rnd-20001203-3-src
authorHolger Schemel <info@artsoft.org>
Sun, 3 Dec 2000 16:26:57 +0000 (17:26 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:35:22 +0000 (10:35 +0200)
15 files changed:
src/init.c
src/libgame/gadgets.c
src/libgame/gadgets.h
src/libgame/libgame.h
src/libgame/misc.c
src/libgame/msdos.c
src/libgame/system.c
src/libgame/system.h
src/libgame/text.c
src/libgame/types.h
src/main.c
src/main.h
src/tape.c
src/tape.h
src/tools.c

index 08bbb05bdfe968f051c0a73041496c48d4c5bb0b..241849cef7285e13a119562ecbef5195d5767b8b 100644 (file)
@@ -420,13 +420,13 @@ void InitGfx()
   };
 #endif
 
-  /* initialize playfield properties */
+  /* initialize screen properties */
 
-  InitPlayfieldInfo(SX, SY, SXSIZE, SYSIZE,
-                   REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
-  InitDoor1Info(DX, DY, DXSIZE, DYSIZE);
-  InitDoor2Info(VX, VY, VXSIZE, VYSIZE);
-  InitScrollbufferInfo(FXSIZE, FYSIZE);
+  InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
+                  REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+  InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
+  InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
+  InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
 
   /* create additional image buffers for double-buffering */
 
index 9827fc80a12fe09e2b541589eefd16900759501a..aeb5ec9cbeee81e88136c84a43d63fa0c2d338ac 100644 (file)
 
 #include "libgame.h"
 
+#if 0
 #include "main_TMP.h"
+#endif
 
 #include "gadgets.h"
 
-/* some positions in the video tape control window */
-#define VIDEO_DATE_LABEL_XPOS  (VIDEO_DISPLAY1_XPOS)
-#define VIDEO_DATE_LABEL_YPOS  (VIDEO_DISPLAY1_YPOS)
-#define VIDEO_DATE_LABEL_XSIZE (VIDEO_DISPLAY_XSIZE)
-#define VIDEO_DATE_LABEL_YSIZE (VIDEO_DISPLAY_YSIZE)
-#define VIDEO_DATE_XPOS                (VIDEO_DISPLAY1_XPOS + 1)
-#define VIDEO_DATE_YPOS                (VIDEO_DISPLAY1_YPOS + 14)
-#define VIDEO_DATE_XSIZE       (VIDEO_DISPLAY_XSIZE)
-#define VIDEO_DATE_YSIZE       16
-#define VIDEO_REC_LABEL_XPOS   (VIDEO_DISPLAY2_XPOS)
-#define VIDEO_REC_LABEL_YPOS   (VIDEO_DISPLAY2_YPOS)
-#define VIDEO_REC_LABEL_XSIZE  20
-#define VIDEO_REC_LABEL_YSIZE  12
-#define VIDEO_REC_SYMBOL_XPOS  (VIDEO_DISPLAY2_XPOS + 20)
-#define VIDEO_REC_SYMBOL_YPOS  (VIDEO_DISPLAY2_YPOS)
-#define VIDEO_REC_SYMBOL_XSIZE 16
-#define VIDEO_REC_SYMBOL_YSIZE 16
-#define VIDEO_PLAY_LABEL_XPOS  (VIDEO_DISPLAY2_XPOS + 65)
-#define VIDEO_PLAY_LABEL_YPOS  (VIDEO_DISPLAY2_YPOS)
-#define VIDEO_PLAY_LABEL_XSIZE 22
-#define VIDEO_PLAY_LABEL_YSIZE 12
-#define VIDEO_PLAY_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS + 52)
-#define VIDEO_PLAY_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS)
-#define VIDEO_PLAY_SYMBOL_XSIZE        11
-#define VIDEO_PLAY_SYMBOL_YSIZE        13
-#define VIDEO_PAUSE_LABEL_XPOS (VIDEO_DISPLAY2_XPOS)
-#define VIDEO_PAUSE_LABEL_YPOS (VIDEO_DISPLAY2_YPOS + 20)
-#define VIDEO_PAUSE_LABEL_XSIZE        35
-#define VIDEO_PAUSE_LABEL_YSIZE        8
-#define VIDEO_PAUSE_SYMBOL_XPOS        (VIDEO_DISPLAY2_XPOS + 35)
-#define VIDEO_PAUSE_SYMBOL_YPOS        (VIDEO_DISPLAY2_YPOS)
-#define VIDEO_PAUSE_SYMBOL_XSIZE 17
-#define VIDEO_PAUSE_SYMBOL_YSIZE 13
-#define VIDEO_TIME_XPOS                (VIDEO_DISPLAY2_XPOS + 38)
-#define VIDEO_TIME_YPOS                (VIDEO_DISPLAY2_YPOS + 14)
-#define VIDEO_TIME_XSIZE       50
-#define VIDEO_TIME_YSIZE       16
-
-/* special */
-#define VIDEO_PBEND_LABEL_XPOS 6
-#define VIDEO_PBEND_LABEL_YPOS 220
-#define VIDEO_PBEND_LABEL_XSIZE        35
-#define VIDEO_PBEND_LABEL_YSIZE        30
-
-#define VIDEO_STATE_OFF                (VIDEO_STATE_PLAY_OFF   |       \
-                                VIDEO_STATE_REC_OFF    |       \
-                                VIDEO_STATE_PAUSE_OFF  |       \
-                                VIDEO_STATE_FFWD_OFF   |       \
-                                VIDEO_STATE_PBEND_OFF  |       \
-                                VIDEO_STATE_DATE_OFF   |       \
-                                VIDEO_STATE_TIME_OFF)
-#define VIDEO_PRESS_OFF                (VIDEO_PRESS_PLAY_OFF   |       \
-                                VIDEO_PRESS_REC_OFF    |       \
-                                VIDEO_PRESS_PAUSE_OFF  |       \
-                                VIDEO_PRESS_STOP_OFF   |       \
-                                VIDEO_PRESS_EJECT_OFF)
-#define VIDEO_ALL_OFF          (VIDEO_STATE_OFF | VIDEO_PRESS_OFF)
-
-#define VIDEO_STATE_ON         (VIDEO_STATE_PLAY_ON    |       \
-                                VIDEO_STATE_REC_ON     |       \
-                                VIDEO_STATE_PAUSE_ON   |       \
-                                VIDEO_STATE_FFWD_ON    |       \
-                                VIDEO_STATE_PBEND_ON   |       \
-                                VIDEO_STATE_DATE_ON    |       \
-                                VIDEO_STATE_TIME_ON)
-#define VIDEO_PRESS_ON         (VIDEO_PRESS_PLAY_ON    |       \
-                                VIDEO_PRESS_REC_ON     |       \
-                                VIDEO_PRESS_PAUSE_ON   |       \
-                                VIDEO_PRESS_STOP_ON    |       \
-                                VIDEO_PRESS_EJECT_ON)
-#define VIDEO_ALL_ON           (VIDEO_STATE_ON | VIDEO_PRESS_ON)
-
-#define VIDEO_STATE            (VIDEO_STATE_ON | VIDEO_STATE_OFF)
-#define VIDEO_PRESS            (VIDEO_PRESS_ON | VIDEO_PRESS_OFF)
-#define VIDEO_ALL              (VIDEO_ALL_ON | VIDEO_ALL_OFF)
-
-
-void DrawVideoDisplay(unsigned long state, unsigned long value)
-{
-  int i;
-  int part_label = 0, part_symbol = 1;
-  int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
-  static char *monatsname[12] =
-  {
-    "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
-    "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
-  };
-  static int video_pos[5][2][4] =
-  {
-    {{ VIDEO_PLAY_LABEL_XPOS, VIDEO_PLAY_LABEL_YPOS,
-       VIDEO_PLAY_LABEL_XSIZE,VIDEO_PLAY_LABEL_YSIZE },
-     { VIDEO_PLAY_SYMBOL_XPOS, VIDEO_PLAY_SYMBOL_YPOS,
-       VIDEO_PLAY_SYMBOL_XSIZE,VIDEO_PLAY_SYMBOL_YSIZE }},
-
-    {{ VIDEO_REC_LABEL_XPOS, VIDEO_REC_LABEL_YPOS,
-       VIDEO_REC_LABEL_XSIZE,VIDEO_REC_LABEL_YSIZE },
-     { VIDEO_REC_SYMBOL_XPOS, VIDEO_REC_SYMBOL_YPOS,
-       VIDEO_REC_SYMBOL_XSIZE,VIDEO_REC_SYMBOL_YSIZE }},
-
-    {{ VIDEO_PAUSE_LABEL_XPOS, VIDEO_PAUSE_LABEL_YPOS,
-       VIDEO_PAUSE_LABEL_XSIZE,VIDEO_PAUSE_LABEL_YSIZE },
-     { VIDEO_PAUSE_SYMBOL_XPOS, VIDEO_PAUSE_SYMBOL_YPOS,
-       VIDEO_PAUSE_SYMBOL_XSIZE,VIDEO_PAUSE_SYMBOL_YSIZE }},
-
-    {{ VIDEO_DATE_LABEL_XPOS, VIDEO_DATE_LABEL_YPOS,
-       VIDEO_DATE_LABEL_XSIZE,VIDEO_DATE_LABEL_YSIZE },
-     { VIDEO_DATE_XPOS, VIDEO_DATE_YPOS,
-       VIDEO_DATE_XSIZE,VIDEO_DATE_YSIZE }},
-
-    {{ 0,0,
-       0,0 },
-     { VIDEO_TIME_XPOS, VIDEO_TIME_YPOS,
-       VIDEO_TIME_XSIZE,VIDEO_TIME_YSIZE }}
-  };
-
-  if (state & VIDEO_STATE_PBEND_OFF)
-  {
-    int cx = DOOR_GFX_PAGEX3, cy = DOOR_GFX_PAGEY2;
-
-    BlitBitmap(pix[PIX_DOOR], drawto,
-              cx + VIDEO_REC_LABEL_XPOS,
-              cy + VIDEO_REC_LABEL_YPOS,
-              VIDEO_PBEND_LABEL_XSIZE,
-              VIDEO_PBEND_LABEL_YSIZE,
-              VX + VIDEO_REC_LABEL_XPOS,
-              VY + VIDEO_REC_LABEL_YPOS);
-  }
-
-  for(i=0;i<10;i++)
-  {
-    if (state & (1<<i))
-    {
-      int pos = i/2, cx, cy = DOOR_GFX_PAGEY2;
-
-      if (i%2)                 /* i ungerade => STATE_ON / PRESS_OFF */
-       cx = DOOR_GFX_PAGEX4;
-      else
-       cx = DOOR_GFX_PAGEX3;   /* i gerade => STATE_OFF / PRESS_ON */
-
-      if (video_pos[pos][part_label][0] && value != VIDEO_DISPLAY_SYMBOL_ONLY)
-       BlitBitmap(pix[PIX_DOOR], drawto,
-                  cx + video_pos[pos][part_label][xpos],
-                  cy + video_pos[pos][part_label][ypos],
-                  video_pos[pos][part_label][xsize],
-                  video_pos[pos][part_label][ysize],
-                  VX + video_pos[pos][part_label][xpos],
-                  VY + video_pos[pos][part_label][ypos]);
-      if (video_pos[pos][part_symbol][0] && value != VIDEO_DISPLAY_LABEL_ONLY)
-       BlitBitmap(pix[PIX_DOOR], drawto,
-                  cx + video_pos[pos][part_symbol][xpos],
-                  cy + video_pos[pos][part_symbol][ypos],
-                  video_pos[pos][part_symbol][xsize],
-                  video_pos[pos][part_symbol][ysize],
-                  VX + video_pos[pos][part_symbol][xpos],
-                  VY + video_pos[pos][part_symbol][ypos]);
-    }
-  }
-
-  if (state & VIDEO_STATE_FFWD_ON)
-  {
-    int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY2;
-
-    BlitBitmap(pix[PIX_DOOR], drawto,
-              cx + VIDEO_PLAY_SYMBOL_XPOS,
-              cy + VIDEO_PLAY_SYMBOL_YPOS,
-              VIDEO_PLAY_SYMBOL_XSIZE - 2,
-              VIDEO_PLAY_SYMBOL_YSIZE,
-              VX + VIDEO_PLAY_SYMBOL_XPOS - 9,
-              VY + VIDEO_PLAY_SYMBOL_YPOS);
-  }
-
-  if (state & VIDEO_STATE_PBEND_ON)
-  {
-    int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
-
-    BlitBitmap(pix[PIX_DOOR], drawto,
-              cx + VIDEO_PBEND_LABEL_XPOS,
-              cy + VIDEO_PBEND_LABEL_YPOS,
-              VIDEO_PBEND_LABEL_XSIZE,
-              VIDEO_PBEND_LABEL_YSIZE,
-              VX + VIDEO_REC_LABEL_XPOS,
-              VY + VIDEO_REC_LABEL_YPOS);
-  }
-
-  if (state & VIDEO_STATE_DATE_ON)
-  {
-    int tag = value % 100;
-    int monat = (value/100) % 100;
-    int jahr = (value/10000);
-
-    DrawText(VX+VIDEO_DATE_XPOS,VY+VIDEO_DATE_YPOS,
-            int2str(tag,2),FS_SMALL,FC_SPECIAL1);
-    DrawText(VX+VIDEO_DATE_XPOS+27,VY+VIDEO_DATE_YPOS,
-            monatsname[monat],FS_SMALL,FC_SPECIAL1);
-    DrawText(VX+VIDEO_DATE_XPOS+64,VY+VIDEO_DATE_YPOS,
-            int2str(jahr,2),FS_SMALL,FC_SPECIAL1);
-  }
-
-  if (state & VIDEO_STATE_TIME_ON)
-  {
-    int min = value / 60;
-    int sec = value % 60;
-
-    DrawText(VX+VIDEO_TIME_XPOS,VY+VIDEO_TIME_YPOS,
-            int2str(min,2),FS_SMALL,FC_SPECIAL1);
-    DrawText(VX+VIDEO_TIME_XPOS+27,VY+VIDEO_TIME_YPOS,
-            int2str(sec,2),FS_SMALL,FC_SPECIAL1);
-  }
-
-  if (state & VIDEO_STATE_DATE)
-    redraw_mask |= REDRAW_VIDEO_1;
-  if ((state & ~VIDEO_STATE_DATE) & VIDEO_STATE)
-    redraw_mask |= REDRAW_VIDEO_2;
-  if (state & VIDEO_PRESS)
-    redraw_mask |= REDRAW_VIDEO_3;
-}
-
-void DrawCompleteVideoDisplay()
-{
-  BlitBitmap(pix[PIX_DOOR], drawto,
-            DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
-  BlitBitmap(pix[PIX_DOOR], drawto,
-            DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
-            DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
-            VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
-            VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
-
-  DrawVideoDisplay(VIDEO_ALL_OFF,0);
-  if (tape.date && tape.length)
-  {
-    DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
-    DrawVideoDisplay(VIDEO_STATE_TIME_ON,tape.length_seconds);
-  }
-
-  BlitBitmap(drawto, pix[PIX_DB_DOOR],
-            VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
-}
-
-
-/* NEW GADGET STUFF -------------------------------------------------------- */
-
 
 /* values for DrawGadget() */
 #define DG_UNPRESSED           0
@@ -496,9 +257,9 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
     BlitBitmap(drawto, window,
               gi->x, gi->y, gi->width, gi->height, gi->x, gi->y);
   else
-    redraw_mask |= (gi->x < SX + SXSIZE ? REDRAW_FIELD :
-                   gi->y < DY + DYSIZE ? REDRAW_DOOR_1 :
-                   gi->y > VY ? REDRAW_DOOR_2 : REDRAW_DOOR_3);
+    redraw_mask |= (gi->x < gfx.sx + gfx.sxsize ? REDRAW_FIELD :
+                   gi->y < gfx.dy + gfx.dysize ? REDRAW_DOOR_1 :
+                   gi->y > gfx.vy ? REDRAW_DOOR_2 : REDRAW_DOOR_3);
 }
 
 static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
@@ -912,9 +673,12 @@ static void MultiMapGadgets(int mode)
 
   while (gi)
   {
-    if ((mode & MULTIMAP_PLAYFIELD && gi->x < SX + SXSIZE) ||
-       (mode & MULTIMAP_DOOR_1 && gi->x >= DX && gi->y < DY + DYSIZE) ||
-       (mode & MULTIMAP_DOOR_2 && gi->x >= DX && gi->y > DY + DYSIZE) ||
+    if ((mode & MULTIMAP_PLAYFIELD &&
+        gi->x < gfx.sx + gfx.sxsize) ||
+       (mode & MULTIMAP_DOOR_1 &&
+        gi->x >= gfx.dx && gi->y < gfx.dy + gfx.dysize) ||
+       (mode & MULTIMAP_DOOR_2 &&
+        gi->x >= gfx.dx && gi->y > gfx.dy + gfx.dysize) ||
        (mode & MULTIMAP_ALL) == MULTIMAP_ALL)
     {
       if (mode & MULTIMAP_UNMAP)
index 44a64f5fc7b81de5b2e48ff7dfdd6792bff9c0aa..ccac2373c83117f7354287d424426480cc4c47ed 100644 (file)
 
 #include "libgame.h"
 
-/* the following definitions are also used by tools.c */
 
-/* some positions in the video tape control window */
-#define VIDEO_DISPLAY1_XPOS    5
-#define VIDEO_DISPLAY1_YPOS    5
-#define VIDEO_DISPLAY2_XPOS    5
-#define VIDEO_DISPLAY2_YPOS    41
-#define VIDEO_DISPLAY_XSIZE    90
-#define VIDEO_DISPLAY_YSIZE    31
-#define VIDEO_BUTTON_XSIZE     18
-#define VIDEO_BUTTON_YSIZE     18
-#define VIDEO_CONTROL_XPOS     5
-#define VIDEO_CONTROL_YPOS     77
-#define VIDEO_CONTROL_XSIZE    VIDEO_DISPLAY_XSIZE
-#define VIDEO_CONTROL_YSIZE    VIDEO_BUTTON_YSIZE
-
-/* values for video tape control */
-#define VIDEO_STATE_PLAY_OFF   (1L << 0)
-#define VIDEO_STATE_PLAY_ON    (1L << 1)
-#define VIDEO_STATE_PLAY       (VIDEO_STATE_PLAY_OFF   | VIDEO_STATE_PLAY_ON)
-#define VIDEO_STATE_REC_OFF    (1L << 2)
-#define VIDEO_STATE_REC_ON     (1L << 3)
-#define VIDEO_STATE_REC                (VIDEO_STATE_REC_OFF    | VIDEO_STATE_REC_ON)
-#define VIDEO_STATE_PAUSE_OFF  (1L << 4)
-#define VIDEO_STATE_PAUSE_ON   (1L << 5)
-#define VIDEO_STATE_PAUSE      (VIDEO_STATE_PAUSE_OFF  | VIDEO_STATE_PAUSE_ON)
-#define VIDEO_STATE_DATE_OFF   (1L << 6)
-#define VIDEO_STATE_DATE_ON    (1L << 7)
-#define VIDEO_STATE_DATE       (VIDEO_STATE_DATE_OFF   | VIDEO_STATE_DATE_ON)
-#define VIDEO_STATE_TIME_OFF   (1L << 8)
-#define VIDEO_STATE_TIME_ON    (1L << 9)
-#define VIDEO_STATE_TIME       (VIDEO_STATE_TIME_OFF   | VIDEO_STATE_TIME_ON)
-#define VIDEO_PRESS_PLAY_ON    (1L << 10)
-#define VIDEO_PRESS_PLAY_OFF   (1L << 11)
-#define VIDEO_PRESS_PLAY       (VIDEO_PRESS_PLAY_OFF   | VIDEO_PRESS_PLAY_ON)
-#define VIDEO_PRESS_REC_ON     (1L << 12)
-#define VIDEO_PRESS_REC_OFF    (1L << 13)
-#define VIDEO_PRESS_REC                (VIDEO_PRESS_REC_OFF    | VIDEO_PRESS_REC_ON)
-#define VIDEO_PRESS_PAUSE_ON   (1L << 14)
-#define VIDEO_PRESS_PAUSE_OFF  (1L << 15)
-#define VIDEO_PRESS_PAUSE      (VIDEO_PRESS_PAUSE_OFF  | VIDEO_PRESS_PAUSE_ON)
-#define VIDEO_PRESS_STOP_ON    (1L << 16)
-#define VIDEO_PRESS_STOP_OFF   (1L << 17)
-#define VIDEO_PRESS_STOP       (VIDEO_PRESS_STOP_OFF   | VIDEO_PRESS_STOP_ON)
-#define VIDEO_PRESS_EJECT_ON   (1L << 18)
-#define VIDEO_PRESS_EJECT_OFF  (1L << 19)
-#define VIDEO_PRESS_EJECT      (VIDEO_PRESS_EJECT_OFF  | VIDEO_PRESS_EJECT_ON)
-
-/* special */
-#define VIDEO_STATE_FFWD_OFF   ((1L << 20) | VIDEO_STATE_PAUSE_OFF)
-#define VIDEO_STATE_FFWD_ON    (1L << 21)
-#define VIDEO_STATE_FFWD       (VIDEO_STATE_FFWD_OFF   | VIDEO_STATE_FFWD_ON)
-#define VIDEO_STATE_PBEND_OFF  (1L << 22)
-#define VIDEO_STATE_PBEND_ON   (1L << 23)
-#define VIDEO_STATE_PBEND      (VIDEO_STATE_PBEND_OFF  | VIDEO_STATE_PBEND_ON)
-
-/* tags to draw video display labels or symbols only */
-#define VIDEO_DISPLAY_DEFAULT          0
-#define VIDEO_DISPLAY_LABEL_ONLY       1
-#define VIDEO_DISPLAY_SYMBOL_ONLY      2
-
-void DrawVideoDisplay(unsigned long, unsigned long);
-void DrawCompleteVideoDisplay(void);
-
-
-/* NEW GADGET STUFF -------------------------------------------------------- */
+#define GADGET_FRAME_DELAY     150     /* delay between gadget actions */
 
 /* gadget types */
 #define GD_TYPE_NORMAL_BUTTON          (1 << 0)
index 95dba9b3559344f1380b2b812ad82a3179320687..fd613b9ce9cd97339d5f81743b838d4dc571c92e 100644 (file)
 #include "pcx.h"
 #include "misc.h"
 
+
+/* areas in bitmap PIX_DOOR */
+/* meaning in PIX_DB_DOOR: (3 PAGEs)
+   PAGEX1: 1. buffer for DOOR_1
+   PAGEX2: 2. buffer for DOOR_1
+   PAGEX3: buffer for animations
+*/
+
+#define DOOR_GFX_PAGESIZE      (gfx.dxsize)
+#define DOOR_GFX_PAGEX1                (0 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEX2                (1 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEX3                (2 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEX4                (3 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEX5                (4 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEX6                (5 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEX7                (6 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEX8                (7 * DOOR_GFX_PAGESIZE)
+#define DOOR_GFX_PAGEY1                (0)
+#define DOOR_GFX_PAGEY2                (gfx.dysize)
+
 #endif /* LIBGAME_H */
index 572ff3601a8efce0d9eb8d119000025e9dc61724..771918ea96bf9d07c5aff8e501367f61fe9bec52 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdarg.h>
 #include <ctype.h>
 
-#include "libgame.h"
+#include "platform.h"
 
 #if !defined(PLATFORM_WIN32)
 #include <pwd.h>
index a49148817ce28d1a3b79d368e9d7123fe6184024..b3137b4a5bc7ecc98eb20e536503e1614b6f205b 100644 (file)
@@ -442,8 +442,7 @@ Pixmap XCreatePixmap(Display *display, Drawable d, unsigned int width,
   BITMAP *bitmap = NULL;
 
   if (gfx_capabilities & GFX_HW_VRAM_BLIT &&
-      width  == playfield.scrollbuffer_width &&
-      height == playfield.scrollbuffer_height)
+      width  == gfx.scrollbuffer_width && height == gfx.scrollbuffer_height)
     bitmap = create_video_bitmap(width, height);
 
   if (bitmap == NULL)
index a88b78cfdb89630d70a96bd83106fa82ea2250e7..471c614f70af6c2783dad96b0a267d21b1c1cafd 100644 (file)
@@ -23,7 +23,7 @@ struct ProgramInfo    program;
 struct OptionInfo      options;
 struct VideoSystemInfo video;
 struct AudioSystemInfo audio;
-struct PlayfieldInfo   playfield;
+struct GfxInfo         gfx;
 
 Display        *display = NULL;
 Visual        *visual = NULL;
@@ -34,8 +34,11 @@ DrawWindow   window = NULL;
 DrawBuffer     backbuffer = NULL;
 DrawBuffer     drawto = NULL;
 
-int            redraw_mask;
-int            redraw_tiles;
+int            button_status = MB_NOT_PRESSED;
+boolean                motion_status = FALSE;
+
+int            redraw_mask = REDRAW_NONE;
+int            redraw_tiles = 0;
 
 int            FrameCounter = 0;
 
@@ -59,42 +62,42 @@ inline void InitProgramInfo(char *command_name, char *program_title,
   program.msdos_pointer_filename = msdos_pointer_filename;
 }
 
-inline void InitPlayfieldInfo(int sx, int sy, int sxsize, int sysize,
-                             int real_sx, int real_sy,
-                             int full_sxsize, int full_sysize)
+inline void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize,
+                            int real_sx, int real_sy,
+                            int full_sxsize, int full_sysize)
 {
-  playfield.sx = sx;
-  playfield.sy = sy;
-  playfield.sxsize = sxsize;
-  playfield.sysize = sysize;
-  playfield.real_sx = real_sx;
-  playfield.real_sy = real_sy;
-  playfield.full_sxsize = full_sxsize;
-  playfield.full_sysize = full_sysize;
+  gfx.sx = sx;
+  gfx.sy = sy;
+  gfx.sxsize = sxsize;
+  gfx.sysize = sysize;
+  gfx.real_sx = real_sx;
+  gfx.real_sy = real_sy;
+  gfx.full_sxsize = full_sxsize;
+  gfx.full_sysize = full_sysize;
 }
 
-inline void InitDoor1Info(int dx, int dy, int dxsize, int dysize)
+inline void InitGfxDoor1Info(int dx, int dy, int dxsize, int dysize)
 {
-  playfield.dx = dx;
-  playfield.dy = dy;
-  playfield.dxsize = dxsize;
-  playfield.dysize = dysize;
+  gfx.dx = dx;
+  gfx.dy = dy;
+  gfx.dxsize = dxsize;
+  gfx.dysize = dysize;
 }
 
-inline void InitDoor2Info(int vx, int vy, int vxsize, int vysize)
+inline void InitGfxDoor2Info(int vx, int vy, int vxsize, int vysize)
 {
-  playfield.vx = vx;
-  playfield.vy = vy;
-  playfield.vxsize = vxsize;
-  playfield.vysize = vysize;
+  gfx.vx = vx;
+  gfx.vy = vy;
+  gfx.vxsize = vxsize;
+  gfx.vysize = vysize;
 }
 
-inline void InitScrollbufferInfo(int scrollbuffer_width,
-                                int scrollbuffer_height)
+inline void InitGfxScrollbufferInfo(int scrollbuffer_width,
+                                   int scrollbuffer_height)
 {
   /* currently only used by MSDOS code to alloc VRAM buffer, if available */
-  playfield.scrollbuffer_width = scrollbuffer_width;
-  playfield.scrollbuffer_height = scrollbuffer_height;
+  gfx.scrollbuffer_width = scrollbuffer_width;
+  gfx.scrollbuffer_height = scrollbuffer_height;
 }
 
 inline static int GetRealDepth(int depth)
index 25eb0c66c485d83b157228f48dd009e1cb59d2b8..a16fb4c5561e9e1974f09dd1cebc2bdb3d8b2474 100644 (file)
 #define FULLSCREEN_NOT_AVAILABLE       FALSE
 #define FULLSCREEN_AVAILABLE           TRUE
 
+/* values for button_status */
+#define MB_NOT_PRESSED         FALSE
+#define MB_RELEASED            FALSE
+#define MB_PRESSED             TRUE
+#define MB_MENU_CHOICE         FALSE
+#define MB_MENU_MARK           TRUE
+#define MB_MENU_INITIALIZE     (-1)
+#define MB_LEFTBUTTON          1
+#define MB_MIDDLEBUTTON                2
+#define MB_RIGHTBUTTON         3
 
 /* values for redraw_mask */
+#define REDRAW_NONE            (0)
 #define REDRAW_ALL             (1 << 0)
 #define REDRAW_FIELD           (1 << 1)
 #define REDRAW_TILES           (1 << 2)
@@ -112,7 +123,7 @@ struct AudioSystemInfo
   int device_fd;
 };
 
-struct PlayfieldInfo
+struct GfxInfo
 {
   int sx, sy;
   int sxsize, sysize;
@@ -136,7 +147,7 @@ extern struct ProgramInfo   program;
 extern struct OptionInfo       options;
 extern struct VideoSystemInfo  video;
 extern struct AudioSystemInfo  audio;
-extern struct PlayfieldInfo    playfield;
+extern struct GfxInfo          gfx;
 
 extern Display        *display;
 extern Visual         *visual;
@@ -147,6 +158,9 @@ extern DrawWindow   window;
 extern DrawBuffer      backbuffer;
 extern DrawBuffer      drawto;
 
+extern int             button_status;
+extern boolean         motion_status;
+
 extern int             redraw_mask;
 extern int             redraw_tiles;
 
@@ -158,10 +172,10 @@ extern int                FrameCounter;
 inline void InitProgramInfo(char *, char *, char *, char *, char *, char *,
                            char *);
 
-inline void InitPlayfieldInfo(int, int, int, int, int, int, int, int);
-inline void InitDoor1Info(int, int, int, int);
-inline void InitDoor2Info(int, int, int, int);
-inline void InitScrollbufferInfo(int, int);
+inline void InitGfxFieldInfo(int, int, int, int, int, int, int, int);
+inline void InitGfxDoor1Info(int, int, int, int);
+inline void InitGfxDoor2Info(int, int, int, int);
+inline void InitGfxScrollbufferInfo(int, int);
 
 inline void InitVideoDisplay(void);
 inline void InitVideoBuffer(DrawBuffer *,DrawWindow *, int, int, int, boolean);
index 2fbf1cb319cf3b48b6514d552e383ba70898bbce..6dfdf7f86ac39eccfa40fd2b491567a0d9bbad45 100644 (file)
@@ -76,8 +76,8 @@ void DrawTextFCentered(int y, int font_type, char *format, ...)
   vsprintf(buffer, format, ap);
   va_end(ap);
 
-  DrawText(playfield.sx + (playfield.sxsize - strlen(buffer) * font_width) / 2,
-          playfield.sy + y, buffer, FS_SMALL, font_type);
+  DrawText(gfx.sx + (gfx.sxsize - strlen(buffer) * font_width) / 2,
+          gfx.sy + y, buffer, FS_SMALL, font_type);
 }
 
 void DrawTextF(int x, int y, int font_type, char *format, ...)
@@ -89,16 +89,16 @@ void DrawTextF(int x, int y, int font_type, char *format, ...)
   vsprintf(buffer, format, ap);
   va_end(ap);
 
-  DrawText(playfield.sx + x, playfield.sy + y, buffer, FS_SMALL, font_type);
+  DrawText(gfx.sx + x, gfx.sy + y, buffer, FS_SMALL, font_type);
 }
 
 void DrawText(int x, int y, char *text, int font_size, int font_type)
 {
   DrawTextExt(drawto, x, y, text, font_size, font_type);
 
-  if (x < playfield.dx)
+  if (x < gfx.dx)
     redraw_mask |= REDRAW_FIELD;
-  else if (y < playfield.vy)
+  else if (y < gfx.vy)
     redraw_mask |= REDRAW_DOOR_1;
 }
 
index e4aad2a3a5f6233600cc438f8bfac0896fd1b091..bd32b02bdd7380110e9c3fa35ae1a5ca294cf1e9 100644 (file)
@@ -22,4 +22,20 @@ typedef unsigned char byte;
 #define TRUE           (!FALSE)
 #endif
 
+#ifndef MIN
+#define MIN(a,b)       ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a,b)       ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef ABS
+#define ABS(a)         ((a) < 0 ? -(a) : (a))
+#endif
+
+#ifndef SIGN
+#define SIGN(a)                ((a) < 0 ? -1 : ((a)>0 ? 1 : 0))
+#endif
+
 #endif /* TYPES_H */
index bf7e3f5bcba90a439112bc038f705e0bf57495c7..c31ace49ffa462879952156ce24152e67917fbf4 100644 (file)
@@ -70,8 +70,12 @@ char        *program_name = NULL;
 int            game_status = MAINMENU;
 boolean                level_editor_test_game = FALSE;
 boolean                network_playing = FALSE;
+
+#if 0
 int            button_status = MB_NOT_PRESSED;
 boolean                motion_status = FALSE;
+#endif
+
 int            key_joystick_mapping = 0;
 int            global_joystick_status = JOYSTICK_STATUS;
 int            joystick_status = JOYSTICK_STATUS;
index f2b5320e335af8ecbcc0f638a796309875f18920..fc70fcc94fb00eabb75b09ab17275d22f9270546 100644 (file)
@@ -62,6 +62,7 @@
 
 #define MAX_PLAYERS    4
 
+#if 0
 #ifndef MIN
 #define MIN(a,b)       ((a) < (b) ? (a) : (b))
 #endif
@@ -74,6 +75,7 @@
 #ifndef SIGN
 #define SIGN(a)                ((a) < 0 ? -1 : ((a)>0 ? 1 : 0))
 #endif
+#endif
 
 #define SCREENX(a)     ((a) - scroll_x)
 #define SCREENY(a)     ((a) - scroll_y)
 #define GAME_FRAME_DELAY       20      /* frame delay in milliseconds */
 #define FFWD_FRAME_DELAY       10      /* 200% speed for fast forward */
 #define FRAMES_PER_SECOND      (1000 / GAME_FRAME_DELAY)
+#if 0
 #define GADGET_FRAME_DELAY     150     /* delay between gadget actions */
+#endif
 #define MICROLEVEL_SCROLL_DELAY        50      /* delay for scrolling micro level */
 #define MICROLEVEL_LABEL_DELAY 250     /* delay for micro level label */
 
@@ -475,8 +479,12 @@ extern char               *program_name;
 extern int             game_status;
 extern boolean         level_editor_test_game;
 extern boolean         network_playing;
+
+#if 0
 extern int             button_status;
 extern boolean         motion_status;
+#endif
+
 extern int             key_joystick_mapping;
 extern int             global_joystick_status, joystick_status;
 
@@ -1703,6 +1711,7 @@ extern int                num_element_info;
 /* default name for new levels */
 #define NAMELESS_LEVEL_NAME    "nameless level"
 
+#if 0
 /* values for button_status */
 #define MB_NOT_PRESSED         FALSE
 #define MB_RELEASED            FALSE
@@ -1713,6 +1722,7 @@ extern int                num_element_info;
 #define MB_LEFTBUTTON          1
 #define MB_MIDDLEBUTTON                2
 #define MB_RIGHTBUTTON         3
+#endif
 
 #if 0
 /* values for redraw_mask */
@@ -1739,6 +1749,7 @@ extern int                num_element_info;
 #define REDRAWTILES_THRESHOLD  (SCR_FIELDX * SCR_FIELDY / 2)
 #endif
 
+#if 0
 /* areas in bitmap PIX_DOOR */
 /* meaning in PIX_DB_DOOR: (3 PAGEs)
    PAGEX1: 1. buffer for DOOR_1
@@ -1757,6 +1768,7 @@ extern int                num_element_info;
 #define DOOR_GFX_PAGEX8                (7 * DOOR_GFX_PAGESIZE)
 #define DOOR_GFX_PAGEY1                0
 #define DOOR_GFX_PAGEY2                DYSIZE
+#endif
 
 /* for DrawGraphicAnimation() [tools.c] and AnimateToon() [cartoons.c] */
 #define ANIM_NORMAL            0
index 7a5d5ff3f81030fbedb7503a8f5342be7e570fec..7add692b51d605ad0bd07b50b8a276f09e89e6a4 100644 (file)
@@ -33,6 +33,258 @@ static void HandleTapeButtons(struct GadgetInfo *);
 
 static struct GadgetInfo *tape_gadget[NUM_TAPE_BUTTONS];
 
+
+/* ========================================================================= */
+/* video tape definitions                                                    */
+/* ========================================================================= */
+
+/* some positions in the video tape control window */
+#define VIDEO_DATE_LABEL_XPOS  (VIDEO_DISPLAY1_XPOS)
+#define VIDEO_DATE_LABEL_YPOS  (VIDEO_DISPLAY1_YPOS)
+#define VIDEO_DATE_LABEL_XSIZE (VIDEO_DISPLAY_XSIZE)
+#define VIDEO_DATE_LABEL_YSIZE (VIDEO_DISPLAY_YSIZE)
+#define VIDEO_DATE_XPOS                (VIDEO_DISPLAY1_XPOS + 1)
+#define VIDEO_DATE_YPOS                (VIDEO_DISPLAY1_YPOS + 14)
+#define VIDEO_DATE_XSIZE       (VIDEO_DISPLAY_XSIZE)
+#define VIDEO_DATE_YSIZE       16
+#define VIDEO_REC_LABEL_XPOS   (VIDEO_DISPLAY2_XPOS)
+#define VIDEO_REC_LABEL_YPOS   (VIDEO_DISPLAY2_YPOS)
+#define VIDEO_REC_LABEL_XSIZE  20
+#define VIDEO_REC_LABEL_YSIZE  12
+#define VIDEO_REC_SYMBOL_XPOS  (VIDEO_DISPLAY2_XPOS + 20)
+#define VIDEO_REC_SYMBOL_YPOS  (VIDEO_DISPLAY2_YPOS)
+#define VIDEO_REC_SYMBOL_XSIZE 16
+#define VIDEO_REC_SYMBOL_YSIZE 16
+#define VIDEO_PLAY_LABEL_XPOS  (VIDEO_DISPLAY2_XPOS + 65)
+#define VIDEO_PLAY_LABEL_YPOS  (VIDEO_DISPLAY2_YPOS)
+#define VIDEO_PLAY_LABEL_XSIZE 22
+#define VIDEO_PLAY_LABEL_YSIZE 12
+#define VIDEO_PLAY_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS + 52)
+#define VIDEO_PLAY_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS)
+#define VIDEO_PLAY_SYMBOL_XSIZE        11
+#define VIDEO_PLAY_SYMBOL_YSIZE        13
+#define VIDEO_PAUSE_LABEL_XPOS (VIDEO_DISPLAY2_XPOS)
+#define VIDEO_PAUSE_LABEL_YPOS (VIDEO_DISPLAY2_YPOS + 20)
+#define VIDEO_PAUSE_LABEL_XSIZE        35
+#define VIDEO_PAUSE_LABEL_YSIZE        8
+#define VIDEO_PAUSE_SYMBOL_XPOS        (VIDEO_DISPLAY2_XPOS + 35)
+#define VIDEO_PAUSE_SYMBOL_YPOS        (VIDEO_DISPLAY2_YPOS)
+#define VIDEO_PAUSE_SYMBOL_XSIZE 17
+#define VIDEO_PAUSE_SYMBOL_YSIZE 13
+#define VIDEO_TIME_XPOS                (VIDEO_DISPLAY2_XPOS + 38)
+#define VIDEO_TIME_YPOS                (VIDEO_DISPLAY2_YPOS + 14)
+#define VIDEO_TIME_XSIZE       50
+#define VIDEO_TIME_YSIZE       16
+
+/* special */
+#define VIDEO_PBEND_LABEL_XPOS 6
+#define VIDEO_PBEND_LABEL_YPOS 220
+#define VIDEO_PBEND_LABEL_XSIZE        35
+#define VIDEO_PBEND_LABEL_YSIZE        30
+
+#define VIDEO_STATE_OFF                (VIDEO_STATE_PLAY_OFF   |       \
+                                VIDEO_STATE_REC_OFF    |       \
+                                VIDEO_STATE_PAUSE_OFF  |       \
+                                VIDEO_STATE_FFWD_OFF   |       \
+                                VIDEO_STATE_PBEND_OFF  |       \
+                                VIDEO_STATE_DATE_OFF   |       \
+                                VIDEO_STATE_TIME_OFF)
+#define VIDEO_PRESS_OFF                (VIDEO_PRESS_PLAY_OFF   |       \
+                                VIDEO_PRESS_REC_OFF    |       \
+                                VIDEO_PRESS_PAUSE_OFF  |       \
+                                VIDEO_PRESS_STOP_OFF   |       \
+                                VIDEO_PRESS_EJECT_OFF)
+#define VIDEO_ALL_OFF          (VIDEO_STATE_OFF | VIDEO_PRESS_OFF)
+
+#define VIDEO_STATE_ON         (VIDEO_STATE_PLAY_ON    |       \
+                                VIDEO_STATE_REC_ON     |       \
+                                VIDEO_STATE_PAUSE_ON   |       \
+                                VIDEO_STATE_FFWD_ON    |       \
+                                VIDEO_STATE_PBEND_ON   |       \
+                                VIDEO_STATE_DATE_ON    |       \
+                                VIDEO_STATE_TIME_ON)
+#define VIDEO_PRESS_ON         (VIDEO_PRESS_PLAY_ON    |       \
+                                VIDEO_PRESS_REC_ON     |       \
+                                VIDEO_PRESS_PAUSE_ON   |       \
+                                VIDEO_PRESS_STOP_ON    |       \
+                                VIDEO_PRESS_EJECT_ON)
+#define VIDEO_ALL_ON           (VIDEO_STATE_ON | VIDEO_PRESS_ON)
+
+#define VIDEO_STATE            (VIDEO_STATE_ON | VIDEO_STATE_OFF)
+#define VIDEO_PRESS            (VIDEO_PRESS_ON | VIDEO_PRESS_OFF)
+#define VIDEO_ALL              (VIDEO_ALL_ON | VIDEO_ALL_OFF)
+
+
+/* ========================================================================= */
+/* video display functions                                                   */
+/* ========================================================================= */
+
+void DrawVideoDisplay(unsigned long state, unsigned long value)
+{
+  int i;
+  int part_label = 0, part_symbol = 1;
+  int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
+  static char *monatsname[12] =
+  {
+    "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
+    "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
+  };
+  static int video_pos[5][2][4] =
+  {
+    {{ VIDEO_PLAY_LABEL_XPOS, VIDEO_PLAY_LABEL_YPOS,
+       VIDEO_PLAY_LABEL_XSIZE,VIDEO_PLAY_LABEL_YSIZE },
+     { VIDEO_PLAY_SYMBOL_XPOS, VIDEO_PLAY_SYMBOL_YPOS,
+       VIDEO_PLAY_SYMBOL_XSIZE,VIDEO_PLAY_SYMBOL_YSIZE }},
+
+    {{ VIDEO_REC_LABEL_XPOS, VIDEO_REC_LABEL_YPOS,
+       VIDEO_REC_LABEL_XSIZE,VIDEO_REC_LABEL_YSIZE },
+     { VIDEO_REC_SYMBOL_XPOS, VIDEO_REC_SYMBOL_YPOS,
+       VIDEO_REC_SYMBOL_XSIZE,VIDEO_REC_SYMBOL_YSIZE }},
+
+    {{ VIDEO_PAUSE_LABEL_XPOS, VIDEO_PAUSE_LABEL_YPOS,
+       VIDEO_PAUSE_LABEL_XSIZE,VIDEO_PAUSE_LABEL_YSIZE },
+     { VIDEO_PAUSE_SYMBOL_XPOS, VIDEO_PAUSE_SYMBOL_YPOS,
+       VIDEO_PAUSE_SYMBOL_XSIZE,VIDEO_PAUSE_SYMBOL_YSIZE }},
+
+    {{ VIDEO_DATE_LABEL_XPOS, VIDEO_DATE_LABEL_YPOS,
+       VIDEO_DATE_LABEL_XSIZE,VIDEO_DATE_LABEL_YSIZE },
+     { VIDEO_DATE_XPOS, VIDEO_DATE_YPOS,
+       VIDEO_DATE_XSIZE,VIDEO_DATE_YSIZE }},
+
+    {{ 0,0,
+       0,0 },
+     { VIDEO_TIME_XPOS, VIDEO_TIME_YPOS,
+       VIDEO_TIME_XSIZE,VIDEO_TIME_YSIZE }}
+  };
+
+  if (state & VIDEO_STATE_PBEND_OFF)
+  {
+    int cx = DOOR_GFX_PAGEX3, cy = DOOR_GFX_PAGEY2;
+
+    BlitBitmap(pix[PIX_DOOR], drawto,
+              cx + VIDEO_REC_LABEL_XPOS,
+              cy + VIDEO_REC_LABEL_YPOS,
+              VIDEO_PBEND_LABEL_XSIZE,
+              VIDEO_PBEND_LABEL_YSIZE,
+              VX + VIDEO_REC_LABEL_XPOS,
+              VY + VIDEO_REC_LABEL_YPOS);
+  }
+
+  for(i=0;i<10;i++)
+  {
+    if (state & (1<<i))
+    {
+      int pos = i/2, cx, cy = DOOR_GFX_PAGEY2;
+
+      if (i%2)                 /* i ungerade => STATE_ON / PRESS_OFF */
+       cx = DOOR_GFX_PAGEX4;
+      else
+       cx = DOOR_GFX_PAGEX3;   /* i gerade => STATE_OFF / PRESS_ON */
+
+      if (video_pos[pos][part_label][0] && value != VIDEO_DISPLAY_SYMBOL_ONLY)
+       BlitBitmap(pix[PIX_DOOR], drawto,
+                  cx + video_pos[pos][part_label][xpos],
+                  cy + video_pos[pos][part_label][ypos],
+                  video_pos[pos][part_label][xsize],
+                  video_pos[pos][part_label][ysize],
+                  VX + video_pos[pos][part_label][xpos],
+                  VY + video_pos[pos][part_label][ypos]);
+      if (video_pos[pos][part_symbol][0] && value != VIDEO_DISPLAY_LABEL_ONLY)
+       BlitBitmap(pix[PIX_DOOR], drawto,
+                  cx + video_pos[pos][part_symbol][xpos],
+                  cy + video_pos[pos][part_symbol][ypos],
+                  video_pos[pos][part_symbol][xsize],
+                  video_pos[pos][part_symbol][ysize],
+                  VX + video_pos[pos][part_symbol][xpos],
+                  VY + video_pos[pos][part_symbol][ypos]);
+    }
+  }
+
+  if (state & VIDEO_STATE_FFWD_ON)
+  {
+    int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY2;
+
+    BlitBitmap(pix[PIX_DOOR], drawto,
+              cx + VIDEO_PLAY_SYMBOL_XPOS,
+              cy + VIDEO_PLAY_SYMBOL_YPOS,
+              VIDEO_PLAY_SYMBOL_XSIZE - 2,
+              VIDEO_PLAY_SYMBOL_YSIZE,
+              VX + VIDEO_PLAY_SYMBOL_XPOS - 9,
+              VY + VIDEO_PLAY_SYMBOL_YPOS);
+  }
+
+  if (state & VIDEO_STATE_PBEND_ON)
+  {
+    int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
+
+    BlitBitmap(pix[PIX_DOOR], drawto,
+              cx + VIDEO_PBEND_LABEL_XPOS,
+              cy + VIDEO_PBEND_LABEL_YPOS,
+              VIDEO_PBEND_LABEL_XSIZE,
+              VIDEO_PBEND_LABEL_YSIZE,
+              VX + VIDEO_REC_LABEL_XPOS,
+              VY + VIDEO_REC_LABEL_YPOS);
+  }
+
+  if (state & VIDEO_STATE_DATE_ON)
+  {
+    int tag = value % 100;
+    int monat = (value/100) % 100;
+    int jahr = (value/10000);
+
+    DrawText(VX+VIDEO_DATE_XPOS,VY+VIDEO_DATE_YPOS,
+            int2str(tag,2),FS_SMALL,FC_SPECIAL1);
+    DrawText(VX+VIDEO_DATE_XPOS+27,VY+VIDEO_DATE_YPOS,
+            monatsname[monat],FS_SMALL,FC_SPECIAL1);
+    DrawText(VX+VIDEO_DATE_XPOS+64,VY+VIDEO_DATE_YPOS,
+            int2str(jahr,2),FS_SMALL,FC_SPECIAL1);
+  }
+
+  if (state & VIDEO_STATE_TIME_ON)
+  {
+    int min = value / 60;
+    int sec = value % 60;
+
+    DrawText(VX+VIDEO_TIME_XPOS,VY+VIDEO_TIME_YPOS,
+            int2str(min,2),FS_SMALL,FC_SPECIAL1);
+    DrawText(VX+VIDEO_TIME_XPOS+27,VY+VIDEO_TIME_YPOS,
+            int2str(sec,2),FS_SMALL,FC_SPECIAL1);
+  }
+
+  if (state & VIDEO_STATE_DATE)
+    redraw_mask |= REDRAW_VIDEO_1;
+  if ((state & ~VIDEO_STATE_DATE) & VIDEO_STATE)
+    redraw_mask |= REDRAW_VIDEO_2;
+  if (state & VIDEO_PRESS)
+    redraw_mask |= REDRAW_VIDEO_3;
+}
+
+void DrawCompleteVideoDisplay()
+{
+  BlitBitmap(pix[PIX_DOOR], drawto, DOOR_GFX_PAGEX3, DOOR_GFX_PAGEY2,
+            gfx.vxsize, gfx.vysize, gfx.vx, gfx.vy);
+  BlitBitmap(pix[PIX_DOOR], drawto,
+            DOOR_GFX_PAGEX4 + VIDEO_CONTROL_XPOS,
+            DOOR_GFX_PAGEY2 + VIDEO_CONTROL_YPOS,
+            VIDEO_CONTROL_XSIZE, VIDEO_CONTROL_YSIZE,
+            gfx.vx + VIDEO_CONTROL_XPOS, gfx.vy + VIDEO_CONTROL_YPOS);
+
+  DrawVideoDisplay(VIDEO_ALL_OFF, 0);
+  if (tape.date && tape.length)
+  {
+    DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date);
+    DrawVideoDisplay(VIDEO_STATE_TIME_ON, tape.length_seconds);
+  }
+
+  BlitBitmap(drawto, pix[PIX_DB_DOOR], gfx.vx, gfx.vy, gfx.vxsize, gfx.vysize,
+            DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2);
+}
+
+
+/* ========================================================================= */
+/* tape control functions                                                    */
+/* ========================================================================= */
+
 void TapeStartRecording()
 {
   time_t zeit1 = time(NULL);
@@ -220,7 +472,7 @@ boolean TapePlayDelay()
        DrawVideoDisplay(VIDEO_STATE_PBEND_OFF, VIDEO_DISPLAY_LABEL_ONLY);
     }
 
-    if (TimePlayed > tape.length_seconds - PAUSE_SECONDS_BEFORE_DEATH)
+    if (TimePlayed > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH)
     {
       TapeTogglePause();
       return(FALSE);
index 1f2a4d8fe6a5b09cf03161ff10d766cf164b9753..1727ecf50faa4e6c46e1418bcebc5c4408ef3e48 100644 (file)
 
 #include "main.h"
 
-#define PAUSE_SECONDS_BEFORE_DEATH     3
+#define TAPE_PAUSE_SECONDS_BEFORE_DEATH                3
+
+/* some positions in the video tape control window */
+#define VIDEO_DISPLAY1_XPOS    5
+#define VIDEO_DISPLAY1_YPOS    5
+#define VIDEO_DISPLAY2_XPOS    5
+#define VIDEO_DISPLAY2_YPOS    41
+#define VIDEO_DISPLAY_XSIZE    90
+#define VIDEO_DISPLAY_YSIZE    31
+#define VIDEO_BUTTON_XSIZE     18
+#define VIDEO_BUTTON_YSIZE     18
+#define VIDEO_CONTROL_XPOS     5
+#define VIDEO_CONTROL_YPOS     77
+#define VIDEO_CONTROL_XSIZE    VIDEO_DISPLAY_XSIZE
+#define VIDEO_CONTROL_YSIZE    VIDEO_BUTTON_YSIZE
+
+/* values for video tape control */
+#define VIDEO_STATE_PLAY_OFF   (1L << 0)
+#define VIDEO_STATE_PLAY_ON    (1L << 1)
+#define VIDEO_STATE_PLAY       (VIDEO_STATE_PLAY_OFF   | VIDEO_STATE_PLAY_ON)
+#define VIDEO_STATE_REC_OFF    (1L << 2)
+#define VIDEO_STATE_REC_ON     (1L << 3)
+#define VIDEO_STATE_REC                (VIDEO_STATE_REC_OFF    | VIDEO_STATE_REC_ON)
+#define VIDEO_STATE_PAUSE_OFF  (1L << 4)
+#define VIDEO_STATE_PAUSE_ON   (1L << 5)
+#define VIDEO_STATE_PAUSE      (VIDEO_STATE_PAUSE_OFF  | VIDEO_STATE_PAUSE_ON)
+#define VIDEO_STATE_DATE_OFF   (1L << 6)
+#define VIDEO_STATE_DATE_ON    (1L << 7)
+#define VIDEO_STATE_DATE       (VIDEO_STATE_DATE_OFF   | VIDEO_STATE_DATE_ON)
+#define VIDEO_STATE_TIME_OFF   (1L << 8)
+#define VIDEO_STATE_TIME_ON    (1L << 9)
+#define VIDEO_STATE_TIME       (VIDEO_STATE_TIME_OFF   | VIDEO_STATE_TIME_ON)
+#define VIDEO_PRESS_PLAY_ON    (1L << 10)
+#define VIDEO_PRESS_PLAY_OFF   (1L << 11)
+#define VIDEO_PRESS_PLAY       (VIDEO_PRESS_PLAY_OFF   | VIDEO_PRESS_PLAY_ON)
+#define VIDEO_PRESS_REC_ON     (1L << 12)
+#define VIDEO_PRESS_REC_OFF    (1L << 13)
+#define VIDEO_PRESS_REC                (VIDEO_PRESS_REC_OFF    | VIDEO_PRESS_REC_ON)
+#define VIDEO_PRESS_PAUSE_ON   (1L << 14)
+#define VIDEO_PRESS_PAUSE_OFF  (1L << 15)
+#define VIDEO_PRESS_PAUSE      (VIDEO_PRESS_PAUSE_OFF  | VIDEO_PRESS_PAUSE_ON)
+#define VIDEO_PRESS_STOP_ON    (1L << 16)
+#define VIDEO_PRESS_STOP_OFF   (1L << 17)
+#define VIDEO_PRESS_STOP       (VIDEO_PRESS_STOP_OFF   | VIDEO_PRESS_STOP_ON)
+#define VIDEO_PRESS_EJECT_ON   (1L << 18)
+#define VIDEO_PRESS_EJECT_OFF  (1L << 19)
+#define VIDEO_PRESS_EJECT      (VIDEO_PRESS_EJECT_OFF  | VIDEO_PRESS_EJECT_ON)
+
+/* special */
+#define VIDEO_STATE_FFWD_OFF   ((1L << 20) | VIDEO_STATE_PAUSE_OFF)
+#define VIDEO_STATE_FFWD_ON    (1L << 21)
+#define VIDEO_STATE_FFWD       (VIDEO_STATE_FFWD_OFF   | VIDEO_STATE_FFWD_ON)
+#define VIDEO_STATE_PBEND_OFF  (1L << 22)
+#define VIDEO_STATE_PBEND_ON   (1L << 23)
+#define VIDEO_STATE_PBEND      (VIDEO_STATE_PBEND_OFF  | VIDEO_STATE_PBEND_ON)
+
+/* tags to draw video display labels or symbols only */
+#define VIDEO_DISPLAY_DEFAULT          0
+#define VIDEO_DISPLAY_LABEL_ONLY       1
+#define VIDEO_DISPLAY_SYMBOL_ONLY      2
+
+
+void DrawVideoDisplay(unsigned long, unsigned long);
+void DrawCompleteVideoDisplay(void);
 
 void TapeStartRecording(void);
 void TapeStopRecording(void);
index 78fd3d6e6b333208e5c4da3f844fe2b9083b1394..521328f605ebde34d6f8730fc897602423cde02a 100644 (file)
@@ -25,6 +25,7 @@
 #include "joystick.h"
 #include "cartoons.h"
 #include "network.h"
+#include "tape.h"
 
 #if defined(PLATFORM_MSDOS)
 extern boolean wait_for_vsync;