mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- handle DoActorSetSpeed
This commit is contained in:
parent
b202cf7a12
commit
f9fb48b930
2 changed files with 29 additions and 29 deletions
|
@ -48,25 +48,11 @@ ANIMATOR* ChooseAction(DECISION decision[]);
|
||||||
|
|
||||||
#define CHOOSE2(value) (RANDOM_P2(1024) < (value))
|
#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)
|
bool ActorMoveHitReact(DSWActor* actor)
|
||||||
{
|
{
|
||||||
|
@ -114,10 +100,13 @@ void DoActorSetSpeed(DSWActor* actor, uint8_t speed)
|
||||||
|
|
||||||
actor->user.speed = speed;
|
actor->user.speed = speed;
|
||||||
|
|
||||||
|
int vel;
|
||||||
if (ActorFlaming(actor))
|
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
|
else
|
||||||
actor->set_int_xvel(actor->user.Attrib->Speed[speed]);
|
vel = actor->user.Attrib->Speed[speed];
|
||||||
|
|
||||||
|
actor->vel.X = vel * maptoworld;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1628,17 +1628,28 @@ extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];
|
||||||
|
|
||||||
ANIMATOR NullAnimator;
|
ANIMATOR NullAnimator;
|
||||||
|
|
||||||
int Distance(int x1, int y1, int x2, int y2);
|
inline int Distance(int x1, int y1, int x2, int y2)
|
||||||
int DistanceI(const DVector2& pos1, const DVector2& pos2)
|
{
|
||||||
|
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));
|
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[]);
|
int NewStateGroup(DSWActor* actor, STATE* SpriteGroup[]);
|
||||||
void SectorMidPoint(sectortype* sect, int *xmid, int *ymid, int *zmid);
|
void SectorMidPoint(sectortype* sect, int *xmid, int *ymid, int *zmid);
|
||||||
|
|
Loading…
Reference in a new issue