mirror of
https://github.com/deater/tb1.git
synced 2024-12-31 09:29:34 +00:00
v2.9.16
This commit is contained in:
parent
de8a2e1a48
commit
8a924ffd24
8
CHANGES
8
CHANGES
@ -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.
|
||||
|
@ -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
2
README
@ -11,7 +11,7 @@
|
||||
|
||||
Vince Weaver
|
||||
|
||||
Version 2.9.11
|
||||
Version 2.9.16
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Contents
|
||||
|
2
TB1.FAQ
2
TB1.FAQ
@ -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
|
||||
|
232
credits.c
232
credits.c
@ -1,4 +1,3 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -6,121 +5,136 @@
|
||||
#include "tb1_state.h"
|
||||
#include "tblib.h"
|
||||
|
||||
void credits(tb1_state *game_state)
|
||||
{
|
||||
void credits(tb1_state *game_state) {
|
||||
|
||||
int i,keypressed=0;
|
||||
|
||||
vmwFont *tb1_font;
|
||||
|
||||
tb1_font=game_state->graph_state->default_font;
|
||||
int i;
|
||||
//,keypressed=0;
|
||||
|
||||
vmwDrawBox(0,0,320,400,0,game_state->virtual_2);
|
||||
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);
|
||||
|
||||
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);
|
||||
vmwTextXY(" VINCENT M WEAVER",0,260,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GRAPHICS",0,290,10,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" VINCENT M WEAVER",0,310,10,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" SOUND EFFECTS",0,340,11,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" VINCENT M WEAVER",0,360,11,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GRAPHICS INSPIRATION",0,390,12,0,1,tb1_font,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);
|
||||
vmwTextXY(" VINCENT M WEAVER",0,260,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GRAPHICS",0,290,10,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" VINCENT M WEAVER",0,310,10,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" SOUND EFFECTS",0,340,11,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" VINCENT M WEAVER",0,360,11,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GRAPHICS INSPIRATION",0,390,12,0,1,tb1_font,game_state->virtual_2);
|
||||
|
||||
for(i=0;i<200;i++){
|
||||
vmwArbitraryCrossBlit(game_state->virtual_2,0,i,320,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);
|
||||
usleep(30000);
|
||||
if (vmwGetInput()) {
|
||||
keypressed=1; break;
|
||||
}
|
||||
}
|
||||
|
||||
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
|
||||
game_state->virtual_1,0,0);
|
||||
vmwArbitraryCrossBlit(game_state->virtual_1,0,0,320,200,
|
||||
game_state->virtual_2,0,0);
|
||||
vmwDrawBox(0,200,320,200,0,game_state->virtual_2);
|
||||
|
||||
vmwTextXY(" JEFF WARWICK",0,210,12,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GENERAL HELP",0,240,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" JOHN CLEMENS",0,260,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" JASON GRIMM",0,280,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" PCGPE AUTHORS, esp",0,310,14,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GRANT SMITH",0,330,14,0,1,tb1_font,game_state->virtual_2);
|
||||
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++){
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
|
||||
game_state->virtual_2,0,0);
|
||||
|
||||
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);
|
||||
vmwTextXY(" ANDREAS UMBACH",0,230,12,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" THANKS TO ALL THE DEVELOPERS",0,260,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" OF LINUX, ESPECIALLY",0,280,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" LINUS TORVALDS",0,300,13,0,1,tb1_font,game_state->virtual_2);
|
||||
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++){
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
|
||||
game_state->virtual_2,0,0);
|
||||
|
||||
vmwDrawBox(0,200,320,200,0,game_state->virtual_2);
|
||||
|
||||
vmwTextXY(" INSPIRATION",0,210,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" DOUGLAS ADAMS",0,230,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" CLIFF STOLL",0,250,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" ARTHUR C CLARKE",0,270,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" ISAAC ASIMOV",0,290,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GORDON KORMAN",0,310,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" THANKS TO ALL THE AGENTS",0,340,10,0,1,tb1_font,game_state->virtual_2);
|
||||
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++){
|
||||
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;
|
||||
}
|
||||
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
|
||||
usleep(30000);
|
||||
if (vmwGetInput()) {
|
||||
goto key_was_pressed;
|
||||
}
|
||||
}
|
||||
|
||||
/* move bottom to temp page */
|
||||
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
|
||||
game_state->virtual_2,0,0);
|
||||
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);
|
||||
vmwTextXY(" GENERAL HELP",0,240,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" JOHN CLEMENS",0,260,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" JASON GRIMM",0,280,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" PCGPE AUTHORS, esp",0,310,14,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GRANT SMITH",0,330,14,0,1,tb1_font,game_state->virtual_2);
|
||||
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);
|
||||
|
||||
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()) {
|
||||
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);
|
||||
vmwTextXY(" ANDREAS UMBACH",0,230,12,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" THANKS TO ALL THE DEVELOPERS",0,260,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" OF LINUX, ESPECIALLY",0,280,13,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" LINUS TORVALDS",0,300,13,0,1,tb1_font,game_state->virtual_2);
|
||||
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);
|
||||
|
||||
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()) {
|
||||
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);
|
||||
vmwTextXY(" DOUGLAS ADAMS",0,230,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" CLIFF STOLL",0,250,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" ARTHUR C CLARKE",0,270,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" ISAAC ASIMOV",0,290,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" GORDON KORMAN",0,310,9,0,1,tb1_font,game_state->virtual_2);
|
||||
vmwTextXY(" THANKS TO ALL THE AGENTS",0,340,10,0,1,tb1_font,game_state->virtual_2);
|
||||
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);
|
||||
|
||||
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()) {
|
||||
goto key_was_pressed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
vmwArbitraryCrossBlit(game_state->virtual_2,0,200,320,200,
|
||||
game_state->virtual_1,0,0);
|
||||
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);
|
||||
|
||||
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -91,17 +91,12 @@ int map_string_to_type(char *string) {
|
||||
struct level2_data *parse_data_file(char *filename) {
|
||||
|
||||
|
||||
FILE *fff;
|
||||
|
||||
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);
|
||||
@ -109,9 +104,7 @@ 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);
|
||||
|
@ -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
|
28
quit.c
28
quit.c
@ -8,20 +8,20 @@
|
||||
#include "sound.h"
|
||||
#include "tblib.h"
|
||||
|
||||
int quit(tb1_state *game_state)
|
||||
{
|
||||
int quit(tb1_state *game_state) {
|
||||
|
||||
int result=0;
|
||||
int result=0;
|
||||
|
||||
result=are_you_sure(game_state,"QUIT??? ARE YOU",
|
||||
"ABSOLUTELY SURE?",
|
||||
"YES-RIGHT NOW!",
|
||||
"NO--NOT YET.");
|
||||
|
||||
if (result) {
|
||||
shutdownSound();
|
||||
vmwCloseGraphics();
|
||||
exit(1);
|
||||
}
|
||||
else return 6;
|
||||
result=are_you_sure(game_state,"QUIT??? ARE YOU",
|
||||
"ABSOLUTELY SURE?",
|
||||
"YES-RIGHT NOW!",
|
||||
"NO--NOT YET.");
|
||||
|
||||
if (result) {
|
||||
shutdownSound();
|
||||
vmwCloseGraphics();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 6;
|
||||
}
|
||||
|
@ -154,30 +154,30 @@ void SDL_Double32bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||
s_pointer=source->memory;
|
||||
t_pointer=((Uint8 *)target->pixels);
|
||||
|
||||
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,
|
||||
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,
|
||||
target_p->actual_pal[*(s_pointer)].g,
|
||||
target_p->actual_pal[*(s_pointer)].b);
|
||||
|
||||
|
||||
/* i=0, j=0 */
|
||||
*((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);
|
||||
|
@ -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;
|
||||
|
||||
|
649
tb1.c
649
tb1.c
@ -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,160 +34,172 @@
|
||||
#include "options.h"
|
||||
#include "playgame.h"
|
||||
|
||||
int command_line_help(int show_version,char *runas)
|
||||
{
|
||||
if (!show_version) {
|
||||
printf("Usage: %s [-curses] [-double] [-fullscreen] [-nosound]"
|
||||
" [-version] [-?]\n\n",runas);
|
||||
printf(" -curses : play in color text-mode\n");
|
||||
printf(" -double : play in 640x480 mode\n");
|
||||
printf(" -fullscreen : play in fullscreen mode (if available)\n");
|
||||
printf(" -nosound : disables sound within game\n");
|
||||
printf(" -opengl : play in openGL mode\n");
|
||||
printf(" -version : print version\n");
|
||||
printf(" -? : print this help message\n");
|
||||
printf("\n");
|
||||
}
|
||||
int command_line_help(int show_version,char *runas) {
|
||||
|
||||
if (!show_version) {
|
||||
printf("Usage: %s [-curses] [-double] [-fullscreen] [-nosound]"
|
||||
" [-version] [-?]\n\n",runas);
|
||||
printf(" -curses : play in color text-mode\n");
|
||||
printf(" -double : play in 640x480 mode\n");
|
||||
printf(" -fullscreen : play in fullscreen mode (if available)\n");
|
||||
printf(" -nosound : disables sound within game\n");
|
||||
printf(" -opengl : play in openGL mode\n");
|
||||
printf(" -version : print version\n");
|
||||
printf(" -? : print this help message\n");
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
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 */
|
||||
int x;
|
||||
|
||||
/* Do the VMW Software Production Logo */
|
||||
for(x=0;x<=40;x++) {
|
||||
vmwLoadPalette(game_state->graph_state, ((x+20)*4),0,0,100+x);
|
||||
vmwLoadPalette(game_state->graph_state,0,0, ( (x+20)*4 ),141+x);
|
||||
vmwLoadPalette(game_state->graph_state,0, ( (x+20)*4),0,182+x);
|
||||
}
|
||||
for(x=0;x<256;x++) {
|
||||
vmwLoadPalette(game_state->graph_state,0,0,0,x); /* 0=black */
|
||||
}
|
||||
|
||||
/* Set the white color */
|
||||
vmwLoadPalette(game_state->graph_state,0xff,0xff,0xff,15);
|
||||
/* Do the VMW Software Production Logo */
|
||||
for(x=0;x<=40;x++) {
|
||||
vmwLoadPalette(game_state->graph_state, ((x+20)*4),0,0,100+x);
|
||||
vmwLoadPalette(game_state->graph_state,0,0, ( (x+20)*4 ),141+x);
|
||||
vmwLoadPalette(game_state->graph_state,0, ( (x+20)*4),0,182+x);
|
||||
}
|
||||
|
||||
/* Set the white color */
|
||||
vmwLoadPalette(game_state->graph_state,0xff,0xff,0xff,15);
|
||||
|
||||
vmwFlushPalette(game_state->graph_state);
|
||||
vmwFlushPalette(game_state->graph_state);
|
||||
|
||||
/* Actually draw the stylized VMW */
|
||||
for(x=0;x<=40;x++){
|
||||
vmwDrawVLine(x+40,45,2*x,100+x,virtual_1);
|
||||
vmwDrawVLine(x+120,45,2*x,141+x,virtual_1);
|
||||
vmwDrawVLine(x+200,45,2*x,141+x,virtual_1);
|
||||
vmwDrawVLine(x+80,125-(2*x),2*x,182+x,virtual_1);
|
||||
vmwDrawVLine(x+160,125-(2*x),2*x,182+x,virtual_1);
|
||||
}
|
||||
for(x=40;x>0;x--){
|
||||
vmwDrawVLine(x+80,45,80-(2*x),140-x,virtual_1);
|
||||
vmwDrawVLine(x+160,45,80-(2*x),181-x,virtual_1);
|
||||
vmwDrawVLine(x+240,45,80-(2*x),181-x,virtual_1);
|
||||
vmwDrawVLine(x+120,45+(2*x),80-(2*x),222-x,virtual_1);
|
||||
vmwDrawVLine(x+200,45+(2*x),80-(2*x),222-x,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))
|
||||
playSound();
|
||||
|
||||
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
||||
pauseawhile(5);
|
||||
vmwFadeToBlack(game_state->graph_state,virtual_1,0);
|
||||
/* Actually draw the stylized VMW */
|
||||
for(x=0;x<=40;x++) {
|
||||
vmwDrawVLine(x+40,45,2*x,100+x,virtual_1);
|
||||
vmwDrawVLine(x+120,45,2*x,141+x,virtual_1);
|
||||
vmwDrawVLine(x+200,45,2*x,141+x,virtual_1);
|
||||
vmwDrawVLine(x+80,125-(2*x),2*x,182+x,virtual_1);
|
||||
vmwDrawVLine(x+160,125-(2*x),2*x,182+x,virtual_1);
|
||||
}
|
||||
for(x=40;x>0;x--){
|
||||
vmwDrawVLine(x+80,45,80-(2*x),140-x,virtual_1);
|
||||
vmwDrawVLine(x+160,45,80-(2*x),181-x,virtual_1);
|
||||
vmwDrawVLine(x+240,45,80-(2*x),181-x,virtual_1);
|
||||
vmwDrawVLine(x+120,45+(2*x),80-(2*x),222-x,virtual_1);
|
||||
vmwDrawVLine(x+200,45+(2*x),80-(2*x),222-x,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)) {
|
||||
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 i,grapherror,reloadpic=0;
|
||||
int ch,barpos,time_sec;
|
||||
int graphics_target=VMW_SDLTARGET;
|
||||
FILE *fff;
|
||||
char *dir_name,options_file[BUFSIZ];
|
||||
vmwVisual *virtual_1,*virtual_2,*virtual_3;
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
tb1_state *game_state;
|
||||
|
||||
vmwFont *tb1_font;
|
||||
|
||||
struct timeval time_info;
|
||||
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");
|
||||
|
||||
/* Setup the game state */
|
||||
if ( (game_state=calloc(1,sizeof(tb1_state)))==NULL) {
|
||||
printf("You are seriously low on RAM!\n");
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* Some sane defaults */
|
||||
game_state->level=0;
|
||||
game_state->shields=0;
|
||||
game_state->score=0;
|
||||
game_state->virtual_1=NULL;
|
||||
game_state->virtual_2=NULL;
|
||||
game_state->virtual_3=NULL;
|
||||
game_state->sound_possible=1;
|
||||
game_state->music_enabled=1;
|
||||
game_state->sound_enabled=1;
|
||||
game_state->sound_volume=5;
|
||||
game_state->music_volume=5;
|
||||
game_state->default_double_size=0;
|
||||
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");
|
||||
}
|
||||
else {
|
||||
sprintf(options_file,"%s/options.tb1",dir_name);
|
||||
fff=fopen(options_file,"r");
|
||||
if (fff==NULL) {
|
||||
printf(" + No ~/.tb1/options.tb1 file. Using defaults.\n");
|
||||
}
|
||||
else {
|
||||
printf(" + Reading options from ~/.tb1/options.tb1\n");
|
||||
fscanf(fff,"%i %i %i %i %i %i",
|
||||
&game_state->sound_enabled,
|
||||
&game_state->music_enabled,
|
||||
&game_state->sound_volume,
|
||||
&game_state->music_volume,
|
||||
&game_state->default_double_size,
|
||||
&game_state->default_fullscreen);
|
||||
fclose(fff);
|
||||
}
|
||||
}
|
||||
int i,grapherror,reloadpic=0;
|
||||
int ch,barpos,time_sec;
|
||||
int graphics_target=VMW_SDLTARGET;
|
||||
FILE *fff;
|
||||
char *dir_name,options_file[BUFSIZ];
|
||||
vmwVisual *virtual_1,*virtual_2,*virtual_3;
|
||||
|
||||
tb1_state *game_state;
|
||||
|
||||
vmwFont *tb1_font;
|
||||
|
||||
struct timeval time_info;
|
||||
struct timezone dontcare;
|
||||
|
||||
printf("\nTom Bombem v%s by Vince Weaver vince@deater.net\n",TB1_VERSION);
|
||||
printf(" http://www.deater.net/weave/vmwprod/tb1\n\n");
|
||||
|
||||
/* Setup the game state */
|
||||
if ( (game_state=calloc(1,sizeof(tb1_state)))==NULL) {
|
||||
printf("You are seriously low on RAM!\n");
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* Some sane defaults */
|
||||
game_state->level=0;
|
||||
game_state->shields=0;
|
||||
game_state->score=0;
|
||||
game_state->virtual_1=NULL;
|
||||
game_state->virtual_2=NULL;
|
||||
game_state->virtual_3=NULL;
|
||||
game_state->sound_possible=1;
|
||||
game_state->music_enabled=1;
|
||||
game_state->sound_enabled=1;
|
||||
game_state->sound_volume=5;
|
||||
game_state->music_volume=5;
|
||||
game_state->default_double_size=0;
|
||||
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");
|
||||
}
|
||||
else {
|
||||
sprintf(options_file,"%s/options.tb1",dir_name);
|
||||
fff=fopen(options_file,"r");
|
||||
if (fff==NULL) {
|
||||
printf(" + No ~/.tb1/options.tb1 file. Using defaults.\n");
|
||||
}
|
||||
else {
|
||||
printf(" + Reading options from ~/.tb1/options.tb1\n");
|
||||
fscanf(fff,"%i %i %i %i %i %i",
|
||||
&game_state->sound_enabled,
|
||||
&game_state->music_enabled,
|
||||
&game_state->sound_volume,
|
||||
&game_state->music_volume,
|
||||
&game_state->default_double_size,
|
||||
&game_state->default_fullscreen);
|
||||
fclose(fff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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;
|
||||
/* 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;
|
||||
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]);
|
||||
printf("Unknown Option: %s\n\n",argv[i]);
|
||||
return 5;
|
||||
}
|
||||
graphics_target=VMW_OPENGLTARGET;
|
||||
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]);
|
||||
@ -195,7 +207,7 @@ int main(int argc,char **argv)
|
||||
return 5;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the Data */
|
||||
/* FIXME : User Defined Path Info*/
|
||||
@ -226,196 +238,229 @@ 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");
|
||||
/* 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;
|
||||
/* Load/Detect sound */
|
||||
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");
|
||||
}
|
||||
|
||||
/* 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=
|
||||
/* Setup Graphics */
|
||||
if (!game_state->default_double_size) {
|
||||
if ( (game_state->graph_state=
|
||||
vmwSetupSVMWGraph(graphics_target,
|
||||
320,200,
|
||||
0,1,
|
||||
game_state->default_fullscreen,
|
||||
1))==NULL) {
|
||||
fprintf(stderr,"ERROR: Couldn't get display set up properly.\n");
|
||||
return VMW_ERROR_DISPLAY;
|
||||
}
|
||||
}
|
||||
else { /* We are double-sized */
|
||||
if ( (game_state->graph_state=
|
||||
fprintf(stderr,"ERROR: Couldn't get display set up properly.\n");
|
||||
return VMW_ERROR_DISPLAY;
|
||||
}
|
||||
}
|
||||
else { /* We are double-sized */
|
||||
if ( (game_state->graph_state=
|
||||
vmwSetupSVMWGraph(graphics_target,
|
||||
640,480,
|
||||
0,2,
|
||||
game_state->default_fullscreen,
|
||||
1))==NULL) {
|
||||
fprintf(stderr,"ERROR: Couldn't get display set up properly.\n");
|
||||
return VMW_ERROR_DISPLAY;
|
||||
}
|
||||
}
|
||||
fprintf(stderr,"ERROR: Couldn't get display set up properly.\n");
|
||||
return VMW_ERROR_DISPLAY;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the tom bombem font */
|
||||
game_state->graph_state->default_font=
|
||||
/* Load the tom bombem font */
|
||||
game_state->graph_state->default_font=
|
||||
vmwLoadFont(tb1_data_file("tbfont.tb1",
|
||||
game_state->path_to_data),8,16,256);
|
||||
printf(" + Loaded tb1 font...\n");
|
||||
printf(" + Loaded tb1 font...\n");
|
||||
|
||||
/* Allocate the 3 virtual screens */
|
||||
if ((game_state->virtual_1=vmwSetupVisual(320,200))==NULL) {
|
||||
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;
|
||||
}
|
||||
|
||||
printf(" + Allocated virtual screens...\n");
|
||||
/* Allocate the 3 virtual screens */
|
||||
if ((game_state->virtual_1=vmwSetupVisual(320,200))==NULL) {
|
||||
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;
|
||||
}
|
||||
|
||||
printf(" + Allocated virtual screens...\n");
|
||||
|
||||
/* To ease typing burden */
|
||||
virtual_1=game_state->virtual_1;
|
||||
virtual_2=game_state->virtual_2;
|
||||
virtual_3=game_state->virtual_3;
|
||||
tb1_font=game_state->graph_state->default_font;
|
||||
|
||||
/* The "fancy" opener */
|
||||
vmw_opener(game_state,virtual_1);
|
||||
|
||||
/* Load menu music */
|
||||
if (game_state->sound_possible) {
|
||||
stopSound();
|
||||
loadSound(tb1_data_file("music/weave1.mod",game_state->path_to_data));
|
||||
}
|
||||
|
||||
/* Load palette */
|
||||
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,0,
|
||||
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),
|
||||
game_state->graph_state);
|
||||
|
||||
/* Copy the picture over */
|
||||
vmwFlipVirtual(virtual_3,virtual_1,320,200);
|
||||
|
||||
vmwUnFade(game_state->graph_state,virtual_1);
|
||||
|
||||
/* Main Menu Loop */
|
||||
while (1) {
|
||||
/* 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));
|
||||
}
|
||||
|
||||
|
||||
grapherror=vmwLoadPicPacked(0,0,virtual_3,1,1,
|
||||
tb1_data_file("tbomb1.tb1",
|
||||
game_state->path_to_data),
|
||||
game_state->graph_state);
|
||||
reloadpic=0;
|
||||
}
|
||||
|
||||
vmwFlipVirtual(virtual_1,virtual_3,320,200);
|
||||
|
||||
/* Play the menu-music */
|
||||
if ((game_state->sound_possible) && (game_state->music_enabled))
|
||||
playSound();
|
||||
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
||||
virtual_1=game_state->virtual_1;
|
||||
virtual_2=game_state->virtual_2;
|
||||
virtual_3=game_state->virtual_3;
|
||||
tb1_font=game_state->graph_state->default_font;
|
||||
|
||||
/* Don't show the menu until keypress/15s */
|
||||
pauseawhile(15);
|
||||
|
||||
barpos=0;
|
||||
vmwTextXY("F1 HELP",0,190,9,7,0,tb1_font,virtual_1);
|
||||
coolbox(117,61,199,140,1,virtual_1);
|
||||
|
||||
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
||||
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);
|
||||
/* The "fancy" opener */
|
||||
vmw_opener(game_state,virtual_1);
|
||||
|
||||
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
||||
|
||||
/* If at title screen too long, run credits */
|
||||
gettimeofday(&time_info,&dontcare);
|
||||
time_sec=time_info.tv_sec;
|
||||
|
||||
while( ((ch=vmwGetInput())==0)) {
|
||||
usleep(30);
|
||||
gettimeofday(&time_info,&dontcare);
|
||||
if (time_info.tv_sec-time_sec>40) {
|
||||
if (game_state->sound_possible) stopSound();
|
||||
credits(game_state);
|
||||
ch=VMW_ENTER;
|
||||
barpos=9;
|
||||
reloadpic=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Change menu position based on key pressed */
|
||||
if ((ch==VMW_DOWN)||(ch==VMW_RIGHT)) barpos++;
|
||||
if ((ch==VMW_UP) || (ch==VMW_LEFT)) barpos--;
|
||||
if (ch==VMW_F1) {barpos=10; ch=VMW_ENTER;} /*F1*/
|
||||
if (ch=='n') barpos=0; /*N*/
|
||||
if (ch=='o') barpos=1; /*O*/
|
||||
if (ch=='a') barpos=2; /*A*/
|
||||
if (ch=='l') barpos=3; /*L*/
|
||||
if (ch=='s') barpos=4; /*S*/
|
||||
if (ch=='c') barpos=5; /*C*/
|
||||
if (ch=='q') barpos=6; /*Q*/
|
||||
if (ch==VMW_ESCAPE){ /* escape */
|
||||
barpos=6;
|
||||
ch=VMW_ENTER;
|
||||
}
|
||||
if(barpos==7) barpos=0;
|
||||
if(barpos<0) barpos=6;
|
||||
}
|
||||
if (game_state->sound_possible) stopSound();
|
||||
/* Load menu music */
|
||||
if (game_state->sound_possible) {
|
||||
stopSound();
|
||||
loadSound(tb1_data_file("music/weave1.mod",game_state->path_to_data));
|
||||
}
|
||||
|
||||
/* Load palette */
|
||||
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,0,
|
||||
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),
|
||||
game_state->graph_state);
|
||||
|
||||
/* Copy the picture over */
|
||||
vmwFlipVirtual(virtual_3,virtual_1,320,200);
|
||||
|
||||
vmwUnFade(game_state->graph_state,virtual_1);
|
||||
|
||||
/* Main Menu Loop */
|
||||
while(1) {
|
||||
/* 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));
|
||||
}
|
||||
grapherror=vmwLoadPicPacked(0,0,virtual_3,1,1,
|
||||
tb1_data_file("tbomb1.tb1",
|
||||
game_state->path_to_data),
|
||||
game_state->graph_state);
|
||||
reloadpic=0;
|
||||
}
|
||||
|
||||
vmwFlipVirtual(virtual_1,virtual_3,320,200);
|
||||
|
||||
/* Play the menu-music */
|
||||
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 */
|
||||
pauseawhile(15);
|
||||
|
||||
barpos=0;
|
||||
vmwTextXY("F1 HELP",0,190,9,7,0,tb1_font,virtual_1);
|
||||
coolbox(117,61,199,140,1,virtual_1);
|
||||
|
||||
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
||||
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);
|
||||
}
|
||||
|
||||
vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
||||
|
||||
/* If at title screen too long, run credits */
|
||||
gettimeofday(&time_info,&dontcare);
|
||||
time_sec=time_info.tv_sec;
|
||||
|
||||
while( ((ch=vmwGetInput())==0)) {
|
||||
usleep(30);
|
||||
gettimeofday(&time_info,&dontcare);
|
||||
if (time_info.tv_sec-time_sec>40) {
|
||||
if (game_state->sound_possible) stopSound();
|
||||
credits(game_state);
|
||||
ch=VMW_ENTER;
|
||||
barpos=9;
|
||||
reloadpic=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Change menu position based on key pressed */
|
||||
if ((ch==VMW_DOWN)||(ch==VMW_RIGHT)) barpos++;
|
||||
if ((ch==VMW_UP) || (ch==VMW_LEFT)) barpos--;
|
||||
if (ch==VMW_F1) {barpos=10; ch=VMW_ENTER;} /*F1*/
|
||||
if (ch=='n') barpos=0; /*N*/
|
||||
if (ch=='o') barpos=1; /*O*/
|
||||
if (ch=='a') barpos=2; /*A*/
|
||||
if (ch=='l') barpos=3; /*L*/
|
||||
if (ch=='s') barpos=4; /*S*/
|
||||
if (ch=='c') barpos=5; /*C*/
|
||||
if (ch=='q') barpos=6; /*Q*/
|
||||
if (ch==VMW_ESCAPE){ /* escape */
|
||||
barpos=6;
|
||||
ch=VMW_ENTER;
|
||||
}
|
||||
if(barpos==7) barpos=0;
|
||||
if(barpos<0) barpos=6;
|
||||
}
|
||||
if (game_state->sound_possible) stopSound();
|
||||
|
||||
/* Run whatever it was that the person pressed */
|
||||
switch (barpos) {
|
||||
/* Run whatever it was that the person pressed */
|
||||
switch (barpos) {
|
||||
case 0: playthegame(game_state); reloadpic=1; break;
|
||||
case 1: options(game_state); reloadpic=1; break;
|
||||
case 2: about(game_state); reloadpic=1; break;
|
||||
@ -424,6 +469,6 @@ int main(int argc,char **argv)
|
||||
case 5: credits(game_state); break;
|
||||
case 6: barpos=quit(game_state); break;
|
||||
case 10: help(game_state); reloadpic=1; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user