This commit is contained in:
Vince Weaver
2009-12-27 18:33:00 -05:00
parent de8a2e1a48
commit 8a924ffd24
14 changed files with 519 additions and 486 deletions

View File

@@ -1,3 +1,11 @@
27 December 2009
+ Fix credits to scroll properly
+ Fix URLs
26 December 2009
+ Update to 2.9.16, remove warnings, straighten out some of
the coding style.
27 October 2004
+ Of course instead of finishing things up, used the library to display
pcx files so I can give presentations using an old 486 laptop.

View File

@@ -51,5 +51,5 @@ SDL_INCLUDE= `sdl-config --cflags`
# DO NOT EDIT BELOW THIS LINE
##############################
INCLUDE_GLOBAL= -Wall -O2 $(SDL_INCLUDE)
INCLUDE_GLOBAL= -Wall -Werror -O2 $(SDL_INCLUDE)
LIBS_GLOBAL= -lm $(SDL_MIXER_LIBS) $(SDL_LIBS) $(CURSES_LIBS) $(OPENGL_LIBS)

2
README
View File

@@ -11,7 +11,7 @@
Vince Weaver
Version 2.9.11
Version 2.9.16
---------------------------------------------------------------------
Contents

View File

@@ -77,4 +77,4 @@ A8). For game balancing issues. [And also because of speed/memory
Q9). Is the name "Tom Bombem" alliterative, shamelessly copying
a name like "Duke Nukem"?
A9). Yes
A9). Maybe

View File

@@ -1,4 +1,3 @@
#include <stdio.h>
#include <unistd.h>
@@ -6,17 +5,20 @@
#include "tb1_state.h"
#include "tblib.h"
void credits(tb1_state *game_state)
{
void credits(tb1_state *game_state) {
int i,keypressed=0;
int i;
//,keypressed=0;
vmwFont *tb1_font;
/* get the font */
tb1_font=game_state->graph_state->default_font;
/* clear the virtual screen */
vmwDrawBox(0,0,320,400,0,game_state->virtual_2);
/* draw off the screen */
vmwTextXY(" TOM BOMBEM",0,210,4,0,1,tb1_font,game_state->virtual_2);
vmwTextXY(" INVASION OF THE INANIMATE OBJECTS",0,220,4,0,1,tb1_font,game_state->virtual_2);
vmwTextXY(" PROGRAMMING",0,240,9,0,1,tb1_font,game_state->virtual_2);
@@ -33,14 +35,17 @@ void credits(tb1_state *game_state)
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
usleep(30000);
if (vmwGetInput()) {
keypressed=1; break;
goto key_was_pressed;
}
}
/* move bottom to temp page */
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
game_state->virtual_1,0,0);
/* move temp page to top */
vmwArbitraryCrossBlit(game_state->virtual_1,0,0,320,200,
game_state->virtual_2,0,0);
/* clear bottom */
vmwDrawBox(0,200,320,200,0,game_state->virtual_2);
vmwTextXY(" JEFF WARWICK",0,210,12,0,1,tb1_font,game_state->virtual_2);
@@ -52,19 +57,20 @@ void credits(tb1_state *game_state)
vmwTextXY(" DOS SOUND BLASTER CODE",0,360,15,0,1,tb1_font,game_state->virtual_2);
vmwTextXY(" ETHAN BRODSKY",0,380,15,0,1,tb1_font,game_state->virtual_2);
if (!keypressed) for(i=0;i<200;i++){
for(i=0;i<200;i++){
vmwArbitraryCrossBlit(game_state->virtual_2,0,i,320,200,
game_state->virtual_1,0,0);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
usleep(30000);
if (vmwGetInput()) {
keypressed=1; break;
goto key_was_pressed;
}
}
/* move bottom to top */
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
game_state->virtual_2,0,0);
/* clear bottom */
vmwDrawBox(0,200,320,200,0,game_state->virtual_2);
vmwTextXY(" GLTRON SOUND CODE",0,210,12,0,1,tb1_font,game_state->virtual_2);
@@ -75,19 +81,20 @@ void credits(tb1_state *game_state)
vmwTextXY(" ALSO SPECIAL THANKS TO",0,330,14,0,1,tb1_font,game_state->virtual_2);
vmwTextXY(" THE SDL DEVELOPMENT TEAM",0,350,14,0,1,tb1_font,game_state->virtual_2);
if (!keypressed) for(i=0;i<200;i++){
for(i=0;i<200;i++){
vmwArbitraryCrossBlit(game_state->virtual_2,0,i,320,200,
game_state->virtual_1,0,0);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
usleep(30000);
if (vmwGetInput()) {
keypressed=1; break;
goto key_was_pressed;
}
}
/* move bottom to top */
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
game_state->virtual_2,0,0);
/* clear bottom */
vmwDrawBox(0,200,320,200,0,game_state->virtual_2);
vmwTextXY(" INSPIRATION",0,210,9,0,1,tb1_font,game_state->virtual_2);
@@ -100,27 +107,34 @@ void credits(tb1_state *game_state)
vmwTextXY(" B,D,JL,L,N,P,S,W,PM,E,G,TK,MP",0,360,10,0,1,tb1_font,game_state->virtual_2);
vmwTextXY(" AND ESPECIALLY KRG",0,380,10,0,1,tb1_font,game_state->virtual_2);
if (!keypressed) for(i=0;i<200;i++){
for(i=0;i<200;i++){
vmwArbitraryCrossBlit(game_state->virtual_2,0,i,320,200,
game_state->virtual_1,0,0);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
usleep(30000);
if (vmwGetInput()) {
keypressed=1; break;
goto key_was_pressed;
}
}
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
game_state->virtual_2,0,0);
key_was_pressed:
/* move bottom to top */
vmwArbitraryCrossBlit(game_state->virtual_2,0,i,320,i+200,
game_state->virtual_2,0,0);
i=0;
/* load picture at bottom */
vmwLoadPicPacked(0,200,game_state->virtual_2,1,1,
tb1_data_file("tbomb1.tb1",game_state->path_to_data),
game_state->graph_state);
if (keypressed) {
vmwDrawBox(0,0,320,200,0,game_state->virtual_2);
}
// if (keypressed) {
// vmwDrawBox(0,0,320,200,0,game_state->virtual_2);
// }
for(i=0;i<200;i++){
while(i<200) {
// for(i=0;i<200;i++){
vmwArbitraryCrossBlit(game_state->virtual_2,0,i,320,200,
game_state->virtual_1,0,0);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
@@ -128,10 +142,10 @@ void credits(tb1_state *game_state)
if (vmwGetInput()) {
break;
}
i++;
}
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
game_state->virtual_1,0,0);
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
}

