Prev: EB1A Up: Map Next: EBEA
EB4C: Fill an object record from its template (PLACE_OBJECT continued)
The rest of PLACE_OBJECT, from the loop that finds the template on: the template's pointer is in the other register set (HL') and the bytes after the type in this one, and the record is filled from each in turn.
PLACE_FROM_TEMPLATE EB4C ADD HL,DE the template for the type
This entry point is used by the routine at PLACE_OBJECT.
PLACE_FROM_TEMPLATE_0 EB4D DEC A
EB4E JR NZ,PLACE_FROM_TEMPLATE }
EB50 LD B,$06 template: +0 to +5, where the sprite goes, its size and the sprite
EB52 CALL COPY_TO_RECORD
EB55 EXX a small type: its first byte to +12
EB56 BIT 6,(IY+WORK_RECORD-V)
EB5A JR NZ,PLACE_FROM_TEMPLATE_1
EB5C LD A,(HL)
EB5D INC HL
EB5E LD (IX+OBJ_KIND-OBJ_X),A
PLACE_FROM_TEMPLATE_1 EB61 LD B,$03 its place, +6 to +8
EB63 CALL COPY_TO_RECORD
EB66 EXX template: +9 to +11, the lengths along, up and across from the corner
EB67 LD B,$03
EB69 CALL COPY_TO_RECORD
EB6C BIT 6,(IY+WORK_RECORD-V) a large type: six more bytes, to +13 to +18
EB70 JR Z,PLACE_FROM_TEMPLATE_2
EB72 EXX
EB73 LD B,$06
EB75 INC IX
EB77 CALL COPY_TO_RECORD
EB7A EXX
EB7B JR PLACE_FROM_TEMPLATE_3
PLACE_FROM_TEMPLATE_2 EB7D LD A,(HL) a small type: the template's last two bytes to +14 and +16
EB7E LD (IX+OBJ_STATE-OBJ_KIND),A
EB81 INC HL
EB82 LD A,(HL)
EB83 LD (IX+OBJ_WEIGHT-OBJ_KIND),A
PLACE_FROM_TEMPLATE_3 EB86 POP IX the place asked for, plus the origin
EB88 LD A,(IX+OBJ_X)
EB8B ADD A,(IY+ORIGIN-V)
EB8E LD B,A
EB8F LD A,(IX+OBJ_TOP)
EB92 ADD A,(IY+ORIGIN_Y-V)
EB95 LD D,A
EB96 LD A,(IX+OBJ_Z)
EB99 ADD A,(IY+ORIGIN_Z-V)
EB9C LD H,A
EB9D LD (IX+OBJ_X),$32 from the place the template's screen position is for, move it there (ISO_MOVE)
EBA1 LD A,(IX+OBJ_HEIGHT)
EBA4 ADD A,$32
EBA6 LD (IX+OBJ_TOP),A
EBA9 LD (IX+OBJ_Z),$32
EBAD CALL ISO_MOVE
EBB0 EXX a large type: done
EBB1 BIT 6,(IY+WORK_RECORD-V)
EBB5 JR NZ,PLACE_FROM_TEMPLATE_6
EBB7 LD (IX+OBJ_COUNT),$01 +15: a countdown the object code uses
EBBB LD A,(IX+OBJ_STATE) the kind of movement: 2 (no template has it)
EBBE AND $0F
EBC0 CP $02
EBC2 JR NZ,PLACE_FROM_TEMPLATE_4
EBC4 LD (IX+OBJ_DIRECTION),$05 its +13
PLACE_FROM_TEMPLATE_4 EBC8 CP $03 kind 3: +13
EBCA JR NZ,PLACE_FROM_TEMPLATE_5
EBCC LD (IX+OBJ_DIRECTION),$45
PLACE_FROM_TEMPLATE_5 EBD0 CP $04 kinds 4-10: +13 and +17
EBD2 JR C,PLACE_FROM_TEMPLATE_6
EBD4 CP $0B
EBD6 JR NC,PLACE_FROM_TEMPLATE_6
EBD8 LD (IX+OBJ_DIRECTION),$05
EBDC LD (IX+OBJ_FRAME),$10
PLACE_FROM_TEMPLATE_6 EBE0 LD DE,$0014 the next free record
EBE3 ADD IX,DE
EBE5 LD (FREE_RECORD),IX
EBE9 RET
Prev: EB1A Up: Map Next: EBEA