diff --git a/ack_lib/ACK3D.H b/ack_lib/ACK3D.H index 090f069..cb7bfa9 100644 --- a/ack_lib/ACK3D.H +++ b/ack_lib/ACK3D.H @@ -2,16 +2,16 @@ // This file contains the main data structures and definitions // required to support the ACK-3D engine. The data structures defined are // the ones you use to set up the communication links between your application -// and the ACK-3D library. The four main data structures set up in this header file +// and the ACK-3D library. The four main data structures set up in this header file // include: ACKENG, DOORS, NEWOBJECT, and OBJSEQ. -// USED TO RID OURSELVES OF THE MANY CASTING PROBLEMS +// 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 short USHORT; -typedef unsigned char UCHAR; +// Internal definitions used to simplify field declarations. +typedef unsigned long ULONG; +typedef unsigned short USHORT; +typedef unsigned char UCHAR; // Error codes returned from ACK-3D functions. You can use these error codes in your // applications to debug the function calls. @@ -72,10 +72,10 @@ typedef unsigned char UCHAR; // Defines required to support bitmaps. // Each bitmap used in ACK-3D is 64x64 pixels in size. -#define BITMAP_WIDTH 64 -#define BITMAP_HEIGHT 64 -#define BITMAP_SHIFT 6 // Bits to shift for bitmap width -#define BITMAP_SIZE (BITMAP_WIDTH * BITMAP_HEIGHT) +#define BITMAP_WIDTH 64 +#define BITMAP_HEIGHT 64 +#define BITMAP_SHIFT 6 // Bits to shift for bitmap width +#define BITMAP_SIZE (BITMAP_WIDTH * BITMAP_HEIGHT) // Defines used to set up map grid. The grid is used with the ACKENG structure. // Each grid component is 64x64 units in size. @@ -89,13 +89,13 @@ typedef unsigned char UCHAR; #define GRID_XMAXLONG (GRID_XMAX * FP_MULT) #define GRID_YMAXLONG (GRID_YMAX * FP_MULT) // The main grid array used with the ACKENG structure -#define GRID_ARRAY (GRID_WIDTH+2) * (GRID_HEIGHT+2) +#define GRID_ARRAY (GRID_WIDTH+2) * (GRID_HEIGHT+2) // Defines to specify maximum sizes for the various components used with // ACK-3D, including wall bitmaps, light zones, shading palette, views, multi- // height walls, doors, object bitmaps, and objects. #define MAX_WALLBMPS 256 // Total wall bitmaps allowed -#define MAX_ZONES 8 // Number of light zones +#define MAX_ZONES 8 // Number of light zones #define PAL_SIZE 4096 // Shading palette ranges #define MAX_VIEWS 47 // Total sides to an object #define MAX_MULTI 3 // Max height for multi-height walls @@ -105,32 +105,32 @@ typedef unsigned char UCHAR; #define MAX_OBJECTS 254 // Total objects allowed in map // Defines to set up different wall types. -#define WALL_TYPE_TRANS 0x0800 // Transparent wall -#define WALL_TYPE_MULTI 0x0400 // Wall is 1.5 times high -#define WALL_TYPE_UPPER 0x0200 // Wall is above floor level -#define WALL_TYPE_PASS 0x0100 // Wall can be walked through +#define WALL_TYPE_TRANS 0x0800 // Transparent wall +#define WALL_TYPE_MULTI 0x0400 // Wall is 1.5 times high +#define WALL_TYPE_UPPER 0x0200 // Wall is above floor level +#define WALL_TYPE_PASS 0x0100 // Wall can be walked through -#define TYPE_WALL 0 -#define TYPE_OBJECT 1 +#define TYPE_WALL 0 +#define TYPE_OBJECT 1 #define RES_LOW 1 // Resolution is low for walls, floor, and ceiling -#define RES_MEDIUM 2 // Resolution is low only for floor and ceiling +#define RES_MEDIUM 2 // Resolution is low only for floor and ceiling //*************************************************************** // Definitions and data structures used to represent and process objects. // These defines specify the two settings for the Active field in the NEWOBJECT structure. -#define OBJECT_ACTIVE 1 // Active and may be moveable -#define OBJECT_INACTIVE 0 // Won't be considered moveable +#define OBJECT_ACTIVE 1 // Active and may be moveable +#define OBJECT_INACTIVE 0 // Won't be considered moveable // These defines specify values for the Flags field in the NEWOBJECT structure. // They are used to indicate the type of animation available for an object. -#define OF_PASSABLE 0x80 // Object can be walked thru -#define OF_ANIMATE 0x40 // Object bitmaps are animated -#define OF_MOVEABLE 0x20 // Object will move X,Y -#define OF_MULTIVIEW 0x10 // Object has multiple sides -#define OF_ANIMONCE 0x08 // Animate once then stop -#define OF_ANIMDONE 0x04 // One shot animation is completed +#define OF_PASSABLE 0x80 // Object can be walked thru +#define OF_ANIMATE 0x40 // Object bitmaps are animated +#define OF_MOVEABLE 0x20 // Object will move X,Y +#define OF_MULTIVIEW 0x10 // Object has multiple sides +#define OF_ANIMONCE 0x08 // Animate once then stop +#define OF_ANIMDONE 0x04 // One shot animation is completed // These defines specify values for the CurrentType field in the NEWOBJECT structure. // They are used to indicate the current status of the object. @@ -142,39 +142,39 @@ typedef unsigned char UCHAR; #define NO_INTERACT 5 // The Object Sequence structure. This structure is used by the NEWOBJECT structure. -#define MAX_OBJ_BITMAPS 32 // Max bitmaps per sequence type +#define MAX_OBJ_BITMAPS 32 // Max bitmaps per sequence type typedef struct { - UCHAR flags; // Flags for this sequence - UCHAR bitmaps[MAX_OBJ_BITMAPS]; // Bitmap numbers in this sequence - short bmSides; // Number of views in sequence - short bmBitmapsPerView; // Number of bitmaps in each view - short AngleFactor; // Used internally to support the object sequence - UCHAR MaxBitmaps; // Max bitmaps in this sequence - } OBJSEQ; + UCHAR flags; // Flags for this sequence + UCHAR bitmaps[MAX_OBJ_BITMAPS]; // Bitmap numbers in this sequence + short bmSides; // Number of views in sequence + short bmBitmapsPerView; // Number of bitmaps in each view + short AngleFactor; // Used internally to support the object sequence + UCHAR MaxBitmaps; // Max bitmaps in this sequence + } OBJSEQ; // The defininition of the main object structure--NEWOBJECT. typedef struct { - char Active; // Determines object status: 0=Inactive, 1=Active - UCHAR Flags; // Misc flags for this object - char Speed; // Speed of obj (used by application) - short Dir; // Direction of obj (used by application) - short x; // Current x,y location in grid - short y; - short mPos; // Current map location in grid - UCHAR id; // Object id - short CurrentType; // Create, Destroy, etc. is current - UCHAR *CurrentBitmaps; // Current bitmap list - short Sides; // Number of views - short aFactor; // Angle factor - short BitmapsPerView; // Number of bitmaps in each view - UCHAR CurrentBm; // Current bitmap number - UCHAR Maxbm; // Max bitmap number for this view - OBJSEQ Create; // Stores structures for the 5 object sequences - OBJSEQ Destroy; - OBJSEQ Walk; - OBJSEQ Attack; - OBJSEQ Interact; - } NEWOBJECT; + char Active; // Determines object status: 0=Inactive, 1=Active + UCHAR Flags; // Misc flags for this object + char Speed; // Speed of obj (used by application) + short Dir; // Direction of obj (used by application) + short x; // Current x,y location in grid + short y; + short mPos; // Current map location in grid + UCHAR id; // Object id + short CurrentType; // Create, Destroy, etc. is current + UCHAR *CurrentBitmaps; // Current bitmap list + short Sides; // Number of views + short aFactor; // Angle factor + short BitmapsPerView; // Number of bitmaps in each view + UCHAR CurrentBm; // Current bitmap number + UCHAR Maxbm; // Max bitmap number for this view + OBJSEQ Create; // Stores structures for the 5 object sequences + OBJSEQ Destroy; + OBJSEQ Walk; + OBJSEQ Attack; + OBJSEQ Interact; + } NEWOBJECT; //************************************************************************** // The definitions and data structure that are used to represent doors. @@ -183,101 +183,101 @@ typedef struct { #define DEFAULT_DOOR_SPEED 2 // These defines are used to set the Type field. // Obsolete door codes since any wall can be a door -#define DOOR_XCODE 60 // Map codes for the various doors +#define DOOR_XCODE 60 // Map codes for the various doors #define DOOR_SIDECODE 61 #define DOOR_YCODE 62 // These two defines are used to set the Flags field in the DOORS structure. -#define DOOR_OPENING 0x80 // Set if door is currently opening -#define DOOR_CLOSING 0x40 // Set if door is currently closing +#define DOOR_OPENING 0x80 // Set if door is currently opening +#define DOOR_CLOSING 0x40 // Set if door is currently closing // Other attributes that can be assigned to the Flags field. -#define DOOR_TYPE_SECRET 0x8000 // Secret door -#define DOOR_LOCKED 0x4000 // Locked door -#define DOOR_TYPE_SLIDE 0x2000 // Sliding door -#define DOOR_TYPE_SPLIT 0x1000 // Split door +#define DOOR_TYPE_SECRET 0x8000 // Secret door +#define DOOR_LOCKED 0x4000 // Locked door +#define DOOR_TYPE_SLIDE 0x2000 // Sliding door +#define DOOR_TYPE_SPLIT 0x1000 // Split door // The main DOORS structure. typedef struct { - short mPos; // Stores position info for a door - short mPos1; - short mCode; // Bitmap ID of the door - short mCode1; - UCHAR ColOffset; // Column offset for the door - char Speed; // Speed setting for opening and closing the door - char Type; // Code for the door type - UCHAR Flags; // Door attribute settings + short mPos; // Stores position info for a door + short mPos1; + short mCode; // Bitmap ID of the door + short mCode1; + UCHAR ColOffset; // Column offset for the door + char Speed; // Speed setting for opening and closing the door + char Type; // Code for the door type + UCHAR Flags; // Door attribute settings } DOORS; //*********************************************************************** // The defines and data structure for the main interface structure--ACKENG. // These defines are used for the LightFlag field in the ACKENG structure. -#define SHADING_ON 1 // Set if distance shading is on -#define SHADING_OFF 0 +#define SHADING_ON 1 // Set if distance shading is on +#define SHADING_OFF 0 // These defines are used for the SysFlags field in the ACKENG structure. -#define SYS_SOLID_BACK 0x8000 // On if solid color bkgd vs picture -#define SYS_SOLID_FLOOR 0x4000 // On if solid vs texture floor -#define SYS_SOLID_CEIL 0x2000 // On if solid vs texture ceiling -#define SYS_NO_WALLS 0x1000 // On if walls are NOT to display -#define SYS_SINGLE_BMP 0x0800 // On if 1 bitmap for floor & ceiling +#define SYS_SOLID_BACK 0x8000 // On if solid color bkgd vs picture +#define SYS_SOLID_FLOOR 0x4000 // On if solid vs texture floor +#define SYS_SOLID_CEIL 0x2000 // On if solid vs texture ceiling +#define SYS_NO_WALLS 0x1000 // On if walls are NOT to display +#define SYS_SINGLE_BMP 0x0800 // On if 1 bitmap for floor & ceiling // These defines indicate how bitmaps will be loaded. they are used with the bmLoadType field. -#define BMLOAD_BBM 0 // Bitmaps will be loaded using BBM format -#define BMLOAD_GIF 1 // Bitmaps will be loaded using GIF format -#define BMLOAD_PCX 2 // Bitmaps will be loaded using PCX format +#define BMLOAD_BBM 0 // Bitmaps will be loaded using BBM format +#define BMLOAD_GIF 1 // Bitmaps will be loaded using GIF format +#define BMLOAD_PCX 2 // Bitmaps will be loaded using PCX format // The main interface structure used between the application and the ACK-3D engine. // This structure MUST be allocated or defined before any ACK-3D calls are made. typedef struct { - USHORT xGrid[GRID_ARRAY]; // Map for X walls - USHORT yGrid[GRID_ARRAY]; // Map for Y walls - UCHAR *mxGrid[GRID_ARRAY]; // Wall data for multi-height X walls - UCHAR *myGrid[GRID_ARRAY]; // Wall data for multi-height Y walls - UCHAR *bMaps[MAX_WALLBMPS]; // Pointers to wall bitmaps - UCHAR *oMaps[MAX_OBJBMPS]; // Pointers to object bitmaps + USHORT xGrid[GRID_ARRAY]; // Map for X walls + USHORT yGrid[GRID_ARRAY]; // Map for Y walls + UCHAR *mxGrid[GRID_ARRAY]; // Wall data for multi-height X walls + UCHAR *myGrid[GRID_ARRAY]; // Wall data for multi-height Y walls + UCHAR *bMaps[MAX_WALLBMPS]; // Pointers to wall bitmaps + UCHAR *oMaps[MAX_OBJBMPS]; // Pointers to object bitmaps - UCHAR *ScreenBuffer; // 64k buffer for screen - UCHAR *OverlayBuffer; // Buffer for compiled overlay - UCHAR *BkgdBuffer; // Buffer for ceiling, floor + UCHAR *ScreenBuffer; // 64k buffer for screen + UCHAR *OverlayBuffer; // Buffer for compiled overlay + UCHAR *BkgdBuffer; // Buffer for ceiling, floor - short xPlayer; // X value from 0 to 4095--stores current position - short yPlayer; // Y value from 0 to 4095--stores current position - short PlayerAngle; // Angle value from 0 to 1799 + short xPlayer; // X value from 0 to 4095--stores current position + short yPlayer; // Y value from 0 to 4095--stores current position + short PlayerAngle; // Angle value from 0 to 1799 - short DoorSpeed; // Door open/close speed - short NonSecretCode; // Wall code for secret door + short DoorSpeed; // Door open/close speed + short NonSecretCode; // Wall code for secret door - UCHAR TopColor; // Base color of ceiling - UCHAR BottomColor; // Base color of floor - UCHAR FloorBitmap; // Bitmap number for single floor - UCHAR CeilBitmap; // Bitmap number for single ceiling + UCHAR TopColor; // Base color of ceiling + UCHAR BottomColor; // Base color of floor + UCHAR FloorBitmap; // Bitmap number for single floor + UCHAR CeilBitmap; // Bitmap number for single ceiling - UCHAR LightFlag; // 0 = no light shading, 1 = ON - UCHAR PalTable[PAL_SIZE]; // 16 zones of 256 colors each + UCHAR LightFlag; // 0 = no light shading, 1 = ON + UCHAR PalTable[PAL_SIZE]; // 16 zones of 256 colors each - short WinStartX; // Value of left side of viewport - short WinStartY; // Value of top side of viewport - short WinEndX; // Value of right side - short WinEndY; // Value of bottom side - short CenterRow; // Value of (WinEndY-WinStartY)/2 - short CenterOffset; // Center row times bytes per row - short WinWidth; // Value of WinEndX - WinStartX - short WinHeight; // Value of WinEndY - WinStartY - USHORT WinLength; // Number of dwords in window - USHORT WinStartOffset; // Value of WinStartY * 320 - USHORT SysFlags; // General system flags--determines display attributes - UCHAR bmLoadType; // Bitmap load flags (BBM, GIF, PCX, etc) - short MaxObjects; // Total number of objects in map - NEWOBJECT *ObjList[MAX_OBJECTS+1]; // Current objects in map - DOORS Door[MAX_DOORS]; // Doors moving at one time + short WinStartX; // Value of left side of viewport + short WinStartY; // Value of top side of viewport + short WinEndX; // Value of right side + short WinEndY; // Value of bottom side + short CenterRow; // Value of (WinEndY-WinStartY)/2 + short CenterOffset; // Center row times bytes per row + short WinWidth; // Value of WinEndX - WinStartX + short WinHeight; // Value of WinEndY - WinStartY + USHORT WinLength; // Number of dwords in window + USHORT WinStartOffset; // Value of WinStartY * 320 + USHORT SysFlags; // General system flags--determines display attributes + UCHAR bmLoadType; // Bitmap load flags (BBM, GIF, PCX, etc) + short MaxObjects; // Total number of objects in map + NEWOBJECT *ObjList[MAX_OBJECTS+1]; // Current objects in map + DOORS Door[MAX_DOORS]; // Doors moving at one time } ACKENG; // Structure used to build the palette ranges for light shading // There are 16 color ranges (or zones) each containing 256 colors. typedef struct { - unsigned char start; // Starting color for this range - unsigned char length; // Length of range + unsigned char start; // Starting color for this range + unsigned char length; // Length of range } ColorRange; //************************************************************************* @@ -433,4 +433,3 @@ void AckSetTextmode(void); short AckDisplayScreen(void); - \ No newline at end of file diff --git a/ack_lib/ACKBKGD.C b/ack_lib/ACKBKGD.C index f8f7589..66e5e3e 100644 --- a/ack_lib/ACKBKGD.C +++ b/ack_lib/ACKBKGD.C @@ -29,14 +29,13 @@ short AckBuildBackground (ACKENG * ae) #if FLOOR_ACTIVE #else AckBuildCeilingFloor (ae->BkgdBuffer, - ae->LightFlag, - ae->TopColor, - ae->BottomColor, - ae->WinStartY, - ae->WinEndY, - ae->CenterRow); + ae->LightFlag, + ae->TopColor, + ae->BottomColor, + ae->WinStartY, + ae->WinEndY, + ae->CenterRow); #endif return (0); } - \ No newline at end of file diff --git a/ack_lib/ACKDATA.C b/ack_lib/ACKDATA.C index 21a4c00..b203845 100644 --- a/ack_lib/ACKDATA.C +++ b/ack_lib/ACKDATA.C @@ -142,9 +142,8 @@ UCHAR HitMap[4096]; UCHAR *VidSeg; char *scantables[96]; -UCHAR AckKeys[128]; // Buffer for keystrokes +UCHAR AckKeys[128]; // Buffer for keystrokes long AckTimerCounter; // **** End of Data **** - \ No newline at end of file diff --git a/ack_lib/ACKDISP.C b/ack_lib/ACKDISP.C index 9293fea..a44f123 100644 --- a/ack_lib/ACKDISP.C +++ b/ack_lib/ACKDISP.C @@ -31,4 +31,3 @@ short xxxAckDisplayScreen (void) } - \ No newline at end of file diff --git a/ack_lib/ACKDOOR.C b/ack_lib/ACKDOOR.C index 3b42c0d..8bd1280 100644 --- a/ack_lib/ACKDOOR.C +++ b/ack_lib/ACKDOOR.C @@ -388,4 +388,3 @@ return (DoorCode); } // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKENG.H b/ack_lib/ACKENG.H index c035221..72cc26b 100644 --- a/ack_lib/ACKENG.H +++ b/ack_lib/ACKENG.H @@ -17,28 +17,28 @@ #define FP_HALF 32768 #define VIEW_WIDTH 320 // The number of columns in a view (screen) -#define MAX_DISTANCE 2048 // The max distance from the POV to a wall slice +#define MAX_DISTANCE 2048 // The max distance from the POV to a wall slice #define TYPE_WALL 0 #define TYPE_OBJECT 1 #define TYPE_PALETTE 2 -#define MAX_HEIGHT 960 // Maximum height of a wall -#define MIN_HEIGHT 8 // Minimum height of a wall +#define MAX_HEIGHT 960 // Maximum height of a wall +#define MIN_HEIGHT 8 // Minimum height of a wall -#define MAX_UPDOWN 30 // Max up or down spots for each level +#define MAX_UPDOWN 30 // Max up or down spots for each level -#define MAP_STARTCODE 0xFC // Force player to this square -#define MAP_UPCODE 0xFD // Go up to previous level -#define MAP_DOWNCODE 0xFE // Go down to next level -#define MAP_GOALCODE 0xFF // Finish line! +#define MAP_STARTCODE 0xFC // Force player to this square +#define MAP_UPCODE 0xFD // Go up to previous level +#define MAP_DOWNCODE 0xFE // Go down to next level +#define MAP_GOALCODE 0xFF // Finish line! #define ST_WALL 1 #define ST_OBJECT 2 -#define COLS_PER_BYTE 1 // Use 1 for normal mode 13h, 4 for modeX -#define BYTES_PER_ROW 320 // Use 320 for normal mode 13h, 80 for modeX -#define DWORDS_PER_ROW (BYTES_PER_ROW / 4) +#define COLS_PER_BYTE 1 // Use 1 for normal mode 13h, 4 for modeX +#define BYTES_PER_ROW 320 // Use 320 for normal mode 13h, 80 for modeX +#define DWORDS_PER_ROW (BYTES_PER_ROW / 4) #define SCREEN_SIZE 64000 // Holds information for the current wall section found during the raycasting process. @@ -47,20 +47,19 @@ // the slice is stored in this structure. typedef struct _slicer { - UCHAR **bMap; // Pointer to wall bitmap found while ray casting - UCHAR *mPtr; // Grid pointer to reference multi-height wall data - short bNumber; // Bitmap number of the wall found - unsigned short bColumn; // Screen column location of the found slice - short Distance; // Distance from the POV to the slice - short mPos; // Position of the slice in the associated map - unsigned char Type; // Indicates if the slice is a wall or object - void (*Fnc)(void); // Pointer to a function to draw wall or object - unsigned char Active; // Indicates last slice in listif a wall or object is displayable or not - // The next two pointers are used if the current slice - // is part of a transparent wall - struct _slicer *Prev; // References the wall slice in front of current slice - struct _slicer *Next; // References the wall slice behind the current slice - } SLICE; + UCHAR **bMap; // Pointer to wall bitmap found while ray casting + UCHAR *mPtr; // Grid pointer to reference multi-height wall data + short bNumber; // Bitmap number of the wall found + unsigned short bColumn; // Screen column location of the found slice + short Distance; // Distance from the POV to the slice + short mPos; // Position of the slice in the associated map + unsigned char Type; // Indicates if the slice is a wall or object + void (*Fnc)(void); // Pointer to a function to draw wall or object + unsigned char Active; // Indicates last slice in listif a wall or object is displayable or not + // The next two pointers are used if the current slice + // is part of a transparent wall + struct _slicer *Prev; // References the wall slice in front of current slice + struct _slicer *Next; // References the wall slice behind the current slice + } SLICE; - \ No newline at end of file diff --git a/ack_lib/ACKEXT.H b/ack_lib/ACKEXT.H index 7337360..8e5eabe 100644 --- a/ack_lib/ACKEXT.H +++ b/ack_lib/ACKEXT.H @@ -1,119 +1,118 @@ -/* ACK-3D ( Animation Construction Kit 3D ) */ +/* ACK-3D ( Animation Construction Kit 3D ) */ -extern UCHAR *BackArray[]; -extern long xPglobal; -extern long yPglobal; -extern long xBegGlobal; -extern long yBegGlobal; -extern long BackDropRows; -extern ACKENG *aeGlobal; -extern USHORT *xGridGlobal; -extern USHORT *yGridGlobal; -extern long xPglobalHI; -extern long yPglobalHI; -extern ULONG *rbaTable; +extern UCHAR *BackArray[]; +extern long xPglobal; +extern long yPglobal; +extern long xBegGlobal; +extern long yBegGlobal; +extern long BackDropRows; +extern ACKENG *aeGlobal; +extern USHORT *xGridGlobal; +extern USHORT *yGridGlobal; +extern long xPglobalHI; +extern long yPglobalHI; +extern ULONG *rbaTable; -extern long bmDistance; +extern long bmDistance; -extern short rsHandle; -extern long LastX1; -extern long LastY1; -extern long iLastX; -extern long iLastY; -extern short MaxDistance; -extern short ErrorCode; -extern short LightFlag; +extern short rsHandle; +extern long LastX1; +extern long LastY1; +extern long iLastX; +extern long iLastY; +extern short MaxDistance; +extern short ErrorCode; +extern short LightFlag; -extern long xMapPosn; -extern long yMapPosn; +extern long xMapPosn; +extern long yMapPosn; -extern short DefZone[]; -extern short AckLightZones[]; -extern UCHAR *HtTable[]; -extern USHORT *Grid; -extern USHORT *ObjGrid; -extern UCHAR HitMap[]; -extern UCHAR *BitmapXferPtr; -extern short TotalSpecial; -extern short DistanceTable[]; -extern long *AdjustTable; -extern short xSecretmPos; -extern short xSecretmPos1; -extern short xSecretColumn; -extern short ySecretmPos; -extern short ySecretmPos1; -extern short ySecretColumn; -extern short TotalSecret; -extern short ViewColumn; -extern long *SinTable; -extern long *CosTable; -extern long *LongTanTable; -extern long *LongInvTanTable; -extern long InvCosTable[]; -extern long InvSinTable[]; -extern long *LongCosTable; -extern long *ViewCosTable; -extern long *xNextTable; -extern long *yNextTable; -extern UCHAR ObjectsSeen[]; -extern UCHAR MoveObjectList[]; -extern short TotalObjects; -extern short FoundObjectCount; -extern short MoveObjectCount; -extern short LastObjectHit; -extern short LastMapPosn; -extern UCHAR ObjNumber[]; -extern USHORT ObjRelDist[]; -extern short ObjColumn[]; -extern short ObjAngle[]; -extern short DirAngle[]; -extern UCHAR LightMap[]; +extern short DefZone[]; +extern short AckLightZones[]; +extern UCHAR *HtTable[]; +extern USHORT *Grid; +extern USHORT *ObjGrid; +extern UCHAR HitMap[]; +extern UCHAR *BitmapXferPtr; +extern short TotalSpecial; +extern short DistanceTable[]; +extern long *AdjustTable; +extern short xSecretmPos; +extern short xSecretmPos1; +extern short xSecretColumn; +extern short ySecretmPos; +extern short ySecretmPos1; +extern short ySecretColumn; +extern short TotalSecret; +extern short ViewColumn; +extern long *SinTable; +extern long *CosTable; +extern long *LongTanTable; +extern long *LongInvTanTable; +extern long InvCosTable[]; +extern long InvSinTable[]; +extern long *LongCosTable; +extern long *ViewCosTable; +extern long *xNextTable; +extern long *yNextTable; +extern UCHAR ObjectsSeen[]; +extern UCHAR MoveObjectList[]; +extern short TotalObjects; +extern short FoundObjectCount; +extern short MoveObjectCount; +extern short LastObjectHit; +extern short LastMapPosn; +extern UCHAR ObjNumber[]; +extern USHORT ObjRelDist[]; +extern short ObjColumn[]; +extern short ObjAngle[]; +extern short DirAngle[]; +extern UCHAR LightMap[]; -extern USHORT FloorMap[]; -extern USHORT CeilMap[]; -extern SLICE Slice[]; -extern USHORT ScreenOffset; -extern short LastFloorAngle; -extern short LastFloorX; -extern short LastFloorY; -extern long Flooru; -extern long Floorv; -extern long Floordu; -extern long Floordv; -extern long Floorkx; -extern long Floorky; -extern long Floorku; -extern long Floorkv; -extern long Floorkdu; -extern long Floorkdv; -extern UCHAR *Floorbm; -extern UCHAR *Floorscr; -extern UCHAR *FloorscrTop; -extern UCHAR *Floorptr2; -extern UCHAR *Floors1; -extern UCHAR *Floors2; -extern long Floorht; -extern long Floorwt; -extern short Floorvht; -extern short Flooreht; -extern short ViewAngle; -extern short ViewHeight; -extern short CeilingHeight; -extern short Resolution; -extern short LastWallHeight; -extern short PlayerAngle; -extern short ViewAngle; -extern USHORT SysFlags; -extern SLICE Slice[]; -extern SLICE *sPtr; -extern UCHAR **WallbMaps; -extern UCHAR *VidTop; -extern UCHAR *VidBottom; -extern short BotRowTable[]; -extern USHORT FloorMap[]; -extern USHORT CeilMap[]; -extern char *scantables[]; +extern USHORT FloorMap[]; +extern USHORT CeilMap[]; +extern SLICE Slice[]; +extern USHORT ScreenOffset; +extern short LastFloorAngle; +extern short LastFloorX; +extern short LastFloorY; +extern long Flooru; +extern long Floorv; +extern long Floordu; +extern long Floordv; +extern long Floorkx; +extern long Floorky; +extern long Floorku; +extern long Floorkv; +extern long Floorkdu; +extern long Floorkdv; +extern UCHAR *Floorbm; +extern UCHAR *Floorscr; +extern UCHAR *FloorscrTop; +extern UCHAR *Floorptr2; +extern UCHAR *Floors1; +extern UCHAR *Floors2; +extern long Floorht; +extern long Floorwt; +extern short Floorvht; +extern short Flooreht; +extern short ViewAngle; +extern short ViewHeight; +extern short CeilingHeight; +extern short Resolution; +extern short LastWallHeight; +extern short PlayerAngle; +extern short ViewAngle; +extern USHORT SysFlags; +extern SLICE Slice[]; +extern SLICE *sPtr; +extern UCHAR **WallbMaps; +extern UCHAR *VidTop; +extern UCHAR *VidBottom; +extern short BotRowTable[]; +extern USHORT FloorMap[]; +extern USHORT CeilMap[]; +extern char *scantables[]; - \ No newline at end of file diff --git a/ack_lib/ACKFLOOR.C b/ack_lib/ACKFLOOR.C index e77ebfd..ff59cb9 100644 --- a/ack_lib/ACKFLOOR.C +++ b/ack_lib/ACKFLOOR.C @@ -1236,4 +1236,3 @@ for (col = BegCol; col < EndCol; col += 2) // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKGIF.C b/ack_lib/ACKGIF.C index 66059b0..3967c7f 100644 --- a/ack_lib/ACKGIF.C +++ b/ack_lib/ACKGIF.C @@ -27,4 +27,3 @@ return(NULL); } // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKIFF.C b/ack_lib/ACKIFF.C index 3ff064d..af32354 100644 --- a/ack_lib/ACKIFF.C +++ b/ack_lib/ACKIFF.C @@ -228,4 +228,3 @@ short iffswab(unsigned short number) // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKINIT.C b/ack_lib/ACKINIT.C index afe1e03..0ce573f 100644 --- a/ack_lib/ACKINIT.C +++ b/ack_lib/ACKINIT.C @@ -367,7 +367,7 @@ else _llseek(handle,rbaTable[(ULONG)fName],SEEK_SET); // Access opened resource file } -aLen = GRID_ARRAY * 2; +aLen = GRID_ARRAY * 2; mLen = GRID_MAX * 2; if (_lread(handle,Grid,mLen) != mLen) // Read in grid map data @@ -448,10 +448,10 @@ return(0); } //ρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρ -// Internal function to create height and distance tables for objects. In +// Internal function to create height and distance tables for objects. In // the DistanceTable[] each entry represents the distance from the player // to a wall. The value stored in the array is the hight of the wall at -// the corresponding distance. For example, DistanceTable[100] indicates +// the corresponding distance. For example, DistanceTable[100] indicates // that the distance to the wall is 100 units. The value stored at this // location is 81--the pixel height f the wall. //ρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρρ @@ -539,4 +539,3 @@ for (i = 0; i < GRID_HEIGHT; i++) // Loop until entire grid has been checked // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKLDBMP.C b/ack_lib/ACKLDBMP.C index d0cd911..9eb4ffe 100644 --- a/ack_lib/ACKLDBMP.C +++ b/ack_lib/ACKLDBMP.C @@ -31,7 +31,7 @@ pos = col * 64; for (i = 0; i < 64; i++) { if (bmp[pos++]) - return(1); + return(1); } return(0); @@ -65,21 +65,21 @@ if (ae->bmLoadType == BMLOAD_BBM) buf = AckReadiff(BitmapName); if (ae->bmLoadType == BMLOAD_GIF) - buf = AckReadgif(BitmapName); + buf = AckReadgif(BitmapName); if (ae->bmLoadType == BMLOAD_PCX) - buf = AckReadPCX(BitmapName); + buf = AckReadPCX(BitmapName); if (buf == NULL) - return(ERR_LOADINGBITMAP); + return(ERR_LOADINGBITMAP); x = (*(short *)buf); y = (*(short *)&buf[2]); if ((x*y) != BITMAP_SIZE) - { - AckFree(buf); - return(ERR_INVALIDFORM); - } + { + AckFree(buf); + return(ERR_INVALIDFORM); + } memmove(buf,&buf[4],BITMAP_SIZE); bFlag = 1; @@ -105,13 +105,13 @@ if (!bFlag) { handle = _lopen(BitmapName,OF_READ); if (handle < 1) - { - AckFree(buf); - AckFree(bmp); - return(ERR_BADFILE); - } + { + AckFree(buf); + AckFree(bmp); + return(ERR_BADFILE); + } - read(handle,buf,4); // Skip width and height for now + read(handle,buf,4); // Skip width and height for now read(handle,buf,BITMAP_SIZE); _lclose(handle); } @@ -121,11 +121,11 @@ for (y = 0; y < BITMAP_HEIGHT; y++) sPos = y; dPos = y * BITMAP_WIDTH; for (x = 0; x < BITMAP_WIDTH; x++) - { - ch = buf[sPos]; - bmp[dPos++] = ch; - sPos += BITMAP_WIDTH; - } + { + ch = buf[sPos]; + bmp[dPos++] = ch; + sPos += BITMAP_WIDTH; + } } @@ -135,7 +135,7 @@ memset(bmpFlags,0,BITMAP_WIDTH); for (x = 0; x < BITMAP_WIDTH; x++) { if (!BlankSlice(x,bmp)) - bmpFlags[x] = 1; + bmpFlags[x] = 1; } @@ -188,7 +188,7 @@ if (ae->ObjList[ObjNumber] == NULL) ae->ObjList[ObjNumber] = (NEWOBJECT *)AckMalloc(sizeof(NEWOBJECT)); if (ae->ObjList[ObjNumber] == NULL) - return(ERR_NOMEMORY); + return(ERR_NOMEMORY); memset(ae->ObjList[ObjNumber],0,sizeof(NEWOBJECT)); } @@ -213,28 +213,28 @@ short AckSetObjectType(ACKENG *ae,short oNum,short oType) switch (oType) { case NO_CREATE: - os = &ae->ObjList[oNum]->Create; - break; + os = &ae->ObjList[oNum]->Create; + break; case NO_DESTROY: - os = &ae->ObjList[oNum]->Destroy; - break; + os = &ae->ObjList[oNum]->Destroy; + break; case NO_WALK: - os = &ae->ObjList[oNum]->Walk; - break; + os = &ae->ObjList[oNum]->Walk; + break; case NO_ATTACK: - os = &ae->ObjList[oNum]->Attack; - break; + os = &ae->ObjList[oNum]->Attack; + break; case NO_INTERACT: - os = &ae->ObjList[oNum]->Interact; - break; + os = &ae->ObjList[oNum]->Interact; + break; default: - result = ERR_BADOBJTYPE; - break; + result = ERR_BADOBJTYPE; + break; } if (!result) @@ -253,16 +253,16 @@ if (ae->ObjList[oNum]->Flags & OF_MOVEABLE) { j = 0; for (i = 0; i < MoveObjectCount; i++) - { - if (MoveObjectList[i] == oNum) - { - j = 1; - break; - } - } + { + if (MoveObjectList[i] == oNum) + { + j = 1; + break; + } + } if (!j) - MoveObjectList[MoveObjectCount++] = oNum; + MoveObjectList[MoveObjectCount++] = oNum; i = (ae->ObjList[oNum]->y & 0xFFC0) + (ae->ObjList[oNum]->x >> 6); ObjGrid[i] = 0; @@ -292,28 +292,28 @@ if (os->flags & OF_MULTIVIEW) switch (oType) { case NO_CREATE: - memmove(&ae->ObjList[oNum]->Create,os,sizeof(OBJSEQ)); - break; + memmove(&ae->ObjList[oNum]->Create,os,sizeof(OBJSEQ)); + break; case NO_DESTROY: - memmove(&ae->ObjList[oNum]->Destroy,os,sizeof(OBJSEQ)); - break; + memmove(&ae->ObjList[oNum]->Destroy,os,sizeof(OBJSEQ)); + break; case NO_WALK: - memmove(&ae->ObjList[oNum]->Walk,os,sizeof(OBJSEQ)); - break; + memmove(&ae->ObjList[oNum]->Walk,os,sizeof(OBJSEQ)); + break; case NO_ATTACK: - memmove(&ae->ObjList[oNum]->Attack,os,sizeof(OBJSEQ)); - break; + memmove(&ae->ObjList[oNum]->Attack,os,sizeof(OBJSEQ)); + break; case NO_INTERACT: - memmove(&ae->ObjList[oNum]->Interact,os,sizeof(OBJSEQ)); - break; + memmove(&ae->ObjList[oNum]->Interact,os,sizeof(OBJSEQ)); + break; default: - result = ERR_BADOBJTYPE; - break; + result = ERR_BADOBJTYPE; + break; } if (!result && ae->ObjList[oNum]->CurrentBitmaps == NULL) @@ -324,4 +324,3 @@ return(result); // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKOBJ.C b/ack_lib/ACKOBJ.C index 17b6048..e8ffc80 100644 --- a/ack_lib/ACKOBJ.C +++ b/ack_lib/ACKOBJ.C @@ -25,8 +25,8 @@ extern void (*WallMaskRtn)(void); //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± // Internal function called by FindObject(). Your programs may call this -// function if they need to calculate the angle between two points. dx and -// dy represent the deltas between the two points. (i.e. dx = x1 - x and +// function if they need to calculate the angle between two points. dx and +// dy represent the deltas between the two points. (i.e. dx = x1 - x and // dy = y1 - y) // // Quadrants @@ -40,7 +40,7 @@ extern void (*WallMaskRtn)(void); // positive. // // The angle between the two points is determined by using the formula: -// tan (angle) = dy/dx. The look-up table LongTanTable[] is used to +// tan (angle) = dy/dx. The look-up table LongTanTable[] is used to // access tangent values of angles. //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± short AckGetObjectAngle(long dx,long dy) @@ -88,7 +88,7 @@ if (dx < 0) // as used in our tangent table. Then, we divide dy by dx (rise/run) // to get the ratio so we can determine the tangent of the angle between // the two pints. We use the ratio to search the tangent table -// and the index that is returned tells us what the actual angle is. +// and the index that is returned tells us what the actual angle is. // We only need to check angles from 0 to 90 degrees. Later, the angle // will be adjusted to take into account which quadrant we are in. //======================================================================= @@ -101,8 +101,8 @@ objAngle = 0; // Initialize angle to 0 //============================================================================= // Now we use a binary lookup trick to speed up the search. This invloves -// a test to see if the angle is between o and 45 degrees or between 45 and -// 90 degrees. Then, we search the list sequentially to find the first value +// a test to see if the angle is between o and 45 degrees or between 45 and +// 90 degrees. Then, we search the list sequentially to find the first value // higher than our ratio. //============================================================================= Beg = 0; // Assume midpoint between 0 and 45 degrees @@ -166,7 +166,7 @@ for (i = 0; i < 16; i++) { result += result; high = (high << 2) | ((low >>30) & 0x3); - low <<= 2; // Shift left by 2 + low <<= 2; // Shift left by 2 tmp = result + result + 1; if (high >= tmp) { @@ -373,7 +373,7 @@ if (FoundObjectCount) // Make sure objects were found during ray casting ObjNum = oPtr->CurrentBitmaps[j]; } - // Done processing multiple sides. Next, find the + // Done processing multiple sides. Next, find the // ending column based on the starting column plus the scaled // width of the object. ColEnd = NewX + wt; @@ -383,7 +383,7 @@ if (FoundObjectCount) // Make sure objects were found during ray casting bmpFlags = &wall[BITMAP_SIZE]; j = distance; - // Loop from starting column to ending column and fold in the + // Loop from starting column to ending column and fold in the // object into the appropriate slice structure. for (Column = NewX - wt; Column < ColEnd; Column++) { @@ -430,9 +430,9 @@ if (FoundObjectCount) // Make sure objects were found during ray casting } // Fill in the slice structure with the // info about the object - sa->Distance = distance; - sa->bNumber = ObjNum; - sa->bColumn = BmpColumn; + sa->Distance = distance; + sa->bNumber = ObjNum; + sa->bColumn = BmpColumn; sa->bMap = omaps; sa->Active = 1; sa->Type = ST_OBJECT; diff --git a/ack_lib/ACKOVER.C b/ack_lib/ACKOVER.C index 38bbab8..195e515 100644 --- a/ack_lib/ACKOVER.C +++ b/ack_lib/ACKOVER.C @@ -33,25 +33,25 @@ sPos = vPos; while (vLen > 0) { if (sBuf[sPos]) - { - sPos1 = sPos; - while (vLen > 0 && sBuf[sPos1++]) - vLen--; + { + sPos1 = sPos; + while (vLen > 0 && sBuf[sPos1++]) + vLen--; - len = (sPos1 - sPos) - 1; - (*(short *)&ae->ScreenBuffer[bPos]) = len; - bPos += 2; - (*(short *)&ae->ScreenBuffer[bPos]) = sPos; - bPos += 2; - memmove(&ae->ScreenBuffer[bPos],&sBuf[sPos],len); - bPos += len; - sPos = sPos1; - } + len = (sPos1 - sPos) - 1; + (*(short *)&ae->ScreenBuffer[bPos]) = len; + bPos += 2; + (*(short *)&ae->ScreenBuffer[bPos]) = sPos; + bPos += 2; + memmove(&ae->ScreenBuffer[bPos],&sBuf[sPos],len); + bPos += len; + sPos = sPos1; + } else - { - sPos++; - vLen--; - } + { + sPos++; + vLen--; + } } (*(short *)&ae->ScreenBuffer[bPos]) = 0; @@ -70,4 +70,3 @@ return(ERR_NOMEMORY); // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKPCX.C b/ack_lib/ACKPCX.C index 6a9dabd..ee8d6a3 100644 --- a/ack_lib/ACKPCX.C +++ b/ack_lib/ACKPCX.C @@ -159,4 +159,3 @@ return(pcx->bitmap); // return bitmap buffer // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKPOV.C b/ack_lib/ACKPOV.C index 3d9ceee..b5de49f 100644 --- a/ack_lib/ACKPOV.C +++ b/ack_lib/ACKPOV.C @@ -18,7 +18,7 @@ //************************************************************************ // Internal function called by AckMovePOV(). Checks the passed X and Y -// coordinates of the player against the object coordinates to see if the player will +// coordinates of the player against the object coordinates to see if the player will // encouner an object. //************************************************************************ short AckCheckObjPosn(short xPlayer,short yPlayer, short oIndex) @@ -28,7 +28,7 @@ short AckCheckObjPosn(short xPlayer,short yPlayer, short oIndex) NEWOBJECT **oList; NEWOBJECT *oPtr; -result = POV_NOTHING; // Initialize to nothing found +result = POV_NOTHING; // Initialize to nothing found MapPosn = (yPlayer & 0xFFC0) + (xPlayer >> 6); // Calculate grid square the player will be in maxObj = aeGlobal->MaxObjects; // Total number of objects used oList = &aeGlobal->ObjList[0]; // Reference the list of objects @@ -37,16 +37,16 @@ for (i = 0; i < maxObj; i++) // Loop and { oPtr = oList[i]; // Point to current object if (oPtr == NULL) // No object here; skip to next object in list - continue; + continue; if (!oPtr->Active || oPtr->Flags & OF_PASSABLE) // Object is not active or is passable - continue; // Skip to next object in list + continue; // Skip to next object in list if (MapPosn == oPtr->mPos && i != oIndex) // Object is found in the player's grid position - { - LastObjectHit = i; // Store the number of the object found - return(POV_OBJECT); // Return flag to indicate an object is found - } + { + LastObjectHit = i; // Store the number of the object found + return(POV_OBJECT); // Return flag to indicate an object is found + } } return(result); } @@ -64,7 +64,7 @@ USHORT GetWallX(short mPos) mCode = xGridGlobal[mPos]; // Get bitmap code at specified map position if (mCode & WALL_TYPE_PASS) // Passable walls can be walked through - mCode = 0; + mCode = 0; return(mCode); } @@ -114,52 +114,52 @@ y1 = yp + (long)((SinTable[Angle] * Amount) >> FP_SHIFT); mPos = yTop + (xp >> 6); // Current Map Posn // It's time to see what happens when we move -if (x1 < xp) // Are we moving left? +if (x1 < xp) // Are we moving left? { - if (GetWallX(mPos)) // Wall found in current square (left edge) - { - if (x1 < xLeft || abs(x1-xLeft) < 28) // We crossed the wall or we're too close - { - x1 = xp; // Use the previous x position - HitResult = POV_SLIDEX; // We're possibly sliding along the left x wall - } - } - } - -if (x1 > xp) // Are we moving right? - { - if (GetWallX(mPos+1)) // Wall found in current square (right edge) + if (GetWallX(mPos)) // Wall found in current square (left edge) { - if (x1 > xRight || abs(xRight-x1) < 28) // We crossed the wall or we're too close - { - x1 = xp; // Use the previous x position - HitResult = POV_SLIDEX; // We're possibly sliding along the right x wall - } - } + if (x1 < xLeft || abs(x1-xLeft) < 28) // We crossed the wall or we're too close + { + x1 = xp; // Use the previous x position + HitResult = POV_SLIDEX; // We're possibly sliding along the left x wall + } + } } -if (y1 < yp) // Are we moving up? +if (x1 > xp) // Are we moving right? { - if (GetWallY(mPos)) // Wall found in current square (top edge) - { - if (y1 < yTop || abs(y1-yTop) < 28) // We crossed the wall or we're too close - { - y1 = yp; // Use the previous y position - HitResult = POV_SLIDEY; // We're possibly sliding along the top wall - } - } + if (GetWallX(mPos+1)) // Wall found in current square (right edge) + { + if (x1 > xRight || abs(xRight-x1) < 28) // We crossed the wall or we're too close + { + x1 = xp; // Use the previous x position + HitResult = POV_SLIDEX; // We're possibly sliding along the right x wall + } + } } -if (y1 > yp) // Are we moving down? +if (y1 < yp) // Are we moving up? + { + if (GetWallY(mPos)) // Wall found in current square (top edge) + { + if (y1 < yTop || abs(y1-yTop) < 28) // We crossed the wall or we're too close + { + y1 = yp; // Use the previous y position + HitResult = POV_SLIDEY; // We're possibly sliding along the top wall + } + } + } + +if (y1 > yp) // Are we moving down? { if (GetWallY(mPos+GRID_WIDTH)) // Wall found in current square (bottom edge) - { - if (y1 > yBottom || abs(yBottom-y1) < 28) // We crossed the wall or we're too close - { - y1 = yp; // Use the previous y position - HitResult = POV_SLIDEY; // We're sliding along the bottom wall - } - } + { + if (y1 > yBottom || abs(yBottom-y1) < 28) // We crossed the wall or we're too close + { + y1 = yp; // Use the previous y position + HitResult = POV_SLIDEY; // We're sliding along the bottom wall + } + } } // A wall or object hasn't been hit yet--we must look further. @@ -171,46 +171,46 @@ if (y1 > yp) // Are we moving down? if (!HitResult) { // Check region A--top left area of grid if (y1 < (yTop+32)) // New y position falls in top half - { - if (x1 < (xLeft+32)) // New x position falls in left half - { - mCodeX = GetWallX(mPos-GRID_WIDTH); // Check adjacent x wall (to left) - mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above) + { + if (x1 < (xLeft+32)) // New x position falls in left half + { + mCodeX = GetWallX(mPos-GRID_WIDTH); // Check adjacent x wall (to left) + mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above) - if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord - { // is within 28 units - if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge - { - if (xp > (xLeft+27)) // Previous x position was outside range - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - } - } + if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord + { // is within 28 units + if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge + { + if (xp > (xLeft+27)) // Previous x position was outside range + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord. - { // is within 28 units - if (y1 < (yTop+28)) // New y coord. is within 28 units of edge - { - if (yp > (yTop+27)) // Previous y position was outside range - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - } - } - } + if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord. + { // is within 28 units + if (y1 < (yTop+28)) // New y coord. is within 28 units of edge + { + if (yp > (yTop+27)) // Previous y position was outside range + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + } + } + } // Check region B--top right area if (x1 > (xRight-32) && !HitResult)// New x is at top right { @@ -219,122 +219,122 @@ if (!HitResult) if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found { - if (x1 > (xRight-28)) - { - if (xp < (xRight-27)) - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - } - } + if (x1 > (xRight-28)) + { + if (xp < (xRight-27)) + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found - { - if (y1 < (yTop+28)) - { - if (yp > (yTop+27)) - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - } - } - } - } + if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found + { + if (y1 < (yTop+28)) + { + if (yp > (yTop+27)) + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + } + } + } + } // Check region C--bottom left area if (y1 > (yTop+32) && !HitResult) // We are below upper half of square - { - if (x1 < (xLeft+32)) // and on the left half of square - { - mCodeX = GetWallX(mPos+GRID_WIDTH); // Check adjacent x wall (to left) - mCodeY = GetWallY(mPos-1+GRID_WIDTH); // Check adjacent y wall (below) + { + if (x1 < (xLeft+32)) // and on the left half of square + { + mCodeX = GetWallX(mPos+GRID_WIDTH); // Check adjacent x wall (to left) + mCodeY = GetWallY(mPos-1+GRID_WIDTH); // Check adjacent y wall (below) - if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found - { - if (x1 < (xLeft+28)) - { - if (xp > (xLeft+27)) - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - } - } + if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found + { + if (x1 < (xLeft+28)) + { + if (xp > (xLeft+27)) + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found - { - if (y1 > (yBottom-28)) - { - if (yp < (yBottom-27)) - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - } - } - } + if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found + { + if (y1 > (yBottom-28)) + { + if (yp < (yBottom-27)) + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + } + } + } // Check region D--bottom right area - if (x1 > (xRight-32) && !HitResult) // Check right side of square - { - mCodeX = GetWallX(mPos+1+GRID_WIDTH); // Check adjacent x wall (to right) - mCodeY = GetWallY(mPos+1+GRID_WIDTH); // Check adjacent y wall (below) + if (x1 > (xRight-32) && !HitResult) // Check right side of square + { + mCodeX = GetWallX(mPos+1+GRID_WIDTH); // Check adjacent x wall (to right) + mCodeY = GetWallY(mPos+1+GRID_WIDTH); // Check adjacent y wall (below) - if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found - { - if (x1 > (xRight-28)) - { - if (xp < (xRight-27)) - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - } - } + if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found + { + if (x1 > (xRight-28)) + { + if (xp < (xRight-27)) + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found - { - if (y1 > (yBottom-28)) - { - if (yp < (yBottom-27)) - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - } - } - } - } + if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found + { + if (y1 > (yBottom-28)) + { + if (yp < (yBottom-27)) + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + } + } + } + } } if (AckCheckObjPosn(x1,y1,0)) // We've hit an object--not a wall @@ -364,7 +364,7 @@ short AckMoveObjectPOV(short ObjIndex,short Angle,short Amount) short xLeft,xRight,yTop,yBottom,mPos; short MapPosn,PlayerPosn; NEWOBJECT **oList; - NEWOBJECT *oPtr; + NEWOBJECT *oPtr; oList = &aeGlobal->ObjList[0]; // Reference the start of the object list oPtr = oList[ObjIndex]; // Set a pointer to the object being moved @@ -383,7 +383,7 @@ xRight = xLeft + GRID_SIZE - 1; // object is currently in yTop = yp & 0xFFC0; yBottom = yTop + GRID_SIZE - 1; mPos = yTop + (xp >> 6); // Calculate the map position of the grid square the object is in -MapPosn = (y1 & 0xFFC0) + (x1 >> 6); // Calculate the map position of the grid square the +MapPosn = (y1 & 0xFFC0) + (x1 >> 6); // Calculate the map position of the grid square the // object is moving to // Check to see if the object will encouner another object while moving @@ -392,221 +392,221 @@ if (oNum > 0) // Yes, return(POV_OBJECT); HitResult = POV_NOTHING; // Nothing found yet, initialize flag -if (x1 < xp) // Are we moving left? +if (x1 < xp) // Are we moving left? { - if (GetWallX(mPos)) // Wall found in current square (left edge) - { - if (x1 < xLeft || abs(x1-xLeft) < 28) // We crossed the wall or we're too close - { - x1 = xp; // Use the previous x position - HitResult = POV_SLIDEX; // We're possibly sliding along the left x wall - } - } + if (GetWallX(mPos)) // Wall found in current square (left edge) + { + if (x1 < xLeft || abs(x1-xLeft) < 28) // We crossed the wall or we're too close + { + x1 = xp; // Use the previous x position + HitResult = POV_SLIDEX; // We're possibly sliding along the left x wall + } + } } -if (x1 > xp) // Are we moving right? +if (x1 > xp) // Are we moving right? { - if (GetWallX(mPos+1)) // Wall found in current square (right edge) - { - if (x1 > xRight || abs(xRight-x1) < 28) // We crossed the wall or we're too close - { - x1 = xp; // Use the previous x position - HitResult = POV_SLIDEX; // We're possibly sliding along the right x wall - } - } + if (GetWallX(mPos+1)) // Wall found in current square (right edge) + { + if (x1 > xRight || abs(xRight-x1) < 28) // We crossed the wall or we're too close + { + x1 = xp; // Use the previous x position + HitResult = POV_SLIDEX; // We're possibly sliding along the right x wall + } + } } -if (y1 < yp) // Are we moving up? +if (y1 < yp) // Are we moving up? { - if (GetWallY(mPos)) // Wall found in current square (top edge) - { - if (y1 < yTop || abs(y1-yTop) < 28) // We crossed the wall or we're too close - { - y1 = yp; // Use the previous y position - HitResult = POV_SLIDEY; // We're possibly sliding along the top wall - } - } + if (GetWallY(mPos)) // Wall found in current square (top edge) + { + if (y1 < yTop || abs(y1-yTop) < 28) // We crossed the wall or we're too close + { + y1 = yp; // Use the previous y position + HitResult = POV_SLIDEY; // We're possibly sliding along the top wall + } + } } -if (y1 > yp) // Are we moving down? +if (y1 > yp) // Are we moving down? { - if (GetWallY(mPos+GRID_WIDTH)) // Wall found in current square (bottom edge) - { - if (y1 > yBottom || abs(yBottom-y1) < 28) // We crossed the wall or we're too close - { - y1 = yp; // Use the previous y position - HitResult = POV_SLIDEY; // We're sliding along the bottom wall - } - } + if (GetWallY(mPos+GRID_WIDTH)) // Wall found in current square (bottom edge) + { + if (y1 > yBottom || abs(yBottom-y1) < 28) // We crossed the wall or we're too close + { + y1 = yp; // Use the previous y position + HitResult = POV_SLIDEY; // We're sliding along the bottom wall + } + } } -if (!HitResult) // Nothing hit yet, look further +if (!HitResult) // Nothing hit yet, look further { - if (y1 < (yTop+32)) // We are above upper half of square - { - if (x1 < (xLeft+32)) // and on the left half of square - { - mCodeX = GetWallX(mPos-GRID_WIDTH); // Check adjacent x wall (to left) - mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above) + if (y1 < (yTop+32)) // We are above upper half of square + { + if (x1 < (xLeft+32)) // and on the left half of square + { + mCodeX = GetWallX(mPos-GRID_WIDTH); // Check adjacent x wall (to left) + mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above) - if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord - { // is within 28 units - if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge - { - if (xp > (xLeft+27)) // Previous x position was outside range - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - } - } + if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord + { // is within 28 units + if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge + { + if (xp > (xLeft+27)) // Previous x position was outside range + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord. - { // is within 28 units - if (y1 < (yTop+28)) // New y coord. is within 28 units of edge - { - if (yp > (yTop+27)) // Previous y position was outside range - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - } - } - } + if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord. + { // is within 28 units + if (y1 < (yTop+28)) // New y coord. is within 28 units of edge + { + if (yp > (yTop+27)) // Previous y position was outside range + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + } + } + } - if (x1 > (xRight-32) && !HitResult) // New x is at top right - { - mCodeX = GetWallX(mPos+1-GRID_WIDTH); // Check adjacent x wall (to right) - mCodeY = GetWallY(mPos+1); // Check adjacent y wall (above) + if (x1 > (xRight-32) && !HitResult) // New x is at top right + { + mCodeX = GetWallX(mPos+1-GRID_WIDTH); // Check adjacent x wall (to right) + mCodeY = GetWallY(mPos+1); // Check adjacent y wall (above) - if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found - { - if (x1 > (xRight-28)) - { - if (xp < (xRight-27)) - { - x1 = xp; // Use previous x position - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - } - } + if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found + { + if (x1 > (xRight-28)) + { + if (xp < (xRight-27)) + { + x1 = xp; // Use previous x position + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found - { - if (y1 < (yTop+28)) - { - if (yp > (yTop+27)) - { - y1 = yp; // Use previous y position - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; - HitResult = POV_SLIDEX; - } - } - } - } - } + if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found + { + if (y1 < (yTop+28)) + { + if (yp > (yTop+27)) + { + y1 = yp; // Use previous y position + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; + HitResult = POV_SLIDEX; + } + } + } + } + } - if (y1 > (yTop+32) && !HitResult) // We are below upper half of square - { - if (x1 < (xLeft+32)) // and on the left half of square - { - mCodeX = GetWallX(mPos+GRID_WIDTH); - mCodeY = GetWallY(mPos-1+GRID_WIDTH); + if (y1 > (yTop+32) && !HitResult) // We are below upper half of square + { + if (x1 < (xLeft+32)) // and on the left half of square + { + mCodeX = GetWallX(mPos+GRID_WIDTH); + mCodeY = GetWallY(mPos-1+GRID_WIDTH); - if (mCodeX && y1 > (yBottom-28)) - { - if (x1 < (xLeft+28)) - { - if (xp > (xLeft+27)) - { - x1 = xp; - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; - HitResult = POV_SLIDEY; - } - } - } + if (mCodeX && y1 > (yBottom-28)) + { + if (x1 < (xLeft+28)) + { + if (xp > (xLeft+27)) + { + x1 = xp; + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 < (xLeft+28)) - { - if (y1 > (yBottom-28)) - { - if (yp < (yBottom-27)) - { - y1 = yp; - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; - HitResult = POV_SLIDEX; - } - } - } - } + if (mCodeY && x1 < (xLeft+28)) + { + if (y1 > (yBottom-28)) + { + if (yp < (yBottom-27)) + { + y1 = yp; + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; + HitResult = POV_SLIDEX; + } + } + } + } - if (x1 > (xRight-32) && !HitResult) // on right side of square - { - mCodeX = GetWallX(mPos+1+GRID_WIDTH); - mCodeY = GetWallY(mPos+1+GRID_WIDTH); + if (x1 > (xRight-32) && !HitResult) // on right side of square + { + mCodeX = GetWallX(mPos+1+GRID_WIDTH); + mCodeY = GetWallY(mPos+1+GRID_WIDTH); - if (mCodeX && y1 > (yBottom-28)) - { - if (x1 > (xRight-28)) - { - if (xp < (xRight-27)) - { - x1 = xp; - HitResult = POV_SLIDEX; - } - else - { - y1 = yp; - HitResult = POV_SLIDEY; - } - } - } + if (mCodeX && y1 > (yBottom-28)) + { + if (x1 > (xRight-28)) + { + if (xp < (xRight-27)) + { + x1 = xp; + HitResult = POV_SLIDEX; + } + else + { + y1 = yp; + HitResult = POV_SLIDEY; + } + } + } - if (mCodeY && x1 > (xRight-28)) - { - if (y1 > (yBottom-28)) - { - if (yp < (yBottom-27)) - { - y1 = yp; - HitResult = POV_SLIDEY; - } - else - { - x1 = xp; - HitResult = POV_SLIDEX; - } - } - } - } - } + if (mCodeY && x1 > (xRight-28)) + { + if (y1 > (yBottom-28)) + { + if (yp < (yBottom-27)) + { + y1 = yp; + HitResult = POV_SLIDEY; + } + else + { + x1 = xp; + HitResult = POV_SLIDEX; + } + } + } + } + } } oPtr->x = x1; // Update the new x,y coordinates for the object @@ -630,7 +630,7 @@ void AckCheckObjectMovement(void) short i,maxObj; short dx; NEWOBJECT **oList; - NEWOBJECT *oPtr; + NEWOBJECT *oPtr; maxObj = aeGlobal->MaxObjects; // Get the number of objects used oList = &aeGlobal->ObjList[0]; // Reference the list of objects @@ -639,33 +639,32 @@ for (i = 1; i < maxObj; i++) // Loop to check each object in { oPtr = oList[i]; // Access current object in list if (oPtr == NULL) // No object here; skip - continue; + continue; if (!oPtr->Active) // Object is not active; skip - continue; + continue; if (!oPtr->Speed) // Object has no speed setting; skip - continue; + continue; if (!(oPtr->Flags & OF_ANIMATE)) // Object is not set up for animation - continue; + continue; dx = oPtr->CurrentBm + 1; // Use the next bitmap if (dx >= oPtr->Maxbm) // We're at the end of the list of bitmaps - { - if (oPtr->Flags & OF_ANIMONCE) // Object should only be animated once - { - oPtr->Flags &= ~OF_ANIMATE; // Reset flags to indicate that we're done - oPtr->Flags |= OF_ANIMDONE; // animating the object - dx = oPtr->CurrentBm; // Keep current bitmap number - } - else - dx = 0; // Start at the beginning of the set of bitmaps - } + { + if (oPtr->Flags & OF_ANIMONCE) // Object should only be animated once + { + oPtr->Flags &= ~OF_ANIMATE; // Reset flags to indicate that we're done + oPtr->Flags |= OF_ANIMDONE; // animating the object + dx = oPtr->CurrentBm; // Keep current bitmap number + } + else + dx = 0; // Start at the beginning of the set of bitmaps + } oPtr->CurrentBm = dx; // Store the next bitmap as the current one } } // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKRAY.C b/ack_lib/ACKRAY.C index e1f216f..966e421 100644 --- a/ack_lib/ACKRAY.C +++ b/ack_lib/ACKRAY.C @@ -1,6 +1,6 @@ //****************** ( Animation Construction Kit 3D ) ********************** -// Ray Casting Routines -// CopyRight (c) 1993 Author: Lary Myers +// Ray Casting Routines +// CopyRight (c) 1993 Author: Lary Myers //*************************************************************************** #include @@ -16,7 +16,7 @@ #include "ackeng.h" #include "ackext.h" -extern short ViewAngle; +extern short ViewAngle; //************************************************************************** // @@ -32,14 +32,14 @@ if (!FoundObjectCount) for (i = 0; i < FoundObjectCount; i++) { if (ObjectsSeen[i] == onum) - return(1); + return(1); } 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; //************************************************************************* // @@ -52,12 +52,12 @@ x_yNext = yNextTable[ViewAngle]; // PreCalc'd value of BITMAP_WIDTH * Tan(angle if (ViewAngle > INT_ANGLE_270 || ViewAngle < INT_ANGLE_90) { x_xPos = xBegGlobal + BITMAP_WIDTH; // Looking to the right - x_xNext = BITMAP_WIDTH; // Positive direction + x_xNext = BITMAP_WIDTH; // Positive direction } else { - x_xPos = xBegGlobal; // Looking to the left - x_xNext = -BITMAP_WIDTH; // Negative direction + x_xPos = xBegGlobal; // Looking to the left + x_xNext = -BITMAP_WIDTH; // Negative direction x_yNext = -x_yNext; } @@ -86,72 +86,72 @@ UINT xRayCast(void) while (1) { if (x_xPos < 0 || x_xPos > GRID_XMAX || - x_yPos < 0 || x_yPos > GRID_YMAXLONG) - break; + x_yPos < 0 || x_yPos > GRID_YMAXLONG) + break; -//************* Fixed point Y/64 * 64 X / 64 ********** +//************* Fixed point Y/64 * 64 X / 64 ********** MapPosn = ((x_yPos >> FP_SHIFT) & 0xFFC0) + (x_xPos >> 6); if ((Color = ObjGrid[MapPosn]) != 0) - { - Color &= 0x7F; - if (!ObjectExist(Color)) - ObjectsSeen[FoundObjectCount++] = Color; + { + Color &= 0x7F; + if (!ObjectExist(Color)) + ObjectsSeen[FoundObjectCount++] = Color; - } + } // Check to see if a wall is being struck by the ray if ((Color = xGridGlobal[MapPosn]) != 0) - { - xMapPosn = MapPosn; // Hold onto the map location - iLastX = x_xPos; - LastY1 = x_yPos; - if ((Color & 0xFF) == DOOR_XCODE) // Is this a door? - { - yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side - xd = yd + BITMAP_WIDTH; // And the right side - ObjDist = (x_yPos + (x_yNext >> 1)) >> FP_SHIFT; // Calc door distance - if (ObjDist < yd || ObjDist > xd) // Is door visible? - { - x_xPos += x_xNext; // Nope, continue casting - x_yPos += x_yNext; // the ray as before - continue; - } + { + xMapPosn = MapPosn; // Hold onto the map location + iLastX = x_xPos; + LastY1 = x_yPos; + if ((Color & 0xFF) == DOOR_XCODE) // Is this a door? + { + yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side + xd = yd + BITMAP_WIDTH; // And the right side + ObjDist = (x_yPos + (x_yNext >> 1)) >> FP_SHIFT; // Calc door distance + if (ObjDist < yd || ObjDist > xd) // Is door visible? + { + x_xPos += x_xNext; // Nope, continue casting + x_yPos += x_yNext; // the ray as before + continue; + } - LastY1 = x_yPos + (x_yNext >> 1); // Adjust the X,Y values so - iLastX += (x_xNext >> 1); // the door is halfway in sq. - } + LastY1 = x_yPos + (x_yNext >> 1); // Adjust the X,Y values so + iLastX += (x_xNext >> 1); // the door is halfway in sq. + } - if (Color & DOOR_TYPE_SECRET) - { - if (xSecretColumn != 0) - { - sy = xSecretColumn * LongTanTable[ViewAngle]; - ObjDist = (x_yPos + sy) >> FP_SHIFT; - yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side - xd = yd + BITMAP_WIDTH; // And the right side - if (ObjDist < yd || ObjDist > xd) // Is door visible? - { - x_xPos += x_xNext; // Nope, continue casting - x_yPos += x_yNext; // the ray as before - continue; - } - LastY1 = x_yPos + sy; - iLastX += xSecretColumn; - } - } + if (Color & DOOR_TYPE_SECRET) + { + if (xSecretColumn != 0) + { + sy = xSecretColumn * LongTanTable[ViewAngle]; + ObjDist = (x_yPos + sy) >> FP_SHIFT; + yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side + xd = yd + BITMAP_WIDTH; // And the right side + if (ObjDist < yd || ObjDist > xd) // Is door visible? + { + x_xPos += x_xNext; // Nope, continue casting + x_yPos += x_yNext; // the ray as before + continue; + } + LastY1 = x_yPos + sy; + iLastX += xSecretColumn; + } + } - return(Color); - } - - x_xPos += x_xNext; // Next X coordinate (fixed at 64 or -64) - x_yPos += x_yNext; // Next calculated Y coord for a delta of X + return(Color); } -return(0); // Return that no wall was found + x_xPos += x_xNext; // Next X coordinate (fixed at 64 or -64) + x_yPos += x_yNext; // Next calculated Y coord for a delta of X + } + +return(0); // Return that no wall was found } @@ -175,17 +175,17 @@ UINT OldxRay(void) long xd,yd,sy; long ObjDist; -yNext = yNextTable[ViewAngle]; // PreCalc'd value of BITMAP_WIDTH * Tan(angle) +yNext = yNextTable[ViewAngle]; // PreCalc'd value of BITMAP_WIDTH * Tan(angle) if (ViewAngle > INT_ANGLE_270 || ViewAngle < INT_ANGLE_90) { - xPos = xBegGlobal + BITMAP_WIDTH; // Looking to the right - xNext = BITMAP_WIDTH; // Positive direction + xPos = xBegGlobal + BITMAP_WIDTH; // Looking to the right + xNext = BITMAP_WIDTH; // Positive direction } else { - xPos = xBegGlobal; // Looking to the left - xNext = -BITMAP_WIDTH; // Negative direction + xPos = xBegGlobal; // Looking to the left + xNext = -BITMAP_WIDTH; // Negative direction yNext = -yNext; } @@ -195,72 +195,72 @@ yPos = (((long)xPos - (long)xPglobal) * LongTanTable[ViewAngle]) + yPglobalHI; while (1) { if (xPos < 0 || xPos > GRID_XMAX || - yPos < 0 || yPos > GRID_YMAXLONG) - break; + yPos < 0 || yPos > GRID_YMAXLONG) + break; -//************* Fixed point Y/64 * 64 X / 64 *********** +//************* Fixed point Y/64 * 64 X / 64 *********** MapPosn = ((yPos >> FP_SHIFT) & 0xFFC0) + (xPos >> 6); if ((Color = ObjGrid[MapPosn]) != 0) - { - Color &= 0x7F; - if (!ObjectExist(Color)) - ObjectsSeen[FoundObjectCount++] = Color; + { + Color &= 0x7F; + if (!ObjectExist(Color)) + ObjectsSeen[FoundObjectCount++] = Color; - } + } // Check to see if a wall is being struck by the ray if ((Color = xGridGlobal[MapPosn]) != 0) - { - xMapPosn = MapPosn; // Hold onto the map location - iLastX = xPos; - LastY1 = yPos; - if ((Color & 0xFF) == DOOR_XCODE) // Is this a door? - { - yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side - xd = yd + BITMAP_WIDTH; // And the right side - ObjDist = (yPos + (yNext >> 1)) >> FP_SHIFT; // Calc door distance - if (ObjDist < yd || ObjDist > xd) // Is door visible? - { - xPos += xNext; // Nope, continue casting - yPos += yNext; // the ray as before - continue; - } + { + xMapPosn = MapPosn; // Hold onto the map location + iLastX = xPos; + LastY1 = yPos; + if ((Color & 0xFF) == DOOR_XCODE) // Is this a door? + { + yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side + xd = yd + BITMAP_WIDTH; // And the right side + ObjDist = (yPos + (yNext >> 1)) >> FP_SHIFT; // Calc door distance + if (ObjDist < yd || ObjDist > xd) // Is door visible? + { + xPos += xNext; // Nope, continue casting + yPos += yNext; // the ray as before + continue; + } - LastY1 = yPos + (yNext >> 1); // Adjust the X,Y values so - iLastX += (xNext >> 1); // the door is halfway in sq. - } + LastY1 = yPos + (yNext >> 1); // Adjust the X,Y values so + iLastX += (xNext >> 1); // the door is halfway in sq. + } - if (Color & DOOR_TYPE_SECRET) - { - if (xSecretColumn != 0) - { - sy = xSecretColumn * LongTanTable[ViewAngle]; - ObjDist = (yPos + sy) >> FP_SHIFT; - yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side - xd = yd + BITMAP_WIDTH; // And the right side - if (ObjDist < yd || ObjDist > xd) // Is door visible? - { - xPos += xNext; // Nope, continue casting - yPos += yNext; // the ray as before - continue; - } - LastY1 = yPos + sy; - iLastX += xSecretColumn; - } - } + if (Color & DOOR_TYPE_SECRET) + { + if (xSecretColumn != 0) + { + sy = xSecretColumn * LongTanTable[ViewAngle]; + ObjDist = (yPos + sy) >> FP_SHIFT; + yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side + xd = yd + BITMAP_WIDTH; // And the right side + if (ObjDist < yd || ObjDist > xd) // Is door visible? + { + xPos += xNext; // Nope, continue casting + yPos += yNext; // the ray as before + continue; + } + LastY1 = yPos + sy; + iLastX += xSecretColumn; + } + } - return(Color); - } - - xPos += xNext; // Next X coordinate (fixed at 64 or -64) - yPos += yNext; // Next calculated Y coord for a delta of X + return(Color); } -return(0); // Return that no wall was found + xPos += xNext; // Next X coordinate (fixed at 64 or -64) + yPos += yNext; // Next calculated Y coord for a delta of X + } + +return(0); // Return that no wall was found } @@ -275,12 +275,12 @@ y_xNext = xNextTable[ViewAngle]; // Pre-calc'd value of BITMAP_WIDTH / tan(angl if (ViewAngle < INT_ANGLE_180) { y_yPos = yBegGlobal + BITMAP_WIDTH; // Looking down - y_yNext = BITMAP_WIDTH; // Positive direction + y_yNext = BITMAP_WIDTH; // Positive direction } else { - y_yPos = yBegGlobal; // Looking up - y_yNext = -BITMAP_WIDTH; // Negative direction + y_yPos = yBegGlobal; // Looking up + y_yNext = -BITMAP_WIDTH; // Negative direction y_xNext = -y_xNext; } @@ -307,74 +307,74 @@ UINT yRayCast(void) while (1) { if (y_xPos < 0 || y_xPos > GRID_XMAXLONG || - y_yPos < 0 || y_yPos > GRID_YMAX) - break; + y_yPos < 0 || y_yPos > GRID_YMAX) + break; -//********** Y/64 * 64 Fixed point and /64 ***** +//********** Y/64 * 64 Fixed point and /64 ***** MapPosn = (y_yPos & 0xFFC0) + (y_xPos >> (FP_SHIFT+6)); if ((Color = ObjGrid[MapPosn]) != 0) - { - Color &= 0x7F; - if (!ObjectExist(Color)) - ObjectsSeen[FoundObjectCount++] = Color; + { + Color &= 0x7F; + if (!ObjectExist(Color)) + ObjectsSeen[FoundObjectCount++] = Color; - } + } // Check for a wall being struck if ((Color = yGridGlobal[MapPosn]) != 0) - { - yMapPosn = MapPosn; // Hold onto map position - LastX1 = y_xPos; - iLastY = y_yPos; + { + yMapPosn = MapPosn; // Hold onto map position + LastX1 = y_xPos; + iLastY = y_yPos; - if ((Color & 0xFF) == DOOR_YCODE) // Is this a door? - { - yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Calc top side of square - xd = yd + BITMAP_WIDTH; // And bottom side of square - ObjDist = (y_xPos + (y_xNext >> 1)) >> FP_SHIFT; - if (ObjDist < yd || ObjDist > xd) // Is door visible? - { - y_xPos += y_xNext; // No, continue on with ray cast - y_yPos += y_yNext; - continue; - } + if ((Color & 0xFF) == DOOR_YCODE) // Is this a door? + { + yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Calc top side of square + xd = yd + BITMAP_WIDTH; // And bottom side of square + ObjDist = (y_xPos + (y_xNext >> 1)) >> FP_SHIFT; + if (ObjDist < yd || ObjDist > xd) // Is door visible? + { + y_xPos += y_xNext; // No, continue on with ray cast + y_yPos += y_yNext; + continue; + } - LastX1 = y_xPos + (y_xNext >> 1); // Adjust coordinates so door is - iLastY += (y_yNext >> 1); // Halfway into wall - } + LastX1 = y_xPos + (y_xNext >> 1); // Adjust coordinates so door is + iLastY += (y_yNext >> 1); // Halfway into wall + } - if (Color & DOOR_TYPE_SECRET) - { - if (ySecretColumn != 0) - { - sx = ySecretColumn * LongInvTanTable[ViewAngle]; - ObjDist = (y_xPos + sx) >> FP_SHIFT; - yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Get the top side - xd = yd + BITMAP_WIDTH; // And the bottom side - if (ObjDist < yd || ObjDist > xd) // Is door visible? - { - y_xPos += y_xNext; // Nope, continue casting - y_yPos += y_yNext; // the ray as before - continue; - } - LastX1 = y_xPos + sx; - iLastY += ySecretColumn; - } + if (Color & DOOR_TYPE_SECRET) + { + if (ySecretColumn != 0) + { + sx = ySecretColumn * LongInvTanTable[ViewAngle]; + ObjDist = (y_xPos + sx) >> FP_SHIFT; + yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Get the top side + xd = yd + BITMAP_WIDTH; // And the bottom side + if (ObjDist < yd || ObjDist > xd) // Is door visible? + { + y_xPos += y_xNext; // Nope, continue casting + y_yPos += y_yNext; // the ray as before + continue; + } + LastX1 = y_xPos + sx; + iLastY += ySecretColumn; + } - } + } - return(Color); - } + return(Color); + } - y_xPos += y_xNext; // Next calculated X value for delta Y - y_yPos += y_yNext; // Next fixed value of 64 or -64 + y_xPos += y_xNext; // Next calculated X value for delta Y + y_yPos += y_yNext; // Next fixed value of 64 or -64 } -return(0); // Return here if no Y wall is found +return(0); // Return here if no Y wall is found } //************************************************************************* @@ -395,17 +395,17 @@ UINT OldyRay(void) long xNext; long xd,yd,ObjDist,sx; -xNext = xNextTable[ViewAngle]; // Pre-calc'd value of BITMAP_WIDTH / tan(angle) +xNext = xNextTable[ViewAngle]; // Pre-calc'd value of BITMAP_WIDTH / tan(angle) if (ViewAngle < INT_ANGLE_180) { - yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */ - yNext = BITMAP_WIDTH; /* Positive direction */ + yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */ + yNext = BITMAP_WIDTH; /* Positive direction */ } else { - yPos = yBegGlobal; /* Looking up */ - yNext = -BITMAP_WIDTH; /* Negative direction */ + yPos = yBegGlobal; /* Looking up */ + yNext = -BITMAP_WIDTH; /* Negative direction */ xNext = -xNext; } @@ -415,81 +415,81 @@ xPos = (((long)yPos - (long)yPglobal) * LongInvTanTable[ViewAngle]) + xPglobalHI while (1) { if (xPos < 0 || xPos > GRID_XMAXLONG || - yPos < 0 || yPos > GRID_YMAX) - break; + yPos < 0 || yPos > GRID_YMAX) + break; -/*********** Y/64 * 64 Fixed point and /64 ******/ +/*********** Y/64 * 64 Fixed point and /64 ******/ // MapPosn = ((yPos / BITMAP_WIDTH) * GRID_WIDTH) + (xPos >> (FP_SHIFT+BITMAP_SHIFT)); // MapPosn = ((yPos & GRID_MASK) >> 1) + (xPos >> (FP_SHIFT+BITMAP_SHIFT)); MapPosn = (yPos & 0xFFC0) + (xPos >> (FP_SHIFT+6)); if ((Color = ObjGrid[MapPosn]) != 0) - { - Color &= 0x7F; - if (!ObjectExist(Color)) - ObjectsSeen[FoundObjectCount++] = Color; + { + Color &= 0x7F; + if (!ObjectExist(Color)) + ObjectsSeen[FoundObjectCount++] = Color; - } + } /** Check for a wall being struck **/ if ((Color = yGridGlobal[MapPosn]) != 0) - { - yMapPosn = MapPosn; /* Hold onto map position */ - LastX1 = xPos; - iLastY = yPos; + { + yMapPosn = MapPosn; /* Hold onto map position */ + LastX1 = xPos; + iLastY = yPos; - if ((Color & 0xFF) == DOOR_YCODE) /* Is this a door? */ - { - yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Calc top side of square */ - xd = yd + BITMAP_WIDTH; /* And bottom side of square */ - ObjDist = (xPos + (xNext >> 1)) >> FP_SHIFT; - if (ObjDist < yd || ObjDist > xd) /* Is door visible? */ - { - xPos += xNext; /* No, continue on with ray cast */ - yPos += yNext; - continue; - } + if ((Color & 0xFF) == DOOR_YCODE) /* Is this a door? */ + { + yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Calc top side of square */ + xd = yd + BITMAP_WIDTH; /* And bottom side of square */ + ObjDist = (xPos + (xNext >> 1)) >> FP_SHIFT; + if (ObjDist < yd || ObjDist > xd) /* Is door visible? */ + { + xPos += xNext; /* No, continue on with ray cast */ + yPos += yNext; + continue; + } - LastX1 = xPos + (xNext >> 1); /* Adjust coordinates so door is */ - iLastY += (yNext >> 1); /* Halfway into wall */ - } + LastX1 = xPos + (xNext >> 1); /* Adjust coordinates so door is */ + iLastY += (yNext >> 1); /* Halfway into wall */ + } - if (Color & DOOR_TYPE_SECRET) - { - if (ySecretColumn != 0) - { - sx = ySecretColumn * LongInvTanTable[ViewAngle]; - ObjDist = (xPos + sx) >> FP_SHIFT; - yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Get the top side */ - xd = yd + BITMAP_WIDTH; /* And the bottom side */ - if (ObjDist < yd || ObjDist > xd) /* Is door visible? */ - { - xPos += xNext; /* Nope, continue casting */ - yPos += yNext; /* the ray as before */ - continue; - } - LastX1 = xPos + sx; - iLastY += ySecretColumn; - } + if (Color & DOOR_TYPE_SECRET) + { + if (ySecretColumn != 0) + { + sx = ySecretColumn * LongInvTanTable[ViewAngle]; + ObjDist = (xPos + sx) >> FP_SHIFT; + yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Get the top side */ + xd = yd + BITMAP_WIDTH; /* And the bottom side */ + if (ObjDist < yd || ObjDist > xd) /* Is door visible? */ + { + xPos += xNext; /* Nope, continue casting */ + yPos += yNext; /* the ray as before */ + continue; + } + LastX1 = xPos + sx; + iLastY += ySecretColumn; + } - } + } - return(Color); - } + return(Color); + } - xPos += xNext; /* Next calculated X value for delta Y */ - yPos += yNext; /* Next fixed value of 64 or -64 */ + xPos += xNext; /* Next calculated X value for delta Y */ + yPos += yNext; /* Next fixed value of 64 or -64 */ } -return(0); /* Return here if no Y wall is found */ +return(0); /* Return here if no Y wall is found */ } /**************************************************************************** -** ** +** ** ****************************************************************************/ UINT xRayMulti(UINT MinDist,short MinHeight) { @@ -508,17 +508,17 @@ UINT xRayMulti(UINT MinDist,short MinHeight) long xd,yd,sy; long ObjDist; -yNext = yNextTable[ViewAngle]; /* PreCalc'd value of BITMAP_WIDTH * Tan(angle) */ +yNext = yNextTable[ViewAngle]; /* PreCalc'd value of BITMAP_WIDTH * Tan(angle) */ if (ViewAngle > INT_ANGLE_270 || ViewAngle < INT_ANGLE_90) { - xPos = xBegGlobal + BITMAP_WIDTH; /* Looking to the right */ - xNext = BITMAP_WIDTH; /* Positive direction */ + xPos = xBegGlobal + BITMAP_WIDTH; /* Looking to the right */ + xNext = BITMAP_WIDTH; /* Positive direction */ } else { - xPos = xBegGlobal; /* Looking to the left */ - xNext = -BITMAP_WIDTH; /* Negative direction */ + xPos = xBegGlobal; /* Looking to the left */ + xNext = -BITMAP_WIDTH; /* Negative direction */ yNext = -yNext; } @@ -528,38 +528,38 @@ yPos = (((long)xPos - (long)xPglobal) * LongTanTable[ViewAngle]) + yPglobalHI; while (1) { if (xPos < 0 || xPos > GRID_XMAX || - yPos < 0 || yPos > GRID_YMAXLONG) - break; + yPos < 0 || yPos > GRID_YMAXLONG) + break; -/************** Fixed point Y/64 * 64 X / 64 ***********/ +/************** Fixed point Y/64 * 64 X / 64 ***********/ MapPosn = ((yPos >> FP_SHIFT) & 0xFFC0) + (xPos >> 6); /* Check to see if a wall is being struck by the ray */ if ((Color = xGridGlobal[MapPosn]) & WALL_TYPE_MULTI) - { - if ((Color & 0xFF) > MinHeight) - { - xd = xPos - xPglobal; - yd = InvCosTable[ViewAngle] >> 4; - if (MinDist < ((xd * yd) >> 10)) - { - xMapPosn = MapPosn; /* Hold onto the map location */ - iLastX = xPos; - LastY1 = yPos; - return(Color); - } - } - } - - xPos += xNext; /* Next X coordinate (fixed at 64 or -64) */ - yPos += yNext; /* Next calculated Y coord for a delta of X */ + { + if ((Color & 0xFF) > MinHeight) + { + xd = xPos - xPglobal; + yd = InvCosTable[ViewAngle] >> 4; + if (MinDist < ((xd * yd) >> 10)) + { + xMapPosn = MapPosn; /* Hold onto the map location */ + iLastX = xPos; + LastY1 = yPos; + return(Color); + } + } } -return(0); /* Return that no wall was found */ + xPos += xNext; /* Next X coordinate (fixed at 64 or -64) */ + yPos += yNext; /* Next calculated Y coord for a delta of X */ + } + +return(0); /* Return that no wall was found */ } /**************************************************************************** -** ** +** ** ****************************************************************************/ UINT yRayMulti(UINT MinDist,short MinHeight) { @@ -576,17 +576,17 @@ UINT yRayMulti(UINT MinDist,short MinHeight) long xNext; long xd,yd,ObjDist,sx; -xNext = xNextTable[ViewAngle]; /* Pre-calc'd value of BITMAP_WIDTH / tan(angle) */ +xNext = xNextTable[ViewAngle]; /* Pre-calc'd value of BITMAP_WIDTH / tan(angle) */ if (ViewAngle < INT_ANGLE_180) { - yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */ - yNext = BITMAP_WIDTH; /* Positive direction */ + yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */ + yNext = BITMAP_WIDTH; /* Positive direction */ } else { - yPos = yBegGlobal; /* Looking up */ - yNext = -BITMAP_WIDTH; /* Negative direction */ + yPos = yBegGlobal; /* Looking up */ + yNext = -BITMAP_WIDTH; /* Negative direction */ xNext = -xNext; } @@ -596,35 +596,34 @@ xPos = (((long)yPos - (long)yPglobal) * LongInvTanTable[ViewAngle]) + xPglobalHI while (1) { if (xPos < 0 || xPos > GRID_XMAXLONG || - yPos < 0 || yPos > GRID_YMAX) - break; + yPos < 0 || yPos > GRID_YMAX) + break; -/*********** Y/64 * 64 Fixed point and /64 ******/ +/*********** Y/64 * 64 Fixed point and /64 ******/ MapPosn = (yPos & 0xFFC0) + (xPos >> (FP_SHIFT+6)); /** Check for a wall being struck **/ if ((Color = yGridGlobal[MapPosn]) & WALL_TYPE_MULTI) - { - if ((Color & 0xFF) > MinHeight) - { - xd = yPos - yPglobal; - yd = InvCosTable[ViewAngle] >> 4; - if (MinDist < ((xd * yd) >> 10)) - { - yMapPosn = MapPosn; /* Hold onto the map location */ - LastX1 = xPos; - iLastY = yPos; - return(Color); - } - } - } + { + if ((Color & 0xFF) > MinHeight) + { + xd = yPos - yPglobal; + yd = InvCosTable[ViewAngle] >> 4; + if (MinDist < ((xd * yd) >> 10)) + { + yMapPosn = MapPosn; /* Hold onto the map location */ + LastX1 = xPos; + iLastY = yPos; + return(Color); + } + } + } - xPos += xNext; /* Next calculated X value for delta Y */ - yPos += yNext; /* Next fixed value of 64 or -64 */ + xPos += xNext; /* Next calculated X value for delta Y */ + yPos += yNext; /* Next fixed value of 64 or -64 */ } -return(0); /* Return here if no Y wall is found */ +return(0); /* Return here if no Y wall is found */ } - \ No newline at end of file diff --git a/ack_lib/ACKRTN.ASM b/ack_lib/ACKRTN.ASM index 24f5350..05be9b1 100644 --- a/ack_lib/ACKRTN.ASM +++ b/ack_lib/ACKRTN.ASM @@ -1,139 +1,139 @@ - locals - IDEAL - JUMPS - P386 - P387 ; Allow 386 processor + locals + IDEAL + JUMPS + P386 + P387 ; Allow 386 processor - MASM - .MODEL FLAT,STDCALL ;32-bit OS/2 model + MASM + .MODEL FLAT,STDCALL ;32-bit OS/2 model .data -COLOR dw ? -RETVAL dw ? -MAPPOSN dw ? -XBEG dd ? -XD dd ? -YD dd ? -YTEMP dd ? -SY dd ? -SX dd ? +COLOR dw ? +RETVAL dw ? +MAPPOSN dw ? +XBEG dd ? +XD dd ? +YD dd ? +YTEMP dd ? +SY dd ? +SX dd ? - .CODE - IDEAL + .CODE + IDEAL - include "ackrtn.inc" + include "ackrtn.inc" -SC_INDEX EQU 03C4h ; Sequencer Controller access -HIGH_ADDR equ 80h ; High byte of screen offset -GC_INDEX equ 3ceh ;Graphics Controller Index register -CRTC_INDEX equ 3d4h ;CRT Controller Index register -MAP_MASK equ 2 ;Map Mask register index in SC -MEMORY_MODE equ 4 ;Memory Mode register index in SC -MAX_SCAN_LINE equ 9 ;Maximum Scan Line reg index in CRTC -START_ADDRESS_HIGH equ 0ch ;Start Address High reg index in CRTC -UNDERLINE equ 14h ;Underline Location reg index in CRTC -MODE_CONTROL equ 17h ;Mode Control register index in CRTC -READ_MAP equ 4 ;Read Map register index in GC -GRAPHICS_MODE equ 5 ;Graphics Mode register index in GC -MISCELLANEOUS equ 6 ;Miscellaneous register index in GC -SCREEN_WIDTH equ 320 ;# of pixels across screen -SCREEN_HEIGHT equ 400 ;# of scan lines on screen +SC_INDEX EQU 03C4h ; Sequencer Controller access +HIGH_ADDR equ 80h ; High byte of screen offset +GC_INDEX equ 3ceh ;Graphics Controller Index register +CRTC_INDEX equ 3d4h ;CRT Controller Index register +MAP_MASK equ 2 ;Map Mask register index in SC +MEMORY_MODE equ 4 ;Memory Mode register index in SC +MAX_SCAN_LINE equ 9 ;Maximum Scan Line reg index in CRTC +START_ADDRESS_HIGH equ 0ch ;Start Address High reg index in CRTC +UNDERLINE equ 14h ;Underline Location reg index in CRTC +MODE_CONTROL equ 17h ;Mode Control register index in CRTC +READ_MAP equ 4 ;Read Map register index in GC +GRAPHICS_MODE equ 5 ;Graphics Mode register index in GC +MISCELLANEOUS equ 6 ;Miscellaneous register index in GC +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: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 _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 _OurDataSeg:word - extrn _HitMap:byte + extrn _HitMap:byte ACKPUBS AckInkey ACKPUBS AckKbdInt @@ -161,17 +161,17 @@ SCREEN_HEIGHT equ 400 ;# of scan lines on screen ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckInkey push ebx - mov ax,0100h - int 16h - mov bx,0 - jz ackinkey_10 - xor ax,ax - int 16h - mov bx,ax + mov ax,0100h + int 16h + mov bx,0 + jz ackinkey_10 + xor ax,ax + int 16h + mov bx,ax ackinkey_10: - mov ax,bx - pop ebx + mov ax,bx + pop ebx ret endp @@ -185,32 +185,32 @@ ACKPROC AckKbdInt 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 + 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 + pop ds + pop esi + pop ebx + pop eax iretd endp @@ -219,87 +219,87 @@ aki_10: ; void AckDisplayScreen(void); ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckDisplayScreen - push ebp - ACKCALL AckDrawPage - pop ebp - xor eax,eax - ret - endp + push ebp + ACKCALL AckDrawPage + pop ebp + xor eax,eax + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; Puts a single byte onto the video ; void AckPutVideo(unsigned int offset,unsigned char color); ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckPutVideo - push ebp - mov ebp,esp - push es - 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],dl - pop edi - pop ebx - pop es - pop ebp - ret - endp + push ebp + mov ebp,esp + push es + 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],dl + pop edi + pop ebx + pop es + pop ebp + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; Retrieves a single byte from the video ; unsigned char AckGetVideo(unsigned int offset); ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckGetVideo - push ebp - mov ebp,esp - push ds - 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 al,[esi] - mov ah,0 - pop esi - pop ebx - pop ds - pop ebp - ret - endp + push ebp + mov ebp,esp + push ds + 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 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); ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckCopyToVideo - push ebp - mov ebp,esp - push es - push ebx - 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 - rep movsb - pop edi - pop esi - pop edx - pop ecx - pop ebx - pop es - pop ebp - ret - endp + push ebp + mov ebp,esp + push es + push ebx + 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 + rep movsb + pop edi + pop esi + pop edx + pop ecx + pop ebx + pop es + pop ebp + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± @@ -310,14 +310,14 @@ 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 + 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 @@ -327,24 +327,24 @@ ACKPROC AckInitVideoSelector ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckGetIntVector push ebp - mov ebp,esp + mov ebp,esp 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 + 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 @@ -354,22 +354,22 @@ ACKPROC AckGetIntVector ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckSetIntVector push ebp - mov ebp,esp + 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 + mov ebx,[ebp+8] + mov ecx,[ebp+12] + mov edx,[ebp+16] +;; mov cx,cs + mov eax,205h cli - int 31h + int 31h sti - pop edx - pop ecx - pop ebx - pop ebp + pop edx + pop ecx + pop ebx + pop ebp ret endp @@ -378,35 +378,35 @@ ACKPROC AckSetIntVector ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckSetPalette push ebp - mov ebp,esp + mov ebp,esp push ds push ebx push ecx push edx - mov esi,[ebp+8] - mov ebx,0 - mov ecx,256 - mov dx,3c8h + mov esi,[ebp+8] + mov ebx,0 + mov ecx,256 + mov dx,3c8h asp_loop: - mov al,bl - out dx,al - inc bx - inc dx + mov al,bl + out dx,al + inc bx + inc dx lodsb - out dx,al + out dx,al lodsb - out dx,al + out dx,al lodsb - out dx,al - dec dx + out dx,al + dec dx loop asp_loop - pop edx - pop ecx - pop ebx - pop ds - pop ebp + pop edx + pop ecx + pop ebx + pop ds + pop ebp ret endp @@ -417,11 +417,11 @@ ACKPROC AckSetVGAmode push ebx push ecx push edx - mov ax,0013h ;AH = 0 means mode set, AL = 13h selects - int 10h ;BIOS video interrupt - pop edx - pop ecx - pop ebx + mov ax,0013h ;AH = 0 means mode set, AL = 13h selects + int 10h ;BIOS video interrupt + pop edx + pop ecx + pop ebx ret ;------------------------------------------------------------------------------ @@ -438,23 +438,23 @@ ACKPROC AckSetVGAmode ; mov al,MEMORY_MODE ; out dx,al ; inc dx -; in al,dx -; and al,not 08h ;turn off chain 4 -; or al,04h ;turn off odd/even +; in al,dx +; and al,not 08h ;turn off chain 4 +; or al,04h ;turn off odd/even ; out dx,al ; mov dx,GC_INDEX ; mov al,GRAPHICS_MODE ; out dx,al ; inc dx -; in al,dx -; and al,not 10h ;turn off odd/even +; in al,dx +; and al,not 10h ;turn off odd/even ; out dx,al ; dec dx ; mov al,MISCELLANEOUS ; out dx,al ; inc dx -; in al,dx -; and al,not 02h ;turn off chain +; in al,dx +; and al,not 02h ;turn off chain ; out dx,al ; mov dx,SC_INDEX ; mov ax,(0fh shl 8) + MAP_MASK @@ -468,17 +468,17 @@ ACKPROC AckSetVGAmode ; mov al,UNDERLINE ; out dx,al ; inc dx -; in al,dx -; and al,not 40h ;turn off doubleword +; in al,dx +; and al,not 40h ;turn off doubleword ; out dx,al ; dec dx ; mov al,MODE_CONTROL ; out dx,al ; inc dx -; in al,dx -; or al,40h ;turn on the byte mode bit, so memory is -; ; scanned for video data in a purely -; ; linear way, just as in modes 10h and 12h +; in al,dx +; or al,40h ;turn on the byte mode bit, so memory is +; ; scanned for video data in a purely +; ; linear way, just as in modes 10h and 12h ; out dx,al ; ret endp @@ -491,11 +491,11 @@ ACKPROC AckSetTextMode push ebx push ecx push edx - mov ax,3 - int 10h - pop edx - pop ecx - pop ebx + mov ax,3 + int 10h + pop edx + pop ecx + pop ebx ret endp @@ -511,81 +511,81 @@ ACKPROC AckDrawPage push es push ds -;; mov edi,[_VidSeg] - mov edi,0 - mov di,[word ptr _VidSeg] - mov esi,[_gScrnBuffer] - cmp [word ptr _gWinFullWidth],0 - jz short dp_smallscreen +;; mov edi,[_VidSeg] + mov edi,0 + mov di,[word ptr _VidSeg] + mov esi,[_gScrnBuffer] + cmp [word ptr _gWinFullWidth],0 + jz short dp_smallscreen - mov eax,[_gWinStartOffset] - add edi,eax - add esi,eax - mov ecx,[_gWinDWORDS] + mov eax,[_gWinStartOffset] + add edi,eax + add esi,eax + mov ecx,[_gWinDWORDS] - mov ax,[word ptr _VidSeg+2] - mov es,ax -;; mov ds,ax + mov ax,[word ptr _VidSeg+2] + mov es,ax +;; mov ds,ax - mov dx,3dah + mov dx,3dah fp020: - in al,dx ;Wait until vertical retrace is on + in al,dx ;Wait until vertical retrace is on test al,8 - jz fp020 + jz fp020 fp030: - in al,dx ;Wait until vertical retrace is off + in al,dx ;Wait until vertical retrace is off test al,8 - jnz fp030 + jnz fp030 - rep movsd + rep movsd - pop ds - pop es - pop edx - pop ecx - pop ebx - pop edi - pop esi + pop ds + pop es + pop edx + pop ecx + pop ebx + pop edi + pop esi ret dp_smallscreen: - mov eax,[_gWinStartOffset] - add edi,eax - add esi,eax + mov eax,[_gWinStartOffset] + add edi,eax + add esi,eax movzx eax,[_gWinStartX] - add edi,eax - add esi,eax - mov dx,[_gWinHeight] - inc dx + add edi,eax + add esi,eax + mov dx,[_gWinHeight] + inc dx movzx ebx,[_gWinWidth] - mov ebp,320 - sub ebp,ebx ;width to advance pointers + mov ebp,320 + sub ebp,ebx ;width to advance pointers - mov ax,[word ptr _VidSeg+2] - mov es,ax -;; mov ds,ax + mov ax,[word ptr _VidSeg+2] + mov es,ax +;; mov ds,ax dp010: - mov ecx,ebx - shr ecx,1 - rep movsw - rcl ecx,1 - rep movsb - add edi,ebp - add esi,ebp - dec dx - jnz dp010 + mov ecx,ebx + shr ecx,1 + rep movsw + rcl ecx,1 + rep movsb + add edi,ebp + add esi,ebp + dec dx + jnz dp010 dp090: - pop ds - pop es - pop edx - pop ecx - pop ebx - pop edi - pop esi + pop ds + pop es + pop edx + pop ecx + pop ebx + pop edi + pop esi ret endp @@ -594,190 +594,190 @@ dp090: ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC xRaySetup - push esi ; Save registers used - push ebx - push ecx - push edx - mov dx,[_ViewAngle] ; Get the current angle for casting - movzx esi,dx ; Use this angle for table look up - shl esi,2 ; Hold onto viewangle * 4 for table access - mov ebx,[_yNextTable] ; Base address of list of y increment coordinates - mov eax,[esi+ebx] ; Use angle as index into table - mov [dword ptr _x_yNext],eax; Store y increment value - cmp dx,INT_ANGLE_270 ; Is angle > 270 degrees? - jg short inbetween - cmp dx,INT_ANGLE_90 ; Is angle >= 90 degrees? - jge short not_inbetween + push esi ; Save registers used + push ebx + push ecx + push edx + mov dx,[_ViewAngle] ; Get the current angle for casting + movzx esi,dx ; Use this angle for table look up + shl esi,2 ; Hold onto viewangle * 4 for table access + mov ebx,[_yNextTable] ; Base address of list of y increment coordinates + mov eax,[esi+ebx] ; Use angle as index into table + mov [dword ptr _x_yNext],eax; Store y increment value + cmp dx,INT_ANGLE_270 ; Is angle > 270 degrees? + jg short inbetween + cmp dx,INT_ANGLE_90 ; Is angle >= 90 degrees? + jge short not_inbetween ; Set up the ray for casting to the right (270 to 90 degrees) inbetween: - mov ecx,[_xBegGlobal] ; Get left corner of grid square - add ecx,64 ; Calculate right corner - mov [dword ptr _x_xPos],ecx ; Store starting x position - mov [dword ptr _x_xNext],large 64 ; Store next x grid increment - jmp short xr_cont ; to the right (+64) + mov ecx,[_xBegGlobal] ; Get left corner of grid square + add ecx,64 ; Calculate right corner + mov [dword ptr _x_xPos],ecx ; Store starting x position + mov [dword ptr _x_xNext],large 64 ; Store next x grid increment + jmp short xr_cont ; to the right (+64) ; Set up the ray for casting to the keft (90 to 270 degrees) not_inbetween: - movzx ecx,[word ptr _xBegGlobal] ; Get left corner of grid square - mov [_x_xPos],ecx ; Store starting x position - mov [dword ptr _x_xNext],large -64 ; Store next x grid increment - ; to the left (-64) - neg [dword ptr _x_yNext] ; Negate the second y intersection - ; coordinate + movzx ecx,[word ptr _xBegGlobal] ; Get left corner of grid square + mov [_x_xPos],ecx ; Store starting x position + mov [dword ptr _x_xNext],large -64 ; Store next x grid increment + ; to the left (-64) + neg [dword ptr _x_yNext] ; Negate the second y intersection + ; coordinate xr_cont: - movzx eax,[word ptr _xPglobal] ; Get player’s x coordinate - sub ecx,eax ; x Distance from player’s position - ; to edge of grid - mov ebx,[dword ptr _LongTanTable] ; Get address of tangent table - imul ecx,[dword ptr esi+ebx] ; Tangent(angle) * Distance - add ecx,[dword ptr _yPglobalHI] ; - mov [dword ptr _x_yPos],ecx ; Store first y coordinate where - ; we hit an x boundary - pop edx ; Restore registers - pop ecx - pop ebx - pop esi - ret - endp + movzx eax,[word ptr _xPglobal] ; Get player’s x coordinate + sub ecx,eax ; x Distance from player’s position + ; to edge of grid + mov ebx,[dword ptr _LongTanTable] ; Get address of tangent table + imul ecx,[dword ptr esi+ebx] ; Tangent(angle) * Distance + add ecx,[dword ptr _yPglobalHI] ; + mov [dword ptr _x_yPos],ecx ; Store first y coordinate where + ; we hit an x boundary + pop edx ; Restore registers + pop ecx + pop ebx + pop esi + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC xRayCast - push esi ; Save registers used - push edi - push ebx - push ecx - push edx - mov esi,[_x_xPos] ; Get x,y starting position - mov edi,[_x_yPos] ; (1st grid border intersection point) - xor ecx,ecx ; Init our bitmap variable + push esi ; Save registers used + push edi + push ebx + push ecx + push edx + mov esi,[_x_xPos] ; Get x,y starting position + mov edi,[_x_yPos] ; (1st grid border intersection point) + xor ecx,ecx ; Init our bitmap variable -looptop: ; Start the ray casting loop - mov edx,esi ; Get x starting position - cmp edx,large 0 ; If it’s < 0 we’re done! - jl short getout - cmp edx,large 4096 ; If it’s > 4,096 we’re done - jge short getout - mov eax,edi ; Get y starting position - cmp eax,large 0 ; If it’s < 0 we’re done - jl short getout - cmp eax,large 010000000h ; If it’s out of range we’re done - jl short inbounds +looptop: ; Start the ray casting loop + mov edx,esi ; Get x starting position + cmp edx,large 0 ; If it’s < 0 we’re done! + jl short getout + cmp edx,large 4096 ; If it’s > 4,096 we’re done + jge short getout + mov eax,edi ; Get y starting position + cmp eax,large 0 ; If it’s < 0 we’re done + jl short getout + cmp eax,large 010000000h ; If it’s out of range we’re done + jl short inbounds getout: - jmp loopdone + jmp loopdone -inbounds: ; We’re in-range; continue casting - sar eax,16 ; Scale y starting position - and eax,-64 - sar edx,6 ; Scale x starting position - add eax,edx ; Calculate grid map position - cmp eax,4095 ; Test map position to see if it’s in range - ja getout - mov [byte ptr _HitMap+eax],1 ; Record the square we cast through - mov ebx,[_xGridGlobal] ; Get pointer to x wall map - mov cx,[ebx+eax*2] ; Get the bitmap number there - jcxz next_square ; Nothing found in square--move ahead +inbounds: ; We’re in-range; continue casting + sar eax,16 ; Scale y starting position + and eax,-64 + sar edx,6 ; Scale x starting position + add eax,edx ; Calculate grid map position + cmp eax,4095 ; Test map position to see if it’s in range + ja getout + mov [byte ptr _HitMap+eax],1 ; Record the square we cast through + mov ebx,[_xGridGlobal] ; Get pointer to x wall map + mov cx,[ebx+eax*2] ; Get the bitmap number there + jcxz next_square ; Nothing found in square--move ahead -wall_here: ; We found something! - mov [word ptr COLOR],cx ; Save the bitmap number - mov [_xMapPosn],eax ; Save the map position - mov [dword ptr _iLastX],esi ; Save the x,y position of the grid - mov [dword ptr _LastY1],edi ; border where the hit was found - test cx,DOOR_WALL ; Did we find a door? - jz short not_door ; No match--go process a wall slice +wall_here: ; We found something! + mov [word ptr COLOR],cx ; Save the bitmap number + mov [_xMapPosn],eax ; Save the map position + mov [dword ptr _iLastX],esi ; Save the x,y position of the grid + mov [dword ptr _LastY1],edi ; border where the hit was found + test cx,DOOR_WALL ; Did we find a door? + jz short not_door ; No match--go process a wall slice ; At this point we’ve found a door, so we need to process it. - mov edx,edi ; Get y position - sar edx,16 ; Scale position - and edx,large 00000FFC0h - mov [dword ptr YD],edx ; YD = (yPos >> FP_SHIFT) & 0xFFC0; - ; YD is the left side of door (grid corner) - add edx,large 64 - mov [dword ptr XD],edx ; XD = YD + GRID_SIZE; - ; XD is the right side of door (grid corner) - mov eax,[dword ptr _x_yNext] ; Get y increment - sar eax,1 ; Use half of inrement - add eax,edi ; Add 1/2 y increment to y position - ; We need to calculate distance to door - mov [YTEMP],eax ; Store new y location - sar eax,16 ; We now have actual distance to door - cmp eax,[dword ptr YD] ; Is distance < YD? - jl short door_not_visible ; Process invisible door - cmp eax,[dword ptr XD] ; Is distance > XD? - jle short door_visible ; Process visible door + mov edx,edi ; Get y position + sar edx,16 ; Scale position + and edx,large 00000FFC0h + mov [dword ptr YD],edx ; YD = (yPos >> FP_SHIFT) & 0xFFC0; + ; YD is the left side of door (grid corner) + add edx,large 64 + mov [dword ptr XD],edx ; XD = YD + GRID_SIZE; + ; XD is the right side of door (grid corner) + mov eax,[dword ptr _x_yNext] ; Get y increment + sar eax,1 ; Use half of inrement + add eax,edi ; Add 1/2 y increment to y position + ; We need to calculate distance to door + mov [YTEMP],eax ; Store new y location + sar eax,16 ; We now have actual distance to door + cmp eax,[dword ptr YD] ; Is distance < YD? + jl short door_not_visible ; Process invisible door + cmp eax,[dword ptr XD] ; Is distance > XD? + jle short door_visible ; Process visible door -door_not_visible: ; Door is invisible so skip to next square - add esi,[dword ptr _x_xNext] ; Add x,y increment to current grid border - add edi,[dword ptr _x_yNext] ; position - jmp looptop ; Cast again to check next position +door_not_visible: ; Door is invisible so skip to next square + add esi,[dword ptr _x_xNext] ; Add x,y increment to current grid border + add edi,[dword ptr _x_yNext] ; position + jmp looptop ; Cast again to check next position -door_visible: ; Process a visible door - mov eax,[dword ptr YTEMP] ; Get y position of door - mov [dword ptr _LastY1],eax ; LastY1 = yTemp; - mov eax,[dword ptr _x_xNext] ; Adjust x,y position so that door - sar eax,1 ; is halfway in square - add [dword ptr _iLastX],eax ; iLastX += xNext >> 1; +door_visible: ; Process a visible door + mov eax,[dword ptr YTEMP] ; Get y position of door + mov [dword ptr _LastY1],eax ; LastY1 = yTemp; + mov eax,[dword ptr _x_xNext] ; Adjust x,y position so that door + sar eax,1 ; is halfway in square + add [dword ptr _iLastX],eax ; iLastX += xNext >> 1; -not_door: ; We don’t think we have a door - test cx,DOOR_TYPE_SECRET ; Check bitmap type - jz short br_no_secret ; Not a secret door - cmp [word ptr _xSecretColumn],0 - jne short secret_door ; We’ve found a secret door +not_door: ; We don’t think we have a door + test cx,DOOR_TYPE_SECRET ; Check bitmap type + jz short br_no_secret ; Not a secret door + cmp [word ptr _xSecretColumn],0 + jne short secret_door ; We’ve found a secret door br_no_secret: - jmp short give_color ; Move on and get the wall’s color + jmp short give_color ; Move on and get the wall’s color -secret_door: ; Process a secret door - movzx eax,[word ptr _xSecretColumn] ; Get secret column location - movzx ebx,[word ptr _ViewAngle] ; Get ViewAngle to door - shl ebx,2 - add ebx,[dword ptr _LongTanTable] ; Add in address of tan table - imul eax,[dword ptr ebx] ; Look up tangent of angle - mov [dword ptr SY],eax ; SY = xSecretColumn * tan(ViewAngle) - mov ebx,edi ; Get x_yPos - add eax,ebx ; SY + x_yPos - mov [dword ptr YTEMP],eax ; Store distance to door - sar eax,16 ; eax = (x_yPos + SY) >> FP_SHIFT - ; This gives us actual distance to door - sar ebx,16 ; Now calculate the left side - and ebx,large 00000FFC0h - mov [dword ptr YD],ebx ; YD = x_yPos >> FP_SHIFT & GRID_MASK - mov ecx,ebx ; Calculate the right side (XD) - add ecx,large 64 ; XD = YD = BITMAP_WIDTH - cmp eax,ebx ; Is distance < YD? - jl short next_square - cmp eax,ecx ; Is distance <= XD? - jle short secret_is_visible +secret_door: ; Process a secret door + movzx eax,[word ptr _xSecretColumn] ; Get secret column location + movzx ebx,[word ptr _ViewAngle] ; Get ViewAngle to door + shl ebx,2 + add ebx,[dword ptr _LongTanTable] ; Add in address of tan table + imul eax,[dword ptr ebx] ; Look up tangent of angle + mov [dword ptr SY],eax ; SY = xSecretColumn * tan(ViewAngle) + mov ebx,edi ; Get x_yPos + add eax,ebx ; SY + x_yPos + mov [dword ptr YTEMP],eax ; Store distance to door + sar eax,16 ; eax = (x_yPos + SY) >> FP_SHIFT + ; This gives us actual distance to door + sar ebx,16 ; Now calculate the left side + and ebx,large 00000FFC0h + mov [dword ptr YD],ebx ; YD = x_yPos >> FP_SHIFT & GRID_MASK + mov ecx,ebx ; Calculate the right side (XD) + add ecx,large 64 ; XD = YD = BITMAP_WIDTH + cmp eax,ebx ; Is distance < YD? + jl short next_square + cmp eax,ecx ; Is distance <= XD? + jle short secret_is_visible -secret_not_visible: ; Process invisible secret door - jmp short next_square +secret_not_visible: ; Process invisible secret door + jmp short next_square -secret_is_visible: ; Process visible secret door - mov eax,[dword ptr YTEMP] - mov [dword ptr _LastY1],eax - mov eax,[dword ptr _xSecretColumn] - add [dword ptr _iLastX],eax - jmp short give_color +secret_is_visible: ; Process visible secret door + mov eax,[dword ptr YTEMP] + mov [dword ptr _LastY1],eax + mov eax,[dword ptr _xSecretColumn] + add [dword ptr _iLastX],eax + jmp short give_color -next_square: ; Didin’t find anything--go to next square - add esi,[dword ptr _x_xNext] ; Add x,y increment to current grid border - add edi,[dword ptr _x_yNext] ; position - jmp looptop ; Start over again +next_square: ; Didin’t find anything--go to next square + add esi,[dword ptr _x_xNext] ; Add x,y increment to current grid border + add edi,[dword ptr _x_yNext] ; position + jmp looptop ; Start over again loopdone: - mov [word ptr COLOR],0 ; Use bitmap value of 0 to indicate - ; nothing has been found + mov [word ptr COLOR],0 ; Use bitmap value of 0 to indicate + ; nothing has been found give_color: - movzx eax,[word ptr COLOR] ; Get color of wall + movzx eax,[word ptr COLOR] ; Get color of wall xRayDone: - pop edx ; Restore registers - pop ecx - pop ebx - pop edi - pop esi - ret - endp + pop edx ; Restore registers + pop ecx + pop ebx + pop edi + pop esi + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± @@ -788,39 +788,39 @@ ACKPROC yRaySetup push ebx push ecx push edx - mov dx,[word _ViewAngle] + mov dx,[word _ViewAngle] movzx esi,dx - shl esi,2 ; // Hold onto viewangle * 4 - mov ebx,[dword ptr _xNextTable] - mov eax,[esi+ebx] - mov [dword ptr _y_xNext],eax - cmp dx,INT_ANGLE_180 - jge short y_not_inbetween + shl esi,2 ; // Hold onto viewangle * 4 + mov ebx,[dword ptr _xNextTable] + mov eax,[esi+ebx] + mov [dword ptr _y_xNext],eax + cmp dx,INT_ANGLE_180 + jge short y_not_inbetween y_inbetween: - mov ecx,[_yBegGlobal] - add ecx,64 - mov [dword ptr _y_yPos],ecx - mov [dword ptr _y_yNext],large 64 - jmp short y_yr_cont + mov ecx,[_yBegGlobal] + add ecx,64 + mov [dword ptr _y_yPos],ecx + mov [dword ptr _y_yNext],large 64 + jmp short y_yr_cont y_not_inbetween: - mov ecx,[_yBegGlobal] - mov [_y_yPos],ecx - mov [dword ptr _y_yNext],large -64 - neg [dword ptr _y_xNext] + mov ecx,[_yBegGlobal] + mov [_y_yPos],ecx + mov [dword ptr _y_yNext],large -64 + neg [dword ptr _y_xNext] y_yr_cont: - mov eax,[_yPglobal] - sub ecx,eax - mov ebx,[dword ptr _LongInvTanTable] + mov eax,[_yPglobal] + sub ecx,eax + mov ebx,[dword ptr _LongInvTanTable] imul ecx,[dword ptr esi+ebx] - add ecx,[dword ptr _xPglobalHI] - mov [dword ptr _y_xPos],ecx - pop edx - pop ecx - pop ebx - pop esi + add ecx,[dword ptr _xPglobalHI] + mov [dword ptr _y_xPos],ecx + pop edx + pop ecx + pop ebx + pop esi ret endp @@ -839,135 +839,135 @@ ACKPROC yRayCast xor ecx,ecx y_looptop: -;-; mov edx,[dword ptr _y_xPos] +;-; mov edx,[dword ptr _y_xPos] mov edx,esi - cmp edx,large 0 - jl short y_getout - cmp edx,large 010000000h - jge short y_getout -;-; mov eax,[_y_yPos] + cmp edx,large 0 + jl short y_getout + cmp edx,large 010000000h + jge short y_getout +;-; mov eax,[_y_yPos] mov eax,edi - cmp eax,large 0 - jl short y_getout - cmp eax,large 4096 - jl short y_inbounds + cmp eax,large 0 + jl short y_getout + cmp eax,large 4096 + jl short y_inbounds y_getout: - jmp loopdone + jmp loopdone y_inbounds: - sar edx,22 - and eax,-64 - add eax,edx - cmp eax,4095 - ja y_getout + sar edx,22 + and eax,-64 + add eax,edx + cmp eax,4095 + ja y_getout - mov [byte ptr _HitMap+eax],1 + mov [byte ptr _HitMap+eax],1 - mov ebx,[dword ptr _yGridGlobal] - mov cx,[ebx+eax*2] + mov ebx,[dword ptr _yGridGlobal] + mov cx,[ebx+eax*2] ;-; test cx,cx -;-; jnz short y_wall_here -;-; jmp y_next_square +;-; jnz short y_wall_here +;-; jmp y_next_square jcxz y_next_square y_wall_here: - mov [word ptr COLOR],cx - mov [_yMapPosn],eax + mov [word ptr COLOR],cx + mov [_yMapPosn],eax -;-; mov ebx,[dword ptr _y_xPos] +;-; mov ebx,[dword ptr _y_xPos] mov ebx,esi - mov [dword ptr _LastX1],ebx -;-; mov edx,[dword ptr _y_yPos] + mov [dword ptr _LastX1],ebx +;-; mov edx,[dword ptr _y_yPos] mov edx,edi - mov [dword ptr _iLastY],edx - mov edx,ebx + mov [dword ptr _iLastY],edx + mov edx,ebx test cx,DOOR_WALL - jz short y_not_door + jz short y_not_door - sar ebx,16 - and ebx,large 00000FFC0h - mov [dword ptr YD],ebx + sar ebx,16 + and ebx,large 00000FFC0h + mov [dword ptr YD],ebx - add ebx,large 64 - mov [dword ptr XD],ebx + add ebx,large 64 + mov [dword ptr XD],ebx - mov eax,[dword ptr _y_xNext] - sar eax,1 - add edx,eax - mov [dword ptr YTEMP],edx - sar edx,16 + mov eax,[dword ptr _y_xNext] + sar eax,1 + add edx,eax + mov [dword ptr YTEMP],edx + sar edx,16 - cmp edx,[dword ptr YD] - jl short y_door_not_visible - cmp edx,[dword ptr XD] - jle short y_door_visible + cmp edx,[dword ptr YD] + jl short y_door_not_visible + cmp edx,[dword ptr XD] + jle short y_door_visible y_door_not_visible: -;-; mov eax,[dword ptr _y_xNext] -;-; add [dword ptr _y_xPos],eax -;-; mov eax,[dword ptr _y_yNext] -;-; add [dword ptr _y_yPos],eax +;-; mov eax,[dword ptr _y_xNext] +;-; add [dword ptr _y_xPos],eax +;-; mov eax,[dword ptr _y_yNext] +;-; add [dword ptr _y_yPos],eax add esi,[dword ptr _y_xNext] add edi,[dword ptr _y_yNext] - jmp y_looptop + jmp y_looptop y_door_visible: - mov eax,[dword ptr YTEMP] - mov [dword ptr _LastX1],eax - mov eax,[dword ptr _y_yNext] - sar eax,1 - add [dword ptr _iLastY],eax + mov eax,[dword ptr YTEMP] + mov [dword ptr _LastX1],eax + mov eax,[dword ptr _y_yNext] + sar eax,1 + add [dword ptr _iLastY],eax y_not_door: test cx,DOOR_TYPE_SECRET - jz short y_br_no_secret - cmp [word ptr _ySecretColumn],0 - jne short y_secret_door + jz short y_br_no_secret + cmp [word ptr _ySecretColumn],0 + jne short y_secret_door y_br_no_secret: - jmp y_give_color + jmp y_give_color y_secret_door: movzx eax,[word ptr _ySecretColumn] movzx edx,[word ptr _ViewAngle] - mov ebx,[dword ptr _LongInvTanTable] + mov ebx,[dword ptr _LongInvTanTable] imul eax,[dword ptr ebx+edx*4] - mov [dword ptr SX],eax -;-; mov ebx,[dword ptr _y_xPos] + mov [dword ptr SX],eax +;-; mov ebx,[dword ptr _y_xPos] mov ebx,esi - add eax,ebx - mov [dword ptr YTEMP],eax - sar eax,16 - sar ebx,16 - and ebx,large 00000FFC0h - mov ecx,ebx - add ecx,large 64 + add eax,ebx + mov [dword ptr YTEMP],eax + sar eax,16 + sar ebx,16 + and ebx,large 00000FFC0h + mov ecx,ebx + add ecx,large 64 - cmp eax,ebx - jl short y_secret_not_visible - cmp eax,ecx - jle short y_secret_is_visible + cmp eax,ebx + jl short y_secret_not_visible + cmp eax,ecx + jle short y_secret_is_visible y_secret_not_visible: - jmp y_door_not_visible + jmp y_door_not_visible y_secret_is_visible: - mov eax,[dword ptr YTEMP] - mov [dword ptr _LastX1],eax - mov eax,[dword ptr _ySecretColumn] - add [dword ptr _iLastY],eax - jmp short y_give_color + mov eax,[dword ptr YTEMP] + mov [dword ptr _LastX1],eax + mov eax,[dword ptr _ySecretColumn] + add [dword ptr _iLastY],eax + jmp short y_give_color y_next_square: -;-; mov eax,[dword ptr _y_xNext] -;-; add [dword ptr _y_xPos],eax -;-; mov eax,[dword ptr _y_yNext] -;-; add [dword ptr _y_yPos],eax +;-; mov eax,[dword ptr _y_xNext] +;-; add [dword ptr _y_xPos],eax +;-; mov eax,[dword ptr _y_yNext] +;-; add [dword ptr _y_yPos],eax add esi,[dword ptr _y_xNext] add edi,[dword ptr _y_yNext] - jmp y_looptop + jmp y_looptop y_loopdone: mov [word ptr COLOR],0 @@ -976,14 +976,13 @@ y_give_color: movzx eax,[word ptr COLOR] yRayDone: - pop edx - pop ecx - pop ebx - pop edi - pop esi + pop edx + pop ecx + pop ebx + pop edi + pop esi ret endp - end + end - \ No newline at end of file diff --git a/ack_lib/ACKRTN.INC b/ack_lib/ACKRTN.INC index b7233bc..d7baece 100644 --- a/ack_lib/ACKRTN.INC +++ b/ack_lib/ACKRTN.INC @@ -1,130 +1,129 @@ -_BORLANDC_ = 1 +_BORLANDC_ = 1 -MACRO ACKPROC L +MACRO ACKPROC L IFDEF _BORLANDC_ -PROC _&L NEAR +PROC _&L NEAR ENDIF IFDEF _WATCOMC_ -PROC &L_ NEAR +PROC &L_ NEAR ENDIF - ENDM + ENDM -MACRO ACKEXT L +MACRO ACKEXT L IFDEF _BORLANDC_ - extrn _&L:NEAR + extrn _&L:NEAR ENDIF -IFDEF _WATCOMC_ - extrn &L_:NEAR +IFDEF _WATCOMC_ + extrn &L_:NEAR ENDIF - ENDM + ENDM -MACRO ACKPUBS LAB -IFDEF _BORLANDC_ - public _&LAB +MACRO ACKPUBS LAB +IFDEF _BORLANDC_ + public _&LAB ENDIF -IFDEF _WATCOMC_ - public &LAB_ +IFDEF _WATCOMC_ + public &LAB_ ENDIF - ENDM + ENDM -MACRO ACKCALL LAB -IFDEF _BORLANDC_ - call _&LAB +MACRO ACKCALL LAB +IFDEF _BORLANDC_ + call _&LAB ENDIF -IFDEF _WATCOMC_ - call &LAB_ +IFDEF _WATCOMC_ + call &LAB_ ENDIF - ENDM + ENDM -IFDEF _BORLANDC_ -VIDSEG equ 0a0000000h +IFDEF _BORLANDC_ +VIDSEG equ 0a0000000h ENDIF -IFDEF _WATCOMC_ -VIDSEG equ 0a0000h +IFDEF _WATCOMC_ +VIDSEG equ 0a0000h ENDIF ;; Equates for SLICE struct -sabMap equ 0 -samPtr equ 4 -sabNumber equ 8 -sabColumn equ 10 -saDist equ 12 -samPos equ 14 -saType equ 16 -saFnc equ 17 -saActive equ 21 -saPrev equ 22 -saNext equ 26 -saSize equ 30 ;size of SLICE structure +sabMap equ 0 +samPtr equ 4 +sabNumber equ 8 +sabColumn equ 10 +saDist equ 12 +samPos equ 14 +saType equ 16 +saFnc equ 17 +saActive equ 21 +saPrev equ 22 +saNext equ 26 +saSize equ 30 ;size of SLICE structure ; Equates for upper byte of walls -WALL_TYPE_UPPER equ 0200h -WALL_TYPE_MULTI equ 0400h -WALL_UPPER_MULTI equ 0600h -WALL_TYPE_TRANS equ 0800h -DOOR_TYPE_SECRET equ 8000h -DOOR_LOCKED equ 4000h -DOOR_TYPE_SLIDE equ 2000h -DOOR_TYPE_SPLIT equ 1000h -DOOR_WALL equ 3000h +WALL_TYPE_UPPER equ 0200h +WALL_TYPE_MULTI equ 0400h +WALL_UPPER_MULTI equ 0600h +WALL_TYPE_TRANS equ 0800h +DOOR_TYPE_SECRET equ 8000h +DOOR_LOCKED equ 4000h +DOOR_TYPE_SLIDE equ 2000h +DOOR_TYPE_SPLIT equ 1000h +DOOR_WALL equ 3000h ; Equates for LightFlag -SHADING_OFF equ 0 -SHADING_ON equ 1 +SHADING_OFF equ 0 +SHADING_ON equ 1 -ST_WALL equ 1 -ST_OBJECT equ 2 +ST_WALL equ 1 +ST_OBJECT equ 2 -DOOR_XCODE equ 60 -DOOR_YCODE equ 62 +DOOR_XCODE equ 60 +DOOR_YCODE equ 62 -RES_LOW equ 1 +RES_LOW equ 1 ;; Equates for SCOL struct -Vid equ 0 -Wall equ 4 -Pal equ 8 -dst equ 12 -wht equ 14 -multi equ 16 -topht equ 18 -botht equ 20 -savwht equ 22 -mulcnt equ 24 -savVid equ 26 -bNum equ 30 -scLen equ 32 ; length of structure +Vid equ 0 +Wall equ 4 +Pal equ 8 +dst equ 12 +wht equ 14 +multi equ 16 +topht equ 18 +botht equ 20 +savwht equ 22 +mulcnt equ 24 +savVid equ 26 +bNum equ 30 +scLen equ 32 ; length of structure ; Equates for SysFlag -SYS_SOLID_BACK equ 8000h ; On if solid color bkgd vs picture -SYS_SOLID_FLOOR equ 4000h ; On if solid vs texture floor -SYS_SOLID_CEIL equ 2000h ; On if solid vs texture ceiling -SYS_NO_WALLS equ 1000h ; On if walls are NOT to display +SYS_SOLID_BACK equ 8000h ; On if solid color bkgd vs picture +SYS_SOLID_FLOOR equ 4000h ; On if solid vs texture floor +SYS_SOLID_CEIL equ 2000h ; On if solid vs texture ceiling +SYS_NO_WALLS equ 1000h ; On if walls are NOT to display -Color equ ebp-4 -retval equ ebp-6 -MapPosn equ ebp-8 -xBeg equ ebp-10 -;xPos equ ebp-14 -;xNext equ ebp-18 -;yPos equ ebp-22 -;yNext equ ebp-26 -xd equ ebp-30 -yd equ ebp-34 -yTemp equ ebp-38 -sy equ ebp-42 -sx equ ebp-46 +Color equ ebp-4 +retval equ ebp-6 +MapPosn equ ebp-8 +xBeg equ ebp-10 +;xPos equ ebp-14 +;xNext equ ebp-18 +;yPos equ ebp-22 +;yNext equ ebp-26 +xd equ ebp-30 +yd equ ebp-34 +yTemp equ ebp-38 +sy equ ebp-42 +sx equ ebp-46 -INT_ANGLE_32 equ 160 -INT_ANGLE_90 equ 450 -INT_ANGLE_135 equ 675 -INT_ANGLE_180 equ 900 -INT_ANGLE_225 equ 1125 -INT_ANGLE_270 equ 1350 -INT_ANGLE_360 equ 1800 +INT_ANGLE_32 equ 160 +INT_ANGLE_90 equ 450 +INT_ANGLE_135 equ 675 +INT_ANGLE_180 equ 900 +INT_ANGLE_225 equ 1125 +INT_ANGLE_270 equ 1350 +INT_ANGLE_360 equ 1800 - \ No newline at end of file diff --git a/ack_lib/ACKRTN1.ASM b/ack_lib/ACKRTN1.ASM index 4397900..1a4dc50 100644 --- a/ack_lib/ACKRTN1.ASM +++ b/ack_lib/ACKRTN1.ASM @@ -1,75 +1,75 @@ - IDEAL - JUMPS - P386 - P387 + IDEAL + JUMPS + P386 + P387 - MASM - .MODEL FLAT + MASM + .MODEL FLAT - .DATA + .DATA SVTABLE dd ? -ENDPOS dd ? +ENDPOS dd ? - .CODE - IDEAL + .CODE + IDEAL - 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 + ACKEXT ShowColLow + ACKEXT ShowColMaskLow - ACKPUBS ShowCol - ACKPUBS ShowColMask - ACKPUBS DrawWalls + ACKPUBS ShowCol + ACKPUBS ShowColMask + ACKPUBS DrawWalls align 2 @@ -77,149 +77,149 @@ align 2 ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC ShowCol - push ebp - push esi - push edi + push ebp + push esi + push edi - mov edi,[_scVid] ;Video buffer position - mov ebp,[_scPal] ;Pointer to palette for shading + mov edi,[_scVid] ;Video buffer position + mov ebp,[_scPal] ;Pointer to palette for shading - mov ax,[_scwht] ;Height to use - mov [_scsavwht],ax ;save for later + mov ax,[_scwht] ;Height to use + mov [_scsavwht],ax ;save for later - movzx ecx,[_sctopht] - mov ebx,[_scWall] - add ebx,ecx - mov [_bmWall],ebx - mov ch,al - inc ch + movzx ecx,[_sctopht] + mov ebx,[_scWall] + add ebx,ecx + mov [_bmWall],ebx + mov ch,al + inc ch - mov esi,[_bmDistance] - mov esi,[_LowerTable+esi*4] - mov [SVTABLE],esi + mov esi,[_bmDistance] + mov esi,[_LowerTable+esi*4] + mov [SVTABLE],esi - mov eax,0 - mov ebx,0 + mov eax,0 + mov ebx,0 - test [word ptr _scbNum],WALL_TYPE_UPPER - jz short toprun - mov edx,[_bmDistance] + test [word ptr _scbNum],WALL_TYPE_UPPER + jz short toprun + mov edx,[_bmDistance] zztoploop: - dec ch - jz short zzdomulti - sub di,320 - add bx,dx - cmp bh,cl - jge short zzdomulti - jmp zztoploop + dec ch + jz short zzdomulti + sub di,320 + add bx,dx + cmp bh,cl + jge short zzdomulti + jmp zztoploop zzdomulti: - mov [_scwht],cx - mov [_scsavVid],edi - jmp chkmulti + mov [_scwht],cx + mov [_scsavVid],edi + jmp chkmulti toprun: - mov ebx,[_bmWall] + mov ebx,[_bmWall] toploop: - movzx edx,[word ptr esi] - cmp dl,cl - jg short botrun - lea esi,[esi+2] - neg edx - mov al,[ebx+edx] - mov al,[ebp+eax] - mov [edi],al - add edi,-320 - dec ch - jnz toploop + movzx edx,[word ptr esi] + cmp dl,cl + jg short botrun + lea esi,[esi+2] + neg edx + mov al,[ebx+edx] + mov al,[ebp+eax] + mov [edi],al + add edi,-320 + dec ch + jnz toploop botrun: - mov [_scwht],cx - mov [_scsavVid],edi - mov edi,[_scVid] - mov cx,[_scbotht] - mov dx,[_scsavwht] - mov ch,dl - mov esi,[SVTABLE] - inc ebx - dec cl + mov [_scwht],cx + mov [_scsavVid],edi + mov edi,[_scVid] + mov cx,[_scbotht] + mov dx,[_scsavwht] + mov ch,dl + mov esi,[SVTABLE] + inc ebx + dec cl botloop: - lea edi,[edi+320] - movzx edx,[word ptr esi] - cmp dl,cl - jge short chkmulti - lea esi,[esi+2] - mov al,[ebx+edx] - mov al,[ebp+eax] - mov [edi],al - dec ch - jnz botloop + lea edi,[edi+320] + movzx edx,[word ptr esi] + cmp dl,cl + jge short chkmulti + lea esi,[esi+2] + mov al,[ebx+edx] + mov al,[ebp+eax] + mov [edi],al + dec ch + jnz botloop chkmulti: - mov edi,[_scsavVid] - cmp [word ptr _scmulti],0 - jz alldone - mov cx,[_scmulcnt] + mov edi,[_scsavVid] + cmp [word ptr _scmulti],0 + jz alldone + mov cx,[_scmulcnt] - mov ebx,[_scMulData] ;ptr to count and wall data - mov cl,[ebx] ;get number of walls to draw - inc ebx - mov al,[ebx] ;first wall to show - inc ebx - mov [_scMulData],ebx - movzx ebx,al ;get wall number - mov esi,[_scColumn] ;Current bitmap column to display x 64 - lea esi,[esi+63] - mov [_scColumn],esi ;save for later use - mov eax,[_WallbMaps] ;Get array of bitmaps - mov ebx,[eax+ebx*4] ;Get the bitmap we are using - add ebx,esi ;point to bottom of column + mov ebx,[_scMulData] ;ptr to count and wall data + mov cl,[ebx] ;get number of walls to draw + inc ebx + mov al,[ebx] ;first wall to show + inc ebx + mov [_scMulData],ebx + movzx ebx,al ;get wall number + mov esi,[_scColumn] ;Current bitmap column to display x 64 + lea esi,[esi+63] + mov [_scColumn],esi ;save for later use + mov eax,[_WallbMaps] ;Get array of bitmaps + mov ebx,[eax+ebx*4] ;Get the bitmap we are using + add ebx,esi ;point to bottom of column - mov ax,[_scwht] ;Get height of window - mov ch,ah - cmp ch,0 ;Is there more room to draw? - jz short alldone ;br if at top of window + mov ax,[_scwht] ;Get height of window + mov ch,ah + cmp ch,0 ;Is there more room to draw? + jz short alldone ;br if at top of window - mov esi,[SVTABLE] - mov eax,0 + mov esi,[SVTABLE] + mov eax,0 mulloop: - movzx eax,[word ptr esi] ;Get height displacement for this row - cmp al,64 ;Did we do the entire column? - jge short nextlevel ;Yes, see if more walls - lea esi,[esi+2] - neg eax ;Invert so we can add it below - movzx eax,[byte ptr ebx+eax] ;Get the pixel from the bitmap - mov al,[ebp+eax] ;Map it to the palette for shading - mov [edi],al ;Place it into the video buffer - dec ch ;Bump the window height - jz short alldone ;br if at the top of the window - sub edi,320 ;next video row - jmp mulloop + movzx eax,[word ptr esi] ;Get height displacement for this row + cmp al,64 ;Did we do the entire column? + jge short nextlevel ;Yes, see if more walls + lea esi,[esi+2] + neg eax ;Invert so we can add it below + movzx eax,[byte ptr ebx+eax] ;Get the pixel from the bitmap + mov al,[ebp+eax] ;Map it to the palette for shading + mov [edi],al ;Place it into the video buffer + dec ch ;Bump the window height + jz short alldone ;br if at the top of the window + sub edi,320 ;next video row + jmp mulloop nextlevel: - dec cl ;Bump wall count - jz short alldone ;br if no more walls - mov ebx,[_scMulData] ;Get pointer to the multi-ht data - movzx eax,[byte ptr ebx] ;next wall number - inc ebx ;Advance for next wall - mov [_scMulData],ebx - mov ebx,[_WallbMaps] ;Get wall array - mov ebx,[ebx+eax*4] ;Get wall bitmap to use - add ebx,[dword ptr _scColumn] ;add in current column - mov eax,0 - mov esi,[SVTABLE] - jmp mulloop + dec cl ;Bump wall count + jz short alldone ;br if no more walls + mov ebx,[_scMulData] ;Get pointer to the multi-ht data + movzx eax,[byte ptr ebx] ;next wall number + inc ebx ;Advance for next wall + mov [_scMulData],ebx + mov ebx,[_WallbMaps] ;Get wall array + mov ebx,[ebx+eax*4] ;Get wall bitmap to use + add ebx,[dword ptr _scColumn] ;add in current column + mov eax,0 + mov esi,[SVTABLE] + jmp mulloop alldone: - pop edi - pop esi - pop ebp - ret - endp + pop edi + pop esi + pop ebp + ret + endp align 2 @@ -227,345 +227,344 @@ align 2 ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC ShowColMask - push ebp - push esi - push edi - mov ebp,eax - mov [_scPtr],eax - mov edi,[_scVid] - mov edx,[_scPal] - mov ax,[_scwht] - mov [_scsavwht],ax - movzx ecx,[_sctopht] - mov ebx,[_scWall] - add ebx,ecx - mov [_bmWall],ebx - mov ch,al - inc ch - mov eax,0 - mov ebx,0 + push ebp + push esi + push edi + mov ebp,eax + mov [_scPtr],eax + mov edi,[_scVid] + mov edx,[_scPal] + mov ax,[_scwht] + mov [_scsavwht],ax + movzx ecx,[_sctopht] + mov ebx,[_scWall] + add ebx,ecx + mov [_bmWall],ebx + mov ch,al + inc ch + mov eax,0 + mov ebx,0 ;--TEST------------------------------------------------------------------------ - test [word ptr _scbNum],WALL_TYPE_UPPER - jz short m_toprun - mov ebp,[_bmDistance] + test [word ptr _scbNum],WALL_TYPE_UPPER + jz short m_toprun + mov ebp,[_bmDistance] m_zztoploop: - dec ch - jz short m_zzdomulti - add bx,bp - cmp bh,cl - jge short m_zzdomulti - sub edi,320 - jmp m_zztoploop + dec ch + jz short m_zzdomulti + add bx,bp + cmp bh,cl + jge short m_zzdomulti + sub edi,320 + jmp m_zztoploop m_zzdomulti: - mov ebp,[_scPtr] - mov [_scwht],cx - mov [_scsavVid],edi - jmp m_chkmulti + mov ebp,[_scPtr] + mov [_scwht],cx + mov [_scsavVid],edi + jmp m_chkmulti ;--TEST------------------------------------------------------------------------ m_toprun: - mov ebp,[_bmDistance] - mov esi,[_bmWall] + mov ebp,[_bmDistance] + mov esi,[_bmWall] m_toploop: - movzx eax,bh - neg eax - movzx eax,[byte ptr esi+eax] - or al,al - jz short m_blank1 - mov al,[edx+eax] - mov [edi],al + movzx eax,bh + neg eax + movzx eax,[byte ptr esi+eax] + or al,al + jz short m_blank1 + mov al,[edx+eax] + mov [edi],al m_blank1: - add bx,bp - cmp bh,cl - jg short m_botrun - dec ch - jz short m_botrun - sub edi,320 - jmp m_toploop + add bx,bp + cmp bh,cl + jg short m_botrun + dec ch + jz short m_botrun + sub edi,320 + jmp m_toploop m_botrun: - mov ebp,[_scPtr] - mov [_scwht],cx - mov [_scsavVid],edi - mov edi,[_scVid] - mov cx,[_scbotht] - mov bx,[_scsavwht] - mov ch,bl - mov ebx,0 - inc esi - mov ebp,[_bmDistance] - mov eax,0 - dec cl + mov ebp,[_scPtr] + mov [_scwht],cx + mov [_scsavVid],edi + mov edi,[_scVid] + mov cx,[_scbotht] + mov bx,[_scsavwht] + mov ch,bl + mov ebx,0 + inc esi + mov ebp,[_bmDistance] + mov eax,0 + dec cl m_botloop: - add edi,320 - mov al,bh - mov al,[esi+eax] - or al,al - jz short m_blank2 - mov al,[edx+eax] - mov [edi],al + add edi,320 + mov al,bh + mov al,[esi+eax] + or al,al + jz short m_blank2 + mov al,[edx+eax] + mov [edi],al m_blank2: - dec ch - jz short m_chkmulti - add bx,bp - cmp bh,cl - jl m_botloop + dec ch + jz short m_chkmulti + add bx,bp + cmp bh,cl + jl m_botloop m_chkmulti: - mov ebp,[_scPtr] - cmp [word ptr _scmulti],0 - jz short m_alldone - mov cx,[_scmulcnt] - mov bx,[_scwht] - mov ch,bh - cmp ch,0 - jz short m_alldone + mov ebp,[_scPtr] + cmp [word ptr _scmulti],0 + jz short m_alldone + mov cx,[_scmulcnt] + mov bx,[_scwht] + mov ch,bh + cmp ch,0 + jz short m_alldone - mov edi,[_scsavVid] - mov ebx,[_scWall] - add ebx,63 - mov [_bmWall],ebx - mov ebx,0 - mov ebp,[_bmDistance] - mov esi,[_bmWall] + mov edi,[_scsavVid] + mov ebx,[_scWall] + add ebx,63 + mov [_bmWall],ebx + mov ebx,0 + mov ebp,[_bmDistance] + mov esi,[_bmWall] m_mulloop: - sub edi,320 - movzx eax,bh - neg eax - movzx eax,[byte ptr esi+eax] - or al,al - jz m_blank3 - mov al,[edx+eax] - mov [edi],al + sub edi,320 + movzx eax,bh + neg eax + movzx eax,[byte ptr esi+eax] + or al,al + jz m_blank3 + mov al,[edx+eax] + mov [edi],al m_blank3: - dec ch - jz short m_alldone - add bx,bp - cmp bh,64 - jge short m_nextlevel - jmp m_mulloop + dec ch + jz short m_alldone + add bx,bp + cmp bh,64 + jge short m_nextlevel + jmp m_mulloop m_nextlevel: - mov ebx,0 - dec cl - jnz m_mulloop + mov ebx,0 + dec cl + jnz m_mulloop m_alldone: - pop edi - pop esi - pop ebp - ret - endp + pop edi + pop esi + pop ebp + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; This routine runs through the list of slices and draws the walls. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC DrawWalls - push ebp - push esi - push edi + push ebp + push esi + push edi - mov ax,[_gWinHeight] - shr ax,1 - mov [_Floorht],ax - mov ax,[_ViewHeight] - mov [_sctopht],ax - mov dx,64 - sub dx,ax - mov [_scbotht],dx - movsx ebx,[word ptr _gWinStartX] - movsx ecx,[_gCenterOff] - add ecx,ebx - add ecx,[_gScrnBuffer] - mov [_scVid],ecx - cmp [word ptr _Resolution],1 ;is this low resolution? - je stw_lowres ;yes, perform faster draw + mov ax,[_gWinHeight] + shr ax,1 + mov [_Floorht],ax + mov ax,[_ViewHeight] + mov [_sctopht],ax + mov dx,64 + sub dx,ax + mov [_scbotht],dx + movsx ebx,[word ptr _gWinStartX] + movsx ecx,[_gCenterOff] + add ecx,ebx + add ecx,[_gScrnBuffer] + mov [_scVid],ecx + cmp [word ptr _Resolution],1 ;is this low resolution? + je stw_lowres ;yes, perform faster draw - movzx eax,[_gWinEndX] + movzx eax,[_gWinEndX] imul eax,saSize - mov [ENDPOS],eax + mov [ENDPOS],eax imul ebx,saSize stw010: - mov ebp,offset _Slice ; offset to slices array - add ebp,ebx + mov ebp,offset _Slice ; offset to slices array + add ebp,ebx stw020: - cmp [byte ptr ebp+saActive],0 ;is this an active slice? - jz short stw030 ;nope, so it's the last one - cmp [dword ptr ebp+saNext],0 ;is this the last slice? - jz short stw030 ;yes, so can't go further - mov ebp,[dword ptr ebp+saNext] ;point to next slice - jmp short stw020 + cmp [byte ptr ebp+saActive],0 ;is this an active slice? + jz short stw030 ;nope, so it's the last one + cmp [dword ptr ebp+saNext],0 ;is this the last slice? + jz short stw030 ;yes, so can't go further + mov ebp,[dword ptr ebp+saNext] ;point to next slice + jmp short stw020 stw030: - mov ax,[word ptr ebp+sabNumber] ;bitmap number - mov cx,ax - and cx,0ffh ;isolate number from flags - mov [_scmulcnt],cx ;save as current multi count - mov [_scbNum],ax ;and bitmap number and flags + mov ax,[word ptr ebp+sabNumber] ;bitmap number + mov cx,ax + and cx,0ffh ;isolate number from flags + mov [_scmulcnt],cx ;save as current multi count + mov [_scbNum],ax ;and bitmap number and flags - mov cx,0 ;set multi-flag to none + mov cx,0 ;set multi-flag to none test ax,WALL_TYPE_MULTI - jz short stw040 - mov esi,[dword ptr ebp+samPtr] - mov [_scMulData],esi - or esi,esi ;is there multi-ht data? - jz short stw040 ;br if not - mov cx,1 ;set multi-flag to yes + jz short stw040 + mov esi,[dword ptr ebp+samPtr] + mov [_scMulData],esi + or esi,esi ;is there multi-ht data? + jz short stw040 ;br if not + mov cx,1 ;set multi-flag to yes stw040: - mov [_scmulti],cx - mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps - movzx esi,al ;get low byte of bitmap number - shl esi,2 + mov [_scmulti],cx + mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps + movzx esi,al ;get low byte of bitmap number + shl esi,2 - mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer - movsx ecx,[word ptr ebp+saDist] ;distance to slice - mov [_bmDistance],ecx ;save for draw routine - shr ecx,6 ;bring it down into palette range - cmp ecx,15 ;check against max palette number - jbe short stw050 - mov ecx,15 ;force to max if above + mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer + movsx ecx,[word ptr ebp+saDist] ;distance to slice + mov [_bmDistance],ecx ;save for draw routine + shr ecx,6 ;bring it down into palette range + cmp ecx,15 ;check against max palette number + jbe short stw050 + mov ecx,15 ;force to max if above stw050: - shl ecx,8 ;x256 for palette entry - mov edi,[_gPalTable] ;pointer to palette table - add edi,ecx - movsx ecx,[word ptr ebp+sabColumn] ;column of bitmap slice - shl ecx,6 ;x64 to get correct row (column) - add esi,ecx ;adjust wall point to correct column - mov [_scColumn],ecx ;save for multi-ht walls + shl ecx,8 ;x256 for palette entry + mov edi,[_gPalTable] ;pointer to palette table + add edi,ecx + movsx ecx,[word ptr ebp+sabColumn] ;column of bitmap slice + shl ecx,6 ;x64 to get correct row (column) + add esi,ecx ;adjust wall point to correct column + mov [_scColumn],ecx ;save for multi-ht walls - mov [_scWall],esi - mov [_scPal],edi - mov eax,0 - mov [_scsavVid],eax ;null out saved video + mov [_scWall],esi + mov [_scPal],edi + mov eax,0 + mov [_scsavVid],eax ;null out saved video - mov ax,[_Floorht] ;window height / 2 saved earlier - mov [_scwht],ax + mov ax,[_Floorht] ;window height / 2 saved earlier + mov [_scwht],ax - mov esi,ebx + mov esi,ebx call [dword ptr ebp+saFnc] - mov ebx,esi + mov ebx,esi stw075: - cmp [dword ptr ebp+saPrev],0 ;is this the first slice? - jz short stw080 ;yes, go to next column - mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice - jmp stw030 ;and start again with same column + cmp [dword ptr ebp+saPrev],0 ;is this the first slice? + jz short stw080 ;yes, go to next column + mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice + jmp stw030 ;and start again with same column stw080: - inc [dword ptr _scVid] ;next video position - add ebx,saSize - cmp ebx,[ENDPOS] - ja stw_getout ;yes, get out - jmp stw010 + inc [dword ptr _scVid] ;next video position + add ebx,saSize + cmp ebx,[ENDPOS] + ja stw_getout ;yes, get out + jmp stw010 stw_lowres: - mov eax,ebx ; current column of display - imul eax,saSize ; size of slice structure - mov ebp,offset _Slice ; offset to slices - add ebp,eax + mov eax,ebx ; current column of display + imul eax,saSize ; size of slice structure + mov ebp,offset _Slice ; offset to slices + add ebp,eax stwlr020: - cmp [byte ptr ebp+saActive],0 ;is this an active slice? - jz short stwlr030 ;nope, so it's the last one - cmp [dword ptr ebp+saNext],0 ;is this the last slice? - jz short stwlr030 ;yes, so can't go further - mov ebp,[dword ptr ebp+saNext] ;point to next slice - jmp short stwlr020 + cmp [byte ptr ebp+saActive],0 ;is this an active slice? + jz short stwlr030 ;nope, so it's the last one + cmp [dword ptr ebp+saNext],0 ;is this the last slice? + jz short stwlr030 ;yes, so can't go further + mov ebp,[dword ptr ebp+saNext] ;point to next slice + jmp short stwlr020 stwlr030: - mov ax,[word ptr ebp+sabNumber] ;bitmap number - mov cx,ax - and cx,0ffh ;isolate number from flags - mov [_scmulcnt],cx ;save as current multi count - mov [_scbNum],ax ;and bitmap number and flags + mov ax,[word ptr ebp+sabNumber] ;bitmap number + mov cx,ax + and cx,0ffh ;isolate number from flags + mov [_scmulcnt],cx ;save as current multi count + mov [_scbNum],ax ;and bitmap number and flags - mov cx,0 ;set multi-flag to none + mov cx,0 ;set multi-flag to none test ax,WALL_TYPE_MULTI - jz short stwlr040 + jz short stwlr040 - mov esi,[dword ptr ebp+samPtr] - mov [_scMulData],esi - or esi,esi ;is there multi-height data? - jz short stwlr040 ;br if not - mov cx,1 ;set multi-flag to yes + mov esi,[dword ptr ebp+samPtr] + mov [_scMulData],esi + or esi,esi ;is there multi-height data? + jz short stwlr040 ;br if not + mov cx,1 ;set multi-flag to yes stwlr040: - mov [_scmulti],cx - mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps - movzx esi,al ;get low byte of bitmap number - shl esi,2 - mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer - movsx ecx,[word ptr ebp+saDist] ;distance to slice - mov [_bmDistance],ecx ;save for draw routine - shr ecx,6 ;bring it down into palette range - cmp ecx,15 ;check against max palette number - jbe short stwlr050 - mov ecx,15 ;force to max if above + mov [_scmulti],cx + mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps + movzx esi,al ;get low byte of bitmap number + shl esi,2 + mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer + movsx ecx,[word ptr ebp+saDist] ;distance to slice + mov [_bmDistance],ecx ;save for draw routine + shr ecx,6 ;bring it down into palette range + cmp ecx,15 ;check against max palette number + jbe short stwlr050 + mov ecx,15 ;force to max if above stwlr050: - shl ecx,8 ;x256 for palette entry - mov edi,[_gPalTable] ;pointer to palette table - add edi,ecx + shl ecx,8 ;x256 for palette entry + mov edi,[_gPalTable] ;pointer to palette table + add edi,ecx movsx ecx,[byte ptr ebp+sabColumn] ;column of bitmap slice - shl ecx,6 ;x64 to get correct row (column) - add esi,ecx ;adjust wall point to correct column - mov [_scColumn],ecx ;save for multi-ht walls + shl ecx,6 ;x64 to get correct row (column) + add esi,ecx ;adjust wall point to correct column + mov [_scColumn],ecx ;save for multi-ht walls - mov [_scWall],esi - mov [_scPal],edi - mov eax,0 - mov [_scsavVid],eax ;null out saved video + mov [_scWall],esi + mov [_scPal],edi + mov eax,0 + mov [_scsavVid],eax ;null out saved video - mov ax,[_Floorht] ;window height / 2 saved earlier - mov [_scwht],ax + mov ax,[_Floorht] ;window height / 2 saved earlier + mov [_scwht],ax - mov esi,ebx - cmp [byte ptr ebp+saType],ST_WALL ;transparent wall? - je short stwlr060 ;nope, use solid slice routine - ACKCALL ShowColMaskLow - jmp short stwlr070 + mov esi,ebx + cmp [byte ptr ebp+saType],ST_WALL ;transparent wall? + je short stwlr060 ;nope, use solid slice routine + ACKCALL ShowColMaskLow + jmp short stwlr070 stwlr060: - ACKCALL ShowColLow + ACKCALL ShowColLow stwlr070: - mov ebx,esi - cmp [dword ptr ebp+saPrev],0 ;is this the first slice? - jz short stwlr080 ;yes, go to next column - mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice - jmp stwlr030 ;and start again with same column + mov ebx,esi + cmp [dword ptr ebp+saPrev],0 ;is this the first slice? + jz short stwlr080 ;yes, go to next column + mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice + jmp stwlr030 ;and start again with same column stwlr080: - add [dword ptr _scVid],2 ;next video position - inc ebx ;next column - inc ebx ;next column - cmp bx,[word ptr _gWinEndX] ;are we at the end of the window? - ja short stw_getout ;yes, get out - jmp stw_lowres + add [dword ptr _scVid],2 ;next video position + inc ebx ;next column + inc ebx ;next column + cmp bx,[word ptr _gWinEndX] ;are we at the end of the window? + ja short stw_getout ;yes, get out + jmp stw_lowres stw_getout: - pop edi - pop esi - pop ebp - ret - endp + pop edi + pop esi + pop ebp + ret + endp - end + end - \ No newline at end of file diff --git a/ack_lib/ACKRTN2.ASM b/ack_lib/ACKRTN2.ASM index 19ee54b..7a70f74 100644 --- a/ack_lib/ACKRTN2.ASM +++ b/ack_lib/ACKRTN2.ASM @@ -22,7 +22,7 @@ extrn _yPglobal:dword extrn _xBegGlobal:dword extrn _yBegGlobal:dword - extrn _aeGlobal:dword + extrn _aeGlobal:dword extrn _xGridGlobal:dword extrn _yGridGlobal:dword extrn _xPglobalHI:dword @@ -46,7 +46,7 @@ extrn _CeilingHeight:word extrn _gTopColor:byte extrn _gBottomColor:byte - extrn _PlayerAngle:word + extrn _PlayerAngle:word extrn _gScrnBuffer:dword extrn _gBkgdBuffer:dword extrn _gCenterOff:word @@ -70,7 +70,7 @@ extrn _ViewColumn:word extrn _SinTable:dword extrn _CosTable:dword - extrn _LongTanTable:dword + extrn _LongTanTable:dword extrn _LongInvTanTable:dword extrn _InvCosTable:byte extrn _InvSinTable:byte @@ -94,7 +94,7 @@ extrn _x_yPos:dword extrn _x_xNext:dword extrn _x_yNext:dword - extrn _y_xPos:dword + extrn _y_xPos:dword extrn _y_yPos:dword extrn _y_xNext:dword extrn _y_yNext:dword @@ -118,7 +118,7 @@ extrn _Floorptr2:dword extrn _Floorht:dword extrn _Floorwt:dword - extrn _Floorvht:word + extrn _Floorvht:word extrn _Flooreht:word extrn _FloorLastbNum:dword extrn _FloorLastbm:dword @@ -133,15 +133,15 @@ ACKEXT DrawBackDrop ACKEXT ShowCol ACKEXT ShowColMask - ACKEXT FindDoor - ACKEXT xRayCast - ACKEXT yRayCast + ACKEXT FindDoor + ACKEXT xRayCast + ACKEXT yRayCast - ACKPUBS xxxAckDrawFloor - ACKPUBS xxxAckDrawFloorOnly - ACKPUBS xxxAckDrawCeilingOnly + ACKPUBS xxxAckDrawFloor + ACKPUBS xxxAckDrawFloorOnly + ACKPUBS xxxAckDrawCeilingOnly - .DATA + .DATA ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; Globals used by the AckDrawFloor routine @@ -157,45 +157,45 @@ FSCRN dd ? CSCRN dd ? CV dd ? SV dd ? -BA dd ? +BA dd ? BA1 dd ? ZDPTR dd ? POS dd ? BMPOS dd ? MPOS dd ? MPOSHI dd ? -SCANTBL dd ? +SCANTBL dd ? LINENUM dd ? -LASTDIST dd ? +LASTDIST dd ? ;LASTX dd ? ;LASTY dd ? LASTEBP dd ? LASTEAX dd ? -LASTEDX dd ? -WALLDIST dd ? +LASTEDX dd ? +WALLDIST dd ? - .CODE - IDEAL + .CODE + IDEAL ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC xxxAckDrawFloor - push ebp + push ebp push esi push edi push ebx push ecx push edx - movzx eax,[word ptr _PlayerAngle] + movzx eax,[word ptr _PlayerAngle] mov ecx,eax - sub eax,INT_ANGLE_32 + sub eax,INT_ANGLE_32 jnc short adf_20 add eax,INT_ANGLE_360 adf_20: - mov ebx,640 + mov ebx,640 cdq idiv ebx mov [BCOL],edx @@ -214,12 +214,12 @@ adf_30: sar eax,1 movzx ebx,[word ptr _gWinEndY] sub ebx,eax - inc ebx + inc ebx sub ebx,5 ; 6 mov [EY],ebx mov edi,[_gScrnBuffer] movzx eax,[word ptr _gCenterOff] - mov ebx,eax + mov ebx,eax add eax,1920 add eax,edi mov [BFSCRN],eax @@ -236,14 +236,14 @@ adf_30: adf_loop: mov eax,[_CosTable] shl ebx,2 - mov eax,[eax+ebx] + mov eax,[eax+ebx] mov [CV],eax - mov eax,[_SinTable] + mov eax,[_SinTable] mov eax,[eax+ebx] mov [SV],eax mov eax,[dword ptr _WallDistTable+ebp*4] - mov [WALLDIST],eax + mov [WALLDIST],eax mov eax,[BCSCRN] mov [CSCRN],eax @@ -260,17 +260,17 @@ adf_loop: adf_l10: mov eax,[_BackArray+ebx*4] - add eax,ecx + add eax,ecx mov [BA1],eax - inc ebx + 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 + mov [BCOL],ebx + lea esi,[offset _zdTable] + mov ecx,[EY] ;Number of rows to draw imul eax,ebp,800 add esi,eax @@ -284,7 +284,7 @@ adf_yloop: cmp edx,[WALLDIST] jb short adf_distokay lea edi,[edi+320] - jmp adf_ycont + jmp adf_ycont adf_distokay: cmp edx,[LASTDIST] @@ -294,7 +294,7 @@ adf_distokay: mov ebp,[LASTEBP] mov eax,[LASTEAX] mov edx,[LASTEDX] - jmp short adf_samedist + jmp short adf_samedist adf_newdist: mov [LASTDIST],edx @@ -308,7 +308,7 @@ adf_newdist: add eax,edx mov edx,[_yPglobal] add ebx,edx -; mov [LASTX],eax +; mov [LASTX],eax ; mov [LASTY],ebx ;adf_samedist: @@ -318,7 +318,7 @@ adf_newdist: sar ebp,6 add ebp,edx ;Pos within floor and ceiling maps - and ebx,63 + and ebx,63 shl ebx,6 and eax,63 add eax,ebx ;bitmap position @@ -333,14 +333,14 @@ adf_newdist: 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 + mov ebx,[SCANTBL] + mov dl,[ebx+edx] + mov dh,dl + mov [LASTEDX],edx adf_samedist: - mov [edi],dx - lea edi,[edi+320] + mov [edi],dx + lea edi,[edi+320] movzx ebx,[word ptr _CeilMap+ebp] mov ebp,[CSCRN] @@ -356,7 +356,7 @@ adf_samedist: mov [ebp],ax mov eax,[LINENUM] - add eax,4 + add eax,4 mov [LINENUM],eax mov eax,[_scantables+eax] mov [SCANTBL],eax @@ -380,7 +380,7 @@ adf_ycont: mov eax,[LINENUM] add eax,4 mov [LINENUM],eax - mov eax,[_scantables+eax] + mov eax,[_scantables+eax] mov [SCANTBL],eax sub [dword ptr CSCRN],320 dec [dword ptr BA] @@ -404,7 +404,7 @@ adf_l90: add [dword ptr BCSCRN],2 pop ebp lea ebp,[ebp+2] - cmp ebp,320 + cmp ebp,320 jb adf_loop @@ -422,12 +422,12 @@ adf_exit: ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC xxxAckDrawFloorOnly - push ebp - push esi - push edi - push ebx - push ecx - push edx + push ebp + push esi + push edi + push ebx + push ecx + push edx movzx eax,[word ptr _PlayerAngle] mov ecx,eax @@ -446,7 +446,7 @@ adfo_20: mov [HEIGHT],eax sub ecx,INT_ANGLE_32 - jnc short adfo_30 + jnc short adfo_30 add ecx,INT_ANGLE_360 adfo_30: @@ -470,7 +470,7 @@ adfo_30: mov ebp,0 mov [LINENUM],ebp mov ebx,[dword ptr _scantables] - mov [SCANTBL],ebx + mov [SCANTBL],ebx mov ebx,[VA] adfo_loop: @@ -518,7 +518,7 @@ adfo_l20: adfo_yloop: mov edx,[esi] lea esi,[esi+4] - mov eax,[CV] + mov eax,[CV] mov ebx,[SV] imul eax,edx imul ebx,edx @@ -542,7 +542,7 @@ adfo_yloop: mov ebx,0 - shl ebp,1 + shl ebp,1 mov bx,[word ptr _FloorMap+ebp] mov edx,[_WallbMaps] mov edx,[edx+ebx*4] @@ -566,7 +566,7 @@ adfo_ycont: mov eax,[LINENUM] add eax,4 mov [LINENUM],eax - mov eax,[_scantables+eax] + mov eax,[_scantables+eax] mov [SCANTBL],eax dec [dword ptr BA] dec [dword ptr BA1] @@ -590,7 +590,7 @@ adfo_l90: pop ebp lea ebp,[ebp+2] cmp ebp,320 - jb adfo_loop + jb adfo_loop adfo_exit: pop edx @@ -607,14 +607,14 @@ adfo_exit: ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC xxxAckDrawCeilingOnly - push ebp - push esi - push edi - push ebx - push ecx - push edx + push ebp + push esi + push edi + push ebx + push ecx + push edx - movzx eax,[word ptr _PlayerAngle] + movzx eax,[word ptr _PlayerAngle] mov ecx,eax sub eax,INT_ANGLE_32 jnc short adco_20 @@ -802,4 +802,3 @@ adco_exit: end - \ No newline at end of file diff --git a/ack_lib/ACKRTN3.ASM b/ack_lib/ACKRTN3.ASM index 59ac135..e6a538b 100644 --- a/ack_lib/ACKRTN3.ASM +++ b/ack_lib/ACKRTN3.ASM @@ -782,7 +782,7 @@ buv070: cmp [word ptr _LastWallHeight],200 ; No need to check if > 200 jg short buv080 - mov eax,[_sPtr] ; Get base address of column slice + mov eax,[_sPtr] ; Get base address of column slice cmp [dword ptr eax+saNext],0 ; Check for any more walls je short buv080 cmp [word ptr eax+saDist],96 ; Distance from POV to slice is @@ -827,4 +827,3 @@ buv_exit: end - \ No newline at end of file diff --git a/ack_lib/ACKRTN4.ASM b/ack_lib/ACKRTN4.ASM index 99d98bc..1bfee2b 100644 --- a/ack_lib/ACKRTN4.ASM +++ b/ack_lib/ACKRTN4.ASM @@ -1,12 +1,12 @@ - IDEAL - JUMPS - P386 - P387 ; Allow 386 processor + IDEAL + JUMPS + P386 + P387 ; Allow 386 processor - MASM - .MODEL FLAT ;32-bit OS/2 model + MASM + .MODEL FLAT ;32-bit OS/2 model .DATA @@ -16,108 +16,108 @@ SAVEVID dd ? SAVEROW dd ? - .CODE - IDEAL + .CODE + IDEAL - 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 + ACKEXT ShowCol + ACKEXT ShowColMask - 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 _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 + ACKPUBS Mymemset + ACKPUBS AckSpeedUp + ACKPUBS AckSlowDown + ACKPUBS ShowColNS + ACKPUBS ShowColMaskNS + ACKPUBS DrawBackDrop + ACKPUBS AckTimerHandler ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckTimerHandler - inc cs:[dword ptr _AckTimerCounter] + inc cs:[dword ptr _AckTimerCounter] iretd endp @@ -125,25 +125,25 @@ ACKPROC AckTimerHandler ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC Mymemset - push edi + push edi push ebx push ecx push edx - mov edi,eax - mov dh,dl - mov ax,dx - shl eax,16 - mov ax,dx - mov ecx,ebx - sar ecx,2 - rep stosd - mov ecx,ebx - and ecx,3 - rep stosb - pop edx - pop ecx - pop ebx - pop edi + mov edi,eax + mov dh,dl + mov ax,dx + shl eax,16 + mov ax,dx + mov ecx,ebx + sar ecx,2 + rep stosd + mov ecx,ebx + and ecx,3 + rep stosb + pop edx + pop ecx + pop ebx + pop edi ret endp @@ -152,24 +152,24 @@ ACKPROC Mymemset ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckSpeedUp - push ebx - push edx - mov bx,ax - mov ax,0FFFFH - xor dx,dx + push ebx + push edx + mov bx,ax + mov ax,0FFFFH + xor dx,dx idiv bx - mov bx,ax - mov dx,43h - mov al,36h - out dx,al - mov dx,40h - mov al,bl ; ffh = original value - out dx,al - mov dx,40h - mov al,bh ; 1fh = orignal value - out dx,al - pop edx - pop ebx + mov bx,ax + mov dx,43h + mov al,36h + out dx,al + mov dx,40h + mov al,bl ; ffh = original value + out dx,al + mov dx,40h + mov al,bh ; 1fh = orignal value + out dx,al + pop edx + pop ebx ret endp @@ -177,236 +177,235 @@ ACKPROC AckSpeedUp ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC AckSlowDown - push edx - mov dx,43h - mov al,36h - out dx,al - mov dx,40h - mov al,0ffh - out dx,al - mov dx,40h - mov al,0ffh - out dx,al - pop edx - ret - endp + push edx + mov dx,43h + mov al,36h + out dx,al + mov dx,40h + mov al,0ffh + out dx,al + mov dx,40h + mov al,0ffh + out dx,al + pop edx + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC DrawBackDrop - push ebp - push esi - push edi - push ebx - push ecx - push edx - mov ax,[_PlayerAngle] - sub ax,INT_ANGLE_32 - jnc ang_okay - add ax,INT_ANGLE_360 + push ebp + push esi + push edi + push ebx + push ecx + push edx + mov ax,[_PlayerAngle] + sub ax,INT_ANGLE_32 + jnc ang_okay + add ax,INT_ANGLE_360 ang_okay: - mov cx,640 - cwd - idiv cx ; Do mod 640 to get starting posn + mov cx,640 + cwd + idiv cx ; Do mod 640 to get starting posn -; movsx ebx,dx - movzx ebx,dx - shl ebx,2 ; x 4 for memory pointers - mov edx,320 - mov ebp,[_gScrnBuffer] ; get screen buffer +; movsx ebx,dx + movzx ebx,dx + shl ebx,2 ; x 4 for memory pointers + mov edx,320 + mov ebp,[_gScrnBuffer] ; get screen buffer dbd010: - mov edi,ebp - mov esi,[dword ptr _BackArray+ebx] ;current image pointer - mov ecx,[_BackDropRows] ; rows to draw + mov edi,ebp + mov esi,[dword ptr _BackArray+ebx] ;current image pointer + mov ecx,[_BackDropRows] ; rows to draw dbd020: -; mov al,[esi] -; mov [edi],al -; inc esi -; lea edi,[edi+320] - movsb - lea edi,[edi+319] - dec ecx - jnz dbd020 +; mov al,[esi] +; mov [edi],al +; inc esi +; lea edi,[edi+320] + movsb + lea edi,[edi+319] + dec ecx + jnz dbd020 - inc ebp ;next screen column - lea ebx,[ebx+4] - cmp ebx,2560 ;see if 640x4 column yet - jb short dbd030 ;nope - mov ebx,0 ;else wrap to 0 column + inc ebp ;next screen column + lea ebx,[ebx+4] + cmp ebx,2560 ;see if 640x4 column yet + jb short dbd030 ;nope + mov ebx,0 ;else wrap to 0 column dbd030: - dec edx ;see if done with all columns - jnz dbd010 + dec edx ;see if done with all columns + jnz dbd010 - pop edx - pop ecx - pop ebx - pop edi - pop esi - pop ebp - ret - endp + pop edx + pop ecx + pop ebx + pop edi + pop esi + pop ebp + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC ShowColNS - push ebp + push ebp push esi push edi - mov edi,[_scVid] - mov ebx,[_scWall] - mov ebp,[_bmDistance] - mov cx,[_gCenterRow] - mov edx,1FFFh - xor eax,eax + mov edi,[_scVid] + mov ebx,[_scWall] + mov ebp,[_bmDistance] + mov cx,[_gCenterRow] + mov edx,1FFFh + xor eax,eax sns_top: - mov al,dh - sub edx,ebp - mov al,[ebx+eax] - mov [edi],al - jc short sns_bot - sub edi,320 - dec cx - jns sns_top - xor ecx,ecx + mov al,dh + sub edx,ebp + mov al,[ebx+eax] + mov [edi],al + jc short sns_bot + sub edi,320 + dec cx + jns sns_top + xor ecx,ecx sns_bot: - mov [SAVEVID],edi - mov [SAVEROW],ecx + mov [SAVEVID],edi + mov [SAVEROW],ecx - mov edi,[_scVid] - mov cx,[_gCenterRow] - mov edx,2000h + mov edi,[_scVid] + mov cx,[_gCenterRow] + mov edx,2000h sns_botloop: - mov al,dh - add edi,320 - mov al,[ebx+eax] - add edx,ebp - mov [edi],al - cmp dh,64 - jae short sns_exit - dec cx - jnz sns_botloop + mov al,dh + add edi,320 + mov al,[ebx+eax] + add edx,ebp + mov [edi],al + cmp dh,64 + jae short sns_exit + dec cx + jnz sns_botloop sns_exit: - cmp [word ptr _scmulti],0 - jz sns_alldone - mov esi,[SAVEROW] - or si,si - jz sns_alldone + cmp [word ptr _scmulti],0 + jz sns_alldone + mov esi,[SAVEROW] + or si,si + jz sns_alldone - mov ebx,[_scMulData] ;ptr to count and wall data - mov cl,[ebx] ;get number of walls to draw - inc ebx - mov al,[ebx] ;first wall to show - inc ebx - mov [_scMulData],ebx - movzx ebx,al ;get wall number - mov eax,[_WallbMaps] ;Get array of bitmaps - mov ebx,[eax+ebx*4] ;Get the bitmap we are using - mov eax,[_scColumn] - add ebx,eax - mov edi,[SAVEVID] - mov edx,3FFFh - mov ebp,[_bmDistance] - mov eax,0 + mov ebx,[_scMulData] ;ptr to count and wall data + mov cl,[ebx] ;get number of walls to draw + inc ebx + mov al,[ebx] ;first wall to show + inc ebx + mov [_scMulData],ebx + movzx ebx,al ;get wall number + mov eax,[_WallbMaps] ;Get array of bitmaps + mov ebx,[eax+ebx*4] ;Get the bitmap we are using + mov eax,[_scColumn] + add ebx,eax + mov edi,[SAVEVID] + mov edx,3FFFh + mov ebp,[_bmDistance] + mov eax,0 sns_mulloop: - mov al,dh - sub edi,320 - mov al,[ebx+eax] - dec si - mov [edi],al - jz short sns_alldone - sub edx,ebp - jnc sns_mulloop + mov al,dh + sub edi,320 + mov al,[ebx+eax] + dec si + mov [edi],al + jz short sns_alldone + sub edx,ebp + jnc sns_mulloop sns_nextlevel: - dec cl ;Bump wall count - jz short sns_alldone ;br if no more walls - mov ebx,[_scMulData] ;Get pointer to the multi-ht data - movzx edx,[byte ptr ebx] ;next wall number - inc ebx ;Advance for next wall - mov [_scMulData],ebx - mov ebx,[_WallbMaps] ;Get wall array - mov ebx,[ebx+edx*4] ;Get wall bitmap to use - add ebx,[dword ptr _scColumn] ;add in current column - mov edx,3FFFh - jmp sns_mulloop + dec cl ;Bump wall count + jz short sns_alldone ;br if no more walls + mov ebx,[_scMulData] ;Get pointer to the multi-ht data + movzx edx,[byte ptr ebx] ;next wall number + inc ebx ;Advance for next wall + mov [_scMulData],ebx + mov ebx,[_WallbMaps] ;Get wall array + mov ebx,[ebx+edx*4] ;Get wall bitmap to use + add ebx,[dword ptr _scColumn] ;add in current column + mov edx,3FFFh + jmp sns_mulloop sns_alldone: - pop edi - pop esi - pop ebp - ret - endp + pop edi + pop esi + pop ebp + ret + endp ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ACKPROC ShowColMaskNS - push ebp - push esi - push edi - mov edi,[_scVid] - mov ebx,[_scWall] - mov ebp,[_bmDistance] - mov cx,[_gCenterRow] - mov edx,1FFFh - xor eax,eax + push ebp + push esi + push edi + mov edi,[_scVid] + mov ebx,[_scWall] + mov ebp,[_bmDistance] + mov cx,[_gCenterRow] + mov edx,1FFFh + xor eax,eax smns_top: - mov al,dh - mov al,[ebx+eax] - or al,al - jz short smns_blank - mov [edi],al + mov al,dh + mov al,[ebx+eax] + or al,al + jz short smns_blank + mov [edi],al smns_blank: - sub edx,ebp - jc short smns_bot - sub edi,320 - dec cx - jnz smns_top + sub edx,ebp + jc short smns_bot + sub edi,320 + dec cx + jnz smns_top smns_bot: - mov edi,[_scVid] - mov cx,[_gCenterRow] - mov edx,2000h + mov edi,[_scVid] + mov cx,[_gCenterRow] + mov edx,2000h smns_botloop: - add edi,320 - mov al,dh - mov al,[ebx+eax] - or al,al - jz short smns_blank1 - mov [edi],al + add edi,320 + mov al,dh + mov al,[ebx+eax] + or al,al + jz short smns_blank1 + mov [edi],al smns_blank1: - add edx,ebp - cmp dh,64 - jae short smns_exit - dec cx - jnz smns_botloop + add edx,ebp + cmp dh,64 + jae short smns_exit + dec cx + jnz smns_botloop smns_exit: - pop edi - pop esi - pop ebp + pop edi + pop esi + pop ebp ret endp end - \ No newline at end of file diff --git a/ack_lib/ACKRTN5.ASM b/ack_lib/ACKRTN5.ASM index bd2ed79..a49e3c3 100644 --- a/ack_lib/ACKRTN5.ASM +++ b/ack_lib/ACKRTN5.ASM @@ -549,4 +549,3 @@ adb020: end - \ No newline at end of file diff --git a/ack_lib/ACKUTIL.C b/ack_lib/ACKUTIL.C index 96230ee..e36f528 100644 --- a/ack_lib/ACKUTIL.C +++ b/ack_lib/ACKUTIL.C @@ -14,9 +14,9 @@ #include "ackext.h" typedef struct { - int sel; - int off; - } SELOFF; + int sel; + int off; + } SELOFF; void AckGetIntVector(int VecNum,int *sel,int *off); void AckSetIntVector(int VecNum,int sel,void *VecOff); @@ -24,12 +24,12 @@ void AckKbdInt(void); void AckTimerHandler(void); void AckSetTextMode(void); - long AckMemUsed; - short AckDisplayErrors; - SELOFF OldKeybdInt; - char AckKeyboardSetup; - SELOFF OldTimerInt; - char AckTimerSetup; + long AckMemUsed; + short AckDisplayErrors; + SELOFF OldKeybdInt; + char AckKeyboardSetup; + SELOFF OldTimerInt; + char AckTimerSetup; //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± // Establish a hook into interrupt 9 for keyboard handling @@ -72,11 +72,11 @@ mBlock = malloc(mSize); if (mBlock == NULL) { if (AckDisplayErrors) - { - AckSetTextMode(); - printf("\n\nOut of memory on call to AckMalloc.\n"); - printf("Memory used: %ld bytes.\n",AckMemUsed); - } + { + AckSetTextMode(); + printf("\n\nOut of memory on call to AckMalloc.\n"); + printf("Memory used: %ld bytes.\n",AckMemUsed); + } return(mBlock); } @@ -104,12 +104,12 @@ mBlock -= 1; if ((*(UCHAR *)mBlock) != 0xF2) { if (AckDisplayErrors) - { - AckSetTextMode(); - printf("\n\nCorrupt memory block in AckFree.\n"); - printf("Mem ptr: %p",mBlock); - return; - } + { + AckSetTextMode(); + printf("\n\nCorrupt memory block in AckFree.\n"); + printf("Mem ptr: %p",mBlock); + return; + } } mBlock += 1; @@ -145,9 +145,9 @@ if (handle > 0) { read(handle,buf,768); if (!rsHandle) - _lclose(handle); + _lclose(handle); - memset(buf,0,3); // Make sure color 0 is always black + memset(buf,0,3); // Make sure color 0 is always black AckSetPalette(buf); } else @@ -164,60 +164,60 @@ return(ErrCode); //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± void AckSetupPalRanges(ACKENG *ae,ColorRange *ranges) { - short i,j,k,found; - short rangenos; - UCHAR plotcolor; + short i,j,k,found; + short rangenos; + UCHAR plotcolor; if (ae->LightFlag == SHADING_OFF) { for ( i = 0;i<16;i++) - { - for (j=0;j<256;j++) - { - ae->PalTable[j+(i*256)] = j; - } - } + { + for (j=0;j<256;j++) + { + ae->PalTable[j+(i*256)] = j; + } + } return; } for (rangenos = 0; rangenos < 64; rangenos++) { if (ranges[rangenos].start == 0) - break; + break; } for ( i = 0;i<16;i++) { for (j=0;j<256;j++) - { - found = 0; - // find the range the color is in. - for ( k = 0; k < rangenos; k++ ) - { - if (j >= ranges[k].start && j < ranges[k].start+ranges[k].length) - { - found = 1; - break; - } - } - if (found) - { + { + found = 0; + // find the range the color is in. + for ( k = 0; k < rangenos; k++ ) + { + if (j >= ranges[k].start && j < ranges[k].start+ranges[k].length) + { + found = 1; + break; + } + } + if (found) + { //============================================================================= -// add color + i; -// if color + i > color+range then plot color = 0; -// otherwise plotcolor = color+i +// add color + i; +// if color + i > color+range then plot color = 0; +// otherwise plotcolor = color+i //============================================================================= - if (j+i >= ranges[k].start+ranges[k].length) - plotcolor = 0; - else - plotcolor = j+i; - } - else - { - plotcolor = j; - } - ae->PalTable[j+(i*256)] = plotcolor; - } + if (j+i >= ranges[k].start+ranges[k].length) + plotcolor = 0; + else + plotcolor = j+i; + } + else + { + plotcolor = j; + } + ae->PalTable[j+(i*256)] = plotcolor; + } } @@ -282,8 +282,8 @@ return(0); //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± short AckFreeBitmap(UCHAR *bmType) { - short i; - UCHAR *Bmp; + short i; + UCHAR *Bmp; if (bmType != NULL) AckFree(bmType); @@ -293,4 +293,3 @@ return(0); // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKVIEW.C b/ack_lib/ACKVIEW.C index 3398df2..f0040e8 100644 --- a/ack_lib/ACKVIEW.C +++ b/ack_lib/ACKVIEW.C @@ -111,7 +111,7 @@ USHORT yRayCast(void); USHORT xRayCastMulti(void); USHORT yRayCastMulti(void); -void ShowCol(void); // Routines for drawing a slice +void ShowCol(void); // Routines for drawing a slice void ShowColMask(void); // column by column void ShowColNS(void); void ShowColMaskNS(void); @@ -162,7 +162,7 @@ gWinHalfHeight = (gWinEndY - (gWinHeight >> 1)) + 1; gCenterRow = ae->CenterRow; // Start of center row in viewport gCenterOff = ae->CenterOffset; // Offset to center of viewport gScrnBuffer = ae->ScreenBuffer; // Screen buffer access -gScrnBufferCenter = gScrnBuffer + gCenterOff; +gScrnBufferCenter = gScrnBuffer + gCenterOff; gBkgdBuffer = ae->BkgdBuffer; // Buffer for ceiling and floors gPalTable = ae->PalTable; // Palette of colors used gDoor = &ae->Door[0]; // List of moving doors @@ -176,7 +176,7 @@ if (SysFlags & SYS_SOLID_CEIL) // Soild ceiling is selcted { mode = 1; // Draw floor only (ceiling will be solid) if (SysFlags & SYS_SOLID_FLOOR) // Solid floor is selcted - mode = 2; // Draw solid floor and ceiling + mode = 2; // Draw solid floor and ceiling } if (SysFlags & SYS_SOLID_FLOOR) // Solid floor is selected @@ -191,13 +191,13 @@ if (!LightFlag) // No light shading used WallMaskRtn = ShowColMaskNS; // using light shading switch (mode) // Check floor and ceiling type { - case 0: // Draw both solid floor and ceiling + case 0: // Draw both solid floor and ceiling if (ae->SysFlags & SYS_SINGLE_BMP) FloorCeilRtn = AckDrawOneFloor; // Use the same bitmap for each else FloorCeilRtn = AckDrawFloorHz; break; - case 1: // Draw solid ceiling and texture floor + case 1: // Draw solid ceiling and texture floor FloorCeilRtn = DrawSolidCeilAndFloorNS; break; case 2: // Draw both solid floor and solid ceiling @@ -272,7 +272,7 @@ yPglobal = aeGlobal->yPlayer; // The player's y coordi yBegGlobal = yPglobal & GRID_MASK; // Upper left corner (y) of grid square yPglobalHI = ((long)yPglobal << FP_SHIFT); // Convert y coordinate to fixed point PlayerAngle = aeGlobal->PlayerAngle; // The player's angle -SysFlags = aeGlobal->SysFlags; // Ceiling and floor attributes; +SysFlags = aeGlobal->SysFlags; // Ceiling and floor attributes; BuildUpView(); // Assembly routine defined in ACKRTN3.ASM. This routine // kicks off the ray casting process. } @@ -308,7 +308,7 @@ void BuildSlice(void) UCHAR *mgPtr; SLICE *spNext; -WallDistance = 3000000; // Set to a ridiculous distance +WallDistance = 3000000; // Set to a ridiculous distance sPtr->Distance = 200; // Initialize the distance from the POV to the slice wFound = 0; // Wall not found yet sPtr->Fnc = ShowNone; // Use the stub function for now for drawing the slice @@ -320,11 +320,11 @@ if ((BitmapNumber = xRayCast()) != 0) // Something has been hit while casting // Use the y intercept to determine the column of the slice BitmapColumn = (LastY1 >> FP_SHIFT) & (BITMAP_WIDTH-1); - // Keep the orientation the same no matter which side we're on + // Keep the orientation the same no matter which side we're on if ((short)iLastX < xPglobal) BitmapColumn = (BITMAP_WIDTH-1) - BitmapColumn; - // Did we strike a door? + // Did we strike a door? if ((BitmapNumber & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT))) { index = FindDoor(xMapPosn); // Locate the position of the door @@ -848,4 +848,3 @@ return(WallCode); } // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/ACKWRAP.C b/ack_lib/ACKWRAP.C index 4a8552c..079c173 100644 --- a/ack_lib/ACKWRAP.C +++ b/ack_lib/ACKWRAP.C @@ -14,14 +14,14 @@ #include "ackext.h" typedef struct { - int sel; - int off; - } SELOFF; + int sel; + int off; + } SELOFF; -extern char AckKeyboardSetup; -extern SELOFF OldKeybdInt; -extern char AckTimerSetup; -extern SELOFF OldTimerInt; +extern char AckKeyboardSetup; +extern SELOFF OldKeybdInt; +extern char AckTimerSetup; +extern SELOFF OldTimerInt; void AckSetIntVector(int VecNum,int sel,int VecOff); @@ -76,4 +76,3 @@ return (0); } // **** End of Source **** - \ No newline at end of file diff --git a/ack_lib/IFF.H b/ack_lib/IFF.H index 8de0ab7..ac66cad 100644 --- a/ack_lib/IFF.H +++ b/ack_lib/IFF.H @@ -14,7 +14,7 @@ #define DWORD unsigned long long ByteFlipLong(long); -UCHAR *Readiff(char *); /* this returns back a bitmap with a picture in it*/ +UCHAR *Readiff(char *); /* this returns back a bitmap with a picture in it*/ typedef LONG ID; /* An ID is four printable ASCII chars like FORM or DPPV */ @@ -30,23 +30,23 @@ typedef LONG ID; /* An ID is four printable ASCII chars like FORM or DPPV */ typedef struct { - ID type; + ID type; long cksize; - ID subtype; + ID subtype; } form_chunk; typedef struct { - ID ckID; + ID ckID; LONG ckSize; } ChunkHeader; typedef struct { - ID ckID; + ID ckID; LONG ckSize; UBYTE ckData[ 1 /*REALLY: ckSize*/ ]; } Chunk; -#define ID_PBM MakeID('P','B','M',' ') +#define ID_PBM MakeID('P','B','M',' ') #define ID_ILBM MakeID('I','L','B','M') #define ID_BMHD MakeID('B','M','H','D') #define ID_CMAP MakeID('C','M','A','P') @@ -73,8 +73,8 @@ typedef struct { UWORD x, y; /* position for this image */ UBYTE nPlanes; /* # source bitplanes */ UBYTE masking; /* masking technique */ - UBYTE compression; /* compression algoithm */ - UBYTE pad1; /* UNUSED. For consistency, put 0 here.*/ + UBYTE compression; /* compression algoithm */ + UBYTE pad1; /* UNUSED. For consistency, put 0 here.*/ UWORD transparentColor; /* transparent "color number" */ UBYTE xAspect, yAspect; /* aspect ratio, a rational number x/y */ UWORD pageWidth, pageHeight; /* source "page" size in pixels */ @@ -95,4 +95,3 @@ void ByteFlipShort(short *); short iffswab(unsigned short); short swab(unsigned short); - \ No newline at end of file diff --git a/ack_lib/KIT.H b/ack_lib/KIT.H index 94dce77..81d8c31 100644 --- a/ack_lib/KIT.H +++ b/ack_lib/KIT.H @@ -4,62 +4,62 @@ // Module: KIT.H // (c) CopyRight 1994 All Rights Reserved -#define MODE_GRAPHICS 0x13 -#define MODE_TEXT 0x03 +#define MODE_GRAPHICS 0x13 +#define MODE_TEXT 0x03 -#define SCREEN_LENGTH 64000 // Bytes in one full screen -#define SCREEN_LEN_WORDS 32000 // Words in one screen -#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen -#define SCREEN_PLANES 1 // Number of planes for this mode -#define SCREEN_WIDTH 320 // Number of bytes in one row -#define SCREEN_HEIGHT 200 // Number of rows on screen +#define SCREEN_LENGTH 64000 // Bytes in one full screen +#define SCREEN_LEN_WORDS 32000 // Words in one screen +#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen +#define SCREEN_PLANES 1 // Number of planes for this mode +#define SCREEN_WIDTH 320 // Number of bytes in one row +#define SCREEN_HEIGHT 200 // Number of rows on screen -#define BUTTON_OK 0 -#define BUTTON_OKCANCEL 1 -#define BUTTON_YESNO 2 +#define BUTTON_OK 0 +#define BUTTON_OKCANCEL 1 +#define BUTTON_YESNO 2 #define BUTTON_ABORTRETRY 3 -#define BUTTON_RET_OK 0 +#define BUTTON_RET_OK 0 #define BUTTON_RET_CANCEL 1 -#define BUTTON_RET_YES 2 -#define BUTTON_RET_NO 3 +#define BUTTON_RET_YES 2 +#define BUTTON_RET_NO 3 #define BUTTON_RET_ABORT 4 #define BUTTON_RET_RETRY 5 // Used in IORTN.C for message boxes typedef struct { - short x; - short y; - short x1; - short y1; - short index; - } BUTTON; + short x; + short y; + short x1; + short y1; + short index; + } BUTTON; // Used in IORTN.C for message boxes typedef struct { - short Count; - short List[4]; - } INDEXES; + short Count; + short List[4]; + } INDEXES; // Used in IORTN.C list boxes typedef struct _lcb { struct _lcb *Back; struct _lcb *Fwd; - char Data[1]; - } LCB; + char Data[1]; + } LCB; typedef struct { - short ux; - short uy; - short ux1; - short uy1; - short dx; - short dy; - short dx1; - short dy1; - } ARROWRECT; + short ux; + short uy; + short ux1; + short uy1; + short dx; + short dy; + short dx1; + short dy1; + } ARROWRECT; //============================================================================= @@ -137,4 +137,3 @@ short ShowPickList(char **p,short SortFlag); //============================================================================= short LoadSet(char *fName); - \ No newline at end of file diff --git a/fdemo/FDEMO.C b/fdemo/FDEMO.C index a4b2c4b..b46edc3 100644 --- a/fdemo/FDEMO.C +++ b/fdemo/FDEMO.C @@ -19,134 +19,134 @@ #include "kit.h" #include "modplay.h" -#define DEMO_RESOURCE 69 -#define HAND1_RESOURCE 135 -#define HAND2_RESOURCE 136 +#define DEMO_RESOURCE 69 +#define HAND1_RESOURCE 135 +#define HAND2_RESOURCE 136 #define KEYBD 0x9 /* INTERRUPT 9 */ -#define RIGHT_ARROW_KEY 77 -#define UP_ARROW_KEY 72 -#define LEFT_ARROW_KEY 75 -#define DOWN_ARROW_KEY 80 -#define MINUS_KEY 74 -#define PLUS_KEY 78 -#define NUMBER_5_KEY 76 -#define ESCAPE_KEY 1 -#define PGUP_KEY 73 -#define PGDN_KEY 81 -#define B_KEY 48 -#define C_KEY 46 -#define F_KEY 33 -#define I_KEY 23 -#define R_KEY 19 -#define S_KEY 31 -#define W_KEY 17 -#define NUM_1_KEY 2 -#define NUM_2_KEY 3 -#define NUM_3_KEY 4 -#define NUM_4_KEY 5 -#define NUM_5_KEY 6 -#define NUM_6_KEY 7 -#define NUM_7_KEY 8 -#define NUM_8_KEY 9 -#define NUM_9_KEY 10 +#define RIGHT_ARROW_KEY 77 +#define UP_ARROW_KEY 72 +#define LEFT_ARROW_KEY 75 +#define DOWN_ARROW_KEY 80 +#define MINUS_KEY 74 +#define PLUS_KEY 78 +#define NUMBER_5_KEY 76 +#define ESCAPE_KEY 1 +#define PGUP_KEY 73 +#define PGDN_KEY 81 +#define B_KEY 48 +#define C_KEY 46 +#define F_KEY 33 +#define I_KEY 23 +#define R_KEY 19 +#define S_KEY 31 +#define W_KEY 17 +#define NUM_1_KEY 2 +#define NUM_2_KEY 3 +#define NUM_3_KEY 4 +#define NUM_4_KEY 5 +#define NUM_5_KEY 6 +#define NUM_6_KEY 7 +#define NUM_7_KEY 8 +#define NUM_8_KEY 9 +#define NUM_9_KEY 10 typedef struct { - int mdx; - int mdy; - int mButtons; + int mdx; + int mdy; + int mButtons; } MOUSE; -#define MAX_AMOUNT 64 -#define MAX_MAG_AMOUNT 64 -#define MAX_STR_AMOUNT 128 +#define MAX_AMOUNT 64 +#define MAX_MAG_AMOUNT 64 +#define MAX_STR_AMOUNT 128 #define MAX_STR_HALF_AMOUNT 64 -extern long AckMemUsed; // Running total of memory used -extern short AckDisplayErrors; // 1 = sw to text mode and display error +extern long AckMemUsed; // Running total of memory used +extern short AckDisplayErrors; // 1 = sw to text mode and display error -extern long mFactor; -extern long dFactor; +extern long mFactor; +extern long dFactor; -extern long zdTable[VIEW_WIDTH][200]; +extern long zdTable[VIEW_WIDTH][200]; -extern UCHAR colordat[]; -extern UINT *ObjGrid; -extern UINT *Grid; -extern UINT FloorMap[]; -extern short ViewHeight; -extern short CeilingHeight; -extern short Resolution; -extern long kduFactor; -extern long kdvFactor; -extern long kxFactor; -extern long kyFactor; -extern short tuFactor; -extern short tvFactor; -extern short rsHandle; -extern ULONG *rbaTable; -extern UCHAR *BackArray[]; -extern long *xNextTable; -extern long *yNextTable; -extern UINT *Grid; -extern long *CosTable; -extern long *SinTable; +extern UCHAR colordat[]; +extern UINT *ObjGrid; +extern UINT *Grid; +extern UINT FloorMap[]; +extern short ViewHeight; +extern short CeilingHeight; +extern short Resolution; +extern long kduFactor; +extern long kdvFactor; +extern long kxFactor; +extern long kyFactor; +extern short tuFactor; +extern short tvFactor; +extern short rsHandle; +extern ULONG *rbaTable; +extern UCHAR *BackArray[]; +extern long *xNextTable; +extern long *yNextTable; +extern UINT *Grid; +extern long *CosTable; +extern long *SinTable; - ACKENG *ae; + ACKENG *ae; // These are the ranges used for distance shading. Will need to be modified // for the new color palette used. #if 0 ColorRange ranges[64] = { - 16,16, - 32,16, - 48,16, - 64,16, - 80,16, - 96,8, - 104,8, - 112,8, - 120,8, - 128,8, - 136,8, - 144,8, - 152,8, - 160,8, - 168,8, - 176,8, - 184,8, - 192,16, - 208,16, - 224,8, - 232,8, - 0,0 - }; + 16,16, + 32,16, + 48,16, + 64,16, + 80,16, + 96,8, + 104,8, + 112,8, + 120,8, + 128,8, + 136,8, + 144,8, + 152,8, + 160,8, + 168,8, + 176,8, + 184,8, + 192,16, + 208,16, + 224,8, + 232,8, + 0,0 + }; #endif ColorRange ranges[64] = { - 16,15, - 32,16, - 48,16, - 64,16, - 80,16, - 96,8, - 104,8, - 112,8, - 120,8, - 128,8, - 136,8, - 144,8, - 152,8, - 160,8, - 168,8, - 176,8, - 184,16, - 200,16, - 216,16, - 232,16, - 248,16, - 0,0 - }; + 16,15, + 32,16, + 48,16, + 64,16, + 80,16, + 96,8, + 104,8, + 112,8, + 120,8, + 128,8, + 136,8, + 144,8, + 152,8, + 160,8, + 168,8, + 176,8, + 184,16, + 200,16, + 216,16, + 232,16, + 248,16, + 0,0 + }; @@ -154,7 +154,7 @@ ColorRange ranges[64] = { UCHAR KeyPressed; UCHAR MiniKey; UCHAR Keys[128]; - int HaveMouse; + int HaveMouse; short FlashIndex; short FlashCount; UCHAR *bmFlash[2]; @@ -164,16 +164,16 @@ ColorRange ranges[64] = { UCHAR FontTransparent; UCHAR FontColor; UCHAR TextBGcolor; - int Throwing; - int Shooting; - int ShutDownFlag; + int Throwing; + int Shooting; + int ShutDownFlag; short MagAmount; short StrAmount; - int ShowHitFlag; - int MapResource; - int PalResource; - int ResScreenBack; - int ResScrollBack; + int ShowHitFlag; + int MapResource; + int PalResource; + int ResScreenBack; + int ResScrollBack; void *BGmusic; UCHAR *DemoPtr; @@ -204,28 +204,28 @@ volatile short cframes=0, count=0, ticks=0; volatile short AckTmCount=0, AckTmDelay=0; char *ErrorMsgs[] = { - "ERR_BADFILE ", - "ERR_BADCOMMAND ", - "ERR_BADOBJNUMBER ", - "ERR_BADSYNTAX ", - "ERR_LOADINGBITMAP", - "ERR_BADDIRECTION ", - "ERR_BADSTARTX ", - "ERR_BADSTARTY ", - "ERR_BADANGLE ", - "ERR_BADMAPFILE ", - "ERR_READINGMAP ", - "ERR_BADPICNAME ", - "ERR_INVALIDFORM ", - "ERR_NOPBM ", - "ERR_BADPICFILE ", - "ERR_NOMEMORY ", - "ERR_BADPALFILE ", - "ERR_BADWINDOWSIZE", - "ERR_TOMANYVIEWS ", - "ERR_BADOBJECTNUM ", - "ERR_BADOBJTYPE " - }; + "ERR_BADFILE ", + "ERR_BADCOMMAND ", + "ERR_BADOBJNUMBER ", + "ERR_BADSYNTAX ", + "ERR_LOADINGBITMAP", + "ERR_BADDIRECTION ", + "ERR_BADSTARTX ", + "ERR_BADSTARTY ", + "ERR_BADANGLE ", + "ERR_BADMAPFILE ", + "ERR_READINGMAP ", + "ERR_BADPICNAME ", + "ERR_INVALIDFORM ", + "ERR_NOPBM ", + "ERR_BADPICFILE ", + "ERR_NOMEMORY ", + "ERR_BADPALFILE ", + "ERR_BADWINDOWSIZE", + "ERR_TOMANYVIEWS ", + "ERR_BADOBJECTNUM ", + "ERR_BADOBJTYPE " + }; void AckRegisterStructure(ACKENG *ae); @@ -298,15 +298,15 @@ void *MODLoadModule(char *Path) unsigned modsize; void *modfile = NULL; if ((handle = open(Path,O_RDONLY | O_BINARY)) != -1) { - modsize = lseek(handle,0L,SEEK_END); - lseek(handle,0L,SEEK_SET); - if ((modfile=(void*)AckMalloc(modsize)) != NULL) { - if (read(handle,modfile,modsize) != modsize) { - AckFree(modfile); + modsize = lseek(handle,0L,SEEK_END); + lseek(handle,0L,SEEK_SET); + if ((modfile=(void*)AckMalloc(modsize)) != NULL) { + if (read(handle,modfile,modsize) != modsize) { + AckFree(modfile); modfile = NULL; } - } - close(handle); + } + close(handle); } return modfile; } @@ -354,7 +354,7 @@ MODFreeModule(BGmusic); short LoadSmallFont(void) { short ht,wt; - int len; + int len; ht = 2; smFont = AckReadiff((UCHAR *)ht); @@ -374,9 +374,9 @@ return(0); //============================================================================= void smWriteChar(short x,short y,unsigned char ch) { - int FontOffset,VidOffset; - int row,col; - UCHAR *Video; + int FontOffset,VidOffset; + int row,col; + UCHAR *Video; VidOffset = (y * 320) + x; Video = (UCHAR *)0xA0000; @@ -389,21 +389,21 @@ if (FontTransparent) for (row = 0; row < 5; row++) { if (!FontTransparent) - { - Video[0] = TextBGcolor; - Video[1] = TextBGcolor; - Video[2] = TextBGcolor; - Video[3] = TextBGcolor; - } + { + Video[0] = TextBGcolor; + Video[1] = TextBGcolor; + Video[2] = TextBGcolor; + Video[3] = TextBGcolor; + } if (smFont[FontOffset]) - Video[0] = FontColor; + Video[0] = FontColor; if (smFont[FontOffset+1]) - Video[1] = FontColor; + Video[1] = FontColor; if (smFont[FontOffset+2]) - Video[2] = FontColor; + Video[2] = FontColor; if (smFont[FontOffset+3]) - Video[3] = FontColor; + Video[3] = FontColor; Video += 320; FontOffset += 294; @@ -427,14 +427,14 @@ while (*s) ch = *s++; if (ch == 10) - { - x = OrgX; - y += 8; - continue; - } + { + x = OrgX; + y += 8; + continue; + } if (ch < ' ') - continue; + continue; ch = toupper(ch); smWriteChar(x,y,ch); @@ -461,7 +461,7 @@ FontColor = 15; //============================================================================= void CheckMouse(MOUSE *m) { - int dx,dy; + int dx,dy; short x,y,buttons; @@ -484,21 +484,21 @@ m->mdy = dy; //============================================================================= int ReadLine(void) { - int len; + int len; char ch; len = 0; while (len < 200) { if (read(rsHandle,&LineBuffer[len],1) != 1) - break; + break; ch = LineBuffer[len]; if (ch == 10) - continue; + continue; if (ch == 13) - break; + break; len++; } @@ -519,16 +519,16 @@ while (*s) { ch = *s++; if (ch == ',') - { - while (*s) - { - ch = *s; - if (ch != ',' && ch != ' ' && ch != '\t') - return(s); - s++; - } - return(NULL); - } + { + while (*s) + { + ch = *s; + if (ch != ',' && ch != ' ' && ch != '\t') + return(s); + s++; + } + return(NULL); + } } @@ -540,20 +540,20 @@ return(NULL); //============================================================================= int LoadWall(void) { - int wnum,rnum,result; + int wnum,rnum,result; long pos; char *lb; -lb = LineBuffer; // Info file buffer -wnum = atoi(lb); // Wall number to load into +lb = LineBuffer; // Info file buffer +wnum = atoi(lb); // Wall number to load into lb = GetNextParm(lb); if (lb == NULL) return(-1); -rnum = atoi(lb); // Resource number +rnum = atoi(lb); // Resource number pos = lseek(rsHandle,0L,SEEK_CUR); result = AckLoadWall(ae,wnum,(char *)rnum); @@ -568,19 +568,19 @@ return(result); //============================================================================= int LoadObject(void) { - int onum,rnum,result; + int onum,rnum,result; long pos; char *lb; lb = LineBuffer; -onum = atoi(lb); // Object bitmap number +onum = atoi(lb); // Object bitmap number lb = GetNextParm(lb); if (lb == NULL) return(-2); -rnum = atoi(lb); // Resource number +rnum = atoi(lb); // Resource number pos = lseek(rsHandle,0L,SEEK_CUR); result = AckLoadObject(ae,onum,(char *)rnum); lseek(rsHandle,pos,SEEK_SET); @@ -608,7 +608,7 @@ return(s); //============================================================================= int CreateObject(void) { - int onum,vnum,speed; + int onum,vnum,speed; short result,oType; short NumViews,bmPerView; UINT flags; @@ -622,22 +622,22 @@ if (!strnicmp(lb,"NUMBER:",7)) lb = &lb[7]; onum = atoi(lb); if (onum < 1 || onum > MAX_OBJECTS) - return(-3); + return(-3); result = AckCreateObject(ae,onum); if (result) - return(result); + return(result); LastObjectIndex = onum; lb = GetNextParm(lb); if (lb == NULL) - return(-4); + return(-4); ae->ObjList[onum]->Speed = atoi(lb); return(0); } -onum = LastObjectIndex; // Object number +onum = LastObjectIndex; // Object number oType = 0; @@ -746,8 +746,8 @@ return(result); //============================================================================= int ProcessInfoFile(short QuietFlag) { - int result; - int mode; + int result; + int mode; long pos; char *lb; @@ -760,188 +760,188 @@ mode = result = 0; while (!result) { if (!ReadLine()) - continue; + continue; if (*LineBuffer == ';') - continue; + continue; if (!strnicmp(LineBuffer,"END:",4)) - break; + break; if (!QuietFlag) - printf("."); + printf("."); switch (mode) - { + { - case 1: // Read walls - if (!strnicmp(LineBuffer,"LOADTYPE:",9)) - { - ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM - break; - } + case 1: // Read walls + if (!strnicmp(LineBuffer,"LOADTYPE:",9)) + { + ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM + break; + } - if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) - mode = 4; - else - result = LoadWall(); - break; + if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) + mode = 4; + else + result = LoadWall(); + break; - case 2: // Object bitmaps - if (!strnicmp(LineBuffer,"LOADTYPE:",9)) // Sets for GIF or BBM - { - ae->bmLoadType = atoi(&LineBuffer[9]); - break; - } - if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) - mode = 5; - else - result = LoadObject(); - break; + case 2: // Object bitmaps + if (!strnicmp(LineBuffer,"LOADTYPE:",9)) // Sets for GIF or BBM + { + ae->bmLoadType = atoi(&LineBuffer[9]); + break; + } + if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) + mode = 5; + else + result = LoadObject(); + break; - case 3: // Create Object - if (!strnicmp(LineBuffer,"ENDDESC:",8)) - mode = 5; - else - result = CreateObject(); - break; + case 3: // Create Object + if (!strnicmp(LineBuffer,"ENDDESC:",8)) + mode = 5; + else + result = CreateObject(); + break; - case 4: // Walls topic - if (!strnicmp(LineBuffer,"BITMAPS:",8)) - mode = 1; + case 4: // Walls topic + if (!strnicmp(LineBuffer,"BITMAPS:",8)) + mode = 1; - if (!strnicmp(LineBuffer,"ENDWALLS:",9)) - mode = 0; - break; + if (!strnicmp(LineBuffer,"ENDWALLS:",9)) + mode = 0; + break; - case 5: // Objects topic - if (!strnicmp(LineBuffer,"BITMAPS:",8)) - mode = 2; + case 5: // Objects topic + if (!strnicmp(LineBuffer,"BITMAPS:",8)) + mode = 2; - if (!strnicmp(LineBuffer,"OBJDESC:",8)) - mode = 3; + if (!strnicmp(LineBuffer,"OBJDESC:",8)) + mode = 3; - if (!strnicmp(LineBuffer,"ENDOBJECTS:",11)) - mode = 0; - break; + if (!strnicmp(LineBuffer,"ENDOBJECTS:",11)) + mode = 0; + break; - default: - if (!strnicmp(LineBuffer,"WALLS:",6)) - { - mode = 4; - break; - } + default: + if (!strnicmp(LineBuffer,"WALLS:",6)) + { + mode = 4; + break; + } - if (!strnicmp(LineBuffer,"OBJECTS:",8)) - { - mode = 5; - break; - } + if (!strnicmp(LineBuffer,"OBJECTS:",8)) + { + mode = 5; + break; + } - if (!strnicmp(LineBuffer,"MAPFILE:",8)) - { - MapResource = atoi(&LineBuffer[8]); - pos = lseek(rsHandle,0L,SEEK_CUR); - result = AckReadMapFile(ae,(char *)MapResource); - lseek(rsHandle,pos,SEEK_SET); - break; - } + if (!strnicmp(LineBuffer,"MAPFILE:",8)) + { + MapResource = atoi(&LineBuffer[8]); + pos = lseek(rsHandle,0L,SEEK_CUR); + result = AckReadMapFile(ae,(char *)MapResource); + lseek(rsHandle,pos,SEEK_SET); + break; + } - if (!strnicmp(LineBuffer,"PALFILE:",8)) - { - PalResource = atoi(&LineBuffer[8]); - break; - } + if (!strnicmp(LineBuffer,"PALFILE:",8)) + { + PalResource = atoi(&LineBuffer[8]); + break; + } - if (!strnicmp(LineBuffer,"XPLAYER:",8)) - { - ae->xPlayer = atoi(&LineBuffer[8]); - break; - } + if (!strnicmp(LineBuffer,"XPLAYER:",8)) + { + ae->xPlayer = atoi(&LineBuffer[8]); + break; + } - if (!strnicmp(LineBuffer,"YPLAYER:",8)) - { - ae->yPlayer = atoi(&LineBuffer[8]); - break; - } + if (!strnicmp(LineBuffer,"YPLAYER:",8)) + { + ae->yPlayer = atoi(&LineBuffer[8]); + break; + } - if (!strnicmp(LineBuffer,"PLAYERANGLE:",12)) - { - ae->PlayerAngle = atoi(&LineBuffer[12]); - break; - } + if (!strnicmp(LineBuffer,"PLAYERANGLE:",12)) + { + ae->PlayerAngle = atoi(&LineBuffer[12]); + break; + } - if (!strnicmp(LineBuffer,"SCREENBACK:",11)) - { - ResScreenBack = atoi(&LineBuffer[11]); - break; - } + if (!strnicmp(LineBuffer,"SCREENBACK:",11)) + { + ResScreenBack = atoi(&LineBuffer[11]); + break; + } - if (!strnicmp(LineBuffer,"SCROLLBACK:",11)) - { - ResScrollBack = atoi(&LineBuffer[11]); - break; - } + if (!strnicmp(LineBuffer,"SCROLLBACK:",11)) + { + ResScrollBack = atoi(&LineBuffer[11]); + break; + } - if (!strnicmp(LineBuffer,"TOPCOLOR:",9)) - { - ae->TopColor = atoi(&LineBuffer[9]); - break; - } + if (!strnicmp(LineBuffer,"TOPCOLOR:",9)) + { + ae->TopColor = atoi(&LineBuffer[9]); + break; + } - if (!strnicmp(LineBuffer,"BOTTOMCOLOR:",12)) - { - ae->BottomColor = atoi(&LineBuffer[12]); - break; - } + if (!strnicmp(LineBuffer,"BOTTOMCOLOR:",12)) + { + ae->BottomColor = atoi(&LineBuffer[12]); + break; + } - if (!strnicmp(LineBuffer,"SHADING:",8)) - { - strupr(LineBuffer); - if (strstr(&LineBuffer[8],"OFF") != NULL) - ae->LightFlag = SHADING_OFF; - else - ae->LightFlag = SHADING_ON; - break; - } + if (!strnicmp(LineBuffer,"SHADING:",8)) + { + strupr(LineBuffer); + if (strstr(&LineBuffer[8],"OFF") != NULL) + ae->LightFlag = SHADING_OFF; + else + ae->LightFlag = SHADING_ON; + break; + } - if (!strnicmp(LineBuffer,"FLOORS:",7)) - { - strupr(LineBuffer); - if (strstr(&LineBuffer[7],"OFF") != NULL) - ae->SysFlags |= SYS_SOLID_FLOOR; - else - { - ae->SysFlags &= ~SYS_SOLID_FLOOR; - } - break; - } + if (!strnicmp(LineBuffer,"FLOORS:",7)) + { + strupr(LineBuffer); + if (strstr(&LineBuffer[7],"OFF") != NULL) + ae->SysFlags |= SYS_SOLID_FLOOR; + else + { + ae->SysFlags &= ~SYS_SOLID_FLOOR; + } + break; + } - if (!strnicmp(LineBuffer,"RESOLUTION:",11)) - { - Resolution = atoi(&LineBuffer[11]); - break; - } + if (!strnicmp(LineBuffer,"RESOLUTION:",11)) + { + Resolution = atoi(&LineBuffer[11]); + break; + } - if (!strnicmp(LineBuffer,"LOADTYPE:",9)) - { - ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM - break; - } + if (!strnicmp(LineBuffer,"LOADTYPE:",9)) + { + ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM + break; + } - break; + break; - } + } } if (!result) { - result = AckCreateObject(ae,0); // Create a dummy object for later + result = AckCreateObject(ae,0); // Create a dummy object for later if (!result) - ae->ObjList[0]->Active = 0; // Turn off checking the object + ae->ObjList[0]->Active = 0; // Turn off checking the object } if (!QuietFlag) @@ -955,7 +955,7 @@ return(result); //============================================================================= void ShowBitmap(short x,short y,UCHAR *dst,short ht,short wt,UCHAR *bm) { - int offset,col; + int offset,col; short endy; UCHAR ch; @@ -966,11 +966,11 @@ endy = ae->WinEndY + 2; while (ht-- > 0 && y++ <= endy) { for (col = 0; col < wt; col++) - { - ch = *bm++; - if (ch) - dst[col] = ch; - } + { + ch = *bm++; + if (ch) + dst[col] = ch; + } dst += 320; } @@ -1103,9 +1103,9 @@ if (i) { printf("Error reading INF file.\n"); if (i > 100 && i < 121) - printf("Last error was %s\n",ErrorMsgs[i-100]); + printf("Last error was %s\n",ErrorMsgs[i-100]); else - printf("Error code: %d\n",i); + printf("Error code: %d\n",i); printf("Line was: \"%s\"\n",LineBuffer); @@ -1156,10 +1156,10 @@ return(0); //============================================================================= int LoadBackDrop(void) { - int result; - int i,j,pos; - UCHAR *bPtr; - UCHAR *aPtr; + int result; + int i,j,pos; + UCHAR *bPtr; + UCHAR *aPtr; result = 0; @@ -1169,36 +1169,36 @@ if (ResScrollBack) bPtr = AckReadiff((char *)ResScrollBack); printf("Processing background image.\n"); if (bPtr != NULL) - { - for (i = 0; i < 320; i++) - { - pos = i + 4; - aPtr = BackArray[i]; - for (j = 0; j < 100; j++) - { - *aPtr++ = bPtr[pos]; - pos += 320; - } - } + { + for (i = 0; i < 320; i++) + { + pos = i + 4; + aPtr = BackArray[i]; + for (j = 0; j < 100; j++) + { + *aPtr++ = bPtr[pos]; + pos += 320; + } + } - for (i = 320; i < 640; i++) - { - pos = (i - 320) + 32004; - aPtr = BackArray[i]; - for (j = 0; j < 100; j++) - { - *aPtr++ = bPtr[pos]; - pos += 320; - } - } + for (i = 320; i < 640; i++) + { + pos = (i - 320) + 32004; + aPtr = BackArray[i]; + for (j = 0; j < 100; j++) + { + *aPtr++ = bPtr[pos]; + pos += 320; + } + } - AckFree(bPtr); - } + AckFree(bPtr); + } else - { - printf("Unable to load background image.\n"); - result = 8; - } + { + printf("Unable to load background image.\n"); + result = 8; + } } return(result); @@ -1209,8 +1209,8 @@ return(result); //============================================================================= void ShowHit(void) { - int x,y,result,wNum; - int flag; + int x,y,result,wNum; + int flag; short oNum,mPos; ae->ObjList[0]->x = ae->xPlayer; @@ -1225,31 +1225,31 @@ while (wNum--) result = AckMoveObjectPOV(0,ae->PlayerAngle,12); if (result == POV_OBJECT) - { - flag = 1; - oNum = AckGetObjectHit(); - break; - } + { + flag = 1; + oNum = AckGetObjectHit(); + break; + } if (result == POV_XWALL) - { - flag = 2; - oNum = ae->xGrid[AckGetWallHit()]; - if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) - flag = 4; - oNum &= 0xFF; - break; - } + { + flag = 2; + oNum = ae->xGrid[AckGetWallHit()]; + if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) + flag = 4; + oNum &= 0xFF; + break; + } if (result == POV_YWALL) - { - flag = 3; - oNum = ae->yGrid[AckGetWallHit()]; - if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) - flag = 4; - oNum &= 0xFF; - break; - } + { + flag = 3; + oNum = ae->yGrid[AckGetWallHit()]; + if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) + flag = 4; + oNum &= 0xFF; + break; + } } @@ -1258,28 +1258,28 @@ if (flag) mPos = (ae->ObjList[0]->y & 0xFFC0) + (ae->ObjList[0]->x >> 6); switch (flag) - { + { - case 1: - sprintf(LineBuffer,"Object %d hit\nat location %d",oNum,mPos); - break; + case 1: + sprintf(LineBuffer,"Object %d hit\nat location %d",oNum,mPos); + break; - case 2: - sprintf(LineBuffer,"Xwall %d hit\nat location %d",oNum,mPos); - break; + case 2: + sprintf(LineBuffer,"Xwall %d hit\nat location %d",oNum,mPos); + break; - case 3: - sprintf(LineBuffer,"Ywall %d hit\nat location %d",oNum,mPos); - break; + case 3: + sprintf(LineBuffer,"Ywall %d hit\nat location %d",oNum,mPos); + break; - case 4: - sprintf(LineBuffer,"Door %d hit\nat location %d",oNum,mPos); - break; + case 4: + sprintf(LineBuffer,"Door %d hit\nat location %d",oNum,mPos); + break; - default: - *LineBuffer = '\0'; - break; - } + default: + *LineBuffer = '\0'; + break; + } ShowHitFlag = 1; } @@ -1306,25 +1306,25 @@ j = AckMoveObjectPOV(99,ae->ObjList[99]->Dir,ae->ObjList[99]->Speed); if (j > 0 && j != POV_PLAYER) { if (j != POV_OBJECT) - { - ae->ObjList[99]->Active = 0; - Shooting = 0; - return; - } + { + ae->ObjList[99]->Active = 0; + Shooting = 0; + return; + } j = AckGetObjectHit(); if (j > 4 && j < 13) - { - if (ae->ObjList[j]->CurrentType == NO_WALK) - { - AckSetObjectType(ae,j,NO_INTERACT); - ObjCounter[j] = TimerCounter + 18 + (rand() % 120); - } - } + { + if (ae->ObjList[j]->CurrentType == NO_WALK) + { + AckSetObjectType(ae,j,NO_INTERACT); + ObjCounter[j] = TimerCounter + 18 + (rand() % 120); + } + } if (j == 51) - ae->ObjList[j]->Active = 0; + ae->ObjList[j]->Active = 0; ae->ObjList[99]->Active = 0; Shooting = 0; @@ -1337,9 +1337,9 @@ if (j > 0 && j != POV_PLAYER) //============================================================================= void CheckMonsters(void) { - int i,tFlag,xp,yp; - int pMap,oMap,oRow,oCol; - int row,col,offset; + int i,tFlag,xp,yp; + int pMap,oMap,oRow,oCol; + int row,col,offset; long dx,dy,dx2,dy2,dist; short cType; UCHAR oFlags; @@ -1354,75 +1354,75 @@ i = 5; while (1) { if (ae->ObjList[i]->Active) - { - oFlags = ae->ObjList[i]->Flags; - cType = ae->ObjList[i]->CurrentType; - dx = xp - ae->ObjList[i]->x; - dy = yp - ae->ObjList[i]->y; + { + oFlags = ae->ObjList[i]->Flags; + cType = ae->ObjList[i]->CurrentType; + dx = xp - ae->ObjList[i]->x; + dy = yp - ae->ObjList[i]->y; - dx2 = dx * dx; - dy2 = dy * dy; - if ((dx2+dy2) < 128000) - { - ae->ObjList[i]->Dir = AckGetObjectAngle(dx,dy); - if (cType == NO_WALK) - { - ae->ObjList[i]->Flags |= OF_ANIMATE; - oFlags |= OF_ANIMATE; - } + dx2 = dx * dx; + dy2 = dy * dy; + if ((dx2+dy2) < 128000) + { + ae->ObjList[i]->Dir = AckGetObjectAngle(dx,dy); + if (cType == NO_WALK) + { + ae->ObjList[i]->Flags |= OF_ANIMATE; + oFlags |= OF_ANIMATE; + } - if (cType == NO_CREATE && !(oFlags & OF_ANIMATE)) - { - if (i < 50) - { - ae->ObjList[i]->Flags |= OF_ANIMATE; - oFlags |= OF_ANIMATE; - } - else - AckSetObjectType(ae,i,NO_WALK); - } + if (cType == NO_CREATE && !(oFlags & OF_ANIMATE)) + { + if (i < 50) + { + ae->ObjList[i]->Flags |= OF_ANIMATE; + oFlags |= OF_ANIMATE; + } + else + AckSetObjectType(ae,i,NO_WALK); + } - } + } - if (cType == NO_WALK && (oFlags & OF_ANIMATE)) - { - tFlag = AckMoveObjectPOV(i,ae->ObjList[i]->Dir,8); - oRow = ae->ObjList[i]->Dir / INT_ANGLE_90; - switch (tFlag) - { - case POV_PLAYER: - StrAmount--; - if (StrAmount < 0) StrAmount = 0; - ShowStatus(); - break; + if (cType == NO_WALK && (oFlags & OF_ANIMATE)) + { + tFlag = AckMoveObjectPOV(i,ae->ObjList[i]->Dir,8); + oRow = ae->ObjList[i]->Dir / INT_ANGLE_90; + switch (tFlag) + { + case POV_PLAYER: + StrAmount--; + if (StrAmount < 0) StrAmount = 0; + ShowStatus(); + break; - case POV_NOTHING: - break; + case POV_NOTHING: + break; - case POV_SLIDEX: - if (oRow > 1) ae->ObjList[i]->Dir = INT_ANGLE_270; - else ae->ObjList[i]->Dir = INT_ANGLE_90; - break; + case POV_SLIDEX: + if (oRow > 1) ae->ObjList[i]->Dir = INT_ANGLE_270; + else ae->ObjList[i]->Dir = INT_ANGLE_90; + break; - case POV_SLIDEY: - if (oRow > 0 && oRow < 3) - ae->ObjList[i]->Dir = INT_ANGLE_180; - else - ae->ObjList[i]->Dir = 0; - break; + case POV_SLIDEY: + if (oRow > 0 && oRow < 3) + ae->ObjList[i]->Dir = INT_ANGLE_180; + else + ae->ObjList[i]->Dir = 0; + break; - case POV_OBJECT: - ae->ObjList[i]->Dir = rand() % INT_ANGLE_360; - break; + case POV_OBJECT: + ae->ObjList[i]->Dir = rand() % INT_ANGLE_360; + break; - default: - if (i < 50) - ae->ObjList[i]->Flags &= ~OF_ANIMATE; - break; + default: + if (i < 50) + ae->ObjList[i]->Flags &= ~OF_ANIMATE; + break; - } - } - } + } + } + } i++; if (i == 13) i = 51; @@ -1437,7 +1437,7 @@ while (1) void ShowStatus(void) { UCHAR *Video; - int row,offset,rlen,glen; + int row,offset,rlen,glen; offset = (163 * 320) + 34; @@ -1450,9 +1450,9 @@ Video += offset; for (row = 0; row < 11; row++) { if (glen) - memset(Video,105,glen); + memset(Video,105,glen); if (rlen) - memset(&Video[glen],39,rlen); + memset(&Video[glen],39,rlen); Video += 320; } @@ -1467,9 +1467,9 @@ Video += offset; for (row = 0; row < 11; row++) { if (glen) - memset(Video,105,glen); + memset(Video,105,glen); if (rlen) - memset(&Video[glen],39,rlen); + memset(&Video[glen],39,rlen); Video += 320; } @@ -1524,24 +1524,24 @@ for (xpos = 0; xpos < NumCols; xpos++) d1 = (d2>>16); while (yposLow > 0 && vPtr > VidOrg) - { - *vPtr = bmp[bmPos+yposLow]; - vPtr -= 320; - ypos -= d1; - yposLow = ypos >> 8; - } + { + *vPtr = bmp[bmPos+yposLow]; + vPtr -= 320; + ypos -= d1; + yposLow = ypos >> 8; + } vPtr = Video + 320; ypos = 0x2000; yposLow = 0x20; while (yposLow < 64 && vPtr < VidEnd) - { - *vPtr = bmp[bmPos+yposLow]; - vPtr += 320; - ypos += d1; - yposLow = ypos >> 8; - } + { + *vPtr = bmp[bmPos+yposLow]; + vPtr += 320; + ypos += d1; + yposLow = ypos >> 8; + } d2 += htStep; bmCol += bmColStep; @@ -1556,7 +1556,7 @@ for (xpos = 0; xpos < NumCols; xpos++) //============================================================================= void ClsBmpBox(int x1,int y1,int x2,int y2) { - int offset,wt; + int offset,wt; UCHAR *Video; Video = (UCHAR *)0xA0000; @@ -1573,12 +1573,12 @@ while (y1++ <= y2) } typedef struct { - int x1; - int y1; - int x2; - int y2; - int d1; - int d2; + int x1; + int y1; + int x2; + int y2; + int d1; + int d2; } AWALL; short near long_sqrt(long v); @@ -1588,8 +1588,8 @@ short near long_sqrt(long v); //============================================================================= void DoTest(void) { - int done,cnt,Total; - int xp,yp,ColX; + int done,cnt,Total; + int xp,yp,ColX; long dx,dy; UCHAR *Video; AWALL aw[2]; @@ -1621,72 +1621,72 @@ while (!done) memset(ae->ScreenBuffer,0,64000); minAngle = ae->PlayerAngle - (INT_ANGLE_32 + 10); if (minAngle < 0) - minAngle += INT_ANGLE_360; + minAngle += INT_ANGLE_360; maxAngle = ae->PlayerAngle + (INT_ANGLE_32 + 10); if (maxAngle >= INT_ANGLE_360) - maxAngle -= INT_ANGLE_360; + maxAngle -= INT_ANGLE_360; xp = ae->xPlayer; yp = ae->yPlayer; for (cnt = 0; cnt < Total; cnt++) - { - dx = aw[cnt].x1 - xp; - dy = aw[cnt].y1 - yp; - aw[cnt].d1 = long_sqrt((dx*dx)+(dy*dy)); - objAngle = AckGetObjectAngle(dx,dy); - dx = aw[cnt].x2 - xp; - dy = aw[cnt].y2 - yp; - aw[cnt].d2 = long_sqrt((dx*dx)+(dy*dy)); + { + dx = aw[cnt].x1 - xp; + dy = aw[cnt].y1 - yp; + aw[cnt].d1 = long_sqrt((dx*dx)+(dy*dy)); + objAngle = AckGetObjectAngle(dx,dy); + dx = aw[cnt].x2 - xp; + dy = aw[cnt].y2 - yp; + aw[cnt].d2 = long_sqrt((dx*dx)+(dy*dy)); - if (minAngle > maxAngle) - { - if (objAngle >= minAngle) - ColX = objAngle - minAngle; - else - ColX = (objAngle+INT_ANGLE_360) - minAngle; - } - else - { - ColX = objAngle - minAngle; - } + if (minAngle > maxAngle) + { + if (objAngle >= minAngle) + ColX = objAngle - minAngle; + else + ColX = (objAngle+INT_ANGLE_360) - minAngle; + } + else + { + ColX = objAngle - minAngle; + } - if (ColX > -40 && ColX < 320) - DrawBmpBox(ColX,100,aw[cnt].x2,100,aw[cnt].d1,aw[cnt].d2); - } + if (ColX > -40 && ColX < 320) + DrawBmpBox(ColX,100,aw[cnt].x2,100,aw[cnt].d1,aw[cnt].d2); + } memmove(Video,ae->ScreenBuffer,64000); if (Keys[ESCAPE_KEY]) - break; + break; if (Keys[LEFT_ARROW_KEY]) - { - ae->PlayerAngle--; - if (ae->PlayerAngle < 0) - ae->PlayerAngle += INT_ANGLE_360; - } + { + ae->PlayerAngle--; + if (ae->PlayerAngle < 0) + ae->PlayerAngle += INT_ANGLE_360; + } if (Keys[RIGHT_ARROW_KEY]) - { - ae->PlayerAngle++; - if (ae->PlayerAngle >= INT_ANGLE_360) - ae->PlayerAngle -= INT_ANGLE_360; - } + { + ae->PlayerAngle++; + if (ae->PlayerAngle >= INT_ANGLE_360) + ae->PlayerAngle -= INT_ANGLE_360; + } if (Keys[UP_ARROW_KEY]) - { - AckMovePOV(ae->PlayerAngle,16); - } + { + AckMovePOV(ae->PlayerAngle,16); + } if (Keys[DOWN_ARROW_KEY]) - { - i = ae->PlayerAngle + INT_ANGLE_180; - if (i >= INT_ANGLE_360) - i -= INT_ANGLE_360; + { + i = ae->PlayerAngle + INT_ANGLE_180; + if (i >= INT_ANGLE_360) + i -= INT_ANGLE_360; - AckMovePOV(i,16); - } + AckMovePOV(i,16); + } } @@ -1707,28 +1707,28 @@ if (i) for (i = 1; i < MAX_WALLBMPS; i++) { if (ae->bMaps[i] != NULL) - { - AckFree(ae->bMaps[i]); - ae->bMaps[i] = NULL; - } + { + AckFree(ae->bMaps[i]); + ae->bMaps[i] = NULL; + } } for (i = 1; i < MAX_OBJBMPS; i++) { if (ae->oMaps[i] != NULL) - { - AckFree(ae->oMaps[i]); - ae->oMaps[i] = NULL; - } + { + AckFree(ae->oMaps[i]); + ae->oMaps[i] = NULL; + } } for (i = 1; i < ae->MaxObjects; i++) { if (ae->ObjList[i] != NULL) - { - AckFree(ae->ObjList[i]); - ae->ObjList[i] = NULL; - } + { + AckFree(ae->ObjList[i]); + ae->ObjList[i] = NULL; + } } ae->MaxObjects = 0; @@ -1736,7 +1736,7 @@ ae->MaxObjects = 0; for (i = 0; i < (GRID_ARRAY - GRID_WIDTH); i++) { if (ae->myGrid[i] != NULL) - AckFree(ae->myGrid[i]); + AckFree(ae->myGrid[i]); ae->mxGrid[i] = NULL; ae->mxGrid[i+1] = NULL; @@ -1766,26 +1766,26 @@ short main(short argc,char **argv) char ch; MOUSE mouse; UCHAR *Video; - int Spin,MoveAmount; - int SpinAngle,MoveAngle; + int Spin,MoveAmount; + int SpinAngle,MoveAngle; long TimerEnd; short DemoFlag; short lpx,lpy,lpa; - int StartTime,EndTime,InfoFlag; - int CkStart,CkEnd; - int TurnFactor,MoveFactor,MoveHalfFactor; - int HandX,HandY,HandDY; + int StartTime,EndTime,InfoFlag; + int CkStart,CkEnd; + int TurnFactor,MoveFactor,MoveHalfFactor; + int HandX,HandY,HandDY; long x1,y1; i = 0; if (argc > 1) { for (j = 1; j <= argc; j++) - { - if (!strnicmp(argv[j],"-1",2)) - i |= 1; + { + if (!strnicmp(argv[j],"-1",2)) + i |= 1; - } + } } if ((done = Initialize(i)) != 0) @@ -1816,7 +1816,7 @@ _dos_setvect(KEYBD,myInt); oldTimer=_dos_getvect(8); _dos_setvect(8,myTimer); AckTmDelay = 3; -AckSpeedUp(AckTmDelay); // Set the timer interrupt at 3 times normal +AckSpeedUp(AckTmDelay); // Set the timer interrupt at 3 times normal StartBGmusic(); @@ -1859,7 +1859,7 @@ MoveFactor = 3 * EndTime; MoveHalfFactor = MoveFactor >> 1; StartTime = clock(); -EndTime = StartTime; +EndTime = StartTime; InfoFlag = 0; HandX = 134; @@ -1871,214 +1871,214 @@ while (!done) { if (SpinAngle) - { - ae->PlayerAngle += SpinAngle; - if (ae->PlayerAngle >= INT_ANGLE_360) - ae->PlayerAngle -= INT_ANGLE_360; - if (ae->PlayerAngle < 0) - ae->PlayerAngle += INT_ANGLE_360; + { + ae->PlayerAngle += SpinAngle; + if (ae->PlayerAngle >= INT_ANGLE_360) + ae->PlayerAngle -= INT_ANGLE_360; + if (ae->PlayerAngle < 0) + ae->PlayerAngle += INT_ANGLE_360; - SpinAngle >>= 3; - if (SpinAngle == -1) SpinAngle = 0; - } + SpinAngle >>= 3; + if (SpinAngle == -1) SpinAngle = 0; + } if (MoveAmount) - { - HandY += HandDY; - if (HandY < 125) HandDY = 2; - if (HandY > 132) HandDY = -2; + { + HandY += HandDY; + if (HandY < 125) HandDY = 2; + if (HandY > 132) HandDY = -2; - j = AckMovePOV(MoveAngle,MoveAmount); - AckCheckDoorOpen(ae->xPlayer,ae->yPlayer,MoveAngle); - MoveAmount >>= 1; + j = AckMovePOV(MoveAngle,MoveAmount); + AckCheckDoorOpen(ae->xPlayer,ae->yPlayer,MoveAngle); + MoveAmount >>= 1; - if (j == POV_OBJECT) - { - j = AckGetObjectHit(); + if (j == POV_OBJECT) + { + j = AckGetObjectHit(); - if (j > 4 && j < 13) - { - StrAmount--; - if (StrAmount < 0) - StrAmount = 0; + if (j > 4 && j < 13) + { + StrAmount--; + if (StrAmount < 0) + StrAmount = 0; - ShowStatus(); - } + ShowStatus(); + } - if (j >= 36 && j <= 49) - { - ae->ObjList[j]->Active = 0; - MagAmount += 4; - if (MagAmount > MAX_MAG_AMOUNT) - MagAmount = MAX_MAG_AMOUNT; - ShowStatus(); - } + if (j >= 36 && j <= 49) + { + ae->ObjList[j]->Active = 0; + MagAmount += 4; + if (MagAmount > MAX_MAG_AMOUNT) + MagAmount = MAX_MAG_AMOUNT; + ShowStatus(); + } - if (j == 50 && ae->ObjList[50]->CurrentType == NO_CREATE) - { - AckSetObjectType(ae,j,NO_WALK); - StrAmount = MAX_STR_AMOUNT; - ShowStatus(); - } + if (j == 50 && ae->ObjList[50]->CurrentType == NO_CREATE) + { + AckSetObjectType(ae,j,NO_WALK); + StrAmount = MAX_STR_AMOUNT; + ShowStatus(); + } - } - } + } + } else - { - if (HandY < 132) - HandY++; - } + { + if (HandY < 132) + HandY++; + } - AckCheckObjectMovement(); // Animate objects if needed + AckCheckObjectMovement(); // Animate objects if needed for (j = 5; j < 13; j++) - { - if (ae->ObjList[j]->Flags & OF_ANIMDONE && - ae->ObjList[j]->CurrentType == NO_DESTROY) - { - AckSetObjectType(ae,j,NO_CREATE); - ae->ObjList[j]->Flags &= ~OF_ANIMDONE; - ae->ObjList[j]->Flags &= ~OF_ANIMATE; - ae->ObjList[j]->Active = 0; - } + { + if (ae->ObjList[j]->Flags & OF_ANIMDONE && + ae->ObjList[j]->CurrentType == NO_DESTROY) + { + AckSetObjectType(ae,j,NO_CREATE); + ae->ObjList[j]->Flags &= ~OF_ANIMDONE; + ae->ObjList[j]->Flags &= ~OF_ANIMATE; + ae->ObjList[j]->Active = 0; + } - if (ae->ObjList[j]->Flags & OF_ANIMDONE && - ae->ObjList[j]->CurrentType != NO_WALK) - { - AckSetObjectType(ae,j,NO_WALK); - ae->ObjList[j]->Flags &= ~OF_ANIMDONE; - ObjCounter[j] = TimerCounter + 18 + (rand() % 120); - } + if (ae->ObjList[j]->Flags & OF_ANIMDONE && + ae->ObjList[j]->CurrentType != NO_WALK) + { + AckSetObjectType(ae,j,NO_WALK); + ae->ObjList[j]->Flags &= ~OF_ANIMDONE; + ObjCounter[j] = TimerCounter + 18 + (rand() % 120); + } - if (TimerCounter > ObjCounter[j]) - { - ObjCounter[j] = TimerCounter + 180 + (rand() % 180); - if (ae->ObjList[j]->CurrentType == NO_WALK) - AckSetObjectType(ae,j,NO_ATTACK); - else - { - if (ae->ObjList[j]->CurrentType == NO_INTERACT) - AckSetObjectType(ae,j,NO_DESTROY); + if (TimerCounter > ObjCounter[j]) + { + ObjCounter[j] = TimerCounter + 180 + (rand() % 180); + if (ae->ObjList[j]->CurrentType == NO_WALK) + AckSetObjectType(ae,j,NO_ATTACK); + else + { + if (ae->ObjList[j]->CurrentType == NO_INTERACT) + AckSetObjectType(ae,j,NO_DESTROY); - } - } - } + } + } + } if (Shooting) - UpdateBlast(); + UpdateBlast(); CheckMonsters(); CkStart = TimerCounter; - AckBuildView(); // Build floor, ceiling, and walls into ScrnBuffer + AckBuildView(); // Build floor, ceiling, and walls into ScrnBuffer if (DemoFlag) - { - switch (DemoFlag) - { - case 1: - if (TimerCounter > TimerEnd) - { - DemoFlag++; - TimerEnd = TimerCounter + 540; - } - break; + { + switch (DemoFlag) + { + case 1: + if (TimerCounter > TimerEnd) + { + DemoFlag++; + TimerEnd = TimerCounter + 540; + } + break; - case 2: - ShowBitmap(130,20,ae->ScreenBuffer,Demoht,Demowt,&DemoPtr[4]); - if (TimerCounter > TimerEnd) - { - DemoFlag = 1; - TimerEnd = TimerCounter + 2160; - } - break; + case 2: + ShowBitmap(130,20,ae->ScreenBuffer,Demoht,Demowt,&DemoPtr[4]); + if (TimerCounter > TimerEnd) + { + DemoFlag = 1; + TimerEnd = TimerCounter + 2160; + } + break; - default: - break; - } + default: + break; + } - } + } switch (Throwing) - { - case 0: - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); - break; + { + case 0: + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); + break; - case 1: - HandY -= 20; - if (HandY < 97) - { - HandY = 97; - Throwing++; - } - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); - break; + case 1: + HandY -= 20; + if (HandY < 97) + { + HandY = 97; + Throwing++; + } + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); + break; - case 2: - HandY -= 5; - Throwing++; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); - break; + case 2: + HandY -= 5; + Throwing++; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); + break; - case 3: - ae->ObjList[99]->Active = 1; - ae->ObjList[99]->x = ae->xPlayer; - ae->ObjList[99]->y = ae->yPlayer; - ae->ObjList[99]->Dir = ae->PlayerAngle; - ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; - AckSetObjectType(ae,99,NO_CREATE); - Shooting = 1; - MagAmount--; - ShowStatus(); - Throwing++; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); - break; + case 3: + ae->ObjList[99]->Active = 1; + ae->ObjList[99]->x = ae->xPlayer; + ae->ObjList[99]->y = ae->yPlayer; + ae->ObjList[99]->Dir = ae->PlayerAngle; + ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; + AckSetObjectType(ae,99,NO_CREATE); + Shooting = 1; + MagAmount--; + ShowStatus(); + Throwing++; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); + break; - case 4: - HandY += 5; - Throwing++; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); - break; + case 4: + HandY += 5; + Throwing++; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); + break; - case 5: - HandY += 20; - if (HandY > 132) - Throwing = 0; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); - break; + case 5: + HandY += 20; + if (HandY > 132) + Throwing = 0; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); + break; - default: - break; - } + default: + break; + } if (InfoFlag) - { - EndTime = clock(); - if (EndTime > StartTime+100 ) - { - StartTime = EndTime; - cframes = framespersec; - framespersec = 0; - } + { + EndTime = clock(); + if (EndTime > StartTime+100 ) + { + StartTime = EndTime; + cframes = framespersec; + framespersec = 0; + } - sprintf(LineBuffer,"FPS: %6ld,%d,%d,%d", - (long)cframes,ae->xPlayer,ae->yPlayer,ae->PlayerAngle); - smWriteHUD(10,20,32,LineBuffer); - framespersec++; - } + sprintf(LineBuffer,"FPS: %6ld,%d,%d,%d", + (long)cframes,ae->xPlayer,ae->yPlayer,ae->PlayerAngle); + smWriteHUD(10,20,32,LineBuffer); + framespersec++; + } // sprintf(LineBuffer,"MEM: %ld",AckMemUsed); // smWriteHUD(22,30,32,LineBuffer); if (ShowHitFlag) - smWriteHUD(10,10,32,LineBuffer); + smWriteHUD(10,10,32,LineBuffer); - AckDisplayScreen(); // Copy ScrnBuffer to actual video + AckDisplayScreen(); // Copy ScrnBuffer to actual video CkEnd = TimerCounter - CkStart; if (!CkEnd) CkEnd = 1; @@ -2088,216 +2088,216 @@ while (!done) i = (ae->yPlayer & 0xFFC0) + (ae->xPlayer >> 6); if (FloorMap[i] == 0x28) - { - StrAmount--; - if (StrAmount < 1) - break; - ShowStatus(); - } + { + StrAmount--; + if (StrAmount < 1) + break; + ShowStatus(); + } CheckMouse(&mouse); if (mouse.mButtons & 1) - { - if (!(ae->ObjList[99]->Active) && MagAmount > 0 && !Throwing) - { - Throwing = 1; - #if 0 - ae->ObjList[99]->Active = 1; - ae->ObjList[99]->x = ae->xPlayer; - ae->ObjList[99]->y = ae->yPlayer; - ae->ObjList[99]->Dir = ae->PlayerAngle; - ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; - AckSetObjectType(ae,99,NO_CREATE); - Shooting = 1; - MagAmount--; - ShowStatus(); - #endif - } - } + { + if (!(ae->ObjList[99]->Active) && MagAmount > 0 && !Throwing) + { + Throwing = 1; + #if 0 + ae->ObjList[99]->Active = 1; + ae->ObjList[99]->x = ae->xPlayer; + ae->ObjList[99]->y = ae->yPlayer; + ae->ObjList[99]->Dir = ae->PlayerAngle; + ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; + AckSetObjectType(ae,99,NO_CREATE); + Shooting = 1; + MagAmount--; + ShowStatus(); + #endif + } + } if (mouse.mButtons & 2) - { - MoveAmount += MoveFactor; // 16; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = ae->PlayerAngle; - } + { + MoveAmount += MoveFactor; // 16; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = ae->PlayerAngle; + } if (mouse.mdx < 0) - { - Spin = -mouse.mdx; - Spin >>= 5; - SpinAngle = -TurnFactor * Spin; // -INT_ANGLE_1 * Spin; - Spin = 1; - } + { + Spin = -mouse.mdx; + Spin >>= 5; + SpinAngle = -TurnFactor * Spin; // -INT_ANGLE_1 * Spin; + Spin = 1; + } if (mouse.mdx > 0) - { - Spin = mouse.mdx; - Spin >>= 5; - SpinAngle = TurnFactor * Spin; // INT_ANGLE_1 * Spin; - Spin = 1; - } + { + Spin = mouse.mdx; + Spin >>= 5; + SpinAngle = TurnFactor * Spin; // INT_ANGLE_1 * Spin; + Spin = 1; + } if (mouse.mdy < 0) - { - i = -mouse.mdy; - i >>= 2; - i += MoveHalfFactor; - MoveAmount += i; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = ae->PlayerAngle; - } + { + i = -mouse.mdy; + i >>= 2; + i += MoveHalfFactor; + MoveAmount += i; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = ae->PlayerAngle; + } if (mouse.mdy > 20) - { - i = mouse.mdy; - i >>= 3; - i += MoveHalfFactor; - j = ae->PlayerAngle + INT_ANGLE_180; - if (j >= INT_ANGLE_360) - j -= INT_ANGLE_360; + { + i = mouse.mdy; + i >>= 3; + i += MoveHalfFactor; + j = ae->PlayerAngle + INT_ANGLE_180; + if (j >= INT_ANGLE_360) + j -= INT_ANGLE_360; - MoveAmount += i; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = j; - } + MoveAmount += i; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = j; + } if (Keys[ESCAPE_KEY]) - break; + break; if(Keys[RIGHT_ARROW_KEY]) - { - Spin += 1; - SpinAngle += TurnFactor; // INT_ANGLE_1 * Spin; - } + { + Spin += 1; + SpinAngle += TurnFactor; // INT_ANGLE_1 * Spin; + } if(Keys[LEFT_ARROW_KEY]) - { - Spin += 1; - SpinAngle -= TurnFactor; // -INT_ANGLE_1 * Spin; - } + { + Spin += 1; + SpinAngle -= TurnFactor; // -INT_ANGLE_1 * Spin; + } if(Keys[UP_ARROW_KEY]) - { - MoveAmount += (MoveFactor + MoveHalfFactor); // 12; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = ae->PlayerAngle; - } + { + MoveAmount += (MoveFactor + MoveHalfFactor); // 12; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = ae->PlayerAngle; + } if(Keys[DOWN_ARROW_KEY]) - { - j = ae->PlayerAngle + INT_ANGLE_180; - if (j >= INT_ANGLE_360) - j -= INT_ANGLE_360; + { + j = ae->PlayerAngle + INT_ANGLE_180; + if (j >= INT_ANGLE_360) + j -= INT_ANGLE_360; - MoveAmount += (MoveFactor + MoveHalfFactor); // 12; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = j; - } + MoveAmount += (MoveFactor + MoveHalfFactor); // 12; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = j; + } if (Keys[C_KEY]) - { - ae->SysFlags ^= SYS_SOLID_CEIL; - ae->SysFlags &= ~SYS_SOLID_BACK; - Keys[C_KEY] = 0; + { + ae->SysFlags ^= SYS_SOLID_CEIL; + ae->SysFlags &= ~SYS_SOLID_BACK; + Keys[C_KEY] = 0; - if ((ae->SysFlags & SYS_SOLID_CEIL) && (ResScrollBack != 0)) - ae->SysFlags |= SYS_SOLID_BACK; - AckRegisterStructure(ae); - } + if ((ae->SysFlags & SYS_SOLID_CEIL) && (ResScrollBack != 0)) + ae->SysFlags |= SYS_SOLID_BACK; + AckRegisterStructure(ae); + } if (Keys[R_KEY]) - { - Keys[R_KEY] = 0; - Resolution++; - if (Resolution > 2) - Resolution = 0; - } + { + Keys[R_KEY] = 0; + Resolution++; + if (Resolution > 2) + Resolution = 0; + } if (Keys[F_KEY]) - { - ae->SysFlags ^= SYS_SOLID_FLOOR; - Keys[F_KEY] = 0; - AckRegisterStructure(ae); - } + { + ae->SysFlags ^= SYS_SOLID_FLOOR; + Keys[F_KEY] = 0; + AckRegisterStructure(ae); + } if (Keys[PGUP_KEY] && ViewHeight < 60) - { - ViewHeight++; - CeilingHeight++; - } + { + ViewHeight++; + CeilingHeight++; + } if (Keys[PGDN_KEY] && ViewHeight > 4) - { - ViewHeight--; - CeilingHeight--; - } + { + ViewHeight--; + CeilingHeight--; + } if (Keys[NUM_1_KEY]) - { - Keys[NUM_1_KEY]=0; - dFactor--; - } + { + Keys[NUM_1_KEY]=0; + dFactor--; + } if (Keys[NUM_2_KEY]) - { - Keys[NUM_2_KEY]=0; - dFactor++; - } + { + Keys[NUM_2_KEY]=0; + dFactor++; + } if (Keys[MINUS_KEY]) - { - Keys[MINUS_KEY]=0; - mFactor--; - } + { + Keys[MINUS_KEY]=0; + mFactor--; + } if (Keys[PLUS_KEY]) - { - Keys[PLUS_KEY]=0; - mFactor++; - } + { + Keys[PLUS_KEY]=0; + mFactor++; + } if (Keys[I_KEY]) - { - Keys[I_KEY] = 0; - InfoFlag ^= 1; - } + { + Keys[I_KEY] = 0; + InfoFlag ^= 1; + } if (Keys[B_KEY]) - { - Keys[B_KEY]=0; - // mFactor -= 64; - if (!LevelFlag) - LoadNewLevel("MALL.DTF"); - else - { - LoadNewLevel("PICS.DTF"); - ae->ObjList[99]->Active = 0; - ae->ObjList[99]->Speed = 48; - } - LevelFlag ^= 1; - } + { + Keys[B_KEY]=0; + // mFactor -= 64; + if (!LevelFlag) + LoadNewLevel("MALL.DTF"); + else + { + LoadNewLevel("PICS.DTF"); + ae->ObjList[99]->Active = 0; + ae->ObjList[99]->Speed = 48; + } + LevelFlag ^= 1; + } if (Keys[S_KEY]) - { - Keys[S_KEY] = 0; - mFactor += 64; - } + { + Keys[S_KEY] = 0; + mFactor += 64; + } } EndBGmusic(); ShutDownFlag = 1; _disable(); -AckSlowDown(); // Set the timer back to normal speed +AckSlowDown(); // Set the timer back to normal speed AckWrapUp(ae); AckSetTextmode(); _dos_setvect(KEYBD,oldvec); @@ -2307,4 +2307,3 @@ _enable(); return(0); } - \ No newline at end of file diff --git a/fdemo/KIT.H b/fdemo/KIT.H index 94dce77..81d8c31 100644 --- a/fdemo/KIT.H +++ b/fdemo/KIT.H @@ -4,62 +4,62 @@ // Module: KIT.H // (c) CopyRight 1994 All Rights Reserved -#define MODE_GRAPHICS 0x13 -#define MODE_TEXT 0x03 +#define MODE_GRAPHICS 0x13 +#define MODE_TEXT 0x03 -#define SCREEN_LENGTH 64000 // Bytes in one full screen -#define SCREEN_LEN_WORDS 32000 // Words in one screen -#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen -#define SCREEN_PLANES 1 // Number of planes for this mode -#define SCREEN_WIDTH 320 // Number of bytes in one row -#define SCREEN_HEIGHT 200 // Number of rows on screen +#define SCREEN_LENGTH 64000 // Bytes in one full screen +#define SCREEN_LEN_WORDS 32000 // Words in one screen +#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen +#define SCREEN_PLANES 1 // Number of planes for this mode +#define SCREEN_WIDTH 320 // Number of bytes in one row +#define SCREEN_HEIGHT 200 // Number of rows on screen -#define BUTTON_OK 0 -#define BUTTON_OKCANCEL 1 -#define BUTTON_YESNO 2 +#define BUTTON_OK 0 +#define BUTTON_OKCANCEL 1 +#define BUTTON_YESNO 2 #define BUTTON_ABORTRETRY 3 -#define BUTTON_RET_OK 0 +#define BUTTON_RET_OK 0 #define BUTTON_RET_CANCEL 1 -#define BUTTON_RET_YES 2 -#define BUTTON_RET_NO 3 +#define BUTTON_RET_YES 2 +#define BUTTON_RET_NO 3 #define BUTTON_RET_ABORT 4 #define BUTTON_RET_RETRY 5 // Used in IORTN.C for message boxes typedef struct { - short x; - short y; - short x1; - short y1; - short index; - } BUTTON; + short x; + short y; + short x1; + short y1; + short index; + } BUTTON; // Used in IORTN.C for message boxes typedef struct { - short Count; - short List[4]; - } INDEXES; + short Count; + short List[4]; + } INDEXES; // Used in IORTN.C list boxes typedef struct _lcb { struct _lcb *Back; struct _lcb *Fwd; - char Data[1]; - } LCB; + char Data[1]; + } LCB; typedef struct { - short ux; - short uy; - short ux1; - short uy1; - short dx; - short dy; - short dx1; - short dy1; - } ARROWRECT; + short ux; + short uy; + short ux1; + short uy1; + short dx; + short dy; + short dx1; + short dy1; + } ARROWRECT; //============================================================================= @@ -137,4 +137,3 @@ short ShowPickList(char **p,short SortFlag); //============================================================================= short LoadSet(char *fName); - \ No newline at end of file diff --git a/fdemo/MODPLAY.ASM b/fdemo/MODPLAY.ASM index 808c7cf..6b3fc89 100644 --- a/fdemo/MODPLAY.ASM +++ b/fdemo/MODPLAY.ASM @@ -1,10 +1,10 @@ ;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² -; Tiny MOD Player for Watcom C/C++32 and DOS/4GW +; Tiny MOD Player for Watcom C/C++32 and DOS/4GW ; Version 2.02a  May 09th, 1994 ; ; Copyright 1993,94 Carlos Hasan ;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² - + ideal p386 model flat,c @@ -16,13 +16,13 @@ jumps global MODPlayModule:near global MODStopModule:near -global MODPlaySample:near -global MODPlayVoice:near -global MODStopVoice:near -global MODSetPeriod:near -global MODSetVolume:near +global MODPlaySample:near +global MODPlayVoice:near +global MODStopVoice:near +global MODSetPeriod:near +global MODSetVolume:near ;;global _GETDS:near -global OurDataSeg:dword +global OurDataSeg:dword ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; EQUATES @@ -46,32 +46,32 @@ RepLength dw ? ends MODSample struc MODHeader ; file header -SongName db 20 dup (?) +SongName db 20 dup (?) Samples MODSample 31 dup (?) OrderLen db ? -ReStart db ? -Order db 128 dup (?) -Sign dd ? -ends MODHeader +ReStart db ? +Order db 128 dup (?) +Sign dd ? +ends MODHeader ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; MOD Player structures ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± -struc Voice -Address dd ?,? ; Current Address -StartAddress dd ? ; Loop Start Address -EndAddress dd ? ; Loop End Address -Frequency dd ? ; Frequency -Volume db ?,? ; Volume -ends Voice +struc Voice +Address dd ?,? ; Current Address +StartAddress dd ? ; Loop Start Address +EndAddress dd ? ; Loop End Address +Frequency dd ? ; Frequency +Volume db ?,? ; Volume +ends Voice -struc Track -Period dw ? ; Note Period -Instr db ? ; Instr Number -Volume db ? ; Volume -Effect dw ? ; Effect -ends Track +struc Track +Period dw ? ; Note Period +Instr db ? ; Instr Number +Volume db ? ; Volume +Effect dw ? ; Effect +ends Track struc Sample Period dw ? ; Default Period @@ -94,7 +94,7 @@ IRQVector df ? ; IRQ Saved Vector BufSelector dw ? ; DPMI Buffer Selector VolBuffer dd ? ; Volume Buffer Address -DMABuffer dd ? ; DMA Buffer Address +DMABuffer dd ? ; DMA Buffer Address DMALength dw ? ; DMA Buffer Length BufferPos dw ? ; Current Buffer Position @@ -118,9 +118,9 @@ OrderLen db ? ; Order Length PatternRow db ? ; Pattern Row OrderList db 128 dup (?) ; Order List PatternPtr dd ? ; Current Pattern Address -Tempo db ? ; Tempo +Tempo db ? ; Tempo TempoCount db ? ; Tempo Internal Counter -BPM db ? ; BPM value +BPM db ? ; BPM value ActiveTracks dw ? ; Number of Active Tracks Tracks Track MAXVOICES dup (?) ; Array of Tracks @@ -145,61 +145,61 @@ codeseg ; In: ; Song = Modulefile address ; Chans = Number of channels -; Rate = Sampling Rate -; Port = I/O Port -; IRQ = IRQ Level -; DRQ = DRQ Channel +; Rate = Sampling Rate +; Port = I/O Port +; IRQ = IRQ Level +; DRQ = DRQ Channel ; Out: -; EAX = status +; EAX = status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword - pushad - mov edi,[Song] ; Load parameters from stack - mov eax,[Chans] - mov [ActiveVoices],ax - mov eax,[Rate] - mov [SBRate],ax - mov eax,[Port] - mov [IOAddr],ax - mov eax,[IRQ] - mov [IRQNum],al - mov eax,[DRQ] - mov [DRQNum],al - mov eax,MIDCRATE*428 ; setup frequency divisor - xor edx,edx - shld edx,eax,16 - shl eax,16 - movzx ebx,[SBRate] - div ebx - mov [FreqDivisor],eax - call MODSetup ; setup MOD player stuff - jc MODPlayDone - call MCInit ; setup the muti-channel stuff - jc MODPlayDone - mov dl,[BPM] ; setup the multi-channel timer - call MCStartTimer - call DMASetBuf ; setup DMA controller - call IRQSetVect ; setup PIC interrupt - call SBOpenDevice ; setup SB for playback - jnc MODPlayDone - call MODStopModule +proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword + pushad + mov edi,[Song] ; Load parameters from stack + mov eax,[Chans] + mov [ActiveVoices],ax + mov eax,[Rate] + mov [SBRate],ax + mov eax,[Port] + mov [IOAddr],ax + mov eax,[IRQ] + mov [IRQNum],al + mov eax,[DRQ] + mov [DRQNum],al + mov eax,MIDCRATE*428 ; setup frequency divisor + xor edx,edx + shld edx,eax,16 + shl eax,16 + movzx ebx,[SBRate] + div ebx + mov [FreqDivisor],eax + call MODSetup ; setup MOD player stuff + jc MODPlayDone + call MCInit ; setup the muti-channel stuff + jc MODPlayDone + mov dl,[BPM] ; setup the multi-channel timer + call MCStartTimer + call DMASetBuf ; setup DMA controller + call IRQSetVect ; setup PIC interrupt + call SBOpenDevice ; setup SB for playback + jnc MODPlayDone + call MODStopModule MODPlayDone: - popad - sbb eax,eax ; return status in EAX - ret + popad + sbb eax,eax ; return status in EAX + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; MODStopModule - Stop playing the current modulefile ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODStopModule - pushad - call SBCloseDevice ; done SB playback - call IRQRestVect ; done PIC interrupt - call DMAReset ; done DMA controller - call MCDone ; done multi-channel stuff - popad - ret +proc MODStopModule + pushad + call SBCloseDevice ; done SB playback + call IRQRestVect ; done PIC interrupt + call DMAReset ; done DMA controller + call MCDone ; done multi-channel stuff + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -208,21 +208,21 @@ endp ; Voice = Audio channel ; Instr = Instrument ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODPlaySample AVoice:dword,AInstr:dword - pushad - mov ebx,[AVoice] ; change the voice sample parameters - mov eax,[AInstr] - mov edx,[eax+Sample.SampleData] - mov esi,[eax+Sample.SampleLength] - add esi,edx - mov edi,esi - call MCStartVoice - movzx ecx,[eax+Sample.Period] ; change the voice frequency - call MCSetFrequency - mov ax,[eax+Sample.Volume] ; and set the voice volume - call MCSetVolume - popad - ret +proc MODPlaySample AVoice:dword,AInstr:dword + pushad + mov ebx,[AVoice] ; change the voice sample parameters + mov eax,[AInstr] + mov edx,[eax+Sample.SampleData] + mov esi,[eax+Sample.SampleLength] + add esi,edx + mov edi,esi + call MCStartVoice + movzx ecx,[eax+Sample.Period] ; change the voice frequency + call MCSetFrequency + mov ax,[eax+Sample.Volume] ; and set the voice volume + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -233,20 +233,20 @@ endp ; Period = Amiga Period ; Volume = Volume ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword - pushad - mov ebx,[AVoice] ; change the voice sample parameters - mov eax,[AInstr] - mov edx,[4*eax+SmpAddress] - mov esi,[4*eax+SmpStartAddress] - mov edi,[4*eax+SmpEndAddress] - call MCStartVoice - mov ecx,[APeriod] ; change the voice frequency - call MCSetFrequency - mov eax,[AVolume] ; and set the voice volume - call MCSetVolume - popad - ret +proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword + pushad + mov ebx,[AVoice] ; change the voice sample parameters + mov eax,[AInstr] + mov edx,[4*eax+SmpAddress] + mov esi,[4*eax+SmpStartAddress] + mov edi,[4*eax+SmpEndAddress] + call MCStartVoice + mov ecx,[APeriod] ; change the voice frequency + call MCSetFrequency + mov eax,[AVolume] ; and set the voice volume + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -254,13 +254,13 @@ endp ; In: ; Voice = Audio channel ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODStopVoice AVoice:dword - pushad - mov ebx,[AVoice] ; set the voice volume to zero - xor al,al - call MCSetVolume - popad - ret +proc MODStopVoice AVoice:dword + pushad + mov ebx,[AVoice] ; set the voice volume to zero + xor al,al + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -269,13 +269,13 @@ endp ; Voice = Audio channel ; Period = Amiga Period ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODSetPeriod AVoice:dword,APeriod:dword - pushad - mov ebx,[AVoice] - mov ecx,[APeriod] - call MCSetFrequency - popad - ret +proc MODSetPeriod AVoice:dword,APeriod:dword + pushad + mov ebx,[AVoice] + mov ecx,[APeriod] + call MCSetFrequency + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -284,13 +284,13 @@ endp ; Voice = Audio channel ; Volume = New Volume ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODSetVolume AVoice:dword,AVolume:dword - pushad - mov ebx,[AVoice] - mov eax,[AVolume] - call MCSetVolume - popad - ret +proc MODSetVolume AVoice:dword,AVolume:dword + pushad + mov ebx,[AVoice] + mov eax,[AVolume] + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -301,10 +301,10 @@ endp ; CF = status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MODSetup: - pushad ; check for valid modfile formats - mov [ActiveTracks],4 - cmp [edi+MODHeader.Sign],'.K.M' - je MODParse + pushad ; check for valid modfile formats + mov [ActiveTracks],4 + cmp [edi+MODHeader.Sign],'.K.M' + je MODParse cmp [edi+MODHeader.Sign],'4TLF' je MODParse mov [ActiveTracks],6 @@ -320,15 +320,15 @@ MODParse: mov [PatternRow],40h mov [Tempo],6 mov [TempoCount],0 - mov [BPM],125 + mov [BPM],125 mov al,[edi+MODHeader.OrderLen] mov [OrderLen],al mov ecx,80h ; copy order list - xor ebx,ebx + xor ebx,ebx xor ah,ah MODCopyOrder: - mov al,[edi+ebx+MODHeader.Order] + mov al,[edi+ebx+MODHeader.Order] mov [ebx+OrderList],al cmp al,ah jb MODCopyNext @@ -352,7 +352,7 @@ MODCopyPatterns: mov ecx,31 ; setup samples data lea edi,[edi+MODHeader.Samples] - xor ebx,ebx + xor ebx,ebx inc ebx MODCopySamples: mov al,[edi+MODSample.Volume] @@ -368,15 +368,15 @@ MODCopySamples: add eax,eax add edx,edx add ebp,ebp - cmp edx,2 ; if not looped, then the loop + cmp edx,2 ; if not looped, then the loop ja MODSetSmpLength ; start and end are the same. xor edx,edx mov ebp,eax MODSetSmpLength: - add edx,ebp + add edx,ebp add eax,esi add edx,esi - add ebp,esi + add ebp,esi mov [4*ebx+SmpAddress],esi mov [4*ebx+SmpEndAddress],edx mov [4*ebx+SmpStartAddress],ebp @@ -397,10 +397,10 @@ MODCallBack: dec [TempoCount] ; decrease tempo counter jle MODNextRow ; next row? lea esi,[Tracks] - xor ebx,ebx + xor ebx,ebx MODUpdateLoop: call MODUpNote ; update note events - add esi,size Track + add esi,size Track inc ebx cmp bx,[ActiveTracks] jb MODUpdateLoop @@ -416,12 +416,12 @@ MODNextRow: mov [PatternRow],bl ; reset the pattern row mov bl,[OrderPos] inc bl ; update the order position - cmp bl,[OrderLen] + cmp bl,[OrderLen] jb MODSetOrder xor bl,bl MODSetOrder: mov [OrderPos],bl - mov bl,[ebx+OrderList] ; get the pattern from the order list + mov bl,[ebx+OrderList] ; get the pattern from the order list mov edi,[4*ebx+PatternList] mov [PatternPtr],edi ; set the pattern address MODDontWrap: @@ -447,9 +447,9 @@ MODGetNoteLoop: ; EDI = pattern data address ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MODGetNote: - mov al,[edi+2] ; get the sample number - shr al,4 - mov ah,[edi] + mov al,[edi+2] ; get the sample number + shr al,4 + mov ah,[edi] and ah,0F0h or al,ah test al,al ; nonzero value? @@ -464,7 +464,7 @@ MODGetPeriod: xchg al,ah and ax,0FFFh test ax,ax - je MODGetEffect ; nonzero value? + je MODGetEffect ; nonzero value? mov [esi+Track.Period],ax ; set new period value movzx ecx,ax call MCSetFrequency @@ -472,8 +472,8 @@ MODGetPeriod: movzx eax,[esi+Track.Instr] mov edx,[4*eax+SmpAddress] mov esi,[4*eax+SmpStartAddress] - mov edi,[4*eax+SmpEndAddress] - call MCStartVoice + mov edi,[4*eax+SmpEndAddress] + call MCStartVoice pop edi esi MODGetEffect: mov ax,[edi+2] ; get the effect value @@ -488,7 +488,7 @@ MODGetEffect: je EFXJumpPos cmp ah,0Dh je EFXBreak - cmp ah,09h + cmp ah,09h je EFXSampleOffset ret @@ -499,10 +499,10 @@ MODGetEffect: ; ESI = track address ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MODUpNote: - mov ax,[esi+Track.Effect] ; dispatch the effects - cmp ah,0Ah - je EFXSlideVolume - ret + mov ax,[esi+Track.Effect] ; dispatch the effects + cmp ah,0Ah + je EFXSlideVolume + ret ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± @@ -512,7 +512,7 @@ MODUpNote: ;  The registers EBX,ESI,EDI must be preserved. ;  The effect parameters are passed through the registers: ; EBX - voice number -; ESI - track address +; ESI - track address ; AL - effect parameter ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± @@ -536,7 +536,7 @@ EFXSetSpeed: mov [TempoCount],al ret EFXSetBPM: - mov [BPM],al + mov [BPM],al mov dl,al call MCStartTimer ret @@ -548,7 +548,7 @@ EFXJumpPos: dec al mov [OrderPos],al mov [PatternRow],40h - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; EFXBreak - breaks the current pattern. @@ -572,7 +572,7 @@ EFXSlideVolume: mov al,40h EFXVolSlided: mov [esi+Track.Volume],al - call MCSetVolume + call MCSetVolume ret EFXVolumeDown: sub al,ah @@ -584,7 +584,7 @@ EFXVolumeDown: ; EFXSampleOffset - Set the sample offset ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° EFXSampleOffset: - xor edx,edx + xor edx,edx mov dh,al push esi edi movzx eax,[esi+Track.Instr] @@ -606,9 +606,9 @@ EFXSampleOffset: ; CF = status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MCInit: - pushad - xor ax,ax ; initialize variables - mov [BufferPos],ax + pushad + xor ax,ax ; initialize variables + mov [BufferPos],ax mov [TimerCount],ax mov [TimerSpeed],ax mov [BufSelector],ax @@ -627,7 +627,7 @@ MCInit: cmp ax,cx jae MCAlignVolBuffer mov esi,edi - add edi,4200h + add edi,4200h MCAlignVolBuffer: ; VolBuffer must be page aligned add esi,0FFh ; (256 bytes = 1 page) and esi,not 0FFh @@ -651,7 +651,7 @@ MCDoVolBuffer: imul bh sar ax,cl mov [edi],ah - inc edi + inc edi inc bl jne MCDoVolBuffer inc bh @@ -675,7 +675,7 @@ MCDone: mov [BufSelector],0 MCDoneExit: popad - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; MCStartVoice - Set the voice sample instrument parameters @@ -723,7 +723,7 @@ MCSetFreqDone: ; AL = volume ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MCSetVolume: - push ebx + push ebx mov ebx,[4*ebx+VoiceTable] mov [ebx+Voice.Volume],al pop ebx @@ -747,7 +747,7 @@ MCStartTimer: mov [TimerSpeed],ax pop dx pop cx - pop ax + pop ax ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -771,7 +771,7 @@ MCPollLoop: cmp [TimerCount],0 ; time to call the MOD callback? jg MCPollChunk call MODCallBack - mov ax,[TimerSpeed] ; update timer accumulator + mov ax,[TimerSpeed] ; update timer accumulator add [TimerCount],ax MCPollChunk: mov ax,[BufferLen] ; get the chunk length @@ -795,7 +795,7 @@ MCVoicesLoop: call MCMixVoice pop edi pop edx - pop ecx + pop ecx pop ebx add ebx,size Voice dec dx @@ -814,12 +814,12 @@ MCPollDone: ; ECX = Number of samples ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MCMixVoice: - push ebx + push ebx ; Modify the mixing chunk of code - mov eax,[ebx+Voice.EndAddress] - mov [dword ds:MCMixCode0],eax + mov eax,[ebx+Voice.EndAddress] + mov [dword ds:MCMixCode0],eax mov [dword ds:MCMixCode2],eax sub eax,[ebx+Voice.StartAddress] mov [dword ds:MCMixCode1],eax @@ -836,7 +836,7 @@ MCMixVoice: ; Load the volume table address mov bh,[ebx+Voice.Volume] - and ebx,0FF00h + and ebx,0FF00h add ebx,[VolBuffer] ; Start of the mixing chunk of code (non pure code) @@ -879,12 +879,12 @@ MCMixBreak: ; AL = data ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° SBWrite: - push eax - push ecx - push edx - mov dx,[IOAddr] - add dx,0Ch - mov ecx,10000h ; wait until the DSP is ready + push eax + push ecx + push edx + mov dx,[IOAddr] + add dx,0Ch + mov ecx,10000h ; wait until the DSP is ready mov ah,al ; to receive the data byte SBWriteWait: in al,dx @@ -895,7 +895,7 @@ SBWriteWait: pop edx pop ecx pop eax - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; SBResetDSP - reset the Sound Blaster DSP chip @@ -919,7 +919,7 @@ SBResetDSP: SBReadWait: in al,dx and al,80h - loopz SBReadWait + loopz SBReadWait sub dx,04h in al,dx ; read the DSP data byte cmp al,0AAh @@ -941,9 +941,9 @@ SBResetDone: ; CF = initialization status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° SBOpenDevice: - pusha - call SBResetDSP ; check for a SB card - jc SBOpenDone + pusha + call SBResetDSP ; check for a SB card + jc SBOpenDone mov al,0D1h call SBWrite ; turn on SB speaker mov al,40h @@ -964,7 +964,7 @@ SBOpenDevice: clc ; set successful status SBOpenDone: popa - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; SBCloseDevice - shutdown the SB playback @@ -988,7 +988,7 @@ DMAReset: pusha mov al,[DRQNum] ; reset the DMA channel or al,04h - out 0Ah,al + out 0Ah,al popa ret @@ -1012,7 +1012,7 @@ DMASetBuf: add dx,dx mov eax,[DMABuffer] out dx,al - mov al,ah + mov al,ah out dx,al inc dx ; set the DMA buffer length mov ax,[DMALength] @@ -1048,15 +1048,15 @@ IRQGetIntNum: push ax bx cx ; get the virtual master and slave mov ax,0400h ; PIC base interrupts in DX int 31h - pop cx bx ax - cmp al,08h ; get the PIC base interrupt for - jb IRQGetDone ; the IRQ number in AL - mov dh,dl - sub al,08h + pop cx bx ax + cmp al,08h ; get the PIC base interrupt for + jb IRQGetDone ; the IRQ number in AL + mov dh,dl + sub al,08h IRQGetDone: - add al,dh - pop dx - ret + add al,dh + pop dx + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; IRQRestVect - Restores the previous IRQ vector @@ -1066,13 +1066,13 @@ IRQGetDone: ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° IRQRestVect: pushad - push ds - in al,0A1h ; disable the IRQ interrupt using - mov ah,al ; the PIC interrupt mask registers - in al,21h - mov dx,01h - mov cl,[IRQNum] - shl dx,cl + push ds + in al,0A1h ; disable the IRQ interrupt using + mov ah,al ; the PIC interrupt mask registers + in al,21h + mov dx,01h + mov cl,[IRQNum] + shl dx,cl or ax,dx out 21h,al mov al,ah @@ -1090,7 +1090,7 @@ IRQRestVect: IRQRestDone: pop ds xor ebx,ebx - mov [dword IRQVector],ebx + mov [dword IRQVector],ebx mov [word 4+IRQVector],bx popad ret @@ -1114,7 +1114,7 @@ IRQSetVect: push cs pop ds int 21h - pop es ds + pop es ds in al,0A1h ; enable this IRQ using the mov al,ah ; PIC interrupt mask registers in al,21h @@ -1133,14 +1133,14 @@ IRQSetVect: ; IRQHandler - Hardware IRQ handler ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° IRQHandler: - pushad ; pushes all the registers - push ds -;;; mov ax,DGROUP ; load the DS selector -;;; mov ds,ax -;;; call _GETDS - mov ax,cs:[dword ptr OurDataSeg] - mov ds,ax - mov dx,[IOAddr] ; send ack to the SB DSP chip + pushad ; pushes all the registers + push ds +;;; mov ax,DGROUP ; load the DS selector +;;; mov ds,ax +;;; call _GETDS + mov ax,cs:[dword ptr OurDataSeg] + mov ds,ax + mov dx,[IOAddr] ; send ack to the SB DSP chip add dx,0Eh in al,dx mov al,14h ; restart DMA transfer @@ -1163,4 +1163,3 @@ IRQAckPIC: iretd end - \ No newline at end of file diff --git a/fdemo/MOUSE.C b/fdemo/MOUSE.C index fc31ab1..01f35d2 100644 --- a/fdemo/MOUSE.C +++ b/fdemo/MOUSE.C @@ -11,14 +11,14 @@ void Mymemset(void *,int,int); - int MouseModifier = 2; + int MouseModifier = 2; //============================================================================= // Check if mouse is installed, returns -1 if it IS installed //============================================================================= int MouseInstalled(void) { - int yesno; + int yesno; union REGPACK regs; Mymemset(®s,0,sizeof(union REGPACK)); @@ -59,7 +59,7 @@ intr(0x33,®s); //============================================================================= int ReadMouseCursor(int *mrow,int *mcol) { - int bstatus; + int bstatus; union REGPACK regs; Mymemset(®s,0,sizeof(union REGPACK)); @@ -77,7 +77,7 @@ return(bstatus); //============================================================================= int ReadMouseButtons(void) { - int bstatus; + int bstatus; union REGPACK regs; Mymemset(®s,0,sizeof(union REGPACK)); @@ -178,4 +178,3 @@ intr(0x33,®s); } - \ No newline at end of file diff --git a/mall/KIT.H b/mall/KIT.H index 9efb072..3cc32f4 100644 --- a/mall/KIT.H +++ b/mall/KIT.H @@ -4,62 +4,62 @@ // Module: KIT.H // (c) CopyRight 1994 All Rights Reserved -#define MODE_GRAPHICS 0x13 -#define MODE_TEXT 0x03 +#define MODE_GRAPHICS 0x13 +#define MODE_TEXT 0x03 -#define SCREEN_LENGTH 64000 // Bytes in one full screen -#define SCREEN_LEN_WORDS 32000 // Words in one screen -#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen -#define SCREEN_PLANES 1 // Number of planes for this mode -#define SCREEN_WIDTH 320 // Number of bytes in one row -#define SCREEN_HEIGHT 200 // Number of rows on screen +#define SCREEN_LENGTH 64000 // Bytes in one full screen +#define SCREEN_LEN_WORDS 32000 // Words in one screen +#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen +#define SCREEN_PLANES 1 // Number of planes for this mode +#define SCREEN_WIDTH 320 // Number of bytes in one row +#define SCREEN_HEIGHT 200 // Number of rows on screen -#define BUTTON_OK 0 -#define BUTTON_OKCANCEL 1 -#define BUTTON_YESNO 2 +#define BUTTON_OK 0 +#define BUTTON_OKCANCEL 1 +#define BUTTON_YESNO 2 #define BUTTON_ABORTRETRY 3 -#define BUTTON_RET_OK 0 +#define BUTTON_RET_OK 0 #define BUTTON_RET_CANCEL 1 -#define BUTTON_RET_YES 2 -#define BUTTON_RET_NO 3 +#define BUTTON_RET_YES 2 +#define BUTTON_RET_NO 3 #define BUTTON_RET_ABORT 4 #define BUTTON_RET_RETRY 5 // Used in IORTN.C for message boxes typedef struct { - short x; - short y; - short x1; - short y1; - short index; - } BUTTON; + short x; + short y; + short x1; + short y1; + short index; + } BUTTON; // Used in IORTN.C for message boxes typedef struct { - short Count; - short List[4]; - } INDEXES; + short Count; + short List[4]; + } INDEXES; // Used in IORTN.C list boxes typedef struct _lcb { struct _lcb *Back; struct _lcb *Fwd; - char Data[1]; - } LCB; + char Data[1]; + } LCB; typedef struct { - short ux; - short uy; - short ux1; - short uy1; - short dx; - short dy; - short dx1; - short dy1; - } ARROWRECT; + short ux; + short uy; + short ux1; + short uy1; + short dx; + short dy; + short dx1; + short dy1; + } ARROWRECT; //============================================================================= @@ -137,4 +137,3 @@ short ShowPickList(char **p,short SortFlag); //============================================================================= short LoadSet(char *fName); - \ No newline at end of file diff --git a/mall/MALL.C b/mall/MALL.C index 72cf2f9..81ce109 100644 --- a/mall/MALL.C +++ b/mall/MALL.C @@ -19,104 +19,104 @@ #include "kit.h" #include "modplay.h" -#define DEMO_RESOURCE 69 -#define HAND1_RESOURCE 135 -#define HAND2_RESOURCE 136 +#define DEMO_RESOURCE 69 +#define HAND1_RESOURCE 135 +#define HAND2_RESOURCE 136 #define KEYBD 0x9 /* INTERRUPT 9 */ -#define RIGHT_ARROW_KEY 77 -#define UP_ARROW_KEY 72 -#define LEFT_ARROW_KEY 75 -#define DOWN_ARROW_KEY 80 -#define MINUS_KEY 74 -#define PLUS_KEY 78 -#define NUMBER_5_KEY 76 -#define ESCAPE_KEY 1 -#define PGUP_KEY 73 -#define PGDN_KEY 81 -#define B_KEY 48 -#define C_KEY 46 -#define F_KEY 33 -#define I_KEY 23 -#define R_KEY 19 -#define S_KEY 31 -#define W_KEY 17 -#define NUM_1_KEY 2 -#define NUM_2_KEY 3 -#define NUM_3_KEY 4 -#define NUM_4_KEY 5 -#define NUM_5_KEY 6 -#define NUM_6_KEY 7 -#define NUM_7_KEY 8 -#define NUM_8_KEY 9 -#define NUM_9_KEY 10 +#define RIGHT_ARROW_KEY 77 +#define UP_ARROW_KEY 72 +#define LEFT_ARROW_KEY 75 +#define DOWN_ARROW_KEY 80 +#define MINUS_KEY 74 +#define PLUS_KEY 78 +#define NUMBER_5_KEY 76 +#define ESCAPE_KEY 1 +#define PGUP_KEY 73 +#define PGDN_KEY 81 +#define B_KEY 48 +#define C_KEY 46 +#define F_KEY 33 +#define I_KEY 23 +#define R_KEY 19 +#define S_KEY 31 +#define W_KEY 17 +#define NUM_1_KEY 2 +#define NUM_2_KEY 3 +#define NUM_3_KEY 4 +#define NUM_4_KEY 5 +#define NUM_5_KEY 6 +#define NUM_6_KEY 7 +#define NUM_7_KEY 8 +#define NUM_8_KEY 9 +#define NUM_9_KEY 10 typedef struct { - int mdx; - int mdy; - int mButtons; + int mdx; + int mdy; + int mButtons; } MOUSE; -#define MAX_AMOUNT 64 -#define MAX_MAG_AMOUNT 64 -#define MAX_STR_AMOUNT 128 +#define MAX_AMOUNT 64 +#define MAX_MAG_AMOUNT 64 +#define MAX_STR_AMOUNT 128 #define MAX_STR_HALF_AMOUNT 64 -extern long mFactor; -extern long dFactor; +extern long mFactor; +extern long dFactor; -extern long zdTable[VIEW_WIDTH][200]; +extern long zdTable[VIEW_WIDTH][200]; -extern UCHAR colordat[]; -extern UINT *ObjGrid; -extern UINT *Grid; -extern UINT FloorMap[]; -extern short ViewHeight; -extern short CeilingHeight; -extern short Resolution; -extern long kduFactor; -extern long kdvFactor; -extern long kxFactor; -extern long kyFactor; -extern short tuFactor; -extern short tvFactor; -extern short rsHandle; -extern ULONG *rbaTable; -extern UCHAR *BackArray[]; -extern long *xNextTable; -extern long *yNextTable; -extern UINT *Grid; -extern long *CosTable; -extern long *SinTable; +extern UCHAR colordat[]; +extern UINT *ObjGrid; +extern UINT *Grid; +extern UINT FloorMap[]; +extern short ViewHeight; +extern short CeilingHeight; +extern short Resolution; +extern long kduFactor; +extern long kdvFactor; +extern long kxFactor; +extern long kyFactor; +extern short tuFactor; +extern short tvFactor; +extern short rsHandle; +extern ULONG *rbaTable; +extern UCHAR *BackArray[]; +extern long *xNextTable; +extern long *yNextTable; +extern UINT *Grid; +extern long *CosTable; +extern long *SinTable; - ACKENG *ae; + ACKENG *ae; // These are the ranges used for distance shading. Will need to be modified // for the new color palette used. ColorRange ranges[64] = { - 16,15, - 32,16, - 48,16, - 64,16, - 80,16, - 96,8, - 104,8, - 112,8, - 120,8, - 128,8, - 136,8, - 144,8, - 152,8, - 160,8, - 168,8, - 176,8, - 184,16, - 200,16, - 216,16, - 232,16, - 248,16, - 0,0 - }; + 16,15, + 32,16, + 48,16, + 64,16, + 80,16, + 96,8, + 104,8, + 112,8, + 120,8, + 128,8, + 136,8, + 144,8, + 152,8, + 160,8, + 168,8, + 176,8, + 184,16, + 200,16, + 216,16, + 232,16, + 248,16, + 0,0 + }; @@ -124,7 +124,7 @@ ColorRange ranges[64] = { UCHAR KeyPressed; UCHAR MiniKey; UCHAR Keys[128]; - int HaveMouse; + int HaveMouse; short FlashIndex; short FlashCount; UCHAR *bmFlash[2]; @@ -134,16 +134,16 @@ ColorRange ranges[64] = { UCHAR FontTransparent; UCHAR FontColor; UCHAR TextBGcolor; - int Throwing; - int Shooting; - int ShutDownFlag; + int Throwing; + int Shooting; + int ShutDownFlag; short MagAmount; short StrAmount; - int ShowHitFlag; - int MapResource; - int PalResource; - int ResScreenBack; - int ResScrollBack; + int ShowHitFlag; + int MapResource; + int PalResource; + int ResScreenBack; + int ResScrollBack; void *BGmusic; UCHAR *DemoPtr; @@ -174,28 +174,28 @@ volatile short cframes=0, count=0, ticks=0; volatile short AckTmCount=0, AckTmDelay=0; char *ErrorMsgs[] = { - "ERR_BADFILE ", - "ERR_BADCOMMAND ", - "ERR_BADOBJNUMBER ", - "ERR_BADSYNTAX ", - "ERR_LOADINGBITMAP", - "ERR_BADDIRECTION ", - "ERR_BADSTARTX ", - "ERR_BADSTARTY ", - "ERR_BADANGLE ", - "ERR_BADMAPFILE ", - "ERR_READINGMAP ", - "ERR_BADPICNAME ", - "ERR_INVALIDFORM ", - "ERR_NOPBM ", - "ERR_BADPICFILE ", - "ERR_NOMEMORY ", - "ERR_BADPALFILE ", - "ERR_BADWINDOWSIZE", - "ERR_TOMANYVIEWS ", - "ERR_BADOBJECTNUM ", - "ERR_BADOBJTYPE " - }; + "ERR_BADFILE ", + "ERR_BADCOMMAND ", + "ERR_BADOBJNUMBER ", + "ERR_BADSYNTAX ", + "ERR_LOADINGBITMAP", + "ERR_BADDIRECTION ", + "ERR_BADSTARTX ", + "ERR_BADSTARTY ", + "ERR_BADANGLE ", + "ERR_BADMAPFILE ", + "ERR_READINGMAP ", + "ERR_BADPICNAME ", + "ERR_INVALIDFORM ", + "ERR_NOPBM ", + "ERR_BADPICFILE ", + "ERR_NOMEMORY ", + "ERR_BADPALFILE ", + "ERR_BADWINDOWSIZE", + "ERR_TOMANYVIEWS ", + "ERR_BADOBJECTNUM ", + "ERR_BADOBJTYPE " + }; void AckRegisterStructure(ACKENG *ae); @@ -258,10 +258,10 @@ else } - short ModSound; // 0 = Off, 1 = On - short ModPort; // Port of SB card - short ModIRQ; // IRQ number of SB card - short ModDMA; // DMA channel of SB card + short ModSound; // 0 = Off, 1 = On + short ModPort; // Port of SB card + short ModIRQ; // IRQ number of SB card + short ModDMA; // DMA channel of SB card char ModName[128]; // Filename of MOD file to read //============================================================================= @@ -269,7 +269,7 @@ else //============================================================================= char *StripEndOfLine(char *s) { - int len; + int len; char ch; len = strlen(s); @@ -278,7 +278,7 @@ while (--len >= 0) { ch = s[len]; if (ch != ' ' && ch != ';' && ch != '\t' && ch != 13 && ch != 10) - break; + break; s[len] = '\0'; } @@ -300,12 +300,12 @@ while (*s) { ch = toupper(*s++); if (ch == ' ' || ch == '\t' || ch == ',') - continue; + continue; if (ch < '0') break; if (ch > 'F') break; if (ch > '9' && ch < 'A') - break; + break; value <<= 4; if (ch >= 'A') ch -= 7; @@ -339,48 +339,48 @@ if (fp == NULL) while (1) { if (feof(fp)) - break; + break; *rBuf = '\0'; fgets(rBuf,125,fp); if (*rBuf == ';') - continue; + continue; if (!strnicmp(rBuf,"SOUND:",6)) - { - s = SkipSpaces(&rBuf[6]); - if (!strnicmp(s,"ON",2)) - ModSound = 1; - else - ModSound = 0; + { + s = SkipSpaces(&rBuf[6]); + if (!strnicmp(s,"ON",2)) + ModSound = 1; + else + ModSound = 0; - continue; - } + continue; + } if (!strnicmp(rBuf,"SBPORT:",7)) - { - ModPort = atoHex(&rBuf[7]); - continue; - } + { + ModPort = atoHex(&rBuf[7]); + continue; + } if (!strnicmp(rBuf,"SBIRQ:",6)) - { - ModIRQ = atoi(&rBuf[6]); - continue; - } + { + ModIRQ = atoi(&rBuf[6]); + continue; + } if (!strnicmp(rBuf,"SBDMA:",6)) - { - ModDMA = atoi(&rBuf[6]); - continue; - } + { + ModDMA = atoi(&rBuf[6]); + continue; + } if (!strnicmp(rBuf,"SOUNDFILE:",10)) - { - s = SkipSpaces(&rBuf[10]); - strcpy(ModName,s); - StripEndOfLine(ModName); - } + { + s = SkipSpaces(&rBuf[10]); + strcpy(ModName,s); + StripEndOfLine(ModName); + } } @@ -396,15 +396,15 @@ void *MODLoadModule(char *Path) unsigned modsize; void *modfile = NULL; if ((handle = open(Path,O_RDONLY | O_BINARY)) != -1) { - modsize = lseek(handle,0L,SEEK_END); - lseek(handle,0L,SEEK_SET); - if ((modfile=(void*)AckMalloc(modsize)) != NULL) { - if (read(handle,modfile,modsize) != modsize) { - AckFree(modfile); - modfile = NULL; - } - } - close(handle); + modsize = lseek(handle,0L,SEEK_END); + lseek(handle,0L,SEEK_SET); + if ((modfile=(void*)AckMalloc(modsize)) != NULL) { + if (read(handle,modfile,modsize) != modsize) { + AckFree(modfile); + modfile = NULL; + } + } + close(handle); } return modfile; } @@ -459,7 +459,7 @@ MODFreeModule(BGmusic); short LoadSmallFont(void) { short ht,wt; - int len; + int len; ht = 2; smFont = AckReadiff((UCHAR *)ht); @@ -479,9 +479,9 @@ return(0); //============================================================================= void smWriteChar(short x,short y,unsigned char ch) { - int FontOffset,VidOffset; - int row,col; - UCHAR *Video; + int FontOffset,VidOffset; + int row,col; + UCHAR *Video; VidOffset = (y * 320) + x; Video = (UCHAR *)0xA0000; @@ -494,21 +494,21 @@ if (FontTransparent) for (row = 0; row < 5; row++) { if (!FontTransparent) - { - Video[0] = TextBGcolor; - Video[1] = TextBGcolor; - Video[2] = TextBGcolor; - Video[3] = TextBGcolor; - } + { + Video[0] = TextBGcolor; + Video[1] = TextBGcolor; + Video[2] = TextBGcolor; + Video[3] = TextBGcolor; + } if (smFont[FontOffset]) - Video[0] = FontColor; + Video[0] = FontColor; if (smFont[FontOffset+1]) - Video[1] = FontColor; + Video[1] = FontColor; if (smFont[FontOffset+2]) - Video[2] = FontColor; + Video[2] = FontColor; if (smFont[FontOffset+3]) - Video[3] = FontColor; + Video[3] = FontColor; Video += 320; FontOffset += 294; @@ -532,14 +532,14 @@ while (*s) ch = *s++; if (ch == 10) - { - x = OrgX; - y += 8; - continue; - } + { + x = OrgX; + y += 8; + continue; + } if (ch < ' ') - continue; + continue; ch = toupper(ch); smWriteChar(x,y,ch); @@ -566,7 +566,7 @@ FontColor = 15; //============================================================================= void CheckMouse(MOUSE *m) { - int dx,dy; + int dx,dy; short x,y,buttons; @@ -589,21 +589,21 @@ m->mdy = dy; //============================================================================= int ReadLine(void) { - int len; + int len; char ch; len = 0; while (len < 200) { if (read(rsHandle,&LineBuffer[len],1) != 1) - break; + break; ch = LineBuffer[len]; if (ch == 10) - continue; + continue; if (ch == 13) - break; + break; len++; } @@ -624,16 +624,16 @@ while (*s) { ch = *s++; if (ch == ',') - { - while (*s) - { - ch = *s; - if (ch != ',' && ch != ' ' && ch != '\t') - return(s); - s++; - } - return(NULL); - } + { + while (*s) + { + ch = *s; + if (ch != ',' && ch != ' ' && ch != '\t') + return(s); + s++; + } + return(NULL); + } } @@ -645,20 +645,20 @@ return(NULL); //============================================================================= int LoadWall(void) { - int wnum,rnum,result; + int wnum,rnum,result; long pos; char *lb; -lb = LineBuffer; // Info file buffer -wnum = atoi(lb); // Wall number to load into +lb = LineBuffer; // Info file buffer +wnum = atoi(lb); // Wall number to load into lb = GetNextParm(lb); if (lb == NULL) return(-1); -rnum = atoi(lb); // Resource number +rnum = atoi(lb); // Resource number pos = lseek(rsHandle,0L,SEEK_CUR); result = AckLoadWall(ae,wnum,(char *)rnum); @@ -673,19 +673,19 @@ return(result); //============================================================================= int LoadObject(void) { - int onum,rnum,result; + int onum,rnum,result; long pos; char *lb; lb = LineBuffer; -onum = atoi(lb); // Object bitmap number +onum = atoi(lb); // Object bitmap number lb = GetNextParm(lb); if (lb == NULL) return(-2); -rnum = atoi(lb); // Resource number +rnum = atoi(lb); // Resource number pos = lseek(rsHandle,0L,SEEK_CUR); result = AckLoadObject(ae,onum,(char *)rnum); lseek(rsHandle,pos,SEEK_SET); @@ -713,7 +713,7 @@ return(s); //============================================================================= int CreateObject(void) { - int onum,vnum,speed; + int onum,vnum,speed; short result,oType; short NumViews,bmPerView; UINT flags; @@ -727,22 +727,22 @@ if (!strnicmp(lb,"NUMBER:",7)) lb = &lb[7]; onum = atoi(lb); if (onum < 1 || onum > MAX_OBJECTS) - return(-3); + return(-3); result = AckCreateObject(ae,onum); if (result) - return(result); + return(result); LastObjectIndex = onum; lb = GetNextParm(lb); if (lb == NULL) - return(-4); + return(-4); ae->ObjList[onum]->Speed = atoi(lb); return(0); } -onum = LastObjectIndex; // Object number +onum = LastObjectIndex; // Object number oType = 0; @@ -851,8 +851,8 @@ return(result); //============================================================================= int ProcessInfoFile(void) { - int result; - int mode; + int result; + int mode; long pos; char *lb; @@ -865,187 +865,187 @@ mode = result = 0; while (!result) { if (!ReadLine()) - continue; + continue; if (*LineBuffer == ';') - continue; + continue; if (!strnicmp(LineBuffer,"END:",4)) - break; + break; printf("."); switch (mode) - { + { - case 1: // Read walls - if (!strnicmp(LineBuffer,"LOADTYPE:",9)) - { - ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM - break; - } + case 1: // Read walls + if (!strnicmp(LineBuffer,"LOADTYPE:",9)) + { + ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM + break; + } - if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) - mode = 4; - else - result = LoadWall(); - break; + if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) + mode = 4; + else + result = LoadWall(); + break; - case 2: // Object bitmaps - if (!strnicmp(LineBuffer,"LOADTYPE:",9)) // Sets for GIF or BBM - { - ae->bmLoadType = atoi(&LineBuffer[9]); - break; - } - if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) - mode = 5; - else - result = LoadObject(); - break; + case 2: // Object bitmaps + if (!strnicmp(LineBuffer,"LOADTYPE:",9)) // Sets for GIF or BBM + { + ae->bmLoadType = atoi(&LineBuffer[9]); + break; + } + if (!strnicmp(LineBuffer,"ENDBITMAPS:",11)) + mode = 5; + else + result = LoadObject(); + break; - case 3: // Create Object - if (!strnicmp(LineBuffer,"ENDDESC:",8)) - mode = 5; - else - result = CreateObject(); - break; + case 3: // Create Object + if (!strnicmp(LineBuffer,"ENDDESC:",8)) + mode = 5; + else + result = CreateObject(); + break; - case 4: // Walls topic - if (!strnicmp(LineBuffer,"BITMAPS:",8)) - mode = 1; + case 4: // Walls topic + if (!strnicmp(LineBuffer,"BITMAPS:",8)) + mode = 1; - if (!strnicmp(LineBuffer,"ENDWALLS:",9)) - mode = 0; - break; + if (!strnicmp(LineBuffer,"ENDWALLS:",9)) + mode = 0; + break; - case 5: // Objects topic - if (!strnicmp(LineBuffer,"BITMAPS:",8)) - mode = 2; + case 5: // Objects topic + if (!strnicmp(LineBuffer,"BITMAPS:",8)) + mode = 2; - if (!strnicmp(LineBuffer,"OBJDESC:",8)) - mode = 3; + if (!strnicmp(LineBuffer,"OBJDESC:",8)) + mode = 3; - if (!strnicmp(LineBuffer,"ENDOBJECTS:",11)) - mode = 0; - break; + if (!strnicmp(LineBuffer,"ENDOBJECTS:",11)) + mode = 0; + break; - default: - if (!strnicmp(LineBuffer,"WALLS:",6)) - { - mode = 4; - break; - } + default: + if (!strnicmp(LineBuffer,"WALLS:",6)) + { + mode = 4; + break; + } - if (!strnicmp(LineBuffer,"OBJECTS:",8)) - { - mode = 5; - break; - } + if (!strnicmp(LineBuffer,"OBJECTS:",8)) + { + mode = 5; + break; + } - if (!strnicmp(LineBuffer,"MAPFILE:",8)) - { - MapResource = atoi(&LineBuffer[8]); - pos = lseek(rsHandle,0L,SEEK_CUR); - result = AckReadMapFile(ae,(char *)MapResource); - lseek(rsHandle,pos,SEEK_SET); - break; - } + if (!strnicmp(LineBuffer,"MAPFILE:",8)) + { + MapResource = atoi(&LineBuffer[8]); + pos = lseek(rsHandle,0L,SEEK_CUR); + result = AckReadMapFile(ae,(char *)MapResource); + lseek(rsHandle,pos,SEEK_SET); + break; + } - if (!strnicmp(LineBuffer,"PALFILE:",8)) - { - PalResource = atoi(&LineBuffer[8]); - break; - } + if (!strnicmp(LineBuffer,"PALFILE:",8)) + { + PalResource = atoi(&LineBuffer[8]); + break; + } - if (!strnicmp(LineBuffer,"XPLAYER:",8)) - { - ae->xPlayer = atoi(&LineBuffer[8]); - break; - } + if (!strnicmp(LineBuffer,"XPLAYER:",8)) + { + ae->xPlayer = atoi(&LineBuffer[8]); + break; + } - if (!strnicmp(LineBuffer,"YPLAYER:",8)) - { - ae->yPlayer = atoi(&LineBuffer[8]); - break; - } + if (!strnicmp(LineBuffer,"YPLAYER:",8)) + { + ae->yPlayer = atoi(&LineBuffer[8]); + break; + } - if (!strnicmp(LineBuffer,"PLAYERANGLE:",12)) - { - ae->PlayerAngle = atoi(&LineBuffer[12]); - break; - } + if (!strnicmp(LineBuffer,"PLAYERANGLE:",12)) + { + ae->PlayerAngle = atoi(&LineBuffer[12]); + break; + } - if (!strnicmp(LineBuffer,"SCREENBACK:",11)) - { - ResScreenBack = atoi(&LineBuffer[11]); - break; - } + if (!strnicmp(LineBuffer,"SCREENBACK:",11)) + { + ResScreenBack = atoi(&LineBuffer[11]); + break; + } - if (!strnicmp(LineBuffer,"SCROLLBACK:",11)) - { - ResScrollBack = atoi(&LineBuffer[11]); - break; - } + if (!strnicmp(LineBuffer,"SCROLLBACK:",11)) + { + ResScrollBack = atoi(&LineBuffer[11]); + break; + } - if (!strnicmp(LineBuffer,"TOPCOLOR:",9)) - { - ae->TopColor = atoi(&LineBuffer[9]); - break; - } + if (!strnicmp(LineBuffer,"TOPCOLOR:",9)) + { + ae->TopColor = atoi(&LineBuffer[9]); + break; + } - if (!strnicmp(LineBuffer,"BOTTOMCOLOR:",12)) - { - ae->BottomColor = atoi(&LineBuffer[12]); - break; - } + if (!strnicmp(LineBuffer,"BOTTOMCOLOR:",12)) + { + ae->BottomColor = atoi(&LineBuffer[12]); + break; + } - if (!strnicmp(LineBuffer,"SHADING:",8)) - { - strupr(LineBuffer); - if (strstr(&LineBuffer[8],"OFF") != NULL) - ae->LightFlag = SHADING_OFF; - else - ae->LightFlag = SHADING_ON; - break; - } + if (!strnicmp(LineBuffer,"SHADING:",8)) + { + strupr(LineBuffer); + if (strstr(&LineBuffer[8],"OFF") != NULL) + ae->LightFlag = SHADING_OFF; + else + ae->LightFlag = SHADING_ON; + break; + } - if (!strnicmp(LineBuffer,"FLOORS:",7)) - { - strupr(LineBuffer); - if (strstr(&LineBuffer[7],"OFF") != NULL) - ae->SysFlags |= SYS_SOLID_FLOOR; - else - { - ae->SysFlags &= ~SYS_SOLID_FLOOR; - } - break; - } + if (!strnicmp(LineBuffer,"FLOORS:",7)) + { + strupr(LineBuffer); + if (strstr(&LineBuffer[7],"OFF") != NULL) + ae->SysFlags |= SYS_SOLID_FLOOR; + else + { + ae->SysFlags &= ~SYS_SOLID_FLOOR; + } + break; + } - if (!strnicmp(LineBuffer,"RESOLUTION:",11)) - { - Resolution = atoi(&LineBuffer[11]); - break; - } + if (!strnicmp(LineBuffer,"RESOLUTION:",11)) + { + Resolution = atoi(&LineBuffer[11]); + break; + } - if (!strnicmp(LineBuffer,"LOADTYPE:",9)) - { - ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM - break; - } + if (!strnicmp(LineBuffer,"LOADTYPE:",9)) + { + ae->bmLoadType = atoi(&LineBuffer[9]); // Sets for GIF or BBM + break; + } - break; + break; - } + } } if (!result) { - result = AckCreateObject(ae,0); // Create a dummy object for later + result = AckCreateObject(ae,0); // Create a dummy object for later if (!result) - ae->ObjList[0]->Active = 0; // Turn off checking the object + ae->ObjList[0]->Active = 0; // Turn off checking the object } printf("done\n"); @@ -1058,7 +1058,7 @@ return(result); //============================================================================= void ShowBitmap(short x,short y,UCHAR *dst,short ht,short wt,UCHAR *bm) { - int offset,col; + int offset,col; short endy; UCHAR ch; @@ -1069,23 +1069,23 @@ endy = ae->WinEndY + 2; while (ht-- > 0 && y++ <= endy) { for (col = 0; col < wt; col++) - { - ch = *bm++; - if (ch) - dst[col] = ch; - } + { + ch = *bm++; + if (ch) + dst[col] = ch; + } dst += 320; } } -#define FONT_RESOURCE 52 +#define FONT_RESOURCE 52 - UCHAR *Fonts[256]; - short MaxWt; - short MaxHt; - short FontSize; - UCHAR FontColorTable[16]; + UCHAR *Fonts[256]; + short MaxWt; + short MaxHt; + short FontSize; + UCHAR FontColorTable[16]; //============================================================================= // @@ -1115,7 +1115,7 @@ for (i = 0; i < 256; i++) { Fonts[i] = AckMalloc(FontSize); if (Fonts[i] == NULL) - break; + break; read(rsHandle,Fonts[i],FontSize); } @@ -1142,7 +1142,7 @@ Video += offset; for (row = 0; row < MaxHt; row++) { for (col = 0; col < MaxWt; col++) - Video[col] = FontColorTable[*fPtr++]; + Video[col] = FontColorTable[*fPtr++]; Video += 320; } @@ -1164,14 +1164,14 @@ while (*s) { ch = *s++; if (ch == 13) - { - x = cx; - cy += MaxHt; - continue; - } + { + x = cx; + cy += MaxHt; + continue; + } if (ch < ' ') - continue; + continue; WriteChar(x,y,ch); x += MaxWt; @@ -1291,9 +1291,9 @@ if (i) { printf("Error reading INF file.\n"); if (i > 100 && i < 121) - printf("Last error was %s\n",ErrorMsgs[i-100]); + printf("Last error was %s\n",ErrorMsgs[i-100]); else - printf("Error code: %d\n",i); + printf("Error code: %d\n",i); printf("Line was: \"%s\"\n",LineBuffer); @@ -1344,10 +1344,10 @@ return(0); //============================================================================= int LoadBackDrop(void) { - int result; - int i,j,pos; - UCHAR *bPtr; - UCHAR *aPtr; + int result; + int i,j,pos; + UCHAR *bPtr; + UCHAR *aPtr; result = 0; @@ -1357,36 +1357,36 @@ if (ResScrollBack) bPtr = AckReadiff((char *)ResScrollBack); printf("Processing background image.\n"); if (bPtr != NULL) - { - for (i = 0; i < 320; i++) - { - pos = i + 4; - aPtr = BackArray[i]; - for (j = 0; j < 100; j++) - { - *aPtr++ = bPtr[pos]; - pos += 320; - } - } + { + for (i = 0; i < 320; i++) + { + pos = i + 4; + aPtr = BackArray[i]; + for (j = 0; j < 100; j++) + { + *aPtr++ = bPtr[pos]; + pos += 320; + } + } - for (i = 320; i < 640; i++) - { - pos = (i - 320) + 32004; - aPtr = BackArray[i]; - for (j = 0; j < 100; j++) - { - *aPtr++ = bPtr[pos]; - pos += 320; - } - } + for (i = 320; i < 640; i++) + { + pos = (i - 320) + 32004; + aPtr = BackArray[i]; + for (j = 0; j < 100; j++) + { + *aPtr++ = bPtr[pos]; + pos += 320; + } + } - AckFree(bPtr); - } + AckFree(bPtr); + } else - { - printf("Unable to load background image.\n"); - result = 8; - } + { + printf("Unable to load background image.\n"); + result = 8; + } } return(result); @@ -1397,8 +1397,8 @@ return(result); //============================================================================= void ShowHit(void) { - int x,y,result,wNum; - int flag; + int x,y,result,wNum; + int flag; short oNum,mPos; ae->ObjList[0]->x = ae->xPlayer; @@ -1413,31 +1413,31 @@ while (wNum--) result = AckMoveObjectPOV(0,ae->PlayerAngle,12); if (result == POV_OBJECT) - { - flag = 1; - oNum = AckGetObjectHit(); - break; - } + { + flag = 1; + oNum = AckGetObjectHit(); + break; + } if (result == POV_XWALL) - { - flag = 2; - oNum = ae->xGrid[AckGetWallHit()]; - if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) - flag = 4; - oNum &= 0xFF; - break; - } + { + flag = 2; + oNum = ae->xGrid[AckGetWallHit()]; + if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) + flag = 4; + oNum &= 0xFF; + break; + } if (result == POV_YWALL) - { - flag = 3; - oNum = ae->yGrid[AckGetWallHit()]; - if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) - flag = 4; - oNum &= 0xFF; - break; - } + { + flag = 3; + oNum = ae->yGrid[AckGetWallHit()]; + if (oNum & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)) + flag = 4; + oNum &= 0xFF; + break; + } } @@ -1446,28 +1446,28 @@ if (flag) mPos = (ae->ObjList[0]->y & 0xFFC0) + (ae->ObjList[0]->x >> 6); switch (flag) - { + { - case 1: - sprintf(LineBuffer,"Object %d hit\nat location %d",oNum,mPos); - break; + case 1: + sprintf(LineBuffer,"Object %d hit\nat location %d",oNum,mPos); + break; - case 2: - sprintf(LineBuffer,"Xwall %d hit\nat location %d",oNum,mPos); - break; + case 2: + sprintf(LineBuffer,"Xwall %d hit\nat location %d",oNum,mPos); + break; - case 3: - sprintf(LineBuffer,"Ywall %d hit\nat location %d",oNum,mPos); - break; + case 3: + sprintf(LineBuffer,"Ywall %d hit\nat location %d",oNum,mPos); + break; - case 4: - sprintf(LineBuffer,"Door %d hit\nat location %d",oNum,mPos); - break; + case 4: + sprintf(LineBuffer,"Door %d hit\nat location %d",oNum,mPos); + break; - default: - *LineBuffer = '\0'; - break; - } + default: + *LineBuffer = '\0'; + break; + } ShowHitFlag = 1; } @@ -1494,25 +1494,25 @@ j = AckMoveObjectPOV(99,ae->ObjList[99]->Dir,ae->ObjList[99]->Speed); if (j > 0 && j != POV_PLAYER) { if (j != POV_OBJECT) - { - ae->ObjList[99]->Active = 0; - Shooting = 0; - return; - } + { + ae->ObjList[99]->Active = 0; + Shooting = 0; + return; + } j = AckGetObjectHit(); if (j > 4 && j < 13) - { - if (ae->ObjList[j]->CurrentType == NO_WALK) - { - AckSetObjectType(ae,j,NO_INTERACT); - ObjCounter[j] = TimerCounter + 18 + (rand() % 120); - } - } + { + if (ae->ObjList[j]->CurrentType == NO_WALK) + { + AckSetObjectType(ae,j,NO_INTERACT); + ObjCounter[j] = TimerCounter + 18 + (rand() % 120); + } + } if (j == 51) - ae->ObjList[j]->Active = 0; + ae->ObjList[j]->Active = 0; ae->ObjList[99]->Active = 0; Shooting = 0; @@ -1525,9 +1525,9 @@ if (j > 0 && j != POV_PLAYER) //============================================================================= void CheckMonsters(void) { - int i,tFlag,xp,yp; - int pMap,oMap,oRow,oCol; - int row,col,offset; + int i,tFlag,xp,yp; + int pMap,oMap,oRow,oCol; + int row,col,offset; long dx,dy,dx2,dy2,dist; short cType; UCHAR oFlags; @@ -1542,75 +1542,75 @@ i = 5; while (1) { if (ae->ObjList[i]->Active) - { - oFlags = ae->ObjList[i]->Flags; - cType = ae->ObjList[i]->CurrentType; - dx = xp - ae->ObjList[i]->x; - dy = yp - ae->ObjList[i]->y; + { + oFlags = ae->ObjList[i]->Flags; + cType = ae->ObjList[i]->CurrentType; + dx = xp - ae->ObjList[i]->x; + dy = yp - ae->ObjList[i]->y; - dx2 = dx * dx; - dy2 = dy * dy; - if ((dx2+dy2) < 128000) - { - ae->ObjList[i]->Dir = AckGetObjectAngle(dx,dy); - if (cType == NO_WALK) - { - ae->ObjList[i]->Flags |= OF_ANIMATE; - oFlags |= OF_ANIMATE; - } + dx2 = dx * dx; + dy2 = dy * dy; + if ((dx2+dy2) < 128000) + { + ae->ObjList[i]->Dir = AckGetObjectAngle(dx,dy); + if (cType == NO_WALK) + { + ae->ObjList[i]->Flags |= OF_ANIMATE; + oFlags |= OF_ANIMATE; + } - if (cType == NO_CREATE && !(oFlags & OF_ANIMATE)) - { - if (i < 50) - { - ae->ObjList[i]->Flags |= OF_ANIMATE; - oFlags |= OF_ANIMATE; - } - else - AckSetObjectType(ae,i,NO_WALK); - } + if (cType == NO_CREATE && !(oFlags & OF_ANIMATE)) + { + if (i < 50) + { + ae->ObjList[i]->Flags |= OF_ANIMATE; + oFlags |= OF_ANIMATE; + } + else + AckSetObjectType(ae,i,NO_WALK); + } - } + } - if (cType == NO_WALK && (oFlags & OF_ANIMATE)) - { - tFlag = AckMoveObjectPOV(i,ae->ObjList[i]->Dir,8); - oRow = ae->ObjList[i]->Dir / INT_ANGLE_90; - switch (tFlag) - { - case POV_PLAYER: - StrAmount--; - if (StrAmount < 0) StrAmount = 0; - ShowStatus(); - break; + if (cType == NO_WALK && (oFlags & OF_ANIMATE)) + { + tFlag = AckMoveObjectPOV(i,ae->ObjList[i]->Dir,8); + oRow = ae->ObjList[i]->Dir / INT_ANGLE_90; + switch (tFlag) + { + case POV_PLAYER: + StrAmount--; + if (StrAmount < 0) StrAmount = 0; + ShowStatus(); + break; - case POV_NOTHING: - break; + case POV_NOTHING: + break; - case POV_SLIDEX: - if (oRow > 1) ae->ObjList[i]->Dir = INT_ANGLE_270; - else ae->ObjList[i]->Dir = INT_ANGLE_90; - break; + case POV_SLIDEX: + if (oRow > 1) ae->ObjList[i]->Dir = INT_ANGLE_270; + else ae->ObjList[i]->Dir = INT_ANGLE_90; + break; - case POV_SLIDEY: - if (oRow > 0 && oRow < 3) - ae->ObjList[i]->Dir = INT_ANGLE_180; - else - ae->ObjList[i]->Dir = 0; - break; + case POV_SLIDEY: + if (oRow > 0 && oRow < 3) + ae->ObjList[i]->Dir = INT_ANGLE_180; + else + ae->ObjList[i]->Dir = 0; + break; - case POV_OBJECT: - ae->ObjList[i]->Dir = rand() % INT_ANGLE_360; - break; + case POV_OBJECT: + ae->ObjList[i]->Dir = rand() % INT_ANGLE_360; + break; - default: - if (i < 50) - ae->ObjList[i]->Flags &= ~OF_ANIMATE; - break; + default: + if (i < 50) + ae->ObjList[i]->Flags &= ~OF_ANIMATE; + break; - } - } - } + } + } + } i++; if (i == 13) i = 51; @@ -1627,7 +1627,7 @@ void ShowStatus(void) #if 0 UCHAR *Video; - int row,offset,rlen,glen; + int row,offset,rlen,glen; offset = (163 * 320) + 34; @@ -1640,9 +1640,9 @@ Video += offset; for (row = 0; row < 11; row++) { if (glen) - memset(Video,105,glen); + memset(Video,105,glen); if (rlen) - memset(&Video[glen],39,rlen); + memset(&Video[glen],39,rlen); Video += 320; } @@ -1657,9 +1657,9 @@ Video += offset; for (row = 0; row < 11; row++) { if (glen) - memset(Video,105,glen); + memset(Video,105,glen); if (rlen) - memset(&Video[glen],39,rlen); + memset(&Video[glen],39,rlen); Video += 320; } @@ -1714,24 +1714,24 @@ for (xpos = 0; xpos < NumCols; xpos++) d1 = (d2>>16); while (yposLow > 0 && vPtr > VidOrg) - { - *vPtr = bmp[bmPos+yposLow]; - vPtr -= 320; - ypos -= d1; - yposLow = ypos >> 8; - } + { + *vPtr = bmp[bmPos+yposLow]; + vPtr -= 320; + ypos -= d1; + yposLow = ypos >> 8; + } vPtr = Video + 320; ypos = 0x2000; yposLow = 0x20; while (yposLow < 64 && vPtr < VidEnd) - { - *vPtr = bmp[bmPos+yposLow]; - vPtr += 320; - ypos += d1; - yposLow = ypos >> 8; - } + { + *vPtr = bmp[bmPos+yposLow]; + vPtr += 320; + ypos += d1; + yposLow = ypos >> 8; + } d2 += htStep; bmCol += bmColStep; @@ -1746,7 +1746,7 @@ for (xpos = 0; xpos < NumCols; xpos++) //============================================================================= void ClsBmpBox(int x1,int y1,int x2,int y2) { - int offset,wt; + int offset,wt; UCHAR *Video; Video = (UCHAR *)0xA0000; @@ -1772,15 +1772,15 @@ short main(void) char ch; MOUSE mouse; UCHAR *Video; - int Spin,MoveAmount; - int SpinAngle,MoveAngle; + int Spin,MoveAmount; + int SpinAngle,MoveAngle; long TimerEnd; short DemoFlag; short lpx,lpy,lpa; - int StartTime,EndTime,InfoFlag; - int CkStart,CkEnd; - int TurnFactor,MoveFactor,MoveHalfFactor; - int HandX,HandY,HandDY; + int StartTime,EndTime,InfoFlag; + int CkStart,CkEnd; + int TurnFactor,MoveFactor,MoveHalfFactor; + int HandX,HandY,HandDY; long x1,y1; if ((done = Initialize()) != 0) @@ -1799,7 +1799,7 @@ _dos_setvect(KEYBD,myInt); oldTimer=_dos_getvect(8); _dos_setvect(8,myTimer); AckTmDelay = 3; -AckSpeedUp(AckTmDelay); // Set the timer interrupt at 3 times normal +AckSpeedUp(AckTmDelay); // Set the timer interrupt at 3 times normal ReadConfigFile(); StartBGmusic(); @@ -1842,7 +1842,7 @@ MoveFactor = 3 * EndTime; MoveHalfFactor = MoveFactor >> 1; StartTime = clock(); -EndTime = StartTime; +EndTime = StartTime; InfoFlag = 0; HandX = 134; @@ -1854,221 +1854,221 @@ while (!done) { if (SpinAngle) - { - ae->PlayerAngle += SpinAngle; - if (ae->PlayerAngle >= INT_ANGLE_360) - ae->PlayerAngle -= INT_ANGLE_360; - if (ae->PlayerAngle < 0) - ae->PlayerAngle += INT_ANGLE_360; + { + ae->PlayerAngle += SpinAngle; + if (ae->PlayerAngle >= INT_ANGLE_360) + ae->PlayerAngle -= INT_ANGLE_360; + if (ae->PlayerAngle < 0) + ae->PlayerAngle += INT_ANGLE_360; - SpinAngle >>= 3; - if (SpinAngle == -1) SpinAngle = 0; - } + SpinAngle >>= 3; + if (SpinAngle == -1) SpinAngle = 0; + } if (MoveAmount) - { + { #if 0 - HandY += HandDY; - if (HandY < 125) HandDY = 2; - if (HandY > 132) HandDY = -2; + HandY += HandDY; + if (HandY < 125) HandDY = 2; + if (HandY > 132) HandDY = -2; #endif - j = AckMovePOV(MoveAngle,MoveAmount); - AckCheckDoorOpen(ae->xPlayer,ae->yPlayer,MoveAngle); - MoveAmount >>= 1; + j = AckMovePOV(MoveAngle,MoveAmount); + AckCheckDoorOpen(ae->xPlayer,ae->yPlayer,MoveAngle); + MoveAmount >>= 1; #if 0 - if (j == POV_OBJECT) - { - j = AckGetObjectHit(); + if (j == POV_OBJECT) + { + j = AckGetObjectHit(); - if (j > 4 && j < 13) - { - StrAmount--; - if (StrAmount < 0) - StrAmount = 0; + if (j > 4 && j < 13) + { + StrAmount--; + if (StrAmount < 0) + StrAmount = 0; - ShowStatus(); - } + ShowStatus(); + } - if (j >= 36 && j <= 49) - { - ae->ObjList[j]->Active = 0; - MagAmount += 4; - if (MagAmount > MAX_MAG_AMOUNT) - MagAmount = MAX_MAG_AMOUNT; - ShowStatus(); - } + if (j >= 36 && j <= 49) + { + ae->ObjList[j]->Active = 0; + MagAmount += 4; + if (MagAmount > MAX_MAG_AMOUNT) + MagAmount = MAX_MAG_AMOUNT; + ShowStatus(); + } - if (j == 50 && ae->ObjList[50]->CurrentType == NO_CREATE) - { - AckSetObjectType(ae,j,NO_WALK); - StrAmount = MAX_STR_AMOUNT; - ShowStatus(); - } + if (j == 50 && ae->ObjList[50]->CurrentType == NO_CREATE) + { + AckSetObjectType(ae,j,NO_WALK); + StrAmount = MAX_STR_AMOUNT; + ShowStatus(); + } - } + } #endif - } + } #if 0 else - { - if (HandY < 132) - HandY++; - } + { + if (HandY < 132) + HandY++; + } #endif - AckCheckObjectMovement(); // Animate objects if needed + AckCheckObjectMovement(); // Animate objects if needed for (j = 5; j < 13; j++) - { - if (ae->ObjList[j]->Flags & OF_ANIMDONE && - ae->ObjList[j]->CurrentType == NO_DESTROY) - { - AckSetObjectType(ae,j,NO_CREATE); - ae->ObjList[j]->Flags &= ~OF_ANIMDONE; - ae->ObjList[j]->Flags &= ~OF_ANIMATE; - ae->ObjList[j]->Active = 0; - } + { + if (ae->ObjList[j]->Flags & OF_ANIMDONE && + ae->ObjList[j]->CurrentType == NO_DESTROY) + { + AckSetObjectType(ae,j,NO_CREATE); + ae->ObjList[j]->Flags &= ~OF_ANIMDONE; + ae->ObjList[j]->Flags &= ~OF_ANIMATE; + ae->ObjList[j]->Active = 0; + } - if (ae->ObjList[j]->Flags & OF_ANIMDONE && - ae->ObjList[j]->CurrentType != NO_WALK) - { - AckSetObjectType(ae,j,NO_WALK); - ae->ObjList[j]->Flags &= ~OF_ANIMDONE; - ObjCounter[j] = TimerCounter + 18 + (rand() % 120); - } + if (ae->ObjList[j]->Flags & OF_ANIMDONE && + ae->ObjList[j]->CurrentType != NO_WALK) + { + AckSetObjectType(ae,j,NO_WALK); + ae->ObjList[j]->Flags &= ~OF_ANIMDONE; + ObjCounter[j] = TimerCounter + 18 + (rand() % 120); + } - if (TimerCounter > ObjCounter[j]) - { - ObjCounter[j] = TimerCounter + 180 + (rand() % 180); - if (ae->ObjList[j]->CurrentType == NO_WALK) - AckSetObjectType(ae,j,NO_ATTACK); - else - { - if (ae->ObjList[j]->CurrentType == NO_INTERACT) - AckSetObjectType(ae,j,NO_DESTROY); + if (TimerCounter > ObjCounter[j]) + { + ObjCounter[j] = TimerCounter + 180 + (rand() % 180); + if (ae->ObjList[j]->CurrentType == NO_WALK) + AckSetObjectType(ae,j,NO_ATTACK); + else + { + if (ae->ObjList[j]->CurrentType == NO_INTERACT) + AckSetObjectType(ae,j,NO_DESTROY); - } - } - } + } + } + } if (Shooting) - UpdateBlast(); + UpdateBlast(); CheckMonsters(); CkStart = TimerCounter; - AckBuildView(); // Build floor, ceiling, and walls into ScrnBuffer + AckBuildView(); // Build floor, ceiling, and walls into ScrnBuffer #if 0 if (DemoFlag) - { - switch (DemoFlag) - { - case 1: - if (TimerCounter > TimerEnd) - { - DemoFlag++; - TimerEnd = TimerCounter + 540; - } - break; + { + switch (DemoFlag) + { + case 1: + if (TimerCounter > TimerEnd) + { + DemoFlag++; + TimerEnd = TimerCounter + 540; + } + break; - case 2: - ShowBitmap(130,20,ae->ScreenBuffer,Demoht,Demowt,&DemoPtr[4]); - if (TimerCounter > TimerEnd) - { - DemoFlag = 1; - TimerEnd = TimerCounter + 2160; - } - break; + case 2: + ShowBitmap(130,20,ae->ScreenBuffer,Demoht,Demowt,&DemoPtr[4]); + if (TimerCounter > TimerEnd) + { + DemoFlag = 1; + TimerEnd = TimerCounter + 2160; + } + break; - default: - break; - } + default: + break; + } - } + } switch (Throwing) - { - case 0: - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); - break; + { + case 0: + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); + break; - case 1: - HandY -= 20; - if (HandY < 97) - { - HandY = 97; - Throwing++; - } - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); - break; + case 1: + HandY -= 20; + if (HandY < 97) + { + HandY = 97; + Throwing++; + } + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); + break; - case 2: - HandY -= 5; - Throwing++; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); - break; + case 2: + HandY -= 5; + Throwing++; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); + break; - case 3: - ae->ObjList[99]->Active = 1; - ae->ObjList[99]->x = ae->xPlayer; - ae->ObjList[99]->y = ae->yPlayer; - ae->ObjList[99]->Dir = ae->PlayerAngle; - ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; - AckSetObjectType(ae,99,NO_CREATE); - Shooting = 1; - MagAmount--; - ShowStatus(); - Throwing++; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); - break; + case 3: + ae->ObjList[99]->Active = 1; + ae->ObjList[99]->x = ae->xPlayer; + ae->ObjList[99]->y = ae->yPlayer; + ae->ObjList[99]->Dir = ae->PlayerAngle; + ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; + AckSetObjectType(ae,99,NO_CREATE); + Shooting = 1; + MagAmount--; + ShowStatus(); + Throwing++; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); + break; - case 4: - HandY += 5; - Throwing++; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); - break; + case 4: + HandY += 5; + Throwing++; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh2,Handw2,&pHand2[4]); + break; - case 5: - HandY += 20; - if (HandY > 132) - Throwing = 0; - ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); - break; + case 5: + HandY += 20; + if (HandY > 132) + Throwing = 0; + ShowBitmap(HandX,HandY,ae->ScreenBuffer,Handh1,Handw1,&pHand1[4]); + break; - default: - break; - } + default: + break; + } if (InfoFlag) - { - EndTime = clock(); - if (EndTime > StartTime+100 ) - { - StartTime = EndTime; - cframes = framespersec; - framespersec = 0; - } + { + EndTime = clock(); + if (EndTime > StartTime+100 ) + { + StartTime = EndTime; + cframes = framespersec; + framespersec = 0; + } - sprintf(LineBuffer,"FPS: %6ld,%d,%d,%d", - (long)cframes,ae->xPlayer,ae->yPlayer,ae->PlayerAngle); - smWriteHUD(10,20,32,LineBuffer); - framespersec++; - } + sprintf(LineBuffer,"FPS: %6ld,%d,%d,%d", + (long)cframes,ae->xPlayer,ae->yPlayer,ae->PlayerAngle); + smWriteHUD(10,20,32,LineBuffer); + framespersec++; + } if (ShowHitFlag) - smWriteHUD(10,10,32,LineBuffer); + smWriteHUD(10,10,32,LineBuffer); #endif - AckDisplayScreen(); // Copy ScrnBuffer to actual video + AckDisplayScreen(); // Copy ScrnBuffer to actual video CkEnd = TimerCounter - CkStart; if (!CkEnd) CkEnd = 1; @@ -2080,205 +2080,205 @@ while (!done) i = (ae->yPlayer & 0xFFC0) + (ae->xPlayer >> 6); if (FloorMap[i] == 0x28) - { - StrAmount--; - if (StrAmount < 1) - break; - ShowStatus(); - } + { + StrAmount--; + if (StrAmount < 1) + break; + ShowStatus(); + } #endif CheckMouse(&mouse); #if 0 if (mouse.mButtons & 1) - { - if (!(ae->ObjList[99]->Active) && MagAmount > 0 && !Throwing) - { - Throwing = 1; - #if 0 - ae->ObjList[99]->Active = 1; - ae->ObjList[99]->x = ae->xPlayer; - ae->ObjList[99]->y = ae->yPlayer; - ae->ObjList[99]->Dir = ae->PlayerAngle; - ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; - AckSetObjectType(ae,99,NO_CREATE); - Shooting = 1; - MagAmount--; - ShowStatus(); - #endif - } - } + { + if (!(ae->ObjList[99]->Active) && MagAmount > 0 && !Throwing) + { + Throwing = 1; + #if 0 + ae->ObjList[99]->Active = 1; + ae->ObjList[99]->x = ae->xPlayer; + ae->ObjList[99]->y = ae->yPlayer; + ae->ObjList[99]->Dir = ae->PlayerAngle; + ae->ObjList[99]->mPos = (ae->yPlayer & 0xFFC0) + ae->xPlayer >> 6; + AckSetObjectType(ae,99,NO_CREATE); + Shooting = 1; + MagAmount--; + ShowStatus(); + #endif + } + } #endif if (mouse.mButtons & 2) - { - MoveAmount += MoveFactor; // 16; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = ae->PlayerAngle; - } + { + MoveAmount += MoveFactor; // 16; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = ae->PlayerAngle; + } if (mouse.mdx < 0) - { - Spin = -mouse.mdx; - Spin >>= 5; - SpinAngle = -TurnFactor * Spin; // -INT_ANGLE_1 * Spin; - Spin = 1; - } + { + Spin = -mouse.mdx; + Spin >>= 5; + SpinAngle = -TurnFactor * Spin; // -INT_ANGLE_1 * Spin; + Spin = 1; + } if (mouse.mdx > 0) - { - Spin = mouse.mdx; - Spin >>= 5; - SpinAngle = TurnFactor * Spin; // INT_ANGLE_1 * Spin; - Spin = 1; - } + { + Spin = mouse.mdx; + Spin >>= 5; + SpinAngle = TurnFactor * Spin; // INT_ANGLE_1 * Spin; + Spin = 1; + } if (mouse.mdy < 0) - { - i = -mouse.mdy; - i >>= 2; - i += MoveHalfFactor; - MoveAmount += i; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = ae->PlayerAngle; - } + { + i = -mouse.mdy; + i >>= 2; + i += MoveHalfFactor; + MoveAmount += i; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = ae->PlayerAngle; + } if (mouse.mdy > 20) - { - i = mouse.mdy; - i >>= 3; - i += MoveHalfFactor; - j = ae->PlayerAngle + INT_ANGLE_180; - if (j >= INT_ANGLE_360) - j -= INT_ANGLE_360; + { + i = mouse.mdy; + i >>= 3; + i += MoveHalfFactor; + j = ae->PlayerAngle + INT_ANGLE_180; + if (j >= INT_ANGLE_360) + j -= INT_ANGLE_360; - MoveAmount += i; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = j; - } + MoveAmount += i; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = j; + } if (Keys[ESCAPE_KEY]) - break; + break; if(Keys[RIGHT_ARROW_KEY]) - { - Spin += 1; - SpinAngle += TurnFactor; // INT_ANGLE_1 * Spin; - } + { + Spin += 1; + SpinAngle += TurnFactor; // INT_ANGLE_1 * Spin; + } if(Keys[LEFT_ARROW_KEY]) - { - Spin += 1; - SpinAngle -= TurnFactor; // -INT_ANGLE_1 * Spin; - } + { + Spin += 1; + SpinAngle -= TurnFactor; // -INT_ANGLE_1 * Spin; + } if(Keys[UP_ARROW_KEY]) - { - MoveAmount += (MoveFactor + MoveHalfFactor); // 12; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = ae->PlayerAngle; - } + { + MoveAmount += (MoveFactor + MoveHalfFactor); // 12; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = ae->PlayerAngle; + } if(Keys[DOWN_ARROW_KEY]) - { - j = ae->PlayerAngle + INT_ANGLE_180; - if (j >= INT_ANGLE_360) - j -= INT_ANGLE_360; + { + j = ae->PlayerAngle + INT_ANGLE_180; + if (j >= INT_ANGLE_360) + j -= INT_ANGLE_360; - MoveAmount += (MoveFactor + MoveHalfFactor); // 12; - if (MoveAmount > MAX_AMOUNT) - MoveAmount = MAX_AMOUNT; - MoveAngle = j; - } + MoveAmount += (MoveFactor + MoveHalfFactor); // 12; + if (MoveAmount > MAX_AMOUNT) + MoveAmount = MAX_AMOUNT; + MoveAngle = j; + } #if 0 if (Keys[C_KEY]) - { - ae->SysFlags ^= SYS_SOLID_CEIL; - ae->SysFlags &= ~SYS_SOLID_BACK; - Keys[C_KEY] = 0; + { + ae->SysFlags ^= SYS_SOLID_CEIL; + ae->SysFlags &= ~SYS_SOLID_BACK; + Keys[C_KEY] = 0; - if ((ae->SysFlags & SYS_SOLID_CEIL) && (ResScrollBack != 0)) - ae->SysFlags |= SYS_SOLID_BACK; - AckRegisterStructure(ae); - } + if ((ae->SysFlags & SYS_SOLID_CEIL) && (ResScrollBack != 0)) + ae->SysFlags |= SYS_SOLID_BACK; + AckRegisterStructure(ae); + } if (Keys[R_KEY]) - { - Keys[R_KEY] = 0; - Resolution++; - if (Resolution > 2) - Resolution = 0; - } + { + Keys[R_KEY] = 0; + Resolution++; + if (Resolution > 2) + Resolution = 0; + } if (Keys[F_KEY]) - { - ae->SysFlags ^= SYS_SOLID_FLOOR; - Keys[F_KEY] = 0; - AckRegisterStructure(ae); - } + { + ae->SysFlags ^= SYS_SOLID_FLOOR; + Keys[F_KEY] = 0; + AckRegisterStructure(ae); + } if (Keys[PGUP_KEY] && ViewHeight < 60) - { - ViewHeight++; - CeilingHeight++; - } + { + ViewHeight++; + CeilingHeight++; + } if (Keys[PGDN_KEY] && ViewHeight > 4) - { - ViewHeight--; - CeilingHeight--; - } + { + ViewHeight--; + CeilingHeight--; + } if (Keys[NUM_1_KEY]) - { - Keys[NUM_1_KEY]=0; - dFactor--; - } + { + Keys[NUM_1_KEY]=0; + dFactor--; + } if (Keys[NUM_2_KEY]) - { - Keys[NUM_2_KEY]=0; - dFactor++; - } + { + Keys[NUM_2_KEY]=0; + dFactor++; + } if (Keys[MINUS_KEY]) - { - Keys[MINUS_KEY]=0; - mFactor--; - } + { + Keys[MINUS_KEY]=0; + mFactor--; + } if (Keys[PLUS_KEY]) - { - Keys[PLUS_KEY]=0; - mFactor++; - } + { + Keys[PLUS_KEY]=0; + mFactor++; + } if (Keys[I_KEY]) - { - Keys[I_KEY] = 0; - InfoFlag ^= 1; - } + { + Keys[I_KEY] = 0; + InfoFlag ^= 1; + } if (Keys[B_KEY]) - { - Keys[B_KEY]=0; - mFactor -= 64; - } + { + Keys[B_KEY]=0; + mFactor -= 64; + } if (Keys[S_KEY]) - { - Keys[S_KEY] = 0; - mFactor += 64; - } + { + Keys[S_KEY] = 0; + mFactor += 64; + } #endif @@ -2287,7 +2287,7 @@ while (!done) EndBGmusic(); ShutDownFlag = 1; _disable(); -AckSlowDown(); // Set the timer back to normal speed +AckSlowDown(); // Set the timer back to normal speed AckWrapUp(ae); AckSetTextmode(); _dos_setvect(KEYBD,oldvec); @@ -2300,4 +2300,3 @@ if (kbhit()) return(0); } - \ No newline at end of file diff --git a/mall/MODPLAY.ASM b/mall/MODPLAY.ASM index 808c7cf..6b3fc89 100644 --- a/mall/MODPLAY.ASM +++ b/mall/MODPLAY.ASM @@ -1,10 +1,10 @@ ;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² -; Tiny MOD Player for Watcom C/C++32 and DOS/4GW +; Tiny MOD Player for Watcom C/C++32 and DOS/4GW ; Version 2.02a  May 09th, 1994 ; ; Copyright 1993,94 Carlos Hasan ;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² - + ideal p386 model flat,c @@ -16,13 +16,13 @@ jumps global MODPlayModule:near global MODStopModule:near -global MODPlaySample:near -global MODPlayVoice:near -global MODStopVoice:near -global MODSetPeriod:near -global MODSetVolume:near +global MODPlaySample:near +global MODPlayVoice:near +global MODStopVoice:near +global MODSetPeriod:near +global MODSetVolume:near ;;global _GETDS:near -global OurDataSeg:dword +global OurDataSeg:dword ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; EQUATES @@ -46,32 +46,32 @@ RepLength dw ? ends MODSample struc MODHeader ; file header -SongName db 20 dup (?) +SongName db 20 dup (?) Samples MODSample 31 dup (?) OrderLen db ? -ReStart db ? -Order db 128 dup (?) -Sign dd ? -ends MODHeader +ReStart db ? +Order db 128 dup (?) +Sign dd ? +ends MODHeader ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ; MOD Player structures ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± -struc Voice -Address dd ?,? ; Current Address -StartAddress dd ? ; Loop Start Address -EndAddress dd ? ; Loop End Address -Frequency dd ? ; Frequency -Volume db ?,? ; Volume -ends Voice +struc Voice +Address dd ?,? ; Current Address +StartAddress dd ? ; Loop Start Address +EndAddress dd ? ; Loop End Address +Frequency dd ? ; Frequency +Volume db ?,? ; Volume +ends Voice -struc Track -Period dw ? ; Note Period -Instr db ? ; Instr Number -Volume db ? ; Volume -Effect dw ? ; Effect -ends Track +struc Track +Period dw ? ; Note Period +Instr db ? ; Instr Number +Volume db ? ; Volume +Effect dw ? ; Effect +ends Track struc Sample Period dw ? ; Default Period @@ -94,7 +94,7 @@ IRQVector df ? ; IRQ Saved Vector BufSelector dw ? ; DPMI Buffer Selector VolBuffer dd ? ; Volume Buffer Address -DMABuffer dd ? ; DMA Buffer Address +DMABuffer dd ? ; DMA Buffer Address DMALength dw ? ; DMA Buffer Length BufferPos dw ? ; Current Buffer Position @@ -118,9 +118,9 @@ OrderLen db ? ; Order Length PatternRow db ? ; Pattern Row OrderList db 128 dup (?) ; Order List PatternPtr dd ? ; Current Pattern Address -Tempo db ? ; Tempo +Tempo db ? ; Tempo TempoCount db ? ; Tempo Internal Counter -BPM db ? ; BPM value +BPM db ? ; BPM value ActiveTracks dw ? ; Number of Active Tracks Tracks Track MAXVOICES dup (?) ; Array of Tracks @@ -145,61 +145,61 @@ codeseg ; In: ; Song = Modulefile address ; Chans = Number of channels -; Rate = Sampling Rate -; Port = I/O Port -; IRQ = IRQ Level -; DRQ = DRQ Channel +; Rate = Sampling Rate +; Port = I/O Port +; IRQ = IRQ Level +; DRQ = DRQ Channel ; Out: -; EAX = status +; EAX = status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword - pushad - mov edi,[Song] ; Load parameters from stack - mov eax,[Chans] - mov [ActiveVoices],ax - mov eax,[Rate] - mov [SBRate],ax - mov eax,[Port] - mov [IOAddr],ax - mov eax,[IRQ] - mov [IRQNum],al - mov eax,[DRQ] - mov [DRQNum],al - mov eax,MIDCRATE*428 ; setup frequency divisor - xor edx,edx - shld edx,eax,16 - shl eax,16 - movzx ebx,[SBRate] - div ebx - mov [FreqDivisor],eax - call MODSetup ; setup MOD player stuff - jc MODPlayDone - call MCInit ; setup the muti-channel stuff - jc MODPlayDone - mov dl,[BPM] ; setup the multi-channel timer - call MCStartTimer - call DMASetBuf ; setup DMA controller - call IRQSetVect ; setup PIC interrupt - call SBOpenDevice ; setup SB for playback - jnc MODPlayDone - call MODStopModule +proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword + pushad + mov edi,[Song] ; Load parameters from stack + mov eax,[Chans] + mov [ActiveVoices],ax + mov eax,[Rate] + mov [SBRate],ax + mov eax,[Port] + mov [IOAddr],ax + mov eax,[IRQ] + mov [IRQNum],al + mov eax,[DRQ] + mov [DRQNum],al + mov eax,MIDCRATE*428 ; setup frequency divisor + xor edx,edx + shld edx,eax,16 + shl eax,16 + movzx ebx,[SBRate] + div ebx + mov [FreqDivisor],eax + call MODSetup ; setup MOD player stuff + jc MODPlayDone + call MCInit ; setup the muti-channel stuff + jc MODPlayDone + mov dl,[BPM] ; setup the multi-channel timer + call MCStartTimer + call DMASetBuf ; setup DMA controller + call IRQSetVect ; setup PIC interrupt + call SBOpenDevice ; setup SB for playback + jnc MODPlayDone + call MODStopModule MODPlayDone: - popad - sbb eax,eax ; return status in EAX - ret + popad + sbb eax,eax ; return status in EAX + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; MODStopModule - Stop playing the current modulefile ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODStopModule - pushad - call SBCloseDevice ; done SB playback - call IRQRestVect ; done PIC interrupt - call DMAReset ; done DMA controller - call MCDone ; done multi-channel stuff - popad - ret +proc MODStopModule + pushad + call SBCloseDevice ; done SB playback + call IRQRestVect ; done PIC interrupt + call DMAReset ; done DMA controller + call MCDone ; done multi-channel stuff + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -208,21 +208,21 @@ endp ; Voice = Audio channel ; Instr = Instrument ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODPlaySample AVoice:dword,AInstr:dword - pushad - mov ebx,[AVoice] ; change the voice sample parameters - mov eax,[AInstr] - mov edx,[eax+Sample.SampleData] - mov esi,[eax+Sample.SampleLength] - add esi,edx - mov edi,esi - call MCStartVoice - movzx ecx,[eax+Sample.Period] ; change the voice frequency - call MCSetFrequency - mov ax,[eax+Sample.Volume] ; and set the voice volume - call MCSetVolume - popad - ret +proc MODPlaySample AVoice:dword,AInstr:dword + pushad + mov ebx,[AVoice] ; change the voice sample parameters + mov eax,[AInstr] + mov edx,[eax+Sample.SampleData] + mov esi,[eax+Sample.SampleLength] + add esi,edx + mov edi,esi + call MCStartVoice + movzx ecx,[eax+Sample.Period] ; change the voice frequency + call MCSetFrequency + mov ax,[eax+Sample.Volume] ; and set the voice volume + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -233,20 +233,20 @@ endp ; Period = Amiga Period ; Volume = Volume ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword - pushad - mov ebx,[AVoice] ; change the voice sample parameters - mov eax,[AInstr] - mov edx,[4*eax+SmpAddress] - mov esi,[4*eax+SmpStartAddress] - mov edi,[4*eax+SmpEndAddress] - call MCStartVoice - mov ecx,[APeriod] ; change the voice frequency - call MCSetFrequency - mov eax,[AVolume] ; and set the voice volume - call MCSetVolume - popad - ret +proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword + pushad + mov ebx,[AVoice] ; change the voice sample parameters + mov eax,[AInstr] + mov edx,[4*eax+SmpAddress] + mov esi,[4*eax+SmpStartAddress] + mov edi,[4*eax+SmpEndAddress] + call MCStartVoice + mov ecx,[APeriod] ; change the voice frequency + call MCSetFrequency + mov eax,[AVolume] ; and set the voice volume + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -254,13 +254,13 @@ endp ; In: ; Voice = Audio channel ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODStopVoice AVoice:dword - pushad - mov ebx,[AVoice] ; set the voice volume to zero - xor al,al - call MCSetVolume - popad - ret +proc MODStopVoice AVoice:dword + pushad + mov ebx,[AVoice] ; set the voice volume to zero + xor al,al + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -269,13 +269,13 @@ endp ; Voice = Audio channel ; Period = Amiga Period ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODSetPeriod AVoice:dword,APeriod:dword - pushad - mov ebx,[AVoice] - mov ecx,[APeriod] - call MCSetFrequency - popad - ret +proc MODSetPeriod AVoice:dword,APeriod:dword + pushad + mov ebx,[AVoice] + mov ecx,[APeriod] + call MCSetFrequency + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -284,13 +284,13 @@ endp ; Voice = Audio channel ; Volume = New Volume ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° -proc MODSetVolume AVoice:dword,AVolume:dword - pushad - mov ebx,[AVoice] - mov eax,[AVolume] - call MCSetVolume - popad - ret +proc MODSetVolume AVoice:dword,AVolume:dword + pushad + mov ebx,[AVoice] + mov eax,[AVolume] + call MCSetVolume + popad + ret endp ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -301,10 +301,10 @@ endp ; CF = status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MODSetup: - pushad ; check for valid modfile formats - mov [ActiveTracks],4 - cmp [edi+MODHeader.Sign],'.K.M' - je MODParse + pushad ; check for valid modfile formats + mov [ActiveTracks],4 + cmp [edi+MODHeader.Sign],'.K.M' + je MODParse cmp [edi+MODHeader.Sign],'4TLF' je MODParse mov [ActiveTracks],6 @@ -320,15 +320,15 @@ MODParse: mov [PatternRow],40h mov [Tempo],6 mov [TempoCount],0 - mov [BPM],125 + mov [BPM],125 mov al,[edi+MODHeader.OrderLen] mov [OrderLen],al mov ecx,80h ; copy order list - xor ebx,ebx + xor ebx,ebx xor ah,ah MODCopyOrder: - mov al,[edi+ebx+MODHeader.Order] + mov al,[edi+ebx+MODHeader.Order] mov [ebx+OrderList],al cmp al,ah jb MODCopyNext @@ -352,7 +352,7 @@ MODCopyPatterns: mov ecx,31 ; setup samples data lea edi,[edi+MODHeader.Samples] - xor ebx,ebx + xor ebx,ebx inc ebx MODCopySamples: mov al,[edi+MODSample.Volume] @@ -368,15 +368,15 @@ MODCopySamples: add eax,eax add edx,edx add ebp,ebp - cmp edx,2 ; if not looped, then the loop + cmp edx,2 ; if not looped, then the loop ja MODSetSmpLength ; start and end are the same. xor edx,edx mov ebp,eax MODSetSmpLength: - add edx,ebp + add edx,ebp add eax,esi add edx,esi - add ebp,esi + add ebp,esi mov [4*ebx+SmpAddress],esi mov [4*ebx+SmpEndAddress],edx mov [4*ebx+SmpStartAddress],ebp @@ -397,10 +397,10 @@ MODCallBack: dec [TempoCount] ; decrease tempo counter jle MODNextRow ; next row? lea esi,[Tracks] - xor ebx,ebx + xor ebx,ebx MODUpdateLoop: call MODUpNote ; update note events - add esi,size Track + add esi,size Track inc ebx cmp bx,[ActiveTracks] jb MODUpdateLoop @@ -416,12 +416,12 @@ MODNextRow: mov [PatternRow],bl ; reset the pattern row mov bl,[OrderPos] inc bl ; update the order position - cmp bl,[OrderLen] + cmp bl,[OrderLen] jb MODSetOrder xor bl,bl MODSetOrder: mov [OrderPos],bl - mov bl,[ebx+OrderList] ; get the pattern from the order list + mov bl,[ebx+OrderList] ; get the pattern from the order list mov edi,[4*ebx+PatternList] mov [PatternPtr],edi ; set the pattern address MODDontWrap: @@ -447,9 +447,9 @@ MODGetNoteLoop: ; EDI = pattern data address ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MODGetNote: - mov al,[edi+2] ; get the sample number - shr al,4 - mov ah,[edi] + mov al,[edi+2] ; get the sample number + shr al,4 + mov ah,[edi] and ah,0F0h or al,ah test al,al ; nonzero value? @@ -464,7 +464,7 @@ MODGetPeriod: xchg al,ah and ax,0FFFh test ax,ax - je MODGetEffect ; nonzero value? + je MODGetEffect ; nonzero value? mov [esi+Track.Period],ax ; set new period value movzx ecx,ax call MCSetFrequency @@ -472,8 +472,8 @@ MODGetPeriod: movzx eax,[esi+Track.Instr] mov edx,[4*eax+SmpAddress] mov esi,[4*eax+SmpStartAddress] - mov edi,[4*eax+SmpEndAddress] - call MCStartVoice + mov edi,[4*eax+SmpEndAddress] + call MCStartVoice pop edi esi MODGetEffect: mov ax,[edi+2] ; get the effect value @@ -488,7 +488,7 @@ MODGetEffect: je EFXJumpPos cmp ah,0Dh je EFXBreak - cmp ah,09h + cmp ah,09h je EFXSampleOffset ret @@ -499,10 +499,10 @@ MODGetEffect: ; ESI = track address ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MODUpNote: - mov ax,[esi+Track.Effect] ; dispatch the effects - cmp ah,0Ah - je EFXSlideVolume - ret + mov ax,[esi+Track.Effect] ; dispatch the effects + cmp ah,0Ah + je EFXSlideVolume + ret ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± @@ -512,7 +512,7 @@ MODUpNote: ;  The registers EBX,ESI,EDI must be preserved. ;  The effect parameters are passed through the registers: ; EBX - voice number -; ESI - track address +; ESI - track address ; AL - effect parameter ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± @@ -536,7 +536,7 @@ EFXSetSpeed: mov [TempoCount],al ret EFXSetBPM: - mov [BPM],al + mov [BPM],al mov dl,al call MCStartTimer ret @@ -548,7 +548,7 @@ EFXJumpPos: dec al mov [OrderPos],al mov [PatternRow],40h - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; EFXBreak - breaks the current pattern. @@ -572,7 +572,7 @@ EFXSlideVolume: mov al,40h EFXVolSlided: mov [esi+Track.Volume],al - call MCSetVolume + call MCSetVolume ret EFXVolumeDown: sub al,ah @@ -584,7 +584,7 @@ EFXVolumeDown: ; EFXSampleOffset - Set the sample offset ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° EFXSampleOffset: - xor edx,edx + xor edx,edx mov dh,al push esi edi movzx eax,[esi+Track.Instr] @@ -606,9 +606,9 @@ EFXSampleOffset: ; CF = status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MCInit: - pushad - xor ax,ax ; initialize variables - mov [BufferPos],ax + pushad + xor ax,ax ; initialize variables + mov [BufferPos],ax mov [TimerCount],ax mov [TimerSpeed],ax mov [BufSelector],ax @@ -627,7 +627,7 @@ MCInit: cmp ax,cx jae MCAlignVolBuffer mov esi,edi - add edi,4200h + add edi,4200h MCAlignVolBuffer: ; VolBuffer must be page aligned add esi,0FFh ; (256 bytes = 1 page) and esi,not 0FFh @@ -651,7 +651,7 @@ MCDoVolBuffer: imul bh sar ax,cl mov [edi],ah - inc edi + inc edi inc bl jne MCDoVolBuffer inc bh @@ -675,7 +675,7 @@ MCDone: mov [BufSelector],0 MCDoneExit: popad - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; MCStartVoice - Set the voice sample instrument parameters @@ -723,7 +723,7 @@ MCSetFreqDone: ; AL = volume ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MCSetVolume: - push ebx + push ebx mov ebx,[4*ebx+VoiceTable] mov [ebx+Voice.Volume],al pop ebx @@ -747,7 +747,7 @@ MCStartTimer: mov [TimerSpeed],ax pop dx pop cx - pop ax + pop ax ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° @@ -771,7 +771,7 @@ MCPollLoop: cmp [TimerCount],0 ; time to call the MOD callback? jg MCPollChunk call MODCallBack - mov ax,[TimerSpeed] ; update timer accumulator + mov ax,[TimerSpeed] ; update timer accumulator add [TimerCount],ax MCPollChunk: mov ax,[BufferLen] ; get the chunk length @@ -795,7 +795,7 @@ MCVoicesLoop: call MCMixVoice pop edi pop edx - pop ecx + pop ecx pop ebx add ebx,size Voice dec dx @@ -814,12 +814,12 @@ MCPollDone: ; ECX = Number of samples ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° MCMixVoice: - push ebx + push ebx ; Modify the mixing chunk of code - mov eax,[ebx+Voice.EndAddress] - mov [dword ds:MCMixCode0],eax + mov eax,[ebx+Voice.EndAddress] + mov [dword ds:MCMixCode0],eax mov [dword ds:MCMixCode2],eax sub eax,[ebx+Voice.StartAddress] mov [dword ds:MCMixCode1],eax @@ -836,7 +836,7 @@ MCMixVoice: ; Load the volume table address mov bh,[ebx+Voice.Volume] - and ebx,0FF00h + and ebx,0FF00h add ebx,[VolBuffer] ; Start of the mixing chunk of code (non pure code) @@ -879,12 +879,12 @@ MCMixBreak: ; AL = data ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° SBWrite: - push eax - push ecx - push edx - mov dx,[IOAddr] - add dx,0Ch - mov ecx,10000h ; wait until the DSP is ready + push eax + push ecx + push edx + mov dx,[IOAddr] + add dx,0Ch + mov ecx,10000h ; wait until the DSP is ready mov ah,al ; to receive the data byte SBWriteWait: in al,dx @@ -895,7 +895,7 @@ SBWriteWait: pop edx pop ecx pop eax - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; SBResetDSP - reset the Sound Blaster DSP chip @@ -919,7 +919,7 @@ SBResetDSP: SBReadWait: in al,dx and al,80h - loopz SBReadWait + loopz SBReadWait sub dx,04h in al,dx ; read the DSP data byte cmp al,0AAh @@ -941,9 +941,9 @@ SBResetDone: ; CF = initialization status ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° SBOpenDevice: - pusha - call SBResetDSP ; check for a SB card - jc SBOpenDone + pusha + call SBResetDSP ; check for a SB card + jc SBOpenDone mov al,0D1h call SBWrite ; turn on SB speaker mov al,40h @@ -964,7 +964,7 @@ SBOpenDevice: clc ; set successful status SBOpenDone: popa - ret + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; SBCloseDevice - shutdown the SB playback @@ -988,7 +988,7 @@ DMAReset: pusha mov al,[DRQNum] ; reset the DMA channel or al,04h - out 0Ah,al + out 0Ah,al popa ret @@ -1012,7 +1012,7 @@ DMASetBuf: add dx,dx mov eax,[DMABuffer] out dx,al - mov al,ah + mov al,ah out dx,al inc dx ; set the DMA buffer length mov ax,[DMALength] @@ -1048,15 +1048,15 @@ IRQGetIntNum: push ax bx cx ; get the virtual master and slave mov ax,0400h ; PIC base interrupts in DX int 31h - pop cx bx ax - cmp al,08h ; get the PIC base interrupt for - jb IRQGetDone ; the IRQ number in AL - mov dh,dl - sub al,08h + pop cx bx ax + cmp al,08h ; get the PIC base interrupt for + jb IRQGetDone ; the IRQ number in AL + mov dh,dl + sub al,08h IRQGetDone: - add al,dh - pop dx - ret + add al,dh + pop dx + ret ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ; IRQRestVect - Restores the previous IRQ vector @@ -1066,13 +1066,13 @@ IRQGetDone: ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° IRQRestVect: pushad - push ds - in al,0A1h ; disable the IRQ interrupt using - mov ah,al ; the PIC interrupt mask registers - in al,21h - mov dx,01h - mov cl,[IRQNum] - shl dx,cl + push ds + in al,0A1h ; disable the IRQ interrupt using + mov ah,al ; the PIC interrupt mask registers + in al,21h + mov dx,01h + mov cl,[IRQNum] + shl dx,cl or ax,dx out 21h,al mov al,ah @@ -1090,7 +1090,7 @@ IRQRestVect: IRQRestDone: pop ds xor ebx,ebx - mov [dword IRQVector],ebx + mov [dword IRQVector],ebx mov [word 4+IRQVector],bx popad ret @@ -1114,7 +1114,7 @@ IRQSetVect: push cs pop ds int 21h - pop es ds + pop es ds in al,0A1h ; enable this IRQ using the mov al,ah ; PIC interrupt mask registers in al,21h @@ -1133,14 +1133,14 @@ IRQSetVect: ; IRQHandler - Hardware IRQ handler ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° IRQHandler: - pushad ; pushes all the registers - push ds -;;; mov ax,DGROUP ; load the DS selector -;;; mov ds,ax -;;; call _GETDS - mov ax,cs:[dword ptr OurDataSeg] - mov ds,ax - mov dx,[IOAddr] ; send ack to the SB DSP chip + pushad ; pushes all the registers + push ds +;;; mov ax,DGROUP ; load the DS selector +;;; mov ds,ax +;;; call _GETDS + mov ax,cs:[dword ptr OurDataSeg] + mov ds,ax + mov dx,[IOAddr] ; send ack to the SB DSP chip add dx,0Eh in al,dx mov al,14h ; restart DMA transfer @@ -1163,4 +1163,3 @@ IRQAckPIC: iretd end - \ No newline at end of file diff --git a/mall/MOUSE.C b/mall/MOUSE.C index fc31ab1..01f35d2 100644 --- a/mall/MOUSE.C +++ b/mall/MOUSE.C @@ -11,14 +11,14 @@ void Mymemset(void *,int,int); - int MouseModifier = 2; + int MouseModifier = 2; //============================================================================= // Check if mouse is installed, returns -1 if it IS installed //============================================================================= int MouseInstalled(void) { - int yesno; + int yesno; union REGPACK regs; Mymemset(®s,0,sizeof(union REGPACK)); @@ -59,7 +59,7 @@ intr(0x33,®s); //============================================================================= int ReadMouseCursor(int *mrow,int *mcol) { - int bstatus; + int bstatus; union REGPACK regs; Mymemset(®s,0,sizeof(union REGPACK)); @@ -77,7 +77,7 @@ return(bstatus); //============================================================================= int ReadMouseButtons(void) { - int bstatus; + int bstatus; union REGPACK regs; Mymemset(®s,0,sizeof(union REGPACK)); @@ -178,4 +178,3 @@ intr(0x33,®s); } - \ No newline at end of file