![]() |
Routines |
| Prev: 52163 | Up: Map | Next: 52307 |
|
Tick the task-four offer-item timer that gates its dialogue.
|
||||||||
| ScriptRoutine_TaskFourTickOfferItem | 52174 | LD A,(29378) | Load the shared tick (SharedTick) into A. | |||||
| 52177 | OR A | Is the shared tick (SharedTick) zero? If not, jump to ScriptRoutine_TaskFourTickOfferItem_TickAndOfferItem. | ||||||
| 52178 | JR NZ,ScriptRoutine_TaskFourTickOfferItem_TickAndOfferItem | |||||||
| 52180 | RES 2,(IX+13) | Reset bit 2 of the current entity's extra state. | ||||||
| 52184 | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
|
Tick SharedTick, flash layout GraphicLayout_Vat_Pouring on the creature, and test whether the offered item is hit.
|
||||||||
| ScriptRoutine_TaskFourTickOfferItem_TickAndOfferItem | 52187 | DEC A | Step the shared tick back by one. | |||||
| 52188 | LD (29378),A | Store the shared tick (SharedTick). | ||||||
| 52191 | LD IY,36977 | Point IY at the vat entity at StateData_Complex_28. | ||||||
| 52195 | LD BC,41318 | Point BC at graphic layout GraphicLayout_Vat_Pouring. | ||||||
| 52198 | LD (36987),BC | Store BC in the inactive complex-entity slot fields at 36987. | ||||||
| 52202 | SET 3,(IX+13) | Set bit 3 of the current entity's extra state. | ||||||
| 52206 | LD A,(IY+8) | Load A with the referenced entity's x-extent. | ||||||
| 52209 | INC A | Advance referenced entity's x-extent by one. | ||||||
| 52210 | LD C,(IY+4) | Load C with the referenced entity's room index. | ||||||
| 52213 | LD IY,36879 | Point IY at the task-item entity (StateData_Complex_21). | ||||||
| 52217 | CP (IY+7) | Does this entity's x match the referenced entity's x (IY+7)? If so, jump to ScriptRoutine_TaskFourTickOfferItem_HitItemAdvanceAnim. | ||||||
| 52220 | JP Z,ScriptRoutine_TaskFourTickOfferItem_HitItemAdvanceAnim | |||||||
|
Missed the offered item: set interaction bit 2 of EntityInteractionFlag and clear the offer latch.
|
||||||||
| ScriptRoutine_TaskFourTickOfferItem_MissItemSetFlags | 52223 | LD A,(29369) | Load A with the entity interaction flag (EntityInteractionFlag). | |||||
| 52226 | SET 2,A | Set bit 2 of EntityInteractionFlag. | ||||||
| 52228 | LD (29369),A | Set the entity interaction flag (EntityInteractionFlag). | ||||||
| 52231 | SET 4,(IX+13) | Set bit 4 of the current entity's extra state. | ||||||
| 52235 | RES 2,(IX+13) | Reset bit 2 of the current entity's extra state. | ||||||
| 52239 | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
|
Hit the offered item: play the vat cue, clear the miss flag, and advance its layout animation.
|
||||||||
| ScriptRoutine_TaskFourTickOfferItem_HitItemAdvanceAnim | 52242 | LD A,C | Copy the saved count/flag from C into A. | |||||
| 52243 | CP (IY+4) | Does this entity share the referenced entity's room (IY+4)? If not, jump to ScriptRoutine_TaskFourTickOfferItem_MissItemSetFlags. | ||||||
| 52246 | JR NZ,ScriptRoutine_TaskFourTickOfferItem_MissItemSetFlags | |||||||
|
|
||||||||
| 52248 | LD A,145 | Load A with 145. | ||||||
| 52250 | CALL Queue_Sound | Call Queue_Sound to queue a sound effect. | ||||||
| 52253 | LD (IY+2),128 | Write 128 to the referenced entity's flags byte 2. | ||||||
| 52257 | LD A,(29369) | Load A with the entity interaction flag (EntityInteractionFlag). | ||||||
| 52260 | RES 2,A | Clear bit 2 of the flag byte in A. | ||||||
| 52262 | LD (29369),A | Set the entity interaction flag (EntityInteractionFlag). | ||||||
| 52265 | LD A,(29377) | Load A with the animation frame counter (AnimationFrameCounter). | ||||||
| 52268 | INC A | Advance animation frame counter by one. | ||||||
| 52269 | LD (29377),A | Set the animation frame counter (AnimationFrameCounter). | ||||||
| 52272 | LD A,(IY+9) | Load A with the referenced entity's direction / state. | ||||||
| 52275 | INC A | Advance referenced entity's direction / state by one. | ||||||
| 52276 | LD (IY+9),A | Set the referenced entity's direction / state. | ||||||
| 52279 | PUSH HL | Stash HL on the stack. | ||||||
| 52280 | LD HL,52299 | Point HL at task-four script data 52299. | ||||||
| 52283 | ADD A,A | Double A to form a word index into the script/handler table. | ||||||
| 52284 | LD C,A | Keep the index in C. | ||||||
| 52285 | LD B,0 | Clear B so BC is the word index into 52299. | ||||||
| 52287 | ADD HL,BC | Add the length/offset in BC to the pointer in HL. | ||||||
| 52288 | LD C,(HL) | Fetch the new script address into BC. | ||||||
| 52289 | INC HL | |||||||
| 52290 | LD B,(HL) | |||||||
| 52291 | POP HL | Restore HL from the stack. | ||||||
| 52292 | LD (36889),BC | Store BC in the task-item entity's layout field (36889). | ||||||
| 52296 | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
| 52299 | LD D,C | Copy referenced entity's direction / state into D. | ||||||
| 52300 | AND B | Mask referenced entity's direction / state with B. | ||||||
| 52301 | LD C,E | Copy the low byte from E into C (build a count/address). | ||||||
| 52302 | AND B | Mask referenced entity's direction / state with B. | ||||||
| 52303 | LD B,L | Copy the low byte from L into B (build a count/address). | ||||||
| 52304 | AND B | Mask referenced entity's direction / state with B. | ||||||
| 52305 | CCF | Invert the success marker. | ||||||
| 52306 | AND B | Mask referenced entity's direction / state with B. | ||||||
| Prev: 52163 | Up: Map | Next: 52307 |