diff --git a/magic/src/fretwork.c b/magic/src/fretwork.c index 553bd904f..4b2231520 100644 --- a/magic/src/fretwork.c +++ b/magic/src/fretwork.c @@ -70,7 +70,8 @@ void fretwork_release(magic_api * api, int which, void fretwork_shutdown(magic_api * api); void fretwork_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot); void fretwork_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot); -inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x, int * y); +#define POINT_TYPE typeof(((SDL_Rect *)NULL)->x) +inline void fretwork_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y); void fretwork_click(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect); @@ -278,7 +279,7 @@ inline unsigned int fretwork_get_segment(int x, int y) return (yy - 1) * fretwork_segments_x + xx; } -inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x, int * y) +inline void fretwork_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y) { *x = ((segment % fretwork_segments_x) - 1) * img_w; //useful to set update_rect as small as possible *y = (int)(segment / fretwork_segments_x) * img_h; @@ -288,7 +289,7 @@ inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x, /* { */ /* magic_api * api = (magic_api *) ptr; */ -/* Sint16 x, y; */ +/* POINT_TYPE x, y; */ /* for (x=0; xw; x++) */ /* for (y=0; yh; y++) */ @@ -298,7 +299,7 @@ inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x, static void fretwork_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src) { magic_api *api = (magic_api *) ptr; - Sint16 x, y; + POINT_TYPE x, y; for (x = 0; x < dest->w; x++) for (y = 0; y < dest->h; y++) @@ -309,7 +310,7 @@ static void fretwork_rotate(void *ptr, SDL_Surface * dest, SDL_Surface * src, _B //src and dest must have same size { magic_api *api = (magic_api *) ptr; - Sint16 x, y; + POINT_TYPE x, y; if (direction) //rotate -90 degs { diff --git a/magic/src/rails.c b/magic/src/rails.c index 8cc7eeb59..9e55bb691 100644 --- a/magic/src/rails.c +++ b/magic/src/rails.c @@ -58,7 +58,8 @@ void rails_shutdown(magic_api * api); void rails_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas); void rails_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas); inline unsigned int rails_get_segment(int x, int y); -inline void rails_extract_coords_from_segment(unsigned int segment, int * x, int * y); +#define POINT_TYPE typeof(((SDL_Rect *)NULL)->x) +inline void rails_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y); static void rails_flip(void *ptr, SDL_Surface * dest, SDL_Surface * src); static void rails_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src); static void rails_rotate(void *ptr, SDL_Surface * dest, SDL_Surface * src, unsigned int direction); @@ -228,7 +229,7 @@ inline unsigned int rails_get_segment(int x, int y) } -inline void rails_extract_coords_from_segment(unsigned int segment, int * x, int * y) +inline void rails_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y) { //extracts the coords of the beginning and the segment *x = ((segment % rails_segments_x) - 1) * img_w; //useful to set update_rect as small as possible *y = (int)(segment / rails_segments_x) * img_h; @@ -238,7 +239,7 @@ static void rails_flip(void *ptr, SDL_Surface * dest, SDL_Surface * src) { magic_api *api = (magic_api *) ptr; - Sint16 x, y; + POINT_TYPE x, y; for (x = 0; x < dest->w; x++) for (y = 0; y < dest->h; y++) @@ -248,7 +249,7 @@ static void rails_flip(void *ptr, SDL_Surface * dest, SDL_Surface * src) static void rails_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src) { magic_api *api = (magic_api *) ptr; - Sint16 x, y; + POINT_TYPE x, y; for (x = 0; x < dest->w; x++) for (y = 0; y < dest->h; y++) @@ -259,7 +260,7 @@ static void rails_rotate(void *ptr, SDL_Surface * dest, SDL_Surface * src, unsig //src and dest must have same size { magic_api *api = (magic_api *) ptr; - Sint16 x, y; + POINT_TYPE x, y; if (direction) //rotate -90 degs {