mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 13:10:39 +00:00
- animatesect, setanimation and related stuff.
This commit is contained in:
parent
b0ced98d5e
commit
db96e93adc
7 changed files with 26 additions and 34 deletions
|
@ -63,8 +63,9 @@ void pinsectorresetdown(int sect)
|
|||
|
||||
if (j == -1)
|
||||
{
|
||||
j = sector[sect].floorz;
|
||||
setanimation(sect, anim_ceilingz, sect, j, 64);
|
||||
auto sec = §or[sect];
|
||||
j = sec->floorz;
|
||||
setanimation(sec, anim_ceilingz, sec, j, 64);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,8 +75,9 @@ int pinsectorresetup(int sect)
|
|||
|
||||
if (j == -1)
|
||||
{
|
||||
j = nextsectorneighborzptr(§or[sect], sector[sect].ceilingz, -1, -1)->ceilingz;
|
||||
setanimation(sect, anim_ceilingz, sect, j, 64);
|
||||
auto sec = §or[sect];
|
||||
j = nextsectorneighborzptr(sec, sec->ceilingz, -1, -1)->ceilingz;
|
||||
setanimation(sec, anim_ceilingz, sec, j, 64);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -153,7 +153,8 @@ void hud_input(int playerNum);
|
|||
int getanimationgoal(int animtype, int animindex);
|
||||
bool isanearoperator(int lotag);
|
||||
bool isanunderoperator(int lotag);
|
||||
int setanimation(int animsect, int animtype, int animindex, int thegoal, int thevel);
|
||||
int setanimation(sectortype* animsect, int animtype, walltype* animtarget, int thegoal, int thevel);
|
||||
int setanimation(sectortype* animsect, int animtype, sectortype* animtarget, int thegoal, int thevel);
|
||||
void dofurniture(walltype* wallNum, sectortype* sectnum, int playerNum);
|
||||
void dotorch();
|
||||
int hitawall(struct player_struct* pl, walltype** hitWall);
|
||||
|
|
|
@ -102,7 +102,7 @@ DDukeActor* spriteq[1024];
|
|||
animwalltype animwall[MAXANIMWALLS]; // animated walls
|
||||
int numanimwalls;
|
||||
int animatecnt; // sector plane movement
|
||||
int animatesect[MAXANIMATES];
|
||||
sectortype* animatesect[MAXANIMATES];
|
||||
int8_t animatetype[MAXANIMATES];
|
||||
int animatetarget[MAXANIMATES];
|
||||
int animategoal[MAXANIMATES];
|
||||
|
|
|
@ -84,7 +84,7 @@ enum animtype_t
|
|||
anim_vertexx,
|
||||
anim_vertexy,
|
||||
};
|
||||
extern int animatesect[MAXANIMATES];
|
||||
extern sectortype* animatesect[MAXANIMATES];
|
||||
extern int animatetarget[MAXANIMATES];
|
||||
extern int8_t animatetype[MAXANIMATES];
|
||||
extern int animategoal[MAXANIMATES];
|
||||
|
|
|
@ -123,7 +123,7 @@ int check_activator_motion(int lotag)
|
|||
if (act->s->lotag == lotag)
|
||||
{
|
||||
for (int j = animatecnt - 1; j >= 0; j--)
|
||||
if (act->s->sectnum == animatesect[j])
|
||||
if (act->s->sector() == animatesect[j])
|
||||
return(1);
|
||||
|
||||
DukeStatIterator it1(STAT_EFFECTOR);
|
||||
|
@ -310,13 +310,13 @@ int* animateptr(int i)
|
|||
|
||||
void doanimations(void)
|
||||
{
|
||||
int i, a, p, v, dasect;
|
||||
int i, a, p, v;
|
||||
|
||||
for (i = animatecnt - 1; i >= 0; i--)
|
||||
{
|
||||
a = *animateptr(i);
|
||||
v = animatevel[i] * TICSPERFRAME;
|
||||
dasect = animatesect[i];
|
||||
auto dasectp = animatesect[i];
|
||||
|
||||
if (a == animategoal[i])
|
||||
{
|
||||
|
@ -328,12 +328,13 @@ void doanimations(void)
|
|||
animategoal[i] = animategoal[animatecnt];
|
||||
animatevel[i] = animatevel[animatecnt];
|
||||
animatesect[i] = animatesect[animatecnt];
|
||||
if (sector[animatesect[i]].lotag == ST_18_ELEVATOR_DOWN || sector[animatesect[i]].lotag == ST_19_ELEVATOR_UP)
|
||||
dasectp = animatesect[i];
|
||||
if (dasectp->lotag == ST_18_ELEVATOR_DOWN || dasectp->lotag == ST_19_ELEVATOR_UP)
|
||||
if (animatetype[i] == anim_ceilingz)
|
||||
continue;
|
||||
|
||||
if ((sector[dasect].lotag & 0xff) != ST_22_SPLITTING_DOOR)
|
||||
callsound(dasect, nullptr);
|
||||
if ((dasectp->lotag & 0xff) != ST_22_SPLITTING_DOOR)
|
||||
callsound(dasectp, nullptr);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -344,22 +345,22 @@ void doanimations(void)
|
|||
if (animatetype[i] == anim_floorz)
|
||||
{
|
||||
for (p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
if (ps[p].cursectnum == dasect)
|
||||
if ((sector[dasect].floorz - ps[p].pos.z) < (64 << 8))
|
||||
if (ps[p].cursector() == dasectp)
|
||||
if ((dasectp->floorz - ps[p].pos.z) < (64 << 8))
|
||||
if (ps[p].GetActor()->GetOwner() != nullptr)
|
||||
{
|
||||
ps[p].pos.z += v;
|
||||
ps[p].poszv = 0;
|
||||
}
|
||||
|
||||
DukeSectIterator it(dasect);
|
||||
DukeSectIterator it(dasectp);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (act->s->statnum != STAT_EFFECTOR)
|
||||
{
|
||||
act->s->backupz();
|
||||
act->s->z += v;
|
||||
act->floorz = sector[dasect].floorz + v;
|
||||
act->floorz = dasectp->floorz + v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +395,7 @@ int getanimationgoal(int animtype, int animtarget)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int setanimation(int animsect, int animtype, int animtarget, int thegoal, int thevel)
|
||||
static int dosetanimation(sectortype* animsect, int animtype, int animtarget, int thegoal, int thevel)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -425,28 +426,16 @@ int setanimation(int animsect, int animtype, int animtarget, int thegoal, int th
|
|||
return(j);
|
||||
}
|
||||
|
||||
int setanimation(int animsect, int animtype, walltype* animtarget, int thegoal, int thevel)
|
||||
{
|
||||
assert(animtype == anim_vertexx || animtype == anim_vertexy);
|
||||
return setanimation(animsect, animtype, wallnum(animtarget), thegoal, thevel);
|
||||
}
|
||||
|
||||
int setanimation(int animsect, int animtype, sectortype* animtarget, int thegoal, int thevel)
|
||||
{
|
||||
assert(animtype == anim_ceilingz || animtype == anim_floorz);
|
||||
return setanimation(animsect, animtype, sectnum(animtarget), thegoal, thevel);
|
||||
}
|
||||
|
||||
int setanimation(sectortype* animsect, int animtype, walltype* animtarget, int thegoal, int thevel)
|
||||
{
|
||||
assert(animtype == anim_vertexx || animtype == anim_vertexy);
|
||||
return setanimation(sectnum(animsect), animtype, wallnum(animtarget), thegoal, thevel);
|
||||
return dosetanimation(animsect, animtype, wallnum(animtarget), thegoal, thevel);
|
||||
}
|
||||
|
||||
int setanimation(sectortype* animsect, int animtype, sectortype* animtarget, int thegoal, int thevel)
|
||||
{
|
||||
assert(animtype == anim_ceilingz || animtype == anim_floorz);
|
||||
return setanimation(sectnum(animsect), animtype, sectnum(animtarget), thegoal, thevel);
|
||||
return dosetanimation(animsect, animtype, sectnum(animtarget), thegoal, thevel);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -557,7 +557,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
|||
switch (other->s->lotag)
|
||||
{
|
||||
case SE_12_LIGHT_SWITCH:
|
||||
sector[other->s->sectnum].floorpal = 0;
|
||||
other->getSector()->floorpal = 0;
|
||||
other->temp_data[0]++;
|
||||
if (other->temp_data[0] == 2)
|
||||
other->temp_data[0]++;
|
||||
|
|
|
@ -844,7 +844,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
if (!isRRRA()) break;
|
||||
[[fallthrough]];
|
||||
case SE_12_LIGHT_SWITCH:
|
||||
sector[other->s->sectnum].floorpal = 0;
|
||||
other->getSector()->floorpal = 0;
|
||||
other->temp_data[0]++;
|
||||
if (other->temp_data[0] == 2)
|
||||
other->temp_data[0]++;
|
||||
|
|
Loading…
Reference in a new issue