add dos map_edit sources
from the book cd under /ACK/DOS/MAP_EDIT/SOURCE
This commit is contained in:
parent
45007835fa
commit
cf7cd898cd
BIN
map_edit/font6x9.bbm
Normal file
BIN
map_edit/font6x9.bbm
Normal file
Binary file not shown.
BIN
map_edit/font6x9.lbm
Normal file
BIN
map_edit/font6x9.lbm
Normal file
Binary file not shown.
96
map_edit/iff.h
Normal file
96
map_edit/iff.h
Normal file
|
@ -0,0 +1,96 @@
|
|||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#define LONG unsigned long
|
||||
#define ULONG unsigned long
|
||||
#define UBYTE unsigned char
|
||||
#define UWORD unsigned short
|
||||
#define DWORD unsigned long
|
||||
|
||||
long ByteFlipLong(long);
|
||||
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 */
|
||||
|
||||
#define MakeID(d,c,b,a) ((DWORD)(a)<<24 | (DWORD)(b)<<16 | (DWORD)(c)<<8 | (DWORD)(d) )
|
||||
|
||||
#define FORM MakeID('F','O','R','M')
|
||||
#define PROP MakeID('P','R','O','P')
|
||||
#define LIST MakeID('L','I','S','T')
|
||||
#define CAT MakeID('C','A','T',' ')
|
||||
#define FILLER MakeID(' ',' ',' ',' ')
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ID type;
|
||||
long cksize;
|
||||
ID subtype;
|
||||
} form_chunk;
|
||||
|
||||
typedef struct {
|
||||
ID ckID;
|
||||
LONG ckSize;
|
||||
} ChunkHeader;
|
||||
|
||||
typedef struct {
|
||||
ID ckID;
|
||||
LONG ckSize;
|
||||
UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
|
||||
} Chunk;
|
||||
|
||||
#define ID_PBM MakeID('P','B','M',' ')
|
||||
#define ID_ILBM MakeID('I','L','B','M')
|
||||
#define ID_BMHD MakeID('B','M','H','D')
|
||||
#define ID_CMAP MakeID('C','M','A','P')
|
||||
#define ID_GRAB MakeID('G','R','A','B')
|
||||
#define ID_DEST MakeID('D','E','S','T')
|
||||
#define ID_SPRT MakeID('S','P','R','T')
|
||||
#define ID_CAMG MakeID('C','A','M','G')
|
||||
#define ID_BODY MakeID('B','O','D','Y')
|
||||
|
||||
/* ---------- BitMapHeader ---------------------------------------------*/
|
||||
|
||||
typedef UBYTE Masking; /* Choice of masking technique.*/
|
||||
#define mskNone 0
|
||||
#define mskHasMask 1
|
||||
#define mskHasTransparentColor 2
|
||||
#define mskLasso 3
|
||||
|
||||
#define cmpNone 0
|
||||
#define cmpByteRun1 1
|
||||
|
||||
/* A BitMapHeader is stored in a BMHD chunk. */
|
||||
typedef struct {
|
||||
UWORD w, h; /* raster width & height in pixels */
|
||||
UWORD x, y; /* position for this image */
|
||||
UBYTE nPlanes; /* # source bitplanes */
|
||||
UBYTE masking; /* masking technique */
|
||||
UBYTE compression; /* compression algoithm */
|
||||
UBYTE pad1; /* UNUSED. For consistency, put 0 here.*/
|
||||
UWORD transparentColor; /* transparent "color number" */
|
||||
UBYTE xAspect, yAspect; /* aspect ratio, a rational number x/y */
|
||||
UWORD pageWidth, pageHeight; /* source "page" size in pixels */
|
||||
} BitMapHeader;
|
||||
/* RowBytes computes the number of bytes in a row, from the width in pixels.*/
|
||||
#define RowBytes(w) (((w) + 15) >> 4 << 1)
|
||||
|
||||
/* A CMAP chunk is a packed array of ColorRegisters (3 bytes each). */
|
||||
typedef struct {
|
||||
UBYTE red, green, blue; /* MUST be UBYTEs so ">> 4" won't sign extend.*/
|
||||
} ColorRegister;
|
||||
|
||||
/* Use this constant instead of sizeof(ColorRegister). */
|
||||
#define sizeofColorRegister 3
|
||||
|
||||
long ByteFlipLong(long);
|
||||
void ByteFlipShort(short *);
|
||||
short iffswab(unsigned short);
|
||||
short swab(unsigned short);
|
||||
|
||||
|
BIN
map_edit/kit.map
Normal file
BIN
map_edit/kit.map
Normal file
Binary file not shown.
BIN
map_edit/kitmap.sav
Normal file
BIN
map_edit/kitmap.sav
Normal file
Binary file not shown.
BIN
map_edit/m1.bbm
Normal file
BIN
map_edit/m1.bbm
Normal file
Binary file not shown.
2646
map_edit/m1.c
Normal file
2646
map_edit/m1.c
Normal file
File diff suppressed because it is too large
Load diff
222
map_edit/m1.h
Normal file
222
map_edit/m1.h
Normal file
|
@ -0,0 +1,222 @@
|
|||
// Header file for ACK-3D Map Editor
|
||||
// Author: Lary Myers
|
||||
// Copyright (c) 1994
|
||||
|
||||
|
||||
#define RES_SMFONT 0 // Resource ID's
|
||||
#define RES_MDFONT 1
|
||||
#define RES_2DSCREEN 2
|
||||
#define RES_3DSCREEN 3
|
||||
#define RES_SELSCREEN 4
|
||||
|
||||
|
||||
#define BM_X 272
|
||||
#define BM_Y 17
|
||||
|
||||
#define BM_NUM_X 308
|
||||
#define BM_NUM_Y 30
|
||||
|
||||
#define MAP_X 0
|
||||
#define MAP_Y 0
|
||||
#define MAP_X1 256
|
||||
#define MAP_Y1 160
|
||||
|
||||
#define MINI_X 255
|
||||
#define MINI_Y 135
|
||||
#define MINI_X1 (MINI_X+63)
|
||||
#define MINI_Y1 (MINI_Y+63)
|
||||
|
||||
#define MAPXY_X 217
|
||||
#define MAPXY_Y 165
|
||||
#define MAPXY_X1 231
|
||||
#define MAPXY_Y1 165
|
||||
|
||||
#define CURXY_X 217
|
||||
#define CURXY_Y 173
|
||||
#define CURXY_X1 231
|
||||
#define CURXY_Y1 173
|
||||
|
||||
#define GD_FWT 32
|
||||
#define GD_FHT 32
|
||||
#define GD_HWT 16
|
||||
#define GD_HHT 16
|
||||
|
||||
#define VM_2D 0 // View mode is 2D
|
||||
#define VM_3D 1 // View mode is 3D
|
||||
|
||||
#define VT_MAP 0 // Viewing map
|
||||
#define VT_FLOOR 1 // Viewing floor
|
||||
#define VT_CEIL 2 // Viewing ceiling
|
||||
|
||||
|
||||
#define ED_WALLS 0 // Editing walls
|
||||
#define ED_OBJECTS 1 // Editing objects
|
||||
|
||||
#define AI_UP 1 // Action index's
|
||||
#define AI_RIGHT 2
|
||||
#define AI_DOWN 3
|
||||
#define AI_LEFT 4
|
||||
#define AI_MINI 5
|
||||
#define AI_SELECT 6
|
||||
#define AI_VIEW 7
|
||||
#define AI_FLOORS 8
|
||||
#define AI_SAVE 9
|
||||
#define AI_MAP 10
|
||||
#define AI_WALLS 11
|
||||
#define AI_CEILING 12
|
||||
#define AI_OBJECTS 13
|
||||
#define AI_OPTIONS 14
|
||||
#define AI_EDITWIN 15
|
||||
#define AI_BM_UP 16
|
||||
#define AI_BM_DOWN 17
|
||||
#define AI_EXIT 99
|
||||
|
||||
#define OPT_NORMAL 0 // Selectable option ID's
|
||||
#define OPT_SLIDING 1
|
||||
#define OPT_SPLIT 2
|
||||
#define OPT_SECRET 3
|
||||
#define OPT_LOCKED 4
|
||||
#define OPT_TRANS 5
|
||||
#define OPT_MULTI 6
|
||||
#define OPT_RAISED 7
|
||||
#define OPT_CANCEL 8
|
||||
#define OPT_FILL 9
|
||||
#define OPT_BORDER 10
|
||||
#define OPT_CLEAR 11
|
||||
#define OPT_PASSABLE 12
|
||||
#define OPT_PALETTE 13
|
||||
#define OPT_MAPPAL 14
|
||||
|
||||
#define OPT_MAX 15 // Total number of options above
|
||||
|
||||
|
||||
#define BM_COLOR_X 261 // Current bitmap color coordinates
|
||||
#define BM_COLOR_Y 17
|
||||
#define BM_COLOR_X1 267
|
||||
#define BM_COLOR_Y1 48
|
||||
|
||||
typedef struct {
|
||||
short Action;
|
||||
short x;
|
||||
short y;
|
||||
short x1;
|
||||
short y1;
|
||||
} HS;
|
||||
|
||||
typedef struct {
|
||||
short id;
|
||||
int xBias;
|
||||
int yBias;
|
||||
UCHAR Flags;
|
||||
char *Text;
|
||||
} OPTS;
|
||||
|
||||
#define OPTF_CHECKED 0x80 // Button will have a checkmark
|
||||
|
||||
|
||||
#define VIDSEG (UCHAR *)0xA0000
|
||||
|
||||
#define MAX_MULTI 3
|
||||
|
||||
#define KEY_ESC 0x011B
|
||||
#define KEY_SPACE 0x3920
|
||||
#define KEY_F2 0x3C00
|
||||
#define KEY_F3 0x3D00
|
||||
#define KEY_UP 0x4800
|
||||
#define KEY_RIGHT 0x4D00
|
||||
#define KEY_DOWN 0x5000
|
||||
#define KEY_LEFT 0x4B00
|
||||
#define KEY_PGUP 0x4900
|
||||
#define KEY_PGDN 0x5100
|
||||
|
||||
//=============================================================================
|
||||
// Prototypes;
|
||||
//=============================================================================
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions in mouse.c
|
||||
//-----------------------------------------------------------------------------
|
||||
short MouseInstalled(void);
|
||||
void ShowMouse(void);
|
||||
void HideMouse(void);
|
||||
short ReadMouseCursor(short *mrow,short *mcol);
|
||||
short ReadMouseButtons(void);
|
||||
void SetMouseCursor(short mrow,short mcol);
|
||||
void SetMouseMinMaxColumns(short mincol,short maxcol);
|
||||
void SetMouseMinMaxRows(short minrow,short maxrow);
|
||||
void SetMouseShape(short hsrow,short hscol,char far *mask);
|
||||
void MouseReleased(void);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions in m1.c
|
||||
//-----------------------------------------------------------------------------
|
||||
short GetAction(short mx,short my);
|
||||
short GetSelAction(short mx,short my);
|
||||
void DrawYline(int x,int y);
|
||||
void DrawXline(int x,int y);
|
||||
void DrawGridBlock(int x,int y);
|
||||
void DrawYbitmap(int x,int y,UCHAR *bm,UCHAR Shade,int TransFlag);
|
||||
void DrawXbitmap(int x,int y,UCHAR *bm,UCHAR Shade,int TransFlag);
|
||||
void ClearGridArea(UCHAR *BufPtr);
|
||||
void RefreshGrid(void);
|
||||
void DrawGrid3D(void);
|
||||
void Draw2Dxline(int x,int y,UCHAR color);
|
||||
void DrawxLineMulti(int x,int y,UCHAR color);
|
||||
void Draw2Dyline(int x,int y,UCHAR color);
|
||||
void DrawyLineMulti(int x,int y,UCHAR color);
|
||||
void DrawGrid2D(void);
|
||||
void DrawTinyBitmap(int x,int y,UCHAR *bm);
|
||||
void DrawFloorCeil(void);
|
||||
void DrawObjects(void);
|
||||
void DrawGrid(void);
|
||||
void ShowScreen(char *Name);
|
||||
void ShowBitmap(int x,int y,UCHAR *bm);
|
||||
short LoadGridMap(char *Name);
|
||||
short SaveGridMap(char *Name);
|
||||
void ShowCurrentBitmap(void);
|
||||
short GetActionIndex(short action);
|
||||
void PressButton(short ActionCode);
|
||||
void ReleaseButton(short ActionCode);
|
||||
void UpdateScreen(void);
|
||||
int GetGridPos(short mx,short my);
|
||||
void PutCode(short mx,short my);
|
||||
void UpdatePosn(short mx,short my);
|
||||
void ShowSelBitmaps(UCHAR bCode);
|
||||
int SelectScreen(void);
|
||||
UCHAR GetIndexColor(short index);
|
||||
UCHAR GetIndexColor2(short index);
|
||||
void DrawBackBox(int x,int y,int x1,int y1);
|
||||
void ShowButtons(OPTS *op,HS *hs,int x,int y,int xAmt,int yAmt);
|
||||
int ShowOptions(void);
|
||||
void FillMap(UCHAR bCode);
|
||||
void DrawArrow(int x,int y,UCHAR color);
|
||||
int SelectGridBox(void);
|
||||
void EditMulti(int mode,short mx,short my);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions in m1util.c
|
||||
//-----------------------------------------------------------------------------
|
||||
void SoundBeep(void);
|
||||
short LoadSmallFont(void);
|
||||
short LoadMedFont(void);
|
||||
void mdWriteChar(short x,short y,unsigned char ch);
|
||||
short mdWriteString(short x,short y,char *s);
|
||||
void smWriteChar(short x,short y,unsigned char ch);
|
||||
short smWriteString(short x,short y,char *s);
|
||||
void smWriteHUD(short x,short y,UCHAR color,char *s);
|
||||
void BlitBlock(int x,int y,int x1,int y1,UCHAR *buf);
|
||||
void DrawFillBox(int x,int y,int x1,int y1,UCHAR color);
|
||||
void DrawHorzLine(int x,int y,int x1,UCHAR color);
|
||||
void DrawVertLine(int x,int y,int y1,UCHAR color);
|
||||
void DrawBox(int x,int y,int x1,int y1,UCHAR color);
|
||||
UCHAR GetColor(int x,int y);
|
||||
void SaveVideo(UCHAR *buf);
|
||||
void RestoreVideo(UCHAR *buf);
|
||||
void CreateButton(int x,int y,HS *hs,char *s);
|
||||
int QueryBox(int x,int y,char *Msg);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions in m1read.c
|
||||
//-----------------------------------------------------------------------------
|
||||
short LoadDescFile(char *fName);
|
||||
|
BIN
map_edit/m1.lbm
Normal file
BIN
map_edit/m1.lbm
Normal file
Binary file not shown.
BIN
map_edit/m12.bbm
Normal file
BIN
map_edit/m12.bbm
Normal file
Binary file not shown.
BIN
map_edit/m12d.bmp
Normal file
BIN
map_edit/m12d.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
BIN
map_edit/m12d.lbm
Normal file
BIN
map_edit/m12d.lbm
Normal file
Binary file not shown.
BIN
map_edit/m12d.pcx
Normal file
BIN
map_edit/m12d.pcx
Normal file
Binary file not shown.
BIN
map_edit/m13d.lbm
Normal file
BIN
map_edit/m13d.lbm
Normal file
Binary file not shown.
8
map_edit/m1files.dat
Normal file
8
map_edit/m1files.dat
Normal file
|
@ -0,0 +1,8 @@
|
|||
; Resource files for ACK3D Map Editor
|
||||
SPFONT.BBM
|
||||
FONT6X9.BBM
|
||||
M12D.LBM
|
||||
M13D.LBM
|
||||
M1SEL.LBM
|
||||
|
||||
|
354
map_edit/m1read.c
Normal file
354
map_edit/m1read.c
Normal file
|
@ -0,0 +1,354 @@
|
|||
// Map Editor for Animation Construction Kit 3D
|
||||
// ASCII Reader program
|
||||
// Author: Lary Myers
|
||||
// Copyright (c) 1994
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <dos.h>
|
||||
#include <mem.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <process.h>
|
||||
#include <bios.h>
|
||||
#include <sys\stat.h>
|
||||
#include "ack3d.h"
|
||||
#include "ackeng.h"
|
||||
|
||||
|
||||
extern UCHAR *Bitmaps[];
|
||||
extern UCHAR *ObjBitmaps[];
|
||||
extern UCHAR ObjbmNum[];
|
||||
extern char MapName[];
|
||||
extern char PalName[];
|
||||
|
||||
short ReadErrorCode;
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
****************************************************************************/
|
||||
char *GetExtent(char *s)
|
||||
{
|
||||
char *e;
|
||||
|
||||
e = strchr(s,'.');
|
||||
if (e == NULL)
|
||||
return(s);
|
||||
e++;
|
||||
|
||||
return(e);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
****************************************************************************/
|
||||
short LoadBitmap(short BitmapNumber,char *BitmapName,short BitmapType)
|
||||
{
|
||||
short LoadType;
|
||||
short handle;
|
||||
short x,y;
|
||||
short sPos,dPos;
|
||||
unsigned char ch;
|
||||
unsigned char *bmp;
|
||||
|
||||
LoadType = 0;
|
||||
if (!(stricmp(GetExtent(BitmapName),"BBM")))
|
||||
LoadType = 1;
|
||||
|
||||
if (!(stricmp(GetExtent(BitmapName),"GIF")))
|
||||
LoadType = 2;
|
||||
|
||||
|
||||
if (LoadType)
|
||||
{
|
||||
if (LoadType == 1)
|
||||
bmp = AckReadiff(BitmapName);
|
||||
else
|
||||
bmp = AckReadgif(BitmapName);
|
||||
|
||||
if (bmp == NULL)
|
||||
{
|
||||
ReadErrorCode = ERR_NOMEMORY;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (BitmapType == TYPE_WALL)
|
||||
Bitmaps[BitmapNumber] = bmp;
|
||||
|
||||
if (BitmapType == TYPE_OBJECT)
|
||||
ObjBitmaps[BitmapNumber] = bmp;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
bmp = malloc(4096);
|
||||
if (bmp == NULL)
|
||||
{
|
||||
ReadErrorCode = ERR_NOMEMORY;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (BitmapType == TYPE_WALL)
|
||||
Bitmaps[BitmapNumber] = bmp;
|
||||
|
||||
if (BitmapType == TYPE_OBJECT)
|
||||
ObjBitmaps[BitmapNumber] = bmp;
|
||||
|
||||
|
||||
handle = open(BitmapName,O_RDWR|O_BINARY);
|
||||
if (handle < 1)
|
||||
{
|
||||
free(bmp);
|
||||
ReadErrorCode = ERR_BADFILE;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
read(handle,bmp,4); /* Skip width and height for now */
|
||||
read(handle,bmp,4096);
|
||||
close(handle);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
****************************************************************************/
|
||||
char *StripEndOfLine(char *s)
|
||||
{
|
||||
short len;
|
||||
char ch;
|
||||
|
||||
len = strlen(s);
|
||||
|
||||
while (--len >= 0)
|
||||
{
|
||||
ch = s[len];
|
||||
if (ch != ' ' && ch != ';' && ch != '\t' && ch != 13 && ch != 10)
|
||||
break;
|
||||
|
||||
s[len] = '\0';
|
||||
}
|
||||
|
||||
return(s);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
****************************************************************************/
|
||||
char *SkipSpaces(char *s)
|
||||
{
|
||||
|
||||
while (*s == ' ' || *s == '\t' || *s == ',')
|
||||
strcpy(s,&s[1]);
|
||||
|
||||
return(s);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
****************************************************************************/
|
||||
char *AddExtent(char *s,char *ext)
|
||||
{
|
||||
if (strchr(s,'.') == NULL)
|
||||
strcat(s,ext);
|
||||
|
||||
return(s);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
****************************************************************************/
|
||||
char *CopyToComma(char *dest,char *src)
|
||||
{
|
||||
char ch;
|
||||
|
||||
while (*src)
|
||||
{
|
||||
ch = *src++;
|
||||
if (ch == ' ' || ch == '\t' || ch == ',')
|
||||
break;
|
||||
|
||||
*dest++ = ch;
|
||||
}
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
return(src);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
****************************************************************************/
|
||||
short LoadDescFile(char *fName)
|
||||
{
|
||||
FILE *fp;
|
||||
short Mode,fMode,result;
|
||||
short bType,value,bNum,ObjIndex;
|
||||
char LineBuf[128];
|
||||
char fBuf[128];
|
||||
char *s;
|
||||
|
||||
fp = fopen(fName,"rt");
|
||||
if (fp == NULL)
|
||||
{
|
||||
printf("Unable to open description file: %s\n",fName);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
printf("Processing description file %s ",fName);
|
||||
|
||||
|
||||
ObjIndex = 0;
|
||||
Mode = 0;
|
||||
result = 0;
|
||||
*MapName = '\0';
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (feof(fp))
|
||||
break;
|
||||
|
||||
*LineBuf = '\0';
|
||||
fgets(LineBuf,127,fp);
|
||||
|
||||
if (*LineBuf == ';')
|
||||
continue;
|
||||
|
||||
StripEndOfLine(LineBuf);
|
||||
SkipSpaces(LineBuf);
|
||||
|
||||
if (!strlen(LineBuf))
|
||||
continue;
|
||||
|
||||
printf(".");
|
||||
|
||||
if (!stricmp(LineBuf,"WALLS:"))
|
||||
{
|
||||
bType = TYPE_WALL;
|
||||
Mode = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!stricmp(LineBuf,"ENDWALLS:"))
|
||||
{
|
||||
if (Mode != 1)
|
||||
{
|
||||
printf("Invalid place for command: %s.\n",LineBuf);
|
||||
result = -1;
|
||||
}
|
||||
|
||||
Mode = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!stricmp(LineBuf,"OBJECTS:"))
|
||||
{
|
||||
bType = TYPE_OBJECT;
|
||||
Mode = 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!stricmp(LineBuf,"FILES:"))
|
||||
{
|
||||
fMode = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!stricmp(LineBuf,"ENDFILES:"))
|
||||
{
|
||||
fMode = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strnicmp(LineBuf,"PALFILE:",8))
|
||||
{
|
||||
strcpy(PalName,SkipSpaces(&LineBuf[8]));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strnicmp(LineBuf,"MAPFILE:",8))
|
||||
{
|
||||
strcpy(MapName,SkipSpaces(&LineBuf[8]));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Mode == 2)
|
||||
{
|
||||
if (!strnicmp(LineBuf,"NUMBER:",7))
|
||||
{
|
||||
value = atoi(&LineBuf[7]);
|
||||
|
||||
if (value < 1 || value >= 255)
|
||||
{
|
||||
printf("Invalid object number:\n%s\n",LineBuf);
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
ObjIndex = value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strnicmp(LineBuf,"BITMAPS:",8))
|
||||
{
|
||||
strcpy(LineBuf,SkipSpaces(&LineBuf[8]));
|
||||
value = 0;
|
||||
strcpy(LineBuf,CopyToComma(fBuf,LineBuf));
|
||||
SkipSpaces(fBuf);
|
||||
bNum = atoi(fBuf);
|
||||
|
||||
if (bNum < 1 || bNum > 255)
|
||||
{
|
||||
printf("Invalid bitmap number for object: %d\n",ObjIndex);
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
ObjbmNum[ObjIndex] = bNum;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (fMode)
|
||||
{
|
||||
value = atoi(LineBuf);
|
||||
if (value < 1 || value > 255)
|
||||
{
|
||||
printf("Invalid number for object: %s.\n",LineBuf);
|
||||
result = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
s = strpbrk(LineBuf,", \t");
|
||||
if (s == NULL)
|
||||
{
|
||||
printf("Unable to locate bitmap name for object: %s.\n",LineBuf);
|
||||
result = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
strcpy(fBuf,SkipSpaces(s));
|
||||
AddExtent(fBuf,".img");
|
||||
|
||||
if (LoadBitmap(value,fBuf,bType))
|
||||
{
|
||||
printf("Error loading bitmap \"%s\".\n",fBuf);
|
||||
result = -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
printf("done\n");
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
BIN
map_edit/m1sel.lbm
Normal file
BIN
map_edit/m1sel.lbm
Normal file
Binary file not shown.
564
map_edit/m1util.c
Normal file
564
map_edit/m1util.c
Normal file
|
@ -0,0 +1,564 @@
|
|||
// Map Editor for Animation Construction Kit 3D
|
||||
// Utilities
|
||||
// Author: Lary Myers
|
||||
// Copyright (c) 1994
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <dos.h>
|
||||
#include <mem.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <process.h>
|
||||
#include <bios.h>
|
||||
#include <sys\stat.h>
|
||||
#include "ack3d.h"
|
||||
#include "ackeng.h"
|
||||
#include "m1.h"
|
||||
|
||||
char *smFont;
|
||||
char *mdFont;
|
||||
UCHAR FontUseColor;
|
||||
UCHAR FontTransparent;
|
||||
UCHAR FontColor;
|
||||
UCHAR TextBGcolor;
|
||||
UCHAR ButtonColor;
|
||||
UCHAR ButtonUpperColor;
|
||||
UCHAR ButtonLowerColor;
|
||||
UCHAR BoxColor;
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void SoundBeep(void)
|
||||
{
|
||||
sound(440);
|
||||
delay(50);
|
||||
nosound();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
short LoadSmallFont(void)
|
||||
{
|
||||
short ht,wt;
|
||||
int len;
|
||||
|
||||
ht = 2;
|
||||
smFont = AckReadiff((char *)RES_SMFONT); // "spfont.bbm");
|
||||
if (smFont == NULL)
|
||||
return(-1);
|
||||
|
||||
ht = (*(short *)smFont);
|
||||
wt = (*(short *)&smFont[2]);
|
||||
len = ht * wt;
|
||||
memmove(smFont,&smFont[4],len);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
short LoadMedFont(void)
|
||||
{
|
||||
short ht,wt;
|
||||
int len;
|
||||
|
||||
ht = 2;
|
||||
mdFont = AckReadiff((char *)RES_MDFONT); // "font6x9.bbm");
|
||||
if (mdFont == NULL)
|
||||
return(-1);
|
||||
|
||||
ht = (*(short *)mdFont);
|
||||
wt = (*(short *)&mdFont[2]);
|
||||
len = ht * wt;
|
||||
memmove(mdFont,&mdFont[4],len);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void mdWriteChar(short x,short y,unsigned char ch)
|
||||
{
|
||||
int FontOffset,VidOffset;
|
||||
int row,col;
|
||||
UCHAR *Video;
|
||||
|
||||
VidOffset = (y * 320) + x;
|
||||
Video = VIDSEG;
|
||||
Video += VidOffset;
|
||||
FontOffset = ((ch-32) * 6);
|
||||
|
||||
if (ch >= 'A')
|
||||
FontOffset += 1386;
|
||||
|
||||
for (row = 0; row < 8; row++)
|
||||
{
|
||||
if (FontUseColor)
|
||||
{
|
||||
ch = mdFont[FontOffset];
|
||||
if (ch == ButtonColor) ch = TextBGcolor;
|
||||
Video[0] = ch;
|
||||
ch = mdFont[FontOffset+1];
|
||||
if (ch == ButtonColor) ch = TextBGcolor;
|
||||
Video[1] = ch;
|
||||
ch = mdFont[FontOffset+2];
|
||||
if (ch == ButtonColor) ch = TextBGcolor;
|
||||
Video[2] = ch;
|
||||
ch = mdFont[FontOffset+3];
|
||||
if (ch == ButtonColor) ch = TextBGcolor;
|
||||
Video[3] = ch;
|
||||
ch = mdFont[FontOffset+4];
|
||||
if (ch == ButtonColor) ch = TextBGcolor;
|
||||
Video[4] = ch;
|
||||
ch = mdFont[FontOffset+5];
|
||||
if (ch == ButtonColor) ch = TextBGcolor;
|
||||
Video[5] = ch;
|
||||
}
|
||||
else
|
||||
{
|
||||
Video[0] = mdFont[FontOffset];
|
||||
Video[1] = mdFont[FontOffset+1];
|
||||
Video[2] = mdFont[FontOffset+2];
|
||||
Video[3] = mdFont[FontOffset+3];
|
||||
Video[4] = mdFont[FontOffset+4];
|
||||
Video[5] = mdFont[FontOffset+5];
|
||||
}
|
||||
Video += 320;
|
||||
FontOffset += 198;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
short mdWriteString(short x,short y,char *s)
|
||||
{
|
||||
short OrgX;
|
||||
char ch;
|
||||
|
||||
OrgX = x;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
ch = *s++;
|
||||
|
||||
if (ch == 10)
|
||||
{
|
||||
x = OrgX;
|
||||
y += 10;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch < ' ')
|
||||
continue;
|
||||
|
||||
ch = toupper(ch);
|
||||
mdWriteChar(x,y,ch);
|
||||
x += 6;
|
||||
}
|
||||
|
||||
return(y);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void smWriteChar(short x,short y,unsigned char ch)
|
||||
{
|
||||
int FontOffset,VidOffset;
|
||||
int row,col;
|
||||
UCHAR *Video;
|
||||
|
||||
VidOffset = (y * 320) + x;
|
||||
Video = VIDSEG;
|
||||
Video += VidOffset;
|
||||
FontOffset = ((ch-32) * 5);
|
||||
|
||||
for (row = 0; row < 5; row++)
|
||||
{
|
||||
if (!FontTransparent)
|
||||
{
|
||||
Video[0] = TextBGcolor;
|
||||
Video[1] = TextBGcolor;
|
||||
Video[2] = TextBGcolor;
|
||||
Video[3] = TextBGcolor;
|
||||
}
|
||||
|
||||
if (smFont[FontOffset])
|
||||
Video[0] = FontColor;
|
||||
if (smFont[FontOffset+1])
|
||||
Video[1] = FontColor;
|
||||
if (smFont[FontOffset+2])
|
||||
Video[2] = FontColor;
|
||||
if (smFont[FontOffset+3])
|
||||
Video[3] = FontColor;
|
||||
|
||||
Video += 320;
|
||||
FontOffset += 294;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
short smWriteString(short x,short y,char *s)
|
||||
{
|
||||
short OrgX;
|
||||
char ch;
|
||||
|
||||
OrgX = x;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
ch = *s++;
|
||||
|
||||
if (ch == 10)
|
||||
{
|
||||
x = OrgX;
|
||||
y += 8;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch < ' ')
|
||||
continue;
|
||||
|
||||
ch = toupper(ch);
|
||||
smWriteChar(x,y,ch);
|
||||
x += 5;
|
||||
}
|
||||
|
||||
return(y);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void smWriteHUD(short x,short y,UCHAR color,char *s)
|
||||
{
|
||||
FontTransparent = 1;
|
||||
FontColor = color;
|
||||
smWriteString(x,y,s);
|
||||
FontTransparent = 0;
|
||||
FontColor = 15;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void BlitBlock(int x,int y,int x1,int y1,UCHAR *buf)
|
||||
{
|
||||
int offset,wt;
|
||||
UCHAR *Video;
|
||||
|
||||
offset = (y * 320) + x;
|
||||
Video = VIDSEG + offset;
|
||||
buf += offset;
|
||||
wt = (x1 - x) + 1;
|
||||
|
||||
HideMouse();
|
||||
while (y++ <= y1)
|
||||
{
|
||||
memmove(Video,buf,wt);
|
||||
Video += 320;
|
||||
buf += 320;
|
||||
}
|
||||
ShowMouse();
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void DrawFillBox(int x,int y,int x1,int y1,UCHAR color)
|
||||
{
|
||||
int wt;
|
||||
UCHAR *Video;
|
||||
|
||||
wt = (y * 320) + x;
|
||||
Video = VIDSEG + wt;
|
||||
|
||||
wt = (x1-x)+1;
|
||||
|
||||
while (y++ <= y1)
|
||||
{
|
||||
memset(Video,color,wt);
|
||||
Video += 320;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void DrawHorzLine(int x,int y,int x1,UCHAR color)
|
||||
{
|
||||
UCHAR *Video;
|
||||
int offset;
|
||||
|
||||
offset = (y * 320) + x;
|
||||
Video = VIDSEG + offset;
|
||||
|
||||
memset(Video,color,(x1-x)+1);
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void DrawVertLine(int x,int y,int y1,UCHAR color)
|
||||
{
|
||||
UCHAR *Video;
|
||||
int offset;
|
||||
|
||||
offset = (y * 320) + x;
|
||||
Video = VIDSEG + offset;
|
||||
|
||||
while (y++ <= y1)
|
||||
{
|
||||
*Video = color;
|
||||
Video += 320;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void DrawBox(int x,int y,int x1,int y1,UCHAR color)
|
||||
{
|
||||
|
||||
DrawHorzLine(x,y,x1,color);
|
||||
DrawHorzLine(x,y1,x1,color);
|
||||
DrawVertLine(x,y,y1,color);
|
||||
DrawVertLine(x1,y,y1,color);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
UCHAR GetColor(int x,int y)
|
||||
{
|
||||
int offset;
|
||||
UCHAR *Video;
|
||||
|
||||
offset = (y * 320) + x;
|
||||
Video = VIDSEG + offset;
|
||||
return(*Video);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void SaveVideo(UCHAR *buf)
|
||||
{
|
||||
memmove(buf,VIDSEG,64000);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void RestoreVideo(UCHAR *buf)
|
||||
{
|
||||
memmove(VIDSEG,buf,64000);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void CreateButton(int x,int y,HS *hs,char *s)
|
||||
{
|
||||
int len,plen,x1,y1;
|
||||
|
||||
hs->x = x;
|
||||
hs->y = y;
|
||||
|
||||
len = strlen(s);
|
||||
plen = len * 6;
|
||||
hs->x1 = x1 = x + plen + 5;
|
||||
hs->y1 = y1 = y + 11;
|
||||
|
||||
DrawFillBox(x,y,x1,y1,ButtonColor);
|
||||
DrawHorzLine(x,y,x1,ButtonUpperColor);
|
||||
DrawVertLine(x,y,y1,ButtonUpperColor);
|
||||
DrawVertLine(x1,y+1,y1,ButtonLowerColor);
|
||||
DrawHorzLine(x,y1,x1,ButtonLowerColor);
|
||||
|
||||
x1 = x + 3;
|
||||
y1 = y + 2;
|
||||
while (*s)
|
||||
{
|
||||
mdWriteChar(x1,y1,toupper(*s++));
|
||||
x1 += 6;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
UCHAR *SaveBlock(int x,int y,int x1,int y1)
|
||||
{
|
||||
int ht,wt,size,offset;
|
||||
UCHAR *buf,*bPtr,*vPtr;
|
||||
|
||||
ht = (y1 - y) + 1;
|
||||
wt = (x1 - x) + 1;
|
||||
size = (ht * wt) + 4;
|
||||
buf = (UCHAR *)malloc(size);
|
||||
if (buf == NULL)
|
||||
return(buf);
|
||||
|
||||
bPtr = buf;
|
||||
(*(short *)bPtr) = ht;
|
||||
bPtr += 2;
|
||||
(*(short *)bPtr) = wt;
|
||||
bPtr += 2;
|
||||
|
||||
offset = (y * 320) + x;
|
||||
vPtr = VIDSEG + offset;
|
||||
|
||||
HideMouse();
|
||||
|
||||
while (ht-- > 0)
|
||||
{
|
||||
memmove(bPtr,vPtr,wt);
|
||||
vPtr += 320;
|
||||
bPtr += wt;
|
||||
}
|
||||
|
||||
ShowMouse();
|
||||
|
||||
return(buf);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
void RestoreBlock(int x,int y,UCHAR *buf)
|
||||
{
|
||||
int ht,wt,offset;
|
||||
UCHAR *vPtr;
|
||||
|
||||
if (buf == NULL)
|
||||
return;
|
||||
|
||||
offset = (y * 320) + x;
|
||||
vPtr = VIDSEG + offset;
|
||||
|
||||
ht = (*(short *)buf);
|
||||
buf += 2;
|
||||
wt = (*(short *)buf);
|
||||
buf += 2;
|
||||
HideMouse();
|
||||
while (ht-- > 0)
|
||||
{
|
||||
memmove(vPtr,buf,wt);
|
||||
vPtr += 320;
|
||||
buf += wt;
|
||||
}
|
||||
ShowMouse();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
int QueryBox(int x,int y,char *Msg)
|
||||
{
|
||||
int done,plen;
|
||||
int x1,y1;
|
||||
UCHAR SaveColor,SaveBGcolor;
|
||||
short mx,my,mbutton;
|
||||
char *s;
|
||||
UCHAR *vBuf;
|
||||
HS hs[2];
|
||||
|
||||
|
||||
SaveColor = BoxColor;
|
||||
SaveBGcolor = TextBGcolor;
|
||||
BoxColor = TextBGcolor = ButtonColor;
|
||||
y1 = y + 42;
|
||||
s = Msg;
|
||||
plen = 0;
|
||||
x1 = 0;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
if (*s++ == 10)
|
||||
{
|
||||
y1 += 10;
|
||||
x1 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 += 6;
|
||||
if (x1 > plen) plen = x1;
|
||||
}
|
||||
}
|
||||
|
||||
x1 = x + plen + 10;
|
||||
|
||||
if ((x1-x) < 100)
|
||||
x1 = x + 100;
|
||||
|
||||
HideMouse();
|
||||
vBuf = SaveBlock(x,y,x1,y1);
|
||||
DrawBackBox(x,y,x1,y1);
|
||||
FontUseColor = 1;
|
||||
mdWriteString(x+5,y+6,Msg);
|
||||
BoxColor = SaveColor;
|
||||
TextBGcolor = SaveBGcolor;
|
||||
FontUseColor = 0;
|
||||
CreateButton(x+5,y1-15,&hs[0]," Ok ");
|
||||
CreateButton(x1-46,y1-15,&hs[1],"CANCEL");
|
||||
ShowMouse();
|
||||
|
||||
done = 0;
|
||||
while (!done)
|
||||
{
|
||||
mbutton = ReadMouseCursor(&my,&mx);
|
||||
|
||||
if (mbutton & 1)
|
||||
{
|
||||
for (x1 = 0; x1 < 2; x1++)
|
||||
{
|
||||
if (mx >= hs[x1].x && mx <= hs[x1].x1 && my >= hs[x1].y && my <= hs[x1].y1)
|
||||
{
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (vBuf != NULL)
|
||||
{
|
||||
RestoreBlock(x,y,vBuf);
|
||||
free(vBuf);
|
||||
}
|
||||
return(x1);
|
||||
}
|
||||
|
||||
|
||||
|
52
map_edit/mapedit.h
Normal file
52
map_edit/mapedit.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* Header file for ACK-3D Map Editor */
|
||||
|
||||
#define CURRENT_SQUAREX 161
|
||||
#define CURRENT_SQUAREY 4
|
||||
|
||||
#define PASS_X 243
|
||||
#define PASS_Y 2
|
||||
|
||||
#define SCREEN_COLOR 20
|
||||
|
||||
#define BLACK 0
|
||||
#define LIGHTBLUE 64
|
||||
#define BLUE 69
|
||||
#define LIGHTMAGENTA 112
|
||||
#define MAGENTA 119
|
||||
#define RED 40
|
||||
#define LIGHTRED 32
|
||||
#define GREEN 88
|
||||
#define LIGHTGREEN 80
|
||||
#define YELLOW 120
|
||||
|
||||
typedef struct {
|
||||
short x;
|
||||
short y;
|
||||
short x1;
|
||||
short y1;
|
||||
} RECT;
|
||||
|
||||
typedef struct {
|
||||
short BoxX;
|
||||
short BoxY;
|
||||
char *FileName;
|
||||
char DoBeep;
|
||||
short NumButtons;
|
||||
RECT ButtonCoords[4];
|
||||
} BOXES;
|
||||
|
||||
#define BOX_ALREADY_1_OBJECT 0
|
||||
#define BOX_NEW_WARNING 1
|
||||
#define BOX_MODIFIED_WARNING 2
|
||||
#define BOX_SAVED 3
|
||||
#define BOX_ALREADY_START_CODE 4
|
||||
#define BOX_MAX_SPECIAL_CODE 5
|
||||
|
||||
/* Prototypes */
|
||||
void SetVmode(short);
|
||||
void SetPalette(unsigned char *);
|
||||
char *AddExtent(char *,char *);
|
||||
unsigned short inkey(void);
|
||||
void SetVGAmode(void);
|
||||
void SetTextMode(void);
|
||||
|
123
map_edit/measm.asm
Normal file
123
map_edit/measm.asm
Normal file
|
@ -0,0 +1,123 @@
|
|||
|
||||
IDEAL
|
||||
JUMPS
|
||||
include "prologue.mac"
|
||||
P386 ; 386 specific opcodes and shit allowed.
|
||||
P387 ; Allow 386 processor
|
||||
|
||||
|
||||
MASM
|
||||
.MODEL FLAT ;32-bit OS/2 model
|
||||
.CODE
|
||||
IDEAL
|
||||
|
||||
PUBLIC SetPalette2_
|
||||
PUBLIC SetVGAmode_
|
||||
PUBLIC SetTextMode_
|
||||
PUBLIC inkey_
|
||||
PUBLIC PutHex_
|
||||
|
||||
;==============================================================================
|
||||
; void SetPalette2(unsigned char *PalBuf,short count);
|
||||
;==============================================================================
|
||||
|
||||
Proc SetPalette2_ near
|
||||
push esi
|
||||
|
||||
mov esi,eax
|
||||
mov cx,dx
|
||||
mov bx,0
|
||||
cld
|
||||
mov dx,3C8H
|
||||
sp210:
|
||||
mov al,bl
|
||||
out dx,al
|
||||
inc dx
|
||||
lodsb
|
||||
out dx,al
|
||||
lodsb
|
||||
out dx,al
|
||||
lodsb
|
||||
out dx,al
|
||||
dec dx
|
||||
inc bx
|
||||
loop sp210
|
||||
|
||||
pop esi
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;==============================================================================
|
||||
; void SetVGAmode(void);
|
||||
;==============================================================================
|
||||
Proc SetVGAmode_ near
|
||||
push ebp
|
||||
mov ax,13h
|
||||
int 10h ; Set 320x200x256
|
||||
pop ebp
|
||||
ret
|
||||
endp
|
||||
|
||||
;==============================================================================
|
||||
;
|
||||
;==============================================================================
|
||||
Proc SetTextMode_ near
|
||||
push ebp
|
||||
mov ax,3
|
||||
int 10h
|
||||
pop ebp
|
||||
ret
|
||||
endp
|
||||
|
||||
;==============================================================================
|
||||
;
|
||||
;==============================================================================
|
||||
Proc inkey_ near
|
||||
xor eax,eax
|
||||
mov ah,1 ;see if key available
|
||||
int 16h
|
||||
jz ink080 ;nope
|
||||
xor ax,ax
|
||||
int 16h
|
||||
jmp short ink090
|
||||
|
||||
ink080:
|
||||
xor ax,ax
|
||||
ink090:
|
||||
ret
|
||||
endp
|
||||
|
||||
;==============================================================================
|
||||
;
|
||||
;==============================================================================
|
||||
Proc HexOut_ near
|
||||
and al,15
|
||||
cmp al,10
|
||||
jb short hex010
|
||||
add al,7
|
||||
|
||||
hex010:
|
||||
add al,'0'
|
||||
stosb
|
||||
ret
|
||||
endp
|
||||
|
||||
;==============================================================================
|
||||
; void PutHex(char *buf,UINT mCode);
|
||||
;==============================================================================
|
||||
Proc PutHex_ near
|
||||
push edi
|
||||
mov edi,eax
|
||||
mov eax,edx
|
||||
shr al,4
|
||||
call HexOut_
|
||||
mov eax,edx
|
||||
call HexOut_
|
||||
xor al,al
|
||||
stosb
|
||||
pop edi
|
||||
ret
|
||||
endp
|
||||
end
|
||||
|
1981
map_edit/medit.c
Normal file
1981
map_edit/medit.c
Normal file
File diff suppressed because it is too large
Load diff
BIN
map_edit/medit.dtf
Normal file
BIN
map_edit/medit.dtf
Normal file
Binary file not shown.
296
map_edit/mgif.c
Normal file
296
map_edit/mgif.c
Normal file
|
@ -0,0 +1,296 @@
|
|||
/*****************************************************************************
|
||||
MGIF.C
|
||||
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
Routine to load a 256 color .GIF file into a memory buffer. *Only* 256
|
||||
color images are supported here! Sorry, no routines to SAVE .GIFs...
|
||||
Memory required is allocated on the fly.
|
||||
|
||||
Mark Morley
|
||||
morley@camosun.bc.ca
|
||||
|
||||
Modified for use in the ACK environment by Lary Myers
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <process.h>
|
||||
#include <bios.h>
|
||||
#include <fcntl.h>
|
||||
#include <malloc.h>
|
||||
#include "ack3d.h"
|
||||
#include "ackeng.h"
|
||||
|
||||
#define MAX_CODES 4096
|
||||
|
||||
extern unsigned char colordat[]; // Palette buffer in AckReadiff module
|
||||
extern short rsHandle;
|
||||
extern short ErrorCode;
|
||||
|
||||
static FILE* fp;
|
||||
static short curr_size;
|
||||
static short clear;
|
||||
static short ending;
|
||||
static short newcodes;
|
||||
static short top_slot;
|
||||
static short slot;
|
||||
static short navail_bytes = 0;
|
||||
static short nbits_left = 0;
|
||||
static unsigned char b1;
|
||||
static unsigned char byte_buff[257];
|
||||
static unsigned char* pbytes;
|
||||
static unsigned char* stack;
|
||||
static unsigned char* suffix;
|
||||
static unsigned short* prefix;
|
||||
|
||||
static unsigned long rbaTable[10];
|
||||
|
||||
static unsigned long code_mask[13] =
|
||||
{
|
||||
0L,
|
||||
0x0001L, 0x0003L,
|
||||
0x0007L, 0x000FL,
|
||||
0x001FL, 0x003FL,
|
||||
0x007FL, 0x00FFL,
|
||||
0x01FFL, 0x03FFL,
|
||||
0x07FFL, 0x0FFFL
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
static short get_next_code(void)
|
||||
{
|
||||
short i;
|
||||
static unsigned long ret;
|
||||
|
||||
if (!nbits_left)
|
||||
{
|
||||
if (navail_bytes <= 0)
|
||||
{
|
||||
pbytes = byte_buff;
|
||||
navail_bytes = getc(fp);
|
||||
|
||||
if (navail_bytes)
|
||||
{
|
||||
for (i = 0; i < navail_bytes; ++i )
|
||||
*(byte_buff + i) = getc( fp );
|
||||
}
|
||||
}
|
||||
b1 = *pbytes++;
|
||||
nbits_left = 8;
|
||||
--navail_bytes;
|
||||
}
|
||||
|
||||
ret = b1 >> (8 - nbits_left);
|
||||
while (curr_size > nbits_left)
|
||||
{
|
||||
if (navail_bytes <= 0)
|
||||
{
|
||||
pbytes = byte_buff;
|
||||
navail_bytes = getc(fp);
|
||||
if (navail_bytes)
|
||||
{
|
||||
for( i = 0; i < navail_bytes; ++i )
|
||||
*(byte_buff + i) = getc( fp );
|
||||
}
|
||||
}
|
||||
b1 = *pbytes++;
|
||||
ret |= b1 << nbits_left;
|
||||
nbits_left += 8;
|
||||
--navail_bytes;
|
||||
}
|
||||
|
||||
nbits_left -= curr_size;
|
||||
|
||||
return((short)(ret & *(code_mask + curr_size)));
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
unsigned char *AckReadgif(char *picname)
|
||||
{
|
||||
unsigned char *sp;
|
||||
unsigned char *buffer,*OrgBuffer;
|
||||
short code, fc, oc;
|
||||
short i;
|
||||
unsigned char size;
|
||||
short c;
|
||||
unsigned short wt,ht;
|
||||
int bSize;
|
||||
unsigned char buf[1028];
|
||||
unsigned char red;
|
||||
unsigned char grn;
|
||||
unsigned char blu;
|
||||
|
||||
|
||||
if (!rsHandle)
|
||||
{
|
||||
fp = fopen(picname,"rb");
|
||||
if( !fp )
|
||||
{
|
||||
ErrorCode = ERR_BADFILE;
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = fdopen(rsHandle,"rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
ErrorCode = ERR_BADPICNAME;
|
||||
return(0L);
|
||||
}
|
||||
|
||||
fseek(fp,rbaTable[(ULONG)picname],SEEK_SET);
|
||||
}
|
||||
|
||||
fread(buf,1,6,fp);
|
||||
if( strncmp( buf, "GIF", 3 ) )
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
|
||||
ErrorCode = ERR_INVALIDFORM;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
fread(buf,1,7,fp);
|
||||
for (i = 0; i < 768;)
|
||||
{
|
||||
red = getc(fp);
|
||||
grn = getc(fp);
|
||||
blu = getc(fp);
|
||||
colordat[i++] = red >> 2;
|
||||
colordat[i++] = grn >> 2;
|
||||
colordat[i++] = blu >> 2;
|
||||
}
|
||||
|
||||
fread(buf,1,5,fp);
|
||||
fread(buf,1,2,fp);
|
||||
wt = (*(short *)buf);
|
||||
fread(buf,1,2,fp);
|
||||
ht = (*(short *)buf);
|
||||
//wt = getw(fp);
|
||||
//ht = getw(fp);
|
||||
bSize = (ht * wt) + (sizeof(short) * 2);
|
||||
buffer = (UCHAR *)malloc(bSize);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
|
||||
ErrorCode = ERR_NOMEMORY;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
OrgBuffer = buffer;
|
||||
|
||||
(*(short *)buffer) = wt;
|
||||
buffer += sizeof(short);
|
||||
(*(short *)buffer) = ht;
|
||||
buffer += sizeof(short);
|
||||
|
||||
fread(buf,1,1,fp);
|
||||
size = getc(fp);
|
||||
|
||||
if (size < 2 || 9 < size)
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
free(OrgBuffer);
|
||||
ErrorCode = ERR_INVALIDFORM;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
stack = (unsigned char *) malloc(MAX_CODES + 1);
|
||||
suffix = (unsigned char *) malloc(MAX_CODES + 1);
|
||||
prefix = (unsigned short *) malloc(sizeof(short) * (MAX_CODES + 1));
|
||||
|
||||
if (stack == NULL || suffix == NULL || prefix == NULL)
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
free(OrgBuffer);
|
||||
ErrorCode = ERR_NOMEMORY;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
curr_size = size + 1;
|
||||
top_slot = 1 << curr_size;
|
||||
clear = 1 << size;
|
||||
ending = clear + 1;
|
||||
slot = newcodes = ending + 1;
|
||||
navail_bytes = nbits_left = 0;
|
||||
oc = fc = 0;
|
||||
sp = stack;
|
||||
|
||||
while ( (c = get_next_code()) != ending )
|
||||
{
|
||||
if (c == clear)
|
||||
{
|
||||
curr_size = size + 1;
|
||||
slot = newcodes;
|
||||
top_slot = 1 << curr_size;
|
||||
while ( (c = get_next_code()) == clear );
|
||||
|
||||
if( c == ending )
|
||||
break;
|
||||
|
||||
if( c >= slot )
|
||||
c = 0;
|
||||
|
||||
oc = fc = c;
|
||||
*buffer++ = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = c;
|
||||
if (code >= slot)
|
||||
{
|
||||
code = oc;
|
||||
*sp++ = fc;
|
||||
}
|
||||
|
||||
while (code >= newcodes)
|
||||
{
|
||||
*sp++ = *(suffix + code);
|
||||
code = *(prefix + code);
|
||||
}
|
||||
|
||||
*sp++ = code;
|
||||
if (slot < top_slot)
|
||||
{
|
||||
*(suffix + slot) = fc = code;
|
||||
*(prefix + slot++) = oc;
|
||||
oc = c;
|
||||
}
|
||||
|
||||
if (slot >= top_slot && curr_size < 12)
|
||||
{
|
||||
top_slot <<= 1;
|
||||
++curr_size;
|
||||
}
|
||||
|
||||
while (sp > stack)
|
||||
{
|
||||
--sp;
|
||||
*buffer++ = *sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(stack);
|
||||
free(suffix);
|
||||
free(prefix);
|
||||
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
|
||||
return(OrgBuffer);
|
||||
}
|
250
map_edit/miff.c
Normal file
250
map_edit/miff.c
Normal file
|
@ -0,0 +1,250 @@
|
|||
/******************* ( Animation Construction Kit 3D ) ***********************/
|
||||
/* Deluxe Paint file reader */
|
||||
/* CopyRight (c) 1993 Authors: Jaimi McEntire, Lary Myers */
|
||||
/*****************************************************************************/
|
||||
//
|
||||
// This function will return a pointer to a buffer that holds the raw image.
|
||||
// just free the pointer to delete this buffer. After returning, the array
|
||||
// colordat will hold the adjusted palette of this pic.
|
||||
//
|
||||
// Also, this has been modified to only read in form PBM brushes. form ILBM's
|
||||
// (the "old" type) are not supported. use the "new" deluxe paint .lbm type
|
||||
// and do not choose "old".
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <process.h>
|
||||
#include <bios.h>
|
||||
#include <fcntl.h>
|
||||
#include <malloc.h>
|
||||
#include <mem.h>
|
||||
#include "ack3d.h"
|
||||
#include "ackeng.h"
|
||||
#include "iff.h"
|
||||
|
||||
extern int ErrorCode;
|
||||
|
||||
unsigned char colordat[768]; /* maximum it can be...256 colors */
|
||||
|
||||
unsigned char cplanes[8][80]; /* setting max at 640 pixels width */
|
||||
/* thats 8 pixels per byte per plane */
|
||||
unsigned char *pplanes= (char far *) &cplanes[0][0]; /* for a form pbm */
|
||||
|
||||
#define MAX_BUF_POS 4096
|
||||
|
||||
int rdbufpos;
|
||||
int rdSize;
|
||||
UCHAR rdBuffer[MAX_BUF_POS+2];
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
short ReadNxtBlock(short handle)
|
||||
{
|
||||
short retlen;
|
||||
|
||||
retlen = read(handle,rdBuffer,MAX_BUF_POS);
|
||||
rdbufpos = 0;
|
||||
|
||||
return(retlen);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
int aRead(short handle,void *dest,int size)
|
||||
{
|
||||
int count = 0;
|
||||
UCHAR *d = (UCHAR *)dest;
|
||||
|
||||
while (size--)
|
||||
{
|
||||
if (rdbufpos >= MAX_BUF_POS)
|
||||
{
|
||||
if (rdSize != MAX_BUF_POS)
|
||||
{
|
||||
return(count);
|
||||
}
|
||||
|
||||
rdSize = read(handle,rdBuffer,MAX_BUF_POS);
|
||||
rdbufpos = 0;
|
||||
}
|
||||
|
||||
d[count++] = rdBuffer[rdbufpos++];
|
||||
}
|
||||
|
||||
return(count);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
unsigned char *Readiff(char *picname)
|
||||
{
|
||||
FILE *pic;
|
||||
short handle;
|
||||
form_chunk fchunk;
|
||||
ChunkHeader chunk;
|
||||
BitMapHeader bmhd;
|
||||
long length;
|
||||
char value; // must remain signed, no matter what. ignore any warnings.
|
||||
short sofar;
|
||||
short width,height,planes;
|
||||
short pixw;
|
||||
unsigned char *destx, *savedestx;
|
||||
|
||||
rdbufpos = MAX_BUF_POS + 1;
|
||||
rdSize = MAX_BUF_POS;
|
||||
|
||||
if ((pic = fopen(picname,"rb")) == NULL)
|
||||
{
|
||||
ErrorCode = ERR_BADPICNAME;
|
||||
return(0L);
|
||||
}
|
||||
fread(&fchunk,1,sizeof(form_chunk),pic); /* read in the first 12 bytes*/
|
||||
// aRead(pic,&fchunk,sizeof(form_chunk));
|
||||
|
||||
if (fchunk.type != FORM)
|
||||
{
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_INVALIDFORM;
|
||||
return(0L);
|
||||
}
|
||||
|
||||
if (fchunk.subtype != ID_PBM)
|
||||
{
|
||||
printf("Error: Not form PBM!");
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_NOPBM;
|
||||
return(0L);
|
||||
}
|
||||
// now lets loop...Because the Chunks can be in any order!
|
||||
while(1)
|
||||
{
|
||||
fread(&chunk,1,sizeof(ChunkHeader),pic);
|
||||
// aRead(pic,&chunk,sizeof(ChunkHeader));
|
||||
chunk.ckSize = ByteFlipLong(chunk.ckSize);
|
||||
if (chunk.ckSize & 1) chunk.ckSize ++; // must be word aligned
|
||||
if(chunk.ckID == ID_BMHD)
|
||||
{
|
||||
fread(&bmhd,1,sizeof(BitMapHeader),pic);
|
||||
// aRead(pic,&bmhd,sizeof(BitMapHeader));
|
||||
bmhd.w=iffswab(bmhd.w); // the only things we need.
|
||||
bmhd.h=iffswab(bmhd.h);
|
||||
destx = (unsigned char *)malloc((bmhd.w * bmhd.h)+4);
|
||||
if ( !destx )
|
||||
{
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_NOMEMORY;
|
||||
return(0L);
|
||||
}
|
||||
|
||||
savedestx = destx;
|
||||
|
||||
destx[0] = bmhd.w%256;
|
||||
destx[1] = bmhd.w/256;
|
||||
destx[2] = bmhd.h%256;
|
||||
destx[3] = bmhd.h/256;
|
||||
destx += 4;
|
||||
continue;
|
||||
}
|
||||
if(chunk.ckID == ID_CMAP)
|
||||
{
|
||||
short i;
|
||||
unsigned char r,g;
|
||||
|
||||
fread(colordat,1,chunk.ckSize,pic);
|
||||
// aRead(pic,colordat,chunk.ckSize);
|
||||
for (i=0;i<768;i++)
|
||||
{
|
||||
r = colordat[i]; // r,g do not stand for red and green
|
||||
g = r >> 2;
|
||||
colordat[i] = g;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(chunk.ckID == ID_BODY)
|
||||
{
|
||||
for(height = 0; height<bmhd.h; height ++)
|
||||
{
|
||||
unsigned char *dest;
|
||||
dest = (unsigned char *)&(pplanes[0]); /* point at first char */
|
||||
sofar = bmhd.w; /* number of bytes = 8 */
|
||||
if (sofar&1) sofar++;
|
||||
while (sofar)
|
||||
{
|
||||
if (bmhd.compression)
|
||||
{
|
||||
// aRead(pic,&value,1);
|
||||
value=fgetc(pic); /* get the next byte */
|
||||
// if (value == 128) continue; /* NOP..just get another*/
|
||||
if (value > 0)
|
||||
{
|
||||
short len;
|
||||
len = value +1;
|
||||
sofar -= len;
|
||||
if(!(fread(dest,len,1,pic)))
|
||||
// if(!(aRead(pic,dest,len)))
|
||||
{
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_BADPICFILE;
|
||||
free(savedestx);
|
||||
return(0L);
|
||||
}
|
||||
dest +=len;
|
||||
}
|
||||
else
|
||||
{
|
||||
short count;
|
||||
count = -value; /* get amount to dup */
|
||||
count ++;
|
||||
sofar -= count;
|
||||
value=fgetc(pic);
|
||||
// aRead(pic,&value,1);
|
||||
while (--count >= 0) *dest++ = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fread(dest,sofar,1,pic); /* just throw on plane */
|
||||
// aRead(pic,dest,sofar); /* just throw on plane */
|
||||
sofar = 0;
|
||||
}
|
||||
}
|
||||
if (sofar < 0)
|
||||
{
|
||||
fclose(pic);
|
||||
}
|
||||
_fmemcpy(destx,pplanes,bmhd.w);
|
||||
destx += bmhd.w;
|
||||
}
|
||||
break; /* leave if we've unpacked the BODY*/
|
||||
}
|
||||
|
||||
fseek(pic,chunk.ckSize,SEEK_CUR);
|
||||
}
|
||||
|
||||
fclose(pic);
|
||||
return((char *)savedestx);
|
||||
}
|
||||
|
||||
long ByteFlipLong(long NUMBER)
|
||||
{
|
||||
// Hey, I didn;t write this function!!!
|
||||
long Y, T;
|
||||
short I;
|
||||
|
||||
T = NUMBER;
|
||||
Y=0;for (I=0;I<4;I++){Y = Y | (T & 0xFF);if (I<3) {Y = Y << 8;T = T >> 8;}}
|
||||
return(Y);
|
||||
}
|
||||
|
||||
short iffswab(unsigned short number)
|
||||
{
|
||||
unsigned short xx1,xx2;
|
||||
unsigned short result;
|
||||
|
||||
xx1 = number <<8; xx2 = number >>8; result = xx1|xx2;
|
||||
return(result);
|
||||
}
|
1
map_edit/mkdtf.bat
Normal file
1
map_edit/mkdtf.bat
Normal file
|
@ -0,0 +1 @@
|
|||
bpic m1files.dat medit.dtf
|
160
map_edit/mouse.c
Normal file
160
map_edit/mouse.c
Normal file
|
@ -0,0 +1,160 @@
|
|||
// 3D Construction Kit
|
||||
// Started: 01/02/94
|
||||
// Author: Lary Myers
|
||||
// Module: MOUSE.C
|
||||
// (c) CopyRight 1994 All Rights Reserved
|
||||
|
||||
#include <dos.h>
|
||||
#include <stdio.h>
|
||||
#include <dos.h>
|
||||
|
||||
int MouseModifier = 2;
|
||||
|
||||
//=============================================================================
|
||||
// Check if mouse is installed, returns -1 if it IS installed
|
||||
//=============================================================================
|
||||
int MouseInstalled(void)
|
||||
{
|
||||
int yesno;
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
intr(0x33,®s);
|
||||
yesno = regs.w.ax;
|
||||
|
||||
return(yesno);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Show the mouse cursor
|
||||
//=============================================================================
|
||||
void ShowMouse(void)
|
||||
{
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 1;
|
||||
intr(0x33,®s);
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Hide the mouse cursor
|
||||
//=============================================================================
|
||||
void HideMouse(void)
|
||||
{
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 2;
|
||||
intr(0x33,®s);
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Returns button status, mouse row and column
|
||||
//=============================================================================
|
||||
int ReadMouseCursor(int *mrow,int *mcol)
|
||||
{
|
||||
int bstatus;
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 3;
|
||||
intr(0x33,®s);
|
||||
bstatus = regs.w.bx;
|
||||
*mrow = regs.w.dx;
|
||||
*mcol = regs.w.cx / MouseModifier;
|
||||
|
||||
return(bstatus);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Returns just the mouse button status
|
||||
//=============================================================================
|
||||
int ReadMouseButtons(void)
|
||||
{
|
||||
int bstatus;
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 3;
|
||||
intr(0x33,®s);
|
||||
bstatus = regs.w.bx;
|
||||
|
||||
return(bstatus);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Set mouse cursor to desired row and column
|
||||
//=============================================================================
|
||||
void SetMouseCursor(int mrow,int mcol)
|
||||
{
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 4;
|
||||
regs.w.dx = mrow;
|
||||
regs.w.cx = mcol * MouseModifier;
|
||||
intr(0x33,®s);
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Defines left and right columns for mouse travel
|
||||
//=============================================================================
|
||||
void SetMouseMinMaxColumns(int mincol,int maxcol)
|
||||
{
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 7;
|
||||
regs.w.cx = mincol * MouseModifier;
|
||||
regs.w.dx = maxcol * MouseModifier;
|
||||
intr(0x33,®s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Defines top and bottom rows for mouse travel
|
||||
//=============================================================================
|
||||
void SetMouseMinMaxRows(int minrow,int maxrow)
|
||||
{
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 8;
|
||||
regs.w.cx = minrow;
|
||||
regs.w.dx = maxrow;
|
||||
intr(0x33,®s);
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Set shape of mouse cursor. 8 byte mask, hotspot row,col
|
||||
//=============================================================================
|
||||
void SetMouseShape(int hsrow,int hscol,char far *mask)
|
||||
{
|
||||
union REGPACK regs;
|
||||
|
||||
memset(®s,0,sizeof(union REGPACK));
|
||||
regs.w.ax = 9;
|
||||
regs.w.dx = FP_OFF(mask);
|
||||
regs.w.es = FP_SEG(mask);
|
||||
regs.w.bx = hscol;
|
||||
regs.w.cx = hsrow;
|
||||
intr(0x33,®s);
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Wait for the mouse button to be released
|
||||
//=============================================================================
|
||||
void MouseReleased(void)
|
||||
{
|
||||
|
||||
while (ReadMouseButtons());
|
||||
|
||||
}
|
||||
|
44
map_edit/prologue.mac
Normal file
44
map_edit/prologue.mac
Normal file
|
@ -0,0 +1,44 @@
|
|||
P386
|
||||
|
||||
|
||||
Macro SETUPSEGMENT
|
||||
|
||||
SEGMENT _TEXT PARA PUBLIC 'CODE'
|
||||
ASSUME CS:_TEXT
|
||||
|
||||
Endm
|
||||
|
||||
macro PENTER STORAGE
|
||||
;; 17 - Enter a procedue with storage space
|
||||
;; Procedure enter, uses the 286/386 ENTER opcode
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
IF STORAGE
|
||||
sub esp,STORAGE
|
||||
ENDIF
|
||||
ENDIF
|
||||
endm
|
||||
|
||||
macro PLEAVE
|
||||
;; 18 - Exit a procedure with stack correction.
|
||||
mov esp,ebp
|
||||
pop ebp
|
||||
endm
|
||||
|
||||
macro PushCREGS
|
||||
;; 19 - Save registers for C
|
||||
push es
|
||||
push ds ;The Kernel is responsible for maintaining DS
|
||||
push esi
|
||||
push edi
|
||||
cld
|
||||
endm
|
||||
|
||||
macro PopCREGS
|
||||
;; 20 - Restore registers for C
|
||||
pop edi
|
||||
pop esi
|
||||
pop ds ;The Kernel is responsible for maintaining DS
|
||||
pop es
|
||||
endm
|
||||
|
BIN
map_edit/slime1a.bbm
Normal file
BIN
map_edit/slime1a.bbm
Normal file
Binary file not shown.
BIN
map_edit/spfont.bbm
Normal file
BIN
map_edit/spfont.bbm
Normal file
Binary file not shown.
Loading…
Reference in a new issue