CRLF to LF all.

This commit is contained in:
Night Owl 2016-06-04 18:24:23 +05:00
parent e0136428bb
commit 4304846337
300 changed files with 133343 additions and 133343 deletions

View File

@ -1,118 +1,118 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#include <assert.h> #include <assert.h>
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "const.h" #include "const.h"
#include "com_model.h" #include "com_model.h"
#include "studio.h" #include "studio.h"
#include "entity_state.h" #include "entity_state.h"
#include "cl_entity.h" #include "cl_entity.h"
#include "dlight.h" #include "dlight.h"
#include "triangleapi.h" #include "triangleapi.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <memory.h> #include <memory.h>
#include <math.h> #include <math.h>
#include "studio_util.h" #include "studio_util.h"
#include "r_studioint.h" #include "r_studioint.h"
#include "StudioModelRenderer.h" #include "StudioModelRenderer.h"
#include "GameStudioModelRenderer.h" #include "GameStudioModelRenderer.h"
// //
// Override the StudioModelRender virtual member functions here to implement custom bone // Override the StudioModelRender virtual member functions here to implement custom bone
// setup, blending, etc. // setup, blending, etc.
// //
// Global engine <-> studio model rendering code interface // Global engine <-> studio model rendering code interface
extern engine_studio_api_t IEngineStudio; extern engine_studio_api_t IEngineStudio;
// The renderer object, created on the stack. // The renderer object, created on the stack.
CGameStudioModelRenderer g_StudioRenderer; CGameStudioModelRenderer g_StudioRenderer;
/* /*
==================== ====================
CGameStudioModelRenderer CGameStudioModelRenderer
==================== ====================
*/ */
CGameStudioModelRenderer::CGameStudioModelRenderer( void ) CGameStudioModelRenderer::CGameStudioModelRenderer( void )
{ {
} }
//////////////////////////////////// ////////////////////////////////////
// Hooks to class implementation // Hooks to class implementation
//////////////////////////////////// ////////////////////////////////////
/* /*
==================== ====================
R_StudioDrawPlayer R_StudioDrawPlayer
==================== ====================
*/ */
int R_StudioDrawPlayer( int flags, entity_state_t *pplayer ) int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
{ {
return g_StudioRenderer.StudioDrawPlayer( flags, pplayer ); return g_StudioRenderer.StudioDrawPlayer( flags, pplayer );
} }
/* /*
==================== ====================
R_StudioDrawModel R_StudioDrawModel
==================== ====================
*/ */
int R_StudioDrawModel( int flags ) int R_StudioDrawModel( int flags )
{ {
return g_StudioRenderer.StudioDrawModel( flags ); return g_StudioRenderer.StudioDrawModel( flags );
} }
/* /*
==================== ====================
R_StudioInit R_StudioInit
==================== ====================
*/ */
void R_StudioInit( void ) void R_StudioInit( void )
{ {
g_StudioRenderer.Init(); g_StudioRenderer.Init();
} }
// The simple drawing interface we'll pass back to the engine // The simple drawing interface we'll pass back to the engine
r_studio_interface_t studio = r_studio_interface_t studio =
{ {
STUDIO_INTERFACE_VERSION, STUDIO_INTERFACE_VERSION,
R_StudioDrawModel, R_StudioDrawModel,
R_StudioDrawPlayer, R_StudioDrawPlayer,
}; };
/* /*
==================== ====================
HUD_GetStudioModelInterface HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects. Export this function for the engine to use the studio renderer class to render objects.
==================== ====================
*/ */
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio ) extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{ {
if ( version != STUDIO_INTERFACE_VERSION ) if ( version != STUDIO_INTERFACE_VERSION )
return 0; return 0;
// Point the engine to our callbacks // Point the engine to our callbacks
*ppinterface = &studio; *ppinterface = &studio;
// Copy in engine helper functions // Copy in engine helper functions
memcpy( &IEngineStudio, pstudio, sizeof( IEngineStudio ) ); memcpy( &IEngineStudio, pstudio, sizeof( IEngineStudio ) );
// Initialize local variables, etc. // Initialize local variables, etc.
R_StudioInit(); R_StudioInit();
// Success // Success
return 1; return 1;
} }

View File

@ -1,26 +1,26 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( GAMESTUDIOMODELRENDERER_H ) #if !defined( GAMESTUDIOMODELRENDERER_H )
#define GAMESTUDIOMODELRENDERER_H #define GAMESTUDIOMODELRENDERER_H
#if defined( _WIN32 ) #if defined( _WIN32 )
#pragma once #pragma once
#endif #endif
/* /*
==================== ====================
CGameStudioModelRenderer CGameStudioModelRenderer
==================== ====================
*/ */
class CGameStudioModelRenderer : public CStudioModelRenderer class CGameStudioModelRenderer : public CStudioModelRenderer
{ {
public: public:
CGameStudioModelRenderer( void ); CGameStudioModelRenderer( void );
}; };
#endif // GAMESTUDIOMODELRENDERER_H #endif // GAMESTUDIOMODELRENDERER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +1,55 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( GAMESTUDIOMODELRENDERER_H ) #if !defined( GAMESTUDIOMODELRENDERER_H )
#define GAMESTUDIOMODELRENDERER_H #define GAMESTUDIOMODELRENDERER_H
#if defined( _WIN32 ) #if defined( _WIN32 )
#pragma once #pragma once
#endif #endif
/* /*
==================== ====================
CGameStudioModelRenderer CGameStudioModelRenderer
==================== ====================
*/ */
class CGameStudioModelRenderer : public CStudioModelRenderer class CGameStudioModelRenderer : public CStudioModelRenderer
{ {
public: public:
CGameStudioModelRenderer( void ); CGameStudioModelRenderer( void );
// Set up model bone positions // Set up model bone positions
virtual void StudioSetupBones ( void ); virtual void StudioSetupBones ( void );
// Estimate gait frame for player // Estimate gait frame for player
virtual void StudioEstimateGait ( entity_state_t *pplayer ); virtual void StudioEstimateGait ( entity_state_t *pplayer );
// Process movement of player // Process movement of player
virtual void StudioProcessGait ( entity_state_t *pplayer ); virtual void StudioProcessGait ( entity_state_t *pplayer );
// Player drawing code // Player drawing code
virtual int StudioDrawPlayer( int flags, entity_state_t *pplayer ); virtual int StudioDrawPlayer( int flags, entity_state_t *pplayer );
virtual int _StudioDrawPlayer( int flags, entity_state_t *pplayer ); virtual int _StudioDrawPlayer( int flags, entity_state_t *pplayer );
// Apply special effects to transform matrix // Apply special effects to transform matrix
virtual void StudioFxTransform( cl_entity_t *ent, float transform[3][4] ); virtual void StudioFxTransform( cl_entity_t *ent, float transform[3][4] );
private: private:
// For local player, in third person, we need to store real render data and then // For local player, in third person, we need to store real render data and then
// setup for with fake/client side animation data // setup for with fake/client side animation data
void SavePlayerState( entity_state_t *pplayer ); void SavePlayerState( entity_state_t *pplayer );
// Called to set up local player's animation values // Called to set up local player's animation values
void SetupClientAnimation( entity_state_t *pplayer ); void SetupClientAnimation( entity_state_t *pplayer );
// Called to restore original player state information // Called to restore original player state information
void RestorePlayerState( entity_state_t *pplayer ); void RestorePlayerState( entity_state_t *pplayer );
private: private:
// Private data // Private data
bool m_bLocal; bool m_bLocal;
}; };
#endif // GAMESTUDIOMODELRENDERER_H #endif // GAMESTUDIOMODELRENDERER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,189 +1,189 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined ( STUDIOMODELRENDERER_H ) #if !defined ( STUDIOMODELRENDERER_H )
#define STUDIOMODELRENDERER_H #define STUDIOMODELRENDERER_H
#if defined( _WIN32 ) #if defined( _WIN32 )
#pragma once #pragma once
#endif #endif
/* /*
==================== ====================
CStudioModelRenderer CStudioModelRenderer
==================== ====================
*/ */
class CStudioModelRenderer class CStudioModelRenderer
{ {
public: public:
// Construction/Destruction // Construction/Destruction
CStudioModelRenderer( void ); CStudioModelRenderer( void );
virtual ~CStudioModelRenderer( void ); virtual ~CStudioModelRenderer( void );
// Initialization // Initialization
virtual void Init( void ); virtual void Init( void );
public: public:
// Public Interfaces // Public Interfaces
virtual int StudioDrawModel ( int flags ); virtual int StudioDrawModel ( int flags );
virtual int StudioDrawPlayer ( int flags, struct entity_state_s *pplayer ); virtual int StudioDrawPlayer ( int flags, struct entity_state_s *pplayer );
public: public:
// Local interfaces // Local interfaces
// //
// Look up animation data for sequence // Look up animation data for sequence
virtual mstudioanim_t *StudioGetAnim ( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc ); virtual mstudioanim_t *StudioGetAnim ( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc );
// Interpolate model position and angles and set up matrices // Interpolate model position and angles and set up matrices
virtual void StudioSetUpTransform (int trivial_accept); virtual void StudioSetUpTransform (int trivial_accept);
// Set up model bone positions // Set up model bone positions
virtual void StudioSetupBones ( void ); virtual void StudioSetupBones ( void );
// Find final attachment points // Find final attachment points
virtual void StudioCalcAttachments ( void ); virtual void StudioCalcAttachments ( void );
// Save bone matrices and names // Save bone matrices and names
virtual void StudioSaveBones( void ); virtual void StudioSaveBones( void );
// Merge cached bones with current bones for model // Merge cached bones with current bones for model
virtual void StudioMergeBones ( model_t *m_pSubModel ); virtual void StudioMergeBones ( model_t *m_pSubModel );
// Determine interpolation fraction // Determine interpolation fraction
virtual float StudioEstimateInterpolant( void ); virtual float StudioEstimateInterpolant( void );
// Determine current frame for rendering // Determine current frame for rendering
virtual float StudioEstimateFrame ( mstudioseqdesc_t *pseqdesc ); virtual float StudioEstimateFrame ( mstudioseqdesc_t *pseqdesc );
// Apply special effects to transform matrix // Apply special effects to transform matrix
virtual void StudioFxTransform( cl_entity_t *ent, float transform[3][4] ); virtual void StudioFxTransform( cl_entity_t *ent, float transform[3][4] );
// Spherical interpolation of bones // Spherical interpolation of bones
virtual void StudioSlerpBones ( vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s ); virtual void StudioSlerpBones ( vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s );
// Compute bone adjustments ( bone controllers ) // Compute bone adjustments ( bone controllers )
virtual void StudioCalcBoneAdj ( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen ); virtual void StudioCalcBoneAdj ( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen );
// Get bone quaternions // Get bone quaternions
virtual void StudioCalcBoneQuaterion ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q ); virtual void StudioCalcBoneQuaterion ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q );
// Get bone positions // Get bone positions
virtual void StudioCalcBonePosition ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos ); virtual void StudioCalcBonePosition ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos );
// Compute rotations // Compute rotations
virtual void StudioCalcRotations ( float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f ); virtual void StudioCalcRotations ( float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f );
// Send bones and verts to renderer // Send bones and verts to renderer
virtual void StudioRenderModel ( void ); virtual void StudioRenderModel ( void );
// Finalize rendering // Finalize rendering
virtual void StudioRenderFinal (void); virtual void StudioRenderFinal (void);
// GL&D3D vs. Software renderer finishing functions // GL&D3D vs. Software renderer finishing functions
virtual void StudioRenderFinal_Software ( void ); virtual void StudioRenderFinal_Software ( void );
virtual void StudioRenderFinal_Hardware ( void ); virtual void StudioRenderFinal_Hardware ( void );
// Player specific data // Player specific data
// Determine pitch and blending amounts for players // Determine pitch and blending amounts for players
virtual void StudioPlayerBlend ( mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch ); virtual void StudioPlayerBlend ( mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch );
// Estimate gait frame for player // Estimate gait frame for player
virtual void StudioEstimateGait ( entity_state_t *pplayer ); virtual void StudioEstimateGait ( entity_state_t *pplayer );
// Process movement of player // Process movement of player
virtual void StudioProcessGait ( entity_state_t *pplayer ); virtual void StudioProcessGait ( entity_state_t *pplayer );
public: public:
// Client clock // Client clock
double m_clTime; double m_clTime;
// Old Client clock // Old Client clock
double m_clOldTime; double m_clOldTime;
// Do interpolation? // Do interpolation?
int m_fDoInterp; int m_fDoInterp;
// Do gait estimation? // Do gait estimation?
int m_fGaitEstimation; int m_fGaitEstimation;
// Current render frame # // Current render frame #
int m_nFrameCount; int m_nFrameCount;
// Cvars that studio model code needs to reference // Cvars that studio model code needs to reference
// //
// Use high quality models? // Use high quality models?
cvar_t *m_pCvarHiModels; cvar_t *m_pCvarHiModels;
// Developer debug output desired? // Developer debug output desired?
cvar_t *m_pCvarDeveloper; cvar_t *m_pCvarDeveloper;
// Draw entities bone hit boxes, etc? // Draw entities bone hit boxes, etc?
cvar_t *m_pCvarDrawEntities; cvar_t *m_pCvarDrawEntities;
// The entity which we are currently rendering. // The entity which we are currently rendering.
cl_entity_t *m_pCurrentEntity; cl_entity_t *m_pCurrentEntity;
// The model for the entity being rendered // The model for the entity being rendered
model_t *m_pRenderModel; model_t *m_pRenderModel;
// Player info for current player, if drawing a player // Player info for current player, if drawing a player
player_info_t *m_pPlayerInfo; player_info_t *m_pPlayerInfo;
// The index of the player being drawn // The index of the player being drawn
int m_nPlayerIndex; int m_nPlayerIndex;
// The player's gait movement // The player's gait movement
float m_flGaitMovement; float m_flGaitMovement;
// Pointer to header block for studio model data // Pointer to header block for studio model data
studiohdr_t *m_pStudioHeader; studiohdr_t *m_pStudioHeader;
// Pointers to current body part and submodel // Pointers to current body part and submodel
mstudiobodyparts_t *m_pBodyPart; mstudiobodyparts_t *m_pBodyPart;
mstudiomodel_t *m_pSubModel; mstudiomodel_t *m_pSubModel;
// Palette substition for top and bottom of model // Palette substition for top and bottom of model
int m_nTopColor; int m_nTopColor;
int m_nBottomColor; int m_nBottomColor;
// //
// Sprite model used for drawing studio model chrome // Sprite model used for drawing studio model chrome
model_t *m_pChromeSprite; model_t *m_pChromeSprite;
// Caching // Caching
// Number of bones in bone cache // Number of bones in bone cache
int m_nCachedBones; int m_nCachedBones;
// Names of cached bones // Names of cached bones
char m_nCachedBoneNames[ MAXSTUDIOBONES ][ 32 ]; char m_nCachedBoneNames[ MAXSTUDIOBONES ][ 32 ];
// Cached bone & light transformation matrices // Cached bone & light transformation matrices
float m_rgCachedBoneTransform [ MAXSTUDIOBONES ][ 3 ][ 4 ]; float m_rgCachedBoneTransform [ MAXSTUDIOBONES ][ 3 ][ 4 ];
float m_rgCachedLightTransform[ MAXSTUDIOBONES ][ 3 ][ 4 ]; float m_rgCachedLightTransform[ MAXSTUDIOBONES ][ 3 ][ 4 ];
// Software renderer scale factors // Software renderer scale factors
float m_fSoftwareXScale, m_fSoftwareYScale; float m_fSoftwareXScale, m_fSoftwareYScale;
// Current view vectors and render origin // Current view vectors and render origin
float m_vUp[ 3 ]; float m_vUp[ 3 ];
float m_vRight[ 3 ]; float m_vRight[ 3 ];
float m_vNormal[ 3 ]; float m_vNormal[ 3 ];
float m_vRenderOrigin[ 3 ]; float m_vRenderOrigin[ 3 ];
// Model render counters ( from engine ) // Model render counters ( from engine )
int *m_pStudioModelCount; int *m_pStudioModelCount;
int *m_pModelsDrawn; int *m_pModelsDrawn;
// Matrices // Matrices
// Model to world transformation // Model to world transformation
float (*m_protationmatrix)[ 3 ][ 4 ]; float (*m_protationmatrix)[ 3 ][ 4 ];
// Model to view transformation // Model to view transformation
float (*m_paliastransform)[ 3 ][ 4 ]; float (*m_paliastransform)[ 3 ][ 4 ];
// Concatenated bone and light transforms // Concatenated bone and light transforms
float (*m_pbonetransform) [ MAXSTUDIOBONES ][ 3 ][ 4 ]; float (*m_pbonetransform) [ MAXSTUDIOBONES ][ 3 ][ 4 ];
float (*m_plighttransform)[ MAXSTUDIOBONES ][ 3 ][ 4 ]; float (*m_plighttransform)[ MAXSTUDIOBONES ][ 3 ][ 4 ];
}; };
#endif // STUDIOMODELRENDERER_H #endif // STUDIOMODELRENDERER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,62 +1,62 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef __AMMO_H__ #ifndef __AMMO_H__
#define __AMMO_H__ #define __AMMO_H__
#define MAX_WEAPON_NAME 128 #define MAX_WEAPON_NAME 128
#define WEAPON_FLAGS_SELECTONEMPTY 1 #define WEAPON_FLAGS_SELECTONEMPTY 1
#define WEAPON_IS_ONTARGET 0x40 #define WEAPON_IS_ONTARGET 0x40
struct WEAPON struct WEAPON
{ {
char szName[MAX_WEAPON_NAME]; char szName[MAX_WEAPON_NAME];
int iAmmoType; int iAmmoType;
int iAmmo2Type; int iAmmo2Type;
int iMax1; int iMax1;
int iMax2; int iMax2;
int iSlot; int iSlot;
int iSlotPos; int iSlotPos;
int iFlags; int iFlags;
int iId; int iId;
int iClip; int iClip;
int iCount; // # of itesm in plist int iCount; // # of itesm in plist
HSPRITE hActive; HSPRITE hActive;
wrect_t rcActive; wrect_t rcActive;
HSPRITE hInactive; HSPRITE hInactive;
wrect_t rcInactive; wrect_t rcInactive;
HSPRITE hAmmo; HSPRITE hAmmo;
wrect_t rcAmmo; wrect_t rcAmmo;
HSPRITE hAmmo2; HSPRITE hAmmo2;
wrect_t rcAmmo2; wrect_t rcAmmo2;
HSPRITE hCrosshair; HSPRITE hCrosshair;
wrect_t rcCrosshair; wrect_t rcCrosshair;
HSPRITE hAutoaim; HSPRITE hAutoaim;
wrect_t rcAutoaim; wrect_t rcAutoaim;
HSPRITE hZoomedCrosshair; HSPRITE hZoomedCrosshair;
wrect_t rcZoomedCrosshair; wrect_t rcZoomedCrosshair;
HSPRITE hZoomedAutoaim; HSPRITE hZoomedAutoaim;
wrect_t rcZoomedAutoaim; wrect_t rcZoomedAutoaim;
}; };
typedef int AMMO; typedef int AMMO;
#endif #endif

View File

@ -1,159 +1,159 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// ammo_secondary.cpp // ammo_secondary.cpp
// //
// implementation of CHudAmmoSecondary class // implementation of CHudAmmoSecondary class
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "parsemsg.h" #include "parsemsg.h"
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoVal ); DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoVal );
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoIcon ); DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoIcon );
int CHudAmmoSecondary :: Init( void ) int CHudAmmoSecondary :: Init( void )
{ {
HOOK_MESSAGE( SecAmmoVal ); HOOK_MESSAGE( SecAmmoVal );
HOOK_MESSAGE( SecAmmoIcon ); HOOK_MESSAGE( SecAmmoIcon );
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
m_HUD_ammoicon = 0; m_HUD_ammoicon = 0;
for ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ ) for ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
m_iAmmoAmounts[i] = -1; // -1 means don't draw this value m_iAmmoAmounts[i] = -1; // -1 means don't draw this value
Reset(); Reset();
return 1; return 1;
} }
void CHudAmmoSecondary :: Reset( void ) void CHudAmmoSecondary :: Reset( void )
{ {
m_fFade = 0; m_fFade = 0;
} }
int CHudAmmoSecondary :: VidInit( void ) int CHudAmmoSecondary :: VidInit( void )
{ {
return 1; return 1;
} }
int CHudAmmoSecondary :: Draw(float flTime) int CHudAmmoSecondary :: Draw(float flTime)
{ {
if ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) ) if ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
return 1; return 1;
// draw secondary ammo icons above normal ammo readout // draw secondary ammo icons above normal ammo readout
int a, x, y, r, g, b, AmmoWidth; int a, x, y, r, g, b, AmmoWidth;
UnpackRGB( r, g, b, RGB_YELLOWISH ); UnpackRGB( r, g, b, RGB_YELLOWISH );
a = (int) max( MIN_ALPHA, m_fFade ); a = (int) max( MIN_ALPHA, m_fFade );
if (m_fFade > 0) if (m_fFade > 0)
m_fFade -= (gHUD.m_flTimeDelta * 20); // slowly lower alpha to fade out icons m_fFade -= (gHUD.m_flTimeDelta * 20); // slowly lower alpha to fade out icons
ScaleColors( r, g, b, a ); ScaleColors( r, g, b, a );
AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left; AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
y = ScreenHeight - (gHUD.m_iFontHeight*4); // this is one font height higher than the weapon ammo values y = ScreenHeight - (gHUD.m_iFontHeight*4); // this is one font height higher than the weapon ammo values
x = ScreenWidth - AmmoWidth; x = ScreenWidth - AmmoWidth;
if ( m_HUD_ammoicon ) if ( m_HUD_ammoicon )
{ {
// Draw the ammo icon // Draw the ammo icon
x -= (gHUD.GetSpriteRect(m_HUD_ammoicon).right - gHUD.GetSpriteRect(m_HUD_ammoicon).left); x -= (gHUD.GetSpriteRect(m_HUD_ammoicon).right - gHUD.GetSpriteRect(m_HUD_ammoicon).left);
y -= (gHUD.GetSpriteRect(m_HUD_ammoicon).top - gHUD.GetSpriteRect(m_HUD_ammoicon).bottom); y -= (gHUD.GetSpriteRect(m_HUD_ammoicon).top - gHUD.GetSpriteRect(m_HUD_ammoicon).bottom);
SPR_Set( gHUD.GetSprite(m_HUD_ammoicon), r, g, b ); SPR_Set( gHUD.GetSprite(m_HUD_ammoicon), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_ammoicon) ); SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_ammoicon) );
} }
else else
{ // move the cursor by the '0' char instead, since we don't have an icon to work with { // move the cursor by the '0' char instead, since we don't have an icon to work with
x -= AmmoWidth; x -= AmmoWidth;
y -= (gHUD.GetSpriteRect(gHUD.m_HUD_number_0).top - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).bottom); y -= (gHUD.GetSpriteRect(gHUD.m_HUD_number_0).top - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).bottom);
} }
// draw the ammo counts, in reverse order, from right to left // draw the ammo counts, in reverse order, from right to left
for ( int i = MAX_SEC_AMMO_VALUES-1; i >= 0; i-- ) for ( int i = MAX_SEC_AMMO_VALUES-1; i >= 0; i-- )
{ {
if ( m_iAmmoAmounts[i] < 0 ) if ( m_iAmmoAmounts[i] < 0 )
continue; // negative ammo amounts imply that they shouldn't be drawn continue; // negative ammo amounts imply that they shouldn't be drawn
// half a char gap between the ammo number and the previous pic // half a char gap between the ammo number and the previous pic
x -= (AmmoWidth / 2); x -= (AmmoWidth / 2);
// draw the number, right-aligned // draw the number, right-aligned
x -= (gHUD.GetNumWidth( m_iAmmoAmounts[i], DHN_DRAWZERO ) * AmmoWidth); x -= (gHUD.GetNumWidth( m_iAmmoAmounts[i], DHN_DRAWZERO ) * AmmoWidth);
gHUD.DrawHudNumber( x, y, DHN_DRAWZERO, m_iAmmoAmounts[i], r, g, b ); gHUD.DrawHudNumber( x, y, DHN_DRAWZERO, m_iAmmoAmounts[i], r, g, b );
if ( i != 0 ) if ( i != 0 )
{ {
// draw the divider bar // draw the divider bar
x -= (AmmoWidth / 2); x -= (AmmoWidth / 2);
FillRGBA(x, y, (AmmoWidth/10), gHUD.m_iFontHeight, r, g, b, a); FillRGBA(x, y, (AmmoWidth/10), gHUD.m_iFontHeight, r, g, b, a);
} }
} }
return 1; return 1;
} }
// Message handler for Secondary Ammo Value // Message handler for Secondary Ammo Value
// accepts one value: // accepts one value:
// string: sprite name // string: sprite name
int CHudAmmoSecondary :: MsgFunc_SecAmmoIcon( const char *pszName, int iSize, void *pbuf ) int CHudAmmoSecondary :: MsgFunc_SecAmmoIcon( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
m_HUD_ammoicon = gHUD.GetSpriteIndex( READ_STRING() ); m_HUD_ammoicon = gHUD.GetSpriteIndex( READ_STRING() );
return 1; return 1;
} }
// Message handler for Secondary Ammo Icon // Message handler for Secondary Ammo Icon
// Sets an ammo value // Sets an ammo value
// takes two values: // takes two values:
// byte: ammo index // byte: ammo index
// byte: ammo value // byte: ammo value
int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, void *pbuf ) int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int index = READ_BYTE(); int index = READ_BYTE();
if ( index < 0 || index >= MAX_SEC_AMMO_VALUES ) if ( index < 0 || index >= MAX_SEC_AMMO_VALUES )
return 1; return 1;
m_iAmmoAmounts[index] = READ_BYTE(); m_iAmmoAmounts[index] = READ_BYTE();
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
// check to see if there is anything left to draw // check to see if there is anything left to draw
int count = 0; int count = 0;
for ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ ) for ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
{ {
count += max( 0, m_iAmmoAmounts[i] ); count += max( 0, m_iAmmoAmounts[i] );
} }
if ( count == 0 ) if ( count == 0 )
{ // the ammo fields are all empty, so turn off this hud area { // the ammo fields are all empty, so turn off this hud area
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
return 1; return 1;
} }
// make the icons light up // make the icons light up
m_fFade = 200.0f; m_fFade = 200.0f;
return 1; return 1;
} }

View File

@ -1,192 +1,192 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// ammohistory.cpp // ammohistory.cpp
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "ammohistory.h" #include "ammohistory.h"
HistoryResource gHR; HistoryResource gHR;
#define AMMO_PICKUP_GAP (gHR.iHistoryGap+5) #define AMMO_PICKUP_GAP (gHR.iHistoryGap+5)
#define AMMO_PICKUP_PICK_HEIGHT (32 + (gHR.iHistoryGap * 2)) #define AMMO_PICKUP_PICK_HEIGHT (32 + (gHR.iHistoryGap * 2))
#define AMMO_PICKUP_HEIGHT_MAX (ScreenHeight - 100) #define AMMO_PICKUP_HEIGHT_MAX (ScreenHeight - 100)
#define MAX_ITEM_NAME 32 #define MAX_ITEM_NAME 32
int HISTORY_DRAW_TIME = 5; int HISTORY_DRAW_TIME = 5;
// keep a list of items // keep a list of items
struct ITEM_INFO struct ITEM_INFO
{ {
char szName[MAX_ITEM_NAME]; char szName[MAX_ITEM_NAME];
HSPRITE spr; HSPRITE spr;
wrect_t rect; wrect_t rect;
}; };
void HistoryResource :: AddToHistory( int iType, int iId, int iCount ) void HistoryResource :: AddToHistory( int iType, int iId, int iCount )
{ {
if ( iType == HISTSLOT_AMMO && !iCount ) if ( iType == HISTSLOT_AMMO && !iCount )
return; // no amount, so don't add return; // no amount, so don't add
if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) ) if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) )
{ // the pic would have to be drawn too high { // the pic would have to be drawn too high
// so start from the bottom // so start from the bottom
iCurrentHistorySlot = 0; iCurrentHistorySlot = 0;
} }
HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot
HISTORY_DRAW_TIME = CVAR_GET_FLOAT( "hud_drawhistory_time" ); HISTORY_DRAW_TIME = CVAR_GET_FLOAT( "hud_drawhistory_time" );
freeslot->type = iType; freeslot->type = iType;
freeslot->iId = iId; freeslot->iId = iId;
freeslot->iCount = iCount; freeslot->iCount = iCount;
freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME; freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;
} }
void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount ) void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount )
{ {
if ( iType != HISTSLOT_ITEM ) if ( iType != HISTSLOT_ITEM )
return; return;
if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) ) if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) )
{ // the pic would have to be drawn too high { // the pic would have to be drawn too high
// so start from the bottom // so start from the bottom
iCurrentHistorySlot = 0; iCurrentHistorySlot = 0;
} }
HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot
// I am really unhappy with all the code in this file // I am really unhappy with all the code in this file
int i = gHUD.GetSpriteIndex( szName ); int i = gHUD.GetSpriteIndex( szName );
if ( i == -1 ) if ( i == -1 )
return; // unknown sprite name, don't add it to history return; // unknown sprite name, don't add it to history
freeslot->iId = i; freeslot->iId = i;
freeslot->type = iType; freeslot->type = iType;
freeslot->iCount = iCount; freeslot->iCount = iCount;
HISTORY_DRAW_TIME = CVAR_GET_FLOAT( "hud_drawhistory_time" ); HISTORY_DRAW_TIME = CVAR_GET_FLOAT( "hud_drawhistory_time" );
freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME; freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;
} }
void HistoryResource :: CheckClearHistory( void ) void HistoryResource :: CheckClearHistory( void )
{ {
for ( int i = 0; i < MAX_HISTORY; i++ ) for ( int i = 0; i < MAX_HISTORY; i++ )
{ {
if ( rgAmmoHistory[i].type ) if ( rgAmmoHistory[i].type )
return; return;
} }
iCurrentHistorySlot = 0; iCurrentHistorySlot = 0;
} }
// //
// Draw Ammo pickup history // Draw Ammo pickup history
// //
int HistoryResource :: DrawAmmoHistory( float flTime ) int HistoryResource :: DrawAmmoHistory( float flTime )
{ {
for ( int i = 0; i < MAX_HISTORY; i++ ) for ( int i = 0; i < MAX_HISTORY; i++ )
{ {
if ( rgAmmoHistory[i].type ) if ( rgAmmoHistory[i].type )
{ {
rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
if ( rgAmmoHistory[i].DisplayTime <= flTime ) if ( rgAmmoHistory[i].DisplayTime <= flTime )
{ // pic drawing time has expired { // pic drawing time has expired
memset( &rgAmmoHistory[i], 0, sizeof(HIST_ITEM) ); memset( &rgAmmoHistory[i], 0, sizeof(HIST_ITEM) );
CheckClearHistory(); CheckClearHistory();
} }
else if ( rgAmmoHistory[i].type == HISTSLOT_AMMO ) else if ( rgAmmoHistory[i].type == HISTSLOT_AMMO )
{ {
wrect_t rcPic; wrect_t rcPic;
HSPRITE *spr = gWR.GetAmmoPicFromWeapon( rgAmmoHistory[i].iId, rcPic ); HSPRITE *spr = gWR.GetAmmoPicFromWeapon( rgAmmoHistory[i].iId, rcPic );
int r, g, b; int r, g, b;
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80; float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) ); ScaleColors(r, g, b, min(scale, 255) );
// Draw the pic // Draw the pic
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - 24; int xpos = ScreenWidth - 24;
if ( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic if ( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic
{ // the dll has to make sure it has sent info the weapons you need { // the dll has to make sure it has sent info the weapons you need
SPR_Set( *spr, r, g, b ); SPR_Set( *spr, r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &rcPic ); SPR_DrawAdditive( 0, xpos, ypos, &rcPic );
} }
// do not draw black console string // do not draw black console string
if( !(( hud_textmode->value == 2 ) && ( scale < 200 )) ) if( !(( hud_textmode->value == 2 ) && ( scale < 200 )) )
// Draw the number // Draw the number
gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b ); gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b );
} }
else if ( rgAmmoHistory[i].type == HISTSLOT_WEAP ) else if ( rgAmmoHistory[i].type == HISTSLOT_WEAP )
{ {
WEAPON *weap = gWR.GetWeapon( rgAmmoHistory[i].iId ); WEAPON *weap = gWR.GetWeapon( rgAmmoHistory[i].iId );
if ( !weap ) if ( !weap )
return 1; // we don't know about the weapon yet, so don't draw anything return 1; // we don't know about the weapon yet, so don't draw anything
int r, g, b; int r, g, b;
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
if ( !gWR.HasAmmo( weap ) ) if ( !gWR.HasAmmo( weap ) )
UnpackRGB(r,g,b, RGB_REDISH); // if the weapon doesn't have ammo, display it as red UnpackRGB(r,g,b, RGB_REDISH); // if the weapon doesn't have ammo, display it as red
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80; float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) ); ScaleColors(r, g, b, min(scale, 255) );
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - (weap->rcInactive.right - weap->rcInactive.left); int xpos = ScreenWidth - (weap->rcInactive.right - weap->rcInactive.left);
SPR_Set( weap->hInactive, r, g, b ); SPR_Set( weap->hInactive, r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &weap->rcInactive ); SPR_DrawAdditive( 0, xpos, ypos, &weap->rcInactive );
} }
else if ( rgAmmoHistory[i].type == HISTSLOT_ITEM ) else if ( rgAmmoHistory[i].type == HISTSLOT_ITEM )
{ {
int r, g, b; int r, g, b;
if ( !rgAmmoHistory[i].iId ) if ( !rgAmmoHistory[i].iId )
continue; // sprite not loaded continue; // sprite not loaded
wrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId ); wrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId );
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80; float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) ); ScaleColors(r, g, b, min(scale, 255) );
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - (rect.right - rect.left) - 10; int xpos = ScreenWidth - (rect.right - rect.left) - 10;
SPR_Set( gHUD.GetSprite( rgAmmoHistory[i].iId ), r, g, b ); SPR_Set( gHUD.GetSprite( rgAmmoHistory[i].iId ), r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &rect ); SPR_DrawAdditive( 0, xpos, ypos, &rect );
} }
} }
} }
return 1; return 1;
} }

View File

@ -1,143 +1,143 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// ammohistory.h // ammohistory.h
// //
// this is the max number of items in each bucket // this is the max number of items in each bucket
#define MAX_WEAPON_POSITIONS MAX_WEAPON_SLOTS #define MAX_WEAPON_POSITIONS MAX_WEAPON_SLOTS
class WeaponsResource class WeaponsResource
{ {
private: private:
// Information about weapons & ammo // Information about weapons & ammo
WEAPON rgWeapons[MAX_WEAPONS]; // Weapons Array WEAPON rgWeapons[MAX_WEAPONS]; // Weapons Array
// counts of weapons * ammo // counts of weapons * ammo
WEAPON* rgSlots[MAX_WEAPON_SLOTS+1][MAX_WEAPON_POSITIONS+1]; // The slots currently in use by weapons. The value is a pointer to the weapon; if it's NULL, no weapon is there WEAPON* rgSlots[MAX_WEAPON_SLOTS+1][MAX_WEAPON_POSITIONS+1]; // The slots currently in use by weapons. The value is a pointer to the weapon; if it's NULL, no weapon is there
int riAmmo[MAX_AMMO_TYPES]; // count of each ammo type int riAmmo[MAX_AMMO_TYPES]; // count of each ammo type
public: public:
void Init( void ) void Init( void )
{ {
memset( rgWeapons, 0, sizeof rgWeapons ); memset( rgWeapons, 0, sizeof rgWeapons );
Reset(); Reset();
} }
void Reset( void ) void Reset( void )
{ {
iOldWeaponBits = 0; iOldWeaponBits = 0;
memset( rgSlots, 0, sizeof rgSlots ); memset( rgSlots, 0, sizeof rgSlots );
memset( riAmmo, 0, sizeof riAmmo ); memset( riAmmo, 0, sizeof riAmmo );
} }
///// WEAPON ///// ///// WEAPON /////
int iOldWeaponBits; int iOldWeaponBits;
WEAPON *GetWeapon( int iId ) { return &rgWeapons[iId]; } WEAPON *GetWeapon( int iId ) { return &rgWeapons[iId]; }
void AddWeapon( WEAPON *wp ) void AddWeapon( WEAPON *wp )
{ {
rgWeapons[ wp->iId ] = *wp; rgWeapons[ wp->iId ] = *wp;
LoadWeaponSprites( &rgWeapons[ wp->iId ] ); LoadWeaponSprites( &rgWeapons[ wp->iId ] );
} }
void PickupWeapon( WEAPON *wp ) void PickupWeapon( WEAPON *wp )
{ {
rgSlots[ wp->iSlot ][ wp->iSlotPos ] = wp; rgSlots[ wp->iSlot ][ wp->iSlotPos ] = wp;
} }
void DropWeapon( WEAPON *wp ) void DropWeapon( WEAPON *wp )
{ {
rgSlots[ wp->iSlot ][ wp->iSlotPos ] = NULL; rgSlots[ wp->iSlot ][ wp->iSlotPos ] = NULL;
} }
void DropAllWeapons( void ) void DropAllWeapons( void )
{ {
for ( int i = 0; i < MAX_WEAPONS; i++ ) for ( int i = 0; i < MAX_WEAPONS; i++ )
{ {
if ( rgWeapons[i].iId ) if ( rgWeapons[i].iId )
DropWeapon( &rgWeapons[i] ); DropWeapon( &rgWeapons[i] );
} }
} }
WEAPON* GetWeaponSlot( int slot, int pos ) { return rgSlots[slot][pos]; } WEAPON* GetWeaponSlot( int slot, int pos ) { return rgSlots[slot][pos]; }
void LoadWeaponSprites( WEAPON* wp ); void LoadWeaponSprites( WEAPON* wp );
void LoadAllWeaponSprites( void ); void LoadAllWeaponSprites( void );
WEAPON* GetFirstPos( int iSlot ); WEAPON* GetFirstPos( int iSlot );
void SelectSlot( int iSlot, int fAdvance, int iDirection ); void SelectSlot( int iSlot, int fAdvance, int iDirection );
WEAPON* GetNextActivePos( int iSlot, int iSlotPos ); WEAPON* GetNextActivePos( int iSlot, int iSlotPos );
int HasAmmo( WEAPON *p ); int HasAmmo( WEAPON *p );
///// AMMO ///// ///// AMMO /////
AMMO GetAmmo( int iId ) { return iId; } AMMO GetAmmo( int iId ) { return iId; }
void SetAmmo( int iId, int iCount ) { riAmmo[ iId ] = iCount; } void SetAmmo( int iId, int iCount ) { riAmmo[ iId ] = iCount; }
int CountAmmo( int iId ); int CountAmmo( int iId );
HSPRITE* GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect ); HSPRITE* GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect );
}; };
extern WeaponsResource gWR; extern WeaponsResource gWR;
#define MAX_HISTORY 12 #define MAX_HISTORY 12
enum { enum {
HISTSLOT_EMPTY, HISTSLOT_EMPTY,
HISTSLOT_AMMO, HISTSLOT_AMMO,
HISTSLOT_WEAP, HISTSLOT_WEAP,
HISTSLOT_ITEM, HISTSLOT_ITEM,
}; };
class HistoryResource class HistoryResource
{ {
private: private:
struct HIST_ITEM { struct HIST_ITEM {
int type; int type;
float DisplayTime; // the time at which this item should be removed from the history float DisplayTime; // the time at which this item should be removed from the history
int iCount; int iCount;
int iId; int iId;
}; };
HIST_ITEM rgAmmoHistory[MAX_HISTORY]; HIST_ITEM rgAmmoHistory[MAX_HISTORY];
public: public:
void Init( void ) void Init( void )
{ {
Reset(); Reset();
} }
void Reset( void ) void Reset( void )
{ {
memset( rgAmmoHistory, 0, sizeof rgAmmoHistory ); memset( rgAmmoHistory, 0, sizeof rgAmmoHistory );
} }
int iHistoryGap; int iHistoryGap;
int iCurrentHistorySlot; int iCurrentHistorySlot;
void AddToHistory( int iType, int iId, int iCount = 0 ); void AddToHistory( int iType, int iId, int iCount = 0 );
void AddToHistory( int iType, const char *szName, int iCount = 0 ); void AddToHistory( int iType, const char *szName, int iCount = 0 );
void CheckClearHistory( void ); void CheckClearHistory( void );
int DrawAmmoHistory( float flTime ); int DrawAmmoHistory( float flTime );
}; };
extern HistoryResource gHR; extern HistoryResource gHR;

View File

@ -1,138 +1,138 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// battery.cpp // battery.cpp
// //
// implementation of CHudBattery class // implementation of CHudBattery class
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
DECLARE_MESSAGE(m_Battery, Battery) DECLARE_MESSAGE(m_Battery, Battery)
int CHudBattery::Init(void) int CHudBattery::Init(void)
{ {
m_iBat = 0; m_iBat = 0;
m_fFade = 0; m_fFade = 0;
m_iFlags = 0; m_iFlags = 0;
HOOK_MESSAGE(Battery); HOOK_MESSAGE(Battery);
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
return 1; return 1;
}; };
int CHudBattery::VidInit(void) int CHudBattery::VidInit(void)
{ {
int HUD_suit_empty = gHUD.GetSpriteIndex( "suit_empty" ); int HUD_suit_empty = gHUD.GetSpriteIndex( "suit_empty" );
int HUD_suit_full = gHUD.GetSpriteIndex( "suit_full" ); int HUD_suit_full = gHUD.GetSpriteIndex( "suit_full" );
m_hSprite1 = m_hSprite2 = 0; // delaying get sprite handles until we know the sprites are loaded m_hSprite1 = m_hSprite2 = 0; // delaying get sprite handles until we know the sprites are loaded
m_prc1 = &gHUD.GetSpriteRect( HUD_suit_empty ); m_prc1 = &gHUD.GetSpriteRect( HUD_suit_empty );
m_prc2 = &gHUD.GetSpriteRect( HUD_suit_full ); m_prc2 = &gHUD.GetSpriteRect( HUD_suit_full );
m_iHeight = m_prc2->bottom - m_prc1->top; m_iHeight = m_prc2->bottom - m_prc1->top;
m_fFade = 0; m_fFade = 0;
return 1; return 1;
}; };
int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf ) int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
{ {
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int x = READ_SHORT(); int x = READ_SHORT();
if (x != m_iBat) if (x != m_iBat)
{ {
m_fFade = FADE_TIME; m_fFade = FADE_TIME;
m_iBat = x; m_iBat = x;
} }
return 1; return 1;
} }
int CHudBattery::Draw(float flTime) int CHudBattery::Draw(float flTime)
{ {
if ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH ) if ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
return 1; return 1;
int r, g, b, x, y, a; int r, g, b, x, y, a;
wrect_t rc; wrect_t rc;
rc = *m_prc2; rc = *m_prc2;
rc.top += m_iHeight * ((float)(100-(min(100,m_iBat))) * 0.01); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1 rc.top += m_iHeight * ((float)(100-(min(100,m_iBat))) * 0.01); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) )) if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1; return 1;
// Has health changed? Flash the health # // Has health changed? Flash the health #
if (m_fFade) if (m_fFade)
{ {
if (m_fFade > FADE_TIME) if (m_fFade > FADE_TIME)
m_fFade = FADE_TIME; m_fFade = FADE_TIME;
m_fFade -= (gHUD.m_flTimeDelta * 20); m_fFade -= (gHUD.m_flTimeDelta * 20);
if (m_fFade <= 0) if (m_fFade <= 0)
{ {
a = 128; a = 128;
m_fFade = 0; m_fFade = 0;
} }
// Fade the health number back to dim // Fade the health number back to dim
a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128; a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128;
} }
else else
a = MIN_ALPHA; a = MIN_ALPHA;
ScaleColors(r, g, b, a ); ScaleColors(r, g, b, a );
int iOffset = (m_prc1->bottom - m_prc1->top)/6; int iOffset = (m_prc1->bottom - m_prc1->top)/6;
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2; y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = ScreenWidth/5; x = ScreenWidth/5;
// make sure we have the right sprite handles // make sure we have the right sprite handles
if ( !m_hSprite1 ) if ( !m_hSprite1 )
m_hSprite1 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_empty" ) ); m_hSprite1 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_empty" ) );
if ( !m_hSprite2 ) if ( !m_hSprite2 )
m_hSprite2 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_full" ) ); m_hSprite2 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_full" ) );
SPR_Set(m_hSprite1, r, g, b ); SPR_Set(m_hSprite1, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset, m_prc1); SPR_DrawAdditive( 0, x, y - iOffset, m_prc1);
if (rc.bottom > rc.top) if (rc.bottom > rc.top)
{ {
SPR_Set(m_hSprite2, r, g, b ); SPR_Set(m_hSprite2, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset + (rc.top - m_prc2->top), &rc); SPR_DrawAdditive( 0, x, y - iOffset + (rc.top - m_prc2->top), &rc);
} }
x += (m_prc1->right - m_prc1->left); x += (m_prc1->right - m_prc1->left);
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b); x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b);
return 1; return 1;
} }

View File

@ -1,24 +1,24 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
// Camera.h -- defines and such for a 3rd person camera // Camera.h -- defines and such for a 3rd person camera
// NOTE: must include quakedef.h first // NOTE: must include quakedef.h first
#ifndef _CAMERA_H_ #ifndef _CAMERA_H_
#define _CAMERA_H_ #define _CAMERA_H_
// pitch, yaw, dist // pitch, yaw, dist
extern vec3_t cam_ofs; extern vec3_t cam_ofs;
// Using third person camera // Using third person camera
extern int cam_thirdperson; extern int cam_thirdperson;
void CAM_Init( void ); void CAM_Init( void );
void CAM_ClearStates( void ); void CAM_ClearStates( void );
void CAM_StartMouseMove(void); void CAM_StartMouseMove(void);
void CAM_EndMouseMove(void); void CAM_EndMouseMove(void);
#endif // _CAMERA_H_ #endif // _CAMERA_H_

View File

@ -1,278 +1,278 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// cdll_int.c // cdll_int.c
// //
// this implementation handles the linking of the engine to the DLL // this implementation handles the linking of the engine to the DLL
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "netadr.h" #include "netadr.h"
extern "C" extern "C"
{ {
#include "pm_shared.h" #include "pm_shared.h"
} }
#include <string.h> #include <string.h>
cl_enginefunc_t gEngfuncs; cl_enginefunc_t gEngfuncs;
CHud gHUD; CHud gHUD;
mobile_engfuncs_t *gMobileEngfuncs = NULL; mobile_engfuncs_t *gMobileEngfuncs = NULL;
void InitInput (void); void InitInput (void);
void EV_HookEvents( void ); void EV_HookEvents( void );
void IN_Commands( void ); void IN_Commands( void );
/* /*
========================== ==========================
Initialize Initialize
Called when the DLL is first loaded. Called when the DLL is first loaded.
========================== ==========================
*/ */
extern "C" extern "C"
{ {
int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ); int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion );
int DLLEXPORT HUD_VidInit( void ); int DLLEXPORT HUD_VidInit( void );
void DLLEXPORT HUD_Init( void ); void DLLEXPORT HUD_Init( void );
int DLLEXPORT HUD_Redraw( float flTime, int intermission ); int DLLEXPORT HUD_Redraw( float flTime, int intermission );
int DLLEXPORT HUD_UpdateClientData( client_data_t *cdata, float flTime ); int DLLEXPORT HUD_UpdateClientData( client_data_t *cdata, float flTime );
void DLLEXPORT HUD_Reset ( void ); void DLLEXPORT HUD_Reset ( void );
void DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server ); void DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server );
void DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove ); void DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove );
char DLLEXPORT HUD_PlayerMoveTexture( char *name ); char DLLEXPORT HUD_PlayerMoveTexture( char *name );
int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs ); int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs );
void DLLEXPORT HUD_Frame( double time ); void DLLEXPORT HUD_Frame( double time );
void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking); void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking);
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf ); void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf );
void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs ); void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs );
} }
/* /*
================================ ================================
HUD_GetHullBounds HUD_GetHullBounds
Engine calls this to enumerate player collision hulls, for prediction. Return 0 if the hullnumber doesn't exist. Engine calls this to enumerate player collision hulls, for prediction. Return 0 if the hullnumber doesn't exist.
================================ ================================
*/ */
int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs ) int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs )
{ {
int iret = 0; int iret = 0;
switch ( hullnumber ) switch ( hullnumber )
{ {
case 0: // Normal player case 0: // Normal player
mins = Vector(-16, -16, -36); mins = Vector(-16, -16, -36);
maxs = Vector(16, 16, 36); maxs = Vector(16, 16, 36);
iret = 1; iret = 1;
break; break;
case 1: // Crouched player case 1: // Crouched player
mins = Vector(-16, -16, -18 ); mins = Vector(-16, -16, -18 );
maxs = Vector(16, 16, 18 ); maxs = Vector(16, 16, 18 );
iret = 1; iret = 1;
break; break;
case 2: // Point based hull case 2: // Point based hull
mins = Vector( 0, 0, 0 ); mins = Vector( 0, 0, 0 );
maxs = Vector( 0, 0, 0 ); maxs = Vector( 0, 0, 0 );
iret = 1; iret = 1;
break; break;
} }
return iret; return iret;
} }
/* /*
================================ ================================
HUD_ConnectionlessPacket HUD_ConnectionlessPacket
Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max
size of the response_buffer, so you must zero it out if you choose not to respond. size of the response_buffer, so you must zero it out if you choose not to respond.
================================ ================================
*/ */
int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ) int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
{ {
// Parse stuff from args // Parse stuff from args
int max_buffer_size = *response_buffer_size; int max_buffer_size = *response_buffer_size;
// Zero it out since we aren't going to respond. // Zero it out since we aren't going to respond.
// If we wanted to response, we'd write data into response_buffer // If we wanted to response, we'd write data into response_buffer
*response_buffer_size = 0; *response_buffer_size = 0;
// Since we don't listen for anything here, just respond that it's a bogus message // Since we don't listen for anything here, just respond that it's a bogus message
// If we didn't reject the message, we'd return 1 for success instead. // If we didn't reject the message, we'd return 1 for success instead.
return 0; return 0;
} }
void DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove ) void DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove )
{ {
PM_Init( ppmove ); PM_Init( ppmove );
} }
char DLLEXPORT HUD_PlayerMoveTexture( char *name ) char DLLEXPORT HUD_PlayerMoveTexture( char *name )
{ {
return PM_FindTextureType( name ); return PM_FindTextureType( name );
} }
void DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server ) void DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server )
{ {
PM_Move( ppmove, server ); PM_Move( ppmove, server );
} }
int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ) int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
{ {
gEngfuncs = *pEnginefuncs; gEngfuncs = *pEnginefuncs;
if (iVersion != CLDLL_INTERFACE_VERSION) if (iVersion != CLDLL_INTERFACE_VERSION)
return 0; return 0;
memcpy(&gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t)); memcpy(&gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t));
EV_HookEvents(); EV_HookEvents();
return 1; return 1;
} }
/* /*
========================== ==========================
HUD_VidInit HUD_VidInit
Called when the game initializes Called when the game initializes
and whenever the vid_mode is changed and whenever the vid_mode is changed
so the HUD can reinitialize itself. so the HUD can reinitialize itself.
========================== ==========================
*/ */
int DLLEXPORT HUD_VidInit( void ) int DLLEXPORT HUD_VidInit( void )
{ {
gHUD.VidInit(); gHUD.VidInit();
return 1; return 1;
} }
/* /*
========================== ==========================
HUD_Init HUD_Init
Called whenever the client connects Called whenever the client connects
to a server. Reinitializes all to a server. Reinitializes all
the hud variables. the hud variables.
========================== ==========================
*/ */
void DLLEXPORT HUD_Init( void ) void DLLEXPORT HUD_Init( void )
{ {
InitInput(); InitInput();
gHUD.Init(); gHUD.Init();
} }
/* /*
========================== ==========================
HUD_Redraw HUD_Redraw
called every screen frame to called every screen frame to
redraw the HUD. redraw the HUD.
=========================== ===========================
*/ */
int DLLEXPORT HUD_Redraw( float time, int intermission ) int DLLEXPORT HUD_Redraw( float time, int intermission )
{ {
gHUD.Redraw( time, intermission ); gHUD.Redraw( time, intermission );
return 1; return 1;
} }
/* /*
========================== ==========================
HUD_UpdateClientData HUD_UpdateClientData
called every time shared client called every time shared client
dll/engine data gets changed, dll/engine data gets changed,
and gives the cdll a chance and gives the cdll a chance
to modify the data. to modify the data.
returns 1 if anything has been changed, 0 otherwise. returns 1 if anything has been changed, 0 otherwise.
========================== ==========================
*/ */
int DLLEXPORT HUD_UpdateClientData(client_data_t *pcldata, float flTime ) int DLLEXPORT HUD_UpdateClientData(client_data_t *pcldata, float flTime )
{ {
IN_Commands(); IN_Commands();
return gHUD.UpdateClientData(pcldata, flTime ); return gHUD.UpdateClientData(pcldata, flTime );
} }
/* /*
========================== ==========================
HUD_Reset HUD_Reset
Called at start and end of demos to restore to "non"HUD state. Called at start and end of demos to restore to "non"HUD state.
========================== ==========================
*/ */
void DLLEXPORT HUD_Reset( void ) void DLLEXPORT HUD_Reset( void )
{ {
gHUD.VidInit(); gHUD.VidInit();
} }
/* /*
========================== ==========================
HUD_Frame HUD_Frame
Called by engine every frame that client .dll is loaded Called by engine every frame that client .dll is loaded
========================== ==========================
*/ */
void DLLEXPORT HUD_Frame( double time ) void DLLEXPORT HUD_Frame( double time )
{ {
} }
/* /*
========================== ==========================
HUD_VoiceStatus HUD_VoiceStatus
Called when a player starts or stops talking. Called when a player starts or stops talking.
========================== ==========================
*/ */
void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking) void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking)
{ {
} }
/* /*
========================== ==========================
HUD_DirectorEvent HUD_DirectorEvent
Called when a director event message was received Called when a director event message was received
========================== ==========================
*/ */
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf ) void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf )
{ {
gHUD.m_Spectator.DirectorMessage( iSize, pbuf ); gHUD.m_Spectator.DirectorMessage( iSize, pbuf );
} }
void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs ) void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs )
{ {
if( gpMobileEngfuncs->version != MOBILITY_API_VERSION ) if( gpMobileEngfuncs->version != MOBILITY_API_VERSION )
return; return;
gMobileEngfuncs = gpMobileEngfuncs; gMobileEngfuncs = gpMobileEngfuncs;
} }

View File

@ -1,46 +1,46 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// cl_dll.h // cl_dll.h
// //
// 4-23-98 JOHN // 4-23-98 JOHN
// //
// This DLL is linked by the client when they first initialize. // This DLL is linked by the client when they first initialize.
// This DLL is responsible for the following tasks: // This DLL is responsible for the following tasks:
// - Loading the HUD graphics upon initialization // - Loading the HUD graphics upon initialization
// - Drawing the HUD graphics every frame // - Drawing the HUD graphics every frame
// - Handling the custum HUD-update packets // - Handling the custum HUD-update packets
// //
typedef unsigned char byte; typedef unsigned char byte;
typedef unsigned short word; typedef unsigned short word;
typedef float vec_t; typedef float vec_t;
typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "util_vector.h" #include "util_vector.h"
#include "../engine/cdll_int.h" #include "../engine/cdll_int.h"
#include "../dlls/cdll_dll.h" #include "../dlls/cdll_dll.h"
#ifndef __MSC_VER #ifndef __MSC_VER
#define _cdecl #define _cdecl
#endif #endif
#include "exportdef.h" #include "exportdef.h"
#include <string.h> #include <string.h>
extern cl_enginefunc_t gEngfuncs; extern cl_enginefunc_t gEngfuncs;
#include "../engine/mobility_int.h" #include "../engine/mobility_int.h"
extern mobile_engfuncs_t *gMobileEngfuncs; extern mobile_engfuncs_t *gMobileEngfuncs;

View File

@ -1,176 +1,176 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// cl_util.h // cl_util.h
// //
#include "exportdef.h" #include "exportdef.h"
#include "cvardef.h" #include "cvardef.h"
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
#endif #endif
// Macros to hook function calls into the HUD object // Macros to hook function calls into the HUD object
#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x ); #define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x );
#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \ #define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \
{ \ { \
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \ return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
} }
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y ); #define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \ #define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
{ \ { \
gHUD.y.UserCmd_##x( ); \ gHUD.y.UserCmd_##x( ); \
} }
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); } inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); } inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) { return gEngfuncs.pfnRegisterVariable( (char*)cv, (char*)val, flags ); } inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) { return gEngfuncs.pfnRegisterVariable( (char*)cv, (char*)val, flags ); }
#define SPR_Load (*gEngfuncs.pfnSPR_Load) #define SPR_Load (*gEngfuncs.pfnSPR_Load)
#define SPR_Set (*gEngfuncs.pfnSPR_Set) #define SPR_Set (*gEngfuncs.pfnSPR_Set)
#define SPR_Frames (*gEngfuncs.pfnSPR_Frames) #define SPR_Frames (*gEngfuncs.pfnSPR_Frames)
#define SPR_GetList (*gEngfuncs.pfnSPR_GetList) #define SPR_GetList (*gEngfuncs.pfnSPR_GetList)
// SPR_Draw draws a the current sprite as solid // SPR_Draw draws a the current sprite as solid
#define SPR_Draw (*gEngfuncs.pfnSPR_Draw) #define SPR_Draw (*gEngfuncs.pfnSPR_Draw)
// SPR_DrawHoles draws the current sprites, with color index255 not drawn (transparent) // SPR_DrawHoles draws the current sprites, with color index255 not drawn (transparent)
#define SPR_DrawHoles (*gEngfuncs.pfnSPR_DrawHoles) #define SPR_DrawHoles (*gEngfuncs.pfnSPR_DrawHoles)
// SPR_DrawAdditive adds the sprites RGB values to the background (additive transulency) // SPR_DrawAdditive adds the sprites RGB values to the background (additive transulency)
#define SPR_DrawAdditive (*gEngfuncs.pfnSPR_DrawAdditive) #define SPR_DrawAdditive (*gEngfuncs.pfnSPR_DrawAdditive)
// SPR_EnableScissor sets a clipping rect for HUD sprites. (0,0) is the top-left hand corner of the screen. // SPR_EnableScissor sets a clipping rect for HUD sprites. (0,0) is the top-left hand corner of the screen.
#define SPR_EnableScissor (*gEngfuncs.pfnSPR_EnableScissor) #define SPR_EnableScissor (*gEngfuncs.pfnSPR_EnableScissor)
// SPR_DisableScissor disables the clipping rect // SPR_DisableScissor disables the clipping rect
#define SPR_DisableScissor (*gEngfuncs.pfnSPR_DisableScissor) #define SPR_DisableScissor (*gEngfuncs.pfnSPR_DisableScissor)
// //
#define FillRGBA (*gEngfuncs.pfnFillRGBA) #define FillRGBA (*gEngfuncs.pfnFillRGBA)
// ScreenHeight returns the height of the screen, in pixels // ScreenHeight returns the height of the screen, in pixels
#define ScreenHeight (gHUD.m_scrinfo.iHeight) #define ScreenHeight (gHUD.m_scrinfo.iHeight)
// ScreenWidth returns the width of the screen, in pixels // ScreenWidth returns the width of the screen, in pixels
#define ScreenWidth (gHUD.m_scrinfo.iWidth) #define ScreenWidth (gHUD.m_scrinfo.iWidth)
// Use this to set any co-ords in 640x480 space // Use this to set any co-ords in 640x480 space
#define XRES(x) ((int)(float(x) * ((float)ScreenWidth / 640.0f) + 0.5f)) #define XRES(x) ((int)(float(x) * ((float)ScreenWidth / 640.0f) + 0.5f))
#define YRES(y) ((int)(float(y) * ((float)ScreenHeight / 480.0f) + 0.5f)) #define YRES(y) ((int)(float(y) * ((float)ScreenHeight / 480.0f) + 0.5f))
// use this to project world coordinates to screen coordinates // use this to project world coordinates to screen coordinates
#define XPROJECT(x) ( (1.0f+(x))*ScreenWidth*0.5f ) #define XPROJECT(x) ( (1.0f+(x))*ScreenWidth*0.5f )
#define YPROJECT(y) ( (1.0f-(y))*ScreenHeight*0.5f ) #define YPROJECT(y) ( (1.0f-(y))*ScreenHeight*0.5f )
#define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo) #define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo)
#define ServerCmd (*gEngfuncs.pfnServerCmd) #define ServerCmd (*gEngfuncs.pfnServerCmd)
#define ClientCmd (*gEngfuncs.pfnClientCmd) #define ClientCmd (*gEngfuncs.pfnClientCmd)
#define SetCrosshair (*gEngfuncs.pfnSetCrosshair) #define SetCrosshair (*gEngfuncs.pfnSetCrosshair)
#define AngleVectors (*gEngfuncs.pfnAngleVectors) #define AngleVectors (*gEngfuncs.pfnAngleVectors)
extern cvar_t *hud_textmode; extern cvar_t *hud_textmode;
extern float g_hud_text_color[3]; extern float g_hud_text_color[3];
inline void DrawSetTextColor(float r, float g, float b) inline void DrawSetTextColor(float r, float g, float b)
{ {
if( hud_textmode->value == 1 ) if( hud_textmode->value == 1 )
g_hud_text_color[0]=r, g_hud_text_color[1] = g, g_hud_text_color[2] = b; g_hud_text_color[0]=r, g_hud_text_color[1] = g, g_hud_text_color[2] = b;
else else
gEngfuncs.pfnDrawSetTextColor( r, g, b ); gEngfuncs.pfnDrawSetTextColor( r, g, b );
} }
// Gets the height & width of a sprite, at the specified frame // Gets the height & width of a sprite, at the specified frame
inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); } inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); }
inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); } inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); }
inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); } inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); }
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b ) inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
{ {
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b ); return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
} }
inline int DrawConsoleString( int x, int y, const char *string ) inline int DrawConsoleString( int x, int y, const char *string )
{ {
if( hud_textmode->value == 1 ) if( hud_textmode->value == 1 )
return gHUD.DrawHudString( x, y, 9999, (char*)string, 255*g_hud_text_color[0], 255*g_hud_text_color[1], 255*g_hud_text_color[2]); return gHUD.DrawHudString( x, y, 9999, (char*)string, 255*g_hud_text_color[0], 255*g_hud_text_color[1], 255*g_hud_text_color[2]);
return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string ); return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string );
} }
inline void GetConsoleStringSize( const char *string, int *width, int *height ) inline void GetConsoleStringSize( const char *string, int *width, int *height )
{ {
if( hud_textmode->value == 1 ) if( hud_textmode->value == 1 )
*height = 13, *width = gHUD.DrawHudStringLen( (char*)string ); *height = 13, *width = gHUD.DrawHudStringLen( (char*)string );
else else
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height ); gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
} }
inline int ConsoleStringLen( const char *string ) inline int ConsoleStringLen( const char *string )
{ {
int _width = 0, _height = 0; int _width = 0, _height = 0;
if( hud_textmode->value == 1 ) if( hud_textmode->value == 1 )
return gHUD.DrawHudStringLen((char*)string); return gHUD.DrawHudStringLen((char*)string);
GetConsoleStringSize( string, &_width, &_height ); GetConsoleStringSize( string, &_width, &_height );
return _width; return _width;
} }
inline void ConsolePrint( const char *string ) inline void ConsolePrint( const char *string )
{ {
gEngfuncs.pfnConsolePrint( string ); gEngfuncs.pfnConsolePrint( string );
} }
inline void CenterPrint( const char *string ) inline void CenterPrint( const char *string )
{ {
gEngfuncs.pfnCenterPrint( string ); gEngfuncs.pfnCenterPrint( string );
} }
// returns the players name of entity no. // returns the players name of entity no.
#define GetPlayerInfo (*gEngfuncs.pfnGetPlayerInfo) #define GetPlayerInfo (*gEngfuncs.pfnGetPlayerInfo)
// sound functions // sound functions
inline void PlaySound( char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); } inline void PlaySound( char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }
inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); } inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); }
#define max(a, b) (((a) > (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b))
#define fabs(x) ((x) > 0 ? (x) : 0 - (x)) #define fabs(x) ((x) > 0 ? (x) : 0 - (x))
void ScaleColors( int &r, int &g, int &b, int a ); void ScaleColors( int &r, int &g, int &b, int a );
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
inline void VectorClear(float *a) { a[0]=0.0;a[1]=0.0;a[2]=0.0;} inline void VectorClear(float *a) { a[0]=0.0;a[1]=0.0;a[2]=0.0;}
float Length(const float *v); float Length(const float *v);
void VectorMA (const float *veca, float scale, const float *vecb, float *vecc); void VectorMA (const float *veca, float scale, const float *vecb, float *vecc);
void VectorScale (const float *in, float scale, float *out); void VectorScale (const float *in, float scale, float *out);
float VectorNormalize (float *v); float VectorNormalize (float *v);
void VectorInverse ( float *v ); void VectorInverse ( float *v );
extern vec3_t vec3_origin; extern vec3_t vec3_origin;
// disable 'possible loss of data converting float to int' warning message // disable 'possible loss of data converting float to int' warning message
#pragma warning( disable: 4244 ) #pragma warning( disable: 4244 )
// disable 'truncation from 'const double' to 'float' warning message // disable 'truncation from 'const double' to 'float' warning message
#pragma warning( disable: 4305 ) #pragma warning( disable: 4305 )
inline void UnpackRGB(int &r, int &g, int &b, unsigned long ulRGB)\ inline void UnpackRGB(int &r, int &g, int &b, unsigned long ulRGB)\
{\ {\
r = (ulRGB & 0xFF0000) >>16;\ r = (ulRGB & 0xFF0000) >>16;\
g = (ulRGB & 0xFF00) >> 8;\ g = (ulRGB & 0xFF00) >> 8;\
b = ulRGB & 0xFF;\ b = ulRGB & 0xFF;\
} }
HSPRITE LoadSprite(const char *pszName); HSPRITE LoadSprite(const char *pszName);

View File

@ -1,277 +1,277 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// Com_Weapons.cpp // Com_Weapons.cpp
// Shared weapons common/shared functions // Shared weapons common/shared functions
#include <stdarg.h> #include <stdarg.h>
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "com_weapons.h" #include "com_weapons.h"
#include "const.h" #include "const.h"
#include "entity_state.h" #include "entity_state.h"
#include "r_efx.h" #include "r_efx.h"
// g_runfuncs is true if this is the first time we've "predicated" a particular movement/firing // g_runfuncs is true if this is the first time we've "predicated" a particular movement/firing
// command. If it is 1, then we should play events/sounds etc., otherwise, we just will be // command. If it is 1, then we should play events/sounds etc., otherwise, we just will be
// updating state info, but not firing events // updating state info, but not firing events
int g_runfuncs = 0; int g_runfuncs = 0;
// During our weapon prediction processing, we'll need to reference some data that is part of // During our weapon prediction processing, we'll need to reference some data that is part of
// the final state passed into the postthink functionality. We'll set this pointer and then // the final state passed into the postthink functionality. We'll set this pointer and then
// reset it to NULL as appropriate // reset it to NULL as appropriate
struct local_state_s *g_finalstate = NULL; struct local_state_s *g_finalstate = NULL;
/* /*
==================== ====================
COM_Log COM_Log
Log debug messages to file ( appends ) Log debug messages to file ( appends )
==================== ====================
*/ */
void COM_Log( char *pszFile, char *fmt, ...) void COM_Log( char *pszFile, char *fmt, ...)
{ {
va_list argptr; va_list argptr;
char string[1024]; char string[1024];
FILE *fp; FILE *fp;
char *pfilename; char *pfilename;
if ( !pszFile ) if ( !pszFile )
{ {
pfilename = "c:\\hllog.txt"; pfilename = "c:\\hllog.txt";
} }
else else
{ {
pfilename = pszFile; pfilename = pszFile;
} }
va_start (argptr,fmt); va_start (argptr,fmt);
vsprintf (string, fmt,argptr); vsprintf (string, fmt,argptr);
va_end (argptr); va_end (argptr);
fp = fopen( pfilename, "a+t"); fp = fopen( pfilename, "a+t");
if (fp) if (fp)
{ {
fprintf(fp, "%s", string); fprintf(fp, "%s", string);
fclose(fp); fclose(fp);
} }
} }
// remember the current animation for the view model, in case we get out of sync with // remember the current animation for the view model, in case we get out of sync with
// server. // server.
static int g_currentanim; static int g_currentanim;
/* /*
===================== =====================
HUD_SendWeaponAnim HUD_SendWeaponAnim
Change weapon model animation Change weapon model animation
===================== =====================
*/ */
void HUD_SendWeaponAnim( int iAnim, int body, int force ) void HUD_SendWeaponAnim( int iAnim, int body, int force )
{ {
// Don't actually change it. // Don't actually change it.
if ( !g_runfuncs && !force ) if ( !g_runfuncs && !force )
return; return;
g_currentanim = iAnim; g_currentanim = iAnim;
// Tell animation system new info // Tell animation system new info
gEngfuncs.pfnWeaponAnim( iAnim, body ); gEngfuncs.pfnWeaponAnim( iAnim, body );
} }
/* /*
===================== =====================
HUD_GetWeaponAnim HUD_GetWeaponAnim
Retrieve current predicted weapon animation Retrieve current predicted weapon animation
===================== =====================
*/ */
int HUD_GetWeaponAnim( void ) int HUD_GetWeaponAnim( void )
{ {
return g_currentanim; return g_currentanim;
} }
/* /*
===================== =====================
HUD_PlaySound HUD_PlaySound
Play a sound, if we are seeing this command for the first time Play a sound, if we are seeing this command for the first time
===================== =====================
*/ */
void HUD_PlaySound( char *sound, float volume ) void HUD_PlaySound( char *sound, float volume )
{ {
if ( !g_runfuncs || !g_finalstate ) if ( !g_runfuncs || !g_finalstate )
return; return;
gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin ); gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin );
} }
/* /*
===================== =====================
HUD_PlaybackEvent HUD_PlaybackEvent
Directly queue up an event on the client Directly queue up an event on the client
===================== =====================
*/ */
void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay,
float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ) float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 )
{ {
vec3_t org; vec3_t org;
vec3_t ang; vec3_t ang;
if ( !g_runfuncs || !g_finalstate ) if ( !g_runfuncs || !g_finalstate )
return; return;
// Weapon prediction events are assumed to occur at the player's origin // Weapon prediction events are assumed to occur at the player's origin
org = g_finalstate->playerstate.origin; org = g_finalstate->playerstate.origin;
ang = v_angles; ang = v_angles;
gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, (float *)&org, (float *)&ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 ); gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, (float *)&org, (float *)&ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 );
} }
/* /*
===================== =====================
HUD_SetMaxSpeed HUD_SetMaxSpeed
===================== =====================
*/ */
void HUD_SetMaxSpeed( const edict_t *ed, float speed ) void HUD_SetMaxSpeed( const edict_t *ed, float speed )
{ {
} }
/* /*
===================== =====================
UTIL_WeaponTimeBase UTIL_WeaponTimeBase
Always 0.0 on client, even if not predicting weapons ( won't get called Always 0.0 on client, even if not predicting weapons ( won't get called
in that case ) in that case )
===================== =====================
*/ */
float UTIL_WeaponTimeBase( void ) float UTIL_WeaponTimeBase( void )
{ {
return 0.0; return 0.0;
} }
static unsigned int glSeed = 0; static unsigned int glSeed = 0;
unsigned int seed_table[ 256 ] = unsigned int seed_table[ 256 ] =
{ {
28985, 27138, 26457, 9451, 17764, 10909, 28790, 8716, 6361, 4853, 17798, 21977, 19643, 20662, 10834, 20103, 28985, 27138, 26457, 9451, 17764, 10909, 28790, 8716, 6361, 4853, 17798, 21977, 19643, 20662, 10834, 20103,
27067, 28634, 18623, 25849, 8576, 26234, 23887, 18228, 32587, 4836, 3306, 1811, 3035, 24559, 18399, 315, 27067, 28634, 18623, 25849, 8576, 26234, 23887, 18228, 32587, 4836, 3306, 1811, 3035, 24559, 18399, 315,
26766, 907, 24102, 12370, 9674, 2972, 10472, 16492, 22683, 11529, 27968, 30406, 13213, 2319, 23620, 16823, 26766, 907, 24102, 12370, 9674, 2972, 10472, 16492, 22683, 11529, 27968, 30406, 13213, 2319, 23620, 16823,
10013, 23772, 21567, 1251, 19579, 20313, 18241, 30130, 8402, 20807, 27354, 7169, 21211, 17293, 5410, 19223, 10013, 23772, 21567, 1251, 19579, 20313, 18241, 30130, 8402, 20807, 27354, 7169, 21211, 17293, 5410, 19223,
10255, 22480, 27388, 9946, 15628, 24389, 17308, 2370, 9530, 31683, 25927, 23567, 11694, 26397, 32602, 15031, 10255, 22480, 27388, 9946, 15628, 24389, 17308, 2370, 9530, 31683, 25927, 23567, 11694, 26397, 32602, 15031,
18255, 17582, 1422, 28835, 23607, 12597, 20602, 10138, 5212, 1252, 10074, 23166, 19823, 31667, 5902, 24630, 18255, 17582, 1422, 28835, 23607, 12597, 20602, 10138, 5212, 1252, 10074, 23166, 19823, 31667, 5902, 24630,
18948, 14330, 14950, 8939, 23540, 21311, 22428, 22391, 3583, 29004, 30498, 18714, 4278, 2437, 22430, 3439, 18948, 14330, 14950, 8939, 23540, 21311, 22428, 22391, 3583, 29004, 30498, 18714, 4278, 2437, 22430, 3439,
28313, 23161, 25396, 13471, 19324, 15287, 2563, 18901, 13103, 16867, 9714, 14322, 15197, 26889, 19372, 26241, 28313, 23161, 25396, 13471, 19324, 15287, 2563, 18901, 13103, 16867, 9714, 14322, 15197, 26889, 19372, 26241,
31925, 14640, 11497, 8941, 10056, 6451, 28656, 10737, 13874, 17356, 8281, 25937, 1661, 4850, 7448, 12744, 31925, 14640, 11497, 8941, 10056, 6451, 28656, 10737, 13874, 17356, 8281, 25937, 1661, 4850, 7448, 12744,
21826, 5477, 10167, 16705, 26897, 8839, 30947, 27978, 27283, 24685, 32298, 3525, 12398, 28726, 9475, 10208, 21826, 5477, 10167, 16705, 26897, 8839, 30947, 27978, 27283, 24685, 32298, 3525, 12398, 28726, 9475, 10208,
617, 13467, 22287, 2376, 6097, 26312, 2974, 9114, 21787, 28010, 4725, 15387, 3274, 10762, 31695, 17320, 617, 13467, 22287, 2376, 6097, 26312, 2974, 9114, 21787, 28010, 4725, 15387, 3274, 10762, 31695, 17320,
18324, 12441, 16801, 27376, 22464, 7500, 5666, 18144, 15314, 31914, 31627, 6495, 5226, 31203, 2331, 4668, 18324, 12441, 16801, 27376, 22464, 7500, 5666, 18144, 15314, 31914, 31627, 6495, 5226, 31203, 2331, 4668,
12650, 18275, 351, 7268, 31319, 30119, 7600, 2905, 13826, 11343, 13053, 15583, 30055, 31093, 5067, 761, 12650, 18275, 351, 7268, 31319, 30119, 7600, 2905, 13826, 11343, 13053, 15583, 30055, 31093, 5067, 761,
9685, 11070, 21369, 27155, 3663, 26542, 20169, 12161, 15411, 30401, 7580, 31784, 8985, 29367, 20989, 14203, 9685, 11070, 21369, 27155, 3663, 26542, 20169, 12161, 15411, 30401, 7580, 31784, 8985, 29367, 20989, 14203,
29694, 21167, 10337, 1706, 28578, 887, 3373, 19477, 14382, 675, 7033, 15111, 26138, 12252, 30996, 21409, 29694, 21167, 10337, 1706, 28578, 887, 3373, 19477, 14382, 675, 7033, 15111, 26138, 12252, 30996, 21409,
25678, 18555, 13256, 23316, 22407, 16727, 991, 9236, 5373, 29402, 6117, 15241, 27715, 19291, 19888, 19847 25678, 18555, 13256, 23316, 22407, 16727, 991, 9236, 5373, 29402, 6117, 15241, 27715, 19291, 19888, 19847
}; };
unsigned int U_Random( void ) unsigned int U_Random( void )
{ {
glSeed *= 69069; glSeed *= 69069;
glSeed += seed_table[ glSeed & 0xff ]; glSeed += seed_table[ glSeed & 0xff ];
return ( ++glSeed & 0x0fffffff ); return ( ++glSeed & 0x0fffffff );
} }
void U_Srand( unsigned int seed ) void U_Srand( unsigned int seed )
{ {
glSeed = seed_table[ seed & 0xff ]; glSeed = seed_table[ seed & 0xff ];
} }
/* /*
===================== =====================
UTIL_SharedRandomLong UTIL_SharedRandomLong
===================== =====================
*/ */
int UTIL_SharedRandomLong( unsigned int seed, int low, int high ) int UTIL_SharedRandomLong( unsigned int seed, int low, int high )
{ {
unsigned int range; unsigned int range;
U_Srand( (int)seed + low + high ); U_Srand( (int)seed + low + high );
range = high - low + 1; range = high - low + 1;
if ( !(range - 1) ) if ( !(range - 1) )
{ {
return low; return low;
} }
else else
{ {
int offset; int offset;
int rnum; int rnum;
rnum = U_Random(); rnum = U_Random();
offset = rnum % range; offset = rnum % range;
return (low + offset); return (low + offset);
} }
} }
/* /*
===================== =====================
UTIL_SharedRandomFloat UTIL_SharedRandomFloat
===================== =====================
*/ */
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high ) float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
{ {
// //
unsigned int range; unsigned int range;
U_Srand( (int)seed + *(int *)&low + *(int *)&high ); U_Srand( (int)seed + *(int *)&low + *(int *)&high );
U_Random(); U_Random();
U_Random(); U_Random();
range = high - low; range = high - low;
if ( !range ) if ( !range )
{ {
return low; return low;
} }
else else
{ {
int tensixrand; int tensixrand;
float offset; float offset;
tensixrand = U_Random() & 65535; tensixrand = U_Random() & 65535;
offset = (float)tensixrand / 65536.0; offset = (float)tensixrand / 65536.0;
return (low + offset * range ); return (low + offset * range );
} }
} }
/* /*
====================== ======================
stub_* stub_*
stub functions for such things as precaching. So we don't have to modify weapons code that stub functions for such things as precaching. So we don't have to modify weapons code that
is compiled into both game and client .dlls. is compiled into both game and client .dlls.
====================== ======================
*/ */
int stub_PrecacheModel ( char* s ) { return 0; } int stub_PrecacheModel ( char* s ) { return 0; }
int stub_PrecacheSound ( char* s ) { return 0; } int stub_PrecacheSound ( char* s ) { return 0; }
unsigned short stub_PrecacheEvent ( int type, const char *s ) { return 0; } unsigned short stub_PrecacheEvent ( int type, const char *s ) { return 0; }
const char *stub_NameForFunction ( unsigned long function ) { return "func"; } const char *stub_NameForFunction ( unsigned long function ) { return "func"; }
void stub_SetModel ( edict_t *e, const char *m ) {} void stub_SetModel ( edict_t *e, const char *m ) {}

View File

@ -1,48 +1,48 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
// com_weapons.h // com_weapons.h
// Shared weapons common function prototypes // Shared weapons common function prototypes
#if !defined( COM_WEAPONSH ) #if !defined( COM_WEAPONSH )
#define COM_WEAPONSH #define COM_WEAPONSH
#ifdef _WIN32 #ifdef _WIN32
#pragma once #pragma once
#endif #endif
#include "hud_iface.h" #include "hud_iface.h"
extern "C" extern "C"
{ {
void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed ); void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );
} }
void COM_Log( char *pszFile, char *fmt, ...); void COM_Log( char *pszFile, char *fmt, ...);
int CL_IsDead( void ); int CL_IsDead( void );
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high ); float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
int UTIL_SharedRandomLong( unsigned int seed, int low, int high ); int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
int HUD_GetWeaponAnim( void ); int HUD_GetWeaponAnim( void );
void HUD_SendWeaponAnim( int iAnim, int body, int force ); void HUD_SendWeaponAnim( int iAnim, int body, int force );
void HUD_PlaySound( char *sound, float volume ); void HUD_PlaySound( char *sound, float volume );
void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void HUD_SetMaxSpeed( const struct edict_s *ed, float speed ); void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
int stub_PrecacheModel( char* s ); int stub_PrecacheModel( char* s );
int stub_PrecacheSound( char* s ); int stub_PrecacheSound( char* s );
unsigned short stub_PrecacheEvent( int type, const char *s ); unsigned short stub_PrecacheEvent( int type, const char *s );
const char *stub_NameForFunction ( unsigned long function ); const char *stub_NameForFunction ( unsigned long function );
void stub_SetModel ( struct edict_s *e, const char *m ); void stub_SetModel ( struct edict_s *e, const char *m );
extern cvar_t *cl_lw; extern cvar_t *cl_lw;
extern int g_runfuncs; extern int g_runfuncs;
extern vec3_t v_angles; extern vec3_t v_angles;
extern float g_lastFOV; extern float g_lastFOV;
extern struct local_state_s *g_finalstate; extern struct local_state_s *g_finalstate;
#endif #endif

View File

@ -1,304 +1,304 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// death notice // death notice
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
DECLARE_MESSAGE( m_DeathNotice, DeathMsg ); DECLARE_MESSAGE( m_DeathNotice, DeathMsg );
struct DeathNoticeItem { struct DeathNoticeItem {
char szKiller[MAX_PLAYER_NAME_LENGTH*2]; char szKiller[MAX_PLAYER_NAME_LENGTH*2];
char szVictim[MAX_PLAYER_NAME_LENGTH*2]; char szVictim[MAX_PLAYER_NAME_LENGTH*2];
int iId; // the index number of the associated sprite int iId; // the index number of the associated sprite
int iSuicide; int iSuicide;
int iTeamKill; int iTeamKill;
int iNonPlayerKill; int iNonPlayerKill;
float flDisplayTime; float flDisplayTime;
float *KillerColor; float *KillerColor;
float *VictimColor; float *VictimColor;
}; };
#define MAX_DEATHNOTICES 4 #define MAX_DEATHNOTICES 4
static int DEATHNOTICE_DISPLAY_TIME = 6; static int DEATHNOTICE_DISPLAY_TIME = 6;
#define DEATHNOTICE_TOP 32 #define DEATHNOTICE_TOP 32
DeathNoticeItem rgDeathNoticeList[ MAX_DEATHNOTICES + 1 ]; DeathNoticeItem rgDeathNoticeList[ MAX_DEATHNOTICES + 1 ];
float g_ColorBlue[3] = { 0.6, 0.8, 1.0 }; float g_ColorBlue[3] = { 0.6, 0.8, 1.0 };
float g_ColorRed[3] = { 1.0, 0.25, 0.25 }; float g_ColorRed[3] = { 1.0, 0.25, 0.25 };
float g_ColorGreen[3] = { 0.6, 1.0, 0.6 }; float g_ColorGreen[3] = { 0.6, 1.0, 0.6 };
float g_ColorYellow[3] = { 1.0, 0.7, 0.0 }; float g_ColorYellow[3] = { 1.0, 0.7, 0.0 };
float g_ColorGrey[3] = { 0.8, 0.8, 0.8 }; float g_ColorGrey[3] = { 0.8, 0.8, 0.8 };
float *GetClientColor( int clientIndex ) float *GetClientColor( int clientIndex )
{ {
switch ( g_PlayerExtraInfo[clientIndex].teamnumber ) switch ( g_PlayerExtraInfo[clientIndex].teamnumber )
{ {
case 1: return g_ColorBlue; case 1: return g_ColorBlue;
case 2: return g_ColorRed; case 2: return g_ColorRed;
case 3: return g_ColorYellow; case 3: return g_ColorYellow;
case 4: return g_ColorGreen; case 4: return g_ColorGreen;
case 0: return g_ColorYellow; case 0: return g_ColorYellow;
default : return g_ColorGrey; default : return g_ColorGrey;
} }
return NULL; return NULL;
} }
int CHudDeathNotice :: Init( void ) int CHudDeathNotice :: Init( void )
{ {
gHUD.AddHudElem( this ); gHUD.AddHudElem( this );
HOOK_MESSAGE( DeathMsg ); HOOK_MESSAGE( DeathMsg );
CVAR_CREATE( "hud_deathnotice_time", "6", 0 ); CVAR_CREATE( "hud_deathnotice_time", "6", 0 );
return 1; return 1;
} }
void CHudDeathNotice :: InitHUDData( void ) void CHudDeathNotice :: InitHUDData( void )
{ {
memset( rgDeathNoticeList, 0, sizeof(rgDeathNoticeList) ); memset( rgDeathNoticeList, 0, sizeof(rgDeathNoticeList) );
} }
int CHudDeathNotice :: VidInit( void ) int CHudDeathNotice :: VidInit( void )
{ {
m_HUD_d_skull = gHUD.GetSpriteIndex( "d_skull" ); m_HUD_d_skull = gHUD.GetSpriteIndex( "d_skull" );
return 1; return 1;
} }
int CHudDeathNotice :: Draw( float flTime ) int CHudDeathNotice :: Draw( float flTime )
{ {
int x, y, r, g, b; int x, y, r, g, b;
for ( int i = 0; i < MAX_DEATHNOTICES; i++ ) for ( int i = 0; i < MAX_DEATHNOTICES; i++ )
{ {
if ( rgDeathNoticeList[i].iId == 0 ) if ( rgDeathNoticeList[i].iId == 0 )
break; // we've gone through them all break; // we've gone through them all
if ( rgDeathNoticeList[i].flDisplayTime < flTime ) if ( rgDeathNoticeList[i].flDisplayTime < flTime )
{ // display time has expired { // display time has expired
// remove the current item from the list // remove the current item from the list
memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i+1], sizeof(DeathNoticeItem) * (MAX_DEATHNOTICES - i) ); memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i+1], sizeof(DeathNoticeItem) * (MAX_DEATHNOTICES - i) );
i--; // continue on the next item; stop the counter getting incremented i--; // continue on the next item; stop the counter getting incremented
continue; continue;
} }
rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
// Only draw if the viewport will let me // Only draw if the viewport will let me
// vgui dropped out // vgui dropped out
//if ( gViewPort && gViewPort->AllowedToPrintText() ) //if ( gViewPort && gViewPort->AllowedToPrintText() )
{ {
// Draw the death notice // Draw the death notice
y = YRES(DEATHNOTICE_TOP) + 2 + (20 * i); //!!! y = YRES(DEATHNOTICE_TOP) + 2 + (20 * i); //!!!
int id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId; int id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId;
x = ScreenWidth - ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left); x = ScreenWidth - ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
if ( !rgDeathNoticeList[i].iSuicide ) if ( !rgDeathNoticeList[i].iSuicide )
{ {
x -= (5 + ConsoleStringLen( rgDeathNoticeList[i].szKiller ) ); x -= (5 + ConsoleStringLen( rgDeathNoticeList[i].szKiller ) );
// Draw killers name // Draw killers name
if ( rgDeathNoticeList[i].KillerColor ) if ( rgDeathNoticeList[i].KillerColor )
DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] ); DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] );
x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller ); x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );
} }
r = 255; g = 80; b = 0; r = 255; g = 80; b = 0;
if ( rgDeathNoticeList[i].iTeamKill ) if ( rgDeathNoticeList[i].iTeamKill )
{ {
r = 10; g = 240; b = 10; // display it in sickly green r = 10; g = 240; b = 10; // display it in sickly green
} }
// Draw death weapon // Draw death weapon
SPR_Set( gHUD.GetSprite(id), r, g, b ); SPR_Set( gHUD.GetSprite(id), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(id) ); SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(id) );
x += (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left); x += (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
// Draw victims name (if it was a player that was killed) // Draw victims name (if it was a player that was killed)
if (rgDeathNoticeList[i].iNonPlayerKill == FALSE) if (rgDeathNoticeList[i].iNonPlayerKill == FALSE)
{ {
if ( rgDeathNoticeList[i].VictimColor ) if ( rgDeathNoticeList[i].VictimColor )
DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] ); DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );
x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim ); x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );
} }
} }
} }
return 1; return 1;
} }
// This message handler may be better off elsewhere // This message handler may be better off elsewhere
int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf ) int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf )
{ {
int i; int i;
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int killer = READ_BYTE(); int killer = READ_BYTE();
int victim = READ_BYTE(); int victim = READ_BYTE();
char killedwith[32]; char killedwith[32];
strcpy( killedwith, "d_" ); strcpy( killedwith, "d_" );
strncat( killedwith, READ_STRING(), 32 ); strncat( killedwith, READ_STRING(), 32 );
gHUD.m_Spectator.DeathMessage(victim); gHUD.m_Spectator.DeathMessage(victim);
for ( i = 0; i < MAX_DEATHNOTICES; i++ ) for ( i = 0; i < MAX_DEATHNOTICES; i++ )
{ {
if ( rgDeathNoticeList[i].iId == 0 ) if ( rgDeathNoticeList[i].iId == 0 )
break; break;
} }
if ( i == MAX_DEATHNOTICES ) if ( i == MAX_DEATHNOTICES )
{ // move the rest of the list forward to make room for this item { // move the rest of the list forward to make room for this item
memmove( rgDeathNoticeList, rgDeathNoticeList+1, sizeof(DeathNoticeItem) * MAX_DEATHNOTICES ); memmove( rgDeathNoticeList, rgDeathNoticeList+1, sizeof(DeathNoticeItem) * MAX_DEATHNOTICES );
i = MAX_DEATHNOTICES - 1; i = MAX_DEATHNOTICES - 1;
} }
//if (gViewPort) //if (gViewPort)
// gViewPort->GetAllPlayersInfo(); // gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo(); gHUD.m_Scoreboard.GetAllPlayersInfo();
// Get the Killer's name // Get the Killer's name
char *killer_name = g_PlayerInfoList[ killer ].name; char *killer_name = g_PlayerInfoList[ killer ].name;
if ( !killer_name ) if ( !killer_name )
{ {
killer_name = ""; killer_name = "";
rgDeathNoticeList[i].szKiller[0] = 0; rgDeathNoticeList[i].szKiller[0] = 0;
} }
else else
{ {
rgDeathNoticeList[i].KillerColor = GetClientColor( killer ); rgDeathNoticeList[i].KillerColor = GetClientColor( killer );
strncpy( rgDeathNoticeList[i].szKiller, killer_name, MAX_PLAYER_NAME_LENGTH ); strncpy( rgDeathNoticeList[i].szKiller, killer_name, MAX_PLAYER_NAME_LENGTH );
rgDeathNoticeList[i].szKiller[MAX_PLAYER_NAME_LENGTH-1] = 0; rgDeathNoticeList[i].szKiller[MAX_PLAYER_NAME_LENGTH-1] = 0;
} }
// Get the Victim's name // Get the Victim's name
char *victim_name = NULL; char *victim_name = NULL;
// If victim is -1, the killer killed a specific, non-player object (like a sentrygun) // If victim is -1, the killer killed a specific, non-player object (like a sentrygun)
if ( ((char)victim) != -1 ) if ( ((char)victim) != -1 )
victim_name = g_PlayerInfoList[ victim ].name; victim_name = g_PlayerInfoList[ victim ].name;
if ( !victim_name ) if ( !victim_name )
{ {
victim_name = ""; victim_name = "";
rgDeathNoticeList[i].szVictim[0] = 0; rgDeathNoticeList[i].szVictim[0] = 0;
} }
else else
{ {
rgDeathNoticeList[i].VictimColor = GetClientColor( victim ); rgDeathNoticeList[i].VictimColor = GetClientColor( victim );
strncpy( rgDeathNoticeList[i].szVictim, victim_name, MAX_PLAYER_NAME_LENGTH ); strncpy( rgDeathNoticeList[i].szVictim, victim_name, MAX_PLAYER_NAME_LENGTH );
rgDeathNoticeList[i].szVictim[MAX_PLAYER_NAME_LENGTH-1] = 0; rgDeathNoticeList[i].szVictim[MAX_PLAYER_NAME_LENGTH-1] = 0;
} }
// Is it a non-player object kill? // Is it a non-player object kill?
if ( ((char)victim) == -1 ) if ( ((char)victim) == -1 )
{ {
rgDeathNoticeList[i].iNonPlayerKill = TRUE; rgDeathNoticeList[i].iNonPlayerKill = TRUE;
// Store the object's name in the Victim slot (skip the d_ bit) // Store the object's name in the Victim slot (skip the d_ bit)
strcpy( rgDeathNoticeList[i].szVictim, killedwith+2 ); strcpy( rgDeathNoticeList[i].szVictim, killedwith+2 );
} }
else else
{ {
if ( killer == victim || killer == 0 ) if ( killer == victim || killer == 0 )
rgDeathNoticeList[i].iSuicide = TRUE; rgDeathNoticeList[i].iSuicide = TRUE;
if ( !strcmp( killedwith, "d_teammate" ) ) if ( !strcmp( killedwith, "d_teammate" ) )
rgDeathNoticeList[i].iTeamKill = TRUE; rgDeathNoticeList[i].iTeamKill = TRUE;
} }
// Find the sprite in the list // Find the sprite in the list
int spr = gHUD.GetSpriteIndex( killedwith ); int spr = gHUD.GetSpriteIndex( killedwith );
rgDeathNoticeList[i].iId = spr; rgDeathNoticeList[i].iId = spr;
DEATHNOTICE_DISPLAY_TIME = CVAR_GET_FLOAT( "hud_deathnotice_time" ); DEATHNOTICE_DISPLAY_TIME = CVAR_GET_FLOAT( "hud_deathnotice_time" );
rgDeathNoticeList[i].flDisplayTime = gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME; rgDeathNoticeList[i].flDisplayTime = gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME;
if (rgDeathNoticeList[i].iNonPlayerKill) if (rgDeathNoticeList[i].iNonPlayerKill)
{ {
ConsolePrint( rgDeathNoticeList[i].szKiller ); ConsolePrint( rgDeathNoticeList[i].szKiller );
ConsolePrint( " killed a " ); ConsolePrint( " killed a " );
ConsolePrint( rgDeathNoticeList[i].szVictim ); ConsolePrint( rgDeathNoticeList[i].szVictim );
ConsolePrint( "\n" ); ConsolePrint( "\n" );
} }
else else
{ {
// record the death notice in the console // record the death notice in the console
if ( rgDeathNoticeList[i].iSuicide ) if ( rgDeathNoticeList[i].iSuicide )
{ {
ConsolePrint( rgDeathNoticeList[i].szVictim ); ConsolePrint( rgDeathNoticeList[i].szVictim );
if ( !strcmp( killedwith, "d_world" ) ) if ( !strcmp( killedwith, "d_world" ) )
{ {
ConsolePrint( " died" ); ConsolePrint( " died" );
} }
else else
{ {
ConsolePrint( " killed self" ); ConsolePrint( " killed self" );
} }
} }
else if ( rgDeathNoticeList[i].iTeamKill ) else if ( rgDeathNoticeList[i].iTeamKill )
{ {
ConsolePrint( rgDeathNoticeList[i].szKiller ); ConsolePrint( rgDeathNoticeList[i].szKiller );
ConsolePrint( " killed his teammate " ); ConsolePrint( " killed his teammate " );
ConsolePrint( rgDeathNoticeList[i].szVictim ); ConsolePrint( rgDeathNoticeList[i].szVictim );
} }
else else
{ {
ConsolePrint( rgDeathNoticeList[i].szKiller ); ConsolePrint( rgDeathNoticeList[i].szKiller );
ConsolePrint( " killed " ); ConsolePrint( " killed " );
ConsolePrint( rgDeathNoticeList[i].szVictim ); ConsolePrint( rgDeathNoticeList[i].szVictim );
} }
if ( *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill ) if ( *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill )
{ {
ConsolePrint( " with " ); ConsolePrint( " with " );
// replace the code names with the 'real' names // replace the code names with the 'real' names
if ( !strcmp( killedwith+2, "egon" ) ) if ( !strcmp( killedwith+2, "egon" ) )
strcpy( killedwith, "d_gluon gun" ); strcpy( killedwith, "d_gluon gun" );
if ( !strcmp( killedwith+2, "gauss" ) ) if ( !strcmp( killedwith+2, "gauss" ) )
strcpy( killedwith, "d_tau cannon" ); strcpy( killedwith, "d_tau cannon" );
ConsolePrint( killedwith+2 ); // skip over the "d_" part ConsolePrint( killedwith+2 ); // skip over the "d_" part
} }
ConsolePrint( "\n" ); ConsolePrint( "\n" );
} }
return 1; return 1;
} }

View File

@ -1,101 +1,101 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "demo.h" #include "demo.h"
#include "demo_api.h" #include "demo_api.h"
#include <memory.h> #include <memory.h>
int g_demosniper = 0; int g_demosniper = 0;
int g_demosniperdamage = 0; int g_demosniperdamage = 0;
float g_demosniperorg[3]; float g_demosniperorg[3];
float g_demosniperangles[3]; float g_demosniperangles[3];
float g_demozoom; float g_demozoom;
// FIXME: There should be buffer helper functions to avoid all of the *(int *)& crap. // FIXME: There should be buffer helper functions to avoid all of the *(int *)& crap.
extern "C" extern "C"
{ {
void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer ); void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer );
} }
/* /*
===================== =====================
Demo_WriteBuffer Demo_WriteBuffer
Write some data to the demo stream Write some data to the demo stream
===================== =====================
*/ */
void Demo_WriteBuffer( int type, int size, unsigned char *buffer ) void Demo_WriteBuffer( int type, int size, unsigned char *buffer )
{ {
int pos = 0; int pos = 0;
unsigned char buf[ 32 * 1024 ]; unsigned char buf[ 32 * 1024 ];
*( int * )&buf[pos] = type; *( int * )&buf[pos] = type;
pos+=sizeof( int ); pos+=sizeof( int );
memcpy( &buf[pos], buffer, size ); memcpy( &buf[pos], buffer, size );
// Write full buffer out // Write full buffer out
gEngfuncs.pDemoAPI->WriteBuffer( size + sizeof( int ), buf ); gEngfuncs.pDemoAPI->WriteBuffer( size + sizeof( int ), buf );
} }
/* /*
===================== =====================
Demo_ReadBuffer Demo_ReadBuffer
Engine wants us to parse some data from the demo stream Engine wants us to parse some data from the demo stream
===================== =====================
*/ */
void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer ) void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )
{ {
int type; int type;
int i = 0; int i = 0;
type = *( int * )buffer; type = *( int * )buffer;
i += sizeof( int ); i += sizeof( int );
switch ( type ) switch ( type )
{ {
case TYPE_SNIPERDOT: case TYPE_SNIPERDOT:
g_demosniper = *(int * )&buffer[ i ]; g_demosniper = *(int * )&buffer[ i ];
i += sizeof( int ); i += sizeof( int );
if ( g_demosniper ) if ( g_demosniper )
{ {
g_demosniperdamage = *( int * )&buffer[ i ]; g_demosniperdamage = *( int * )&buffer[ i ];
i += sizeof( int ); i += sizeof( int );
g_demosniperangles[ 0 ] = *(float *)&buffer[i]; g_demosniperangles[ 0 ] = *(float *)&buffer[i];
i += sizeof( float ); i += sizeof( float );
g_demosniperangles[ 1 ] = *(float *)&buffer[i]; g_demosniperangles[ 1 ] = *(float *)&buffer[i];
i += sizeof( float ); i += sizeof( float );
g_demosniperangles[ 2 ] = *(float *)&buffer[i]; g_demosniperangles[ 2 ] = *(float *)&buffer[i];
i += sizeof( float ); i += sizeof( float );
g_demosniperorg[ 0 ] = *(float *)&buffer[i]; g_demosniperorg[ 0 ] = *(float *)&buffer[i];
i += sizeof( float ); i += sizeof( float );
g_demosniperorg[ 1 ] = *(float *)&buffer[i]; g_demosniperorg[ 1 ] = *(float *)&buffer[i];
i += sizeof( float ); i += sizeof( float );
g_demosniperorg[ 2 ] = *(float *)&buffer[i]; g_demosniperorg[ 2 ] = *(float *)&buffer[i];
i += sizeof( float ); i += sizeof( float );
} }
break; break;
case TYPE_ZOOM: case TYPE_ZOOM:
g_demozoom = *(float * )&buffer[ i ]; g_demozoom = *(float * )&buffer[ i ];
i += sizeof( float ); i += sizeof( float );
break; break;
default: default:
gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" ); gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" );
break; break;
} }
} }

View File

@ -1,27 +1,27 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( DEMOH ) #if !defined( DEMOH )
#define DEMOH #define DEMOH
#pragma once #pragma once
// Types of demo messages we can write/parse // Types of demo messages we can write/parse
enum enum
{ {
TYPE_SNIPERDOT = 0, TYPE_SNIPERDOT = 0,
TYPE_ZOOM TYPE_ZOOM
}; };
void Demo_WriteBuffer( int type, int size, unsigned char *buffer ); void Demo_WriteBuffer( int type, int size, unsigned char *buffer );
extern int g_demosniper; extern int g_demosniper;
extern int g_demosniperdamage; extern int g_demosniperdamage;
extern float g_demosniperorg[3]; extern float g_demosniperorg[3];
extern float g_demosniperangles[3]; extern float g_demosniperangles[3];
extern float g_demozoom; extern float g_demozoom;
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,205 +1,205 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// shared event functions // shared event functions
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "const.h" #include "const.h"
#include "entity_state.h" #include "entity_state.h"
#include "cl_entity.h" #include "cl_entity.h"
#include "r_efx.h" #include "r_efx.h"
#include "eventscripts.h" #include "eventscripts.h"
#include "event_api.h" #include "event_api.h"
#include "pm_shared.h" #include "pm_shared.h"
#define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || (g_iUser1 && (gHUD.m_Spectator.m_pip->value == INSET_IN_EYE)) ) #define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || (g_iUser1 && (gHUD.m_Spectator.m_pip->value == INSET_IN_EYE)) )
/* /*
================= =================
GetEntity GetEntity
Return's the requested cl_entity_t Return's the requested cl_entity_t
================= =================
*/ */
struct cl_entity_s *GetEntity( int idx ) struct cl_entity_s *GetEntity( int idx )
{ {
return gEngfuncs.GetEntityByIndex( idx ); return gEngfuncs.GetEntityByIndex( idx );
} }
/* /*
================= =================
GetViewEntity GetViewEntity
Return's the current weapon/view model Return's the current weapon/view model
================= =================
*/ */
struct cl_entity_s *GetViewEntity( void ) struct cl_entity_s *GetViewEntity( void )
{ {
return gEngfuncs.GetViewModel(); return gEngfuncs.GetViewModel();
} }
/* /*
================= =================
EV_CreateTracer EV_CreateTracer
Creates a tracer effect Creates a tracer effect
================= =================
*/ */
void EV_CreateTracer( float *start, float *end ) void EV_CreateTracer( float *start, float *end )
{ {
gEngfuncs.pEfxAPI->R_TracerEffect( start, end ); gEngfuncs.pEfxAPI->R_TracerEffect( start, end );
} }
/* /*
================= =================
EV_IsPlayer EV_IsPlayer
Is the entity's index in the player range? Is the entity's index in the player range?
================= =================
*/ */
qboolean EV_IsPlayer( int idx ) qboolean EV_IsPlayer( int idx )
{ {
if ( idx >= 1 && idx <= gEngfuncs.GetMaxClients() ) if ( idx >= 1 && idx <= gEngfuncs.GetMaxClients() )
return true; return true;
return false; return false;
} }
/* /*
================= =================
EV_IsLocal EV_IsLocal
Is the entity == the local player Is the entity == the local player
================= =================
*/ */
qboolean EV_IsLocal( int idx ) qboolean EV_IsLocal( int idx )
{ {
// check if we are in some way in first person spec mode // check if we are in some way in first person spec mode
if ( IS_FIRSTPERSON_SPEC ) if ( IS_FIRSTPERSON_SPEC )
return (g_iUser2 == idx); return (g_iUser2 == idx);
else else
return gEngfuncs.pEventAPI->EV_IsLocal( idx - 1 ) ? true : false; return gEngfuncs.pEventAPI->EV_IsLocal( idx - 1 ) ? true : false;
} }
/* /*
================= =================
EV_GetGunPosition EV_GetGunPosition
Figure out the height of the gun Figure out the height of the gun
================= =================
*/ */
void EV_GetGunPosition( event_args_t *args, float *pos, float *origin ) void EV_GetGunPosition( event_args_t *args, float *pos, float *origin )
{ {
int idx; int idx;
vec3_t view_ofs; vec3_t view_ofs;
idx = args->entindex; idx = args->entindex;
VectorClear( view_ofs ); VectorClear( view_ofs );
view_ofs[2] = DEFAULT_VIEWHEIGHT; view_ofs[2] = DEFAULT_VIEWHEIGHT;
if ( EV_IsPlayer( idx ) ) if ( EV_IsPlayer( idx ) )
{ {
// in spec mode use entity viewheigh, not own // in spec mode use entity viewheigh, not own
if ( EV_IsLocal( idx ) && !IS_FIRSTPERSON_SPEC ) if ( EV_IsLocal( idx ) && !IS_FIRSTPERSON_SPEC )
{ {
// Grab predicted result for local player // Grab predicted result for local player
gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs ); gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );
} }
else if ( args->ducking == 1 ) else if ( args->ducking == 1 )
{ {
view_ofs[2] = VEC_DUCK_VIEW; view_ofs[2] = VEC_DUCK_VIEW;
} }
} }
VectorAdd( origin, view_ofs, pos ); VectorAdd( origin, view_ofs, pos );
} }
/* /*
================= =================
EV_EjectBrass EV_EjectBrass
Bullet shell casings Bullet shell casings
================= =================
*/ */
void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype ) void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype )
{ {
vec3_t endpos; vec3_t endpos;
VectorClear( endpos ); VectorClear( endpos );
endpos[1] = rotation; endpos[1] = rotation;
gEngfuncs.pEfxAPI->R_TempModel( origin, velocity, endpos, 2.5, model, soundtype ); gEngfuncs.pEfxAPI->R_TempModel( origin, velocity, endpos, 2.5, model, soundtype );
} }
/* /*
================= =================
EV_GetDefaultShellInfo EV_GetDefaultShellInfo
Determine where to eject shells from Determine where to eject shells from
================= =================
*/ */
void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale ) void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale )
{ {
int i; int i;
vec3_t view_ofs; vec3_t view_ofs;
float fR, fU; float fR, fU;
int idx; int idx;
idx = args->entindex; idx = args->entindex;
VectorClear( view_ofs ); VectorClear( view_ofs );
view_ofs[2] = DEFAULT_VIEWHEIGHT; view_ofs[2] = DEFAULT_VIEWHEIGHT;
if ( EV_IsPlayer( idx ) ) if ( EV_IsPlayer( idx ) )
{ {
if ( EV_IsLocal( idx ) ) if ( EV_IsLocal( idx ) )
{ {
gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs ); gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );
} }
else if ( args->ducking == 1 ) else if ( args->ducking == 1 )
{ {
view_ofs[2] = VEC_DUCK_VIEW; view_ofs[2] = VEC_DUCK_VIEW;
} }
} }
fR = gEngfuncs.pfnRandomFloat( 50, 70 ); fR = gEngfuncs.pfnRandomFloat( 50, 70 );
fU = gEngfuncs.pfnRandomFloat( 100, 150 ); fU = gEngfuncs.pfnRandomFloat( 100, 150 );
for ( i = 0; i < 3; i++ ) for ( i = 0; i < 3; i++ )
{ {
ShellVelocity[i] = velocity[i] + right[i] * fR + up[i] * fU + forward[i] * 25; ShellVelocity[i] = velocity[i] + right[i] * fR + up[i] * fU + forward[i] * 25;
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale + right[i] * rightScale; ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale + right[i] * rightScale;
} }
} }
/* /*
================= =================
EV_MuzzleFlash EV_MuzzleFlash
Flag weapon/view model for muzzle flash Flag weapon/view model for muzzle flash
================= =================
*/ */
void EV_MuzzleFlash( void ) void EV_MuzzleFlash( void )
{ {
// Add muzzle flash to current weapon model // Add muzzle flash to current weapon model
cl_entity_t *ent = GetViewEntity(); cl_entity_t *ent = GetViewEntity();
if ( !ent ) if ( !ent )
{ {
return; return;
} }
// Or in the muzzle flash // Or in the muzzle flash
ent->curstate.effects |= EF_MUZZLEFLASH; ent->curstate.effects |= EF_MUZZLEFLASH;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +1,95 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined ( EV_HLDMH ) #if !defined ( EV_HLDMH )
#define EV_HLDMH #define EV_HLDMH
// bullet types // bullet types
typedef enum typedef enum
{ {
BULLET_NONE = 0, BULLET_NONE = 0,
BULLET_PLAYER_9MM, // glock BULLET_PLAYER_9MM, // glock
BULLET_PLAYER_MP5, // mp5 BULLET_PLAYER_MP5, // mp5
BULLET_PLAYER_357, // python BULLET_PLAYER_357, // python
BULLET_PLAYER_BUCKSHOT, // shotgun BULLET_PLAYER_BUCKSHOT, // shotgun
BULLET_PLAYER_CROWBAR, // crowbar swipe BULLET_PLAYER_CROWBAR, // crowbar swipe
BULLET_MONSTER_9MM, BULLET_MONSTER_9MM,
BULLET_MONSTER_MP5, BULLET_MONSTER_MP5,
BULLET_MONSTER_12MM, BULLET_MONSTER_12MM,
} Bullet; } Bullet;
enum glock_e { enum glock_e {
GLOCK_IDLE1 = 0, GLOCK_IDLE1 = 0,
GLOCK_IDLE2, GLOCK_IDLE2,
GLOCK_IDLE3, GLOCK_IDLE3,
GLOCK_SHOOT, GLOCK_SHOOT,
GLOCK_SHOOT_EMPTY, GLOCK_SHOOT_EMPTY,
GLOCK_RELOAD, GLOCK_RELOAD,
GLOCK_RELOAD_NOT_EMPTY, GLOCK_RELOAD_NOT_EMPTY,
GLOCK_DRAW, GLOCK_DRAW,
GLOCK_HOLSTER, GLOCK_HOLSTER,
GLOCK_ADD_SILENCER GLOCK_ADD_SILENCER
}; };
enum shotgun_e { enum shotgun_e {
SHOTGUN_IDLE = 0, SHOTGUN_IDLE = 0,
SHOTGUN_FIRE, SHOTGUN_FIRE,
SHOTGUN_FIRE2, SHOTGUN_FIRE2,
SHOTGUN_RELOAD, SHOTGUN_RELOAD,
SHOTGUN_PUMP, SHOTGUN_PUMP,
SHOTGUN_START_RELOAD, SHOTGUN_START_RELOAD,
SHOTGUN_DRAW, SHOTGUN_DRAW,
SHOTGUN_HOLSTER, SHOTGUN_HOLSTER,
SHOTGUN_IDLE4, SHOTGUN_IDLE4,
SHOTGUN_IDLE_DEEP SHOTGUN_IDLE_DEEP
}; };
enum mp5_e enum mp5_e
{ {
MP5_LONGIDLE = 0, MP5_LONGIDLE = 0,
MP5_IDLE1, MP5_IDLE1,
MP5_LAUNCH, MP5_LAUNCH,
MP5_RELOAD, MP5_RELOAD,
MP5_DEPLOY, MP5_DEPLOY,
MP5_FIRE1, MP5_FIRE1,
MP5_FIRE2, MP5_FIRE2,
MP5_FIRE3, MP5_FIRE3,
}; };
enum python_e { enum python_e {
PYTHON_IDLE1 = 0, PYTHON_IDLE1 = 0,
PYTHON_FIDGET, PYTHON_FIDGET,
PYTHON_FIRE1, PYTHON_FIRE1,
PYTHON_RELOAD, PYTHON_RELOAD,
PYTHON_HOLSTER, PYTHON_HOLSTER,
PYTHON_DRAW, PYTHON_DRAW,
PYTHON_IDLE2, PYTHON_IDLE2,
PYTHON_IDLE3 PYTHON_IDLE3
}; };
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging #define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged #define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
enum gauss_e { enum gauss_e {
GAUSS_IDLE = 0, GAUSS_IDLE = 0,
GAUSS_IDLE2, GAUSS_IDLE2,
GAUSS_FIDGET, GAUSS_FIDGET,
GAUSS_SPINUP, GAUSS_SPINUP,
GAUSS_SPIN, GAUSS_SPIN,
GAUSS_FIRE, GAUSS_FIRE,
GAUSS_FIRE2, GAUSS_FIRE2,
GAUSS_HOLSTER, GAUSS_HOLSTER,
GAUSS_DRAW GAUSS_DRAW
}; };
void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName ); void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName );
void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType ); void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType );
int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, float *right, int iBulletType, int iTracerFreq, int *tracerCount ); int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, float *right, int iBulletType, int iTracerFreq, int *tracerCount );
void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int cShots, float *vecSrc, float *vecDirShooting, float flDistance, int iBulletType, int iTracerFreq, int *tracerCount, float flSpreadX, float flSpreadY ); void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int cShots, float *vecSrc, float *vecDirShooting, float flDistance, int iBulletType, int iTracerFreq, int *tracerCount, float flSpreadX, float flSpreadY );
#endif // EV_HLDMH #endif // EV_HLDMH

View File

@ -1,23 +1,23 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
void Game_HookEvents( void ); void Game_HookEvents( void );
/* /*
=================== ===================
EV_HookEvents EV_HookEvents
See if game specific code wants to hook any events. See if game specific code wants to hook any events.
=================== ===================
*/ */
void EV_HookEvents( void ) void EV_HookEvents( void )
{ {
Game_HookEvents(); Game_HookEvents();
} }

View File

@ -1,73 +1,73 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
// eventscripts.h // eventscripts.h
#if !defined ( EVENTSCRIPTSH ) #if !defined ( EVENTSCRIPTSH )
#define EVENTSCRIPTSH #define EVENTSCRIPTSH
// defaults for clientinfo messages // defaults for clientinfo messages
#define DEFAULT_VIEWHEIGHT 28 #define DEFAULT_VIEWHEIGHT 28
#define VEC_DUCK_VIEW 12 #define VEC_DUCK_VIEW 12
#define FTENT_FADEOUT 0x00000080 #define FTENT_FADEOUT 0x00000080
#define DMG_GENERIC 0 // generic damage was done #define DMG_GENERIC 0 // generic damage was done
#define DMG_CRUSH (1 << 0) // crushed by falling or moving object #define DMG_CRUSH (1 << 0) // crushed by falling or moving object
#define DMG_BULLET (1 << 1) // shot #define DMG_BULLET (1 << 1) // shot
#define DMG_SLASH (1 << 2) // cut, clawed, stabbed #define DMG_SLASH (1 << 2) // cut, clawed, stabbed
#define DMG_BURN (1 << 3) // heat burned #define DMG_BURN (1 << 3) // heat burned
#define DMG_FREEZE (1 << 4) // frozen #define DMG_FREEZE (1 << 4) // frozen
#define DMG_FALL (1 << 5) // fell too far #define DMG_FALL (1 << 5) // fell too far
#define DMG_BLAST (1 << 6) // explosive blast damage #define DMG_BLAST (1 << 6) // explosive blast damage
#define DMG_CLUB (1 << 7) // crowbar, punch, headbutt #define DMG_CLUB (1 << 7) // crowbar, punch, headbutt
#define DMG_SHOCK (1 << 8) // electric shock #define DMG_SHOCK (1 << 8) // electric shock
#define DMG_SONIC (1 << 9) // sound pulse shockwave #define DMG_SONIC (1 << 9) // sound pulse shockwave
#define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam #define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam
#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death #define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death. #define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
// time-based damage // time-based damage
//mask off TF-specific stuff too //mask off TF-specific stuff too
#define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage #define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage
#define DMG_DROWN (1 << 14) // Drowning #define DMG_DROWN (1 << 14) // Drowning
#define DMG_FIRSTTIMEBASED DMG_DROWN #define DMG_FIRSTTIMEBASED DMG_DROWN
#define DMG_PARALYZE (1 << 15) // slows affected creature down #define DMG_PARALYZE (1 << 15) // slows affected creature down
#define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad #define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad
#define DMG_POISON (1 << 17) // blood poisioning #define DMG_POISON (1 << 17) // blood poisioning
#define DMG_RADIATION (1 << 18) // radiation exposure #define DMG_RADIATION (1 << 18) // radiation exposure
#define DMG_DROWNRECOVER (1 << 19) // drowning recovery #define DMG_DROWNRECOVER (1 << 19) // drowning recovery
#define DMG_ACID (1 << 20) // toxic chemicals or acid burns #define DMG_ACID (1 << 20) // toxic chemicals or acid burns
#define DMG_SLOWBURN (1 << 21) // in an oven #define DMG_SLOWBURN (1 << 21) // in an oven
#define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer #define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer
#define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar) #define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar)
//TF ADDITIONS //TF ADDITIONS
#define DMG_IGNITE (1 << 24) // Players hit by this begin to burn #define DMG_IGNITE (1 << 24) // Players hit by this begin to burn
#define DMG_RADIUS_MAX (1 << 25) // Radius damage with this flag doesn't decrease over distance #define DMG_RADIUS_MAX (1 << 25) // Radius damage with this flag doesn't decrease over distance
#define DMG_RADIUS_QUAKE (1 << 26) // Radius damage is done like Quake. 1/2 damage at 1/2 radius. #define DMG_RADIUS_QUAKE (1 << 26) // Radius damage is done like Quake. 1/2 damage at 1/2 radius.
#define DMG_IGNOREARMOR (1 << 27) // Damage ignores target's armor #define DMG_IGNOREARMOR (1 << 27) // Damage ignores target's armor
#define DMG_AIMED (1 << 28) // Does Hit location damage #define DMG_AIMED (1 << 28) // Does Hit location damage
#define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls #define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls
#define DMG_CALTROP (1<<30) #define DMG_CALTROP (1<<30)
#define DMG_HALLUC (1<<31) #define DMG_HALLUC (1<<31)
// Some of these are HL/TFC specific? // Some of these are HL/TFC specific?
void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype ); void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype );
void EV_GetGunPosition( struct event_args_s *args, float *pos, float *origin ); void EV_GetGunPosition( struct event_args_s *args, float *pos, float *origin );
void EV_GetDefaultShellInfo( struct event_args_s *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale ); void EV_GetDefaultShellInfo( struct event_args_s *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale );
qboolean EV_IsLocal( int idx ); qboolean EV_IsLocal( int idx );
qboolean EV_IsPlayer( int idx ); qboolean EV_IsPlayer( int idx );
void EV_CreateTracer( float *start, float *end ); void EV_CreateTracer( float *start, float *end );
struct cl_entity_s *GetEntity( int idx ); struct cl_entity_s *GetEntity( int idx );
struct cl_entity_s *GetViewEntity( void ); struct cl_entity_s *GetViewEntity( void );
void EV_MuzzleFlash( void ); void EV_MuzzleFlash( void );
#endif // EVENTSCRIPTSH #endif // EVENTSCRIPTSH

View File

@ -1,101 +1,101 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// flashlight.cpp // flashlight.cpp
// //
// implementation of CHudFlashlight class // implementation of CHudFlashlight class
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
DECLARE_MESSAGE(m_Flash, FlashBat) DECLARE_MESSAGE(m_Flash, FlashBat)
DECLARE_MESSAGE(m_Flash, Flashlight) DECLARE_MESSAGE(m_Flash, Flashlight)
#define BAT_NAME "sprites/%d_Flashlight.spr" #define BAT_NAME "sprites/%d_Flashlight.spr"
int CHudFlashlight::Init(void) int CHudFlashlight::Init(void)
{ {
m_fFade = 0; m_fFade = 0;
m_fOn = 0; m_fOn = 0;
HOOK_MESSAGE(Flashlight); HOOK_MESSAGE(Flashlight);
HOOK_MESSAGE(FlashBat); HOOK_MESSAGE(FlashBat);
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
return 1; return 1;
}; };
void CHudFlashlight::Reset(void) void CHudFlashlight::Reset(void)
{ {
m_fFade = 0; m_fFade = 0;
m_fOn = 0; m_fOn = 0;
} }
int CHudFlashlight::VidInit(void) int CHudFlashlight::VidInit(void)
{ {
int HUD_flash_empty = gHUD.GetSpriteIndex( "flash_empty" ); int HUD_flash_empty = gHUD.GetSpriteIndex( "flash_empty" );
int HUD_flash_full = gHUD.GetSpriteIndex( "flash_full" ); int HUD_flash_full = gHUD.GetSpriteIndex( "flash_full" );
int HUD_flash_beam = gHUD.GetSpriteIndex( "flash_beam" ); int HUD_flash_beam = gHUD.GetSpriteIndex( "flash_beam" );
m_hSprite1 = gHUD.GetSprite(HUD_flash_empty); m_hSprite1 = gHUD.GetSprite(HUD_flash_empty);
m_hSprite2 = gHUD.GetSprite(HUD_flash_full); m_hSprite2 = gHUD.GetSprite(HUD_flash_full);
m_hBeam = gHUD.GetSprite(HUD_flash_beam); m_hBeam = gHUD.GetSprite(HUD_flash_beam);
m_prc1 = &gHUD.GetSpriteRect(HUD_flash_empty); m_prc1 = &gHUD.GetSpriteRect(HUD_flash_empty);
m_prc2 = &gHUD.GetSpriteRect(HUD_flash_full); m_prc2 = &gHUD.GetSpriteRect(HUD_flash_full);
m_prcBeam = &gHUD.GetSpriteRect(HUD_flash_beam); m_prcBeam = &gHUD.GetSpriteRect(HUD_flash_beam);
m_iWidth = m_prc2->right - m_prc2->left; m_iWidth = m_prc2->right - m_prc2->left;
return 1; return 1;
}; };
int CHudFlashlight:: MsgFunc_FlashBat(const char *pszName, int iSize, void *pbuf ) int CHudFlashlight:: MsgFunc_FlashBat(const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int x = READ_BYTE(); int x = READ_BYTE();
m_iBat = x; m_iBat = x;
m_flBat = ((float)x)/100.0; m_flBat = ((float)x)/100.0;
return 1; return 1;
} }
int CHudFlashlight:: MsgFunc_Flashlight(const char *pszName, int iSize, void *pbuf ) int CHudFlashlight:: MsgFunc_Flashlight(const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
m_fOn = READ_BYTE(); m_fOn = READ_BYTE();
int x = READ_BYTE(); int x = READ_BYTE();
m_iBat = x; m_iBat = x;
m_flBat = ((float)x)/100.0; m_flBat = ((float)x)/100.0;
return 1; return 1;
} }
int CHudFlashlight::Draw(float flTime) int CHudFlashlight::Draw(float flTime)
{ {
static bool show = ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) ); static bool show = ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) );
if( show != !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) ) ) if( show != !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) ) )
{ {
@ -106,53 +106,53 @@ int CHudFlashlight::Draw(float flTime)
} }
} }
if ( !show ) if ( !show )
return 1; return 1;
int r, g, b, x, y, a; int r, g, b, x, y, a;
wrect_t rc; wrect_t rc;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) )) if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1; return 1;
if (m_fOn) if (m_fOn)
a = 225; a = 225;
else else
a = MIN_ALPHA; a = MIN_ALPHA;
if (m_flBat < 0.20) if (m_flBat < 0.20)
UnpackRGB(r,g,b, RGB_REDISH); UnpackRGB(r,g,b, RGB_REDISH);
else else
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
ScaleColors(r, g, b, a); ScaleColors(r, g, b, a);
y = (m_prc1->bottom - m_prc2->top)/2; y = (m_prc1->bottom - m_prc2->top)/2;
x = ScreenWidth - m_iWidth - m_iWidth/2 ; x = ScreenWidth - m_iWidth - m_iWidth/2 ;
// Draw the flashlight casing // Draw the flashlight casing
SPR_Set(m_hSprite1, r, g, b ); SPR_Set(m_hSprite1, r, g, b );
SPR_DrawAdditive( 0, x, y, m_prc1); SPR_DrawAdditive( 0, x, y, m_prc1);
if ( m_fOn ) if ( m_fOn )
{ // draw the flashlight beam { // draw the flashlight beam
x = ScreenWidth - m_iWidth/2; x = ScreenWidth - m_iWidth/2;
SPR_Set( m_hBeam, r, g, b ); SPR_Set( m_hBeam, r, g, b );
SPR_DrawAdditive( 0, x, y, m_prcBeam ); SPR_DrawAdditive( 0, x, y, m_prcBeam );
} }
// draw the flashlight energy level // draw the flashlight energy level
x = ScreenWidth - m_iWidth - m_iWidth/2 ; x = ScreenWidth - m_iWidth - m_iWidth/2 ;
int iOffset = m_iWidth * (1.0 - m_flBat); int iOffset = m_iWidth * (1.0 - m_flBat);
if (iOffset < m_iWidth) if (iOffset < m_iWidth)
{ {
rc = *m_prc2; rc = *m_prc2;
rc.left += iOffset; rc.left += iOffset;
SPR_Set(m_hSprite2, r, g, b ); SPR_Set(m_hSprite2, r, g, b );
SPR_DrawAdditive( 0, x + iOffset, y, &rc); SPR_DrawAdditive( 0, x + iOffset, y, &rc);
} }
return 1; return 1;
} }

View File

@ -1,184 +1,184 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// Geiger.cpp // Geiger.cpp
// //
// implementation of CHudAmmo class // implementation of CHudAmmo class
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
#include "parsemsg.h" #include "parsemsg.h"
DECLARE_MESSAGE(m_Geiger, Geiger ) DECLARE_MESSAGE(m_Geiger, Geiger )
int CHudGeiger::Init(void) int CHudGeiger::Init(void)
{ {
HOOK_MESSAGE( Geiger ); HOOK_MESSAGE( Geiger );
m_iGeigerRange = 0; m_iGeigerRange = 0;
m_iFlags = 0; m_iFlags = 0;
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
srand( (unsigned)time( NULL ) ); srand( (unsigned)time( NULL ) );
return 1; return 1;
}; };
int CHudGeiger::VidInit(void) int CHudGeiger::VidInit(void)
{ {
return 1; return 1;
}; };
int CHudGeiger::MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf) int CHudGeiger::MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf)
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
// update geiger data // update geiger data
m_iGeigerRange = READ_BYTE(); m_iGeigerRange = READ_BYTE();
m_iGeigerRange = m_iGeigerRange << 2; m_iGeigerRange = m_iGeigerRange << 2;
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
return 1; return 1;
} }
int CHudGeiger::Draw (float flTime) int CHudGeiger::Draw (float flTime)
{ {
int pct; int pct;
float flvol = 0.0f; float flvol = 0.0f;
int rg[3]; int rg[3];
int i; int i;
if (m_iGeigerRange < 1000 && m_iGeigerRange > 0) if (m_iGeigerRange < 1000 && m_iGeigerRange > 0)
{ {
// peicewise linear is better than continuous formula for this // peicewise linear is better than continuous formula for this
if (m_iGeigerRange > 800) if (m_iGeigerRange > 800)
{ {
pct = 0; //Con_Printf ( "range > 800\n"); pct = 0; //Con_Printf ( "range > 800\n");
} }
else if (m_iGeigerRange > 600) else if (m_iGeigerRange > 600)
{ {
pct = 2; pct = 2;
flvol = 0.4; //Con_Printf ( "range > 600\n"); flvol = 0.4; //Con_Printf ( "range > 600\n");
rg[0] = 1; rg[0] = 1;
rg[1] = 1; rg[1] = 1;
i = 2; i = 2;
} }
else if (m_iGeigerRange > 500) else if (m_iGeigerRange > 500)
{ {
pct = 4; pct = 4;
flvol = 0.5; //Con_Printf ( "range > 500\n"); flvol = 0.5; //Con_Printf ( "range > 500\n");
rg[0] = 1; rg[0] = 1;
rg[1] = 2; rg[1] = 2;
i = 2; i = 2;
} }
else if (m_iGeigerRange > 400) else if (m_iGeigerRange > 400)
{ {
pct = 8; pct = 8;
flvol = 0.6; //Con_Printf ( "range > 400\n"); flvol = 0.6; //Con_Printf ( "range > 400\n");
rg[0] = 1; rg[0] = 1;
rg[1] = 2; rg[1] = 2;
rg[2] = 3; rg[2] = 3;
i = 3; i = 3;
} }
else if (m_iGeigerRange > 300) else if (m_iGeigerRange > 300)
{ {
pct = 8; pct = 8;
flvol = 0.7; //Con_Printf ( "range > 300\n"); flvol = 0.7; //Con_Printf ( "range > 300\n");
rg[0] = 2; rg[0] = 2;
rg[1] = 3; rg[1] = 3;
rg[2] = 4; rg[2] = 4;
i = 3; i = 3;
} }
else if (m_iGeigerRange > 200) else if (m_iGeigerRange > 200)
{ {
pct = 28; pct = 28;
flvol = 0.78; //Con_Printf ( "range > 200\n"); flvol = 0.78; //Con_Printf ( "range > 200\n");
rg[0] = 2; rg[0] = 2;
rg[1] = 3; rg[1] = 3;
rg[2] = 4; rg[2] = 4;
i = 3; i = 3;
} }
else if (m_iGeigerRange > 150) else if (m_iGeigerRange > 150)
{ {
pct = 40; pct = 40;
flvol = 0.80; //Con_Printf ( "range > 150\n"); flvol = 0.80; //Con_Printf ( "range > 150\n");
rg[0] = 3; rg[0] = 3;
rg[1] = 4; rg[1] = 4;
rg[2] = 5; rg[2] = 5;
i = 3; i = 3;
} }
else if (m_iGeigerRange > 100) else if (m_iGeigerRange > 100)
{ {
pct = 60; pct = 60;
flvol = 0.85; //Con_Printf ( "range > 100\n"); flvol = 0.85; //Con_Printf ( "range > 100\n");
rg[0] = 3; rg[0] = 3;
rg[1] = 4; rg[1] = 4;
rg[2] = 5; rg[2] = 5;
i = 3; i = 3;
} }
else if (m_iGeigerRange > 75) else if (m_iGeigerRange > 75)
{ {
pct = 80; pct = 80;
flvol = 0.9; //Con_Printf ( "range > 75\n"); flvol = 0.9; //Con_Printf ( "range > 75\n");
//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75; //gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;
rg[0] = 4; rg[0] = 4;
rg[1] = 5; rg[1] = 5;
rg[2] = 6; rg[2] = 6;
i = 3; i = 3;
} }
else if (m_iGeigerRange > 50) else if (m_iGeigerRange > 50)
{ {
pct = 90; pct = 90;
flvol = 0.95; //Con_Printf ( "range > 50\n"); flvol = 0.95; //Con_Printf ( "range > 50\n");
rg[0] = 5; rg[0] = 5;
rg[1] = 6; rg[1] = 6;
i = 2; i = 2;
} }
else else
{ {
pct = 95; pct = 95;
flvol = 1.0; //Con_Printf ( "range < 50\n"); flvol = 1.0; //Con_Printf ( "range < 50\n");
rg[0] = 5; rg[0] = 5;
rg[1] = 6; rg[1] = 6;
i = 2; i = 2;
} }
flvol = (flvol * ((rand() & 127)) / 255) + 0.25; // UTIL_RandomFloat(0.25, 0.5); flvol = (flvol * ((rand() & 127)) / 255) + 0.25; // UTIL_RandomFloat(0.25, 0.5);
if ((rand() & 127) < pct || (rand() & 127) < pct) if ((rand() & 127) < pct || (rand() & 127) < pct)
{ {
//S_StartDynamicSound (-1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0, 0, 100); //S_StartDynamicSound (-1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0, 0, 100);
char sz[256]; char sz[256];
int j = rand() & 1; int j = rand() & 1;
if (i > 2) if (i > 2)
j += rand() & 1; j += rand() & 1;
sprintf(sz, "player/geiger%d.wav", j + 1); sprintf(sz, "player/geiger%d.wav", j + 1);
PlaySound(sz, flvol); PlaySound(sz, flvol);
} }
} }
return 1; return 1;
} }

View File

@ -1,483 +1,483 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// Health.cpp // Health.cpp
// //
// implementation of CHudHealth class // implementation of CHudHealth class
// //
#include "stdio.h" #include "stdio.h"
#include "stdlib.h" #include "stdlib.h"
#include "math.h" #include "math.h"
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include "mobility_int.h" #include "mobility_int.h"
DECLARE_MESSAGE(m_Health, Health ) DECLARE_MESSAGE(m_Health, Health )
DECLARE_MESSAGE(m_Health, Damage ) DECLARE_MESSAGE(m_Health, Damage )
#define PAIN_NAME "sprites/%d_pain.spr" #define PAIN_NAME "sprites/%d_pain.spr"
#define DAMAGE_NAME "sprites/%d_dmg.spr" #define DAMAGE_NAME "sprites/%d_dmg.spr"
int giDmgHeight, giDmgWidth; int giDmgHeight, giDmgWidth;
int giDmgFlags[NUM_DMG_TYPES] = int giDmgFlags[NUM_DMG_TYPES] =
{ {
DMG_POISON, DMG_POISON,
DMG_ACID, DMG_ACID,
DMG_FREEZE|DMG_SLOWFREEZE, DMG_FREEZE|DMG_SLOWFREEZE,
DMG_DROWN, DMG_DROWN,
DMG_BURN|DMG_SLOWBURN, DMG_BURN|DMG_SLOWBURN,
DMG_NERVEGAS, DMG_NERVEGAS,
DMG_RADIATION, DMG_RADIATION,
DMG_SHOCK, DMG_SHOCK,
DMG_CALTROP, DMG_CALTROP,
DMG_TRANQ, DMG_TRANQ,
DMG_CONCUSS, DMG_CONCUSS,
DMG_HALLUC DMG_HALLUC
}; };
int CHudHealth::Init(void) int CHudHealth::Init(void)
{ {
HOOK_MESSAGE(Health); HOOK_MESSAGE(Health);
HOOK_MESSAGE(Damage); HOOK_MESSAGE(Damage);
m_iHealth = 100; m_iHealth = 100;
m_fFade = 0; m_fFade = 0;
m_iFlags = 0; m_iFlags = 0;
m_bitsDamage = 0; m_bitsDamage = 0;
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0; m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
giDmgHeight = 0; giDmgHeight = 0;
giDmgWidth = 0; giDmgWidth = 0;
memset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES); memset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES);
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
return 1; return 1;
} }
void CHudHealth::Reset( void ) void CHudHealth::Reset( void )
{ {
// make sure the pain compass is cleared when the player respawns // make sure the pain compass is cleared when the player respawns
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0; m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
// force all the flashing damage icons to expire // force all the flashing damage icons to expire
m_bitsDamage = 0; m_bitsDamage = 0;
for ( int i = 0; i < NUM_DMG_TYPES; i++ ) for ( int i = 0; i < NUM_DMG_TYPES; i++ )
{ {
m_dmg[i].fExpire = 0; m_dmg[i].fExpire = 0;
} }
} }
int CHudHealth::VidInit(void) int CHudHealth::VidInit(void)
{ {
m_hSprite = 0; m_hSprite = 0;
m_HUD_dmg_bio = gHUD.GetSpriteIndex( "dmg_bio" ) + 1; m_HUD_dmg_bio = gHUD.GetSpriteIndex( "dmg_bio" ) + 1;
m_HUD_cross = gHUD.GetSpriteIndex( "cross" ); m_HUD_cross = gHUD.GetSpriteIndex( "cross" );
giDmgHeight = gHUD.GetSpriteRect(m_HUD_dmg_bio).right - gHUD.GetSpriteRect(m_HUD_dmg_bio).left; giDmgHeight = gHUD.GetSpriteRect(m_HUD_dmg_bio).right - gHUD.GetSpriteRect(m_HUD_dmg_bio).left;
giDmgWidth = gHUD.GetSpriteRect(m_HUD_dmg_bio).bottom - gHUD.GetSpriteRect(m_HUD_dmg_bio).top; giDmgWidth = gHUD.GetSpriteRect(m_HUD_dmg_bio).bottom - gHUD.GetSpriteRect(m_HUD_dmg_bio).top;
return 1; return 1;
} }
int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf ) int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf )
{ {
// TODO: update local health data // TODO: update local health data
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int x = READ_BYTE(); int x = READ_BYTE();
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
// Only update the fade if we've changed health // Only update the fade if we've changed health
if (x != m_iHealth) if (x != m_iHealth)
{ {
m_fFade = FADE_TIME; m_fFade = FADE_TIME;
m_iHealth = x; m_iHealth = x;
} }
return 1; return 1;
} }
int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf ) int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int armor = READ_BYTE(); // armor int armor = READ_BYTE(); // armor
int damageTaken = READ_BYTE(); // health int damageTaken = READ_BYTE(); // health
long bitsDamage = READ_LONG(); // damage bits long bitsDamage = READ_LONG(); // damage bits
vec3_t vecFrom; vec3_t vecFrom;
for ( int i = 0 ; i < 3 ; i++) for ( int i = 0 ; i < 3 ; i++)
vecFrom[i] = READ_COORD(); vecFrom[i] = READ_COORD();
UpdateTiles(gHUD.m_flTime, bitsDamage); UpdateTiles(gHUD.m_flTime, bitsDamage);
// Actually took damage? // Actually took damage?
if ( damageTaken > 0 || armor > 0 ) if ( damageTaken > 0 || armor > 0 )
{ {
CalcDamageDirection(vecFrom); CalcDamageDirection(vecFrom);
if( gMobileEngfuncs && damageTaken > 0 ) if( gMobileEngfuncs && damageTaken > 0 )
{ {
float time = damageTaken * 4.0f; float time = damageTaken * 4.0f;
if( time > 200.0f ) time = 200.0f; if( time > 200.0f ) time = 200.0f;
gMobileEngfuncs->pfnVibrate( time, 0 ); gMobileEngfuncs->pfnVibrate( time, 0 );
} }
} }
return 1; return 1;
} }
// Returns back a color from the // Returns back a color from the
// Green <-> Yellow <-> Red ramp // Green <-> Yellow <-> Red ramp
void CHudHealth::GetPainColor( int &r, int &g, int &b ) void CHudHealth::GetPainColor( int &r, int &g, int &b )
{ {
int iHealth = m_iHealth; int iHealth = m_iHealth;
if (iHealth > 25) if (iHealth > 25)
iHealth -= 25; iHealth -= 25;
else if ( iHealth < 0 ) else if ( iHealth < 0 )
iHealth = 0; iHealth = 0;
#if 0 #if 0
g = iHealth * 255 / 100; g = iHealth * 255 / 100;
r = 255 - g; r = 255 - g;
b = 0; b = 0;
#else #else
if (m_iHealth > 25) if (m_iHealth > 25)
{ {
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
} }
else else
{ {
r = 250; r = 250;
g = 0; g = 0;
b = 0; b = 0;
} }
#endif #endif
} }
int CHudHealth::Draw(float flTime) int CHudHealth::Draw(float flTime)
{ {
int r, g, b; int r, g, b;
int a = 0, x, y; int a = 0, x, y;
int HealthWidth; int HealthWidth;
if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly() ) if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly() )
return 1; return 1;
if ( !m_hSprite ) if ( !m_hSprite )
m_hSprite = LoadSprite(PAIN_NAME); m_hSprite = LoadSprite(PAIN_NAME);
// Has health changed? Flash the health # // Has health changed? Flash the health #
if (m_fFade) if (m_fFade)
{ {
m_fFade -= (gHUD.m_flTimeDelta * 20); m_fFade -= (gHUD.m_flTimeDelta * 20);
if (m_fFade <= 0) if (m_fFade <= 0)
{ {
a = MIN_ALPHA; a = MIN_ALPHA;
m_fFade = 0; m_fFade = 0;
} }
// Fade the health number back to dim // Fade the health number back to dim
a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128; a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128;
} }
else else
a = MIN_ALPHA; a = MIN_ALPHA;
// If health is getting low, make it bright red // If health is getting low, make it bright red
if (m_iHealth <= 15) if (m_iHealth <= 15)
a = 255; a = 255;
GetPainColor( r, g, b ); GetPainColor( r, g, b );
ScaleColors(r, g, b, a ); ScaleColors(r, g, b, a );
// Only draw health if we have the suit. // Only draw health if we have the suit.
if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT))) if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)))
{ {
HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left; HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
int CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left; int CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left;
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2; y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = CrossWidth /2; x = CrossWidth /2;
SPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b); SPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b);
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross)); SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross));
x = CrossWidth + HealthWidth / 2; x = CrossWidth + HealthWidth / 2;
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b); x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b);
x += HealthWidth/2; x += HealthWidth/2;
int iHeight = gHUD.m_iFontHeight; int iHeight = gHUD.m_iFontHeight;
int iWidth = HealthWidth/10; int iWidth = HealthWidth/10;
FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a); FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a);
} }
DrawDamage(flTime); DrawDamage(flTime);
return DrawPain(flTime); return DrawPain(flTime);
} }
void CHudHealth::CalcDamageDirection(vec3_t vecFrom) void CHudHealth::CalcDamageDirection(vec3_t vecFrom)
{ {
vec3_t forward, right, up; vec3_t forward, right, up;
float side, front; float side, front;
vec3_t vecOrigin, vecAngles; vec3_t vecOrigin, vecAngles;
if (!vecFrom[0] && !vecFrom[1] && !vecFrom[2]) if (!vecFrom[0] && !vecFrom[1] && !vecFrom[2])
{ {
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0; m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
return; return;
} }
memcpy(vecOrigin, gHUD.m_vecOrigin, sizeof(vec3_t)); memcpy(vecOrigin, gHUD.m_vecOrigin, sizeof(vec3_t));
memcpy(vecAngles, gHUD.m_vecAngles, sizeof(vec3_t)); memcpy(vecAngles, gHUD.m_vecAngles, sizeof(vec3_t));
VectorSubtract (vecFrom, vecOrigin, vecFrom); VectorSubtract (vecFrom, vecOrigin, vecFrom);
float flDistToTarget = vecFrom.Length(); float flDistToTarget = vecFrom.Length();
vecFrom = vecFrom.Normalize(); vecFrom = vecFrom.Normalize();
AngleVectors (vecAngles, forward, right, up); AngleVectors (vecAngles, forward, right, up);
front = DotProduct (vecFrom, right); front = DotProduct (vecFrom, right);
side = DotProduct (vecFrom, forward); side = DotProduct (vecFrom, forward);
if (flDistToTarget <= 50) if (flDistToTarget <= 50)
{ {
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 1; m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 1;
} }
else else
{ {
if (side > 0) if (side > 0)
{ {
if (side > 0.3) if (side > 0.3)
m_fAttackFront = max(m_fAttackFront, side); m_fAttackFront = max(m_fAttackFront, side);
} }
else else
{ {
float f = fabs(side); float f = fabs(side);
if (f > 0.3) if (f > 0.3)
m_fAttackRear = max(m_fAttackRear, f); m_fAttackRear = max(m_fAttackRear, f);
} }
if (front > 0) if (front > 0)
{ {
if (front > 0.3) if (front > 0.3)
m_fAttackRight = max(m_fAttackRight, front); m_fAttackRight = max(m_fAttackRight, front);
} }
else else
{ {
float f = fabs(front); float f = fabs(front);
if (f > 0.3) if (f > 0.3)
m_fAttackLeft = max(m_fAttackLeft, f); m_fAttackLeft = max(m_fAttackLeft, f);
} }
} }
} }
int CHudHealth::DrawPain(float flTime) int CHudHealth::DrawPain(float flTime)
{ {
if (!(m_fAttackFront || m_fAttackRear || m_fAttackLeft || m_fAttackRight)) if (!(m_fAttackFront || m_fAttackRear || m_fAttackLeft || m_fAttackRight))
return 1; return 1;
int r, g, b; int r, g, b;
int x, y, a, shade; int x, y, a, shade;
// TODO: get the shift value of the health // TODO: get the shift value of the health
a = 255; // max brightness until then a = 255; // max brightness until then
float fFade = gHUD.m_flTimeDelta * 2; float fFade = gHUD.m_flTimeDelta * 2;
// SPR_Draw top // SPR_Draw top
if (m_fAttackFront > 0.4) if (m_fAttackFront > 0.4)
{ {
GetPainColor(r,g,b); GetPainColor(r,g,b);
shade = a * max( m_fAttackFront, 0.5 ); shade = a * max( m_fAttackFront, 0.5 );
ScaleColors(r, g, b, shade); ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b ); SPR_Set(m_hSprite, r, g, b );
x = ScreenWidth/2 - SPR_Width(m_hSprite, 0)/2; x = ScreenWidth/2 - SPR_Width(m_hSprite, 0)/2;
y = ScreenHeight/2 - SPR_Height(m_hSprite,0) * 3; y = ScreenHeight/2 - SPR_Height(m_hSprite,0) * 3;
SPR_DrawAdditive(0, x, y, NULL); SPR_DrawAdditive(0, x, y, NULL);
m_fAttackFront = max( 0, m_fAttackFront - fFade ); m_fAttackFront = max( 0, m_fAttackFront - fFade );
} else } else
m_fAttackFront = 0; m_fAttackFront = 0;
if (m_fAttackRight > 0.4) if (m_fAttackRight > 0.4)
{ {
GetPainColor(r,g,b); GetPainColor(r,g,b);
shade = a * max( m_fAttackRight, 0.5 ); shade = a * max( m_fAttackRight, 0.5 );
ScaleColors(r, g, b, shade); ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b ); SPR_Set(m_hSprite, r, g, b );
x = ScreenWidth/2 + SPR_Width(m_hSprite, 1) * 2; x = ScreenWidth/2 + SPR_Width(m_hSprite, 1) * 2;
y = ScreenHeight/2 - SPR_Height(m_hSprite,1)/2; y = ScreenHeight/2 - SPR_Height(m_hSprite,1)/2;
SPR_DrawAdditive(1, x, y, NULL); SPR_DrawAdditive(1, x, y, NULL);
m_fAttackRight = max( 0, m_fAttackRight - fFade ); m_fAttackRight = max( 0, m_fAttackRight - fFade );
} else } else
m_fAttackRight = 0; m_fAttackRight = 0;
if (m_fAttackRear > 0.4) if (m_fAttackRear > 0.4)
{ {
GetPainColor(r,g,b); GetPainColor(r,g,b);
shade = a * max( m_fAttackRear, 0.5 ); shade = a * max( m_fAttackRear, 0.5 );
ScaleColors(r, g, b, shade); ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b ); SPR_Set(m_hSprite, r, g, b );
x = ScreenWidth/2 - SPR_Width(m_hSprite, 2)/2; x = ScreenWidth/2 - SPR_Width(m_hSprite, 2)/2;
y = ScreenHeight/2 + SPR_Height(m_hSprite,2) * 2; y = ScreenHeight/2 + SPR_Height(m_hSprite,2) * 2;
SPR_DrawAdditive(2, x, y, NULL); SPR_DrawAdditive(2, x, y, NULL);
m_fAttackRear = max( 0, m_fAttackRear - fFade ); m_fAttackRear = max( 0, m_fAttackRear - fFade );
} else } else
m_fAttackRear = 0; m_fAttackRear = 0;
if (m_fAttackLeft > 0.4) if (m_fAttackLeft > 0.4)
{ {
GetPainColor(r,g,b); GetPainColor(r,g,b);
shade = a * max( m_fAttackLeft, 0.5 ); shade = a * max( m_fAttackLeft, 0.5 );
ScaleColors(r, g, b, shade); ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b ); SPR_Set(m_hSprite, r, g, b );
x = ScreenWidth/2 - SPR_Width(m_hSprite, 3) * 3; x = ScreenWidth/2 - SPR_Width(m_hSprite, 3) * 3;
y = ScreenHeight/2 - SPR_Height(m_hSprite,3)/2; y = ScreenHeight/2 - SPR_Height(m_hSprite,3)/2;
SPR_DrawAdditive(3, x, y, NULL); SPR_DrawAdditive(3, x, y, NULL);
m_fAttackLeft = max( 0, m_fAttackLeft - fFade ); m_fAttackLeft = max( 0, m_fAttackLeft - fFade );
} else } else
m_fAttackLeft = 0; m_fAttackLeft = 0;
return 1; return 1;
} }
int CHudHealth::DrawDamage(float flTime) int CHudHealth::DrawDamage(float flTime)
{ {
int i, r, g, b, a; int i, r, g, b, a;
DAMAGE_IMAGE *pdmg; DAMAGE_IMAGE *pdmg;
if (!m_bitsDamage) if (!m_bitsDamage)
return 1; return 1;
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
a = (int)( fabs(sin(flTime*2)) * 256.0); a = (int)( fabs(sin(flTime*2)) * 256.0);
ScaleColors(r, g, b, a); ScaleColors(r, g, b, a);
// Draw all the items // Draw all the items
for (i = 0; i < NUM_DMG_TYPES; i++) for (i = 0; i < NUM_DMG_TYPES; i++)
{ {
if (m_bitsDamage & giDmgFlags[i]) if (m_bitsDamage & giDmgFlags[i])
{ {
pdmg = &m_dmg[i]; pdmg = &m_dmg[i];
SPR_Set(gHUD.GetSprite(m_HUD_dmg_bio + i), r, g, b ); SPR_Set(gHUD.GetSprite(m_HUD_dmg_bio + i), r, g, b );
SPR_DrawAdditive(0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect(m_HUD_dmg_bio + i)); SPR_DrawAdditive(0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect(m_HUD_dmg_bio + i));
} }
} }
// check for bits that should be expired // check for bits that should be expired
for ( i = 0; i < NUM_DMG_TYPES; i++ ) for ( i = 0; i < NUM_DMG_TYPES; i++ )
{ {
pdmg = &m_dmg[i]; pdmg = &m_dmg[i];
if ( m_bitsDamage & giDmgFlags[i] ) if ( m_bitsDamage & giDmgFlags[i] )
{ {
pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
if ( pdmg->fExpire <= flTime // when the time has expired if ( pdmg->fExpire <= flTime // when the time has expired
&& a < 40 ) // and the flash is at the low point of the cycle && a < 40 ) // and the flash is at the low point of the cycle
{ {
pdmg->fExpire = 0; pdmg->fExpire = 0;
int y = pdmg->y; int y = pdmg->y;
pdmg->x = pdmg->y = 0; pdmg->x = pdmg->y = 0;
// move everyone above down // move everyone above down
for (int j = 0; j < NUM_DMG_TYPES; j++) for (int j = 0; j < NUM_DMG_TYPES; j++)
{ {
pdmg = &m_dmg[j]; pdmg = &m_dmg[j];
if ((pdmg->y) && (pdmg->y < y)) if ((pdmg->y) && (pdmg->y < y))
pdmg->y += giDmgHeight; pdmg->y += giDmgHeight;
} }
m_bitsDamage &= ~giDmgFlags[i]; // clear the bits m_bitsDamage &= ~giDmgFlags[i]; // clear the bits
} }
} }
} }
return 1; return 1;
} }
void CHudHealth::UpdateTiles(float flTime, long bitsDamage) void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
{ {
DAMAGE_IMAGE *pdmg; DAMAGE_IMAGE *pdmg;
// Which types are new? // Which types are new?
long bitsOn = ~m_bitsDamage & bitsDamage; long bitsOn = ~m_bitsDamage & bitsDamage;
for (int i = 0; i < NUM_DMG_TYPES; i++) for (int i = 0; i < NUM_DMG_TYPES; i++)
{ {
pdmg = &m_dmg[i]; pdmg = &m_dmg[i];
// Is this one already on? // Is this one already on?
if (m_bitsDamage & giDmgFlags[i]) if (m_bitsDamage & giDmgFlags[i])
{ {
pdmg->fExpire = flTime + DMG_IMAGE_LIFE; // extend the duration pdmg->fExpire = flTime + DMG_IMAGE_LIFE; // extend the duration
if (!pdmg->fBaseline) if (!pdmg->fBaseline)
pdmg->fBaseline = flTime; pdmg->fBaseline = flTime;
} }
// Are we just turning it on? // Are we just turning it on?
if (bitsOn & giDmgFlags[i]) if (bitsOn & giDmgFlags[i])
{ {
// put this one at the bottom // put this one at the bottom
pdmg->x = giDmgWidth/8; pdmg->x = giDmgWidth/8;
pdmg->y = ScreenHeight - giDmgHeight * 2; pdmg->y = ScreenHeight - giDmgHeight * 2;
pdmg->fExpire=flTime + DMG_IMAGE_LIFE; pdmg->fExpire=flTime + DMG_IMAGE_LIFE;
// move everyone else up // move everyone else up
for (int j = 0; j < NUM_DMG_TYPES; j++) for (int j = 0; j < NUM_DMG_TYPES; j++)
{ {
if (j == i) if (j == i)
continue; continue;
pdmg = &m_dmg[j]; pdmg = &m_dmg[j];
if (pdmg->y) if (pdmg->y)
pdmg->y -= giDmgHeight; pdmg->y -= giDmgHeight;
} }
pdmg = &m_dmg[i]; pdmg = &m_dmg[i];
} }
} }
// damage bits are only turned on here; they are turned off when the draw time has expired (in DrawDamage()) // damage bits are only turned on here; they are turned off when the draw time has expired (in DrawDamage())
m_bitsDamage |= bitsDamage; m_bitsDamage |= bitsDamage;
} }

View File

@ -1,127 +1,127 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#define DMG_IMAGE_LIFE 2 // seconds that image is up #define DMG_IMAGE_LIFE 2 // seconds that image is up
#define DMG_IMAGE_POISON 0 #define DMG_IMAGE_POISON 0
#define DMG_IMAGE_ACID 1 #define DMG_IMAGE_ACID 1
#define DMG_IMAGE_COLD 2 #define DMG_IMAGE_COLD 2
#define DMG_IMAGE_DROWN 3 #define DMG_IMAGE_DROWN 3
#define DMG_IMAGE_BURN 4 #define DMG_IMAGE_BURN 4
#define DMG_IMAGE_NERVE 5 #define DMG_IMAGE_NERVE 5
#define DMG_IMAGE_RAD 6 #define DMG_IMAGE_RAD 6
#define DMG_IMAGE_SHOCK 7 #define DMG_IMAGE_SHOCK 7
//tf defines //tf defines
#define DMG_IMAGE_CALTROP 8 #define DMG_IMAGE_CALTROP 8
#define DMG_IMAGE_TRANQ 9 #define DMG_IMAGE_TRANQ 9
#define DMG_IMAGE_CONCUSS 10 #define DMG_IMAGE_CONCUSS 10
#define DMG_IMAGE_HALLUC 11 #define DMG_IMAGE_HALLUC 11
#define NUM_DMG_TYPES 12 #define NUM_DMG_TYPES 12
// instant damage // instant damage
#define DMG_GENERIC 0 // generic damage was done #define DMG_GENERIC 0 // generic damage was done
#define DMG_CRUSH (1 << 0) // crushed by falling or moving object #define DMG_CRUSH (1 << 0) // crushed by falling or moving object
#define DMG_BULLET (1 << 1) // shot #define DMG_BULLET (1 << 1) // shot
#define DMG_SLASH (1 << 2) // cut, clawed, stabbed #define DMG_SLASH (1 << 2) // cut, clawed, stabbed
#define DMG_BURN (1 << 3) // heat burned #define DMG_BURN (1 << 3) // heat burned
#define DMG_FREEZE (1 << 4) // frozen #define DMG_FREEZE (1 << 4) // frozen
#define DMG_FALL (1 << 5) // fell too far #define DMG_FALL (1 << 5) // fell too far
#define DMG_BLAST (1 << 6) // explosive blast damage #define DMG_BLAST (1 << 6) // explosive blast damage
#define DMG_CLUB (1 << 7) // crowbar, punch, headbutt #define DMG_CLUB (1 << 7) // crowbar, punch, headbutt
#define DMG_SHOCK (1 << 8) // electric shock #define DMG_SHOCK (1 << 8) // electric shock
#define DMG_SONIC (1 << 9) // sound pulse shockwave #define DMG_SONIC (1 << 9) // sound pulse shockwave
#define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam #define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam
#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death #define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death. #define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
// time-based damage // time-based damage
//mask off TF-specific stuff too //mask off TF-specific stuff too
#define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage #define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage
#define DMG_DROWN (1 << 14) // Drowning #define DMG_DROWN (1 << 14) // Drowning
#define DMG_FIRSTTIMEBASED DMG_DROWN #define DMG_FIRSTTIMEBASED DMG_DROWN
#define DMG_PARALYZE (1 << 15) // slows affected creature down #define DMG_PARALYZE (1 << 15) // slows affected creature down
#define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad #define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad
#define DMG_POISON (1 << 17) // blood poisioning #define DMG_POISON (1 << 17) // blood poisioning
#define DMG_RADIATION (1 << 18) // radiation exposure #define DMG_RADIATION (1 << 18) // radiation exposure
#define DMG_DROWNRECOVER (1 << 19) // drowning recovery #define DMG_DROWNRECOVER (1 << 19) // drowning recovery
#define DMG_ACID (1 << 20) // toxic chemicals or acid burns #define DMG_ACID (1 << 20) // toxic chemicals or acid burns
#define DMG_SLOWBURN (1 << 21) // in an oven #define DMG_SLOWBURN (1 << 21) // in an oven
#define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer #define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer
#define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar) #define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar)
//TF ADDITIONS //TF ADDITIONS
#define DMG_IGNITE (1 << 24) // Players hit by this begin to burn #define DMG_IGNITE (1 << 24) // Players hit by this begin to burn
#define DMG_RADIUS_MAX (1 << 25) // Radius damage with this flag doesn't decrease over distance #define DMG_RADIUS_MAX (1 << 25) // Radius damage with this flag doesn't decrease over distance
#define DMG_RADIUS_QUAKE (1 << 26) // Radius damage is done like Quake. 1/2 damage at 1/2 radius. #define DMG_RADIUS_QUAKE (1 << 26) // Radius damage is done like Quake. 1/2 damage at 1/2 radius.
#define DMG_IGNOREARMOR (1 << 27) // Damage ignores target's armor #define DMG_IGNOREARMOR (1 << 27) // Damage ignores target's armor
#define DMG_AIMED (1 << 28) // Does Hit location damage #define DMG_AIMED (1 << 28) // Does Hit location damage
#define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls #define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls
#define DMG_CALTROP (1<<30) #define DMG_CALTROP (1<<30)
#define DMG_HALLUC (1<<31) #define DMG_HALLUC (1<<31)
// TF Healing Additions for TakeHealth // TF Healing Additions for TakeHealth
#define DMG_IGNORE_MAXHEALTH DMG_IGNITE #define DMG_IGNORE_MAXHEALTH DMG_IGNITE
// TF Redefines since we never use the originals // TF Redefines since we never use the originals
#define DMG_NAIL DMG_SLASH #define DMG_NAIL DMG_SLASH
#define DMG_NOT_SELF DMG_FREEZE #define DMG_NOT_SELF DMG_FREEZE
#define DMG_TRANQ DMG_MORTAR #define DMG_TRANQ DMG_MORTAR
#define DMG_CONCUSS DMG_SONIC #define DMG_CONCUSS DMG_SONIC
typedef struct typedef struct
{ {
float fExpire; float fExpire;
float fBaseline; float fBaseline;
int x, y; int x, y;
} DAMAGE_IMAGE; } DAMAGE_IMAGE;
// //
//----------------------------------------------------- //-----------------------------------------------------
// //
class CHudHealth: public CHudBase class CHudHealth: public CHudBase
{ {
public: public:
virtual int Init( void ); virtual int Init( void );
virtual int VidInit( void ); virtual int VidInit( void );
virtual int Draw(float fTime); virtual int Draw(float fTime);
virtual void Reset( void ); virtual void Reset( void );
int MsgFunc_Health(const char *pszName, int iSize, void *pbuf); int MsgFunc_Health(const char *pszName, int iSize, void *pbuf);
int MsgFunc_Damage(const char *pszName, int iSize, void *pbuf); int MsgFunc_Damage(const char *pszName, int iSize, void *pbuf);
int m_iHealth; int m_iHealth;
int m_HUD_dmg_bio; int m_HUD_dmg_bio;
int m_HUD_cross; int m_HUD_cross;
float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight; float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight;
void GetPainColor( int &r, int &g, int &b ); void GetPainColor( int &r, int &g, int &b );
float m_fFade; float m_fFade;
private: private:
HSPRITE m_hSprite; HSPRITE m_hSprite;
HSPRITE m_hDamage; HSPRITE m_hDamage;
DAMAGE_IMAGE m_dmg[NUM_DMG_TYPES]; DAMAGE_IMAGE m_dmg[NUM_DMG_TYPES];
int m_bitsDamage; int m_bitsDamage;
int DrawPain(float fTime); int DrawPain(float fTime);
int DrawDamage(float fTime); int DrawDamage(float fTime);
void CalcDamageDirection(vec3_t vecFrom); void CalcDamageDirection(vec3_t vecFrom);
void UpdateTiles(float fTime, long bits); void UpdateTiles(float fTime, long bits);
}; };

View File

@ -1,347 +1,347 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
/* /*
========================== ==========================
This file contains "stubs" of class member implementations so that we can predict certain This file contains "stubs" of class member implementations so that we can predict certain
weapons client side. From time to time you might find that you need to implement part of the weapons client side. From time to time you might find that you need to implement part of the
these functions. If so, cut it from here, paste it in hl_weapons.cpp or somewhere else and these functions. If so, cut it from here, paste it in hl_weapons.cpp or somewhere else and
add in the functionality you need. add in the functionality you need.
========================== ==========================
*/ */
#include "extdll.h" #include "extdll.h"
#include "util.h" #include "util.h"
#include "cbase.h" #include "cbase.h"
#include "player.h" #include "player.h"
#include "weapons.h" #include "weapons.h"
#include "nodes.h" #include "nodes.h"
#include "soundent.h" #include "soundent.h"
#include "skill.h" #include "skill.h"
// Globals used by game logic // Globals used by game logic
const Vector g_vecZero = Vector( 0, 0, 0 ); const Vector g_vecZero = Vector( 0, 0, 0 );
int gmsgWeapPickup = 0; int gmsgWeapPickup = 0;
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS]; ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS];
void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch) { } void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch) { }
// CBaseEntity Stubs // CBaseEntity Stubs
int CBaseEntity :: TakeHealth( float flHealth, int bitsDamageType ) { return 1; } int CBaseEntity :: TakeHealth( float flHealth, int bitsDamageType ) { return 1; }
int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ) { return 1; } int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ) { return 1; }
CBaseEntity *CBaseEntity::GetNextTarget( void ) { return NULL; } CBaseEntity *CBaseEntity::GetNextTarget( void ) { return NULL; }
int CBaseEntity::Save( CSave &save ) { return 1; } int CBaseEntity::Save( CSave &save ) { return 1; }
int CBaseEntity::Restore( CRestore &restore ) { return 1; } int CBaseEntity::Restore( CRestore &restore ) { return 1; }
void CBaseEntity::SetObjectCollisionBox( void ) { } void CBaseEntity::SetObjectCollisionBox( void ) { }
int CBaseEntity :: Intersects( CBaseEntity *pOther ) { return 0; } int CBaseEntity :: Intersects( CBaseEntity *pOther ) { return 0; }
void CBaseEntity :: MakeDormant( void ) { } void CBaseEntity :: MakeDormant( void ) { }
int CBaseEntity :: IsDormant( void ) { return 0; } int CBaseEntity :: IsDormant( void ) { return 0; }
BOOL CBaseEntity :: IsInWorld( void ) { return TRUE; } BOOL CBaseEntity :: IsInWorld( void ) { return TRUE; }
int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; } int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; }
int CBaseEntity :: DamageDecal( int bitsDamageType ) { return -1; } int CBaseEntity :: DamageDecal( int bitsDamageType ) { return -1; }
CBaseEntity * CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; } CBaseEntity * CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
void CBaseEntity::SUB_Remove( void ) { } void CBaseEntity::SUB_Remove( void ) { }
// CBaseDelay Stubs // CBaseDelay Stubs
void CBaseDelay :: KeyValue( struct KeyValueData_s * ) { } void CBaseDelay :: KeyValue( struct KeyValueData_s * ) { }
int CBaseDelay::Restore( class CRestore & ) { return 1; } int CBaseDelay::Restore( class CRestore & ) { return 1; }
int CBaseDelay::Save( class CSave & ) { return 1; } int CBaseDelay::Save( class CSave & ) { return 1; }
// CBaseAnimating Stubs // CBaseAnimating Stubs
int CBaseAnimating::Restore( class CRestore & ) { return 1; } int CBaseAnimating::Restore( class CRestore & ) { return 1; }
int CBaseAnimating::Save( class CSave & ) { return 1; } int CBaseAnimating::Save( class CSave & ) { return 1; }
// DEBUG Stubs // DEBUG Stubs
edict_t *DBG_EntOfVars( const entvars_t *pev ) { return NULL; } edict_t *DBG_EntOfVars( const entvars_t *pev ) { return NULL; }
void DBG_AssertFunction(BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage) { } void DBG_AssertFunction(BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage) { }
// UTIL_* Stubs // UTIL_* Stubs
void UTIL_PrecacheOther( const char *szClassname ) { } void UTIL_PrecacheOther( const char *szClassname ) { }
void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { } void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { }
void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber ) { } void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber ) { }
void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber ) { } void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber ) { }
void UTIL_MakeVectors( const Vector &vecAngles ) { } void UTIL_MakeVectors( const Vector &vecAngles ) { }
BOOL UTIL_IsValidEntity( edict_t *pent ) { return TRUE; } BOOL UTIL_IsValidEntity( edict_t *pent ) { return TRUE; }
void UTIL_SetOrigin( entvars_t *, const Vector &org ) { } void UTIL_SetOrigin( entvars_t *, const Vector &org ) { }
BOOL UTIL_GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon ) { return TRUE; } BOOL UTIL_GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon ) { return TRUE; }
void UTIL_LogPrintf(char *,...) { } void UTIL_LogPrintf(char *,...) { }
void UTIL_ClientPrintAll( int,char const *,char const *,char const *,char const *,char const *) { } void UTIL_ClientPrintAll( int,char const *,char const *,char const *,char const *,char const *) { }
void ClientPrint( entvars_t *client, int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4 ) { } void ClientPrint( entvars_t *client, int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4 ) { }
// CBaseToggle Stubs // CBaseToggle Stubs
int CBaseToggle::Restore( class CRestore & ) { return 1; } int CBaseToggle::Restore( class CRestore & ) { return 1; }
int CBaseToggle::Save( class CSave & ) { return 1; } int CBaseToggle::Save( class CSave & ) { return 1; }
void CBaseToggle :: KeyValue( struct KeyValueData_s * ) { } void CBaseToggle :: KeyValue( struct KeyValueData_s * ) { }
// CGrenade Stubs // CGrenade Stubs
void CGrenade::BounceSound( void ) { } void CGrenade::BounceSound( void ) { }
void CGrenade::Explode( Vector, Vector ) { } void CGrenade::Explode( Vector, Vector ) { }
void CGrenade::Explode( TraceResult *, int ) { } void CGrenade::Explode( TraceResult *, int ) { }
void CGrenade::Killed( entvars_t *, int ) { } void CGrenade::Killed( entvars_t *, int ) { }
void CGrenade::Spawn( void ) { } void CGrenade::Spawn( void ) { }
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ){ return 0; } CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ){ return 0; }
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ){ return 0; } CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ){ return 0; }
void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ){ } void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ){ }
void UTIL_Remove( CBaseEntity *pEntity ){ } void UTIL_Remove( CBaseEntity *pEntity ){ }
struct skilldata_t gSkillData; struct skilldata_t gSkillData;
void UTIL_SetSize( entvars_t *pev, const Vector &vecMin, const Vector &vecMax ){ } void UTIL_SetSize( entvars_t *pev, const Vector &vecMin, const Vector &vecMax ){ }
CBaseEntity *UTIL_FindEntityInSphere( CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius ){ return 0;} CBaseEntity *UTIL_FindEntityInSphere( CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius ){ return 0;}
Vector UTIL_VecToAngles( const Vector &vec ){ return 0; } Vector UTIL_VecToAngles( const Vector &vec ){ return 0; }
CSprite *CSprite::SpriteCreate( const char *pSpriteName, const Vector &origin, BOOL animate ) { return 0; } CSprite *CSprite::SpriteCreate( const char *pSpriteName, const Vector &origin, BOOL animate ) { return 0; }
void CBeam::PointEntInit( const Vector &start, int endIndex ) { } void CBeam::PointEntInit( const Vector &start, int endIndex ) { }
CBeam *CBeam::BeamCreate( const char *pSpriteName, int width ) { return NULL; } CBeam *CBeam::BeamCreate( const char *pSpriteName, int width ) { return NULL; }
void CSprite::Expand( float scaleSpeed, float fadeSpeed ) { } void CSprite::Expand( float scaleSpeed, float fadeSpeed ) { }
CBaseEntity* CBaseMonster :: CheckTraceHullAttack( float flDist, int iDamage, int iDmgType ) { return NULL; } CBaseEntity* CBaseMonster :: CheckTraceHullAttack( float flDist, int iDamage, int iDmgType ) { return NULL; }
void CBaseMonster :: Eat ( float flFullDuration ) { } void CBaseMonster :: Eat ( float flFullDuration ) { }
BOOL CBaseMonster :: FShouldEat ( void ) { return TRUE; } BOOL CBaseMonster :: FShouldEat ( void ) { return TRUE; }
void CBaseMonster :: BarnacleVictimBitten ( entvars_t *pevBarnacle ) { } void CBaseMonster :: BarnacleVictimBitten ( entvars_t *pevBarnacle ) { }
void CBaseMonster :: BarnacleVictimReleased ( void ) { } void CBaseMonster :: BarnacleVictimReleased ( void ) { }
void CBaseMonster :: Listen ( void ) { } void CBaseMonster :: Listen ( void ) { }
float CBaseMonster :: FLSoundVolume ( CSound *pSound ) { return 0.0; } float CBaseMonster :: FLSoundVolume ( CSound *pSound ) { return 0.0; }
BOOL CBaseMonster :: FValidateHintType ( short sHint ) { return FALSE; } BOOL CBaseMonster :: FValidateHintType ( short sHint ) { return FALSE; }
void CBaseMonster :: Look ( int iDistance ) { } void CBaseMonster :: Look ( int iDistance ) { }
int CBaseMonster :: ISoundMask ( void ) { return 0; } int CBaseMonster :: ISoundMask ( void ) { return 0; }
CSound* CBaseMonster :: PBestSound ( void ) { return NULL; } CSound* CBaseMonster :: PBestSound ( void ) { return NULL; }
CSound* CBaseMonster :: PBestScent ( void ) { return NULL; } CSound* CBaseMonster :: PBestScent ( void ) { return NULL; }
float CBaseAnimating :: StudioFrameAdvance ( float flInterval ) { return 0.0; } float CBaseAnimating :: StudioFrameAdvance ( float flInterval ) { return 0.0; }
void CBaseMonster :: MonsterThink ( void ) { } void CBaseMonster :: MonsterThink ( void ) { }
void CBaseMonster :: MonsterUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { } void CBaseMonster :: MonsterUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { }
int CBaseMonster :: IgnoreConditions ( void ) { return 0; } int CBaseMonster :: IgnoreConditions ( void ) { return 0; }
void CBaseMonster :: RouteClear ( void ) { } void CBaseMonster :: RouteClear ( void ) { }
void CBaseMonster :: RouteNew ( void ) { } void CBaseMonster :: RouteNew ( void ) { }
BOOL CBaseMonster :: FRouteClear ( void ) { return FALSE; } BOOL CBaseMonster :: FRouteClear ( void ) { return FALSE; }
BOOL CBaseMonster :: FRefreshRoute ( void ) { return 0; } BOOL CBaseMonster :: FRefreshRoute ( void ) { return 0; }
BOOL CBaseMonster::MoveToEnemy( Activity movementAct, float waitTime ) { return FALSE; } BOOL CBaseMonster::MoveToEnemy( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToLocation( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; } BOOL CBaseMonster::MoveToLocation( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
BOOL CBaseMonster::MoveToTarget( Activity movementAct, float waitTime ) { return FALSE; } BOOL CBaseMonster::MoveToTarget( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToNode( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; } BOOL CBaseMonster::MoveToNode( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
int ShouldSimplify( int routeType ) { return TRUE; } int ShouldSimplify( int routeType ) { return TRUE; }
void CBaseMonster :: RouteSimplify( CBaseEntity *pTargetEnt ) { } void CBaseMonster :: RouteSimplify( CBaseEntity *pTargetEnt ) { }
BOOL CBaseMonster :: FBecomeProne ( void ) { return TRUE; } BOOL CBaseMonster :: FBecomeProne ( void ) { return TRUE; }
BOOL CBaseMonster :: CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; } BOOL CBaseMonster :: CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; } BOOL CBaseMonster :: CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack1 ( float flDot, float flDist ) { return FALSE; } BOOL CBaseMonster :: CheckMeleeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack2 ( float flDot, float flDist ) { return FALSE; } BOOL CBaseMonster :: CheckMeleeAttack2 ( float flDot, float flDist ) { return FALSE; }
void CBaseMonster :: CheckAttacks ( CBaseEntity *pTarget, float flDist ) { } void CBaseMonster :: CheckAttacks ( CBaseEntity *pTarget, float flDist ) { }
BOOL CBaseMonster :: FCanCheckAttacks ( void ) { return FALSE; } BOOL CBaseMonster :: FCanCheckAttacks ( void ) { return FALSE; }
int CBaseMonster :: CheckEnemy ( CBaseEntity *pEnemy ) { return 0; } int CBaseMonster :: CheckEnemy ( CBaseEntity *pEnemy ) { return 0; }
void CBaseMonster :: PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { } void CBaseMonster :: PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { }
BOOL CBaseMonster :: PopEnemy( ) { return FALSE; } BOOL CBaseMonster :: PopEnemy( ) { return FALSE; }
void CBaseMonster :: SetActivity ( Activity NewActivity ) { } void CBaseMonster :: SetActivity ( Activity NewActivity ) { }
void CBaseMonster :: SetSequenceByName ( char *szSequence ) { } void CBaseMonster :: SetSequenceByName ( char *szSequence ) { }
int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; } int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; }
float CBaseMonster :: OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; } float CBaseMonster :: OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; }
void CBaseMonster :: AdvanceRoute ( float distance ) { } void CBaseMonster :: AdvanceRoute ( float distance ) { }
int CBaseMonster :: RouteClassify( int iMoveFlag ) { return 0; } int CBaseMonster :: RouteClassify( int iMoveFlag ) { return 0; }
BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEntity *pTarget ) { return FALSE; } BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEntity *pTarget ) { return FALSE; }
void CBaseMonster :: InsertWaypoint ( Vector vecLocation, int afMoveFlags ) { } void CBaseMonster :: InsertWaypoint ( Vector vecLocation, int afMoveFlags ) { }
BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex ) { return FALSE; } BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex ) { return FALSE; }
void CBaseMonster :: Move ( float flInterval ) { } void CBaseMonster :: Move ( float flInterval ) { }
BOOL CBaseMonster:: ShouldAdvanceRoute( float flWaypointDist ) { return FALSE; } BOOL CBaseMonster:: ShouldAdvanceRoute( float flWaypointDist ) { return FALSE; }
void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval ) { } void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval ) { }
void CBaseMonster :: MonsterInit ( void ) { } void CBaseMonster :: MonsterInit ( void ) { }
void CBaseMonster :: MonsterInitThink ( void ) { } void CBaseMonster :: MonsterInitThink ( void ) { }
void CBaseMonster :: StartMonster ( void ) { } void CBaseMonster :: StartMonster ( void ) { }
void CBaseMonster :: MovementComplete( void ) { } void CBaseMonster :: MovementComplete( void ) { }
int CBaseMonster::TaskIsRunning( void ) { return 0; } int CBaseMonster::TaskIsRunning( void ) { return 0; }
int CBaseMonster::IRelationship ( CBaseEntity *pTarget ) { return 0; } int CBaseMonster::IRelationship ( CBaseEntity *pTarget ) { return 0; }
BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; } BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; } BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
CBaseEntity *CBaseMonster :: BestVisibleEnemy ( void ) { return NULL; } CBaseEntity *CBaseMonster :: BestVisibleEnemy ( void ) { return NULL; }
BOOL CBaseMonster :: FInViewCone ( CBaseEntity *pEntity ) { return FALSE; } BOOL CBaseMonster :: FInViewCone ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseMonster :: FInViewCone ( Vector *pOrigin ) { return FALSE; } BOOL CBaseMonster :: FInViewCone ( Vector *pOrigin ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity ) { return FALSE; } BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( const Vector &vecOrigin ) { return FALSE; } BOOL CBaseEntity :: FVisible ( const Vector &vecOrigin ) { return FALSE; }
void CBaseMonster :: MakeIdealYaw( Vector vecTarget ) { } void CBaseMonster :: MakeIdealYaw( Vector vecTarget ) { }
float CBaseMonster::FlYawDiff ( void ) { return 0.0; } float CBaseMonster::FlYawDiff ( void ) { return 0.0; }
float CBaseMonster::ChangeYaw ( int yawSpeed ) { return 0; } float CBaseMonster::ChangeYaw ( int yawSpeed ) { return 0; }
float CBaseMonster::VecToYaw ( Vector vecDir ) { return 0.0; } float CBaseMonster::VecToYaw ( Vector vecDir ) { return 0.0; }
int CBaseAnimating :: LookupActivity ( int activity ) { return 0; } int CBaseAnimating :: LookupActivity ( int activity ) { return 0; }
int CBaseAnimating :: LookupActivityHeaviest ( int activity ) { return 0; } int CBaseAnimating :: LookupActivityHeaviest ( int activity ) { return 0; }
void CBaseMonster :: SetEyePosition ( void ) { } void CBaseMonster :: SetEyePosition ( void ) { }
int CBaseAnimating :: LookupSequence ( const char *label ) { return 0; } int CBaseAnimating :: LookupSequence ( const char *label ) { return 0; }
void CBaseAnimating :: ResetSequenceInfo ( ) { } void CBaseAnimating :: ResetSequenceInfo ( ) { }
BOOL CBaseAnimating :: GetSequenceFlags( ) { return FALSE; } BOOL CBaseAnimating :: GetSequenceFlags( ) { return FALSE; }
void CBaseAnimating :: DispatchAnimEvents ( float flInterval ) { } void CBaseAnimating :: DispatchAnimEvents ( float flInterval ) { }
void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent ) { } void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent ) { }
float CBaseAnimating :: SetBoneController ( int iController, float flValue ) { return 0.0; } float CBaseAnimating :: SetBoneController ( int iController, float flValue ) { return 0.0; }
void CBaseAnimating :: InitBoneControllers ( void ) { } void CBaseAnimating :: InitBoneControllers ( void ) { }
float CBaseAnimating :: SetBlending ( int iBlender, float flValue ) { return 0; } float CBaseAnimating :: SetBlending ( int iBlender, float flValue ) { return 0; }
void CBaseAnimating :: GetBonePosition ( int iBone, Vector &origin, Vector &angles ) { } void CBaseAnimating :: GetBonePosition ( int iBone, Vector &origin, Vector &angles ) { }
void CBaseAnimating :: GetAttachment ( int iAttachment, Vector &origin, Vector &angles ) { } void CBaseAnimating :: GetAttachment ( int iAttachment, Vector &origin, Vector &angles ) { }
int CBaseAnimating :: FindTransition( int iEndingSequence, int iGoalSequence, int *piDir ) { return -1; } int CBaseAnimating :: FindTransition( int iEndingSequence, int iGoalSequence, int *piDir ) { return -1; }
void CBaseAnimating :: GetAutomovement( Vector &origin, Vector &angles, float flInterval ) { } void CBaseAnimating :: GetAutomovement( Vector &origin, Vector &angles, float flInterval ) { }
void CBaseAnimating :: SetBodygroup( int iGroup, int iValue ) { } void CBaseAnimating :: SetBodygroup( int iGroup, int iValue ) { }
int CBaseAnimating :: GetBodygroup( int iGroup ) { return 0; } int CBaseAnimating :: GetBodygroup( int iGroup ) { return 0; }
Vector CBaseMonster :: GetGunPosition( void ) { return g_vecZero; } Vector CBaseMonster :: GetGunPosition( void ) { return g_vecZero; }
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { } void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker ) { } void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker ) { }
void CBaseEntity :: TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) { } void CBaseEntity :: TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) { }
void CBaseMonster :: MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir ) { } void CBaseMonster :: MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir ) { }
BOOL CBaseMonster :: FGetNodeRoute ( Vector vecDest ) { return TRUE; } BOOL CBaseMonster :: FGetNodeRoute ( Vector vecDest ) { return TRUE; }
int CBaseMonster :: FindHintNode ( void ) { return NO_NODE; } int CBaseMonster :: FindHintNode ( void ) { return NO_NODE; }
void CBaseMonster::ReportAIState( void ) { } void CBaseMonster::ReportAIState( void ) { }
void CBaseMonster :: KeyValue( KeyValueData *pkvd ) { } void CBaseMonster :: KeyValue( KeyValueData *pkvd ) { }
BOOL CBaseMonster :: FCheckAITrigger ( void ) { return FALSE; } BOOL CBaseMonster :: FCheckAITrigger ( void ) { return FALSE; }
int CBaseMonster :: CanPlaySequence( BOOL fDisregardMonsterState, int interruptLevel ) { return FALSE; } int CBaseMonster :: CanPlaySequence( BOOL fDisregardMonsterState, int interruptLevel ) { return FALSE; }
BOOL CBaseMonster :: FindLateralCover ( const Vector &vecThreat, const Vector &vecViewOffset ) { return FALSE; } BOOL CBaseMonster :: FindLateralCover ( const Vector &vecThreat, const Vector &vecViewOffset ) { return FALSE; }
Vector CBaseMonster :: ShootAtEnemy( const Vector &shootOrigin ) { return g_vecZero; } Vector CBaseMonster :: ShootAtEnemy( const Vector &shootOrigin ) { return g_vecZero; }
BOOL CBaseMonster :: FacingIdeal( void ) { return FALSE; } BOOL CBaseMonster :: FacingIdeal( void ) { return FALSE; }
BOOL CBaseMonster :: FCanActiveIdle ( void ) { return FALSE; } BOOL CBaseMonster :: FCanActiveIdle ( void ) { return FALSE; }
void CBaseMonster::PlaySentence( const char *pszSentence, float duration, float volume, float attenuation ) { } void CBaseMonster::PlaySentence( const char *pszSentence, float duration, float volume, float attenuation ) { }
void CBaseMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener ) { } void CBaseMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener ) { }
void CBaseMonster::SentenceStop( void ) { } void CBaseMonster::SentenceStop( void ) { }
void CBaseMonster::CorpseFallThink( void ) { } void CBaseMonster::CorpseFallThink( void ) { }
void CBaseMonster :: MonsterInitDead( void ) { } void CBaseMonster :: MonsterInitDead( void ) { }
BOOL CBaseMonster :: BBoxFlat ( void ) { return TRUE; } BOOL CBaseMonster :: BBoxFlat ( void ) { return TRUE; }
BOOL CBaseMonster :: GetEnemy ( void ) { return FALSE; } BOOL CBaseMonster :: GetEnemy ( void ) { return FALSE; }
void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { } void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
CBaseEntity* CBaseMonster :: DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; } CBaseEntity* CBaseMonster :: DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; }
BOOL CBaseMonster :: ShouldFadeOnDeath( void ) { return FALSE; } BOOL CBaseMonster :: ShouldFadeOnDeath( void ) { return FALSE; }
void CBaseMonster :: RadiusDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { } void CBaseMonster :: RadiusDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
void CBaseMonster :: RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { } void CBaseMonster :: RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
void CBaseMonster::FadeMonster( void ) { } void CBaseMonster::FadeMonster( void ) { }
void CBaseMonster :: GibMonster( void ) { } void CBaseMonster :: GibMonster( void ) { }
BOOL CBaseMonster :: HasHumanGibs( void ) { return FALSE; } BOOL CBaseMonster :: HasHumanGibs( void ) { return FALSE; }
BOOL CBaseMonster :: HasAlienGibs( void ) { return FALSE; } BOOL CBaseMonster :: HasAlienGibs( void ) { return FALSE; }
Activity CBaseMonster :: GetDeathActivity ( void ) { return ACT_DIE_HEADSHOT; } Activity CBaseMonster :: GetDeathActivity ( void ) { return ACT_DIE_HEADSHOT; }
MONSTERSTATE CBaseMonster :: GetIdealState ( void ) { return MONSTERSTATE_ALERT; } MONSTERSTATE CBaseMonster :: GetIdealState ( void ) { return MONSTERSTATE_ALERT; }
Schedule_t* CBaseMonster :: GetScheduleOfType ( int Type ) { return NULL; } Schedule_t* CBaseMonster :: GetScheduleOfType ( int Type ) { return NULL; }
Schedule_t *CBaseMonster :: GetSchedule ( void ) { return NULL; } Schedule_t *CBaseMonster :: GetSchedule ( void ) { return NULL; }
void CBaseMonster :: RunTask ( Task_t *pTask ) { } void CBaseMonster :: RunTask ( Task_t *pTask ) { }
void CBaseMonster :: StartTask ( Task_t *pTask ) { } void CBaseMonster :: StartTask ( Task_t *pTask ) { }
Schedule_t *CBaseMonster::ScheduleFromName( const char *pName ) { return NULL;} Schedule_t *CBaseMonster::ScheduleFromName( const char *pName ) { return NULL;}
void CBaseMonster::BecomeDead( void ) {} void CBaseMonster::BecomeDead( void ) {}
void CBaseMonster :: RunAI ( void ) {} void CBaseMonster :: RunAI ( void ) {}
void CBaseMonster :: Killed( entvars_t *pevAttacker, int iGib ) {} void CBaseMonster :: Killed( entvars_t *pevAttacker, int iGib ) {}
int CBaseMonster :: TakeHealth (float flHealth, int bitsDamageType) { return 0; } int CBaseMonster :: TakeHealth (float flHealth, int bitsDamageType) { return 0; }
int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; } int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
int CBaseMonster::Restore( class CRestore & ) { return 1; } int CBaseMonster::Restore( class CRestore & ) { return 1; }
int CBaseMonster::Save( class CSave & ) { return 1; } int CBaseMonster::Save( class CSave & ) { return 1; }
int TrainSpeed(int iSpeed, int iMax) { return 0; } int TrainSpeed(int iSpeed, int iMax) { return 0; }
void CBasePlayer :: DeathSound( void ) { } void CBasePlayer :: DeathSound( void ) { }
int CBasePlayer :: TakeHealth( float flHealth, int bitsDamageType ) { return 0; } int CBasePlayer :: TakeHealth( float flHealth, int bitsDamageType ) { return 0; }
void CBasePlayer :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { } void CBasePlayer :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
int CBasePlayer :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; } int CBasePlayer :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
void CBasePlayer::PackDeadPlayerItems( void ) { } void CBasePlayer::PackDeadPlayerItems( void ) { }
void CBasePlayer::RemoveAllItems( BOOL removeSuit ) { } void CBasePlayer::RemoveAllItems( BOOL removeSuit ) { }
void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim ) { } void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim ) { }
void CBasePlayer::WaterMove() { } void CBasePlayer::WaterMove() { }
BOOL CBasePlayer::IsOnLadder( void ) { return FALSE; } BOOL CBasePlayer::IsOnLadder( void ) { return FALSE; }
void CBasePlayer::PlayerDeathThink(void) { } void CBasePlayer::PlayerDeathThink(void) { }
void CBasePlayer::StartDeathCam( void ) { } void CBasePlayer::StartDeathCam( void ) { }
void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) { } void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) { }
void CBasePlayer::PlayerUse ( void ) { } void CBasePlayer::PlayerUse ( void ) { }
void CBasePlayer::Jump() { } void CBasePlayer::Jump() { }
void CBasePlayer::Duck( ) { } void CBasePlayer::Duck( ) { }
int CBasePlayer::Classify ( void ) { return 0; } int CBasePlayer::Classify ( void ) { return 0; }
void CBasePlayer::PreThink(void) { } void CBasePlayer::PreThink(void) { }
void CBasePlayer::CheckTimeBasedDamage() { } void CBasePlayer::CheckTimeBasedDamage() { }
void CBasePlayer :: UpdateGeigerCounter( void ) { } void CBasePlayer :: UpdateGeigerCounter( void ) { }
void CBasePlayer::CheckSuitUpdate() { } void CBasePlayer::CheckSuitUpdate() { }
void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) { } void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) { }
void CBasePlayer :: UpdatePlayerSound ( void ) { } void CBasePlayer :: UpdatePlayerSound ( void ) { }
void CBasePlayer::PostThink() { } void CBasePlayer::PostThink() { }
void CBasePlayer :: Precache( void ) { } void CBasePlayer :: Precache( void ) { }
int CBasePlayer::Save( CSave &save ) { return 0; } int CBasePlayer::Save( CSave &save ) { return 0; }
void CBasePlayer::RenewItems(void) { } void CBasePlayer::RenewItems(void) { }
int CBasePlayer::Restore( CRestore &restore ) { return 0; } int CBasePlayer::Restore( CRestore &restore ) { return 0; }
void CBasePlayer::SelectNextItem( int iItem ) { } void CBasePlayer::SelectNextItem( int iItem ) { }
BOOL CBasePlayer::HasWeapons( void ) { return FALSE; } BOOL CBasePlayer::HasWeapons( void ) { return FALSE; }
void CBasePlayer::SelectPrevItem( int iItem ) { } void CBasePlayer::SelectPrevItem( int iItem ) { }
CBaseEntity *FindEntityForward( CBaseEntity *pMe ) { return NULL; } CBaseEntity *FindEntityForward( CBaseEntity *pMe ) { return NULL; }
BOOL CBasePlayer :: FlashlightIsOn( void ) { return FALSE; } BOOL CBasePlayer :: FlashlightIsOn( void ) { return FALSE; }
void CBasePlayer :: FlashlightTurnOn( void ) { } void CBasePlayer :: FlashlightTurnOn( void ) { }
void CBasePlayer :: FlashlightTurnOff( void ) { } void CBasePlayer :: FlashlightTurnOff( void ) { }
void CBasePlayer :: ForceClientDllUpdate( void ) { } void CBasePlayer :: ForceClientDllUpdate( void ) { }
void CBasePlayer::ImpulseCommands( ) { } void CBasePlayer::ImpulseCommands( ) { }
void CBasePlayer::CheatImpulseCommands( int iImpulse ) { } void CBasePlayer::CheatImpulseCommands( int iImpulse ) { }
int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem ) { return FALSE; } int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem ) { return FALSE; } int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
void CBasePlayer::ItemPreFrame() { } void CBasePlayer::ItemPreFrame() { }
void CBasePlayer::ItemPostFrame() { } void CBasePlayer::ItemPostFrame() { }
int CBasePlayer::AmmoInventory( int iAmmoIndex ) { return -1; } int CBasePlayer::AmmoInventory( int iAmmoIndex ) { return -1; }
int CBasePlayer::GetAmmoIndex(const char *psz) { return -1; } int CBasePlayer::GetAmmoIndex(const char *psz) { return -1; }
void CBasePlayer::SendAmmoUpdate(void) { } void CBasePlayer::SendAmmoUpdate(void) { }
void CBasePlayer :: UpdateClientData( void ) { } void CBasePlayer :: UpdateClientData( void ) { }
BOOL CBasePlayer :: FBecomeProne ( void ) { return TRUE; } BOOL CBasePlayer :: FBecomeProne ( void ) { return TRUE; }
void CBasePlayer :: BarnacleVictimBitten ( entvars_t *pevBarnacle ) { } void CBasePlayer :: BarnacleVictimBitten ( entvars_t *pevBarnacle ) { }
void CBasePlayer :: BarnacleVictimReleased ( void ) { } void CBasePlayer :: BarnacleVictimReleased ( void ) { }
int CBasePlayer :: Illumination( void ) { return 0; } int CBasePlayer :: Illumination( void ) { return 0; }
void CBasePlayer :: EnableControl(BOOL fControl) { } void CBasePlayer :: EnableControl(BOOL fControl) { }
Vector CBasePlayer :: GetAutoaimVector( float flDelta ) { return g_vecZero; } Vector CBasePlayer :: GetAutoaimVector( float flDelta ) { return g_vecZero; }
Vector CBasePlayer :: AutoaimDeflection( Vector &vecSrc, float flDist, float flDelta ) { return g_vecZero; } Vector CBasePlayer :: AutoaimDeflection( Vector &vecSrc, float flDist, float flDelta ) { return g_vecZero; }
void CBasePlayer :: ResetAutoaim( ) { } void CBasePlayer :: ResetAutoaim( ) { }
void CBasePlayer :: SetCustomDecalFrames( int nFrames ) { } void CBasePlayer :: SetCustomDecalFrames( int nFrames ) { }
int CBasePlayer :: GetCustomDecalFrames( void ) { return -1; } int CBasePlayer :: GetCustomDecalFrames( void ) { return -1; }
void CBasePlayer::DropPlayerItem ( char *pszItemName ) { } void CBasePlayer::DropPlayerItem ( char *pszItemName ) { }
BOOL CBasePlayer::HasPlayerItem( CBasePlayerItem *pCheckItem ) { return FALSE; } BOOL CBasePlayer::HasPlayerItem( CBasePlayerItem *pCheckItem ) { return FALSE; }
BOOL CBasePlayer :: SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; } BOOL CBasePlayer :: SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; }
Vector CBasePlayer :: GetGunPosition( void ) { return g_vecZero; } Vector CBasePlayer :: GetGunPosition( void ) { return g_vecZero; }
const char *CBasePlayer::TeamID( void ) { return ""; } const char *CBasePlayer::TeamID( void ) { return ""; }
int CBasePlayer :: GiveAmmo( int iCount, char *szName, int iMax ) { return 0; } int CBasePlayer :: GiveAmmo( int iCount, char *szName, int iMax ) { return 0; }
void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) { } void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) { }
void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { } void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { }
void ClearMultiDamage(void) { } void ClearMultiDamage(void) { }
void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker ) { } void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker ) { }
void AddMultiDamage( entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) { } void AddMultiDamage( entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) { }
void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage) { } void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage) { }
int DamageDecal( CBaseEntity *pEntity, int bitsDamageType ) { return 0; } int DamageDecal( CBaseEntity *pEntity, int bitsDamageType ) { return 0; }
void DecalGunshot( TraceResult *pTrace, int iBulletType ) { } void DecalGunshot( TraceResult *pTrace, int iBulletType ) { }
void EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype ) { } void EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype ) { }
void AddAmmoNameToAmmoRegistry( const char *szAmmoname ) { } void AddAmmoNameToAmmoRegistry( const char *szAmmoname ) { }
int CBasePlayerItem::Restore( class CRestore & ) { return 1; } int CBasePlayerItem::Restore( class CRestore & ) { return 1; }
int CBasePlayerItem::Save( class CSave & ) { return 1; } int CBasePlayerItem::Save( class CSave & ) { return 1; }
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; } int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
int CBasePlayerWeapon::Save( class CSave & ) { return 1; } int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
void CBasePlayerItem :: SetObjectCollisionBox( void ) { } void CBasePlayerItem :: SetObjectCollisionBox( void ) { }
void CBasePlayerItem :: FallInit( void ) { } void CBasePlayerItem :: FallInit( void ) { }
void CBasePlayerItem::FallThink ( void ) { } void CBasePlayerItem::FallThink ( void ) { }
void CBasePlayerItem::Materialize( void ) { } void CBasePlayerItem::Materialize( void ) { }
void CBasePlayerItem::AttemptToMaterialize( void ) { } void CBasePlayerItem::AttemptToMaterialize( void ) { }
void CBasePlayerItem :: CheckRespawn ( void ) { } void CBasePlayerItem :: CheckRespawn ( void ) { }
CBaseEntity* CBasePlayerItem::Respawn( void ) { return NULL; } CBaseEntity* CBasePlayerItem::Respawn( void ) { return NULL; }
void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) { } void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) { }
void CBasePlayerItem::DestroyItem( void ) { } void CBasePlayerItem::DestroyItem( void ) { }
int CBasePlayerItem::AddToPlayer( CBasePlayer *pPlayer ) { return TRUE; } int CBasePlayerItem::AddToPlayer( CBasePlayer *pPlayer ) { return TRUE; }
void CBasePlayerItem::Drop( void ) { } void CBasePlayerItem::Drop( void ) { }
void CBasePlayerItem::Kill( void ) { } void CBasePlayerItem::Kill( void ) { }
void CBasePlayerItem::Holster( int skiplocal ) { } void CBasePlayerItem::Holster( int skiplocal ) { }
void CBasePlayerItem::AttachToPlayer ( CBasePlayer *pPlayer ) { } void CBasePlayerItem::AttachToPlayer ( CBasePlayer *pPlayer ) { }
int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal ) { return 0; } int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal ) { return 0; }
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer ) { return FALSE; } int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer ) { return FALSE; }
int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) { return 0; } int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) { return 0; }
BOOL CBasePlayerWeapon :: AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry ) { return TRUE; } BOOL CBasePlayerWeapon :: AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry ) { return TRUE; }
BOOL CBasePlayerWeapon :: AddSecondaryAmmo( int iCount, char *szName, int iMax ) { return TRUE; } BOOL CBasePlayerWeapon :: AddSecondaryAmmo( int iCount, char *szName, int iMax ) { return TRUE; }
BOOL CBasePlayerWeapon :: IsUseable( void ) { return TRUE; } BOOL CBasePlayerWeapon :: IsUseable( void ) { return TRUE; }
int CBasePlayerWeapon::PrimaryAmmoIndex( void ) { return -1; } int CBasePlayerWeapon::PrimaryAmmoIndex( void ) { return -1; }
int CBasePlayerWeapon::SecondaryAmmoIndex( void ) { return -1; } int CBasePlayerWeapon::SecondaryAmmoIndex( void ) { return -1; }
void CBasePlayerAmmo::Spawn( void ) { } void CBasePlayerAmmo::Spawn( void ) { }
CBaseEntity* CBasePlayerAmmo::Respawn( void ) { return this; } CBaseEntity* CBasePlayerAmmo::Respawn( void ) { return this; }
void CBasePlayerAmmo::Materialize( void ) { } void CBasePlayerAmmo::Materialize( void ) { }
void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) { } void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) { }
int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { return 0; } int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; } int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
void CBasePlayerWeapon::RetireWeapon( void ) { } void CBasePlayerWeapon::RetireWeapon( void ) { }
void CSoundEnt::InsertSound ( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {} void CSoundEnt::InsertSound ( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {}
void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){} void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){}

View File

@ -1,80 +1,80 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#include "../hud.h" #include "../hud.h"
#include "../cl_util.h" #include "../cl_util.h"
#include "event_api.h" #include "event_api.h"
extern "C" extern "C"
{ {
// HLDM // HLDM
void EV_FireGlock1( struct event_args_s *args ); void EV_FireGlock1( struct event_args_s *args );
void EV_FireGlock2( struct event_args_s *args ); void EV_FireGlock2( struct event_args_s *args );
void EV_FireShotGunSingle( struct event_args_s *args ); void EV_FireShotGunSingle( struct event_args_s *args );
void EV_FireShotGunDouble( struct event_args_s *args ); void EV_FireShotGunDouble( struct event_args_s *args );
void EV_FireMP5( struct event_args_s *args ); void EV_FireMP5( struct event_args_s *args );
void EV_FireMP52( struct event_args_s *args ); void EV_FireMP52( struct event_args_s *args );
void EV_FirePython( struct event_args_s *args ); void EV_FirePython( struct event_args_s *args );
void EV_FireGauss( struct event_args_s *args ); void EV_FireGauss( struct event_args_s *args );
void EV_SpinGauss( struct event_args_s *args ); void EV_SpinGauss( struct event_args_s *args );
void EV_Crowbar( struct event_args_s *args ); void EV_Crowbar( struct event_args_s *args );
void EV_FireCrossbow( struct event_args_s *args ); void EV_FireCrossbow( struct event_args_s *args );
void EV_FireCrossbow2( struct event_args_s *args ); void EV_FireCrossbow2( struct event_args_s *args );
void EV_FireRpg( struct event_args_s *args ); void EV_FireRpg( struct event_args_s *args );
void EV_EgonFire( struct event_args_s *args ); void EV_EgonFire( struct event_args_s *args );
void EV_EgonStop( struct event_args_s *args ); void EV_EgonStop( struct event_args_s *args );
void EV_HornetGunFire( struct event_args_s *args ); void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args ); void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args ); void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args ); void EV_TrainPitchAdjust( struct event_args_s *args );
} }
/* /*
====================== ======================
Game_HookEvents Game_HookEvents
Associate script file name with callback functions. Callback's must be extern "C" so Associate script file name with callback functions. Callback's must be extern "C" so
the engine doesn't get confused about name mangling stuff. Note that the format is the engine doesn't get confused about name mangling stuff. Note that the format is
always the same. Of course, a clever mod team could actually embed parameters, behavior always the same. Of course, a clever mod team could actually embed parameters, behavior
into the actual .sc files and create a .sc file parser and hook their functionality through into the actual .sc files and create a .sc file parser and hook their functionality through
that.. i.e., a scripting system. that.. i.e., a scripting system.
That was what we were going to do, but we ran out of time...oh well. That was what we were going to do, but we ran out of time...oh well.
====================== ======================
*/ */
void Game_HookEvents( void ) void Game_HookEvents( void )
{ {
gEngfuncs.pfnHookEvent( "events/glock1.sc", EV_FireGlock1 ); gEngfuncs.pfnHookEvent( "events/glock1.sc", EV_FireGlock1 );
gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 ); gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 );
gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle ); gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle );
gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble ); gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble );
gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 ); gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 );
gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 ); gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 );
gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython ); gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython );
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss ); gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss ); gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust ); gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar ); gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar );
gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow ); gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow );
gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 ); gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 );
gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg ); gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg );
gEngfuncs.pfnHookEvent( "events/egon_fire.sc", EV_EgonFire ); gEngfuncs.pfnHookEvent( "events/egon_fire.sc", EV_EgonFire );
gEngfuncs.pfnHookEvent( "events/egon_stop.sc", EV_EgonStop ); gEngfuncs.pfnHookEvent( "events/egon_stop.sc", EV_EgonStop );
gEngfuncs.pfnHookEvent( "events/firehornet.sc", EV_HornetGunFire ); gEngfuncs.pfnHookEvent( "events/firehornet.sc", EV_HornetGunFire );
gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire ); gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire );
gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire ); gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire );
} }

View File

@ -1,90 +1,90 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#include "../hud.h" #include "../hud.h"
#include "../cl_util.h" #include "../cl_util.h"
#include "../demo.h" #include "../demo.h"
#include "demo_api.h" #include "demo_api.h"
#include "const.h" #include "const.h"
#include "entity_state.h" #include "entity_state.h"
#include "cl_entity.h" #include "cl_entity.h"
#include "pm_defs.h" #include "pm_defs.h"
#include "event_api.h" #include "event_api.h"
#include "entity_types.h" #include "entity_types.h"
#include "r_efx.h" #include "r_efx.h"
extern BEAM *pBeam; extern BEAM *pBeam;
extern BEAM *pBeam2; extern BEAM *pBeam2;
void HUD_GetLastOrg( float *org ); void HUD_GetLastOrg( float *org );
void UpdateBeams ( void ) void UpdateBeams ( void )
{ {
vec3_t forward, vecSrc, vecEnd, origin, angles, right, up; vec3_t forward, vecSrc, vecEnd, origin, angles, right, up;
vec3_t view_ofs; vec3_t view_ofs;
pmtrace_t tr; pmtrace_t tr;
cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer(); cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer();
int idx = pthisplayer->index; int idx = pthisplayer->index;
// Get our exact viewangles from engine // Get our exact viewangles from engine
gEngfuncs.GetViewAngles( (float *)angles ); gEngfuncs.GetViewAngles( (float *)angles );
// Determine our last predicted origin // Determine our last predicted origin
HUD_GetLastOrg( (float *)&origin ); HUD_GetLastOrg( (float *)&origin );
AngleVectors( angles, forward, right, up ); AngleVectors( angles, forward, right, up );
VectorCopy( origin, vecSrc ); VectorCopy( origin, vecSrc );
VectorMA( vecSrc, 2048, forward, vecEnd ); VectorMA( vecSrc, 2048, forward, vecEnd );
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true ); gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
// Store off the old count // Store off the old count
gEngfuncs.pEventAPI->EV_PushPMStates(); gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players. // Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 ); gEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 ); gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr ); gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
gEngfuncs.pEventAPI->EV_PopPMStates(); gEngfuncs.pEventAPI->EV_PopPMStates();
if ( pBeam ) if ( pBeam )
{ {
pBeam->target = tr.endpos; pBeam->target = tr.endpos;
pBeam->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case. pBeam->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
} }
if ( pBeam2 ) if ( pBeam2 )
{ {
pBeam2->target = tr.endpos; pBeam2->target = tr.endpos;
pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case. pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
} }
} }
/* /*
===================== =====================
Game_AddObjects Game_AddObjects
Add game specific, client-side objects here Add game specific, client-side objects here
===================== =====================
*/ */
void Game_AddObjects( void ) void Game_AddObjects( void )
{ {
if ( pBeam && pBeam2 ) if ( pBeam && pBeam2 )
UpdateBeams(); UpdateBeams();
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( HUD_IFACEH ) #if !defined( HUD_IFACEH )
#define HUD_IFACEH #define HUD_IFACEH
#pragma once #pragma once
#include "exportdef.h" #include "exportdef.h"
typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "wrect.h" #include "wrect.h"
#include "../engine/cdll_int.h" #include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs; extern cl_enginefunc_t gEngfuncs;
#endif #endif

View File

@ -1,120 +1,120 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// hud_msg.cpp // hud_msg.cpp
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include "r_efx.h" #include "r_efx.h"
#define MAX_CLIENTS 32 #define MAX_CLIENTS 32
extern BEAM *pBeam; extern BEAM *pBeam;
extern BEAM *pBeam2; extern BEAM *pBeam2;
/// USER-DEFINED SERVER MESSAGE HANDLERS /// USER-DEFINED SERVER MESSAGE HANDLERS
int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf ) int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
{ {
ASSERT( iSize == 0 ); ASSERT( iSize == 0 );
// clear all hud data // clear all hud data
HUDLIST *pList = m_pHudList; HUDLIST *pList = m_pHudList;
while ( pList ) while ( pList )
{ {
if ( pList->p ) if ( pList->p )
pList->p->Reset(); pList->p->Reset();
pList = pList->pNext; pList = pList->pNext;
} }
// reset sensitivity // reset sensitivity
m_flMouseSensitivity = 0; m_flMouseSensitivity = 0;
// reset concussion effect // reset concussion effect
m_iConcussionEffect = 0; m_iConcussionEffect = 0;
return 1; return 1;
} }
void CAM_ToFirstPerson(void); void CAM_ToFirstPerson(void);
void CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf ) void CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
{ {
CAM_ToFirstPerson(); CAM_ToFirstPerson();
} }
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf ) void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{ {
// prepare all hud data // prepare all hud data
HUDLIST *pList = m_pHudList; HUDLIST *pList = m_pHudList;
while (pList) while (pList)
{ {
if ( pList->p ) if ( pList->p )
pList->p->InitHUDData(); pList->p->InitHUDData();
pList = pList->pNext; pList = pList->pNext;
} }
//Probably not a good place to put this. //Probably not a good place to put this.
pBeam = pBeam2 = NULL; pBeam = pBeam2 = NULL;
} }
int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf ) int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
m_Teamplay = READ_BYTE(); m_Teamplay = READ_BYTE();
return 1; return 1;
} }
int CHud :: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf ) int CHud :: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
{ {
int armor, blood; int armor, blood;
Vector from; Vector from;
int i; int i;
float count; float count;
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
armor = READ_BYTE(); armor = READ_BYTE();
blood = READ_BYTE(); blood = READ_BYTE();
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
from[i] = READ_COORD(); from[i] = READ_COORD();
count = (blood * 0.5) + (armor * 0.5); count = (blood * 0.5) + (armor * 0.5);
if (count < 10) if (count < 10)
count = 10; count = 10;
// TODO: kick viewangles, show damage visually // TODO: kick viewangles, show damage visually
return 1; return 1;
} }
int CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf ) int CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
m_iConcussionEffect = READ_BYTE(); m_iConcussionEffect = READ_BYTE();
if (m_iConcussionEffect) if (m_iConcussionEffect)
this->m_StatusIcons.EnableIcon("dmg_concuss",255,160,0); this->m_StatusIcons.EnableIcon("dmg_concuss",255,160,0);
else else
this->m_StatusIcons.DisableIcon("dmg_concuss"); this->m_StatusIcons.DisableIcon("dmg_concuss");
return 1; return 1;
} }

View File

@ -1,365 +1,365 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// hud_redraw.cpp // hud_redraw.cpp
// //
#include <math.h> #include <math.h>
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
//#include "triangleapi.h" //#include "triangleapi.h"
#define MAX_LOGO_FRAMES 56 #define MAX_LOGO_FRAMES 56
int grgLogoFrame[MAX_LOGO_FRAMES] = int grgLogoFrame[MAX_LOGO_FRAMES] =
{ {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 12, 11, 10, 9, 8, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 12, 11, 10, 9, 8, 14, 15,
16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
29, 29, 29, 29, 29, 28, 27, 26, 25, 24, 30, 31 29, 29, 29, 29, 29, 28, 27, 26, 25, 24, 30, 31
}; };
extern int g_iVisibleMouse; extern int g_iVisibleMouse;
float HUD_GetFOV( void ); float HUD_GetFOV( void );
extern cvar_t *sensitivity; extern cvar_t *sensitivity;
// Think // Think
void CHud::Think(void) void CHud::Think(void)
{ {
int newfov; int newfov;
HUDLIST *pList = m_pHudList; HUDLIST *pList = m_pHudList;
while (pList) while (pList)
{ {
if (pList->p->m_iFlags & HUD_ACTIVE) if (pList->p->m_iFlags & HUD_ACTIVE)
pList->p->Think(); pList->p->Think();
pList = pList->pNext; pList = pList->pNext;
} }
newfov = HUD_GetFOV(); newfov = HUD_GetFOV();
if ( newfov == 0 ) if ( newfov == 0 )
{ {
m_iFOV = default_fov->value; m_iFOV = default_fov->value;
} }
else else
{ {
m_iFOV = newfov; m_iFOV = newfov;
} }
// the clients fov is actually set in the client data update section of the hud // the clients fov is actually set in the client data update section of the hud
// Set a new sensitivity // Set a new sensitivity
if ( m_iFOV == default_fov->value ) if ( m_iFOV == default_fov->value )
{ {
// reset to saved sensitivity // reset to saved sensitivity
m_flMouseSensitivity = 0; m_flMouseSensitivity = 0;
} }
else else
{ {
// set a new sensitivity that is proportional to the change from the FOV default // set a new sensitivity that is proportional to the change from the FOV default
m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)default_fov->value) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)default_fov->value) * CVAR_GET_FLOAT("zoom_sensitivity_ratio");
} }
// think about default fov // think about default fov
if ( m_iFOV == 0 ) if ( m_iFOV == 0 )
{ // only let players adjust up in fov, and only if they are not overriden by something else { // only let players adjust up in fov, and only if they are not overriden by something else
m_iFOV = max( default_fov->value, 90 ); m_iFOV = max( default_fov->value, 90 );
} }
} }
// Redraw // Redraw
// step through the local data, placing the appropriate graphics & text as appropriate // step through the local data, placing the appropriate graphics & text as appropriate
// returns 1 if they've changed, 0 otherwise // returns 1 if they've changed, 0 otherwise
int CHud :: Redraw( float flTime, int intermission ) int CHud :: Redraw( float flTime, int intermission )
{ {
m_fOldTime = m_flTime; // save time of previous redraw m_fOldTime = m_flTime; // save time of previous redraw
m_flTime = flTime; m_flTime = flTime;
m_flTimeDelta = (double)m_flTime - m_fOldTime; m_flTimeDelta = (double)m_flTime - m_fOldTime;
static float m_flShotTime = 0; static float m_flShotTime = 0;
// Clock was reset, reset delta // Clock was reset, reset delta
if ( m_flTimeDelta < 0 ) if ( m_flTimeDelta < 0 )
m_flTimeDelta = 0; m_flTimeDelta = 0;
if (m_flShotTime && m_flShotTime < flTime) if (m_flShotTime && m_flShotTime < flTime)
{ {
gEngfuncs.pfnClientCmd("snapshot\n"); gEngfuncs.pfnClientCmd("snapshot\n");
m_flShotTime = 0; m_flShotTime = 0;
} }
m_iIntermission = intermission; m_iIntermission = intermission;
// if no redrawing is necessary // if no redrawing is necessary
// return 0; // return 0;
if ( m_pCvarDraw->value ) if ( m_pCvarDraw->value )
{ {
HUDLIST *pList = m_pHudList; HUDLIST *pList = m_pHudList;
while (pList) while (pList)
{ {
if ( !intermission ) if ( !intermission )
{ {
if ( (pList->p->m_iFlags & HUD_ACTIVE) && !(m_iHideHUDDisplay & HIDEHUD_ALL) ) if ( (pList->p->m_iFlags & HUD_ACTIVE) && !(m_iHideHUDDisplay & HIDEHUD_ALL) )
pList->p->Draw(flTime); pList->p->Draw(flTime);
} }
else else
{ // it's an intermission, so only draw hud elements that are set to draw during intermissions { // it's an intermission, so only draw hud elements that are set to draw during intermissions
if ( pList->p->m_iFlags & HUD_INTERMISSION ) if ( pList->p->m_iFlags & HUD_INTERMISSION )
pList->p->Draw( flTime ); pList->p->Draw( flTime );
} }
pList = pList->pNext; pList = pList->pNext;
} }
} }
// are we in demo mode? do we need to draw the logo in the top corner? // are we in demo mode? do we need to draw the logo in the top corner?
if (m_iLogo) if (m_iLogo)
{ {
int x, y, i; int x, y, i;
if (m_hsprLogo == 0) if (m_hsprLogo == 0)
m_hsprLogo = LoadSprite("sprites/%d_logo.spr"); m_hsprLogo = LoadSprite("sprites/%d_logo.spr");
SPR_Set(m_hsprLogo, 250, 250, 250 ); SPR_Set(m_hsprLogo, 250, 250, 250 );
x = SPR_Width(m_hsprLogo, 0); x = SPR_Width(m_hsprLogo, 0);
x = ScreenWidth - x; x = ScreenWidth - x;
y = SPR_Height(m_hsprLogo, 0)/2; y = SPR_Height(m_hsprLogo, 0)/2;
// Draw the logo at 20 fps // Draw the logo at 20 fps
int iFrame = (int)(flTime * 20) % MAX_LOGO_FRAMES; int iFrame = (int)(flTime * 20) % MAX_LOGO_FRAMES;
i = grgLogoFrame[iFrame] - 1; i = grgLogoFrame[iFrame] - 1;
SPR_DrawAdditive(i, x, y, NULL); SPR_DrawAdditive(i, x, y, NULL);
} }
/* /*
if ( g_iVisibleMouse ) if ( g_iVisibleMouse )
{ {
void IN_GetMousePos( int *mx, int *my ); void IN_GetMousePos( int *mx, int *my );
int mx, my; int mx, my;
IN_GetMousePos( &mx, &my ); IN_GetMousePos( &mx, &my );
if (m_hsprCursor == 0) if (m_hsprCursor == 0)
{ {
char sz[256]; char sz[256];
sprintf( sz, "sprites/cursor.spr" ); sprintf( sz, "sprites/cursor.spr" );
m_hsprCursor = SPR_Load( sz ); m_hsprCursor = SPR_Load( sz );
} }
SPR_Set(m_hsprCursor, 250, 250, 250 ); SPR_Set(m_hsprCursor, 250, 250, 250 );
// Draw the logo at 20 fps // Draw the logo at 20 fps
SPR_DrawAdditive( 0, mx, my, NULL ); SPR_DrawAdditive( 0, mx, my, NULL );
} }
*/ */
return 1; return 1;
} }
void ScaleColors( int &r, int &g, int &b, int a ) void ScaleColors( int &r, int &g, int &b, int a )
{ {
float x = (float)a / 255; float x = (float)a / 255;
r = (int)(r * x); r = (int)(r * x);
g = (int)(g * x); g = (int)(g * x);
b = (int)(b * x); b = (int)(b * x);
} }
const unsigned char colors[8][3] = const unsigned char colors[8][3] =
{ {
{127, 127, 127}, // additive cannot be black {127, 127, 127}, // additive cannot be black
{255, 0, 0}, {255, 0, 0},
{ 0, 255, 0}, { 0, 255, 0},
{255, 255, 0}, {255, 255, 0},
{ 0, 0, 255}, { 0, 0, 255},
{ 0, 255, 255}, { 0, 255, 255},
{255, 0, 255}, {255, 0, 255},
{240, 180, 24} {240, 180, 24}
}; };
int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b ) int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
{ {
if( hud_textmode->value == 2 ) if( hud_textmode->value == 2 )
{ {
gEngfuncs.pfnDrawSetTextColor( r/255.0, g/255.0, b/255.0 ); gEngfuncs.pfnDrawSetTextColor( r/255.0, g/255.0, b/255.0 );
return gEngfuncs.pfnDrawConsoleString( xpos, ypos, (char*) szIt ); return gEngfuncs.pfnDrawConsoleString( xpos, ypos, (char*) szIt );
} }
// xash3d: reset unicode state // xash3d: reset unicode state
TextMessageDrawChar( 0, 0, 0, 0, 0, 0 ); TextMessageDrawChar( 0, 0, 0, 0, 0, 0 );
// draw the string until we hit the null character or a newline character // draw the string until we hit the null character or a newline character
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ ) for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
{ {
int w = gHUD.m_scrinfo.charWidths[ 'M' ]; int w = gHUD.m_scrinfo.charWidths[ 'M' ];
if ( xpos + w > iMaxX ) if ( xpos + w > iMaxX )
return xpos; return xpos;
if( (*szIt == '^') && (*(szIt + 1) >= '0') && (*(szIt + 1) <= '7') ) if( (*szIt == '^') && (*(szIt + 1) >= '0') && (*(szIt + 1) <= '7') )
{ {
szIt++; szIt++;
r = colors[ *szIt - '0' ][0]; r = colors[ *szIt - '0' ][0];
g = colors[ *szIt - '0' ][1]; g = colors[ *szIt - '0' ][1];
b = colors[ *szIt - '0' ][2]; b = colors[ *szIt - '0' ][2];
if( !*(++szIt)) if( !*(++szIt))
return xpos; return xpos;
} }
int c = (unsigned int)(unsigned char)*szIt; int c = (unsigned int)(unsigned char)*szIt;
xpos += TextMessageDrawChar( xpos, ypos, c, r, g, b ); xpos += TextMessageDrawChar( xpos, ypos, c, r, g, b );
} }
return xpos; return xpos;
} }
int CHud :: DrawHudStringLen( char *szIt ) int CHud :: DrawHudStringLen( char *szIt )
{ {
int l = 0; int l = 0;
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ ) for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
{ {
l += gHUD.m_scrinfo.charWidths[ (unsigned char)*szIt ]; l += gHUD.m_scrinfo.charWidths[ (unsigned char)*szIt ];
} }
return l; return l;
} }
int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ) int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b )
{ {
char szString[32]; char szString[32];
sprintf( szString, "%d", iNumber ); sprintf( szString, "%d", iNumber );
return DrawHudStringReverse( xpos, ypos, iMinX, szString, r, g, b ); return DrawHudStringReverse( xpos, ypos, iMinX, szString, r, g, b );
} }
// draws a string from right to left (right-aligned) // draws a string from right to left (right-aligned)
int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ) int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b )
{ {
// find the end of the string // find the end of the string
for( char *szIt = szString; *szIt != 0; szIt++ ) for( char *szIt = szString; *szIt != 0; szIt++ )
xpos -= gHUD.m_scrinfo.charWidths[ (unsigned char) *szIt ]; xpos -= gHUD.m_scrinfo.charWidths[ (unsigned char) *szIt ];
if( xpos < iMinX ) if( xpos < iMinX )
xpos = iMinX; xpos = iMinX;
DrawHudString( xpos, ypos, gHUD.m_scrinfo.iWidth, szString, r, g, b ); DrawHudString( xpos, ypos, gHUD.m_scrinfo.iWidth, szString, r, g, b );
return xpos; return xpos;
} }
int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b) int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b)
{ {
int iWidth = GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left; int iWidth = GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left;
int k; int k;
if (iNumber > 0) if (iNumber > 0)
{ {
// SPR_Draw 100's // SPR_Draw 100's
if (iNumber >= 100) if (iNumber >= 100)
{ {
k = iNumber/100; k = iNumber/100;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b ); SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k)); SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
x += iWidth; x += iWidth;
} }
else if (iFlags & (DHN_3DIGITS)) else if (iFlags & (DHN_3DIGITS))
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
} }
// SPR_Draw 10's // SPR_Draw 10's
if (iNumber >= 10) if (iNumber >= 10)
{ {
k = (iNumber % 100)/10; k = (iNumber % 100)/10;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b ); SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k)); SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
x += iWidth; x += iWidth;
} }
else if (iFlags & (DHN_3DIGITS | DHN_2DIGITS)) else if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
} }
// SPR_Draw ones // SPR_Draw ones
k = iNumber % 10; k = iNumber % 10;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b ); SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
SPR_DrawAdditive(0, x, y, &GetSpriteRect(m_HUD_number_0 + k)); SPR_DrawAdditive(0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
x += iWidth; x += iWidth;
} }
else if (iFlags & DHN_DRAWZERO) else if (iFlags & DHN_DRAWZERO)
{ {
SPR_Set(GetSprite(m_HUD_number_0), r, g, b ); SPR_Set(GetSprite(m_HUD_number_0), r, g, b );
// SPR_Draw 100's // SPR_Draw 100's
if (iFlags & (DHN_3DIGITS)) if (iFlags & (DHN_3DIGITS))
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
} }
if (iFlags & (DHN_3DIGITS | DHN_2DIGITS)) if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
} }
// SPR_Draw ones // SPR_Draw ones
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0)); SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0));
x += iWidth; x += iWidth;
} }
return x; return x;
} }
int CHud::GetNumWidth( int iNumber, int iFlags ) int CHud::GetNumWidth( int iNumber, int iFlags )
{ {
if (iFlags & (DHN_3DIGITS)) if (iFlags & (DHN_3DIGITS))
return 3; return 3;
if (iFlags & (DHN_2DIGITS)) if (iFlags & (DHN_2DIGITS))
return 2; return 2;
if (iNumber <= 0) if (iNumber <= 0)
{ {
if (iFlags & (DHN_DRAWZERO)) if (iFlags & (DHN_DRAWZERO))
return 1; return 1;
else else
return 0; return 0;
} }
if (iNumber < 10) if (iNumber < 10)
return 1; return 1;
if (iNumber < 100) if (iNumber < 100)
return 2; return 2;
return 3; return 3;
} }
void CHud::DrawDarkRectangle( int x, int y, int wide, int tall ) void CHud::DrawDarkRectangle( int x, int y, int wide, int tall )
{ {
//gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture ); //gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );
gEngfuncs.pfnFillRGBABlend( x, y, wide, tall, 0, 0, 0, 255 * 0.6 ); gEngfuncs.pfnFillRGBABlend( x, y, wide, tall, 0, 0, 0, 255 * 0.6 );
FillRGBA( x+1, y, wide-1, 1, 255, 140, 0, 255 ); FillRGBA( x+1, y, wide-1, 1, 255, 140, 0, 255 );
FillRGBA( x, y, 1, tall-1, 255, 140, 0, 255 ); FillRGBA( x, y, 1, tall-1, 255, 140, 0, 255 );
FillRGBA( x+wide-1, y+1, 1, tall-1, 255, 140, 0, 255 ); FillRGBA( x+wide-1, y+1, 1, tall-1, 255, 140, 0, 255 );
FillRGBA( x, y+tall-1, wide-1, 1, 255, 140, 0, 255 ); FillRGBA( x, y+tall-1, wide-1, 1, 255, 140, 0, 255 );
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +1,41 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( HUD_SERVERSH ) #if !defined( HUD_SERVERSH )
#define HUD_SERVERSH #define HUD_SERVERSH
#pragma once #pragma once
#define NET_CALLBACK /* */ #define NET_CALLBACK /* */
// Dispatchers // Dispatchers
void NET_CALLBACK ListResponse( struct net_response_s *response ); void NET_CALLBACK ListResponse( struct net_response_s *response );
void NET_CALLBACK ServerResponse( struct net_response_s *response ); void NET_CALLBACK ServerResponse( struct net_response_s *response );
void NET_CALLBACK PingResponse( struct net_response_s *response ); void NET_CALLBACK PingResponse( struct net_response_s *response );
void NET_CALLBACK RulesResponse( struct net_response_s *response ); void NET_CALLBACK RulesResponse( struct net_response_s *response );
void NET_CALLBACK PlayersResponse( struct net_response_s *response ); void NET_CALLBACK PlayersResponse( struct net_response_s *response );
void ServersInit( void ); void ServersInit( void );
void ServersShutdown( void ); void ServersShutdown( void );
void ServersThink( double time ); void ServersThink( double time );
void ServersCancel( void ); void ServersCancel( void );
// Get list and get server info from each // Get list and get server info from each
void ServersList( void ); void ServersList( void );
// Query for IP / IPX LAN servers // Query for IP / IPX LAN servers
void BroadcastServersList( int clearpending ); void BroadcastServersList( int clearpending );
void ServerPing( int server ); void ServerPing( int server );
void ServerRules( int server ); void ServerRules( int server );
void ServerPlayers( int server ); void ServerPlayers( int server );
int ServersGetCount( void ); int ServersGetCount( void );
const char *ServersGetInfo( int server ); const char *ServersGetInfo( int server );
int ServersIsQuerying( void ); int ServersIsQuerying( void );
void SortServers( const char *fieldname ); void SortServers( const char *fieldname );
#endif // HUD_SERVERSH #endif // HUD_SERVERSH

View File

@ -1,98 +1,98 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( HUD_SERVERS_PRIVH ) #if !defined( HUD_SERVERS_PRIVH )
#define HUD_SERVERS_PRIVH #define HUD_SERVERS_PRIVH
#pragma once #pragma once
#include "netadr.h" #include "netadr.h"
class CHudServers class CHudServers
{ {
public: public:
typedef struct request_s typedef struct request_s
{ {
struct request_s *next; struct request_s *next;
netadr_t remote_address; netadr_t remote_address;
int context; int context;
} request_t; } request_t;
typedef struct server_s typedef struct server_s
{ {
struct server_s *next; struct server_s *next;
netadr_t remote_address; netadr_t remote_address;
char *info; char *info;
int ping; int ping;
} server_t; } server_t;
CHudServers(); CHudServers();
~CHudServers(); ~CHudServers();
void Think( double time ); void Think( double time );
void QueryThink( void ); void QueryThink( void );
int isQuerying( void ); int isQuerying( void );
int LoadMasterAddresses( int maxservers, int *count, netadr_t *padr ); int LoadMasterAddresses( int maxservers, int *count, netadr_t *padr );
void RequestList( void ); void RequestList( void );
void RequestBroadcastList( int clearpending ); void RequestBroadcastList( int clearpending );
void ServerPing( int server ); void ServerPing( int server );
void ServerRules( int server ); void ServerRules( int server );
void ServerPlayers( int server ); void ServerPlayers( int server );
void CancelRequest( void ); void CancelRequest( void );
int CompareServers( server_t *p1, server_t *p2 ); int CompareServers( server_t *p1, server_t *p2 );
void ClearServerList( server_t **ppList ); void ClearServerList( server_t **ppList );
void ClearRequestList( request_t **ppList ); void ClearRequestList( request_t **ppList );
void AddServer( server_t **ppList, server_t *p ); void AddServer( server_t **ppList, server_t *p );
void RemoveServerFromList( request_t **ppList, request_t *item ); void RemoveServerFromList( request_t **ppList, request_t *item );
request_t *FindRequest( int context, request_t *pList ); request_t *FindRequest( int context, request_t *pList );
int ServerListSize( void ); int ServerListSize( void );
char *GetServerInfo( int server ); char *GetServerInfo( int server );
int GetServerCount( void ); int GetServerCount( void );
void SortServers( const char *fieldname ); void SortServers( const char *fieldname );
void ListResponse( struct net_response_s *response ); void ListResponse( struct net_response_s *response );
void ServerResponse( struct net_response_s *response ); void ServerResponse( struct net_response_s *response );
void PingResponse( struct net_response_s *response ); void PingResponse( struct net_response_s *response );
void RulesResponse( struct net_response_s *response ); void RulesResponse( struct net_response_s *response );
void PlayersResponse( struct net_response_s *response ); void PlayersResponse( struct net_response_s *response );
private: private:
server_t *GetServer( int server ); server_t *GetServer( int server );
// //
char m_szToken[ 1024 ]; char m_szToken[ 1024 ];
int m_nRequesting; int m_nRequesting;
int m_nDone; int m_nDone;
double m_dStarted; double m_dStarted;
request_t *m_pServerList; request_t *m_pServerList;
request_t *m_pActiveList; request_t *m_pActiveList;
server_t *m_pServers; server_t *m_pServers;
int m_nServerCount; int m_nServerCount;
int m_nActiveQueries; int m_nActiveQueries;
int m_nQuerying; int m_nQuerying;
double m_fElapsed; double m_fElapsed;
request_t *m_pPingRequest; request_t *m_pPingRequest;
request_t *m_pRulesRequest; request_t *m_pRulesRequest;
request_t *m_pPlayersRequest; request_t *m_pPlayersRequest;
}; };
#endif // HUD_SERVERS_PRIVH #endif // HUD_SERVERS_PRIVH

File diff suppressed because it is too large Load Diff

View File

@ -1,132 +1,132 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#ifndef SPECTATOR_H #ifndef SPECTATOR_H
#define SPECTATOR_H #define SPECTATOR_H
#pragma once #pragma once
#include "cl_entity.h" #include "cl_entity.h"
#define INSET_OFF 0 #define INSET_OFF 0
#define INSET_CHASE_FREE 1 #define INSET_CHASE_FREE 1
#define INSET_IN_EYE 2 #define INSET_IN_EYE 2
#define INSET_MAP_FREE 3 #define INSET_MAP_FREE 3
#define INSET_MAP_CHASE 4 #define INSET_MAP_CHASE 4
#define MAX_SPEC_HUD_MESSAGES 8 #define MAX_SPEC_HUD_MESSAGES 8
#define OVERVIEW_TILE_SIZE 128 // don't change this #define OVERVIEW_TILE_SIZE 128 // don't change this
#define OVERVIEW_MAX_LAYERS 1 #define OVERVIEW_MAX_LAYERS 1
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it ) // Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
typedef struct overviewInfo_s { typedef struct overviewInfo_s {
char map[64]; // cl.levelname or empty char map[64]; // cl.levelname or empty
vec3_t origin; // center of map vec3_t origin; // center of map
float zoom; // zoom of map images float zoom; // zoom of map images
int layers; // how may layers do we have int layers; // how may layers do we have
float layersHeights[OVERVIEW_MAX_LAYERS]; float layersHeights[OVERVIEW_MAX_LAYERS];
char layersImages[OVERVIEW_MAX_LAYERS][255]; char layersImages[OVERVIEW_MAX_LAYERS][255];
qboolean rotated; // are map images rotated (90 degrees) ? qboolean rotated; // are map images rotated (90 degrees) ?
int insetWindowX; int insetWindowX;
int insetWindowY; int insetWindowY;
int insetWindowHeight; int insetWindowHeight;
int insetWindowWidth; int insetWindowWidth;
} overviewInfo_t; } overviewInfo_t;
typedef struct overviewEntity_s { typedef struct overviewEntity_s {
HSPRITE hSprite; HSPRITE hSprite;
struct cl_entity_s * entity; struct cl_entity_s * entity;
double killTime; double killTime;
} overviewEntity_t; } overviewEntity_t;
#define MAX_OVERVIEW_ENTITIES 128 #define MAX_OVERVIEW_ENTITIES 128
class CHudSpectator : public CHudBase class CHudSpectator : public CHudBase
{ {
public: public:
void Reset(); void Reset();
int ToggleInset(bool allowOff); int ToggleInset(bool allowOff);
void CheckSettings(); void CheckSettings();
void InitHUDData( void ); void InitHUDData( void );
bool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime); bool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime);
void DeathMessage(int victim); void DeathMessage(int victim);
bool AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname ); bool AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname );
void CheckOverviewEntities(); void CheckOverviewEntities();
void DrawOverview(); void DrawOverview();
void DrawOverviewEntities(); void DrawOverviewEntities();
void GetMapPosition( float * returnvec ); void GetMapPosition( float * returnvec );
void DrawOverviewLayer(); void DrawOverviewLayer();
void LoadMapSprites(); void LoadMapSprites();
bool ParseOverviewFile(); bool ParseOverviewFile();
bool IsActivePlayer(cl_entity_t * ent); bool IsActivePlayer(cl_entity_t * ent);
void SetModes(int iMainMode, int iInsetMode); void SetModes(int iMainMode, int iInsetMode);
void HandleButtonsDown(int ButtonPressed); void HandleButtonsDown(int ButtonPressed);
void HandleButtonsUp(int ButtonPressed); void HandleButtonsUp(int ButtonPressed);
void FindNextPlayer( bool bReverse ); void FindNextPlayer( bool bReverse );
void DirectorMessage( int iSize, void *pbuf ); void DirectorMessage( int iSize, void *pbuf );
void SetSpectatorStartPosition(); void SetSpectatorStartPosition();
int Init(); int Init();
int VidInit(); int VidInit();
int Draw(float flTime); int Draw(float flTime);
int m_iDrawCycle; int m_iDrawCycle;
client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES]; client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES];
char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128]; char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128];
int m_lastHudMessage; int m_lastHudMessage;
overviewInfo_t m_OverviewData; overviewInfo_t m_OverviewData;
overviewEntity_t m_OverviewEntities[MAX_OVERVIEW_ENTITIES]; overviewEntity_t m_OverviewEntities[MAX_OVERVIEW_ENTITIES];
int m_iObserverFlags; int m_iObserverFlags;
int m_iSpectatorNumber; int m_iSpectatorNumber;
float m_mapZoom; // zoom the user currently uses float m_mapZoom; // zoom the user currently uses
vec3_t m_mapOrigin; // origin where user rotates around vec3_t m_mapOrigin; // origin where user rotates around
cvar_t * m_drawnames; cvar_t * m_drawnames;
cvar_t * m_drawcone; cvar_t * m_drawcone;
cvar_t * m_drawstatus; cvar_t * m_drawstatus;
cvar_t * m_autoDirector; cvar_t * m_autoDirector;
cvar_t * m_pip; cvar_t * m_pip;
qboolean m_chatEnabled; qboolean m_chatEnabled;
vec3_t m_cameraOrigin; // a help camera vec3_t m_cameraOrigin; // a help camera
vec3_t m_cameraAngles; // and it's angles vec3_t m_cameraAngles; // and it's angles
private: private:
vec3_t m_vPlayerPos[MAX_PLAYERS]; vec3_t m_vPlayerPos[MAX_PLAYERS];
HSPRITE m_hsprPlayerBlue; HSPRITE m_hsprPlayerBlue;
HSPRITE m_hsprPlayerRed; HSPRITE m_hsprPlayerRed;
HSPRITE m_hsprPlayer; HSPRITE m_hsprPlayer;
HSPRITE m_hsprCamera; HSPRITE m_hsprCamera;
HSPRITE m_hsprPlayerDead; HSPRITE m_hsprPlayerDead;
HSPRITE m_hsprViewcone; HSPRITE m_hsprViewcone;
HSPRITE m_hsprUnkownMap; HSPRITE m_hsprUnkownMap;
HSPRITE m_hsprBeam; HSPRITE m_hsprBeam;
HSPRITE m_hCrosshair; HSPRITE m_hCrosshair;
wrect_t m_crosshairRect; wrect_t m_crosshairRect;
struct model_s * m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame struct model_s * m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame
float m_flNextObserverInput; float m_flNextObserverInput;
float m_zoomDelta; float m_zoomDelta;
float m_moveDelta; float m_moveDelta;
int m_lastPrimaryObject; int m_lastPrimaryObject;
int m_lastSecondaryObject; int m_lastSecondaryObject;
}; };
#endif // SPECTATOR_H #endif // SPECTATOR_H

View File

@ -1,54 +1,54 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// hud_update.cpp // hud_update.cpp
// //
#include <math.h> #include <math.h>
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include <stdlib.h> #include <stdlib.h>
#include <memory.h> #include <memory.h>
int CL_ButtonBits( int ); int CL_ButtonBits( int );
void CL_ResetButtonBits( int bits ); void CL_ResetButtonBits( int bits );
extern float v_idlescale; extern float v_idlescale;
float in_fov; float in_fov;
extern void HUD_SetCmdBits( int bits ); extern void HUD_SetCmdBits( int bits );
int CHud::UpdateClientData(client_data_t *cdata, float time) int CHud::UpdateClientData(client_data_t *cdata, float time)
{ {
memcpy(m_vecOrigin, cdata->origin, sizeof(vec3_t)); memcpy(m_vecOrigin, cdata->origin, sizeof(vec3_t));
memcpy(m_vecAngles, cdata->viewangles, sizeof(vec3_t)); memcpy(m_vecAngles, cdata->viewangles, sizeof(vec3_t));
m_iKeyBits = CL_ButtonBits( 0 ); m_iKeyBits = CL_ButtonBits( 0 );
m_iWeaponBits = cdata->iWeaponBits; m_iWeaponBits = cdata->iWeaponBits;
in_fov = cdata->fov; in_fov = cdata->fov;
Think(); Think();
cdata->fov = m_iFOV; cdata->fov = m_iFOV;
v_idlescale = m_iConcussionEffect; v_idlescale = m_iConcussionEffect;
CL_ResetButtonBits( m_iKeyBits ); CL_ResetButtonBits( m_iKeyBits );
// return 1 if in anything in the client_data struct has been changed, 0 otherwise // return 1 if in anything in the client_data struct has been changed, 0 otherwise
return 1; return 1;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,30 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( IN_DEFSH ) #if !defined( IN_DEFSH )
#define IN_DEFSH #define IN_DEFSH
#pragma once #pragma once
// up / down // up / down
#define PITCH 0 #define PITCH 0
// left / right // left / right
#define YAW 1 #define YAW 1
// fall over // fall over
#define ROLL 2 #define ROLL 2
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #else
typedef struct point_s{ typedef struct point_s{
int x; int x;
int y; int y;
} POINT; } POINT;
#define GetCursorPos(x) #define GetCursorPos(x)
#define SetCursorPos(x,y) #define SetCursorPos(x,y)
#endif #endif
#endif #endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,18 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( KBUTTONH ) #if !defined( KBUTTONH )
#define KBUTTONH #define KBUTTONH
#pragma once #pragma once
typedef struct kbutton_s typedef struct kbutton_s
{ {
int down[2]; // key nums holding it down int down[2]; // key nums holding it down
int state; // low bit is down state int state; // low bit is down state
} kbutton_t; } kbutton_t;
#endif // !KBUTTONH #endif // !KBUTTONH

View File

@ -1,188 +1,188 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// menu.cpp // menu.cpp
// //
// generic menu handler // generic menu handler
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#define MAX_MENU_STRING 512 #define MAX_MENU_STRING 512
char g_szMenuString[MAX_MENU_STRING]; char g_szMenuString[MAX_MENU_STRING];
char g_szPrelocalisedMenuString[MAX_MENU_STRING]; char g_szPrelocalisedMenuString[MAX_MENU_STRING];
int KB_ConvertString( char *in, char **ppout ); int KB_ConvertString( char *in, char **ppout );
DECLARE_MESSAGE( m_Menu, ShowMenu ); DECLARE_MESSAGE( m_Menu, ShowMenu );
int CHudMenu :: Init( void ) int CHudMenu :: Init( void )
{ {
gHUD.AddHudElem( this ); gHUD.AddHudElem( this );
HOOK_MESSAGE( ShowMenu ); HOOK_MESSAGE( ShowMenu );
InitHUDData(); InitHUDData();
return 1; return 1;
} }
void CHudMenu :: InitHUDData( void ) void CHudMenu :: InitHUDData( void )
{ {
m_fMenuDisplayed = 0; m_fMenuDisplayed = 0;
m_bitsValidSlots = 0; m_bitsValidSlots = 0;
Reset(); Reset();
} }
void CHudMenu :: Reset( void ) void CHudMenu :: Reset( void )
{ {
g_szPrelocalisedMenuString[0] = 0; g_szPrelocalisedMenuString[0] = 0;
m_fWaitingForMore = FALSE; m_fWaitingForMore = FALSE;
} }
int CHudMenu :: VidInit( void ) int CHudMenu :: VidInit( void )
{ {
return 1; return 1;
} }
int CHudMenu :: Draw( float flTime ) int CHudMenu :: Draw( float flTime )
{ {
int i; int i;
// check for if menu is set to disappear // check for if menu is set to disappear
if ( m_flShutoffTime > 0 ) if ( m_flShutoffTime > 0 )
{ {
if ( m_flShutoffTime <= gHUD.m_flTime ) if ( m_flShutoffTime <= gHUD.m_flTime )
{ // times up, shutoff { // times up, shutoff
m_fMenuDisplayed = 0; m_fMenuDisplayed = 0;
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
return 1; return 1;
} }
} }
// don't draw the menu if the scoreboard is being shown // don't draw the menu if the scoreboard is being shown
// draw the menu, along the left-hand side of the screen // draw the menu, along the left-hand side of the screen
// count the number of newlines // count the number of newlines
int nlc = 0; int nlc = 0;
for ( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ ) for ( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
{ {
if ( g_szMenuString[i] == '\n' ) if ( g_szMenuString[i] == '\n' )
nlc++; nlc++;
} }
// center it // center it
int y = (ScreenHeight/2) - ((nlc/2)*12) - 40; // make sure it is above the say text int y = (ScreenHeight/2) - ((nlc/2)*12) - 40; // make sure it is above the say text
int x = 20; int x = 20;
i = 0; i = 0;
while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' ) while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' )
{ {
gHUD.DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 ); gHUD.DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 );
y += 12; y += 12;
while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' ) while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' )
i++; i++;
if ( g_szMenuString[i] == '\n' ) if ( g_szMenuString[i] == '\n' )
i++; i++;
} }
return 1; return 1;
} }
// selects an item from the menu // selects an item from the menu
void CHudMenu :: SelectMenuItem( int menu_item ) void CHudMenu :: SelectMenuItem( int menu_item )
{ {
// if menu_item is in a valid slot, send a menuselect command to the server // if menu_item is in a valid slot, send a menuselect command to the server
if ( (menu_item > 0) && (m_bitsValidSlots & (1 << (menu_item-1))) ) if ( (menu_item > 0) && (m_bitsValidSlots & (1 << (menu_item-1))) )
{ {
char szbuf[32]; char szbuf[32];
sprintf( szbuf, "menuselect %d\n", menu_item ); sprintf( szbuf, "menuselect %d\n", menu_item );
ClientCmd( szbuf ); ClientCmd( szbuf );
// remove the menu // remove the menu
m_fMenuDisplayed = 0; m_fMenuDisplayed = 0;
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
} }
} }
// Message handler for ShowMenu message // Message handler for ShowMenu message
// takes four values: // takes four values:
// short: a bitfield of keys that are valid input // short: a bitfield of keys that are valid input
// char : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen. // char : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen.
// byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, FALSE if it's the last string // byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, FALSE if it's the last string
// string: menu string to display // string: menu string to display
// if this message is never received, then scores will simply be the combined totals of the players. // if this message is never received, then scores will simply be the combined totals of the players.
int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf ) int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
{ {
char *temp = NULL; char *temp = NULL;
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
m_bitsValidSlots = READ_SHORT(); m_bitsValidSlots = READ_SHORT();
int DisplayTime = READ_CHAR(); int DisplayTime = READ_CHAR();
int NeedMore = READ_BYTE(); int NeedMore = READ_BYTE();
if ( DisplayTime > 0 ) if ( DisplayTime > 0 )
m_flShutoffTime = DisplayTime + gHUD.m_flTime; m_flShutoffTime = DisplayTime + gHUD.m_flTime;
else else
m_flShutoffTime = -1; m_flShutoffTime = -1;
if ( m_bitsValidSlots ) if ( m_bitsValidSlots )
{ {
if ( !m_fWaitingForMore ) // this is the start of a new menu if ( !m_fWaitingForMore ) // this is the start of a new menu
{ {
strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING ); strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
} }
else else
{ // append to the current menu string { // append to the current menu string
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen(g_szPrelocalisedMenuString) ); strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen(g_szPrelocalisedMenuString) );
} }
g_szPrelocalisedMenuString[MAX_MENU_STRING-1] = 0; // ensure null termination (strncat/strncpy does not) g_szPrelocalisedMenuString[MAX_MENU_STRING-1] = 0; // ensure null termination (strncat/strncpy does not)
if ( !NeedMore ) if ( !NeedMore )
{ // we have the whole string, so we can localise it now { // we have the whole string, so we can localise it now
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) ); strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) );
// Swap in characters // Swap in characters
if ( KB_ConvertString( g_szMenuString, &temp ) ) if ( KB_ConvertString( g_szMenuString, &temp ) )
{ {
strcpy( g_szMenuString, temp ); strcpy( g_szMenuString, temp );
free( temp ); free( temp );
} }
} }
m_fMenuDisplayed = 1; m_fMenuDisplayed = 1;
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
} }
else else
{ {
m_fMenuDisplayed = 0; // no valid slots means that the menu should be turned off m_fMenuDisplayed = 0; // no valid slots means that the menu should be turned off
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
} }
m_fWaitingForMore = NeedMore; m_fWaitingForMore = NeedMore;
return 1; return 1;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,163 +1,163 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "cl_entity.h" #include "cl_entity.h"
#include "triangleapi.h" #include "triangleapi.h"
#include "overview.h" #include "overview.h"
// these are included for the math functions // these are included for the math functions
#include "com_model.h" #include "com_model.h"
#include "studio_util.h" #include "studio_util.h"
#pragma warning(disable: 4244) #pragma warning(disable: 4244)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CHudOverview::Init() int CHudOverview::Init()
{ {
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
return 1; return 1;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Loads new icons // Purpose: Loads new icons
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CHudOverview::VidInit() int CHudOverview::VidInit()
{ {
m_hsprPlayer = gEngfuncs.pfnSPR_Load("sprites/ring.spr"); m_hsprPlayer = gEngfuncs.pfnSPR_Load("sprites/ring.spr");
m_hsprViewcone = gEngfuncs.pfnSPR_Load("sprites/camera.spr"); m_hsprViewcone = gEngfuncs.pfnSPR_Load("sprites/camera.spr");
return 1; return 1;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
// Input : flTime - // Input : flTime -
// intermission - // intermission -
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CHudOverview::Draw(float flTime) int CHudOverview::Draw(float flTime)
{ {
#if 0 #if 0
// only draw in overview mode // only draw in overview mode
if (!gEngfuncs.Overview_GetOverviewState()) if (!gEngfuncs.Overview_GetOverviewState())
return 1; return 1;
// make sure we have player info // make sure we have player info
// gViewPort->GetAllPlayersInfo(); // gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo(); gHUD.m_Scoreboard.GetAllPlayersInfo();
// calculate player size on the overview // calculate player size on the overview
int x1, y1, x2, y2; int x1, y1, x2, y2;
float v0[3]={0,0,0}, v1[3]={64,64,0}; float v0[3]={0,0,0}, v1[3]={64,64,0};
gEngfuncs.Overview_WorldToScreen(v0, &x1, &y1); gEngfuncs.Overview_WorldToScreen(v0, &x1, &y1);
gEngfuncs.Overview_WorldToScreen(v1, &x2, &y2); gEngfuncs.Overview_WorldToScreen(v1, &x2, &y2);
float scale = abs(x2 - x1); float scale = abs(x2 - x1);
// loop through all the players and draw them on the map // loop through all the players and draw them on the map
for (int i = 1; i < MAX_PLAYERS; i++) for (int i = 1; i < MAX_PLAYERS; i++)
{ {
cl_entity_t *pl = gEngfuncs.GetEntityByIndex(i); cl_entity_t *pl = gEngfuncs.GetEntityByIndex(i);
if (pl && pl->player && pl->curstate.health > 0 && pl->curstate.solid != SOLID_NOT) if (pl && pl->player && pl->curstate.health > 0 && pl->curstate.solid != SOLID_NOT)
{ {
int x, y, z = 0; int x, y, z = 0;
float v[3]={pl->origin[0], pl->origin[1], 0}; float v[3]={pl->origin[0], pl->origin[1], 0};
gEngfuncs.Overview_WorldToScreen(v, &x, &y); gEngfuncs.Overview_WorldToScreen(v, &x, &y);
// hack in some team colors // hack in some team colors
float r, g, bc; float r, g, bc;
if (g_PlayerExtraInfo[i].teamnumber == 1) if (g_PlayerExtraInfo[i].teamnumber == 1)
{ {
r = 0.0f; g = 0.0f; bc = 1.0f; r = 0.0f; g = 0.0f; bc = 1.0f;
} }
else if (g_PlayerExtraInfo[i].teamnumber == 2) else if (g_PlayerExtraInfo[i].teamnumber == 2)
{ {
r = 1.0f; g = 0.0f; bc = 0.0f; r = 1.0f; g = 0.0f; bc = 0.0f;
} }
else else
{ {
// just use the default orange color if the team isn't set // just use the default orange color if the team isn't set
r = 1.0f; g = 0.7f; bc = 0.0f; r = 1.0f; g = 0.7f; bc = 0.0f;
} }
// set the current texture // set the current texture
gEngfuncs.pTriAPI->SpriteTexture((struct model_s *)gEngfuncs.GetSpritePointer(m_hsprPlayer), 0); gEngfuncs.pTriAPI->SpriteTexture((struct model_s *)gEngfuncs.GetSpritePointer(m_hsprPlayer), 0);
// additive render mode // additive render mode
gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd);
// no culling // no culling
gEngfuncs.pTriAPI->CullFace(TRI_NONE); gEngfuncs.pTriAPI->CullFace(TRI_NONE);
// draw a square // draw a square
gEngfuncs.pTriAPI->Begin(TRI_QUADS); gEngfuncs.pTriAPI->Begin(TRI_QUADS);
// set the color to be that of the team // set the color to be that of the team
gEngfuncs.pTriAPI->Color4f(r, g, bc, 1.0f); gEngfuncs.pTriAPI->Color4f(r, g, bc, 1.0f);
// calculate rotational matrix // calculate rotational matrix
vec3_t a, b, angles; vec3_t a, b, angles;
float rmatrix[3][4]; // transformation matrix float rmatrix[3][4]; // transformation matrix
VectorCopy(pl->angles, angles); VectorCopy(pl->angles, angles);
angles[0] = 0.0f; angles[0] = 0.0f;
angles[1] += 90.f; angles[1] += 90.f;
angles[1] = -angles[1]; angles[1] = -angles[1];
angles[2] = 0.0f; angles[2] = 0.0f;
AngleMatrix(angles, rmatrix); AngleMatrix(angles, rmatrix);
a[2] = 0; a[2] = 0;
a[0] = -scale; a[1] = -scale; a[0] = -scale; a[1] = -scale;
VectorTransform(a, rmatrix , b ); VectorTransform(a, rmatrix , b );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 ); gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->Vertex3f(x + b[0], y + b[1], z); gEngfuncs.pTriAPI->Vertex3f(x + b[0], y + b[1], z);
a[0]=-scale; a[1] = scale; a[0]=-scale; a[1] = scale;
VectorTransform(a, rmatrix , b ); VectorTransform(a, rmatrix , b );
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 ); gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z);
a[0]=scale; a[1] = scale; a[0]=scale; a[1] = scale;
VectorTransform(a, rmatrix , b ); VectorTransform(a, rmatrix , b );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 ); gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z);
a[0]=scale; a[1] = -scale; a[0]=scale; a[1] = -scale;
VectorTransform(a, rmatrix , b ); VectorTransform(a, rmatrix , b );
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 ); gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z);
// finish up // finish up
gEngfuncs.pTriAPI->End(); gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal ); gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
// draw the players name and health underneath // draw the players name and health underneath
char string[256]; char string[256];
sprintf(string, "%s (%i%%)", g_PlayerInfoList[i].name, pl->curstate.health); sprintf(string, "%s (%i%%)", g_PlayerInfoList[i].name, pl->curstate.health);
DrawConsoleString(x, y + (1.1 * scale), string); DrawConsoleString(x, y + (1.1 * scale), string);
} }
} }
#endif #endif
return 1; return 1;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: called every time a server is connected to // Purpose: called every time a server is connected to
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CHudOverview::InitHUDData() void CHudOverview::InitHUDData()
{ {
// this block would force the spectator view to be on // this block would force the spectator view to be on
// gEngfuncs.Overview_SetDrawOverview( 1 ); // gEngfuncs.Overview_SetDrawOverview( 1 );
// gEngfuncs.Overview_SetDrawInset( 0 ); // gEngfuncs.Overview_SetDrawInset( 0 );
} }

View File

@ -1,31 +1,31 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#ifndef OVERVIEW_H #ifndef OVERVIEW_H
#define OVERVIEW_H #define OVERVIEW_H
#pragma once #pragma once
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Handles the drawing of the top-down map and all the things on it // Purpose: Handles the drawing of the top-down map and all the things on it
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class CHudOverview : public CHudBase class CHudOverview : public CHudBase
{ {
public: public:
int Init(); int Init();
int VidInit(); int VidInit();
int Draw(float flTime); int Draw(float flTime);
void InitHUDData( void ); void InitHUDData( void );
private: private:
HSPRITE m_hsprPlayer; HSPRITE m_hsprPlayer;
HSPRITE m_hsprViewcone; HSPRITE m_hsprViewcone;
}; };
#endif // OVERVIEW_H #endif // OVERVIEW_H

View File

@ -1,166 +1,166 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// parsemsg.cpp // parsemsg.cpp
// //
typedef unsigned char byte; typedef unsigned char byte;
#define true 1 #define true 1
static byte *gpBuf; static byte *gpBuf;
static int giSize; static int giSize;
static int giRead; static int giRead;
static int giBadRead; static int giBadRead;
void BEGIN_READ( void *buf, int size ) void BEGIN_READ( void *buf, int size )
{ {
giRead = 0; giRead = 0;
giBadRead = 0; giBadRead = 0;
giSize = size; giSize = size;
gpBuf = (byte*)buf; gpBuf = (byte*)buf;
} }
int READ_CHAR( void ) int READ_CHAR( void )
{ {
int c; int c;
if (giRead + 1 > giSize) if (giRead + 1 > giSize)
{ {
giBadRead = true; giBadRead = true;
return -1; return -1;
} }
c = (signed char)gpBuf[giRead]; c = (signed char)gpBuf[giRead];
giRead++; giRead++;
return c; return c;
} }
int READ_BYTE( void ) int READ_BYTE( void )
{ {
int c; int c;
if (giRead+1 > giSize) if (giRead+1 > giSize)
{ {
giBadRead = true; giBadRead = true;
return -1; return -1;
} }
c = (unsigned char)gpBuf[giRead]; c = (unsigned char)gpBuf[giRead];
giRead++; giRead++;
return c; return c;
} }
int READ_SHORT( void ) int READ_SHORT( void )
{ {
int c; int c;
if (giRead+2 > giSize) if (giRead+2 > giSize)
{ {
giBadRead = true; giBadRead = true;
return -1; return -1;
} }
c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) ); c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) );
giRead += 2; giRead += 2;
return c; return c;
} }
int READ_WORD( void ) int READ_WORD( void )
{ {
return READ_SHORT(); return READ_SHORT();
} }
int READ_LONG( void ) int READ_LONG( void )
{ {
int c; int c;
if (giRead+4 > giSize) if (giRead+4 > giSize)
{ {
giBadRead = true; giBadRead = true;
return -1; return -1;
} }
c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24); c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24);
giRead += 4; giRead += 4;
return c; return c;
} }
float READ_FLOAT( void ) float READ_FLOAT( void )
{ {
union union
{ {
byte b[4]; byte b[4];
float f; float f;
int l; int l;
} dat; } dat;
dat.b[0] = gpBuf[giRead]; dat.b[0] = gpBuf[giRead];
dat.b[1] = gpBuf[giRead+1]; dat.b[1] = gpBuf[giRead+1];
dat.b[2] = gpBuf[giRead+2]; dat.b[2] = gpBuf[giRead+2];
dat.b[3] = gpBuf[giRead+3]; dat.b[3] = gpBuf[giRead+3];
giRead += 4; giRead += 4;
// dat.l = LittleLong (dat.l); // dat.l = LittleLong (dat.l);
return dat.f; return dat.f;
} }
char* READ_STRING( void ) char* READ_STRING( void )
{ {
static char string[2048]; static char string[2048];
int l,c; int l,c;
string[0] = 0; string[0] = 0;
l = 0; l = 0;
do do
{ {
if ( giRead+1 > giSize ) if ( giRead+1 > giSize )
break; // no more characters break; // no more characters
c = READ_BYTE(); c = READ_BYTE();
if (c == -1 || c == 0) if (c == -1 || c == 0)
break; break;
string[l] = c; string[l] = c;
l++; l++;
} while (l < sizeof(string)-1); } while (l < sizeof(string)-1);
string[l] = 0; string[l] = 0;
return string; return string;
} }
float READ_COORD( void ) float READ_COORD( void )
{ {
return (float)(READ_SHORT() * (1.0/8)); return (float)(READ_SHORT() * (1.0/8));
} }
float READ_ANGLE( void ) float READ_ANGLE( void )
{ {
return (float)(READ_CHAR() * (360.0/256)); return (float)(READ_CHAR() * (360.0/256));
} }
float READ_HIRESANGLE( void ) float READ_HIRESANGLE( void )
{ {
return (float)(READ_SHORT() * (360.0/65536)); return (float)(READ_SHORT() * (360.0/65536));
} }

View File

@ -1,40 +1,40 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// parsemsg.h // parsemsg.h
// //
#define ASSERT( x ) #define ASSERT( x )
void BEGIN_READ( void *buf, int size ); void BEGIN_READ( void *buf, int size );
int READ_CHAR( void ); int READ_CHAR( void );
int READ_BYTE( void ); int READ_BYTE( void );
int READ_SHORT( void ); int READ_SHORT( void );
int READ_WORD( void ); int READ_WORD( void );
int READ_LONG( void ); int READ_LONG( void );
float READ_FLOAT( void ); float READ_FLOAT( void );
char* READ_STRING( void ); char* READ_STRING( void );
float READ_COORD( void ); float READ_COORD( void );
float READ_ANGLE( void ); float READ_ANGLE( void );
float READ_HIRESANGLE( void ); float READ_HIRESANGLE( void );

View File

@ -1,313 +1,313 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// saytext.cpp // saytext.cpp
// //
// implementation of CHudSayText class // implementation of CHudSayText class
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
extern float *GetClientColor( int clientIndex ); extern float *GetClientColor( int clientIndex );
#define MAX_LINES 5 #define MAX_LINES 5
#define MAX_CHARS_PER_LINE 256 /* it can be less than this, depending on char size */ #define MAX_CHARS_PER_LINE 256 /* it can be less than this, depending on char size */
// allow 20 pixels on either side of the text // allow 20 pixels on either side of the text
#define MAX_LINE_WIDTH ( ScreenWidth - 40 ) #define MAX_LINE_WIDTH ( ScreenWidth - 40 )
#define LINE_START 10 #define LINE_START 10
static float SCROLL_SPEED = 5; static float SCROLL_SPEED = 5;
static char g_szLineBuffer[ MAX_LINES + 1 ][ MAX_CHARS_PER_LINE ]; static char g_szLineBuffer[ MAX_LINES + 1 ][ MAX_CHARS_PER_LINE ];
static float *g_pflNameColors[ MAX_LINES + 1 ]; static float *g_pflNameColors[ MAX_LINES + 1 ];
static int g_iNameLengths[ MAX_LINES + 1 ]; static int g_iNameLengths[ MAX_LINES + 1 ];
static float flScrollTime = 0; // the time at which the lines next scroll up static float flScrollTime = 0; // the time at which the lines next scroll up
static int Y_START = 0; static int Y_START = 0;
static int line_height = 0; static int line_height = 0;
DECLARE_MESSAGE( m_SayText, SayText ); DECLARE_MESSAGE( m_SayText, SayText );
int CHudSayText :: Init( void ) int CHudSayText :: Init( void )
{ {
gHUD.AddHudElem( this ); gHUD.AddHudElem( this );
HOOK_MESSAGE( SayText ); HOOK_MESSAGE( SayText );
InitHUDData(); InitHUDData();
m_HUD_saytext = gEngfuncs.pfnRegisterVariable( "hud_saytext", "1", 0 ); m_HUD_saytext = gEngfuncs.pfnRegisterVariable( "hud_saytext", "1", 0 );
m_HUD_saytext_time = gEngfuncs.pfnRegisterVariable( "hud_saytext_time", "5", 0 ); m_HUD_saytext_time = gEngfuncs.pfnRegisterVariable( "hud_saytext_time", "5", 0 );
m_iFlags |= HUD_INTERMISSION; // is always drawn during an intermission m_iFlags |= HUD_INTERMISSION; // is always drawn during an intermission
return 1; return 1;
} }
void CHudSayText :: InitHUDData( void ) void CHudSayText :: InitHUDData( void )
{ {
memset( g_szLineBuffer, 0, sizeof g_szLineBuffer ); memset( g_szLineBuffer, 0, sizeof g_szLineBuffer );
memset( g_pflNameColors, 0, sizeof g_pflNameColors ); memset( g_pflNameColors, 0, sizeof g_pflNameColors );
memset( g_iNameLengths, 0, sizeof g_iNameLengths ); memset( g_iNameLengths, 0, sizeof g_iNameLengths );
} }
int CHudSayText :: VidInit( void ) int CHudSayText :: VidInit( void )
{ {
return 1; return 1;
} }
int ScrollTextUp( void ) int ScrollTextUp( void )
{ {
ConsolePrint( g_szLineBuffer[0] ); // move the first line into the console buffer ConsolePrint( g_szLineBuffer[0] ); // move the first line into the console buffer
g_szLineBuffer[MAX_LINES][0] = 0; g_szLineBuffer[MAX_LINES][0] = 0;
memmove( g_szLineBuffer[0], g_szLineBuffer[1], sizeof(g_szLineBuffer) - sizeof(g_szLineBuffer[0]) ); // overwrite the first line memmove( g_szLineBuffer[0], g_szLineBuffer[1], sizeof(g_szLineBuffer) - sizeof(g_szLineBuffer[0]) ); // overwrite the first line
memmove( &g_pflNameColors[0], &g_pflNameColors[1], sizeof(g_pflNameColors) - sizeof(g_pflNameColors[0]) ); memmove( &g_pflNameColors[0], &g_pflNameColors[1], sizeof(g_pflNameColors) - sizeof(g_pflNameColors[0]) );
memmove( &g_iNameLengths[0], &g_iNameLengths[1], sizeof(g_iNameLengths) - sizeof(g_iNameLengths[0]) ); memmove( &g_iNameLengths[0], &g_iNameLengths[1], sizeof(g_iNameLengths) - sizeof(g_iNameLengths[0]) );
g_szLineBuffer[MAX_LINES-1][0] = 0; g_szLineBuffer[MAX_LINES-1][0] = 0;
if ( g_szLineBuffer[0][0] == ' ' ) // also scroll up following lines if ( g_szLineBuffer[0][0] == ' ' ) // also scroll up following lines
{ {
g_szLineBuffer[0][0] = 2; g_szLineBuffer[0][0] = 2;
return 1 + ScrollTextUp(); return 1 + ScrollTextUp();
} }
return 1; return 1;
} }
int CHudSayText :: Draw( float flTime ) int CHudSayText :: Draw( float flTime )
{ {
int y = Y_START; int y = Y_START;
// make sure the scrolltime is within reasonable bounds, to guard against the clock being reset // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset
flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );
// make sure the scrolltime is within reasonable bounds, to guard against the clock being reset // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset
flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );
if ( flScrollTime <= flTime ) if ( flScrollTime <= flTime )
{ {
if ( *g_szLineBuffer[0] ) if ( *g_szLineBuffer[0] )
{ {
flScrollTime = flTime + m_HUD_saytext_time->value; flScrollTime = flTime + m_HUD_saytext_time->value;
// push the console up // push the console up
ScrollTextUp(); ScrollTextUp();
} }
else else
{ // buffer is empty, just disable drawing of this section { // buffer is empty, just disable drawing of this section
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
} }
} }
for ( int i = 0; i < MAX_LINES; i++ ) for ( int i = 0; i < MAX_LINES; i++ )
{ {
if ( *g_szLineBuffer[i] ) if ( *g_szLineBuffer[i] )
{ {
if ( *g_szLineBuffer[i] == 2 && g_pflNameColors[i] ) if ( *g_szLineBuffer[i] == 2 && g_pflNameColors[i] )
{ {
// it's a saytext string // it's a saytext string
static char buf[MAX_PLAYER_NAME_LENGTH+32]; static char buf[MAX_PLAYER_NAME_LENGTH+32];
// draw the first x characters in the player color // draw the first x characters in the player color
strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) ); strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) );
buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0; buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0;
DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] );
int x = DrawConsoleString( LINE_START, y, buf ); int x = DrawConsoleString( LINE_START, y, buf );
// color is reset after each string draw // color is reset after each string draw
DrawConsoleString( x, y, g_szLineBuffer[i] + g_iNameLengths[i] ); DrawConsoleString( x, y, g_szLineBuffer[i] + g_iNameLengths[i] );
} }
else else
{ {
// normal draw // normal draw
DrawConsoleString( LINE_START, y, g_szLineBuffer[i] ); DrawConsoleString( LINE_START, y, g_szLineBuffer[i] );
} }
} }
y += line_height; y += line_height;
} }
return 1; return 1;
} }
int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf ) int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int client_index = READ_BYTE(); // the client who spoke the message int client_index = READ_BYTE(); // the client who spoke the message
SayTextPrint( READ_STRING(), iSize - 1, client_index ); SayTextPrint( READ_STRING(), iSize - 1, client_index );
return 1; return 1;
} }
void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex ) void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex )
{ {
int i; int i;
ConsolePrint( pszBuf ); ConsolePrint( pszBuf );
// find an empty string slot // find an empty string slot
for ( i = 0; i < MAX_LINES; i++ ) for ( i = 0; i < MAX_LINES; i++ )
{ {
if ( ! *g_szLineBuffer[i] ) if ( ! *g_szLineBuffer[i] )
break; break;
} }
if ( i == MAX_LINES ) if ( i == MAX_LINES )
{ {
// force scroll buffer up // force scroll buffer up
ScrollTextUp(); ScrollTextUp();
i = MAX_LINES - 1; i = MAX_LINES - 1;
} }
g_iNameLengths[i] = 0; g_iNameLengths[i] = 0;
g_pflNameColors[i] = NULL; g_pflNameColors[i] = NULL;
// if it's a say message, search for the players name in the string // if it's a say message, search for the players name in the string
if ( *pszBuf == 2 && clientIndex > 0 ) if ( *pszBuf == 2 && clientIndex > 0 )
{ {
GetPlayerInfo( clientIndex, &g_PlayerInfoList[clientIndex] ); GetPlayerInfo( clientIndex, &g_PlayerInfoList[clientIndex] );
const char *pName = g_PlayerInfoList[clientIndex].name; const char *pName = g_PlayerInfoList[clientIndex].name;
if ( pName ) if ( pName )
{ {
const char *nameInString = strstr( pszBuf, pName ); const char *nameInString = strstr( pszBuf, pName );
if ( nameInString ) if ( nameInString )
{ {
g_iNameLengths[i] = strlen( pName ) + (nameInString - pszBuf); g_iNameLengths[i] = strlen( pName ) + (nameInString - pszBuf);
g_pflNameColors[i] = GetClientColor( clientIndex ); g_pflNameColors[i] = GetClientColor( clientIndex );
} }
} }
} }
strncpy( g_szLineBuffer[i], pszBuf, max(iBufSize -1, MAX_CHARS_PER_LINE-1) ); strncpy( g_szLineBuffer[i], pszBuf, max(iBufSize -1, MAX_CHARS_PER_LINE-1) );
// make sure the text fits in one line // make sure the text fits in one line
EnsureTextFitsInOneLineAndWrapIfHaveTo( i ); EnsureTextFitsInOneLineAndWrapIfHaveTo( i );
// Set scroll time // Set scroll time
if ( i == 0 ) if ( i == 0 )
{ {
flScrollTime = gHUD.m_flTime + m_HUD_saytext_time->value; flScrollTime = gHUD.m_flTime + m_HUD_saytext_time->value;
} }
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
PlaySound( "misc/talk.wav", 1 ); PlaySound( "misc/talk.wav", 1 );
if ( ScreenHeight >= 480 ) if ( ScreenHeight >= 480 )
Y_START = ScreenHeight - 60; Y_START = ScreenHeight - 60;
else else
Y_START = ScreenHeight - 45; Y_START = ScreenHeight - 45;
Y_START -= (line_height * (MAX_LINES+1)); Y_START -= (line_height * (MAX_LINES+1));
} }
void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line ) void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
{ {
int line_width = 0; int line_width = 0;
GetConsoleStringSize( g_szLineBuffer[line], &line_width, &line_height ); GetConsoleStringSize( g_szLineBuffer[line], &line_width, &line_height );
if ( (line_width + LINE_START) > MAX_LINE_WIDTH ) if ( (line_width + LINE_START) > MAX_LINE_WIDTH )
{ // string is too long to fit on line { // string is too long to fit on line
// scan the string until we find what word is too long, and wrap the end of the sentence after the word // scan the string until we find what word is too long, and wrap the end of the sentence after the word
int length = LINE_START; int length = LINE_START;
int tmp_len = 0; int tmp_len = 0;
char *last_break = NULL; char *last_break = NULL;
for ( char *x = g_szLineBuffer[line]; *x != 0; x++ ) for ( char *x = g_szLineBuffer[line]; *x != 0; x++ )
{ {
// check for a color change, if so skip past it // check for a color change, if so skip past it
if ( x[0] == '/' && x[1] == '(' ) if ( x[0] == '/' && x[1] == '(' )
{ {
x += 2; x += 2;
// skip forward until past mode specifier // skip forward until past mode specifier
while ( *x != 0 && *x != ')' ) while ( *x != 0 && *x != ')' )
x++; x++;
if ( *x != 0 ) if ( *x != 0 )
x++; x++;
if ( *x == 0 ) if ( *x == 0 )
break; break;
} }
char buf[2]; char buf[2];
buf[1] = 0; buf[1] = 0;
if ( *x == ' ' && x != g_szLineBuffer[line] ) // store each line break, except for the very first character if ( *x == ' ' && x != g_szLineBuffer[line] ) // store each line break, except for the very first character
last_break = x; last_break = x;
buf[0] = *x; // get the length of the current character buf[0] = *x; // get the length of the current character
GetConsoleStringSize( buf, &tmp_len, &line_height ); GetConsoleStringSize( buf, &tmp_len, &line_height );
length += tmp_len; length += tmp_len;
if ( length > MAX_LINE_WIDTH ) if ( length > MAX_LINE_WIDTH )
{ // needs to be broken up { // needs to be broken up
if ( !last_break ) if ( !last_break )
last_break = x-1; last_break = x-1;
x = last_break; x = last_break;
// find an empty string slot // find an empty string slot
int j; int j;
do do
{ {
for ( j = 0; j < MAX_LINES; j++ ) for ( j = 0; j < MAX_LINES; j++ )
{ {
if ( ! *g_szLineBuffer[j] ) if ( ! *g_szLineBuffer[j] )
break; break;
} }
if ( j == MAX_LINES ) if ( j == MAX_LINES )
{ {
// need to make more room to display text, scroll stuff up then fix the pointers // need to make more room to display text, scroll stuff up then fix the pointers
int linesmoved = ScrollTextUp(); int linesmoved = ScrollTextUp();
line -= linesmoved; line -= linesmoved;
last_break = last_break - (sizeof(g_szLineBuffer[0]) * linesmoved); last_break = last_break - (sizeof(g_szLineBuffer[0]) * linesmoved);
} }
} }
while ( j == MAX_LINES ); while ( j == MAX_LINES );
// copy remaining string into next buffer, making sure it starts with a space character // copy remaining string into next buffer, making sure it starts with a space character
if ( (char)*last_break == (char)' ' ) if ( (char)*last_break == (char)' ' )
{ {
int linelen = strlen(g_szLineBuffer[j]); int linelen = strlen(g_szLineBuffer[j]);
int remaininglen = strlen(last_break); int remaininglen = strlen(last_break);
if ( (linelen - remaininglen) <= MAX_CHARS_PER_LINE ) if ( (linelen - remaininglen) <= MAX_CHARS_PER_LINE )
strcat( g_szLineBuffer[j], last_break ); strcat( g_szLineBuffer[j], last_break );
} }
else else
{ {
if ( (strlen(g_szLineBuffer[j]) - strlen(last_break) - 2) < MAX_CHARS_PER_LINE ) if ( (strlen(g_szLineBuffer[j]) - strlen(last_break) - 2) < MAX_CHARS_PER_LINE )
{ {
strcat( g_szLineBuffer[j], " " ); strcat( g_szLineBuffer[j], " " );
strcat( g_szLineBuffer[j], last_break ); strcat( g_szLineBuffer[j], last_break );
} }
} }
*last_break = 0; // cut off the last string *last_break = 0; // cut off the last string
EnsureTextFitsInOneLineAndWrapIfHaveTo( j ); EnsureTextFitsInOneLineAndWrapIfHaveTo( j );
break; break;
} }
} }
} }
} }

View File

@ -1,162 +1,162 @@
//======== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. ======== //======== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. ========
// //
// The copyright to the contents herein is the property of Valve, L.L.C. // The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of // The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied. // the agreement/contract under which the contents have been supplied.
// //
// Purpose: // Purpose:
// //
// $Workfile: $ // $Workfile: $
// $Date: $ // $Date: $
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// $Log: $ // $Log: $
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#include <windows.h> #include <windows.h>
#include <dsound.h> #include <dsound.h>
#include <mmsystem.h> #include <mmsystem.h>
#include "r_studioint.h" #include "r_studioint.h"
extern engine_studio_api_t IEngineStudio; extern engine_studio_api_t IEngineStudio;
#define RENDERTYPE_UNDEFINED 0 #define RENDERTYPE_UNDEFINED 0
#define RENDERTYPE_SOFTWARE 1 #define RENDERTYPE_SOFTWARE 1
#define RENDERTYPE_HARDWARE 2 #define RENDERTYPE_HARDWARE 2
#define ENGINE_LAUNCHER_API_VERSION 1 #define ENGINE_LAUNCHER_API_VERSION 1
LPDIRECTSOUND lpDS = NULL; LPDIRECTSOUND lpDS = NULL;
LPDIRECTSOUNDBUFFER lpDSBuf = NULL; LPDIRECTSOUNDBUFFER lpDSBuf = NULL;
LPHWAVEOUT lpHW = NULL; LPHWAVEOUT lpHW = NULL;
static HMODULE hEngine = 0; static HMODULE hEngine = 0;
typedef struct engine_api_s typedef struct engine_api_s
{ {
int version; int version;
int rendertype; int rendertype;
int size; int size;
// Functions // Functions
void ( *unused1 ) ( void ); void ( *unused1 ) ( void );
void ( *unused2 ) ( void ); void ( *unused2 ) ( void );
void ( *unused3 ) ( void ); void ( *unused3 ) ( void );
void ( *unused4 ) ( void ); void ( *unused4 ) ( void );
void ( *unused5 ) ( void ); void ( *unused5 ) ( void );
void ( *unused6 ) ( void ); void ( *unused6 ) ( void );
void ( *unused7 ) ( void ); void ( *unused7 ) ( void );
void ( *unused8 ) ( void ); void ( *unused8 ) ( void );
void ( *unused9 ) ( void ); void ( *unused9 ) ( void );
void ( *unused10 ) ( void ); void ( *unused10 ) ( void );
void ( *unused11 ) ( void ); void ( *unused11 ) ( void );
void ( *unused12 ) ( void ); void ( *unused12 ) ( void );
void ( *unused13 ) ( void ); void ( *unused13 ) ( void );
void ( *unused14 ) ( void ); void ( *unused14 ) ( void );
void ( *unused15 ) ( void ); void ( *unused15 ) ( void );
void ( *unused16 ) ( void ); void ( *unused16 ) ( void );
void ( *unused17 ) ( void ); void ( *unused17 ) ( void );
void ( *unused18 ) ( void ); void ( *unused18 ) ( void );
void ( *unused19 ) ( void ); void ( *unused19 ) ( void );
void ( *unused20 ) ( void ); void ( *unused20 ) ( void );
void ( *unused21 ) ( void ); void ( *unused21 ) ( void );
void ( *unused22 ) ( void ); void ( *unused22 ) ( void );
void ( *unused23 ) ( void ); void ( *unused23 ) ( void );
void ( *unused24 ) ( void ); void ( *unused24 ) ( void );
void ( *unused25 ) ( void ); void ( *unused25 ) ( void );
void ( *unused26 ) ( void ); void ( *unused26 ) ( void );
void ( *unused27 ) ( void ); void ( *unused27 ) ( void );
void ( *unused28 ) ( void ); void ( *unused28 ) ( void );
void ( *unused29 ) ( void ); void ( *unused29 ) ( void );
void ( *unused30 ) ( void ); void ( *unused30 ) ( void );
void ( *unused31 ) ( void ); void ( *unused31 ) ( void );
void ( *unused32 ) ( void ); void ( *unused32 ) ( void );
void ( *unused33 ) ( void ); void ( *unused33 ) ( void );
void ( *unused34 ) ( void ); void ( *unused34 ) ( void );
void ( *S_GetDSPointer ) ( struct IDirectSound **lpDS, struct IDirectSoundBuffer **lpDSBuf ); void ( *S_GetDSPointer ) ( struct IDirectSound **lpDS, struct IDirectSoundBuffer **lpDSBuf );
void *( *S_GetWAVPointer ) ( void ); void *( *S_GetWAVPointer ) ( void );
void ( *unused35 ) ( void ); void ( *unused35 ) ( void );
void ( *unused36 ) ( void ); void ( *unused36 ) ( void );
void ( *unused37 ) ( void ); void ( *unused37 ) ( void );
void ( *unused38 ) ( void ); void ( *unused38 ) ( void );
void ( *unused39 ) ( void ); void ( *unused39 ) ( void );
void ( *unused40 ) ( void ); void ( *unused40 ) ( void );
void ( *unused41 ) ( void ); void ( *unused41 ) ( void );
void ( *unused42 ) ( void ); void ( *unused42 ) ( void );
void ( *unused43 ) ( void ); void ( *unused43 ) ( void );
void ( *unused44 ) ( void ); void ( *unused44 ) ( void );
void ( *unused45 ) ( void ); void ( *unused45 ) ( void );
void ( *unused46 ) ( void ); void ( *unused46 ) ( void );
void ( *unused47 ) ( void ); void ( *unused47 ) ( void );
void ( *unused48 ) ( void ); void ( *unused48 ) ( void );
void ( *unused49 ) ( void ); void ( *unused49 ) ( void );
void ( *unused50 ) ( void ); void ( *unused50 ) ( void );
void ( *unused51 ) ( void ); void ( *unused51 ) ( void );
void ( *unused52 ) ( void ); void ( *unused52 ) ( void );
void ( *unused53 ) ( void ); void ( *unused53 ) ( void );
void ( *unused54 ) ( void ); void ( *unused54 ) ( void );
void ( *unused55 ) ( void ); void ( *unused55 ) ( void );
} engine_api_t; } engine_api_t;
static engine_api_t engineapi; static engine_api_t engineapi;
typedef int (*engine_api_func)( int version, int size, struct engine_api_s *api ); typedef int (*engine_api_func)( int version, int size, struct engine_api_s *api );
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Get launcher/engine interface from engine module // Purpose: Get launcher/engine interface from engine module
// Input : hMod - // Input : hMod -
// Output : int // Output : int
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int Eng_LoadFunctions( HMODULE hMod ) int Eng_LoadFunctions( HMODULE hMod )
{ {
engine_api_func pfnEngineAPI; engine_api_func pfnEngineAPI;
pfnEngineAPI = ( engine_api_func )GetProcAddress( hMod, "Sys_EngineAPI" ); pfnEngineAPI = ( engine_api_func )GetProcAddress( hMod, "Sys_EngineAPI" );
if ( !pfnEngineAPI ) if ( !pfnEngineAPI )
return 0; return 0;
if ( !(*pfnEngineAPI)( ENGINE_LAUNCHER_API_VERSION, sizeof( engine_api_t ), &engineapi ) ) if ( !(*pfnEngineAPI)( ENGINE_LAUNCHER_API_VERSION, sizeof( engine_api_t ), &engineapi ) )
return 0; return 0;
// All is okay // All is okay
return 1; return 1;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Load proper engine .dll and get pointer to either DSound and primary buffer or HWAVEOUT ( NT 4.0, e.g. ) // Purpose: Load proper engine .dll and get pointer to either DSound and primary buffer or HWAVEOUT ( NT 4.0, e.g. )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LoadSoundAPIs( void ) void LoadSoundAPIs( void )
{ {
hEngine = ::LoadLibrary( IEngineStudio.IsHardware() ? "hw.dll" : "sw.dll" ); hEngine = ::LoadLibrary( IEngineStudio.IsHardware() ? "hw.dll" : "sw.dll" );
if ( hEngine ) if ( hEngine )
{ {
if ( Eng_LoadFunctions( hEngine ) ) if ( Eng_LoadFunctions( hEngine ) )
{ {
if ( engineapi.S_GetDSPointer && engineapi.S_GetWAVPointer ) if ( engineapi.S_GetDSPointer && engineapi.S_GetWAVPointer )
{ {
engineapi.S_GetDSPointer(&lpDS, &lpDSBuf); engineapi.S_GetDSPointer(&lpDS, &lpDSBuf);
lpHW = (HWAVEOUT FAR *)engineapi.S_GetWAVPointer(); lpHW = (HWAVEOUT FAR *)engineapi.S_GetWAVPointer();
} }
} }
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Close engine library, release sound pointers // Purpose: Close engine library, release sound pointers
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ShutdownSoundAPIs( void ) void ShutdownSoundAPIs( void )
{ {
if( hEngine ) if( hEngine )
{ {
FreeLibrary( hEngine ); FreeLibrary( hEngine );
hEngine = 0; hEngine = 0;
} }
lpDS = 0; lpDS = 0;
lpDSBuf = 0; lpDSBuf = 0;
lpHW = 0; lpHW = 0;
} }

View File

@ -1,164 +1,164 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// status_icons.cpp // status_icons.cpp
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "const.h" #include "const.h"
#include "entity_state.h" #include "entity_state.h"
#include "cl_entity.h" #include "cl_entity.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "parsemsg.h" #include "parsemsg.h"
#include "event_api.h" #include "event_api.h"
DECLARE_MESSAGE( m_StatusIcons, StatusIcon ); DECLARE_MESSAGE( m_StatusIcons, StatusIcon );
int CHudStatusIcons::Init( void ) int CHudStatusIcons::Init( void )
{ {
HOOK_MESSAGE( StatusIcon ); HOOK_MESSAGE( StatusIcon );
gHUD.AddHudElem( this ); gHUD.AddHudElem( this );
Reset(); Reset();
return 1; return 1;
} }
int CHudStatusIcons::VidInit( void ) int CHudStatusIcons::VidInit( void )
{ {
return 1; return 1;
} }
void CHudStatusIcons::Reset( void ) void CHudStatusIcons::Reset( void )
{ {
memset( m_IconList, 0, sizeof m_IconList ); memset( m_IconList, 0, sizeof m_IconList );
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
} }
// Draw status icons along the left-hand side of the screen // Draw status icons along the left-hand side of the screen
int CHudStatusIcons::Draw( float flTime ) int CHudStatusIcons::Draw( float flTime )
{ {
if (gEngfuncs.IsSpectateOnly()) if (gEngfuncs.IsSpectateOnly())
return 1; return 1;
// find starting position to draw from, along right-hand side of screen // find starting position to draw from, along right-hand side of screen
int x = 5; int x = 5;
int y = ScreenHeight / 2; int y = ScreenHeight / 2;
// loop through icon list, and draw any valid icons drawing up from the middle of screen // loop through icon list, and draw any valid icons drawing up from the middle of screen
for ( int i = 0; i < MAX_ICONSPRITES; i++ ) for ( int i = 0; i < MAX_ICONSPRITES; i++ )
{ {
if ( m_IconList[i].spr ) if ( m_IconList[i].spr )
{ {
y -= ( m_IconList[i].rc.bottom - m_IconList[i].rc.top ) + 5; y -= ( m_IconList[i].rc.bottom - m_IconList[i].rc.top ) + 5;
SPR_Set( m_IconList[i].spr, m_IconList[i].r, m_IconList[i].g, m_IconList[i].b ); SPR_Set( m_IconList[i].spr, m_IconList[i].r, m_IconList[i].g, m_IconList[i].b );
SPR_DrawAdditive( 0, x, y, &m_IconList[i].rc ); SPR_DrawAdditive( 0, x, y, &m_IconList[i].rc );
} }
} }
return 1; return 1;
} }
// Message handler for StatusIcon message // Message handler for StatusIcon message
// accepts five values: // accepts five values:
// byte : TRUE = ENABLE icon, FALSE = DISABLE icon // byte : TRUE = ENABLE icon, FALSE = DISABLE icon
// string : the sprite name to display // string : the sprite name to display
// byte : red // byte : red
// byte : green // byte : green
// byte : blue // byte : blue
int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf ) int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int ShouldEnable = READ_BYTE(); int ShouldEnable = READ_BYTE();
char *pszIconName = READ_STRING(); char *pszIconName = READ_STRING();
if ( ShouldEnable ) if ( ShouldEnable )
{ {
int r = READ_BYTE(); int r = READ_BYTE();
int g = READ_BYTE(); int g = READ_BYTE();
int b = READ_BYTE(); int b = READ_BYTE();
EnableIcon( pszIconName, r, g, b ); EnableIcon( pszIconName, r, g, b );
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
} }
else else
{ {
DisableIcon( pszIconName ); DisableIcon( pszIconName );
} }
return 1; return 1;
} }
// add the icon to the icon list, and set it's drawing color // add the icon to the icon list, and set it's drawing color
void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue ) void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )
{ {
int i; int i;
// check to see if the sprite is in the current list // check to see if the sprite is in the current list
for ( i = 0; i < MAX_ICONSPRITES; i++ ) for ( i = 0; i < MAX_ICONSPRITES; i++ )
{ {
if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) ) if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
break; break;
} }
if ( i == MAX_ICONSPRITES ) if ( i == MAX_ICONSPRITES )
{ {
// icon not in list, so find an empty slot to add to // icon not in list, so find an empty slot to add to
for ( i = 0; i < MAX_ICONSPRITES; i++ ) for ( i = 0; i < MAX_ICONSPRITES; i++ )
{ {
if ( !m_IconList[i].spr ) if ( !m_IconList[i].spr )
break; break;
} }
} }
// if we've run out of space in the list, overwrite the first icon // if we've run out of space in the list, overwrite the first icon
if ( i == MAX_ICONSPRITES ) if ( i == MAX_ICONSPRITES )
{ {
i = 0; i = 0;
} }
// Load the sprite and add it to the list // Load the sprite and add it to the list
// the sprite must be listed in hud.txt // the sprite must be listed in hud.txt
int spr_index = gHUD.GetSpriteIndex( pszIconName ); int spr_index = gHUD.GetSpriteIndex( pszIconName );
m_IconList[i].spr = gHUD.GetSprite( spr_index ); m_IconList[i].spr = gHUD.GetSprite( spr_index );
m_IconList[i].rc = gHUD.GetSpriteRect( spr_index ); m_IconList[i].rc = gHUD.GetSpriteRect( spr_index );
m_IconList[i].r = red; m_IconList[i].r = red;
m_IconList[i].g = green; m_IconList[i].g = green;
m_IconList[i].b = blue; m_IconList[i].b = blue;
strcpy( m_IconList[i].szSpriteName, pszIconName ); strcpy( m_IconList[i].szSpriteName, pszIconName );
// Hack: Play Timer sound when a grenade icon is played (in 0.8 seconds) // Hack: Play Timer sound when a grenade icon is played (in 0.8 seconds)
if ( strstr(m_IconList[i].szSpriteName, "grenade") ) if ( strstr(m_IconList[i].szSpriteName, "grenade") )
{ {
cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer(); cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer();
gEngfuncs.pEventAPI->EV_PlaySound( pthisplayer->index, pthisplayer->origin, CHAN_STATIC, "weapons/timer.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); gEngfuncs.pEventAPI->EV_PlaySound( pthisplayer->index, pthisplayer->origin, CHAN_STATIC, "weapons/timer.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
} }
} }
void CHudStatusIcons::DisableIcon( char *pszIconName ) void CHudStatusIcons::DisableIcon( char *pszIconName )
{ {
// find the sprite is in the current list // find the sprite is in the current list
for ( int i = 0; i < MAX_ICONSPRITES; i++ ) for ( int i = 0; i < MAX_ICONSPRITES; i++ )
{ {
if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) ) if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
{ {
// clear the item from the list // clear the item from the list
memset( &m_IconList[i], 0, sizeof( icon_sprite_t ) ); memset( &m_IconList[i], 0, sizeof( icon_sprite_t ) );
return; return;
} }
} }
} }

View File

@ -1,265 +1,265 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// statusbar.cpp // statusbar.cpp
// //
// generic text status bar, set by game dll // generic text status bar, set by game dll
// runs across bottom of screen // runs across bottom of screen
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "parsemsg.h" #include "parsemsg.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
DECLARE_MESSAGE( m_StatusBar, StatusText ); DECLARE_MESSAGE( m_StatusBar, StatusText );
DECLARE_MESSAGE( m_StatusBar, StatusValue ); DECLARE_MESSAGE( m_StatusBar, StatusValue );
#define STATUSBAR_ID_LINE 1 #define STATUSBAR_ID_LINE 1
float *GetClientColor( int clientIndex ); float *GetClientColor( int clientIndex );
extern float g_ColorYellow[3]; extern float g_ColorYellow[3];
int CHudStatusBar :: Init( void ) int CHudStatusBar :: Init( void )
{ {
gHUD.AddHudElem( this ); gHUD.AddHudElem( this );
HOOK_MESSAGE( StatusText ); HOOK_MESSAGE( StatusText );
HOOK_MESSAGE( StatusValue ); HOOK_MESSAGE( StatusValue );
Reset(); Reset();
CVAR_CREATE( "hud_centerid", "0", FCVAR_ARCHIVE ); CVAR_CREATE( "hud_centerid", "0", FCVAR_ARCHIVE );
return 1; return 1;
} }
int CHudStatusBar :: VidInit( void ) int CHudStatusBar :: VidInit( void )
{ {
// Load sprites here // Load sprites here
return 1; return 1;
} }
void CHudStatusBar :: Reset( void ) void CHudStatusBar :: Reset( void )
{ {
int i = 0; int i = 0;
m_iFlags &= ~HUD_ACTIVE; // start out inactive m_iFlags &= ~HUD_ACTIVE; // start out inactive
for ( i = 0; i < MAX_STATUSBAR_LINES; i++ ) for ( i = 0; i < MAX_STATUSBAR_LINES; i++ )
m_szStatusText[i][0] = 0; m_szStatusText[i][0] = 0;
memset( m_iStatusValues, 0, sizeof m_iStatusValues ); memset( m_iStatusValues, 0, sizeof m_iStatusValues );
m_iStatusValues[0] = 1; // 0 is the special index, which always returns true m_iStatusValues[0] = 1; // 0 is the special index, which always returns true
// reset our colors for the status bar lines (yellow is default) // reset our colors for the status bar lines (yellow is default)
for ( i = 0; i < MAX_STATUSBAR_LINES; i++ ) for ( i = 0; i < MAX_STATUSBAR_LINES; i++ )
m_pflNameColors[i] = g_ColorYellow; m_pflNameColors[i] = g_ColorYellow;
} }
void CHudStatusBar :: ParseStatusString( int line_num ) void CHudStatusBar :: ParseStatusString( int line_num )
{ {
// localise string first // localise string first
char szBuffer[MAX_STATUSTEXT_LENGTH]; char szBuffer[MAX_STATUSTEXT_LENGTH];
memset( szBuffer, 0, sizeof szBuffer ); memset( szBuffer, 0, sizeof szBuffer );
gHUD.m_TextMessage.LocaliseTextString( m_szStatusText[line_num], szBuffer, MAX_STATUSTEXT_LENGTH ); gHUD.m_TextMessage.LocaliseTextString( m_szStatusText[line_num], szBuffer, MAX_STATUSTEXT_LENGTH );
// parse m_szStatusText & m_iStatusValues into m_szStatusBar // parse m_szStatusText & m_iStatusValues into m_szStatusBar
memset( m_szStatusBar[line_num], 0, MAX_STATUSTEXT_LENGTH ); memset( m_szStatusBar[line_num], 0, MAX_STATUSTEXT_LENGTH );
char *src = szBuffer; char *src = szBuffer;
char *dst = m_szStatusBar[line_num]; char *dst = m_szStatusBar[line_num];
char *src_start = src, *dst_start = dst; char *src_start = src, *dst_start = dst;
while ( *src != 0 ) while ( *src != 0 )
{ {
while ( *src == '\n' ) while ( *src == '\n' )
src++; // skip over any newlines src++; // skip over any newlines
if ( ((src - src_start) >= MAX_STATUSTEXT_LENGTH) || ((dst - dst_start) >= MAX_STATUSTEXT_LENGTH) ) if ( ((src - src_start) >= MAX_STATUSTEXT_LENGTH) || ((dst - dst_start) >= MAX_STATUSTEXT_LENGTH) )
break; break;
int index = atoi( src ); int index = atoi( src );
// should we draw this line? // should we draw this line?
if ( (index >= 0 && index < MAX_STATUSBAR_VALUES) && (m_iStatusValues[index] != 0) ) if ( (index >= 0 && index < MAX_STATUSBAR_VALUES) && (m_iStatusValues[index] != 0) )
{ // parse this line and append result to the status bar { // parse this line and append result to the status bar
while ( *src >= '0' && *src <= '9' ) while ( *src >= '0' && *src <= '9' )
src++; src++;
if ( *src == '\n' || *src == 0 ) if ( *src == '\n' || *src == 0 )
continue; // no more left in this text line continue; // no more left in this text line
// copy the text, char by char, until we hit a % or a \n // copy the text, char by char, until we hit a % or a \n
while ( *src != '\n' && *src != 0 ) while ( *src != '\n' && *src != 0 )
{ {
if ( *src != '%' ) if ( *src != '%' )
{ // just copy the character { // just copy the character
*dst = *src; *dst = *src;
dst++, src++; dst++, src++;
} }
else else
{ {
// get the descriptor // get the descriptor
char valtype = *(++src); // move over % char valtype = *(++src); // move over %
// if it's a %, draw a % sign // if it's a %, draw a % sign
if ( valtype == '%' ) if ( valtype == '%' )
{ {
*dst = valtype; *dst = valtype;
dst++, src++; dst++, src++;
continue; continue;
} }
// move over descriptor, then get and move over the index // move over descriptor, then get and move over the index
index = atoi( ++src ); index = atoi( ++src );
while ( *src >= '0' && *src <= '9' ) while ( *src >= '0' && *src <= '9' )
src++; src++;
if ( index >= 0 && index < MAX_STATUSBAR_VALUES ) if ( index >= 0 && index < MAX_STATUSBAR_VALUES )
{ {
int indexval = m_iStatusValues[index]; int indexval = m_iStatusValues[index];
// get the string to substitute in place of the %XX // get the string to substitute in place of the %XX
char szRepString[MAX_PLAYER_NAME_LENGTH]; char szRepString[MAX_PLAYER_NAME_LENGTH];
switch ( valtype ) switch ( valtype )
{ {
case 'p': // player name case 'p': // player name
GetPlayerInfo( indexval, &g_PlayerInfoList[indexval] ); GetPlayerInfo( indexval, &g_PlayerInfoList[indexval] );
if ( g_PlayerInfoList[indexval].name != NULL ) if ( g_PlayerInfoList[indexval].name != NULL )
{ {
strncpy( szRepString, g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH ); strncpy( szRepString, g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH );
m_pflNameColors[line_num] = GetClientColor( indexval ); m_pflNameColors[line_num] = GetClientColor( indexval );
} }
else else
{ {
strcpy( szRepString, "******" ); strcpy( szRepString, "******" );
} }
break; break;
case 'i': // number case 'i': // number
sprintf( szRepString, "%d", indexval ); sprintf( szRepString, "%d", indexval );
break; break;
default: default:
szRepString[0] = 0; szRepString[0] = 0;
} }
for ( char *cp = szRepString; *cp != 0 && ((dst - dst_start) < MAX_STATUSTEXT_LENGTH); cp++, dst++ ) for ( char *cp = szRepString; *cp != 0 && ((dst - dst_start) < MAX_STATUSTEXT_LENGTH); cp++, dst++ )
*dst = *cp; *dst = *cp;
} }
} }
} }
} }
else else
{ {
// skip to next line of text // skip to next line of text
while ( *src != 0 && *src != '\n' ) while ( *src != 0 && *src != '\n' )
src++; src++;
} }
} }
} }
int CHudStatusBar :: Draw( float fTime ) int CHudStatusBar :: Draw( float fTime )
{ {
if ( m_bReparseString ) if ( m_bReparseString )
{ {
for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
{ {
m_pflNameColors[i] = g_ColorYellow; m_pflNameColors[i] = g_ColorYellow;
ParseStatusString( i ); ParseStatusString( i );
} }
m_bReparseString = FALSE; m_bReparseString = FALSE;
} }
int Y_START = ScreenHeight - YRES(32 + 4); int Y_START = ScreenHeight - YRES(32 + 4);
// Draw the status bar lines // Draw the status bar lines
for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
{ {
int TextHeight, TextWidth; int TextHeight, TextWidth;
GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight ); GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight );
int x = 4; int x = 4;
int y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen int y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen
// let user set status ID bar centering // let user set status ID bar centering
if ( (i == STATUSBAR_ID_LINE) && CVAR_GET_FLOAT("hud_centerid") ) if ( (i == STATUSBAR_ID_LINE) && CVAR_GET_FLOAT("hud_centerid") )
{ {
x = max( 0, max(2, (ScreenWidth - TextWidth)) / 2 ); x = max( 0, max(2, (ScreenWidth - TextWidth)) / 2 );
y = (ScreenHeight / 2) + (TextHeight*CVAR_GET_FLOAT("hud_centerid")); y = (ScreenHeight / 2) + (TextHeight*CVAR_GET_FLOAT("hud_centerid"));
} }
if ( m_pflNameColors[i] ) if ( m_pflNameColors[i] )
DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] ); DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] );
DrawConsoleString( x, y, m_szStatusBar[i] ); DrawConsoleString( x, y, m_szStatusBar[i] );
} }
return 1; return 1;
} }
// Message handler for StatusText message // Message handler for StatusText message
// accepts two values: // accepts two values:
// byte: line number of status bar text // byte: line number of status bar text
// string: status bar text // string: status bar text
// this string describes how the status bar should be drawn // this string describes how the status bar should be drawn
// a semi-regular expression: // a semi-regular expression:
// ( slotnum ([a..z] [%pX] [%iX])*)* // ( slotnum ([a..z] [%pX] [%iX])*)*
// where slotnum is an index into the Value table (see below) // where slotnum is an index into the Value table (see below)
// if slotnum is 0, the string is always drawn // if slotnum is 0, the string is always drawn
// if StatusValue[slotnum] != 0, the following string is drawn, upto the next newline - otherwise the text is skipped upto next newline // if StatusValue[slotnum] != 0, the following string is drawn, upto the next newline - otherwise the text is skipped upto next newline
// %pX, where X is an integer, will substitute a player name here, getting the player index from StatusValue[X] // %pX, where X is an integer, will substitute a player name here, getting the player index from StatusValue[X]
// %iX, where X is an integer, will substitute a number here, getting the number from StatusValue[X] // %iX, where X is an integer, will substitute a number here, getting the number from StatusValue[X]
int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *pbuf ) int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int line = READ_BYTE(); int line = READ_BYTE();
if ( line < 0 || line >= MAX_STATUSBAR_LINES ) if ( line < 0 || line >= MAX_STATUSBAR_LINES )
return 1; return 1;
strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH ); strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH );
m_szStatusText[line][MAX_STATUSTEXT_LENGTH-1] = 0; // ensure it's null terminated ( strncpy() won't null terminate if read string too long) m_szStatusText[line][MAX_STATUSTEXT_LENGTH-1] = 0; // ensure it's null terminated ( strncpy() won't null terminate if read string too long)
if ( m_szStatusText[0] == 0 ) if ( m_szStatusText[0] == 0 )
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
else else
m_iFlags |= HUD_ACTIVE; // we have status text, so turn on the status bar m_iFlags |= HUD_ACTIVE; // we have status text, so turn on the status bar
m_bReparseString = TRUE; m_bReparseString = TRUE;
return 1; return 1;
} }
// Message handler for StatusText message // Message handler for StatusText message
// accepts two values: // accepts two values:
// byte: index into the status value array // byte: index into the status value array
// short: value to store // short: value to store
int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf ) int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int index = READ_BYTE(); int index = READ_BYTE();
if ( index < 1 || index >= MAX_STATUSBAR_VALUES ) if ( index < 1 || index >= MAX_STATUSBAR_VALUES )
return 1; // index out of range return 1; // index out of range
m_iStatusValues[index] = READ_SHORT(); m_iStatusValues[index] = READ_SHORT();
m_bReparseString = TRUE; m_bReparseString = TRUE;
return 1; return 1;
} }

View File

@ -1,251 +1,251 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#include <memory.h> #include <memory.h>
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "const.h" #include "const.h"
#include "com_model.h" #include "com_model.h"
#include "studio_util.h" #include "studio_util.h"
/* /*
==================== ====================
AngleMatrix AngleMatrix
==================== ====================
*/ */
void AngleMatrix (const float *angles, float (*matrix)[4] ) void AngleMatrix (const float *angles, float (*matrix)[4] )
{ {
float angle; float angle;
float sr, sp, sy, cr, cp, cy; float sr, sp, sy, cr, cp, cy;
angle = angles[YAW] * (M_PI*2 / 360); angle = angles[YAW] * (M_PI*2 / 360);
sy = sin(angle); sy = sin(angle);
cy = cos(angle); cy = cos(angle);
angle = angles[PITCH] * (M_PI*2 / 360); angle = angles[PITCH] * (M_PI*2 / 360);
sp = sin(angle); sp = sin(angle);
cp = cos(angle); cp = cos(angle);
angle = angles[ROLL] * (M_PI*2 / 360); angle = angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle); sr = sin(angle);
cr = cos(angle); cr = cos(angle);
// matrix = (YAW * PITCH) * ROLL // matrix = (YAW * PITCH) * ROLL
matrix[0][0] = cp*cy; matrix[0][0] = cp*cy;
matrix[1][0] = cp*sy; matrix[1][0] = cp*sy;
matrix[2][0] = -sp; matrix[2][0] = -sp;
matrix[0][1] = sr*sp*cy+cr*-sy; matrix[0][1] = sr*sp*cy+cr*-sy;
matrix[1][1] = sr*sp*sy+cr*cy; matrix[1][1] = sr*sp*sy+cr*cy;
matrix[2][1] = sr*cp; matrix[2][1] = sr*cp;
matrix[0][2] = (cr*sp*cy+-sr*-sy); matrix[0][2] = (cr*sp*cy+-sr*-sy);
matrix[1][2] = (cr*sp*sy+-sr*cy); matrix[1][2] = (cr*sp*sy+-sr*cy);
matrix[2][2] = cr*cp; matrix[2][2] = cr*cp;
matrix[0][3] = 0.0; matrix[0][3] = 0.0;
matrix[1][3] = 0.0; matrix[1][3] = 0.0;
matrix[2][3] = 0.0; matrix[2][3] = 0.0;
} }
/* /*
==================== ====================
VectorCompare VectorCompare
==================== ====================
*/ */
int VectorCompare (const float *v1, const float *v2) int VectorCompare (const float *v1, const float *v2)
{ {
int i; int i;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
if (v1[i] != v2[i]) if (v1[i] != v2[i])
return 0; return 0;
return 1; return 1;
} }
/* /*
==================== ====================
CrossProduct CrossProduct
==================== ====================
*/ */
void CrossProduct (const float *v1, const float *v2, float *cross) void CrossProduct (const float *v1, const float *v2, float *cross)
{ {
cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
} }
/* /*
==================== ====================
VectorTransform VectorTransform
==================== ====================
*/ */
void VectorTransform (const float *in1, float in2[3][4], float *out) void VectorTransform (const float *in1, float in2[3][4], float *out)
{ {
out[0] = DotProduct(in1, in2[0]) + in2[0][3]; out[0] = DotProduct(in1, in2[0]) + in2[0][3];
out[1] = DotProduct(in1, in2[1]) + in2[1][3]; out[1] = DotProduct(in1, in2[1]) + in2[1][3];
out[2] = DotProduct(in1, in2[2]) + in2[2][3]; out[2] = DotProduct(in1, in2[2]) + in2[2][3];
} }
/* /*
================ ================
ConcatTransforms ConcatTransforms
================ ================
*/ */
void ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]) void ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
{ {
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
in1[0][2] * in2[2][0]; in1[0][2] * in2[2][0];
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
in1[0][2] * in2[2][1]; in1[0][2] * in2[2][1];
out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
in1[0][2] * in2[2][2]; in1[0][2] * in2[2][2];
out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] +
in1[0][2] * in2[2][3] + in1[0][3]; in1[0][2] * in2[2][3] + in1[0][3];
out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
in1[1][2] * in2[2][0]; in1[1][2] * in2[2][0];
out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
in1[1][2] * in2[2][1]; in1[1][2] * in2[2][1];
out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
in1[1][2] * in2[2][2]; in1[1][2] * in2[2][2];
out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] +
in1[1][2] * in2[2][3] + in1[1][3]; in1[1][2] * in2[2][3] + in1[1][3];
out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
in1[2][2] * in2[2][0]; in1[2][2] * in2[2][0];
out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
in1[2][2] * in2[2][1]; in1[2][2] * in2[2][1];
out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
in1[2][2] * in2[2][2]; in1[2][2] * in2[2][2];
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
in1[2][2] * in2[2][3] + in1[2][3]; in1[2][2] * in2[2][3] + in1[2][3];
} }
// angles index are not the same as ROLL, PITCH, YAW // angles index are not the same as ROLL, PITCH, YAW
/* /*
==================== ====================
AngleQuaternion AngleQuaternion
==================== ====================
*/ */
void AngleQuaternion( float *angles, vec4_t quaternion ) void AngleQuaternion( float *angles, vec4_t quaternion )
{ {
float angle; float angle;
float sr, sp, sy, cr, cp, cy; float sr, sp, sy, cr, cp, cy;
// FIXME: rescale the inputs to 1/2 angle // FIXME: rescale the inputs to 1/2 angle
angle = angles[2] * 0.5; angle = angles[2] * 0.5;
sy = sin(angle); sy = sin(angle);
cy = cos(angle); cy = cos(angle);
angle = angles[1] * 0.5; angle = angles[1] * 0.5;
sp = sin(angle); sp = sin(angle);
cp = cos(angle); cp = cos(angle);
angle = angles[0] * 0.5; angle = angles[0] * 0.5;
sr = sin(angle); sr = sin(angle);
cr = cos(angle); cr = cos(angle);
quaternion[0] = sr*cp*cy-cr*sp*sy; // X quaternion[0] = sr*cp*cy-cr*sp*sy; // X
quaternion[1] = cr*sp*cy+sr*cp*sy; // Y quaternion[1] = cr*sp*cy+sr*cp*sy; // Y
quaternion[2] = cr*cp*sy-sr*sp*cy; // Z quaternion[2] = cr*cp*sy-sr*sp*cy; // Z
quaternion[3] = cr*cp*cy+sr*sp*sy; // W quaternion[3] = cr*cp*cy+sr*sp*sy; // W
} }
/* /*
==================== ====================
QuaternionSlerp QuaternionSlerp
==================== ====================
*/ */
void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt ) void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
{ {
int i; int i;
float omega, cosom, sinom, sclp, sclq; float omega, cosom, sinom, sclp, sclq;
// decide if one of the quaternions is backwards // decide if one of the quaternions is backwards
float a = 0; float a = 0;
float b = 0; float b = 0;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
a += (p[i]-q[i])*(p[i]-q[i]); a += (p[i]-q[i])*(p[i]-q[i]);
b += (p[i]+q[i])*(p[i]+q[i]); b += (p[i]+q[i])*(p[i]+q[i]);
} }
if (a > b) if (a > b)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
q[i] = -q[i]; q[i] = -q[i];
} }
} }
cosom = p[0]*q[0] + p[1]*q[1] + p[2]*q[2] + p[3]*q[3]; cosom = p[0]*q[0] + p[1]*q[1] + p[2]*q[2] + p[3]*q[3];
if ((1.0 + cosom) > 0.000001) if ((1.0 + cosom) > 0.000001)
{ {
if ((1.0 - cosom) > 0.000001) if ((1.0 - cosom) > 0.000001)
{ {
omega = acos( cosom ); omega = acos( cosom );
sinom = sin( omega ); sinom = sin( omega );
sclp = sin( (1.0 - t)*omega) / sinom; sclp = sin( (1.0 - t)*omega) / sinom;
sclq = sin( t*omega ) / sinom; sclq = sin( t*omega ) / sinom;
} }
else else
{ {
sclp = 1.0 - t; sclp = 1.0 - t;
sclq = t; sclq = t;
} }
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
qt[i] = sclp * p[i] + sclq * q[i]; qt[i] = sclp * p[i] + sclq * q[i];
} }
} }
else else
{ {
qt[0] = -q[1]; qt[0] = -q[1];
qt[1] = q[0]; qt[1] = q[0];
qt[2] = -q[3]; qt[2] = -q[3];
qt[3] = q[2]; qt[3] = q[2];
sclp = sin( (1.0 - t) * (0.5 * M_PI)); sclp = sin( (1.0 - t) * (0.5 * M_PI));
sclq = sin( t * (0.5 * M_PI)); sclq = sin( t * (0.5 * M_PI));
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
qt[i] = sclp * p[i] + sclq * qt[i]; qt[i] = sclp * p[i] + sclq * qt[i];
} }
} }
} }
/* /*
==================== ====================
QuaternionMatrix QuaternionMatrix
==================== ====================
*/ */
void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] ) void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] )
{ {
matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2]; matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];
matrix[1][0] = 2.0 * quaternion[0] * quaternion[1] + 2.0 * quaternion[3] * quaternion[2]; matrix[1][0] = 2.0 * quaternion[0] * quaternion[1] + 2.0 * quaternion[3] * quaternion[2];
matrix[2][0] = 2.0 * quaternion[0] * quaternion[2] - 2.0 * quaternion[3] * quaternion[1]; matrix[2][0] = 2.0 * quaternion[0] * quaternion[2] - 2.0 * quaternion[3] * quaternion[1];
matrix[0][1] = 2.0 * quaternion[0] * quaternion[1] - 2.0 * quaternion[3] * quaternion[2]; matrix[0][1] = 2.0 * quaternion[0] * quaternion[1] - 2.0 * quaternion[3] * quaternion[2];
matrix[1][1] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[2] * quaternion[2]; matrix[1][1] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[2] * quaternion[2];
matrix[2][1] = 2.0 * quaternion[1] * quaternion[2] + 2.0 * quaternion[3] * quaternion[0]; matrix[2][1] = 2.0 * quaternion[1] * quaternion[2] + 2.0 * quaternion[3] * quaternion[0];
matrix[0][2] = 2.0 * quaternion[0] * quaternion[2] + 2.0 * quaternion[3] * quaternion[1]; matrix[0][2] = 2.0 * quaternion[0] * quaternion[2] + 2.0 * quaternion[3] * quaternion[1];
matrix[1][2] = 2.0 * quaternion[1] * quaternion[2] - 2.0 * quaternion[3] * quaternion[0]; matrix[1][2] = 2.0 * quaternion[1] * quaternion[2] - 2.0 * quaternion[3] * quaternion[0];
matrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1]; matrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1];
} }
/* /*
==================== ====================
MatrixCopy MatrixCopy
==================== ====================
*/ */
void MatrixCopy( float in[3][4], float out[3][4] ) void MatrixCopy( float in[3][4], float out[3][4] )
{ {
memcpy( out, in, sizeof( float ) * 3 * 4 ); memcpy( out, in, sizeof( float ) * 3 * 4 );
} }

View File

@ -1,40 +1,40 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined( STUDIO_UTIL_H ) #if !defined( STUDIO_UTIL_H )
#define STUDIO_UTIL_H #define STUDIO_UTIL_H
#if defined( WIN32 ) #if defined( WIN32 )
#pragma once #pragma once
#endif #endif
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif #endif
#ifndef PITCH #ifndef PITCH
// MOVEMENT INFO // MOVEMENT INFO
// up / down // up / down
#define PITCH 0 #define PITCH 0
// left / right // left / right
#define YAW 1 #define YAW 1
// fall over // fall over
#define ROLL 2 #define ROLL 2
#endif #endif
#define FDotProduct( a, b ) (fabs((a[0])*(b[0])) + fabs((a[1])*(b[1])) + fabs((a[2])*(b[2]))) #define FDotProduct( a, b ) (fabs((a[0])*(b[0])) + fabs((a[1])*(b[1])) + fabs((a[2])*(b[2])))
void AngleMatrix (const float *angles, float (*matrix)[4] ); void AngleMatrix (const float *angles, float (*matrix)[4] );
int VectorCompare (const float *v1, const float *v2); int VectorCompare (const float *v1, const float *v2);
void CrossProduct (const float *v1, const float *v2, float *cross); void CrossProduct (const float *v1, const float *v2, float *cross);
void VectorTransform (const float *in1, float in2[3][4], float *out); void VectorTransform (const float *in1, float in2[3][4], float *out);
void ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); void ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void MatrixCopy( float in[3][4], float out[3][4] ); void MatrixCopy( float in[3][4], float out[3][4] );
void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] ); void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] );
void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt ); void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt );
void AngleQuaternion( float *angles, vec4_t quaternion ); void AngleQuaternion( float *angles, vec4_t quaternion );
#endif // STUDIO_UTIL_H #endif // STUDIO_UTIL_H

View File

@ -1,209 +1,209 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// text_message.cpp // text_message.cpp
// //
// implementation of CHudTextMessage class // implementation of CHudTextMessage class
// //
// this class routes messages through titles.txt for localisation // this class routes messages through titles.txt for localisation
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "parsemsg.h" #include "parsemsg.h"
DECLARE_MESSAGE( m_TextMessage, TextMsg ); DECLARE_MESSAGE( m_TextMessage, TextMsg );
int CHudTextMessage::Init(void) int CHudTextMessage::Init(void)
{ {
HOOK_MESSAGE( TextMsg ); HOOK_MESSAGE( TextMsg );
gHUD.AddHudElem( this ); gHUD.AddHudElem( this );
Reset(); Reset();
return 1; return 1;
}; };
// Searches through the string for any msg names (indicated by a '#') // Searches through the string for any msg names (indicated by a '#')
// any found are looked up in titles.txt and the new message substituted // any found are looked up in titles.txt and the new message substituted
// the new value is pushed into dst_buffer // the new value is pushed into dst_buffer
char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size ) char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size )
{ {
char *dst = dst_buffer; char *dst = dst_buffer;
for ( char *src = (char*)msg; *src != 0 && buffer_size > 0; buffer_size-- ) for ( char *src = (char*)msg; *src != 0 && buffer_size > 0; buffer_size-- )
{ {
if ( *src == '#' ) if ( *src == '#' )
{ {
// cut msg name out of string // cut msg name out of string
static char word_buf[255]; static char word_buf[255];
char *wdst = word_buf, *word_start = src; char *wdst = word_buf, *word_start = src;
for ( ++src ; (*src >= 'A' && *src <= 'z') || (*src >= '0' && *src <= '9'); wdst++, src++ ) for ( ++src ; (*src >= 'A' && *src <= 'z') || (*src >= '0' && *src <= '9'); wdst++, src++ )
{ {
*wdst = *src; *wdst = *src;
} }
*wdst = 0; *wdst = 0;
// lookup msg name in titles.txt // lookup msg name in titles.txt
client_textmessage_t *clmsg = TextMessageGet( word_buf ); client_textmessage_t *clmsg = TextMessageGet( word_buf );
if ( !clmsg || !(clmsg->pMessage) ) if ( !clmsg || !(clmsg->pMessage) )
{ {
src = word_start; src = word_start;
*dst = *src; *dst = *src;
dst++, src++; dst++, src++;
continue; continue;
} }
// copy string into message over the msg name // copy string into message over the msg name
for ( char *wsrc = (char*)clmsg->pMessage; *wsrc != 0; wsrc++, dst++ ) for ( char *wsrc = (char*)clmsg->pMessage; *wsrc != 0; wsrc++, dst++ )
{ {
*dst = *wsrc; *dst = *wsrc;
} }
*dst = 0; *dst = 0;
} }
else else
{ {
*dst = *src; *dst = *src;
dst++, src++; dst++, src++;
*dst = 0; *dst = 0;
} }
} }
dst_buffer[buffer_size-1] = 0; // ensure null termination dst_buffer[buffer_size-1] = 0; // ensure null termination
return dst_buffer; return dst_buffer;
} }
// As above, but with a local static buffer // As above, but with a local static buffer
char *CHudTextMessage::BufferedLocaliseTextString( const char *msg ) char *CHudTextMessage::BufferedLocaliseTextString( const char *msg )
{ {
static char dst_buffer[1024]; static char dst_buffer[1024];
LocaliseTextString( msg, dst_buffer, 1024 ); LocaliseTextString( msg, dst_buffer, 1024 );
return dst_buffer; return dst_buffer;
} }
// Simplified version of LocaliseTextString; assumes string is only one word // Simplified version of LocaliseTextString; assumes string is only one word
char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
{ {
if ( !msg ) if ( !msg )
return ""; return "";
// '#' character indicates this is a reference to a string in titles.txt, and not the string itself // '#' character indicates this is a reference to a string in titles.txt, and not the string itself
if ( msg[0] == '#' ) if ( msg[0] == '#' )
{ {
// this is a message name, so look up the real message // this is a message name, so look up the real message
client_textmessage_t *clmsg = TextMessageGet( msg+1 ); client_textmessage_t *clmsg = TextMessageGet( msg+1 );
if ( !clmsg || !(clmsg->pMessage) ) if ( !clmsg || !(clmsg->pMessage) )
return (char*)msg; // lookup failed, so return the original string return (char*)msg; // lookup failed, so return the original string
if ( msg_dest ) if ( msg_dest )
{ {
// check to see if titles.txt info overrides msg destination // check to see if titles.txt info overrides msg destination
// if clmsg->effect is less than 0, then clmsg->effect holds -1 * message_destination // if clmsg->effect is less than 0, then clmsg->effect holds -1 * message_destination
if ( clmsg->effect < 0 ) // if ( clmsg->effect < 0 ) //
*msg_dest = -clmsg->effect; *msg_dest = -clmsg->effect;
} }
return (char*)clmsg->pMessage; return (char*)clmsg->pMessage;
} }
else else
{ // nothing special about this message, so just return the same string { // nothing special about this message, so just return the same string
return (char*)msg; return (char*)msg;
} }
} }
void StripEndNewlineFromString( char *str ) void StripEndNewlineFromString( char *str )
{ {
int s = strlen( str ) - 1; int s = strlen( str ) - 1;
if ( str[s] == '\n' || str[s] == '\r' ) if ( str[s] == '\n' || str[s] == '\r' )
str[s] = 0; str[s] = 0;
} }
// converts all '\r' characters to '\n', so that the engine can deal with the properly // converts all '\r' characters to '\n', so that the engine can deal with the properly
// returns a pointer to str // returns a pointer to str
char* ConvertCRtoNL( char *str ) char* ConvertCRtoNL( char *str )
{ {
for ( char *ch = str; *ch != 0; ch++ ) for ( char *ch = str; *ch != 0; ch++ )
if ( *ch == '\r' ) if ( *ch == '\r' )
*ch = '\n'; *ch = '\n';
return str; return str;
} }
// Message handler for text messages // Message handler for text messages
// displays a string, looking them up from the titles.txt file, which can be localised // displays a string, looking them up from the titles.txt file, which can be localised
// parameters: // parameters:
// byte: message direction ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK ) // byte: message direction ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )
// string: message // string: message
// optional parameters: // optional parameters:
// string: message parameter 1 // string: message parameter 1
// string: message parameter 2 // string: message parameter 2
// string: message parameter 3 // string: message parameter 3
// string: message parameter 4 // string: message parameter 4
// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt // any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt
// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#') // the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')
int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf ) int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf )
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int msg_dest = READ_BYTE(); int msg_dest = READ_BYTE();
static char szBuf[6][128]; static char szBuf[6][128];
char *msg_text = LookupString( READ_STRING(), &msg_dest ); char *msg_text = LookupString( READ_STRING(), &msg_dest );
msg_text = strcpy( szBuf[0], msg_text ); msg_text = strcpy( szBuf[0], msg_text );
// keep reading strings and using C format strings for subsituting the strings into the localised text string // keep reading strings and using C format strings for subsituting the strings into the localised text string
char *sstr1 = LookupString( READ_STRING() ); char *sstr1 = LookupString( READ_STRING() );
sstr1 = strcpy( szBuf[1], sstr1 ); sstr1 = strcpy( szBuf[1], sstr1 );
StripEndNewlineFromString( sstr1 ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines StripEndNewlineFromString( sstr1 ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
char *sstr2 = LookupString( READ_STRING() ); char *sstr2 = LookupString( READ_STRING() );
sstr2 = strcpy( szBuf[2], sstr2 ); sstr2 = strcpy( szBuf[2], sstr2 );
StripEndNewlineFromString( sstr2 ); StripEndNewlineFromString( sstr2 );
char *sstr3 = LookupString( READ_STRING() ); char *sstr3 = LookupString( READ_STRING() );
sstr3 = strcpy( szBuf[3], sstr3 ); sstr3 = strcpy( szBuf[3], sstr3 );
StripEndNewlineFromString( sstr3 ); StripEndNewlineFromString( sstr3 );
char *sstr4 = LookupString( READ_STRING() ); char *sstr4 = LookupString( READ_STRING() );
sstr4 = strcpy( szBuf[4], sstr4 ); sstr4 = strcpy( szBuf[4], sstr4 );
StripEndNewlineFromString( sstr4 ); StripEndNewlineFromString( sstr4 );
char *psz = szBuf[5]; char *psz = szBuf[5];
switch ( msg_dest ) switch ( msg_dest )
{ {
case HUD_PRINTCENTER: case HUD_PRINTCENTER:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 ); sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
CenterPrint( ConvertCRtoNL( psz ) ); CenterPrint( ConvertCRtoNL( psz ) );
break; break;
case HUD_PRINTNOTIFY: case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer psz[0] = 1; // mark this message to go into the notify buffer
sprintf( psz+1, msg_text, sstr1, sstr2, sstr3, sstr4 ); sprintf( psz+1, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) ); ConsolePrint( ConvertCRtoNL( psz ) );
break; break;
case HUD_PRINTTALK: case HUD_PRINTTALK:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 ); sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 ); gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
break; break;
case HUD_PRINTCONSOLE: case HUD_PRINTCONSOLE:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 ); sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) ); ConsolePrint( ConvertCRtoNL( psz ) );
break; break;
} }
return 1; return 1;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +1,85 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// Train.cpp // Train.cpp
// //
// implementation of CHudAmmo class // implementation of CHudAmmo class
// //
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "parsemsg.h" #include "parsemsg.h"
DECLARE_MESSAGE(m_Train, Train ) DECLARE_MESSAGE(m_Train, Train )
int CHudTrain::Init(void) int CHudTrain::Init(void)
{ {
HOOK_MESSAGE( Train ); HOOK_MESSAGE( Train );
m_iPos = 0; m_iPos = 0;
m_iFlags = 0; m_iFlags = 0;
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
return 1; return 1;
}; };
int CHudTrain::VidInit(void) int CHudTrain::VidInit(void)
{ {
m_hSprite = 0; m_hSprite = 0;
return 1; return 1;
}; };
int CHudTrain::Draw(float fTime) int CHudTrain::Draw(float fTime)
{ {
if ( !m_hSprite ) if ( !m_hSprite )
m_hSprite = LoadSprite("sprites/%d_train.spr"); m_hSprite = LoadSprite("sprites/%d_train.spr");
if (m_iPos) if (m_iPos)
{ {
int r, g, b, x, y; int r, g, b, x, y;
UnpackRGB(r,g,b, RGB_YELLOWISH); UnpackRGB(r,g,b, RGB_YELLOWISH);
SPR_Set(m_hSprite, r, g, b ); SPR_Set(m_hSprite, r, g, b );
// This should show up to the right and part way up the armor number // This should show up to the right and part way up the armor number
y = ScreenHeight - SPR_Height(m_hSprite,0) - gHUD.m_iFontHeight; y = ScreenHeight - SPR_Height(m_hSprite,0) - gHUD.m_iFontHeight;
x = ScreenWidth/3 + SPR_Width(m_hSprite,0)/4; x = ScreenWidth/3 + SPR_Width(m_hSprite,0)/4;
SPR_DrawAdditive( m_iPos - 1, x, y, NULL); SPR_DrawAdditive( m_iPos - 1, x, y, NULL);
} }
return 1; return 1;
} }
int CHudTrain::MsgFunc_Train(const char *pszName, int iSize, void *pbuf) int CHudTrain::MsgFunc_Train(const char *pszName, int iSize, void *pbuf)
{ {
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
// update Train data // update Train data
m_iPos = READ_BYTE(); m_iPos = READ_BYTE();
if (m_iPos) if (m_iPos)
m_iFlags |= HUD_ACTIVE; m_iFlags |= HUD_ACTIVE;
else else
m_iFlags &= ~HUD_ACTIVE; m_iFlags &= ~HUD_ACTIVE;
return 1; return 1;
} }

View File

@ -1,122 +1,122 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
// Triangle rendering, if any // Triangle rendering, if any
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
// Triangle rendering apis are in gEngfuncs.pTriAPI // Triangle rendering apis are in gEngfuncs.pTriAPI
#include "const.h" #include "const.h"
#include "entity_state.h" #include "entity_state.h"
#include "cl_entity.h" #include "cl_entity.h"
#include "triangleapi.h" #include "triangleapi.h"
extern "C" extern "C"
{ {
void DLLEXPORT HUD_DrawNormalTriangles( void ); void DLLEXPORT HUD_DrawNormalTriangles( void );
void DLLEXPORT HUD_DrawTransparentTriangles( void ); void DLLEXPORT HUD_DrawTransparentTriangles( void );
}; };
//#define TEST_IT //#define TEST_IT
#if defined( TEST_IT ) #if defined( TEST_IT )
/* /*
================= =================
Draw_Triangles Draw_Triangles
Example routine. Draws a sprite offset from the player origin. Example routine. Draws a sprite offset from the player origin.
================= =================
*/ */
void Draw_Triangles( void ) void Draw_Triangles( void )
{ {
cl_entity_t *player; cl_entity_t *player;
vec3_t org; vec3_t org;
// Load it up with some bogus data // Load it up with some bogus data
player = gEngfuncs.GetLocalPlayer(); player = gEngfuncs.GetLocalPlayer();
if ( !player ) if ( !player )
return; return;
org = player->origin; org = player->origin;
org.x += 50; org.x += 50;
org.y += 50; org.y += 50;
if (gHUD.m_hsprCursor == 0) if (gHUD.m_hsprCursor == 0)
{ {
char sz[256]; char sz[256];
sprintf( sz, "sprites/cursor.spr" ); sprintf( sz, "sprites/cursor.spr" );
gHUD.m_hsprCursor = SPR_Load( sz ); gHUD.m_hsprCursor = SPR_Load( sz );
} }
if ( !gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( gHUD.m_hsprCursor ), 0 )) if ( !gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( gHUD.m_hsprCursor ), 0 ))
{ {
return; return;
} }
// Create a triangle, sigh // Create a triangle, sigh
gEngfuncs.pTriAPI->RenderMode( kRenderNormal ); gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
gEngfuncs.pTriAPI->CullFace( TRI_NONE ); gEngfuncs.pTriAPI->CullFace( TRI_NONE );
gEngfuncs.pTriAPI->Begin( TRI_QUADS ); gEngfuncs.pTriAPI->Begin( TRI_QUADS );
// Overload p->color with index into tracer palette, p->packedColor with brightness // Overload p->color with index into tracer palette, p->packedColor with brightness
gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 ); gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );
// UNDONE: This gouraud shading causes tracers to disappear on some cards (permedia2) // UNDONE: This gouraud shading causes tracers to disappear on some cards (permedia2)
gEngfuncs.pTriAPI->Brightness( 1 ); gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 ); gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->Vertex3f( org.x, org.y, org.z ); gEngfuncs.pTriAPI->Vertex3f( org.x, org.y, org.z );
gEngfuncs.pTriAPI->Brightness( 1 ); gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 ); gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->Vertex3f( org.x, org.y + 50, org.z ); gEngfuncs.pTriAPI->Vertex3f( org.x, org.y + 50, org.z );
gEngfuncs.pTriAPI->Brightness( 1 ); gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 ); gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y + 50, org.z ); gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y + 50, org.z );
gEngfuncs.pTriAPI->Brightness( 1 ); gEngfuncs.pTriAPI->Brightness( 1 );
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 ); gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y, org.z ); gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y, org.z );
gEngfuncs.pTriAPI->End(); gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal ); gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
} }
#endif #endif
/* /*
================= =================
HUD_DrawNormalTriangles HUD_DrawNormalTriangles
Non-transparent triangles-- add them here Non-transparent triangles-- add them here
================= =================
*/ */
void DLLEXPORT HUD_DrawNormalTriangles( void ) void DLLEXPORT HUD_DrawNormalTriangles( void )
{ {
gHUD.m_Spectator.DrawOverview(); gHUD.m_Spectator.DrawOverview();
#if defined( TEST_IT ) #if defined( TEST_IT )
// Draw_Triangles(); // Draw_Triangles();
#endif #endif
} }
/* /*
================= =================
HUD_DrawTransparentTriangles HUD_DrawTransparentTriangles
Render any triangles with transparent rendermode needs here Render any triangles with transparent rendermode needs here
================= =================
*/ */
void DLLEXPORT HUD_DrawTransparentTriangles( void ) void DLLEXPORT HUD_DrawTransparentTriangles( void )
{ {
#if defined( TEST_IT ) #if defined( TEST_IT )
// Draw_Triangles(); // Draw_Triangles();
#endif #endif
} }

View File

@ -1,133 +1,133 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// //
// util.cpp // util.cpp
// //
// implementation of class-less helper functions // implementation of class-less helper functions
// //
#include "stdio.h" #include "stdio.h"
#include "stdlib.h" #include "stdlib.h"
#include "math.h" #include "math.h"
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include <string.h> #include <string.h>
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif #endif
extern vec3_t vec3_origin; extern vec3_t vec3_origin;
double sqrt(double x); double sqrt(double x);
float Length(const float *v) float Length(const float *v)
{ {
int i; int i;
float length; float length;
length = 0; length = 0;
for (i=0 ; i< 3 ; i++) for (i=0 ; i< 3 ; i++)
length += v[i]*v[i]; length += v[i]*v[i];
length = sqrt (length); // FIXME length = sqrt (length); // FIXME
return length; return length;
} }
void VectorAngles( const float *forward, float *angles ) void VectorAngles( const float *forward, float *angles )
{ {
float tmp, yaw, pitch; float tmp, yaw, pitch;
if (forward[1] == 0 && forward[0] == 0) if (forward[1] == 0 && forward[0] == 0)
{ {
yaw = 0; yaw = 0;
if (forward[2] > 0) if (forward[2] > 0)
pitch = 90; pitch = 90;
else else
pitch = 270; pitch = 270;
} }
else else
{ {
yaw = (atan2(forward[1], forward[0]) * 180 / M_PI); yaw = (atan2(forward[1], forward[0]) * 180 / M_PI);
if (yaw < 0) if (yaw < 0)
yaw += 360; yaw += 360;
tmp = sqrt (forward[0]*forward[0] + forward[1]*forward[1]); tmp = sqrt (forward[0]*forward[0] + forward[1]*forward[1]);
pitch = (atan2(forward[2], tmp) * 180 / M_PI); pitch = (atan2(forward[2], tmp) * 180 / M_PI);
if (pitch < 0) if (pitch < 0)
pitch += 360; pitch += 360;
} }
angles[0] = pitch; angles[0] = pitch;
angles[1] = yaw; angles[1] = yaw;
angles[2] = 0; angles[2] = 0;
} }
float VectorNormalize (float *v) float VectorNormalize (float *v)
{ {
float length, ilength; float length, ilength;
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
length = sqrt (length); // FIXME length = sqrt (length); // FIXME
if (length) if (length)
{ {
ilength = 1/length; ilength = 1/length;
v[0] *= ilength; v[0] *= ilength;
v[1] *= ilength; v[1] *= ilength;
v[2] *= ilength; v[2] *= ilength;
} }
return length; return length;
} }
void VectorInverse ( float *v ) void VectorInverse ( float *v )
{ {
v[0] = -v[0]; v[0] = -v[0];
v[1] = -v[1]; v[1] = -v[1];
v[2] = -v[2]; v[2] = -v[2];
} }
void VectorScale (const float *in, float scale, float *out) void VectorScale (const float *in, float scale, float *out)
{ {
out[0] = in[0]*scale; out[0] = in[0]*scale;
out[1] = in[1]*scale; out[1] = in[1]*scale;
out[2] = in[2]*scale; out[2] = in[2]*scale;
} }
void VectorMA (const float *veca, float scale, const float *vecb, float *vecc) void VectorMA (const float *veca, float scale, const float *vecb, float *vecc)
{ {
vecc[0] = veca[0] + scale*vecb[0]; vecc[0] = veca[0] + scale*vecb[0];
vecc[1] = veca[1] + scale*vecb[1]; vecc[1] = veca[1] + scale*vecb[1];
vecc[2] = veca[2] + scale*vecb[2]; vecc[2] = veca[2] + scale*vecb[2];
} }
HSPRITE LoadSprite(const char *pszName) HSPRITE LoadSprite(const char *pszName)
{ {
int i; int i;
char sz[256]; char sz[256];
if (ScreenWidth < 640) if (ScreenWidth < 640)
i = 320; i = 320;
else else
i = 640; i = 640;
sprintf(sz, pszName, i); sprintf(sz, pszName, i);
return SPR_Load(sz); return SPR_Load(sz);
} }

View File

@ -1,121 +1,121 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// Vector.h // Vector.h
// A subset of the extdll.h in the project HL Entity DLL // A subset of the extdll.h in the project HL Entity DLL
// //
// Misc C-runtime library headers // Misc C-runtime library headers
#include "stdio.h" #include "stdio.h"
#include "stdlib.h" #include "stdlib.h"
#include "math.h" #include "math.h"
// Header file containing definition of globalvars_t and entvars_t // Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t; // typedef unsigned int func_t; //
typedef unsigned int string_t; // from engine's pr_comp.h; typedef unsigned int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h typedef float vec_t; // needed before including progdefs.h
//========================================================= //=========================================================
// 2DVector - used for many pathfinding and many other // 2DVector - used for many pathfinding and many other
// operations that are treated as planar rather than 3d. // operations that are treated as planar rather than 3d.
//========================================================= //=========================================================
class Vector2D class Vector2D
{ {
public: public:
inline Vector2D(void) { } inline Vector2D(void) { }
inline Vector2D(float X, float Y) { x = X; y = Y; } inline Vector2D(float X, float Y) { x = X; y = Y; }
inline Vector2D operator+(const Vector2D& v) const { return Vector2D(x+v.x, y+v.y); } inline Vector2D operator+(const Vector2D& v) const { return Vector2D(x+v.x, y+v.y); }
inline Vector2D operator-(const Vector2D& v) const { return Vector2D(x-v.x, y-v.y); } inline Vector2D operator-(const Vector2D& v) const { return Vector2D(x-v.x, y-v.y); }
inline Vector2D operator*(float fl) const { return Vector2D(x*fl, y*fl); } inline Vector2D operator*(float fl) const { return Vector2D(x*fl, y*fl); }
inline Vector2D operator/(float fl) const { return Vector2D(x/fl, y/fl); } inline Vector2D operator/(float fl) const { return Vector2D(x/fl, y/fl); }
inline float Length(void) const { return (float)sqrt(x*x + y*y ); } inline float Length(void) const { return (float)sqrt(x*x + y*y ); }
inline Vector2D Normalize ( void ) const inline Vector2D Normalize ( void ) const
{ {
Vector2D vec2; Vector2D vec2;
float flLen = Length(); float flLen = Length();
if ( flLen == 0 ) if ( flLen == 0 )
{ {
return Vector2D( (float)0, (float)0 ); return Vector2D( (float)0, (float)0 );
} }
else else
{ {
flLen = 1 / flLen; flLen = 1 / flLen;
return Vector2D( x * flLen, y * flLen ); return Vector2D( x * flLen, y * flLen );
} }
} }
vec_t x, y; vec_t x, y;
}; };
inline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); } inline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); }
inline Vector2D operator*(float fl, const Vector2D& v) { return v * fl; } inline Vector2D operator*(float fl, const Vector2D& v) { return v * fl; }
//========================================================= //=========================================================
// 3D Vector // 3D Vector
//========================================================= //=========================================================
class Vector // same data-layout as engine's vec3_t, class Vector // same data-layout as engine's vec3_t,
{ // which is a vec_t[3] { // which is a vec_t[3]
public: public:
// Construction/destruction // Construction/destruction
inline Vector(void) { } inline Vector(void) { }
inline Vector(float X, float Y, float Z) { x = X; y = Y; z = Z; } inline Vector(float X, float Y, float Z) { x = X; y = Y; z = Z; }
inline Vector(double X, double Y, double Z) { x = (float)X; y = (float)Y; z = (float)Z; } inline Vector(double X, double Y, double Z) { x = (float)X; y = (float)Y; z = (float)Z; }
inline Vector(int X, int Y, int Z) { x = (float)X; y = (float)Y; z = (float)Z; } inline Vector(int X, int Y, int Z) { x = (float)X; y = (float)Y; z = (float)Z; }
inline Vector(const Vector& v) { x = v.x; y = v.y; z = v.z; } inline Vector(const Vector& v) { x = v.x; y = v.y; z = v.z; }
inline Vector(float rgfl[3]) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; } inline Vector(float rgfl[3]) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; }
// Operators // Operators
inline Vector operator-(void) const { return Vector(-x,-y,-z); } inline Vector operator-(void) const { return Vector(-x,-y,-z); }
inline int operator==(const Vector& v) const { return x==v.x && y==v.y && z==v.z; } inline int operator==(const Vector& v) const { return x==v.x && y==v.y && z==v.z; }
inline int operator!=(const Vector& v) const { return !(*this==v); } inline int operator!=(const Vector& v) const { return !(*this==v); }
inline Vector operator+(const Vector& v) const { return Vector(x+v.x, y+v.y, z+v.z); } inline Vector operator+(const Vector& v) const { return Vector(x+v.x, y+v.y, z+v.z); }
inline Vector operator-(const Vector& v) const { return Vector(x-v.x, y-v.y, z-v.z); } inline Vector operator-(const Vector& v) const { return Vector(x-v.x, y-v.y, z-v.z); }
inline Vector operator*(float fl) const { return Vector(x*fl, y*fl, z*fl); } inline Vector operator*(float fl) const { return Vector(x*fl, y*fl, z*fl); }
inline Vector operator/(float fl) const { return Vector(x/fl, y/fl, z/fl); } inline Vector operator/(float fl) const { return Vector(x/fl, y/fl, z/fl); }
// Methods // Methods
inline void CopyToArray(float* rgfl) const { rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; } inline void CopyToArray(float* rgfl) const { rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; }
inline float Length(void) const { return (float)sqrt(x*x + y*y + z*z); } inline float Length(void) const { return (float)sqrt(x*x + y*y + z*z); }
operator float *() { return &x; } // Vectors will now automatically convert to float * when needed operator float *() { return &x; } // Vectors will now automatically convert to float * when needed
operator const float *() const { return &x; } // Vectors will now automatically convert to float * when needed operator const float *() const { return &x; } // Vectors will now automatically convert to float * when needed
inline Vector Normalize(void) const inline Vector Normalize(void) const
{ {
float flLen = Length(); float flLen = Length();
if (flLen == 0) return Vector(0,0,1); // ???? if (flLen == 0) return Vector(0,0,1); // ????
flLen = 1 / flLen; flLen = 1 / flLen;
return Vector(x * flLen, y * flLen, z * flLen); return Vector(x * flLen, y * flLen, z * flLen);
} }
inline Vector2D Make2D ( void ) const inline Vector2D Make2D ( void ) const
{ {
Vector2D Vec2; Vector2D Vec2;
Vec2.x = x; Vec2.x = x;
Vec2.y = y; Vec2.y = y;
return Vec2; return Vec2;
} }
inline float Length2D(void) const { return (float)sqrt(x*x + y*y); } inline float Length2D(void) const { return (float)sqrt(x*x + y*y); }
// Members // Members
vec_t x, y, z; vec_t x, y, z;
}; };
inline Vector operator*(float fl, const Vector& v) { return v * fl; } inline Vector operator*(float fl, const Vector& v) { return v * fl; }
inline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); } inline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); }
inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ); } inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ); }
#define vec3_t Vector #define vec3_t Vector

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#if !defined ( VIEWH ) #if !defined ( VIEWH )
#define VIEWH #define VIEWH
#pragma once #pragma once
void V_StartPitchDrift( void ); void V_StartPitchDrift( void );
void V_StopPitchDrift( void ); void V_StopPitchDrift( void );
#endif // !VIEWH #endif // !VIEWH

View File

@ -1,60 +1,60 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef BEAMDEF_H #ifndef BEAMDEF_H
#define BEAMDEF_H #define BEAMDEF_H
#define FBEAM_STARTENTITY 0x00000001 #define FBEAM_STARTENTITY 0x00000001
#define FBEAM_ENDENTITY 0x00000002 #define FBEAM_ENDENTITY 0x00000002
#define FBEAM_FADEIN 0x00000004 #define FBEAM_FADEIN 0x00000004
#define FBEAM_FADEOUT 0x00000008 #define FBEAM_FADEOUT 0x00000008
#define FBEAM_SINENOISE 0x00000010 #define FBEAM_SINENOISE 0x00000010
#define FBEAM_SOLID 0x00000020 #define FBEAM_SOLID 0x00000020
#define FBEAM_SHADEIN 0x00000040 #define FBEAM_SHADEIN 0x00000040
#define FBEAM_SHADEOUT 0x00000080 #define FBEAM_SHADEOUT 0x00000080
#define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet? #define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet?
#define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet? #define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet?
#define FBEAM_ISACTIVE 0x40000000 #define FBEAM_ISACTIVE 0x40000000
#define FBEAM_FOREVER 0x80000000 #define FBEAM_FOREVER 0x80000000
typedef struct beam_s BEAM; typedef struct beam_s BEAM;
struct beam_s struct beam_s
{ {
BEAM *next; BEAM *next;
int type; int type;
int flags; int flags;
vec3_t source; vec3_t source;
vec3_t target; vec3_t target;
vec3_t delta; vec3_t delta;
float t; // 0 .. 1 over lifetime of beam float t; // 0 .. 1 over lifetime of beam
float freq; float freq;
float die; float die;
float width; float width;
float amplitude; float amplitude;
float r, g, b; float r, g, b;
float brightness; float brightness;
float speed; float speed;
float frameRate; float frameRate;
float frame; float frame;
int segments; int segments;
int startEntity; int startEntity;
int endEntity; int endEntity;
int modelIndex; int modelIndex;
int frameCount; int frameCount;
struct model_s *pFollowModel; struct model_s *pFollowModel;
struct particle_s *particles; struct particle_s *particles;
}; };
#endif//BEAMDEF_H #endif//BEAMDEF_H

View File

@ -1,246 +1,246 @@
/* /*
bspfile.h - BSP format included q1, hl1 support bspfile.h - BSP format included q1, hl1 support
Copyright (C) 2010 Uncle Mike Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef BSPFILE_H #ifndef BSPFILE_H
#define BSPFILE_H #define BSPFILE_H
/* /*
============================================================================== ==============================================================================
BRUSH MODELS BRUSH MODELS
.bsp contain level static geometry with including PVS and lightning info .bsp contain level static geometry with including PVS and lightning info
============================================================================== ==============================================================================
*/ */
// header // header
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28) #define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
#define HLBSP_VERSION 30 // half-life regular version #define HLBSP_VERSION 30 // half-life regular version
#define XTBSP_VERSION 31 // extended lightmaps and expanded clipnodes limit #define XTBSP_VERSION 31 // extended lightmaps and expanded clipnodes limit
#define IDEXTRAHEADER (('H'<<24)+('S'<<16)+('A'<<8)+'X') // little-endian "XASH" #define IDEXTRAHEADER (('H'<<24)+('S'<<16)+('A'<<8)+'X') // little-endian "XASH"
#define EXTRA_VERSION 2 // because version 1 was occupied by old versions of XashXT #define EXTRA_VERSION 2 // because version 1 was occupied by old versions of XashXT
#define DELUXEMAP_VERSION 1 #define DELUXEMAP_VERSION 1
#define IDDELUXEMAPHEADER (('T'<<24)+('I'<<16)+('L'<<8)+'Q') // little-endian "QLIT" #define IDDELUXEMAPHEADER (('T'<<24)+('I'<<16)+('L'<<8)+'Q') // little-endian "QLIT"
// worldcraft predefined angles // worldcraft predefined angles
#define ANGLE_UP -1 #define ANGLE_UP -1
#define ANGLE_DOWN -2 #define ANGLE_DOWN -2
// bmodel limits // bmodel limits
#define MAX_MAP_HULLS 4 // MAX_HULLS #define MAX_MAP_HULLS 4 // MAX_HULLS
#define SURF_NOCULL BIT( 0 ) // two-sided polygon (e.g. 'water4b') #define SURF_NOCULL BIT( 0 ) // two-sided polygon (e.g. 'water4b')
#define SURF_PLANEBACK BIT( 1 ) // plane should be negated #define SURF_PLANEBACK BIT( 1 ) // plane should be negated
#define SURF_DRAWSKY BIT( 2 ) // sky surface #define SURF_DRAWSKY BIT( 2 ) // sky surface
#define SURF_WATERCSG BIT( 3 ) // culled by csg (was SURF_DRAWSPRITE) #define SURF_WATERCSG BIT( 3 ) // culled by csg (was SURF_DRAWSPRITE)
#define SURF_DRAWTURB BIT( 4 ) // warp surface #define SURF_DRAWTURB BIT( 4 ) // warp surface
#define SURF_DRAWTILED BIT( 5 ) // face without lighmap #define SURF_DRAWTILED BIT( 5 ) // face without lighmap
#define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND) #define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND)
#define SURF_UNDERWATER BIT( 7 ) // caustics #define SURF_UNDERWATER BIT( 7 ) // caustics
#define SURF_TRANSPARENT BIT( 8 ) // it's a transparent texture (was SURF_DONTWARP) #define SURF_TRANSPARENT BIT( 8 ) // it's a transparent texture (was SURF_DONTWARP)
#define SURF_REFLECT BIT( 31 ) // reflect surface (mirror) #define SURF_REFLECT BIT( 31 ) // reflect surface (mirror)
// lightstyle management // lightstyle management
#define LM_STYLES 4 // MAXLIGHTMAPS #define LM_STYLES 4 // MAXLIGHTMAPS
#define LS_NORMAL 0x00 #define LS_NORMAL 0x00
#define LS_UNUSED 0xFE #define LS_UNUSED 0xFE
#define LS_NONE 0xFF #define LS_NONE 0xFF
#define MAX_MAP_MODELS 1024 // can be increased up to 2048 if needed #define MAX_MAP_MODELS 1024 // can be increased up to 2048 if needed
#define MAX_MAP_BRUSHES 32768 // unsigned short limit #define MAX_MAP_BRUSHES 32768 // unsigned short limit
#define MAX_MAP_ENTITIES 8192 // can be increased up to 32768 if needed #define MAX_MAP_ENTITIES 8192 // can be increased up to 32768 if needed
#define MAX_MAP_ENTSTRING 0x80000 // 512 kB should be enough #define MAX_MAP_ENTSTRING 0x80000 // 512 kB should be enough
#define MAX_MAP_PLANES 65536 // can be increased without problems #define MAX_MAP_PLANES 65536 // can be increased without problems
#define MAX_MAP_NODES 32767 // because negative shorts are leafs #define MAX_MAP_NODES 32767 // because negative shorts are leafs
#define MAX_MAP_CLIPNODES 32767 // because negative shorts are contents #define MAX_MAP_CLIPNODES 32767 // because negative shorts are contents
#define MAX_MAP_LEAFS 32767 // signed short limit #define MAX_MAP_LEAFS 32767 // signed short limit
#define MAX_MAP_VERTS 65535 // unsigned short limit #define MAX_MAP_VERTS 65535 // unsigned short limit
#define MAX_MAP_FACES 65535 // unsigned short limit #define MAX_MAP_FACES 65535 // unsigned short limit
#define MAX_MAP_MARKSURFACES 65535 // unsigned short limit #define MAX_MAP_MARKSURFACES 65535 // unsigned short limit
#define MAX_MAP_TEXINFO MAX_MAP_FACES // in theory each face may have personal texinfo #define MAX_MAP_TEXINFO MAX_MAP_FACES // in theory each face may have personal texinfo
#define MAX_MAP_EDGES 0x100000 // can be increased but not needed #define MAX_MAP_EDGES 0x100000 // can be increased but not needed
#define MAX_MAP_SURFEDGES 0x200000 // can be increased but not needed #define MAX_MAP_SURFEDGES 0x200000 // can be increased but not needed
#define MAX_MAP_TEXTURES 2048 // can be increased but not needed #define MAX_MAP_TEXTURES 2048 // can be increased but not needed
#define MAX_MAP_MIPTEX 0x2000000 // 32 Mb internal textures data #define MAX_MAP_MIPTEX 0x2000000 // 32 Mb internal textures data
#define MAX_MAP_LIGHTING 0x2000000 // 32 Mb lightmap raw data (can contain deluxemaps) #define MAX_MAP_LIGHTING 0x2000000 // 32 Mb lightmap raw data (can contain deluxemaps)
#define MAX_MAP_VISIBILITY 0x800000 // 8 Mb visdata #define MAX_MAP_VISIBILITY 0x800000 // 8 Mb visdata
// quake lump ordering // quake lump ordering
#define LUMP_ENTITIES 0 #define LUMP_ENTITIES 0
#define LUMP_PLANES 1 #define LUMP_PLANES 1
#define LUMP_TEXTURES 2 // internal textures #define LUMP_TEXTURES 2 // internal textures
#define LUMP_VERTEXES 3 #define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4 #define LUMP_VISIBILITY 4
#define LUMP_NODES 5 #define LUMP_NODES 5
#define LUMP_TEXINFO 6 #define LUMP_TEXINFO 6
#define LUMP_FACES 7 #define LUMP_FACES 7
#define LUMP_LIGHTING 8 #define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9 #define LUMP_CLIPNODES 9
#define LUMP_LEAFS 10 #define LUMP_LEAFS 10
#define LUMP_MARKSURFACES 11 #define LUMP_MARKSURFACES 11
#define LUMP_EDGES 12 #define LUMP_EDGES 12
#define LUMP_SURFEDGES 13 #define LUMP_SURFEDGES 13
#define LUMP_MODELS 14 // internal submodels #define LUMP_MODELS 14 // internal submodels
#define HEADER_LUMPS 15 #define HEADER_LUMPS 15
// version 31 // version 31
#define LUMP_CLIPNODES2 15 // hull0 goes into LUMP_NODES, hull1 goes into LUMP_CLIPNODES, #define LUMP_CLIPNODES2 15 // hull0 goes into LUMP_NODES, hull1 goes into LUMP_CLIPNODES,
#define LUMP_CLIPNODES3 16 // hull2 goes into LUMP_CLIPNODES2, hull3 goes into LUMP_CLIPNODES3 #define LUMP_CLIPNODES3 16 // hull2 goes into LUMP_CLIPNODES2, hull3 goes into LUMP_CLIPNODES3
#define HEADER_LUMPS_31 17 #define HEADER_LUMPS_31 17
#define LUMP_FACES_EXTRADATA 0 // extension of dface_t #define LUMP_FACES_EXTRADATA 0 // extension of dface_t
#define LUMP_VERTS_EXTRADATA 1 // extension of dvertex_t #define LUMP_VERTS_EXTRADATA 1 // extension of dvertex_t
#define LUMP_CUBEMAPS 2 // cubemap description #define LUMP_CUBEMAPS 2 // cubemap description
#define EXTRA_LUMPS 8 // g-cont. just for future expansions #define EXTRA_LUMPS 8 // g-cont. just for future expansions
// texture flags // texture flags
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision #define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
// ambient sound types // ambient sound types
enum enum
{ {
AMBIENT_WATER = 0, // waterfall AMBIENT_WATER = 0, // waterfall
AMBIENT_SKY, // wind AMBIENT_SKY, // wind
AMBIENT_SLIME, // never used in quake AMBIENT_SLIME, // never used in quake
AMBIENT_LAVA, // never used in quake AMBIENT_LAVA, // never used in quake
NUM_AMBIENTS, // automatic ambient sounds NUM_AMBIENTS, // automatic ambient sounds
}; };
// //
// BSP File Structures // BSP File Structures
// //
typedef struct typedef struct
{ {
int fileofs; int fileofs;
int filelen; int filelen;
} dlump_t; } dlump_t;
typedef struct typedef struct
{ {
int version; int version;
dlump_t lumps[HEADER_LUMPS]; dlump_t lumps[HEADER_LUMPS];
} dheader_t; } dheader_t;
typedef struct typedef struct
{ {
int version; int version;
dlump_t lumps[HEADER_LUMPS_31]; dlump_t lumps[HEADER_LUMPS_31];
} dheader31_t; } dheader31_t;
typedef struct typedef struct
{ {
int id; // must be little endian XASH int id; // must be little endian XASH
int version; int version;
dlump_t lumps[EXTRA_LUMPS]; dlump_t lumps[EXTRA_LUMPS];
} dextrahdr_t; } dextrahdr_t;
typedef struct typedef struct
{ {
vec3_t mins; vec3_t mins;
vec3_t maxs; vec3_t maxs;
vec3_t origin; // for sounds or lights vec3_t origin; // for sounds or lights
int headnode[MAX_MAP_HULLS]; int headnode[MAX_MAP_HULLS];
int visleafs; // not including the solid leaf 0 int visleafs; // not including the solid leaf 0
int firstface; int firstface;
int numfaces; int numfaces;
} dmodel_t; } dmodel_t;
typedef struct typedef struct
{ {
int nummiptex; int nummiptex;
int dataofs[4]; // [nummiptex] int dataofs[4]; // [nummiptex]
} dmiptexlump_t; } dmiptexlump_t;
typedef struct typedef struct
{ {
vec3_t point; vec3_t point;
} dvertex_t; } dvertex_t;
typedef struct typedef struct
{ {
vec3_t normal; vec3_t normal;
float dist; float dist;
int type; // PLANE_X - PLANE_ANYZ ? int type; // PLANE_X - PLANE_ANYZ ?
} dplane_t; } dplane_t;
typedef struct typedef struct
{ {
int planenum; int planenum;
short children[2]; // negative numbers are -(leafs + 1), not nodes short children[2]; // negative numbers are -(leafs + 1), not nodes
short mins[3]; // for sphere culling short mins[3]; // for sphere culling
short maxs[3]; short maxs[3];
word firstface; word firstface;
word numfaces; // counting both sides word numfaces; // counting both sides
} dnode_t; } dnode_t;
// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas // leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
// all other leafs need visibility info // all other leafs need visibility info
typedef struct typedef struct
{ {
int contents; int contents;
int visofs; // -1 = no visibility info int visofs; // -1 = no visibility info
short mins[3]; // for frustum culling short mins[3]; // for frustum culling
short maxs[3]; short maxs[3];
word firstmarksurface; word firstmarksurface;
word nummarksurfaces; word nummarksurfaces;
// automatic ambient sounds // automatic ambient sounds
byte ambient_level[NUM_AMBIENTS]; // ambient sound level (0 - 255) byte ambient_level[NUM_AMBIENTS]; // ambient sound level (0 - 255)
} dleaf_t; } dleaf_t;
typedef struct typedef struct
{ {
int planenum; int planenum;
short children[2]; // negative numbers are contents short children[2]; // negative numbers are contents
} dclipnode_t; } dclipnode_t;
typedef struct typedef struct
{ {
float vecs[2][4]; // texmatrix [s/t][xyz offset] float vecs[2][4]; // texmatrix [s/t][xyz offset]
int miptex; int miptex;
int flags; int flags;
} dtexinfo_t; } dtexinfo_t;
typedef word dmarkface_t; // leaf marksurfaces indexes typedef word dmarkface_t; // leaf marksurfaces indexes
typedef int dsurfedge_t; // map surfedges typedef int dsurfedge_t; // map surfedges
// NOTE: that edge 0 is never used, because negative edge nums // NOTE: that edge 0 is never used, because negative edge nums
// are used for counterclockwise use of the edge in a face // are used for counterclockwise use of the edge in a face
typedef struct typedef struct
{ {
word v[2]; // vertex numbers word v[2]; // vertex numbers
} dedge_t; } dedge_t;
typedef struct typedef struct
{ {
word planenum; word planenum;
short side; short side;
int firstedge; // we must support > 64k edges int firstedge; // we must support > 64k edges
short numedges; short numedges;
short texinfo; short texinfo;
// lighting info // lighting info
byte styles[LM_STYLES]; byte styles[LM_STYLES];
int lightofs; // start of [numstyles*surfsize] samples int lightofs; // start of [numstyles*surfsize] samples
} dface_t; } dface_t;
#endif//BSPFILE_H #endif//BSPFILE_H

View File

@ -1,105 +1,105 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef CL_ENTITY_H #ifndef CL_ENTITY_H
#define CL_ENTITY_H #define CL_ENTITY_H
typedef struct efrag_s typedef struct efrag_s
{ {
struct mleaf_s *leaf; struct mleaf_s *leaf;
struct efrag_s *leafnext; struct efrag_s *leafnext;
struct cl_entity_s *entity; struct cl_entity_s *entity;
struct efrag_s *entnext; struct efrag_s *entnext;
} efrag_t; } efrag_t;
typedef struct typedef struct
{ {
byte mouthopen; // 0 = mouth closed, 255 = mouth agape byte mouthopen; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average byte sndcount; // counter for running average
int sndavg; // running average int sndavg; // running average
} mouth_t; } mouth_t;
typedef struct typedef struct
{ {
float prevanimtime; float prevanimtime;
float sequencetime; float sequencetime;
byte prevseqblending[2]; byte prevseqblending[2];
vec3_t prevorigin; vec3_t prevorigin;
vec3_t prevangles; vec3_t prevangles;
int prevsequence; int prevsequence;
float prevframe; float prevframe;
byte prevcontroller[4]; byte prevcontroller[4];
byte prevblending[2]; byte prevblending[2];
} latchedvars_t; } latchedvars_t;
typedef struct typedef struct
{ {
// Time stamp for this movement // Time stamp for this movement
float animtime; float animtime;
vec3_t origin; vec3_t origin;
vec3_t angles; vec3_t angles;
} position_history_t; } position_history_t;
typedef struct cl_entity_s cl_entity_t; typedef struct cl_entity_s cl_entity_t;
#define HISTORY_MAX 64 // Must be power of 2 #define HISTORY_MAX 64 // Must be power of 2
#define HISTORY_MASK ( HISTORY_MAX - 1 ) #define HISTORY_MASK ( HISTORY_MAX - 1 )
#include "entity_state.h" #include "entity_state.h"
#include "event_args.h" #include "event_args.h"
struct cl_entity_s struct cl_entity_s
{ {
int index; // Index into cl_entities ( should match actual slot, but not necessarily ) int index; // Index into cl_entities ( should match actual slot, but not necessarily )
qboolean player; // True if this entity is a "player" qboolean player; // True if this entity is a "player"
entity_state_t baseline; // The original state from which to delta during an uncompressed message entity_state_t baseline; // The original state from which to delta during an uncompressed message
entity_state_t prevstate; // The state information from the penultimate message received from the server entity_state_t prevstate; // The state information from the penultimate message received from the server
entity_state_t curstate; // The state information from the last message received from server entity_state_t curstate; // The state information from the last message received from server
int current_position; // Last received history update index int current_position; // Last received history update index
position_history_t ph[HISTORY_MAX]; // History of position and angle updates for this player position_history_t ph[HISTORY_MAX]; // History of position and angle updates for this player
mouth_t mouth; // For synchronizing mouth movements. mouth_t mouth; // For synchronizing mouth movements.
latchedvars_t latched; // Variables used by studio model rendering routines latchedvars_t latched; // Variables used by studio model rendering routines
// Information based on interplocation, extrapolation, prediction, or just copied from last msg received. // Information based on interplocation, extrapolation, prediction, or just copied from last msg received.
// //
float lastmove; float lastmove;
// Actual render position and angles // Actual render position and angles
vec3_t origin; vec3_t origin;
vec3_t angles; vec3_t angles;
// Attachment points // Attachment points
vec3_t attachment[4]; vec3_t attachment[4];
// Other entity local information // Other entity local information
int trivial_accept; int trivial_accept;
struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model
struct efrag_s *efrag; // linked list of efrags struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
float syncbase; // for client-side animations -- used by obsolete alias animation system, remove? float syncbase; // for client-side animations -- used by obsolete alias animation system, remove?
int visframe; // last frame this entity was found in an active leaf int visframe; // last frame this entity was found in an active leaf
colorVec cvFloorColor; colorVec cvFloorColor;
}; };
#endif//CL_ENTITY_H #endif//CL_ENTITY_H

View File

@ -1,413 +1,413 @@
/* /*
com_model.h - cient model structures com_model.h - cient model structures
Copyright (C) 2010 Uncle Mike Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef COM_MODEL_H #ifndef COM_MODEL_H
#define COM_MODEL_H #define COM_MODEL_H
#include "bspfile.h" // we need some declarations from it #include "bspfile.h" // we need some declarations from it
typedef vec_t vec2_t[2]; typedef vec_t vec2_t[2];
typedef vec_t vec4_t[4]; typedef vec_t vec4_t[4];
/* /*
============================================================================== ==============================================================================
ENGINE MODEL FORMAT ENGINE MODEL FORMAT
============================================================================== ==============================================================================
*/ */
#define STUDIO_RENDER 1 #define STUDIO_RENDER 1
#define STUDIO_EVENTS 2 #define STUDIO_EVENTS 2
#define ZISCALE ((float)0x8000) #define ZISCALE ((float)0x8000)
#define MIPLEVELS 4 #define MIPLEVELS 4
#define VERTEXSIZE 7 #define VERTEXSIZE 7
#define MAXLIGHTMAPS 4 #define MAXLIGHTMAPS 4
#define NUM_AMBIENTS 4 // automatic ambient sounds #define NUM_AMBIENTS 4 // automatic ambient sounds
// model types // model types
typedef enum typedef enum
{ {
mod_bad = -1, mod_bad = -1,
mod_brush, mod_brush,
mod_sprite, mod_sprite,
mod_alias, mod_alias,
mod_studio mod_studio
} modtype_t; } modtype_t;
typedef struct mplane_s typedef struct mplane_s
{ {
vec3_t normal; vec3_t normal;
float dist; float dist;
byte type; // for fast side tests byte type; // for fast side tests
byte signbits; // signx + (signy<<1) + (signz<<1) byte signbits; // signx + (signy<<1) + (signz<<1)
byte pad[2]; byte pad[2];
} mplane_t; } mplane_t;
typedef struct typedef struct
{ {
vec3_t position; vec3_t position;
} mvertex_t; } mvertex_t;
typedef struct typedef struct
{ {
unsigned short v[2]; unsigned short v[2];
unsigned int cachededgeoffset; unsigned int cachededgeoffset;
} medge_t; } medge_t;
typedef struct texture_s typedef struct texture_s
{ {
char name[16]; char name[16];
unsigned int width, height; unsigned int width, height;
int gl_texturenum; int gl_texturenum;
struct msurface_s *texturechain; // for gl_texsort drawing struct msurface_s *texturechain; // for gl_texsort drawing
int anim_total; // total tenths in sequence ( 0 = no) int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned short fb_texturenum; // auto-luma texturenum unsigned short fb_texturenum; // auto-luma texturenum
unsigned short dt_texturenum; // detail-texture binding unsigned short dt_texturenum; // detail-texture binding
unsigned int unused[3]; // reserved unsigned int unused[3]; // reserved
} texture_t; } texture_t;
typedef struct typedef struct
{ {
float vecs[2][4]; // [s/t] unit vectors in world space. float vecs[2][4]; // [s/t] unit vectors in world space.
// [i][3] is the s/t offset relative to the origin. // [i][3] is the s/t offset relative to the origin.
// s or t = dot( 3Dpoint, vecs[i] ) + vecs[i][3] // s or t = dot( 3Dpoint, vecs[i] ) + vecs[i][3]
float mipadjust; // mipmap limits for very small surfaces float mipadjust; // mipmap limits for very small surfaces
texture_t *texture; texture_t *texture;
int flags; // sky or slime, no lightmap or 256 subdivision int flags; // sky or slime, no lightmap or 256 subdivision
} mtexinfo_t; } mtexinfo_t;
// 73 bytes per VBO vertex // 73 bytes per VBO vertex
// FIXME: align to 32 bytes // FIXME: align to 32 bytes
typedef struct glvert_s typedef struct glvert_s
{ {
vec3_t vertex; // position vec3_t vertex; // position
vec3_t normal; // normal vec3_t normal; // normal
vec2_t stcoord; // ST texture coords vec2_t stcoord; // ST texture coords
vec2_t lmcoord; // ST lightmap coords vec2_t lmcoord; // ST lightmap coords
vec2_t sccoord; // ST scissor coords (decals only) - for normalmap coords migration vec2_t sccoord; // ST scissor coords (decals only) - for normalmap coords migration
vec3_t tangent; // tangent vec3_t tangent; // tangent
vec3_t binormal; // binormal vec3_t binormal; // binormal
byte color[4]; // colors per vertex byte color[4]; // colors per vertex
} glvert_t; } glvert_t;
typedef struct glpoly_s typedef struct glpoly_s
{ {
struct glpoly_s *next; struct glpoly_s *next;
struct glpoly_s *chain; struct glpoly_s *chain;
int numverts; int numverts;
int flags; // for SURF_UNDERWATER int flags; // for SURF_UNDERWATER
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2) float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t; } glpoly_t;
typedef struct mnode_s typedef struct mnode_s
{ {
// common with leaf // common with leaf
int contents; // 0, to differentiate from leafs int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling float minmaxs[6]; // for bounding box culling
struct mnode_s *parent; struct mnode_s *parent;
// node specific // node specific
mplane_t *plane; mplane_t *plane;
struct mnode_s *children[2]; struct mnode_s *children[2];
unsigned short firstsurface; unsigned short firstsurface;
unsigned short numsurfaces; unsigned short numsurfaces;
} mnode_t; } mnode_t;
typedef struct msurface_s msurface_t; typedef struct msurface_s msurface_t;
typedef struct decal_s decal_t; typedef struct decal_s decal_t;
// JAY: Compress this as much as possible // JAY: Compress this as much as possible
struct decal_s struct decal_s
{ {
decal_t *pnext; // linked list for each surface decal_t *pnext; // linked list for each surface
msurface_t *psurface; // Surface id for persistence / unlinking msurface_t *psurface; // Surface id for persistence / unlinking
float dx; // local texture coordinates float dx; // local texture coordinates
float dy; // float dy; //
float scale; // Pixel scale float scale; // Pixel scale
short texture; // Decal texture short texture; // Decal texture
byte flags; // Decal flags FDECAL_* byte flags; // Decal flags FDECAL_*
short entityIndex; // Entity this is attached to short entityIndex; // Entity this is attached to
// Xash3D added // Xash3D added
vec3_t position; // location of the decal center in world space. vec3_t position; // location of the decal center in world space.
vec3_t saxis; // direction of the s axis in world space vec3_t saxis; // direction of the s axis in world space
struct msurfmesh_s *mesh; // decal mesh in local space struct msurfmesh_s *mesh; // decal mesh in local space
int reserved[4]; // for future expansions int reserved[4]; // for future expansions
}; };
typedef struct mleaf_s typedef struct mleaf_s
{ {
// common with node // common with node
int contents; int contents;
int visframe; // node needs to be traversed if current int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling float minmaxs[6]; // for bounding box culling
struct mnode_s *parent; struct mnode_s *parent;
// leaf specific // leaf specific
byte *compressed_vis; byte *compressed_vis;
struct efrag_s *efrags; struct efrag_s *efrags;
msurface_t **firstmarksurface; msurface_t **firstmarksurface;
int nummarksurfaces; int nummarksurfaces;
byte *compressed_pas; byte *compressed_pas;
byte ambient_sound_level[NUM_AMBIENTS]; byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t; } mleaf_t;
typedef struct msurface_s typedef struct msurface_s
{ {
int visframe; // should be drawn when node is crossed int visframe; // should be drawn when node is crossed
mplane_t *plane; // pointer to shared plane mplane_t *plane; // pointer to shared plane
int flags; // see SURF_ #defines int flags; // see SURF_ #defines
int firstedge; // look up in model->surfedges[], negative numbers int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges int numedges; // are backwards edges
short texturemins[2]; short texturemins[2];
short extents[2]; short extents[2];
int light_s, light_t; // gl lightmap coordinates int light_s, light_t; // gl lightmap coordinates
glpoly_t *polys; // multiple if warped glpoly_t *polys; // multiple if warped
struct msurface_s *texturechain; struct msurface_s *texturechain;
mtexinfo_t *texinfo; mtexinfo_t *texinfo;
// lighting info // lighting info
int dlightframe; // last frame the surface was checked by an animated light int dlightframe; // last frame the surface was checked by an animated light
int dlightbits; // dynamically generated. Indicates if the surface illumination int dlightbits; // dynamically generated. Indicates if the surface illumination
// is modified by an animated light. // is modified by an animated light.
int lightmaptexturenum; int lightmaptexturenum;
byte styles[MAXLIGHTMAPS]; byte styles[MAXLIGHTMAPS];
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
struct msurface_s *lightmapchain; // for new dlights rendering (was cached_dlight) struct msurface_s *lightmapchain; // for new dlights rendering (was cached_dlight)
color24 *samples; // note: this is the actual lightmap data for this surface color24 *samples; // note: this is the actual lightmap data for this surface
decal_t *pdecals; decal_t *pdecals;
} msurface_t; } msurface_t;
typedef struct msurfmesh_s typedef struct msurfmesh_s
{ {
unsigned short numVerts; unsigned short numVerts;
unsigned short numElems; // ~ 20 000 vertex per one surface. Should be enough unsigned short numElems; // ~ 20 000 vertex per one surface. Should be enough
unsigned int startVert; // user-variable. may be used for construct world single-VBO unsigned int startVert; // user-variable. may be used for construct world single-VBO
unsigned int startElem; // user-variable. may be used for construct world single-VBO unsigned int startElem; // user-variable. may be used for construct world single-VBO
glvert_t *verts; // vertexes array glvert_t *verts; // vertexes array
unsigned short *elems; // indices unsigned short *elems; // indices
struct msurface_s *surf; // pointer to parent surface. Just for consistency struct msurface_s *surf; // pointer to parent surface. Just for consistency
struct msurfmesh_s *next; // temporary chain of subdivided surfaces struct msurfmesh_s *next; // temporary chain of subdivided surfaces
} msurfmesh_t; } msurfmesh_t;
// surface extradata stored in cache.data for all brushmodels // surface extradata stored in cache.data for all brushmodels
typedef struct mextrasurf_s typedef struct mextrasurf_s
{ {
vec3_t mins, maxs; vec3_t mins, maxs;
vec3_t origin; // surface origin vec3_t origin; // surface origin
msurfmesh_t *mesh; // VBO\VA ready surface mesh. Not used by engine but can be used by mod-makers msurfmesh_t *mesh; // VBO\VA ready surface mesh. Not used by engine but can be used by mod-makers
int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps
int mirrortexturenum; // gl texnum int mirrortexturenum; // gl texnum
float mirrormatrix[4][4]; float mirrormatrix[4][4];
struct mextrasurf_s *mirrorchain; // for gl_texsort drawing struct mextrasurf_s *mirrorchain; // for gl_texsort drawing
struct mextrasurf_s *detailchain; // for detail textures drawing struct mextrasurf_s *detailchain; // for detail textures drawing
color24 *deluxemap; // note: this is the actual deluxemap data for this surface color24 *deluxemap; // note: this is the actual deluxemap data for this surface
int reserved[32]; // just for future expansions or mod-makers int reserved[32]; // just for future expansions or mod-makers
} mextrasurf_t; } mextrasurf_t;
typedef struct hull_s typedef struct hull_s
{ {
dclipnode_t *clipnodes; dclipnode_t *clipnodes;
mplane_t *planes; mplane_t *planes;
int firstclipnode; int firstclipnode;
int lastclipnode; int lastclipnode;
vec3_t clip_mins; vec3_t clip_mins;
vec3_t clip_maxs; vec3_t clip_maxs;
} hull_t; } hull_t;
#ifndef CACHE_USER #ifndef CACHE_USER
#define CACHE_USER #define CACHE_USER
typedef struct cache_user_s typedef struct cache_user_s
{ {
void *data; // extradata void *data; // extradata
} cache_user_t; } cache_user_t;
#endif #endif
typedef struct model_s typedef struct model_s
{ {
char name[64]; // model name char name[64]; // model name
qboolean needload; // bmodels and sprites don't cache normally qboolean needload; // bmodels and sprites don't cache normally
// shared modelinfo // shared modelinfo
modtype_t type; // model type modtype_t type; // model type
int numframes; // sprite's framecount int numframes; // sprite's framecount
byte *mempool; // private mempool (was synctype) byte *mempool; // private mempool (was synctype)
int flags; // hl compatibility int flags; // hl compatibility
// //
// volume occupied by the model // volume occupied by the model
// //
vec3_t mins, maxs; // bounding box at angles '0 0 0' vec3_t mins, maxs; // bounding box at angles '0 0 0'
float radius; float radius;
// brush model // brush model
int firstmodelsurface; int firstmodelsurface;
int nummodelsurfaces; int nummodelsurfaces;
int numsubmodels; int numsubmodels;
dmodel_t *submodels; // or studio animations dmodel_t *submodels; // or studio animations
int numplanes; int numplanes;
mplane_t *planes; mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0 int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs; mleaf_t *leafs;
int numvertexes; int numvertexes;
mvertex_t *vertexes; mvertex_t *vertexes;
int numedges; int numedges;
medge_t *edges; medge_t *edges;
int numnodes; int numnodes;
mnode_t *nodes; mnode_t *nodes;
int numtexinfo; int numtexinfo;
mtexinfo_t *texinfo; mtexinfo_t *texinfo;
int numsurfaces; int numsurfaces;
msurface_t *surfaces; msurface_t *surfaces;
int numsurfedges; int numsurfedges;
int *surfedges; int *surfedges;
int numclipnodes; int numclipnodes;
dclipnode_t *clipnodes; dclipnode_t *clipnodes;
int nummarksurfaces; int nummarksurfaces;
msurface_t **marksurfaces; msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS]; hull_t hulls[MAX_MAP_HULLS];
int numtextures; int numtextures;
texture_t **textures; texture_t **textures;
byte *visdata; byte *visdata;
color24 *lightdata; color24 *lightdata;
char *entities; char *entities;
// //
// additional model data // additional model data
// //
cache_user_t cache; // only access through Mod_Extradata cache_user_t cache; // only access through Mod_Extradata
} model_t; } model_t;
typedef struct alight_s typedef struct alight_s
{ {
int ambientlight; // clip at 128 int ambientlight; // clip at 128
int shadelight; // clip at 192 - ambientlight int shadelight; // clip at 192 - ambientlight
vec3_t color; vec3_t color;
float *plightvec; float *plightvec;
} alight_t; } alight_t;
typedef struct auxvert_s typedef struct auxvert_s
{ {
float fv[3]; // viewspace x, y float fv[3]; // viewspace x, y
} auxvert_t; } auxvert_t;
#define MAX_SCOREBOARDNAME 32 #define MAX_SCOREBOARDNAME 32
#define MAX_INFO_STRING 256 #define MAX_INFO_STRING 256
#include "custom.h" #include "custom.h"
typedef struct player_info_s typedef struct player_info_s
{ {
int userid; // User id on server int userid; // User id on server
char userinfo[MAX_INFO_STRING]; // User info string char userinfo[MAX_INFO_STRING]; // User info string
char name[MAX_SCOREBOARDNAME]; // Name (extracted from userinfo) char name[MAX_SCOREBOARDNAME]; // Name (extracted from userinfo)
int spectator; // Spectator or not, unused int spectator; // Spectator or not, unused
int ping; int ping;
int packet_loss; int packet_loss;
// skin information // skin information
char model[64]; char model[64];
int topcolor; int topcolor;
int bottomcolor; int bottomcolor;
// last frame rendered // last frame rendered
int renderframe; int renderframe;
// Gait frame estimation // Gait frame estimation
int gaitsequence; int gaitsequence;
float gaitframe; float gaitframe;
float gaityaw; float gaityaw;
vec3_t prevgaitorigin; vec3_t prevgaitorigin;
customization_t customdata; customization_t customdata;
} player_info_t; } player_info_t;
// //
// sprite representation in memory // sprite representation in memory
// //
typedef enum { SPR_SINGLE = 0, SPR_GROUP, SPR_ANGLED } spriteframetype_t; typedef enum { SPR_SINGLE = 0, SPR_GROUP, SPR_ANGLED } spriteframetype_t;
typedef struct mspriteframe_s typedef struct mspriteframe_s
{ {
int width; int width;
int height; int height;
float up, down, left, right; float up, down, left, right;
int gl_texturenum; int gl_texturenum;
} mspriteframe_t; } mspriteframe_t;
typedef struct typedef struct
{ {
int numframes; int numframes;
float *intervals; float *intervals;
mspriteframe_t *frames[1]; mspriteframe_t *frames[1];
} mspritegroup_t; } mspritegroup_t;
typedef struct typedef struct
{ {
spriteframetype_t type; spriteframetype_t type;
mspriteframe_t *frameptr; mspriteframe_t *frameptr;
} mspriteframedesc_t; } mspriteframedesc_t;
typedef struct typedef struct
{ {
short type; short type;
short texFormat; short texFormat;
int maxwidth; int maxwidth;
int maxheight; int maxheight;
int numframes; int numframes;
int radius; int radius;
int facecull; int facecull;
int synctype; int synctype;
mspriteframedesc_t frames[1]; mspriteframedesc_t frames[1];
} msprite_t; } msprite_t;
#endif//COM_MODEL_H #endif//COM_MODEL_H

View File

@ -1,25 +1,25 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef CON_NPRINT_H #ifndef CON_NPRINT_H
#define CON_NPRINT_H #define CON_NPRINT_H
typedef struct con_nprint_s typedef struct con_nprint_s
{ {
int index; // Row # int index; // Row #
float time_to_live; // # of seconds before it dissappears float time_to_live; // # of seconds before it dissappears
float color[3]; // RGB colors ( 0.0 -> 1.0 scale ) float color[3]; // RGB colors ( 0.0 -> 1.0 scale )
} con_nprint_t; } con_nprint_t;
#endif//CON_NPRINT_H #endif//CON_NPRINT_H

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +1,37 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef CVARDEF_H #ifndef CVARDEF_H
#define CVARDEF_H #define CVARDEF_H
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc #define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
#define FCVAR_USERINFO (1<<1) // changes the client's info string #define FCVAR_USERINFO (1<<1) // changes the client's info string
#define FCVAR_SERVER (1<<2) // notifies players when changed #define FCVAR_SERVER (1<<2) // notifies players when changed
#define FCVAR_EXTDLL (1<<3) // defined by external DLL #define FCVAR_EXTDLL (1<<3) // defined by external DLL
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll #define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value #define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). #define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log #define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
typedef struct cvar_s typedef struct cvar_s
{ {
char *name; char *name;
char *string; char *string;
int flags; int flags;
float value; float value;
struct cvar_s *next; struct cvar_s *next;
} cvar_t; } cvar_t;
#endif//CVARDEF_H #endif//CVARDEF_H

View File

@ -1,27 +1,27 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef DEMO_API_H #ifndef DEMO_API_H
#define DEMO_API_H #define DEMO_API_H
typedef struct demo_api_s typedef struct demo_api_s
{ {
int (*IsRecording)( void ); int (*IsRecording)( void );
int (*IsPlayingback)( void ); int (*IsPlayingback)( void );
int (*IsTimeDemo)( void ); int (*IsTimeDemo)( void );
void (*WriteBuffer)( int size, unsigned char *buffer ); void (*WriteBuffer)( int size, unsigned char *buffer );
} demo_api_t; } demo_api_t;
#endif//DEMO_API_H #endif//DEMO_API_H

View File

@ -1,31 +1,31 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef DLIGHT_H #ifndef DLIGHT_H
#define DLIGHT_H #define DLIGHT_H
typedef struct dlight_s typedef struct dlight_s
{ {
vec3_t origin; vec3_t origin;
float radius; float radius;
color24 color; color24 color;
float die; // stop lighting after this time float die; // stop lighting after this time
float decay; // drop this each second float decay; // drop this each second
float minlight; // don't add when contributing less float minlight; // don't add when contributing less
int key; int key;
qboolean dark; // subtracts light instead of adding qboolean dark; // subtracts light instead of adding
} dlight_t; } dlight_t;
#endif//DLIGHT_H #endif//DLIGHT_H

View File

@ -1,186 +1,186 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef ENTITY_STATE_H #ifndef ENTITY_STATE_H
#define ENTITY_STATE_H #define ENTITY_STATE_H
// For entityType below // For entityType below
#define ENTITY_NORMAL (1<<0) #define ENTITY_NORMAL (1<<0)
#define ENTITY_BEAM (1<<1) #define ENTITY_BEAM (1<<1)
// Entity state is used for the baseline and for delta compression of a packet of // Entity state is used for the baseline and for delta compression of a packet of
// entities that is sent to a client. // entities that is sent to a client.
typedef struct entity_state_s entity_state_t; typedef struct entity_state_s entity_state_t;
struct entity_state_s struct entity_state_s
{ {
// Fields which are filled in by routines outside of delta compression // Fields which are filled in by routines outside of delta compression
int entityType; int entityType;
// Index into cl_entities array for this entity. // Index into cl_entities array for this entity.
int number; int number;
float msg_time; float msg_time;
// Message number last time the player/entity state was updated. // Message number last time the player/entity state was updated.
int messagenum; int messagenum;
// Fields which can be transitted and reconstructed over the network stream // Fields which can be transitted and reconstructed over the network stream
vec3_t origin; vec3_t origin;
vec3_t angles; vec3_t angles;
int modelindex; int modelindex;
int sequence; int sequence;
float frame; float frame;
int colormap; int colormap;
short skin; short skin;
short solid; short solid;
int effects; int effects;
float scale; float scale;
byte eflags; byte eflags;
// Render information // Render information
int rendermode; int rendermode;
int renderamt; int renderamt;
color24 rendercolor; color24 rendercolor;
int renderfx; int renderfx;
int movetype; int movetype;
float animtime; float animtime;
float framerate; float framerate;
int body; int body;
byte controller[4]; byte controller[4];
byte blending[4]; byte blending[4];
vec3_t velocity; vec3_t velocity;
// Send bbox down to client for use during prediction. // Send bbox down to client for use during prediction.
vec3_t mins; vec3_t mins;
vec3_t maxs; vec3_t maxs;
int aiment; int aiment;
// If owned by a player, the index of that player ( for projectiles ). // If owned by a player, the index of that player ( for projectiles ).
int owner; int owner;
// Friction, for prediction. // Friction, for prediction.
float friction; float friction;
// Gravity multiplier // Gravity multiplier
float gravity; float gravity;
// PLAYER SPECIFIC // PLAYER SPECIFIC
int team; int team;
int playerclass; int playerclass;
int health; int health;
qboolean spectator; qboolean spectator;
int weaponmodel; int weaponmodel;
int gaitsequence; int gaitsequence;
// If standing on conveyor, e.g. // If standing on conveyor, e.g.
vec3_t basevelocity; vec3_t basevelocity;
// Use the crouched hull, or the regular player hull. // Use the crouched hull, or the regular player hull.
int usehull; int usehull;
// Latched buttons last time state updated. // Latched buttons last time state updated.
int oldbuttons; int oldbuttons;
// -1 = in air, else pmove entity number // -1 = in air, else pmove entity number
int onground; int onground;
int iStepLeft; int iStepLeft;
// How fast we are falling // How fast we are falling
float flFallVelocity; float flFallVelocity;
float fov; float fov;
int weaponanim; int weaponanim;
// Parametric movement overrides // Parametric movement overrides
vec3_t startpos; vec3_t startpos;
vec3_t endpos; vec3_t endpos;
float impacttime; float impacttime;
float starttime; float starttime;
// For mods // For mods
int iuser1; int iuser1;
int iuser2; int iuser2;
int iuser3; int iuser3;
int iuser4; int iuser4;
float fuser1; float fuser1;
float fuser2; float fuser2;
float fuser3; float fuser3;
float fuser4; float fuser4;
vec3_t vuser1; vec3_t vuser1;
vec3_t vuser2; vec3_t vuser2;
vec3_t vuser3; vec3_t vuser3;
vec3_t vuser4; vec3_t vuser4;
}; };
#include "pm_info.h" #include "pm_info.h"
typedef struct clientdata_s typedef struct clientdata_s
{ {
vec3_t origin; vec3_t origin;
vec3_t velocity; vec3_t velocity;
int viewmodel; int viewmodel;
vec3_t punchangle; vec3_t punchangle;
int flags; int flags;
int waterlevel; int waterlevel;
int watertype; int watertype;
vec3_t view_ofs; vec3_t view_ofs;
float health; float health;
int bInDuck; int bInDuck;
int weapons; // remove? int weapons; // remove?
int flTimeStepSound; int flTimeStepSound;
int flDuckTime; int flDuckTime;
int flSwimTime; int flSwimTime;
int waterjumptime; int waterjumptime;
float maxspeed; float maxspeed;
float fov; float fov;
int weaponanim; int weaponanim;
int m_iId; int m_iId;
int ammo_shells; int ammo_shells;
int ammo_nails; int ammo_nails;
int ammo_cells; int ammo_cells;
int ammo_rockets; int ammo_rockets;
float m_flNextAttack; float m_flNextAttack;
int tfstate; int tfstate;
int pushmsec; int pushmsec;
int deadflag; int deadflag;
char physinfo[MAX_PHYSINFO_STRING]; char physinfo[MAX_PHYSINFO_STRING];
// For mods // For mods
int iuser1; int iuser1;
int iuser2; int iuser2;
int iuser3; int iuser3;
int iuser4; int iuser4;
float fuser1; float fuser1;
float fuser2; float fuser2;
float fuser3; float fuser3;
float fuser4; float fuser4;
vec3_t vuser1; vec3_t vuser1;
vec3_t vuser2; vec3_t vuser2;
vec3_t vuser3; vec3_t vuser3;
vec3_t vuser4; vec3_t vuser4;
} clientdata_t; } clientdata_t;
#include "weaponinfo.h" #include "weaponinfo.h"
typedef struct local_state_s typedef struct local_state_s
{ {
entity_state_t playerstate; entity_state_t playerstate;
clientdata_t client; clientdata_t client;
weapon_data_t weapondata[64]; weapon_data_t weapondata[64];
} local_state_t; } local_state_t;
#endif//ENTITY_STATE_H #endif//ENTITY_STATE_H

View File

@ -1,25 +1,25 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef ENTITY_TYPES_H #ifndef ENTITY_TYPES_H
#define ENTITY_TYPES_H #define ENTITY_TYPES_H
#define ET_NORMAL 0 #define ET_NORMAL 0
#define ET_PLAYER 1 #define ET_PLAYER 1
#define ET_TEMPENTITY 2 #define ET_TEMPENTITY 2
#define ET_BEAM 3 #define ET_BEAM 3
#define ET_FRAGMENTED 4 // BMODEL or SPRITE that was split across BSP nodes #define ET_FRAGMENTED 4 // BMODEL or SPRITE that was split across BSP nodes
#endif//ENTITY_TYPES_H #endif//ENTITY_TYPES_H

View File

@ -1,54 +1,54 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef EVENT_API_H #ifndef EVENT_API_H
#define EVENT_API_H #define EVENT_API_H
#define EVENT_API_VERSION 1 #define EVENT_API_VERSION 1
typedef struct event_api_s typedef struct event_api_s
{ {
int version; int version;
void ( *EV_PlaySound )( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ); void ( *EV_PlaySound )( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch );
void ( *EV_StopSound )( int ent, int channel, const char *sample ); void ( *EV_StopSound )( int ent, int channel, const char *sample );
int ( *EV_FindModelIndex )( const char *pmodel ); int ( *EV_FindModelIndex )( const char *pmodel );
int ( *EV_IsLocal )( int playernum ); int ( *EV_IsLocal )( int playernum );
int ( *EV_LocalPlayerDucking )( void ); int ( *EV_LocalPlayerDucking )( void );
void ( *EV_LocalPlayerViewheight )( float * ); void ( *EV_LocalPlayerViewheight )( float * );
void ( *EV_LocalPlayerBounds )( int hull, float *mins, float *maxs ); void ( *EV_LocalPlayerBounds )( int hull, float *mins, float *maxs );
int ( *EV_IndexFromTrace)( struct pmtrace_s *pTrace ); int ( *EV_IndexFromTrace)( struct pmtrace_s *pTrace );
struct physent_s *( *EV_GetPhysent )( int idx ); struct physent_s *( *EV_GetPhysent )( int idx );
void ( *EV_SetUpPlayerPrediction )( int dopred, int bIncludeLocalClient ); void ( *EV_SetUpPlayerPrediction )( int dopred, int bIncludeLocalClient );
void ( *EV_PushPMStates )( void ); void ( *EV_PushPMStates )( void );
void ( *EV_PopPMStates )( void ); void ( *EV_PopPMStates )( void );
void ( *EV_SetSolidPlayers )( int playernum ); void ( *EV_SetSolidPlayers )( int playernum );
void ( *EV_SetTraceHull )( int hull ); void ( *EV_SetTraceHull )( int hull );
void ( *EV_PlayerTrace )( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr ); void ( *EV_PlayerTrace )( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr );
void ( *EV_WeaponAnimation )( int sequence, int body ); void ( *EV_WeaponAnimation )( int sequence, int body );
unsigned short ( *EV_PrecacheEvent )( int type, const char* psz ); unsigned short ( *EV_PrecacheEvent )( int type, const char* psz );
void ( *EV_PlaybackEvent )( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void ( *EV_PlaybackEvent )( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
const char *( *EV_TraceTexture )( int ground, float *vstart, float *vend ); const char *( *EV_TraceTexture )( int ground, float *vstart, float *vend );
void ( *EV_StopAllSounds )( int entnum, int entchannel ); void ( *EV_StopAllSounds )( int entnum, int entchannel );
void ( *EV_KillEvents )( int entnum, const char *eventname ); void ( *EV_KillEvents )( int entnum, const char *eventname );
// Xash3D extension // Xash3D extension
unsigned short (*EV_IndexForEvent)( const char *name ); unsigned short (*EV_IndexForEvent)( const char *name );
const char *(*EV_EventForIndex)( unsigned short index ); const char *(*EV_EventForIndex)( unsigned short index );
void ( *EV_PlayerTraceExt )( float *start, float *end, int traceFlags, int (*pfnIgnore)( struct physent_s *pe ), struct pmtrace_s *tr ); void ( *EV_PlayerTraceExt )( float *start, float *end, int traceFlags, int (*pfnIgnore)( struct physent_s *pe ), struct pmtrace_s *tr );
const char *(*EV_SoundForIndex)( int index ); const char *(*EV_SoundForIndex)( int index );
struct msurface_s *( *EV_TraceSurface )( int ground, float *vstart, float *vend ); struct msurface_s *( *EV_TraceSurface )( int ground, float *vstart, float *vend );
} event_api_t; } event_api_t;
#endif//EVENT_API_H #endif//EVENT_API_H

View File

@ -1,47 +1,47 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef EVENT_ARGS_H #ifndef EVENT_ARGS_H
#define EVENT_ARGS_H #define EVENT_ARGS_H
// Event was invoked with stated origin // Event was invoked with stated origin
#define FEVENT_ORIGIN ( 1<<0 ) #define FEVENT_ORIGIN ( 1<<0 )
// Event was invoked with stated angles // Event was invoked with stated angles
#define FEVENT_ANGLES ( 1<<1 ) #define FEVENT_ANGLES ( 1<<1 )
typedef struct event_args_s typedef struct event_args_s
{ {
int flags; int flags;
// Transmitted // Transmitted
int entindex; int entindex;
float origin[3]; float origin[3];
float angles[3]; float angles[3];
float velocity[3]; float velocity[3];
int ducking; int ducking;
float fparam1; float fparam1;
float fparam2; float fparam2;
int iparam1; int iparam1;
int iparam2; int iparam2;
int bparam1; int bparam1;
int bparam2; int bparam2;
} event_args_t; } event_args_t;
#endif//EVENT_ARGS_H #endif//EVENT_ARGS_H

View File

@ -1,45 +1,45 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef EVENT_FLAGS_H #ifndef EVENT_FLAGS_H
#define EVENT_FLAGS_H #define EVENT_FLAGS_H
// Skip local host for event send. // Skip local host for event send.
#define FEV_NOTHOST (1<<0) #define FEV_NOTHOST (1<<0)
// Send the event reliably. You must specify the origin and angles and use // Send the event reliably. You must specify the origin and angles and use
// PLAYBACK_EVENT_FULL for this to work correctly on the server for anything // PLAYBACK_EVENT_FULL for this to work correctly on the server for anything
// that depends on the event origin/angles. I.e., the origin/angles are not // that depends on the event origin/angles. I.e., the origin/angles are not
// taken from the invoking edict for reliable events. // taken from the invoking edict for reliable events.
#define FEV_RELIABLE (1<<1) #define FEV_RELIABLE (1<<1)
// Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC
// sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ).
#define FEV_GLOBAL (1<<2) #define FEV_GLOBAL (1<<2)
// If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate
// //
#define FEV_UPDATE (1<<3) #define FEV_UPDATE (1<<3)
// Only send to entity specified as the invoker // Only send to entity specified as the invoker
#define FEV_HOSTONLY (1<<4) #define FEV_HOSTONLY (1<<4)
// Only send if the event was created on the server. // Only send if the event was created on the server.
#define FEV_SERVER (1<<5) #define FEV_SERVER (1<<5)
// Only issue event client side ( from shared code ) // Only issue event client side ( from shared code )
#define FEV_CLIENT (1<<6) #define FEV_CLIENT (1<<6)
#endif//EVENT_FLAGS_H #endif//EVENT_FLAGS_H

View File

@ -1,49 +1,49 @@
/* /*
gameinfo.h - current game info gameinfo.h - current game info
Copyright (C) 2010 Uncle Mike Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef GAMEINFO_H #ifndef GAMEINFO_H
#define GAMEINFO_H #define GAMEINFO_H
#define GFL_NOMODELS (1<<0) #define GFL_NOMODELS (1<<0)
/* /*
======================================================================== ========================================================================
GAMEINFO stuff GAMEINFO stuff
internal shared gameinfo structure (readonly for engine parts) internal shared gameinfo structure (readonly for engine parts)
======================================================================== ========================================================================
*/ */
typedef struct typedef struct
{ {
// filesystem info // filesystem info
char gamefolder[64]; // used for change game '-game x' char gamefolder[64]; // used for change game '-game x'
char startmap[64]; // map to start singleplayer game char startmap[64]; // map to start singleplayer game
char trainmap[64]; // map to start hazard course (if specified) char trainmap[64]; // map to start hazard course (if specified)
char title[64]; // Game Main Title char title[64]; // Game Main Title
char version[14]; // game version (optional) char version[14]; // game version (optional)
short flags; // game flags short flags; // game flags
// about mod info // about mod info
char game_url[256]; // link to a developer's site char game_url[256]; // link to a developer's site
char update_url[256]; // link to updates page char update_url[256]; // link to updates page
char type[64]; // single, toolkit, multiplayer etc char type[64]; // single, toolkit, multiplayer etc
char date[64]; char date[64];
char size[64]; // displayed mod size char size[64]; // displayed mod size
int gamemode; int gamemode;
} GAMEINFO; } GAMEINFO;
#endif//GAMEINFO_H #endif//GAMEINFO_H

View File

@ -1,59 +1,59 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef HLTV_H #ifndef HLTV_H
#define HLTV_H #define HLTV_H
#define TYPE_CLIENT 0 // client is a normal HL client (default) #define TYPE_CLIENT 0 // client is a normal HL client (default)
#define TYPE_PROXY 1 // client is another proxy #define TYPE_PROXY 1 // client is another proxy
#define TYPE_COMMENTATOR 3 // client is a commentator #define TYPE_COMMENTATOR 3 // client is a commentator
#define TYPE_DEMO 4 // client is a demo file #define TYPE_DEMO 4 // client is a demo file
// sub commands of svc_hltv: // sub commands of svc_hltv:
#define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands #define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands
#define HLTV_STATUS 1 // send status infos about proxy #define HLTV_STATUS 1 // send status infos about proxy
#define HLTV_LISTEN 2 // tell client to listen to a multicast stream #define HLTV_LISTEN 2 // tell client to listen to a multicast stream
// sub commands of svc_director: // sub commands of svc_director:
#define DRC_CMD_NONE 0 // NULL director command #define DRC_CMD_NONE 0 // NULL director command
#define DRC_CMD_START 1 // start director mode #define DRC_CMD_START 1 // start director mode
#define DRC_CMD_EVENT 2 // informs about director command #define DRC_CMD_EVENT 2 // informs about director command
#define DRC_CMD_MODE 3 // switches camera modes #define DRC_CMD_MODE 3 // switches camera modes
#define DRC_CMD_CAMERA 4 // sets camera registers #define DRC_CMD_CAMERA 4 // sets camera registers
#define DRC_CMD_TIMESCALE 5 // sets time scale #define DRC_CMD_TIMESCALE 5 // sets time scale
#define DRC_CMD_MESSAGE 6 // send HUD centerprint #define DRC_CMD_MESSAGE 6 // send HUD centerprint
#define DRC_CMD_SOUND 7 // plays a particular sound #define DRC_CMD_SOUND 7 // plays a particular sound
#define DRC_CMD_STATUS 8 // status info about broadcast #define DRC_CMD_STATUS 8 // status info about broadcast
#define DRC_CMD_BANNER 9 // banner file name for HLTV gui #define DRC_CMD_BANNER 9 // banner file name for HLTV gui
#define DRC_CMD_FADE 10 // send screen fade command #define DRC_CMD_FADE 10 // send screen fade command
#define DRC_CMD_SHAKE 11 // send screen shake command #define DRC_CMD_SHAKE 11 // send screen shake command
#define DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command #define DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command
#define DRC_CMD_LAST 12 #define DRC_CMD_LAST 12
// HLTV_EVENT event flags // HLTV_EVENT event flags
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important) #define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4) // #define DRC_FLAG_SIDE (1<<4) //
#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene #define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo #define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc) #define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)
#define DRC_FLAG_INTRO (1<<8) // is a introduction scene #define DRC_FLAG_INTRO (1<<8) // is a introduction scene
#define DRC_FLAG_FINAL (1<<9) // is a final scene #define DRC_FLAG_FINAL (1<<9) // is a final scene
#define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data #define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
#define MAX_DIRECTOR_CMD_PARAMETERS 4 #define MAX_DIRECTOR_CMD_PARAMETERS 4
#define MAX_DIRECTOR_CMD_STRING 128 #define MAX_DIRECTOR_CMD_STRING 128
#endif//HLTV_H #endif//HLTV_H

View File

@ -1,40 +1,40 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef IVOICETWEAK_H #ifndef IVOICETWEAK_H
#define IVOICETWEAK_H #define IVOICETWEAK_H
// These provide access to the voice controls. // These provide access to the voice controls.
typedef enum typedef enum
{ {
MicrophoneVolume = 0, // values 0-1. MicrophoneVolume = 0, // values 0-1.
OtherSpeakerScale // values 0-1. Scales how loud other players are. OtherSpeakerScale // values 0-1. Scales how loud other players are.
} VoiceTweakControl; } VoiceTweakControl;
typedef struct IVoiceTweak_s typedef struct IVoiceTweak_s
{ {
// These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back // These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back
// without sending to the server. // without sending to the server.
int (*StartVoiceTweakMode)( void ); // Returns 0 on error. int (*StartVoiceTweakMode)( void ); // Returns 0 on error.
void (*EndVoiceTweakMode)( void ); void (*EndVoiceTweakMode)( void );
// Get/set control values. // Get/set control values.
void (*SetControlFloat)( VoiceTweakControl iControl, float value ); void (*SetControlFloat)( VoiceTweakControl iControl, float value );
float (*GetControlFloat)( VoiceTweakControl iControl ); float (*GetControlFloat)( VoiceTweakControl iControl );
int (*GetSpeakingVolume)( void ); int (*GetSpeakingVolume)( void );
} IVoiceTweak; } IVoiceTweak;
#endif//IVOICETWEAK_H #endif//IVOICETWEAK_H

View File

@ -1,29 +1,29 @@
/* /*
lightstyle.h - lighstyle description lightstyle.h - lighstyle description
Copyright (C) 2011 Uncle Mike Copyright (C) 2011 Uncle Mike
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef LIGHTSTYLE_H #ifndef LIGHTSTYLE_H
#define LIGHTSTYLE_H #define LIGHTSTYLE_H
typedef struct typedef struct
{ {
char pattern[256]; char pattern[256];
float map[256]; float map[256];
int length; int length;
float value; float value;
qboolean interp; // allow to interpolate this lightstyle qboolean interp; // allow to interpolate this lightstyle
float time; // local time is gurantee what new style begins from the start, not mid or end of the sequence float time; // local time is gurantee what new style begins from the start, not mid or end of the sequence
} lightstyle_t; } lightstyle_t;
#endif//LIGHTSTYLE_H #endif//LIGHTSTYLE_H

View File

@ -1,95 +1,95 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
// mathlib.h // mathlib.h
#include <math.h> #include <math.h>
typedef float vec_t; typedef float vec_t;
typedef vec_t vec2_t[2]; typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3]; typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4]; // x,y,z,w typedef vec_t vec4_t[4]; // x,y,z,w
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif #endif
struct mplane_s; struct mplane_s;
extern vec3_t vec3_origin; extern vec3_t vec3_origin;
extern int nanmask; extern int nanmask;
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
#ifndef VECTOR_H #ifndef VECTOR_H
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
#endif #endif
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;} #define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;}
void VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc); void VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc);
vec_t _DotProduct (vec3_t v1, vec3_t v2); vec_t _DotProduct (vec3_t v1, vec3_t v2);
void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorCopy (vec3_t in, vec3_t out); void _VectorCopy (vec3_t in, vec3_t out);
int VectorCompare (const vec3_t v1, const vec3_t v2); int VectorCompare (const vec3_t v1, const vec3_t v2);
float Length (const vec3_t v); float Length (const vec3_t v);
void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross); void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross);
float VectorNormalize (vec3_t v); // returns vector length float VectorNormalize (vec3_t v); // returns vector length
void VectorInverse (vec3_t v); void VectorInverse (vec3_t v);
void VectorScale (const vec3_t in, vec_t scale, vec3_t out); void VectorScale (const vec3_t in, vec_t scale, vec3_t out);
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
void AngleVectorsTranspose (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); void AngleVectorsTranspose (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
#define AngleIVectors AngleVectorsTranspose #define AngleIVectors AngleVectorsTranspose
void AngleMatrix (const vec3_t angles, float (*matrix)[4] ); void AngleMatrix (const vec3_t angles, float (*matrix)[4] );
void AngleIMatrix (const vec3_t angles, float (*matrix)[4] ); void AngleIMatrix (const vec3_t angles, float (*matrix)[4] );
void VectorTransform (const vec3_t in1, float in2[3][4], vec3_t out); void VectorTransform (const vec3_t in1, float in2[3][4], vec3_t out);
void NormalizeAngles( vec3_t angles ); void NormalizeAngles( vec3_t angles );
void InterpolateAngles( vec3_t start, vec3_t end, vec3_t output, float frac ); void InterpolateAngles( vec3_t start, vec3_t end, vec3_t output, float frac );
float AngleBetweenVectors( const vec3_t v1, const vec3_t v2 ); float AngleBetweenVectors( const vec3_t v1, const vec3_t v2 );
void VectorMatrix( vec3_t forward, vec3_t right, vec3_t up); void VectorMatrix( vec3_t forward, vec3_t right, vec3_t up);
void VectorAngles( const vec3_t forward, vec3_t angles ); void VectorAngles( const vec3_t forward, vec3_t angles );
int InvertMatrix( const float * m, float *out ); int InvertMatrix( const float * m, float *out );
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
float anglemod(float a); float anglemod(float a);
#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \
(((p)->type < 3)? \ (((p)->type < 3)? \
( \ ( \
((p)->dist <= (emins)[(p)->type])? \ ((p)->dist <= (emins)[(p)->type])? \
1 \ 1 \
: \ : \
( \ ( \
((p)->dist >= (emaxs)[(p)->type])?\ ((p)->dist >= (emaxs)[(p)->type])?\
2 \ 2 \
: \ : \
3 \ 3 \
) \ ) \
) \ ) \
: \ : \
BoxOnPlaneSide( (emins), (emaxs), (p))) BoxOnPlaneSide( (emins), (emaxs), (p)))

View File

@ -1,97 +1,97 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef NET_API_H #ifndef NET_API_H
#define NET_API_H #define NET_API_H
#include "netadr.h" #include "netadr.h"
#define NETAPI_REQUEST_SERVERLIST ( 0 ) // Doesn't need a remote address #define NETAPI_REQUEST_SERVERLIST ( 0 ) // Doesn't need a remote address
#define NETAPI_REQUEST_PING ( 1 ) #define NETAPI_REQUEST_PING ( 1 )
#define NETAPI_REQUEST_RULES ( 2 ) #define NETAPI_REQUEST_RULES ( 2 )
#define NETAPI_REQUEST_PLAYERS ( 3 ) #define NETAPI_REQUEST_PLAYERS ( 3 )
#define NETAPI_REQUEST_DETAILS ( 4 ) #define NETAPI_REQUEST_DETAILS ( 4 )
// Set this flag for things like broadcast requests, etc. where the engine should not // Set this flag for things like broadcast requests, etc. where the engine should not
// kill the request hook after receiving the first response // kill the request hook after receiving the first response
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 ) #define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
typedef void (*net_api_response_func_t) ( struct net_response_s *response ); typedef void (*net_api_response_func_t) ( struct net_response_s *response );
#define NET_SUCCESS ( 0 ) #define NET_SUCCESS ( 0 )
#define NET_ERROR_TIMEOUT ( 1<<0 ) #define NET_ERROR_TIMEOUT ( 1<<0 )
#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 ) #define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 )
#define NET_ERROR_UNDEFINED ( 1<<2 ) #define NET_ERROR_UNDEFINED ( 1<<2 )
typedef struct net_adrlist_s typedef struct net_adrlist_s
{ {
struct net_adrlist_s *next; struct net_adrlist_s *next;
netadr_t remote_address; netadr_t remote_address;
} net_adrlist_t; } net_adrlist_t;
typedef struct net_response_s typedef struct net_response_s
{ {
// NET_SUCCESS or an error code // NET_SUCCESS or an error code
int error; int error;
// Context ID // Context ID
int context; int context;
// Type // Type
int type; int type;
// Server that is responding to the request // Server that is responding to the request
netadr_t remote_address; netadr_t remote_address;
// Response RTT ping time // Response RTT ping time
double ping; double ping;
// Key/Value pair string ( separated by backlash \ characters ) // Key/Value pair string ( separated by backlash \ characters )
// WARNING: You must copy this buffer in the callback function, because it is freed // WARNING: You must copy this buffer in the callback function, because it is freed
// by the engine right after the call!!!! // by the engine right after the call!!!!
// ALSO: For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's // ALSO: For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's
void *response; void *response;
} net_response_t; } net_response_t;
typedef struct net_status_s typedef struct net_status_s
{ {
// Connected to remote server? 1 == yes, 0 otherwise // Connected to remote server? 1 == yes, 0 otherwise
int connected; int connected;
// Client's IP address // Client's IP address
netadr_t local_address; netadr_t local_address;
// Address of remote server // Address of remote server
netadr_t remote_address; netadr_t remote_address;
// Packet Loss ( as a percentage ) // Packet Loss ( as a percentage )
int packet_loss; int packet_loss;
// Latency, in seconds ( multiply by 1000.0 to get milliseconds ) // Latency, in seconds ( multiply by 1000.0 to get milliseconds )
double latency; double latency;
// Connection time, in seconds // Connection time, in seconds
double connection_time; double connection_time;
// Rate setting ( for incoming data ) // Rate setting ( for incoming data )
double rate; double rate;
} net_status_t; } net_status_t;
typedef struct net_api_s typedef struct net_api_s
{ {
// APIs // APIs
void (*InitNetworking)( void ); void (*InitNetworking)( void );
void (*Status )( struct net_status_s *status ); void (*Status )( struct net_status_s *status );
void (*SendRequest)( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response ); void (*SendRequest)( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );
void (*CancelRequest)( int context ); void (*CancelRequest)( int context );
void (*CancelAllRequests)( void ); void (*CancelAllRequests)( void );
char *(*AdrToString)( struct netadr_s *a ); char *(*AdrToString)( struct netadr_s *a );
int ( *CompareAdr)( struct netadr_s *a, struct netadr_s *b ); int ( *CompareAdr)( struct netadr_s *a, struct netadr_s *b );
int ( *StringToAdr)( char *s, struct netadr_s *a ); int ( *StringToAdr)( char *s, struct netadr_s *a );
const char *(*ValueForKey)( const char *s, const char *key ); const char *(*ValueForKey)( const char *s, const char *key );
void (*RemoveKey)( char *s, const char *key ); void (*RemoveKey)( char *s, const char *key );
void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize ); void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize );
} net_api_t; } net_api_t;
#endif//NET_APIH #endif//NET_APIH

View File

@ -1,37 +1,37 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef NETADR_H #ifndef NETADR_H
#define NETADR_H #define NETADR_H
typedef enum typedef enum
{ {
NA_UNUSED, NA_UNUSED,
NA_LOOPBACK, NA_LOOPBACK,
NA_BROADCAST, NA_BROADCAST,
NA_IP, NA_IP,
NA_IPX, NA_IPX,
NA_BROADCAST_IPX NA_BROADCAST_IPX
} netadrtype_t; } netadrtype_t;
typedef struct netadr_s typedef struct netadr_s
{ {
netadrtype_t type; netadrtype_t type;
unsigned char ip[4]; unsigned char ip[4];
unsigned char ipx[10]; unsigned char ipx[10];
unsigned short port; unsigned short port;
} netadr_t; } netadr_t;
#endif//NETADR_H #endif//NETADR_H

View File

@ -1,54 +1,54 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef PARTICLEDEF_H #ifndef PARTICLEDEF_H
#define PARTICLEDEF_H #define PARTICLEDEF_H
typedef enum typedef enum
{ {
pt_static, pt_static,
pt_grav, pt_grav,
pt_slowgrav, pt_slowgrav,
pt_fire, pt_fire,
pt_explode, pt_explode,
pt_explode2, pt_explode2,
pt_blob, pt_blob,
pt_blob2, pt_blob2,
pt_vox_slowgrav, pt_vox_slowgrav,
pt_vox_grav, pt_vox_grav,
pt_clientcustom, // Must have callback function specified pt_clientcustom, // Must have callback function specified
pt_tracer // Always have callback pt_tracer // Always have callback
} ptype_t; } ptype_t;
typedef struct particle_s typedef struct particle_s
{ {
vec3_t org; vec3_t org;
short color; short color;
short packedColor; short packedColor;
struct particle_s *next; struct particle_s *next;
vec3_t vel; vec3_t vel;
float ramp; float ramp;
float die; float die;
ptype_t type; ptype_t type;
void (*deathfunc)( struct particle_s *particle ); void (*deathfunc)( struct particle_s *particle );
// for pt_clientcusttom, we'll call this function each frame // for pt_clientcusttom, we'll call this function each frame
void (*callback)( struct particle_s *particle, float frametime ); void (*callback)( struct particle_s *particle, float frametime );
// For deathfunc, etc. // For deathfunc, etc.
unsigned char context; unsigned char context;
} particle_t; } particle_t;
#endif//PARTICLEDEF_H #endif//PARTICLEDEF_H

View File

@ -1,41 +1,41 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef PM_TRACE_H #ifndef PM_TRACE_H
#define PM_TRACE_H #define PM_TRACE_H
typedef struct typedef struct
{ {
vec3_t normal; vec3_t normal;
float dist; float dist;
} pmplane_t; } pmplane_t;
typedef struct pmtrace_s pmtrace_t; typedef struct pmtrace_s pmtrace_t;
struct pmtrace_s struct pmtrace_s
{ {
qboolean allsolid; // if true, plane is not valid qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater; // End point is in empty space or in water qboolean inopen, inwater; // End point is in empty space or in water
float fraction; // time completed, 1.0 = didn't hit anything float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact pmplane_t plane; // surface normal at impact
int ent; // entity at impact int ent; // entity at impact
vec3_t deltavelocity; // Change in player's velocity caused by impact. vec3_t deltavelocity; // Change in player's velocity caused by impact.
// Only run on server. // Only run on server.
int hitgroup; int hitgroup;
}; };
#endif//PM_TRACE_H #endif//PM_TRACE_H

View File

@ -1,38 +1,38 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef QFONT_H #ifndef QFONT_H
#define QFONT_H #define QFONT_H
// Font stuff // Font stuff
#define NUM_GLYPHS 256 #define NUM_GLYPHS 256
typedef struct typedef struct
{ {
short startoffset; short startoffset;
short charwidth; short charwidth;
} charinfo; } charinfo;
typedef struct qfont_s typedef struct qfont_s
{ {
int width, height; int width, height;
int rowcount; int rowcount;
int rowheight; int rowheight;
charinfo fontinfo[NUM_GLYPHS]; charinfo fontinfo[NUM_GLYPHS];
byte data[4]; byte data[4];
} qfont_t; } qfont_t;
#endif//QFONT_H #endif//QFONT_H

View File

@ -1,195 +1,195 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef R_EFX_H #ifndef R_EFX_H
#define R_EFX_H #define R_EFX_H
// particle_t // particle_t
#if !defined( PARTICLEDEFH ) #if !defined( PARTICLEDEFH )
#include "particledef.h" #include "particledef.h"
#endif #endif
// BEAM // BEAM
#if !defined( BEAMDEFH ) #if !defined( BEAMDEFH )
#include "beamdef.h" #include "beamdef.h"
#endif #endif
// dlight_t // dlight_t
#if !defined ( DLIGHTH ) #if !defined ( DLIGHTH )
#include "dlight.h" #include "dlight.h"
#endif #endif
// cl_entity_t // cl_entity_t
#if !defined( CL_ENTITYH ) #if !defined( CL_ENTITYH )
#include "cl_entity.h" #include "cl_entity.h"
#endif #endif
/* /*
// FOR REFERENCE, These are the built-in tracer colors. Note, color 4 is the one // FOR REFERENCE, These are the built-in tracer colors. Note, color 4 is the one
// that uses the tracerred/tracergreen/tracerblue and traceralpha cvar settings // that uses the tracerred/tracergreen/tracerblue and traceralpha cvar settings
color24 gTracerColors[] = color24 gTracerColors[] =
{ {
{ 255, 255, 255 }, // White { 255, 255, 255 }, // White
{ 255, 0, 0 }, // Red { 255, 0, 0 }, // Red
{ 0, 255, 0 }, // Green { 0, 255, 0 }, // Green
{ 0, 0, 255 }, // Blue { 0, 0, 255 }, // Blue
{ 0, 0, 0 }, // Tracer default, filled in from cvars, etc. { 0, 0, 0 }, // Tracer default, filled in from cvars, etc.
{ 255, 167, 17 }, // Yellow-orange sparks { 255, 167, 17 }, // Yellow-orange sparks
{ 255, 130, 90 }, // Yellowish streaks (garg) { 255, 130, 90 }, // Yellowish streaks (garg)
{ 55, 60, 144 }, // Blue egon streak { 55, 60, 144 }, // Blue egon streak
{ 255, 130, 90 }, // More Yellowish streaks (garg) { 255, 130, 90 }, // More Yellowish streaks (garg)
{ 255, 140, 90 }, // More Yellowish streaks (garg) { 255, 140, 90 }, // More Yellowish streaks (garg)
{ 200, 130, 90 }, // More red streaks (garg) { 200, 130, 90 }, // More red streaks (garg)
{ 255, 120, 70 }, // Darker red streaks (garg) { 255, 120, 70 }, // Darker red streaks (garg)
}; };
*/ */
// Temporary entity array // Temporary entity array
#define TENTPRIORITY_LOW 0 #define TENTPRIORITY_LOW 0
#define TENTPRIORITY_HIGH 1 #define TENTPRIORITY_HIGH 1
// TEMPENTITY flags // TEMPENTITY flags
#define FTENT_NONE 0x00000000 #define FTENT_NONE 0x00000000
#define FTENT_SINEWAVE 0x00000001 #define FTENT_SINEWAVE 0x00000001
#define FTENT_GRAVITY 0x00000002 #define FTENT_GRAVITY 0x00000002
#define FTENT_ROTATE 0x00000004 #define FTENT_ROTATE 0x00000004
#define FTENT_SLOWGRAVITY 0x00000008 #define FTENT_SLOWGRAVITY 0x00000008
#define FTENT_SMOKETRAIL 0x00000010 #define FTENT_SMOKETRAIL 0x00000010
#define FTENT_COLLIDEWORLD 0x00000020 #define FTENT_COLLIDEWORLD 0x00000020
#define FTENT_FLICKER 0x00000040 #define FTENT_FLICKER 0x00000040
#define FTENT_FADEOUT 0x00000080 #define FTENT_FADEOUT 0x00000080
#define FTENT_SPRANIMATE 0x00000100 #define FTENT_SPRANIMATE 0x00000100
#define FTENT_HITSOUND 0x00000200 #define FTENT_HITSOUND 0x00000200
#define FTENT_SPIRAL 0x00000400 #define FTENT_SPIRAL 0x00000400
#define FTENT_SPRCYCLE 0x00000800 #define FTENT_SPRCYCLE 0x00000800
#define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes #define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes
#define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw #define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw
#define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything #define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything
#define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner) #define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner)
#define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed #define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed
#define FTENT_SPARKSHOWER 0x00020000 #define FTENT_SPARKSHOWER 0x00020000
#define FTENT_NOMODEL 0x00040000 // Doesn't have a model, never try to draw ( it just triggers other things ) #define FTENT_NOMODEL 0x00040000 // Doesn't have a model, never try to draw ( it just triggers other things )
#define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things ) #define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )
#define FTENT_SCALE 0x00100000 // An experiment #define FTENT_SCALE 0x00100000 // An experiment
typedef struct tempent_s TEMPENTITY; typedef struct tempent_s TEMPENTITY;
typedef struct tempent_s typedef struct tempent_s
{ {
int flags; int flags;
float die; float die;
float frameMax; float frameMax;
float x; float x;
float y; float y;
float z; float z;
float fadeSpeed; float fadeSpeed;
float bounceFactor; float bounceFactor;
int hitSound; int hitSound;
void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ); void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr );
void (*callback)( struct tempent_s *ent, float frametime, float currenttime ); void (*callback)( struct tempent_s *ent, float frametime, float currenttime );
TEMPENTITY *next; TEMPENTITY *next;
int priority; int priority;
short clientIndex; // if attached, this is the index of the client to stick to short clientIndex; // if attached, this is the index of the client to stick to
// if COLLIDEALL, this is the index of the client to ignore // if COLLIDEALL, this is the index of the client to ignore
// TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex! // TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex!
vec3_t tentOffset; // if attached, client origin + tentOffset = tent origin. vec3_t tentOffset; // if attached, client origin + tentOffset = tent origin.
cl_entity_t entity; cl_entity_t entity;
// baseline.origin - velocity // baseline.origin - velocity
// baseline.renderamt - starting fadeout intensity // baseline.renderamt - starting fadeout intensity
// baseline.angles - angle velocity // baseline.angles - angle velocity
} TEMPENTITY; } TEMPENTITY;
typedef struct efx_api_s efx_api_t; typedef struct efx_api_s efx_api_t;
struct efx_api_s struct efx_api_s
{ {
particle_t *(*R_AllocParticle)( void (*callback)( struct particle_s *particle, float frametime )); particle_t *(*R_AllocParticle)( void (*callback)( struct particle_s *particle, float frametime ));
void (*R_BlobExplosion)( float *org ); void (*R_BlobExplosion)( float *org );
void (*R_Blood)( float *org, float *dir, int pcolor, int speed ); void (*R_Blood)( float *org, float *dir, int pcolor, int speed );
void (*R_BloodSprite)( float *org, int colorindex, int modelIndex, int modelIndex2, float size ); void (*R_BloodSprite)( float *org, int colorindex, int modelIndex, int modelIndex2, float size );
void (*R_BloodStream)( float *org, float *dir, int pcolor, int speed ); void (*R_BloodStream)( float *org, float *dir, int pcolor, int speed );
void (*R_BreakModel)( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags ); void (*R_BreakModel)( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags );
void (*R_Bubbles)( float *mins, float *maxs, float height, int modelIndex, int count, float speed ); void (*R_Bubbles)( float *mins, float *maxs, float height, int modelIndex, int count, float speed );
void (*R_BubbleTrail)( float *start, float *end, float height, int modelIndex, int count, float speed ); void (*R_BubbleTrail)( float *start, float *end, float height, int modelIndex, int count, float speed );
void (*R_BulletImpactParticles)( float *pos ); void (*R_BulletImpactParticles)( float *pos );
void (*R_EntityParticles)( struct cl_entity_s *ent ); void (*R_EntityParticles)( struct cl_entity_s *ent );
void (*R_Explosion)( float *pos, int model, float scale, float framerate, int flags ); void (*R_Explosion)( float *pos, int model, float scale, float framerate, int flags );
void (*R_FizzEffect)( struct cl_entity_s *pent, int modelIndex, int density ); void (*R_FizzEffect)( struct cl_entity_s *pent, int modelIndex, int density );
void (*R_FireField)( float *org, int radius, int modelIndex, int count, int flags, float life ); void (*R_FireField)( float *org, int radius, int modelIndex, int count, int flags, float life );
void (*R_FlickerParticles)( float *org ); void (*R_FlickerParticles)( float *org );
void (*R_FunnelSprite)( float *org, int modelIndex, int reverse ); void (*R_FunnelSprite)( float *org, int modelIndex, int reverse );
void (*R_Implosion)( float *end, float radius, int count, float life ); void (*R_Implosion)( float *end, float radius, int count, float life );
void (*R_LargeFunnel)( float *org, int reverse ); void (*R_LargeFunnel)( float *org, int reverse );
void (*R_LavaSplash)( float *org ); void (*R_LavaSplash)( float *org );
void (*R_MultiGunshot)( float *org, float *dir, float *noise, int count, int decalCount, int *decalIndices ); void (*R_MultiGunshot)( float *org, float *dir, float *noise, int count, int decalCount, int *decalIndices );
void (*R_MuzzleFlash)( float *pos1, int type ); void (*R_MuzzleFlash)( float *pos1, int type );
void (*R_ParticleBox)( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life ); void (*R_ParticleBox)( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );
void (*R_ParticleBurst)( float *pos, int size, int color, float life ); void (*R_ParticleBurst)( float *pos, int size, int color, float life );
void (*R_ParticleExplosion)( float *org ); void (*R_ParticleExplosion)( float *org );
void (*R_ParticleExplosion2)( float *org, int colorStart, int colorLength ); void (*R_ParticleExplosion2)( float *org, int colorStart, int colorLength );
void (*R_ParticleLine)( float *start, float *end, unsigned char r, unsigned char g, unsigned char b, float life ); void (*R_ParticleLine)( float *start, float *end, unsigned char r, unsigned char g, unsigned char b, float life );
void (*R_PlayerSprites)( int client, int modelIndex, int count, int size ); void (*R_PlayerSprites)( int client, int modelIndex, int count, int size );
void (*R_Projectile)( float *origin, float *velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) ); void (*R_Projectile)( float *origin, float *velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );
void (*R_RicochetSound)( float *pos ); void (*R_RicochetSound)( float *pos );
void (*R_RicochetSprite)( float *pos, struct model_s *pmodel, float duration, float scale ); void (*R_RicochetSprite)( float *pos, struct model_s *pmodel, float duration, float scale );
void (*R_RocketFlare)( float *pos ); void (*R_RocketFlare)( float *pos );
void (*R_RocketTrail)( float *start, float *end, int type ); void (*R_RocketTrail)( float *start, float *end, int type );
void (*R_RunParticleEffect)( float *org, float *dir, int color, int count ); void (*R_RunParticleEffect)( float *org, float *dir, int color, int count );
void (*R_ShowLine)( float *start, float *end ); void (*R_ShowLine)( float *start, float *end );
void (*R_SparkEffect)( float *pos, int count, int velocityMin, int velocityMax ); void (*R_SparkEffect)( float *pos, int count, int velocityMin, int velocityMax );
void (*R_SparkShower)( float *pos ); void (*R_SparkShower)( float *pos );
void (*R_SparkStreaks)( float *pos, int count, int velocityMin, int velocityMax ); void (*R_SparkStreaks)( float *pos, int count, int velocityMin, int velocityMax );
void (*R_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int spread, int rendermode ); void (*R_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int spread, int rendermode );
void (*R_Sprite_Explode)( TEMPENTITY *pTemp, float scale, int flags ); void (*R_Sprite_Explode)( TEMPENTITY *pTemp, float scale, int flags );
void (*R_Sprite_Smoke)( TEMPENTITY *pTemp, float scale ); void (*R_Sprite_Smoke)( TEMPENTITY *pTemp, float scale );
void (*R_Sprite_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int iRand ); void (*R_Sprite_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int iRand );
void (*R_Sprite_Trail)( int type, float *start, float *end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed ); void (*R_Sprite_Trail)( int type, float *start, float *end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed );
void (*R_Sprite_WallPuff)( TEMPENTITY *pTemp, float scale ); void (*R_Sprite_WallPuff)( TEMPENTITY *pTemp, float scale );
void (*R_StreakSplash)( float *pos, float *dir, int color, int count, float speed, int velocityMin, int velocityMax ); void (*R_StreakSplash)( float *pos, float *dir, int color, int count, float speed, int velocityMin, int velocityMax );
void (*R_TracerEffect)( float *start, float *end ); void (*R_TracerEffect)( float *start, float *end );
void (*R_UserTracerParticle)( float *org, float *vel, float life, int colorIndex, float length, unsigned char deathcontext, void (*deathfunc)( struct particle_s *particle )); void (*R_UserTracerParticle)( float *org, float *vel, float life, int colorIndex, float length, unsigned char deathcontext, void (*deathfunc)( struct particle_s *particle ));
particle_t *(*R_TracerParticles)( float *org, float *vel, float life ); particle_t *(*R_TracerParticles)( float *org, float *vel, float life );
void (*R_TeleportSplash)( float *org ); void (*R_TeleportSplash)( float *org );
void (*R_TempSphereModel)( float *pos, float speed, float life, int count, int modelIndex ); void (*R_TempSphereModel)( float *pos, float speed, float life, int count, int modelIndex );
TEMPENTITY *(*R_TempModel)( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype ); TEMPENTITY *(*R_TempModel)( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype );
TEMPENTITY *(*R_DefaultSprite)( float *pos, int spriteIndex, float framerate ); TEMPENTITY *(*R_DefaultSprite)( float *pos, int spriteIndex, float framerate );
TEMPENTITY *(*R_TempSprite)( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags ); TEMPENTITY *(*R_TempSprite)( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
int (*Draw_DecalIndex)( int id ); int (*Draw_DecalIndex)( int id );
int (*Draw_DecalIndexFromName)( char *name ); int (*Draw_DecalIndexFromName)( char *name );
void (*R_DecalShoot)( int textureIndex, int entity, int modelIndex, float *position, int flags ); void (*R_DecalShoot)( int textureIndex, int entity, int modelIndex, float *position, int flags );
void (*R_AttachTentToPlayer)( int client, int modelIndex, float zoffset, float life ); void (*R_AttachTentToPlayer)( int client, int modelIndex, float zoffset, float life );
void (*R_KillAttachedTents)( int client ); void (*R_KillAttachedTents)( int client );
BEAM *(*R_BeamCirclePoints)( int type, float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); BEAM *(*R_BeamCirclePoints)( int type, float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *(*R_BeamEntPoint)( int startEnt, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); BEAM *(*R_BeamEntPoint)( int startEnt, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *(*R_BeamEnts)( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); BEAM *(*R_BeamEnts)( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *(*R_BeamFollow)( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness ); BEAM *(*R_BeamFollow)( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness );
void (*R_BeamKill)( int deadEntity ); void (*R_BeamKill)( int deadEntity );
BEAM *(*R_BeamLightning)( float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed ); BEAM *(*R_BeamLightning)( float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed );
BEAM *(*R_BeamPoints)( float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); BEAM *(*R_BeamPoints)( float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *(*R_BeamRing)( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); BEAM *(*R_BeamRing)( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
dlight_t *(*CL_AllocDlight)( int key ); dlight_t *(*CL_AllocDlight)( int key );
dlight_t *(*CL_AllocElight)( int key ); dlight_t *(*CL_AllocElight)( int key );
TEMPENTITY *(*CL_TempEntAlloc)( float *org, struct model_s *model ); TEMPENTITY *(*CL_TempEntAlloc)( float *org, struct model_s *model );
TEMPENTITY *(*CL_TempEntAllocNoModel)( float *org ); TEMPENTITY *(*CL_TempEntAllocNoModel)( float *org );
TEMPENTITY *(*CL_TempEntAllocHigh)( float *org, struct model_s *model ); TEMPENTITY *(*CL_TempEntAllocHigh)( float *org, struct model_s *model );
TEMPENTITY *(*CL_TentEntAllocCustom)( float *origin, struct model_s *model, int high, void (*callback)( struct tempent_s *ent, float frametime, float currenttime )); TEMPENTITY *(*CL_TentEntAllocCustom)( float *origin, struct model_s *model, int high, void (*callback)( struct tempent_s *ent, float frametime, float currenttime ));
void (*R_GetPackedColor)( short *packed, short color ); void (*R_GetPackedColor)( short *packed, short color );
short (*R_LookupColor)( unsigned char r, unsigned char g, unsigned char b ); short (*R_LookupColor)( unsigned char r, unsigned char g, unsigned char b );
void (*R_DecalRemoveAll)( int textureIndex ); // textureIndex points to the decal index in the array, not the actual texture index. void (*R_DecalRemoveAll)( int textureIndex ); // textureIndex points to the decal index in the array, not the actual texture index.
void (*R_FireCustomDecal)( int textureIndex, int entity, int modelIndex, float *position, int flags, float scale ); void (*R_FireCustomDecal)( int textureIndex, int entity, int modelIndex, float *position, int flags, float scale );
}; };
#endif//R_EFX_H #endif//R_EFX_H

View File

@ -1,154 +1,154 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef R_STUDIOINT_H #ifndef R_STUDIOINT_H
#define R_STUDIOINT_H #define R_STUDIOINT_H
#define STUDIO_INTERFACE_VERSION 1 #define STUDIO_INTERFACE_VERSION 1
typedef struct engine_studio_api_s typedef struct engine_studio_api_s
{ {
// Allocate number*size bytes and zero it // Allocate number*size bytes and zero it
void *( *Mem_Calloc )( int number, size_t size ); void *( *Mem_Calloc )( int number, size_t size );
// Check to see if pointer is in the cache // Check to see if pointer is in the cache
void *( *Cache_Check )( struct cache_user_s *c ); void *( *Cache_Check )( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand ) // Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile )( char *path, struct cache_user_s *cu ); void ( *LoadCacheFile )( char *path, struct cache_user_s *cu );
// Retrieve model pointer for the named model // Retrieve model pointer for the named model
struct model_s *( *Mod_ForName )( const char *name, int crash_if_missing ); struct model_s *( *Mod_ForName )( const char *name, int crash_if_missing );
// Retrieve pointer to studio model data block from a model // Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata )( struct model_s *mod ); void *( *Mod_Extradata )( struct model_s *mod );
// Retrieve indexed model from client side model precache list // Retrieve indexed model from client side model precache list
struct model_s *( *GetModelByIndex )( int index ); struct model_s *( *GetModelByIndex )( int index );
// Get entity that is set for rendering // Get entity that is set for rendering
struct cl_entity_s * ( *GetCurrentEntity )( void ); struct cl_entity_s * ( *GetCurrentEntity )( void );
// Get referenced player_info_t // Get referenced player_info_t
struct player_info_s *( *PlayerInfo )( int index ); struct player_info_s *( *PlayerInfo )( int index );
// Get most recently received player state data from network system // Get most recently received player state data from network system
struct entity_state_s *( *GetPlayerState )( int index ); struct entity_state_s *( *GetPlayerState )( int index );
// Get viewentity // Get viewentity
struct cl_entity_s * ( *GetViewEntity )( void ); struct cl_entity_s * ( *GetViewEntity )( void );
// Get current frame count, and last two timestampes on client // Get current frame count, and last two timestampes on client
void ( *GetTimes )( int *framecount, double *current, double *old ); void ( *GetTimes )( int *framecount, double *current, double *old );
// Get a pointer to a cvar by name // Get a pointer to a cvar by name
struct cvar_s *( *GetCvar )( const char *name ); struct cvar_s *( *GetCvar )( const char *name );
// Get current render origin and view vectors ( up, right and vpn ) // Get current render origin and view vectors ( up, right and vpn )
void ( *GetViewInfo )( float *origin, float *upv, float *rightv, float *vpnv ); void ( *GetViewInfo )( float *origin, float *upv, float *rightv, float *vpnv );
// Get sprite model used for applying chrome effect // Get sprite model used for applying chrome effect
struct model_s *( *GetChromeSprite )( void ); struct model_s *( *GetChromeSprite )( void );
// Get model counters so we can incement instrumentation // Get model counters so we can incement instrumentation
void ( *GetModelCounters )( int **s, int **a ); void ( *GetModelCounters )( int **s, int **a );
// Get software scaling coefficients // Get software scaling coefficients
void ( *GetAliasScale )( float *x, float *y ); void ( *GetAliasScale )( float *x, float *y );
// Get bone, light, alias, and rotation matrices // Get bone, light, alias, and rotation matrices
float ****( *StudioGetBoneTransform )( void ); float ****( *StudioGetBoneTransform )( void );
float ****( *StudioGetLightTransform )( void ); float ****( *StudioGetLightTransform )( void );
float ***( *StudioGetAliasTransform )( void ); float ***( *StudioGetAliasTransform )( void );
float ***( *StudioGetRotationMatrix )( void ); float ***( *StudioGetRotationMatrix )( void );
// Set up body part, and get submodel pointers // Set up body part, and get submodel pointers
void ( *StudioSetupModel )( int bodypart, void **ppbodypart, void **ppsubmodel ); void ( *StudioSetupModel )( int bodypart, void **ppbodypart, void **ppsubmodel );
// Check if entity's bbox is in the view frustum // Check if entity's bbox is in the view frustum
int ( *StudioCheckBBox )( void ); int ( *StudioCheckBBox )( void );
// Apply lighting effects to model // Apply lighting effects to model
void ( *StudioDynamicLight )( struct cl_entity_s *ent, struct alight_s *plight ); void ( *StudioDynamicLight )( struct cl_entity_s *ent, struct alight_s *plight );
void ( *StudioEntityLight )( struct alight_s *plight ); void ( *StudioEntityLight )( struct alight_s *plight );
void ( *StudioSetupLighting )( struct alight_s *plighting ); void ( *StudioSetupLighting )( struct alight_s *plighting );
// Draw mesh vertices // Draw mesh vertices
void ( *StudioDrawPoints )( void ); void ( *StudioDrawPoints )( void );
// Draw hulls around bones // Draw hulls around bones
void ( *StudioDrawHulls )( void ); void ( *StudioDrawHulls )( void );
// Draw bbox around studio models // Draw bbox around studio models
void ( *StudioDrawAbsBBox )( void ); void ( *StudioDrawAbsBBox )( void );
// Draws bones // Draws bones
void ( *StudioDrawBones )( void ); void ( *StudioDrawBones )( void );
// Loads in appropriate texture for model // Loads in appropriate texture for model
void ( *StudioSetupSkin )( void *ptexturehdr, int index ); void ( *StudioSetupSkin )( void *ptexturehdr, int index );
// Sets up for remapped colors // Sets up for remapped colors
void ( *StudioSetRemapColors )( int top, int bottom ); void ( *StudioSetRemapColors )( int top, int bottom );
// Set's player model and returns model pointer // Set's player model and returns model pointer
struct model_s *( *SetupPlayerModel )( int index ); struct model_s *( *SetupPlayerModel )( int index );
// Fires any events embedded in animation // Fires any events embedded in animation
void ( *StudioClientEvents )( void ); void ( *StudioClientEvents )( void );
// Retrieve/set forced render effects flags // Retrieve/set forced render effects flags
int ( *GetForceFaceFlags )( void ); int ( *GetForceFaceFlags )( void );
void ( *SetForceFaceFlags )( int flags ); void ( *SetForceFaceFlags )( int flags );
// Tell engine the value of the studio model header // Tell engine the value of the studio model header
void ( *StudioSetHeader )( void *header ); void ( *StudioSetHeader )( void *header );
// Tell engine which model_t * is being renderered // Tell engine which model_t * is being renderered
void ( *SetRenderModel )( struct model_s *model ); void ( *SetRenderModel )( struct model_s *model );
// Final state setup and restore for rendering // Final state setup and restore for rendering
void ( *SetupRenderer )( int rendermode ); void ( *SetupRenderer )( int rendermode );
void ( *RestoreRenderer )( void ); void ( *RestoreRenderer )( void );
// Set render origin for applying chrome effect // Set render origin for applying chrome effect
void ( *SetChromeOrigin )( void ); void ( *SetChromeOrigin )( void );
// True if using D3D/OpenGL // True if using D3D/OpenGL
int ( *IsHardware )( void ); int ( *IsHardware )( void );
// Only called by hardware interface // Only called by hardware interface
void ( *GL_StudioDrawShadow )( void ); void ( *GL_StudioDrawShadow )( void );
void ( *GL_SetRenderMode )( int mode ); void ( *GL_SetRenderMode )( int mode );
void ( *StudioSetRenderamt )( int iRenderamt ); void ( *StudioSetRenderamt )( int iRenderamt );
void ( *StudioSetCullState )( int iCull ); void ( *StudioSetCullState )( int iCull );
void ( *StudioRenderShadow )( int iSprite, float *p1, float *p2, float *p3, float *p4 ); void ( *StudioRenderShadow )( int iSprite, float *p1, float *p2, float *p3, float *p4 );
} engine_studio_api_t; } engine_studio_api_t;
typedef struct server_studio_api_s typedef struct server_studio_api_s
{ {
// Allocate number*size bytes and zero it // Allocate number*size bytes and zero it
void *( *Mem_Calloc )( int number, size_t size ); void *( *Mem_Calloc )( int number, size_t size );
// Check to see if pointer is in the cache // Check to see if pointer is in the cache
void *( *Cache_Check )( struct cache_user_s *c ); void *( *Cache_Check )( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand ) // Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile )( char *path, struct cache_user_s *cu ); void ( *LoadCacheFile )( char *path, struct cache_user_s *cu );
// Retrieve pointer to studio model data block from a model // Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata )( struct model_s *mod ); void *( *Mod_Extradata )( struct model_s *mod );
} server_studio_api_t; } server_studio_api_t;
// client blending // client blending
typedef struct r_studio_interface_s typedef struct r_studio_interface_s
{ {
int version; int version;
int ( *StudioDrawModel )( int flags ); int ( *StudioDrawModel )( int flags );
int ( *StudioDrawPlayer )( int flags, struct entity_state_s *pplayer ); int ( *StudioDrawPlayer )( int flags, struct entity_state_s *pplayer );
} r_studio_interface_t; } r_studio_interface_t;
// server blending // server blending
#define SV_BLENDING_INTERFACE_VERSION 1 #define SV_BLENDING_INTERFACE_VERSION 1
typedef struct sv_blending_interface_s typedef struct sv_blending_interface_s
{ {
int version; int version;
void ( *SV_StudioSetupBones )( struct model_s *pModel, void ( *SV_StudioSetupBones )( struct model_s *pModel,
float frame, float frame,
int sequence, int sequence,
const vec3_t angles, const vec3_t angles,
const vec3_t origin, const vec3_t origin,
const byte *pcontroller, const byte *pcontroller,
const byte *pblending, const byte *pblending,
int iBone, int iBone,
const edict_t *pEdict ); const edict_t *pEdict );
} sv_blending_interface_t; } sv_blending_interface_t;
#endif//R_STUDIOINT_H #endif//R_STUDIOINT_H

View File

@ -1,90 +1,90 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef REF_PARAMS_H #ifndef REF_PARAMS_H
#define REF_PARAMS_H #define REF_PARAMS_H
typedef struct ref_params_s typedef struct ref_params_s
{ {
// output // output
vec3_t vieworg; vec3_t vieworg;
vec3_t viewangles; vec3_t viewangles;
vec3_t forward; vec3_t forward;
vec3_t right; vec3_t right;
vec3_t up; vec3_t up;
// Client frametime; // Client frametime;
float frametime; float frametime;
// Client time // Client time
float time; float time;
// Misc // Misc
int intermission; int intermission;
int paused; int paused;
int spectator; int spectator;
int onground; int onground;
int waterlevel; int waterlevel;
vec3_t simvel; vec3_t simvel;
vec3_t simorg; vec3_t simorg;
vec3_t viewheight; vec3_t viewheight;
float idealpitch; float idealpitch;
vec3_t cl_viewangles; vec3_t cl_viewangles;
int health; int health;
vec3_t crosshairangle; vec3_t crosshairangle;
float viewsize; float viewsize;
vec3_t punchangle; vec3_t punchangle;
int maxclients; int maxclients;
int viewentity; int viewentity;
int playernum; int playernum;
int max_entities; int max_entities;
int demoplayback; int demoplayback;
int hardware; int hardware;
int smoothing; int smoothing;
// Last issued usercmd // Last issued usercmd
struct usercmd_s *cmd; struct usercmd_s *cmd;
// Movevars // Movevars
struct movevars_s *movevars; struct movevars_s *movevars;
int viewport[4]; // the viewport coordinates x, y, width, height int viewport[4]; // the viewport coordinates x, y, width, height
int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview
// so long in cycles until this value is 0 (multiple views) // so long in cycles until this value is 0 (multiple views)
int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions
// Xash3D extension // Xash3D extension
float fov_x, fov_y; // actual fov can be overrided on nextView float fov_x, fov_y; // actual fov can be overrided on nextView
} ref_params_t; } ref_params_t;
// same as ref_params but for overview mode // same as ref_params but for overview mode
typedef struct ref_overview_s typedef struct ref_overview_s
{ {
vec3_t origin; vec3_t origin;
qboolean rotated; qboolean rotated;
float xLeft; float xLeft;
float xRight; float xRight;
float xTop; float xTop;
float xBottom; float xBottom;
float zFar; float zFar;
float zNear; float zNear;
float flZoom; float flZoom;
} ref_overview_t; } ref_overview_t;
#endif//REF_PARAMS_H #endif//REF_PARAMS_H

View File

@ -1,261 +1,261 @@
/* /*
render_api.h - Xash3D extension for client interface render_api.h - Xash3D extension for client interface
Copyright (C) 2011 Uncle Mike Copyright (C) 2011 Uncle Mike
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef RENDER_API_H #ifndef RENDER_API_H
#define RENDER_API_H #define RENDER_API_H
#include "lightstyle.h" #include "lightstyle.h"
#include "dlight.h" #include "dlight.h"
// changes for version 28 // changes for version 28
// replace decal_t from software declaration to hardware (matched to normal HL) // replace decal_t from software declaration to hardware (matched to normal HL)
// mextrasurf_t->increased limit of reserved fields (up from 7 to 32) // mextrasurf_t->increased limit of reserved fields (up from 7 to 32)
// replace R_StoreEfrags with him extended version // replace R_StoreEfrags with him extended version
// formed group for BSP decal manipulating // formed group for BSP decal manipulating
// move misc functions at end of the interface // move misc functions at end of the interface
// added new export for clearing studio decals // added new export for clearing studio decals
#define CL_RENDER_INTERFACE_VERSION 35 #define CL_RENDER_INTERFACE_VERSION 35
#define MAX_STUDIO_DECALS 4096 // + unused space of BSP decals #define MAX_STUDIO_DECALS 4096 // + unused space of BSP decals
#define SURF_INFO( surf, mod ) ((mextrasurf_t *)mod->cache.data + (surf - mod->surfaces)) #define SURF_INFO( surf, mod ) ((mextrasurf_t *)mod->cache.data + (surf - mod->surfaces))
#define INFO_SURF( surf, mod ) (mod->surfaces + (surf - (mextrasurf_t *)mod->cache.data)) #define INFO_SURF( surf, mod ) (mod->surfaces + (surf - (mextrasurf_t *)mod->cache.data))
// render info parms // render info parms
#define PARM_TEX_WIDTH 1 // all parms with prefix 'TEX_' receive arg as texnum #define PARM_TEX_WIDTH 1 // all parms with prefix 'TEX_' receive arg as texnum
#define PARM_TEX_HEIGHT 2 // otherwise it's not used #define PARM_TEX_HEIGHT 2 // otherwise it's not used
#define PARM_TEX_SRC_WIDTH 3 #define PARM_TEX_SRC_WIDTH 3
#define PARM_TEX_SRC_HEIGHT 4 #define PARM_TEX_SRC_HEIGHT 4
#define PARM_TEX_SKYBOX 5 // second arg as skybox ordering num #define PARM_TEX_SKYBOX 5 // second arg as skybox ordering num
#define PARM_TEX_SKYTEXNUM 6 // skytexturenum for quake sky #define PARM_TEX_SKYTEXNUM 6 // skytexturenum for quake sky
#define PARM_TEX_LIGHTMAP 7 // second arg as number 0 - 128 #define PARM_TEX_LIGHTMAP 7 // second arg as number 0 - 128
#define PARM_TEX_TARGET 8 #define PARM_TEX_TARGET 8
#define PARM_TEX_TEXNUM 9 #define PARM_TEX_TEXNUM 9
#define PARM_TEX_FLAGS 10 #define PARM_TEX_FLAGS 10
#define PARM_TEX_TYPE 11 #define PARM_TEX_TYPE 11
#define PARM_TEX_CACHEFRAME 12 // compare with worldmodel->needload #define PARM_TEX_CACHEFRAME 12 // compare with worldmodel->needload
#define PARM_TEX_GLFORMAT 13 // get a texture GL-format #define PARM_TEX_GLFORMAT 13 // get a texture GL-format
// reserved // reserved
#define PARM_WORLD_VERSION 16 // return the version of bsp #define PARM_WORLD_VERSION 16 // return the version of bsp
#define PARM_SKY_SPHERE 17 // sky is quake sphere ? #define PARM_SKY_SPHERE 17 // sky is quake sphere ?
#define PARM_MAP_HAS_MIRRORS 18 // current map has mirorrs #define PARM_MAP_HAS_MIRRORS 18 // current map has mirorrs
#define PARM_MAP_HAS_DELUXE 19 // map has deluxedata #define PARM_MAP_HAS_DELUXE 19 // map has deluxedata
#define PARM_MAX_ENTITIES 20 #define PARM_MAX_ENTITIES 20
#define PARM_WIDESCREEN 21 #define PARM_WIDESCREEN 21
#define PARM_FULLSCREEN 22 #define PARM_FULLSCREEN 22
#define PARM_SCREEN_WIDTH 23 #define PARM_SCREEN_WIDTH 23
#define PARM_SCREEN_HEIGHT 24 #define PARM_SCREEN_HEIGHT 24
#define PARM_CLIENT_INGAME 25 #define PARM_CLIENT_INGAME 25
#define PARM_FEATURES 26 // same as movevars->features #define PARM_FEATURES 26 // same as movevars->features
#define PARM_ACTIVE_TMU 27 // for debug #define PARM_ACTIVE_TMU 27 // for debug
#define PARM_CACHEFRAME 28 #define PARM_CACHEFRAME 28
#define PARM_MAX_IMAGE_UNITS 29 #define PARM_MAX_IMAGE_UNITS 29
#define PARM_CLIENT_ACTIVE 30 #define PARM_CLIENT_ACTIVE 30
#define PARM_REBUILD_GAMMA 31 // if true lightmaps rebuilding for gamma change #define PARM_REBUILD_GAMMA 31 // if true lightmaps rebuilding for gamma change
enum enum
{ {
// skybox ordering // skybox ordering
SKYBOX_RIGHT = 0, SKYBOX_RIGHT = 0,
SKYBOX_BACK, SKYBOX_BACK,
SKYBOX_LEFT, SKYBOX_LEFT,
SKYBOX_FORWARD, SKYBOX_FORWARD,
SKYBOX_UP, SKYBOX_UP,
SKYBOX_DOWN, SKYBOX_DOWN,
}; };
typedef enum typedef enum
{ {
TEX_INVALID = 0, // free slot TEX_INVALID = 0, // free slot
TEX_SYSTEM, // generated by engine TEX_SYSTEM, // generated by engine
TEX_NOMIP, // hud pics, menu etc TEX_NOMIP, // hud pics, menu etc
TEX_BRUSH, // a map texture TEX_BRUSH, // a map texture
TEX_SPRITE, // sprite frames TEX_SPRITE, // sprite frames
TEX_STUDIO, // studio skins TEX_STUDIO, // studio skins
TEX_LIGHTMAP, // lightmap textures TEX_LIGHTMAP, // lightmap textures
TEX_DECAL, // decals TEX_DECAL, // decals
TEX_VGUI, // vgui fonts or images TEX_VGUI, // vgui fonts or images
TEX_CUBEMAP, // cubemap textures (sky) TEX_CUBEMAP, // cubemap textures (sky)
TEX_DETAIL, // detail textures TEX_DETAIL, // detail textures
TEX_REMAP, // local copy of remap texture TEX_REMAP, // local copy of remap texture
TEX_SCREENCOPY, // keep screen copy e.g. for mirror TEX_SCREENCOPY, // keep screen copy e.g. for mirror
TEX_CUSTOM, // user created texture TEX_CUSTOM, // user created texture
TEX_DEPTHMAP // shadowmap texture TEX_DEPTHMAP // shadowmap texture
} texType_t; } texType_t;
typedef enum typedef enum
{ {
TF_NEAREST = (1<<0), // disable texfilter TF_NEAREST = (1<<0), // disable texfilter
TF_KEEP_RGBDATA = (1<<1), // some images keep source TF_KEEP_RGBDATA = (1<<1), // some images keep source
TF_NOFLIP_TGA = (1<<2), // Steam background completely ignore tga attribute 0x20 TF_NOFLIP_TGA = (1<<2), // Steam background completely ignore tga attribute 0x20
TF_KEEP_8BIT = (1<<3), // keep original 8-bit image (if present) TF_KEEP_8BIT = (1<<3), // keep original 8-bit image (if present)
TF_NOPICMIP = (1<<4), // ignore r_picmip resample rules TF_NOPICMIP = (1<<4), // ignore r_picmip resample rules
TF_UNCOMPRESSED = (1<<5), // don't compress texture in video memory TF_UNCOMPRESSED = (1<<5), // don't compress texture in video memory
TF_CUBEMAP = (1<<6), // it's cubemap texture TF_CUBEMAP = (1<<6), // it's cubemap texture
TF_DEPTHMAP = (1<<7), // custom texture filter used TF_DEPTHMAP = (1<<7), // custom texture filter used
TF_INTENSITY = (1<<8), // monochrome intensity image TF_INTENSITY = (1<<8), // monochrome intensity image
TF_LUMINANCE = (1<<9), // force image to grayscale TF_LUMINANCE = (1<<9), // force image to grayscale
TF_SKYSIDE = (1<<10), // this is a part of skybox TF_SKYSIDE = (1<<10), // this is a part of skybox
TF_CLAMP = (1<<11), // clamp texcoords to [0..1] range TF_CLAMP = (1<<11), // clamp texcoords to [0..1] range
TF_NOMIPMAP = (1<<12), // don't build mips for this image TF_NOMIPMAP = (1<<12), // don't build mips for this image
TF_HAS_LUMA = (1<<13), // sets by GL_UploadTexture TF_HAS_LUMA = (1<<13), // sets by GL_UploadTexture
TF_MAKELUMA = (1<<14), // create luma from quake texture (only q1 textures contain luma-pixels) TF_MAKELUMA = (1<<14), // create luma from quake texture (only q1 textures contain luma-pixels)
TF_NORMALMAP = (1<<15), // is a normalmap TF_NORMALMAP = (1<<15), // is a normalmap
TF_HAS_ALPHA = (1<<16), // image has alpha (used only for GL_CreateTexture) TF_HAS_ALPHA = (1<<16), // image has alpha (used only for GL_CreateTexture)
TF_FORCE_COLOR = (1<<17), // force upload monochrome textures as RGB (detail textures) TF_FORCE_COLOR = (1<<17), // force upload monochrome textures as RGB (detail textures)
TF_TEXTURE_1D = (1<<18), // this is GL_TEXTURE_1D TF_TEXTURE_1D = (1<<18), // this is GL_TEXTURE_1D
TF_BORDER = (1<<19), // zero clamp for projected textures TF_BORDER = (1<<19), // zero clamp for projected textures
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
TF_STATIC = (1<<21), // a marker for purge mechanism (not used by engine) TF_STATIC = (1<<21), // a marker for purge mechanism (not used by engine)
TF_TEXTURE_RECTANGLE= (1<<22), // this is GL_TEXTURE_RECTANGLE TF_TEXTURE_RECTANGLE= (1<<22), // this is GL_TEXTURE_RECTANGLE
TF_ALPHA_BORDER = (1<<23), // clamp to (0,0,0,255) (probably no difference) TF_ALPHA_BORDER = (1<<23), // clamp to (0,0,0,255) (probably no difference)
TF_IMAGE_PROGRAM = (1<<24), // enable image program support like in Doom3 TF_IMAGE_PROGRAM = (1<<24), // enable image program support like in Doom3
TF_ALPHACONTRAST = (1<<25), // special texture flags for internal usage TF_ALPHACONTRAST = (1<<25), // special texture flags for internal usage
TF_FLOAT = (1<<26), // float textures TF_FLOAT = (1<<26), // float textures
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
TF_FLOATDATA = (1<<28), // incoming dataType has type GL_FLOAT TF_FLOATDATA = (1<<28), // incoming dataType has type GL_FLOAT
} texFlags_t; } texFlags_t;
typedef struct beam_s BEAM; typedef struct beam_s BEAM;
typedef struct particle_s particle_t; typedef struct particle_s particle_t;
// 12 bytes here // 12 bytes here
typedef struct modelstate_s typedef struct modelstate_s
{ {
short sequence; short sequence;
short frame; // 10 bits multiple by 4, should be enough short frame; // 10 bits multiple by 4, should be enough
byte blending[2]; byte blending[2];
byte controller[4]; byte controller[4];
byte body; byte body;
byte skin; byte skin;
} modelstate_t; } modelstate_t;
typedef struct decallist_s typedef struct decallist_s
{ {
vec3_t position; vec3_t position;
char name[64]; char name[64];
short entityIndex; short entityIndex;
byte depth; byte depth;
byte flags; byte flags;
float scale; float scale;
// this is the surface plane that we hit so that // this is the surface plane that we hit so that
// we can move certain decals across // we can move certain decals across
// transitions if they hit similar geometry // transitions if they hit similar geometry
vec3_t impactPlaneNormal; vec3_t impactPlaneNormal;
modelstate_t studio_state; // studio decals only modelstate_t studio_state; // studio decals only
} decallist_t; } decallist_t;
typedef struct render_api_s typedef struct render_api_s
{ {
// Get renderer info (doesn't changes engine state at all) // Get renderer info (doesn't changes engine state at all)
int (*RenderGetParm)( int parm, int arg ); // generic int (*RenderGetParm)( int parm, int arg ); // generic
void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale ); void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale );
void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha ); void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha );
lightstyle_t* (*GetLightStyle)( int number ); lightstyle_t* (*GetLightStyle)( int number );
dlight_t* (*GetDynamicLight)( int number ); dlight_t* (*GetDynamicLight)( int number );
dlight_t* (*GetEntityLight)( int number ); dlight_t* (*GetEntityLight)( int number );
byte (*TextureToTexGamma)( byte color ); // software gamma support byte (*TextureToTexGamma)( byte color ); // software gamma support
void (*GetBeamChains)( BEAM ***active_beams, BEAM ***free_beams, particle_t ***free_trails ); void (*GetBeamChains)( BEAM ***active_beams, BEAM ***free_beams, particle_t ***free_trails );
// Set renderer info (tell engine about changes) // Set renderer info (tell engine about changes)
void (*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel void (*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel
void (*R_SetCurrentModel)( struct model_s *mod ); // change currentmodel but leave currententity unchanged void (*R_SetCurrentModel)( struct model_s *mod ); // change currentmodel but leave currententity unchanged
void (*GL_SetWorldviewProjectionMatrix)( const float *glmatrix ); // update viewprojection matrix (tracers uses it) void (*GL_SetWorldviewProjectionMatrix)( const float *glmatrix ); // update viewprojection matrix (tracers uses it)
void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities
// Texture tools // Texture tools
int (*GL_FindTexture)( const char *name ); int (*GL_FindTexture)( const char *name );
const char* (*GL_TextureName)( unsigned int texnum ); const char* (*GL_TextureName)( unsigned int texnum );
const byte* (*GL_TextureData)( unsigned int texnum ); // may be NULL const byte* (*GL_TextureData)( unsigned int texnum ); // may be NULL
int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags ); int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags );
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, int flags ); int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, int flags );
void (*GL_SetTextureType)( unsigned int texnum, unsigned int type ); void (*GL_SetTextureType)( unsigned int texnum, unsigned int type );
void (*GL_TextureCacheFrame)( unsigned int texnum ); void (*GL_TextureCacheFrame)( unsigned int texnum );
void (*GL_FreeTexture)( unsigned int texnum ); void (*GL_FreeTexture)( unsigned int texnum );
// Decals manipulating (draw & remove) // Decals manipulating (draw & remove)
void (*DrawSingleDecal)( struct decal_s *pDecal, struct msurface_s *fa ); void (*DrawSingleDecal)( struct decal_s *pDecal, struct msurface_s *fa );
float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount ); float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount );
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only) void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
// AVIkit support // AVIkit support
void *(*AVI_LoadVideo)( const char *filename, int ignore_hwgamma ); void *(*AVI_LoadVideo)( const char *filename, int ignore_hwgamma );
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration ); int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
long (*AVI_GetVideoFrameNumber)( void *Avi, float time ); long (*AVI_GetVideoFrameNumber)( void *Avi, float time );
byte *(*AVI_GetVideoFrame)( void *Avi, long frame ); byte *(*AVI_GetVideoFrame)( void *Avi, long frame );
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data ); void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );
void (*AVI_FreeVideo)( void *Avi ); void (*AVI_FreeVideo)( void *Avi );
int (*AVI_IsActive)( void *Avi ); int (*AVI_IsActive)( void *Avi );
// glState related calls (must use this instead of normal gl-calls to prevent de-synchornize local states between engine and the client) // glState related calls (must use this instead of normal gl-calls to prevent de-synchornize local states between engine and the client)
void (*GL_Bind)( int tmu, unsigned int texnum ); void (*GL_Bind)( int tmu, unsigned int texnum );
void (*GL_SelectTexture)( int tmu ); void (*GL_SelectTexture)( int tmu );
void (*GL_LoadTextureMatrix)( const float *glmatrix ); void (*GL_LoadTextureMatrix)( const float *glmatrix );
void (*GL_TexMatrixIdentity)( void ); void (*GL_TexMatrixIdentity)( void );
void (*GL_CleanUpTextureUnits)( int last ); // pass 0 for clear all the texture units void (*GL_CleanUpTextureUnits)( int last ); // pass 0 for clear all the texture units
void (*GL_TexGen)( unsigned int coord, unsigned int mode ); void (*GL_TexGen)( unsigned int coord, unsigned int mode );
void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture
void (*GL_TexCoordArrayMode)( unsigned int texmode ); void (*GL_TexCoordArrayMode)( unsigned int texmode );
void (*GL_Reserved0)( void ); // for potential interface expansion without broken compatibility void (*GL_Reserved0)( void ); // for potential interface expansion without broken compatibility
void (*GL_Reserved1)( void ); void (*GL_Reserved1)( void );
void (*GL_Reserved2)( void ); void (*GL_Reserved2)( void );
void (*GL_Reserved3)( void ); void (*GL_Reserved3)( void );
// Misc renderer functions // Misc renderer functions
void (*GL_DrawParticles)( const float *vieworg, const float *fwd, const float *rt, const float *up, unsigned int clipFlags ); void (*GL_DrawParticles)( const float *vieworg, const float *fwd, const float *rt, const float *up, unsigned int clipFlags );
void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // creates a cubemap or skybox into gfx\env folder void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // creates a cubemap or skybox into gfx\env folder
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare ); int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
void (*Host_Error)( const char *error, ... ); // cause Host Error void (*Host_Error)( const char *error, ... ); // cause Host Error
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
void (*TessPolygon)( struct msurface_s *surf, struct model_s *mod, float tessSize ); void (*TessPolygon)( struct msurface_s *surf, struct model_s *mod, float tessSize );
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e ); struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
const struct ref_overview_s *( *GetOverviewParms )( void ); const struct ref_overview_s *( *GetOverviewParms )( void );
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents) void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
// static allocations // static allocations
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ); void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
void (*pfnMemFree)( void *mem, const char *filename, const int fileline ); void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
// find in files // find in files
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly ); char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 35 // ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 35
} render_api_t; } render_api_t;
// render callbacks // render callbacks
typedef struct render_interface_s typedef struct render_interface_s
{ {
int version; int version;
// passed through R_RenderFrame (0 - use engine renderer, 1 - use custom client renderer) // passed through R_RenderFrame (0 - use engine renderer, 1 - use custom client renderer)
int (*GL_RenderFrame)( const struct ref_params_s *pparams, qboolean drawWorld ); int (*GL_RenderFrame)( const struct ref_params_s *pparams, qboolean drawWorld );
// build all the lightmaps on new level or when gamma is changed // build all the lightmaps on new level or when gamma is changed
void (*GL_BuildLightmaps)( void ); void (*GL_BuildLightmaps)( void );
// setup map bounds for ortho-projection when we in dev_overview mode // setup map bounds for ortho-projection when we in dev_overview mode
void (*GL_OrthoBounds)( const float *mins, const float *maxs ); void (*GL_OrthoBounds)( const float *mins, const float *maxs );
// handle decals which hit mod_studio or mod_sprite // handle decals which hit mod_studio or mod_sprite
void (*R_StudioDecalShoot)( int decalTexture, struct cl_entity_s *ent, const float *start, const float *pos, int flags, modelstate_t *state ); void (*R_StudioDecalShoot)( int decalTexture, struct cl_entity_s *ent, const float *start, const float *pos, int flags, modelstate_t *state );
// prepare studio decals for save // prepare studio decals for save
int (*R_CreateStudioDecalList)( decallist_t *pList, int count, qboolean changelevel ); int (*R_CreateStudioDecalList)( decallist_t *pList, int count, qboolean changelevel );
// clear decals by engine request (e.g. for demo recording or vid_restart) // clear decals by engine request (e.g. for demo recording or vid_restart)
void (*R_ClearStudioDecals)( void ); void (*R_ClearStudioDecals)( void );
// grab r_speeds message // grab r_speeds message
qboolean (*R_SpeedsMessage)( char *out, size_t size ); qboolean (*R_SpeedsMessage)( char *out, size_t size );
// replace with built-in R_DrawCubemapView for make skyshots or envshots // replace with built-in R_DrawCubemapView for make skyshots or envshots
qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size ); qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size );
// alloc or destroy studiomodel custom data // alloc or destroy studiomodel custom data
void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer ); void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer );
} render_interface_t; } render_interface_t;
#endif//RENDER_API_H #endif//RENDER_API_H

View File

@ -1,29 +1,29 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from * object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited * Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#ifndef SCREENFADE_H #ifndef SCREENFADE_H
#define SCREENFADE_H #define SCREENFADE_H
typedef struct screenfade_s typedef struct screenfade_s
{ {
float fadeSpeed; // How fast to fade (tics / second) (+ fade in, - fade out) float fadeSpeed; // How fast to fade (tics / second) (+ fade in, - fade out)
float fadeEnd; // When the fading hits maximum float fadeEnd; // When the fading hits maximum
float fadeTotalEnd; // Total End Time of the fade (used for FFADE_OUT) float fadeTotalEnd; // Total End Time of the fade (used for FFADE_OUT)
float fadeReset; // When to reset to not fading (for fadeout and hold) float fadeReset; // When to reset to not fading (for fadeout and hold)
byte fader, fadeg, fadeb, fadealpha; // Fade color byte fader, fadeg, fadeb, fadealpha; // Fade color
int fadeFlags; // Fading flags int fadeFlags; // Fading flags
} screenfade_t; } screenfade_t;
#endif//SCREENFADE_H #endif//SCREENFADE_H

Some files were not shown because too many files have changed in this diff Show More