Mercurial > might-and-magic-trilogy
diff mm7_2.cpp @ 136:f07a29f328e8
Слияние
author | Ritor1 |
---|---|
date | Thu, 15 Nov 2012 18:08:18 +0600 |
parents | fcf3209727a4 05b2d9653abc |
children | 062e8a8e09bc |
line wrap: on
line diff
--- a/mm7_2.cpp Thu Nov 15 18:08:01 2012 +0600 +++ b/mm7_2.cpp Thu Nov 15 18:08:18 2012 +0600 @@ -7520,10 +7520,10 @@ int v16; // eax@19 int v17; // ecx@19 int v18; // esi@31 - int v19; // ecx@32 - int v20; // edx@32 - int v21; // eax@32 - Actor *v22; // esi@35 + //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 @@ -7546,7 +7546,7 @@ //void *v42; // [sp-10h] [bp-F8h]@50 //size_t v43; // [sp-Ch] [bp-F4h]@50 const char *v44; // [sp-8h] [bp-F0h]@13 - char *v45; // [sp-4h] [bp-ECh]@9 + char *pTexture; // [sp-4h] [bp-ECh]@9 char Str[32]; // [sp+Ch] [bp-DCh]@60 char Str2[120]; // [sp+2Ch] [bp-BCh]@29 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 @@ -7555,13 +7555,12 @@ char Source[32]; // [sp+B0h] [bp-38h]@20 int v52; // [sp+D0h] [bp-18h]@34 int v53; // [sp+D4h] [bp-14h]@34 - int v54; // [sp+D8h] [bp-10h]@32 - int v55; // [sp+DCh] [bp-Ch]@32 + int pSector; // [sp+D8h] [bp-10h]@32 + int pPosX; // [sp+DCh] [bp-Ch]@32 int v56; // [sp+E0h] [bp-8h]@8 int v57; // [sp+E4h] [bp-4h]@1 //auto a2 = spawn; - v57 = 0; //v5 = pMapInfo; //v6 = spawn; @@ -7571,15 +7570,12 @@ v7 = pIndoor->dlv.field_C_alert; else v7 = 0; - if (v7) v8 = (spawn->uAttributes & 1) == 0; else v8 = (spawn->uAttributes & 1) == 1; - if (v8) return; - //result = (void *)(spawn->uIndex - 1); v56 = 1; switch (spawn->uIndex - 1) @@ -7588,82 +7584,70 @@ v9 = pMapInfo->uEncounterMonster1AtLeast; v10 = rand(); v11 = pMapInfo->uEncounterMonster1AtMost; - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v12 = v10 % (v11 - v9 + 1); v13 = pMapInfo->field_34; goto LABEL_20; - case 3u: - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s A"; goto LABEL_25; - case 4u: - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s A"; goto LABEL_25; - case 5u: - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s A"; goto LABEL_25; - case 1u: v9 = pMapInfo->uEncounterMonster2AtLeast; v14 = rand(); v15 = pMapInfo->uEncounterMonster2AtMost; - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v12 = v14 % (v15 - v9 + 1); v13 = pMapInfo->field_37; goto LABEL_20; - case 6u: - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s B"; goto LABEL_25; - case 7u: - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s B"; goto LABEL_25; - case 8u: - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s B"; goto LABEL_25; - case 2u: v9 = pMapInfo->uEncounterMonster3AtLeast; v16 = rand(); v17 = pMapInfo->uEncounterMonster3AtMost; - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v12 = v16 % (v17 - v9 + 1); v13 = pMapInfo->field_3A; LABEL_20: v57 = v13; v56 = v9 + v12; - strcpy(Source, v45); + strcpy(Source, pTexture); goto LABEL_26; - case 9u: - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s C"; goto LABEL_25; - case 0xAu: - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s C"; goto LABEL_25; - case 0xBu: - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s C"; LABEL_25: - sprintf(Source, v44, v45); + sprintf(Source, v44, pTexture); LABEL_26: if (Source[0] == '0') return; - v57 += a3; if ( v57 > 4 ) v57 = 4; @@ -7673,15 +7657,12 @@ v18 = v56; if ( (signed int)(v56 + uNumActors) >= 500 ) return; - v19 = spawn->vPosition.x; - v20 = spawn->vPosition.y; - v21 = spawn->vPosition.z; - v54 = 0; - v55 = v19; - a4 = v20; - a3 = v21; + pSector = 0; + pPosX = spawn->vPosition.x; + a4 = spawn->vPosition.y; + a3 = spawn->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - v54 = pIndoor->GetSector(v19, v20, v21); + pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z); v53 = 0; v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; if ( v18 <= 0 ) @@ -7690,10 +7671,9 @@ default: return; } - for (uint i = v53; i < v56; ++i) { - v22 = &pActors[uNumActors]; + pMonster = &pActors[uNumActors]; pActors[uNumActors].Reset(); if ( v57 ) { @@ -7711,72 +7691,66 @@ } if ( v24 == 1 ) { - v45 = Source; + pTexture = Source; v44 = "%s A"; } else { if ( v24 == 2 ) { - v45 = Source; + pTexture = Source; v44 = "%s B"; } else { if ( v24 != 3 ) goto LABEL_58; - v45 = Source; + pTexture = Source; v44 = "%s C"; } } - sprintf(Str2, v44, v45); + sprintf(Str2, v44, pTexture); } v26 = pMonsterList->GetMonsterByName(Str2); v50 = (signed __int16)v26; - v45 = Str2; + pTexture = Str2; if ( (signed __int16)v26 == -1 ) { - sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45); + sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture); MessageBoxA(nullptr, Str, nullptr, 0); ExitProcess(0); } v27 = &pMonsterList->pMonsters[(signed __int16)v26]; - v28 = pMonsterStats->_4563FF(v45); + v28 = pMonsterStats->_4563FF(pTexture); if ( !v28 ) v28 = 1; Src = &pMonsterStats->pInfos[v28]; - strcpy(v22->pActorName, Src->pName); - //v43 = 88; - //v42 = Src; - v29 = Src->uHP; - v41 = &v22->pMonsterInfo; - v22->sCurrentHP = v29; + strcpy(pMonster->pActorName, Src->pName); + pMonster->sCurrentHP = Src->uHP; assert(sizeof(MonsterInfo) == 88); - memcpy(v41, Src, sizeof(MonsterInfo)); - v22->word_000086_some_monster_id = v50 + 1; - v22->uActorRadius = v27->uMonsterRadius; - v22->uActorHeight = v27->uMonsterHeight; - v22->uMovementSpeed = v27->uMovementSpeed; - v30 = v55; - v22->vInitialPosition.x = v55; - v22->vPosition.x = v30; - v31 = a4; - v22->uTetherDistance = 256; - v22->vInitialPosition.y = v31; - v22->vPosition.y = v31; - v45 = 0; - v22->vInitialPosition.z = a3; - v22->vPosition.z = a3; - v22->uSectorID = v54; - v22->uGroup = spawn->uGroup; - v22->PrepareSprites((char)v45); - v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + memcpy(&pMonster->pMonsterInfo, Src, sizeof(MonsterInfo)); + pMonster->word_000086_some_monster_id = v50 + 1; + pMonster->uActorRadius = v27->uMonsterRadius; + pMonster->uActorHeight = v27->uMonsterHeight; + pMonster->uMovementSpeed = v27->uMovementSpeed; + pMonster->vInitialPosition.x = spawn->vPosition.x; + pMonster->vPosition.x = spawn->vPosition.x; + pMonster->uTetherDistance = 256; + pMonster->vInitialPosition.y = a4; + pMonster->vPosition.y = a4; + pTexture = 0; + pMonster->vInitialPosition.z = a3; + pMonster->vPosition.z = a3; + pMonster->uSectorID = pSector; + pMonster->uGroup = spawn->uGroup; + pMonster->PrepareSprites((char)pTexture); + pMonster->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v32 = rand(); v33 = v32 % 2048; v34 = stru_5C6E00->SinCos(v32 % 2048); a4 = v34; a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; - v55 = a3 + spawn->vPosition.x; + pPosX = a3 + spawn->vPosition.x; v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi); a4 = v35; a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; @@ -7785,10 +7759,10 @@ a3 = spawn->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) goto LABEL_55; - v37 = pIndoor->GetSector(v55, a4, v36); - if ( v37 == v54 ) - { - v38 = _46CEC3_get_floor_level(v55, a4, a3, v37, &uFaceID); + v37 = pIndoor->GetSector(pPosX, a4, v36); + if ( v37 == pSector ) + { + v38 = _46CEC3_get_floor_level(pPosX, a4, a3, v37, &uFaceID); v39 = v38; if ( v38 != -30000 ) { @@ -7797,7 +7771,7 @@ a3 = v39; LABEL_55: if ( a5 ) - v22->uAttributes |= 0x080000; + pMonster->uAttributes |= 0x080000; ++uNumActors; goto LABEL_58; }