rnd-19990219-1
[rocksndiamonds.git] / src / game.c
index b510a0e56c72e434be4d71e74c6784d5e25acd3e..253827d31d7de1b3c315585d006cc1f198588ed1 100644 (file)
 #define DOUBLE_PLAYER_SPEED(p) (HALVE_MOVE_DELAY((p)->move_delay_value))
 #define HALVE_PLAYER_SPEED(p)  (DOUBLE_MOVE_DELAY((p)->move_delay_value))
 
-/* score for elements */
-#define SC_EDELSTEIN           0
-#define SC_DIAMANT             1
-#define SC_KAEFER              2
-#define SC_FLIEGER             3
-#define SC_MAMPFER             4
-#define SC_ROBOT               5
-#define SC_PACMAN              6
-#define SC_KOKOSNUSS           7
-#define SC_DYNAMIT             8
-#define SC_SCHLUESSEL          9
-#define SC_ZEITBONUS           10
-
 /* game button identifiers */
 #define GAME_CTRL_ID_STOP              0
 #define GAME_CTRL_ID_PAUSE             1
@@ -212,6 +199,7 @@ static void InitField(int x, int y, boolean init_game)
        if (!options.network || player->connected)
        {
          player->active = TRUE;
+         player->gone = FALSE;
 
          /* remove potentially duplicate players */
          if (StorePlayer[jx][jy] == Feld[x][y])
@@ -397,7 +385,7 @@ void InitGame()
 
     player->snapped = FALSE;
 
-    player->gone = FALSE;
+    player->gone = TRUE;
 
     player->last_jx = player->last_jy = 0;
     player->jx = player->jy = 0;
@@ -484,6 +472,7 @@ void InitGame()
        {
          player->present = TRUE;
          player->active = TRUE;
+         player->gone = FALSE;
          some_player->present = FALSE;
 
          StorePlayer[jx][jy] = player->element_nr;
@@ -508,6 +497,7 @@ void InitGame()
        int jx = player->jx, jy = player->jy;
 
        player->active = FALSE;
+       player->gone = TRUE;
        StorePlayer[jx][jy] = 0;
        Feld[jx][jy] = EL_LEERRAUM;
       }
@@ -529,6 +519,7 @@ void InitGame()
            int jx = player->jx, jy = player->jy;
 
            player->active = FALSE;
+           player->gone = TRUE;
            StorePlayer[jx][jy] = 0;
            Feld[jx][jy] = EL_LEERRAUM;
          }
@@ -606,24 +597,20 @@ void InitGame()
   DrawAllPlayers();
   FadeToFront();
 
-  XCopyArea(display, pix[PIX_DOOR], pix[PIX_DB_DOOR], gc,
-           DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
-           DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
-  DrawTextExt(pix[PIX_DB_DOOR], gc,
-             DOOR_GFX_PAGEX1 + XX_LEVEL, DOOR_GFX_PAGEY1 + YY_LEVEL,
-             int2str(level_nr, 2), FS_SMALL, FC_YELLOW);
-  DrawTextExt(pix[PIX_DB_DOOR], gc,
-             DOOR_GFX_PAGEX1 + XX_EMERALDS, DOOR_GFX_PAGEY1 + YY_EMERALDS,
-             int2str(local_player->gems_still_needed,3), FS_SMALL, FC_YELLOW);
-  DrawTextExt(pix[PIX_DB_DOOR], gc,
-             DOOR_GFX_PAGEX1 + XX_DYNAMITE, DOOR_GFX_PAGEY1 + YY_DYNAMITE,
-             int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW);
-  DrawTextExt(pix[PIX_DB_DOOR], gc,
-             DOOR_GFX_PAGEX1 + XX_SCORE, DOOR_GFX_PAGEY1 + YY_SCORE,
-             int2str(local_player->score, 5), FS_SMALL, FC_YELLOW);
-  DrawTextExt(pix[PIX_DB_DOOR], gc,
-             DOOR_GFX_PAGEX1 + XX_TIME, DOOR_GFX_PAGEY1 + YY_TIME,
-             int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
+  /* copy default game door content to main double buffer */
+  XCopyArea(display, pix[PIX_DOOR], drawto, gc,
+           DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+
+  DrawText(DX + XX_LEVEL, DY + YY_LEVEL,
+          int2str(level_nr, 2), FS_SMALL, FC_YELLOW);
+  DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS,
+          int2str(local_player->gems_still_needed,3), FS_SMALL, FC_YELLOW);
+  DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE,
+          int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW);
+  DrawText(DX + XX_SCORE, DY + YY_SCORE,
+          int2str(local_player->score, 5), FS_SMALL, FC_YELLOW);
+  DrawText(DX + XX_TIME, DY + YY_TIME,
+          int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
 
   UnmapGameButtons();
   game_gadget[SOUND_CTRL_ID_MUSIC]->checked = setup.sound_music;
@@ -632,12 +619,9 @@ void InitGame()
   MapGameButtons();
   MapTapeButtons();
 
-  /* copy actual game buttons to door double buffer for OpenDoor() */
+  /* copy actual game door content to door double buffer for OpenDoor() */
   XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
-           DX + GAME_CONTROL_XPOS, DY + GAME_CONTROL_YPOS,
-           GAME_CONTROL_XSIZE, 2 * GAME_CONTROL_YSIZE,
-           DOOR_GFX_PAGEX1 + GAME_CONTROL_XPOS,
-           DOOR_GFX_PAGEY1 + GAME_CONTROL_YPOS);
+           DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
 
   OpenDoor(DOOR_OPEN_ALL);