ref: 76bfa9c2c2f7199eb0dba1426d557a992a745ec5
parent: 7d20ba048e9b9513397d92153a6e665773bd876a
author: Tanguy Fautre <[email protected]>
date: Sat Feb 22 08:46:52 EST 2020
Remove impossible code path and drawing routines.
--- a/Engine/src/draw.c
+++ b/Engine/src/draw.c
@@ -469,128 +469,7 @@
/* --------------- SPRITE RENDERING METHOD (USED TO BE HIGHLY OPTIMIZED ASSEMBLY) ----------------------------*/
-static int32_t spal_eax;
-static int32_t smach_eax;
-static int32_t smach2_eax;
-static int32_t smach5_eax;
-static int32_t smach_ecx;
-void setupspritevline(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
-{
- spal_eax = i1;
- smach_eax = (i5<<16);
- smach2_eax = (i5>>16)+i2;
- smach5_eax = smach2_eax + i4;
- smach_ecx = i3;
-}
-
-void spritevline(int32_t i1, uint32_t i2, int32_t i3, uint32_t i4, uint8_t* source, uint8_t* dest)
-{
-
-
-setup:
-
- i2 += smach_eax;
- i1 = (i1&0xffffff00) | (*source&0xff);
- if ((i2 - smach_eax) > i2)
- source += smach2_eax + 1;
- else
- source += smach2_eax;
-
- while(1) {
-
- i1 = (i1&0xffffff00) | (((uint8_t *)spal_eax)[i1]&0xff);
-
-#if RENDER_LIMIT_PIXELS
- if (pixelsAllowed-- > 0)
-#endif
- *dest = i1;
-
- dest += bytesperline;
-
- i4 += smach_ecx;
- i4--;
- if (!((i4 - smach_ecx) > i4) && i4 != 0)
- goto setup;
-
- if (i4 == 0)
- return;
-
- i2 += smach_eax;
-
- i1 = (i1&0xffffff00) | (*source&0xff);
-
- if ((i2 - smach_eax) > i2)
- source += smach5_eax + 1;
- else
- source += smach5_eax;
- }
-}
-
-
-static int32_t mspal_eax;
-static int32_t msmach_eax;
-static int32_t msmach2_eax;
-static int32_t msmach5_eax;
-static int32_t msmach_ecx;
-void msetupspritevline(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
-{
- mspal_eax = i1;
- msmach_eax = (i5<<16);
- msmach2_eax = (i5>>16)+i2;
- msmach5_eax = smach2_eax + i4;
- msmach_ecx = i3;
-}
-
-
-void mspritevline(int32_t colorIndex, int32_t i2, int32_t i3, int32_t i4, uint8_t * source, uint8_t * dest)
-{
-
-setup:
- i2 += smach_eax;
-
- colorIndex = (colorIndex&0xffffff00) | (*source&0xff);
-
- if ((i2 - smach_eax) > i2)
- source += smach2_eax + 1;
- else
- source += smach2_eax;
-
- while(1){
-
- //Skip transparent pixels (index=255)
- if ((colorIndex&0xff) != 255)
- {
- colorIndex = (colorIndex&0xffffff00) | (((uint8_t *)spal_eax)[colorIndex]&0xff);
-
-#if RENDER_LIMIT_PIXELS
- if (pixelsAllowed-- > 0)
-#endif
- *dest = colorIndex;
- }
-
- dest += bytesperline;
- i4 += smach_ecx;
- i4--;
-
- if (!((i4 - smach_ecx) > i4) && i4 != 0)
- goto setup;
-
- if (i4 == 0)
- return;
-
- i2 += smach_eax;
-
- colorIndex = (colorIndex&0xffffff00) | (*source&0xff);
-
- if ((i2 - smach_eax) > i2)
- source += smach5_eax + 1;
- else
- source += smach5_eax;
- }
-}
-
-
uint8_t * tspal;
uint32_t tsmach_eax1;
uint32_t adder;
@@ -604,7 +483,6 @@
tsmach_eax3 = adder + i4;
tsmach_ecx = i3;
}
-
/*
FCS: Draw a sprite vertical line of pixels.
--- a/Engine/src/draw.h
+++ b/Engine/src/draw.h
@@ -48,10 +48,6 @@
void vlineasm4(int32_t,uint8_t*);
void setupmvlineasm(int32_t);
void mvlineasm4(int32_t,uint8_t*);
-void setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
-void spritevline(int32_t,uint32_t,int32_t,uint32_t,uint8_t*,uint8_t*);
-void msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
-void mspritevline(int32_t,int32_t,int32_t,int32_t,uint8_t *,uint8_t *);
void tsetupspritevline(uint8_t *,int32_t,int32_t,int32_t,int32_t);
void DrawSpriteVerticalLine(int32_t,int32_t,uint32_t,uint8_t* ,uint8_t*);
void mhline(uint8_t *,int32_t,int32_t,int32_t,int32_t,uint8_t*);
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -11,8 +11,6 @@
#include <string.h>
-
-
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@@ -3856,8 +3854,7 @@
xv2 = xv;
yv2 = yv;
}
-
-
+
//Taking care of the Y coordinates.
pvWalls[0].cameraSpaceCoo[0][VEC_Y] = sy - (yv*xoff + xv*yoff);
pvWalls[1].cameraSpaceCoo[0][VEC_Y] = pvWalls[0].cameraSpaceCoo[0][VEC_Y] + yv * tileWidht;
@@ -3907,13 +3904,6 @@
(pvWalls[3].cameraSpaceCoo[0][VEC_X]>i))
return;
-
-
-
-
-
-
-
gx1 = pvWalls[0].cameraSpaceCoo[0][VEC_X];
gy1 = pvWalls[0].cameraSpaceCoo[0][VEC_Y]; /* back up these before clipping */
@@ -4262,22 +4252,12 @@
}
else
{
- if ((dastat&1) == 0)
- {
- if (dastat&64)
- setupspritevline(palookupoffs,(xv>>16)*tileHeight,xv<<16,tileHeight,yv,0L);
- else
- msetupspritevline(palookupoffs,(xv>>16)*tileHeight,xv<<16,tileHeight,yv,0L);
- }
- else
- {
- tsetupspritevline(palookupoffs,(xv>>16)*tileHeight,xv<<16,tileHeight,yv);
+ tsetupspritevline(palookupoffs,(xv>>16)*tileHeight,xv<<16,tileHeight,yv);
- if (dastat&32)
- settrans(TRANS_REVERSE);
- else
- settrans(TRANS_NORMAL);
- }
+ if (dastat&32)
+ settrans(TRANS_REVERSE);
+ else
+ settrans(TRANS_NORMAL);
for(x=x1; x<x2; x++)
{
@@ -4316,18 +4296,9 @@
p = ylookup[y1]+x+frameplace;
- if ((dastat&1) == 0)
- {
- if (dastat&64)
- spritevline(0L,by<<16,y2-y1+1,bx<<16,(bx>>16)*tileHeight+(by>>16)+bufplc,p);
- else
- mspritevline(0L,by<<16,y2-y1+1,bx<<16,(bx>>16)*tileHeight+(by>>16)+bufplc,p);
- }
- else
- {
- DrawSpriteVerticalLine(by<<16,y2-y1+1,bx<<16,(bx>>16)*tileHeight+(by>>16)+bufplc,p);
- transarea += (y2-y1);
- }
+ DrawSpriteVerticalLine(by<<16,y2-y1+1,bx<<16,(bx>>16)*tileHeight+(by>>16)+bufplc,p);
+ transarea += (y2-y1);
+
faketimerhandler();
}
}