game speed: speed is now based on a global setting
authorLukas Krickl <lukas@krickl.dev>
Sun, 20 Jul 2025 06:30:44 +0000 (08:30 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 20 Jul 2025 06:30:44 +0000 (08:30 +0200)
This means all tile moves are the same speed for both player and
enemies. The AI script will determine when to move for enemies later on.
This will allow choosing between a more real time and a more tactical
gameplay style.

src/defs.s
src/mem.s
src/stats.s
src/wram.s

index dfad1ce71cc4fae7b5764d5d9cffb63645819817..95c8f4cefbe83a3f1b62a2d29bec3bdc5e707aa3 100644 (file)
@@ -7,7 +7,14 @@
 #define WRAM 0xC000
 #define WRAMLEN 0xFFF
 
-#define STAT_MAX 100
+#define STAT_MAX 255 
+
+; game speed defs
+#define GAME_SPEED_SLOW 128
+#define GAME_SPEED_NORMAL 235 
+#define GAME_SPEED_FAST 255
+
+#define GAME_SPEED_DEFAULT GAME_SPEED_NORMAL
 
 #define NULL 0
 
index e48a7e5341c832663a676a7e7ae5e378d28c17a5..cd99e3eeda2460697ec574db93b1bb114e7139c8 100644 (file)
--- a/src/mem.s
+++ b/src/mem.s
@@ -33,6 +33,11 @@ mem_init:
   ld bc, st_size
   call memcpy
 
+  
+  ; set up default game speed
+  ld a, GAME_SPEED_DEFAULT
+  ld [game_speed], a
+
   ; load a demo
   ; ld hl, demo_inputs1
   ; call load_demo_ptr
index 965e78f944c1a4aae967fad1df422bf319943a16..4d6aa2bc4311dbdfcd7a3145799731a459bcab32 100644 (file)
@@ -32,7 +32,5 @@ stat_calc_str:
   ; returns:
   ;   a: speed stat
 stat_calc_speed:
-  ld hl, act_dex
-  add hl, de ; hl = speed stat
-  ld a, [hl]
+  ld a, [game_speed] 
   ret
index 56fce98dd6446bd0554494c366e62b988832aa1d..e95af0037030a66fa5b6bac92682d5879b8d55a8 100644 (file)
@@ -93,6 +93,11 @@ state:
   ; seed must never be 0
 srand: .adv 2
 
+  ; game speed variable
+  ; this controls how fast the 
+  ; game runs
+game_speed: .adv 1
+
   ; last d16 result
 d16: .adv 1
 
@@ -101,6 +106,9 @@ d16: .adv 1
 scroll_move_y: .adv 1
 scroll_move_x: .adv 1
 
+  ; the current floor
+floor: .adv 1
+
   ; scroll location
 scroll_y: .adv 1
 scroll_x: .adv 1