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"
|
2014-10-25 03:29:21 +00:00
|
|
|
#include "pragmas.h"
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2006-09-10 17:40:34 +00:00
|
|
|
#ifdef ENGINE_USING_A_C
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
#define BITSOFPRECISION 3
|
|
|
|
#define BITSOFPRECISIONPOW 8
|
|
|
|
|
2013-11-16 18:47:11 +00:00
|
|
|
// Compile code to saturate vplc for sprites to prevent stray lines at the
|
|
|
|
// bottom of non-y-flipped ones?
|
|
|
|
#define USE_SATURATE_VPLC
|
|
|
|
// Also for translucent masks?
|
|
|
|
//#define USE_SATURATE_VPLC_TRANS
|
|
|
|
|
2008-04-25 11:21:08 +00:00
|
|
|
extern intptr_t asm1, asm2, asm3, asm4;
|
2014-10-25 03:30:38 +00:00
|
|
|
extern int32_t globalx3, globaly3;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2013-09-21 13:37:31 +00:00
|
|
|
#ifdef USE_ASM64
|
|
|
|
# define A64_ASSIGN(var, val) var=val
|
|
|
|
#else
|
|
|
|
# define A64_ASSIGN(var, val)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_ASM64
|
|
|
|
// variables for a64.yasm
|
|
|
|
int32_t a64_bpl, a64_transmode, a64_glogy;
|
|
|
|
intptr_t a64_paloffs;
|
|
|
|
char *a64_gtrans;
|
|
|
|
#endif
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static int32_t bpl, transmode = 0;
|
2014-11-22 18:37:23 +00:00
|
|
|
static char *gbuf;
|
|
|
|
static int32_t glogx, glogy;
|
|
|
|
int32_t gpinc;
|
2014-10-25 03:30:38 +00:00
|
|
|
static int32_t gbxinc, gbyinc;
|
|
|
|
static char *gpal, *ghlinepal, *gtrans;
|
2012-03-18 23:17:17 +00:00
|
|
|
static char *gpal2;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
//Global variable functions
|
2013-09-21 13:37:31 +00:00
|
|
|
void setvlinebpl(int32_t dabpl) { A64_ASSIGN(a64_bpl, dabpl); bpl = dabpl;}
|
|
|
|
void fixtransluscence(intptr_t datransoff)
|
|
|
|
{
|
|
|
|
A64_ASSIGN(a64_gtrans, (char *)datransoff);
|
|
|
|
gtrans = (char *)datransoff;
|
|
|
|
}
|
|
|
|
void settransnormal(void) { A64_ASSIGN(a64_transmode, 0); transmode = 0; }
|
|
|
|
void settransreverse(void) { A64_ASSIGN(a64_transmode, 1); transmode = 1; }
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2014-10-29 17:06:43 +00:00
|
|
|
const char *const A_C_RESTRICT palptr = &ghlinepal[paloffs];
|
|
|
|
const char *const A_C_RESTRICT buf = gbuf;
|
2012-03-04 20:12:30 +00:00
|
|
|
const int32_t bxinc = gbxinc, byinc = gbyinc;
|
|
|
|
const int32_t logx = glogx, logy = glogy;
|
|
|
|
char *pp = (char *)p;
|
2014-10-25 03:30:38 +00:00
|
|
|
const uint8_t logx32 = 32-logx, logy32 = 32-logy;
|
2012-03-04 20:12:30 +00:00
|
|
|
|
2014-10-25 03:30:38 +00:00
|
|
|
#ifdef CLASSIC_SLICE_BY_4
|
|
|
|
for (; cnt>=4; cnt-=4, pp-=4)
|
2014-10-25 03:29:21 +00:00
|
|
|
{
|
2014-10-25 03:30:38 +00:00
|
|
|
*pp = palptr[buf[((bx>>logx32)<<logy)+(by>>logy32)]];
|
|
|
|
*(pp-1) = palptr[buf[(((bx-bxinc)>>logx32)<<logy)+((by-byinc)>>logy32)]];
|
|
|
|
*(pp-2) = palptr[buf[(((bx-(bxinc<<1))>>logx32)<<logy)+((by-(byinc<<1))>>logy32)]];
|
|
|
|
*(pp-3) = palptr[buf[(((bx-(bxinc*3))>>logx32)<<logy)+((by-(byinc*3))>>logy32)]];
|
2014-10-25 03:29:21 +00:00
|
|
|
|
|
|
|
bx -= bxinc<<2;
|
|
|
|
by -= byinc<<2;
|
|
|
|
}
|
2014-10-25 03:30:38 +00:00
|
|
|
#endif
|
2014-10-25 03:29:21 +00:00
|
|
|
|
2014-10-25 03:30:38 +00:00
|
|
|
for (; cnt>=0; cnt--, pp--)
|
2012-03-04 20:12:30 +00:00
|
|
|
{
|
2014-10-25 03:30:38 +00:00
|
|
|
*pp = palptr[buf[((bx>>logx32)<<logy)+(by>>logy32)]];
|
2012-03-04 20:12:30 +00:00
|
|
|
bx -= bxinc;
|
|
|
|
by -= byinc;
|
|
|
|
}
|
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 /////
|
2014-11-02 05:35:06 +00:00
|
|
|
extern int32_t sloptable[16384];
|
2012-03-04 20:12:30 +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
|
|
|
{
|
2014-10-29 17:06:43 +00:00
|
|
|
intptr_t * A_C_RESTRICT 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
|
|
|
{
|
2014-11-02 05:35:06 +00:00
|
|
|
i = (sloptable[(bz>>6)+8192]); bz += bzinc;
|
2014-08-23 10:28:18 +00:00
|
|
|
u = bx+(inthi_t)globalx3*i;
|
|
|
|
v = by+(inthi_t)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 /////
|
|
|
|
|
2012-07-06 11:26:24 +00:00
|
|
|
|
|
|
|
extern int32_t globaltilesizy;
|
|
|
|
|
|
|
|
static inline uint32_t ourmulscale32(uint32_t a, uint32_t b)
|
|
|
|
{
|
|
|
|
return ((uint64_t)a*b)>>32;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int32_t getpix(int32_t logy, const char *buf, uint32_t vplc)
|
|
|
|
{
|
2014-10-25 03:29:21 +00:00
|
|
|
return logy ? buf[vplc>>logy] : buf[ourmulscale32(vplc,globaltilesizy)];
|
2012-07-06 11:26:24 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2014-10-29 17:06:43 +00:00
|
|
|
const char *const A_C_RESTRICT buf = (char *)bufplc;
|
|
|
|
const char *const A_C_RESTRICT pal = (char *)paloffs;
|
2012-03-04 20:12:30 +00:00
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
|
|
|
char *pp = (char *)p;
|
|
|
|
|
|
|
|
cnt++;
|
|
|
|
|
2014-10-25 03:29:21 +00:00
|
|
|
if (logy)
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2014-10-25 03:29:21 +00:00
|
|
|
#ifdef CLASSIC_SLICE_BY_4
|
|
|
|
for (; cnt>=4; cnt-=4)
|
|
|
|
{
|
2012-07-06 11:26:24 +00:00
|
|
|
*pp = pal[buf[vplc>>logy]];
|
2014-10-25 03:29:21 +00:00
|
|
|
*(pp+ourbpl) = pal[buf[(vplc+vinc)>>logy]];
|
|
|
|
*(pp+(ourbpl<<1)) = pal[buf[(vplc+(vinc<<1))>>logy]];
|
|
|
|
*(pp+(ourbpl*3)) = pal[buf[(vplc+(vinc*3))>>logy ]];
|
|
|
|
pp += ourbpl<<2;
|
|
|
|
vplc += vinc<<2;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
while (cnt--)
|
|
|
|
{
|
|
|
|
*pp = pal[buf[vplc>>logy]];
|
|
|
|
pp += ourbpl;
|
|
|
|
vplc += vinc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef CLASSIC_SLICE_BY_4
|
|
|
|
for (; cnt>=4; cnt-=4)
|
|
|
|
{
|
|
|
|
*pp = pal[buf[ourmulscale32(vplc, globaltilesizy)]];
|
|
|
|
*(pp+ourbpl) = pal[buf[ourmulscale32((vplc+vinc),globaltilesizy)]];
|
|
|
|
*(pp+(ourbpl<<1)) = pal[buf[ourmulscale32((vplc+(vinc<<1)), globaltilesizy)]];
|
|
|
|
*(pp+(ourbpl*3)) = pal[buf[ourmulscale32((vplc+(vinc*3)), globaltilesizy)]];
|
|
|
|
pp += ourbpl<<2;
|
|
|
|
vplc += vinc<<2;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
while (cnt--)
|
|
|
|
{
|
|
|
|
*pp = pal[buf[ourmulscale32(vplc,globaltilesizy)]], pp += ourbpl;
|
|
|
|
vplc += vinc;
|
|
|
|
}
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2012-03-18 23:16:57 +00:00
|
|
|
return vplc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern intptr_t palookupoffse[4];
|
2012-11-15 14:28:11 +00:00
|
|
|
extern uint32_t vplce[4];
|
|
|
|
extern int32_t vince[4];
|
2012-03-18 23:16:57 +00:00
|
|
|
extern intptr_t bufplce[4];
|
|
|
|
|
2014-10-25 10:17:35 +00:00
|
|
|
#if (EDUKE32_GCC_PREREQ(4,7) || __has_extension(attribute_ext_vector_type)) && defined BITNESS64
|
2014-11-07 22:07:11 +00:00
|
|
|
// XXX: The "Ubuntu clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5)"
|
|
|
|
// does not compile us with USE_VECTOR_EXT. Maybe a newer one does?
|
|
|
|
# if !defined __clang__
|
|
|
|
# define USE_VECTOR_EXT
|
|
|
|
# endif
|
2013-11-16 18:47:07 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_VECTOR_EXT
|
|
|
|
typedef uint32_t uint32_vec4 __attribute__ ((vector_size (16)));
|
|
|
|
#endif
|
|
|
|
|
2013-11-16 18:47:11 +00:00
|
|
|
#ifdef USE_SATURATE_VPLC
|
|
|
|
# define saturate_vplc(vplc, vinc) vplc |= g_saturate & -(vplc < (uint32_t)vinc)
|
|
|
|
// NOTE: the vector types yield -1 for logical "true":
|
|
|
|
# define saturate_vplc_vec(vplc, vinc) vplc |= g_saturate & (vplc < vinc)
|
|
|
|
# ifdef USE_SATURATE_VPLC_TRANS
|
|
|
|
# define saturate_vplc_trans(vplc, vinc) saturate_vplc(vplc, vinc)
|
|
|
|
# else
|
|
|
|
# define saturate_vplc_trans(vplc, vinc)
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# define saturate_vplc(vplc, vinc)
|
|
|
|
# define saturate_vplc_vec(vplc, vinc)
|
|
|
|
# define saturate_vplc_trans(vplc, vinc)
|
|
|
|
#endif
|
|
|
|
|
2014-11-22 18:37:23 +00:00
|
|
|
#ifdef CLASSIC_NONPOW2_YSIZE_WALLS
|
2014-10-25 03:30:38 +00:00
|
|
|
// cnt >= 1
|
2014-11-22 18:37:23 +00:00
|
|
|
static void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *const A_C_RESTRICT * buf,
|
|
|
|
# ifdef USE_VECTOR_EXT
|
2014-10-25 03:30:38 +00:00
|
|
|
uint32_vec4 vplc, const uint32_vec4 vinc)
|
2014-11-22 18:37:23 +00:00
|
|
|
# else
|
2014-10-25 03:30:38 +00:00
|
|
|
uint32_t * vplc, const int32_t *vinc)
|
2014-11-22 18:37:23 +00:00
|
|
|
# endif
|
2014-10-25 03:30:38 +00:00
|
|
|
{
|
|
|
|
const int32_t ourbpl = bpl;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
p[0] = pal[0][buf[0][ourmulscale32(vplc[0], globaltilesizy)]];
|
|
|
|
p[1] = pal[1][buf[1][ourmulscale32(vplc[1], globaltilesizy)]];
|
|
|
|
p[2] = pal[2][buf[2][ourmulscale32(vplc[2], globaltilesizy)]];
|
|
|
|
p[3] = pal[3][buf[3][ourmulscale32(vplc[3], globaltilesizy)]];
|
|
|
|
|
2014-11-22 18:37:23 +00:00
|
|
|
# if defined USE_VECTOR_EXT
|
2014-10-25 03:30:38 +00:00
|
|
|
vplc += vinc;
|
2014-11-22 18:37:23 +00:00
|
|
|
# else
|
2014-10-25 03:30:38 +00:00
|
|
|
vplc[0] += vinc[0];
|
|
|
|
vplc[1] += vinc[1];
|
|
|
|
vplc[2] += vinc[2];
|
|
|
|
vplc[3] += vinc[3];
|
2014-11-22 18:37:23 +00:00
|
|
|
# endif
|
2014-10-25 03:30:38 +00:00
|
|
|
p += ourbpl;
|
|
|
|
} while (--cnt);
|
|
|
|
|
|
|
|
Bmemcpy(&vplce[0], &vplc[0], sizeof(uint32_t) * 4);
|
|
|
|
}
|
2014-11-22 18:37:23 +00:00
|
|
|
#endif
|
2014-10-25 03:30:38 +00:00
|
|
|
|
2012-03-18 23:16:57 +00:00
|
|
|
// cnt >= 1
|
|
|
|
void vlineasm4(int32_t cnt, char *p)
|
|
|
|
{
|
2014-10-29 17:06:43 +00:00
|
|
|
char * const A_C_RESTRICT pal[4] = {(char *)palookupoffse[0], (char *)palookupoffse[1], (char *)palookupoffse[2], (char *)palookupoffse[3]};
|
|
|
|
char * const A_C_RESTRICT buf[4] = {(char *)bufplce[0], (char *)bufplce[1], (char *)bufplce[2], (char *)bufplce[3]};
|
2013-11-16 18:47:07 +00:00
|
|
|
#ifdef USE_VECTOR_EXT
|
2014-12-01 19:52:08 +00:00
|
|
|
uint32_vec4 vinc = {(uint32_t)vince[0], (uint32_t)vince[1], (uint32_t)vince[2], (uint32_t)vince[3]};
|
2013-11-16 18:47:07 +00:00
|
|
|
uint32_vec4 vplc = {vplce[0], vplce[1], vplce[2], vplce[3]};
|
|
|
|
#else
|
2012-03-18 23:16:57 +00:00
|
|
|
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]};
|
|
|
|
#endif
|
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
|
|
|
|
2014-11-22 18:37:23 +00:00
|
|
|
#ifdef CLASSIC_NONPOW2_YSIZE_WALLS
|
|
|
|
if (EDUKE32_PREDICT_FALSE(!logy))
|
2012-03-18 23:16:57 +00:00
|
|
|
{
|
2014-11-22 18:37:23 +00:00
|
|
|
// This should only happen when 'globalshiftval = 0' has been set in engine.c.
|
2014-10-25 03:30:38 +00:00
|
|
|
vlineasm4nlogy(cnt, p, pal, buf, vplc, vinc);
|
|
|
|
return;
|
2014-10-25 03:29:21 +00:00
|
|
|
}
|
2014-11-22 18:37:23 +00:00
|
|
|
#else
|
|
|
|
assert(logy);
|
|
|
|
#endif
|
|
|
|
|
2014-10-25 03:29:21 +00:00
|
|
|
// just fucking shoot me
|
|
|
|
#ifdef CLASSIC_SLICE_BY_4
|
|
|
|
for (; cnt>=4;cnt-=4)
|
|
|
|
{
|
|
|
|
p[0] = pal[0][buf[0][ vplc[0]>>logy ]];
|
|
|
|
p[1] = pal[1][buf[1][ vplc[1]>>logy ]];
|
|
|
|
p[2] = pal[2][buf[2][ vplc[2]>>logy ]];
|
|
|
|
p[3] = pal[3][buf[3][ vplc[3]>>logy ]];
|
|
|
|
(p+ourbpl)[0] = pal[0][buf[0][ (vplc[0]+vinc[0])>>logy ]];
|
|
|
|
(p+ourbpl)[1] = pal[1][buf[1][ (vplc[1]+vinc[1])>>logy ]];
|
|
|
|
(p+ourbpl)[2] = pal[2][buf[2][ (vplc[2]+vinc[2])>>logy ]];
|
|
|
|
(p+ourbpl)[3] = pal[3][buf[3][ (vplc[3]+vinc[3])>>logy ]];
|
|
|
|
(p+(ourbpl<<1))[0] = pal[0][buf[0][ (vplc[0]+(vinc[0]<<1))>>logy ]];
|
|
|
|
(p+(ourbpl<<1))[1] = pal[1][buf[1][ (vplc[1]+(vinc[1]<<1))>>logy ]];
|
|
|
|
(p+(ourbpl<<1))[2] = pal[2][buf[2][ (vplc[2]+(vinc[2]<<1))>>logy ]];
|
|
|
|
(p+(ourbpl<<1))[3] = pal[3][buf[3][ (vplc[3]+(vinc[3]<<1))>>logy ]];
|
|
|
|
(p+(ourbpl*3))[0] = pal[0][buf[0][ (vplc[0]+(vinc[0]*3))>>logy ]];
|
|
|
|
(p+(ourbpl*3))[1] = pal[1][buf[1][ (vplc[1]+(vinc[1]*3))>>logy ]];
|
|
|
|
(p+(ourbpl*3))[2] = pal[2][buf[2][ (vplc[2]+(vinc[2]*3))>>logy ]];
|
|
|
|
(p+(ourbpl*3))[3] = pal[3][buf[3][ (vplc[3]+(vinc[3]*3))>>logy ]];
|
|
|
|
|
|
|
|
#if defined USE_VECTOR_EXT
|
|
|
|
vplc += vinc<<2;
|
|
|
|
#else
|
|
|
|
vplc[0] += vinc[0]<<2;
|
|
|
|
vplc[1] += vinc[1]<<2;
|
|
|
|
vplc[2] += vinc[2]<<2;
|
|
|
|
vplc[3] += vinc[3]<<2;
|
|
|
|
#endif
|
|
|
|
p += ourbpl<<2;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
while (cnt--)
|
|
|
|
{
|
|
|
|
p[0] = pal[0][buf[0][vplc[0]>>logy]];
|
|
|
|
p[1] = pal[1][buf[1][vplc[1]>>logy]];
|
|
|
|
p[2] = pal[2][buf[2][vplc[2]>>logy]];
|
|
|
|
p[3] = pal[3][buf[3][vplc[3]>>logy]];
|
|
|
|
|
|
|
|
#if defined USE_VECTOR_EXT
|
2013-11-16 18:47:07 +00:00
|
|
|
vplc += vinc;
|
2014-10-25 03:29:21 +00:00
|
|
|
#else
|
|
|
|
vplc[0] += vinc[0];
|
|
|
|
vplc[1] += vinc[1];
|
|
|
|
vplc[2] += vinc[2];
|
|
|
|
vplc[3] += vinc[3];
|
2013-11-16 18:47:07 +00:00
|
|
|
#endif
|
2012-03-18 23:16:57 +00:00
|
|
|
p += ourbpl;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:30:38 +00:00
|
|
|
Bmemcpy(&vplce[0], &vplc[0], sizeof(uint32_t) * 4);
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2013-11-16 18:47:11 +00:00
|
|
|
#ifdef USE_SATURATE_VPLC
|
|
|
|
static int32_t g_saturate; // -1 if saturating vplc is requested, 0 else
|
|
|
|
# define set_saturate(dosaturate) g_saturate = -!!dosaturate
|
|
|
|
#else
|
|
|
|
# define set_saturate(dosaturate) UNREFERENCED_PARAMETER(dosaturate)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void setupmvlineasm(int32_t neglogy, int32_t dosaturate)
|
|
|
|
{
|
|
|
|
glogy = neglogy;
|
|
|
|
set_saturate(dosaturate);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2014-10-29 17:06:43 +00:00
|
|
|
const char *const A_C_RESTRICT buf = (char *)bufplc;
|
|
|
|
const char *const A_C_RESTRICT pal = (char *)paloffs;
|
2012-03-04 20:12:30 +00:00
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
|
|
|
char *pp = (char *)p;
|
|
|
|
|
|
|
|
cnt++;
|
|
|
|
|
2014-10-25 03:29:21 +00:00
|
|
|
if (!logy)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ch = buf[ourmulscale32(vplc,globaltilesizy)];
|
|
|
|
if (ch != 255) *pp = pal[ch];
|
|
|
|
pp += ourbpl;
|
|
|
|
vplc += vinc;
|
|
|
|
saturate_vplc(vplc, vinc);
|
|
|
|
}
|
|
|
|
while (--cnt);
|
|
|
|
|
|
|
|
return vplc;
|
|
|
|
}
|
|
|
|
|
2012-03-04 20:12:30 +00:00
|
|
|
do
|
2006-04-24 19:04:22 +00:00
|
|
|
{
|
2014-10-25 03:29:21 +00:00
|
|
|
|
|
|
|
if (buf[vplc>>logy] != 255)
|
|
|
|
*pp = pal[buf[vplc>>logy]];
|
2012-03-04 20:12:30 +00:00
|
|
|
pp += ourbpl;
|
2006-04-24 19:04:22 +00:00
|
|
|
vplc += vinc;
|
2013-11-16 18:47:11 +00:00
|
|
|
saturate_vplc(vplc, vinc);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
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)
|
|
|
|
{
|
2014-10-29 17:06:43 +00:00
|
|
|
char *const A_C_RESTRICT pal[4] = {(char *)palookupoffse[0], (char *)palookupoffse[1], (char *)palookupoffse[2], (char *)palookupoffse[3]};
|
|
|
|
char *const A_C_RESTRICT buf[4] = {(char *)bufplce[0], (char *)bufplce[1], (char *)bufplce[2], (char *)bufplce[3]};
|
2013-11-16 18:47:07 +00:00
|
|
|
#ifdef USE_VECTOR_EXT
|
2014-12-01 19:52:08 +00:00
|
|
|
uint32_vec4 vinc = {(uint32_t)vince[0], (uint32_t)vince[1], (uint32_t)vince[2], (uint32_t)vince[3]};
|
2013-11-16 18:47:07 +00:00
|
|
|
uint32_vec4 vplc = {vplce[0], vplce[1], vplce[2], vplce[3]};
|
|
|
|
#else
|
2012-03-18 23:16:57 +00:00
|
|
|
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]};
|
2013-11-16 18:47:07 +00:00
|
|
|
#endif
|
2012-03-18 23:16:57 +00:00
|
|
|
const int32_t logy = glogy, ourbpl = bpl;
|
2014-10-25 03:29:21 +00:00
|
|
|
char ch;
|
2012-03-18 23:16:57 +00:00
|
|
|
|
2014-10-25 03:29:21 +00:00
|
|
|
if (logy)
|
2012-03-18 23:16:57 +00:00
|
|
|
{
|
2014-10-25 03:29:21 +00:00
|
|
|
do
|
2012-03-18 23:16:57 +00:00
|
|
|
{
|
2014-10-25 03:29:21 +00:00
|
|
|
ch = buf[0][vplc[0]>>logy];
|
|
|
|
if (ch != 255) p[0] = pal[0][ch];
|
|
|
|
ch = buf[1][vplc[1]>>logy];
|
|
|
|
if (ch != 255) p[1] = pal[1][ch];
|
|
|
|
ch = buf[2][vplc[2]>>logy];
|
|
|
|
if (ch != 255) p[2] = pal[2][ch];
|
|
|
|
ch = buf[3][vplc[3]>>logy];
|
|
|
|
if (ch != 255) p[3] = pal[3][ch];
|
|
|
|
|
2013-11-16 18:47:07 +00:00
|
|
|
#if !defined USE_VECTOR_EXT
|
2014-10-25 03:29:21 +00:00
|
|
|
vplc[0] += vinc[0];
|
|
|
|
vplc[1] += vinc[1];
|
|
|
|
vplc[2] += vinc[2];
|
|
|
|
vplc[3] += vinc[3];
|
|
|
|
saturate_vplc(vplc[0], vinc[0]);
|
|
|
|
saturate_vplc(vplc[1], vinc[1]);
|
|
|
|
saturate_vplc(vplc[2], vinc[2]);
|
|
|
|
saturate_vplc(vplc[3], vinc[3]);
|
|
|
|
#else
|
|
|
|
vplc += vinc;
|
|
|
|
saturate_vplc_vec(vplc, vinc);
|
2013-11-16 18:47:07 +00:00
|
|
|
#endif
|
2014-10-25 03:29:21 +00:00
|
|
|
p += ourbpl;
|
2012-03-18 23:16:57 +00:00
|
|
|
}
|
2014-10-25 03:29:21 +00:00
|
|
|
while (--cnt);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ch = buf[0][ourmulscale32(vplc[0],globaltilesizy)];
|
|
|
|
if (ch != 255) p[0] = pal[0][ch];
|
|
|
|
ch = buf[1][ourmulscale32(vplc[1],globaltilesizy)];
|
|
|
|
if (ch != 255) p[1] = pal[1][ch];
|
|
|
|
ch = buf[2][ourmulscale32(vplc[2],globaltilesizy)];
|
|
|
|
if (ch != 255) p[2] = pal[2][ch];
|
|
|
|
ch = buf[3][ourmulscale32(vplc[3],globaltilesizy)];
|
|
|
|
if (ch != 255) p[3] = pal[3][ch];
|
|
|
|
|
|
|
|
#if !defined USE_VECTOR_EXT
|
|
|
|
vplc[0] += vinc[0];
|
|
|
|
vplc[1] += vinc[1];
|
|
|
|
vplc[2] += vinc[2];
|
|
|
|
vplc[3] += vinc[3];
|
|
|
|
saturate_vplc(vplc[0], vinc[0]);
|
|
|
|
saturate_vplc(vplc[1], vinc[1]);
|
|
|
|
saturate_vplc(vplc[2], vinc[2]);
|
|
|
|
saturate_vplc(vplc[3], vinc[3]);
|
|
|
|
#else
|
|
|
|
vplc += vinc;
|
|
|
|
saturate_vplc_vec(vplc, vinc);
|
2013-11-16 18:47:07 +00:00
|
|
|
#endif
|
2014-10-25 03:29:21 +00:00
|
|
|
p += ourbpl;
|
|
|
|
}
|
|
|
|
while (--cnt);
|
2012-03-18 23:16:57 +00:00
|
|
|
}
|
|
|
|
|
2014-10-25 03:30:38 +00:00
|
|
|
Bmemcpy(&vplce[0], &vplc[0], sizeof(uint32_t) * 4);
|
2012-03-18 23:16:57 +00:00
|
|
|
}
|
|
|
|
|
2013-09-21 13:37:31 +00:00
|
|
|
#ifdef USE_ASM64
|
|
|
|
# define GLOGY a64_glogy
|
|
|
|
#else
|
|
|
|
# define GLOGY glogy
|
|
|
|
#endif
|
|
|
|
|
2013-11-16 18:47:11 +00:00
|
|
|
void setuptvlineasm(int32_t neglogy, int32_t dosaturate)
|
2013-09-21 13:37:31 +00:00
|
|
|
{
|
|
|
|
GLOGY = neglogy;
|
2013-11-16 18:47:11 +00:00
|
|
|
set_saturate(dosaturate);
|
2013-09-21 13:37:31 +00:00
|
|
|
}
|
2012-03-18 23:16:57 +00:00
|
|
|
|
2013-09-21 13:37:31 +00:00
|
|
|
#if !defined USE_ASM64
|
2012-03-04 20:12:30 +00:00
|
|
|
// cnt+1 loop iterations!
|
2012-03-18 23:17:17 +00:00
|
|
|
int32_t 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;
|
|
|
|
|
2014-10-29 17:06:43 +00:00
|
|
|
const char *const A_C_RESTRICT buf = (char *)bufplc;
|
|
|
|
const char *const A_C_RESTRICT pal = (char *)paloffs;
|
|
|
|
const char *const A_C_RESTRICT trans = (char *)gtrans;
|
2012-03-04 20:12:30 +00:00
|
|
|
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-07-06 11:26:24 +00:00
|
|
|
ch = getpix(logy, buf, vplc);
|
2014-10-25 03:29:21 +00:00
|
|
|
if (ch != 255)
|
|
|
|
*pp = trans[(*pp)|(pal[ch]<<8)];
|
2012-03-04 20:12:30 +00:00
|
|
|
pp += ourbpl;
|
2006-04-24 19:04:22 +00:00
|
|
|
vplc += vinc;
|
2013-11-16 18:47:11 +00:00
|
|
|
saturate_vplc_trans(vplc, vinc);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
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-07-06 11:26:24 +00:00
|
|
|
ch = getpix(logy, buf, vplc);
|
2012-03-04 20:12:30 +00:00
|
|
|
if (ch != 255) *pp = trans[((*pp)<<8)|pal[ch]];
|
|
|
|
pp += ourbpl;
|
2006-04-24 19:04:22 +00:00
|
|
|
vplc += vinc;
|
2013-11-16 18:47:11 +00:00
|
|
|
saturate_vplc_trans(vplc, vinc);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2012-03-04 20:12:30 +00:00
|
|
|
while (--cnt);
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2012-03-18 23:17:17 +00:00
|
|
|
|
|
|
|
return vplc;
|
|
|
|
}
|
2013-09-21 13:37:31 +00:00
|
|
|
#endif
|
2012-03-18 23:17:17 +00:00
|
|
|
|
|
|
|
void setuptvlineasm2(int32_t neglogy, intptr_t paloffs1, intptr_t paloffs2)
|
|
|
|
{
|
2013-09-21 13:37:31 +00:00
|
|
|
GLOGY = neglogy;
|
|
|
|
A64_ASSIGN(a64_paloffs, paloffs1);
|
2012-03-18 23:17:17 +00:00
|
|
|
gpal = (char *)paloffs1;
|
|
|
|
gpal2 = (char *)paloffs2;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
2013-09-21 13:37:31 +00:00
|
|
|
|
|
|
|
#if !defined USE_ASM64
|
2012-03-18 23:17:17 +00:00
|
|
|
// Pass: asm1=vinc2, asm2=pend
|
|
|
|
// Return: asm1=vplc1, asm2=vplc2
|
|
|
|
void tvlineasm2(uint32_t vplc2, int32_t vinc1, intptr_t bufplc1, intptr_t bufplc2, uint32_t vplc1, intptr_t p)
|
|
|
|
{
|
|
|
|
char ch;
|
|
|
|
|
2014-10-25 03:29:21 +00:00
|
|
|
int32_t cnt = tabledivide32(asm2-p-1, bpl); // >= 1
|
2012-03-18 23:17:17 +00:00
|
|
|
const int32_t vinc2 = asm1;
|
|
|
|
|
2014-10-29 17:06:43 +00:00
|
|
|
const char *const A_C_RESTRICT buf1 = (char *)bufplc1;
|
|
|
|
const char *const A_C_RESTRICT buf2 = (char *)bufplc2;
|
2012-03-18 23:17:17 +00:00
|
|
|
const int32_t logy = glogy, ourbpl = bpl, transm = transmode;
|
|
|
|
|
|
|
|
char *pp = (char *)p;
|
|
|
|
|
|
|
|
cnt++;
|
|
|
|
|
|
|
|
if (transm)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2012-07-06 11:26:24 +00:00
|
|
|
ch = getpix(logy, buf1, vplc1);
|
2012-03-18 23:17:17 +00:00
|
|
|
if (ch != 255) pp[0] = gtrans[pp[0]|(gpal[ch]<<8)];
|
|
|
|
vplc1 += vinc1;
|
2013-11-16 18:47:11 +00:00
|
|
|
saturate_vplc_trans(vplc1, vinc1);
|
2012-03-18 23:17:17 +00:00
|
|
|
|
2012-07-06 11:26:24 +00:00
|
|
|
ch = getpix(logy, buf2, vplc2);
|
2012-03-18 23:17:17 +00:00
|
|
|
if (ch != 255) pp[1] = gtrans[pp[1]|(gpal2[ch]<<8)];
|
|
|
|
vplc2 += vinc2;
|
2013-11-16 18:47:11 +00:00
|
|
|
saturate_vplc_trans(vplc2, vinc2);
|
2012-03-18 23:17:17 +00:00
|
|
|
|
|
|
|
pp += ourbpl;
|
|
|
|
}
|
|
|
|
while (--cnt > 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2012-07-06 11:26:24 +00:00
|
|
|
ch = getpix(logy, buf1, vplc1);
|
2012-03-18 23:17:17 +00:00
|
|
|
if (ch != 255) pp[0] = gtrans[(pp[0]<<8)|gpal[ch]];
|
|
|
|
vplc1 += vinc1;
|
2013-11-16 18:47:11 +00:00
|
|
|
saturate_vplc_trans(vplc1, vinc1);
|
2012-03-18 23:17:17 +00:00
|
|
|
|
2012-07-06 11:26:24 +00:00
|
|
|
ch = getpix(logy, buf2, vplc2);
|
2012-03-18 23:17:17 +00:00
|
|
|
if (ch != 255) pp[1] = gtrans[(pp[1]<<8)|gpal2[ch]];
|
|
|
|
vplc2 += vinc2;
|
2013-11-16 18:47:11 +00:00
|
|
|
saturate_vplc_trans(vplc2, vinc2);
|
2012-03-18 23:17:17 +00:00
|
|
|
|
|
|
|
pp += ourbpl;
|
|
|
|
}
|
|
|
|
while (--cnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
asm1 = vplc1;
|
|
|
|
asm2 = vplc2;
|
|
|
|
}
|
2013-09-21 13:37:31 +00:00
|
|
|
#endif
|
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)];
|
2014-10-25 03:29:21 +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)];
|
2014-10-25 03:29:21 +00:00
|
|
|
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
|
2006-04-24 19:04:22 +00:00
|
|
|
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)
|
|
|
|
{
|
2012-05-01 12:37:32 +00:00
|
|
|
char c = gpal[(int32_t)(*(char *)((v>>16)+vptr))];
|
|
|
|
for (x=0; x < dx; x++)
|
|
|
|
((char*)p)[x] = c;
|
|
|
|
p += bpl;
|
|
|
|
v += vi;
|
|
|
|
dy--;
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
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:
|
|
|
|
*/
|
|
|
|
|