rnd-19980813-1
authorHolger Schemel <info@artsoft.org>
Wed, 12 Aug 1998 23:43:58 +0000 (01:43 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:30:21 +0000 (10:30 +0200)
src/cartoons.c
src/events.c
src/files.h
src/game.c
src/main.h
src/screens.c
src/screens.h
src/tools.c

index 7cc59d1a05454557a136b2b6629c245993a87473..1c193f6f689ae3b334210ee8ed3c04b27530df27 100644 (file)
@@ -139,12 +139,17 @@ void HandleAnimation(int mode)
        SetDrawtoField(DRAW_DIRECT);
       }
 
+      if (soft_scrolling_on && game_status==PLAYING)
+       XCopyArea(display,fieldbuffer,backbuffer,gc,
+                 FX,FY, SXSIZE,SYSIZE,
+                 SX,SY);
+
       return;
       break;
     case ANIM_CONTINUE:
       break;
     case ANIM_STOP:
-      redraw_mask |= REDRAW_FIELD;
+      redraw_mask |= (REDRAW_FIELD | REDRAW_FROM_BACKBUFFER);
 
       /* Redraw background even when in direct drawing mode */
       draw_mode = direct_draw_on;
index ed43f4ec90d015436452eb51ec7fd486ad17c093..1b77ca40cbdd515890660201aae94fc01dc4fa6f 100644 (file)
@@ -160,6 +160,11 @@ void HandleExposeEvent(XExposeEvent *event)
     SetDrawtoField(DRAW_DIRECT);
   }
 
+  if (soft_scrolling_on && game_status==PLAYING)
+    XCopyArea(display,fieldbuffer,backbuffer,gc,
+             FX,FY, SXSIZE,SYSIZE,
+             SX,SY);
+
   XCopyArea(display,drawto,window,gc, x,y, width,height, x,y);
 
   XFlush(display);
@@ -202,6 +207,7 @@ void HandleFocusEvent(XFocusChangeEvent *event)
     XAutoRepeatOn(display);
     old_joystick_status = joystick_status;
     joystick_status = JOYSTICK_OFF;
