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
dataset?
* A key to change viewsize while playing (note: max == 20, min == 5 or so...)
......
......@@ -60,7 +60,7 @@ char extension[5],
long *grstarts; /* array of offsets in vgagraph, -1 for sparse */
long *audiostarts; /* array of offsets in audio / audiot */
huffnode grhuffman[255];
huffnode grhuffman[255];
int grhandle; /* handle to VGAGRAPH */
int maphandle; /* handle to MAPTEMP / GAMEMAPS */
......
......@@ -140,7 +140,7 @@ void ReadConfig()
#if 0 /* TODO */
int file;
if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1)
if ((file = open(configname, O_BINARY | O_RDONLY)) != -1)
{
//
// valid config file
......@@ -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);
if (file != -1)
......@@ -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.weapon = gamestate.bestweapon
= gamestate.chosenweapon = wp_pistol;
......@@ -293,27 +294,30 @@ void NewGame (int difficulty,int episode)
startgame = true;
}
//===========================================================================
/* ======================================================================== */
void DiskFlopAnim(int x,int y)
void DiskFlopAnim(int x, int y)
{
static char which=0;
if (!x && !y)
return;
VWB_DrawPic(x,y,C_DISKLOADING1PIC+which);
VW_UpdateScreen();
which^=1;
static char which=0;
if (!x && !y)
return;
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++)
checksum += source[i]^source[i+1];
for (i=0;i<size-1;i++)
checksum += source[i]^source[i+1];
return checksum;
return checksum;
}
......@@ -355,17 +359,16 @@ boolean SaveTheGame(int file,int x,int y)
CA_FarWrite (file,(void *)areaconnect,sizeof(areaconnect));
CA_FarWrite (file,(void *)areabyplayer,sizeof(areabyplayer));
for (ob = player ; ob ; ob=ob->next)
{
DiskFlopAnim(x,y);
CA_FarWrite (file,(void *)ob,sizeof(*ob));
for (ob = player; ob; ob=ob->next) {
DiskFlopAnim(x,y);
CA_FarWrite(file, (void *)ob, sizeof(*ob));
}
nullobj.active = ac_badobject; // end of file marker
DiskFlopAnim(x,y);
CA_FarWrite (file,(void *)&nullobj,sizeof(nullobj));
DiskFlopAnim(x,y);
CA_FarWrite (file,(void *)&laststatobj,sizeof(laststatobj));
checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum);
......@@ -395,9 +398,9 @@ boolean SaveTheGame(int file,int x,int y)
//
// 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)
while (1)
{
DiskFlopAnim(x,y);
CA_FarRead (file,(void *)&nullobj,sizeof(nullobj));
DiskFlopAnim(x,y);
CA_FarRead(file,(void *)&nullobj,sizeof(nullobj));
if (nullobj.active == ac_badobject)
break;
GetNewActor ();
// don't copy over the links
memcpy (new,&nullobj,sizeof(nullobj)-4);
memcpy(new,&nullobj,sizeof(nullobj)-4);
}
DiskFlopAnim(x,y);
CA_FarRead (file,(void *)&laststatobj,sizeof(laststatobj));
checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum);
......@@ -476,41 +480,41 @@ boolean LoadTheGame(int file,int x,int y)
checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum);
DiskFlopAnim(x,y);
CA_FarRead (file,(void *)&pwallstate,sizeof(pwallstate));
CA_FarRead(file,(void *)&pwallstate,sizeof(pwallstate));
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);
CA_FarRead (file,(void *)&pwally,sizeof(pwally));
CA_FarRead(file,(void *)&pwally,sizeof(pwally));
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);
CA_FarRead (file,(void *)&pwallpos,sizeof(pwallpos));
CA_FarRead(file,(void *)&pwallpos,sizeof(pwallpos));
checksum = DoChecksum((byte *)&pwallpos,sizeof(pwallpos),checksum);
CA_FarRead (file,(void *)&oldchecksum,sizeof(oldchecksum));
CA_FarRead(file, (void *)&oldchecksum, sizeof(oldchecksum));
if (oldchecksum != checksum)
{
Message(STR_SAVECHT1"\n"
STR_SAVECHT2"\n"
STR_SAVECHT3"\n"
STR_SAVECHT4);
IN_ClearKeysDown();
IN_Ack();
gamestate.score = 0;
gamestate.lives = 1;
gamestate.weapon =
gamestate.chosenweapon =
gamestate.bestweapon = wp_pistol;
gamestate.ammo = 8;
Message(STR_SAVECHT1"\n"
STR_SAVECHT2"\n"
STR_SAVECHT3"\n"
STR_SAVECHT4);
IN_ClearKeysDown();
IN_Ack();
gamestate.score = 0;
gamestate.lives = 1;
gamestate.weapon =
gamestate.chosenweapon =
gamestate.bestweapon = wp_pistol;
gamestate.ammo = 8;
}
return true;
}
//===========================================================================
/* ======================================================================== */
/*
==========================
......@@ -551,7 +555,7 @@ void ShutdownId()
const float radtoint = (float)FINEANGLES/2.0f/PI;
void BuildTables (void)
void BuildTables()
{
int i;
float angle,anglestep;
......@@ -606,7 +610,7 @@ void BuildTables (void)
====================
*/
void CalcProjection (long focal)
void CalcProjection(long focal)
{
int i;
long intang;
......
......@@ -31,13 +31,13 @@ TEXT FORMATTING COMMANDS
#define WORDLIMIT 80
#define FONTHEIGHT 10
#define TOPMARGIN 16
#define BOTTOMMARGIN 32
#define BOTTOMMARGIN 32
#define LEFTMARGIN 16
#define RIGHTMARGIN 16
#define PICMARGIN 8
#define TEXTROWS ((200-TOPMARGIN-BOTTOMMARGIN)/FONTHEIGHT)
#define SPACEWIDTH 7
#define SCREENPIXWIDTH 320
#define SCREENPIXWIDTH 320
#define SCREENMID (SCREENPIXWIDTH/2)
/*
......@@ -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;
unsigned rowon;
int picx,picy,picnum,picdelay;
int picx, picy, picnum, picdelay;
boolean layoutdone;
//===========================================================================
/* ======================================================================== */
/*
=====================
......@@ -67,7 +67,7 @@ boolean layoutdone;
=====================
*/
void RipToEOL (void)
void RipToEOL()
{
while (*text++ != '\n') // scan to end of line
;
......@@ -82,10 +82,10 @@ void RipToEOL (void)
=====================
*/
int ParseNumber (void)
int ParseNumber()
{
char ch;
char num[80],*numptr;
char ch;
char num[80], *numptr;
//
// scan until a number is found
......@@ -105,7 +105,7 @@ int ParseNumber (void)
} while (ch >= '0' && ch <= '9');
*numptr = 0;
return atoi (num);
return atoi(num);
}
......@@ -121,22 +121,22 @@ int ParseNumber (void)
=====================
*/
void ParsePicCommand (void)
void ParsePicCommand()
{
picy=ParseNumber();
picx=ParseNumber();
picnum=ParseNumber();
RipToEOL ();
picy = ParseNumber();
picx = ParseNumber();
picnum = ParseNumber();
RipToEOL();
}
void ParseTimedCommand (void)
void ParseTimedCommand()
{
picy=ParseNumber();
picx=ParseNumber();
picnum=ParseNumber();
picdelay=ParseNumber();
RipToEOL ();
picy = ParseNumber();
picx = ParseNumber();
picnum = ParseNumber();
picdelay = ParseNumber();
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