fix ushort/uint confusion. return success/fail from main()

the map_edit source on the book's cd included a prebuilt version of
the old watcom version of ack3d (with headers) which defined UINT to be
'unsigned short' while our version of ack3d defines UINT to be
'unsigned int'
This commit is contained in:
Gered 2019-11-03 10:51:11 -05:00
parent be71fad292
commit 800298c59f

View file

@ -116,26 +116,26 @@ void ShowMaskedBitmap(int x,int y,UCHAR *bm);
UCHAR *Bitmaps[256]; UCHAR *Bitmaps[256];
UCHAR *ObjBitmaps[256]; UCHAR *ObjBitmaps[256];
UCHAR ObjbmNum[256]; UCHAR ObjbmNum[256];
UINT MedxGrid[GRID_ARRAY]; USHORT MedxGrid[GRID_ARRAY];
UINT MedyGrid[GRID_ARRAY]; USHORT MedyGrid[GRID_ARRAY];
UINT MedGrid[GRID_MAX]; USHORT MedGrid[GRID_MAX];
UINT MobGrid[GRID_MAX]; USHORT MobGrid[GRID_MAX];
UINT MedFloorMap[GRID_MAX]; USHORT MedFloorMap[GRID_MAX];
UINT MedCeilMap[GRID_MAX]; USHORT MedCeilMap[GRID_MAX];
UCHAR *MedMultiPtrs[GRID_MAX]; UCHAR *MedMultiPtrs[GRID_MAX];
int GridRow,GridCol; int GridRow,GridCol;
int ViewMode; int ViewMode;
int ViewType,LastViewType; int ViewType,LastViewType;
int EditType; int EditType;
UINT WallFlags; USHORT WallFlags;
UINT ObjFlags; USHORT ObjFlags;
int MaxCol,MaxRow; int MaxCol,MaxRow;
int LastgRow,LastgCol; int LastgRow,LastgCol;
int ModifyFlag; int ModifyFlag;
short LastMX,LastMY; short LastMX,LastMY;
UINT CurrentCode; USHORT CurrentCode;
UINT LastWallCode; USHORT LastWallCode;
UINT LastObjCode; USHORT LastObjCode;
UCHAR BaseColor; UCHAR BaseColor;
UCHAR *VidBuf; UCHAR *VidBuf;
UCHAR *BgBuf; UCHAR *BgBuf;
@ -582,7 +582,7 @@ void DrawMultiBitmaps(int gPos,int x,int y)
{ {
int cnt; int cnt;
UCHAR *bmPtr,*mPtr; UCHAR *bmPtr,*mPtr;
UINT bNum; USHORT bNum;
mPtr = MedMultiPtrs[gPos]; mPtr = MedMultiPtrs[gPos];
if (mPtr == NULL) if (mPtr == NULL)
@ -617,7 +617,7 @@ void DrawGrid3D(void)
int gPos,gOrg,row,col; int gPos,gOrg,row,col;
UCHAR *bmPtr; UCHAR *bmPtr;
UCHAR sValue,color,sValue1; UCHAR sValue,color,sValue1;
UINT bNum; USHORT bNum;
xOrg = MAP_X + 128; xOrg = MAP_X + 128;
yOrg = MAP_Y + GD_FHT; yOrg = MAP_Y + GD_FHT;
@ -828,7 +828,7 @@ void DrawGrid2D(void)
{ {
int x,y,gRow,gCol; int x,y,gRow,gCol;
int row,col,gOrg,gPos; int row,col,gOrg,gPos;
UINT mCode; USHORT mCode;
UCHAR sValue,color,sValue1; UCHAR sValue,color,sValue1;
gOrg = (GridRow * GRID_WIDTH) + GridCol; gOrg = (GridRow * GRID_WIDTH) + GridCol;
@ -959,8 +959,8 @@ for (col = 0; col < 12; col++)
void DrawFloorCeil(void) void DrawFloorCeil(void)
{ {
int row,col,x,y,pos,pOrg; int row,col,x,y,pos,pOrg;
UINT bCode; USHORT bCode;
UINT *buf; USHORT *buf;
if (ViewType == VT_FLOOR) if (ViewType == VT_FLOOR)
buf = MedFloorMap; buf = MedFloorMap;
@ -1000,8 +1000,8 @@ ShowMouse();
void DrawObjects(void) void DrawObjects(void)
{ {
int row,col,x,y,pos,pOrg; int row,col,x,y,pos,pOrg;
UINT bCode; USHORT bCode;
UINT *buf; USHORT *buf;
UCHAR bcLow; UCHAR bcLow;
buf = MobGrid; buf = MobGrid;
@ -1364,7 +1364,7 @@ return(pos);
//============================================================================= //=============================================================================
// //
//============================================================================= //=============================================================================
short ObjectInMap(UINT oCode) short ObjectInMap(USHORT oCode)
{ {
int i; int i;
@ -1386,7 +1386,7 @@ return(0);
void PutCode(short mx,short my) void PutCode(short mx,short my)
{ {
int x,y,pos; int x,y,pos;
UINT wFlags,cCode; USHORT wFlags,cCode;
if ((pos = GetGridPos(mx,my)) == -1) if ((pos = GetGridPos(mx,my)) == -1)
{ {
@ -1494,7 +1494,7 @@ switch (ViewType)
void GetCode(short mx,short my) void GetCode(short mx,short my)
{ {
int x,y,pos; int x,y,pos;
UINT wFlags,cCode; USHORT wFlags,cCode;
if ((pos = GetGridPos(mx,my)) == -1) if ((pos = GetGridPos(mx,my)) == -1)
{ {
@ -1865,10 +1865,10 @@ switch (ViewType)
//============================================================================= //=============================================================================
// //
//============================================================================= //=============================================================================
void DrawBorder(UINT bCode) void DrawBorder(USHORT bCode)
{ {
short row,col; short row,col;
UINT offset; USHORT offset;
if (ViewType != VT_MAP) if (ViewType != VT_MAP)
{ {
@ -1964,7 +1964,7 @@ void EditMulti(int mode,short gx,short gy)
{ {
int i,x,y,x1,y1,pos,done,num; int i,x,y,x1,y1,pos,done,num;
short mx,my,mbuttons; short mx,my,mbuttons;
UINT OldCurrent; USHORT OldCurrent;
UCHAR bCode; UCHAR bCode;
UCHAR *mPtr; UCHAR *mPtr;
HS hs[4]; HS hs[4];
@ -2193,17 +2193,17 @@ switch (OptNum)
//============================================================================= //=============================================================================
// //
//============================================================================= //=============================================================================
void main(short argc,char **argv) int main(short argc,char **argv)
{ {
short mx,my,mButtons; short mx,my,mButtons;
short Action,done,rFlag; short Action,done,rFlag;
int result; int result;
UINT OldCode,key; USHORT OldCode,key;
if (MouseInstalled() != -1) if (MouseInstalled() != -1)
{ {
printf("Mouse required.\n"); printf("Mouse required.\n");
return; return 1;
} }
VidBuf = (UCHAR *)malloc(64000); VidBuf = (UCHAR *)malloc(64000);
@ -2211,7 +2211,7 @@ BlankbmBuf = (UCHAR *)malloc(4100);
if (VidBuf == NULL || BlankbmBuf == NULL) if (VidBuf == NULL || BlankbmBuf == NULL)
{ {
printf("Not enough memory\n"); printf("Not enough memory\n");
return; return 1;
} }
memset(BlankbmBuf,0,4100); memset(BlankbmBuf,0,4100);
@ -2226,7 +2226,7 @@ for (mx = 0; mx < 256; mx++)
if (LoadDescFile(argv[1])) if (LoadDescFile(argv[1]))
{ {
printf("\nError reading ASCII file - ErrorCode = %d\n",ReadErrorCode); printf("\nError reading ASCII file - ErrorCode = %d\n",ReadErrorCode);
return; return 1;
} }
memmove(bmPalette,colordat,768); memmove(bmPalette,colordat,768);
@ -2245,52 +2245,23 @@ if (LoadGridMap(MapName))
if (AckOpenResource("MEDIT.DTF")) if (AckOpenResource("MEDIT.DTF"))
{ {
printf("Unable to locate MEDIT.DTF\n"); printf("Unable to locate MEDIT.DTF\n");
return; return 1;
} }
if (LoadSmallFont()) if (LoadSmallFont())
{ {
printf("Error loading SPFONT.BBM\n"); printf("Error loading SPFONT.BBM\n");
return; return 1;
} }
if (LoadMedFont()) if (LoadMedFont())
{ {
printf("Error loading FONT6X9.BBM\n"); printf("Error loading FONT6X9.BBM\n");
return; return 1;
} }
#if 0
Bitmaps[1] = AckReadiff("m1.bbm");
if (Bitmaps[1] == NULL)
{
printf("Error loading m1.bbm");
return;
}
Bitmaps[2] = AckReadiff("m12.bbm");
if (Bitmaps[2] == NULL)
{
printf("Error loading m12.bbm");
return;
}
ObjBitmaps[1] = AckReadiff("slime1a.bbm");
strcpy(MapName,"kit.map");
if (LoadGridMap(MapName))
{
memset(MedGrid,0,(GRID_MAX * 2));
memset(MobGrid,0,(GRID_MAX * 2));
}
memset(MedFloorMap,0,(GRID_MAX * 2));
memset(MedCeilMap,0,(GRID_MAX * 2));
#endif
ViewMode = VM_2D; ViewMode = VM_2D;
ViewType = VT_MAP; ViewType = VT_MAP;
MaxCol = GRID_WIDTH-12; MaxCol = GRID_WIDTH-12;
@ -2641,6 +2612,7 @@ while (!done)
} }
AckSetTextmode(); AckSetTextmode();
return 0;
} }