Commit d9003143 authored by Steven Fuller's avatar Steven Fuller

Now just gotta fix linking problems, then actually fix the code!

parent 65d7dc44
...@@ -101,7 +101,7 @@ static void INL_KeyService(void) ...@@ -101,7 +101,7 @@ static void INL_KeyService(void)
byte k, c, temp; byte k, c, temp;
int i; int i;
k = inportb(0x60); // Get the scan code /* k = inportb(0x60); // Get the scan code */
if (k == 0xe0) // Special key prefix if (k == 0xe0) // Special key prefix
special = true; special = true;
......
...@@ -12,6 +12,7 @@ int px,py; ...@@ -12,6 +12,7 @@ int px,py;
byte fontcolor,backcolor; byte fontcolor,backcolor;
int fontnumber; int fontnumber;
unsigned freelatch;
/* ======================================================================== */ /* ======================================================================== */
void VW_DrawPropString(char *string) void VW_DrawPropString(char *string)
......
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
#include "id_heads.h" #include "id_heads.h"
unsigned bufferofs;
unsigned displayofs;
boolean screenfaded; boolean screenfaded;
byte palette1[256][3], palette2[256][3]; byte palette1[256][3], palette2[256][3];
byte *gfxbuf;
void VL_WaitVBL(int vbls) void VL_WaitVBL(int vbls)
{ {
} }
......
...@@ -331,7 +331,7 @@ void InitAreas (void) ...@@ -331,7 +331,7 @@ void InitAreas (void)
void InitDoorList (void) void InitDoorList (void)
{ {
memset (areabyplayer,0,sizeof(areabyplayer)); memset (areabyplayer,0,sizeof(areabyplayer));
_fmemset (areaconnect,0,sizeof(areaconnect)); memset (areaconnect,0,sizeof(areaconnect));
lastdoorobj = &doorobjlist[0]; lastdoorobj = &doorobjlist[0];
doornum = 0; doornum = 0;
......
...@@ -59,8 +59,6 @@ void DebugMemory (void) ...@@ -59,8 +59,6 @@ void DebugMemory (void)
US_CPrint ("Memory Usage"); US_CPrint ("Memory Usage");
US_CPrint ("------------"); US_CPrint ("------------");
US_Print ("Total :");
US_PrintUnsigned (mminfo.mainmem/1024);
US_Print ("k\nFree :"); US_Print ("k\nFree :");
US_PrintUnsigned (MM_UnusedMemory()/1024); US_PrintUnsigned (MM_UnusedMemory()/1024);
US_Print ("k\nWith purge:"); US_Print ("k\nWith purge:");
...@@ -216,21 +214,10 @@ static char buf[10]; ...@@ -216,21 +214,10 @@ static char buf[10];
US_Print(" (Sound)"); US_Print(" (Sound)");
US_Print("\n XMS: "); US_Print("\n XMS: ");
if (page->xmsPage != -1) US_Print("No");
US_PrintUnsigned(page->xmsPage);
else
US_Print("No");
US_Print("\n Main: "); US_Print("\n Main: ");
if (page->mainPage != -1) US_Print("No");
US_PrintUnsigned(page->mainPage);
else if (page->emsPage != -1)
{
US_Print("EMS ");
US_PrintUnsigned(page->emsPage);
}
else
US_Print("No");
US_Print("\n Last hit: "); US_Print("\n Last hit: ");
US_PrintUnsigned(page->lastHit); US_PrintUnsigned(page->lastHit);
...@@ -247,7 +234,6 @@ static char buf[10]; ...@@ -247,7 +234,6 @@ static char buf[10];
// //
// draw the wall // draw the wall
// //
bufferofs += 32*SCREENWIDTH;
postx = 128; postx = 128;
postwidth = 1; postwidth = 1;
postsource = ((long)((unsigned)addr))<<16; postsource = ((long)((unsigned)addr))<<16;
...@@ -256,16 +242,13 @@ static char buf[10]; ...@@ -256,16 +242,13 @@ static char buf[10];
wallheight[postx] = 256; wallheight[postx] = 256;
FarScalePost (); FarScalePost ();
} }
bufferofs -= 32*SCREENWIDTH;
} }
else if (i < PMSoundStart) else if (i < PMSoundStart)
{ {
// //
// draw the sprite // draw the sprite
// //
bufferofs += 32*SCREENWIDTH;
SimpleScaleShape (160, i-PMSpriteStart, 64); SimpleScaleShape (160, i-PMSpriteStart, 64);
bufferofs -= 32*SCREENWIDTH;
} }
else if (i == ChunksInFile - 1) else if (i == ChunksInFile - 1)
{ {
...@@ -283,7 +266,7 @@ static char buf[10]; ...@@ -283,7 +266,7 @@ static char buf[10];
} }
else else
{ {
byte *dp = (byte *)MK_FP(addr,0); byte *dp = addr;
for (j = 0;j < NumDigi;j++) for (j = 0;j < NumDigi;j++)
{ {
k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
#define NUMBERCHARS 9 #define NUMBERCHARS 9
#define HEIGHTRATIO 0.50
//---------------- //----------------
#define EXTRAPOINTS 40000 #define EXTRAPOINTS 40000
......
...@@ -75,7 +75,6 @@ void AsmRefresh (void); ...@@ -75,7 +75,6 @@ void AsmRefresh (void);
= =
======================== ========================
*/ */
#if 0
fixed FixedByFrac (fixed a, fixed b) fixed FixedByFrac (fixed a, fixed b)
{ {
long long ra = a; long long ra = a;
...@@ -86,7 +85,6 @@ fixed FixedByFrac (fixed a, fixed b) ...@@ -86,7 +85,6 @@ fixed FixedByFrac (fixed a, fixed b)
r >>= 16; r >>= 16;
return (fixed)r; return (fixed)r;
} }
#endif
//========================================================================== //==========================================================================
......
...@@ -64,7 +64,7 @@ char configname[13]="config."; ...@@ -64,7 +64,7 @@ char configname[13]="config.";
unsigned xoffset, yoffset; unsigned xoffset, yoffset;
int _argc; int _argc;
char **argv; char **_argv;
/* /*
============================================================================= =============================================================================
...@@ -260,7 +260,7 @@ void DiskFlopAnim(int x,int y) ...@@ -260,7 +260,7 @@ void DiskFlopAnim(int x,int y)
} }
long DoChecksum(byte far *source,unsigned size,long checksum) long DoChecksum(byte *source,unsigned size,long checksum)
{ {
unsigned i; unsigned i;
...@@ -281,110 +281,75 @@ long DoChecksum(byte far *source,unsigned size,long checksum) ...@@ -281,110 +281,75 @@ long DoChecksum(byte far *source,unsigned size,long checksum)
boolean SaveTheGame(int file,int x,int y) boolean SaveTheGame(int file,int x,int y)
{ {
struct diskfree_t dfree;
long avail,size,checksum; long avail,size,checksum;
objtype *ob,nullobj; objtype *ob,nullobj;
if (_dos_getdiskfree(0,&dfree))
Quit("Error in _dos_getdiskfree call");
avail = (long)dfree.avail_clusters *
dfree.bytes_per_sector *
dfree.sectors_per_cluster;
size = 0;
for (ob = player; ob ; ob=ob->next)
size += sizeof(*ob);
size += sizeof(nullobj);
size += sizeof(gamestate) +
sizeof(LRstruct)*8 +
sizeof(tilemap) +
sizeof(actorat) +
sizeof(laststatobj) +
sizeof(statobjlist) +
sizeof(doorposition) +
sizeof(pwallstate) +
sizeof(pwallx) +
sizeof(pwally) +
sizeof(pwalldir) +
sizeof(pwallpos);
if (avail < size)
{
Message(STR_NOSPACE1"\n"
STR_NOSPACE2);
return false;
}
checksum = 0; checksum = 0;
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)&gamestate,sizeof(gamestate)); CA_FarWrite (file,(void *)&gamestate,sizeof(gamestate));
checksum = DoChecksum((byte far *)&gamestate,sizeof(gamestate),checksum); checksum = DoChecksum((byte *)&gamestate,sizeof(gamestate),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
#ifdef SPEAR #ifdef SPEAR
CA_FarWrite (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*20); CA_FarWrite (file,(void *)&LevelRatios[0],sizeof(LRstruct)*20);
checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*20,checksum); checksum = DoChecksum((byte *)&LevelRatios[0],sizeof(LRstruct)*20,checksum);
#else #else
CA_FarWrite (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*8); CA_FarWrite (file,(void *)&LevelRatios[0],sizeof(LRstruct)*8);
checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*8,checksum); checksum = DoChecksum((byte *)&LevelRatios[0],sizeof(LRstruct)*8,checksum);
#endif #endif
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)tilemap,sizeof(tilemap)); CA_FarWrite (file,(void *)tilemap,sizeof(tilemap));
checksum = DoChecksum((byte far *)tilemap,sizeof(tilemap),checksum); checksum = DoChecksum((byte *)tilemap,sizeof(tilemap),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)actorat,sizeof(actorat)); CA_FarWrite (file,(void *)actorat,sizeof(actorat));
checksum = DoChecksum((byte far *)actorat,sizeof(actorat),checksum); checksum = DoChecksum((byte *)actorat,sizeof(actorat),checksum);
CA_FarWrite (file,(void far *)areaconnect,sizeof(areaconnect)); CA_FarWrite (file,(void *)areaconnect,sizeof(areaconnect));
CA_FarWrite (file,(void far *)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 far *)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 far *)&nullobj,sizeof(nullobj)); CA_FarWrite (file,(void *)&nullobj,sizeof(nullobj));
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)&laststatobj,sizeof(laststatobj)); CA_FarWrite (file,(void *)&laststatobj,sizeof(laststatobj));
checksum = DoChecksum((byte far *)&laststatobj,sizeof(laststatobj),checksum); checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)statobjlist,sizeof(statobjlist)); CA_FarWrite (file,(void *)statobjlist,sizeof(statobjlist));
checksum = DoChecksum((byte far *)statobjlist,sizeof(statobjlist),checksum); checksum = DoChecksum((byte *)statobjlist,sizeof(statobjlist),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)doorposition,sizeof(doorposition)); CA_FarWrite (file,(void *)doorposition,sizeof(doorposition));
checksum = DoChecksum((byte far *)doorposition,sizeof(doorposition),checksum); checksum = DoChecksum((byte *)doorposition,sizeof(doorposition),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)doorobjlist,sizeof(doorobjlist)); CA_FarWrite (file,(void *)doorobjlist,sizeof(doorobjlist));
checksum = DoChecksum((byte far *)doorobjlist,sizeof(doorobjlist),checksum); checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarWrite (file,(void far *)&pwallstate,sizeof(pwallstate)); CA_FarWrite (file,(void *)&pwallstate,sizeof(pwallstate));
checksum = DoChecksum((byte far *)&pwallstate,sizeof(pwallstate),checksum); checksum = DoChecksum((byte *)&pwallstate,sizeof(pwallstate),checksum);
CA_FarWrite (file,(void far *)&pwallx,sizeof(pwallx)); CA_FarWrite (file,(void *)&pwallx,sizeof(pwallx));
checksum = DoChecksum((byte far *)&pwallx,sizeof(pwallx),checksum); checksum = DoChecksum((byte *)&pwallx,sizeof(pwallx),checksum);
CA_FarWrite (file,(void far *)&pwally,sizeof(pwally)); CA_FarWrite (file,(void *)&pwally,sizeof(pwally));
checksum = DoChecksum((byte far *)&pwally,sizeof(pwally),checksum); checksum = DoChecksum((byte *)&pwally,sizeof(pwally),checksum);
CA_FarWrite (file,(void far *)&pwalldir,sizeof(pwalldir)); CA_FarWrite (file,(void *)&pwalldir,sizeof(pwalldir));
checksum = DoChecksum((byte far *)&pwalldir,sizeof(pwalldir),checksum); checksum = DoChecksum((byte *)&pwalldir,sizeof(pwalldir),checksum);
CA_FarWrite (file,(void far *)&pwallpos,sizeof(pwallpos)); CA_FarWrite (file,(void *)&pwallpos,sizeof(pwallpos));
checksum = DoChecksum((byte far *)&pwallpos,sizeof(pwallpos),checksum); checksum = DoChecksum((byte *)&pwallpos,sizeof(pwallpos),checksum);
// //
// WRITE OUT CHECKSUM // WRITE OUT CHECKSUM
// //
CA_FarWrite (file,(void far *)&checksum,sizeof(checksum)); CA_FarWrite (file,(void *)&checksum,sizeof(checksum));
return(true); return(true);
} }
...@@ -408,41 +373,41 @@ boolean LoadTheGame(int file,int x,int y) ...@@ -408,41 +373,41 @@ boolean LoadTheGame(int file,int x,int y)
checksum = 0; checksum = 0;
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&gamestate,sizeof(gamestate)); CA_FarRead (file,(void *)&gamestate,sizeof(gamestate));
checksum = DoChecksum((byte far *)&gamestate,sizeof(gamestate),checksum); checksum = DoChecksum((byte *)&gamestate,sizeof(gamestate),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
#ifdef SPEAR #ifdef SPEAR
CA_FarRead (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*20); CA_FarRead (file,(void *)&LevelRatios[0],sizeof(LRstruct)*20);
checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*20,checksum); checksum = DoChecksum((byte *)&LevelRatios[0],sizeof(LRstruct)*20,checksum);
#else #else
CA_FarRead (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*8); CA_FarRead (file,(void *)&LevelRatios[0],sizeof(LRstruct)*8);
checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*8,checksum); checksum = DoChecksum((byte *)&LevelRatios[0],sizeof(LRstruct)*8,checksum);
#endif #endif
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
SetupGameLevel (); SetupGameLevel ();
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)tilemap,sizeof(tilemap)); CA_FarRead (file,(void *)tilemap,sizeof(tilemap));
checksum = DoChecksum((byte far *)tilemap,sizeof(tilemap),checksum); checksum = DoChecksum((byte *)tilemap,sizeof(tilemap),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)actorat,sizeof(actorat)); CA_FarRead (file,(void *)actorat,sizeof(actorat));
checksum = DoChecksum((byte far *)actorat,sizeof(actorat),checksum); checksum = DoChecksum((byte *)actorat,sizeof(actorat),checksum);
CA_FarRead (file,(void far *)areaconnect,sizeof(areaconnect)); CA_FarRead (file,(void *)areaconnect,sizeof(areaconnect));
CA_FarRead (file,(void far *)areabyplayer,sizeof(areabyplayer)); CA_FarRead (file,(void *)areabyplayer,sizeof(areabyplayer));
InitActorList (); InitActorList ();
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)player,sizeof(*player)); CA_FarRead (file,(void *)player,sizeof(*player));
while (1) while (1)
{ {
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&nullobj,sizeof(nullobj)); CA_FarRead (file,(void *)&nullobj,sizeof(nullobj));
if (nullobj.active == ac_badobject) if (nullobj.active == ac_badobject)
break; break;
GetNewActor (); GetNewActor ();
...@@ -453,32 +418,32 @@ boolean LoadTheGame(int file,int x,int y) ...@@ -453,32 +418,32 @@ boolean LoadTheGame(int file,int x,int y)
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&laststatobj,sizeof(laststatobj)); CA_FarRead (file,(void *)&laststatobj,sizeof(laststatobj));
checksum = DoChecksum((byte far *)&laststatobj,sizeof(laststatobj),checksum); checksum = DoChecksum((byte *)&laststatobj,sizeof(laststatobj),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)statobjlist,sizeof(statobjlist)); CA_FarRead (file,(void *)statobjlist,sizeof(statobjlist));
checksum = DoChecksum((byte far *)statobjlist,sizeof(statobjlist),checksum); checksum = DoChecksum((byte *)statobjlist,sizeof(statobjlist),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)doorposition,sizeof(doorposition)); CA_FarRead (file,(void *)doorposition,sizeof(doorposition));
checksum = DoChecksum((byte far *)doorposition,sizeof(doorposition),checksum); checksum = DoChecksum((byte *)doorposition,sizeof(doorposition),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)doorobjlist,sizeof(doorobjlist)); CA_FarRead (file,(void *)doorobjlist,sizeof(doorobjlist));
checksum = DoChecksum((byte far *)doorobjlist,sizeof(doorobjlist),checksum); checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum);
DiskFlopAnim(x,y); DiskFlopAnim(x,y);
CA_FarRead (file,(void far *)&pwallstate,sizeof(pwallstate)); CA_FarRead (file,(void *)&pwallstate,sizeof(pwallstate));
checksum = DoChecksum((byte far *)&pwallstate,sizeof(pwallstate),checksum); checksum = DoChecksum((byte *)&pwallstate,sizeof(pwallstate),checksum);
CA_FarRead (file,(void far *)&pwallx,sizeof(pwallx)); CA_FarRead (file,(void *)&pwallx,sizeof(pwallx));
checksum = DoChecksum((byte far *)&pwallx,sizeof(pwallx),checksum); checksum = DoChecksum((byte *)&pwallx,sizeof(pwallx),checksum);
CA_FarRead (file,(void far *)&pwally,sizeof(pwally)); CA_FarRead (file,(void *)&pwally,sizeof(pwally));
checksum = DoChecksum((byte far *)&pwally,sizeof(pwally),checksum); checksum = DoChecksum((byte *)&pwally,sizeof(pwally),checksum);
CA_FarRead (file,(void far *)&pwalldir,sizeof(pwalldir)); CA_FarRead (file,(void *)&pwalldir,sizeof(pwalldir));
checksum = DoChecksum((byte far *)&pwalldir,sizeof(pwalldir),checksum); checksum = DoChecksum((byte *)&pwalldir,sizeof(pwalldir),checksum);
CA_FarRead (file,(void far *)&pwallpos,sizeof(pwallpos)); CA_FarRead (file,(void *)&pwallpos,sizeof(pwallpos));
checksum = DoChecksum((byte far *)&pwallpos,sizeof(pwallpos),checksum); checksum = DoChecksum((byte *)&pwallpos,sizeof(pwallpos),checksum);
CA_FarRead (file,(void far *)&oldchecksum,sizeof(oldchecksum)); CA_FarRead (file,(void *)&oldchecksum,sizeof(oldchecksum));
if (oldchecksum != checksum) if (oldchecksum != checksum)
{ {
...@@ -708,7 +673,7 @@ void FinishSignon (void) ...@@ -708,7 +673,7 @@ void FinishSignon (void)
{ {
#ifndef SPEAR #ifndef SPEAR
VW_Bar (0,189,300,11,peekb(0xa000,0)); VW_Bar (0,189,300,11, *gfxbuf);
WindowX = 0; WindowX = 0;
WindowW = 320; WindowW = 320;
PrintY = 190; PrintY = 190;
...@@ -728,7 +693,7 @@ void FinishSignon (void) ...@@ -728,7 +693,7 @@ void FinishSignon (void)
IN_Ack (); IN_Ack ();
#ifndef JAPAN #ifndef JAPAN
VW_Bar (0,189,300,11,peekb(0xa000,0)); VW_Bar (0,189,300,11,*gfxbuf);
PrintY = 190; PrintY = 190;
SETFONTCOLOR(10,4); SETFONTCOLOR(10,4);
...@@ -758,7 +723,7 @@ void FinishSignon (void) ...@@ -758,7 +723,7 @@ void FinishSignon (void)
================= =================
*/ */
boolean MS_CheckParm (char far *check) boolean MS_CheckParm(char *check)
{ {
int i; int i;
char *parm; char *parm;
...@@ -771,7 +736,7 @@ boolean MS_CheckParm (char far *check) ...@@ -771,7 +736,7 @@ boolean MS_CheckParm (char far *check)
if (!*parm++) if (!*parm++)
break; // hit end of string without an alphanum break; // hit end of string without an alphanum
if ( !_fstricmp(check,parm) ) if ( !strcasecmp(check,parm) )
return true; return true;
} }
...@@ -913,7 +878,7 @@ void InitDigiMap (void) ...@@ -913,7 +878,7 @@ void InitDigiMap (void)
#ifndef SPEAR #ifndef SPEAR
CP_iteminfo MusicItems={CTL_X,CTL_Y,6,0,32}; CP_iteminfo MusicItems={CTL_X,CTL_Y,6,0,32};
CP_itemtype far MusicMenu[]= CP_itemtype MusicMenu[]=
{ {
{1,"Get Them!",0}, {1,"Get Them!",0},
{1,"Searching",0}, {1,"Searching",0},
...@@ -938,7 +903,7 @@ CP_itemtype far MusicMenu[]= ...@@ -938,7 +903,7 @@ CP_itemtype far MusicMenu[]=
}; };
#else #else
CP_iteminfo MusicItems={CTL_X,CTL_Y-20,9,0,32}; CP_iteminfo MusicItems={CTL_X,CTL_Y-20,9,0,32};
CP_itemtype far MusicMenu[]= CP_itemtype MusicMenu[]=
{ {
{1,"Funky Colonel Bill",0}, {1,"Funky Colonel Bill",0},
{1,"Death To The Nazis",0}, {1,"Death To The Nazis",0},
...@@ -991,9 +956,6 @@ void DoJukebox(void) ...@@ -991,9 +956,6 @@ void DoJukebox(void)
XTOWER2_MUS // 23 XTOWER2_MUS // 23
#endif #endif
}; };
struct dostime_t time;
IN_ClearKeysDown(); IN_ClearKeysDown();
if (!AdLibPresent && !SoundBlasterPresent) if (!AdLibPresent && !SoundBlasterPresent)
...@@ -1004,8 +966,7 @@ void DoJukebox(void) ...@@ -1004,8 +966,7 @@ void DoJukebox(void)
#ifndef SPEAR #ifndef SPEAR
#ifndef UPLOAD #ifndef UPLOAD
_dos_gettime(&time); start = (rand()%3)*6;
start = (time.hsecond%3)*6;
#else #else
start = 0; start = 0;
#endif #endif
...@@ -1086,7 +1047,6 @@ void DoJukebox(void) ...@@ -1086,7 +1047,6 @@ void DoJukebox(void)
void InitGame (void) void InitGame (void)
{ {
int i,x,y; int i,x,y;
unsigned *blockstart;
if (MS_CheckParm ("virtual")) if (MS_CheckParm ("virtual"))
virtualreality = true; virtualreality = true;
...@@ -1100,29 +1060,10 @@ void InitGame (void) ...@@ -1100,29 +1060,10 @@ void InitGame (void)
VW_Startup (); VW_Startup ();
IN_Startup (); IN_Startup ();
PM_Startup (); PM_Startup ();
PM_UnlockMainMem ();
SD_Startup (); SD_Startup ();
CA_Startup (); CA_Startup ();
US_Startup (); US_Startup ();
#ifndef SPEAR
if (mminfo.mainmem < 235000L)
#else
if (mminfo.mainmem < 257000L && !MS_CheckParm("debugmode"))
#endif
{
memptr screen;
CA_CacheGrChunk (ERRORSCREEN);
screen = grsegs[ERRORSCREEN];
ShutdownId();
movedata ((unsigned)screen,7+7*160,0xb800,0,17*160);
gotoxy (1,23);
exit(1);
}
// //
// build some tables // build some tables
// //
...@@ -1137,15 +1078,8 @@ void InitGame (void) ...@@ -1137,15 +1078,8 @@ void InitGame (void)
for (i=0;i<PORTTILESHIGH;i++) for (i=0;i<PORTTILESHIGH;i++)
uwidthtable[i] = UPDATEWIDE*i; uwidthtable[i] = UPDATEWIDE*i;
blockstart = &blockstarts[0];
for (y=0;y<UPDATEHIGH;y++)
for (x=0;x<UPDATEWIDE;x++)
*blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;
updateptr = &update[0]; updateptr = &update[0];
bufferofs = 0;
displayofs = 0;
ReadConfig (); ReadConfig ();
...@@ -1184,13 +1118,9 @@ void InitGame (void) ...@@ -1184,13 +1118,9 @@ void InitGame (void)
if (!virtualreality) if (!virtualreality)
FinishSignon(); FinishSignon();
displayofs = PAGE1START;
bufferofs = PAGE2START;
if (virtualreality) if (virtualreality)
{ {
NoWait = true; NoWait = true;
geninterrupt(0x60);
} }
} }
...@@ -1212,7 +1142,7 @@ boolean SetViewSize (unsigned width, unsigned height) ...@@ -1212,7 +1142,7 @@ boolean SetViewSize (unsigned width, unsigned height)
shootdelta = viewwidth/10; shootdelta = viewwidth/10;
screenofs = ((200-STATUSLINES-viewheight)/2*SCREENWIDTH+(320-viewwidth)/8); screenofs = ((200-STATUSLINES-viewheight)/2*SCREENWIDTH+(320-viewwidth)/8);
yoffset = (200-STATUSLINES-viewheight)/2 yoffset = (200-STATUSLINES-viewheight)/2;
xoffset = (320-viewwidth)/2; xoffset = (320-viewwidth)/2;
// //
...@@ -1280,9 +1210,6 @@ void Quit (char *error) ...@@ -1280,9 +1210,6 @@ void Quit (char *error)
unsigned finscreen; unsigned finscreen;
memptr screen; memptr screen;
if (virtualreality)
geninterrupt(0x61);
ClearMemory (); ClearMemory ();
if (!*error) if (!*error)
{ {
...@@ -1299,7 +1226,13 @@ void Quit (char *error) ...@@ -1299,7 +1226,13 @@ void Quit (char *error)
} }
ShutdownId (); ShutdownId ();
if (error && *error)
printf("Quit: %s\n", error);
else
printf("Quit: Nothing\n");
#if 0
if (error && *error) if (error && *error)
{ {
movedata ((unsigned)screen,7,0xb800,0,7*160); movedata ((unsigned)screen,7,0xb800,0,7*160);
...@@ -1316,12 +1249,8 @@ void Quit (char *error) ...@@ -1316,12 +1249,8 @@ void Quit (char *error)
movedata ((unsigned)screen,7,0xb800,0,4000); movedata ((unsigned)screen,7,0xb800,0,4000);
gotoxy(1,24); gotoxy(1,24);
#endif #endif
//asm mov bh,0
//asm mov dh,23 // row
//asm mov dl,0 // collumn
//asm mov ah,2
//asm int 0x10
} }
#endif
exit(0); exit(0);
} }
...@@ -1513,7 +1442,7 @@ void DemoLoop (void) ...@@ -1513,7 +1442,7 @@ void DemoLoop (void)
========================== ==========================
*/ */
void main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int i; int i;
...@@ -1527,5 +1456,7 @@ void main(int argc, char *argv[]) ...@@ -1527,5 +1456,7 @@ void main(int argc, char *argv[])
DemoLoop(); DemoLoop();
Quit("Demo loop exited???"); Quit("Demo loop exited???");
return 0;
} }
// WL_PLAY.C /* wl_play.c */
#include "WL_DEF.H" #include "wl_def.h"
#pragma hdrstop
/* /*
...@@ -67,7 +66,7 @@ int viewsize; ...@@ -67,7 +66,7 @@ int viewsize;
boolean buttonheld[NUMBUTTONS]; boolean buttonheld[NUMBUTTONS];
boolean demorecord,demoplayback; boolean demorecord,demoplayback;
char far *demoptr, far *lastdemoptr; char *demoptr, *lastdemoptr;
memptr demobuffer; memptr demobuffer;
// //
...@@ -374,11 +373,7 @@ void PollKeyboardMove (void) ...@@ -374,11 +373,7 @@ void PollKeyboardMove (void)
void PollMouseMove (void) void PollMouseMove (void)
{ {
int mousexmove,mouseymove; int mousexmove = 0, mouseymove = 0;
Mouse(MDelta);
mousexmove = _CX;
mouseymove = _DX;
controlx += mousexmove*10/(13-mouseadjustment); controlx += mousexmove*10/(13-mouseadjustment);
controly += mouseymove*20/(13-mouseadjustment); controly += mouseymove*20/(13-mouseadjustment);
...@@ -684,7 +679,6 @@ void CheckKeys (void) ...@@ -684,7 +679,6 @@ void CheckKeys (void)
STR_CHEATER5); STR_CHEATER5);
UNCACHEGRCHUNK(STARTFONT+1); UNCACHEGRCHUNK(STARTFONT+1);
PM_CheckMainMem ();
IN_ClearKeysDown(); IN_ClearKeysDown();
IN_Ack(); IN_Ack();
...@@ -713,7 +707,6 @@ void CheckKeys (void) ...@@ -713,7 +707,6 @@ void CheckKeys (void)
Message("Debugging keys are\nnow available!"); Message("Debugging keys are\nnow available!");
UNCACHEGRCHUNK(STARTFONT+1); UNCACHEGRCHUNK(STARTFONT+1);
PM_CheckMainMem ();
IN_ClearKeysDown(); IN_ClearKeysDown();
IN_Ack(); IN_Ack();
...@@ -739,7 +732,6 @@ void CheckKeys (void) ...@@ -739,7 +732,6 @@ void CheckKeys (void)
"that - right, Cheatmeister?!"); "that - right, Cheatmeister?!");
UNCACHEGRCHUNK(STARTFONT+1); UNCACHEGRCHUNK(STARTFONT+1);
PM_CheckMainMem ();
IN_ClearKeysDown(); IN_ClearKeysDown();
IN_Ack(); IN_Ack();
...@@ -758,8 +750,6 @@ void CheckKeys (void) ...@@ -758,8 +750,6 @@ void CheckKeys (void)
IN_ClearKeysDown (); IN_ClearKeysDown ();
SD_MusicOn(); SD_MusicOn();
Paused = false; Paused = false;
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
return; return;
} }
...@@ -783,7 +773,6 @@ void CheckKeys (void) ...@@ -783,7 +773,6 @@ void CheckKeys (void)
if (scan == sc_F9) if (scan == sc_F9)
StartMusic (); StartMusic ();
PM_CheckMainMem ();
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
IN_ClearKeysDown(); IN_ClearKeysDown();
return; return;
...@@ -808,9 +797,6 @@ void CheckKeys (void) ...@@ -808,9 +797,6 @@ void CheckKeys (void)
if (loadedgame) if (loadedgame)
playstate = ex_abort; playstate = ex_abort;
lasttimecount = TimeCount; lasttimecount = TimeCount;
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
PM_CheckMainMem ();
return; return;
} }
...@@ -823,8 +809,6 @@ void CheckKeys (void) ...@@ -823,8 +809,6 @@ void CheckKeys (void)
fontnumber=0; fontnumber=0;
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
DebugKeys(); DebugKeys();
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
lasttimecount = TimeCount; lasttimecount = TimeCount;
return; return;
} }
...@@ -1001,8 +985,8 @@ void StopMusic(void) ...@@ -1001,8 +985,8 @@ void StopMusic(void)
for (i = 0;i < LASTMUSIC;i++) for (i = 0;i < LASTMUSIC;i++)
if (audiosegs[STARTMUSIC + i]) if (audiosegs[STARTMUSIC + i])
{ {
MM_SetPurge(&((memptr)audiosegs[STARTMUSIC + i]),3); MM_SetPurge((memptr)&(audiosegs[STARTMUSIC + i]),3);
MM_SetLock(&((memptr)audiosegs[STARTMUSIC + i]),false); MM_SetLock((memptr)&(audiosegs[STARTMUSIC + i]),false);
} }
} }
...@@ -1030,13 +1014,8 @@ void StartMusic(void) ...@@ -1030,13 +1014,8 @@ void StartMusic(void)
MM_BombOnError (false); MM_BombOnError (false);
CA_CacheAudioChunk(STARTMUSIC + chunk); CA_CacheAudioChunk(STARTMUSIC + chunk);
MM_BombOnError (true); MM_BombOnError (true);
if (mmerror) MM_SetLock((memptr)&(audiosegs[STARTMUSIC + chunk]),true);
mmerror = false; SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
else
{
MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),true);
SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + chunk]);
}
} }
...@@ -1056,13 +1035,13 @@ void StartMusic(void) ...@@ -1056,13 +1035,13 @@ void StartMusic(void)
#define WHITETICS 6 #define WHITETICS 6
byte far redshifts[NUMREDSHIFTS][768]; byte redshifts[NUMREDSHIFTS][768];
byte far whiteshifts[NUMREDSHIFTS][768]; byte whiteshifts[NUMREDSHIFTS][768];
int damagecount,bonuscount; int damagecount,bonuscount;
boolean palshifted; boolean palshifted;
extern byte far gamepal; extern byte gamepal;
/* /*
===================== =====================
...@@ -1074,7 +1053,7 @@ extern byte far gamepal; ...@@ -1074,7 +1053,7 @@ extern byte far gamepal;
void InitRedShifts (void) void InitRedShifts (void)
{ {
byte far *workptr, far *baseptr; byte *workptr, *baseptr;
int i,j,delta; int i,j,delta;
...@@ -1083,7 +1062,7 @@ void InitRedShifts (void) ...@@ -1083,7 +1062,7 @@ void InitRedShifts (void)
// //
for (i=1;i<=NUMREDSHIFTS;i++) for (i=1;i<=NUMREDSHIFTS;i++)
{ {
workptr = (byte far *)&redshifts[i-1][0]; workptr = (byte *)&redshifts[i-1][0];
baseptr = &gamepal; baseptr = &gamepal;
for (j=0;j<=255;j++) for (j=0;j<=255;j++)
...@@ -1099,7 +1078,7 @@ void InitRedShifts (void) ...@@ -1099,7 +1078,7 @@ void InitRedShifts (void)
for (i=1;i<=NUMWHITESHIFTS;i++) for (i=1;i<=NUMWHITESHIFTS;i++)
{ {
workptr = (byte far *)&whiteshifts[i-1][0]; workptr = (byte *)&whiteshifts[i-1][0];
baseptr = &gamepal; baseptr = &gamepal;
for (j=0;j<=255;j++) for (j=0;j<=255;j++)
...@@ -1376,9 +1355,6 @@ void PlayLoop (void) ...@@ -1376,9 +1355,6 @@ void PlayLoop (void)
memset (buttonstate,0,sizeof(buttonstate)); memset (buttonstate,0,sizeof(buttonstate));
ClearPaletteShifts (); ClearPaletteShifts ();
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
if (demoplayback) if (demoplayback)
IN_StartAck (); IN_StartAck ();
...@@ -1386,7 +1362,7 @@ void PlayLoop (void) ...@@ -1386,7 +1362,7 @@ void PlayLoop (void)
{ {
if (virtualreality) if (virtualreality)
{ {
helmetangle = peek (0x40,0xf0); helmetangle = 0; /* TODO: virtualreality can be removed */
player->angle += helmetangle; player->angle += helmetangle;
if (player->angle >= ANGLES) if (player->angle >= ANGLES)
player->angle -= ANGLES; player->angle -= ANGLES;
......
// WL_STATE.C /* wl_state.c */
#include "WL_DEF.H" #include "wl_def.h"
#pragma hdrstop
/* /*
============================================================================= =============================================================================
......
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