Prev: F0DC Up: Map Next: F13E
F0E3: Script Routine: (0F) Have entity put down carried entity
Make the entity put down whatever it is carrying.
Input
IX Address of complex state data for an entity
ScriptRoutine_PutDownCarried F0E3 CALL Script_PutDown_SetCarryingFlag Call Script_PutDown_SetCarryingFlag to script Put Down Set Carrying Flag.
F0E6 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
This entry point is used by the routine at Update_Berk_ReadControls.
Place the held entity using Berk's Y as the put-down baseline.
ScriptRoutine_PutDownCarried_PlaceHeldFromBerk F0E9 LD C,(IX+$05) Load C with the current entity's y-coordinate.
F0EC LD IY,($72AC) Load IY with the current-entity pointer (Pointer_CurrentEntity).
F0F0 JR ScriptRoutine_PutDownCarried_SaveSizeAndPlaceY Jump to ScriptRoutine_PutDownCarried_SaveSizeAndPlaceY to continue this routine.
Set bit 04 of flags byte 3 and prepare the held entity for put-down.
Script_PutDown_SetCarryingFlag F0F2 SET 4,(IX+$03) Set bit 04 of the current entity's flags byte 3.
F0F6 LD C,(IX+$05) Load C with the current entity's y-coordinate.
F0F9 LD IY,($72AC) Load IY with the current-entity pointer (Pointer_CurrentEntity).
F0FD LD A,(IY+$00) Load A with the referenced entity's entity type.
F100 CP $01 Is A equal to 01? If not, jump to Script_PutDown_Apply.
F102 JR NZ,Script_PutDown_Apply
F104 XOR A Clear A to 00.
F105 LD ($72C7),A Set the Bad Tempered Thing state (BadTemperedThingState).
Reactivate the held entity; if it is type 09, set Slimies in TaskThreeFlags.
Script_PutDown_Apply F108 RES 7,(IY+$00) Reset bit 07 of the referenced entity's entity type.
F10C CP $09 Is A equal to 09? If not, jump to ScriptRoutine_PutDownCarried_SetHeldBit5.
F10E JR NZ,ScriptRoutine_PutDownCarried_SetHeldBit5
F110 LD A,($72B6) Load A with the task-three flags (TaskThreeFlags).
F113 SET 1,A Set Slimies (bit 01 of A. put-down of type 09).
F115 LD ($72B6),A Set the task-three flags (TaskThreeFlags).
Set bit 05 on the held entity before writing its grounded Y.
ScriptRoutine_PutDownCarried_SetHeldBit5 F118 SET 5,(IY+$01) Set bit 05 of the referenced entity's flags byte 1.
Save held width/height into CameraYCoordinate/CameraXCoordinate and park the entity at the put-down Y.
ScriptRoutine_PutDownCarried_SaveSizeAndPlaceY F11C LD A,(IY+$08) Load A with the referenced entity's x-extent.
F11F SUB (IY+$07) Subtract the referenced entity's x-coordinate from A.
F122 LD ($72ED),A Store the held entity's width (x-extent − x) in CameraYCoordinate.
F125 LD A,(IY+$06) Load A with the referenced entity's y-extent.
F128 SUB (IY+$05) Subtract the referenced entity's y-coordinate from A.
F12B LD ($72EE),A Store the held entity's height (y-extent − y) in CameraXCoordinate.
F12E LD B,A Keep a copy of A in B.
F12F SRL A Shift A right logical.
F131 NEG Negate A (flip a delta/direction).
F133 ADD A,C A+=C.
F134 ADD A,$02 A+=02.
F136 LD (IY+$05),A Set the referenced entity's y-coordinate.
F139 ADD A,B A+=B.
F13A LD (IY+$06),A Set the referenced entity's y-extent.
F13D RET Return.
Prev: F0DC Up: Map Next: F13E