From: Holger Schemel Date: Thu, 1 Apr 2010 08:33:33 +0000 (+0200) Subject: rnd-20100401-1-src X-Git-Tag: 3.3.0.0^2~14 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f965a2a6e56dd5c1e91b306dfd52b38b1dd49537;p=rocksndiamonds.git rnd-20100401-1-src --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 913a3728..1282c695 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5842,6 +5842,15 @@ struct ConfigInfo image_config[] = { "game.panel.time_ss.draw_masked", "true" }, { "game.panel.time_ss.draw_order", "0" }, + { "game.panel.frame.x", "-1" }, + { "game.panel.frame.y", "-1" }, + { "game.panel.frame.align", "left" }, + { "game.panel.frame.valign", "top" }, + { "game.panel.frame.digits", "-1" }, + { "game.panel.frame.font", "font.text_2" }, + { "game.panel.frame.draw_masked", "true" }, + { "game.panel.frame.draw_order", "0" }, + { "game.panel.shield_normal.x", "-1" }, { "game.panel.shield_normal.y", "-1" }, { "game.panel.shield_normal.tile_size", "16" }, diff --git a/src/conf_var.c b/src/conf_var.c index 13fa8959..3edf500b 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -2936,6 +2936,38 @@ struct TokenIntPtrInfo image_config_vars[] = "game.panel.time_ss.draw_order", &game.panel.time_ss.sort_priority }, + { + "game.panel.frame.x", + &game.panel.frame.x + }, + { + "game.panel.frame.y", + &game.panel.frame.y + }, + { + "game.panel.frame.align", + &game.panel.frame.align + }, + { + "game.panel.frame.valign", + &game.panel.frame.valign + }, + { + "game.panel.frame.digits", + &game.panel.frame.size + }, + { + "game.panel.frame.font", + &game.panel.frame.font + }, + { + "game.panel.frame.draw_masked", + &game.panel.frame.draw_masked + }, + { + "game.panel.frame.draw_order", + &game.panel.frame.sort_priority + }, { "game.panel.shield_normal.x", &game.panel.shield_normal.x diff --git a/src/conftime.h b/src/conftime.h index dc3844ee..4b951c0d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-03-27 20:44" +#define COMPILE_DATE_STRING "2010-03-31 10:44" diff --git a/src/game.c b/src/game.c index d486b15f..556c22b2 100644 --- a/src/game.c +++ b/src/game.c @@ -194,86 +194,87 @@ #define GAME_PANEL_TIME_HH 32 #define GAME_PANEL_TIME_MM 33 #define GAME_PANEL_TIME_SS 34 -#define GAME_PANEL_SHIELD_NORMAL 35 -#define GAME_PANEL_SHIELD_NORMAL_TIME 36 -#define GAME_PANEL_SHIELD_DEADLY 37 -#define GAME_PANEL_SHIELD_DEADLY_TIME 38 -#define GAME_PANEL_EXIT 39 -#define GAME_PANEL_EMC_MAGIC_BALL 40 -#define GAME_PANEL_EMC_MAGIC_BALL_SWITCH 41 -#define GAME_PANEL_LIGHT_SWITCH 42 -#define GAME_PANEL_LIGHT_SWITCH_TIME 43 -#define GAME_PANEL_TIMEGATE_SWITCH 44 -#define GAME_PANEL_TIMEGATE_SWITCH_TIME 45 -#define GAME_PANEL_SWITCHGATE_SWITCH 46 -#define GAME_PANEL_EMC_LENSES 47 -#define GAME_PANEL_EMC_LENSES_TIME 48 -#define GAME_PANEL_EMC_MAGNIFIER 49 -#define GAME_PANEL_EMC_MAGNIFIER_TIME 50 -#define GAME_PANEL_BALLOON_SWITCH 51 -#define GAME_PANEL_DYNABOMB_NUMBER 52 -#define GAME_PANEL_DYNABOMB_SIZE 53 -#define GAME_PANEL_DYNABOMB_POWER 54 -#define GAME_PANEL_PENGUINS 55 -#define GAME_PANEL_SOKOBAN_OBJECTS 56 -#define GAME_PANEL_SOKOBAN_FIELDS 57 -#define GAME_PANEL_ROBOT_WHEEL 58 -#define GAME_PANEL_CONVEYOR_BELT_1 59 -#define GAME_PANEL_CONVEYOR_BELT_2 60 -#define GAME_PANEL_CONVEYOR_BELT_3 61 -#define GAME_PANEL_CONVEYOR_BELT_4 62 -#define GAME_PANEL_CONVEYOR_BELT_1_SWITCH 63 -#define GAME_PANEL_CONVEYOR_BELT_2_SWITCH 64 -#define GAME_PANEL_CONVEYOR_BELT_3_SWITCH 65 -#define GAME_PANEL_CONVEYOR_BELT_4_SWITCH 66 -#define GAME_PANEL_MAGIC_WALL 67 -#define GAME_PANEL_MAGIC_WALL_TIME 68 -#define GAME_PANEL_GRAVITY_STATE 69 -#define GAME_PANEL_GRAPHIC_1 70 -#define GAME_PANEL_GRAPHIC_2 71 -#define GAME_PANEL_GRAPHIC_3 72 -#define GAME_PANEL_GRAPHIC_4 73 -#define GAME_PANEL_GRAPHIC_5 74 -#define GAME_PANEL_GRAPHIC_6 75 -#define GAME_PANEL_GRAPHIC_7 76 -#define GAME_PANEL_GRAPHIC_8 77 -#define GAME_PANEL_ELEMENT_1 78 -#define GAME_PANEL_ELEMENT_2 79 -#define GAME_PANEL_ELEMENT_3 80 -#define GAME_PANEL_ELEMENT_4 81 -#define GAME_PANEL_ELEMENT_5 82 -#define GAME_PANEL_ELEMENT_6 83 -#define GAME_PANEL_ELEMENT_7 84 -#define GAME_PANEL_ELEMENT_8 85 -#define GAME_PANEL_ELEMENT_COUNT_1 86 -#define GAME_PANEL_ELEMENT_COUNT_2 87 -#define GAME_PANEL_ELEMENT_COUNT_3 88 -#define GAME_PANEL_ELEMENT_COUNT_4 89 -#define GAME_PANEL_ELEMENT_COUNT_5 90 -#define GAME_PANEL_ELEMENT_COUNT_6 91 -#define GAME_PANEL_ELEMENT_COUNT_7 92 -#define GAME_PANEL_ELEMENT_COUNT_8 93 -#define GAME_PANEL_CE_SCORE_1 94 -#define GAME_PANEL_CE_SCORE_2 95 -#define GAME_PANEL_CE_SCORE_3 96 -#define GAME_PANEL_CE_SCORE_4 97 -#define GAME_PANEL_CE_SCORE_5 98 -#define GAME_PANEL_CE_SCORE_6 99 -#define GAME_PANEL_CE_SCORE_7 100 -#define GAME_PANEL_CE_SCORE_8 101 -#define GAME_PANEL_CE_SCORE_1_ELEMENT 102 -#define GAME_PANEL_CE_SCORE_2_ELEMENT 103 -#define GAME_PANEL_CE_SCORE_3_ELEMENT 104 -#define GAME_PANEL_CE_SCORE_4_ELEMENT 105 -#define GAME_PANEL_CE_SCORE_5_ELEMENT 106 -#define GAME_PANEL_CE_SCORE_6_ELEMENT 107 -#define GAME_PANEL_CE_SCORE_7_ELEMENT 108 -#define GAME_PANEL_CE_SCORE_8_ELEMENT 109 -#define GAME_PANEL_PLAYER_NAME 110 -#define GAME_PANEL_LEVEL_NAME 111 -#define GAME_PANEL_LEVEL_AUTHOR 112 - -#define NUM_GAME_PANEL_CONTROLS 113 +#define GAME_PANEL_FRAME 35 +#define GAME_PANEL_SHIELD_NORMAL 36 +#define GAME_PANEL_SHIELD_NORMAL_TIME 37 +#define GAME_PANEL_SHIELD_DEADLY 38 +#define GAME_PANEL_SHIELD_DEADLY_TIME 39 +#define GAME_PANEL_EXIT 40 +#define GAME_PANEL_EMC_MAGIC_BALL 41 +#define GAME_PANEL_EMC_MAGIC_BALL_SWITCH 42 +#define GAME_PANEL_LIGHT_SWITCH 43 +#define GAME_PANEL_LIGHT_SWITCH_TIME 44 +#define GAME_PANEL_TIMEGATE_SWITCH 45 +#define GAME_PANEL_TIMEGATE_SWITCH_TIME 46 +#define GAME_PANEL_SWITCHGATE_SWITCH 47 +#define GAME_PANEL_EMC_LENSES 48 +#define GAME_PANEL_EMC_LENSES_TIME 49 +#define GAME_PANEL_EMC_MAGNIFIER 50 +#define GAME_PANEL_EMC_MAGNIFIER_TIME 51 +#define GAME_PANEL_BALLOON_SWITCH 52 +#define GAME_PANEL_DYNABOMB_NUMBER 53 +#define GAME_PANEL_DYNABOMB_SIZE 54 +#define GAME_PANEL_DYNABOMB_POWER 55 +#define GAME_PANEL_PENGUINS 56 +#define GAME_PANEL_SOKOBAN_OBJECTS 57 +#define GAME_PANEL_SOKOBAN_FIELDS 58 +#define GAME_PANEL_ROBOT_WHEEL 59 +#define GAME_PANEL_CONVEYOR_BELT_1 60 +#define GAME_PANEL_CONVEYOR_BELT_2 61 +#define GAME_PANEL_CONVEYOR_BELT_3 62 +#define GAME_PANEL_CONVEYOR_BELT_4 63 +#define GAME_PANEL_CONVEYOR_BELT_1_SWITCH 64 +#define GAME_PANEL_CONVEYOR_BELT_2_SWITCH 65 +#define GAME_PANEL_CONVEYOR_BELT_3_SWITCH 66 +#define GAME_PANEL_CONVEYOR_BELT_4_SWITCH 67 +#define GAME_PANEL_MAGIC_WALL 68 +#define GAME_PANEL_MAGIC_WALL_TIME 69 +#define GAME_PANEL_GRAVITY_STATE 70 +#define GAME_PANEL_GRAPHIC_1 71 +#define GAME_PANEL_GRAPHIC_2 72 +#define GAME_PANEL_GRAPHIC_3 73 +#define GAME_PANEL_GRAPHIC_4 74 +#define GAME_PANEL_GRAPHIC_5 75 +#define GAME_PANEL_GRAPHIC_6 76 +#define GAME_PANEL_GRAPHIC_7 77 +#define GAME_PANEL_GRAPHIC_8 78 +#define GAME_PANEL_ELEMENT_1 79 +#define GAME_PANEL_ELEMENT_2 80 +#define GAME_PANEL_ELEMENT_3 81 +#define GAME_PANEL_ELEMENT_4 82 +#define GAME_PANEL_ELEMENT_5 83 +#define GAME_PANEL_ELEMENT_6 84 +#define GAME_PANEL_ELEMENT_7 85 +#define GAME_PANEL_ELEMENT_8 86 +#define GAME_PANEL_ELEMENT_COUNT_1 87 +#define GAME_PANEL_ELEMENT_COUNT_2 88 +#define GAME_PANEL_ELEMENT_COUNT_3 89 +#define GAME_PANEL_ELEMENT_COUNT_4 90 +#define GAME_PANEL_ELEMENT_COUNT_5 91 +#define GAME_PANEL_ELEMENT_COUNT_6 92 +#define GAME_PANEL_ELEMENT_COUNT_7 93 +#define GAME_PANEL_ELEMENT_COUNT_8 94 +#define GAME_PANEL_CE_SCORE_1 95 +#define GAME_PANEL_CE_SCORE_2 96 +#define GAME_PANEL_CE_SCORE_3 97 +#define GAME_PANEL_CE_SCORE_4 98 +#define GAME_PANEL_CE_SCORE_5 99 +#define GAME_PANEL_CE_SCORE_6 100 +#define GAME_PANEL_CE_SCORE_7 101 +#define GAME_PANEL_CE_SCORE_8 102 +#define GAME_PANEL_CE_SCORE_1_ELEMENT 103 +#define GAME_PANEL_CE_SCORE_2_ELEMENT 104 +#define GAME_PANEL_CE_SCORE_3_ELEMENT 105 +#define GAME_PANEL_CE_SCORE_4_ELEMENT 106 +#define GAME_PANEL_CE_SCORE_5_ELEMENT 107 +#define GAME_PANEL_CE_SCORE_6_ELEMENT 108 +#define GAME_PANEL_CE_SCORE_7_ELEMENT 109 +#define GAME_PANEL_CE_SCORE_8_ELEMENT 110 +#define GAME_PANEL_PLAYER_NAME 111 +#define GAME_PANEL_LEVEL_NAME 112 +#define GAME_PANEL_LEVEL_AUTHOR 113 + +#define NUM_GAME_PANEL_CONTROLS 114 struct GamePanelOrderInfo { @@ -473,6 +474,11 @@ static struct GamePanelControlInfo game_panel_controls[] = &game.panel.time_ss, TYPE_INTEGER, }, + { + GAME_PANEL_FRAME, + &game.panel.frame, + TYPE_INTEGER, + }, { GAME_PANEL_SHIELD_NORMAL, &game.panel.shield_normal, @@ -2347,6 +2353,8 @@ void UpdateGameControlValues() game_panel_controls[GAME_PANEL_TIME_MM].value = (time / 60) % 60; game_panel_controls[GAME_PANEL_TIME_SS].value = time % 60; + game_panel_controls[GAME_PANEL_FRAME].value = FrameCounter; + game_panel_controls[GAME_PANEL_SHIELD_NORMAL].value = (local_player->shield_normal_time_left > 0 ? EL_SHIELD_NORMAL_ACTIVE : EL_EMPTY); diff --git a/src/game.h b/src/game.h index f5bf7bbf..c764e1d3 100644 --- a/src/game.h +++ b/src/game.h @@ -47,6 +47,7 @@ struct GamePanelInfo struct TextPosInfo time_hh; struct TextPosInfo time_mm; struct TextPosInfo time_ss; + struct TextPosInfo frame; struct TextPosInfo shield_normal; struct TextPosInfo shield_normal_time; struct TextPosInfo shield_deadly; diff --git a/src/init.c b/src/init.c index 4596e839..6d0b9501 100644 --- a/src/init.c +++ b/src/init.c @@ -39,7 +39,7 @@ #define CONFIG_TOKEN_GLOBAL_BUSY "global.busy" #define DEBUG_PRINT_INIT_TIMESTAMPS TRUE -#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH 1 +#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH 10 static struct FontBitmapInfo font_initial[NUM_INITIAL_FONTS]; @@ -6171,8 +6171,14 @@ void OpenAll() game_status = GAME_MODE_LOADING; +#if 1 + InitCounter(); +#endif + InitGlobal(); /* initialize some global variables */ + print_timestamp_time("[init global stuff]"); + if (options.execute_command) Execute_Command(options.execute_command); @@ -6195,25 +6201,29 @@ void OpenAll() InitArtworkConfig(); /* needed before forking sound child process */ InitMixer(); +#if 0 InitCounter(); +#endif InitRND(NEW_RANDOMIZE); InitSimpleRandom(NEW_RANDOMIZE); InitJoysticks(); - print_timestamp_time("[pre-video]"); + print_timestamp_time("[init setup/config stuff]"); InitVideoDisplay(); InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen); InitEventFilter(FilterMouseMotionEvents); + print_timestamp_time("[init video stuff]"); + InitElementPropertiesStatic(); InitElementPropertiesEngine(GAME_VERSION_ACTUAL); InitElementPropertiesGfxElement(); - print_timestamp_time("[post-video]"); + print_timestamp_time("[init element properties stuff]"); InitGfx(); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 1535b69c..d21815b2 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -182,6 +182,46 @@ END_OF_FUNCTION(increment_counter); /* maximal allowed length of a command line option */ #define MAX_OPTION_LEN 256 +#if 1 + +#ifdef TARGET_SDL +static unsigned long getCurrentMS() +{ + return SDL_GetTicks(); +} + +#else /* !TARGET_SDL */ + +#if defined(PLATFORM_UNIX) +static unsigned long getCurrentMS() +{ + struct timeval current_time; + + gettimeofday(¤t_time, NULL); + + return current_time.tv_sec * 1000 + current_time.tv_usec / 1000; +} +#endif /* PLATFORM_UNIX */ +#endif /* !TARGET_SDL */ + +static unsigned long mainCounter(int mode) +{ + static unsigned long base_ms = 0; + unsigned long current_ms; + + /* get current system milliseconds */ + current_ms = getCurrentMS(); + + /* reset base timestamp in case of counter reset or wrap-around */ + if (mode == INIT_COUNTER || current_ms < base_ms) + base_ms = current_ms; + + /* return milliseconds since last counter reset */ + return current_ms - base_ms; +} + +#else + #ifdef TARGET_SDL static unsigned long mainCounter(int mode) { @@ -223,6 +263,8 @@ static unsigned long mainCounter(int mode) #endif /* PLATFORM_UNIX */ #endif /* !TARGET_SDL */ +#endif + void InitCounter() /* set counter back to zero */ { #if !defined(PLATFORM_MSDOS) diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 3ccc5352..b7e34adf 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2603,7 +2603,11 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent) ti->last_level = 0; ti->level_group = FALSE; ti->handicap_level = 0; +#if 1 + ti->readonly = parent->readonly; +#else ti->readonly = TRUE; +#endif ti->handicap = TRUE; ti->skip_levels = FALSE; } @@ -3137,6 +3141,12 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, leveldir_new->in_user_dir = (!strEqual(leveldir_new->basepath, options.level_directory)); +#if 0 + printf("::: '%s' -> %d\n", + leveldir_new->identifier, + leveldir_new->in_user_dir); +#endif + /* adjust some settings if user's private level directory was detected */ if (leveldir_new->sort_priority == LEVELCLASS_UNDEFINED && leveldir_new->in_user_dir &&