From: Lukas Krickl Date: Sun, 20 Jul 2025 06:30:44 +0000 (+0200) Subject: game speed: speed is now based on a global setting X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=dcf4fdbe8f2f4e4e6839a101d9116cae395b7360;p=gbrg%2F.git game speed: speed is now based on a global setting 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. --- diff --git a/src/defs.s b/src/defs.s index dfad1ce..95c8f4c 100644 --- a/src/defs.s +++ b/src/defs.s @@ -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 diff --git a/src/mem.s b/src/mem.s index e48a7e5..cd99e3e 100644 --- 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 diff --git a/src/stats.s b/src/stats.s index 965e78f..4d6aa2b 100644 --- a/src/stats.s +++ b/src/stats.s @@ -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 diff --git a/src/wram.s b/src/wram.s index 56fce98..e95af00 100644 --- a/src/wram.s +++ b/src/wram.s @@ -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