diff --git a/CMakeLists.txt b/CMakeLists.txt index 80c2c5d9..ffae124c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,11 @@ if(${CMAKE_VERSION} VERSION_LESS "3.0.2") endmacro() endif() +if(NOT MSVC) + add_compile_options(-Wempty-body) # GCC/Clang flag + add_compile_options(-Wreturn-type) # GCC/Clang flag +endif() + if(BUILD_CLIENT) add_subdirectory(cl_dll) endif() diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index 4104acff..4a4437bb 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -152,7 +152,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hInactive = SPR_Load( sz ); pWeapon->rcInactive = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hInactive = 0; @@ -174,7 +174,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hAmmo = SPR_Load( sz ); pWeapon->rcAmmo = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hAmmo = 0; @@ -186,7 +186,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hAmmo2 = SPR_Load( sz ); pWeapon->rcAmmo2 = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hAmmo2 = 0; @@ -320,7 +320,7 @@ int CHudAmmo::VidInit( void ) giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left; giBucketHeight = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top; - gHR.iHistoryGap = max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top ); // If we've already loaded weapons, let's get new sprites gWR.LoadAllWeaponSprites(); @@ -861,7 +861,7 @@ int CHudAmmo::Draw( float flTime ) AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left; - a = (int)max( MIN_ALPHA, m_fFade ); + a = (int)Q_max( MIN_ALPHA, m_fFade ); if( m_fFade > 0 ) m_fFade -= ( gHUD.m_flTimeDelta * 20 ); diff --git a/cl_dll/ammo_secondary.cpp b/cl_dll/ammo_secondary.cpp index 148d29b7..786f862d 100644 --- a/cl_dll/ammo_secondary.cpp +++ b/cl_dll/ammo_secondary.cpp @@ -61,7 +61,7 @@ int CHudAmmoSecondary::Draw( float flTime ) // draw secondary ammo icons above normal ammo readout int a, x, y, r, g, b, AmmoWidth; UnpackRGB( r, g, b, RGB_YELLOWISH ); - a = (int)max( MIN_ALPHA, m_fFade ); + a = (int)Q_max( MIN_ALPHA, m_fFade ); if( m_fFade > 0 ) m_fFade -= ( gHUD.m_flTimeDelta * 20 ); // slowly lower alpha to fade out icons ScaleColors( r, g, b, a ); @@ -142,7 +142,7 @@ int CHudAmmoSecondary::MsgFunc_SecAmmoVal( const char *pszName, int iSize, void int count = 0; for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ ) { - count += max( 0, m_iAmmoAmounts[i] ); + count += Q_max( 0, m_iAmmoAmounts[i] ); } if( count == 0 ) diff --git a/cl_dll/ammohistory.cpp b/cl_dll/ammohistory.cpp index 4b1e6745..a3961da7 100644 --- a/cl_dll/ammohistory.cpp +++ b/cl_dll/ammohistory.cpp @@ -111,7 +111,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) { if( rgAmmoHistory[i].type ) { - rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); + rgAmmoHistory[i].DisplayTime = Q_min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); if( rgAmmoHistory[i].DisplayTime <= flTime ) { @@ -127,7 +127,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) int r, g, b; UnpackRGB( r, g, b, RGB_YELLOWISH ); float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); // Draw the pic int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); @@ -158,7 +158,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) UnpackRGB( r, g, b, RGB_REDISH ); // if the weapon doesn't have ammo, display it as red float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ); int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left ); @@ -176,7 +176,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) UnpackRGB( r, g, b, RGB_YELLOWISH ); float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ); int xpos = ScreenWidth - ( rect.right - rect.left ) - 10; diff --git a/cl_dll/battery.cpp b/cl_dll/battery.cpp index 2f26057f..b939a8b1 100644 --- a/cl_dll/battery.cpp +++ b/cl_dll/battery.cpp @@ -78,7 +78,7 @@ int CHudBattery::Draw( float flTime ) wrect_t rc; rc = *m_prc2; - rc.top += m_iHeight * ( (float)( 100 - ( min( 100,m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1 + rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1 UnpackRGB( r, g, b, RGB_YELLOWISH ); diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index 0cb65f32..7ba3bc7e 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -148,8 +148,8 @@ inline void CenterPrint( const char *string ) inline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); } inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); } -#define max(a, b) (((a) > (b)) ? (a) : (b)) -#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define Q_max(a, b) (((a) > (b)) ? (a) : (b)) +#define Q_min(a, b) (((a) < (b)) ? (a) : (b)) #define fabs(x) ((x) > 0 ? (x) : 0 - (x)) void ScaleColors( int &r, int &g, int &b, int a ); diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index 579fc255..b0667ec2 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -106,7 +106,7 @@ int CHudDeathNotice::Draw( float flTime ) continue; } - rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); + rgDeathNoticeList[i].flDisplayTime = Q_min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); // Only draw if the viewport will let me // vgui dropped out diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 3cce6fe7..b5837247 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -238,6 +238,14 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v fattn = 1.0; cnt = 2; break; + case CHAR_TEX_SNOW: + fvol = 0.9; + fvolbar = 0.1; + rgsz[0] = "player/pl_snow1.wav"; + rgsz[1] = "player/pl_snow2.wav"; + rgsz[2] = "player/pl_snow3.wav"; + cnt = 3; + break; } // play material hit sound diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index eebf0eb0..bde24f96 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -273,25 +273,25 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom ) if( side > 0 ) { if( side > 0.3 ) - m_fAttackFront = max( m_fAttackFront, side ); + m_fAttackFront = Q_max( m_fAttackFront, side ); } else { float f = fabs( side ); if( f > 0.3 ) - m_fAttackRear = max( m_fAttackRear, f ); + m_fAttackRear = Q_max( m_fAttackRear, f ); } if( front > 0 ) { if( front > 0.3 ) - m_fAttackRight = max( m_fAttackRight, front ); + m_fAttackRight = Q_max( m_fAttackRight, front ); } else { float f = fabs( front ); if( f > 0.3 ) - m_fAttackLeft = max( m_fAttackLeft, f ); + m_fAttackLeft = Q_max( m_fAttackLeft, f ); } } } @@ -313,28 +313,28 @@ int CHudHealth::DrawPain( float flTime ) if( m_fAttackFront > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackFront, 0.5 ); + shade = a * Q_max( m_fAttackFront, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); x = ScreenWidth / 2 - SPR_Width( m_hSprite, 0 ) / 2; y = ScreenHeight / 2 - SPR_Height( m_hSprite, 0 ) * 3; SPR_DrawAdditive( 0, x, y, NULL ); - m_fAttackFront = max( 0, m_fAttackFront - fFade ); + m_fAttackFront = Q_max( 0, m_fAttackFront - fFade ); } else m_fAttackFront = 0; if( m_fAttackRight > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackRight, 0.5 ); + shade = a * Q_max( m_fAttackRight, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); x = ScreenWidth / 2 + SPR_Width( m_hSprite, 1 ) * 2; y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2; SPR_DrawAdditive( 1, x, y, NULL ); - m_fAttackRight = max( 0, m_fAttackRight - fFade ); + m_fAttackRight = Q_max( 0, m_fAttackRight - fFade ); } else m_fAttackRight = 0; @@ -342,14 +342,14 @@ int CHudHealth::DrawPain( float flTime ) if( m_fAttackRear > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackRear, 0.5 ); + shade = a * Q_max( m_fAttackRear, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); x = ScreenWidth / 2 - SPR_Width( m_hSprite, 2 ) / 2; y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2; SPR_DrawAdditive( 2, x, y, NULL ); - m_fAttackRear = max( 0, m_fAttackRear - fFade ); + m_fAttackRear = Q_max( 0, m_fAttackRear - fFade ); } else m_fAttackRear = 0; @@ -357,7 +357,7 @@ int CHudHealth::DrawPain( float flTime ) if( m_fAttackLeft > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackLeft, 0.5 ); + shade = a * Q_max( m_fAttackLeft, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); @@ -365,7 +365,7 @@ int CHudHealth::DrawPain( float flTime ) y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2; SPR_DrawAdditive( 3, x, y, NULL ); - m_fAttackLeft = max( 0, m_fAttackLeft - fFade ); + m_fAttackLeft = Q_max( 0, m_fAttackLeft - fFade ); } else m_fAttackLeft = 0; @@ -397,7 +397,7 @@ int CHudHealth::DrawDamage( float flTime ) SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b ); SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) ); - pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); + pdmg->fExpire = Q_min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); if( pdmg->fExpire <= flTime // when the time has expired && a < 40 ) // and the flash is at the low point of the cycle diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index 4a46a519..000c0c1b 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -75,7 +75,7 @@ void CHud::Think( void ) if( m_iFOV == 0 ) { // only let players adjust up in fov, and only if they are not overriden by something else - m_iFOV = max( default_fov->value, 90 ); + m_iFOV = Q_max( default_fov->value, 90 ); } } diff --git a/cl_dll/saytext.cpp b/cl_dll/saytext.cpp index 0e6a35e8..b084f44b 100644 --- a/cl_dll/saytext.cpp +++ b/cl_dll/saytext.cpp @@ -96,7 +96,7 @@ int CHudSayText::Draw( float flTime ) int y = Y_START; // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset - flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); + flScrollTime = Q_min( flScrollTime, flTime + m_HUD_saytext_time->value ); if( flScrollTime <= flTime ) { @@ -123,8 +123,8 @@ int CHudSayText::Draw( float flTime ) static char buf[MAX_PLAYER_NAME_LENGTH + 32]; // draw the first x characters in the player color - strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) ); - buf[min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0; + strncpy( buf, g_szLineBuffer[i], Q_min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) ); + buf[Q_min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0; DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); int x = DrawConsoleString( LINE_START, y, buf ); @@ -193,7 +193,7 @@ void CHudSayText::SayTextPrint( const char *pszBuf, int iBufSize, int clientInde } } - strncpy( g_szLineBuffer[i], pszBuf, max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) ); + strncpy( g_szLineBuffer[i], pszBuf, Q_max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) ); // make sure the text fits in one line EnsureTextFitsInOneLineAndWrapIfHaveTo( i ); diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index d4bdecb8..3361aa0a 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -561,7 +561,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf if( g_TeamInfo[j].name[0] == '\0' ) break; } - m_iNumTeams = max( j, m_iNumTeams ); + m_iNumTeams = Q_max( j, m_iNumTeams ); strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME ); g_TeamInfo[j].players = 0; diff --git a/cl_dll/statusbar.cpp b/cl_dll/statusbar.cpp index 98b317c5..79f30b7e 100644 --- a/cl_dll/statusbar.cpp +++ b/cl_dll/statusbar.cpp @@ -197,7 +197,7 @@ int CHudStatusBar::Draw( float fTime ) // let user set status ID bar centering if( ( i == STATUSBAR_ID_LINE ) && CVAR_GET_FLOAT( "hud_centerid" ) ) { - x = max( 0, max( 2, ( ScreenWidth - TextWidth ) ) / 2 ); + x = Q_max( 0, Q_max( 2, ( ScreenWidth - TextWidth ) ) / 2 ); y = ( ScreenHeight / 2 ) + ( TextHeight * CVAR_GET_FLOAT( "hud_centerid" ) ); } diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index 9bd88d82..ebabcb35 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -213,8 +213,8 @@ float V_CalcBob( struct ref_params_s *pparams ) bob = sqrt( vel[0] * vel[0] + vel[1] * vel[1] ) * cl_bob->value; bob = bob * 0.3 + bob * 0.7 * sin(cycle); - bob = min( bob, 4 ); - bob = max( bob, -7 ); + bob = Q_min( bob, 4 ); + bob = Q_max( bob, -7 ); return bob; } @@ -708,7 +708,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams ) if( dt > 0.0 ) { frac = ( t - ViewInterp.OriginTime[foundidx & ORIGIN_MASK] ) / dt; - frac = min( 1.0, frac ); + frac = Q_min( 1.0, frac ); VectorSubtract( ViewInterp.Origins[( foundidx + 1 ) & ORIGIN_MASK], ViewInterp.Origins[foundidx & ORIGIN_MASK], delta ); VectorMA( ViewInterp.Origins[foundidx & ORIGIN_MASK], frac, delta, neworg ); @@ -1576,7 +1576,7 @@ void V_DropPunchAngle( float frametime, float *ev_punchangle ) len = VectorNormalize( ev_punchangle ); len -= ( 10.0 + len * 0.5 ) * frametime; - len = max( len, 0.0 ); + len = Q_max( len, 0.0 ); VectorScale( ev_punchangle, len, ev_punchangle ); } diff --git a/dlls/client.cpp b/dlls/client.cpp index 75c4c5f3..214ae8b9 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -892,6 +892,11 @@ void ClientPrecache( void ) PRECACHE_SOUND( "player/pl_wade3.wav" ); PRECACHE_SOUND( "player/pl_wade4.wav" ); + PRECACHE_SOUND( "player/pl_snow1.wav" ); // walk on snow + PRECACHE_SOUND( "player/pl_snow2.wav" ); + PRECACHE_SOUND( "player/pl_snow3.wav" ); + PRECACHE_SOUND( "player/pl_snow4.wav" ); + PRECACHE_SOUND( "debris/wood1.wav" ); // hit wood texture PRECACHE_SOUND( "debris/wood2.wav" ); PRECACHE_SOUND( "debris/wood3.wav" ); diff --git a/dlls/gearbox/ctf_gamerules.cpp b/dlls/gearbox/ctf_gamerules.cpp index 8d72883a..b585f1f8 100644 --- a/dlls/gearbox/ctf_gamerules.cpp +++ b/dlls/gearbox/ctf_gamerules.cpp @@ -598,6 +598,7 @@ void CCTFMultiplay::ChangePlayerTeam(CBasePlayer *pPlayer, int iTeam) WRITE_BYTE(ENTINDEX(pPlayer->edict())); WRITE_SHORT(pPlayer->pev->frags); WRITE_SHORT(pPlayer->m_iDeaths); + WRITE_SHORT(0); WRITE_SHORT(pPlayer->pev->team); MESSAGE_END(); diff --git a/dlls/gearbox/drillsergeant.cpp b/dlls/gearbox/drillsergeant.cpp index 0e22c75e..ae372032 100644 --- a/dlls/gearbox/drillsergeant.cpp +++ b/dlls/gearbox/drillsergeant.cpp @@ -20,6 +20,7 @@ #include "cbase.h" #include "monsters.h" #include "schedule.h" +#include "defaultai.h" #include "weapons.h" #include "talkmonster.h" #include "soundent.h" @@ -32,16 +33,21 @@ public: void SetYawSpeed(void); int ISoundMask(void); virtual int ObjectCaps( void ) { return CTalkMonster::ObjectCaps() | FCAP_IMPULSE_USE; } + int Classify() { return CLASS_PLAYER_ALLY_MILITARY; } void DeathSound( void ); void PainSound( void ); + Schedule_t *GetScheduleOfType(int Type); + Schedule_t *GetSchedule(void); + void DeclineFollowing(); - void EXPORT DrillUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); virtual int Save( CSave &save ); virtual int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; + void TalkInit(); + float m_painTime; }; @@ -85,15 +91,7 @@ void CDrillSergeant::Spawn() m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP; MonsterInit(); - SetUse( &CDrillSergeant::DrillUse ); -} - -void CDrillSergeant::DrillUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) -{ - if( m_useTime > gpGlobals->time ) - return; - if( pCaller != NULL && pCaller->IsPlayer() && IRelationship(pCaller) < R_DL && IRelationship(pCaller) != R_FR ) - DeclineFollowing(); + SetUse( &CTalkMonster::FollowerUse ); } void CDrillSergeant::DeclineFollowing() @@ -173,3 +171,143 @@ void CDrillSergeant::DeathSound( void ) break; } } + +void CDrillSergeant::TalkInit() +{ + CTalkMonster::TalkInit(); + + m_szGrp[TLK_ANSWER] = "DR_ANSWER"; + m_szGrp[TLK_QUESTION] = "DR_QUESTION"; + m_szGrp[TLK_IDLE] = "DR_IDLE"; + m_szGrp[TLK_STARE] = "DR_STARE"; + m_szGrp[TLK_USE] = "DR_OK"; + m_szGrp[TLK_UNUSE] = "DR_WAIT"; + m_szGrp[TLK_STOP] = "DR_STOP"; + + m_szGrp[TLK_NOSHOOT] = "DR_SCARED"; + m_szGrp[TLK_HELLO] = "DR_HELLO"; + + m_szGrp[TLK_PLHURT1] = "!DR_CUREA"; + m_szGrp[TLK_PLHURT2] = "!DR_CUREB"; + m_szGrp[TLK_PLHURT3] = "!DR_CUREC"; + + m_szGrp[TLK_PHELLO] = NULL;// UNDONE + m_szGrp[TLK_PIDLE] = NULL;// UNDONE + m_szGrp[TLK_PQUESTION] = "DR_PQUEST"; + + m_szGrp[TLK_SMELL] = "DR_SMELL"; + + m_szGrp[TLK_WOUND] = "DR_WOUND"; + m_szGrp[TLK_MORTAL] = "DR_MORTAL"; +} + +extern Schedule_t slBaFaceTarget[]; +extern Schedule_t slBaFollow[]; +extern Schedule_t slIdleBaStand[]; + +Schedule_t *CDrillSergeant::GetScheduleOfType( int Type ) +{ + Schedule_t *psched; + + switch( Type ) + { + // Hook these to make a looping schedule + case SCHED_TARGET_FACE: + // call base class default so that barney will talk + // when 'used' + psched = CTalkMonster::GetScheduleOfType( Type ); + + if( psched == slIdleStand ) + return slBaFaceTarget; // override this for different target face behavior + else + return psched; + case SCHED_TARGET_CHASE: + return slBaFollow; + case SCHED_IDLE_STAND: + // call base class default so that scientist will talk + // when standing during idle + psched = CTalkMonster::GetScheduleOfType( Type ); + + if( psched == slIdleStand ) + { + // just look straight ahead. + return slIdleBaStand; + } + else + return psched; + } + + return CTalkMonster::GetScheduleOfType( Type ); +} + +Schedule_t *CDrillSergeant::GetSchedule( void ) +{ + if( HasConditions( bits_COND_HEAR_SOUND ) ) + { + CSound *pSound; + pSound = PBestSound(); + + ASSERT( pSound != NULL ); + if( pSound && (pSound->m_iType & bits_SOUND_DANGER) ) + return GetScheduleOfType( SCHED_TAKE_COVER_FROM_BEST_SOUND ); + } + + switch( m_MonsterState ) + { + case MONSTERSTATE_COMBAT: + { + // dead enemy + if( HasConditions( bits_COND_ENEMY_DEAD ) ) + { + // call base class, all code to handle dead enemies is centralized there. + return CBaseMonster::GetSchedule(); + } + + // always act surprized with a new enemy + if( HasConditions( bits_COND_NEW_ENEMY ) && HasConditions( bits_COND_LIGHT_DAMAGE ) ) + return GetScheduleOfType( SCHED_SMALL_FLINCH ); + + if( HasConditions( bits_COND_HEAVY_DAMAGE ) ) + return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY ); + } + break; + case MONSTERSTATE_ALERT: + case MONSTERSTATE_IDLE: + if( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) ) + { + // flinch if hurt + return GetScheduleOfType( SCHED_SMALL_FLINCH ); + } + + if( m_hEnemy == 0 && IsFollowing() ) + { + if( !m_hTargetEnt->IsAlive() ) + { + // UNDONE: Comment about the recently dead player here? + StopFollowing( FALSE ); + break; + } + else + { + if( HasConditions( bits_COND_CLIENT_PUSH ) ) + { + return GetScheduleOfType( SCHED_MOVE_AWAY_FOLLOW ); + } + return GetScheduleOfType( SCHED_TARGET_FACE ); + } + } + + if( HasConditions( bits_COND_CLIENT_PUSH ) ) + { + return GetScheduleOfType( SCHED_MOVE_AWAY ); + } + + // try to say something about smells + TrySmellTalk(); + break; + default: + break; + } + + return CTalkMonster::GetSchedule(); +} diff --git a/dlls/gearbox/fgrunt.cpp b/dlls/gearbox/fgrunt.cpp index 861f6787..395996d0 100644 --- a/dlls/gearbox/fgrunt.cpp +++ b/dlls/gearbox/fgrunt.cpp @@ -2311,6 +2311,7 @@ int CHFGrunt :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo PlaySentence( "FG_SHOT", 4, VOL_NORM, ATTN_NORM ); } } + return ret; } //========================================================= diff --git a/dlls/gearbox/penguin.cpp b/dlls/gearbox/penguin.cpp index 2bba079b..57f55b67 100644 --- a/dlls/gearbox/penguin.cpp +++ b/dlls/gearbox/penguin.cpp @@ -131,7 +131,7 @@ void CPenguinGrenade::Spawn(void) pev->gravity = 0.5; pev->friction = 0.5; - pev->dmg = gSkillData.snarkDmgPop; + pev->dmg = gSkillData.plrDmgHandGrenade; m_flDie = gpGlobals->time + PENGUIN_DETONATE_DELAY; @@ -161,33 +161,12 @@ void CPenguinGrenade::Precache(void) void CPenguinGrenade::Killed(entvars_t *pevAttacker, int iGib) { - pev->model = iStringNull;// make invisible - SetThink(&CPenguinGrenade::SUB_Remove); - SetTouch(NULL); - pev->nextthink = gpGlobals->time + 0.1; - - // since squeak grenades never leave a body behind, clear out their takedamage now. - // Squeaks do a bit of radius damage when they pop, and that radius damage will - // continue to call this function unless we acknowledge the Squeak's death now. (sjb) - pev->takedamage = DAMAGE_NO; - - // play squeek blast - EMIT_SOUND_DYN(ENT(pev), CHAN_ITEM, "squeek/sqk_blast1.wav", 1, 0.5, 0, PITCH_NORM); - - CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, SMALL_EXPLOSION_VOLUME, 3.0); - - UTIL_BloodDrips(pev->origin, g_vecZero, BloodColor(), 80); - - 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 != 0) + if( m_hOwner != 0 ) + pev->owner = m_hOwner->edict(); + CGrenade::Detonate(); + UTIL_BloodDrips( pev->origin, g_vecZero, BloodColor(), 80 ); + if( m_hOwner != 0 ) pev->owner = m_hOwner->edict(); - - CBaseMonster::Killed(pevAttacker, GIB_ALWAYS); } void CPenguinGrenade::GibMonster(void) @@ -358,7 +337,8 @@ void CPenguinGrenade::SuperBounceTouch(CBaseEntity *pOther) else ApplyMultiDamage(pev, pev); - pev->dmg += gSkillData.snarkDmgPop; // add more explosion damage + pev->dmg += gSkillData.plrDmgHandGrenade; // add more explosion damage + pev->dmg = Q_min(pev->dmg, 500); // m_flDie += 2.0; // add more life // make bite sound diff --git a/dlls/gearbox/voltigore.cpp b/dlls/gearbox/voltigore.cpp index bd3c74de..c3163b94 100644 --- a/dlls/gearbox/voltigore.cpp +++ b/dlls/gearbox/voltigore.cpp @@ -26,10 +26,11 @@ #include "decals.h" #include "soundent.h" #include "game.h" +#include "weapons.h" #define VOLTIGORE_SPRINT_DIST 256 // how close the voltigore has to get before starting to sprint and refusing to swerve -#define VOLTIGORE_MAX_BEAMS 12 +#define VOLTIGORE_MAX_BEAMS 8 #define VOLTIGORE_CLASSNAME "monster_alien_voltigore" #define VOLTIGORE_BABY_CLASSNAME "monster_alien_babyvoltigore" @@ -39,10 +40,10 @@ #define VOLTIGORE_ZAP_BLUE 255 #define VOLTIGORE_ZAP_BEAM "sprites/lgtning.spr" #define VOLTIGORE_ZAP_NOISE 80 -#define VOLTIGORE_ZAP_WIDTH 40 +#define VOLTIGORE_ZAP_WIDTH 30 #define VOLTIGORE_ZAP_BRIGHTNESS 255 #define VOLTIGORE_ZAP_DISTANCE 512 -#define VOLTIGORE_GLOW_SCALE 1.0f +#define VOLTIGORE_GLOW_SCALE 0.75f #define VOLTIGORE_GIB_COUNT 9 #define VOLTIGORE_GLOW_SPRITE "sprites/blueflare2.spr" @@ -68,8 +69,8 @@ public: void Spawn(void); static void Shoot(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity); - void Touch(CBaseEntity *pOther); - void EXPORT BeamThink(void); + void EXPORT BallTouch(CBaseEntity *pOther); + void EXPORT FlyThink(void); virtual int Save(CSave &save); virtual int Restore(CRestore &restore); @@ -112,7 +113,7 @@ void CVoltigoreEnergyBall::Spawn(void) pev->solid = SOLID_BBOX; pev->rendermode = kRenderTransAdd; - pev->renderamt = 220; + pev->renderamt = 255; SET_MODEL(ENT(pev), VOLTIGORE_GLOW_SPRITE); pev->frame = 0; @@ -135,14 +136,15 @@ void CVoltigoreEnergyBall::Shoot(entvars_t *pevOwner, Vector vecStart, Vector ve pEnergyBall->pev->velocity = vecVelocity; pEnergyBall->pev->owner = ENT(pevOwner); - pEnergyBall->SetThink(&CVoltigoreEnergyBall::BeamThink); + pEnergyBall->SetTouch(&CVoltigoreEnergyBall::BallTouch); + pEnergyBall->SetThink(&CVoltigoreEnergyBall::FlyThink); pEnergyBall->pev->nextthink = gpGlobals->time + 0.1; } //========================================================= // Purpose: //========================================================= -void CVoltigoreEnergyBall::Touch(CBaseEntity *pOther) +void CVoltigoreEnergyBall::BallTouch(CBaseEntity *pOther) { if (m_timeToDie) { return; @@ -157,17 +159,18 @@ void CVoltigoreEnergyBall::Touch(CBaseEntity *pOther) } else { - pOther->TakeDamage(pev, VARS( pev->owner ), gSkillData.voltigoreDmgBeam, DMG_SHOCK); + pOther->TakeDamage(pev, VARS( pev->owner ), gSkillData.voltigoreDmgBeam, DMG_SHOCK|DMG_ALWAYSGIB); } pev->velocity = Vector(0,0,0); m_timeToDie = gpGlobals->time + 0.3; + ResetTouch(); } //========================================================= // Purpose: //========================================================= -void CVoltigoreEnergyBall::BeamThink(void) +void CVoltigoreEnergyBall::FlyThink(void) { pev->nextthink = gpGlobals->time + 0.1; if (m_timeToDie) @@ -628,26 +631,18 @@ void CVoltigore::HandleAnimEvent(MonsterEvent_t *pEvent) case VOLTIGORE_AE_THROW: { // SOUND HERE! - Vector vecSpitOffset; Vector vecSpitDir; UTIL_MakeVectors(pev->angles); - // !!!HACKHACK - the spot at which the spit originates (in front of the mouth) was measured in 3ds and hardcoded here. - // we should be able to read the position of bones at runtime for this info. - vecSpitOffset = (gpGlobals->v_right * 8 + gpGlobals->v_forward * 37 + gpGlobals->v_up * 23); - vecSpitOffset = (pev->origin + vecSpitOffset); - vecSpitDir = ((m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs) - vecSpitOffset).Normalize(); - - vecSpitDir.x += RANDOM_FLOAT(-0.01, 0.01); - vecSpitDir.y += RANDOM_FLOAT(-0.01, 0.01); - vecSpitDir.z += RANDOM_FLOAT(-0.01, 0); - + Vector vecSpitOrigin, vecAngles; + GetAttachment(3, vecSpitOrigin, vecAngles); + vecSpitDir = ShootAtEnemy(vecSpitOrigin); // do stuff for this event. //AttackSound(); - CVoltigoreEnergyBall::Shoot(pev, vecSpitOffset, vecSpitDir * 1000); + CVoltigoreEnergyBall::Shoot(pev, vecSpitOrigin, vecSpitDir * 1000); // turn the beam glow off. DestroyBeams(); @@ -665,12 +660,19 @@ void CVoltigore::HandleAnimEvent(MonsterEvent_t *pEvent) CBaseEntity *pHurt = CheckTraceHullAttack(120, gSkillData.voltigoreDmgPunch, DMG_CLUB); if (pHurt) { - pHurt->pev->punchangle.z = -15; - pHurt->pev->punchangle.x = 15; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -150; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100; + if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT)) + { + pHurt->pev->punchangle.z = -15; + pHurt->pev->punchangle.x = 15; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -150; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100; + } EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM); + + Vector vecArmPos, vecArmAng; + GetAttachment( 0, vecArmPos, vecArmAng ); + SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood. } else { @@ -685,11 +687,18 @@ void CVoltigore::HandleAnimEvent(MonsterEvent_t *pEvent) CBaseEntity *pHurt = CheckTraceHullAttack(120, gSkillData.voltigoreDmgPunch, DMG_CLUB); if (pHurt) { - pHurt->pev->punchangle.x = 20; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 150; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100; + if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT)) + { + pHurt->pev->punchangle.x = 20; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 150; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100; + } EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM); + + Vector vecArmPos, vecArmAng; + GetAttachment( 0, vecArmPos, vecArmAng ); + SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood. } else { @@ -814,7 +823,8 @@ Schedule_t slVoltigoreRangeAttack1[] = bits_COND_NEW_ENEMY | bits_COND_ENEMY_DEAD | bits_COND_HEAVY_DAMAGE | - bits_COND_ENEMY_OCCLUDED | + // Attack animation is quite long, so it's better to not stop it when enemy hides + //bits_COND_ENEMY_OCCLUDED | bits_COND_NO_AMMO_LOADED, 0, "Voltigore Range Attack1" @@ -1041,7 +1051,7 @@ void CVoltigore::Killed(entvars_t *pevAttacker, int iGib) WRITE_SHORT( m_beamTexture ); WRITE_BYTE( 0 ); // framestart WRITE_BYTE( 10 ); // framerate - WRITE_BYTE( RANDOM_LONG( 10, 15 ) ); // life + WRITE_BYTE( RANDOM_LONG( 8, 10 ) ); // life WRITE_BYTE( VOLTIGORE_ZAP_WIDTH ); // width WRITE_BYTE( VOLTIGORE_ZAP_NOISE ); // noise WRITE_BYTE( VOLTIGORE_ZAP_RED ); // r, g, b @@ -1151,7 +1161,7 @@ void CVoltigore::UpdateBeams() void CVoltigore::CreateGlow() { m_pBeamGlow = CSprite::SpriteCreate(VOLTIGORE_GLOW_SPRITE, pev->origin, FALSE); - m_pBeamGlow->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation); + m_pBeamGlow->SetTransparency(kRenderTransAdd, 255, 255, 255, 0, kRenderFxNoDissipation); m_pBeamGlow->SetAttachment(edict(), 4); m_pBeamGlow->SetScale(VOLTIGORE_GLOW_SCALE); } @@ -1263,12 +1273,19 @@ void CBabyVoltigore::HandleAnimEvent(MonsterEvent_t* pEvent) CBaseEntity *pHurt = CheckTraceHullAttack(70, gSkillData.babyVoltigoreDmgPunch, DMG_CLUB | DMG_ALWAYSGIB); if (pHurt) { - pHurt->pev->punchangle.z = -10; - pHurt->pev->punchangle.x = 10; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -100; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50; + if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT)) + { + pHurt->pev->punchangle.z = -10; + pHurt->pev->punchangle.x = 10; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -100; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50; + } EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM); + + Vector vecArmPos, vecArmAng; + GetAttachment( 0, vecArmPos, vecArmAng ); + SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood. } else { @@ -1282,11 +1299,18 @@ void CBabyVoltigore::HandleAnimEvent(MonsterEvent_t* pEvent) CBaseEntity *pHurt = CheckTraceHullAttack(70, gSkillData.babyVoltigoreDmgPunch, DMG_CLUB | DMG_ALWAYSGIB); if (pHurt) { - pHurt->pev->punchangle.x = 15; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 100; - pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50; + if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT)) + { + pHurt->pev->punchangle.x = 15; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 100; + pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50; + } EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM); + + Vector vecArmPos, vecArmAng; + GetAttachment( 0, vecArmPos, vecArmAng ); + SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood. } else { diff --git a/dlls/player.h b/dlls/player.h index a933d8a5..1f24ac02 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -318,8 +318,6 @@ public: void TabulateAmmo( void ); - Vector m_vecLastViewAngles; - float m_flStartCharge; float m_flAmmoStartCharge; float m_flPlayAftershock; @@ -376,6 +374,8 @@ public: void Service_Grapple( void ); + Vector m_vecLastViewAngles; + bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message. bool m_bIsClimbing; diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 6637fe53..d9355e53 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -1652,6 +1652,14 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in fattn = 1.0; cnt = 2; break; + case CHAR_TEX_SNOW: + fvol = 0.9; + fvolbar = 0.1; + rgsz[0] = "player/pl_snow1.wav"; + rgsz[1] = "player/pl_snow2.wav"; + rgsz[2] = "player/pl_snow3.wav"; + cnt = 3; + break; } // did we hit a breakable? diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index c2513555..9b69156e 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -72,6 +72,7 @@ playermove_t *pmove = NULL; #define CHAR_TEX_COMPUTER 'P' #define CHAR_TEX_GLASS 'Y' #define CHAR_TEX_FLESH 'F' +#define CHAR_TEX_SNOW 'O' #define STEP_CONCRETE 0 // default step sound #define STEP_METAL 1 // metal floor @@ -82,6 +83,7 @@ playermove_t *pmove = NULL; #define STEP_SLOSH 6 // shallow liquid puddle #define STEP_WADE 7 // wading in liquid #define STEP_LADDER 8 // climbing ladder +#define STEP_SNOW 9 #define PLAYER_FATAL_FALL_SPEED 1024// approx 60 feet #define PLAYER_MAX_SAFE_FALL_SPEED 580// approx 20 feet @@ -486,6 +488,25 @@ void PM_PlayStepSound( int step, float fvol ) break; } break; + case STEP_SNOW: + switch( irand ) + { + // right foot + case 0: + pmove->PM_PlaySound( CHAN_BODY, "player/pl_snow1.wav", fvol, ATTN_NORM, 0, PITCH_NORM ); + break; + case 1: + pmove->PM_PlaySound( CHAN_BODY, "player/pl_snow3.wav", fvol, ATTN_NORM, 0, PITCH_NORM ); + break; + // left foot + case 2: + pmove->PM_PlaySound( CHAN_BODY, "player/pl_snow2.wav", fvol, ATTN_NORM, 0, PITCH_NORM ); + break; + case 3: + pmove->PM_PlaySound( CHAN_BODY, "player/pl_snow4.wav", fvol, ATTN_NORM, 0, PITCH_NORM ); + break; + } + break; } } @@ -508,6 +529,8 @@ int PM_MapTextureTypeStepType( char chTextureType ) return STEP_TILE; case CHAR_TEX_SLOSH: return STEP_SLOSH; + case CHAR_TEX_SNOW: + return STEP_SNOW; } } @@ -646,7 +669,8 @@ void PM_UpdateStepSound( void ) fvol = fWalking ? 0.2 : 0.5; pmove->flTimeStepSound = fWalking ? 400 : 300; break; - case CHAR_TEX_DIRT: + case CHAR_TEX_DIRT: + case CHAR_TEX_SNOW: fvol = fWalking ? 0.25 : 0.55; pmove->flTimeStepSound = fWalking ? 400 : 300; break;