From ca3d1b424a90490fb8da2a3bcfe58a4ab206d8a1 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 3 Jul 2003 23:55:55 +0200 Subject: [PATCH] rnd-20030703-3-src --- src/conftime.h | 2 +- src/editor.c | 36 ++++++++++++++++++++++++++++++------ src/files.c | 19 ++++++++++++++++--- src/main.h | 8 +++++--- 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index a37bb49e..ec4b799c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-07-03 13:40]" +#define COMPILE_DATE_STRING "[2003-07-03 21:19]" diff --git a/src/editor.c b/src/editor.c index a0872472..4696db8b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -366,9 +366,10 @@ #define GADGET_ID_LEVEL_NAME (GADGET_ID_TEXT_INPUT_FIRST + 0) #define GADGET_ID_LEVEL_AUTHOR (GADGET_ID_TEXT_INPUT_FIRST + 1) +#define GADGET_ID_ELEMENT_NAME (GADGET_ID_TEXT_INPUT_FIRST + 2) /* selectbox identifiers */ -#define GADGET_ID_SELECTBOX_FIRST (GADGET_ID_TEXT_INPUT_FIRST + 2) +#define GADGET_ID_SELECTBOX_FIRST (GADGET_ID_TEXT_INPUT_FIRST + 3) #define GADGET_ID_CUSTOM_WALK_TO_ACTION (GADGET_ID_SELECTBOX_FIRST + 0) #define GADGET_ID_CUSTOM_CONSISTENCY (GADGET_ID_SELECTBOX_FIRST + 1) @@ -512,8 +513,9 @@ /* values for text input gadgets */ #define ED_TEXTINPUT_ID_LEVEL_NAME 0 #define ED_TEXTINPUT_ID_LEVEL_AUTHOR 1 +#define ED_TEXTINPUT_ID_ELEMENT_NAME 2 -#define ED_NUM_TEXTINPUT 2 +#define ED_NUM_TEXTINPUT 3 #define ED_TEXTINPUT_ID_LEVEL_FIRST ED_TEXTINPUT_ID_LEVEL_NAME #define ED_TEXTINPUT_ID_LEVEL_LAST ED_TEXTINPUT_ID_LEVEL_AUTHOR @@ -881,6 +883,13 @@ static struct MAX_LEVEL_AUTHOR_LEN, level.author, "Author" + }, + { + 5 * MINI_TILEX, 5 * MINI_TILEY - ED_BORDER_SIZE, + GADGET_ID_ELEMENT_NAME, + MAX_ELEMENT_NAME_LEN - 2, /* currently 2 chars less editable */ + custom_element.description, + NULL } }; @@ -2377,6 +2386,8 @@ static char *getElementInfoText(int element) { if (element_info[element].custom_description != NULL) info_text = element_info[element].custom_description; + else if (strlen(element_info[element].description) > 0) + info_text = element_info[element].description; else if (element_info[element].editor_description != NULL) info_text = element_info[element].editor_description; } @@ -3422,9 +3433,12 @@ static void MapTextInputGadget(int id) int x = textinput_info[id].x + xoffset_above; int y = textinput_info[id].y + yoffset_above; - sprintf(infotext, "%s:", textinput_info[id].infotext); - infotext[max_infotext_len] = '\0'; - DrawTextF(x, y, FONT_TEXT_1, infotext); + if (textinput_info[id].infotext) + { + sprintf(infotext, "%s:", textinput_info[id].infotext); + infotext[max_infotext_len] = '\0'; + DrawTextF(x, y, FONT_TEXT_1, infotext); + } ModifyGadget(level_editor_gadget[textinput_info[id].gadget_id], GDI_TEXT_VALUE, textinput_info[id].value, GDI_END); @@ -4811,6 +4825,9 @@ static void DrawPropertiesConfig() /* draw drawing area gadgets */ DrawCustomContentArea(); + + /* draw text input gadgets */ + MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME); } } @@ -5683,6 +5700,8 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) ModifyEditorElementList(); RedrawDrawingElements(); + DrawPropertiesAdvancedDrawingAreas(); + FrameCounter = 0; /* restart animation frame counter */ } else if (id == GADGET_ID_CUSTOM_CONTENT) @@ -5902,7 +5921,12 @@ static void HandleCounterButtons(struct GadgetInfo *gi) static void HandleTextInputGadgets(struct GadgetInfo *gi) { - strcpy(textinput_info[gi->custom_type_id].value, gi->text.value); + int type_id = gi->custom_type_id; + + strcpy(textinput_info[type_id].value, gi->text.value); + + if (type_id == ED_TEXTINPUT_ID_ELEMENT_NAME) + CopyCustomElementPropertiesToGame(properties_element); } static void HandleSelectboxGadgets(struct GadgetInfo *gi) diff --git a/src/files.c b/src/files.c index e0538955..787013ba 100644 --- a/src/files.c +++ b/src/files.c @@ -30,7 +30,7 @@ #define LEVEL_HEADER_UNUSED 13 /* unused level header bytes */ #define LEVEL_CHUNK_CNT2_SIZE 160 /* size of level CNT2 chunk */ #define LEVEL_CHUNK_CNT2_UNUSED 11 /* unused CNT2 chunk bytes */ -#define LEVEL_CPART_CUS3_SIZE 102 /* size of CUS3 chunk part */ +#define LEVEL_CPART_CUS3_SIZE 134 /* size of CUS3 chunk part */ #define LEVEL_CPART_CUS3_UNUSED 16 /* unused CUS3 bytes / part */ #define TAPE_HEADER_SIZE 20 /* size of tape file header */ #define TAPE_HEADER_UNUSED 3 /* unused tape header bytes */ @@ -105,6 +105,11 @@ static void setLevelInfoToDefaults() { int element = EL_CUSTOM_START + i; + for(j=0; j