From: Lukas Krickl Date: Sat, 25 Oct 2025 03:33:41 +0000 (+0200) Subject: hard mode: Hard mode selector now works X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=896c9d91541f2dbc4fd0574b05836470f2b53a7b;p=gbrg%2F.git hard mode: Hard mode selector now works --- diff --git a/src/mainmenu.s b/src/mainmenu.s index 27a7c3c..9919e9b 100644 --- a/src/mainmenu.s +++ b/src/mainmenu.s @@ -1,10 +1,23 @@ ; map routine that loads l1 map_r_load_l1: + ld a, [player+act_pos_y] cp a, 5 ret nc + ; if the player is on the right side of the map + ; load hard mode + ld a, [player+act_pos_x] + cp a, 0x5F + jr c, @no_hard REL + ld a, [game_flags] + or a, GPF_HARD_MODE + ld [game_flags], a +@no_hard: + + call player_init + ld de, l1_map call map_load ret diff --git a/src/player.s b/src/player.s index 31325b0..52a41e2 100644 --- a/src/player.s +++ b/src/player.s @@ -1,6 +1,12 @@ #define PLAYER_SPEED 0xE0 #define ARROW_TILE 0x86 #define PLAYER_WALKING_TILE 0x8E + + ; inits hard mode +player_init_hard_mode: + ld a, 1 + ld [player_hp_max], a + ret ; sets up the player actor player_init: @@ -15,6 +21,11 @@ player_init: ld a, [player_hp_max] ld [player+act_hp], a + + + ld a, [game_flags] + and a, GPF_HARD_MODE + call nz, player_init_hard_mode ret ; updates the special player actor diff --git a/src/update.s b/src/update.s index 3f5e5cb..01044c7 100644 --- a/src/update.s +++ b/src/update.s @@ -42,20 +42,10 @@ update_anim_timer: ld [animation_frame], a ret - ; sets up hard mode values -init_hard_mode: - ld a, 1 - ld [player_hp_max], a - ret - new_game: ld a, HP_MAX ld [player_hp_max], a - ld a, [game_flags] - and a, GPF_HARD_MODE - call nz, init_hard_mode - ld de, l_main_menu call map_load