#include "buttons.h"
#include "files.h"
+/* positions in the level editor */
+#define ED_WIN_MB_LEFT_XPOS 7
+#define ED_WIN_MB_LEFT_YPOS 6
+#define ED_WIN_LEVELNR_XPOS 77
+#define ED_WIN_LEVELNR_YPOS 7
+#define ED_WIN_MB_MIDDLE_XPOS 7
+#define ED_WIN_MB_MIDDLE_YPOS 258
+#define ED_WIN_MB_RIGHT_XPOS 77
+#define ED_WIN_MB_RIGHT_YPOS 258
+
+/* other constants for the editor */
+#define ED_SCROLL_NO 0
+#define ED_SCROLL_LEFT 1
+#define ED_SCROLL_RIGHT 2
+#define ED_SCROLL_UP 4
+#define ED_SCROLL_DOWN 8
+
+/* delay value to avoid too fast scrolling etc. */
#define CHOICE_DELAY_VALUE 100
static int level_xpos,level_ypos;
-static BOOL edit_mode;
-static BOOL name_typing;
+static boolean edit_mode;
+static boolean name_typing;
static int new_element1 = EL_MAUERWERK;
static int new_element2 = EL_LEERRAUM;
static int new_element3 = EL_ERDREICH;
static int check[4][2] = { {-1,0}, {0,-1}, {1,0}, {0,1} };
static int safety = 0;
+ /* check if starting field still has the desired content */
+ if (Feld[from_x][from_y] == fill_element)
+ return;
+
safety++;
- if (safety>lev_fieldx*lev_fieldy)
- {
- fprintf(stderr,"Something went wrong in 'FloodFill()'. Please debug.\n");
- exit(-1);
- }
+ if (safety > lev_fieldx*lev_fieldy)
+ Error(ERR_EXIT, "Something went wrong in 'FloodFill()'. Please debug.");
old_element = Feld[from_x][from_y];
Feld[from_x][from_y] = fill_element;
for(i=0;i<4;i++)
{
- x = from_x+check[i][0];
- y = from_y+check[i][1];
+ x = from_x + check[i][0];
+ y = from_y + check[i][1];
- if (IN_LEV_FIELD(x,y) && Feld[x][y]==old_element)
- FloodFill(x,y,fill_element);
+ if (IN_LEV_FIELD(x,y) && Feld[x][y] == old_element)
+ FloodFill(x, y, fill_element);
}
safety--;
{
static int last_button = 0;
static int in_field_pressed = FALSE;
- static BOOL use_floodfill = FALSE;
+ static boolean use_floodfill = FALSE;
int x = (mx-SX)/MINI_TILEX;
int y = (my-SY)/MINI_TILEY;