From 5a42e80cf43f13b17277d006d1baf61080112490 Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Sat, 14 Feb 2026 20:05:48 +0100 Subject: [PATCH] Replace STAT_DEAD_YAW logic to player_state->damagePitch and player_state->damageYaw, and preserve enum padding for demo netcode by renaming as STAT_UNUSED_BIT --- README.md | 1 + code/cgame/cg_view.c | 7 ++++--- code/game/bg_public.h | 2 +- code/game/g_combat.c | 18 ++++++++++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 98a2c9c1..65be8c5d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Unofficial Quake III Arena gamecode patch * fixed shotgun not gibbing unless aiming at the feet * fixed server browser + faster scanning * fixed grappling hook muzzle position visuals + * migrated STAT_DEAD_YAW logic to player_state->damagePitch and player_state->damageYaw to sum the result, now it's renamed as STAT_UNUSED_INDEX and it can be reused even if you want to retain the demo networking in this same enum value field. * new demo UI (subfolders,filtering,sorting) * updated serverinfo UI * map rotation system diff --git a/code/cgame/cg_view.c b/code/cgame/cg_view.c index 3c8ffa34..014ad06b 100644 --- a/code/cgame/cg_view.c +++ b/code/cgame/cg_view.c @@ -216,8 +216,9 @@ static void CG_OffsetThirdPersonView( void ) { // if dead, look at killer if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 ) { - focusAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW]; - cg.refdefViewAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW]; + int totalYaw = cg.predictedPlayerState.damageYaw + cg.predictedPlayerState.damagePitch; + focusAngles[YAW] = totalYaw; + cg.refdefViewAngles[YAW] = totalYaw; } if ( focusAngles[PITCH] > 45 ) { @@ -311,7 +312,7 @@ static void CG_OffsetFirstPersonView( void ) { if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 ) { angles[ROLL] = 40; angles[PITCH] = -15; - angles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW]; + angles[YAW] = cg.snap->ps.damageYaw + cg.snap->ps.damagePitch; origin[2] += cg.predictedPlayerState.viewheight; return; } diff --git a/code/game/bg_public.h b/code/game/bg_public.h index 0878102e..7d5b0448 100644 --- a/code/game/bg_public.h +++ b/code/game/bg_public.h @@ -196,7 +196,7 @@ typedef enum { #endif STAT_WEAPONS, // 16 bit fields STAT_ARMOR, - STAT_DEAD_YAW, // look this direction when dead (FIXME: get rid of?) + STAT_UNUSED_INDEX, // unused stat index (don't remove if you want to keep demo networking!) STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?) STAT_MAX_HEALTH // health / armor limit, changable by handicap } statIndex_t; diff --git a/code/game/g_combat.c b/code/game/g_combat.c index 5a88e713..e7a76cdf 100644 --- a/code/game/g_combat.c +++ b/code/game/g_combat.c @@ -202,17 +202,31 @@ LookAtKiller */ void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker ) { vec3_t dir; + float killerYaw = self->s.angles[YAW]; if ( attacker && attacker != self ) { VectorSubtract (attacker->s.pos.trBase, self->s.pos.trBase, dir); } else if ( inflictor && inflictor != self ) { VectorSubtract (inflictor->s.pos.trBase, self->s.pos.trBase, dir); } else { - self->client->ps.stats[STAT_DEAD_YAW] = self->s.angles[YAW]; + if ( killerYaw > 255 ) { + self->client->ps.damageYaw = 255; + self->client->ps.damagePitch = (int)( killerYaw - 255 ); + } else { + self->client->ps.damageYaw = (int)killerYaw; + self->client->ps.damagePitch = 0; + } return; } - self->client->ps.stats[STAT_DEAD_YAW] = vectoyaw ( dir ); + killerYaw = vectoyaw ( dir ); + if ( killerYaw > 255 ) { + self->client->ps.damageYaw = 255; + self->client->ps.damagePitch = (int)( killerYaw - 255 ); + } else { + self->client->ps.damageYaw = (int)killerYaw; + self->client->ps.damagePitch = 0; + } } /*