From: Holger Schemel Date: Thu, 5 Feb 2004 02:42:25 +0000 (+0100) Subject: rnd-20040205-1-src X-Git-Tag: 3.1.0^2~77 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9afd3ebaca7211c2c7e10926ddaaf422c73486dc;p=rocksndiamonds.git rnd-20040205-1-src * corrected move pattern to 32 bit and initial move direction to 8 bit --- diff --git a/ChangeLog b/ChangeLog index 9136c507..6e0badcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +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 diff --git a/src/conftime.h b/src/conftime.h index c6c6a35b..e52d0627 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-02-04 02:34]" +#define COMPILE_DATE_STRING "[2004-02-05 03:42]" diff --git a/src/editor.c b/src/editor.c index 2ac0b1fb..6ca13b17 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1146,13 +1146,13 @@ static struct ValueTextInfo options_move_pattern[] = 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 } }; @@ -6858,12 +6858,19 @@ static void DrawPropertiesWindow() 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) @@ -8049,6 +8056,17 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) *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(); @@ -8071,15 +8089,6 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) 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) diff --git a/src/files.c b/src/files.c index fca09c44..c2767d32 100644 --- a/src/files.c +++ b/src/files.c @@ -217,7 +217,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) 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; @@ -988,6 +988,7 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) 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); @@ -1002,8 +1003,11 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) 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 */ @@ -2555,7 +2559,8 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) 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); @@ -2569,8 +2574,11 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) 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 */ diff --git a/src/game.c b/src/game.c index 61ea108f..f5dc4186 100644 --- a/src/game.c +++ b/src/game.c @@ -1793,15 +1793,15 @@ void InitMovDir(int x, int y) 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; @@ -6247,7 +6247,7 @@ static void ChangeElementNowExt(int x, int y, int target_element) 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); @@ -9569,7 +9569,7 @@ boolean DropElement(struct PlayerInfo *player) 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]; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index c7b8eea4..3612ba04 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -850,27 +850,27 @@ inline void swap_number_pairs(int *x1, int *y1, int *x2, int *y2) *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); } } diff --git a/src/libgame/misc.h b/src/libgame/misc.h index af65d4ca..1a29394c 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -114,8 +114,8 @@ void checked_free(void *); 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); diff --git a/src/main.h b/src/main.h index 4afa2703..f11fc730 100644 --- a/src/main.h +++ b/src/main.h @@ -222,7 +222,7 @@ #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 @@ -236,15 +236,12 @@ #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) @@ -259,7 +256,18 @@ #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