Version 2.9.5

This commit is contained in:
Vince Weaver
2000-09-17 23:50:00 -04:00
parent 185e1ecf2c
commit 486148bc84
51 changed files with 525 additions and 391 deletions

View File

@@ -21,9 +21,9 @@ void about(tb1_state *game_state)
vmwClearScreen(target1,0); vmwClearScreen(target1,0);
vmwLoadPicPacked(0,0,target2,1,1, vmwLoadPicPacked(0,0,target2,1,1,
tb1_data_file("register.tb1",game_state->path_to_data)); tb1_data_file("./about/register.tb1",game_state->path_to_data));
vmwLoadPicPacked(0,0,target1,1,0, /* Load Palette */ vmwLoadPicPacked(0,0,target1,1,0, /* Load Palette */
tb1_data_file("register.tb1",game_state->path_to_data)); tb1_data_file("./about/register.tb1",game_state->path_to_data));
while ((ch!=VMW_ESCAPE)&&(ch!='q')){ while ((ch!=VMW_ESCAPE)&&(ch!='q')){
while(( (ch=vmwGetInput())==0) && (firstime)); while(( (ch=vmwGetInput())==0) && (firstime));

View File

@@ -5,9 +5,9 @@ Chipper
Kevin Kevin
Leonard Leonard
Lizann Lizann
VINCECOOL
Vinnels
Pete Pete
Vinnie
joebob
5000 5000
4500 4500
4000 4000
@@ -15,6 +15,6 @@ joebob
3000 3000
2500 2500
2000 2000
1570
1540
1500 1500
1200
1160

View File

@@ -109,6 +109,9 @@ char *vmwGrInput(tb1_state *game_state,int x,int y,int howlong,int forecol,int b
ch=-1; ch=-1;
vmwTextXY(" ",x,y,forecol,backcol,1,tb1_font,vis);
vmwBlitMemToDisplay(game_state->graph_state,vis);
while (ch!=VMW_ENTER) { while (ch!=VMW_ENTER) {
while ((ch=vmwGetInput())==0) usleep(30); while ((ch=vmwGetInput())==0) usleep(30);

View File

@@ -79,7 +79,7 @@ void beforeboss(tb1_state *game_state)
vmwClearKeyboardBuffer(); vmwClearKeyboardBuffer();
vmwLoadPicPacked(0,0,game_state->virtual_3,0,1, vmwLoadPicPacked(0,0,game_state->virtual_3,0,1,
tb1_data_file("viewscr.tb1",game_state->path_to_data)); tb1_data_file("level1/viewscr.tb1",game_state->path_to_data));
vmwClearScreen(game_state->virtual_1,0); vmwClearScreen(game_state->virtual_1,0);
vmwArbitraryCrossBlit(game_state->virtual_3,0,5,58,37, vmwArbitraryCrossBlit(game_state->virtual_3,0,5,58,37,
game_state->virtual_1,10,10); game_state->virtual_1,10,10);
@@ -130,7 +130,7 @@ void afterboss(tb1_state *game_state)
tb1_font=game_state->graph_state->default_font; tb1_font=game_state->graph_state->default_font;
vmwLoadPicPacked(0,0,game_state->virtual_3,0,1, vmwLoadPicPacked(0,0,game_state->virtual_3,0,1,
tb1_data_file("viewscr.tb1",game_state->path_to_data)); tb1_data_file("level1/viewscr.tb1",game_state->path_to_data));
vmwDrawBox(0,0,320,200,0,game_state->virtual_1); vmwDrawBox(0,0,320,200,0,game_state->virtual_1);
vmwArbitraryCrossBlit(game_state->virtual_3,0,42,58,37, vmwArbitraryCrossBlit(game_state->virtual_3,0,42,58,37,
game_state->virtual_1,10,10); game_state->virtual_1,10,10);
@@ -362,14 +362,14 @@ void levelone(tb1_state *game_state) {
/* Load Sprites */ /* Load Sprites */
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1, grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1,
tb1_data_file("ships.tb1",game_state->path_to_data)); tb1_data_file("level1/ships.tb1",game_state->path_to_data));
bigship1=vmwGetSprite(0,0,48,30,virtual_1); bigship1=vmwGetSprite(0,0,48,30,virtual_1);
bigship2=vmwGetSprite(0,32,48,30,virtual_1); bigship2=vmwGetSprite(0,32,48,30,virtual_1);
bigship3=vmwGetSprite(0,64,48,30,virtual_1); bigship3=vmwGetSprite(0,64,48,30,virtual_1);
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1, grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1,
tb1_data_file("tbshapes.tb1",game_state->path_to_data)); tb1_data_file("level1/tbshapes.tb1",game_state->path_to_data));
for(j=0;j<2;j++) for(j=0;j<2;j++)
for(i=0;i<10;i++) for(i=0;i<10;i++)
@@ -641,9 +641,9 @@ void littleopener(tb1_state *game_state)
vmwClearScreen(game_state->virtual_2,0); vmwClearScreen(game_state->virtual_2,0);
vmwLoadPicPacked(0,0,game_state->virtual_2,1,1, vmwLoadPicPacked(0,0,game_state->virtual_2,1,1,
tb1_data_file("moon2.tb1",game_state->path_to_data)); tb1_data_file("level1/moon2.tb1",game_state->path_to_data));
vmwLoadPicPacked(0,0,game_state->virtual_1,1,0, /* Load palette */ vmwLoadPicPacked(0,0,game_state->virtual_1,1,0, /* Load palette */
tb1_data_file("moon2.tb1",game_state->path_to_data)); tb1_data_file("level1/moon2.tb1",game_state->path_to_data));
ship1=vmwGetSprite(9,178,15,18,game_state->virtual_2); ship1=vmwGetSprite(9,178,15,18,game_state->virtual_2);
ship2=vmwGetSprite(30,178,15,18,game_state->virtual_2); ship2=vmwGetSprite(30,178,15,18,game_state->virtual_2);
@@ -679,6 +679,6 @@ void littleopener(tb1_state *game_state)
vmwDrawBox(0,0,320,200,0,game_state->virtual_1); vmwDrawBox(0,0,320,200,0,game_state->virtual_1);
vmwLoadPicPacked(0,0,game_state->virtual_1,1,0, /* Restore Palette */ vmwLoadPicPacked(0,0,game_state->virtual_1,1,0, /* Restore Palette */
tb1_data_file("tbgorg.tb1",game_state->path_to_data)); tb1_data_file("tbomb1.tb1",game_state->path_to_data));
} }

View File

