#define ED_NUM_CTRL2_BUTTONS (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT)
#define ED_NUM_CTRL_BUTTONS (ED_NUM_CTRL1_BUTTONS + ED_NUM_CTRL2_BUTTONS)
+/* values for properties window */
+#define ED_PROPERTIES_XPOS (TILEX - MINI_TILEX/2)
/* values for counter gadgets */
#define ED_COUNT_VALUE_XOFFSET 5
#define ED_COUNT_VALUE_YOFFSET 3
-#define ED_COUNT_SCORE_XPOS (TILEX)
+#define ED_COUNT_SCORE_XPOS ED_PROPERTIES_XPOS
#define ED_COUNT_SCORE_YPOS (14 * MINI_TILEY)
-#define ED_COUNT_ELEMCONT_XPOS (TILEX)
+#define ED_COUNT_ELEMCONT_XPOS ED_PROPERTIES_XPOS
#define ED_COUNT_ELEMCONT_YPOS (17 * MINI_TILEY)
/* values for element content drawing areas */
el2gfx(new_element3));
redraw_mask |= REDRAW_DOOR_1;
- /*
- properties_element = new_element;
- if (edit_mode == ED_MODE_PROPERTIES)
- DrawPropertiesWindow();
- */
-
+ if (!HAS_CONTENT(properties_element))
+ {
+ properties_element = new_element;
+ if (edit_mode == ED_MODE_PROPERTIES)
+ DrawPropertiesWindow();
+ }
}
if (edit_mode == ED_MODE_DRAWING) /********** EDIT-FENSTER **********/
int2str(value, 3), FS_SMALL, FC_YELLOW);
}
-#define TEXT_COLLECTING "Score for collecting"
-#define TEXT_SMASHING "Score for smashing"
-#define TEXT_CRACKING "Score for cracking"
-#define TEXT_SPEED "Speed of growth"
-#define TEXT_DURATION "Duration when activated"
-
static void DrawDrawingWindow()
{
ClearWindow();
static void DrawElementContentAreas()
{
- static int num_areas = MAX_ELEMCONT;
+ int *num_areas = &MampferMax;
int area_x = ED_AREA_ELEMCONT_XPOS / MINI_TILEX;
int area_y = ED_AREA_ELEMCONT_YPOS / MINI_TILEY;
int area_sx = SX + ED_AREA_ELEMCONT_XPOS;
for (i=0; i<MAX_ELEMCONT; i++)
for (y=0; y<3; y++)
for (x=0; x<3; x++)
- ElementContent[i][x][y] =
- (i < 4 ? level.mampfer_inhalt[i][x][y] : EL_LEERRAUM);
+ ElementContent[i][x][y] = level.mampfer_inhalt[i][x][y];
for (i=0; i<MAX_ELEMCONT; i++)
UnmapDrawingArea(ED_CTRL_ID_ELEMCONT_0 + i);
/* display counter to choose number of element content areas */
- gadget_areas_value = &num_areas;
+ gadget_areas_value = num_areas;
DrawCounterValueField(ED_COUNTER_ELEMCONT, *gadget_areas_value);
x = counter_info[ED_COUNTER_ELEMCONT].x + DXSIZE;
y = counter_info[ED_COUNTER_ELEMCONT].y;
SXSIZE, 12 * MINI_TILEY);
/* draw some decorative border for the objects */
- for (i=0; i<num_areas; i++)
+ for (i=0; i<*num_areas; i++)
{
for (y=0; y<4; y++)
for (x=0; x<4; x++)
area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 12 * MINI_TILEY,
area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
- for (i=0; i<num_areas; i++)
+ DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
+ "Content", FS_SMALL, FC_YELLOW);
+ DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 1 * MINI_TILEY + 1,
+ "when", FS_SMALL, FC_YELLOW);
+ DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 2 * MINI_TILEY + 1,
+ "smashed", FS_SMALL, FC_YELLOW);
+
+ for (i=0; i<*num_areas; i++)
{
for (y=0; y<3; y++)
for (x=0; x<3; x++)
FC_YELLOW, "%d", i + 1);
}
- for (i=0; i<num_areas; i++)
+ for (i=0; i<*num_areas; i++)
MapDrawingArea(ED_CTRL_ID_ELEMCONT_0 + i);
}
area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba",
+ FS_SMALL, FC_YELLOW);
+
DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
MapDrawingArea(ED_CTRL_ID_AMOEBA_CONTENT);
}
+#define TEXT_COLLECTING "Score for collecting"
+#define TEXT_SMASHING "Score for smashing"
+#define TEXT_CRACKING "Score for cracking"
+#define TEXT_SPEED "Speed of amoeba growth"
+#define TEXT_DURATION "Duration when activated"
+
static void DrawPropertiesWindow()
{
int i, x, y;
if (Feld[x][y] == properties_element)
num_elements_in_level++;
- DrawTextF(TILEX, 5*TILEY, FC_YELLOW, "%d x contained in level",
+ DrawTextF(ED_PROPERTIES_XPOS, 5*TILEY, FC_YELLOW, "%d x contained in level",
num_elements_in_level);
/* check if there are elements where a score can be chosen for */
}
}
- if (properties_element == EL_MAMPFER)
- DrawElementContentAreas();
- else if (IS_AMOEBOID(properties_element))
- DrawAmoebaContentArea();
+ if (HAS_CONTENT(properties_element))
+ {
+ if (IS_AMOEBOID(properties_element))
+ DrawAmoebaContentArea();
+ else
+ DrawElementContentAreas();
+ }
}
static void swap_numbers(int *i1, int *i2)
{
static boolean started_inside_drawing_area = FALSE;
static boolean draw_with_brush = FALSE;
+ int id = gi->custom_id;
boolean inside_drawing_area = !gi->event.off_borders;
boolean button_press_event;
boolean button_release_event;
- boolean draw_level = (gi->custom_id == ED_CTRL_ID_DRAWING_LEVEL);
+ boolean draw_level = (id == ED_CTRL_ID_DRAWING_LEVEL);
int new_element;
int button = gi->event.button;
int sx = gi->event.x, sy = gi->event.y;
gi->x + sx * MINI_TILEX,
gi->y + sy * MINI_TILEY,
el2gfx(new_element));
+
+ if (id == ED_CTRL_ID_AMOEBA_CONTENT)
+ level.amoebe_inhalt = new_element;
+ else if (id >= ED_CTRL_ID_ELEMCONT_0 && id <= ED_CTRL_ID_ELEMCONT_7)
+ level.mampfer_inhalt[id - ED_CTRL_ID_ELEMCONT_0][sx][sy] =
+ new_element;
}
break;
}
else
{
- AdjustLevelScrollPosition();
- DrawMiniLevel(level_xpos, level_ypos);
+ DrawDrawingWindow();
edit_mode = ED_MODE_DRAWING;
}
break;
if (Feld[x][y] != Ur[x][y])
level_changed = TRUE;
- if (!level_changed)
+ if (0 && !level_changed)
{
Request("Level has not changed !", REQ_CONFIRM);
break;
for(i=0; i<LEVEL_SCORE_ELEMENTS; i++)
level.score[i] = 10;
- for(i=0; i<4; i++)
+ MampferMax = 4;
+ for(i=0; i<8; i++)
for(x=0; x<3; x++)
for(y=0; y<3; y++)
level.mampfer_inhalt[i][x][y] = EL_FELSBROCKEN;
for(i=0; i<LEVEL_SCORE_ELEMENTS; i++)
level.score[i] = fgetc(file);
- for(i=0; i<4; i++)
+ MampferMax = 4;
+ for(i=0; i<8; i++)
+ {
for(y=0; y<3; y++)
+ {
for(x=0; x<3; x++)
- level.mampfer_inhalt[i][x][y] = fgetc(file);
+ {
+ if (i < 4)
+ level.mampfer_inhalt[i][x][y] = fgetc(file);
+ else
+ level.mampfer_inhalt[i][x][y] = EL_LEERRAUM;
+ }
+ }
+ }
level.tempo_amoebe = fgetc(file);
level.dauer_sieb = fgetc(file);
/* read chunk "BODY" */
if (file_version >= FILE_VERSION_1_2)
{
- /* next check body chunk identifier and chunk length */
fgets(chunk, CHUNK_ID_LEN + 1, file);
chunk_length =
(fgetc(file)<<24) | (fgetc(file)<<16) | (fgetc(file)<<8) | fgetc(file);
+
+ /* look for optional content chunk */
+ if (strcmp(chunk, "CONT") == 0 && chunk_length == 4 + 8 * 3 * 3)
+ {
+ fgetc(file);
+ MampferMax = fgetc(file);
+ fgetc(file);
+ fgetc(file);
+
+ for(i=0; i<8; i++)
+ for(y=0; y<3; y++)
+ for(x=0; x<3; x++)
+ level.mampfer_inhalt[i][x][y] = fgetc(file);
+
+ fgets(chunk, CHUNK_ID_LEN + 1, file);
+ chunk_length =
+ (fgetc(file)<<24) | (fgetc(file)<<16) | (fgetc(file)<<8) | fgetc(file);
+ }
+
+ /* next check body chunk identifier and chunk length */
if (strcmp(chunk, "BODY") || chunk_length != lev_fieldx * lev_fieldy)
{
Error(ERR_WARN, "wrong 'BODY' chunk of level file '%s'", filename);
for(i=0; i<LEVEL_HEADER_UNUSED; i++) /* set unused header bytes to zero */
fputc(0, file);
+ fputs("CONT", file); /* chunk identifier for contents */
+
+ chunk_length = 4 + 8 * 3 * 3;
+
+ fputc((chunk_length >> 24) & 0xff, file);
+ fputc((chunk_length >> 16) & 0xff, file);
+ fputc((chunk_length >> 8) & 0xff, file);
+ fputc((chunk_length >> 0) & 0xff, file);
+
+ fputc(EL_MAMPFER, file);
+ fputc(MampferMax, file);
+ fputc(0, file);
+ fputc(0, file);
+
+ for(i=0; i<8; i++)
+ for(y=0; y<3; y++)
+ for(x=0; x<3; x++)
+ fputc(level.mampfer_inhalt[i][x][y], file);
+
fputs("BODY", file); /* chunk identifier for file body */
chunk_length = lev_fieldx * lev_fieldy;
#define EP_BIT_MAMPF3 (1<<23)
#define EP_BIT_PUSHABLE (1<<24)
#define EP_BIT_PLAYER (1<<25)
+#define EP_BIT_HAS_CONTENT (1<<26)
#define IS_AMOEBALIVE(e) (Elementeigenschaften[e] & EP_BIT_AMOEBALIVE)
#define IS_AMOEBOID(e) (Elementeigenschaften[e] & EP_BIT_AMOEBOID)
#define IS_MAMPF3(e) (Elementeigenschaften[e] & EP_BIT_MAMPF3)
#define IS_PUSHABLE(e) (Elementeigenschaften[e] & EP_BIT_PUSHABLE)
#define ELEM_IS_PLAYER(e) (Elementeigenschaften[e] & EP_BIT_PLAYER)
+#define HAS_CONTENT(e) (Elementeigenschaften[e] & EP_BIT_HAS_CONTENT)
#define IS_PLAYER(x,y) (ELEM_IS_PLAYER(StorePlayer[x][y]))
int edelsteine;
char name[MAX_LEVNAMLEN];
int score[LEVEL_SCORE_ELEMENTS];
- int mampfer_inhalt[4][3][3];
+ int mampfer_inhalt[8][3][3];
int tempo_amoebe;
int dauer_sieb;
int dauer_ablenk;
extern int ZX,ZY, ExitX,ExitY;
extern int AllPlayersGone;
extern int FrameCounter, TimeFrames, TimeLeft;
-extern int MampferNr, SiebAktiv;
+extern int MampferMax, MampferNr, SiebAktiv;
extern boolean network_player_action_received;