mirror of
https://github.com/deater/tb1.git
synced 2024-06-07 20:29:31 +00:00
tb1_linux: compile warning free on modern compiler
also unwisely mix in some "fromdos" conversions and some other whitespace fixes
This commit is contained in:
parent
f0fc207ce7
commit
78c92961dc
|
@ -18,58 +18,58 @@ tb1: tb1.o ./svmwgraph/libsvmwgraph.a about.o credits.o graphic_tools.o \
|
||||||
cd svmwgraph && make
|
cd svmwgraph && make
|
||||||
|
|
||||||
tb1.o: tb1.c
|
tb1.o: tb1.c
|
||||||
$(CC) -c tb1.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c tb1.c $(INCLUDE)
|
||||||
|
|
||||||
about.o: about.c
|
about.o: about.c
|
||||||
$(CC) -c about.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c about.c $(INCLUDE)
|
||||||
|
|
||||||
credits.o: credits.c
|
credits.o: credits.c
|
||||||
$(CC) -c credits.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c credits.c $(INCLUDE)
|
||||||
|
|
||||||
graphic_tools.o: graphic_tools.c
|
graphic_tools.o: graphic_tools.c
|
||||||
$(CC) -c graphic_tools.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c graphic_tools.c $(INCLUDE)
|
||||||
|
|
||||||
help.o: help.c
|
help.o: help.c
|
||||||
$(CC) -c help.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c help.c $(INCLUDE)
|
||||||
|
|
||||||
hiscore.o: hiscore.c
|
hiscore.o: hiscore.c
|
||||||
$(CC) -c hiscore.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c hiscore.c $(INCLUDE)
|
||||||
|
|
||||||
level_1.o: level_1.c
|
level_1.o: level_1.c
|
||||||
$(CC) -c level_1.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c level_1.c $(INCLUDE)
|
||||||
|
|
||||||
level2_engine.o: level2_engine.c
|
level2_engine.o: level2_engine.c
|
||||||
$(CC) -c level2_engine.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c level2_engine.c $(INCLUDE)
|
||||||
|
|
||||||
#level_2.o: level_2.c
|
#level_2.o: level_2.c
|
||||||
# $(CC) -c level_2.c $(INCLUDE)
|
# $(CC) -c level_2.c $(INCLUDE)
|
||||||
|
|
||||||
level_3.o: level_3.c
|
level_3.o: level_3.c
|
||||||
$(CC) -c level_3.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c level_3.c $(INCLUDE)
|
||||||
|
|
||||||
loadsave.o: loadsave.c
|
loadsave.o: loadsave.c
|
||||||
$(CC) -c loadsave.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c loadsave.c $(INCLUDE)
|
||||||
|
|
||||||
options.o: options.c
|
options.o: options.c
|
||||||
$(CC) -c options.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c options.c $(INCLUDE)
|
||||||
|
|
||||||
playgame.o: playgame.c
|
playgame.o: playgame.c
|
||||||
$(CC) -c playgame.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c playgame.c $(INCLUDE)
|
||||||
|
|
||||||
quit.o: quit.c
|
quit.o: quit.c
|
||||||
$(CC) -c quit.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c quit.c $(INCLUDE)
|
||||||
|
|
||||||
sidebar.o: sidebar.c
|
sidebar.o: sidebar.c
|
||||||
$(CC) -c sidebar.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c sidebar.c $(INCLUDE)
|
||||||
|
|
||||||
sound.o: sound.c
|
sound.o: sound.c
|
||||||
$(CC) -c sound.c $(INCLUDE) $(SDL_MIXER_FLAGS)
|
$(CC) $(CFLAGS) -c sound.c $(INCLUDE) $(SDL_MIXER_FLAGS)
|
||||||
|
|
||||||
story.o: story.c
|
story.o: story.c
|
||||||
$(CC) -c story.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c story.c $(INCLUDE)
|
||||||
|
|
||||||
tblib.o: tblib.c
|
tblib.o: tblib.c
|
||||||
$(CC) -c tblib.c $(INCLUDE)
|
$(CC) $(CFLAGS) -c tblib.c $(INCLUDE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f tb1 *.o *~
|
rm -f tb1 *.o *~
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#
|
#
|
||||||
CC= gcc
|
CC= gcc
|
||||||
|
|
||||||
|
CFLAGS = -O2 -Wall -g
|
||||||
|
|
||||||
#
|
#
|
||||||
# Uncomment the following for SDL_mixer sound
|
# Uncomment the following for SDL_mixer sound
|
||||||
#
|
#
|
||||||
|
@ -26,9 +28,9 @@ SDL_INCLUDE= `sdl-config --cflags`
|
||||||
#
|
#
|
||||||
# Uncomment the following for ncurses
|
# Uncomment the following for ncurses
|
||||||
#
|
#
|
||||||
#CURSES_TARGET= curses_svmwgraph.o
|
CURSES_TARGET= curses_svmwgraph.o
|
||||||
#CURSES_FLAGS= -DCURSES_TARGET=1
|
CURSES_FLAGS= -DCURSES_TARGET=1
|
||||||
#CURSES_LIBS= -lncurses
|
CURSES_LIBS= -lncurses
|
||||||
|
|
||||||
#
|
#
|
||||||
# On machines w/ curses instead of ncurses [i.e. solaris, Irix, etc]
|
# On machines w/ curses instead of ncurses [i.e. solaris, Irix, etc]
|
||||||
|
@ -42,14 +44,14 @@ SDL_INCLUDE= `sdl-config --cflags`
|
||||||
#
|
#
|
||||||
# Uncomment the following for opengGL
|
# Uncomment the following for opengGL
|
||||||
#
|
#
|
||||||
#OPENGL_TARGET= opengl_svmwgraph.o
|
OPENGL_TARGET= opengl_svmwgraph.o
|
||||||
#OPENGL_FLAGS=-DOPENGL_TARGET
|
OPENGL_FLAGS=-DOPENGL_TARGET
|
||||||
#OPENGL_LIBS= -L/usr/X11R6/lib -lX11 -lICE -lXmu -lGL -lGLU
|
OPENGL_LIBS= -lX11 -lICE -lGL -lGLU
|
||||||
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# DO NOT EDIT BELOW THIS LINE
|
# DO NOT EDIT BELOW THIS LINE
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
INCLUDE_GLOBAL= -Wall -O2 $(SDL_INCLUDE)
|
INCLUDE_GLOBAL= $(SDL_INCLUDE)
|
||||||
LIBS_GLOBAL= -lm $(SDL_MIXER_LIBS) $(SDL_LIBS) $(CURSES_LIBS) $(OPENGL_LIBS)
|
LIBS_GLOBAL= -lm $(SDL_MIXER_LIBS) $(SDL_LIBS) $(CURSES_LIBS) $(OPENGL_LIBS)
|
||||||
|
|
|
@ -275,7 +275,7 @@ void leveltwoengine(tb1_state *game_state, char *shipfile, char *levelfile,
|
||||||
struct timeval timing_info;
|
struct timeval timing_info;
|
||||||
struct timezone dontcare;
|
struct timezone dontcare;
|
||||||
|
|
||||||
long oldsec,oldusec,time_spent;
|
long oldusec,time_spent;//oldsec
|
||||||
int howmuchscroll=200; /* there is a reason for this */
|
int howmuchscroll=200; /* there is a reason for this */
|
||||||
struct obstruction_type obstruction[12][20];
|
struct obstruction_type obstruction[12][20];
|
||||||
int shipadd=0,shipframe=1;
|
int shipadd=0,shipframe=1;
|
||||||
|
@ -306,6 +306,9 @@ void leveltwoengine(tb1_state *game_state, char *shipfile, char *levelfile,
|
||||||
tb1_data_file(shipfile,
|
tb1_data_file(shipfile,
|
||||||
game_state->path_to_data),
|
game_state->path_to_data),
|
||||||
game_state->graph_state);
|
game_state->graph_state);
|
||||||
|
if (grapherror) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ship_shape[0]=vmwGetSprite(0,0,48,30,virtual_1);
|
ship_shape[0]=vmwGetSprite(0,0,48,30,virtual_1);
|
||||||
ship_shape[1]=vmwGetSprite(0,32,48,30,virtual_1);
|
ship_shape[1]=vmwGetSprite(0,32,48,30,virtual_1);
|
||||||
|
@ -360,11 +363,10 @@ void leveltwoengine(tb1_state *game_state, char *shipfile, char *levelfile,
|
||||||
|
|
||||||
change_shields(game_state);
|
change_shields(game_state);
|
||||||
|
|
||||||
|
|
||||||
/* Ready the timing loop */
|
/* Ready the timing loop */
|
||||||
gettimeofday(&timing_info,&dontcare);
|
gettimeofday(&timing_info,&dontcare);
|
||||||
oldsec=timing_info.tv_sec; oldusec=timing_info.tv_usec;
|
//oldsec=timing_info.tv_sec;
|
||||||
|
oldusec=timing_info.tv_usec;
|
||||||
|
|
||||||
/* Get the initial background ready */
|
/* Get the initial background ready */
|
||||||
/* We copy the last 40 rows into vaddr_2 */
|
/* We copy the last 40 rows into vaddr_2 */
|
||||||
|
@ -754,20 +756,19 @@ void leveltwoengine(tb1_state *game_state, char *shipfile, char *levelfile,
|
||||||
if (time_spent<30000) usleep(100);
|
if (time_spent<30000) usleep(100);
|
||||||
else (done_waiting=1);
|
else (done_waiting=1);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldusec=timing_info.tv_usec;
|
oldusec=timing_info.tv_usec;
|
||||||
oldsec=timing_info.tv_sec;
|
//oldsec=timing_info.tv_sec;
|
||||||
|
|
||||||
/* If game is paused, don't keep track of time */
|
/* If game is paused, don't keep track of time */
|
||||||
|
|
||||||
if (game_paused) {
|
if (game_paused) {
|
||||||
gettimeofday(&timing_info,&dontcare);
|
gettimeofday(&timing_info,&dontcare);
|
||||||
oldusec=timing_info.tv_usec;
|
oldusec=timing_info.tv_usec;
|
||||||
oldsec=timing_info.tv_sec;
|
//oldsec=timing_info.tv_sec;
|
||||||
game_paused=0;
|
game_paused=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The level is over */
|
||||||
/* The leve is over */
|
|
||||||
/* FIXME autocalculate rather than 1950 */
|
/* FIXME autocalculate rather than 1950 */
|
||||||
|
|
||||||
if (rows_goneby>1950) {
|
if (rows_goneby>1950) {
|
||||||
|
@ -777,8 +778,6 @@ void leveltwoengine(tb1_state *game_state, char *shipfile, char *levelfile,
|
||||||
// vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
// vmwBlitMemToDisplay(game_state->graph_state,virtual_1);
|
||||||
// pauseawhile(10);
|
// pauseawhile(10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vmwClearKeyboardBuffer();
|
vmwClearKeyboardBuffer();
|
||||||
pauseawhile(5);
|
pauseawhile(5);
|
||||||
vmwLoadPicPacked(0,0,game_state->virtual_3,0,1,
|
vmwLoadPicPacked(0,0,game_state->virtual_3,0,1,
|
||||||
|
|
|
@ -481,7 +481,7 @@ void LevelOneEngine(tb1_state *game_state) {
|
||||||
int shipx=36,shipadd=0,shipframe=1;
|
int shipx=36,shipadd=0,shipframe=1;
|
||||||
vmwSprite *bigship1,*bigship2,*bigship3;
|
vmwSprite *bigship1,*bigship2,*bigship3;
|
||||||
vmwSprite *shapetable[20];
|
vmwSprite *shapetable[20];
|
||||||
long oldsec,oldusec,time_spent=1;
|
long oldusec,time_spent=1; // oldsec;
|
||||||
int howmuchscroll=0;
|
int howmuchscroll=0;
|
||||||
int game_paused=0;
|
int game_paused=0;
|
||||||
int done_waiting=0;
|
int done_waiting=0;
|
||||||
|
@ -502,6 +502,9 @@ void LevelOneEngine(tb1_state *game_state) {
|
||||||
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1,
|
grapherror=vmwLoadPicPacked(0,0,virtual_1,1,1,
|
||||||
tb1_data_file("level1/ships.tb1",game_state->path_to_data),
|
tb1_data_file("level1/ships.tb1",game_state->path_to_data),
|
||||||
game_state->graph_state);
|
game_state->graph_state);
|
||||||
|
if (grapherror) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
@ -559,7 +562,7 @@ void LevelOneEngine(tb1_state *game_state) {
|
||||||
|
|
||||||
/* Get time values for frame-limiting */
|
/* Get time values for frame-limiting */
|
||||||
gettimeofday(&timing_info,&dontcare);
|
gettimeofday(&timing_info,&dontcare);
|
||||||
oldsec=timing_info.tv_sec;
|
//oldsec=timing_info.tv_sec;
|
||||||
oldusec=timing_info.tv_usec;
|
oldusec=timing_info.tv_usec;
|
||||||
|
|
||||||
/* MAIN GAME LOOP */
|
/* MAIN GAME LOOP */
|
||||||
|
@ -585,7 +588,6 @@ void LevelOneEngine(tb1_state *game_state) {
|
||||||
virtual_1,0,0);
|
virtual_1,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Add new enemies and move to next wave if needed */
|
/* Add new enemies and move to next wave if needed */
|
||||||
if (enemies_out<NUM_ENEMIES) {
|
if (enemies_out<NUM_ENEMIES) {
|
||||||
if (add_another_enemy(0,game_state)==LEVEL_OVER) {
|
if (add_another_enemy(0,game_state)==LEVEL_OVER) {
|
||||||
|
@ -595,8 +597,6 @@ void LevelOneEngine(tb1_state *game_state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* See if the enemies have hit anything/scrolled off screen */
|
/* See if the enemies have hit anything/scrolled off screen */
|
||||||
for(i=0;i<NUM_ENEMIES;i++) {
|
for(i=0;i<NUM_ENEMIES;i++) {
|
||||||
if (!enemy[i].dead) {
|
if (!enemy[i].dead) {
|
||||||
|
@ -709,8 +709,10 @@ void LevelOneEngine(tb1_state *game_state) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
case 's': if (game_state->sound_possible)
|
case 's': if (game_state->sound_possible) {
|
||||||
game_state->sound_enabled=!(game_state->sound_enabled); break;
|
game_state->sound_enabled=!(game_state->sound_enabled);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case VMW_F2: game_paused=1;
|
case VMW_F2: game_paused=1;
|
||||||
savegame(game_state);
|
savegame(game_state);
|
||||||
break;
|
break;
|
||||||
|
@ -766,21 +768,18 @@ void LevelOneEngine(tb1_state *game_state) {
|
||||||
if (time_spent<0) time_spent+=1000000;
|
if (time_spent<0) time_spent+=1000000;
|
||||||
if (time_spent<30000) usleep(100);
|
if (time_spent<30000) usleep(100);
|
||||||
else (done_waiting=1);
|
else (done_waiting=1);
|
||||||
|
|
||||||
}
|
}
|
||||||
oldusec=timing_info.tv_usec;
|
oldusec=timing_info.tv_usec;
|
||||||
oldsec=timing_info.tv_sec;
|
//oldsec=timing_info.tv_sec;
|
||||||
|
|
||||||
/* If game is paused, don't keep track of time */
|
/* If game is paused, don't keep track of time */
|
||||||
|
|
||||||
if (game_paused) {
|
if (game_paused) {
|
||||||
gettimeofday(&timing_info,&dontcare);
|
gettimeofday(&timing_info,&dontcare);
|
||||||
oldusec=timing_info.tv_usec;
|
oldusec=timing_info.tv_usec;
|
||||||
oldsec=timing_info.tv_sec;
|
//oldsec=timing_info.tv_sec;
|
||||||
game_paused=0;
|
game_paused=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The little opener before Level 1 */
|
/* The little opener before Level 1 */
|
||||||
|
|
|
@ -24,7 +24,6 @@ vmwSprite *shape_table[80];
|
||||||
|
|
||||||
void loadlevel3shapes(tb1_state *game_state) {
|
void loadlevel3shapes(tb1_state *game_state) {
|
||||||
|
|
||||||
|
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
vmwLoadPicPacked(0,0,game_state->virtual_2,0,1,
|
vmwLoadPicPacked(0,0,game_state->virtual_2,0,1,
|
||||||
|
@ -179,20 +178,18 @@ void LevelThreeEngine(tb1_state *game_state) {
|
||||||
|
|
||||||
int tom_x=100,tom_y=100,walking=0;
|
int tom_x=100,tom_y=100,walking=0;
|
||||||
|
|
||||||
|
vmwVisual *virtual_1;//,*virtual_2;
|
||||||
vmwVisual *virtual_1,*virtual_2;
|
// vmwFont *tb1_font;
|
||||||
vmwFont *tb1_font;
|
|
||||||
|
|
||||||
long oldsec,oldusec,time_spent;
|
long oldsec,oldusec,time_spent;
|
||||||
|
|
||||||
struct timeval timing_info;
|
struct timeval timing_info;
|
||||||
struct timezone dontcare;
|
struct timezone dontcare;
|
||||||
int speed_factor=0;
|
// int speed_factor=0;
|
||||||
|
|
||||||
|
|
||||||
virtual_1=game_state->virtual_1;
|
virtual_1=game_state->virtual_1;
|
||||||
virtual_2=game_state->virtual_2;
|
// virtual_2=game_state->virtual_2;
|
||||||
tb1_font=game_state->graph_state->default_font;
|
// tb1_font=game_state->graph_state->default_font;
|
||||||
|
|
||||||
loadlevel3shapes(game_state);
|
loadlevel3shapes(game_state);
|
||||||
/* computer_0hits:=0;
|
/* computer_0hits:=0;
|
||||||
|
@ -763,7 +760,6 @@ newroom:
|
||||||
|
|
||||||
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
|
vmwBlitMemToDisplay(game_state->graph_state,game_state->virtual_1);
|
||||||
|
|
||||||
|
|
||||||
/* Calculate how much time has passed */
|
/* Calculate how much time has passed */
|
||||||
gettimeofday(&timing_info,&dontcare);
|
gettimeofday(&timing_info,&dontcare);
|
||||||
time_spent=timing_info.tv_usec-oldusec;
|
time_spent=timing_info.tv_usec-oldusec;
|
||||||
|
@ -786,14 +782,13 @@ newroom:
|
||||||
oldusec=timing_info.tv_usec;
|
oldusec=timing_info.tv_usec;
|
||||||
oldsec=timing_info.tv_sec;
|
oldsec=timing_info.tv_sec;
|
||||||
game_paused=0;
|
game_paused=0;
|
||||||
speed_factor=1;
|
//speed_factor=1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
speed_factor=(time_spent/30000);
|
//speed_factor=(time_spent/30000);
|
||||||
oldusec=timing_info.tv_usec;
|
oldusec=timing_info.tv_usec;
|
||||||
oldsec=timing_info.tv_sec;
|
oldsec=timing_info.tv_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,6 +814,10 @@ void LevelThreeLittleOpener(tb1_state *game_state) {
|
||||||
grapherror=vmwLoadPicPacked(0,0,virtual_2,
|
grapherror=vmwLoadPicPacked(0,0,virtual_2,
|
||||||
1,1,tb1_data_file("level3/tbl3intr.tb1",
|
1,1,tb1_data_file("level3/tbl3intr.tb1",
|
||||||
game_state->path_to_data),game_state->graph_state);
|
game_state->path_to_data),game_state->graph_state);
|
||||||
|
if (grapherror) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vmwArbitraryCrossBlit(game_state->virtual_2,0,3,171,114,
|
vmwArbitraryCrossBlit(game_state->virtual_2,0,3,171,114,
|
||||||
game_state->virtual_1,10,10);
|
game_state->virtual_1,10,10);
|
||||||
|
|
||||||
|
|
|
@ -10,43 +10,43 @@ libsvmwgraph.a: vmw_core.o vmw_dialogs.o vmw_flip.o vmw_font.o vmw_paintpro.o vm
|
||||||
ranlib libsvmwgraph.a
|
ranlib libsvmwgraph.a
|
||||||
|
|
||||||
vmw_core.o: vmw_core.c
|
vmw_core.o: vmw_core.c
|
||||||
$(CC) $(INCLUDE) -c vmw_core.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_core.c
|
||||||
|
|
||||||
vmw_dialogs.o: vmw_dialogs.c
|
vmw_dialogs.o: vmw_dialogs.c
|
||||||
$(CC) $(INCLUDE) -c vmw_dialogs.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_dialogs.c
|
||||||
|
|
||||||
vmw_flip.o: vmw_flip.c
|
vmw_flip.o: vmw_flip.c
|
||||||
$(CC) $(INCLUDE) -c vmw_flip.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_flip.c
|
||||||
|
|
||||||
vmw_font.o: vmw_font.c
|
vmw_font.o: vmw_font.c
|
||||||
$(CC) $(INCLUDE) -c vmw_font.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_font.c
|
||||||
|
|
||||||
vmw_paintpro.o: vmw_paintpro.c
|
vmw_paintpro.o: vmw_paintpro.c
|
||||||
$(CC) $(INCLUDE) -c vmw_paintpro.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_paintpro.c
|
||||||
|
|
||||||
vmw_palette.o: vmw_palette.c
|
vmw_palette.o: vmw_palette.c
|
||||||
$(CC) $(INCLUDE) -c vmw_palette.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_palette.c
|
||||||
|
|
||||||
vmw_pcx.o: vmw_pcx.c
|
vmw_pcx.o: vmw_pcx.c
|
||||||
$(CC) $(INCLUDE) -c vmw_pcx.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_pcx.c
|
||||||
|
|
||||||
vmw_setup.o: vmw_setup.c
|
vmw_setup.o: vmw_setup.c
|
||||||
$(CC) $(INCLUDE) $(SDL_FLAGS) $(CURSES_FLAGS) $(OPENGL_FLAGS) -c vmw_setup.c
|
$(CC) $(CFLAGS) $(INCLUDE) $(SDL_FLAGS) $(CURSES_FLAGS) $(OPENGL_FLAGS) -c vmw_setup.c
|
||||||
|
|
||||||
vmw_sprite.o: vmw_sprite.c
|
vmw_sprite.o: vmw_sprite.c
|
||||||
$(CC) $(INCLUDE) -c vmw_sprite.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c vmw_sprite.c
|
||||||
|
|
||||||
curses_svmwgraph.o: curses_svmwgraph.c
|
curses_svmwgraph.o: curses_svmwgraph.c
|
||||||
$(CC) $(INCLUDE) -c curses_svmwgraph.c $(CURSES_FLAGS)
|
$(CC) $(CFLAGS) $(INCLUDE) -c curses_svmwgraph.c $(CURSES_FLAGS)
|
||||||
|
|
||||||
null_svmwgraph.o: null_svmwgraph.c
|
null_svmwgraph.o: null_svmwgraph.c
|
||||||
$(CC) $(INCLUDE) -c null_svmwgraph.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c null_svmwgraph.c
|
||||||
|
|
||||||
opengl_svmwgraph.o: opengl_svmwgraph.c
|
opengl_svmwgraph.o: opengl_svmwgraph.c
|
||||||
$(CC) $(INCLUDE) -c opengl_svmwgraph.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c opengl_svmwgraph.c
|
||||||
|
|
||||||
sdl_svmwgraph.o: sdl_svmwgraph.c
|
sdl_svmwgraph.o: sdl_svmwgraph.c
|
||||||
$(CC) $(INCLUDE) -c sdl_svmwgraph.c
|
$(CC) $(CFLAGS) $(INCLUDE) -c sdl_svmwgraph.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f libsvmwgraph.a *.o *~
|
rm -f libsvmwgraph.a *.o *~
|
||||||
|
|
|
@ -186,27 +186,24 @@ void openGL_flushPalette(vmwSVMWGraphState *state) {
|
||||||
void openGL_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
void openGL_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
|
|
||||||
|
|
||||||
int x=0,y=0,temp_col,i,j,ending_j,ending_i;
|
int x=0,y=0,i,j;//temp_col,ending_j,ending_i;
|
||||||
unsigned char *s_pointer;
|
unsigned char *s_pointer;
|
||||||
|
|
||||||
GLubyte temp_data[64*64*4];
|
GLubyte temp_data[64*64*4];
|
||||||
|
|
||||||
GLubyte *t_pointer;
|
// GLubyte *t_pointer;
|
||||||
|
|
||||||
GLfloat light_position[]={0.0,0.0,25.0,0.0};
|
GLfloat light_position[]={0.0,0.0,25.0,0.0};
|
||||||
GLfloat light_ambient[]={0.65,0.65,0.65,1.0};
|
// GLfloat light_ambient[]={0.65,0.65,0.65,1.0};
|
||||||
GLfloat lmodel_ambient[]={0.4,0.4,0.4,1.0};
|
GLfloat lmodel_ambient[]={0.4,0.4,0.4,1.0};
|
||||||
GLfloat white_light[]={1.0,1.0,1.0,1.0};
|
GLfloat white_light[]={1.0,1.0,1.0,1.0};
|
||||||
|
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
gluLookAt(0.0,0.0,20.0,
|
gluLookAt(0.0,0.0,20.0,
|
||||||
0.0,0.0,0.0,
|
0.0,0.0,0.0,
|
||||||
0.0,1.0,1.0);
|
0.0,1.0,1.0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
|
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
|
||||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, white_light);
|
glLightfv(GL_LIGHT0, GL_DIFFUSE, white_light);
|
||||||
glLightfv(GL_LIGHT0, GL_SPECULAR,white_light);
|
glLightfv(GL_LIGHT0, GL_SPECULAR,white_light);
|
||||||
|
|
|
@ -136,7 +136,7 @@ void SDL_NoScale32bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
|
|
||||||
void SDL_Double32bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
void SDL_Double32bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
|
|
||||||
int x,y,scale,color;
|
int x,y,color;//,scale;
|
||||||
|
|
||||||
unsigned char *s_pointer,*t_pointer;
|
unsigned char *s_pointer,*t_pointer;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ void SDL_Double32bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
|
|
||||||
target=(SDL_Surface *)target_p->output_screen;
|
target=(SDL_Surface *)target_p->output_screen;
|
||||||
|
|
||||||
scale=target_p->scale;
|
// scale=target_p->scale;
|
||||||
|
|
||||||
if ( SDL_MUSTLOCK(target) ) {
|
if ( SDL_MUSTLOCK(target) ) {
|
||||||
if ( SDL_LockSurface(target) < 0 )
|
if ( SDL_LockSurface(target) < 0 )
|
||||||
|
@ -214,7 +214,6 @@ void SDL_NoScale16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
s_pointer++; t_pointer+=2;
|
s_pointer++; t_pointer+=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Update the display */
|
/* Update the display */
|
||||||
if ( SDL_MUSTLOCK(target) ) {
|
if ( SDL_MUSTLOCK(target) ) {
|
||||||
SDL_UnlockSurface(target);
|
SDL_UnlockSurface(target);
|
||||||
|
@ -228,7 +227,7 @@ void SDL_NoScale16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
/* I should make this generic, but it makes it really slow */
|
/* I should make this generic, but it makes it really slow */
|
||||||
void SDL_Double16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
void SDL_Double16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
|
|
||||||
int x,y,scale;
|
int x,y;
|
||||||
|
|
||||||
unsigned char *s_pointer,*t_pointer;
|
unsigned char *s_pointer,*t_pointer;
|
||||||
|
|
||||||
|
@ -236,7 +235,7 @@ void SDL_Double16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
|
|
||||||
target=(SDL_Surface *)target_p->output_screen;
|
target=(SDL_Surface *)target_p->output_screen;
|
||||||
|
|
||||||
scale=target_p->scale;
|
//scale=target_p->scale;
|
||||||
|
|
||||||
if ( SDL_MUSTLOCK(target) ) {
|
if ( SDL_MUSTLOCK(target) ) {
|
||||||
if ( SDL_LockSurface(target) < 0 )
|
if ( SDL_LockSurface(target) < 0 )
|
||||||
|
@ -264,13 +263,11 @@ void SDL_Double16bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
*((Uint16 *) ( (t_pointer+2+(2*target_p->xsize) )))=
|
*((Uint16 *) ( (t_pointer+2+(2*target_p->xsize) )))=
|
||||||
target_p->palette[*(s_pointer)];
|
target_p->palette[*(s_pointer)];
|
||||||
|
|
||||||
|
|
||||||
s_pointer++; t_pointer+=4;
|
s_pointer++; t_pointer+=4;
|
||||||
}
|
}
|
||||||
t_pointer+=2*target_p->xsize;
|
t_pointer+=2*target_p->xsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Update the display */
|
/* Update the display */
|
||||||
if ( SDL_MUSTLOCK(target) ) {
|
if ( SDL_MUSTLOCK(target) ) {
|
||||||
SDL_UnlockSurface(target);
|
SDL_UnlockSurface(target);
|
||||||
|
@ -305,7 +302,6 @@ void SDL_NoScale8bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
s_pointer++; t_pointer++;
|
s_pointer++; t_pointer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Update the display */
|
/* Update the display */
|
||||||
if ( SDL_MUSTLOCK(target) ) {
|
if ( SDL_MUSTLOCK(target) ) {
|
||||||
SDL_UnlockSurface(target);
|
SDL_UnlockSurface(target);
|
||||||
|
@ -357,18 +353,16 @@ void SDL_Double8bpp_BlitMem(vmwSVMWGraphState *target_p, vmwVisual *source) {
|
||||||
|
|
||||||
/* Write this out to the screen */
|
/* Write this out to the screen */
|
||||||
SDL_UpdateRect(target, 0, 0, target_p->xsize, target_p->ysize);
|
SDL_UpdateRect(target, 0, 0, target_p->xsize, target_p->ysize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SDL_clearKeyboardBuffer() {
|
void SDL_clearKeyboardBuffer(void) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_getInput() {
|
int SDL_getInput(void) {
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
int keypressed,button;
|
int keypressed,button;
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <string.h> /* For strncmp */
|
#include <string.h> /* For strncmp */
|
||||||
#include <fcntl.h> /* for open() */
|
#include <fcntl.h> /* for open() */
|
||||||
#include <unistd.h> /* for lseek() */
|
#include <unistd.h> /* for lseek() */
|
||||||
|
#include <stdlib.h> /* for calloc() */
|
||||||
#include <sys/stat.h> /* for file modes */
|
#include <sys/stat.h> /* for file modes */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <string.h> /* For strncmp */
|
#include <string.h> /* For strncmp */
|
||||||
#include <fcntl.h> /* for open() */
|
#include <fcntl.h> /* for open() */
|
||||||
#include <unistd.h> /* for lseek() */
|
#include <unistd.h> /* for lseek() */
|
||||||
|
#include <stdlib.h> /* for calloc() */
|
||||||
#include <sys/stat.h> /* for file modes */
|
#include <sys/stat.h> /* for file modes */
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,9 +96,9 @@ int vmwLoadPCX(int x1,int y1,vmwVisual *target,
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int pcx_fd,x,y,i,numacross,xsize,ysize,xmin,ymin;
|
int pcx_fd,x,i,numacross,xsize,ysize,xmin,ymin;//y;
|
||||||
unsigned int r,g,b;
|
unsigned int r,g,b;
|
||||||
int bpp,planes,bpl,xmax,ymax,version;
|
int xmax,ymax;//bpl,bpp,planes,version;
|
||||||
unsigned char pcx_header[128];
|
unsigned char pcx_header[128];
|
||||||
unsigned char temp_byte;
|
unsigned char temp_byte;
|
||||||
|
|
||||||
|
@ -110,7 +111,6 @@ int vmwLoadPCX(int x1,int y1,vmwVisual *target,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************** DECODE THE HEADER *************************/
|
/*************** DECODE THE HEADER *************************/
|
||||||
read(pcx_fd,&pcx_header,128);
|
read(pcx_fd,&pcx_header,128);
|
||||||
|
|
||||||
|
@ -120,10 +120,10 @@ int vmwLoadPCX(int x1,int y1,vmwVisual *target,
|
||||||
xmax=(pcx_header[9]<<8)+pcx_header[8];
|
xmax=(pcx_header[9]<<8)+pcx_header[8];
|
||||||
ymax=(pcx_header[11]<<8)+pcx_header[10];
|
ymax=(pcx_header[11]<<8)+pcx_header[10];
|
||||||
|
|
||||||
version=pcx_header[1];
|
//version=pcx_header[1];
|
||||||
bpp=pcx_header[3];
|
//bpp=pcx_header[3];
|
||||||
planes=pcx_header[65];
|
//planes=pcx_header[65];
|
||||||
bpl=(pcx_header[67]<<8)+pcx_header[66];
|
//bpl=(pcx_header[67]<<8)+pcx_header[66];
|
||||||
|
|
||||||
xsize=((xmax-xmin)+1);
|
xsize=((xmax-xmin)+1);
|
||||||
ysize=((ymax-ymin)+1);
|
ysize=((ymax-ymin)+1);
|
||||||
|
@ -136,7 +136,7 @@ int vmwLoadPCX(int x1,int y1,vmwVisual *target,
|
||||||
|
|
||||||
unsigned char *pointer=target->memory;
|
unsigned char *pointer=target->memory;
|
||||||
|
|
||||||
x=0; y=0;
|
x=0; //y=0;
|
||||||
|
|
||||||
while (x<xsize*ysize) {
|
while (x<xsize*ysize) {
|
||||||
read(pcx_fd,&temp_byte,1);
|
read(pcx_fd,&temp_byte,1);
|
||||||
|
@ -152,7 +152,6 @@ int vmwLoadPCX(int x1,int y1,vmwVisual *target,
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//printf("Color=%i Across=%i\n",temp_byte,numacross);
|
//printf("Color=%i Across=%i\n",temp_byte,numacross);
|
||||||
//vmwDrawHLine(x,y,numacross,temp_byte,target);
|
//vmwDrawHLine(x,y,numacross,temp_byte,target);
|
||||||
//x+=numacross;
|
//x+=numacross;
|
||||||
|
@ -215,12 +214,10 @@ int vmwSavePCX(int x1,int y1,int xsize,int ysize,
|
||||||
vmw24BitPal *palette,
|
vmw24BitPal *palette,
|
||||||
char *FileName) {
|
char *FileName) {
|
||||||
|
|
||||||
|
|
||||||
int pcx_fd,x,y,oldcolor,color,numacross,i;
|
int pcx_fd,x,y,oldcolor,color,numacross,i;
|
||||||
unsigned char *pcx_header;
|
unsigned char *pcx_header;
|
||||||
unsigned char temp_byte;
|
unsigned char temp_byte;
|
||||||
|
|
||||||
|
|
||||||
pcx_fd=open(FileName,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
|
pcx_fd=open(FileName,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
|
||||||
if (pcx_fd<0) {
|
if (pcx_fd<0) {
|
||||||
printf("Error opening \"%s\" for writing!\n",FileName);
|
printf("Error opening \"%s\" for writing!\n",FileName);
|
||||||
|
|
|
@ -69,6 +69,10 @@ vmwSVMWGraphState *vmwSetupSVMWGraph(int display_type,int xsize,int ysize,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vmwSetupGraphics==NULL) {
|
||||||
|
fprintf(stderr,"Unsupported graphics target!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Attempt to get desired graphics state */
|
/* Attempt to get desired graphics state */
|
||||||
temp_state->output_screen=vmwSetupGraphics(&temp_state->xsize,
|
temp_state->output_screen=vmwSetupGraphics(&temp_state->xsize,
|
||||||
|
|
|
@ -107,7 +107,7 @@ int main(int argc,char **argv) {
|
||||||
int graphics_target=VMW_SDLTARGET;
|
int graphics_target=VMW_SDLTARGET;
|
||||||
FILE *fff;
|
FILE *fff;
|
||||||
char *dir_name,options_file[BUFSIZ];
|
char *dir_name,options_file[BUFSIZ];
|
||||||
vmwVisual *virtual_1,*virtual_2,*virtual_3;
|
vmwVisual *virtual_1,*virtual_3;//*virtual_2
|
||||||
|
|
||||||
tb1_state *game_state;
|
tb1_state *game_state;
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ int main(int argc,char **argv) {
|
||||||
game_state->shields=0;
|
game_state->shields=0;
|
||||||
game_state->score=0;
|
game_state->score=0;
|
||||||
game_state->virtual_1=NULL;
|
game_state->virtual_1=NULL;
|
||||||
game_state->virtual_2=NULL;
|
//game_state->virtual_2=NULL;
|
||||||
game_state->virtual_3=NULL;
|
game_state->virtual_3=NULL;
|
||||||
game_state->sound_possible=1;
|
game_state->sound_possible=1;
|
||||||
game_state->music_enabled=1;
|
game_state->music_enabled=1;
|
||||||
|
@ -310,7 +310,7 @@ int main(int argc,char **argv) {
|
||||||
|
|
||||||
/* To ease typing burden */
|
/* To ease typing burden */
|
||||||
virtual_1=game_state->virtual_1;
|
virtual_1=game_state->virtual_1;
|
||||||
virtual_2=game_state->virtual_2;
|
//virtual_2=game_state->virtual_2;
|
||||||
virtual_3=game_state->virtual_3;
|
virtual_3=game_state->virtual_3;
|
||||||
tb1_font=game_state->graph_state->default_font;
|
tb1_font=game_state->graph_state->default_font;
|
||||||
|
|
||||||
|
@ -328,6 +328,9 @@ int main(int argc,char **argv) {
|
||||||
tb1_data_file("tbomb1.tb1",
|
tb1_data_file("tbomb1.tb1",
|
||||||
game_state->path_to_data),
|
game_state->path_to_data),
|
||||||
game_state->graph_state);
|
game_state->graph_state);
|
||||||
|
if (grapherror) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Bit of a hack to load proper unfade colors */
|
/* Bit of a hack to load proper unfade colors */
|
||||||
vmwFadeToBlack(game_state->graph_state,virtual_1,1);
|
vmwFadeToBlack(game_state->graph_state,virtual_1,1);
|
||||||
|
|
|
@ -11,11 +11,11 @@ void pauseawhile(int howlong) {
|
||||||
|
|
||||||
struct timeval bob;
|
struct timeval bob;
|
||||||
struct timezone mree;
|
struct timezone mree;
|
||||||
long begin_s,begin_u;
|
long begin_s;
|
||||||
|
|
||||||
vmwClearKeyboardBuffer();
|
vmwClearKeyboardBuffer();
|
||||||
gettimeofday(&bob,&mree);
|
gettimeofday(&bob,&mree);
|
||||||
begin_s=bob.tv_sec; begin_u=bob.tv_usec;
|
begin_s=bob.tv_sec;
|
||||||
while ((bob.tv_sec-begin_s)<howlong) {
|
while ((bob.tv_sec-begin_s)<howlong) {
|
||||||
if (vmwGetInput()) return;
|
if (vmwGetInput()) return;
|
||||||
usleep(30);
|
usleep(30);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user