- handle DoActorSetSpeed

This commit is contained in:
Christoph Oelckers 2022-09-04 20:43:12 +02:00
parent b202cf7a12
commit f9fb48b930
2 changed files with 29 additions and 29 deletions

View file

@ -48,25 +48,11 @@ ANIMATOR* ChooseAction(DECISION decision[]);
#define CHOOSE2(value) (RANDOM_P2(1024) < (value))
int Distance(int x1, int y1, int x2, int y2)
{
int min;
if ((x2 = x2 - x1) < 0)
x2 = -x2;
if ((y2 = y2 - y1) < 0)
y2 = -y2;
if (x2 > y2)
min = y2;
else
min = x2;
return x2 + y2 - (min >> 1);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool ActorMoveHitReact(DSWActor* actor)
{
@ -114,10 +100,13 @@ void DoActorSetSpeed(DSWActor* actor, uint8_t speed)
actor->user.speed = speed;
int vel;
if (ActorFlaming(actor))
actor->set_int_xvel(actor->user.Attrib->Speed[speed] + (actor->user.Attrib->Speed[speed] >> 1));
vel = actor->user.Attrib->Speed[speed] + (actor->user.Attrib->Speed[speed] >> 1);
else
actor->set_int_xvel(actor->user.Attrib->Speed[speed]);
vel = actor->user.Attrib->Speed[speed];
actor->vel.X = vel * maptoworld;
}
/*

View file

@ -1628,17 +1628,28 @@ extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];
ANIMATOR NullAnimator;
int Distance(int x1, int y1, int x2, int y2);
int DistanceI(const DVector2& pos1, const DVector2& pos2)
inline int Distance(int x1, int y1, int x2, int y2)
{
int min;
if ((x2 = x2 - x1) < 0)
x2 = -x2;
if ((y2 = y2 - y1) < 0)
y2 = -y2;
if (x2 > y2)
min = y2;
else
min = x2;
return x2 + y2 - (min >> 1);
}
inline int DistanceI(const DVector2& pos1, const DVector2& pos2)
{
return Distance(int(pos1.X * worldtoint), int(pos1.Y * worldtoint), int(pos2.X * worldtoint), int(pos2.Y * worldtoint));
}
/*
double Distance(const DVector2& pos1, const DVector2& pos2)
{
return (pos2 - pos1).Length();
}
*/
int NewStateGroup(DSWActor* actor, STATE* SpriteGroup[]);
void SectorMidPoint(sectortype* sect, int *xmid, int *ymid, int *zmid);