Routines |
Prev: 6920 | Up: Map | Next: 69C9 |
"Movable items" are the stove and crate objects which appear in three rooms in the game. Unlike ordinary items such as keys and the radio the movable items can be pushed around (on one axis) by the hero character walking into them. Internally they use the second visible character slot.
Used by the routines at enter_room and reset_outdoors.
|
||||
setup_movable_items | 6939 | CALL reset_nonplayer_visible_characters | Reset all non-player visible characters | |
693C | LD A,($68A0) | Get the global current room index | ||
693F | CP $02 | If current room index is room_2_HUT2LEFT then jump to setup_stove1 | ||
6941 | JP NZ,setup_movable_items_0 | |||
6944 | CALL setup_stove1 | |||
6947 | JR setup_movable_items_2 | |||
setup_movable_items_0 | 6949 | CP $04 | If current room index is room_4_HUT3LEFT then jump to setup_stove2 | |
694B | JP NZ,setup_movable_items_1 | |||
694E | CALL setup_stove2 | |||
6951 | JR setup_movable_items_2 | |||
setup_movable_items_1 | 6953 | CP $09 | If current room index is room_9_CRATE then jump to setup_crate | |
6955 | JP NZ,setup_movable_items_2 | |||
6958 | CALL setup_crate | |||
setup_movable_items_2 | 695B | CALL spawn_characters | Spawn characters | |
695E | CALL mark_nearby_items | Mark nearby items | ||
6961 | CALL animate | Animate all visible characters | ||
6964 | CALL move_map | Move the map | ||
6967 | JP plot_sprites | Plot vischars and items | ||
setup_crate | 696A | LD HL,$69B7 | Point HL at movable_item_crate | |
696D | LD A,$1C | Set A to character index character_28_CRATE | ||
696F | JR setup_movable_item | Jump to setup_movable_item | ||
setup_stove2 | 6971 | LD HL,$69C0 | Point HL at movable_item_stove2 | |
6974 | LD A,$1B | Set A to character index character_27_STOVE_2 | ||
6976 | JR setup_movable_item | Jump to setup_movable_item | ||
setup_stove1 | 6978 | LD HL,$69AE | Point HL at movable_item_stove1 | |
697B | LD A,$1A | Set A to character index character_26_STOVE_1 | ||
Using the movable item specific data and a generic item reset data, setup the second visible character as a movable item.
|
||||
setup_movable_item | 697D | LD ($8020),A | Assign the character index in A to the second visible character's character field | |
6980 | LD BC,$0009 | Copy nine bytes of item-specific movable item data over the second visible character data | ||
6983 | LD DE,$802F | |||
6986 | LDIR | |||
6988 | LD HL,$69A0 | Copy fourteen bytes of visible character data over the vischar | ||
698B | LD DE,$8021 | |||
698E | LD BC,$000E | |||
6991 | LDIR | |||
6993 | LD A,($68A0) | Set the visible character's room index to the global current room index | ||
6996 | LD ($803C),A | |||
6999 | LD HL,$8020 | Point HL at the second visible character | ||
699C | CALL calc_vischar_iso_pos_from_vischar | Set saved_pos | ||
699F | RET | Return | ||
Fourteen bytes of visible character reset data.
|
||||
movable_item_reset_data | 69A0 | DEFB $00 | Flags | |
69A1 | DEFW $0000 | Route | ||
69A3 | DEFB $00,$00,$00 | Position | ||
69A6 | DEFB $00 | Counter and flags | ||
69A7 | DEFW animations | Animation base = &animations[0] | ||
69A9 | DEFW anim_wait_tl | Animation = animations[8] // anim_wait_tl animation | ||
69AB | DEFB $00 | Animation index | ||
69AC | DEFB $00 | Input | ||
69AD | DEFB $00 | Direction | ||
Movable items. struct movable_item { word x_coord, y_coord, height; const sprite *; byte index; };
Sub-struct of vischar ($802F..$8038).
|
||||
movable_item_stove1 | 69AE | DEFW $003E,$0023,$0010 | Position (62, 35, 16) | |
69B4 | DEFW sprite_stove | Sprite: sprite_stove | ||
69B6 | DEFB $00 | Index: 0 | ||
movable_item_crate | 69B7 | DEFW $0037,$0036,$000E | Position (55, 54, 14) | |
69BD | DEFW sprite_crate | Sprite: sprite_crate | ||
69BF | DEFB $00 | Index: 0 | ||
movable_item_stove2 | 69C0 | DEFW $003E,$0023,$0010 | Position (62, 35, 16) | |
69C6 | DEFW sprite_stove | Sprite: sprite_stove | ||
69C8 | DEFB $00 | Index: 0 |
Prev: 6920 | Up: Map | Next: 69C9 |