mirror of
https://github.com/deater/tb1.git
synced 2025-04-13 10:37:51 +00:00
Some more changes
This commit is contained in:
parent
e1c4761d2d
commit
de396082e5
1
BUGS
1
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
|
||||
|
@ -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]
|
||||
|
9
Makefile
9
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
|
||||
|
||||
|
49
devel/Makefile
Normal file
49
devel/Makefile
Normal file
@ -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
|
288
devel/lev2edit.c
Normal file
288
devel/lev2edit.c
Normal file
@ -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 <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ggi/libggi.h>
|
||||
#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(i<argc) {
|
||||
if (argv[i][0]=='-') {
|
||||
switch (argv[i][1]) {
|
||||
case 'h': case '?':
|
||||
command_line_help(0,argv[0]); return 5; break;
|
||||
case 'v':
|
||||
command_line_help(1,argv[0]); return 5; break;
|
||||
case 'f':
|
||||
force_8bpp=1; break;
|
||||
default : command_line_help(0,argv[0]);
|
||||
printf("Unknown Option: %s\n\n",argv[i]);
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
command_line_help(0,argv[0]);
|
||||
printf("Unknown Option: %s\n\n",argv[i]);
|
||||
return 5;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Find the Data */
|
||||
/* FIXME : User Defined Path Info*/
|
||||
|
||||
/* Randomize random number generator */
|
||||
srandom(time(NULL));
|
||||
|
||||
/* Load the tom bombem font */
|
||||
tb1_font=LoadVMWFont("../data/tbfont.tb1",8,16,256);
|
||||
|
||||
/* Setup Graphics */
|
||||
if (setup_graphics(force_8bpp)==2) {
|
||||
fprintf(stderr,"ERROR: Couldn't get display set up properly.\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* ggiDrawVLine(vis,x+200,45+(2*x),80-(2*x));
|
||||
}
|
||||
|
||||
ggiSetGCForeground(vis,tb1_pal[15]);
|
||||
VMWtextxy("A VMW SOFTWARE PRODUCTION",60,140,
|
||||
tb1_pal[15],tb1_pal[15],0,tb1_font,vis);
|
||||
ggiFlush(vis);
|
||||
pauseawhile(5);
|
||||
|
||||
ggiSetGCForeground(vis,tb1_pal[0]);
|
||||
ggiFillscreen(vis);
|
||||
|
||||
Load the title screen */
|
||||
grapherror=GGILoadPicPacked(0,0,vis,1,1,
|
||||
"../data/tbomb1.tb1",
|
||||
(ggi_color *)&eight_bit_pal,
|
||||
(ggi_pixel *)&tb1_pal,color_depth);
|
||||
grapherror=GGILoadPicPacked(0,0,vaddr2,1,1,
|
||||
"../data/tbomb1.tb1",
|
||||
(ggi_color *)&eight_bit_pal,
|
||||
(ggi_pixel *)&tb1_pal,color_depth);
|
||||
ggiFlush(vis);
|
||||
ggiFlush(vaddr2);
|
||||
pauseawhile(5);
|
||||
|
||||
max_x=12;max_y=200;
|
||||
x_pos=0; y_pos=0;
|
||||
|
||||
for(x=0;x<max_x;x++)
|
||||
for(y=0;y<max_y;y++)
|
||||
game_map[x][y]=(rand()%26)+65;
|
||||
|
||||
/* Main Menu Loop */
|
||||
while (1) {
|
||||
|
||||
vmwCrossBlit(plb_vis->write,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<max_x;x++)
|
||||
for(y=y_pos;y<(y_pos+20);y++) {
|
||||
sprintf(tempst,"%c",game_map[x][y]);
|
||||
VMWtextxy(tempst,x*20,(y-y_pos)*10,
|
||||
tb1_pal[32],tb1_pal[0],1,tb1_font,vaddr);
|
||||
|
||||
}
|
||||
|
||||
if (ch2=='Q') barpos=6; /*Q*/
|
||||
if (ch==27){ /* escape */
|
||||
barpos=6;
|
||||
ch=TB_ENTER;
|
||||
}
|
||||
if(barpos==7) barpos=0;
|
||||
if(barpos<0) barpos=6;
|
||||
|
||||
/* Run whatever it was that the person pressed */
|
||||
if(barpos==6) quit();
|
||||
}
|
||||
}
|
180
devel/view_ppro.c
Normal file
180
devel/view_ppro.c
Normal file
@ -0,0 +1,180 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ggi/libggi.h>
|
||||
#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);
|
||||
}
|
||||
}
|
191
gtblib.c
Normal file
191
gtblib.c
Normal file
@ -0,0 +1,191 @@
|
||||
/* Generic tblib stuff usable by other apps */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ggi/libggi.h>
|
||||
#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<y2-4;i++) ggiDrawHLine(page,x1+5,i,(x2-x1-9));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int close_graphics()
|
||||
{
|
||||
int err=0;
|
||||
|
||||
err=ggiClose(vis);
|
||||
err+=ggiClose(vaddr);
|
||||
err+=ggiClose(vaddr2);
|
||||
if (err) fprintf(stderr,"Probelms shutting down GGI!\n");
|
||||
else fprintf(stderr,"Shutting down GGI...\n");
|
||||
ggiExit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int quit()
|
||||
{
|
||||
int barpos=0,ch=0,ch2;
|
||||
|
||||
coolbox(90,75,230,125,1,vis);
|
||||
VMWtextxy("QUIT??? ARE YOU",97,82,tb1_pal[9],tb1_pal[7],0,tb1_font,vis);
|
||||
VMWtextxy("ABSOLUTELY SURE?",97,90,tb1_pal[9],tb1_pal[7],0,tb1_font,vis);
|
||||
while (ch!=TB_ENTER){
|
||||
if (barpos==0) VMWtextxy("YES-RIGHT NOW!",97,98,tb1_pal[150],tb1_pal[0],1,tb1_font,vis);
|
||||
else VMWtextxy("YES-RIGHT NOW!",97,98,tb1_pal[150],tb1_pal[7],1,tb1_font,vis);
|
||||
if (barpos==1) VMWtextxy("NO--NOT YET.",97,106,tb1_pal[150],tb1_pal[0],1,tb1_font,vis);
|
||||
else VMWtextxy("NO--NOT YET.",97,106,tb1_pal[150],tb1_pal[7],1,tb1_font,vis);
|
||||
while ( (ch=get_input())==0);
|
||||
ch2=toupper(ch);
|
||||
if ((ch==TB_UP)||(ch==TB_DOWN)||(ch==TB_LEFT)||(ch==TB_RIGHT)) barpos++;
|
||||
if (ch2=='Y') barpos=0;
|
||||
if (ch2=='N') barpos=1;
|
||||
if (barpos==2) barpos=0;
|
||||
}
|
||||
if (barpos==0){
|
||||
close_graphics();
|
||||
exit(1);
|
||||
}
|
||||
else return 6;
|
||||
/*move(imagedata,screen,4000); textcolor(7);*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
int pauseawhile(int howlong)
|
||||
{
|
||||
struct timeval bob;
|
||||
struct timezone mree;
|
||||
long begin_s,begin_u;
|
||||
int ch=0;
|
||||
|
||||
clear_keyboard_buffer();
|
||||
gettimeofday(&bob,&mree);
|
||||
begin_s=bob.tv_sec; begin_u=bob.tv_usec;
|
||||
while(( (bob.tv_sec-begin_s)<howlong) && ( (ch=get_input())==0)) {
|
||||
usleep(30);
|
||||
gettimeofday(&bob,&mree);
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
void shadowrite(char *st,int x5,int y5,int forecol,int backcol,
|
||||
ggi_visual_t vis)
|
||||
{
|
||||
VMWtextxy(st,x5+1,y5+1,tb1_pal[backcol],0,0,tb1_font,vis);
|
||||
VMWtextxy(st,x5,y5,tb1_pal[forecol],0,0,tb1_font,vis);
|
||||
}
|
19
gtblib.h
Normal file
19
gtblib.h
Normal file
@ -0,0 +1,19 @@
|
||||
#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();
|
||||
void coolbox(int x1,int y1,int x2,int y2,int fill,ggi_visual_t page);
|
||||
int close_graphics();
|
||||
int quit();
|
||||
void clear_keyboard_buffer();
|
||||
void shadowrite(char *st,int x,int y,int forecol,int backcol,ggi_visual_t vis);
|
||||
void pauseawhile(int howlong);
|
||||
|
1
level1.c
1
level1.c
@ -11,6 +11,7 @@
|
||||
#include "svmwgrap.h"
|
||||
#include "levels.h"
|
||||
#include "tblib.h"
|
||||
#include "gtblib.h"
|
||||
#include "soundIt.h"
|
||||
|
||||
/* Define this to get a frames per second readout */
|
||||
|
1
level2.c
1
level2.c
@ -10,6 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "svmwgrap.h"
|
||||
#include "levels.h"
|
||||
#include "gtblib.h"
|
||||
#include "tblib.h"
|
||||
#include "soundIt.h"
|
||||
|
||||
|
20
svmwgrap.c
20
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<h;yy++){
|
||||
for(xx=0;xx<w;xx++)
|
||||
if ((*(src+xx)) && ((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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
4
tb1.c
4
tb1.c
@ -18,9 +18,9 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ggi/libggi.h>
|
||||
|
||||
#include <ggi/libggi.h>
|
||||
#include "svmwgrap.h"
|
||||
#include "gtblib.h"
|
||||
#include "tblib.h"
|
||||
|
||||
/* Exported Global Variables */
|
||||
|
435
tblib.c
435
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;i<y2-4;i++) ggiDrawHLine(page,x1+5,i,(x2-x1-9));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int close_graphics()
|
||||
{
|
||||
int err=0;
|
||||
|
||||
err=ggiClose(vis);
|
||||
err+=ggiClose(vaddr);
|
||||
err+=ggiClose(vaddr2);
|
||||
if(err) fprintf(stderr,"Probelms shutting down GGI!\n");
|
||||
else fprintf(stderr,"Shutting down GGI...\n");
|
||||
ggiExit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int quit()
|
||||
{
|
||||
int barpos=0,ch=0,ch2;
|
||||
|
||||
coolbox(90,75,230,125,1,vis);
|
||||
VMWtextxy("QUIT??? ARE YOU",97,82,tb1_pal[9],tb1_pal[7],0,tb1_font,vis);
|
||||
VMWtextxy("ABSOLUTELY SURE?",97,90,tb1_pal[9],tb1_pal[7],0,tb1_font,vis);
|
||||
while (ch!=TB_ENTER){
|
||||
if (barpos==0) VMWtextxy("YES-RIGHT NOW!",97,98,tb1_pal[150],tb1_pal[0],1,tb1_font,vis);
|
||||
else VMWtextxy("YES-RIGHT NOW!",97,98,tb1_pal[150],tb1_pal[7],1,tb1_font,vis);
|
||||
if (barpos==1) VMWtextxy("NO--NOT YET.",97,106,tb1_pal[150],tb1_pal[0],1,tb1_font,vis);
|
||||
else VMWtextxy("NO--NOT YET.",97,106,tb1_pal[150],tb1_pal[7],1,tb1_font,vis);
|
||||
while ( (ch=get_input())==0);
|
||||
ch2=toupper(ch);
|
||||
if ((ch==TB_UP)||(ch==TB_DOWN)||(ch==TB_LEFT)||(ch==TB_RIGHT)) barpos++;
|
||||
if (ch2=='Y') barpos=0;
|
||||
if (ch2=='N') barpos=1;
|
||||
if (barpos==2) barpos=0;
|
||||
}
|
||||
if (barpos==0){
|
||||
close_graphics();
|
||||
exit(1);
|
||||
}
|
||||
else return 6;
|
||||
/*move(imagedata,screen,4000); textcolor(7);*/
|
||||
}
|
||||
|
||||
|
||||
int showhiscore(int showchart)
|
||||
{
|
||||
@ -403,25 +282,6 @@ void setupsidebar(int score,int hiscore,int shields)
|
||||
VMWtextxy("S-SOUND ",251,165,tb1_pal[10],tb1_pal[0],0,tb1_font,vaddr2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void pauseawhile(int howlong)
|
||||
{
|
||||
struct timeval bob;
|
||||
struct timezone mree;
|
||||
long begin_s,begin_u;
|
||||
|
||||
clear_keyboard_buffer();
|
||||
gettimeofday(&bob,&mree);
|
||||
begin_s=bob.tv_sec; begin_u=bob.tv_usec;
|
||||
while(( (bob.tv_sec-begin_s)<howlong) && (get_input()==0)) {
|
||||
usleep(30);
|
||||
gettimeofday(&bob,&mree);
|
||||
}
|
||||
}
|
||||
|
||||
void savegame(int level,int begin_score,int begin_shields)
|
||||
{
|
||||
char ch;
|
||||
@ -518,13 +378,6 @@ void savegame(int level,int begin_score,int begin_shields)
|
||||
while( (ch=get_input())==0) usleep(30);
|
||||
}
|
||||
|
||||
void shadowrite(char *st,int x5,int y5,int forecol,int backcol,
|
||||
ggi_visual_t vis)
|
||||
{
|
||||
VMWtextxy(st,x5+1,y5+1,tb1_pal[backcol],0,0,tb1_font,vis);
|
||||
VMWtextxy(st,x5,y5,tb1_pal[forecol],0,0,tb1_font,vis);
|
||||
}
|
||||
|
||||
void options()
|
||||
{
|
||||
int opbarpos,argh=0,ch=0;
|
||||
@ -633,13 +486,16 @@ void loadgame()
|
||||
|
||||
void story()
|
||||
{
|
||||
int error;
|
||||
int error,yzrrp;
|
||||
int xtemp,ytemp;
|
||||
int thrustcol;
|
||||
float thrust;
|
||||
char tempch;
|
||||
int alienchar;
|
||||
int cycles;
|
||||
int explo1[325],explo2[325],bigflame1[600],bigflame2[600];
|
||||
int rent[125],sflame1[25],sflame2[25],barge[310];
|
||||
int truck1[60],truck2[60];
|
||||
char *tempst[300];
|
||||
/*
|
||||
procedure doflames;
|
||||
@ -678,97 +534,101 @@ begin
|
||||
end;
|
||||
*/
|
||||
|
||||
GGILoadPicPacked(0,0,vaddr,1,1,
|
||||
GGILoadPicPacked(0,0,vaddr,0,1,
|
||||
tb1_data_file("tbsobj.tb1",(char *)tempst),
|
||||
(ggi_color *)&eight_bit_pal,
|
||||
(ggi_pixel *)&tb1_pal,color_depth);
|
||||
/*
|
||||
for ytemp:=0 to 18 do
|
||||
for xtemp:=0 to 26 do begin
|
||||
ShapeTable1^[((ytemp*27)+xtemp)+bigflame1off]:=getpixel(xtemp,ytemp+2,vaddr);
|
||||
ShapeTable1^[((ytemp*27)+xtemp)+bigflame2off]:=getpixel(xtemp,ytemp+21,vaddr);
|
||||
end;
|
||||
for ytemp:=0 to 18 do
|
||||
for xtemp:=0 to 15 do begin
|
||||
ShapeTable1^[((ytemp*16)+xtemp)+explo1off]:=getpixel(127+xtemp,ytemp+100,vaddr);
|
||||
ShapeTable1^[((ytemp*16)+xtemp)+explo2off]:=getpixel(148+xtemp,ytemp+100,vaddr);
|
||||
end;
|
||||
for ytemp:=0 to 6 do
|
||||
for xtemp:=0 to 15 do
|
||||
ShapeTable1^[((ytemp*16)+xtemp)+rent1off]:=getpixel(168+xtemp,ytemp+100,vaddr);
|
||||
|
||||
for ytemp:=0 to 4 do
|
||||
for xtemp:=0 to 3 do begin
|
||||
ShapeTable1^[((ytemp*4)+xtemp)+sflame1off]:=getpixel(xtemp,ytemp+43,vaddr);
|
||||
ShapeTable1^[((ytemp*4)+xtemp)+sflame2off]:=getpixel(xtemp,ytemp+47,vaddr);
|
||||
end;
|
||||
|
||||
for ytemp:=0 to 18 do
|
||||
for xtemp:=0 to 15 do
|
||||
ShapeTable1^[((ytemp*16)+xtemp)+bargeoff]:=getpixel(xtemp+65,ytemp+100,vaddr);
|
||||
|
||||
for ytemp:=0 to 8 do
|
||||
for xtemp:=0 to 5 do begin
|
||||
ShapeTable1^[((ytemp*6)+xtemp)+truck1off]:=getpixel(xtemp+85,ytemp+100,vaddr);
|
||||
ShapeTable1^[((ytemp*6)+xtemp)+truck2off]:=getpixel(xtemp+95,ytemp+100,vaddr);
|
||||
end;
|
||||
*/
|
||||
|
||||
vmwGetSprite(vaddr,0,2,26,18,bigflame1);
|
||||
vmwGetSprite(vaddr,0,21,26,18,bigflame2);
|
||||
vmwGetSprite(vaddr,127,100,15,18,explo1);
|
||||
vmwGetSprite(vaddr,148,100,15,18,explo2);
|
||||
vmwGetSprite(vaddr,168,100,15,6,rent);
|
||||
vmwGetSprite(vaddr,0,43,3,4,sflame1);
|
||||
vmwGetSprite(vaddr,0,47,3,4,sflame2);
|
||||
vmwGetSprite(vaddr,65,100,18,15,barge);
|
||||
vmwGetSprite(vaddr,85,100,5,8,truck1);
|
||||
vmwGetSprite(vaddr,95,100,5,8,truck2);
|
||||
|
||||
/******FIRST MESSAGE********/
|
||||
ggiSetGCForeground(vis,tb1_pal[0]);
|
||||
ggiDrawBox(vis,0,0,320,200);
|
||||
|
||||
VMWtextxy("THE STORY SO FAR...",20,20,tb1_pal[4],tb1_pal[0],0,tb1_font,vis);
|
||||
pauseawhile(7);
|
||||
VMWtextxy("THE STORY SO FAR...",
|
||||
20,20,tb1_pal[4],tb1_pal[0],0,tb1_font,vis);
|
||||
if (pauseawhile(7)==TB_ESC) goto end;
|
||||
|
||||
ggiSetGCForeground(vis,tb1_pal[0]);
|
||||
ggiDrawBox(vis,0,0,320,200);
|
||||
|
||||
GGILoadPicPacked(0,0,vaddr2,1,1,
|
||||
GGILoadPicPacked(0,0,vaddr2,0,1,
|
||||
tb1_data_file("tbcobj.tb1",(char *)tempst),
|
||||
(ggi_color *)&eight_bit_pal,
|
||||
(ggi_pixel *)&tb1_pal,color_depth);
|
||||
vmwArbitraryCrossBlit(plb_vaddr2->read,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("<Huh?> ",1,1,tb1_pal[9],tb1_pal[0],1,tb1_font,vis);
|
||||
pauseawhile(10);
|
||||
|
||||
end:
|
||||
/* All Done. Close up sound */
|
||||
Snd_restore();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void credits()
|
||||
|
18
tblib.h
18
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user