![]() |
Routines |
| Prev: D085 | Up: Map | Next: D13A |
|
The handler of the object type 5A, which is the helper. It can be picked up by the player, like the stones, and when it is not held it goes to an object of one of the types 70 to 73 in the room, and collects it.
The helper starts by falling to the floor. If there is an object of the right type, it takes the position of that as a target, which it keeps in its record. Then it rises, to a height of B0, and goes towards the target in a straight line along x and y, as SteerTowardsTarget sets its speeds. When it gets there it flags the object, so that RunCollectableObject collects it, makes a noise and disappears in an explosion, and its entry in the object store is removed.
|
||||||||
|
Fly towards the target if one is set.
|
||||||||
| RunHelper | D0AC | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | |||||
| D0AF | BIT 0,(IX+$14) | Jump to RunHelper_Seek if the helper has no target. | ||||||
| D0B3 | JR Z,RunHelper_Seek | |||||||
| D0B5 | CALL SteerTowardsTarget | Call SteerTowardsTarget to set the speeds towards the target. | ||||||
| D0B8 | LD A,(IX+$03) | Jump to RunHelper_Move if the helper is at the height of B0 or more. | ||||||
| D0BB | CP $B0 | |||||||
| D0BD | JR NC,RunHelper_Move | |||||||
| D0BF | LD (IX+$0B),$01 | Set the speed along z to 01. | ||||||
| RunHelper_Move | D0C3 | CALL ApplyGravityAndMove_Move | Call ApplyGravityAndMove_Move to move the helper, without gravity. | |||||
| D0C6 | LD A,(IX+$0A) | Fetch the speeds together. | ||||||
| D0C9 | OR (IX+$09) | |||||||
| D0CC | OR (IX+$0B) | |||||||
| D0CF | JP NZ,FinishObjectMove | Jump to FinishObjectMove to finish if the helper is still moving. | ||||||
|
Collect the object when the helper arrives.
|
||||||||
| D0D2 | CALL PointAtObjects | Call PointAtObjects to point IY at the first ordinary object. | ||||||
| D0D5 | LD C,$70 | Set the first type to look for. | ||||||
| RunHelper_FindObject | D0D7 | LD A,(IY+$00) | Fetch the type of the object. | |||||
| D0DA | AND %11111100 | Keep the type without its lowest two bits. | ||||||
| D0DC | CP C | Jump to RunHelper_Collect if it is one of the types 70 to 73. | ||||||
| D0DD | JR Z,RunHelper_Collect | |||||||
| D0DF | ADD IY,DE | Move on to the next object. | ||||||
| D0E1 | DJNZ RunHelper_FindObject | Jump to RunHelper_FindObject until all of the objects have been tested. | ||||||
| D0E3 | JP FinishObjectMove | Jump to FinishObjectMove to finish if there is none. | ||||||
| RunHelper_Collect | D0E6 | SET 0,(IY+$16) | Flag the object as collected. | |||||
| D0EA | XOR A | Clear the helper flag. | ||||||
| D0EB | LD ($A70E),A | |||||||
| D0EE | LD DE,$D847 | Take the tune for an object being collected, CollectedTune. | ||||||
| D0F1 | CALL PlayMusic | Call PlayMusic to play it. | ||||||
| D0F4 | CALL PointAtStore | Call PointAtStore to point IY at the first entry of the object store. | ||||||
| D0F7 | LD A,$5A | Set the type to look for, which is that of the helper. | ||||||
| RunHelper_FindEntry | D0F9 | CP (IY+$00) | Jump to RunHelper_RemoveEntry if the entry is the helper. | |||||
| D0FC | JR Z,RunHelper_RemoveEntry | |||||||
| D0FE | ADD IY,DE | Move on to the next entry, and jump to RunHelper_FindEntry until all have been tested. | ||||||
| D100 | DJNZ RunHelper_FindEntry | |||||||
| D102 | JP StartExplosion | Jump to StartExplosion to make the helper explode. | ||||||
| RunHelper_RemoveEntry | D105 | LD (IY+$00),$00 | Remove the helper from the object store. | |||||
| D109 | JP StartExplosion | Jump to StartExplosion to make the helper explode. | ||||||
|
Fall, then pick a quest object as the target.
|
||||||||
| RunHelper_Seek | D10C | LD (IX+$0B),$FF | Set the speed along z to FF, to make the helper fall. | |||||
| D110 | CALL ApplyGravityAndMove_Move | Call ApplyGravityAndMove_Move to move it, without gravity. | ||||||
| D113 | CALL PointAtObjects | Call PointAtObjects to point IY at the first ordinary object. | ||||||
| D116 | LD C,$70 | Set the first type to look for. | ||||||
| RunHelper_SeekLoop | D118 | LD A,(IY+$00) | Fetch the type of the object. | |||||
| D11B | AND %11111100 | Keep the type without its lowest two bits. | ||||||
| D11D | CP C | Jump to RunHelper_SetTarget if it is one of the types 70 to 73. | ||||||
| D11E | JR Z,RunHelper_SetTarget | |||||||
| D120 | ADD IY,DE | Move on to the next object, and jump to RunHelper_SeekLoop until all have been tested. | ||||||
| D122 | DJNZ RunHelper_SeekLoop | |||||||
| D124 | JP FinishObjectMove | Jump to FinishObjectMove to finish if there is none. | ||||||
| RunHelper_SetTarget | D127 | LD A,(IY+$01) | Set the x position of the target to that of the object. | |||||
| D12A | LD (IX+$15),A | |||||||
| D12D | LD A,(IY+$02) | Set the y position of the target to that of the object. | ||||||
| D130 | LD (IX+$16),A | |||||||
| D133 | SET 0,(IX+$14) | Flag the helper as having a target. | ||||||
| D137 | JP FinishObjectMove | Jump to FinishObjectMove to finish. | ||||||
| Prev: D085 | Up: Map | Next: D13A |