From 420ac2c8f2307ddcbe551972544bbe11f05ee7ff Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 27 May 2024 19:13:02 +0100 Subject: Avoid function declarator with no prototype errors This is for SDCC 4.4.0 at least. --- game/src/game.c | 12 ++++++------ game/src/game.h | 12 ++++++------ game/src/main.c | 8 ++++---- game/src/main.h | 4 ++-- include/mplayer.h | 4 ++-- include/spman.h | 8 ++++---- include/ubox.h | 14 +++++++------- src/spman/spman.c | 8 ++++---- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/game/src/game.c b/game/src/game.c index 2fea5a3..3f91e23 100644 --- a/game/src/game.c +++ b/game/src/game.c @@ -19,7 +19,7 @@ #define BG_TILE_MAP 0x1800 -void init_map_entities() +void init_map_entities(void) { const uint8_t *m = cur_map; uint8_t typ, last = 0; @@ -83,7 +83,7 @@ void init_map_entities() } -void draw_map() +void draw_map(void) { // draw the map! // @@ -96,7 +96,7 @@ void draw_map() ubox_write_vm((uint8_t *)BG_TILE_MAP, MAP_W * MAP_H, cur_map_data); } -void draw_hud() +void draw_hud(void) { uint8_t i; @@ -189,7 +189,7 @@ uint8_t is_map_elevator_up(uint8_t x, uint8_t y) return (t == 14 || t == 15); } -void update_enemy() +void update_enemy(void) { // check for the player; if alive and not invulnerable! // we use small hit boxes @@ -253,7 +253,7 @@ void update_enemy() spman_alloc_sprite(&sp); } -void update_player() +void update_player(void) { // to know if we need to update the walk animation uint8_t moved = 0; @@ -371,7 +371,7 @@ void update_player() spman_alloc_fixed_sprite(&sp); } -void run_game() +void run_game(void) { uint8_t i; diff --git a/game/src/game.h b/game/src/game.h index 5f5d603..1354522 100644 --- a/game/src/game.h +++ b/game/src/game.h @@ -80,16 +80,16 @@ struct entity uint8_t flags; uint8_t delay; uint8_t frame; - void (*update)(); + void (*update)(void); }; -void run_game(); +void run_game(void); -void update_player(); -void update_enemy(); +void update_player(void); +void update_enemy(void); -void draw_map(); -void draw_hud(); +void draw_map(void); +void draw_hud(void); void erase_battery(uint8_t x, uint8_t y); diff --git a/game/src/main.c b/game/src/main.c index c95fcc8..577fd5c 100644 --- a/game/src/main.c +++ b/game/src/main.c @@ -12,7 +12,7 @@ // generated #include "tiles.h" -void draw_menu() +void draw_menu(void) { uint8_t i; @@ -39,7 +39,7 @@ void draw_menu() ubox_enable_screen(); } -void draw_end_game() +void draw_end_game(void) { ubox_disable_screen(); @@ -63,7 +63,7 @@ void draw_end_game() } } -void draw_game_over() +void draw_game_over(void) { ubox_disable_screen(); @@ -78,7 +78,7 @@ void draw_game_over() ubox_wait_for(128); } -void main() +void main(void) { // PAL: 50/2 = 25 FPS // NTSC: 60/2 = 30 FPS diff --git a/game/src/main.h b/game/src/main.h index 9f7b628..606a07c 100644 --- a/game/src/main.h +++ b/game/src/main.h @@ -33,8 +33,8 @@ enum effects EFX_DEAD, }; -void draw_end_game(); -void draw_menu(); +void draw_end_game(void); +void draw_menu(void); // store the selected control LOCAL uint8_t ctl; diff --git a/include/mplayer.h b/include/mplayer.h index 139dd9e..c13ac56 100644 --- a/include/mplayer.h +++ b/include/mplayer.h @@ -92,14 +92,14 @@ void mplayer_init_effects(const uint8_t *effects) __z88dk_fastcall; * If the player is stopped, [mplayer_stop](#mplayer_stop) must be called to * silence the PSG. */ -void mplayer_play(); +void mplayer_play(void); /** * Silences the PSG, stopping any sound. * * This doesn't stop the player if [mplayer_play](#mplayer_play) is called. */ -void mplayer_stop(); +void mplayer_stop(void); // @Sound effects diff --git a/include/spman.h b/include/spman.h index e8e27af..fa2a5c9 100644 --- a/include/spman.h +++ b/include/spman.h @@ -37,7 +37,7 @@ * * it needs to be called before using any of the functions of the sprite manager. */ -void spman_init(); +void spman_init(void); /** * Allocates a pattern for sprite `type` using `data`. @@ -121,7 +121,7 @@ void spman_alloc_sprite(const struct sprite_attr *sp); * * This doesn't affect sprites currently being shown on the screen. */ -void spman_sprite_flush(); +void spman_sprite_flush(void); // @Sprites on screen @@ -136,7 +136,7 @@ void spman_sprite_flush(); * [spman_alloc_sprite](#spman_alloc_sprite). * */ -void spman_update(); +void spman_update(void); /** * Hides all the sprites currently shown on screen. @@ -144,6 +144,6 @@ void spman_update(); * This doesn't affect any allocated sprites. To free allocated sprites use * [spman_sprite_flush](#spman_sprite_flush). */ -void spman_hide_all_sprites(); +void spman_hide_all_sprites(void); #endif // _SPMAN_H diff --git a/include/ubox.h b/include/ubox.h index b045d4d..fa56741 100644 --- a/include/ubox.h +++ b/include/ubox.h @@ -69,7 +69,7 @@ void ubox_set_mode(uint8_t mode) __z88dk_fastcall; /** * Enables the screen. */ -void ubox_enable_screen(); +void ubox_enable_screen(void); /** * Disables the screen. @@ -79,7 +79,7 @@ void ubox_enable_screen(); * * Note that [ubox_set_mode](#ubox_set_mode) also enables the screen. */ -void ubox_disable_screen(); +void ubox_disable_screen(void); /** * Changes the screen colors. @@ -158,7 +158,7 @@ void ubox_wvdp(uint8_t reg, uint8_t data); * | 0 | 60Hz | * | 1 | 50Hz | */ -uint8_t ubox_get_vsync_freq(); +uint8_t ubox_get_vsync_freq(void); // *INDENT-OFF* /** @@ -311,7 +311,7 @@ void ubox_init_isr(uint8_t wait_ticks) __z88dk_fastcall; * ubox_set_user_isr(my_isr); * ``` */ -void ubox_set_user_isr(void (*fn)()) __z88dk_fastcall; +void ubox_set_user_isr(void (*fn)(void)) __z88dk_fastcall; /** * Waits for a maximum `wait_ticks` interrupts (see [ubox_init_isr](#ubox_init_isr)). @@ -347,7 +347,7 @@ void ubox_set_user_isr(void (*fn)()) __z88dk_fastcall; * } * ``` */ -void ubox_wait(); +void ubox_wait(void); /** * Waits for `frames` frames. @@ -373,7 +373,7 @@ extern uint8_t ubox_tick; * * `ubox_tick` is a 8-bit global variable that is incremented on every interrupt. */ -void ubox_reset_tick(); +void ubox_reset_tick(void); // @Sprite functions // @@ -486,7 +486,7 @@ void ubox_set_sprite_pat16_flip(const uint8_t *data, uint8_t pattern); * * See [ubox_read_ctl](#ubox_read_ctl) for possible control values. */ -uint8_t ubox_select_ctl(); +uint8_t ubox_select_ctl(void); /** * Read the control identified by `control` and return the status of it. diff --git a/src/spman/spman.c b/src/spman/spman.c index ba8a939..8bb8ba1 100644 --- a/src/spman/spman.c +++ b/src/spman/spman.c @@ -15,7 +15,7 @@ struct sprite_attr sp_buffer[SPMAN_MAX_SPRITES * 2]; uint8_t sp_pat_map[SPMAN_MAX_PATTERNS]; uint8_t sp_last_pat; -void spman_init() +void spman_init(void) { sp_last_pat = 0; sp_idx = 0; @@ -49,7 +49,7 @@ uint8_t spman_alloc_pat(uint8_t type, uint8_t *data, uint8_t len, uint8_t flip) return sp_pat_map[type] * 4; } -void spman_sprite_flush() +void spman_sprite_flush(void) { sp_last_fixed_sprite = 0; sp_last_sprite = 0; @@ -83,7 +83,7 @@ static const struct sprite_attr hide = { 208, 0, 0, 0 }; static uint8_t *p; -void spman_update() +void spman_update(void) { p = (uint8_t*)SPMAN_SPR_ATTRS; @@ -113,7 +113,7 @@ void spman_update() spman_sprite_flush(); } -void spman_hide_all_sprites() +void spman_hide_all_sprites(void) { ubox_wait_vsync(); ubox_write_vm((uint8_t *)SPMAN_SPR_ATTRS, 4, (uint8_t *)hide); -- cgit v1.2.3