hard mode: Hard mode selector now works
authorLukas Krickl <lukas@krickl.dev>
Sat, 25 Oct 2025 03:33:41 +0000 (05:33 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 25 Oct 2025 03:33:41 +0000 (05:33 +0200)
src/mainmenu.s
src/player.s
src/update.s

index 27a7c3c71f396371d9196508708abd88492bfd5a..9919e9b01df9cde8660d885169a69722b6716ddb 100644 (file)
@@ -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
index 31325b0b3d750b4f6e6b1619d6509893e708673c..52a41e27823fb485bebf689fdec352f0d4322ab8 100644 (file)
@@ -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
index 3f5e5cb0436393bdf1f0853bb3a5ebbc6b10a717..01044c793cfdd24f00fdb11e75c646b6de9fa135 100644 (file)
@@ -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