Skip to content

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#69

Open
LegendaryGuard wants to merge 1 commit intoec-:masterfrom
LegendaryGuard:fixIdSoftware-getRidOfSTAT_DEAD_YAW

Conversation

@LegendaryGuard
Copy link
Contributor

@LegendaryGuard LegendaryGuard commented Feb 14, 2026

Uses player_state->damageYaw does the same behavior and can be reused for these situations.
That could fix a FIXME task in STAT_DEAD_YAW enum from id Software, which was left since the first Q3 version release.

Tested and works.
Moreover, this STAT_ slot can be reused, it isn't removed because it must retain the enum value for demo netcode safeness.

EDIT:
Uses ps->damagePitch and ps->damageYaw to get the correct result, so that avoids 8 bits value issues.

@LegendaryGuard LegendaryGuard force-pushed the fixIdSoftware-getRidOfSTAT_DEAD_YAW branch from 5ef3ef2 to 40e4cc0 Compare February 14, 2026 19:43
@ensiform
Copy link

This is demo and pseudo-netcode breaking requiring client to have forced matching cgame.qvm now.
Should not remove an entry from enum list like this. You should retain the enum value so the others following it are not changed.

@LegendaryGuard LegendaryGuard force-pushed the fixIdSoftware-getRidOfSTAT_DEAD_YAW branch from 40e4cc0 to 5c4d1b5 Compare February 15, 2026 09:38
@LegendaryGuard LegendaryGuard changed the title Get rid of STAT_DEAD_YAW, player_state->damageYaw is the best solution Migrate STAT_DEAD_YAW logic to playerState_t->damageYaw and preserve enum padding for netcode Feb 15, 2026
@LegendaryGuard
Copy link
Contributor Author

LegendaryGuard commented Feb 15, 2026

Thanks for the warning! Just commited. Then, do I leave like it as is?
Tell me if I have forgotten such details or something isn't right. And if it isn't what we expected, I close the PR.

@LegendaryGuard LegendaryGuard force-pushed the fixIdSoftware-getRidOfSTAT_DEAD_YAW branch from 5c4d1b5 to 91af79d Compare February 15, 2026 09:47
@LegendaryGuard LegendaryGuard changed the title Migrate STAT_DEAD_YAW logic to playerState_t->damageYaw and preserve enum padding for netcode Migrate STAT_DEAD_YAW logic to player_state->damageYaw and preserve enum padding for netcode Feb 15, 2026
@LegendaryGuard LegendaryGuard changed the title Migrate STAT_DEAD_YAW logic to player_state->damageYaw and preserve enum padding for netcode Migrate STAT_DEAD_YAW logic to player_state->damageYaw and preserve enum padding for demo netcode Feb 15, 2026
@NeonKnightOA
Copy link

Thanks for the warning! Just commited. Then, do I leave like it as is? Tell me if I have forgotten such details or something isn't right. And if it isn't what we expected, I close the PR.

You could also leave all the changes as they are, but restore back the enum to its place. But that would defeat the purpose of the PR.

@ensiform
Copy link

You can manually assign the values of enums to accommodate a missing entry or just rename it unused or something.

@LegendaryGuard LegendaryGuard force-pushed the fixIdSoftware-getRidOfSTAT_DEAD_YAW branch from 91af79d to b5b2e26 Compare February 15, 2026 15:58
@LegendaryGuard LegendaryGuard changed the title Migrate STAT_DEAD_YAW logic to player_state->damageYaw and preserve enum padding for demo netcode Replace STAT_DEAD_YAW logic to player_state->damageYaw and preserve enum padding for demo netcode by renaming as STAT_UNUSED_BIT Feb 15, 2026
@LegendaryGuard
Copy link
Contributor Author

LegendaryGuard commented Feb 15, 2026

@ensiform Done, I just renamed this unused enum value and added a comment on it.

EDIT: Sorry for the last force-pushed commits, I was renaming as correctly as possible.

@LegendaryGuard LegendaryGuard force-pushed the fixIdSoftware-getRidOfSTAT_DEAD_YAW branch 3 times, most recently from 849e88e to 8dd03d5 Compare February 15, 2026 16:03
@ensiform
Copy link

ensiform commented Feb 17, 2026

Also of note, by the way, damageYaw is only networked 8 bits so technically can only hold 0-255 (what does do about the range 255-360)? at network transmission anything higher results in either wrapping or it is capped, I don't recall what the engine does for this. Although it may actually be -127 to 127.

I believe this cannot be safely merged using that variable.

@LegendaryGuard LegendaryGuard marked this pull request as draft February 17, 2026 15:50
@LegendaryGuard
Copy link
Contributor Author

LegendaryGuard commented Feb 17, 2026

Sh*t! I knew something bad was happening in the code and in-game, the rest of angles from 255 and 360 aren't showing correctly.
I was about to use send data event idea in EV_DEATHx, but I realized that eventparm is 8 bits too. So close!

At the end, I close the PR.

@LegendaryGuard LegendaryGuard changed the title Replace STAT_DEAD_YAW logic to player_state->damageYaw and preserve enum padding for demo netcode by renaming as STAT_UNUSED_BIT 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 Feb 17, 2026
…tate->damageYaw, and preserve enum padding for demo netcode by renaming as STAT_UNUSED_BIT
@LegendaryGuard LegendaryGuard force-pushed the fixIdSoftware-getRidOfSTAT_DEAD_YAW branch from 8dd03d5 to 5a42e80 Compare February 25, 2026 23:28
@LegendaryGuard
Copy link
Contributor Author

What about reusing ps->damagePitch and ps->damageYaw and apply the result?
It worked dodging the 8 bits value headaches!

@LegendaryGuard LegendaryGuard marked this pull request as ready for review February 25, 2026 23:30
@ensiform
Copy link

ensiform commented Feb 26, 2026

Seems fine to me to do this if you need access to more stats in a mod. but the fixme comment could just be removed TBH. as this behavior was propagated across all the other idtech games using this stat, so it seems more like they just forgot to remove the fixme and everyone was okay with it.

" If it ain't broke don't fix it"

Others may approve of the change and it doesn't really matter either way for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants