+2005-02-01
+ * fixed bug on level selection screen when dragging scrollbar
+
2005-01-19
* fixed bug which caused broken tapes when appending to EM engine tapes
-#define COMPILE_DATE_STRING "[2005-01-29 01:36]"
+#define COMPILE_DATE_STRING "[2005-02-01 23:09]"
MultiMapGadgets(MULTIMAP_ALL | MULTIMAP_REMAP);
}
-static boolean anyTextInputGadgetActive()
+boolean anyTextInputGadgetActive()
{
return (last_gi && (last_gi->type & GD_TYPE_TEXT_INPUT) && last_gi->mapped);
}
-static boolean anyTextAreaGadgetActive()
+boolean anyTextAreaGadgetActive()
{
return (last_gi && (last_gi->type & GD_TYPE_TEXT_AREA) && last_gi->mapped);
}
-static boolean anySelectboxGadgetActive()
+boolean anySelectboxGadgetActive()
{
return (last_gi && (last_gi->type & GD_TYPE_SELECTBOX) && last_gi->mapped);
}
+boolean anyScrollbarGadgetActive()
+{
+ return (last_gi && (last_gi->type & GD_TYPE_SCROLLBAR) && last_gi->mapped);
+}
+
+boolean anyTextGadgetActive()
+{
+ return (anyTextInputGadgetActive() ||
+ anyTextAreaGadgetActive() ||
+ anySelectboxGadgetActive());
+}
+
static boolean insideSelectboxLine(struct GadgetInfo *gi, int mx, int my)
{
return(gi != NULL &&
my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height);
}
-boolean anyTextGadgetActive()
-{
- return (anyTextInputGadgetActive() ||
- anyTextAreaGadgetActive() ||
- anySelectboxGadgetActive());
-}
-
void ClickOnGadget(struct GadgetInfo *gi, int button)
{
if (!gi->mapped)
void UnmapAllGadgets();
void RemapAllGadgets();
+boolean anyTextInputGadgetActive();
+boolean anyTextAreaGadgetActive();
+boolean anySelectboxGadgetActive();
+boolean anyScrollbarGadgetActive();
boolean anyTextGadgetActive();
void ClickOnGadget(struct GadgetInfo *, int);
#define LEVELCOLOR(n) (IS_LEVELCLASS_TUTORIAL(n) ? FC_BLUE : \
IS_LEVELCLASS_CLASSICS(n) ? FC_RED : \
- IS_LEVELCLASS_BD(n) ? FC_GREEN : \
+ IS_LEVELCLASS_BD(n) ? FC_YELLOW : \
IS_LEVELCLASS_EM(n) ? FC_YELLOW : \
- IS_LEVELCLASS_SP(n) ? FC_GREEN : \
+ IS_LEVELCLASS_SP(n) ? FC_YELLOW : \
IS_LEVELCLASS_DX(n) ? FC_YELLOW : \
+ IS_LEVELCLASS_SB(n) ? FC_YELLOW : \
IS_LEVELCLASS_CONTRIB(n) ? FC_GREEN : \
IS_LEVELCLASS_PRIVATE(n) ? FC_RED : \
FC_BLUE)
IS_LEVELCLASS_EM(n) ? 3 : \
IS_LEVELCLASS_SP(n) ? 4 : \
IS_LEVELCLASS_DX(n) ? 5 : \
- IS_LEVELCLASS_CONTRIB(n) ? 6 : \
- IS_LEVELCLASS_PRIVATE(n) ? 7 : \
+ IS_LEVELCLASS_SB(n) ? 6 : \
+ IS_LEVELCLASS_CONTRIB(n) ? 7 : \
+ IS_LEVELCLASS_PRIVATE(n) ? 8 : \
9)
#define ARTWORKCOLOR(n) (IS_ARTWORKCLASS_CLASSICS(n) ? FC_RED : \
- IS_ARTWORKCLASS_CONTRIB(n) ? FC_YELLOW : \
+ IS_ARTWORKCLASS_CONTRIB(n) ? FC_GREEN : \
IS_ARTWORKCLASS_PRIVATE(n) ? FC_RED : \
- IS_ARTWORKCLASS_LEVEL(n) ? FC_GREEN : \
+ IS_ARTWORKCLASS_LEVEL(n) ? FC_YELLOW : \
FC_BLUE)
#define ARTWORKSORTING(n) (IS_ARTWORKCLASS_CLASSICS(n) ? 0 : \
#define LEVELINFO_TOKEN_NAME_SORTING 2
#define LEVELINFO_TOKEN_AUTHOR 3
#define LEVELINFO_TOKEN_IMPORTED_FROM 4
-#define LEVELINFO_TOKEN_LEVELS 5
-#define LEVELINFO_TOKEN_FIRST_LEVEL 6
-#define LEVELINFO_TOKEN_SORT_PRIORITY 7
-#define LEVELINFO_TOKEN_LATEST_ENGINE 8
-#define LEVELINFO_TOKEN_LEVEL_GROUP 9
-#define LEVELINFO_TOKEN_READONLY 10
-#define LEVELINFO_TOKEN_GRAPHICS_SET 11
-#define LEVELINFO_TOKEN_SOUNDS_SET 12
-#define LEVELINFO_TOKEN_MUSIC_SET 13
-#define LEVELINFO_TOKEN_FILENAME 14
-#define LEVELINFO_TOKEN_FILETYPE 15
-#define LEVELINFO_TOKEN_HANDICAP 16
-
-#define NUM_LEVELINFO_TOKENS 17
+#define LEVELINFO_TOKEN_IMPORTED_BY 5
+#define LEVELINFO_TOKEN_LEVELS 6
+#define LEVELINFO_TOKEN_FIRST_LEVEL 7
+#define LEVELINFO_TOKEN_SORT_PRIORITY 8
+#define LEVELINFO_TOKEN_LATEST_ENGINE 9
+#define LEVELINFO_TOKEN_LEVEL_GROUP 10
+#define LEVELINFO_TOKEN_READONLY 11
+#define LEVELINFO_TOKEN_GRAPHICS_SET 12
+#define LEVELINFO_TOKEN_SOUNDS_SET 13
+#define LEVELINFO_TOKEN_MUSIC_SET 14
+#define LEVELINFO_TOKEN_FILENAME 15
+#define LEVELINFO_TOKEN_FILETYPE 16
+#define LEVELINFO_TOKEN_HANDICAP 17
+
+#define NUM_LEVELINFO_TOKENS 18
static LevelDirTree ldi;
{ TYPE_STRING, &ldi.name_sorting, "name_sorting" },
{ TYPE_STRING, &ldi.author, "author" },
{ TYPE_STRING, &ldi.imported_from, "imported_from" },
+ { TYPE_STRING, &ldi.imported_by, "imported_by" },
{ TYPE_INTEGER, &ldi.levels, "levels" },
{ TYPE_INTEGER, &ldi.first_level, "first_level" },
{ TYPE_INTEGER, &ldi.sort_priority, "sort_priority" },
if (ldi->type == TREE_TYPE_LEVEL_DIR)
{
ldi->imported_from = NULL;
+ ldi->imported_by = NULL;
ldi->graphics_set = NULL;
ldi->sounds_set = NULL;
if (ldi->type == TREE_TYPE_LEVEL_DIR)
{
ldi->imported_from = getStringCopy(parent->imported_from);
+ ldi->imported_by = getStringCopy(parent->imported_by);
ldi->graphics_set = NULL;
ldi->sounds_set = NULL;
ldi->author = getStringCopy(parent->author);
ldi->imported_from = getStringCopy(parent->imported_from);
+ ldi->imported_by = getStringCopy(parent->imported_by);
ldi->class_desc = getStringCopy(parent->class_desc);
ldi->graphics_set = NULL;
if (ldi->type == TREE_TYPE_LEVEL_DIR)
{
checked_free(ldi->imported_from);
+ checked_free(ldi->imported_by);
checked_free(ldi->graphics_set);
checked_free(ldi->sounds_set);
if (i != LEVELINFO_TOKEN_IDENTIFIER &&
i != LEVELINFO_TOKEN_NAME_SORTING &&
i != LEVELINFO_TOKEN_IMPORTED_FROM &&
+ i != LEVELINFO_TOKEN_IMPORTED_BY &&
i != LEVELINFO_TOKEN_FILENAME &&
i != LEVELINFO_TOKEN_FILETYPE)
fprintf(file, "%s\n", getSetupLine(levelinfo_tokens, "", i));
#define LEVELCLASS_SP_END 699
#define LEVELCLASS_DX_START 700
#define LEVELCLASS_DX_END 799
+#define LEVELCLASS_SB_START 800
+#define LEVELCLASS_SB_END 899
#define LEVELCLASS_PREDEFINED_START LEVELCLASS_TUTORIAL_START
-#define LEVELCLASS_PREDEFINED_END LEVELCLASS_DX_END
+#define LEVELCLASS_PREDEFINED_END LEVELCLASS_SB_END
#define LEVELCLASS_TUTORIAL LEVELCLASS_TUTORIAL_START
#define LEVELCLASS_CLASSICS LEVELCLASS_CLASSICS_START
#define LEVELCLASS_EM LEVELCLASS_EM_START
#define LEVELCLASS_SP LEVELCLASS_SP_START
#define LEVELCLASS_DX LEVELCLASS_DX_START
+#define LEVELCLASS_SB LEVELCLASS_SB_START
#define LEVELCLASS_UNDEFINED 999
#define IS_LEVELCLASS_DX(p) \
((p)->sort_priority >= LEVELCLASS_DX_START && \
(p)->sort_priority <= LEVELCLASS_DX_END)
+#define IS_LEVELCLASS_SB(p) \
+ ((p)->sort_priority >= LEVELCLASS_SB_START && \
+ (p)->sort_priority <= LEVELCLASS_SB_END)
#define IS_LEVELCLASS_UNDEFINED(p) \
((p)->sort_priority < LEVELCLASS_PREDEFINED_START || \
(p)->sort_priority > LEVELCLASS_PREDEFINED_END)
IS_LEVELCLASS_EM(n) ? LEVELCLASS_EM : \
IS_LEVELCLASS_SP(n) ? LEVELCLASS_SP : \
IS_LEVELCLASS_DX(n) ? LEVELCLASS_DX : \
+ IS_LEVELCLASS_SB(n) ? LEVELCLASS_SB : \
LEVELCLASS_UNDEFINED)
/* sort priorities of artwork */
char *name_sorting; /* optional sorting name for correct name sorting */
char *author; /* level or artwork author name */
char *imported_from; /* optional comment for imported levels or artwork */
+ char *imported_by; /* optional comment for imported levels or artwork */
char *graphics_set; /* optional custom graphics set (level tree only) */
char *sounds_set; /* optional custom sounds set (level tree only) */
#define EYSIZE (VYSIZE + 44)
#define FULL_SXSIZE (2 + SXSIZE + 2)
#define FULL_SYSIZE (2 + SYSIZE + 2)
-#define MICROLEV_XSIZE ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
-#define MICROLEV_YSIZE ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
-#define MICROLEV_XPOS (SX + (SXSIZE - MICROLEV_XSIZE) / 2)
-#define MICROLEV_YPOS (SX + 12 * TILEY - MICRO_TILEY)
-#define MICROLABEL_YPOS (MICROLEV_YPOS + MICROLEV_YSIZE + 7)
+#define MICROLEVEL_XSIZE ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
+#define MICROLEVEL_YSIZE ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
+#define MICROLEVEL_XPOS (SX + (SXSIZE - MICROLEVEL_XSIZE) / 2)
+#define MICROLEVEL_YPOS (SX + 12 * TILEY - MICRO_TILEY)
+#define MICROLABEL1_YPOS (MICROLEVEL_YPOS - 36)
+#define MICROLABEL2_YPOS (MICROLEVEL_YPOS + MICROLEVEL_YSIZE + 7)
/* score for elements */
DrawText(mSX + level_width + 5 * 32, mSY + 3*32, int2str(level_nr,3),
FONT_VALUE_1);
- DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, TRUE);
+ DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE);
DrawTextF(mSX + 32 + level_width - 2, mSY + 3*32 + 1, FONT_TEXT_3, "%d-%d",
leveldir_current->first_level, leveldir_current->last_level);
FONT_VALUE_1);
LoadLevel(level_nr);
- DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, TRUE);
+ DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE);
TapeErase();
LoadTape(level_nr);
if (game_status == GAME_MODE_MAIN)
{
- DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, FALSE);
+ DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, FALSE);
DoAnimation();
}
}
int num_entries = numTreeInfoInGroup(ti);
int num_page_entries;
int last_game_status = game_status; /* save current game status */
+ boolean position_set_by_scrollbar = (dx == 999);
/* force LEVELS draw offset on choose level and artwork setup screen */
game_status = GAME_MODE_LEVELS;
ti->cl_cursor = entry_pos - ti->cl_first;
}
- if (dx == 999) /* first entry is set by scrollbar position */
+ if (position_set_by_scrollbar)
ti->cl_first = dy;
else
AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL,
return;
}
- if (IN_VIS_FIELD(x, y) &&
+ if (!anyScrollbarGadgetActive() &&
+ IN_VIS_FIELD(x, y) &&
mx < screen_gadget[SCREEN_CTRL_ID_SCROLL_VERTICAL]->x &&
y >= 0 && y < num_page_entries)
{
{
int x, y;
- DrawBackground(xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
+ DrawBackground(xpos, ypos, MICROLEVEL_XSIZE, MICROLEVEL_YSIZE);
if (lev_fieldx < STD_LEV_FIELDX)
xpos += (STD_LEV_FIELDX - lev_fieldx) / 2 * MICRO_TILEX;
#define MICROLABEL_EMPTY 0
#define MICROLABEL_LEVEL_NAME 1
-#define MICROLABEL_CREATED_BY 2
+#define MICROLABEL_LEVEL_AUTHOR_HEAD 2
#define MICROLABEL_LEVEL_AUTHOR 3
-#define MICROLABEL_IMPORTED_FROM 4
-#define MICROLABEL_LEVEL_IMPORT_INFO 5
+#define MICROLABEL_IMPORTED_FROM_HEAD 4
+#define MICROLABEL_IMPORTED_FROM 5
+#define MICROLABEL_IMPORTED_BY_HEAD 6
+#define MICROLABEL_IMPORTED_BY 7
static void DrawMicroLevelLabelExt(int mode)
{
int max_len_label_text;
int font_nr = FONT_TEXT_2;
- if (mode == MICROLABEL_CREATED_BY || mode == MICROLABEL_IMPORTED_FROM)
+ if (mode == MICROLABEL_LEVEL_AUTHOR_HEAD ||
+ mode == MICROLABEL_IMPORTED_FROM_HEAD ||
+ mode == MICROLABEL_IMPORTED_BY_HEAD)
font_nr = FONT_TEXT_3;
max_len_label_text = SXSIZE / getFontWidth(font_nr);
- DrawBackground(SX, MICROLABEL_YPOS, SXSIZE, getFontHeight(font_nr));
+ DrawBackground(SX, MICROLABEL2_YPOS, SXSIZE, getFontHeight(font_nr));
- strncpy(label_text, (mode == MICROLABEL_LEVEL_NAME ? level.name :
- mode == MICROLABEL_CREATED_BY ? "created by" :
- mode == MICROLABEL_LEVEL_AUTHOR ? level.author :
- mode == MICROLABEL_IMPORTED_FROM ? "imported from" :
- mode == MICROLABEL_LEVEL_IMPORT_INFO ?
- leveldir_current->imported_from : ""),
+ strncpy(label_text,
+ (mode == MICROLABEL_LEVEL_NAME ? level.name :
+ mode == MICROLABEL_LEVEL_AUTHOR_HEAD ? "created by" :
+ mode == MICROLABEL_LEVEL_AUTHOR ? level.author :
+ mode == MICROLABEL_IMPORTED_FROM_HEAD ? "imported from" :
+ mode == MICROLABEL_IMPORTED_FROM ? leveldir_current->imported_from :
+ mode == MICROLABEL_IMPORTED_BY_HEAD ? "imported by" :
+ mode == MICROLABEL_IMPORTED_BY ? leveldir_current->imported_by :""),
max_len_label_text);
label_text[max_len_label_text] = '\0';
if (strlen(label_text) > 0)
{
int lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2;
- int lypos = MICROLABEL_YPOS;
+ int lypos = MICROLABEL2_YPOS;
DrawText(lxpos, lypos, label_text, font_nr);
}
if (leveldir_current->name)
{
- int text_width = getTextWidth(leveldir_current->name, FONT_TEXT_1);
- int lxpos = SX + (SXSIZE - text_width) / 2;
- int lypos = SY + 352;
+ char label_text[MAX_OUTPUT_LINESIZE + 1];
+ int font_nr = FONT_TEXT_1;
+ int max_len_label_text = SXSIZE / getFontWidth(font_nr);
+ int lxpos, lypos;
- DrawText(lxpos, lypos, leveldir_current->name, FONT_TEXT_1);
+ strncpy(label_text, leveldir_current->name, max_len_label_text);
+ label_text[max_len_label_text] = '\0';
+
+ lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2;
+ lypos = SY + MICROLABEL1_YPOS;
+
+ DrawText(lxpos, lypos, label_text, font_nr);
}
game_status = last_game_status; /* restore current game status */
DrawMicroLevelExt(xpos, ypos, from_x, from_y);
}
+ /* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */
/* redraw micro level label, if needed */
if (strcmp(level.name, NAMELESS_LEVEL_NAME) != 0 &&
strcmp(level.author, ANONYMOUS_NAME) != 0 &&
if (leveldir_current->imported_from != NULL)
max_label_counter += 14;
+ if (leveldir_current->imported_by != NULL)
+ max_label_counter += 14;
label_counter = (label_counter + 1) % max_label_counter;
label_state = (label_counter >= 0 && label_counter <= 7 ?
MICROLABEL_LEVEL_NAME :
label_counter >= 9 && label_counter <= 12 ?
- MICROLABEL_CREATED_BY :
+ MICROLABEL_LEVEL_AUTHOR_HEAD :
label_counter >= 14 && label_counter <= 21 ?
MICROLABEL_LEVEL_AUTHOR :
label_counter >= 23 && label_counter <= 26 ?
- MICROLABEL_IMPORTED_FROM :
+ MICROLABEL_IMPORTED_FROM_HEAD :
label_counter >= 28 && label_counter <= 35 ?
- MICROLABEL_LEVEL_IMPORT_INFO : MICROLABEL_EMPTY);
+ MICROLABEL_IMPORTED_FROM :
+ label_counter >= 37 && label_counter <= 40 ?
+ MICROLABEL_IMPORTED_BY_HEAD :
+ label_counter >= 42 && label_counter <= 49 ?
+ MICROLABEL_IMPORTED_BY : MICROLABEL_EMPTY);
+
+ if (leveldir_current->imported_from == NULL &&
+ (label_state == MICROLABEL_IMPORTED_FROM_HEAD ||
+ label_state == MICROLABEL_IMPORTED_FROM))
+ label_state = (label_state == MICROLABEL_IMPORTED_FROM_HEAD ?
+ MICROLABEL_IMPORTED_BY_HEAD : MICROLABEL_IMPORTED_BY);
+
DrawMicroLevelLabelExt(label_state);
}