projects
/
gbrg
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d1040c4
)
defs: removed some magic numbers from scroll center
author
Lukas Krickl
<lukas@krickl.dev>
Fri, 20 Jun 2025 19:15:31 +0000
(21:15 +0200)
committer
Lukas Krickl
<lukas@krickl.dev>
Fri, 20 Jun 2025 19:15:31 +0000
(21:15 +0200)
src/defs.s
patch
|
blob
|
history
src/unit.s
patch
|
blob
|
history
diff --git
a/src/defs.s
b/src/defs.s
index 815673991cc6ad6fc56cdf9e45da521b361c8e2d..22d281c67192dce2b795405d777d0b688a2e4544 100644
(file)
--- a/
src/defs.s
+++ b/
src/defs.s
@@
-19,6
+19,9
@@
#define MAP_H 24
#define MAP_SIZE (MAP_W * MAP_H)
+#define VIEW_PORT_TILES_W 12
+#define VIEW_PORT_TILES_H 10
+
; seed for the rng
; 8 bit signed int
#define RAND_MAGIC 0x1B
diff --git
a/src/unit.s
b/src/unit.s
index a04511cbdd088a93b5f99ac189bf47dc117be540..b51c747fdd5bd5596bfab3a21cd474f948879ff9 100644
(file)
--- a/
src/unit.s
+++ b/
src/unit.s
@@
-380,7
+380,7
@@
unit_scroll_center:
ld a, 0x07
@not_min_y:
; adjust scroll
- sub a, (MAP_H -
10
) / 2
+ sub a, (MAP_H -
VIEW_PORT_TILES_H
) / 2
mul8 a
ld [scroll_y], a
@@
-399,7
+399,7
@@
unit_scroll_center:
ld a, 0x0A
@not_min_x:
- sub a, (MAP_W -
12
) / 2
+ sub a, (MAP_W -
VIEW_PORT_TILES_W
) / 2
mul8 a
ld [scroll_x], a