Add a shitty helper function to figure out dimensions for V_LockBlend

This commit is contained in:
James R 2020-01-03 02:25:20 -08:00
parent 1f85e2b70c
commit 1a0a86f557
3 changed files with 85 additions and 0 deletions

View file

@ -640,4 +640,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Render flats on walls
#define WALLFLATS
/* THE CODE IN ST_STUFF SUCKS WTF */
/// Show dimensions of drawing in batched mode
//#define BATCHTEST
#endif // __DOOMDEF__

View file

@ -493,6 +493,51 @@ blending translucent pixels. This is for overlapping translucent drawing.
static UINT8 *v_blendscreen;
#ifdef BATCHTEST
static int v_batchtest;
static int v_batchx1;
static int v_batchx2;
static int v_batchy1;
static int v_batchy2;
void
V_TestBatch (void)
{
v_batchx1 = 0;
v_batchx2 = 0;
v_batchy1 = 0;
v_batchy2 = 0;
v_batchtest = 1;
}
static void
Vstatbatch (int x, int y, int w, int h)
{
switch (v_batchtest)
{
case 1:
v_batchx1 = x;
v_batchx2 = x + w;
v_batchy1 = y;
v_batchy2 = y + h;
v_batchtest = 2;
break;
case 2:
if (x < v_batchx1)
v_batchx1 = x;
if (y < v_batchy1)
v_batchy1 = y;
x = x + w;
if (x > v_batchx2)
v_batchx2 = x;
y = y + h;
if (y > v_batchy2)
v_batchy2 = y;
break;
}
}
#endif/*BATCHTEST*/
void
V_LockBlend (
int x,
@ -531,6 +576,39 @@ V_LockBlend (
void
V_UnlockBlend (void)
{
#ifdef BATCHTEST
int w;
int h;
if (v_batchtest)
{
w = ( v_batchx2 - v_batchx1 );
h = ( v_batchy2 - v_batchy1 );
if (!(
v_batchx1 % vid.dupx ||
w % vid.dupx ||
v_batchy1 % vid.dupy ||
h % vid.dupy )
){
CONS_Printf(
"%dx%d+%d+%d(u)\n",
w / vid.dupx,
h / vid.dupy,
v_batchx1 / vid.dupx,
v_batchy1 / vid.dupy
);
}
else
{
CONS_Printf(
"%dx%d+%d+%d\n",
w,
h,
v_batchx1,
v_batchy1
);
}
}
#endif/*BATCHTEST*/
v_blendscreen = screens[0];
}

View file

@ -246,5 +246,8 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3
void V_LockBlend (int x, int y, int w, int h, int flags);
void V_UnlockBlend (void);
#ifdef BATCHTEST
void V_TestBatch (void);
#endif
#endif