Prev: 45290 Up: Map Next: 45854
45401: Routine at 45401
Used by the routine at 36457.
45401 LD IX,29574
45405 LD C,6
45407 LD H,(IX+1)
45410 LD L,(IX+5)
45413 LD B,C
45414 PUSH IX
45416 CALL 45470
45419 LD A,H
45420 CP (IX+1)
45423 JR Z,45444
45425 DJNZ 45416
45427 POP IX
45429 DEC C
45430 CALL 45470
45433 LD A,IXl
45435 CP 182
45437 JR NZ,45407
45439 CALL 37322
45442 RET
45443 NOP
45444 LD A,L
45445 SUB 2
45447 ADD A,(IX+6)
45450 LD (IX+6),A
45453 POP DE
45454 PUSH DE
45455 INC E
45456 INC E
45457 INC E
45458 INC E
45459 INC E
45460 INC E
45461 LD A,(DE)
45462 ADD A,(IX+5)
45465 SUB 2
45467 LD (DE),A
45468 JR 45425
45470 LD DE,8
45473 ADD IX,DE
45475 RET
This entry point is used by the routine at 38379.
45476 CALL 45585
45479 LD A,(31252)
45482 CP 1
45484 RET NZ
45485 LD A,(31241)
45488 CP C
45489 RET Z
45490 PUSH BC
45491 PUSH DE
45492 PUSH HL
45493 PUSH IX
45495 LD HL,65535
45498 LD (31250),HL
45501 CALL 32536
45504 POP IX
45506 POP HL
45507 POP DE
45508 POP BC
45509 RET
This entry point is used by the routine at 35578.
45510 LD A,(IX+5)
45513 ADD A,1
45515 LD (IX+5),A
45518 LD A,(IX+6)
45521 ADD A,1
45523 LD (IX+6),A
45526 CALL 32385
45529 LD HL,33706
45532 RET
This entry point is used by the routine at 38379.
45533 LD (IX+5),C
45536 JP 45479
This entry point is used by the routine at 35973.
45539 INC HL
45540 DEC (HL)
45541 LD A,127
45543 CP (HL)
45544 JR NC,45548
45546 LD (HL),0
45548 DEC HL
45549 ADD HL,DE
45550 DEC B
45551 JP NZ,36436
45554 LD A,(31252)
45557 CP 1
45559 RET NZ
45560 PUSH BC
45561 PUSH IX
45563 LD A,(31241)
45566 LD B,A
45567 LD IX,29566
45571 LD DE,8
45574 ADD IX,DE
45576 DJNZ 45574
45578 CALL 32385
45581 POP IX
45583 POP BC
45584 RET
45585 INC HL
45586 LD (HL),1
45588 PUSH BC
45589 PUSH IX
45591 PUSH HL
45592 LD H,0
45594 LD A,(33695)
45597 CP 255
45599 CALL NZ,45642
45602 LD A,(33696)
45605 CP 255
45607 CALL NZ,45642
45610 LD A,(33697)
45613 CP 255
45615 CALL NZ,45642
45618 LD A,H
45619 CP 0
45621 JR Z,45637
45623 POP HL
45624 LD (HL),2
45626 PUSH HL
45627 LD L,A
45628 LD H,C
45629 LD A,20
45631 CALL 37176
45634 CALL 36428
45637 POP HL
45638 POP IX
45640 POP BC
45641 RET
45642 LD B,A
45643 LD IX,29566
45647 LD DE,8
45650 ADD IX,DE
45652 DJNZ 45650
45654 LD B,A
45655 LD A,(IX+7)
45658 OR A
45659 RET NZ
45660 DEC (IX+6)
45663 LD A,127
45665 CP (IX+6)
45668 JR NC,45674
45670 LD (IX+6),0
45674 LD H,B
45675 RET
This entry point is used by the routine at 38379.
45676 CP (HL)
45677 JP Z,31417
45680 JP 45490
This entry point is used by the routine at 38379.
45683 LD BC,29346
45686 AND 63
45688 LD (38356),A
45691 RET
This entry point is used by the routine at 31634.
45692 CALL 31690
This entry point is used by the routine at 31634.
45695 LD HL,31257
45698 LD A,(HL)
45699 AND 31
45701 RET Z
45702 JP 32670
This entry point is used by the routine at 38379.
45705 CP C
45706 JP Z,39035
45709 LD A,(29567)
45712 AND 63
45714 CP C
45715 JP Z,39035
45718 JP 39000
This entry point is used by the routine at 37018.
45721 LD A,(IX+1)
45724 CP 98
45726 JP Z,37132
45729 JP 37036
This entry point is used by the routine at 41264.
45732 LD (33704),A
45735 LD A,(31252)
45738 CP 1
45740 RET NZ
45741 LD A,(33703)
45744 LD D,A
45745 LD A,(31241)
45748 CP D
45749 RET NZ
45750 JP 31417
This entry point is used by the routine at 35314. The hostile-in-room ATTACK-row swap and the 238 marker PreDispatchHook is called by RoomModeDispatch (35314) 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
ForceAttackRowIfHostile: room view only, and never on the QUIT row. A press on row 8 (the front-hand item) zeroes the actor's action countdown (+0), cancelling any pending timed job — the countdown only fires its action when it decrements to zero in ResetCrewTimers (35973). Then, if the alien (slot 0) is in the viewed actor's room — or, once the alien is active (flag $FF), the alien-target / Android slot (pointer at $83A5) is — swap the special row to ATTACK.
45760 LD A,(31252) room view (mode 1)?
45763 CP 1
45765 RET NZ no: nothing to do
45766 LD A,(33683)
45769 CP 17 cursor on the QUIT row?
45771 RET Z yes: leave everything alone
45772 CP 8 cursor on the front-hand item row?
45774 JR NZ,45780
45776 LD (IX+0),0 yes: cancel the actor's pending countdown
45780 LD A,(29567) alien (slot 0) in the viewed actor's room?
45783 CP (IX+1) (raw compare, so the duct bit must match too)
45786 JR Z,45803 yes: hostile present
45788 LD A,(33704) alien active ($FF, set by TriggerAlienEvent)?
45791 CP 255
45793 RET NZ no: done
45794 LD HL,(33701) the alien-target / Android record:
45797 INC HL
45798 LD A,(HL) its current room (+1)
45799 CP (IX+1) in the viewed actor's room?
45802 RET NZ no: done
45803 LD A,(33685) is the press landing on 49 "RmveGrille"?
45806 CP 49
45808 JR NZ,45815
45810 LD A,238 yes: mark the mirror with 238 so the
45812 LD (33685),A special-row shim honours the grille press
45815 LD A,52 special row (cell 13) = 52 " ATTACK "
45817 LD (29643),A
45820 LD HL,18646 and redraw it (screen row 14, column 22)
45823 LD (31257),HL
45826 CALL 31634
45829 RET
This entry point is used by the routine at 35578. SpecialRowAction: the special-row (13) handler, reached via the JP at $8BCB. 238 -> the press was aimed at RmveGrille before the swap above: restore the visible value 52 and start the timed grille removal anyway. Anything else goes to the normal path at $8BCE (52 -> attack, 49 -> timed grille removal).
45830 LD A,(33685) A = value the press landed on
45833 CP 238 swapped-under-the-cursor marker?
45835 JP NZ,35790 no: normal ATTACK / RmveGrille handling
45838 LD A,52 yes: mirror = 52 to match the displayed
45840 LD (33685),A ATTACK row,
45843 JP 35795 but still start the timed grille removal
This entry point is used by the routine at 38379. CancelActionTimer: zero the actor's action countdown (+0); a countdown parked at 0 never fires (ResetCrewTimers only dispatches on the 1 -> 0 transition).
45846 LD A,(33683)
45849 LD (IX+0),0
45853 RET
Prev: 45290 Up: Map Next: 45854