From 240269d614d12d0612cc0764589e6798378e2b8c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 22 Jan 1999 19:17:04 +0100 Subject: [PATCH] rnd-19990122-1 --- src/editor.c | 217 +++++++++++++++++++++++++++++++------------------- src/files.c | 79 +++++++++++++++--- src/init.c | 6 +- src/main.h | 25 +++--- src/misc.c | 10 +++ src/misc.h | 1 + src/screens.c | 4 +- src/tools.c | 75 +++++++++++------ 8 files changed, 284 insertions(+), 133 deletions(-) diff --git a/src/editor.c b/src/editor.c index d7f0f4df..8570bd19 100644 --- a/src/editor.c +++ b/src/editor.c @@ -91,7 +91,10 @@ #define ED_COUNT_ELEM_SCORE_YPOS (14 * MINI_TILEY) #define ED_COUNT_ELEM_CONTENT_XPOS ED_PROPERTIES_XPOS #define ED_COUNT_ELEM_CONTENT_YPOS (17 * MINI_TILEY) - +#define ED_COUNTER_YSTART (ED_LEVELINFO_YPOS + 3 * TILEY) +#define ED_COUNTER_YDISTANCE (3 * MINI_TILEY) +#define ED_COUNTER_YPOS(n) (ED_COUNTER_YSTART + \ + n * ED_COUNTER_YDISTANCE) /* standard distances */ #define ED_BORDER_SIZE 3 #define ED_GADGET_DISTANCE 2 @@ -165,57 +168,63 @@ #define ED_CTRL_ID_LEVEL_YSIZE_DOWN 31 #define ED_CTRL_ID_LEVEL_YSIZE_TEXT 32 #define ED_CTRL_ID_LEVEL_YSIZE_UP 33 -#define ED_CTRL_ID_LEVEL_COLLECT_DOWN 34 -#define ED_CTRL_ID_LEVEL_COLLECT_TEXT 35 -#define ED_CTRL_ID_LEVEL_COLLECT_UP 36 -#define ED_CTRL_ID_LEVEL_TIMELIMIT_DOWN 37 -#define ED_CTRL_ID_LEVEL_TIMELIMIT_TEXT 38 -#define ED_CTRL_ID_LEVEL_TIMELIMIT_UP 39 -#define ED_CTRL_ID_LEVEL_TIMESCORE_DOWN 40 -#define ED_CTRL_ID_LEVEL_TIMESCORE_TEXT 41 -#define ED_CTRL_ID_LEVEL_TIMESCORE_UP 42 +#define ED_CTRL_ID_LEVEL_RANDOM_DOWN 34 +#define ED_CTRL_ID_LEVEL_RANDOM_TEXT 35 +#define ED_CTRL_ID_LEVEL_RANDOM_UP 36 +#define ED_CTRL_ID_LEVEL_COLLECT_DOWN 37 +#define ED_CTRL_ID_LEVEL_COLLECT_TEXT 38 +#define ED_CTRL_ID_LEVEL_COLLECT_UP 39 +#define ED_CTRL_ID_LEVEL_TIMELIMIT_DOWN 40 +#define ED_CTRL_ID_LEVEL_TIMELIMIT_TEXT 41 +#define ED_CTRL_ID_LEVEL_TIMELIMIT_UP 42 +#define ED_CTRL_ID_LEVEL_TIMESCORE_DOWN 43 +#define ED_CTRL_ID_LEVEL_TIMESCORE_TEXT 44 +#define ED_CTRL_ID_LEVEL_TIMESCORE_UP 45 /* drawing area identifiers */ -#define ED_CTRL_ID_DRAWING_LEVEL 43 -#define ED_CTRL_ID_ELEM_CONTENT_0 44 -#define ED_CTRL_ID_ELEM_CONTENT_1 45 -#define ED_CTRL_ID_ELEM_CONTENT_2 46 -#define ED_CTRL_ID_ELEM_CONTENT_3 47 -#define ED_CTRL_ID_ELEM_CONTENT_4 48 -#define ED_CTRL_ID_ELEM_CONTENT_5 49 -#define ED_CTRL_ID_ELEM_CONTENT_6 50 -#define ED_CTRL_ID_ELEM_CONTENT_7 51 -#define ED_CTRL_ID_AMOEBA_CONTENT 52 +#define ED_CTRL_ID_DRAWING_LEVEL 46 +#define ED_CTRL_ID_ELEM_CONTENT_0 47 +#define ED_CTRL_ID_ELEM_CONTENT_1 48 +#define ED_CTRL_ID_ELEM_CONTENT_2 49 +#define ED_CTRL_ID_ELEM_CONTENT_3 50 +#define ED_CTRL_ID_ELEM_CONTENT_4 51 +#define ED_CTRL_ID_ELEM_CONTENT_5 52 +#define ED_CTRL_ID_ELEM_CONTENT_6 53 +#define ED_CTRL_ID_ELEM_CONTENT_7 54 +#define ED_CTRL_ID_AMOEBA_CONTENT 55 /* text input identifiers */ -#define ED_CTRL_ID_LEVEL_NAME 53 +#define ED_CTRL_ID_LEVEL_NAME 56 +#define ED_CTRL_ID_LEVEL_AUTHOR 57 /* gadgets for scrolling of drawing area */ -#define ED_CTRL_ID_SCROLL_UP 54 -#define ED_CTRL_ID_SCROLL_DOWN 55 -#define ED_CTRL_ID_SCROLL_LEFT 56 -#define ED_CTRL_ID_SCROLL_RIGHT 57 -#define ED_CTRL_ID_SCROLL_VERTICAL 58 -#define ED_CTRL_ID_SCROLL_HORIZONTAL 59 +#define ED_CTRL_ID_SCROLL_UP 58 +#define ED_CTRL_ID_SCROLL_DOWN 59 +#define ED_CTRL_ID_SCROLL_LEFT 60 +#define ED_CTRL_ID_SCROLL_RIGHT 61 +#define ED_CTRL_ID_SCROLL_VERTICAL 62 +#define ED_CTRL_ID_SCROLL_HORIZONTAL 63 -#define ED_NUM_GADGETS 60 +#define ED_NUM_GADGETS 64 /* values for counter gadgets */ #define ED_COUNTER_ID_ELEM_SCORE 0 #define ED_COUNTER_ID_ELEM_CONTENT 1 #define ED_COUNTER_ID_LEVEL_XSIZE 2 #define ED_COUNTER_ID_LEVEL_YSIZE 3 -#define ED_COUNTER_ID_LEVEL_COLLECT 4 -#define ED_COUNTER_ID_LEVEL_TIMELIMIT 5 -#define ED_COUNTER_ID_LEVEL_TIMESCORE 6 +#define ED_COUNTER_ID_LEVEL_RANDOM 4 +#define ED_COUNTER_ID_LEVEL_COLLECT 5 +#define ED_COUNTER_ID_LEVEL_TIMELIMIT 6 +#define ED_COUNTER_ID_LEVEL_TIMESCORE 7 /* values for text input gadgets */ #define ED_TEXTINPUT_ID_LEVEL_NAME 0 +#define ED_TEXTINPUT_ID_LEVEL_AUTHOR 1 -#define ED_NUM_COUNTERBUTTONS 7 +#define ED_NUM_COUNTERBUTTONS 8 #define ED_NUM_SCROLLBUTTONS 4 #define ED_NUM_SCROLLBARS 2 -#define ED_NUM_TEXTINPUT 1 +#define ED_NUM_TEXTINPUT 2 /* values for CopyLevelToUndoBuffer() */ #define UNDO_IMMEDIATE 0 @@ -263,6 +272,7 @@ static int *gadget_elem_score_value = NULL; static int *gadget_elem_content_value = NULL; static int *gadget_level_xsize_value = NULL; static int *gadget_level_ysize_value = NULL; +static int *gadget_level_random_value = NULL; static int *gadget_level_collect_value = NULL; static int *gadget_level_timelimit_value = NULL; static int *gadget_level_timescore_value = NULL; @@ -294,7 +304,7 @@ static struct "element content" }, { - ED_LEVELINFO_XPOS, ED_LEVELINFO_YPOS + 6 * MINI_TILEY, + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(0), MIN_LEV_FIELDX, MAX_LEV_FIELDX, ED_CTRL_ID_LEVEL_XSIZE_DOWN, ED_CTRL_ID_LEVEL_XSIZE_UP, ED_CTRL_ID_LEVEL_XSIZE_TEXT, @@ -302,7 +312,7 @@ static struct "playfield width" }, { - ED_LEVELINFO_XPOS, ED_LEVELINFO_YPOS + 10 * MINI_TILEY, + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(1), MIN_LEV_FIELDY, MAX_LEV_FIELDY, ED_CTRL_ID_LEVEL_YSIZE_DOWN, ED_CTRL_ID_LEVEL_YSIZE_UP, ED_CTRL_ID_LEVEL_YSIZE_TEXT, @@ -310,7 +320,15 @@ static struct "playfield height" }, { - ED_LEVELINFO_XPOS, ED_LEVELINFO_YPOS + 14 * MINI_TILEY, + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(2), + 0, 100, + ED_CTRL_ID_LEVEL_RANDOM_DOWN, ED_CTRL_ID_LEVEL_RANDOM_UP, + ED_CTRL_ID_LEVEL_RANDOM_TEXT, + &gadget_level_random_value, + "number of random elements" + }, + { + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(3), 0, 999, ED_CTRL_ID_LEVEL_COLLECT_DOWN, ED_CTRL_ID_LEVEL_COLLECT_UP, ED_CTRL_ID_LEVEL_COLLECT_TEXT, @@ -318,7 +336,7 @@ static struct "number of emeralds to collect" }, { - ED_LEVELINFO_XPOS, ED_LEVELINFO_YPOS + 18 * MINI_TILEY, + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(4), 0, 999, ED_CTRL_ID_LEVEL_TIMELIMIT_DOWN, ED_CTRL_ID_LEVEL_TIMELIMIT_UP, ED_CTRL_ID_LEVEL_TIMELIMIT_TEXT, @@ -326,7 +344,7 @@ static struct "time available to solve level" }, { - ED_LEVELINFO_XPOS, ED_LEVELINFO_YPOS + 22 * MINI_TILEY, + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(5), 0, 255, ED_CTRL_ID_LEVEL_TIMESCORE_DOWN, ED_CTRL_ID_LEVEL_TIMESCORE_UP, ED_CTRL_ID_LEVEL_TIMESCORE_TEXT, @@ -344,10 +362,16 @@ static struct } textinput_info[ED_NUM_TEXTINPUT] = { { - ED_LEVELINFO_XPOS, ED_LEVELINFO_YPOS + 26 * MINI_TILEY, + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(6), ED_CTRL_ID_LEVEL_NAME, level.name, - "level title" + "Level Title" + }, + { + ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(7), + ED_CTRL_ID_LEVEL_AUTHOR, + level.author, + "Level Author" } }; @@ -1150,42 +1174,44 @@ static void CreateDrawingAreas() static void CreateTextInputGadgets() { - Pixmap gd_pixmap = pix[PIX_DOOR]; - int gd_x, gd_y; - struct GadgetInfo *gi; - unsigned long event_mask; - char infotext[MAX_INFOTEXT_LEN + 1]; - int i, id; + int i; - /* text input gadget for the level name */ - i = ED_TEXTINPUT_ID_LEVEL_NAME; - id = ED_CTRL_ID_LEVEL_NAME; + for (i=0; itext.number_value; + break; + case ED_CTRL_ID_LEVEL_COLLECT_DOWN: case ED_CTRL_ID_LEVEL_COLLECT_UP: step *= (id == ED_CTRL_ID_LEVEL_COLLECT_DOWN ? -1 : 1); @@ -3557,6 +3604,10 @@ static void HandleTextInputGadgets(struct GadgetInfo *gi) strcpy(level.name, gi->text.value); break; + case ED_CTRL_ID_LEVEL_AUTHOR: + strcpy(level.author, gi->text.value); + break; + default: break; } diff --git a/src/files.c b/src/files.c index 87a60c1c..e56759e0 100644 --- a/src/files.c +++ b/src/files.c @@ -82,8 +82,32 @@ #define LEVELCLASS_CONTRIBUTION_END 299 #define LEVELCLASS_USER_START 300 #define LEVELCLASS_USER_END 399 + +#define LEVELCLASS_TUTORIAL LEVELCLASS_TUTORIAL_START +#define LEVELCLASS_CLASSICS LEVELCLASS_CLASSICS_START +#define LEVELCLASS_CONTRIBUTION LEVELCLASS_CONTRIBUTION_START +#define LEVELCLASS_USER LEVELCLASS_USER_START #define LEVELCLASS_UNDEFINED 999 +#define IS_LEVELCLASS_TUTORIAL(n) \ + (leveldir[n].sort_priority >= LEVELCLASS_TUTORIAL_START && \ + leveldir[n].sort_priority <= LEVELCLASS_TUTORIAL_END) +#define IS_LEVELCLASS_CLASSICS(n) \ + (leveldir[n].sort_priority >= LEVELCLASS_CLASSICS_START && \ + leveldir[n].sort_priority <= LEVELCLASS_CLASSICS_END) +#define IS_LEVELCLASS_CONTRIBUTION(n) \ + (leveldir[n].sort_priority >= LEVELCLASS_CONTRIBUTION_START && \ + leveldir[n].sort_priority <= LEVELCLASS_CONTRIBUTION_END) +#define IS_LEVELCLASS_USER(n) \ + (leveldir[n].sort_priority >= LEVELCLASS_USER_START && \ + leveldir[n].sort_priority <= LEVELCLASS_USER_END) + +#define LEVELCLASS(n) (IS_LEVELCLASS_TUTORIAL(n) ? LEVELCLASS_TUTORIAL : \ + IS_LEVELCLASS_CLASSICS(n) ? LEVELCLASS_CLASSICS : \ + IS_LEVELCLASS_CONTRIBUTION(n) ? LEVELCLASS_CONTRIBUTION : \ + IS_LEVELCLASS_USER(n) ? LEVELCLASS_USER : \ + LEVELCLASS_UNDEFINED) + static void SaveUserLevelInfo(); /* for 'InitUserLevelDir()' */ static char *getSetupLine(char *, int); /* for 'SaveUserLevelInfo()' */ @@ -267,6 +291,7 @@ static void setLevelInfoToDefaults() level.high_speed = FALSE; strcpy(level.name, "Nameless Level"); + strcpy(level.author, "Anonymous"); for(i=0; i= LEVELCLASS_CONTRIBUTION_START && - leveldir[leveldir_nr].sort_priority <= LEVELCLASS_CONTRIBUTION_END) + IS_LEVELCLASS_CONTRIBUTION(leveldir_nr)) { Error(ERR_WARN, "level file '%s' has version number 1.0", filename); Error(ERR_WARN, "using high speed movement for player"); @@ -455,7 +513,7 @@ void SaveLevel(int level_nr) fputc(level.edelsteine / 256, file); fputc(level.edelsteine % 256, file); - for(i=0; iname = getStringCopy("non-existing"); + ldi->author = NULL; ldi->levels = 0; ldi->first_level = 0; ldi->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */ diff --git a/src/init.c b/src/init.c index 33cec176..77c5fb65 100644 --- a/src/init.c +++ b/src/init.c @@ -348,8 +348,8 @@ void InitWindow(int argc, char *argv[]) XSizeHints size_hints; XWMHints wm_hints; XClassHint class_hints; - char *window_name = WINDOWTITLE_STRING; - char *icon_name = WINDOWTITLE_STRING; + char *window_name = WINDOW_TITLE_STRING; + char *icon_name = WINDOW_TITLE_STRING; long window_event_mask; Atom proto_atom = None, delete_atom = None; #endif @@ -540,7 +540,7 @@ void InitGfx() #endif LoadGfx(PIX_SMALLFONT,&pic[PIX_SMALLFONT]); - DrawInitText(WINDOWTITLE_STRING,20,FC_YELLOW); + DrawInitText(WINDOW_TITLE_STRING,20,FC_YELLOW); DrawInitText(COPYRIGHT_STRING,50,FC_RED); #ifdef MSDOS DrawInitText("MSDOS version done by Guido Schulz",210,FC_BLUE); diff --git a/src/main.h b/src/main.h index da627421..00d49ab9 100644 --- a/src/main.h +++ b/src/main.h @@ -199,7 +199,8 @@ typedef unsigned char byte; /* boundaries of arrays etc. */ #define MAX_NAMELEN (10+1) -#define MAX_LEVNAMLEN 32 +#define MAX_LEVEL_NAME_LEN 32 +#define MAX_LEVEL_AUTHOR_LEN 34 #define MAX_TAPELEN (1000 * 50) /* max. time * framerate */ #define MAX_LEVDIR_ENTRIES 100 #define MAX_SCORE_ENTRIES 100 @@ -214,6 +215,7 @@ typedef unsigned char byte; #define FRAMES_PER_SECOND (1000 / GAME_FRAME_DELAY) #define GADGET_FRAME_DELAY 150 /* delay between gadget actions */ #define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */ +#define MICROLEVEL_LABEL_DELAY 250 /* delay for micro level label */ struct HiScore { @@ -336,7 +338,8 @@ struct LevelInfo int fieldy; int time; int edelsteine; - char name[MAX_LEVNAMLEN]; + char name[MAX_LEVEL_NAME_LEN]; + char author[MAX_LEVEL_AUTHOR_LEN]; int score[LEVEL_SCORE_ELEMENTS]; int mampfer_inhalt[8][3][3]; int tempo_amoebe; @@ -350,6 +353,7 @@ struct LevelDirInfo { char *filename; char *name; + char *author; int levels; int first_level; int last_level; @@ -1232,10 +1236,11 @@ extern int num_bg_loops; #define TAPES_DIRECTORY "tapes" #define SCORES_DIRECTORY "scores" -#define VERSION_STRING "1.2.1" -#define GAMETITLE_STRING "Rocks'n'Diamonds" -#define WINDOWTITLE_STRING GAMETITLE_STRING " " VERSION_STRING -#define COPYRIGHT_STRING "Copyright ^1995-99 by Holger Schemel" +#define PROGRAM_VERSION_STRING "1.2.1" +#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" +#define PROGRAM_AUTHOR_STRING "Holger Schemel" +#define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_VERSION_STRING +#define COPYRIGHT_STRING "Copyright ^1995-99 by " PROGRAM_AUTHOR_STRING /* default name for empty highscore entry */ #define EMPTY_PLAYER_NAME "no name" @@ -1265,19 +1270,17 @@ extern int num_bg_loops; #define REDRAW_VIDEO_2 (1L << 5) #define REDRAW_VIDEO_3 (1L << 6) #define REDRAW_MICROLEVEL (1L << 7) -#define REDRAW_MICROLEVEL_LABEL (1L << 8) -#define REDRAW_FROM_BACKBUFFER (1L << 9) +#define REDRAW_FROM_BACKBUFFER (1L << 8) #define REDRAW_DOOR_2 (REDRAW_VIDEO_1 | \ REDRAW_VIDEO_2 | \ REDRAW_VIDEO_3) -#define REDRAW_DOOR_3 (1L << 10) +#define REDRAW_DOOR_3 (1L << 9) #define REDRAW_DOORS (REDRAW_DOOR_1 | \ REDRAW_DOOR_2 | \ REDRAW_DOOR_3) #define REDRAW_MAIN (REDRAW_FIELD | \ REDRAW_TILES | \ - REDRAW_MICROLEVEL | \ - REDRAW_MICROLEVEL_LABEL) + REDRAW_MICROLEVEL) #define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2) /* areas in pixmap PIX_DOOR */ diff --git a/src/misc.c b/src/misc.c index c3e5b205..0e113727 100644 --- a/src/misc.c +++ b/src/misc.c @@ -241,6 +241,16 @@ char *getLoginName() return pwd->pw_name; } +char *getRealName() +{ + struct passwd *pwd; + + if (!(pwd = getpwuid(getuid()))) + return "ANONYMOUS"; + else + return pwd->pw_gecos; +} + char *getHomeDir() { #ifndef MSDOS diff --git a/src/misc.h b/src/misc.h index d925f983..9793cb73 100644 --- a/src/misc.h +++ b/src/misc.h @@ -45,6 +45,7 @@ unsigned int SimpleRND(unsigned int); unsigned int RND(unsigned int); unsigned int InitRND(long); char *getLoginName(void); +char *getRealName(void); char *getHomeDir(void); char *getPath2(char *, char *); char *getPath3(char *, char *, char*); diff --git a/src/screens.c b/src/screens.c index 11c6bf2a..2395c467 100644 --- a/src/screens.c +++ b/src/screens.c @@ -47,9 +47,9 @@ extern unsigned char get_ascii(KeySym); void DrawHeadline() { - int x = SX + (SXSIZE - strlen(GAMETITLE_STRING) * FONT1_XSIZE) / 2; + int x = SX + (SXSIZE - strlen(PROGRAM_TITLE_STRING) * FONT1_XSIZE) / 2; - DrawText(x, SY + 8, GAMETITLE_STRING, FS_BIG, FC_YELLOW); + DrawText(x, SY + 8, PROGRAM_TITLE_STRING, FS_BIG, FC_YELLOW); DrawTextFCentered(46, FC_RED, COPYRIGHT_STRING); } diff --git a/src/tools.c b/src/tools.c index 900e5ef7..51014b9a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -189,15 +189,10 @@ void BackToFront() XCopyArea(display,backbuffer,window,gc, MICROLEV_XPOS, MICROLEV_YPOS, MICROLEV_XSIZE, MICROLEV_YSIZE, MICROLEV_XPOS, MICROLEV_YPOS); - redraw_mask &= ~REDRAW_MICROLEVEL; - } - - if (redraw_mask & REDRAW_MICROLEVEL_LABEL) - { XCopyArea(display,backbuffer,window,gc, SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE, SX, MICROLABEL_YPOS); - redraw_mask &= ~REDRAW_MICROLEVEL_LABEL; + redraw_mask &= ~REDRAW_MICROLEVEL; } if (redraw_mask & REDRAW_TILES) @@ -1442,41 +1437,61 @@ static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y) redraw_mask |= REDRAW_MICROLEVEL; } +static void DrawMicroLevelLabelExt(int mode) +{ + char label_text[100]; + + XFillRectangle(display, drawto,gc, + SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE); + + strcpy(label_text, (mode == 1 ? level.name : + mode == 2 ? "created by" : + mode == 3 ? level.author : "")); + + if (strlen(label_text) > 0) + { + int size, lxpos, lypos; + + label_text[SXSIZE / FONT4_XSIZE] = '\0'; + + size = strlen(label_text); + lxpos = SX + (SXSIZE - size * FONT4_XSIZE) / 2; + lypos = MICROLABEL_YPOS; + + DrawText(lxpos, lypos, label_text, FS_SMALL, FC_SPECIAL2); + } + + redraw_mask |= REDRAW_MICROLEVEL; +} + void DrawMicroLevel(int xpos, int ypos, boolean restart) { static unsigned long scroll_delay = 0; + static unsigned long label_delay = 0; static int from_x, from_y, scroll_direction; + static int label_state, label_counter; if (restart) { from_x = from_y = 0; scroll_direction = MV_RIGHT; + label_state = 1; + label_counter = 0; DrawMicroLevelExt(xpos, ypos, from_x, from_y); + DrawMicroLevelLabelExt(label_state); - XFillRectangle(display, drawto,gc, - SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE); - - if (level.name && restart) - { - int len = strlen(level.name); - int lxpos = SX + (SXSIZE - len * FONT4_XSIZE) / 2; - int lypos = MICROLABEL_YPOS; - - DrawText(lxpos, lypos, level.name, FS_SMALL, FC_SPECIAL2); - } - - /* initialize delay counter */ + /* initialize delay counters */ DelayReached(&scroll_delay, 0); + DelayReached(&label_delay, 0); - redraw_mask |= REDRAW_MICROLEVEL_LABEL; + return; } - else - { - if ((lev_fieldx <= STD_LEV_FIELDX && lev_fieldy <= STD_LEV_FIELDY) || - !DelayReached(&scroll_delay, MICROLEVEL_SCROLL_DELAY)) - return; + /* scroll micro level, if needed */ + if ((lev_fieldx > STD_LEV_FIELDX || lev_fieldy > STD_LEV_FIELDY) && + DelayReached(&scroll_delay, MICROLEVEL_SCROLL_DELAY)) + { switch (scroll_direction) { case MV_LEFT: @@ -1513,6 +1528,16 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart) DrawMicroLevelExt(xpos, ypos, from_x, from_y); } + + /* redraw micro level label, if needed */ + if (DelayReached(&label_delay, MICROLEVEL_LABEL_DELAY)) + { + label_counter = (label_counter + 1) % 23; + label_state = (label_counter >= 0 && label_counter <= 7 ? 1 : + label_counter >= 9 && label_counter <= 12 ? 2 : + label_counter >= 14 && label_counter <= 21 ? 3 : 0); + DrawMicroLevelLabelExt(label_state); + } } int REQ_in_range(int x, int y) -- 2.34.1