| Prev: 706C | Up: Map | Next: 7104 |
708E: Main viewport slot processing loop.
|
Used by the routines at play, main_loop, overview, operate_ship_or_helicopter_continue, operate_fighter_continue, operate_tank_shell_explosion, handle_inactive_object, animate_object, animate_helicopter, operate_tank, operate_tank_on_bank, cancel_and_remove_shell, handle_tank_at_boundary, operate_fuel, reverse_enemy_direction, remove_object_from_viewport, operate_balloon, jp_operate_viewport_slots and reverse_balloon_direction.
|
||||
|
Iterates through the viewport_slots array (viewport_slots), processing each active object. Each slot is a 3-byte structure: [X position, Y position, object definition byte].
The routine performs the following steps for each object:
1. Skip empty slots (SET_MARKER_EMPTY_SLOT) and reset to the beginning when reaching the end marker (SET_MARKER_END_OF_SET).
2. Advance the object's Y position (move it down the screen).
3. Remove objects that have moved beyond the viewport boundary (VIEWPORT_HEIGHT).
4. Render missiles for advanced helicopters (OBJECT_HELICOPTER_ADV).
5. Skip further processing if in GAMEPLAY_MODE_SCROLL_IN.
6. Activate objects on their first frame using an interrupt counter and activation mask (sets bit 7 of the OBJECT_DEFINITION byte).
7. Dispatch to type-specific handlers based on object type: OBJECT_FIGHTER, OBJECT_BALLOON, OBJECT_FUEL, OBJECT_TANK, or ships/helicopters (other types).
|
||||
| operate_viewport_slots | 708E | LD A,$00 | Reset state_collision_mode to COLLISION_MODE_NONE. | |
| 7090 | LD ($5EF5),A | |||
| 7093 | LD HL,($5F60) | Load slot [X, Y, definition] into C, B, D; advance current_slot_ptr to next slot. | ||
| 7096 | LD C,(HL) | |||
| 7097 | INC HL | |||
| 7098 | LD B,(HL) | |||
| 7099 | INC HL | |||
| 709A | LD D,(HL) | |||
| 709B | INC HL | |||
| 709C | LD ($5F60),HL | |||
| 709F | LD A,C | Skip empty slots; reset to beginning on end-of-set marker. | ||
| 70A0 | CP $00 | |||
| 70A2 | JP Z,operate_viewport_slots | |||
| 70A5 | CP $FF | |||
| 70A7 | JP Z,reset_slot_ptr | |||
| 70AA | CALL advance_object | Advance object Y position and write back to slot. | ||
| 70AD | DEC HL | |||
| 70AE | DEC HL | |||
| 70AF | LD (HL),B | |||
| 70B0 | LD A,B | If object moved beyond viewport boundary, remove it. | ||
| 70B1 | AND $88 | |||
| 70B3 | CP $88 | |||
| 70B5 | JP Z,remove_object_from_viewport | |||
| 70B8 | LD A,D | If advanced helicopter, render its missile. | ||
| 70B9 | AND $07 | |||
| 70BB | CP $03 | |||
| 70BD | PUSH DE | |||
| 70BE | PUSH HL | |||
| 70BF | PUSH BC | |||
| 70C0 | CALL Z,render_helicopter_missile | |||
| 70C3 | POP BC | |||
| 70C4 | POP HL | |||
| 70C5 | POP DE | |||
| 70C6 | LD A,($5F68) | Skip further processing during GAMEPLAY_MODE_SCROLL_IN. | ||
| 70C9 | CP $01 | |||
| 70CB | JP Z,operate_viewport_slots | |||
| 70CE | BIT 7,D | If already activated (bit 7 set), skip to type dispatch. | ||
| 70D0 | JP NZ,dispatch_object_type | |||
| 70D3 | LD A,($5F5F) | Check if interrupt counter matches activation interval; skip to handle_inactive_object if not time yet. | ||
| 70D6 | LD E,A | |||
| 70D7 | LD A,($5C78) | |||
| 70DA | AND E | |||
| 70DB | CP $00 | |||
| 70DD | JP NZ,handle_inactive_object | |||
| 70E0 | SET 7,D | Mark object as activated (set bit 7) and increment interrupt counter. | ||
| 70E2 | INC HL | |||
| 70E3 | LD (HL),D | |||
| 70E4 | LD HL,$5C78 | |||
| 70E7 | INC (HL) | |||
| dispatch_object_type | 70E8 | LD A,D | Dispatch by object type (bits 0-2). | |
| 70E9 | AND $07 | |||
| 70EB | CP $05 | |||
| 70ED | JP Z,operate_fighter | |||
| 70F0 | CP $06 | |||
| 70F2 | JP Z,operate_balloon | |||
| 70F5 | CP $07 | |||
| 70F7 | JP Z,operate_fuel | |||
| 70FA | CP $04 | |||
| 70FC | JP Z,operate_tank | |||
| 70FF | CP $00 | |||
| 7101 | JP Z,operate_tank_shell_explosion | |||
| Prev: 706C | Up: Map | Next: 7104 |