From: Holger Schemel Date: Sun, 5 Oct 2003 00:18:58 +0000 (+0200) Subject: rnd-20031005-1-src X-Git-Tag: 3.0.6^2~1 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5ec721dcfc26f09d7f95d16c07eb54147919993f;p=rocksndiamonds.git rnd-20031005-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 1d8c0e62..276cb64b 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-10-04 03:08]" +#define COMPILE_DATE_STRING "[2003-10-04 19:30]" diff --git a/src/editor.c b/src/editor.c index 0b9ad878..8e9904e7 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1114,11 +1114,11 @@ static struct ValueTextInfo options_change_direct_action[] = { { CE_TOUCHED_BY_PLAYER, "touched by player ..." }, { CE_PRESSED_BY_PLAYER, "pressed by player ..." }, - { CE_SWITCHED_BY_PLAYER, "switched by player ..." }, { CE_PUSHED_BY_PLAYER, "pushed by player ..." }, { CE_ENTERED_BY_PLAYER, "entered by player ..." }, { CE_LEFT_BY_PLAYER, "left by player ..." }, { CE_DROPPED_BY_PLAYER, "dropped by player" }, + { CE_SWITCHED, "switched ..." }, { CE_COLLISION, "collision ..." }, { CE_IMPACT, "impact" }, { CE_SMASHED, "smashed" }, @@ -1129,7 +1129,6 @@ static struct ValueTextInfo options_change_other_action[] = { { CE_OTHER_GETS_TOUCHED, "player touches ..." }, { CE_OTHER_GETS_PRESSED, "player presses ..." }, - { CE_OTHER_GETS_SWITCHED, "player switches ..." }, { CE_OTHER_GETS_PUSHED, "player pushes ..." }, { CE_OTHER_GETS_ENTERED, "player enters ..." }, { CE_OTHER_GETS_LEFT, "player leaves ..." }, @@ -1137,6 +1136,7 @@ static struct ValueTextInfo options_change_other_action[] = { CE_OTHER_GETS_COLLECTED, "player collects" }, { CE_OTHER_GETS_DROPPED, "player drops" }, { CE_OTHER_IS_TOUCHING, "touching ..." }, + { CE_OTHER_IS_SWITCHING, "switch of ..." }, { CE_OTHER_IS_CHANGING, "change of" }, { CE_OTHER_IS_EXPLODING, "explosion of" }, { -1, NULL } @@ -4591,11 +4591,11 @@ static void CopyCustomElementPropertiesToEditor(int element) custom_element_change.direct_action = (HAS_CHANGE_EVENT(element, CE_TOUCHED_BY_PLAYER) ? CE_TOUCHED_BY_PLAYER : HAS_CHANGE_EVENT(element, CE_PRESSED_BY_PLAYER) ? CE_PRESSED_BY_PLAYER : - HAS_CHANGE_EVENT(element, CE_SWITCHED_BY_PLAYER) ? CE_SWITCHED_BY_PLAYER : HAS_CHANGE_EVENT(element, CE_PUSHED_BY_PLAYER) ? CE_PUSHED_BY_PLAYER : HAS_CHANGE_EVENT(element, CE_ENTERED_BY_PLAYER) ? CE_ENTERED_BY_PLAYER : HAS_CHANGE_EVENT(element, CE_LEFT_BY_PLAYER) ? CE_LEFT_BY_PLAYER : HAS_CHANGE_EVENT(element, CE_DROPPED_BY_PLAYER) ? CE_DROPPED_BY_PLAYER : + HAS_CHANGE_EVENT(element, CE_SWITCHED) ? CE_SWITCHED : HAS_CHANGE_EVENT(element, CE_COLLISION) ? CE_COLLISION : HAS_CHANGE_EVENT(element, CE_IMPACT) ? CE_IMPACT : HAS_CHANGE_EVENT(element, CE_SMASHED) ? CE_SMASHED : @@ -4605,7 +4605,6 @@ static void CopyCustomElementPropertiesToEditor(int element) custom_element_change.other_action = (HAS_CHANGE_EVENT(element, CE_OTHER_GETS_TOUCHED) ? CE_OTHER_GETS_TOUCHED : HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PRESSED) ? CE_OTHER_GETS_PRESSED : - HAS_CHANGE_EVENT(element, CE_OTHER_GETS_SWITCHED) ? CE_OTHER_GETS_SWITCHED : HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PUSHED) ? CE_OTHER_GETS_PUSHED : HAS_CHANGE_EVENT(element, CE_OTHER_GETS_ENTERED) ? CE_OTHER_GETS_ENTERED : HAS_CHANGE_EVENT(element, CE_OTHER_GETS_LEFT) ? CE_OTHER_GETS_LEFT : @@ -4613,6 +4612,7 @@ static void CopyCustomElementPropertiesToEditor(int element) HAS_CHANGE_EVENT(element, CE_OTHER_GETS_COLLECTED) ? CE_OTHER_GETS_COLLECTED : HAS_CHANGE_EVENT(element, CE_OTHER_GETS_DROPPED) ? CE_OTHER_GETS_DROPPED : HAS_CHANGE_EVENT(element, CE_OTHER_IS_TOUCHING) ? CE_OTHER_IS_TOUCHING : + HAS_CHANGE_EVENT(element, CE_OTHER_IS_SWITCHING) ? CE_OTHER_IS_SWITCHING : HAS_CHANGE_EVENT(element, CE_OTHER_IS_CHANGING) ? CE_OTHER_IS_CHANGING : HAS_CHANGE_EVENT(element, CE_OTHER_IS_EXPLODING) ? CE_OTHER_IS_EXPLODING : custom_element_change.other_action); @@ -4709,11 +4709,11 @@ static void CopyCustomElementPropertiesToGame(int element) /* set player change event from checkbox and selectbox */ custom_element_change_events[CE_TOUCHED_BY_PLAYER] = FALSE; custom_element_change_events[CE_PRESSED_BY_PLAYER] = FALSE; - custom_element_change_events[CE_SWITCHED_BY_PLAYER] = FALSE; custom_element_change_events[CE_PUSHED_BY_PLAYER] = FALSE; custom_element_change_events[CE_ENTERED_BY_PLAYER] = FALSE; custom_element_change_events[CE_LEFT_BY_PLAYER] = FALSE; custom_element_change_events[CE_DROPPED_BY_PLAYER] = FALSE; + custom_element_change_events[CE_SWITCHED] = FALSE; custom_element_change_events[CE_COLLISION] = FALSE; custom_element_change_events[CE_IMPACT] = FALSE; custom_element_change_events[CE_SMASHED] = FALSE; @@ -4723,7 +4723,6 @@ static void CopyCustomElementPropertiesToGame(int element) /* set other element action change event from checkbox and selectbox */ custom_element_change_events[CE_OTHER_GETS_TOUCHED] = FALSE; custom_element_change_events[CE_OTHER_GETS_PRESSED] = FALSE; - custom_element_change_events[CE_OTHER_GETS_SWITCHED] = FALSE; custom_element_change_events[CE_OTHER_GETS_PUSHED] = FALSE; custom_element_change_events[CE_OTHER_GETS_ENTERED] = FALSE; custom_element_change_events[CE_OTHER_GETS_LEFT] = FALSE; @@ -4731,6 +4730,7 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_change_events[CE_OTHER_GETS_COLLECTED] = FALSE; custom_element_change_events[CE_OTHER_GETS_DROPPED] = FALSE; custom_element_change_events[CE_OTHER_IS_TOUCHING] = FALSE; + custom_element_change_events[CE_OTHER_IS_SWITCHING] = FALSE; custom_element_change_events[CE_OTHER_IS_CHANGING] = FALSE; custom_element_change_events[CE_OTHER_IS_EXPLODING] = FALSE; custom_element_change_events[custom_element_change.other_action] = diff --git a/src/game.c b/src/game.c index 2062caa8..3a622337 100644 --- a/src/game.c +++ b/src/game.c @@ -1016,6 +1016,9 @@ void InitGame() player->Frame = 0; player->StepFrame = 0; + player->switch_x = -1; + player->switch_y = -1; + player->use_murphy_graphic = FALSE; player->use_disk_red_graphic = FALSE; @@ -3095,6 +3098,11 @@ void Impact(int x, int y) else { CheckElementChange(x, y + 1, smashed, CE_SMASHED); + + CheckTriggeredElementSideChange(x, y + 1, smashed, CH_SIDE_TOP, + CE_OTHER_IS_SWITCHING); + CheckElementSideChange(x, y + 1, smashed, CH_SIDE_TOP, + CE_SWITCHED, -1); } } else @@ -7415,6 +7423,7 @@ int DigField(struct PlayerInfo *player, switch (element) { +#if 0 case EL_ROBOT_WHEEL: Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE; ZX = x; @@ -7423,7 +7432,9 @@ int DigField(struct PlayerInfo *player, PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING); return MF_ACTION; break; +#endif +#if 0 case EL_SP_TERMINAL: { int xx, yy; @@ -7444,7 +7455,9 @@ int DigField(struct PlayerInfo *player, return MF_ACTION; } break; +#endif +#if 0 case EL_CONVEYOR_BELT_1_SWITCH_LEFT: case EL_CONVEYOR_BELT_1_SWITCH_MIDDLE: case EL_CONVEYOR_BELT_1_SWITCH_RIGHT: @@ -7457,31 +7470,56 @@ int DigField(struct PlayerInfo *player, case EL_CONVEYOR_BELT_4_SWITCH_LEFT: case EL_CONVEYOR_BELT_4_SWITCH_MIDDLE: case EL_CONVEYOR_BELT_4_SWITCH_RIGHT: +#if 1 + if (!PLAYER_SWITCHING(player, x, y)) +#else if (!player->Switching) +#endif { player->Switching = TRUE; + player->switch_x = x; + player->switch_y = y; + ToggleBeltSwitch(x, y); PlaySoundLevel(x, y, SND_CLASS_CONVEYOR_BELT_SWITCH_ACTIVATING); } return MF_ACTION; break; +#endif +#if 0 case EL_SWITCHGATE_SWITCH_UP: case EL_SWITCHGATE_SWITCH_DOWN: +#if 1 + if (!PLAYER_SWITCHING(player, x, y)) +#else if (!player->Switching) +#endif { player->Switching = TRUE; + player->switch_x = x; + player->switch_y = y; + ToggleSwitchgateSwitch(x, y); PlaySoundLevel(x, y, SND_CLASS_SWITCHGATE_SWITCH_ACTIVATING); } return MF_ACTION; break; +#endif +#if 0 case EL_LIGHT_SWITCH: case EL_LIGHT_SWITCH_ACTIVE: +#if 1 + if (!PLAYER_SWITCHING(player, x, y)) +#else if (!player->Switching) +#endif { player->Switching = TRUE; + player->switch_x = x; + player->switch_y = y; + ToggleLightSwitch(x, y); PlaySoundLevel(x, y, element == EL_LIGHT_SWITCH ? SND_LIGHT_SWITCH_ACTIVATING : @@ -7489,14 +7527,18 @@ int DigField(struct PlayerInfo *player, } return MF_ACTION; break; +#endif +#if 0 case EL_TIMEGATE_SWITCH: ActivateTimegateSwitch(x, y); PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVATING); return MF_ACTION; break; +#endif +#if 0 case EL_BALLOON_SWITCH_LEFT: case EL_BALLOON_SWITCH_RIGHT: case EL_BALLOON_SWITCH_UP: @@ -7514,6 +7556,7 @@ int DigField(struct PlayerInfo *player, return MF_ACTION; break; +#endif case EL_SP_PORT_LEFT: case EL_SP_PORT_RIGHT: @@ -7606,6 +7649,7 @@ int DigField(struct PlayerInfo *player, } break; +#if 0 case EL_LAMP: Feld[x][y] = EL_LAMP_ACTIVE; local_player->lights_still_needed--; @@ -7613,7 +7657,9 @@ int DigField(struct PlayerInfo *player, PlaySoundLevel(x, y, SND_LAMP_ACTIVATING); return MF_ACTION; break; +#endif +#if 0 case EL_TIME_ORB_FULL: Feld[x][y] = EL_TIME_ORB_EMPTY; TimeLeft += 10; @@ -7622,6 +7668,7 @@ int DigField(struct PlayerInfo *player, PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MIDDLE); return MF_ACTION; break; +#endif default: @@ -7910,29 +7957,175 @@ int DigField(struct PlayerInfo *player, break; } - else + else if (IS_SWITCHABLE(element)) { + if (PLAYER_SWITCHING(player, x, y)) + return MF_ACTION; + #if 1 + PlaySoundLevelElementAction(x, y, element, ACTION_ACTIVATING); +#endif + + if (element == EL_ROBOT_WHEEL) + { + Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE; + ZX = x; + ZY = y; + + DrawLevelField(x, y); + +#if 0 + PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING); +#endif + } + else if (element == EL_SP_TERMINAL) + { + int xx, yy; + +#if 0 + PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVATING); +#endif + + for (yy=0; yySwitching = TRUE; + player->switch_x = x; + player->switch_y = y; + + ToggleBeltSwitch(x, y); + +#if 0 + PlaySoundLevel(x, y, SND_CLASS_CONVEYOR_BELT_SWITCH_ACTIVATING); +#endif + } + } + else if (element == EL_SWITCHGATE_SWITCH_UP || + element == EL_SWITCHGATE_SWITCH_DOWN) + { +#if 0 + if (!PLAYER_SWITCHING(player, x, y)) +#endif + { + player->Switching = TRUE; + player->switch_x = x; + player->switch_y = y; + + ToggleSwitchgateSwitch(x, y); + +#if 0 + PlaySoundLevel(x, y, SND_CLASS_SWITCHGATE_SWITCH_ACTIVATING); +#endif + } + } + else if (element == EL_LIGHT_SWITCH || + element == EL_LIGHT_SWITCH_ACTIVE) + { +#if 0 + if (!PLAYER_SWITCHING(player, x, y)) +#endif + { + player->Switching = TRUE; + player->switch_x = x; + player->switch_y = y; + + ToggleLightSwitch(x, y); + +#if 0 + PlaySoundLevel(x, y, element == EL_LIGHT_SWITCH ? + SND_LIGHT_SWITCH_ACTIVATING : + SND_LIGHT_SWITCH_DEACTIVATING); +#endif + } + } + else if (element == EL_TIMEGATE_SWITCH) + { + ActivateTimegateSwitch(x, y); + +#if 0 + PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVATING); +#endif + } + else if (element == EL_BALLOON_SWITCH_LEFT || + element == EL_BALLOON_SWITCH_RIGHT || + element == EL_BALLOON_SWITCH_UP || + element == EL_BALLOON_SWITCH_DOWN || + element == EL_BALLOON_SWITCH_ANY) + { + if (element == EL_BALLOON_SWITCH_ANY) + game.balloon_dir = move_direction; + else + game.balloon_dir = (element == EL_BALLOON_SWITCH_LEFT ? MV_LEFT : + element == EL_BALLOON_SWITCH_RIGHT ? MV_RIGHT : + element == EL_BALLOON_SWITCH_UP ? MV_UP : + element == EL_BALLOON_SWITCH_DOWN ? MV_DOWN : + MV_NO_MOVING); +#if 0 + PlaySoundLevel(x, y, SND_CLASS_BALLOON_SWITCH_ACTIVATING); +#endif + } + else if (element == EL_LAMP) + { + Feld[x][y] = EL_LAMP_ACTIVE; + local_player->lights_still_needed--; + + DrawLevelField(x, y); + +#if 0 + PlaySoundLevel(x, y, SND_LAMP_ACTIVATING); +#endif + } + else if (element == EL_TIME_ORB_FULL) + { + Feld[x][y] = EL_TIME_ORB_EMPTY; + TimeLeft += 10; + DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2); + + DrawLevelField(x, y); + +#if 0 + PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MIDDLE); +#endif + } + + return MF_ACTION; + } + else + { #if 1 + if (!PLAYER_SWITCHING(player, x, y)) +#else if (!player->Switching) +#endif { player->Switching = TRUE; + player->switch_x = x; + player->switch_y = y; + CheckTriggeredElementSideChange(x, y, element, dig_side, - CE_OTHER_GETS_SWITCHED); - CheckElementSideChange(x, y, element, dig_side, - CE_SWITCHED_BY_PLAYER, -1); + CE_OTHER_IS_SWITCHING); + CheckElementSideChange(x, y, element, dig_side, CE_SWITCHED, -1); } -#endif CheckTriggeredElementSideChange(x, y, element, dig_side, CE_OTHER_GETS_PRESSED); CheckElementSideChange(x, y, element, dig_side, CE_PRESSED_BY_PLAYER, -1); -#else - CheckTriggeredElementChange(x, y, element, CE_OTHER_GETS_PRESSED); - CheckElementChange(x, y, element, CE_PRESSED_BY_PLAYER); -#endif } return MF_NO_ACTION; diff --git a/src/main.h b/src/main.h index e860375c..985014ba 100644 --- a/src/main.h +++ b/src/main.h @@ -179,8 +179,8 @@ #define CE_LEFT_BY_PLAYER 22 #define CE_OTHER_GETS_ENTERED 23 #define CE_OTHER_GETS_LEFT 24 -#define CE_SWITCHED_BY_PLAYER 25 -#define CE_OTHER_GETS_SWITCHED 26 +#define CE_SWITCHED 25 +#define CE_OTHER_IS_SWITCHING 26 #define NUM_CHANGE_EVENTS 27 @@ -359,6 +359,9 @@ #define PLAYER_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \ PROTECTED_FIELD(x, y)) +#define PLAYER_SWITCHING(p,x,y) ((p)->Switching && \ + (p)->switch_x == (x) && (p)->switch_y == (y)) + #define PLAYER_NR_GFX(g,i) ((g) + i * (IMG_PLAYER_2 - IMG_PLAYER_1)) #define ANIM_FRAMES(g) (graphic_info[g].anim_frames) @@ -1138,6 +1141,8 @@ struct PlayerInfo boolean LevelSolved, GameOver; boolean snapped; + int switch_x, switch_y; + int last_move_dir; boolean is_moving; boolean is_waiting;