Prev: 7663 Up: Map Next: 76F8
768A: Create Action for a Scenery Object
Used by the routines at Vector_Main and Screen_DrawColumn.
Input
IX Pointer to scenery item.
Actions_CreateObj 768A LD A,(IX+$02) Get item's bitmap index.
768D LD HL,(ActionsLinkListPtr) Get address of first link in list.
7690 LD BC,$0000 Using BC to check to see if HL == 0.
Search to ned of list / Check to see if action exits.
Actions_CreateObj_0 7693 AND A Check for end of list.
7694 ADC HL,BC
7696 JR Z,Actions_CreateObj_1
7698 LD E,(HL) If not end, get next link.
7699 INC HL
769A LD D,(HL)
769B INC HL
769C CP (HL) If bitmap is already in list, do nothing.
769D RET Z
769E EX DE,HL
769F JR Actions_CreateObj_0
Create a new action using bitmap.
Actions_CreateObj_1 76A1 PUSH IX Remember item's address.
76A3 LD L,(IX+$02) Get item's bitmap index and get the bitmap's width.
76A6 LD H,$00
76A8 ADD HL,HL
76A9 ADD HL,HL
76AA LD DE,BitmapData_Width
76AD ADD HL,DE
76AE LD A,(HL)
76AF LD L,(IX+$01) Get item's secondary position. (Adding 1 if width is odd).
76B2 LD H,$00
76B4 RRCA
76B5 ADC HL,HL
76B7 EX DE,HL
76B8 LD L,(IX+$00)
76BB LD H,$00 Get item's primary position. (Adding 1 if width is odd).
76BD RLCA
76BE ADC HL,HL
76C0 LD A,(IX+$02) Get bitmap index again.
76C3 PUSH AF Create an empty link and add to list. IX = address.
76C4 PUSH DE
76C5 PUSH HL
76C6 CALL Actions_NewLink
76C9 POP HL Store item's primary position. (True value)
76CA LD (IX+$05),L
76CD LD (IX+$06),H
76D0 POP DE Store item's secondary position. (True value)
76D1 LD (IX+$07),E
76D4 LD (IX+$08),D
76D7 POP AF Store item's bitmap index.
76D8 LD (IX+$02),A
76DB LD (IX+$0B),A
76DE LD HL,Actions_Data Search through the action data and find the related function address. This is the function called when the action is triggered.
76E1 LD A,(IX+$02)
Actions_CreateObj_2 76E4 CPI
76E6 JR Z,Actions_CreateObj_3
76E8 INC HL
76E9 INC HL
76EA JR Actions_CreateObj_2
Actions_CreateObj_3 76EC LD A,(HL) Store function pointer.
76ED INC HL
76EE LD (IX+$03),A
76F1 LD A,(HL)
76F2 LD (IX+$04),A
76F5 POP IX Restore item's address and return.
76F7 RET
Prev: 7663 Up: Map Next: 76F8