@@ -93,12 +93,9 @@ void leveltwoengine(tb1_state *game_state)
game_state->begin_score=game_state->score; game_state->begin_score=game_state->score;
game_state->begin_shields=game_state->shields; game_state->begin_shields=game_state->shields;
printf("Starting level 2\n"); fflush(stdout);
/* Load Sprites */ /* Load Sprites */
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1, grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1,
tb1_data_file("ships.tb1", tb1_data_file("level1/ships.tb1",
game_state->path_to_data)); game_state->path_to_data));
ship_shape[0]=vmwGetSprite(0,0,48,30,virtual_1); ship_shape[0]=vmwGetSprite(0,0,48,30,virtual_1);
@@ -107,21 +104,19 @@ void leveltwoengine(tb1_state *game_state)
if (game_state->level==2) vmwLoadPicPacked(0,0,virtual_1,1,1, if (game_state->level==2) vmwLoadPicPacked(0,0,virtual_1,1,1,
tb1_data_file("tbaship.tb1",game_state->path_to_data)); tb1_data_file("level2/tbaship.tb1",game_state->path_to_data));
if (game_state->level==4) vmwLoadPicPacked(0,0,virtual_1,1,1, if (game_state->level==4) vmwLoadPicPacked(0,0,virtual_1,1,1,
tb1_data_file("tbeerm.tb1",game_state->path_to_data)); tb1_data_file("level4/tbeerm.tb1",game_state->path_to_data));
for(j=0;j<4;j++) for(j=0;j<4;j++)
for(i=0;i<10;i++) for(i=0;i<10;i++)
shape_table[j*10+i]=vmwGetSprite(1+i*21,1+j*11,20,10,virtual_1); shape_table[j*10+i]=vmwGetSprite(1+i*21,1+j*11,20,10,virtual_1);
printf("Sprites Loaded\n"); fflush(stdout);
/* Load Background Data */ /* Load Background Data */
if (game_state->level==2) if (game_state->level==2)
f=fopen(tb1_data_file("level2.dat",game_state->path_to_data),"r"); f=fopen(tb1_data_file("level2/level2.dat",game_state->path_to_data),"r");
if (game_state->level==4) if (game_state->level==4)
f=fopen(tb1_data_file("level4.dat",game_state->path_to_data),"r"); f=fopen(tb1_data_file("level4/level4.dat",game_state->path_to_data),"r");
if (f==NULL) if (f==NULL)
printf("ERROR! Could't open level %d data!\n",game_state->level); printf("ERROR! Could't open level %d data!\n",game_state->level);
@@ -442,7 +437,13 @@ void leveltwoengine(tb1_state *game_state)
/*printf("%i\n",rows_goneby);*/ /*printf("%i\n",rows_goneby);*/
if (rows_goneby>1950) { if (rows_goneby>1950) {
printf("%i\n",rows_goneby); // printf("%i\n",rows_goneby);
coolbox(35,85,215,110,1,virtual_1);
vmwTextXY("TO BE CONTINUED...",55,85,4,7,0,tb1_font,virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
pauseawhile(10);
/* /*
clearkeyboardbuffer; clearkeyboardbuffer;
pauseawhile(200); pauseawhile(200);
@@ -562,22 +563,17 @@ void leveltwoengine(tb1_state *game_state)
void littleopener2() void littleopener2(tb1_state *game_state) {
{
// char tempst[300]; vmwDrawBox(0,0,319,199,0,game_state->virtual_1);
/* vmwLoadPicPacked(0,0,game_state->virtual_1,1,1,
ggiSetGCForeground(vis,tb1_pal[0]); tb1_data_file("level2/tbl2ship.tb1",game_state->path_to_data));
ggiDrawBox(vis,0,0,320,200); vmwTextXY("Hmmmm... ",10,10,4,0,0,game_state->graph_state->default_font,
ggiSetGCForeground(vaddr,tb1_pal[0]); game_state->virtual_1);
ggiDrawBox(vaddr,0,0,320,200); vmwTextXY("This Might Be Harder Than I Thought.",10,20,4,0,0,
GGILoadPicPacked(0,0,vis,1,1, game_state->graph_state->default_font,game_state->virtual_1);
tb1_data_file("tbl2ship.tb1",(char *)tempst), vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
(ggi_color *)&eight_bit_pal,
(ggi_pixel *)&tb1_pal,color_depth);
VMWtextxy("Hmmmm... ",10,10,tb1_pal[4],tb1_pal[0],0,tb1_font,vis);
VMWtextxy("This Might Be Harder Than I Thought.",10,20,tb1_pal[4],tb1_pal[0],0,tb1_font,vis);
pauseawhile(13); pauseawhile(13);
ggiSetGCForeground(vis,tb1_pal[0]); vmwDrawBox(0,0,319,199,0,game_state->virtual_1);
ggiDrawBox(vis,0,0,320,200);
*/
} }

View File

@@ -1,4 +1,5 @@
void levelone(tb1_state *game_state); void levelone(tb1_state *game_state);
void littleopener(); void littleopener(tb1_state *game_state);
void leveltwoengine(tb1_state *game_state); void leveltwoengine(tb1_state *game_state);
void littleopener2(); void littleopener2(tb1_state *game_state);

View File

@@ -23,7 +23,7 @@ void playthegame(tb1_state *game_state)
if (game_state->level==1) { if (game_state->level==1) {
levelone(game_state); levelone(game_state);
// if(level==2) littleopener2(); if (game_state->level==2) littleopener2(game_state);
} }
if (game_state->level==2) { if (game_state->level==2) {
leveltwoengine(game_state); leveltwoengine(game_state);
@@ -51,7 +51,7 @@ void playthegame(tb1_state *game_state)
vmwTextXY("ENTER YOUR NAME (10 Chars)",30,90,0,7,0, vmwTextXY("ENTER YOUR NAME (10 Chars)",30,90,0,7,0,
game_state->graph_state->default_font,game_state->virtual_1); game_state->graph_state->default_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
hiname=vmwGrInput(game_state,110,110,10,11,7,game_state->graph_state->default_font, hiname=vmwGrInput(game_state,110,110,10,11,0,game_state->graph_state->default_font,
game_state->virtual_1); game_state->virtual_1);
write_hs_list(game_state,game_state->score,hiname,0); write_hs_list(game_state,game_state->score,hiname,0);
} }

16
sound.c
View File

@@ -13,14 +13,14 @@ static Mix_Music *music;
static Mix_Chunk *game_fx[NUM_GAME_FX]; static Mix_Chunk *game_fx[NUM_GAME_FX];
static char *game_fx_names[] = { static char *game_fx_names[] = {
"tb_ahh.wav", "sound/tb_ahh.wav",
"tb_cc.wav", "sound/tb_cc.wav",
"tb_kapow.wav", "sound/tb_kapow.wav",
"tb_scream.wav", "sound/tb_scream.wav",
"tb_bonk.wav", "sound/tb_bonk.wav",
"tb_click.wav", "sound/tb_click.wav",
"tb_ow.wav", "sound/tb_ow.wav",
"tb_zrrp.wav" "sound/tb_zrrp.wav"
}; };
void loadFX(char *path_to_data) { void loadFX(char *path_to_data) {

484
story.c
View File

@@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> /* for usleep */
#include "svmwgraph/svmwgraph.h" #include "svmwgraph/svmwgraph.h"
#include "tb1_state.h" #include "tb1_state.h"
@@ -7,92 +8,69 @@
#include "sound.h" #include "sound.h"
vmwSprite *bigFlame1,*bigFlame2,*smallFlame1,*smallFlame2;
vmwSprite *rent,*truck1,*truck2,*barge;
vmwSprite *explosion1,*explosion2;
void doflames(tb1_state *game_state) {
static int flames=0;
static char alienchar=34;
char tempst[5];
if (flames) {
vmwPutSprite(bigFlame1,213,100,game_state->virtual_1);
vmwPutSpriteNonTransparent(smallFlame2,105,90,game_state->virtual_1);
vmwPutSpriteNonTransparent(smallFlame1,151,71,game_state->virtual_1);
vmwPutSpriteNonTransparent(smallFlame2,218,72,game_state->virtual_1);
}
else {
vmwPutSprite(bigFlame2,213,100,game_state->virtual_1);
vmwPutSpriteNonTransparent(smallFlame1,105,90,game_state->virtual_1);
vmwPutSpriteNonTransparent(smallFlame2,151,71,game_state->virtual_1);
vmwPutSpriteNonTransparent(smallFlame1,218,72,game_state->virtual_1);
sprintf(tempst,"%c",alienchar);
vmwTextXY(tempst,10,10,12,0,1,game_state->graph_state->default_font,game_state->virtual_1);
alienchar++;
if (alienchar>44) alienchar=34;
}
flames=(!flames);
}
void story(tb1_state *game_state) void story(tb1_state *game_state)
{ {
int error; int i;
int xtemp,ytemp; int xtemp,ytemp;
int thrustcol; int thrustcol;
float thrust; float thrust;
char tempch; char tempch;
int alienchar; int cycles,to_clear;
int cycles;
vmwFont *tb1_font; vmwFont *tb1_font;
tb1_font=game_state->graph_state->default_font; tb1_font=game_state->graph_state->default_font;
/*
procedure doflames;
begin
if flames=true then begin
putshape(bigflame1off,vaddr,27,17,213,100);
putshapeover(sflame2off,vaddr,4,4,105,90);
putshapeover(sflame1off,vaddr,4,4,151,71);
putshapeover(sflame2off,vaddr,4,4,218,72);
end
else
begin
putshape(bigflame2off,vaddr,27,17,213,100);
putshapeover(sflame1off,vaddr,4,4,105,90);
putshapeover(sflame2off,vaddr,4,4,151,71);
putshapeover(sflame1off,vaddr,4,4,218,72);
outtextxy(chr(alienchar),10,10,12,0,vaddr,true);
inc(alienchar);
if alienchar>44 then alienchar:=34;
end;
flipd320(vaddr,vga);
vdelay(5);
flames:=not(flames);
end;
procedure puttruck(xp,yp,frame:integer;where:word);
var xtemp,into,ytemp:integer;
col:byte;
begin
for into:=0 to 7 do begin
if(into+yp>=172) then
if frame=0 then putshapeline(truck1off,where,6,8,xp,yp,into)
else putshapeline(truck2off,where,6,8,xp,yp,into);
end;
end;
*/
vmwLoadPicPacked(0,0,game_state->virtual_2,1,1, vmwLoadPicPacked(0,0,game_state->virtual_2,1,1,
tb1_data_file("tbsobj.tb1",game_state->path_to_data)); tb1_data_file("story/tbsobj.tb1",game_state->path_to_data));
/*
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;
*/
/* Load up the sprites! */
bigFlame1=vmwGetSprite(0,2,26,18,game_state->virtual_2);
bigFlame2=vmwGetSprite(0,21,26,18,game_state->virtual_2);
explosion1=vmwGetSprite(127,100,15,18,game_state->virtual_2);
explosion2=vmwGetSprite(148,100,15,18,game_state->virtual_2);
rent=vmwGetSprite(166,100,15,6,game_state->virtual_2);
smallFlame1=vmwGetSprite(0,43,3,4,game_state->virtual_2);
smallFlame2=vmwGetSprite(0,47,3,4,game_state->virtual_2);
barge=vmwGetSprite(65,100,15,18,game_state->virtual_2);
truck1=vmwGetSprite(85,100,6,8,game_state->virtual_2);
truck2=vmwGetSprite(95,100,6,8,game_state->virtual_2);
/******FIRST MESSAGE********/ /******FIRST MESSAGE********/
vmwClearScreen(game_state->virtual_1,0); vmwClearScreen(game_state->virtual_1,0);
vmwTextXY("THE STORY SO FAR...",20,20,4,0,0,tb1_font,game_state->virtual_1); vmwTextXY("THE STORY SO FAR...",20,20,4,0,0,tb1_font,game_state->virtual_1);
@@ -102,7 +80,7 @@ end;
vmwClearScreen(game_state->virtual_1,0); vmwClearScreen(game_state->virtual_1,0);
vmwLoadPicPacked(0,0,game_state->virtual_2,1,1, vmwLoadPicPacked(0,0,game_state->virtual_2,1,1,
tb1_data_file("tbcobj.tb1",game_state->path_to_data)); tb1_data_file("story/tbcobj.tb1",game_state->path_to_data));
vmwArbitraryCrossBlit(game_state->virtual_2,129,56,49,132, vmwArbitraryCrossBlit(game_state->virtual_2,129,56,49,132,
game_state->virtual_1,10,10); game_state->virtual_1,10,10);
@@ -143,7 +121,7 @@ end;
pauseawhile(12); pauseawhile(12);
vmwLoadPicPacked(0,0,game_state->virtual_1,1,1, vmwLoadPicPacked(0,0,game_state->virtual_1,1,1,
tb1_data_file("tbchief.tb1",game_state->path_to_data)); tb1_data_file("story/tbchief.tb1",game_state->path_to_data));
/* Save the area where the error will go */ /* Save the area where the error will go */
vmwArbitraryCrossBlit(game_state->virtual_1,115,55,91,59, vmwArbitraryCrossBlit(game_state->virtual_1,115,55,91,59,
@@ -154,7 +132,7 @@ end;
vmwTextXY("Ahhh.... Mr. Bombem.... ",1,1,15,0,0,tb1_font,game_state->virtual_1); vmwTextXY("Ahhh.... Mr. Bombem.... ",1,1,15,0,0,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
if (game_state->sound_enabled) playGameFX(0); if (game_state->sound_enabled) playGameFX(0);
pauseawhile(2); pauseawhile(6);
if (game_state->sound_enabled) playGameFX(2); if (game_state->sound_enabled) playGameFX(2);
/* Show fake error message */ /* Show fake error message */
@@ -188,8 +166,9 @@ end;
/******BARGE TAKING OFF***********/ /******BARGE TAKING OFF***********/
vmwClearScreen(game_state->virtual_2,0);
vmwLoadPicPacked(0,0,game_state->virtual_2,1,1, vmwLoadPicPacked(0,0,game_state->virtual_2,1,1,
tb1_data_file("tbma1.tb1",game_state->path_to_data)); tb1_data_file("story/tbma1.tb1",game_state->path_to_data));
vmwSmallTextXY("MY WIFE AND I FOUNDED",212,3,14,0,0,tb1_font,game_state->virtual_2); vmwSmallTextXY("MY WIFE AND I FOUNDED",212,3,14,0,0,tb1_font,game_state->virtual_2);
vmwSmallTextXY("THIS BASE IN 2008.",212,9,14,0,0,tb1_font,game_state->virtual_2); vmwSmallTextXY("THIS BASE IN 2008.",212,9,14,0,0,tb1_font,game_state->virtual_2);
@@ -204,186 +183,227 @@ end;
vmwSmallTextXY("THE LAST LAUNCH EIGHT",212,66,11,0,0,tb1_font,game_state->virtual_2); vmwSmallTextXY("THE LAST LAUNCH EIGHT",212,66,11,0,0,tb1_font,game_state->virtual_2);
vmwSmallTextXY("YEARS AGO.",212,72,11,0,0,tb1_font,game_state->virtual_2); vmwSmallTextXY("YEARS AGO.",212,72,11,0,0,tb1_font,game_state->virtual_2);
vmwFlipVirtual(game_state->virtual_1,game_state->virtual_2,320,200);
/* putshape(bargeoff,vaddr,16,18,141,157);*/
/* vmwCrossBlit(plb_vis->write,plb_vaddr->read,plb_vis->stride,200);*/ vmwFlipVirtual(game_state->virtual_1,game_state->virtual_2,320,200);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(7);
#if 0 vmwPutSprite(barge,141,157,game_state->virtual_1);
/*
/* vmwCrossBlit(game_state->virtual_1,plb_vaddr->read,plb_vis->stride,200);*/
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6);
for ytemp:=191 downto 164 do begin /* Roll the truck up to the barge */
if ytemp>=172 then blockmove(145,ytemp,152,ytemp+10,vaddr2,145,ytemp,vaddr) for(ytemp=190;ytemp>=164;ytemp--) {
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;
pauseawhile(20);
flipd320(vaddr2,vaddr);
putshape(bargeoff,vaddr,16,18,141,157);
thrustcol:=0;
ytemp:=157;
thrust:=0;
while ytemp>-25 do begin
thrust:=thrust+0.05;
if thrustcol<63 then inc(thrustcol);
blockmove(141,ytemp,171,ytemp+30,vaddr2,141,ytemp,vaddr);
for i:=1 to 17 do
if ytemp+i>=0 then
putshapeline(bargeoff,vaddr,16,18,141,ytemp,i);
pauseawhile(5);
if keypressed then if readkey=#27 then exit;
pal(250,thrustcol,0,0);
flipd320(vaddr,vga);
ytemp:=ytemp-round(thrust);
end;
*/
pauseawhile(5);
/****SECOND CHIEF*******/
ggiSetGCForeground(vis,0]);
ggiDrawBox(vis,0,0,320,200);
GGILoadPicPacked(0,0,vaddr2,1,1,
tb1_data_file("tbcobj.tb1",(char *)tempst),
(ggi_color *)&eight_bit_pal,
(ggi_pixel *)&tb1_pal,color_depth);
GGILoadPicPacked(0,0,vis,1,1,
tb1_data_file("tbchief.tb1",(char *)tempst),
(ggi_color *)&eight_bit_pal,
(ggi_pixel *)&tb1_pal,color_depth);
/* vmwArbitraryCrossBlit(plb_vaddr2->read,7,104,90,21,
plb_vis->write,6,174,plb_vis->stride,
stride_factor);
*/
vmwTextXY("You might wonder why this is important.",1,1,15],0],1,tb1_font,virtual_1);
pauseawhile(6);
vmwTextXY("Last week we received a message. ",1,1,15],0],1,tb1_font,virtual_1);
pauseawhile(6);
vmwTextXY("It is of extra-terrestrial origin. ",1,1,15],0],1,tb1_font,virtual_1);
pauseawhile(6);
vmwTextXY("Watch the screen. ",1,1,15],0],1,tb1_font,virtual_1);
/*vmwArbitraryCrossBlit(plb_vaddr2->read,210,136,85,59, if (ytemp>=172)
plb_vis->write,210,136,plb_vis->stride, vmwArbitraryCrossBlit(game_state->virtual_2,
stride_factor);*/ 145,ytemp,7,10,
game_state->virtual_1,145,ytemp);
else
vmwArbitraryCrossBlit(game_state->virtual_2,
145,172,7,10,
game_state->virtual_1,145,172);
if (ytemp%2) vmwPutPartialSprite(game_state->virtual_1,
truck1,145,ytemp,
0,319,172,199);
else vmwPutPartialSprite(game_state->virtual_1,
truck2,145,ytemp,
0,319,172,199);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
usleep(80000);
}
pauseawhile(2);
/* Have the barge take off */
vmwFlipVirtual(game_state->virtual_1,game_state->virtual_2,320,200);
vmwPutSprite(barge,141,157,game_state->virtual_1);
thrustcol=0;
ytemp=157;
to_clear=0;
thrust=0;
while (ytemp> -25) {
thrust+=0.15;
if (thrustcol<62) thrustcol++;
to_clear=ytemp;
if (ytemp<0) to_clear=0;
vmwArbitraryCrossBlit(game_state->virtual_2,141,to_clear,30,30,
game_state->virtual_1,141,to_clear);
for(i=1;i<17;i++) {
vmwPutPartialSprite(game_state->virtual_1,
barge,141,ytemp,
0,319,0,199);
}
usleep(50000);
game_state->virtual_1->palette[250]=thrustcol*0x1000;
ytemp=ytemp-(int)thrust;
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
}
pauseawhile(5);
vmwClearScreen(game_state->virtual_2,0);
/****SECOND CHIEF*******/
vmwLoadPicPacked(0,0,game_state->virtual_2,1,1,
tb1_data_file("story/tbcobj.tb1",game_state->path_to_data));
vmwLoadPicPacked(0,0,game_state->virtual_1,1,1,
tb1_data_file("story/tbchief.tb1",game_state->path_to_data));
vmwArbitraryCrossBlit(game_state->virtual_2,7,104,90,21,
game_state->virtual_1,6,174);
vmwTextXY("You might wonder why this is important.",
1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6);
vmwTextXY("Last week we received a message. ",
1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6);
vmwTextXY("It is of extra-terrestrial origin. ",
1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6);
vmwTextXY("Watch the screen. ",
1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwArbitraryCrossBlit(game_state->virtual_2,210,136,85,59,
game_state->virtual_1,210,136);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(4); pauseawhile(4);
/******ALIEN DELEGATION*****/ /******ALIEN DELEGATION*****/
GGILoadPicPacked(0,0,vaddr2,1,1,
tb1_data_file("tbcrash.tb1",(char *)tempst), /* Something is not quite right here */
(ggi_color *)&eight_bit_pal, // vmwLoadPicPacked(0,0,game_state->virtual_2,1,1,
(ggi_pixel *)&tb1_pal,color_depth); // tb1_data_file("story/tbcrash.tb1",
// game_state->path_to_data));
/*alienchar:=34; vmwLoadPicPacked(0,0,game_state->virtual_1,1,1,
flipd320(vaddr2,vaddr); tb1_data_file("story/tbcrash.tb1",
flipd320(vaddr,vga); game_state->path_to_data));
putshape(bargeoff,vaddr,16,18,97,180); vmwLoadPicPacked(0,0,game_state->virtual_1,1,0,
unfade; tb1_data_file("tbomb1.tb1",
xtemp:=97; game_state->path_to_data));
ytemp:=181;
flames:=true;
while ytemp>118 do begin vmwFlipVirtual(game_state->virtual_2,game_state->virtual_1,320,200);
blockmove(xtemp,ytemp,xtemp+20,ytemp+20,vaddr2,xtemp,ytemp,vaddr); // flipd320(vaddr,vga);
putshape(bargeoff,vaddr,16,18,xtemp,ytemp); vmwPutSprite(barge,97,180,game_state->virtual_1);
doflames; xtemp=97;
dec(ytemp); ytemp=181;
inc(xtemp);
pauseawhile(1); while (ytemp>118) {
if keypressed then if readkey=#27 then exit; vmwArbitraryCrossBlit(game_state->virtual_2,xtemp,ytemp,20,20,
end; game_state->virtual_1,xtemp,ytemp);
blockmove(xtemp,ytemp,xtemp+30,ytemp+30,vaddr2,xtemp,ytemp,vaddr); vmwPutSprite(barge,xtemp,ytemp,game_state->virtual_1);
pal(0,63,63,63); doflames(game_state);
putshape(explo1off,vga,16,18,160,118); ytemp--;
pauseawhile(5); xtemp++;
if keypressed then if readkey=#27 then exit; vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pal(0,0,0,0); usleep(80000);
if sbeffects then startsound(sound[3],0,false); }
for xtemp:=0 to 10 do begin vmwArbitraryCrossBlit(game_state->virtual_2,xtemp,ytemp,30,30,
putshapeover(explo2off,vaddr,16,18,160,118); game_state->virtual_1,xtemp,ytemp);
doflames; game_state->virtual_1->palette[0]=0xffffff;
putshapeover(explo1off,vaddr,16,18,160,118); vmwPutSprite(explosion1,160,118,game_state->virtual_1);
doflames; vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
end; game_state->virtual_1->palette[0]=0;
blockmove(159,114,189,144,vaddr2,159,114,vaddr); usleep(80000);
putshapeover(rent1off,vaddr,16,6,160,115); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
flipd320(vaddr,vga);
cycles:=0; if (game_state->sound_enabled) playGameFX(2);
repeat for(xtemp=0;xtemp<10;xtemp++) {
doflames; vmwPutSprite(explosion2,160,118,game_state->virtual_1);
inc(cycles); doflames(game_state);
until ((keypressed) or (cycles>60)); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
if keypressed then if readkey=#27 then exit; usleep(80000);
*/ vmwPutSprite(explosion1,160,118,game_state->virtual_1);
doflames(game_state);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
usleep(80000);
}
vmwArbitraryCrossBlit(game_state->virtual_2,159,114,30,30,
game_state->virtual_1,159,114);
vmwPutSpriteNonTransparent(rent,160,118,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
cycles=0;
while ( ((tempch=vmwGetInput())==0) && cycles<12) {
doflames(game_state);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
cycles++;
usleep(500000);
}
/****ALIEN MESSAGE*****/ /****ALIEN MESSAGE*****/
GGILoadPicPacked(0,0,vis,1,1, vmwLoadPicPacked(0,0,game_state->virtual_1,1,1,
tb1_data_file("tbgorg.tb1",(char *)tempst), tb1_data_file("story/tbgorg.tb1",game_state->path_to_data));
(ggi_color *)&eight_bit_pal, vmwTextXY("GREETINGS EARTHLINGS.",0,162,12,0,0,tb1_font,game_state->virtual_1);
(ggi_pixel *)&tb1_pal,color_depth); vmwTextXY("I AM GORGONZOLA THE REPULSIVE.",0,171,12,0,0,tb1_font,game_state->virtual_1);
vmwTextXY("GREETINGS EARTHLINGS.",0,162,12],0],0,tb1_font,virtual_1); vmwTextXY("YOU HAVE MADE A BIG MISTAKE.",0,180,12,0,0,tb1_font,game_state->virtual_1);
vmwTextXY("I AM GORGONZOLA THE REPULSIVE.",0,171,12],0],0,tb1_font,virtual_1); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
vmwTextXY("YOU HAVE MADE A BIG MISTAKE.",0,180,12],0],0,tb1_font,virtual_1);
pauseawhile(7); pauseawhile(7);
vmwTextXY("YOUR SHIP FULL OF REFUSE HAS",0,162,12],0],1,tb1_font,virtual_1); vmwTextXY("YOUR SHIP FULL OF REFUSE HAS",0,162,12,0,1,tb1_font,game_state->virtual_1);
vmwTextXY("DAMAGED OUR OFFICIAL PEACE ",0,171,12],0],1,tb1_font,virtual_1); vmwTextXY("DAMAGED OUR OFFICIAL PEACE ",0,171,12,0,1,tb1_font,game_state->virtual_1);
vmwTextXY("ENVOY. IT WAS ON ITS WAY TO ",0,180,12],0],1,tb1_font,virtual_1); vmwTextXY("ENVOY. IT WAS ON ITS WAY TO ",0,180,12,0,1,tb1_font,game_state->virtual_1);
vmwTextXY("YOUR PLANET. ",0,189,12],0],1,tb1_font,virtual_1); vmwTextXY("YOUR PLANET. ",0,189,12,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(7); pauseawhile(7);
vmwTextXY("IN AN IRONIC FORM OF RETALLIATION",0,162,12],0],1,tb1_font,virtual_1); vmwTextXY("IN AN IRONIC FORM OF RETALLIATION",0,162,12,0,1,tb1_font,game_state->virtual_1);
vmwTextXY("WE HAVE MADE YOUR TRASH EVIL AND",0,171,12],0],1,tb1_font,virtual_1); vmwTextXY("WE HAVE MADE YOUR TRASH EVIL AND",0,171,12,0,1,tb1_font,game_state->virtual_1);
vmwTextXY("TURNED IT AGAINST YOU. ",0,180,12],0],1,tb1_font,virtual_1); vmwTextXY("TURNED IT AGAINST YOU. ",0,180,12,0,1,tb1_font,game_state->virtual_1);
vmwTextXY(" DIE EARTH SCUM! ",0,189,12],0],1,tb1_font,virtual_1); vmwTextXY(" DIE EARTH SCUM! ",0,189,12,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(7); pauseawhile(7);
/****** THIRD CHIEF *******/ /****** THIRD CHIEF *******/
GGILoadPicPacked(0,0,vaddr2,1,1, vmwLoadPicPacked(0,0,game_state->virtual_2,1,1,
tb1_data_file("tbcobj.tb1",(char *)tempst), tb1_data_file("story/tbcobj.tb1",game_state->path_to_data));
(ggi_color *)&eight_bit_pal, vmwLoadPicPacked(0,0,game_state->virtual_1,1,1,
(ggi_pixel *)&tb1_pal,color_depth); tb1_data_file("story/tbchief.tb1",game_state->path_to_data));
GGILoadPicPacked(0,0,virtual_1,1,1, vmwArbitraryCrossBlit(game_state->virtual_2,7,127,90,21,
tb1_data_file("tbchief.tb1",(char *)tempst), game_state->virtual_1,6,174);
(ggi_color *)&eight_bit_pal,
(ggi_pixel *)&tb1_pal,color_depth);
vmwArbitraryCrossBlit(plb_vaddr2->read,7,127,90,21,
plb_vis->write,6,174,plb_vis->stride,
stride_factor);
vmwTextXY("Tom, our radar detects approaching ",1,1,15],0],1,tb1_font,virtual_1); vmwTextXY("Tom, our radar detects approaching ",1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6); pauseawhile(6);
vmwTextXY("objects. They are inside the ",1,1,15],0],1,tb1_font,virtual_1); vmwTextXY("objects. They are inside the ",1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6); pauseawhile(6);
vmwTextXY("orbit of Jupiter. ",1,1,15],0],1,tb1_font,virtual_1); vmwTextXY("orbit of Jupiter. ",1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6); pauseawhile(6);
vmwTextXY("You are our only hope! ",1,1,15],0],1,tb1_font,virtual_1); vmwTextXY("You are our only hope! ",1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6); pauseawhile(6);
vmwTextXY("Will you fly our only spaceship ",1,1,15],0],1,tb1_font,virtual_1); vmwTextXY("Will you fly our only spaceship ",1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6); pauseawhile(6);
vmwTextXY("and save the human race? ",1,1,15],0],1,tb1_font,virtual_1); vmwTextXY("and save the human race? ",1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6); pauseawhile(6);
vmwArbitraryCrossBlit(plb_vaddr2->read,5,16,39,82, vmwArbitraryCrossBlit(game_state->virtual_2,5,16,39,82,
plb_vis->write,146,59,plb_vis->stride, game_state->virtual_1,146,59);
stride_factor); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(1); usleep(500000);
vmwArbitraryCrossBlit(plb_vaddr2->read,46,16,39,82, vmwArbitraryCrossBlit(game_state->virtual_2,46,16,39,82,
plb_vis->write,146,59,plb_vis->stride, game_state->virtual_1,146,59);
stride_factor); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(1); usleep(500000);
vmwArbitraryCrossBlit(plb_vaddr2->read,87,16,39,82, vmwArbitraryCrossBlit(game_state->virtual_2,87,16,39,82,
plb_vis->write,146,59,plb_vis->stride, game_state->virtual_1,146,59);
stride_factor); vmwTextXY("Scratch. Scratch. <Ow that itches>",1,1,9,0,1,tb1_font,game_state->virtual_1);
vmwTextXY("Scratch. Scratch. <Ow that itches>",1,1,9],0],1,tb1_font,virtual_1); vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(5); pauseawhile(5);
vmwTextXY("I knew you'd do it. Good Luck! ",1,1,15],0],1,tb1_font,virtual_1); vmwTextXY("I knew you'd do it. Good Luck! ",1,1,15,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(6); pauseawhile(6);
vmwTextXY("<Huh?> ",1,1,9],0],1,tb1_font,virtual_1); vmwTextXY("<Huh?> ",1,1,9,0,1,tb1_font,game_state->virtual_1);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
pauseawhile(10); pauseawhile(10);
#endif
} }

