Prev: 35560 Up: Map Next: 35973
35578: GetItemPick
Room mode 4: the "Get Item" picker strip is up (see GetItemMenu, 35638) and the action key fires on a row. QUIT rebuilds the room scene; otherwise the picked row's entry in RoomItemList (29962) is the item id to take: it goes into the front hand (marker 160+slot in ItemLocations (29940), courage/morale raised by ItemCourageBonus) if that hand is free, else into the back hand (128+slot).
35578 LD A,(33685) row value under the cursor
35581 CP 61 QUIT?
35583 JP Z,32719
35586 LD A,(33683) cursor row
35589 LD E,A
35590 LD D,0
35592 LD HL,29962 E = RoomItemList[row] = picked item id
35595 ADD HL,DE
35596 LD E,(HL)
35597 LD C,128 assume back hand (marker = slot+128)
35599 LD A,(31248) front hand free?
35602 CP 255
35604 JR NZ,35626
35606 LD HL,29984 yes: raise courage and morale
35609 ADD HL,DE by ItemCourageBonus[item]
35610 LD A,(IX+5)
35613 ADD A,(HL)
35614 LD (IX+5),A
35617 LD A,(IX+6)
35620 ADD A,(HL)
35621 LD (IX+6),A
35624 LD C,160 and use the front hand (slot+160)
35626 LD A,(31241) ItemLocations[item] = hand marker:
35629 ADD A,C the item is now carried
35630 LD HL,29940
35633 ADD HL,DE
35634 LD (HL),A
35635 JP 32719 rebuild the room scene
GetItemMenu — action on the "Get Item" row (10): rebuild the strip as an item picker listing the room's items — copy RoomItemList (29962) into CorridorPosTable, converting each id to its name string via ItemIdToString (31857) — put the cursor on the QUIT row and switch to room mode 4 (GetItemPick above handles the selection).
35638 LD (IX+0),0 clear the actor's action timer
35642 LD DE,29630 DE -> CorridorPosTable
35645 LD HL,29962 HL -> RoomItemList
35648 LD B,17 copy 17 entries
35650 LD A,(HL)
35651 CP 255 255 = empty row, copied as-is
35653 JR Z,35660
35655 PUSH DE
35656 CALL 31857 item id -> name string index
35659 POP DE
35660 LD (DE),A
35661 INC HL
35662 INC DE
35663 DJNZ 35650
35665 LD A,61 row 17 = " QUIT ",
35667 LD (29647),A cursor on it
35670 LD (33685),A
35673 LD A,17
35675 LD (33683),A
35678 LD HL,22582 menu attributes: 17 rows white,
35681 LD A,15 1 row highlighted
35683 LD C,17
35685 CALL 31612
35688 LD A,56
35690 LD C,1
35692 CALL 31612
35695 LD HL,29630 draw the 19 menu rows
35698 LD (31261),HL
35701 LD HL,16438
35704 LD (31257),HL
35707 LD B,19
35709 PUSH BC
35710 CALL 31626
35713 POP BC
35714 DJNZ 35709
35716 LD A,4 room mode = 4 (item picker)
35718 LD (31252),A
35721 CALL 34882
35724 RET
LeaveItemHandler — action on the "Leave Item" row (11): drop the back-hand item if there is one, otherwise the front-hand item (undoing its courage bonus); the dropped item's ItemLocations entry becomes the current room.
35725 LD (IX+0),0
35729 LD A,(31249) back hand loaded?
35732 CP 255
35734 JR NZ,35782 yes: drop the back item
35736 LD A,(31248) no: drop the front item —
35739 LD E,A
35740 LD D,0
35742 LD HL,29984 undo its courage bonus
35745 ADD HL,DE
35746 LD A,(IX+5)
35749 SUB (HL)
35750 CP 127 (clamp underflow to 0)
35752 JR C,35755
35754 XOR A
35755 LD (IX+5),A
35758 LD A,(IX+6)
35761 SUB (HL)
35762 CP 127
35764 JR C,35767
35766 XOR A
35767 LD (IX+6),A
35770 LD HL,29940 ItemLocations[item] = current room:
35773 ADD HL,DE the item now lies here
35774 LD A,(31242)
35777 LD (HL),A
35778 CALL 32719 rebuild the room scene
35781 RET
35782 LD E,A E = back item id (no bonus to undo)
35783 LD D,0
35785 JR 35770
Special-row handler (row 13, from RoomDispatchTailExtra): the shim at $B306 sorts out the 238 marker first, then re-enters below.
35787 JP 45830
This entry point is used by the routine at 45401.
35790 CP 52 " ATTACK " selected?
35792 JP Z,37493 yes: attack handler
This entry point is used by the routine at 45401. StartGrilleRemoval: queue the timed RmveGrille job — action state 3 fires CrewAction3_RemoveGrille (36150) when the countdown expires.
35795 LD A,(31241) base time = GrilleTimeBySlot[slot]
35798 LD E,A (100-180 frames, crew-dependent)
35799 LD D,0
35801 LD HL,33770
35804 ADD HL,DE
35805 LD A,(HL)
35806 CALL 35814 set the action countdown
35809 LD (IX+3),3 action state = 3 (remove the grille)
35813 RET
This entry point is used by the routines at 35382, 35560, 36457 and 37490. SetActionTimer: (IX+0) = A + ActionTimeBySlot[slot] + ActionTimeByStrength[(IX+4) & 7] — the shared countdown formula for every queued crew action (move, grille, attack, ...).
35814 PUSH AF A = base time from the caller
35815 LD HL,33786
35818 LD A,(31241) + per-slot adjustment
35821 LD D,0
35823 LD E,A
35824 ADD HL,DE
35825 LD C,(HL)
35826 LD A,(IX+4) + per-strength adjustment
35829 AND 7 (Wounded +48, strength 3 +16, else +0)
35831 LD E,A
35832 LD HL,33778
35835 ADD HL,DE
35836 LD A,(HL)
35837 ADD A,C
35838 LD C,A
35839 POP AF
35840 ADD A,C
35841 LD (IX+0),A arm the countdown
35844 RET
35845 LD (IX+0),0
35849 LD A,(31248)
35852 CP 17
35854 JR Z,35859
35856 CP 16
35858 RET NZ
35859 LD A,(31241)
35862 LD E,A
35863 LD D,0
35865 LD HL,33762
35868 ADD HL,DE
35869 LD E,(HL)
35870 LD A,(31248)
35873 CP 17
35875 JR Z,35881
35877 LD A,E
35878 SUB 4
35880 LD E,A
35881 CALL 33589
35884 CP E
35885 JR NC,35896
35887 LD HL,33707
35890 LD (HL),1
35892 CALL 36859
35895 RET
35896 LD A,(31248)
35899 LD HL,29940
35902 LD E,A
35903 LD D,0
35905 ADD HL,DE
35906 LD (HL),255
35908 LD E,4
35910 ADD HL,DE
35911 LD A,(31241)
35914 ADD A,160
35916 LD (HL),A
35917 CALL 31820
35920 LD A,(31248)
35923 CALL 31857
35926 LD (29638),A
35929 LD HL,18486
35932 LD (31257),HL
35935 CALL 31634
35938 CALL 45510
35941 LD (HL),255
35943 LD HL,18678
35946 LD (31257),HL
35949 LD A,255
35951 LD (29644),A
35954 CALL 31634
35957 CALL 34743
35960 CALL 39670
35963 LD A,(31241)
35966 LD L,A L = capturing crew slot
35967 LD A,2 msg #2 "{actor} has captured Jones"
35969 CALL 37176
35972 RET
Prev: 35560 Up: Map Next: 35973