From: Holger Schemel Date: Fri, 7 Oct 2011 21:32:32 +0000 (+0200) Subject: rnd-20111007-1-src X-Git-Tag: 3.3.1.0^2~5 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=61c3da024802ecc0268bab42d7499fc0346e4fd3 rnd-20111007-1-src * fixed code (esp. random/tape handling) when compiled on 64-bit systems (by simply replacing all "long" by "int" types) --- diff --git a/ChangeLog b/ChangeLog index b7f003c0..2fa0f138 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-10-07 + * fixed code (esp. random/tape handling) when compiled on 64-bit systems + (by simply replacing all "long" by "int" types) + 2010-11-19 * fixed nasty bug (affecting crumbled graphics) after adding new special graphics suffix ".TAPE" (and messing some things up in src/main.c) diff --git a/src/conftime.h b/src/conftime.h index b2f8c35d..61e2ff61 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2011-03-22 09:01" +#define COMPILE_DATE_STRING "2011-10-07 23:26" diff --git a/src/editor.c b/src/editor.c index 53123487..35ebce3f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -5230,7 +5230,7 @@ static void CreateControlButtons() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int i; /* create toolbox buttons */ @@ -5519,7 +5519,7 @@ static void CreateCounterButtons() int gd_xoffset; int gd_x, gd_x1, gd_x2, gd_y; int x_size, y_size; - unsigned long event_mask; + unsigned int event_mask; char infotext[max_infotext_len + 1]; event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED; @@ -5655,7 +5655,7 @@ static void CreateDrawingAreas() for (i = 0; i < ED_NUM_DRAWING_AREAS; i++) { struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int id = drawingarea_info[i].gadget_id; int x = SX + drawingarea_info[i].x; int y = SY + drawingarea_info[i].y; @@ -5706,7 +5706,7 @@ static void CreateTextInputGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x, gd_y; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = textinput_info[i].gadget_id; @@ -5754,7 +5754,7 @@ static void CreateTextAreaGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x, gd_y; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = textarea_info[i].gadget_id; int area_xsize = textarea_info[i].xsize; @@ -5803,7 +5803,7 @@ static void CreateSelectboxGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x, gd_y; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = selectbox_info[i].gadget_id; int x = SX + selectbox_info[i].x; @@ -5880,7 +5880,7 @@ static void CreateTextbuttonGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x1, gd_x2, gd_y1, gd_y2; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = textbutton_info[i].gadget_id; int x = SX + textbutton_info[i].x; @@ -5953,7 +5953,7 @@ static void CreateGraphicbuttonGadgets() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int i; /* create buttons for scrolling of drawing area and element list */ @@ -6060,7 +6060,7 @@ static void CreateScrollbarGadgets() int gd_x1, gd_x2, gd_y1, gd_y2; struct GadgetInfo *gi; int items_max, items_visible, item_position; - unsigned long event_mask; + unsigned int event_mask; if (i == ED_SCROLLBAR_ID_LIST_VERTICAL) { @@ -6127,7 +6127,7 @@ static void CreateCheckbuttonGadgets() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int gd_x1, gd_x2, gd_x3, gd_x4, gd_y; int i; @@ -6190,7 +6190,7 @@ static void CreateRadiobuttonGadgets() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int gd_x1, gd_x2, gd_x3, gd_x4, gd_y; int i; @@ -11749,8 +11749,8 @@ void HandleLevelEditorKeyInput(Key key) void HandleLevelEditorIdle() { - static unsigned long action_delay = 0; - unsigned long action_delay_value = GameFrameDelay; + static unsigned int action_delay = 0; + unsigned int action_delay_value = GameFrameDelay; int xpos = 1, ypos = 2; int i; diff --git a/src/events.c b/src/events.c index ebcb5e1d..d583d873 100644 --- a/src/events.c +++ b/src/events.c @@ -29,7 +29,7 @@ static boolean cursor_inside_playfield = FALSE; static boolean playfield_cursor_set = FALSE; -static unsigned long playfield_cursor_delay = 0; +static unsigned int playfield_cursor_delay = 0; /* event filter especially needed for SDL event filtering due to @@ -1012,7 +1012,7 @@ void HandleKey(Key key, int key_status) } break; - case KSYM_S: + case KSYM_s: if (!global.fps_slowdown) { global.fps_slowdown = TRUE; @@ -1141,7 +1141,7 @@ void HandleJoystick() case GAME_MODE_SETUP: case GAME_MODE_INFO: { - static unsigned long joystickmove_delay = 0; + static unsigned int joystickmove_delay = 0; if (joystick && !button && !DelayReached(&joystickmove_delay, GADGET_FRAME_DELAY)) diff --git a/src/game.c b/src/game.c index e7523585..0a9b6185 100644 --- a/src/game.c +++ b/src/game.c @@ -9555,8 +9555,8 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element) void AmoebeWaechst(int x, int y) { - static unsigned long sound_delay = 0; - static unsigned long sound_delay_value = 0; + static unsigned int sound_delay = 0; + static unsigned int sound_delay_value = 0; if (!MovDelay[x][y]) /* start new growing cycle */ { @@ -9591,8 +9591,8 @@ void AmoebeWaechst(int x, int y) void AmoebaDisappearing(int x, int y) { - static unsigned long sound_delay = 0; - static unsigned long sound_delay_value = 0; + static unsigned int sound_delay = 0; + static unsigned int sound_delay_value = 0; if (!MovDelay[x][y]) /* start new shrinking cycle */ { @@ -12303,9 +12303,9 @@ void AdvanceFrameAndPlayerCounters(int player_nr) } void StartGameActions(boolean init_network_game, boolean record_tape, - long random_seed) + int random_seed) { - unsigned long new_random_seed = InitRND(random_seed); + unsigned int new_random_seed = InitRND(random_seed); if (record_tape) TapeStartRecording(new_random_seed); @@ -12324,8 +12324,8 @@ void StartGameActions(boolean init_network_game, boolean record_tape, void GameActions() { - static unsigned long game_frame_delay = 0; - unsigned long game_frame_delay_value; + static unsigned int game_frame_delay = 0; + unsigned int game_frame_delay_value; byte *recorded_player_action; byte summarized_player_action = 0; byte tape_action[MAX_PLAYERS]; @@ -13093,7 +13093,7 @@ void GameActions_RND() /* new experimental amoeba growth stuff */ if (!(FrameCounter % 8)) { - static unsigned long random = 1684108901; + static unsigned int random = 1684108901; for (i = 0; i < level.amoeba_speed * 28 / 8; i++) { @@ -13277,9 +13277,9 @@ void GameActions_RND() if (options.debug) /* calculate frames per second */ { - static unsigned long fps_counter = 0; + static unsigned int fps_counter = 0; static int fps_frames = 0; - unsigned long fps_delay_ms = Counter() - fps_counter; + unsigned int fps_delay_ms = Counter() - fps_counter; fps_frames++; @@ -13710,7 +13710,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) int original_move_delay_value = player->move_delay_value; #if DEBUG - printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES. [%ld]\n", + printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES. [%d]\n", tape.counter); #endif @@ -14112,7 +14112,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) void ScrollScreen(struct PlayerInfo *player, int mode) { - static unsigned long screen_frame_counter = 0; + static unsigned int screen_frame_counter = 0; if (mode == SCROLL_INIT) { @@ -16521,7 +16521,7 @@ void RequestQuitGame(boolean ask_if_really_quit) /* random generator functions */ /* ------------------------------------------------------------------------- */ -unsigned int InitEngineRandom_RND(long seed) +unsigned int InitEngineRandom_RND(int seed) { game.num_random_calls = 0; @@ -16614,7 +16614,7 @@ static void SaveEngineSnapshotValues_RND() static void LoadEngineSnapshotValues_RND() { - unsigned long num_random_calls = game.num_random_calls; + unsigned int num_random_calls = game.num_random_calls; int i, j; for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) @@ -16832,7 +16832,7 @@ void CreateGameButtons() struct GadgetInfo *gi; int button_type; boolean checked; - unsigned long event_mask; + unsigned int event_mask; int gd_x = gfx->src_x; int gd_y = gfx->src_y; int gd_xp = gfx->src_x + gfx->pressed_xoffset; diff --git a/src/game.h b/src/game.h index 18cac2ed..96af46d0 100644 --- a/src/game.h +++ b/src/game.h @@ -178,7 +178,7 @@ struct GameInfo boolean set_centered_player; /* values for random number generator initialization after snapshot */ - unsigned long num_random_calls; + unsigned int num_random_calls; }; struct PlayerInfo @@ -278,7 +278,7 @@ struct PlayerInfo int push_delay; int push_delay_value; - unsigned long actual_frame_counter; + unsigned int actual_frame_counter; int drop_delay; int drop_pressed_delay; @@ -331,7 +331,7 @@ void Moving2Blocked(int, int, int *, int *); void Blocked2Moving(int, int, int *, int *); void DrawDynamite(int, int); -void StartGameActions(boolean, boolean, long); +void StartGameActions(boolean, boolean, int); void GameActions(void); void GameActions_EM_Main(); @@ -350,7 +350,7 @@ void RaiseScoreElement(int); void RequestQuitGameExt(boolean, boolean, char *); void RequestQuitGame(boolean); -unsigned int InitEngineRandom_RND(long); +unsigned int InitEngineRandom_RND(int); unsigned int RND(int); void FreeEngineSnapshot(); diff --git a/src/game_em/export.h b/src/game_em/export.h index f9fa8884..7efbfc3b 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -700,7 +700,7 @@ struct GraphicInfo_EM struct EngineSnapshotInfo_EM { struct GameInfo_EM game_em; - unsigned long RandomEM; + unsigned int RandomEM; struct LEVEL lev; struct PLAYER ply[MAX_PLAYERS]; short Array[4][EM_MAX_CAVE_HEIGHT][EM_MAX_CAVE_WIDTH]; @@ -732,7 +732,7 @@ extern void InitGfxBuffers_EM(); extern void InitGameEngine_EM(); extern void GameActions_EM(byte *, boolean); -extern unsigned int InitEngineRandom_EM(long); +extern unsigned int InitEngineRandom_EM(int); extern void setLevelInfoToDefaults_EM(); extern boolean LoadNativeLevel_EM(char *, boolean); diff --git a/src/game_em/global.h b/src/game_em/global.h index 0f2a6448..2da0ec8e 100644 --- a/src/game_em/global.h +++ b/src/game_em/global.h @@ -59,7 +59,7 @@ void convert_em_level(unsigned char *, int); void prepare_em_level(void); int sound_thread(void); -int read_sample(char *, short **, long *); +int read_sample(char *, short **, int *); void read_cave_list(void); void free_cave_list(void); diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 455979ea..ef0e1537 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -1008,9 +1008,9 @@ void RedrawPlayfield_EM(boolean force_redraw) if (draw_new_player_location && !quick_relocation) { #if 1 - unsigned long game_frame_delay_value = getGameFrameDelay_EM(20); + unsigned int game_frame_delay_value = getGameFrameDelay_EM(20); #else - unsigned long game_frame_delay_value = getGameFrameDelay_EM(25); + unsigned int game_frame_delay_value = getGameFrameDelay_EM(25); #endif int wait_delay_value = game_frame_delay_value; int screen_xx = VALID_SCREEN_X(sx); diff --git a/src/game_em/init.c b/src/game_em/init.c index 12c0ad97..2033b2db 100644 --- a/src/game_em/init.c +++ b/src/game_em/init.c @@ -46,7 +46,7 @@ struct GameInfo_EM game_em; static int sound_pid = -1; int sound_pipe[2] = { -1, -1 }; /* for communication */ short *sound_data[SAMPLE_MAX]; /* pointer to sound data */ -long sound_length[SAMPLE_MAX]; /* length of sound data */ +int sound_length[SAMPLE_MAX]; /* length of sound data */ static const char *sound_names[SAMPLE_MAX] = { @@ -401,7 +401,7 @@ void sound_play(void) clear_mem(play, sizeof(play)); } -unsigned int InitEngineRandom_EM(long seed) +unsigned int InitEngineRandom_EM(int seed) { if (seed == NEW_RANDOMIZE) { diff --git a/src/game_em/input.c b/src/game_em/input.c index cf8b9de6..76932c54 100644 --- a/src/game_em/input.c +++ b/src/game_em/input.c @@ -6,7 +6,7 @@ #include "main_em.h" -unsigned long RandomEM; +unsigned int RandomEM; struct LEVEL lev; struct PLAYER ply[MAX_PLAYERS]; diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h index c8776452..91b01844 100644 --- a/src/game_em/main_em.h +++ b/src/game_em/main_em.h @@ -133,7 +133,7 @@ extern int SX, SY; /* exported variables */ /* ------------------------------------------------------------------------- */ -extern unsigned long RandomEM; +extern unsigned int RandomEM; extern struct LEVEL lev; extern struct PLAYER ply[MAX_PLAYERS]; diff --git a/src/game_em/sample.h b/src/game_em/sample.h index 853b27d3..efbd7745 100644 --- a/src/game_em/sample.h +++ b/src/game_em/sample.h @@ -10,7 +10,7 @@ extern void play_element_sound(int, int, int, int); extern char play[SAMPLE_MAX]; extern int sound_pipe[2]; extern short *sound_data[SAMPLE_MAX]; -extern long sound_length[SAMPLE_MAX]; +extern int sound_length[SAMPLE_MAX]; #define MIXER_MAX 4 /* maximum number of samples we can play at once */ diff --git a/src/game_em/sound.c b/src/game_em/sound.c index c1334cc7..9ed5ac3d 100644 --- a/src/game_em/sound.c +++ b/src/game_em/sound.c @@ -71,7 +71,7 @@ int sound_thread(void) short *mix_buffer; char sound_play[SAMPLE_MAX]; /* if set, we should be playing these sounds */ - long sound_pos[SAMPLE_MAX]; /* position in the sound */ + int sound_pos[SAMPLE_MAX]; /* position in the sound */ int mix_play[MIXER_MAX]; /* which sounds we have chosen to mix (calculated each time) */ int mix_count; int i; @@ -301,7 +301,7 @@ int sound_thread(void) register short *mix_ptr = mix_buffer; register short *sound_ptr = sound_data[mix_play[i]] + sound_pos[mix_play[i]]; - register long count = + register int count = sound_length[mix_play[i]] - sound_pos[mix_play[i]]; if (count > fragment_size) @@ -380,16 +380,16 @@ int sound_thread(void) return(0); } -int read_sample(char *name, short **data, long *length) +int read_sample(char *name, short **data, int *length) { int result; FILE *file = 0; short *dataptr = 0; - long datalength; + int datalength; int i, actual, ch; unsigned char buffer[24]; - unsigned long temp; + unsigned int temp; file = fopen(name, "rb"); if (file == 0) @@ -454,7 +454,7 @@ int read_sample(char *name, short **data, long *length) temp = buffer[12] << 24 | buffer[13] << 16 | buffer[14] << 8 | buffer[15]; if (temp != 1) { - fprintf(stderr, "%s: \"%s\": %s (%ld != 1)\n", progname, name, + fprintf(stderr, "%s: \"%s\": %s (%d != 1)\n", progname, name, "bad encoding type", temp); result = 1; goto fail; @@ -464,7 +464,7 @@ int read_sample(char *name, short **data, long *length) temp = buffer[16] << 24 | buffer[17] << 16 | buffer[18] << 8 | buffer[19]; if (temp != 8000) { - fprintf(stderr, "%s: \"%s\": %s (%ld != 8000)\n", progname, name, + fprintf(stderr, "%s: \"%s\": %s (%d != 8000)\n", progname, name, "bad sample rate", temp); result = 1; goto fail; @@ -474,7 +474,7 @@ int read_sample(char *name, short **data, long *length) temp = buffer[20] << 24 | buffer[21] << 16 | buffer[22] << 8 | buffer[23]; if (temp != 1) { - fprintf(stderr, "%s: \"%s\": %s (%ld != 1)\n", progname, name, + fprintf(stderr, "%s: \"%s\": %s (%d != 1)\n", progname, name, "unsupported channels", temp); result = 1; goto fail; diff --git a/src/game_em/synchro_2.c b/src/game_em/synchro_2.c index 82ca79b6..c4b9a678 100644 --- a/src/game_em/synchro_2.c +++ b/src/game_em/synchro_2.c @@ -43,7 +43,7 @@ void synchro_2(void) { int x = 0; int y = 1; - unsigned long random = RandomEM; + unsigned int random = RandomEM; short *cave_cache = Cave[y]; /* might be a win */ int score = 0; diff --git a/src/game_sp/BugsTerminals.c b/src/game_sp/BugsTerminals.c index 94850270..d0a82ad4 100644 --- a/src/game_sp/BugsTerminals.c +++ b/src/game_sp/BugsTerminals.c @@ -127,7 +127,7 @@ void subAnimateTerminals(int si) void subRandomize() { - long Tick = MyGetTickCount(); + int Tick = MyGetTickCount(); RandomSeed = (Tick ^ (Tick >> 16)) & 0xFFFF; } diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index bb3b5c04..82f0d1e6 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -7,14 +7,14 @@ #include -long mScrollX, mScrollY; -long mScrollX_last, mScrollY_last; +int mScrollX, mScrollY; +int mScrollX_last, mScrollY_last; #if 1 -long ScreenBuffer[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2]; +int ScreenBuffer[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2]; boolean redraw[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2]; #else -long ScreenBuffer[MAX_BUF_XSIZE][MAX_BUF_YSIZE]; +int ScreenBuffer[MAX_BUF_XSIZE][MAX_BUF_YSIZE]; boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE]; #endif @@ -91,9 +91,9 @@ static void ScrollPlayfield(int dx, int dy) int sx = x - x1; int sy = y - y1; int tsi = GetSI(x, y); - long id = ((PlayField16[tsi]) | - (PlayField8[tsi] << 16) | - (DisPlayField[tsi] << 24)); + int id = ((PlayField16[tsi]) | + (PlayField8[tsi] << 16) | + (DisPlayField[tsi] << 24)); if ((dx == -1 && x == x2) || (dx == +1 && x == x1) || @@ -454,12 +454,12 @@ void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) ScrollPlayfieldIfNeeded(); } -void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) +void DDScrollBuffer_SoftScrollTo(int X, int Y, int TimeMS, int FPS) { double dx, dY; - long dT, StepCount; + int dT, StepCount; double T, tStep; - long oldX, oldY, maxD; + int oldX, oldY, maxD; static boolean AlreadyRunning = False; if (NoDisplayFlag) diff --git a/src/game_sp/DDScrollBuffer.h b/src/game_sp/DDScrollBuffer.h index e34ef219..efff1306 100644 --- a/src/game_sp/DDScrollBuffer.h +++ b/src/game_sp/DDScrollBuffer.h @@ -8,8 +8,8 @@ #include "global.h" -extern long mScrollX, mScrollY; -extern long mScrollX_last, mScrollY_last; +extern int mScrollX, mScrollY; +extern int mScrollX_last, mScrollY_last; #if 1 extern boolean redraw[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2]; @@ -26,6 +26,6 @@ extern void RestorePlayfield(); extern void DDScrollBuffer_ScrollTo(int X, int Y); extern void DDScrollBuffer_ScrollTowards(int X, int Y, double Step); -extern void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS); +extern void DDScrollBuffer_SoftScrollTo(int X, int Y, int TimeMS, int FPS); #endif /* DDSCROLLBUFFER_H */ diff --git a/src/game_sp/Display.c b/src/game_sp/Display.c index d3bf853e..ae9d26ea 100644 --- a/src/game_sp/Display.c +++ b/src/game_sp/Display.c @@ -10,8 +10,8 @@ int ScreenScrollXPos, ScreenScrollYPos; int ExplosionShake, ExplosionShakeMurphy; boolean NoDisplayFlag; -long DisplayMinX, DisplayMaxX; -long DisplayMinY, DisplayMaxY; +int DisplayMinX, DisplayMaxX; +int DisplayMinY, DisplayMaxY; void subDisplayLevel() @@ -52,7 +52,7 @@ void ScrollTowards(int X, int Y) DDScrollBuffer_ScrollTowards(X, Y, 2 * ZoomFactor); } -void SoftScrollTo(int X, int Y, long TimeMS, int FPS) +void SoftScrollTo(int X, int Y, int TimeMS, int FPS) { if (NoDisplayFlag) return; diff --git a/src/game_sp/Display.h b/src/game_sp/Display.h index bc0934f4..dee7b16e 100644 --- a/src/game_sp/Display.h +++ b/src/game_sp/Display.h @@ -13,12 +13,12 @@ extern int ScreenScrollXPos, ScreenScrollYPos; extern int ExplosionShake, ExplosionShakeMurphy; extern boolean NoDisplayFlag; -extern long DisplayMinX, DisplayMaxX; -extern long DisplayMinY, DisplayMaxY; +extern int DisplayMinX, DisplayMaxX; +extern int DisplayMinY, DisplayMaxY; extern void subDisplayLevel(); extern void ScrollTo(int, int); extern void ScrollTowards(int, int); -extern void SoftScrollTo(int, int, long, int); +extern void SoftScrollTo(int, int, int, int); #endif /* DISPLAY_H */ diff --git a/src/game_sp/Globals.c b/src/game_sp/Globals.c index 35bf4d8a..9ddbf2b0 100644 --- a/src/game_sp/Globals.c +++ b/src/game_sp/Globals.c @@ -15,7 +15,7 @@ int FieldHeight; // standard size = 24 int HeaderSize; // standard size = 96 int FieldMax, LevelMax; #if 0 -long FileMax; +int FileMax; #endif #if 1 @@ -48,7 +48,7 @@ int MurphyPosIndex, MurphyXPos, MurphyYPos; int MurphyScreenXPos, MurphyScreenYPos; int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos; int KillMurphyFlag, MurphyMoveCounter; -long YawnSleepCounter; +int YawnSleepCounter; int MurphyVarFaceLeft; int ScratchGravity, GravityFlag; int RedDiskReleaseFlag, MovingPictureSequencePhase; diff --git a/src/game_sp/Globals.h b/src/game_sp/Globals.h index c2a56c7c..6b965de9 100644 --- a/src/game_sp/Globals.h +++ b/src/game_sp/Globals.h @@ -13,7 +13,7 @@ #define True (!False) #endif -#define ScrollDelta ((long)1) +#define ScrollDelta ((int)1) #if NEW_TILESIZE // #define ZoomFactor (ZOOM_FACTOR) @@ -229,8 +229,8 @@ typedef struct { int Width; int Height; - long OffSet; - long Size; + int OffSet; + int Size; } LevelDescriptor; #define HAS_LevelDescriptor #endif @@ -320,7 +320,7 @@ extern int TimerVar; extern short RandomSeed; #if 0 -extern long FileMax; +extern int FileMax; #endif extern LevelInfoType LInfo; @@ -343,6 +343,6 @@ extern int RedDiskReleasePhase; extern int ScratchGravity, GravityFlag; extern int SnikSnaksElectronsFrozen; extern int YellowDisksExploded; -extern long YawnSleepCounter; +extern int YawnSleepCounter; #endif /* GLOBALS_H */ diff --git a/src/game_sp/export.h b/src/game_sp/export.h index a8e6e318..364ede02 100644 --- a/src/game_sp/export.h +++ b/src/game_sp/export.h @@ -193,7 +193,7 @@ extern void InitGfxBuffers_SP(); extern void InitGameEngine_SP(); extern void GameActions_SP(byte *, boolean); -extern unsigned int InitEngineRandom_SP(long); +extern unsigned int InitEngineRandom_SP(int); extern void setLevelInfoToDefaults_SP(); extern void copyInternalEngineVars_SP(); diff --git a/src/game_sp/init.c b/src/game_sp/init.c index 07bdb9d9..acd426ff 100644 --- a/src/game_sp/init.c +++ b/src/game_sp/init.c @@ -83,13 +83,13 @@ void InitGfxBuffers_SP() ReCreateBitmap(&bitmap_db_field_sp, FXSIZE, FYSIZE, DEFAULT_DEPTH); } -unsigned int InitEngineRandom_SP(long seed) +unsigned int InitEngineRandom_SP(int seed) { if (seed == NEW_RANDOMIZE) { subRandomize(); - seed = (long)RandomSeed; + seed = (int)RandomSeed; } RandomSeed = (short)seed; diff --git a/src/game_sp/vb_lib.c b/src/game_sp/vb_lib.c index f71693c0..bdbe7691 100644 --- a/src/game_sp/vb_lib.c +++ b/src/game_sp/vb_lib.c @@ -23,7 +23,7 @@ void *REDIM_1D(int data_size, int first_data_pos, int last_data_pos) } #endif -long MyGetTickCount() +int MyGetTickCount() { return random_linux_libc(RANDOM_SIMPLE); } diff --git a/src/game_sp/vb_lib.h b/src/game_sp/vb_lib.h index cf8e3462..4f19f3a2 100644 --- a/src/game_sp/vb_lib.h +++ b/src/game_sp/vb_lib.h @@ -15,6 +15,6 @@ extern void *REDIM_1D(int, int, int); #endif -extern long MyGetTickCount(); +extern int MyGetTickCount(); #endif /* VB_LIB_H */ diff --git a/src/init.c b/src/init.c index e239da9d..3eb14051 100644 --- a/src/init.c +++ b/src/init.c @@ -159,8 +159,8 @@ void DrawInitAnim() { struct GraphicInfo *graphic_info_last = graphic_info; int graphic = 0; - static unsigned long action_delay = 0; - unsigned long action_delay_value = GameFrameDelay; + static unsigned int action_delay = 0; + unsigned int action_delay_value = GameFrameDelay; int sync_frame = FrameCounter; int x, y; @@ -175,9 +175,9 @@ void DrawInitAnim() #if 0 { - static unsigned long last_counter = -1; - unsigned long current_counter = Counter(); - unsigned long delay = current_counter - last_counter; + static unsigned int last_counter = -1; + unsigned int current_counter = Counter(); + unsigned int delay = current_counter - last_counter; if (last_counter != -1 && delay > action_delay_value + 5) printf("::: DrawInitAnim: DELAY TOO LONG: %ld\n", delay); @@ -1857,7 +1857,7 @@ static void InitGraphicInfo() static boolean clipmasks_initialized = FALSE; Pixmap src_pixmap; XGCValues clip_gc_values; - unsigned long clip_gc_valuemask; + unsigned int clip_gc_valuemask; GC copy_clipmask_gc = None; #endif diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index ba2081c6..cbe7482c 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -1431,8 +1431,8 @@ void ClickOnGadget(struct GadgetInfo *gi, int button) boolean HandleGadgets(int mx, int my, int button) { - static unsigned long pressed_delay = 0; - static unsigned long pressed_delay_value = GADGET_FRAME_DELAY; + static unsigned int pressed_delay = 0; + static unsigned int pressed_delay_value = GADGET_FRAME_DELAY; static int last_button = 0; static int last_mx = 0, last_my = 0; static int pressed_mx = 0, pressed_my = 0; diff --git a/src/libgame/gadgets.h b/src/libgame/gadgets.h index 43125d66..7b8ce7f5 100644 --- a/src/libgame/gadgets.h +++ b/src/libgame/gadgets.h @@ -135,7 +135,7 @@ struct GadgetDecoration struct GadgetEvent { - unsigned long type; /* event type */ + unsigned int type; /* event type */ int button; /* button number for button events */ int x, y; /* gadget position at event time */ boolean off_borders; /* mouse pointer outside gadget? */ diff --git a/src/libgame/image.c b/src/libgame/image.c index 8ccf1fcb..498c1c0b 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -64,28 +64,28 @@ void freeImage(Image *image) note: the internal format is big endian */ #define memory_to_value(ptr, len) ( \ -(len) == 1 ? (unsigned long)( *( (byte *)(ptr)) ) : \ -(len) == 2 ? (unsigned long)(((unsigned long)(*( (byte *)(ptr)) ))<< 8) \ - + ( *(((byte *)(ptr))+1) ) : \ -(len) == 3 ? (unsigned long)(((unsigned long)(*( (byte *)(ptr)) ))<<16) \ - + (((unsigned long)(*(((byte *)(ptr))+1)))<< 8) \ - + ( *(((byte *)(ptr))+2) ) : \ - (unsigned long)(((unsigned long)(*( (byte *)(ptr)) ))<<24) \ - + (((unsigned long)(*(((byte *)(ptr))+1)))<<16) \ - + (((unsigned long)(*(((byte *)(ptr))+2)))<< 8) \ - + ( *(((byte *)(ptr))+3) ) ) +(len) == 1 ? (unsigned int)( *( (byte *)(ptr)) ) : \ +(len) == 2 ? (unsigned int)(((unsigned int)(*( (byte *)(ptr)) ))<< 8) \ + + ( *(((byte *)(ptr))+1) ) : \ +(len) == 3 ? (unsigned int)(((unsigned int)(*( (byte *)(ptr)) ))<<16) \ + + (((unsigned int)(*(((byte *)(ptr))+1)))<< 8) \ + + ( *(((byte *)(ptr))+2) ) : \ + (unsigned int)(((unsigned int)(*( (byte *)(ptr)) ))<<24) \ + + (((unsigned int)(*(((byte *)(ptr))+1)))<<16) \ + + (((unsigned int)(*(((byte *)(ptr))+2)))<< 8) \ + + ( *(((byte *)(ptr))+3) ) ) #define value_to_memory(value, ptr, len) ( \ (len) == 1 ? (*( (byte *)(ptr) ) = ( value ) ) : \ -(len) == 2 ? (*( (byte *)(ptr) ) = (((unsigned long)(value))>> 8), \ +(len) == 2 ? (*( (byte *)(ptr) ) = (((unsigned int)(value))>> 8), \ *(((byte *)(ptr))+1) = ( value ) ) : \ -(len) == 3 ? (*( (byte *)(ptr) ) = (((unsigned long)(value))>>16), \ - *(((byte *)(ptr))+1) = (((unsigned long)(value))>> 8), \ +(len) == 3 ? (*( (byte *)(ptr) ) = (((unsigned int)(value))>>16), \ + *(((byte *)(ptr))+1) = (((unsigned int)(value))>> 8), \ *(((byte *)(ptr))+2) = ( value ) ) : \ - (*( (byte *)(ptr) ) = (((unsigned long)(value))>>24), \ - *(((byte *)(ptr))+1) = (((unsigned long)(value))>>16), \ - *(((byte *)(ptr))+2) = (((unsigned long)(value))>> 8), \ + (*( (byte *)(ptr) ) = (((unsigned int)(value))>>24), \ + *(((byte *)(ptr))+1) = (((unsigned int)(value))>>16), \ + *(((byte *)(ptr))+2) = (((unsigned int)(value))>> 8), \ *(((byte *)(ptr))+3) = ( value ) )) static Pixmap Image_to_Mask(Image *image, Display *display, Window window) diff --git a/src/libgame/image.h b/src/libgame/image.h index 89f4f7c4..c3c1e0d1 100644 --- a/src/libgame/image.h +++ b/src/libgame/image.h @@ -59,10 +59,10 @@ typedef struct #define IMAGETYPE_RGB 1 /* RGB image with colormap */ #define IMAGETYPE_TRUECOLOR 2 /* true-color image */ -#define TRUECOLOR_RED(pixel) (((unsigned long)((pixel) & 0xff0000)) >> 16) -#define TRUECOLOR_GREEN(pixel) (((unsigned long)((pixel) & 0xff00)) >> 8) -#define TRUECOLOR_BLUE(pixel) ( (unsigned long)((pixel) & 0xff)) -#define RGB_TO_TRUECOLOR(r,g,b) ((((unsigned long)((r) & 0xff00)) << 8) | ((g) & 0xff00) | (((unsigned short)(b)) >> 8)) +#define TRUECOLOR_RED(pixel) (((unsigned int)((pixel) & 0xff0000)) >> 16) +#define TRUECOLOR_GREEN(pixel) (((unsigned int)((pixel) & 0xff00)) >> 8) +#define TRUECOLOR_BLUE(pixel) ( (unsigned int)((pixel) & 0xff)) +#define RGB_TO_TRUECOLOR(r,g,b) ((((unsigned int)((r) & 0xff00)) << 8) | ((g) & 0xff00) | (((unsigned short)(b)) >> 8)) Image *newImage(unsigned int, unsigned int, unsigned int); void freeImage(Image *); diff --git a/src/libgame/joystick.c b/src/libgame/joystick.c index b286de23..d5a78a29 100644 --- a/src/libgame/joystick.c +++ b/src/libgame/joystick.c @@ -208,7 +208,7 @@ char *getDeviceNameFromJoystickNr(int joystick_nr) static int JoystickPositionPercent(int center, int border, int actual) { - long range, position; + int range, position; int percent; if (border < center && actual > center) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index b8f2fe5c..7051e28e 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -168,7 +168,7 @@ boolean getTokenValueFromString(char *string, char **token, char **value) /* ------------------------------------------------------------------------- */ #if defined(PLATFORM_MSDOS) -volatile unsigned long counter = 0; +volatile unsigned int counter = 0; void increment_counter() { @@ -185,7 +185,7 @@ END_OF_FUNCTION(increment_counter); #if 1 #ifdef TARGET_SDL -static unsigned long getCurrentMS() +static unsigned int getCurrentMS() { return SDL_GetTicks(); } @@ -193,7 +193,7 @@ static unsigned long getCurrentMS() #else /* !TARGET_SDL */ #if defined(PLATFORM_UNIX) -static unsigned long getCurrentMS() +static unsigned int getCurrentMS() { struct timeval current_time; @@ -204,10 +204,10 @@ static unsigned long getCurrentMS() #endif /* PLATFORM_UNIX */ #endif /* !TARGET_SDL */ -static unsigned long mainCounter(int mode) +static unsigned int mainCounter(int mode) { - static unsigned long base_ms = 0; - unsigned long current_ms; + static unsigned int base_ms = 0; + unsigned int current_ms; /* get current system milliseconds */ current_ms = getCurrentMS(); @@ -223,11 +223,11 @@ static unsigned long mainCounter(int mode) #else #ifdef TARGET_SDL -static unsigned long mainCounter(int mode) +static unsigned int mainCounter(int mode) { - static unsigned long base_ms = 0; - unsigned long current_ms; - unsigned long counter_ms; + static unsigned int base_ms = 0; + unsigned int current_ms; + unsigned int counter_ms; current_ms = SDL_GetTicks(); @@ -243,11 +243,11 @@ static unsigned long mainCounter(int mode) #else /* !TARGET_SDL */ #if defined(PLATFORM_UNIX) -static unsigned long mainCounter(int mode) +static unsigned int mainCounter(int mode) { static struct timeval base_time = { 0, 0 }; struct timeval current_time; - unsigned long counter_ms; + unsigned int counter_ms; gettimeofday(¤t_time, NULL); @@ -276,7 +276,7 @@ void InitCounter() /* set counter back to zero */ #endif } -unsigned long Counter() /* get milliseconds since last call of InitCounter() */ +unsigned int Counter() /* get milliseconds since last call of InitCounter() */ { #if !defined(PLATFORM_MSDOS) return mainCounter(READ_COUNTER); @@ -285,7 +285,7 @@ unsigned long Counter() /* get milliseconds since last call of InitCounter() */ #endif } -static void sleep_milliseconds(unsigned long milliseconds_delay) +static void sleep_milliseconds(unsigned int milliseconds_delay) { boolean do_busy_waiting = (milliseconds_delay < 5 ? TRUE : FALSE); @@ -296,7 +296,7 @@ static void sleep_milliseconds(unsigned long milliseconds_delay) therefore it's better to do a short interval of busy waiting to get our sleeping time more accurate */ - unsigned long base_counter = Counter(), actual_counter = Counter(); + unsigned int base_counter = Counter(), actual_counter = Counter(); while (actual_counter < base_counter + milliseconds_delay && actual_counter >= base_counter) @@ -320,15 +320,15 @@ static void sleep_milliseconds(unsigned long milliseconds_delay) } } -void Delay(unsigned long delay) /* Sleep specified number of milliseconds */ +void Delay(unsigned int delay) /* Sleep specified number of milliseconds */ { sleep_milliseconds(delay); } -boolean FrameReached(unsigned long *frame_counter_var, - unsigned long frame_delay) +boolean FrameReached(unsigned int *frame_counter_var, + unsigned int frame_delay) { - unsigned long actual_frame_counter = FrameCounter; + unsigned int actual_frame_counter = FrameCounter; if (actual_frame_counter >= *frame_counter_var && actual_frame_counter < *frame_counter_var + frame_delay) @@ -339,10 +339,10 @@ boolean FrameReached(unsigned long *frame_counter_var, return TRUE; } -boolean DelayReached(unsigned long *counter_var, - unsigned long delay) +boolean DelayReached(unsigned int *counter_var, + unsigned int delay) { - unsigned long actual_counter = Counter(); + unsigned int actual_counter = Counter(); if (actual_counter >= *counter_var && actual_counter < *counter_var + delay) @@ -353,9 +353,9 @@ boolean DelayReached(unsigned long *counter_var, return TRUE; } -void WaitUntilDelayReached(unsigned long *counter_var, unsigned long delay) +void WaitUntilDelayReached(unsigned int *counter_var, unsigned int delay) { - unsigned long actual_counter; + unsigned int actual_counter; while (1) { @@ -376,12 +376,12 @@ void WaitUntilDelayReached(unsigned long *counter_var, unsigned long delay) /* random generator functions */ /* ------------------------------------------------------------------------- */ -unsigned int init_random_number(int nr, long seed) +unsigned int init_random_number(int nr, int seed) { if (seed == NEW_RANDOMIZE) { /* default random seed */ - seed = (long)time(NULL); // seconds since the epoch + seed = (int)time(NULL); // seconds since the epoch #if !defined(PLATFORM_WIN32) /* add some more randomness */ @@ -389,12 +389,12 @@ unsigned int init_random_number(int nr, long seed) gettimeofday(¤t_time, NULL); - seed += (long)current_time.tv_usec; // microseconds since the epoch + seed += (int)current_time.tv_usec; // microseconds since the epoch #endif #if defined(TARGET_SDL) /* add some more randomness */ - seed += (long)SDL_GetTicks(); // milliseconds since SDL init + seed += (int)SDL_GetTicks(); // milliseconds since SDL init #endif #if 1 @@ -426,7 +426,7 @@ static char *get_corrected_real_name(char *real_name) char *to_ptr = real_name_new; /* copy the name string, but not more than MAX_USERNAME_LEN characters */ - while (*from_ptr && (long)(to_ptr - real_name_new) < MAX_USERNAME_LEN - 1) + while (*from_ptr && (int)(to_ptr - real_name_new) < MAX_USERNAME_LEN - 1) { /* the name field read from "passwd" file may also contain additional user information, separated by commas, which will be removed here */ @@ -458,7 +458,7 @@ char *getLoginName() #if defined(PLATFORM_WIN32) if (login_name == NULL) { - unsigned long buffer_size = MAX_USERNAME_LEN + 1; + unsigned int buffer_size = MAX_USERNAME_LEN + 1; login_name = checked_malloc(buffer_size); if (GetUserName(login_name, &buffer_size) == 0) @@ -487,7 +487,7 @@ char *getRealName() if (real_name == NULL) { static char buffer[MAX_USERNAME_LEN + 1]; - unsigned long buffer_size = MAX_USERNAME_LEN + 1; + unsigned int buffer_size = MAX_USERNAME_LEN + 1; if (GetUserName(buffer, &buffer_size) != 0) real_name = get_corrected_real_name(buffer); @@ -890,7 +890,7 @@ void GetOptions(char *argv[], void (*print_usage_function)(void)) options.special_flags = getStringCopy(&option[2]); #else char *flags_string = &option[2]; - unsigned long flags_value; + unsigned int flags_value; if (*flags_string == '\0') Error(ERR_EXIT_HELP, "empty flag ignored"); @@ -1024,7 +1024,7 @@ void Error(int mode, char *format, ...) /* checked memory allocation and freeing functions */ /* ------------------------------------------------------------------------- */ -void *checked_malloc(unsigned long size) +void *checked_malloc(unsigned int size) { void *ptr; @@ -1036,7 +1036,7 @@ void *checked_malloc(unsigned long size) return ptr; } -void *checked_calloc(unsigned long size) +void *checked_calloc(unsigned int size) { void *ptr; @@ -1048,7 +1048,7 @@ void *checked_calloc(unsigned long size) return ptr; } -void *checked_realloc(void *ptr, unsigned long size) +void *checked_realloc(void *ptr, unsigned int size) { ptr = realloc(ptr, size); @@ -1064,7 +1064,7 @@ void checked_free(void *ptr) free(ptr); } -void clear_mem(void *ptr, unsigned long size) +void clear_mem(void *ptr, unsigned int size) { #if defined(PLATFORM_WIN32) /* for unknown reason, memset() sometimes crashes when compiled with MinGW */ @@ -1256,7 +1256,7 @@ int putFileVersion(FILE *file, int version) return 4; } -void ReadBytesFromFile(FILE *file, byte *buffer, unsigned long bytes) +void ReadBytesFromFile(FILE *file, byte *buffer, unsigned int bytes) { int i; @@ -1264,7 +1264,7 @@ void ReadBytesFromFile(FILE *file, byte *buffer, unsigned long bytes) buffer[i] = fgetc(file); } -void WriteBytesToFile(FILE *file, byte *buffer, unsigned long bytes) +void WriteBytesToFile(FILE *file, byte *buffer, unsigned int bytes) { int i; @@ -1272,13 +1272,13 @@ void WriteBytesToFile(FILE *file, byte *buffer, unsigned long bytes) fputc(buffer[i], file); } -void ReadUnusedBytesFromFile(FILE *file, unsigned long bytes) +void ReadUnusedBytesFromFile(FILE *file, unsigned int bytes) { while (bytes-- && !feof(file)) fgetc(file); } -void WriteUnusedBytesToFile(FILE *file, unsigned long bytes) +void WriteUnusedBytesToFile(FILE *file, unsigned int bytes) { while (bytes--) fputc(0, file); @@ -1475,7 +1475,7 @@ void translate_keyname(Key *keysym, char **x11name, char **name, int mode) while (translate_key[++i].x11name); if (!translate_key[i].x11name) - sprintf(name_buffer, "0x%04lx", (unsigned long)key); + sprintf(name_buffer, "0x%04x", (unsigned int)key); } *x11name = name_buffer; @@ -1552,7 +1552,7 @@ void translate_keyname(Key *keysym, char **x11name, char **name, int mode) } else if (strPrefix(name_ptr, "0x")) { - unsigned long value = 0; + unsigned int value = 0; name_ptr += 2; @@ -3148,7 +3148,7 @@ void debug_print_timestamp(int counter_nr, char *message) counter[counter_nr][0] = Counter_Microseconds(); #else - static long counter[DEBUG_NUM_TIMESTAMPS][2]; + static int counter[DEBUG_NUM_TIMESTAMPS][2]; char *unit = "s"; counter[counter_nr][0] = Counter(); diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 34499610..b8cdbbdb 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -80,13 +80,13 @@ int log_2(unsigned int); boolean getTokenValueFromString(char *, char **, char **); void InitCounter(void); -unsigned long Counter(void); -void Delay(unsigned long); -boolean FrameReached(unsigned long *, unsigned long); -boolean DelayReached(unsigned long *, unsigned long); -void WaitUntilDelayReached(unsigned long *, unsigned long); +unsigned int Counter(void); +void Delay(unsigned int); +boolean FrameReached(unsigned int *, unsigned int); +boolean DelayReached(unsigned int *, unsigned int); +void WaitUntilDelayReached(unsigned int *, unsigned int); -unsigned int init_random_number(int, long); +unsigned int init_random_number(int, int); unsigned int get_random_number(int, int); char *getLoginName(void); @@ -121,11 +121,11 @@ void SetError(char *, ...); char *GetError(void); void Error(int, char *, ...); -void *checked_malloc(unsigned long); -void *checked_calloc(unsigned long); -void *checked_realloc(void *, unsigned long); +void *checked_malloc(unsigned int); +void *checked_calloc(unsigned int); +void *checked_realloc(void *, unsigned int); void checked_free(void *); -void clear_mem(void *, unsigned long); +void clear_mem(void *, unsigned int); void swap_numbers(int *, int *); void swap_number_pairs(int *, int *, int *, int *); @@ -142,11 +142,11 @@ int putFileChunk(FILE *, char *, int, int); int getFileVersion(FILE *); int putFileVersion(FILE *, int); -void ReadBytesFromFile(FILE *, byte *, unsigned long); -void WriteBytesToFile(FILE *, byte *, unsigned long); +void ReadBytesFromFile(FILE *, byte *, unsigned int); +void WriteBytesToFile(FILE *, byte *, unsigned int); -void ReadUnusedBytesFromFile(FILE *, unsigned long); -void WriteUnusedBytesToFile(FILE *, unsigned long); +void ReadUnusedBytesFromFile(FILE *, unsigned int); +void WriteUnusedBytesToFile(FILE *, unsigned int); #define getFile8Bit(f) getFile8BitInteger(f) #define putFile8Bit(f,x) putFile8BitInteger(f,x) diff --git a/src/libgame/msdos.c b/src/libgame/msdos.c index 407752bc..c4c6ff4f 100644 --- a/src/libgame/msdos.c +++ b/src/libgame/msdos.c @@ -329,8 +329,8 @@ Display *XOpenDisplay(char *display_name) Window XCreateSimpleWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, - unsigned int border_width, unsigned long border, - unsigned long background) + unsigned int border_width, unsigned int border, + unsigned int background) { video_bitmap = create_video_bitmap(XRES, YRES); clear_to_color(video_bitmap, background); @@ -381,7 +381,7 @@ void XFree(void *data) checked_free(data); } -GC XCreateGC(Display *display, Drawable d, unsigned long value_mask, +GC XCreateGC(Display *display, Drawable d, unsigned int value_mask, XGCValues *values) { XGCValues *gcv; @@ -811,7 +811,7 @@ int XLookupString(XKeyEvent *key_event, char *buffer, int buffer_size, return 0; } -void XSetForeground(Display *display, GC gc, unsigned long pixel) +void XSetForeground(Display *display, GC gc, unsigned int pixel) { XGCValues *gcv = (XGCValues *)gc; diff --git a/src/libgame/msdos.h b/src/libgame/msdos.h index 95e0dbc0..9d6a2155 100644 --- a/src/libgame/msdos.h +++ b/src/libgame/msdos.h @@ -555,7 +555,7 @@ #define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel) #define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel) #define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root) -#define AllPlanes ((unsigned long)~0L) +#define AllPlanes ((unsigned int)~0L) #define DefaultVisual(dpy, scr) (NULL) #define DefaultDepth(dpy, scr) (NULL) @@ -565,8 +565,8 @@ #define XGetPixel(ximage, x, y) \ ((*((ximage)->f.get_pixel))((ximage), (x), (y))) -typedef unsigned long Pixel; /* Index into colormap */ -typedef unsigned long XID; +typedef unsigned int Pixel; /* Index into colormap */ +typedef unsigned int XID; typedef XID Window; typedef XID Drawable; typedef XID Pixmap; @@ -574,9 +574,9 @@ typedef XID Colormap; typedef XID KeySym; typedef XID GContext; typedef struct _XDisplay Display; -typedef long Visual; -typedef long XVisualInfo; -typedef long Atom; +typedef int Visual; +typedef int XVisualInfo; +typedef int Atom; typedef int Status; typedef int Bool; typedef int XComposeStatus; /* we don't need the real type */ @@ -590,8 +590,8 @@ typedef struct { Colormap cmap; /* default color map */ Window root; /* root window id */ - unsigned long white_pixel; /* white pixel value */ - unsigned long black_pixel; /* black pixel value */ + unsigned int white_pixel; /* white pixel value */ + unsigned int black_pixel; /* black pixel value */ int x; int y; unsigned int width; @@ -610,13 +610,13 @@ typedef struct _XImage { struct funcs { - unsigned long (*get_pixel) (struct _XImage *, int, int); + unsigned int (*get_pixel) (struct _XImage *, int, int); } f; } XImage; typedef struct { - long flags; /* marks which fields in this structure are defined */ + int flags; /* marks which fields in this structure are defined */ int width, height; /* should set so old wm's don't mess up */ int min_width, min_height; int max_width, max_height; @@ -624,7 +624,7 @@ typedef struct typedef struct { - long flags; /* marks which fields in this structure are defined */ + int flags; /* marks which fields in this structure are defined */ Bool input; /* does this application rely on the window manager to get keyboard input? */ int initial_state; /* see below */ @@ -645,13 +645,13 @@ typedef struct typedef struct { - unsigned long foreground; /* foreground pixel */ - unsigned long background; /* background pixel */ + unsigned int foreground; /* foreground pixel */ + unsigned int background; /* background pixel */ Bool graphics_exposures; /* boolean, should exposures be generated */ Pixmap clip_mask; /* bitmap clipping; other calls for rects */ int clip_x_origin; /* x origin for clipping */ int clip_y_origin; /* y origin for clipping */ - unsigned long value_mask; + unsigned int value_mask; int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, @@ -711,10 +711,10 @@ void XMapWindow(Display *, Window); Display *XOpenDisplay(char *); Window XCreateSimpleWindow(Display *, Window, int, int, unsigned int, unsigned int, unsigned int, - unsigned long, unsigned long); + unsigned int, unsigned int); Status XStringListToTextProperty(char **, int, XTextProperty *); void XFree(void *); -GC XCreateGC(Display *, Drawable, unsigned long, XGCValues *); +GC XCreateGC(Display *, Drawable, unsigned int, XGCValues *); void XSetClipMask(Display *, GC, Pixmap); void XSetClipOrigin(Display *, GC, int, int); void XFillRectangle(Display *, Drawable, GC, int, int, @@ -735,7 +735,7 @@ void XNextEvent(Display *, XEvent *); int XPending(Display *); KeySym XLookupKeysym(XKeyEvent *, int); int XLookupString(XKeyEvent *, char *, int, KeySym *, XComposeStatus *); -void XSetForeground(Display *, GC, unsigned long); +void XSetForeground(Display *, GC, unsigned int); void XDrawLine(Display *, Drawable, GC, int, int, int, int); void XDestroyImage(XImage *); void XDestroyWindow(Display *, Window); diff --git a/src/libgame/random.c b/src/libgame/random.c index 92f6ca3a..099fe72b 100644 --- a/src/libgame/random.c +++ b/src/libgame/random.c @@ -129,7 +129,7 @@ position of the rear pointer is just (MAX_TYPES * (rptr - state)) + TYPE_3 == TYPE_3. */ -static long int randtbl_0[DEG_3 + 1] = +static int randtbl_0[DEG_3 + 1] = { TYPE_3, -851904987, -43806228, -2029755270, 1390239686, -1912102820, @@ -139,7 +139,7 @@ static long int randtbl_0[DEG_3 + 1] = -607508183, -205999574, -1696891592, 1492211999, -1528267240, -952028296, -189082757, 362343714, 1424981831, 2039449641, }; -static long int randtbl_1[DEG_3 + 1] = +static int randtbl_1[DEG_3 + 1] = { TYPE_3, -851904987, -43806228, -2029755270, 1390239686, -1912102820, @@ -161,8 +161,8 @@ static long int randtbl_1[DEG_3 + 1] = in the initialization of randtbl) because the state table pointer is set to point to randtbl[1] (as explained below).) */ -static long int *fptr[2] = { &randtbl_0[SEP_3 + 1], &randtbl_1[SEP_3 + 1] }; -static long int *rptr[2] = { &randtbl_0[1], &randtbl_1[1] }; +static int *fptr[2] = { &randtbl_0[SEP_3 + 1], &randtbl_1[SEP_3 + 1] }; +static int *rptr[2] = { &randtbl_0[1], &randtbl_1[1] }; @@ -176,13 +176,13 @@ static long int *rptr[2] = { &randtbl_0[1], &randtbl_1[1] }; indexing every time to find the address of the last element to see if the front and rear pointers have wrapped. */ -static long int *state[2] = { &randtbl_0[1], &randtbl_1[1] }; +static int *state[2] = { &randtbl_0[1], &randtbl_1[1] }; static int rand_type[2] = { TYPE_3, TYPE_3 }; static int rand_deg[2] = { DEG_3, DEG_3 }; static int rand_sep[2] = { SEP_3, SEP_3 }; -static long int *end_ptr[2] = +static int *end_ptr[2] = { &randtbl_0[sizeof(randtbl_0) / sizeof(randtbl_0[0])], &randtbl_1[sizeof(randtbl_1) / sizeof(randtbl_1[0])] @@ -203,7 +203,7 @@ void srandom_linux_libc(int nr, unsigned int x) if (rand_type[nr] != TYPE_0) { - register long int i; + register int i; for (i = 1; i < rand_deg[nr]; ++i) state[nr][i] = (1103515145 * state[nr][i - 1]) + 12345; @@ -227,21 +227,21 @@ void srandom_linux_libc(int nr, unsigned int x) rear pointers can't wrap on the same call by not testing the rear pointer if the front one has wrapped. Returns a 31-bit random number. */ -long int random_linux_libc(int nr) +int random_linux_libc(int nr) { if (rand_type[nr] == TYPE_0) { - state[nr][0] = ((state[nr][0] * 1103515245) + 12345) & LONG_MAX; + state[nr][0] = ((state[nr][0] * 1103515245) + 12345) & INT_MAX; return state[nr][0]; } else { - long int i; + int i; *fptr[nr] += *rptr[nr]; /* Chucking least random bit. */ - i = (*fptr[nr] >> 1) & LONG_MAX; + i = (*fptr[nr] >> 1) & INT_MAX; fptr[nr]++; if (fptr[nr] >= end_ptr[nr]) diff --git a/src/libgame/random.h b/src/libgame/random.h index bde1214d..98b101f1 100644 --- a/src/libgame/random.h +++ b/src/libgame/random.h @@ -15,6 +15,6 @@ #define RANDOM_H void srandom_linux_libc(int, unsigned int); -long int random_linux_libc(int); +int random_linux_libc(int); #endif diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 412779d0..a2cc00ad 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1630,6 +1630,7 @@ SetupFileList *addListEntry(SetupFileList *list, char *token, char *value) return addListEntry(list->next, token, value); } +#if 0 #ifdef DEBUG static void printSetupFileList(SetupFileList *list) { @@ -1642,6 +1643,7 @@ static void printSetupFileList(SetupFileList *list) printSetupFileList(list->next); } #endif +#endif #ifdef DEBUG DEFINE_HASHTABLE_INSERT(insert_hash_entry, char, char); @@ -3061,8 +3063,8 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, char *directory_name) { #if 0 - static unsigned long progress_delay = 0; - unsigned long progress_delay_value = 100; /* (in milliseconds) */ + static unsigned int progress_delay = 0; + unsigned int progress_delay_value = 100; /* (in milliseconds) */ #endif char *directory_path = getPath2(level_directory, directory_name); char *filename = getPath2(directory_path, LEVELINFO_FILENAME); @@ -3625,8 +3627,8 @@ void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node, LevelDirTree *level_node) { #if 0 - static unsigned long progress_delay = 0; - unsigned long progress_delay_value = 100; /* (in milliseconds) */ + static unsigned int progress_delay = 0; + unsigned int progress_delay_value = 100; /* (in milliseconds) */ #endif int type = (*artwork_node)->type; diff --git a/src/libgame/sound.c b/src/libgame/sound.c index d620dd93..0d7ed67c 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -75,8 +75,8 @@ struct SoundHeader_WAV { unsigned short compression_code; unsigned short num_channels; - unsigned long sample_rate; - unsigned long bytes_per_second; + unsigned int sample_rate; + unsigned int bytes_per_second; unsigned short block_align; unsigned short bits_per_sample; }; @@ -98,7 +98,7 @@ struct SampleInfo int type; int format; void *data_ptr; /* pointer to first sample (8 or 16 bit) */ - long data_len; /* number of samples, NOT number of bytes */ + int data_len; /* number of samples, NOT number of bytes */ int num_channels; /* mono: 1 channel, stereo: 2 channels */ }; typedef struct SampleInfo SoundInfo; @@ -114,13 +114,13 @@ struct SoundControl int state; - unsigned long playing_starttime; - unsigned long playing_pos; + unsigned int playing_starttime; + unsigned int playing_pos; int type; int format; void *data_ptr; /* pointer to first sample (8 or 16 bit) */ - long data_len; /* number of samples, NOT number of bytes */ + int data_len; /* number of samples, NOT number of bytes */ int num_channels; /* mono: 1 channel, stereo: 2 channels */ #if defined(TARGET_ALLEGRO) @@ -468,11 +468,11 @@ static void WriteReloadInfoToPipe(char *set_identifier, int type) SoundControl snd_ctrl; TreeInfo *ti = (type == SND_CTRL_RELOAD_SOUNDS ? artwork.snd_current : artwork.mus_current); - unsigned long str_size1 = strlen(leveldir_current->fullpath) + 1; - unsigned long str_size2 = strlen(leveldir_current->sounds_path) + 1; - unsigned long str_size3 = strlen(leveldir_current->music_path) + 1; - unsigned long str_size4 = strlen(ti->basepath) + 1; - unsigned long str_size5 = strlen(ti->fullpath) + 1; + unsigned int str_size1 = strlen(leveldir_current->fullpath) + 1; + unsigned int str_size2 = strlen(leveldir_current->sounds_path) + 1; + unsigned int str_size3 = strlen(leveldir_current->music_path) + 1; + unsigned int str_size4 = strlen(ti->basepath) + 1; + unsigned int str_size5 = strlen(ti->fullpath) + 1; boolean override_level_artwork = (type == SND_CTRL_RELOAD_SOUNDS ? gfx.override_level_sounds : gfx.override_level_music); @@ -500,15 +500,15 @@ static void WriteReloadInfoToPipe(char *set_identifier, int type) write(audio.mixer_pipe[1], ti, sizeof(TreeInfo)) < 0 || write(audio.mixer_pipe[1], &str_size1, - sizeof(unsigned long)) < 0 || + sizeof(unsigned int)) < 0 || write(audio.mixer_pipe[1], &str_size2, - sizeof(unsigned long)) < 0 || + sizeof(unsigned int)) < 0 || write(audio.mixer_pipe[1], &str_size3, - sizeof(unsigned long)) < 0 || + sizeof(unsigned int)) < 0 || write(audio.mixer_pipe[1], &str_size4, - sizeof(unsigned long)) < 0 || + sizeof(unsigned int)) < 0 || write(audio.mixer_pipe[1], &str_size5, - sizeof(unsigned long)) < 0 || + sizeof(unsigned int)) < 0 || write(audio.mixer_pipe[1], leveldir_current->fullpath, str_size1) < 0 || write(audio.mixer_pipe[1], leveldir_current->sounds_path, @@ -531,7 +531,7 @@ static void ReadReloadInfoFromPipe(SoundControl *snd_ctrl) TreeInfo **ti_ptr = ((snd_ctrl->state & SND_CTRL_RELOAD_SOUNDS) ? &artwork.snd_current : &artwork.mus_current); TreeInfo *ti = *ti_ptr; - unsigned long str_size1, str_size2, str_size3, str_size4, str_size5; + unsigned int str_size1, str_size2, str_size3, str_size4, str_size5; static char *set_identifier = NULL; boolean *override_level_artwork = (snd_ctrl->state & SND_CTRL_RELOAD_SOUNDS ? &gfx.override_level_sounds : @@ -562,15 +562,15 @@ static void ReadReloadInfoFromPipe(SoundControl *snd_ctrl) read(audio.mixer_pipe[0], ti, sizeof(TreeInfo)) != sizeof(TreeInfo) || read(audio.mixer_pipe[0], &str_size1, - sizeof(unsigned long)) != sizeof(unsigned long) || + sizeof(unsigned int)) != sizeof(unsigned int) || read(audio.mixer_pipe[0], &str_size2, - sizeof(unsigned long)) != sizeof(unsigned long) || + sizeof(unsigned int)) != sizeof(unsigned int) || read(audio.mixer_pipe[0], &str_size3, - sizeof(unsigned long)) != sizeof(unsigned long) || + sizeof(unsigned int)) != sizeof(unsigned int) || read(audio.mixer_pipe[0], &str_size4, - sizeof(unsigned long)) != sizeof(unsigned long) || + sizeof(unsigned int)) != sizeof(unsigned int) || read(audio.mixer_pipe[0], &str_size5, - sizeof(unsigned long)) != sizeof(unsigned long)) + sizeof(unsigned int)) != sizeof(unsigned int)) Error(ERR_EXIT_SOUND_SERVER, "broken pipe -- no sounds"); leveldir_current->fullpath = checked_calloc(str_size1); @@ -874,7 +874,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) /* don't play sound more than n times simultaneously (with n == 2 for now) */ if (k >= 2) { - unsigned long playing_current = Counter(); + unsigned int playing_current = Counter(); int longest = 0, longest_nr = audio.first_sound_channel; /* look for oldest equal sound */ @@ -925,7 +925,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) if (mixer_active_channels == audio.num_channels - (mixer[audio.music_channel].active ? 0 : 1)) { - unsigned long playing_current = Counter(); + unsigned int playing_current = Counter(); int longest = 0, longest_nr = audio.first_sound_channel; #if 0 @@ -933,8 +933,8 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) /* print some debugging information about audio channel usage */ for (i = audio.first_sound_channel; i < audio.num_channels; i++) { - Error(ERR_INFO, "Mixer_InsertSound: %d [%d]: %ld (%ld)", - i, mixer[i].active, mixer[i].data_len, (long)mixer[i].data_ptr); + Error(ERR_INFO, "Mixer_InsertSound: %d [%d]: %d (%d)", + i, mixer[i].active, mixer[i].data_len, (int)mixer[i].data_ptr); } #endif #endif @@ -1120,7 +1120,7 @@ static void CopySampleToMixingBuffer(SoundControl *snd_ctrl, static void Mixer_Main_DSP() { static short premix_first_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE]; - static long premix_last_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE]; + static int premix_last_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE]; static byte playing_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE]; boolean stereo; int fragment_size; @@ -1148,7 +1148,7 @@ static void Mixer_Main_DSP() /* first clear the last premixing buffer */ clear_mem(premix_last_buffer, - max_sample_size * num_output_channels * sizeof(long)); + max_sample_size * num_output_channels * sizeof(int)); for (i = 0; i < audio.num_channels; i++) { @@ -1203,7 +1203,7 @@ static void Mixer_Main_DSP() if (mixer[i].volume != SOUND_MAX_VOLUME) for (j = 0; j < sample_size * num_output_channels; j++) premix_first_buffer[j] = - mixer[i].volume * (long)premix_first_buffer[j] / SOUND_MAX_VOLUME; + mixer[i].volume * (int)premix_first_buffer[j] / SOUND_MAX_VOLUME; /* adjust left and right channel volume due to stereo sound position */ if (stereo) @@ -1302,7 +1302,7 @@ static int Mixer_Main_SimpleAudio(SoundControl snd_ctrl) if (mixer[i].volume != SOUND_MAX_VOLUME) for (j = 0; j < sample_size; j++) premix_first_buffer[j] = - mixer[i].volume * (long)premix_first_buffer[j] / SOUND_MAX_VOLUME; + mixer[i].volume * (int)premix_first_buffer[j] / SOUND_MAX_VOLUME; /* might be needed for u-law /dev/audio */ for (j = 0; j < sample_size; j++) @@ -1648,8 +1648,8 @@ static void *Load_WAV(char *filename) printf("WAV file: '%s'\n", filename); printf(" Compression code: %d'\n", header.compression_code); printf(" Number of channels: %d'\n", header.num_channels); - printf(" Sample rate: %ld'\n", header.sample_rate); - printf(" Average bytes per second: %ld'\n", header.bytes_per_second); + printf(" Sample rate: %d'\n", header.sample_rate); + printf(" Average bytes per second: %d'\n", header.bytes_per_second); printf(" Block align: %d'\n", header.block_align); printf(" Significant bits per sample: %d'\n", header.bits_per_sample); #endif diff --git a/src/libgame/text.c b/src/libgame/text.c index 23de7cac..9d4d1193 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -28,7 +28,7 @@ static GC font_clip_gc = None; static void InitFontClipmasks() { XGCValues clip_gc_values; - unsigned long clip_gc_valuemask; + unsigned int clip_gc_valuemask; GC copy_clipmask_gc; int i, j; @@ -210,8 +210,8 @@ int maxWordLengthInString(char *text) void DrawInitTextExt(char *text, int ypos, int font_nr, boolean force) { - static unsigned long progress_delay = 0; - unsigned long progress_delay_value = 100; /* (in milliseconds) */ + static unsigned int progress_delay = 0; + unsigned int progress_delay_value = 100; /* (in milliseconds) */ UPDATE_BUSY_STATE(); diff --git a/src/libgame/toons.c b/src/libgame/toons.c index 300ae70b..264cda43 100644 --- a/src/libgame/toons.c +++ b/src/libgame/toons.c @@ -186,13 +186,13 @@ void DrawAnim(Bitmap *toon_bitmap, GC toon_clip_gc, boolean AnimateToon(int toon_nr, boolean restart) { - static unsigned long animation_frame_counter = 0; + static unsigned int animation_frame_counter = 0; static int pos_x = 0, pos_y = 0; static int delta_x = 0, delta_y = 0; static int frame = 0; static boolean horiz_move, vert_move; - static unsigned long anim_delay = 0; - static unsigned long anim_delay_value = 0; + static unsigned int anim_delay = 0; + static unsigned int anim_delay_value = 0; static int width,height; static int pad_x,pad_y; static int cut_x,cut_y; @@ -342,8 +342,8 @@ boolean AnimateToon(int toon_nr, boolean restart) void HandleAnimation(int mode) { - static unsigned long animstart_delay = -1; - static unsigned long animstart_delay_value = 0; + static unsigned int animstart_delay = -1; + static unsigned int animstart_delay_value = 0; static boolean anim_running = FALSE; static boolean anim_restart = TRUE; static boolean reset_delay = TRUE; diff --git a/src/libgame/x11.c b/src/libgame/x11.c index f95c3da9..66f4a3ef 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -110,7 +110,7 @@ static DrawWindow *X11InitWindow() DrawWindow *new_window = CreateBitmapStruct(); unsigned int border_width = 4; XGCValues gc_values; - unsigned long gc_valuemask; + unsigned int gc_valuemask; #if !defined(PLATFORM_MSDOS) XTextProperty windowName, iconName; Pixmap icon_pixmap, iconmask_pixmap; @@ -121,13 +121,13 @@ static DrawWindow *X11InitWindow() XClassHint class_hints; char *window_name = program.window_title; char *icon_name = program.window_title; - long window_event_mask; + int window_event_mask; Atom proto_atom = None, delete_atom = None; #endif int screen_width, screen_height; int win_xpos, win_ypos; - unsigned long pen_fg = WhitePixel(display, screen); - unsigned long pen_bg = BlackPixel(display, screen); + unsigned int pen_fg = WhitePixel(display, screen); + unsigned int pen_bg = BlackPixel(display, screen); const int width = video.width, height = video.height; int i; @@ -289,7 +289,7 @@ Bitmap *X11LoadImage(char *filename) char *error = "Read_PCX_to_Pixmap(): %s '%s'"; int pcx_err; XGCValues clip_gc_values; - unsigned long clip_gc_valuemask; + unsigned int clip_gc_valuemask; pcx_err = Read_PCX_to_Pixmap(display, window->drawable, window->gc, filename, &new_bitmap->drawable, &new_bitmap->clip_mask); diff --git a/src/main.h b/src/main.h index f319e55f..75d882b4 100644 --- a/src/main.h +++ b/src/main.h @@ -2618,7 +2618,7 @@ struct ElementInfo /* ---------- special element property values ---------- */ - unsigned long properties[NUM_EP_BITFIELDS]; /* element base properties */ + unsigned int properties[NUM_EP_BITFIELDS]; /* element base properties */ boolean use_gfx_element; /* use custom graphic element */ int gfx_element_initial; /* initial optional custom graphic element */ diff --git a/src/netserv.c b/src/netserv.c index ac1b71c4..4a834923 100644 --- a/src/netserv.c +++ b/src/netserv.c @@ -77,7 +77,7 @@ static unsigned char realbuffer[512], *buffer = realbuffer + 4; static int interrupt; -static unsigned long ServerFrameCounter = 0; +static unsigned int ServerFrameCounter = 0; static void addtobuffer(struct NetworkServerPlayerInfo *player, unsigned char *b, int len) diff --git a/src/network.c b/src/network.c index fd98b62d..e5e3d859 100644 --- a/src/network.c +++ b/src/network.c @@ -308,7 +308,7 @@ void SendToServer_NrWanted(int nr_wanted) void SendToServer_StartPlaying() { - unsigned long new_random_seed = InitRND(level.random_seed); + unsigned int new_random_seed = InitRND(level.random_seed); int dummy = 0; /* !!! HAS NO MEANING ANYMORE !!! */ /* the name of the level must be enough */ @@ -503,7 +503,7 @@ static void Handle_OP_START_PLAYING() LevelDirTree *new_leveldir; int new_level_nr; int dummy; - unsigned long new_random_seed; + unsigned int new_random_seed; char *new_leveldir_identifier; new_level_nr = (buffer[2] << 8) + buffer[3]; diff --git a/src/screens.c b/src/screens.c index 129d0263..5fde5b2c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1448,7 +1448,7 @@ static void gotoTopLevelDir() void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { - static unsigned long title_delay = 0; + static unsigned int title_delay = 0; static int title_screen_nr = 0; static int last_sound = -1, last_music = -1; boolean return_to_main_menu = FALSE; @@ -2335,7 +2335,7 @@ void DrawInfoScreen_Elements() void HandleInfoScreen_Elements(int button) { - static unsigned long info_delay = 0; + static unsigned int info_delay = 0; static int num_anims; static int num_pages; static int page; @@ -5913,7 +5913,7 @@ static struct static void CreateScreenMenubuttons() { struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int i; for (i = 0; i < NUM_SCREEN_MENUBUTTONS; i++) @@ -5966,7 +5966,7 @@ static void CreateScreenMenubuttons() static void CreateScreenScrollbuttons() { struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int i; /* these values are not constant, but can change at runtime */ @@ -6046,7 +6046,7 @@ static void CreateScreenScrollbars() int gd_x1, gd_x2, gd_y1, gd_y2; struct GadgetInfo *gi; int items_max, items_visible, item_position; - unsigned long event_mask; + unsigned int event_mask; int num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN; int id = scrollbar_info[i].gadget_id; diff --git a/src/tape.c b/src/tape.c index cf72eda3..2cc1571b 100644 --- a/src/tape.c +++ b/src/tape.c @@ -186,7 +186,7 @@ static struct GadgetInfo *tape_gadget[NUM_TAPE_BUTTONS]; /* video display functions */ /* ========================================================================= */ -void DrawVideoDisplay(unsigned long state, unsigned long value) +void DrawVideoDisplay(unsigned int state, unsigned int value) { int i, j, k; static char *monatsname[12] = @@ -677,12 +677,12 @@ static void TapeRewind() InitRND(tape.random_seed); } -static void TapeSetRandomSeed(long random_seed) +static void TapeSetRandomSeed(int random_seed) { tape.random_seed = InitRND(random_seed); } -void TapeStartRecording(long random_seed) +void TapeStartRecording(int random_seed) { if (!TAPE_IS_STOPPED(tape)) TapeStop(); diff --git a/src/tape.h b/src/tape.h index af32eb38..6a5107cb 100644 --- a/src/tape.h +++ b/src/tape.h @@ -146,11 +146,11 @@ struct TapeInfo char *level_identifier; int level_nr; - unsigned long random_seed; - unsigned long date; - unsigned long counter; - unsigned long length; - unsigned long length_seconds; + unsigned int random_seed; + unsigned int date; + unsigned int counter; + unsigned int length; + unsigned int length_seconds; unsigned int delay_played; boolean pause_before_death; boolean recording, playing, pausing; @@ -182,7 +182,7 @@ struct TapeInfo }; -void DrawVideoDisplay(unsigned long, unsigned long); +void DrawVideoDisplay(unsigned int, unsigned int); void DrawCompleteVideoDisplay(void); void TapeDeactivateDisplayOn(); @@ -191,7 +191,7 @@ void TapeDeactivateDisplayOff(boolean); void TapeSetDateFromEpochSeconds(time_t); void TapeSetDateFromNow(); -void TapeStartRecording(long); +void TapeStartRecording(int); void TapeHaltRecording(void); void TapeStopRecording(void); void TapeRecordAction(byte *); diff --git a/src/tools.c b/src/tools.c index c89ef367..588f7f8e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2478,7 +2478,7 @@ void AnimateEnvelope(int envelope_nr, int anim_mode, int action) int mask_mode = (src_bitmap != NULL ? BLIT_MASKED : BLIT_ON_BACKGROUND); boolean ffwd_delay = (tape.playing && tape.fast_forward); boolean no_delay = (tape.warp_forward); - unsigned long anim_delay = 0; + unsigned int anim_delay = 0; int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay); int anim_delay_value = (no_delay ? 0 : frame_delay_value); int font_nr = FONT_ENVELOPE_1 + envelope_nr; @@ -2540,7 +2540,7 @@ void AnimateEnvelopeDoor(char *text, int anim_mode, int action) int mask_mode = (src_bitmap != NULL ? BLIT_MASKED : BLIT_ON_BACKGROUND); boolean ffwd_delay = (tape.playing && tape.fast_forward); boolean no_delay = (tape.warp_forward); - unsigned long anim_delay = 0; + unsigned int anim_delay = 0; int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay); int anim_delay_value = (no_delay ? 0 : frame_delay_value); #if 1 @@ -3050,11 +3050,11 @@ static void DrawPreviewLevelLabelExt(int mode) void DrawPreviewLevel(boolean restart) { - static unsigned long scroll_delay = 0; - static unsigned long label_delay = 0; + static unsigned int scroll_delay = 0; + static unsigned int label_delay = 0; static int from_x, from_y, scroll_direction; static int label_state, label_counter; - unsigned long scroll_delay_value = preview.step_delay; + unsigned int scroll_delay_value = preview.step_delay; boolean show_level_border = (BorderElement != EL_EMPTY); int level_xsize = lev_fieldx + (show_level_border ? 2 : 0); int level_ysize = lev_fieldy + (show_level_border ? 2 : 0); @@ -4308,8 +4308,8 @@ unsigned int MoveDoor(unsigned int door_state) { static int door1 = DOOR_OPEN_1; static int door2 = DOOR_CLOSE_2; - unsigned long door_delay = 0; - unsigned long door_delay_value; + unsigned int door_delay = 0; + unsigned int door_delay_value; int stepsize = 1; if (door_1.width < 0 || door_1.width > DXSIZE) @@ -4728,7 +4728,7 @@ void CreateToolButtons() Bitmap *deco_bitmap = None; int deco_x = 0, deco_y = 0, deco_xpos = 0, deco_ypos = 0; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int gd_xoffset, gd_yoffset; int gd_x1, gd_x2, gd_y; int id = i; @@ -7211,7 +7211,7 @@ int getGameFrameDelay_EM(int native_em_game_frame_delay) return game_frame_delay_value; } -unsigned int InitRND(long seed) +unsigned int InitRND(int seed) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) return InitEngineRandom_EM(seed); diff --git a/src/tools.h b/src/tools.h index fb4ab278..d834df77 100644 --- a/src/tools.h +++ b/src/tools.h @@ -218,7 +218,7 @@ int getBeltElementFromBeltNrAndBeltDir(int, int); int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int); int getBeltSwitchElementFromBeltNrAndBeltDir(int, int); -unsigned int InitRND(long); +unsigned int InitRND(int); void InitGraphicInfo_EM(void); void PlayMenuSoundExt(int);