mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- made camsprite an actor variable.
This commit is contained in:
parent
25c93e65fc
commit
083454986b
7 changed files with 17 additions and 20 deletions
|
@ -1301,12 +1301,12 @@ static void moveviewscreen(DDukeActor* actor)
|
|||
{
|
||||
#if 0
|
||||
if (actor->s.yvel == 1)
|
||||
camsprite = i;
|
||||
camsprite = actor;
|
||||
#endif
|
||||
}
|
||||
else if (camsprite != -1 && actor->temp_data[0] == 1)
|
||||
else if (camsprite != nullptr && actor->temp_data[0] == 1)
|
||||
{
|
||||
camsprite = -1;
|
||||
camsprite = nullptr;
|
||||
actor->s.yvel = 0;
|
||||
actor->temp_data[0] = 0;
|
||||
}
|
||||
|
|
|
@ -259,14 +259,14 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
continue;
|
||||
case VIEWSCREEN:
|
||||
case VIEWSCREEN2:
|
||||
if (camsprite >= 0 && h->GetOwner()->temp_data[0] == 1)
|
||||
if (camsprite != nullptr && h->GetOwner()->temp_data[0] == 1)
|
||||
{
|
||||
t->picnum = STATIC;
|
||||
t->cstat |= (rand() & 12);
|
||||
t->xrepeat += 8;
|
||||
t->yrepeat += 8;
|
||||
}
|
||||
else if (camsprite >= 0)
|
||||
else if (camsprite != nullptr)
|
||||
{
|
||||
t->picnum = TILE_VIEWSCR;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ animwalltype animwall[MAXANIMWALLS];
|
|||
int numanimwalls;
|
||||
int animatecnt;
|
||||
int numclouds;
|
||||
int camsprite;
|
||||
DDukeActor* camsprite;
|
||||
int numcyclers;
|
||||
int earthquaketime;
|
||||
int freezerhurtowner;
|
||||
|
|
|
@ -70,7 +70,7 @@ extern animwalltype animwall[MAXANIMWALLS];
|
|||
extern int numanimwalls;
|
||||
extern int animatecnt;
|
||||
extern int numclouds;
|
||||
extern int camsprite;
|
||||
extern DDukeActor* camsprite;
|
||||
extern int numcyclers;
|
||||
extern int earthquaketime;
|
||||
extern int freezerhurtowner;
|
||||
|
|
|
@ -418,7 +418,7 @@ void resetprestat(int snum,int g)
|
|||
paused = 0;
|
||||
ud.cameraactor =nullptr;
|
||||
tempwallptr = 0;
|
||||
camsprite =-1;
|
||||
camsprite =nullptr;
|
||||
earthquaketime = 0;
|
||||
|
||||
WindTime = 0;
|
||||
|
@ -742,8 +742,8 @@ void resettimevars(void)
|
|||
{
|
||||
cloudclock = 0;
|
||||
ud.levelclock = 0;
|
||||
if (camsprite >= 0)
|
||||
hittype[camsprite].temp_data[0] = 0;
|
||||
if (camsprite != nullptr)
|
||||
camsprite->temp_data[0] = 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -273,18 +273,15 @@ void animatecamsprite(double smoothratio)
|
|||
{
|
||||
const int VIEWSCREEN_ACTIVE_DISTANCE = 8192;
|
||||
|
||||
if (camsprite < 0)
|
||||
if (camsprite == nullptr)
|
||||
return;
|
||||
|
||||
int spriteNum = camsprite;
|
||||
|
||||
auto p = &ps[screenpeek];
|
||||
auto act = &hittype[spriteNum];
|
||||
auto sp = &act->s;
|
||||
auto sp = &camsprite->s;
|
||||
|
||||
if (p->newOwner != nullptr) act->SetOwner(p->newOwner);
|
||||
if (p->newOwner != nullptr) camsprite->SetOwner(p->newOwner);
|
||||
|
||||
if (act->GetOwner() && dist(p->GetActor(), act) < VIEWSCREEN_ACTIVE_DISTANCE)
|
||||
if (camsprite->GetOwner() && dist(p->GetActor(), camsprite) < VIEWSCREEN_ACTIVE_DISTANCE)
|
||||
{
|
||||
auto tex = tileGetTexture(sp->picnum);
|
||||
TileFiles.MakeCanvas(TILE_VIEWSCR, tex->GetDisplayWidth(), tex->GetDisplayHeight());
|
||||
|
@ -294,8 +291,8 @@ void animatecamsprite(double smoothratio)
|
|||
|
||||
screen->RenderTextureView(canvas, [=](IntRect& rect)
|
||||
{
|
||||
auto camera = &act->GetOwner()->s;
|
||||
auto ang = getcamspriteang(act->GetOwner(), smoothratio);
|
||||
auto camera = &camsprite->GetOwner()->s;
|
||||
auto ang = getcamspriteang(camsprite->GetOwner(), smoothratio);
|
||||
// Note: no ROR or camera here for now - the current setup has no means to detect these things before rendering the scene itself.
|
||||
drawrooms(camera->x, camera->y, camera->z, ang, 100 + camera->shade, camera->sectnum); // why 'shade'...?
|
||||
display_mirror = 1; // should really be 'display external view'.
|
||||
|
|
|
@ -1710,7 +1710,7 @@ void checksectors_d(int snum)
|
|||
|
||||
neartagsprite->SetOwner(acti);
|
||||
neartagsprite->s.yvel = 1;
|
||||
camsprite = neartagsprite->GetIndex();
|
||||
camsprite = neartagsprite;
|
||||
|
||||
|
||||
j = p->cursectnum;
|
||||
|
|
Loading…
Reference in a new issue