From: Holger Schemel Date: Sun, 14 Mar 1999 01:17:28 +0000 (+0100) Subject: rnd-19990314-1-src X-Git-Tag: 1.4.0^2~33 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=776100a335243955272732ccba109d366e0ba3fd;p=rocksndiamonds.git rnd-19990314-1-src --- diff --git a/src/editor.c b/src/editor.c index 856523de..bf51938f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -811,8 +811,8 @@ int editor_element[] = EL_MORAST_LEER, EL_MORAST_VOLL, - EL_DYNAMIT_AUS, - EL_DYNAMIT, + EL_DYNAMITE_INACTIVE, + EL_DYNAMITE_ACTIVE, EL_AUSGANG_ZU, EL_AUSGANG_AUF, @@ -2467,7 +2467,7 @@ static void DrawPropertiesWindow() { EL_PACMAN_L, &level.score[SC_PACMAN], TEXT_SMASHING }, { EL_PACMAN_U, &level.score[SC_PACMAN], TEXT_SMASHING }, { EL_KOKOSNUSS, &level.score[SC_KOKOSNUSS], TEXT_CRACKING }, - { EL_DYNAMIT_AUS, &level.score[SC_DYNAMIT], TEXT_COLLECTING }, + { EL_DYNAMITE_INACTIVE,&level.score[SC_DYNAMIT], TEXT_COLLECTING }, { EL_SCHLUESSEL1, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING }, { EL_SCHLUESSEL2, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING }, { EL_SCHLUESSEL3, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING }, diff --git a/src/game.c b/src/game.c index b4e3fc97..1fbb21a5 100644 --- a/src/game.c +++ b/src/game.c @@ -280,7 +280,7 @@ static void InitField(int x, int y, boolean init_game) } break; - case EL_DYNAMIT: + case EL_DYNAMITE_ACTIVE: MovDelay[x][y] = 96; break; @@ -359,7 +359,7 @@ void InitGame() player->dynamite = 0; player->dynabomb_count = 0; - player->dynabomb_size = 0; + player->dynabomb_size = 1; player->dynabombs_left = 0; player->dynabomb_xl = FALSE; @@ -1054,7 +1054,7 @@ void DrawDynamite(int x, int y) if (Store[x][y]) DrawGraphic(sx, sy, el2gfx(Store[x][y])); - if (Feld[x][y] == EL_DYNAMIT) + if (Feld[x][y] == EL_DYNAMITE_ACTIVE) { if ((phase = (96 - MovDelay[x][y]) / 12) > 6) phase = 6; @@ -1083,10 +1083,13 @@ void CheckDynamite(int x, int y) if (!(MovDelay[x][y] % 12)) PlaySoundLevel(x, y, SND_ZISCH); - if (Feld[x][y] == EL_DYNAMIT && !(MovDelay[x][y] % 12)) - DrawDynamite(x, y); - else if (Feld[x][y] == EL_DYNABOMB && !(MovDelay[x][y] % 6)) - DrawDynamite(x, y); + if (IS_ACTIVE_BOMB(Feld[x][y])) + { + int delay = (Feld[x][y] == EL_DYNAMITE_ACTIVE ? 12 : 6); + + if (!(MovDelay[x][y] % delay)) + DrawDynamite(x, y); + } return; } @@ -1127,8 +1130,8 @@ void Explode(int ex, int ey, int phase, int mode) if (!IN_LEV_FIELD(x, y) || IS_MASSIVE(element) || element == EL_BURNING) continue; - if ((mode!=EX_NORMAL || center_element == EL_AMOEBA2DIAM) && - (x!=ex || y!=ey)) + if ((mode != EX_NORMAL || center_element == EL_AMOEBA2DIAM) && + (x != ex || y != ey)) continue; if (element == EL_EXPLODING) @@ -1277,7 +1280,9 @@ void Explode(int ex, int ey, int phase, int mode) void DynaExplode(int ex, int ey) { int i, j; - struct PlayerInfo *player = &stored_player[Store2[ex][ey] - EL_SPIELER1]; + int dynabomb_size = 1; + boolean dynabomb_xl = FALSE; + struct PlayerInfo *player; static int xy[4][2] = { { 0, -1 }, @@ -1286,16 +1291,22 @@ void DynaExplode(int ex, int ey) { 0, +1 } }; - Store2[ex][ey] = 0; /* delete player information */ + if (IS_ACTIVE_BOMB(Feld[ex][ey])) + { + player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_ACTIVE_1]; + dynabomb_size = player->dynabomb_size; + dynabomb_xl = player->dynabomb_xl; + player->dynabombs_left++; + } Explode(ex, ey, EX_PHASE_START, EX_CENTER); for (i=0; i<4; i++) { - for (j=1; j<=player->dynabomb_size; j++) + for (j=1; j<=dynabomb_size; j++) { - int x = ex+j*xy[i%4][0]; - int y = ey+j*xy[i%4][1]; + int x = ex + j * xy[i % 4][0]; + int y = ey + j * xy[i % 4][1]; int element; if (!IN_LEV_FIELD(x, y) || IS_MASSIVE(Feld[x][y])) @@ -1307,12 +1318,10 @@ void DynaExplode(int ex, int ey) if (element != EL_LEERRAUM && element != EL_ERDREICH && element != EL_EXPLODING && - !player->dynabomb_xl) + !dynabomb_xl) break; } } - - player->dynabombs_left++; } void Bang(int x, int y) @@ -1340,7 +1349,10 @@ void Bang(int x, int y) RaiseScoreElement(element); Explode(x, y, EX_PHASE_START, EX_NORMAL); break; - case EL_DYNABOMB: + case EL_DYNABOMB_ACTIVE_1: + case EL_DYNABOMB_ACTIVE_2: + case EL_DYNABOMB_ACTIVE_3: + case EL_DYNABOMB_ACTIVE_4: case EL_DYNABOMB_NR: case EL_DYNABOMB_SZ: case EL_DYNABOMB_XL: @@ -3579,7 +3591,7 @@ void GameActions() } else if (IS_MOVING(x, y)) ContinueMoving(x, y); - else if (element == EL_DYNAMIT || element == EL_DYNABOMB) + else if (IS_ACTIVE_BOMB(element)) CheckDynamite(x, y); else if (element == EL_EXPLODING) Explode(x, y, Frame[x][y], EX_NORMAL); @@ -4385,11 +4397,11 @@ int DigField(struct PlayerInfo *player, PlaySoundLevel(x, y, SND_PONG); break; - case EL_DYNAMIT_AUS: + case EL_DYNAMITE_INACTIVE: case EL_SP_DISK_RED: RemoveField(x, y); player->dynamite++; - RaiseScoreElement(EL_DYNAMIT); + RaiseScoreElement(EL_DYNAMITE_INACTIVE); DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); @@ -4403,21 +4415,21 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->dynabomb_count++; player->dynabombs_left++; - RaiseScoreElement(EL_DYNAMIT); + RaiseScoreElement(EL_DYNAMITE_INACTIVE); PlaySoundLevel(x, y, SND_PONG); break; case EL_DYNABOMB_SZ: RemoveField(x, y); player->dynabomb_size++; - RaiseScoreElement(EL_DYNAMIT); + RaiseScoreElement(EL_DYNAMITE_INACTIVE); PlaySoundLevel(x, y, SND_PONG); break; case EL_DYNABOMB_XL: RemoveField(x, y); player->dynabomb_xl = TRUE; - RaiseScoreElement(EL_DYNAMIT); + RaiseScoreElement(EL_DYNAMITE_INACTIVE); PlaySoundLevel(x, y, SND_PONG); break; @@ -4794,8 +4806,7 @@ boolean PlaceBomb(struct PlayerInfo *player) element = Feld[jx][jy]; if ((player->dynamite == 0 && player->dynabombs_left == 0) || - element == EL_DYNAMIT || element == EL_DYNABOMB || - element == EL_EXPLODING) + IS_ACTIVE_BOMB(element) || element == EL_EXPLODING) return FALSE; if (element != EL_LEERRAUM) @@ -4803,7 +4814,7 @@ boolean PlaceBomb(struct PlayerInfo *player) if (player->dynamite) { - Feld[jx][jy] = EL_DYNAMIT; + Feld[jx][jy] = EL_DYNAMITE_ACTIVE; MovDelay[jx][jy] = 96; player->dynamite--; DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3), @@ -4818,8 +4829,7 @@ boolean PlaceBomb(struct PlayerInfo *player) } else { - Feld[jx][jy] = EL_DYNABOMB; - Store2[jx][jy] = player->element_nr; /* for DynaExplode() */ + Feld[jx][jy] = EL_DYNABOMB_ACTIVE_1 + (player->element_nr - EL_SPIELER1); MovDelay[jx][jy] = 96; player->dynabombs_left--; if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) @@ -4909,7 +4919,7 @@ void RaiseScoreElement(int element) case EL_KOKOSNUSS: RaiseScore(level.score[SC_KOKOSNUSS]); break; - case EL_DYNAMIT: + case EL_DYNAMITE_INACTIVE: RaiseScore(level.score[SC_DYNAMIT]); break; case EL_SCHLUESSEL: diff --git a/src/init.c b/src/init.c index 85339702..4f18c12a 100644 --- a/src/init.c +++ b/src/init.c @@ -1313,7 +1313,7 @@ void InitElementProperties() EL_EM_GATE_2X, EL_EM_GATE_3X, EL_EM_GATE_4X, - EL_DYNAMIT_AUS, + EL_DYNAMITE_INACTIVE, EL_UNSICHTBAR, EL_BIRNE_AUS, EL_BIRNE_EIN, @@ -1379,9 +1379,12 @@ void InitElementProperties() static int ep_explosive[] = { EL_BOMBE, - EL_DYNAMIT, - EL_DYNAMIT_AUS, - EL_DYNABOMB, + EL_DYNAMITE_ACTIVE, + EL_DYNAMITE_INACTIVE, + EL_DYNABOMB_ACTIVE_1, + EL_DYNABOMB_ACTIVE_2, + EL_DYNABOMB_ACTIVE_3, + EL_DYNABOMB_ACTIVE_4, EL_DYNABOMB_NR, EL_DYNABOMB_SZ, EL_DYNABOMB_XL, @@ -1538,6 +1541,16 @@ void InitElementProperties() }; static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int); + static int ep_active_bomb[] = + { + EL_DYNAMITE_ACTIVE, + EL_DYNABOMB_ACTIVE_1, + EL_DYNABOMB_ACTIVE_2, + EL_DYNABOMB_ACTIVE_3, + EL_DYNABOMB_ACTIVE_4 + }; + static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int); + static long ep_bit[] = { EP_BIT_AMOEBALIVE, @@ -1569,7 +1582,8 @@ void InitElementProperties() EP_BIT_EATABLE, EP_BIT_SP_ELEMENT, EP_BIT_QUICK_GATE, - EP_BIT_OVER_PLAYER + EP_BIT_OVER_PLAYER, + EP_BIT_ACTIVE_BOMB }; static int *ep_array[] = { @@ -1602,7 +1616,8 @@ void InitElementProperties() ep_eatable, ep_sp_element, ep_quick_gate, - ep_over_player + ep_over_player, + ep_active_bomb }; static int *ep_num[] = { @@ -1635,7 +1650,8 @@ void InitElementProperties() &ep_eatable_num, &ep_sp_element_num, &ep_quick_gate_num, - &ep_over_player_num + &ep_over_player_num, + &ep_active_bomb_num }; static int num_properties = sizeof(ep_num)/sizeof(int *); diff --git a/src/main.h b/src/main.h index 0a52d8f5..726e58ac 100644 --- a/src/main.h +++ b/src/main.h @@ -126,6 +126,7 @@ typedef unsigned char byte; #define EP_BIT_SP_ELEMENT (1 << 28) #define EP_BIT_QUICK_GATE (1 << 29) #define EP_BIT_OVER_PLAYER (1 << 30) +#define EP_BIT_ACTIVE_BOMB (1 << 31) #define IS_AMOEBALIVE(e) (Elementeigenschaften[e] & EP_BIT_AMOEBALIVE) #define IS_AMOEBOID(e) (Elementeigenschaften[e] & EP_BIT_AMOEBOID) @@ -158,6 +159,7 @@ typedef unsigned char byte; #define IS_SP_ELEMENT(e) (Elementeigenschaften[e] & EP_BIT_SP_ELEMENT) #define IS_QUICK_GATE(e) (Elementeigenschaften[e] & EP_BIT_QUICK_GATE) #define IS_OVER_PLAYER(e) (Elementeigenschaften[e] & EP_BIT_OVER_PLAYER) +#define IS_ACTIVE_BOMB(e) (Elementeigenschaften[e] & EP_BIT_ACTIVE_BOMB) #define IS_PLAYER(x,y) (ELEM_IS_PLAYER(StorePlayer[x][y])) @@ -600,7 +602,7 @@ extern char *element_info[]; #define EL_KOKOSNUSS 25 #define EL_LIFE 26 #define EL_LIFE_ASYNC 27 -#define EL_DYNAMIT 28 +#define EL_DYNAMITE_ACTIVE 28 #define EL_BADEWANNE 29 #define EL_ABLENK_AUS 30 #define EL_ABLENK_EIN 31 @@ -616,7 +618,7 @@ extern char *element_info[]; #define EL_PFORTE2X 41 #define EL_PFORTE3X 42 #define EL_PFORTE4X 43 -#define EL_DYNAMIT_AUS 44 +#define EL_DYNAMITE_INACTIVE 44 #define EL_PACMAN 45 #define EL_UNSICHTBAR 46 #define EL_BIRNE_AUS 47 @@ -635,7 +637,9 @@ extern char *element_info[]; #define EL_MAMPFER2 60 #define EL_SIEB2_INAKTIV 61 #define EL_INVISIBLE_STEEL 62 -#define EL_DYNABOMB 63 + +#define EL_UNUSED_63 63 + #define EL_DYNABOMB_NR 64 #define EL_DYNABOMB_SZ 65 #define EL_DYNABOMB_XL 66 @@ -823,6 +827,10 @@ extern char *element_info[]; #define EL_EM_KEY_2 310 #define EL_EM_KEY_3 311 #define EL_EM_KEY_4 312 +#define EL_DYNABOMB_ACTIVE_1 313 +#define EL_DYNABOMB_ACTIVE_2 314 +#define EL_DYNABOMB_ACTIVE_3 315 +#define EL_DYNABOMB_ACTIVE_4 316 /* "unreal" (and therefore not drawable) runtime elements */ #define EL_BLOCKED 400 diff --git a/src/tools.c b/src/tools.c index a946e4b3..a5224ae1 100644 --- a/src/tools.c +++ b/src/tools.c @@ -489,7 +489,7 @@ void DrawPlayer(struct PlayerInfo *player) DrawLevelElement(last_jx, last_jy, Store[last_jx][last_jy]); DrawLevelFieldThruMask(last_jx, last_jy); } - else if (last_element == EL_DYNAMIT) + else if (last_element == EL_DYNAMITE_ACTIVE) DrawDynamite(last_jx, last_jy); else DrawLevelField(last_jx, last_jy); @@ -518,7 +518,7 @@ void DrawPlayer(struct PlayerInfo *player) if (Store[jx][jy]) DrawLevelElement(jx, jy, Store[jx][jy]); - else if (element != EL_DYNAMIT && element != EL_DYNABOMB) + else if (!IS_ACTIVE_BOMB(element)) DrawLevelField(jx, jy); /* draw player himself */ @@ -631,13 +631,13 @@ void DrawPlayer(struct PlayerInfo *player) } } - /* draw things in front of player (EL_DYNAMIT or EL_DYNABOMB) */ + /* draw things in front of player (active dynamite or dynabombs) */ - if (element == EL_DYNAMIT || element == EL_DYNABOMB) + if (IS_ACTIVE_BOMB(element)) { graphic = el2gfx(element); - if (element == EL_DYNAMIT) + if (element == EL_DYNAMITE_ACTIVE) { if ((phase = (96 - MovDelay[jx][jy]) / 12) > 6) phase = 6; @@ -2332,7 +2332,7 @@ int el2gfx(int element) case EL_KOKOSNUSS: return GFX_KOKOSNUSS; case EL_LIFE: return GFX_LIFE; case EL_LIFE_ASYNC: return GFX_LIFE_ASYNC; - case EL_DYNAMIT: return GFX_DYNAMIT; + case EL_DYNAMITE_ACTIVE: return GFX_DYNAMIT; case EL_BADEWANNE: return GFX_BADEWANNE; case EL_BADEWANNE1: return GFX_BADEWANNE1; case EL_BADEWANNE2: return GFX_BADEWANNE2; @@ -2353,7 +2353,7 @@ int el2gfx(int element) case EL_PFORTE2X: return GFX_PFORTE2X; case EL_PFORTE3X: return GFX_PFORTE3X; case EL_PFORTE4X: return GFX_PFORTE4X; - case EL_DYNAMIT_AUS: return GFX_DYNAMIT_AUS; + case EL_DYNAMITE_INACTIVE: return GFX_DYNAMIT_AUS; case EL_PACMAN: return GFX_PACMAN; case EL_PACMAN_R: return GFX_PACMAN_R; case EL_PACMAN_O: return GFX_PACMAN_O; @@ -2383,7 +2383,10 @@ int el2gfx(int element) case EL_SIEB2_LEER: return GFX_SIEB2_LEER; case EL_SIEB2_VOLL: return GFX_SIEB2_VOLL; case EL_SIEB2_TOT: return GFX_SIEB2_TOT; - case EL_DYNABOMB: return GFX_DYNABOMB; + case EL_DYNABOMB_ACTIVE_1: return GFX_DYNABOMB; + case EL_DYNABOMB_ACTIVE_2: return GFX_DYNABOMB; + case EL_DYNABOMB_ACTIVE_3: return GFX_DYNABOMB; + case EL_DYNABOMB_ACTIVE_4: return GFX_DYNABOMB; case EL_DYNABOMB_NR: return GFX_DYNABOMB_NR; case EL_DYNABOMB_SZ: return GFX_DYNABOMB_SZ; case EL_DYNABOMB_XL: return GFX_DYNABOMB_XL;