{ MV_TURNING_LEFT, "turning left" },
{ MV_TURNING_RIGHT, "turning right" },
{ MV_WHEN_PUSHED, "when pushed" },
+#if 0
+ { MV_MAZE_RUNNER, "maze runner style" },
+ { MV_MAZE_HUNTER, "maze hunter style" },
+#endif
{ -1, NULL }
};
{ CE_LEFT_BY_PLAYER, "left by player ..." },
{ CE_DROPPED_BY_PLAYER, "dropped by player" },
{ CE_SWITCHED, "switched ..." },
- { CE_COLLISION, "collision ..." },
- { CE_IMPACT, "impact" },
- { CE_SMASHED, "smashed" },
+#if 0
+ { CE_COLLISION_ACTIVE, "hitting something ..." },
+ { CE_COLLISION_PASSIVE, "hit by something ..." },
+#else
+ { CE_COLLISION_ACTIVE, "collision ..." },
+#endif
+ { CE_IMPACT, "impact (on something)" },
+ { CE_SMASHED, "smashed (from above)" },
{ -1, NULL }
};
{ CE_OTHER_GETS_COLLECTED, "player collects" },
{ CE_OTHER_GETS_DROPPED, "player drops" },
{ CE_OTHER_IS_TOUCHING, "touching ..." },
+#if 0
+ { CE_OTHER_IS_COLL_ACTIVE, "hitting ..." },
+ { CE_OTHER_IS_COLL_PASSIVE, "hit by ..." },
+#endif
{ CE_OTHER_IS_SWITCHING, "switch of ..." },
{ CE_OTHER_IS_CHANGING, "change of" },
{ CE_OTHER_IS_EXPLODING, "explosion of" },
{ CH_SIDE_BOTTOM, "bottom side" },
{ CH_SIDE_LEFT_RIGHT, "left/right side" },
{ CH_SIDE_TOP_BOTTOM, "top/bottom side" },
- { CH_SIDE_ANY, "all sides" },
+ { CH_SIDE_ANY, "any side" },
{ -1, NULL }
};
EL_BD_FIREFLY,
EL_MOLE_LEFT,
- EL_EMPTY,
+ EL_MAZE_RUNNER,
EL_MOLE_RIGHT,
EL_PACMAN,
&num_editor_el_user_defined);
/* initialize list of empty elements (used for padding, if needed) */
- for (i=0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
editor_el_empty[i] = EL_EMPTY;
/* do some sanity checks for each element from element list */
- for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
{
- for (j=0; j < *editor_elements_info[i].element_list_size; j++)
+ for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
{
int element = (*editor_elements_info[i].element_list)[j];
use_el_empty = FALSE;
/* determine size of element list */
- for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
{
if (*editor_elements_info[i].setup_value)
{
editor_elements = checked_malloc(num_editor_elements * sizeof(int));
/* fill element list */
- for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
{
if (*editor_elements_info[i].setup_value)
{
if (setup.editor.el_headlines)
- for (j=0; j < *editor_elements_info[i].headline_list_size; j++)
+ for (j = 0; j < *editor_elements_info[i].headline_list_size; j++)
editor_elements[pos++] = (*editor_elements_info[i].headline_list)[j];
- for (j=0; j < *editor_elements_info[i].element_list_size; j++)
+ for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
editor_elements[pos++] = (*editor_elements_info[i].element_list)[j];
}
}
boolean *stop = &setup.editor.el_user_defined;
int i, j;
- for (i=0; editor_elements_info[i].setup_value != stop; i++)
+ for (i = 0; editor_elements_info[i].setup_value != stop; i++)
{
- for (j=0; j < *editor_elements_info[i].headline_list_size; j++)
+ for (j = 0; j < *editor_elements_info[i].headline_list_size; j++)
{
int element = (*editor_elements_info[i].headline_list)[j];
if (j > 0)
printf("#\n");
- for (j=0; j < *editor_elements_info[i].element_list_size; j++)
+ for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
{
int element = (*editor_elements_info[i].element_list)[j];
if (last_setup_value_headlines != setup.editor.el_headlines)
initialization_needed = TRUE;
- for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
if (editor_elements_info[i].last_setup_value !=
*editor_elements_info[i].setup_value)
initialization_needed = TRUE;
/* store current setup values for next invocation of this function */
last_setup_value_headlines = setup.editor.el_headlines;
- for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
editor_elements_info[i].last_setup_value =
*editor_elements_info[i].setup_value;
getMiniGraphicSource(border_graphic, &src_bitmap, &src_x, &src_y);
- for (y=0; y < num_mini_tiley; y++)
- for (x=0; x < num_mini_tilex; x++)
+ for (y = 0; y < num_mini_tiley; y++)
+ for (x = 0; x < num_mini_tilex; x++)
BlitBitmap(src_bitmap, drawto, src_x, src_y, MINI_TILEX, MINI_TILEY,
dest_x - MINI_TILEX / 2 + x * MINI_TILEX,
dest_y - MINI_TILEY / 2 + y * MINI_TILEY);
DrawMiniGraphicExt(drawto, gi->x, gi->y,
el2edimg(custom_element.gfx_element));
else if (id == ED_DRAWING_ID_CUSTOM_CONTENT)
- for (y=0; y<3; y++)
- for (x=0; x<3; x++)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
DrawMiniGraphicExt(drawto,
gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY,
el2edimg(custom_element.content[x][y]));
DrawMiniGraphicExt(drawto, gi->x, gi->y,
el2edimg(custom_element_change.target_element));
else if (id == ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT)
- for (y=0; y < 3; y++)
- for (x=0; x < 3; x++)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
DrawMiniGraphicExt(drawto,
gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY,
el2edimg(custom_element_change.content[x][y]));
{
int nr = id - ED_DRAWING_ID_ELEMENT_CONTENT_0;
- for (y=0; y < 3; y++)
- for (x=0; x < 3; x++)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
DrawMiniGraphicExt(drawto,
gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY,
el2edimg(level.yamyam_content[nr][x][y]));
if (dx)
{
x = (dx == 1 ? 0 : ed_fieldx - 1);
- for(y=0; y<ed_fieldy; y++)
+ for (y = 0; y < ed_fieldy; y++)
DrawMiniElementOrWall(x, y, from_x, from_y);
}
else if (dy)
{
y = (dy == 1 ? 0 : ed_fieldy - 1);
- for(x=0; x<ed_fieldx; x++)
+ for (x = 0; x < ed_fieldx; x++)
DrawMiniElementOrWall(x, y, from_x, from_y);
}
int i;
/* create toolbox buttons */
- for (i=0; i < ED_NUM_CTRL_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
{
int id = i;
int width, height;
}
/* create buttons for scrolling of drawing area and element list */
- for (i=0; i<ED_NUM_SCROLLBUTTONS; i++)
+ for (i = 0; i < ED_NUM_SCROLLBUTTONS; i++)
{
int id = scrollbutton_info[i].gadget_id;
int x, y, width, height;
}
/* create buttons for element list */
- for (i=0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
Bitmap *deco_bitmap;
int deco_x, deco_y, deco_xpos, deco_ypos;
int max_infotext_len = getMaxInfoTextLength();
int i;
- for (i=0; i<ED_NUM_COUNTERBUTTONS; i++)
+ for (i = 0; i < ED_NUM_COUNTERBUTTONS; i++)
{
int j;
int x = SX + counterbutton_info[i].x; /* down count button */
if (counterbutton_info[i].text_left != NULL)
x += getTextWidthForGadget(counterbutton_info[i].text_left);
- for (j=0; j<2; j++)
+ for (j = 0; j < 2; j++)
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
{
int i;
- for (i=0; i<ED_NUM_DRAWING_AREAS; i++)
+ for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
{
struct GadgetInfo *gi;
unsigned long event_mask;
int max_infotext_len = getMaxInfoTextLength();
int i;
- for (i=0; i<ED_NUM_TEXTINPUT; i++)
+ for (i = 0; i < ED_NUM_TEXTINPUT; i++)
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x, gd_y;
int max_infotext_len = getMaxInfoTextLength();
int i;
- for (i=0; i<ED_NUM_TEXTAREAS; i++)
+ for (i = 0; i < ED_NUM_TEXTAREAS; i++)
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x, gd_y;
int max_infotext_len = getMaxInfoTextLength();
int i, j;
- for (i=0; i<ED_NUM_SELECTBOX; i++)
+ for (i = 0; i < ED_NUM_SELECTBOX; i++)
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x, gd_y;
implicitely cast -1 to an unsigned integer value!) */
selectbox_info[i].size = 0;
- for (j=0; selectbox_info[i].options[j].text != NULL; j++)
+ for (j = 0; selectbox_info[i].options[j].text != NULL; j++)
if (strlen(selectbox_info[i].options[j].text) > selectbox_info[i].size)
selectbox_info[i].size = strlen(selectbox_info[i].options[j].text);
int max_infotext_len = getMaxInfoTextLength();
int i;
- for (i=0; i<ED_NUM_TEXTBUTTONS; i++)
+ for (i = 0; i < ED_NUM_TEXTBUTTONS; i++)
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x1, gd_x2, gd_y1, gd_y2;
int i;
/* create buttons for scrolling of drawing area and element list */
- for (i=0; i < ED_NUM_GRAPHICBUTTONS; i++)
+ for (i = 0; i < ED_NUM_GRAPHICBUTTONS; i++)
{
int id = graphicbutton_info[i].gadget_id;
int gd_x1, gd_x2, gd_y1, gd_y2;
{
int i;
- for (i=0; i<ED_NUM_SCROLLBARS; i++)
+ for (i = 0; i < ED_NUM_SCROLLBARS; i++)
{
int id = scrollbar_info[i].gadget_id;
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
gd_x4 = DOOR_GFX_PAGEX3 + ED_CHECKBUTTON_CHECKED_XPOS;
gd_y = DOOR_GFX_PAGEY1 + ED_RADIOBUTTON_YPOS;
- for (i=0; i<ED_NUM_CHECKBUTTONS; i++)
+ for (i = 0; i < ED_NUM_CHECKBUTTONS; i++)
{
int id = checkbutton_info[i].gadget_id;
int x = SX + checkbutton_info[i].x;
gd_x4 = DOOR_GFX_PAGEX3 + ED_CHECKBUTTON_CHECKED_XPOS;
gd_y = DOOR_GFX_PAGEY1 + ED_RADIOBUTTON_YPOS;
- for (i=0; i<ED_NUM_RADIOBUTTONS; i++)
+ for (i = 0; i < ED_NUM_RADIOBUTTONS; i++)
{
int id = radiobutton_info[i].gadget_id;
int x = SX + radiobutton_info[i].x;
{
int i;
- for (i=0; i < NUM_EDITOR_GADGETS; i++)
+ for (i = 0; i < NUM_EDITOR_GADGETS; i++)
FreeGadget(level_editor_gadget[i]);
}
int i;
/* map toolbox buttons (excluding special CE toolbox buttons) */
- for (i=0; i < ED_NUM_CTRL1_2_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_CTRL1_2_BUTTONS; i++)
MapGadget(level_editor_gadget[i]);
/* map buttons to select elements */
- for (i=0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
MapGadget(level_editor_gadget[GADGET_ID_ELEMENTLIST_FIRST + i]);
MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL]);
MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_UP]);
boolean no_vertical_scrollbar = (lev_fieldy + 2 <= ed_fieldy);
int i;
- for (i=ED_SCROLLBUTTON_ID_AREA_FIRST; i<=ED_SCROLLBUTTON_ID_AREA_LAST; i++)
+ for (i=ED_SCROLLBUTTON_ID_AREA_FIRST; i <= ED_SCROLLBUTTON_ID_AREA_LAST; i++)
{
if (((i == ED_SCROLLBUTTON_ID_AREA_LEFT ||
i == ED_SCROLLBUTTON_ID_AREA_RIGHT) &&
MapGadget(level_editor_gadget[scrollbutton_info[i].gadget_id]);
}
- for (i=ED_SCROLLBAR_ID_AREA_FIRST; i<=ED_SCROLLBAR_ID_AREA_LAST; i++)
+ for (i = ED_SCROLLBAR_ID_AREA_FIRST; i <= ED_SCROLLBAR_ID_AREA_LAST; i++)
{
if ((i == ED_SCROLLBAR_ID_AREA_HORIZONTAL && no_horizontal_scrollbar) ||
(i == ED_SCROLLBAR_ID_AREA_VERTICAL && no_vertical_scrollbar))
{
int i;
- for (i=0; i < ED_NUM_CTRL_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
{
if (i == GADGET_ID_CUSTOM_COPY_FROM ||
i == GADGET_ID_CUSTOM_COPY_TO ||
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int i;
- for (i=0; i < ED_NUM_CTRL1_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_CTRL1_BUTTONS; i++)
{
if (i != GADGET_ID_SINGLE_ITEMS &&
i != GADGET_ID_PROPERTIES &&
{
int i;
- for (i=0; i < NUM_EDITOR_GADGETS; i++)
+ for (i = 0; i < NUM_EDITOR_GADGETS; i++)
if (level_editor_gadget[i]->x < SX + SXSIZE)
UnmapGadget(level_editor_gadget[i]);
}
{
int i;
- for (i=0; i < NUM_EDITOR_GADGETS; i++)
+ for (i = 0; i < NUM_EDITOR_GADGETS; i++)
UnmapGadget(level_editor_gadget[i]);
}
boolean level_changed = FALSE;
int x, y;
- for(y=0; y<lev_fieldy; y++)
- for(x=0; x<lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
if (Feld[x][y] != level.field[x][y])
level_changed = TRUE;
boolean player_found = FALSE;
int x, y;
- for(y=0; y<lev_fieldy; y++)
- for(x=0; x<lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
if (Feld[x][y] == EL_PLAYER_1 ||
Feld[x][y] == EL_SP_MURPHY)
player_found = TRUE;
{
int x, y;
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
dst[x][y] = src[x][y];
}
int new_index_value = 0;
int i;
- for(i=0; selectbox_info[selectbox_id].options[i].text != NULL; i++)
+ for (i = 0; selectbox_info[selectbox_id].options[i].text != NULL; i++)
if (selectbox_info[selectbox_id].options[i].value == new_value)
new_index_value = i;
int i, x, y;
/* ---------- copy element description ---------- */
- for (i=0; i < MAX_ELEMENT_NAME_LEN + 1; i++)
+ for (i = 0; i < MAX_ELEMENT_NAME_LEN + 1; i++)
ei_to->description[i] = ei_from->description[i];
/* ---------- copy element properties ---------- */
ei_to->slippery_type = ei_from->slippery_type;
- for(y=0; y<3; y++)
- for(x=0; x<3; x++)
+ 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;
change_to->random = change_from->random;
change_to->power = change_from->power;
- for(y=0; y<3; y++)
- for(x=0; x<3; x++)
+ 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;
{
int i, j, x, y;
- for (i=0; i < NUM_FILE_ELEMENTS; i++)
+ 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++)
+ 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;
if (change->trigger_element == element_from)
change->trigger_element = element_to;
- for(y=0; y<3; y++)
- for(x=0; x<3; x++)
+ 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;
}
{
int x, y;
- for(x=0; x < lev_fieldx; x++)
- for(y=0; y < lev_fieldy; 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;
}
int current_change_page = element_info[element].current_change_page;
/* dynamically (re)build selectbox for selecting change page */
- for (i=0; i < element_info[element].num_change_pages; i++)
+ for (i = 0; i < element_info[element].num_change_pages; i++)
{
sprintf(options_change_page_strings[i], "%d", i + 1);
custom_element_change = *element_info[element].change;
/* needed to initially set selectbox value variables to reliable defaults */
- for (i=0; i < ED_NUM_SELECTBOX; i++)
+ for (i = 0; i < ED_NUM_SELECTBOX; i++)
setSelectboxValue(i, *selectbox_info[i].value);
- for (i=0; i < NUM_ELEMENT_PROPERTIES; i++)
+ for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++)
custom_element_properties[i] = HAS_PROPERTY(element, i);
- for (i=0; i < NUM_CHANGE_EVENTS; i++)
+ for (i = 0; i < NUM_CHANGE_EVENTS; i++)
custom_element_change_events[i] = HAS_CHANGE_EVENT(element, i);
/* ---------- element settings: configure (custom elements) ------------- */
HAS_CHANGE_EVENT(element, CE_LEFT_BY_PLAYER) ? CE_LEFT_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_DROPPED_BY_PLAYER) ? CE_DROPPED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_SWITCHED) ? CE_SWITCHED :
- HAS_CHANGE_EVENT(element, CE_COLLISION) ? CE_COLLISION :
+ HAS_CHANGE_EVENT(element, CE_COLLISION_ACTIVE) ? CE_COLLISION_ACTIVE :
+ HAS_CHANGE_EVENT(element, CE_COLLISION_PASSIVE) ? CE_COLLISION_PASSIVE :
HAS_CHANGE_EVENT(element, CE_IMPACT) ? CE_IMPACT :
HAS_CHANGE_EVENT(element, CE_SMASHED) ? CE_SMASHED :
custom_element_change.direct_action);
HAS_CHANGE_EVENT(element, CE_OTHER_GETS_COLLECTED) ? CE_OTHER_GETS_COLLECTED :
HAS_CHANGE_EVENT(element, CE_OTHER_GETS_DROPPED) ? CE_OTHER_GETS_DROPPED :
HAS_CHANGE_EVENT(element, CE_OTHER_IS_TOUCHING) ? CE_OTHER_IS_TOUCHING :
+ HAS_CHANGE_EVENT(element, CE_OTHER_IS_COLL_ACTIVE) ? CE_OTHER_IS_COLL_ACTIVE :
+ HAS_CHANGE_EVENT(element, CE_OTHER_IS_COLL_PASSIVE) ? CE_OTHER_IS_COLL_PASSIVE :
HAS_CHANGE_EVENT(element, CE_OTHER_IS_SWITCHING) ? CE_OTHER_IS_SWITCHING :
HAS_CHANGE_EVENT(element, CE_OTHER_IS_CHANGING) ? CE_OTHER_IS_CHANGING :
HAS_CHANGE_EVENT(element, CE_OTHER_IS_EXPLODING) ? CE_OTHER_IS_EXPLODING :
if (level.use_custom_template)
{
- if (Request("Copy and modify level tem- plate ?", REQ_ASK))
+ if (Request("Copy and modify level template ?", REQ_ASK))
{
level.use_custom_template = FALSE;
ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE],
custom_element_change_events[CE_LEFT_BY_PLAYER] = FALSE;
custom_element_change_events[CE_DROPPED_BY_PLAYER] = FALSE;
custom_element_change_events[CE_SWITCHED] = FALSE;
- custom_element_change_events[CE_COLLISION] = FALSE;
+ custom_element_change_events[CE_COLLISION_ACTIVE] = FALSE;
+ custom_element_change_events[CE_COLLISION_PASSIVE] = FALSE;
custom_element_change_events[CE_IMPACT] = FALSE;
custom_element_change_events[CE_SMASHED] = FALSE;
custom_element_change_events[custom_element_change.direct_action] =
custom_element_change_events[CE_OTHER_GETS_COLLECTED] = FALSE;
custom_element_change_events[CE_OTHER_GETS_DROPPED] = FALSE;
custom_element_change_events[CE_OTHER_IS_TOUCHING] = FALSE;
+ custom_element_change_events[CE_OTHER_IS_COLL_ACTIVE] = FALSE;
+ custom_element_change_events[CE_OTHER_IS_COLL_PASSIVE] = FALSE;
custom_element_change_events[CE_OTHER_IS_SWITCHING] = FALSE;
custom_element_change_events[CE_OTHER_IS_CHANGING] = FALSE;
custom_element_change_events[CE_OTHER_IS_EXPLODING] = FALSE;
custom_element_change_events[custom_element_change.other_action] =
custom_element_change_events[CE_BY_OTHER_ACTION];
- for (i=0; i < NUM_ELEMENT_PROPERTIES; i++)
+ for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++)
SET_PROPERTY(element, i, custom_element_properties[i]);
- for (i=0; i < NUM_CHANGE_EVENTS; i++)
+ for (i = 0; i < NUM_CHANGE_EVENTS; i++)
SET_CHANGE_EVENT(element, i, custom_element_change_events[i]);
/* copy change events also to special level editor variable */
{
int i;
- for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
int gadget_id = GADGET_ID_ELEMENTLIST_FIRST + i;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
"Editor Settings", FONT_TITLE_1);
/* draw counter gadgets */
- for (i=ED_COUNTER_ID_LEVEL_FIRST; i<=ED_COUNTER_ID_LEVEL_LAST; i++)
+ for (i = ED_COUNTER_ID_LEVEL_FIRST; i <= ED_COUNTER_ID_LEVEL_LAST; i++)
MapCounterButtons(i);
/* draw checkbutton gadgets */
- for (i=ED_CHECKBUTTON_ID_LEVEL_FIRST; i<=ED_CHECKBUTTON_ID_LEVEL_LAST; i++)
+ for (i=ED_CHECKBUTTON_ID_LEVEL_FIRST; i <= ED_CHECKBUTTON_ID_LEVEL_LAST; i++)
MapCheckbuttonGadget(i);
/* draw radiobutton gadgets */
- for (i=ED_RADIOBUTTON_ID_LEVEL_FIRST; i<=ED_RADIOBUTTON_ID_LEVEL_LAST; i++)
+ for (i=ED_RADIOBUTTON_ID_LEVEL_FIRST; i <= ED_RADIOBUTTON_ID_LEVEL_LAST; i++)
MapRadiobuttonGadget(i);
/* draw text input gadgets */
- for (i=ED_TEXTINPUT_ID_LEVEL_FIRST; i<=ED_TEXTINPUT_ID_LEVEL_LAST; i++)
+ for (i = ED_TEXTINPUT_ID_LEVEL_FIRST; i <= ED_TEXTINPUT_ID_LEVEL_LAST; i++)
MapTextInputGadget(i);
/* draw drawing area */
/* display counter to choose number of element content areas */
MapCounterButtons(ED_COUNTER_ID_ELEMENT_CONTENT);
- for (i=0; i < MAX_ELEMENT_CONTENTS; i++)
+ for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
{
int id = ED_DRAWING_ID_ELEMENT_CONTENT_0 + i;
int font_height = getFontHeight(FONT_TEXT_1);
return NULL;
}
-static boolean PrintInfoText(char *text, int font_nr, int screen_line)
+static boolean PrintInfoText(char *text, int font_nr, int start_line)
{
int font_height = getFontHeight(font_nr);
int pad_x = ED_SETTINGS_XPOS(0);
int sy = SY + pad_y;
int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
- if (screen_line >= max_lines_per_screen)
+ if (start_line >= max_lines_per_screen)
return FALSE;
- DrawText(sx, sy + screen_line * font_height, text, font_nr);
+ DrawText(sx, sy + start_line * font_height, text, font_nr);
return TRUE;
}
-static int PrintElementDescriptionFromFile(char *filename, int screen_line)
+#if 1
+
+static int PrintElementDescriptionFromFile(char *filename, int start_line)
+{
+ int font_nr = FONT_TEXT_2;
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ int pad_x = ED_SETTINGS_XPOS(0);
+ int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+ int sx = SX + pad_x;
+ int sy = SY + pad_y + start_line * font_height;
+ int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
+ int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+
+ return DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line,
+ max_lines_per_screen);
+}
+
+#else
+
+static int PrintElementDescriptionFromFile(char *filename, int start_line)
{
int font_nr = FONT_TEXT_2;
int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
int pad_x = ED_SETTINGS_XPOS(0);
+ int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+ int sx = SX + pad_x;
+ int sy = SY + pad_y;
int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
+ int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+ int current_line = start_line;
char line[MAX_LINE_LEN];
char buffer[max_chars_per_line + 1];
int buffer_len;
- int lines_printed = 0;
FILE *file;
+ if (current_line >= max_lines_per_screen)
+ return 0;
+
if (filename == NULL)
return 0;
buffer[0] = '\0';
buffer_len = 0;
- while(!feof(file))
+ while (!feof(file) && current_line < max_lines_per_screen)
{
- char *line_ptr, *word_ptr;
+ char *line_ptr;
boolean last_line_was_empty = TRUE;
/* read next line of input file */
if (strlen(line) == 0) /* special case: force empty line */
strcpy(line, "\n");
- word_ptr = line;
+ line_ptr = line;
- while (*word_ptr)
+ while (*line_ptr && current_line < max_lines_per_screen)
{
- boolean print_buffer = FALSE;
- int word_len;
-
- /* skip leading whitespaces */
- while (*word_ptr == ' ' || *word_ptr == '\t')
- word_ptr++;
-
- line_ptr = word_ptr;
- word_len = 0;
-
- /* look for end of next word */
- while (*line_ptr != ' ' && *line_ptr != '\t' && *line_ptr != '\0')
- {
- line_ptr++;
- word_len++;
- }
-
- if (word_len == 0)
- {
- continue;
- }
- else if (*word_ptr == '\n') /* special case: force empty line */
- {
- if (buffer_len == 0)
- word_ptr++;
-
- /* prevent printing of multiple empty lines */
- if (buffer_len > 0 || !last_line_was_empty)
- print_buffer = TRUE;
- }
- else if (word_len < max_chars_per_line - buffer_len)
- {
- /* word fits into text buffer -- add word */
-
- if (buffer_len > 0)
- buffer[buffer_len++] = ' ';
-
- strncpy(&buffer[buffer_len], word_ptr, word_len);
- buffer_len += word_len;
- buffer[buffer_len] = '\0';
- word_ptr += word_len;
- }
- else if (buffer_len > 0)
- {
- /* not enough space left for word in text buffer -- print buffer */
-
- print_buffer = TRUE;
- }
- else
+ boolean buffer_filled = RenderLineToBuffer(&line_ptr,
+ buffer, &buffer_len,
+ last_line_was_empty,
+ max_chars_per_line);
+ if (buffer_filled)
{
- /* word does not fit at all into empty text buffer -- cut word */
-
- strncpy(buffer, word_ptr, max_chars_per_line);
- buffer[max_chars_per_line] = '\0';
- word_ptr += max_chars_per_line;
- print_buffer = TRUE;
- }
-
- if (print_buffer)
- {
- if (!PrintInfoText(buffer, font_nr, screen_line + lines_printed))
- return lines_printed;
+ DrawText(sx, sy + current_line * font_height, buffer, font_nr);
+ current_line++;
last_line_was_empty = (buffer_len == 0);
- lines_printed++;
buffer[0] = '\0';
buffer_len = 0;
- print_buffer = FALSE;
}
}
}
fclose(file);
- if (buffer_len > 0)
- if (PrintInfoText(buffer, font_nr, screen_line + lines_printed))
- lines_printed++;
+ if (buffer_len > 0 && current_line < max_lines_per_screen)
+ {
+ DrawText(sx, sy + current_line * font_height, buffer, font_nr);
+ current_line++;
+ }
- return lines_printed;
+ return (current_line - start_line);
}
+#endif
+
static void DrawPropertiesTabulatorGadgets()
{
struct GadgetInfo *gd_gi = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
if (IS_CUSTOM_ELEMENT(properties_element))
id_last = ED_TEXTBUTTON_ID_PROPERTIES_ADVANCED;
- for (i=id_first; i <= id_last; i++)
+ for (i = id_first; i <= id_last; i++)
{
int gadget_id = textbutton_info[i].gadget_id;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
/* ----- print number of elements / percentage of this element in level */
num_elements_in_level = 0;
- for (y=0; y<lev_fieldy; y++)
- for (x=0; x<lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
if (Feld[x][y] == properties_element)
num_elements_in_level++;
percentage = num_elements_in_level * 100.0 / (lev_fieldx * lev_fieldy);
DrawTextS(pad_x, pad_y + screen_line++ * font2_height, font1_nr,
properties_text);
- for (i=0; properties[i].value != -1; i++)
+ for (i = 0; properties[i].value != -1; i++)
{
if (!HAS_PROPERTY(properties_element, properties[i].value))
continue;
HAS_CONTENT(properties_element))
return TRUE;
else
- for (i=0; elements_with_counter[i].element != -1; i++)
+ for (i = 0; elements_with_counter[i].element != -1; i++)
if (elements_with_counter[i].element == properties_element)
return TRUE;
}
/* check if there are elements where a score can be chosen for */
- for (i=0; elements_with_counter[i].element != -1; i++)
+ for (i = 0; elements_with_counter[i].element != -1; i++)
{
if (elements_with_counter[i].element == properties_element)
{
MapCheckbuttonGadget(i);
/* draw counter gadgets */
- for (i=ED_COUNTER_ID_CUSTOM_FIRST; i<=ED_COUNTER_ID_CUSTOM_LAST; i++)
+ for (i = ED_COUNTER_ID_CUSTOM_FIRST; i <= ED_COUNTER_ID_CUSTOM_LAST; i++)
MapCounterButtons(i);
/* draw selectbox gadgets */
MapCheckbuttonGadget(i);
/* draw counter gadgets */
- for (i=ED_COUNTER_ID_CHANGE_FIRST; i<=ED_COUNTER_ID_CHANGE_LAST; i++)
+ for (i = ED_COUNTER_ID_CHANGE_FIRST; i <= ED_COUNTER_ID_CHANGE_LAST; i++)
MapCounterButtons(i);
/* draw selectbox gadgets */
- for (i=ED_SELECTBOX_ID_CHANGE_FIRST; i<=ED_SELECTBOX_ID_CHANGE_LAST; i++)
+ for (i = ED_SELECTBOX_ID_CHANGE_FIRST; i <= ED_SELECTBOX_ID_CHANGE_LAST; i++)
MapSelectboxGadget(i);
/* draw textbutton gadgets */
- for (i=ED_TEXTBUTTON_ID_CHANGE_FIRST; i<=ED_TEXTBUTTON_ID_CHANGE_LAST; i++)
+ for (i=ED_TEXTBUTTON_ID_CHANGE_FIRST; i <= ED_TEXTBUTTON_ID_CHANGE_LAST; i++)
MapTextbuttonGadget(i);
/* draw graphicbutton gadgets */
if (from_x > to_x)
swap_numbers(&from_x, &to_x);
- for (x=from_x; x<=to_x; x++)
+ for (x = from_x; x <= to_x; x++)
DrawLineElement(x, y, element, change_level);
}
else if (from_x == to_x) /* vertical line */
if (from_y > to_y)
swap_numbers(&from_y, &to_y);
- for (y=from_y; y<=to_y; y++)
+ for (y = from_y; y <= to_y; y++)
DrawLineElement(x, y, element, change_level);
}
else /* diagonal line */
if (from_x > to_x)
swap_number_pairs(&from_x, &from_y, &to_x, &to_y);
- for (x=0; x<=len_x; x++)
+ for (x = 0; x <= len_x; x++)
{
y = (int)(a * x + 0.5) * (to_y < from_y ? -1 : +1);
DrawLineElement(from_x + x, from_y + y, element, change_level);
if (from_y > to_y)
swap_number_pairs(&from_x, &from_y, &to_x, &to_y);
- for (y=0; y<=len_y; y++)
+ for (y = 0; y <= len_y; y++)
{
x = (int)(a * y + 0.5) * (to_x < from_x ? -1 : +1);
DrawLineElement(from_x + x, from_y + y, element, change_level);
if (from_y > to_y)
swap_number_pairs(&from_x, &from_y, &to_x, &to_y);
- for (y=from_y; y<=to_y; y++)
+ for (y = from_y; y <= to_y; y++)
DrawLine(from_x, y, to_x, y, element, change_level);
}
/* not optimal (some points get drawn twice) but simple,
and fast enough for the few points we are drawing */
- for (x=0; x<=radius; x++)
+ for (x = 0; x <= radius; x++)
{
int sx, sy, lx, ly;
DrawLineElement(sx, sy, element, change_level);
}
- for (y=0; y<=radius; y++)
+ for (y = 0; y <= radius; y++)
{
int sx, sy, lx, ly;
from_lx = from_x + level_xpos;
from_ly = from_y + level_ypos;
- for (y=0; y<brush_height; y++)
+ for (y = 0; y < brush_height; y++)
{
- for (x=0; x<brush_width; x++)
+ for (x=0; x < brush_width; x++)
{
brush_buffer[x][y] = Feld[from_lx + x][from_ly + y];
return;
}
- for (y=0; y<brush_height; y++)
+ for (y = 0; y < brush_height; y++)
{
- for (x=0; x<brush_width; x++)
+ for (x = 0; x < brush_width; x++)
{
int sx = cursor_from_x + x;
int sy = cursor_from_y + y;
old_element = Feld[from_x][from_y];
Feld[from_x][from_y] = fill_element;
- for(i=0;i<4;i++)
+ for (i = 0; i < 4; i++)
{
x = from_x + check[i][0];
y = from_y + check[i][1];
undo_buffer_steps++;
}
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
UndoBuffer[undo_buffer_position][x][y] = Feld[x][y];
/* check if drawing operation forces change of border style */
/* determine number of free positions for the new elements */
/* (maybe this statement should be formatted a bit more readable...) */
num_free_positions = 0;
- for (x=0; x<lev_fieldx; x++)
- for (y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
if ((free_position[x][y] =
((random_placement_background_restricted &&
Feld[x][y] == random_placement_background_element) ||
/* if not more free positions than elements to place, fill whole level */
if (num_elements >= num_free_positions)
{
- for (x=0; x<lev_fieldx; x++)
- for (y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
Feld[x][y] = new_element;
DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
int wrap_dy = lev_fieldy - dy;
int x, y;
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
FieldBackup[x][y] = Feld[x][y];
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
Feld[x][y] =
FieldBackup[(x + wrap_dx) % lev_fieldx][(y + wrap_dy) % lev_fieldy];
/* clicking into drawing area with pressed Control key picks element */
if (GetKeyModState() & KMOD_Control)
+ {
+ last_drawing_function = drawing_function;
actual_drawing_function = GADGET_ID_PICK_ELEMENT;
+ }
switch (actual_drawing_function)
{
if (new_element == EL_PLAYER_1)
{
/* remove player at old position */
- for(y=0; y<lev_fieldy; y++)
+ for (y = 0; y < lev_fieldy; y++)
{
- for(x=0; x<lev_fieldx; x++)
+ for (x = 0; x < lev_fieldx; x++)
{
if (Feld[x][y] == EL_PLAYER_1)
{
boolean new_template = (!LevelFileExists(-1));
if (new_template ||
- Request("Save this tem- plate and kill the old ?", REQ_ASK))
+ Request("Save this template and kill the old ?", REQ_ASK))
SaveLevelTemplate();
if (new_template)
- Request("Tem- plate saved !", REQ_CONFIRM);
+ Request("Template saved !", REQ_CONFIRM);
}
else if (type_id == ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE &&
custom_element.num_change_pages < MAX_CHANGE_PAGES)
{
if (level.use_custom_template && !LevelFileExists(-1))
{
- Request("No level tem- plate found !", REQ_CONFIRM);
+ Request("No level template found !", REQ_CONFIRM);
level.use_custom_template = FALSE;
ModifyGadget(gi, GDI_CHECKED, FALSE, GDI_END);
(undo_buffer_position - 1 + NUM_UNDO_STEPS) % NUM_UNDO_STEPS;
undo_buffer_steps--;
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
Feld[x][y] = UndoBuffer[undo_buffer_position][x][y];
DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos,level_ypos);
break;
edit_mode = ED_MODE_DRAWING;
}
- for(x=0; x<MAX_LEV_FIELDX; x++)
- for(y=0; y<MAX_LEV_FIELDY; y++)
+ for (x = 0; x < MAX_LEV_FIELDX; x++)
+ for (y = 0; y < MAX_LEV_FIELDY; y++)
Feld[x][y] = (button == 1 ? EL_EMPTY : new_element);
CopyLevelToUndoBuffer(GADGET_ID_CLEAR);
else if (key == KSYM_Return || key == setup.shortcut.toggle_pause)
ClickOnGadget(level_editor_gadget[GADGET_ID_TEST], button);
else
- for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
if (letter && letter == control_info[i].shortcut)
if (!anyTextGadgetActive())
ClickOnGadget(level_editor_gadget[i], button);