diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index 988bd6fa..860cde42 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -877,11 +877,11 @@ int CHudAmmo::Draw( float flTime ) x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth; x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b ); - wrect_t rc; + /*wrect_t rc; rc.top = 0; rc.left = 0; rc.right = AmmoWidth; - rc.bottom = 100; + rc.bottom = 100;*/ int iBarWidth = AmmoWidth / 10; diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index cc693b88..e50de419 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -41,7 +41,7 @@ COM_Log Log debug messages to file ( appends ) ==================== */ -void COM_Log( char *pszFile, char *fmt, ... ) +void COM_Log( const char *pszFile, const char *fmt, ... ) { va_list argptr; char string[1024]; @@ -111,7 +111,7 @@ HUD_PlaySound Play a sound, if we are seeing this command for the first time ===================== */ -void HUD_PlaySound( char *sound, float volume ) +void HUD_PlaySound( const char *sound, float volume ) { if( !g_runfuncs || !g_finalstate ) return; @@ -268,12 +268,12 @@ stub functions for such things as precaching. So we don't have to modify weapon is compiled into both game and client .dlls. ====================== */ -int stub_PrecacheModel( char* s ) +int stub_PrecacheModel( const char* s ) { return 0; } -int stub_PrecacheSound( char* s ) +int stub_PrecacheSound( const char* s ) { return 0; } diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index 4dd75203..8559e20b 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -20,7 +20,7 @@ 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 COM_Log( char *pszFile, char *fmt, ... ); +void COM_Log( const char *pszFile, const char *fmt, ... ); int CL_IsDead( void ); float UTIL_SharedRandomFloat( unsigned int seed, float low, float high ); @@ -28,11 +28,11 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high ); int HUD_GetWeaponAnim( void ); void HUD_SendWeaponAnim( int iAnim, int body, int force ); -void HUD_PlaySound( char *sound, float volume ); +void HUD_PlaySound( const 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_SetMaxSpeed( const struct edict_s *ed, float speed ); -int stub_PrecacheModel( char* s ); -int stub_PrecacheSound( char* s ); +int stub_PrecacheModel( const char* s ); +int stub_PrecacheSound( const char* s ); unsigned short stub_PrecacheEvent( int type, const char *s ); const char *stub_NameForFunction( unsigned int function ); void stub_SetModel( struct edict_s *e, const char *m ); diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index 455dfd36..579fc255 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -187,7 +187,8 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu gHUD.m_Scoreboard.GetAllPlayersInfo(); // Get the Killer's name - char *killer_name = g_PlayerInfoList[killer].name; + const char *killer_name = ""; + killer_name = g_PlayerInfoList[killer].name; if( !killer_name ) { killer_name = ""; @@ -201,11 +202,11 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu } // Get the Victim's name - char *victim_name = NULL; + const char *victim_name = ""; // 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; - if ( !victim_name ) + if( !victim_name ) { victim_name = ""; rgDeathNoticeList[i].szVictim[0] = 0; @@ -218,7 +219,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu } // Is it a non-player object kill? - if ( ( (char)victim ) == -1 ) + if( ( (char)victim ) == -1 ) { rgDeathNoticeList[i].iNonPlayerKill = TRUE; @@ -227,10 +228,10 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu } else { - if ( killer == victim || killer == 0 ) + if( killer == victim || killer == 0 ) rgDeathNoticeList[i].iSuicide = TRUE; - if ( !strcmp( killedwith, "d_teammate" ) ) + if( !strcmp( killedwith, "d_teammate" ) ) rgDeathNoticeList[i].iTeamKill = TRUE; } @@ -285,7 +286,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu // replace the code names with the 'real' names if( !strcmp( killedwith + 2, "egon" ) ) strcpy( killedwith, "d_gluon gun" ); - if ( !strcmp( killedwith + 2, "gauss" ) ) + if( !strcmp( killedwith + 2, "gauss" ) ) strcpy( killedwith, "d_tau cannon" ); ConsolePrint( killedwith + 2 ); // skip over the "d_" part diff --git a/cl_dll/entity.cpp b/cl_dll/entity.cpp index 07bd0ff3..303a9d25 100644 --- a/cl_dll/entity.cpp +++ b/cl_dll/entity.cpp @@ -585,10 +585,10 @@ void DLLEXPORT HUD_TempEntUpdate ( static int gTempEntFrame = 0; int i; TEMPENTITY *pTemp, *pnext, *pprev; - float freq, gravity, gravitySlow, life, fastFreq; + float /*freq,*/ gravity, gravitySlow, life, fastFreq; // Nothing to simulate - if ( !*ppTempEntActive ) + if( !*ppTempEntActive ) return; // in order to have tents collide with players, we have to run the player prediction code so @@ -601,7 +601,7 @@ void DLLEXPORT HUD_TempEntUpdate ( gEngfuncs.pEventAPI->EV_PushPMStates(); // Now add in all of the players. - gEngfuncs.pEventAPI->EV_SetSolidPlayers( -1 ); + gEngfuncs.pEventAPI->EV_SetSolidPlayers( -1 ); // !!!BUGBUG -- This needs to be time based gTempEntFrame = ( gTempEntFrame + 1 ) & 31; @@ -623,7 +623,7 @@ void DLLEXPORT HUD_TempEntUpdate ( } pprev = NULL; - freq = client_time * 0.01; + //freq = client_time * 0.01; fastFreq = client_time * 5.5; gravity = -frametime * cl_gravity; gravitySlow = gravity * 0.5; @@ -709,12 +709,12 @@ void DLLEXPORT HUD_TempEntUpdate ( } else if( pTemp->flags & FTENT_SPIRAL ) { - float s, c; + /*float s, c; s = sin( pTemp->entity.baseline.origin[2] + fastFreq ); - c = cos( pTemp->entity.baseline.origin[2] + fastFreq ); + c = cos( pTemp->entity.baseline.origin[2] + fastFreq );*/ - pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (int)(size_t)pTemp ); - pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (int)(size_t)pTemp ); + pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (size_t)pTemp ); + pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (size_t)pTemp ); pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime; } else diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 9787a839..787e1be8 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -94,7 +94,7 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v char chTextureType = CHAR_TEX_CONCRETE; float fvol; float fvolbar; - char *rgsz[4]; + const char *rgsz[4]; int cnt; float fattn = ATTN_NORM; int entity; @@ -568,7 +568,7 @@ void EV_FireShotGunDouble( event_args_t *args ) vec3_t vecSrc, vecAiming; vec3_t vecSpread; vec3_t up, right, forward; - float flSpread = 0.01; + //float flSpread = 0.01; idx = args->entindex; VectorCopy( args->origin, origin ); @@ -622,7 +622,7 @@ void EV_FireShotGunSingle( event_args_t *args ) vec3_t vecSrc, vecAiming; vec3_t vecSpread; vec3_t up, right, forward; - float flSpread = 0.01; + //float flSpread = 0.01; idx = args->entindex; VectorCopy( args->origin, origin ); @@ -679,7 +679,7 @@ void EV_FireMP5( event_args_t *args ) int shell; vec3_t vecSrc, vecAiming; vec3_t up, right, forward; - float flSpread = 0.01; + //float flSpread = 0.01; idx = args->entindex; VectorCopy( args->origin, origin ); @@ -769,7 +769,7 @@ void EV_FirePython( event_args_t *args ) vec3_t vecSrc, vecAiming; vec3_t up, right, forward; - float flSpread = 0.01; + //float flSpread = 0.01; idx = args->entindex; VectorCopy( args->origin, origin ); @@ -860,16 +860,16 @@ void EV_FireGauss( event_args_t *args ) vec3_t angles; vec3_t velocity; float flDamage = args->fparam1; - int primaryfire = args->bparam1; + //int primaryfire = args->bparam1; int m_fPrimaryFire = args->bparam1; - int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME; + //int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME; vec3_t vecSrc; vec3_t vecDest; - edict_t *pentIgnore; + //edict_t *pentIgnore; pmtrace_t tr, beam_tr; float flMaxFrac = 1.0; - int nTotal = 0; + //int nTotal = 0; int fHasPunched = 0; int fFirstBeam = 1; int nMaxHits = 10; @@ -980,7 +980,7 @@ void EV_FireGauss( event_args_t *args ) { float n; - pentIgnore = NULL; + //pentIgnore = NULL; n = -DotProduct( tr.plane.normal, forward ); @@ -1412,12 +1412,12 @@ BEAM *pBeam2; void EV_EgonFire( event_args_t *args ) { - int idx, iFireState, iFireMode; + int idx, /*iFireState,*/ iFireMode; vec3_t origin; idx = args->entindex; VectorCopy( args->origin, origin ); - iFireState = args->iparam1; + //iFireState = args->iparam1; iFireMode = args->iparam2; int iStartup = args->bparam1; @@ -1539,13 +1539,13 @@ enum hgun_e void EV_HornetGunFire( event_args_t *args ) { - int idx, iFireMode; + int idx; //, iFireMode; vec3_t origin, angles, vecSrc, forward, right, up; idx = args->entindex; VectorCopy( args->origin, origin ); VectorCopy( args->angles, angles ); - iFireMode = args->iparam1; + //iFireMode = args->iparam1; //Only play the weapon anims if I shot it. if( EV_IsLocal( idx ) ) @@ -1554,7 +1554,7 @@ void EV_HornetGunFire( event_args_t *args ) gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 ); } - switch( gEngfuncs.pfnRandomLong( 0 , 2 ) ) + switch( gEngfuncs.pfnRandomLong( 0, 2 ) ) { case 0: gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 ); diff --git a/cl_dll/geiger.cpp b/cl_dll/geiger.cpp index 7ccaf1d3..097889b9 100644 --- a/cl_dll/geiger.cpp +++ b/cl_dll/geiger.cpp @@ -65,7 +65,7 @@ int CHudGeiger::Draw( float flTime ) { int pct; float flvol = 0.0f; - int rg[3]; + //int rg[3]; int i; if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 ) @@ -79,61 +79,61 @@ int CHudGeiger::Draw( float flTime ) { pct = 2; flvol = 0.4; //Con_Printf( "range > 600\n" ); - rg[0] = 1; - rg[1] = 1; + //rg[0] = 1; + //rg[1] = 1; i = 2; } else if( m_iGeigerRange > 500 ) { pct = 4; flvol = 0.5; //Con_Printf( "range > 500\n" ); - rg[0] = 1; - rg[1] = 2; + //rg[0] = 1; + //rg[1] = 2; i = 2; } else if( m_iGeigerRange > 400 ) { pct = 8; flvol = 0.6; //Con_Printf( "range > 400\n" ); - rg[0] = 1; - rg[1] = 2; - rg[2] = 3; + //rg[0] = 1; + //rg[1] = 2; + //rg[2] = 3; i = 3; } else if( m_iGeigerRange > 300 ) { pct = 8; flvol = 0.7; //Con_Printf( "range > 300\n" ); - rg[0] = 2; - rg[1] = 3; - rg[2] = 4; + //rg[0] = 2; + //rg[1] = 3; + //rg[2] = 4; i = 3; } else if( m_iGeigerRange > 200 ) { pct = 28; flvol = 0.78; //Con_Printf( "range > 200\n" ); - rg[0] = 2; - rg[1] = 3; - rg[2] = 4; + //rg[0] = 2; + //rg[1] = 3; + //rg[2] = 4; i = 3; } else if( m_iGeigerRange > 150 ) { pct = 40; flvol = 0.80; //Con_Printf( "range > 150\n" ); - rg[0] = 3; - rg[1] = 4; - rg[2] = 5; + //rg[0] = 3; + //rg[1] = 4; + //rg[2] = 5; i = 3; } else if( m_iGeigerRange > 100 ) { pct = 60; flvol = 0.85; //Con_Printf( "range > 100\n" ); - rg[0] = 3; - rg[1] = 4; - rg[2] = 5; + //rg[0] = 3; + //rg[1] = 4; + //rg[2] = 5; i = 3; } else if( m_iGeigerRange > 75 ) @@ -141,29 +141,29 @@ int CHudGeiger::Draw( float flTime ) pct = 80; flvol = 0.9; //Con_Printf( "range > 75\n" ); //gflGeigerDelay = cl.time + GEIGERDELAY * 0.75; - rg[0] = 4; - rg[1] = 5; - rg[2] = 6; + //rg[0] = 4; + //rg[1] = 5; + //rg[2] = 6; i = 3; } else if( m_iGeigerRange > 50 ) { pct = 90; flvol = 0.95; //Con_Printf( "range > 50\n" ); - rg[0] = 5; - rg[1] = 6; + //rg[0] = 5; + //rg[1] = 6; i = 2; } else { pct = 95; flvol = 1.0; //Con_Printf( "range < 50\n" ); - rg[0] = 5; - rg[1] = 6; + //rg[0] = 5; + //rg[1] = 6; 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 ) { diff --git a/cl_dll/hl/hl_baseentity.cpp b/cl_dll/hl/hl_baseentity.cpp index fc306838..d24c0ef4 100644 --- a/cl_dll/hl/hl_baseentity.cpp +++ b/cl_dll/hl/hl_baseentity.cpp @@ -54,7 +54,7 @@ int CBaseEntity::IsDormant( void ) { return 0; } BOOL CBaseEntity::IsInWorld( void ) { return TRUE; } int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; } 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( const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; } void CBaseEntity::SUB_Remove( void ) { } // CBaseDelay Stubs @@ -146,7 +146,7 @@ int CBaseMonster::CheckEnemy( CBaseEntity *pEnemy ) { return 0; } void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { } BOOL CBaseMonster::PopEnemy() { return FALSE; } void CBaseMonster::SetActivity( Activity NewActivity ) { } -void CBaseMonster::SetSequenceByName( char *szSequence ) { } +void CBaseMonster::SetSequenceByName( const char *szSequence ) { } int CBaseMonster::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; } float CBaseMonster::OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; } void CBaseMonster::AdvanceRoute( float distance ) { } @@ -214,7 +214,7 @@ void CBaseMonster::MonsterInitDead( void ) { } BOOL CBaseMonster::BBoxFlat( void ) { return TRUE; } BOOL CBaseMonster::GetEnemy( void ) { return FALSE; } 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( const char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; } BOOL CBaseMonster::ShouldFadeOnDeath( void ) { return FALSE; } 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 ) { } @@ -258,8 +258,8 @@ void CBasePlayer::PreThink(void) { } void CBasePlayer::CheckTimeBasedDamage() { } void CBasePlayer::UpdateGeigerCounter( void ) { } void CBasePlayer::CheckSuitUpdate() { } -void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) { } -void CBasePlayer::UpdatePlayerSound ( void ) { } +void CBasePlayer::SetSuitUpdate( const char *name, int fgroup, int iNoRepeatTime ) { } +void CBasePlayer::UpdatePlayerSound( void ) { } void CBasePlayer::PostThink() { } void CBasePlayer::Precache( void ) { } int CBasePlayer::Save( CSave &save ) { return 0; } @@ -298,7 +298,7 @@ BOOL CBasePlayer::HasPlayerItem( CBasePlayerItem *pCheckItem ) { return FALSE; } BOOL CBasePlayer::SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; } Vector CBasePlayer::GetGunPosition( void ) { return g_vecZero; } const char *CBasePlayer::TeamID( void ) { return ""; } -int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax ) { return 0; } +int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax ) { return 0; } void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) { } void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { } diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 8c6909e3..8f8baea7 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -75,7 +75,7 @@ AlertMessage Print debug messages to console ====================== */ -void AlertMessage( ALERT_TYPE atype, char *szFmt, ... ) +void AlertMessage( ALERT_TYPE atype, const char *szFmt, ... ) { va_list argptr; static char string[1024]; @@ -96,7 +96,7 @@ bool bIsMultiplayer( void ) } //Just loads a v_ model. -void LoadVModel( char *szViewModel, CBasePlayer *m_pPlayer ) +void LoadVModel( const char *szViewModel, CBasePlayer *m_pPlayer ) { gEngfuncs.CL_LoadModel( szViewModel, &m_pPlayer->pev->viewmodel ); } @@ -208,7 +208,7 @@ CBasePlayerWeapon::DefaultDeploy ===================== */ -BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal, int body ) +BOOL CBasePlayerWeapon::DefaultDeploy( const char *szViewModel, const char *szWeaponModel, int iAnim, const char *szAnimExt, int skiplocal, int body ) { if( !CanDeploy() ) return FALSE; @@ -288,7 +288,7 @@ Only produces random numbers to match the server ones. */ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand ) { - float x = 0, y = 0, z; + float x = 0.0f, y = 0.0f, z; for( ULONG iShot = 1; iShot <= cShots; iShot++ ) { diff --git a/cl_dll/hud.h b/cl_dll/hud.h index ec236003..ab179bbb 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -480,7 +480,7 @@ public: int Init( void ); static char *LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size ); static char *BufferedLocaliseTextString( const char *msg ); - char *LookupString( const char *msg_name, int *msg_dest = NULL ); + const char *LookupString( const char *msg_name, int *msg_dest = NULL ); int MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf ); }; @@ -541,8 +541,8 @@ public: //had to make these public so CHud could access them (to enable concussion icon) //could use a friend declaration instead... - void EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue ); - void DisableIcon( char *pszIconName ); + void EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue ); + void DisableIcon( const char *pszIconName ); private: typedef struct @@ -588,11 +588,11 @@ public: int m_iFontHeight; int DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b ); - int DrawHudString( int x, int y, int iMaxX, char *szString, int r, int g, int b ); - int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ); + int DrawHudString( int x, int y, int iMaxX, const char *szString, int r, int g, int b ); + int DrawHudStringReverse( int xpos, int ypos, int iMinX, const char *szString, int r, int g, int b ); int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ); int GetNumWidth( int iNumber, int iFlags ); - int DrawHudStringLen( char *szIt ); + int DrawHudStringLen( const char *szIt ); void DrawDarkRectangle( int x, int y, int wide, int tall ); private: diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index c30df36d..5182b484 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -199,7 +199,7 @@ const unsigned char colors[8][3] = {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, const char *szIt, int r, int g, int b ) { if( hud_textmode->value == 2 ) { @@ -233,9 +233,7 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g return xpos; } - - -int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b ) +int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b ) { // xash3d: reset unicode state gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 ); @@ -262,7 +260,7 @@ int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int return xpos; } -int CHud::DrawHudStringLen( char *szIt ) +int CHud::DrawHudStringLen( const char *szIt ) { int l = 0; for( ; *szIt != 0 && *szIt != '\n'; szIt++ ) @@ -280,7 +278,7 @@ int CHud::DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r } // 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, const char *szString, int r, int g, int b ) { // find the end of the string for( char *szIt = szString; *szIt != 0; szIt++ ) diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index 5d52d413..ff8d97bf 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -29,7 +29,7 @@ DECLARE_MESSAGE( m_Message, GameTitle ) // 1 Global client_textmessage_t for custom messages that aren't in the titles.txt client_textmessage_t g_pCustomMessage; -char *g_pCustomName = "Custom"; +const char *g_pCustomName = "Custom"; char g_pCustomText[1024]; int CHudMessage::Init( void ) @@ -260,7 +260,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time ) width = 0; } else - width += gHUD.m_scrinfo.charWidths[*pText]; + width += gHUD.m_scrinfo.charWidths[(unsigned char)*pText]; pText++; length++; } @@ -310,7 +310,7 @@ int CHudMessage::Draw( float fTime ) { int i, drawn; client_textmessage_t *pMessage; - float endTime = 0; + float endTime = 0.0f; drawn = 0; diff --git a/cl_dll/status_icons.cpp b/cl_dll/status_icons.cpp index c960d5ef..4b2d9726 100644 --- a/cl_dll/status_icons.cpp +++ b/cl_dll/status_icons.cpp @@ -104,7 +104,7 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p } // 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( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue ) { int i; @@ -149,7 +149,7 @@ void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned } } -void CHudStatusIcons::DisableIcon( char *pszIconName ) +void CHudStatusIcons::DisableIcon( const char *pszIconName ) { // find the sprite is in the current list for( int i = 0; i < MAX_ICONSPRITES; i++ ) diff --git a/cl_dll/text_message.cpp b/cl_dll/text_message.cpp index af62a915..13b62577 100644 --- a/cl_dll/text_message.cpp +++ b/cl_dll/text_message.cpp @@ -45,7 +45,7 @@ int CHudTextMessage::Init( void ) char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size ) { char *dst = dst_buffer; - for( char *src = (char*)msg; *src != 0 && buffer_size > 0; buffer_size-- ) + for( char *src = msg; *src != 0 && buffer_size > 0; buffer_size-- ) { if( *src == '#' ) { @@ -91,12 +91,12 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in char *CHudTextMessage::BufferedLocaliseTextString( const char *msg ) { static char dst_buffer[1024]; - LocaliseTextString( msg, dst_buffer, 1024 ); + LocaliseTextString( msg, dst_buffer, sizeof(dst_buffer) ); return dst_buffer; } // Simplified version of LocaliseTextString; assumes string is only one word -char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) +const char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) { if( !msg ) return ""; @@ -108,7 +108,7 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) client_textmessage_t *clmsg = TextMessageGet( msg + 1 ); if( !clmsg || !(clmsg->pMessage) ) - return (char*)msg; // lookup failed, so return the original string + return msg; // lookup failed, so return the original string if( msg_dest ) { @@ -118,12 +118,12 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) *msg_dest = -clmsg->effect; } - return (char*)clmsg->pMessage; + return clmsg->pMessage; } else { // nothing special about this message, so just return the same string - return (char*)msg; + return msg; } } @@ -167,16 +167,16 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf msg_text = strcpy( szBuf[0], msg_text ); // keep reading strings and using C format strings for subsituting the strings into the localised text string - char *sstr1 = LookupString( READ_STRING() ); + const char *sstr1 = LookupString( READ_STRING() ); sstr1 = strcpy( szBuf[1], sstr1 ); StripEndNewlineFromString( sstr1 ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines - char *sstr2 = LookupString( READ_STRING() ); + const char *sstr2 = LookupString( READ_STRING() ); sstr2 = strcpy( szBuf[2], sstr2 ); StripEndNewlineFromString( sstr2 ); - char *sstr3 = LookupString( READ_STRING() ); + const char *sstr3 = LookupString( READ_STRING() ); sstr3 = strcpy( szBuf[3], sstr3 ); StripEndNewlineFromString( sstr3 ); - char *sstr4 = LookupString( READ_STRING() ); + const char *sstr4 = LookupString( READ_STRING() ); sstr4 = strcpy( szBuf[4], sstr4 ); StripEndNewlineFromString( sstr4 ); char *psz = szBuf[5]; diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index b581cc82..dcd2b1af 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -351,11 +351,11 @@ V_CalcIntermissionRefdef */ void V_CalcIntermissionRefdef( struct ref_params_s *pparams ) { - cl_entity_t *ent, *view; + cl_entity_t /**ent,*/ *view; float old; // ent is the player model ( visible when out of body ) - ent = gEngfuncs.GetLocalPlayer(); + //ent = gEngfuncs.GetLocalPlayer(); // view is the weapon model (only visible from inside body ) view = gEngfuncs.GetViewModel(); @@ -1307,7 +1307,7 @@ void V_GetMapChasePosition( int target, float *cl_angles, float *origin, float * int V_FindViewModelByWeaponModel( int weaponindex ) { - static char *modelmap[][2] = + static const char *modelmap[][2] = { { "models/p_crossbow.mdl", "models/v_crossbow.mdl" }, { "models/p_crowbar.mdl", "models/v_crowbar.mdl" }, @@ -1327,7 +1327,7 @@ int V_FindViewModelByWeaponModel( int weaponindex ) { NULL, NULL } }; - struct model_s * weaponModel = IEngineStudio.GetModelByIndex( weaponindex ); + struct model_s *weaponModel = IEngineStudio.GetModelByIndex( weaponindex ); if( weaponModel ) { diff --git a/common/cvardef.h b/common/cvardef.h index c57b97a7..e8a24581 100644 --- a/common/cvardef.h +++ b/common/cvardef.h @@ -28,8 +28,8 @@ typedef struct cvar_s { - char *name; - char *string; + const char *name; + const char *string; int flags; float value; struct cvar_s *next; diff --git a/dlls/activity.h b/dlls/activity.h index 58b2d8cd..5382d70d 100644 --- a/dlls/activity.h +++ b/dlls/activity.h @@ -99,7 +99,7 @@ typedef enum { typedef struct { int type; - char *name; + const char *name; } activity_map_t; extern activity_map_t activity_map[]; diff --git a/dlls/activitymap.h b/dlls/activitymap.h index 92cadae7..5f77c55a 100644 --- a/dlls/activitymap.h +++ b/dlls/activitymap.h @@ -93,5 +93,5 @@ _A( ACT_FLINCH_LEFTARM ), _A( ACT_FLINCH_RIGHTARM ), _A( ACT_FLINCH_LEFTLEG ), _A( ACT_FLINCH_RIGHTLEG ), -0, NULL +{ 0, NULL } }; diff --git a/dlls/aflock.cpp b/dlls/aflock.cpp index 1e317632..19998a9d 100644 --- a/dlls/aflock.cpp +++ b/dlls/aflock.cpp @@ -567,7 +567,6 @@ void CFlockingFlyer::FlockLeaderThink( void ) TraceResult tr; Vector vecDist;// used for general measurements Vector vecDir;// used for general measurements - int cProcessed = 0;// keep track of how many other boids we've processed float flLeftSide; float flRightSide; diff --git a/dlls/agrunt.cpp b/dlls/agrunt.cpp index 97804f68..c6583fb7 100644 --- a/dlls/agrunt.cpp +++ b/dlls/agrunt.cpp @@ -608,7 +608,7 @@ void CAGrunt::Spawn() //========================================================= void CAGrunt::Precache() { - int i; + size_t i; PRECACHE_MODEL( "models/agrunt.mdl" ); @@ -909,7 +909,7 @@ BOOL CAGrunt::FCanCheckAttacks( void ) //========================================================= BOOL CAGrunt::CheckMeleeAttack1( float flDot, float flDist ) { - if( HasConditions( bits_COND_SEE_ENEMY ) && flDist <= AGRUNT_MELEE_DIST && flDot >= 0.6 && m_hEnemy != NULL ) + if( HasConditions( bits_COND_SEE_ENEMY ) && flDist <= AGRUNT_MELEE_DIST && flDot >= 0.6 && m_hEnemy != 0 ) { return TRUE; } @@ -1160,7 +1160,7 @@ Schedule_t *CAGrunt::GetScheduleOfType( int Type ) case SCHED_FAIL: // no fail schedule specified, so pick a good generic one. { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { // I have an enemy // !!!LATER - what if this enemy is really far away and i'm chasing him? diff --git a/dlls/animation.cpp b/dlls/animation.cpp index 86cb78ae..5454f0e8 100644 --- a/dlls/animation.cpp +++ b/dlls/animation.cpp @@ -268,8 +268,6 @@ int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEve if( !pstudiohdr || pev->sequence >= pstudiohdr->numseq || !pMonsterEvent ) return 0; - int events = 0; - mstudioseqdesc_t *pseqdesc; mstudioevent_t *pevent; @@ -351,7 +349,7 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu } } - int setting = 255 * ( flValue - pbonecontroller->start ) / ( pbonecontroller->end - pbonecontroller->start ); + int setting = (int)( 255 * ( flValue - pbonecontroller->start ) / ( pbonecontroller->end - pbonecontroller->start ) ); if( setting < 0 ) setting = 0; @@ -393,7 +391,7 @@ float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue ) } } - int setting = 255 * ( flValue - pseqdesc->blendstart[iBlender] ) / ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] ); + int setting = (int)( 255 * ( flValue - pseqdesc->blendstart[iBlender] ) / ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] ) ); if( setting < 0 ) setting = 0; diff --git a/dlls/apache.cpp b/dlls/apache.cpp index b64a8bae..aeeea30e 100644 --- a/dlls/apache.cpp +++ b/dlls/apache.cpp @@ -458,7 +458,7 @@ void CApache::HuntThink( void ) if( m_flGoalSpeed < 800 ) m_flGoalSpeed += 5; - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { // ALERT( at_console, "%s\n", STRING( m_hEnemy->pev->classname ) ); if( FVisible( m_hEnemy ) ) @@ -552,7 +552,7 @@ void CApache::HuntThink( void ) { if( m_flLastSeen + 60 > gpGlobals->time ) { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { // make sure it's a good shot if( DotProduct( m_vecTarget, vecEst ) > .965 ) @@ -732,7 +732,6 @@ void CApache::Flight( void ) void CApache::FireRocket( void ) { static float side = 1.0; - static int count; if( m_iRockets <= 0 ) return; diff --git a/dlls/barnacle.cpp b/dlls/barnacle.cpp index 1e2aa785..ecc1f5d4 100644 --- a/dlls/barnacle.cpp +++ b/dlls/barnacle.cpp @@ -170,7 +170,7 @@ void CBarnacle::BarnacleThink( void ) #endif pev->nextthink = gpGlobals->time + 0.1; - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { // barnacle has prey. if( !m_hEnemy->IsAlive() ) @@ -183,7 +183,7 @@ void CBarnacle::BarnacleThink( void ) if( m_fLiftingPrey ) { - if( m_hEnemy != NULL && m_hEnemy->pev->deadflag != DEAD_NO ) + if( m_hEnemy != 0 && m_hEnemy->pev->deadflag != DEAD_NO ) { // crap, someone killed the prey on the way up. m_hEnemy = NULL; @@ -352,7 +352,7 @@ void CBarnacle::Killed( entvars_t *pevAttacker, int iGib ) pev->solid = SOLID_NOT; pev->takedamage = DAMAGE_NO; - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { pVictim = m_hEnemy->MyMonsterPointer(); diff --git a/dlls/barney.cpp b/dlls/barney.cpp index b1c97090..3fc5aef0 100644 --- a/dlls/barney.cpp +++ b/dlls/barney.cpp @@ -221,7 +221,7 @@ void CBarney::RunTask( Task_t *pTask ) switch( pTask->iTask ) { case TASK_RANGE_ATTACK1: - if( m_hEnemy != NULL && ( m_hEnemy->IsPlayer() ) ) + if( m_hEnemy != 0 && ( m_hEnemy->IsPlayer() ) ) { pev->framerate = 1.5; } @@ -262,7 +262,7 @@ int CBarney::Classify( void ) //========================================================= void CBarney::AlertSound( void ) { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { if( FOkToSpeak() ) { @@ -504,7 +504,7 @@ int CBarney::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float // This is a heurstic to determine if the player intended to harm me // If I have an enemy, we can't establish intent (may just be crossfire) - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { // If the player was facing directly at me, or I'm already suspicious, get mad if( ( m_afMemory & bits_MEMORY_SUSPICIOUS ) || IsFacing( pevAttacker, pev->origin ) ) @@ -616,7 +616,7 @@ void CBarney::Killed( entvars_t *pevAttacker, int iGib ) GetAttachment( 0, vecGunPos, vecGunAngles ); - CBaseEntity *pGun = DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles ); + DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles ); } SetUse( NULL ); @@ -633,7 +633,7 @@ Schedule_t *CBarney::GetScheduleOfType( int Type ) switch( Type ) { case SCHED_ARM_WEAPON: - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { // face enemy, then draw. return slBarneyEnemyDraw; @@ -721,7 +721,7 @@ Schedule_t *CBarney::GetSchedule( void ) return GetScheduleOfType( SCHED_SMALL_FLINCH ); } - if( m_hEnemy == NULL && IsFollowing() ) + if( m_hEnemy == 0 && IsFollowing() ) { if( !m_hTargetEnt->IsAlive() ) { @@ -783,10 +783,10 @@ public: void KeyValue( KeyValueData *pkvd ); int m_iPose;// which sequence to display -- temporary, don't need to save - static char *m_szPoses[3]; + static const char *m_szPoses[3]; }; -char *CDeadBarney::m_szPoses[] = { "lying_on_back", "lying_on_side", "lying_on_stomach" }; +const char *CDeadBarney::m_szPoses[] = { "lying_on_back", "lying_on_side", "lying_on_stomach" }; void CDeadBarney::KeyValue( KeyValueData *pkvd ) { diff --git a/dlls/basemonster.h b/dlls/basemonster.h index ad05fccf..0d22104f 100644 --- a/dlls/basemonster.h +++ b/dlls/basemonster.h @@ -195,7 +195,7 @@ public: Task_t *GetTask( void ); virtual MONSTERSTATE GetIdealState( void ); virtual void SetActivity( Activity NewActivity ); - void SetSequenceByName( char *szSequence ); + void SetSequenceByName( const char *szSequence ); void SetState( MONSTERSTATE State ); virtual void ReportAIState( void ); @@ -327,6 +327,6 @@ public: BOOL ExitScriptedSequence(); BOOL CineCleanup(); - CBaseEntity* DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item. + CBaseEntity* DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item. }; #endif // BASEMONSTER_H diff --git a/dlls/bigmomma.cpp b/dlls/bigmomma.cpp index 59f6cae2..a038c776 100644 --- a/dlls/bigmomma.cpp +++ b/dlls/bigmomma.cpp @@ -677,7 +677,7 @@ void CBigMomma::Precache() void CBigMomma::Activate( void ) { - if( m_hTargetEnt == NULL ) + if( m_hTargetEnt == 0 ) Remember( bits_MEMORY_ADVANCE_NODE ); // Start 'er up } @@ -985,7 +985,7 @@ void CBigMomma::RunTask( Task_t *pTask ) { float distance; - if( m_hTargetEnt == NULL ) + if( m_hTargetEnt == 0 ) TaskFail(); else { @@ -1002,7 +1002,7 @@ void CBigMomma::RunTask( Task_t *pTask ) } break; case TASK_WAIT_NODE: - if( m_hTargetEnt != NULL && ( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT ) ) + if( m_hTargetEnt != 0 && ( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT ) ) return; if( gpGlobals->time > m_flWaitFinished ) @@ -1056,7 +1056,6 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot float time = speed / flGravity; vecGrenadeVel = vecSpot2 - vecSpot1; vecGrenadeVel.z = 0; - float distance = vecGrenadeVel.Length(); // Travel half the distance to the target in that time (apex is at the midpoint) vecGrenadeVel = vecGrenadeVel * ( 0.5 / time ); diff --git a/dlls/bmodels.cpp b/dlls/bmodels.cpp index ee676679..6e8526f9 100644 --- a/dlls/bmodels.cpp +++ b/dlls/bmodels.cpp @@ -210,7 +210,7 @@ void CFuncIllusionary::KeyValue( KeyValueData *pkvd ) { if( FStrEq( pkvd->szKeyName, "skin" ) )//skin is used for content type { - pev->skin = atof( pkvd->szValue ); + pev->skin = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else @@ -614,7 +614,7 @@ void CFuncRotating::SpinDown( void ) // stop sound, we're done EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning /* Stop */ ), - 0, 0, SND_STOP, m_pitch ); + 0, 0, SND_STOP, (int)m_pitch ); SetThink( &CFuncRotating::Rotate ); Rotate(); diff --git a/dlls/bullsquid.cpp b/dlls/bullsquid.cpp index 18026b43..af3ab88a 100644 --- a/dlls/bullsquid.cpp +++ b/dlls/bullsquid.cpp @@ -248,7 +248,7 @@ int CBullsquid::IgnoreConditions( void ) iIgnore = bits_COND_SMELL | bits_COND_SMELL_FOOD; } - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { if( FClassnameIs( m_hEnemy->pev, "monster_headcrab" ) ) { @@ -287,7 +287,7 @@ int CBullsquid::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo // if the squid is running, has an enemy, was hurt by the enemy, hasn't been hurt in the last 3 seconds, and isn't too close to the enemy, // it will swerve. (whew). - if( m_hEnemy != NULL && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3 ) + if( m_hEnemy != 0 && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3 ) { flDist = ( pev->origin - m_hEnemy->pev->origin ).Length2D(); @@ -324,7 +324,7 @@ BOOL CBullsquid::CheckRangeAttack1( float flDot, float flDist ) if( flDist > 64 && flDist <= 784 && flDot >= 0.5 && gpGlobals->time >= m_flNextSpitTime ) { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { if( fabs( pev->origin.z - m_hEnemy->pev->origin.z ) > 256 ) { @@ -383,7 +383,7 @@ BOOL CBullsquid::CheckMeleeAttack2( float flDot, float flDist ) //========================================================= BOOL CBullsquid::FValidateHintType( short sHint ) { - int i; + size_t i; static short sSquidHints[] = { @@ -784,7 +784,7 @@ void CBullsquid::RunAI( void ) pev->skin = 1; } - if( m_hEnemy != NULL && m_Activity == ACT_RUN ) + if( m_hEnemy != 0 && m_Activity == ACT_RUN ) { // chasing enemy. Sprint for last bit if( ( pev->origin - m_hEnemy->pev->origin).Length2D() < SQUID_SPRINT_DIST ) @@ -1247,7 +1247,7 @@ MONSTERSTATE CBullsquid::GetIdealState( void ) COMBAT goes to ALERT upon death of enemy */ { - if( m_hEnemy != NULL && ( iConditions & bits_COND_LIGHT_DAMAGE || iConditions & bits_COND_HEAVY_DAMAGE ) && FClassnameIs( m_hEnemy->pev, "monster_headcrab" ) ) + if( m_hEnemy != 0 && ( iConditions & bits_COND_LIGHT_DAMAGE || iConditions & bits_COND_HEAVY_DAMAGE ) && FClassnameIs( m_hEnemy->pev, "monster_headcrab" ) ) { // if the squid has a headcrab enemy and something hurts it, it's going to forget about the crab for a while. m_hEnemy = NULL; diff --git a/dlls/buttons.cpp b/dlls/buttons.cpp index 3027f10e..76f4ad91 100644 --- a/dlls/buttons.cpp +++ b/dlls/buttons.cpp @@ -275,7 +275,7 @@ IMPLEMENT_SAVERESTORE( CBaseButton, CBaseToggle ) void CBaseButton::Precache( void ) { - char *pszSound; + const char *pszSound; if( FBitSet( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )// this button should spark in OFF state { @@ -381,22 +381,22 @@ void CBaseButton::KeyValue( KeyValueData *pkvd ) } else if( FStrEq( pkvd->szKeyName, "locked_sound" ) ) { - m_bLockedSound = atof( pkvd->szValue ); + m_bLockedSound = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) ) { - m_bLockedSentence = atof( pkvd->szValue ); + m_bLockedSentence = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) ) { - m_bUnlockedSound = atof( pkvd->szValue ); + m_bUnlockedSound = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) ) { - m_bUnlockedSentence = atof( pkvd->szValue ); + m_bUnlockedSentence = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "sounds" ) ) @@ -421,7 +421,7 @@ int CBaseButton::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl SetTouch( NULL ); m_hActivator = CBaseEntity::Instance( pevAttacker ); - if( m_hActivator == NULL ) + if( m_hActivator == 0 ) return 0; if( code == BUTTON_RETURN ) @@ -461,7 +461,7 @@ LINK_ENTITY_TO_CLASS( func_button, CBaseButton ) void CBaseButton::Spawn() { - char *pszSound; + const char *pszSound; //---------------------------------------------------- //determine sounds for buttons @@ -527,7 +527,7 @@ void CBaseButton::Spawn() char *ButtonSound( int sound ) { - char *pszSound; + const char *pszSound; switch( sound ) { @@ -869,7 +869,7 @@ LINK_ENTITY_TO_CLASS( func_rot_button, CRotButton ) void CRotButton::Spawn( void ) { - char *pszSound; + const char *pszSound; //---------------------------------------------------- //determine sounds for buttons //a sound of 0 should not make a sound @@ -1010,7 +1010,7 @@ void CMomentaryRotButton::Spawn( void ) UTIL_SetOrigin( pev, pev->origin ); SET_MODEL( ENT( pev ), STRING( pev->model ) ); - char *pszSound = ButtonSound( m_sounds ); + const char *pszSound = ButtonSound( m_sounds ); PRECACHE_SOUND( pszSound ); pev->noise = ALLOC_STRING( pszSound ); m_lastUsed = 0; diff --git a/dlls/cbase.cpp b/dlls/cbase.cpp index 62b4eaa1..0cc10bdb 100644 --- a/dlls/cbase.cpp +++ b/dlls/cbase.cpp @@ -26,7 +26,7 @@ void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd ); extern "C" void PM_Move ( struct playermove_s *ppmove, int server ); extern "C" void PM_Init ( struct playermove_s *ppmove ); -extern "C" char PM_FindTextureType( char *name ); +extern "C" char PM_FindTextureType( const char *name ); extern Vector VecBModelOrigin( entvars_t* pevBModel ); extern DLL_GLOBAL Vector g_vecAttackDir; @@ -739,7 +739,7 @@ int CBaseEntity::DamageDecal( int bitsDamageType ) // NOTE: szName must be a pointer to constant memory, e.g. "monster_class" because the entity // will keep a pointer to it after this call. -CBaseEntity *CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) +CBaseEntity *CBaseEntity::Create( const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { edict_t *pent; CBaseEntity *pEntity; diff --git a/dlls/cbase.h b/dlls/cbase.h index 617bbab9..6c738bf5 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -177,7 +177,7 @@ public: virtual void AddPointsToTeam( int score, BOOL bAllowNegativeScore ) {} virtual BOOL AddPlayerItem( CBasePlayerItem *pItem ) { return 0; } virtual BOOL RemovePlayerItem( CBasePlayerItem *pItem ) { return 0; } - virtual int GiveAmmo( int iAmount, char *szName, int iMax ) { return -1; }; + virtual int GiveAmmo( int iAmount, const char *szName, int iMax ) { return -1; }; virtual float GetDelay( void ) { return 0; } virtual int IsMoving( void ) { return pev->velocity != g_vecZero; } virtual void OverrideReset( void ) {} @@ -314,7 +314,7 @@ public: // used by monsters that are created by the MonsterMaker virtual void UpdateOwner( void ) { return; }; - static CBaseEntity *Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL ); + static CBaseEntity *Create( const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL ); virtual BOOL FBecomeProne( void ) {return FALSE;}; edict_t *edict() { return ENT( pev ); }; @@ -655,8 +655,7 @@ class CSound; #include "basemonster.h" - -char *ButtonSound( int sound ); // get string of button sound number +const char *ButtonSound( int sound ); // get string of button sound number // // Generic Button diff --git a/dlls/client.cpp b/dlls/client.cpp index 72538b02..99f1913b 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -215,7 +215,7 @@ bool Q_IsValidUChar32( unsigned int uVal ) { // Values > 0x10FFFF are explicitly invalid; ditto for UTF-16 surrogate halves, // values ending in FFFE or FFFF, or values in the 0x00FDD0-0x00FDEF reserved range - return ( uVal < 0x110000u ) && ( ( uVal - 0x00D800u ) > 0x7FFu ) && ( ( uVal & 0xFFFFu ) < 0xFFFEu ) && ( ( uVal - 0x00FDD0u ) > 0x1Fu ); + return ( ( uVal - 0x0u ) < 0x110000u ) && ( (uVal - 0x00D800u) > 0x7FFu ) && ( (uVal & 0xFFFFu) < 0xFFFEu ) && ( ( uVal - 0x00FDD0u ) > 0x1Fu ); } // Decode one character from a UTF-8 encoded string. Treats 6-byte CESU-8 sequences @@ -423,7 +423,7 @@ void Host_Say( edict_t *pEntity, int teamonly ) // echo to server console g_engfuncs.pfnServerPrint( text ); - char *temp; + const char *temp; if( teamonly ) temp = "say_team"; else @@ -744,7 +744,6 @@ void PlayerPreThink( edict_t *pEntity ) { //ALERT( at_console, "PreThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime ); - entvars_t *pev = &pEntity->v; CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity ); if( pPlayer ) @@ -762,7 +761,6 @@ void PlayerPostThink( edict_t *pEntity ) { //ALERT( at_console, "PostThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime ); - entvars_t *pev = &pEntity->v; CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity ); if( pPlayer ) @@ -950,7 +948,6 @@ animation right now. */ void PlayerCustomization( edict_t *pEntity, customization_t *pCust ) { - entvars_t *pev = &pEntity->v; CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity ); if( !pPlayer ) @@ -990,7 +987,6 @@ A spectator has joined the game */ void SpectatorConnect( edict_t *pEntity ) { - entvars_t *pev = &pEntity->v; CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity ); if( pPlayer ) @@ -1006,7 +1002,6 @@ A spectator has left the game */ void SpectatorDisconnect( edict_t *pEntity ) { - entvars_t *pev = &pEntity->v; CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity ); if( pPlayer ) @@ -1022,7 +1017,6 @@ A spectator has sent a usercmd */ void SpectatorThink( edict_t *pEntity ) { - entvars_t *pev = &pEntity->v; CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity ); if( pPlayer ) @@ -1235,11 +1229,11 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h } state->rendermode = ent->v.rendermode; - state->renderamt = ent->v.renderamt; + state->renderamt = (int)ent->v.renderamt; state->renderfx = ent->v.renderfx; - state->rendercolor.r = ent->v.rendercolor.x; - state->rendercolor.g = ent->v.rendercolor.y; - state->rendercolor.b = ent->v.rendercolor.z; + state->rendercolor.r = (byte)ent->v.rendercolor.x; + state->rendercolor.g = (byte)ent->v.rendercolor.y; + state->rendercolor.b = (byte)ent->v.rendercolor.z; state->aiment = 0; if( ent->v.aiment ) @@ -1286,7 +1280,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h //state->team = ent->v.team; state->usehull = ( ent->v.flags & FL_DUCKING ) ? 1 : 0; - state->health = ent->v.health; + state->health = (int)ent->v.health; } return 1; @@ -1834,7 +1828,7 @@ ConnectionlessPacket int ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ) { // 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. // If we wanted to response, we'd write data into response_buffer @@ -1888,10 +1882,10 @@ to be created during play ( e.g., grenades, ammo packs, projectiles, corpses, et */ void CreateInstancedBaselines( void ) { - int iret = 0; + /*int iret = 0; entity_state_t state; - memset( &state, 0, sizeof(state) ); + memset( &state, 0, sizeof(state) );*/ // Create any additional baselines here for things like grendates, etc. // iret = ENGINE_INSTANCE_BASELINE( pc->pev->classname, &state ); diff --git a/dlls/combat.cpp b/dlls/combat.cpp index 3a59844f..d8830c20 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -460,11 +460,11 @@ Activity CBaseMonster::GetSmallFlinchActivity( void ) { Activity flinchActivity; BOOL fTriedDirection; - float flDot; + //float flDot; fTriedDirection = FALSE; UTIL_MakeVectors( pev->angles ); - flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 ); + //flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 ); switch( m_LastHitGroup ) { @@ -576,8 +576,8 @@ Killed */ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib ) { - unsigned int cCount = 0; - BOOL fDone = FALSE; + //unsigned int cCount = 0; + //BOOL fDone = FALSE; if( HasMemory( bits_MEMORY_KILLED ) ) { @@ -920,7 +920,7 @@ int CBaseMonster::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, f // enemy's last known position is somewhere down the vector that the attack came from. if( pevInflictor ) { - if( m_hEnemy == NULL || pevInflictor == m_hEnemy->pev || !HasConditions( bits_COND_SEE_ENEMY ) ) + if( m_hEnemy == 0 || pevInflictor == m_hEnemy->pev || !HasConditions( bits_COND_SEE_ENEMY ) ) { m_vecEnemyLKP = pevInflictor->origin; } @@ -1463,7 +1463,7 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin } } // make bullet trails - UTIL_BubbleTrail( vecSrc, tr.vecEndPos, ( flDistance * tr.flFraction ) / 64.0 ); + UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0 ); } ApplyMultiDamage( pev, pevAttacker ); } @@ -1483,7 +1483,8 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi TraceResult tr; Vector vecRight = gpGlobals->v_right; Vector vecUp = gpGlobals->v_up; - float x, y, z; + float x = 0.0f, y = 0.0f; + float z; if( pevAttacker == NULL ) pevAttacker = pev; // the default attacker is ourselves @@ -1497,7 +1498,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi // get circular gaussian spread x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 ); y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 ); - z = x * x + y * y; + //z = x * x + y * y; Vector vecDir = vecDirShooting + x * vecSpread.x * vecRight + @@ -1548,7 +1549,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi } } // make bullet trails - UTIL_BubbleTrail( vecSrc, tr.vecEndPos, ( flDistance * tr.flFraction ) / 64.0 ); + UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0 ) ); } ApplyMultiDamage( pev, pevAttacker ); diff --git a/dlls/controller.cpp b/dlls/controller.cpp index 3d56325f..bfa119d3 100644 --- a/dlls/controller.cpp +++ b/dlls/controller.cpp @@ -614,7 +614,7 @@ void CController::RunTask( Task_t *pTask ) Vector vecSrc = vecHand + pev->velocity * ( m_flShootTime - gpGlobals->time ); Vector vecDir; - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { if( HasConditions( bits_COND_SEE_ENEMY ) ) { @@ -707,7 +707,7 @@ Schedule_t *CController::GetSchedule( void ) { case MONSTERSTATE_COMBAT: { - Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 ); + // Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 ); // dead enemy if( HasConditions( bits_COND_LIGHT_DAMAGE ) ) @@ -1095,7 +1095,6 @@ class CControllerHeadBall : public CBaseMonster void EXPORT BounceTouch( CBaseEntity *pOther ); void MovetoTarget( Vector vecTarget ); void Crawl( void ); - int m_iTrail; int m_flNextAttack; Vector m_vecIdeal; EHANDLE m_hOwner; @@ -1160,7 +1159,7 @@ void CControllerHeadBall::HuntThink( void ) MESSAGE_END(); // check world boundaries - if( gpGlobals->time - pev->dmgtime > 5 || pev->renderamt < 64 || m_hEnemy == NULL || m_hOwner == NULL || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 ) + if( gpGlobals->time - pev->dmgtime > 5 || pev->renderamt < 64 || m_hEnemy == 0 || m_hOwner == 0 || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 ) { SetTouch( NULL ); UTIL_Remove( this ); @@ -1340,7 +1339,7 @@ void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther ) entvars_t *pevOwner; - if( m_hOwner != NULL ) + if( m_hOwner != 0 ) { pevOwner = m_hOwner->pev; } diff --git a/dlls/crossbow.cpp b/dlls/crossbow.cpp index 7a4686e7..d749c785 100644 --- a/dlls/crossbow.cpp +++ b/dlls/crossbow.cpp @@ -425,10 +425,11 @@ void CCrossbow::FireBolt() UTIL_MakeVectors( anglesAim ); anglesAim.x = -anglesAim.x; + +#ifndef CLIENT_DLL Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2; Vector vecDir = gpGlobals->v_forward; -#ifndef CLIENT_DLL CCrossbowBolt *pBolt = CCrossbowBolt::BoltCreate(); pBolt->pev->origin = vecSrc; pBolt->pev->angles = anglesAim; diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index 80a18d65..00b16d57 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -183,7 +183,7 @@ int CCrowbar::Swing( int fFirst ) #endif PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0, - 0.0, 0, 0.0 ); + 0, 0, 0 ); if( tr.flFraction >= 1.0 ) { @@ -294,7 +294,7 @@ int CCrowbar::Swing( int fFirst ) m_trHit = tr; } - m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME; + m_pPlayer->m_iWeaponVolume = (int)( flVol * CROWBAR_WALLHIT_VOLUME ); #endif m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 ); diff --git a/dlls/decals.h b/dlls/decals.h index ce5a2b53..97f5f29f 100644 --- a/dlls/decals.h +++ b/dlls/decals.h @@ -66,7 +66,7 @@ enum decal_e typedef struct { - char *name; + const char *name; int index; } DLL_DECALLIST; diff --git a/dlls/doors.cpp b/dlls/doors.cpp index bdc82f06..dcb04e00 100644 --- a/dlls/doors.cpp +++ b/dlls/doors.cpp @@ -189,42 +189,42 @@ void CBaseDoor::KeyValue( KeyValueData *pkvd ) { if( FStrEq( pkvd->szKeyName, "skin" ) )//skin is used for content type { - pev->skin = atof( pkvd->szValue ); + pev->skin = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "movesnd" ) ) { - m_bMoveSnd = atof( pkvd->szValue ); + m_bMoveSnd = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "stopsnd" ) ) { - m_bStopSnd = atof( pkvd->szValue ); + m_bStopSnd = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "healthvalue" ) ) { - m_bHealthValue = atof( pkvd->szValue ); + m_bHealthValue = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "locked_sound" ) ) { - m_bLockedSound = atof( pkvd->szValue ); + m_bLockedSound = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) ) { - m_bLockedSentence = atof( pkvd->szValue ); + m_bLockedSentence = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) ) { - m_bUnlockedSound = atof( pkvd->szValue ); + m_bUnlockedSound = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) ) { - m_bUnlockedSentence = atof( pkvd->szValue ); + m_bUnlockedSentence = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "WaveHeight" ) ) @@ -328,7 +328,7 @@ void CBaseDoor::SetToggleState( int state ) void CBaseDoor::Precache( void ) { - char *pszSound; + const char *pszSound; // set the door's "in-motion" sound switch( m_bMoveSnd ) @@ -581,7 +581,7 @@ int CBaseDoor::DoorActivate() else { // door should open - if( m_hActivator != NULL && m_hActivator->IsPlayer() ) + if( m_hActivator != 0 && m_hActivator->IsPlayer() ) { // give health if player opened the door (medikit) //VARS( m_eoActivator )->health += m_bHealthValue; @@ -623,7 +623,7 @@ void CBaseDoor::DoorGoUp( void ) { float sign = 1.0; - if( m_hActivator != NULL ) + if( m_hActivator != 0 ) { pevActivator = m_hActivator->pev; @@ -1070,7 +1070,7 @@ void CMomentaryDoor::KeyValue( KeyValueData *pkvd ) if( FStrEq( pkvd->szKeyName, "movesnd" ) ) { - m_bMoveSnd = atof( pkvd->szValue ); + m_bMoveSnd = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "stopsnd" ) ) diff --git a/dlls/effects.cpp b/dlls/effects.cpp index ecc04a19..2977a3ed 100644 --- a/dlls/effects.cpp +++ b/dlls/effects.cpp @@ -75,7 +75,7 @@ void CBubbling::Spawn( void ) pev->solid = SOLID_NOT; // Remove model & collisions pev->renderamt = 0; // The engine won't draw this model if this is set to 0 and blending is on pev->rendermode = kRenderTransTexture; - int speed = pev->speed > 0 ? pev->speed : -pev->speed; + int speed = fabs( pev->speed ); // HACKHACK!!! - Speed in rendercolor pev->rendercolor.x = speed >> 8; @@ -701,7 +701,7 @@ void CLightning::StrikeThink( void ) WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b WRITE_BYTE( (int)pev->rendercolor.z ); // r, g, b - WRITE_BYTE( pev->renderamt ); // brightness + WRITE_BYTE( (int)pev->renderamt ); // brightness WRITE_BYTE( m_speed ); // speed MESSAGE_END(); DoSparks( pStart->pev->origin, pEnd->pev->origin ); @@ -763,7 +763,7 @@ void CLightning::Zap( const Vector &vecSrc, const Vector &vecDest ) WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b WRITE_BYTE( (int)pev->rendercolor.z ); // r, g, b - WRITE_BYTE( pev->renderamt ); // brightness + WRITE_BYTE( (int)pev->renderamt ); // brightness WRITE_BYTE( m_speed ); // speed MESSAGE_END(); #else @@ -944,7 +944,7 @@ void CLaser::Spawn( void ) m_pSprite = NULL; if( m_pSprite ) - m_pSprite->SetTransparency( kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx ); + m_pSprite->SetTransparency( kRenderGlow, (int)pev->rendercolor.x, (int)pev->rendercolor.y, (int)pev->rendercolor.z, (int)pev->renderamt, (int)pev->renderfx ); if( pev->targetname && !( pev->spawnflags & SF_BEAM_STARTON ) ) TurnOff(); @@ -1619,7 +1619,7 @@ void CTestEffect::TestThink( void ) for( i = 0; i < m_iBeam; i++ ) { t = ( gpGlobals->time - m_flBeamTime[i] ) / ( 3 + m_flStartTime - m_flBeamTime[i] ); - m_pBeam[i]->SetBrightness( 255 * t ); + m_pBeam[i]->SetBrightness( (int)( 255 * t ) ); // m_pBeam[i]->SetScrollRate( 20 * t ); } pev->nextthink = gpGlobals->time + 0.1; @@ -1749,9 +1749,9 @@ Vector CBlood::BloodPosition( CBaseEntity *pActivator ) void CBlood::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( pev->spawnflags & SF_BLOOD_STREAM ) - UTIL_BloodStream( BloodPosition( pActivator ), Direction(), ( Color() == BLOOD_COLOR_RED ) ? 70 : Color(), BloodAmount() ); + UTIL_BloodStream( BloodPosition( pActivator ), Direction(), ( Color() == BLOOD_COLOR_RED ) ? 70 : Color(), (int)BloodAmount() ); else - UTIL_BloodDrips( BloodPosition( pActivator ), Direction(), Color(), BloodAmount() ); + UTIL_BloodDrips( BloodPosition( pActivator ), Direction(), Color(), (int)BloodAmount() ); if( pev->spawnflags & SF_BLOOD_DECAL ) { @@ -1947,12 +1947,12 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType { if( pActivator->IsNetClient() ) { - UTIL_ScreenFade( pActivator, pev->rendercolor, Duration(), HoldTime(), pev->renderamt, fadeFlags ); + UTIL_ScreenFade( pActivator, pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags ); } } else { - UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), pev->renderamt, fadeFlags ); + UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags ); } SUB_UseTargets( this, USE_TOGGLE, 0 ); } diff --git a/dlls/effects.h b/dlls/effects.h index 031b8273..68f0ea29 100644 --- a/dlls/effects.h +++ b/dlls/effects.h @@ -238,7 +238,7 @@ public: inline int GetWidth( void ) { - return pev->scale; + return (int)pev->scale; } inline int GetNoise( void ) @@ -255,17 +255,17 @@ public: inline int GetBrightness( void ) { - return pev->renderamt; + return (int)pev->renderamt; } inline int GetFrame( void ) { - return pev->frame; + return (int)pev->frame; } inline int GetScrollRate( void ) { - return pev->animtime; + return (int)pev->animtime; } // Call after you change start/end positions diff --git a/dlls/egon.cpp b/dlls/egon.cpp index 433704ce..9a4de49b 100644 --- a/dlls/egon.cpp +++ b/dlls/egon.cpp @@ -270,7 +270,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir ) } } #endif - float timedist; + float timedist = 0.0f; switch( m_fireMode ) { @@ -380,13 +380,13 @@ void CEgon::UpdateEffect( const Vector &startPoint, const Vector &endPoint, floa } m_pBeam->SetStartPos( endPoint ); - m_pBeam->SetBrightness( 255 - ( timeBlend * 180 ) ); - m_pBeam->SetWidth( 40 - ( timeBlend * 20 ) ); + m_pBeam->SetBrightness( (int)( 255 - ( timeBlend * 180 )) ); + m_pBeam->SetWidth( (int)( 40 - ( timeBlend * 20 ) ) ); if( m_fireMode == FIRE_WIDE ) - m_pBeam->SetColor( 30 + ( 25 * timeBlend ), 30 + ( 30 * timeBlend ), 64 + 80 * fabs( sin( gpGlobals->time * 10 ) ) ); + m_pBeam->SetColor( (int)( 30 + ( 25 * timeBlend ) ), (int)( 30 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time * 10 ) ) ) ); else - m_pBeam->SetColor( 60 + ( 25 * timeBlend ), 120 + ( 30 * timeBlend ), 64 + 80 * fabs( sin( gpGlobals->time *10 ) ) ); + m_pBeam->SetColor( (int)( 60 + ( 25 * timeBlend ) ), (int)( 120 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time *10 ) ) ) ); UTIL_SetOrigin( m_pSprite->pev, endPoint ); m_pSprite->pev->frame += 8 * gpGlobals->frametime; diff --git a/dlls/enginecallback.h b/dlls/enginecallback.h index 1c5ec1b2..9bef0d48 100644 --- a/dlls/enginecallback.h +++ b/dlls/enginecallback.h @@ -14,10 +14,18 @@ ****/ #ifndef ENGINECALLBACK_H #define ENGINECALLBACK_H + +#ifdef _WIN32 +#ifndef __MINGW32__ #pragma once +#endif /* not __MINGW32__ */ +#endif #include "event_flags.h" +// Fix warning in MSVC8 +#undef SERVER_EXECUTE + // Must be provided by user of this code extern enginefuncs_t g_engfuncs; diff --git a/dlls/extdll.h b/dlls/extdll.h index 58349e32..ea176aab 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -25,11 +25,13 @@ #endif // Silence certain warnings +#ifdef _MSC_VER #pragma warning(disable : 4244) // int or float down-conversion #pragma warning(disable : 4305) // int or float data truncation #pragma warning(disable : 4201) // nameless struct/union #pragma warning(disable : 4514) // unreferenced inline function removed #pragma warning(disable : 4100) // unreferenced formal parameter +#endif // Prevent tons of unused windows definitions #ifdef _WIN32 @@ -42,8 +44,12 @@ #include "windows.h" #undef HSPRITE #else // _WIN32 +#ifndef FALSE #define FALSE 0 +#endif +#ifndef TRUE #define TRUE (!FALSE) +#endif typedef unsigned int ULONG; typedef unsigned char BYTE; typedef int BOOL; diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index 38b05f7b..6abf1b44 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -104,7 +104,7 @@ void CBreakable::KeyValue( KeyValueData* pkvd ) else if( FStrEq( pkvd->szKeyName, "spawnobject" ) ) { int object = atoi( pkvd->szValue ); - if( object > 0 && object < ARRAYSIZE( pSpawnObjects ) ) + if( object > 0 && object < (int)ARRAYSIZE( pSpawnObjects ) ) m_iszSpawnObject = MAKE_STRING( pSpawnObjects[object] ); pkvd->fHandled = TRUE; } @@ -353,7 +353,7 @@ void CBreakable::DamageSound( void ) { int pitch; float fvol; - char *rgpsz[6]; + const char *rgpsz[6]; int i = 0; int material = m_Material; @@ -574,7 +574,6 @@ void CBreakable::Die( void ) { Vector vecSpot;// shard origin Vector vecVelocity;// shard velocity - CBaseEntity *pEntity = NULL; char cFlag = 0; int pitch; float fvol; @@ -794,7 +793,7 @@ public: static TYPEDESCRIPTION m_SaveData[]; - static char *m_soundNames[3]; + static const char *m_soundNames[3]; int m_lastSound; // no need to save/restore, just keeps the same sound from playing twice in a row float m_maxSpeed; float m_soundTime; @@ -810,7 +809,7 @@ IMPLEMENT_SAVERESTORE( CPushable, CBreakable ) LINK_ENTITY_TO_CLASS( func_pushable, CPushable ) -char *CPushable::m_soundNames[3] = +const char *CPushable::m_soundNames[3] = { "debris/pushbox1.wav", "debris/pushbox2.wav", @@ -839,7 +838,7 @@ void CPushable::Spawn( void ) UTIL_SetOrigin( pev, pev->origin ); // Multiply by area of the box's cross-section (assume 1000 units^3 standard volume) - pev->skin = ( pev->skin * ( pev->maxs.x - pev->mins.x ) * ( pev->maxs.y - pev->mins.y ) ) * 0.0005; + pev->skin = (int)( ( pev->skin * ( pev->maxs.x - pev->mins.x ) * ( pev->maxs.y - pev->mins.y ) ) * 0.0005 ); m_soundTime = 0; } @@ -882,7 +881,7 @@ void CPushable::KeyValue( KeyValueData *pkvd ) } else if( FStrEq( pkvd->szKeyName, "buoyancy" ) ) { - pev->skin = atof( pkvd->szValue ); + pev->skin = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else diff --git a/dlls/func_tank.cpp b/dlls/func_tank.cpp index eab9e621..ab295e0c 100644 --- a/dlls/func_tank.cpp +++ b/dlls/func_tank.cpp @@ -190,7 +190,7 @@ void CFuncTank::Spawn( void ) if( m_fireRate <= 0 ) m_fireRate = 1; - if( m_spread > MAX_FIRING_SPREADS ) + if( m_spread > (int)MAX_FIRING_SPREADS ) m_spread = 0; pev->oldorigin = pev->origin; @@ -328,7 +328,7 @@ BOOL CFuncTank::OnControls( entvars_t *pevTest ) if( !( pev->spawnflags & SF_TANK_CANCONTROL ) ) return FALSE; - Vector offset = pevTest->origin - pev->origin; + //Vector offset = pevTest->origin - pev->origin; if( ( m_vecControllerUsePos - pevTest->origin ).Length() < 30 ) return TRUE; @@ -476,9 +476,9 @@ void CFuncTank::TrackTarget( void ) { TraceResult tr; edict_t *pPlayer = FIND_CLIENT_IN_PVS( edict() ); - BOOL updateTime = FALSE, lineOfSight; + BOOL updateTime = FALSE; Vector angles, direction, targetPosition, barrelEnd; - edict_t *pTarget; + edict_t *pTarget = NULL; // Get a position to aim for if( m_pController ) @@ -515,12 +515,8 @@ void CFuncTank::TrackTarget( void ) UTIL_TraceLine( barrelEnd, targetPosition, dont_ignore_monsters, edict(), &tr ); - lineOfSight = FALSE; - // No line of sight, don't track if( tr.flFraction == 1.0 || tr.pHit == pTarget ) { - lineOfSight = TRUE; - CBaseEntity *pInstance = CBaseEntity::Instance(pTarget); if( InRange( range ) && pInstance && pInstance->IsAlive() ) { @@ -644,7 +640,7 @@ void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t { CSprite *pSprite = CSprite::SpriteCreate( STRING( m_iszSpriteSmoke ), barrelEnd, TRUE ); pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0, 20.0 ) ); - pSprite->SetTransparency( kRenderTransAlpha, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, 255, kRenderFxNone ); + pSprite->SetTransparency( kRenderTransAlpha, (int)pev->rendercolor.x, (int)pev->rendercolor.y, (int)pev->rendercolor.z, 255, kRenderFxNone ); pSprite->pev->velocity.z = RANDOM_FLOAT( 40, 80 ); pSprite->SetScale( m_spriteScale ); } @@ -714,7 +710,7 @@ void CFuncTankGun::Fire( const Vector &barrelEnd, const Vector &forward, entvars // FireBullets needs gpGlobals->v_up, etc. UTIL_MakeAimVectors( pev->angles ); - int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate; + int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate ); if( bulletCount > 0 ) { for( i = 0; i < bulletCount; i++ ) @@ -835,7 +831,7 @@ void CFuncTankLaser::Fire( const Vector &barrelEnd, const Vector &forward, entva // TankTrace needs gpGlobals->v_up, etc. UTIL_MakeAimVectors( pev->angles ); - int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate; + int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate ); if( bulletCount ) { for( i = 0; i < bulletCount; i++ ) @@ -879,12 +875,12 @@ void CFuncTankRocket::Fire( const Vector &barrelEnd, const Vector &forward, entv if( m_fireLast != 0 ) { - int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate; + int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate ); if( bulletCount > 0 ) { for( i = 0; i < bulletCount; i++ ) { - CBaseEntity *pRocket = CBaseEntity::Create( "rpg_rocket", barrelEnd, pev->angles, edict() ); + CBaseEntity::Create( "rpg_rocket", barrelEnd, pev->angles, edict() ); } CFuncTank::Fire( barrelEnd, forward, pev ); } @@ -917,7 +913,7 @@ void CFuncTankMortar::Fire( const Vector &barrelEnd, const Vector &forward, entv { if( m_fireLast != 0 ) { - int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate; + int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate ); // Only create 1 explosion if( bulletCount > 0 ) { diff --git a/dlls/gargantua.cpp b/dlls/gargantua.cpp index 6c65b06f..7f60b401 100644 --- a/dlls/gargantua.cpp +++ b/dlls/gargantua.cpp @@ -538,7 +538,6 @@ void CGargantua::FlameControls( float angleX, float angleY ) void CGargantua::FlameUpdate( void ) { int i; - static float offset[2] = { 60, -60 }; TraceResult trace; Vector vecStart, angleGun; BOOL streaks = FALSE; @@ -759,7 +758,7 @@ void CGargantua::Spawn() //========================================================= void CGargantua::Precache() { - int i; + size_t i; PRECACHE_MODEL( "models/garg.mdl" ); PRECACHE_MODEL( GARG_EYE_SPRITE_NAME ); diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index 10149202..93352b57 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -259,7 +259,7 @@ void CGauss::SecondaryAttack() m_pPlayer->m_flNextAmmoBurn = 1000; } - int pitch = ( gpGlobals->time - m_pPlayer->m_flStartCharge ) * ( 150 / GetFullChargeTime() ) + 100; + int pitch = (int)( ( gpGlobals->time - m_pPlayer->m_flStartCharge ) * ( 150 / GetFullChargeTime() ) + 100 ); if( pitch > 250 ) pitch = 250; @@ -359,11 +359,11 @@ void CGauss::StartFire( void ) void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage ) { m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME; - + TraceResult tr, beam_tr; +#ifndef CLIENT_DLL Vector vecSrc = vecOrigSrc; Vector vecDest = vecSrc + vecDir * 8192; edict_t *pentIgnore; - TraceResult tr, beam_tr; float flMaxFrac = 1.0; int nTotal = 0; int fHasPunched = 0; @@ -371,8 +371,7 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage ) int nMaxHits = 10; pentIgnore = ENT( m_pPlayer->pev ); - -#ifdef CLIENT_DLL +#else if( m_fPrimaryFire == false ) g_irunninggausspred = true; #endif diff --git a/dlls/genericmonster.cpp b/dlls/genericmonster.cpp index c40bb802..23622120 100644 --- a/dlls/genericmonster.cpp +++ b/dlls/genericmonster.cpp @@ -88,7 +88,7 @@ void CGenericMonster::HandleAnimEvent( MonsterEvent_t *pEvent ) //========================================================= int CGenericMonster::ISoundMask( void ) { - return NULL; + return 0; } //========================================================= diff --git a/dlls/ggrenade.cpp b/dlls/ggrenade.cpp index 64d9f3cf..0ca516c4 100644 --- a/dlls/ggrenade.cpp +++ b/dlls/ggrenade.cpp @@ -49,7 +49,7 @@ void CGrenade::Explode( Vector vecSrc, Vector vecAim ) // UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution. void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) { - float flRndSound;// sound randomizer + // float flRndSound;// sound randomizer pev->model = iStringNull;//invisible pev->solid = SOLID_NOT;// intangible @@ -102,7 +102,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) UTIL_DecalTrace( pTrace, DECAL_SCORCH2 ); } - flRndSound = RANDOM_FLOAT( 0, 1 ); + //flRndSound = RANDOM_FLOAT( 0, 1 ); switch( RANDOM_LONG( 0, 2 ) ) { @@ -144,8 +144,8 @@ void CGrenade::Smoke( void ) WRITE_COORD( pev->origin.y ); WRITE_COORD( pev->origin.z ); WRITE_SHORT( g_sModelIndexSmoke ); - WRITE_BYTE( ( pev->dmg - 50 ) * 0.80 ); // scale * 10 - WRITE_BYTE( 12 ); // framerate + WRITE_BYTE( (int)( ( pev->dmg - 50 ) * 0.80 ) ); // scale * 10 + WRITE_BYTE( 12 ); // framerate MESSAGE_END(); } UTIL_Remove( this ); @@ -165,7 +165,7 @@ void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T void CGrenade::PreDetonate( void ) { - CSoundEnt::InsertSound ( bits_SOUND_DANGER, pev->origin, 400, 0.3 ); + CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, 400, 0.3 ); SetThink( &CGrenade::Detonate ); pev->nextthink = gpGlobals->time + 1; @@ -207,7 +207,7 @@ void CGrenade::DangerSoundThink( void ) return; } - CSoundEnt::InsertSound ( bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5, pev->velocity.Length(), 0.2 ); + CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5, (int)pev->velocity.Length(), 0.2 ); pev->nextthink = gpGlobals->time + 0.2; if( pev->waterlevel != 0 ) @@ -253,7 +253,7 @@ void CGrenade::BounceTouch( CBaseEntity *pOther ) // go ahead and emit the danger sound. // register a radius louder than the explosion, so we make sure everyone gets out of the way - CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, pev->dmg / 0.4, 0.3 ); + CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, (int)( pev->dmg / 0.4 ), 0.3 ); m_fRegisteredSound = TRUE; } diff --git a/dlls/gman.cpp b/dlls/gman.cpp index bdfb60d4..377755f6 100644 --- a/dlls/gman.cpp +++ b/dlls/gman.cpp @@ -109,7 +109,7 @@ void CGMan::HandleAnimEvent( MonsterEvent_t *pEvent ) //========================================================= int CGMan::ISoundMask( void ) { - return NULL; + return 0; } //========================================================= @@ -149,7 +149,7 @@ void CGMan::StartTask( Task_t *pTask ) switch( pTask->iTask ) { case TASK_WAIT: - if( m_hPlayer == NULL ) + if( m_hPlayer == 0 ) { m_hPlayer = UTIL_FindEntityByClassname( NULL, "player" ); } @@ -164,7 +164,7 @@ void CGMan::RunTask( Task_t *pTask ) { case TASK_WAIT: // look at who I'm talking to - if( m_flTalkTime > gpGlobals->time && m_hTalkTarget != NULL ) + if( m_flTalkTime > gpGlobals->time && m_hTalkTarget != 0 ) { float yaw = VecToYaw( m_hTalkTarget->pev->origin - pev->origin ) - pev->angles.y; @@ -177,7 +177,7 @@ void CGMan::RunTask( Task_t *pTask ) SetBoneController( 0, yaw ); } // look at player, but only if playing a "safe" idle animation - else if( m_hPlayer != NULL && pev->sequence == 0 ) + else if( m_hPlayer != 0 && pev->sequence == 0 ) { float yaw = VecToYaw( m_hPlayer->pev->origin - pev->origin ) - pev->angles.y; diff --git a/dlls/h_battery.cpp b/dlls/h_battery.cpp index fdb7c645..976a5733 100644 --- a/dlls/h_battery.cpp +++ b/dlls/h_battery.cpp @@ -91,7 +91,7 @@ void CRecharge::Spawn() UTIL_SetOrigin( pev, pev->origin ); // set size and link into world UTIL_SetSize( pev, pev->mins, pev->maxs ); SET_MODEL( ENT( pev ), STRING( pev->model ) ); - m_iJuice = gSkillData.suitchargerCapacity; + m_iJuice = (int)gSkillData.suitchargerCapacity; pev->frame = 0; } @@ -172,7 +172,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use void CRecharge::Recharge( void ) { - m_iJuice = gSkillData.suitchargerCapacity; + m_iJuice = (int)gSkillData.suitchargerCapacity; pev->frame = 0; SetThink( &CBaseEntity::SUB_DoNothing ); } @@ -185,7 +185,7 @@ void CRecharge::Off( void ) m_iOn = 0; - if( ( !m_iJuice ) && ( ( m_iReactivate = g_pGameRules->FlHEVChargerRechargeTime() ) > 0 ) ) + if( ( !m_iJuice ) && ( ( m_iReactivate = (int)g_pGameRules->FlHEVChargerRechargeTime() ) > 0 ) ) { pev->nextthink = pev->ltime + m_iReactivate; SetThink( &CRecharge::Recharge ); diff --git a/dlls/h_cine.cpp b/dlls/h_cine.cpp index fc503171..bb07e02c 100644 --- a/dlls/h_cine.cpp +++ b/dlls/h_cine.cpp @@ -31,7 +31,7 @@ class CLegacyCineMonster : public CBaseMonster { public: - void CineSpawn( char *szModel ); + void CineSpawn( const char *szModel ); void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); void EXPORT CineThink( void ); void Pain( void ); @@ -103,7 +103,7 @@ LINK_ENTITY_TO_CLASS( monster_cine3_barney, CCine3Barney ) // ********** Scientist SPAWN ********** // -void CLegacyCineMonster :: CineSpawn( char *szModel ) +void CLegacyCineMonster :: CineSpawn( const char *szModel ) { PRECACHE_MODEL(szModel); SET_MODEL(ENT(pev), szModel); diff --git a/dlls/h_cycler.cpp b/dlls/h_cycler.cpp index d685ac36..e920abfa 100644 --- a/dlls/h_cycler.cpp +++ b/dlls/h_cycler.cpp @@ -34,7 +34,7 @@ class CCycler : public CBaseMonster { public: - void GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax); + void GenericCyclerSpawn( const char *szModel, Vector vecMin, Vector vecMax ); virtual int ObjectCaps( void ) { return ( CBaseEntity::ObjectCaps() | FCAP_IMPULSE_USE ); } int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ); void Spawn( void ); @@ -92,7 +92,7 @@ void CCyclerProbe::Spawn( void ) } // Cycler member functions -void CCycler::GenericCyclerSpawn( char *szModel, Vector vecMin, Vector vecMax ) +void CCycler::GenericCyclerSpawn( const char *szModel, Vector vecMin, Vector vecMax ) { if( !szModel || !*szModel ) { @@ -406,7 +406,7 @@ void CWreckage::Spawn( void ) } // pev->scale = 5.0; - m_flStartTime = gpGlobals->time; + m_flStartTime = (int)gpGlobals->time; } void CWreckage::Precache() diff --git a/dlls/hassassin.cpp b/dlls/hassassin.cpp index 5aac1e53..ff053595 100644 --- a/dlls/hassassin.cpp +++ b/dlls/hassassin.cpp @@ -185,7 +185,7 @@ void CHAssassin::SetYawSpeed( void ) //========================================================= void CHAssassin::Shoot( void ) { - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { return; } @@ -597,7 +597,7 @@ IMPLEMENT_CUSTOM_SCHEDULES( CHAssassin, CBaseMonster ) //========================================================= BOOL CHAssassin::CheckMeleeAttack1( float flDot, float flDist ) { - if( m_flNextJump < gpGlobals->time && ( flDist <= 128 || HasMemory( bits_MEMORY_BADJUMP ) ) && m_hEnemy != NULL ) + if( m_flNextJump < gpGlobals->time && ( flDist <= 128 || HasMemory( bits_MEMORY_BADJUMP ) ) && m_hEnemy != 0 ) { TraceResult tr; @@ -687,7 +687,7 @@ void CHAssassin::RunAI( void ) // always visible if moving // always visible is not on hard - if( g_iSkillLevel != SKILL_HARD || m_hEnemy == NULL || pev->deadflag != DEAD_NO || m_Activity == ACT_RUN || m_Activity == ACT_WALK || !( pev->flags & FL_ONGROUND ) ) + if( g_iSkillLevel != SKILL_HARD || m_hEnemy == 0 || pev->deadflag != DEAD_NO || m_Activity == ACT_RUN || m_Activity == ACT_WALK || !( pev->flags & FL_ONGROUND ) ) m_iTargetRanderamt = 255; else m_iTargetRanderamt = 20; diff --git a/dlls/headcrab.cpp b/dlls/headcrab.cpp index d84a692e..60e03c10 100644 --- a/dlls/headcrab.cpp +++ b/dlls/headcrab.cpp @@ -226,7 +226,7 @@ void CHeadCrab::HandleAnimEvent( MonsterEvent_t *pEvent ) UTIL_MakeVectors( pev->angles ); Vector vecJumpDir; - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { float gravity = g_psv_gravity->value; if( gravity <= 1 ) @@ -538,7 +538,7 @@ Schedule_t *CBabyCrab::GetScheduleOfType( int Type ) switch( Type ) { case SCHED_FAIL: // If you fail, try to jump! - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) return slHCRangeAttack1Fast; break; case SCHED_RANGE_ATTACK1: diff --git a/dlls/healthkit.cpp b/dlls/healthkit.cpp index e1b22467..99d53d35 100644 --- a/dlls/healthkit.cpp +++ b/dlls/healthkit.cpp @@ -159,7 +159,7 @@ void CWallHealth::Spawn() UTIL_SetOrigin( pev, pev->origin ); // set size and link into world UTIL_SetSize( pev, pev->mins, pev->maxs ); SET_MODEL( ENT( pev ), STRING( pev->model ) ); - m_iJuice = gSkillData.healthchargerCapacity; + m_iJuice = (int)gSkillData.healthchargerCapacity; pev->frame = 0; } @@ -230,7 +230,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u void CWallHealth::Recharge( void ) { EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM ); - m_iJuice = gSkillData.healthchargerCapacity; + m_iJuice = (int)gSkillData.healthchargerCapacity; pev->frame = 0; SetThink( &CBaseEntity::SUB_DoNothing ); } @@ -243,7 +243,7 @@ void CWallHealth::Off( void ) m_iOn = 0; - if( ( !m_iJuice ) && ( ( m_iReactivate = g_pGameRules->FlHealthChargerRechargeTime() ) > 0 ) ) + if( ( !m_iJuice ) && ( ( m_iReactivate = (int)g_pGameRules->FlHealthChargerRechargeTime() ) > 0 ) ) { pev->nextthink = pev->ltime + m_iReactivate; SetThink( &CWallHealth::Recharge ); diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 7b0eaa2c..4cb85c2c 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -217,7 +217,7 @@ const char *CHGrunt::pGruntSentences[] = "HG_TAUNT", // say rude things }; -enum +typedef enum { HGRUNT_SENT_NONE = -1, HGRUNT_SENT_GREN = 0, @@ -366,7 +366,7 @@ void CHGrunt::JustSpoke( void ) //========================================================= void CHGrunt::PrescheduleThink( void ) { - if( InSquad() && m_hEnemy != NULL ) + if( InSquad() && m_hEnemy != 0 ) { if( HasConditions( bits_COND_SEE_ENEMY ) ) { @@ -413,9 +413,9 @@ BOOL CHGrunt::FCanCheckAttacks( void ) //========================================================= BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist ) { - CBaseMonster *pEnemy; + CBaseMonster *pEnemy = 0; - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { pEnemy = m_hEnemy->MyMonsterPointer(); @@ -787,7 +787,7 @@ Vector CHGrunt::GetGunPosition() //========================================================= void CHGrunt::Shoot( void ) { - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { return; } @@ -814,7 +814,7 @@ void CHGrunt::Shoot( void ) //========================================================= void CHGrunt::Shotgun( void ) { - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { return; } @@ -1834,7 +1834,7 @@ IMPLEMENT_CUSTOM_SCHEDULES( CHGrunt, CSquadMonster ) void CHGrunt::SetActivity( Activity NewActivity ) { int iSequence = ACTIVITY_NOT_AVAILABLE; - void *pmodel = GET_MODEL_PTR( ENT( pev ) ); + //void *pmodel = GET_MODEL_PTR( ENT( pev ) ); switch( NewActivity ) { @@ -2032,10 +2032,10 @@ Schedule_t *CHGrunt::GetSchedule( void ) // before he starts pluggin away. if( FOkToSpeak() )// && RANDOM_LONG( 0, 1 ) ) { - if( ( m_hEnemy != NULL ) && m_hEnemy->IsPlayer() ) + if( ( m_hEnemy != 0 ) && m_hEnemy->IsPlayer() ) // player SENTENCEG_PlayRndSz( ENT( pev ), "HG_ALERT", HGRUNT_SENTENCE_VOLUME, GRUNT_ATTN, 0, m_voicePitch ); - else if( ( m_hEnemy != NULL ) && + else if( ( m_hEnemy != 0 ) && ( m_hEnemy->Classify() != CLASS_PLAYER_ALLY ) && ( m_hEnemy->Classify() != CLASS_HUMAN_PASSIVE ) && ( m_hEnemy->Classify() != CLASS_MACHINE ) ) @@ -2072,7 +2072,7 @@ Schedule_t *CHGrunt::GetSchedule( void ) // 10% chance of flinch. int iPercent = RANDOM_LONG( 0, 99 ); - if( iPercent <= 90 && m_hEnemy != NULL ) + if( iPercent <= 90 && m_hEnemy != 0 ) { // only try to take cover if we actually have an enemy! @@ -2308,7 +2308,7 @@ Schedule_t *CHGrunt::GetScheduleOfType( int Type ) } case SCHED_FAIL: { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { // grunt has an enemy, so pick a different default fail schedule most likely to help recover. return &slGruntCombatFail[0]; @@ -2408,10 +2408,10 @@ public: void KeyValue( KeyValueData *pkvd ); int m_iPose;// which sequence to display -- temporary, don't need to save - static char *m_szPoses[3]; + static const char *m_szPoses[3]; }; -char *CDeadHGrunt::m_szPoses[] = { "deadstomach", "deadside", "deadsitting" }; +const char *CDeadHGrunt::m_szPoses[] = { "deadstomach", "deadside", "deadsitting" }; void CDeadHGrunt::KeyValue( KeyValueData *pkvd ) { diff --git a/dlls/hornet.cpp b/dlls/hornet.cpp index 1e7025a0..d968b79b 100644 --- a/dlls/hornet.cpp +++ b/dlls/hornet.cpp @@ -258,14 +258,14 @@ void CHornet::TrackTarget( void ) } // UNDONE: The player pointer should come back after returning from another level - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { // enemy is dead. Look( 512 ); m_hEnemy = BestVisibleEnemy(); } - if( m_hEnemy != NULL && FVisible( m_hEnemy ) ) + if( m_hEnemy != 0 && FVisible( m_hEnemy ) ) { m_vecEnemyLKP = m_hEnemy->BodyTarget( pev->origin ); } @@ -335,7 +335,7 @@ void CHornet::TrackTarget( void ) // if hornet is close to the enemy, jet in a straight line for a half second. // (only in the single player game) - if( m_hEnemy != NULL && !g_pGameRules->IsMultiplayer() ) + if( m_hEnemy != 0 && !g_pGameRules->IsMultiplayer() ) { if( flDelta >= 0.4 && ( pev->origin - m_vecEnemyLKP ).Length() <= 300 ) { diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index f35b0740..cedee258 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -137,7 +137,7 @@ int CHoundeye::Classify( void ) //========================================================= BOOL CHoundeye::FValidateHintType( short sHint ) { - int i; + size_t i; static short sHoundHints[] = { diff --git a/dlls/ichthyosaur.cpp b/dlls/ichthyosaur.cpp index cbc86d50..53f57a27 100644 --- a/dlls/ichthyosaur.cpp +++ b/dlls/ichthyosaur.cpp @@ -416,7 +416,7 @@ void CIchthyosaur::HandleAnimEvent( MonsterEvent_t *pEvent ) case ICHTHYOSAUR_AE_SHAKE_RIGHT: case ICHTHYOSAUR_AE_SHAKE_LEFT: { - if( m_hEnemy != NULL && FVisible( m_hEnemy ) ) + if( m_hEnemy != 0 && FVisible( m_hEnemy ) ) { CBaseEntity *pHurt = m_hEnemy; @@ -622,7 +622,7 @@ void CIchthyosaur::RunTask( Task_t *pTask ) switch( pTask->iTask ) { case TASK_ICHTHYOSAUR_CIRCLE_ENEMY: - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { TaskComplete(); } @@ -864,7 +864,7 @@ void CIchthyosaur::Stop( void ) void CIchthyosaur::Swim() { - int retValue = 0; + //int retValue = 0; Vector start = pev->origin; @@ -1072,7 +1072,7 @@ Vector CIchthyosaur::DoProbe( const Vector &Probe ) } } - if( bBumpedSomething && ( m_hEnemy == NULL || tr.pHit != m_hEnemy->edict() ) ) + if( bBumpedSomething && ( m_hEnemy == 0 || tr.pHit != m_hEnemy->edict() ) ) { Vector ProbeDir = Probe - pev->origin; diff --git a/dlls/islave.cpp b/dlls/islave.cpp index cfb1df1b..3b4343d3 100644 --- a/dlls/islave.cpp +++ b/dlls/islave.cpp @@ -51,7 +51,7 @@ public: void HandleAnimEvent( MonsterEvent_t *pEvent ); BOOL CheckRangeAttack1( float flDot, float flDist ); BOOL CheckRangeAttack2( float flDot, float flDist ); - void CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ); + void CallForHelp( const char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ); void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ); int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ); @@ -155,7 +155,7 @@ int CISlave::IRelationship( CBaseEntity *pTarget ) return CBaseMonster::IRelationship( pTarget ); } -void CISlave::CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ) +void CISlave::CallForHelp( const char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ) { // ALERT( at_aiconsole, "help " ); @@ -185,7 +185,7 @@ void CISlave::CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vect //========================================================= void CISlave::AlertSound( void ) { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { SENTENCEG_PlayRndSz( ENT( pev ), "SLV_ALERT", 0.85, ATTN_NORM, 0, m_voicePitch ); @@ -365,7 +365,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent ) WRITE_BYTE( 0 ); // decay * 0.1 MESSAGE_END(); } - if( m_hDead != NULL ) + if( m_hDead != 0 ) { WackBeam( -1, m_hDead ); WackBeam( 1, m_hDead ); @@ -385,7 +385,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent ) { ClearBeams(); - if( m_hDead != NULL ) + if( m_hDead != 0 ) { Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 ); TraceResult trace; @@ -394,7 +394,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent ) if( !trace.fStartSolid ) { CBaseEntity *pNew = Create( "monster_alien_slave", m_hDead->pev->origin, m_hDead->pev->angles ); - CBaseMonster *pNewMonster = pNew->MyMonsterPointer( ); + //CBaseMonster *pNewMonster = pNew->MyMonsterPointer(); pNew->pev->spawnflags |= 1; WackBeam( -1, pNew ); WackBeam( 1, pNew ); @@ -484,7 +484,7 @@ BOOL CISlave::CheckRangeAttack2( float flDot, float flDist ) } } } - if( m_hDead != NULL ) + if( m_hDead != 0 ) return TRUE; else return FALSE; @@ -530,7 +530,7 @@ void CISlave::Spawn() //========================================================= void CISlave::Precache() { - int i; + size_t i; PRECACHE_MODEL( "models/islave.mdl" ); PRECACHE_MODEL( "sprites/lgtning.spr" ); @@ -756,8 +756,8 @@ void CISlave::BeamGlow() //========================================================= void CISlave::WackBeam( int side, CBaseEntity *pEntity ) { - Vector vecDest; - float flDist = 1.0; + //Vector vecDest; + //float flDist = 1.0; if( m_iBeams >= ISLAVE_MAX_BEAMS ) return; diff --git a/dlls/leech.cpp b/dlls/leech.cpp index ea524aaa..dccffcf4 100644 --- a/dlls/leech.cpp +++ b/dlls/leech.cpp @@ -271,7 +271,7 @@ void CLeech::AlertSound( void ) void CLeech::Precache( void ) { - int i; + size_t i; //PRECACHE_MODEL( "models/icky.mdl" ); PRECACHE_MODEL( "models/leech.mdl" ); diff --git a/dlls/lights.cpp b/dlls/lights.cpp index 2a8b0683..e6b03125 100644 --- a/dlls/lights.cpp +++ b/dlls/lights.cpp @@ -99,7 +99,7 @@ void CLight::Spawn( void ) if( FBitSet( pev->spawnflags, SF_LIGHT_START_OFF ) ) LIGHT_STYLE( m_iStyle, "a" ); else if( m_iszPattern ) - LIGHT_STYLE( m_iStyle, (char *)STRING( m_iszPattern ) ); + LIGHT_STYLE( m_iStyle, STRING( m_iszPattern ) ); else LIGHT_STYLE( m_iStyle, "m" ); } @@ -115,7 +115,7 @@ void CLight::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp if( FBitSet( pev->spawnflags, SF_LIGHT_START_OFF ) ) { if( m_iszPattern ) - LIGHT_STYLE( m_iStyle, (char *)STRING( m_iszPattern ) ); + LIGHT_STYLE( m_iStyle, STRING( m_iszPattern ) ); else LIGHT_STYLE( m_iStyle, "m" ); ClearBits( pev->spawnflags, SF_LIGHT_START_OFF ); @@ -155,15 +155,16 @@ void CEnvLight::KeyValue( KeyValueData* pkvd ) } else if( j == 4 ) { - r = r * ( v / 255.0 ); - g = g * ( v / 255.0 ); - b = b * ( v / 255.0 ); + v /= 255; + r *= v; + g *= v; + b *= v; } // simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling - r = pow( r / 114.0, 0.6 ) * 264; - g = pow( g / 114.0, 0.6 ) * 264; - b = pow( b / 114.0, 0.6 ) * 264; + r = (int)( pow( r / 114.0, 0.6 ) * 264.0 ); + g = (int)( pow( g / 114.0, 0.6 ) * 264.0 ); + b = (int)( pow( b / 114.0, 0.6 ) * 264.0 ); pkvd->fHandled = TRUE; sprintf( szColor, "%d", r ); diff --git a/dlls/maprules.cpp b/dlls/maprules.cpp index 3eea7486..2230acac 100644 --- a/dlls/maprules.cpp +++ b/dlls/maprules.cpp @@ -64,9 +64,9 @@ void CRuleEntity::Spawn( void ) void CRuleEntity::KeyValue( KeyValueData *pkvd ) { - if (FStrEq(pkvd->szKeyName, "master")) + if( FStrEq(pkvd->szKeyName, "master" ) ) { - SetMaster( ALLOC_STRING(pkvd->szValue) ); + SetMaster( ALLOC_STRING( pkvd->szValue ) ); pkvd->fHandled = TRUE; } else @@ -75,9 +75,9 @@ void CRuleEntity::KeyValue( KeyValueData *pkvd ) BOOL CRuleEntity::CanFireForActivator( CBaseEntity *pActivator ) { - if ( m_iszMaster ) + if( m_iszMaster ) { - if ( UTIL_IsMasterTriggered( m_iszMaster, pActivator ) ) + if( UTIL_IsMasterTriggered( m_iszMaster, pActivator ) ) return TRUE; else return FALSE; @@ -135,7 +135,7 @@ public: void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); void KeyValue( KeyValueData *pkvd ); - inline int Points( void ) { return pev->frags; } + inline int Points( void ) { return (int)pev->frags; } inline BOOL AllowNegativeScore( void ) { return pev->spawnflags & SF_SCORE_NEGATIVE; } inline BOOL AwardToTeam( void ) { return pev->spawnflags & SF_SCORE_TEAM; } @@ -643,8 +643,8 @@ public: inline void CountUp( void ) { pev->frags++; } inline void CountDown( void ) { pev->frags--; } inline void ResetCount( void ) { pev->frags = pev->dmg; } - inline int CountValue( void ) { return pev->frags; } - inline int LimitValue( void ) { return pev->health; } + inline int CountValue( void ) { return (int)pev->frags; } + inline int LimitValue( void ) { return (int)pev->health; } inline BOOL HitLimit( void ) { return CountValue() == LimitValue(); } diff --git a/dlls/monsters.cpp b/dlls/monsters.cpp index d034abd6..cfe4c561 100644 --- a/dlls/monsters.cpp +++ b/dlls/monsters.cpp @@ -133,7 +133,7 @@ int CBaseMonster::Restore( CRestore &restore ) m_Activity = ACT_RESET; // If we don't have an enemy, clear conditions like see enemy, etc. - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) m_afConditions = 0; return status; @@ -672,7 +672,7 @@ BOOL CBaseMonster::FRefreshRoute( void ) returnCode = BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, NULL ); break; case MOVEGOAL_TARGETENT: - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) { returnCode = BuildRoute( m_hTargetEnt->pev->origin, bits_MF_TO_TARGETENT, m_hTargetEnt ); } @@ -954,7 +954,7 @@ BOOL CBaseMonster::CheckRangeAttack2( float flDot, float flDist ) BOOL CBaseMonster::CheckMeleeAttack1( float flDot, float flDist ) { // Decent fix to keep folks from kicking/punching hornets and snarks is to check the onground flag(sjb) - if( flDist <= 64 && flDot >= 0.7 && m_hEnemy != NULL && FBitSet( m_hEnemy->pev->flags, FL_ONGROUND ) ) + if( flDist <= 64 && flDot >= 0.7 && m_hEnemy != 0 && FBitSet( m_hEnemy->pev->flags, FL_ONGROUND ) ) { return TRUE; } @@ -1165,7 +1165,7 @@ void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { if( m_hOldEnemy[i] == pEnemy ) return; - if( m_hOldEnemy[i] == NULL ) // someone died, reuse their slot + if( m_hOldEnemy[i] == 0 ) // someone died, reuse their slot break; } if( i >= MAX_OLD_ENEMIES ) @@ -1183,7 +1183,7 @@ BOOL CBaseMonster::PopEnemy() // UNDONE: blah, this is bad, we should use a stack but I'm too lazy to code one. for( int i = MAX_OLD_ENEMIES - 1; i >= 0; i-- ) { - if( m_hOldEnemy[i] != NULL ) + if( m_hOldEnemy[i] != 0 ) { if( m_hOldEnemy[i]->IsAlive()) // cheat and know when they die { @@ -1240,7 +1240,7 @@ void CBaseMonster::SetActivity( Activity NewActivity ) //========================================================= // SetSequenceByName //========================================================= -void CBaseMonster::SetSequenceByName( char *szSequence ) +void CBaseMonster::SetSequenceByName( const char *szSequence ) { int iSequence; @@ -2863,7 +2863,7 @@ void CBaseMonster::ReportAIState( void ) else ALERT( level, "No Schedule, " ); - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) ALERT( level, "\nEnemy is %s", STRING( m_hEnemy->pev->classname ) ); else ALERT( level, "No enemy" ); @@ -2950,7 +2950,7 @@ BOOL CBaseMonster::FCheckAITrigger( void ) switch( m_iTriggerCondition ) { case AITRIGGER_SEEPLAYER_ANGRY_AT_PLAYER: - if( m_hEnemy != NULL && m_hEnemy->IsPlayer() && HasConditions( bits_COND_SEE_ENEMY ) ) + if( m_hEnemy != 0 && m_hEnemy->IsPlayer() && HasConditions( bits_COND_SEE_ENEMY ) ) { fFireTarget = TRUE; } @@ -3321,7 +3321,7 @@ BOOL CBaseMonster::GetEnemy( void ) } // remember old enemies - if( m_hEnemy == NULL && PopEnemy() ) + if( m_hEnemy == 0 && PopEnemy() ) { if( m_pSchedule ) { @@ -3332,7 +3332,7 @@ BOOL CBaseMonster::GetEnemy( void ) } } - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { // monster has an enemy. return TRUE; @@ -3344,7 +3344,7 @@ BOOL CBaseMonster::GetEnemy( void ) //========================================================= // DropItem - dead monster drops named item //========================================================= -CBaseEntity *CBaseMonster::DropItem( char *pszItemName, const Vector &vecPos, const Vector &vecAng ) +CBaseEntity *CBaseMonster::DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { if( !pszItemName ) { diff --git a/dlls/monsterstate.cpp b/dlls/monsterstate.cpp index f29664dc..cec29b79 100644 --- a/dlls/monsterstate.cpp +++ b/dlls/monsterstate.cpp @@ -42,7 +42,7 @@ void CBaseMonster::SetState( MONSTERSTATE State ) // Drop enemy pointers when going to idle case MONSTERSTATE_IDLE: - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { m_hEnemy = NULL;// not allowed to have an enemy anymore. ALERT( at_aiconsole, "Stripped\n" ); @@ -92,7 +92,7 @@ void CBaseMonster::RunAI( void ) } // do these calculations if monster has an enemy. - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { CheckEnemy( m_hEnemy ); } @@ -198,7 +198,7 @@ MONSTERSTATE CBaseMonster::GetIdealState( void ) COMBAT goes to ALERT upon death of enemy */ { - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { m_IdealMonsterState = MONSTERSTATE_ALERT; // pev->effects = EF_BRIGHTFIELD; diff --git a/dlls/mpstubb.cpp b/dlls/mpstubb.cpp index 703a4dba..12b3a82f 100644 --- a/dlls/mpstubb.cpp +++ b/dlls/mpstubb.cpp @@ -230,7 +230,7 @@ CBaseEntity *CBaseMonster::BestVisibleEnemy( void ) // currently think is the best visible enemy. No need to do // a distance check, just get mad at this one for now. iBestRelationship = IRelationship( pNextEnt ); - iNearest = ( pNextEnt->pev->origin - pev->origin ).Length(); + (int)iNearest = ( pNextEnt->pev->origin - pev->origin ).Length(); pReturn = pNextEnt; } else if( IRelationship( pNextEnt ) == iBestRelationship ) @@ -238,7 +238,7 @@ CBaseEntity *CBaseMonster::BestVisibleEnemy( void ) // this entity is disliked just as much as the entity that // we currently think is the best visible enemy, so we only // get mad at it if it is closer. - iDist = ( pNextEnt->pev->origin - pev->origin ).Length(); + (int)iDist = ( pNextEnt->pev->origin - pev->origin ).Length(); if( iDist <= iNearest ) { diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index ebef51de..9da8d0b4 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -256,7 +256,7 @@ void CHalfLifeMultiplay::Think( void ) if( pPlayer ) { - remain = flFragLimit - pPlayer->pev->frags; + remain = (int)( flFragLimit - pPlayer->pev->frags ); if( remain < bestfrags ) { bestfrags = remain; @@ -300,7 +300,7 @@ BOOL CHalfLifeMultiplay::IsDeathmatch( void ) //========================================================= BOOL CHalfLifeMultiplay::IsCoOp( void ) { - return gpGlobals->coop; + return gpGlobals->coop ? TRUE : FALSE; } //========================================================= @@ -467,7 +467,7 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl ) { MESSAGE_BEGIN( MSG_ONE, gmsgScoreInfo, NULL, pl->edict() ); WRITE_BYTE( i ); // client number - WRITE_SHORT( plr->pev->frags ); + WRITE_SHORT( (int)plr->pev->frags ); WRITE_SHORT( plr->m_iDeaths ); WRITE_SHORT( 0 ); WRITE_SHORT( GetTeamIndex( plr->m_szTeamName ) + 1 ); @@ -652,7 +652,7 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, // killed scores MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo ); WRITE_BYTE( ENTINDEX(pVictim->edict()) ); - WRITE_SHORT( pVictim->pev->frags ); + WRITE_SHORT( (int)pVictim->pev->frags ); WRITE_SHORT( pVictim->m_iDeaths ); WRITE_SHORT( 0 ); WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 ); @@ -666,7 +666,7 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo ); WRITE_BYTE( ENTINDEX( PK->edict() ) ); - WRITE_SHORT( PK->pev->frags ); + WRITE_SHORT( (int)PK->pev->frags ); WRITE_SHORT( PK->m_iDeaths ); WRITE_SHORT( 0 ); WRITE_SHORT( GetTeamIndex( PK->m_szTeamName ) + 1 ); @@ -689,14 +689,14 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor ) { // Work out what killed the player, and send a message to all clients about it - CBaseEntity *Killer = CBaseEntity::Instance( pKiller ); + CBaseEntity::Instance( pKiller ); const char *killer_weapon_name = "world"; // by default, the player is killed by the world int killer_index = 0; // Hack to fix name change - char *tau = "tau_cannon"; - char *gluon = "gluon gun"; + const char *tau = "tau_cannon"; + const char *gluon = "gluon gun"; if( pKiller->flags & FL_CLIENT ) { diff --git a/dlls/nihilanth.cpp b/dlls/nihilanth.cpp index ba1c6192..479a2b34 100644 --- a/dlls/nihilanth.cpp +++ b/dlls/nihilanth.cpp @@ -587,7 +587,7 @@ void CNihilanth::ShootBalls( void ) while( m_flShootTime < m_flShootEnd && m_flShootTime < gpGlobals->time ) { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { Vector vecSrc, vecDir; CNihilanthHVR *pEntity; @@ -742,7 +742,7 @@ void CNihilanth::NextActivity() float flDist = ( m_posDesired - pev->origin ).Length(); float flDot = DotProduct( m_vecDesired, gpGlobals->v_forward ); - if( m_hRecharger != NULL ) + if( m_hRecharger != 0 ) { // at we at power up yet? if( flDist < 128.0 ) @@ -767,23 +767,23 @@ void CNihilanth::NextActivity() return; } - if( m_hEnemy != NULL && !m_hEnemy->IsAlive() ) + if( m_hEnemy != 0 && !m_hEnemy->IsAlive() ) { - m_hEnemy = NULL; + m_hEnemy = 0; } if( m_flLastSeen + 15 < gpGlobals->time ) { - m_hEnemy = NULL; + m_hEnemy = 0; } - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { Look( 4096 ); m_hEnemy = BestVisibleEnemy(); } - if( m_hEnemy != NULL && m_irritation != 0 ) + if( m_hEnemy != 0 && m_irritation != 0 ) { if( m_flLastSeen + 5 > gpGlobals->time && flDist < 256 && flDot > 0 ) { @@ -860,7 +860,7 @@ void CNihilanth::HuntThink( void ) } // look for current enemy - if( m_hEnemy != NULL && m_hRecharger == NULL ) + if( m_hEnemy != 0 && m_hRecharger == NULL ) { if( FVisible( m_hEnemy ) ) { @@ -928,7 +928,7 @@ void CNihilanth::Flight( void ) if( flDir < 0 ) flSpeed = -flSpeed; - float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward ); + //float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward ); // sideways drag m_velocity.x = m_velocity.x * ( 1.0 - fabs( gpGlobals->v_right.x ) * 0.05 ); @@ -959,7 +959,7 @@ BOOL CNihilanth::AbsorbSphere( void ) { for( int i = 0; i < N_SPHERES; i++ ) { - if( m_hSphere[i] != NULL ) + if( m_hSphere[i] != 0 ) { CNihilanthHVR *pSphere = (CNihilanthHVR *)( (CBaseEntity *)m_hSphere[i] ); pSphere->AbsorbInit(); @@ -978,7 +978,7 @@ BOOL CNihilanth::EmitSphere( void ) for( int i = 0; i < N_SPHERES; i++ ) { - if( m_hSphere[i] != NULL ) + if( m_hSphere[i] != 0 ) { m_iActiveSpheres++; } @@ -1007,10 +1007,10 @@ void CNihilanth::TargetSphere( USE_TYPE useType, float value ) for( i = 0; i < N_SPHERES; i++ ) { - if( m_hSphere[i] != NULL ) + if( m_hSphere[i] != 0 ) { pSphere = m_hSphere[i]->MyMonsterPointer(); - if( pSphere->m_hEnemy == NULL ) + if( pSphere->m_hEnemy == 0 ) break; } } @@ -1141,7 +1141,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent ) case 4: // get a sphere { - if( m_hRecharger != NULL ) + if( m_hRecharger != 0 ) { if( !EmitSphere() ) { @@ -1340,7 +1340,7 @@ void CNihilanthHVR::HoverThink( void ) { pev->nextthink = gpGlobals->time + 0.1; - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) { CircleTarget( m_hTargetEnt->pev->origin + Vector( 0, 0, 16 * N_SCALE ) ); } @@ -1424,7 +1424,7 @@ void CNihilanthHVR::ZapThink( void ) pev->nextthink = gpGlobals->time + 0.05; // check world boundaries - if( m_hEnemy == NULL || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 ) + if( m_hEnemy == 0 || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 ) { SetTouch( NULL ); UTIL_Remove( this ); @@ -1561,7 +1561,7 @@ void CNihilanthHVR::TeleportThink( void ) pev->nextthink = gpGlobals->time + 0.1; // check world boundaries - if( m_hEnemy == NULL || !m_hEnemy->IsAlive() || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 ) + if( m_hEnemy == 0 || !m_hEnemy->IsAlive() || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 ) { STOP_SOUND( edict(), CHAN_WEAPON, "x/x_teleattack1.wav" ); UTIL_Remove( this ); @@ -1573,10 +1573,10 @@ void CNihilanthHVR::TeleportThink( void ) STOP_SOUND( edict(), CHAN_WEAPON, "x/x_teleattack1.wav" ); UTIL_Remove( this ); - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) m_hTargetEnt->Use( m_hEnemy, m_hEnemy, USE_ON, 1.0 ); - if( m_hTouch != NULL && m_hEnemy != NULL ) + if( m_hTouch != 0 && m_hEnemy != NULL ) m_hTouch->Touch( m_hEnemy ); } else @@ -1630,10 +1630,10 @@ void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther ) if( pOther == pEnemy ) { - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) m_hTargetEnt->Use( pEnemy, pEnemy, USE_ON, 1.0 ); - if( m_hTouch != NULL && pEnemy != NULL ) + if( m_hTouch != 0 && pEnemy != NULL ) m_hTouch->Touch( pEnemy ); } else @@ -1656,7 +1656,7 @@ void CNihilanthHVR::DissipateThink( void ) pev->renderamt -= 2; pev->scale += 0.1; - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) { CircleTarget( m_hTargetEnt->pev->origin + Vector( 0, 0, 4096 ) ); } diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index a97b6a80..68a1c267 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -214,7 +214,7 @@ entvars_t *CGraph::LinkEntForLink( CLink *pLink, CNode *pNode ) //========================================================= int CGraph::HandleLinkEnt( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODEQUERY queryType ) { - edict_t *pentWorld; + //edict_t *pentWorld; CBaseEntity *pDoor; TraceResult tr; @@ -230,7 +230,7 @@ int CGraph::HandleLinkEnt( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODE ALERT( at_aiconsole, "dead path ent!\n" ); return TRUE; } - pentWorld = NULL; + //pentWorld = NULL; // func_door if( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) ) @@ -586,7 +586,7 @@ int CGraph::FindShortestPath( int *piPath, int iStart, int iDest, int iHull, int int iVisitNode; int iCurrentNode; int iNumPathNodes; - int iHullMask; + int iHullMask = 0; if( !m_fGraphPresent || !m_fGraphPointersSet ) { @@ -1665,10 +1665,10 @@ void CTestHull::BuildNodeGraph( void ) int iBadNode;// this is the node that caused graph generation to fail - int cMaxInitialLinks = 0; - int cMaxValidLinks = 0; + //int cMaxInitialLinks = 0; + //int cMaxValidLinks = 0; - int iPoolIndex = 0; + //int iPoolIndex = 0; int cPoolLinks;// number of links in the pool. Vector vecDirToCheckNode; @@ -2058,11 +2058,16 @@ void CTestHull::BuildNodeGraph( void ) fprintf( file, "\nAll Connections are Paired!\n" ); } +#ifdef _MSC_VER +#define SIZET_FMT "%Iu" +#else +#define SIZET_FMT "%zu" +#endif fprintf( file, "-------------------------------------------------------------------------------\n" ); fprintf( file, "\n\n-------------------------------------------------------------------------------\n" ); fprintf( file, "Total Number of Connections in Pool: %d\n", cPoolLinks ); fprintf( file, "-------------------------------------------------------------------------------\n" ); - fprintf( file, "Connection Pool: %d bytes\n", sizeof(CLink) * cPoolLinks ); + fprintf( file, "Connection Pool: " SIZET_FMT " bytes\n", sizeof(CLink) * cPoolLinks ); fprintf( file, "-------------------------------------------------------------------------------\n" ); ALERT( at_aiconsole, "%d Nodes, %d Connections\n", WorldGraph.m_cNodes, cPoolLinks ); diff --git a/dlls/nodes.h b/dlls/nodes.h index 27b890ed..2b582a6f 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -15,7 +15,8 @@ //========================================================= // nodes.h //========================================================= - +#ifndef NODES_H +#define NODES_H //========================================================= // DEFINE //========================================================= @@ -370,3 +371,4 @@ enum }; extern CGraph WorldGraph; +#endif // NODES_H diff --git a/dlls/observer.cpp b/dlls/observer.cpp index 0eda7490..f3fc54a0 100644 --- a/dlls/observer.cpp +++ b/dlls/observer.cpp @@ -35,7 +35,7 @@ void CBasePlayer::Observer_FindNextPlayer( bool bReverse ) else iStart = ENTINDEX( edict() ); int iCurrent = iStart; - m_hObserverTarget = NULL; + m_hObserverTarget = 0; int iDir = bReverse ? -1 : 1; do @@ -125,11 +125,11 @@ void CBasePlayer::Observer_CheckTarget() return; // try to find a traget if we have no current one - if( m_hObserverTarget == NULL ) + if( m_hObserverTarget == 0 ) { Observer_FindNextPlayer( false ); - if( m_hObserverTarget == NULL ) + if( m_hObserverTarget == 0 ) { // no target found at all @@ -166,7 +166,7 @@ void CBasePlayer::Observer_CheckTarget() void CBasePlayer::Observer_CheckProperties() { // try to find a traget if we have no current one - if( pev->iuser1 == OBS_IN_EYE && m_hObserverTarget != NULL ) + if( pev->iuser1 == OBS_IN_EYE && m_hObserverTarget != 0 ) { CBasePlayer* target = (CBasePlayer*)( UTIL_PlayerByIndex( ENTINDEX( m_hObserverTarget->edict() ) ) ); @@ -222,26 +222,26 @@ void CBasePlayer::Observer_SetMode( int iMode ) if( iMode < OBS_CHASE_LOCKED || iMode > OBS_MAP_CHASE ) iMode = OBS_IN_EYE; // now it is // verify observer target again - if( m_hObserverTarget != NULL ) + if( m_hObserverTarget != 0 ) { CBaseEntity *pEnt = m_hObserverTarget; if( ( pEnt == this ) || ( pEnt == NULL ) ) - m_hObserverTarget = NULL; + m_hObserverTarget = 0; else if( ( (CBasePlayer*)pEnt )->IsObserver() || ( pEnt->pev->effects & EF_NODRAW ) ) - m_hObserverTarget = NULL; + m_hObserverTarget = 0; } // set spectator mode pev->iuser1 = iMode; // if we are not roaming, we need a valid target to track - if( ( iMode != OBS_ROAMING ) && ( m_hObserverTarget == NULL ) ) + if( ( iMode != OBS_ROAMING ) && ( m_hObserverTarget == 0 ) ) { Observer_FindNextPlayer( false ); // if we didn't find a valid target switch to roaming - if( m_hObserverTarget == NULL ) + if( m_hObserverTarget == 0 ) { ClientPrint( pev, HUD_PRINTCENTER, "#Spec_NoTarget" ); pev->iuser1 = OBS_ROAMING; diff --git a/dlls/osprey.cpp b/dlls/osprey.cpp index 95088d2b..6a421645 100644 --- a/dlls/osprey.cpp +++ b/dlls/osprey.cpp @@ -261,7 +261,7 @@ BOOL COsprey::HasDead() { for( int i = 0; i < m_iUnits; i++ ) { - if( m_hGrunt[i] == NULL || !m_hGrunt[i]->IsAlive() ) + if( m_hGrunt[i] == 0 || !m_hGrunt[i]->IsAlive() ) { return TRUE; } @@ -285,9 +285,9 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc ) for( int i = 0; i < m_iUnits; i++ ) { - if( m_hGrunt[i] == NULL || !m_hGrunt[i]->IsAlive() ) + if( m_hGrunt[i] == 0 || !m_hGrunt[i]->IsAlive() ) { - if( m_hGrunt[i] != NULL && m_hGrunt[i]->pev->rendermode == kRenderNormal ) + if( m_hGrunt[i] != 0 && m_hGrunt[i]->pev->rendermode == kRenderNormal ) { m_hGrunt[i]->SUB_StartFadeOut(); } @@ -319,7 +319,7 @@ void COsprey::HoverThink( void ) int i; for( i = 0; i < 4; i++ ) { - if( m_hRepel[i] != NULL && m_hRepel[i]->pev->health > 0 && !( m_hRepel[i]->pev->flags & FL_ONGROUND ) ) + if( m_hRepel[i] != 0 && m_hRepel[i]->pev->health > 0 && !( m_hRepel[i]->pev->flags & FL_ONGROUND ) ) { break; } diff --git a/dlls/plats.cpp b/dlls/plats.cpp index 93fb22fe..8fecf684 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -82,12 +82,12 @@ void CBasePlatTrain::KeyValue( KeyValueData *pkvd ) } else if( FStrEq( pkvd->szKeyName, "movesnd" ) ) { - m_bMoveSnd = atof( pkvd->szValue ); + m_bMoveSnd = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "stopsnd" ) ) { - m_bStopSnd = atof( pkvd->szValue ); + m_bStopSnd = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "volume" ) ) @@ -1437,7 +1437,7 @@ void CFuncTrackTrain::Spawn( void ) pev->speed = 0; pev->velocity = g_vecZero; pev->avelocity = g_vecZero; - pev->impulse = m_speed; + pev->impulse = (int)m_speed; m_dir = 1; @@ -2212,7 +2212,7 @@ void CGunTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us { pev->takedamage = DAMAGE_AIM; m_hTargetEnt = GetNextTarget(); - if( m_hTargetEnt == NULL ) + if( m_hTargetEnt == 0 ) return; pev->health = pev->max_health; Next(); diff --git a/dlls/player.cpp b/dlls/player.cpp index 7d7363b5..51995acf 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -459,7 +459,7 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl } // keep track of amount of damage last sustained - m_lastDamageAmount = flDamage; + m_lastDamageAmount = (int)flDamage; // Armor. if( pev->armorvalue && !( bitsDamageType & ( DMG_FALL | DMG_DROWN ) ) )// armor doesn't protect against fall or drown damage! @@ -787,7 +787,7 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit ) m_pLastItem = NULL; - if( m_pTank != NULL ) + if( m_pTank != 0 ) { m_pTank->Use( this, this, USE_OFF, 0 ); m_pTank = NULL; @@ -847,7 +847,7 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib ) g_pGameRules->PlayerKilled( this, pevAttacker, g_pevLastInflictor ); - if( m_pTank != NULL ) + if( m_pTank != 0 ) { m_pTank->Use( this, this, USE_OFF, 0 ); m_pTank = NULL; @@ -1172,7 +1172,7 @@ void CBasePlayer::WaterMove() // track drowning damage, give it back when // player finally takes a breath - m_idrowndmg += pev->dmg; + m_idrowndmg += (int)pev->dmg; } } else @@ -1393,7 +1393,7 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) if( m_pActiveItem ) m_pActiveItem->Holster(); - if( m_pTank != NULL ) + if( m_pTank != 0 ) { m_pTank->Use( this, this, USE_OFF, 0 ); m_pTank = NULL; @@ -1468,7 +1468,7 @@ void CBasePlayer::PlayerUse( void ) // Hit Use on a train? if( m_afButtonPressed & IN_USE ) { - if( m_pTank != NULL ) + if( m_pTank != 0 ) { // Stop controlling the tank // TODO: Send HUD Update @@ -1491,7 +1491,7 @@ void CBasePlayer::PlayerUse( void ) if( pTrain && !( pev->button & IN_JUMP ) && FBitSet( pev->flags, FL_ONGROUND ) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE ) && pTrain->OnControls( pev ) ) { m_afPhysicsFlags |= PFLAG_ONTRAIN; - m_iTrain = TrainSpeed( pTrain->pev->speed, pTrain->pev->impulse ); + m_iTrain = TrainSpeed( (int)pTrain->pev->speed, pTrain->pev->impulse ); m_iTrain |= TRAIN_NEW; EMIT_SOUND( ENT( pev ), CHAN_ITEM, "plats/train_use1.wav", 0.8, ATTN_NORM ); return; @@ -1662,7 +1662,7 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) if( -score > pev->frags ) // Will this go negative? { - score = -pev->frags; // Sum will be 0 + score = (int)( -pev->frags ); // Sum will be 0 } } } @@ -1671,7 +1671,7 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo ); WRITE_BYTE( ENTINDEX( edict() ) ); - WRITE_SHORT( pev->frags ); + WRITE_SHORT( (int)pev->frags ); WRITE_SHORT( m_iDeaths ); WRITE_SHORT( 0 ); WRITE_SHORT( g_pGameRules->GetTeamIndex( m_szTeamName ) + 1 ); @@ -1733,8 +1733,8 @@ void CBasePlayer::UpdateStatusBar() // allies and medics get to see the targets health if( g_pGameRules->PlayerRelationship( this, pEntity ) == GR_TEAMMATE ) { - newSBarState[SBAR_ID_TARGETHEALTH] = 100 * ( pEntity->pev->health / pEntity->pev->max_health ); - newSBarState[SBAR_ID_TARGETARMOR] = pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max. + newSBarState[SBAR_ID_TARGETHEALTH] = (int)( 100 * ( pEntity->pev->health / pEntity->pev->max_health ) ); + newSBarState[SBAR_ID_TARGETARMOR] = (int)pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max. } m_flStatusBarDisappearDelay = gpGlobals->time + 1.0; @@ -1899,7 +1899,7 @@ void CBasePlayer::PreThink( void ) if( vel ) { - m_iTrain = TrainSpeed( pTrain->pev->speed, pTrain->pev->impulse ); + m_iTrain = TrainSpeed( (int)pTrain->pev->speed, pTrain->pev->impulse ); m_iTrain |= TRAIN_ACTIVE|TRAIN_NEW; } } @@ -2010,7 +2010,7 @@ void CBasePlayer::CheckTimeBasedDamage() int i; BYTE bDuration = 0; - static float gtbdPrev = 0.0; + //static float gtbdPrev = 0.0; if( !( m_bitsDamageType & DMG_TIMEBASED ) ) return; @@ -2271,7 +2271,7 @@ void CBasePlayer::CheckSuitUpdate() // seconds, then we won't repeat playback of this word or sentence // for at least that number of seconds. -void CBasePlayer::SetSuitUpdate( char *name, int fgroup, int iNoRepeatTime ) +void CBasePlayer::SetSuitUpdate( const char *name, int fgroup, int iNoRepeatTime ) { int i; int isentence; @@ -2399,7 +2399,7 @@ void CBasePlayer::UpdatePlayerSound( void ) // is louder than his body/movement, use the weapon volume, else, use the body volume. if( FBitSet( pev->flags, FL_ONGROUND ) ) { - iBodyVolume = pev->velocity.Length(); + iBodyVolume = (int)pev->velocity.Length(); // clamp the noise that can be made by the body, in case a push trigger, // weapon recoil, or anything shoves the player abnormally fast. @@ -2432,7 +2432,7 @@ void CBasePlayer::UpdatePlayerSound( void ) } // decay weapon volume over time so bits_SOUND_COMBAT stays set for a while - m_iWeaponVolume -= 250 * gpGlobals->frametime; + m_iWeaponVolume -= (int)( 250 * gpGlobals->frametime ); if( m_iWeaponVolume < 0 ) { iVolume = 0; @@ -2450,7 +2450,7 @@ void CBasePlayer::UpdatePlayerSound( void ) } else if( iVolume > m_iTargetVolume ) { - iVolume -= 250 * gpGlobals->frametime; + iVolume -= (int)( 250 * gpGlobals->frametime ); if( iVolume < m_iTargetVolume ) { @@ -2479,7 +2479,7 @@ void CBasePlayer::UpdatePlayerSound( void ) } // keep track of virtual muzzle flash - m_iWeaponFlash -= 256 * gpGlobals->frametime; + m_iWeaponFlash -= (int)( 256 * gpGlobals->frametime ); if( m_iWeaponFlash < 0 ) m_iWeaponFlash = 0; @@ -2501,7 +2501,7 @@ void CBasePlayer::PostThink() goto pt_end; // Handle Tank controlling - if( m_pTank != NULL ) + if( m_pTank != 0 ) { // if they've moved too far from the gun, or selected a weapon, unuse the gun if( m_pTank->OnControls( pev ) && !pev->weaponmodel ) @@ -2565,7 +2565,7 @@ void CBasePlayer::PostThink() { if( m_flFallVelocity > 64 && !g_pGameRules->IsMultiplayer() ) { - CSoundEnt::InsertSound( bits_SOUND_PLAYER, pev->origin, m_flFallVelocity, 0.2 ); + CSoundEnt::InsertSound( bits_SOUND_PLAYER, pev->origin, (int)m_flFallVelocity, 0.2 ); // ALERT( at_console, "fall %f\n", m_flFallVelocity ); } m_flFallVelocity = 0; @@ -3195,7 +3195,7 @@ void CSprayCan::Think( void ) } else { - UTIL_PlayerDecalTrace( &tr, playernum, pev->frame, TRUE ); + UTIL_PlayerDecalTrace( &tr, playernum, (int)pev->frame, TRUE ); // Just painted last custom frame. if( pev->frame++ >= ( nFrames - 1 ) ) UTIL_Remove( this ); @@ -3682,7 +3682,7 @@ int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem ) // // Returns the unique ID for the ammo, or -1 if error // -int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax ) +int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax ) { if( !szName ) { @@ -3756,10 +3756,10 @@ Called every frame by the player PostThink */ void CBasePlayer::ItemPostFrame() { - static int fInSelect = FALSE; + //static int fInSelect = FALSE; // check if the player is using a tank - if( m_pTank != NULL ) + if( m_pTank != 0 ) return; #if defined( CLIENT_WEAPONS ) @@ -3912,12 +3912,12 @@ void CBasePlayer::UpdateClientData( void ) WRITE_BYTE( iHealth ); MESSAGE_END(); - m_iClientHealth = pev->health; + m_iClientHealth = (int)pev->health; } if( pev->armorvalue != m_iClientBattery ) { - m_iClientBattery = pev->armorvalue; + m_iClientBattery = (int)pev->armorvalue; ASSERT( gmsgBattery > 0 ); @@ -3945,8 +3945,8 @@ void CBasePlayer::UpdateClientData( void ) int visibleDamageBits = m_bitsDamageType & DMG_SHOWNHUD; MESSAGE_BEGIN( MSG_ONE, gmsgDamage, NULL, pev ); - WRITE_BYTE( pev->dmg_save ); - WRITE_BYTE( pev->dmg_take ); + WRITE_BYTE( (int)pev->dmg_save ); + WRITE_BYTE( (int)pev->dmg_take ); WRITE_LONG( visibleDamageBits ); WRITE_COORD( damageOrigin.x ); WRITE_COORD( damageOrigin.y ); @@ -4211,8 +4211,8 @@ Vector CBasePlayer::GetAutoaimVector( float flDelta ) { SET_CROSSHAIRANGLE( edict(), -m_vecAutoAim.x, m_vecAutoAim.y ); - m_lastx = m_vecAutoAim.x; - m_lasty = m_vecAutoAim.y; + m_lastx = (int)m_vecAutoAim.x; + m_lasty = (int)m_vecAutoAim.y; } } @@ -4556,10 +4556,10 @@ public: void KeyValue( KeyValueData *pkvd ); int m_iPose;// which sequence to display -- temporary, don't need to save - static char *m_szPoses[4]; + static const char *m_szPoses[4]; }; -char *CDeadHEV::m_szPoses[] = +const char *CDeadHEV::m_szPoses[] = { "deadback", "deadsitting", @@ -4701,7 +4701,7 @@ void CRevertSaved::KeyValue( KeyValueData *pkvd ) void CRevertSaved::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), pev->renderamt, FFADE_OUT ); + UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, FFADE_OUT ); pev->nextthink = gpGlobals->time + MessageTime(); SetThink( &CRevertSaved::MessageThink ); } diff --git a/dlls/player.h b/dlls/player.h index cb2bddf8..b2dce868 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -273,7 +273,7 @@ public: void GiveNamedItem( const char *szName ); void EnableControl(BOOL fControl); - int GiveAmmo( int iAmount, char *szName, int iMax ); + int GiveAmmo( int iAmount, const char *szName, int iMax ); void SendAmmoUpdate(void); void WaterMove( void ); @@ -281,7 +281,7 @@ public: void PlayerUse( void ); void CheckSuitUpdate(); - void SetSuitUpdate(char *name, int fgroup, int iNoRepeat); + void SetSuitUpdate( const char *name, int fgroup, int iNoRepeat ); void UpdateGeigerCounter( void ); void CheckTimeBasedDamage( void ); diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 05d1fc8c..458ac532 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -92,7 +92,7 @@ void CSatchelCharge::Spawn( void ) void CSatchelCharge::SatchelSlide( CBaseEntity *pOther ) { - entvars_t *pevOther = pOther->pev; + //entvars_t *pevOther = pOther->pev; // don't hit the guy that launched this grenade if( pOther->edict() == pev->owner ) @@ -377,11 +377,11 @@ void CSatchel::Throw( void ) { if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ) { +#ifndef CLIENT_DLL Vector vecSrc = m_pPlayer->pev->origin; Vector vecThrow = gpGlobals->v_forward * 274 + m_pPlayer->pev->velocity; -#ifndef CLIENT_DLL CBaseEntity *pSatchel = Create( "monster_satchel", vecSrc, Vector( 0, 0, 0 ), m_pPlayer->edict() ); pSatchel->pev->velocity = vecThrow; pSatchel->pev->avelocity.y = 400; diff --git a/dlls/saverestore.h b/dlls/saverestore.h index a9ad2c54..4295871d 100644 --- a/dlls/saverestore.h +++ b/dlls/saverestore.h @@ -23,7 +23,7 @@ class CSaveRestoreBuffer public: CSaveRestoreBuffer( void ); CSaveRestoreBuffer( SAVERESTOREDATA *pdata ); - ~CSaveRestoreBuffer( void ); + virtual ~CSaveRestoreBuffer( void ); int EntityIndex( entvars_t *pevLookup ); int EntityIndex( edict_t *pentLookup ); @@ -41,6 +41,10 @@ protected: SAVERESTOREDATA *m_pdata; void BufferRewind( int size ); unsigned int HashString( const char *pszToken ); +private: + // effc++ rule 11 + void operator = ( CSaveRestoreBuffer& ); + CSaveRestoreBuffer( const CSaveRestoreBuffer& ); }; class CSave : public CSaveRestoreBuffer @@ -81,7 +85,7 @@ typedef struct class CRestore : public CSaveRestoreBuffer { public: - CRestore( SAVERESTOREDATA *pdata ) : CSaveRestoreBuffer( pdata ) { m_global = 0; m_precache = TRUE; } + CRestore( SAVERESTOREDATA *pdata ) : CSaveRestoreBuffer( pdata ), m_global(0), m_precache( TRUE ) { } int ReadEntVars( const char *pname, entvars_t *pev ); // entvars_t int ReadFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); int ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount, int startField, int size, char *pName, void *pData ); @@ -160,6 +164,9 @@ private: globalentity_t *Find( string_t globalname ); globalentity_t *m_pList; int m_listCount; + // effc++ rule 11 + void operator = ( CGlobalState& ); + CGlobalState( const CGlobalState& ); }; extern CGlobalState gGlobalState; diff --git a/dlls/schedule.cpp b/dlls/schedule.cpp index c28a88fa..4a5cefca 100644 --- a/dlls/schedule.cpp +++ b/dlls/schedule.cpp @@ -238,7 +238,7 @@ void CBaseMonster::MaintainSchedule( void ) { if( (m_afConditions && !HasConditions( bits_COND_SCHEDULE_DONE ) ) || ( m_pSchedule && (m_pSchedule->iInterruptMask & bits_COND_SCHEDULE_DONE ) ) || - ( ( m_MonsterState == MONSTERSTATE_COMBAT ) && ( m_hEnemy == NULL ) ) ) + ( ( m_MonsterState == MONSTERSTATE_COMBAT ) && ( m_hEnemy == 0 ) ) ) { GetIdealState(); } @@ -407,7 +407,7 @@ void CBaseMonster::RunTask( Task_t *pTask ) { float distance; - if( m_hTargetEnt == NULL ) + if( m_hTargetEnt == 0 ) TaskFail(); else { @@ -675,7 +675,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) } case TASK_FIND_NEAR_NODE_COVER_FROM_ENEMY: { - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { TaskFail(); return; @@ -695,7 +695,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) } case TASK_FIND_FAR_NODE_COVER_FROM_ENEMY: { - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { TaskFail(); return; @@ -715,7 +715,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) } case TASK_FIND_NODE_COVER_FROM_ENEMY: { - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { TaskFail(); return; @@ -737,7 +737,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) { entvars_t *pevCover; - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { // Find cover from self if no enemy available pevCover = pev; @@ -821,7 +821,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) SetTurnActivity(); break; case TASK_FACE_TARGET: - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) { MakeIdealYaw( m_hTargetEnt->pev->origin ); SetTurnActivity(); @@ -904,7 +904,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) TaskComplete(); else { - if( m_hTargetEnt == NULL || !MoveToTarget( newActivity, 2 ) ) + if( m_hTargetEnt == 0 || !MoveToTarget( newActivity, 2 ) ) { TaskFail(); ALERT( at_aiconsole, "%s Failed to reach target!!!\n", STRING( pev->classname ) ); @@ -1043,7 +1043,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) case TASK_GET_PATH_TO_TARGET: { RouteClear(); - if( m_hTargetEnt != NULL && MoveToTarget( m_movementActivity, 1 ) ) + if( m_hTargetEnt != 0 && MoveToTarget( m_movementActivity, 1 ) ) { TaskComplete(); } @@ -1272,7 +1272,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) } case TASK_PLANT_ON_SCRIPT: { - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) { pev->origin = m_hTargetEnt->pev->origin; // Plant on target } @@ -1282,7 +1282,7 @@ void CBaseMonster::StartTask( Task_t *pTask ) } case TASK_FACE_SCRIPT: { - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) { pev->ideal_yaw = UTIL_AngleMod( m_hTargetEnt->pev->angles.y ); } diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 4e60c58e..d7659c61 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -434,7 +434,7 @@ void CScientist::Scream( void ) Activity CScientist::GetStoppedActivity( void ) { - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) return ACT_EXCITED; return CTalkMonster::GetStoppedActivity(); } @@ -510,7 +510,7 @@ void CScientist::RunTask( Task_t *pTask ) if( RANDOM_LONG( 0, 63 ) < 8 ) Scream(); - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { TaskFail(); } @@ -893,8 +893,8 @@ Schedule_t *CScientist::GetSchedule( void ) m_fearTime = gpGlobals->time; else if( DisregardEnemy( pEnemy ) ) // After 15 seconds of being hidden, return to alert { - m_hEnemy = NULL; - pEnemy = NULL; + m_hEnemy = 0; + pEnemy = 0; } } @@ -1021,12 +1021,12 @@ MONSTERSTATE CScientist::GetIdealState( void ) { // Strip enemy when going to alert m_IdealMonsterState = MONSTERSTATE_ALERT; - m_hEnemy = NULL; + m_hEnemy = 0; return m_IdealMonsterState; } // Follow if only scared a little - if( m_hTargetEnt != NULL ) + if( m_hTargetEnt != 0 ) { m_IdealMonsterState = MONSTERSTATE_ALERT; return m_IdealMonsterState; @@ -1050,7 +1050,7 @@ MONSTERSTATE CScientist::GetIdealState( void ) BOOL CScientist::CanHeal( void ) { - if( ( m_healTime > gpGlobals->time ) || ( m_hTargetEnt == NULL ) || ( m_hTargetEnt->pev->health > ( m_hTargetEnt->pev->max_health * 0.5 ) ) ) + if( ( m_healTime > gpGlobals->time ) || ( m_hTargetEnt == 0 ) || ( m_hTargetEnt->pev->health > ( m_hTargetEnt->pev->max_health * 0.5 ) ) ) return FALSE; return TRUE; @@ -1093,10 +1093,10 @@ public: void KeyValue( KeyValueData *pkvd ); int m_iPose;// which sequence to display - static char *m_szPoses[7]; + static const char *m_szPoses[7]; }; -char *CDeadScientist::m_szPoses[] = +const char *CDeadScientist::m_szPoses[] = { "lying_on_back", "lying_on_stomach", diff --git a/dlls/scripted.cpp b/dlls/scripted.cpp index f3cf37c5..da9708d1 100644 --- a/dlls/scripted.cpp +++ b/dlls/scripted.cpp @@ -1068,7 +1068,7 @@ BOOL CScriptedSentence::AcceptableSpeaker( CBaseMonster *pMonster ) { if( pev->spawnflags & SF_SENTENCE_FOLLOWERS ) { - if( pMonster->m_hTargetEnt == NULL || !FClassnameIs( pMonster->m_hTargetEnt->pev, "player" ) ) + if( pMonster->m_hTargetEnt == 0 || !FClassnameIs( pMonster->m_hTargetEnt->pev, "player" ) ) return FALSE; } BOOL override; @@ -1124,7 +1124,7 @@ BOOL CScriptedSentence::StartSentence( CBaseMonster *pTarget ) if( !pTarget ) { ALERT( at_aiconsole, "Not Playing sentence %s\n", STRING( m_iszSentence ) ); - return NULL; + return FALSE; } BOOL bConcurrent = FALSE; diff --git a/dlls/skill.cpp b/dlls/skill.cpp index 2a68e1a5..689bbadb 100644 --- a/dlls/skill.cpp +++ b/dlls/skill.cpp @@ -25,13 +25,12 @@ skilldata_t gSkillData; // take the name of a cvar, tack a digit for the skill level // on, and return the value.of that Cvar //========================================================= -float GetSkillCvar( char *pName ) +float GetSkillCvar( const char *pName ) { - int iCount; float flValue; char szBuffer[64]; - iCount = sprintf( szBuffer, "%s%d",pName, gSkillData.iSkillLevel ); + sprintf( szBuffer, "%s%d",pName, gSkillData.iSkillLevel ); flValue = CVAR_GET_FLOAT( szBuffer ); diff --git a/dlls/skill.h b/dlls/skill.h index 5e784bed..12b784e3 100644 --- a/dlls/skill.h +++ b/dlls/skill.h @@ -136,7 +136,7 @@ struct skilldata_t }; extern DLL_GLOBAL skilldata_t gSkillData; -float GetSkillCvar( char *pName ); +float GetSkillCvar( const char *pName ); extern DLL_GLOBAL int g_iSkillLevel; diff --git a/dlls/sound.cpp b/dlls/sound.cpp index b97eee12..f6110a8d 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -448,7 +448,7 @@ void CAmbientGeneric::InitModulationParms( void ) { int pitchinc; - m_dpv.volrun = pev->health * 10; // 0 - 100 + m_dpv.volrun = (int)( pev->health * 10 ); // 0 - 100 if( m_dpv.volrun > 100 ) m_dpv.volrun = 100; if( m_dpv.volrun < 0 ) @@ -553,7 +553,7 @@ void CAmbientGeneric::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, if( fraction < 0.0 ) fraction = 0.01; - m_dpv.pitch = fraction * 255; + m_dpv.pitch = (int)( fraction * 255 ); UTIL_EmitAmbientSound( ENT( pev ), pev->origin, szSoundFile, 0, 0, SND_CHANGE_PITCH, m_dpv.pitch ); return; @@ -1610,7 +1610,7 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in const char *pTextureName; float rgfl1[3]; float rgfl2[3]; - char *rgsz[4]; + const char *rgsz[4]; int cnt; float fattn = ATTN_NORM; @@ -1822,7 +1822,7 @@ IMPLEMENT_SAVERESTORE( CSpeaker, CBaseEntity ) // void CSpeaker::Spawn( void ) { - char *szSoundFile = (char*) STRING( pev->message ); + const char *szSoundFile = STRING( pev->message ); if( !m_preset && ( FStringNull( pev->message ) || strlen( szSoundFile ) < 1 ) ) { @@ -1854,7 +1854,7 @@ void CSpeaker::Precache( void ) } void CSpeaker::SpeakerThink( void ) { - char* szSoundFile; + const char* szSoundFile = NULL; float flvolume = pev->health * 0.1; float flattenuation = 0.3; int flags = 0; @@ -1911,7 +1911,7 @@ void CSpeaker::SpeakerThink( void ) } } else - szSoundFile = (char*)STRING( pev->message ); + szSoundFile = STRING( pev->message ); if( szSoundFile[0] == '!' ) { diff --git a/dlls/squadmonster.cpp b/dlls/squadmonster.cpp index a89f39f9..3d476b50 100644 --- a/dlls/squadmonster.cpp +++ b/dlls/squadmonster.cpp @@ -192,7 +192,7 @@ BOOL CSquadMonster::SquadAdd( CSquadMonster *pAdd ) for( int i = 0; i < MAX_SQUAD_MEMBERS - 1; i++ ) { - if( m_hSquadMember[i] == NULL ) + if( m_hSquadMember[i] == 0 ) { m_hSquadMember[i] = pAdd; pAdd->m_hSquadLeader = this; @@ -258,7 +258,7 @@ void CSquadMonster::SquadMakeEnemy( CBaseEntity *pEnemy ) // reset members who aren't activly engaged in fighting if( pMember->m_hEnemy != pEnemy && !pMember->HasConditions( bits_COND_SEE_ENEMY ) ) { - if( pMember->m_hEnemy != NULL ) + if( pMember->m_hEnemy != 0 ) { // remember their current enemy pMember->PushEnemy( pMember->m_hEnemy, pMember->m_vecEnemyLKP ); @@ -459,7 +459,7 @@ BOOL CSquadMonster::NoFriendlyFire( void ) Vector v_left; //!!!BUGBUG - to fix this, the planes must be aligned to where the monster will be firing its gun, not the direction it is facing!!! - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { UTIL_MakeVectors( UTIL_VecToAngles( m_hEnemy->Center() - pev->origin ) ); } @@ -508,9 +508,7 @@ BOOL CSquadMonster::NoFriendlyFire( void ) //========================================================= MONSTERSTATE CSquadMonster::GetIdealState ( void ) { - int iConditions; - - iConditions = IScheduleFlags(); + IScheduleFlags(); // If no schedule conditions, the new ideal state is probably the reason we're in here. switch( m_MonsterState ) @@ -565,7 +563,7 @@ BOOL CSquadMonster::SquadEnemySplit( void ) for( int i = 0; i < MAX_SQUAD_MEMBERS; i++ ) { CSquadMonster *pMember = pSquadLeader->MySquadMember( i ); - if( pMember != NULL && pMember->m_hEnemy != NULL && pMember->m_hEnemy != pEnemy ) + if( pMember != NULL && pMember->m_hEnemy != 0 && pMember->m_hEnemy != pEnemy ) { return TRUE; } diff --git a/dlls/squadmonster.h b/dlls/squadmonster.h index ecd75ee5..707910c2 100644 --- a/dlls/squadmonster.h +++ b/dlls/squadmonster.h @@ -88,7 +88,7 @@ public: else return (CSquadMonster *)( (CBaseEntity *)m_hSquadMember[i] ); } - int InSquad( void ) { return m_hSquadLeader != NULL; } + int InSquad( void ) { return m_hSquadLeader != 0; } int IsLeader( void ) { return m_hSquadLeader == this; } int SquadJoin( int searchRadius ); int SquadRecruit( int searchRadius, int maxMembers ); diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index 30ddda62..830cfab8 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -94,7 +94,7 @@ int CSqueakGrenade::Classify( void ) if( m_iMyClass != 0 ) return m_iMyClass; // protect against recursion - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { m_iMyClass = CLASS_INSECT; // no one cares about it switch( m_hEnemy->Classify() ) @@ -180,13 +180,13 @@ void CSqueakGrenade::Killed( entvars_t *pevAttacker, int iGib ) UTIL_BloodDrips( pev->origin, g_vecZero, BloodColor(), 80 ); - if( m_hOwner != NULL ) + if( m_hOwner != 0 ) RadiusDamage( pev, m_hOwner->pev, pev->dmg, CLASS_NONE, DMG_BLAST ); else RadiusDamage( pev, pev, pev->dmg, CLASS_NONE, DMG_BLAST ); // reset owner so death message happens - if( m_hOwner != NULL ) + if( m_hOwner != 0 ) pev->owner = m_hOwner->edict(); CBaseMonster::Killed( pevAttacker, GIB_ALWAYS ); @@ -230,7 +230,7 @@ void CSqueakGrenade::HuntThink( void ) pev->velocity = pev->velocity * 0.9; pev->velocity.z += 8.0; } - else if( ( pev->movetype = MOVETYPE_FLY ) ) + else if( pev->movetype == MOVETYPE_FLY ) { pev->movetype = MOVETYPE_BOUNCE; } @@ -241,7 +241,7 @@ void CSqueakGrenade::HuntThink( void ) m_flNextHunt = gpGlobals->time + 2.0; - CBaseEntity *pOther = NULL; + //CBaseEntity *pOther = NULL; Vector vecDir; TraceResult tr; @@ -251,7 +251,7 @@ void CSqueakGrenade::HuntThink( void ) UTIL_MakeVectors( pev->angles ); - if( m_hEnemy == NULL || !m_hEnemy->IsAlive() ) + if( m_hEnemy == 0 || !m_hEnemy->IsAlive() ) { // find target, bounce a bit towards it. Look( 512 ); @@ -270,7 +270,7 @@ void CSqueakGrenade::HuntThink( void ) if( flpitch < 80 ) flpitch = 80; - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { if( FVisible( m_hEnemy ) ) { @@ -350,9 +350,9 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther ) if( tr.pHit->v.modelindex != pev->modelindex ) { // ALERT( at_console, "hit enemy\n" ); - ClearMultiDamage( ); + ClearMultiDamage(); pOther->TraceAttack( pev, gSkillData.snarkDmgBite, gpGlobals->v_forward, &tr, DMG_SLASH ); - if( m_hOwner != NULL ) + if( m_hOwner != 0 ) ApplyMultiDamage( pev, m_hOwner->pev ); else ApplyMultiDamage( pev, pev ); diff --git a/dlls/talkmonster.cpp b/dlls/talkmonster.cpp index d832c2cc..35bf3856 100644 --- a/dlls/talkmonster.cpp +++ b/dlls/talkmonster.cpp @@ -51,7 +51,7 @@ TYPEDESCRIPTION CTalkMonster::m_SaveData[] = IMPLEMENT_SAVERESTORE( CTalkMonster, CBaseMonster ) // array of friend names -char *CTalkMonster::m_szFriends[TLK_CFRIENDS] = +const char *CTalkMonster::m_szFriends[TLK_CFRIENDS] = { "monster_barney", "monster_scientist", @@ -391,7 +391,7 @@ void CTalkMonster::StartTask( Task_t *pTask ) case TASK_TLK_EYECONTACT: break; case TASK_TLK_IDEALYAW: - if( m_hTalkTarget != NULL ) + if( m_hTalkTarget != 0 ) { pev->yaw_speed = 60; float yaw = VecToYaw( m_hTalkTarget->pev->origin - pev->origin ) - pev->angles.y; @@ -536,7 +536,7 @@ void CTalkMonster::RunTask( Task_t *pTask ) } break; case TASK_TLK_EYECONTACT: - if( !IsMoving() && IsTalking() && m_hTalkTarget != NULL ) + if( !IsMoving() && IsTalking() && m_hTalkTarget != 0 ) { // ALERT( at_console, "waiting %f\n", m_flStopTalkTime - gpGlobals->time ); IdleHeadTurn( m_hTalkTarget->pev->origin ); @@ -561,7 +561,7 @@ void CTalkMonster::RunTask( Task_t *pTask ) } break; case TASK_WAIT_FOR_MOVEMENT: - if( IsTalking() && m_hTalkTarget != NULL ) + if( IsTalking() && m_hTalkTarget != 0 ) { // ALERT( at_console, "walking, talking\n" ); IdleHeadTurn( m_hTalkTarget->pev->origin ); @@ -582,7 +582,7 @@ void CTalkMonster::RunTask( Task_t *pTask ) IdleHeadTurn( pev->origin ); break; default: - if( IsTalking() && m_hTalkTarget != NULL ) + if( IsTalking() && m_hTalkTarget != 0 ) { IdleHeadTurn( m_hTalkTarget->pev->origin ); } @@ -603,7 +603,7 @@ void CTalkMonster::Killed( entvars_t *pevAttacker, int iGib ) LimitFollowers( CBaseEntity::Instance( pevAttacker ), 0 ); } - m_hTargetEnt = NULL; + m_hTargetEnt = 0; // Don't finish that sentence StopTalking(); SetUse( NULL ); @@ -613,7 +613,7 @@ void CTalkMonster::Killed( entvars_t *pevAttacker, int iGib ) CBaseEntity *CTalkMonster::EnumFriends( CBaseEntity *pPrevious, int listNumber, BOOL bTrace ) { CBaseEntity *pFriend = pPrevious; - char *pszFriend; + const char *pszFriend; TraceResult tr; Vector vecCheck; @@ -712,7 +712,7 @@ void CTalkMonster::LimitFollowers( CBaseEntity *pPlayer, int maxFollowers ) float CTalkMonster::TargetDistance( void ) { // If we lose the player, or he dies, return a really large distance - if( m_hTargetEnt == NULL || !m_hTargetEnt->IsAlive() ) + if( m_hTargetEnt == 0 || !m_hTargetEnt->IsAlive() ) return 1e6; return ( m_hTargetEnt->pev->origin - pev->origin ).Length(); @@ -764,7 +764,7 @@ CBaseEntity *CTalkMonster::FindNearestFriend( BOOL fPlayer ) Vector vecStart = pev->origin; Vector vecCheck; int i; - char *pszFriend; + const char *pszFriend; int cfriends; vecStart.z = pev->absmax.z; @@ -855,7 +855,7 @@ void CTalkMonster::Touch( CBaseEntity *pOther ) //========================================================= void CTalkMonster::IdleRespond( void ) { - int pitch = GetVoicePitch(); + //int pitch = GetVoicePitch(); // play response PlaySentence( m_szGrp[TLK_ANSWER], RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE ); @@ -890,7 +890,7 @@ int CTalkMonster::FOkToSpeak( void ) return FALSE; // don't talk if you're in combat - if( m_hEnemy != NULL && FVisible( m_hEnemy ) ) + if( m_hEnemy != 0 && FVisible( m_hEnemy ) ) return FALSE; return TRUE; @@ -977,7 +977,7 @@ void CTalkMonster::IdleHeadTurn( Vector &vecFriend ) int CTalkMonster::FIdleSpeak( void ) { // try to start a conversation, or make statement - int pitch; + //int pitch; const char *szIdleGroup; const char *szQuestionGroup; float duration; @@ -1001,7 +1001,7 @@ int CTalkMonster::FIdleSpeak( void ) duration = RANDOM_FLOAT( 2.8, 3.2 ); } - pitch = GetVoicePitch(); + //pitch = GetVoicePitch(); // player using this entity is alive and wounded? CBaseEntity *pTarget = m_hTargetEnt; @@ -1315,10 +1315,10 @@ void CTalkMonster::StopFollowing( BOOL clearSchedule ) if( m_movementGoal == MOVEGOAL_TARGETENT ) RouteClear(); // Stop him from walking toward the player - m_hTargetEnt = NULL; + m_hTargetEnt = 0; if( clearSchedule ) ClearSchedule(); - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) m_IdealMonsterState = MONSTERSTATE_COMBAT; } } @@ -1328,7 +1328,7 @@ void CTalkMonster::StartFollowing( CBaseEntity *pLeader ) if( m_pCine ) m_pCine->CancelScript(); - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) m_IdealMonsterState = MONSTERSTATE_ALERT; m_hTargetEnt = pLeader; diff --git a/dlls/talkmonster.h b/dlls/talkmonster.h index 57c417e4..72222aae 100644 --- a/dlls/talkmonster.h +++ b/dlls/talkmonster.h @@ -138,7 +138,7 @@ public: // For following BOOL CanFollow( void ); - BOOL IsFollowing( void ) { return m_hTargetEnt != NULL && m_hTargetEnt->IsPlayer(); } + BOOL IsFollowing( void ) { return m_hTargetEnt != 0 && m_hTargetEnt->IsPlayer(); } void StopFollowing( BOOL clearSchedule ); void StartFollowing( CBaseEntity *pLeader ); virtual void DeclineFollowing( void ) {} @@ -154,7 +154,7 @@ public: static TYPEDESCRIPTION m_SaveData[]; - static char *m_szFriends[TLK_CFRIENDS]; // array of friend names + static const char *m_szFriends[TLK_CFRIENDS]; // array of friend names static float g_talkWaitTime; int m_bitsSaid; // set bits for sentences we don't want repeated diff --git a/dlls/teamplay_gamerules.cpp b/dlls/teamplay_gamerules.cpp index 614bd7bb..87b695e7 100644 --- a/dlls/teamplay_gamerules.cpp +++ b/dlls/teamplay_gamerules.cpp @@ -116,7 +116,7 @@ void CHalfLifeTeamplay::Think( void ) return; } - remain = flFragLimit - team_scores[i]; + remain = (int)( flFragLimit - team_scores[i] ); if( remain < bestfrags ) { bestfrags = remain; @@ -157,7 +157,7 @@ BOOL CHalfLifeTeamplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) if( CMD_ARGC() < 2 ) return TRUE; - int slot = atoi( CMD_ARGV( 1 ) ); + //int slot = atoi( CMD_ARGV( 1 ) ); // select the item from the current menu return TRUE; @@ -241,7 +241,7 @@ void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer ) ChangePlayerTeam( pPlayer, pPlayer->m_szTeamName, FALSE, FALSE ); UTIL_SayText( text, pPlayer ); - int clientIndex = pPlayer->entindex(); + //int clientIndex = pPlayer->entindex(); RecountTeams(); // update this player with all the other players team info // loop through all active players and send their team info to the new client @@ -300,7 +300,7 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo ); WRITE_BYTE( clientIndex ); - WRITE_SHORT( pPlayer->pev->frags ); + WRITE_SHORT( (int)pPlayer->pev->frags ); WRITE_SHORT( pPlayer->m_iDeaths ); WRITE_SHORT( 0 ); WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 ); @@ -607,7 +607,7 @@ void CHalfLifeTeamplay::RecountTeams( bool bResendInfo ) if( tm >= 0 ) { - team_scores[tm] += plr->pev->frags; + team_scores[tm] += (int)plr->pev->frags; } if( bResendInfo ) //Someone's info changed, let's send the team info again. diff --git a/dlls/tentacle.cpp b/dlls/tentacle.cpp index 637b8946..44b8b45b 100644 --- a/dlls/tentacle.cpp +++ b/dlls/tentacle.cpp @@ -486,12 +486,12 @@ void CTentacle::Cycle( void ) m_flSoundYaw += 360; if( m_flSoundYaw > 180 ) m_flSoundYaw -= 360; - +#if 0 // ALERT( at_console, "sound %d %.0f\n", m_iSoundLevel, m_flSoundYaw ); if( m_flSoundTime < gpGlobals->time ) { // play "I hear new something" sound - char *sound; + const char *sound; switch( RANDOM_LONG( 0, 1 ) ) { @@ -505,6 +505,7 @@ void CTentacle::Cycle( void ) // UTIL_EmitAmbientSound( ENT( pev ), pev->origin + Vector( 0, 0, MyHeight() ), sound, 1.0, ATTN_NORM, 0, 100 ); } +#endif m_flSoundTime = gpGlobals->time + RANDOM_FLOAT( 5.0, 10.0 ); } @@ -591,7 +592,7 @@ void CTentacle::Cycle( void ) if( m_flNextSong < gpGlobals->time ) { // play "I hear new something" sound - char *sound; + const char *sound; switch( RANDOM_LONG( 0, 1 ) ) { @@ -791,7 +792,7 @@ void CTentacle::DieThink( void ) void CTentacle::HandleAnimEvent( MonsterEvent_t *pEvent ) { - char *sound; + const char *sound; switch( pEvent->event ) { diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 958f899f..2959d96d 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1265,7 +1265,7 @@ void CTriggerVolume::Spawn( void ) pev->solid = SOLID_NOT; pev->movetype = MOVETYPE_NONE; SET_MODEL( ENT(pev), STRING( pev->model ) ); // set size and link into world - pev->model = NULL; + pev->model = 0; pev->modelindex = 0; } @@ -1438,7 +1438,7 @@ void CChangeLevel::UseChangeLevel( CBaseEntity *pActivator, CBaseEntity *pCaller void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) { edict_t *pentLandmark; - LEVELLIST levels[16]; + //LEVELLIST levels[16]; ASSERT( !FStrEq( m_szMapName, "" ) ); @@ -2224,7 +2224,7 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP } // Nothing to look at! - if( m_hTarget == NULL ) + if( m_hTarget == 0 ) { return; } @@ -2280,10 +2280,10 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP void CTriggerCamera::FollowTarget() { - if( m_hPlayer == NULL ) + if( m_hPlayer == 0 ) return; - if( m_hTarget == NULL || m_flReturnTime < gpGlobals->time ) + if( m_hTarget == 0 || m_flReturnTime < gpGlobals->time ) { if( m_hPlayer->IsAlive() ) { diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index e2ed0817..520206dd 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -162,7 +162,7 @@ void CTripmineGrenade::PowerupThink( void ) { TraceResult tr; - if( m_hOwner == NULL ) + if( m_hOwner == 0 ) { // find an owner edict_t *oldowner = pev->owner; @@ -217,7 +217,7 @@ void CTripmineGrenade::PowerupThink( void ) MakeBeam(); // play enabled sound - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "weapons/mine_activate.wav", 0.5, ATTN_NORM, 1.0, 75 ); + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "weapons/mine_activate.wav", 0.5, ATTN_NORM, 1, 75 ); } pev->nextthink = gpGlobals->time + 0.1; } @@ -280,7 +280,7 @@ void CTripmineGrenade::BeamBreakThink( void ) } else { - if( m_hOwner == NULL ) + if( m_hOwner == 0 ) bBlowup = 1; else if( m_posOwner != m_hOwner->pev->origin ) bBlowup = 1; @@ -446,7 +446,7 @@ void CTripmine::PrimaryAttack( void ) { Vector angles = UTIL_VecToAngles( tr.vecPlaneNormal ); - CBaseEntity *pEnt = CBaseEntity::Create( "monster_tripmine", tr.vecEndPos + tr.vecPlaneNormal * 8, angles, m_pPlayer->edict() ); + CBaseEntity::Create( "monster_tripmine", tr.vecEndPos + tr.vecPlaneNormal * 8, angles, m_pPlayer->edict() ); m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; diff --git a/dlls/turret.cpp b/dlls/turret.cpp index 2dce87fb..5b9e1b77 100644 --- a/dlls/turret.cpp +++ b/dlls/turret.cpp @@ -456,7 +456,7 @@ void CBaseTurret::ActiveThink( void ) pev->nextthink = gpGlobals->time + 0.1; StudioFrameAdvance(); - if( ( !m_iOn ) || ( m_hEnemy == NULL ) ) + if( ( !m_iOn ) || ( m_hEnemy == 0 ) ) { m_hEnemy = NULL; m_flLastSight = gpGlobals->time + m_flMaxWait; @@ -826,21 +826,21 @@ void CBaseTurret::SearchThink( void ) Ping(); // If we have a target and we're still healthy - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { if( !m_hEnemy->IsAlive() ) m_hEnemy = NULL;// Dead enemy forces a search for new one } // Acquire Target - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { Look( TURRET_RANGE ); m_hEnemy = BestVisibleEnemy(); } // If we've found a target, spin up the barrel and start to attack - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { m_flLastSight = 0; m_flSpinUpTime = 0; @@ -881,20 +881,20 @@ void CBaseTurret::AutoSearchThink( void ) pev->nextthink = gpGlobals->time + 0.3; // If we have a target and we're still healthy - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { if( !m_hEnemy->IsAlive() ) m_hEnemy = NULL;// Dead enemy forces a search for new one } // Acquire Target - if( m_hEnemy == NULL ) + if( m_hEnemy == 0 ) { Look( TURRET_RANGE ); m_hEnemy = BestVisibleEnemy(); } - if( m_hEnemy != NULL ) + if( m_hEnemy != 0 ) { SetThink( &CBaseTurret::Deploy ); EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_alert.wav", TURRET_MACHINE_VOLUME, ATTN_NORM ); @@ -903,7 +903,7 @@ void CBaseTurret::AutoSearchThink( void ) void CBaseTurret::TurretDeath( void ) { - BOOL iActive = FALSE; + //BOOL iActive = FALSE; StudioFrameAdvance(); pev->nextthink = gpGlobals->time + 0.1; @@ -1222,7 +1222,7 @@ void CSentry::SentryTouch( CBaseEntity *pOther ) void CSentry::SentryDeath( void ) { - BOOL iActive = FALSE; + //BOOL iActive = FALSE; StudioFrameAdvance(); pev->nextthink = gpGlobals->time + 0.1; diff --git a/dlls/util.cpp b/dlls/util.cpp index 9c7d9803..d79c9f5a 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -118,7 +118,7 @@ float UTIL_SharedRandomFloat( unsigned int seed, float low, float high ) U_Random(); U_Random(); - range = high - low; + range = (int)( high - low ); if( !range ) { return low; @@ -625,7 +625,7 @@ static unsigned short FixedUnsigned16( float value, float scale ) { int output; - output = value * scale; + output = (int)( value * scale ); if( output < 0 ) output = 0; if( output > 0xFFFF ) @@ -638,7 +638,7 @@ static short FixedSigned16( float value, float scale ) { int output; - output = value * scale; + output = (int)( value * scale ); if( output > 32767 ) output = 32767; @@ -937,10 +937,10 @@ TraceResult UTIL_GetGlobalTrace( ) { TraceResult tr; - tr.fAllSolid = gpGlobals->trace_allsolid; - tr.fStartSolid = gpGlobals->trace_startsolid; - tr.fInOpen = gpGlobals->trace_inopen; - tr.fInWater = gpGlobals->trace_inwater; + tr.fAllSolid = (int)gpGlobals->trace_allsolid; + tr.fStartSolid = (int)gpGlobals->trace_startsolid; + tr.fInOpen = (int)gpGlobals->trace_inopen; + tr.fInWater = (int)gpGlobals->trace_inwater; tr.flFraction = gpGlobals->trace_fraction; tr.flPlaneDist = gpGlobals->trace_plane_dist; tr.pHit = gpGlobals->trace_ent; @@ -1033,7 +1033,7 @@ float UTIL_SplineFraction( float value, float scale ) return 3 * valueSquared - 2 * valueSquared * value; } -char *UTIL_VarArgs( char *format, ... ) +char *UTIL_VarArgs( const char *format, ... ) { va_list argptr; static char string[1024]; @@ -1536,7 +1536,7 @@ void UTIL_PrecacheOther( const char *szClassname ) // UTIL_LogPrintf - Prints a logged message to console. // Preceded by LOG: ( timestamp ) < message > //========================================================= -void UTIL_LogPrintf( char *fmt, ... ) +void UTIL_LogPrintf( const char *fmt, ... ) { va_list argptr; static char string[1024]; @@ -1902,7 +1902,7 @@ void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd ) int i; TYPEDESCRIPTION *pField; - for( i = 0; i < ENTVARS_COUNT; i++ ) + for( i = 0; i < (int)ENTVARS_COUNT; i++ ) { pField = &gEntvarsDescription[i]; diff --git a/dlls/util.h b/dlls/util.h index f8ae0b6a..fc345ae4 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -87,8 +87,9 @@ typedef int EOFFSET; typedef int BOOL; // In case this ever changes +#ifndef M_PI #define M_PI 3.14159265358979323846 - +#endif // Keeps clutter down a bit, when declaring external entity/global method prototypes #define DECLARE_GLOBAL_METHOD(MethodName) extern void DLLEXPORT MethodName( void ) #define GLOBAL_METHOD(funcname) void DLLEXPORT funcname(void) @@ -304,7 +305,7 @@ extern float UTIL_Approach( float target, float value, float speed ); extern float UTIL_ApproachAngle( float target, float value, float speed ); extern float UTIL_AngleDistance( float next, float cur ); -extern char *UTIL_VarArgs( char *format, ... ); +extern char *UTIL_VarArgs( const char *format, ... ); extern void UTIL_Remove( CBaseEntity *pEntity ); extern BOOL UTIL_IsValidEntity( edict_t *pent ); extern BOOL UTIL_TeamsMatch( const char *pTeamName1, const char *pTeamName2 ); @@ -364,7 +365,7 @@ extern char *UTIL_dtos3( int d ); extern char *UTIL_dtos4( int d ); // Writes message to console with timestamp and FragLog header. -extern void UTIL_LogPrintf( char *fmt, ... ); +extern void UTIL_LogPrintf( const char *fmt, ... ); // Sorta like FInViewCone, but for nonmonsters. extern float UTIL_DotPoints ( const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir ); @@ -534,7 +535,7 @@ void EMIT_GROUPID_SUIT(edict_t *entity, int isentenceg); void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname); #define PRECACHE_SOUND_ARRAY( a ) \ - { for (int i = 0; i < ARRAYSIZE( a ); i++ ) PRECACHE_SOUND((char *) a [i]); } + { for (int i = 0; i < (int)ARRAYSIZE( a ); i++ ) PRECACHE_SOUND((char *) a [i]); } #define EMIT_SOUND_ARRAY_DYN( chan, array ) \ EMIT_SOUND_DYN ( ENT(pev), chan , array [ RANDOM_LONG(0,ARRAYSIZE( array )-1) ], 1.0, ATTN_NORM, 0, RANDOM_LONG(95,105) ); diff --git a/dlls/vector.h b/dlls/vector.h index d3347983..265a9b00 100644 --- a/dlls/vector.h +++ b/dlls/vector.h @@ -22,8 +22,8 @@ class Vector2D { public: - inline Vector2D(void) { } - inline Vector2D(float X, float Y) { x = X; y = Y; } + inline Vector2D(void): x( 0.0f ), y( 0.0f ) { } + inline Vector2D(float X, float Y): x( 0.0f ), y( 0.0f ) { 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*(float fl) const { return Vector2D( x * fl, y * fl ); } @@ -33,7 +33,7 @@ public: inline Vector2D Normalize ( void ) const { - Vector2D vec2; + //Vector2D vec2; float flLen = Length(); if( flLen == 0 ) @@ -60,12 +60,12 @@ class Vector // same data-layout as engine's vec3_t, { // which is a vec_t[3] public: // Construction/destruction - inline Vector( void ) { } - inline Vector( float X, float Y, float Z ) { x = X; y = Y; z = Z; } + inline Vector( void ): x( 0.0f ), y( 0.0f ), z( 0.0f ) { } + inline Vector( float X, float Y, float Z ): x( 0.0f ), y( 0.0f ), z( 0.0f ) { 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( 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( float rgfl[3] ) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; } + inline Vector( const Vector& v ): x( 0.0f ), y( 0.0f ), z( 0.0f ) { x = v.x; y = v.y; z = v.z; } + inline Vector( float rgfl[3] ): x( 0.0f ), y( 0.0f ), z( 0.0f ) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; } // Operators inline Vector operator-( void ) const { return Vector( -x, -y, -z ); } diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index ee2a8547..0b6f7de6 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -935,7 +935,7 @@ BOOL CBasePlayerWeapon::CanDeploy( void ) return TRUE; } -BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal /* = 0 */, int body ) +BOOL CBasePlayerWeapon::DefaultDeploy( const char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal /* = 0 */, int body ) { if( !CanDeploy() ) return FALSE; @@ -1400,7 +1400,7 @@ BOOL CWeaponBox::PackAmmo( int iszName, int iCount ) //========================================================= // CWeaponBox - GiveAmmo //========================================================= -int CWeaponBox::GiveAmmo( int iCount, char *szName, int iMax, int *pIndex/* = NULL*/ ) +int CWeaponBox::GiveAmmo( int iCount, const char *szName, int iMax, int *pIndex/* = NULL*/ ) { int i; diff --git a/dlls/weapons.h b/dlls/weapons.h index 3e6fc5ce..8d60bad8 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -310,7 +310,7 @@ public: virtual BOOL CanDeploy( void ); virtual BOOL IsUseable( void ); - BOOL DefaultDeploy( char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal = 0, int body = 0 ); + BOOL DefaultDeploy( const char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal = 0, int body = 0 ); int DefaultReload( int iClipSize, int iAnim, float fDelay, int body = 0 ); virtual void ItemPostFrame( void ); // called each frame by the player PostThink @@ -430,7 +430,7 @@ class CWeaponBox : public CBaseEntity void Touch( CBaseEntity *pOther ); void KeyValue( KeyValueData *pkvd ); BOOL IsEmpty( void ); - int GiveAmmo( int iCount, char *szName, int iMax, int *pIndex = NULL ); + int GiveAmmo( int iCount, const char *szName, int iMax, int *pIndex = NULL ); void SetObjectCollisionBox( void ); public: @@ -453,7 +453,7 @@ public: #ifdef CLIENT_DLL bool bIsMultiplayer ( void ); -void LoadVModel ( char *szViewModel, CBasePlayer *m_pPlayer ); +void LoadVModel ( const char *szViewModel, CBasePlayer *m_pPlayer ); #endif class CGlock : public CBasePlayerWeapon @@ -828,7 +828,9 @@ public: unsigned short m_usEgonStop; private: +#ifndef CLIENT_DLL float m_shootTime; +#endif EGON_FIREMODE m_fireMode; float m_shakeTime; BOOL m_deployed; diff --git a/dlls/world.cpp b/dlls/world.cpp index a065b5be..f352bd52 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -292,7 +292,7 @@ globalentity_t *CGlobalState::Find( string_t globalname ) //#ifdef _DEBUG void CGlobalState::DumpGlobals( void ) { - static char *estates[] = { "Off", "On", "Dead" }; + static const char *estates[] = { "Off", "On", "Dead" }; globalentity_t *pTest; ALERT( at_console, "-- Globals --\n" ); @@ -582,7 +582,7 @@ void CWorld::Precache( void ) // 63 testing LIGHT_STYLE( 63, "a" ); - for( int i = 0; i < ARRAYSIZE( gDecals ); i++ ) + for( int i = 0; i < (int)ARRAYSIZE( gDecals ); i++ ) gDecals[i].index = DECAL_INDEX( gDecals[i].name ); // init the WorldGraph. diff --git a/dlls/xen.cpp b/dlls/xen.cpp index 8e9c771c..4e9e1685 100644 --- a/dlls/xen.cpp +++ b/dlls/xen.cpp @@ -98,7 +98,7 @@ void CXenPLight::Spawn( void ) pev->frame = RANDOM_FLOAT( 0, 255 ); m_pGlow = CSprite::SpriteCreate( XEN_PLANT_GLOW_SPRITE, pev->origin + Vector(0,0,(pev->mins.z+pev->maxs.z)*0.5), FALSE ); - m_pGlow->SetTransparency( kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx ); + m_pGlow->SetTransparency( kRenderGlow, (int)pev->rendercolor.x, (int)pev->rendercolor.y, (int)pev->rendercolor.z, (int)pev->renderamt, (int)pev->renderfx ); m_pGlow->SetAttachment( edict(), 1 ); } @@ -497,7 +497,7 @@ void CXenSporeLarge::Spawn( void ) UTIL_MakeVectorsPrivate( pev->angles, forward, right, NULL ); // Rotate the leg hulls into position - for( int i = 0; i < ARRAYSIZE( m_hullSizes ); i++ ) + for( int i = 0; i < (int)ARRAYSIZE( m_hullSizes ); i++ ) CXenHull::CreateHull( this, Vector( -12, -12, 0 ), Vector( 12, 12, 120 ), ( m_hullSizes[i].x * forward ) + ( m_hullSizes[i].y * right ) ); } @@ -536,7 +536,7 @@ void CXenSpore::Touch( CBaseEntity *pOther ) void CXenSpore::Think( void ) { - float flInterval = StudioFrameAdvance(); + StudioFrameAdvance(); pev->nextthink = gpGlobals->time + 0.1; #if 0 DispatchAnimEvents( flInterval ); diff --git a/dlls/zombie.cpp b/dlls/zombie.cpp index b20293c1..2611f881 100644 --- a/dlls/zombie.cpp +++ b/dlls/zombie.cpp @@ -286,7 +286,7 @@ void CZombie::Spawn() //========================================================= void CZombie::Precache() { - int i; + size_t i; PRECACHE_MODEL( "models/zombie.mdl" ); diff --git a/engine/custom.h b/engine/custom.h index d48ee72d..8f644e00 100644 --- a/engine/custom.h +++ b/engine/custom.h @@ -16,6 +16,12 @@ #ifndef CUSTOM_H #define CUSTOM_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#endif + #include "const.h" ///////////////// diff --git a/engine/edict.h b/engine/edict.h index b0469b86..e89b6926 100644 --- a/engine/edict.h +++ b/engine/edict.h @@ -16,6 +16,12 @@ #ifndef EDICT_H #define EDICT_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#endif + #define MAX_ENT_LEAFS 48 #include "progdefs.h" @@ -39,4 +45,4 @@ struct edict_s // other fields from progs come immediately after }; -#endif//EDICT_H \ No newline at end of file +#endif//EDICT_H diff --git a/engine/eiface.h b/engine/eiface.h index 3419e5bd..30f8a82a 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -94,13 +94,13 @@ typedef unsigned int CRC32_t; // Engine hands this to DLLs for functionality callbacks typedef struct enginefuncs_s { - int (*pfnPrecacheModel)( char* s ); - int (*pfnPrecacheSound)( char* s ); + int (*pfnPrecacheModel)( const char *s ); + int (*pfnPrecacheSound)( const char *s ); void (*pfnSetModel)( edict_t *e, const char *m ); int (*pfnModelIndex)( const char *m ); int (*pfnModelFrames)( int modelIndex ); void (*pfnSetSize)( edict_t *e, const float *rgflMin, const float *rgflMax ); - void (*pfnChangeLevel)( char* s1, char* s2 ); + void (*pfnChangeLevel)( const char *s1, const char *s2 ); void (*pfnGetSpawnParms)( edict_t *ent ); void (*pfnSaveSpawnParms)( edict_t *ent ); float (*pfnVecToYaw)( const float *rgflVector ); @@ -132,12 +132,12 @@ typedef struct enginefuncs_s void (*pfnTraceModel)( const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr ); const char *(*pfnTraceTexture)( edict_t *pTextureEntity, const float *v1, const float *v2 ); void (*pfnTraceSphere)( const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr ); - void (*pfnGetAimVector)( edict_t* ent, float speed, float *rgflReturn ); - void (*pfnServerCommand)( char* str ); + void (*pfnGetAimVector)( edict_t *ent, float speed, float *rgflReturn ); + void (*pfnServerCommand)( const char *str ); void (*pfnServerExecute)( void ); - void (*pfnClientCommand)( edict_t* pEdict, char* szFmt, ... ); + void (*pfnClientCommand)( edict_t* pEdict, const char *szFmt, ... ); void (*pfnParticleEffect)( const float *org, const float *dir, float color, float count ); - void (*pfnLightStyle)( int style, char* val ); + void (*pfnLightStyle)( int style, const char *val ); int (*pfnDecalIndex)( const char *name ); int (*pfnPointContents)( const float *rgflVector ); void (*pfnMessageBegin)( int msg_dest, int msg_type, const float *pOrigin, edict_t *ed ); @@ -155,8 +155,8 @@ typedef struct enginefuncs_s const char* (*pfnCVarGetString)( const char *szVarName ); void (*pfnCVarSetFloat)( const char *szVarName, float flValue ); void (*pfnCVarSetString)( const char *szVarName, const char *szValue ); - void (*pfnAlertMessage)( ALERT_TYPE atype, char *szFmt, ... ); - void (*pfnEngineFprintf)( FILE *pfile, char *szFmt, ... ); + void (*pfnAlertMessage)( ALERT_TYPE atype, const char *szFmt, ... ); + void (*pfnEngineFprintf)( FILE *pfile, const char *szFmt, ... ); void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, int cb ); void* (*pfnPvEntPrivateData)( edict_t *pEdict ); void (*pfnFreeEntPrivateData)( edict_t *pEdict ); @@ -189,7 +189,7 @@ typedef struct enginefuncs_s void (*pfnSetView)( const edict_t *pClient, const edict_t *pViewent ); float (*pfnTime)( void ); void (*pfnCrosshairAngle)( const edict_t *pClient, float pitch, float yaw ); - byte* (*pfnLoadFileForMe)( char *filename, int *pLength ); + byte* (*pfnLoadFileForMe)( const char *filename, int *pLength ); void (*pfnFreeFile)( void *buffer ); void (*pfnEndSection)( const char *pszSectionName ); // trigger_endsection int (*pfnCompareFileTime)( char *filename1, char *filename2, int *iCompare ); @@ -201,12 +201,12 @@ typedef struct enginefuncs_s void (*pfnRunPlayerMove)( edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); int (*pfnNumberOfEntities)( void ); char* (*pfnGetInfoKeyBuffer)( edict_t *e ); // passing in NULL gets the serverinfo - char* (*pfnInfoKeyValue)( char *infobuffer, char *key ); - void (*pfnSetKeyValue)( char *infobuffer, char *key, char *value ); - void (*pfnSetClientKeyValue)( int clientIndex, char *infobuffer, char *key, char *value ); - int (*pfnIsMapValid)( char *filename ); + char* (*pfnInfoKeyValue)( char *infobuffer, const char *key ); + void (*pfnSetKeyValue)( char *infobuffer, const char *key, const char *value ); + void (*pfnSetClientKeyValue)( int clientIndex, char *infobuffer, const char *key, const char *value ); + int (*pfnIsMapValid)( const char *filename ); void (*pfnStaticDecal)( const float *origin, int decalIndex, int entityIndex, int modelIndex ); - int (*pfnPrecacheGeneric)( char *s ); + int (*pfnPrecacheGeneric)( const char *s ); int (*pfnGetPlayerUserId)( edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients void (*pfnBuildSoundMsg)( edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed ); int (*pfnIsDedicatedServer)( void ); // is this a dedicated server? @@ -228,7 +228,7 @@ typedef struct enginefuncs_s void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname ); void (*pfnDeltaUnsetField)( struct delta_s *pFields, const char *fieldname ); - void (*pfnDeltaAddEncoder)( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); + void (*pfnDeltaAddEncoder)( const char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); int (*pfnGetCurrentPlayer)( void ); int (*pfnCanSkipPlayer)( const edict_t *player ); int (*pfnDeltaFindField)( struct delta_s *pFields, const char *fieldname ); @@ -236,7 +236,7 @@ typedef struct enginefuncs_s void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber ); void (*pfnSetGroupMask)( int mask, int op ); int (*pfnCreateInstancedBaseline)( int classname, struct entity_state_s *baseline ); - void (*pfnCvar_DirectSet)( struct cvar_s *var, char *value ); + void (*pfnCvar_DirectSet)( struct cvar_s *var, const char *value ); // Forces the client and server to be running with the same version of the specified file // ( e.g., a player model ). @@ -245,7 +245,7 @@ typedef struct enginefuncs_s void (*pfnGetPlayerStats)( const edict_t *pClient, int *ping, int *packet_loss ); - void (*pfnAddServerCommand)( char *cmd_name, void (*function) (void) ); + void (*pfnAddServerCommand)( const char *cmd_name, void (*function) (void) ); // For voice communications, set which clients hear eachother. // NOTE: these functions take player entity indices (starting at 1). @@ -256,7 +256,7 @@ typedef struct enginefuncs_s void *(*pfnSequenceGet)( const char *fileName, const char *entryName ); void *(*pfnSequencePickSentence)( const char *groupName, int pickMethod, int *picked ); - int (*pfnGetFileSize)( char *filename ); + int (*pfnGetFileSize)( const char *filename ); unsigned int (*pfnGetApproxWavePlayLen)( const char *filepath ); int (*pfnIsCareerMatch)( void ); int (*pfnGetLocalizedStringLength)( const char *label ); @@ -274,9 +274,9 @@ typedef struct enginefuncs_s // Passed to pfnKeyValue typedef struct KeyValueData_s { - char *szClassName; // in: entity classname - char *szKeyName; // in: name of key - char *szValue; // in: value of key + const char *szClassName; // in: entity classname + const char *szKeyName; // in: name of key + const char *szValue; // in: value of key int fHandled; // out: DLL sets to true if key-value pair was understood } KeyValueData; @@ -374,13 +374,15 @@ typedef enum _fieldtypes typedef struct { FIELDTYPE fieldType; - char *fieldName; + const char *fieldName; int fieldOffset; short fieldSize; short flags; } TYPEDESCRIPTION; +#ifndef ARRAYSIZE #define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0])) +#endif typedef struct { @@ -434,7 +436,7 @@ typedef struct void (*pfnPM_Move)( struct playermove_s *ppmove, qboolean server ); void (*pfnPM_Init)( struct playermove_s *ppmove ); - char (*pfnPM_FindTextureType)( char *name ); + char (*pfnPM_FindTextureType)( const char *name ); void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas ); void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ); int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); diff --git a/engine/progdefs.h b/engine/progdefs.h index 74004a27..cdbcc006 100644 --- a/engine/progdefs.h +++ b/engine/progdefs.h @@ -16,6 +16,12 @@ #ifndef PROGDEFS_H #define PROGDEFS_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#endif + typedef struct { float time; @@ -215,4 +221,4 @@ typedef struct entvars_s edict_t *euser4; } entvars_t; -#endif//PROGDEFS_H \ No newline at end of file +#endif//PROGDEFS_H diff --git a/pm_shared/pm_debug.c b/pm_shared/pm_debug.c index 3baccaef..3b0879c7 100644 --- a/pm_shared/pm_debug.c +++ b/pm_shared/pm_debug.c @@ -23,8 +23,10 @@ #include +#ifdef _MSC_VER #pragma warning(disable : 4244) #pragma warning(disable : 4305) +#endif extern playermove_t *pmove; diff --git a/pm_shared/pm_debug.h b/pm_shared/pm_debug.h index 4959d165..cc130598 100644 --- a/pm_shared/pm_debug.h +++ b/pm_shared/pm_debug.h @@ -15,6 +15,12 @@ #ifndef PM_DEBUG_H #define PM_DEBUG_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#endif + void PM_ViewEntity( void ); void PM_DrawBBox( vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life ); void PM_ParticleLine( vec3_t start, vec3_t end, int pcolor, float life, float vert ); diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index cd17ce54..b4c652ba 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -16,6 +16,12 @@ #ifndef PM_DEFS_H #define PM_DEFS_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#endif + #define MAX_PHYSENTS 600 // Must have room for all entities in the world. #define MAX_MOVEENTS 64 #define MAX_CLIP_PLANES 5 diff --git a/pm_shared/pm_info.h b/pm_shared/pm_info.h index 321527f2..d9dbc03d 100644 --- a/pm_shared/pm_info.h +++ b/pm_shared/pm_info.h @@ -15,5 +15,11 @@ #ifndef PM_INFO_H #define PM_INFO_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#endif + #define MAX_PHYSINFO_STRING 256 #endif//PM_INFO_H diff --git a/pm_shared/pm_math.c b/pm_shared/pm_math.c index 3718dc63..5bbe0068 100644 --- a/pm_shared/pm_math.c +++ b/pm_shared/pm_math.c @@ -25,7 +25,9 @@ // fall over #define ROLL 2 +#ifdef _MSC_VER #pragma warning(disable : 4244) +#endif vec3_t vec3_origin = { 0,0,0 }; int nanmask = 255 << 23; diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index 7a1fb966..c709ba14 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -36,7 +36,9 @@ extern float vJumpAngles[3]; static int pm_shared_initialized = 0; +#ifdef _MSC_VER #pragma warning( disable : 4305 ) +#endif playermove_t *pmove = NULL; @@ -90,7 +92,10 @@ playermove_t *pmove = NULL; #define PLAYER_DUCKING_MULTIPLIER 0.333 // double to float warning +#ifdef _MSC_VER #pragma warning(disable : 4244) +#endif + #define max(a, b) (((a) > (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b)) // up / down @@ -549,7 +554,7 @@ void PM_UpdateStepSound( void ) float fvol; vec3_t knee; vec3_t feet; - vec3_t center; + //vec3_t center; float height; float speed; float velrun; @@ -592,7 +597,7 @@ void PM_UpdateStepSound( void ) { fWalking = speed < velrun; - VectorCopy( pmove->origin, center ); + //VectorCopy( pmove->origin, center ); VectorCopy( pmove->origin, knee ); VectorCopy( pmove->origin, feet ); @@ -1062,7 +1067,7 @@ Only used by players. Moves along the ground when player is a MOVETYPE_WALK. */ void PM_WalkMove() { - int clip; + //int clip; int oldonground; int i; @@ -1072,7 +1077,7 @@ void PM_WalkMove() vec3_t wishdir; float wishspeed; - vec3_t dest, start; + vec3_t dest; //, start; vec3_t original, originalvel; vec3_t down, downvel; float downdist, updist; @@ -1135,7 +1140,7 @@ void PM_WalkMove() dest[2] = pmove->origin[2]; // first try moving directly to the next spot - VectorCopy( dest, start ); + //VectorCopy( dest, start ); trace = pmove->PM_PlayerTrace( pmove->origin, dest, PM_NORMAL, -1 ); // If we made it all the way, then copy trace end // as new player position. @@ -1158,7 +1163,8 @@ void PM_WalkMove() VectorCopy( pmove->velocity, originalvel ); // velocity. // Slide move - clip = PM_FlyMove(); + //clip = PM_FlyMove(); + PM_FlyMove(); // Copy the results out VectorCopy( pmove->origin, down ); @@ -1183,7 +1189,8 @@ void PM_WalkMove() } // slide move the rest of the way. - clip = PM_FlyMove(); + //clip = PM_FlyMove(); + PM_FlyMove(); // Now try going back down from the end point // press down the stepheight @@ -1994,8 +2001,8 @@ void PM_Duck( void ) int buttonsChanged = ( pmove->oldbuttons ^ pmove->cmd.buttons ); // These buttons have changed this frame int nButtonPressed = buttonsChanged & pmove->cmd.buttons; // The changed ones still down are "pressed" - int duckchange = buttonsChanged & IN_DUCK ? 1 : 0; - int duckpressed = nButtonPressed & IN_DUCK ? 1 : 0; + //int duckchange = buttonsChanged & IN_DUCK ? 1 : 0; + //int duckpressed = nButtonPressed & IN_DUCK ? 1 : 0; if( pmove->cmd.buttons & IN_DUCK ) { @@ -2261,6 +2268,7 @@ void PM_AddGravity() pmove->basevelocity[2] = 0; PM_CheckVelocity(); } + /* ============ PM_PushEntity diff --git a/pm_shared/pm_shared.h b/pm_shared/pm_shared.h index 124d37ba..1d0e4f38 100644 --- a/pm_shared/pm_shared.h +++ b/pm_shared/pm_shared.h @@ -16,6 +16,12 @@ #ifndef PM_SHARED_H #define PM_SHARED_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#endif + void PM_Init( struct playermove_s *ppmove ); void PM_Move( struct playermove_s *ppmove, int server ); char PM_FindTextureType( char *name );