From: Holger Schemel Date: Sun, 10 Oct 1999 21:51:23 +0000 (+0200) Subject: rnd-19991010-2-src X-Git-Tag: 1.4.0^2~5 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=adaabca253f2e76597725cdc86fc1fff6f0de1d2;p=rocksndiamonds.git rnd-19991010-2-src --- diff --git a/src/editor.c b/src/editor.c index 379da414..212de031 100644 --- a/src/editor.c +++ b/src/editor.c @@ -751,7 +751,7 @@ int editor_element[] = EL_ERDREICH, EL_BETON, - EL_FELSBODEN, + EL_BD_WALL, EL_SIEB2_INAKTIV, EL_AUSGANG_ZU, EL_AUSGANG_AUF, @@ -759,7 +759,7 @@ int editor_element[] = EL_EDELSTEIN_BD, EL_BUTTERFLY_UP, EL_FIREFLY_UP, - EL_FELSBROCKEN, + EL_BD_ROCK, EL_BUTTERFLY_LEFT, EL_FIREFLY_LEFT, @@ -1153,7 +1153,7 @@ int editor_element[] = EL_TUBE_LEFT_UP, EL_TRAP_INACTIVE, - EL_LEERRAUM, + EL_DX_SUPABOMB, EL_LEERRAUM, EL_LEERRAUM, diff --git a/src/files.c b/src/files.c index fa40845e..ce0aff38 100644 --- a/src/files.c +++ b/src/files.c @@ -441,6 +441,17 @@ static void setLevelInfoToDefaults() } } +static int checkLevelElement(int element) +{ + if (element >= EL_FIRST_RUNTIME_EL) + { + Error(ERR_WARN, "invalid level element %d", element); + element = EL_CHAR_FRAGE; + } + + return element; +} + void LoadLevel(int level_nr) { int i, x, y; @@ -510,7 +521,7 @@ void LoadLevel(int level_nr) for(x=0; x<3; x++) { if (i < STD_ELEMENT_CONTENTS) - level.yam_content[i][x][y] = fgetc(file); + level.yam_content[i][x][y] = checkLevelElement(fgetc(file)); else level.yam_content[i][x][y] = EL_LEERRAUM; } @@ -520,7 +531,7 @@ void LoadLevel(int level_nr) level.amoeba_speed = fgetc(file); level.time_magic_wall = fgetc(file); level.time_wheel = fgetc(file); - level.amoeba_content = fgetc(file); + level.amoeba_content = checkLevelElement(fgetc(file)); level.double_speed = (fgetc(file) == 1 ? TRUE : FALSE); level.gravity = (fgetc(file) == 1 ? TRUE : FALSE); @@ -566,9 +577,10 @@ void LoadLevel(int level_nr) for(y=0; y<3; y++) for(x=0; x<3; x++) level.yam_content[i][x][y] = - (encoding_16bit ? - getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN) : - fgetc(file)); + checkLevelElement(encoding_16bit ? + getFile16BitInteger(file, + BYTE_ORDER_BIG_ENDIAN) : + fgetc(file)); getFileChunk(file, chunk, &chunk_length, BYTE_ORDER_BIG_ENDIAN); } @@ -591,9 +603,9 @@ void LoadLevel(int level_nr) for(y=0; y0 && IS_FREE(x-1, y) && @@ -2517,7 +2535,9 @@ void StartMoving(int x, int y) if (left || right) { - if (left && right && game.emulation != EMU_BOULDERDASH) + if (left && right && + (game.emulation != EMU_BOULDERDASH && + element != EL_BD_ROCK && element != EL_EDELSTEIN_BD)) left = !(right = RND(2)); InitMovingField(x, y, left ? MV_LEFT : MV_RIGHT); @@ -2539,7 +2559,8 @@ void StartMoving(int x, int y) { int newx, newy; - if ((element == EL_SONDE || element == EL_BALLOON) + if ((element == EL_SONDE || element == EL_BALLOON || + element == EL_SPRING_MOVING) && JustBeingPushed(x, y)) return; @@ -2868,6 +2889,8 @@ void ContinueMoving(int x, int y) else if (CAN_FALL(element) && horiz_move && y < lev_fieldy-1 && IS_BELT(Feld[x][y+1])) step /= 2; + else if (element == EL_SPRING_MOVING) + step*=2; #if OLD_GAME_BEHAVIOUR else if (CAN_FALL(element) && horiz_move && !IS_SP_ELEMENT(element)) @@ -3148,7 +3171,7 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element) if (done) PlaySoundLevel(ax, ay, - (new_element == EL_FELSBROCKEN ? SND_KLOPF : SND_PLING)); + (new_element == EL_BD_ROCK ? SND_KLOPF : SND_PLING)); } void AmoebeWaechst(int x, int y) @@ -3332,7 +3355,7 @@ void AmoebeAbleger(int ax, int ay) if (element == EL_AMOEBE_BD && AmoebaCnt2[new_group_nr] >= 200) { - AmoebeUmwandelnBD(newax, neway, EL_FELSBROCKEN); + AmoebeUmwandelnBD(newax, neway, EL_BD_ROCK); return; } } @@ -4162,7 +4185,7 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) { int el = Feld[jx+dx][jy]; int push_delay = (IS_SB_ELEMENT(el) || el == EL_SONDE ? 2 : - el == EL_BALLOON ? 0 : 10); + (el == EL_BALLOON || el == EL_SPRING) ? 0 : 10); if (tape.delay_played + push_delay >= tape.pos[tape.counter].delay) { @@ -5470,11 +5493,14 @@ int DigField(struct PlayerInfo *player, break; case EL_FELSBROCKEN: + case EL_BD_ROCK: case EL_BOMBE: + case EL_DX_SUPABOMB: case EL_KOKOSNUSS: case EL_ZEIT_LEER: case EL_SP_ZONK: case EL_SP_DISK_ORANGE: + case EL_SPRING: if (dy || mode == DF_SNAP) return MF_NO_ACTION; @@ -5492,16 +5518,22 @@ int DigField(struct PlayerInfo *player, if (player->push_delay == 0) player->push_delay = FrameCounter; if (!FrameReached(&player->push_delay, player->push_delay_value) && - !tape.playing) + !tape.playing && element != EL_SPRING) return MF_NO_ACTION; RemoveField(x, y); Feld[x+dx][y+dy] = element; - player->push_delay_value = 2+RND(8); + if (element == EL_SPRING) + { + Feld[x+dx][y+dy] = EL_SPRING_MOVING; + MovDir[x+dx][y+dy] = move_direction; + } + + player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8)); DrawLevelField(x+dx, y+dy); - if (element == EL_FELSBROCKEN) + if (element == EL_FELSBROCKEN || element == EL_BD_ROCK) PlaySoundLevel(x+dx, y+dy, SND_PUSCH); else if (element == EL_KOKOSNUSS) PlaySoundLevel(x+dx, y+dy, SND_KNURK); @@ -5696,7 +5728,6 @@ int DigField(struct PlayerInfo *player, case EL_SONDE: case EL_SP_DISK_YELLOW: case EL_BALLOON: - case EL_SPRING: if (mode == DF_SNAP) return MF_NO_ACTION; diff --git a/src/init.c b/src/init.c index 5a43f577..6276e5bc 100644 --- a/src/init.c +++ b/src/init.c @@ -898,6 +898,7 @@ void InitElementProperties() EL_MAUER_X, EL_MAUER_Y, EL_MAUER_XY, + EL_BD_WALL, EL_FELSBODEN, EL_AUSGANG_ZU, EL_AUSGANG_ACT, @@ -1093,7 +1094,9 @@ void InitElementProperties() static int ep_slippery[] = { EL_FELSBODEN, + EL_BD_WALL, EL_FELSBROCKEN, + EL_BD_ROCK, EL_EDELSTEIN, EL_EDELSTEIN_BD, EL_EDELSTEIN_GELB, @@ -1169,6 +1172,7 @@ void InitElementProperties() EL_MAUER_Y, EL_MAUER_XY, EL_MAUERND, + EL_BD_WALL, EL_SP_CHIP_SINGLE, EL_SP_CHIP_LEFT, EL_SP_CHIP_RIGHT, @@ -1207,6 +1211,7 @@ void InitElementProperties() static int ep_can_fall[] = { EL_FELSBROCKEN, + EL_BD_ROCK, EL_EDELSTEIN, EL_EDELSTEIN_BD, EL_EDELSTEIN_GELB, @@ -1226,13 +1231,15 @@ void InitElementProperties() EL_SP_DISK_ORANGE, EL_PEARL, EL_CRYSTAL, - EL_SPRING + EL_SPRING, + EL_DX_SUPABOMB }; static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int); static int ep_can_smash[] = { EL_FELSBROCKEN, + EL_BD_ROCK, EL_EDELSTEIN, EL_EDELSTEIN_BD, EL_EDELSTEIN_GELB, @@ -1256,13 +1263,16 @@ void InitElementProperties() EL_SP_INFOTRON, EL_SP_DISK_ORANGE, EL_PEARL, - EL_CRYSTAL + EL_CRYSTAL, + EL_SPRING, + EL_DX_SUPABOMB }; static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int); static int ep_can_change[] = { EL_FELSBROCKEN, + EL_BD_ROCK, EL_EDELSTEIN, EL_EDELSTEIN_BD, EL_EDELSTEIN_GELB, @@ -1289,7 +1299,8 @@ void InitElementProperties() EL_SONDE, EL_SP_SNIKSNAK, EL_SP_ELECTRON, - EL_BALLOON + EL_BALLOON, + EL_SPRING_MOVING }; static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int); @@ -1379,7 +1390,9 @@ void InitElementProperties() EL_LEERRAUM, EL_ERDREICH, EL_FELSBODEN, + EL_BD_WALL, EL_FELSBROCKEN, + EL_BD_ROCK, EL_EDELSTEIN_BD, EL_SIEB2_INAKTIV, EL_AUSGANG_ZU, @@ -1430,6 +1443,7 @@ void InitElementProperties() EL_LEERRAUM, EL_ERDREICH, EL_MAUERWERK, + EL_BD_WALL, EL_FELSBODEN, EL_SCHLUESSEL, EL_BETON, @@ -1583,7 +1597,8 @@ void InitElementProperties() EL_SP_DISK_ORANGE, EL_SP_DISK_YELLOW, EL_SP_SNIKSNAK, - EL_SP_ELECTRON + EL_SP_ELECTRON, + EL_DX_SUPABOMB }; static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int); @@ -1603,6 +1618,7 @@ void InitElementProperties() static int ep_pushable[] = { EL_FELSBROCKEN, + EL_BD_ROCK, EL_BOMBE, EL_KOKOSNUSS, EL_ZEIT_LEER, @@ -1613,7 +1629,8 @@ void InitElementProperties() EL_SP_DISK_ORANGE, EL_SP_DISK_YELLOW, EL_BALLOON, - EL_SPRING + EL_SPRING, + EL_DX_SUPABOMB }; static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int); diff --git a/src/main.c b/src/main.c index 6d4ece73..94287fa0 100644 --- a/src/main.c +++ b/src/main.c @@ -258,7 +258,7 @@ char *element_info[] = "dark yam yam", /* 60 */ "magic wall (BD style)", "invisible steel wall", - "dynabomb", + "-", "increases number of bombs", "increases explosion size", "increases power of explosion", @@ -300,8 +300,8 @@ char *element_info[] = "unknown", "unknown", "unknown", - "unknown", - "unknown", + "normal wall (BD style)", + "rock (BD style)", "open exit", "unknown", "amoeba", @@ -555,6 +555,7 @@ char *element_info[] = "tube (right & down)", "spring", "trap", + "stable bomb (DX style)", "-" /* diff --git a/src/main.h b/src/main.h index 66c7d05f..716ce292 100644 --- a/src/main.h +++ b/src/main.h @@ -180,13 +180,15 @@ typedef unsigned char byte; #define IS_BLOCKED(x,y) (Feld[x][y] == EL_BLOCKED) #define EL_CHANGED(e) ((e) == EL_FELSBROCKEN ? EL_EDELSTEIN : \ + (e) == EL_BD_ROCK ? EL_EDELSTEIN_BD : \ (e) == EL_EDELSTEIN ? EL_DIAMANT : \ (e) == EL_EDELSTEIN_GELB ? EL_DIAMANT : \ (e) == EL_EDELSTEIN_ROT ? EL_DIAMANT : \ (e) == EL_EDELSTEIN_LILA ? EL_DIAMANT : \ EL_FELSBROCKEN) #define EL_CHANGED2(e) ((e) == EL_FELSBROCKEN ? EL_EDELSTEIN_BD : \ - EL_FELSBROCKEN) + (e) == EL_BD_ROCK ? EL_EDELSTEIN_BD : \ + EL_BD_ROCK) #define IS_DRAWABLE(e) ((e) < EL_BLOCKED) #define IS_NOT_DRAWABLE(e) ((e) >= EL_BLOCKED) #define TAPE_IS_EMPTY(x) ((x).length == 0) @@ -754,14 +756,10 @@ extern char *element_info[]; #define EL_BADEWANNE3 102 #define EL_BADEWANNE4 103 #define EL_BADEWANNE5 104 - -#define EL_UNUSED_105 105 -#define EL_UNUSED_106 106 - +#define EL_BD_WALL 105 +#define EL_BD_ROCK 106 #define EL_AUSGANG_AUF 107 - #define EL_BLACK_ORB 108 - #define EL_AMOEBA2DIAM 109 #define EL_MOLE 110 #define EL_PINGUIN 111 @@ -986,6 +984,7 @@ extern char *element_info[]; #define EL_TUBE_RIGHT_DOWN 354 #define EL_SPRING 355 #define EL_TRAP_INACTIVE 356 +#define EL_DX_SUPABOMB 357 /* "real" (and therefore drawable) runtime elements */ #define EL_FIRST_RUNTIME_EL 500 @@ -1013,6 +1012,7 @@ extern char *element_info[]; #define EL_TIMEGATE_CLOSING 520 #define EL_PEARL_BREAKING 521 #define EL_TRAP_ACTIVE 522 +#define EL_SPRING_MOVING 523 /* "unreal" (and therefore not drawable) runtime elements */ #define EL_BLOCKED 600 @@ -1477,6 +1477,9 @@ extern char *element_info[]; #define GFX_TRAP_INACTIVE (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 4) #define GFX_TRAP_ACTIVE (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 7) +#define GFX_BD_WALL (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 4) +#define GFX_BD_ROCK (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 4) +#define GFX_DX_SUPABOMB (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 7) /* graphics from "RocksFont" */ #define GFX_CHAR_START (GFX_START_ROCKSFONT) diff --git a/src/tools.c b/src/tools.c index 57fb652d..e4ab11ab 100644 --- a/src/tools.c +++ b/src/tools.c @@ -645,7 +645,9 @@ void DrawPlayer(struct PlayerInfo *player) int element = Feld[next_jx][next_jy]; int graphic = el2gfx(element); - if ((element == EL_FELSBROCKEN || element == EL_SP_ZONK) && sxx) + if ((element == EL_FELSBROCKEN || + element == EL_SP_ZONK || + element == EL_BD_ROCK) && sxx) { int phase = (player->GfxPos / (TILEX / 4)); @@ -1170,12 +1172,16 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, { graphic += phase4; } - else if ((element == EL_FELSBROCKEN || element == EL_SP_ZONK || + else if ((element == EL_FELSBROCKEN || + element == EL_SP_ZONK || + element == EL_BD_ROCK || IS_GEM(element)) && !cut_mode) { if (uy >= lev_fieldy-1 || !IS_BELT(Feld[ux][uy+1])) { - if (element == EL_FELSBROCKEN || element == EL_SP_ZONK) + if (element == EL_FELSBROCKEN || + element == EL_SP_ZONK || + element == EL_BD_ROCK) { if (dir == MV_LEFT) graphic += (4 - phase4) % 4; @@ -2650,8 +2656,12 @@ int el2gfx(int element) case EL_TUBE_RIGHT_UP: return GFX_TUBE_RIGHT_UP; case EL_TUBE_RIGHT_DOWN: return GFX_TUBE_RIGHT_DOWN; case EL_SPRING: return GFX_SPRING; + case EL_SPRING_MOVING: return GFX_SPRING; case EL_TRAP_INACTIVE: return GFX_TRAP_INACTIVE; case EL_TRAP_ACTIVE: return GFX_TRAP_ACTIVE; + case EL_BD_WALL: return GFX_BD_WALL; + case EL_BD_ROCK: return GFX_BD_ROCK; + case EL_DX_SUPABOMB: return GFX_DX_SUPABOMB; default: {