mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- use actors instead of sprites in the new renderer's API.
This commit is contained in:
parent
f602cf3806
commit
09634c4993
14 changed files with 55 additions and 54 deletions
|
@ -1132,7 +1132,7 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
|
|||
TSectIterator<DCoreActor> it(clipsectorlist[i]);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
auto spr = &actor->s();
|
||||
auto spr = &actor->spr;
|
||||
const int32_t cstat = spr->cstat;
|
||||
int32_t daz = 0, daz2 = 0;
|
||||
|
||||
|
@ -1402,7 +1402,7 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
|
|||
TSectIterator<DCoreActor> it(sec);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
auto const spr = &actor->s();
|
||||
auto const spr = &actor->spr;
|
||||
uint32_t const cstat = spr->cstat;
|
||||
|
||||
if (spr->cstat2 & CSTAT2_SPRITE_NOFIND)
|
||||
|
|
|
@ -15,6 +15,7 @@ struct FRenderViewpoint;
|
|||
struct spritetype;
|
||||
struct sectortype;
|
||||
struct tspritetype;
|
||||
class DCoreActor;
|
||||
|
||||
struct GameStats
|
||||
{
|
||||
|
@ -118,8 +119,8 @@ struct GameInterface
|
|||
virtual int chaseCamZ(fixedhoriz horiz) { return 0; }
|
||||
virtual void processSprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) = 0;
|
||||
virtual void UpdateCameras(double smoothratio) {}
|
||||
virtual void EnterPortal(spritetype* viewer, int type) {}
|
||||
virtual void LeavePortal(spritetype* viewer, int type) {}
|
||||
virtual void EnterPortal(DCoreActor* viewer, int type) {}
|
||||
virtual void LeavePortal(DCoreActor* viewer, int type) {}
|
||||
virtual bool GetGeoEffect(GeoEffect* eff, sectortype* viewsector) { return false; }
|
||||
virtual int Voxelize(int sprnum) { return -1; }
|
||||
virtual void AddExcludedEpisode(const FString& episode) {}
|
||||
|
|
|
@ -176,10 +176,10 @@ void RenderViewpoint(FRenderViewpoint& mainvp, IntRect* bounds, float fov, float
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
FRenderViewpoint SetupViewpoint(spritetype* cam, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang)
|
||||
FRenderViewpoint SetupViewpoint(DCoreActor* cam, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang)
|
||||
{
|
||||
FRenderViewpoint r_viewpoint{};
|
||||
r_viewpoint.CameraSprite = cam;
|
||||
r_viewpoint.CameraActor = cam;
|
||||
r_viewpoint.SectNums = nullptr;
|
||||
r_viewpoint.SectCount = sectnum;
|
||||
r_viewpoint.Pos = { position.X / 16.f, position.Y / -16.f, position.Z / -256.f };
|
||||
|
@ -307,7 +307,7 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
|
||||
void animatecamsprite(double s);
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio)
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio)
|
||||
{
|
||||
checkRotatedWalls();
|
||||
|
||||
|
@ -364,7 +364,7 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
|||
All.Unclock();
|
||||
}
|
||||
|
||||
void render_camtex(spritetype* playersprite, const vec3_t& position, sectortype* sect, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
void render_camtex(DCoreActor* playersprite, const vec3_t& position, sectortype* sect, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
{
|
||||
updatesector(position.X, position.Y, §);
|
||||
if (!sect) return;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
class FSerializer;
|
||||
struct IntRect;
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio);
|
||||
void render_camtex(spritetype* playersprite, const vec3_t& position, sectortype* sect, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio);
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio);
|
||||
void render_camtex(DCoreActor* playersprite, const vec3_t& position, sectortype* sect, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio);
|
||||
|
||||
struct PortalDesc
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ class FRenderState;
|
|||
|
||||
struct FRenderViewpoint
|
||||
{
|
||||
spritetype* CameraSprite;
|
||||
DCoreActor* CameraActor;
|
||||
DVector3 Pos;
|
||||
FRotator HWAngles;
|
||||
FAngle FieldOfView;
|
||||
|
|
|
@ -396,9 +396,9 @@ void HWScenePortalBase::DrawContents(HWDrawInfo* di, FRenderState& state)
|
|||
if (Setup(di, state, di->mClipper))
|
||||
{
|
||||
auto type = GetType();
|
||||
gi->EnterPortal(di->Viewpoint.CameraSprite, type);
|
||||
gi->EnterPortal(di->Viewpoint.CameraActor, type);
|
||||
di->DrawScene(DM_PORTAL, type == PORTAL_SECTOR_CEILING);
|
||||
gi->LeavePortal(di->Viewpoint.CameraSprite, type);
|
||||
gi->LeavePortal(di->Viewpoint.CameraActor, type);
|
||||
Shutdown(di, state);
|
||||
}
|
||||
else state.ClearScreen();
|
||||
|
|
|
@ -978,21 +978,21 @@ void GameInterface::processSprites(tspritetype* tsprite, int& spritesortcnt, int
|
|||
|
||||
int display_mirror;
|
||||
|
||||
void GameInterface::EnterPortal(spritetype* viewer, int type)
|
||||
void GameInterface::EnterPortal(DCoreActor* viewer, int type)
|
||||
{
|
||||
if (type == PORTAL_WALL_MIRROR)
|
||||
{
|
||||
display_mirror++;
|
||||
if (viewer) viewer->cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
||||
if (viewer) viewer->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
void GameInterface::LeavePortal(spritetype* viewer, int type)
|
||||
void GameInterface::LeavePortal(DCoreActor* viewer, int type)
|
||||
{
|
||||
if (type == PORTAL_WALL_MIRROR)
|
||||
{
|
||||
display_mirror--;
|
||||
if (viewer && display_mirror == 0 && !(viewer->cstat & CSTAT_SPRITE_TRANSLUCENT)) viewer->cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
if (viewer && display_mirror == 0 && !(viewer->spr.cstat & CSTAT_SPRITE_TRANSLUCENT)) viewer->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,8 +152,8 @@ struct GameInterface : public ::GameInterface
|
|||
int chaseCamY(binangle ang) override { return MulScale(-Sin(ang.asbuild()), 1280, 30); }
|
||||
int chaseCamZ(fixedhoriz horiz) override { return FixedToInt(MulScale(horiz.asq16(), 1280, 3)) - (16 << 8); }
|
||||
void processSprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
||||
void EnterPortal(spritetype* viewer, int type) override;
|
||||
void LeavePortal(spritetype* viewer, int type) override;
|
||||
void EnterPortal(DCoreActor* viewer, int type) override;
|
||||
void LeavePortal(DCoreActor* viewer, int type) override;
|
||||
void LoadGameTextures() override;
|
||||
int GetCurrentSkill() override;
|
||||
bool IsQAVInterpTypeValid(const FString& type) override;
|
||||
|
|
|
@ -671,7 +671,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
fixedhoriz deliriumPitchI = q16horiz(interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate));
|
||||
auto bakCstat = gView->pSprite->cstat;
|
||||
gView->pSprite->cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
render_drawrooms(gView->pSprite, { cX, cY, cZ }, sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
|
||||
render_drawrooms(gView->actor, { cX, cY, cZ }, sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
|
||||
gView->pSprite->cstat = bakCstat;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -62,8 +62,8 @@ struct GameInterface : public ::GameInterface
|
|||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 9; }
|
||||
void processSprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
||||
void UpdateCameras(double smoothratio) override;
|
||||
void EnterPortal(spritetype* viewer, int type) override;
|
||||
void LeavePortal(spritetype* viewer, int type) override;
|
||||
void EnterPortal(DCoreActor* viewer, int type) override;
|
||||
void LeavePortal(DCoreActor* viewer, int type) override;
|
||||
bool GetGeoEffect(GeoEffect* eff, sectortype* viewsector) override;
|
||||
void AddExcludedEpisode(const FString& episode) override;
|
||||
int GetCurrentSkill() override;
|
||||
|
|
|
@ -64,7 +64,7 @@ BEGIN_DUKE_NS
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void renderView(spritetype* playersprite, sectortype* sect, int x, int y, int z, binangle a, fixedhoriz h, binangle rotscrnang, int smoothratio)
|
||||
void renderView(DDukeActor* playersprite, sectortype* sect, int x, int y, int z, binangle a, fixedhoriz h, binangle rotscrnang, int smoothratio)
|
||||
{
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
|
@ -109,19 +109,19 @@ void GameInterface::UpdateCameras(double smoothratio)
|
|||
|
||||
screen->RenderTextureView(canvas, [=](IntRect& rect)
|
||||
{
|
||||
auto camera = &camsprite->GetOwner()->spr;
|
||||
auto ang = buildang(camera->interpolatedang(smoothratio));
|
||||
auto camera = camsprite->GetOwner();
|
||||
auto ang = buildang(camera->spr.interpolatedang(smoothratio));
|
||||
display_mirror = 1; // should really be 'display external view'.
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
// Note: no ROR or camera here - Polymost has no means to detect these things before rendering the scene itself.
|
||||
renderDrawRoomsQ16(camera->pos.X, camera->pos.Y, camera->pos.Z, ang.asq16(), IntToFixed(camera->shade), camera->sector(), false); // why 'shade'...?
|
||||
fi.animatesprites(pm_tsprite, pm_spritesortcnt, camera->pos.X, camera->pos.Y, ang.asbuild(), (int)smoothratio);
|
||||
renderDrawRoomsQ16(camera->spr.pos.X, camera->spr.pos.Y, camera->spr.pos.Z, ang.asq16(), IntToFixed(camera->spr.shade), camera->spr.sector(), false); // why 'shade'...?
|
||||
fi.animatesprites(pm_tsprite, pm_spritesortcnt, camera->spr.pos.X, camera->spr.pos.Y, ang.asbuild(), (int)smoothratio);
|
||||
renderDrawMasks();
|
||||
}
|
||||
else
|
||||
{
|
||||
render_camtex(camera, camera->pos, camera->sector(), ang, buildhoriz(camera->shade), buildang(0), tex, rect, smoothratio);
|
||||
render_camtex(camera, camera->spr.pos, camera->spr.sector(), ang, buildhoriz(camera->spr.shade), buildang(0), tex, rect, smoothratio);
|
||||
}
|
||||
display_mirror = 0;
|
||||
});
|
||||
|
@ -129,12 +129,12 @@ void GameInterface::UpdateCameras(double smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
void GameInterface::EnterPortal(spritetype* viewer, int type)
|
||||
void GameInterface::EnterPortal(DCoreActor* viewer, int type)
|
||||
{
|
||||
if (type == PORTAL_WALL_MIRROR) display_mirror++;
|
||||
}
|
||||
|
||||
void GameInterface::LeavePortal(spritetype* viewer, int type)
|
||||
void GameInterface::LeavePortal(DCoreActor* viewer, int type)
|
||||
{
|
||||
if (type == PORTAL_WALL_MIRROR) display_mirror--;
|
||||
}
|
||||
|
@ -282,15 +282,15 @@ void displayrooms(int snum, double smoothratio)
|
|||
|
||||
if (ud.cameraactor)
|
||||
{
|
||||
spritetype* s = &ud.cameraactor->spr;
|
||||
auto act = ud.cameraactor;
|
||||
|
||||
if (s->yvel < 0) s->yvel = -100;
|
||||
else if (s->yvel > 199) s->yvel = 300;
|
||||
if (act->spr.yvel < 0) act->spr.yvel = -100;
|
||||
else if (act->spr.yvel > 199) act->spr.yvel = 300;
|
||||
|
||||
cang = buildang(interpolatedangle(ud.cameraactor->tempang, s->ang, smoothratio));
|
||||
cang = buildang(interpolatedangle(ud.cameraactor->tempang, act->spr.ang, smoothratio));
|
||||
|
||||
auto bh = buildhoriz(s->yvel);
|
||||
renderView(s, s->sector(), s->pos.X, s->pos.Y, s->pos.Z - (4 << 8), cang, bh, buildang(0), (int)smoothratio);
|
||||
auto bh = buildhoriz(act->spr.yvel);
|
||||
renderView(act, act->spr.sector(), act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - (4 << 8), cang, bh, buildang(0), (int)smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -344,34 +344,34 @@ void displayrooms(int snum, double smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
spritetype* viewer;
|
||||
DDukeActor* viewer;
|
||||
if (p->newOwner != nullptr)
|
||||
{
|
||||
auto spr = &p->newOwner->spr;
|
||||
cang = buildang(spr->interpolatedang(smoothratio));
|
||||
choriz = buildhoriz(spr->shade);
|
||||
cposx = spr->pos.X;
|
||||
cposy = spr->pos.Y;
|
||||
cposz = spr->pos.Z;
|
||||
sect = spr->sector();
|
||||
auto act = p->newOwner;
|
||||
cang = buildang(act->spr.interpolatedang(smoothratio));
|
||||
choriz = buildhoriz(act->spr.shade);
|
||||
cposx = act->spr.pos.X;
|
||||
cposy = act->spr.pos.Y;
|
||||
cposz = act->spr.pos.Z;
|
||||
sect = act->spr.sector();
|
||||
rotscrnang = buildang(0);
|
||||
smoothratio = MaxSmoothRatio;
|
||||
viewer = spr;
|
||||
viewer = act;
|
||||
}
|
||||
else if (p->over_shoulder_on == 0)
|
||||
{
|
||||
if (cl_viewbob) cposz += interpolatedvalue(p->opyoff, p->pyoff, smoothratio);
|
||||
viewer = &p->GetActor()->spr;
|
||||
viewer = p->GetActor();
|
||||
}
|
||||
else
|
||||
{
|
||||
cposz -= isRR() ? 3840 : 3072;
|
||||
|
||||
viewer = &p->GetActor()->spr;
|
||||
if (!calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, cang, choriz, smoothratio))
|
||||
viewer = p->GetActor();
|
||||
if (!calcChaseCamPos(&cposx, &cposy, &cposz, &viewer->spr, §, cang, choriz, smoothratio))
|
||||
{
|
||||
cposz += isRR() ? 3840 : 3072;
|
||||
calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, cang, choriz, smoothratio);
|
||||
calcChaseCamPos(&cposx, &cposy, &cposz, &viewer->spr, §, cang, choriz, smoothratio);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1563,7 +1563,7 @@ void drawscreen(PLAYERp pp, double smoothratio)
|
|||
else
|
||||
{
|
||||
UpdateWallPortalState();
|
||||
render_drawrooms(&pp->Actor()->s(), { tx, ty, tz }, sectnum(tsect), tang, thoriz, trotscrnang, smoothratio);
|
||||
render_drawrooms(pp->Actor(), { tx, ty, tz }, sectnum(tsect), tang, thoriz, trotscrnang, smoothratio);
|
||||
RestorePortalState();
|
||||
}
|
||||
|
||||
|
|
|
@ -2091,8 +2091,8 @@ struct GameInterface : public ::GameInterface
|
|||
int chaseCamZ(fixedhoriz horiz) override { return horiz.asq16() >> 8; }
|
||||
void processSprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
||||
void UpdateCameras(double smoothratio) override;
|
||||
void EnterPortal(spritetype* viewer, int type) override;
|
||||
void LeavePortal(spritetype* viewer, int type) override;
|
||||
void EnterPortal(DCoreActor* viewer, int type) override;
|
||||
void LeavePortal(DCoreActor* viewer, int type) override;
|
||||
int Voxelize(int sprnum);
|
||||
void ExitFromMenu() override;
|
||||
int GetCurrentSkill() override;
|
||||
|
|
|
@ -688,12 +688,12 @@ void GameInterface::UpdateCameras(double smoothratio)
|
|||
JS_DrawCameras(cam_pp, cam_tx, cam_ty, cam_tz, smoothratio);
|
||||
}
|
||||
|
||||
void GameInterface::EnterPortal(spritetype* viewer, int type)
|
||||
void GameInterface::EnterPortal(DCoreActor* viewer, int type)
|
||||
{
|
||||
if (type == PORTAL_WALL_MIRROR) display_mirror++;
|
||||
}
|
||||
|
||||
void GameInterface::LeavePortal(spritetype* viewer, int type)
|
||||
void GameInterface::LeavePortal(DCoreActor* viewer, int type)
|
||||
{
|
||||
if (type == PORTAL_WALL_MIRROR) display_mirror--;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue