Mercurial > might-and-magic-trilogy
view Party.cpp @ 20:d3536563ef2d
Удалил файлы .suo и .user
author | Lower |
---|---|
date | Sat, 13 Oct 2012 21:16:44 +0600 |
parents | 540178ef9b18 |
children | 509744251c8e |
line wrap: on
line source
#include "Party.h" #include "MapInfo.h" #include "Time.h" #include "AudioPlayer.h" #include "IconFrameTable.h" #include "Mouse.h" #include "PlayerFrameTable.h" #include "TurnEngine.h" #include "stru279.h" #include "Viewport.h" #include "Actor.h" #include "GUIWindow.h" #include "mm7_data.h" Party *pParty; // idb struct ActionQueue *pPartyActionQueue; //----- (004760C1) -------------------------------------------------------- void ActionQueue::Add(PartyAction action) { if (uNumActions < 30) pActions[uNumActions++] = action; } //----- (00497FC5) -------------------------------------------------------- bool Party::_497FC5_check_party_perception_against_level() { int uMaxPerception; // edi@1 Player *v2; // esi@1 signed int v3; // ebx@1 Player *v4; // ecx@2 signed int v5; // eax@3 bool result; // eax@7 uMaxPerception = 0; v2 = this->pPlayers; v3 = 4; do { if ( v2->CanAct() ) { v5 = v2->GetPerception(); if ( v5 > uMaxPerception ) uMaxPerception = v5; } ++v2; --v3; } while ( v3 ); if ( uLevelMapStatsID && (signed int)uLevelMapStatsID < 77 ) result = uMaxPerception >= 2 * pMapStats->pInfos[uLevelMapStatsID]._per; else result = 0; return result; } //----- (004936E1) -------------------------------------------------------- void Party::SetHoldingItem(ItemGen *pItem) { Party *v2; // esi@1 v2 = this; sub_421B2C_PlaceInInventory_or_DropPickedItem(); memcpy(&v2->pPickedItem, pItem, sizeof(v2->pPickedItem)); pMouse->SetCursorBitmapFromItemID(v2->pPickedItem.uItemID); } //----- (0049370F) -------------------------------------------------------- int Party::GetNextActiveCharacter() { Party *v1; // esi@1 int v2; // eax@4 signed int v4; // ecx@6 char *v5; // edx@6 Player *v6; // eax@7 char *v7; // ecx@23 signed int v8; // esi@23 signed int v9; // edx@23 Player **v10; // edi@23 Player *v11; // eax@24 int v12; // [sp+Ch] [bp-4h]@1 v1 = this; v12 = 0; if ( pParty->bTurnBasedModeOn == 1 ) { if ( pTurnEngine->field_4 != 2 || (pTurnEngine->pQueue[0].uPackedID & 7) != 4 ) return 0; v2 = pTurnEngine->pQueue[0].uPackedID >> 3; return v2 + 1; } v4 = 0; v5 = (char *)&v1->pPlayers[0].uTimeToRecovery; while ( 1 ) { v6 = ::pPlayers[v4 + 1]; if ( v6->pConditions[2] || v6->pConditions[12] || v6->pConditions[13] || v6->pConditions[14] || v6->pConditions[15] || v6->pConditions[16] || *(short *)v5 ) { byte_AE3368[v4] = 1; goto LABEL_21; } if ( !byte_AE3368[v4] ) break; LABEL_21: ++v4; v5 += 6972; if ( v4 >= 4 ) goto LABEL_16; } v12 = v4; byte_AE3368[v4] = 1; LABEL_16: if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] ) memset(byte_AE3368, 0, 4u); v2 = v12; if ( v12 ) return v2 + 1; v7 = (char *)&v1->pPlayers[0].uSpeedBonus; v8 = 0; v9 = 1; v10 = &::pPlayers[1]; while ( 2 ) { v11 = *v10; if ( !(*v10)->pConditions[2] && !v11->pConditions[12] && !v11->pConditions[13] && !v11->pConditions[14] && !v11->pConditions[15] && !v11->pConditions[16] && !*((short *)v7 + 3123) ) { if ( v12 ) { if ( *(short *)v7 > v8 ) { v8 = *(short *)v7; goto LABEL_35; } } else { v8 = *(short *)v7; LABEL_35: v12 = v9; } } ++v10; ++v9; v7 += 6972; if ( v9 - 1 < 4 ) continue; return v12; } } // AE3369: using guessed type char byte_AE3369; // AE336A: using guessed type char byte_AE336A; // AE336B: using guessed type char byte_AE336B; //----- (00493244) -------------------------------------------------------- bool Party::HasItem(unsigned int uItemID) { char *v2; // edx@1 signed int v3; // ecx@2 ItemGen *v4; // eax@2 v2 = (char *)pParty->pPlayers[0].pInventoryItems; while ( 2 ) { v3 = 0; v4 = (ItemGen *)v2; do { if ( v4->uItemID == uItemID ) return 1; ++v3; ++v4; } while ( v3 < 138 ); v2 += 6972; if ( (signed int)v2 < (signed int)&pParty->field_777C[85] ) continue; break; } return 0; } //----- (00492AD5) -------------------------------------------------------- __int16 Party::SetFood(unsigned int uNumFood) { __int16 result; // ax@1 pUIAnim_Food->uAnimTime = 0; pParty->uNumFoodRations = uNumFood; result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; return result; } //----- (00492B03) -------------------------------------------------------- void Party::TakeFood(unsigned int uNumFood) { if ( ((pParty->uNumFoodRations - uNumFood) & 0x80000000u) == 0 ) pParty->uNumFoodRations -= uNumFood; else pParty->uNumFoodRations = 0; pUIAnim_Food->uAnimTime = 0; pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; } //----- (00492B42) -------------------------------------------------------- __int16 Party::GiveFood(unsigned int _this) { __int16 result; // ax@1 pParty->uNumFoodRations += _this; pUIAnim_Food->uAnimTime = 0; result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; return result; } //----- (00492B70) -------------------------------------------------------- void Party::SetGold(unsigned int uNumGold) { pParty->uNumGold = uNumGold; pUIAnim_Gold->uAnimTime = 0; pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); } //----- (00492BB6) -------------------------------------------------------- void Party::TakeGold(unsigned int uNumGold) { if ( uNumGold <= pParty->uNumGold ) pParty->uNumGold -= uNumGold; else pParty->uNumGold = 0; pUIAnim_Gold->uAnimTime = 0; pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); } //----- (0049135E) -------------------------------------------------------- unsigned int Party::GetPartyFame() { signed int v1; // eax@1 char *v2; // ecx@1 signed int v3; // edx@1 v1 = 0; v2 = (char *)&this->pPlayers[0].uExperience; v3 = 4; // (E exp) / 1000 do { v1 += *(int *)v2; v2 += 6972; --v3; } while ( v3 ); return v1 / 1000; } //----- (0049137D) -------------------------------------------------------- void Party::CreateDefaultParty(char bGiveItems) { Party *v2; // esi@1 signed __int16 v3; // ax@1 int v4; // ecx@1 Player *v5; // esi@3 signed int v6; // edx@5 int v7; // eax@5 int uSkillIdx; // eax@11 unsigned __int8 v9; // zf@37 char v10; // sf@37 unsigned __int8 v11; // of@37 char *v12; // eax@38 signed int v13; // ecx@38 int v14; // eax@42 unsigned int v15; // [sp-4h] [bp-44h]@14 unsigned int v16; // [sp-4h] [bp-44h]@26 int v17; // [sp+10h] [bp-30h]@1 int v18; // [sp+14h] [bp-2Ch]@11 signed int v19; // [sp+18h] [bp-28h]@1 ItemGen Dst; // [sp+1Ch] [bp-24h]@10 v2 = this; strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); v2->pPlayers[0].field_1928 = 17; v2->pPlayers[0].uFace = 17; v2->pPlayers[0].field_1924 = 17; v2->pPlayers[0].uVoiceID = 17; v2->pPlayers[0].uMight = 30; v2->pPlayers[0].uIntelligence = 5; v2->pPlayers[0].uWillpower = 5; v2->pPlayers[0].uEndurance = 13; v2->pPlayers[0].uAccuracy = 13; v2->pPlayers[0].uSpeed = 14; v2->pPlayers[0].uLuck = 7; v2->pPlayers[0].pActiveSkills[9] = 1; // leather v2->pPlayers[0].pActiveSkills[33] = 1; // armsmaster v2->pPlayers[0].pActiveSkills[5] = 1; // bow v2->pPlayers[0].pActiveSkills[1] = 1; // sword v2->pPlayers[1].field_1928 = 3; v2->pPlayers[1].uFace = 3; v2->pPlayers[1].field_1924 = 3; v2->pPlayers[1].uVoiceID = 3; strcpy(v2->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); v2->pPlayers[1].uMight = 13; v2->pPlayers[1].uIntelligence = 9; v2->pPlayers[1].uWillpower = 9; v2->pPlayers[1].uEndurance = 13; v2->pPlayers[1].uAccuracy = 13; v2->pPlayers[1].uSpeed = 13; v2->pPlayers[1].uLuck = 13; v2->pPlayers[1].pActiveSkills[9] = 1; // leather v2->pPlayers[1].pActiveSkills[34] = 1; // stealing v2->pPlayers[1].pActiveSkills[2] = 1; // dagger v2->pPlayers[1].pActiveSkills[29] = 1; // disarm trap v2->pPlayers[2].field_1928 = 14; v2->pPlayers[2].uFace = 14; v2->pPlayers[2].field_1924 = 14; v2->pPlayers[2].uVoiceID = 14; strcpy(v2->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); v2->pPlayers[2].uMight = 12; v2->pPlayers[2].uIntelligence = 9; v2->pPlayers[2].uWillpower = 20; v2->pPlayers[2].uEndurance = 22; v2->pPlayers[2].uAccuracy = 7; v2->pPlayers[2].uSpeed = 13; v2->pPlayers[2].uLuck = 7; v2->pPlayers[2].pActiveSkills[35] = 1; // alchemy v2->pPlayers[2].pActiveSkills[9] = 1; // leather v2->pPlayers[2].pActiveSkills[18] = 1; // body v2->pPlayers[2].pActiveSkills[6] = 1; // mace strcpy(v2->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); v3 = 10; v2->pPlayers[3].field_1928 = 10; v2->pPlayers[3].uFace = 10; v4 = (int)&v2->pPlayers[0].sResMagicBase; v2->pPlayers[3].uEndurance = 13; v2->pPlayers[3].uAccuracy = 13; v2->pPlayers[3].uSpeed = 13; v2->pPlayers[3].field_1924 = 10; v2->pPlayers[3].uVoiceID = 10; v2->pPlayers[3].uMight = 5; v2->pPlayers[3].uIntelligence = 30; v2->pPlayers[3].uWillpower = 9; v2->pPlayers[3].uLuck = 7; v2->pPlayers[3].pActiveSkills[9] = 1; // leather v2->pPlayers[3].pActiveSkills[13] = 1; // air v2->pPlayers[3].pActiveSkills[12] = 1; // fire v2->pPlayers[3].pActiveSkills[0] = 1; // staff v17 = (int)&v2->pPlayers[0].sResMagicBase; v19 = 4; while ( 1 ) { v5 = (Player *)(v4 - 6014); if ( !*(char *)(v4 - 5829) ) *(short *)v4 = v3; v6 = 0; v7 = v4 - 5726; while ( !*(short *)v7 ) { ++v6; v7 += 2; if ( v6 >= 9 ) goto LABEL_10; } v5->field_1A4E = v6; LABEL_10: v5->uExpressionTimePassed = 0; Dst.Reset(); if ( bGiveItems ) { pItemsTable->GenerateItem(2, 40, &Dst); v5->AddItem2(0xFFFFFFFFu, &Dst); uSkillIdx = 0; v18 = 0; do { if ( v5->pActiveSkills[uSkillIdx] ) { switch ( uSkillIdx ) { case PLAYER_SKILL_STAFF: v15 = ITEM_STAFF_1; goto wear_item; case PLAYER_SKILL_SWORD: v15 = 1; goto wear_item; case PLAYER_SKILL_DAGGER: v15 = ITEM_DAGGER_1; goto wear_item; case PLAYER_SKILL_AXE: v15 = ITEM_AXE_1; goto wear_item; case PLAYER_SKILL_SPEAR: v15 = ITEM_SPEAR_1; goto wear_item; case PLAYER_SKILL_BOW: v15 = ITEM_CROSSBOW_1; goto wear_item; case PLAYER_SKILL_MACE: v15 = ITEM_MACE_1; goto wear_item; case PLAYER_SKILL_SHIELD: v15 = ITEM_BUCKLER_1; goto wear_item; case PLAYER_SKILL_LEATHER: v15 = ITEM_LEATHER_1; goto wear_item; case PLAYER_SKILL_CHAIN: v15 = ITEM_CHAINMAIL_1; goto wear_item; case PLAYER_SKILL_PLATE: v15 = ITEM_PLATE_1; wear_item: v5->WearItem(v15); break; case PLAYER_SKILL_FIRE: v16 = ITEM_SPELLBOOK_FIRE_STRIKE; goto add_item; case PLAYER_SKILL_AIR: v16 = ITEM_SPELLBOOK_AIR_FEATHER_FALL; goto add_item; case PLAYER_SKILL_WATER: v16 = ITEM_SPELLBOOK_WATER_POISON_SPRAY; goto add_item; case PLAYER_SKILL_EARTH: v16 = ITEM_SPELLBOOK_EARTH_SLOW; goto add_item; case PLAYER_SKILL_SPIRIT: v16 = ITEM_SPELLBOOK_SPIRIT_BLESS; goto add_item; case PLAYER_SKILL_MIND: v16 = ITEM_SPELLBOOK_MIND_MIND_BLAST; goto add_item; case PLAYER_SKILL_BODY: v16 = ITEM_SPELLBOOK_BODY_FIRST_AID; goto add_item; case PLAYER_SKILL_ITEM_ID: case PLAYER_SKILL_REPAIR: case PLAYER_SKILL_MEDITATION: case PLAYER_SKILL_PERCEPTION: case PLAYER_SKILL_DIPLOMACY: case PLAYER_SKILL_TRAP_DISARM: case PLAYER_SKILL_LEARNING: v5->AddItem(0xFFFFFFFFu, ITEM_POTION_BOTTLE); v16 = 5 * (rand() % 3 + 40); // simple reagent goto add_item; case PLAYER_SKILL_DODGE: v16 = ITEM_BOOTS_1; goto add_item; case PLAYER_SKILL_UNARMED: v16 = ITEM_GAUNTLETS_1; add_item: v5->AddItem(0xFFFFFFFFu, v16); break; default: break; } } uSkillIdx = v18 + 1; v11 = __OFSUB__(v18 + 1, 36); v9 = v18 == 35; v10 = v18++ - 35 < 0; } while ( (unsigned __int8)(v10 ^ v11) | v9 ); v12 = (char *)&v5->pInventoryItems[0].uAttributtes; v13 = 138; do { if ( *((int *)v12 - 5) ) *(int *)v12 |= 1u; v12 += 36; --v13; } while ( v13 ); } v5->sHealth = v5->GetMaxHealth(); v14 = v5->GetMaxMana(); v17 += 6972; v9 = v19-- == 1; v5->sMana = v14; if ( v9 ) break; v4 = v17; v3 = 10; } } //----- (004917CE) -------------------------------------------------------- int Party::Reset() { //Party *v1; // esi@1 unsigned __int64 *pTimePlayed; // edi@1 bool v3; // edx@1 Player **v4; // eax@1 Player *v5; // ecx@1 char v6; // cl@3 char v7; // al@6 char v8; // al@9 char v9; // cl@12 Player **v10; // ebx@15 signed int v11; // eax@16 Player *v12; // edx@17 signed int v13; // edi@18 SpellBuff *v14; // ebx@21 signed int v15; // edi@21 char *v16; // esi@23 Player **v17; // esi@23 int v18; // edx@24 Player *v19; // eax@24 //v1 = this; pTimePlayed = &uTimePlayed; //memset(&this->uTimePlayed, 0, 0x1620Cu); field_708 = 15; sEyelevel = 160; LOBYTE(v3) = 1; uFlags2 = 0; uNumGold = 200; uNumGoldInBank = 0; uNumFoodRations = 7; uAlignment = 1; SetUserInterface(1, v3); *((int *)pTimePlayed + 1) = 0; *(int *)pTimePlayed = 0x21C00u; LODWORD(uLastRegenerationTime) = 0x21C00; HIDWORD(uLastRegenerationTime) = 0; bTurnBasedModeOn = 0; uActiveCharacter = 1; ::pPlayers[0] = pPlayers; v4 = &::pPlayers[1]; v5 = pPlayers; do { *v4 = v5; ++v4; ++v5; } while ( (signed int)v4 < (signed int)&qword_A750D8 ); pPlayers[0].Reset(0); pPlayers[0].Reset(4u); pPlayers[0].Reset(0x18u); pPlayers[0].Reset(0x20u); pPlayers[0].uFace = 17; pPlayers[0].field_1924 = 17; pPlayers[0].uVoiceID = 17; pPlayers[0].SetInitialStats(); v6 = 0; switch ( pPlayers[0].uVoiceID ) { case 0u: case 1u: case 2u: case 3u: case 8u: case 9u: case 0xCu: case 0xDu: case 0x10u: case 0x11u: case 0x14u: case 0x17u: v6 = 0; break; case 4u: case 5u: case 6u: case 7u: case 0xAu: case 0xBu: case 0xEu: case 0xFu: case 0x12u: case 0x13u: case 0x15u: case 0x18u: v6 = 1; break; default: break; } pPlayers[0].uSex = v6; pPlayers[0].RandomizeName(); strcpy(pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); pPlayers[1].uFace = 3; pPlayers[1].field_1924 = 3; pPlayers[1].uVoiceID = 3; pPlayers[1].SetInitialStats(); v7 = 0; switch (pPlayers[1].uVoiceID) { case 0u: case 1u: case 2u: case 3u: case 8u: case 9u: case 0xCu: case 0xDu: case 0x10u: case 0x11u: case 0x14u: case 0x17u: v7 = 0; break; case 4u: case 5u: case 6u: case 7u: case 0xAu: case 0xBu: case 0xEu: case 0xFu: case 0x12u: case 0x13u: case 0x15u: case 0x18u: v7 = 1; break; default: break; } pPlayers[1].uSex = v7; pPlayers[1].RandomizeName(); strcpy(pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); pPlayers[2].uFace = 14; pPlayers[2].field_1924 = 14; pPlayers[2].uVoiceID = 14; pPlayers[2].SetInitialStats(); v8 = 0; switch (pPlayers[2].uVoiceID) { case 0u: case 1u: case 2u: case 3u: case 8u: case 9u: case 0xCu: case 0xDu: case 0x10u: case 0x11u: case 0x14u: case 0x17u: v8 = 0; break; case 4u: case 5u: case 6u: case 7u: case 0xAu: case 0xBu: case 0xEu: case 0xFu: case 0x12u: case 0x13u: case 0x15u: case 0x18u: v8 = 1; break; default: break; } pPlayers[2].uSex = v8; pPlayers[2].RandomizeName(); strcpy(pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); pPlayers[3].uFace = 10; pPlayers[3].field_1924 = 10; pPlayers[3].uVoiceID = 10; pPlayers[3].SetInitialStats(); v9 = 0; switch (pPlayers[3].uVoiceID) { case 0u: case 1u: case 2u: case 3u: case 8u: case 9u: case 0xCu: case 0xDu: case 0x10u: case 0x11u: case 0x14u: case 0x17u: v9 = 0; break; case 4u: case 5u: case 6u: case 7u: case 0xAu: case 0xBu: case 0xEu: case 0xFu: case 0x12u: case 0x13u: case 0x15u: case 0x18u: v9 = 1; break; default: break; } pPlayers[3].uSex = v9; pPlayers[3].RandomizeName(); strcpy(pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); v10 = &::pPlayers[1]; do { (*v10)->uTimeToRecovery = 0; v11 = 0; do { v12 = *v10; LODWORD((*v10)->pConditions[v11]) = 0; ++v11; *(int *)((char *)v12 + v11 * 8 - 4) = 0; } while ( v11 < 20 ); v13 = 6048; do { ((SpellBuff *)((char *)*v10 + v13))->Reset(); v13 += 16; } while ( v13 < 6432 ); ++v10; } while ( (signed int)v10 <= (signed int)&pPlayers[4] ); v14 = &pPartyBuffs[1]; v15 = 19; do { v14->Reset(); ++v14; --v15; } while ( v15 ); pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; uFlags = 0; v16 = (char *)_award_bits; _449B7E_toggle_bit(v16, 1, 1u); _449B7E_toggle_bit(v16, 2, 1u); _449B7E_toggle_bit(v16, 3, 1u); _449B7E_toggle_bit(v16, 4, 1u); _449B7E_toggle_bit(v16, 5, 1u); _449B7E_toggle_bit(v16, 6, 1u); v17 = &::pPlayers[1]; do { (*v17)->uExpressionID = 1; (*v17)->uExpressionTimePassed = 0; v18 = rand() % 256; v19 = *v17; ++v17; v19->uExpressionTimeLength = v18 + 128; } while ( (signed int)v17 <= (signed int)&pPlayers[4] ); memcpy(pNPCStats->pNewNPCData, &pNPCStats, 0x94BCu); memcpy(pNPCStats->pGroups_copy, pNPCStats->pGroups, 0x66u); pNPCStats->pNewNPCData[3].uFlags |= 0x80u; _494035_timed_effects__water_walking_damage__etc(); pEventTimer->Pause(); return 0; } //----- (0043AD34) -------------------------------------------------------- void Party::Yell() { void *v0; // esi@5 int v1; // edi@9 int v2; // ebx@9 int v3; // eax@9 unsigned int v4; // [sp+8h] [bp-4h]@4 if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime > 0 ) pParty->pPartyBuffs[11].Reset(); if ( pParty->bTurnBasedModeOn != 1 ) { v4 = 0; if ( (signed int)uNumActors > 0 ) { v0 = &pActors[0].pMonsterInfo.uMovementType; do { if ( ((Actor *)((char *)v0 - 59))->Actor::CanAct() && *((char *)v0 + 2) != 4 && *(char *)v0 != 5 ) { v1 = abs(*(short *)((char *)v0 + 83) - pParty->vPosition.x); v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.z); v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.y); if ( (double)sub_4621DA(v1, v2, v3) < 512.0 ) Actor::_402968(v4, 4, 0, 0); } ++v4; v0 = (char *)v0 + 836; } while ( (signed int)v4 < (signed int)uNumActors ); } } } //----- (00491BF9) -------------------------------------------------------- void Party::ResetPosMiscAndSpellBuffs() { Party *v1; // esi@1 char *v2; // edi@1 SpellBuff *v3; // ebx@2 SpellBuff *v4; // esi@5 signed int v5; // edi@5 signed int v6; // [sp+8h] [bp-8h]@1 signed int v7; // [sp+Ch] [bp-4h]@2 v1 = this; this->vPosition.y = 0; this->vPosition.z = 0; this->vPosition.x = 0; this->uFallStartY = 0; this->sRotationY = 0; this->sRotationX = 0; this->uFallSpeed = 0; this->field_28 = 0; this->uDefaultPartyHeight = 120; this->field_14 = 37; this->field_18 = 25; this->uWalkSpeed = 384; this->field_20_prolly_turn_speed = 90; this->field_24 = 5; this->field_6FC = 0; this->field_708 = 15; this->field_0 = 25; v2 = (char *)this->pPlayers[0].pPlayerBuffs; v6 = 4; do { v3 = (SpellBuff *)v2; v7 = 24; do { v3->Reset(); ++v3; --v7; } while ( v7 ); v2 += 6972; --v6; } while ( v6 ); v4 = v1->pPartyBuffs; v5 = 20; do { v4->Reset(); ++v4; --v5; } while ( v5 ); } //----- (004909F4) -------------------------------------------------------- void Party::_4909F4() { char *v1; // esi@2 unsigned int v2; // eax@3 __int16 v3; // cx@5 int v4; // edx@27 signed int v5; // eax@52 PlayerFrame *v6; // edx@53 char *v7; // esi@60 signed int v8; // ebp@61 int v9; // ebx@62 unsigned int v10; // edi@62 signed int v11; // [sp+0h] [bp-4h]@2 if ( dword_A75070 != stru_51076C.field_8 ) { dword_A75070 = stru_51076C.field_8; v1 = (char *)&this->pPlayers[0].uExpressionID; v11 = 4; do { v2 = ((Player *)(v1 - 6812))->GetMajorConditionrIdx(); if ( v2 == 18 || v2 == 17 ) { *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); if ( *((short *)v1 + 1) >= *((short *)v1 + 2) ) { if ( *(short *)v1 != 1 || rand() % 5 ) { *((short *)v1 + 1) = 0; *(short *)v1 = 1; *((short *)v1 + 2) = rand() % 256 + 32; } else { v4 = rand() % 100; if ( v4 >= 25 ) { if ( v4 >= 31 ) { if ( v4 >= 37 ) { if ( v4 >= 43 ) { if ( v4 >= 46 ) { if ( v4 >= 52 ) { if ( v4 >= 58 ) { if ( v4 >= 64 ) { if ( v4 >= 70 ) { if ( v4 >= 76 ) { if ( v4 >= 82 ) { if ( v4 >= 88 ) *(short *)v1 = (v4 >= 94) + 29; else *(short *)v1 = 57; } else { *(short *)v1 = 56; } } else { *(short *)v1 = 55; } } else { *(short *)v1 = 54; } } else { *(short *)v1 = 20; } } else { *(short *)v1 = 19; } } else { *(short *)v1 = 18; } } else { *(short *)v1 = 17; } } else { *(short *)v1 = 16; } } else { *(short *)v1 = 15; } } else { *(short *)v1 = 14; } } else { *(short *)v1 = 13; } v5 = 0; *((short *)v1 + 1) = 0; if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) { LABEL_56: v5 = 0; } else { v6 = pPlayerFrameTable->pFrames; while ( v6->uSequenceID != *(short *)v1 ) { ++v5; ++v6; if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) goto LABEL_56; } } *((short *)v1 + 2) = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength; } } } else { v3 = *(short *)v1; if ( *(short *)v1 != 34 && v3 != 35 && v3 != 36 || (signed int)(pMiscTimer->uTimeElapsed + *((short *)v1 + 1)) >= *((short *)v1 + 2) ) { *((short *)v1 + 2) = 0; *((short *)v1 + 1) = 0; switch ( v2 ) { case 0xEu: *(short *)v1 = 98; break; case 0xFu: *(short *)v1 = 12; break; case 0x10u: *(short *)v1 = 99; break; case 0u: *(short *)v1 = 2; break; case 1u: *(short *)v1 = 3; break; case 2u: *(short *)v1 = 4; break; case 3u: *(short *)v1 = 5; break; case 4u: *(short *)v1 = 6; break; case 5u: *(short *)v1 = 7; break; case 6u: case 8u: case 0xAu: *(short *)v1 = 8; break; case 7u: case 9u: case 0xBu: *(short *)v1 = 9; break; case 0xCu: *(short *)v1 = 10; break; case 0xDu: *(short *)v1 = 11; break; default: break; } } else { *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); } } v1 += 6972; --v11; } while ( v11 ); v7 = (char *)&pParty->pHirelings[0].evtb; do { v8 = *((int *)v7 + 1); if ( v8 ) { v9 = *((int *)v7 - 1); v10 = pMiscTimer->uTimeElapsed + *(int *)v7; if ( (signed int)v10 >= v8 ) { v9 = 0; v8 = 0; v10 = 0; memset(v7 - 44, 0, 0x4Cu); pParty->field_709 = 0; sub_44A56A(); viewparams->bRedrawGameUI = 1; } *(int *)v7 = v10; *((int *)v7 + 1) = v8; *((int *)v7 - 1) = v9; } v7 += 76; } while ( (signed int)v7 < (signed int)&pParty->field_777C[1] ); } } // A75070: using guessed type int dword_A75070; //----- (00490D02) -------------------------------------------------------- void Party::RestAndHeal() { SpellBuff *v1; // esi@1 Player *v2; // esi@4 signed int v3; // ebx@4 SpellBuff *v4; // edi@4 int v5; // eax@9 char v6; // zf@9 char *v7; // eax@10 signed int v8; // ecx@10 int v9; // eax@18 int v10; // eax@25 signed int v11; // ecx@26 signed int v12; // [sp-4h] [bp-1Ch]@26 Party *v13; // [sp+Ch] [bp-Ch]@1 signed int v14; // [sp+10h] [bp-8h]@10 signed int v15; // [sp+14h] [bp-4h]@3 v13 = this; v1 = pParty->pPartyBuffs; do { v1->Reset(); ++v1; } while ( (signed int)v1 < (signed int)pParty->pPlayers ); v15 = 0; do { v2 = &pParty->pPlayers[v15]; v3 = 20; v4 = v2->pPlayerBuffs; do { v4->Reset(); ++v4; --v3; } while ( v3 ); v2->Zero(); if ( v2->pConditions[14] || v2->pConditions[15] || v2->pConditions[16] ) goto LABEL_33; LODWORD(v2->pConditions[13]) = 0; HIDWORD(v2->pConditions[13]) = 0; LODWORD(v2->pConditions[4]) = 0; HIDWORD(v2->pConditions[4]) = 0; LODWORD(v2->pConditions[2]) = 0; HIDWORD(v2->pConditions[2]) = 0; LODWORD(v2->pConditions[3]) = 0; HIDWORD(v2->pConditions[3]) = 0; LODWORD(v2->pConditions[1]) = 0; HIDWORD(v2->pConditions[1]) = 0; v2->uTimeToRecovery = 0; v2->sHealth = v2->GetMaxHealth(); v5 = v2->GetMaxMana(); v6 = v2->uClass == 35; v2->sMana = v5; if ( v6 ) { v14 = 0; v7 = &v2->pInventoryItems[0].field_1A; v8 = 138; do { if ( *(int *)(v7 - 26) == 601 && (unsigned __int8)*v7 == v15 + 1 ) v14 = 1; v7 += 36; --v8; } while ( v8 ); if ( !v14 ) { v2->sHealth = v2->GetMaxHealth() / 2; v2->sMana = v2->GetMaxMana() / 2; } } if ( !v2->pConditions[17] ) { if ( v2->pConditions[10] || v2->pConditions[11] ) { v11 = 4; v12 = 4; } else { if ( !v2->pConditions[8] && !v2->pConditions[9] ) { if ( !v2->pConditions[6] && !v2->pConditions[7] ) goto LABEL_30; v2->sHealth /= 2; v10 = v2->sMana / 2; goto LABEL_29; } v11 = 3; v12 = 3; } v2->sHealth /= v11; v10 = v2->sMana / v12; LABEL_29: v2->sMana = v10; goto LABEL_30; } v9 = v2->sHealth; v2->sMana = 0; v2->sHealth = v9 / 2; LABEL_30: if ( v2->pConditions[5] ) v2->sMana = 0; _4909F4(); LABEL_33: ++v15; } while ( v15 < 4 ); pParty->field_764 = 0; }