Prev: 45598 Up: Map Next: 45738
45656: Process Special Entity Flags
Used by the routine at GameStart.
Process Special Entity Flags walking the entity tables at StateData_SimpleEntities / StateData_Boney.
Process_Special_Entity_Flags 45656 LD HL,29363 Point HL at the game event flags (GameEventFlags).
45659 BIT 0,(HL) Is "room / script event raised" (bit 0 of GameEventFlags) set? If not, return.
45661 RET Z
45662 RES 0,(HL) Clear "room / script event raised" (bit 0 of GameEventFlags).
45664 LD DE,14 Each entity record is 0014 bytes long, then load that length into DE.
45667 LD IX,36585 Point IX at Boney's complex entity state (StateData_Boney).
Scan special-flag entities: raise them while y < 40, else deactivate, or try an entity-slot update.
Process_Special_Entity_Flags_Scan 45671 LD A,(IX+0) Fetch the current entity's type for the type test.
45674 CP 50 Is the current entity's entity type equal to 50? If so, return.
45676 RET Z
45677 BIT 5,(IX+2) Is bit 5 of the current entity's flags byte 2 set? If not, jump to Process_Special_Entity_Flags_TryUpdateSlot.
45681 JR Z,Process_Special_Entity_Flags_TryUpdateSlot
45683 LD A,(IX+5) Load A with the current entity's y-coordinate.
45686 CP 40 Is the current entity's y-coordinate less than 40? If so, jump to Process_Special_Entity_Flags_RaiseY.
45688 JR C,Process_Special_Entity_Flags_RaiseY
45690 LD (IX+0),0 Write 0 to the current entity's entity type.
45694 RES 7,(IX+1) Reset bit 7 of the current entity's flags byte 1.
45698 RES 5,(IX+2) Reset bit 5 of the current entity's flags byte 2.
45702 JR Process_Special_Entity_Flags_Branch Jump to Process_Special_Entity_Flags_Branch to finish this special-flag entity.
Raise the special-flag entity two characters and keep the room/script event latched.
Process_Special_Entity_Flags_RaiseY 45704 INC (IX+5) Move this entity two characters down.
45707 INC (IX+6)
45710 INC (IX+5)
45713 INC (IX+6)
45716 SET 0,(HL) Set "room / script event raised" (bit 0 of GameEventFlags).
45718 JR Process_Special_Entity_Flags_Branch Jump to Process_Special_Entity_Flags_Branch to finish this special-flag entity.
When bit 7 is set, call Update_Entity_Slot to update the entity slot (once or twice).
Process_Special_Entity_Flags_TryUpdateSlot 45720 BIT 7,(IX+1) Is bit 7 of the current entity's flags byte 1 set? If not, jump to Process_Special_Entity_Flags_Branch.
45724 JR Z,Process_Special_Entity_Flags_Branch
45726 CALL Update_Entity_Slot Call Update_Entity_Slot to update Entity Slot? If so, jump to Process_Special_Entity_Flags_Branch.
45729 JR C,Process_Special_Entity_Flags_Branch
45731 CALL Update_Entity_Slot Call Update_Entity_Slot to update Entity Slot.
Advance to the next entity and continue the special-flag scan.
Process_Special_Entity_Flags_Branch 45734 ADD IX,DE Advance IX to the next entity record.
45736 JR Process_Special_Entity_Flags_Scan Jump to Process_Special_Entity_Flags_Scan to advance to the next special-flag entity.
Prev: 45598 Up: Map Next: 45738