From: Holger Schemel Date: Sat, 27 Sep 2003 16:34:30 +0000 (+0200) Subject: rnd-20030927-2-src X-Git-Tag: 3.0.5^2~2 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=53745d86fbc455ad0ed5c8fb04f39ec3c3f04b14;p=rocksndiamonds.git rnd-20030927-2-src --- diff --git a/src/conf_fnt.c b/src/conf_fnt.c index ef44d538..764bec14 100644 --- a/src/conf_fnt.c +++ b/src/conf_fnt.c @@ -99,6 +99,10 @@ font_to_graphic[] = FONT_TEXT_2, GFX_SPECIAL_ARG_PREVIEW, IMG_FONT_TEXT_2_PREVIEW }, + { + FONT_TEXT_2, GFX_SPECIAL_ARG_PLAYING, + IMG_FONT_TEXT_2_PLAYING + }, { FONT_TEXT_2, GFX_SPECIAL_ARG_SCORES, IMG_FONT_TEXT_2_SCORES @@ -119,6 +123,10 @@ font_to_graphic[] = FONT_TEXT_3, GFX_SPECIAL_ARG_PREVIEW, IMG_FONT_TEXT_3_PREVIEW }, + { + FONT_TEXT_3, GFX_SPECIAL_ARG_PLAYING, + IMG_FONT_TEXT_3_PLAYING + }, { FONT_TEXT_3, GFX_SPECIAL_ARG_SCORES, IMG_FONT_TEXT_3_SCORES @@ -135,6 +143,10 @@ font_to_graphic[] = FONT_TEXT_4, GFX_SPECIAL_ARG_LEVELS, IMG_FONT_TEXT_4_LEVELS }, + { + FONT_TEXT_4, GFX_SPECIAL_ARG_PLAYING, + IMG_FONT_TEXT_4_PLAYING + }, { FONT_TEXT_4, GFX_SPECIAL_ARG_SCORES, IMG_FONT_TEXT_4_SCORES diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 72dd3bd1..46527737 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -3308,6 +3308,11 @@ struct ConfigInfo image_config[] = { "font.text_2.PREVIEW.y", "160" }, { "font.text_2.PREVIEW.width", "16" }, { "font.text_2.PREVIEW.height", "16" }, + { "font.text_2.PLAYING", "RocksFontEM.pcx" }, + { "font.text_2.PLAYING.x", "0" }, + { "font.text_2.PLAYING.y", "160" }, + { "font.text_2.PLAYING.width", "16" }, + { "font.text_2.PLAYING.height", "16" }, { "font.text_2.SCORES", "RocksFontBig.pcx" }, { "font.text_2.SCORES.x", "0" }, { "font.text_2.SCORES.y", "320" }, @@ -3333,6 +3338,11 @@ struct ConfigInfo image_config[] = { "font.text_3.PREVIEW.y", "160" }, { "font.text_3.PREVIEW.width", "16" }, { "font.text_3.PREVIEW.height", "16" }, + { "font.text_3.PLAYING", "RocksFontEM.pcx" }, + { "font.text_3.PLAYING.x", "0" }, + { "font.text_3.PLAYING.y", "160" }, + { "font.text_3.PLAYING.width", "16" }, + { "font.text_3.PLAYING.height", "16" }, { "font.text_3.SCORES", "RocksFontMedium.pcx" }, { "font.text_3.SCORES.x", "0" }, { "font.text_3.SCORES.y", "480" }, @@ -3353,6 +3363,11 @@ struct ConfigInfo image_config[] = { "font.text_4.LEVELS.y", "480" }, { "font.text_4.LEVELS.width", "16" }, { "font.text_4.LEVELS.height", "32" }, + { "font.text_4.PLAYING", "RocksFontEM.pcx" }, + { "font.text_4.PLAYING.x", "0" }, + { "font.text_4.PLAYING.y", "160" }, + { "font.text_4.PLAYING.width", "16" }, + { "font.text_4.PLAYING.height", "16" }, { "font.text_4.SCORES", "RocksFontMedium.pcx" }, { "font.text_4.SCORES.x", "0" }, { "font.text_4.SCORES.y", "480" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index cf51a444..b1688cfb 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1257,50 +1257,53 @@ #define IMG_FONT_TEXT_2 1236 #define IMG_FONT_TEXT_2_LEVELS 1237 #define IMG_FONT_TEXT_2_PREVIEW 1238 -#define IMG_FONT_TEXT_2_SCORES 1239 -#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1240 -#define IMG_FONT_TEXT_3 1241 -#define IMG_FONT_TEXT_3_LEVELS 1242 -#define IMG_FONT_TEXT_3_PREVIEW 1243 -#define IMG_FONT_TEXT_3_SCORES 1244 -#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1245 -#define IMG_FONT_TEXT_4 1246 -#define IMG_FONT_TEXT_4_LEVELS 1247 -#define IMG_FONT_TEXT_4_SCORES 1248 -#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1249 -#define IMG_FONT_INPUT_1 1250 -#define IMG_FONT_INPUT_1_MAIN 1251 -#define IMG_FONT_INPUT_1_ACTIVE 1252 -#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1253 -#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1254 -#define IMG_FONT_INPUT_2 1255 -#define IMG_FONT_INPUT_2_ACTIVE 1256 -#define IMG_FONT_OPTION_OFF 1257 -#define IMG_FONT_OPTION_ON 1258 -#define IMG_FONT_VALUE_1 1259 -#define IMG_FONT_VALUE_2 1260 -#define IMG_FONT_VALUE_OLD 1261 -#define IMG_FONT_LEVEL_NUMBER 1262 -#define IMG_FONT_TAPE_RECORDER 1263 -#define IMG_FONT_GAME_INFO 1264 -#define IMG_GLOBAL_BORDER 1265 -#define IMG_GLOBAL_DOOR 1266 -#define IMG_EDITOR_ELEMENT_BORDER 1267 -#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1268 -#define IMG_GAME_ENVELOPE_BACKGROUND 1269 -#define IMG_GAME_ENVELOPE_1_BACKGROUND 1270 -#define IMG_GAME_ENVELOPE_2_BACKGROUND 1271 -#define IMG_GAME_ENVELOPE_3_BACKGROUND 1272 -#define IMG_GAME_ENVELOPE_4_BACKGROUND 1273 -#define IMG_BACKGROUND 1274 -#define IMG_BACKGROUND_MAIN 1275 -#define IMG_BACKGROUND_LEVELS 1276 -#define IMG_BACKGROUND_SCORES 1277 -#define IMG_BACKGROUND_EDITOR 1278 -#define IMG_BACKGROUND_INFO 1279 -#define IMG_BACKGROUND_SETUP 1280 -#define IMG_BACKGROUND_DOOR 1281 +#define IMG_FONT_TEXT_2_PLAYING 1239 +#define IMG_FONT_TEXT_2_SCORES 1240 +#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1241 +#define IMG_FONT_TEXT_3 1242 +#define IMG_FONT_TEXT_3_LEVELS 1243 +#define IMG_FONT_TEXT_3_PREVIEW 1244 +#define IMG_FONT_TEXT_3_PLAYING 1245 +#define IMG_FONT_TEXT_3_SCORES 1246 +#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1247 +#define IMG_FONT_TEXT_4 1248 +#define IMG_FONT_TEXT_4_LEVELS 1249 +#define IMG_FONT_TEXT_4_PLAYING 1250 +#define IMG_FONT_TEXT_4_SCORES 1251 +#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1252 +#define IMG_FONT_INPUT_1 1253 +#define IMG_FONT_INPUT_1_MAIN 1254 +#define IMG_FONT_INPUT_1_ACTIVE 1255 +#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1256 +#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1257 +#define IMG_FONT_INPUT_2 1258 +#define IMG_FONT_INPUT_2_ACTIVE 1259 +#define IMG_FONT_OPTION_OFF 1260 +#define IMG_FONT_OPTION_ON 1261 +#define IMG_FONT_VALUE_1 1262 +#define IMG_FONT_VALUE_2 1263 +#define IMG_FONT_VALUE_OLD 1264 +#define IMG_FONT_LEVEL_NUMBER 1265 +#define IMG_FONT_TAPE_RECORDER 1266 +#define IMG_FONT_GAME_INFO 1267 +#define IMG_GLOBAL_BORDER 1268 +#define IMG_GLOBAL_DOOR 1269 +#define IMG_EDITOR_ELEMENT_BORDER 1270 +#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1271 +#define IMG_GAME_ENVELOPE_BACKGROUND 1272 +#define IMG_GAME_ENVELOPE_1_BACKGROUND 1273 +#define IMG_GAME_ENVELOPE_2_BACKGROUND 1274 +#define IMG_GAME_ENVELOPE_3_BACKGROUND 1275 +#define IMG_GAME_ENVELOPE_4_BACKGROUND 1276 +#define IMG_BACKGROUND 1277 +#define IMG_BACKGROUND_MAIN 1278 +#define IMG_BACKGROUND_LEVELS 1279 +#define IMG_BACKGROUND_SCORES 1280 +#define IMG_BACKGROUND_EDITOR 1281 +#define IMG_BACKGROUND_INFO 1282 +#define IMG_BACKGROUND_SETUP 1283 +#define IMG_BACKGROUND_DOOR 1284 -#define NUM_IMAGE_FILES 1282 +#define NUM_IMAGE_FILES 1285 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index 068d3fa4..5f389b34 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-09-27 11:36]" +#define COMPILE_DATE_STRING "[2003-09-27 18:33]" diff --git a/src/editor.c b/src/editor.c index 4a95e613..793ade1b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -950,7 +950,7 @@ static struct GADGET_ID_CHANGE_CONT_RND_DOWN, GADGET_ID_CHANGE_CONT_RND_UP, GADGET_ID_CHANGE_CONT_RND_TEXT, GADGET_ID_NONE, &custom_element_change.random, - NULL, "use random change:", "(%)" + NULL, "use random replace:", "%" }, }; @@ -1043,6 +1043,7 @@ static struct ValueTextInfo options_move_pattern[] = { MV_ALONG_RIGHT_SIDE, "along right side" }, { MV_TURNING_LEFT, "turning left" }, { MV_TURNING_RIGHT, "turning right" }, + { MV_WHEN_PUSHED, "when pushed" }, { -1, NULL } }; @@ -1104,20 +1105,20 @@ static struct ValueTextInfo options_consistency[] = static struct ValueTextInfo options_time_units[] = { - { FRAMES_PER_SECOND, "seconds" }, { 1, "frames" }, + { FRAMES_PER_SECOND, "seconds" }, { -1, NULL } }; static struct ValueTextInfo options_change_direct_action[] = { - { CE_TOUCHED_BY_PLAYER, "touched by player" }, - { CE_PRESSED_BY_PLAYER, "pressed by player" }, - { CE_PUSHED_BY_PLAYER, "pushed by player" }, + { CE_TOUCHED_BY_PLAYER, "touched by player ..." }, + { CE_PRESSED_BY_PLAYER, "pressed 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_COLLISION, "collision" }, + { CE_COLLISION, "collision ..." }, { CE_IMPACT, "impact" }, { CE_SMASHED, "smashed" }, { -1, NULL } @@ -1125,9 +1126,9 @@ static struct ValueTextInfo options_change_direct_action[] = static struct ValueTextInfo options_change_other_action[] = { - { CE_OTHER_GETS_TOUCHED, "player touches" }, - { CE_OTHER_GETS_PRESSED, "player presses" }, - { CE_OTHER_GETS_PUSHED, "player pushes" }, + { CE_OTHER_GETS_TOUCHED, "player touches ..." }, + { CE_OTHER_GETS_PRESSED, "player presses ..." }, + { CE_OTHER_GETS_PUSHED, "player pushes ..." }, { CE_OTHER_GETS_ENTERED, "player enters ..." }, { CE_OTHER_GETS_LEFT, "player leaves ..." }, { CE_OTHER_GETS_DIGGED, "player digs" }, @@ -1659,13 +1660,13 @@ static struct ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(11), GADGET_ID_CHANGE_ONLY_COMPLETE, GADGET_ID_NONE, &custom_element_change.only_complete, - NULL, "only use complete change", "only use complete extended content" + NULL, "replace all or nothing", "only replace when all can be changed" }, { ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(12), GADGET_ID_CHANGE_USE_RANDOM, GADGET_ID_NONE, &custom_element_change.use_random_change, - NULL, NULL, "use random value for new content" + NULL, NULL, "use percentage for random replace" }, { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(13), @@ -7571,10 +7572,12 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed) Request("Level has changed! Exit without saving ?", REQ_ASK | REQ_STAY_OPEN)) { +#if 1 CloseDoor(DOOR_CLOSE_1); - /* + SetDoorState(DOOR_CLOSE_2); +#else CloseDoor(DOOR_CLOSE_ALL); - */ +#endif game_status = GAME_MODE_MAIN; DrawMainMenu(); } diff --git a/src/files.c b/src/files.c index 3c26c22f..4dac3c11 100644 --- a/src/files.c +++ b/src/files.c @@ -34,8 +34,6 @@ #define LEVEL_CHUNK_CNT3_UNUSED 10 /* unused CNT3 chunk bytes */ #define LEVEL_CPART_CUS3_SIZE 134 /* size of CUS3 chunk part */ #define LEVEL_CPART_CUS3_UNUSED 15 /* unused CUS3 bytes / part */ -#define LEVEL_CPART_CUS4_SIZE ??? /* size of CUS4 chunk part */ -#define LEVEL_CPART_CUS4_UNUSED ??? /* unused CUS4 bytes / part */ #define TAPE_HEADER_SIZE 20 /* size of tape file header */ #define TAPE_HEADER_UNUSED 3 /* unused tape header bytes */ @@ -80,7 +78,7 @@ void setElementChangeInfoToDefaults(struct ElementChangeInfo *change) change->delay_fixed = 0; change->delay_random = 0; - change->delay_frames = -1; /* later set to reliable default value */ + change->delay_frames = 1; change->trigger_element = EL_EMPTY_SPACE; @@ -88,7 +86,7 @@ void setElementChangeInfoToDefaults(struct ElementChangeInfo *change) change->use_content = FALSE; change->only_complete = FALSE; change->use_random_change = FALSE; - change->random = 0; + change->random = 100; change->power = CP_NON_DESTRUCTIVE; for(x=0; x<3; x++) @@ -782,8 +780,13 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) change->can_change = getFile8Bit(file); + change->sides = getFile8Bit(file); + + if (change->sides == CH_SIDE_NONE) /* correct empty sides field */ + change->sides = CH_SIDE_ANY; + /* some free bytes for future change property values and padding */ - ReadUnusedBytesFromFile(file, 9); + ReadUnusedBytesFromFile(file, 8); } /* mark this custom element as modified */ @@ -1649,8 +1652,10 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) putFile8Bit(file, change->can_change); + putFile8Bit(file, change->sides); + /* some free bytes for future change property values and padding */ - WriteUnusedBytesToFile(file, 9); + WriteUnusedBytesToFile(file, 8); } } diff --git a/src/game.c b/src/game.c index 17eaef58..b73c4dc8 100644 --- a/src/game.c +++ b/src/game.c @@ -3649,6 +3649,13 @@ void TurnRound(int x, int y) MovDir[x][y] = old_move_dir; } } + else if (element_info[element].move_pattern == MV_WHEN_PUSHED) + { + if (!IN_LEV_FIELD_AND_IS_FREE(move_x, move_y)) + MovDir[x][y] = MV_NO_MOVING; + + MovDelay[x][y] = 0; + } } static boolean JustBeingPushed(int x, int y) @@ -3959,11 +3966,16 @@ void StartMoving(int x, int y) { int newx, newy; +#if 1 + if (IS_PUSHABLE(element) && JustBeingPushed(x, y)) + return; +#else if ((element == EL_SATELLITE || element == EL_BALLOON || element == EL_SPRING) && JustBeingPushed(x, y)) return; +#endif #if 0 #if 0 @@ -4496,7 +4508,7 @@ void ContinueMoving(int x, int y) Impact(x, newy); if (!IN_LEV_FIELD(nextx, nexty) || !IS_FREE(nextx, nexty)) - CheckElementChange(newx, newy, element, CE_COLLISION); + CheckElementSideChange(newx, newy, element, direction, CE_COLLISION, -1); #if 1 TestIfElementTouchesCustomElement(x, y); /* for empty space */ @@ -6815,6 +6827,14 @@ void TestIfPlayerTouchesCustomElement(int x, int y) { +1, 0 }, { 0, +1 } }; + static int change_sides[4][2] = + { + /* center side border side */ + { CH_SIDE_TOP, CH_SIDE_BOTTOM }, /* check top */ + { CH_SIDE_LEFT, CH_SIDE_RIGHT }, /* check left */ + { CH_SIDE_RIGHT, CH_SIDE_LEFT }, /* check right */ + { CH_SIDE_BOTTOM, CH_SIDE_TOP } /* check bottom */ + }; int i; #if 0 @@ -6828,10 +6848,30 @@ void TestIfPlayerTouchesCustomElement(int x, int y) { int xx = x + xy[i][0]; int yy = y + xy[i][1]; + int center_side = change_sides[i][0]; + int border_side = change_sides[i][1]; if (!IN_LEV_FIELD(xx, yy)) continue; +#if 1 + if (IS_PLAYER(x, y)) + { + CheckTriggeredElementSideChange(xx, yy, Feld[xx][yy], border_side, + CE_OTHER_GETS_TOUCHED); + CheckElementSideChange(xx, yy, Feld[xx][yy], border_side, + CE_TOUCHED_BY_PLAYER, -1); + } + else if (IS_PLAYER(xx, yy)) + { + CheckTriggeredElementSideChange(x, y, Feld[x][y], center_side, + CE_OTHER_GETS_TOUCHED); + CheckElementSideChange(x, y, Feld[x][y], center_side, + CE_TOUCHED_BY_PLAYER, -1); + + break; + } +#else if (IS_PLAYER(x, y)) { CheckTriggeredElementChange(xx, yy, Feld[xx][yy], CE_OTHER_GETS_TOUCHED); @@ -6844,6 +6884,7 @@ void TestIfPlayerTouchesCustomElement(int x, int y) break; } +#endif } #if 0 @@ -7277,16 +7318,13 @@ static boolean checkDiagonalPushing(struct PlayerInfo *player, int DigField(struct PlayerInfo *player, int x, int y, int real_dx, int real_dy, int mode) { -#if 0 - static int change_sides[4][2] = + static int change_sides[4] = { - /* enter side leave side */ - { CH_SIDE_RIGHT, CH_SIDE_LEFT }, /* moving left */ - { CH_SIDE_LEFT, CH_SIDE_RIGHT }, /* moving right */ - { CH_SIDE_BOTTOM, CH_SIDE_TOP }, /* moving up */ - { CH_SIDE_TOP, CH_SIDE_BOTTOM } /* moving down */ + CH_SIDE_RIGHT, /* moving left */ + CH_SIDE_LEFT, /* moving right */ + CH_SIDE_BOTTOM, /* moving up */ + CH_SIDE_TOP, /* moving down */ }; -#endif boolean use_spring_bug = (game.engine_version < VERSION_IDENT(2,2,0)); int jx = player->jx, jy = player->jy; int dx = x - jx, dy = y - jy; @@ -7295,10 +7333,7 @@ int DigField(struct PlayerInfo *player, dx == +1 ? MV_RIGHT : dy == -1 ? MV_UP : dy == +1 ? MV_DOWN : MV_NO_MOVING); -#if 0 - int enter_side = change_sides[MV_DIR_BIT(move_direction)][0]; - int leave_side = change_sides[MV_DIR_BIT(move_direction)][1]; -#endif + int dig_side = change_sides[MV_DIR_BIT(move_direction)]; int element; if (player->MovPos == 0) @@ -7762,9 +7797,22 @@ int DigField(struct PlayerInfo *player, !(element == EL_SPRING && use_spring_bug)) return MF_NO_ACTION; +#if 1 + /* + printf("::: %d [%d,%d,%d => %d]\n", MovDir[x][y], + CAN_MOVE(element), move_direction, getElementMoveStepsize(x, y), + (CAN_MOVE(element) && MovDir[x][y] == move_direction && + getElementMoveStepsize(x, y) > MOVE_STEPSIZE_NORMAL) ); + */ + + /* do not push elements already moving away faster than player */ + if (CAN_MOVE(element) && MovDir[x][y] == move_direction && + ABS(getElementMoveStepsize(x, y)) > MOVE_STEPSIZE_NORMAL) + return MF_NO_ACTION; +#else if (element == EL_SPRING && MovDir[x][y] != MV_NO_MOVING) return MF_NO_ACTION; - +#endif if (!player->Pushing && game.engine_version >= RELEASE_IDENT(2,2,0,7)) player->push_delay_value = GET_NEW_PUSH_DELAY(element); @@ -7837,15 +7885,29 @@ int DigField(struct PlayerInfo *player, if (game.engine_version < RELEASE_IDENT(2,2,0,7)) player->push_delay_value = GET_NEW_PUSH_DELAY(element); +#if 1 + CheckTriggeredElementSideChange(x, y, element, dig_side, + CE_OTHER_GETS_PUSHED); + CheckElementSideChange(x, y, element, dig_side, + CE_PUSHED_BY_PLAYER, -1); +#else CheckTriggeredElementChange(x, y, element, CE_OTHER_GETS_PUSHED); CheckElementChange(x, y, element, CE_PUSHED_BY_PLAYER); +#endif break; } else { +#if 1 + 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; @@ -7856,24 +7918,6 @@ int DigField(struct PlayerInfo *player, if (Feld[x][y] != element) /* really digged/collected something */ player->is_collecting = !player->is_digging; -#if 0 - if (IS_CUSTOM_ELEMENT(Feld[jx][jy])) - { - CheckTriggeredElementSideChange(jx, jy, Feld[jx][jy], leave_side, - CE_OTHER_GETS_LEFT); - CheckElementSideChange(jx, jy, Feld[jx][jy], leave_side, - CE_LEFT_BY_PLAYER, -1); - } - - if (IS_CUSTOM_ELEMENT(Feld[x][y])) - { - CheckTriggeredElementSideChange(x, y, Feld[x][y], enter_side, - CE_OTHER_GETS_ENTERED); - CheckElementSideChange(x, y, Feld[x][y], enter_side, - CE_ENTERED_BY_PLAYER, -1); - } -#endif - return MF_MOVING; } diff --git a/src/main.h b/src/main.h index ef941752..ef25bdde 100644 --- a/src/main.h +++ b/src/main.h @@ -204,6 +204,7 @@ (CH_EVENT_VAR(e) &= ~CH_EVENT_BIT(c))) : 0) /* values for change sides for custom elements */ +#define CH_SIDE_NONE MV_NO_MOVING #define CH_SIDE_LEFT MV_LEFT #define CH_SIDE_RIGHT MV_RIGHT #define CH_SIDE_TOP MV_UP @@ -224,6 +225,7 @@ #define MV_BIT_ALONG_RIGHT_SIDE 7 #define MV_BIT_TURNING_LEFT 8 #define MV_BIT_TURNING_RIGHT 9 +#define MV_BIT_WHEN_PUSHED 10 /* values for special move patterns for custom elements */ #define MV_HORIZONTAL (MV_LEFT | MV_RIGHT) @@ -236,6 +238,7 @@ #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) +#define MV_WHEN_PUSHED (1 << MV_BIT_WHEN_PUSHED) /* values for slippery property for custom elements */ #define SLIPPERY_ANY_RANDOM 0 diff --git a/src/screens.c b/src/screens.c index c119ff7c..54ba6a41 100644 --- a/src/screens.c +++ b/src/screens.c @@ -212,6 +212,7 @@ void DrawMainMenu() { game_status = GAME_MODE_EDITOR; DrawLevelEd(); + return; } diff --git a/src/tools.c b/src/tools.c index 4fdb4120..3f4cff15 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1599,6 +1599,170 @@ void DrawEnvelopeBackground(int envelope_nr, int startx, int starty, dst_x, dst_y); } +#if 1 + +void AnimateEnvelope(int envelope_nr) +{ +} + +void ShowEnvelope(int envelope_nr) +{ + int element = EL_ENVELOPE_1 + envelope_nr; + int graphic = IMG_GAME_ENVELOPE_1_BACKGROUND + envelope_nr; + int sound_opening = element_info[element].sound[ACTION_OPENING]; + int sound_closing = element_info[element].sound[ACTION_CLOSING]; + boolean draw_masked = graphic_info[graphic].draw_masked; + int anim_mode = graphic_info[graphic].anim_mode; + int mask_mode = (draw_masked ? BLIT_MASKED : BLIT_ON_BACKGROUND); + int font_nr = FONT_TEXT_1 + envelope_nr; + int font_width = getFontWidth(font_nr); + int font_height = getFontHeight(font_nr); + boolean ffwd_delay = (tape.playing && tape.fast_forward); + unsigned long anim_delay = 0; + int anim_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay); + int wait_delay_value = (ffwd_delay ? 500 : 1000); + int start_pos_vertically = 0; + int i, x, y; + + game.envelope_active = TRUE; + + if (anim_mode != ANIM_NONE) + PlaySoundStereo(sound_opening, SOUND_MIDDLE); + + if (anim_mode == ANIM_DEFAULT) + { + /* open envelope window horizontally */ + for (i = 0; i <= level.envelope_xsize[envelope_nr]; i++) + { + int xsize = i + 2; + int ysize = 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize, + font_nr); + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + WaitUntilDelayReached(&anim_delay, anim_delay_value / 2); + } + } + + if (anim_mode == ANIM_NONE) + start_pos_vertically = level.envelope_ysize[envelope_nr]; + + /* open envelope window vertically */ + for (i = start_pos_vertically; i <= level.envelope_ysize[envelope_nr]; i++) + { + int xsize = level.envelope_xsize[envelope_nr] + 2; + int ysize = i + 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize, + font_nr); + + DrawTextToTextArea(SX + startx + font_width, SY + starty + font_height, + level.envelope_text[envelope_nr], font_nr, + level.envelope_xsize[envelope_nr], i, mask_mode); + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + WaitUntilDelayReached(&anim_delay, anim_delay_value); + } + + if (tape.playing) + Delay(wait_delay_value); + else + WaitForEventToContinue(); + + if (anim_mode != ANIM_NONE) + PlaySoundStereo(sound_closing, SOUND_MIDDLE); + + if (anim_mode != ANIM_NONE) + { + /* close envelope window vertically */ + for (i = level.envelope_ysize[envelope_nr]; i >= 0; i--) + { + int xsize = level.envelope_xsize[envelope_nr] + 2; + int ysize = i + 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize, + font_nr); + + DrawTextToTextArea(SX + startx + font_width, SY + starty + font_height, + level.envelope_text[envelope_nr], font_nr, + level.envelope_xsize[envelope_nr], i, mask_mode); + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + WaitUntilDelayReached(&anim_delay, anim_delay_value); + } + } + + if (anim_mode == ANIM_DEFAULT) + { + /* close envelope window horizontally */ + for (i = level.envelope_xsize[envelope_nr]; i >= 0; i--) + { + int xsize = i + 2; + int ysize = 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize, + font_nr); + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + WaitUntilDelayReached(&anim_delay, anim_delay_value / 2); + } + } + + game.envelope_active = FALSE; + + SetDrawtoField(DRAW_BUFFERED); + + redraw_mask |= REDRAW_FIELD; + BackToFront(); +} + +#else + void ShowEnvelope(int envelope_nr) { int element = EL_ENVELOPE_1 + envelope_nr; @@ -1755,6 +1919,8 @@ void ShowEnvelope(int envelope_nr) BackToFront(); } +#endif + void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { Bitmap *src_bitmap = graphic_info[graphic].bitmap; @@ -2352,7 +2518,7 @@ unsigned int MoveDoor(unsigned int door_state) static int door1 = DOOR_OPEN_1; static int door2 = DOOR_CLOSE_2; unsigned long door_delay = 0; - unsigned long door_delay_value = door_1.step_delay; + unsigned long door_delay_value; int stepsize = 1; if (door_state == DOOR_GET_STATE) @@ -2377,6 +2543,9 @@ unsigned int MoveDoor(unsigned int door_state) else if (door2 == DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2) door_state &= ~DOOR_CLOSE_2; + door_delay_value = (door_state & DOOR_ACTION_1 ? door_1.step_delay : + door_2.step_delay); + if (setup.quick_doors) { stepsize = 20; /* must be choosen to always draw last frame */