more minor cleanups

This commit is contained in:
Gered 2019-11-03 13:05:01 -05:00
parent 5a92ca7021
commit 0789a528be
14 changed files with 49 additions and 35 deletions

View file

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

View file

@ -1,5 +1,6 @@
// This source file contains the functions needed to process doors.
// (c) 1995 ACK Software (Lary Myers)
#include <stdlib.h>
#include "ack3d.h"
#include "ackeng.h"
#include "ackext.h"

View file

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

View file

@ -16,6 +16,7 @@
*****************************************************************************/
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <bios.h>
#include <fcntl.h>
@ -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);

View file

@ -212,7 +212,7 @@ unsigned char *AckReadiff(char *picname)
}
CloseFile(pic);
return((char *)savedestx);
return((unsigned char *)savedestx);
}
long ByteFlipLong(long NUMBER)

View file

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

View file

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

View file

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

View file

@ -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;i<pcx->imagebytes;i++)
{
@ -127,14 +127,14 @@ for (i=0;i<pcx->imagebytes;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;

View file

@ -2,6 +2,7 @@
// (c) 1995 ACK Software (Lary Myers)
#include <stdio.h>
#include <stdlib.h>
#include "ack3d.h"
#include "ackeng.h"

View file

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include <conio.h>
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
@ -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;

View file

@ -1,6 +1,7 @@
// This file contains the declarations and functions to set up views for the
// ray casting engine.
#include <stdio.h>
#include <string.h>
#include "ack3d.h" // Main ACK-3D internal and interface data structures
#include "ackeng.h" // Intrnal structures and constants

View file

@ -9,6 +9,7 @@
#include <malloc.h>
#include <mem.h>
#include <string.h>
#include <ctype.h>
#include <dos.h>
#include <time.h>
#include <io.h>
@ -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);
}

View file

@ -6,11 +6,12 @@
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <mem.h>
#include <string.h>
#include <ctype.h>
#include <dos.h>
#include <time.h>
#include <conio.h>
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
@ -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();