mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-23 04:01:19 +00:00
- GetPlayerSpriteNum
This commit is contained in:
parent
602048b41d
commit
4d12bbbb56
1 changed files with 8 additions and 11 deletions
|
@ -484,10 +484,9 @@ TARGETACTOR:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
DSWActor* GetPlayerSpriteNum(DSWActor* actor)
|
||||||
GetPlayerSpriteNum(short SpriteNum)
|
|
||||||
{
|
{
|
||||||
USERp u = User[SpriteNum].Data();
|
USERp u = actor->u();
|
||||||
short pnum;
|
short pnum;
|
||||||
PLAYERp pp;
|
PLAYERp pp;
|
||||||
|
|
||||||
|
@ -497,10 +496,10 @@ GetPlayerSpriteNum(short SpriteNum)
|
||||||
|
|
||||||
if (pp->Actor() == u->targetActor)
|
if (pp->Actor() == u->targetActor)
|
||||||
{
|
{
|
||||||
return pp->PlayerSprite;
|
return pp->Actor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -611,7 +610,6 @@ DoActorActionDecide(short SpriteNum)
|
||||||
SPRITEp sp = &actor->s();
|
SPRITEp sp = &actor->s();
|
||||||
int dist;
|
int dist;
|
||||||
ANIMATORp action;
|
ANIMATORp action;
|
||||||
USERp pu=nullptr;
|
|
||||||
bool ICanSee=false;
|
bool ICanSee=false;
|
||||||
|
|
||||||
// REMINDER: This function is not even called if SpriteControl doesn't let
|
// REMINDER: This function is not even called if SpriteControl doesn't let
|
||||||
|
@ -669,10 +667,10 @@ DoActorActionDecide(short SpriteNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pu = User[GetPlayerSpriteNum(SpriteNum)].Data();
|
auto pActor = GetPlayerSpriteNum(actor);
|
||||||
// check for short range attack possibility
|
// check for short range attack possibility
|
||||||
if ((dist < CloseRangeDist(sp, u->tgt_sp()) && ICanSee) ||
|
if ((dist < CloseRangeDist(sp, u->tgt_sp()) && ICanSee) ||
|
||||||
(pu && pu->WeaponNum == WPN_FIST && u->ID != RIPPER2_RUN_R0 && u->ID != RIPPER_RUN_R0))
|
(pActor && pActor->hasU() && pActor->u()->WeaponNum == WPN_FIST && u->ID != RIPPER2_RUN_R0 && u->ID != RIPPER_RUN_R0))
|
||||||
{
|
{
|
||||||
if ((u->ID == COOLG_RUN_R0 && TEST(sp->cstat, CSTAT_SPRITE_TRANSLUCENT)) || TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
|
if ((u->ID == COOLG_RUN_R0 && TEST(sp->cstat, CSTAT_SPRITE_TRANSLUCENT)) || TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
|
||||||
action = ChooseAction(u->Personality->Evasive);
|
action = ChooseAction(u->Personality->Evasive);
|
||||||
|
@ -1508,7 +1506,6 @@ DoActorAttack(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
int SpriteNum = u->SpriteNum;
|
||||||
USERp pu;
|
|
||||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
SPRITEp sp = User[SpriteNum]->SpriteP;
|
||||||
short rand_num;
|
short rand_num;
|
||||||
int dist,a,b,c;
|
int dist,a,b,c;
|
||||||
|
@ -1517,9 +1514,9 @@ DoActorAttack(DSWActor* actor)
|
||||||
|
|
||||||
DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c);
|
DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c);
|
||||||
|
|
||||||
pu = User[GetPlayerSpriteNum(SpriteNum)].Data();
|
auto pActor = GetPlayerSpriteNum(actor);
|
||||||
if ((u->ActorActionSet->CloseAttack[0] && dist < CloseRangeDist(sp, u->tgt_sp())) ||
|
if ((u->ActorActionSet->CloseAttack[0] && dist < CloseRangeDist(sp, u->tgt_sp())) ||
|
||||||
(pu && pu->WeaponNum == WPN_FIST)) // JBF: added null check
|
(pActor && pActor->hasU() && pActor->u()->WeaponNum == WPN_FIST)) // JBF: added null check
|
||||||
{
|
{
|
||||||
rand_num = ChooseActionNumber(u->ActorActionSet->CloseAttackPercent);
|
rand_num = ChooseActionNumber(u->ActorActionSet->CloseAttackPercent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue