}
else /********** KONTROLL-FENSTER **********/
{
- static long choice_delay = 0;
+ static int choice_delay = 0;
int choice = CheckCountButtons(mx,my,button);
int step = (button==1 ? 1 : button==2 ? 5 : button==3 ? 10 : 0);
}
}
-void DrawEditButton(unsigned long state)
+void DrawEditButton(unsigned int state)
{
int i;
int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
redraw_mask |= REDRAW_DOOR_2;
}
-void DrawCtrlButton(unsigned long state)
+void DrawCtrlButton(unsigned int state)
{
int i;
int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
void ScrollMiniLevel(int, int, int);
void LevelEd(int, int, int);
void LevelNameTyping(KeySym);
-void DrawEditButton(unsigned long state);
-void DrawCtrlButton(unsigned long state);
+void DrawEditButton(unsigned int state);
+void DrawCtrlButton(unsigned int state);
void DrawElemButton(int, int);
void DrawCountButton(int, int);
int CheckEditButtons(int, int, int);
case SETUP:
{
int dx = 0, dy = 0;
- static long joystickmove_delay = 0;
+ static int joystickmove_delay = 0;
if (DelayReached(&joystickmove_delay,15) || button)
{
char filename[MAX_FILENAME];
char cookie[MAX_FILENAME];
FILE *file;
+ int ignored;
sprintf(filename,"%s/%s",LEVEL_PATH,LEVDIR_FILENAME);
CloseAll();
}
- fscanf(file,"%s\n",cookie);
+ ignored = fscanf(file,"%s\n",cookie);
if (strcmp(cookie,LEVELDIR_COOKIE)) /* ungültiges Format? */
{
fprintf(stderr,"%s: wrong format of level info file!\n",progname);
leveldir_nr = 0;
for(i=0;i<MAX_LEVDIR_ENTRIES;i++)
{
- fscanf(file,"%s",leveldir[i].filename);
- fscanf(file,"%s",leveldir[i].name);
- fscanf(file,"%d",&leveldir[i].num_ready);
- fscanf(file,"%d",&leveldir[i].num_free);
+ ignored = fscanf(file,"%s",leveldir[i].filename);
+ ignored = fscanf(file,"%s",leveldir[i].name);
+ ignored = fscanf(file,"%d",&leveldir[i].num_ready);
+ ignored = fscanf(file,"%d",&leveldir[i].num_free);
if (feof(file))
break;
char filename[MAX_FILENAME];
char cookie[MAX_FILENAME];
FILE *file;
+ char *ignored;
sprintf(filename,"%s/%s/%d",
LEVEL_PATH,leveldir[leveldir_nr].filename,level_nr);
}
else
{
- fgets(cookie,LEVEL_COOKIE_LEN,file);
+ ignored = fgets(cookie,LEVEL_COOKIE_LEN,file);
fgetc(file);
if (strcmp(cookie,LEVEL_COOKIE)) /* ungültiges Format? */
{
char filename[MAX_FILENAME];
char cookie[MAX_FILENAME];
FILE *file;
+ char *ignored;
sprintf(filename,"%s/%s/%d.tape",
LEVEL_PATH,leveldir[leveldir_nr].filename,level_nr);
if ((file=fopen(filename,"r")))
{
- fgets(cookie,LEVELREC_COOKIE_LEN,file);
+ ignored = fgets(cookie,LEVELREC_COOKIE_LEN,file);
fgetc(file);
if (strcmp(cookie,LEVELREC_COOKIE)) /* ungültiges Format? */
{
char filename[MAX_FILENAME];
char cookie[MAX_FILENAME];
FILE *file;
+ char *ignored;
sprintf(filename,"%s/%s/%s",
SCORE_PATH,leveldir[leveldir_nr].filename,SCORE_FILENAME);
if (file)
{
- fgets(cookie,SCORE_COOKIE_LEN,file);
+ ignored = fgets(cookie,SCORE_COOKIE_LEN,file);
if (strcmp(cookie,SCORE_COOKIE)) /* ungültiges Format? */
{
fprintf(stderr,"%s: wrong format of score file!\n",progname);
FILE *file;
char *login_name = GetLoginName();
struct PlayerInfo default_player, new_player;
+ char *ignored;
if (mode==PLAYER_LEVEL)
sprintf(filename,"%s/%s/%s",
if (file)
{
- fgets(cookie,NAMES_COOKIE_LEN,file);
+ ignored = fgets(cookie,NAMES_COOKIE_LEN,file);
if (strcmp(cookie,NAMES_COOKIE)) /* ungültiges Format? */
{
fprintf(stderr,"%s: wrong format of names file '%s'!\n",
char cookie[MAX_FILENAME];
FILE *file;
struct PlayerInfo default_player;
+ char *ignored;
if (mode==PLAYER_LEVEL)
sprintf(filename,"%s/%s/%s",
return;
}
- fgets(cookie,NAMES_COOKIE_LEN,file);
+ ignored = fgets(cookie,NAMES_COOKIE_LEN,file);
if (strcmp(cookie,NAMES_COOKIE)) /* ungültiges Format? */
{
fprintf(stderr,"%s: wrong format of names file '%s'!\n",
#ifdef ONE_PER_NAME
put_into_list:
#endif
- sprintf(highscore[k].Name,player.alias_name);
+ sprintf(highscore[k].Name,"%s",player.alias_name);
highscore[k].Score = Score;
position = k;
break;
void AmoebeWaechst(int x, int y)
{
- static long sound_delay = 0;
+ static int sound_delay = 0;
static int sound_delay_value = 0;
CheckExploding=TRUE;
int GameActions(int mx, int my, int button)
{
- static long time_delay=0, action_delay=0;
+ static int time_delay=0, action_delay=0;
int Action;
if (TimeLeft>0 && DelayReached(&time_delay,100) && !tape.pausing)
BOOL MoveFigure(int dx, int dy)
{
- static long move_delay = 0;
+ static int move_delay = 0;
int moved = MF_NO_ACTION;
if (GameOver || (!dx && !dy))
{
int dx=x-JX, dy=y-JY;
int element;
- static long push_delay = 0;
+ static int push_delay = 0;
static int push_delay_value = 20;
if (mode==DF_NO_PUSH)
tape.length = 0;
}
-void DrawVideoDisplay(unsigned long state, unsigned long value)
+void DrawVideoDisplay(unsigned int state, unsigned int value)
{
int i;
int part1 = 0, part2 = 1;
redraw_mask |= REDRAW_VIDEO_3;
}
-void DrawSoundDisplay(unsigned long state)
+void DrawSoundDisplay(unsigned int state)
{
int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
redraw_mask |= REDRAW_DOOR_1;
}
-void DrawGameButton(unsigned long state)
+void DrawGameButton(unsigned int state)
{
int pos, cx = DOOR_GFX_PAGEX4, cy = -GAME_BUTTON_YSIZE;
redraw_mask |= REDRAW_DOOR_1;
}
-void DrawChooseButton(unsigned long state)
+void DrawChooseButton(unsigned int state)
{
int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
redraw_mask |= REDRAW_DOOR_1;
}
-void DrawConfirmButton(unsigned long state)
+void DrawConfirmButton(unsigned int state)
{
int cx = DOOR_GFX_PAGEX4, cy = 0;
BOOL TapePlayDelay(void);
void TapeStop(void);
void TapeErase(void);
-void DrawVideoDisplay(unsigned long, unsigned long);
-void DrawSoundDisplay(unsigned long);
-void DrawGameButton(unsigned long);
-void DrawChooseButton(unsigned long);
-void DrawConfirmButton(unsigned long);
+void DrawVideoDisplay(unsigned int, unsigned int);
+void DrawSoundDisplay(unsigned int);
+void DrawGameButton(unsigned int);
+void DrawChooseButton(unsigned int);
+void DrawConfirmButton(unsigned int);
#endif
XClassHint class_hints;
XTextProperty windowName, iconName;
XGCValues gc_values;
- unsigned long gc_valuemask;
+ unsigned int gc_valuemask;
char *window_name = "Rocks'n'Diamonds";
char *icon_name = "Rocks'n'Diamonds";
- long window_event_mask;
+ int window_event_mask;
width = WIN_XSIZE;
height = WIN_YSIZE;
unsigned int width,height;
int hot_x,hot_y;
XGCValues gc_values;
- unsigned long gc_valuemask;
+ unsigned int gc_valuemask;
XGCValues clip_gc_values;
- unsigned long clip_gc_valuemask;
+ unsigned int clip_gc_valuemask;
char filename[256];
Pixmap shapemask;
int joystick_device = 0;
char *joystick_device_name[2] = { DEV_JOYSTICK_0, DEV_JOYSTICK_1 };
int width, height;
-unsigned long pen_fg, pen_bg;
+unsigned int pen_fg, pen_bg;
int game_status = MAINMENU;
int button_status = MB_NOT_PRESSED, motion_status = FALSE;
{
int level_nr;
unsigned int random_seed;
- unsigned long date;
- unsigned long counter;
- unsigned long length;
+ unsigned int date;
+ unsigned int counter;
+ unsigned int length;
BOOL recording, playing, pausing;
struct
{
int yupper, ylower, ymiddle;
};
+struct SoundHeader_SUN
+{
+ unsigned int magic;
+ unsigned int hdr_size;
+ unsigned int data_size;
+ unsigned int encoding;
+ unsigned int sample_rate;
+ unsigned int channels;
+};
+
+struct SoundHeader_8SVX
+{
+ char magic_FORM[4];
+ unsigned int chunk_size;
+ char magic_8SVX[4];
+};
+
+struct SoundInfo
+{
+ char *name;
+ char *file_ptr, *data_ptr;
+ int file_len, data_len;
+};
+
+struct SoundControl
+{
+ int nr;
+ int volume;
+ int stereo;
+ BOOL active;
+ BOOL loop;
+ BOOL fade_sound;
+ BOOL stop_sound;
+ BOOL stop_all_sounds;
+ int playingtime;
+ int playingpos;
+ int data_len;
+ char *data_ptr;
+};
+
extern Display *display;
extern int screen;
extern Window window;
extern int joystick_device;
extern char *joystick_device_name[2];
extern int width, height;
-extern unsigned long pen_fg, pen_bg;
+extern unsigned int pen_fg, pen_bg;
extern int game_status;
extern int button_status, motion_status;
#include <sys/param.h>
#include <sys/types.h>
-void microsleep(unsigned long usec)
+void microsleep(unsigned int usec)
{
struct timeval delay;
progname);
}
-unsigned long be2long(unsigned long *be) /* big-endian -> longword */
+unsigned int be2int(unsigned int *be) /* big-endian -> longword */
{
unsigned char *ptr = (unsigned char *)be;
return(rand() % max);
}
-unsigned int InitRND(long seed)
+unsigned int InitRND(int seed)
{
struct timeval current_time;
void HandleAnimation(int mode)
{
- static long animstart_delay = -1;
- static long animstart_delay_value = 0;
+ static int animstart_delay = -1;
+ static int animstart_delay_value = 0;
static BOOL anim_restart = TRUE;
static BOOL reset_delay = TRUE;
static int toon_nr = 0;
static delta_x = 0, delta_y = 0;
static int frame = 0, frame_step = 1;
static BOOL horiz_move, vert_move;
- static long anim_delay = 0;
+ static int anim_delay = 0;
static int anim_delay_value = 0;
struct AnimInfo *anim = &toon[toon_nr];
static int width,height;
#define NEW_RANDOMIZE -1
-void microsleep(unsigned long);
-unsigned long be2long(unsigned long *);
+void microsleep(unsigned int);
+unsigned int be2int(unsigned int *);
char *int2str(int, int);
unsigned int RND(unsigned int);
-unsigned int InitRND(long);
+unsigned int InitRND(int);
char *GetLoginName(void);
void InitAnimation(void);
(x==15 && level_nr<LEVELDIR_SIZE(leveldir[leveldir_nr]))) &&
button)
{
- static long level_delay = 0;
+ static int level_delay = 0;
int step = (button==1 ? 1 : button==2 ? 5 : 10);
if (!DelayReached(&level_delay,20))
#define HA_NEXT -999
#define HA_END -1000
-static long helpscreen_state;
+static int helpscreen_state;
static int helpscreen_step[MAX_HELPSCREEN_ELS];
static int helpscreen_frame[MAX_HELPSCREEN_ELS];
static int helpscreen_delay[MAX_HELPSCREEN_ELS];
void HandleHelpScreen(int button)
{
- static long hs_delay = 0;
+ static int hs_delay = 0;
int num_helpscreen_els_pages =
(num_helpscreen_els + MAX_HELPSCREEN_ELS-1) / MAX_HELPSCREEN_ELS;
int button_released = !button;
{
struct timeval delay = { 0, 0 };
char *sample_ptr;
- long sample_size, max_sample_size;
- long fragment_size;
+ int sample_size, max_sample_size;
+ int fragment_size;
BOOL stereo;
+ ssize_t ignored;
if (playing_sounds || (sound_device=open(sound_device_name,O_WRONLY))>=0)
{
}
/* finally play the sound fragment */
- write(sound_device,playing_buffer,fragment_size);
+ ignored = write(sound_device,playing_buffer,fragment_size);
}
/* if no sounds playing, free device for other sound programs */
{
struct timeval delay = { 0, 0 };
char *sample_ptr;
- long sample_size, max_sample_size = SND_BLOCKSIZE;
- long sample_rate = 8000; /* standard "/dev/audio" sampling rate */
+ int sample_size, max_sample_size = SND_BLOCKSIZE;
+ int sample_rate = 8000; /* standard "/dev/audio" sampling rate */
int wait_percent = 90; /* wait 90% of the real playing time */
int i;
snd_hdr = (struct SoundHeader_8SVX *)snd_info->file_ptr;
if (strncmp(snd_hdr->magic_FORM,"FORM",4) ||
- snd_info->file_len!=be2long(&snd_hdr->chunk_size)+8 ||
+ snd_info->file_len!=be2int(&snd_hdr->chunk_size)+8 ||
strncmp(snd_hdr->magic_8SVX,"8SVX",4))
{
fprintf(stderr,"%s: '%s' is not an IFF/8SVX file or broken- no sounds\n",
{
if (!strncmp(ptr,"VHDR",4))
{
- ptr+=be2long((unsigned long *)(ptr+4));
+ ptr+=be2int((unsigned int *)(ptr+4));
}
if (!strncmp(ptr,"ANNO",4))
{
- ptr+=be2long((unsigned long *)(ptr+4));
+ ptr+=be2int((unsigned int *)(ptr+4));
}
if (!strncmp(ptr,"CHAN",4))
{
- ptr+=be2long((unsigned long *)(ptr+4));
+ ptr+=be2int((unsigned int *)(ptr+4));
}
if (!strncmp(ptr,"BODY",4))
{
snd_info->data_ptr = ptr+8;
- snd_info->data_len = be2long((unsigned long *)(ptr+4));
+ snd_info->data_len = be2int((unsigned int *)(ptr+4));
return(TRUE);
}
ptr++;
#define VOXWARE
#endif
/* where is the right declaration for 'ioctl'? */
-extern void ioctl(long, long, void *);
+extern void ioctl(int, int, void *);
#endif
#define SND_BLOCKSIZE 4096
#define SOUND_STATUS SOUND_AVAILABLE
#endif
-struct SoundHeader_SUN
-{
- unsigned long magic;
- unsigned long hdr_size;
- unsigned long data_size;
- unsigned long encoding;
- unsigned long sample_rate;
- unsigned long channels;
-};
-
-struct SoundHeader_8SVX
-{
- char magic_FORM[4];
- unsigned long chunk_size;
- char magic_8SVX[4];
-};
-
-struct SoundInfo
-{
- char *name;
- char *file_ptr, *data_ptr;
- long file_len, data_len;
-};
-
-struct SoundControl
-{
- int nr;
- int volume;
- int stereo;
- BOOL active;
- BOOL loop;
- BOOL fade_sound;
- BOOL stop_sound;
- BOOL stop_all_sounds;
- int playingtime;
- long playingpos;
- long data_len;
- char *data_ptr;
-};
-
/* function from "misc.c" */
-unsigned long be2long(unsigned long *);
+unsigned int be2int(unsigned int *);
/* sound server functions */
void SoundServer(void);
void FadeToFront()
{
- long fading_delay = 300000;
+ int fading_delay = 300000;
if (fading_on && (redraw_mask & REDRAW_FIELD))
{
ty--;
continue;
}
- sprintf(txt,text);
+ sprintf(txt,"%s",text);
txt[tl]=0;
DrawTextExt(pix[PIX_DB_DOOR],gc,
DOOR_GFX_PAGEX1+51-(tl*14)/2,SY+ty*16,txt,FS_SMALL,FC_YELLOW);
door2 = door_state & DOOR_ACTION_2;
}
-long mainCounter(int mode)
+int mainCounter(int mode)
{
static struct timeval base_time = { 0, 0 };
struct timeval current_time;
- long counter_ms;
+ int counter_ms;
gettimeofday(¤t_time,NULL);
if (mode==0 || current_time.tv_sec<base_time.tv_sec)
mainCounter(0);
}
-long Counter() /* returns 1/100 secs since last call of InitCounter() */
+int Counter() /* returns 1/100 secs since last call of InitCounter() */
{
return(mainCounter(1));
}
-long Counter2() /* returns 1/1000 secs since last call of InitCounter() */
+int Counter2() /* returns 1/1000 secs since last call of InitCounter() */
{
return(mainCounter(2));
}
-void WaitCounter(long value) /* wait for counter to reach value */
+void WaitCounter(int value) /* wait for counter to reach value */
{
- long wait;
+ int wait;
while((wait=value-Counter())>0)
microsleep(wait*10000);
}
-void WaitCounter2(long value) /* wait for counter to reach value */
+void WaitCounter2(int value) /* wait for counter to reach value */
{
- long wait;
+ int wait;
while((wait=value-Counter2())>0)
microsleep(wait*1000);
}
-void Delay(long value)
+void Delay(int value)
{
microsleep(value);
}
-BOOL DelayReached(long *counter_var, int delay)
+BOOL DelayReached(int *counter_var, int delay)
{
- long actual_counter = Counter();
+ int actual_counter = Counter();
if (actual_counter>*counter_var+delay || actual_counter<*counter_var)
{
int i;
char cookie[256];
FILE *file;
+ int ignored;
if (joystick_status==JOYSTICK_OFF)
return;
if (!(file=fopen(JOYDAT_FILE,"r")))
return;
- fscanf(file,"%s",cookie);
+ ignored = fscanf(file,"%s",cookie);
if (strcmp(cookie,JOYSTICK_COOKIE)) /* ungültiges Format? */
{
fprintf(stderr,"%s: wrong format of joystick file!\n",progname);
for(i=0;i<2;i++)
{
- fscanf(file,"%s",cookie);
- fscanf(file, "%d %d %d \n",
- &joystick[i].xleft, &joystick[i].xmiddle, &joystick[i].xright);
- fscanf(file, "%d %d %d \n",
- &joystick[i].yupper, &joystick[i].ymiddle, &joystick[i].ylower);
+ ignored = fscanf(file,"%s",cookie);
+ ignored =
+ fscanf(file, "%d %d %d \n",
+ &joystick[i].xleft, &joystick[i].xmiddle, &joystick[i].xright);
+ ignored =
+ fscanf(file, "%d %d %d \n",
+ &joystick[i].yupper, &joystick[i].ymiddle, &joystick[i].ylower);
}
fclose(file);
int JoystickPosition(int middle, int margin, int actual)
{
- long range, pos;
+ int range, pos;
int percentage;
if (margin<middle && actual>middle)
void OpenDoor(unsigned int);
void CloseDoor(unsigned int);
void MoveDoor(unsigned int);
-long mainCounter(int);
+int mainCounter(int);
void InitCounter(void);
-long Counter(void);
-long Counter2(void);
-void WaitCounter(long);
-void WaitCounter2(long);
-void Delay(long);
-BOOL DelayReached(long *, int);
+int Counter(void);
+int Counter2(void);
+void WaitCounter(int);
+void WaitCounter2(int);
+void Delay(int);
+BOOL DelayReached(int *, int);
int ReadPixel(Drawable, int, int);
int el2gfx(int);
void LoadJoystickData(void);