2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
#include "engine.h"
|
|
|
|
|
|
|
|
#include <io.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
// static int globhiz, globloz, globhihit, globlohit;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
void overwritesprite(int thex, int they, short tilenum, signed char shade, char stat, char dapalnum)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
|
|
|
#if 0
|
2019-08-31 07:47:15 +00:00
|
|
|
rotatesprite(thex << 16, they << 16, 0x10000, (short)((flags & 8) << 7), tilenum, shade, dapalnum,
|
|
|
|
(char)(((flags & 1 ^ 1) << 4) + (flags & 2) + ((flags & 4) >> 2) + ((flags & 16) >> 2) ^ ((flags & 8) >> 1)),
|
|
|
|
windowx1, windowy1, windowx2, windowy2);
|
2019-08-26 03:59:14 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
rotatesprite(thex << 16, they << 16, 65536L, (stat & 8) << 7, tilenum, shade, dapalnum,
|
|
|
|
(((stat & 1) ^ 1) << 4) + (stat & 2) + ((stat & 4) >> 2) + (((stat & 16) >> 2) ^ ((stat & 8) >> 1)),
|
2019-08-26 03:59:14 +00:00
|
|
|
windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y);
|
|
|
|
}
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
void permanentwritesprite(int thex, int they, short tilenum, signed char shade, int cx1, int cy1, int cx2, int cy2, char dapalnum)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
rotatesprite(thex << 16, they << 16, 65536L, 0, tilenum, shade, dapalnum, 8 + 16, cx1, cy1, cx2, cy2);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void resettiming()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
numframes = 0L;
|
|
|
|
totalclock = 0L;
|
2019-08-26 03:59:14 +00:00
|
|
|
// TODO totalclocklock = 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
void kensetpalette(unsigned char *vgapal)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
//setbrightness(0, (char*)vgapal, 4 | 2);
|
2019-08-26 03:59:14 +00:00
|
|
|
// TODO
|
|
|
|
Bmemcpy(palette, vgapal, 768);
|
2019-08-31 10:36:26 +00:00
|
|
|
for (auto &i : palette)
|
|
|
|
i <<= 2;
|
2019-08-31 09:08:38 +00:00
|
|
|
videoSetPalette(0, 0, /*4 | */2);
|
2019-08-26 03:59:14 +00:00
|
|
|
#if 0
|
|
|
|
char vesapal[1024];
|
|
|
|
|
|
|
|
for(int i = 0; i < 256; i++)
|
|
|
|
{
|
|
|
|
vesapal[i*4+0] = vgapal[i*3+2];
|
|
|
|
vesapal[i*4+1] = vgapal[i*3+1];
|
|
|
|
vesapal[i*4+2] = vgapal[i*3+0];
|
|
|
|
vesapal[i*4+3] = 0;
|
|
|
|
}
|
|
|
|
#ifndef __WATCOMC__
|
2019-08-31 07:47:15 +00:00
|
|
|
(0L, 256L, vesapal);
|
2019-08-26 03:59:14 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
void printext(int x, int y, const char *buffer, short tilenum, char invisiblecol)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
int i;
|
|
|
|
unsigned char ch;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
for (i = 0; buffer[i] != 0; i++)
|
|
|
|
{
|
|
|
|
ch = (unsigned char)buffer[i];
|
|
|
|
rotatesprite((x - ((ch & 15) << 3)) << 16, (y - ((ch >> 4) << 3)) << 16, 65536L, 0, tilenum, 0, 0, 8 + 16 + 128, x, y, x + 7, y + 7);
|
|
|
|
x += 8;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
#if 0
|
2019-08-31 07:47:15 +00:00
|
|
|
int i;
|
|
|
|
char ch;
|
|
|
|
|
|
|
|
for(i=0;buffer[i]!=0;i++)
|
|
|
|
{
|
|
|
|
ch = buffer[i];
|
|
|
|
rotatesprite((x-((8&15)<<3))<<16,(y-((8>>4)<<3))<<16,65536L,0,tilenum,0,0,8+16+64+128,x,y,x+7,y+7);
|
|
|
|
rotatesprite((x-((ch&15)<<3))<<16,(y-((ch>>4)<<3))<<16,65536L,0,tilenum,0,0,8+16+128,x,y,x+7,y+7);
|
|
|
|
x += 8;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void precache()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < numsectors; i++)
|
|
|
|
{
|
|
|
|
short j = sector[i].ceilingpicnum;
|
|
|
|
if (waloff[j] == 0) tileLoad(j);
|
|
|
|
j = sector[i].floorpicnum;
|
|
|
|
if (waloff[j] == 0) tileLoad(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < numwalls; i++)
|
|
|
|
{
|
|
|
|
short j = wall[i].picnum;
|
|
|
|
if (waloff[j] == 0) tileLoad(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < kMaxSprites; i++)
|
|
|
|
{
|
|
|
|
if (sprite[i].statnum < kMaxStatus)
|
|
|
|
{
|
|
|
|
short j = sprite[i].picnum;
|
|
|
|
if (waloff[j] == 0) tileLoad(j);
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|