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 // This file contains the main data structures and definitions
// required to support the ACK-3D engine. The data structures defined are // 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 // 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. // 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) #define CAST(t,f) (t)(f)
// Internal definitions used to simplify field declarations. // Internal definitions used to simplify field declarations.
typedef unsigned long ULONG; typedef unsigned long ULONG;
typedef unsigned short USHORT; typedef unsigned short USHORT;
typedef unsigned char UCHAR; typedef unsigned char UCHAR;
// Error codes returned from ACK-3D functions. You can use these error codes in your // Error codes returned from ACK-3D functions. You can use these error codes in your
// applications to debug the function calls. // applications to debug the function calls.
@ -72,10 +72,10 @@ typedef unsigned char UCHAR;
// Defines required to support bitmaps. // Defines required to support bitmaps.
// Each bitmap used in ACK-3D is 64x64 pixels in size. // Each bitmap used in ACK-3D is 64x64 pixels in size.
#define BITMAP_WIDTH 64 #define BITMAP_WIDTH 64
#define BITMAP_HEIGHT 64 #define BITMAP_HEIGHT 64
#define BITMAP_SHIFT 6 // Bits to shift for bitmap width #define BITMAP_SHIFT 6 // Bits to shift for bitmap width
#define BITMAP_SIZE (BITMAP_WIDTH * BITMAP_HEIGHT) #define BITMAP_SIZE (BITMAP_WIDTH * BITMAP_HEIGHT)
// Defines used to set up map grid. The grid is used with the ACKENG structure. // Defines used to set up map grid. The grid is used with the ACKENG structure.
// Each grid component is 64x64 units in size. // 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_XMAXLONG (GRID_XMAX * FP_MULT)
#define GRID_YMAXLONG (GRID_YMAX * FP_MULT) #define GRID_YMAXLONG (GRID_YMAX * FP_MULT)
// The main grid array used with the ACKENG structure // 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 // Defines to specify maximum sizes for the various components used with
// ACK-3D, including wall bitmaps, light zones, shading palette, views, multi- // ACK-3D, including wall bitmaps, light zones, shading palette, views, multi-
// height walls, doors, object bitmaps, and objects. // height walls, doors, object bitmaps, and objects.
#define MAX_WALLBMPS 256 // Total wall bitmaps allowed #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 PAL_SIZE 4096 // Shading palette ranges
#define MAX_VIEWS 47 // Total sides to an object #define MAX_VIEWS 47 // Total sides to an object
#define MAX_MULTI 3 // Max height for multi-height walls #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 #define MAX_OBJECTS 254 // Total objects allowed in map
// Defines to set up different wall types. // Defines to set up different wall types.
#define WALL_TYPE_TRANS 0x0800 // Transparent wall #define WALL_TYPE_TRANS 0x0800 // Transparent wall
#define WALL_TYPE_MULTI 0x0400 // Wall is 1.5 times high #define WALL_TYPE_MULTI 0x0400 // Wall is 1.5 times high
#define WALL_TYPE_UPPER 0x0200 // Wall is above floor level #define WALL_TYPE_UPPER 0x0200 // Wall is above floor level
#define WALL_TYPE_PASS 0x0100 // Wall can be walked through #define WALL_TYPE_PASS 0x0100 // Wall can be walked through
#define TYPE_WALL 0 #define TYPE_WALL 0
#define TYPE_OBJECT 1 #define TYPE_OBJECT 1
#define RES_LOW 1 // Resolution is low for walls, floor, and ceiling #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. // Definitions and data structures used to represent and process objects.
// These defines specify the two settings for the Active field in the NEWOBJECT structure. // 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_ACTIVE 1 // Active and may be moveable
#define OBJECT_INACTIVE 0 // Won't be considered moveable #define OBJECT_INACTIVE 0 // Won't be considered moveable
// These defines specify values for the Flags field in the NEWOBJECT structure. // 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. // They are used to indicate the type of animation available for an object.
#define OF_PASSABLE 0x80 // Object can be walked thru #define OF_PASSABLE 0x80 // Object can be walked thru
#define OF_ANIMATE 0x40 // Object bitmaps are animated #define OF_ANIMATE 0x40 // Object bitmaps are animated
#define OF_MOVEABLE 0x20 // Object will move X,Y #define OF_MOVEABLE 0x20 // Object will move X,Y
#define OF_MULTIVIEW 0x10 // Object has multiple sides #define OF_MULTIVIEW 0x10 // Object has multiple sides
#define OF_ANIMONCE 0x08 // Animate once then stop #define OF_ANIMONCE 0x08 // Animate once then stop
#define OF_ANIMDONE 0x04 // One shot animation is completed #define OF_ANIMDONE 0x04 // One shot animation is completed
// These defines specify values for the CurrentType field in the NEWOBJECT structure. // These defines specify values for the CurrentType field in the NEWOBJECT structure.
// They are used to indicate the current status of the object. // They are used to indicate the current status of the object.
@ -142,39 +142,39 @@ typedef unsigned char UCHAR;
#define NO_INTERACT 5 #define NO_INTERACT 5
// The Object Sequence structure. This structure is used by the NEWOBJECT structure. // 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 { typedef struct {
UCHAR flags; // Flags for this sequence UCHAR flags; // Flags for this sequence
UCHAR bitmaps[MAX_OBJ_BITMAPS]; // Bitmap numbers in this sequence UCHAR bitmaps[MAX_OBJ_BITMAPS]; // Bitmap numbers in this sequence
short bmSides; // Number of views in sequence short bmSides; // Number of views in sequence
short bmBitmapsPerView; // Number of bitmaps in each view short bmBitmapsPerView; // Number of bitmaps in each view
short AngleFactor; // Used internally to support the object sequence short AngleFactor; // Used internally to support the object sequence
UCHAR MaxBitmaps; // Max bitmaps in this sequence UCHAR MaxBitmaps; // Max bitmaps in this sequence
} OBJSEQ; } OBJSEQ;
// The defininition of the main object structure--NEWOBJECT. // The defininition of the main object structure--NEWOBJECT.
typedef struct { typedef struct {
char Active; // Determines object status: 0=Inactive, 1=Active char Active; // Determines object status: 0=Inactive, 1=Active
UCHAR Flags; // Misc flags for this object UCHAR Flags; // Misc flags for this object
char Speed; // Speed of obj (used by application) char Speed; // Speed of obj (used by application)
short Dir; // Direction of obj (used by application) short Dir; // Direction of obj (used by application)
short x; // Current x,y location in grid short x; // Current x,y location in grid
short y; short y;
short mPos; // Current map location in grid short mPos; // Current map location in grid
UCHAR id; // Object id UCHAR id; // Object id
short CurrentType; // Create, Destroy, etc. is current short CurrentType; // Create, Destroy, etc. is current
UCHAR *CurrentBitmaps; // Current bitmap list UCHAR *CurrentBitmaps; // Current bitmap list
short Sides; // Number of views short Sides; // Number of views
short aFactor; // Angle factor short aFactor; // Angle factor
short BitmapsPerView; // Number of bitmaps in each view short BitmapsPerView; // Number of bitmaps in each view
UCHAR CurrentBm; // Current bitmap number UCHAR CurrentBm; // Current bitmap number
UCHAR Maxbm; // Max bitmap number for this view UCHAR Maxbm; // Max bitmap number for this view
OBJSEQ Create; // Stores structures for the 5 object sequences OBJSEQ Create; // Stores structures for the 5 object sequences
OBJSEQ Destroy; OBJSEQ Destroy;
OBJSEQ Walk; OBJSEQ Walk;
OBJSEQ Attack; OBJSEQ Attack;
OBJSEQ Interact; OBJSEQ Interact;
} NEWOBJECT; } NEWOBJECT;
//************************************************************************** //**************************************************************************
// The definitions and data structure that are used to represent doors. // The definitions and data structure that are used to represent doors.
@ -183,101 +183,101 @@ typedef struct {
#define DEFAULT_DOOR_SPEED 2 #define DEFAULT_DOOR_SPEED 2
// These defines are used to set the Type field. // These defines are used to set the Type field.
// Obsolete door codes since any wall can be a door // 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_SIDECODE 61
#define DOOR_YCODE 62 #define DOOR_YCODE 62
// These two defines are used to set the Flags field in the DOORS structure. // 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_OPENING 0x80 // Set if door is currently opening
#define DOOR_CLOSING 0x40 // Set if door is currently closing #define DOOR_CLOSING 0x40 // Set if door is currently closing
// Other attributes that can be assigned to the Flags field. // Other attributes that can be assigned to the Flags field.
#define DOOR_TYPE_SECRET 0x8000 // Secret door #define DOOR_TYPE_SECRET 0x8000 // Secret door
#define DOOR_LOCKED 0x4000 // Locked door #define DOOR_LOCKED 0x4000 // Locked door
#define DOOR_TYPE_SLIDE 0x2000 // Sliding door #define DOOR_TYPE_SLIDE 0x2000 // Sliding door
#define DOOR_TYPE_SPLIT 0x1000 // Split door #define DOOR_TYPE_SPLIT 0x1000 // Split door
// The main DOORS structure. // The main DOORS structure.
typedef struct { typedef struct {
short mPos; // Stores position info for a door short mPos; // Stores position info for a door
short mPos1; short mPos1;
short mCode; // Bitmap ID of the door short mCode; // Bitmap ID of the door
short mCode1; short mCode1;
UCHAR ColOffset; // Column offset for the door UCHAR ColOffset; // Column offset for the door
char Speed; // Speed setting for opening and closing the door char Speed; // Speed setting for opening and closing the door
char Type; // Code for the door type char Type; // Code for the door type
UCHAR Flags; // Door attribute settings UCHAR Flags; // Door attribute settings
} DOORS; } DOORS;
//*********************************************************************** //***********************************************************************
// The defines and data structure for the main interface structure--ACKENG. // The defines and data structure for the main interface structure--ACKENG.
// These defines are used for the LightFlag field in the ACKENG structure. // These defines are used for the LightFlag field in the ACKENG structure.
#define SHADING_ON 1 // Set if distance shading is on #define SHADING_ON 1 // Set if distance shading is on
#define SHADING_OFF 0 #define SHADING_OFF 0
// These defines are used for the SysFlags field in the ACKENG structure. // 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_BACK 0x8000 // On if solid color bkgd vs picture
#define SYS_SOLID_FLOOR 0x4000 // On if solid vs texture floor #define SYS_SOLID_FLOOR 0x4000 // On if solid vs texture floor
#define SYS_SOLID_CEIL 0x2000 // On if solid vs texture ceiling #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_NO_WALLS 0x1000 // On if walls are NOT to display
#define SYS_SINGLE_BMP 0x0800 // On if 1 bitmap for floor & ceiling #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. // 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_BBM 0 // Bitmaps will be loaded using BBM format
#define BMLOAD_GIF 1 // Bitmaps will be loaded using GIF 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_PCX 2 // Bitmaps will be loaded using PCX format
// The main interface structure used between the application and the ACK-3D engine. // 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. // This structure MUST be allocated or defined before any ACK-3D calls are made.
typedef struct { typedef struct {
USHORT xGrid[GRID_ARRAY]; // Map for X walls USHORT xGrid[GRID_ARRAY]; // Map for X walls
USHORT yGrid[GRID_ARRAY]; // Map for Y walls USHORT yGrid[GRID_ARRAY]; // Map for Y walls
UCHAR *mxGrid[GRID_ARRAY]; // Wall data for multi-height X walls UCHAR *mxGrid[GRID_ARRAY]; // Wall data for multi-height X walls
UCHAR *myGrid[GRID_ARRAY]; // Wall data for multi-height Y walls UCHAR *myGrid[GRID_ARRAY]; // Wall data for multi-height Y walls
UCHAR *bMaps[MAX_WALLBMPS]; // Pointers to wall bitmaps UCHAR *bMaps[MAX_WALLBMPS]; // Pointers to wall bitmaps
UCHAR *oMaps[MAX_OBJBMPS]; // Pointers to object bitmaps UCHAR *oMaps[MAX_OBJBMPS]; // Pointers to object bitmaps
UCHAR *ScreenBuffer; // 64k buffer for screen UCHAR *ScreenBuffer; // 64k buffer for screen
UCHAR *OverlayBuffer; // Buffer for compiled overlay UCHAR *OverlayBuffer; // Buffer for compiled overlay
UCHAR *BkgdBuffer; // Buffer for ceiling, floor UCHAR *BkgdBuffer; // Buffer for ceiling, floor
short xPlayer; // X value from 0 to 4095--stores current position short xPlayer; // X value from 0 to 4095--stores current position
short yPlayer; // Y 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 PlayerAngle; // Angle value from 0 to 1799
short DoorSpeed; // Door open/close speed short DoorSpeed; // Door open/close speed
short NonSecretCode; // Wall code for secret door short NonSecretCode; // Wall code for secret door
UCHAR TopColor; // Base color of ceiling UCHAR TopColor; // Base color of ceiling
UCHAR BottomColor; // Base color of floor UCHAR BottomColor; // Base color of floor
UCHAR FloorBitmap; // Bitmap number for single floor UCHAR FloorBitmap; // Bitmap number for single floor
UCHAR CeilBitmap; // Bitmap number for single ceiling UCHAR CeilBitmap; // Bitmap number for single ceiling
UCHAR LightFlag; // 0 = no light shading, 1 = ON UCHAR LightFlag; // 0 = no light shading, 1 = ON
UCHAR PalTable[PAL_SIZE]; // 16 zones of 256 colors each UCHAR PalTable[PAL_SIZE]; // 16 zones of 256 colors each
short WinStartX; // Value of left side of viewport short WinStartX; // Value of left side of viewport
short WinStartY; // Value of top side of viewport short WinStartY; // Value of top side of viewport
short WinEndX; // Value of right side short WinEndX; // Value of right side
short WinEndY; // Value of bottom side short WinEndY; // Value of bottom side
short CenterRow; // Value of (WinEndY-WinStartY)/2 short CenterRow; // Value of (WinEndY-WinStartY)/2
short CenterOffset; // Center row times bytes per row short CenterOffset; // Center row times bytes per row
short WinWidth; // Value of WinEndX - WinStartX short WinWidth; // Value of WinEndX - WinStartX
short WinHeight; // Value of WinEndY - WinStartY short WinHeight; // Value of WinEndY - WinStartY
USHORT WinLength; // Number of dwords in window USHORT WinLength; // Number of dwords in window
USHORT WinStartOffset; // Value of WinStartY * 320 USHORT WinStartOffset; // Value of WinStartY * 320
USHORT SysFlags; // General system flags--determines display attributes USHORT SysFlags; // General system flags--determines display attributes
UCHAR bmLoadType; // Bitmap load flags (BBM, GIF, PCX, etc) UCHAR bmLoadType; // Bitmap load flags (BBM, GIF, PCX, etc)
short MaxObjects; // Total number of objects in map short MaxObjects; // Total number of objects in map
NEWOBJECT *ObjList[MAX_OBJECTS+1]; // Current objects in map NEWOBJECT *ObjList[MAX_OBJECTS+1]; // Current objects in map
DOORS Door[MAX_DOORS]; // Doors moving at one time DOORS Door[MAX_DOORS]; // Doors moving at one time
} ACKENG; } ACKENG;
// Structure used to build the palette ranges for light shading // Structure used to build the palette ranges for light shading
// There are 16 color ranges (or zones) each containing 256 colors. // There are 16 color ranges (or zones) each containing 256 colors.
typedef struct { typedef struct {
unsigned char start; // Starting color for this range unsigned char start; // Starting color for this range
unsigned char length; // Length of range unsigned char length; // Length of range
} ColorRange; } ColorRange;
//************************************************************************* //*************************************************************************
@ -433,4 +433,3 @@ void AckSetTextmode(void);
short AckDisplayScreen(void); short AckDisplayScreen(void);


View file

@ -29,14 +29,13 @@ short AckBuildBackground (ACKENG * ae)
#if FLOOR_ACTIVE #if FLOOR_ACTIVE
#else #else
AckBuildCeilingFloor (ae->BkgdBuffer, AckBuildCeilingFloor (ae->BkgdBuffer,
ae->LightFlag, ae->LightFlag,
ae->TopColor, ae->TopColor,
ae->BottomColor, ae->BottomColor,
ae->WinStartY, ae->WinStartY,
ae->WinEndY, ae->WinEndY,
ae->CenterRow); ae->CenterRow);
#endif #endif
return (0); return (0);
} }


View file

@ -142,9 +142,8 @@ UCHAR HitMap[4096];
UCHAR *VidSeg; UCHAR *VidSeg;
char *scantables[96]; char *scantables[96];
UCHAR AckKeys[128]; // Buffer for keystrokes UCHAR AckKeys[128]; // Buffer for keystrokes
long AckTimerCounter; long AckTimerCounter;
// **** End of Data **** // **** End of Data ****


View file

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


View file

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


View file

@ -17,28 +17,28 @@
#define FP_HALF 32768 #define FP_HALF 32768
#define VIEW_WIDTH 320 // The number of columns in a view (screen) #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_WALL 0
#define TYPE_OBJECT 1 #define TYPE_OBJECT 1
#define TYPE_PALETTE 2 #define TYPE_PALETTE 2
#define MAX_HEIGHT 960 // Maximum height of a wall #define MAX_HEIGHT 960 // Maximum height of a wall
#define MIN_HEIGHT 8 // Minimum 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_STARTCODE 0xFC // Force player to this square
#define MAP_UPCODE 0xFD // Go up to previous level #define MAP_UPCODE 0xFD // Go up to previous level
#define MAP_DOWNCODE 0xFE // Go down to next level #define MAP_DOWNCODE 0xFE // Go down to next level
#define MAP_GOALCODE 0xFF // Finish line! #define MAP_GOALCODE 0xFF // Finish line!
#define ST_WALL 1 #define ST_WALL 1
#define ST_OBJECT 2 #define ST_OBJECT 2
#define COLS_PER_BYTE 1 // Use 1 for normal mode 13h, 4 for modeX #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 BYTES_PER_ROW 320 // Use 320 for normal mode 13h, 80 for modeX
#define DWORDS_PER_ROW (BYTES_PER_ROW / 4) #define DWORDS_PER_ROW (BYTES_PER_ROW / 4)
#define SCREEN_SIZE 64000 #define SCREEN_SIZE 64000
// Holds information for the current wall section found during the raycasting process. // Holds information for the current wall section found during the raycasting process.
@ -47,20 +47,19 @@
// the slice is stored in this structure. // the slice is stored in this structure.
typedef struct _slicer { typedef struct _slicer {
UCHAR **bMap; // Pointer to wall bitmap found while ray casting UCHAR **bMap; // Pointer to wall bitmap found while ray casting
UCHAR *mPtr; // Grid pointer to reference multi-height wall data UCHAR *mPtr; // Grid pointer to reference multi-height wall data
short bNumber; // Bitmap number of the wall found short bNumber; // Bitmap number of the wall found
unsigned short bColumn; // Screen column location of the found slice unsigned short bColumn; // Screen column location of the found slice
short Distance; // Distance from the POV to the slice short Distance; // Distance from the POV to the slice
short mPos; // Position of the slice in the associated map short mPos; // Position of the slice in the associated map
unsigned char Type; // Indicates if the slice is a wall or object unsigned char Type; // Indicates if the slice is a wall or object
void (*Fnc)(void); // Pointer to a function to draw 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 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 // The next two pointers are used if the current slice
// is part of a transparent wall // is part of a transparent wall
struct _slicer *Prev; // References the wall slice in front of current slice struct _slicer *Prev; // References the wall slice in front of current slice
struct _slicer *Next; // References the wall slice behind the current slice struct _slicer *Next; // References the wall slice behind the current slice
} SLICE; } SLICE;


View file

@ -1,119 +1,118 @@
/* ACK-3D ( Animation Construction Kit 3D ) */ /* ACK-3D ( Animation Construction Kit 3D ) */
extern UCHAR *BackArray[]; extern UCHAR *BackArray[];
extern long xPglobal; extern long xPglobal;
extern long yPglobal; extern long yPglobal;
extern long xBegGlobal; extern long xBegGlobal;
extern long yBegGlobal; extern long yBegGlobal;
extern long BackDropRows; extern long BackDropRows;
extern ACKENG *aeGlobal; extern ACKENG *aeGlobal;
extern USHORT *xGridGlobal; extern USHORT *xGridGlobal;
extern USHORT *yGridGlobal; extern USHORT *yGridGlobal;
extern long xPglobalHI; extern long xPglobalHI;
extern long yPglobalHI; extern long yPglobalHI;
extern ULONG *rbaTable; extern ULONG *rbaTable;
extern long bmDistance; extern long bmDistance;
extern short rsHandle; extern short rsHandle;
extern long LastX1; extern long LastX1;
extern long LastY1; extern long LastY1;
extern long iLastX; extern long iLastX;
extern long iLastY; extern long iLastY;
extern short MaxDistance; extern short MaxDistance;
extern short ErrorCode; extern short ErrorCode;
extern short LightFlag; extern short LightFlag;
extern long xMapPosn; extern long xMapPosn;
extern long yMapPosn; extern long yMapPosn;
extern short DefZone[]; extern short DefZone[];
extern short AckLightZones[]; extern short AckLightZones[];
extern UCHAR *HtTable[]; extern UCHAR *HtTable[];
extern USHORT *Grid; extern USHORT *Grid;
extern USHORT *ObjGrid; extern USHORT *ObjGrid;
extern UCHAR HitMap[]; extern UCHAR HitMap[];
extern UCHAR *BitmapXferPtr; extern UCHAR *BitmapXferPtr;
extern short TotalSpecial; extern short TotalSpecial;
extern short DistanceTable[]; extern short DistanceTable[];
extern long *AdjustTable; extern long *AdjustTable;
extern short xSecretmPos; extern short xSecretmPos;
extern short xSecretmPos1; extern short xSecretmPos1;
extern short xSecretColumn; extern short xSecretColumn;
extern short ySecretmPos; extern short ySecretmPos;
extern short ySecretmPos1; extern short ySecretmPos1;
extern short ySecretColumn; extern short ySecretColumn;
extern short TotalSecret; extern short TotalSecret;
extern short ViewColumn; extern short ViewColumn;
extern long *SinTable; extern long *SinTable;
extern long *CosTable; extern long *CosTable;
extern long *LongTanTable; extern long *LongTanTable;
extern long *LongInvTanTable; extern long *LongInvTanTable;
extern long InvCosTable[]; extern long InvCosTable[];
extern long InvSinTable[]; extern long InvSinTable[];
extern long *LongCosTable; extern long *LongCosTable;
extern long *ViewCosTable; extern long *ViewCosTable;
extern long *xNextTable; extern long *xNextTable;
extern long *yNextTable; extern long *yNextTable;
extern UCHAR ObjectsSeen[]; extern UCHAR ObjectsSeen[];
extern UCHAR MoveObjectList[]; extern UCHAR MoveObjectList[];
extern short TotalObjects; extern short TotalObjects;
extern short FoundObjectCount; extern short FoundObjectCount;
extern short MoveObjectCount; extern short MoveObjectCount;
extern short LastObjectHit; extern short LastObjectHit;
extern short LastMapPosn; extern short LastMapPosn;
extern UCHAR ObjNumber[]; extern UCHAR ObjNumber[];
extern USHORT ObjRelDist[]; extern USHORT ObjRelDist[];
extern short ObjColumn[]; extern short ObjColumn[];
extern short ObjAngle[]; extern short ObjAngle[];
extern short DirAngle[]; extern short DirAngle[];
extern UCHAR LightMap[]; extern UCHAR LightMap[];
extern USHORT FloorMap[]; extern USHORT FloorMap[];
extern USHORT CeilMap[]; extern USHORT CeilMap[];
extern SLICE Slice[]; extern SLICE Slice[];
extern USHORT ScreenOffset; extern USHORT ScreenOffset;
extern short LastFloorAngle; extern short LastFloorAngle;
extern short LastFloorX; extern short LastFloorX;
extern short LastFloorY; extern short LastFloorY;
extern long Flooru; extern long Flooru;
extern long Floorv; extern long Floorv;
extern long Floordu; extern long Floordu;
extern long Floordv; extern long Floordv;
extern long Floorkx; extern long Floorkx;
extern long Floorky; extern long Floorky;
extern long Floorku; extern long Floorku;
extern long Floorkv; extern long Floorkv;
extern long Floorkdu; extern long Floorkdu;
extern long Floorkdv; extern long Floorkdv;
extern UCHAR *Floorbm; extern UCHAR *Floorbm;
extern UCHAR *Floorscr; extern UCHAR *Floorscr;
extern UCHAR *FloorscrTop; extern UCHAR *FloorscrTop;
extern UCHAR *Floorptr2; extern UCHAR *Floorptr2;
extern UCHAR *Floors1; extern UCHAR *Floors1;
extern UCHAR *Floors2; extern UCHAR *Floors2;
extern long Floorht; extern long Floorht;
extern long Floorwt; extern long Floorwt;
extern short Floorvht; extern short Floorvht;
extern short Flooreht; extern short Flooreht;
extern short ViewAngle; extern short ViewAngle;
extern short ViewHeight; extern short ViewHeight;
extern short CeilingHeight; extern short CeilingHeight;
extern short Resolution; extern short Resolution;
extern short LastWallHeight; extern short LastWallHeight;
extern short PlayerAngle; extern short PlayerAngle;
extern short ViewAngle; extern short ViewAngle;
extern USHORT SysFlags; extern USHORT SysFlags;
extern SLICE Slice[]; extern SLICE Slice[];
extern SLICE *sPtr; extern SLICE *sPtr;
extern UCHAR **WallbMaps; extern UCHAR **WallbMaps;
extern UCHAR *VidTop; extern UCHAR *VidTop;
extern UCHAR *VidBottom; extern UCHAR *VidBottom;
extern short BotRowTable[]; extern short BotRowTable[];
extern USHORT FloorMap[]; extern USHORT FloorMap[];
extern USHORT CeilMap[]; extern USHORT CeilMap[];
extern char *scantables[]; extern char *scantables[];


View file

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


View file

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


View file

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


View file

@ -367,7 +367,7 @@ else
_llseek(handle,rbaTable[(ULONG)fName],SEEK_SET); // Access opened resource file _llseek(handle,rbaTable[(ULONG)fName],SEEK_SET); // Access opened resource file
} }
aLen = GRID_ARRAY * 2; aLen = GRID_ARRAY * 2;
mLen = GRID_MAX * 2; mLen = GRID_MAX * 2;
if (_lread(handle,Grid,mLen) != mLen) // Read in grid map data 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 // 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 // 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 // that the distance to the wall is 100 units. The value stored at this
// location is 81--the pixel height f the wall. // 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 **** // **** End of Source ****


View file

