Fix invisible player on mirror

This commit is contained in:
nukeykt 2019-09-08 23:29:17 +09:00 committed by Christoph Oelckers
parent e8337c783e
commit 8b0fb8dfe2
3 changed files with 38 additions and 4 deletions

View file

@ -340,7 +340,7 @@ void sub_557C4(int x, int y, int interpolation)
}
}
void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth)
void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth, int viewPlayer)
{
if (videoGetRenderMode() == REND_POLYMER)
return;
@ -407,6 +407,19 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth)
r_rorphase = 1;
#endif
int nSector = mirror[i].at4;
int bakCstat;
if (viewPlayer >= 0)
{
bakCstat = gPlayer[viewPlayer].pSprite->cstat;
if (gViewPos == 0)
{
gPlayer[viewPlayer].pSprite->cstat |= 32768;
}
else
{
gPlayer[viewPlayer].pSprite->cstat |= 514;
}
}
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
polymer_setanimatesprites(viewProcessSprites, x+mirror[i].at8, y+mirror[i].atc, z+mirror[i].at10, fix16_to_int(a), smooth);
@ -421,6 +434,10 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth)
sector[nSector].floorstat = fstat;
for (int i = 0; i < 16; i++)
ClearBitString(gotpic, 4080+i);
if (viewPlayer >= 0)
{
gPlayer[viewPlayer].pSprite->cstat = bakCstat;
}
#ifdef USE_OPENGL
r_rorphase = 0;
#endif
@ -432,6 +449,19 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth)
r_rorphase = 1;
#endif
int nSector = mirror[i].at4;
int bakCstat;
if (viewPlayer >= 0)
{
bakCstat = gPlayer[viewPlayer].pSprite->cstat;
if (gViewPos == 0)
{
gPlayer[viewPlayer].pSprite->cstat |= 32768;
}
else
{
gPlayer[viewPlayer].pSprite->cstat |= 514;
}
}
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
polymer_setanimatesprites(viewProcessSprites, x+mirror[i].at8, y+mirror[i].atc, z+mirror[i].at10, fix16_to_int(a), smooth);
@ -446,6 +476,10 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth)
sector[nSector].ceilingstat = cstat;
for (int i = 0; i < 16; i++)
ClearBitString(gotpic, 4080+i);
if (viewPlayer >= 0)
{
gPlayer[viewPlayer].pSprite->cstat = bakCstat;
}
#ifdef USE_OPENGL
r_rorphase = 0;
#endif

View file

@ -25,4 +25,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
void InitMirrors(void);
void sub_5571C(char mode);
void sub_557C4(int x, int y, int interpolation);
void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth);
void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth, int viewPlayer);

View file

@ -3191,7 +3191,7 @@ RORHACKOTHER:
for (int i = 0; i < 16; i++)
ror_status[i] = TestBitString(gotpic, 4080 + i);
yax_preparedrawrooms();
DrawMirrors(vd8, vd4, vd0, fix16_from_int(v50), fix16_from_int(v54 + defaultHoriz), gInterpolate);
DrawMirrors(vd8, vd4, vd0, fix16_from_int(v50), fix16_from_int(v54 + defaultHoriz), gInterpolate, -1);
drawrooms(vd8, vd4, vd0, v50, v54 + defaultHoriz, vcc);
yax_drawrooms(viewProcessSprites, vcc, 0, gInterpolate);
bool do_ror_hack = false;
@ -3267,6 +3267,7 @@ RORHACK:
for (int i = 0; i < 16; i++)
ror_status[i] = TestBitString(gotpic, 4080+i);
fix16_t deliriumPitchI = interpolate(fix16_from_int(deliriumPitchO), fix16_from_int(deliriumPitch), gInterpolate);
DrawMirrors(cX, cY, cZ, cA, q16horiz + fix16_from_int(defaultHoriz) + deliriumPitchI, gInterpolate, gViewIndex);
int bakCstat = gView->pSprite->cstat;
if (gViewPos == 0)
{
@ -3276,7 +3277,6 @@ RORHACK:
{
gView->pSprite->cstat |= 514;
}
DrawMirrors(cX, cY, cZ, cA, q16horiz + fix16_from_int(defaultHoriz) + deliriumPitchI, gInterpolate);
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
polymer_setanimatesprites(viewProcessSprites, cX, cY, cZ, fix16_to_int(cA), gInterpolate);