From 49221e59bff18cdfbef8c877b588280266ae5037 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 3 Dec 2000 17:26:57 +0100 Subject: [PATCH] rnd-20001203-3-src --- src/init.c | 12 +- src/libgame/gadgets.c | 258 ++---------------------------------------- src/libgame/gadgets.h | 66 +---------- src/libgame/libgame.h | 20 ++++ src/libgame/misc.c | 2 +- src/libgame/msdos.c | 3 +- src/libgame/system.c | 59 +++++----- src/libgame/system.h | 26 ++++- src/libgame/text.c | 10 +- src/libgame/types.h | 16 +++ src/main.c | 4 + src/main.h | 12 ++ src/tape.c | 254 ++++++++++++++++++++++++++++++++++++++++- src/tape.h | 65 ++++++++++- src/tools.c | 1 + 15 files changed, 446 insertions(+), 362 deletions(-) diff --git a/src/init.c b/src/init.c index 08bbb05b..241849ce 100644 --- a/src/init.c +++ b/src/init.c @@ -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 */ diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 9827fc80..aeb5ec9c 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -15,251 +15,12 @@ #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< 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) diff --git a/src/libgame/gadgets.h b/src/libgame/gadgets.h index 44a64f5f..ccac2373 100644 --- a/src/libgame/gadgets.h +++ b/src/libgame/gadgets.h @@ -16,72 +16,8 @@ #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) diff --git a/src/libgame/libgame.h b/src/libgame/libgame.h index 95dba9b3..fd613b9c 100644 --- a/src/libgame/libgame.h +++ b/src/libgame/libgame.h @@ -26,4 +26,24 @@ #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 */ diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 572ff360..771918ea 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -17,7 +17,7 @@ #include #include -#include "libgame.h" +#include "platform.h" #if !defined(PLATFORM_WIN32) #include diff --git a/src/libgame/msdos.c b/src/libgame/msdos.c index a4914881..b3137b4a 100644 --- a/src/libgame/msdos.c +++ b/src/libgame/msdos.c @@ -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) diff --git a/src/libgame/system.c b/src/libgame/system.c index a88b78cf..471c614f 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -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) diff --git a/src/libgame/system.h b/src/libgame/system.h index 25eb0c66..a16fb4c5 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -37,8 +37,19 @@ #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); diff --git a/src/libgame/text.c b/src/libgame/text.c index 2fbf1cb3..6dfdf7f8 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -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; } diff --git a/src/libgame/types.h b/src/libgame/types.h index e4aad2a3..bd32b02b 100644 --- a/src/libgame/types.h +++ b/src/libgame/types.h @@ -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 */ diff --git a/src/main.c b/src/main.c index bf7e3f5b..c31ace49 100644 --- a/src/main.c +++ b/src/main.c @@ -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; diff --git a/src/main.h b/src/main.h index f2b5320e..fc70fcc9 100644 --- a/src/main.h +++ b/src/main.h @@ -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) @@ -226,7 +228,9 @@ #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 diff --git a/src/tape.c b/src/tape.c index 7a5d5ff3..7add692b 100644 --- a/src/tape.c +++ b/src/tape.c @@ -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< 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); diff --git a/src/tape.h b/src/tape.h index 1f2a4d8f..1727ecf5 100644 --- a/src/tape.h +++ b/src/tape.h @@ -16,7 +16,70 @@ #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); diff --git a/src/tools.c b/src/tools.c index 78fd3d6e..521328f6 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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; -- 2.34.1