Mercurial > mm7
changeset 2378:48dbf99c0f7f
spawn_light_elemental cleaned
author | Ritor1 |
---|---|
date | Mon, 09 Jun 2014 16:26:07 +0600 |
parents | 6eb63623cbe8 |
children | 56f87a5c402b |
files | Actor.cpp Build/Visual Studio 2010/World of Might and Magic.vcxproj Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Items.cpp OurMath.cpp Texture.cpp UI/UICharacter.cpp Vis.cpp |
diffstat | 8 files changed, 130 insertions(+), 254 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Jun 02 12:31:28 2014 +0600 +++ b/Actor.cpp Mon Jun 09 16:26:07 2014 +0600 @@ -240,18 +240,13 @@ int v48; // ecx@110 int v51; // ecx@130 int v54; // ecx@138 - //Player *v57; // esi@145 - //int v58; // eax@146 int v59; // edi@146 - //int v60; // eax@146 int v61; // edi@146 - //int v62; // eax@146 signed int v63; // edi@146 int v68; // edi@168 signed int v70; // ecx@172 int v79; // edx@185 int v80; // eax@185 - //signed int v89; // ecx@192 signed int v91; // eax@200 int v94; // ecx@208 int v96; // ecx@217 @@ -706,11 +701,13 @@ unsigned int v3; // edi@1 v2 = a1->uAlly; - v3 = a2->uAlly; - if ( !v2 ) + if ( !a1->uAlly ) v2 = (a1->pMonsterInfo.uID - 1) / 3 + 1; - if ( !v3 ) + + v3 = a2->uAlly; + if ( !a2->uAlly ) v3 = (a2->pMonsterInfo.uID - 1) / 3 + 1; + if ( v2 >= 39 && v2 <= 44 && v3 >= 39 && v3 <= 44 || v2 >= 45 && v2 <= 50 && v3 >= 45 && v3 <= 50 || v2 >= 51 && v2 <= 62 && v3 >= 51 && v3 <= 62 @@ -760,12 +757,9 @@ //----- (00404874) -------------------------------------------------------- void Actor::AI_RangedAttack( unsigned int uActorID, struct AIDirection *pDir, int type, char a4 ) { - //Actor *actPtr; // esi@1 char specAb; // al@1 int v13; // edx@28 - //actPtr = &pActors[uActorID]; - SpriteObject a1; // [sp+Ch] [bp-74h]@1 switch ( type ) @@ -825,12 +819,12 @@ return; } a1.stru_24.Reset(); + a1.spell_id = 0; a1.vPosition.x = pActors[uActorID].vPosition.x; - a1.spell_id = 0; a1.vPosition.y = pActors[uActorID].vPosition.y; + a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75); a1.spell_level = 0; a1.spell_skill = 0; - a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75); a1.uFacing = pDir->uYawAngle; a1.uSoundID = 0; a1.uAttributes = 0; @@ -1103,7 +1097,6 @@ { AIDirection *v7; // eax@3 AIDirection v1; // eax@3 - //Actor *v9; // ebx@3 AIDirection a3; // [sp+8h] [bp-38h]@4 if ( rand() % 100 >= 5 ) @@ -1133,7 +1126,8 @@ //----- (00403F58) -------------------------------------------------------- void Actor::AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4) { - if (rand() % 2) + //движется или стоит определяется случайно(1 - движется, 0 - стоит) + if (rand() % 2)//0 or 1 AI_Bored(uActorID, uObjID, a4); else AI_Stand(uActorID, uObjID, uActionLength, a4); @@ -1154,7 +1148,7 @@ pActors[uActorID].uAIState = Standing; if (!uActionLength) - pActors[uActorID].uCurrentActionLength = rand() % 256 + 256; + pActors[uActorID].uCurrentActionLength = rand() % 256 + 256;// от 256 до 256 + 256 else pActors[uActorID].uCurrentActionLength = uActionLength; pActors[uActorID].uCurrentActionTime = 0; @@ -1181,7 +1175,7 @@ //----- (00403C6C) -------------------------------------------------------- void Actor::AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) { - Actor *v3; // ebx@1 + //Actor *v3; // ebx@1 int16_t v6; // esi@6 int16_t v7; // edi@6 signed int v8; // eax@7 @@ -1192,8 +1186,10 @@ int v23; // [sp+4Ch] [bp-8h]@6 unsigned int v25; // [sp+5Ch] [bp+8h]@13 - v3 = &pActors[uActorID]; - if ( v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY && v3->pMonsterInfo.uAIType == 1 ) + assert(uActorID < uNumActors); + + //v3 = &pActors[uActorID]; + if ( pActors[uActorID].pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY && pActors[uActorID].pMonsterInfo.uAIType == 1 ) { Actor::AI_Stand(uActorID, sTargetPid, 0, arg0); return; @@ -1217,9 +1213,10 @@ Error("Should not get here"); return; } - v10.z = (int32_t)(v3->uActorHeight * 0.75 + v3->vPosition.z); - v10.y = v3->vPosition.y; - v10.x = v3->vPosition.x; + + v10.x = pActors[uActorID].vPosition.x; + v10.y = pActors[uActorID].vPosition.y; + v10.z = (int32_t)(pActors[uActorID].uActorHeight * 0.75 + pActors[uActorID].vPosition.z); if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) { @@ -1230,22 +1227,22 @@ Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0); v12 = &a3; } - v3->uYawAngle = LOWORD(v12->uYawAngle); - v3->uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8; - v3->uCurrentActionTime = 0; - v3->uAIState = AttackingMelee; + pActors[uActorID].uYawAngle = LOWORD(v12->uYawAngle); + pActors[uActorID].uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[pActors[uActorID].pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8; + pActors[uActorID].uCurrentActionTime = 0; + pActors[uActorID].uAIState = AttackingMelee; Actor::PlaySound(uActorID, 0); - v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) + v25 = pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].uRecoveryTime; + if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) v25 *= 2; if ( pParty->bTurnBasedModeOn != 1 ) - v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); + pActors[uActorID].pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); else - v3->pMonsterInfo.uRecoveryTime = v25; - v3->vVelocity.z = 0; - v3->vVelocity.y = 0; - v3->vVelocity.x = 0; - v3->UpdateAnimation(); + pActors[uActorID].pMonsterInfo.uRecoveryTime = v25; + pActors[uActorID].vVelocity.z = 0; + pActors[uActorID].vVelocity.y = 0; + pActors[uActorID].vVelocity.x = 0; + pActors[uActorID].UpdateAnimation(); } else Actor::AI_Pursue1(uActorID, sTargetPid, rand() % 2, 64, arg0); @@ -4541,51 +4538,19 @@ //----- (004016FA) -------------------------------------------------------- int Actor::MakeActorAIList_BLV() { - //Actor *v0; // esi@2 int v1; // eax@4 - // int v2; // ebx@4 - // unsigned int v3; // ecx@4 - // int v4; // edx@5 - // int v5; // edx@7 - // unsigned int v6; // edx@9 - unsigned int v7; // ST24_4@10 - // int v8; // eax@10 int v9; // edi@10 - // int v10; // ebx@14 - // char v11; // zf@16 - int v12; // eax@22 int v13; // edx@24 - // int v14; // ecx@25 - int v15; // ebx@26 - // unsigned int *v16; // ecx@27 - unsigned int v17; // esi@27 int v18; // ecx@31 signed int v19; // edi@31 - // Actor *v20; // esi@32 - // bool v21; // eax@33 - // int v22; // eax@34 - // signed int v23; // ebx@36 - // Actor *v24; // esi@37 signed int v25; // eax@40 - // int v26; // eax@43 - int v27; // ebx@45 int j; // edi@45 - // unsigned int v29; // eax@46 int v30; // eax@48 - // int v31; // ecx@51 - // int v32; // eax@51 - // signed int v33; // eax@53 - // __int64 v34; // qax@55 - // char *v35; // ecx@56 int v37; // [sp+Ch] [bp-18h]@1 int v38; // [sp+10h] [bp-14h]@4 int v39; // [sp+14h] [bp-10h]@4 - //int v40; // [sp+18h] [bp-Ch]@10 - // int v41; // [sp+18h] [bp-Ch]@29 int i; // [sp+18h] [bp-Ch]@31 - //signed int v43; // [sp+1Ch] [bp-8h]@1 - // signed int v44; // [sp+1Ch] [bp-8h]@25 - int v45; // [sp+20h] [bp-4h]@1 + uint v45; // [sp+20h] [bp-4h]@1 // __debugbreak(); // refactor for blv ai pParty->uFlags &= 0xFFFFFFCFu; @@ -4599,11 +4564,11 @@ pActors[i].uAttributes &= 0xBF00; continue; } - v39 = abs(pParty->vPosition.z - pActors[i].vPosition.z); + v1 = abs(pParty->vPosition.x - pActors[i].vPosition.x); v38 = abs(pParty->vPosition.y - pActors[i].vPosition.y); - v1 = abs(pParty->vPosition.x - pActors[i].vPosition.x); - v7 = int_get_vector_length(v39, v38, v1); - v9 = v7 - pActors[i].uActorRadius; + v39 = abs(pParty->vPosition.z - pActors[i].vPosition.z); + + v9 = int_get_vector_length(v39, v38, v1) - pActors[i].uActorRadius; if ( v9 < 0 ) v9 = 0; if ( v9 < 10240 ) @@ -4617,9 +4582,9 @@ if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) pParty->uFlags |= 0x20; } - v12 = v45++; - ai_near_actors_distances[v12] = v9; - ai_near_actors_ids[v12] = i; + ai_near_actors_distances[v45] = v9; + ai_near_actors_ids[v45] = i; + v45++; } else pActors[i].uAttributes &= 0xBF00; @@ -4631,14 +4596,12 @@ { for ( uint j = 1; j < v45; ++j ) { - v15 = ai_near_actors_distances[v13]; if ( ai_near_actors_distances[v13] > ai_near_actors_distances[j] ) { - v17 = ai_near_actors_ids[v13]; ai_near_actors_ids[v13] = ai_near_actors_ids[j]; - ai_near_actors_ids[j] = v17; + ai_near_actors_ids[j] = ai_near_actors_ids[v13]; ai_near_actors_distances[v13] = ai_near_actors_distances[j]; - ai_near_actors_distances[j] = v15; + ai_near_actors_distances[j] = ai_near_actors_distances[v13]; } } ++v13; @@ -4687,21 +4650,19 @@ } } } - v27 = ai_arrays_size; for ( j = 0; j < v45; ++j ) { - //v29 = ai_near_actors_ids[j]; if ( pActors[ai_near_actors_ids[j]].uAttributes & 0xC000 && pActors[ai_near_actors_ids[j]].CanAct() ) { v30 = 0; - if ( v27 <= 0 ) + if ( ai_arrays_size <= 0 ) ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j]; else { while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] ) { ++v30; - if ( v30 >= v27 ) + if ( v30 >= ai_arrays_size ) { ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j]; break; @@ -4724,20 +4685,13 @@ bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID) { signed int v2; // eax@1 -// int v5; // ecx@2 int obj1_sector; // eax@4 float v8; // ST24_4@5 -// double v9; // ST18_8@5 -// int v11; // ecx@6 signed int v12; // eax@7 -// int v13; // esi@7 -// int v14; // esi@8 -// int v15; // esi@9 int obj2_z; // edi@11 int obj2_x; // esi@11 int obj2_sector; // eax@13 float v20; // ST24_4@14 -// double v21; // ST18_8@14 int dist_x; // ebx@16 signed int dist_3d; // ecx@16 int v25; // eax@18 @@ -4748,10 +4702,7 @@ int v33; // ST54_4@44 int v34; // eax@44 signed int v38; // esi@45 -// signed __int64 v40; // qtt@50 __int16 next_sector; // bx@58 -// int v43; // [sp-8h] [bp-70h]@11 -// int v44; // [sp-4h] [bp-6Ch]@11 int v47; // [sp+18h] [bp-50h]@20 int v48; // [sp+1Ch] [bp-4Ch]@20 int v49; // [sp+20h] [bp-48h]@20 @@ -4909,8 +4860,9 @@ } v32 = fixpoint_mul(v29->pFacePlane_old.vNormal.x,v49); + v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48); v33 = fixpoint_mul(v29->pFacePlane_old.vNormal.z,v47); - v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48); + v59 = v32 + v33 + v34; if ( v59 ) { @@ -4989,35 +4941,27 @@ { unsigned int v1; // ebx@1 bool result; // eax@2 - MonsterDesc *v3; // esi@5 - MonsterInfo *v4; // edi@5 - Vec3_int_ v5; // ST08_12@5 unsigned int v6; // ecx@5 - Actor *v7; // eax@7 Actor actor; // [sp+4h] [bp-350h]@5 Vec3_int_ pOut; // [sp+348h] [bp-Ch]@5 v1 = uMonsterID; if ( uNumActors == 499 ) - { result = 0; - } else { if ( (signed int)uMonsterID >= (signed int)pMonsterList->uNumMonsters ) v1 = 0; - v3 = &pMonsterList->pMonsters[v1]; - v4 = &pMonsterStats->pInfos[v1 + 1]; - memset(&actor, 0, 0x344u); - strcpy(actor.pActorName, v4->pName); - actor.sCurrentHP = LOWORD(v4->uHP); - memcpy(&actor.pMonsterInfo, &pMonsterStats->pInfos[v1 + 1], 0x58u); + memset(&actor, 0, sizeof(Actor)); + strcpy(actor.pActorName, pMonsterStats->pInfos[v1 + 1].pName); + actor.sCurrentHP = LOWORD(pMonsterStats->pInfos[v1 + 1].uHP); + memcpy(&actor.pMonsterInfo, &pMonsterStats->pInfos[v1 + 1], sizeof(MonsterInfo)); actor.word_000086_some_monster_id = v1 + 1; - actor.uActorRadius = v3->uMonsterRadius; - actor.uActorHeight = v3->uMonsterHeight; - actor.uMovementSpeed = v3->uMovementSpeed; - v5 = pParty->vPosition; - Vec3_int_::Rotate(200, pParty->sRotationY, 0, v5, &pOut.x, &pOut.z, &pOut.y); + actor.uActorRadius = pMonsterList->pMonsters[v1].uMonsterRadius; + actor.uActorHeight = pMonsterList->pMonsters[v1].uMonsterHeight; + actor.uMovementSpeed = pMonsterList->pMonsters[v1].uMovementSpeed; + + Vec3_int_::Rotate(200, pParty->sRotationY, 0, pParty->vPosition, &pOut.x, &pOut.z, &pOut.y); actor.vInitialPosition.x = pOut.x; actor.vPosition.x = pOut.x; actor.uTetherDistance = 256; @@ -5033,9 +4977,8 @@ dword_5C6DF8 = 0; v6 = uNumActors++; } - v7 = &pActors[v6]; - memcpy(v7, &actor, 0x344u); - v7->PrepareSprites(1); + memcpy(&pActors[v6], &actor, sizeof(Actor)); + pActors[v6].PrepareSprites(1); result = 1; } return result; @@ -5046,163 +4989,99 @@ //----- (0044FA4C) -------------------------------------------------------- signed int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3) { - signed int v3; // ecx@6 - Actor *v4; // edx@7 signed int result; // eax@13 - Actor *v6; // esi@16 - char *v7; // ebx@16 - MonsterDesc *v8; // edi@16 - unsigned __int16 v9; // ax@16 int v10; // ebx@16 - //int v11; // edi@16 - //int v12; // eax@16 - //int v13; // ecx@16 - //int v14; // ebx@16 const char *v15; // [sp-4h] [bp-24h]@2 - //unsigned __int16 v16; // [sp+0h] [bp-20h]@1 - //int v17; // [sp+4h] [bp-1Ch]@1 unsigned int uFaceID; // [sp+8h] [bp-18h]@16 int v19; // [sp+Ch] [bp-14h]@16 size_t v20; // [sp+10h] [bp-10h]@6 int v21; // [sp+14h] [bp-Ch]@14 - //int v22; // [sp+18h] [bp-8h]@14 unsigned int v23; // [sp+1Ch] [bp-4h]@6 - //v16 = a2; - //v17 = a1; if ( a2 == 4 ) - { v15 = "Elemental Light C"; - } else if ( a2 == 3 ) v15 = "Elemental Light B"; else v15 = "Elemental Light A"; v23 = pMonsterList->GetMonsterIDByName(v15); - v3 = 0; - v20 = uNumActors; - if ( (signed int)uNumActors > 0 ) + v20 = 0; + for ( v20; v20 < uNumActors; v20++ ) { - v4 = pActors.data();//[0].uAIState; - while ( v4->uAIState != Removed ) - { - ++v3; - ++v4; - if ( v3 >= (signed int)uNumActors ) - break; - } - if( v3 < (signed int)uNumActors ) - v20 = v3; + if ( pActors[v20].uAIState == Removed ) + break; } - if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) + + result = uNumActors + 1; + if ( v20 != uNumActors || result < 500 ) { v21 = 0; - //v22 = pParty->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); - v6 = &pActors[v20]; - v7 = (char *)&pMonsterStats->pInfos[v23 + 1]; v19 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; - v6->Reset(); - v8 = &pMonsterList->pMonsters[v23]; - strcpy(v6->pActorName, *(const char **)v7); - v6->sCurrentHP = *((short *)v7 + 32); - memcpy(&v6->pMonsterInfo, v7, 0x58u); - v6->word_000086_some_monster_id = v23 + 1; - v6->uActorRadius = v8->uMonsterRadius; - v6->uActorHeight = v8->uMonsterHeight; - v9 = v8->uMovementSpeed; - v6->pMonsterInfo.uTreasureDiceRolls = 0; - v6->pMonsterInfo.uTreasureType = 0; - v6->pMonsterInfo.uExp = 0; - v6->uMovementSpeed = v9; + pActors[v20].Reset(); + strcpy(pActors[v20].pActorName, pMonsterStats->pInfos[v23 + 1].pName); + pActors[v20].sCurrentHP = pMonsterStats->pInfos[v23 + 1].uHP; + memcpy(&pActors[v20].pMonsterInfo, &pMonsterStats->pInfos[v23 + 1], sizeof(MonsterInfo)); + pActors[v20].word_000086_some_monster_id = v23 + 1; + pActors[v20].uActorRadius = pMonsterList->pMonsters[v23].uMonsterRadius; + pActors[v20].uActorHeight = pMonsterList->pMonsters[v23].uMonsterHeight; + pActors[v20].pMonsterInfo.uTreasureDiceRolls = 0; + pActors[v20].pMonsterInfo.uTreasureType = 0; + pActors[v20].pMonsterInfo.uExp = 0; + pActors[v20].uMovementSpeed = pMonsterList->pMonsters[v23].uMovementSpeed; v10 = rand() % 2048; - //v11 = pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v10), v19); - uFaceID = stru_5C6E00->Sin(v10); - //v12 = pParty->vPosition.y; - //v13 = fixpoint_mul(uFaceID, v19); - //v14 = pParty->vPosition.y + fixpoint_mul(uFaceID, v19); - //LOWORD(v12) = v22; - v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v10), v19); - v6->vPosition.x = v6->vInitialPosition.x; - v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_mul(uFaceID, v19); - v6->vPosition.y = v6->vInitialPosition.y; - v6->vInitialPosition.z = pParty->vPosition.z; - v6->vPosition.z = v6->vInitialPosition.z; - //LOWORD(v12) = v21; - v6->uTetherDistance = 256; - v6->uSectorID = v21; - v6->PrepareSprites(0); - v6->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - v6->uAlly = 9999; - v6->uGroup = 0; - v6->uCurrentActionTime = 0; - v6->uAIState = Summoned; - v6->uCurrentActionLength = 256; - v6->UpdateAnimation(); + pActors[v20].vInitialPosition.x = pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v10), v19); + pActors[v20].vPosition.x = pActors[v20].vInitialPosition.x; + pActors[v20].vInitialPosition.y = pParty->vPosition.y + fixpoint_mul(stru_5C6E00->Sin(v10), v19); + pActors[v20].vPosition.y = pActors[v20].vInitialPosition.y; + pActors[v20].vInitialPosition.z = pParty->vPosition.z; + pActors[v20].vPosition.z = pActors[v20].vInitialPosition.z; + pActors[v20].uTetherDistance = 256; + pActors[v20].uSectorID = v21; + pActors[v20].PrepareSprites(0); + pActors[v20].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + pActors[v20].uAlly = 9999; + pActors[v20].uGroup = 0; + pActors[v20].uCurrentActionTime = 0; + pActors[v20].uAIState = Summoned; + pActors[v20].uCurrentActionLength = 256; + pActors[v20].UpdateAnimation(); + + result = pIndoor->GetSector(pActors[v20].vPosition.x, pActors[v20].vPosition.y, pActors[v20].vPosition.z); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor - || (result = pIndoor->GetSector(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z), - result == v21) - && (result = BLV_GetFloorLevel(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z, result, &uFaceID), result != -30000) + || result == v21 + && (result = BLV_GetFloorLevel(pActors[v20].vPosition.x, pActors[v20].vPosition.y, pActors[v20].vPosition.z, result, &uFaceID), result != -30000) && (result = abs(result - pParty->vPosition.z), result <= 1024) ) { if ( v20 == uNumActors ) ++uNumActors; - v6->uSummonerID = PID(OBJECT_Player, a1); - result = v6->pActorBuffs[ACTOR_BUFF_SUMMONED].Apply(pParty->uTimePlayed + (a3 * 128) / 30.0f, - a2, - a1, - 0, - 0); + pActors[v20].uSummonerID = PID(OBJECT_Player, a1); + result = pActors[v20].pActorBuffs[ACTOR_BUFF_SUMMONED].Apply(pParty->uTimePlayed + (a3 * 128) / 30.0f, a2, a1, 0, 0); } } return result; } - //----- (0044F57C) -------------------------------------------------------- void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5) { - //MapInfo *v5; // esi@1 - //SpawnPointMM7 *v6; // ebx@1 int v7; // eax@2 char v8; // zf@5 - // int v9; // edi@9 - // int v10; // eax@9 - // int v11; // ecx@9 int v12; // edx@9 - // int v13; // eax@9 - // int v14; // eax@14 - // int v15; // ecx@14 - // int v16; // eax@19 - // int v17; // ecx@19 int v18; // esi@31 - //int pPosX; // ecx@32 - //int v20; // edx@32 - //int v21; // eax@32 Actor *pMonster; // esi@35 int v23; // edx@36 signed int v24; // edi@36 int v25; // ecx@36 - // unsigned __int16 v26; // ax@47 MonsterDesc *v27; // edi@48 signed int v28; // eax@48 - // __int16 v29; // cx@50 - // __int16 v30; // ax@50 - // __int16 v31; // ax@50 int v32; // eax@50 - // int v33; // edi@50 - // int v34; // eax@50 - // int v35; // eax@50 - // int v36; // eax@50 int v37; // eax@51 int v38; // eax@52 int v39; // edi@52 std::string v40; // [sp-18h] [bp-100h]@60 - // void *v41; // [sp-14h] [bp-FCh]@50 - //void *v42; // [sp-10h] [bp-F8h]@50 - //size_t v43; // [sp-Ch] [bp-F4h]@50 const char *v44; // [sp-8h] [bp-F0h]@13 char *pTexture; // [sp-4h] [bp-ECh]@9 char Str[32]; // [sp+Ch] [bp-DCh]@60 @@ -5355,9 +5234,7 @@ v24 = 2; } else - { v24 = 1; - } if ( v24 == 1 ) { pTexture = Source;
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Mon Jun 02 12:31:28 2014 +0600 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Mon Jun 09 16:26:07 2014 +0600 @@ -227,6 +227,7 @@ <ClCompile Include="..\..\UI\Books\UIMapBook.cpp" /> <ClCompile Include="..\..\UI\Books\UINotesBooks.cpp" /> <ClCompile Include="..\..\UI\Books\UISpellBook.cpp" /> + <ClCompile Include="..\..\UI\UIArena.cpp" /> <ClCompile Include="..\..\UI\UIBooks.cpp" /> <ClCompile Include="..\..\UI\UICharacter.cpp" /> <ClCompile Include="..\..\UI\UiGame.cpp" /> @@ -479,6 +480,7 @@ <ClInclude Include="..\..\TileFrameTable.h" /> <ClInclude Include="..\..\Timer.h" /> <ClInclude Include="..\..\TurnEngine.h" /> + <ClInclude Include="..\..\UI\UIArena.h" /> <ClInclude Include="..\..\UI\UIBooks.h" /> <ClInclude Include="..\..\UI\UIHouses.h" /> <ClInclude Include="..\..\VectorTypes.h" />
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Mon Jun 02 12:31:28 2014 +0600 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Mon Jun 09 16:26:07 2014 +0600 @@ -530,6 +530,9 @@ <ClInclude Include="..\..\ZlibWrapper.h" /> <ClInclude Include="..\..\GUIButton.h" /> <ClInclude Include="..\..\Registry.h" /> + <ClInclude Include="..\..\UI\UIArena.h"> + <Filter>UI</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <Filter Include="lib"> @@ -959,6 +962,9 @@ <ClCompile Include="..\..\ZlibWrapper.cpp" /> <ClCompile Include="..\..\OurMath.cpp" /> <ClCompile Include="..\..\Registry.cpp" /> + <ClCompile Include="..\..\UI\UIArena.cpp"> + <Filter>UI</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <CustomBuild Include="..\..\NewUI\Core\UIControlModule.swig">
--- a/Items.cpp Mon Jun 02 12:31:28 2014 +0600 +++ b/Items.cpp Mon Jun 09 16:26:07 2014 +0600 @@ -1199,7 +1199,7 @@ } } - v46 = rand()%spc_sum+1; + v46 = rand()%spc_sum+1;//случайные значения от 1 до spc_sum j=0; v45 = 0; while (v45<v46)
--- a/OurMath.cpp Mon Jun 02 12:31:28 2014 +0600 +++ b/OurMath.cpp Mon Jun 09 16:26:07 2014 +0600 @@ -204,10 +204,13 @@ //----- (00452A9E) -------------------------------------------------------- int integer_sqrt(int val) { +/////////////////////////////// +//Получение квадратного корня// +/////////////////////////////// + signed int result; // eax@2 unsigned int v2; // edx@3 unsigned int v3; // edi@3 - //signed int v4; // ebx@3 int v5; // esi@4 if (val < 1) @@ -216,7 +219,6 @@ v2 = 0; v3 = val; result = 0; - //v4 = 16; for (uint i = 0; i < 16; ++i) { result *= 2; @@ -228,9 +230,7 @@ ++result; v2 -= v5; } - //--v4; } - //while ( v4 ); if ( val - result * result >= (unsigned int)(result - 1) ) ++result; return result;
--- a/Texture.cpp Mon Jun 02 12:31:28 2014 +0600 +++ b/Texture.cpp Mon Jun 09 16:26:07 2014 +0600 @@ -283,22 +283,22 @@ //----- (0044E0ED) -------------------------------------------------------- void TextureFrameTable::LoadAnimationSequenceAndPalettes( signed int uIconID ) - { - TextureFrameTable *v3; // ebx@1 +{ + //TextureFrameTable *v3; // ebx@1 unsigned int i; // edi@3 - v3 = this; + //v3 = this; if ( (uIconID <= this->sNumTextures) && uIconID >= 0 ) { for ( i = uIconID; ; ++i ) { - v3->pTextures[i].uTextureID = pBitmaps_LOD->LoadTexture(v3->pTextures[i].pTextureName, TEXTURE_DEFAULT); + this->pTextures[i].uTextureID = pBitmaps_LOD->LoadTexture(this->pTextures[i].pTextureName, TEXTURE_DEFAULT); - if (v3->pTextures[i].uTextureID != -1) - pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID].palette_id1); + if (this->pTextures[i].uTextureID != -1) + pBitmaps_LOD->pTextures[this->pTextures[i].uTextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[this->pTextures[i].uTextureID].palette_id1); //result = (unsigned int)v3->pTextures; //if ( !(*(char *)(result + i * 20 + 18) & 1) ) - if( v3->pTextures[i].uFlags & 1) + if( this->pTextures[i].uFlags & 1) break; } }
--- a/UI/UICharacter.cpp Mon Jun 02 12:31:28 2014 +0600 +++ b/UI/UICharacter.cpp Mon Jun 09 16:26:07 2014 +0600 @@ -2235,7 +2235,7 @@ if (full_num_items_in_book>0) { for (int i = 0; i< full_num_items_in_book; ++i) - achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16); + achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16);//случайные значения от 0 до 15 for (int i = 1; i< full_num_items_in_book; ++i) { for (int j = i; j< full_num_items_in_book; ++j)
--- a/Vis.cpp Mon Jun 02 12:31:28 2014 +0600 +++ b/Vis.cpp Mon Jun 09 16:26:07 2014 +0600 @@ -411,13 +411,7 @@ //----- (004C1944) -------------------------------------------------------- int Vis::PickClosestActor(int object_id, unsigned int pick_depth, int a4, int a5, int a6) { - //float v6; // ST00_4@3 - //int result; // eax@4 Vis_SelectionFilter v8; // [sp+18h] [bp-20h]@3 - //__int64 v9; // [sp+2Ch] [bp-Ch]@3 - //Vis *v14; // [sp+34h] [bp-4h]@1 - - //v14 = this; static Vis_SelectionList Vis_static_sub_4C1944_stru_F8BDE8; @@ -429,10 +423,7 @@ Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers = 0; PickBillboards_Keyboard(pick_depth, &Vis_static_sub_4C1944_stru_F8BDE8, &v8); Vis_static_sub_4C1944_stru_F8BDE8.create_object_pointers(Vis_SelectionList::Unique); - sort_object_pointers( - Vis_static_sub_4C1944_stru_F8BDE8.object_pointers, - 0, - Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers - 1); + sort_object_pointers(Vis_static_sub_4C1944_stru_F8BDE8.object_pointers, 0, Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers - 1); if (!Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers) return -1; @@ -1290,12 +1281,12 @@ { //stru157 *v3; // esi@1 //int result; // eax@1 - int v5; // edx@2 + //int v5; // edx@2 //int v6; // ecx@2 //char v7; // zf@3 - int v8; // esi@5 + //int v8; // esi@5 // std::string *v9; // ecx@7 - Actor *v10; // edi@18 + //Actor *v10; // edi@18 //const char *v12; // [sp-20h] [bp-2Ch]@7 // int v13; // [sp-1Ch] [bp-28h]@7 //std::string v14; // [sp-18h] [bp-24h]@7 @@ -1309,21 +1300,21 @@ case VisObjectType_Sprite: { - v5 = filter->select_flags; + //v5 = filter->select_flags; int object_idx = PID_ID(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].sParentBillboardID].object_pid); int object_type = PID_TYPE(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].sParentBillboardID].object_pid); - if ( v5 & 2 ) + if ( filter->select_flags & 2 ) { if (object_type == filter->object_id) return false; return true; } - if ( v5 & 4 ) + if ( filter->select_flags & 4 ) { - v8 = filter->object_id; + //v8 = filter->object_id; if ( object_type != filter->object_id) return true; - if (v8 != OBJECT_Decoration) + if (filter->object_id != OBJECT_Decoration) { MessageBoxA(nullptr, "Unsupported \"exclusion if no event\" type in CVis::is_part_of_selection", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:207", 0); return true; @@ -1340,16 +1331,16 @@ return true; } - v10 = &pActors[object_idx]; - int result = 1 << LOBYTE(v10->uAIState); + //v10 = &pActors[object_idx]; + int result = 1 << LOBYTE(pActors[object_idx].uAIState); if ( result & filter->no_at_ai_state || !(result & filter->at_ai_state) - || v5 & 8 && (result = MonsterStats::BelongsToSupertype(v10->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) == 0 ) + || filter->select_flags & 8 && (result = MonsterStats::BelongsToSupertype(pActors[object_idx].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) == 0 ) return false; if ( !(filter->select_flags & 1) ) return true; - result = v10->GetActorsRelation(nullptr); + result = pActors[object_idx].GetActorsRelation(nullptr); if (result == 0) return false; return true;