diff --git a/ack_lib/ACK3D.H b/ack_lib/ACK3D.H index cb7bfa9..3c4bf25 100644 --- a/ack_lib/ACK3D.H +++ b/ack_lib/ACK3D.H @@ -5,11 +5,17 @@ // and the ACK-3D library. The four main data structures set up in this header file // include: ACKENG, DOORS, NEWOBJECT, and OBJSEQ. +#ifndef ACK3D_H_INCLUDED +#define ACK3D_H_INCLUDED + +#include + // USED TO RID OURSELVES OF THE MANY CASTING PROBLEMS #define CAST(t,f) (t)(f) // Internal definitions used to simplify field declarations. typedef unsigned long ULONG; +typedef unsigned int UINT; typedef unsigned short USHORT; typedef unsigned char UCHAR; @@ -427,9 +433,10 @@ void AckSetPalette(UCHAR *PalBuffer); void AckSetVGAmode(void); // Places video in 80x25 color text mode 3. -void AckSetTextmode(void); +void AckSetTextMode(void); // Displays the contents of ScreenBuffer and OverlayBuffer if desired. short AckDisplayScreen(void); +#endif diff --git a/ack_lib/ACKBKGD.C b/ack_lib/ACKBKGD.C index 66e5e3e..f92a870 100644 --- a/ack_lib/ACKBKGD.C +++ b/ack_lib/ACKBKGD.C @@ -1,17 +1,3 @@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//typedef unsigned short USHORT; - #include "ack3d.h" #include "ackeng.h" diff --git a/ack_lib/ACKDATA.C b/ack_lib/ACKDATA.C index b203845..a533f21 100644 --- a/ack_lib/ACKDATA.C +++ b/ack_lib/ACKDATA.C @@ -1,11 +1,10 @@ -#include #include #include "ack3d.h" #include "ackeng.h" long scPtr; -UCHAR *bmWall; +UCHAR *bmWall = NULL; long bmDistance; long BackDropRows; @@ -16,13 +15,13 @@ long yPglobal; long xBegGlobal; long yBegGlobal; -ACKENG *aeGlobal; -USHORT *xGridGlobal; -USHORT *yGridGlobal; +ACKENG *aeGlobal = NULL; +USHORT *xGridGlobal = NULL; +USHORT *yGridGlobal = NULL; long xPglobalHI; long yPglobalHI; -ULONG *rbaTable; -short rsHandle; +ULONG *rbaTable = NULL; +int rsHandle; long LastX1; long LastY1; @@ -45,15 +44,15 @@ short ErrorCode; long xMapPosn; long yMapPosn; -USHORT *Grid; -USHORT *ObjGrid; +USHORT *Grid = NULL; +USHORT *ObjGrid = NULL; SLICE Slice[VIEW_WIDTH]; -SLICE *sPtr; +SLICE *sPtr = NULL; short TotalSpecial; short DistanceTable[MAX_DISTANCE + 1]; -long *AdjustTable; +long *AdjustTable = NULL; short xSecretmPos; short xSecretmPos1; @@ -66,18 +65,18 @@ short ySecretColumn; short TotalSecret; short ViewColumn; -long *SinTable; -long *CosTable; +long *SinTable = NULL; +long *CosTable = NULL; -long *LongTanTable; -long *LongInvTanTable; +long *LongTanTable = NULL; +long *LongInvTanTable = NULL; long InvCosTable[INT_ANGLE_360]; long InvSinTable[INT_ANGLE_360]; -long *LongCosTable; -long *ViewCosTable; +long *LongCosTable = NULL; +long *ViewCosTable = NULL; -long *xNextTable; -long *yNextTable; +long *xNextTable = NULL; +long *yNextTable = NULL; short LastFloorAngle = -1; short LastFloorX; @@ -113,12 +112,12 @@ long Floorku; long Floorkv; long Floorkdu; long Floorkdv; -UCHAR *Floorbm; -UCHAR *Floorscr; -UCHAR *FloorscrTop; -UCHAR *Floorptr2; -UCHAR *Floors1; -UCHAR *Floors2; +UCHAR *Floorbm = NULL; +UCHAR *Floorscr = NULL; +UCHAR *FloorscrTop = NULL; +UCHAR *Floorptr2 = NULL; +UCHAR *Floors1 = NULL; +UCHAR *Floors2 = NULL; long Floorht; long Floorwt; short Floorvht; @@ -132,18 +131,21 @@ short LastWallHeight; short PlayerAngle; short ViewAngle; USHORT SysFlags; -UCHAR **WallbMaps; -UCHAR *VidTop; -UCHAR *VidBottom; +UCHAR **WallbMaps = NULL; +UCHAR *VidTop = NULL; +UCHAR *VidBottom = NULL; short BotRowTable[320]; USHORT FloorMap[4096]; USHORT CeilMap[4096]; UCHAR HitMap[4096]; -UCHAR *VidSeg; +UINT *VidSeg = 0xA0000; char *scantables[96]; -UCHAR AckKeys[128]; // Buffer for keystrokes -long AckTimerCounter; +volatile UCHAR AckKeys[128]; // Buffer for keystrokes +volatile long AckTimerCounter; +volatile short AckTmCount=0; +volatile short AckTmDelay=0; +volatile UCHAR KeyPressed; // **** End of Data **** diff --git a/ack_lib/ACKDISP.C b/ack_lib/ACKDISP.C deleted file mode 100644 index a44f123..0000000 --- a/ack_lib/ACKDISP.C +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//typedef unsigned short USHORT; - -#include "ack3d.h" -#include "ackeng.h" -#include "ackext.h" - - -void AckDrawPage (void); - -//ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -// This function has been replaced by AckDisplayScreen in assembler -//ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -short xxxAckDisplayScreen (void) -{ - -/* Let the assembly routine do the hard work */ - AckDrawPage (); - - return (0); -} - - diff --git a/ack_lib/ACKDOOR.C b/ack_lib/ACKDOOR.C index 8bd1280..c6718b7 100644 --- a/ack_lib/ACKDOOR.C +++ b/ack_lib/ACKDOOR.C @@ -1,16 +1,5 @@ // This source file contains the functions needed to process doors. // (c) 1995 ACK Software (Lary Myers) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "ack3d.h" #include "ackeng.h" #include "ackext.h" diff --git a/ack_lib/ACKENG.H b/ack_lib/ACKENG.H index 72cc26b..683e03c 100644 --- a/ack_lib/ACKENG.H +++ b/ack_lib/ACKENG.H @@ -5,6 +5,9 @@ // the functions in the ACK-3D library. To locate data structures for the // ACK-3D interface, see the file ACK3D.H. +#ifndef ACKENG_H_INCLUDED +#define ACKENG_H_INCLUDED + #define TRANS_WALLS 0 #define FLOOR_ACTIVE 1 #define USE_XMS 0 // Set to 0 if XMS not desired @@ -62,4 +65,5 @@ typedef struct _slicer { struct _slicer *Next; // References the wall slice behind the current slice } SLICE; +#endif diff --git a/ack_lib/ACKEXT.H b/ack_lib/ACKEXT.H index 8e5eabe..3eb5391 100644 --- a/ack_lib/ACKEXT.H +++ b/ack_lib/ACKEXT.H @@ -1,5 +1,8 @@ /* ACK-3D ( Animation Construction Kit 3D ) */ +#ifndef ACKEXT_H_INCLUDED +#define ACKEXT_H_INCLUDED + extern UCHAR *BackArray[]; extern long xPglobal; extern long yPglobal; @@ -16,7 +19,7 @@ extern ULONG *rbaTable; extern long bmDistance; -extern short rsHandle; +extern int rsHandle; extern long LastX1; extern long LastY1; extern long iLastX; @@ -115,4 +118,11 @@ extern USHORT FloorMap[]; extern USHORT CeilMap[]; extern char *scantables[]; +extern volatile UCHAR AckKeys[]; +extern volatile UCHAR KeyPressed; +extern volatile long AckTimerCounter; +extern volatile short AckTmCount; +extern volatile short AckTmDelay; + +#endif diff --git a/ack_lib/ACKFLOOR.C b/ack_lib/ACKFLOOR.C index ff59cb9..b837038 100644 --- a/ack_lib/ACKFLOOR.C +++ b/ack_lib/ACKFLOOR.C @@ -1,24 +1,13 @@ // This source file contains the functions needed to process floors. // (c) 1995 ACK Software (Lary Myers) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "ack3d.h" #include "ackeng.h" #include "ackext.h" #define MAX_F_VIEWHALFHEIGHT 50 +void DrawBackDrop(void); + extern long FloorCosTable[]; extern short gWinStartX; extern short gWinStartY; diff --git a/ack_lib/ACKGIF.C b/ack_lib/ACKGIF.C index 3967c7f..737b798 100644 --- a/ack_lib/ACKGIF.C +++ b/ack_lib/ACKGIF.C @@ -1,13 +1,6 @@ // This source file contains the functions needed to read in GIF files. // (c) 1995 ACK Software (Lary Myers) -#include #include -#include -#include -#include -#include -#include -#include #include "ack3d.h" #include "ackeng.h" diff --git a/ack_lib/ACKIFF.C b/ack_lib/ACKIFF.C index af32354..59f97d9 100644 --- a/ack_lib/ACKIFF.C +++ b/ack_lib/ACKIFF.C @@ -9,14 +9,12 @@ // (the "old" type) are not supported. use the "new" deluxe paint .lbm type // and do not choose "old". //============================================================================= -#include #include -#include -#include -#include +#include +#include #include -#include -#include +#include +#include #include "ack3d.h" #include "ackeng.h" @@ -48,7 +46,7 @@ void CloseFile(FILE *fp) fclose(fp); if (rsHandle) { - rsHandle = _lopen(rsName,OF_READ); + rsHandle = open(rsName,O_RDONLY|O_BINARY); if (rsHandle < 1) rsHandle = 0; } @@ -57,8 +55,7 @@ if (rsHandle) unsigned char *AckReadiff(char *picname) { - FILE *pic; - short handle; + int handle; form_chunk fchunk; ChunkHeader chunk; BitMapHeader bmhd; @@ -73,19 +70,19 @@ unsigned char *AckReadiff(char *picname) rdSize = MAX_BUF_POS; if (!rsHandle) - handle = _lopen(picname,OF_READ); + handle = open(picname,O_RDONLY|O_BINARY); else { handle = rsHandle; - _llseek(rsHandle,rbaTable[(ULONG)picname],SEEK_SET); + lseek(rsHandle,rbaTable[(ULONG)picname],SEEK_SET); } - _lread(handle,&fchunk,sizeof(form_chunk)); + read(handle,&fchunk,sizeof(form_chunk)); if (fchunk.type != FORM) { if (!rsHandle) - _lclose(handle); + close(handle); ErrorCode = ERR_INVALIDFORM; return(0L); @@ -94,26 +91,26 @@ unsigned char *AckReadiff(char *picname) if (fchunk.subtype != ID_PBM) { if (!rsHandle) - _lclose(handle); + close(handle); ErrorCode = ERR_NOPBM; return(0L); } // now lets loop...Because the Chunks can be in any order! while(1) { - _lread(handle,&chunk,sizeof(ChunkHeader)); + read(handle,&chunk,sizeof(ChunkHeader)); chunk.ckSize = ByteFlipLong(chunk.ckSize); if (chunk.ckSize & 1) chunk.ckSize ++; // must be word aligned if(chunk.ckID == ID_BMHD) { - _lread(handle,&bmhd,sizeof(BitMapHeader)); + read(handle,&bmhd,sizeof(BitMapHeader)); bmhd.w=iffswab(bmhd.w); // the only things we need. bmhd.h=iffswab(bmhd.h); destx = (unsigned char *)AckMalloc((bmhd.w * bmhd.h)+4); if ( !destx ) { if (!rsHandle) - _lclose(handle); + close(handle); ErrorCode = ERR_NOMEMORY; return(0L); } @@ -132,7 +129,7 @@ unsigned char *AckReadiff(char *picname) short i; unsigned char r,g; - _lread(handle,colordat,chunk.ckSize); + read(handle,colordat,chunk.ckSize); for (i=0;i<768;i++) { r = colordat[i]; // r,g do not stand for red and green @@ -154,16 +151,16 @@ unsigned char *AckReadiff(char *picname) if (bmhd.compression) { value = 0; - _lread(handle,&value,1); + read(handle,&value,1); if (value > 0) { short len; len = value +1; sofar -= len; - if (!(_lread(handle,dest,len))) + if (!(read(handle,dest,len))) { if (!rsHandle) - _lclose(handle); + close(handle); ErrorCode = ERR_BADPICFILE; AckFree(savedestx); return(0L); @@ -177,32 +174,32 @@ unsigned char *AckReadiff(char *picname) count ++; sofar -= count; value = 0; - _lread(handle,&value,1); + read(handle,&value,1); while (--count >= 0) *dest++ = value; } } else { - _lread(handle,dest,sofar); + read(handle,dest,sofar); sofar = 0; } } if (sofar < 0) { if (!rsHandle) - _lclose(handle); + close(handle); } - _fmemcpy(destx,pplanes,bmhd.w); + memcpy(destx,pplanes,bmhd.w); destx += bmhd.w; } break; // leave if we've unpacked the BODY } - _llseek(handle,chunk.ckSize,SEEK_CUR); + lseek(handle,chunk.ckSize,SEEK_CUR); } if (!rsHandle) - _lclose(handle); + close(handle); return((char *)savedestx); } diff --git a/ack_lib/ACKINIT.C b/ack_lib/ACKINIT.C index 0ce573f..2536707 100644 --- a/ack_lib/ACKINIT.C +++ b/ack_lib/ACKINIT.C @@ -2,16 +2,12 @@ // The main function AckInitialize() must be called first before any of the // other ACK-3D functions are called. The internal functions defined in this file // perform all of the set up work of loading tables and resource files. -#include -#include #include -#include -#include +#include #include #include -#include -#include -#include +#include +#include #include "ack3d.h" #include "ackeng.h" @@ -23,7 +19,6 @@ extern char AckTimerSetup; short *LowerTable[2048]; short tmpLowerValue[400]; short LowerLen[2048]; -short OurDataSeg; char rsName[128]; @@ -65,10 +60,6 @@ short AckInitialize(ACKENG *ae) short j; UCHAR topcolor; -#ifdef __BORLANDC__ // Conditional for Borland C++ -OurDataSeg = _DS; -#endif - AckKeyboardSetup = 0; // Indicates keyboard interrupt has not been set up AckTimerSetup = 0; // Indicates timer has not been set up @@ -109,9 +100,9 @@ short AckOpenResource(char *fName) ULONG hLen; if (rsHandle) // Is a resource file currently opened? - _lclose(rsHandle); // Close it before opening a new one + close(rsHandle); // Close it before opening a new one -rsHandle = _lopen(fName,OF_READ); // Open new resource file +rsHandle = open(fName,O_RDONLY|O_BINARY); // Open new resource file if (rsHandle < 1) // Check to see if file is opened properly { rsHandle = 0; // Reset file handle @@ -123,15 +114,15 @@ if (rbaTable == NULL) rbaTable = (ULONG *)AckMalloc(hLen); // Allocate buffer for file if (rbaTable == NULL) // Was memory available? { - _lclose(rsHandle); // Close file + close(rsHandle); // Close file rsHandle = 0; // Reset file handle return(ERR_NOMEMORY); // Return error code } // Read in the file and check for byte count error -if (_lread(rsHandle,(ULONG *)rbaTable,hLen) != hLen) +if (read(rsHandle,(ULONG *)rbaTable,hLen) != hLen) { - _lclose(rsHandle); // Close file + close(rsHandle); // Close file rsHandle = 0; // Reset file handle AckFree(rbaTable); // Free up buffer return(ERR_BADFILE); // Return file error code @@ -147,7 +138,7 @@ return(0); void AckCloseResource(void) { if (rsHandle) // Check to make sure resource file is opened - _lclose(rsHandle); // Close the resource + close(rsHandle); // Close the resource if (rbaTable != NULL) // Do we need to free the memory for the file buffer? { @@ -230,14 +221,14 @@ BuildWallDstTables(); // Create the distance tables if (!rsHandle) // Check to make sure resource file is not opened { - handle = _lopen("trig.dat",OF_READ); // Open trig data file + handle = open("trig.dat",O_RDONLY|O_BINARY); // Open trig data file if (handle < 1) return(ERR_BADFILE); // File can't be opened; return error code } else { handle = rsHandle; // Get handle for resource file - _llseek(handle,rbaTable[0],SEEK_SET); + lseek(handle,rbaTable[0],SEEK_SET); } // Allocate memory for trig and coordinate tables @@ -275,21 +266,21 @@ if (LongTanTable == NULL || // Make sure memory is allocated for tab ViewCosTable == NULL) { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_NOMEMORY); // Return memory allocation error code } len = sizeof(long) * INT_ANGLE_360; // Calculate size for each trig table -_lread(handle,SinTable,len); // Read in trig data and place in appropriate tables -_lread(handle,CosTable,len); -_lread(handle,LongTanTable,len); -_lread(handle,LongInvTanTable,len); -_lread(handle,InvCosTable,len); -_lread(handle,InvSinTable,len); -_lread(handle,LongCosTable,len); +read(handle,SinTable,len); // Read in trig data and place in appropriate tables +read(handle,CosTable,len); +read(handle,LongTanTable,len); +read(handle,LongInvTanTable,len); +read(handle,InvCosTable,len); +read(handle,InvSinTable,len); +read(handle,LongCosTable,len); if (!rsHandle) - _lclose(handle); // Done reading, close trig.dat + close(handle); // Done reading, close trig.dat ca = INT_ANGLE_32; na = -1; @@ -357,72 +348,72 @@ short AckReadMapFile(ACKENG *ae,char *fName) if (!rsHandle) // Check to see if resource file is open already { // No resource file so open new one - handle = _lopen(fName,OF_READ); // Open the specified resource + handle = open(fName,O_RDONLY|O_BINARY); // Open the specified resource if (handle < 1) return(ERR_BADMAPFILE); // File was not opened; return error code } else { handle = rsHandle; // Get handle to open resource - _llseek(handle,rbaTable[(ULONG)fName],SEEK_SET); // Access opened resource file + lseek(handle,rbaTable[(ULONG)fName],SEEK_SET); // Access opened resource file } aLen = GRID_ARRAY * 2; mLen = GRID_MAX * 2; -if (_lread(handle,Grid,mLen) != mLen) // Read in grid map data +if (read(handle,Grid,mLen) != mLen) // Read in grid map data { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_READINGMAP); // Return file read error code } -if (_lread(handle,ObjGrid,mLen) != mLen) // Read in object map data +if (read(handle,ObjGrid,mLen) != mLen) // Read in object map data { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_READINGMAP); } -if (_lread(handle,ae->xGrid,aLen) != aLen) // Read in x grid data +if (read(handle,ae->xGrid,aLen) != aLen) // Read in x grid data { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_READINGMAP); } -if (_lread(handle,ae->yGrid,aLen) != aLen) // Read in y grid data +if (read(handle,ae->yGrid,aLen) != aLen) // Read in y grid data { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_READINGMAP); } -if (_lread(handle,FloorMap,mLen) != mLen) // Read in floor map data +if (read(handle,FloorMap,mLen) != mLen) // Read in floor map data { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_READINGMAP); } -if (_lread(handle,CeilMap,mLen) != mLen) // Read in ceiling map data +if (read(handle,CeilMap,mLen) != mLen) // Read in ceiling map data { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_READINGMAP); } -_lread(handle,&count,2); // Check counter for multi-height walls +read(handle,&count,2); // Check counter for multi-height walls if (count) { for (i = 0; i < count;i++) // Read in multi-height wall data { - _lread(handle,&pos,2); // Get grid position for this multi-height wall + read(handle,&pos,2); // Get grid position for this multi-height wall mPtr = (UCHAR *)AckMalloc(MAX_MULTI+1); // Allocate memory for multi-height wall data if (mPtr == NULL) { if (!rsHandle) - _lclose(handle); + close(handle); return(ERR_NOMEMORY); } @@ -430,7 +421,7 @@ if (count) ae->myGrid[pos] = mPtr; ae->mxGrid[pos+1] = mPtr; ae->myGrid[pos+GRID_WIDTH] = mPtr; - _lread(handle,buf,MAX_MULTI); + read(handle,buf,MAX_MULTI); buf[MAX_MULTI] = '\0'; len = strlen(buf); if (len > MAX_MULTI) len = MAX_MULTI; @@ -441,7 +432,7 @@ if (count) } if (!rsHandle) // Close handle - _lclose(handle); + close(handle); AckBuildGrid(ae); // Build object lists return(0); diff --git a/ack_lib/ACKLDBMP.C b/ack_lib/ACKLDBMP.C index 9eb4ffe..b6bf3fe 100644 --- a/ack_lib/ACKLDBMP.C +++ b/ack_lib/ACKLDBMP.C @@ -1,14 +1,10 @@ -#include -#include #include -#include -#include +#include #include #include -#include -#include -#include +#include +#include #include "ack3d.h" #include "ackeng.h" @@ -48,7 +44,8 @@ return(0); //ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ short AckLoadBitmap(ACKENG *ae,short BitmapNumber,short BitmapType,char *BitmapName) { - short handle,bFlag; + int handle; + short bFlag; short x,y,bLen; short sPos,dPos; UCHAR ch; @@ -103,7 +100,7 @@ if (BitmapType == TYPE_OBJECT) if (!bFlag) { - handle = _lopen(BitmapName,OF_READ); + handle = open(BitmapName,O_RDONLY|O_BINARY); if (handle < 1) { AckFree(buf); @@ -113,7 +110,7 @@ if (!bFlag) read(handle,buf,4); // Skip width and height for now read(handle,buf,BITMAP_SIZE); - _lclose(handle); + close(handle); } for (y = 0; y < BITMAP_HEIGHT; y++) diff --git a/ack_lib/ACKOBJ.C b/ack_lib/ACKOBJ.C index e8ffc80..7b4d37a 100644 --- a/ack_lib/ACKOBJ.C +++ b/ack_lib/ACKOBJ.C @@ -1,18 +1,8 @@ // This source file contains the internal functions needed to add objects // to the slice structures as a view is being built. // (c) 1995 ACK Software (Lary Myers) -#include -#include #include -#include -#include -#include -#include -#include -#include #include -#include -#include #include "ack3d.h" // Main ACK-3D internal and interface data structures #include "ackeng.h" // Internal data structures and constants diff --git a/ack_lib/ACKOVER.C b/ack_lib/ACKOVER.C index 195e515..aea3adb 100644 --- a/ack_lib/ACKOVER.C +++ b/ack_lib/ACKOVER.C @@ -1,14 +1,5 @@ - -#include -#include #include -#include -#include -#include -#include -#include #include -#include #include "ack3d.h" #include "ackeng.h" diff --git a/ack_lib/ACKPCX.C b/ack_lib/ACKPCX.C index ee8d6a3..0c9d265 100644 --- a/ack_lib/ACKPCX.C +++ b/ack_lib/ACKPCX.C @@ -1,11 +1,10 @@ // This source file contains the functions needed to read in PCX files. // (c) 1995 ACK Software (Lary Myers) -#include #include -#include -#include -#include -#include +#include +#include +#include +#include //typedef unsigned short USHORT; @@ -61,15 +60,15 @@ unsigned char *AckReadPCX(char *filename) long i; int mode=NORMAL,nbytes; char abyte,*p; - short handle; + int handle; PcxFile *pcx; pcx = &pcxGlobal; // Open the file since no resource is open. if (!rsHandle) { - handle = _lopen(filename,OF_READ); // Open the file for reading - if (handle == HFILE_ERROR) // Make sure file is opened + handle = open(filename,O_RDONLY|O_BINARY); // Open the file for reading + if (handle < 1) // Make sure file is opened { ErrorCode = ERR_BADFILE; return NULL; @@ -79,11 +78,11 @@ else // Use the resource instead { handle = rsHandle; // Use the handle to the resource file // Move to the location in the resource where the data is stored - _llseek(handle,rbaTable[(ULONG)filename],SEEK_SET); + lseek(handle,rbaTable[(ULONG)filename],SEEK_SET); } -_lread(handle,&pcx->hdr,sizeof(PcxHeader)); // Read in the header data +read(handle,&pcx->hdr,sizeof(PcxHeader)); // Read in the header data pcx->width=1+pcx->hdr.xmax-pcx->hdr.xmin; // Store width and height pcx->height=1+pcx->hdr.ymax-pcx->hdr.ymin; // Store number of bytes used for image @@ -93,7 +92,7 @@ pcx->imagebytes=(unsigned int)(pcx->width*pcx->height); if (pcx->imagebytes > PCX_MAX_SIZE) { if (!rsHandle) - _lclose(handle); + close(handle); ErrorCode = ERR_INVALIDFORM; return(NULL); } @@ -105,7 +104,7 @@ pcx->bitmap=(char*)AckMalloc(pcx->imagebytes+4); if (pcx->bitmap == NULL) // Make sure memory is allocated { if (!rsHandle) - _lclose(handle); + close(handle); ErrorCode = ERR_NOMEMORY; return(NULL); } @@ -117,11 +116,11 @@ for (i=0;iimagebytes;i++) { if (mode == NORMAL) // Normal color read mode { - _lread(handle,&abyte,1); // Read in pixel value from file + read(handle,&abyte,1); // Read in pixel value from file if ((unsigned char)abyte > 0xbf) // Value read > 191 { nbytes=abyte & 0x3f; // Get the RLE counter - _lread(handle,&abyte,1); + read(handle,&abyte,1); if (--nbytes > 0) // Is counter greater than 1? mode=RLE; // Yes, we're in RLE mode } @@ -135,18 +134,18 @@ for (i=0;iimagebytes;i++) // end of file. For a resource file we need to find the position where // the next file starts and then backup 768 bytes if (rsHandle) - _llseek(handle,rbaTable[(ULONG)(filename + 1)]-768L,SEEK_CUR); + lseek(handle,rbaTable[(ULONG)(filename + 1)]-768L,SEEK_CUR); else - _llseek(handle,-768L,SEEK_END); + lseek(handle,-768L,SEEK_END); // Store the palette data in our global colordat array -_lread(handle,colordat,768); +read(handle,colordat,768); p=colordat; for (i=0;i<768;i++) // bit shift palette *p++ = *p >> 2; if (!rsHandle) // Close pcx file if not using a resource - _lclose(handle); + close(handle); // Add in bitmap width and height to first 4 bytes of buffer p = pcx->bitmap; diff --git a/ack_lib/ACKPOV.C b/ack_lib/ACKPOV.C index b5de49f..fac495f 100644 --- a/ack_lib/ACKPOV.C +++ b/ack_lib/ACKPOV.C @@ -1,16 +1,7 @@ // Source file ACKPOV.C - Player and Object Movement routines // (c) 1995 ACK Software (Lary Myers) -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include "ack3d.h" #include "ackeng.h" diff --git a/ack_lib/ACKRAY.C b/ack_lib/ACKRAY.C index 966e421..514b8f2 100644 --- a/ack_lib/ACKRAY.C +++ b/ack_lib/ACKRAY.C @@ -3,15 +3,6 @@ // CopyRight (c) 1993 Author: Lary Myers //*************************************************************************** -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "ack3d.h" #include "ackeng.h" #include "ackext.h" @@ -38,12 +29,13 @@ for (i = 0; i < FoundObjectCount; i++) return(result); } - long x_xPos,x_yPos,x_xNext,x_yNext; - long y_xPos,y_yPos,y_xNext,y_yNext; +// long x_xPos,x_yPos,x_xNext,x_yNext; +// long y_xPos,y_yPos,y_xNext,y_yNext; //************************************************************************* // //************************************************************************* +/* void xRaySetup(void) { @@ -65,10 +57,12 @@ else x_yPos = (((long)x_xPos - (long)xPglobal) * LongTanTable[ViewAngle]) + yPglobalHI; } +*/ //************************************************************************** // //************************************************************************** +/* UINT xRayCast(void) { UINT Color; @@ -153,7 +147,7 @@ while (1) return(0); // Return that no wall was found } - +*/ //************************************************************************* // @@ -267,6 +261,7 @@ return(0); // Return that no wall was found //************************************************************************* // //************************************************************************* +/* void yRaySetup(void) { @@ -288,10 +283,12 @@ else y_xPos = (((long)y_yPos - (long)yPglobal) * LongInvTanTable[ViewAngle]) + xPglobalHI; } +*/ //************************************************************************* // //************************************************************************* +/* UINT yRayCast(void) { UINT Color; @@ -376,6 +373,7 @@ while (1) return(0); // Return here if no Y wall is found } +*/ //************************************************************************* // diff --git a/ack_lib/ACKRTN.ASM b/ack_lib/ACKRTN.ASM index 05be9b1..234fcaf 100644 --- a/ack_lib/ACKRTN.ASM +++ b/ack_lib/ACKRTN.ASM @@ -1,15 +1,14 @@ - locals - IDEAL - JUMPS - P386 - P387 ; Allow 386 processor +locals +IDEAL +JUMPS +P386 +P387 ; Allow 386 processor + +model flat - MASM - .MODEL FLAT,STDCALL ;32-bit OS/2 model - -.data +dataseg COLOR dw ? RETVAL dw ? @@ -23,10 +22,9 @@ SX dd ? - .CODE - IDEAL +codeseg - include "ackrtn.inc" +include "ackrtn.inc" SC_INDEX EQU 03C4h ; Sequencer Controller access HIGH_ADDR equ 80h ; High byte of screen offset @@ -45,113 +43,107 @@ SCREEN_WIDTH equ 320 ;# of pixels across screen SCREEN_HEIGHT equ 400 ;# of scan lines on screen - extrn _ViewAngle:word - extrn _ScreenOffset:word - extrn _xPglobal:dword - extrn _yPglobal:dword - extrn _xBegGlobal:dword - extrn _yBegGlobal:dword - extrn _aeGlobal:dword - extrn _xGridGlobal:dword - extrn _yGridGlobal:dword - extrn _xPglobalHI:dword - extrn _yPglobalHI:dword - extrn _rbaTable:dword - extrn _rsHandle:word - extrn _LastX1:dword - extrn _LastY1:dword - extrn _iLastX:dword - extrn _iLastY;dword - extrn _MaxDistance:word - extrn _ErrorCode:word - extrn _xMapPosn:dword - extrn _yMapPosn:dword - extrn _Grid:dword - extrn _ObjGrid:dword +extrn _ViewAngle:word +extrn _ScreenOffset:word +extrn _xPglobal:dword +extrn _yPglobal:dword +extrn _xBegGlobal:dword +extrn _yBegGlobal:dword +extrn _aeGlobal:dword +extrn _xGridGlobal:dword +extrn _yGridGlobal:dword +extrn _xPglobalHI:dword +extrn _yPglobalHI:dword +extrn _rbaTable:dword +extrn _rsHandle:dword +extrn _LastX1:dword +extrn _LastY1:dword +extrn _iLastX:dword +extrn _iLastY:dword +extrn _MaxDistance:word +extrn _ErrorCode:word +extrn _xMapPosn:dword +extrn _yMapPosn:dword +extrn _Grid:dword +extrn _ObjGrid:dword - extrn _xSecretmPos:word - extrn _xSecretmPos1:word - extrn _xSecretColumn:word +extrn _xSecretmPos:word +extrn _xSecretmPos1:word +extrn _xSecretColumn:word - extrn _ySecretmPos:word - extrn _ySecretmPos1:word - extrn _ySecretColumn:word +extrn _ySecretmPos:word +extrn _ySecretmPos1:word +extrn _ySecretColumn:word - extrn _TotalSecret:word - extrn _ViewColumn:word - extrn _SinTable:dword - extrn _CosTable:dword - extrn _LongTanTable:dword - extrn _LongInvTanTable:dword - extrn _InvCosTable:byte - extrn _InvSinTable:byte - extrn _LongCosTable:dword - extrn _ViewCosTable:dword - extrn _xNextTable:dword - extrn _yNextTable:dword +extrn _TotalSecret:word +extrn _ViewColumn:word +extrn _SinTable:dword +extrn _CosTable:dword +extrn _LongTanTable:dword +extrn _LongInvTanTable:dword +extrn _InvCosTable:byte +extrn _InvSinTable:byte +extrn _LongCosTable:dword +extrn _ViewCosTable:dword +extrn _xNextTable:dword +extrn _yNextTable:dword - extrn _LastMapPosn:word - extrn _LastObjectHit:word - extrn _TotalObjects:word - extrn _FoundObjectCount:word - extrn _ObjectsSeen:byte - extrn _MoveObjectCount:word - extrn _MoveObjectList:byte - extrn _ObjNumber:byte - extrn _ObjRelDist:byte - extrn _ObjColumn:byte +extrn _LastMapPosn:word +extrn _LastObjectHit:word +extrn _TotalObjects:word +extrn _FoundObjectCount:word +extrn _ObjectsSeen:byte +extrn _MoveObjectCount:word +extrn _MoveObjectList:byte +extrn _ObjNumber:byte +extrn _ObjRelDist:byte +extrn _ObjColumn:byte - extrn _x_xPos:dword - extrn _x_yPos:dword - extrn _x_xNext:dword - extrn _x_yNext:dword - extrn _y_xPos:dword - extrn _y_yPos:dword - extrn _y_xNext:dword - extrn _y_yNext:dword +extrn _x_xPos:dword +extrn _x_yPos:dword +extrn _x_xNext:dword +extrn _x_yNext:dword +extrn _y_xPos:dword +extrn _y_yPos:dword +extrn _y_xNext:dword +extrn _y_yNext:dword - extrn _Floorscr:dword - extrn _Floors1:dword - extrn _Floors2:dword - extrn _FloorscrTop:dword - extrn _Floorptr2:dword - extrn _Floorht:word - extrn _Floorwt:word +extrn _Floorscr:dword +extrn _Floors1:dword +extrn _Floors2:dword +extrn _FloorscrTop:dword +extrn _Floorptr2:dword +extrn _Floorht:word +extrn _Floorwt:word - extrn _gScrnBuffer:dword - extrn _gWinStartY:word - extrn _gWinStartX:word - extrn _gWinWidth:word - extrn _gWinHeight:word +extrn _gScrnBuffer:dword +extrn _gWinStartY:word +extrn _gWinStartX:word +extrn _gWinWidth:word +extrn _gWinHeight:word - extrn _gWinFullWidth:word - extrn _gWinDWORDS:dword - extrn _gWinStartOffset:dword +extrn _gWinFullWidth:word +extrn _gWinDWORDS:dword +extrn _gWinStartOffset:dword - extrn _VidSeg:dword - extrn _AckKeys:byte +extrn _VidSeg:dword +extrn _AckKeys:byte - extrn _OurDataSeg:word +extrn _HitMap:byte - extrn _HitMap:byte - - ACKPUBS AckInkey - ACKPUBS AckKbdInt - ACKPUBS AckPutVideo - ACKPUBS AckGetVideo - ACKPUBS AckCopyToVideo - ACKPUBS AckSetPalette - ACKPUBS AckDisplayScreen - ACKPUBS AckInitVideoSelector - ACKPUBS AckGetIntVector - ACKPUBS AckSetIntVector - ACKPUBS AckSetVGAmode - ACKPUBS AckSetTextMode - ACKPUBS AckDrawPage - ACKPUBS xRaySetup - ACKPUBS yRaySetup - ACKPUBS xRayCast - ACKPUBS yRayCast +public AckInkey_ +public AckPutVideo_ +public AckGetVideo_ +public AckCopyToVideo_ +public AckSetPalette_ +public AckDisplayScreen_ +public AckSetVGAmode_ +public AckSetTextMode_ +public AckDrawPage_ +public xRaySetup_ +public yRaySetup_ +public xRayCast_ +public yRayCast_ ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; Checks for a keystroke and returns 0 if none, else scan/char in AX @@ -159,7 +151,7 @@ SCREEN_HEIGHT equ 400 ;# of scan lines on screen ; to the AckKbdInt routine below. ; unsigned short AckInkey(void); ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckInkey +proc AckInkey_ near push ebx mov ax,0100h int 16h @@ -175,52 +167,13 @@ ackinkey_10: ret endp -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; Interrupt 9 keyboard handler. Places keys into the keyboard array so they -; can be checked by the application. -; Do NOT call this routine directly!!! -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckKbdInt - push eax - push ebx - push esi - push ds - xor ebx,ebx - in al,60h - mov bl,al - in al,61h - mov ah,al - or al,80h - out 61h,al - mov al,ah - out 61h,al - mov al,20h - out 20h,al - mov ax,cs:[word ptr _OurDataSeg] - mov ds,ax - mov esi,offset _AckKeys - mov eax,ebx - and eax,127 - mov [byte ptr esi+eax],1 - test ebx,128 - jz aki_10 - mov [byte ptr esi+eax],0 - -aki_10: - pop ds - pop esi - pop ebx - pop eax - iretd - endp - ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; Older version which now simply calls AckDrawPage. ; void AckDisplayScreen(void); ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckDisplayScreen +proc AckDisplayScreen_ near push ebp - ACKCALL AckDrawPage + call AckDrawPage_ pop ebp xor eax,eax ret @@ -229,164 +182,70 @@ ACKPROC AckDisplayScreen ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; Puts a single byte onto the video ; void AckPutVideo(unsigned int offset,unsigned char color); +; eax: offset +; edx: color ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckPutVideo - push ebp - mov ebp,esp - push es +proc AckPutVideo_ near push ebx push edi - mov bx,[word ptr _VidSeg+2] - mov es,bx - movzx edi,[word ptr _VidSeg] - add edi,[dword ptr ebp+8] - mov edx,[ebp+12] + mov edi,[_VidSeg] + add edi,eax + mov edx,edx mov [edi],dl pop edi pop ebx - pop es - pop ebp ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; Retrieves a single byte from the video ; unsigned char AckGetVideo(unsigned int offset); +; eax: offset ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckGetVideo - push ebp - mov ebp,esp - push ds +proc AckGetVideo_ near push ebx push esi - movzx esi,[word ptr _VidSeg] - add esi,[dword ptr ebp+8] - mov ax,[word ptr _VidSeg+2] - mov ds,ax + mov esi,[_VidSeg] + add esi,eax mov al,[esi] mov ah,0 pop esi pop ebx - pop ds - pop ebp ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; Copies a block from the data segment buffer to the video screen ; void AckCopyToVideo(unsigned int SrcOff,unsigned int len); +; eax: SrcOff +; edx: len ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckCopyToVideo - push ebp - mov ebp,esp - push es - push ebx +proc AckCopyToVideo_ near push ecx - push edx push esi push edi - mov esi,[ebp+8] - mov ecx,[ebp+12] - movzx edi,[word ptr _VidSeg] - mov ax,[word ptr _VidSeg+2] - mov es,ax + mov esi,eax + mov ecx,edx + mov edi,[_VidSeg] rep movsb pop edi pop esi - pop edx pop ecx - pop ebx - pop es - pop ebp - ret - endp - - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; Retrieves a selector to Video memory and stores it in the VidSeg global -; void AckInitVideoSelector(void); -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckInitVideoSelector - push ebx - push ecx - push edx - mov ax,2 ; Allocate selector for real mode address - mov bx,0A000h ; Get Video address - int 31h - mov [word ptr _VidSeg+2],ax - mov [word ptr _VidSeg],0 - pop edx - pop ecx - pop ebx ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; Retrieves a protected mode interrupt vector. -; void AckGetIntVector(int VectorNumber,int *sel,int *off); +; void AckSetPalette(UCHAR *PalBuffer) +; eax: PalBuffer ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckGetIntVector - push ebp - mov ebp,esp +proc AckSetPalette_ near push ebx push ecx push edx - push es - mov ebx,[ebp+8] - mov eax,204h - int 31h - mov ebx,[ebp+12] - mov [ebx],cx - mov ebx,[ebp+16] - mov [ebx],dx - pop es -; mov eax,ecx - pop edx - pop ecx - pop ebx - pop ebp - ret - endp - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; Sets a protected mode interrupt handler. -; void AckSetIntVector(int VecNum,unsigned int VecSel,unsigned int VecOff); -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckSetIntVector - push ebp - mov ebp,esp - push ebx - push ecx - push edx - mov ebx,[ebp+8] - mov ecx,[ebp+12] - mov edx,[ebp+16] -;; mov cx,cs - mov eax,205h - cli - int 31h - sti - pop edx - pop ecx - pop ebx - pop ebp - ret - endp - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckSetPalette - push ebp - mov ebp,esp - push ds - push ebx - push ecx - push edx - mov esi,[ebp+8] + mov esi,eax mov ebx,0 mov ecx,256 - mov dx,3c8h + mov edx,3c8h asp_loop: mov al,bl @@ -405,15 +264,13 @@ asp_loop: pop edx pop ecx pop ebx - pop ds - pop ebp ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void AckSetVGAmode(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckSetVGAmode +proc AckSetVGAmode_ near push ebx push ecx push edx @@ -485,9 +342,9 @@ ACKPROC AckSetVGAmode ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void AckSetTextMode(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckSetTextMode +proc AckSetTextMode_ near push ebx push ecx push edx @@ -500,20 +357,16 @@ ACKPROC AckSetTextMode endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void AckDrawPage(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckDrawPage +proc AckDrawPage_ near push esi push edi push ebx push ecx push edx - push es - push ds -;; mov edi,[_VidSeg] - mov edi,0 - mov di,[word ptr _VidSeg] + mov edi,[_VidSeg] mov esi,[_gScrnBuffer] cmp [word ptr _gWinFullWidth],0 jz short dp_smallscreen @@ -523,10 +376,6 @@ ACKPROC AckDrawPage add esi,eax mov ecx,[_gWinDWORDS] - mov ax,[word ptr _VidSeg+2] - mov es,ax -;; mov ds,ax - mov dx,3dah fp020: @@ -541,8 +390,6 @@ fp030: rep movsd - pop ds - pop es pop edx pop ecx pop ebx @@ -557,16 +404,13 @@ dp_smallscreen: movzx eax,[_gWinStartX] add edi,eax add esi,eax - mov dx,[_gWinHeight] + movzx edx,[_gWinHeight] inc dx movzx ebx,[_gWinWidth] + push ebp mov ebp,320 sub ebp,ebx ;width to advance pointers - mov ax,[word ptr _VidSeg+2] - mov es,ax -;; mov ds,ax - dp010: mov ecx,ebx shr ecx,1 @@ -579,8 +423,7 @@ dp010: jnz dp010 dp090: - pop ds - pop es + pop ebp pop edx pop ecx pop ebx @@ -591,9 +434,9 @@ dp090: ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void xRaySetup(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC xRaySetup +proc xRaySetup_ near push esi ; Save registers used push ebx push ecx @@ -640,9 +483,9 @@ xr_cont: endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; USHORT xRayCast(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC xRayCast +proc xRayCast_ near push esi ; Save registers used push edi push ebx @@ -781,9 +624,9 @@ xRayDone: ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void yRaySetup(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC yRaySetup +proc yRaySetup_ near push esi push ebx push ecx @@ -825,9 +668,9 @@ y_yr_cont: endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; USHORT yRayCast(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC yRayCast +proc yRayCast_ near push esi push edi push ebx diff --git a/ack_lib/ACKRTN.INC b/ack_lib/ACKRTN.INC index d7baece..f07f778 100644 --- a/ack_lib/ACKRTN.INC +++ b/ack_lib/ACKRTN.INC @@ -1,51 +1,4 @@ -_BORLANDC_ = 1 - -MACRO ACKPROC L -IFDEF _BORLANDC_ -PROC _&L NEAR -ENDIF -IFDEF _WATCOMC_ -PROC &L_ NEAR -ENDIF - ENDM - -MACRO ACKEXT L -IFDEF _BORLANDC_ - extrn _&L:NEAR -ENDIF -IFDEF _WATCOMC_ - extrn &L_:NEAR -ENDIF - ENDM - - -MACRO ACKPUBS LAB -IFDEF _BORLANDC_ - public _&LAB -ENDIF -IFDEF _WATCOMC_ - public &LAB_ -ENDIF - ENDM - -MACRO ACKCALL LAB -IFDEF _BORLANDC_ - call _&LAB -ENDIF -IFDEF _WATCOMC_ - call &LAB_ -ENDIF - ENDM - -IFDEF _BORLANDC_ -VIDSEG equ 0a0000000h -ENDIF - -IFDEF _WATCOMC_ -VIDSEG equ 0a0000h -ENDIF - ;; Equates for SLICE struct sabMap equ 0 samPtr equ 4 diff --git a/ack_lib/ACKRTN1.ASM b/ack_lib/ACKRTN1.ASM index 1a4dc50..b21c777 100644 --- a/ack_lib/ACKRTN1.ASM +++ b/ack_lib/ACKRTN1.ASM @@ -1,82 +1,79 @@ - IDEAL - JUMPS - P386 - P387 +IDEAL +JUMPS +P386 +P387 +model flat - MASM - .MODEL FLAT - - .DATA +dataseg SVTABLE dd ? ENDPOS dd ? - .CODE - IDEAL +codeseg - include "ackrtn.inc" +include "ackrtn.inc" - extrn _VidSeg:dword - extrn _Resolution:word - extrn _ScreenOffset:word - extrn _bmDistance:dword - extrn _bmWall:dword - extrn _scPtr:dword - extrn _VidTop:dword - extrn _VidBottom:dword - extrn _Floors1:dword - extrn _Floors2:dword +extrn _VidSeg:dword +extrn _Resolution:word +extrn _ScreenOffset:word +extrn _bmDistance:dword +extrn _bmWall:dword +extrn _scPtr:dword +extrn _VidTop:dword +extrn _VidBottom:dword +extrn _Floors1:dword +extrn _Floors2:dword - extrn _gPalTable:dword - extrn _gWinStartX:word - extrn _gWinStartY:word - extrn _gWinEndX:word - extrn _gWinEndY:word - extrn _gWinHeight:word - extrn _ViewHeight:word - extrn _SysFlags:word - extrn _Slice:byte - extrn _gScrnBuffer:dword - extrn _gCenterOff:word - extrn _Floorht:word - extrn _Floorscr:dword - extrn _gWinStartOffset:dword +extrn _gPalTable:dword +extrn _gWinStartX:word +extrn _gWinStartY:word +extrn _gWinEndX:word +extrn _gWinEndY:word +extrn _gWinHeight:word +extrn _ViewHeight:word +extrn _SysFlags:word +extrn _Slice:byte +extrn _gScrnBuffer:dword +extrn _gCenterOff:word +extrn _Floorht:word +extrn _Floorscr:dword +extrn _gWinStartOffset:dword - extrn _scVid:dword - extrn _scWall:dword - extrn _scPal:dword - extrn _scdst:word - extrn _scwht:word - extrn _scmulti:word - extrn _sctopht:word - extrn _scbotht:word - extrn _scsavwht:word - extrn _scmulcnt:word - extrn _scsavVid:dword - extrn _scbNum:word - extrn _scMulData:dword - extrn _scColumn:dword - extrn _WallbMaps:dword - extrn _LowerTable:dword - extrn _gBottomOff:dword +extrn _scVid:dword +extrn _scWall:dword +extrn _scPal:dword +extrn _scdst:word +extrn _scwht:word +extrn _scmulti:word +extrn _sctopht:word +extrn _scbotht:word +extrn _scsavwht:word +extrn _scmulcnt:word +extrn _scsavVid:dword +extrn _scbNum:word +extrn _scMulData:dword +extrn _scColumn:dword +extrn _WallbMaps:dword +extrn _LowerTable:dword +extrn _gBottomOff:dword - ACKEXT ShowColLow - ACKEXT ShowColMaskLow +extrn ShowColLow_:near +extrn ShowColMaskLow_:near - ACKPUBS ShowCol - ACKPUBS ShowColMask - ACKPUBS DrawWalls +public ShowCol_ +public ShowColMask_ +public DrawWalls_ align 2 ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void ShowCol(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC ShowCol +proc ShowCol_ near push ebp push esi push edi @@ -224,9 +221,9 @@ alldone: align 2 ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void ShowColMask(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC ShowColMask +proc ShowColMask_ near push ebp push esi push edi @@ -369,8 +366,9 @@ m_alldone: ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; This routine runs through the list of slices and draws the walls. +; void DrawWalls(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC DrawWalls +proc DrawWalls_ near push ebp push esi push edi @@ -537,11 +535,11 @@ stwlr050: mov esi,ebx cmp [byte ptr ebp+saType],ST_WALL ;transparent wall? je short stwlr060 ;nope, use solid slice routine - ACKCALL ShowColMaskLow + call ShowColMaskLow_ jmp short stwlr070 stwlr060: - ACKCALL ShowColLow + call ShowColLow_ stwlr070: mov ebx,esi diff --git a/ack_lib/ACKRTN2.ASM b/ack_lib/ACKRTN2.ASM deleted file mode 100644 index 7a70f74..0000000 --- a/ack_lib/ACKRTN2.ASM +++ /dev/null @@ -1,804 +0,0 @@ - - IDEAL - JUMPS - P386 - P387 ; Allow 386 processor - - - MASM - .MODEL FLAT ;32-bit OS/2 model - - IDEAL - include "ackrtn.inc" - MASM - - extrn _WallDistTable:dword - extrn _FloorMap:word - extrn _CeilMap:word - extrn _LastWallHeight:word - extrn _ViewAngle:word - extrn _ScreenOffset:word - extrn _xPglobal:dword - extrn _yPglobal:dword - extrn _xBegGlobal:dword - extrn _yBegGlobal:dword - extrn _aeGlobal:dword - extrn _xGridGlobal:dword - extrn _yGridGlobal:dword - extrn _xPglobalHI:dword - extrn _yPglobalHI:dword - extrn _rbaTable:dword - extrn _rsHandle:word - extrn _LastX1:dword - extrn _LastY1:dword - extrn _iLastX:dword - extrn _iLastY;dword - extrn _MaxDistance:word - extrn _BackArray:dword - extrn _zdTable:dword - extrn _ErrorCode:word - extrn _xMapPosn:dword - extrn _yMapPosn:dword - extrn _Grid:dword - extrn _ObjGrid:dword - extrn _WallbMaps:dword - extrn _ViewHeight:word - extrn _CeilingHeight:word - extrn _gTopColor:byte - extrn _gBottomColor:byte - extrn _PlayerAngle:word - extrn _gScrnBuffer:dword - extrn _gBkgdBuffer:dword - extrn _gCenterOff:word - extrn _gWinStartOffset:dword - extrn _gWinHeight:word - extrn _gWinEndY:dword - extrn _SysFlags:word - extrn _sPtr:dword - extrn _mxGridGlobal:dword - extrn _myGridGlobal:dword - - extrn _xSecretmPos:word - extrn _xSecretmPos1:word - extrn _xSecretColumn:word - - extrn _ySecretmPos:word - extrn _ySecretmPos1:word - extrn _ySecretColumn:word - - extrn _TotalSecret:word - extrn _ViewColumn:word - extrn _SinTable:dword - extrn _CosTable:dword - extrn _LongTanTable:dword - extrn _LongInvTanTable:dword - extrn _InvCosTable:byte - extrn _InvSinTable:byte - extrn _LongCosTable:dword - extrn _ViewCosTable:dword - extrn _xNextTable:dword - extrn _yNextTable:dword - - extrn _LastMapPosn:word - extrn _LastObjectHit:word - extrn _TotalObjects:word - extrn _FoundObjectCount:word - extrn _ObjectsSeen:byte - extrn _MoveObjectCount:word - extrn _MoveObjectList:byte - extrn _ObjNumber:byte - extrn _ObjRelDist:byte - extrn _ObjColumn:byte - - extrn _x_xPos:dword - extrn _x_yPos:dword - extrn _x_xNext:dword - extrn _x_yNext:dword - extrn _y_xPos:dword - extrn _y_yPos:dword - extrn _y_xNext:dword - extrn _y_yNext:dword - - extrn _Resolution:word - extrn _Flooru:dword - extrn _Floorv:dword - extrn _Floordu:dword - extrn _Floordv:dword - extrn _Floorkx:dword - extrn _Floorky:dword - extrn _Floorku:dword - extrn _Floorkv:dword - extrn _Floorkdu:dword - extrn _Floorkdv:dword - extrn _Floorbm:dword - extrn _Floorscr:dword - extrn _Floors1:dword - extrn _Floors2:dword - extrn _FloorscrTop:dword - extrn _Floorptr2:dword - extrn _Floorht:dword - extrn _Floorwt:dword - extrn _Floorvht:word - extrn _Flooreht:word - extrn _FloorLastbNum:dword - extrn _FloorLastbm:dword - - extrn _bmDistance:dword - extrn _scwht:word - extrn _scWall:dword - extrn _scPal:dword - extrn _scVid:dword - extrn _scantables:dword - - ACKEXT DrawBackDrop - ACKEXT ShowCol - ACKEXT ShowColMask - ACKEXT FindDoor - ACKEXT xRayCast - ACKEXT yRayCast - - ACKPUBS xxxAckDrawFloor - ACKPUBS xxxAckDrawFloorOnly - ACKPUBS xxxAckDrawCeilingOnly - - .DATA - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; Globals used by the AckDrawFloor routine -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -BCOL dd ? -HEIGHT dd ? -VA dd ? -SY dd ? -EY dd ? -BFSCRN dd ? -BCSCRN dd ? -FSCRN dd ? -CSCRN dd ? -CV dd ? -SV dd ? -BA dd ? -BA1 dd ? -ZDPTR dd ? -POS dd ? -BMPOS dd ? -MPOS dd ? -MPOSHI dd ? -SCANTBL dd ? -LINENUM dd ? -LASTDIST dd ? -;LASTX dd ? -;LASTY dd ? -LASTEBP dd ? -LASTEAX dd ? -LASTEDX dd ? -WALLDIST dd ? - - .CODE - IDEAL - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC xxxAckDrawFloor - push ebp - push esi - push edi - push ebx - push ecx - push edx - - movzx eax,[word ptr _PlayerAngle] - mov ecx,eax - sub eax,INT_ANGLE_32 - jnc short adf_20 - add eax,INT_ANGLE_360 - -adf_20: - mov ebx,640 - cdq - idiv ebx - mov [BCOL],edx - - mov eax,89 - sub ax,[word ptr _ViewHeight] - mov [HEIGHT],eax - - sub ecx,INT_ANGLE_32 - jnc short adf_30 - add ecx,INT_ANGLE_360 - -adf_30: - mov [VA],ecx - movzx eax,[word ptr _gWinHeight] - sar eax,1 - movzx ebx,[word ptr _gWinEndY] - sub ebx,eax - inc ebx - sub ebx,5 ; 6 - mov [EY],ebx - mov edi,[_gScrnBuffer] - movzx eax,[word ptr _gCenterOff] - mov ebx,eax - add eax,1920 - add eax,edi - mov [BFSCRN],eax - sub ebx,1600 ;1920 - add ebx,edi - mov [BCSCRN],ebx - mov ebp,0 - mov [LINENUM],ebp - mov [LASTDIST],ebp - mov ebx,[dword ptr _scantables] - mov [SCANTBL],ebx - mov ebx,[VA] - -adf_loop: - mov eax,[_CosTable] - shl ebx,2 - mov eax,[eax+ebx] - mov [CV],eax - mov eax,[_SinTable] - mov eax,[eax+ebx] - mov [SV],eax - - mov eax,[dword ptr _WallDistTable+ebp*4] - mov [WALLDIST],eax - - mov eax,[BCSCRN] - mov [CSCRN],eax - - mov ecx,[EY] - mov ebx,[BCOL] - mov eax,[_BackArray+ebx*4] - add eax,ecx - mov [BA],eax - inc ebx - cmp ebx,640 - jb short adf_l10 - sub ebx,ebx - -adf_l10: - mov eax,[_BackArray+ebx*4] - add eax,ecx - mov [BA1],eax - inc ebx - cmp ebx,640 - jb short adf_l20 - sub ebx,ebx - -adf_l20: - mov [BCOL],ebx - lea esi,[offset _zdTable] - mov ecx,[EY] ;Number of rows to draw - imul eax,ebp,800 - - add esi,eax - add esi,24 ;ebx - mov edi,[BFSCRN] - push ebp - -adf_yloop: - mov edx,[esi] - lea esi,[esi+4] - cmp edx,[WALLDIST] - jb short adf_distokay - lea edi,[edi+320] - jmp adf_ycont - -adf_distokay: - cmp edx,[LASTDIST] - jne short adf_newdist -; mov eax,[LASTX] -; mov ebx,[LASTY] - mov ebp,[LASTEBP] - mov eax,[LASTEAX] - mov edx,[LASTEDX] - jmp short adf_samedist - -adf_newdist: - mov [LASTDIST],edx - mov eax,[CV] - mov ebx,[SV] - imul eax,edx - imul ebx,edx - sar eax,16 - sar ebx,16 - mov edx,[_xPglobal] - add eax,edx - mov edx,[_yPglobal] - add ebx,edx -; mov [LASTX],eax -; mov [LASTY],ebx - -;adf_samedist: - mov edx,ebx - and edx,0FC0h - mov ebp,eax - sar ebp,6 - add ebp,edx ;Pos within floor and ceiling maps - - and ebx,63 - shl ebx,6 - and eax,63 - add eax,ebx ;bitmap position - -;; mov ebx,0 - - shl ebp,1 - mov [LASTEBP],ebp - mov [LASTEAX],eax - - movzx ebx,[word ptr _FloorMap+ebp] - mov edx,[_WallbMaps] - mov edx,[edx+ebx*4] - movzx edx,[byte ptr edx+eax] - mov ebx,[SCANTBL] - mov dl,[ebx+edx] - mov dh,dl - mov [LASTEDX],edx - -adf_samedist: - mov [edi],dx - lea edi,[edi+320] - - movzx ebx,[word ptr _CeilMap+ebp] - mov ebp,[CSCRN] - test bx,bx - jz short adf_yback - - mov edx,[_WallbMaps] - mov edx,[edx+ebx*4] - movzx eax,[byte ptr edx+eax] - mov edx,[SCANTBL] - mov al,[edx+eax] - mov ah,al - mov [ebp],ax - - mov eax,[LINENUM] - add eax,4 - mov [LINENUM],eax - mov eax,[_scantables+eax] - mov [SCANTBL],eax - lea ebp,[ebp-320] - mov [CSCRN],ebp - dec [dword ptr BA] - dec [dword ptr BA1] - dec ecx - jnz adf_yloop - - jmp short adf_ynext - -adf_yback: - mov eax,[BA] - mov dl,[eax] - mov eax,[BA1] - mov dh,[eax] - mov [ebp],dx - -adf_ycont: - mov eax,[LINENUM] - add eax,4 - mov [LINENUM],eax - mov eax,[_scantables+eax] - mov [SCANTBL],eax - sub [dword ptr CSCRN],320 - dec [dword ptr BA] - dec [dword ptr BA1] - dec ecx - jnz adf_yloop - -adf_ynext: - mov [dword ptr LINENUM],0 - mov eax,[dword ptr _scantables] - mov [SCANTBL],eax - mov ebx,[VA] - lea ebx,[ebx+2] - cmp ebx,INT_ANGLE_360 - jb short adf_l90 - sub ebx,INT_ANGLE_360 - -adf_l90: - mov [VA],ebx ;Note: EBX is used for VA at top of loop! - add [dword ptr BFSCRN],2 - add [dword ptr BCSCRN],2 - pop ebp - lea ebp,[ebp+2] - cmp ebp,320 - jb adf_loop - - -adf_exit: - pop edx - pop ecx - pop ebx - pop edi - pop esi - pop ebp - ret - endp - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC xxxAckDrawFloorOnly - push ebp - push esi - push edi - push ebx - push ecx - push edx - - movzx eax,[word ptr _PlayerAngle] - mov ecx,eax - sub eax,INT_ANGLE_32 - jnc short adfo_20 - add eax,INT_ANGLE_360 - -adfo_20: - mov ebx,640 - cdq - idiv ebx - mov [BCOL],edx - - mov eax,89 - sub ax,[word ptr _ViewHeight] - mov [HEIGHT],eax - - sub ecx,INT_ANGLE_32 - jnc short adfo_30 - add ecx,INT_ANGLE_360 - -adfo_30: - mov [VA],ecx - movzx eax,[word ptr _gWinHeight] - sar eax,1 - movzx ebx,[word ptr _gWinEndY] - sub ebx,eax - inc ebx - sub ebx,5 ; 6 - mov [EY],ebx - mov edi,[_gScrnBuffer] - movzx eax,[word ptr _gCenterOff] - mov ebx,eax - add eax,1920 - add eax,edi - mov [BFSCRN],eax - sub ebx,1600 ;1920 - add ebx,edi - mov [BCSCRN],ebx - mov ebp,0 - mov [LINENUM],ebp - mov ebx,[dword ptr _scantables] - mov [SCANTBL],ebx - mov ebx,[VA] - -adfo_loop: - mov eax,[_CosTable] - shl ebx,2 - mov eax,[eax+ebx] - mov [CV],eax - mov eax,[_SinTable] - mov eax,[eax+ebx] - mov [SV],eax - - mov eax,[BCSCRN] - mov [CSCRN],eax - - mov ecx,[EY] - mov ebx,[BCOL] - mov eax,[_BackArray+ebx*4] - add eax,ecx - mov [BA],eax - inc ebx - cmp ebx,640 - jb short adfo_l10 - sub ebx,ebx - -adfo_l10: - mov eax,[_BackArray+ebx*4] - add eax,ecx - mov [BA1],eax - inc ebx - cmp ebx,640 - jb short adfo_l20 - sub ebx,ebx - -adfo_l20: - mov [BCOL],ebx - lea esi,[offset _zdTable] - mov ecx,[EY] ;Number of rows to draw - imul eax,ebp,800 - - add esi,eax - add esi,24 ;ebx - mov edi,[BFSCRN] - push ebp - -adfo_yloop: - mov edx,[esi] - lea esi,[esi+4] - mov eax,[CV] - mov ebx,[SV] - imul eax,edx - imul ebx,edx - sar eax,16 - sar ebx,16 - mov edx,[_xPglobal] - add eax,edx - mov edx,[_yPglobal] - add ebx,edx - - mov edx,ebx - and edx,0FC0h - mov ebp,eax - sar ebp,6 - add ebp,edx ;Pos within floor and ceiling maps - - and ebx,63 - shl ebx,6 - and eax,63 - add eax,ebx ;bitmap position - - mov ebx,0 - - shl ebp,1 - mov bx,[word ptr _FloorMap+ebp] - mov edx,[_WallbMaps] - mov edx,[edx+ebx*4] - movzx edx,[byte ptr edx+eax] - mov ebx,[SCANTBL] - mov dl,[ebx+edx] - mov dh,dl - mov [edi],dx - lea edi,[edi+320] - - mov eax,[BA] - mov dl,[eax] - mov eax,[BA1] - mov dh,[eax] - mov ebp,[CSCRN] - mov [ebp],dx - -adfo_ycont: - lea ebp,[ebp-320] - mov [CSCRN],ebp - mov eax,[LINENUM] - add eax,4 - mov [LINENUM],eax - mov eax,[_scantables+eax] - mov [SCANTBL],eax - dec [dword ptr BA] - dec [dword ptr BA1] - dec ecx - jnz adfo_yloop - -adfo_ynext: - mov [dword ptr LINENUM],0 - mov eax,[dword ptr _scantables] - mov [SCANTBL],eax - mov ebx,[VA] - lea ebx,[ebx+2] - cmp ebx,INT_ANGLE_360 - jb short adfo_l90 - sub ebx,INT_ANGLE_360 - -adfo_l90: - mov [VA],ebx ;Note: EBX is used for VA at top of loop! - add [dword ptr BFSCRN],2 - add [dword ptr BCSCRN],2 - pop ebp - lea ebp,[ebp+2] - cmp ebp,320 - jb adfo_loop - -adfo_exit: - pop edx - pop ecx - pop ebx - pop edi - pop esi - pop ebp - ret - endp - - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC xxxAckDrawCeilingOnly - push ebp - push esi - push edi - push ebx - push ecx - push edx - - movzx eax,[word ptr _PlayerAngle] - mov ecx,eax - sub eax,INT_ANGLE_32 - jnc short adco_20 - add eax,INT_ANGLE_360 - -adco_20: - mov ebx,640 - cdq - idiv ebx - mov [BCOL],edx - - mov eax,89 - sub ax,[word ptr _ViewHeight] - mov [HEIGHT],eax - - sub ecx,INT_ANGLE_32 - jnc short adco_30 - add ecx,INT_ANGLE_360 - -adco_30: - mov [VA],ecx - movzx eax,[word ptr _gWinHeight] - sar eax,1 - movzx ebx,[word ptr _gWinEndY] - sub ebx,eax - inc ebx - sub ebx,5 ; 6 - mov [EY],ebx - mov edi,[_gScrnBuffer] - movzx eax,[word ptr _gCenterOff] - mov ebx,eax - sub ebx,1600 ;1920 - add ebx,edi - mov [BCSCRN],ebx - mov ebp,0 - mov [LINENUM],ebp - mov ebx,[dword ptr _scantables] - mov [SCANTBL],ebx - mov ebx,[VA] - -adco_loop: - mov eax,[_CosTable] - shl ebx,2 - mov eax,[eax+ebx] - mov [CV],eax - mov eax,[_SinTable] - mov eax,[eax+ebx] - mov [SV],eax - - mov eax,[BCSCRN] - mov [CSCRN],eax - - mov ecx,[EY] - mov ebx,[BCOL] - mov eax,[_BackArray+ebx*4] - add eax,ecx - mov [BA],eax - inc ebx - cmp ebx,640 - jb short adco_l10 - sub ebx,ebx - -adco_l10: - mov eax,[_BackArray+ebx*4] - add eax,ecx - mov [BA1],eax - inc ebx - cmp ebx,640 - jb short adco_l20 - sub ebx,ebx - -adco_l20: - mov [BCOL],ebx - lea esi,[offset _zdTable] - mov ecx,[EY] ;Number of rows to draw - imul eax,ebp,800 - - add esi,eax - add esi,24 ;ebx - push ebp - -adco_yloop: - mov edx,[esi] - lea esi,[esi+4] - mov eax,[CV] - mov ebx,[SV] - imul eax,edx - imul ebx,edx - sar eax,16 - sar ebx,16 - mov edx,[_xPglobal] - add eax,edx - mov edx,[_yPglobal] - add ebx,edx - - mov edx,ebx - and edx,0FC0h - mov ebp,eax - sar ebp,6 - add ebp,edx ;Pos within floor and ceiling maps - - and ebx,63 - shl ebx,6 - and eax,63 - add eax,ebx ;bitmap position - - mov ebx,0 - - shl ebp,1 - movzx ebx,[word ptr _CeilMap+ebp] - mov ebp,[CSCRN] - test bx,bx - jz short adco_yback - - mov edx,[_WallbMaps] - mov edx,[edx+ebx*4] - movzx eax,[byte ptr edx+eax] - mov edx,[SCANTBL] - mov al,[edx+eax] - mov ah,al - mov [ebp],ax - - mov eax,[LINENUM] - add eax,4 - mov [LINENUM],eax - mov eax,[_scantables+eax] - mov [SCANTBL],eax - lea ebp,[ebp-320] - mov [CSCRN],ebp - dec [dword ptr BA] - dec [dword ptr BA1] - dec ecx - jnz adco_yloop - - jmp short adco_ynext - -adco_yback: - mov eax,[BA] - mov dl,[eax] - mov eax,[BA1] - mov dh,[eax] - mov [ebp],dx - -adco_ycont: - mov eax,[LINENUM] - add eax,4 - mov [LINENUM],eax - mov eax,[_scantables+eax] - mov [SCANTBL],eax - sub [dword ptr CSCRN],320 - dec [dword ptr BA] - dec [dword ptr BA1] - dec ecx - jnz adco_yloop - -adco_ynext: - mov [dword ptr LINENUM],0 - mov eax,[dword ptr _scantables] - mov [SCANTBL],eax - mov ebx,[VA] - lea ebx,[ebx+2] - cmp ebx,INT_ANGLE_360 - jb short adco_l90 - sub ebx,INT_ANGLE_360 - -adco_l90: - mov [VA],ebx ;Note: EBX is used for VA at top of loop! - add [dword ptr BCSCRN],2 - pop ebp - lea ebp,[ebp+2] - cmp ebp,320 - jb adco_loop - - -adco_exit: - pop edx - pop ecx - pop ebx - pop edi - pop esi - pop ebp - ret - endp - - - end - diff --git a/ack_lib/ACKRTN3.ASM b/ack_lib/ACKRTN3.ASM index e6a538b..0c0e37c 100644 --- a/ack_lib/ACKRTN3.ASM +++ b/ack_lib/ACKRTN3.ASM @@ -1,164 +1,162 @@ - IDEAL - JUMPS - P386 - P387 ; Allow 386 processor +IDEAL +JUMPS +P386 +P387 ; Allow 386 processor + +model flat + +codeseg + +include "ackrtn.inc" + +extrn _gMultiWalls:word +extrn _WallDistTable:dword +extrn _BackDropRows:dword +extrn _FloorCeilRtn:dword +extrn _Resolution:word +extrn _ScreenOffset:word +extrn _bmDistance:dword +extrn _bmWall:dword +extrn _scPtr:dword +extrn _VidTop:dword +extrn _VidBottom:dword +extrn _Floors1:dword +extrn _Floors2:dword +extrn _PlayerAngle:word +extrn _BackArray:dword +extrn _gWinStartX:word +extrn _gWinStartY:word +extrn _gWinEndX:word +extrn _gWinEndY:word +extrn _gWinHeight:word +extrn _gWinWidth:word +extrn _gCenterRow:word +extrn _gCenterOff:word + +extrn _scVid:dword +extrn _scWall:dword +extrn _scPal:dword +extrn _scdst:word +extrn _scwht:word +extrn _scmulti:word +extrn _sctopht:word +extrn _scbotht:word +extrn _scsavwht:word +extrn _scmulcnt:word +extrn _scsavVid:dword +extrn _scbNum:word +extrn _scMulData:dword +extrn _scColumn:dword +extrn _WallbMaps:dword + +extrn _FloorMap:word +extrn _CeilMap:word +extrn _LastWallHeight:word +extrn _ViewAngle:word +extrn _ScreenOffset:word +extrn _xPglobal:dword +extrn _yPglobal:dword +extrn _xBegGlobal:dword +extrn _yBegGlobal:dword +extrn _aeGlobal:dword +extrn _xGridGlobal:dword +extrn _yGridGlobal:dword +extrn _xPglobalHI:dword +extrn _yPglobalHI:dword +extrn _rbaTable:dword +extrn _rsHandle:dword +extrn _LastX1:dword +extrn _LastY1:dword +extrn _iLastX:dword +extrn _iLastY:dword +extrn _MaxDistance:word +extrn _ErrorCode:word +extrn _xMapPosn:dword +extrn _yMapPosn:dword +extrn _Grid:dword +extrn _ObjGrid:dword +extrn _ViewHeight:word +extrn _CeilingHeight:word +extrn _gTopColor:byte +extrn _gBottomColor:byte +extrn _PlayerAngle:word +extrn _gScrnBuffer:dword +extrn _gBkgdBuffer:dword +extrn _gCenterOff:word +extrn _gWinHeight:word +extrn _SysFlags:word - MASM - .MODEL FLAT ;32-bit OS/2 model - .CODE - IDEAL +extrn _xSecretmPos:word +extrn _xSecretmPos1:word +extrn _xSecretColumn:word - include "ackrtn.inc" +extrn _ySecretmPos:word +extrn _ySecretmPos1:word +extrn _ySecretColumn:word - extrn _gMultiWalls:word - extrn _WallDistTable:dword - extrn _BackDropRows:dword - extrn _FloorCeilRtn:dword - extrn _Resolution:word - extrn _ScreenOffset:word - extrn _bmDistance:dword - extrn _bmWall:dword - extrn _scPtr:dword - extrn _VidTop:dword - extrn _VidBottom:dword - extrn _Floors1:dword - extrn _Floors2:dword - extrn _PlayerAngle:word - extrn _BackArray:dword - extrn _gWinStartX:word - extrn _gWinStartY:word - extrn _gWinEndX:word - extrn _gWinEndY:word - extrn _gWinHeight:word - extrn _gWinWidth:word - extrn _gCenterRow:word - extrn _gCenterOff:word +extrn _TotalSecret:word +extrn _ViewColumn:word +extrn _SinTable:dword +extrn _CosTable:dword +extrn _LongTanTable:dword +extrn _LongInvTanTable:dword +extrn _InvCosTable:byte +extrn _InvSinTable:byte +extrn _LongCosTable:dword +extrn _ViewCosTable:dword +extrn _xNextTable:dword +extrn _yNextTable:dword - extrn _scVid:dword - extrn _scWall:dword - extrn _scPal:dword - extrn _scdst:word - extrn _scwht:word - extrn _scmulti:word - extrn _sctopht:word - extrn _scbotht:word - extrn _scsavwht:word - extrn _scmulcnt:word - extrn _scsavVid:dword - extrn _scbNum:word - extrn _scMulData:dword - extrn _scColumn:dword - extrn _WallbMaps:dword +extrn _LastMapPosn:word +extrn _LastObjectHit:word +extrn _TotalObjects:word +extrn _FoundObjectCount:word +extrn _ObjectsSeen:byte +extrn _MoveObjectCount:word +extrn _MoveObjectList:byte +extrn _ObjNumber:byte +extrn _ObjRelDist:byte +extrn _ObjColumn:byte - extrn _FloorMap:word - extrn _CeilMap:word - extrn _LastWallHeight:word - extrn _ViewAngle:word - extrn _ScreenOffset:word - extrn _xPglobal:dword - extrn _yPglobal:dword - extrn _xBegGlobal:dword - extrn _yBegGlobal:dword - extrn _aeGlobal:dword - extrn _xGridGlobal:dword - extrn _yGridGlobal:dword - extrn _xPglobalHI:dword - extrn _yPglobalHI:dword - extrn _rbaTable:dword - extrn _rsHandle:word - extrn _LastX1:dword - extrn _LastY1:dword - extrn _iLastX:dword - extrn _iLastY;dword - extrn _MaxDistance:word - extrn _ErrorCode:word - extrn _xMapPosn:dword - extrn _yMapPosn:dword - extrn _Grid:dword - extrn _ObjGrid:dword - extrn _ViewHeight:word - extrn _CeilingHeight:word - extrn _gTopColor:byte - extrn _gBottomColor:byte - extrn _PlayerAngle:word - extrn _gScrnBuffer:dword - extrn _gBkgdBuffer:dword - extrn _gCenterOff:word - extrn _gWinHeight:word - extrn _SysFlags:word +extrn _x_xPos:dword +extrn _x_yPos:dword +extrn _x_xNext:dword +extrn _x_yNext:dword +extrn _y_xPos:dword +extrn _y_yPos:dword +extrn _y_xNext:dword +extrn _y_yNext:dword +extrn _Slice:dword +extrn _sPtr:dword +extrn _HitMap:byte - extrn _xSecretmPos:word - extrn _xSecretmPos1:word - extrn _xSecretColumn:word +extrn xRaySetup_:near +extrn yRaySetup_:near +extrn BuildSlice_:near +extrn xRayCast_:near +extrn yRayCast_:near +extrn AckDrawFloor_:near +extrn AckDrawFloorOnly_:near +extrn AckDrawCeilingOnly_:near +extrn DrawWalls_:near +extrn CheckDoors_:near +extrn BuildSliceMulti_:near +extrn FindObject_:near - extrn _ySecretmPos:word - extrn _ySecretmPos1:word - extrn _ySecretColumn:word - - extrn _TotalSecret:word - extrn _ViewColumn:word - extrn _SinTable:dword - extrn _CosTable:dword - extrn _LongTanTable:dword - extrn _LongInvTanTable:dword - extrn _InvCosTable:byte - extrn _InvSinTable:byte - extrn _LongCosTable:dword - extrn _ViewCosTable:dword - extrn _xNextTable:dword - extrn _yNextTable:dword - - extrn _LastMapPosn:word - extrn _LastObjectHit:word - extrn _TotalObjects:word - extrn _FoundObjectCount:word - extrn _ObjectsSeen:byte - extrn _MoveObjectCount:word - extrn _MoveObjectList:byte - extrn _ObjNumber:byte - extrn _ObjRelDist:byte - extrn _ObjColumn:byte - - extrn _x_xPos:dword - extrn _x_yPos:dword - extrn _x_xNext:dword - extrn _x_yNext:dword - extrn _y_xPos:dword - extrn _y_yPos:dword - extrn _y_xNext:dword - extrn _y_yNext:dword - - extrn _Slice:dword - extrn _sPtr:dword - extrn _HitMap:byte - - ACKEXT xRaySetup - ACKEXT yRaySetup - ACKEXT BuildSlice - ACKEXT xRayCast - ACKEXT yRayCast - ACKEXT AckDrawFloor - ACKEXT AckDrawFloorOnly - ACKEXT AckDrawCeilingOnly - ACKEXT DrawWalls - ACKEXT CheckDoors - ACKEXT BuildSliceMulti - ACKEXT FindObject - - ACKPUBS xRayCastMulti - ACKPUBS yRayCastMulti - ACKPUBS ShowColLow - ACKPUBS ShowColMaskLow - ACKPUBS BuildUpView +public xRayCastMulti_ +public yRayCastMulti_ +public ShowColLow_ +public ShowColMaskLow_ +public BuildUpView_ align 2 ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void ShowColLow(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC ShowColLow +proc ShowColLow_ near push ebp push esi push edi @@ -319,9 +317,9 @@ alldone: align 2 ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void ShowColMaskLow(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC ShowColMaskLow +proc ShowColMaskLow_ near push ebp push esi push edi @@ -463,12 +461,10 @@ m_alldone: endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; USHORT xRayCastMulti(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC xRayCastMulti - push ebp - mov ebp,esp - sub esp,50 +proc xRayCastMulti_ near +; sub esp,50 push esi push edi push ebx @@ -561,18 +557,14 @@ xRayDone: pop ebx pop edi pop esi - mov esp,ebp - pop ebp ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; USHORT yRayCastMulti(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC yRayCastMulti - push ebp - mov ebp,esp - sub esp,50 +proc yRayCastMulti_ near +; sub esp,50 push esi push edi push ebx @@ -664,16 +656,14 @@ yRayDone: pop ebx pop edi pop esi - mov esp,ebp - pop ebp ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void CheckHitMap(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC CheckHitMap +proc CheckHitMap_ near mov edi,offset _HitMap mov edx,edi mov ecx,4096 @@ -701,9 +691,9 @@ chmDone: endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void BuildUpView(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC BuildUpView +proc BuildUpView_ near push ebp ; Save registers used by this routine push esi push edi @@ -711,7 +701,7 @@ ACKPROC BuildUpView push ecx push edx - ACKCALL CheckDoors ; Determine the state of the doors used in the view + call CheckDoors_ ; Determine the state of the doors used in the view mov edi,offset _HitMap ; Access the hit map mov ecx,1024 ; Size of the hit map @@ -768,14 +758,14 @@ buv050: add eax,ebx ; Add offset to base address mov [_sPtr],eax ; Set up pointer to actual column slice movzx edi,[_ViewAngle] ; Use current viewing angle - ACKCALL xRaySetup ; Set up x ray to start casting + call xRaySetup_ ; Set up x ray to start casting buv060: - ACKCALL yRaySetup ; Set up y ray to start casting + call yRaySetup_ ; Set up y ray to start casting buv070: mov [word ptr _LastWallHeight],0 ; For checking mult-height walls - ACKCALL BuildSlice ; Build the current slice + call BuildSlice_ ; Build the current slice cmp [word ptr _gMultiWalls],0 ; Are multi-height walls used? jz short buv080 ; Nope, no need to check @@ -788,7 +778,7 @@ buv070: cmp [word ptr eax+saDist],96 ; Distance from POV to slice is jle short buv080 ; less than or equal to 96 - ACKCALL BuildSliceMulti ; Build the current slice for + call BuildSliceMulti_ ; Build the current slice for ; a multi-height wall buv080: movzx eax,[_ViewColumn] ; Get current column @@ -811,10 +801,10 @@ buv100: jl buv050 ; Nope; go build next slice buv_exit: - ACKCALL CheckHitMap - ACKCALL FindObject ; Update slice structures with objects found - call [dword ptr _FloorCeilRtn] ; Build the floor and ceiling - ACKCALL DrawWalls ; Build the walls + call CheckHitMap_ + call FindObject_ ; Update slice structures with objects found + call [dword ptr _FloorCeilRtn] ; Build the floor and ceiling + call DrawWalls_ ; Build the walls pop edx ; Restore the registers used pop ecx diff --git a/ack_lib/ACKRTN4.ASM b/ack_lib/ACKRTN4.ASM index 1bfee2b..10189f5 100644 --- a/ack_lib/ACKRTN4.ASM +++ b/ack_lib/ACKRTN4.ASM @@ -1,14 +1,12 @@ - IDEAL - JUMPS - P386 - P387 ; Allow 386 processor +IDEAL +JUMPS +P386 +P387 ; Allow 386 processor +model flat - MASM - .MODEL FLAT ;32-bit OS/2 model - -.DATA +dataseg SVTABLE dd ? @@ -16,116 +14,106 @@ SAVEVID dd ? SAVEROW dd ? - .CODE - IDEAL +codeseg - include "ackrtn.inc" +include "ackrtn.inc" - extrn _BackDropRows:dword - extrn _PlayerAngle:word - extrn _BackArray:dword - extrn _Resolution:word - extrn _ScreenOffset:word - extrn _bmDistance:dword - extrn _bmWall:dword - extrn _scPtr:dword - extrn _VidTop:dword - extrn _VidBottom:dword - extrn _Floors1:dword - extrn _Floors2:dword +extrn _BackDropRows:dword +extrn _PlayerAngle:word +extrn _BackArray:dword +extrn _Resolution:word +extrn _ScreenOffset:word +extrn _bmDistance:dword +extrn _bmWall:dword +extrn _scPtr:dword +extrn _VidTop:dword +extrn _VidBottom:dword +extrn _Floors1:dword +extrn _Floors2:dword - extrn _gPalTable:dword - extrn _gWinStartX:word - extrn _gWinStartY:word - extrn _gWinEndX:word - extrn _gWinEndY:word - extrn _gWinHeight:word - extrn _ViewHeight:word - extrn _SysFlags:word - extrn _Slice:byte - extrn _gScrnBuffer:dword - extrn _gCenterOff:word - extrn _gCenterRow:word - extrn _Floorscr:dword - extrn _gWinStartOffset:dword +extrn _gPalTable:dword +extrn _gWinStartX:word +extrn _gWinStartY:word +extrn _gWinEndX:word +extrn _gWinEndY:word +extrn _gWinHeight:word +extrn _ViewHeight:word +extrn _SysFlags:word +extrn _Slice:byte +extrn _gScrnBuffer:dword +extrn _gCenterOff:word +extrn _gCenterRow:word +extrn _Floorscr:dword +extrn _gWinStartOffset:dword - extrn _scVid:dword - extrn _scWall:dword - extrn _scPal:dword - extrn _scdst:word - extrn _scwht:word - extrn _scmulti:word - extrn _sctopht:word - extrn _scbotht:word - extrn _scsavwht:word - extrn _scmulcnt:word - extrn _scsavVid:dword - extrn _scbNum:word - extrn _scMulData:dword - extrn _scColumn:dword - extrn _WallbMaps:dword - extrn _LowerTable:dword - extrn _gBottomOff:dword - extrn _LightFlag:word +extrn _scVid:dword +extrn _scWall:dword +extrn _scPal:dword +extrn _scdst:word +extrn _scwht:word +extrn _scmulti:word +extrn _sctopht:word +extrn _scbotht:word +extrn _scsavwht:word +extrn _scmulcnt:word +extrn _scsavVid:dword +extrn _scbNum:word +extrn _scMulData:dword +extrn _scColumn:dword +extrn _WallbMaps:dword +extrn _LowerTable:dword +extrn _gBottomOff:dword +extrn _LightFlag:word - ACKEXT ShowCol - ACKEXT ShowColMask +extrn ShowCol_:near +extrn ShowColMask_:near - extrn _Resolution:word - extrn _Flooru:dword - extrn _Floorv:dword - extrn _Floordu:dword - extrn _Floordv:dword - extrn _Floorkx:dword - extrn _Floorky:dword - extrn _Floorku:dword - extrn _Floorkv:dword - extrn _Floorkdu:dword - extrn _Floorkdv:dword - extrn _Floorbm:dword - extrn _Floorscr:dword - extrn _Floors1:dword - extrn _Floors2:dword - extrn _FloorscrTop:dword - extrn _Floorptr2:dword - extrn _Floorwt:dword - extrn _Floorvht:word - extrn _Flooreht:word - extrn _FloorMap:word - extrn _gScrnBufferCenter:dword - extrn _gWinHalfHeight:word - extrn _zdTable:dword - extrn _CosTable:dword - extrn _SinTable:dword - extrn _xPglobal:dword - extrn _yPglobal:dword - extrn _WallDistTable:dword - extrn _CeilMap:word - extrn _AckTimerCounter:dword +extrn _Resolution:word +extrn _Flooru:dword +extrn _Floorv:dword +extrn _Floordu:dword +extrn _Floordv:dword +extrn _Floorkx:dword +extrn _Floorky:dword +extrn _Floorku:dword +extrn _Floorkv:dword +extrn _Floorkdu:dword +extrn _Floorkdv:dword +extrn _Floorbm:dword +extrn _Floorscr:dword +extrn _Floors1:dword +extrn _Floors2:dword +extrn _FloorscrTop:dword +extrn _Floorptr2:dword +extrn _Floorwt:dword +extrn _Floorvht:word +extrn _Flooreht:word +extrn _FloorMap:word +extrn _gScrnBufferCenter:dword +extrn _gWinHalfHeight:word +extrn _zdTable:dword +extrn _CosTable:dword +extrn _SinTable:dword +extrn _xPglobal:dword +extrn _yPglobal:dword +extrn _WallDistTable:dword +extrn _CeilMap:word +extrn _AckTimerCounter:dword - ACKPUBS Mymemset - ACKPUBS AckSpeedUp - ACKPUBS AckSlowDown - ACKPUBS ShowColNS - ACKPUBS ShowColMaskNS - ACKPUBS DrawBackDrop - ACKPUBS AckTimerHandler +public Mymemset_ +public AckSpeedUp_ +public AckSlowDown_ +public ShowColNS_ +public ShowColMaskNS_ +public DrawBackDrop_ ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckTimerHandler - inc cs:[dword ptr _AckTimerCounter] - iretd - endp - -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; -;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC Mymemset - push edi +proc Mymemset_ near + push edi push ebx push ecx push edx @@ -149,9 +137,9 @@ ACKPROC Mymemset ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void AckSpeedUp(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckSpeedUp +proc AckSpeedUp_ near push ebx push edx mov bx,ax @@ -174,9 +162,9 @@ ACKPROC AckSpeedUp endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void AckSlowDown(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckSlowDown +proc AckSlowDown_ near push edx mov dx,43h mov al,36h @@ -193,9 +181,9 @@ ACKPROC AckSlowDown ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void DrawBackDrop(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC DrawBackDrop +proc DrawBackDrop_ near push ebp push esi push edi @@ -254,9 +242,9 @@ dbd030: ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void ShowColNS(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC ShowColNS +proc ShowColNS_ near push ebp push esi push edi @@ -353,9 +341,9 @@ sns_alldone: ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void ShowColMaskNS(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC ShowColMaskNS +proc ShowColMaskNS_ near push ebp push esi push edi diff --git a/ack_lib/ACKRTN5.ASM b/ack_lib/ACKRTN5.ASM index a49e3c3..61f471a 100644 --- a/ack_lib/ACKRTN5.ASM +++ b/ack_lib/ACKRTN5.ASM @@ -1,152 +1,148 @@ - IDEAL - JUMPS - P386 - P387 ; Allow 386 processor +IDEAL +JUMPS +P386 +P387 ; Allow 386 processor +model flat - MASM - .MODEL FLAT ;32-bit OS/2 model - IDEAL +include "ackrtn.inc" +extrn _WallDistTable:dword +extrn _FloorMap:word +extrn _CeilMap:word +extrn _LastWallHeight:word +extrn _ViewAngle:word +extrn _ScreenOffset:word +extrn _xPglobal:dword +extrn _yPglobal:dword +extrn _xBegGlobal:dword +extrn _yBegGlobal:dword +extrn _aeGlobal:dword +extrn _xGridGlobal:dword +extrn _yGridGlobal:dword +extrn _xPglobalHI:dword +extrn _yPglobalHI:dword +extrn _rbaTable:dword +extrn _rsHandle:dword +extrn _LastX1:dword +extrn _LastY1:dword +extrn _iLastX:dword +extrn _iLastY:dword +extrn _MaxDistance:word +extrn _BackArray:dword +extrn _zdTable:dword +extrn _ErrorCode:word +extrn _xMapPosn:dword +extrn _yMapPosn:dword +extrn _Grid:dword +extrn _ObjGrid:dword +extrn _WallbMaps:dword +extrn _ViewHeight:word +extrn _CeilingHeight:word +extrn _gTopColor:byte +extrn _gBottomColor:byte +extrn _PlayerAngle:word +extrn _gScrnBuffer:dword +extrn _gBkgdBuffer:dword +extrn _gCenterOff:word +extrn _gWinStartOffset:dword +extrn _gWinHeight:word +extrn _gWinEndY:dword +extrn _SysFlags:word +extrn _sPtr:dword +extrn _mxGridGlobal:dword +extrn _myGridGlobal:dword - include "ackrtn.inc" +extrn _xSecretmPos:word +extrn _xSecretmPos1:word +extrn _xSecretColumn:word - extrn _WallDistTable:dword - extrn _FloorMap:word - extrn _CeilMap:word - extrn _LastWallHeight:word - extrn _ViewAngle:word - extrn _ScreenOffset:word - extrn _xPglobal:dword - extrn _yPglobal:dword - extrn _xBegGlobal:dword - extrn _yBegGlobal:dword - extrn _aeGlobal:dword - extrn _xGridGlobal:dword - extrn _yGridGlobal:dword - extrn _xPglobalHI:dword - extrn _yPglobalHI:dword - extrn _rbaTable:dword - extrn _rsHandle:word - extrn _LastX1:dword - extrn _LastY1:dword - extrn _iLastX:dword - extrn _iLastY;dword - extrn _MaxDistance:word - extrn _BackArray:dword - extrn _zdTable:dword - extrn _ErrorCode:word - extrn _xMapPosn:dword - extrn _yMapPosn:dword - extrn _Grid:dword - extrn _ObjGrid:dword - extrn _WallbMaps:dword - extrn _ViewHeight:word - extrn _CeilingHeight:word - extrn _gTopColor:byte - extrn _gBottomColor:byte - extrn _PlayerAngle:word - extrn _gScrnBuffer:dword - extrn _gBkgdBuffer:dword - extrn _gCenterOff:word - extrn _gWinStartOffset:dword - extrn _gWinHeight:word - extrn _gWinEndY:dword - extrn _SysFlags:word - extrn _sPtr:dword - extrn _mxGridGlobal:dword - extrn _myGridGlobal:dword +extrn _ySecretmPos:word +extrn _ySecretmPos1:word +extrn _ySecretColumn:word - extrn _xSecretmPos:word - extrn _xSecretmPos1:word - extrn _xSecretColumn:word +extrn _TotalSecret:word +extrn _ViewColumn:word +extrn _SinTable:dword +extrn _CosTable:dword +extrn _LongTanTable:dword +extrn _LongInvTanTable:dword +extrn _InvCosTable:byte +extrn _InvSinTable:byte +extrn _LongCosTable:dword +extrn _ViewCosTable:dword +extrn _xNextTable:dword +extrn _yNextTable:dword - extrn _ySecretmPos:word - extrn _ySecretmPos1:word - extrn _ySecretColumn:word +extrn _LastMapPosn:word +extrn _LastObjectHit:word +extrn _TotalObjects:word +extrn _FoundObjectCount:word +extrn _ObjectsSeen:byte +extrn _MoveObjectCount:word +extrn _MoveObjectList:byte +extrn _ObjNumber:byte +extrn _ObjRelDist:byte +extrn _ObjColumn:byte - extrn _TotalSecret:word - extrn _ViewColumn:word - extrn _SinTable:dword - extrn _CosTable:dword - extrn _LongTanTable:dword - extrn _LongInvTanTable:dword - extrn _InvCosTable:byte - extrn _InvSinTable:byte - extrn _LongCosTable:dword - extrn _ViewCosTable:dword - extrn _xNextTable:dword - extrn _yNextTable:dword +extrn _x_xPos:dword +extrn _x_yPos:dword +extrn _x_xNext:dword +extrn _x_yNext:dword +extrn _y_xPos:dword +extrn _y_yPos:dword +extrn _y_xNext:dword +extrn _y_yNext:dword - extrn _LastMapPosn:word - extrn _LastObjectHit:word - extrn _TotalObjects:word - extrn _FoundObjectCount:word - extrn _ObjectsSeen:byte - extrn _MoveObjectCount:word - extrn _MoveObjectList:byte - extrn _ObjNumber:byte - extrn _ObjRelDist:byte - extrn _ObjColumn:byte +extrn _Resolution:word +extrn _Flooru:dword +extrn _Floorv:dword +extrn _Floordu:dword +extrn _Floordv:dword +extrn _Floorkx:dword +extrn _Floorky:dword +extrn _Floorku:dword +extrn _Floorkv:dword +extrn _Floorkdu:dword +extrn _Floorkdv:dword +extrn _Floorbm:dword +extrn _Floorscr:dword +extrn _Floors1:dword +extrn _Floors2:dword +extrn _FloorscrTop:dword +extrn _Floorptr2:dword +extrn _Floorht:dword +extrn _Floorwt:dword +extrn _Floorvht:word +extrn _Flooreht:word +extrn _FloorLastbNum:dword +extrn _FloorLastbm:dword - extrn _x_xPos:dword - extrn _x_yPos:dword - extrn _x_xNext:dword - extrn _x_yNext:dword - extrn _y_xPos:dword - extrn _y_yPos:dword - extrn _y_xNext:dword - extrn _y_yNext:dword +extrn _bmDistance:dword +extrn _scwht:word +extrn _scWall:dword +extrn _scPal:dword +extrn _scVid:dword +extrn _scantables:dword - extrn _Resolution:word - extrn _Flooru:dword - extrn _Floorv:dword - extrn _Floordu:dword - extrn _Floordv:dword - extrn _Floorkx:dword - extrn _Floorky:dword - extrn _Floorku:dword - extrn _Floorkv:dword - extrn _Floorkdu:dword - extrn _Floorkdv:dword - extrn _Floorbm:dword - extrn _Floorscr:dword - extrn _Floors1:dword - extrn _Floors2:dword - extrn _FloorscrTop:dword - extrn _Floorptr2:dword - extrn _Floorht:dword - extrn _Floorwt:dword - extrn _Floorvht:word - extrn _Flooreht:word - extrn _FloorLastbNum:dword - extrn _FloorLastbm:dword +extrn AckDrawFloor_:near +extrn AckDrawFloorOnly_:near +extrn AckDrawCeilingOnly_:near +extrn DrawBackDrop_:near +extrn AckDrawCeilingOnlyNS_:near +extrn AckDrawFloorOnlyNS_:near - extrn _bmDistance:dword - extrn _scwht:word - extrn _scWall:dword - extrn _scPal:dword - extrn _scVid:dword - extrn _scantables:dword +public AckDrawFloorNS_ +public DrawSolidCeilAndFloorNS_ +public DrawSolidCeilAndFloor_ +public DrawSolidFloorAndCeilNS_ +public DrawSolidFloorAndCeil_ +public DrawSolidCeilSolidFloor_ +public AckDoubleBuffer_ - ACKEXT AckDrawFloor - ACKEXT AckDrawFloorOnly - ACKEXT AckDrawCeilingOnly - ACKEXT DrawBackDrop - ACKEXT AckDrawCeilingOnlyNS - ACKEXT AckDrawFloorOnlyNS +dataseg - ACKPUBS AckDrawFloorNS - ACKPUBS DrawSolidCeilAndFloorNS - ACKPUBS DrawSolidCeilAndFloor - ACKPUBS DrawSolidFloorAndCeilNS - ACKPUBS DrawSolidFloorAndCeil - ACKPUBS DrawSolidCeilSolidFloor - ACKPUBS AckDoubleBuffer - - MASM - .DATA ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; Globals used by the AckDrawFloor routine ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ @@ -180,13 +176,12 @@ WALLDIST dd ? DSTPTR dd ? COLNUM dd ? - .CODE - IDEAL +codeseg ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void AckDrawFloorNS(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckDrawFloorNS +proc AckDrawFloorNS_ near push ebp push esi push edi @@ -415,9 +410,9 @@ adf_exit: ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -; +; void DrawSolidCeilAndFloor(void) ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC DrawSolidCeilAndFloor +proc DrawSolidCeilAndFloor_ near mov edi,[_gScrnBuffer] movzx ecx,[word ptr _gCenterOff] mov al,[byte ptr _gTopColor] @@ -426,14 +421,14 @@ ACKPROC DrawSolidCeilAndFloor rep stosw rcl cx,1 rep stosb - ACKCALL AckDrawFloorOnly + call AckDrawFloorOnly_ ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC DrawSolidCeilAndFloorNS +proc DrawSolidCeilAndFloorNS_ near mov edi,[_gScrnBuffer] movzx ecx,[word ptr _gCenterOff] mov al,[byte ptr _gTopColor] @@ -442,14 +437,14 @@ ACKPROC DrawSolidCeilAndFloorNS rep stosw rcl cx,1 rep stosb - ACKCALL AckDrawFloorOnlyNS + call AckDrawFloorOnlyNS_ ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC DrawSolidFloorAndCeilNS +proc DrawSolidFloorAndCeilNS_ near mov edi,[_gScrnBuffer] movzx ecx,[word ptr _gCenterOff] add edi,ecx @@ -459,14 +454,14 @@ ACKPROC DrawSolidFloorAndCeilNS rep stosw rcl cx,1 rep stosb - ACKCALL AckDrawCeilingOnlyNS + call AckDrawCeilingOnlyNS_ ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC DrawSolidFloorAndCeil +proc DrawSolidFloorAndCeil_ near mov edi,[_gScrnBuffer] movzx ecx,[word ptr _gCenterOff] add edi,ecx @@ -476,14 +471,14 @@ ACKPROC DrawSolidFloorAndCeil rep stosw rcl cx,1 rep stosb - ACKCALL AckDrawCeilingOnly + call AckDrawCeilingOnly_ ret endp ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC DrawSolidCeilSolidFloor +proc DrawSolidCeilSolidFloor_ near mov edi,[_gScrnBuffer] movzx ecx,[word ptr _gCenterOff] mov al,[byte ptr _gTopColor] @@ -508,7 +503,7 @@ ACKPROC DrawSolidCeilSolidFloor ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -ACKPROC AckDoubleBuffer +proc AckDoubleBuffer_ near push ebp mov ebp,esp push esi diff --git a/ack_lib/ACKUTIL.C b/ack_lib/ACKUTIL.C index e36f528..e03a1b0 100644 --- a/ack_lib/ACKUTIL.C +++ b/ack_lib/ACKUTIL.C @@ -1,46 +1,82 @@ -#include -#include #include +#include +#include #include -#include #include #include -#include -#include -#include +#include +#include #include "ack3d.h" #include "ackeng.h" #include "ackext.h" -typedef struct { - int sel; - int off; - } SELOFF; - -void AckGetIntVector(int VecNum,int *sel,int *off); -void AckSetIntVector(int VecNum,int sel,void *VecOff); -void AckKbdInt(void); -void AckTimerHandler(void); -void AckSetTextMode(void); long AckMemUsed; short AckDisplayErrors; - SELOFF OldKeybdInt; + void (__interrupt __far *OldKeybdInt)(); char AckKeyboardSetup; - SELOFF OldTimerInt; + void (__interrupt __far *OldTimerInt)(); char AckTimerSetup; +//============================================================================= +// Keyboard interrupt 9 +//============================================================================= +void __interrupt __far AckKbdInt(void) +{ +UCHAR scanCode, x; + +scanCode = inp(0x60); // read keyboard data port +x = inp(0x61); +outp(0x61, (x | 0x80)); +outp(0x61, x); +outp(0x20, 0x20); + +AckKeys[scanCode & 127] = 1; +KeyPressed = 1; +if (scanCode & 128) + { + AckKeys[scanCode & 127] = 0; + KeyPressed = 0; + } +} + + +//============================================================================= +// Timer interrupt - simply increments a counter for use in program +// Calls the old timer after X iterations have cycled so clock stays correct +//============================================================================= +void __interrupt __far AckTimerHandler(void) +{ + +AckTimerCounter++; + +AckTmCount++; +if (AckTmCount > AckTmDelay) + { + OldTimerInt(); + AckTmCount -= AckTmDelay; + } +else + { + _enable(); + outp(0x20,0x20); + } +} + + //ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ // Establish a hook into interrupt 9 for keyboard handling // The application can access which key is pressed by looking at the // AckKeys global array //ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ -#ifndef _MSC_VER void AckSetupKeyboard(void) { -AckGetIntVector(9,&OldKeybdInt.sel,&OldKeybdInt.off); -AckSetIntVector(9,_CS,AckKbdInt); +memset(AckKeys, 0, sizeof(UCHAR)*128); +KeyPressed = 0; + +OldKeybdInt = _dos_getvect(0x9); +_dos_setvect(0x9, AckKbdInt); AckKeyboardSetup = 1; } @@ -51,11 +87,13 @@ AckKeyboardSetup = 1; //ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ void AckSetupTimer(void) { -AckGetIntVector(0x1C,&OldTimerInt.sel,&OldTimerInt.off); -AckSetIntVector(0x1C,_CS,AckKbdInt); +AckTimerCounter = 0; +AckTmCount = 0; + +OldTimerInt = _dos_getvect(0x1C); +_dos_setvect(0x1C, AckTimerHandler); AckTimerSetup = 1; } -#endif //ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ // Utility routine used to track memory usage by the ACK engine and @@ -134,18 +172,18 @@ if (buf == NULL) ErrCode = 0; if (!rsHandle) - handle = _lopen(PalName,O_RDWR|O_BINARY); + handle = open(PalName,O_RDONLY|O_BINARY); else { handle = rsHandle; - _llseek(handle,rbaTable[(ULONG)PalName],SEEK_SET); + lseek(handle,rbaTable[(ULONG)PalName],SEEK_SET); } if (handle > 0) { read(handle,buf,768); if (!rsHandle) - _lclose(handle); + close(handle); memset(buf,0,3); // Make sure color 0 is always black AckSetPalette(buf); diff --git a/ack_lib/ACKVIEW.C b/ack_lib/ACKVIEW.C index f0040e8..5b1eb11 100644 --- a/ack_lib/ACKVIEW.C +++ b/ack_lib/ACKVIEW.C @@ -1,17 +1,6 @@ // This file contains the declarations and functions to set up views for the // ray casting engine. -#include // Required for Windows version of engine -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "ack3d.h" // Main ACK-3D internal and interface data structures #include "ackeng.h" // Intrnal structures and constants diff --git a/ack_lib/ACKWRAP.C b/ack_lib/ACKWRAP.C index 079c173..ebdc9a5 100644 --- a/ack_lib/ACKWRAP.C +++ b/ack_lib/ACKWRAP.C @@ -1,29 +1,15 @@ -#include -#include #include #include -#include #include -#include -#include -#include -#include #include "ack3d.h" #include "ackeng.h" #include "ackext.h" -typedef struct { - int sel; - int off; - } SELOFF; - extern char AckKeyboardSetup; -extern SELOFF OldKeybdInt; +extern void (__interrupt __far *OldKeybdInt)(); extern char AckTimerSetup; -extern SELOFF OldTimerInt; - -void AckSetIntVector(int VecNum,int sel,int VecOff); +extern void (__interrupt __far *OldTimerInt)(); //ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ // Frees up buffers and closes any resource file that may be open. @@ -63,12 +49,12 @@ short AckWrapUp (ACKENG * ae) if (AckKeyboardSetup) { - AckSetIntVector(9,OldKeybdInt.sel,OldKeybdInt.off); + _dos_setvect(0x9, OldKeybdInt); AckKeyboardSetup = 0; } if (AckTimerSetup) { - AckSetIntVector(0x1C,OldTimerInt.sel,OldTimerInt.off); + _dos_setvect(0x1C, OldTimerInt); AckTimerSetup = 0; } diff --git a/ack_lib/IFF.H b/ack_lib/IFF.H index ac66cad..6c551ad 100644 --- a/ack_lib/IFF.H +++ b/ack_lib/IFF.H @@ -1,3 +1,6 @@ +#ifndef IFF_H_INCLUDED +#define IFF_H_INCLUDED + #ifndef NULL #define NULL 0 #endif @@ -95,3 +98,5 @@ void ByteFlipShort(short *); short iffswab(unsigned short); short swab(unsigned short); +#endif + diff --git a/ack_lib/KIT.H b/ack_lib/KIT.H index 81d8c31..a4c887d 100644 --- a/ack_lib/KIT.H +++ b/ack_lib/KIT.H @@ -4,6 +4,9 @@ // Module: KIT.H // (c) CopyRight 1994 All Rights Reserved +#ifndef KIT_H_INCLUDED +#define KIT_H_INCLUDED + #define MODE_GRAPHICS 0x13 #define MODE_TEXT 0x03 @@ -137,3 +140,5 @@ short ShowPickList(char **p,short SortFlag); //============================================================================= short LoadSet(char *fName); +#endif + diff --git a/ack_lib/makefile b/ack_lib/makefile new file mode 100644 index 0000000..710491a --- /dev/null +++ b/ack_lib/makefile @@ -0,0 +1,70 @@ +target_config = debug + +target_name = acklib + +object_files = & + ackbkgd.obj & + ackdata.obj & + ackdoor.obj & + ackfloor.obj & + ackgif.obj & + ackiff.obj & + ackinit.obj & + ackldbmp.obj & + ackobj.obj & + ackover.obj & + ackpcx.obj & + ackpov.obj & + ackray.obj & + ackrtn.obj & + ackrtn1.obj & + ackrtn3.obj & + ackrtn4.obj & + ackrtn5.obj & + ackutil.obj & + ackview.obj & + ackwrap.obj & + + +cc_flags_debug = /d2 /zp1 /4r /fp3 /j +cc_flags_release = /d1+ /zp1 /4r /fp3 /ontx /oe=40 /j +cc_flags = /mf $(cc_flags_$(target_config)) + +link_flags_debug = debug all +link_flags_release = debug all +link_flags = $(link_flags_$(target_config)) + +asm_flags_debug = /zi +asm_flags_release = /zi +asm_flags = /m /ml $(asm_flags_$(target_config)) + + +.c.obj: .AUTODEPEND + wcc386 $[. /zq $(cc_flags) + +.asm.obj: .AUTODEPEND + tasm $[. /t $(asm_flags) + + +$(target_name).lbc: $(object_files) + %create $^@ + @for %i in ($(object_files)) do %append $^@ +%i + +$(target_name).lib: $(object_files) $(target_name).lbc + wlib /n /q /b $(target_name).lib @$(target_name).lbc + + +clean : .SYMBOLIC + del *.obj + del *.err + del $(target_name).exe + del $(target_name).lib + del $(target_name).lnk + del $(target_name).lbc + +.NOCHECK +build : $(target_name).lib + +.NOCHECK +library : $(target_name).lib +