+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)
-#define COMPILE_DATE_STRING "2011-03-22 09:01"
+#define COMPILE_DATE_STRING "2011-10-07 23:26"
{
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 */
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;
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;
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;
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;
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;
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;
{
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 */
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)
{
{
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;
{
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;
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;
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
}
break;
- case KSYM_S:
+ case KSYM_s:
if (!global.fps_slowdown)
{
global.fps_slowdown = TRUE;
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))
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 */
{
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 */
{
}
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);
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];
/* 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++)
{
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++;
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
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)
{
/* random generator functions */
/* ------------------------------------------------------------------------- */
-unsigned int InitEngineRandom_RND(long seed)
+unsigned int InitEngineRandom_RND(int seed)
{
game.num_random_calls = 0;
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++)
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;
boolean set_centered_player;
/* values for random number generator initialization after snapshot */
- unsigned long num_random_calls;
+ unsigned int num_random_calls;
};
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;
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();
void RequestQuitGameExt(boolean, boolean, char *);
void RequestQuitGame(boolean);
-unsigned int InitEngineRandom_RND(long);
+unsigned int InitEngineRandom_RND(int);
unsigned int RND(int);
void FreeEngineSnapshot();
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];
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);
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);
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);
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] =
{
clear_mem(play, sizeof(play));
}
-unsigned int InitEngineRandom_EM(long seed)
+unsigned int InitEngineRandom_EM(int seed)
{
if (seed == NEW_RANDOMIZE)
{
#include "main_em.h"
-unsigned long RandomEM;
+unsigned int RandomEM;
struct LEVEL lev;
struct PLAYER ply[MAX_PLAYERS];
/* exported variables */
/* ------------------------------------------------------------------------- */
-extern unsigned long RandomEM;
+extern unsigned int RandomEM;
extern struct LEVEL lev;
extern struct PLAYER ply[MAX_PLAYERS];
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 */
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;
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)
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)
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;
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;
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;
{
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;
void subRandomize()
{
- long Tick = MyGetTickCount();
+ int Tick = MyGetTickCount();
RandomSeed = (Tick ^ (Tick >> 16)) & 0xFFFF;
}
#include <math.h>
-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
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) ||
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)
#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];
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 */
int ExplosionShake, ExplosionShakeMurphy;
boolean NoDisplayFlag;
-long DisplayMinX, DisplayMaxX;
-long DisplayMinY, DisplayMaxY;
+int DisplayMinX, DisplayMaxX;
+int DisplayMinY, DisplayMaxY;
void subDisplayLevel()
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;
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 */
int HeaderSize; // standard size = 96
int FieldMax, LevelMax;
#if 0
-long FileMax;
+int FileMax;
#endif
#if 1
int MurphyScreenXPos, MurphyScreenYPos;
int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos;
int KillMurphyFlag, MurphyMoveCounter;
-long YawnSleepCounter;
+int YawnSleepCounter;
int MurphyVarFaceLeft;
int ScratchGravity, GravityFlag;
int RedDiskReleaseFlag, MovingPictureSequencePhase;
#define True (!False)
#endif
-#define ScrollDelta ((long)1)
+#define ScrollDelta ((int)1)
#if NEW_TILESIZE
// #define ZoomFactor (ZOOM_FACTOR)
{
int Width;
int Height;
- long OffSet;
- long Size;
+ int OffSet;
+ int Size;
} LevelDescriptor;
#define HAS_LevelDescriptor
#endif
extern short RandomSeed;
#if 0
-extern long FileMax;
+extern int FileMax;
#endif
extern LevelInfoType LInfo;
extern int ScratchGravity, GravityFlag;
extern int SnikSnaksElectronsFrozen;
extern int YellowDisksExploded;
-extern long YawnSleepCounter;
+extern int YawnSleepCounter;
#endif /* GLOBALS_H */
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();
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;
}
#endif
-long MyGetTickCount()
+int MyGetTickCount()
{
return random_linux_libc(RANDOM_SIMPLE);
}
extern void *REDIM_1D(int, int, int);
#endif
-extern long MyGetTickCount();
+extern int MyGetTickCount();
#endif /* VB_LIB_H */
{
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;
#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);
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
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;
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? */
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)
#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 *);
static int JoystickPositionPercent(int center, int border, int actual)
{
- long range, position;
+ int range, position;
int percent;
if (border < center && actual > center)
/* ------------------------------------------------------------------------- */
#if defined(PLATFORM_MSDOS)
-volatile unsigned long counter = 0;
+volatile unsigned int counter = 0;
void increment_counter()
{
#if 1
#ifdef TARGET_SDL
-static unsigned long getCurrentMS()
+static unsigned int getCurrentMS()
{
return SDL_GetTicks();
}
#else /* !TARGET_SDL */
#if defined(PLATFORM_UNIX)
-static unsigned long getCurrentMS()
+static unsigned int getCurrentMS()
{
struct timeval current_time;
#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();
#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();
#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);
#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);
#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);
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)
}
}
-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)
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)
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)
{
/* 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 */
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
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 */
#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)
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);
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");
/* checked memory allocation and freeing functions */
/* ------------------------------------------------------------------------- */
-void *checked_malloc(unsigned long size)
+void *checked_malloc(unsigned int size)
{
void *ptr;
return ptr;
}
-void *checked_calloc(unsigned long size)
+void *checked_calloc(unsigned int size)
{
void *ptr;
return ptr;
}
-void *checked_realloc(void *ptr, unsigned long size)
+void *checked_realloc(void *ptr, unsigned int size)
{
ptr = realloc(ptr, size);
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 */
return 4;
}
-void ReadBytesFromFile(FILE *file, byte *buffer, unsigned long bytes)
+void ReadBytesFromFile(FILE *file, byte *buffer, unsigned int bytes)
{
int i;
buffer[i] = fgetc(file);
}
-void WriteBytesToFile(FILE *file, byte *buffer, unsigned long bytes)
+void WriteBytesToFile(FILE *file, byte *buffer, unsigned int bytes)
{
int i;
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);
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;
}
else if (strPrefix(name_ptr, "0x"))
{
- unsigned long value = 0;
+ unsigned int value = 0;
name_ptr += 2;
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();
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);
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 *);
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)
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);
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;
return 0;
}
-void XSetForeground(Display *display, GC gc, unsigned long pixel)
+void XSetForeground(Display *display, GC gc, unsigned int pixel)
{
XGCValues *gcv = (XGCValues *)gc;
#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)
#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;
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 */
{
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;
{
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;
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 */
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,
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,
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);
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,
-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,
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] };
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])]
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;
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])
#define RANDOM_H
void srandom_linux_libc(int, unsigned int);
-long int random_linux_libc(int);
+int random_linux_libc(int);
#endif
return addListEntry(list->next, token, value);
}
+#if 0
#ifdef DEBUG
static void printSetupFileList(SetupFileList *list)
{
printSetupFileList(list->next);
}
#endif
+#endif
#ifdef DEBUG
DEFINE_HASHTABLE_INSERT(insert_hash_entry, char, char);
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);
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;
{
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;
};
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;
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)
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);
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,
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 :
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);
/* 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 */
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
/* 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
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;
/* 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++)
{
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)
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++)
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
static void InitFontClipmasks()
{
XGCValues clip_gc_values;
- unsigned long clip_gc_valuemask;
+ unsigned int clip_gc_valuemask;
GC copy_clipmask_gc;
int i, j;
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();
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;
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;
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;
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;
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);
/* ---------- 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 */
static int interrupt;
-static unsigned long ServerFrameCounter = 0;
+static unsigned int ServerFrameCounter = 0;
static void addtobuffer(struct NetworkServerPlayerInfo *player,
unsigned char *b, int len)
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 */
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];
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;
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;
static void CreateScreenMenubuttons()
{
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int i;
for (i = 0; i < NUM_SCREEN_MENUBUTTONS; i++)
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 */
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;
/* 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] =
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();
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;
};
-void DrawVideoDisplay(unsigned long, unsigned long);
+void DrawVideoDisplay(unsigned int, unsigned int);
void DrawCompleteVideoDisplay(void);
void TapeDeactivateDisplayOn();
void TapeSetDateFromEpochSeconds(time_t);
void TapeSetDateFromNow();
-void TapeStartRecording(long);
+void TapeStartRecording(int);
void TapeHaltRecording(void);
void TapeStopRecording(void);
void TapeRecordAction(byte *);
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;
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
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);
{
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)
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;
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);
int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int);
int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
-unsigned int InitRND(long);
+unsigned int InitRND(int);
void InitGraphicInfo_EM(void);
void PlayMenuSoundExt(int);