mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- expose animatesprite set of functions to new renderer as a callback.
This commit is contained in:
parent
0b1e81023f
commit
be7bca8e9e
10 changed files with 33 additions and 18 deletions
|
@ -102,7 +102,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 void processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) {}
|
||||
virtual void processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) = 0;
|
||||
|
||||
virtual FString statFPS()
|
||||
{
|
||||
|
|
|
@ -441,9 +441,10 @@ void BunchDrawer::ProcessSector(int sectnum)
|
|||
|
||||
int sx = spr->x - iview.x, sy = spr->y - int(iview.y);
|
||||
|
||||
if ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) || (hw_models && tile2model[spr->picnum].modelid >= 0) || ((sx * gcosang) + (sy * gsinang) > 0)) // is it behind the camera? (fixme!)
|
||||
// this checks if the sprite is it behind the camera, which will not work if the pitch is high enough to necessitate a FOV of more than 180°.
|
||||
//if ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) || (hw_models && tile2model[spr->picnum].modelid >= 0) || ((sx * gcosang) + (sy * gsinang) > 0))
|
||||
{
|
||||
if ((spr->cstat & (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_MASK)) != (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_WALL + 16) ||
|
||||
if ((spr->cstat & (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_MASK)) != (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_WALL) ||
|
||||
(r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) ||
|
||||
DMulScale(bcos(spr->ang), -sx, bsin(spr->ang), -sy, 6) > 0)
|
||||
if (renderAddTsprite(z, sectnum))
|
||||
|
|
|
@ -65,6 +65,7 @@ struct GameInterface : public ::GameInterface
|
|||
int chaseCamX(binangle ang) { return -ang.bcos(-4); }
|
||||
int chaseCamY(binangle ang) { return -ang.bsin(-4); }
|
||||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 9; }
|
||||
void processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -414,6 +414,10 @@ bool GameInterface::GenerateSavePic()
|
|||
return true;
|
||||
}
|
||||
|
||||
void GameInterface::processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio)
|
||||
{
|
||||
fi.animatesprites(viewx, viewy, viewz, int(smoothRatio));
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -255,6 +255,7 @@ struct GameInterface : ::GameInterface
|
|||
int chaseCamX(binangle ang) { return -ang.bcos() / 12; }
|
||||
int chaseCamY(binangle ang) { return -ang.bsin() / 12; }
|
||||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() / 384; }
|
||||
void processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
||||
|
||||
::GameStats getStats() override;
|
||||
};
|
||||
|
|
|
@ -66,7 +66,7 @@ short enemy;
|
|||
short nEnemyPal = 0;
|
||||
|
||||
// NOTE - not to be confused with Ken's analyzesprites()
|
||||
static void analyzesprites(double const smoothratio)
|
||||
static void analyzesprites(int x, int y, int z, double const smoothratio)
|
||||
{
|
||||
tspritetype *pTSprite;
|
||||
|
||||
|
@ -90,11 +90,6 @@ static void analyzesprites(double const smoothratio)
|
|||
|
||||
besttarget = -1;
|
||||
|
||||
int x = pPlayerSprite->x;
|
||||
int y = pPlayerSprite->y;
|
||||
|
||||
int z = pPlayerSprite->z - (GetSpriteHeight(nPlayerSprite) / 2);
|
||||
|
||||
short nSector = pPlayerSprite->sectnum;
|
||||
|
||||
int nAngle = (2048 - pPlayerSprite->ang) & kAngleMask;
|
||||
|
@ -362,7 +357,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
{
|
||||
renderSetRollAngle(rotscrnang.asbuildf());
|
||||
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa.asq16(), nCamerapan.asq16(), nSector);
|
||||
analyzesprites(smoothRatio);
|
||||
analyzesprites(nCamerax, nCameray, viewz, smoothRatio);
|
||||
renderDrawMasks();
|
||||
}
|
||||
else
|
||||
|
@ -467,6 +462,12 @@ bool GameInterface::GenerateSavePic()
|
|||
return true;
|
||||
}
|
||||
|
||||
void GameInterface::processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio)
|
||||
{
|
||||
analyzesprites(viewx, viewy, viewz, smoothRatio);
|
||||
}
|
||||
|
||||
|
||||
void NoClip()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixe
|
|||
if (!FAF_DebugView)
|
||||
FAF_DrawRooms(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
|
||||
|
||||
analyzesprites(tx, ty, tz, false);
|
||||
analyzesprites(tx, ty, tz, tang.asbuild());
|
||||
post_analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
|
@ -323,7 +323,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
|
|||
|
||||
renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS);
|
||||
|
||||
analyzesprites(tposx, tposy, tz, true);
|
||||
analyzesprites(tposx, tposy, tz, tang >> 16);
|
||||
renderDrawMasks();
|
||||
|
||||
renderCompleteMirror(); // Reverse screen x-wise in this
|
||||
|
|
|
@ -265,7 +265,7 @@ DoShadowFindGroundPoint(tspriteptr_t sp)
|
|||
}
|
||||
|
||||
void
|
||||
DoShadows(tspriteptr_t tsp, int viewz, bool mirror)
|
||||
DoShadows(tspriteptr_t tsp, int viewz, int camang)
|
||||
{
|
||||
tspriteptr_t New = &tsprite[spritesortcnt];
|
||||
USERp tu = User[tsp->owner];
|
||||
|
@ -553,7 +553,7 @@ void DoStarView(tspriteptr_t tsp, USERp tu, int viewz)
|
|||
}
|
||||
|
||||
void
|
||||
analyzesprites(int viewx, int viewy, int viewz, bool mirror)
|
||||
analyzesprites(int viewx, int viewy, int viewz, int camang)
|
||||
{
|
||||
int tSpriteNum;
|
||||
short SpriteNum;
|
||||
|
@ -645,7 +645,7 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror)
|
|||
|
||||
if (r_shadows && TEST(tu->Flags, SPR_SHADOW))
|
||||
{
|
||||
DoShadows(tsp, viewz, mirror);
|
||||
DoShadows(tsp, viewz, camang);
|
||||
}
|
||||
|
||||
//#define UK_VERSION 1
|
||||
|
@ -1869,6 +1869,12 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
return true;
|
||||
}
|
||||
|
||||
void GameInterface::processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio)
|
||||
{
|
||||
analyzesprites(viewx, viewy, viewz, viewang.asbuild());
|
||||
post_analyzesprites();
|
||||
}
|
||||
|
||||
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -1967,7 +1967,7 @@ int DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets);
|
|||
void change_sprite_stat(short, short);
|
||||
void SetOwner(short, short);
|
||||
void SetAttach(short, short);
|
||||
void analyzesprites(int,int,int,bool);
|
||||
void analyzesprites(int,int,int,int);
|
||||
void ChangeState(short SpriteNum, STATEp statep);
|
||||
void CollectPortals();
|
||||
|
||||
|
@ -2248,7 +2248,8 @@ struct GameInterface : ::GameInterface
|
|||
int chaseCamX(binangle ang) { return -ang.bcos(-3); }
|
||||
int chaseCamY(binangle ang) { return -ang.bsin(-3); }
|
||||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 8; }
|
||||
|
||||
void processSprites(int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
||||
|
||||
|
||||
GameStats getStats() override;
|
||||
};
|
||||
|
|
|
@ -476,7 +476,7 @@ void drawroomstotile(int daposx, int daposy, int daposz,
|
|||
if (!testnewrenderer)
|
||||
{
|
||||
renderDrawRoomsQ16(daposx, daposy, daposz, ang.asq16(), horiz.asq16(), dacursectnum);
|
||||
analyzesprites(daposx, daposy, daposz, false);
|
||||
analyzesprites(daposx, daposy, daposz, ang.asbuild());
|
||||
renderDrawMasks();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue