#define ED_SCROLL_HORIZONTAL_YSIZE ED_SCROLLBUTTON_YSIZE
/* control button identifiers */
-#define ED_CTRL_ID_NONE -1
-
-#define ED_CTRL_ID_SINGLE_ITEMS 0
-#define ED_CTRL_ID_CONNECTED_ITEMS 1
-#define ED_CTRL_ID_LINE 2
-#define ED_CTRL_ID_ARC 3
-#define ED_CTRL_ID_RECTANGLE 4
-#define ED_CTRL_ID_FILLED_BOX 5
-#define ED_CTRL_ID_WRAP_UP 6
-#define ED_CTRL_ID_TEXT 7
-#define ED_CTRL_ID_FLOOD_FILL 8
-#define ED_CTRL_ID_WRAP_LEFT 9
-#define ED_CTRL_ID_PROPERTIES 10
-#define ED_CTRL_ID_WRAP_RIGHT 11
-#define ED_CTRL_ID_RANDOM_PLACEMENT 12
-#define ED_CTRL_ID_GRAB_BRUSH 13
-#define ED_CTRL_ID_WRAP_DOWN 14
-#define ED_CTRL_ID_PICK_ELEMENT 15
-#define ED_CTRL_ID_UNDO 16
-#define ED_CTRL_ID_INFO 17
-#define ED_CTRL_ID_SAVE 18
-#define ED_CTRL_ID_CLEAR 19
-#define ED_CTRL_ID_TEST 20
-#define ED_CTRL_ID_EXIT 21
+#define GADGET_ID_NONE -1
+
+#define GADGET_ID_SINGLE_ITEMS 0
+#define GADGET_ID_CONNECTED_ITEMS 1
+#define GADGET_ID_LINE 2
+#define GADGET_ID_ARC 3
+#define GADGET_ID_RECTANGLE 4
+#define GADGET_ID_FILLED_BOX 5
+#define GADGET_ID_WRAP_UP 6
+#define GADGET_ID_TEXT 7
+#define GADGET_ID_FLOOD_FILL 8
+#define GADGET_ID_WRAP_LEFT 9
+#define GADGET_ID_PROPERTIES 10
+#define GADGET_ID_WRAP_RIGHT 11
+#define GADGET_ID_RANDOM_PLACEMENT 12
+#define GADGET_ID_GRAB_BRUSH 13
+#define GADGET_ID_WRAP_DOWN 14
+#define GADGET_ID_PICK_ELEMENT 15
+#define GADGET_ID_UNDO 16
+#define GADGET_ID_INFO 17
+#define GADGET_ID_SAVE 18
+#define GADGET_ID_CLEAR 19
+#define GADGET_ID_TEST 20
+#define GADGET_ID_EXIT 21
/* counter button identifiers */
-#define ED_CTRL_ID_ELEM_SCORE_DOWN 22
-#define ED_CTRL_ID_ELEM_SCORE_TEXT 23
-#define ED_CTRL_ID_ELEM_SCORE_UP 24
-#define ED_CTRL_ID_ELEM_CONTENT_DOWN 25
-#define ED_CTRL_ID_ELEM_CONTENT_TEXT 26
-#define ED_CTRL_ID_ELEM_CONTENT_UP 27
-#define ED_CTRL_ID_LEVEL_XSIZE_DOWN 28
-#define ED_CTRL_ID_LEVEL_XSIZE_TEXT 29
-#define ED_CTRL_ID_LEVEL_XSIZE_UP 30
-#define ED_CTRL_ID_LEVEL_YSIZE_DOWN 31
-#define ED_CTRL_ID_LEVEL_YSIZE_TEXT 32
-#define ED_CTRL_ID_LEVEL_YSIZE_UP 33
-#define ED_CTRL_ID_LEVEL_RANDOM_DOWN 34
-#define ED_CTRL_ID_LEVEL_RANDOM_TEXT 35
-#define ED_CTRL_ID_LEVEL_RANDOM_UP 36
-#define ED_CTRL_ID_LEVEL_COLLECT_DOWN 37
-#define ED_CTRL_ID_LEVEL_COLLECT_TEXT 38
-#define ED_CTRL_ID_LEVEL_COLLECT_UP 39
-#define ED_CTRL_ID_LEVEL_TIMELIMIT_DOWN 40
-#define ED_CTRL_ID_LEVEL_TIMELIMIT_TEXT 41
-#define ED_CTRL_ID_LEVEL_TIMELIMIT_UP 42
-#define ED_CTRL_ID_LEVEL_TIMESCORE_DOWN 43
-#define ED_CTRL_ID_LEVEL_TIMESCORE_TEXT 44
-#define ED_CTRL_ID_LEVEL_TIMESCORE_UP 45
+#define GADGET_ID_ELEM_SCORE_DOWN 22
+#define GADGET_ID_ELEM_SCORE_TEXT 23
+#define GADGET_ID_ELEM_SCORE_UP 24
+#define GADGET_ID_ELEM_CONTENT_DOWN 25
+#define GADGET_ID_ELEM_CONTENT_TEXT 26
+#define GADGET_ID_ELEM_CONTENT_UP 27
+#define GADGET_ID_LEVEL_XSIZE_DOWN 28
+#define GADGET_ID_LEVEL_XSIZE_TEXT 29
+#define GADGET_ID_LEVEL_XSIZE_UP 30
+#define GADGET_ID_LEVEL_YSIZE_DOWN 31
+#define GADGET_ID_LEVEL_YSIZE_TEXT 32
+#define GADGET_ID_LEVEL_YSIZE_UP 33
+#define GADGET_ID_LEVEL_RANDOM_DOWN 34
+#define GADGET_ID_LEVEL_RANDOM_TEXT 35
+#define GADGET_ID_LEVEL_RANDOM_UP 36
+#define GADGET_ID_LEVEL_COLLECT_DOWN 37
+#define GADGET_ID_LEVEL_COLLECT_TEXT 38
+#define GADGET_ID_LEVEL_COLLECT_UP 39
+#define GADGET_ID_LEVEL_TIMELIMIT_DOWN 40
+#define GADGET_ID_LEVEL_TIMELIMIT_TEXT 41
+#define GADGET_ID_LEVEL_TIMELIMIT_UP 42
+#define GADGET_ID_LEVEL_TIMESCORE_DOWN 43
+#define GADGET_ID_LEVEL_TIMESCORE_TEXT 44
+#define GADGET_ID_LEVEL_TIMESCORE_UP 45
/* drawing area identifiers */
-#define ED_CTRL_ID_DRAWING_LEVEL 46
-#define ED_CTRL_ID_ELEM_CONTENT_0 47
-#define ED_CTRL_ID_ELEM_CONTENT_1 48
-#define ED_CTRL_ID_ELEM_CONTENT_2 49
-#define ED_CTRL_ID_ELEM_CONTENT_3 50
-#define ED_CTRL_ID_ELEM_CONTENT_4 51
-#define ED_CTRL_ID_ELEM_CONTENT_5 52
-#define ED_CTRL_ID_ELEM_CONTENT_6 53
-#define ED_CTRL_ID_ELEM_CONTENT_7 54
-#define ED_CTRL_ID_AMOEBA_CONTENT 55
+#define GADGET_ID_DRAWING_LEVEL 46
+#define GADGET_ID_ELEM_CONTENT_0 47
+#define GADGET_ID_ELEM_CONTENT_1 48
+#define GADGET_ID_ELEM_CONTENT_2 49
+#define GADGET_ID_ELEM_CONTENT_3 50
+#define GADGET_ID_ELEM_CONTENT_4 51
+#define GADGET_ID_ELEM_CONTENT_5 52
+#define GADGET_ID_ELEM_CONTENT_6 53
+#define GADGET_ID_ELEM_CONTENT_7 54
+#define GADGET_ID_AMOEBA_CONTENT 55
/* text input identifiers */
-#define ED_CTRL_ID_LEVEL_NAME 56
-#define ED_CTRL_ID_LEVEL_AUTHOR 57
+#define GADGET_ID_LEVEL_NAME 56
+#define GADGET_ID_LEVEL_AUTHOR 57
/* gadgets for scrolling of drawing area */
-#define ED_CTRL_ID_SCROLL_UP 58
-#define ED_CTRL_ID_SCROLL_DOWN 59
-#define ED_CTRL_ID_SCROLL_LEFT 60
-#define ED_CTRL_ID_SCROLL_RIGHT 61
-#define ED_CTRL_ID_SCROLL_VERTICAL 62
-#define ED_CTRL_ID_SCROLL_HORIZONTAL 63
+#define GADGET_ID_SCROLL_UP 58
+#define GADGET_ID_SCROLL_DOWN 59
+#define GADGET_ID_SCROLL_LEFT 60
+#define GADGET_ID_SCROLL_RIGHT 61
+#define GADGET_ID_SCROLL_VERTICAL 62
+#define GADGET_ID_SCROLL_HORIZONTAL 63
/* gadgets for scrolling element list */
-#define ED_CTRL_ID_ELEMENTLIST_UP 64
-#define ED_CTRL_ID_ELEMENTLIST_DOWN 65
+#define GADGET_ID_ELEMENTLIST_UP 64
+#define GADGET_ID_ELEMENTLIST_DOWN 65
/* gadgets for buttons in element list */
-#define ED_CTRL_ID_ELEMENTLIST_FIRST 66
-#define ED_CTRL_ID_ELEMENTLIST_LAST 105
+#define GADGET_ID_ELEMENTLIST_FIRST 66
+#define GADGET_ID_ELEMENTLIST_LAST 105
-#define ED_NUM_GADGETS 106
+#define NUM_EDITOR_GADGETS 106
/* values for counter gadgets */
#define ED_COUNTER_ID_ELEM_SCORE 0
{
ED_COUNT_ELEM_SCORE_XPOS, ED_COUNT_ELEM_SCORE_YPOS,
MIN_SCORE, MAX_SCORE,
- ED_CTRL_ID_ELEM_SCORE_DOWN, ED_CTRL_ID_ELEM_SCORE_UP,
- ED_CTRL_ID_ELEM_SCORE_TEXT,
+ GADGET_ID_ELEM_SCORE_DOWN, GADGET_ID_ELEM_SCORE_UP,
+ GADGET_ID_ELEM_SCORE_TEXT,
&gadget_elem_score_value,
"element score"
},
{
ED_COUNT_ELEM_CONTENT_XPOS, ED_COUNT_ELEM_CONTENT_YPOS,
MIN_ELEM_CONTENT, MAX_ELEM_CONTENT,
- ED_CTRL_ID_ELEM_CONTENT_DOWN, ED_CTRL_ID_ELEM_CONTENT_UP,
- ED_CTRL_ID_ELEM_CONTENT_TEXT,
+ GADGET_ID_ELEM_CONTENT_DOWN, GADGET_ID_ELEM_CONTENT_UP,
+ GADGET_ID_ELEM_CONTENT_TEXT,
&gadget_elem_content_value,
"element content"
},
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(0),
MIN_LEV_FIELDX, MAX_LEV_FIELDX,
- ED_CTRL_ID_LEVEL_XSIZE_DOWN, ED_CTRL_ID_LEVEL_XSIZE_UP,
- ED_CTRL_ID_LEVEL_XSIZE_TEXT,
+ GADGET_ID_LEVEL_XSIZE_DOWN, GADGET_ID_LEVEL_XSIZE_UP,
+ GADGET_ID_LEVEL_XSIZE_TEXT,
&gadget_level_xsize_value,
"playfield width"
},
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(1),
MIN_LEV_FIELDY, MAX_LEV_FIELDY,
- ED_CTRL_ID_LEVEL_YSIZE_DOWN, ED_CTRL_ID_LEVEL_YSIZE_UP,
- ED_CTRL_ID_LEVEL_YSIZE_TEXT,
+ GADGET_ID_LEVEL_YSIZE_DOWN, GADGET_ID_LEVEL_YSIZE_UP,
+ GADGET_ID_LEVEL_YSIZE_TEXT,
&gadget_level_ysize_value,
"playfield height"
},
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(2),
0, 100,
- ED_CTRL_ID_LEVEL_RANDOM_DOWN, ED_CTRL_ID_LEVEL_RANDOM_UP,
- ED_CTRL_ID_LEVEL_RANDOM_TEXT,
+ GADGET_ID_LEVEL_RANDOM_DOWN, GADGET_ID_LEVEL_RANDOM_UP,
+ GADGET_ID_LEVEL_RANDOM_TEXT,
&gadget_level_random_value,
"number of random elements"
},
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(3),
0, 999,
- ED_CTRL_ID_LEVEL_COLLECT_DOWN, ED_CTRL_ID_LEVEL_COLLECT_UP,
- ED_CTRL_ID_LEVEL_COLLECT_TEXT,
+ GADGET_ID_LEVEL_COLLECT_DOWN, GADGET_ID_LEVEL_COLLECT_UP,
+ GADGET_ID_LEVEL_COLLECT_TEXT,
&gadget_level_collect_value,
"number of emeralds to collect"
},
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(4),
0, 999,
- ED_CTRL_ID_LEVEL_TIMELIMIT_DOWN, ED_CTRL_ID_LEVEL_TIMELIMIT_UP,
- ED_CTRL_ID_LEVEL_TIMELIMIT_TEXT,
+ GADGET_ID_LEVEL_TIMELIMIT_DOWN, GADGET_ID_LEVEL_TIMELIMIT_UP,
+ GADGET_ID_LEVEL_TIMELIMIT_TEXT,
&gadget_level_timelimit_value,
"time available to solve level"
},
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(5),
0, 255,
- ED_CTRL_ID_LEVEL_TIMESCORE_DOWN, ED_CTRL_ID_LEVEL_TIMESCORE_UP,
- ED_CTRL_ID_LEVEL_TIMESCORE_TEXT,
+ GADGET_ID_LEVEL_TIMESCORE_DOWN, GADGET_ID_LEVEL_TIMESCORE_UP,
+ GADGET_ID_LEVEL_TIMESCORE_TEXT,
&gadget_level_timescore_value,
"score for each 10 seconds left"
},
{
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(6),
- ED_CTRL_ID_LEVEL_NAME,
+ GADGET_ID_LEVEL_NAME,
level.name,
"Level Title"
},
{
ED_LEVELINFO_XPOS, ED_COUNTER_YPOS(7),
- ED_CTRL_ID_LEVEL_AUTHOR,
+ GADGET_ID_LEVEL_AUTHOR,
level.author,
"Level Author"
}
{
ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 0 * ED_SCROLLBUTTON_YSIZE,
ED_SCROLL_UP_XPOS, ED_SCROLL_UP_YPOS,
- ED_CTRL_ID_SCROLL_UP,
+ GADGET_ID_SCROLL_UP,
"scroll level editing area up"
},
{
ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 1 * ED_SCROLLBUTTON_YSIZE,
ED_SCROLL_DOWN_XPOS, ED_SCROLL_DOWN_YPOS,
- ED_CTRL_ID_SCROLL_DOWN,
+ GADGET_ID_SCROLL_DOWN,
"scroll level editing area down"
},
{
ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 2 * ED_SCROLLBUTTON_YSIZE,
ED_SCROLL_LEFT_XPOS, ED_SCROLL_LEFT_YPOS,
- ED_CTRL_ID_SCROLL_LEFT,
+ GADGET_ID_SCROLL_LEFT,
"scroll level editing area left"
},
{
ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 3 * ED_SCROLLBUTTON_YSIZE,
ED_SCROLL_RIGHT_XPOS, ED_SCROLL_RIGHT_YPOS,
- ED_CTRL_ID_SCROLL_RIGHT,
+ GADGET_ID_SCROLL_RIGHT,
"scroll level editing area right"
},
{
ED_ELEMENTLIST_UP_XPOS, ED_ELEMENTLIST_UP_ALT_YPOS,
ED_ELEMENTLIST_UP_XPOS, ED_ELEMENTLIST_UP_YPOS,
- ED_CTRL_ID_ELEMENTLIST_UP,
+ GADGET_ID_ELEMENTLIST_UP,
"scroll element list up"
},
{
ED_ELEMENTLIST_DOWN_XPOS, ED_ELEMENTLIST_DOWN_ALT_YPOS,
ED_ELEMENTLIST_DOWN_XPOS, ED_ELEMENTLIST_DOWN_YPOS,
- ED_CTRL_ID_ELEMENTLIST_DOWN,
+ GADGET_ID_ELEMENTLIST_DOWN,
"scroll element list down"
}
};
ED_SCROLL_VERTICAL_XPOS, ED_SCROLL_VERTICAL_YPOS,
ED_SCROLL_VERTICAL_XSIZE, ED_SCROLL_VERTICAL_YSIZE,
GD_TYPE_SCROLLBAR_VERTICAL,
- ED_CTRL_ID_SCROLL_VERTICAL,
+ GADGET_ID_SCROLL_VERTICAL,
"scroll level editing area vertically"
},
{
ED_SCROLL_HORIZONTAL_XPOS, ED_SCROLL_HORIZONTAL_YPOS,
ED_SCROLL_HORIZONTAL_XSIZE, ED_SCROLL_HORIZONTAL_YSIZE,
GD_TYPE_SCROLLBAR_HORIZONTAL,
- ED_CTRL_ID_SCROLL_HORIZONTAL,
+ GADGET_ID_SCROLL_HORIZONTAL,
"scroll level editing area horizontally"
},
};
static void HandleDrawingAreaInfo(struct GadgetInfo *);
static void HandleTextInputGadgets(struct GadgetInfo *);
-static struct GadgetInfo *level_editor_gadget[ED_NUM_GADGETS];
+static struct GadgetInfo *level_editor_gadget[NUM_EDITOR_GADGETS];
-static int drawing_function = ED_CTRL_ID_SINGLE_ITEMS;
-static int last_drawing_function = ED_CTRL_ID_SINGLE_ITEMS;
+static int drawing_function = GADGET_ID_SINGLE_ITEMS;
+static int last_drawing_function = GADGET_ID_SINGLE_ITEMS;
static boolean draw_with_brush = FALSE;
static int properties_element = 0;
int radio_button_nr;
boolean checked;
- if (id == ED_CTRL_ID_SINGLE_ITEMS ||
- id == ED_CTRL_ID_CONNECTED_ITEMS ||
- id == ED_CTRL_ID_LINE ||
- id == ED_CTRL_ID_ARC ||
- id == ED_CTRL_ID_TEXT ||
- id == ED_CTRL_ID_RECTANGLE ||
- id == ED_CTRL_ID_FILLED_BOX ||
- id == ED_CTRL_ID_FLOOD_FILL ||
- id == ED_CTRL_ID_GRAB_BRUSH ||
- id == ED_CTRL_ID_PICK_ELEMENT)
+ if (id == GADGET_ID_SINGLE_ITEMS ||
+ id == GADGET_ID_CONNECTED_ITEMS ||
+ id == GADGET_ID_LINE ||
+ id == GADGET_ID_ARC ||
+ id == GADGET_ID_TEXT ||
+ id == GADGET_ID_RECTANGLE ||
+ id == GADGET_ID_FILLED_BOX ||
+ id == GADGET_ID_FLOOD_FILL ||
+ id == GADGET_ID_GRAB_BRUSH ||
+ id == GADGET_ID_PICK_ELEMENT)
{
button_type = GD_TYPE_RADIO_BUTTON;
radio_button_nr = 1;
radio_button_nr = 0;
checked = FALSE;
- if (id == ED_CTRL_ID_WRAP_LEFT ||
- id == ED_CTRL_ID_WRAP_RIGHT ||
- id == ED_CTRL_ID_WRAP_UP ||
- id == ED_CTRL_ID_WRAP_DOWN)
+ if (id == GADGET_ID_WRAP_LEFT ||
+ id == GADGET_ID_WRAP_RIGHT ||
+ id == GADGET_ID_WRAP_UP ||
+ id == GADGET_ID_WRAP_DOWN)
event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
else
event_mask = GD_EVENT_RELEASED;
event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
- if (id == ED_CTRL_ID_ELEMENTLIST_UP ||
- id == ED_CTRL_ID_ELEMENTLIST_DOWN)
+ if (id == GADGET_ID_ELEMENTLIST_UP ||
+ id == GADGET_ID_ELEMENTLIST_DOWN)
{
x += DX;
y += DY;
int gd_x, gd_y1, gd_y2;
int x = i % ED_ELEMENTLIST_BUTTONS_HORIZ;
int y = i / ED_ELEMENTLIST_BUTTONS_HORIZ;
- int id = ED_CTRL_ID_ELEMENTLIST_FIRST + i;
+ int id = GADGET_ID_ELEMENTLIST_FIRST + i;
event_mask = GD_EVENT_RELEASED;
GD_EVENT_OFF_BORDERS;
/* one for the level drawing area ... */
- id = ED_CTRL_ID_DRAWING_LEVEL;
+ id = GADGET_ID_DRAWING_LEVEL;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_X, SX,
GDI_Y, SY,
int gx = SX + ED_AREA_ELEM_CONTENT_XPOS + 5 * (i % 4) * MINI_TILEX;
int gy = SX + ED_AREA_ELEM_CONTENT_YPOS + 6 * (i / 4) * MINI_TILEY;
- id = ED_CTRL_ID_ELEM_CONTENT_0 + i;
+ id = GADGET_ID_ELEM_CONTENT_0 + i;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_X, gx,
GDI_Y, gy,
}
/* ... and one for the amoeba content */
- id = ED_CTRL_ID_AMOEBA_CONTENT;
+ id = GADGET_ID_AMOEBA_CONTENT;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_X, SX + ED_AREA_ELEM_CONTENT_XPOS,
GDI_Y, SY + ED_AREA_ELEM_CONTENT_YPOS,
struct GadgetInfo *gi;
unsigned long event_mask;
char infotext[1024];
- int id = ED_CTRL_ID_LEVEL_NAME + i;
+ int id = GADGET_ID_LEVEL_NAME + i;
event_mask = GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
MapGadget(level_editor_gadget[i]);
for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
- MapGadget(level_editor_gadget[ED_CTRL_ID_ELEMENTLIST_FIRST + i]);
+ MapGadget(level_editor_gadget[GADGET_ID_ELEMENTLIST_FIRST + i]);
}
static void MapCounterButtons(int id)
for (i=0; i<ED_NUM_SCROLLBARS; i++)
MapGadget(level_editor_gadget[scrollbar_info[i].gadget_id]);
- MapDrawingArea(ED_CTRL_ID_DRAWING_LEVEL);
+ MapDrawingArea(GADGET_ID_DRAWING_LEVEL);
}
static void UnmapDrawingArea(int id)
{
int i;
- for (i=0; i<ED_NUM_GADGETS; i++)
+ for (i=0; i<NUM_EDITOR_GADGETS; i++)
if (level_editor_gadget[i]->x < DX)
UnmapGadget(level_editor_gadget[i]);
}
{
int i;
- for (i=0; i<ED_NUM_GADGETS; i++)
+ for (i=0; i<NUM_EDITOR_GADGETS; i++)
UnmapGadget(level_editor_gadget[i]);
}
OpenDoor(DOOR_OPEN_1);
- strcpy(level_editor_gadget[ED_CTRL_ID_LEVEL_NAME]->text.value, level.name);
+ strcpy(level_editor_gadget[GADGET_ID_LEVEL_NAME]->text.value, level.name);
MapControlButtons();
struct GadgetInfo *gi = level_editor_gadget[id];
int items_max, items_visible, item_position;
- if (id == ED_CTRL_ID_SCROLL_HORIZONTAL)
+ if (id == GADGET_ID_SCROLL_HORIZONTAL)
{
items_max = MAX(lev_fieldx + 2, ED_FIELDX);
items_visible = ED_FIELDX;
ClearWindow();
UnmapLevelEditorWindowGadgets();
AdjustLevelScrollPosition();
- AdjustEditorScrollbar(ED_CTRL_ID_SCROLL_HORIZONTAL);
- AdjustEditorScrollbar(ED_CTRL_ID_SCROLL_VERTICAL);
+ AdjustEditorScrollbar(GADGET_ID_SCROLL_HORIZONTAL);
+ AdjustEditorScrollbar(GADGET_ID_SCROLL_VERTICAL);
DrawMiniLevel(level_xpos, level_ypos);
MapMainDrawingArea();
}
ElementContent[i][x][y] = level.mampfer_inhalt[i][x][y];
for (i=0; i<MAX_ELEM_CONTENT; i++)
- UnmapDrawingArea(ED_CTRL_ID_ELEM_CONTENT_0 + i);
+ UnmapDrawingArea(GADGET_ID_ELEM_CONTENT_0 + i);
/* display counter to choose number of element content areas */
gadget_elem_content_value = num_areas;
}
for (i=0; i<*num_areas; i++)
- MapDrawingArea(ED_CTRL_ID_ELEM_CONTENT_0 + i);
+ MapDrawingArea(GADGET_ID_ELEM_CONTENT_0 + i);
}
static void DrawAmoebaContentArea()
DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
- MapDrawingArea(ED_CTRL_ID_AMOEBA_CONTENT);
+ MapDrawingArea(GADGET_ID_AMOEBA_CONTENT);
}
#define TEXT_COLLECTING "Score for collecting"
boolean inside_drawing_area = !gi->event.off_borders;
boolean button_press_event;
boolean button_release_event;
- boolean draw_level = (id == ED_CTRL_ID_DRAWING_LEVEL);
+ boolean draw_level = (id == GADGET_ID_DRAWING_LEVEL);
int new_element;
int button = gi->event.button;
int sx = gi->event.x, sy = gi->event.y;
#endif
- if (!draw_level && drawing_function != ED_CTRL_ID_SINGLE_ITEMS)
+ if (!draw_level && drawing_function != GADGET_ID_SINGLE_ITEMS)
return;
switch (drawing_function)
{
- case ED_CTRL_ID_SINGLE_ITEMS:
+ case GADGET_ID_SINGLE_ITEMS:
if (draw_level)
{
if (button_release_event)
gi->y + sy * MINI_TILEY,
el2gfx(new_element));
- if (id == ED_CTRL_ID_AMOEBA_CONTENT)
+ if (id == GADGET_ID_AMOEBA_CONTENT)
level.amoebe_inhalt = new_element;
- else if (id >= ED_CTRL_ID_ELEM_CONTENT_0 &&
- id <= ED_CTRL_ID_ELEM_CONTENT_7)
- level.mampfer_inhalt[id - ED_CTRL_ID_ELEM_CONTENT_0][sx][sy] =
+ else if (id >= GADGET_ID_ELEM_CONTENT_0 &&
+ id <= GADGET_ID_ELEM_CONTENT_7)
+ level.mampfer_inhalt[id - GADGET_ID_ELEM_CONTENT_0][sx][sy] =
new_element;
}
break;
- case ED_CTRL_ID_CONNECTED_ITEMS:
+ case GADGET_ID_CONNECTED_ITEMS:
{
static int last_sx = -1;
static int last_sy = -1;
}
break;
- case ED_CTRL_ID_LINE:
- case ED_CTRL_ID_ARC:
- case ED_CTRL_ID_RECTANGLE:
- case ED_CTRL_ID_FILLED_BOX:
- case ED_CTRL_ID_GRAB_BRUSH:
- case ED_CTRL_ID_TEXT:
+ case GADGET_ID_LINE:
+ case GADGET_ID_ARC:
+ case GADGET_ID_RECTANGLE:
+ case GADGET_ID_FILLED_BOX:
+ case GADGET_ID_GRAB_BRUSH:
+ case GADGET_ID_TEXT:
{
static int last_sx = -1;
static int last_sy = -1;
static int start_sy = -1;
void (*draw_func)(int, int, int, int, int, boolean);
- if (drawing_function == ED_CTRL_ID_LINE)
+ if (drawing_function == GADGET_ID_LINE)
draw_func = DrawLine;
- else if (drawing_function == ED_CTRL_ID_ARC)
+ else if (drawing_function == GADGET_ID_ARC)
draw_func = DrawArc;
- else if (drawing_function == ED_CTRL_ID_RECTANGLE)
+ else if (drawing_function == GADGET_ID_RECTANGLE)
draw_func = DrawRectangle;
- else if (drawing_function == ED_CTRL_ID_FILLED_BOX)
+ else if (drawing_function == GADGET_ID_FILLED_BOX)
draw_func = DrawFilledBox;
- else if (drawing_function == ED_CTRL_ID_GRAB_BRUSH)
+ else if (drawing_function == GADGET_ID_GRAB_BRUSH)
draw_func = SelectArea;
- else /* (drawing_function == ED_CTRL_ID_TEXT) */
+ else /* (drawing_function == GADGET_ID_TEXT) */
draw_func = SetTextCursor;
if (button_press_event)
start_sx = last_sx = sx;
start_sy = last_sy = sy;
- if (drawing_function == ED_CTRL_ID_TEXT)
+ if (drawing_function == GADGET_ID_TEXT)
DrawLevelText(0, 0, 0, TEXT_END);
}
else if (button_release_event)
{
draw_func(start_sx, start_sy, sx, sy, new_element, TRUE);
- if (drawing_function == ED_CTRL_ID_GRAB_BRUSH)
+ if (drawing_function == GADGET_ID_GRAB_BRUSH)
{
CopyAreaToBrush(start_sx, start_sy, sx, sy, button);
CopyBrushToCursor(sx, sy);
- ClickOnGadget(level_editor_gadget[ED_CTRL_ID_SINGLE_ITEMS]);
+ ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS]);
draw_with_brush = TRUE;
}
- else if (drawing_function == ED_CTRL_ID_TEXT)
+ else if (drawing_function == GADGET_ID_TEXT)
DrawLevelText(sx, sy, 0, TEXT_INIT);
else
CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
#if 0
- case ED_CTRL_ID_TEXT:
+ case GADGET_ID_TEXT:
/*
DrawMiniElement(last_sx, last_sy, Feld[lx][ly]);
DrawAreaBorder(sx, sy, sx, sy);
- case ED_CTRL_ID_FLOOD_FILL:
+ case GADGET_ID_FLOOD_FILL:
if (button_press_event && Feld[lx][ly] != new_element)
{
FloodFill(lx, ly, new_element);
}
break;
- case ED_CTRL_ID_PICK_ELEMENT:
+ case GADGET_ID_PICK_ELEMENT:
if (button_press_event)
PickDrawingElement(button, Feld[lx][ly]);
if (button_release_event)
switch (id)
{
- case ED_CTRL_ID_ELEM_SCORE_DOWN:
- case ED_CTRL_ID_ELEM_SCORE_UP:
- step *= (id == ED_CTRL_ID_ELEM_SCORE_DOWN ? -1 : 1);
+ case GADGET_ID_ELEM_SCORE_DOWN:
+ case GADGET_ID_ELEM_SCORE_UP:
+ step *= (id == GADGET_ID_ELEM_SCORE_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_ELEM_SCORE,
*gadget_elem_score_value + step);
break;
- case ED_CTRL_ID_ELEM_SCORE_TEXT:
+ case GADGET_ID_ELEM_SCORE_TEXT:
*gadget_elem_score_value = gi->text.number_value;
break;
- case ED_CTRL_ID_ELEM_CONTENT_DOWN:
- case ED_CTRL_ID_ELEM_CONTENT_UP:
- step *= (id == ED_CTRL_ID_ELEM_CONTENT_DOWN ? -1 : 1);
+ case GADGET_ID_ELEM_CONTENT_DOWN:
+ case GADGET_ID_ELEM_CONTENT_UP:
+ step *= (id == GADGET_ID_ELEM_CONTENT_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_ELEM_CONTENT,
*gadget_elem_content_value + step);
DrawElementContentAreas();
break;
- case ED_CTRL_ID_ELEM_CONTENT_TEXT:
+ case GADGET_ID_ELEM_CONTENT_TEXT:
*gadget_elem_content_value = gi->text.number_value;
DrawElementContentAreas();
break;
- case ED_CTRL_ID_LEVEL_XSIZE_DOWN:
- case ED_CTRL_ID_LEVEL_XSIZE_UP:
- step *= (id == ED_CTRL_ID_LEVEL_XSIZE_DOWN ? -1 : 1);
+ case GADGET_ID_LEVEL_XSIZE_DOWN:
+ case GADGET_ID_LEVEL_XSIZE_UP:
+ step *= (id == GADGET_ID_LEVEL_XSIZE_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_LEVEL_XSIZE,
*gadget_level_xsize_value + step);
level.fieldx = lev_fieldx;
break;
- case ED_CTRL_ID_LEVEL_XSIZE_TEXT:
+ case GADGET_ID_LEVEL_XSIZE_TEXT:
*gadget_level_xsize_value = gi->text.number_value;
level.fieldx = lev_fieldx;
break;
- case ED_CTRL_ID_LEVEL_YSIZE_DOWN:
- case ED_CTRL_ID_LEVEL_YSIZE_UP:
- step *= (id == ED_CTRL_ID_LEVEL_YSIZE_DOWN ? -1 : 1);
+ case GADGET_ID_LEVEL_YSIZE_DOWN:
+ case GADGET_ID_LEVEL_YSIZE_UP:
+ step *= (id == GADGET_ID_LEVEL_YSIZE_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_LEVEL_YSIZE,
*gadget_level_ysize_value + step);
level.fieldy = lev_fieldy;
break;
- case ED_CTRL_ID_LEVEL_YSIZE_TEXT:
+ case GADGET_ID_LEVEL_YSIZE_TEXT:
*gadget_level_ysize_value = gi->text.number_value;
level.fieldy = lev_fieldy;
break;
- case ED_CTRL_ID_LEVEL_RANDOM_DOWN:
- case ED_CTRL_ID_LEVEL_RANDOM_UP:
- step *= (id == ED_CTRL_ID_LEVEL_RANDOM_DOWN ? -1 : 1);
+ case GADGET_ID_LEVEL_RANDOM_DOWN:
+ case GADGET_ID_LEVEL_RANDOM_UP:
+ step *= (id == GADGET_ID_LEVEL_RANDOM_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_LEVEL_RANDOM,
*gadget_level_random_value + step);
break;
- case ED_CTRL_ID_LEVEL_RANDOM_TEXT:
+ case GADGET_ID_LEVEL_RANDOM_TEXT:
*gadget_level_random_value = gi->text.number_value;
break;
- case ED_CTRL_ID_LEVEL_COLLECT_DOWN:
- case ED_CTRL_ID_LEVEL_COLLECT_UP:
- step *= (id == ED_CTRL_ID_LEVEL_COLLECT_DOWN ? -1 : 1);
+ case GADGET_ID_LEVEL_COLLECT_DOWN:
+ case GADGET_ID_LEVEL_COLLECT_UP:
+ step *= (id == GADGET_ID_LEVEL_COLLECT_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_LEVEL_COLLECT,
*gadget_level_collect_value + step);
break;
- case ED_CTRL_ID_LEVEL_COLLECT_TEXT:
+ case GADGET_ID_LEVEL_COLLECT_TEXT:
*gadget_level_collect_value = gi->text.number_value;
break;
- case ED_CTRL_ID_LEVEL_TIMELIMIT_DOWN:
- case ED_CTRL_ID_LEVEL_TIMELIMIT_UP:
- step *= (id == ED_CTRL_ID_LEVEL_TIMELIMIT_DOWN ? -1 : 1);
+ case GADGET_ID_LEVEL_TIMELIMIT_DOWN:
+ case GADGET_ID_LEVEL_TIMELIMIT_UP:
+ step *= (id == GADGET_ID_LEVEL_TIMELIMIT_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_LEVEL_TIMELIMIT,
*gadget_level_timelimit_value + step);
break;
- case ED_CTRL_ID_LEVEL_TIMELIMIT_TEXT:
+ case GADGET_ID_LEVEL_TIMELIMIT_TEXT:
*gadget_level_timelimit_value = gi->text.number_value;
break;
- case ED_CTRL_ID_LEVEL_TIMESCORE_DOWN:
- case ED_CTRL_ID_LEVEL_TIMESCORE_UP:
- step *= (id == ED_CTRL_ID_LEVEL_TIMESCORE_DOWN ? -1 : 1);
+ case GADGET_ID_LEVEL_TIMESCORE_DOWN:
+ case GADGET_ID_LEVEL_TIMESCORE_UP:
+ step *= (id == GADGET_ID_LEVEL_TIMESCORE_DOWN ? -1 : 1);
ModifyEditorCounter(ED_COUNTER_ID_LEVEL_TIMESCORE,
*gadget_level_timescore_value + step);
break;
- case ED_CTRL_ID_LEVEL_TIMESCORE_TEXT:
+ case GADGET_ID_LEVEL_TIMESCORE_TEXT:
*gadget_level_timescore_value = gi->text.number_value;
break;
switch (id)
{
- case ED_CTRL_ID_LEVEL_NAME:
+ case GADGET_ID_LEVEL_NAME:
strcpy(level.name, gi->text.value);
break;
- case ED_CTRL_ID_LEVEL_AUTHOR:
+ case GADGET_ID_LEVEL_AUTHOR:
strcpy(level.author, gi->text.value);
break;
button == 2 ? new_element2 :
button == 3 ? new_element3 : 0);
- if (edit_mode == ED_MODE_DRAWING && drawing_function == ED_CTRL_ID_TEXT)
+ if (edit_mode == ED_MODE_DRAWING && drawing_function == GADGET_ID_TEXT)
DrawLevelText(0, 0, 0, TEXT_END);
- if (id < ED_NUM_CTRL1_BUTTONS && id != ED_CTRL_ID_PROPERTIES &&
+ if (id < ED_NUM_CTRL1_BUTTONS && id != GADGET_ID_PROPERTIES &&
edit_mode != ED_MODE_DRAWING)
{
DrawDrawingWindow();
switch (id)
{
- case ED_CTRL_ID_SCROLL_LEFT:
+ case GADGET_ID_SCROLL_LEFT:
if (level_xpos >= 0)
{
- int gadget_id = ED_CTRL_ID_SCROLL_HORIZONTAL;
+ int gadget_id = GADGET_ID_SCROLL_HORIZONTAL;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
struct GadgetScrollbar *gs = &gi->scrollbar;
}
break;
- case ED_CTRL_ID_SCROLL_RIGHT:
+ case GADGET_ID_SCROLL_RIGHT:
if (level_xpos <= lev_fieldx - ED_FIELDX)
{
- int gadget_id = ED_CTRL_ID_SCROLL_HORIZONTAL;
+ int gadget_id = GADGET_ID_SCROLL_HORIZONTAL;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
struct GadgetScrollbar *gs = &gi->scrollbar;
}
break;
- case ED_CTRL_ID_SCROLL_UP:
+ case GADGET_ID_SCROLL_UP:
if (level_ypos >= 0)
{
- int gadget_id = ED_CTRL_ID_SCROLL_VERTICAL;
+ int gadget_id = GADGET_ID_SCROLL_VERTICAL;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
struct GadgetScrollbar *gs = &gi->scrollbar;
}
break;
- case ED_CTRL_ID_SCROLL_DOWN:
+ case GADGET_ID_SCROLL_DOWN:
if (level_ypos <= lev_fieldy - ED_FIELDY)
{
- int gadget_id = ED_CTRL_ID_SCROLL_VERTICAL;
+ int gadget_id = GADGET_ID_SCROLL_VERTICAL;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
struct GadgetScrollbar *gs = &gi->scrollbar;
}
break;
- case ED_CTRL_ID_SCROLL_HORIZONTAL:
+ case GADGET_ID_SCROLL_HORIZONTAL:
level_xpos = gi->event.item_position - 1;
DrawMiniLevel(level_xpos, level_ypos);
break;
- case ED_CTRL_ID_SCROLL_VERTICAL:
+ case GADGET_ID_SCROLL_VERTICAL:
level_ypos = gi->event.item_position - 1;
DrawMiniLevel(level_xpos, level_ypos);
break;
- case ED_CTRL_ID_ELEMENTLIST_UP:
- case ED_CTRL_ID_ELEMENTLIST_DOWN:
- step *= (id == ED_CTRL_ID_ELEMENTLIST_UP ? -1 : +1);
+ case GADGET_ID_ELEMENTLIST_UP:
+ case GADGET_ID_ELEMENTLIST_DOWN:
+ step *= (id == GADGET_ID_ELEMENTLIST_UP ? -1 : +1);
element_shift += step * ED_ELEMENTLIST_BUTTONS_HORIZ;
if (element_shift < 0)
for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
- int gadget_id = ED_CTRL_ID_ELEMENTLIST_FIRST + i;
+ int gadget_id = GADGET_ID_ELEMENTLIST_FIRST + i;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
struct GadgetDesign *design = &gi->deco.design;
}
break;
- case ED_CTRL_ID_WRAP_LEFT:
+ case GADGET_ID_WRAP_LEFT:
WrapLevel(-step, 0);
break;
- case ED_CTRL_ID_WRAP_RIGHT:
+ case GADGET_ID_WRAP_RIGHT:
WrapLevel(step, 0);
break;
- case ED_CTRL_ID_WRAP_UP:
+ case GADGET_ID_WRAP_UP:
WrapLevel(0, -step);
break;
- case ED_CTRL_ID_WRAP_DOWN:
+ case GADGET_ID_WRAP_DOWN:
WrapLevel(0, step);
break;
- case ED_CTRL_ID_SINGLE_ITEMS:
- case ED_CTRL_ID_CONNECTED_ITEMS:
- case ED_CTRL_ID_LINE:
- case ED_CTRL_ID_ARC:
- case ED_CTRL_ID_TEXT:
- case ED_CTRL_ID_RECTANGLE:
- case ED_CTRL_ID_FILLED_BOX:
- case ED_CTRL_ID_FLOOD_FILL:
- case ED_CTRL_ID_GRAB_BRUSH:
- case ED_CTRL_ID_PICK_ELEMENT:
+ case GADGET_ID_SINGLE_ITEMS:
+ case GADGET_ID_CONNECTED_ITEMS:
+ case GADGET_ID_LINE:
+ case GADGET_ID_ARC:
+ case GADGET_ID_TEXT:
+ case GADGET_ID_RECTANGLE:
+ case GADGET_ID_FILLED_BOX:
+ case GADGET_ID_FLOOD_FILL:
+ case GADGET_ID_GRAB_BRUSH:
+ case GADGET_ID_PICK_ELEMENT:
last_drawing_function = drawing_function;
drawing_function = id;
draw_with_brush = FALSE;
break;
- case ED_CTRL_ID_RANDOM_PLACEMENT:
+ case GADGET_ID_RANDOM_PLACEMENT:
RandomPlacement(button);
break;
- case ED_CTRL_ID_PROPERTIES:
+ case GADGET_ID_PROPERTIES:
if (edit_mode != ED_MODE_PROPERTIES)
{
properties_element = new_element;
}
break;
- case ED_CTRL_ID_UNDO:
+ case GADGET_ID_UNDO:
if (undo_buffer_steps == 0)
{
Request("Undo buffer empty !", REQ_CONFIRM);
DrawMiniLevel(level_xpos,level_ypos);
break;
- case ED_CTRL_ID_INFO:
+ case GADGET_ID_INFO:
if (edit_mode != ED_MODE_INFO)
{
DrawLevelInfoWindow();
}
break;
- case ED_CTRL_ID_CLEAR:
+ case GADGET_ID_CLEAR:
for(x=0; x<MAX_LEV_FIELDX; x++)
for(y=0; y<MAX_LEV_FIELDY; y++)
Feld[x][y] = new_element3;
- CopyLevelToUndoBuffer(ED_CTRL_ID_CLEAR);
+ CopyLevelToUndoBuffer(GADGET_ID_CLEAR);
DrawMiniLevel(level_xpos, level_ypos);
break;
- case ED_CTRL_ID_SAVE:
+ case GADGET_ID_SAVE:
if (leveldir[leveldir_nr].readonly)
{
Request("This level is read only !", REQ_CONFIRM);
}
break;
- case ED_CTRL_ID_TEST:
+ case GADGET_ID_TEST:
for(y=0; y<lev_fieldy; y++)
for(x=0; x<lev_fieldx; x++)
if (Feld[x][y] == EL_SPIELFIGUR ||
}
break;
- case ED_CTRL_ID_EXIT:
+ case GADGET_ID_EXIT:
for(y=0; y<lev_fieldy; y++)
for(x=0; x<lev_fieldx; x++)
if (Feld[x][y] != Ur[x][y])
{
char letter = getCharFromKeySym(key);
- if (drawing_function == ED_CTRL_ID_TEXT)
+ if (drawing_function == GADGET_ID_TEXT)
{
if (letter)
DrawLevelText(0, 0, letter, TEXT_WRITECHAR);
switch (key)
{
case XK_Left:
- id = ED_CTRL_ID_SCROLL_LEFT;
+ id = GADGET_ID_SCROLL_LEFT;
break;
case XK_Right:
- id = ED_CTRL_ID_SCROLL_RIGHT;
+ id = GADGET_ID_SCROLL_RIGHT;
break;
case XK_Up:
- id = ED_CTRL_ID_SCROLL_UP;
+ id = GADGET_ID_SCROLL_UP;
break;
case XK_Down:
- id = ED_CTRL_ID_SCROLL_DOWN;
+ id = GADGET_ID_SCROLL_DOWN;
break;
default:
- id = ED_CTRL_ID_NONE;
+ id = GADGET_ID_NONE;
break;
}
- if (id != ED_CTRL_ID_NONE)
+ if (id != GADGET_ID_NONE)
ClickOnGadget(level_editor_gadget[id]);
else if (letter == '.')
- ClickOnGadget(level_editor_gadget[ED_CTRL_ID_SINGLE_ITEMS]);
+ ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS]);
else
for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
if (letter && letter == control_info[i].shortcut)
{
sprintf(shortcut, " ('%s%c')",
(key >= 'A' && key <= 'Z' ? "Shift-" :
- gi->custom_id == ED_CTRL_ID_SINGLE_ITEMS ? ".' or '" : ""),
+ gi->custom_id == GADGET_ID_SINGLE_ITEMS ? ".' or '" : ""),
key);
if (strlen(infotext) + strlen(shortcut) <= MAX_INFOTEXT_LEN)
ClearEditorGadgetInfoText();
- if (id == ED_CTRL_ID_DRAWING_LEVEL)
+ if (id == GADGET_ID_DRAWING_LEVEL)
{
if (button_status)
{
switch (drawing_function)
{
- case ED_CTRL_ID_SINGLE_ITEMS:
+ case GADGET_ID_SINGLE_ITEMS:
infotext = "Drawing single items";
break;
- case ED_CTRL_ID_CONNECTED_ITEMS:
+ case GADGET_ID_CONNECTED_ITEMS:
infotext = "Drawing connected items";
break;
- case ED_CTRL_ID_LINE:
+ case GADGET_ID_LINE:
infotext = "Drawing line";
break;
- case ED_CTRL_ID_ARC:
+ case GADGET_ID_ARC:
infotext = "Drawing arc";
break;
- case ED_CTRL_ID_TEXT:
+ case GADGET_ID_TEXT:
infotext = "Setting text cursor";
break;
- case ED_CTRL_ID_RECTANGLE:
+ case GADGET_ID_RECTANGLE:
infotext = "Drawing rectangle";
break;
- case ED_CTRL_ID_FILLED_BOX:
+ case GADGET_ID_FILLED_BOX:
infotext = "Drawing filled box";
break;
- case ED_CTRL_ID_FLOOD_FILL:
+ case GADGET_ID_FLOOD_FILL:
infotext = "Flood fill";
break;
- case ED_CTRL_ID_GRAB_BRUSH:
+ case GADGET_ID_GRAB_BRUSH:
infotext = "Grabbing brush";
break;
- case ED_CTRL_ID_PICK_ELEMENT:
+ case GADGET_ID_PICK_ELEMENT:
infotext = "Picking element";
break;
DeleteBrushFromCursor();
}
}
- else if (id == ED_CTRL_ID_AMOEBA_CONTENT)
+ else if (id == GADGET_ID_AMOEBA_CONTENT)
DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
"Amoeba content");
else
DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
"Cruncher %d content: %d, %d",
- id - ED_CTRL_ID_ELEM_CONTENT_0 + 1, sx, sy);
+ id - GADGET_ID_ELEM_CONTENT_0 + 1, sx, sy);
}
extern boolean wait_for_vsync;
#endif
+/* tool button identifiers */
+#define TOOL_CTRL_ID_YES 0
+#define TOOL_CTRL_ID_NO 1
+#define TOOL_CTRL_ID_CONFIRM 2
+#define TOOL_CTRL_ID_PLAYER_1 3
+#define TOOL_CTRL_ID_PLAYER_2 4
+#define TOOL_CTRL_ID_PLAYER_3 5
+#define TOOL_CTRL_ID_PLAYER_4 6
+
+#define NUM_TOOL_BUTTONS 7
+
+/* forward declaration for internal use */
+static void UnmapToolButtons();
+static void HandleToolButtons(struct GadgetInfo *);
+
+static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS];
+static int request_gadget_id = -1;
+
void SetDrawtoField(int mode)
{
if (mode == DRAW_BUFFERED && setup.soft_scrolling)
old_door_state = GetDoorState();
+ UnmapAllGadgets();
+
CloseDoor(DOOR_CLOSE_1);
- /* Alten Türinhalt sichern */
+ /* save old door content */
XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1);
- /* Fragetext schreiben */
+ /* clear door drawing field */
+#if 0
XFillRectangle(display, pix[PIX_DB_DOOR], gc,
DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE);
+#else
+ XFillRectangle(display, drawto, gc, DX, DY, DXSIZE, DYSIZE);
+#endif
+ /* write text for request */
for(ty=0; ty<13; ty++)
{
int tx, tl, tc;
}
sprintf(txt, text);
txt[tl] = 0;
+#if 0
DrawTextExt(pix[PIX_DB_DOOR], gc,
DOOR_GFX_PAGEX1 + 51 - (tl * 14)/2, SY + ty * 16,
txt, FS_SMALL, FC_YELLOW);
+#else
+ DrawTextExt(drawto, gc,
+ DX + 51 - (tl * 14)/2, DY + 8 + ty * 16,
+ txt, FS_SMALL, FC_YELLOW);
+#endif
text += tl + (tc == 32 ? 1 : 0);
}
+
+
+#if 0
if (req_state & REQ_ASK)
{
DrawYesNoButton(BUTTON_OK, DB_INIT);
DrawPlayerButton(BUTTON_PLAYER_3, DB_INIT);
DrawPlayerButton(BUTTON_PLAYER_4, DB_INIT);
}
+#else
+
+ if (req_state & REQ_ASK)
+ {
+ MapGadget(tool_gadget[TOOL_CTRL_ID_YES]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_NO]);
+ }
+ else if (req_state & REQ_CONFIRM)
+ {
+ MapGadget(tool_gadget[TOOL_CTRL_ID_CONFIRM]);
+ }
+ else if (req_state & REQ_PLAYER)
+ {
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_1]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_2]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_3]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_4]);
+ }
+
+ /* copy request gadgets to door backbuffer */
+ XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
+ DX, DY, DXSIZE, DYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+
+#endif
+
+
OpenDoor(DOOR_OPEN_1);
ClearEventQueue();
button_status = MB_RELEASED;
+ request_gadget_id = -1;
+
while(result < 0)
{
if (XPending(display))
if (event.type == MotionNotify)
{
+ Window root, child;
+ int root_x, root_y;
+ int win_x, win_y;
+ unsigned int mask;
+
+ if (!XQueryPointer(display, window, &root, &child,
+ &root_x, &root_y, &win_x, &win_y, &mask))
+ continue;
+
+ if (!button_status)
+ continue;
+
motion_status = TRUE;
mx = ((XMotionEvent *) &event)->x;
my = ((XMotionEvent *) &event)->y;
button_status = MB_RELEASED;
}
+
+
+#if 0
if (req_state & REQ_ASK)
choice = CheckYesNoButtons(mx,my,button_status);
else if (req_state & REQ_CONFIRM)
default:
break;
}
+#else
+
+ /* this sets 'request_gadget_id' */
+ HandleGadgets(mx, my, button_status);
+
+ switch(request_gadget_id)
+ {
+ case TOOL_CTRL_ID_YES:
+ result = TRUE;
+ break;
+ case TOOL_CTRL_ID_NO:
+ result = FALSE;
+ break;
+ case TOOL_CTRL_ID_CONFIRM:
+ result = TRUE | FALSE;
+ break;
+
+ case TOOL_CTRL_ID_PLAYER_1:
+ result = 1;
+ break;
+ case TOOL_CTRL_ID_PLAYER_2:
+ result = 2;
+ break;
+ case TOOL_CTRL_ID_PLAYER_3:
+ result = 3;
+ break;
+ case TOOL_CTRL_ID_PLAYER_4:
+ result = 4;
+ break;
+
+ default:
+ break;
+ }
+#endif
+
break;
}
if (game_status != MAINMENU)
StopAnimation();
+ UnmapToolButtons();
+
if (!(req_state & REQ_STAY_OPEN))
{
CloseDoor(DOOR_CLOSE_1);
}
}
+ RemapAllGadgets();
+
#ifndef MSDOS
/* continue network game after request */
if (options.network &&
XDestroyImage(pixel_image);
return pixel_value;
+}
+
+/* ---------- new tool button stuff ---------------------------------------- */
+
+/* graphic position values for tool buttons */
+#define TOOL_BUTTON_YES_XPOS 2
+#define TOOL_BUTTON_YES_YPOS 250
+#define TOOL_BUTTON_YES_GFX_YPOS 0
+#define TOOL_BUTTON_YES_XSIZE 46
+#define TOOL_BUTTON_YES_YSIZE 28
+#define TOOL_BUTTON_NO_XPOS 52
+#define TOOL_BUTTON_NO_YPOS TOOL_BUTTON_YES_YPOS
+#define TOOL_BUTTON_NO_GFX_YPOS TOOL_BUTTON_YES_GFX_YPOS
+#define TOOL_BUTTON_NO_XSIZE TOOL_BUTTON_YES_XSIZE
+#define TOOL_BUTTON_NO_YSIZE TOOL_BUTTON_YES_YSIZE
+#define TOOL_BUTTON_CONFIRM_XPOS TOOL_BUTTON_YES_XPOS
+#define TOOL_BUTTON_CONFIRM_YPOS TOOL_BUTTON_YES_YPOS
+#define TOOL_BUTTON_CONFIRM_GFX_YPOS 30
+#define TOOL_BUTTON_CONFIRM_XSIZE 96
+#define TOOL_BUTTON_CONFIRM_YSIZE TOOL_BUTTON_YES_YSIZE
+#define TOOL_BUTTON_PLAYER_XSIZE 30
+#define TOOL_BUTTON_PLAYER_YSIZE 30
+#define TOOL_BUTTON_PLAYER_GFX_XPOS 5
+#define TOOL_BUTTON_PLAYER_GFX_YPOS 185
+#define TOOL_BUTTON_PLAYER_XPOS (5 + TOOL_BUTTON_PLAYER_XSIZE / 2)
+#define TOOL_BUTTON_PLAYER_YPOS (215 - TOOL_BUTTON_PLAYER_YSIZE / 2)
+#define TOOL_BUTTON_PLAYER1_XPOS (TOOL_BUTTON_PLAYER_XPOS \
+ + 0 * TOOL_BUTTON_PLAYER_XSIZE)
+#define TOOL_BUTTON_PLAYER2_XPOS (TOOL_BUTTON_PLAYER_XPOS \
+ + 1 * TOOL_BUTTON_PLAYER_XSIZE)
+#define TOOL_BUTTON_PLAYER3_XPOS (TOOL_BUTTON_PLAYER_XPOS \
+ + 0 * TOOL_BUTTON_PLAYER_XSIZE)
+#define TOOL_BUTTON_PLAYER4_XPOS (TOOL_BUTTON_PLAYER_XPOS \
+ + 1 * TOOL_BUTTON_PLAYER_XSIZE)
+#define TOOL_BUTTON_PLAYER1_YPOS (TOOL_BUTTON_PLAYER_YPOS \
+ + 0 * TOOL_BUTTON_PLAYER_YSIZE)
+#define TOOL_BUTTON_PLAYER2_YPOS (TOOL_BUTTON_PLAYER_YPOS \
+ + 0 * TOOL_BUTTON_PLAYER_YSIZE)
+#define TOOL_BUTTON_PLAYER3_YPOS (TOOL_BUTTON_PLAYER_YPOS \
+ + 1 * TOOL_BUTTON_PLAYER_YSIZE)
+#define TOOL_BUTTON_PLAYER4_YPOS (TOOL_BUTTON_PLAYER_YPOS \
+ + 1 * TOOL_BUTTON_PLAYER_YSIZE)
+
+static struct
+{
+ int xpos, ypos;
+ int x, y;
+ int width, height;
+ int gadget_id;
+ char *infotext;
+} toolbutton_info[NUM_TOOL_BUTTONS] =
+{
+ {
+ TOOL_BUTTON_YES_XPOS, TOOL_BUTTON_YES_GFX_YPOS,
+ TOOL_BUTTON_YES_XPOS, TOOL_BUTTON_YES_YPOS,
+ TOOL_BUTTON_YES_XSIZE, TOOL_BUTTON_YES_YSIZE,
+ TOOL_CTRL_ID_YES,
+ "yes"
+ },
+ {
+ TOOL_BUTTON_NO_XPOS, TOOL_BUTTON_NO_GFX_YPOS,
+ TOOL_BUTTON_NO_XPOS, TOOL_BUTTON_NO_YPOS,
+ TOOL_BUTTON_NO_XSIZE, TOOL_BUTTON_NO_YSIZE,
+ TOOL_CTRL_ID_NO,
+ "no"
+ },
+ {
+ TOOL_BUTTON_CONFIRM_XPOS, TOOL_BUTTON_CONFIRM_GFX_YPOS,
+ TOOL_BUTTON_CONFIRM_XPOS, TOOL_BUTTON_CONFIRM_YPOS,
+ TOOL_BUTTON_CONFIRM_XSIZE, TOOL_BUTTON_CONFIRM_YSIZE,
+ TOOL_CTRL_ID_CONFIRM,
+ "confirm"
+ },
+ {
+ TOOL_BUTTON_PLAYER_GFX_XPOS,TOOL_BUTTON_PLAYER_GFX_YPOS,
+ TOOL_BUTTON_PLAYER1_XPOS, TOOL_BUTTON_PLAYER1_YPOS,
+ TOOL_BUTTON_PLAYER_XSIZE, TOOL_BUTTON_PLAYER_YSIZE,
+ TOOL_CTRL_ID_PLAYER_1,
+ "player 1"
+ },
+ {
+ TOOL_BUTTON_PLAYER_GFX_XPOS,TOOL_BUTTON_PLAYER_GFX_YPOS,
+ TOOL_BUTTON_PLAYER2_XPOS, TOOL_BUTTON_PLAYER2_YPOS,
+ TOOL_BUTTON_PLAYER_XSIZE, TOOL_BUTTON_PLAYER_YSIZE,
+ TOOL_CTRL_ID_PLAYER_2,
+ "player 2"
+ },
+ {
+ TOOL_BUTTON_PLAYER_GFX_XPOS,TOOL_BUTTON_PLAYER_GFX_YPOS,
+ TOOL_BUTTON_PLAYER3_XPOS, TOOL_BUTTON_PLAYER3_YPOS,
+ TOOL_BUTTON_PLAYER_XSIZE, TOOL_BUTTON_PLAYER_YSIZE,
+ TOOL_CTRL_ID_PLAYER_3,
+ "player 3"
+ },
+ {
+ TOOL_BUTTON_PLAYER_GFX_XPOS,TOOL_BUTTON_PLAYER_GFX_YPOS,
+ TOOL_BUTTON_PLAYER4_XPOS, TOOL_BUTTON_PLAYER4_YPOS,
+ TOOL_BUTTON_PLAYER_XSIZE, TOOL_BUTTON_PLAYER_YSIZE,
+ TOOL_CTRL_ID_PLAYER_4,
+ "player 4"
+ }
+};
+
+void CreateToolButtons()
+{
+ int i;
+
+ for (i=0; i<NUM_TOOL_BUTTONS; i++)
+ {
+ Pixmap gd_pixmap = pix[PIX_DOOR];
+ Pixmap deco_pixmap = 0;
+ int deco_x, deco_y, deco_xpos, deco_ypos;
+ struct GadgetInfo *gi;
+ unsigned long event_mask;
+ int gd_xoffset, gd_yoffset;
+ int gd_x1, gd_x2, gd_y;
+ int id = i;
+
+ event_mask = GD_EVENT_RELEASED;
+
+ gd_xoffset = toolbutton_info[i].xpos;
+ gd_yoffset = toolbutton_info[i].ypos;
+ gd_x1 = DOOR_GFX_PAGEX4 + gd_xoffset;
+ gd_x2 = DOOR_GFX_PAGEX3 + gd_xoffset;
+ gd_y = DOOR_GFX_PAGEY1 + gd_yoffset;
+
+ if (id >= TOOL_CTRL_ID_PLAYER_1 && id <= TOOL_CTRL_ID_PLAYER_4)
+ {
+ getMiniGraphicSource(GFX_SPIELER1 + id - TOOL_CTRL_ID_PLAYER_1,
+ &deco_pixmap, &deco_x, &deco_y);
+ deco_xpos = (toolbutton_info[i].width - MINI_TILEX) / 2;
+ deco_ypos = (toolbutton_info[i].height - MINI_TILEY) / 2;
+ }
+
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_INFO_TEXT, toolbutton_info[i].infotext,
+ GDI_X, DX + toolbutton_info[i].x,
+ GDI_Y, DY + toolbutton_info[i].y,
+ GDI_WIDTH, toolbutton_info[i].width,
+ GDI_HEIGHT, toolbutton_info[i].height,
+ GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
+ GDI_STATE, GD_BUTTON_UNPRESSED,
+ GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
+ GDI_DECORATION_DESIGN, deco_pixmap, deco_x, deco_y,
+ GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
+ GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
+ GDI_DECORATION_SHIFTING, 1, 1,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_ACTION, HandleToolButtons,
+ GDI_END);
+
+ if (gi == NULL)
+ Error(ERR_EXIT, "cannot create gadget");
+
+ tool_gadget[id] = gi;
+ }
+}
+
+static void UnmapToolButtons()
+{
+ int i;
+
+ for (i=0; i<NUM_TOOL_BUTTONS; i++)
+ UnmapGadget(tool_gadget[i]);
+}
+
+static void HandleToolButtons(struct GadgetInfo *gi)
+{
+ request_gadget_id = gi->custom_id;
+
+
+#if 0
+ int id = gi->custom_id;
+
+ if (game_status != PLAYING)
+ return;
+
+ switch (id)
+ {
+ case GAME_CTRL_ID_STOP:
+ if (AllPlayersGone)
+ {
+ CloseDoor(DOOR_CLOSE_1);
+ game_status = MAINMENU;
+ DrawMainMenu();
+ break;
+ }
+
+ if (Request("Do you really want to quit the game ?",
+ REQ_ASK | REQ_STAY_CLOSED))
+ {
+#ifndef MSDOS
+ if (options.network)
+ SendToServer_StopPlaying();
+ else
+#endif
+ {
+ game_status = MAINMENU;
+ DrawMainMenu();
+ }
+ }
+ else
+ OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);
+ break;
+
+ case GAME_CTRL_ID_PAUSE:
+ if (options.network)
+ {
+#ifndef MSDOS
+ if (tape.pausing)
+ SendToServer_ContinuePlaying();
+ else
+ SendToServer_PausePlaying();
+#endif
+ }
+ else
+ TapeTogglePause();
+ break;
+
+ case GAME_CTRL_ID_PLAY:
+ if (tape.pausing)
+ {
+#ifndef MSDOS
+ if (options.network)
+ SendToServer_ContinuePlaying();
+ else
+#endif
+ {
+ tape.pausing = FALSE;
+ DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);
+ }
+ }
+ break;
+
+ case SOUND_CTRL_ID_MUSIC:
+ if (setup.sound_music)
+ {
+ setup.sound_music = FALSE;
+ FadeSound(background_loop[level_nr % num_bg_loops]);
+ }
+ else if (sound_loops_allowed)
+ {
+ setup.sound = setup.sound_music = TRUE;
+ PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
+ }
+ break;
+
+ case SOUND_CTRL_ID_LOOPS:
+ if (setup.sound_loops)
+ setup.sound_loops = FALSE;
+ else if (sound_loops_allowed)
+ setup.sound = setup.sound_loops = TRUE;
+ break;
+
+ case SOUND_CTRL_ID_SIMPLE:
+ if (setup.sound_simple)
+ setup.sound_simple = FALSE;
+ else if (sound_status==SOUND_AVAILABLE)
+ setup.sound = setup.sound_simple = TRUE;
+ break;
+
+ default:
+ break;
+ }
+#endif
+
+
+
}
int el2gfx(int element)