mirror of https://git.sr.ht/~kikoodx/momento
add 'restrict' were it makes sense
This commit is contained in:
parent
88b1ac790a
commit
ab8c3bc611
|
@ -12,4 +12,4 @@ struct Input {
|
|||
};
|
||||
|
||||
struct Input input_init(void);
|
||||
void input_update(struct Input *input);
|
||||
void input_update(struct Input *restrict input);
|
||||
|
|
|
@ -23,6 +23,6 @@ struct LevelSelection {
|
|||
|
||||
struct LevelSelection levelselection_init(void);
|
||||
/* Return 1 if game state should change. */
|
||||
int levelselection_update(struct LevelSelection *levelselection,
|
||||
int levelselection_update(struct LevelSelection *restrict levelselection,
|
||||
struct Input input);
|
||||
void levelselection_draw(struct LevelSelection levelselection);
|
||||
|
|
|
@ -18,5 +18,5 @@ struct MainMenu {
|
|||
|
||||
struct MainMenu mainmenu_init(void);
|
||||
/* Return 1 if game state should change. */
|
||||
int mainmenu_update(struct MainMenu *mainmenu, struct Input input);
|
||||
int mainmenu_update(struct MainMenu *restrict mainmenu, struct Input input);
|
||||
void mainmenu_draw(struct MainMenu mainmenu);
|
||||
|
|
|
@ -10,5 +10,5 @@ struct Pause {
|
|||
|
||||
struct Pause pause_init(void);
|
||||
/* Return 1 if game state should change. */
|
||||
int pause_update(struct Pause *pause, struct Input input);
|
||||
int pause_update(struct Pause *restrict pause, struct Input input);
|
||||
void pause_draw(struct Pause pause);
|
||||
|
|
|
@ -45,7 +45,7 @@ enum { UP_LEFT, UP_RIGHT, DOWN_LEFT, DOWN_RIGHT };
|
|||
struct Player player_init(void);
|
||||
void player_draw(struct Player player);
|
||||
/* return 1 if exit reached, -1 on death/reset and 0 otherwise */
|
||||
int player_update(struct Player *player, struct Input input);
|
||||
int player_update(struct Player *restrict player, struct Input input);
|
||||
void player_collide(Tile collisions[COLLIDE_POINTS], int x, int y, int margin);
|
||||
int player_collide_tile(Tile collisions[COLLIDE_POINTS], int x, int y,
|
||||
Tile tile, int margin, int update);
|
||||
|
|
|
@ -10,5 +10,6 @@ struct TitleScreen {
|
|||
|
||||
struct TitleScreen titlescreen_init(void);
|
||||
/* Return 1 if game state should change. */
|
||||
int titlescreen_update(struct TitleScreen *titlescreen, struct Input input);
|
||||
int titlescreen_update(struct TitleScreen *restrict titlescreen,
|
||||
struct Input input);
|
||||
void titlescreen_draw(struct TitleScreen titlescreen);
|
||||
|
|
|
@ -21,7 +21,7 @@ struct Transition {
|
|||
|
||||
struct Transition transition_init(float speed, color_t color,
|
||||
enum TransitionMode mode);
|
||||
enum TransitionMode transition_update(struct Transition *transition);
|
||||
enum TransitionMode transition_update(struct Transition *restrict transition);
|
||||
void transition_draw(struct Transition transition);
|
||||
void hfade_in(float step, color_t color);
|
||||
void hfade_out(float step, color_t color);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <gint/keyboard.h>
|
||||
|
||||
void
|
||||
input_update(struct Input *input)
|
||||
input_update(struct Input *restrict input)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
/* Return 1 if game state should change. */
|
||||
int
|
||||
levelselection_update(struct LevelSelection *levelselection, struct Input input)
|
||||
levelselection_update(struct LevelSelection *restrict levelselection,
|
||||
struct Input input)
|
||||
{
|
||||
/* decrease selected pack id */
|
||||
if (input.keystates[K_LEFT] == KS_PRESS &&
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
/* Return 1 if game state should change. */
|
||||
int
|
||||
mainmenu_update(struct MainMenu *mainmenu, struct Input input)
|
||||
mainmenu_update(struct MainMenu *restrict mainmenu, struct Input input)
|
||||
{
|
||||
/* decrease selected pack id */
|
||||
if (input.keystates[K_UP] == KS_PRESS ||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
/* Return 1 if game state should change. */
|
||||
int
|
||||
pause_update(struct Pause *pause, struct Input input)
|
||||
pause_update(struct Pause *restrict pause, struct Input input)
|
||||
{
|
||||
if (input.keystates[K_START] == KS_PRESS) {
|
||||
return 1;
|
||||
|
|
|
@ -9,15 +9,16 @@
|
|||
#include "tiles.h"
|
||||
#include "util.h"
|
||||
|
||||
static void player_move(struct Player *player, int x, int y);
|
||||
static void player_set_anim(struct Player *player, enum AnimState new_anim);
|
||||
static void player_move(struct Player *restrict player, int x, int y);
|
||||
static void player_set_anim(struct Player *restrict player,
|
||||
enum AnimState new_anim);
|
||||
|
||||
extern struct Level level;
|
||||
|
||||
/* return -1 on pause, return 1 if exit reached, 2 on death/reset and 0
|
||||
* otherwise */
|
||||
int
|
||||
player_update(struct Player *player, struct Input input)
|
||||
player_update(struct Player *restrict player, struct Input input)
|
||||
{
|
||||
Tile collisions[COLLIDE_POINTS];
|
||||
const int on_ground = player_collide_solid(player->x, player->y + 1);
|
||||
|
@ -194,7 +195,7 @@ player_update(struct Player *player, struct Input input)
|
|||
}
|
||||
|
||||
static void
|
||||
player_move(struct Player *player, int x, int y)
|
||||
player_move(struct Player *restrict player, int x, int y)
|
||||
{
|
||||
const int sign_x = sign(x);
|
||||
const int sign_y = sign(y);
|
||||
|
@ -217,7 +218,7 @@ player_move(struct Player *player, int x, int y)
|
|||
}
|
||||
|
||||
static void
|
||||
player_set_anim(struct Player *player, enum AnimState new_anim)
|
||||
player_set_anim(struct Player *restrict player, enum AnimState new_anim)
|
||||
{
|
||||
player->anim_state = new_anim;
|
||||
switch (new_anim) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
/* Return 1 if game state should change. */
|
||||
int
|
||||
titlescreen_update(struct TitleScreen *titlescreen, struct Input input)
|
||||
titlescreen_update(struct TitleScreen *restrict titlescreen, struct Input input)
|
||||
{
|
||||
if (input.keystates[K_A] == KS_PRESS) {
|
||||
return 1;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "transition.h"
|
||||
|
||||
enum TransitionMode
|
||||
transition_update(struct Transition *transition)
|
||||
transition_update(struct Transition *restrict transition)
|
||||
{
|
||||
enum TransitionMode previous_transition_mode = TransitionNone;
|
||||
|
||||
|
|
Loading…
Reference in New Issue