#define GADGET_ID_CUSTOM_COPY (GADGET_ID_TOOLBOX_FIRST + 25)
#define GADGET_ID_CUSTOM_PASTE (GADGET_ID_TOOLBOX_FIRST + 26)
-/* counter button identifiers */
+/* counter gadget identifiers */
#define GADGET_ID_COUNTER_FIRST (GADGET_ID_TOOLBOX_FIRST + 27)
#define GADGET_ID_SELECT_LEVEL_DOWN (GADGET_ID_COUNTER_FIRST + 0)
#define GADGET_ID_CAN_FALL_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 20)
#define GADGET_ID_CAN_MOVE_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 21)
#define GADGET_ID_DONT_COLLIDE_WITH (GADGET_ID_CHECKBUTTON_FIRST + 22)
-#define GADGET_ID_CUSTOM_INDESTRUCTIBLE (GADGET_ID_CHECKBUTTON_FIRST + 23)
-#define GADGET_ID_CUSTOM_CAN_EXPLODE (GADGET_ID_CHECKBUTTON_FIRST + 24)
-#define GADGET_ID_CUSTOM_EXPLODE_FIRE (GADGET_ID_CHECKBUTTON_FIRST + 25)
-#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 26)
-#define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 27)
-#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 28)
-#define GADGET_ID_CUSTOM_DEADLY (GADGET_ID_CHECKBUTTON_FIRST + 29)
-#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 30)
-#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 31)
-#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 32)
-#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 33)
-#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 34)
-#define GADGET_ID_CUSTOM_GRAV_REACHABLE (GADGET_ID_CHECKBUTTON_FIRST + 35)
-#define GADGET_ID_CUSTOM_USE_LAST_VALUE (GADGET_ID_CHECKBUTTON_FIRST + 36)
-#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 37)
-#define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 38)
-#define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 39)
-#define GADGET_ID_CHANGE_USE_CONTENT (GADGET_ID_CHECKBUTTON_FIRST + 40)
-#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 41)
-#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 42)
-#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 43)
-#define GADGET_ID_CHANGE_HAS_ACTION (GADGET_ID_CHECKBUTTON_FIRST + 44)
-#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 45)
-#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 46)
-#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 47)
+#define GADGET_ID_ENVELOPE_AUTOWRAP (GADGET_ID_CHECKBUTTON_FIRST + 23)
+#define GADGET_ID_ENVELOPE_CENTERED (GADGET_ID_CHECKBUTTON_FIRST + 24)
+#define GADGET_ID_CUSTOM_INDESTRUCTIBLE (GADGET_ID_CHECKBUTTON_FIRST + 25)
+#define GADGET_ID_CUSTOM_CAN_EXPLODE (GADGET_ID_CHECKBUTTON_FIRST + 26)
+#define GADGET_ID_CUSTOM_EXPLODE_FIRE (GADGET_ID_CHECKBUTTON_FIRST + 27)
+#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 28)
+#define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 29)
+#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 30)
+#define GADGET_ID_CUSTOM_DEADLY (GADGET_ID_CHECKBUTTON_FIRST + 31)
+#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 32)
+#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 33)
+#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 34)
+#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 35)
+#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 36)
+#define GADGET_ID_CUSTOM_GRAV_REACHABLE (GADGET_ID_CHECKBUTTON_FIRST + 37)
+#define GADGET_ID_CUSTOM_USE_LAST_VALUE (GADGET_ID_CHECKBUTTON_FIRST + 38)
+#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 39)
+#define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 40)
+#define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 41)
+#define GADGET_ID_CHANGE_USE_CONTENT (GADGET_ID_CHECKBUTTON_FIRST + 42)
+#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 43)
+#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 44)
+#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 45)
+#define GADGET_ID_CHANGE_HAS_ACTION (GADGET_ID_CHECKBUTTON_FIRST + 46)
+#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 47)
+#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 48)
+#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 49)
/* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 48)
+#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 50)
#define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \
ED_NUM_ELEMENTLIST_BUTTONS - 1)
#define ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID 18
#define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID 19
#define ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH 20
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 21
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE 22
-#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE 23
-#define ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE 24
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE 25
-#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 26
-#define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE 27
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE 28
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 29
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 30
-#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 31
-#define ED_CHECKBUTTON_ID_CUSTOM_DEADLY 32
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE 33
-#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE 34
-#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 35
-#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 36
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 37
-#define ED_CHECKBUTTON_ID_CHANGE_DELAY 38
-#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 39
-#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT 40
-#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 41
-#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 42
-#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 43
-#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 44
-#define ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION 45
-
-#define ED_NUM_CHECKBUTTONS 46
+#define ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP 21
+#define ED_CHECKBUTTON_ID_ENVELOPE_CENTERED 22
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 23
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE 24
+#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE 25
+#define ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE 26
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE 27
+#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 28
+#define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE 29
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE 30
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 31
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 32
+#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 33
+#define ED_CHECKBUTTON_ID_CUSTOM_DEADLY 34
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE 35
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE 36
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 37
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 38
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 39
+#define ED_CHECKBUTTON_ID_CHANGE_DELAY 40
+#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 41
+#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT 42
+#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 43
+#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 44
+#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 45
+#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 46
+#define ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION 47
+
+#define ED_NUM_CHECKBUTTONS 48
#define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
#define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
MIN_ENVELOPE_XSIZE, MAX_ENVELOPE_XSIZE,
GADGET_ID_ENVELOPE_XSIZE_DOWN, GADGET_ID_ENVELOPE_XSIZE_UP,
GADGET_ID_ENVELOPE_XSIZE_TEXT, GADGET_ID_NONE,
- NULL,
+ NULL, /* will be set when used */
NULL, NULL, "width",
},
{
MIN_ENVELOPE_YSIZE, MAX_ENVELOPE_YSIZE,
GADGET_ID_ENVELOPE_YSIZE_DOWN, GADGET_ID_ENVELOPE_YSIZE_UP,
GADGET_ID_ENVELOPE_YSIZE_TEXT, GADGET_ID_ENVELOPE_XSIZE_UP,
- NULL,
+ NULL, /* will be set when used */
NULL, " ", "height",
},
} textarea_info[ED_NUM_TEXTAREAS] =
{
{
- ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
+ ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
GADGET_ID_ENVELOPE_INFO,
MAX_ENVELOPE_XSIZE, MAX_ENVELOPE_YSIZE,
NULL,
- "Envelope Info:", "Envelope Info"
+ "Envelope Content:", "Envelope Content"
}
};
NULL,
"deadly when colliding with", "element is deadly when hitting player"
},
+ {
+ ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
+ GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_NONE,
+ &level.envelope[0].autowrap,
+ NULL,
+ "auto-wrap", "automatically wrap envelope text"
+ },
+ {
+ -1, ED_ELEMENT_SETTINGS_YPOS(1),
+ GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_ENVELOPE_AUTOWRAP,
+ &level.envelope[0].centered,
+ " ",
+ "centered", "automatically center envelope text"
+ },
/* ---------- element settings: configure 1 (custom elements) ----------- */
/* !!! add separate "use existing element sound" !!! */
#if 0
- NULL, "use graphic/sound of element:", "use existing graphic and sound"
+ NULL,
+ "use graphic/sound of element:", "use existing graphic and sound"
#else
- NULL, "use graphic of element:", "use existing element graphic"
+ NULL,
+ "use graphic of element:", "use existing element graphic"
#endif
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
GADGET_ID_CUSTOM_USE_TEMPLATE, GADGET_ID_NONE,
&level.use_custom_template,
- NULL, "use template", "use template for custom properties"
+ NULL,
+ "use template", "use template for custom properties"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
GADGET_ID_CUSTOM_ACCESSIBLE, GADGET_ID_NONE,
&custom_element_properties[EP_ACCESSIBLE],
- NULL, NULL, "player can walk to or pass this field"
+ NULL,
+ NULL, "player can walk to or pass this field"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(10),
GADGET_ID_CUSTOM_GRAV_REACHABLE, GADGET_ID_NONE,
&custom_element_properties[EP_GRAVITY_REACHABLE],
- NULL, "reachable despite gravity", "player can walk/dig despite gravity"
+ NULL,
+ "reachable despite gravity", "player can walk/dig despite gravity"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(13),
GADGET_ID_CUSTOM_USE_LAST_VALUE, GADGET_ID_NONE,
&custom_element.use_last_ce_value,
- NULL, "use last CE value after change", "use last CE value after change"
+ NULL,
+ "use last CE value after change", "use last CE value after change"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(5),
GADGET_ID_CUSTOM_WALK_TO_OBJECT, GADGET_ID_NONE,
&custom_element_properties[EP_WALK_TO_OBJECT],
- NULL, NULL, "player can dig/collect/push element"
+ NULL,
+ NULL, "player can dig/collect/push element"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(9),
GADGET_ID_CUSTOM_INDESTRUCTIBLE, GADGET_ID_NONE,
&custom_element_properties[EP_INDESTRUCTIBLE],
- NULL, "indestructible", "element is indestructible"
+ NULL,
+ "indestructible", "element is indestructible"
},
/* ---------- element settings: configure 2 (custom elements) ----------- */
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
GADGET_ID_CUSTOM_CAN_MOVE, GADGET_ID_NONE,
&custom_element_properties[EP_CAN_MOVE],
- NULL, NULL, "element can move with some pattern"
+ NULL,
+ NULL, "element can move with some pattern"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(7),
GADGET_ID_CUSTOM_CAN_FALL, GADGET_ID_NONE,
&custom_element_properties[EP_CAN_FALL],
- NULL, "can fall", "element can fall down"
+ NULL,
+ "can fall", "element can fall down"
},
{
-1, ED_ELEMENT_SETTINGS_YPOS(7),
GADGET_ID_CUSTOM_CAN_SMASH, GADGET_ID_CUSTOM_CAN_FALL,
&custom_element_properties[EP_CAN_SMASH],
- " ", NULL, "element can smash other elements"
+ " ",
+ NULL, "element can smash other elements"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(8),
GADGET_ID_CUSTOM_SLIPPERY, GADGET_ID_NONE,
&custom_element_properties[EP_SLIPPERY],
- NULL, NULL, "other elements can fall down from it"
+ NULL,
+ NULL, "other elements can fall down from it"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(9),
GADGET_ID_CUSTOM_DEADLY, GADGET_ID_NONE,
&custom_element_properties[EP_DEADLY],
- NULL, NULL, "element can kill the player"
+ NULL,
+ NULL, "element can kill the player"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(10),
GADGET_ID_CUSTOM_CAN_EXPLODE, GADGET_ID_NONE,
&custom_element_properties[EP_CAN_EXPLODE],
- NULL, NULL, "element can explode"
+ NULL,
+ NULL, "element can explode"
},
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(11),
GADGET_ID_CUSTOM_EXPLODE_FIRE, GADGET_ID_NONE,
&custom_element_properties[EP_EXPLODES_BY_FIRE],
- NULL, "by fire", "element can explode by fire/explosion"
+ NULL,
+ "by fire", "element can explode by fire/explosion"
},
{
-1, ED_ELEMENT_SETTINGS_YPOS(11),
GADGET_ID_CUSTOM_EXPLODE_SMASH, GADGET_ID_CUSTOM_EXPLODE_FIRE,
&custom_element_properties[EP_EXPLODES_SMASHED],
- " ", "smashed", "element can explode when smashed"
+ " ",
+ "smashed", "element can explode when smashed"
},
{
-1, ED_ELEMENT_SETTINGS_YPOS(11),
GADGET_ID_CUSTOM_EXPLODE_IMPACT, GADGET_ID_CUSTOM_EXPLODE_SMASH,
&custom_element_properties[EP_EXPLODES_IMPACT],
- " ", "impact", "element can explode on impact"
+ " ",
+ "impact", "element can explode on impact"
},
/* ---------- element settings: advanced (custom elements) --------------- */
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
GADGET_ID_CUSTOM_CAN_CHANGE, GADGET_ID_NONE,
&custom_element_change.can_change,
- NULL, "element changes to:", "change element on specified condition"
+ NULL,
+ "element changes to:", "change element on specified condition"
},
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(2),
GADGET_ID_CHANGE_DELAY, GADGET_ID_NONE,
&custom_element_change_events[CE_DELAY],
- NULL, NULL, "element changes after delay"
+ NULL,
+ NULL, "element changes after delay"
},
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(4),
GADGET_ID_CHANGE_BY_DIRECT_ACT, GADGET_ID_NONE,
&custom_element_change_events[CE_BY_DIRECT_ACTION],
- NULL, NULL, "element changes by direct action"
+ NULL,
+ NULL, "element changes by direct action"
},
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(5),
GADGET_ID_CHANGE_BY_OTHER_ACT, GADGET_ID_NONE,
&custom_element_change_events[CE_BY_OTHER_ACTION],
- NULL, NULL, "element changes by other element"
+ NULL,
+ NULL, "element changes by other element"
},
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(8),
GADGET_ID_CHANGE_USE_EXPLOSION, GADGET_ID_NONE,
&custom_element_change.explode,
- NULL, "explode instead of change", "element explodes instead of change"
+ NULL,
+ "explode instead of change", "element explodes instead of change"
},
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(9),
GADGET_ID_CHANGE_USE_CONTENT, GADGET_ID_NONE,
&custom_element_change.use_target_content,
- NULL, "use extended change target:","element changes to more elements"
+ NULL,
+ "use extended change target:", "element changes to more elements"
},
{
ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(11),
GADGET_ID_CHANGE_ONLY_COMPLETE, GADGET_ID_NONE,
&custom_element_change.only_if_complete,
- NULL, "replace all or nothing", "only replace when all can be changed"
+ NULL,
+ "replace all or nothing", "only replace when all can be changed"
},
{
ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(12),
GADGET_ID_CHANGE_USE_RANDOM, GADGET_ID_NONE,
&custom_element_change.use_random_replace,
- NULL, NULL, "use percentage for random replace"
+ NULL,
+ NULL, "use percentage for random replace"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(13),
GADGET_ID_CHANGE_HAS_ACTION, GADGET_ID_NONE,
&custom_element_change.has_action,
- NULL, NULL, "execute action on specified condition"
+ NULL,
+ NULL, "execute action on specified condition"
},
};
{
int counter1_id = ED_COUNTER_ID_ENVELOPE_XSIZE;
int counter2_id = ED_COUNTER_ID_ENVELOPE_YSIZE;
+ int button1_id = ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP;
+ int button2_id = ED_CHECKBUTTON_ID_ENVELOPE_CENTERED;
int envelope_nr = properties_element - EL_ENVELOPE_1;
counterbutton_info[counter1_id].value = &level.envelope[envelope_nr].xsize;
counterbutton_info[counter2_id].value = &level.envelope[envelope_nr].ysize;
+ checkbutton_info[button1_id].value = &level.envelope[envelope_nr].autowrap;
+ checkbutton_info[button2_id].value = &level.envelope[envelope_nr].centered;
+
/* display counter to choose size of envelope text area */
- MapCounterButtons(ED_COUNTER_ID_ENVELOPE_XSIZE);
- MapCounterButtons(ED_COUNTER_ID_ENVELOPE_YSIZE);
+ MapCounterButtons(counter1_id);
+ MapCounterButtons(counter2_id);
+
+ /* display checkbuttons to choose auto-wrap and alignment properties */
+ MapCheckbuttonGadget(button1_id);
+ MapCheckbuttonGadget(button2_id);
DrawEnvelopeTextArea(envelope_nr);
}
*y = font->src_y + (font_pos / font->num_chars_per_line) * font->height;
}
+
+/* ========================================================================= */
+/* simple text drawing functions */
+/* ========================================================================= */
+
void DrawInitText(char *text, int ypos, int font_nr)
{
if (window != NULL &&
}
}
-void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length,
- int area_xsize, int area_ysize, int mask_mode)
+
+/* ========================================================================= */
+/* text buffer drawing functions */
+/* ========================================================================= */
+
+char *GetTextBufferFromFile(char *filename, int max_lines)
+{
+ FILE *file;
+ char *buffer;
+ int num_lines = 0;
+
+ if (filename == NULL)
+ return NULL;
+
+ if (!(file = fopen(filename, MODE_READ)))
+ return NULL;
+
+ buffer = checked_calloc(1); /* start with valid, but empty text buffer */
+
+ while (!feof(file) && num_lines < max_lines)
+ {
+ char line[MAX_LINE_LEN];
+
+ /* read next line of input file */
+ if (!fgets(line, MAX_LINE_LEN, file))
+ break;
+
+ buffer = checked_realloc(buffer, strlen(buffer) + strlen(line) + 1);
+
+ strcat(buffer, line);
+
+ num_lines++;
+ }
+
+ fclose(file);
+
+ return buffer;
+}
+
+void DrawTextToTextArea_OLD(int x, int y, char *text, int font_nr, int line_length,
+ int area_xsize, int area_ysize, int mask_mode)
{
int area_line = 0;
int font_height = getFontHeight(font_nr);
return buffer_filled;
}
-void DrawTextWrapped(int x, int y, char *text, int font_nr, int line_length,
- int max_lines)
+#if 0
+void DrawTextWrapped_OLD(int x, int y, char *text, int font_nr, int line_length,
+ int max_lines)
{
char *text_ptr = text;
- char buffer[line_length + 1];
- int buffer_len;
int current_line = 0;
int font_height = getFontHeight(font_nr);
while (*text_ptr && current_line < max_lines)
{
+ char buffer[line_length + 1];
+ int buffer_len = 0;
+
buffer[0] = '\0';
- buffer_len = 0;
RenderLineToBuffer(&text_ptr, buffer, &buffer_len, TRUE, line_length);
current_line++;
}
}
+#endif
-int DrawTextFromFile(int x, int y, char *filename, int font_nr,
- int line_length, int max_lines, boolean rewrap)
+#if 0
+int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr,
+ int line_length, int max_lines, boolean wrap_text)
{
int font_height = getFontHeight(font_nr);
char line[MAX_LINE_LEN];
#if 1
boolean buffer_filled;
- if (rewrap)
+ if (wrap_text)
{
buffer_filled = RenderLineToBuffer(&line_ptr,
buffer, &buffer_len,
return current_line;
}
+#endif
+
+int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
+ int line_length, int cut_length, int max_lines,
+ int mask_mode, boolean formatted, boolean centered)
+{
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ char buffer[line_length + 1];
+ int buffer_len;
+ int current_line = 0;
+
+ if (text_buffer == NULL || *text_buffer == '\0')
+ return 0;
+
+ if (current_line >= max_lines)
+ return 0;
+
+ if (cut_length == -1)
+ cut_length = line_length;
+
+ buffer[0] = '\0';
+ buffer_len = 0;
+
+ while (*text_buffer && current_line < max_lines)
+ {
+ char line[MAX_LINE_LEN + 1];
+ char *line_ptr;
+ boolean last_line_was_empty = TRUE;
+ int num_line_chars = (formatted ? MAX_LINE_LEN : line_length);
+ int i;
+
+ /* copy next line from text buffer to line buffer (nearly fgets() style) */
+ for (i = 0; i < num_line_chars && *text_buffer; i++)
+ if ((line[i] = *text_buffer++) == '\n')
+ break;
+ line[i] = '\0';
+
+ /* skip comments (lines directly beginning with '#') */
+ if (line[0] == '#')
+ continue;
+
+ /* cut trailing newline and carriage return from input line */
+ for (line_ptr = line; *line_ptr; line_ptr++)
+ {
+ if (*line_ptr == '\n' || *line_ptr == '\r')
+ {
+ *line_ptr = '\0';
+ break;
+ }
+ }
+
+ if (strlen(line) == 0) /* special case: force empty line */
+ strcpy(line, "\n");
+
+ line_ptr = line;
+
+ while (*line_ptr && current_line < max_lines)
+ {
+ boolean buffer_filled;
+
+ if (formatted)
+ {
+ buffer_filled = RenderLineToBuffer(&line_ptr,
+ buffer, &buffer_len,
+ last_line_was_empty,
+ line_length);
+ }
+ else
+ {
+ if (strlen(line_ptr) <= line_length)
+ {
+ buffer_len = strlen(line_ptr);
+ strcpy(buffer, line_ptr);
+ }
+ else
+ {
+ buffer_len = line_length;
+ strncpy(buffer, line_ptr, line_length);
+ }
+
+ buffer[buffer_len] = '\0';
+ line_ptr += buffer_len;
+
+ buffer_filled = TRUE;
+ }
+
+ if (buffer_filled)
+ {
+ int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
+ int offset_xsize =
+ (centered ? font_width * (line_length - buffer_len) / 2 : 0);
+ int final_cut_length = MAX(0, cut_length - offset_chars);
+ int xx = x + offset_xsize;
+
+ buffer[final_cut_length] = '\0';
+
+ if (mask_mode != -1)
+ DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
+ font_nr, mask_mode);
+ else
+ DrawText(xx, y + current_line * font_height, buffer, font_nr);
+
+ current_line++;
+
+ last_line_was_empty = (buffer_len == 0);
+
+ buffer[0] = '\0';
+ buffer_len = 0;
+ }
+ }
+ }
+
+ if (buffer_len > 0 && current_line < max_lines)
+ {
+ int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
+ int offset_xsize =
+ (centered ? font_width * (line_length - buffer_len) / 2 : 0);
+ int final_cut_length = MAX(0, cut_length - offset_chars);
+ int xx = x + offset_xsize;
+
+ buffer[final_cut_length] = '\0';
+
+ if (mask_mode != -1)
+ DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
+ font_nr, mask_mode);
+ else
+ DrawText(xx, y + current_line * font_height, buffer, font_nr);
+
+ current_line++;
+ }
+
+ return current_line;
+}
+
+int DrawTextFromFile(int x, int y, char *filename, int font_nr,
+ int line_length, int max_lines, boolean formatted)
+{
+ char *text_buffer = GetTextBufferFromFile(filename, 1000);
+ int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
+ line_length, -1, max_lines, -1,
+ formatted, FALSE);
+ checked_free(text_buffer);
+
+ return num_lines_printed;
+}
+
+void DrawTextWrapped(int x, int y, char *text, int font_nr, int line_length,
+ int max_lines)
+{
+ DrawTextBuffer(x, y, text, font_nr, line_length, -1, max_lines, -1, TRUE,
+ FALSE);
+}
+
+void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length,
+ int cut_length, int max_lines, int mask_mode)
+{
+ DrawTextBuffer(x, y, text, font_nr, line_length, cut_length, max_lines,
+ mask_mode, FALSE, FALSE);
+}