%20WL_MAIN.C
//=================================================================
==========
/*
==================
=
= LoadTheGame
=
==================
*/
boolean LoadTheGame(int file,int x,int y)
{
long checksum,oldchecksum;
objtype *ob,nullobj;
checksum = 0;
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&gamestate,sizeof(gamestate));
checksum = DoChecksum((byte far
*)&gamestate,sizeof(gamestate),checksum);
DiskFlopAnim(x,y);
#ifdef SPEAR
CA_FarRead (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*20);
checksum = DoChecksum((byte far
*)&LevelRatios[0],sizeof(LRstruct)*20,checksum);
#else
CA_FarRead (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*8);
checksum = DoChecksum((byte far
*)&LevelRatios[0],sizeof(LRstruct)*8,checksum);
#endif
DiskFlopAnim(x,y);
SetupGameLevel ();
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)tilemap,sizeof(tilemap));
checksum = DoChecksum((byte far *)tilemap,sizeof(tilemap),checksum);
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)actorat,sizeof(actorat));
checksum = DoChecksum((byte far *)actorat,sizeof(actorat),checksum);
CA_FarRead (file,(void far *)areaconnect,sizeof(areaconnect));
CA_FarRead (file,(void far *)areabyplayer,sizeof(areabyplayer));
InitActorList ();
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)player,sizeof(*player));
while (1)
{
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&nullobj,sizeof(nullobj));
if (nullobj.active == ac_badobject)
break;
GetNewActor ();
// don't copy over the links
memcpy (new,&nullobj,sizeof(nullobj)-4);
}
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&laststatobj,sizeof(laststatobj));
checksum = DoChecksum((byte far
*)&laststatobj,sizeof(laststatobj),checksum);
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)statobjlist,sizeof(statobjlist));
checksum = DoChecksum((byte far
*)statobjlist,sizeof(statobjlist),checksum);
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)doorposition,sizeof(doorposition));
checksum = DoChecksum((byte far
*)doorposition,sizeof(doorposition),checksum);
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)doorobjlist,sizeof(doorobjlist));
checksum = DoChecksum((byte far
*)doorobjlist,sizeof(doorobjlist),checksum);
DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&pwallstate,sizeof(pwallstate));
checksum = DoChecksum((byte far
*)&pwallstate,sizeof(pwallstate),checksum);
CA_FarRead (file,(void far *)&pwallx,sizeof(pwallx));
checksum = DoChecksum((byte far *)&pwallx,sizeof(pwallx),checksum);
CA_FarRead (file,(void far *)&pwally,sizeof(pwally));
checksum = DoChecksum((byte far *)&pwally,sizeof(pwally),checksum);
CA_FarRead (file,(void far *)&pwalldir,sizeof(pwalldir));
checksum = DoChecksum((byte far
*)&pwalldir,sizeof(pwalldir),checksum);
CA_FarRead (file,(void far *)&pwallpos,sizeof(pwallpos));
checksum = DoChecksum((byte far
*)&pwallpos,sizeof(pwallpos),checksum);
CA_FarRead (file,(void far *)&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;
}
return true;
}
//=======================================================================
====
/*
==========================
=
= ShutdownId
=
= Shuts down all ID_?? managers
=
==========================
*/
void ShutdownId (void)
{
US_Shutdown ();
SD_Shutdown ();
PM_Shutdown ();
IN_Shutdown ();
VW_Shutdown ();
CA_Shutdown ();
MM_Shutdown ();
}
//=======================================================================
====
/*
==================
=
= BuildTables
=
= Calculates:
=
= scale projection constant
= sintable/costable overlapping fractional tables
=
==================
*/
const float radtoint = (float)FINEANGLES/2/PI;
void BuildTables (void)
{
int i;
float angle,anglestep;
double tang;
fixed value;
//
// calculate fine tangents
//
for (i=0;i>2
//
heightnumerator = (TILEGLOBAL*scale)>>6;
minheightdiv = heightnumerator/0x7fff +1;
//
// calculate the angle offset from view angle of each pixel's ray
//
for (i=0;i>= 8;
}
//=======================================================================
====
/*
===================
=
= SetupWalls
=
= Map tile values to scaled pics
=
===================
*/
void SetupWalls (void)
{
int i;
for (i=1;i