From 638dbd0af112aa730c04af776fbd15dffee43337 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Wed, 30 Mar 2022 08:23:15 +0200 Subject: Rename MAP_{X|Y} to MAP_{W|H} --- src/camera/src/camera.c | 8 ++++---- src/camera/src/pad.c | 4 ++-- src/terrain/inc/terrain.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/camera/src/camera.c b/src/camera/src/camera.c index 4cc164c..0b96629 100644 --- a/src/camera/src/camera.c +++ b/src/camera/src/camera.c @@ -78,8 +78,8 @@ void camera_update_pos(struct camera *const cam) if (cam->x > 0) cam->x = 0; - else if (cam->x < -MAP_X) - cam->x = -MAP_X; + else if (cam->x < -MAP_W) + cam->x = -MAP_W; const int y = cam->y + cam->y_speed; @@ -87,8 +87,8 @@ void camera_update_pos(struct camera *const cam) if (cam->y > 0) cam->y = 0; - else if (cam->y < -MAP_Y) - cam->y = -MAP_Y; + else if (cam->y < -MAP_H) + cam->y = -MAP_H; } bool camera_translate(const struct camera *const cam, const struct util_rect *const dim, diff --git a/src/camera/src/pad.c b/src/camera/src/pad.c index b445e53..79c05ff 100644 --- a/src/camera/src/pad.c +++ b/src/camera/src/pad.c @@ -20,7 +20,7 @@ static void cursor_update(struct camera *const cam, const struct pad *const p) c->x -= STEP; else if (pad_pressed(p, PAD_KEY_RIGHT) && (c->x + STEP < screen_w) - && (c->x != c->x_init || cam->x <= -MAP_X)) + && (c->x != c->x_init || cam->x <= -MAP_W)) c->x += STEP; if (pad_pressed(p, PAD_KEY_UP) @@ -29,7 +29,7 @@ static void cursor_update(struct camera *const cam, const struct pad *const p) c->y -= STEP; else if (pad_pressed(p, PAD_KEY_DOWN) && (c->y + STEP < screen_h) - && (c->y != c->y_init || cam->y <= -MAP_Y)) + && (c->y != c->y_init || cam->y <= -MAP_H)) c->y += STEP; c->state = pad_pressed(p, PAD_KEY_A) || pad_pressed(p, PAD_KEY_B) ? diff --git a/src/terrain/inc/terrain.h b/src/terrain/inc/terrain.h index d5f4e12..508fe25 100644 --- a/src/terrain/inc/terrain.h +++ b/src/terrain/inc/terrain.h @@ -14,8 +14,8 @@ enum { MAP_TILES = 64, TERRAIN_SZ = 32, - MAP_X = MAP_TILES * TERRAIN_SZ, - MAP_Y = MAP_TILES * TERRAIN_SZ + MAP_W = MAP_TILES * TERRAIN_SZ, + MAP_H = MAP_TILES * TERRAIN_SZ }; enum terrain_type -- cgit v1.2.3