+2006-10-18
+ * added configuration directives for the remaining main menu items
+
2006-10-17
* added additional configuration directives for info screen draw offset:
menu.draw_{x,y}offset.INFO[{ELEMENTS,MUSIC,CREDITS,PROGRAM,LEVELSET}]
{ "main.button.setup.y", "256" },
{ "main.button.quit.x", "0" },
{ "main.button.quit.y", "288" },
+
{ "main.button.prev_level.x", "320" },
{ "main.button.prev_level.y", "96" },
{ "main.button.next_level.x", "448" },
{ "main.text.name.y", "-1" },
{ "main.text.name.width", "-1" },
{ "main.text.name.height", "-1" },
+ { "main.text.name.align", "left" },
{ "main.text.levels.x", "-1" },
{ "main.text.levels.y", "-1" },
{ "main.text.levels.width", "-1" },
{ "main.text.levels.height", "-1" },
+ { "main.text.levels.align", "left" },
{ "main.text.scores.x", "-1" },
{ "main.text.scores.y", "-1" },
{ "main.text.scores.width", "-1" },
{ "main.text.scores.height", "-1" },
+ { "main.text.scores.align", "left" },
{ "main.text.editor.x", "-1" },
{ "main.text.editor.y", "-1" },
{ "main.text.editor.width", "-1" },
{ "main.text.editor.height", "-1" },
+ { "main.text.editor.align", "left" },
{ "main.text.info.x", "-1" },
{ "main.text.info.y", "-1" },
{ "main.text.info.width", "-1" },
{ "main.text.info.height", "-1" },
+ { "main.text.info.align", "left" },
{ "main.text.game.x", "-1" },
{ "main.text.game.y", "-1" },
{ "main.text.game.width", "-1" },
{ "main.text.game.height", "-1" },
+ { "main.text.game.align", "left" },
{ "main.text.setup.x", "-1" },
{ "main.text.setup.y", "-1" },
{ "main.text.setup.width", "-1" },
{ "main.text.setup.height", "-1" },
+ { "main.text.setup.align", "left" },
{ "main.text.quit.x", "-1" },
{ "main.text.quit.y", "-1" },
{ "main.text.quit.width", "-1" },
{ "main.text.quit.height", "-1" },
+ { "main.text.quit.align", "left" },
{ "main.text.current_level.x", "352" },
{ "main.text.current_level.y", "96" },
+ { "main.text.current_level.align", "left" },
{ "main.text.first_level.x", "488" },
{ "main.text.first_level.y", "98" },
+ { "main.text.first_level.align", "left" },
{ "main.text.last_level.x", "488" },
{ "main.text.last_level.y", "112" },
+ { "main.text.last_level.align", "left" },
{ "main.text.level_info_1.x", "272" },
{ "main.text.level_info_1.y", "352" },
+ { "main.text.level_info_1.align", "center" },
{ "main.text.level_info_2.x", "272" },
{ "main.text.level_info_2.y", "523" },
+ { "main.text.level_info_2.align", "center" },
+ { "main.text.title_1.x", "272" },
+ { "main.text.title_1.y", "8" },
+ { "main.text.title_1.align", "center" },
+ { "main.text.title_2.x", "272" },
+ { "main.text.title_2.y", "46" },
+ { "main.text.title_2.align", "center" },
+ { "main.text.title_3.x", "272" },
+ { "main.text.title_3.y", "326" },
+ { "main.text.title_3.align", "center" },
{ "main.input.name.x", "-1" },
{ "main.input.name.y", "-1" },
+ { "main.input.name.align", "left" },
- { "preview.x", "148" },
- { "preview.y", "388" },
+ { "preview.x", "272" },
+ { "preview.y", "380" },
+ { "preview.align", "center" },
{ "preview.xsize", "66" },
{ "preview.ysize", "34" },
{ "preview.xoffset", "0" },
{ "preview.tile_size", "4" },
{ "preview.step_offset", "1" },
{ "preview.step_delay", "50" },
+ { "preview.anim_mode", "default" },
{ "door_1.width", "-1" },
{ "door_1.height", "-1" },
-#define COMPILE_DATE_STRING "[2006-10-18 01:10]"
+#define COMPILE_DATE_STRING "[2006-10-19 00:36]"
strEqual(value, "up") ? MV_UP :
strEqual(value, "down") ? MV_DOWN : MV_NONE);
}
+ else if (strEqual(suffix, ".align"))
+ {
+ result = (strEqual(value, "left") ? ALIGN_LEFT :
+ strEqual(value, "right") ? ALIGN_RIGHT :
+ strEqual(value, "center") ? ALIGN_CENTER : ALIGN_DEFAULT);
+ }
else if (strEqual(suffix, ".anim_mode"))
{
result = (string_has_parameter(value, "none") ? ANIM_NONE :
string_has_parameter(value, "ce_delay") ? ANIM_CE_DELAY :
string_has_parameter(value, "horizontal") ? ANIM_HORIZONTAL :
string_has_parameter(value, "vertical") ? ANIM_VERTICAL :
+ string_has_parameter(value, "centered") ? ANIM_CENTERED :
ANIM_DEFAULT);
if (string_has_parameter(value, "reverse"))
/* values for special (non game element) animation modes */
#define ANIM_HORIZONTAL (1 << 10)
#define ANIM_VERTICAL (1 << 11)
-#define ANIM_STATIC_PANEL (1 << 12)
+#define ANIM_CENTERED (1 << 12)
+#define ANIM_STATIC_PANEL (1 << 13)
#define ANIM_DEFAULT ANIM_LOOP
+/* values for text alignment */
+#define ALIGN_LEFT (1 << 0)
+#define ALIGN_RIGHT (1 << 1)
+#define ALIGN_CENTER (1 << 2)
+
+#define ALIGN_DEFAULT ALIGN_LEFT
+
+#define ALIGNED_XPOS(x,w,a) ((a) == ALIGN_CENTER ? (x) - (w) / 2 : \
+ (a) == ALIGN_RIGHT ? (x) - (w) : (x))
+
/* values for redraw_mask */
#define REDRAW_NONE (0)
#define REDRAW_ALL (1 << 0)
gfx.sy + y, text, font_nr);
}
+void DrawTextSAligned(int x, int y, char *text, int font_nr, int align)
+{
+ DrawText(gfx.sx + ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
+ gfx.sx + y, text, font_nr);
+}
+
+void DrawTextAligned(int x, int y, char *text, int font_nr, int align)
+{
+ DrawText(ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
+ y, text, font_nr);
+}
+
void DrawText(int x, int y, char *text, int font_nr)
{
int mask_mode = BLIT_OPAQUE;
void DrawTextFCentered(int, int, char *, ...);
void DrawTextS(int, int, int, char *);
void DrawTextSCentered(int, int, char *);
+void DrawTextSAligned(int, int, char *, int, int);
+void DrawTextAligned(int, int, char *, int, int);
void DrawText(int, int, char *, int);
void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
void DrawTextToTextArea(int, int, char *, int, int, int, int, int);
{ "main.button.setup.y", &menu.main.button.setup.y },
{ "main.button.quit.x", &menu.main.button.quit.x },
{ "main.button.quit.y", &menu.main.button.quit.y },
+
{ "main.button.prev_level.x", &menu.main.button.prev_level.x },
{ "main.button.prev_level.y", &menu.main.button.prev_level.y },
{ "main.button.next_level.x", &menu.main.button.next_level.x },
{ "main.text.name.y", &menu.main.text.name.y },
{ "main.text.name.width", &menu.main.text.name.width },
{ "main.text.name.height", &menu.main.text.name.height },
+ { "main.text.name.align", &menu.main.text.name.align },
{ "main.text.levels.x", &menu.main.text.levels.x },
{ "main.text.levels.y", &menu.main.text.levels.y },
{ "main.text.levels.width", &menu.main.text.levels.width },
{ "main.text.levels.height", &menu.main.text.levels.height },
+ { "main.text.levels.align", &menu.main.text.levels.align },
{ "main.text.scores.x", &menu.main.text.scores.x },
{ "main.text.scores.y", &menu.main.text.scores.y },
{ "main.text.scores.width", &menu.main.text.scores.width },
{ "main.text.scores.height", &menu.main.text.scores.height },
+ { "main.text.scores.align", &menu.main.text.scores.align },
{ "main.text.editor.x", &menu.main.text.editor.x },
{ "main.text.editor.y", &menu.main.text.editor.y },
{ "main.text.editor.width", &menu.main.text.editor.width },
{ "main.text.editor.height", &menu.main.text.editor.height },
+ { "main.text.editor.align", &menu.main.text.editor.align },
{ "main.text.info.x", &menu.main.text.info.x },
{ "main.text.info.y", &menu.main.text.info.y },
{ "main.text.info.width", &menu.main.text.info.width },
{ "main.text.info.height", &menu.main.text.info.height },
+ { "main.text.info.align", &menu.main.text.info.align },
{ "main.text.game.x", &menu.main.text.game.x },
{ "main.text.game.y", &menu.main.text.game.y },
{ "main.text.game.width", &menu.main.text.game.width },
{ "main.text.game.height", &menu.main.text.game.height },
+ { "main.text.game.align", &menu.main.text.game.align },
{ "main.text.setup.x", &menu.main.text.setup.x },
{ "main.text.setup.y", &menu.main.text.setup.y },
{ "main.text.setup.width", &menu.main.text.setup.width },
{ "main.text.setup.height", &menu.main.text.setup.height },
+ { "main.text.setup.align", &menu.main.text.setup.align },
{ "main.text.quit.x", &menu.main.text.quit.x },
{ "main.text.quit.y", &menu.main.text.quit.y },
{ "main.text.quit.width", &menu.main.text.quit.width },
{ "main.text.quit.height", &menu.main.text.quit.height },
+ { "main.text.quit.align", &menu.main.text.quit.align },
- { "main.text.current_level.x",&menu.main.text.current_level.x },
- { "main.text.current_level.y",&menu.main.text.current_level.y },
- { "main.text.first_level.x", &menu.main.text.first_level.x },
- { "main.text.first_level.y", &menu.main.text.first_level.y },
- { "main.text.last_level.x", &menu.main.text.last_level.x },
- { "main.text.last_level.y", &menu.main.text.last_level.y },
- { "main.text.level_info_1.x", &menu.main.text.level_info_1.x },
- { "main.text.level_info_1.y", &menu.main.text.level_info_1.y },
- { "main.text.level_info_2.x", &menu.main.text.level_info_2.x },
- { "main.text.level_info_2.y", &menu.main.text.level_info_2.y },
+ { "main.text.current_level.x", &menu.main.text.current_level.x },
+ { "main.text.current_level.y", &menu.main.text.current_level.y },
+ { "main.text.current_level.align", &menu.main.text.current_level.align },
+ { "main.text.first_level.x", &menu.main.text.first_level.x },
+ { "main.text.first_level.y", &menu.main.text.first_level.y },
+ { "main.text.first_level.align", &menu.main.text.first_level.align },
+ { "main.text.last_level.x", &menu.main.text.last_level.x },
+ { "main.text.last_level.y", &menu.main.text.last_level.y },
+ { "main.text.last_level.align", &menu.main.text.last_level.align },
+ { "main.text.level_info_1.x", &menu.main.text.level_info_1.x },
+ { "main.text.level_info_1.y", &menu.main.text.level_info_1.y },
+ { "main.text.level_info_1.align", &menu.main.text.level_info_1.align },
+ { "main.text.level_info_2.x", &menu.main.text.level_info_2.x },
+ { "main.text.level_info_2.y", &menu.main.text.level_info_2.y },
+ { "main.text.level_info_2.align", &menu.main.text.level_info_2.align },
+ { "main.text.title_1.x", &menu.main.text.title_1.x },
+ { "main.text.title_1.y", &menu.main.text.title_1.y },
+ { "main.text.title_1.align", &menu.main.text.title_1.align },
+ { "main.text.title_2.x", &menu.main.text.title_2.x },
+ { "main.text.title_2.y", &menu.main.text.title_2.y },
+ { "main.text.title_2.align", &menu.main.text.title_2.align },
+ { "main.text.title_3.x", &menu.main.text.title_3.x },
+ { "main.text.title_3.y", &menu.main.text.title_3.y },
+ { "main.text.title_3.align", &menu.main.text.title_3.align },
{ "main.input.name.x", &menu.main.input.name.x },
{ "main.input.name.y", &menu.main.input.name.y },
+ { "main.input.name.align", &menu.main.input.name.align },
{ "preview.x", &preview.x },
{ "preview.y", &preview.y },
+ { "preview.align", &preview.align },
{ "preview.xsize", &preview.xsize },
{ "preview.ysize", &preview.ysize },
{ "preview.xoffset", &preview.xoffset },
{ "preview.tile_size", &preview.tile_size },
{ "preview.step_offset", &preview.step_offset },
{ "preview.step_delay", &preview.step_delay },
+ { "preview.anim_mode", &preview.anim_mode },
{ "door_1.width", &door_1.width },
{ "door_1.height", &door_1.height },
#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2006 by Holger Schemel"
#define PROGRAM_EMAIL_STRING "info@artsoft.org"
#define PROGRAM_WEBSITE_STRING "http://www.artsoft.org/"
+#define PROGRAM_GAME_BY_STRING "A Game by Artsoft Entertainment"
#define ICON_TITLE_STRING PROGRAM_TITLE_STRING
#define COOKIE_PREFIX "ROCKSNDIAMONDS"
int draw_masked[NUM_SPECIAL_GFX_ARGS];
};
+struct MenuPosInfo
+{
+ int x, y;
+ int width, height;
+ int align;
+};
+
struct MenuMainButtonInfo
{
- struct Rect name;
- struct Rect levels;
- struct Rect scores;
- struct Rect editor;
- struct Rect info;
- struct Rect game;
- struct Rect setup;
- struct Rect quit;
-
- struct Rect prev_level;
- struct Rect next_level;
+ struct MenuPosInfo name;
+ struct MenuPosInfo levels;
+ struct MenuPosInfo scores;
+ struct MenuPosInfo editor;
+ struct MenuPosInfo info;
+ struct MenuPosInfo game;
+ struct MenuPosInfo setup;
+ struct MenuPosInfo quit;
+
+ struct MenuPosInfo prev_level;
+ struct MenuPosInfo next_level;
};
struct MenuMainTextInfo
{
- struct Rect name;
- struct Rect levels;
- struct Rect scores;
- struct Rect editor;
- struct Rect info;
- struct Rect game;
- struct Rect setup;
- struct Rect quit;
-
- struct Rect current_level;
- struct Rect first_level;
- struct Rect last_level;
- struct Rect level_info_1;
- struct Rect level_info_2;
+ struct MenuPosInfo name;
+ struct MenuPosInfo levels;
+ struct MenuPosInfo scores;
+ struct MenuPosInfo editor;
+ struct MenuPosInfo info;
+ struct MenuPosInfo game;
+ struct MenuPosInfo setup;
+ struct MenuPosInfo quit;
+
+ struct MenuPosInfo current_level;
+ struct MenuPosInfo first_level;
+ struct MenuPosInfo last_level;
+ struct MenuPosInfo level_info_1;
+ struct MenuPosInfo level_info_2;
+ struct MenuPosInfo title_1;
+ struct MenuPosInfo title_2;
+ struct MenuPosInfo title_3;
};
struct MenuMainInputInfo
{
- struct Rect name;
+ struct MenuPosInfo name;
};
struct MenuMainInfo
struct PreviewInfo
{
int x, y;
+ int align;
int xsize, ysize;
int xoffset, yoffset;
int tile_size;
int step_offset;
int step_delay;
+ int anim_mode;
};
struct HiScore
#define MAIN_CONTROL_CURRENT_LEVEL 10
#define MAIN_CONTROL_FIRST_LEVEL 11
#define MAIN_CONTROL_LAST_LEVEL 12
-#define MAIN_CONTROL_LEVELSET_INFO 13
-#define MAIN_CONTROL_LEVEL_INFO 14
+#define MAIN_CONTROL_LEVEL_INFO_1 13
+#define MAIN_CONTROL_LEVEL_INFO_2 14
+#define MAIN_CONTROL_TITLE_1 15
+#define MAIN_CONTROL_TITLE_2 16
+#define MAIN_CONTROL_TITLE_3 17
static char main_text_name[10];
static char main_text_current_level[10];
{
int nr;
- struct Rect *pos_button;
+ struct MenuPosInfo *pos_button;
int button_graphic;
- struct Rect *pos_text;
+ struct MenuPosInfo *pos_text;
char *text;
int font_text;
- struct Rect *pos_input;
+ struct MenuPosInfo *pos_input;
char *input;
int font_input;
}
NULL, NULL, -1,
},
{
- MAIN_CONTROL_LEVELSET_INFO,
+ MAIN_CONTROL_LEVEL_INFO_1,
NULL, -1,
&menu.main.text.level_info_1, NULL, -1,
NULL, NULL, -1,
},
{
- MAIN_CONTROL_LEVEL_INFO,
+ MAIN_CONTROL_LEVEL_INFO_2,
NULL, -1,
&menu.main.text.level_info_2, NULL, -1,
NULL, NULL, -1,
},
+ {
+ MAIN_CONTROL_TITLE_1,
+ NULL, -1,
+ &menu.main.text.title_1, PROGRAM_TITLE_STRING, FONT_TITLE_1,
+ NULL, NULL, -1,
+ },
+ {
+ MAIN_CONTROL_TITLE_2,
+ NULL, -1,
+ &menu.main.text.title_2, PROGRAM_COPYRIGHT_STRING, FONT_TITLE_2,
+ NULL, NULL, -1,
+ },
+ {
+ MAIN_CONTROL_TITLE_3,
+ NULL, -1,
+ &menu.main.text.title_3, PROGRAM_GAME_BY_STRING, FONT_TITLE_2,
+ NULL, NULL, -1,
+ },
{
-1,
/* set main control screen positions to dynamically determined values */
for (i = 0; main_controls[i].nr != -1; i++)
{
- int nr = main_controls[i].nr;
- struct Rect *pos_button = main_controls[i].pos_button;
- struct Rect *pos_text = main_controls[i].pos_text;
- struct Rect *pos_input = main_controls[i].pos_input;
- char *text = main_controls[i].text;
- char *input = main_controls[i].input;
- int button_graphic = main_controls[i].button_graphic;
- int font_text = main_controls[i].font_text;
- int font_input = main_controls[i].font_input;
+ int nr = main_controls[i].nr;
+ struct MenuPosInfo *pos_button = main_controls[i].pos_button;
+ struct MenuPosInfo *pos_text = main_controls[i].pos_text;
+ struct MenuPosInfo *pos_input = main_controls[i].pos_input;
+ char *text = main_controls[i].text;
+ char *input = main_controls[i].input;
+ int button_graphic = main_controls[i].button_graphic;
+ int font_text = main_controls[i].font_text;
+ int font_input = main_controls[i].font_input;
int font_text_width = (font_text != -1 ? getFontWidth(font_text) : 0);
int font_text_height = (font_text != -1 ? getFontHeight(font_text) : 0);
if (pos_text != NULL)
{
+ /* calculate width for non-clickable text -- needed for text alignment */
+ boolean calculate_text_width = (pos_button == NULL && text != NULL);
+
if (pos_text->x == -1 && pos_button != NULL)
pos_text->x = pos_button->x + pos_button->width;
if (pos_text->y == -1 && pos_button != NULL)
pos_text->y = pos_button->y;
- if (pos_text->width == -1)
+ if (pos_text->width == -1 || calculate_text_width)
pos_text->width = text_width;
if (pos_text->height == -1)
pos_text->height = text_height;
for (i = 0; main_controls[i].nr != -1; i++)
{
- if (main_controls[i].nr == pos)
+ if (main_controls[i].nr == pos || pos == -1)
{
- struct Rect *pos_button = main_controls[i].pos_button;
- struct Rect *pos_text = main_controls[i].pos_text;
- char *text = main_controls[i].text;
- int font_text = main_controls[i].font_text;
- int button_graphic = main_controls[i].button_graphic;
- int button_x = mSX + pos_button->x;
- int button_y = mSY + pos_button->y;
- int text_x = mSX + pos_text->x;
- int text_y = mSY + pos_text->y;
+ struct MenuPosInfo *pos_button = main_controls[i].pos_button;
+ struct MenuPosInfo *pos_text = main_controls[i].pos_text;
+ struct MenuPosInfo *pos_input = main_controls[i].pos_input;
+ char *text = main_controls[i].text;
+ char *input = main_controls[i].input;
+ int button_graphic = main_controls[i].button_graphic;
+ int font_text = main_controls[i].font_text;
+ int font_input = main_controls[i].font_input;
if (active)
{
font_text = FONT_ACTIVE(font_text);
}
- DrawBackground(button_x, button_y, pos_button->width, pos_button->height);
- DrawGraphicThruMaskExt(drawto, button_x, button_y, button_graphic, 0);
+ if (pos_button != NULL)
+ {
+ int button_x = mSX + pos_button->x;
+ int button_y = mSY + pos_button->y;
+
+ DrawBackground(button_x,button_y, pos_button->width,pos_button->height);
+ DrawGraphicThruMaskExt(drawto, button_x, button_y, button_graphic, 0);
+ }
+
+ if (pos_text != NULL && text != NULL)
+ {
+ int text_x = mSX + ALIGNED_XPOS(pos_text->x, pos_text->width,
+ pos_text->align);
+ int text_y = mSY + pos_text->y;
- DrawBackground(text_x, text_y, pos_text->width, pos_text->height);
- DrawText(text_x, text_y, text, font_text);
+ DrawBackground(text_x, text_y, pos_text->width, pos_text->height);
+ DrawText(text_x, text_y, text, font_text);
+ }
- break;
+ if (pos_input != NULL && input != NULL)
+ {
+ int input_x = mSX + ALIGNED_XPOS(pos_input->x, pos_input->width,
+ pos_input->align);
+ int input_y = mSY + pos_input->y;
+
+ DrawBackground(input_x, input_y, pos_input->width, pos_input->height);
+ DrawText(input_x, input_y, input, font_input);
+ }
}
}
}
-static boolean insideRect(struct Rect *rect, int x, int y)
+static boolean insideMenuPosRect(struct MenuPosInfo *rect, int x, int y)
{
+ int rect_x = ALIGNED_XPOS(rect->x, rect->width, rect->align);
+ int rect_y = rect->y;
+
return (rect != NULL &&
- x >= rect->x && x < rect->x + rect->width &&
- y >= rect->y && y < rect->y + rect->height);
+ x >= rect_x && x < rect_x + rect->width &&
+ y >= rect_y && y < rect_y + rect->height);
}
static void drawCursorExt(int xpos, int ypos, boolean active, int graphic)
/* force LEVELS draw offset on artwork setup screen */
game_status = GAME_MODE_LEVELS;
- drawCursorExt(0, ypos, active, 0);
+ drawCursorExt(0, ypos, active, -1);
game_status = last_game_status; /* restore current game status */
}
char *name_text = (local_team_mode ? "Team:" : "Name:");
int name_width, level_width;
#endif
+#if 0
int i;
+#endif
UnmapAllGadgets();
FadeSoundsAndMusic();
SetMainBackgroundImage(IMG_BACKGROUND_MAIN);
ClearWindow();
- DrawHeadline();
-
#if 1
InitializeMainControls();
+#if 1
+ DrawCursorAndText_Main(-1, FALSE);
+#else
for (i = 0; main_controls[i].nr != -1; i++)
{
- struct Rect *pos_button = main_controls[i].pos_button;
- struct Rect *pos_text = main_controls[i].pos_text;
- struct Rect *pos_input = main_controls[i].pos_input;
- char *text = main_controls[i].text;
- char *input = main_controls[i].input;
- int button_graphic = main_controls[i].button_graphic;
- int font_text = main_controls[i].font_text;
- int font_input = main_controls[i].font_input;
+ struct MenuPosInfo *pos_button = main_controls[i].pos_button;
+ struct MenuPosInfo *pos_text = main_controls[i].pos_text;
+ struct MenuPosInfo *pos_input = main_controls[i].pos_input;
+ char *text = main_controls[i].text;
+ char *input = main_controls[i].input;
+ int button_graphic = main_controls[i].button_graphic;
+ int font_text = main_controls[i].font_text;
+ int font_input = main_controls[i].font_input;
if (pos_button != NULL)
DrawGraphicThruMaskExt(drawto, mSX + pos_button->x, mSY + pos_button->y,
if (pos_input != NULL && input != NULL)
DrawText(mSX + pos_input->x, mSY + pos_input->y, input, font_input);
}
+#endif
#else
+ DrawHeadline();
+
DrawText(mSX + 32, mSY + 2 * 32, name_text, FONT_MENU_1);
DrawText(mSX + 32, mSY + 3 * 32, "Levelset", FONT_MENU_1);
DrawText(mSX + 32, mSY + 4 * 32, "Hall Of Fame", FONT_MENU_1);
for (i = 0; i < 8; i++)
initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_ENTER_MENU :
IMG_MENU_BUTTON));
+
+ DrawTextSCentered(326, FONT_TITLE_2, PROGRAM_GAME_BY_STRING);
#endif
DrawPreviewLevel(TRUE);
- DrawTextSCentered(326, FONT_TITLE_2, "A Game by Artsoft Entertainment");
-
HandleMainMenu(0, 0, 0, 0, MB_MENU_INITIALIZE);
TapeStop();
for (i = 0; main_controls[i].nr != -1; i++)
{
- if (insideRect(main_controls[i].pos_button, mx - mSX, my - mSY) ||
- insideRect(main_controls[i].pos_text, mx - mSX, my - mSY) ||
- insideRect(main_controls[i].pos_input, mx - mSX, my - mSY))
+ if (insideMenuPosRect(main_controls[i].pos_button, mx - mSX, my - mSY) ||
+ insideMenuPosRect(main_controls[i].pos_text, mx - mSX, my - mSY) ||
+ insideMenuPosRect(main_controls[i].pos_input, mx - mSX, my - mSY))
{
pos = main_controls[i].nr;
drawChooseTreeList(ti->cl_first, num_page_entries, ti);
drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti);
- drawChooseTreeCursor(ti->cl_cursor, FC_RED);
+ drawChooseTreeCursor(ti->cl_cursor, TRUE);
return;
}
drawChooseTreeList(ti->cl_first, num_page_entries, ti);
drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti);
- drawChooseTreeCursor(ti->cl_cursor, FC_RED);
+ drawChooseTreeCursor(ti->cl_cursor, TRUE);
+
AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL,
ti->cl_first, ti);
}
drawChooseTreeList(ti->cl_first, num_page_entries, ti);
drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti);
- drawChooseTreeCursor(ti->cl_cursor, FC_RED);
+ drawChooseTreeCursor(ti->cl_cursor, TRUE);
+
AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL,
ti->cl_first, ti);
}
{
if (y != ti->cl_cursor)
{
- drawChooseTreeCursor(y, FC_RED);
- drawChooseTreeCursor(ti->cl_cursor, FC_BLUE);
+ drawChooseTreeCursor(ti->cl_cursor, FALSE);
+ drawChooseTreeCursor(y, TRUE);
drawChooseTreeInfo(ti->cl_first + y, ti);
+
ti->cl_cursor = y;
}
}
static void DrawPreviewLevelExt(int from_x, int from_y)
{
boolean show_level_border = (BorderElement != EL_EMPTY);
- int dst_x = preview.x;
- int dst_y = preview.y;
int level_xsize = lev_fieldx + (show_level_border ? 2 : 0);
int level_ysize = lev_fieldy + (show_level_border ? 2 : 0);
int tile_size = preview.tile_size;
int preview_height = preview.ysize * tile_size;
int real_preview_xsize = MIN(level_xsize, preview.xsize);
int real_preview_ysize = MIN(level_ysize, preview.ysize);
+ int dst_x = SX + ALIGNED_XPOS(preview.x, preview_width, preview.align);
+ int dst_y = SY + preview.y;
int x, y;
DrawBackground(dst_x, dst_y, preview_width, preview_height);
#define MICROLABEL_IMPORTED_BY_HEAD 6
#define MICROLABEL_IMPORTED_BY 7
+static int getMaxTextLength(struct MenuPosInfo *pos, int font_nr)
+{
+ int max_text_width = SXSIZE;
+ int font_width = getFontWidth(font_nr);
+
+ if (pos->align == ALIGN_CENTER)
+ max_text_width = (pos->x < SXSIZE / 2 ? pos->x * 2 : (SXSIZE - pos->x) * 2);
+ else if (pos->align == ALIGN_RIGHT)
+ max_text_width = pos->x;
+ else
+ max_text_width = SXSIZE - pos->x;
+
+ return max_text_width / font_width;
+}
+
static void DrawPreviewLevelLabelExt(int mode)
{
+ struct MenuPosInfo *pos = &menu.main.text.level_info_2;
char label_text[MAX_OUTPUT_LINESIZE + 1];
int max_len_label_text;
int font_nr = FONT_TEXT_2;
mode == MICROLABEL_IMPORTED_BY_HEAD)
font_nr = FONT_TEXT_3;
+#if 1
+ max_len_label_text = getMaxTextLength(pos, font_nr);
+#else
max_len_label_text = SXSIZE / getFontWidth(font_nr);
+#endif
for (i = 0; i < max_len_label_text; i++)
label_text[i] = ' ';
if (strlen(label_text) > 0)
{
#if 1
- int text_width = getTextWidth(label_text, font_nr);
- int lxpos = SX + menu.main.text.level_info_2.x - text_width / 2;
- int lypos = SY + menu.main.text.level_info_2.y;
+ DrawTextSAligned(pos->x, pos->y, label_text, font_nr, pos->align);
#else
int lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2;
int lypos = MICROLABEL2_YPOS;
-#endif
DrawText(lxpos, lypos, label_text, font_nr);
+#endif
}
strncpy(label_text,
if (strlen(label_text) > 0)
{
#if 1
- int text_width = getTextWidth(label_text, font_nr);
- int lxpos = SX + menu.main.text.level_info_2.x - text_width / 2;
- int lypos = SY + menu.main.text.level_info_2.y;
+ DrawTextSAligned(pos->x, pos->y, label_text, font_nr, pos->align);
#else
int lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2;
int lypos = MICROLABEL2_YPOS;
-#endif
DrawText(lxpos, lypos, label_text, font_nr);
+#endif
}
redraw_mask |= REDRAW_MICROLEVEL;
if (restart)
{
- from_x = preview.xoffset;
- from_y = preview.yoffset;
+ from_x = 0;
+ from_y = 0;
+
+ if (preview.anim_mode == ANIM_CENTERED)
+ {
+ if (level_xsize > preview.xsize)
+ from_x = (level_xsize - preview.xsize) / 2;
+ if (level_ysize > preview.ysize)
+ from_y = (level_ysize - preview.ysize) / 2;
+ }
+
+ from_x += preview.xoffset;
+ from_y += preview.yoffset;
+
scroll_direction = MV_RIGHT;
label_state = 1;
label_counter = 0;
if (leveldir_current->name)
{
+ struct MenuPosInfo *pos = &menu.main.text.level_info_1;
char label_text[MAX_OUTPUT_LINESIZE + 1];
int font_nr = FONT_TEXT_1;
+#if 1
+ int max_len_label_text = getMaxTextLength(pos, font_nr);
+#else
int max_len_label_text = SXSIZE / getFontWidth(font_nr);
+#endif
+#if 0
int text_width;
int lxpos, lypos;
+#endif
strncpy(label_text, leveldir_current->name, max_len_label_text);
label_text[max_len_label_text] = '\0';
#if 1
- text_width = getTextWidth(label_text, font_nr);
- lxpos = SX + menu.main.text.level_info_1.x - text_width / 2;
- lypos = SY + menu.main.text.level_info_1.y;
+ DrawTextSAligned(pos->x, pos->y, label_text, font_nr, pos->align);
#else
lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2;
lypos = SY + MICROLABEL1_YPOS;
-#endif
DrawText(lxpos, lypos, label_text, font_nr);
+#endif
}
game_status = last_game_status; /* restore current game status */
}
/* scroll preview level, if needed */
- if ((level_xsize > preview.xsize || level_ysize > preview.ysize) &&
+ if (preview.anim_mode != ANIM_NONE &&
+ (level_xsize > preview.xsize || level_ysize > preview.ysize) &&
DelayReached(&scroll_delay, scroll_delay_value))
{
switch (scroll_direction)