summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-04-24 16:51:08 +0200
committerBad Diode <bd@badd10de.dev>2021-04-24 16:51:08 +0200
commit0f16e5bfb1738330a33b300067f86d363fd250bf (patch)
treef1d07133d39a320fa8b389018814261988d5bf17
parenta910bccb3e2f70865d4a2f4d2991b864a97bebed (diff)
downloadgba-experiments-0f16e5bfb1738330a33b300067f86d363fd250bf.tar.gz
gba-experiments-0f16e5bfb1738330a33b300067f86d363fd250bf.zip
Suppress incompatible-pointer-types warnings
Life is too short to cast all of these.
-rw-r--r--Makefile2
-rw-r--r--src/gba-buttons.c15
-rw-r--r--src/main.c12
3 files changed, 8 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index ae1e158..1979bf8 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ CC := arm-none-eabi-gcc
28OBJCOPY := arm-none-eabi-objcopy 28OBJCOPY := arm-none-eabi-objcopy
29ARCH := -mthumb -mthumb-interwork 29ARCH := -mthumb -mthumb-interwork
30SPECS := -specs=gba.specs 30SPECS := -specs=gba.specs
31CFLAGS := -g -Wall -Wextra -pedantic -fno-strict-aliasing 31CFLAGS := -g -Wall -Wextra -pedantic -fno-strict-aliasing -Wno-incompatible-pointer-types
32CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) 32CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH)
33CFLAGS += -I$(LIBGBA_SRC) 33CFLAGS += -I$(LIBGBA_SRC)
34LDFLAGS := $(ARCH) $(SPECS) 34LDFLAGS := $(ARCH) $(SPECS)
diff --git a/src/gba-buttons.c b/src/gba-buttons.c
index 7f13676..951b4dc 100644
--- a/src/gba-buttons.c
+++ b/src/gba-buttons.c
@@ -140,21 +140,6 @@ typedef struct SpriteAnimation {
140 140
141typedef enum {BTN_STATE_IDLE, BTN_STATE_PRESSED, BTN_STATE_RELEASED, BTN_STATE_HOLD} BtnState; 141typedef enum {BTN_STATE_IDLE, BTN_STATE_PRESSED, BTN_STATE_RELEASED, BTN_STATE_HOLD} BtnState;
142 142
143static size_t btn_state_idle[] = {0};
144// static size_t btn_state_pressed[] = {16, 16, 32, 32, 48, 48, 64, 64, 80, 96};
145static size_t btn_state_pressed[] = {0};
146
147static SpriteAnimation *animation_states[] = {
148 &(SpriteAnimation){
149 .tile_offsets = &btn_state_idle,
150 .n_frames = sizeof(btn_state_idle) / sizeof(size_t),
151 },
152 &(SpriteAnimation){
153 .tile_offsets = &btn_state_pressed,
154 .n_frames = sizeof(btn_state_pressed) / sizeof(size_t),
155 },
156};
157
158typedef struct AnimationEntry { 143typedef struct AnimationEntry {
159 int x_offset; 144 int x_offset;
160 int y_offset; 145 int y_offset;
diff --git a/src/main.c b/src/main.c
index 2876e18..3002f7e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,3 +1,5 @@
1#include <string.h>
2
1#include "shorthand.h" 3#include "shorthand.h"
2#include "bd-font.c" 4#include "bd-font.c"
3#include "gba-buttons.c" 5#include "gba-buttons.c"
@@ -105,10 +107,10 @@ typedef u16 ScreenBlock[1024];
105// FRAMEBUFFER[y][x] = color; 107// FRAMEBUFFER[y][x] = color;
106// 108//
107typedef Color Scanline[SCREEN_WIDTH]; 109typedef Color Scanline[SCREEN_WIDTH];
108#define FRAMEBUFFER ((Scanline*)MEM_VRAM) 110#define FRAMEBUFFER ((Scanline*)MEM_VRAM)
109#define SCREEN_BUFFER ((vu16*) MEM_VRAM) 111#define SCREEN_BUFFER ((u16*) MEM_VRAM)
110#define PAL_BUFFER_BG ((vu16*) MEM_PAL) 112#define PAL_BUFFER_BG ((u16*) MEM_PAL)
111#define PAL_BUFFER_SPRITES ((vu16*) 0x05000200) 113#define PAL_BUFFER_SPRITES ((u16*) 0x05000200)
112 114
113// 115//
114// Colors. 116// Colors.
@@ -534,7 +536,7 @@ typedef struct ButtonSprite {
534typedef struct MultiSprite { 536typedef struct MultiSprite {
535 ObjState *sprites; 537 ObjState *sprites;
536 AnimationEntry **animations; 538 AnimationEntry **animations;
537 int frame; 539 size_t frame;
538 size_t n_obj; 540 size_t n_obj;
539 size_t n_frames; 541 size_t n_frames;
540 BtnState state; 542 BtnState state;