From 983b7bc7f3493b1522d08d8e7bdecb3bd8e462eb Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 23 May 2005 21:30:58 +0200 Subject: [PATCH] rnd-20050523-1-src * added setup option "skip levels" and possibility to skip levels * fixed displaying "imported from/by" on preview with empty string * fixed ignoring draw offset for fonts used for level preview texts --- ChangeLog | 7 +++++++ src/conftime.h | 2 +- src/editor.c | 4 ++-- src/files.c | 2 +- src/screens.c | 16 ++++++---------- src/tools.c | 25 +++++++++++++++++++++++-- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b373cd3d..da554aa6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-05-15 + * added setup option "skip levels" and possibility to skip levels + +2005-04-28 + * fixed displaying "imported from/by" on preview with empty string + * fixed ignoring draw offset for fonts used for level preview texts + 2005-04-24 * fixed a delay problem with SDL and too many mouse motion events * added setup option "skip levels" and level skipping functionality diff --git a/src/conftime.h b/src/conftime.h index d56a2b3c..42000960 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2005-04-23 23:41]" +#define COMPILE_DATE_STRING "[2005-05-23 21:29]" diff --git a/src/editor.c b/src/editor.c index f6c63d1d..988c1cdc 100644 --- a/src/editor.c +++ b/src/editor.c @@ -8713,7 +8713,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi) if ((level_changed && pressed) || (!level_changed && released)) return; - if (level_changed && !Request("Level has changed! Discard changes ?", + if (level_changed && !Request("Level has changed ! Discard changes ?", REQ_ASK)) { if (gadget_id == counterbutton_info[counter_id].gadget_id_text) @@ -9729,7 +9729,7 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed) { if (!ask_if_level_has_changed || !LevelChanged() || - Request("Level has changed! Exit without saving ?", + Request("Level has changed ! Exit without saving ?", REQ_ASK | REQ_STAY_OPEN)) { #if 1 diff --git a/src/files.c b/src/files.c index b1754033..473a7392 100644 --- a/src/files.c +++ b/src/files.c @@ -4005,7 +4005,7 @@ void SaveTape(int nr) tape.changed = FALSE; if (new_tape) - Request("tape saved !", REQ_CONFIRM); + Request("Tape saved !", REQ_CONFIRM); } void DumpTape(struct TapeInfo *tape) diff --git a/src/screens.c b/src/screens.c index 10a7cd57..8d4fa282 100644 --- a/src/screens.c +++ b/src/screens.c @@ -379,6 +379,7 @@ static void gotoTopLevelDir() void HandleMainMenu(int mx, int my, int dx, int dy, int button) { + static unsigned long level_delay = 0; static int choice = 5; int x = 0; int y = choice; @@ -404,9 +405,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) if (y == 1 && ((x == 10 && level_nr > leveldir_current->first_level) || (x == 14 && level_nr < leveldir_current->last_level)) && - button) + button && DelayReached(&level_delay, GADGET_FRAME_DELAY)) { - static unsigned long level_delay = 0; int step = (button == 1 ? 1 : button == 2 ? 5 : 10); int old_level_nr = level_nr; int new_level_nr; @@ -418,13 +418,10 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) new_level_nr = leveldir_current->last_level; #if 1 - if (setup.handicap && new_level_nr > leveldir_current->handicap_level + 1) - new_level_nr = leveldir_current->handicap_level; - - if (setup.handicap && new_level_nr > leveldir_current->handicap_level && - leveldir_current->handicap_level < leveldir_current->last_level) + if (setup.handicap && new_level_nr > leveldir_current->handicap_level) { - if (setup.skip_levels && + /* skipping levels is only allowed when trying to skip single level */ + if (setup.skip_levels && step == 1 && Request("Level still unsolved ! Skip despite handicap ?", REQ_ASK)) { leveldir_current->handicap_level++; @@ -438,8 +435,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) new_level_nr = leveldir_current->handicap_level; #endif - if (new_level_nr != old_level_nr && - DelayReached(&level_delay, GADGET_FRAME_DELAY)) + if (new_level_nr != old_level_nr) { level_nr = new_level_nr; diff --git a/src/tools.c b/src/tools.c index 794de36e..13ba8301 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1552,6 +1552,7 @@ static void DrawMicroLevelLabelExt(int mode) char label_text[MAX_OUTPUT_LINESIZE + 1]; int max_len_label_text; int font_nr = FONT_TEXT_2; + int i; if (mode == MICROLABEL_LEVEL_AUTHOR_HEAD || mode == MICROLABEL_IMPORTED_FROM_HEAD || @@ -1560,8 +1561,26 @@ static void DrawMicroLevelLabelExt(int mode) max_len_label_text = SXSIZE / getFontWidth(font_nr); +#if 1 + + for (i = 0; i < max_len_label_text; i++) + label_text[i] = ' '; + label_text[max_len_label_text] = '\0'; + + if (strlen(label_text) > 0) + { + int lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2; + int lypos = MICROLABEL2_YPOS; + + DrawText(lxpos, lypos, label_text, font_nr); + } + +#else + DrawBackground(SX, MICROLABEL2_YPOS, SXSIZE, getFontHeight(font_nr)); +#endif + strncpy(label_text, (mode == MICROLABEL_LEVEL_NAME ? level.name : mode == MICROLABEL_LEVEL_AUTHOR_HEAD ? "created by" : @@ -1680,9 +1699,11 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart) { int max_label_counter = 23; - if (leveldir_current->imported_from != NULL) + if (leveldir_current->imported_from != NULL && + strlen(leveldir_current->imported_from) > 0) max_label_counter += 14; - if (leveldir_current->imported_by != NULL) + if (leveldir_current->imported_by != NULL && + strlen(leveldir_current->imported_by) > 0) max_label_counter += 14; label_counter = (label_counter + 1) % max_label_counter; -- 2.34.1