View File

@@ -5,9 +5,16 @@
#include <stdlib.h> /* For atexit() */ #include <stdlib.h> /* For atexit() */
/* Setup the Graphics */ /* Setup the Graphics */
void *SDL_setupGraphics(int xsize,int ysize,int bpp,int verbose) void *SDL_setupGraphics(int xsize,int ysize,int bpp,int scale,
int fullscreen,int verbose)
{ {
SDL_Surface *sdl_screen; SDL_Surface *sdl_screen;
int mode;
mode=SDL_SWSURFACE;
if (fullscreen) mode|=SDL_FULLSCREEN;
/* Initialize the SDL library */ /* Initialize the SDL library */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
@@ -20,10 +27,10 @@ void *SDL_setupGraphics(int xsize,int ysize,int bpp,int verbose)
atexit(SDL_Quit); atexit(SDL_Quit);
/* Initialize the display */ /* Initialize the display */
sdl_screen = SDL_SetVideoMode(xsize, ysize, 16, SDL_SWSURFACE); sdl_screen = SDL_SetVideoMode(xsize, ysize, 16, mode);
if ( sdl_screen == NULL ) { if ( sdl_screen == NULL ) {
fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n", fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n",
xsize,ysize,bpp,SDL_GetError()); xsize*scale,ysize*scale,bpp,SDL_GetError());
exit(1); exit(1);
} }
if (verbose) { if (verbose) {
@@ -72,6 +79,64 @@ void SDL_NoScale16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
/* Write this out to the screen */ /* Write this out to the screen */
SDL_UpdateRect(target, 0, 0, source->xsize, source->ysize); SDL_UpdateRect(target, 0, 0, source->xsize, source->ysize);
}
/* I should make this generic, but it makes it really slow */
void SDL_Double16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
int x,y,Bpp,scale;
unsigned char *s_pointer,*t_pointer;
SDL_Surface *target;
target=(SDL_Surface *)target_p->output_screen;
scale=target_p->scale;
if ( SDL_MUSTLOCK(target) ) {
if ( SDL_LockSurface(target) < 0 )
return;
}
Bpp=target->format->BytesPerPixel;
s_pointer=source->memory;
t_pointer=((Uint8 *)target->pixels);
for (y=0;y<source->ysize;y++) {
for (x=0;x<source->xsize;x++) {
/* i=0, j=0 */
*((Uint16 *) ( (t_pointer)))=
source->palette[*(s_pointer)];
/* i=1, j=0 */
*((Uint16 *) ( (t_pointer+(2*target_p->xsize) )))=
source->palette[*(s_pointer)];
/* i=0, j=1 */
*((Uint16 *) ( (t_pointer+2) ))=
source->palette[*(s_pointer)];
/* i=1 j=1 */
*((Uint16 *) ( (t_pointer+2+(2*target_p->xsize) )))=
source->palette[*(s_pointer)];
s_pointer++; t_pointer+=4;
}
t_pointer+=2*target_p->xsize;
}
/* Update the display */
if ( SDL_MUSTLOCK(target) ) {
SDL_UnlockSurface(target);
}
/* Write this out to the screen */
SDL_UpdateRect(target, 0, 0, target_p->xsize, target_p->ysize);
} }

