convert tabs to spaces, because there is a LOT of mixing going on

lots of random tabs used (for both indentation and spacing). lets just
use spaces everywhere for consistency
This commit is contained in:
Gered 2019-11-02 13:44:19 -04:00
parent 1c590f344f
commit 7933231c9d
37 changed files with 4842 additions and 4878 deletions

View file

@ -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);


View file

@ -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);
}


View file

@ -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 ****


View file

@ -31,4 +31,3 @@ short xxxAckDisplayScreen (void)
}


View file

@ -388,4 +388,3 @@ return (DoorCode);
}
// **** End of Source ****


View file

@ -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;


View file

@ -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[];


View file

@ -1236,4 +1236,3 @@ for (col = BegCol; col < EndCol; col += 2)
// **** End of Source ****


View file

@ -27,4 +27,3 @@ return(NULL);
}
// **** End of Source ****


View file

@ -228,4 +228,3 @@ short iffswab(unsigned short number)
// **** End of Source ****


View file

@ -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 ****


View file

@ -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 ****


View file

@ -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;

View file

@ -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 ****


View file

@ -159,4 +159,3 @@ return(pcx->bitmap); // return bitmap buffer
// **** End of Source ****


View file

@ -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 ****


View file

@ -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 <stdlib.h>
@ -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 */
}


File diff suppressed because it is too large Load diff

View file

@ -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


View file

@ -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


View file

@ -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


View file

@ -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


View file

@ -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


View file

@ -549,4 +549,3 @@ adb020:
end


View file

@ -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 ****


View file

@ -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 ****


View file

@ -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 ****


View file

@ -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);


View file

@ -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);


File diff suppressed because it is too large Load diff

View file

@ -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);


View file

@ -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


View file

@ -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(&regs,0,sizeof(union REGPACK));
@ -59,7 +59,7 @@ intr(0x33,&regs);
//=============================================================================
int ReadMouseCursor(int *mrow,int *mcol)
{
int bstatus;
int bstatus;
union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK));
@ -77,7 +77,7 @@ return(bstatus);
//=============================================================================
int ReadMouseButtons(void)
{
int bstatus;
int bstatus;
union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK));
@ -178,4 +178,3 @@ intr(0x33,&regs);
}


View file

@ -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);


File diff suppressed because it is too large Load diff

View file

@ -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


View file

@ -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(&regs,0,sizeof(union REGPACK));
@ -59,7 +59,7 @@ intr(0x33,&regs);
//=============================================================================
int ReadMouseCursor(int *mrow,int *mcol)
{
int bstatus;
int bstatus;
union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK));
@ -77,7 +77,7 @@ return(bstatus);
//=============================================================================
int ReadMouseButtons(void)
{
int bstatus;
int bstatus;
union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK));
@ -178,4 +178,3 @@ intr(0x33,&regs);
}