- sector[] in render interface

This commit is contained in:
Christoph Oelckers 2021-11-18 19:33:32 +01:00
parent db96e93adc
commit 9b6d6eb7f9
6 changed files with 27 additions and 18 deletions

View file

@ -87,6 +87,13 @@ extern int cameradist, cameraclock;
void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp = false); void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp = false);
bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, int *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio); bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, int *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio);
inline bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, sectortype** psectnum, binangle ang, fixedhoriz horiz, double const smoothratio)
{
int sectnum;
bool res = calcChaseCamPos(px, py, pz, pspr, &sectnum, ang, horiz, smoothratio);
*psectnum = &sector[sectnum];
return res;
}
void PlanesAtPoint(const sectortype* sec, int dax, int day, float* ceilz, float* florz); void PlanesAtPoint(const sectortype* sec, int dax, int day, float* ceilz, float* florz);
inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz) // this is just for warning evasion. inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz) // this is just for warning evasion.

View file

@ -13,6 +13,7 @@ bool System_WantGuiCapture(); // During playing this tells us whether the game m
class FSerializer; class FSerializer;
struct FRenderViewpoint; struct FRenderViewpoint;
struct spritetype; struct spritetype;
struct sectortype;
struct GameStats struct GameStats
{ {
@ -118,7 +119,7 @@ struct GameInterface
virtual void UpdateCameras(double smoothratio) {} virtual void UpdateCameras(double smoothratio) {}
virtual void EnterPortal(spritetype* viewer, int type) {} virtual void EnterPortal(spritetype* viewer, int type) {}
virtual void LeavePortal(spritetype* viewer, int type) {} virtual void LeavePortal(spritetype* viewer, int type) {}
virtual bool GetGeoEffect(GeoEffect* eff, int viewsector) { return false; } virtual bool GetGeoEffect(GeoEffect* eff, sectortype* viewsector) { return false; }
virtual int Voxelize(int sprnum) { return -1; } virtual int Voxelize(int sprnum) { return -1; }
virtual void AddExcludedEpisode(const FString& episode) {} virtual void AddExcludedEpisode(const FString& episode) {}
virtual int GetCurrentSkill() { return -1; } virtual int GetCurrentSkill() { return -1; }

View file

@ -403,7 +403,7 @@ void HWDrawInfo::CreateScene(bool portal)
int drawsect = effsect; int drawsect = effsect;
// RR geometry hack. Ugh... // RR geometry hack. Ugh...
// This just adds to the existing render list, so we must offset the effect areas to the same xy-space as the main one as we cannot change the view matrix. // This just adds to the existing render list, so we must offset the effect areas to the same xy-space as the main one as we cannot change the view matrix.
if (gi->GetGeoEffect(&eff, effsect)) if (gi->GetGeoEffect(&eff, &sector[effsect]))
{ {
ingeo = true; ingeo = true;
geoofs = { (float)eff.geox[0], (float)eff.geoy[0] }; geoofs = { (float)eff.geox[0], (float)eff.geoy[0] };

View file

@ -67,7 +67,7 @@ struct GameInterface : public ::GameInterface
void UpdateCameras(double smoothratio) override; void UpdateCameras(double smoothratio) override;
void EnterPortal(spritetype* viewer, int type) override; void EnterPortal(spritetype* viewer, int type) override;
void LeavePortal(spritetype* viewer, int type) override; void LeavePortal(spritetype* viewer, int type) override;
bool GetGeoEffect(GeoEffect* eff, int viewsector) override; bool GetGeoEffect(GeoEffect* eff, sectortype* viewsector) override;
void AddExcludedEpisode(const FString& episode) override; void AddExcludedEpisode(const FString& episode) override;
int GetCurrentSkill() override; int GetCurrentSkill() override;

View file

@ -117,12 +117,12 @@ void fakedomovethings(void)
actions = syn->actions; actions = syn->actions;
psect = mycursectnum; psect = mycursectnum;
psectlotag = sector[psect].lotag; psectlotag = psect->lotag;
spritebridge = 0; spritebridge = 0;
shrunk = (p->GetActor()->s.yrepeat < (isRR()? 8 : 32)); shrunk = (p->GetActor()->s.yrepeat < (isRR()? 8 : 32));
if( ud.clipping == 0 && ( sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS) ) if( ud.clipping == 0 && ( psect->floorpicnum == MIRROR || psect == nullptr) )
{ {
myx = omyx; myx = omyx;
myy = omyy; myy = omyy;
@ -145,7 +145,7 @@ void fakedomovethings(void)
if(clz.type == kHitSector && psectlotag == 1 && abs(myz-j) > gs.playerheight+(16<<8) ) if(clz.type == kHitSector && psectlotag == 1 && abs(myz-j) > gs.playerheight+(16<<8) )
psectlotag = 0; psectlotag = 0;
if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) ) if( p->aim_mode == 0 && myonground && psectlotag != 2 && (psect->floorstat&2) )
{ {
x = myx + bcos(myang, -5); x = myx + bcos(myang, -5);
y = myy + bsin(myang, -5); y = myy + bsin(myang, -5);
@ -296,7 +296,7 @@ void fakedomovethings(void)
} }
if(myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling if(myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling
{ {
if( (sb_snum&3) == 0 && !(p->OnMotorcycle || p->OnBoat) && myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) ) if( (sb_snum&3) == 0 && !(p->OnMotorcycle || p->OnBoat) && myonground && (psect->floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) )
myz = fz-(i<<8); myz = fz-(i<<8);
else else
{ {

View file

@ -141,9 +141,9 @@ void GameInterface::LeavePortal(spritetype* viewer, int type)
if (type == PORTAL_WALL_MIRROR) display_mirror--; if (type == PORTAL_WALL_MIRROR) display_mirror--;
} }
bool GameInterface::GetGeoEffect(GeoEffect* eff, int viewsector) bool GameInterface::GetGeoEffect(GeoEffect* eff, sectortype* viewsector)
{ {
if (isRR() && sector[viewsector].lotag == 848) if (isRR() && viewsector->lotag == 848)
{ {
eff->geocnt = geocnt; eff->geocnt = geocnt;
eff->geosector = geosector; eff->geosector = geosector;
@ -252,7 +252,6 @@ static int getdrugmode(player_struct *p, int oyrepeat)
void displayrooms(int snum, double smoothratio) void displayrooms(int snum, double smoothratio)
{ {
int cposx, cposy, cposz, fz, cz; int cposx, cposy, cposz, fz, cz;
int sect;
binangle cang, rotscrnang; binangle cang, rotscrnang;
fixedhoriz choriz; fixedhoriz choriz;
struct player_struct* p; struct player_struct* p;
@ -273,8 +272,8 @@ void displayrooms(int snum, double smoothratio)
videoSetCorrectedAspect(); videoSetCorrectedAspect();
sect = p->cursectnum; auto sect = p->cursector();
if (sect < 0 || sect >= MAXSECTORS) return; if (sect == nullptr) return;
GlobalMapFog = fogactive ? 0x999999 : 0; GlobalMapFog = fogactive ? 0x999999 : 0;
GlobalFogDensity = fogactive ? 350.f : 0.f; GlobalFogDensity = fogactive ? 350.f : 0.f;
@ -310,6 +309,7 @@ void displayrooms(int snum, double smoothratio)
// set screen rotation. // set screen rotation.
rotscrnang = !SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio); rotscrnang = !SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio);
#if 0
if ((snum == myconnectindex) && (numplayers > 1)) if ((snum == myconnectindex) && (numplayers > 1))
{ {
cposx = interpolatedvalue(omyx, myx, smoothratio); cposx = interpolatedvalue(omyx, myx, smoothratio);
@ -328,6 +328,7 @@ void displayrooms(int snum, double smoothratio)
sect = mycursectnum; sect = mycursectnum;
} }
else else
#endif
{ {
cposx = interpolatedvalue(p->oposx, p->pos.x, smoothratio); cposx = interpolatedvalue(p->oposx, p->pos.x, smoothratio);
cposy = interpolatedvalue(p->oposy, p->pos.y, smoothratio); cposy = interpolatedvalue(p->oposy, p->pos.y, smoothratio);
@ -355,7 +356,7 @@ void displayrooms(int snum, double smoothratio)
cposx = spr->pos.x; cposx = spr->pos.x;
cposy = spr->pos.y; cposy = spr->pos.y;
cposz = spr->pos.z; cposz = spr->pos.z;
sect = spr->sectnum; sect = spr->sector();
rotscrnang = buildang(0); rotscrnang = buildang(0);
smoothratio = MaxSmoothRatio; smoothratio = MaxSmoothRatio;
viewer = spr; viewer = spr;
@ -394,23 +395,23 @@ void displayrooms(int snum, double smoothratio)
else if (cposz > (p->truefz - (4 << 8))) cposz = fz - (4 << 8); else if (cposz > (p->truefz - (4 << 8))) cposz = fz - (4 << 8);
} }
if (sect >= 0) if (sect)
{ {
getzsofslope(sect, cposx, cposy, &cz, &fz); getzsofslopeptr(sect, cposx, cposy, &cz, &fz);
if (cposz < cz + (4 << 8)) cposz = cz + (4 << 8); if (cposz < cz + (4 << 8)) cposz = cz + (4 << 8);
if (cposz > fz - (4 << 8)) cposz = fz - (4 << 8); if (cposz > fz - (4 << 8)) cposz = fz - (4 << 8);
} }
choriz = clamp(choriz, q16horiz(gi->playerHorizMin()), q16horiz(gi->playerHorizMax())); choriz = clamp(choriz, q16horiz(gi->playerHorizMin()), q16horiz(gi->playerHorizMax()));
if (isRR() && sector[sect].lotag == 848 && !testnewrenderer) if (isRR() && sect->lotag == 848 && !testnewrenderer)
{ {
renderSetRollAngle((float)rotscrnang.asbuildf()); renderSetRollAngle((float)rotscrnang.asbuildf());
geometryEffect(cposx, cposy, cposz, cang, choriz, sect, (int)smoothratio); geometryEffect(cposx, cposy, cposz, cang, choriz, sectnum(sect), (int)smoothratio);
} }
else else
{ {
renderView(viewer, sect, cposx, cposy, cposz, cang, choriz, rotscrnang, (int)smoothratio); renderView(viewer, sectnum(sect), cposx, cposy, cposz, cang, choriz, rotscrnang, (int)smoothratio);
} }
} }
//GLInterface.SetMapFog(false); //GLInterface.SetMapFog(false);