Prev: 45732 Up: Map Next: 45760
45753: PreDispatchHook
Used by the routine at 35314.
The hostile-in-room ATTACK-row swap and the 238 marker
PreDispatchHook is called by RoomModeDispatch at the start of EVERY action-key dispatch in room modes 0/1, before the row handler runs. In the room view it forces the special-action row (cell 13) to 52 " ATTACK " whenever a hostile is in the viewed room.
The subtlety is a press that was aimed at 49 "RmveGrille": the row is swapped to ATTACK by this very hook, inside the same key release that dispatches the row — so the hook leaves the value 238 in CursorCellValue ($8395) as a marker meaning "this press was made while the row still read RmveGrille".
The special-row shim at $B306 then honours the player's original intent: it restores the mirror to 52 (matching the now-displayed ATTACK) but still starts the timed grille removal. Only the NEXT press, taken with the row visibly reading ATTACK, goes down the attack path.
(Verified in the simulator: press 1 with the alien in the room -> mirror 49->238->52, cell 13 -> 52, actor gets action state 3 with its full grille timer; press 2 -> attack handler 37493, action state 4 timer 40, replacing the pending grille job.)
45753 CALL 45760 run the hostile-row check, then
45756 LD A,(31252) return the room mode to the dispatcher
45759 RET
Prev: 45732 Up: Map Next: 45760