rnd-19980928-4
[rocksndiamonds.git] / src / events.c
index bde68249425127f49c3f6c81a68ee324611b6b41..ff86409e640952345561ebeacf78ece8163d1eb3 100644 (file)
@@ -180,8 +180,8 @@ void HandleExposeEvent(XExposeEvent *event)
   {
     int fx = FX, fy = FY;
 
-    fx += (local_player->MovDir & (MV_LEFT|MV_RIGHT) ? ScreenMovPos : 0);
-    fy += (local_player->MovDir & (MV_UP|MV_DOWN)    ? ScreenMovPos : 0);
+    fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
+    fy += (ScreenMovDir & (MV_UP|MV_DOWN)    ? ScreenGfxPos : 0);
 
     XCopyArea(display,fieldbuffer,backbuffer,gc,
              fx,fy, SXSIZE,SYSIZE,
@@ -268,20 +268,23 @@ void HandleButton(int mx, int my, int button)
   }
 
 #ifdef DEBUG
-  if (game_status == PLAYING && button)
+  if (game_status == PLAYING && !button)
   {
     int sx = (mx - SX) / TILEX;
     int sy = (my - SY) / TILEY;
 
-    if (IN_SCR_FIELD(sx,sy))
+    if (IN_VIS_FIELD(sx,sy))
     {
-      int x = UNSCROLLX(sx);
-      int y = UNSCROLLY(sy);
+      int x = LEVELX(sx);
+      int y = LEVELY(sy);
 
       printf("INFO: Feld[%d][%d] == %d\n", x,y, Feld[x][y]);
       printf("      Store[%d][%d] == %d\n", x,y, Store[x][y]);
       printf("      Store2[%d][%d] == %d\n", x,y, Store2[x][y]);
       printf("      StorePlayer[%d][%d] == %d\n", x,y, StorePlayer[x][y]);
+      printf("      MovPos[%d][%d] == %d\n", x,y, MovPos[x][y]);
+      printf("      MovDir[%d][%d] == %d\n", x,y, MovDir[x][y]);
+      printf("      MovDelay[%d][%d] == %d\n", x,y, MovDelay[x][y]);
       printf("\n");
     }
   }
@@ -664,6 +667,20 @@ void HandleKey(KeySym key, int key_status)
            printf("\n");
          }
 
+         break;
+
+       case XK_t:
+         {
+           char *color[] = { "yellow", "red", "green", "blue" };
+
+           do
+             TestPlayer = (TestPlayer + 1) % MAX_PLAYERS;
+           while(!stored_player[TestPlayer].active);
+
+           printf("TestPlayer = %d (%s player)\n",
+                  TestPlayer, color[TestPlayer]);
+         }
+
          break;
 #endif
 
@@ -711,7 +728,12 @@ void HandleJoystick()
 {
   int joystick = Joystick();
   int keyboard = key_joystick_mapping;
+
+  /*
   int joy      = (tape.playing ? TapePlayAction() : (joystick | keyboard));
+  */
+
+  int joy      = (joystick | keyboard);
   int left     = joy & JOY_LEFT;
   int right    = joy & JOY_RIGHT;
   int up       = joy & JOY_UP;