MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / Sprite_Homing_LockInRange

Method Sprite_Homing_LockInRange

Source/Fodder.cpp:18549–18595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18547}
18548
18549int16 cFodder::Sprite_Homing_LockInRange(sSprite* pSprite, sSprite*& pFoundSprite) {
18550
18551 int16 MouseX = mMouseX;
18552 int16 MouseY = mMouseY;
18553
18554 MouseX += mCameraX >> 16;
18555 MouseY += mCameraY >> 16;
18556
18557 MouseX -= 0x10;
18558 if (!MouseX)
18559 MouseX = 1;
18560
18561 MouseY += 0x08;
18562
18563 for( auto& Sprite : mSprites ) {
18564 pFoundSprite = &Sprite;
18565
18566 if (pFoundSprite->field_0 == -32768)
18567 continue;
18568
18569 if (!mSprite_Missile_CanLock[pFoundSprite->field_18])
18570 continue;
18571
18572 if (pFoundSprite->field_22 == pSprite->field_22)
18573 continue;
18574
18575 int16 Data0 = pFoundSprite->field_0 + 5;
18576 int16 Data4 = pFoundSprite->field_4 - 5;
18577
18578 Data4 -= pFoundSprite->field_20;
18579 int16 Distance = 0x1F;
18580 int16 S_Data8 = MouseX;
18581 int16 S_DataC = MouseY;
18582
18583 Map_Get_Distance_BetweenPoints(Data0, Data4, MouseX, Distance, MouseY);
18584
18585 MouseX = S_Data8;
18586 MouseY = S_DataC;
18587
18588 if (Data0 < 0x16) {
18589 Data0 = -1;
18590 return -1;
18591 }
18592 }
18593
18594 return 0;
18595}
18596
18597void cFodder::Sprite_Projectile_HitTarget(sSprite* pSprite) {
18598

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected