Commit f1995e1d authored by Steven Fuller's avatar Steven Fuller

More cosmetic changes

parent c5dd2f30
------------- Please Disregard the Following Outdated Text: ----------------
* One binary, any game type. Store certain things in a new file for each * One binary, any game type. Store certain things in a new file for each
dataset? dataset?
* A key to change viewsize while playing (note: max == 20, min == 5 or so...) * A key to change viewsize while playing (note: max == 20, min == 5 or so...)
......
...@@ -60,7 +60,7 @@ char extension[5], ...@@ -60,7 +60,7 @@ char extension[5],
long *grstarts; /* array of offsets in vgagraph, -1 for sparse */ long *grstarts; /* array of offsets in vgagraph, -1 for sparse */
long *audiostarts; /* array of offsets in audio / audiot */ long *audiostarts; /* array of offsets in audio / audiot */
huffnode grhuffman[255]; huffnode grhuffman[255];
int grhandle; /* handle to VGAGRAPH */ int grhandle; /* handle to VGAGRAPH */
int maphandle; /* handle to MAPTEMP / GAMEMAPS */ int maphandle; /* handle to MAPTEMP / GAMEMAPS */
......
...@@ -140,7 +140,7 @@ void ReadConfig() ...@@ -140,7 +140,7 @@ void ReadConfig()
#if 0 /* TODO */ #if 0 /* TODO */
int file; int file;
if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1) if ((file = open(configname, O_BINARY | O_RDONLY)) != -1)
{ {
// //
// valid config file // valid config file
...@@ -233,11 +233,11 @@ void ReadConfig() ...@@ -233,11 +233,11 @@ void ReadConfig()
==================== ====================
*/ */
void WriteConfig(void) void WriteConfig()
{ {
int file; int file;
file = open(configname,O_CREAT | O_BINARY | O_WRONLY, file = open(configname, O_CREAT | O_BINARY | O_WRONLY,
S_IREAD | S_IWRITE | S_IFREG); S_IREAD | S_IWRITE | S_IFREG);
if (file != -1) if (file != -1)
...@@ -278,9 +278,10 @@ void WriteConfig(void) ...@@ -278,9 +278,10 @@ void WriteConfig(void)
===================== =====================
*/ */
void NewGame (int difficulty,int episode) void NewGame(int difficulty,int episode)
{ {
memset (&gamestate,0,sizeof(gamestate)); memset(&gamestate,0,sizeof(gamestate));
gamestate.difficulty = difficulty; gamestate.difficulty = difficulty;
gamestate.weapon = gamestate.bestweapon gamestate.weapon = gamestate.bestweapon
= gamestate.chosenweapon = wp_pistol; = gamestate.chosenweapon = wp_pistol;
...@@ -293,27 +294,30 @@ void NewGame (int difficulty,int episode) ...@@ -293,27 +294,30 @@ void NewGame (int difficulty,int episode)
startgame = true; startgame = true;
} }
//=========================================================================== /* ======================================================================== */
void DiskFlopAnim(int x,int y) void DiskFlopAnim(int x, int y)
{ {
static char which=0; static char which=0;
if (!x && !y)
return; if (!x && !y)
VWB_DrawPic(x,y,C_DISKLOADING1PIC+which); return;
VW_UpdateScreen();
which^=1; VWB_DrawPic(x,y,C_DISKLOADING1PIC+which);
VW_UpdateScreen();
which ^= 1;
} }
long DoChecksum(byte *source,unsigned size,long checksum) long DoChecksum(byte *source, unsigned size, long checksum)
{ {
unsigned i; unsigned i;
for (i=0;i<size-1;i++) for (i=0;i<size-1;i++)
checksum += source[i]^source[i+1]; checksum += source[i]^source[i+1];
return checksum; return checksum;
} }
...@@ -355,17 +359,16 @@ boolean SaveTheGame(int file,int x,int y) ...@@ -355,17 +359,16 @@ boolean SaveTheGame(int file,int x,int y)
CA_FarWrite (file,(void *)areaconnect,sizeof(areaconnect)); CA_FarWrite (file,(void *)areaconnect,sizeof(areaconnect));
CA_FarWrite (file,(void *)areabyplayer,sizeof(areabyplayer)); CA_FarWrite (file,(void *)areabyplayer,sizeof(areabyplayer));
for (ob = player ; ob ; ob=ob->next) for (ob = player; ob; ob=ob->next) {
{ DiskFlopAnim(x,y);
DiskFlopAnim(x,y); CA_FarWrite(file, (void *)ob, sizeof(*ob));
CA_FarWrite (file,(void *)ob,sizeof(*ob));
} }
nullobj.active = ac_badobject; // end of file marker nullobj.active = ac_badobject; // end of file marker
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void *)&nullobj,sizeof(nullobj)); CA_FarWrite (file,(void *)&nullobj,sizeof(nullobj));
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void *)&laststatobj,sizeof(laststatobj)); CA_FarWrite (file,(void *)&laststatobj,sizeof(laststatobj));
checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum); checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum);
...@@ -395,9 +398,9 @@ boolean SaveTheGame(int file,int x,int y) ...@@ -395,9 +398,9 @@ boolean SaveTheGame(int file,int x,int y)
// //
// WRITE OUT CHECKSUM // WRITE OUT CHECKSUM
// //
CA_FarWrite (file,(void *)&checksum,sizeof(checksum)); CA_FarWrite(file, (void *)&checksum, sizeof(checksum));
return(true); return true;
} }
//=========================================================================== //===========================================================================
...@@ -450,17 +453,18 @@ boolean LoadTheGame(int file,int x,int y) ...@@ -450,17 +453,18 @@ boolean LoadTheGame(int file,int x,int y)
while (1) while (1)
{ {
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void *)&nullobj,sizeof(nullobj)); CA_FarRead(file,(void *)&nullobj,sizeof(nullobj));
if (nullobj.active == ac_badobject) if (nullobj.active == ac_badobject)
break; break;
GetNewActor (); GetNewActor ();
// don't copy over the links // don't copy over the links
memcpy (new,&nullobj,sizeof(nullobj)-4); memcpy(new,&nullobj,sizeof(nullobj)-4);
} }
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void *)&laststatobj,sizeof(laststatobj)); CA_FarRead (file,(void *)&laststatobj,sizeof(laststatobj));
checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum); checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum);
...@@ -476,41 +480,41 @@ boolean LoadTheGame(int file,int x,int y) ...@@ -476,41 +480,41 @@ boolean LoadTheGame(int file,int x,int y)
checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum); checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void *)&pwallstate,sizeof(pwallstate)); CA_FarRead(file,(void *)&pwallstate,sizeof(pwallstate));
checksum = DoChecksum((byte *)&pwallstate,sizeof(pwallstate),checksum); checksum = DoChecksum((byte *)&pwallstate,sizeof(pwallstate),checksum);
CA_FarRead (file,(void *)&pwallx,sizeof(pwallx)); CA_FarRead(file,(void *)&pwallx,sizeof(pwallx));
checksum = DoChecksum((byte *)&pwallx,sizeof(pwallx),checksum); checksum = DoChecksum((byte *)&pwallx,sizeof(pwallx),checksum);
CA_FarRead (file,(void *)&pwally,sizeof(pwally)); CA_FarRead(file,(void *)&pwally,sizeof(pwally));
checksum = DoChecksum((byte *)&pwally,sizeof(pwally),checksum); checksum = DoChecksum((byte *)&pwally,sizeof(pwally),checksum);
CA_FarRead (file,(void *)&pwalldir,sizeof(pwalldir)); CA_FarRead(file,(void *)&pwalldir,sizeof(pwalldir));
checksum = DoChecksum((byte *)&pwalldir,sizeof(pwalldir),checksum); checksum = DoChecksum((byte *)&pwalldir,sizeof(pwalldir),checksum);
CA_FarRead (file,(void *)&pwallpos,sizeof(pwallpos)); CA_FarRead(file,(void *)&pwallpos,sizeof(pwallpos));
checksum = DoChecksum((byte *)&pwallpos,sizeof(pwallpos),checksum); checksum = DoChecksum((byte *)&pwallpos,sizeof(pwallpos),checksum);
CA_FarRead (file,(void *)&oldchecksum,sizeof(oldchecksum)); CA_FarRead(file, (void *)&oldchecksum, sizeof(oldchecksum));
if (oldchecksum != checksum) if (oldchecksum != checksum)
{ {
Message(STR_SAVECHT1"\n" Message(STR_SAVECHT1"\n"
STR_SAVECHT2"\n" STR_SAVECHT2"\n"
STR_SAVECHT3"\n" STR_SAVECHT3"\n"
STR_SAVECHT4); STR_SAVECHT4);
IN_ClearKeysDown(); IN_ClearKeysDown();
IN_Ack(); IN_Ack();
gamestate.score = 0; gamestate.score = 0;
gamestate.lives = 1; gamestate.lives = 1;
gamestate.weapon = gamestate.weapon =
gamestate.chosenweapon = gamestate.chosenweapon =
gamestate.bestweapon = wp_pistol; gamestate.bestweapon = wp_pistol;
gamestate.ammo = 8; gamestate.ammo = 8;
} }
return true; return true;
} }
//=========================================================================== /* ======================================================================== */
/* /*
========================== ==========================
...@@ -551,7 +555,7 @@ void ShutdownId() ...@@ -551,7 +555,7 @@ void ShutdownId()
const float radtoint = (float)FINEANGLES/2.0f/PI; const float radtoint = (float)FINEANGLES/2.0f/PI;
void BuildTables (void) void BuildTables()
{ {
int i; int i;
float angle,anglestep; float angle,anglestep;
...@@ -606,7 +610,7 @@ void BuildTables (void) ...@@ -606,7 +610,7 @@ void BuildTables (void)
==================== ====================
*/ */
void CalcProjection (long focal) void CalcProjection(long focal)
{ {
int i; int i;
long intang; long intang;
......
...@@ -31,13 +31,13 @@ TEXT FORMATTING COMMANDS ...@@ -31,13 +31,13 @@ TEXT FORMATTING COMMANDS
#define WORDLIMIT 80 #define WORDLIMIT 80
#define FONTHEIGHT 10 #define FONTHEIGHT 10
#define TOPMARGIN 16 #define TOPMARGIN 16
#define BOTTOMMARGIN 32 #define BOTTOMMARGIN 32
#define LEFTMARGIN 16 #define LEFTMARGIN 16
#define RIGHTMARGIN 16 #define RIGHTMARGIN 16
#define PICMARGIN 8 #define PICMARGIN 8
#define TEXTROWS ((200-TOPMARGIN-BOTTOMMARGIN)/FONTHEIGHT) #define TEXTROWS ((200-TOPMARGIN-BOTTOMMARGIN)/FONTHEIGHT)
#define SPACEWIDTH 7 #define SPACEWIDTH 7
#define SCREENPIXWIDTH 320 #define SCREENPIXWIDTH 320
#define SCREENMID (SCREENPIXWIDTH/2) #define SCREENMID (SCREENPIXWIDTH/2)
/* /*
...@@ -48,16 +48,16 @@ TEXT FORMATTING COMMANDS ...@@ -48,16 +48,16 @@ TEXT FORMATTING COMMANDS
============================================================================= =============================================================================
*/ */
int pagenum,numpages; int pagenum, numpages;
unsigned leftmargin[TEXTROWS],rightmargin[TEXTROWS]; unsigned leftmargin[TEXTROWS], rightmargin[TEXTROWS];
char *text; char *text;
unsigned rowon; unsigned rowon;
int picx,picy,picnum,picdelay; int picx, picy, picnum, picdelay;
boolean layoutdone; boolean layoutdone;
//=========================================================================== /* ======================================================================== */
/* /*
===================== =====================
...@@ -67,7 +67,7 @@ boolean layoutdone; ...@@ -67,7 +67,7 @@ boolean layoutdone;
===================== =====================
*/ */
void RipToEOL (void) void RipToEOL()
{ {
while (*text++ != '\n') // scan to end of line while (*text++ != '\n') // scan to end of line
; ;
...@@ -82,10 +82,10 @@ void RipToEOL (void) ...@@ -82,10 +82,10 @@ void RipToEOL (void)
===================== =====================
*/ */
int ParseNumber (void) int ParseNumber()
{ {
char ch; char ch;
char num[80],*numptr; char num[80], *numptr;
// //
// scan until a number is found // scan until a number is found
...@@ -105,7 +105,7 @@ int ParseNumber (void) ...@@ -105,7 +105,7 @@ int ParseNumber (void)
} while (ch >= '0' && ch <= '9'); } while (ch >= '0' && ch <= '9');
*numptr = 0; *numptr = 0;
return atoi (num); return atoi(num);
} }
...@@ -121,22 +121,22 @@ int ParseNumber (void) ...@@ -121,22 +121,22 @@ int ParseNumber (void)
===================== =====================
*/ */
void ParsePicCommand (void) void ParsePicCommand()
{ {
picy=ParseNumber(); picy = ParseNumber();
picx=ParseNumber(); picx = ParseNumber();
picnum=ParseNumber(); picnum = ParseNumber();
RipToEOL (); RipToEOL();
} }
void ParseTimedCommand (void) void ParseTimedCommand()
{ {
picy=ParseNumber(); picy = ParseNumber();
picx=ParseNumber(); picx = ParseNumber();
picnum=ParseNumber(); picnum = ParseNumber();
picdelay=ParseNumber(); picdelay = ParseNumber();
RipToEOL (); RipToEOL();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment