From 0f16e5bfb1738330a33b300067f86d363fd250bf Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sat, 24 Apr 2021 16:51:08 +0200 Subject: Suppress incompatible-pointer-types warnings Life is too short to cast all of these. --- Makefile | 2 +- src/gba-buttons.c | 15 --------------- src/main.c | 12 +++++++----- 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 OBJCOPY := arm-none-eabi-objcopy ARCH := -mthumb -mthumb-interwork SPECS := -specs=gba.specs -CFLAGS := -g -Wall -Wextra -pedantic -fno-strict-aliasing +CFLAGS := -g -Wall -Wextra -pedantic -fno-strict-aliasing -Wno-incompatible-pointer-types CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) CFLAGS += -I$(LIBGBA_SRC) LDFLAGS := $(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 { typedef enum {BTN_STATE_IDLE, BTN_STATE_PRESSED, BTN_STATE_RELEASED, BTN_STATE_HOLD} BtnState; -static size_t btn_state_idle[] = {0}; -// static size_t btn_state_pressed[] = {16, 16, 32, 32, 48, 48, 64, 64, 80, 96}; -static size_t btn_state_pressed[] = {0}; - -static SpriteAnimation *animation_states[] = { - &(SpriteAnimation){ - .tile_offsets = &btn_state_idle, - .n_frames = sizeof(btn_state_idle) / sizeof(size_t), - }, - &(SpriteAnimation){ - .tile_offsets = &btn_state_pressed, - .n_frames = sizeof(btn_state_pressed) / sizeof(size_t), - }, -}; - typedef struct AnimationEntry { int x_offset; 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 @@ +#include + #include "shorthand.h" #include "bd-font.c" #include "gba-buttons.c" @@ -105,10 +107,10 @@ typedef u16 ScreenBlock[1024]; // FRAMEBUFFER[y][x] = color; // typedef Color Scanline[SCREEN_WIDTH]; -#define FRAMEBUFFER ((Scanline*)MEM_VRAM) -#define SCREEN_BUFFER ((vu16*) MEM_VRAM) -#define PAL_BUFFER_BG ((vu16*) MEM_PAL) -#define PAL_BUFFER_SPRITES ((vu16*) 0x05000200) +#define FRAMEBUFFER ((Scanline*)MEM_VRAM) +#define SCREEN_BUFFER ((u16*) MEM_VRAM) +#define PAL_BUFFER_BG ((u16*) MEM_PAL) +#define PAL_BUFFER_SPRITES ((u16*) 0x05000200) // // Colors. @@ -534,7 +536,7 @@ typedef struct ButtonSprite { typedef struct MultiSprite { ObjState *sprites; AnimationEntry **animations; - int frame; + size_t frame; size_t n_obj; size_t n_frames; BtnState state; -- cgit v1.2.1