@ -31,7 +31,7 @@ pos = col * 64;
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)
{ {
if (bmp[pos++]) if (bmp[pos++])
return(1); return(1);
} }
return(0); return(0);
@ -65,21 +65,21 @@ if (ae->bmLoadType == BMLOAD_BBM)
buf = AckReadiff(BitmapName); buf = AckReadiff(BitmapName);
if (ae->bmLoadType == BMLOAD_GIF) if (ae->bmLoadType == BMLOAD_GIF)
buf = AckReadgif(BitmapName); buf = AckReadgif(BitmapName);
if (ae->bmLoadType == BMLOAD_PCX) if (ae->bmLoadType == BMLOAD_PCX)
buf = AckReadPCX(BitmapName); buf = AckReadPCX(BitmapName);
if (buf == NULL) if (buf == NULL)
return(ERR_LOADINGBITMAP); return(ERR_LOADINGBITMAP);
x = (*(short *)buf); x = (*(short *)buf);
y = (*(short *)&buf[2]); y = (*(short *)&buf[2]);
if ((x*y) != BITMAP_SIZE) if ((x*y) != BITMAP_SIZE)
{ {
AckFree(buf); AckFree(buf);
return(ERR_INVALIDFORM); return(ERR_INVALIDFORM);
} }
memmove(buf,&buf[4],BITMAP_SIZE); memmove(buf,&buf[4],BITMAP_SIZE);
bFlag = 1; bFlag = 1;
@ -105,13 +105,13 @@ if (!bFlag)
{ {
handle = _lopen(BitmapName,OF_READ); handle = _lopen(BitmapName,OF_READ);
if (handle < 1) if (handle < 1)
{ {
AckFree(buf); AckFree(buf);
AckFree(bmp); AckFree(bmp);
return(ERR_BADFILE); 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); read(handle,buf,BITMAP_SIZE);
_lclose(handle); _lclose(handle);
} }
@ -121,11 +121,11 @@ for (y = 0; y < BITMAP_HEIGHT; y++)
sPos = y; sPos = y;
dPos = y * BITMAP_WIDTH; dPos = y * BITMAP_WIDTH;
for (x = 0; x < BITMAP_WIDTH; x++) for (x = 0; x < BITMAP_WIDTH; x++)
{ {
ch = buf[sPos]; ch = buf[sPos];
bmp[dPos++] = ch; bmp[dPos++] = ch;
sPos += BITMAP_WIDTH; sPos += BITMAP_WIDTH;
} }
} }
@ -135,7 +135,7 @@ memset(bmpFlags,0,BITMAP_WIDTH);
for (x = 0; x < BITMAP_WIDTH; x++) for (x = 0; x < BITMAP_WIDTH; x++)
{ {
if (!BlankSlice(x,bmp)) 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)); ae->ObjList[ObjNumber] = (NEWOBJECT *)AckMalloc(sizeof(NEWOBJECT));
if (ae->ObjList[ObjNumber] == NULL) if (ae->ObjList[ObjNumber] == NULL)
return(ERR_NOMEMORY); return(ERR_NOMEMORY);
memset(ae->ObjList[ObjNumber],0,sizeof(NEWOBJECT)); memset(ae->ObjList[ObjNumber],0,sizeof(NEWOBJECT));
} }
@ -213,28 +213,28 @@ short AckSetObjectType(ACKENG *ae,short oNum,short oType)
switch (oType) switch (oType)
{ {
case NO_CREATE: case NO_CREATE:
os = &ae->ObjList[oNum]->Create; os = &ae->ObjList[oNum]->Create;
break; break;
case NO_DESTROY: case NO_DESTROY:
os = &ae->ObjList[oNum]->Destroy; os = &ae->ObjList[oNum]->Destroy;
break; break;
case NO_WALK: case NO_WALK:
os = &ae->ObjList[oNum]->Walk; os = &ae->ObjList[oNum]->Walk;
break; break;
case NO_ATTACK: case NO_ATTACK:
os = &ae->ObjList[oNum]->Attack; os = &ae->ObjList[oNum]->Attack;
break; break;
case NO_INTERACT: case NO_INTERACT:
os = &ae->ObjList[oNum]->Interact; os = &ae->ObjList[oNum]->Interact;
break; break;
default: default:
result = ERR_BADOBJTYPE; result = ERR_BADOBJTYPE;
break; break;
} }
if (!result) if (!result)
@ -253,16 +253,16 @@ if (ae->ObjList[oNum]->Flags & OF_MOVEABLE)
{ {
j = 0; j = 0;
for (i = 0; i < MoveObjectCount; i++) for (i = 0; i < MoveObjectCount; i++)
{ {
if (MoveObjectList[i] == oNum) if (MoveObjectList[i] == oNum)
{ {
j = 1; j = 1;
break; break;
} }
} }
if (!j) if (!j)
MoveObjectList[MoveObjectCount++] = oNum; MoveObjectList[MoveObjectCount++] = oNum;
i = (ae->ObjList[oNum]->y & 0xFFC0) + (ae->ObjList[oNum]->x >> 6); i = (ae->ObjList[oNum]->y & 0xFFC0) + (ae->ObjList[oNum]->x >> 6);
ObjGrid[i] = 0; ObjGrid[i] = 0;
@ -292,28 +292,28 @@ if (os->flags & OF_MULTIVIEW)
switch (oType) switch (oType)
{ {
case NO_CREATE: case NO_CREATE:
memmove(&ae->ObjList[oNum]->Create,os,sizeof(OBJSEQ)); memmove(&ae->ObjList[oNum]->Create,os,sizeof(OBJSEQ));
break; break;
case NO_DESTROY: case NO_DESTROY:
memmove(&ae->ObjList[oNum]->Destroy,os,sizeof(OBJSEQ)); memmove(&ae->ObjList[oNum]->Destroy,os,sizeof(OBJSEQ));
break; break;
case NO_WALK: case NO_WALK:
memmove(&ae->ObjList[oNum]->Walk,os,sizeof(OBJSEQ)); memmove(&ae->ObjList[oNum]->Walk,os,sizeof(OBJSEQ));
break; break;
case NO_ATTACK: case NO_ATTACK:
memmove(&ae->ObjList[oNum]->Attack,os,sizeof(OBJSEQ)); memmove(&ae->ObjList[oNum]->Attack,os,sizeof(OBJSEQ));
break; break;
case NO_INTERACT: case NO_INTERACT:
memmove(&ae->ObjList[oNum]->Interact,os,sizeof(OBJSEQ)); memmove(&ae->ObjList[oNum]->Interact,os,sizeof(OBJSEQ));
break; break;
default: default:
result = ERR_BADOBJTYPE; result = ERR_BADOBJTYPE;
break; break;
} }
if (!result && ae->ObjList[oNum]->CurrentBitmaps == NULL) if (!result && ae->ObjList[oNum]->CurrentBitmaps == NULL)
@ -324,4 +324,3 @@ return(result);
// **** End of Source **** // **** End of Source ****


View file

@ -25,8 +25,8 @@ extern void (*WallMaskRtn)(void);
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// Internal function called by FindObject(). Your programs may call this // Internal function called by FindObject(). Your programs may call this
// function if they need to calculate the angle between two points. dx 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 represent the deltas between the two points. (i.e. dx = x1 - x and
// dy = y1 - y) // dy = y1 - y)
// //
// Quadrants // Quadrants
@ -40,7 +40,7 @@ extern void (*WallMaskRtn)(void);
// positive. // positive.
// //
// The angle between the two points is determined by using the formula: // 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. // access tangent values of angles.
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
short AckGetObjectAngle(long dx,long dy) 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) // 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 // 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 // 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 // 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. // 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 // 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 // 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 // 90 degrees. Then, we search the list sequentially to find the first value
// higher than our ratio. // higher than our ratio.
//============================================================================= //=============================================================================
Beg = 0; // Assume midpoint between 0 and 45 degrees Beg = 0; // Assume midpoint between 0 and 45 degrees
@ -166,7 +166,7 @@ for (i = 0; i < 16; i++)
{ {
result += result; result += result;
high = (high << 2) | ((low >>30) & 0x3); high = (high << 2) | ((low >>30) & 0x3);
low <<= 2; // Shift left by 2 low <<= 2; // Shift left by 2
tmp = result + result + 1; tmp = result + result + 1;
if (high >= tmp) if (high >= tmp)
{ {
@ -373,7 +373,7 @@ if (FoundObjectCount) // Make sure objects were found during ray casting
ObjNum = oPtr->CurrentBitmaps[j]; 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 // ending column based on the starting column plus the scaled
// width of the object. // width of the object.
ColEnd = NewX + wt; ColEnd = NewX + wt;
@ -383,7 +383,7 @@ if (FoundObjectCount) // Make sure objects were found during ray casting
bmpFlags = &wall[BITMAP_SIZE]; bmpFlags = &wall[BITMAP_SIZE];
j = distance; 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. // object into the appropriate slice structure.
for (Column = NewX - wt; Column < ColEnd; Column++) 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 // Fill in the slice structure with the
// info about the object // info about the object
sa->Distance = distance; sa->Distance = distance;
sa->bNumber = ObjNum; sa->bNumber = ObjNum;
sa->bColumn = BmpColumn; sa->bColumn = BmpColumn;
sa->bMap = omaps; sa->bMap = omaps;
sa->Active = 1; sa->Active = 1;
sa->Type = ST_OBJECT; sa->Type = ST_OBJECT;

View file

@ -33,25 +33,25 @@ sPos = vPos;
while (vLen > 0) while (vLen > 0)
{ {
if (sBuf[sPos]) if (sBuf[sPos])
{ {
sPos1 = sPos; sPos1 = sPos;
while (vLen > 0 && sBuf[sPos1++]) while (vLen > 0 && sBuf[sPos1++])
vLen--; vLen--;
len = (sPos1 - sPos) - 1; len = (sPos1 - sPos) - 1;
(*(short *)&ae->ScreenBuffer[bPos]) = len; (*(short *)&ae->ScreenBuffer[bPos]) = len;
bPos += 2; bPos += 2;
(*(short *)&ae->ScreenBuffer[bPos]) = sPos; (*(short *)&ae->ScreenBuffer[bPos]) = sPos;
bPos += 2; bPos += 2;
memmove(&ae->ScreenBuffer[bPos],&sBuf[sPos],len); memmove(&ae->ScreenBuffer[bPos],&sBuf[sPos],len);
bPos += len; bPos += len;
sPos = sPos1; sPos = sPos1;
} }
else else
{ {
sPos++; sPos++;
vLen--; vLen--;
} }
} }
(*(short *)&ae->ScreenBuffer[bPos]) = 0; (*(short *)&ae->ScreenBuffer[bPos]) = 0;
@ -70,4 +70,3 @@ return(ERR_NOMEMORY);
// **** End of Source **** // **** End of Source ****


View file

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


View file

@ -18,7 +18,7 @@
//************************************************************************ //************************************************************************
// Internal function called by AckMovePOV(). Checks the passed X and Y // 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. // encouner an object.
//************************************************************************ //************************************************************************
short AckCheckObjPosn(short xPlayer,short yPlayer, short oIndex) short AckCheckObjPosn(short xPlayer,short yPlayer, short oIndex)
@ -28,7 +28,7 @@ short AckCheckObjPosn(short xPlayer,short yPlayer, short oIndex)
NEWOBJECT **oList; NEWOBJECT **oList;
NEWOBJECT *oPtr; 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 MapPosn = (yPlayer & 0xFFC0) + (xPlayer >> 6); // Calculate grid square the player will be in
maxObj = aeGlobal->MaxObjects; // Total number of objects used maxObj = aeGlobal->MaxObjects; // Total number of objects used
oList = &aeGlobal->ObjList[0]; // Reference the list of objects 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 oPtr = oList[i]; // Point to current object
if (oPtr == NULL) // No object here; skip to next object in list 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 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 if (MapPosn == oPtr->mPos && i != oIndex) // Object is found in the player's grid position
{ {
LastObjectHit = i; // Store the number of the object found LastObjectHit = i; // Store the number of the object found
return(POV_OBJECT); // Return flag to indicate an object is found return(POV_OBJECT); // Return flag to indicate an object is found
} }
} }
return(result); return(result);
} }
@ -64,7 +64,7 @@ USHORT GetWallX(short mPos)
mCode = xGridGlobal[mPos]; // Get bitmap code at specified map position mCode = xGridGlobal[mPos]; // Get bitmap code at specified map position
if (mCode & WALL_TYPE_PASS) // Passable walls can be walked through if (mCode & WALL_TYPE_PASS) // Passable walls can be walked through
mCode = 0; mCode = 0;
return(mCode); return(mCode);
} }
@ -114,52 +114,52 @@ y1 = yp + (long)((SinTable[Angle] * Amount) >> FP_SHIFT);
mPos = yTop + (xp >> 6); // Current Map Posn mPos = yTop + (xp >> 6); // Current Map Posn
// It's time to see what happens when we move // 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 (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 (x1 > xRight || abs(xRight-x1) < 28) // We crossed the wall or we're too close if (x1 < xLeft || abs(x1-xLeft) < 28) // We crossed the wall or we're too close
{ {
x1 = xp; // Use the previous x position x1 = xp; // Use the previous x position
HitResult = POV_SLIDEX; // We're possibly sliding along the right x wall 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 (GetWallX(mPos+1)) // Wall found in current square (right edge)
{ {
if (y1 < yTop || abs(y1-yTop) < 28) // We crossed the wall or we're too close if (x1 > xRight || abs(xRight-x1) < 28) // We crossed the wall or we're too close
{ {
y1 = yp; // Use the previous y position x1 = xp; // Use the previous x position
HitResult = POV_SLIDEY; // We're possibly sliding along the top wall 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 (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 if (y1 > yBottom || abs(yBottom-y1) < 28) // We crossed the wall or we're too close
{ {
y1 = yp; // Use the previous y position y1 = yp; // Use the previous y position
HitResult = POV_SLIDEY; // We're sliding along the bottom wall HitResult = POV_SLIDEY; // We're sliding along the bottom wall
} }
} }
} }
// A wall or object hasn't been hit yet--we must look further. // 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) if (!HitResult)
{ // Check region A--top left area of grid { // Check region A--top left area of grid
if (y1 < (yTop+32)) // New y position falls in top half if (y1 < (yTop+32)) // New y position falls in top half
{ {
if (x1 < (xLeft+32)) // New x position falls in left half if (x1 < (xLeft+32)) // New x position falls in left half
{ {
mCodeX = GetWallX(mPos-GRID_WIDTH); // Check adjacent x wall (to left) mCodeX = GetWallX(mPos-GRID_WIDTH); // Check adjacent x wall (to left)
mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above) mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above)
if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord
{ // is within 28 units { // is within 28 units
if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge
{ {
if (xp > (xLeft+27)) // Previous x position was outside range if (xp > (xLeft+27)) // Previous x position was outside range
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord. if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord.
{ // is within 28 units { // is within 28 units
if (y1 < (yTop+28)) // New y coord. is within 28 units of edge if (y1 < (yTop+28)) // New y coord. is within 28 units of edge
{ {
if (yp > (yTop+27)) // Previous y position was outside range if (yp > (yTop+27)) // Previous y position was outside range
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
// Check region B--top right area // Check region B--top right area
if (x1 > (xRight-32) && !HitResult)// New x is at top right 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 (mCodeX && y1 < (yTop+28)) // Adjacent x wall found
{ {
if (x1 > (xRight-28)) if (x1 > (xRight-28))
{ {
if (xp < (xRight-27)) if (xp < (xRight-27))
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found
{ {
if (y1 < (yTop+28)) if (y1 < (yTop+28))
{ {
if (yp > (yTop+27)) if (yp > (yTop+27))
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
} }
// Check region C--bottom left area // Check region C--bottom left area
if (y1 > (yTop+32) && !HitResult) // We are below upper half of square if (y1 > (yTop+32) && !HitResult) // We are below upper half of square
{ {
if (x1 < (xLeft+32)) // and on the left 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) mCodeX = GetWallX(mPos+GRID_WIDTH); // Check adjacent x wall (to left)
mCodeY = GetWallY(mPos-1+GRID_WIDTH); // Check adjacent y wall (below) mCodeY = GetWallY(mPos-1+GRID_WIDTH); // Check adjacent y wall (below)
if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found
{ {
if (x1 < (xLeft+28)) if (x1 < (xLeft+28))
{ {
if (xp > (xLeft+27)) if (xp > (xLeft+27))
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found
{ {
if (y1 > (yBottom-28)) if (y1 > (yBottom-28))
{ {
if (yp < (yBottom-27)) if (yp < (yBottom-27))
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
// Check region D--bottom right area // Check region D--bottom right area
if (x1 > (xRight-32) && !HitResult) // Check right side of square if (x1 > (xRight-32) && !HitResult) // Check right side of square
{ {
mCodeX = GetWallX(mPos+1+GRID_WIDTH); // Check adjacent x wall (to right) mCodeX = GetWallX(mPos+1+GRID_WIDTH); // Check adjacent x wall (to right)
mCodeY = GetWallY(mPos+1+GRID_WIDTH); // Check adjacent y wall (below) mCodeY = GetWallY(mPos+1+GRID_WIDTH); // Check adjacent y wall (below)
if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found if (mCodeX && y1 > (yBottom-28)) // Adjacent x wall found
{ {
if (x1 > (xRight-28)) if (x1 > (xRight-28))
{ {
if (xp < (xRight-27)) if (xp < (xRight-27))
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found
{ {
if (y1 > (yBottom-28)) if (y1 > (yBottom-28))
{ {
if (yp < (yBottom-27)) if (yp < (yBottom-27))
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
} }
} }
if (AckCheckObjPosn(x1,y1,0)) // We've hit an object--not a wall 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 xLeft,xRight,yTop,yBottom,mPos;
short MapPosn,PlayerPosn; short MapPosn,PlayerPosn;
NEWOBJECT **oList; NEWOBJECT **oList;
NEWOBJECT *oPtr; NEWOBJECT *oPtr;
oList = &aeGlobal->ObjList[0]; // Reference the start of the object list oList = &aeGlobal->ObjList[0]; // Reference the start of the object list
oPtr = oList[ObjIndex]; // Set a pointer to the object being moved 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; yTop = yp & 0xFFC0;
yBottom = yTop + GRID_SIZE - 1; yBottom = yTop + GRID_SIZE - 1;
mPos = yTop + (xp >> 6); // Calculate the map position of the grid square the object is in 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 // object is moving to
// Check to see if the object will encouner another object while moving // Check to see if the object will encouner another object while moving
@ -392,221 +392,221 @@ if (oNum > 0) // Yes,
return(POV_OBJECT); return(POV_OBJECT);
HitResult = POV_NOTHING; // Nothing found yet, initialize flag 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 (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 if (x1 < xLeft || abs(x1-xLeft) < 28) // We crossed the wall or we're too close
{ {
x1 = xp; // Use the previous x position x1 = xp; // Use the previous x position
HitResult = POV_SLIDEX; // We're possibly sliding along the left x wall 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 (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 if (x1 > xRight || abs(xRight-x1) < 28) // We crossed the wall or we're too close
{ {
x1 = xp; // Use the previous x position x1 = xp; // Use the previous x position
HitResult = POV_SLIDEX; // We're possibly sliding along the right x wall 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 (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 if (y1 < yTop || abs(y1-yTop) < 28) // We crossed the wall or we're too close
{ {
y1 = yp; // Use the previous y position y1 = yp; // Use the previous y position
HitResult = POV_SLIDEY; // We're possibly sliding along the top wall 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 (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 if (y1 > yBottom || abs(yBottom-y1) < 28) // We crossed the wall or we're too close
{ {
y1 = yp; // Use the previous y position y1 = yp; // Use the previous y position
HitResult = POV_SLIDEY; // We're sliding along the bottom wall 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 (y1 < (yTop+32)) // We are above upper half of square
{ {
if (x1 < (xLeft+32)) // and on the left 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) mCodeX = GetWallX(mPos-GRID_WIDTH); // Check adjacent x wall (to left)
mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above) mCodeY = GetWallY(mPos-1); // Check adjacent y wall (above)
if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found and new y coord
{ // is within 28 units { // is within 28 units
if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge if (x1 < (xLeft+28)) // New x coord. is within 28 units of edge
{ {
if (xp > (xLeft+27)) // Previous x position was outside range if (xp > (xLeft+27)) // Previous x position was outside range
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord. if (mCodeY && x1 < (xLeft+28)) // Adjacent y wall found and new x coord.
{ // is within 28 units { // is within 28 units
if (y1 < (yTop+28)) // New y coord. is within 28 units of edge if (y1 < (yTop+28)) // New y coord. is within 28 units of edge
{ {
if (yp > (yTop+27)) // Previous y position was outside range if (yp > (yTop+27)) // Previous y position was outside range
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
if (x1 > (xRight-32) && !HitResult) // New x is at top right if (x1 > (xRight-32) && !HitResult) // New x is at top right
{ {
mCodeX = GetWallX(mPos+1-GRID_WIDTH); // Check adjacent x wall (to right) mCodeX = GetWallX(mPos+1-GRID_WIDTH); // Check adjacent x wall (to right)
mCodeY = GetWallY(mPos+1); // Check adjacent y wall (above) mCodeY = GetWallY(mPos+1); // Check adjacent y wall (above)
if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found if (mCodeX && y1 < (yTop+28)) // Adjacent x wall found
{ {
if (x1 > (xRight-28)) if (x1 > (xRight-28))
{ {
if (xp < (xRight-27)) if (xp < (xRight-27))
{ {
x1 = xp; // Use previous x position x1 = xp; // Use previous x position
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found if (mCodeY && x1 > (xRight-28)) // Adjacent y wall found
{ {
if (y1 < (yTop+28)) if (y1 < (yTop+28))
{ {
if (yp > (yTop+27)) if (yp > (yTop+27))
{ {
y1 = yp; // Use previous y position y1 = yp; // Use previous y position
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; x1 = xp;
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
} }
if (y1 > (yTop+32) && !HitResult) // We are below upper half of square if (y1 > (yTop+32) && !HitResult) // We are below upper half of square
{ {
if (x1 < (xLeft+32)) // and on the left half of square if (x1 < (xLeft+32)) // and on the left half of square
{ {
mCodeX = GetWallX(mPos+GRID_WIDTH); mCodeX = GetWallX(mPos+GRID_WIDTH);
mCodeY = GetWallY(mPos-1+GRID_WIDTH); mCodeY = GetWallY(mPos-1+GRID_WIDTH);
if (mCodeX && y1 > (yBottom-28)) if (mCodeX && y1 > (yBottom-28))
{ {
if (x1 < (xLeft+28)) if (x1 < (xLeft+28))
{ {
if (xp > (xLeft+27)) if (xp > (xLeft+27))
{ {
x1 = xp; x1 = xp;
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; y1 = yp;
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 < (xLeft+28)) if (mCodeY && x1 < (xLeft+28))
{ {
if (y1 > (yBottom-28)) if (y1 > (yBottom-28))
{ {
if (yp < (yBottom-27)) if (yp < (yBottom-27))
{ {
y1 = yp; y1 = yp;
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; x1 = xp;
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
if (x1 > (xRight-32) && !HitResult) // on right side of square if (x1 > (xRight-32) && !HitResult) // on right side of square
{ {
mCodeX = GetWallX(mPos+1+GRID_WIDTH); mCodeX = GetWallX(mPos+1+GRID_WIDTH);
mCodeY = GetWallY(mPos+1+GRID_WIDTH); mCodeY = GetWallY(mPos+1+GRID_WIDTH);
if (mCodeX && y1 > (yBottom-28)) if (mCodeX && y1 > (yBottom-28))
{ {
if (x1 > (xRight-28)) if (x1 > (xRight-28))
{ {
if (xp < (xRight-27)) if (xp < (xRight-27))
{ {
x1 = xp; x1 = xp;
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
else else
{ {
y1 = yp; y1 = yp;
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
} }
} }
if (mCodeY && x1 > (xRight-28)) if (mCodeY && x1 > (xRight-28))
{ {
if (y1 > (yBottom-28)) if (y1 > (yBottom-28))
{ {
if (yp < (yBottom-27)) if (yp < (yBottom-27))
{ {
y1 = yp; y1 = yp;
HitResult = POV_SLIDEY; HitResult = POV_SLIDEY;
} }
else else
{ {
x1 = xp; x1 = xp;
HitResult = POV_SLIDEX; HitResult = POV_SLIDEX;
} }
} }
} }
} }
} }
} }
oPtr->x = x1; // Update the new x,y coordinates for the object oPtr->x = x1; // Update the new x,y coordinates for the object
@ -630,7 +630,7 @@ void AckCheckObjectMovement(void)
short i,maxObj; short i,maxObj;
short dx; short dx;
NEWOBJECT **oList; NEWOBJECT **oList;
NEWOBJECT *oPtr; NEWOBJECT *oPtr;
maxObj = aeGlobal->MaxObjects; // Get the number of objects used maxObj = aeGlobal->MaxObjects; // Get the number of objects used
oList = &aeGlobal->ObjList[0]; // Reference the list of objects 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 oPtr = oList[i]; // Access current object in list
if (oPtr == NULL) // No object here; skip if (oPtr == NULL) // No object here; skip
continue; continue;
if (!oPtr->Active) // Object is not active; skip if (!oPtr->Active) // Object is not active; skip
continue; continue;
if (!oPtr->Speed) // Object has no speed setting; skip if (!oPtr->Speed) // Object has no speed setting; skip
continue; continue;
if (!(oPtr->Flags & OF_ANIMATE)) // Object is not set up for animation if (!(oPtr->Flags & OF_ANIMATE)) // Object is not set up for animation
continue; continue;
dx = oPtr->CurrentBm + 1; // Use the next bitmap dx = oPtr->CurrentBm + 1; // Use the next bitmap
if (dx >= oPtr->Maxbm) // We're at the end of the list of bitmaps 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 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_ANIMATE; // Reset flags to indicate that we're done
oPtr->Flags |= OF_ANIMDONE; // animating the object oPtr->Flags |= OF_ANIMDONE; // animating the object
dx = oPtr->CurrentBm; // Keep current bitmap number dx = oPtr->CurrentBm; // Keep current bitmap number
} }
else else
dx = 0; // Start at the beginning of the set of bitmaps dx = 0; // Start at the beginning of the set of bitmaps
} }
oPtr->CurrentBm = dx; // Store the next bitmap as the current one oPtr->CurrentBm = dx; // Store the next bitmap as the current one
} }
} }
// **** End of Source **** // **** End of Source ****


View file

@ -1,6 +1,6 @@
//****************** ( Animation Construction Kit 3D ) ********************** //****************** ( Animation Construction Kit 3D ) **********************
// Ray Casting Routines // Ray Casting Routines
// CopyRight (c) 1993 Author: Lary Myers // CopyRight (c) 1993 Author: Lary Myers
//*************************************************************************** //***************************************************************************
#include <stdlib.h> #include <stdlib.h>
@ -16,7 +16,7 @@
#include "ackeng.h" #include "ackeng.h"
#include "ackext.h" #include "ackext.h"
extern short ViewAngle; extern short ViewAngle;
//************************************************************************** //**************************************************************************
// //
@ -32,14 +32,14 @@ if (!FoundObjectCount)
for (i = 0; i < FoundObjectCount; i++) for (i = 0; i < FoundObjectCount; i++)
{ {
if (ObjectsSeen[i] == onum) if (ObjectsSeen[i] == onum)
return(1); return(1);
} }
return(result); return(result);
} }
long x_xPos,x_yPos,x_xNext,x_yNext; long x_xPos,x_yPos,x_xNext,x_yNext;
long y_xPos,y_yPos,y_xNext,y_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) if (ViewAngle > INT_ANGLE_270 || ViewAngle < INT_ANGLE_90)
{ {
x_xPos = xBegGlobal + BITMAP_WIDTH; // Looking to the right x_xPos = xBegGlobal + BITMAP_WIDTH; // Looking to the right
x_xNext = BITMAP_WIDTH; // Positive direction x_xNext = BITMAP_WIDTH; // Positive direction
} }
else else
{ {
x_xPos = xBegGlobal; // Looking to the left x_xPos = xBegGlobal; // Looking to the left
x_xNext = -BITMAP_WIDTH; // Negative direction x_xNext = -BITMAP_WIDTH; // Negative direction
x_yNext = -x_yNext; x_yNext = -x_yNext;
} }
@ -86,72 +86,72 @@ UINT xRayCast(void)
while (1) while (1)
{ {
if (x_xPos < 0 || x_xPos > GRID_XMAX || if (x_xPos < 0 || x_xPos > GRID_XMAX ||
x_yPos < 0 || x_yPos > GRID_YMAXLONG) x_yPos < 0 || x_yPos > GRID_YMAXLONG)
break; break;
//************* Fixed point Y/64 * 64 X / 64 ********** //************* Fixed point Y/64 * 64 X / 64 **********
MapPosn = ((x_yPos >> FP_SHIFT) & 0xFFC0) + (x_xPos >> 6); MapPosn = ((x_yPos >> FP_SHIFT) & 0xFFC0) + (x_xPos >> 6);
if ((Color = ObjGrid[MapPosn]) != 0) if ((Color = ObjGrid[MapPosn]) != 0)
{ {
Color &= 0x7F; Color &= 0x7F;
if (!ObjectExist(Color)) if (!ObjectExist(Color))
ObjectsSeen[FoundObjectCount++] = Color; ObjectsSeen[FoundObjectCount++] = Color;
} }
// Check to see if a wall is being struck by the ray // Check to see if a wall is being struck by the ray
if ((Color = xGridGlobal[MapPosn]) != 0) if ((Color = xGridGlobal[MapPosn]) != 0)
{ {
xMapPosn = MapPosn; // Hold onto the map location xMapPosn = MapPosn; // Hold onto the map location
iLastX = x_xPos; iLastX = x_xPos;
LastY1 = x_yPos; LastY1 = x_yPos;
if ((Color & 0xFF) == DOOR_XCODE) // Is this a door? if ((Color & 0xFF) == DOOR_XCODE) // Is this a door?
{ {
yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side
xd = yd + BITMAP_WIDTH; // And the right side xd = yd + BITMAP_WIDTH; // And the right side
ObjDist = (x_yPos + (x_yNext >> 1)) >> FP_SHIFT; // Calc door distance ObjDist = (x_yPos + (x_yNext >> 1)) >> FP_SHIFT; // Calc door distance
if (ObjDist < yd || ObjDist > xd) // Is door visible? if (ObjDist < yd || ObjDist > xd) // Is door visible?
{ {
x_xPos += x_xNext; // Nope, continue casting x_xPos += x_xNext; // Nope, continue casting
x_yPos += x_yNext; // the ray as before x_yPos += x_yNext; // the ray as before
continue; continue;
} }
LastY1 = x_yPos + (x_yNext >> 1); // Adjust the X,Y values so LastY1 = x_yPos + (x_yNext >> 1); // Adjust the X,Y values so
iLastX += (x_xNext >> 1); // the door is halfway in sq. iLastX += (x_xNext >> 1); // the door is halfway in sq.
} }
if (Color & DOOR_TYPE_SECRET) if (Color & DOOR_TYPE_SECRET)
{ {
if (xSecretColumn != 0) if (xSecretColumn != 0)
{ {
sy = xSecretColumn * LongTanTable[ViewAngle]; sy = xSecretColumn * LongTanTable[ViewAngle];
ObjDist = (x_yPos + sy) >> FP_SHIFT; ObjDist = (x_yPos + sy) >> FP_SHIFT;
yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side yd = ((x_yPos >> FP_SHIFT) & GRID_MASK); // Get the left side
xd = yd + BITMAP_WIDTH; // And the right side xd = yd + BITMAP_WIDTH; // And the right side
if (ObjDist < yd || ObjDist > xd) // Is door visible? if (ObjDist < yd || ObjDist > xd) // Is door visible?
{ {
x_xPos += x_xNext; // Nope, continue casting x_xPos += x_xNext; // Nope, continue casting
x_yPos += x_yNext; // the ray as before x_yPos += x_yNext; // the ray as before
continue; continue;
} }
LastY1 = x_yPos + sy; LastY1 = x_yPos + sy;
iLastX += xSecretColumn; iLastX += xSecretColumn;
} }
} }
return(Color); 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(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 xd,yd,sy;
long ObjDist; 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) if (ViewAngle > INT_ANGLE_270 || ViewAngle < INT_ANGLE_90)
{ {
xPos = xBegGlobal + BITMAP_WIDTH; // Looking to the right xPos = xBegGlobal + BITMAP_WIDTH; // Looking to the right
xNext = BITMAP_WIDTH; // Positive direction xNext = BITMAP_WIDTH; // Positive direction
} }
else else
{ {
xPos = xBegGlobal; // Looking to the left xPos = xBegGlobal; // Looking to the left
xNext = -BITMAP_WIDTH; // Negative direction xNext = -BITMAP_WIDTH; // Negative direction
yNext = -yNext; yNext = -yNext;
} }
@ -195,72 +195,72 @@ yPos = (((long)xPos - (long)xPglobal) * LongTanTable[ViewAngle]) + yPglobalHI;
while (1) while (1)
{ {
if (xPos < 0 || xPos > GRID_XMAX || if (xPos < 0 || xPos > GRID_XMAX ||
yPos < 0 || yPos > GRID_YMAXLONG) yPos < 0 || yPos > GRID_YMAXLONG)
break; break;
//************* Fixed point Y/64 * 64 X / 64 *********** //************* Fixed point Y/64 * 64 X / 64 ***********
MapPosn = ((yPos >> FP_SHIFT) & 0xFFC0) + (xPos >> 6); MapPosn = ((yPos >> FP_SHIFT) & 0xFFC0) + (xPos >> 6);
if ((Color = ObjGrid[MapPosn]) != 0) if ((Color = ObjGrid[MapPosn]) != 0)
{ {
Color &= 0x7F; Color &= 0x7F;
if (!ObjectExist(Color)) if (!ObjectExist(Color))
ObjectsSeen[FoundObjectCount++] = Color; ObjectsSeen[FoundObjectCount++] = Color;
} }
// Check to see if a wall is being struck by the ray // Check to see if a wall is being struck by the ray
if ((Color = xGridGlobal[MapPosn]) != 0) if ((Color = xGridGlobal[MapPosn]) != 0)
{ {
xMapPosn = MapPosn; // Hold onto the map location xMapPosn = MapPosn; // Hold onto the map location
iLastX = xPos; iLastX = xPos;
LastY1 = yPos; LastY1 = yPos;
if ((Color & 0xFF) == DOOR_XCODE) // Is this a door? if ((Color & 0xFF) == DOOR_XCODE) // Is this a door?
{ {
yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side
xd = yd + BITMAP_WIDTH; // And the right side xd = yd + BITMAP_WIDTH; // And the right side
ObjDist = (yPos + (yNext >> 1)) >> FP_SHIFT; // Calc door distance ObjDist = (yPos + (yNext >> 1)) >> FP_SHIFT; // Calc door distance
if (ObjDist < yd || ObjDist > xd) // Is door visible? if (ObjDist < yd || ObjDist > xd) // Is door visible?
{ {
xPos += xNext; // Nope, continue casting xPos += xNext; // Nope, continue casting
yPos += yNext; // the ray as before yPos += yNext; // the ray as before
continue; continue;
} }
LastY1 = yPos + (yNext >> 1); // Adjust the X,Y values so LastY1 = yPos + (yNext >> 1); // Adjust the X,Y values so
iLastX += (xNext >> 1); // the door is halfway in sq. iLastX += (xNext >> 1); // the door is halfway in sq.
} }
if (Color & DOOR_TYPE_SECRET) if (Color & DOOR_TYPE_SECRET)
{ {
if (xSecretColumn != 0) if (xSecretColumn != 0)
{ {
sy = xSecretColumn * LongTanTable[ViewAngle]; sy = xSecretColumn * LongTanTable[ViewAngle];
ObjDist = (yPos + sy) >> FP_SHIFT; ObjDist = (yPos + sy) >> FP_SHIFT;
yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side yd = ((yPos >> FP_SHIFT) & GRID_MASK); // Get the left side
xd = yd + BITMAP_WIDTH; // And the right side xd = yd + BITMAP_WIDTH; // And the right side
if (ObjDist < yd || ObjDist > xd) // Is door visible? if (ObjDist < yd || ObjDist > xd) // Is door visible?
{ {
xPos += xNext; // Nope, continue casting xPos += xNext; // Nope, continue casting
yPos += yNext; // the ray as before yPos += yNext; // the ray as before
continue; continue;
} }
LastY1 = yPos + sy; LastY1 = yPos + sy;
iLastX += xSecretColumn; iLastX += xSecretColumn;
} }
} }
return(Color); return(Color);
}
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 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) if (ViewAngle < INT_ANGLE_180)
{ {
y_yPos = yBegGlobal + BITMAP_WIDTH; // Looking down y_yPos = yBegGlobal + BITMAP_WIDTH; // Looking down
y_yNext = BITMAP_WIDTH; // Positive direction y_yNext = BITMAP_WIDTH; // Positive direction
} }
else else
{ {
y_yPos = yBegGlobal; // Looking up y_yPos = yBegGlobal; // Looking up
y_yNext = -BITMAP_WIDTH; // Negative direction y_yNext = -BITMAP_WIDTH; // Negative direction
y_xNext = -y_xNext; y_xNext = -y_xNext;
} }
@ -307,74 +307,74 @@ UINT yRayCast(void)
while (1) while (1)
{ {
if (y_xPos < 0 || y_xPos > GRID_XMAXLONG || if (y_xPos < 0 || y_xPos > GRID_XMAXLONG ||
y_yPos < 0 || y_yPos > GRID_YMAX) y_yPos < 0 || y_yPos > GRID_YMAX)
break; break;
//********** Y/64 * 64 Fixed point and /64 ***** //********** Y/64 * 64 Fixed point and /64 *****
MapPosn = (y_yPos & 0xFFC0) + (y_xPos >> (FP_SHIFT+6)); MapPosn = (y_yPos & 0xFFC0) + (y_xPos >> (FP_SHIFT+6));
if ((Color = ObjGrid[MapPosn]) != 0) if ((Color = ObjGrid[MapPosn]) != 0)
{ {
Color &= 0x7F; Color &= 0x7F;
if (!ObjectExist(Color)) if (!ObjectExist(Color))
ObjectsSeen[FoundObjectCount++] = Color; ObjectsSeen[FoundObjectCount++] = Color;
} }
// Check for a wall being struck // Check for a wall being struck
if ((Color = yGridGlobal[MapPosn]) != 0) if ((Color = yGridGlobal[MapPosn]) != 0)
{ {
yMapPosn = MapPosn; // Hold onto map position yMapPosn = MapPosn; // Hold onto map position
LastX1 = y_xPos; LastX1 = y_xPos;
iLastY = y_yPos; iLastY = y_yPos;
if ((Color & 0xFF) == DOOR_YCODE) // Is this a door? if ((Color & 0xFF) == DOOR_YCODE) // Is this a door?
{ {
yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Calc top side of square yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Calc top side of square
xd = yd + BITMAP_WIDTH; // And bottom side of square xd = yd + BITMAP_WIDTH; // And bottom side of square
ObjDist = (y_xPos + (y_xNext >> 1)) >> FP_SHIFT; ObjDist = (y_xPos + (y_xNext >> 1)) >> FP_SHIFT;
if (ObjDist < yd || ObjDist > xd) // Is door visible? if (ObjDist < yd || ObjDist > xd) // Is door visible?
{ {
y_xPos += y_xNext; // No, continue on with ray cast y_xPos += y_xNext; // No, continue on with ray cast
y_yPos += y_yNext; y_yPos += y_yNext;
continue; continue;
} }
LastX1 = y_xPos + (y_xNext >> 1); // Adjust coordinates so door is LastX1 = y_xPos + (y_xNext >> 1); // Adjust coordinates so door is
iLastY += (y_yNext >> 1); // Halfway into wall iLastY += (y_yNext >> 1); // Halfway into wall
} }
if (Color & DOOR_TYPE_SECRET) if (Color & DOOR_TYPE_SECRET)
{ {
if (ySecretColumn != 0) if (ySecretColumn != 0)
{ {
sx = ySecretColumn * LongInvTanTable[ViewAngle]; sx = ySecretColumn * LongInvTanTable[ViewAngle];
ObjDist = (y_xPos + sx) >> FP_SHIFT; ObjDist = (y_xPos + sx) >> FP_SHIFT;
yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Get the top side yd = ((y_xPos >> FP_SHIFT) & GRID_MASK); // Get the top side
xd = yd + BITMAP_WIDTH; // And the bottom side xd = yd + BITMAP_WIDTH; // And the bottom side
if (ObjDist < yd || ObjDist > xd) // Is door visible? if (ObjDist < yd || ObjDist > xd) // Is door visible?
{ {
y_xPos += y_xNext; // Nope, continue casting y_xPos += y_xNext; // Nope, continue casting
y_yPos += y_yNext; // the ray as before y_yPos += y_yNext; // the ray as before
continue; continue;
} }
LastX1 = y_xPos + sx; LastX1 = y_xPos + sx;
iLastY += ySecretColumn; iLastY += ySecretColumn;
} }
} }
return(Color); return(Color);
} }
y_xPos += y_xNext; // Next calculated X value for delta Y y_xPos += y_xNext; // Next calculated X value for delta Y
y_yPos += y_yNext; // Next fixed value of 64 or -64 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 xNext;
long xd,yd,ObjDist,sx; 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) if (ViewAngle < INT_ANGLE_180)
{ {
yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */ yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */
yNext = BITMAP_WIDTH; /* Positive direction */ yNext = BITMAP_WIDTH; /* Positive direction */
} }
else else
{ {
yPos = yBegGlobal; /* Looking up */ yPos = yBegGlobal; /* Looking up */
yNext = -BITMAP_WIDTH; /* Negative direction */ yNext = -BITMAP_WIDTH; /* Negative direction */
xNext = -xNext; xNext = -xNext;
} }
@ -415,81 +415,81 @@ xPos = (((long)yPos - (long)yPglobal) * LongInvTanTable[ViewAngle]) + xPglobalHI
while (1) while (1)
{ {
if (xPos < 0 || xPos > GRID_XMAXLONG || if (xPos < 0 || xPos > GRID_XMAXLONG ||
yPos < 0 || yPos > GRID_YMAX) yPos < 0 || yPos > GRID_YMAX)
break; 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 / BITMAP_WIDTH) * GRID_WIDTH) + (xPos >> (FP_SHIFT+BITMAP_SHIFT));
// MapPosn = ((yPos & GRID_MASK) >> 1) + (xPos >> (FP_SHIFT+BITMAP_SHIFT)); // MapPosn = ((yPos & GRID_MASK) >> 1) + (xPos >> (FP_SHIFT+BITMAP_SHIFT));
MapPosn = (yPos & 0xFFC0) + (xPos >> (FP_SHIFT+6)); MapPosn = (yPos & 0xFFC0) + (xPos >> (FP_SHIFT+6));
if ((Color = ObjGrid[MapPosn]) != 0) if ((Color = ObjGrid[MapPosn]) != 0)
{ {
Color &= 0x7F; Color &= 0x7F;
if (!ObjectExist(Color)) if (!ObjectExist(Color))
ObjectsSeen[FoundObjectCount++] = Color; ObjectsSeen[FoundObjectCount++] = Color;
} }
/** Check for a wall being struck **/ /** Check for a wall being struck **/
if ((Color = yGridGlobal[MapPosn]) != 0) if ((Color = yGridGlobal[MapPosn]) != 0)
{ {
yMapPosn = MapPosn; /* Hold onto map position */ yMapPosn = MapPosn; /* Hold onto map position */
LastX1 = xPos; LastX1 = xPos;
iLastY = yPos; iLastY = yPos;
if ((Color & 0xFF) == DOOR_YCODE) /* Is this a door? */ if ((Color & 0xFF) == DOOR_YCODE) /* Is this a door? */
{ {
yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Calc top side of square */ yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Calc top side of square */
xd = yd + BITMAP_WIDTH; /* And bottom side of square */ xd = yd + BITMAP_WIDTH; /* And bottom side of square */
ObjDist = (xPos + (xNext >> 1)) >> FP_SHIFT; ObjDist = (xPos + (xNext >> 1)) >> FP_SHIFT;
if (ObjDist < yd || ObjDist > xd) /* Is door visible? */ if (ObjDist < yd || ObjDist > xd) /* Is door visible? */
{ {
xPos += xNext; /* No, continue on with ray cast */ xPos += xNext; /* No, continue on with ray cast */
yPos += yNext; yPos += yNext;
continue; continue;
} }
LastX1 = xPos + (xNext >> 1); /* Adjust coordinates so door is */ LastX1 = xPos + (xNext >> 1); /* Adjust coordinates so door is */
iLastY += (yNext >> 1); /* Halfway into wall */ iLastY += (yNext >> 1); /* Halfway into wall */
} }
if (Color & DOOR_TYPE_SECRET) if (Color & DOOR_TYPE_SECRET)
{ {
if (ySecretColumn != 0) if (ySecretColumn != 0)
{ {
sx = ySecretColumn * LongInvTanTable[ViewAngle]; sx = ySecretColumn * LongInvTanTable[ViewAngle];
ObjDist = (xPos + sx) >> FP_SHIFT; ObjDist = (xPos + sx) >> FP_SHIFT;
yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Get the top side */ yd = ((xPos >> FP_SHIFT) & GRID_MASK); /* Get the top side */
xd = yd + BITMAP_WIDTH; /* And the bottom side */ xd = yd + BITMAP_WIDTH; /* And the bottom side */
if (ObjDist < yd || ObjDist > xd) /* Is door visible? */ if (ObjDist < yd || ObjDist > xd) /* Is door visible? */
{ {
xPos += xNext; /* Nope, continue casting */ xPos += xNext; /* Nope, continue casting */
yPos += yNext; /* the ray as before */ yPos += yNext; /* the ray as before */
continue; continue;
} }
LastX1 = xPos + sx; LastX1 = xPos + sx;
iLastY += ySecretColumn; iLastY += ySecretColumn;
} }
} }
return(Color); return(Color);
} }
xPos += xNext; /* Next calculated X value for delta Y */ xPos += xNext; /* Next calculated X value for delta Y */
yPos += yNext; /* Next fixed value of 64 or -64 */ 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) UINT xRayMulti(UINT MinDist,short MinHeight)
{ {
@ -508,17 +508,17 @@ UINT xRayMulti(UINT MinDist,short MinHeight)
long xd,yd,sy; long xd,yd,sy;
long ObjDist; 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) if (ViewAngle > INT_ANGLE_270 || ViewAngle < INT_ANGLE_90)
{ {
xPos = xBegGlobal + BITMAP_WIDTH; /* Looking to the right */ xPos = xBegGlobal + BITMAP_WIDTH; /* Looking to the right */
xNext = BITMAP_WIDTH; /* Positive direction */ xNext = BITMAP_WIDTH; /* Positive direction */
} }
else else
{ {
xPos = xBegGlobal; /* Looking to the left */ xPos = xBegGlobal; /* Looking to the left */
xNext = -BITMAP_WIDTH; /* Negative direction */ xNext = -BITMAP_WIDTH; /* Negative direction */
yNext = -yNext; yNext = -yNext;
} }
@ -528,38 +528,38 @@ yPos = (((long)xPos - (long)xPglobal) * LongTanTable[ViewAngle]) + yPglobalHI;
while (1) while (1)
{ {
if (xPos < 0 || xPos > GRID_XMAX || if (xPos < 0 || xPos > GRID_XMAX ||
yPos < 0 || yPos > GRID_YMAXLONG) yPos < 0 || yPos > GRID_YMAXLONG)
break; break;
/************** Fixed point Y/64 * 64 X / 64 ***********/ /************** Fixed point Y/64 * 64 X / 64 ***********/
MapPosn = ((yPos >> FP_SHIFT) & 0xFFC0) + (xPos >> 6); MapPosn = ((yPos >> FP_SHIFT) & 0xFFC0) + (xPos >> 6);
/* Check to see if a wall is being struck by the ray */ /* Check to see if a wall is being struck by the ray */
if ((Color = xGridGlobal[MapPosn]) & WALL_TYPE_MULTI) if ((Color = xGridGlobal[MapPosn]) & WALL_TYPE_MULTI)
{ {
if ((Color & 0xFF) > MinHeight) if ((Color & 0xFF) > MinHeight)
{ {
xd = xPos - xPglobal; xd = xPos - xPglobal;
yd = InvCosTable[ViewAngle] >> 4; yd = InvCosTable[ViewAngle] >> 4;
if (MinDist < ((xd * yd) >> 10)) if (MinDist < ((xd * yd) >> 10))
{ {
xMapPosn = MapPosn; /* Hold onto the map location */ xMapPosn = MapPosn; /* Hold onto the map location */
iLastX = xPos; iLastX = xPos;
LastY1 = yPos; LastY1 = yPos;
return(Color); return(Color);
} }
} }
}
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 */ 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) UINT yRayMulti(UINT MinDist,short MinHeight)
{ {
@ -576,17 +576,17 @@ UINT yRayMulti(UINT MinDist,short MinHeight)
long xNext; long xNext;
long xd,yd,ObjDist,sx; 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) if (ViewAngle < INT_ANGLE_180)
{ {
yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */ yPos = yBegGlobal + BITMAP_WIDTH; /* Looking down */
yNext = BITMAP_WIDTH; /* Positive direction */ yNext = BITMAP_WIDTH; /* Positive direction */
} }
else else
{ {
yPos = yBegGlobal; /* Looking up */ yPos = yBegGlobal; /* Looking up */
yNext = -BITMAP_WIDTH; /* Negative direction */ yNext = -BITMAP_WIDTH; /* Negative direction */
xNext = -xNext; xNext = -xNext;
} }
@ -596,35 +596,34 @@ xPos = (((long)yPos - (long)yPglobal) * LongInvTanTable[ViewAngle]) + xPglobalHI
while (1) while (1)
{ {
if (xPos < 0 || xPos > GRID_XMAXLONG || if (xPos < 0 || xPos > GRID_XMAXLONG ||
yPos < 0 || yPos > GRID_YMAX) yPos < 0 || yPos > GRID_YMAX)
break; break;
/*********** Y/64 * 64 Fixed point and /64 ******/ /*********** Y/64 * 64 Fixed point and /64 ******/
MapPosn = (yPos & 0xFFC0) + (xPos >> (FP_SHIFT+6)); MapPosn = (yPos & 0xFFC0) + (xPos >> (FP_SHIFT+6));
/** Check for a wall being struck **/ /** Check for a wall being struck **/
if ((Color = yGridGlobal[MapPosn]) & WALL_TYPE_MULTI) if ((Color = yGridGlobal[MapPosn]) & WALL_TYPE_MULTI)
{ {
if ((Color & 0xFF) > MinHeight) if ((Color & 0xFF) > MinHeight)
{ {
xd = yPos - yPglobal; xd = yPos - yPglobal;
yd = InvCosTable[ViewAngle] >> 4; yd = InvCosTable[ViewAngle] >> 4;
if (MinDist < ((xd * yd) >> 10)) if (MinDist < ((xd * yd) >> 10))
{ {
yMapPosn = MapPosn; /* Hold onto the map location */ yMapPosn = MapPosn; /* Hold onto the map location */
LastX1 = xPos; LastX1 = xPos;
iLastY = yPos; iLastY = yPos;
return(Color); return(Color);
} }
} }
} }
xPos += xNext; /* Next calculated X value for delta Y */ xPos += xNext; /* Next calculated X value for delta Y */
yPos += yNext; /* Next fixed value of 64 or -64 */ 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_ IFDEF _BORLANDC_
PROC _&L NEAR PROC _&L NEAR
ENDIF ENDIF
IFDEF _WATCOMC_ IFDEF _WATCOMC_
PROC &L_ NEAR PROC &L_ NEAR
ENDIF ENDIF
ENDM ENDM
MACRO ACKEXT L MACRO ACKEXT L
IFDEF _BORLANDC_ IFDEF _BORLANDC_
extrn _&L:NEAR extrn _&L:NEAR
ENDIF ENDIF
IFDEF _WATCOMC_ IFDEF _WATCOMC_
extrn &L_:NEAR extrn &L_:NEAR
ENDIF ENDIF
ENDM ENDM
MACRO ACKPUBS LAB MACRO ACKPUBS LAB
IFDEF _BORLANDC_ IFDEF _BORLANDC_
public _&LAB public _&LAB
ENDIF ENDIF
IFDEF _WATCOMC_ IFDEF _WATCOMC_
public &LAB_ public &LAB_
ENDIF ENDIF
ENDM ENDM
MACRO ACKCALL LAB MACRO ACKCALL LAB
IFDEF _BORLANDC_ IFDEF _BORLANDC_
call _&LAB call _&LAB
ENDIF ENDIF
IFDEF _WATCOMC_ IFDEF _WATCOMC_
call &LAB_ call &LAB_
ENDIF ENDIF
ENDM ENDM
IFDEF _BORLANDC_ IFDEF _BORLANDC_
VIDSEG equ 0a0000000h VIDSEG equ 0a0000000h
ENDIF ENDIF
IFDEF _WATCOMC_ IFDEF _WATCOMC_
VIDSEG equ 0a0000h VIDSEG equ 0a0000h
ENDIF ENDIF
;; Equates for SLICE struct ;; Equates for SLICE struct
sabMap equ 0 sabMap equ 0
samPtr equ 4 samPtr equ 4
sabNumber equ 8 sabNumber equ 8
sabColumn equ 10 sabColumn equ 10
saDist equ 12 saDist equ 12
samPos equ 14 samPos equ 14
saType equ 16 saType equ 16
saFnc equ 17 saFnc equ 17
saActive equ 21 saActive equ 21
saPrev equ 22 saPrev equ 22
saNext equ 26 saNext equ 26
saSize equ 30 ;size of SLICE structure saSize equ 30 ;size of SLICE structure
; Equates for upper byte of walls ; Equates for upper byte of walls
WALL_TYPE_UPPER equ 0200h WALL_TYPE_UPPER equ 0200h
WALL_TYPE_MULTI equ 0400h WALL_TYPE_MULTI equ 0400h
WALL_UPPER_MULTI equ 0600h WALL_UPPER_MULTI equ 0600h
WALL_TYPE_TRANS equ 0800h WALL_TYPE_TRANS equ 0800h
DOOR_TYPE_SECRET equ 8000h DOOR_TYPE_SECRET equ 8000h
DOOR_LOCKED equ 4000h DOOR_LOCKED equ 4000h
DOOR_TYPE_SLIDE equ 2000h DOOR_TYPE_SLIDE equ 2000h
DOOR_TYPE_SPLIT equ 1000h DOOR_TYPE_SPLIT equ 1000h
DOOR_WALL equ 3000h DOOR_WALL equ 3000h
; Equates for LightFlag ; Equates for LightFlag
SHADING_OFF equ 0 SHADING_OFF equ 0
SHADING_ON equ 1 SHADING_ON equ 1
ST_WALL equ 1 ST_WALL equ 1
ST_OBJECT equ 2 ST_OBJECT equ 2
DOOR_XCODE equ 60 DOOR_XCODE equ 60
DOOR_YCODE equ 62 DOOR_YCODE equ 62
RES_LOW equ 1 RES_LOW equ 1
;; Equates for SCOL struct ;; Equates for SCOL struct
Vid equ 0 Vid equ 0
Wall equ 4 Wall equ 4
Pal equ 8 Pal equ 8
dst equ 12 dst equ 12
wht equ 14 wht equ 14
multi equ 16 multi equ 16
topht equ 18 topht equ 18
botht equ 20 botht equ 20
savwht equ 22 savwht equ 22
mulcnt equ 24 mulcnt equ 24
savVid equ 26 savVid equ 26
bNum equ 30 bNum equ 30
scLen equ 32 ; length of structure scLen equ 32 ; length of structure
; Equates for SysFlag ; Equates for SysFlag
SYS_SOLID_BACK equ 8000h ; On if solid color bkgd vs picture 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_FLOOR equ 4000h ; On if solid vs texture floor
SYS_SOLID_CEIL equ 2000h ; On if solid vs texture ceiling SYS_SOLID_CEIL equ 2000h ; On if solid vs texture ceiling
SYS_NO_WALLS equ 1000h ; On if walls are NOT to display SYS_NO_WALLS equ 1000h ; On if walls are NOT to display
Color equ ebp-4 Color equ ebp-4
retval equ ebp-6 retval equ ebp-6
MapPosn equ ebp-8 MapPosn equ ebp-8
xBeg equ ebp-10 xBeg equ ebp-10
;xPos equ ebp-14 ;xPos equ ebp-14
;xNext equ ebp-18 ;xNext equ ebp-18
;yPos equ ebp-22 ;yPos equ ebp-22
;yNext equ ebp-26 ;yNext equ ebp-26
xd equ ebp-30 xd equ ebp-30
yd equ ebp-34 yd equ ebp-34
yTemp equ ebp-38 yTemp equ ebp-38
sy equ ebp-42 sy equ ebp-42
sx equ ebp-46 sx equ ebp-46
INT_ANGLE_32 equ 160 INT_ANGLE_32 equ 160
INT_ANGLE_90 equ 450 INT_ANGLE_90 equ 450
INT_ANGLE_135 equ 675 INT_ANGLE_135 equ 675
INT_ANGLE_180 equ 900 INT_ANGLE_180 equ 900
INT_ANGLE_225 equ 1125 INT_ANGLE_225 equ 1125
INT_ANGLE_270 equ 1350 INT_ANGLE_270 equ 1350
INT_ANGLE_360 equ 1800 INT_ANGLE_360 equ 1800


View file

@ -1,75 +1,75 @@
IDEAL IDEAL
JUMPS JUMPS
P386 P386
P387 P387
MASM MASM
.MODEL FLAT .MODEL FLAT
.DATA .DATA
SVTABLE dd ? SVTABLE dd ?
ENDPOS dd ? ENDPOS dd ?
.CODE .CODE
IDEAL IDEAL
include "ackrtn.inc" include "ackrtn.inc"
extrn _VidSeg:dword extrn _VidSeg:dword
extrn _Resolution:word extrn _Resolution:word
extrn _ScreenOffset:word extrn _ScreenOffset:word
extrn _bmDistance:dword extrn _bmDistance:dword
extrn _bmWall:dword extrn _bmWall:dword
extrn _scPtr:dword extrn _scPtr:dword
extrn _VidTop:dword extrn _VidTop:dword
extrn _VidBottom:dword extrn _VidBottom:dword
extrn _Floors1:dword extrn _Floors1:dword
extrn _Floors2:dword extrn _Floors2:dword
extrn _gPalTable:dword extrn _gPalTable:dword
extrn _gWinStartX:word extrn _gWinStartX:word
extrn _gWinStartY:word extrn _gWinStartY:word
extrn _gWinEndX:word extrn _gWinEndX:word
extrn _gWinEndY:word extrn _gWinEndY:word
extrn _gWinHeight:word extrn _gWinHeight:word
extrn _ViewHeight:word extrn _ViewHeight:word
extrn _SysFlags:word extrn _SysFlags:word
extrn _Slice:byte extrn _Slice:byte
extrn _gScrnBuffer:dword extrn _gScrnBuffer:dword
extrn _gCenterOff:word extrn _gCenterOff:word
extrn _Floorht:word extrn _Floorht:word
extrn _Floorscr:dword extrn _Floorscr:dword
extrn _gWinStartOffset:dword extrn _gWinStartOffset:dword
extrn _scVid:dword extrn _scVid:dword
extrn _scWall:dword extrn _scWall:dword
extrn _scPal:dword extrn _scPal:dword
extrn _scdst:word extrn _scdst:word
extrn _scwht:word extrn _scwht:word
extrn _scmulti:word extrn _scmulti:word
extrn _sctopht:word extrn _sctopht:word
extrn _scbotht:word extrn _scbotht:word
extrn _scsavwht:word extrn _scsavwht:word
extrn _scmulcnt:word extrn _scmulcnt:word
extrn _scsavVid:dword extrn _scsavVid:dword
extrn _scbNum:word extrn _scbNum:word
extrn _scMulData:dword extrn _scMulData:dword
extrn _scColumn:dword extrn _scColumn:dword
extrn _WallbMaps:dword extrn _WallbMaps:dword
extrn _LowerTable:dword extrn _LowerTable:dword
extrn _gBottomOff:dword extrn _gBottomOff:dword
ACKEXT ShowColLow ACKEXT ShowColLow
ACKEXT ShowColMaskLow ACKEXT ShowColMaskLow
ACKPUBS ShowCol ACKPUBS ShowCol
ACKPUBS ShowColMask ACKPUBS ShowColMask
ACKPUBS DrawWalls ACKPUBS DrawWalls
align 2 align 2
@ -77,149 +77,149 @@ align 2
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC ShowCol ACKPROC ShowCol
push ebp push ebp
push esi push esi
push edi push edi
mov edi,[_scVid] ;Video buffer position mov edi,[_scVid] ;Video buffer position
mov ebp,[_scPal] ;Pointer to palette for shading mov ebp,[_scPal] ;Pointer to palette for shading
mov ax,[_scwht] ;Height to use mov ax,[_scwht] ;Height to use
mov [_scsavwht],ax ;save for later mov [_scsavwht],ax ;save for later
movzx ecx,[_sctopht] movzx ecx,[_sctopht]
mov ebx,[_scWall] mov ebx,[_scWall]
add ebx,ecx add ebx,ecx
mov [_bmWall],ebx mov [_bmWall],ebx
mov ch,al mov ch,al
inc ch inc ch
mov esi,[_bmDistance] mov esi,[_bmDistance]
mov esi,[_LowerTable+esi*4] mov esi,[_LowerTable+esi*4]
mov [SVTABLE],esi mov [SVTABLE],esi
mov eax,0 mov eax,0
mov ebx,0 mov ebx,0
test [word ptr _scbNum],WALL_TYPE_UPPER test [word ptr _scbNum],WALL_TYPE_UPPER
jz short toprun jz short toprun
mov edx,[_bmDistance] mov edx,[_bmDistance]
zztoploop: zztoploop:
dec ch dec ch
jz short zzdomulti jz short zzdomulti
sub di,320 sub di,320
add bx,dx add bx,dx
cmp bh,cl cmp bh,cl
jge short zzdomulti jge short zzdomulti
jmp zztoploop jmp zztoploop
zzdomulti: zzdomulti:
mov [_scwht],cx mov [_scwht],cx
mov [_scsavVid],edi mov [_scsavVid],edi
jmp chkmulti jmp chkmulti
toprun: toprun:
mov ebx,[_bmWall] mov ebx,[_bmWall]
toploop: toploop:
movzx edx,[word ptr esi] movzx edx,[word ptr esi]
cmp dl,cl cmp dl,cl
jg short botrun jg short botrun
lea esi,[esi+2] lea esi,[esi+2]
neg edx neg edx
mov al,[ebx+edx] mov al,[ebx+edx]
mov al,[ebp+eax] mov al,[ebp+eax]
mov [edi],al mov [edi],al
add edi,-320 add edi,-320
dec ch dec ch
jnz toploop jnz toploop
botrun: botrun:
mov [_scwht],cx mov [_scwht],cx
mov [_scsavVid],edi mov [_scsavVid],edi
mov edi,[_scVid] mov edi,[_scVid]
mov cx,[_scbotht] mov cx,[_scbotht]
mov dx,[_scsavwht] mov dx,[_scsavwht]
mov ch,dl mov ch,dl
mov esi,[SVTABLE] mov esi,[SVTABLE]
inc ebx inc ebx
dec cl dec cl
botloop: botloop:
lea edi,[edi+320] lea edi,[edi+320]
movzx edx,[word ptr esi] movzx edx,[word ptr esi]
cmp dl,cl cmp dl,cl
jge short chkmulti jge short chkmulti
lea esi,[esi+2] lea esi,[esi+2]
mov al,[ebx+edx] mov al,[ebx+edx]
mov al,[ebp+eax] mov al,[ebp+eax]
mov [edi],al mov [edi],al
dec ch dec ch
jnz botloop jnz botloop
chkmulti: chkmulti:
mov edi,[_scsavVid] mov edi,[_scsavVid]
cmp [word ptr _scmulti],0 cmp [word ptr _scmulti],0
jz alldone jz alldone
mov cx,[_scmulcnt] mov cx,[_scmulcnt]
mov ebx,[_scMulData] ;ptr to count and wall data mov ebx,[_scMulData] ;ptr to count and wall data
mov cl,[ebx] ;get number of walls to draw mov cl,[ebx] ;get number of walls to draw
inc ebx inc ebx
mov al,[ebx] ;first wall to show mov al,[ebx] ;first wall to show
inc ebx inc ebx
mov [_scMulData],ebx mov [_scMulData],ebx
movzx ebx,al ;get wall number movzx ebx,al ;get wall number
mov esi,[_scColumn] ;Current bitmap column to display x 64 mov esi,[_scColumn] ;Current bitmap column to display x 64
lea esi,[esi+63] lea esi,[esi+63]
mov [_scColumn],esi ;save for later use mov [_scColumn],esi ;save for later use
mov eax,[_WallbMaps] ;Get array of bitmaps mov eax,[_WallbMaps] ;Get array of bitmaps
mov ebx,[eax+ebx*4] ;Get the bitmap we are using mov ebx,[eax+ebx*4] ;Get the bitmap we are using
add ebx,esi ;point to bottom of column add ebx,esi ;point to bottom of column
mov ax,[_scwht] ;Get height of window mov ax,[_scwht] ;Get height of window
mov ch,ah mov ch,ah
cmp ch,0 ;Is there more room to draw? cmp ch,0 ;Is there more room to draw?
jz short alldone ;br if at top of window jz short alldone ;br if at top of window
mov esi,[SVTABLE] mov esi,[SVTABLE]
mov eax,0 mov eax,0
mulloop: mulloop:
movzx eax,[word ptr esi] ;Get height displacement for this row movzx eax,[word ptr esi] ;Get height displacement for this row
cmp al,64 ;Did we do the entire column? cmp al,64 ;Did we do the entire column?
jge short nextlevel ;Yes, see if more walls jge short nextlevel ;Yes, see if more walls
lea esi,[esi+2] lea esi,[esi+2]
neg eax ;Invert so we can add it below neg eax ;Invert so we can add it below
movzx eax,[byte ptr ebx+eax] ;Get the pixel from the bitmap movzx eax,[byte ptr ebx+eax] ;Get the pixel from the bitmap
mov al,[ebp+eax] ;Map it to the palette for shading mov al,[ebp+eax] ;Map it to the palette for shading
mov [edi],al ;Place it into the video buffer mov [edi],al ;Place it into the video buffer
dec ch ;Bump the window height dec ch ;Bump the window height
jz short alldone ;br if at the top of the window jz short alldone ;br if at the top of the window
sub edi,320 ;next video row sub edi,320 ;next video row
jmp mulloop jmp mulloop
nextlevel: nextlevel:
dec cl ;Bump wall count dec cl ;Bump wall count
jz short alldone ;br if no more walls jz short alldone ;br if no more walls
mov ebx,[_scMulData] ;Get pointer to the multi-ht data mov ebx,[_scMulData] ;Get pointer to the multi-ht data
movzx eax,[byte ptr ebx] ;next wall number movzx eax,[byte ptr ebx] ;next wall number
inc ebx ;Advance for next wall inc ebx ;Advance for next wall
mov [_scMulData],ebx mov [_scMulData],ebx
mov ebx,[_WallbMaps] ;Get wall array mov ebx,[_WallbMaps] ;Get wall array
mov ebx,[ebx+eax*4] ;Get wall bitmap to use mov ebx,[ebx+eax*4] ;Get wall bitmap to use
add ebx,[dword ptr _scColumn] ;add in current column add ebx,[dword ptr _scColumn] ;add in current column
mov eax,0 mov eax,0
mov esi,[SVTABLE] mov esi,[SVTABLE]
jmp mulloop jmp mulloop
alldone: alldone:
pop edi pop edi
pop esi pop esi
pop ebp pop ebp
ret ret
endp endp
align 2 align 2
@ -227,345 +227,344 @@ align 2
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC ShowColMask ACKPROC ShowColMask
push ebp push ebp
push esi push esi
push edi push edi
mov ebp,eax mov ebp,eax
mov [_scPtr],eax mov [_scPtr],eax
mov edi,[_scVid] mov edi,[_scVid]
mov edx,[_scPal] mov edx,[_scPal]
mov ax,[_scwht] mov ax,[_scwht]
mov [_scsavwht],ax mov [_scsavwht],ax
movzx ecx,[_sctopht] movzx ecx,[_sctopht]
mov ebx,[_scWall] mov ebx,[_scWall]
add ebx,ecx add ebx,ecx
mov [_bmWall],ebx mov [_bmWall],ebx
mov ch,al mov ch,al
inc ch inc ch
mov eax,0 mov eax,0
mov ebx,0 mov ebx,0
;--TEST------------------------------------------------------------------------ ;--TEST------------------------------------------------------------------------
test [word ptr _scbNum],WALL_TYPE_UPPER test [word ptr _scbNum],WALL_TYPE_UPPER
jz short m_toprun jz short m_toprun
mov ebp,[_bmDistance] mov ebp,[_bmDistance]
m_zztoploop: m_zztoploop:
dec ch dec ch
jz short m_zzdomulti jz short m_zzdomulti
add bx,bp add bx,bp
cmp bh,cl cmp bh,cl
jge short m_zzdomulti jge short m_zzdomulti
sub edi,320 sub edi,320
jmp m_zztoploop jmp m_zztoploop
m_zzdomulti: m_zzdomulti:
mov ebp,[_scPtr] mov ebp,[_scPtr]
mov [_scwht],cx mov [_scwht],cx
mov [_scsavVid],edi mov [_scsavVid],edi
jmp m_chkmulti jmp m_chkmulti
;--TEST------------------------------------------------------------------------ ;--TEST------------------------------------------------------------------------
m_toprun: m_toprun:
mov ebp,[_bmDistance] mov ebp,[_bmDistance]
mov esi,[_bmWall] mov esi,[_bmWall]
m_toploop: m_toploop:
movzx eax,bh movzx eax,bh
neg eax neg eax
movzx eax,[byte ptr esi+eax] movzx eax,[byte ptr esi+eax]
or al,al or al,al
jz short m_blank1 jz short m_blank1
mov al,[edx+eax] mov al,[edx+eax]
mov [edi],al mov [edi],al
m_blank1: m_blank1:
add bx,bp add bx,bp
cmp bh,cl cmp bh,cl
jg short m_botrun jg short m_botrun
dec ch dec ch
jz short m_botrun jz short m_botrun
sub edi,320 sub edi,320
jmp m_toploop jmp m_toploop
m_botrun: m_botrun:
mov ebp,[_scPtr] mov ebp,[_scPtr]
mov [_scwht],cx mov [_scwht],cx
mov [_scsavVid],edi mov [_scsavVid],edi
mov edi,[_scVid] mov edi,[_scVid]
mov cx,[_scbotht] mov cx,[_scbotht]
mov bx,[_scsavwht] mov bx,[_scsavwht]
mov ch,bl mov ch,bl
mov ebx,0 mov ebx,0
inc esi inc esi
mov ebp,[_bmDistance] mov ebp,[_bmDistance]
mov eax,0 mov eax,0
dec cl dec cl
m_botloop: m_botloop:
add edi,320 add edi,320
mov al,bh mov al,bh
mov al,[esi+eax] mov al,[esi+eax]
or al,al or al,al
jz short m_blank2 jz short m_blank2
mov al,[edx+eax] mov al,[edx+eax]
mov [edi],al mov [edi],al
m_blank2: m_blank2:
dec ch dec ch
jz short m_chkmulti jz short m_chkmulti
add bx,bp add bx,bp
cmp bh,cl cmp bh,cl
jl m_botloop jl m_botloop
m_chkmulti: m_chkmulti:
mov ebp,[_scPtr] mov ebp,[_scPtr]
cmp [word ptr _scmulti],0 cmp [word ptr _scmulti],0
jz short m_alldone jz short m_alldone
mov cx,[_scmulcnt] mov cx,[_scmulcnt]
mov bx,[_scwht] mov bx,[_scwht]
mov ch,bh mov ch,bh
cmp ch,0 cmp ch,0
jz short m_alldone jz short m_alldone
mov edi,[_scsavVid] mov edi,[_scsavVid]
mov ebx,[_scWall] mov ebx,[_scWall]
add ebx,63 add ebx,63
mov [_bmWall],ebx mov [_bmWall],ebx
mov ebx,0 mov ebx,0
mov ebp,[_bmDistance] mov ebp,[_bmDistance]
mov esi,[_bmWall] mov esi,[_bmWall]
m_mulloop: m_mulloop:
sub edi,320 sub edi,320
movzx eax,bh movzx eax,bh
neg eax neg eax
movzx eax,[byte ptr esi+eax] movzx eax,[byte ptr esi+eax]
or al,al or al,al
jz m_blank3 jz m_blank3
mov al,[edx+eax] mov al,[edx+eax]
mov [edi],al mov [edi],al
m_blank3: m_blank3:
dec ch dec ch
jz short m_alldone jz short m_alldone
add bx,bp add bx,bp
cmp bh,64 cmp bh,64
jge short m_nextlevel jge short m_nextlevel
jmp m_mulloop jmp m_mulloop
m_nextlevel: m_nextlevel:
mov ebx,0 mov ebx,0
dec cl dec cl
jnz m_mulloop jnz m_mulloop
m_alldone: m_alldone:
pop edi pop edi
pop esi pop esi
pop ebp pop ebp
ret ret
endp endp
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; This routine runs through the list of slices and draws the walls. ; This routine runs through the list of slices and draws the walls.
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC DrawWalls ACKPROC DrawWalls
push ebp push ebp
push esi push esi
push edi push edi
mov ax,[_gWinHeight] mov ax,[_gWinHeight]
shr ax,1 shr ax,1
mov [_Floorht],ax mov [_Floorht],ax
mov ax,[_ViewHeight] mov ax,[_ViewHeight]
mov [_sctopht],ax mov [_sctopht],ax
mov dx,64 mov dx,64
sub dx,ax sub dx,ax
mov [_scbotht],dx mov [_scbotht],dx
movsx ebx,[word ptr _gWinStartX] movsx ebx,[word ptr _gWinStartX]
movsx ecx,[_gCenterOff] movsx ecx,[_gCenterOff]
add ecx,ebx add ecx,ebx
add ecx,[_gScrnBuffer] add ecx,[_gScrnBuffer]
mov [_scVid],ecx mov [_scVid],ecx
cmp [word ptr _Resolution],1 ;is this low resolution? cmp [word ptr _Resolution],1 ;is this low resolution?
je stw_lowres ;yes, perform faster draw je stw_lowres ;yes, perform faster draw
movzx eax,[_gWinEndX] movzx eax,[_gWinEndX]
imul eax,saSize imul eax,saSize
mov [ENDPOS],eax mov [ENDPOS],eax
imul ebx,saSize imul ebx,saSize
stw010: stw010:
mov ebp,offset _Slice ; offset to slices array mov ebp,offset _Slice ; offset to slices array
add ebp,ebx add ebp,ebx
stw020: stw020:
cmp [byte ptr ebp+saActive],0 ;is this an active slice? cmp [byte ptr ebp+saActive],0 ;is this an active slice?
jz short stw030 ;nope, so it's the last one jz short stw030 ;nope, so it's the last one
cmp [dword ptr ebp+saNext],0 ;is this the last slice? cmp [dword ptr ebp+saNext],0 ;is this the last slice?
jz short stw030 ;yes, so can't go further jz short stw030 ;yes, so can't go further
mov ebp,[dword ptr ebp+saNext] ;point to next slice mov ebp,[dword ptr ebp+saNext] ;point to next slice
jmp short stw020 jmp short stw020
stw030: stw030:
mov ax,[word ptr ebp+sabNumber] ;bitmap number mov ax,[word ptr ebp+sabNumber] ;bitmap number
mov cx,ax mov cx,ax
and cx,0ffh ;isolate number from flags and cx,0ffh ;isolate number from flags
mov [_scmulcnt],cx ;save as current multi count mov [_scmulcnt],cx ;save as current multi count
mov [_scbNum],ax ;and bitmap number and flags 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 test ax,WALL_TYPE_MULTI
jz short stw040 jz short stw040
mov esi,[dword ptr ebp+samPtr] mov esi,[dword ptr ebp+samPtr]
mov [_scMulData],esi mov [_scMulData],esi
or esi,esi ;is there multi-ht data? or esi,esi ;is there multi-ht data?
jz short stw040 ;br if not jz short stw040 ;br if not
mov cx,1 ;set multi-flag to yes mov cx,1 ;set multi-flag to yes
stw040: stw040:
mov [_scmulti],cx mov [_scmulti],cx
mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps
movzx esi,al ;get low byte of bitmap number movzx esi,al ;get low byte of bitmap number
shl esi,2 shl esi,2
mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer
movsx ecx,[word ptr ebp+saDist] ;distance to slice movsx ecx,[word ptr ebp+saDist] ;distance to slice
mov [_bmDistance],ecx ;save for draw routine mov [_bmDistance],ecx ;save for draw routine
shr ecx,6 ;bring it down into palette range shr ecx,6 ;bring it down into palette range
cmp ecx,15 ;check against max palette number cmp ecx,15 ;check against max palette number
jbe short stw050 jbe short stw050
mov ecx,15 ;force to max if above mov ecx,15 ;force to max if above
stw050: stw050:
shl ecx,8 ;x256 for palette entry shl ecx,8 ;x256 for palette entry
mov edi,[_gPalTable] ;pointer to palette table mov edi,[_gPalTable] ;pointer to palette table
add edi,ecx add edi,ecx
movsx ecx,[word ptr ebp+sabColumn] ;column of bitmap slice movsx ecx,[word ptr ebp+sabColumn] ;column of bitmap slice
shl ecx,6 ;x64 to get correct row (column) shl ecx,6 ;x64 to get correct row (column)
add esi,ecx ;adjust wall point to correct column add esi,ecx ;adjust wall point to correct column
mov [_scColumn],ecx ;save for multi-ht walls mov [_scColumn],ecx ;save for multi-ht walls
mov [_scWall],esi mov [_scWall],esi
mov [_scPal],edi mov [_scPal],edi
mov eax,0 mov eax,0
mov [_scsavVid],eax ;null out saved video mov [_scsavVid],eax ;null out saved video
mov ax,[_Floorht] ;window height / 2 saved earlier mov ax,[_Floorht] ;window height / 2 saved earlier
mov [_scwht],ax mov [_scwht],ax
mov esi,ebx mov esi,ebx
call [dword ptr ebp+saFnc] call [dword ptr ebp+saFnc]
mov ebx,esi mov ebx,esi
stw075: stw075:
cmp [dword ptr ebp+saPrev],0 ;is this the first slice? cmp [dword ptr ebp+saPrev],0 ;is this the first slice?
jz short stw080 ;yes, go to next column jz short stw080 ;yes, go to next column
mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice
jmp stw030 ;and start again with same column jmp stw030 ;and start again with same column
stw080: stw080:
inc [dword ptr _scVid] ;next video position inc [dword ptr _scVid] ;next video position
add ebx,saSize add ebx,saSize
cmp ebx,[ENDPOS] cmp ebx,[ENDPOS]
ja stw_getout ;yes, get out ja stw_getout ;yes, get out
jmp stw010 jmp stw010
stw_lowres: stw_lowres:
mov eax,ebx ; current column of display mov eax,ebx ; current column of display
imul eax,saSize ; size of slice structure imul eax,saSize ; size of slice structure
mov ebp,offset _Slice ; offset to slices mov ebp,offset _Slice ; offset to slices
add ebp,eax add ebp,eax
stwlr020: stwlr020:
cmp [byte ptr ebp+saActive],0 ;is this an active slice? cmp [byte ptr ebp+saActive],0 ;is this an active slice?
jz short stwlr030 ;nope, so it's the last one jz short stwlr030 ;nope, so it's the last one
cmp [dword ptr ebp+saNext],0 ;is this the last slice? cmp [dword ptr ebp+saNext],0 ;is this the last slice?
jz short stwlr030 ;yes, so can't go further jz short stwlr030 ;yes, so can't go further
mov ebp,[dword ptr ebp+saNext] ;point to next slice mov ebp,[dword ptr ebp+saNext] ;point to next slice
jmp short stwlr020 jmp short stwlr020
stwlr030: stwlr030:
mov ax,[word ptr ebp+sabNumber] ;bitmap number mov ax,[word ptr ebp+sabNumber] ;bitmap number
mov cx,ax mov cx,ax
and cx,0ffh ;isolate number from flags and cx,0ffh ;isolate number from flags
mov [_scmulcnt],cx ;save as current multi count mov [_scmulcnt],cx ;save as current multi count
mov [_scbNum],ax ;and bitmap number and flags 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 test ax,WALL_TYPE_MULTI
jz short stwlr040 jz short stwlr040
mov esi,[dword ptr ebp+samPtr] mov esi,[dword ptr ebp+samPtr]
mov [_scMulData],esi mov [_scMulData],esi
or esi,esi ;is there multi-height data? or esi,esi ;is there multi-height data?
jz short stwlr040 ;br if not jz short stwlr040 ;br if not
mov cx,1 ;set multi-flag to yes mov cx,1 ;set multi-flag to yes
stwlr040: stwlr040:
mov [_scmulti],cx mov [_scmulti],cx
mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps mov ecx,[dword ptr ebp+sabMap] ;get pointer to bitmaps
movzx esi,al ;get low byte of bitmap number movzx esi,al ;get low byte of bitmap number
shl esi,2 shl esi,2
mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer mov esi,[dword ptr ecx+esi] ;get actual bitmap pointer
movsx ecx,[word ptr ebp+saDist] ;distance to slice movsx ecx,[word ptr ebp+saDist] ;distance to slice
mov [_bmDistance],ecx ;save for draw routine mov [_bmDistance],ecx ;save for draw routine
shr ecx,6 ;bring it down into palette range shr ecx,6 ;bring it down into palette range
cmp ecx,15 ;check against max palette number cmp ecx,15 ;check against max palette number
jbe short stwlr050 jbe short stwlr050
mov ecx,15 ;force to max if above mov ecx,15 ;force to max if above
stwlr050: stwlr050:
shl ecx,8 ;x256 for palette entry shl ecx,8 ;x256 for palette entry
mov edi,[_gPalTable] ;pointer to palette table mov edi,[_gPalTable] ;pointer to palette table
add edi,ecx add edi,ecx
movsx ecx,[byte ptr ebp+sabColumn] ;column of bitmap slice movsx ecx,[byte ptr ebp+sabColumn] ;column of bitmap slice
shl ecx,6 ;x64 to get correct row (column) shl ecx,6 ;x64 to get correct row (column)
add esi,ecx ;adjust wall point to correct column add esi,ecx ;adjust wall point to correct column
mov [_scColumn],ecx ;save for multi-ht walls mov [_scColumn],ecx ;save for multi-ht walls
mov [_scWall],esi mov [_scWall],esi
mov [_scPal],edi mov [_scPal],edi
mov eax,0 mov eax,0
mov [_scsavVid],eax ;null out saved video mov [_scsavVid],eax ;null out saved video
mov ax,[_Floorht] ;window height / 2 saved earlier mov ax,[_Floorht] ;window height / 2 saved earlier
mov [_scwht],ax mov [_scwht],ax
mov esi,ebx mov esi,ebx
cmp [byte ptr ebp+saType],ST_WALL ;transparent wall? cmp [byte ptr ebp+saType],ST_WALL ;transparent wall?
je short stwlr060 ;nope, use solid slice routine je short stwlr060 ;nope, use solid slice routine
ACKCALL ShowColMaskLow ACKCALL ShowColMaskLow
jmp short stwlr070 jmp short stwlr070
stwlr060: stwlr060:
ACKCALL ShowColLow ACKCALL ShowColLow
stwlr070: stwlr070:
mov ebx,esi mov ebx,esi
cmp [dword ptr ebp+saPrev],0 ;is this the first slice? cmp [dword ptr ebp+saPrev],0 ;is this the first slice?
jz short stwlr080 ;yes, go to next column jz short stwlr080 ;yes, go to next column
mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice mov ebp,[dword ptr ebp+saPrev] ;pick up previous slice
jmp stwlr030 ;and start again with same column jmp stwlr030 ;and start again with same column
stwlr080: stwlr080:
add [dword ptr _scVid],2 ;next video position add [dword ptr _scVid],2 ;next video position
inc ebx ;next column inc ebx ;next column
inc ebx ;next column inc ebx ;next column
cmp bx,[word ptr _gWinEndX] ;are we at the end of the window? cmp bx,[word ptr _gWinEndX] ;are we at the end of the window?
ja short stw_getout ;yes, get out ja short stw_getout ;yes, get out
jmp stw_lowres jmp stw_lowres
stw_getout: stw_getout:
pop edi pop edi
pop esi pop esi
pop ebp pop ebp
ret ret
endp endp
end end


View file

@ -22,7 +22,7 @@
extrn _yPglobal:dword extrn _yPglobal:dword
extrn _xBegGlobal:dword extrn _xBegGlobal:dword
extrn _yBegGlobal:dword extrn _yBegGlobal:dword
extrn _aeGlobal:dword extrn _aeGlobal:dword
extrn _xGridGlobal:dword extrn _xGridGlobal:dword
extrn _yGridGlobal:dword extrn _yGridGlobal:dword
extrn _xPglobalHI:dword extrn _xPglobalHI:dword
@ -46,7 +46,7 @@
extrn _CeilingHeight:word extrn _CeilingHeight:word
extrn _gTopColor:byte extrn _gTopColor:byte
extrn _gBottomColor:byte extrn _gBottomColor:byte
extrn _PlayerAngle:word extrn _PlayerAngle:word
extrn _gScrnBuffer:dword extrn _gScrnBuffer:dword
extrn _gBkgdBuffer:dword extrn _gBkgdBuffer:dword
extrn _gCenterOff:word extrn _gCenterOff:word
@ -70,7 +70,7 @@
extrn _ViewColumn:word extrn _ViewColumn:word
extrn _SinTable:dword extrn _SinTable:dword
extrn _CosTable:dword extrn _CosTable:dword
extrn _LongTanTable:dword extrn _LongTanTable:dword
extrn _LongInvTanTable:dword extrn _LongInvTanTable:dword
extrn _InvCosTable:byte extrn _InvCosTable:byte
extrn _InvSinTable:byte extrn _InvSinTable:byte
@ -94,7 +94,7 @@
extrn _x_yPos:dword extrn _x_yPos:dword
extrn _x_xNext:dword extrn _x_xNext:dword
extrn _x_yNext:dword extrn _x_yNext:dword
extrn _y_xPos:dword extrn _y_xPos:dword
extrn _y_yPos:dword extrn _y_yPos:dword
extrn _y_xNext:dword extrn _y_xNext:dword
extrn _y_yNext:dword extrn _y_yNext:dword
@ -118,7 +118,7 @@
extrn _Floorptr2:dword extrn _Floorptr2:dword
extrn _Floorht:dword extrn _Floorht:dword
extrn _Floorwt:dword extrn _Floorwt:dword
extrn _Floorvht:word extrn _Floorvht:word
extrn _Flooreht:word extrn _Flooreht:word
extrn _FloorLastbNum:dword extrn _FloorLastbNum:dword
extrn _FloorLastbm:dword extrn _FloorLastbm:dword
@ -133,15 +133,15 @@
ACKEXT DrawBackDrop ACKEXT DrawBackDrop
ACKEXT ShowCol ACKEXT ShowCol
ACKEXT ShowColMask ACKEXT ShowColMask
ACKEXT FindDoor ACKEXT FindDoor
ACKEXT xRayCast ACKEXT xRayCast
ACKEXT yRayCast ACKEXT yRayCast
ACKPUBS xxxAckDrawFloor ACKPUBS xxxAckDrawFloor
ACKPUBS xxxAckDrawFloorOnly ACKPUBS xxxAckDrawFloorOnly
ACKPUBS xxxAckDrawCeilingOnly ACKPUBS xxxAckDrawCeilingOnly
.DATA .DATA
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; Globals used by the AckDrawFloor routine ; Globals used by the AckDrawFloor routine
@ -157,45 +157,45 @@ FSCRN dd ?
CSCRN dd ? CSCRN dd ?
CV dd ? CV dd ?
SV dd ? SV dd ?
BA dd ? BA dd ?
BA1 dd ? BA1 dd ?
ZDPTR dd ? ZDPTR dd ?
POS dd ? POS dd ?
BMPOS dd ? BMPOS dd ?
MPOS dd ? MPOS dd ?
MPOSHI dd ? MPOSHI dd ?
SCANTBL dd ? SCANTBL dd ?
LINENUM dd ? LINENUM dd ?
LASTDIST dd ? LASTDIST dd ?
;LASTX dd ? ;LASTX dd ?
;LASTY dd ? ;LASTY dd ?
LASTEBP dd ? LASTEBP dd ?
LASTEAX dd ? LASTEAX dd ?
LASTEDX dd ? LASTEDX dd ?
WALLDIST dd ? WALLDIST dd ?
.CODE .CODE
IDEAL IDEAL
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC xxxAckDrawFloor ACKPROC xxxAckDrawFloor
push ebp push ebp
push esi push esi
push edi push edi
push ebx push ebx
push ecx push ecx
push edx push edx
movzx eax,[word ptr _PlayerAngle] movzx eax,[word ptr _PlayerAngle]
mov ecx,eax mov ecx,eax
sub eax,INT_ANGLE_32 sub eax,INT_ANGLE_32
jnc short adf_20 jnc short adf_20
add eax,INT_ANGLE_360 add eax,INT_ANGLE_360
adf_20: adf_20:
mov ebx,640 mov ebx,640
cdq cdq
idiv ebx idiv ebx
mov [BCOL],edx mov [BCOL],edx
@ -214,12 +214,12 @@ adf_30:
sar eax,1 sar eax,1
movzx ebx,[word ptr _gWinEndY] movzx ebx,[word ptr _gWinEndY]
sub ebx,eax sub ebx,eax
inc ebx inc ebx
sub ebx,5 ; 6 sub ebx,5 ; 6
mov [EY],ebx mov [EY],ebx
mov edi,[_gScrnBuffer] mov edi,[_gScrnBuffer]
movzx eax,[word ptr _gCenterOff] movzx eax,[word ptr _gCenterOff]
mov ebx,eax mov ebx,eax
add eax,1920 add eax,1920
add eax,edi add eax,edi
mov [BFSCRN],eax mov [BFSCRN],eax
@ -236,14 +236,14 @@ adf_30:
adf_loop: adf_loop:
mov eax,[_CosTable] mov eax,[_CosTable]
shl ebx,2 shl ebx,2
mov eax,[eax+ebx] mov eax,[eax+ebx]
mov [CV],eax mov [CV],eax
mov eax,[_SinTable] mov eax,[_SinTable]
mov eax,[eax+ebx] mov eax,[eax+ebx]
mov [SV],eax mov [SV],eax
mov eax,[dword ptr _WallDistTable+ebp*4] mov eax,[dword ptr _WallDistTable+ebp*4]
mov [WALLDIST],eax mov [WALLDIST],eax
mov eax,[BCSCRN] mov eax,[BCSCRN]
mov [CSCRN],eax mov [CSCRN],eax
@ -260,17 +260,17 @@ adf_loop:
adf_l10: adf_l10:
mov eax,[_BackArray+ebx*4] mov eax,[_BackArray+ebx*4]
add eax,ecx add eax,ecx
mov [BA1],eax mov [BA1],eax
inc ebx inc ebx
cmp ebx,640 cmp ebx,640
jb short adf_l20 jb short adf_l20
sub ebx,ebx sub ebx,ebx
adf_l20: adf_l20:
mov [BCOL],ebx mov [BCOL],ebx
lea esi,[offset _zdTable] lea esi,[offset _zdTable]
mov ecx,[EY] ;Number of rows to draw mov ecx,[EY] ;Number of rows to draw
imul eax,ebp,800 imul eax,ebp,800
add esi,eax add esi,eax
@ -284,7 +284,7 @@ adf_yloop:
cmp edx,[WALLDIST] cmp edx,[WALLDIST]
jb short adf_distokay jb short adf_distokay
lea edi,[edi+320] lea edi,[edi+320]
jmp adf_ycont jmp adf_ycont
adf_distokay: adf_distokay:
cmp edx,[LASTDIST] cmp edx,[LASTDIST]
@ -294,7 +294,7 @@ adf_distokay:
mov ebp,[LASTEBP] mov ebp,[LASTEBP]
mov eax,[LASTEAX] mov eax,[LASTEAX]
mov edx,[LASTEDX] mov edx,[LASTEDX]
jmp short adf_samedist jmp short adf_samedist
adf_newdist: adf_newdist:
mov [LASTDIST],edx mov [LASTDIST],edx
@ -308,7 +308,7 @@ adf_newdist:
add eax,edx add eax,edx
mov edx,[_yPglobal] mov edx,[_yPglobal]
add ebx,edx add ebx,edx
; mov [LASTX],eax ; mov [LASTX],eax
; mov [LASTY],ebx ; mov [LASTY],ebx
;adf_samedist: ;adf_samedist:
@ -318,7 +318,7 @@ adf_newdist:
sar ebp,6 sar ebp,6
add ebp,edx ;Pos within floor and ceiling maps add ebp,edx ;Pos within floor and ceiling maps
and ebx,63 and ebx,63
shl ebx,6 shl ebx,6
and eax,63 and eax,63
add eax,ebx ;bitmap position add eax,ebx ;bitmap position
@ -333,14 +333,14 @@ adf_newdist:
mov edx,[_WallbMaps] mov edx,[_WallbMaps]
mov edx,[edx+ebx*4] mov edx,[edx+ebx*4]
movzx edx,[byte ptr edx+eax] movzx edx,[byte ptr edx+eax]
mov ebx,[SCANTBL] mov ebx,[SCANTBL]
mov dl,[ebx+edx] mov dl,[ebx+edx]
mov dh,dl mov dh,dl
mov [LASTEDX],edx mov [LASTEDX],edx
adf_samedist: adf_samedist:
mov [edi],dx mov [edi],dx
lea edi,[edi+320] lea edi,[edi+320]
movzx ebx,[word ptr _CeilMap+ebp] movzx ebx,[word ptr _CeilMap+ebp]
mov ebp,[CSCRN] mov ebp,[CSCRN]
@ -356,7 +356,7 @@ adf_samedist:
mov [ebp],ax mov [ebp],ax
mov eax,[LINENUM] mov eax,[LINENUM]
add eax,4 add eax,4
mov [LINENUM],eax mov [LINENUM],eax
mov eax,[_scantables+eax] mov eax,[_scantables+eax]
mov [SCANTBL],eax mov [SCANTBL],eax
@ -380,7 +380,7 @@ adf_ycont:
mov eax,[LINENUM] mov eax,[LINENUM]
add eax,4 add eax,4
mov [LINENUM],eax mov [LINENUM],eax
mov eax,[_scantables+eax] mov eax,[_scantables+eax]
mov [SCANTBL],eax mov [SCANTBL],eax
sub [dword ptr CSCRN],320 sub [dword ptr CSCRN],320
dec [dword ptr BA] dec [dword ptr BA]
@ -404,7 +404,7 @@ adf_l90:
add [dword ptr BCSCRN],2 add [dword ptr BCSCRN],2
pop ebp pop ebp
lea ebp,[ebp+2] lea ebp,[ebp+2]
cmp ebp,320 cmp ebp,320
jb adf_loop jb adf_loop
@ -422,12 +422,12 @@ adf_exit:
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC xxxAckDrawFloorOnly ACKPROC xxxAckDrawFloorOnly
push ebp push ebp
push esi push esi
push edi push edi
push ebx push ebx
push ecx push ecx
push edx push edx
movzx eax,[word ptr _PlayerAngle] movzx eax,[word ptr _PlayerAngle]
mov ecx,eax mov ecx,eax
@ -446,7 +446,7 @@ adfo_20:
mov [HEIGHT],eax mov [HEIGHT],eax
sub ecx,INT_ANGLE_32 sub ecx,INT_ANGLE_32
jnc short adfo_30 jnc short adfo_30
add ecx,INT_ANGLE_360 add ecx,INT_ANGLE_360
adfo_30: adfo_30:
@ -470,7 +470,7 @@ adfo_30:
mov ebp,0 mov ebp,0
mov [LINENUM],ebp mov [LINENUM],ebp
mov ebx,[dword ptr _scantables] mov ebx,[dword ptr _scantables]
mov [SCANTBL],ebx mov [SCANTBL],ebx
mov ebx,[VA] mov ebx,[VA]
adfo_loop: adfo_loop:
@ -518,7 +518,7 @@ adfo_l20:
adfo_yloop: adfo_yloop:
mov edx,[esi] mov edx,[esi]
lea esi,[esi+4] lea esi,[esi+4]
mov eax,[CV] mov eax,[CV]
mov ebx,[SV] mov ebx,[SV]
imul eax,edx imul eax,edx
imul ebx,edx imul ebx,edx
@ -542,7 +542,7 @@ adfo_yloop:
mov ebx,0 mov ebx,0
shl ebp,1 shl ebp,1
mov bx,[word ptr _FloorMap+ebp] mov bx,[word ptr _FloorMap+ebp]
mov edx,[_WallbMaps] mov edx,[_WallbMaps]
mov edx,[edx+ebx*4] mov edx,[edx+ebx*4]
@ -566,7 +566,7 @@ adfo_ycont:
mov eax,[LINENUM] mov eax,[LINENUM]
add eax,4 add eax,4
mov [LINENUM],eax mov [LINENUM],eax
mov eax,[_scantables+eax] mov eax,[_scantables+eax]
mov [SCANTBL],eax mov [SCANTBL],eax
dec [dword ptr BA] dec [dword ptr BA]
dec [dword ptr BA1] dec [dword ptr BA1]
@ -590,7 +590,7 @@ adfo_l90:
pop ebp pop ebp
lea ebp,[ebp+2] lea ebp,[ebp+2]
cmp ebp,320 cmp ebp,320
jb adfo_loop jb adfo_loop
adfo_exit: adfo_exit:
pop edx pop edx
@ -607,14 +607,14 @@ adfo_exit:
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC xxxAckDrawCeilingOnly ACKPROC xxxAckDrawCeilingOnly
push ebp push ebp
push esi push esi
push edi push edi
push ebx push ebx
push ecx push ecx
push edx push edx
movzx eax,[word ptr _PlayerAngle] movzx eax,[word ptr _PlayerAngle]
mov ecx,eax mov ecx,eax
sub eax,INT_ANGLE_32 sub eax,INT_ANGLE_32
jnc short adco_20 jnc short adco_20
@ -802,4 +802,3 @@ adco_exit:
end end


View file

@ -782,7 +782,7 @@ buv070:
cmp [word ptr _LastWallHeight],200 ; No need to check if > 200 cmp [word ptr _LastWallHeight],200 ; No need to check if > 200
jg short buv080 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 cmp [dword ptr eax+saNext],0 ; Check for any more walls
je short buv080 je short buv080
cmp [word ptr eax+saDist],96 ; Distance from POV to slice is cmp [word ptr eax+saDist],96 ; Distance from POV to slice is
@ -827,4 +827,3 @@ buv_exit:
end end


View file

@ -1,12 +1,12 @@
IDEAL IDEAL
JUMPS JUMPS
P386 P386
P387 ; Allow 386 processor P387 ; Allow 386 processor
MASM MASM
.MODEL FLAT ;32-bit OS/2 model .MODEL FLAT ;32-bit OS/2 model
.DATA .DATA
@ -16,108 +16,108 @@ SAVEVID dd ?
SAVEROW dd ? SAVEROW dd ?
.CODE .CODE
IDEAL IDEAL
include "ackrtn.inc" include "ackrtn.inc"
extrn _BackDropRows:dword extrn _BackDropRows:dword
extrn _PlayerAngle:word extrn _PlayerAngle:word
extrn _BackArray:dword extrn _BackArray:dword
extrn _Resolution:word extrn _Resolution:word
extrn _ScreenOffset:word extrn _ScreenOffset:word
extrn _bmDistance:dword extrn _bmDistance:dword
extrn _bmWall:dword extrn _bmWall:dword
extrn _scPtr:dword extrn _scPtr:dword
extrn _VidTop:dword extrn _VidTop:dword
extrn _VidBottom:dword extrn _VidBottom:dword
extrn _Floors1:dword extrn _Floors1:dword
extrn _Floors2:dword extrn _Floors2:dword
extrn _gPalTable:dword extrn _gPalTable:dword
extrn _gWinStartX:word extrn _gWinStartX:word
extrn _gWinStartY:word extrn _gWinStartY:word
extrn _gWinEndX:word extrn _gWinEndX:word
extrn _gWinEndY:word extrn _gWinEndY:word
extrn _gWinHeight:word extrn _gWinHeight:word
extrn _ViewHeight:word extrn _ViewHeight:word
extrn _SysFlags:word extrn _SysFlags:word
extrn _Slice:byte extrn _Slice:byte
extrn _gScrnBuffer:dword extrn _gScrnBuffer:dword
extrn _gCenterOff:word extrn _gCenterOff:word
extrn _gCenterRow:word extrn _gCenterRow:word
extrn _Floorscr:dword extrn _Floorscr:dword
extrn _gWinStartOffset:dword extrn _gWinStartOffset:dword
extrn _scVid:dword extrn _scVid:dword
extrn _scWall:dword extrn _scWall:dword
extrn _scPal:dword extrn _scPal:dword
extrn _scdst:word extrn _scdst:word
extrn _scwht:word extrn _scwht:word
extrn _scmulti:word extrn _scmulti:word
extrn _sctopht:word extrn _sctopht:word
extrn _scbotht:word extrn _scbotht:word
extrn _scsavwht:word extrn _scsavwht:word
extrn _scmulcnt:word extrn _scmulcnt:word
extrn _scsavVid:dword extrn _scsavVid:dword
extrn _scbNum:word extrn _scbNum:word
extrn _scMulData:dword extrn _scMulData:dword
extrn _scColumn:dword extrn _scColumn:dword
extrn _WallbMaps:dword extrn _WallbMaps:dword
extrn _LowerTable:dword extrn _LowerTable:dword
extrn _gBottomOff:dword extrn _gBottomOff:dword
extrn _LightFlag:word extrn _LightFlag:word
ACKEXT ShowCol ACKEXT ShowCol
ACKEXT ShowColMask ACKEXT ShowColMask
extrn _Resolution:word extrn _Resolution:word
extrn _Flooru:dword extrn _Flooru:dword
extrn _Floorv:dword extrn _Floorv:dword
extrn _Floordu:dword extrn _Floordu:dword
extrn _Floordv:dword extrn _Floordv:dword
extrn _Floorkx:dword extrn _Floorkx:dword
extrn _Floorky:dword extrn _Floorky:dword
extrn _Floorku:dword extrn _Floorku:dword
extrn _Floorkv:dword extrn _Floorkv:dword
extrn _Floorkdu:dword extrn _Floorkdu:dword
extrn _Floorkdv:dword extrn _Floorkdv:dword
extrn _Floorbm:dword extrn _Floorbm:dword
extrn _Floorscr:dword extrn _Floorscr:dword
extrn _Floors1:dword extrn _Floors1:dword
extrn _Floors2:dword extrn _Floors2:dword
extrn _FloorscrTop:dword extrn _FloorscrTop:dword
extrn _Floorptr2:dword extrn _Floorptr2:dword
extrn _Floorwt:dword extrn _Floorwt:dword
extrn _Floorvht:word extrn _Floorvht:word
extrn _Flooreht:word extrn _Flooreht:word
extrn _FloorMap:word extrn _FloorMap:word
extrn _gScrnBufferCenter:dword extrn _gScrnBufferCenter:dword
extrn _gWinHalfHeight:word extrn _gWinHalfHeight:word
extrn _zdTable:dword extrn _zdTable:dword
extrn _CosTable:dword extrn _CosTable:dword
extrn _SinTable:dword extrn _SinTable:dword
extrn _xPglobal:dword extrn _xPglobal:dword
extrn _yPglobal:dword extrn _yPglobal:dword
extrn _WallDistTable:dword extrn _WallDistTable:dword
extrn _CeilMap:word extrn _CeilMap:word
extrn _AckTimerCounter:dword extrn _AckTimerCounter:dword
ACKPUBS Mymemset ACKPUBS Mymemset
ACKPUBS AckSpeedUp ACKPUBS AckSpeedUp
ACKPUBS AckSlowDown ACKPUBS AckSlowDown
ACKPUBS ShowColNS ACKPUBS ShowColNS
ACKPUBS ShowColMaskNS ACKPUBS ShowColMaskNS
ACKPUBS DrawBackDrop ACKPUBS DrawBackDrop
ACKPUBS AckTimerHandler ACKPUBS AckTimerHandler
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC AckTimerHandler ACKPROC AckTimerHandler
inc cs:[dword ptr _AckTimerCounter] inc cs:[dword ptr _AckTimerCounter]
iretd iretd
endp endp
@ -125,25 +125,25 @@ ACKPROC AckTimerHandler
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC Mymemset ACKPROC Mymemset
push edi push edi
push ebx push ebx
push ecx push ecx
push edx push edx
mov edi,eax mov edi,eax
mov dh,dl mov dh,dl
mov ax,dx mov ax,dx
shl eax,16 shl eax,16
mov ax,dx mov ax,dx
mov ecx,ebx mov ecx,ebx
sar ecx,2 sar ecx,2
rep stosd rep stosd
mov ecx,ebx mov ecx,ebx
and ecx,3 and ecx,3
rep stosb rep stosb
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
pop edi pop edi
ret ret
endp endp
@ -152,24 +152,24 @@ ACKPROC Mymemset
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC AckSpeedUp ACKPROC AckSpeedUp
push ebx push ebx
push edx push edx
mov bx,ax mov bx,ax
mov ax,0FFFFH mov ax,0FFFFH
xor dx,dx xor dx,dx
idiv bx idiv bx
mov bx,ax mov bx,ax
mov dx,43h mov dx,43h
mov al,36h mov al,36h
out dx,al out dx,al
mov dx,40h mov dx,40h
mov al,bl ; ffh = original value mov al,bl ; ffh = original value
out dx,al out dx,al
mov dx,40h mov dx,40h
mov al,bh ; 1fh = orignal value mov al,bh ; 1fh = orignal value
out dx,al out dx,al
pop edx pop edx
pop ebx pop ebx
ret ret
endp endp
@ -177,236 +177,235 @@ ACKPROC AckSpeedUp
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC AckSlowDown ACKPROC AckSlowDown
push edx push edx
mov dx,43h mov dx,43h
mov al,36h mov al,36h
out dx,al out dx,al
mov dx,40h mov dx,40h
mov al,0ffh mov al,0ffh
out dx,al out dx,al
mov dx,40h mov dx,40h
mov al,0ffh mov al,0ffh
out dx,al out dx,al
pop edx pop edx
ret ret
endp endp
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC DrawBackDrop ACKPROC DrawBackDrop
push ebp push ebp
push esi push esi
push edi push edi
push ebx push ebx
push ecx push ecx
push edx push edx
mov ax,[_PlayerAngle] mov ax,[_PlayerAngle]
sub ax,INT_ANGLE_32 sub ax,INT_ANGLE_32
jnc ang_okay jnc ang_okay
add ax,INT_ANGLE_360 add ax,INT_ANGLE_360
ang_okay: ang_okay:
mov cx,640 mov cx,640
cwd cwd
idiv cx ; Do mod 640 to get starting posn idiv cx ; Do mod 640 to get starting posn
; movsx ebx,dx ; movsx ebx,dx
movzx ebx,dx movzx ebx,dx
shl ebx,2 ; x 4 for memory pointers shl ebx,2 ; x 4 for memory pointers
mov edx,320 mov edx,320
mov ebp,[_gScrnBuffer] ; get screen buffer mov ebp,[_gScrnBuffer] ; get screen buffer
dbd010: dbd010:
mov edi,ebp mov edi,ebp
mov esi,[dword ptr _BackArray+ebx] ;current image pointer mov esi,[dword ptr _BackArray+ebx] ;current image pointer
mov ecx,[_BackDropRows] ; rows to draw mov ecx,[_BackDropRows] ; rows to draw
dbd020: dbd020:
; mov al,[esi] ; mov al,[esi]
; mov [edi],al ; mov [edi],al
; inc esi ; inc esi
; lea edi,[edi+320] ; lea edi,[edi+320]
movsb movsb
lea edi,[edi+319] lea edi,[edi+319]
dec ecx dec ecx
jnz dbd020 jnz dbd020
inc ebp ;next screen column inc ebp ;next screen column
lea ebx,[ebx+4] lea ebx,[ebx+4]
cmp ebx,2560 ;see if 640x4 column yet cmp ebx,2560 ;see if 640x4 column yet
jb short dbd030 ;nope jb short dbd030 ;nope
mov ebx,0 ;else wrap to 0 column mov ebx,0 ;else wrap to 0 column
dbd030: dbd030:
dec edx ;see if done with all columns dec edx ;see if done with all columns
jnz dbd010 jnz dbd010
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
pop edi pop edi
pop esi pop esi
pop ebp pop ebp
ret ret
endp endp
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC ShowColNS ACKPROC ShowColNS
push ebp push ebp
push esi push esi
push edi push edi
mov edi,[_scVid] mov edi,[_scVid]
mov ebx,[_scWall] mov ebx,[_scWall]
mov ebp,[_bmDistance] mov ebp,[_bmDistance]
mov cx,[_gCenterRow] mov cx,[_gCenterRow]
mov edx,1FFFh mov edx,1FFFh
xor eax,eax xor eax,eax
sns_top: sns_top:
mov al,dh mov al,dh
sub edx,ebp sub edx,ebp
mov al,[ebx+eax] mov al,[ebx+eax]
mov [edi],al mov [edi],al
jc short sns_bot jc short sns_bot
sub edi,320 sub edi,320
dec cx dec cx
jns sns_top jns sns_top
xor ecx,ecx xor ecx,ecx
sns_bot: sns_bot:
mov [SAVEVID],edi mov [SAVEVID],edi
mov [SAVEROW],ecx mov [SAVEROW],ecx
mov edi,[_scVid] mov edi,[_scVid]
mov cx,[_gCenterRow] mov cx,[_gCenterRow]
mov edx,2000h mov edx,2000h
sns_botloop: sns_botloop:
mov al,dh mov al,dh
add edi,320 add edi,320
mov al,[ebx+eax] mov al,[ebx+eax]
add edx,ebp add edx,ebp
mov [edi],al mov [edi],al
cmp dh,64 cmp dh,64
jae short sns_exit jae short sns_exit
dec cx dec cx
jnz sns_botloop jnz sns_botloop
sns_exit: sns_exit:
cmp [word ptr _scmulti],0 cmp [word ptr _scmulti],0
jz sns_alldone jz sns_alldone
mov esi,[SAVEROW] mov esi,[SAVEROW]
or si,si or si,si
jz sns_alldone jz sns_alldone
mov ebx,[_scMulData] ;ptr to count and wall data mov ebx,[_scMulData] ;ptr to count and wall data
mov cl,[ebx] ;get number of walls to draw mov cl,[ebx] ;get number of walls to draw
inc ebx inc ebx
mov al,[ebx] ;first wall to show mov al,[ebx] ;first wall to show
inc ebx inc ebx
mov [_scMulData],ebx mov [_scMulData],ebx
movzx ebx,al ;get wall number movzx ebx,al ;get wall number
mov eax,[_WallbMaps] ;Get array of bitmaps mov eax,[_WallbMaps] ;Get array of bitmaps
mov ebx,[eax+ebx*4] ;Get the bitmap we are using mov ebx,[eax+ebx*4] ;Get the bitmap we are using
mov eax,[_scColumn] mov eax,[_scColumn]
add ebx,eax add ebx,eax
mov edi,[SAVEVID] mov edi,[SAVEVID]
mov edx,3FFFh mov edx,3FFFh
mov ebp,[_bmDistance] mov ebp,[_bmDistance]
mov eax,0 mov eax,0
sns_mulloop: sns_mulloop:
mov al,dh mov al,dh
sub edi,320 sub edi,320
mov al,[ebx+eax] mov al,[ebx+eax]
dec si dec si
mov [edi],al mov [edi],al
jz short sns_alldone jz short sns_alldone
sub edx,ebp sub edx,ebp
jnc sns_mulloop jnc sns_mulloop
sns_nextlevel: sns_nextlevel:
dec cl ;Bump wall count dec cl ;Bump wall count
jz short sns_alldone ;br if no more walls jz short sns_alldone ;br if no more walls
mov ebx,[_scMulData] ;Get pointer to the multi-ht data mov ebx,[_scMulData] ;Get pointer to the multi-ht data
movzx edx,[byte ptr ebx] ;next wall number movzx edx,[byte ptr ebx] ;next wall number
inc ebx ;Advance for next wall inc ebx ;Advance for next wall
mov [_scMulData],ebx mov [_scMulData],ebx
mov ebx,[_WallbMaps] ;Get wall array mov ebx,[_WallbMaps] ;Get wall array
mov ebx,[ebx+edx*4] ;Get wall bitmap to use mov ebx,[ebx+edx*4] ;Get wall bitmap to use
add ebx,[dword ptr _scColumn] ;add in current column add ebx,[dword ptr _scColumn] ;add in current column
mov edx,3FFFh mov edx,3FFFh
jmp sns_mulloop jmp sns_mulloop
sns_alldone: sns_alldone:
pop edi pop edi
pop esi pop esi
pop ebp pop ebp
ret ret
endp endp
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; ;
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ACKPROC ShowColMaskNS ACKPROC ShowColMaskNS
push ebp push ebp
push esi push esi
push edi push edi
mov edi,[_scVid] mov edi,[_scVid]
mov ebx,[_scWall] mov ebx,[_scWall]
mov ebp,[_bmDistance] mov ebp,[_bmDistance]
mov cx,[_gCenterRow] mov cx,[_gCenterRow]
mov edx,1FFFh mov edx,1FFFh
xor eax,eax xor eax,eax
smns_top: smns_top:
mov al,dh mov al,dh
mov al,[ebx+eax] mov al,[ebx+eax]
or al,al or al,al
jz short smns_blank jz short smns_blank
mov [edi],al mov [edi],al
smns_blank: smns_blank:
sub edx,ebp sub edx,ebp
jc short smns_bot jc short smns_bot
sub edi,320 sub edi,320
dec cx dec cx
jnz smns_top jnz smns_top
smns_bot: smns_bot:
mov edi,[_scVid] mov edi,[_scVid]
mov cx,[_gCenterRow] mov cx,[_gCenterRow]
mov edx,2000h mov edx,2000h
smns_botloop: smns_botloop:
add edi,320 add edi,320
mov al,dh mov al,dh
mov al,[ebx+eax] mov al,[ebx+eax]
or al,al or al,al
jz short smns_blank1 jz short smns_blank1
mov [edi],al mov [edi],al
smns_blank1: smns_blank1:
add edx,ebp add edx,ebp
cmp dh,64 cmp dh,64
jae short smns_exit jae short smns_exit
dec cx dec cx
jnz smns_botloop jnz smns_botloop
smns_exit: smns_exit:
pop edi pop edi
pop esi pop esi
pop ebp pop ebp
ret ret
endp endp
end end


View file

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


View file

@ -14,9 +14,9 @@
#include "ackext.h" #include "ackext.h"
typedef struct { typedef struct {
int sel; int sel;
int off; int off;
} SELOFF; } SELOFF;
void AckGetIntVector(int VecNum,int *sel,int *off); void AckGetIntVector(int VecNum,int *sel,int *off);
void AckSetIntVector(int VecNum,int sel,void *VecOff); void AckSetIntVector(int VecNum,int sel,void *VecOff);
@ -24,12 +24,12 @@ void AckKbdInt(void);
void AckTimerHandler(void); void AckTimerHandler(void);
void AckSetTextMode(void); void AckSetTextMode(void);
long AckMemUsed; long AckMemUsed;
short AckDisplayErrors; short AckDisplayErrors;
SELOFF OldKeybdInt; SELOFF OldKeybdInt;
char AckKeyboardSetup; char AckKeyboardSetup;
SELOFF OldTimerInt; SELOFF OldTimerInt;
char AckTimerSetup; char AckTimerSetup;
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// Establish a hook into interrupt 9 for keyboard handling // Establish a hook into interrupt 9 for keyboard handling
@ -72,11 +72,11 @@ mBlock = malloc(mSize);
if (mBlock == NULL) if (mBlock == NULL)
{ {
if (AckDisplayErrors) if (AckDisplayErrors)
{ {
AckSetTextMode(); AckSetTextMode();
printf("\n\nOut of memory on call to AckMalloc.\n"); printf("\n\nOut of memory on call to AckMalloc.\n");
printf("Memory used: %ld bytes.\n",AckMemUsed); printf("Memory used: %ld bytes.\n",AckMemUsed);
} }
return(mBlock); return(mBlock);
} }
@ -104,12 +104,12 @@ mBlock -= 1;
if ((*(UCHAR *)mBlock) != 0xF2) if ((*(UCHAR *)mBlock) != 0xF2)
{ {
if (AckDisplayErrors) if (AckDisplayErrors)
{ {
AckSetTextMode(); AckSetTextMode();
printf("\n\nCorrupt memory block in AckFree.\n"); printf("\n\nCorrupt memory block in AckFree.\n");
printf("Mem ptr: %p",mBlock); printf("Mem ptr: %p",mBlock);
return; return;
} }
} }
mBlock += 1; mBlock += 1;
@ -145,9 +145,9 @@ if (handle > 0)
{ {
read(handle,buf,768); read(handle,buf,768);
if (!rsHandle) 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); AckSetPalette(buf);
} }
else else
@ -164,60 +164,60 @@ return(ErrCode);
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
void AckSetupPalRanges(ACKENG *ae,ColorRange *ranges) void AckSetupPalRanges(ACKENG *ae,ColorRange *ranges)
{ {
short i,j,k,found; short i,j,k,found;
short rangenos; short rangenos;
UCHAR plotcolor; UCHAR plotcolor;
if (ae->LightFlag == SHADING_OFF) if (ae->LightFlag == SHADING_OFF)
{ {
for ( i = 0;i<16;i++) for ( i = 0;i<16;i++)
{ {
for (j=0;j<256;j++) for (j=0;j<256;j++)
{ {
ae->PalTable[j+(i*256)] = j; ae->PalTable[j+(i*256)] = j;
} }
} }
return; return;
} }
for (rangenos = 0; rangenos < 64; rangenos++) for (rangenos = 0; rangenos < 64; rangenos++)
{ {
if (ranges[rangenos].start == 0) if (ranges[rangenos].start == 0)
break; break;
} }
for ( i = 0;i<16;i++) for ( i = 0;i<16;i++)
{ {
for (j=0;j<256;j++) for (j=0;j<256;j++)
{ {
found = 0; found = 0;
// find the range the color is in. // find the range the color is in.
for ( k = 0; k < rangenos; k++ ) for ( k = 0; k < rangenos; k++ )
{ {
if (j >= ranges[k].start && j < ranges[k].start+ranges[k].length) if (j >= ranges[k].start && j < ranges[k].start+ranges[k].length)
{ {
found = 1; found = 1;
break; break;
} }
} }
if (found) if (found)
{ {
//============================================================================= //=============================================================================
// add color + i; // add color + i;
// if color + i > color+range then plot color = 0; // if color + i > color+range then plot color = 0;
// otherwise plotcolor = color+i // otherwise plotcolor = color+i
//============================================================================= //=============================================================================
if (j+i >= ranges[k].start+ranges[k].length) if (j+i >= ranges[k].start+ranges[k].length)
plotcolor = 0; plotcolor = 0;
else else
plotcolor = j+i; plotcolor = j+i;
} }
else else
{ {
plotcolor = j; plotcolor = j;
} }
ae->PalTable[j+(i*256)] = plotcolor; ae->PalTable[j+(i*256)] = plotcolor;
} }
} }
@ -282,8 +282,8 @@ return(0);
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± //±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
short AckFreeBitmap(UCHAR *bmType) short AckFreeBitmap(UCHAR *bmType)
{ {
short i; short i;
UCHAR *Bmp; UCHAR *Bmp;
if (bmType != NULL) if (bmType != NULL)
AckFree(bmType); AckFree(bmType);
@ -293,4 +293,3 @@ return(0);
// **** End of Source **** // **** End of Source ****


View file

@ -111,7 +111,7 @@ USHORT yRayCast(void);
USHORT xRayCastMulti(void); USHORT xRayCastMulti(void);
USHORT yRayCastMulti(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 ShowColMask(void); // column by column
void ShowColNS(void); void ShowColNS(void);
void ShowColMaskNS(void); void ShowColMaskNS(void);
@ -162,7 +162,7 @@ gWinHalfHeight = (gWinEndY - (gWinHeight >> 1)) + 1;
gCenterRow = ae->CenterRow; // Start of center row in viewport gCenterRow = ae->CenterRow; // Start of center row in viewport
gCenterOff = ae->CenterOffset; // Offset to center of viewport gCenterOff = ae->CenterOffset; // Offset to center of viewport
gScrnBuffer = ae->ScreenBuffer; // Screen buffer access gScrnBuffer = ae->ScreenBuffer; // Screen buffer access
gScrnBufferCenter = gScrnBuffer + gCenterOff; gScrnBufferCenter = gScrnBuffer + gCenterOff;
gBkgdBuffer = ae->BkgdBuffer; // Buffer for ceiling and floors gBkgdBuffer = ae->BkgdBuffer; // Buffer for ceiling and floors
gPalTable = ae->PalTable; // Palette of colors used gPalTable = ae->PalTable; // Palette of colors used
gDoor = &ae->Door[0]; // List of moving doors 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) mode = 1; // Draw floor only (ceiling will be solid)
if (SysFlags & SYS_SOLID_FLOOR) // Solid floor is selcted 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 if (SysFlags & SYS_SOLID_FLOOR) // Solid floor is selected
@ -191,13 +191,13 @@ if (!LightFlag) // No light shading used
WallMaskRtn = ShowColMaskNS; // using light shading WallMaskRtn = ShowColMaskNS; // using light shading
switch (mode) // Check floor and ceiling type 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) if (ae->SysFlags & SYS_SINGLE_BMP)
FloorCeilRtn = AckDrawOneFloor; // Use the same bitmap for each FloorCeilRtn = AckDrawOneFloor; // Use the same bitmap for each
else else
FloorCeilRtn = AckDrawFloorHz; FloorCeilRtn = AckDrawFloorHz;
break; break;
case 1: // Draw solid ceiling and texture floor case 1: // Draw solid ceiling and texture floor
FloorCeilRtn = DrawSolidCeilAndFloorNS; FloorCeilRtn = DrawSolidCeilAndFloorNS;
break; break;
case 2: // Draw both solid floor and solid ceiling 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 yBegGlobal = yPglobal & GRID_MASK; // Upper left corner (y) of grid square
yPglobalHI = ((long)yPglobal << FP_SHIFT); // Convert y coordinate to fixed point yPglobalHI = ((long)yPglobal << FP_SHIFT); // Convert y coordinate to fixed point
PlayerAngle = aeGlobal->PlayerAngle; // The player's angle 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 BuildUpView(); // Assembly routine defined in ACKRTN3.ASM. This routine
// kicks off the ray casting process. // kicks off the ray casting process.
} }
@ -308,7 +308,7 @@ void BuildSlice(void)
UCHAR *mgPtr; UCHAR *mgPtr;
SLICE *spNext; 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 sPtr->Distance = 200; // Initialize the distance from the POV to the slice
wFound = 0; // Wall not found yet wFound = 0; // Wall not found yet
sPtr->Fnc = ShowNone; // Use the stub function for now for drawing the slice 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 // Use the y intercept to determine the column of the slice
BitmapColumn = (LastY1 >> FP_SHIFT) & (BITMAP_WIDTH-1); 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) if ((short)iLastX < xPglobal)
BitmapColumn = (BITMAP_WIDTH-1) - BitmapColumn; BitmapColumn = (BITMAP_WIDTH-1) - BitmapColumn;
// Did we strike a door? // Did we strike a door?
if ((BitmapNumber & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT))) if ((BitmapNumber & (DOOR_TYPE_SLIDE+DOOR_TYPE_SPLIT)))
{ {
index = FindDoor(xMapPosn); // Locate the position of the door index = FindDoor(xMapPosn); // Locate the position of the door
@ -848,4 +848,3 @@ return(WallCode);
} }
// **** End of Source **** // **** End of Source ****


View file

@ -14,14 +14,14 @@
#include "ackext.h" #include "ackext.h"
typedef struct { typedef struct {
int sel; int sel;
int off; int off;
} SELOFF; } SELOFF;
extern char AckKeyboardSetup; extern char AckKeyboardSetup;
extern SELOFF OldKeybdInt; extern SELOFF OldKeybdInt;
extern char AckTimerSetup; extern char AckTimerSetup;
extern SELOFF OldTimerInt; extern SELOFF OldTimerInt;
void AckSetIntVector(int VecNum,int sel,int VecOff); void AckSetIntVector(int VecNum,int sel,int VecOff);
@ -76,4 +76,3 @@ return (0);
} }
// **** End of Source **** // **** End of Source ****


View file

@ -14,7 +14,7 @@
#define DWORD unsigned long #define DWORD unsigned long
long ByteFlipLong(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 */ 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 typedef struct
{ {
ID type; ID type;
long cksize; long cksize;
ID subtype; ID subtype;
} form_chunk; } form_chunk;
typedef struct { typedef struct {
ID ckID; ID ckID;
LONG ckSize; LONG ckSize;
} ChunkHeader; } ChunkHeader;
typedef struct { typedef struct {
ID ckID; ID ckID;
LONG ckSize; LONG ckSize;
UBYTE ckData[ 1 /*REALLY: ckSize*/ ]; UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
} Chunk; } 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_ILBM MakeID('I','L','B','M')
#define ID_BMHD MakeID('B','M','H','D') #define ID_BMHD MakeID('B','M','H','D')
#define ID_CMAP MakeID('C','M','A','P') #define ID_CMAP MakeID('C','M','A','P')
@ -73,8 +73,8 @@ typedef struct {
UWORD x, y; /* position for this image */ UWORD x, y; /* position for this image */
UBYTE nPlanes; /* # source bitplanes */ UBYTE nPlanes; /* # source bitplanes */
UBYTE masking; /* masking technique */ UBYTE masking; /* masking technique */
UBYTE compression; /* compression algoithm */ UBYTE compression; /* compression algoithm */
UBYTE pad1; /* UNUSED. For consistency, put 0 here.*/ UBYTE pad1; /* UNUSED. For consistency, put 0 here.*/
UWORD transparentColor; /* transparent "color number" */ UWORD transparentColor; /* transparent "color number" */
UBYTE xAspect, yAspect; /* aspect ratio, a rational number x/y */ UBYTE xAspect, yAspect; /* aspect ratio, a rational number x/y */
UWORD pageWidth, pageHeight; /* source "page" size in pixels */ UWORD pageWidth, pageHeight; /* source "page" size in pixels */
@ -95,4 +95,3 @@ void ByteFlipShort(short *);
short iffswab(unsigned short); short iffswab(unsigned short);
short swab(unsigned short); short swab(unsigned short);


View file

@ -4,62 +4,62 @@
// Module: KIT.H // Module: KIT.H
// (c) CopyRight 1994 All Rights Reserved // (c) CopyRight 1994 All Rights Reserved
#define MODE_GRAPHICS 0x13 #define MODE_GRAPHICS 0x13
#define MODE_TEXT 0x03 #define MODE_TEXT 0x03
#define SCREEN_LENGTH 64000 // Bytes in one full screen #define SCREEN_LENGTH 64000 // Bytes in one full screen
#define SCREEN_LEN_WORDS 32000 // Words in one screen #define SCREEN_LEN_WORDS 32000 // Words in one screen
#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen #define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen
#define SCREEN_PLANES 1 // Number of planes for this mode #define SCREEN_PLANES 1 // Number of planes for this mode
#define SCREEN_WIDTH 320 // Number of bytes in one row #define SCREEN_WIDTH 320 // Number of bytes in one row
#define SCREEN_HEIGHT 200 // Number of rows on screen #define SCREEN_HEIGHT 200 // Number of rows on screen
#define BUTTON_OK 0 #define BUTTON_OK 0
#define BUTTON_OKCANCEL 1 #define BUTTON_OKCANCEL 1
#define BUTTON_YESNO 2 #define BUTTON_YESNO 2
#define BUTTON_ABORTRETRY 3 #define BUTTON_ABORTRETRY 3
#define BUTTON_RET_OK 0 #define BUTTON_RET_OK 0
#define BUTTON_RET_CANCEL 1 #define BUTTON_RET_CANCEL 1
#define BUTTON_RET_YES 2 #define BUTTON_RET_YES 2
#define BUTTON_RET_NO 3 #define BUTTON_RET_NO 3
#define BUTTON_RET_ABORT 4 #define BUTTON_RET_ABORT 4
#define BUTTON_RET_RETRY 5 #define BUTTON_RET_RETRY 5
// Used in IORTN.C for message boxes // Used in IORTN.C for message boxes
typedef struct { typedef struct {
short x; short x;
short y; short y;
short x1; short x1;
short y1; short y1;
short index; short index;
} BUTTON; } BUTTON;
// Used in IORTN.C for message boxes // Used in IORTN.C for message boxes
typedef struct { typedef struct {
short Count; short Count;
short List[4]; short List[4];
} INDEXES; } INDEXES;
// Used in IORTN.C list boxes // Used in IORTN.C list boxes
typedef struct _lcb { typedef struct _lcb {
struct _lcb *Back; struct _lcb *Back;
struct _lcb *Fwd; struct _lcb *Fwd;
char Data[1]; char Data[1];
} LCB; } LCB;
typedef struct { typedef struct {
short ux; short ux;
short uy; short uy;
short ux1; short ux1;
short uy1; short uy1;
short dx; short dx;
short dy; short dy;
short dx1; short dx1;
short dy1; short dy1;
} ARROWRECT; } ARROWRECT;
//============================================================================= //=============================================================================
@ -137,4 +137,3 @@ short ShowPickList(char **p,short SortFlag);
//============================================================================= //=============================================================================
short LoadSet(char *fName); short LoadSet(char *fName);


File diff suppressed because it is too large Load diff

View file

@ -4,62 +4,62 @@
// Module: KIT.H // Module: KIT.H
// (c) CopyRight 1994 All Rights Reserved // (c) CopyRight 1994 All Rights Reserved
#define MODE_GRAPHICS 0x13 #define MODE_GRAPHICS 0x13
#define MODE_TEXT 0x03 #define MODE_TEXT 0x03
#define SCREEN_LENGTH 64000 // Bytes in one full screen #define SCREEN_LENGTH 64000 // Bytes in one full screen
#define SCREEN_LEN_WORDS 32000 // Words in one screen #define SCREEN_LEN_WORDS 32000 // Words in one screen
#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen #define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen
#define SCREEN_PLANES 1 // Number of planes for this mode #define SCREEN_PLANES 1 // Number of planes for this mode
#define SCREEN_WIDTH 320 // Number of bytes in one row #define SCREEN_WIDTH 320 // Number of bytes in one row
#define SCREEN_HEIGHT 200 // Number of rows on screen #define SCREEN_HEIGHT 200 // Number of rows on screen
#define BUTTON_OK 0 #define BUTTON_OK 0
#define BUTTON_OKCANCEL 1 #define BUTTON_OKCANCEL 1
#define BUTTON_YESNO 2 #define BUTTON_YESNO 2
#define BUTTON_ABORTRETRY 3 #define BUTTON_ABORTRETRY 3
#define BUTTON_RET_OK 0 #define BUTTON_RET_OK 0
#define BUTTON_RET_CANCEL 1 #define BUTTON_RET_CANCEL 1
#define BUTTON_RET_YES 2 #define BUTTON_RET_YES 2
#define BUTTON_RET_NO 3 #define BUTTON_RET_NO 3
#define BUTTON_RET_ABORT 4 #define BUTTON_RET_ABORT 4
#define BUTTON_RET_RETRY 5 #define BUTTON_RET_RETRY 5
// Used in IORTN.C for message boxes // Used in IORTN.C for message boxes
typedef struct { typedef struct {
short x; short x;
short y; short y;
short x1; short x1;
short y1; short y1;
short index; short index;
} BUTTON; } BUTTON;
// Used in IORTN.C for message boxes // Used in IORTN.C for message boxes
typedef struct { typedef struct {
short Count; short Count;
short List[4]; short List[4];
} INDEXES; } INDEXES;
// Used in IORTN.C list boxes // Used in IORTN.C list boxes
typedef struct _lcb { typedef struct _lcb {
struct _lcb *Back; struct _lcb *Back;
struct _lcb *Fwd; struct _lcb *Fwd;
char Data[1]; char Data[1];
} LCB; } LCB;
typedef struct { typedef struct {
short ux; short ux;
short uy; short uy;
short ux1; short ux1;
short uy1; short uy1;
short dx; short dx;
short dy; short dy;
short dx1; short dx1;
short dy1; short dy1;
} ARROWRECT; } ARROWRECT;
//============================================================================= //=============================================================================
@ -137,4 +137,3 @@ short ShowPickList(char **p,short SortFlag);
//============================================================================= //=============================================================================
short LoadSet(char *fName); 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 ; Version 2.02a  May 09th, 1994
; ;
; Copyright 1993,94 Carlos Hasan ; Copyright 1993,94 Carlos Hasan
;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² ;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
ideal ideal
p386 p386
model flat,c model flat,c
@ -16,13 +16,13 @@ jumps
global MODPlayModule:near global MODPlayModule:near
global MODStopModule:near global MODStopModule:near
global MODPlaySample:near global MODPlaySample:near
global MODPlayVoice:near global MODPlayVoice:near
global MODStopVoice:near global MODStopVoice:near
global MODSetPeriod:near global MODSetPeriod:near
global MODSetVolume:near global MODSetVolume:near
;;global _GETDS:near ;;global _GETDS:near
global OurDataSeg:dword global OurDataSeg:dword
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; EQUATES ; EQUATES
@ -46,32 +46,32 @@ RepLength dw ?
ends MODSample ends MODSample
struc MODHeader ; file header struc MODHeader ; file header
SongName db 20 dup (?) SongName db 20 dup (?)
Samples MODSample 31 dup (?) Samples MODSample 31 dup (?)
OrderLen db ? OrderLen db ?
ReStart db ? ReStart db ?
Order db 128 dup (?) Order db 128 dup (?)
Sign dd ? Sign dd ?
ends MODHeader ends MODHeader
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; MOD Player structures ; MOD Player structures
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
struc Voice struc Voice
Address dd ?,? ; Current Address Address dd ?,? ; Current Address
StartAddress dd ? ; Loop Start Address StartAddress dd ? ; Loop Start Address
EndAddress dd ? ; Loop End Address EndAddress dd ? ; Loop End Address
Frequency dd ? ; Frequency Frequency dd ? ; Frequency
Volume db ?,? ; Volume Volume db ?,? ; Volume
ends Voice ends Voice
struc Track struc Track
Period dw ? ; Note Period Period dw ? ; Note Period
Instr db ? ; Instr Number Instr db ? ; Instr Number
Volume db ? ; Volume Volume db ? ; Volume
Effect dw ? ; Effect Effect dw ? ; Effect
ends Track ends Track
struc Sample struc Sample
Period dw ? ; Default Period Period dw ? ; Default Period
@ -94,7 +94,7 @@ IRQVector df ? ; IRQ Saved Vector
BufSelector dw ? ; DPMI Buffer Selector BufSelector dw ? ; DPMI Buffer Selector
VolBuffer dd ? ; Volume Buffer Address VolBuffer dd ? ; Volume Buffer Address
DMABuffer dd ? ; DMA Buffer Address DMABuffer dd ? ; DMA Buffer Address
DMALength dw ? ; DMA Buffer Length DMALength dw ? ; DMA Buffer Length
BufferPos dw ? ; Current Buffer Position BufferPos dw ? ; Current Buffer Position
@ -118,9 +118,9 @@ OrderLen db ? ; Order Length
PatternRow db ? ; Pattern Row PatternRow db ? ; Pattern Row
OrderList db 128 dup (?) ; Order List OrderList db 128 dup (?) ; Order List
PatternPtr dd ? ; Current Pattern Address PatternPtr dd ? ; Current Pattern Address
Tempo db ? ; Tempo Tempo db ? ; Tempo
TempoCount db ? ; Tempo Internal Counter TempoCount db ? ; Tempo Internal Counter
BPM db ? ; BPM value BPM db ? ; BPM value
ActiveTracks dw ? ; Number of Active Tracks ActiveTracks dw ? ; Number of Active Tracks
Tracks Track MAXVOICES dup (?) ; Array of Tracks Tracks Track MAXVOICES dup (?) ; Array of Tracks
@ -145,61 +145,61 @@ codeseg
; In: ; In:
; Song = Modulefile address ; Song = Modulefile address
; Chans = Number of channels ; Chans = Number of channels
; Rate = Sampling Rate ; Rate = Sampling Rate
; Port = I/O Port ; Port = I/O Port
; IRQ = IRQ Level ; IRQ = IRQ Level
; DRQ = DRQ Channel ; DRQ = DRQ Channel
; Out: ; Out:
; EAX = status ; EAX = status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword
pushad pushad
mov edi,[Song] ; Load parameters from stack mov edi,[Song] ; Load parameters from stack
mov eax,[Chans] mov eax,[Chans]
mov [ActiveVoices],ax mov [ActiveVoices],ax
mov eax,[Rate] mov eax,[Rate]
mov [SBRate],ax mov [SBRate],ax
mov eax,[Port] mov eax,[Port]
mov [IOAddr],ax mov [IOAddr],ax
mov eax,[IRQ] mov eax,[IRQ]
mov [IRQNum],al mov [IRQNum],al
mov eax,[DRQ] mov eax,[DRQ]
mov [DRQNum],al mov [DRQNum],al
mov eax,MIDCRATE*428 ; setup frequency divisor mov eax,MIDCRATE*428 ; setup frequency divisor
xor edx,edx xor edx,edx
shld edx,eax,16 shld edx,eax,16
shl eax,16 shl eax,16
movzx ebx,[SBRate] movzx ebx,[SBRate]
div ebx div ebx
mov [FreqDivisor],eax mov [FreqDivisor],eax
call MODSetup ; setup MOD player stuff call MODSetup ; setup MOD player stuff
jc MODPlayDone jc MODPlayDone
call MCInit ; setup the muti-channel stuff call MCInit ; setup the muti-channel stuff
jc MODPlayDone jc MODPlayDone
mov dl,[BPM] ; setup the multi-channel timer mov dl,[BPM] ; setup the multi-channel timer
call MCStartTimer call MCStartTimer
call DMASetBuf ; setup DMA controller call DMASetBuf ; setup DMA controller
call IRQSetVect ; setup PIC interrupt call IRQSetVect ; setup PIC interrupt
call SBOpenDevice ; setup SB for playback call SBOpenDevice ; setup SB for playback
jnc MODPlayDone jnc MODPlayDone
call MODStopModule call MODStopModule
MODPlayDone: MODPlayDone:
popad popad
sbb eax,eax ; return status in EAX sbb eax,eax ; return status in EAX
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; MODStopModule - Stop playing the current modulefile ; MODStopModule - Stop playing the current modulefile
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODStopModule proc MODStopModule
pushad pushad
call SBCloseDevice ; done SB playback call SBCloseDevice ; done SB playback
call IRQRestVect ; done PIC interrupt call IRQRestVect ; done PIC interrupt
call DMAReset ; done DMA controller call DMAReset ; done DMA controller
call MCDone ; done multi-channel stuff call MCDone ; done multi-channel stuff
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -208,21 +208,21 @@ endp
; Voice = Audio channel ; Voice = Audio channel
; Instr = Instrument ; Instr = Instrument
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODPlaySample AVoice:dword,AInstr:dword proc MODPlaySample AVoice:dword,AInstr:dword
pushad pushad
mov ebx,[AVoice] ; change the voice sample parameters mov ebx,[AVoice] ; change the voice sample parameters
mov eax,[AInstr] mov eax,[AInstr]
mov edx,[eax+Sample.SampleData] mov edx,[eax+Sample.SampleData]
mov esi,[eax+Sample.SampleLength] mov esi,[eax+Sample.SampleLength]
add esi,edx add esi,edx
mov edi,esi mov edi,esi
call MCStartVoice call MCStartVoice
movzx ecx,[eax+Sample.Period] ; change the voice frequency movzx ecx,[eax+Sample.Period] ; change the voice frequency
call MCSetFrequency call MCSetFrequency
mov ax,[eax+Sample.Volume] ; and set the voice volume mov ax,[eax+Sample.Volume] ; and set the voice volume
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -233,20 +233,20 @@ endp
; Period = Amiga Period ; Period = Amiga Period
; Volume = Volume ; Volume = Volume
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword
pushad pushad
mov ebx,[AVoice] ; change the voice sample parameters mov ebx,[AVoice] ; change the voice sample parameters
mov eax,[AInstr] mov eax,[AInstr]
mov edx,[4*eax+SmpAddress] mov edx,[4*eax+SmpAddress]
mov esi,[4*eax+SmpStartAddress] mov esi,[4*eax+SmpStartAddress]
mov edi,[4*eax+SmpEndAddress] mov edi,[4*eax+SmpEndAddress]
call MCStartVoice call MCStartVoice
mov ecx,[APeriod] ; change the voice frequency mov ecx,[APeriod] ; change the voice frequency
call MCSetFrequency call MCSetFrequency
mov eax,[AVolume] ; and set the voice volume mov eax,[AVolume] ; and set the voice volume
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -254,13 +254,13 @@ endp
; In: ; In:
; Voice = Audio channel ; Voice = Audio channel
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODStopVoice AVoice:dword proc MODStopVoice AVoice:dword
pushad pushad
mov ebx,[AVoice] ; set the voice volume to zero mov ebx,[AVoice] ; set the voice volume to zero
xor al,al xor al,al
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -269,13 +269,13 @@ endp
; Voice = Audio channel ; Voice = Audio channel
; Period = Amiga Period ; Period = Amiga Period
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODSetPeriod AVoice:dword,APeriod:dword proc MODSetPeriod AVoice:dword,APeriod:dword
pushad pushad
mov ebx,[AVoice] mov ebx,[AVoice]
mov ecx,[APeriod] mov ecx,[APeriod]
call MCSetFrequency call MCSetFrequency
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -284,13 +284,13 @@ endp
; Voice = Audio channel ; Voice = Audio channel
; Volume = New Volume ; Volume = New Volume
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODSetVolume AVoice:dword,AVolume:dword proc MODSetVolume AVoice:dword,AVolume:dword
pushad pushad
mov ebx,[AVoice] mov ebx,[AVoice]
mov eax,[AVolume] mov eax,[AVolume]
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -301,10 +301,10 @@ endp
; CF = status ; CF = status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MODSetup: MODSetup:
pushad ; check for valid modfile formats pushad ; check for valid modfile formats
mov [ActiveTracks],4 mov [ActiveTracks],4
cmp [edi+MODHeader.Sign],'.K.M' cmp [edi+MODHeader.Sign],'.K.M'
je MODParse je MODParse
cmp [edi+MODHeader.Sign],'4TLF' cmp [edi+MODHeader.Sign],'4TLF'
je MODParse je MODParse
mov [ActiveTracks],6 mov [ActiveTracks],6
@ -320,15 +320,15 @@ MODParse:
mov [PatternRow],40h mov [PatternRow],40h
mov [Tempo],6 mov [Tempo],6
mov [TempoCount],0 mov [TempoCount],0
mov [BPM],125 mov [BPM],125
mov al,[edi+MODHeader.OrderLen] mov al,[edi+MODHeader.OrderLen]
mov [OrderLen],al mov [OrderLen],al
mov ecx,80h ; copy order list mov ecx,80h ; copy order list
xor ebx,ebx xor ebx,ebx
xor ah,ah xor ah,ah
MODCopyOrder: MODCopyOrder:
mov al,[edi+ebx+MODHeader.Order] mov al,[edi+ebx+MODHeader.Order]
mov [ebx+OrderList],al mov [ebx+OrderList],al
cmp al,ah cmp al,ah
jb MODCopyNext jb MODCopyNext
@ -352,7 +352,7 @@ MODCopyPatterns:
mov ecx,31 ; setup samples data mov ecx,31 ; setup samples data
lea edi,[edi+MODHeader.Samples] lea edi,[edi+MODHeader.Samples]
xor ebx,ebx xor ebx,ebx
inc ebx inc ebx
MODCopySamples: MODCopySamples:
mov al,[edi+MODSample.Volume] mov al,[edi+MODSample.Volume]
@ -368,15 +368,15 @@ MODCopySamples:
add eax,eax add eax,eax
add edx,edx add edx,edx
add ebp,ebp 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. ja MODSetSmpLength ; start and end are the same.
xor edx,edx xor edx,edx
mov ebp,eax mov ebp,eax
MODSetSmpLength: MODSetSmpLength:
add edx,ebp add edx,ebp
add eax,esi add eax,esi
add edx,esi add edx,esi
add ebp,esi add ebp,esi
mov [4*ebx+SmpAddress],esi mov [4*ebx+SmpAddress],esi
mov [4*ebx+SmpEndAddress],edx mov [4*ebx+SmpEndAddress],edx
mov [4*ebx+SmpStartAddress],ebp mov [4*ebx+SmpStartAddress],ebp
@ -397,10 +397,10 @@ MODCallBack:
dec [TempoCount] ; decrease tempo counter dec [TempoCount] ; decrease tempo counter
jle MODNextRow ; next row? jle MODNextRow ; next row?
lea esi,[Tracks] lea esi,[Tracks]
xor ebx,ebx xor ebx,ebx
MODUpdateLoop: MODUpdateLoop:
call MODUpNote ; update note events call MODUpNote ; update note events
add esi,size Track add esi,size Track
inc ebx inc ebx
cmp bx,[ActiveTracks] cmp bx,[ActiveTracks]
jb MODUpdateLoop jb MODUpdateLoop
@ -416,12 +416,12 @@ MODNextRow:
mov [PatternRow],bl ; reset the pattern row mov [PatternRow],bl ; reset the pattern row
mov bl,[OrderPos] mov bl,[OrderPos]
inc bl ; update the order position inc bl ; update the order position
cmp bl,[OrderLen] cmp bl,[OrderLen]
jb MODSetOrder jb MODSetOrder
xor bl,bl xor bl,bl
MODSetOrder: MODSetOrder:
mov [OrderPos],bl 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 edi,[4*ebx+PatternList]
mov [PatternPtr],edi ; set the pattern address mov [PatternPtr],edi ; set the pattern address
MODDontWrap: MODDontWrap:
@ -447,9 +447,9 @@ MODGetNoteLoop:
; EDI = pattern data address ; EDI = pattern data address
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MODGetNote: MODGetNote:
mov al,[edi+2] ; get the sample number mov al,[edi+2] ; get the sample number
shr al,4 shr al,4
mov ah,[edi] mov ah,[edi]
and ah,0F0h and ah,0F0h
or al,ah or al,ah
test al,al ; nonzero value? test al,al ; nonzero value?
@ -464,7 +464,7 @@ MODGetPeriod:
xchg al,ah xchg al,ah
and ax,0FFFh and ax,0FFFh
test ax,ax test ax,ax
je MODGetEffect ; nonzero value? je MODGetEffect ; nonzero value?
mov [esi+Track.Period],ax ; set new period value mov [esi+Track.Period],ax ; set new period value
movzx ecx,ax movzx ecx,ax
call MCSetFrequency call MCSetFrequency
@ -472,8 +472,8 @@ MODGetPeriod:
movzx eax,[esi+Track.Instr] movzx eax,[esi+Track.Instr]
mov edx,[4*eax+SmpAddress] mov edx,[4*eax+SmpAddress]
mov esi,[4*eax+SmpStartAddress] mov esi,[4*eax+SmpStartAddress]
mov edi,[4*eax+SmpEndAddress] mov edi,[4*eax+SmpEndAddress]
call MCStartVoice call MCStartVoice
pop edi esi pop edi esi
MODGetEffect: MODGetEffect:
mov ax,[edi+2] ; get the effect value mov ax,[edi+2] ; get the effect value
@ -488,7 +488,7 @@ MODGetEffect:
je EFXJumpPos je EFXJumpPos
cmp ah,0Dh cmp ah,0Dh
je EFXBreak je EFXBreak
cmp ah,09h cmp ah,09h
je EFXSampleOffset je EFXSampleOffset
ret ret
@ -499,10 +499,10 @@ MODGetEffect:
; ESI = track address ; ESI = track address
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MODUpNote: MODUpNote:
mov ax,[esi+Track.Effect] ; dispatch the effects mov ax,[esi+Track.Effect] ; dispatch the effects
cmp ah,0Ah cmp ah,0Ah
je EFXSlideVolume je EFXSlideVolume
ret ret
;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±
@ -512,7 +512,7 @@ MODUpNote:
;  The registers EBX,ESI,EDI must be preserved. ;  The registers EBX,ESI,EDI must be preserved.
;  The effect parameters are passed through the registers: ;  The effect parameters are passed through the registers:
; EBX - voice number ; EBX - voice number
; ESI - track address ; ESI - track address
; AL - effect parameter ; AL - effect parameter
;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±
@ -536,7 +536,7 @@ EFXSetSpeed:
mov [TempoCount],al mov [TempoCount],al
ret ret
EFXSetBPM: EFXSetBPM:
mov [BPM],al mov [BPM],al
mov dl,al mov dl,al
call MCStartTimer call MCStartTimer
ret ret
@ -548,7 +548,7 @@ EFXJumpPos:
dec al dec al
mov [OrderPos],al mov [OrderPos],al
mov [PatternRow],40h mov [PatternRow],40h
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; EFXBreak - breaks the current pattern. ; EFXBreak - breaks the current pattern.
@ -572,7 +572,7 @@ EFXSlideVolume:
mov al,40h mov al,40h
EFXVolSlided: EFXVolSlided:
mov [esi+Track.Volume],al mov [esi+Track.Volume],al
call MCSetVolume call MCSetVolume
ret ret
EFXVolumeDown: EFXVolumeDown:
sub al,ah sub al,ah
@ -584,7 +584,7 @@ EFXVolumeDown:
; EFXSampleOffset - Set the sample offset ; EFXSampleOffset - Set the sample offset
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
EFXSampleOffset: EFXSampleOffset:
xor edx,edx xor edx,edx
mov dh,al mov dh,al
push esi edi push esi edi
movzx eax,[esi+Track.Instr] movzx eax,[esi+Track.Instr]
@ -606,9 +606,9 @@ EFXSampleOffset:
; CF = status ; CF = status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MCInit: MCInit:
pushad pushad
xor ax,ax ; initialize variables xor ax,ax ; initialize variables
mov [BufferPos],ax mov [BufferPos],ax
mov [TimerCount],ax mov [TimerCount],ax
mov [TimerSpeed],ax mov [TimerSpeed],ax
mov [BufSelector],ax mov [BufSelector],ax
@ -627,7 +627,7 @@ MCInit:
cmp ax,cx cmp ax,cx
jae MCAlignVolBuffer jae MCAlignVolBuffer
mov esi,edi mov esi,edi
add edi,4200h add edi,4200h
MCAlignVolBuffer: ; VolBuffer must be page aligned MCAlignVolBuffer: ; VolBuffer must be page aligned
add esi,0FFh ; (256 bytes = 1 page) add esi,0FFh ; (256 bytes = 1 page)
and esi,not 0FFh and esi,not 0FFh
@ -651,7 +651,7 @@ MCDoVolBuffer:
imul bh imul bh
sar ax,cl sar ax,cl
mov [edi],ah mov [edi],ah
inc edi inc edi
inc bl inc bl
jne MCDoVolBuffer jne MCDoVolBuffer
inc bh inc bh
@ -675,7 +675,7 @@ MCDone:
mov [BufSelector],0 mov [BufSelector],0
MCDoneExit: MCDoneExit:
popad popad
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; MCStartVoice - Set the voice sample instrument parameters ; MCStartVoice - Set the voice sample instrument parameters
@ -723,7 +723,7 @@ MCSetFreqDone:
; AL = volume ; AL = volume
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MCSetVolume: MCSetVolume:
push ebx push ebx
mov ebx,[4*ebx+VoiceTable] mov ebx,[4*ebx+VoiceTable]
mov [ebx+Voice.Volume],al mov [ebx+Voice.Volume],al
pop ebx pop ebx
@ -747,7 +747,7 @@ MCStartTimer:
mov [TimerSpeed],ax mov [TimerSpeed],ax
pop dx pop dx
pop cx pop cx
pop ax pop ax
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -771,7 +771,7 @@ MCPollLoop:
cmp [TimerCount],0 ; time to call the MOD callback? cmp [TimerCount],0 ; time to call the MOD callback?
jg MCPollChunk jg MCPollChunk
call MODCallBack call MODCallBack
mov ax,[TimerSpeed] ; update timer accumulator mov ax,[TimerSpeed] ; update timer accumulator
add [TimerCount],ax add [TimerCount],ax
MCPollChunk: MCPollChunk:
mov ax,[BufferLen] ; get the chunk length mov ax,[BufferLen] ; get the chunk length
@ -795,7 +795,7 @@ MCVoicesLoop:
call MCMixVoice call MCMixVoice
pop edi pop edi
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
add ebx,size Voice add ebx,size Voice
dec dx dec dx
@ -814,12 +814,12 @@ MCPollDone:
; ECX = Number of samples ; ECX = Number of samples
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MCMixVoice: MCMixVoice:
push ebx push ebx
; Modify the mixing chunk of code ; Modify the mixing chunk of code
mov eax,[ebx+Voice.EndAddress] mov eax,[ebx+Voice.EndAddress]
mov [dword ds:MCMixCode0],eax mov [dword ds:MCMixCode0],eax
mov [dword ds:MCMixCode2],eax mov [dword ds:MCMixCode2],eax
sub eax,[ebx+Voice.StartAddress] sub eax,[ebx+Voice.StartAddress]
mov [dword ds:MCMixCode1],eax mov [dword ds:MCMixCode1],eax
@ -836,7 +836,7 @@ MCMixVoice:
; Load the volume table address ; Load the volume table address
mov bh,[ebx+Voice.Volume] mov bh,[ebx+Voice.Volume]
and ebx,0FF00h and ebx,0FF00h
add ebx,[VolBuffer] add ebx,[VolBuffer]
; Start of the mixing chunk of code (non pure code) ; Start of the mixing chunk of code (non pure code)
@ -879,12 +879,12 @@ MCMixBreak:
; AL = data ; AL = data
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
SBWrite: SBWrite:
push eax push eax
push ecx push ecx
push edx push edx
mov dx,[IOAddr] mov dx,[IOAddr]
add dx,0Ch add dx,0Ch
mov ecx,10000h ; wait until the DSP is ready mov ecx,10000h ; wait until the DSP is ready
mov ah,al ; to receive the data byte mov ah,al ; to receive the data byte
SBWriteWait: SBWriteWait:
in al,dx in al,dx
@ -895,7 +895,7 @@ SBWriteWait:
pop edx pop edx
pop ecx pop ecx
pop eax pop eax
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; SBResetDSP - reset the Sound Blaster DSP chip ; SBResetDSP - reset the Sound Blaster DSP chip
@ -919,7 +919,7 @@ SBResetDSP:
SBReadWait: SBReadWait:
in al,dx in al,dx
and al,80h and al,80h
loopz SBReadWait loopz SBReadWait
sub dx,04h sub dx,04h
in al,dx ; read the DSP data byte in al,dx ; read the DSP data byte
cmp al,0AAh cmp al,0AAh
@ -941,9 +941,9 @@ SBResetDone:
; CF = initialization status ; CF = initialization status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
SBOpenDevice: SBOpenDevice:
pusha pusha
call SBResetDSP ; check for a SB card call SBResetDSP ; check for a SB card
jc SBOpenDone jc SBOpenDone
mov al,0D1h mov al,0D1h
call SBWrite ; turn on SB speaker call SBWrite ; turn on SB speaker
mov al,40h mov al,40h
@ -964,7 +964,7 @@ SBOpenDevice:
clc ; set successful status clc ; set successful status
SBOpenDone: SBOpenDone:
popa popa
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; SBCloseDevice - shutdown the SB playback ; SBCloseDevice - shutdown the SB playback
@ -988,7 +988,7 @@ DMAReset:
pusha pusha
mov al,[DRQNum] ; reset the DMA channel mov al,[DRQNum] ; reset the DMA channel
or al,04h or al,04h
out 0Ah,al out 0Ah,al
popa popa
ret ret
@ -1012,7 +1012,7 @@ DMASetBuf:
add dx,dx add dx,dx
mov eax,[DMABuffer] mov eax,[DMABuffer]
out dx,al out dx,al
mov al,ah mov al,ah
out dx,al out dx,al
inc dx ; set the DMA buffer length inc dx ; set the DMA buffer length
mov ax,[DMALength] mov ax,[DMALength]
@ -1048,15 +1048,15 @@ IRQGetIntNum:
push ax bx cx ; get the virtual master and slave push ax bx cx ; get the virtual master and slave
mov ax,0400h ; PIC base interrupts in DX mov ax,0400h ; PIC base interrupts in DX
int 31h int 31h
pop cx bx ax pop cx bx ax
cmp al,08h ; get the PIC base interrupt for cmp al,08h ; get the PIC base interrupt for
jb IRQGetDone ; the IRQ number in AL jb IRQGetDone ; the IRQ number in AL
mov dh,dl mov dh,dl
sub al,08h sub al,08h
IRQGetDone: IRQGetDone:
add al,dh add al,dh
pop dx pop dx
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; IRQRestVect - Restores the previous IRQ vector ; IRQRestVect - Restores the previous IRQ vector
@ -1066,13 +1066,13 @@ IRQGetDone:
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
IRQRestVect: IRQRestVect:
pushad pushad
push ds push ds
in al,0A1h ; disable the IRQ interrupt using in al,0A1h ; disable the IRQ interrupt using
mov ah,al ; the PIC interrupt mask registers mov ah,al ; the PIC interrupt mask registers
in al,21h in al,21h
mov dx,01h mov dx,01h
mov cl,[IRQNum] mov cl,[IRQNum]
shl dx,cl shl dx,cl
or ax,dx or ax,dx
out 21h,al out 21h,al
mov al,ah mov al,ah
@ -1090,7 +1090,7 @@ IRQRestVect:
IRQRestDone: IRQRestDone:
pop ds pop ds
xor ebx,ebx xor ebx,ebx
mov [dword IRQVector],ebx mov [dword IRQVector],ebx
mov [word 4+IRQVector],bx mov [word 4+IRQVector],bx
popad popad
ret ret
@ -1114,7 +1114,7 @@ IRQSetVect:
push cs push cs
pop ds pop ds
int 21h int 21h
pop es ds pop es ds
in al,0A1h ; enable this IRQ using the in al,0A1h ; enable this IRQ using the
mov al,ah ; PIC interrupt mask registers mov al,ah ; PIC interrupt mask registers
in al,21h in al,21h
@ -1133,14 +1133,14 @@ IRQSetVect:
; IRQHandler - Hardware IRQ handler ; IRQHandler - Hardware IRQ handler
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
IRQHandler: IRQHandler:
pushad ; pushes all the registers pushad ; pushes all the registers
push ds push ds
;;; mov ax,DGROUP ; load the DS selector ;;; mov ax,DGROUP ; load the DS selector
;;; mov ds,ax ;;; mov ds,ax
;;; call _GETDS ;;; call _GETDS
mov ax,cs:[dword ptr OurDataSeg] mov ax,cs:[dword ptr OurDataSeg]
mov ds,ax mov ds,ax
mov dx,[IOAddr] ; send ack to the SB DSP chip mov dx,[IOAddr] ; send ack to the SB DSP chip
add dx,0Eh add dx,0Eh
in al,dx in al,dx
mov al,14h ; restart DMA transfer mov al,14h ; restart DMA transfer
@ -1163,4 +1163,3 @@ IRQAckPIC:
iretd iretd
end end


View file

@ -11,14 +11,14 @@
void Mymemset(void *,int,int); void Mymemset(void *,int,int);
int MouseModifier = 2; int MouseModifier = 2;
//============================================================================= //=============================================================================
// Check if mouse is installed, returns -1 if it IS installed // Check if mouse is installed, returns -1 if it IS installed
//============================================================================= //=============================================================================
int MouseInstalled(void) int MouseInstalled(void)
{ {
int yesno; int yesno;
union REGPACK regs; union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK)); Mymemset(&regs,0,sizeof(union REGPACK));
@ -59,7 +59,7 @@ intr(0x33,&regs);
//============================================================================= //=============================================================================
int ReadMouseCursor(int *mrow,int *mcol) int ReadMouseCursor(int *mrow,int *mcol)
{ {
int bstatus; int bstatus;
union REGPACK regs; union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK)); Mymemset(&regs,0,sizeof(union REGPACK));
@ -77,7 +77,7 @@ return(bstatus);
//============================================================================= //=============================================================================
int ReadMouseButtons(void) int ReadMouseButtons(void)
{ {
int bstatus; int bstatus;
union REGPACK regs; union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK)); Mymemset(&regs,0,sizeof(union REGPACK));
@ -178,4 +178,3 @@ intr(0x33,&regs);
} }


View file

@ -4,62 +4,62 @@
// Module: KIT.H // Module: KIT.H
// (c) CopyRight 1994 All Rights Reserved // (c) CopyRight 1994 All Rights Reserved
#define MODE_GRAPHICS 0x13 #define MODE_GRAPHICS 0x13
#define MODE_TEXT 0x03 #define MODE_TEXT 0x03
#define SCREEN_LENGTH 64000 // Bytes in one full screen #define SCREEN_LENGTH 64000 // Bytes in one full screen
#define SCREEN_LEN_WORDS 32000 // Words in one screen #define SCREEN_LEN_WORDS 32000 // Words in one screen
#define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen #define SCREEN_LEN_DWORDS 16000 // DWORDS in one screen
#define SCREEN_PLANES 1 // Number of planes for this mode #define SCREEN_PLANES 1 // Number of planes for this mode
#define SCREEN_WIDTH 320 // Number of bytes in one row #define SCREEN_WIDTH 320 // Number of bytes in one row
#define SCREEN_HEIGHT 200 // Number of rows on screen #define SCREEN_HEIGHT 200 // Number of rows on screen
#define BUTTON_OK 0 #define BUTTON_OK 0
#define BUTTON_OKCANCEL 1 #define BUTTON_OKCANCEL 1
#define BUTTON_YESNO 2 #define BUTTON_YESNO 2
#define BUTTON_ABORTRETRY 3 #define BUTTON_ABORTRETRY 3
#define BUTTON_RET_OK 0 #define BUTTON_RET_OK 0
#define BUTTON_RET_CANCEL 1 #define BUTTON_RET_CANCEL 1
#define BUTTON_RET_YES 2 #define BUTTON_RET_YES 2
#define BUTTON_RET_NO 3 #define BUTTON_RET_NO 3
#define BUTTON_RET_ABORT 4 #define BUTTON_RET_ABORT 4
#define BUTTON_RET_RETRY 5 #define BUTTON_RET_RETRY 5
// Used in IORTN.C for message boxes // Used in IORTN.C for message boxes
typedef struct { typedef struct {
short x; short x;
short y; short y;
short x1; short x1;
short y1; short y1;
short index; short index;
} BUTTON; } BUTTON;
// Used in IORTN.C for message boxes // Used in IORTN.C for message boxes
typedef struct { typedef struct {
short Count; short Count;
short List[4]; short List[4];
} INDEXES; } INDEXES;
// Used in IORTN.C list boxes // Used in IORTN.C list boxes
typedef struct _lcb { typedef struct _lcb {
struct _lcb *Back; struct _lcb *Back;
struct _lcb *Fwd; struct _lcb *Fwd;
char Data[1]; char Data[1];
} LCB; } LCB;
typedef struct { typedef struct {
short ux; short ux;
short uy; short uy;
short ux1; short ux1;
short uy1; short uy1;
short dx; short dx;
short dy; short dy;
short dx1; short dx1;
short dy1; short dy1;
} ARROWRECT; } ARROWRECT;
//============================================================================= //=============================================================================
@ -137,4 +137,3 @@ short ShowPickList(char **p,short SortFlag);
//============================================================================= //=============================================================================
short LoadSet(char *fName); 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 ; Version 2.02a  May 09th, 1994
; ;
; Copyright 1993,94 Carlos Hasan ; Copyright 1993,94 Carlos Hasan
;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² ;²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
ideal ideal
p386 p386
model flat,c model flat,c
@ -16,13 +16,13 @@ jumps
global MODPlayModule:near global MODPlayModule:near
global MODStopModule:near global MODStopModule:near
global MODPlaySample:near global MODPlaySample:near
global MODPlayVoice:near global MODPlayVoice:near
global MODStopVoice:near global MODStopVoice:near
global MODSetPeriod:near global MODSetPeriod:near
global MODSetVolume:near global MODSetVolume:near
;;global _GETDS:near ;;global _GETDS:near
global OurDataSeg:dword global OurDataSeg:dword
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; EQUATES ; EQUATES
@ -46,32 +46,32 @@ RepLength dw ?
ends MODSample ends MODSample
struc MODHeader ; file header struc MODHeader ; file header
SongName db 20 dup (?) SongName db 20 dup (?)
Samples MODSample 31 dup (?) Samples MODSample 31 dup (?)
OrderLen db ? OrderLen db ?
ReStart db ? ReStart db ?
Order db 128 dup (?) Order db 128 dup (?)
Sign dd ? Sign dd ?
ends MODHeader ends MODHeader
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; MOD Player structures ; MOD Player structures
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
struc Voice struc Voice
Address dd ?,? ; Current Address Address dd ?,? ; Current Address
StartAddress dd ? ; Loop Start Address StartAddress dd ? ; Loop Start Address
EndAddress dd ? ; Loop End Address EndAddress dd ? ; Loop End Address
Frequency dd ? ; Frequency Frequency dd ? ; Frequency
Volume db ?,? ; Volume Volume db ?,? ; Volume
ends Voice ends Voice
struc Track struc Track
Period dw ? ; Note Period Period dw ? ; Note Period
Instr db ? ; Instr Number Instr db ? ; Instr Number
Volume db ? ; Volume Volume db ? ; Volume
Effect dw ? ; Effect Effect dw ? ; Effect
ends Track ends Track
struc Sample struc Sample
Period dw ? ; Default Period Period dw ? ; Default Period
@ -94,7 +94,7 @@ IRQVector df ? ; IRQ Saved Vector
BufSelector dw ? ; DPMI Buffer Selector BufSelector dw ? ; DPMI Buffer Selector
VolBuffer dd ? ; Volume Buffer Address VolBuffer dd ? ; Volume Buffer Address
DMABuffer dd ? ; DMA Buffer Address DMABuffer dd ? ; DMA Buffer Address
DMALength dw ? ; DMA Buffer Length DMALength dw ? ; DMA Buffer Length
BufferPos dw ? ; Current Buffer Position BufferPos dw ? ; Current Buffer Position
@ -118,9 +118,9 @@ OrderLen db ? ; Order Length
PatternRow db ? ; Pattern Row PatternRow db ? ; Pattern Row
OrderList db 128 dup (?) ; Order List OrderList db 128 dup (?) ; Order List
PatternPtr dd ? ; Current Pattern Address PatternPtr dd ? ; Current Pattern Address
Tempo db ? ; Tempo Tempo db ? ; Tempo
TempoCount db ? ; Tempo Internal Counter TempoCount db ? ; Tempo Internal Counter
BPM db ? ; BPM value BPM db ? ; BPM value
ActiveTracks dw ? ; Number of Active Tracks ActiveTracks dw ? ; Number of Active Tracks
Tracks Track MAXVOICES dup (?) ; Array of Tracks Tracks Track MAXVOICES dup (?) ; Array of Tracks
@ -145,61 +145,61 @@ codeseg
; In: ; In:
; Song = Modulefile address ; Song = Modulefile address
; Chans = Number of channels ; Chans = Number of channels
; Rate = Sampling Rate ; Rate = Sampling Rate
; Port = I/O Port ; Port = I/O Port
; IRQ = IRQ Level ; IRQ = IRQ Level
; DRQ = DRQ Channel ; DRQ = DRQ Channel
; Out: ; Out:
; EAX = status ; EAX = status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword proc MODPlayModule Song:dword,Chans:dword,Rate:dword,Port:dword,IRQ:dword,DRQ:dword
pushad pushad
mov edi,[Song] ; Load parameters from stack mov edi,[Song] ; Load parameters from stack
mov eax,[Chans] mov eax,[Chans]
mov [ActiveVoices],ax mov [ActiveVoices],ax
mov eax,[Rate] mov eax,[Rate]
mov [SBRate],ax mov [SBRate],ax
mov eax,[Port] mov eax,[Port]
mov [IOAddr],ax mov [IOAddr],ax
mov eax,[IRQ] mov eax,[IRQ]
mov [IRQNum],al mov [IRQNum],al
mov eax,[DRQ] mov eax,[DRQ]
mov [DRQNum],al mov [DRQNum],al
mov eax,MIDCRATE*428 ; setup frequency divisor mov eax,MIDCRATE*428 ; setup frequency divisor
xor edx,edx xor edx,edx
shld edx,eax,16 shld edx,eax,16
shl eax,16 shl eax,16
movzx ebx,[SBRate] movzx ebx,[SBRate]
div ebx div ebx
mov [FreqDivisor],eax mov [FreqDivisor],eax
call MODSetup ; setup MOD player stuff call MODSetup ; setup MOD player stuff
jc MODPlayDone jc MODPlayDone
call MCInit ; setup the muti-channel stuff call MCInit ; setup the muti-channel stuff
jc MODPlayDone jc MODPlayDone
mov dl,[BPM] ; setup the multi-channel timer mov dl,[BPM] ; setup the multi-channel timer
call MCStartTimer call MCStartTimer
call DMASetBuf ; setup DMA controller call DMASetBuf ; setup DMA controller
call IRQSetVect ; setup PIC interrupt call IRQSetVect ; setup PIC interrupt
call SBOpenDevice ; setup SB for playback call SBOpenDevice ; setup SB for playback
jnc MODPlayDone jnc MODPlayDone
call MODStopModule call MODStopModule
MODPlayDone: MODPlayDone:
popad popad
sbb eax,eax ; return status in EAX sbb eax,eax ; return status in EAX
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; MODStopModule - Stop playing the current modulefile ; MODStopModule - Stop playing the current modulefile
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODStopModule proc MODStopModule
pushad pushad
call SBCloseDevice ; done SB playback call SBCloseDevice ; done SB playback
call IRQRestVect ; done PIC interrupt call IRQRestVect ; done PIC interrupt
call DMAReset ; done DMA controller call DMAReset ; done DMA controller
call MCDone ; done multi-channel stuff call MCDone ; done multi-channel stuff
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -208,21 +208,21 @@ endp
; Voice = Audio channel ; Voice = Audio channel
; Instr = Instrument ; Instr = Instrument
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODPlaySample AVoice:dword,AInstr:dword proc MODPlaySample AVoice:dword,AInstr:dword
pushad pushad
mov ebx,[AVoice] ; change the voice sample parameters mov ebx,[AVoice] ; change the voice sample parameters
mov eax,[AInstr] mov eax,[AInstr]
mov edx,[eax+Sample.SampleData] mov edx,[eax+Sample.SampleData]
mov esi,[eax+Sample.SampleLength] mov esi,[eax+Sample.SampleLength]
add esi,edx add esi,edx
mov edi,esi mov edi,esi
call MCStartVoice call MCStartVoice
movzx ecx,[eax+Sample.Period] ; change the voice frequency movzx ecx,[eax+Sample.Period] ; change the voice frequency
call MCSetFrequency call MCSetFrequency
mov ax,[eax+Sample.Volume] ; and set the voice volume mov ax,[eax+Sample.Volume] ; and set the voice volume
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -233,20 +233,20 @@ endp
; Period = Amiga Period ; Period = Amiga Period
; Volume = Volume ; Volume = Volume
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword proc MODPlayVoice AVoice:dword,AInstr:dword,APeriod:dword,AVolume:dword
pushad pushad
mov ebx,[AVoice] ; change the voice sample parameters mov ebx,[AVoice] ; change the voice sample parameters
mov eax,[AInstr] mov eax,[AInstr]
mov edx,[4*eax+SmpAddress] mov edx,[4*eax+SmpAddress]
mov esi,[4*eax+SmpStartAddress] mov esi,[4*eax+SmpStartAddress]
mov edi,[4*eax+SmpEndAddress] mov edi,[4*eax+SmpEndAddress]
call MCStartVoice call MCStartVoice
mov ecx,[APeriod] ; change the voice frequency mov ecx,[APeriod] ; change the voice frequency
call MCSetFrequency call MCSetFrequency
mov eax,[AVolume] ; and set the voice volume mov eax,[AVolume] ; and set the voice volume
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -254,13 +254,13 @@ endp
; In: ; In:
; Voice = Audio channel ; Voice = Audio channel
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODStopVoice AVoice:dword proc MODStopVoice AVoice:dword
pushad pushad
mov ebx,[AVoice] ; set the voice volume to zero mov ebx,[AVoice] ; set the voice volume to zero
xor al,al xor al,al
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -269,13 +269,13 @@ endp
; Voice = Audio channel ; Voice = Audio channel
; Period = Amiga Period ; Period = Amiga Period
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODSetPeriod AVoice:dword,APeriod:dword proc MODSetPeriod AVoice:dword,APeriod:dword
pushad pushad
mov ebx,[AVoice] mov ebx,[AVoice]
mov ecx,[APeriod] mov ecx,[APeriod]
call MCSetFrequency call MCSetFrequency
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -284,13 +284,13 @@ endp
; Voice = Audio channel ; Voice = Audio channel
; Volume = New Volume ; Volume = New Volume
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
proc MODSetVolume AVoice:dword,AVolume:dword proc MODSetVolume AVoice:dword,AVolume:dword
pushad pushad
mov ebx,[AVoice] mov ebx,[AVoice]
mov eax,[AVolume] mov eax,[AVolume]
call MCSetVolume call MCSetVolume
popad popad
ret ret
endp endp
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -301,10 +301,10 @@ endp
; CF = status ; CF = status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MODSetup: MODSetup:
pushad ; check for valid modfile formats pushad ; check for valid modfile formats
mov [ActiveTracks],4 mov [ActiveTracks],4
cmp [edi+MODHeader.Sign],'.K.M' cmp [edi+MODHeader.Sign],'.K.M'
je MODParse je MODParse
cmp [edi+MODHeader.Sign],'4TLF' cmp [edi+MODHeader.Sign],'4TLF'
je MODParse je MODParse
mov [ActiveTracks],6 mov [ActiveTracks],6
@ -320,15 +320,15 @@ MODParse:
mov [PatternRow],40h mov [PatternRow],40h
mov [Tempo],6 mov [Tempo],6
mov [TempoCount],0 mov [TempoCount],0
mov [BPM],125 mov [BPM],125
mov al,[edi+MODHeader.OrderLen] mov al,[edi+MODHeader.OrderLen]
mov [OrderLen],al mov [OrderLen],al
mov ecx,80h ; copy order list mov ecx,80h ; copy order list
xor ebx,ebx xor ebx,ebx
xor ah,ah xor ah,ah
MODCopyOrder: MODCopyOrder:
mov al,[edi+ebx+MODHeader.Order] mov al,[edi+ebx+MODHeader.Order]
mov [ebx+OrderList],al mov [ebx+OrderList],al
cmp al,ah cmp al,ah
jb MODCopyNext jb MODCopyNext
@ -352,7 +352,7 @@ MODCopyPatterns:
mov ecx,31 ; setup samples data mov ecx,31 ; setup samples data
lea edi,[edi+MODHeader.Samples] lea edi,[edi+MODHeader.Samples]
xor ebx,ebx xor ebx,ebx
inc ebx inc ebx
MODCopySamples: MODCopySamples:
mov al,[edi+MODSample.Volume] mov al,[edi+MODSample.Volume]
@ -368,15 +368,15 @@ MODCopySamples:
add eax,eax add eax,eax
add edx,edx add edx,edx
add ebp,ebp 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. ja MODSetSmpLength ; start and end are the same.
xor edx,edx xor edx,edx
mov ebp,eax mov ebp,eax
MODSetSmpLength: MODSetSmpLength:
add edx,ebp add edx,ebp
add eax,esi add eax,esi
add edx,esi add edx,esi
add ebp,esi add ebp,esi
mov [4*ebx+SmpAddress],esi mov [4*ebx+SmpAddress],esi
mov [4*ebx+SmpEndAddress],edx mov [4*ebx+SmpEndAddress],edx
mov [4*ebx+SmpStartAddress],ebp mov [4*ebx+SmpStartAddress],ebp
@ -397,10 +397,10 @@ MODCallBack:
dec [TempoCount] ; decrease tempo counter dec [TempoCount] ; decrease tempo counter
jle MODNextRow ; next row? jle MODNextRow ; next row?
lea esi,[Tracks] lea esi,[Tracks]
xor ebx,ebx xor ebx,ebx
MODUpdateLoop: MODUpdateLoop:
call MODUpNote ; update note events call MODUpNote ; update note events
add esi,size Track add esi,size Track
inc ebx inc ebx
cmp bx,[ActiveTracks] cmp bx,[ActiveTracks]
jb MODUpdateLoop jb MODUpdateLoop
@ -416,12 +416,12 @@ MODNextRow:
mov [PatternRow],bl ; reset the pattern row mov [PatternRow],bl ; reset the pattern row
mov bl,[OrderPos] mov bl,[OrderPos]
inc bl ; update the order position inc bl ; update the order position
cmp bl,[OrderLen] cmp bl,[OrderLen]
jb MODSetOrder jb MODSetOrder
xor bl,bl xor bl,bl
MODSetOrder: MODSetOrder:
mov [OrderPos],bl 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 edi,[4*ebx+PatternList]
mov [PatternPtr],edi ; set the pattern address mov [PatternPtr],edi ; set the pattern address
MODDontWrap: MODDontWrap:
@ -447,9 +447,9 @@ MODGetNoteLoop:
; EDI = pattern data address ; EDI = pattern data address
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MODGetNote: MODGetNote:
mov al,[edi+2] ; get the sample number mov al,[edi+2] ; get the sample number
shr al,4 shr al,4
mov ah,[edi] mov ah,[edi]
and ah,0F0h and ah,0F0h
or al,ah or al,ah
test al,al ; nonzero value? test al,al ; nonzero value?
@ -464,7 +464,7 @@ MODGetPeriod:
xchg al,ah xchg al,ah
and ax,0FFFh and ax,0FFFh
test ax,ax test ax,ax
je MODGetEffect ; nonzero value? je MODGetEffect ; nonzero value?
mov [esi+Track.Period],ax ; set new period value mov [esi+Track.Period],ax ; set new period value
movzx ecx,ax movzx ecx,ax
call MCSetFrequency call MCSetFrequency
@ -472,8 +472,8 @@ MODGetPeriod:
movzx eax,[esi+Track.Instr] movzx eax,[esi+Track.Instr]
mov edx,[4*eax+SmpAddress] mov edx,[4*eax+SmpAddress]
mov esi,[4*eax+SmpStartAddress] mov esi,[4*eax+SmpStartAddress]
mov edi,[4*eax+SmpEndAddress] mov edi,[4*eax+SmpEndAddress]
call MCStartVoice call MCStartVoice
pop edi esi pop edi esi
MODGetEffect: MODGetEffect:
mov ax,[edi+2] ; get the effect value mov ax,[edi+2] ; get the effect value
@ -488,7 +488,7 @@ MODGetEffect:
je EFXJumpPos je EFXJumpPos
cmp ah,0Dh cmp ah,0Dh
je EFXBreak je EFXBreak
cmp ah,09h cmp ah,09h
je EFXSampleOffset je EFXSampleOffset
ret ret
@ -499,10 +499,10 @@ MODGetEffect:
; ESI = track address ; ESI = track address
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MODUpNote: MODUpNote:
mov ax,[esi+Track.Effect] ; dispatch the effects mov ax,[esi+Track.Effect] ; dispatch the effects
cmp ah,0Ah cmp ah,0Ah
je EFXSlideVolume je EFXSlideVolume
ret ret
;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±
@ -512,7 +512,7 @@ MODUpNote:
;  The registers EBX,ESI,EDI must be preserved. ;  The registers EBX,ESI,EDI must be preserved.
;  The effect parameters are passed through the registers: ;  The effect parameters are passed through the registers:
; EBX - voice number ; EBX - voice number
; ESI - track address ; ESI - track address
; AL - effect parameter ; AL - effect parameter
;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°± ;°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±°±
@ -536,7 +536,7 @@ EFXSetSpeed:
mov [TempoCount],al mov [TempoCount],al
ret ret
EFXSetBPM: EFXSetBPM:
mov [BPM],al mov [BPM],al
mov dl,al mov dl,al
call MCStartTimer call MCStartTimer
ret ret
@ -548,7 +548,7 @@ EFXJumpPos:
dec al dec al
mov [OrderPos],al mov [OrderPos],al
mov [PatternRow],40h mov [PatternRow],40h
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; EFXBreak - breaks the current pattern. ; EFXBreak - breaks the current pattern.
@ -572,7 +572,7 @@ EFXSlideVolume:
mov al,40h mov al,40h
EFXVolSlided: EFXVolSlided:
mov [esi+Track.Volume],al mov [esi+Track.Volume],al
call MCSetVolume call MCSetVolume
ret ret
EFXVolumeDown: EFXVolumeDown:
sub al,ah sub al,ah
@ -584,7 +584,7 @@ EFXVolumeDown:
; EFXSampleOffset - Set the sample offset ; EFXSampleOffset - Set the sample offset
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
EFXSampleOffset: EFXSampleOffset:
xor edx,edx xor edx,edx
mov dh,al mov dh,al
push esi edi push esi edi
movzx eax,[esi+Track.Instr] movzx eax,[esi+Track.Instr]
@ -606,9 +606,9 @@ EFXSampleOffset:
; CF = status ; CF = status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MCInit: MCInit:
pushad pushad
xor ax,ax ; initialize variables xor ax,ax ; initialize variables
mov [BufferPos],ax mov [BufferPos],ax
mov [TimerCount],ax mov [TimerCount],ax
mov [TimerSpeed],ax mov [TimerSpeed],ax
mov [BufSelector],ax mov [BufSelector],ax
@ -627,7 +627,7 @@ MCInit:
cmp ax,cx cmp ax,cx
jae MCAlignVolBuffer jae MCAlignVolBuffer
mov esi,edi mov esi,edi
add edi,4200h add edi,4200h
MCAlignVolBuffer: ; VolBuffer must be page aligned MCAlignVolBuffer: ; VolBuffer must be page aligned
add esi,0FFh ; (256 bytes = 1 page) add esi,0FFh ; (256 bytes = 1 page)
and esi,not 0FFh and esi,not 0FFh
@ -651,7 +651,7 @@ MCDoVolBuffer:
imul bh imul bh
sar ax,cl sar ax,cl
mov [edi],ah mov [edi],ah
inc edi inc edi
inc bl inc bl
jne MCDoVolBuffer jne MCDoVolBuffer
inc bh inc bh
@ -675,7 +675,7 @@ MCDone:
mov [BufSelector],0 mov [BufSelector],0
MCDoneExit: MCDoneExit:
popad popad
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; MCStartVoice - Set the voice sample instrument parameters ; MCStartVoice - Set the voice sample instrument parameters
@ -723,7 +723,7 @@ MCSetFreqDone:
; AL = volume ; AL = volume
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MCSetVolume: MCSetVolume:
push ebx push ebx
mov ebx,[4*ebx+VoiceTable] mov ebx,[4*ebx+VoiceTable]
mov [ebx+Voice.Volume],al mov [ebx+Voice.Volume],al
pop ebx pop ebx
@ -747,7 +747,7 @@ MCStartTimer:
mov [TimerSpeed],ax mov [TimerSpeed],ax
pop dx pop dx
pop cx pop cx
pop ax pop ax
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
@ -771,7 +771,7 @@ MCPollLoop:
cmp [TimerCount],0 ; time to call the MOD callback? cmp [TimerCount],0 ; time to call the MOD callback?
jg MCPollChunk jg MCPollChunk
call MODCallBack call MODCallBack
mov ax,[TimerSpeed] ; update timer accumulator mov ax,[TimerSpeed] ; update timer accumulator
add [TimerCount],ax add [TimerCount],ax
MCPollChunk: MCPollChunk:
mov ax,[BufferLen] ; get the chunk length mov ax,[BufferLen] ; get the chunk length
@ -795,7 +795,7 @@ MCVoicesLoop:
call MCMixVoice call MCMixVoice
pop edi pop edi
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
add ebx,size Voice add ebx,size Voice
dec dx dec dx
@ -814,12 +814,12 @@ MCPollDone:
; ECX = Number of samples ; ECX = Number of samples
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
MCMixVoice: MCMixVoice:
push ebx push ebx
; Modify the mixing chunk of code ; Modify the mixing chunk of code
mov eax,[ebx+Voice.EndAddress] mov eax,[ebx+Voice.EndAddress]
mov [dword ds:MCMixCode0],eax mov [dword ds:MCMixCode0],eax
mov [dword ds:MCMixCode2],eax mov [dword ds:MCMixCode2],eax
sub eax,[ebx+Voice.StartAddress] sub eax,[ebx+Voice.StartAddress]
mov [dword ds:MCMixCode1],eax mov [dword ds:MCMixCode1],eax
@ -836,7 +836,7 @@ MCMixVoice:
; Load the volume table address ; Load the volume table address
mov bh,[ebx+Voice.Volume] mov bh,[ebx+Voice.Volume]
and ebx,0FF00h and ebx,0FF00h
add ebx,[VolBuffer] add ebx,[VolBuffer]
; Start of the mixing chunk of code (non pure code) ; Start of the mixing chunk of code (non pure code)
@ -879,12 +879,12 @@ MCMixBreak:
; AL = data ; AL = data
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
SBWrite: SBWrite:
push eax push eax
push ecx push ecx
push edx push edx
mov dx,[IOAddr] mov dx,[IOAddr]
add dx,0Ch add dx,0Ch
mov ecx,10000h ; wait until the DSP is ready mov ecx,10000h ; wait until the DSP is ready
mov ah,al ; to receive the data byte mov ah,al ; to receive the data byte
SBWriteWait: SBWriteWait:
in al,dx in al,dx
@ -895,7 +895,7 @@ SBWriteWait:
pop edx pop edx
pop ecx pop ecx
pop eax pop eax
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; SBResetDSP - reset the Sound Blaster DSP chip ; SBResetDSP - reset the Sound Blaster DSP chip
@ -919,7 +919,7 @@ SBResetDSP:
SBReadWait: SBReadWait:
in al,dx in al,dx
and al,80h and al,80h
loopz SBReadWait loopz SBReadWait
sub dx,04h sub dx,04h
in al,dx ; read the DSP data byte in al,dx ; read the DSP data byte
cmp al,0AAh cmp al,0AAh
@ -941,9 +941,9 @@ SBResetDone:
; CF = initialization status ; CF = initialization status
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
SBOpenDevice: SBOpenDevice:
pusha pusha
call SBResetDSP ; check for a SB card call SBResetDSP ; check for a SB card
jc SBOpenDone jc SBOpenDone
mov al,0D1h mov al,0D1h
call SBWrite ; turn on SB speaker call SBWrite ; turn on SB speaker
mov al,40h mov al,40h
@ -964,7 +964,7 @@ SBOpenDevice:
clc ; set successful status clc ; set successful status
SBOpenDone: SBOpenDone:
popa popa
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; SBCloseDevice - shutdown the SB playback ; SBCloseDevice - shutdown the SB playback
@ -988,7 +988,7 @@ DMAReset:
pusha pusha
mov al,[DRQNum] ; reset the DMA channel mov al,[DRQNum] ; reset the DMA channel
or al,04h or al,04h
out 0Ah,al out 0Ah,al
popa popa
ret ret
@ -1012,7 +1012,7 @@ DMASetBuf:
add dx,dx add dx,dx
mov eax,[DMABuffer] mov eax,[DMABuffer]
out dx,al out dx,al
mov al,ah mov al,ah
out dx,al out dx,al
inc dx ; set the DMA buffer length inc dx ; set the DMA buffer length
mov ax,[DMALength] mov ax,[DMALength]
@ -1048,15 +1048,15 @@ IRQGetIntNum:
push ax bx cx ; get the virtual master and slave push ax bx cx ; get the virtual master and slave
mov ax,0400h ; PIC base interrupts in DX mov ax,0400h ; PIC base interrupts in DX
int 31h int 31h
pop cx bx ax pop cx bx ax
cmp al,08h ; get the PIC base interrupt for cmp al,08h ; get the PIC base interrupt for
jb IRQGetDone ; the IRQ number in AL jb IRQGetDone ; the IRQ number in AL
mov dh,dl mov dh,dl
sub al,08h sub al,08h
IRQGetDone: IRQGetDone:
add al,dh add al,dh
pop dx pop dx
ret ret
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
; IRQRestVect - Restores the previous IRQ vector ; IRQRestVect - Restores the previous IRQ vector
@ -1066,13 +1066,13 @@ IRQGetDone:
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
IRQRestVect: IRQRestVect:
pushad pushad
push ds push ds
in al,0A1h ; disable the IRQ interrupt using in al,0A1h ; disable the IRQ interrupt using
mov ah,al ; the PIC interrupt mask registers mov ah,al ; the PIC interrupt mask registers
in al,21h in al,21h
mov dx,01h mov dx,01h
mov cl,[IRQNum] mov cl,[IRQNum]
shl dx,cl shl dx,cl
or ax,dx or ax,dx
out 21h,al out 21h,al
mov al,ah mov al,ah
@ -1090,7 +1090,7 @@ IRQRestVect:
IRQRestDone: IRQRestDone:
pop ds pop ds
xor ebx,ebx xor ebx,ebx
mov [dword IRQVector],ebx mov [dword IRQVector],ebx
mov [word 4+IRQVector],bx mov [word 4+IRQVector],bx
popad popad
ret ret
@ -1114,7 +1114,7 @@ IRQSetVect:
push cs push cs
pop ds pop ds
int 21h int 21h
pop es ds pop es ds
in al,0A1h ; enable this IRQ using the in al,0A1h ; enable this IRQ using the
mov al,ah ; PIC interrupt mask registers mov al,ah ; PIC interrupt mask registers
in al,21h in al,21h
@ -1133,14 +1133,14 @@ IRQSetVect:
; IRQHandler - Hardware IRQ handler ; IRQHandler - Hardware IRQ handler
;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ;°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
IRQHandler: IRQHandler:
pushad ; pushes all the registers pushad ; pushes all the registers
push ds push ds
;;; mov ax,DGROUP ; load the DS selector ;;; mov ax,DGROUP ; load the DS selector
;;; mov ds,ax ;;; mov ds,ax
;;; call _GETDS ;;; call _GETDS
mov ax,cs:[dword ptr OurDataSeg] mov ax,cs:[dword ptr OurDataSeg]
mov ds,ax mov ds,ax
mov dx,[IOAddr] ; send ack to the SB DSP chip mov dx,[IOAddr] ; send ack to the SB DSP chip
add dx,0Eh add dx,0Eh
in al,dx in al,dx
mov al,14h ; restart DMA transfer mov al,14h ; restart DMA transfer
@ -1163,4 +1163,3 @@ IRQAckPIC:
iretd iretd
end end


View file

@ -11,14 +11,14 @@
void Mymemset(void *,int,int); void Mymemset(void *,int,int);
int MouseModifier = 2; int MouseModifier = 2;
//============================================================================= //=============================================================================
// Check if mouse is installed, returns -1 if it IS installed // Check if mouse is installed, returns -1 if it IS installed
//============================================================================= //=============================================================================
int MouseInstalled(void) int MouseInstalled(void)
{ {
int yesno; int yesno;
union REGPACK regs; union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK)); Mymemset(&regs,0,sizeof(union REGPACK));
@ -59,7 +59,7 @@ intr(0x33,&regs);
//============================================================================= //=============================================================================
int ReadMouseCursor(int *mrow,int *mcol) int ReadMouseCursor(int *mrow,int *mcol)
{ {
int bstatus; int bstatus;
union REGPACK regs; union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK)); Mymemset(&regs,0,sizeof(union REGPACK));
@ -77,7 +77,7 @@ return(bstatus);
//============================================================================= //=============================================================================
int ReadMouseButtons(void) int ReadMouseButtons(void)
{ {
int bstatus; int bstatus;
union REGPACK regs; union REGPACK regs;
Mymemset(&regs,0,sizeof(union REGPACK)); Mymemset(&regs,0,sizeof(union REGPACK));
@ -178,4 +178,3 @@ intr(0x33,&regs);
} }