SERVER: Fix stance change values in NZ:P Beta

This commit is contained in:
cypress 2023-12-30 10:25:58 -05:00
parent c1b68a8cda
commit 59737bd194

View file

@ -34,8 +34,10 @@ void() rec_downed;
#define PLAYER_START_HEALTH 100 #define PLAYER_START_HEALTH 100
#define PLAYER_CROUCH_DIFFERENCE 25 #define PLAYER_CROUCH_DIFFERENCE_HL 25
#define PLAYER_PRONE_DIFFERENCE 23 #define PLAYER_PRONE_DIFFERENCE_HL 23
#define PLAYER_CROUCH_DIFFERENCE_QK 15
#define PLAYER_PRONE_DIFFERENCE_QK 13
#define PLAYER_ANIM_WALK 1 #define PLAYER_ANIM_WALK 1
#define PLAYER_ANIM_SPRINT 2 #define PLAYER_ANIM_SPRINT 2
@ -302,29 +304,40 @@ void(entity who, float preferred_stance, float play_animation) Player_SetStance
setsize(self, PLAYER_MINS_STANDING, PLAYER_MAXS_STANDING); setsize(self, PLAYER_MINS_STANDING, PLAYER_MAXS_STANDING);
} }
// NZ:P Beta should change the stances by a different amount,
// to avoid looking like you're in the ground..
float height_diff_crouch, height_diff_prone;
if (map_compatibility_mode == MAP_COMPAT_BETA) {
height_diff_crouch = PLAYER_CROUCH_DIFFERENCE_QK;
height_diff_prone = PLAYER_PRONE_DIFFERENCE_QK;
} else {
height_diff_crouch = PLAYER_CROUCH_DIFFERENCE_HL;
height_diff_prone = PLAYER_PRONE_DIFFERENCE_HL;
}
// Prone while standing? Lower to crouch + prone height. // Prone while standing? Lower to crouch + prone height.
if (who.stance == PLAYER_STANCE_STAND && preferred_stance == PLAYER_STANCE_PRONE) if (who.stance == PLAYER_STANCE_STAND && preferred_stance == PLAYER_STANCE_PRONE)
who.new_ofs_z = who.view_ofs_z - (PLAYER_CROUCH_DIFFERENCE + PLAYER_CROUCH_DIFFERENCE); who.new_ofs_z = who.view_ofs_z - (height_diff_crouch + height_diff_prone);
// Prone while crouching? Lower to prone height. // Prone while crouching? Lower to prone height.
else if (who.stance == PLAYER_STANCE_CROUCH && preferred_stance == PLAYER_STANCE_PRONE) else if (who.stance == PLAYER_STANCE_CROUCH && preferred_stance == PLAYER_STANCE_PRONE)
who.new_ofs_z = who.view_ofs_z - PLAYER_PRONE_DIFFERENCE; who.new_ofs_z = who.view_ofs_z - height_diff_prone;
// Crouch while proning? Raise to crouch height/take away prone difference. // Crouch while proning? Raise to crouch height/take away prone difference.
else if (who.stance == PLAYER_STANCE_PRONE && preferred_stance == PLAYER_STANCE_CROUCH) else if (who.stance == PLAYER_STANCE_PRONE && preferred_stance == PLAYER_STANCE_CROUCH)
who.new_ofs_z = who.view_ofs_z + PLAYER_PRONE_DIFFERENCE; who.new_ofs_z = who.view_ofs_z + height_diff_prone;
// Crouch while standing? Lower to crouch height. // Crouch while standing? Lower to crouch height.
else if (who.stance == PLAYER_STANCE_STAND && preferred_stance == PLAYER_STANCE_CROUCH) else if (who.stance == PLAYER_STANCE_STAND && preferred_stance == PLAYER_STANCE_CROUCH)
who.new_ofs_z = who.view_ofs_z - PLAYER_CROUCH_DIFFERENCE; who.new_ofs_z = who.view_ofs_z - height_diff_crouch;
// Stand while crouching? Raise to stand height/take away crouch difference. // Stand while crouching? Raise to stand height/take away crouch difference.
else if (who.stance == PLAYER_STANCE_CROUCH && preferred_stance == PLAYER_STANCE_STAND) else if (who.stance == PLAYER_STANCE_CROUCH && preferred_stance == PLAYER_STANCE_STAND)
who.new_ofs_z = who.view_ofs_z + PLAYER_CROUCH_DIFFERENCE; who.new_ofs_z = who.view_ofs_z + height_diff_crouch;
// Stand while proning? Raise to stand height/take away crouch + prone difference. // Stand while proning? Raise to stand height/take away crouch + prone difference.
else if (who.stance == PLAYER_STANCE_PRONE && preferred_stance == PLAYER_STANCE_STAND) else if (who.stance == PLAYER_STANCE_PRONE && preferred_stance == PLAYER_STANCE_STAND)
who.new_ofs_z = who.view_ofs_z + (PLAYER_CROUCH_DIFFERENCE + PLAYER_CROUCH_DIFFERENCE); who.new_ofs_z = who.view_ofs_z + (height_diff_crouch + height_diff_prone);
// Set the stance value // Set the stance value
who.stance = preferred_stance; who.stance = preferred_stance;