Mapster32: Fix extended ceiling/floor picnums taking on picnum 0 in Polymer.

The reason was that drawmasks(), which was where the resetting of the fake
RoR textures happened under Polymer, can be called from polymer_displayrooms()
when mirrors are present. I was assuming that drawmasks() was only ever called
after the 'main' drawrooms and that hence the sequence of fake RoR tile tweaking
was set, reset, set, reset, ... which it was not.
Now, do the resetting explicitly after every drawmasks() in the editor.

git-svn-id: https://svn.eduke32.com/eduke32@2350 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-02-16 19:25:42 +00:00
parent 30e16fe7bb
commit 0ef1721955
4 changed files with 37 additions and 14 deletions

View file

@ -116,6 +116,9 @@ int32_t yax_is121(int16_t bunchnum, int16_t getfloor);
extern void M32_DrawRoomsAndMasks(void);
extern void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore); // editor-only
extern void M32_ResetFakeRORTiles(void);
extern int32_t kopen4loadfrommod(const char *filename, char searchfirst);
// set to 1 to enable:

View file

@ -437,6 +437,25 @@ static void m32_keypresscallback(int32_t code, int32_t downp)
VM_OnEvent(EVENT_KEYPRESS, -1);
}
void M32_ResetFakeRORTiles(void)
{
#ifdef POLYMER
# ifdef YAX_ENABLE
// END_TWEAK ceiling/floor fake 'TROR' pics, see BEGIN_TWEAK in engine.c
if (rendmode==4 && showinvisibility)
{
int32_t i;
for (i=0; i<numyaxbunches; i++)
{
yax_tweakpicnums(i, YAX_CEILING, 1);
yax_tweakpicnums(i, YAX_FLOOR, 1);
}
}
# endif
#endif
}
void M32_DrawRoomsAndMasks(void)
{
yax_preparedrawrooms();
@ -445,6 +464,7 @@ void M32_DrawRoomsAndMasks(void)
ExtAnalyzeSprites();
drawmasks();
M32_ResetFakeRORTiles();
#ifdef POLYMER
if (rendmode == 4 && searchit == 2)
@ -453,6 +473,7 @@ void M32_DrawRoomsAndMasks(void)
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
ExtAnalyzeSprites();
drawmasks();
M32_ResetFakeRORTiles();
}
#endif
}

View file

@ -694,13 +694,21 @@ static int yax_cmpbunches(const int16_t *b1, const int16_t *b2)
return (bunchdist[*b2] - bunchdist[*b1]);
}
static void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore)
void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore)
{
// for polymer, this is called before polymer_drawrooms() with restore==0
// and after polymer_drawmasks() with restore==1
static int16_t opicnum[2][MAXSECTORS];
int32_t i, dastat;
static int16_t opicnum[2][MAXSECTORS];
#ifdef DEBUGGINGAIDS
static uint8_t expect_restore[2][YAX_MAXBUNCHES];
// must call this with restore == 0, 1, 0, 1, 0, 1, ...
assert(expect_restore[cf][bunchnum] == restore);
expect_restore[cf][bunchnum] = !expect_restore[cf][bunchnum];
#endif
for (SECTORS_OF_BUNCH(bunchnum, cf, i))
{
@ -8091,7 +8099,7 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
if (rendmode == 4)
{
# ifdef YAX_ENABLE
// BEGIN TWEAK ceiling/floor fake 'TROR' pics
// BEGIN_TWEAK ceiling/floor fake 'TROR' pics, see END_TWEAK in build.c
if (editstatus && showinvisibility)
{
for (i=0; i<numyaxbunches; i++)
@ -8577,17 +8585,6 @@ killsprite:
#ifdef POLYMER
if (rendmode == 4) {
polymer_drawmasks();
# ifdef YAX_ENABLE
// END TWEAK ceiling/floor fake 'TROR' pics
if (editstatus && showinvisibility)
{
for (i=0; i<numyaxbunches; i++)
{
yax_tweakpicnums(i, YAX_CEILING, 1);
yax_tweakpicnums(i, YAX_FLOOR, 1);
}
}
# endif
}
#endif

View file

@ -2887,6 +2887,7 @@ static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,in
drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum);
ExtAnalyzeSprites();
drawmasks();
M32_ResetFakeRORTiles();
if (draw_both)
{
@ -2912,6 +2913,7 @@ static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,in
drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum);
ExtAnalyzeSprites();
drawmasks();
M32_ResetFakeRORTiles();
}
} // end SE40