mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- cleanup of 'gotpic' handling.
This commit is contained in:
parent
e74aca291c
commit
e40ed2262e
13 changed files with 40 additions and 117 deletions
|
@ -719,6 +719,10 @@ set( NOT_COMPILED_SOURCE_FILES
|
|||
zcc-parse.h
|
||||
common/platform/win32/zutil.natvis
|
||||
|
||||
games/blood/src/_polymost.cpp
|
||||
games/duke/src/_polymost.cpp
|
||||
games/sw/src/_polymost.cpp
|
||||
|
||||
# Blood
|
||||
games/blood/src/actor.cpp
|
||||
games/blood/src/ai.cpp
|
||||
|
|
|
@ -729,6 +729,17 @@ inline void setgotpic(int32_t tilenume)
|
|||
gotpic[tilenume >> 3] |= 1 << (tilenume & 7);
|
||||
}
|
||||
|
||||
inline void cleargotpic(int32_t tilenume)
|
||||
{
|
||||
gotpic[tilenume >> 3] &= ~(1 << (tilenume & 7));
|
||||
}
|
||||
|
||||
inline bool testgotpic(int32_t tilenume, bool reset = false)
|
||||
{
|
||||
bool res = gotpic[tilenume >> 3] & (1 << (tilenume & 7));
|
||||
if (reset) gotpic[tilenume >> 3] &= ~(1 << (tilenume & 7));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
#include "iterators.h"
|
||||
|
|
|
@ -110,7 +110,7 @@ void processSpritesOnOtherSideOfPortal(int x, int y, int interpolation)
|
|||
for (int i = mirrorcnt-1; i >= 0; i--)
|
||||
{
|
||||
int nTile = 4080+i;
|
||||
if (TestBitString(gotpic, nTile))
|
||||
if (testgotpic(nTile))
|
||||
{
|
||||
if (mirror[i].type == 1 || mirror[i].type == 2)
|
||||
{
|
||||
|
@ -144,9 +144,9 @@ void render3DViewPolymost(int nSectnum, int cX, int cY, int cZ, binangle cA, fix
|
|||
}
|
||||
cH = q16horiz(ClipRange(cH.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
RORHACK:
|
||||
int ror_status[16];
|
||||
bool ror_status[16];
|
||||
for (int i = 0; i < 16; i++)
|
||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||
ror_status[i] = testgotpic(4080 + i);
|
||||
fixed_t deliriumPitchI = interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
||||
DrawMirrors(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, gInterpolate, gViewIndex);
|
||||
int bakCstat = gView->pSprite->cstat;
|
||||
|
@ -163,7 +163,7 @@ RORHACK:
|
|||
viewProcessSprites(pm_tsprite, pm_spritesortcnt, cX, cY, cZ, cA.asbuild(), gInterpolate);
|
||||
bool do_ror_hack = false;
|
||||
for (int i = 0; i < 16; i++)
|
||||
if (ror_status[i] != TestBitString(gotpic, 4080 + i))
|
||||
if (ror_status[i] != testgotpic(4080 + i))
|
||||
do_ror_hack = true;
|
||||
if (do_ror_hack)
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ void setPortalFlags(char mode)
|
|||
for (int i = mirrorcnt - 1; i >= 0; i--)
|
||||
{
|
||||
int nTile = 4080 + i;
|
||||
if (TestBitString(gotpic, nTile))
|
||||
if (testgotpic(nTile))
|
||||
{
|
||||
switch (mirror[i].type)
|
||||
{
|
||||
|
@ -215,9 +215,8 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
for (int i = mirrorcnt - 1; i >= 0; i--)
|
||||
{
|
||||
int nTile = 4080 + i;
|
||||
if (TestBitString(gotpic, nTile))
|
||||
if (testgotpic(nTile, true))
|
||||
{
|
||||
ClearBitString(gotpic, nTile);
|
||||
switch (mirror[i].type)
|
||||
{
|
||||
case 0:
|
||||
|
@ -287,7 +286,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
renderDrawMasks();
|
||||
sector[nSector].floorstat = fstat;
|
||||
for (int i = 0; i < 16; i++)
|
||||
ClearBitString(gotpic, 4080 + i);
|
||||
cleargotpic(4080 + i);
|
||||
if (viewPlayer >= 0)
|
||||
{
|
||||
gPlayer[viewPlayer].pSprite->cstat = bakCstat;
|
||||
|
@ -319,7 +318,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
renderDrawMasks();
|
||||
sector[nSector].ceilingstat = cstat;
|
||||
for (int i = 0; i < 16; i++)
|
||||
ClearBitString(gotpic, 4080 + i);
|
||||
cleargotpic(4080 + i);
|
||||
if (viewPlayer >= 0)
|
||||
{
|
||||
gPlayer[viewPlayer].pSprite->cstat = bakCstat;
|
||||
|
|
|
@ -4969,11 +4969,11 @@ void MoveDude(spritetype *pSprite)
|
|||
switch (nLink) {
|
||||
case kMarkerLowStack:
|
||||
if (pPlayer == gView)
|
||||
SetBitString(gotpic, sector[pSprite->sectnum].floorpicnum);
|
||||
setgotpic(sector[pSprite->sectnum].floorpicnum);
|
||||
break;
|
||||
case kMarkerUpStack:
|
||||
if (pPlayer == gView)
|
||||
SetBitString(gotpic, sector[pSprite->sectnum].ceilingpicnum);
|
||||
setgotpic(sector[pSprite->sectnum].ceilingpicnum);
|
||||
break;
|
||||
case kMarkerLowWater:
|
||||
case kMarkerLowGoo:
|
||||
|
|
|
@ -340,8 +340,6 @@ void UpdateBlend()
|
|||
videoTintBlood(nRed, nGreen, nBlue);
|
||||
}
|
||||
|
||||
uint8_t otherMirrorGotpic[2];
|
||||
uint8_t bakMirrorGotpic[2];
|
||||
// int gVisibility;
|
||||
|
||||
int deliriumTilt, deliriumTurn, deliriumPitch;
|
||||
|
@ -542,7 +540,6 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSe
|
|||
void renderCrystalBall()
|
||||
{
|
||||
#if 0
|
||||
// needs to be redone for pure hardware rendering when MP is working again.
|
||||
int tmp = (PlayClock / 240) % (gNetPlayers - 1);
|
||||
int i = connecthead;
|
||||
while (1)
|
||||
|
@ -593,37 +590,7 @@ void renderCrystalBall()
|
|||
{
|
||||
v14 = 10;
|
||||
}
|
||||
memcpy(bakMirrorGotpic, gotpic + 510, 2);
|
||||
memcpy(gotpic + 510, otherMirrorGotpic, 2);
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * pOther->visibility, 0));
|
||||
int vc4, vc8;
|
||||
getzsofslope(vcc, vd8, vd4, &vc8, &vc4);
|
||||
if (vd0 >= vc4)
|
||||
{
|
||||
vd0 = vc4 - (gUpperLink[vcc] >= 0 ? 0 : (8 << 8));
|
||||
}
|
||||
if (vd0 <= vc8)
|
||||
{
|
||||
vd0 = vc8 + (gLowerLink[vcc] >= 0 ? 0 : (8 << 8));
|
||||
}
|
||||
v54 = ClipRange(v54, -200, 200);
|
||||
RORHACKOTHER:
|
||||
int ror_status[16];
|
||||
for (int i = 0; i < 16; i++)
|
||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||
DrawMirrors(vd8, vd4, vd0, IntToFixed(v50), IntToFixed(v54), gInterpolate, -1);
|
||||
drawrooms(vd8, vd4, vd0, v50, v54, vcc);
|
||||
bool do_ror_hack = false;
|
||||
for (int i = 0; i < 16; i++)
|
||||
if (ror_status[i] != TestBitString(gotpic, 4080 + i))
|
||||
do_ror_hack = true;
|
||||
if (do_ror_hack)
|
||||
{
|
||||
spritesortcnt = 0;
|
||||
goto RORHACKOTHER;
|
||||
}
|
||||
memcpy(otherMirrorGotpic, gotpic + 510, 2);
|
||||
memcpy(gotpic + 510, bakMirrorGotpic, 2);
|
||||
viewProcessSprites(vd8, vd4, vd0, v50, gInterpolate);
|
||||
renderDrawMasks();
|
||||
renderRestoreTarget();
|
||||
|
@ -636,10 +603,9 @@ void viewDrawScreen(bool sceneonly)
|
|||
{
|
||||
int nPalette = 0;
|
||||
|
||||
if (TestBitString(gotpic, 2342))
|
||||
if (testgotpic(2342, true))
|
||||
{
|
||||
FireProcess();
|
||||
ClearBitString(gotpic, 2342);
|
||||
}
|
||||
|
||||
if (!paused && (!M_Active() || gGameOptions.nGameType != 0))
|
||||
|
|
|
@ -15,8 +15,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
|
|||
|
||||
i = FOF; //Effect TILE
|
||||
tileDelete(FOF);
|
||||
if (!(gotpic[i >> 3] & (1 << (i & 7)))) return;
|
||||
gotpic[i >> 3] &= ~(1 << (i & 7));
|
||||
if (!testgotpic(FOF, true)) return;
|
||||
|
||||
floor1 = spr;
|
||||
|
||||
|
@ -165,7 +164,7 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
|
|||
|
||||
void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz choriz, int smoothratio)
|
||||
{
|
||||
if ((gotpic[TILE_MIRROR >> 3] & (1 << (TILE_MIRROR & 7))) > 0)
|
||||
if (testgotpic(TILE_MIRROR, true))
|
||||
{
|
||||
int dst = 0x7fffffff, i = 0;
|
||||
for (int k = 0; k < mirrorcnt; k++)
|
||||
|
@ -194,7 +193,6 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
|
|||
renderCompleteMirror(); //Reverse screen x-wise in this function
|
||||
g_visibility = j;
|
||||
}
|
||||
gotpic[TILE_MIRROR >> 3] &= ~(1 << (TILE_MIRROR & 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -563,9 +563,8 @@ void thunder(void)
|
|||
|
||||
if (!thunderflash)
|
||||
{
|
||||
if ((gotpic[RRTILE2577 >> 3] & (1 << (RRTILE2577 & 7))) > 0)
|
||||
if (testgotpic(RRTILE2577, true))
|
||||
{
|
||||
gotpic[RRTILE2577 >> 3] &= ~(1 << (RRTILE2577 & 7));
|
||||
g_visibility = 256; // this is an engine variable
|
||||
if (krand() > 65000)
|
||||
{
|
||||
|
@ -593,9 +592,8 @@ void thunder(void)
|
|||
}
|
||||
if (!winderflash)
|
||||
{
|
||||
if ((gotpic[RRTILE2562 >> 3] & (1 << (RRTILE2562 & 7))) > 0)
|
||||
if (testgotpic(RRTILE2562, true))
|
||||
{
|
||||
gotpic[RRTILE2562 >> 3] &= ~(1 << (RRTILE2562 & 7));
|
||||
if (krand() > 65000)
|
||||
{
|
||||
winderflash = 1;
|
||||
|
|
|
@ -29,9 +29,8 @@ ViewSectorInScene(short cursectnum, short level)
|
|||
// found a potential match
|
||||
match = sp->lotag;
|
||||
|
||||
if (!PicInView(FAF_MIRROR_PIC, true))
|
||||
if (!testgotpic(FAF_MIRROR_PIC, true))
|
||||
return -1;
|
||||
|
||||
return match;
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short
|
|||
// manually set gotpic
|
||||
if (gotsector[sprite[i].sectnum])
|
||||
{
|
||||
SET_GOTPIC(FAF_MIRROR_PIC);
|
||||
setgotpic(FAF_MIRROR_PIC);
|
||||
}
|
||||
|
||||
if (SPRITE_TAG3(i) == 0)
|
||||
|
@ -195,25 +194,19 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
|
|||
// drift!
|
||||
bool bIsWallMirror = false;
|
||||
|
||||
// WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong
|
||||
longptr = (int *)&gotpic[MIRRORLABEL >> 3];
|
||||
if (longptr && (longptr[0] || longptr[1]))
|
||||
{
|
||||
for (cnt = MAXMIRRORS - 1; cnt >= 0; cnt--)
|
||||
//if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(cnt + CAMSPRITE))
|
||||
if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic)))
|
||||
//if (testgotpic(cnt + MIRRORLABEL) || testgotpic(cnt + CAMSPRITE))
|
||||
if (testgotpic(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && testgotpic(mirror[cnt].campic)))
|
||||
{
|
||||
bIsWallMirror = false;
|
||||
if (TEST_GOTPIC(cnt + MIRRORLABEL))
|
||||
if (testgotpic(cnt + MIRRORLABEL, true))
|
||||
{
|
||||
bIsWallMirror = true;
|
||||
RESET_GOTPIC(cnt + MIRRORLABEL);
|
||||
}
|
||||
//else if (TEST_GOTPIC(cnt + CAMSPRITE))
|
||||
else if ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic))
|
||||
else if ((unsigned)mirror[cnt].campic < MAXTILES && testgotpic(mirror[cnt].campic))
|
||||
{
|
||||
//RESET_GOTPIC(cnt + CAMSPRITE);
|
||||
RESET_GOTPIC(mirror[cnt].campic);
|
||||
cleargotpic(mirror[cnt].campic);
|
||||
}
|
||||
|
||||
mirrorinview = true;
|
||||
|
|
|
@ -478,10 +478,6 @@ BREAK_INFOp SetupWallForBreak(WALLp wallp)
|
|||
{
|
||||
wallp->lotag = TAG_WALL_BREAK;
|
||||
SET(wallp->extra, WALLFX_DONT_STICK);
|
||||
|
||||
// set for cacheing
|
||||
if (break_info->breaknum >= 0)
|
||||
SET_GOTPIC(break_info->breaknum);
|
||||
}
|
||||
|
||||
if (wallp->overpicnum > 0 && TEST(wallp->cstat, CSTAT_WALL_MASKED))
|
||||
|
@ -528,10 +524,6 @@ BREAK_INFOp SetupSpriteForBreak(SPRITEp sp)
|
|||
sp->clipdist = SPRITEp_SIZE_X(sp);
|
||||
|
||||
SET(sp->cstat, CSTAT_SPRITE_BREAKABLE);
|
||||
|
||||
// set for cacheing
|
||||
if (break_info->breaknum >= 0)
|
||||
SET_GOTPIC(break_info->breaknum);
|
||||
}
|
||||
|
||||
return break_info;
|
||||
|
|
|
@ -1365,7 +1365,6 @@ void PreDrawStackedWater(void)
|
|||
|
||||
short ScreenSavePic = false;
|
||||
|
||||
bool PicInView(short, bool);
|
||||
void DoPlayerDiveMeter(PLAYERp pp);
|
||||
|
||||
void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixedhoriz thoriz, int tsectnum);
|
||||
|
@ -1611,20 +1610,6 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
|
||||
if (!ScreenSavePic) UpdatePanel(smoothratio);
|
||||
|
||||
#define SLIME 2305
|
||||
// Only animate lava if its picnum is on screen
|
||||
// gotpic is a bit array where the tile number's bit is set
|
||||
// whenever it is drawn (ceilings, walls, sprites, etc.)
|
||||
#if 0 // This needs a different implementation.
|
||||
if ((gotpic[SLIME >> 3] & (1 << (SLIME & 7))) > 0)
|
||||
{
|
||||
gotpic[SLIME >> 3] &= ~(1 << (SLIME & 7));
|
||||
|
||||
if (waloff[SLIME])
|
||||
movelava((char *) waloff[SLIME]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// if doing a screen save don't need to process the rest
|
||||
if (ScreenSavePic)
|
||||
{
|
||||
|
|
|
@ -354,10 +354,6 @@ inline int SPRITEp_SIZE_BOS(const spritetype* sp)
|
|||
// just determine if the player is moving
|
||||
#define PLAYER_MOVING(pp) ((pp)->xvect|(pp)->yvect)
|
||||
|
||||
#define TEST_GOTPIC(tile_num) (TEST(gotpic[(tile_num) >> 3], 1 << ((tile_num) & 7)))
|
||||
#define RESET_GOTPIC(tile_num) (RESET(gotpic[(tile_num) >> 3], 1 << ((tile_num) & 7)))
|
||||
#define SET_GOTPIC(tile_num) (SET(gotpic[(tile_num) >> 3], 1 << ((tile_num) & 7)))
|
||||
|
||||
#define LOW_TAG(sectnum) ( sector[sectnum].lotag )
|
||||
#define HIGH_TAG(sectnum) ( sector[sectnum].hitag )
|
||||
|
||||
|
|
|
@ -559,9 +559,6 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, double smoothratio)
|
|||
}
|
||||
lastcamclock = camclock;
|
||||
|
||||
// WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong
|
||||
longptr = (int*)&gotpic[MIRRORLABEL >> 3];
|
||||
if (longptr && (longptr[0] || longptr[1]))
|
||||
{
|
||||
uint32_t oscilation_delta = camclock - oscilationclock;
|
||||
oscilation_delta -= oscilation_delta % 4;
|
||||
|
@ -571,11 +568,10 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, double smoothratio)
|
|||
{
|
||||
if (!mirror[cnt].ismagic) continue; // these are definitely not camera textures.
|
||||
|
||||
//if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(cnt + CAMSPRITE))
|
||||
if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic)))
|
||||
if (testgotpic(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && testgotpic(mirror[cnt].campic)))
|
||||
{
|
||||
// Do not change any global state here!
|
||||
bIsWallMirror = !!(TEST_GOTPIC(cnt + MIRRORLABEL));
|
||||
bIsWallMirror = testgotpic(cnt + MIRRORLABEL);
|
||||
dist = 0x7fffffff;
|
||||
|
||||
if (bIsWallMirror)
|
||||
|
|
|
@ -633,21 +633,6 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
}
|
||||
}
|
||||
|
||||
// doesn't work for blank pics
|
||||
bool
|
||||
PicInView(short tile_num, bool reset)
|
||||
{
|
||||
if (TEST(gotpic[tile_num >> 3], 1 << (tile_num & 7)))
|
||||
{
|
||||
if (reset)
|
||||
RESET(gotpic[tile_num >> 3], 1 << (tile_num & 7));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
SetupMirrorTiles(void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue