PMove: Added a bit of a punchangle when falling/falldamage hits

This commit is contained in:
Marco Cawthorne 2020-09-02 04:09:33 +02:00
parent 9125cbbfeb
commit 3ca223b673
7 changed files with 29 additions and 10 deletions

View file

@ -31,6 +31,7 @@ Game_Worldspawn(void)
Sound_Precache("ammo.respawn");
Sound_Precache("player.die");
Sound_Precache("player.fall");
Sound_Precache("player.lightfall");
precache_model("models/player.mdl");
precache_model("models/w_weaponbox.mdl");
Weapons_Init();

View file

@ -26,6 +26,7 @@ void Game_Worldspawn(void)
precache_model("models/w_weaponbox.mdl");
Sound_Precache("player.die");
Sound_Precache("player.fall");
Sound_Precache("player.lightfall");
Player_Precache();
Weapons_Init();

View file

@ -27,6 +27,7 @@ Game_Worldspawn(void)
Sound_Precache("ammo.respawn");
Sound_Precache("player.die");
Sound_Precache("player.fall");
Sound_Precache("player.lightfall");
precache_model("models/player.mdl");
precache_model("models/w_weaponbox.mdl");
Weapons_Init();

View file

@ -31,6 +31,8 @@ Game_Worldspawn(void)
Sound_Precache("ammo.respawn");
Sound_Precache("player.die");
Sound_Precache("player.fall");
Sound_Precache("player.lightfall");
precache_model("models/player.mdl");
precache_model("models/w_weaponbox.mdl");
Weapons_Init();

View file

@ -778,6 +778,14 @@ PMove_Run(void)
/* activate any SOLID_TRIGGER entities */
touchtriggers();
if (self.waterlevel != 0) {
flFallVel = 0;
}
if ((self.flags & FL_ONGROUND) && self.movetype == MOVETYPE_WALK) {
GamePMove_Fall((player)self, flFallVel);
}
/* timers, these are predicted and shared across client and server */
pl.w_attack_next = max(0, pl.w_attack_next - input_timelength);
pl.w_idle_next = max(0, pl.w_idle_next - input_timelength);
@ -787,14 +795,6 @@ PMove_Run(void)
pl.punchangle[1] *= punch;
pl.punchangle[2] *= punch;
if (self.waterlevel != 0) {
flFallVel = 0;
}
if ((self.flags & FL_ONGROUND) && self.movetype == MOVETYPE_WALK) {
GamePMove_Fall((player)self, flFallVel);
}
/* weapon/item logic of what the player controls */
Game_Input();
}

View file

@ -31,8 +31,14 @@ void GamePMove_Fall(player target, float impactspeed)
if (impactspeed > 580) {
#ifdef SERVER
float fFallDamage = (impactspeed - 580) * (100 / (1024 - 580));
Damage_Apply(self, world, fFallDamage, 0, DMG_FALL);
Sound_Play(self, CHAN_AUTO, "player.fall");
Damage_Apply(target, world, fFallDamage, 0, DMG_FALL);
Sound_Play(target, CHAN_AUTO, "player.fall");
#endif
target.punchangle += [15,0,(input_sequence & 1) ? 15 : -15];
} else if (impactspeed > 400) {
target.punchangle += [15,0,0];
#ifdef SERVER
Sound_Play(target, CHAN_AUTO, "player.lightfall");
#endif
}
}

View file

@ -0,0 +1,8 @@
player.fall
{
sample player/pl_fallpain3.wav
}
player.lightfall
{
sample player/pl_fallpain1.wav
}