diff --git a/BUGS b/BUGS index 61026ca..8ce3322 100644 --- a/BUGS +++ b/BUGS @@ -1,4 +1,5 @@ Known Bugs: +% sound sounds wrong on linux > 2.1.95 or so % svgalib needs -force8bpp option % weird colors at times in 8bpp X mode % Enlightenment window manager screws up 8bpp colors diff --git a/COMPILING b/COMPILING index 680b2d5..cd55aba 100644 --- a/COMPILING +++ b/COMPILING @@ -1,12 +1,13 @@ First you have to get the ggi graphics library. * for newest updates/info check out http://www.ggi-project.org * Get a new snapshot from ftp://synergy.caltech.edu/pub/ggi/ggi-snapshots - * Get a newer one --> I developed it with ggi-980226.tar.gz + * Get a newer one --> I developed it with ggi-980403.tar.gz * save it * uncompress it "tar -xzvf ggi-980226.tar.gz" * "cd ggi" "cd lib" "cd libggi" "make" - * this brings up a menu. be sure to choose "xserv","svga" and "mem" - you can choose others if you wish, but these are all needed. + * Select the "TARGETS" option on the menu + * this brings up a menu. be sure to choose "xserv","xlib", "svga","multi" + and "mem" you can choose others if you wish, but these are the ones I use. * exit the menu * "make" * should compile w/o problems [hopefully] diff --git a/Makefile b/Makefile index 6fd635c..a75cd75 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ############################################################## -# Makefile for Seabattle 1.0 -- by Vince Weaver # +# Makefile for Tom Bombem -- by Vince Weaver # # # # Written on Linux 2.1.35 # # # @@ -28,8 +28,8 @@ clean: rm -f tb1 rm -f *~ -tb1: tb1.o svmwgrap.o tblib.o level1.o level2.o soundIt.o - $(CC) $(C_OPTS) -o tb1 tb1.o svmwgrap.o tblib.o level1.o level2.o soundIt.o $(L_OPTS) +tb1: tb1.o svmwgrap.o gtblib.o tblib.o level1.o level2.o soundIt.o + $(CC) $(C_OPTS) -o tb1 tb1.o svmwgrap.o gtblib.o tblib.o level1.o level2.o soundIt.o $(L_OPTS) @strip tb1 soundIt.o: soundIt.c @@ -38,6 +38,9 @@ soundIt.o: soundIt.c tb1.o: tb1.c $(CC) $(C_OPTS) -c tb1.c +gtblib.o: gtblib.c + $(CC) $(C_OPTS) -c gtblib.c + tblib.o: tblib.c $(CC) $(C_OPTS) -c tblib.c diff --git a/devel/Makefile b/devel/Makefile new file mode 100644 index 0000000..5bf1c0b --- /dev/null +++ b/devel/Makefile @@ -0,0 +1,49 @@ +############################################################## +# Makefile for TbLevelEdit -- by Vince Weaver # +# # +# Written on Linux 2.1.35 # +# # +# To modify for your configuration, add or remove the # # +# # +############################################################## + +#Your compiler. If gcc doesn't work, try CC +CC = gcc +#CC = cc + +#On Linux, uncomment the following +# +PLATFORM = Linux +C_OPTS = -O2 -Wall -DHAVE_LINUX_SOUND +L_OPTS = -lggi + +###################################################################### +# THERE IS NO NEED TO EDIT ANYTHING BELOW THIS LINE # +###################################################################### + +all: lev2edit view_ppro + +clean: + rm -f *.o + rm -f lev2edit + rm -f *~ + +lev2edit: lev2edit.o ../svmwgrap.o + $(CC) $(C_OPTS) -o lev2edit lev2edit.o ../svmwgrap.o ../gtblib.o $(L_OPTS) + @strip lev2edit + +view_ppro: view_ppro.o ../svmwgrap.o + $(CC) $(C_OPTS) -o view_ppro view_ppro.o ../svmwgrap.o $(L_OPTS) + @strip view_ppro + +view_ppro.o: view_ppro.c + $(CC) $(C_OPTS) -c view_ppro.c + +lev2edit.o: lev2edit.c + $(CC) $(C_OPTS) -c lev2edit.c + +../svmwgrap.o: ../svmwgrap.c + $(CC) $(C_OPTS) -c ../svmwgrap.c + +../gtblib.o: ../gtblib.c + $(CC) $(C_OPTS) -c ../gtblib.c diff --git a/devel/lev2edit.c b/devel/lev2edit.c new file mode 100644 index 0000000..205cad5 --- /dev/null +++ b/devel/lev2edit.c @@ -0,0 +1,288 @@ +/****************************************************************\ +\* TOM BOMBEM AND THE INVASION OF THE INANIMATE_OBJECTS */ +/* version 2.9.0 February 28, 1998 *\ +\* by Vince Weaver weave@eng.umd.edu */ +/* *\ +\* Originally written in Pascal and x86 assembly for DOS */ +/* Ported to Linux, C, and ggi late 1997-early 1998 *\ +\* This source is released under the GPL */ +/****************************************************************/ + +#define TB1_VERSION "2.9.0" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include "../svmwgrap.h" +#include "../gtblib.h" + + /* Exported Global Variables */ +ggi_visual_t vis,vaddr,vaddr2; +vmw_font *tb1_font; +uint white; +ggi_color eight_bit_pal[256]; +ggi_pixel tb1_pal[256]; +int color_depth; +ggi_directbuffer_t dbuf_vis,dbuf_vaddr,dbuf_vaddr2; +ggi_pixellinearbuffer *plb_vis = NULL,*plb_vaddr= NULL,*plb_vaddr2=NULL; +int stride_factor=1; +int sound_enabled=1,sound_possible=1,read_only_mode=0; +char path_to_data[256]; + +struct timeval time_info; +struct timezone dontcare; + +/*----------------*/ + +int game_map[12][200]; +int max_x,max_y,u_x,u_y,x_pos=0,y_pos=0,x,y; +char tempst[40]; + + + /* Setup the Graphics */ +int setup_graphics(int force_8bpp) +{ + int err; + ggi_mode mode; + int vx,vy,sx,sy; + + ggiInit(); + vis=ggiOpen(NULL); + + if (force_8bpp) + err=ggiSetGraphMode(vis,320,200,320,200,GT_8BIT); + else + err=ggiSetGraphMode(vis,320,200,320,200,GGI_AUTO); + if (err) { + fprintf(stderr,"ERROR! Problem opening 320x200 vis\n\n"); + return 2; + } + + ggiGetMode(vis,&mode); + vx=mode.virt.x; vy=mode.virt.y; + sx=mode.visible.x;sy=mode.visible.y; + switch (mode.graphtype) { + case GT_1BIT: color_depth=1;break; + case GT_4BIT: color_depth=4;break; + case GT_8BIT: color_depth=8;break; + case GT_15BIT: color_depth=15;break; + case GT_16BIT: color_depth=16;break; + case GT_24BIT: color_depth=24;break; + case GT_32BIT: color_depth=32;break; + default: break; + } + printf(" + Opened a %d x %d (%d x %d) mode with %d bpp\n", + sx,sy,vx,vy,color_depth); + + err = ggiDBGetBuffer (vis, &dbuf_vis); + if (err) { + printf("Error! Could not get directbuffer\n"); + return 2; + } + if (!(ggiDBGetLayout (dbuf_vis) == blPixelLinearBuffer)) { + printf("Error! Nonlinear Display Buffer.\n"); + return 2; + } + if (!(plb_vis = ggiDBGetPLB (dbuf_vis)) ) { + printf("Error! Problem getting pixel linear buffer.\n"); + return 2; + } + + vaddr=ggiOpen("display-memory",NULL); + err=ggiSetGraphMode(vaddr,320,200,320,200,mode.graphtype); + if (err) { + printf("ERROR! Problem opening 320x200x%d vaddr\n",color_depth); + return 2; + } + err = ggiDBGetBuffer (vaddr, &dbuf_vaddr); + if (err) { + printf("Error! Could not get directbuffer\n"); + return 2; + } + if (!(ggiDBGetLayout (dbuf_vaddr) == blPixelLinearBuffer)) { + printf("Error! Nonlinear Display Buffer.\n"); + return 2; + } + if (!(plb_vaddr = ggiDBGetPLB (dbuf_vaddr)) ) { + printf("Error! Problem getting pixel linear buffer.\n"); + return 2; + } + + vaddr2=ggiOpen("display-memory",NULL); + err=ggiSetGraphMode(vaddr2,320,400,320,400,mode.graphtype); + if (err){ + printf("ERROR! Problem opening 320x400x%d vaddr2\n",color_depth); + return 2; + } + err = ggiDBGetBuffer (vaddr2, &dbuf_vaddr2); + if (err) { + printf("Error! Could not get directbuffer\n"); + return 2; + } + if (!(ggiDBGetLayout (dbuf_vaddr2) == blPixelLinearBuffer)) { + printf("Error! Nonlinear Display Buffer.\n"); + return 2; + } + if (!(plb_vaddr2 = ggiDBGetPLB (dbuf_vaddr2)) ) { + printf("Error! Problem getting pixel linear buffer.\n"); + return 2; + } + stride_factor=(plb_vis->stride)/320; + printf(" + Using a stride factor of %d\n",stride_factor); + printf(" + GGI Graphics Initialization successful...\n"); + printf(" + Running TB1 in %dbpp Mode...\n",color_depth); + return 0; +} + +int command_line_help(int show_version,char *runas) +{ + if (!show_version) { + printf("Usage: %s [-force8bpp] [-nosound] [-readonly]" + " [-version] [-?]\n\n",runas); + printf(" -force8bpp : force to run in 8bpp mode\n"); + printf(" -version : print version\n"); + printf(" -? : print this help message\n"); + printf("\n"); + } + return 0; +} + + +int main(int argc,char **argv) +{ + int i,grapherror,reloadpic=0,force_8bpp=0; + int ch,ch2,x,barpos,time_sec; + char *tempst[300]; + FILE *fff; + + printf("\nTom Bombem Level Editor by Vince Weaver weave@eng.umd.edu\n"); + printf(" http://www.glue.umd.edu/~weave/tb1\n\n"); + + /* Parse Command Line Arguments */ + i=1; + while(iwrite,plb_vaddr->read,plb_vis->stride,200); + ggiFlush(vis); + + barpos=0; + + ggiFlush(vis); + ch=0; + + + + while( ((ch=get_input())==0)) { + usleep(10); + } + + /* Change menu position based on key pressed */ + ch2=toupper(ch); + if (ch==TB_DOWN) y_pos++; + if (ch==TB_RIGHT) x_pos++; + if (ch==TB_UP) y_pos--; + if (ch==TB_LEFT) x_pos--; + if (y_pos<0) y_pos=0; if(x_pos<0) x_pos=0; + if (y_pos>(max_y-20)) y_pos=max_y-20; + if (x_pos>(max_x)) x_pos=max_x; + + ggiSetGCForeground(vaddr,tb1_pal[0]); + ggiFillscreen(vaddr); + + + for(x=0;x +#include +#include +#include +#include "../svmwgrap.h" + +ggi_visual_t vis,vaddr; +uint white; +ggi_color eight_bit_pal[256]; +ggi_pixel tb1_pal[256]; +ggi_directbuffer_t dbuf; +ggi_directbuffer_t dbuf2; +ggi_pixellinearbuffer *plb = NULL; +ggi_pixellinearbuffer *plb2= NULL; +char *dest,*src; + +int ch; + +int get_input() { + + int evmask; + ggi_event ev; + struct timeval t={0,0}; + + evmask=emKeyPress|emKeyRelease|emPointer; + + while (ggiEventPoll(vis,evmask,&t)) + { + /*ggiEventPoll(vis,evmask,NULL);*/ + + do { + ggiEventRead(vis,&ev,evmask); + } while(! ( (1 << ev.any.type) & evmask ) ); + + if (ev.any.type==evKeyPress) { + switch(KTYP(U(ev.key.sym))) { + case KT_LATIN: + case KT_LETTER: + switch(KVAL(U(ev.key.sym))) { + case ' ': /* space */ + printf("Space\n");exit (1); break; + case '\x1b': /* esc */ + printf("escape\n");break; + case ',': + printf("Comma\n");break; + case '.': + printf("Period\n");break; + case '0':break; + case '1':break; + case '2':break; + case '3':break; + case '4':break; + case '5':break; + case '6':break; + case '7':break; + case '8':break; + case '9':printf("9\n");break; + default: printf("latin sym=%4x code=%4x (%c)\n",ev.key.sym,ev.key.code,KVAL(U(ev.key.sym)));break; + } + break; + default: + switch(U(ev.key.sym)) { + case K_UP: /* CrSr up */ + case K_P8: /* Keypad 8 */ + printf("Up\n");break; + case K_DOWN: /* CrSr down */ + case K_P2: /* Keypad 2 */ + printf("Down\n");break; + case K_RIGHT: /* CrSr right */ + case K_P6: /* CrSr right */ + printf("Right\n");break; + case K_LEFT: /* CrSr left */ + case K_P4: /* CrSr left */ + printf("Left\n");break; + case K_ENTER: /* enter */ + printf("Enter\n");break; + case K_P9: + case K_P7: + break; + case K_P3: + case K_P1: + break; + default: printf("sym=%4x code=%4x\n",ev.key.sym,ev.key.code);break; + } + } + } + else if (ev.any.type==evKeyRelease){ + switch(KTYP(U(ev.key.sym))) { + case KT_LATIN: + case KT_LETTER: + switch(KVAL(U(ev.key.sym))) { + case ' ': /* space */ + printf("Sp2\n");break; + case '\x1b': /* esc */ + printf("Escape2\n");break; + case ',': + case '.': + break; + case '0':break; + case '1':break; + case '2':break; + case '3':break; + case '4':break; + case '5':break; + case '6':break; + case '7':break; + case '8':break; + case '9':break; + } + break; + default: + switch(U(ev.key.sym)) { + case K_UP: /* CrSr up */ + case K_P8: /* Keypad 8 */ + case K_DOWN: /* CrSr down */ + case K_P2: /* Keypad 2 */ + printf("What is this?\n");break; + case K_RIGHT: /* CrSr right */ + case K_P6: /* CrSr right */ + case K_LEFT: /* CrSr left */ + case K_P4: /* CrSr left */ + printf("Hmmmmmmm\n");;break; + case K_ENTER: /* enter */ + printf("Boom\n");break; + case K_P9: + case K_P7: + case K_P3: + case K_P1: + break; + } + } + + } + + } + return 4; + } + + + + + + +int setup_graphics() +{ + int err; + + ggiInit(); + + vis=ggiOpen(NULL); + + err=ggiSetGraphMode(vis,320,200,320,200,GT_8BIT); + + if (err) { + printf("Problem opening 320x200x8 vis\n"); + return 2; + } + + printf("GGI Graphics Initialization OK...\n"); + return 0; +} + + +int main(int argc,char **argv) +{ + + if(argc!=2) + printf("\n\nUsage: %s filename\n\n",argv[0]); + else { + setup_graphics(); + GGILoadPicPacked(0,0,vis,1,1,argv[1], + (ggi_color *)&eight_bit_pal, + (ggi_pixel *)&tb1_pal,16); + + ggiFlush(vis); + sleep(5); + while( ((ch=get_input())!=0)); + while( ((ch=get_input())==0)) usleep(30); + } +} diff --git a/gtblib.c b/gtblib.c new file mode 100644 index 0000000..37e467b --- /dev/null +++ b/gtblib.c @@ -0,0 +1,191 @@ +/* Generic tblib stuff usable by other apps */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "svmwgrap.h" +#include "levels.h" + +extern vmw_font *tb1_font; +extern ggi_visual_t vis; +extern ggi_visual_t vaddr; +extern ggi_visual_t vaddr2; +extern ggi_directbuffer_t dbuf_vis; +extern ggi_directbuffer_t dbuf_vaddr; +extern ggi_directbuffer_t dbuf_vaddr2; +extern ggi_pixellinearbuffer *plb_vis; +extern ggi_pixellinearbuffer *plb_vaddr; +extern ggi_pixellinearbuffer *plb_vaddr2; +extern int stride_factor; +extern char path_to_data[256]; +extern int read_only_mode; +extern ggi_color eight_bit_pal[256]; +extern ggi_pixel tb1_pal[256]; +extern int color_depth; + +#define TB_ESC 27 +#define TB_ENTER 1024 +#define TB_F1 1025 +#define TB_F2 1026 +#define TB_UP 1027 +#define TB_DOWN 1028 +#define TB_LEFT 1029 +#define TB_RIGHT 1030 +#define TB_PGUP 1031 +#define TB_PGDOWN 1032 + +int get_input() { + + int evmask; + ggi_event ev; + struct timeval t={0,0}; + + evmask=emKeyPress|emKeyRelease|emPointer; + + while (ggiEventPoll(vis,evmask,&t)) { + do { + ggiEventRead(vis,&ev,evmask); + } while(! ( (1 << ev.any.type) & evmask ) ); + + if (ev.any.type==evKeyPress) { + switch(KTYP(U(ev.key.sym))) { + case KT_LATIN: + case KT_LETTER: + return (KVAL(U(ev.key.sym))); break; + default: switch(U(ev.key.sym)) { + case K_UP: /* CrSr up */ + case K_P8: /* Keypad 8 */ + return TB_UP;break; + case K_DOWN: /* CrSr down */ + case K_P2: /* Keypad 2 */ + return TB_DOWN;break; + case K_RIGHT: /* CrSr right */ + case K_P6: /* CrSr right */ + return TB_RIGHT;break; + case K_LEFT: /* CrSr left */ + case K_P4: /* CrSr left */ + return TB_LEFT;break; + case K_F1: + return TB_F1;break; + case K_F2: + return TB_F2;break; + case K_ENTER: /* enter */ + return TB_ENTER;break; + default: + /*printf("sym=%4x code=%4x\n",ev.key.sym,ev.key.code);*/break; + } + } + } + } + return 0; +} + + +void clear_keyboard_buffer() +{ + while (get_input()!=0) ; +} + + +void drawsquare(int x1,int y1,int x2,int y2,int col,ggi_visual_t page) +{ + ggiSetGCForeground(page,tb1_pal[col]); + /*ggiDrawHLine(page,x1,y1,(x2-x1)); + * ggiDrawHLine(page,x1,y2,(x2-x1)); + * ggiDrawVLine(page,x1,y1,(y2-y1)); + * ggiDrawVLine(page,x2,y1,(y2-y1));*/ + ggiDrawLine(page,x1,y1,x1,y2); + ggiDrawLine(page,x2,y1,x2,y2); + ggiDrawLine(page,x1,y1,x2,y1); + ggiDrawLine(page,x1,y2,x2,y2); +} + + +void coolbox(int x1,int y1,int x2,int y2,int fill,ggi_visual_t page) +{ + int i; + + for(i=0;i<5;i++) { + /*ggiSetGCForeground(page,31-i); + ggiDrawBox(page,x1+i,y1+i,(x2-x1-i-i),(y2-y1-i-i));*/ + drawsquare(x1+i,y1+i,x2-i,y2-i,31-i,page); + } + if (fill) { + ggiSetGCForeground(page,tb1_pal[7]); + for(i=y1+5;i #include "svmwgrap.h" #include "levels.h" +#include "gtblib.h" #include "tblib.h" #include "soundIt.h" diff --git a/svmwgrap.c b/svmwgrap.c index 910c119..0310d3a 100644 --- a/svmwgrap.c +++ b/svmwgrap.c @@ -66,6 +66,7 @@ int vmwArbitraryCrossBlit(char *src,int x1,int y1,int w,int h, return 0; } + int vmwPutSprite(int *src,int w,int h,int stride_factor, char *dest,int x,int y,int dest_stride) { @@ -82,6 +83,25 @@ int vmwPutSprite(int *src,int w,int h,int stride_factor, } +int vmwPutPartialSprite(int *src,int w,int h,int stride_factor, + char *dest,int x,int y,int dest_stride, + int x_start,int x_stop,int y_start,int y_stop) +{ /* x_start/stop not implemented yet */ + int xx,yy; + dest+=(dest_stride*y); + for(yy=0;yy=y_start) && (yy<=y_stop)) ) + memcpy(dest+(stride_factor*(xx+x)),(src+xx),stride_factor); + /**(dest+xx+x)=15;*/ + src+=w; + dest+=dest_stride; + } + return 0; + +} + + int vmwGetSprite(ggi_visual_t visual,int x,int y,int w,int h, int *sprite) { diff --git a/svmwgrap.h b/svmwgrap.h index 7b03470..2ffb2a8 100644 --- a/svmwgrap.h +++ b/svmwgrap.h @@ -21,6 +21,9 @@ int vmwArbitraryCrossBlit(char *src,int x1,int y1,int w,int h, int vmwPutSprite(int *src,int w,int h,int stride_factor, char *dest,int x,int y,int dest_stride); +int vmwPutPartialSprite(int *src,int w,int h,int stride_factor, + char *dest,int x,int y,int dest_stride, + int x_start,int x_stop,int y_start,int y_stop); int vmwGetSprite(ggi_visual_t visual,int x,int y,int w,int h, int *sprite); diff --git a/tb1.c b/tb1.c index 1186772..a5d2b91 100644 --- a/tb1.c +++ b/tb1.c @@ -18,9 +18,9 @@ #include #include -#include - +#include #include "svmwgrap.h" +#include "gtblib.h" #include "tblib.h" /* Exported Global Variables */ diff --git a/tblib.c b/tblib.c index 5e9e327..2068c77 100644 --- a/tblib.c +++ b/tblib.c @@ -29,6 +29,8 @@ extern ggi_color eight_bit_pal[256]; extern ggi_pixel tb1_pal[256]; extern int color_depth; +Sample sound_effects[1]; + #define TB_ESC 27 #define TB_ENTER 1024 #define TB_F1 1025 @@ -99,129 +101,6 @@ char *tb1_data_file(char *name, char *store) return store; } -int get_input() { - - int evmask; - ggi_event ev; - struct timeval t={0,0}; - - evmask=emKeyPress|emKeyRelease|emPointer; - - while (ggiEventPoll(vis,evmask,&t)) { - do { - ggiEventRead(vis,&ev,evmask); - } while(! ( (1 << ev.any.type) & evmask ) ); - - if (ev.any.type==evKeyPress) { - switch(KTYP(U(ev.key.sym))) { - case KT_LATIN: - case KT_LETTER: - return (KVAL(U(ev.key.sym))); break; - default: switch(U(ev.key.sym)) { - case K_UP: /* CrSr up */ - case K_P8: /* Keypad 8 */ - return TB_UP;break; - case K_DOWN: /* CrSr down */ - case K_P2: /* Keypad 2 */ - return TB_DOWN;break; - case K_RIGHT: /* CrSr right */ - case K_P6: /* CrSr right */ - return TB_RIGHT;break; - case K_LEFT: /* CrSr left */ - case K_P4: /* CrSr left */ - return TB_LEFT;break; - case K_F1: - return TB_F1;break; - case K_F2: - return TB_F2;break; - case K_ENTER: /* enter */ - return TB_ENTER;break; - default: - /*printf("sym=%4x code=%4x\n",ev.key.sym,ev.key.code);*/break; - } - } - } - } - return 0; -} - - -void clear_keyboard_buffer() -{ - while (get_input()!=0) ; -} - -void drawsquare(int x1,int y1,int x2,int y2,int col,ggi_visual_t page) -{ - ggiSetGCForeground(page,tb1_pal[col]); - /*ggiDrawHLine(page,x1,y1,(x2-x1)); - ggiDrawHLine(page,x1,y2,(x2-x1)); - ggiDrawVLine(page,x1,y1,(y2-y1)); - ggiDrawVLine(page,x2,y1,(y2-y1));*/ - ggiDrawLine(page,x1,y1,x1,y2); - ggiDrawLine(page,x2,y1,x2,y2); - ggiDrawLine(page,x1,y1,x2,y1); - ggiDrawLine(page,x1,y2,x2,y2); -} - -void coolbox(int x1,int y1,int x2,int y2,int fill,ggi_visual_t page) -{ - int i; - - for(i=0;i<5;i++) { - /*ggiSetGCForeground(page,31-i); - ggiDrawBox(page,x1+i,y1+i,(x2-x1-i-i),(y2-y1-i-i));*/ - drawsquare(x1+i,y1+i,x2-i,y2-i,31-i,page); - } - if (fill) { - ggiSetGCForeground(page,tb1_pal[7]); - for(i=y1+5;iread,129,56,49,132, - plb_vis->write,10,10,plb_vis->stride, + plb_vis->write,10,10,plb_vaddr2->stride, stride_factor); - VMWtextxy("YOU ARE TOM BOMBEM, A STRANGE",80,10,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" BUT EFFICIENT MEMBER OF",80,20,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" THE LUNAR SPACE FORCE.",80,30,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); - VMWtextxy("YOU NEVER SAY MUCH AND YOU ARE",80,50,tb1_pal[4],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" RARELY SEEN OUTSIDE OF",80,60,tb1_pal[4],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" YOUR BLUE SPACESUIT.",80,70,tb1_pal[4],tb1_pal[0],0,tb1_font,vis); - VMWtextxy("YOU OFTEN GET YOURSELF IN ",80,90,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" TROUBLE BY SCRATCHING",80,100,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" YOUR HEAD AT INAPPROPRIATE",80,110,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" TIMES.",80,120,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); - VMWtextxy("PRESS ANY KEY....",96,185,tb1_pal[15],tb1_pal[0],0,tb1_font,vis); - pauseawhile(12); + + VMWtextxy("YOU ARE TOM BOMBEM, A STRANGE", + 80,10,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" BUT EFFICIENT MEMBER OF", + 80,20,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" THE LUNAR SPACE FORCE.", + 80,30,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); + VMWtextxy("YOU NEVER SAY MUCH AND YOU ARE", + 80,50,tb1_pal[4],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" RARELY SEEN OUTSIDE OF", + 80,60,tb1_pal[4],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" YOUR BLUE SPACESUIT.", + 80,70,tb1_pal[4],tb1_pal[0],0,tb1_font,vis); + VMWtextxy("YOU OFTEN GET YOURSELF IN ", + 80,90,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" TROUBLE BY SCRATCHING", + 80,100,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" YOUR HEAD AT INAPPROPRIATE", + 80,110,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" TIMES.", + 80,120,tb1_pal[2],tb1_pal[0],0,tb1_font,vis); + VMWtextxy("PRESS ANY KEY....", + 96,185,tb1_pal[15],tb1_pal[0],0,tb1_font,vis); + if (pauseawhile(12)==TB_ESC) goto end; - ggiSetGCForeground(vis,tb1_pal[0]); - ggiDrawBox(vis,0,0,320,200); + ggiSetGCForeground(vis,tb1_pal[0]); + ggiDrawBox(vis,0,0,320,200); - vmwArbitraryCrossBlit(plb_vaddr2->read,129,56,49,132, - plb_vis->write,260,10,plb_vis->stride, - stride_factor); - vmwArbitraryCrossBlit(plb_vaddr2->read,99,104,29,81, - plb_vis->write,287,13,plb_vis->stride, - stride_factor); + vmwArbitraryCrossBlit(plb_vaddr2->read,129,56,49,132, + plb_vis->write,260,10,plb_vis->stride, + stride_factor); + vmwArbitraryCrossBlit(plb_vaddr2->read,99,104,29,81, + plb_vis->write,287,13,plb_vis->stride, + stride_factor); - VMWtextxy("IT IS THE YEAR 2028.",10,10,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); - VMWtextxy("YOU HAVE BEEN SUMMONED BY",10,30,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" LUNAR DICTATOR-IN-CHIEF",10,40,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" VINCENT WEAVER ABOUT A",10,50,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" TOP SECRET THREAT TO ",10,60,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" INTERPLANETARY SECURITY.",10,70,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); - VMWtextxy("YOU ATTEND THE BRIEFING WITH",10,90,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" YOUR USUAL CONFUSED",10,100,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" QUIETNESS. YOU STILL DO",10,110,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" NOT UNDERSTAND YOUR OWN",10,120,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); - VMWtextxy(" SUCCESSFULNESS.",10,130,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); + VMWtextxy("IT IS THE YEAR 2028.", + 10,10,tb1_pal[1],tb1_pal[0],0,tb1_font,vis); + VMWtextxy("YOU HAVE BEEN SUMMONED BY", + 10,30,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" LUNAR DICTATOR-IN-CHIEF", + 10,40,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" VINCENT WEAVER ABOUT A", + 10,50,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" TOP SECRET THREAT TO ", + 10,60,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" INTERPLANETARY SECURITY.", + 10,70,tb1_pal[3],tb1_pal[0],0,tb1_font,vis); + VMWtextxy("YOU ATTEND THE BRIEFING WITH", + 10,90,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" YOUR USUAL CONFUSED", + 10,100,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" QUIETNESS. YOU STILL DO", + 10,110,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" NOT UNDERSTAND YOUR OWN", + 10,120,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); + VMWtextxy(" SUCCESSFULNESS.", + 10,130,tb1_pal[5],tb1_pal[0],0,tb1_font,vis); VMWtextxy("PRESS ANY KEY....",96,185,tb1_pal[15],tb1_pal[0],0,tb1_font,vis); - pauseawhile(10); + if (pauseawhile(10)==TB_ESC) goto end; - GGILoadPicPacked(0,0,vis,1,1, + GGILoadPicPacked(0,0,vis,0,1, tb1_data_file("tbchief.tb1",(char *)tempst), (ggi_color *)&eight_bit_pal, (ggi_pixel *)&tb1_pal,color_depth); @@ -777,36 +637,48 @@ end; plb_vaddr->write,115,55,plb_vis->stride, stride_factor); - pauseawhile(6); + if (pauseawhile(6)==TB_ESC) goto end; + VMWtextxy("Ahhh.... Mr. Bombem.... ",1,1,tb1_pal[15],tb1_pal[0],0,tb1_font,vis); - /* if sbeffects then startsound(sound[1],0,false);*/ - pauseawhile(2); - - /*if sbeffects then startsound(sound[3],0,false);*/ + /* Load The Sound */ + if (sound_possible) { + Snd_loadRawSample(tb1_data_file("tbahh.raw",(char *)&tempst), + &sound_effects[0],0); + /* Initialize Sound, if Possible */ + if (Snd_init( 1,sound_effects,22050,4, + "/dev/dsp")==EXIT_FAILURE) { + printf("ERROR! Cannot init sound.\n"); + sound_enabled=0; + } + } + /* Play "Ahhhhhhh Mr. Bombem..... */ + if (sound_enabled) Snd_effect(0,1); + pauseawhile(2); + vmwArbitraryCrossBlit(plb_vaddr2->read,188,14,91,59, - plb_vis->write,115,55,plb_vis->stride, + plb_vis->write,115,55,plb_vaddr2->stride, stride_factor); - pauseawhile(6); + if (pauseawhile(6)==TB_ESC) goto end; + vmwArbitraryCrossBlit(plb_vaddr->read,115,55,91,59, - plb_vis->write,115,55,plb_vis->stride, + plb_vis->write,115,55,plb_vaddr2->stride, stride_factor); - VMWtextxy("I'll be brief. ",1,1,tb1_pal[15],tb1_pal[0],1,tb1_font,vis); - pauseawhile(5); - VMWtextxy("Do you know how this base was founded?",1,1,tb1_pal[15],tb1_pal[0],1,tb1_font,vis); - pauseawhile(5); + VMWtextxy("I'll be brief. ", + 1,1,tb1_pal[15],tb1_pal[0],1,tb1_font,vis); + if (pauseawhile(5)==TB_ESC) goto end; + VMWtextxy("Do you know how this base was founded?", + 1,1,tb1_pal[15],tb1_pal[0],1,tb1_font,vis); + if (pauseawhile(5)==TB_ESC) goto end; VMWtextxy("No? Well watch the screen. ",1,1,tb1_pal[15],tb1_pal[0],1,tb1_font,vis); - pauseawhile(5); + if (pauseawhile(5)==TB_ESC) goto end; vmwArbitraryCrossBlit(plb_vaddr2->read,210,75,85,60, plb_vis->write,210,136,plb_vis->stride, stride_factor); - pauseawhile(4); + if (pauseawhile(4)==TB_ESC) goto end; - /*pal(250,0,0,0);*/ - - /******BARGE TAKING OFF***********/ GGILoadPicPacked(0,0,vaddr2,1,1, @@ -814,36 +686,71 @@ end; (ggi_color *)&eight_bit_pal, (ggi_pixel *)&tb1_pal,color_depth); - VMWsmalltextxy("MY WIFE AND I FOUNDED",212,3,tb1_pal[14],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("THIS BASE IN 2008.",212,9,tb1_pal[14],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("THE ONLY WAY TO ",212,16,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("FINANCE IT WAS TO",212,22,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("ENGAGE IN A DUBIOUS",212,28,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("BUSINESS.",212,34,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("WE LAUNCHED EARTH'S",212,41,tb1_pal[12],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("TRASH INTO SPACE",212,47,tb1_pal[12],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("FOR A PROFIT.",212,53,tb1_pal[12],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("HERE IS FOOTAGE FROM",212,60,tb1_pal[11],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("THE LAST LAUNCH EIGHT",212,66,tb1_pal[11],tb1_pal[0],0,tb1_font,vaddr2); - VMWsmalltextxy("YEARS AGO.",212,72,tb1_pal[11],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("MY WIFE AND I FOUNDED", + 212,3,tb1_pal[14],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("THIS BASE IN 2008.", + 212,9,tb1_pal[14],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("THE ONLY WAY TO ", + 212,16,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("FINANCE IT WAS TO", + 212,22,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("ENGAGE IN A DUBIOUS", + 212,28,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("BUSINESS.", + 212,34,tb1_pal[13],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("WE LAUNCHED EARTH'S", + 212,41,tb1_pal[12],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("TRASH INTO SPACE", + 212,47,tb1_pal[12],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("FOR A PROFIT.", + 212,53,tb1_pal[12],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("HERE IS FOOTAGE FROM", + 212,60,tb1_pal[11],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("THE LAST LAUNCH EIGHT", + 212,66,tb1_pal[11],tb1_pal[0],0,tb1_font,vaddr2); + VMWsmalltextxy("YEARS AGO.", + 212,72,tb1_pal[11],tb1_pal[0],0,tb1_font,vaddr2); vmwCrossBlit(plb_vaddr->write,plb_vaddr2->read,plb_vis->stride,200); -/* putshape(bargeoff,vaddr,16,18,141,157);*/ - + vmwPutSprite(barge,18,15,stride_factor, + plb_vaddr->write,141,157,plb_vaddr->stride); + vmwCrossBlit(plb_vis->write,plb_vaddr->read,plb_vis->stride,200); - pauseawhile(7); -/* + if (pauseawhile(7)==TB_ESC) goto end; - for ytemp:=191 downto 164 do begin - if ytemp>=172 then blockmove(145,ytemp,152,ytemp+10,vaddr2,145,ytemp,vaddr) - else blockmove(145,172,152,182,vaddr2,145,172,vaddr); - puttruck(145,ytemp,ytemp mod 2,vaddr); - pauseawhile(7); - if keypressed then if readkey=#27 then exit; - flipd320(vaddr,vga); - end; + for(ytemp=191;ytemp>163;ytemp--) { + if (ytemp>=172) vmwArbitraryCrossBlit(plb_vaddr2->read,145,ytemp, + 7,9,plb_vaddr->write,145,ytemp, + plb_vaddr->stride,stride_factor); + + /*blockmove(145,ytemp,152,ytemp+10,vaddr2,145,ytemp,vaddr)*/ + else vmwArbitraryCrossBlit(plb_vaddr2->read,145,172, + 7,9,plb_vaddr->write,145,172, + plb_vaddr->stride,stride_factor); + + + /*blockmove(145,172,152,182,vaddr2,145,172,vaddr);*/ + yzrrp=ytemp-172; + if (yzrrp<0) yzrrp=-yzrrp; + else yzrrp=0; + if (ytemp%2) vmwPutPartialSprite(truck1,5,8,stride_factor, + plb_vaddr->write,145,ytemp, + plb_vaddr->stride,0,5,yzrrp,8); + + else vmwPutPartialSprite(truck2,5,8,stride_factor, + plb_vaddr->write,145,ytemp, + plb_vaddr->stride,0,5,yzrrp,8); + + /* truck1,truck2 + puttruck(145,ytemp,ytemp mod 2,vaddr);*/ + /*if (pauseawhile(1)==TB_ESC) break;*/ + usleep(30000); + vmwCrossBlit(plb_vis->write,plb_vaddr->read,plb_vis->stride,200); + + } +/* pauseawhile(20); flipd320(vaddr2,vaddr); putshape(bargeoff,vaddr,16,18,141,157); @@ -864,7 +771,7 @@ end; ytemp:=ytemp-round(thrust); end; */ - pauseawhile(5); + if (pauseawhile(5)==TB_ESC) goto end; /****SECOND CHIEF*******/ @@ -1004,6 +911,12 @@ end; pauseawhile(6); VMWtextxy(" ",1,1,tb1_pal[9],tb1_pal[0],1,tb1_font,vis); pauseawhile(10); + + end: + /* All Done. Close up sound */ + Snd_restore(); + + } void credits() diff --git a/tblib.h b/tblib.h index bbba957..bcb9a40 100644 --- a/tblib.h +++ b/tblib.h @@ -1,30 +1,12 @@ -#define TB_ESC 27 -#define TB_ENTER 1024 -#define TB_F1 1025 -#define TB_F2 1026 -#define TB_UP 1027 -#define TB_DOWN 1028 -#define TB_LEFT 1029 -#define TB_RIGHT 1030 -#define TB_PGUP 1031 -#define TB_PGDOWN 1032 - int change_shields(int *shields); int changescore(int score,int *shields); int collision(int x1,int y1,int xsize,int ysize,int x2,int y2,int x2size,int y2size); char *tb1_data_file(char *name,char *store); -int get_input(); -void coolbox(int x1,int y1,int x2,int y2,int fill,ggi_visual_t page); -int close_graphics(); -int quit(); void ReadConfigFile(int CDROMmode); int showhiscore(int showchart); -void clear_keyboard_buffer(); void write_hs_list(int score,char *hiname); void help(); void setupsidebar(int score,int hiscore,int shields); -void shadowrite(char *st,int x,int y,int forecol,int backcol,ggi_visual_t vis); -void pauseawhile(int howlong); void options(); void savegame(int level,int begin_score,int begin_shields); void loadgame();