Routines |
Prev: 52044 | Up: Map | Next: 52118 |
Used by the routine at 51968.
|
||||
Follows from previous routine or jump from 52000 if bit 3 (8) of item byte at 60238 is set (item is moving/falling after being dropped).
|
||||
52059 | CALL 56008 | Check that the servant isn't dragging a held object below the bottom of the room boundary, adjusting co-ordinates accordingly | ||
52062 | CALL 57401 | Other wall/room boundary checks, including horizontal wall checks | ||
The next routine handles the item's vertical movement speed/momentum. When objects are dropped, they will fall a certain distance that depends on the item's screen height/position:
|
||||
52065 | LD A,(60237) | Vertical movement speed/offset in pixels (negative = up, positive = down) | ||
52068 | ADD A,12 | Adjust vertical movement rate slightly - 12 pixels gives a bit of momentum to the object to create a semblence of gravity when the servant is throwing or dropping an object - this increase means vertical speed will increase if the item is falling, and decrease if it is rising (after being 'thrown' upwards by the servant). | ||
52070 | LD (60237),A | |||
52073 | CP 128 | >=128 = negative value | ||
52075 | JR NC,52136 | If no carry (>=128) item is moving upwards | ||
Item is falling (moving downwards). Check it doesn't move off the bottom of the playing area, and stop it if it is.
|
||||
52077 | SRA A | Halve the downward momentum (adjusted earlier by adding 12, so halving here will increment the value in steps of 6) | ||
52079 | LD C,A | Temp store in C register | ||
52080 | LD A,(60234) | Graphic vertical pixel position from top of playing area | ||
52083 | LD D,A | |||
52084 | LD A,96 | Pixel line 96 is the bottom of the playing area when the room viewport is in its default position | ||
52086 | LD HL,60150 | Address holding the vertical pixel position of the current room viewport | ||
52089 | INC HL | Advance to the next address as it's the high byte that contains the vertical pixel value | ||
52090 | ADD A,(HL) | Adjust the bottom-of-screen boundary based on the current room position/viewport | ||
52091 | SUB D | Subtract the item vertical position | ||
52092 | CP 96 | |||
52094 | JR NC,52099 | If there's no carry, the item is falling off the bottom of the screen | ||
Item isn't falling off the bottom of the screen. Check if the item has fallen far enough to rest on the room floor.
|
||||
52096 | CP C | C contains the falling item's incremental vertical momentum (6, 12, 18, 24 etc.). Once this surpasses the adjusted vertical screen pixel position, the object stops. The effect of this calculation means the object will fall further the higher up the screen it is. This reinforces the 3D illusion, where the lower part of the room (the floor area) is presented at an angle, compared to the back wall, which is presented face on. |
||
52097 | JR NC,52136 | No carry = jump out here - the object can continue to fall | ||
Item is falling off the bottom of the screen, or has fallen far enough in the room - need to stop it moving so it's now at rest.
|
||||
52099 | LD A,(60238) | |||
52102 | AND 247 | Reset bit 3 (8) of the item properties byte to indicate this item is no longer falling/moving | ||
52104 | LD (60238),A | |||
52107 | LD A,0 | |||
52109 | LD (60237),A | Set the item's vertical speed to zero | ||
52112 | LD (60236),A | Set the item's horizontal speed to zero | ||
52115 | JP 52263 |
Prev: 52044 | Up: Map | Next: 52118 |