Browse Source

Play ear ringing sound when inflicted explosion damage to player. Add cinematic camera implementation.

visitors
Night Owl 7 years ago
parent
commit
22791ee915
  1. 3
      cl_dll/Android.mk
  2. 2
      cl_dll/CMakeLists.txt
  3. 28
      cl_dll/hud.cpp
  4. 4
      cl_dll/hud.h
  5. 43
      cl_dll/hud_msg.cpp
  6. 25
      cl_dll/in_camera.cpp
  7. 11
      cl_dll/view.cpp
  8. 4
      dlls/Android.mk
  9. 3
      dlls/CMakeLists.txt
  10. 3
      dlls/client.cpp
  11. 15
      dlls/crossbow.cpp
  12. 3
      dlls/effects.cpp
  13. 2
      dlls/game.cpp
  14. 1
      dlls/game.h
  15. 100
      dlls/player.cpp
  16. 2
      dlls/player.h
  17. 26
      dlls/triggers.cpp
  18. 91
      dlls/visitors/cinematic.cpp
  19. 42
      dlls/visitors/cinematic.h
  20. 7
      pm_shared/pm_shared.c

3
cl_dll/Android.mk

@ -102,7 +102,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \ @@ -102,7 +102,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/../game_shared \
$(LOCAL_PATH)/../dlls \
$(LOCAL_PATH)/../pm_shared \
$(LOCAL_PATH)/../utils/false_vgui/include
$(LOCAL_PATH)/../utils/false_vgui/include \
$(LOCAL_PATH)/../dlls/visitors
LOCAL_CFLAGS += $(DEFINES) $(INCLUDES)
ifeq ($(GOLDSOURCE_SUPPORT),1)

2
cl_dll/CMakeLists.txt

@ -98,7 +98,7 @@ set (CLDLL_SOURCES @@ -98,7 +98,7 @@ set (CLDLL_SOURCES
scoreboard.cpp
MOTD.cpp)
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include)
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include ../dlls/visitors )
if(USE_VOICEMGR)
#set(CLDLL_SOURCES

28
cl_dll/hud.cpp

@ -78,30 +78,6 @@ int __MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf ) @@ -78,30 +78,6 @@ int __MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
return gHUD.MsgFunc_GameMode( pszName, iSize, pbuf );
}
int __MsgFunc_Firstperson( const char *pszName, int iSize, void *pbuf )
{
gHUD.MsgFunc_Firstperson( pszName, iSize, pbuf );
return 1;
}
int __MsgFunc_Thirdperson( const char *pszName, int iSize, void *pbuf )
{
gHUD.MsgFunc_Thirdperson( pszName, iSize, pbuf );
return 1;
}
int __MsgFunc_PlayerModel( const char *pszName, int iSize, void *pbuf )
{
gHUD.MsgFunc_PlayerModel( pszName, iSize, pbuf );
return 1;
}
int __MsgFunc_DeathCam( const char *pszName, int iSize, void *pbuf )
{
gHUD.MsgFunc_DeathCam( pszName, iSize, pbuf );
return 1;
}
// TFFree Command Menu
void __CmdFunc_OpenCommandMenu( void )
{
@ -185,10 +161,6 @@ void CHud::Init( void ) @@ -185,10 +161,6 @@ void CHud::Init( void )
HOOK_MESSAGE( ViewMode );
HOOK_MESSAGE( SetFOV );
HOOK_MESSAGE( Concuss );
HOOK_MESSAGE( Firstperson );
HOOK_MESSAGE( Thirdperson );
HOOK_MESSAGE( PlayerModel );
HOOK_MESSAGE( DeathCam );
// TFFree CommandMenu
HOOK_COMMAND( "+commandmenu", OpenCommandMenu );

4
cl_dll/hud.h

@ -654,10 +654,6 @@ public: @@ -654,10 +654,6 @@ public:
void _cdecl MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );
void _cdecl MsgFunc_Firstperson( const char *pszName, int iSize, void *pbuf );
void _cdecl MsgFunc_Thirdperson( const char *pszName, int iSize, void *pbuf );
void _cdecl MsgFunc_PlayerModel( const char *pszName, int iSize, void *pbuf );
void _cdecl MsgFunc_DeathCam( const char *pszName, int iSize, void *pbuf );
// Screen information
SCREENINFO m_scrinfo;

