From 84c20a81b20d9a4017f7691dda78fc3b6f2dedf5 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 14 Feb 1999 02:09:56 +0100 Subject: [PATCH] rnd-19990214-1 --- src/editor.c | 17 ++++++++++--- src/game.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++- src/init.c | 14 ++++++++++- src/main.h | 12 ++++++--- src/tools.c | 8 ++++++ 5 files changed, 111 insertions(+), 10 deletions(-) diff --git a/src/editor.c b/src/editor.c index b178476d..a2a9fbf1 100644 --- a/src/editor.c +++ b/src/editor.c @@ -776,10 +776,10 @@ int editor_element[] = EL_AMOEBE_NASS, EL_AMOEBE_NORM, - EL_SCHLUESSEL1, - EL_SCHLUESSEL2, - EL_SCHLUESSEL3, - EL_SCHLUESSEL4, + EL_EM_KEY_1_FILE, + EL_EM_KEY_2_FILE, + EL_EM_KEY_3_FILE, + EL_EM_KEY_4_FILE, EL_EM_GATE_1, EL_EM_GATE_2, @@ -796,6 +796,11 @@ int editor_element[] = EL_CHAR('R'), EL_CHAR('E'), + EL_SCHLUESSEL1, + EL_SCHLUESSEL2, + EL_SCHLUESSEL3, + EL_SCHLUESSEL4, + EL_PFORTE1, EL_PFORTE2, EL_PFORTE3, @@ -2328,6 +2333,10 @@ static void DrawPropertiesWindow() { EL_SCHLUESSEL2, &level.score[9], TEXT_COLLECTING }, { EL_SCHLUESSEL3, &level.score[9], TEXT_COLLECTING }, { EL_SCHLUESSEL4, &level.score[9], TEXT_COLLECTING }, + { EL_EM_KEY_1_FILE, &level.score[9], TEXT_COLLECTING }, + { EL_EM_KEY_2_FILE, &level.score[9], TEXT_COLLECTING }, + { EL_EM_KEY_3_FILE, &level.score[9], TEXT_COLLECTING }, + { EL_EM_KEY_4_FILE, &level.score[9], TEXT_COLLECTING }, { EL_AMOEBE_NASS, &level.tempo_amoebe, TEXT_SPEED }, { EL_AMOEBE_NORM, &level.tempo_amoebe, TEXT_SPEED }, { EL_AMOEBE_VOLL, &level.tempo_amoebe, TEXT_SPEED }, diff --git a/src/game.c b/src/game.c index b233fa55..e70afad3 100644 --- a/src/game.c +++ b/src/game.c @@ -312,6 +312,19 @@ static void InitField(int x, int y, boolean init_game) Feld[x][y] = EL_LEERRAUM; break; + case EL_EM_KEY_1_FILE: + Feld[x][y] = EL_EM_KEY_1; + break; + case EL_EM_KEY_2_FILE: + Feld[x][y] = EL_EM_KEY_2; + break; + case EL_EM_KEY_3_FILE: + Feld[x][y] = EL_EM_KEY_3; + break; + case EL_EM_KEY_4_FILE: + Feld[x][y] = EL_EM_KEY_4; + break; + default: break; } @@ -974,6 +987,29 @@ int MovingOrBlocked2Element(int x, int y) return element; } +static int MovingOrBlocked2ElementIfNotLeaving(int x, int y) +{ + /* like MovingOrBlocked2Element(), but if element is moving + and (x,y) is the field the moving element is just leaving, + return EL_BLOCKED instead of the element value */ + int element = Feld[x][y]; + + if (IS_MOVING(x, y)) + { + if (element == EL_BLOCKED) + { + int oldx, oldy; + + Blocked2Moving(x, y, &oldx, &oldy); + return Feld[oldx][oldy]; + } + else + return EL_BLOCKED; + } + else + return element; +} + static void RemoveField(int x, int y) { Feld[x][y] = EL_LEERRAUM; @@ -1535,6 +1571,10 @@ void Impact(int x, int y) case EL_SCHLUESSEL2: case EL_SCHLUESSEL3: case EL_SCHLUESSEL4: + case EL_EM_KEY_1: + case EL_EM_KEY_2: + case EL_EM_KEY_3: + case EL_EM_KEY_4: sound = SND_KINK; break; case EL_ZEIT_VOLL: @@ -3850,7 +3890,11 @@ boolean MoveFigureOneStep(struct PlayerInfo *player, if (!options.network && !AllPlayersInSight(player, new_jx, new_jy)) return MF_NO_ACTION; +#if 0 element = MovingOrBlocked2Element(new_jx, new_jy); +#else + element = MovingOrBlocked2ElementIfNotLeaving(new_jx, new_jy); +#endif if (DONT_GO_TO(element)) { @@ -4177,7 +4221,11 @@ void TestIfGoodThingHitsBadThing(int goodx, int goody) if (!IN_LEV_FIELD(x, y)) continue; +#if 0 element = Feld[x][y]; +#else + element = MovingOrBlocked2ElementIfNotLeaving(x, y); +#endif if (DONT_TOUCH(element)) { @@ -4472,7 +4520,27 @@ int DigField(struct PlayerInfo *player, case EL_SCHLUESSEL3: case EL_SCHLUESSEL4: { - int key_nr = element-EL_SCHLUESSEL1; + int key_nr = element - EL_SCHLUESSEL1; + + RemoveField(x, y); + player->key[key_nr] = TRUE; + RaiseScoreElement(EL_SCHLUESSEL); + DrawMiniGraphicExt(drawto, gc, + DX_KEYS+key_nr*MINI_TILEX, DY_KEYS, + GFX_SCHLUESSEL1+key_nr); + DrawMiniGraphicExt(window, gc, + DX_KEYS+key_nr*MINI_TILEX, DY_KEYS, + GFX_SCHLUESSEL1+key_nr); + PlaySoundLevel(x, y, SND_PONG); + break; + } + + case EL_EM_KEY_1: + case EL_EM_KEY_2: + case EL_EM_KEY_3: + case EL_EM_KEY_4: + { + int key_nr = element - EL_EM_KEY_1; RemoveField(x, y); player->key[key_nr] = TRUE; diff --git a/src/init.c b/src/init.c index e8de30a3..6935fc82 100644 --- a/src/init.c +++ b/src/init.c @@ -876,7 +876,11 @@ void InitElementProperties() EL_SCHLUESSEL1, EL_SCHLUESSEL2, EL_SCHLUESSEL3, - EL_SCHLUESSEL4 + EL_SCHLUESSEL4, + EL_EM_KEY_1, + EL_EM_KEY_2, + EL_EM_KEY_3, + EL_EM_KEY_4 }; static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int); @@ -1131,6 +1135,10 @@ void InitElementProperties() EL_SCHLUESSEL2, EL_SCHLUESSEL3, EL_SCHLUESSEL4, + EL_EM_KEY_1, + EL_EM_KEY_2, + EL_EM_KEY_3, + EL_EM_KEY_4, EL_BOMBE, EL_KOKOSNUSS, EL_TROPFEN, @@ -1318,6 +1326,10 @@ void InitElementProperties() EL_SCHLUESSEL2, EL_SCHLUESSEL3, EL_SCHLUESSEL4, + EL_EM_KEY_1, + EL_EM_KEY_2, + EL_EM_KEY_3, + EL_EM_KEY_4, EL_PFORTE1, EL_PFORTE2, EL_PFORTE3, diff --git a/src/main.h b/src/main.h index 7fd58136..ec429bfb 100644 --- a/src/main.h +++ b/src/main.h @@ -689,7 +689,7 @@ extern char *element_info[]; #define EL_SCHWEIN 117 #define EL_DRACHE 118 -#define EL_UNUSED_119 119 +#define EL_EM_KEY_1_FILE 119 #define EL_CHAR_START 120 #define EL_CHAR_ASCII0 (EL_CHAR_START-32) @@ -739,9 +739,9 @@ extern char *element_info[]; #define EL_EM_GATE_3 205 #define EL_EM_GATE_4 206 -#define EL_UNUSED_207 207 -#define EL_UNUSED_208 208 -#define EL_UNUSED_209 209 +#define EL_EM_KEY_2_FILE 207 +#define EL_EM_KEY_3_FILE 208 +#define EL_EM_KEY_4_FILE 209 #define EL_SP_START 210 #define EL_SP_EMPTY (EL_SP_START + 0) @@ -804,6 +804,10 @@ extern char *element_info[]; #define EL_AUSGANG_ACT 306 #define EL_SP_TERMINAL_ACTIVE 307 #define EL_SP_BUG_ACTIVE 308 +#define EL_EM_KEY_1 309 +#define EL_EM_KEY_2 310 +#define EL_EM_KEY_3 311 +#define EL_EM_KEY_4 312 /* "unreal" (and therefore not drawable) runtime elements */ #define EL_BLOCKED 400 diff --git a/src/tools.c b/src/tools.c index fba56ac5..4c74046c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2757,6 +2757,14 @@ int el2gfx(int element) case EL_EM_GATE_2X: return GFX_EM_GATE_2X; case EL_EM_GATE_3X: return GFX_EM_GATE_3X; case EL_EM_GATE_4X: return GFX_EM_GATE_4X; + case EL_EM_KEY_1_FILE: return GFX_EM_KEY_1; + case EL_EM_KEY_2_FILE: return GFX_EM_KEY_2; + case EL_EM_KEY_3_FILE: return GFX_EM_KEY_3; + case EL_EM_KEY_4_FILE: return GFX_EM_KEY_4; + case EL_EM_KEY_1: return GFX_EM_KEY_1; + case EL_EM_KEY_2: return GFX_EM_KEY_2; + case EL_EM_KEY_3: return GFX_EM_KEY_3; + case EL_EM_KEY_4: return GFX_EM_KEY_4; default: { -- 2.34.1