Classic: fix glitches where stuff would be drawn transiently on sect change.

This was introduced with r2771, which fixed e.g. AMC TC city_si's mirrors,
but instructed the base drawrooms inside yax_drawrooms to not correct the
passed sectnum.  Therefore, stuff would get drawn wrongly when passing
sector boundaries, like from the platform to the rails in trueror1.map.

git-svn-id: https://svn.eduke32.com/eduke32@2810 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-07-06 15:36:46 +00:00
parent eae25756a8
commit 6ed9241f0a
5 changed files with 24 additions and 16 deletions

View file

@ -132,12 +132,12 @@ static inline int32_t yax_waltosecmask(int32_t walclipmask)
return ((walclipmask&1)<<9) | ((walclipmask&64)<<5);
}
void yax_preparedrawrooms(void);
void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectnum);
void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectnum, int32_t didmirror);
# define YAX_SKIPSECTOR(i) if (graysectbitmap[(i)>>3]&(1<<((i)&7))) continue
# define YAX_SKIPWALL(i) if (graywallbitmap[(i)>>3]&(1<<((i)&7))) continue
#else
# define yax_preparedrawrooms()
# define yax_drawrooms(ExtAnalyzeSprites, horiz, sectnum)
# define yax_drawrooms(ExtAnalyzeSprites, horiz, sectnum, didmirror)
# define YAX_SKIPSECTOR(i) (i)=(i)
# define YAX_SKIPWALL(i) (i)=(i)
#endif
@ -606,7 +606,7 @@ void setviewback(void);
void preparemirror(int32_t dax, int32_t day, int32_t daz, int16_t daang, int32_t dahoriz, int16_t dawall, int16_t dasector, int32_t *tposx, int32_t *tposy, int16_t *tang);
void completemirror(void);
void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum);
int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum);
void drawmasks(void);
void clearview(int32_t dacol);
void clearallviews(int32_t dacol);

View file

@ -465,7 +465,7 @@ void M32_DrawRoomsAndMasks(void)
{
yax_preparedrawrooms();
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum);
yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum, 0);
ExtAnalyzeSprites();
drawmasks();

View file

@ -838,7 +838,7 @@ void yax_preparedrawrooms(void)
}
}
void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectnum)
void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectnum, int32_t didmirror)
{
static uint8_t havebunch[YAX_MAXBUNCHES>>3];
@ -1071,7 +1071,8 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
scansector_collectsprites = 0;
// draw base level
drawrooms(globalposx,globalposy,globalposz,globalang,horiz,osectnum+MAXSECTORS);
drawrooms(globalposx,globalposy,globalposz,globalang,horiz,
osectnum + MAXSECTORS*didmirror);
// if (scansector_collectsprites)
// spritesortcnt = 0;
yax_copytsprites();
@ -8244,12 +8245,14 @@ void initspritelists(void)
//
// drawrooms
//
void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
int16_t daang, int32_t dahoriz, int16_t dacursectnum)
{
int32_t i, j, /*cz, fz,*/ closest;
int16_t *shortptr1, *shortptr2;
int32_t didmirror = 0;
beforedrawrooms = 0;
indrawroomsandmasks = 1;
@ -8340,14 +8343,14 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
polymer_drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum);
bglDisable(GL_CULL_FACE);
gloy1 = 0;
return;
return 0;
}
# endif
//============================================================================= //POLYMOST BEGINS
polymost_drawrooms();
if (rendmode)
return;
return 0;
//============================================================================= //POLYMOST ENDS
#endif
@ -8400,7 +8403,7 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
if (globalcursectnum<0)
{
enddrawing(); //!!!
return;
return 0;
}
}
/*
@ -8421,10 +8424,11 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
if (numbunches==0)
{
enddrawing(); //!!!
return;
return 0;
}
inpreparemirror = 0;
didmirror = 1;
mirrorsx1 = xdimen-1; mirrorsx2 = 0;
for (i=numscans-1; i>=0; i--)
@ -8484,6 +8488,8 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
}
enddrawing(); //}}}
return didmirror;
}
// UTILITY TYPES AND FUNCTIONS FOR DRAWMASKS OCCLUSION TREE

View file

@ -3385,10 +3385,12 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i
if (getrendermode()==0)
{
int32_t didmirror;
yax_preparedrawrooms();
drawrooms(tposx,tposy,z,tang,horiz,g_mirrorSector[i]+MAXSECTORS);
didmirror = drawrooms(tposx,tposy,z,tang,horiz,g_mirrorSector[i]+MAXSECTORS);
g_yax_smoothratio = smoothratio;
yax_drawrooms(G_AnalyzeSprites, horiz, g_mirrorSector[i]);
yax_drawrooms(G_AnalyzeSprites, horiz, g_mirrorSector[i], didmirror);
}
#ifdef USE_OPENGL
else
@ -3465,7 +3467,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
yax_preparedrawrooms();
drawrooms(s->x,s->y,s->z-(4<<8),ud.cameraang,s->yvel,s->sectnum);
g_yax_smoothratio = smoothratio;
yax_drawrooms(G_AnalyzeSprites, s->yvel, s->sectnum);
yax_drawrooms(G_AnalyzeSprites, s->yvel, s->sectnum, 0);
G_DoSpriteAnimations(s->x,s->y,ud.cameraang,smoothratio);
drawmasks();
}
@ -3679,7 +3681,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
yax_preparedrawrooms();
drawrooms(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,ud.camerasect);
g_yax_smoothratio = smoothratio;
yax_drawrooms(G_AnalyzeSprites, ud.camerahoriz, ud.camerasect);
yax_drawrooms(G_AnalyzeSprites, ud.camerahoriz, ud.camerasect, 0);
// dupe the sprites touching the portal to the other sector

View file

@ -573,7 +573,7 @@ void G_SetupCamTile(int32_t i,int32_t wn)
yax_preparedrawrooms();
drawrooms(SX,SY,SZ,SA,100+sprite[i].shade,SECT);
// g_yax_smoothratio?
yax_drawrooms(G_AnalyzeSprites, 100+sprite[i].shade, SECT);
yax_drawrooms(G_AnalyzeSprites, 100+sprite[i].shade, SECT, 0);
display_mirror = 1;
G_DoSpriteAnimations(SX,SY,SA,65536L);