43
cl_dll/hud_msg.cpp

@ -26,8 +26,6 @@ @@ -26,8 +26,6 @@
extern BEAM *pBeam;
extern BEAM *pBeam2;
extern int cam_thirdperson;
/// USER-DEFINED SERVER MESSAGE HANDLERS
int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
@ -117,44 +115,3 @@ int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf ) @@ -117,44 +115,3 @@ int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
this->m_StatusIcons.DisableIcon( "dmg_concuss" );
return 1;
}
extern int cam_deathcam_enabled;
extern float cam_deathcam_yaw;
void CHud::MsgFunc_Firstperson( const char *pszName, int iSize, void *pbuf )
{
cam_thirdperson = 0;
}
void CHud::MsgFunc_Thirdperson( const char *pszName, int iSize, void *pbuf )
{
cam_thirdperson = 1;
}
void CHud::MsgFunc_PlayerModel( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
char* model = READ_STRING();
gEngfuncs.Cvar_Set( "model", model );
}
void CHud::MsgFunc_DeathCam( const char *pszName, int iSize, void *pbuf )
{
int fDeathCamOn;
Vector vDeathCamPos;
BEGIN_READ( pbuf, iSize );
fDeathCamOn = READ_BYTE(); // Enable/Disable
if( fDeathCamOn )
{
cam_deathcam_enabled = 1;
cam_deathcam_yaw = 0;
}
else
{
cam_deathcam_enabled = 0;
cam_deathcam_yaw = 0;
}
}

25
cl_dll/in_camera.cpp

@ -65,12 +65,6 @@ cvar_t *c_mindistance; @@ -65,12 +65,6 @@ cvar_t *c_mindistance;
// pitch, yaw, dist
vec3_t cam_ofs;
//
// HL: Visitors - Death camera
//
int cam_deathcam_enabled;
float cam_deathcam_yaw;
// In third person
int cam_thirdperson;
int cam_mousemove; //true if we are moving the cam with the mouse, False if not
@ -394,25 +388,6 @@ void DLLEXPORT CAM_Think( void ) @@ -394,25 +388,6 @@ void DLLEXPORT CAM_Think( void )
return;
}
#endif
//
// HL: Visitors - Death camera.
//
if( cam_deathcam_enabled )
{
// Store new values.
camAngles[PITCH] = 90;
camAngles[YAW] = cam_deathcam_yaw;
camAngles[ROLL] = 0;
// slowly rotate the camera by increasing the yaw.
cam_deathcam_yaw += 0.1f;
// Clamp camera yaw value.
if( cam_deathcam_yaw > 180 )
cam_deathcam_yaw -= 360;
else if( cam_deathcam_yaw < -180 )
cam_deathcam_yaw += 360;
}
cam_ofs[0] = camAngles[0];
cam_ofs[1] = camAngles[1];
cam_ofs[2] = dist;

11
cl_dll/view.cpp

@ -337,13 +337,10 @@ void V_CalcViewRoll( struct ref_params_s *pparams ) @@ -337,13 +337,10 @@ void V_CalcViewRoll( struct ref_params_s *pparams )
if( pparams->health <= 0 && ( pparams->viewheight[2] != 0 ) )
{
//
// HL: Visitors - No death view roll.
//
pparams->viewangles[ROLL] = 0;
// Look straight to the ground.
pparams->viewangles[PITCH] = 90;
// only roll the view if the player is dead and the viewheight[2] is nonzero
// this is so deadcam in multiplayer will work.
pparams->viewangles[ROLL] = 80; // dead view angle
return;
}
}

4
dlls/Android.mk

@ -26,7 +26,8 @@ LOCAL_C_INCLUDES := $(SDL_PATH)/include \ @@ -26,7 +26,8 @@ LOCAL_C_INCLUDES := $(SDL_PATH)/include \
$(LOCAL_PATH)/../engine \
$(LOCAL_PATH)/../public \
$(LOCAL_PATH)/../pm_shared \
$(LOCAL_PATH)/../game_shared
$(LOCAL_PATH)/../game_shared \
$(LOCAL_PATH)/visitors
LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
aflock.cpp \
@ -127,6 +128,7 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \ @@ -127,6 +128,7 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
../pm_shared/pm_debug.c \
../pm_shared/pm_math.c \
../pm_shared/pm_shared.c \
visitors/cinematic.cpp \
visitors/flashlight.cpp \
visitors/kevlar.cpp \
visitors/massn.cpp \

