Skip to content

feat: run the player's own wake into its see frame in a live arm #559

Description

@MarcusKainth

Where it lands

Decode or execute in SQL (sqlcpu)

Native mode's simulation, native/src/sql/sim/, and its live suites. The
form's list has no entry for it.

What you are trying to do, and what stops you

P_DamageMobj's chase block ends with:

if (target->state == &states[target->info->spawnstate]
    && target->info->seestate != S_NULL)
    P_SetMobjState (target, target->info->seestate);

Once the player exclusion came out of dm_chases, the player reaches that
too: hit while standing in S_PLAY, it goes to S_PLAY_RUN1. A
statement-level test pins that the SQL has no player term in dm_wakes or
dm_chases and that dm_state prefers the see frame to the pain frame. No
live arm runs the path.

What stops one being written today is the seed. dm_pained is 0 only when the
pain roll misses, MT_PLAYER's painchance is 255, and rndtable holds 255 at
exactly one of its 256 entries, index 158. So an arm has to seed prndindex
such that the pain draw lands on that entry, and the offset it needs depends
on how many numbers the tic drew before the claw. That offset has moved
several times recently, so a seed pinned to it would break for reasons
unrelated to what it tests.

What it might look like

A claw arm in sim_player_damage_live.rs with the player standing in
S_PLAY, prndindex seeded so the pain draw reads rndtable index 158,
asserting the player's mobj ends in S_PLAY_RUN1 with that state's own wait.

The fields that can carry the assertion are the state and the tics, and only
those. S_PLAY and S_PLAY_RUN1 carry the same sprite and the same frame,
28 and 0, so an arm asserting the picture would pass whether or not the wake
happened. The wait is the clearer of the two: S_PLAY waits forever and
S_PLAY_RUN1 waits four tics.

Worth building when the draw accounting settles. A seed that has to name a
draw offset is only as stable as the offset.

Does this touch any of these?

  • None of them

Would you want to implement it?

Yes

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementA new feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions