From b59a0eedca464cba38e8a6bcfae54db32ac6b15e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 1 Apr 2002 22:22:46 +0200 Subject: [PATCH] rnd-20020401-3-src --- src/Makefile | 9 ++ src/config.c | 30 ++++++ src/config.h | 21 ++++ src/events.c | 4 +- src/files.c | 80 +++++++++++----- src/init.c | 3 +- src/libgame/misc.c | 31 +++++- src/libgame/misc.h | 1 + src/libgame/setup.c | 10 +- src/libgame/setup.h | 28 ++++-- src/libgame/system.h | 11 +++ src/main.h | 7 -- src/screens.c | 224 +++++++++++++++++++++++++++++++++---------- src/screens.h | 11 ++- src/timestamp.h | 1 + 15 files changed, 373 insertions(+), 98 deletions(-) create mode 100644 src/config.c create mode 100644 src/config.h create mode 100644 src/timestamp.h diff --git a/src/Makefile b/src/Makefile index 5b8f1366..4d26807e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -118,6 +118,7 @@ LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm SRCS = main.c \ init.c \ + config.c \ events.c \ tools.c \ screens.c \ @@ -131,6 +132,7 @@ SRCS = main.c \ OBJS = main.o \ init.o \ + config.o \ events.o \ tools.o \ screens.o \ @@ -142,6 +144,8 @@ OBJS = main.o \ network.o \ netserv.o +TIMESTAMP_FILE = timestamp.h + LIBDIR = libgame LIBGAME = $(LIBDIR)/libgame.a @@ -162,6 +166,11 @@ libgame_dir: $(LIBGAME): @$(MAKE) -C $(LIBDIR) +$(TIMESTAMP_FILE): $(SRCS) + @date '+"[%Y-%m-%d %H:%M]"' \ + | sed -e 's/^/#define COMPILE_DATE_STRING /' \ + > $(TIMESTAMP_FILE) + $(ICON): $(BMP2ICO) -transparent $(ICONBASE).ico $(ICON32X32) echo "$(ICONBASE) ICON $(ICONBASE).ico" | $(WINDRES) -o $(ICON) diff --git a/src/config.c b/src/config.c new file mode 100644 index 00000000..9c6ff21e --- /dev/null +++ b/src/config.c @@ -0,0 +1,30 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* config.c * +***********************************************************/ + +#include "libgame/libgame.h" + +#include "config.h" +#include "timestamp.h" + +/* use timestamp created at compile-time */ +#define PROGRAM_BUILD_STRING PROGRAM_IDENT_STRING " " COMPILE_DATE_STRING +#ifdef DEBUG +#undef WINDOW_TITLE_STRING +#define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_BUILD_STRING +#endif + + +char *getWindowTitleString() +{ + return WINDOW_TITLE_STRING; +} diff --git a/src/config.h b/src/config.h new file mode 100644 index 00000000..d9e5d94d --- /dev/null +++ b/src/config.h @@ -0,0 +1,21 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* config.h * +***********************************************************/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "main.h" + +char *getWindowTitleString(void); + +#endif /* CONFIG_H */ diff --git a/src/events.c b/src/events.c index c497116e..c002c78e 100644 --- a/src/events.c +++ b/src/events.c @@ -489,9 +489,9 @@ void HandleKey(Key key, int key_status) /* special shortcuts for quick game tape saving and loading */ if (game_status == MAINMENU || game_status == PLAYING) { - if (key == KSYM_F1) /* save game */ + if (key == setup.shortcut.save_game) TapeQuickSave(); - else if (key == KSYM_F2) /* load game */ + else if (key == setup.shortcut.load_game) TapeQuickLoad(); } diff --git a/src/files.c b/src/files.c index d5ad588b..5da89a73 100644 --- a/src/files.c +++ b/src/files.c @@ -1183,6 +1183,12 @@ void SaveScore(int level_nr) #define NUM_GLOBAL_SETUP_TOKENS 15 +/* shortcut setup */ +#define SETUP_TOKEN_SAVE_GAME 0 +#define SETUP_TOKEN_LOAD_GAME 1 + +#define NUM_SHORTCUT_SETUP_TOKENS 2 + /* player setup */ #define SETUP_TOKEN_USE_JOYSTICK 0 #define SETUP_TOKEN_JOY_DEVICE_NAME 1 @@ -1204,26 +1210,34 @@ void SaveScore(int level_nr) #define NUM_PLAYER_SETUP_TOKENS 16 static struct SetupInfo si; +static struct SetupShortcutInfo ssi; static struct SetupInputInfo sii; static struct TokenInfo global_setup_tokens[] = { /* global setup */ - { TYPE_STRING, &si.player_name, "player_name" }, - { TYPE_SWITCH, &si.sound, "sound" }, - { TYPE_SWITCH, &si.sound_loops, "repeating_sound_loops" }, - { TYPE_SWITCH, &si.sound_music, "background_music" }, - { TYPE_SWITCH, &si.sound_simple, "simple_sound_effects" }, - { TYPE_SWITCH, &si.toons, "toons" }, - { TYPE_SWITCH, &si.scroll_delay, "scroll_delay" }, - { TYPE_SWITCH, &si.soft_scrolling, "soft_scrolling" }, - { TYPE_SWITCH, &si.fading, "screen_fading" }, - { TYPE_SWITCH, &si.autorecord, "automatic_tape_recording" }, - { TYPE_SWITCH, &si.quick_doors, "quick_doors" }, - { TYPE_SWITCH, &si.team_mode, "team_mode" }, - { TYPE_SWITCH, &si.handicap, "handicap" }, - { TYPE_SWITCH, &si.time_limit, "time_limit" }, - { TYPE_SWITCH, &si.fullscreen, "fullscreen" } + { TYPE_STRING, &si.player_name, "player_name" }, + { TYPE_SWITCH, &si.sound, "sound" }, + { TYPE_SWITCH, &si.sound_loops, "repeating_sound_loops" }, + { TYPE_SWITCH, &si.sound_music, "background_music" }, + { TYPE_SWITCH, &si.sound_simple, "simple_sound_effects" }, + { TYPE_SWITCH, &si.toons, "toons" }, + { TYPE_SWITCH, &si.scroll_delay, "scroll_delay" }, + { TYPE_SWITCH, &si.soft_scrolling, "soft_scrolling" }, + { TYPE_SWITCH, &si.fading, "screen_fading" }, + { TYPE_SWITCH, &si.autorecord, "automatic_tape_recording" }, + { TYPE_SWITCH, &si.quick_doors, "quick_doors" }, + { TYPE_SWITCH, &si.team_mode, "team_mode" }, + { TYPE_SWITCH, &si.handicap, "handicap" }, + { TYPE_SWITCH, &si.time_limit, "time_limit" }, + { TYPE_SWITCH, &si.fullscreen, "fullscreen" } +}; + +static struct TokenInfo shortcut_setup_tokens[] = +{ + /* shortcut setup */ + { TYPE_KEY_X11, &ssi.save_game, "shortcut.save_game" }, + { TYPE_KEY_X11, &ssi.load_game, "shortcut.load_game" } }; static struct TokenInfo player_setup_tokens[] = @@ -1239,12 +1253,12 @@ static struct TokenInfo player_setup_tokens[] = { TYPE_INTEGER, &sii.joy.ylower, ".joy.ylower" }, { TYPE_INTEGER, &sii.joy.snap, ".joy.snap_field" }, { TYPE_INTEGER, &sii.joy.bomb, ".joy.place_bomb" }, - { TYPE_KEY, &sii.key.left, ".key.move_left" }, - { TYPE_KEY, &sii.key.right, ".key.move_right" }, - { TYPE_KEY, &sii.key.up, ".key.move_up" }, - { TYPE_KEY, &sii.key.down, ".key.move_down" }, - { TYPE_KEY, &sii.key.snap, ".key.snap_field" }, - { TYPE_KEY, &sii.key.bomb, ".key.place_bomb" } + { TYPE_KEY_X11, &sii.key.left, ".key.move_left" }, + { TYPE_KEY_X11, &sii.key.right, ".key.move_right" }, + { TYPE_KEY_X11, &sii.key.up, ".key.move_up" }, + { TYPE_KEY_X11, &sii.key.down, ".key.move_down" }, + { TYPE_KEY_X11, &sii.key.snap, ".key.snap_field" }, + { TYPE_KEY_X11, &sii.key.bomb, ".key.place_bomb" } }; static void setSetupInfoToDefaults(struct SetupInfo *si) @@ -1270,6 +1284,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->time_limit = TRUE; si->fullscreen = FALSE; + si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME; + si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME; + for (i=0; iinput[i].use_joystick = FALSE; @@ -1298,14 +1315,21 @@ static void decodeSetupFileList(struct SetupFileList *setup_file_list) if (!setup_file_list) return; - /* handle global setup values */ + /* global setup */ si = setup; for (i=0; i 0 && y < num_setup_info - 1 && - setup_info[y].type == TYPE_EMPTY) + (setup_info[y].type & TYPE_SKIP_ENTRY)) y += dy; } if (x == 0 && y >= 0 && y < num_setup_info && - setup_info[y].type != TYPE_EMPTY) + (setup_info[y].type & ~TYPE_SKIP_ENTRY)) { if (button) { @@ -1524,6 +1625,7 @@ void HandleGenericSetupScreen(int mx, int my, int dx, int dy, int button) } else if (!(setup_info[y].type & TYPE_GHOSTED)) { +#if 0 if (setup_info[y].type & TYPE_BOOLEAN_STYLE) { boolean new_value = !*(boolean *)(setup_info[y].value); @@ -1531,12 +1633,34 @@ void HandleGenericSetupScreen(int mx, int my, int dx, int dy, int button) *(boolean *)setup_info[y].value = new_value; drawSetupValue(y); } + else if (setup_info[y].type == TYPE_KEYTEXT && + setup_info[y + 1].type == TYPE_KEY) + { + changeSetupValue(y + 1); + } else if (setup_info[y].type & TYPE_ENTER_OR_LEAVE_MENU) { void (*menu_callback_function)(void) = setup_info[choice].value; menu_callback_function(); } +#else + if (setup_info[y].type & TYPE_ENTER_OR_LEAVE_MENU) + { + void (*menu_callback_function)(void) = setup_info[choice].value; + + menu_callback_function(); + } + else + { + if ((setup_info[y].type & TYPE_KEYTEXT) && + (setup_info[y + 1].type & TYPE_KEY)) + y++; + + if (setup_info[y].type & TYPE_VALUE) + changeSetupValue(y); + } +#endif } } @@ -1546,10 +1670,10 @@ void HandleGenericSetupScreen(int mx, int my, int dx, int dy, int button) DoAnimation(); } -void DrawSetupInputScreen() +void DrawSetupScreen_Input() { ClearWindow(); - DrawText(SX+16, SY+16, "SETUP INPUT", FS_BIG, FC_YELLOW); + DrawText(SX+16, SY+16, "Setup Input", FS_BIG, FC_YELLOW); initCursor(0, GFX_KUGEL_BLAU); initCursor(1, GFX_KUGEL_BLAU); @@ -1567,7 +1691,7 @@ void DrawSetupInputScreen() DrawTextFCentered(SYSIZE - 20, FC_BLUE, "Joysticks deactivated on this screen"); - HandleSetupInputScreen(0,0, 0,0, MB_MENU_INITIALIZE); + HandleSetupScreen_Input(0,0, 0,0, MB_MENU_INITIALIZE); FadeToFront(); InitAnimation(); } @@ -1664,7 +1788,7 @@ static void drawPlayerSetupInputInfo(int player_nr) } } -void HandleSetupInputScreen(int mx, int my, int dx, int dy, int button) +void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) { static int choice = 0; static int player_nr = 0; @@ -1785,22 +1909,6 @@ void HandleSetupInputScreen(int mx, int my, int dx, int dy, int button) DoAnimation(); } -void DrawSetupScreen() -{ - if (setup_mode == SETUP_MODE_INPUT) - DrawSetupInputScreen(); - else - DrawGenericSetupScreen(); -} - -void HandleSetupScreen(int mx, int my, int dx, int dy, int button) -{ - if (setup_mode == SETUP_MODE_INPUT) - HandleSetupInputScreen(mx, my, dx, dy, button); - else - HandleGenericSetupScreen(mx, my, dx, dy, button); -} - void CustomizeKeyboard(int player_nr) { int i; @@ -1928,7 +2036,7 @@ void CustomizeKeyboard(int player_nr) setup.input[player_nr].key = custom_key; StopAnimation(); - DrawSetupInputScreen(); + DrawSetupScreen_Input(); } static boolean CalibrateJoystickMain(int player_nr) @@ -2096,7 +2204,7 @@ static boolean CalibrateJoystickMain(int player_nr) StopAnimation(); - DrawSetupInputScreen(); + DrawSetupScreen_Input(); /* wait until the last pressed button was released */ while (Joystick(player_nr) & JOY_BUTTON) @@ -2128,6 +2236,22 @@ void CalibrateJoystick(int player_nr) } } +void DrawSetupScreen() +{ + if (setup_mode == SETUP_MODE_INPUT) + DrawSetupScreen_Input(); + else + DrawSetupScreen_Generic(); +} + +void HandleSetupScreen(int mx, int my, int dx, int dy, int button) +{ + if (setup_mode == SETUP_MODE_INPUT) + HandleSetupScreen_Input(mx, my, dx, dy, button); + else + HandleSetupScreen_Generic(mx, my, dx, dy, button); +} + void HandleGameActions() { if (game_status != PLAYING) diff --git a/src/screens.h b/src/screens.h index 68567082..bf0702b4 100644 --- a/src/screens.h +++ b/src/screens.h @@ -17,25 +17,28 @@ #include "main.h" void DrawHeadline(void); + void DrawMainMenu(void); void HandleMainMenu(int, int, int, int, int); + void DrawHelpScreenElAction(int); void DrawHelpScreenElText(int); void DrawHelpScreenMusicText(int); void DrawHelpScreenCreditsText(void); void DrawHelpScreen(void); void HandleHelpScreen(int); + void HandleTypeName(int, Key); + void DrawChooseLevel(void); void HandleChooseLevel(int, int, int, int, int); + void DrawHallOfFame(int); void HandleHallOfFame(int, int, int, int, int); + void DrawSetupScreen(void); void HandleSetupScreen(int, int, int, int, int); -void DrawSetupInputScreen(void); -void HandleSetupInputScreen(int, int, int, int, int); -void CustomizeKeyboard(int); -void CalibrateJoystick(int); + void HandleGameActions(void); void CreateScreenGadgets(); diff --git a/src/timestamp.h b/src/timestamp.h new file mode 100644 index 00000000..ecb53d5c --- /dev/null +++ b/src/timestamp.h @@ -0,0 +1 @@ +#define COMPILE_DATE_STRING "[2002-04-01 20:50]" -- 2.34.1