-#define COMPILE_DATE_STRING "[2006-02-10 02:10]"
+#define COMPILE_DATE_STRING "[2006-02-11 15:23]"
ei_to->description[i] = ei_from->description[i];
/* ---------- copy element base properties ---------- */
+#if 1
+ ei_to->properties[EP_BITFIELD_BASE] = ei_from->properties[EP_BITFIELD_BASE];
+#else
Properties[element_to][EP_BITFIELD_BASE] =
Properties[element_from][EP_BITFIELD_BASE];
+#endif
/* ---------- copy custom property values ---------- */
return;
}
- if (game_status == GAME_MODE_MAIN && key == setup.shortcut.toggle_pause)
+ if (game_status == GAME_MODE_MAIN &&
+ (key == setup.shortcut.toggle_pause || key == KSYM_space))
{
StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE);
case GAME_MODE_INFO:
switch(key)
{
+#if 0
+ /* !!! only use "space" key to start game from main menu !!! */
case KSYM_space:
+#endif
case KSYM_Return:
if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE);
/* !!! now done in InitElementPropertiesStatic() (see above) !!! */
/* !!! (else properties set there will be overwritten here) !!! */
/* start with no properties at all */
+#if 1
+ for (j = 0; j < NUM_EP_BITFIELDS; j++)
+ ei->properties[j] = EP_BITMASK_DEFAULT;
+#else
for (j = 0; j < NUM_EP_BITFIELDS; j++)
Properties[element][j] = EP_BITMASK_DEFAULT;
+#endif
#endif
/* now set default properties */
static void ActivateLevelTemplate()
{
+#if 1
+ /* Currently there is no special action needed to activate the template
+ data, because 'element_info' property settings overwrite the original
+ level data, while all other variables do not change. */
+#else
/* Currently there is no special action needed to activate the template
data, because 'element_info' and 'Properties' overwrite the original
level data, while all other variables do not change. */
+#endif
}
static char *getLevelFilenameFromBasename(char *basename)
int element = getFile16BitBE(file);
int properties = getFile32BitBE(file);
+#if 1
+ if (IS_CUSTOM_ELEMENT(element))
+ element_info[element].properties[EP_BITFIELD_BASE] = properties;
+ else
+ Error(ERR_WARN, "invalid custom element number %d", element);
+#else
if (IS_CUSTOM_ELEMENT(element))
Properties[element][EP_BITFIELD_BASE] = properties;
else
Error(ERR_WARN, "invalid custom element number %d", element);
+#endif
}
return chunk_size;
ei->description[j] = getFile8Bit(file);
ei->description[MAX_ELEMENT_NAME_LEN] = 0;
+#if 1
+ ei->properties[EP_BITFIELD_BASE] = getFile32BitBE(file);
+#else
Properties[element][EP_BITFIELD_BASE] = getFile32BitBE(file);
+#endif
/* some free bytes for future properties and padding */
ReadUnusedBytesFromFile(file, 7);
ei->description[i] = getFile8Bit(file);
ei->description[MAX_ELEMENT_NAME_LEN] = 0;
+#if 1
+ ei->properties[EP_BITFIELD_BASE] = getFile32BitBE(file);
+#else
Properties[element][EP_BITFIELD_BASE] = getFile32BitBE(file);
+#endif
ReadUnusedBytesFromFile(file, 4); /* reserved for more base properties */
ei->num_change_pages = getFile8Bit(file);
{
int element = EL_CUSTOM_START + i;
+#if 1
+ struct ElementInfo *ei = &element_info[element];
+
+ if (ei->properties[EP_BITFIELD_BASE] != EP_BITMASK_DEFAULT)
+ {
+ if (check < num_changed_custom_elements)
+ {
+ putFile16BitBE(file, element);
+ putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE]);
+ }
+
+ check++;
+ }
+#else
if (Properties[element][EP_BITFIELD_BASE] != EP_BITMASK_DEFAULT)
{
if (check < num_changed_custom_elements)
check++;
}
+#endif
}
if (check != num_changed_custom_elements) /* should not happen */
for (j = 0; j < MAX_ELEMENT_NAME_LEN; j++)
putFile8Bit(file, ei->description[j]);
+#if 1
+ putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE]);
+#else
putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE]);
+#endif
/* some free bytes for future properties and padding */
WriteUnusedBytesToFile(file, 7);
for (i = 0; i < MAX_ELEMENT_NAME_LEN; i++)
putFile8Bit(file, ei->description[i]);
+#if 1
+ putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE]);
+#else
putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE]);
+#endif
WriteUnusedBytesToFile(file, 4); /* reserved for more base properties */
putFile8Bit(file, ei->num_change_pages);
}
}
+#if 1
+
void TestIfElementTouchesCustomElement(int x, int y)
+{
+ static int xy[4][2] =
+ {
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
+ };
+ static int trigger_sides[4][2] =
+ {
+ /* center side border side */
+ { CH_SIDE_TOP, CH_SIDE_BOTTOM }, /* check top */
+ { CH_SIDE_LEFT, CH_SIDE_RIGHT }, /* check left */
+ { CH_SIDE_RIGHT, CH_SIDE_LEFT }, /* check right */
+ { CH_SIDE_BOTTOM, CH_SIDE_TOP } /* check bottom */
+ };
+ static int touch_dir[4] =
+ {
+ MV_LEFT | MV_RIGHT,
+ MV_UP | MV_DOWN,
+ MV_UP | MV_DOWN,
+ MV_LEFT | MV_RIGHT
+ };
+ boolean change_center_element = FALSE;
+ int center_element = Feld[x][y]; /* should always be non-moving! */
+ int border_element_old[NUM_DIRECTIONS];
+ int i;
+
+ for (i = 0; i < NUM_DIRECTIONS; i++)
+ {
+ int xx = x + xy[i][0];
+ int yy = y + xy[i][1];
+ int border_element;
+
+ border_element_old[i] = -1;
+
+ if (!IN_LEV_FIELD(xx, yy))
+ continue;
+
+ if (game.engine_version < VERSION_IDENT(3,0,7,0))
+ border_element = Feld[xx][yy]; /* may be moving! */
+ else if (!IS_MOVING(xx, yy) && !IS_BLOCKED(xx, yy))
+ border_element = Feld[xx][yy];
+ else if (MovDir[xx][yy] & touch_dir[i]) /* elements are touching */
+ border_element = MovingOrBlocked2Element(xx, yy);
+ else
+ continue; /* center and border element do not touch */
+
+ border_element_old[i] = border_element;
+ }
+
+ for (i = 0; i < NUM_DIRECTIONS; i++)
+ {
+ int xx = x + xy[i][0];
+ int yy = y + xy[i][1];
+ int center_side = trigger_sides[i][0];
+ int border_element = border_element_old[i];
+
+ if (border_element == -1)
+ continue;
+
+ /* check for change of border element */
+ CheckElementChangeBySide(xx, yy, border_element, center_element,
+ CE_TOUCHING_X, center_side);
+ }
+
+ for (i = 0; i < NUM_DIRECTIONS; i++)
+ {
+ int border_side = trigger_sides[i][1];
+ int border_element = border_element_old[i];
+
+ if (border_element == -1)
+ continue;
+
+ /* check for change of center element (but change it only once) */
+ if (!change_center_element)
+ change_center_element =
+ CheckElementChangeBySide(x, y, center_element, border_element,
+ CE_TOUCHING_X, border_side);
+ }
+}
+
+#else
+
+void TestIfElementTouchesCustomElement_OLD(int x, int y)
{
static int xy[4][2] =
{
}
}
+#endif
+
void TestIfElementHitsCustomElement(int x, int y, int direction)
{
int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
int RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+#if 0
unsigned long Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
+#endif
int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
#define EP_BITMASK_DEFAULT 0
#define PROPERTY_BIT(p) (1 << ((p) % 32))
+#if 1
+#define PROPERTY_VAR(e,p) (element_info[e].properties[(p) / 32])
+#else
#define PROPERTY_VAR(e,p) (Properties[e][(p) / 32])
+#endif
#define HAS_PROPERTY(e,p) ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
#define SET_PROPERTY(e,p,v) ((v) ? \
(PROPERTY_VAR(e,p) |= PROPERTY_BIT(p)) : \
/* ---------- special element property values ---------- */
+ unsigned long properties[NUM_EP_BITFIELDS]; /* element base properties */
+
boolean use_gfx_element; /* use custom graphic element */
int gfx_element; /* optional custom graphic element */
extern int RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+#if 0
extern unsigned long Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
+#endif
extern int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
{
if (dx && choice == 1)
x = (dx < 0 ? 10 : 14);
+ else if (dx > 0)
+ {
+ if (choice == 4 || choice == 6)
+ button = MB_MENU_CHOICE;
+ }
else if (dy)
y = choice + dy;
}