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...)
......
...@@ -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,20 +294,23 @@ void NewGame (int difficulty,int episode) ...@@ -293,20 +294,23 @@ 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) if (!x && !y)
return; return;
VWB_DrawPic(x,y,C_DISKLOADING1PIC+which); VWB_DrawPic(x,y,C_DISKLOADING1PIC+which);
VW_UpdateScreen(); VW_UpdateScreen();
which^=1;
which ^= 1;
} }
long DoChecksum(byte *source,unsigned size,long checksum) long DoChecksum(byte *source, unsigned size, long checksum)
{ {
unsigned i; unsigned i;
...@@ -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;
} }
//=========================================================================== //===========================================================================
...@@ -451,16 +454,17 @@ boolean LoadTheGame(int file,int x,int y) ...@@ -451,16 +454,17 @@ 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,18 +480,18 @@ boolean LoadTheGame(int file,int x,int y) ...@@ -476,18 +480,18 @@ 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)
{ {
...@@ -510,7 +514,7 @@ boolean LoadTheGame(int file,int x,int y) ...@@ -510,7 +514,7 @@ boolean LoadTheGame(int file,int x,int y)
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;
......
...@@ -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