diff --git a/cl_dll/battery.cpp b/cl_dll/battery.cpp index 28a3b1e0..21e730d3 100644 --- a/cl_dll/battery.cpp +++ b/cl_dll/battery.cpp @@ -82,9 +82,6 @@ int CHudBattery::Draw( float flTime ) UnpackRGB( r, g, b, RGB_YELLOWISH ); - if( !( gHUD.m_iWeaponBits & ( 1 << ( 4096 ) ) ) ) - return 1; - // Has health changed? Flash the health # if( m_fFade ) { diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index 1c4e7357..e63605cd 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -161,13 +161,9 @@ int CHudDeathNotice::Draw( float flTime ) x += ( gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left ); - // Draw victims name (if it was a player that was killed) - if( rgDeathNoticeList[i].iNonPlayerKill == FALSE ) - { - if( rgDeathNoticeList[i].VictimColor ) - DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] ); - x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim ); - } + if( rgDeathNoticeList[i].VictimColor ) + DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] ); + x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim ); } } diff --git a/cl_dll/dmc/DMC_Teleporters.cpp b/cl_dll/dmc/DMC_Teleporters.cpp index 9ca0e711..e6794c97 100644 --- a/cl_dll/dmc/DMC_Teleporters.cpp +++ b/cl_dll/dmc/DMC_Teleporters.cpp @@ -5,7 +5,7 @@ // $NoKeywords: $ //============================================================================= -#include "extdll.h" +#include "hud.h" #include "entity_state.h" #include "pm_defs.h" #include "pm_shared.h" @@ -17,6 +17,7 @@ #include "event_flags.h" #include "DMC_BSPFile.h" #include "cl_util.h" +#include extern "C" playermove_t *pmove; extern int g_runfuncs; @@ -513,4 +514,4 @@ void Dmc_CheckTeleporters( struct local_state_s *from, struct local_state_s *to // Run test if ( g_iUser1 == OBS_NONE ) Dmc_TouchTeleporters( to, s_teles, s_num_teles ); -} \ No newline at end of file +} diff --git a/cl_dll/flashlight.cpp b/cl_dll/flashlight.cpp index 41bb452c..cd99908d 100644 --- a/cl_dll/flashlight.cpp +++ b/cl_dll/flashlight.cpp @@ -106,9 +106,6 @@ int CHudFlashlight::Draw( float flTime ) int r, g, b, x, y, a; wrect_t rc; - if( !( gHUD.m_iWeaponBits & ( 1 << ( 4096 ) ) ) ) - return 1; - if( m_fOn ) a = 225; else diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index d2383d11..49fc16a0 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -211,8 +211,6 @@ int CHudHealth::Draw( float flTime ) GetPainColor( r, g, b ); ScaleColors( r, g, b, a ); - // Only draw health if we have the suit. - if( gHUD.m_iWeaponBits & ( 1 << ( 4096 ) ) ) { HealthWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left; int CrossWidth = gHUD.GetSpriteRect( m_HUD_cross ).right - gHUD.GetSpriteRect( m_HUD_cross ).left; diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index 5bffc42e..4381d2c1 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -90,11 +90,6 @@ int __MsgFunc_QItems( const char *pszName, int iSize, void *pbuf ) return gHUD.MsgFunc_QItems( pszName, iSize, pbuf ); } -int __MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf ) -{ - return 0; -} - // This is called every time the DLL is loaded void CHud::Init( void ) { @@ -111,9 +106,6 @@ void CHud::Init( void ) // QUAKECLASSIC HOOK_MESSAGE( QItems ); - HOOK_MESSAGE( ScoreInfo ); - //HOOK_MESSAGE( TeamScore ); - HOOK_MESSAGE( TeamInfo ); hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE ); m_iLogo = 0; @@ -324,7 +316,7 @@ void CHud::VidInit( void ) m_Geiger.VidInit(); m_Train.VidInit(); m_Battery.VidInit(); - m_Flash.VidInit(); + //m_Flash.VidInit(); m_Message.VidInit(); m_StatusBar.VidInit(); m_DeathNotice.VidInit(); diff --git a/cl_dll/hud.h b/cl_dll/hud.h index 0c514eed..ad253668 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -611,7 +611,7 @@ 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 DrawHudStringCTFint x, int y, int iMaxX, char *szString, int r, int g, int b ); + int DrawHudStringCTF( int x, int y, int iMaxX, char *szString, int r, int g, int b ); int ReturnStringPixelLength( char *Hihi ); int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ); int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ); diff --git a/cl_dll/hud_spectator.cpp b/cl_dll/hud_spectator.cpp index 025d6f9b..b94fb5f0 100644 --- a/cl_dll/hud_spectator.cpp +++ b/cl_dll/hud_spectator.cpp @@ -76,6 +76,7 @@ void SpectatorSpray( void ) gEngfuncs.pfnServerCmd( string ); } } + void SpectatorHelp( void ) { { @@ -1401,13 +1402,6 @@ void CHudSpectator::CheckSettings() } } - // if we are a real player on server don't allow inset window - // in First Person mode since this is our resticted forcecamera mode 2 - // team number 3 = SPECTATOR see player.h - - if( ( ( g_iTeamNumber == 1 ) || ( g_iTeamNumber == 2 ) ) && ( g_iUser1 == OBS_IN_EYE ) ) - m_pip->value = INSET_OFF; - // draw small border around inset view, adjust upper black bar } diff --git a/cl_dll/quake/quake_baseentity.cpp b/cl_dll/quake/quake_baseentity.cpp index fb0d3943..3ca5b74a 100644 --- a/cl_dll/quake/quake_baseentity.cpp +++ b/cl_dll/quake/quake_baseentity.cpp @@ -239,8 +239,8 @@ void CBasePlayer::PlayerUse ( void ) { } void CBasePlayer::Jump() { } void CBasePlayer::Duck( ) { } int CBasePlayer::Classify ( void ) { return 0; } -void CBasePlayer :: PlayStepSound(int step, float fvol) { } -void CBasePlayer :: UpdateStepSound( void ) { } +//void CBasePlayer :: PlayStepSound(int step, float fvol) { } +//void CBasePlayer :: UpdateStepSound( void ) { } void CBasePlayer::PreThink(void) { } void CBasePlayer::CheckTimeBasedDamage() { } void CBasePlayer :: UpdateGeigerCounter( void ) { } @@ -327,4 +327,4 @@ void CBasePlayerAmmo::Materialize( void ) { } void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) { } int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { return 0; } int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; } -void CBasePlayerWeapon::RetireWeapon( void ) { } \ No newline at end of file +void CBasePlayerWeapon::RetireWeapon( void ) { } diff --git a/cl_dll/quake/quake_weapons.cpp b/cl_dll/quake/quake_weapons.cpp index a42fdfce..353aa3bc 100644 --- a/cl_dll/quake/quake_weapons.cpp +++ b/cl_dll/quake/quake_weapons.cpp @@ -32,7 +32,7 @@ #include "../demo.h" #include "quake_gun.h" -#include "../DMC_Teleporters.h" +#include "DMC_Teleporters.h" extern globalvars_t *gpGlobals; diff --git a/common/bspfile.h b/common/bspfile.h index 809e2fd0..0ba35461 100644 --- a/common/bspfile.h +++ b/common/bspfile.h @@ -131,13 +131,13 @@ typedef struct int fileofs; int filelen; } dlump_t; - +/* typedef struct { int version; dlump_t lumps[HEADER_LUMPS]; } dheader_t; - +*/ typedef struct { int version; diff --git a/dlls/client.cpp b/dlls/client.cpp index 1d7055c6..5d9e256b 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -431,11 +431,15 @@ void ClientCommand( edict_t *pEntity ) } } } - else if( pPlayer->m_bHadFirstSpawn == false && g_bHaveMOTD ) - { - pPlayer->m_bHadFirstSpawn = true; - pPlayer->Spawn(); - } + else if( FStrEq( pcmd, "_firstspawn" ) ) + { + CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev ); + if( pPlayer->m_bHadFirstSpawn == false && g_bHaveMOTD ) + { + pPlayer->m_bHadFirstSpawn = true; + pPlayer->Spawn(); + } + } else if( FStrEq( pcmd, "lastinv" ) ) { GetClassPtr( (CBasePlayer *)pev )->SelectLastItem(); @@ -1691,12 +1695,6 @@ void UpdateClientData( const struct edict_s *ent, int sendweapons, struct client cd->vuser4.x = gun->m_iPrimaryAmmoType; cd->vuser4.y = pl->m_rgAmmo[gun->m_iPrimaryAmmoType]; cd->vuser4.z = pl->m_rgAmmo[gun->m_iSecondaryAmmoType]; - - if( pl->m_pActiveItem->m_iId == WEAPON_RPG ) - { - cd->vuser2.y = ( (CRpg *)pl->m_pActiveItem )->m_fSpotActive; - cd->vuser2.z = ( (CRpg *)pl->m_pActiveItem )->m_cActiveRockets; - } } } cd->fuser1 = (float)pl->m_iQuakeWeapon; diff --git a/dlls/dmc/quake_items.cpp b/dlls/dmc/quake_items.cpp index 7d6a8450..7e5f4fff 100644 --- a/dlls/dmc/quake_items.cpp +++ b/dlls/dmc/quake_items.cpp @@ -61,7 +61,7 @@ void CQuakeItem::Spawn() pev->movetype = MOVETYPE_TOSS; pev->solid = SOLID_TRIGGER; - SetTouch(ItemTouch); + SetTouch( &CQuakeItem::ItemTouch ); if (DROP_TO_FLOOR(ENT(pev)) == 0) { @@ -83,7 +83,7 @@ void CQuakeItem::Materialize() { // Become visible and touchable pev->effects &= ~EF_NODRAW; - SetTouch( ItemTouch ); + SetTouch( &CQuakeItem::ItemTouch ); // Play respawn sound EMIT_SOUND( ENT(pev), CHAN_WEAPON, "items/itembk2.wav", 1, ATTN_NORM ); @@ -98,11 +98,10 @@ void CQuakeItem::Respawn( float flTime ) SetTouch( NULL ); // Come back in time - SetThink ( Materialize ); + SetThink( &CQuakeItem::Materialize ); pev->nextthink = gpGlobals->time + flTime; } - //----------------------------------------------------------------------------- // Purpose: Touch function that calls the virtual touch function //----------------------------------------------------------------------------- @@ -238,7 +237,7 @@ BOOL CItemHealth::MyTouch( CBasePlayer *pPlayer ) pPlayer->m_iQuakeItems |= IT_SUPERHEALTH; if (gpGlobals->deathmatch != 4) { - SetThink( MegahealthRot ); + SetThink( &CItemHealth::MegahealthRot ); pev->nextthink = gpGlobals->time + 5; } m_hRotTarget = pPlayer; @@ -272,7 +271,7 @@ void CItemHealth::MegahealthRot( void ) // Respawn if it's not DM==2 if (gpGlobals->deathmatch != 2) { - SetThink ( Materialize ); + SetThink( &CQuakeItem::Materialize ); pev->nextthink = gpGlobals->time + 20; } else @@ -1356,7 +1355,7 @@ void CItemBackpack::Spawn() UTIL_SetOrigin( pev, pev->origin ); SET_MODEL(ENT(pev), "models/backpack.mdl"); - SetTouch(ItemTouch); + SetTouch( &CItemBackpack::ItemTouch ); } // Drop a backpack containing this player's ammo/weapons @@ -1406,7 +1405,7 @@ void CBasePlayer::DropBackpack() // Remove after 2 mins pPack->pev->nextthink = gpGlobals->time + 120; - pPack->SetThink( SUB_Remove ); + pPack->SetThink( &CBasePlayer::SUB_Remove ); // Remove all weapons m_iQuakeItems = 0; diff --git a/dlls/dmc/quake_nail.cpp b/dlls/dmc/quake_nail.cpp index ebb2001a..98e0a6f2 100644 --- a/dlls/dmc/quake_nail.cpp +++ b/dlls/dmc/quake_nail.cpp @@ -65,10 +65,10 @@ void CQuakeNail::Spawn( void ) // Safety removal pev->nextthink = gpGlobals->time + 6; - SetThink( SUB_Remove ); + SetThink( &CBaseEntity::SUB_Remove ); // Touch - SetTouch( NailTouch ); + SetTouch( &CQuakeNail::NailTouch ); // Model SET_MODEL( ENT(pev), "models/spike.mdl" ); diff --git a/dlls/dmc/quake_rocket.cpp b/dlls/dmc/quake_rocket.cpp index 25a62712..aebbb74c 100644 --- a/dlls/dmc/quake_rocket.cpp +++ b/dlls/dmc/quake_rocket.cpp @@ -49,11 +49,11 @@ CQuakeRocket *CQuakeRocket::CreateRocket( Vector vecOrigin, Vector vecAngles, CB pRocket->pev->angles = UTIL_VecToAngles( vecAngles ); // Touch - pRocket->SetTouch( CQuakeRocket::RocketTouch ); + pRocket->SetTouch( &CQuakeRocket::RocketTouch ); // Safety Remove pRocket->pev->nextthink = gpGlobals->time + 5; - pRocket->SetThink( SUB_Remove ); + pRocket->SetThink( &CBaseEntity::SUB_Remove ); // Effects // pRocket->pev->effects |= EF_LIGHT; @@ -87,7 +87,7 @@ CQuakeRocket *CQuakeRocket::CreateGrenade( Vector vecOrigin, Vector vecVelocity, pRocket->pev->friction = 0.5; // Touch - pRocket->SetTouch( CQuakeRocket::GrenadeTouch ); + pRocket->SetTouch( &CQuakeRocket::GrenadeTouch ); // set newmis duration if ( gpGlobals->deathmatch == 4 ) @@ -98,7 +98,7 @@ CQuakeRocket *CQuakeRocket::CreateGrenade( Vector vecOrigin, Vector vecVelocity, } pRocket->pev->nextthink = gpGlobals->time + 2.5; - pRocket->SetThink( CQuakeRocket::GrenadeExplode ); + pRocket->SetThink( &CQuakeRocket::GrenadeExplode ); PLAYBACK_EVENT_FULL (FEV_GLOBAL, pRocket->edict(), g_sTrail, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.7, 0.0, pRocket->entindex(), GRENADE_TRAIL, 0, 0); @@ -188,4 +188,4 @@ void CQuakeRocket::Explode() PLAYBACK_EVENT_FULL( FEV_GLOBAL, edict(), g_sExplosion, 0.0, (float *)&pev->origin, (float *)&pev->velocity, 0.0, 0.0, 0, 0, 0, 0 ); UTIL_Remove( this ); -} \ No newline at end of file +} diff --git a/dlls/doors.cpp b/dlls/doors.cpp index 4f2f58b3..a5d4941d 100644 --- a/dlls/doors.cpp +++ b/dlls/doors.cpp @@ -632,18 +632,20 @@ void CBaseDoor::DoorGoUp( void ) // emit door moving and stop sounds on CHAN_STATIC so that the multicast doesn't // filter them out and leave a client stuck with looping door sounds! if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) && m_bIsReopening == false ) + { + // don't play sounds too often + if( m_fNextSoundPlay < gpGlobals->time ) { - // don't play sounds too often - if( m_fNextSoundPlay < gpGlobals->time ) - { - PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorGoUp, 0.0, (float *)&Center(), (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); + Vector vecCenter( Center() ); + float *pCenter = (float *)&vecCenter; + PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorGoUp, 0.0, pCenter, (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); #if defined ( OLD_SOUNDS ) - STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) ); - if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN ) - EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ), 1, ATTN_NORM ); + STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) ); + if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN ) + EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ), 1, ATTN_NORM ); #endif - } - + } + } m_toggle_state = TS_GOING_UP; SetMoveDone( &CBaseDoor::DoorHitTop ); @@ -686,8 +688,9 @@ void CBaseDoor::DoorHitTop( void ) if( ( ( m_fNextSoundPlay < gpGlobals->time ) && !m_bIsReopening ) || ( !m_bStoppedOpenSound ) ) { m_bStoppedOpenSound = true; - - PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorHitTop, 0.0, (float *)&Center(), (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); + Vector vecCenter( Center() ); + float *pCenter = (float *)&vecCenter; + PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorHitTop, 0.0, pCenter, (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); #if defined ( OLD_SOUNDS ) STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) ); @@ -736,13 +739,16 @@ void CBaseDoor::DoorGoDown( void ) // don't play sounds too often if( m_fNextSoundPlay < gpGlobals->time ) { - PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorGoDown, 0.0, (float *)&Center(), (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); + Vector vecCenter( Center() ); + float *pCenter = (float *)&vecCenter; + PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorGoDown, 0.0, pCenter, (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); #if defined ( OLD_SOUNDS ) STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) ); if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN ) EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ), 1, ATTN_NORM ); #endif } + } #ifdef DOOR_ASSERT ASSERT( m_toggle_state == TS_AT_TOP ); #endif // DOOR_ASSERT @@ -765,7 +771,9 @@ void CBaseDoor::DoorHitBottom( void ) // don't play sounds too often if( m_fNextSoundPlay < gpGlobals->time ) { - PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorHitBottom, 0.0, (float *)&Center(), (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); + Vector vecCenter( Center() ); + float *pCenter = (float *)&vecCenter; + PLAYBACK_EVENT_FULL( FEV_RELIABLE, NULL, m_usDoorHitBottom, 0.0, pCenter, (float *)&g_vecZero, 0.0, 0.0, ( m_bMoveSnd << 8 ) | ( m_bStopSnd & 0xff ), 0, 0, 0 ); #if defined ( OLD_SOUNDS ) STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) ); EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseArrived ), 1, ATTN_NORM ); diff --git a/dlls/gamerules.h b/dlls/gamerules.h index e1324878..cec50e43 100644 --- a/dlls/gamerules.h +++ b/dlls/gamerules.h @@ -260,8 +260,6 @@ class CHalfLifeMultiplay : public CGameRules public: CHalfLifeMultiplay(); - virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd ); - // GR_Think virtual void Think( void ); virtual void RefreshSkillData( void ); diff --git a/dlls/monsterstate.cpp b/dlls/monsterstate.cpp index f29664dc..144032e8 100644 --- a/dlls/monsterstate.cpp +++ b/dlls/monsterstate.cpp @@ -55,179 +55,3 @@ void CBaseMonster::SetState( MONSTERSTATE State ) m_MonsterState = State; m_IdealMonsterState = State; } - -//========================================================= -// RunAI -//========================================================= -void CBaseMonster::RunAI( void ) -{ - // to test model's eye height - //UTIL_ParticleEffect ( pev->origin + pev->view_ofs, g_vecZero, 255, 10 ); - - // IDLE sound permitted in ALERT state is because monsters were silent in ALERT state. Only play IDLE sound in IDLE state - // once we have sounds for that state. - if( ( m_MonsterState == MONSTERSTATE_IDLE || m_MonsterState == MONSTERSTATE_ALERT ) && RANDOM_LONG( 0, 99 ) == 0 && !( pev->flags & SF_MONSTER_GAG ) ) - { - IdleSound(); - } - - if( m_MonsterState != MONSTERSTATE_NONE && - m_MonsterState != MONSTERSTATE_PRONE && - m_MonsterState != MONSTERSTATE_DEAD )// don't bother with this crap if monster is prone. - { - // collect some sensory Condition information. - // don't let monsters outside of the player's PVS act up, or most of the interesting - // things will happen before the player gets there! - // UPDATE: We now let COMBAT state monsters think and act fully outside of player PVS. This allows the player to leave - // an area where monsters are fighting, and the fight will continue. - if( !FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) || ( m_MonsterState == MONSTERSTATE_COMBAT ) ) - { - Look( m_flDistLook ); - Listen();// check for audible sounds. - - // now filter conditions. - ClearConditions( IgnoreConditions() ); - - GetEnemy(); - } - - // do these calculations if monster has an enemy. - if( m_hEnemy != NULL ) - { - CheckEnemy( m_hEnemy ); - } - - CheckAmmo(); - } - - FCheckAITrigger(); - - PrescheduleThink(); - - MaintainSchedule(); - - // if the monster didn't use these conditions during the above call to MaintainSchedule() or CheckAITrigger() - // we throw them out cause we don't want them sitting around through the lifespan of a schedule - // that doesn't use them. - m_afConditions &= ~( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ); -} - -//========================================================= -// GetIdealState - surveys the Conditions information available -// and finds the best new state for a monster. -//========================================================= -MONSTERSTATE CBaseMonster::GetIdealState( void ) -{ - int iConditions; - - iConditions = IScheduleFlags(); - - // If no schedule conditions, the new ideal state is probably the reason we're in here. - switch( m_MonsterState ) - { - case MONSTERSTATE_IDLE: - /* - IDLE goes to ALERT upon hearing a sound - -IDLE goes to ALERT upon being injured - IDLE goes to ALERT upon seeing food - -IDLE goes to COMBAT upon sighting an enemy - IDLE goes to HUNT upon smelling food - */ - { - if( iConditions & bits_COND_NEW_ENEMY ) - { - // new enemy! This means an idle monster has seen someone it dislikes, or - // that a monster in combat has found a more suitable target to attack - m_IdealMonsterState = MONSTERSTATE_COMBAT; - } - else if( iConditions & bits_COND_LIGHT_DAMAGE ) - { - MakeIdealYaw( m_vecEnemyLKP ); - m_IdealMonsterState = MONSTERSTATE_ALERT; - } - else if( iConditions & bits_COND_HEAVY_DAMAGE ) - { - MakeIdealYaw( m_vecEnemyLKP ); - m_IdealMonsterState = MONSTERSTATE_ALERT; - } - else if( iConditions & bits_COND_HEAR_SOUND ) - { - CSound *pSound; - - pSound = PBestSound(); - ASSERT( pSound != NULL ); - if( pSound ) - { - MakeIdealYaw( pSound->m_vecOrigin ); - if( pSound->m_iType & ( bits_SOUND_COMBAT|bits_SOUND_DANGER ) ) - m_IdealMonsterState = MONSTERSTATE_ALERT; - } - } - else if( iConditions & ( bits_COND_SMELL | bits_COND_SMELL_FOOD ) ) - { - m_IdealMonsterState = MONSTERSTATE_ALERT; - } - - break; - } - case MONSTERSTATE_ALERT: - /* - ALERT goes to IDLE upon becoming bored - -ALERT goes to COMBAT upon sighting an enemy - ALERT goes to HUNT upon hearing a noise - */ - { - if( iConditions & ( bits_COND_NEW_ENEMY | bits_COND_SEE_ENEMY ) ) - { - // see an enemy we MUST attack - m_IdealMonsterState = MONSTERSTATE_COMBAT; - } - else if( iConditions & bits_COND_HEAR_SOUND ) - { - m_IdealMonsterState = MONSTERSTATE_ALERT; - CSound *pSound = PBestSound(); - ASSERT( pSound != NULL ); - if( pSound ) - MakeIdealYaw( pSound->m_vecOrigin ); - } - break; - } - case MONSTERSTATE_COMBAT: - /* - COMBAT goes to HUNT upon losing sight of enemy - COMBAT goes to ALERT upon death of enemy - */ - { - if( m_hEnemy == NULL ) - { - m_IdealMonsterState = MONSTERSTATE_ALERT; - // pev->effects = EF_BRIGHTFIELD; - ALERT( at_aiconsole, "***Combat state with no enemy!\n" ); - } - break; - } - case MONSTERSTATE_HUNT: - /* - HUNT goes to ALERT upon seeing food - HUNT goes to ALERT upon being injured - HUNT goes to IDLE if goal touched - HUNT goes to COMBAT upon seeing enemy - */ - { - break; - } - case MONSTERSTATE_SCRIPT: - if( iConditions & ( bits_COND_TASK_FAILED | bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) ) - { - ExitScriptedSequence(); // This will set the ideal state - } - break; - case MONSTERSTATE_DEAD: - m_IdealMonsterState = MONSTERSTATE_DEAD; - break; - default: - break; - } - - return m_IdealMonsterState; -} diff --git a/dlls/player.cpp b/dlls/player.cpp index ab6018f3..9dc6e176 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -220,7 +220,7 @@ void LinkUserMessages( void ) gmsgInitHUD = REG_USER_MSG( "InitHUD", -1 ); // called every time a new player joins the server gmsgShowGameTitle = REG_USER_MSG( "GameTitle", 1 ); gmsgDeathMsg = REG_USER_MSG( "DeathMsg", -1 ); - gmsgScoreInfo = REG_USER_MSG( "ScoreInfo", 7 ); + gmsgScoreInfo = REG_USER_MSG( "ScoreInfo", 9 ); gmsgTeamInfo = REG_USER_MSG( "TeamInfo", -1 ); // sets the name of a player's team gmsgTeamScore = REG_USER_MSG( "TeamScore", -1 ); // sets the score of a team on the scoreboard gmsgGameMode = REG_USER_MSG( "GameMode", 1 ); @@ -246,7 +246,7 @@ void LinkUserMessages( void ) LINK_ENTITY_TO_CLASS( player, CBasePlayer ) // QUAKECLASSIC: Play pain sounds -void CBasePlayer::Pain( void ) +void CBasePlayer::Pain( CBaseEntity *pAttacker ) { if( pev->health < 0 ) return; @@ -1336,103 +1336,6 @@ void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) } } - -//Player ID -void CBasePlayer::InitStatusBar() -{ - m_flStatusBarDisappearDelay = 0; - m_SbarString1[0] = m_SbarString0[0] = 0; -} - -void CBasePlayer::UpdateStatusBar() -{ - int newSBarState[SBAR_END] = {0}; - char sbuf0[SBAR_STRING_SIZE]; - char sbuf1[ SBAR_STRING_SIZE ]; - - strcpy( sbuf0, m_SbarString0 ); - strcpy( sbuf1, m_SbarString1 ); - - // Find an ID Target - TraceResult tr; - UTIL_MakeVectors( pev->v_angle + pev->punchangle ); - Vector vecSrc = EyePosition(); - Vector vecEnd = vecSrc + ( gpGlobals->v_forward * MAX_ID_RANGE ); - UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, edict(), &tr ); - - if( tr.flFraction != 1.0 ) - { - if( !FNullEnt( tr.pHit ) ) - { - CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit ); - - if( pEntity->Classify() == CLASS_PLAYER ) - { - newSBarState[SBAR_ID_TARGETNAME] = ENTINDEX( pEntity->edict() ); - strcpy( sbuf1, "1 %p1\n2 Health: %i2%%\n3 Armor: %i3%%" ); - - // 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. - } - - m_flStatusBarDisappearDelay = gpGlobals->time + 1.0; - } - } - else if( m_flStatusBarDisappearDelay > gpGlobals->time ) - { - // hold the values for a short amount of time after viewing the object - newSBarState[SBAR_ID_TARGETNAME] = m_izSBarState[SBAR_ID_TARGETNAME]; - newSBarState[SBAR_ID_TARGETHEALTH] = m_izSBarState[SBAR_ID_TARGETHEALTH]; - newSBarState[SBAR_ID_TARGETARMOR] = m_izSBarState[SBAR_ID_TARGETARMOR]; - } - } - - BOOL bForceResend = FALSE; - - if( strcmp( sbuf0, m_SbarString0 ) ) - { - MESSAGE_BEGIN( MSG_ONE, gmsgStatusText, NULL, pev ); - WRITE_BYTE( 0 ); - WRITE_STRING( sbuf0 ); - MESSAGE_END(); - - strcpy( m_SbarString0, sbuf0 ); - - // make sure everything's resent - bForceResend = TRUE; - } - - if( strcmp( sbuf1, m_SbarString1 ) ) - { - MESSAGE_BEGIN( MSG_ONE, gmsgStatusText, NULL, pev ); - WRITE_BYTE( 1 ); - WRITE_STRING( sbuf1 ); - MESSAGE_END(); - - strcpy( m_SbarString1, sbuf1 ); - - // make sure everything's resent - bForceResend = TRUE; - } - - // Check values and send if they don't match - for( int i = 1; i < SBAR_END; i++ ) - { - if( newSBarState[i] != m_izSBarState[i] || bForceResend ) - { - MESSAGE_BEGIN( MSG_ONE, gmsgStatusValue, NULL, pev ); - WRITE_BYTE( i ); - WRITE_SHORT( newSBarState[i] ); - MESSAGE_END(); - - m_izSBarState[i] = newSBarState[i]; - } - } -} - void CBasePlayer::PowerUpThink( void ) { int iPowerUp = 0; diff --git a/dlls/schedule.cpp b/dlls/schedule.cpp index c28a88fa..a639b40f 100644 --- a/dlls/schedule.cpp +++ b/dlls/schedule.cpp @@ -25,1479 +25,16 @@ #include "scripted.h" #include "nodes.h" #include "defaultai.h" -#include "soundent.h" extern CGraph WorldGraph; -//========================================================= -// FHaveSchedule - Returns TRUE if monster's m_pSchedule -// is anything other than NULL. -//========================================================= -BOOL CBaseMonster::FHaveSchedule( void ) -{ - if( m_pSchedule == NULL ) - { - return FALSE; - } - - return TRUE; -} - -//========================================================= -// ClearSchedule - blanks out the caller's schedule pointer -// and index. -//========================================================= -void CBaseMonster::ClearSchedule( void ) -{ - m_iTaskStatus = TASKSTATUS_NEW; - m_pSchedule = NULL; - m_iScheduleIndex = 0; -} - -//========================================================= -// FScheduleDone - Returns TRUE if the caller is on the -// last task in the schedule -//========================================================= -BOOL CBaseMonster::FScheduleDone( void ) -{ - ASSERT( m_pSchedule != NULL ); - - if( m_iScheduleIndex == m_pSchedule->cTasks ) - { - return TRUE; - } - - return FALSE; -} - -//========================================================= -// ChangeSchedule - replaces the monster's schedule pointer -// with the passed pointer, and sets the ScheduleIndex back -// to 0 -//========================================================= -void CBaseMonster::ChangeSchedule( Schedule_t *pNewSchedule ) -{ - ASSERT( pNewSchedule != NULL ); - - m_pSchedule = pNewSchedule; - m_iScheduleIndex = 0; - m_iTaskStatus = TASKSTATUS_NEW; - m_afConditions = 0;// clear all of the conditions - m_failSchedule = SCHED_NONE; - - if( m_pSchedule->iInterruptMask & bits_COND_HEAR_SOUND && !(m_pSchedule->iSoundMask) ) - { - ALERT( at_aiconsole, "COND_HEAR_SOUND with no sound mask!\n" ); - } - else if( m_pSchedule->iSoundMask && !(m_pSchedule->iInterruptMask & bits_COND_HEAR_SOUND) ) - { - ALERT( at_aiconsole, "Sound mask without COND_HEAR_SOUND!\n" ); - } - -#if _DEBUG - if( !ScheduleFromName( pNewSchedule->pName ) ) - { - ALERT( at_console, "Schedule %s not in table!!!\n", pNewSchedule->pName ); - } -#endif - -// this is very useful code if you can isolate a test case in a level with a single monster. It will notify -// you of every schedule selection the monster makes. -#if 0 - if( FClassnameIs( pev, "monster_human_grunt" ) ) - { - Task_t *pTask = GetTask(); - - if( pTask ) - { - const char *pName = NULL; - - if( m_pSchedule ) - { - pName = m_pSchedule->pName; - } - else - { - pName = "No Schedule"; - } - - if( !pName ) - { - pName = "Unknown"; - } - - ALERT( at_aiconsole, "%s: picked schedule %s\n", STRING( pev->classname ), pName ); - } - } -#endif// 0 -} - -//========================================================= -// NextScheduledTask - increments the ScheduleIndex -//========================================================= -void CBaseMonster::NextScheduledTask( void ) -{ - ASSERT( m_pSchedule != NULL ); - - m_iTaskStatus = TASKSTATUS_NEW; - m_iScheduleIndex++; - - if( FScheduleDone() ) - { - // just completed last task in schedule, so make it invalid by clearing it. - SetConditions( bits_COND_SCHEDULE_DONE ); - //ClearSchedule(); - } -} - -//========================================================= -// IScheduleFlags - returns an integer with all Conditions -// bits that are currently set and also set in the current -// schedule's Interrupt mask. -//========================================================= -int CBaseMonster::IScheduleFlags( void ) -{ - if( !m_pSchedule ) - { - return 0; - } - - // strip off all bits excepts the ones capable of breaking this schedule. - return m_afConditions & m_pSchedule->iInterruptMask; -} - -//========================================================= -// FScheduleValid - returns TRUE as long as the current -// schedule is still the proper schedule to be executing, -// taking into account all conditions -//========================================================= -BOOL CBaseMonster::FScheduleValid( void ) -{ - if( m_pSchedule == NULL ) - { - // schedule is empty, and therefore not valid. - return FALSE; - } - - if( HasConditions( m_pSchedule->iInterruptMask | bits_COND_SCHEDULE_DONE | bits_COND_TASK_FAILED ) ) - { -#ifdef DEBUG - if( HasConditions( bits_COND_TASK_FAILED ) && m_failSchedule == SCHED_NONE ) - { - // fail! Send a visual indicator. - ALERT( at_aiconsole, "Schedule: %s Failed\n", m_pSchedule->pName ); - - Vector tmp = pev->origin; - tmp.z = pev->absmax.z + 16; - UTIL_Sparks( tmp ); - } -#endif // DEBUG - // some condition has interrupted the schedule, or the schedule is done - return FALSE; - } - - return TRUE; -} - -//========================================================= -// MaintainSchedule - does all the per-think schedule maintenance. -// ensures that the monster leaves this function with a valid -// schedule! -//========================================================= -void CBaseMonster::MaintainSchedule( void ) -{ - Schedule_t *pNewSchedule; - int i; - - // UNDONE: Tune/fix this 10... This is just here so infinite loops are impossible - for( i = 0; i < 10; i++ ) - { - if( m_pSchedule != NULL && TaskIsComplete() ) - { - NextScheduledTask(); - } - - // validate existing schedule - if( !FScheduleValid() || m_MonsterState != m_IdealMonsterState ) - { - // if we come into this block of code, the schedule is going to have to be changed. - // if the previous schedule was interrupted by a condition, GetIdealState will be - // called. Else, a schedule finished normally. - - // Notify the monster that his schedule is changing - ScheduleChange(); - - // Call GetIdealState if we're not dead and one or more of the following... - // - in COMBAT state with no enemy (it died?) - // - conditions bits (excluding SCHEDULE_DONE) indicate interruption, - // - schedule is done but schedule indicates it wants GetIdealState called - // after successful completion (by setting bits_COND_SCHEDULE_DONE in iInterruptMask) - // DEAD & SCRIPT are not suggestions, they are commands! - if( m_IdealMonsterState != MONSTERSTATE_DEAD && - ( m_IdealMonsterState != MONSTERSTATE_SCRIPT || m_IdealMonsterState == m_MonsterState ) ) - { - if( (m_afConditions && !HasConditions( bits_COND_SCHEDULE_DONE ) ) || - ( m_pSchedule && (m_pSchedule->iInterruptMask & bits_COND_SCHEDULE_DONE ) ) || - ( ( m_MonsterState == MONSTERSTATE_COMBAT ) && ( m_hEnemy == NULL ) ) ) - { - GetIdealState(); - } - } - if( HasConditions( bits_COND_TASK_FAILED ) && m_MonsterState == m_IdealMonsterState ) - { - if( m_failSchedule != SCHED_NONE ) - pNewSchedule = GetScheduleOfType( m_failSchedule ); - else - pNewSchedule = GetScheduleOfType( SCHED_FAIL ); - - // schedule was invalid because the current task failed to start or complete - ALERT( at_aiconsole, "Schedule Failed at %d!\n", m_iScheduleIndex ); - ChangeSchedule( pNewSchedule ); - } - else - { - SetState( m_IdealMonsterState ); - if( m_MonsterState == MONSTERSTATE_SCRIPT || m_MonsterState == MONSTERSTATE_DEAD ) - pNewSchedule = CBaseMonster::GetSchedule(); - else - pNewSchedule = GetSchedule(); - ChangeSchedule( pNewSchedule ); - } - } - - if( m_iTaskStatus == TASKSTATUS_NEW ) - { - Task_t *pTask = GetTask(); - ASSERT( pTask != NULL ); - TaskBegin(); - StartTask( pTask ); - } - - // UNDONE: Twice?!!! - if( m_Activity != m_IdealActivity ) - { - SetActivity( m_IdealActivity ); - } - - if( !TaskIsComplete() && m_iTaskStatus != TASKSTATUS_NEW ) - break; - } - - if( TaskIsRunning() ) - { - Task_t *pTask = GetTask(); - ASSERT( pTask != NULL ); - RunTask( pTask ); - } - - // UNDONE: We have to do this so that we have an animation set to blend to if RunTask changes the animation - // RunTask() will always change animations at the end of a script! - // Don't do this twice - if( m_Activity != m_IdealActivity ) - { - SetActivity( m_IdealActivity ); - } -} - -//========================================================= -// RunTask -//========================================================= -void CBaseMonster::RunTask( Task_t *pTask ) -{ - switch( pTask->iTask ) - { - case TASK_TURN_RIGHT: - case TASK_TURN_LEFT: - { - ChangeYaw( pev->yaw_speed ); - - if( FacingIdeal() ) - { - TaskComplete(); - } - break; - } - case TASK_PLAY_SEQUENCE_FACE_ENEMY: - case TASK_PLAY_SEQUENCE_FACE_TARGET: - { - CBaseEntity *pTarget; - - if( pTask->iTask == TASK_PLAY_SEQUENCE_FACE_TARGET ) - pTarget = m_hTargetEnt; - else - pTarget = m_hEnemy; - if( pTarget ) - { - pev->ideal_yaw = UTIL_VecToYaw( pTarget->pev->origin - pev->origin ); - ChangeYaw( pev->yaw_speed ); - } - if( m_fSequenceFinished ) - TaskComplete(); - } - break; - case TASK_PLAY_SEQUENCE: - case TASK_PLAY_ACTIVE_IDLE: - { - if( m_fSequenceFinished ) - { - TaskComplete(); - } - break; - } - case TASK_FACE_ENEMY: - { - MakeIdealYaw( m_vecEnemyLKP ); - - ChangeYaw( pev->yaw_speed ); - - if( FacingIdeal() ) - { - TaskComplete(); - } - break; - } - case TASK_FACE_HINTNODE: - case TASK_FACE_LASTPOSITION: - case TASK_FACE_TARGET: - case TASK_FACE_IDEAL: - case TASK_FACE_ROUTE: - { - ChangeYaw( pev->yaw_speed ); - - if( FacingIdeal() ) - { - TaskComplete(); - } - break; - } - case TASK_WAIT_PVS: - { - if( !FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) ) - { - TaskComplete(); - } - break; - } - case TASK_WAIT_INDEFINITE: - { - // don't do anything. - break; - } - case TASK_WAIT: - case TASK_WAIT_RANDOM: - { - if( gpGlobals->time >= m_flWaitFinished ) - { - TaskComplete(); - } - break; - } - case TASK_WAIT_FACE_ENEMY: - { - MakeIdealYaw( m_vecEnemyLKP ); - ChangeYaw( pev->yaw_speed ); - - if( gpGlobals->time >= m_flWaitFinished ) - { - TaskComplete(); - } - break; - } - case TASK_MOVE_TO_TARGET_RANGE: - { - float distance; - - if( m_hTargetEnt == NULL ) - TaskFail(); - else - { - distance = ( m_vecMoveGoal - pev->origin ).Length2D(); - - // Re-evaluate when you think your finished, or the target has moved too far - if( ( distance < pTask->flData ) || ( m_vecMoveGoal - m_hTargetEnt->pev->origin ).Length() > pTask->flData * 0.5 ) - { - m_vecMoveGoal = m_hTargetEnt->pev->origin; - distance = ( m_vecMoveGoal - pev->origin ).Length2D(); - FRefreshRoute(); - } - - // Set the appropriate activity based on an overlapping range - // overlap the range to prevent oscillation - if( distance < pTask->flData ) - { - TaskComplete(); - RouteClear(); // Stop moving - } - else if( distance < 190 && m_movementActivity != ACT_WALK ) - m_movementActivity = ACT_WALK; - else if( distance >= 270 && m_movementActivity != ACT_RUN ) - m_movementActivity = ACT_RUN; - } - break; - } - case TASK_WAIT_FOR_MOVEMENT: - { - if( MovementIsComplete() ) - { - TaskComplete(); - RouteClear(); // Stop moving - } - break; - } - case TASK_DIE: - { - if( m_fSequenceFinished && pev->frame >= 255 ) - { - pev->deadflag = DEAD_DEAD; - - SetThink( NULL ); - StopAnimation(); - - if( !BBoxFlat() ) - { - // a bit of a hack. If a corpses' bbox is positioned such that being left solid so that it can be attacked will - // block the player on a slope or stairs, the corpse is made nonsolid. - //pev->solid = SOLID_NOT; - UTIL_SetSize( pev, Vector( -4, -4, 0 ), Vector( 4, 4, 1 ) ); - } - else // !!!HACKHACK - put monster in a thin, wide bounding box until we fix the solid type/bounding volume problem - UTIL_SetSize( pev, Vector( pev->mins.x, pev->mins.y, pev->mins.z ), Vector( pev->maxs.x, pev->maxs.y, pev->mins.z + 1 ) ); - - if( ShouldFadeOnDeath() ) - { - // this monster was created by a monstermaker... fade the corpse out. - SUB_StartFadeOut(); - } - else - { - // body is gonna be around for a while, so have it stink for a bit. - CSoundEnt::InsertSound( bits_SOUND_CARCASS, pev->origin, 384, 30 ); - } - } - break; - } - case TASK_RANGE_ATTACK1_NOTURN: - case TASK_MELEE_ATTACK1_NOTURN: - case TASK_MELEE_ATTACK2_NOTURN: - case TASK_RANGE_ATTACK2_NOTURN: - case TASK_RELOAD_NOTURN: - { - if( m_fSequenceFinished ) - { - m_Activity = ACT_RESET; - TaskComplete(); - } - break; - } - case TASK_RANGE_ATTACK1: - case TASK_MELEE_ATTACK1: - case TASK_MELEE_ATTACK2: - case TASK_RANGE_ATTACK2: - case TASK_SPECIAL_ATTACK1: - case TASK_SPECIAL_ATTACK2: - case TASK_RELOAD: - { - MakeIdealYaw( m_vecEnemyLKP ); - ChangeYaw( pev->yaw_speed ); - - if( m_fSequenceFinished ) - { - m_Activity = ACT_RESET; - TaskComplete(); - } - break; - } - case TASK_SMALL_FLINCH: - { - if( m_fSequenceFinished ) - { - TaskComplete(); - } - } - break; - case TASK_WAIT_FOR_SCRIPT: - { - if( m_pCine->m_iDelay <= 0 && gpGlobals->time >= m_pCine->m_startTime ) - { - TaskComplete(); - m_pCine->StartSequence( (CBaseMonster *)this, m_pCine->m_iszPlay, TRUE ); - if( m_fSequenceFinished ) - ClearSchedule(); - pev->framerate = 1.0; - //ALERT( at_aiconsole, "Script %s has begun for %s\n", STRING( m_pCine->m_iszPlay ), STRING( pev->classname ) ); - } - break; - } - case TASK_PLAY_SCRIPT: - { - if( m_fSequenceFinished ) - { - m_pCine->SequenceDone( this ); - } - break; - } - } -} - -//========================================================= -// SetTurnActivity - measures the difference between the way -// the monster is facing and determines whether or not to -// select one of the 180 turn animations. -//========================================================= -void CBaseMonster::SetTurnActivity( void ) -{ - float flYD; - flYD = FlYawDiff(); - - if( flYD <= -45 && LookupActivity( ACT_TURN_RIGHT ) != ACTIVITY_NOT_AVAILABLE ) - { - // big right turn - m_IdealActivity = ACT_TURN_RIGHT; - } - else if( flYD > 45 && LookupActivity( ACT_TURN_LEFT ) != ACTIVITY_NOT_AVAILABLE ) - { - // big left turn - m_IdealActivity = ACT_TURN_LEFT; - } -} - -//========================================================= -// Start task - selects the correct activity and performs -// any necessary calculations to start the next task on the -// schedule. -//========================================================= -void CBaseMonster::StartTask( Task_t *pTask ) -{ - switch( pTask->iTask ) - { - case TASK_TURN_RIGHT: - { - float flCurrentYaw; - - flCurrentYaw = UTIL_AngleMod( pev->angles.y ); - pev->ideal_yaw = UTIL_AngleMod( flCurrentYaw - pTask->flData ); - SetTurnActivity(); - break; - } - case TASK_TURN_LEFT: - { - float flCurrentYaw; - - flCurrentYaw = UTIL_AngleMod( pev->angles.y ); - pev->ideal_yaw = UTIL_AngleMod( flCurrentYaw + pTask->flData ); - SetTurnActivity(); - break; - } - case TASK_REMEMBER: - { - Remember( (int)pTask->flData ); - TaskComplete(); - break; - } - case TASK_FORGET: - { - Forget( (int)pTask->flData ); - TaskComplete(); - break; - } - case TASK_FIND_HINTNODE: - { - m_iHintNode = FindHintNode(); - - if( m_iHintNode != NO_NODE ) - { - TaskComplete(); - } - else - { - TaskFail(); - } - break; - } - case TASK_STORE_LASTPOSITION: - { - m_vecLastPosition = pev->origin; - TaskComplete(); - break; - } - case TASK_CLEAR_LASTPOSITION: - { - m_vecLastPosition = g_vecZero; - TaskComplete(); - break; - } - case TASK_CLEAR_HINTNODE: - { - m_iHintNode = NO_NODE; - TaskComplete(); - break; - } - case TASK_STOP_MOVING: - { - if( m_IdealActivity == m_movementActivity ) - { - m_IdealActivity = GetStoppedActivity(); - } - - RouteClear(); - TaskComplete(); - break; - } - case TASK_PLAY_SEQUENCE_FACE_ENEMY: - case TASK_PLAY_SEQUENCE_FACE_TARGET: - case TASK_PLAY_SEQUENCE: - { - m_IdealActivity = (Activity)(int)pTask->flData; - break; - } - case TASK_PLAY_ACTIVE_IDLE: - { - // monsters verify that they have a sequence for the node's activity BEFORE - // moving towards the node, so it's ok to just set the activity without checking here. - m_IdealActivity = (Activity)WorldGraph.m_pNodes[m_iHintNode].m_sHintActivity; - break; - } - case TASK_SET_SCHEDULE: - { - Schedule_t *pNewSchedule; - - pNewSchedule = GetScheduleOfType( (int)pTask->flData ); - - if( pNewSchedule ) - { - ChangeSchedule( pNewSchedule ); - } - else - { - TaskFail(); - } - break; - } - case TASK_FIND_NEAR_NODE_COVER_FROM_ENEMY: - { - if( m_hEnemy == NULL ) - { - TaskFail(); - return; - } - - if( FindCover( m_hEnemy->pev->origin, m_hEnemy->pev->view_ofs, 0, pTask->flData ) ) - { - // try for cover farther than the FLData from the schedule. - TaskComplete(); - } - else - { - // no coverwhatsoever. - TaskFail(); - } - break; - } - case TASK_FIND_FAR_NODE_COVER_FROM_ENEMY: - { - if( m_hEnemy == NULL ) - { - TaskFail(); - return; - } - - if( FindCover( m_hEnemy->pev->origin, m_hEnemy->pev->view_ofs, pTask->flData, CoverRadius() ) ) - { - // try for cover farther than the FLData from the schedule. - TaskComplete(); - } - else - { - // no coverwhatsoever. - TaskFail(); - } - break; - } - case TASK_FIND_NODE_COVER_FROM_ENEMY: - { - if( m_hEnemy == NULL ) - { - TaskFail(); - return; - } - - if( FindCover( m_hEnemy->pev->origin, m_hEnemy->pev->view_ofs, 0, CoverRadius() ) ) - { - // try for cover farther than the FLData from the schedule. - TaskComplete(); - } - else - { - // no coverwhatsoever. - TaskFail(); - } - break; - } - case TASK_FIND_COVER_FROM_ENEMY: - { - entvars_t *pevCover; - - if( m_hEnemy == NULL ) - { - // Find cover from self if no enemy available - pevCover = pev; - //TaskFail(); - //return; - } - else - pevCover = m_hEnemy->pev; - - if( FindLateralCover( pevCover->origin, pevCover->view_ofs ) ) - { - // try lateral first - m_flMoveWaitFinished = gpGlobals->time + pTask->flData; - TaskComplete(); - } - else if( FindCover( pevCover->origin, pevCover->view_ofs, 0, CoverRadius() ) ) - { - // then try for plain ole cover - m_flMoveWaitFinished = gpGlobals->time + pTask->flData; - TaskComplete(); - } - else - { - // no coverwhatsoever. - TaskFail(); - } - break; - } - case TASK_FIND_COVER_FROM_ORIGIN: - { - if( FindCover( pev->origin, pev->view_ofs, 0, CoverRadius() ) ) - { - // then try for plain ole cover - m_flMoveWaitFinished = gpGlobals->time + pTask->flData; - TaskComplete(); - } - else - { - // no cover! - TaskFail(); - } - } - break; - case TASK_FIND_COVER_FROM_BEST_SOUND: - { - CSound *pBestSound; - - pBestSound = PBestSound(); - - ASSERT( pBestSound != NULL ); - /* - if( pBestSound && FindLateralCover( pBestSound->m_vecOrigin, g_vecZero ) ) - { - // try lateral first - m_flMoveWaitFinished = gpGlobals->time + pTask->flData; - TaskComplete(); - } - */ - - if( pBestSound && FindCover( pBestSound->m_vecOrigin, g_vecZero, pBestSound->m_iVolume, CoverRadius() ) ) - { - // then try for plain ole cover - m_flMoveWaitFinished = gpGlobals->time + pTask->flData; - TaskComplete(); - } - else - { - // no coverwhatsoever. or no sound in list - TaskFail(); - } - break; - } - case TASK_FACE_HINTNODE: - { - pev->ideal_yaw = WorldGraph.m_pNodes[m_iHintNode].m_flHintYaw; - SetTurnActivity(); - break; - } - case TASK_FACE_LASTPOSITION: - MakeIdealYaw( m_vecLastPosition ); - SetTurnActivity(); - break; - case TASK_FACE_TARGET: - if( m_hTargetEnt != NULL ) - { - MakeIdealYaw( m_hTargetEnt->pev->origin ); - SetTurnActivity(); - } - else - TaskFail(); - break; - case TASK_FACE_ENEMY: - { - MakeIdealYaw( m_vecEnemyLKP ); - SetTurnActivity(); - break; - } - case TASK_FACE_IDEAL: - { - SetTurnActivity(); - break; - } - case TASK_FACE_ROUTE: - { - if( FRouteClear() ) - { - ALERT( at_aiconsole, "No route to face!\n" ); - TaskFail(); - } - else - { - MakeIdealYaw( m_Route[m_iRouteIndex].vecLocation ); - SetTurnActivity(); - } - break; - } - case TASK_WAIT_PVS: - case TASK_WAIT_INDEFINITE: - { - // don't do anything. - break; - } - case TASK_WAIT: - case TASK_WAIT_FACE_ENEMY: - { - // set a future time that tells us when the wait is over. - m_flWaitFinished = gpGlobals->time + pTask->flData; - break; - } - case TASK_WAIT_RANDOM: - { - // set a future time that tells us when the wait is over. - m_flWaitFinished = gpGlobals->time + RANDOM_FLOAT( 0.1, pTask->flData ); - break; - } - case TASK_MOVE_TO_TARGET_RANGE: - { - if( ( m_hTargetEnt->pev->origin - pev->origin ).Length() < 1 ) - TaskComplete(); - else - { - m_vecMoveGoal = m_hTargetEnt->pev->origin; - if( !MoveToTarget( ACT_WALK, 2 ) ) - TaskFail(); - } - break; - } - case TASK_RUN_TO_TARGET: - case TASK_WALK_TO_TARGET: - { - Activity newActivity; - - if( ( m_hTargetEnt->pev->origin - pev->origin ).Length() < 1 ) - TaskComplete(); - else - { - if( pTask->iTask == TASK_WALK_TO_TARGET ) - newActivity = ACT_WALK; - else - newActivity = ACT_RUN; - - // This monster can't do this! - if( LookupActivity( newActivity ) == ACTIVITY_NOT_AVAILABLE ) - TaskComplete(); - else - { - if( m_hTargetEnt == NULL || !MoveToTarget( newActivity, 2 ) ) - { - TaskFail(); - ALERT( at_aiconsole, "%s Failed to reach target!!!\n", STRING( pev->classname ) ); - RouteClear(); - } - } - } - TaskComplete(); - break; - } - case TASK_CLEAR_MOVE_WAIT: - { - m_flMoveWaitFinished = gpGlobals->time; - TaskComplete(); - break; - } - case TASK_MELEE_ATTACK1_NOTURN: - case TASK_MELEE_ATTACK1: - { - m_IdealActivity = ACT_MELEE_ATTACK1; - break; - } - case TASK_MELEE_ATTACK2_NOTURN: - case TASK_MELEE_ATTACK2: - { - m_IdealActivity = ACT_MELEE_ATTACK2; - break; - } - case TASK_RANGE_ATTACK1_NOTURN: - case TASK_RANGE_ATTACK1: - { - m_IdealActivity = ACT_RANGE_ATTACK1; - break; - } - case TASK_RANGE_ATTACK2_NOTURN: - case TASK_RANGE_ATTACK2: - { - m_IdealActivity = ACT_RANGE_ATTACK2; - break; - } - case TASK_RELOAD_NOTURN: - case TASK_RELOAD: - { - m_IdealActivity = ACT_RELOAD; - break; - } - case TASK_SPECIAL_ATTACK1: - { - m_IdealActivity = ACT_SPECIAL_ATTACK1; - break; - } - case TASK_SPECIAL_ATTACK2: - { - m_IdealActivity = ACT_SPECIAL_ATTACK2; - break; - } - case TASK_SET_ACTIVITY: - { - m_IdealActivity = (Activity)(int)pTask->flData; - TaskComplete(); - break; - } - case TASK_GET_PATH_TO_ENEMY_LKP: - { - if( BuildRoute( m_vecEnemyLKP, bits_MF_TO_LOCATION, NULL ) ) - { - TaskComplete(); - } - else if( BuildNearestRoute( m_vecEnemyLKP, pev->view_ofs, 0, ( m_vecEnemyLKP - pev->origin ).Length() ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT( at_aiconsole, "GetPathToEnemyLKP failed!!\n" ); - TaskFail(); - } - break; - } - case TASK_GET_PATH_TO_ENEMY: - { - CBaseEntity *pEnemy = m_hEnemy; - - if( pEnemy == NULL ) - { - TaskFail(); - return; - } - - if( BuildRoute( pEnemy->pev->origin, bits_MF_TO_ENEMY, pEnemy ) ) - { - TaskComplete(); - } - else if( BuildNearestRoute( pEnemy->pev->origin, pEnemy->pev->view_ofs, 0, ( pEnemy->pev->origin - pev->origin ).Length() ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT( at_aiconsole, "GetPathToEnemy failed!!\n" ); - TaskFail(); - } - break; - } - case TASK_GET_PATH_TO_ENEMY_CORPSE: - { - UTIL_MakeVectors( pev->angles ); - if( BuildRoute( m_vecEnemyLKP - gpGlobals->v_forward * 64, bits_MF_TO_LOCATION, NULL ) ) - { - TaskComplete(); - } - else - { - ALERT( at_aiconsole, "GetPathToEnemyCorpse failed!!\n" ); - TaskFail(); - } - } - break; - case TASK_GET_PATH_TO_SPOT: - { - CBaseEntity *pPlayer = CBaseEntity::Instance( FIND_ENTITY_BY_CLASSNAME( NULL, "player" ) ); - if( BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, pPlayer ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT( at_aiconsole, "GetPathToSpot failed!!\n" ); - TaskFail(); - } - break; - } - case TASK_GET_PATH_TO_TARGET: - { - RouteClear(); - if( m_hTargetEnt != NULL && MoveToTarget( m_movementActivity, 1 ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT( at_aiconsole, "GetPathToSpot failed!!\n" ); - TaskFail(); - } - break; - } - case TASK_GET_PATH_TO_HINTNODE: - // for active idles! - { - if( MoveToLocation( m_movementActivity, 2, WorldGraph.m_pNodes[m_iHintNode].m_vecOrigin ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT( at_aiconsole, "GetPathToHintNode failed!!\n" ); - TaskFail(); - } - break; - } - case TASK_GET_PATH_TO_LASTPOSITION: - { - m_vecMoveGoal = m_vecLastPosition; - - if( MoveToLocation( m_movementActivity, 2, m_vecMoveGoal ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT ( at_aiconsole, "GetPathToLastPosition failed!!\n" ); - TaskFail(); - } - break; - } - case TASK_GET_PATH_TO_BESTSOUND: - { - CSound *pSound; - - pSound = PBestSound(); - - if( pSound && MoveToLocation( m_movementActivity, 2, pSound->m_vecOrigin ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT ( at_aiconsole, "GetPathToBestSound failed!!\n" ); - TaskFail(); - } - break; - } - case TASK_GET_PATH_TO_BESTSCENT: - { - CSound *pScent; - - pScent = PBestScent(); - - if( pScent && MoveToLocation( m_movementActivity, 2, pScent->m_vecOrigin ) ) - { - TaskComplete(); - } - else - { - // no way to get there =( - ALERT ( at_aiconsole, "GetPathToBestScent failed!!\n" ); - - TaskFail(); - } - break; - } - case TASK_RUN_PATH: - { - // UNDONE: This is in some default AI and some monsters can't run? -- walk instead? - if( LookupActivity( ACT_RUN ) != ACTIVITY_NOT_AVAILABLE ) - { - m_movementActivity = ACT_RUN; - } - else - { - m_movementActivity = ACT_WALK; - } - TaskComplete(); - break; - } - case TASK_WALK_PATH: - { - if( pev->movetype == MOVETYPE_FLY ) - { - m_movementActivity = ACT_FLY; - } - if( LookupActivity( ACT_WALK ) != ACTIVITY_NOT_AVAILABLE ) - { - m_movementActivity = ACT_WALK; - } - else - { - m_movementActivity = ACT_RUN; - } - TaskComplete(); - break; - } - case TASK_STRAFE_PATH: - { - Vector2D vec2DirToPoint; - Vector2D vec2RightSide; - - // to start strafing, we have to first figure out if the target is on the left side or right side - UTIL_MakeVectors( pev->angles ); - - vec2DirToPoint = ( m_Route[0].vecLocation - pev->origin ).Make2D().Normalize(); - vec2RightSide = gpGlobals->v_right.Make2D().Normalize(); - - if( DotProduct ( vec2DirToPoint, vec2RightSide ) > 0 ) - { - // strafe right - m_movementActivity = ACT_STRAFE_RIGHT; - } - else - { - // strafe left - m_movementActivity = ACT_STRAFE_LEFT; - } - TaskComplete(); - break; - } - case TASK_WAIT_FOR_MOVEMENT: - { - if( FRouteClear() ) - { - TaskComplete(); - } - break; - } - case TASK_EAT: - { - Eat( pTask->flData ); - TaskComplete(); - break; - } - case TASK_SMALL_FLINCH: - { - m_IdealActivity = GetSmallFlinchActivity(); - break; - } - case TASK_DIE: - { - RouteClear(); - - m_IdealActivity = GetDeathActivity(); - - pev->deadflag = DEAD_DYING; - break; - } - case TASK_SOUND_WAKE: - { - AlertSound(); - TaskComplete(); - break; - } - case TASK_SOUND_DIE: - { - DeathSound(); - TaskComplete(); - break; - } - case TASK_SOUND_IDLE: - { - IdleSound(); - TaskComplete(); - break; - } - case TASK_SOUND_PAIN: - { - PainSound(); - TaskComplete(); - break; - } - case TASK_SOUND_DEATH: - { - DeathSound(); - TaskComplete(); - break; - } - case TASK_SOUND_ANGRY: - { - // sounds are complete as soon as we get here, cause we've already played them. - ALERT( at_aiconsole, "SOUND\n" ); - TaskComplete(); - break; - } - case TASK_WAIT_FOR_SCRIPT: - { - if( m_pCine->m_iszIdle ) - { - m_pCine->StartSequence( (CBaseMonster *)this, m_pCine->m_iszIdle, FALSE ); - if( FStrEq( STRING( m_pCine->m_iszIdle ), STRING( m_pCine->m_iszPlay ) ) ) - { - pev->framerate = 0; - } - } - else - m_IdealActivity = ACT_IDLE; - break; - } - case TASK_PLAY_SCRIPT: - { - pev->movetype = MOVETYPE_FLY; - ClearBits( pev->flags, FL_ONGROUND ); - m_scriptState = SCRIPT_PLAYING; - break; - } - case TASK_ENABLE_SCRIPT: - { - m_pCine->DelayStart( 0 ); - TaskComplete(); - break; - } - case TASK_PLANT_ON_SCRIPT: - { - if( m_hTargetEnt != NULL ) - { - pev->origin = m_hTargetEnt->pev->origin; // Plant on target - } - - TaskComplete(); - break; - } - case TASK_FACE_SCRIPT: - { - if( m_hTargetEnt != NULL ) - { - pev->ideal_yaw = UTIL_AngleMod( m_hTargetEnt->pev->angles.y ); - } - - TaskComplete(); - m_IdealActivity = ACT_IDLE; - RouteClear(); - break; - } - case TASK_SUGGEST_STATE: - { - m_IdealMonsterState = (MONSTERSTATE)(int)pTask->flData; - TaskComplete(); - break; - } - case TASK_SET_FAIL_SCHEDULE: - m_failSchedule = (int)pTask->flData; - TaskComplete(); - break; - case TASK_CLEAR_FAIL_SCHEDULE: - m_failSchedule = SCHED_NONE; - TaskComplete(); - break; - default: - { - ALERT( at_aiconsole, "No StartTask entry for %d\n", (SHARED_TASKS)pTask->iTask ); - break; - } - } -} - -//========================================================= -// GetTask - returns a pointer to the current -// scheduled task. NULL if there's a problem. -//========================================================= -Task_t *CBaseMonster::GetTask( void ) -{ - if( m_iScheduleIndex < 0 || m_iScheduleIndex >= m_pSchedule->cTasks ) - { - // m_iScheduleIndex is not within valid range for the monster's current schedule. - return NULL; - } - else - { - return &m_pSchedule->pTasklist[m_iScheduleIndex]; - } -} - -//========================================================= -// GetSchedule - Decides which type of schedule best suits -// the monster's current state and conditions. Then calls -// monster's member function to get a pointer to a schedule -// of the proper type. -//========================================================= -Schedule_t *CBaseMonster::GetSchedule( void ) -{ - switch( m_MonsterState ) - { - case MONSTERSTATE_PRONE: - { - return GetScheduleOfType( SCHED_BARNACLE_VICTIM_GRAB ); - break; - } - case MONSTERSTATE_NONE: - { - ALERT( at_aiconsole, "MONSTERSTATE IS NONE!\n" ); - break; - } - case MONSTERSTATE_IDLE: - { - if( HasConditions( bits_COND_HEAR_SOUND ) ) - { - return GetScheduleOfType( SCHED_ALERT_FACE ); - } - else if( FRouteClear() ) - { - // no valid route! - return GetScheduleOfType( SCHED_IDLE_STAND ); - } - else - { - // valid route. Get moving - return GetScheduleOfType( SCHED_IDLE_WALK ); - } - break; - } - case MONSTERSTATE_ALERT: - { - if( HasConditions( bits_COND_ENEMY_DEAD ) && LookupActivity( ACT_VICTORY_DANCE ) != ACTIVITY_NOT_AVAILABLE ) - { - return GetScheduleOfType( SCHED_VICTORY_DANCE ); - } - - if( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) ) - { - if( fabs( FlYawDiff() ) < ( 1.0 - m_flFieldOfView ) * 60 ) // roughly in the correct direction - { - return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ORIGIN ); - } - else - { - return GetScheduleOfType( SCHED_ALERT_SMALL_FLINCH ); - } - } - else if( HasConditions ( bits_COND_HEAR_SOUND ) ) - { - return GetScheduleOfType( SCHED_ALERT_FACE ); - } - else - { - return GetScheduleOfType( SCHED_ALERT_STAND ); - } - break; - } - case MONSTERSTATE_COMBAT: - { - if( HasConditions( bits_COND_ENEMY_DEAD ) ) - { - // clear the current (dead) enemy and try to find another. - m_hEnemy = NULL; - - if( GetEnemy() ) - { - ClearConditions( bits_COND_ENEMY_DEAD ); - return GetSchedule(); - } - else - { - SetState( MONSTERSTATE_ALERT ); - return GetSchedule(); - } - } - - if( HasConditions( bits_COND_NEW_ENEMY ) ) - { - return GetScheduleOfType( SCHED_WAKE_ANGRY ); - } - else if( HasConditions( bits_COND_LIGHT_DAMAGE ) && !HasMemory( bits_MEMORY_FLINCHED ) ) - { - return GetScheduleOfType( SCHED_SMALL_FLINCH ); - } - else if( !HasConditions( bits_COND_SEE_ENEMY ) ) - { - // we can't see the enemy - if( !HasConditions( bits_COND_ENEMY_OCCLUDED ) ) - { - // enemy is unseen, but not occluded! - // turn to face enemy - return GetScheduleOfType( SCHED_COMBAT_FACE ); - } - else - { - // chase! - return GetScheduleOfType( SCHED_CHASE_ENEMY ); - } - } - else - { - // we can see the enemy - if( HasConditions( bits_COND_CAN_RANGE_ATTACK1 ) ) - { - return GetScheduleOfType( SCHED_RANGE_ATTACK1 ); - } - if( HasConditions( bits_COND_CAN_RANGE_ATTACK2 ) ) - { - return GetScheduleOfType( SCHED_RANGE_ATTACK2 ); - } - if( HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) ) - { - return GetScheduleOfType( SCHED_MELEE_ATTACK1 ); - } - if( HasConditions( bits_COND_CAN_MELEE_ATTACK2 ) ) - { - return GetScheduleOfType( SCHED_MELEE_ATTACK2 ); - } - if( !HasConditions( bits_COND_CAN_RANGE_ATTACK1 | bits_COND_CAN_MELEE_ATTACK1 ) ) - { - // if we can see enemy but can't use either attack type, we must need to get closer to enemy - return GetScheduleOfType( SCHED_CHASE_ENEMY ); - } - else if( !FacingIdeal() ) - { - //turn - return GetScheduleOfType( SCHED_COMBAT_FACE ); - } - else - { - ALERT( at_aiconsole, "No suitable combat schedule!\n" ); - } - } - break; - } - case MONSTERSTATE_DEAD: - { - return GetScheduleOfType( SCHED_DIE ); - break; - } - case MONSTERSTATE_SCRIPT: - { - ASSERT( m_pCine != NULL ); - if( !m_pCine ) - { - ALERT( at_aiconsole, "Script failed for %s\n", STRING( pev->classname ) ); - CineCleanup(); - return GetScheduleOfType( SCHED_IDLE_STAND ); - } - - return GetScheduleOfType( SCHED_AISCRIPT ); - } - default: - { - ALERT( at_aiconsole, "Invalid State for GetSchedule!\n" ); - break; - } - } - - return &slError[0]; -} +BOOL CBaseMonster::FHaveSchedule( void ) { return FALSE; }; +void CBaseMonster::ClearSchedule( void ) { }; +BOOL CBaseMonster::FScheduleDone( void ) { return FALSE; }; +void CBaseMonster::ChangeSchedule( Schedule_t *pNewSchedule ) { }; +void CBaseMonster::NextScheduledTask( void ) { }; +int CBaseMonster::IScheduleFlags( void ) { return 0; }; +BOOL CBaseMonster::FScheduleValid( void ) { return FALSE; }; +void CBaseMonster::MaintainSchedule( void ) { }; +void CBaseMonster::SetTurnActivity( void ) { }; +Task_t *CBaseMonster::GetTask( void ) { return NULL; }; diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 6427df14..e0611a7d 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -798,7 +798,7 @@ Used to represent Slime or Lava void CTriggerEnvHurt::Spawn( void ) { InitTrigger(); - SetTouch( EnvTouch ); + SetTouch( &CBaseTrigger::EnvTouch ); if( FBitSet( pev->spawnflags, SF_TRIGGER_HURT_START_OFF ) )// if flagged to Start Turned Off, make trigger nonsolid. pev->solid = SOLID_NOT; @@ -2015,9 +2015,9 @@ void CTeleDeath::Spawn( void ) UTIL_SetSize( pev, pOwner->pev->mins - Vector( 1, 1, 1 ), pOwner->pev->maxs + Vector( 1, 1, 1 ) ); UTIL_SetOrigin( pev, pev->origin ); - SetTouch( DeathTouch ); + SetTouch( &CTeleDeath::DeathTouch ); pev->nextthink = gpGlobals->time + 0.2; - SetThink( SUB_Remove ); + SetThink( &CBaseEntity::SUB_Remove ); // Touch still players gpGlobals->force_retouch = 2; diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 5738a9aa..0ae34221 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -765,7 +765,7 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) return 1; } -void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal, int body ) +void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal) { if( UseDecrement() ) skiplocal = 1; @@ -887,7 +887,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( char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal /* = 0 */ ) { if( !CanDeploy() ) return FALSE; @@ -897,7 +897,7 @@ BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, i m_pPlayer->pev->viewmodel = MAKE_STRING( szViewModel ); m_pPlayer->pev->weaponmodel = MAKE_STRING( szWeaponModel ); strcpy( m_pPlayer->m_szAnimExtention, szAnimExt ); - SendWeaponAnim( iAnim, skiplocal, body ); + SendWeaponAnim( iAnim, skiplocal ); m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; @@ -905,7 +905,7 @@ BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, i return TRUE; } -BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, int body ) +BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay ) { if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) return FALSE; diff --git a/dlls/weapons.h b/dlls/weapons.h index 55035df3..71fbc724 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -304,12 +304,12 @@ public: virtual BOOL PlayEmptySound( void ); virtual void ResetEmptySound( void ); - virtual void SendWeaponAnim( int iAnim, int skiplocal = 1, int body = 0 ); // skiplocal is 1 if client is predicting weapon animations + virtual void SendWeaponAnim( int iAnim, int skiplocal = 1 ); // skiplocal is 1 if client is predicting weapon animations virtual BOOL CanDeploy( void ); virtual BOOL IsUseable( void ); - BOOL DefaultDeploy( 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 ); + BOOL DefaultDeploy( char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal = 0 ); + int DefaultReload( int iClipSize, int iAnim, float fDelay ); virtual void ItemPostFrame( void ); // called each frame by the player PostThink // called by CBasePlayerWeapons ItemPostFrame() diff --git a/dlls/world.cpp b/dlls/world.cpp index c356ff4b..41f03304 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -42,6 +42,7 @@ CGlobalState gGlobalState; extern DLL_GLOBAL int gDisplayTitle; extern void W_Precache( void ); +extern void QuakeClassicPrecache( void ); // // This must match the list in util.h