- also handle SW's voxels.

This commit is contained in:
Christoph Oelckers 2021-04-11 13:38:23 +02:00
parent e5e23cd63c
commit 0ee28fb45e
6 changed files with 12 additions and 9 deletions

View file

@ -2202,7 +2202,7 @@ void polymost_scansector(int32_t sectnum)
{
if ((spr->cstat&(64+48))!=(64+16) ||
(r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) ||
(r_voxels && gi->Voxelize(spr->picnum)) ||
(r_voxels && gi->Voxelize(spr->picnum) > -1) ||
DMulScale(bcos(spr->ang), -s.x, bsin(spr->ang), -s.y, 6) > 0)
if (renderAddTsprite(z, sectnum))
break;

View file

@ -101,7 +101,7 @@ struct GameInterface
virtual int chaseCamX(binangle ang) { return 0; }
virtual int chaseCamY(binangle ang) { return 0; }
virtual int chaseCamZ(fixedhoriz horiz) { return 0; }
virtual bool Voxelize(int sprnum) { return false; }
virtual int Voxelize(int sprnum) { return -1; }
virtual FString statFPS()
{

View file

@ -72,8 +72,9 @@ static void doprecache(int picnum, int palette)
if (r_voxels)
{
int vox = tiletovox[picnum];
if (vox == -1) vox = gi->Voxelize(picnum);
if (vox == -1 && isBlood()) vox = Blood::voxelIndex[picnum];
if (vox != -1 && voxmodels[vox] && voxmodels[vox]->model)
if (vox >= 0 && vox < MAXVOXELS && voxmodels[vox] && voxmodels[vox]->model)
{
FHWModelRenderer mr(*screen->RenderState(), 0);
voxmodels[vox]->model->BuildVertexBuffer(&mr);
@ -127,5 +128,6 @@ void precacheMarkedTiles()
int dapalnum = pair->Key >> 32;
doprecache(dapicnum, dapalnum);
}
cachemap.Clear();
}

View file

@ -2,4 +2,5 @@
void PrecacheHardwareTextures(int nTile);
void markTileForPrecache(int tilenum, int palnum);
void markVoxelForPrecache(int voxnum);
void precacheMarkedTiles();

View file

@ -798,9 +798,9 @@ void GameInterface::FreeLevelData()
::GameInterface::FreeLevelData();
}
bool GameInterface::Voxelize(int sprnum)
int GameInterface::Voxelize(int sprnum)
{
return (aVoxelArray[sprnum].Voxel >= 0);
return (aVoxelArray[sprnum].Voxel);
}
END_SW_NS

View file

@ -2252,10 +2252,10 @@ struct GameInterface : ::GameInterface
void WarpToCoords(int x, int y, int z, int a, int h) override;
void ToggleThirdPerson() override;
void SwitchCoopView() override;
int chaseCamX(binangle ang) { return -ang.bcos(-3); }
int chaseCamY(binangle ang) { return -ang.bsin(-3); }
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 8; }
bool Voxelize(int sprnum);
int chaseCamX(binangle ang) override { return -ang.bcos(-3); }
int chaseCamY(binangle ang) override { return -ang.bsin(-3); }
int chaseCamZ(fixedhoriz horiz) override { return horiz.asq16() >> 8; }
int Voxelize(int sprnum) override;
GameStats getStats() override;