{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
static int video_button[5] =
{
VIDEO_PRESS_EJECT_ON,
{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
int sound_state[3];
- sound_state[0] = BUTTON_SOUND_MUSIC | (BUTTON_ON * sound_music_on);
- sound_state[1] = BUTTON_SOUND_LOOPS | (BUTTON_ON * sound_loops_on);
- sound_state[2] = BUTTON_SOUND_SIMPLE | (BUTTON_ON * sound_simple_on);
+ sound_state[0] = BUTTON_SOUND_MUSIC | (BUTTON_ON * setup.sound_music_on);
+ sound_state[1] = BUTTON_SOUND_LOOPS | (BUTTON_ON * setup.sound_loops_on);
+ sound_state[2] = BUTTON_SOUND_SIMPLE | (BUTTON_ON * setup.sound_simple_on);
if (button)
{
{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
int game_state[3] =
{
BUTTON_GAME_STOP,
{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
static int yesno_button[5] =
{
BUTTON_OK,
{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
if (button)
{
{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
int player_state[4] =
{
BUTTON_PLAYER_1,
{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
static int edit_button[6] =
{
ED_BUTTON_CTRL,
{
int return_code = 0;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
static int ctrl_button[4] =
{
ED_BUTTON_EDIT,
{
int return_code = -1;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
if (button)
{
{
int return_code = -1;
static int choice = -1;
- static BOOL pressed = FALSE;
+ static boolean pressed = FALSE;
if (button)
{
#include "tools.h"
static void HandleAnimation(int);
-static BOOL AnimateToon(int, BOOL);
+static boolean AnimateToon(int, boolean);
static void DrawAnim(Pixmap, GC, int, int, int, int, int, int, int, int);
struct AnimInfo
int frames;
int frames_per_second;
int stepsize;
- BOOL pingpong;
+ boolean pingpong;
int direction;
int position;
};
{
static long animstart_delay = -1;
static long animstart_delay_value = 0;
- static BOOL anim_restart = TRUE;
- static BOOL reset_delay = TRUE;
+ static boolean anim_restart = TRUE;
+ static boolean reset_delay = TRUE;
static int toon_nr = 0;
int draw_mode;
- if (!toons_on)
+ if (!setup.toons_on)
return;
switch(mode)
reset_delay = TRUE;
/* Fill empty backbuffer for animation functions */
- if (direct_draw_on && game_status == PLAYING)
+ if (setup.direct_draw_on && game_status == PLAYING)
{
int xx,yy;
SetDrawtoField(DRAW_DIRECT);
}
- if (soft_scrolling_on && game_status == PLAYING)
+ if (setup.soft_scrolling_on && game_status == PLAYING)
{
int fx = FX, fy = FY;
redraw_mask |= (REDRAW_FIELD | REDRAW_FROM_BACKBUFFER);
/* Redraw background even when in direct drawing mode */
- draw_mode = direct_draw_on;
- direct_draw_on = FALSE;
+ draw_mode = setup.direct_draw_on;
+ setup.direct_draw_on = FALSE;
BackToFront();
- direct_draw_on = draw_mode;
+ setup.direct_draw_on = draw_mode;
return;
break;
anim_restart = reset_delay = AnimateToon(toon_nr,anim_restart);
}
-BOOL AnimateToon(int toon_nr, BOOL restart)
+boolean AnimateToon(int toon_nr, boolean restart)
{
static pos_x = 0, pos_y = 0;
static delta_x = 0, delta_y = 0;
static int frame = 0, frame_step = 1;
- static BOOL horiz_move, vert_move;
+ static boolean horiz_move, vert_move;
static long anim_delay = 0;
static int anim_delay_value = 0;
static int width,height;
#define CHOICE_DELAY_VALUE 100
static int level_xpos,level_ypos;
-static BOOL edit_mode;
-static BOOL name_typing;
+static boolean edit_mode;
+static boolean name_typing;
static int new_element1 = EL_MAUERWERK;
static int new_element2 = EL_LEERRAUM;
static int new_element3 = EL_ERDREICH;
{
static int last_button = 0;
static int in_field_pressed = FALSE;
- static BOOL use_floodfill = FALSE;
+ static boolean use_floodfill = FALSE;
int x = (mx-SX)/MINI_TILEX;
int y = (my-SY)/MINI_TILEY;
void SleepWhileUnmapped()
{
- BOOL window_unmapped = TRUE;
+ boolean window_unmapped = TRUE;
XAutoRepeatOn(display);
int x = event->x, y = event->y;
int width = event->width, height = event->height;
- if (direct_draw_on && game_status==PLAYING)
+ if (setup.direct_draw_on && game_status==PLAYING)
{
int xx,yy;
int x1 = (x-SX)/TILEX, y1 = (y-SY)/TILEY;
SetDrawtoField(DRAW_DIRECT);
}
- if (soft_scrolling_on && game_status == PLAYING)
+ if (setup.soft_scrolling_on && game_status == PLAYING)
{
int fx = FX, fy = FY;
}
*/
- printf("direct_draw_on == %d\n", direct_draw_on);
+ printf("direct_draw_on == %d\n", setup.direct_draw_on);
break;
return;
}
- if (network)
+ if (options.network)
HandleNetworking();
switch(game_status)
#include "tape.h"
#include "joystick.h"
-BOOL CreateNewScoreFile()
+boolean CreateNewScoreFile()
{
int i,j,k;
char filename[MAX_FILENAME_LEN];
return(TRUE);
}
-BOOL CreateNewNamesFile(int mode)
+boolean CreateNewNamesFile(int mode)
{
char filename[MAX_FILENAME_LEN];
FILE *file;
return(TRUE);
}
-BOOL LoadLevelInfo()
+boolean LoadLevelInfo()
{
int i;
char filename[MAX_FILENAME_LEN];
char filename[MAX_FILENAME_LEN];
char cookie[MAX_FILENAME_LEN];
FILE *file;
- BOOL levelrec_10 = FALSE;
+ boolean levelrec_10 = FALSE;
#ifndef MSDOS
sprintf(filename,"%s/%s/%d.tape",
int i;
char filename[MAX_FILENAME_LEN];
FILE *file;
- BOOL new_tape = TRUE;
+ boolean new_tape = TRUE;
#ifndef MSDOS
sprintf(filename,"%s/%s/%d.tape",
#define SETUP_SCROLL_DELAY_ON(x) (((x) & SETUP_SCROLL_DELAY) != 0)
#define SETUP_SOFT_SCROLL_ON(x) (((x) & SETUP_SOFT_SCROLL) != 0)
-BOOL CreateNewScoreFile(void);
-BOOL CreateNewNamesFile(int);
-BOOL LoadLevelInfo(void);
+boolean CreateNewScoreFile(void);
+boolean CreateNewNamesFile(int);
+boolean LoadLevelInfo(void);
void LoadLevel(int);
void LoadLevelTape(int);
void LoadScore(int);
void GetPlayerConfig()
{
- int old_joystick_nr = joystick_nr;
+ int old_joystick_nr = setup.joystick_nr;
if (sound_status==SOUND_OFF)
local_player->setup &= ~SETUP_SOUND;
local_player->setup &= ~SETUP_SOUND_MUSIC;
}
- sound_on = sound_simple_on = SETUP_SOUND_ON(local_player->setup);
- sound_loops_on = SETUP_SOUND_LOOPS_ON(local_player->setup);
- sound_music_on = SETUP_SOUND_MUSIC_ON(local_player->setup);
- toons_on = SETUP_TOONS_ON(local_player->setup);
- direct_draw_on = SETUP_DIRECT_DRAW_ON(local_player->setup);
- fading_on = SETUP_FADING_ON(local_player->setup);
- autorecord_on = SETUP_AUTO_RECORD_ON(local_player->setup);
- joystick_nr = SETUP_2ND_JOYSTICK_ON(local_player->setup);
- quick_doors = SETUP_QUICK_DOORS_ON(local_player->setup);
- scroll_delay_on = SETUP_SCROLL_DELAY_ON(local_player->setup);
- soft_scrolling_on = SETUP_SOFT_SCROLL_ON(local_player->setup);
+ setup.sound_on = setup.sound_simple_on = SETUP_SOUND_ON(local_player->setup);
+ setup.sound_loops_on = SETUP_SOUND_LOOPS_ON(local_player->setup);
+ setup.sound_music_on = SETUP_SOUND_MUSIC_ON(local_player->setup);
+ setup.toons_on = SETUP_TOONS_ON(local_player->setup);
+ setup.direct_draw_on = SETUP_DIRECT_DRAW_ON(local_player->setup);
+ setup.fading_on = SETUP_FADING_ON(local_player->setup);
+ setup.autorecord_on = SETUP_AUTO_RECORD_ON(local_player->setup);
+ setup.joystick_nr = SETUP_2ND_JOYSTICK_ON(local_player->setup);
+ setup.quick_doors = SETUP_QUICK_DOORS_ON(local_player->setup);
+ setup.scroll_delay_on = SETUP_SCROLL_DELAY_ON(local_player->setup);
+ setup.soft_scrolling_on = SETUP_SOFT_SCROLL_ON(local_player->setup);
#ifndef MSDOS
- if (joystick_nr != old_joystick_nr)
+ if (setup.joystick_nr != old_joystick_nr)
{
if (joystick_device)
close(joystick_device);
void InitGame()
{
int i,j, x,y;
- BOOL emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
- BOOL emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
+ boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
+ boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
/* don't play tapes over network */
- network_playing = (network && !tape.playing);
+ network_playing = (options.network && !tape.playing);
for(i=0; i<MAX_PLAYERS; i++)
{
DrawGameButton(BUTTON_GAME_STOP);
DrawGameButton(BUTTON_GAME_PAUSE);
DrawGameButton(BUTTON_GAME_PLAY);
- DrawSoundDisplay(BUTTON_SOUND_MUSIC | (BUTTON_ON * sound_music_on));
- DrawSoundDisplay(BUTTON_SOUND_LOOPS | (BUTTON_ON * sound_loops_on));
- DrawSoundDisplay(BUTTON_SOUND_SIMPLE | (BUTTON_ON * sound_simple_on));
+ DrawSoundDisplay(BUTTON_SOUND_MUSIC | (BUTTON_ON * setup.sound_music_on));
+ DrawSoundDisplay(BUTTON_SOUND_LOOPS | (BUTTON_ON * setup.sound_loops_on));
+ DrawSoundDisplay(BUTTON_SOUND_SIMPLE | (BUTTON_ON * setup.sound_simple_on));
XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
DX+GAME_CONTROL_XPOS,DY+GAME_CONTROL_YPOS,
GAME_CONTROL_XSIZE,2*GAME_CONTROL_YSIZE,
OpenDoor(DOOR_OPEN_1);
- if (sound_music_on)
+ if (setup.sound_music_on)
PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
XAutoRepeatOff(display);
if (TimeLeft)
{
- if (sound_loops_on)
+ if (setup.sound_loops_on)
PlaySoundExt(SND_SIRR, PSND_MAX_VOLUME, PSND_MAX_RIGHT, PSND_LOOP);
while(TimeLeft > 0)
{
- if (!sound_loops_on)
+ if (!setup.sound_loops_on)
PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT);
if (TimeLeft && !(TimeLeft % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
Delay(10);
}
- if (sound_loops_on)
+ if (setup.sound_loops_on)
StopSound(SND_SIRR);
}
BackToFront();
}
-BOOL NewHiScore()
+boolean NewHiScore()
{
int k,l;
int position = -1;
void Impact(int x, int y)
{
- BOOL lastline = (y==lev_fieldy-1);
- BOOL object_hit = FALSE;
+ boolean lastline = (y==lev_fieldy-1);
+ boolean object_hit = FALSE;
int element = Feld[x][y];
int smashed = 0;
}
else if (element==EL_MAMPFER)
{
- BOOL can_turn_left = FALSE, can_turn_right = FALSE;
+ boolean can_turn_left = FALSE, can_turn_right = FALSE;
if (IN_LEV_FIELD(left_x,left_y) &&
(IS_FREE_OR_PLAYER(left_x,left_y) ||
}
else if (element==EL_MAMPFER2)
{
- BOOL can_turn_left = FALSE, can_turn_right = FALSE;
+ boolean can_turn_left = FALSE, can_turn_right = FALSE;
if (IN_LEV_FIELD(left_x,left_y) &&
(IS_FREE_OR_PLAYER(left_x,left_y) ||
}
else if (element==EL_PACMAN)
{
- BOOL can_turn_left = FALSE, can_turn_right = FALSE;
+ boolean can_turn_left = FALSE, can_turn_right = FALSE;
if (IN_LEV_FIELD(left_x,left_y) &&
(IS_FREE_OR_PLAYER(left_x,left_y) ||
}
else if (element==EL_SCHWEIN)
{
- BOOL can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE;
- BOOL should_turn_left = FALSE, should_turn_right = FALSE;
- BOOL should_move_on = FALSE;
+ boolean can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE;
+ boolean should_turn_left = FALSE, should_turn_right = FALSE;
+ boolean should_move_on = FALSE;
int rnd_value = 24;
int rnd = RND(rnd_value);
}
else if (element==EL_DRACHE)
{
- BOOL can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE;
+ boolean can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE;
int rnd_value = 24;
int rnd = RND(rnd_value);
if ((MovDir[x][y]&(MV_LEFT|MV_RIGHT)) && (MovDir[x][y]&(MV_UP|MV_DOWN)))
{
- BOOL first_horiz = RND(2);
+ boolean first_horiz = RND(2);
int new_move_dir = MovDir[x][y];
MovDir[x][y] =
}
}
-static BOOL JustBeingPushed(int x, int y)
+static boolean JustBeingPushed(int x, int y)
{
int i;
}
else if (IS_SLIPPERY(Feld[x][y+1]) && !Store[x][y+1])
{
- BOOL left = (x>0 && IS_FREE(x-1,y) &&
- (IS_FREE(x-1,y+1) || Feld[x-1][y+1]==EL_SALZSAEURE));
- BOOL right = (x<lev_fieldx-1 && IS_FREE(x+1,y) &&
- (IS_FREE(x+1,y+1) || Feld[x+1][y+1]==EL_SALZSAEURE));
+ boolean left = (x>0 && IS_FREE(x-1,y) &&
+ (IS_FREE(x-1,y+1) || Feld[x-1][y+1]==EL_SALZSAEURE));
+ boolean right = (x<lev_fieldx-1 && IS_FREE(x+1,y) &&
+ (IS_FREE(x+1,y+1) || Feld[x+1][y+1]==EL_SALZSAEURE));
if (left || right)
{
}
else
{
- BOOL wanna_flame = !RND(10);
+ boolean wanna_flame = !RND(10);
int dx = newx - x, dy = newy - y;
int newx1 = newx+1*dx, newy1 = newy+1*dy;
int newx2 = newx+2*dx, newy2 = newy+2*dy;
{
int x,y;
int group_nr = AmoebaNr[ax][ay];
- BOOL done = FALSE;
+ boolean done = FALSE;
for(y=0;y<lev_fieldy;y++) for(x=0;x<lev_fieldx;x++)
{
else /* normale oder "gefüllte" Amöbe */
{
int start = RND(4);
- BOOL waiting_for_player = FALSE;
+ boolean waiting_for_player = FALSE;
for(i=0;i<4;i++)
{
{
MovDelay[x][y]--;
- if (direct_draw_on && MovDelay[x][y])
+ if (setup.direct_draw_on && MovDelay[x][y])
SetDrawtoField(DRAW_BUFFERED);
DrawGraphic(SCREENX(x),SCREENY(y), el2gfx(Feld[x][y]));
DrawGraphicThruMask(SCREENX(x),SCREENY(y), GFX_FUNKELN_WEISS + phase);
- if (direct_draw_on)
+ if (setup.direct_draw_on)
{
int dest_x,dest_y;
void MauerAbleger(int ax, int ay)
{
int element = Feld[ax][ay];
- BOOL oben_frei = FALSE, unten_frei = FALSE;
- BOOL links_frei = FALSE, rechts_frei = FALSE;
- BOOL oben_massiv = FALSE, unten_massiv = FALSE;
- BOOL links_massiv = FALSE, rechts_massiv = FALSE;
+ boolean oben_frei = FALSE, unten_frei = FALSE;
+ boolean links_frei = FALSE, rechts_frei = FALSE;
+ boolean oben_massiv = FALSE, unten_massiv = FALSE;
+ boolean links_massiv = FALSE, rechts_massiv = FALSE;
if (!MovDelay[ax][ay]) /* neue Mauer / noch nicht gewartet */
MovDelay[ax][ay] = 6;
void CheckForDragon(int x, int y)
{
int i,j;
- BOOL dragon_found = FALSE;
+ boolean dragon_found = FALSE;
static int xy[4][2] =
{
{ 0,-1 },
{
static byte stored_player_action[MAX_PLAYERS];
static int num_stored_actions = 0;
- BOOL moved = FALSE, snapped = FALSE, bombed = FALSE;
+ boolean moved = FALSE, snapped = FALSE, bombed = FALSE;
int jx = player->jx, jy = player->jy;
int left = player_action & JOY_LEFT;
int right = player_action & JOY_RIGHT;
{
/*
int actual_player_action =
- (network ? network_player_action[i] : player_action);
+ (options.network ? network_player_action[i] : player_action);
*/
int actual_player_action =
actual_player_action = 0;
*/
- if (!network && i != TestPlayer)
+ if (!options.network && i != TestPlayer)
actual_player_action = 0;
/* TEST TEST TEST */
if (SiebAktiv)
{
- BOOL sieb = FALSE;
+ boolean sieb = FALSE;
int jx = local_player->jx, jy = local_player->jy;
if (element==EL_SIEB_LEER || element==EL_SIEB_VOLL ||
DrawAllPlayers();
}
-static BOOL AllPlayersInSight(struct PlayerInfo *player, int x, int y)
+static boolean AllPlayersInSight(struct PlayerInfo *player, int x, int y)
{
int min_x = x, min_y = y, max_x = x, max_y = y;
int i;
return(max_x - min_x < SCR_FIELDX && max_y - min_y < SCR_FIELDY);
}
-static BOOL AllPlayersInVisibleScreen()
+static boolean AllPlayersInVisibleScreen()
{
int i;
void ScrollLevel(int dx, int dy)
{
- int softscroll_offset = (soft_scrolling_on ? TILEX : 0);
+ int softscroll_offset = (setup.soft_scrolling_on ? TILEX : 0);
int x,y;
/*
redraw_mask |= REDRAW_FIELD;
}
-BOOL MoveFigureOneStep(struct PlayerInfo *player,
- int dx, int dy, int real_dx, int real_dy)
+boolean MoveFigureOneStep(struct PlayerInfo *player,
+ int dx, int dy, int real_dx, int real_dy)
{
int jx = player->jx, jy = player->jy;
int new_jx = jx+dx, new_jy = jy+dy;
if (!IN_LEV_FIELD(new_jx,new_jy))
return(MF_NO_ACTION);
- if (!network && !AllPlayersInSight(player, new_jx,new_jy))
+ if (!options.network && !AllPlayersInSight(player, new_jx,new_jy))
return(MF_NO_ACTION);
element = MovingOrBlocked2Element(new_jx,new_jy);
return(MF_MOVING);
}
-BOOL MoveFigure(struct PlayerInfo *player, int dx, int dy)
+boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
{
int jx = player->jx, jy = player->jy;
int old_jx = jx, old_jy = jy;
*/
if (moved & MF_MOVING && !ScreenMovPos &&
- (player == local_player || !network))
+ (player == local_player || !options.network))
{
int old_scroll_x = scroll_x, old_scroll_y = scroll_y;
- int offset = (scroll_delay_on ? 3 : 0);
+ int offset = (setup.scroll_delay_on ? 3 : 0);
/*
if (player == local_player)
if (scroll_x != old_scroll_x || scroll_y != old_scroll_y)
{
- if (!network && !AllPlayersInVisibleScreen())
+ if (!options.network && !AllPlayersInVisibleScreen())
{
scroll_x = old_scroll_x;
scroll_y = old_scroll_y;
return(MF_MOVING);
}
-BOOL SnapField(struct PlayerInfo *player, int dx, int dy)
+boolean SnapField(struct PlayerInfo *player, int dx, int dy)
{
int jx = player->jx, jy = player->jy;
int x = jx + dx, y = jy + dy;
return(TRUE);
}
-BOOL PlaceBomb(struct PlayerInfo *player)
+boolean PlaceBomb(struct PlayerInfo *player)
{
int jx = player->jx, jy = player->jy;
int element;
int volume, stereo;
int silence_distance = 8;
- if ((!sound_simple_on && !IS_LOOP_SOUND(sound_nr)) ||
- (!sound_loops_on && IS_LOOP_SOUND(sound_nr)))
+ if ((!setup.sound_simple_on && !IS_LOOP_SOUND(sound_nr)) ||
+ (!setup.sound_loops_on && IS_LOOP_SOUND(sound_nr)))
return;
if (!IN_LEV_FIELD(x,y) ||
void InitMovDir(int, int);
void InitAmoebaNr(int, int);
void GameWon(void);
-BOOL NewHiScore(void);
+boolean NewHiScore(void);
void InitMovingField(int, int, int);
void Moving2Blocked(int, int, int *, int *);
void Blocked2Moving(int, int, int *, int *);
void GameActions(byte);
void ScrollLevel(int, int);
-BOOL MoveFigureOneStep(struct PlayerInfo *, int, int, int, int);
-BOOL MoveFigure(struct PlayerInfo *, int, int);
+boolean MoveFigureOneStep(struct PlayerInfo *, int, int, int, int);
+boolean MoveFigure(struct PlayerInfo *, int, int);
void ScrollFigure(struct PlayerInfo *, int);
void ScrollScreen(struct PlayerInfo *, int);
void BuryHero(struct PlayerInfo *);
void RemoveHero(struct PlayerInfo *);
int DigField(struct PlayerInfo *, int, int, int, int, int);
-BOOL SnapField(struct PlayerInfo *, int, int);
-BOOL PlaceBomb(struct PlayerInfo *);
+boolean SnapField(struct PlayerInfo *, int, int);
+boolean PlaceBomb(struct PlayerInfo *);
void PlaySoundLevel(int, int, int);
void RaiseScore(int);
void RaiseScoreElement(int);
struct PictureFileInfo
{
char *picture_filename;
- BOOL picture_with_mask;
+ boolean picture_with_mask;
};
struct IconFileInfo
void OpenAll(int argc, char *argv[])
{
- if (serveronly)
+ if (options.serveronly)
{
- NetworkServer(server_port, serveronly);
+ NetworkServer(options.server_port, options.serveronly);
/* never reached */
exit(0);
{
int i;
+ /* initialize local player's setup */
+ setup.sound_on = TRUE;
+ setup.sound_loops_on = FALSE;
+ setup.sound_music_on = FALSE;
+ setup.sound_simple_on = FALSE;
+ setup.toons_on = TRUE;
+ setup.direct_draw_on = FALSE;
+ setup.scroll_delay_on = FALSE;
+ setup.soft_scrolling_on = TRUE;
+ setup.fading_on = FALSE;
+ setup.autorecord_on = FALSE;
+ setup.quick_doors = FALSE;
+ setup.joystick_nr = 0;
+
+ /* choose default local player */
local_player = &stored_player[0];
if (!LoadLevelInfo()) /* global level info */
LoadPlayerInfo(PLAYER_SETUP); /* global setup info */
LoadPlayerInfo(PLAYER_LEVEL); /* level specific info */
+ /* after LoadPlayerInfo(), because it overwrites 'local_player' */
for (i=0; i<MAX_PLAYERS; i++)
{
stored_player[i].connected = FALSE;
{
int nr_wanted;
- if (!network)
+ if (!options.network)
return;
nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
- if (!ConnectToServer(server_host, server_port))
+ if (!ConnectToServer(options.server_host, options.server_port))
Error(ERR_EXIT, "cannot connect to multiplayer server");
SendToServer_Nickname(local_player->alias_name);
#ifdef VOXWARE
sound_loops_allowed = TRUE;
- sound_loops_on = TRUE;
+ setup.sound_loops_on = TRUE;
#endif
#else
sound_loops_allowed = TRUE;
- sound_loops_on = TRUE;
+ setup.sound_loops_on = TRUE;
#endif
for(i=0; i<NUM_SOUNDS; i++)
return;
#ifndef MSDOS
- if (access(joystick_device_name[joystick_nr],R_OK)<0)
+ if (access(joystick_device_name[setup.joystick_nr], R_OK) < 0)
{
Error(ERR_RETURN, "cannot access joystick device '%s'",
- joystick_device_name[joystick_nr]);
+ joystick_device_name[setup.joystick_nr]);
joystick_status = JOYSTICK_OFF;
return;
}
- if ((joystick_device = open(joystick_device_name[joystick_nr],O_RDONLY))<0)
+ if ((joystick_device =
+ open(joystick_device_name[setup.joystick_nr], O_RDONLY)) < 0)
{
Error(ERR_RETURN, "cannot open joystick device '%s'",
- joystick_device_name[joystick_nr]);
+ joystick_device_name[setup.joystick_nr]);
joystick_status = JOYSTICK_OFF;
return;
}
unsigned int depth;
/* connect to X server */
- if (!(display = XOpenDisplay(display_name)))
- Error(ERR_EXIT,"cannot connect to X server %s",XDisplayName(display_name));
+ if (!(display = XOpenDisplay(options.display_name)))
+ Error(ERR_EXIT, "cannot connect to X server %s",
+ XDisplayName(options.display_name));
screen = DefaultScreen(display);
visual = DefaultVisual(display, screen);
js_b2 = joy_ctrl.buttons & 2;
#endif
- left = JoystickPosition(joystick[joystick_nr].xmiddle,
- joystick[joystick_nr].xleft, js_x);
- right = JoystickPosition(joystick[joystick_nr].xmiddle,
- joystick[joystick_nr].xright, js_x);
- up = JoystickPosition(joystick[joystick_nr].ymiddle,
- joystick[joystick_nr].yupper, js_y);
- down = JoystickPosition(joystick[joystick_nr].ymiddle,
- joystick[joystick_nr].ylower, js_y);
+ left = JoystickPosition(joystick[setup.joystick_nr].xmiddle,
+ joystick[setup.joystick_nr].xleft, js_x);
+ right = JoystickPosition(joystick[setup.joystick_nr].xmiddle,
+ joystick[setup.joystick_nr].xright, js_x);
+ up = JoystickPosition(joystick[setup.joystick_nr].ymiddle,
+ joystick[setup.joystick_nr].yupper, js_y);
+ down = JoystickPosition(joystick[setup.joystick_nr].ymiddle,
+ joystick[setup.joystick_nr].ylower, js_y);
if (left>JOYSTICK_PERCENT)
result |= JOY_LEFT;
int width, height;
char *program_name = NULL;
-char *display_name = NULL;
-char *server_host = NULL;
-int server_port = 0;
-int serveronly = FALSE;
-int network = FALSE;
-int verbose = FALSE;
int game_status = MAINMENU;
int game_emulation = EMU_NONE;
-int network_playing = FALSE;
-int button_status = MB_NOT_PRESSED, motion_status = FALSE;
+boolean network_playing = FALSE;
+int button_status = MB_NOT_PRESSED;
+boolean motion_status = FALSE;
int key_joystick_mapping = 0;
int global_joystick_status = JOYSTICK_STATUS;
int joystick_status = JOYSTICK_STATUS;
-int sound_status = SOUND_STATUS, sound_on = TRUE;
-int sound_loops_allowed = FALSE, sound_loops_on = FALSE;
-int sound_music_on = FALSE;
-int sound_simple_on = FALSE;
-int toons_on = TRUE;
-int direct_draw_on = FALSE;
-int scroll_delay_on = FALSE;
-int soft_scrolling_on = TRUE;
-int fading_on = FALSE;
-int autorecord_on = FALSE;
-int joystick_nr = 0;
-int quick_doors = FALSE;
-
-BOOL redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
+int sound_status = SOUND_STATUS;
+boolean sound_loops_allowed = FALSE;
+
+boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
int redraw_x1 = 0, redraw_y1 = 0;
int redraw_mask;
int redraw_tiles;
-int Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int JustHit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA];
-long Elementeigenschaften[MAX_ELEMENTS];
+short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short JustHit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA];
+unsigned long Elementeigenschaften[MAX_ELEMENTS];
int level_nr, leveldir_nr, num_leveldirs;
int lev_fieldx,lev_fieldy, scroll_x,scroll_y;
int MampferNr, SiebAktiv;
byte network_player_action[MAX_PLAYERS];
-BOOL network_player_action_received = FALSE;
+boolean network_player_action_received = FALSE;
int TestPlayer = 0;
struct LevelDirInfo leveldir[MAX_LEVDIR_ENTRIES];
struct HiScore highscore[MAX_SCORE_ENTRIES];
struct SoundInfo Sound[NUM_SOUNDS];
struct RecordingInfo tape;
+struct OptionInfo options;
+struct SetupInfo setup;
struct JoystickInfo joystick[2] =
{
#include "msdos.h"
#endif /* #ifndef MSDOS */
-typedef int BOOL;
+typedef unsigned char boolean;
typedef unsigned char byte;
#ifndef FALSE
int Score;
};
+struct OptionInfo
+{
+ char *display_name;
+ char *server_host;
+ int server_port;
+ boolean serveronly;
+ boolean network;
+ boolean verbose;
+};
+
+struct SetupInfo
+{
+ boolean sound_on;
+ boolean sound_loops_on;
+ boolean sound_music_on;
+ boolean sound_simple_on;
+ boolean toons_on;
+ boolean direct_draw_on;
+ boolean scroll_delay_on;
+ boolean soft_scrolling_on;
+ boolean fading_on;
+ boolean autorecord_on;
+ boolean quick_doors;
+ int joystick_nr;
+};
+
struct PlayerInfo
{
- BOOL present; /* player present in level playfield */
- BOOL connected; /* player connected locally or via network */
- BOOL local; /* player connected locally */
- BOOL active; /* player (present && connected) */
+ boolean present; /* player present in level playfield */
+ boolean connected; /* player connected locally or via network */
+ boolean local; /* player connected locally */
+ boolean active; /* player (present && connected) */
int index_nr, client_nr, element_nr;
int MovDir, MovPos, GfxPos;
int Frame;
- BOOL Pushing;
- BOOL gone, LevelSolved, GameOver;
- BOOL snapped;
+ boolean Pushing;
+ boolean gone, LevelSolved, GameOver;
+ boolean snapped;
long move_delay;
int last_move_dir;
unsigned long length;
unsigned long length_seconds;
unsigned int delay_played;
- BOOL pause_before_death;
- BOOL recording, playing, pausing;
- BOOL fast_forward;
- BOOL changed;
+ boolean pause_before_death;
+ boolean recording, playing, pausing;
+ boolean fast_forward;
+ boolean changed;
struct
{
byte action[MAX_PLAYERS];
extern int width, height;
extern char *program_name;
-extern char *display_name;
-extern char *server_host;
-extern int server_port;
-extern int serveronly;
-extern int network;
-extern int verbose;
extern int game_status;
extern int game_emulation;
-extern int network_playing;
-extern int button_status, motion_status;
+extern boolean network_playing;
+extern int button_status;
+extern boolean motion_status;
extern int key_joystick_mapping;
extern int global_joystick_status, joystick_status;
-extern int sound_status, sound_on;
-extern int sound_loops_allowed, sound_loops_on;
-extern int sound_music_on;
-extern int sound_simple_on;
-extern int toons_on;
-extern int direct_draw_on;
-extern int scroll_delay_on;
-extern int soft_scrolling_on;
-extern int fading_on;
-extern int autorecord_on;
-extern int joystick_nr;
-extern int quick_doors;
-
-extern BOOL redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
+extern int sound_status;
+extern boolean sound_loops_allowed;
+
+extern boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
extern int redraw_x1, redraw_y1;
extern int redraw_mask;
extern int redraw_tiles;
-extern int Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int JustHit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA];
-extern long Elementeigenschaften[MAX_ELEMENTS];
+extern short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short JustHit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA];
+extern unsigned long Elementeigenschaften[MAX_ELEMENTS];
extern int level_nr, leveldir_nr, num_leveldirs;
extern int lev_fieldx,lev_fieldy, scroll_x,scroll_y;
extern int MampferNr, SiebAktiv;
extern byte network_player_action[];
-extern BOOL network_player_action_received;
+extern boolean network_player_action_received;
extern int TestPlayer;
extern struct LevelDirInfo leveldir[];
extern struct RecordingInfo tape;
extern struct SoundInfo Sound[];
extern struct JoystickInfo joystick[];
+struct OptionInfo options;
+struct SetupInfo setup;
extern char *sound_name[];
extern int background_loop[];
sleep_milliseconds(delay);
}
-BOOL FrameReached(unsigned long *frame_counter_var, unsigned long frame_delay)
+boolean FrameReached(unsigned long *frame_counter_var,
+ unsigned long frame_delay)
{
unsigned long actual_frame_counter = FrameCounter;
return(TRUE);
}
-BOOL DelayReached(unsigned long *counter_var, unsigned long delay)
+boolean DelayReached(unsigned long *counter_var,
+ unsigned long delay)
{
unsigned long actual_counter = Counter();
{
char **options_left = &argv[1];
+ /* initialize global program options */
+ options.display_name = NULL;
+ options.server_host = NULL;
+ options.server_port = 0;
+ options.serveronly = FALSE;
+ options.network = FALSE;
+ options.verbose = FALSE;
+
while (*options_left)
{
char option_str[MAX_OPTION_LEN];
if (option_arg == NULL)
Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str);
- display_name = option_arg;
+ options.display_name = option_arg;
if (option_arg == next_option)
options_left++;
- printf("--display == '%s'\n", display_name);
+ printf("--display == '%s'\n", options.display_name);
}
else if (strncmp(option, "-levels", option_len) == 0)
{
{
printf("--network\n");
- network = TRUE;
+ options.network = TRUE;
}
else if (strncmp(option, "-serveronly", option_len) == 0)
{
printf("--serveronly\n");
- serveronly = TRUE;
+ options.serveronly = TRUE;
}
else if (strncmp(option, "-verbose", option_len) == 0)
{
printf("--verbose\n");
- verbose = TRUE;
+ options.verbose = TRUE;
}
else if (*option == '-')
Error(ERR_EXIT_HELP, "unrecognized option '%s'", option_str);
- else if (server_host == NULL)
+ else if (options.server_host == NULL)
{
- server_host = *options_left;
+ options.server_host = *options_left;
- printf("server.name == '%s'\n", server_host);
+ printf("server.name == '%s'\n", options.server_host);
}
- else if (server_port == 0)
+ else if (options.server_port == 0)
{
- server_port = atoi(*options_left);
- if (server_port < 1024)
- Error(ERR_EXIT_HELP, "bad port number '%d'", server_port);
+ options.server_port = atoi(*options_left);
+ if (options.server_port < 1024)
+ Error(ERR_EXIT_HELP, "bad port number '%d'", options.server_port);
- printf("port == %d\n", server_port);
+ printf("port == %d\n", options.server_port);
}
else
Error(ERR_EXIT_HELP, "too many arguments");
void InitCounter(void);
unsigned long Counter(void);
void Delay(unsigned long);
-BOOL FrameReached(unsigned long *, unsigned long);
-BOOL DelayReached(unsigned long *, unsigned long);
+boolean FrameReached(unsigned long *, unsigned long);
+boolean DelayReached(unsigned long *, unsigned long);
void WaitUntilDelayReached(unsigned long *, unsigned long);
char *int2str(int, int);
unsigned int SimpleRND(unsigned int);
static int key_buffer[OSD_MAX_KEY];
static XEvent event_buffer[MAX_EVENT_BUFFER];
static int pending_events;
-static BOOL joystick_event;
-static BOOL mouse_installed = FALSE;
+static boolean joystick_event;
+static boolean mouse_installed = FALSE;
static int last_mouse_pos;
static int last_mouse_b;
static int last_joystick_state;
static BITMAP* video_bitmap;
-BOOL wait_for_vsync;
+boolean wait_for_vsync;
extern int playing_sounds;
extern struct SoundControl playlist[MAX_SOUNDS_PLAYING];
}
-BOOL hide_mouse(Display *display, int x, int y, unsigned int width, unsigned int height)
+boolean hide_mouse(Display *display, int x, int y,
+ unsigned int width, unsigned int height)
{
if(mouse_x + display->mouse_ptr->w < x || mouse_x > x+width) return FALSE;
if(mouse_y + display->mouse_ptr->h < y || mouse_y > y+height) return FALSE;
{
int x, y;
unsigned int width, height;
- BOOL mouse_off;
+ boolean mouse_off;
x = display->screens[display->default_screen].x;
y = display->screens[display->default_screen].y;
unsigned int width,
unsigned int height)
{
- BOOL mouse_off;
+ boolean mouse_off;
if((BITMAP *) d == video_bitmap)
{
int dest_x,
int dest_y)
{
- BOOL mouse_off;
+ boolean mouse_off;
if((BITMAP *) src == video_bitmap )
{
int XPending(Display* display)
{
int i, state;
- static BOOL joy_button_2 = FALSE;
+ static boolean joy_button_2 = FALSE;
XKeyEvent *xkey;
XButtonEvent *xbutton;
{
struct user *v, *w;
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: dropping client %d (%s)\n", u->number, u->nick);
if (u == user0)
if (onceonly && clients == bots)
{
- if (verbose)
+ if (options.verbose)
{
printf("RND_SERVER: no clients left\n");
printf("RND_SERVER: aborting\n");
}
u->number = nxn;
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d connecting from %s\n", nxn, inet_ntoa(saddr.sin_addr));
clients++;
{
if (len != 5 || buf[2] != PROT_VERS_1 || buf[3] != PROT_VERS_2)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) has wrong protocol version %d.%d.%d\n", u->number, u->nick, buf[2], buf[3], buf[4]);
buf[0] = 0;
}
else
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) uses protocol version %d.%d.%d\n", u->number, u->nick, buf[2], buf[3], buf[4]);
}
}
int nr_wanted = buf[2];
int nr_is_free = 1;
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) wants to switch to # %d\n",
u->number, u->nick, nr_wanted);
}
}
- if (verbose)
+ if (options.verbose)
{
if (nr_is_free)
printf("RND_SERVER: client %d (%s) switches to # %d\n",
broadcast(u, 2, 0);
}
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d calls itself \"%s\"\n", u->number, u->nick);
buf[1] = OP_NICKNAME;
broadcast(u, len, 0);
{
struct user *v, *w;
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) starts game [level %d from levedir %d (%s)]\n",
u->number, u->nick,
(buf[2] << 8) + buf[3],
static void Handle_OP_PAUSE_PLAYING(struct user *u)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) pauses game\n", u->number, u->nick);
broadcast(NULL, 2, 0);
paused = 1;
static void Handle_OP_CONTINUE_PLAYING(struct user *u)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) continues game\n", u->number, u->nick);
broadcast(NULL, 2, 0);
paused = 0;
static void Handle_OP_STOP_PLAYING(struct user *u)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) stops game\n", u->number, u->nick);
broadcast(NULL, 2, 0);
}
if (is_daemon)
{
/* become a daemon, breaking all ties with the controlling terminal */
- verbose = 0;
+ options.verbose = 0;
for (i=0; i<255; i++)
{
if (i != lfd)
open("/dev/null", O_WRONLY);
}
- if (verbose)
+ if (options.verbose)
{
printf("rocksndiamonds network server: started up, listening on port %d\n",
port);
{
buf[0] = 0;
do_play();
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: everyone lost... restarting game\n");
timetoplay = 0;
}
if (clients > 0 && clients == bots)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: only bots left... dropping all bots\n");
while (user0)
dropuser(user0);
r = read(u->fd, u->readbuf + u->nread, MAX_BUFFER_SIZE - u->nread);
if (r <= 0)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: EOF from client %d (%s)\n", u->number, u->nick);
dropuser(u);
interrupt = 1;
len = u->readbuf[3];
if (u->readbuf[0] || u->readbuf[1] || u->readbuf[2])
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: crap from client %d (%s)\n", u->number, u->nick);
write(u->fd, "\033]50;kanji24\007\033#8\033(0", 19);
dropuser(u);
buf[0] = u->number;
if (!u->introduced && buf[1] != OP_NICKNAME)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: !(client %d)->introduced && buf[1]==%d (expected OP_NICKNAME)\n", buf[0], buf[1]);
dropuser(u);
{
if (v->isbot)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) kills bot %d (%s)\n", u->number, u->nick, v->number, v->nick);
dropuser(v);
}
else
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) attempting to kill non-bot %d (%s)\n", u->number, u->nick, v->number, v->nick);
}
}
case OP_MODE:
mode = buf[2];
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) sets mode %d (%s)\n", u->number, u->nick, buf[2], buf[2] == 0 ? "normal" : (buf[2] == 1 ? "fun" : "unknown"));
broadcast(NULL, 3, 0);
break;
if (!u->isbot)
bots++;
u->isbot = 1;
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) declares itself to be a bot\n", u->number, u->nick);
break;
case OP_LEVEL:
levelnr = buf[2];
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) sets level %d\n", u->number, u->nick, buf[2]);
broadcast(NULL, 3, 0);
break;
{
struct user *won = NULL;
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) has lost\n", u->number, u->nick);
u->playing = 0;
broadcast(u, 2, 1);
case OP_ZERO:
broadcast(NULL, 2, 0);
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) resets the game counters\n", u->number, u->nick);
for (v=user0; v; v=v->next)
v->games = 0;
case OP_MSG:
buf[len] = '\0';
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) sends message: %s\n", u->number, u->nick, &buf[2]);
broadcast(u, len, 0);
break;
case OP_LINES:
if (len != 3)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) sends crap for an OP_LINES\n", u->number, u->nick);
dropuser(u);
}
if (u->nextvictim)
{
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: client %d (%s) sends %d %s to client %d (%s)\n", u->number, u->nick, (int)buf[2], buf[2] == 1 ? "line" : "lines", u->nextvictim->number, u->nextvictim->nick);
sendtoone(u->nextvictim, 3);
buf[3] = u->nextvictim->number;
}
}
}
- else if (verbose)
+ else if (options.verbose)
printf("RND_SERVER: client %d (%s) makes %d %s but has no victim\n", u->number, u->nick, (int)buf[2], buf[2] == 1 ? "line" : "lines");
break;
default:
- if (verbose)
+ if (options.verbose)
printf("RND_SERVER: opcode %d from client %d (%s) not understood\n", buf[0], u->number, u->nick);
}
}
static void sysmsg(char *s)
{
- if (verbose)
+ if (options.verbose)
{
printf("** %s\n", s);
fflush(stdout);
static void sendbuf(int len)
{
- if (network)
+ if (options.network)
{
realbuf[0] = realbuf[1] = realbuf[2] = 0;
realbuf[3] = (unsigned char)len;
switch (fork())
{
case 0:
- NetworkServer(port, serveronly);
+ NetworkServer(port, options.serveronly);
/* never reached */
exit(0);
case -1:
Error(ERR_RETURN,
"cannot create network server process - no network games");
- network = FALSE;
+ options.network = FALSE;
return;
default:
}
}
-BOOL ConnectToServer(char *host, int port)
+boolean ConnectToServer(char *host, int port)
{
struct hostent *hp;
struct sockaddr_in s;
- if (autorecord_on)
+ if (setup.autorecord_on)
TapeStartRecording();
#include "main.h"
-BOOL ConnectToServer(char *, int);
+boolean ConnectToServer(char *, int);
void SendToServer_Nickname(char *);
void SendToServer_ProtocolVersion(void);
void SendToServer_NrWanted(int);
}
else if (y==8)
{
- if (autorecord_on)
+ if (setup.autorecord_on)
TapeStartRecording();
- if (network)
+ if (options.network)
SendToServer_StartPlaying();
else
{
new_joystick_xmiddle = joy_ctrl.x;
new_joystick_ymiddle = joy_ctrl.y;
- joystick[joystick_nr].xleft = new_joystick_xleft;
- joystick[joystick_nr].yupper = new_joystick_yupper;
- joystick[joystick_nr].xright = new_joystick_xright;
- joystick[joystick_nr].ylower = new_joystick_ylower;
- joystick[joystick_nr].xmiddle = new_joystick_xmiddle;
- joystick[joystick_nr].ymiddle = new_joystick_ymiddle;
+ joystick[setup.joystick_nr].xleft = new_joystick_xleft;
+ joystick[setup.joystick_nr].yupper = new_joystick_yupper;
+ joystick[setup.joystick_nr].xright = new_joystick_xright;
+ joystick[setup.joystick_nr].ylower = new_joystick_ylower;
+ joystick[setup.joystick_nr].xmiddle = new_joystick_xmiddle;
+ joystick[setup.joystick_nr].ymiddle = new_joystick_ymiddle;
CheckJoystickData();
{
TapeStartRecording();
- if (network)
+ if (options.network)
SendToServer_StartPlaying();
else
{
switch(CheckSoundButtons(mx,my,button))
{
case BUTTON_SOUND_MUSIC:
- if (sound_music_on)
+ if (setup.sound_music_on)
{
- sound_music_on = FALSE;
+ setup.sound_music_on = FALSE;
local_player->setup &= ~SETUP_SOUND_MUSIC;
FadeSound(background_loop[level_nr % num_bg_loops]);
DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
}
else if (sound_loops_allowed)
{
- sound_on = sound_music_on = TRUE;
+ setup.sound_on = setup.sound_music_on = TRUE;
local_player->setup |= (SETUP_SOUND | SETUP_SOUND_MUSIC);
PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
DrawSoundDisplay(BUTTON_SOUND_MUSIC_ON);
break;
case BUTTON_SOUND_LOOPS:
- if (sound_loops_on)
+ if (setup.sound_loops_on)
{
- sound_loops_on = FALSE;
+ setup.sound_loops_on = FALSE;
local_player->setup &= ~SETUP_SOUND_LOOPS;
DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
}
else if (sound_loops_allowed)
{
- sound_on = sound_loops_on = TRUE;
+ setup.sound_on = setup.sound_loops_on = TRUE;
local_player->setup |= (SETUP_SOUND | SETUP_SOUND_LOOPS);
DrawSoundDisplay(BUTTON_SOUND_LOOPS_ON);
}
break;
case BUTTON_SOUND_SIMPLE:
- if (sound_simple_on)
+ if (setup.sound_simple_on)
{
- sound_simple_on = FALSE;
+ setup.sound_simple_on = FALSE;
local_player->setup &= ~SETUP_SOUND;
DrawSoundDisplay(BUTTON_SOUND_SIMPLE_OFF);
}
else if (sound_status==SOUND_AVAILABLE)
{
- sound_on = sound_simple_on = TRUE;
+ setup.sound_on = setup.sound_simple_on = TRUE;
local_player->setup |= SETUP_SOUND;
DrawSoundDisplay(BUTTON_SOUND_SIMPLE_ON);
}
if (Request("Do you really want to quit the game ?",
REQ_ASK | REQ_STAY_CLOSED))
{
- if (network)
+ if (options.network)
SendToServer_StopPlaying();
else
{
break;
case BUTTON_GAME_PAUSE:
- if (network)
+ if (options.network)
{
if (tape.pausing)
SendToServer_ContinuePlaying();
/*
if (tape.pausing)
{
- if (network)
+ if (options.network)
SendToServer_ContinuePlaying();
else
{
}
else
{
- if (network)
+ if (options.network)
SendToServer_PausePlaying();
else
{
case BUTTON_GAME_PLAY:
if (tape.pausing)
{
- if (network)
+ if (options.network)
SendToServer_ContinuePlaying();
else
{
char *sample_ptr;
long sample_size, max_sample_size;
long fragment_size;
- BOOL stereo;
+ boolean stereo;
if (playing_sounds || (sound_device=open(sound_device_name,O_WRONLY))>=0)
{
return(ptr[0]<<24 | ptr[1]<<16 | ptr[2]<<8 | ptr[3]);
}
-BOOL LoadSound(struct SoundInfo *snd_info)
+boolean LoadSound(struct SoundInfo *snd_info)
{
FILE *file;
char filename[256];
PlaySoundExt(nr, PSND_MAX_VOLUME, PSND_MIDDLE, PSND_LOOP);
}
-void PlaySoundExt(int nr, int volume, int stereo, BOOL loop)
+void PlaySoundExt(int nr, int volume, int stereo, boolean loop)
{
struct SoundControl snd_ctrl = emptySoundControl;
- if (sound_status==SOUND_OFF || !sound_on)
+ if (sound_status==SOUND_OFF || !setup.sound_on)
return;
if (volume<PSND_MIN_VOLUME)
int nr;
int volume;
int stereo;
- BOOL active;
- BOOL loop;
- BOOL fade_sound;
- BOOL stop_sound;
- BOOL stop_all_sounds;
+ boolean active;
+ boolean loop;
+ boolean fade_sound;
+ boolean stop_sound;
+ boolean stop_all_sounds;
int playingtime;
long playingpos;
long data_len;
int ulaw_to_linear(unsigned char);
/* application functions */
-BOOL LoadSound(struct SoundInfo *);
+boolean LoadSound(struct SoundInfo *);
void PlaySound(int);
void PlaySoundStereo(int, int);
void PlaySoundLoop(int);
-void PlaySoundExt(int, int, int, BOOL);
+void PlaySoundExt(int, int, int, boolean);
void FadeSound(int);
void FadeSounds(void);
void StopSound(int);
return(NULL);
}
-BOOL TapePlayDelay()
+boolean TapePlayDelay()
{
if (!tape.playing || tape.pausing)
return(FALSE);
void TapeStartPlaying(void);
void TapeStopPlaying(void);
int *TapePlayAction(void);
-BOOL TapePlayDelay(void);
+boolean TapePlayDelay(void);
void TapeStop(void);
void TapeErase(void);
unsigned int GetTapeLength(void);
#include <math.h>
#ifdef MSDOS
-extern BOOL wait_for_vsync;
+extern boolean wait_for_vsync;
#endif
void SetDrawtoField(int mode)
{
- if (mode == DRAW_BUFFERED && soft_scrolling_on)
+ if (mode == DRAW_BUFFERED && setup.soft_scrolling_on)
{
FX = TILEX;
FY = TILEY;
int x,y;
Drawable buffer = (drawto_field != window ? drawto_field : backbuffer);
- if (direct_draw_on && game_status == PLAYING)
+ if (setup.direct_draw_on && game_status == PLAYING)
redraw_mask &= ~REDRAW_MAIN;
if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD)
{
int fx = FX, fy = FY;
- if (soft_scrolling_on)
+ if (setup.soft_scrolling_on)
{
fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
/*
long fading_delay = 300;
- if (fading_on && (redraw_mask & REDRAW_FIELD))
+ if (setup.fading_on && (redraw_mask & REDRAW_FIELD))
{
*/
XFillRectangle(display,backbuffer,gc,
REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
- if (soft_scrolling_on && game_status==PLAYING)
+ if (setup.soft_scrolling_on && game_status==PLAYING)
{
XFillRectangle(display,fieldbuffer,gc,
0,0, FXSIZE,FYSIZE);
else
SetDrawtoField(DRAW_BACKBUFFER);
- if (direct_draw_on && game_status==PLAYING)
+ if (setup.direct_draw_on && game_status==PLAYING)
{
XFillRectangle(display,window,gc,
REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
if (!IN_SCR_FIELD(sx,sy))
return;
- if (direct_draw_on)
+ if (setup.direct_draw_on)
SetDrawtoField(DRAW_BUFFERED);
/* draw things behind the player, if needed */
syy = player->GfxPos;
}
- if (!soft_scrolling_on && ScreenMovPos)
+ if (!setup.soft_scrolling_on && ScreenMovPos)
sxx = syy = 0;
DrawGraphicShiftedThruMask(sx,sy, sxx,syy, graphic, NO_CUTTING);
GFX_EXPLOSION + ((phase-1)/delay-1));
}
- if (direct_draw_on)
+ if (setup.direct_draw_on)
{
int dest_x = SX + SCREENX(MIN(jx,last_jx))*TILEX;
int dest_y = SY + SCREENY(MIN(jy,last_jy))*TILEY;
}
else if (element==EL_MAUER_LEBT)
{
- BOOL links_massiv = FALSE, rechts_massiv = FALSE;
+ boolean links_massiv = FALSE, rechts_massiv = FALSE;
if (!IN_LEV_FIELD(ux-1,uy) || IS_MAUER(Feld[ux-1][uy]))
links_massiv = TRUE;
if (IS_MOVING(ux,uy))
{
int horiz_move = (MovDir[ux][uy]==MV_LEFT || MovDir[ux][uy]==MV_RIGHT);
- BOOL cut_mode = NO_CUTTING;
+ boolean cut_mode = NO_CUTTING;
if (Store[ux][uy]==EL_MORAST_LEER ||
Store[ux][uy]==EL_SIEB_LEER ||
int oldx,oldy;
int sx, sy;
int horiz_move;
- BOOL cut_mode = NO_CUTTING;
+ boolean cut_mode = NO_CUTTING;
Blocked2Moving(ux,uy,&oldx,&oldy);
sx = SCREENX(oldx);
for(y=BY1; y<=BY2; y++)
DrawScreenField(x,y);
- if (soft_scrolling_on)
+ if (setup.soft_scrolling_on)
XCopyArea(display,fieldbuffer,backbuffer,gc,
FX,FY, SXSIZE,SYSIZE,
SX,SY);
return(0);
}
-BOOL Request(char *text, unsigned int req_state)
+boolean Request(char *text, unsigned int req_state)
{
int mx,my, ty, result = -1;
unsigned int old_door_state;
/* pause network game while waiting for request to answer */
- if (network && game_status == PLAYING && req_state & REQUEST_WAIT_FOR)
+ if (options.network &&
+ game_status == PLAYING &&
+ req_state & REQUEST_WAIT_FOR)
SendToServer_PausePlaying();
old_door_state = GetDoorState();
}
/* continue network game after request */
- if (network && game_status == PLAYING && req_state & REQUEST_WAIT_FOR)
+ if (options.network &&
+ game_status == PLAYING &&
+ req_state & REQUEST_WAIT_FOR)
SendToServer_ContinuePlaying();
return(result);
else if (door2==DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2)
door_state &= ~DOOR_CLOSE_2;
- if (quick_doors)
+ if (setup.quick_doors)
{
stepsize = 20;
door_delay_value = 0;
void DrawLevel(void);
void DrawMiniLevel(int, int);
void DrawMicroLevel(int, int);
-BOOL Request(char *, unsigned int);
+boolean Request(char *, unsigned int);
unsigned int OpenDoor(unsigned int);
unsigned int CloseDoor(unsigned int);
unsigned int GetDoorState(void);