From: Holger Schemel Date: Fri, 19 Mar 2004 21:59:29 +0000 (+0100) Subject: rnd-20040319-B-src X-Git-Tag: 3.1.0^2~44 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8f9768f67f24a3279d812ee1760e8dc8e723145d;p=rocksndiamonds.git rnd-20040319-B-src --- diff --git a/Makefile b/Makefile index 481244f7..1ea92b07 100644 --- a/Makefile +++ b/Makefile @@ -50,8 +50,8 @@ CROSS_PATH_WIN32=/usr/local/cross-tools/i386-mingw32msvc SRC_DIR = src MAKE_CMD = $(MAKE) -C $(SRC_DIR) -# DEFAULT_TARGET = x11 -DEFAULT_TARGET = sdl +DEFAULT_TARGET = x11 +# DEFAULT_TARGET = sdl # ----------------------------------------------------------------------------- diff --git a/src/Makefile b/src/Makefile index f065f0b9..ef1f52af 100644 --- a/src/Makefile +++ b/src/Makefile @@ -85,7 +85,8 @@ endif ifeq ($(TARGET),x11) SYS_CFLAGS = -DTARGET_X11 $(X11_INCL) -SYS_LDFLAGS = $(X11_LIBS) -lX11 +# SYS_LDFLAGS = $(X11_LIBS) -lX11 +SYS_LDFLAGS = $(XLIB_PATH)/libX11.a endif ifeq ($(TARGET),sdl) diff --git a/src/conftime.h b/src/conftime.h index a54a64cc..5c96450b 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-03-19 03:14]" +#define COMPILE_DATE_STRING "[2004-03-19 22:55]" diff --git a/src/editor.c b/src/editor.c index bbe1d19d..da310123 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1271,6 +1271,9 @@ static struct ValueTextInfo options_move_stepsize[] = { 4, "normal" }, { 8, "fast" }, { 16, "very fast" }, +#if 1 + { 32, "even faster" }, +#endif { -1, NULL } }; @@ -1317,7 +1320,7 @@ static struct ValueTextInfo options_deadliness[] = static struct ValueTextInfo options_consistency[] = { { EP_CAN_EXPLODE_3X3, "can explode 3x3" }, - { EP_CAN_EXPLODE_DYNA, "can explode 3+3" }, + { EP_CAN_EXPLODE_CROSS, "can explode 3+3" }, { EP_CAN_EXPLODE_1X1, "can explode 1x1" }, { EP_INDESTRUCTIBLE, "indestructible" }, @@ -5484,7 +5487,7 @@ static int setSelectboxValue(int selectbox_id, int new_value) static void copy_custom_element_settings(int element_from, int element_to) { -#if 1 +#if 0 struct ElementInfo ei_to_old = element_info[element_to]; struct ElementInfo *ei_from = &element_info[element_from]; struct ElementInfo *ei_to = &element_info[element_to]; @@ -5526,7 +5529,7 @@ static void copy_custom_element_settings(int element_from, int element_to) for (i = 0; i < MAX_ELEMENT_NAME_LEN + 1; i++) ei_to->description[i] = ei_from->description[i]; - /* ---------- copy element properties ---------- */ + /* ---------- copy element base properties ---------- */ Properties[element_to][EP_BITFIELD_BASE] = Properties[element_from][EP_BITFIELD_BASE]; @@ -5535,6 +5538,8 @@ static void copy_custom_element_settings(int element_from, int element_to) ei_to->use_gfx_element = ei_from->use_gfx_element; ei_to->gfx_element = ei_from->gfx_element; + ei_to->access_direction = ei_from->access_direction; + ei_to->collect_score = ei_from->collect_score; ei_to->collect_count = ei_from->collect_count; @@ -5547,49 +5552,33 @@ static void copy_custom_element_settings(int element_from, int element_to) ei_to->move_direction_initial = ei_from->move_direction_initial; ei_to->move_stepsize = ei_from->move_stepsize; + ei_to->move_enter_element = ei_from->move_enter_element; + ei_to->move_leave_element = ei_from->move_leave_element; + ei_to->move_leave_type = ei_from->move_leave_type; + ei_to->slippery_type = ei_from->slippery_type; for (y = 0; y < 3; y++) for (x = 0; x < 3; x++) ei_to->content[x][y] = ei_from->content[x][y]; - ei_to->num_change_pages = ei_from->num_change_pages; - setElementChangePages(ei_to, ei_to->num_change_pages); - - for (i=0; i < ei_to->num_change_pages; i++) - { - struct ElementChangeInfo *change_to = &ei_to->change_page[i]; - struct ElementChangeInfo *change_from = &ei_from->change_page[i]; - - /* always start with reliable default values */ - setElementChangeInfoToDefaults(change_to); - - change_to->events = change_from->events; + ei_to->explosion_delay = ei_from->explosion_delay; + ei_to->ignition_delay = ei_from->ignition_delay; - change_to->target_element = change_from->target_element; - - change_to->delay_fixed = change_from->delay_fixed; - change_to->delay_random = change_from->delay_random; - change_to->delay_frames = change_from->delay_frames; - - change_to->trigger_element = change_from->trigger_element; + /* ---------- reinitialize and copy change pages ---------- */ - change_to->explode = change_from->explode; - change_to->use_content = change_from->use_content; - change_to->only_if_complete = change_from->only_if_complete; - change_to->use_random_change = change_from->use_random_change; + ei_to->num_change_pages = ei_from->num_change_pages; + ei_to->current_change_page = ei_from->current_change_page; - change_to->random_percentage = change_from->random_percentage; - change_to->replace_when = change_from->replace_when; + setElementChangePages(ei_to, ei_to->num_change_pages); - for (y = 0; y < 3; y++) - for (x = 0; x < 3; x++) - change_to->target_content[x][y] = change_from->target_content[x][y]; + for (i=0; i < ei_to->num_change_pages; i++) + ei_to->change_page[i] = ei_from->change_page[i]; - change_to->can_change = change_from->can_change; + /* ---------- copy group element info ---------- */ + if (ei_from->group != NULL && ei_to->group != NULL) /* group or internal */ + *ei_to->group = *ei_from->group; - change_to->trigger_side = change_from->trigger_side; - } #endif /* mark this custom element as modified */ @@ -5796,13 +5785,13 @@ static void CopyCustomElementPropertiesToEditor(int element) (IS_INDESTRUCTIBLE(element) ? EP_INDESTRUCTIBLE : CAN_EXPLODE_1X1(element) ? EP_CAN_EXPLODE_1X1 : CAN_EXPLODE_3X3(element) ? EP_CAN_EXPLODE_3X3 : - CAN_EXPLODE_DYNA(element) ? EP_CAN_EXPLODE_DYNA : + CAN_EXPLODE_CROSS(element) ? EP_CAN_EXPLODE_CROSS : custom_element.consistency); custom_element_properties[EP_EXPLODE_RESULT] = (IS_INDESTRUCTIBLE(element) || CAN_EXPLODE_1X1(element) || CAN_EXPLODE_3X3(element) || - CAN_EXPLODE_DYNA(element)); + CAN_EXPLODE_CROSS(element)); /* special case: sub-settings dependent from main setting */ if (CAN_EXPLODE_BY_FIRE(element)) @@ -5958,7 +5947,7 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_properties[EP_INDESTRUCTIBLE] = FALSE; custom_element_properties[EP_CAN_EXPLODE_1X1] = FALSE; custom_element_properties[EP_CAN_EXPLODE_3X3] = FALSE; - custom_element_properties[EP_CAN_EXPLODE_DYNA] = FALSE; + custom_element_properties[EP_CAN_EXPLODE_CROSS] = FALSE; custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] = FALSE; custom_element_properties[EP_CAN_EXPLODE_SMASHED] = FALSE; custom_element_properties[EP_CAN_EXPLODE_IMPACT] = FALSE; @@ -5968,7 +5957,7 @@ static void CopyCustomElementPropertiesToGame(int element) /* special case: sub-settings dependent from main setting */ if (custom_element_properties[EP_CAN_EXPLODE_1X1] || custom_element_properties[EP_CAN_EXPLODE_3X3] || - custom_element_properties[EP_CAN_EXPLODE_DYNA]) + custom_element_properties[EP_CAN_EXPLODE_CROSS]) { custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] = custom_element.can_explode_by_fire; diff --git a/src/game.c b/src/game.c index ac8eced7..5e5fe3ea 100644 --- a/src/game.c +++ b/src/game.c @@ -43,10 +43,12 @@ /* for Explode() */ #define EX_PHASE_START 0 -#define EX_NO_EXPLOSION 0 -#define EX_NORMAL 1 -#define EX_CENTER 2 -#define EX_BORDER 3 +#define EX_TYPE_NONE 0 +#define EX_TYPE_NORMAL (1 << 0) +#define EX_TYPE_CENTER (1 << 1) +#define EX_TYPE_BORDER (1 << 2) +#define EX_TYPE_CROSS (1 << 3) +#define EX_TYPE_SINGLE_TILE (EX_TYPE_CENTER | EX_TYPE_BORDER) /* special positions in the game control window (relative to control window) */ #define XX_LEVEL 37 @@ -1613,7 +1615,7 @@ void InitGame() ExplodePhase[x][y] = 0; ExplodeDelay[x][y] = 0; - ExplodeField[x][y] = EX_NO_EXPLOSION; + ExplodeField[x][y] = EX_TYPE_NONE; RunnerVisit[x][y] = 0; PlayerVisit[x][y] = 0; @@ -2846,11 +2848,12 @@ void Explode(int ex, int ey, int phase, int mode) /* --- This is only really needed (and now handled) in "Impact()". --- */ /* do not explode moving elements that left the explode field in time */ if (game.engine_version >= VERSION_IDENT(2,2,0,7) && - center_element == EL_EMPTY && (mode == EX_NORMAL || mode == EX_CENTER)) + center_element == EL_EMPTY && + (mode == EX_TYPE_NORMAL || mode == EX_TYPE_CENTER)) return; #endif - if (mode == EX_NORMAL || mode == EX_CENTER) + if (mode == EX_TYPE_NORMAL || mode == EX_TYPE_CENTER) PlayLevelSoundAction(ex, ey, ACTION_EXPLODING); /* remove things displayed in background while burning dynamite */ @@ -2885,11 +2888,20 @@ void Explode(int ex, int ey, int phase, int mode) int element; #if 1 - if (!IN_LEV_FIELD(x, y) || (mode != EX_NORMAL && (x != ex || y != ey))) +#if 1 + if (!IN_LEV_FIELD(x, y) || + (mode & EX_TYPE_SINGLE_TILE && (x != ex || y != ey)) || + (mode == EX_TYPE_CROSS && (x != ex && y != ey))) continue; #else if (!IN_LEV_FIELD(x, y) || - ((mode != EX_NORMAL || center_element == EL_AMOEBA_TO_DIAMOND) && + (mode != EX_TYPE_NORMAL && (x != ex || y != ey))) + continue; +#endif +#else + if (!IN_LEV_FIELD(x, y) || + ((mode != EX_TYPE_NORMAL || + center_element == EL_AMOEBA_TO_DIAMOND) && (x != ex || y != ey))) continue; #endif @@ -3028,7 +3040,7 @@ void Explode(int ex, int ey, int phase, int mode) Store[x][y] = EL_EMPTY; if (x != ex || y != ey || - center_element == EL_AMOEBA_TO_DIAMOND || mode == EX_BORDER) + center_element == EL_AMOEBA_TO_DIAMOND || mode == EX_TYPE_BORDER) Store2[x][y] = element; #if 0 @@ -3355,7 +3367,7 @@ void DynaExplode(int ex, int ey) player->dynabombs_left++; } - Explode(ex, ey, EX_PHASE_START, EX_CENTER); + Explode(ex, ey, EX_PHASE_START, EX_TYPE_CENTER); for (i = 0; i < NUM_DIRECTIONS; i++) { @@ -3374,7 +3386,7 @@ void DynaExplode(int ex, int ey) if (element == EL_EXPLOSION && IS_ACTIVE_BOMB(Store2[x][y])) continue; - Explode(x, y, EX_PHASE_START, EX_BORDER); + Explode(x, y, EX_PHASE_START, EX_TYPE_BORDER); /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */ if (element != EL_EMPTY && @@ -3434,7 +3446,7 @@ void Bang(int x, int y) case EL_PACMAN: case EL_MOLE: RaiseScoreElement(element); - Explode(x, y, EX_PHASE_START, EX_NORMAL); + Explode(x, y, EX_PHASE_START, EX_TYPE_NORMAL); break; case EL_DYNABOMB_PLAYER_1_ACTIVE: case EL_DYNABOMB_PLAYER_2_ACTIVE: @@ -3452,17 +3464,21 @@ void Bang(int x, int y) case EL_AMOEBA_TO_DIAMOND: #endif if (IS_PLAYER(x, y)) - Explode(x, y, EX_PHASE_START, EX_NORMAL); + Explode(x, y, EX_PHASE_START, EX_TYPE_NORMAL); else - Explode(x, y, EX_PHASE_START, EX_CENTER); + Explode(x, y, EX_PHASE_START, EX_TYPE_CENTER); break; default: - if (CAN_EXPLODE_DYNA(element)) + if (CAN_EXPLODE_CROSS(element)) +#if 1 + Explode(x, y, EX_PHASE_START, EX_TYPE_CROSS); +#else DynaExplode(x, y); +#endif else if (CAN_EXPLODE_1X1(element)) - Explode(x, y, EX_PHASE_START, EX_CENTER); + Explode(x, y, EX_PHASE_START, EX_TYPE_CENTER); else - Explode(x, y, EX_PHASE_START, EX_NORMAL); + Explode(x, y, EX_PHASE_START, EX_TYPE_NORMAL); break; } @@ -8101,7 +8117,7 @@ void GameActions() CheckDynamite(x, y); #if 0 else if (element == EL_EXPLOSION && !game.explosions_delayed) - Explode(x, y, ExplodePhase[x][y], EX_NORMAL); + Explode(x, y, ExplodePhase[x][y], EX_TYPE_NORMAL); #endif else if (element == EL_AMOEBA_GROWING) AmoebeWaechst(x, y); @@ -8217,9 +8233,9 @@ void GameActions() if (ExplodeField[x][y]) Explode(x, y, EX_PHASE_START, ExplodeField[x][y]); else if (element == EL_EXPLOSION) - Explode(x, y, ExplodePhase[x][y], EX_NORMAL); + Explode(x, y, ExplodePhase[x][y], EX_TYPE_NORMAL); - ExplodeField[x][y] = EX_NO_EXPLOSION; + ExplodeField[x][y] = EX_TYPE_NONE; } game.explosions_delayed = TRUE; @@ -8919,24 +8935,22 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) int leave_side = trigger_sides[MV_DIR_BIT(move_direction)][1]; #if 1 + CheckTriggeredElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy], + CE_OTHER_GETS_LEFT, + player->index_bit, leave_side); + if (IS_CUSTOM_ELEMENT(Feld[old_jx][old_jy])) - { - CheckTriggeredElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy], - CE_OTHER_GETS_LEFT, - player->index_bit, leave_side); CheckElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy], CE_LEFT_BY_PLAYER, player->index_bit, leave_side); - } + + CheckTriggeredElementChangePlayer(jx, jy, Feld[jx][jy], + CE_OTHER_GETS_ENTERED, + player->index_bit, enter_side); if (IS_CUSTOM_ELEMENT(Feld[jx][jy])) - { - CheckTriggeredElementChangePlayer(jx, jy, Feld[jx][jy], - CE_OTHER_GETS_ENTERED, - player->index_bit, enter_side); CheckElementChangePlayer(jx, jy, Feld[jx][jy], CE_ENTERED_BY_PLAYER, player->index_bit, enter_side); - } #endif } @@ -9072,24 +9086,22 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) int old_jy = last_jy; #if 1 + CheckTriggeredElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy], + CE_OTHER_GETS_LEFT, + player->index_bit, leave_side); + if (IS_CUSTOM_ELEMENT(Feld[old_jx][old_jy])) - { - CheckTriggeredElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy], - CE_OTHER_GETS_LEFT, - player->index_bit, leave_side); CheckElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy], CE_LEFT_BY_PLAYER, player->index_bit, leave_side); - } + + CheckTriggeredElementChangePlayer(jx, jy, Feld[jx][jy], + CE_OTHER_GETS_ENTERED, + player->index_bit, enter_side); if (IS_CUSTOM_ELEMENT(Feld[jx][jy])) - { - CheckTriggeredElementChangePlayer(jx, jy, Feld[jx][jy], - CE_OTHER_GETS_ENTERED, - player->index_bit, enter_side); CheckElementChangePlayer(jx, jy, Feld[jx][jy], CE_ENTERED_BY_PLAYER, player->index_bit, enter_side); - } #endif } @@ -10233,7 +10245,7 @@ int DigField(struct PlayerInfo *player, PlayLevelSoundElementAction(x, y, element, ACTION_DIGGING); CheckTriggeredElementChangePlayer(x, y, element, CE_OTHER_GETS_DIGGED, - player->index_bit, CH_SIDE_ANY); + player->index_bit, dig_side); #if 1 if (mode == DF_SNAP) @@ -10333,7 +10345,7 @@ int DigField(struct PlayerInfo *player, CheckTriggeredElementChangePlayer(x, y, element, CE_OTHER_GETS_COLLECTED, - player->index_bit, CH_SIDE_ANY); + player->index_bit, dig_side); #if 1 if (mode == DF_SNAP) @@ -10698,7 +10710,16 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) boolean DropElement(struct PlayerInfo *player) { + static int trigger_sides[4] = + { + CH_SIDE_LEFT, /* dropping left */ + CH_SIDE_RIGHT, /* dropping right */ + CH_SIDE_TOP, /* dropping up */ + CH_SIDE_BOTTOM, /* dropping down */ + }; int jx = player->jx, jy = player->jy; + int drop_direction = player->MovDir; + int drop_side = trigger_sides[MV_DIR_BIT(drop_direction)]; int old_element = Feld[jx][jy]; int new_element = (player->inventory_size > 0 ? player->inventory_element[player->inventory_size - 1] : @@ -10777,9 +10798,9 @@ boolean DropElement(struct PlayerInfo *player) CheckTriggeredElementChangePlayer(jx, jy, new_element, CE_OTHER_GETS_DROPPED, - player->index_bit, CH_SIDE_ANY); + player->index_bit, drop_side); CheckElementChangePlayer(jx, jy, new_element, CE_DROPPED_BY_PLAYER, - player->index_bit, CH_SIDE_ANY); + player->index_bit, drop_side); TestIfElementTouchesCustomElement(jx, jy); } diff --git a/src/init.c b/src/init.c index 24fbb2a7..92a70194 100644 --- a/src/init.c +++ b/src/init.c @@ -2234,7 +2234,7 @@ void InitElementPropertiesStatic() -1 }; - static int ep_can_explode_dyna[] = + static int ep_can_explode_cross[] = { -1 }; @@ -3026,7 +3026,7 @@ void InitElementPropertiesStatic() { ep_droppable, EP_DROPPABLE }, { ep_can_explode_1x1, EP_CAN_EXPLODE_1X1 }, { ep_pushable, EP_PUSHABLE }, - { ep_can_explode_dyna, EP_CAN_EXPLODE_DYNA }, + { ep_can_explode_cross, EP_CAN_EXPLODE_CROSS }, { ep_protected, EP_PROTECTED }, { ep_player, EP_PLAYER }, @@ -3320,7 +3320,7 @@ void InitElementPropertiesEngine(int engine_version) /* ---------- CAN_EXPLODE_3X3 ------------------------------------------ */ SET_PROPERTY(i, EP_CAN_EXPLODE_3X3, (CAN_EXPLODE(i) && !CAN_EXPLODE_1X1(i) && - !CAN_EXPLODE_DYNA(i))); + !CAN_EXPLODE_CROSS(i))); /* ---------- CAN_EXPLODE_BY_DRAGONFIRE -------------------------------- */ SET_PROPERTY(i, EP_CAN_EXPLODE_BY_DRAGONFIRE, CAN_EXPLODE_BY_FIRE(i)); @@ -3357,7 +3357,7 @@ void InitElementPropertiesEngine(int engine_version) printf("::: %d, %d, %d -> %d\n", CAN_EXPLODE_1X1(i), CAN_EXPLODE_3X3(i), - CAN_EXPLODE_DYNA(i), + CAN_EXPLODE_CROSS(i), CAN_EXPLODE(i)); #endif diff --git a/src/main.h b/src/main.h index f990acf9..c5939594 100644 --- a/src/main.h +++ b/src/main.h @@ -86,7 +86,7 @@ #define EP_DROPPABLE 22 #define EP_CAN_EXPLODE_1X1 23 #define EP_PUSHABLE 24 -#define EP_CAN_EXPLODE_DYNA 25 +#define EP_CAN_EXPLODE_CROSS 25 #define EP_PROTECTED 26 #define EP_CAN_MOVE_INTO_ACID 27 @@ -324,7 +324,7 @@ #define IS_DROPPABLE(e) HAS_PROPERTY(e, EP_DROPPABLE) #define CAN_EXPLODE_1X1(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_1X1) #define IS_PUSHABLE(e) HAS_PROPERTY(e, EP_PUSHABLE) -#define CAN_EXPLODE_DYNA(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_DYNA) +#define CAN_EXPLODE_CROSS(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_CROSS) #define IS_PROTECTED(e) HAS_PROPERTY(e, EP_PROTECTED) #define CAN_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_CAN_MOVE_INTO_ACID) @@ -1564,14 +1564,14 @@ struct ElementChangeInfo boolean explode; /* explode instead of change */ + /* ---------- internal values used at runtime when playing ---------- */ + /* functions that are called before, while and after the change of an element -- currently only used for non-custom elements */ void (*pre_change_function)(int x, int y); void (*change_function)(int x, int y); void (*post_change_function)(int x, int y); - /* ---------- internal values used at runtime when playing ---------- */ - short actual_trigger_element; /* element that actually triggered change */ int actual_trigger_player; /* player which actually triggered change */