rnd-19990214-1
authorHolger Schemel <info@artsoft.org>
Sun, 14 Feb 1999 01:09:56 +0000 (02:09 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:33:37 +0000 (10:33 +0200)
src/editor.c
src/game.c
src/init.c
src/main.h
src/tools.c

index b178476d195e7ebd05e7a537c5ac3bcc311bfc62..a2a9fbf1918af01129023ac80c843e9e2744d134 100644 (file)
@@ -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 },
index b233fa55c1ef299c7d1fe3976d5d91a94ddf784e..e70afad3b73a8ce6cdd64c2721c366cb664cf6c9 100644 (file)
@@ -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;
index e8de30a3d8ca3aee7fa33550b76cabdfbcc9fa8c..6935fc82d99c1a058fefa609ea009469a217618d 100644 (file)
@@ -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,
index 7fd5813671c838c6ef56564ab03e8e94c79f767e..ec429bfbffdc15bd954b50b79b1aa09aec8ac4ee 100644 (file)
@@ -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
index fba56ac5b1d331e7161e032f837d7e75db9c9413..4c74046cedcab26e3fd0cf3f886343b73fb99db3 100644 (file)
@@ -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:
     {