mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
- dudeLeechOperate
This commit is contained in:
parent
e415d93283
commit
f4fd2a770b
3 changed files with 27 additions and 16 deletions
|
@ -1830,38 +1830,49 @@ int getDodgeChance(DBloodActor* actor)
|
||||||
|
|
||||||
int chance = ((baseChance / mass) << 7);
|
int chance = ((baseChance / mass) << 7);
|
||||||
return chance;
|
return chance;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT event)
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
|
||||||
{
|
{
|
||||||
if (event.cmd == kCmdOff) {
|
auto const pSprite = &actor->s();
|
||||||
|
auto const pXSprite = &actor->x();
|
||||||
|
|
||||||
|
if (event.cmd == kCmdOff)
|
||||||
|
{
|
||||||
actPostSprite(pSprite->index, kStatFree);
|
actPostSprite(pSprite->index, kStatFree);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto actor = &bloodActors[pSprite->index];
|
|
||||||
|
|
||||||
int nTarget = pXSprite->target_i;
|
auto actTarget = actor->GetTarget();
|
||||||
if (spriRangeIsFine(nTarget) && nTarget != pSprite->owner) {
|
if (actTarget != nullptr && actTarget != actor->GetOwner())
|
||||||
spritetype* pTarget = &sprite[nTarget];
|
{
|
||||||
if (pTarget->statnum == kStatDude && !(pTarget->flags & 32) && pTarget->extra > 0 && pTarget->extra < kMaxXSprites && !pXSprite->stateTimer) {
|
spritetype* pTarget = &actTarget->s();
|
||||||
|
if (pTarget->statnum == kStatDude && !(pTarget->flags & 32) && pTarget->extra > 0 && pTarget->extra < kMaxXSprites && !pXSprite->stateTimer)
|
||||||
if (IsPlayerSprite(pTarget)) {
|
{
|
||||||
|
if (IsPlayerSprite(pTarget))
|
||||||
|
{
|
||||||
PLAYER* pPlayer = &gPlayer[pTarget->type - kDudePlayer1];
|
PLAYER* pPlayer = &gPlayer[pTarget->type - kDudePlayer1];
|
||||||
if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) return;
|
if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) return;
|
||||||
}
|
}
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
GetSpriteExtents(pSprite, &top, &bottom);
|
GetActorExtents(actor, &top, &bottom);
|
||||||
int nType = pTarget->type - kDudeBase;
|
int nType = pTarget->type - kDudeBase;
|
||||||
DUDEINFO* pDudeInfo = &dudeInfo[nType];
|
DUDEINFO* pDudeInfo = &dudeInfo[nType];
|
||||||
int z1 = (top - pSprite->z) - 256;
|
int z1 = (top - pSprite->z) - 256;
|
||||||
int x = pTarget->x; int y = pTarget->y; int z = pTarget->z;
|
int x = pTarget->x; int y = pTarget->y; int z = pTarget->z;
|
||||||
int nDist = approxDist(x - pSprite->x, y - pSprite->y);
|
int nDist = approxDist(x - pSprite->x, y - pSprite->y);
|
||||||
|
|
||||||
if (nDist != 0 && cansee(pSprite->x, pSprite->y, top, pSprite->sectnum, x, y, z, pTarget->sectnum)) {
|
if (nDist != 0 && cansee(pSprite->x, pSprite->y, top, pSprite->sectnum, x, y, z, pTarget->sectnum))
|
||||||
|
{
|
||||||
int t = DivScale(nDist, 0x1aaaaa, 12);
|
int t = DivScale(nDist, 0x1aaaaa, 12);
|
||||||
x += (xvel[nTarget] * t) >> 12;
|
x += (actTarget->xvel() * t) >> 12;
|
||||||
y += (yvel[nTarget] * t) >> 12;
|
y += (actTarget->yvel() * t) >> 12;
|
||||||
int angBak = pSprite->ang;
|
int angBak = pSprite->ang;
|
||||||
pSprite->ang = getangle(x - pSprite->x, y - pSprite->y);
|
pSprite->ang = getangle(x - pSprite->x, y - pSprite->y);
|
||||||
int dx = CosScale16(pSprite->ang);
|
int dx = CosScale16(pSprite->ang);
|
||||||
|
|
|
@ -209,7 +209,7 @@ int checkAttackState(DBloodActor* actor);
|
||||||
bool doExplosion(DBloodActor* pSprite, int nType);
|
bool doExplosion(DBloodActor* pSprite, int nType);
|
||||||
spritetype* genDudeSpawn(XSPRITE* pXSource, spritetype* pSprite, int nDist);
|
spritetype* genDudeSpawn(XSPRITE* pXSource, spritetype* pSprite, int nDist);
|
||||||
void genDudeTransform(spritetype* pSprite);
|
void genDudeTransform(spritetype* pSprite);
|
||||||
void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3);
|
void dudeLeechOperate(DBloodActor* actor, const EVENT& a3);
|
||||||
int getDodgeChance(DBloodActor* pSprite);
|
int getDodgeChance(DBloodActor* pSprite);
|
||||||
int getRecoilChance(DBloodActor* pSprite);
|
int getRecoilChance(DBloodActor* pSprite);
|
||||||
bool dudeIsMelee(DBloodActor* pXSprite);
|
bool dudeIsMelee(DBloodActor* pXSprite);
|
||||||
|
|
|
@ -5066,7 +5066,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case kModernThingEnemyLifeLeech:
|
case kModernThingEnemyLifeLeech:
|
||||||
dudeLeechOperate(pSprite, pXSprite, event);
|
dudeLeechOperate(actor, event);
|
||||||
return true;
|
return true;
|
||||||
case kModernPlayerControl: { // WIP
|
case kModernPlayerControl: { // WIP
|
||||||
PLAYER* pPlayer = NULL; int cmd = (event.cmd >= kCmdNumberic) ? event.cmd : pXSprite->command;
|
PLAYER* pPlayer = NULL; int cmd = (event.cmd >= kCmdNumberic) ? event.cmd : pXSprite->command;
|
||||||
|
|
Loading…
Reference in a new issue