mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- SW: made ANIM value type independent.
This commit is contained in:
parent
fa53fcd085
commit
9407fa549d
2 changed files with 35 additions and 11 deletions
|
@ -2101,34 +2101,58 @@ inline void PlaySound(int num, DSWActor* actor, int flags, int channel = 8, ECha
|
|||
struct ANIM
|
||||
{
|
||||
int animtype, animindex;
|
||||
int goal;
|
||||
double goal;
|
||||
int vel;
|
||||
short vel_adj;
|
||||
TObjPtr<DSWActor*> animactor;
|
||||
ANIM_CALLBACKp callback;
|
||||
SECTOR_OBJECT* callbackdata; // only gets used in one place for this so having a proper type makes serialization easier.
|
||||
|
||||
int& Addr(bool write)
|
||||
double getValue()
|
||||
{
|
||||
static int scratch;
|
||||
switch (animtype)
|
||||
{
|
||||
case ANIM_Floorz:
|
||||
return *sector[animindex].floorzptr(!write);
|
||||
return sector[animindex].floorz;
|
||||
case ANIM_SopZ:
|
||||
return SectorObject[animindex].pmid.Z;
|
||||
case ANIM_Spritez:
|
||||
if (animactor == nullptr) return scratch;
|
||||
return animactor->spr.__int_pos.Z;
|
||||
if (animactor == nullptr) return 0;
|
||||
return animactor->spr.int_pos().Z;
|
||||
case ANIM_Userz:
|
||||
if (animactor == nullptr) return scratch;
|
||||
if (animactor == nullptr) return 0;
|
||||
return animactor->user.pos.Z;
|
||||
case ANIM_SUdepth:
|
||||
return sector[animindex].depth_fixed;
|
||||
default:
|
||||
return animindex;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void setValue(double value)
|
||||
{
|
||||
switch (animtype)
|
||||
{
|
||||
case ANIM_Floorz:
|
||||
sector[animindex].setfloorz(value);
|
||||
break;
|
||||
case ANIM_SopZ:
|
||||
SectorObject[animindex].pmid.Z = value;
|
||||
break;
|
||||
case ANIM_Spritez:
|
||||
if (animactor == nullptr) return;
|
||||
animactor->set_int_z(value);
|
||||
break;
|
||||
case ANIM_Userz:
|
||||
if (animactor == nullptr) return;
|
||||
animactor->user.pos.Z = value;
|
||||
break;
|
||||
case ANIM_SUdepth:
|
||||
sector[animindex].depth_fixed = value;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
extern ANIM Anim[MAXANIM];
|
||||
|
|
|
@ -2425,11 +2425,11 @@ void DoSineWaveWall(void)
|
|||
|
||||
void DoAnim(int numtics)
|
||||
{
|
||||
int i, animval;
|
||||
int i;
|
||||
|
||||
for (i = AnimCnt - 1; i >= 0; i--)
|
||||
{
|
||||
animval = Anim[i].Addr(true);
|
||||
double animval = Anim[i].getValue();
|
||||
|
||||
// if LESS THAN goal
|
||||
if (animval < Anim[i].goal)
|
||||
|
@ -2455,7 +2455,7 @@ void DoAnim(int numtics)
|
|||
animval = Anim[i].goal;
|
||||
}
|
||||
|
||||
Anim[i].Addr(true) =animval;
|
||||
Anim[i].setValue(animval);
|
||||
|
||||
// EQUAL this entry has finished
|
||||
if (animval == Anim[i].goal)
|
||||
|
|
Loading…
Reference in a new issue