Prev: AF7F Up: Map Next: AFB7
AF88: Set up and play
Used by the routine at START.
Builds the lookup tables, shows the menu, and then does the four things that make a game different from the last one: shuffles which objects the wizard will ask for, chooses a starting room, sets the sun and moon running, and places the special objects. Then it falls into player_dies, which brings Sabreman on exactly as it does after a death.
Three of those choices come from the game seed at $5BA0, and two of them from the same two bits of it: bits 0 and 1 pick the starting room in init_start_location and also how far shuffle_objects_required rotates the wizard's list. So on the first game after loading, the starting room tells you the order the cauldron will ask in. The charms' placing adds the refresh register, so that one is not tied.
main AF88 CALL build_lookup_tbls the tables at reverse_bits_tbl -- see build_lookup_tbls
AF8B XOR A no room has been played yet, so the first room entry has nothing to save back
AF8C LD ($5BB2),A
AF8F LD (flags12_1),A clear byte 12 of the player record saved at plyr_spr_1_scratchpad
AF92 LD A,$05 five lives; the first pass through player_dies takes one of them
AF94 LD ($5BBA),A
AF97 LD HL,$5BA0 stir the frame counter into the game seed; it is zero on the first game after loading
AF9A LD A,($5BA2)
AF9D ADD A,(HL)
AF9E LD (HL),A
AF9F CALL clear_scrn clear the screen
AFA2 CALL do_menu_selection the control menu; the seed also goes up by one every time round its loop
AFA5 LD DE,start_game_tune the tune that plays as the game starts
AFA8 CALL play_audio
AFAB CALL shuffle_objects_required rotate the list of objects the cauldron wants
AFAE CALL init_start_location pick one of four starting rooms, and make the player records
AFB1 CALL init_sun the sun starts at the left of its frame
AFB4 CALL init_special_objects deal the charms and extra lives out to their places
Prev: AF7F Up: Map Next: AFB7