+2004-02-04
+ * corrected move pattern to 32 bit and initial move direction to 8 bit
+
2004-02-03
* added second custom element base configuration page
-#define COMPILE_DATE_STRING "[2004-02-04 02:34]"
+#define COMPILE_DATE_STRING "[2004-02-05 03:42]"
static struct ValueTextInfo options_move_direction[] =
{
- { MV_AUTOMATIC, "automatic" },
- { MV_LEFT, "left" },
- { MV_RIGHT, "right" },
- { MV_UP, "up" },
- { MV_DOWN, "down" },
- { MV_RANDOM, "random" },
- { MV_PREVIOUS, "previous" },
+ { MV_START_AUTOMATIC, "automatic" },
+ { MV_START_LEFT, "left" },
+ { MV_START_RIGHT, "right" },
+ { MV_START_UP, "up" },
+ { MV_START_DOWN, "down" },
+ { MV_START_RANDOM, "random" },
+ { MV_START_PREVIOUS, "previous" },
{ -1, NULL }
};
static void UpdateCustomElementGraphicGadgets()
{
+ int i;
+
ModifyEditorElementList();
RedrawDrawingElements();
- if (edit_mode == ED_MODE_PROPERTIES &&
- edit_mode_properties == ED_MODE_PROPERTIES_CHANGE)
- DrawPropertiesChangeDrawingAreas();
+ /* force redraw of all mapped drawing area gadgets */
+ for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
+ {
+ struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[i].gadget_id];
+
+ if (gi->mapped)
+ MapDrawingArea(i);
+ }
}
static void DrawLineElement(int sx, int sy, int element, boolean change_level)
*checkbutton_info[type_id].value ^= TRUE;
+ if (((type_id >= ED_CHECKBUTTON_ID_CUSTOM1_FIRST &&
+ type_id <= ED_CHECKBUTTON_ID_CUSTOM1_LAST) ||
+ (type_id >= ED_CHECKBUTTON_ID_CUSTOM2_FIRST &&
+ type_id <= ED_CHECKBUTTON_ID_CUSTOM2_LAST) ||
+ (type_id >= ED_CHECKBUTTON_ID_CHANGE_FIRST &&
+ type_id <= ED_CHECKBUTTON_ID_CHANGE_LAST)) &&
+ type_id != ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE)
+ {
+ CopyElementPropertiesToGame(properties_element);
+ }
+
if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC)
{
UpdateCustomElementGraphicGadgets();
DrawEditModeWindow();
}
- else if ((type_id >= ED_CHECKBUTTON_ID_CUSTOM1_FIRST &&
- type_id <= ED_CHECKBUTTON_ID_CUSTOM1_LAST) ||
- (type_id >= ED_CHECKBUTTON_ID_CUSTOM2_FIRST &&
- type_id <= ED_CHECKBUTTON_ID_CUSTOM2_LAST) ||
- (type_id >= ED_CHECKBUTTON_ID_CHANGE_FIRST &&
- type_id <= ED_CHECKBUTTON_ID_CHANGE_LAST))
- {
- CopyElementPropertiesToGame(properties_element);
- }
}
static void HandleControlButtons(struct GadgetInfo *gi)
element_info[element].move_delay_random = 0;
element_info[element].move_pattern = MV_ALL_DIRECTIONS;
- element_info[element].move_direction_initial = MV_AUTOMATIC;
+ element_info[element].move_direction_initial = MV_START_AUTOMATIC;
element_info[element].move_stepsize = TILEX / 8;
element_info[element].move_enter_element = EL_EMPTY_SPACE;
element_info[element].move_leave_element = EL_EMPTY_SPACE;
ei->move_delay_fixed = getFile16BitBE(file);
ei->move_delay_random = getFile16BitBE(file);
+ /* bits 0 - 15 of "move_pattern" ... */
ei->move_pattern = getFile16BitBE(file);
ei->move_direction_initial = getFile8Bit(file);
ei->move_stepsize = getFile8Bit(file);
ei->move_leave_element = getMappedElement(getFile16BitBE(file));
ei->move_leave_type = getFile8Bit(file);
+ /* ... bits 16 - 31 of "move_pattern" (not nice, but downward compatible) */
+ ei->move_pattern |= (getFile16BitBE(file) << 16);
+
/* some free bytes for future custom property values and padding */
- ReadUnusedBytesFromFile(file, 7);
+ ReadUnusedBytesFromFile(file, 5);
/* read change property values */
putFile16BitBE(file, ei->move_delay_fixed);
putFile16BitBE(file, ei->move_delay_random);
- putFile16BitBE(file, ei->move_pattern);
+ /* bits 0 - 15 of "move_pattern" ... */
+ putFile16BitBE(file, ei->move_pattern & 0xffff);
putFile8Bit(file, ei->move_direction_initial);
putFile8Bit(file, ei->move_stepsize);
putFile16BitBE(file, ei->move_leave_element);
putFile8Bit(file, ei->move_leave_type);
+ /* ... bits 16 - 31 of "move_pattern" (not nice, but downward compatible) */
+ putFile16BitBE(file, (ei->move_pattern >> 16) & 0xffff);
+
/* some free bytes for future custom property values and padding */
- WriteUnusedBytesToFile(file, 7);
+ WriteUnusedBytesToFile(file, 5);
/* write change property values */
int move_direction_initial = ei->move_direction_initial;
int move_pattern = ei->move_pattern;
- if (move_direction_initial == MV_PREVIOUS)
+ if (move_direction_initial == MV_START_PREVIOUS)
{
if (MovDir[x][y] != MV_NO_MOVING)
return;
- move_direction_initial = MV_AUTOMATIC;
+ move_direction_initial = MV_START_AUTOMATIC;
}
- if (move_direction_initial == MV_RANDOM)
+ if (move_direction_initial == MV_START_RANDOM)
MovDir[x][y] = 1 << RND(4);
else if (move_direction_initial & MV_ANY_DIRECTION)
MovDir[x][y] = move_direction_initial;
ResetGfxAnimation(x, y);
ResetRandomAnimationValue(x, y);
- if (element_info[Feld[x][y]].move_direction_initial == MV_PREVIOUS)
+ if (element_info[Feld[x][y]].move_direction_initial == MV_START_PREVIOUS)
MovDir[x][y] = previous_move_direction;
InitField(x, y, FALSE);
int move_stepsize = element_info[new_element].move_stepsize;
int direction, dx, dy, nextx, nexty;
- if (element_info[new_element].move_direction_initial == MV_AUTOMATIC)
+ if (element_info[new_element].move_direction_initial == MV_START_AUTOMATIC)
MovDir[jx][jy] = player->MovDir;
direction = MovDir[jx][jy];
*y2 = help_y;
}
-short getFile16BitInteger(FILE *file, int byte_order)
+int getFile16BitInteger(FILE *file, int byte_order)
{
if (byte_order == BYTE_ORDER_BIG_ENDIAN)
- return ((fgetc(file) << 8) |
- (fgetc(file) << 0));
+ return ((fgetc(file) << 8) |
+ (fgetc(file) << 0));
else /* BYTE_ORDER_LITTLE_ENDIAN */
- return ((fgetc(file) << 0) |
- (fgetc(file) << 8));
+ return ((fgetc(file) << 0) |
+ (fgetc(file) << 8));
}
-void putFile16BitInteger(FILE *file, short value, int byte_order)
+void putFile16BitInteger(FILE *file, int value, int byte_order)
{
if (byte_order == BYTE_ORDER_BIG_ENDIAN)
{
- fputc((value >> 8) & 0xff, file);
- fputc((value >> 0) & 0xff, file);
+ fputc((value >> 8) & 0xff, file);
+ fputc((value >> 0) & 0xff, file);
}
else /* BYTE_ORDER_LITTLE_ENDIAN */
{
- fputc((value >> 0) & 0xff, file);
- fputc((value >> 8) & 0xff, file);
+ fputc((value >> 0) & 0xff, file);
+ fputc((value >> 8) & 0xff, file);
}
}
inline void swap_numbers(int *, int *);
inline void swap_number_pairs(int *, int *, int *, int *);
-short getFile16BitInteger(FILE *, int);
-void putFile16BitInteger(FILE *, short, int);
+int getFile16BitInteger(FILE *, int);
+void putFile16BitInteger(FILE *, int, int);
int getFile32BitInteger(FILE *, int);
void putFile32BitInteger(FILE *, int, int);
boolean getFileChunk(FILE *, char *, int *, int);
#define CP_HALF_DESTRUCTIVE 1
#define CP_FULL_DESTRUCTIVE 2
-/* values for special move patterns (bits 0-3: basic move directions) */
+/* values for custom move patterns (bits 0 - 3: basic move directions) */
#define MV_BIT_TOWARDS_PLAYER 4
#define MV_BIT_AWAY_FROM_PLAYER 5
#define MV_BIT_ALONG_LEFT_SIDE 6
#define MV_BIT_TURNING_LEFT_RIGHT 14
#define MV_BIT_TURNING_RIGHT_LEFT 15
#define MV_BIT_TURNING_RANDOM 16
-#define MV_BIT_PREVIOUS 17
-/* values for special move patterns for custom elements */
+/* values for custom move patterns */
#define MV_HORIZONTAL (MV_LEFT | MV_RIGHT)
#define MV_VERTICAL (MV_UP | MV_DOWN)
#define MV_ALL_DIRECTIONS (MV_HORIZONTAL | MV_VERTICAL)
#define MV_ANY_DIRECTION (MV_ALL_DIRECTIONS)
-#define MV_RANDOM (MV_ALL_DIRECTIONS)
-#define MV_AUTOMATIC (MV_NO_MOVING)
#define MV_TOWARDS_PLAYER (1 << MV_BIT_TOWARDS_PLAYER)
#define MV_AWAY_FROM_PLAYER (1 << MV_BIT_AWAY_FROM_PLAYER)
#define MV_ALONG_LEFT_SIDE (1 << MV_BIT_ALONG_LEFT_SIDE)
#define MV_TURNING_LEFT_RIGHT (1 << MV_BIT_TURNING_LEFT_RIGHT)
#define MV_TURNING_RIGHT_LEFT (1 << MV_BIT_TURNING_RIGHT_LEFT)
#define MV_TURNING_RANDOM (1 << MV_BIT_TURNING_RANDOM)
-#define MV_PREVIOUS (1 << MV_BIT_PREVIOUS)
+
+/* values for initial move direction (bits 0 - 3: basic move directions) */
+#define MV_START_BIT_PREVIOUS 4
+
+/* values for initial move direction */
+#define MV_START_AUTOMATIC (MV_NO_MOVING)
+#define MV_START_LEFT (MV_LEFT)
+#define MV_START_RIGHT (MV_RIGHT)
+#define MV_START_UP (MV_UP)
+#define MV_START_DOWN (MV_DOWN)
+#define MV_START_RANDOM (MV_ALL_DIRECTIONS)
+#define MV_START_PREVIOUS (1 << MV_START_BIT_PREVIOUS)
/* values for elements left behind by custom elements */
#define LEAVE_TYPE_UNLIMITED 0