Mercurial > mm7
diff Actor.cpp @ 319:5a66be213cff
Actor::Die
author | Nomad |
---|---|
date | Wed, 20 Feb 2013 02:53:37 +0200 |
parents | 6d584c95dcf8 |
children | 15decc249a94 |
line wrap: on
line diff
--- a/Actor.cpp Wed Feb 20 01:21:59 2013 +0200 +++ b/Actor.cpp Wed Feb 20 02:53:37 2013 +0200 @@ -2178,7 +2178,7 @@ } v15 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v12->uYawAngle); - v16 = v15[v3->pSpriteIDs[2]].uAnimLength; + v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength; v17 = v24; v3->uCurrentActionLength = 8 * v16; v3->uCurrentActionTime = v13; @@ -2575,7 +2575,7 @@ } v12 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[3]].uAnimLength; + v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v14 = v22; v3->uCurrentActionLength = 8 * v13; v3->uCurrentActionTime = v10; @@ -2687,7 +2687,7 @@ } v12 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[3]].uAnimLength; + v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v14 = v22; v3->uCurrentActionLength = 8 * v13; v3->uCurrentActionTime = v10; @@ -2798,7 +2798,7 @@ } v12 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[3]].uAnimLength; + v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v14 = v21; v3->uCurrentActionLength = 8 * v13; v3->uCurrentActionTime = v10; @@ -2902,7 +2902,7 @@ } v13 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v10->uYawAngle); - v14 = v13[v3->pSpriteIDs[3]].uAnimLength; + v14 = v13[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v15 = v21; v3->uCurrentActionLength = 8 * v14; v3->uCurrentActionTime = v11; @@ -3111,7 +3111,7 @@ memcpy(&v10, Actor::GetDirectionInfo(8 * v3 | 3, a2, &a3, 0), sizeof(v10)); v6 = pSpriteFrameTable->pSpriteSFrames; v4->uYawAngle = LOWORD(v10.uYawAngle); - v7 = v6[v4->pSpriteIDs[4]].uAnimLength; + v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength; v8 = v11; v4->uCurrentActionTime = 0; v4->uAIState = Stunned; @@ -3153,7 +3153,7 @@ } v6 = pSpriteFrameTable->pSpriteSFrames; v5->uYawAngle = LOWORD(v4->uYawAngle); - v5->uCurrentActionLength = 8 * v6[v5->pSpriteIDs[7]].uAnimLength; + v5->uCurrentActionLength = 8 * v6[v5->pSpriteIDs[ANIM_Bored]].uAnimLength; v7 = stru_5C6E00->Atan2(v5->vPosition.x - pIndoorCamera->pos.x, v5->vPosition.y - pIndoorCamera->pos.y); LOWORD(v8) = v5->uYawAngle; v9 = stru_5C6E00->uIntegerPi + v8 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7; @@ -3184,7 +3184,7 @@ pActor = &pActors[uActorID]; v2 = pSpriteFrameTable->pSpriteSFrames; - v3 = pActor->pSpriteIDs[5]; + v3 = pActor->pSpriteIDs[ANIM_Dying]; pActor->uCurrentActionTime = 0; pActor->uAIState = Resurrected; pActor->uCurrentActionAnimation = ANIM_Dying; @@ -3196,237 +3196,65 @@ //----- (00402D6E) -------------------------------------------------------- -void __fastcall Actor::Die(unsigned int uActorID) +void Actor::Die(unsigned int uActorID) { - Actor *v1; // esi@1 - SpriteFrame *v2; // ecx@1 - int v3; // eax@1 - int v4; // ecx@1 - char *v5; // eax@1 - SpellBuff *v6; // edi@5 - signed int v7; // ebx@5 - MONSTER_TYPE v8; // eax@7 - int v9; // eax@23 - ItemGen _this; // [sp+8h] [bp-28h]@7 - unsigned int v11; // [sp+2Ch] [bp-4h]@1 + auto actor = &pActors[uActorID]; - v1 = &pActors[uActorID]; - v11 = uActorID; - v2 = pSpriteFrameTable->pSpriteSFrames; - v3 = 60 * v1->pSpriteIDs[5]; - v1->uCurrentActionTime = 0; - v1->uAIState = Dying; - v1->uCurrentActionAnimation = ANIM_Dying; - LOWORD(v3) = *(__int16 *)((char *)&v2->uAnimLength + v3); - v1->sCurrentHP = 0; - v1->uCurrentActionLength = 8 * v3; - v1->pActorBuffs[6].Reset(); - v1->pActorBuffs[5].Reset(); - Actor::PlaySound(v11, 1u); - v1->UpdateAnimation(); - v4 = v1->pMonsterInfo.uID; - v5 = (char *)pParty->field_75A; - do - { - if ( v4 == *((short *)v5 - 5) ) - *(short *)v5 = 1; - v5 += 2; - } - while ( (signed int)v5 < (signed int)&pParty->field_764 ); - v6 = v1->pActorBuffs; - v7 = 22; - do - { - v6->Reset(); - ++v6; - --v7; - } - while ( v7 ); - _this.Reset(); - v8 = (MONSTER_TYPE)v1->pMonsterInfo.uID; - if ( v8 > MONSTER_HARPY_3 ) + actor->uCurrentActionTime = 0; + actor->uAIState = Dying; + actor->uCurrentActionAnimation = ANIM_Dying; + actor->sCurrentHP = 0; + actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Dying]].uAnimLength; + actor->pActorBuffs[6].Reset(); + actor->pActorBuffs[5].Reset(); + Actor::PlaySound(uActorID, 1); + actor->UpdateAnimation(); + + for (uint i = 0; i < 5; ++i) + if (pParty->field_750[i] == actor->pMonsterInfo.uID) + pParty->field_75A[i] = true; + + for (uint i = 0; i < 22; ++i) + actor->pActorBuffs[i].Reset(); + + ItemGen drop; + switch (actor->pMonsterInfo.uID) { - if ( v8 < MONSTER_OOZE_1 ) - { - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( v8 <= MONSTER_OOZE_3 ) - { - _this.uItemID = ITEM_OOZE_ECTOPLASM_BOTTLE; - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( v8 <= MONSTER_PEASANT_GOBLIN_MALE_3_3 || v8 > MONSTER_TROLL_3 ) - { - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - _this.uItemID = ITEM_TROLL_BLOOD; + case MONSTER_HARPY_1: case MONSTER_HARPY_2: case MONSTER_HARPY_3: + drop.uItemID = ITEM_HARPY_FEATHER; + break; + + case MONSTER_OOZE_1: case MONSTER_OOZE_2: case MONSTER_OOZE_3: + drop.uItemID = ITEM_OOZE_ECTOPLASM_BOTTLE; + break; + + case MONSTER_TROLL_1: case MONSTER_TROLL_2: case MONSTER_TROLL_3: + drop.uItemID = ITEM_TROLL_BLOOD; + break; + + case MONSTER_DEVIL_1: case MONSTER_DEVIL_2: case MONSTER_DEVIL_3: + drop.uItemID = ITEM_DEVIL_ICHOR; + break; + + case MONSTER_DRAGON_1: case MONSTER_DRAGON_2: case MONSTER_DRAGON_3: + drop.uItemID = ITEM_DRAGON_EYE; } - else + + if (rand() % 100 < 20) { - if ( v8 >= MONSTER_HARPY_1 ) - { - _this.uItemID = ITEM_HARPY_FEATHER; - } - else - { - if ( v8 < MONSTER_DEVIL_1 ) - { - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( v8 > MONSTER_DEVIL_3 ) - { - if ( v8 <= MONSTER_DRAGON_3 ) - { - _this.uItemID = ITEM_DRAGON_EYE; - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - _this.uItemID = ITEM_DEVIL_ICHOR; - } - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, + sub_42F7EB_DropItemAt(pItemsTable->pItems[drop.uItemID].uSpriteID, + actor->vPosition.x, + actor->vPosition.y, + actor->vPosition.z + 16, + rand() % 200 + 200, 1, 1, 0, - &_this); + &drop); } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); + + if (actor->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE) + Actor::Explode(uActorID); } //----- (00402CED) -------------------------------------------------------- @@ -4129,7 +3957,7 @@ this->uAttributes = result; break; case Dead: - result = 60 * this->pSpriteIDs[6]; + result = 60 * this->pSpriteIDs[ANIM_Dead]; if ( *(__int16 *)((char *)pSpriteFrameTable->pSpriteSFrames->pHwSpriteIDs + result) <= 0 ) this->uAIState = Removed; else