![]() |
Routines |
| Prev: 48444 | Up: Map | Next: 48579 |
|
Used by the routine at ScriptRoutine_ThingUpstairsChase.
Return 1 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 0. Otherwise return 0.
|
||||||||
|
Horizontal overlap against Berk's X / X-extent copies.
|
||||||||
| Test_ThingUpstairs_Overlap | 48498 | LD A,(29444) | Load Berk's X-extent copy (BerkXExtentCopy) into A. | |||||
| 48501 | DEC A | Step that right edge back by one. | ||||||
| 48502 | CP (IX+7) | Is Berk's right edge left of the Thing Upstairs entity's left edge (IX+7)? If so, no overlap, so return. | ||||||
| 48505 | RET C | |||||||
| 48506 | LD A,(29443) | Load Berk's X-coordinate copy (BerkXCoordinateCopy) into A. | ||||||
| 48509 | CP (IX+8) | Is Berk's left edge at or beyond the Thing Upstairs entity's right edge (IX+8)? If so, no overlap, so return. | ||||||
| 48512 | RET NC | |||||||
|
Vertical overlap against the camera-follow entity.
|
||||||||
| 48513 | LD A,(IX+6) | Load the Thing Upstairs entity's y-extent (bottom edge) into A. | ||||||
| 48516 | LD IY,37019 | Point IY at the camera-follow entity (StateData_Berk). | ||||||
| 48520 | LD C,(IY+6) | Load the camera-follow entity's y-extent into C. | ||||||
| 48523 | CP (IY+5) | Is the Thing Upstairs entity's bottom above the camera-follow entity's top (IY+5)? If so, no overlap, so return. | ||||||
| 48526 | RET C | |||||||
| 48527 | LD A,(IX+5) | Load the Thing Upstairs entity's y-coordinate (top edge) into A. | ||||||
| 48530 | INC A | Advance that top edge by two. | ||||||
| 48531 | INC A | |||||||
| 48532 | CP C | Is that raised top at or below the camera-follow entity's bottom in C? If so, no overlap, so return. | ||||||
| 48533 | RET NC | |||||||
|
Accept only when Berk's room copy is 0.
|
||||||||
| 48534 | LD A,(29445) | Load Berk's room-index copy (BerkRoomIndexCopy) into A. | ||||||
| 48537 | OR A | Is Berk in room 0? If not, jump to Test_ThingUpstairs_Overlap_NoMatch. | ||||||
| 48538 | JR NZ,Test_ThingUpstairs_Overlap_NoMatch | |||||||
| 48540 | INC A | Set A to 1 as a successful overlap result. | ||||||
| 48541 | RET | Return. | ||||||
|
No Thing Upstairs overlap (wrong room or miss): return 0 in A.
|
||||||||
| Test_ThingUpstairs_Overlap_NoMatch | 48542 | XOR A | Clear A as a false / no-match result. | |||||
| 48543 | RET | Return. | ||||||
|
This entry point is used by the routine at Update_ThingUpstairs_Entity.
Entry from Update_ThingUpstairs_Entity when slot 32 is not Thing Upstairs: maybe arm the Thing Upstairs script/sound.
|
||||||||
| Update_ThingUpstairs_Entity_ArmSpawn | 48544 | LD A,(29363) | Load A with the game event flags (GameEventFlags). | |||||
| 48547 | BIT 1,A | Is "trap door is open / trap door event armed" (bit 1 of GameEventFlags) set? If not, return. | ||||||
| 48549 | RET Z | |||||||
| 48550 | LD A,60 | Load A with random maximum 60. | ||||||
| 48552 | CALL PseudoRandom | Call PseudoRandom to pick a pseudo-random value. | ||||||
| 48555 | OR A | Is that random value zero? If not, return. | ||||||
| 48556 | RET NZ | |||||||
|
|
||||||||
| 48557 | LD A,136 | Load A with 136. | ||||||
| 48559 | CALL Queue_Sound | Call Queue_Sound to queue a sound effect. | ||||||
| 48562 | LD HL,29363 | Point HL at the game event flags (GameEventFlags). | ||||||
| 48565 | SET 4,(HL) | Set "task-two / upstairs event latch" (bit 4 of GameEventFlags). | ||||||
| 48567 | LD HL,48096 | Point HL at the Thing Upstairs script (48096). | ||||||
| 48570 | LD (29401),HL | Store HL in Pointer_ThingUpstairsScriptPosition. | ||||||
| 48573 | LD A,34 | Load A with 34. | ||||||
| 48575 | LD (36865),A | Store A in complex entity slot 32's type (StateData_Complex_20). | ||||||
| 48578 | RET | Return. | ||||||
| Prev: 48444 | Up: Map | Next: 48579 |