2006-04-23 06:44:19 +00:00
|
|
|
// A.ASM replacement using C
|
|
|
|
// Mainly by Ken Silverman, with things melded with my port by
|
2012-03-12 04:47:04 +00:00
|
|
|
// Jonathon Fowler (jf@jonof.id.au)
|
2006-04-23 06:44:19 +00:00
|
|
|
//
|
|
|
|
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
|
|
|
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
|
|
|
// See the included license file "BUILDLIC.TXT" for license info.
|
|
|
|
|
|
|
|
#include "a.h"
|
|
|
|
|
2006-09-10 17:40:34 +00:00
|
|
|
#ifdef ENGINE_USING_A_C
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t krecip(int32_t num); // from engine.c
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
#define BITSOFPRECISION 3
|
|
|
|
#define BITSOFPRECISIONPOW 8
|
|
|
|
|
2008-04-25 11:21:08 +00:00
|
|
|
extern intptr_t asm1, asm2, asm3, asm4;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t fpuasm, globalx3, globaly3;
|
2006-04-23 06:44:19 +00:00
|
|
|
extern void *reciptable;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static int32_t bpl, transmode = 0;
|
|
|
|
static int32_t glogx, glogy, gbxinc, gbyinc, gpinc;
|
2006-04-23 06:44:19 +00:00
|
|
|
static char *gbuf, *gpal, *ghlinepal, *gtrans;
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
//Global variable functions
|
2009-01-09 09:29:17 +00:00
|
|
|
void setvlinebpl(int32_t dabpl) { bpl = dabpl; }
|
2008-04-25 11:21:08 +00:00
|
|
|
void fixtransluscence(intptr_t datransoff) { gtrans = (char *)datransoff; }
|
2006-04-23 06:44:19 +00:00
|
|
|
void settransnormal(void) { transmode = 0; }
|
|
|
|
void settransreverse(void) { transmode = 1; }
|
|
|
|
|
|
|
|
|
2012-03-04 20:12:30 +00:00
|
|
|
///// Ceiling/floor horizontal line functions /////
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc)
|
2006-04-24 19:04:22 +00:00
|
|
|
{ glogx = logx; glogy = logy; gbuf = (char *)bufplc; }
|
2006-04-23 06:44:19 +00:00
|
|
|
void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; }
|
2009-01-09 09:29:17 +00:00
|
|
|
void setuphlineasm4(int32_t bxinc, int32_t byinc) { gbxinc = bxinc; gbyinc = byinc; }
|
|
|
|
void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, uint32_t bx, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; }
|
2012-03-04 20:12:30 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2012-03-04 20:12:30 +00:00
|
|
|
const char *const palptr = &ghlinepal[paloffs];
|
|
|
|
const char *const buf = gbuf;
|
|
|
|
const int32_t bxinc = gbxinc, byinc = gbyinc;
|
|
|
|
const int32_t logx = glogx, logy = glogy;
|
|
|
|
char *pp = (char *)p;
|
|
|
|
|
|
|
|
for (; cnt>=0; cnt--)
|
|
|
|
{
|
|
|
|
*pp = palptr[buf[((bx>>(32-logx))<<logy)+(by>>(32-logy))]];
|
|
|
|
bx -= bxinc;
|
|
|
|
by -= byinc;
|
|
|
|
pp--;
|
|
|
|
}
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-04 20:12:30 +00:00
|
|
|
///// Sloped ceiling/floor vertical line functions /////
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void setupslopevlin(int32_t logylogx, intptr_t bufplc, int32_t pinc)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
glogx = (logylogx&255); glogy = (logylogx>>8);
|
|
|
|
gbuf = (char *)bufplc; gpinc = pinc;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
2009-01-09 09:29:17 +00:00
|
|
|
void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2011-01-16 02:50:27 +00:00
|
|
|
intptr_t *slopalptr;
|
2009-11-04 08:11:21 +00:00
|
|
|
int32_t bz, bzinc;
|
2009-01-09 09:29:17 +00:00
|
|
|
uint32_t u, v;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
bz = asm3; bzinc = (asm1>>3);
|
2011-01-16 02:50:27 +00:00
|
|
|
slopalptr = (intptr_t *)slopaloffs;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; cnt>0; cnt--)
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
i = krecip(bz>>6); bz += bzinc;
|
|
|
|
u = bx+globalx3*i;
|
|
|
|
v = by+globaly3*i;
|
2008-04-25 11:21:08 +00:00
|
|
|
(*(char *)p) = *(char *)(((intptr_t)slopalptr[0])+gbuf[((u>>(32-glogx))<<glogy)+(v>>(32-glogy))]);
|
2006-04-24 19:04:22 +00:00
|
|
|
slopalptr--;
|
|
|
|
p += gpinc;
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-04 20:12:30 +00:00
|
|
|
///// Wall,face sprite/wall sprite vertical line functions /////
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void setupvlineasm(int32_t neglogy) { glogy = neglogy; }
|
2012-03-04 20:12:30 +00:00
|
|
|
// cnt+1 loop iterations!
|
2012-03-18 23:16:57 +00:00
|
|
|
int32_t vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2012-03-04 20:12:30 +00:00
|
|
|
const char *const buf = (char *)bufplc;
|
|
|
|
const char *const pal = (char *)paloffs;
|
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
|
|
|
char *pp = (char *)p;
|
|
|
|
|
|
|
|
cnt++;
|
|
|
|
|
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2012-03-04 20:12:30 +00:00
|
|
|
*pp = pal[buf[vplc>>logy]];
|
|
|
|
pp += ourbpl;
|
2006-04-24 19:04:22 +00:00
|
|
|
vplc += vinc;
|
|
|
|
}
|
2012-03-04 20:12:30 +00:00
|
|
|
while (--cnt);
|
2012-03-18 23:16:57 +00:00
|
|
|
|
|
|
|
return vplc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern intptr_t palookupoffse[4];
|
|
|
|
extern int32_t vplce[4], vince[4];
|
|
|
|
extern intptr_t bufplce[4];
|
|
|
|
|
|
|
|
// cnt >= 1
|
|
|
|
void vlineasm4(int32_t cnt, char *p)
|
|
|
|
{
|
|
|
|
char ch;
|
|
|
|
int32_t i;
|
|
|
|
#if 1
|
|
|
|
// this gives slightly more stuff in registers in the loop
|
|
|
|
// (on x86_64 at least)
|
|
|
|
char *const pal[4] = {(char *)palookupoffse[0], (char *)palookupoffse[1], (char *)palookupoffse[2], (char *)palookupoffse[3]};
|
|
|
|
char *const buf[4] = {(char *)bufplce[0], (char *)bufplce[1], (char *)bufplce[2], (char *)bufplce[3]};
|
|
|
|
const int32_t vinc[4] = {vince[0], vince[1], vince[2], vince[3]};
|
|
|
|
uint32_t vplc[4] = {vplce[0], vplce[1], vplce[2], vplce[3]};
|
|
|
|
#else
|
|
|
|
char *pal[4];
|
|
|
|
char *buf[4];
|
|
|
|
int32_t vinc[4];
|
|
|
|
uint32_t vplc[4];
|
|
|
|
|
|
|
|
Bmemcpy(pal, palookupoffse, sizeof(pal));
|
|
|
|
Bmemcpy(buf, bufplce, sizeof(buf));
|
|
|
|
Bmemcpy(vinc, vince, sizeof(vinc));
|
|
|
|
Bmemcpy(vplc, vplce, sizeof(vplc));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
{
|
|
|
|
ch = buf[i][vplc[i]>>logy]; p[i] = pal[i][ch];
|
|
|
|
vplc[i] += vinc[i];
|
|
|
|
}
|
|
|
|
p += ourbpl;
|
|
|
|
}
|
|
|
|
while (--cnt);
|
|
|
|
|
|
|
|
Bmemcpy(vplce, vplc, sizeof(vplce));
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void setupmvlineasm(int32_t neglogy) { glogy = neglogy; }
|
2012-03-04 20:12:30 +00:00
|
|
|
// cnt+1 loop iterations!
|
2012-03-18 23:16:57 +00:00
|
|
|
int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
char ch;
|
|
|
|
|
2012-03-04 20:12:30 +00:00
|
|
|
const char *const buf = (char *)bufplc;
|
|
|
|
const char *const pal = (char *)paloffs;
|
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
|
|
|
char *pp = (char *)p;
|
|
|
|
|
|
|
|
cnt++;
|
|
|
|
|
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2012-03-04 20:12:30 +00:00
|
|
|
ch = buf[vplc>>logy]; if (ch != 255) *pp = pal[ch];
|
|
|
|
pp += ourbpl;
|
2006-04-24 19:04:22 +00:00
|
|
|
vplc += vinc;
|
|
|
|
}
|
2012-03-04 20:12:30 +00:00
|
|
|
while (--cnt);
|
2012-03-18 23:16:57 +00:00
|
|
|
|
|
|
|
return vplc;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-03-18 23:16:57 +00:00
|
|
|
// cnt >= 1
|
|
|
|
void mvlineasm4(int32_t cnt, char *p)
|
|
|
|
{
|
|
|
|
char ch;
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
char *const pal[4] = {(char *)palookupoffse[0], (char *)palookupoffse[1], (char *)palookupoffse[2], (char *)palookupoffse[3]};
|
|
|
|
char *const buf[4] = {(char *)bufplce[0], (char *)bufplce[1], (char *)bufplce[2], (char *)bufplce[3]};
|
|
|
|
const int32_t vinc[4] = {vince[0], vince[1], vince[2], vince[3]};
|
|
|
|
uint32_t vplc[4] = {vplce[0], vplce[1], vplce[2], vplce[3]};
|
|
|
|
|
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
{
|
|
|
|
ch = buf[i][vplc[i]>>logy]; if (ch != 255) p[i] = pal[i][ch];
|
|
|
|
vplc[i] += vinc[i];
|
|
|
|
}
|
|
|
|
p += ourbpl;
|
|
|
|
}
|
|
|
|
while (--cnt);
|
|
|
|
|
|
|
|
Bmemcpy(vplce, vplc, sizeof(vplce));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void setuptvlineasm(int32_t neglogy) { glogy = neglogy; }
|
2012-03-04 20:12:30 +00:00
|
|
|
// cnt+1 loop iterations!
|
2009-01-09 09:29:17 +00:00
|
|
|
void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
char ch;
|
|
|
|
|
2012-03-04 20:12:30 +00:00
|
|
|
const char *const buf = (char *)bufplc;
|
|
|
|
const char *const pal = (char *)paloffs;
|
|
|
|
const char *const trans = (char *)gtrans;
|
|
|
|
const int32_t logy = glogy, ourbpl = bpl, transm = transmode;
|
|
|
|
char *pp = (char *)p;
|
|
|
|
|
|
|
|
cnt++;
|
|
|
|
|
|
|
|
if (transm)
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2012-03-04 20:12:30 +00:00
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2012-03-11 17:36:49 +00:00
|
|
|
ch = buf[vplc>>logy];
|
2012-03-04 20:12:30 +00:00
|
|
|
if (ch != 255) *pp = trans[(*pp)|(pal[ch]<<8)];
|
|
|
|
pp += ourbpl;
|
2006-04-24 19:04:22 +00:00
|
|
|
vplc += vinc;
|
|
|
|
}
|
2012-03-04 20:12:30 +00:00
|
|
|
while (--cnt);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-04 20:12:30 +00:00
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2012-03-04 20:12:30 +00:00
|
|
|
ch = buf[vplc>>logy];
|
|
|
|
if (ch != 255) *pp = trans[((*pp)<<8)|pal[ch]];
|
|
|
|
pp += ourbpl;
|
2006-04-24 19:04:22 +00:00
|
|
|
vplc += vinc;
|
|
|
|
}
|
2012-03-04 20:12:30 +00:00
|
|
|
while (--cnt);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
//Floor sprite horizontal line functions
|
2009-01-09 09:29:17 +00:00
|
|
|
void msethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; }
|
2012-03-07 19:42:37 +00:00
|
|
|
// cntup16>>16 + 1 iterations
|
2009-01-09 09:29:17 +00:00
|
|
|
void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
char ch;
|
|
|
|
|
2012-03-07 19:42:37 +00:00
|
|
|
const int32_t xinc = asm1, yinc = asm2;
|
|
|
|
|
2011-04-14 20:48:08 +00:00
|
|
|
UNREFERENCED_PARAMETER(junk);
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
gbuf = (char *)bufplc;
|
|
|
|
gpal = (char *)asm3;
|
2012-03-07 19:42:37 +00:00
|
|
|
|
|
|
|
cntup16>>=16;
|
|
|
|
cntup16++;
|
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
|
|
|
|
if (ch != 255) *((char *)p) = gpal[ch];
|
2012-03-07 19:42:37 +00:00
|
|
|
bx += xinc;
|
|
|
|
by += yinc;
|
2006-04-24 19:04:22 +00:00
|
|
|
p++;
|
|
|
|
}
|
2012-03-07 19:42:37 +00:00
|
|
|
while (--cntup16);
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void tsethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; }
|
2012-03-07 19:42:37 +00:00
|
|
|
// cntup16>>16 + 1 iterations
|
2009-01-09 09:29:17 +00:00
|
|
|
void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
char ch;
|
|
|
|
|
2012-03-07 19:42:37 +00:00
|
|
|
const int32_t xinc = asm1, yinc = asm2;
|
|
|
|
|
2011-04-14 20:48:08 +00:00
|
|
|
UNREFERENCED_PARAMETER(junk);
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
gbuf = (char *)bufplc;
|
|
|
|
gpal = (char *)asm3;
|
2012-03-07 19:42:37 +00:00
|
|
|
|
|
|
|
cntup16>>=16;
|
|
|
|
cntup16++;
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
if (transmode)
|
|
|
|
{
|
2012-03-07 19:42:37 +00:00
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
|
2012-03-07 19:42:37 +00:00
|
|
|
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))|(gpal[ch]<<8)];
|
|
|
|
bx += xinc;
|
|
|
|
by += yinc;
|
2006-04-24 19:04:22 +00:00
|
|
|
p++;
|
|
|
|
}
|
2012-03-07 19:42:37 +00:00
|
|
|
while (--cntup16);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-07 19:42:37 +00:00
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
|
2012-03-07 19:42:37 +00:00
|
|
|
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)|gpal[ch]];
|
|
|
|
bx += xinc;
|
|
|
|
by += yinc;
|
2006-04-24 19:04:22 +00:00
|
|
|
p++;
|
|
|
|
}
|
2012-03-07 19:42:37 +00:00
|
|
|
while (--cntup16);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
//Rotatesprite vertical line functions
|
2009-01-09 09:29:17 +00:00
|
|
|
void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
gpal = (char *)paloffs;
|
|
|
|
gbxinc = bxinc;
|
|
|
|
gbyinc = byinc;
|
|
|
|
glogy = ysiz;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
2009-01-09 09:29:17 +00:00
|
|
|
void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
gbuf = (char *)bufplc;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; cnt>1; cnt--)
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
(*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]];
|
|
|
|
bx += gbxinc;
|
|
|
|
by += gbyinc;
|
|
|
|
p += bpl;
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
//Rotatesprite vertical line functions
|
2009-01-09 09:29:17 +00:00
|
|
|
void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
gpal = (char *)paloffs;
|
|
|
|
gbxinc = bxinc;
|
|
|
|
gbyinc = byinc;
|
|
|
|
glogy = ysiz;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
2009-01-09 09:29:17 +00:00
|
|
|
void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
char ch;
|
|
|
|
|
|
|
|
gbuf = (char *)bufplc;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; cnt>1; cnt--)
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
ch = gbuf[(bx>>16)*glogy+(by>>16)];
|
2007-12-12 17:42:14 +00:00
|
|
|
if (ch != 255)(*(char *)p) = gpal[ch];
|
2006-04-24 19:04:22 +00:00
|
|
|
bx += gbxinc;
|
|
|
|
by += gbyinc;
|
|
|
|
p += bpl;
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
gpal = (char *)paloffs;
|
|
|
|
gbxinc = bxinc;
|
|
|
|
gbyinc = byinc;
|
|
|
|
glogy = ysiz;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
2009-01-09 09:29:17 +00:00
|
|
|
void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
char ch;
|
|
|
|
|
|
|
|
gbuf = (char *)bufplc;
|
|
|
|
if (transmode)
|
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; cnt>1; cnt--)
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
ch = gbuf[(bx>>16)*glogy+(by>>16)];
|
|
|
|
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
|
|
|
|
bx += gbxinc;
|
|
|
|
by += gbyinc;
|
|
|
|
p += bpl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; cnt>1; cnt--)
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
|
|
|
ch = gbuf[(bx>>16)*glogy+(by>>16)];
|
|
|
|
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
|
|
|
|
bx += gbxinc;
|
|
|
|
by += gbyinc;
|
|
|
|
p += bpl;
|
|
|
|
}
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void setupdrawslab(int32_t dabpl, intptr_t pal)
|
2006-04-24 19:04:22 +00:00
|
|
|
{ bpl = dabpl; gpal = (char *)pal; }
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void drawslab(int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t x;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
while (dy > 0)
|
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<dx; x++) *(char *)(p+x) = gpal[(int32_t)(*(char *)((v>>16)+vptr))];
|
2006-04-24 19:04:22 +00:00
|
|
|
p += bpl; v += vi; dy--;
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-03-11 17:36:49 +00:00
|
|
|
#if 0
|
2009-01-09 09:29:17 +00:00
|
|
|
void stretchhline(intptr_t p0, int32_t u, int32_t cnt, int32_t uinc, intptr_t rptr, intptr_t p)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
p0 = p-(cnt<<2);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
p--;
|
|
|
|
*(char *)p = *(char *)((u>>16)+rptr); u -= uinc;
|
2007-12-12 17:42:14 +00:00
|
|
|
}
|
|
|
|
while (p > p0);
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
2012-03-11 17:36:49 +00:00
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
void mmxoverlay() { }
|
|
|
|
|
2006-09-10 17:40:34 +00:00
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
/*
|
|
|
|
* vim:ts=4:
|
|
|
|
*/
|
|
|
|
|