View File

@@ -2,7 +2,9 @@
#include <SDL.h> #include <SDL.h>
void *SDL_setupGraphics(int xsize,int ysize,int bpp,int verbose); void *SDL_setupGraphics(int xsize,int ysize,int bpp,int scale,int fullscreen,
int verbose);
void SDL_NoScale16bpp_BlitMem(vmwSVMWGraphState *target, vmwVisual *source); void SDL_NoScale16bpp_BlitMem(vmwSVMWGraphState *target, vmwVisual *source);
void SDL_Double16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source);
void SDL_clearKeyboardBuffer(); void SDL_clearKeyboardBuffer();
int SDL_getInput(); int SDL_getInput();

View File

@@ -29,6 +29,7 @@ typedef struct {
int xsize; int xsize;
int ysize; int ysize;
int bpp; int bpp;
int scale;
void *output_screen; void *output_screen;
vmwFont *default_font; vmwFont *default_font;
} vmwSVMWGraphState; } vmwSVMWGraphState;
@@ -107,12 +108,14 @@ void vmwUnFade(vmwVisual *source);
/* From vmw_setup.c */ /* From vmw_setup.c */
extern void *(*vmwSetupGraphics)(int xsize,int ysize, int bpp, int verbose); extern void *(*vmwSetupGraphics)(int xsize,int ysize, int bpp, int scale,
int fullscreen,int verbose);
extern void (*vmwBlitMemToDisplay)(vmwSVMWGraphState *display, vmwVisual *source); extern void (*vmwBlitMemToDisplay)(vmwSVMWGraphState *display, vmwVisual *source);
extern void (*vmwClearKeyboardBuffer)(void); extern void (*vmwClearKeyboardBuffer)(void);
extern int (*vmwGetInput)(void); extern int (*vmwGetInput)(void);
vmwSVMWGraphState *vmwSetupSVMWGraph(int display_type,int xsize,int ysize, vmwSVMWGraphState *vmwSetupSVMWGraph(int display_type,int xsize,int ysize,
int bpp,int verbose); int bpp,int scale,int fullscreen,
int verbose);
vmwVisual *vmwSetupVisual(int xsize,int ysize,int palette_size); vmwVisual *vmwSetupVisual(int xsize,int ysize,int palette_size);
/* From vmw_sprite.c */ /* From vmw_sprite.c */
@@ -123,8 +126,11 @@ vmwSprite *vmwGetSprite(int x, int y,
void vmwPutSprite(vmwSprite *sprite,int x,int y, void vmwPutSprite(vmwSprite *sprite,int x,int y,
vmwVisual *screen); vmwVisual *screen);
void vmwPutPartialSprite(vmwVisual *destination, void vmwPutSpriteNonTransparent(vmwSprite *sprite,int x,int y,
vmwSprite *sprite, vmwVisual *screen);
int x_start,int y_start,
int x_stop, int y_stop); void vmwPutPartialSprite(vmwVisual *destination,
vmwSprite *sprite,int x,int y,
int x_start,int x_stop,
int y_start,int y_stop);

View File

@@ -6,13 +6,15 @@
#include <stdio.h> /* For printf */ #include <stdio.h> /* For printf */
#include <stdlib.h> /* For Memory Allocation */ #include <stdlib.h> /* For Memory Allocation */
void *(*vmwSetupGraphics)(int xsize,int ysize, int bpp, int verbose); void *(*vmwSetupGraphics)(int xsize,int ysize, int bpp,
int scale, int fullscreen,int verbose);
void (*vmwBlitMemToDisplay)(vmwSVMWGraphState *display, vmwVisual *source); void (*vmwBlitMemToDisplay)(vmwSVMWGraphState *display, vmwVisual *source);
void (*vmwClearKeyboardBuffer)(void); void (*vmwClearKeyboardBuffer)(void);
int (*vmwGetInput)(void); int (*vmwGetInput)(void);
vmwSVMWGraphState *vmwSetupSVMWGraph(int display_type,int xsize,int ysize, vmwSVMWGraphState *vmwSetupSVMWGraph(int display_type,int xsize,int ysize,
int bpp,int verbose) { int bpp,int scale,int fullscreen,
int verbose) {
vmwSVMWGraphState *temp_state; vmwSVMWGraphState *temp_state;
@@ -23,11 +25,16 @@ vmwSVMWGraphState *vmwSetupSVMWGraph(int display_type,int xsize,int ysize,
switch (display_type) { switch (display_type) {
case VMW_SDLTARGET: vmwSetupGraphics=SDL_setupGraphics; case VMW_SDLTARGET: vmwSetupGraphics=SDL_setupGraphics;
vmwBlitMemToDisplay=SDL_NoScale16bpp_BlitMem; if (scale==1)
vmwBlitMemToDisplay=SDL_NoScale16bpp_BlitMem;
else
vmwBlitMemToDisplay=SDL_Double16bpp_BlitMem;
vmwClearKeyboardBuffer=SDL_clearKeyboardBuffer; vmwClearKeyboardBuffer=SDL_clearKeyboardBuffer;
vmwGetInput=SDL_getInput; vmwGetInput=SDL_getInput;
temp_state->output_screen= temp_state->output_screen=
vmwSetupGraphics(xsize,ysize,bpp,verbose); vmwSetupGraphics(xsize,ysize,bpp,scale,
fullscreen,verbose);
break; break;
default: printf("ERROR! Unknown Display Target %i.\n",display_type); default: printf("ERROR! Unknown Display Target %i.\n",display_type);
return NULL; return NULL;
@@ -36,6 +43,7 @@ vmwSVMWGraphState *vmwSetupSVMWGraph(int display_type,int xsize,int ysize,
temp_state->xsize=xsize; temp_state->xsize=xsize;
temp_state->ysize=ysize; temp_state->ysize=ysize;
temp_state->bpp=bpp; temp_state->bpp=bpp;
temp_state->scale=scale;
temp_state->default_font=NULL; temp_state->default_font=NULL;
return temp_state; return temp_state;

View File

@@ -46,23 +46,52 @@ void vmwPutSprite(vmwSprite *sprite,int x,int y,
} }
} }
void vmwPutSpriteNonTransparent(vmwSprite *sprite,int x,int y,
vmwVisual *screen) {
unsigned char *temp_source,*temp_destination;
int xx,yy;
temp_source=sprite->spritedata;
temp_destination= (unsigned char *)(screen->memory)+(y*screen->xsize+x);
for (yy=0;yy<sprite->ysize;yy++) {
for (xx=0;xx<sprite->xsize;xx++) {
*(temp_destination)=*(temp_source);
temp_source++;
temp_destination++;
}
temp_destination+=((screen->xsize-sprite->xsize));
}
}
void vmwPutPartialSprite(vmwVisual *destination, void vmwPutPartialSprite(vmwVisual *destination,
vmwSprite *sprite, vmwSprite *sprite,int x,int y,
int x_start,int y_start, int x_start,int x_stop,
int x_stop, int y_stop) int y_start, int y_stop)
{ /* x_start/stop not implemented yet */ {
// int xx,yy;
/* unsigned char *temp_source,*temp_destination;
* dest+=(dest_stride*y); int xx,yy;
* for(yy=0;yy<h;yy++){
* for(xx=0;xx<w;xx++) temp_source=sprite->spritedata;
* if ((*(src+xx)) && ((yy>=y_start) && (yy<=y_stop)) ) temp_destination=(unsigned char *)(destination->memory)+(y*destination->xsize+x);
* memcpy(dest+(stride_factor*(xx+x)),(src+xx),stride_factor);
* // **(dest+xx+x)=15; for (yy=0;yy<sprite->ysize;yy++) {
* src+=w; for (xx=0;xx<sprite->xsize;xx++) {
* dest+=dest_stride; /* Only draw if in bounds */
* } if ( (yy+y>=y_start) && (yy+y<=y_stop) &&
* */ (xx+x>=x_start) && (xx+x<=x_stop) ) {
return;
if (*temp_source!=0) {
*(temp_destination)=*(temp_source);
}
}
temp_source++;
temp_destination++;
}
temp_destination+=((destination->xsize-sprite->xsize));
}
return;
} }

50
tb1.c
View File

@@ -1,6 +1,6 @@
/****************************************************************\ /****************************************************************\
\* TOM BOMBEM AND THE INVASION OF THE INANIMATE_OBJECTS */ \* TOM BOMBEM AND THE INVASION OF THE INANIMATE_OBJECTS */
/* version 2.9.2 15 September 2000 *\ /* version 2.9.5 16 September 2000 *\
\* by Vince Weaver weave@eng.umd.edu */ \* by Vince Weaver weave@eng.umd.edu */
/* *\ /* *\
\* Originally written in Pascal and x86 assembly for DOS */ \* Originally written in Pascal and x86 assembly for DOS */
@@ -10,7 +10,7 @@
\* This source is released under the GPL */ \* This source is released under the GPL */
/****************************************************************/ /****************************************************************/
#define TB1_VERSION "2.9.2" #define TB1_VERSION "2.9.5"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> /* for calloc */ #include <stdlib.h> /* for calloc */
@@ -36,13 +36,15 @@
int command_line_help(int show_version,char *runas) int command_line_help(int show_version,char *runas)
{ {
if (!show_version) { if (!show_version) {
printf("Usage: %s [-force8bpp] [-nosound] [-readonly]" printf("Usage: %s [-8bpp] [-double] [-fullscreen] [-nosound] [-readonly]"
" [-version] [-?]\n\n",runas); " [-version] [-?]\n\n",runas);
printf(" -force8bpp : force to run in 8bpp mode\n"); printf(" -8bpp : force to run in 8bpp mode\n");
printf(" -nosound : disables sound within game\n"); printf(" -double : play in 640x480 mode\n");
printf(" -readonly : don't try to write files to disk\n"); printf(" -fullscreen : play in fullscreen mode (if available)\n");
printf(" -version : print version\n"); printf(" -nosound : disables sound within game\n");
printf(" -? : print this help message\n"); printf(" -readonly : don't try to write files to disk\n");
printf(" -version : print version\n");
printf(" -? : print this help message\n");
printf("\n"); printf("\n");
} }
return 0; return 0;
@@ -54,7 +56,7 @@ int main(int argc,char **argv)
int i,grapherror,reloadpic=0; int i,grapherror,reloadpic=0;
int custom_palette[256]; int custom_palette[256];
int ch,x,barpos,time_sec; int ch,x,barpos,time_sec;
int scale=1; int scale=1,fullscreen=0;
FILE *fff; FILE *fff;
vmwVisual *virtual_1,*virtual_2,*virtual_3; vmwVisual *virtual_1,*virtual_2,*virtual_3;
@@ -92,7 +94,10 @@ int main(int argc,char **argv)
command_line_help(0,argv[0]); return 5; break; command_line_help(0,argv[0]); return 5; break;
case 'v': case 'v':
command_line_help(1,argv[0]); return 5; break; command_line_help(1,argv[0]); return 5; break;
case 'f':
fullscreen=1; break;
case 'd':
scale=2; break;
case 'n': case 'n':
game_state->sound_enabled=0; game_state->sound_enabled=0;
printf(" + Sound totally disabled\n"); printf(" + Sound totally disabled\n");
@@ -116,17 +121,17 @@ int main(int argc,char **argv)
/* Find the Data */ /* Find the Data */
/* FIXME : User Defined Path Info*/ /* FIXME : User Defined Path Info*/
if ( (fff=fopen("./data/data_files_here","r"))!=NULL) { if ( (fff=fopen("./data/tb1_data_files_here","r"))!=NULL) {
strncpy(game_state->path_to_data,"./data/",20); strncpy(game_state->path_to_data,"./data/",20);
} }
else if ( (fff=fopen("/usr/local/games/tb1/data/data_files_here","r")) else if ( (fff=fopen("/usr/local/games/tb1/data/tb1_data_files_here","r"))
!=NULL) { !=NULL) {
strncpy(game_state->path_to_data,"/usr/local/games/tb1/data/",40); strncpy(game_state->path_to_data,"/usr/local/games/tb1/data/",40);
} }
else { else {
char tempst[200]; char tempst[200];
sprintf(tempst,"%s/.tb1/data/data_files_here",getenv("HOME")); sprintf(tempst,"%s/.tb1/data/tb1_data_files_here",getenv("HOME"));
if ( (fff=fopen(tempst,"r"))!=NULL) { if ( (fff=fopen(tempst,"r"))!=NULL) {
sprintf(game_state->path_to_data,"%s/.tb1/data/",getenv("HOME")); sprintf(game_state->path_to_data,"%s/.tb1/data/",getenv("HOME"));
} }
@@ -155,17 +160,28 @@ int main(int argc,char **argv)
/* Load sounds */ /* Load sounds */
initSound(game_state->path_to_data); initSound(game_state->path_to_data);
loadSound(tb1_data_file("vmwfan.mod",game_state->path_to_data)); loadSound(tb1_data_file("music/vmwfan.mod",game_state->path_to_data));
printf(" + Loaded sounds...\n"); printf(" + Loaded sounds...\n");
/* Setup Graphics */ /* Setup Graphics */
if (scale==1) {
if ( (game_state->graph_state=vmwSetupSVMWGraph(VMW_SDLTARGET, if ( (game_state->graph_state=vmwSetupSVMWGraph(VMW_SDLTARGET,
320*scale,200*scale, 320,200,
16,1))==NULL) { 16,scale,fullscreen,1))==NULL) {
fprintf(stderr,"ERROR: Couldn't get display set up properly.\n"); fprintf(stderr,"ERROR: Couldn't get display set up properly.\n");
return VMW_ERROR_DISPLAY; return VMW_ERROR_DISPLAY;
} }
}
else {
if ( (game_state->graph_state=vmwSetupSVMWGraph(VMW_SDLTARGET,
640,480,
16,scale,fullscreen,1))==NULL) {
fprintf(stderr,"ERROR: Couldn't get display set up properly.\n");
return VMW_ERROR_DISPLAY;
}
}
/* Load the tom bombem font */ /* Load the tom bombem font */
game_state->graph_state->default_font= game_state->graph_state->default_font=
@@ -234,7 +250,7 @@ int main(int argc,char **argv)
pauseawhile(5); pauseawhile(5);
stopSound(); stopSound();
loadSound(tb1_data_file("weave1.mod",game_state->path_to_data)); loadSound(tb1_data_file("music/weave1.mod",game_state->path_to_data));
/* Clear the Screen and get ready for the Menu */ /* Clear the Screen and get ready for the Menu */

1
tools/README Normal file
View File

@@ -0,0 +1 @@
Tools that will be useful for developing new levels of tb1.

View File

@@ -1,12 +1,3 @@
/****************************************************************\
\* 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" #define TB1_VERSION "2.9.0"
@@ -19,8 +10,8 @@
#include <sys/time.h> #include <sys/time.h>
#include <ggi/libggi.h> #include <ggi/libggi.h>
#include "svmwgrap.h" #include "../svmwgrap.h"
#include "tblib.h" #include "../gtblib.h"
/* Exported Global Variables */ /* Exported Global Variables */
ggi_visual_t vis,vaddr,vaddr2; ggi_visual_t vis,vaddr,vaddr2;
@@ -38,6 +29,13 @@ char path_to_data[256];
struct timeval time_info; struct timeval time_info;
struct timezone dontcare; 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 */ /* Setup the Graphics */
int setup_graphics(int force_8bpp) int setup_graphics(int force_8bpp)
{ {
@@ -188,7 +186,7 @@ int main(int argc,char **argv)
srandom(time(NULL)); srandom(time(NULL));
/* Load the tom bombem font */ /* Load the tom bombem font */
tb1_font=LoadVMWFont(tb1_data_file("tbfont.tb1",(char *)tempst),8,16,256); tb1_font=LoadVMWFont("../data/tbfont.tb1",8,16,256);
/* Setup Graphics */ /* Setup Graphics */
if (setup_graphics(force_8bpp)==2) { if (setup_graphics(force_8bpp)==2) {
@@ -210,58 +208,36 @@ int main(int argc,char **argv)
Load the title screen */ Load the title screen */
grapherror=GGILoadPicPacked(0,0,vis,1,1, grapherror=GGILoadPicPacked(0,0,vis,1,1,
tb1_data_file("tbomb1.tb1",(char *)tempst), "../data/tbomb1.tb1",
(ggi_color *)&eight_bit_pal, (ggi_color *)&eight_bit_pal,
(ggi_pixel *)&tb1_pal,color_depth); (ggi_pixel *)&tb1_pal,color_depth);
grapherror=GGILoadPicPacked(0,0,vaddr2,1,1, grapherror=GGILoadPicPacked(0,0,vaddr2,1,1,
tb1_data_file("tbomb1.tb1",(char *)tempst), "../data/tbomb1.tb1",
(ggi_color *)&eight_bit_pal, (ggi_color *)&eight_bit_pal,
(ggi_pixel *)&tb1_pal,color_depth); (ggi_pixel *)&tb1_pal,color_depth);
ggiFlush(vis); ggiFlush(vis);
ggiFlush(vaddr2); ggiFlush(vaddr2);
pauseawhile(5); 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 */ /* Main Menu Loop */
while (1) { while (1) {
vmwCrossBlit(plb_vis->write,plb_vaddr2->read,plb_vis->stride,200); vmwCrossBlit(plb_vis->write,plb_vaddr->read,plb_vis->stride,200);
ggiFlush(vis); ggiFlush(vis);
barpos=0; barpos=0;
VMWtextxy("F1 HELP",0,190,tb1_pal[9],tb1_pal[7],0,tb1_font,vis);
coolbox(117,61,199,140,1,vis);
ggiFlush(vis); ggiFlush(vis);
ch=0; ch=0;
while(ch!=TB_ENTER){
if (barpos==0) VMWtextxy("NEW GAME",123,67,
tb1_pal[32],tb1_pal[0],1,tb1_font,vis);
else VMWtextxy("NEW GAME",123,67,
tb1_pal[32],tb1_pal[7],1,tb1_font,vis);
if (barpos==1) VMWtextxy("OPTIONS",123,77,
tb1_pal[32],tb1_pal[0],1,tb1_font,vis);
else VMWtextxy("OPTIONS",123,77,
tb1_pal[32],tb1_pal[7],1,tb1_font,vis);
if (barpos==2) VMWtextxy("ABOUT",123,87,
tb1_pal[32],tb1_pal[0],1,tb1_font,vis);
else VMWtextxy("ABOUT",123,87,
tb1_pal[32],tb1_pal[7],1,tb1_font,vis);
if (barpos==3) VMWtextxy("LOAD GAME",123,97,
tb1_pal[32],tb1_pal[0],1,tb1_font,vis);
else VMWtextxy("LOAD GAME",123,97,
tb1_pal[32],tb1_pal[7],1,tb1_font,vis);
if (barpos==4) VMWtextxy("STORY",123,107,
tb1_pal[32],tb1_pal[0],1,tb1_font,vis);
else VMWtextxy("STORY",123,107,
tb1_pal[32],tb1_pal[7],1,tb1_font,vis);
if (barpos==5) VMWtextxy("CREDITS",123,117,
tb1_pal[32],tb1_pal[0],1,tb1_font,vis);
else VMWtextxy("CREDITS",123,117,
tb1_pal[32],tb1_pal[7],1,tb1_font,vis);
if (barpos==6) VMWtextxy("QUIT",123,127,
tb1_pal[32],tb1_pal[0],1,tb1_font,vis);
else VMWtextxy("QUIT",123,127,
tb1_pal[32],tb1_pal[7],1,tb1_font,vis);
ggiFlush(vis);
while( ((ch=get_input())==0)) { while( ((ch=get_input())==0)) {
usleep(10); usleep(10);
@@ -269,15 +245,26 @@ int main(int argc,char **argv)
/* Change menu position based on key pressed */ /* Change menu position based on key pressed */
ch2=toupper(ch); ch2=toupper(ch);
if ((ch==TB_DOWN)||(ch==TB_RIGHT)) barpos++; if (ch==TB_DOWN) y_pos++;
if ((ch==TB_UP) || (ch==TB_LEFT)) barpos--; if (ch==TB_RIGHT) x_pos++;
if (ch==TB_F1) {barpos=10; ch=TB_ENTER;} /*F1*/ if (ch==TB_UP) y_pos--;
if (ch2=='N') barpos=0; /*N*/ if (ch==TB_LEFT) x_pos--;
if (ch2=='O') barpos=1; /*O*/ if (y_pos<0) y_pos=0; if(x_pos<0) x_pos=0;
if (ch2=='A') barpos=2; /*A*/ if (y_pos>(max_y-20)) y_pos=max_y-20;
if (ch2=='L') barpos=3; /*L*/ if (x_pos>(max_x)) x_pos=max_x;
if (ch2=='S') barpos=4; /*S*/
if (ch2=='C') barpos=5; /*C*/ 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 (ch2=='Q') barpos=6; /*Q*/
if (ch==27){ /* escape */ if (ch==27){ /* escape */
barpos=6; barpos=6;
@@ -285,8 +272,8 @@ int main(int argc,char **argv)
} }
if(barpos==7) barpos=0; if(barpos==7) barpos=0;
if(barpos<0) barpos=6; if(barpos<0) barpos=6;
}
/* Run whatever it was that the person pressed */ /* Run whatever it was that the person pressed */
if(barpos==6) quit();
} }
} }

0
tools/pcx2ppp.c Normal file
View File