View File

@@ -4,17 +4,17 @@ Marie
Hairold
Kevin
Leonard
VmW
Lizann
Vinnie
Pete
Vinnie
vmw
5000
4500
4000
3500
3000
2500
2170
2000
1740
1500
1490
1730

View File

@@ -92,16 +92,11 @@ struct level2_data *parse_data_file(char *filename) {
FILE *fff;
char tempst[255],sprite_file[255],throwaway[255];
char type[255];
int number,shoots,explodes,count,i,numsprites,tempint;
struct level2_data *data;
fff=fopen(filename,"r");
if (fff==NULL) {
printf("Cannot open %s\n",filename);
@@ -110,8 +105,6 @@ struct level2_data *parse_data_file(char *filename) {
data=(struct level2_data *)malloc(sizeof(struct level2_data));
/* Pass 1 */
do {
fgets(tempst,254,fff);
@@ -209,7 +202,6 @@ struct level2_data *parse_data_file(char *filename) {
#ifdef DEBUG
print_level(data);
printf("Sprite File: %s\n",sprite_file);
printf("Sprite size: %ix%i\n",data->xsize,data->ysize);
printf("Sprite array: %ix%i\n",data->rows,data->cols);

View File

@@ -1,26 +0,0 @@
;
;
;
;012345678901234567890123
0########### ##########0
1# # # #1
2# G # # S #2
3# # # #3
4# # # #4
5# # # #5
6# # # #6
7# #### #### #7
8# # w # #8
9# #9
0# #0
1# #1
2# # # #2
3# # w # #3
4# #### #### #4
5# # # #5
6# # # #6
7# A # # #7
8# # T # #8
9###########///##########9
;012345678901234567890123

6
quit.c
View File

@@ -8,8 +8,7 @@
#include "sound.h"
#include "tblib.h"
int quit(tb1_state *game_state)
{
int quit(tb1_state *game_state) {
int result=0;
@@ -23,5 +22,6 @@ int quit(tb1_state *game_state)
vmwCloseGraphics();
exit(1);
}
else return 6;
return 6;
}

View File

@@ -156,7 +156,8 @@ void SDL_Double32bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
for(y=0;y<source->ysize;y++) {
for(x=0;x<source->xsize;x++) {
color=SDL_MapRGB(target->format,target_p->actual_pal[*(s_pointer)].r,
color=SDL_MapRGB(target->format,
target_p->actual_pal[*(s_pointer)].r,
target_p->actual_pal[*(s_pointer)].g,
target_p->actual_pal[*(s_pointer)].b);
@@ -164,20 +165,19 @@ void SDL_Double32bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
*((Uint32 *) ( (t_pointer)))=color;
/* i=1, j=0 */
*((Uint32 *) ( (t_pointer+(2*target_p->xsize) )))=color;
*((Uint32 *) ( (t_pointer+(4*target_p->xsize) )))=color;
/* i=0, j=1 */
*((Uint32 *) ( (t_pointer+4) ))=color;
/* i=1 j=1 */
*((Uint32 *) ( (t_pointer+4+(2*target_p->xsize) )))=color;
*((Uint32 *) ( (t_pointer+4+(4*target_p->xsize) )))=color;
s_pointer++; t_pointer+=8;
}
t_pointer+=2*target_p->xsize;
t_pointer+=4*target_p->xsize;
}
/* Update the display */
if ( SDL_MUSTLOCK(target) ) {
SDL_UnlockSurface(target);

View File

@@ -8,7 +8,7 @@
/* It is used both to get size of the sprite, then to actually get it */
int fakeGetSprite(int x,int y,int xsize,int ysize,
vmwVisual *screen,int capture,
char *spritedata) {
unsigned char *spritedata) {
int oldcolor,xtemp,ytemp=0,color,numacross,pointer=0;

139
tb1.c
View File

@@ -1,6 +1,6 @@
/****************************************************************\
\* TOM BOMBEM AND THE INVASION OF THE INANIMATE_OBJECTS */
/* version 2.9.15 28 October 2001 *\
/* version 2.9.16 26 December 2009 *\
\* by Vince Weaver vince@deater.net */
/* *\
\* Originally written in Pascal and x86 assembly for DOS */
@@ -10,7 +10,7 @@
\* This source is released under the GPL */
/****************************************************************/
#define TB1_VERSION "2.9.15"
#define TB1_VERSION "2.9.16"
#include <stdio.h>
#include <stdlib.h> /* for calloc */
@@ -34,8 +34,8 @@
#include "options.h"
#include "playgame.h"
int command_line_help(int show_version,char *runas)
{
int command_line_help(int show_version,char *runas) {
if (!show_version) {
printf("Usage: %s [-curses] [-double] [-fullscreen] [-nosound]"
" [-version] [-?]\n\n",runas);
@@ -56,7 +56,9 @@ void vmw_opener(tb1_state *game_state, vmwVisual *virtual_1) {
int x;
for (x=0;x<256;x++) vmwLoadPalette(game_state->graph_state,0,0,0,x); /* 0=black */
for(x=0;x<256;x++) {
vmwLoadPalette(game_state->graph_state,0,0,0,x); /* 0=black */
}
/* Do the VMW Software Production Logo */
for(x=0;x<=40;x++) {
@@ -89,16 +91,17 @@ void vmw_opener(tb1_state *game_state, vmwVisual *virtual_1) {
vmwTextXY("A VMW SOFTWARE PRODUCTION",60,140,
15,15,0,game_state->graph_state->default_font,virtual_1);
if ((game_state->sound_possible) && (game_state->music_enabled))
if ((game_state->sound_possible) && (game_state->music_enabled)) {
playSound();
}
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
pauseawhile(5);
vmwFadeToBlack(game_state->graph_state,virtual_1,0);
}
int main(int argc,char **argv)
{
int main(int argc,char **argv) {
int i,grapherror,reloadpic=0;
int ch,barpos,time_sec;
int graphics_target=VMW_SDLTARGET;
@@ -114,7 +117,7 @@ int main(int argc,char **argv)
struct timezone dontcare;
printf("\nTom Bombem v%s by Vince Weaver vince@deater.net\n",TB1_VERSION);
printf(" http://www.deater.net/weave/tb1\n\n");
printf(" http://www.deater.net/weave/vmwprod/tb1\n\n");
/* Setup the game state */
if ( (game_state=calloc(1,sizeof(tb1_state)))==NULL) {
@@ -138,7 +141,6 @@ int main(int argc,char **argv)
game_state->default_fullscreen=0;
/* Load saved defaults, if any */
dir_name=check_for_tb1_directory(game_state,0);
if (dir_name==NULL) {
printf(" + No ~/.tb1 directory. Using default options.\n");
@@ -168,23 +170,33 @@ int main(int argc,char **argv)
while(i<argc) {
if (argv[i][0]=='-') {
switch (argv[i][1]) {
case 'h': case '?':
command_line_help(0,argv[0]); return 5; break;
case 'h':
case '?':
command_line_help(0,argv[0]);
return 5;
break;
case 'v':
command_line_help(1,argv[0]); return 5; break;
command_line_help(1,argv[0]);
return 5;
break;
case 'f':
game_state->default_fullscreen=1; break;
game_state->default_fullscreen=1;
break;
case 'c':
graphics_target=VMW_CURSESTARGET; break;
graphics_target=VMW_CURSESTARGET;
break;
case 'd':
game_state->default_double_size=1; break;
game_state->default_double_size=1;
break;
case 'n':
game_state->sound_possible=0;
printf(" + Sound totally disabled\n");
break;
case 'o':
graphics_target=VMW_OPENGLTARGET; break;
default : command_line_help(0,argv[0]);
graphics_target=VMW_OPENGLTARGET;
break;
default :
command_line_help(0,argv[0]);
printf("Unknown Option: %s\n\n",argv[i]);
return 5;
}
@@ -226,29 +238,29 @@ int main(int argc,char **argv)
\* --> You are not meant to understand this <-- */
/* No 9-22-94 Back to yes 10-6-94 uh_oh 2-21-95 *\
\* gone for real long time 10-12-95 */
/* 11-95 not Amy anymore, but Gus *\
\* 3-96 oh well... gave up on Gus finally */
/* 5-11-96 Now Marie... *\
/* 11-95 not AMG, but AAT *\
\* 3-96 oh well... gave up on AAT finally */
/* 5-11-96 Now MLP... *\
\* 9-22-2000 :( */
/* 3-25-2002 Now Kristina ;) */
/* 3-25-2002 Now KRG ;) */
/* Randomize random number generator */
srandom(time(NULL));
printf(" + Seeding random number generator...\n");
/* Load/Detect sound */
if (game_state->sound_possible)
if (initSound(game_state->path_to_data)<0) game_state->sound_possible=0;
if (game_state->sound_possible) {
if (initSound(game_state->path_to_data)<0) {
game_state->sound_possible=0;
}
/* Load fanfare Music */
if (game_state->sound_possible) {
loadSound(tb1_data_file("music/vmwfan.mod",game_state->path_to_data));
}
printf(" + Loaded sounds...\n");
}
/* Setup Graphics */
if (!game_state->default_double_size) {
if ( (game_state->graph_state=
vmwSetupSVMWGraph(graphics_target,
@@ -283,10 +295,12 @@ int main(int argc,char **argv)
fprintf(stderr,"ERROR: Couldn't get RAM for virtual screen 1!\n");
return VMW_ERROR_MEM;
}
if ((game_state->virtual_2=vmwSetupVisual(320,400))==NULL) {
fprintf(stderr,"ERROR: Couldn't get RAM for virtual screen 2!\n");
return VMW_ERROR_MEM;
}
if ((game_state->virtual_3=vmwSetupVisual(320,200))==NULL) {
fprintf(stderr,"ERROR: Couldn't get RAM for virtual screen 3!\n");
return VMW_ERROR_MEM;
@@ -311,14 +325,17 @@ int main(int argc,char **argv)
/* Load palette */
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,0,
tb1_data_file("tbomb1.tb1",game_state->path_to_data),
tb1_data_file("tbomb1.tb1",
game_state->path_to_data),
game_state->graph_state);
/* Bit of a hack to load proper unfade colors */
vmwFadeToBlack(game_state->graph_state,virtual_1,1);
/* Load Title Picture */
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1,
tb1_data_file("tbomb1.tb1",game_state->path_to_data),
tb1_data_file("tbomb1.tb1",
game_state->path_to_data),
game_state->graph_state);
/* Copy the picture over */
@@ -331,10 +348,9 @@ int main(int argc,char **argv)
/* If virtual_3 was over-written, re-load it */
if (reloadpic) {
if ((game_state->sound_possible) && (game_state->music_enabled)) {
loadSound(tb1_data_file("music/weave1.mod",game_state->path_to_data));
loadSound(tb1_data_file("music/weave1.mod",
game_state->path_to_data));
}
grapherror=vmwLoadPicPacked(0,0,virtual_3,1,1,
tb1_data_file("tbomb1.tb1",
game_state->path_to_data),
@@ -345,8 +361,9 @@ int main(int argc,char **argv)
vmwFlipVirtual(virtual_1,virtual_3,320,200);
/* Play the menu-music */
if ((game_state->sound_possible) && (game_state->music_enabled))
if ((game_state->sound_possible) && (game_state->music_enabled)) {
playSound();
}
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
/* Don't show the menu until keypress/15s */
@@ -360,20 +377,48 @@ int main(int argc,char **argv)
ch=0;
while(ch!=VMW_ENTER){
if (barpos==0) vmwTextXY("NEW GAME",123,67,32,0,1,tb1_font,virtual_1);
else vmwTextXY("NEW GAME",123,67,32,7,1,tb1_font,virtual_1);
if (barpos==1) vmwTextXY("OPTIONS",123,77,32,0,1,tb1_font,virtual_1);
else vmwTextXY("OPTIONS",123,77,32,7,1,tb1_font,virtual_1);
if (barpos==2) vmwTextXY("ABOUT",123,87,32,0,1,tb1_font,virtual_1);
else vmwTextXY("ABOUT",123,87,32,7,1,tb1_font,virtual_1);
if (barpos==3) vmwTextXY("LOAD GAME",123,97,32,0,1,tb1_font,virtual_1);
else vmwTextXY("LOAD GAME",123,97,32,7,1,tb1_font,virtual_1);
if (barpos==4) vmwTextXY("STORY",123,107,32,0,1,tb1_font,virtual_1);
else vmwTextXY("STORY",123,107,32,7,1,tb1_font,virtual_1);
if (barpos==5) vmwTextXY("CREDITS",123,117,32,0,1,tb1_font,virtual_1);
else vmwTextXY("CREDITS",123,117,32,7,1,tb1_font,virtual_1);
if (barpos==6) vmwTextXY("QUIT",123,127,32,0,1,tb1_font,virtual_1);
else vmwTextXY("QUIT",123,127,32,7,1,tb1_font,virtual_1);
if (barpos==0) {
vmwTextXY("NEW GAME",123,67,32,0,1,tb1_font,virtual_1);
}
else {
vmwTextXY("NEW GAME",123,67,32,7,1,tb1_font,virtual_1);
}
if (barpos==1) {
vmwTextXY("OPTIONS",123,77,32,0,1,tb1_font,virtual_1);
}
else {
vmwTextXY("OPTIONS",123,77,32,7,1,tb1_font,virtual_1);
}
if (barpos==2) {
vmwTextXY("ABOUT",123,87,32,0,1,tb1_font,virtual_1);
}
else {
vmwTextXY("ABOUT",123,87,32,7,1,tb1_font,virtual_1);
}
if (barpos==3) {
vmwTextXY("LOAD GAME",123,97,32,0,1,tb1_font,virtual_1);
}
else {
vmwTextXY("LOAD GAME",123,97,32,7,1,tb1_font,virtual_1);
}
if (barpos==4) {
vmwTextXY("STORY",123,107,32,0,1,tb1_font,virtual_1);
}
else {
vmwTextXY("STORY",123,107,32,7,1,tb1_font,virtual_1);
}
if (barpos==5) {
vmwTextXY("CREDITS",123,117,32,0,1,tb1_font,virtual_1);
}
else {
vmwTextXY("CREDITS",123,117,32,7,1,tb1_font,virtual_1);
}
if (barpos==6) {
vmwTextXY("QUIT",123,127,32,0,1,tb1_font,virtual_1);
}
else {
vmwTextXY("QUIT",123,127,32,7,1,tb1_font,virtual_1);
}
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);

View File

@@ -14,10 +14,10 @@ int main(int argc,char **argv)
int grapherror;
int scale=1,fullscreen=0;
vmwVisual *virtual_1;
vmwPaintProHeader *ppro_header;
char *filename;
// vmwPaintProHeader *ppro_header;
// char *filename;
char ch=0;
char save_string[BUFSIZ];
// char save_string[BUFSIZ];
char *extension,*temp_string1,*temp_string2;
int xsize,ysize,type;
int is_pcx=0,target=VMW_SDLTARGET;