From fd2761fde6102017cd3be6b59c3be9140f96f703 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 22 Nov 2003 20:12:56 +0100 Subject: [PATCH] rnd-20031122-2-src --- src/conftime.h | 2 +- src/editor.c | 445 ++++++++++++++++++++++++++++++++++++++------- src/files.c | 4 +- src/libgame/text.c | 25 ++- src/libgame/text.h | 2 + src/main.c | 5 + src/main.h | 3 +- src/screens.c | 68 +++---- 8 files changed, 444 insertions(+), 110 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index a3595d1d..59183376 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-11-22 03:36]" +#define COMPILE_DATE_STRING "[2003-11-22 20:08]" diff --git a/src/editor.c b/src/editor.c index 20994b8d..26ec5f72 100644 --- a/src/editor.c +++ b/src/editor.c @@ -42,24 +42,41 @@ #define ED_WIN_MB_RIGHT_YPOS ED_WIN_MB_LEFT_YPOS /* values for the control window */ -#define ED_CTRL_BUTTONS_GFX_YPOS 236 -#define ED_CTRL_BUTTONS_ALT_GFX_YPOS 142 +#define ED_CTRL_NO_BUTTONS_GFX_XPOS 6 +#define ED_CTRL_NO_BUTTONS_GFX_YPOS 286 +#define ED_CTRL1_BUTTONS_GFX_YPOS 236 +#define ED_CTRL2_BUTTONS_GFX_YPOS 236 +#define ED_CTRL3_BUTTONS_GFX_YPOS 324 +#define ED_CTRL1_BUTTONS_ALT_GFX_YPOS 142 +#define ED_CTRL3_BUTTONS_ALT_GFX_YPOS 302 -#define ED_CTRL1_BUTTONS_HORIZ 4 -#define ED_CTRL1_BUTTONS_VERT 4 #define ED_CTRL1_BUTTON_XSIZE 22 #define ED_CTRL1_BUTTON_YSIZE 22 #define ED_CTRL1_BUTTONS_XPOS 6 #define ED_CTRL1_BUTTONS_YPOS 6 -#define ED_CTRL2_BUTTONS_HORIZ 3 -#define ED_CTRL2_BUTTONS_VERT 2 #define ED_CTRL2_BUTTON_XSIZE 30 #define ED_CTRL2_BUTTON_YSIZE 20 #define ED_CTRL2_BUTTONS_XPOS 5 #define ED_CTRL2_BUTTONS_YPOS 99 +#define ED_CTRL3_BUTTON_XSIZE 22 +#define ED_CTRL3_BUTTON_YSIZE 22 +#define ED_CTRL3_BUTTONS_XPOS 6 +#define ED_CTRL3_BUTTONS_YPOS 6 + +#define ED_CTRL1_BUTTONS_HORIZ 4 +#define ED_CTRL1_BUTTONS_VERT 4 +#define ED_CTRL2_BUTTONS_HORIZ 3 +#define ED_CTRL2_BUTTONS_VERT 2 +#define ED_CTRL3_BUTTONS_HORIZ 3 +#define ED_CTRL3_BUTTONS_VERT 1 + #define ED_NUM_CTRL1_BUTTONS (ED_CTRL1_BUTTONS_HORIZ * ED_CTRL1_BUTTONS_VERT) #define ED_NUM_CTRL2_BUTTONS (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT) -#define ED_NUM_CTRL_BUTTONS (ED_NUM_CTRL1_BUTTONS + ED_NUM_CTRL2_BUTTONS) +#define ED_NUM_CTRL3_BUTTONS (ED_CTRL3_BUTTONS_HORIZ * ED_CTRL3_BUTTONS_VERT) +#define ED_NUM_CTRL1_2_BUTTONS (ED_NUM_CTRL1_BUTTONS + ED_NUM_CTRL2_BUTTONS) +#define ED_NUM_CTRL_BUTTONS (ED_NUM_CTRL1_BUTTONS + \ + ED_NUM_CTRL2_BUTTONS + \ + ED_NUM_CTRL3_BUTTONS) /* values for the element list */ #define ED_ELEMENTLIST_XPOS 5 @@ -283,6 +300,7 @@ #define GADGET_ID_GRAB_BRUSH (GADGET_ID_TOOLBOX_FIRST + 13) #define GADGET_ID_WRAP_DOWN (GADGET_ID_TOOLBOX_FIRST + 14) #define GADGET_ID_PICK_ELEMENT (GADGET_ID_TOOLBOX_FIRST + 15) + #define GADGET_ID_UNDO (GADGET_ID_TOOLBOX_FIRST + 16) #define GADGET_ID_INFO (GADGET_ID_TOOLBOX_FIRST + 17) #define GADGET_ID_SAVE (GADGET_ID_TOOLBOX_FIRST + 18) @@ -290,8 +308,12 @@ #define GADGET_ID_TEST (GADGET_ID_TOOLBOX_FIRST + 20) #define GADGET_ID_EXIT (GADGET_ID_TOOLBOX_FIRST + 21) +#define GADGET_ID_CUSTOM_COPY_FROM (GADGET_ID_TOOLBOX_FIRST + 22) +#define GADGET_ID_CUSTOM_COPY_TO (GADGET_ID_TOOLBOX_FIRST + 23) +#define GADGET_ID_CUSTOM_EXCHANGE (GADGET_ID_TOOLBOX_FIRST + 24) + /* counter button identifiers */ -#define GADGET_ID_COUNTER_FIRST (GADGET_ID_TOOLBOX_FIRST + 22) +#define GADGET_ID_COUNTER_FIRST (GADGET_ID_TOOLBOX_FIRST + 25) #define GADGET_ID_SELECT_LEVEL_DOWN (GADGET_ID_COUNTER_FIRST + 0) #define GADGET_ID_SELECT_LEVEL_TEXT (GADGET_ID_COUNTER_FIRST + 1) @@ -736,28 +758,33 @@ static struct char *text; } control_info[ED_NUM_CTRL_BUTTONS] = { - { 's', "draw single items" }, - { 'd', "draw connected items" }, - { 'l', "draw lines" }, - { 'a', "draw arcs" }, - { 'r', "draw outline rectangles" }, - { 'R', "draw filled rectangles" }, - { '\0', "wrap (rotate) level up" }, - { 't', "enter text elements" }, - { 'f', "flood fill" }, - { '\0', "wrap (rotate) level left" }, - { '?', "properties of drawing element" }, - { '\0', "wrap (rotate) level right" }, - { '\0', "random element placement" }, - { 'b', "grab brush" }, - { '\0', "wrap (rotate) level down" }, - { ',', "pick drawing element" }, - { 'U', "undo last operation" }, - { 'I', "level properties" }, - { 'S', "save level" }, - { 'C', "clear level" }, - { 'T', "test level" }, - { 'E', "exit level editor" } + { 's', "draw single items" }, + { 'd', "draw connected items" }, + { 'l', "draw lines" }, + { 'a', "draw arcs" }, + { 'r', "draw outline rectangles" }, + { 'R', "draw filled rectangles" }, + { '\0', "wrap (rotate) level up" }, + { 't', "enter text elements" }, + { 'f', "flood fill" }, + { '\0', "wrap (rotate) level left" }, + { '?', "properties of drawing element" }, + { '\0', "wrap (rotate) level right" }, + { '\0', "random element placement" }, + { 'b', "grab brush" }, + { '\0', "wrap (rotate) level down" }, + { ',', "pick drawing element" }, + + { 'U', "undo last operation" }, + { 'I', "level properties" }, + { 'S', "save level" }, + { 'C', "clear level" }, + { 'T', "test level" }, + { 'E', "exit level editor" }, + + { '\0', "copy settings from other element" }, + { '\0', "copy settings to other element" }, + { '\0', "exchange settings with other element" }, }; static int random_placement_value = 10; @@ -1845,6 +1872,7 @@ static void RedrawDrawingElements(); static void DrawDrawingWindow(); static void DrawLevelInfoWindow(); static void DrawPropertiesWindow(); +static void UpdateCustomElementGraphicGadgets(); static boolean checkPropertiesConfig(); static void CopyLevelToUndoBuffer(int); static void HandleDrawingAreas(struct GadgetInfo *); @@ -3244,7 +3272,7 @@ static void CreateControlButtons() int i; /* create toolbox buttons */ - for (i=0; iwidth, gi->height, gi->x, gi->y); + + redraw_mask |= REDRAW_DOOR_3; + } + } + } +} + +static void MapLevelEditorToolboxDrawingGadgets() +{ + MapOrUnmapLevelEditorToolboxDrawingGadgets(TRUE); +} + +static void UnmapLevelEditorToolboxDrawingGadgets() +{ + MapOrUnmapLevelEditorToolboxDrawingGadgets(FALSE); +} + static void UnmapDrawingArea(int id) { UnmapGadget(level_editor_gadget[id]); } -void UnmapLevelEditorWindowGadgets() +static void UnmapLevelEditorWindowGadgets() { int i; - for (i=0; ix < SX + SXSIZE) UnmapGadget(level_editor_gadget[i]); } @@ -4474,7 +4593,7 @@ void UnmapLevelEditorGadgets() { int i; - for (i=0; idescription[i] = ei_from->description[i]; + + /* ---------- copy element properties ---------- */ + Properties[element_to][EP_BITFIELD_BASE] = + Properties[element_from][EP_BITFIELD_BASE]; + + /* ---------- copy custom property values ---------- */ + + ei_to->use_gfx_element = ei_from->use_gfx_element; + ei_to->gfx_element = ei_from->gfx_element; + + ei_to->collect_score = ei_from->collect_score; + ei_to->collect_count = ei_from->collect_count; + + ei_to->push_delay_fixed = ei_from->push_delay_fixed; + ei_to->push_delay_random = ei_from->push_delay_random; + ei_to->move_delay_fixed = ei_from->move_delay_fixed; + ei_to->move_delay_random = ei_from->move_delay_random; + + ei_to->move_pattern = ei_from->move_pattern; + ei_to->move_direction_initial = ei_from->move_direction_initial; + ei_to->move_stepsize = ei_from->move_stepsize; + + ei_to->slippery_type = ei_from->slippery_type; + + for(y=0; y<3; y++) + for(x=0; x<3; x++) + ei_to->content[x][y] = ei_from->content[x][y]; + + ei_to->num_change_pages = ei_from->num_change_pages; + setElementChangePages(ei_to, ei_to->num_change_pages); + + for (i=0; i < ei_to->num_change_pages; i++) + { + struct ElementChangeInfo *change_to = &ei_to->change_page[i]; + struct ElementChangeInfo *change_from = &ei_from->change_page[i]; + + /* always start with reliable default values */ + setElementChangeInfoToDefaults(change_to); + + change_to->events = change_from->events; + + change_to->target_element = change_from->target_element; + + change_to->delay_fixed = change_from->delay_fixed; + change_to->delay_random = change_from->delay_random; + change_to->delay_frames = change_from->delay_frames; + + change_to->trigger_element = change_from->trigger_element; + + change_to->explode = change_from->explode; + change_to->use_content = change_from->use_content; + change_to->only_complete = change_from->only_complete; + change_to->use_random_change = change_from->use_random_change; + + change_to->random = change_from->random; + change_to->power = change_from->power; + + for(y=0; y<3; y++) + for(x=0; x<3; x++) + change_to->content[x][y] = change_from->content[x][y]; + + change_to->can_change = change_from->can_change; + + change_to->sides = change_from->sides; + } + + /* mark this custom element as modified */ + ei_to->modified_settings = TRUE; +} + +static void replace_custom_element_in_settings(int element_from, + int element_to) +{ + int i, j, x, y; + + for (i=0; i < NUM_FILE_ELEMENTS; i++) + { + struct ElementInfo *ei = &element_info[i]; + + for(y=0; y<3; y++) + for(x=0; x<3; x++) + if (ei->content[x][y] == element_from) + ei->content[x][y] = element_to; + + for (j=0; j < ei->num_change_pages; j++) + { + struct ElementChangeInfo *change = &ei->change_page[j]; + + if (change->target_element == element_from) + change->target_element = element_to; + + if (change->trigger_element == element_from) + change->trigger_element = element_to; + + for(y=0; y<3; y++) + for(x=0; x<3; x++) + if (change->content[x][y] == element_from) + change->content[x][y] = element_to; + } + } +} + +static void replace_custom_element_in_playfield(int element_from, + int element_to) +{ + int x, y; + + for(x=0; x < lev_fieldx; x++) + for(y=0; y < lev_fieldy; y++) + if (Feld[x][y] == element_from) + Feld[x][y] = element_to; +} + +static void CopyCustomElement(int element_old, int element_new, int copy_mode) +{ + if (copy_mode == GADGET_ID_CUSTOM_COPY_FROM) + { + copy_custom_element_settings(element_new, element_old); + } + else if (copy_mode == GADGET_ID_CUSTOM_COPY_TO) + { + copy_custom_element_settings(element_old, element_new); + } + else if (copy_mode == GADGET_ID_CUSTOM_EXCHANGE) + { + copy_custom_element_settings(element_old, EL_DUMMY); + copy_custom_element_settings(element_new, element_old); + copy_custom_element_settings(EL_DUMMY, element_new); + + replace_custom_element_in_settings(element_old, EL_DUMMY); + replace_custom_element_in_settings(element_new, element_old); + replace_custom_element_in_settings(EL_DUMMY, element_new); + + replace_custom_element_in_playfield(element_old, EL_DUMMY); + replace_custom_element_in_playfield(element_new, element_old); + replace_custom_element_in_playfield(EL_DUMMY, element_new); + } + + UpdateCustomElementGraphicGadgets(); + DrawPropertiesWindow(); +} + static void CopyCustomElementPropertiesToEditor(int element) { int i; @@ -5071,7 +5341,9 @@ static void DrawDrawingWindow() SetMainBackgroundImage(IMG_UNDEFINED); ClearWindow(); + UnmapLevelEditorWindowGadgets(); + UnmapLevelEditorToolboxCustomGadgets(); AdjustDrawingAreaGadgets(); AdjustLevelScrollPosition(); @@ -5079,7 +5351,9 @@ static void DrawDrawingWindow() AdjustEditorScrollbar(GADGET_ID_SCROLL_VERTICAL); DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + MapMainDrawingArea(); + MapLevelEditorToolboxDrawingGadgets(); } static void DrawLevelInfoWindow() @@ -5502,7 +5776,7 @@ static void DrawPropertiesInfo() num_elements_in_level++; percentage = num_elements_in_level * 100.0 / (lev_fieldx * lev_fieldy); - DrawTextF(pad_x, pad_y + screen_line * font2_height, font1_nr, + DrawTextS(pad_x, pad_y + screen_line * font2_height, font1_nr, percentage_text); DrawTextF(pad_x + strlen(percentage_text) * font1_width, pad_y + screen_line++ * font2_height, font2_nr, @@ -5512,7 +5786,7 @@ static void DrawPropertiesInfo() /* ----- print standard properties of this element */ - DrawTextF(pad_x, pad_y + screen_line++ * font2_height, font1_nr, + DrawTextS(pad_x, pad_y + screen_line++ * font2_height, font1_nr, properties_text); for (i=0; properties[i].value != -1; i++) @@ -5520,13 +5794,13 @@ static void DrawPropertiesInfo() if (!HAS_PROPERTY(properties_element, properties[i].value)) continue; - DrawTextF(pad_x, pad_y + screen_line++ * font2_height, font2_nr, + DrawTextS(pad_x, pad_y + screen_line++ * font2_height, font2_nr, properties[i].text); num_standard_properties++; } if (num_standard_properties == 0) - DrawTextF(pad_x + strlen(properties_text) * font1_width, + DrawTextS(pad_x + strlen(properties_text) * font1_width, pad_y + (screen_line - 1) * font2_height, font2_nr, "none"); screen_line++; @@ -5777,7 +6051,7 @@ static void DrawElementName(int x, int y, int element) char buffer[max_chars_per_line + 1]; if (strlen(element_name) <= max_chars_per_line) - DrawTextF(x, y, font_nr, element_name); + DrawTextS(x, y, font_nr, element_name); else { int next_pos = max_chars_per_line; @@ -5802,12 +6076,12 @@ static void DrawElementName(int x, int y, int element) } } - DrawTextF(x, y - font_height / 2, font_nr, buffer); + DrawTextS(x, y - font_height / 2, font_nr, buffer); strncpy(buffer, &element_name[next_pos], max_chars_per_line); buffer[max_chars_per_line] = '\0'; - DrawTextF(x, y + font_height / 2, font_nr, buffer); + DrawTextS(x, y + font_height / 2, font_nr, buffer); } } @@ -5827,6 +6101,11 @@ static void DrawPropertiesWindow() CopyCustomElementPropertiesToEditor(properties_element); UnmapLevelEditorWindowGadgets(); + UnmapLevelEditorToolboxDrawingGadgets(); + UnmapLevelEditorToolboxCustomGadgets(); + + if (IS_CUSTOM_ELEMENT(properties_element)) + MapLevelEditorToolboxCustomGadgets(); SetMainBackgroundImage(IMG_BACKGROUND_EDITOR); ClearWindow(); @@ -6993,6 +7272,9 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) static void HandleControlButtons(struct GadgetInfo *gi) { + static int last_level_drawing_function = GADGET_ID_SINGLE_ITEMS; + static int last_edit_mode = ED_MODE_DRAWING; + static int last_custom_copy_mode = -1; int id = gi->custom_id; int button = gi->event.button; int step = BUTTON_STEPSIZE(button); @@ -7002,8 +7284,11 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (edit_mode == ED_MODE_DRAWING && drawing_function == GADGET_ID_TEXT) DrawLevelText(0, 0, 0, TEXT_END); - if (id < ED_NUM_CTRL1_BUTTONS && id != GADGET_ID_PROPERTIES && - id != GADGET_ID_PICK_ELEMENT && edit_mode != ED_MODE_DRAWING && + if (id < ED_NUM_CTRL1_BUTTONS && + id != GADGET_ID_SINGLE_ITEMS && + id != GADGET_ID_PROPERTIES && + id != GADGET_ID_PICK_ELEMENT && + edit_mode != ED_MODE_DRAWING && drawing_function != GADGET_ID_PICK_ELEMENT && !(GetKeyModState() & KMOD_Control)) { @@ -7165,14 +7450,28 @@ static void HandleControlButtons(struct GadgetInfo *gi) properties_element = new_element; DrawPropertiesWindow(); edit_mode = ED_MODE_PROPERTIES; + + last_level_drawing_function = drawing_function; + ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS], + MB_LEFTBUTTON); } else { DrawDrawingWindow(); edit_mode = ED_MODE_DRAWING; + + ClickOnGadget(level_editor_gadget[last_level_drawing_function], + MB_LEFTBUTTON); } break; + case GADGET_ID_CUSTOM_COPY_FROM: + case GADGET_ID_CUSTOM_COPY_TO: + case GADGET_ID_CUSTOM_EXCHANGE: + last_custom_copy_mode = id; + last_drawing_function = drawing_function; + break; + case GADGET_ID_UNDO: if (undo_buffer_steps == 0) { @@ -7199,13 +7498,16 @@ static void HandleControlButtons(struct GadgetInfo *gi) case GADGET_ID_INFO: if (edit_mode != ED_MODE_INFO) { - DrawLevelInfoWindow(); + last_edit_mode = edit_mode; edit_mode = ED_MODE_INFO; + + DrawLevelInfoWindow(); } else { - DrawDrawingWindow(); - edit_mode = ED_MODE_DRAWING; + edit_mode = last_edit_mode; + + DrawEditModeWindow(); } break; @@ -7289,6 +7591,19 @@ static void HandleControlButtons(struct GadgetInfo *gi) int element_position = id - GADGET_ID_ELEMENTLIST_FIRST; int new_element = editor_elements[element_position + element_shift]; + if (last_custom_copy_mode != -1) + { + CopyCustomElement(properties_element, new_element, + last_custom_copy_mode); + + ClickOnGadget(level_editor_gadget[last_drawing_function], + MB_LEFTBUTTON); + + last_custom_copy_mode = -1; + + break; + } + PickDrawingElement(button, new_element); if (!stick_element_properties_window && @@ -7624,25 +7939,25 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) else { if (id == GADGET_ID_AMOEBA_CONTENT) - DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, + DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "Amoeba content"); else if (id == GADGET_ID_CUSTOM_GRAPHIC) - DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, + DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "Custom graphic element"); else if (id == GADGET_ID_CUSTOM_CONTENT) DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "Custom element content position: %d, %d", sx, sy); else if (id == GADGET_ID_CUSTOM_CHANGE_TARGET) - DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, + DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "New element after change"); else if (id == GADGET_ID_CUSTOM_CHANGE_CONTENT) - DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, + DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "New extended elements after change"); else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER) - DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, + DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "Other element triggering change"); else if (id == GADGET_ID_RANDOM_BACKGROUND) - DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, + DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "Random placement background"); else if (id >= GADGET_ID_ELEMENT_CONTENT_0 && id <= GADGET_ID_ELEMENT_CONTENT_7) diff --git a/src/files.c b/src/files.c index 51e2c44d..bc12226d 100644 --- a/src/files.c +++ b/src/files.c @@ -614,7 +614,7 @@ static int LoadLevel_CUS3(FILE *file, int chunk_size, struct LevelInfo *level) { Error(ERR_WARN, "invalid custom element number %d", element); - element = EL_DEFAULT; /* dummy element used for artwork config */ + element = EL_DUMMY; } for(j=0; j MAX_OUTPUT_LINESIZE) - Error(ERR_EXIT, "string too long in DrawTextFCentered() -- aborting"); + Error(ERR_EXIT, "string too long in DrawTextF() -- aborting"); - DrawText(gfx.sx + (gfx.sxsize - getTextWidth(buffer, font_nr)) / 2, - gfx.sy + y, buffer, font_nr); + DrawText(gfx.sx + x, gfx.sy + y, buffer, font_nr); } -void DrawTextF(int x, int y, int font_nr, char *format, ...) +void DrawTextFCentered(int y, int font_nr, char *format, ...) { char buffer[MAX_OUTPUT_LINESIZE + 1]; va_list ap; @@ -217,9 +216,21 @@ void DrawTextF(int x, int y, int font_nr, char *format, ...) va_end(ap); if (strlen(buffer) > MAX_OUTPUT_LINESIZE) - Error(ERR_EXIT, "string too long in DrawTextF() -- aborting"); + Error(ERR_EXIT, "string too long in DrawTextFCentered() -- aborting"); - DrawText(gfx.sx + x, gfx.sy + y, buffer, font_nr); + DrawText(gfx.sx + (gfx.sxsize - getTextWidth(buffer, font_nr)) / 2, + gfx.sy + y, buffer, font_nr); +} + +void DrawTextS(int x, int y, int font_nr, char *text) +{ + DrawText(gfx.sx + x, gfx.sy + y, text, font_nr); +} + +void DrawTextSCentered(int y, int font_nr, char *text) +{ + DrawText(gfx.sx + (gfx.sxsize - getTextWidth(text, font_nr)) / 2, + gfx.sy + y, text, font_nr); } void DrawText(int x, int y, char *text, int font_nr) diff --git a/src/libgame/text.h b/src/libgame/text.h index dc29e283..611cf2be 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -64,6 +64,8 @@ void getFontCharSource(int, char, Bitmap **, int *, int *); void DrawInitText(char *, int, int); void DrawTextF(int, int, int, char *, ...); void DrawTextFCentered(int, int, char *, ...); +void DrawTextS(int, int, int, char *); +void DrawTextSCentered(int, int, char *); void DrawText(int, int, char *, int); void DrawTextExt(DrawBuffer *, int, int, char *, int, int); void DrawTextToTextArea(int, int, char *, int, int, int, int, int); diff --git a/src/main.c b/src/main.c index 4032019b..f7b2a41e 100644 --- a/src/main.c +++ b/src/main.c @@ -3666,6 +3666,11 @@ struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] = "sb_default", "-" }, + { + "dummy", + "dummy", + "-" + }, /* keyword to stop parser: "ELEMENT_INFO_END" <-- do not change! */ diff --git a/src/main.h b/src/main.h index ebcfb39d..627d5291 100644 --- a/src/main.h +++ b/src/main.h @@ -887,8 +887,9 @@ #define EL_BD_DEFAULT (EL_FIRST_DUMMY + 22) #define EL_SP_DEFAULT (EL_FIRST_DUMMY + 23) #define EL_SB_DEFAULT (EL_FIRST_DUMMY + 24) +#define EL_DUMMY (EL_FIRST_DUMMY + 25) -#define MAX_NUM_ELEMENTS (EL_FIRST_DUMMY + 25) +#define MAX_NUM_ELEMENTS (EL_FIRST_DUMMY + 26) /* values for graphics/sounds action types */ diff --git a/src/screens.c b/src/screens.c index 328f6893..078ebb23 100644 --- a/src/screens.c +++ b/src/screens.c @@ -291,9 +291,9 @@ void DrawMainMenu() if (leveldir_current->readonly) { - DrawTextF(mSX + level_width + 9 * 32 - 2, + DrawTextS(mSX + level_width + 9 * 32 - 2, mSY + 3 * 32 + 1 - 7, FONT_TEXT_3, "READ"); - DrawTextF(mSX + level_width + 9 * 32 - 2, + DrawTextS(mSX + level_width + 9 * 32 - 2, mSY + 3 * 32 + 1 + 7, FONT_TEXT_3, "ONLY"); } @@ -994,7 +994,7 @@ void DrawHelpScreenElText(int start) ClearWindow(); DrawHeadline(); - DrawTextFCentered(100, FONT_TEXT_1, "The game elements:"); + DrawTextSCentered(100, FONT_TEXT_1, "The game elements:"); for(i=start; i < start + MAX_HELPSCREEN_ELS && i < num_helpscreen_els; i++) { @@ -1005,7 +1005,7 @@ void DrawHelpScreenElText(int start) helpscreen_eltext[i][1], FONT_TEXT_2); } - DrawTextFCentered(ybottom, FONT_TEXT_4, + DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for next page"); } @@ -1023,28 +1023,28 @@ void DrawHelpScreenMusicText(int num) ClearWindow(); DrawHeadline(); - DrawTextFCentered(100, FONT_TEXT_1, "The game background music loops:"); + DrawTextSCentered(100, FONT_TEXT_1, "The game background music loops:"); #if 1 - DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from"); + DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from"); DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, "\"%s\"", list->title); - DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_2, "by"); + DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "by"); DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3, "%s", list->artist); - DrawTextFCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album"); + DrawTextSCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album"); DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_3, "\"%s\"", list->album); #else - DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from"); + DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from"); DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, "\"%s\"", helpscreen_music[num][0]); - DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_2, "by"); + DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "by"); DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3, "%s", helpscreen_music[num][1]); - DrawTextFCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album"); + DrawTextSCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album"); DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_3, "\"%s\"", helpscreen_music[num][2]); #endif - DrawTextFCentered(ybottom, FONT_TEXT_4, + DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for next page"); #if 0 @@ -1061,16 +1061,16 @@ void DrawHelpScreenCreditsText() ClearWindow(); DrawHeadline(); - DrawTextFCentered(100, FONT_TEXT_1, "Credits:"); - DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2, "DOS port of the game:"); - DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, "Guido Schulz"); - DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_2, "Additional toons:"); - DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3, "Karl Hörnell"); - DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_2, + DrawTextSCentered(100, FONT_TEXT_1, "Credits:"); + DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "DOS port of the game:"); + DrawTextSCentered(ystart + 1 * ystep, FONT_TEXT_3, "Guido Schulz"); + DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "Additional toons:"); + DrawTextSCentered(ystart + 3 * ystep, FONT_TEXT_3, "Karl Hörnell"); + DrawTextSCentered(ystart + 5 * ystep, FONT_TEXT_2, "...and many thanks to all contributors"); - DrawTextFCentered(ystart + 6 * ystep, FONT_TEXT_2, "of new levels!"); + DrawTextSCentered(ystart + 6 * ystep, FONT_TEXT_2, "of new levels!"); - DrawTextFCentered(ybottom, FONT_TEXT_4, + DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for next page"); } @@ -1082,33 +1082,33 @@ void DrawHelpScreenContactText() ClearWindow(); DrawHeadline(); - DrawTextFCentered(100, FONT_TEXT_1, "Program information:"); + DrawTextSCentered(100, FONT_TEXT_1, "Program information:"); - DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2, + DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "This game is Freeware!"); - DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_2, + DrawTextSCentered(ystart + 1 * ystep, FONT_TEXT_2, "If you like it, send e-mail to:"); - DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_3, + DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_3, "info@artsoft.org"); - DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_2, + DrawTextSCentered(ystart + 3 * ystep, FONT_TEXT_2, "or SnailMail to:"); - DrawTextFCentered(ystart + 4 * ystep + 0, FONT_TEXT_3, + DrawTextSCentered(ystart + 4 * ystep + 0, FONT_TEXT_3, "Holger Schemel"); - DrawTextFCentered(ystart + 4 * ystep + 20, FONT_TEXT_3, + DrawTextSCentered(ystart + 4 * ystep + 20, FONT_TEXT_3, "Detmolder Strasse 189"); - DrawTextFCentered(ystart + 4 * ystep + 40, FONT_TEXT_3, + DrawTextSCentered(ystart + 4 * ystep + 40, FONT_TEXT_3, "33604 Bielefeld"); - DrawTextFCentered(ystart + 4 * ystep + 60, FONT_TEXT_3, + DrawTextSCentered(ystart + 4 * ystep + 60, FONT_TEXT_3, "Germany"); - DrawTextFCentered(ystart + 7 * ystep, FONT_TEXT_2, + DrawTextSCentered(ystart + 7 * ystep, FONT_TEXT_2, "If you have created new levels,"); - DrawTextFCentered(ystart + 8 * ystep, FONT_TEXT_2, + DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_2, "send them to me to include them!"); - DrawTextFCentered(ystart + 9 * ystep, FONT_TEXT_2, + DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2, ":-)"); - DrawTextFCentered(ybottom, FONT_TEXT_4, + DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for main menu"); } @@ -2261,7 +2261,7 @@ void DrawSetupScreen_Input() #if 0 DeactivateJoystickForCalibration(); - DrawTextFCentered(SYSIZE - 20, FONT_TEXT_4, + DrawTextSCentered(SYSIZE - 20, FONT_TEXT_4, "Joysticks deactivated on this screen"); #endif -- 2.34.1