From: Holger Schemel Date: Mon, 7 Jul 2003 14:46:11 +0000 (+0200) Subject: rnd-20030707-1-src X-Git-Tag: 3.0.0^2~25 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4096fcbae692bfbf2f6506786659872a60b31693;p=rocksndiamonds.git rnd-20030707-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 9eaef5e6..4e3308a1 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-07-04 09:17]" +#define COMPILE_DATE_STRING "[2003-07-07 16:41]" diff --git a/src/editor.c b/src/editor.c index 969aad79..bfea8ee4 100644 --- a/src/editor.c +++ b/src/editor.c @@ -378,16 +378,17 @@ #define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 4) #define GADGET_ID_CUSTOM_MOVE_STEPSIZE (GADGET_ID_SELECTBOX_FIRST + 5) #define GADGET_ID_CUSTOM_SMASH_TARGETS (GADGET_ID_SELECTBOX_FIRST + 6) -#define GADGET_ID_CUSTOM_ACCESS_TYPE (GADGET_ID_SELECTBOX_FIRST + 7) -#define GADGET_ID_CUSTOM_ACCESS_LAYER (GADGET_ID_SELECTBOX_FIRST + 8) -#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 9) -#define GADGET_ID_CHANGE_PLAYER_ACTION (GADGET_ID_SELECTBOX_FIRST + 10) -#define GADGET_ID_CHANGE_COLLIDE_ACTION (GADGET_ID_SELECTBOX_FIRST + 11) -#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 12) -#define GADGET_ID_CHANGE_POWER (GADGET_ID_SELECTBOX_FIRST + 13) +#define GADGET_ID_CUSTOM_SLIPPERY_TYPE (GADGET_ID_SELECTBOX_FIRST + 7) +#define GADGET_ID_CUSTOM_ACCESS_TYPE (GADGET_ID_SELECTBOX_FIRST + 8) +#define GADGET_ID_CUSTOM_ACCESS_LAYER (GADGET_ID_SELECTBOX_FIRST + 9) +#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 10) +#define GADGET_ID_CHANGE_PLAYER_ACTION (GADGET_ID_SELECTBOX_FIRST + 11) +#define GADGET_ID_CHANGE_COLLIDE_ACTION (GADGET_ID_SELECTBOX_FIRST + 12) +#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 13) +#define GADGET_ID_CHANGE_POWER (GADGET_ID_SELECTBOX_FIRST + 14) /* textbutton identifiers */ -#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 14) +#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 15) #define GADGET_ID_PROPERTIES_INFO (GADGET_ID_TEXTBUTTON_FIRST + 0) #define GADGET_ID_PROPERTIES_CONFIG (GADGET_ID_TEXTBUTTON_FIRST + 1) @@ -528,15 +529,16 @@ #define ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION 4 #define ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE 5 #define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS 6 -#define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE 7 -#define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER 8 -#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 9 -#define ED_SELECTBOX_ID_CHANGE_PLAYER_ACTION 10 -#define ED_SELECTBOX_ID_CHANGE_COLLIDE_ACTION 11 -#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 12 -#define ED_SELECTBOX_ID_CHANGE_POWER 13 +#define ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE 7 +#define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE 8 +#define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER 9 +#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 10 +#define ED_SELECTBOX_ID_CHANGE_PLAYER_ACTION 11 +#define ED_SELECTBOX_ID_CHANGE_COLLIDE_ACTION 12 +#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 13 +#define ED_SELECTBOX_ID_CHANGE_POWER 14 -#define ED_NUM_SELECTBOX 14 +#define ED_NUM_SELECTBOX 15 #define ED_SELECTBOX_ID_CUSTOM_FIRST ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION #define ED_SELECTBOX_ID_CUSTOM_LAST ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER @@ -962,6 +964,16 @@ static struct ValueTextInfo options_smash_targets[] = { -1, NULL } }; +static struct ValueTextInfo options_slippery_type[] = +{ + { SLIPPERY_ANY_RANDOM, "random" }, + { SLIPPERY_ANY_LEFT_RIGHT, "left, right" }, + { SLIPPERY_ANY_RIGHT_LEFT, "right, left" }, + { SLIPPERY_ONLY_LEFT, "only left" }, + { SLIPPERY_ONLY_RIGHT, "only right" }, + { -1, NULL } +}; + static struct ValueTextInfo options_deadliness[] = { { EP_DONT_RUN_INTO, "running into" }, @@ -1088,6 +1100,14 @@ static struct &custom_element.smash_targets, "can smash", NULL, "elements that can be smashed" }, + { + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(10), + GADGET_ID_CUSTOM_SLIPPERY_TYPE, + -1, + options_slippery_type, + &custom_element.slippery_type, + "slippery", NULL, "where other elements fall down" + }, { ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(11), GADGET_ID_CUSTOM_DEADLINESS, @@ -1367,7 +1387,7 @@ static struct ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(10), GADGET_ID_CUSTOM_SLIPPERY, &custom_element_properties[EP_SLIPPERY], - "slippery", "other elements can fall down from it" + NULL, "other elements can fall down from it" }, { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(11), diff --git a/src/files.c b/src/files.c index 1396b60e..8fe110f2 100644 --- a/src/files.c +++ b/src/files.c @@ -31,7 +31,7 @@ #define LEVEL_CHUNK_CNT2_SIZE 160 /* size of level CNT2 chunk */ #define LEVEL_CHUNK_CNT2_UNUSED 11 /* unused CNT2 chunk bytes */ #define LEVEL_CPART_CUS3_SIZE 134 /* size of CUS3 chunk part */ -#define LEVEL_CPART_CUS3_UNUSED 16 /* unused CUS3 bytes / part */ +#define LEVEL_CPART_CUS3_UNUSED 15 /* unused CUS3 bytes / part */ #define TAPE_HEADER_SIZE 20 /* size of tape file header */ #define TAPE_HEADER_UNUSED 3 /* unused tape header bytes */ @@ -129,6 +129,8 @@ static void setLevelInfoToDefaults() element_info[element].move_direction_initial = MV_NO_MOVING; element_info[element].move_stepsize = TILEX / 8; + element_info[element].slippery_type = SLIPPERY_ANY_RANDOM; + for(x=0; x<3; x++) for(y=0; y<3; y++) element_info[element].content[x][y] = EL_EMPTY_SPACE; @@ -523,6 +525,8 @@ static int LoadLevel_CUS3(FILE *file, int chunk_size, struct LevelInfo *level) element_info[element].change.content[x][y] = checkLevelElement(getFile16BitBE(file)); + element_info[element].slippery_type = getFile8Bit(file); + /* some free bytes for future properties and padding */ ReadUnusedBytesFromFile(file, LEVEL_CPART_CUS3_UNUSED); } @@ -1001,6 +1005,8 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, for(x=0; x<3; x++) putFile16BitBE(file, element_info[element].change.content[x][y]); + putFile8Bit(file, element_info[element].slippery_type); + /* some free bytes for future properties and padding */ WriteUnusedBytesToFile(file, LEVEL_CPART_CUS3_UNUSED); } diff --git a/src/game.c b/src/game.c index 3051f5ac..2774beba 100644 --- a/src/game.c +++ b/src/game.c @@ -3578,31 +3578,47 @@ void StartMoving(int x, int y) element != EL_DX_SUPABOMB && element != EL_SP_DISK_ORANGE) #endif { - boolean left = (x>0 && IS_FREE(x-1, y) && - (IS_FREE(x-1, y + 1) || Feld[x-1][y + 1] == EL_ACID)); - boolean right = (x 0 && IS_FREE(x - 1, y) && + (IS_FREE(x - 1, y + 1) || + Feld[x - 1][y + 1] == EL_ACID)); + boolean can_fall_right = (x < lev_fieldx - 1 && IS_FREE(x + 1, y) && + (IS_FREE(x + 1, y + 1) || + Feld[x + 1][y + 1] == EL_ACID)); + boolean can_fall_any = (can_fall_left || can_fall_right); + boolean can_fall_both = (can_fall_left && can_fall_right); + + if (can_fall_any && IS_CUSTOM_ELEMENT(Feld[x][y + 1])) + { + int slippery_type = element_info[Feld[x][y + 1]].slippery_type; + + if (slippery_type == SLIPPERY_ONLY_LEFT) + can_fall_right = FALSE; + else if (slippery_type == SLIPPERY_ONLY_RIGHT) + can_fall_left = FALSE; + else if (slippery_type == SLIPPERY_ANY_LEFT_RIGHT && can_fall_both) + can_fall_right = FALSE; + else if (slippery_type == SLIPPERY_ANY_RIGHT_LEFT && can_fall_both) + can_fall_left = FALSE; + + can_fall_any = (can_fall_left || can_fall_right); + can_fall_both = (can_fall_left && can_fall_right); + } - if (left || right) + if (can_fall_any) { - if (left && right && + if (can_fall_both && (game.emulation != EMU_BOULDERDASH && element != EL_BD_ROCK && element != EL_BD_DIAMOND)) - left = !(right = RND(2)); + can_fall_left = !(can_fall_right = RND(2)); - InitMovingField(x, y, left ? MV_LEFT : MV_RIGHT); + InitMovingField(x, y, can_fall_left ? MV_LEFT : MV_RIGHT); started_moving = TRUE; - -#if 0 - if (element == EL_BOMB) - printf("::: SLIP DOWN [%d]\n", FrameCounter); -#endif } } else if (IS_BELT_ACTIVE(Feld[x][y + 1])) { - boolean left_is_free = (x>0 && IS_FREE(x-1, y)); - boolean right_is_free = (x 0 && IS_FREE(x - 1, y)); + boolean right_is_free = (x < lev_fieldx - 1 && IS_FREE(x + 1, y)); int belt_nr = getBeltNrFromBeltActiveElement(Feld[x][y + 1]); int belt_dir = game.belt_dir[belt_nr]; diff --git a/src/libgame/system.h b/src/libgame/system.h index d5f4457f..a5e0b22e 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -87,7 +87,7 @@ #define MB_RIGHTBUTTON 3 -/* values for basic move directions (effective at runtime) */ +/* values for move directions */ #define MV_BIT_LEFT 0 #define MV_BIT_RIGHT 1 #define MV_BIT_UP 2 @@ -95,19 +95,11 @@ #define NUM_DIRECTIONS 4 -/* values for special "button" bitmasks (effective at runtime) */ +/* values for special "button" bitmasks */ #define BUTTON_1 4 #define BUTTON_2 5 -/* values for special move patterns (stored in level files) */ -#define MV_BIT_TOWARDS_PLAYER 6 -#define MV_BIT_AWAY_FROM_PLAYER 7 -#define MV_BIT_ALONG_LEFT_SIDE 8 -#define MV_BIT_ALONG_RIGHT_SIDE 9 -#define MV_BIT_TURNING_LEFT 10 -#define MV_BIT_TURNING_RIGHT 11 - -/* values for move direction/pattern and special "button" key bitmasks */ +/* values for move direction and special "button" key bitmasks */ #define MV_NO_MOVING 0 #define MV_LEFT (1 << MV_BIT_LEFT) #define MV_RIGHT (1 << MV_BIT_RIGHT) @@ -124,17 +116,6 @@ (x) == MV_RIGHT ? MV_BIT_RIGHT : \ (x) == MV_UP ? MV_BIT_UP : MV_BIT_DOWN) -#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_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_ALONG_RIGHT_SIDE (1 << MV_BIT_ALONG_RIGHT_SIDE) -#define MV_TURNING_LEFT (1 << MV_BIT_TURNING_LEFT) -#define MV_TURNING_RIGHT (1 << MV_BIT_TURNING_RIGHT) - /* values for animation mode (frame order and direction) */ #define ANIM_NONE 0 diff --git a/src/main.h b/src/main.h index 95f6da8e..340f8beb 100644 --- a/src/main.h +++ b/src/main.h @@ -194,6 +194,32 @@ #define CP_HALF_DESTRUCTIVE 1 #define CP_FULL_DESTRUCTIVE 2 +/* values for special 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_ALONG_RIGHT_SIDE 7 +#define MV_BIT_TURNING_LEFT 8 +#define MV_BIT_TURNING_RIGHT 9 + +/* values for special move patterns for custom elements */ +#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_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_ALONG_RIGHT_SIDE (1 << MV_BIT_ALONG_RIGHT_SIDE) +#define MV_TURNING_LEFT (1 << MV_BIT_TURNING_LEFT) +#define MV_TURNING_RIGHT (1 << MV_BIT_TURNING_RIGHT) + +/* values for slippery property for custom elements */ +#define SLIPPERY_ANY_RANDOM 0 +#define SLIPPERY_ANY_LEFT_RIGHT 1 +#define SLIPPERY_ANY_RIGHT_LEFT 2 +#define SLIPPERY_ONLY_LEFT 3 +#define SLIPPERY_ONLY_RIGHT 4 /* macros for configurable properties */ #define IS_DIGGABLE(e) HAS_PROPERTY(e, EP_DIGGABLE) @@ -1239,6 +1265,8 @@ struct ElementInfo int move_direction_initial; /* initial direction element moves to */ int move_stepsize; /* step size element moves with */ + int slippery_type; /* how/where other elements slip away */ + int content[3][3]; /* new elements after explosion */ struct ElementChangeInfo change;