3
dlls/CMakeLists.txt

@ -131,6 +131,7 @@ set (SVDLL_SOURCES @@ -131,6 +131,7 @@ set (SVDLL_SOURCES
../pm_shared/pm_debug.c
../pm_shared/pm_math.c
../pm_shared/pm_shared.c
visitors/cinematic.cpp
visitors/flashlight.cpp
visitors/kevlar.cpp
visitors/massn.cpp
@ -138,7 +139,7 @@ set (SVDLL_SOURCES @@ -138,7 +139,7 @@ set (SVDLL_SOURCES
visitors/sniper.cpp
)
include_directories (. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public)
include_directories (. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public visitors )
if(USE_VOICEMGR)
set(SVDLL_SOURCES

3
dlls/client.cpp

@ -927,6 +927,9 @@ void ClientPrecache( void ) @@ -927,6 +927,9 @@ void ClientPrecache( void )
PRECACHE_SOUND( "player/geiger2.wav" );
PRECACHE_SOUND( "player/geiger1.wav" );
// ear ringing sound
PRECACHE_SOUND( "player/ear_ringing.wav" );
if( giPrecacheGrunt )
UTIL_PrecacheOther( "monster_human_grunt" );
}

15
dlls/crossbow.cpp

@ -97,9 +97,18 @@ int CCrossbowBolt::Classify( void ) @@ -97,9 +97,18 @@ int CCrossbowBolt::Classify( void )
void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
{
CBasePlayer *pPlayer;
SetTouch( NULL );
SetThink( NULL );
pPlayer = (CBasePlayer *)CBaseEntity::Instance( pev->owner );
if( pPlayer && pPlayer->m_pCam )
{
pPlayer->m_pCam->SetTarget( pPlayer );
pPlayer->m_pCam->SetOrigin( g_vecZero );
}
if( pOther->pev->takedamage )
{
TraceResult tr = UTIL_GetGlobalTrace();
@ -435,6 +444,12 @@ void CCrossbow::FireBolt() @@ -435,6 +444,12 @@ void CCrossbow::FireBolt()
pBolt->pev->angles = anglesAim;
pBolt->pev->owner = m_pPlayer->edict();
if( m_pPlayer->m_pCam )
{
m_pPlayer->m_pCam->SetTarget( pBolt );
m_pPlayer->m_pCam->SetOrigin( Vector( 0, 2, 8 ) );
}
if( m_pPlayer->pev->waterlevel == 3 )
{
pBolt->pev->velocity = vecDir * BOLT_WATER_VELOCITY;

3
dlls/effects.cpp

@ -1943,6 +1943,9 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType @@ -1943,6 +1943,9 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
if( pev->spawnflags & SF_FADE_MODULATE )
fadeFlags |= FFADE_MODULATE;
if( HoldTime() == -1 )
fadeFlags |= FFADE_STAYOUT;
if( pev->spawnflags & SF_FADE_ONLYONE )
{
if( pActivator->IsNetClient() )

2
dlls/game.cpp

@ -40,6 +40,7 @@ cvar_t teamlist = { "mp_teamlist","hgrunt;scientist", FCVAR_SERVER }; @@ -40,6 +40,7 @@ cvar_t teamlist = { "mp_teamlist","hgrunt;scientist", FCVAR_SERVER };
cvar_t teamoverride = { "mp_teamoverride","1" };
cvar_t defaultteam = { "mp_defaultteam","0" };
cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER };
cvar_t cinematics = { "mp_cinematics","0", FCVAR_SERVER };
cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER };
cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators
@ -479,6 +480,7 @@ void GameDLLInit( void ) @@ -479,6 +480,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &teamoverride );
CVAR_REGISTER( &defaultteam );
CVAR_REGISTER( &allowmonsters );
CVAR_REGISTER( &cinematics );
CVAR_REGISTER( &bhopcap );
CVAR_REGISTER( &mp_chattime );

1
dlls/game.h

@ -37,6 +37,7 @@ extern cvar_t teamlist; @@ -37,6 +37,7 @@ extern cvar_t teamlist;
extern cvar_t teamoverride;
extern cvar_t defaultteam;
extern cvar_t allowmonsters;
extern cvar_t cinematics;
// Engine Cvars
extern cvar_t *g_psv_gravity;

100
dlls/player.cpp

@ -119,6 +119,8 @@ TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] = @@ -119,6 +119,8 @@ TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] =
DEFINE_FIELD( CBasePlayer, m_iHideHUD, FIELD_INTEGER ),
DEFINE_FIELD( CBasePlayer, m_iFOV, FIELD_INTEGER ),
DEFINE_FIELD( CBasePlayer, m_pCam, FIELD_CLASSPTR ),
//DEFINE_FIELD( CBasePlayer, m_fDeadTime, FIELD_FLOAT ), // only used in multiplayer games
//DEFINE_FIELD( CBasePlayer, m_fGameHUDInitialized, FIELD_INTEGER ), // only used in multiplayer games
//DEFINE_FIELD( CBasePlayer, m_flStopExtraSoundTime, FIELD_TIME ),
@ -188,11 +190,6 @@ int gmsgBhopcap = 0; @@ -188,11 +190,6 @@ int gmsgBhopcap = 0;
int gmsgStatusText = 0;
int gmsgStatusValue = 0;
int gmsgFirstperson = 0;
int gmsgThirdperson = 0;
int gmsgPlayerModel = 0;
int gmsgDeathCam = 0;
void LinkUserMessages( void )
{
// Already taken care of?
@ -239,11 +236,6 @@ void LinkUserMessages( void ) @@ -239,11 +236,6 @@ void LinkUserMessages( void )
gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
gmsgFirstperson = REG_USER_MSG( "Firstperson", 0 );
gmsgThirdperson = REG_USER_MSG( "Thirdperson", 0 );
gmsgPlayerModel = REG_USER_MSG( "PlayerModel", -1 );
gmsgDeathCam = REG_USER_MSG( "DeathCam", 1 );
}
LINK_ENTITY_TO_CLASS( player, CBasePlayer )
@ -472,8 +464,10 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl @@ -472,8 +464,10 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
// keep track of amount of damage last sustained
m_lastDamageAmount = (int)flDamage;
if( !FBitSet( pev->flags, FL_GODMODE ) )
{
// Armor.
if( !( pev->flags & FL_GODMODE ) && pev->armorvalue && !( bitsDamageType & ( DMG_FALL | DMG_DROWN ) ) )// armor doesn't protect against fall or drown damage!
if( pev->armorvalue && !( bitsDamageType & ( DMG_FALL | DMG_DROWN ) ) )// armor doesn't protect against fall or drown damage!
{
float flNew = flDamage * flRatio;
@ -495,6 +489,41 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl @@ -495,6 +489,41 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
flDamage = flNew;
}
if( pev->health - flDamage > 0 )
{
if( ( bitsDamageType & DMG_BLAST ) && flDamage > 10 )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "player/ear_ringing.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
}
}
else
{
TraceResult tr;
CBaseEntity* pDeathCam = GetClassPtr( (CBaseEntity*)NULL );
pev->velocity = g_vecZero;
pDeathCam->pev->origin = pev->origin;
pDeathCam->pev->movetype = MOVETYPE_FLY;
pDeathCam->pev->solid = SOLID_NOT;
pDeathCam->pev->renderamt = 0;
pDeathCam->pev->rendermode = kRenderTransAlpha;
UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, 100 ), dont_ignore_monsters, edict(), &tr );
if( tr.flFraction == 1.0 )
pDeathCam->pev->origin.z += 100;
else
pDeathCam->pev->origin.z += fabs( pev->origin.z - tr.vecEndPos.z );
pDeathCam->pev->angles = Vector( 90, 0, 0 );
UTIL_ScreenFade( this, g_vecZero, 15.0f, 0.0f, 255, 5 );
m_pCam->m_bIsDeathCamera = TRUE;
m_pCam->SetTarget( pDeathCam );
}
}
// this cast to INT is critical!!! If a player ends up with 0.5 health, the engine will get that
// as an int (zero) and think the player is dead! (this will incite a clientside screentilt, etc)
fTookDamage = CBaseMonster::TakeDamage( pevInflictor, pevAttacker, (int)flDamage, bitsDamageType );
@ -866,19 +895,6 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib ) @@ -866,19 +895,6 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
WRITE_BYTE( 0 );
MESSAGE_END();
//
// HL: Visitors - Go to thirdperson.
//
MESSAGE_BEGIN( MSG_ONE, gmsgThirdperson, NULL, pev );
MESSAGE_END();
//
// HL: Visitors - Enable Death camera.
//
MESSAGE_BEGIN( MSG_ONE, gmsgDeathCam, NULL, pev );
WRITE_BYTE( 1 ); // Enable/Disable
MESSAGE_END();
// UNDONE: Put this in, but add FFADE_PERMANENT and make fade time 8.8 instead of 4.12
// UTIL_ScreenFade( edict(), Vector( 128, 0, 0 ), 6, 15, 255, FFADE_OUT | FFADE_MODULATE );
@ -1291,7 +1307,7 @@ void CBasePlayer::PlayerDeathThink( void ) @@ -1291,7 +1307,7 @@ void CBasePlayer::PlayerDeathThink( void )
return;
// wait for any button down, or mp_forcerespawn is set and the respawn time is up
if( !fAnyButtonDown && !( g_pGameRules->IsMultiplayer() && forcerespawn.value > 0 && ( gpGlobals->time > ( m_fDeadTime + 5 ) ) ) )
if( !fAnyButtonDown && !( gpGlobals->time > ( m_fDeadTime + 15 ) || ( g_pGameRules->IsMultiplayer() && forcerespawn.value > 0 && ( gpGlobals->time > ( m_fDeadTime + 5 ) ) ) ) )
return;
pev->button = 0;
@ -2780,6 +2796,7 @@ void CBasePlayer::Spawn( void ) @@ -2780,6 +2796,7 @@ void CBasePlayer::Spawn( void )
m_bitsDamageType = 0;
m_afPhysicsFlags = 0;
m_fLongJump = FALSE;// no longjump module.
m_pCam = 0;
g_engfuncs.pfnSetPhysicsKeyValue( edict(), "slj", "0" );
g_engfuncs.pfnSetPhysicsKeyValue( edict(), "hl", "1" );
@ -3835,6 +3852,19 @@ reflecting all of the HUD state info. @@ -3835,6 +3852,19 @@ reflecting all of the HUD state info.
*/
void CBasePlayer::UpdateClientData( void )
{
if( m_pCam )
{
m_pCam->SetViewOnPlayer();
}
else
{
m_pCam = CCinematicCamera::CreateCinematicCamera();
m_pCam->SetTarget( this );
m_pCam->SetPlayer( this );
m_pCam->SetOrigin( g_vecZero );
m_pCam->SetViewOnTarget();
}
if( m_fInitHUD )
{
m_fInitHUD = FALSE;
@ -3844,26 +3874,6 @@ void CBasePlayer::UpdateClientData( void ) @@ -3844,26 +3874,6 @@ void CBasePlayer::UpdateClientData( void )
WRITE_BYTE( 0 );
MESSAGE_END();
//
// HL: Visitors - Go to firstperson.
//
MESSAGE_BEGIN( MSG_ONE, gmsgFirstperson, NULL, pev );
MESSAGE_END();
//
// HL: Visitors - Disable Death camera.
//
MESSAGE_BEGIN( MSG_ONE, gmsgDeathCam, NULL, pev );
WRITE_BYTE( 0 ),
MESSAGE_END();
//
// HL: Visitors - Fix up player model.
//
MESSAGE_BEGIN( MSG_ONE, gmsgPlayerModel, NULL, pev );
WRITE_STRING( "player" );
MESSAGE_END();
if( !m_fGameHUDInitialized )
{
MESSAGE_BEGIN( MSG_ONE, gmsgInitHUD, NULL, pev );

2
dlls/player.h

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
#define PLAYER_H
#include "pm_materials.h"
#include "cinematic.h"
#define PLAYER_FATAL_FALL_SPEED 1024// approx 60 feet
#define PLAYER_MAX_SAFE_FALL_SPEED 580// approx 20 feet
@ -325,6 +326,7 @@ public: @@ -325,6 +326,7 @@ public:
float m_flNextChatTime;
CCinematicCamera *m_pCam;
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
};

26
dlls/triggers.cpp

@ -2127,9 +2127,6 @@ public: @@ -2127,9 +2127,6 @@ public:
float m_acceleration;
float m_deceleration;
int m_state;
BOOL m_fIsMapCredits;
float m_flMapCreditsTime;
};
LINK_ENTITY_TO_CLASS( trigger_camera, CTriggerCamera )
@ -2150,8 +2147,6 @@ TYPEDESCRIPTION CTriggerCamera::m_SaveData[] = @@ -2150,8 +2147,6 @@ TYPEDESCRIPTION CTriggerCamera::m_SaveData[] =
DEFINE_FIELD( CTriggerCamera, m_acceleration, FIELD_FLOAT ),
DEFINE_FIELD( CTriggerCamera, m_deceleration, FIELD_FLOAT ),
DEFINE_FIELD( CTriggerCamera, m_state, FIELD_INTEGER ),
DEFINE_FIELD( CTriggerCamera, m_fIsMapCredits, FIELD_BOOLEAN ),
DEFINE_FIELD( CTriggerCamera, m_flMapCreditsTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CTriggerCamera, CBaseDelay )
@ -2168,8 +2163,6 @@ void CTriggerCamera::Spawn( void ) @@ -2168,8 +2163,6 @@ void CTriggerCamera::Spawn( void )
m_acceleration = 500;
if( m_deceleration == 0 )
m_deceleration = 500;
m_fIsMapCredits = FALSE;
}
void CTriggerCamera::KeyValue( KeyValueData *pkvd )
@ -2220,8 +2213,6 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP @@ -2220,8 +2213,6 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
m_flReturnTime = gpGlobals->time + m_flWait;
pev->speed = m_initialSpeed;
m_targetSpeed = m_initialSpeed;
m_fIsMapCredits = FStrEq( STRING( gpGlobals->mapname ), "vis_credits" ) ? TRUE : FALSE;
m_flMapCreditsTime = gpGlobals->time + 15.0f;
if( FBitSet( pev->spawnflags, SF_CAMERA_PLAYER_TARGET ) )
{
@ -2275,7 +2266,13 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP @@ -2275,7 +2266,13 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
pev->velocity = Vector( 0, 0, 0 );
}
SET_VIEW( pActivator->edict(), edict() );
CBasePlayer *pPlayer = (CBasePlayer *)( pActivator );
if( !pPlayer->m_pCam )
pPlayer->m_pCam = CCinematicCamera::CreateCinematicCamera();
pPlayer->m_pCam->SetPlayer( pPlayer );
pPlayer->m_pCam->SetTarget( this );
pPlayer->m_pCam->SetOrigin( g_vecZero );
pPlayer->m_pCam->SetViewOnTarget();
SET_MODEL( ENT( pev ), STRING( pActivator->pev->model ) );
@ -2292,12 +2289,13 @@ void CTriggerCamera::FollowTarget() @@ -2292,12 +2289,13 @@ void CTriggerCamera::FollowTarget()
if( m_hPlayer == 0 )
return;
if( m_hTarget == 0 || m_flReturnTime < gpGlobals->time || ( m_fIsMapCredits && m_flMapCreditsTime < gpGlobals->time ) )
if( m_hTarget == 0 || m_flReturnTime < gpGlobals->time )
{
if( m_hPlayer->IsAlive() )
{
SET_VIEW( m_hPlayer->edict(), m_hPlayer->edict() );
( (CBasePlayer *)( (CBaseEntity *)m_hPlayer ) )->EnableControl( TRUE );
CBasePlayer *pPlayer = (CBasePlayer *)(CBaseEntity *)m_hPlayer;
pPlayer->m_pCam->SetTarget( pPlayer );
pPlayer->EnableControl( TRUE );
}
SUB_UseTargets( this, USE_TOGGLE, 0 );
pev->avelocity = Vector( 0, 0, 0 );
@ -2344,6 +2342,8 @@ void CTriggerCamera::FollowTarget() @@ -2344,6 +2342,8 @@ void CTriggerCamera::FollowTarget()
void CTriggerCamera::Move()
{
( (CBasePlayer *)( (CBaseEntity *)m_hPlayer ) )->m_pCam->SetViewOnPlayer();
// Not moving on a path, return
if( !m_pentPath )
return;

91
dlls/visitors/cinematic.cpp

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "game.h"
#include "cinematic.h"
TYPEDESCRIPTION CCinematicCamera::m_SaveData[] =
{
DEFINE_ARRAY( CCinematicCamera, m_vecOrigin, FIELD_FLOAT, 3 ),
DEFINE_FIELD( CCinematicCamera, m_hTarget, FIELD_EHANDLE ),
DEFINE_FIELD( CCinematicCamera, m_hPlayer, FIELD_EHANDLE ),
};
IMPLEMENT_SAVERESTORE( CCinematicCamera, CBaseEntity )
BOOL CCinematicCamera::IsCinematic()
{
return cinematics.value;
}
CCinematicCamera *CCinematicCamera::CreateCinematicCamera()
{
CCinematicCamera *pCam = GetClassPtr( (CCinematicCamera *)NULL );
pCam->Spawn();
return pCam;
}
void CCinematicCamera::Spawn()
{
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_NOT;
pev->renderamt = 0;
pev->rendermode = kRenderTransAlpha;
SET_MODEL( ENT( pev ), "models/crossbow_bolt.mdl" );
UTIL_SetOrigin( pev, pev->origin );
UTIL_SetSize( pev, g_vecZero, g_vecZero );
}
void CCinematicCamera::SetOrigin( const Vector &p_vecOrigin )
{
m_vecOrigin = p_vecOrigin;
}
void CCinematicCamera::SetTarget( CBaseEntity *pEntity )
{
m_hTarget = pEntity;
}
void CCinematicCamera::SetPlayer( CBaseEntity *pEntity )
{
m_hPlayer = pEntity;
}
void CCinematicCamera::SetViewOnTarget()
{
if( m_hTarget != 0 )
{
UTIL_SetOrigin( pev, m_hTarget->pev->origin + m_vecOrigin );
SET_VIEW( m_hPlayer->edict(), edict() );
}
}
void CCinematicCamera::SetViewOnPlayer()
{
if( IsCinematic() || FClassnameIs( m_hTarget->pev, "trigger_camera" ) || m_bIsDeathCamera )
{
UTIL_SetOrigin( pev, m_hTarget->pev->origin + m_vecOrigin );
pev->angles = m_hTarget->pev->angles;
if( m_hTarget->IsPlayer() && m_vecOrigin == g_vecZero )
SET_VIEW( m_hPlayer->edict(), m_hPlayer->edict() );
else
SET_VIEW( m_hPlayer->edict(), edict() );
}
else
SET_VIEW( m_hPlayer->edict(), m_hPlayer->edict() );
}

42
dlls/visitors/cinematic.h

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
/***
*
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#pragma once
#ifndef CINEMATIC_H
#define CINEMATIC_H
class CCinematicCamera : public CBaseEntity
{
public:
BOOL IsCinematic();
static CCinematicCamera *CreateCinematicCamera();
void Spawn();
void SetOrigin( const Vector &p_vecOrigin );
void SetTarget( CBaseEntity *pEntity );
void SetPlayer( CBaseEntity *pEntity );
void SetViewOnTarget();
void SetViewOnPlayer();
int Save( CSave &save );
int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
// private:
EHANDLE m_hPlayer;
EHANDLE m_hTarget;
Vector m_vecOrigin;
BOOL m_bIsDeathCamera;
};
#endif // CINEMATIC_H

7
pm_shared/pm_shared.c

@ -2878,13 +2878,6 @@ void PM_CheckParamters( void ) @@ -2878,13 +2878,6 @@ void PM_CheckParamters( void )
else
{
VectorCopy( pmove->oldangles, pmove->angles );
//
// HL: Visitors - Do not allow rotations while dead. Since this mod features a dead camera,
// we must ensure not to update angles, otherwise player models would look
// like they 'jitter' around.
//
pmove->angles[YAW] = 0;
pmove->angles[PITCH] = 90;
}
// Set dead player view_offset

Loading…
Cancel
Save