static void PrepareBackbuffer()
{
/* Fill empty backbuffer for animation functions */
- if (setup.direct_draw && game_status == PLAYING)
+ if (setup.direct_draw && game_status == GAME_MODE_PLAYING)
{
int xx,yy;
SetDrawtoField(DRAW_DIRECT);
}
- if (setup.soft_scrolling && game_status == PLAYING)
+ if (setup.soft_scrolling && game_status == GAME_MODE_PLAYING)
{
int fx = FX, fy = FY;
boolean ToonNeedsRedraw()
{
- return (game_status == HELPSCREEN ||
- (game_status == MAINMENU &&
+ return (game_status == GAME_MODE_INFO ||
+ (game_status == GAME_MODE_MAIN &&
((redraw_mask & REDRAW_MICROLEVEL) ||
(redraw_mask & REDRAW_MICROLABEL))));
}
{ "background.SETUP", UNDEFINED_FILENAME },
{ "background.DOOR", UNDEFINED_FILENAME },
- /* the following directives are not associated with an image,
- but make sense to be defined in "graphicsinfo.conf", too */
+ /* the following directives are not associated with an image, but
+ probably make sense to be defined in "graphicsinfo.conf", too */
{ "global.num_toons", "20" },
{ "menu.draw_yoffset", "0" },
{ "menu.draw_xoffset.MAIN", "0" },
{ "menu.draw_yoffset.MAIN", "0" },
+ { "menu.draw_xoffset.LEVELS", "0" },
+ { "menu.draw_yoffset.LEVELS", "0" },
+ { "menu.draw_xoffset.SCORES", "0" },
+ { "menu.draw_yoffset.SCORES", "0" },
+ { "menu.draw_xoffset.EDITOR", "0" },
+ { "menu.draw_yoffset.EDITOR", "0" },
+ { "menu.draw_xoffset.INFO", "0" },
+ { "menu.draw_yoffset.INFO", "0" },
+ { "menu.draw_xoffset.SETUP", "0" },
+ { "menu.draw_yoffset.SETUP", "0" },
{ "door.step_offset", "2" },
{ "door.step_delay", "10" },
-#define COMPILE_DATE_STRING "[2003-04-26 19:05]"
+#define COMPILE_DATE_STRING "[2003-04-26 20:44]"
int old_game_status = game_status;
/* setting 'game_status' is needed to get the right fonts for the editor */
- game_status = LEVELED;
+ game_status = GAME_MODE_EDITOR;
ReinitializeElementList();
TapeStartRecording();
level_editor_test_game = TRUE;
- game_status = PLAYING;
+ game_status = GAME_MODE_PLAYING;
InitGame();
}
char shortcut[MAX_OUTPUT_LINESIZE + 1];
int max_infotext_len = getMaxInfoTextLength();
- if (game_status != LEVELED)
+ if (game_status != GAME_MODE_EDITOR)
return;
ClearEditorGadgetInfoText();
/*
CloseDoor(DOOR_CLOSE_ALL);
*/
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
else
cursor_inside_playfield = (motion->x >= SX && motion->x < SX + SXSIZE &&
motion->y >= SY && motion->y < SY + SYSIZE);
- if (game_status == PLAYING && playfield_cursor_set)
+ if (game_status == GAME_MODE_PLAYING && playfield_cursor_set)
{
SetMouseCursor(CURSOR_DEFAULT);
playfield_cursor_set = FALSE;
}
/* skip mouse motion events without pressed button outside level editor */
- if (button_status == MB_RELEASED && game_status != LEVELED)
+ if (button_status == MB_RELEASED && game_status != GAME_MODE_EDITOR)
return 0;
else
return 1;
else
{
/* when playing, display a special mouse pointer inside the playfield */
- if (game_status == PLAYING)
+ if (game_status == GAME_MODE_PLAYING)
{
if (!playfield_cursor_set && cursor_inside_playfield &&
DelayReached(&playfield_cursor_delay, 1000))
/* don't use all CPU time when idle; the main loop while playing
has its own synchronization and is CPU friendly, too */
- if (game_status == PLAYING)
+ if (game_status == GAME_MODE_PLAYING)
HandleGameActions();
else
{
/* refresh window contents from drawing buffer, if needed */
BackToFront();
- if (game_status == EXITGAME)
+ if (game_status == GAME_MODE_QUIT)
return;
}
}
}
}
- if (game_status == PLAYING)
+ if (game_status == GAME_MODE_PLAYING)
KeyboardAutoRepeatOff();
}
return; /* window and pointer are on different screens */
#if 1
- if (button_status == MB_RELEASED && game_status != LEVELED)
+ if (button_status == MB_RELEASED && game_status != GAME_MODE_EDITOR)
return;
#endif
void HandleKeyEvent(KeyEvent *event)
{
int key_status = (event->type==EVENT_KEYPRESS ? KEY_PRESSED : KEY_RELEASED);
- boolean with_modifiers = (game_status == PLAYING ? FALSE : TRUE);
+ boolean with_modifiers = (game_status == GAME_MODE_PLAYING ? FALSE : TRUE);
Key key = GetEventKey(event, with_modifiers);
HandleKey(key, key_status);
because unfortunately this is a global setting and not (which
would be far better) set for each X11 window individually.
The effect would be keyboard auto repeat while playing the game
- (game_status == PLAYING), which is not desired.
+ (game_status == GAME_MODE_PLAYING), which is not desired.
To avoid this special case, we just wait 1/10 second before
processing the 'FocusIn' event.
*/
- if (game_status == PLAYING)
+ if (game_status == GAME_MODE_PLAYING)
{
Delay(100);
KeyboardAutoRepeatOff();
switch(game_status)
{
- case MAINMENU:
+ case GAME_MODE_MAIN:
HandleMainMenu(mx,my, 0,0, button);
break;
- case TYPENAME:
+ case GAME_MODE_PSEUDO_TYPENAME:
HandleTypeName(0, KSYM_Return);
break;
- case CHOOSELEVEL:
+ case GAME_MODE_LEVELS:
HandleChooseLevel(mx,my, 0,0, button);
break;
- case HALLOFFAME:
+ case GAME_MODE_SCORES:
HandleHallOfFame(0,0, 0,0, button);
break;
- case LEVELED:
+ case GAME_MODE_EDITOR:
break;
- case HELPSCREEN:
+ case GAME_MODE_INFO:
HandleHelpScreen(button);
break;
- case SETUP:
+ case GAME_MODE_SETUP:
HandleSetupScreen(mx,my, 0,0, button);
break;
- case PLAYING:
+ case GAME_MODE_PLAYING:
#ifdef DEBUG
if (button == MB_RELEASED)
{
{ &custom_key.bomb, DEFAULT_KEY_BOMB, JOY_BUTTON_2 }
};
- if (game_status == PLAYING)
+ if (game_status == GAME_MODE_PLAYING)
{
/* only needed for single-step tape recording mode */
static boolean clear_button_2[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
HandleJoystick();
}
- if (game_status != PLAYING)
+ if (game_status != GAME_MODE_PLAYING)
key_joystick_mapping = 0;
if (key_status == KEY_RELEASED)
return;
if ((key == KSYM_Return || key == setup.shortcut.toggle_pause) &&
- game_status == PLAYING && AllPlayersGone)
+ game_status == GAME_MODE_PLAYING && AllPlayersGone)
{
CloseDoor(DOOR_CLOSE_1);
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
return;
}
/* allow quick escape to the main menu with the Escape key */
if (key == KSYM_Escape &&
- game_status != MAINMENU &&
- game_status != PLAYING &&
- game_status != LEVELED &&
- game_status != CHOOSELEVEL &&
- game_status != SETUP)
+ game_status != GAME_MODE_MAIN &&
+ game_status != GAME_MODE_PLAYING &&
+ game_status != GAME_MODE_EDITOR &&
+ game_status != GAME_MODE_LEVELS &&
+ game_status != GAME_MODE_SETUP)
{
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
return;
}
/* special key shortcuts */
- if (game_status == MAINMENU || game_status == PLAYING)
+ if (game_status == GAME_MODE_MAIN || game_status == GAME_MODE_PLAYING)
{
if (key == setup.shortcut.save_game)
TapeQuickSave();
#if 0
#ifndef DEBUG
- if (game_status == PLAYING && (tape.playing || tape.pausing))
+ if (game_status == GAME_MODE_PLAYING && (tape.playing || tape.pausing))
return;
#endif
switch(game_status)
{
- case TYPENAME:
+ case GAME_MODE_PSEUDO_TYPENAME:
HandleTypeName(0, key);
break;
- case MAINMENU:
- case CHOOSELEVEL:
- case SETUP:
+ case GAME_MODE_MAIN:
+ case GAME_MODE_LEVELS:
+ case GAME_MODE_SETUP:
switch(key)
{
case KSYM_Return:
- if (game_status == MAINMENU)
+ if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE);
- else if (game_status == CHOOSELEVEL)
+ else if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0, 0,0, MB_MENU_CHOICE);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 0,0, MB_MENU_CHOICE);
break;
case KSYM_Escape:
- if (game_status == CHOOSELEVEL)
+ if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0, 0,0, MB_MENU_LEAVE);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 0,0, MB_MENU_LEAVE);
break;
case KSYM_Page_Up:
- if (game_status == CHOOSELEVEL)
+ if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0, 0,-SCR_FIELDY, MB_MENU_MARK);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 0,-SCR_FIELDY, MB_MENU_MARK);
break;
case KSYM_Page_Down:
- if (game_status == CHOOSELEVEL)
+ if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0, 0,SCR_FIELDY, MB_MENU_MARK);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 0,SCR_FIELDY, MB_MENU_MARK);
break;
}
break;
- case HELPSCREEN:
+ case GAME_MODE_INFO:
HandleHelpScreen(MB_RELEASED);
break;
- case HALLOFFAME:
+ case GAME_MODE_SCORES:
switch(key)
{
case KSYM_Return:
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
BackToFront();
break;
}
break;
- case LEVELED:
+ case GAME_MODE_EDITOR:
if (!anyTextGadgetActiveOrJustFinished || key == KSYM_Escape)
HandleLevelEditorKeyInput(key);
break;
- case PLAYING:
+ case GAME_MODE_PLAYING:
{
switch(key)
{
void HandleNoEvent()
{
- if (button_status && game_status != PLAYING)
+ if (button_status && game_status != GAME_MODE_PLAYING)
{
HandleButton(0, 0, -button_status);
return;
switch(game_status)
{
- case MAINMENU:
- case CHOOSELEVEL:
- case SETUP:
+ case GAME_MODE_MAIN:
+ case GAME_MODE_LEVELS:
+ case GAME_MODE_SETUP:
{
static unsigned long joystickmove_delay = 0;
!DelayReached(&joystickmove_delay, GADGET_FRAME_DELAY))
newbutton = dx = dy = 0;
- if (game_status == MAINMENU)
+ if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
- else if (game_status == CHOOSELEVEL)
+ else if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
break;
}
- case HALLOFFAME:
+ case GAME_MODE_SCORES:
HandleHallOfFame(0,0, dx,dy, !newbutton);
break;
- case HELPSCREEN:
+ case GAME_MODE_INFO:
HandleHelpScreen(!newbutton);
break;
- case LEVELED:
+ case GAME_MODE_EDITOR:
HandleLevelEditorIdle();
break;
- case PLAYING:
+ case GAME_MODE_PLAYING:
if (tape.playing || keyboard)
newbutton = ((joy & JOY_BUTTON) != 0);
if (AllPlayersGone && newbutton)
{
CloseDoor(DOOR_CLOSE_1);
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
return;
}
if ((hi_pos = NewHiScore()) >= 0)
{
- game_status = HALLOFFAME;
+ game_status = GAME_MODE_SCORES;
DrawHallOfFame(hi_pos);
if (raise_level)
{
}
else
{
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
if (raise_level)
{
level_nr++;
byte *recorded_player_action;
byte summarized_player_action = 0;
- if (game_status != PLAYING)
+ if (game_status != GAME_MODE_PLAYING)
return;
action_delay_value =
HandleNetworking();
#endif
- if (game_status != PLAYING)
+ if (game_status != GAME_MODE_PLAYING)
return;
if (!network_player_action_received)
else
#endif
{
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
}
{
int id = gi->custom_id;
- if (game_status != PLAYING)
+ if (game_status != GAME_MODE_PLAYING)
return;
switch (id)
{
int special = -1;
- if (game_status == MAINMENU || game_status == TYPENAME)
+ if (game_status >= GAME_MODE_MAIN && game_status <= GAME_MODE_PSEUDO_PREVIEW)
+ special = game_status;
+ else if (game_status == GAME_MODE_PSEUDO_TYPENAME)
special = GFX_SPECIAL_ARG_MAIN;
- else if (game_status == CHOOSELEVEL)
- special = GFX_SPECIAL_ARG_LEVELS;
- else if (game_status == HALLOFFAME)
- special = GFX_SPECIAL_ARG_SCORES;
- else if (game_status == LEVELED)
- special = GFX_SPECIAL_ARG_EDITOR;
- else if (game_status == HELPSCREEN)
- special = GFX_SPECIAL_ARG_INFO;
- else if (game_status == SETUP)
- special = GFX_SPECIAL_ARG_SETUP;
- else if (game_status == PSEUDO_PREVIEW)
- special = GFX_SPECIAL_ARG_PREVIEW;
- else if (game_status == PLAYING || game_status == PSEUDO_DOOR)
+ else if (game_status == GAME_MODE_PLAYING)
special = GFX_SPECIAL_ARG_DOOR;
if (special != -1)
"menu.draw_yoffset",
"menu.draw_xoffset.MAIN",
"menu.draw_yoffset.MAIN",
+ "menu.draw_xoffset.LEVELS",
+ "menu.draw_yoffset.LEVELS",
+ "menu.draw_xoffset.SCORES",
+ "menu.draw_yoffset.SCORES",
+ "menu.draw_xoffset.EDITOR",
+ "menu.draw_yoffset.EDITOR",
+ "menu.draw_xoffset.INFO",
+ "menu.draw_yoffset.INFO",
+ "menu.draw_xoffset.SETUP",
+ "menu.draw_yoffset.SETUP",
"door.step_offset",
"door.step_delay",
NULL
return;
}
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
/*
djb2
- this algorithm (k=33) was first reported by dan bernstein many years ago in
- comp.lang.c. another version of this algorithm (now favored by bernstein)
- uses xor: hash(i) = hash(i - 1) * 33 ^ str[i]; the magic of number 33 (why
+ This algorithm (k=33) was first reported by Dan Bernstein many years ago in
+ 'comp.lang.c'. Another version of this algorithm (now favored by Bernstein)
+ uses XOR: hash(i) = hash(i - 1) * 33 ^ str[i]; the magic of number 33 (why
it works better than many other constants, prime or not) has never been
adequately explained.
+
+ If you just want to have a good hash function, and cannot wait, djb2
+ is one of the best string hash functions i know. It has excellent
+ distribution and speed on many different sets of keys and table sizes.
+ You are not likely to do better with one of the "well known" functions
+ such as PJW, K&R, etc.
+
+ Ozan (oz) Yigit [http://www.cs.yorku.ca/~oz/hash.html]
*/
char *str = (char *)key;
#ifdef DEBUG
static void printSetupFileHash(SetupFileHash *hash)
{
-#if 0
- if (hash == NULL)
- return;
-
- /* iterator constructor only returns valid iterator for non-empty hash */
- if (hash != NULL && hashtable_count(hash) > 0)
- {
- struct hashtable_itr *itr = hashtable_iterator(hash);
-
- do
- {
- printf("token: '%s'\n", (char *)hashtable_iterator_key(itr));
- printf("value: '%s'\n", (char *)hashtable_iterator_value(itr));
- }
- while (hashtable_iterator_advance(itr));
-
- free(itr);
- }
-#endif
-
BEGIN_HASH_ITERATION(hash, itr)
{
printf("token: '%s'\n", HASH_ITERATION_TOKEN(itr));
struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
{
- { ".MAIN", 0, },
- { ".LEVELS", 0, },
- { ".SCORES", 0, },
- { ".EDITOR", 0, },
- { ".INFO", 0, },
- { ".SETUP", 0, },
- { ".DOOR", 0, },
- { ".PREVIEW", 0, },
+ { ".MAIN", GAME_MODE_MAIN, },
+ { ".LEVELS", GAME_MODE_LEVELS },
+ { ".SCORES", GAME_MODE_SCORES, },
+ { ".EDITOR", GAME_MODE_EDITOR, },
+ { ".INFO", GAME_MODE_INFO, },
+ { ".SETUP", GAME_MODE_SETUP, },
+ { ".DOOR", GAME_MODE_PSEUDO_DOOR, },
+ { ".PREVIEW", GAME_MODE_PSEUDO_PREVIEW, },
{ NULL, 0, }
};
#define NUM_ACTIONS 26
-/* values for special image configuration suffixes */
+/* values for special image configuration suffixes (must match game mode) */
#define GFX_SPECIAL_ARG_MAIN 0
#define GFX_SPECIAL_ARG_LEVELS 1
#define GFX_SPECIAL_ARG_SCORES 2
#define NUM_FONTS 28
#define NUM_INITIAL_FONTS 4
-/* values for game_status */
-#define EXITGAME 0
-#define MAINMENU 1
-#define PLAYING 2
-#define LEVELED 3
-#define HELPSCREEN 4
-#define CHOOSELEVEL 5
-#define TYPENAME 6
-#define HALLOFFAME 7
-#define SETUP 8
-#define PSEUDO_PREVIEW 9
-#define PSEUDO_DOOR 10
+/* values for game_status (must match special image configuration suffixes) */
+#define GAME_MODE_MAIN 0
+#define GAME_MODE_LEVELS 1
+#define GAME_MODE_SCORES 2
+#define GAME_MODE_EDITOR 3
+#define GAME_MODE_INFO 4
+#define GAME_MODE_SETUP 5
+#define GAME_MODE_PSEUDO_DOOR 6
+#define GAME_MODE_PSEUDO_PREVIEW 7
+
+/* there are no special config file suffixes for these modes */
+#define GAME_MODE_PLAYING 8
+#define GAME_MODE_PSEUDO_TYPENAME 9
+#define GAME_MODE_QUIT 10
#define PROGRAM_VERSION_MAJOR 2
#define PROGRAM_VERSION_MINOR 2
InitRND(new_random_seed);
- game_status = PLAYING;
+ game_status = GAME_MODE_PLAYING;
InitGame();
}
printf("OP_STOP_PLAYING: %d\n", buffer[0]);
Error(ERR_NETWORK_CLIENT, "client %d stops game", buffer[0]);
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
static int mSX = SX;
static int mSY = SY;
#else
-#define mSX (SX + (game_status == MAINMENU ? global.menu_draw_xoffset_MAIN : \
+#define mSX (SX + (game_status == GAME_MODE_MAIN ? global.menu_draw_xoffset_MAIN : \
global.menu_draw_xoffset))
-#define mSY (SY + (game_status == MAINMENU ? global.menu_draw_yoffset_MAIN : \
+#define mSY (SY + (game_status == GAME_MODE_MAIN ? global.menu_draw_yoffset_MAIN : \
global.menu_draw_yoffset))
#endif
/* needed if last screen was the playing screen, invoked from level editor */
if (level_editor_test_game)
{
- game_status = LEVELED;
+ game_status = GAME_MODE_EDITOR;
DrawLevelEd();
return;
}
{
if (y == 0)
{
- game_status = TYPENAME;
+ game_status = GAME_MODE_PSEUDO_TYPENAME;
HandleTypeName(strlen(setup.player_name), 0);
}
else if (y == 1)
{
if (leveldir_first)
{
- game_status = CHOOSELEVEL;
+ game_status = GAME_MODE_LEVELS;
SaveLevelSetup_LastSeries();
SaveLevelSetup_SeriesInfo();
}
else if (y == 2)
{
- game_status = HALLOFFAME;
+ game_status = GAME_MODE_SCORES;
DrawHallOfFame(-1);
}
else if (y == 3)
if (leveldir_current->readonly &&
strcmp(setup.player_name, "Artsoft") != 0)
Request("This level is read only !", REQ_CONFIRM);
- game_status = LEVELED;
+ game_status = GAME_MODE_EDITOR;
DrawLevelEd();
}
else if (y == 4)
{
- game_status = HELPSCREEN;
+ game_status = GAME_MODE_INFO;
DrawHelpScreen();
}
else if (y == 5)
else
#endif
{
- game_status = PLAYING;
+ game_status = GAME_MODE_PLAYING;
StopAnimation();
InitGame();
}
}
else if (y == 6)
{
- game_status = SETUP;
+ game_status = GAME_MODE_SETUP;
setup_mode = SETUP_MODE_MAIN;
DrawSetupScreen();
}
SaveLevelSetup_LastSeries();
SaveLevelSetup_SeriesInfo();
if (Request("Do you really want to quit ?", REQ_ASK | REQ_STAY_CLOSED))
- game_status = EXITGAME;
+ game_status = GAME_MODE_QUIT;
}
}
}
out:
- if (game_status == MAINMENU)
+ if (game_status == GAME_MODE_MAIN)
{
DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, FALSE);
DoAnimation();
{
FadeSounds();
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
}
DrawText(startx + xpos * font_width, starty, " ", FONT_INPUT_1_ACTIVE);
SaveSetup();
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
}
BackToFront();
DrawText(SX + offset, SY + offset, title_string, FONT_TITLE_1);
- game_status = CHOOSELEVEL; /* force LEVELS font on artwork setup screen */
+ /* force LEVELS font on artwork setup screen */
+ game_status = GAME_MODE_LEVELS;
for(i=0; i<num_page_entries; i++)
{
*ti_ptr = ti->node_parent;
DrawChooseTree(ti_ptr);
}
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
{
execSetupArtwork();
}
else
{
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
TapeErase();
}
- if (game_status == SETUP)
+ if (game_status == GAME_MODE_SETUP)
{
execSetupArtwork();
}
else
{
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
}
BackToFront();
- if (game_status == CHOOSELEVEL || game_status == SETUP)
+ if (game_status == GAME_MODE_LEVELS || game_status == GAME_MODE_SETUP)
DoAnimation();
}
if (button_released)
{
FadeSound(SND_BACKGROUND_SCORES);
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
BackToFront();
- if (game_status == HALLOFFAME)
+ if (game_status == GAME_MODE_SCORES)
{
DoAnimation();
#if 1
static void execExitSetup()
{
- game_status = MAINMENU;
+ game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
BackToFront();
- if (game_status == SETUP)
+ if (game_status == GAME_MODE_SETUP)
DoAnimation();
}
out:
- if (game_status == SETUP)
+ if (game_status == GAME_MODE_SETUP)
DoAnimation();
}
void HandleGameActions()
{
- if (game_status != PLAYING)
+ if (game_status != GAME_MODE_PLAYING)
return;
if (local_player->LevelSolved)
{
int id = gi->custom_id;
- if (game_status != CHOOSELEVEL && game_status != SETUP)
+ if (game_status != GAME_MODE_LEVELS && game_status != GAME_MODE_SETUP)
return;
switch (id)
{
case SCREEN_CTRL_ID_SCROLL_UP:
- if (game_status == CHOOSELEVEL)
+ if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(SX,SY + 32, 0,0, MB_MENU_MARK);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(SX,SY + 32, 0,0, MB_MENU_MARK);
break;
case SCREEN_CTRL_ID_SCROLL_DOWN:
- if (game_status == CHOOSELEVEL)
+ if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(SX,SY + SYSIZE - 32, 0,0, MB_MENU_MARK);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(SX,SY + SYSIZE - 32, 0,0, MB_MENU_MARK);
break;
case SCREEN_CTRL_ID_SCROLL_VERTICAL:
- if (game_status == CHOOSELEVEL)
+ if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0, 999,gi->event.item_position,MB_MENU_INITIALIZE);
- else if (game_status == SETUP)
+ else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 999,gi->event.item_position,MB_MENU_INITIALIZE);
break;
else
#endif
{
- game_status = PLAYING;
+ game_status = GAME_MODE_PLAYING;
StopAnimation();
InitGame();
}
{
TapeStartPlaying();
- game_status = PLAYING;
+ game_status = GAME_MODE_PLAYING;
StopAnimation();
InitGame();
}
void TapeQuickSave()
{
- if (game_status == PLAYING)
+ if (game_status == GAME_MODE_PLAYING)
{
if (tape.recording)
TapeHaltRecording(); /* prepare tape for saving on-the-fly */
else
SaveTape(tape.level_nr);
}
- else if (game_status == MAINMENU)
+ else if (game_status == GAME_MODE_MAIN)
Request("No game that can be saved !", REQ_CONFIRM);
}
void TapeQuickLoad()
{
- if (game_status == PLAYING || game_status == MAINMENU)
+ if (game_status == GAME_MODE_PLAYING || game_status == GAME_MODE_MAIN)
{
TapeStop();
TapeErase();
{
int id = gi->custom_id;
- if (game_status != MAINMENU && game_status != PLAYING)
+ if (game_status != GAME_MODE_MAIN && game_status != GAME_MODE_PLAYING)
return;
switch (id)
void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height)
{
- if (game_status == PLAYING)
+ if (game_status == GAME_MODE_PLAYING)
{
if (force_redraw)
{
int x,y;
DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field);
- if (setup.direct_draw && game_status == PLAYING)
+ if (setup.direct_draw && game_status == GAME_MODE_PLAYING)
redraw_mask &= ~REDRAW_MAIN;
if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD)
if (redraw_mask == REDRAW_NONE)
return;
- if (global.fps_slowdown && game_status == PLAYING)
+ if (global.fps_slowdown && game_status == GAME_MODE_PLAYING)
{
static boolean last_frame_skipped = FALSE;
boolean skip_even_when_not_scrolling = TRUE;
if (redraw_mask & REDRAW_FIELD)
{
- if (game_status != PLAYING || redraw_mask & REDRAW_FROM_BACKBUFFER)
+ if (game_status != GAME_MODE_PLAYING ||
+ redraw_mask & REDRAW_FROM_BACKBUFFER)
{
BlitBitmap(backbuffer, window,
REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY);
{
DrawBackground(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
- if (setup.soft_scrolling && game_status == PLAYING)
+ if (setup.soft_scrolling && game_status == GAME_MODE_PLAYING)
{
ClearRectangle(fieldbuffer, 0, 0, FXSIZE, FYSIZE);
SetDrawtoField(DRAW_BUFFERED);
else
SetDrawtoField(DRAW_BACKBUFFER);
- if (setup.direct_draw && game_status == PLAYING)
+ if (setup.direct_draw && game_status == GAME_MODE_PLAYING)
{
ClearRectangle(window, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
SetDrawtoField(DRAW_DIRECT);
static int label_state, label_counter;
int last_game_status = game_status; /* save current game status */
- game_status = PSEUDO_PREVIEW; /* force PREVIEW font on preview level */
+ /* force PREVIEW font on preview level */
+ game_status = GAME_MODE_PSEUDO_PREVIEW;
if (restart)
{
#if defined(PLATFORM_UNIX)
/* pause network game while waiting for request to answer */
if (options.network &&
- game_status == PLAYING &&
+ game_status == GAME_MODE_PLAYING &&
req_state & REQUEST_WAIT_FOR)
SendToServer_PausePlaying();
#endif
/* clear door drawing field */
DrawBackground(DX, DY, DXSIZE, DYSIZE);
- game_status = PSEUDO_DOOR; /* force DOOR font on preview level */
+ /* force DOOR font on preview level */
+ game_status = GAME_MODE_PSEUDO_DOOR;
/* write text for request */
for(ty=0; ty < MAX_REQUEST_LINES; ty++)
return FALSE;
}
- if (game_status != MAINMENU)
+ if (game_status != GAME_MODE_MAIN)
InitAnimation();
button_status = MB_RELEASED;
Delay(10);
}
- if (game_status != MAINMENU)
+ if (game_status != GAME_MODE_MAIN)
StopAnimation();
UnmapToolButtons();
#if defined(PLATFORM_UNIX)
/* continue network game after request */
if (options.network &&
- game_status == PLAYING &&
+ game_status == GAME_MODE_PLAYING &&
req_state & REQUEST_WAIT_FOR)
SendToServer_ContinuePlaying();
#endif
BackToFront();
- if (game_status == MAINMENU)
+ if (game_status == GAME_MODE_MAIN)
DoAnimation();
}
}