CSGameRules: Make use of SpectatorDeathcam(). Support player death animation variations again. Also fix the death sound not having played.
This commit is contained in:
parent
ab3d4a9346
commit
7994088423
|
@ -16,8 +16,6 @@
|
|||
|
||||
class CSGameRules:CGameRules
|
||||
{
|
||||
virtual void PlayerConnect(NSClientPlayer);
|
||||
virtual void PlayerDisconnect(NSClientPlayer);
|
||||
virtual void PlayerKill(NSClientPlayer);
|
||||
virtual void PlayerPreFrame(NSClientPlayer);
|
||||
virtual void PlayerDeath(NSClientPlayer);
|
||||
|
|
|
@ -175,27 +175,6 @@ CSGameRules::LevelNewParms(void)
|
|||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
void
|
||||
CSGameRules::PlayerConnect(NSClientPlayer pl)
|
||||
{
|
||||
if (Plugin_PlayerConnect(pl) == FALSE)
|
||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||
}
|
||||
|
||||
void
|
||||
CSGameRules::PlayerDisconnect(NSClientPlayer pl)
|
||||
{
|
||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||
|
||||
/* Make this unusable */
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.modelindex = 0;
|
||||
pl.health = 0;
|
||||
pl.takedamage = 0;
|
||||
pl.SendFlags = PLAYER_MODELINDEX;
|
||||
}
|
||||
|
||||
void
|
||||
CSGameRules::PlayerKill(NSClientPlayer pl)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ CSMultiplayerRules::PlayerDisconnect(NSClientPlayer pl)
|
|||
if (health > 0)
|
||||
PlayerDeath(pl);
|
||||
|
||||
NSGameRules::PlayerDisconnect(pl);
|
||||
super::PlayerDisconnect(pl);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -44,8 +44,42 @@ CSMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
|||
{
|
||||
player targ = (player)g_dmg_eTarget;
|
||||
player attk = (player)g_dmg_eAttacker;
|
||||
NSRenderableEntity newCorpse;
|
||||
float deathAnimation;
|
||||
|
||||
FX_Corpse_Spawn(targ, ANIM_DEATH1);
|
||||
/* TODO: death anims based on hit-regions */
|
||||
if (targ.flags & FL_CROUCHING) {
|
||||
deathAnimation = ANIM_CROUCH_DIE;
|
||||
} else {
|
||||
switch (g_dmg_iHitBody) {
|
||||
case BODY_HEAD:
|
||||
deathAnimation = ANIM_DIE_HEAD;
|
||||
break;
|
||||
case BODY_STOMACH:
|
||||
deathAnimation = ANIM_DIE_GUT;
|
||||
break;
|
||||
case BODY_ARMLEFT:
|
||||
deathAnimation = ANIM_DIE_LEFT;
|
||||
break;
|
||||
case BODY_ARMRIGHT:
|
||||
deathAnimation = ANIM_DIE_RIGHT;
|
||||
break;
|
||||
default:
|
||||
bool isFacing = targ.IsFacingPosition(g_dmg_vecLocation);
|
||||
deathAnimation = ANIM_DEATH1;
|
||||
|
||||
if (isFacing == false)
|
||||
deathAnimation = ANIM_DIE_FORWARD;
|
||||
else
|
||||
deathAnimation = ANIM_DIE_BACK;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
newCorpse = FX_Corpse_Spawn(targ, deathAnimation);
|
||||
|
||||
targ.SpectatorDeathcam(newCorpse, attk, 3.0f);
|
||||
|
||||
/* obituary networking */
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
@ -108,6 +142,8 @@ CSMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
|||
targ.Death();
|
||||
targ.gflags &= ~GF_FLASHLIGHT;
|
||||
|
||||
targ.StartSoundDef("Player.Death", CHAN_AUTO, true);
|
||||
|
||||
/* gamerule stuff */
|
||||
targ.MakeTempSpectator();
|
||||
forceinfokey(targ, "*dead", "1");
|
||||
|
|
|
@ -172,6 +172,7 @@ class player:NSClientPlayer
|
|||
|
||||
virtual void(void) Physics_InputPostMove;
|
||||
virtual void UpdatePlayerAnimation(float);
|
||||
virtual void SharedInputFrame(void);
|
||||
|
||||
#ifdef CLIENT
|
||||
int playertype;
|
||||
|
@ -250,6 +251,22 @@ player::UpdatePlayerAnimation(float timelength)
|
|||
Animation_TimerUpdate(this, timelength);
|
||||
}
|
||||
|
||||
void
|
||||
player::SharedInputFrame(void)
|
||||
{
|
||||
/* don't allow attacks when in freeze. */
|
||||
#ifdef CLIENT
|
||||
if (getstatf(STAT_GAMESTATE) == GAME_FREEZE) {
|
||||
#else
|
||||
if (g_cs_gamestate == GAME_FREEZE) {
|
||||
#endif
|
||||
/* secondary fire is still allowed, however. */
|
||||
if (input_buttons & INPUT_BUTTON0) {
|
||||
w_attack_next = (w_attack_next > 0.1) ? w_attack_next : 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void Camera_RunPosBob(vector angles, __inout vector camera_pos);
|
||||
void Camera_StrafeRoll(__inout vector camera_angle);
|
||||
|
|
Loading…
Reference in New Issue