mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- FindCeilingView, FindFloorView and related things.
This commit is contained in:
parent
db95dc95d1
commit
19f8458f01
5 changed files with 39 additions and 40 deletions
|
@ -1,7 +1,7 @@
|
|||
BEGIN_SW_NS
|
||||
|
||||
bool FindCeilingView(int match, int* x, int* y, int z, int* sectnum);
|
||||
bool FindFloorView(int match, int* x, int* y, int z, int* sectnum);
|
||||
bool FindCeilingView(int match, int* x, int* y, int z, sectortype** sectnum);
|
||||
bool FindFloorView(int match, int* x, int* y, int z, sectortype** sectnum);
|
||||
|
||||
|
||||
int ViewSectorInScene(int cursectnum, int level)
|
||||
|
@ -36,19 +36,19 @@ int ViewSectorInScene(int cursectnum, int level)
|
|||
|
||||
|
||||
|
||||
void DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, int tsectnum)
|
||||
void DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, sectortype* tsect)
|
||||
{
|
||||
save.zcount = 0;
|
||||
|
||||
int match = ViewSectorInScene(tsectnum, VIEW_LEVEL1);
|
||||
int match = ViewSectorInScene(sectnum(tsect), VIEW_LEVEL1);
|
||||
if (match != -1)
|
||||
{
|
||||
FindCeilingView(match, &tx, &ty, tz, &tsectnum);
|
||||
FindCeilingView(match, &tx, &ty, tz, &tsect);
|
||||
|
||||
if (tsectnum < 0)
|
||||
if (tsect == nullptr)
|
||||
return;
|
||||
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false);
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, sectnum(tsect), false);
|
||||
|
||||
// reset Z's
|
||||
for (int i = 0; i < save.zcount; i++)
|
||||
|
@ -65,15 +65,15 @@ void DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz,
|
|||
}
|
||||
else
|
||||
{
|
||||
int match = ViewSectorInScene(tsectnum, VIEW_LEVEL2);
|
||||
int match = ViewSectorInScene(sectnum(tsect), VIEW_LEVEL2);
|
||||
if (match != -1)
|
||||
{
|
||||
FindFloorView(match, &tx, &ty, tz, &tsectnum);
|
||||
FindFloorView(match, &tx, &ty, tz, &tsect);
|
||||
|
||||
if (tsectnum < 0)
|
||||
if (tsect == nullptr)
|
||||
return;
|
||||
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false);
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, sectnum(tsect), false);
|
||||
|
||||
// reset Z's
|
||||
for (int i = 0; i < save.zcount; i++)
|
||||
|
@ -146,12 +146,12 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se
|
|||
}
|
||||
}
|
||||
|
||||
void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixedhoriz thoriz, int tsectnum)
|
||||
void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixedhoriz thoriz, sectortype* tsect)
|
||||
{
|
||||
videoSetCorrectedAspect();
|
||||
renderSetAspect(xs_CRoundToInt(double(viewingrange) * tan(r_fov * (pi::pi() / 360.))), yxaspect);
|
||||
OverlapDraw = true;
|
||||
DrawOverlapRoom(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
|
||||
DrawOverlapRoom(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsect);
|
||||
OverlapDraw = false;
|
||||
|
||||
if (automapMode != am_full)// && !ScreenSavePic)
|
||||
|
@ -164,7 +164,7 @@ void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixe
|
|||
// TODO: This call is redundant if the tiled overhead map is shown, but the
|
||||
// HUD elements should be properly outputted with hardware rendering first.
|
||||
if (!FAF_DebugView)
|
||||
FAF_DrawRooms(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
|
||||
FAF_DrawRooms(tx, ty, tz, tang.asq16(), thoriz.asq16(), sectnum(tsect));
|
||||
|
||||
analyzesprites(pm_tsprite, pm_spritesortcnt, tx, ty, tz, tang.asbuild());
|
||||
post_analyzesprites(pm_tsprite, pm_spritesortcnt);
|
||||
|
|
|
@ -1338,7 +1338,7 @@ short ScreenSavePic = false;
|
|||
|
||||
void DoPlayerDiveMeter(PLAYERp pp);
|
||||
|
||||
void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixedhoriz thoriz, int tsectnum);
|
||||
void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixedhoriz thoriz, sectortype* tsect);
|
||||
|
||||
|
||||
void UpdateWallPortalState()
|
||||
|
@ -1578,7 +1578,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
if (!testnewrenderer)
|
||||
{
|
||||
renderSetRollAngle((float)trotscrnang.asbuildf());
|
||||
polymost_drawscreen(pp, tx, ty, tz, tang, thoriz, tsectnum);
|
||||
polymost_drawscreen(pp, tx, ty, tz, tang, thoriz, pSect);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2057,7 +2057,6 @@ void ScreenCaptureKeys(void); // draw.c
|
|||
|
||||
void computergetinput(int snum,InputPacket *syn); // jplayer.c
|
||||
|
||||
void DrawOverlapRoom(int tx,int ty,int tz,fixed_t tq16ang,fixed_t tq16horiz,short tsectnum); // rooms.c
|
||||
void SetupMirrorTiles(void); // rooms.c
|
||||
bool FAF_Sector(sectortype* sectnum); // rooms.c
|
||||
int GetZadjustment(sectortype* sectnum,short hitag); // rooms.c
|
||||
|
|
|
@ -1746,7 +1746,7 @@ void UpdatePlayerUnderSprite(PLAYERp pp)
|
|||
sp->x = over_sp->x;
|
||||
sp->y = over_sp->y;
|
||||
sp->z = over_sp->z;
|
||||
ChangeActorSect(pp->PlayerUnderActor, over_sp->sectnum);
|
||||
ChangeActorSect(pp->PlayerUnderActor, over_sp->sector());
|
||||
|
||||
SpriteWarpToUnderwater(pp->PlayerUnderActor);
|
||||
|
||||
|
@ -6022,7 +6022,7 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
|
|||
|
||||
pp->posx = sp->x;
|
||||
pp->posy = sp->y;
|
||||
pp->cursectnum = sp->sectnum;
|
||||
pp->setcursector(sp->sector());
|
||||
|
||||
// try to stay in valid area - death sometimes throws you out of the map
|
||||
sectnum = pp->cursectnum;
|
||||
|
@ -6996,7 +6996,7 @@ void PlayerSpawnPosition(PLAYERp pp)
|
|||
pp->posy = pp->oposy = sp->y;
|
||||
pp->posz = pp->oposz = sp->z;
|
||||
pp->angle.ang = pp->angle.oang = buildang(sp->ang);
|
||||
pp->cursectnum = sp->sectnum;
|
||||
pp->setcursector(sp->sector());
|
||||
|
||||
getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz);
|
||||
// if too close to the floor - stand up
|
||||
|
|
|
@ -710,7 +710,7 @@ void GetUpperLowerSector(short match, int x, int y, sectortype** upper, sectorty
|
|||
}
|
||||
}
|
||||
|
||||
bool FindCeilingView(int match, int* x, int* y, int z, int* sectnum)
|
||||
bool FindCeilingView(int match, int* x, int* y, int z, sectortype** sect)
|
||||
{
|
||||
int xoff = 0;
|
||||
int yoff = 0;
|
||||
|
@ -752,18 +752,18 @@ bool FindCeilingView(int match, int* x, int* y, int z, int* sectnum)
|
|||
|
||||
// get new sector
|
||||
GetUpperLowerSector(match, *x, *y, &upper, &lower);
|
||||
*sectnum = ::sectnum(upper);
|
||||
*sect = upper;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*sectnum == -1)
|
||||
if (*sect == nullptr)
|
||||
return false;
|
||||
|
||||
if (!sp || sp->hitag != VIEW_THRU_FLOOR)
|
||||
{
|
||||
*sectnum = -1;
|
||||
*sect = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -805,7 +805,7 @@ bool FindCeilingView(int match, int* x, int* y, int z, int* sectnum)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FindFloorView(int match, int* x, int* y, int z, int* sectnum)
|
||||
bool FindFloorView(int match, int* x, int* y, int z, sectortype** sect)
|
||||
{
|
||||
int xoff = 0;
|
||||
int yoff = 0;
|
||||
|
@ -848,18 +848,18 @@ bool FindFloorView(int match, int* x, int* y, int z, int* sectnum)
|
|||
|
||||
// get new sector
|
||||
GetUpperLowerSector(match, *x, *y, &upper, &lower);
|
||||
*sectnum = ::sectnum(lower);
|
||||
*sect = lower;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*sectnum < 0)
|
||||
if (*sect == nullptr)
|
||||
return false;
|
||||
|
||||
if (!sp || sp->hitag != VIEW_THRU_CEILING)
|
||||
{
|
||||
*sectnum = 0;
|
||||
*sect = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -901,7 +901,7 @@ bool FindFloorView(int match, int* x, int* y, int z, int* sectnum)
|
|||
return true;
|
||||
}
|
||||
|
||||
short FindViewSectorInScene(short cursectnum, short level)
|
||||
short FindViewSectorInScene(sectortype* cursect, short level)
|
||||
{
|
||||
SPRITEp sp;
|
||||
short match;
|
||||
|
@ -913,7 +913,7 @@ short FindViewSectorInScene(short cursectnum, short level)
|
|||
|
||||
if (sp->hitag == level)
|
||||
{
|
||||
if (cursectnum == sp->sectnum)
|
||||
if (cursect == sp->sector())
|
||||
{
|
||||
// ignore case if sprite is pointing up
|
||||
if (sp->ang == 1536)
|
||||
|
@ -1007,16 +1007,16 @@ void CollectPortals()
|
|||
int tx = actor->s().x;
|
||||
int ty = actor->s().y;
|
||||
int tz = actor->s().z;
|
||||
int tsectnum = sec;
|
||||
auto tsect = §or[sec];
|
||||
|
||||
int match = FindViewSectorInScene(tsectnum, VIEW_LEVEL1);
|
||||
int match = FindViewSectorInScene(tsect, VIEW_LEVEL1);
|
||||
if (match != -1)
|
||||
{
|
||||
FindCeilingView(match, &tx, &ty, tz, &tsectnum);
|
||||
if (tsectnum >= 0 && sector[tsectnum].floorpicnum == FAF_MIRROR_PIC)
|
||||
FindCeilingView(match, &tx, &ty, tz, &tsect);
|
||||
if (tsect != nullptr &&tsect->floorpicnum == FAF_MIRROR_PIC)
|
||||
{
|
||||
// got something!
|
||||
fp.othersector = tsectnum;
|
||||
fp.othersector = sectnum(tsect);
|
||||
fp.offset = { tx, ty, tz };
|
||||
fp.offset -= actor->s().pos;
|
||||
goto nextfg;
|
||||
|
@ -1037,16 +1037,16 @@ void CollectPortals()
|
|||
int tx = actor->s().x;
|
||||
int ty = actor->s().y;
|
||||
int tz = actor->s().z;
|
||||
int tsectnum = sec;
|
||||
auto tsect = §or[sec];
|
||||
|
||||
int match = FindViewSectorInScene(tsectnum, VIEW_LEVEL2);
|
||||
int match = FindViewSectorInScene(tsect, VIEW_LEVEL2);
|
||||
if (match != -1)
|
||||
{
|
||||
FindFloorView(match, &tx, &ty, tz, &tsectnum);
|
||||
if (tsectnum >= 0 && sector[tsectnum].ceilingpicnum == FAF_MIRROR_PIC)
|
||||
FindFloorView(match, &tx, &ty, tz, &tsect);
|
||||
if (tsect != nullptr && tsect->ceilingpicnum == FAF_MIRROR_PIC)
|
||||
{
|
||||
// got something!
|
||||
fp.othersector = tsectnum;
|
||||
fp.othersector = sectnum(tsect);
|
||||
fp.offset = { tx, ty, tz };
|
||||
fp.offset -= actor->s().pos;
|
||||
goto nextcg;
|
||||
|
|
Loading…
Reference in a new issue