+    key_joystick_mapping = 0;
   }
   else if (event->type == FocusIn)
   {
index 1489d289300dfca7bcdd79506fe6b3b2cc24c2f4..e34532a171087f7b1e870a5bb5dcc63e893b2510 100644 (file)
@@ -32,6 +32,7 @@
 #define SETUP_2ND_JOYSTICK             (1<<7)
 #define SETUP_QUICK_DOORS              (1<<8)
 #define SETUP_SCROLL_DELAY             (1<<9)
+#define SETUP_SOFT_SCROLL              (1<<10)
 
 #define DEFAULT_SETUP                  (SETUP_TOONS |          \
                                         SETUP_SOUND |          \
@@ -49,6 +50,7 @@
 #define SETUP_2ND_JOYSTICK_ON(x)       (((x) & SETUP_2ND_JOYSTICK) != 0)
 #define SETUP_QUICK_DOORS_ON(x)                (((x) & SETUP_QUICK_DOORS) != 0)
 #define SETUP_SCROLL_DELAY_ON(x)       (((x) & SETUP_SCROLL_DELAY) != 0)
+#define SETUP_SOFT_SCROLL_ON(x)                (((x) & SETUP_SOFT_SCROLL) != 0)
 
 BOOL CreateNewScoreFile(void);
 BOOL CreateNewNamesFile(int);
index dbc5458281c82836719c2db85724588faebd3b11..01d6b72cc2d7df39362f53fe104ae13062ed4192 100644 (file)
@@ -49,6 +49,7 @@ void GetPlayerConfig()
   joystick_nr = SETUP_2ND_JOYSTICK_ON(player.setup);
   quick_doors = SETUP_QUICK_DOORS_ON(player.setup);
   scroll_delay_on = SETUP_SCROLL_DELAY_ON(player.setup);
+  soft_scrolling_on = SETUP_SOFT_SCROLL_ON(player.setup);
 
   if (joystick_nr != old_joystick_nr)
   {
@@ -74,6 +75,7 @@ void InitGame()
   FrameCounter = 0;
   TimeFrames = 0;
   TimeLeft = level.time;
+  ScreenMovPos = 0;
   PlayerMovDir = MV_NO_MOVING;
   PlayerMovPos = 0;
   PlayerFrame = 0;
@@ -2751,6 +2753,9 @@ void GameActions()
   */
 
 
+  DrawPlayerField();
+
+
   BackToFront();
 }
 
@@ -2869,6 +2874,7 @@ BOOL MoveFigureOneStep(int dx, int dy, int real_dx, int real_dy)
 BOOL MoveFigure(int dx, int dy)
 {
   static long move_delay = 0;
+  static int last_move_dir = MV_NO_MOVING;
   int moved = MF_NO_ACTION;
   int oldJX = JX, oldJY = JY;
 
@@ -2901,6 +2907,22 @@ BOOL MoveFigure(int dx, int dy)
       return(FALSE);
   }
 
+
+  if (last_move_dir & (MV_LEFT | MV_RIGHT))
+  {
+    if (!(moved |= MoveFigureOneStep(0,dy, dx,dy)))
+      moved |= MoveFigureOneStep(dx,0, dx,dy);
+  }
+  else
+  {
+    if (!(moved |= MoveFigureOneStep(dx,0, dx,dy)))
+      moved |= MoveFigureOneStep(0,dy, dx,dy);
+  }
+
+  last_move_dir = MV_NO_MOVING;
+
+
+  /*
   if (moved |= MoveFigureOneStep(dx,0, dx,dy))
     moved |= MoveFigureOneStep(0,dy, dx,dy);
   else
@@ -2908,6 +2930,7 @@ BOOL MoveFigure(int dx, int dy)
     moved |= MoveFigureOneStep(0,dy, dx,dy);
     moved |= MoveFigureOneStep(dx,0, dx,dy);
   }
+  */
 
   if (moved & MF_MOVING)
   {
@@ -2938,6 +2961,8 @@ BOOL MoveFigure(int dx, int dy)
       PlayerMovDir = (oldJY < JY ? MV_DOWN : MV_UP);
 
     DrawLevelField(JX,JY);     /* für "ErdreichAnbroeckeln()" */
+
+    last_move_dir = PlayerMovDir;
   }
 
   TestIfHeroHitsBadThing();
@@ -2961,6 +2986,8 @@ void ScrollFigure(int init)
   {
     if (PlayerMovPos && oldX != -1 && oldY != -1)
     {
+      if (Feld[JX2][JY2] == EL_LEERRAUM)
+       Feld[JX2][JY2] = EL_UNSICHTBAR;
       DrawLevelElement(oldX,oldY, Feld[oldX][oldY]);
       DrawPlayerField();
     }
@@ -2969,8 +2996,10 @@ void ScrollFigure(int init)
     oldY = JY2;
     actual_frame_counter = FrameCounter;
 
+    /*
     redraw[redraw_x1 + oldX][redraw_y1 + oldY] = 1;
     redraw_tiles++;
+    */
 
     /*
     DrawLevelElement(oldX,oldY, Feld[oldX][oldY]);
@@ -2991,6 +3020,9 @@ void ScrollFigure(int init)
     redraw_mask |= REDRAW_FIELD;
   }
 
+  if (Feld[oldX][oldY] == EL_UNSICHTBAR)
+    Feld[oldX][oldY] = EL_LEERRAUM;
+
   DrawLevelElement(oldX,oldY, Feld[oldX][oldY]);
   DrawPlayerField();
 
index 4bdf70f1f85a64c4134e9d6f3817e80ce0e7b427..90dcd6d2672a2feb1f827e4bd0c4efb06e390d23 100644 (file)
@@ -67,11 +67,12 @@ typedef int BOOL;
 #define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2)
 #define IN_LEV_FIELD(x,y) ((x)>=0 && (x)<lev_fieldx && (y)>=0 &&(y)<lev_fieldy)
 
-/*
+
 #define IS_PLAYER(x,y)         (JX==(x) && JY==(y))
-*/
 
+/*
 #define IS_PLAYER(x,y)         ((JX==(x) && JY==(y)) || (JX2==(x) && JY2==(y)))
+*/
 
 #define IS_FREE(x,y)           (Feld[x][y]==EL_LEERRAUM && !IS_PLAYER(x,y))
 #define IS_FREE_OR_PLAYER(x,y) (Feld[x][y]==EL_LEERRAUM)
@@ -996,6 +997,7 @@ extern char         *progname;
 #define REDRAW_VIDEO_2         (1L<<5)
 #define REDRAW_VIDEO_3         (1L<<6)
 #define REDRAW_MICROLEV                (1L<<7)
+#define REDRAW_FROM_BACKBUFFER (1L<<8)
 #define REDRAW_DOOR_2  (REDRAW_VIDEO_1 | REDRAW_VIDEO_2 | REDRAW_VIDEO_3)
 #define REDRAW_DOORS   (REDRAW_DOOR_1 | REDRAW_DOOR_2)
 #define REDRAW_MAIN    (REDRAW_FIELD | REDRAW_TILES | REDRAW_MICROLEV)
index bfb4f117b707be67777870a00a0a1845a6880bfc..50d6506a4974ec64ec2eecd943a058a32e8aea52 100644 (file)
@@ -892,6 +892,7 @@ void DrawSetupScreen()
     {SETUP_TOONS,      "Toons:",       {"on", "off"},  {FC_YELLOW,FC_BLUE}},
     {SETUP_DIRECT_DRAW,        "Buffered gfx:",{"off","on" },  {FC_BLUE,FC_YELLOW}},
     {SETUP_SCROLL_DELAY,"Scroll Delay:",{"on", "off"}, {FC_YELLOW,FC_BLUE}},
+    {SETUP_SOFT_SCROLL,        "Soft Scroll.:",{"on", "off"},  {FC_YELLOW,FC_BLUE}},
     {SETUP_FADING,     "Fading:",      {"on", "off"},  {FC_YELLOW,FC_BLUE}},
     {SETUP_QUICK_DOORS,        "Quick Doors:", {"on", "off"},  {FC_YELLOW,FC_BLUE}},
     {SETUP_AUTO_RECORD,        "Auto-Record:", {"on", "off"},  {FC_YELLOW,FC_BLUE}},
@@ -1054,6 +1055,14 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
        player.setup ^= SETUP_SCROLL_DELAY;
       }
       else if (y==9)
+      {
+       if (SETUP_SOFT_SCROLL_ON(player.setup))
+         DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
+       else
+         DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
+       player.setup ^= SETUP_SOFT_SCROLL;
+      }
+      else if (y==10)
       {
        if (SETUP_FADING_ON(player.setup))
          DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
@@ -1061,7 +1070,7 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
          DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
        player.setup ^= SETUP_FADING;
       }
-      else if (y==10)
+      else if (y==11)
       {
        if (SETUP_QUICK_DOORS_ON(player.setup))
          DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
@@ -1069,7 +1078,7 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
          DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
        player.setup ^= SETUP_QUICK_DOORS;
       }
-      else if (y==11)
+      else if (y==12)
       {
        if (SETUP_AUTO_RECORD_ON(player.setup))
          DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
@@ -1077,7 +1086,7 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
          DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
        player.setup ^= SETUP_AUTO_RECORD;
       }
-      else if (y==12)
+      else if (y==13)
       {
        if (SETUP_2ND_JOYSTICK_ON(player.setup))
          DrawText(SX+14*32, SY+yy*32,"1st",FS_BIG,FC_YELLOW);
@@ -1085,7 +1094,7 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
          DrawText(SX+14*32, SY+yy*32,"2nd",FS_BIG,FC_YELLOW);
        player.setup ^= SETUP_2ND_JOYSTICK;
       }
-      else if (y==13)
+      else if (y==14)
       {
        CalibrateJoystick();
        redraw = TRUE;
index a9c5f72e41a1f98b27c1131ffee7900b47e6f6d3..a21dd5982c18e5860156d4c6eacd8e0e892cbf2d 100644 (file)
@@ -18,7 +18,7 @@
 #include "main.h"
 
 #define SETUP_SCREEN_POS_START         2
-#define SETUP_SCREEN_POS_END           15
+#define SETUP_SCREEN_POS_END           16
 #define SETUP_SCREEN_POS_EMPTY         (SETUP_SCREEN_POS_END - 2)
 
 void DrawHeadline(void);
index e020340b43dc2ac4c404d2826dc431ad20abc36d..bbf81e33053eeda7654a7ab8b7020b01a196f332 100644 (file)
@@ -143,7 +143,7 @@ void BackToFront()
     int fx = FX + (PlayerMovDir & (MV_LEFT|MV_RIGHT) ? ScreenMovPos : 0);
     int fy = FY + (PlayerMovDir & (MV_UP|MV_DOWN)    ? ScreenMovPos : 0);
 
-    if (game_status == PLAYING)
+    if (game_status == PLAYING && !(redraw_mask & REDRAW_FROM_BACKBUFFER))
     {
       XCopyArea(display,buffer,window,gc,
                fx,fy, SXSIZE,SYSIZE,
@@ -386,10 +386,16 @@ void DrawPlayerField()
   if (PlayerGone)
     return;
 
+  /*
+  printf("INFO: DrawPlayerField(): x = %d, y = %d\n",x,y);
+  */
+
+
 #if DEBUG
   if (!IN_LEV_FIELD(x,y) || !IN_SCR_FIELD(sx,sy))
   {
     printf("DrawPlayerField(): x = %d, y = %d\n",x,y);
+    printf("DrawPlayerField(): sx = %d, sy = %d\n",sx,sy);
     printf("DrawPlayerField(): This should never happen!\n");
     return;
   }
@@ -1126,7 +1132,12 @@ void DrawLevel()
     for(y=BY1; y<=BY2; y++)
       DrawScreenField(x,y);
 
-  redraw_mask |= REDRAW_FIELD;
+  if (soft_scrolling_on)
+    XCopyArea(display,fieldbuffer,backbuffer,gc,
+             FX,FY, SXSIZE,SYSIZE,
+             SX,SY);
+
+  redraw_mask |= (REDRAW_FIELD | REDRAW_FROM_BACKBUFFER);
 }
 
 void DrawMiniLevel(int scroll_x, int scroll_y)