-#define COMPILE_DATE_STRING "2007-03-05 22:24"
+#define COMPILE_DATE_STRING "2007-03-06 02:28"
new_element = (nr == 0 ? EL_SP_HARDWARE_GREEN :
nr == 1 ? EL_SP_HARDWARE_BLUE : EL_SP_HARDWARE_RED);
}
+ else if (IS_GROUP_ELEMENT(new_element))
+ {
+ boolean connected_drawing = FALSE;
+ int i;
+
+ for (i = 0; i < NUM_DIRECTIONS; i++)
+ {
+ int xx = x + xy[i][0];
+ int yy = y + xy[i][1];
+
+ if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
+ IS_IN_GROUP_EL(IntelliDrawBuffer[last_x][last_y], new_element))
+ connected_drawing = TRUE;
+ }
+
+ if (!connected_drawing)
+ ResolveGroupElement(new_element);
+
+ new_element = GetElementFromGroupElement(new_element);
+ }
else if (IS_BELT_SWITCH(old_element))
{
int belt_nr = getBeltNrFromBeltSwitchElement(old_element);
int num_percentage, num_elements;
int x, y;
+#if 1
+ ResetIntelliDraw();
+#endif
+
/* determine number of free positions for randomly placing the new element */
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])
+#if 1
+ SetElement(x, y, new_element);
+#else
Feld[x][y] = new_element;
+#endif
}
else
{
if (free_position[x][y])
{
free_position[x][y] = FALSE;
+#if 1
+ SetElement(x, y, new_element);
+#else
Feld[x][y] = new_element;
+#endif
num_elements--;
}
}
InitJoysticks();
}
-static int get_element_from_group_element(int element)
+int GetElementFromGroupElement(int element)
{
if (IS_GROUP_ELEMENT(element))
{
}
else if (IS_GROUP_ELEMENT(element))
{
- Feld[x][y] = get_element_from_group_element(element);
+ Feld[x][y] = GetElementFromGroupElement(element);
InitField(x, y, init_game);
}
static void CreateFieldExt(int x, int y, int element, boolean is_change)
{
int old_element = Feld[x][y];
- int new_element = get_element_from_group_element(element);
+ int new_element = GetElementFromGroupElement(element);
int previous_move_direction = MovDir[x][y];
#if USE_NEW_CUSTOM_VALUE
int last_ce_value = CustomValue[x][y];
if (change->can_change)
{
-#if 0
+#if 1
/* !!! not clear why graphic animation should be reset at all here !!! */
+ /* !!! UPDATE: but is needed for correct Snake Bite tail animation !!! */
#if USE_GFX_RESET_WHEN_NOT_MOVING
/* when a custom element is about to change (for example by change delay),
do not reset graphic animation when the custom element is moving */
- if (IS_MOVING(x, y))
+ if (!IS_MOVING(x, y))
#endif
{
ResetGfxAnimation(x, y);
int i, x, y;
#endif
+#if 0
+ /* !!! THIS IS APPARENTLY WRONG FOR PLAYER RELOCATION !!! */
/* only horizontal XOR vertical scroll direction allowed */
if ((dx == 0 && dy == 0) || (dx != 0 && dy != 0))
return;
+#endif
#if 1
if (bitmap_db_field2 == NULL)
bitmap_db_field2 = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
+ /* needed when blitting directly to same bitmap -- should not be needed with
+ recent SDL libraries, but apparently does not work in 1.2.11 directly */
BlitBitmap(drawto_field, bitmap_db_field2,
FX + TILEX * (dx == -1) - softscroll_offset,
FY + TILEY * (dy == -1) - softscroll_offset,
#else
#if 1
+ /* !!! DOES NOT WORK FOR DIAGONAL PLAYER RELOCATION !!! */
int xsize = (BX2 - BX1 + 1);
int ysize = (BY2 - BY1 + 1);
int start = (dx != 0 ? (dx == -1 ? BX1 : BX2) : (dy == -1 ? BY1 : BY2));
#endif
void GetPlayerConfig(void);
+int GetElementFromGroupElement(int);
void DrawGameValue_Time(int);
void DrawGameDoorValues(void);
return FALSE;
}
-static void resolve_group_element(int group_element, int recursion_depth)
+static void ResolveGroupElementExt(int group_element, int recursion_depth)
{
static int group_nr;
static struct ElementGroupInfo *group;
if (recursion_depth == 0) /* initialization */
{
group = actual_group;
- group_nr = group_element - EL_GROUP_START;
+ group_nr = GROUP_NR(group_element);
group->num_elements_resolved = 0;
group->choice_pos = 0;
+
+ for (i = 0; i < MAX_NUM_ELEMENTS; i++)
+ element_info[i].in_group[group_nr] = FALSE;
}
for (i = 0; i < actual_group->num_elements; i++)
break;
if (IS_GROUP_ELEMENT(element))
- resolve_group_element(element, recursion_depth + 1);
+ ResolveGroupElementExt(element, recursion_depth + 1);
else
{
group->element_resolved[group->num_elements_resolved++] = element;
}
}
+void ResolveGroupElement(int group_element)
+{
+ ResolveGroupElementExt(group_element, 0);
+}
+
void InitElementPropertiesStatic()
{
static int ep_diggable[] =
property (which means that conditional property changes must be set to
a reliable default value before) */
- /* ---------- recursively resolve group elements ------------------------- */
-
- for (i = 0; i < MAX_NUM_ELEMENTS; i++)
- for (j = 0; j < NUM_GROUP_ELEMENTS; j++)
- element_info[i].in_group[j] = FALSE;
-
+ /* resolve group elements */
for (i = 0; i < NUM_GROUP_ELEMENTS; i++)
- resolve_group_element(EL_GROUP_START + i, 0);
+ ResolveGroupElement(EL_GROUP_START + i);
/* set all special, combined or engine dependent element properties */
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
void setBitfieldProperty(int *, int, int, boolean);
boolean getBitfieldProperty(int *, int, int);
+void ResolveGroupElement(int);
void InitElementPropertiesStatic(void);
void InitElementPropertiesEngine(int);
void InitElementPropertiesAfterLoading(int);
#if DEBUG
#define DEBUG_NUM_TIMESTAMPS 3
-#define DEBUG_TIME_IN_MICROSECONDS 1
+#define DEBUG_TIME_IN_MICROSECONDS 0
#if DEBUG_TIME_IN_MICROSECONDS
static double Counter_Microseconds()