From 0789a528be4bc6e60ecf8e8b0bba51428299ca6b Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 3 Nov 2019 13:05:01 -0500 Subject: [PATCH] more minor cleanups --- ack_lib/ACKDATA.C | 2 +- ack_lib/ACKDOOR.C | 1 + ack_lib/ACKFLOOR.C | 16 ++++++++-------- ack_lib/ACKGIF.C | 3 ++- ack_lib/ACKIFF.C | 2 +- ack_lib/ACKINIT.C | 8 ++++---- ack_lib/ACKLDBMP.C | 2 +- ack_lib/ACKOVER.C | 2 +- ack_lib/ACKPCX.C | 8 ++++---- ack_lib/ACKPOV.C | 1 + ack_lib/ACKUTIL.C | 9 +++++---- ack_lib/ACKVIEW.C | 1 + fdemo/FDEMO.C | 12 ++++++++---- mall/MALL.C | 17 +++++++++++------ 14 files changed, 49 insertions(+), 35 deletions(-) diff --git a/ack_lib/ACKDATA.C b/ack_lib/ACKDATA.C index a533f21..3c06df3 100644 --- a/ack_lib/ACKDATA.C +++ b/ack_lib/ACKDATA.C @@ -139,7 +139,7 @@ USHORT FloorMap[4096]; USHORT CeilMap[4096]; UCHAR HitMap[4096]; -UINT *VidSeg = 0xA0000; +UINT *VidSeg = (UINT*)0xA0000; char *scantables[96]; volatile UCHAR AckKeys[128]; // Buffer for keystrokes volatile long AckTimerCounter; diff --git a/ack_lib/ACKDOOR.C b/ack_lib/ACKDOOR.C index c6718b7..ba5f0a3 100644 --- a/ack_lib/ACKDOOR.C +++ b/ack_lib/ACKDOOR.C @@ -1,5 +1,6 @@ // This source file contains the functions needed to process doors. // (c) 1995 ACK Software (Lary Myers) +#include #include "ack3d.h" #include "ackeng.h" #include "ackext.h" diff --git a/ack_lib/ACKFLOOR.C b/ack_lib/ACKFLOOR.C index b837038..304c1a0 100644 --- a/ack_lib/ACKFLOOR.C +++ b/ack_lib/ACKFLOOR.C @@ -33,14 +33,14 @@ void SetupFloors(ACKENG *ae) long x,y,dist; long Lastx,Lasty; -for ( i=0; i<12;i++ ) scantables[i] = ae->PalTable + (7*256); -for ( i=12;i<24;i++ ) scantables[i] = ae->PalTable + (6*256); -for ( i=24;i<36;i++ ) scantables[i] = ae->PalTable + (5*256); -for ( i=36;i<48;i++ ) scantables[i] = ae->PalTable + (4*256); -for ( i=48;i<60;i++ ) scantables[i] = ae->PalTable + (3*256); -for ( i=60;i<72;i++ ) scantables[i] = ae->PalTable + (2*256); -for ( i=72;i<84;i++ ) scantables[i] = ae->PalTable + (1*256); -for ( i=84;i<96;i++ ) scantables[i] = ae->PalTable; +for ( i=0; i<12;i++ ) scantables[i] = (char*)(ae->PalTable + (7*256)); +for ( i=12;i<24;i++ ) scantables[i] = (char*)(ae->PalTable + (6*256)); +for ( i=24;i<36;i++ ) scantables[i] = (char*)(ae->PalTable + (5*256)); +for ( i=36;i<48;i++ ) scantables[i] = (char*)(ae->PalTable + (4*256)); +for ( i=48;i<60;i++ ) scantables[i] = (char*)(ae->PalTable + (3*256)); +for ( i=60;i<72;i++ ) scantables[i] = (char*)(ae->PalTable + (2*256)); +for ( i=72;i<84;i++ ) scantables[i] = (char*)(ae->PalTable + (1*256)); +for ( i=84;i<96;i++ ) scantables[i] = (char*)(ae->PalTable); Scale_Fac = (89 - ViewHeight) * 5; diff --git a/ack_lib/ACKGIF.C b/ack_lib/ACKGIF.C index bd7b1cb..26e4228 100644 --- a/ack_lib/ACKGIF.C +++ b/ack_lib/ACKGIF.C @@ -16,6 +16,7 @@ *****************************************************************************/ #include +#include #include #include #include @@ -147,7 +148,7 @@ else } fread(buf,1,6,fp); -if( strncmp( buf, "GIF", 3 ) ) +if( strncmp( (char*)buf, "GIF", 3 ) ) { if (!rsHandle) fclose(fp); diff --git a/ack_lib/ACKIFF.C b/ack_lib/ACKIFF.C index 131d56e..23b1a0c 100644 --- a/ack_lib/ACKIFF.C +++ b/ack_lib/ACKIFF.C @@ -212,7 +212,7 @@ unsigned char *AckReadiff(char *picname) } CloseFile(pic); - return((char *)savedestx); + return((unsigned char *)savedestx); } long ByteFlipLong(long NUMBER) diff --git a/ack_lib/ACKINIT.C b/ack_lib/ACKINIT.C index 2536707..26776df 100644 --- a/ack_lib/ACKINIT.C +++ b/ack_lib/ACKINIT.C @@ -83,7 +83,7 @@ BackDropRows = 100; for (i = 0; i < 640; i++) { - BackArray[i] = AckMalloc(BackDropRows+1); + BackArray[i] = (UCHAR*)AckMalloc(BackDropRows+1); if (BackArray[i] == NULL) return(ERR_NOMEMORY); memset(BackArray[i],topcolor,BackDropRows); @@ -190,7 +190,7 @@ for (ldst = 10;ldst < 2048; ldst++) } if (j) { - lp = AckMalloc(len); + lp = (short*)AckMalloc(len); if (lp == NULL) { return; @@ -324,7 +324,7 @@ for (len = 0; len < VIEW_WIDTH; len++) memset(sa,0,sizeof(SLICE)); // Set all data to 0 for (ca = 0; ca < 8; ca++) { - saNext = AckMalloc(sizeof(SLICE)); // Create a slice structure to link in + saNext = (SLICE*)AckMalloc(sizeof(SLICE)); // Create a slice structure to link in if (saNext == NULL) return(ERR_NOMEMORY); // Check for memory allocation memset(saNext,0,sizeof(SLICE)); // Initialize all data to 0 @@ -423,7 +423,7 @@ if (count) ae->myGrid[pos+GRID_WIDTH] = mPtr; read(handle,buf,MAX_MULTI); buf[MAX_MULTI] = '\0'; - len = strlen(buf); + len = strlen((char*)buf); if (len > MAX_MULTI) len = MAX_MULTI; *mPtr = len; if (len) diff --git a/ack_lib/ACKLDBMP.C b/ack_lib/ACKLDBMP.C index b6bf3fe..9ce0341 100644 --- a/ack_lib/ACKLDBMP.C +++ b/ack_lib/ACKLDBMP.C @@ -81,7 +81,7 @@ if ((x*y) != BITMAP_SIZE) memmove(buf,&buf[4],BITMAP_SIZE); bFlag = 1; -bmp = AckMalloc(bLen); +bmp = (UCHAR*)AckMalloc(bLen); if (bmp == NULL) { AckFree(buf); diff --git a/ack_lib/ACKOVER.C b/ack_lib/ACKOVER.C index aea3adb..11a2a59 100644 --- a/ack_lib/ACKOVER.C +++ b/ack_lib/ACKOVER.C @@ -48,7 +48,7 @@ while (vLen > 0) (*(short *)&ae->ScreenBuffer[bPos]) = 0; bPos += 2; -ae->OverlayBuffer = AckMalloc(bPos); +ae->OverlayBuffer = (UCHAR*)AckMalloc(bPos); if (ae->OverlayBuffer != NULL) { diff --git a/ack_lib/ACKPCX.C b/ack_lib/ACKPCX.C index aa59a38..a8bfd64 100644 --- a/ack_lib/ACKPCX.C +++ b/ack_lib/ACKPCX.C @@ -96,7 +96,7 @@ if (pcx->imagebytes > PCX_MAX_SIZE) return(NULL); } -pcx->bitmap=(char*)AckMalloc(pcx->imagebytes+4); +pcx->bitmap=(UCHAR*)AckMalloc(pcx->imagebytes+4); if (pcx->bitmap == NULL) { @@ -105,7 +105,7 @@ if (pcx->bitmap == NULL) ErrorCode = ERR_NOMEMORY; return(NULL); } -p=&pcx->bitmap[4]; +p=(char*)&pcx->bitmap[4]; for (i=0;iimagebytes;i++) { @@ -127,14 +127,14 @@ for (i=0;iimagebytes;i++) fseek(f,-768L,SEEK_END); // get palette from pcx file fread(colordat,768,1,f); -p=colordat; +p=(char*)colordat; for (i=0;i<768;i++) // bit shift palette *p++=*p >>2; if (!rsHandle) fclose(f); -p = pcx->bitmap; +p = (char*)pcx->bitmap; (*(short *)p) = pcx->width; p += sizeof(short); (*(short *)p) = pcx->height; diff --git a/ack_lib/ACKPOV.C b/ack_lib/ACKPOV.C index fac495f..a861b74 100644 --- a/ack_lib/ACKPOV.C +++ b/ack_lib/ACKPOV.C @@ -2,6 +2,7 @@ // (c) 1995 ACK Software (Lary Myers) #include +#include #include "ack3d.h" #include "ackeng.h" diff --git a/ack_lib/ACKUTIL.C b/ack_lib/ACKUTIL.C index e03a1b0..dc9bce6 100644 --- a/ack_lib/ACKUTIL.C +++ b/ack_lib/ACKUTIL.C @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,7 @@ else //ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ void AckSetupKeyboard(void) { -memset(AckKeys, 0, sizeof(UCHAR)*128); +memset((void*)AckKeys, 0, sizeof(UCHAR)*128); KeyPressed = 0; OldKeybdInt = _dos_getvect(0x9); @@ -105,7 +106,7 @@ void *AckMalloc(size_t mSize) mSize += sizeof(long); mSize++; -mBlock = malloc(mSize); +mBlock = (UCHAR*)malloc(mSize); if (mBlock == NULL) { @@ -166,7 +167,7 @@ short AckLoadAndSetPalette(char *PalName) short handle,ErrCode; char *buf; -buf = AckMalloc(800); +buf = (char*)AckMalloc(800); if (buf == NULL) return(ERR_NOMEMORY); @@ -186,7 +187,7 @@ if (handle > 0) close(handle); memset(buf,0,3); // Make sure color 0 is always black - AckSetPalette(buf); + AckSetPalette((UCHAR*)buf); } else ErrCode = ERR_BADFILE; diff --git a/ack_lib/ACKVIEW.C b/ack_lib/ACKVIEW.C index 5b1eb11..865166e 100644 --- a/ack_lib/ACKVIEW.C +++ b/ack_lib/ACKVIEW.C @@ -1,6 +1,7 @@ // This file contains the declarations and functions to set up views for the // ray casting engine. #include +#include #include "ack3d.h" // Main ACK-3D internal and interface data structures #include "ackeng.h" // Intrnal structures and constants diff --git a/fdemo/FDEMO.C b/fdemo/FDEMO.C index 3c6a26f..c038b2e 100644 --- a/fdemo/FDEMO.C +++ b/fdemo/FDEMO.C @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -166,6 +167,9 @@ volatile short cframes=0, count=0, ticks=0; }; +void ShowStatus(void); + + //============================================================================= // //============================================================================= @@ -235,7 +239,7 @@ short LoadSmallFont(void) int len; ht = 2; -smFont = AckReadiff((UCHAR *)ht); +smFont = (char*)AckReadiff((char*)ht); if (smFont == NULL) return(-1); @@ -905,7 +909,7 @@ if (MouseInstalled() != -1) return(1); } -ae = AckMalloc(sizeof(ACKENG)); +ae = (ACKENG*)AckMalloc(sizeof(ACKENG)); if (ae == NULL) { printf("Unable to get required memory.\n"); @@ -1016,7 +1020,7 @@ buf = AckReadiff(fName); if (buf == NULL) return(-1); -Video = (char *)0xA0000; +Video = (UCHAR*)0xA0000; memmove(Video,&buf[4],64000); AckSetPalette(colordat); @@ -2174,7 +2178,7 @@ EndBGmusic(); ShutDownFlag = 1; AckSlowDown(); // Set the timer back to normal speed AckWrapUp(ae); -AckSetTextmode(); +AckSetTextMode(); return(0); } diff --git a/mall/MALL.C b/mall/MALL.C index b5d0f9c..a4dbef1 100644 --- a/mall/MALL.C +++ b/mall/MALL.C @@ -6,11 +6,12 @@ #include #include -#include #include #include +#include #include #include +#include #include #include #include @@ -173,6 +174,10 @@ volatile short cframes=0, count=0, ticks=0; short ModDMA; // DMA channel of SB card char ModName[128]; // Filename of MOD file to read + +void ShowStatus(void); + + //============================================================================= // //============================================================================= @@ -371,7 +376,7 @@ short LoadSmallFont(void) int len; ht = 2; -smFont = AckReadiff((UCHAR *)ht); +smFont = (char*)AckReadiff((char*)ht); if (smFont == NULL) return(-1); @@ -1022,7 +1027,7 @@ FontSize = MaxHt * MaxWt; for (i = 0; i < 256; i++) { - Fonts[i] = AckMalloc(FontSize); + Fonts[i] = (UCHAR*)AckMalloc(FontSize); if (Fonts[i] == NULL) break; @@ -1130,7 +1135,7 @@ if (MouseInstalled() != -1) return(1); } -ae = AckMalloc(sizeof(ACKENG)); +ae = (ACKENG*)AckMalloc(sizeof(ACKENG)); if (ae == NULL) { printf("Unable to get required memory.\n"); @@ -1235,7 +1240,7 @@ buf = AckReadiff(fName); if (buf == NULL) return(-1); -Video = (char *)0xA0000; +Video = (UCHAR*)0xA0000; memmove(Video,&buf[4],64000); AckSetPalette(colordat); @@ -2193,7 +2198,7 @@ EndBGmusic(); ShutDownFlag = 1; AckSlowDown(); // Set the timer back to normal speed AckWrapUp(ae); -AckSetTextmode(); +AckSetTextMode(); if (kbhit()) getch();