comparison Actor.cpp @ 1878:6ffa3228eaf7

Actor::AI_SpellAttack2 cleaned up
author Grumpy7
date Thu, 17 Oct 2013 09:50:25 +0200
parents bed4532cfe59
children 7efa09ddb8b4
comparison
equal deleted inserted replaced
1877:bed4532cfe59 1878:6ffa3228eaf7
1273 v3->uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8; 1273 v3->uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8;
1274 v3->uCurrentActionTime = 0; 1274 v3->uCurrentActionTime = 0;
1275 v3->uAIState = AttackingMelee; 1275 v3->uAIState = AttackingMelee;
1276 Actor::PlaySound(uActorID, 0); 1276 Actor::PlaySound(uActorID, 0);
1277 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; 1277 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
1278 if ( v3->pActorBuffs[7].uExpireTime > 0 )
1279 {
1280 v25 *= 2;
1281 }
1278 if ( pParty->bTurnBasedModeOn != 1 ) 1282 if ( pParty->bTurnBasedModeOn != 1 )
1279 { 1283 {
1280 v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); 1284 v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333);
1281 }
1282 else if ( v3->pActorBuffs[7].uExpireTime > 0 )
1283 {
1284 v3->pMonsterInfo.uRecoveryTime = v25 * 2;
1285 } 1285 }
1286 else 1286 else
1287 { 1287 {
1288 v3->pMonsterInfo.uRecoveryTime = v25; 1288 v3->pMonsterInfo.uRecoveryTime = v25;
1289 } 1289 }
1498 1498
1499 //----- (00403A60) -------------------------------------------------------- 1499 //----- (00403A60) --------------------------------------------------------
1500 void Actor::AI_SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir) 1500 void Actor::AI_SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir)
1501 { 1501 {
1502 Actor *v3; // ebx@1 1502 Actor *v3; // ebx@1
1503 AIDirection *v4; // esi@3 1503 int16_t v4; // esi@3
1504 AIDirection *v5; // edi@3 1504 int16_t v5; // edi@3
1505 signed int v6; // eax@4 1505 signed int v6; // eax@4
1506 Vec3_int_ v7; // ST04_12@6 1506 Vec3_int_ v7; // ST04_12@6
1507 //unsigned int result; // eax@7 1507 //unsigned int result; // eax@7
1508 AIDirection *v9; // eax@8 1508 AIDirection *v9; // eax@8
1509 unsigned int v10; // esi@8
1510 AIDirection *v11; // esi@9
1511 SpriteFrame *v12; // ecx@10
1512 __int16 v13; // ax@10 1509 __int16 v13; // ax@10
1513 unsigned int v14; // ecx@10
1514 unsigned int v15; // eax@10
1515 signed int v16; // ecx@17 1510 signed int v16; // ecx@17
1516 AIDirection a3; // [sp+Ch] [bp-48h]@9 1511 AIDirection a3; // [sp+Ch] [bp-48h]@9
1517 AIDirection v18; // [sp+28h] [bp-2Ch]@9 1512 AIDirection v18; // [sp+28h] [bp-2Ch]@9
1518 int v19; // [sp+44h] [bp-10h]@6 1513 int v19; // [sp+44h] [bp-10h]@6
1519 signed int a2; // [sp+48h] [bp-Ch]@1 1514 signed int a2; // [sp+48h] [bp-Ch]@1
1520 int v21; // [sp+4Ch] [bp-8h]@3 1515 int v21; // [sp+4Ch] [bp-8h]@3
1521 unsigned int v22; // [sp+50h] [bp-4h]@1
1522 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 1516 unsigned int pDira; // [sp+5Ch] [bp+8h]@10
1523 1517
1524 v22 = uActorID;
1525 v3 = &pActors[uActorID]; 1518 v3 = &pActors[uActorID];
1526 a2 = edx0; 1519 a2 = edx0;
1527 if ( PID_TYPE(edx0) == OBJECT_Actor) 1520 if ( PID_TYPE(edx0) == OBJECT_Actor)
1528 { 1521 {
1529 v6 = PID_ID(edx0); 1522 v6 = PID_ID(edx0);
1530 v4 = (AIDirection *)pActors[v6].vPosition.x; 1523 v4 = pActors[v6].vPosition.x;
1531 v5 = (AIDirection *)pActors[v6].vPosition.y; 1524 v5 = pActors[v6].vPosition.y;
1532 v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); 1525 v21 = (int)(pActors[v6].uActorHeight * 0.75 + pActors[v6].vPosition.z);
1526 }
1527 else if ( PID_TYPE(edx0) == OBJECT_Player)
1528 {
1529 v4 = pParty->vPosition.x;
1530 v5 = pParty->vPosition.y;
1531 v21 = pParty->vPosition.z + pParty->sEyelevel;
1533 } 1532 }
1534 else 1533 else
1535 { 1534 {
1536 if ( PID_TYPE(edx0) == OBJECT_Player) 1535 Error("Should not get here");
1537 { 1536 return;
1538 v4 = (AIDirection *)pParty->vPosition.x;
1539 v5 = (AIDirection *)pParty->vPosition.y;
1540 v21 = pParty->vPosition.z + pParty->sEyelevel;
1541 }
1542 else
1543 {
1544 v4 = pDir;
1545 v5 = pDir;
1546 }
1547 } 1537 }
1548 v19 = v3->uActorHeight; 1538 v19 = v3->uActorHeight;
1549 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); 1539 v7.z = v3->vPosition.z - (int)(v19 * -0.75);
1550 v7.y = v3->vPosition.y; 1540 v7.y = v3->vPosition.y;
1551 v7.x = v3->vPosition.x; 1541 v7.x = v3->vPosition.x;
1552 if ( sub_407A1C((int)v4, (int)v5, v21, v7) ) 1542 if ( sub_407A1C(v4, v5, v21, v7) )
1553 { 1543 {
1554 v9 = pDir; 1544 if ( pDir == nullptr)
1555 v10 = 0; 1545 {
1556 if ( !pDir ) 1546 v9 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), a2, &a3, 0);
1557 { 1547 }
1558 v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), a2, &a3, 0); 1548 else
1559 v9 = &v18; 1549 {
1560 memcpy(&v18, v11, sizeof(v18)); 1550 v9 = pDir;
1561 v10 = 0; 1551 }
1562 }
1563 v12 = pSpriteFrameTable->pSpriteSFrames;
1564 v3->uYawAngle = LOWORD(v9->uYawAngle); 1552 v3->uYawAngle = LOWORD(v9->uYawAngle);
1565 v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; 1553 v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength;
1566 v14 = v22;
1567 v3->uCurrentActionLength = 8 * v13; 1554 v3->uCurrentActionLength = 8 * v13;
1568 v3->uCurrentActionTime = v10; 1555 v3->uCurrentActionTime = 0;
1569 v3->uAIState = AttackingRanged4; 1556 v3->uAIState = AttackingRanged4;
1570 Actor::PlaySound(v14, 0); 1557 Actor::PlaySound(uActorID, 0);
1571 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
1572 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; 1558 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
1573 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 1559 if (v3->pActorBuffs[7].uExpireTime > 0)
1574 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) 1560 {
1575 { 1561 pDira *= 2;
1576 v15 *= 2;
1577 pDira = v15;
1578 } 1562 }
1579 if ( pParty->bTurnBasedModeOn == 1 ) 1563 if ( pParty->bTurnBasedModeOn == 1 )
1580 v3->pMonsterInfo.uRecoveryTime = v15; 1564 v3->pMonsterInfo.uRecoveryTime = pDira;
1581 else 1565 else
1582 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength 1566 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333);
1583 - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2
1584 * (double)(signed int)pDira
1585 * -2.133333333333333);
1586 v16 = v3->pMonsterInfo.uSpell2ID; 1567 v16 = v3->pMonsterInfo.uSpell2ID;
1587 v3->vVelocity.z = v10; 1568 v3->vVelocity.z = 0;
1588 v3->vVelocity.y = v10; 1569 v3->vVelocity.y = 0;
1589 v3->vVelocity.x = v10; 1570 v3->vVelocity.x = 0;
1590 if ( _42FB5C_check_spell(v16) ) 1571 if ( _42FB5C_check_spell(v16) )
1591 { 1572 {
1592 v3->uCurrentActionLength = 64; 1573 v3->uCurrentActionLength = 64;
1593 v3->uCurrentActionTime = v10; 1574 v3->uCurrentActionTime = 0;
1594 v3->uAIState = Fidgeting; 1575 v3->uAIState = Fidgeting;
1595 v3->UpdateAnimation(); 1576 v3->UpdateAnimation();
1596 v3->uAIState = AttackingRanged4; 1577 v3->uAIState = AttackingRanged4;
1597 } 1578 }
1598 else 1579 else
1599 v3->UpdateAnimation(); 1580 v3->UpdateAnimation();
1600 } 1581 }
1601 else 1582 else
1602 Actor::AI_Pursue1(v22, a2, v22, 64, pDir); 1583 Actor::AI_Pursue1(uActorID, a2, uActorID, 64, pDir);
1603 } 1584 }
1604 1585
1605 //----- (00403854) -------------------------------------------------------- 1586 //----- (00403854) --------------------------------------------------------
1606 void Actor::AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) 1587 void Actor::AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir)
1607 { 1588 {