Simplify voxel rotation handling

# Conflicts:
#	source/build/include/mdsprite.h
This commit is contained in:
nukeykt 2019-09-30 15:35:33 +09:00 committed by Christoph Oelckers
parent c00ff59579
commit 61b4fae6e0
6 changed files with 14 additions and 21 deletions

View file

@ -881,7 +881,6 @@ voxmodel_t *voxload(const char *filnam)
vm->siz.x = voxsiz.x; vm->siz.y = voxsiz.y; vm->siz.z = voxsiz.z;
vm->piv.x = voxpiv.x; vm->piv.y = voxpiv.y; vm->piv.z = voxpiv.z;
vm->is8bit = is8bit;
vm->rotate = 0;
vm->texid = (FHardwareTexture * *)Xcalloc(MAXPALOOKUPS, sizeof(FHardwareTexture*));
}
@ -1029,15 +1028,13 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
vec3f_t m0 = { m->scale, m->scale, m->scale };
vec3f_t a0 = { 0, 0, m->zadd*m->scale };
int32_t const rotateang = m->rotate ? (int32_t)totalclocklock<<3 : 0;
k0 = m->bscale / 64.f;
f = (float) tspr->xrepeat * (256.f/320.f) * k0;
if ((sprite[tspr->owner].cstat&48)==16)
{
f *= 1.25f;
a0.y -= tspr->xoffset*sintable[(spriteext[tspr->owner].angoff+rotateang+512)&2047]*(1.f/(64.f*16384.f));
a0.x += tspr->xoffset*sintable[(spriteext[tspr->owner].angoff+rotateang)&2047]*(1.f/(64.f*16384.f));
a0.y -= tspr->xoffset*sintable[(spriteext[tspr->owner].angoff+512)&2047]*(1.f/(64.f*16384.f));
a0.x += tspr->xoffset*sintable[(spriteext[tspr->owner].angoff)&2047]*(1.f/(64.f*16384.f));
}
if (globalorientation&8) { m0.z = -m0.z; a0.z = -a0.z; } //y-flipping
@ -1071,7 +1068,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
m0.z *= g; a0.z = (((float)(k0 -globalposz - shadowHack)) * -(1.f/16384.f) + a0.z) * g;
float mat[16];
md3_vox_calcmat_common(tspr, &a0, f, mat, rotateang);
md3_vox_calcmat_common(tspr, &a0, f, mat);
//Mirrors
if (grhalfxdown10x < 0)