![]() |
Routines |
| Prev: BD3C | Up: Map | Next: BDC3 |
|
Used by the routine at ScriptRoutine_ThingUpstairsChase.
Return 01 in A when the Thing Upstairs entity overlaps Berk on X (BerkXCoordinateCopy / BerkXExtentCopy) and the camera-follow entity (StateData_Berk) on Y while Berk's room copy is 00. Otherwise return 00.
|
||||||||
|
Horizontal overlap against Berk's X / X-extent copies.
|
||||||||
| Test_ThingUpstairs_Overlap | BD72 | LD A,($7304) | Load Berk's X-extent copy (BerkXExtentCopy) into A. | |||||
| BD75 | DEC A | Step that right edge back by one. | ||||||
| BD76 | CP (IX+$07) | Is Berk's right edge left of the Thing Upstairs entity's left edge (IX+07)? If so, no overlap, so return. | ||||||
| BD79 | RET C | |||||||
| BD7A | LD A,($7303) | Load Berk's X-coordinate copy (BerkXCoordinateCopy) into A. | ||||||
| BD7D | CP (IX+$08) | Is Berk's left edge at or beyond the Thing Upstairs entity's right edge (IX+08)? If so, no overlap, so return. | ||||||
| BD80 | RET NC | |||||||
|
Vertical overlap against the camera-follow entity.
|
||||||||
| BD81 | LD A,(IX+$06) | Load the Thing Upstairs entity's y-extent (bottom edge) into A. | ||||||
| BD84 | LD IY,$909B | Point IY at the camera-follow entity (StateData_Berk). | ||||||
| BD88 | LD C,(IY+$06) | Load the camera-follow entity's y-extent into C. | ||||||
| BD8B | CP (IY+$05) | Is the Thing Upstairs entity's bottom above the camera-follow entity's top (IY+05)? If so, no overlap, so return. | ||||||
| BD8E | RET C | |||||||
| BD8F | LD A,(IX+$05) | Load the Thing Upstairs entity's y-coordinate (top edge) into A. | ||||||
| BD92 | INC A | Advance that top edge by two. | ||||||
| BD93 | INC A | |||||||
| BD94 | CP C | Is that raised top at or below the camera-follow entity's bottom in C? If so, no overlap, so return. | ||||||
| BD95 | RET NC | |||||||
|
Accept only when Berk's room copy is 00.
|
||||||||
| BD96 | LD A,($7305) | Load Berk's room-index copy (BerkRoomIndexCopy) into A. | ||||||
| BD99 | OR A | Is Berk in room 00? If not, jump to Test_ThingUpstairs_Overlap_NoMatch. | ||||||
| BD9A | JR NZ,Test_ThingUpstairs_Overlap_NoMatch | |||||||
| BD9C | INC A | Set A to 01 as a successful overlap result. | ||||||
| BD9D | RET | Return. | ||||||
|
No Thing Upstairs overlap (wrong room or miss): return 00 in A.
|
||||||||
| Test_ThingUpstairs_Overlap_NoMatch | BD9E | XOR A | Clear A as a false / no-match result. | |||||
| BD9F | RET | Return. | ||||||
|
This entry point is used by the routine at Update_ThingUpstairs_Entity.
Entry from Update_ThingUpstairs_Entity when slot 20 is not Thing Upstairs: maybe arm the Thing Upstairs script/sound.
|
||||||||
| Update_ThingUpstairs_Entity_ArmSpawn | BDA0 | LD A,($72B3) | Load A with the game event flags (GameEventFlags). | |||||
| BDA3 | BIT 1,A | Is "trap door is open / trap door event armed" (bit 01 of GameEventFlags) set? If not, return. | ||||||
| BDA5 | RET Z | |||||||
| BDA6 | LD A,$3C | Load A with random maximum 3C. | ||||||
| BDA8 | CALL PseudoRandom | Call PseudoRandom to pick a pseudo-random value. | ||||||
| BDAB | OR A | Is that random value zero? If not, return. | ||||||
| BDAC | RET NZ | |||||||
|
|
||||||||
| BDAD | LD A,$88 | Load A with 88. | ||||||
| BDAF | CALL Queue_Sound | Call Queue_Sound to queue a sound effect. | ||||||
| BDB2 | LD HL,$72B3 | Point HL at the game event flags (GameEventFlags). | ||||||
| BDB5 | SET 4,(HL) | Set "task-two / upstairs event latch" (bit 04 of GameEventFlags). | ||||||
| BDB7 | LD HL,$BBE0 | Point HL at the Thing Upstairs script (BBE0). | ||||||
| BDBA | LD ($72D9),HL | Store HL in Pointer_ThingUpstairsScriptPosition. | ||||||
| BDBD | LD A,$22 | Load A with 22. | ||||||
| BDBF | LD ($9001),A | Store A in complex entity slot 20's type (StateData_Complex_20). | ||||||
| BDC2 | RET | Return. | ||||||
| Prev: BD3C | Up: Map | Next: BDC3 |