Prev: B2C9 Up: Map Next: B398
B2D2: Perform an action after hitting a button
Used by the routine at BA3B.
B2D2 EX AF,AF' Remember these
B2D3 PUSH AF
B2D4 PUSH BC
B2D5 PUSH DE
B2D6 LD A,$18 Play a "hit box" sound
B2D8 LD BC,$0678
B2DB LD HL,$2080
B2DE CALL $BF1B
B2E1 LD HL,$A45B
B2E4 LD A,(HL)
B2E5 XOR $08
B2E7 LD (HL),A
B2E8 BIT 3,A
B2EA JR Z,$B319
B2EC LD DE,($A422) Get current room number
B2F0 LD D,$00 Get flags for this room in D
B2F2 LD HL,$7DC0
B2F5 ADD HL,DE
B2F6 LD D,(HL)
B2F7 LD ($A463),DE Store them
B2FB LD HL,($A45F) Get the task box character
B2FE LD A,H Have we got one?
B2FF OR L
B300 CALL NZ,$BAAA See if this task box triggers anything else
B303 LD A,($A430)
B306 LD HL,($A431)
B309 CALL $B2B6 Copy the attributes to the screen buffer
B30C LD C,$80
B30E LD A,($A422)
B311 LD ($A43B),A
B314 LD A,($A436)
B317 JR $B384
B319 LD A,($A422)
B31C LD L,A
B31D LD H,$00
B31F LD DE,$7DC0
B322 ADD HL,DE
B323 RES 7,(HL)
B325 CP $03
B327 JR NZ,$B35E
B329 LD HL,($A46D)
B32C LD DE,$0004
B32F ADD HL,DE
B330 LD DE,$7DC4
B333 LD IX,$AA57
B337 LD B,$2D
B339 EX DE,HL
B33A LD A,(DE)
B33B SUB (IX+$00)
B33E RL (HL)
B340 RLA
B341 RR (HL)
B343 INC HL
B344 INC DE
B345 LD A,(IX+$00)
B348 INC IX
B34A CP $DC
B34C JR NZ,$B352
B34E LD IX,$AA49
B352 DJNZ $B33A
B354 LD HL,$A45B
B357 SET 2,(HL)
B359 RES 4,(HL)
B35B CALL $B1A4
Completed a task - update status
B35E LD HL,$A437
B361 LD A,($A422)
B364 CP (HL)
B365 JR C,$B37A
B367 JR Z,$B37A
B369 LD (HL),A
B36A LD HL,$A45E
B36D SUB $02
B36F CP (HL)
B370 JR NZ,$B37A
B372 INC (HL)
B373 LD A,(HL)
B374 LD HL,$50F0
B377 CALL $B6F5
B37A LD HL,($A45F)
B37D LD A,H
B37E OR L
B37F CALL NZ,$BA8B
B382 XOR A
B383 LD C,A
B384 LD ($A42F),A
B387 LD A,($A433)
B38A OR C
B38B LD HL,($A434)
B38E CALL $B2B6
B391 POP DE
B392 POP BC
B393 RES 7,B
B395 POP AF
B396 EX AF,AF'
B397 RET
Prev: B2C9 Up: Map Next: B398