Mercurial > mm7
changeset 2114:68fbaf45ef66
_42FB5C_check_spell cleaned
author | Ritor1 |
---|---|
date | Mon, 23 Dec 2013 17:30:22 +0600 |
parents | a94c5bee0225 |
children | 18dee3152c52 c7bf59066842 |
files | Actor.cpp AudioPlayer.cpp Game.cpp Render.cpp TurnEngine.h UI/UICharacter.cpp mm7_5.cpp mm7_6.cpp mm7_7.cpp mm7_data.h |
diffstat | 10 files changed, 172 insertions(+), 361 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/Actor.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -1669,7 +1669,7 @@ v3->vVelocity.z = 0; v3->vVelocity.y = 0; v3->vVelocity.x = 0; - if ( _42FB5C_check_spell(v16) ) + if ( _42FB5C_check_spell(v3->pMonsterInfo.uSpell1ID) ) { v3->uCurrentActionLength = 64; v3->uCurrentActionTime = 0;
--- a/AudioPlayer.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/AudioPlayer.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -52,8 +52,10 @@ std::array<float, 10> pSoundVolumeLevels = { - 0.0000000f, 0.4900000f, 0.5500000f, 0.6100000f, 0.6700000f, - 0.7000000f, 0.7600000f, 0.8200000f, 0.8800000f, 0.9700000f //changed 0.9900000f to 0.9700000f. for some reason it only works for values below this + 0.0000000f, 0.1099999f, 0.2199999f, 0.3300000f, 0.4399999f, + 0.5500000f, 0.6600000f, 0.7699999f, 0.8799999f, 0.9700000f +// 0.0000000f, 0.4900000f, 0.5500000f, 0.6100000f, 0.6700000f, //for 128.0f +// 0.7000000f, 0.7600000f, 0.8200000f, 0.8800000f, 0.9700000f //changed 0.9900000f to 0.9700000f. for some reason it only works for values below this }; @@ -692,10 +694,14 @@ { //if (!source_x) //source_x = pParty->vPosition.x; - //if (!source_x) - //source_x = pParty->vPosition.y; - AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(source_x, source_y)); - AIL_set_sample_volume(pMixerChannels[j].hSample, GetSoundStrengthByDistanceFromParty(source_x, source_y, pParty->vPosition.z)); + //if (!source_y) + //source_y = pParty->vPosition.y; + if ( source_x )//Ritor1: for pedestals + { + AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(source_x, source_y)); + int vol = GetSoundStrengthByDistanceFromParty(source_x, source_y, pParty->vPosition.z); + AIL_set_sample_volume(pMixerChannels[j].hSample, vol); + } } if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
--- a/Game.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/Game.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -1895,9 +1895,9 @@ if ( (char)uMusicVolimeMultiplier < 1 ) uMusicVolimeMultiplier = 0; GUIWindow::Create(243, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); - //if ( uMusicVolimeMultiplier ) - pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f, 0); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f); + if ( uMusicVolimeMultiplier ) + pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; } if ( uMessageParam == 5 )//кнопка повышения @@ -1907,16 +1907,16 @@ uMusicVolimeMultiplier = 9; GUIWindow::Create(435, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); if ( uMusicVolimeMultiplier ) - pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f, 0); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f); + pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; } uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//для задания громкости мышкой if ( (char)uMusicVolimeMultiplier > 9 ) uMusicVolimeMultiplier = 9; if ( uMusicVolimeMultiplier ) - pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f, 0); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f); + pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; case UIMSG_ChangeSoundVolume: if ( uMessageParam == 4 )//reduce sound level button left
--- a/Render.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/Render.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -8681,18 +8681,18 @@ }*/ - for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) - { - RenderBillboardD3D* p = &pRenderer->pBillboardRenderListD3D[i]; - - if (p->uOpacity != RenderBillboardD3D::NoBlend) - SetBillboardBlendOptions(p->uOpacity); + for (int i = pRenderer->uNumBillboardsToDraw - 1; i >= 0; --i) + { + if((int)pRenderer->pBillboardRenderListD3D[i].pTexture == 0xcdcdcdcd) + __debugbreak();//Ritor1: error + if (pRenderer->pBillboardRenderListD3D[i].uOpacity != RenderBillboardD3D::NoBlend) + SetBillboardBlendOptions(pRenderer->pBillboardRenderListD3D[i].uOpacity); - //if((int)p->pTexture!=0xcdcdcdcd) - pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); + + pRenderer->pRenderD3D->pDevice->SetTexture(0, pRenderer->pBillboardRenderListD3D[i].pTexture); ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - p->pQuads, p->uNumVertices, + pRenderer->pBillboardRenderListD3D[i].pQuads, pRenderer->pBillboardRenderListD3D[i].uNumVertices, D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); }
--- a/TurnEngine.h Mon Dec 23 00:48:53 2013 +0600 +++ b/TurnEngine.h Mon Dec 23 17:30:22 2013 +0600 @@ -75,7 +75,7 @@ int turns_count; - int turn_stage; + int turn_stage; //if = 2 - action int ai_turn_timer; int uActorQueueSize; //c int turn_initiative;
--- a/UI/UICharacter.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/UI/UICharacter.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -1545,7 +1545,7 @@ { Texture *pTexture; // esi@6 int v13; // eax@13 - int v15; // eax@13 + //int v15; // eax@13 unsigned int v17; // edi@15 unsigned int uCellX; // [sp+30h] [bp-8h]@5 unsigned int uCellY; // [sp+34h] [bp-4h]@5 @@ -1567,12 +1567,13 @@ pTexture->uTextureWidth = 14; if ( (pTexture->uTextureWidth - 14) / 32 == 0 && pTexture->uTextureWidth < 32) uCellX += (32 - pTexture->uTextureWidth) / 2; - v13 = pTexture->uTextureWidth - 14; - LOBYTE(v13) = v13 & 0xE0; - v15 = v13 + 32; + //v13 = pTexture->uTextureWidth - 14; + //LOBYTE(v13) = v13 & 0xE0; + //v15 = v13 + 32; if (pTexture->uTextureHeight < 14 ) pTexture->uTextureHeight = 14; - v17 = uCellX + ((v15 - pTexture->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + (( (int)((pTexture->uTextureHeight - 14) & 0xFFFFFFE0) - pTexture->uTextureHeight + 32) >> 1)]; //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up + v17 = uCellX + (( (int)((pTexture->uTextureWidth - 14) & 0xE0) + 32 - pTexture->uTextureWidth) / 2) + + pSRZBufferLineOffsets[uCellY + (( (int)((pTexture->uTextureHeight - 14) & 0xFFFFFFE0) - pTexture->uTextureHeight + 32) / 2)]; //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & ITEM_ENCHANT_ANIMATION) { Texture *loadedTextureptr = nullptr;
--- a/mm7_5.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/mm7_5.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -342,9 +342,9 @@ int v6; // eax@3 //Actor *v7; // esi@4 //Actor *v8; // edi@4 - char v9; // zf@5 + //char v9; // zf@5 __int64 v10; // qax@8 - signed __int16 v11; // cx@9 + //signed __int16 v11; // cx@9 signed int v12; // ecx@20 int v13; // ecx@22 int v14; // edi@30 @@ -364,19 +364,19 @@ v6 = pActors[actor_id].IsNotAlive(); if ( !v6 ) { - v9 = pActors[actor_id].uAIState == 7; + //v9 = pActors[actor_id].uAIState == 7; pActors[actor_id].uLastCharacterIDToHit = v17; - if ( v9 ) - BYTE2(pActors[actor_id].uAttributes) |= 2u; - v6 = pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0); - if ( v6 ) + if ( pActors[actor_id].uAIState == Fleeing ) + BYTE2(pActors[actor_id].uAttributes) |= 2; + //v6 = pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0); + if ( pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0) ) { v10 = (unsigned int)pActors[PID_ID(v17)]._43B3E0_CalcDamage(a4); if ( (signed __int64)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 ) { - v11 = pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; - if ( v11 ) - v10 = (signed int)v10 / (unsigned __int16)v11; + //v11 = pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; + if ( pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower ) + v10 = (signed int)v10 / (unsigned __int16)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; } if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10) && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10) @@ -447,18 +447,15 @@ } } - //----- (0043F515) -------------------------------------------------------- void FindBillboardsLightLevels_BLV() { for (uint i = 0; i < uNumBillboardsToDraw; ++i) { - RenderBillboard* p = &pBillboardRenderList[i]; - - if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) - p->dimming_level = 0; + if (pBillboardRenderList[i].field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !pBillboardRenderList[i].uIndoorSectorID) + pBillboardRenderList[i].dimming_level = 0; else - p->dimming_level = _43F55F_get_billboard_light_level(p, -1); + pBillboardRenderList[i].dimming_level = _43F55F_get_billboard_light_level(&pBillboardRenderList[i], -1); } } @@ -468,9 +465,7 @@ signed int v3; // ecx@2 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; - } else { if ( uBaseLightLevel == -1 ) @@ -759,7 +754,7 @@ obj2_x = pParty->vPosition.x; obj2_z = pParty->sEyelevel + pParty->vPosition.z; obj2_y = pParty->vPosition.y; - obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z); + obj2_sector = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z); break; case OBJECT_Actor: obj2_y = pActors[v12].vPosition.y; @@ -885,15 +880,10 @@ v58 = fixpoint_div(v38,v59); if( v58 < 0 ) - { - continue; - } + continue; - if(!sub_4075DB( - obj1_x + ((fixpoint_mul(v49,v58) + 32768) >> 16), - obj1_y + ((fixpoint_mul(v48,v58) + 32768) >> 16), - obj1_z + ((fixpoint_mul(v47,v58) + 32768) >> 16), - v29) ) + if(!sub_4075DB(obj1_x + ((fixpoint_mul(v49,v58) + 32768) >> 16), obj1_y + ((fixpoint_mul(v48,v58) + 32768) >> 16), + obj1_z + ((fixpoint_mul(v47,v58) + 32768) >> 16), v29) ) { continue; } @@ -906,9 +896,7 @@ //no more portals, quit if ( next_sector == current_sector ) - { - break; - } + break; ++sectors_visited; current_sector = next_sector; @@ -937,28 +925,11 @@ } //----- (004075DB) -------------------------------------------------------- -bool __fastcall sub_4075DB(int x, int y, int z, BLVFace *a4) +bool __fastcall sub_4075DB(int x, int y, int z, BLVFace *face) { - unsigned int v5; // esi@1 - char v7; // zf@2 int v8; // edi@2 - Vec3_short_ *v9; // ecx@3 - int v10; // edx@4 - Vec3_short_ *v12; // ecx@8 - int v13; // edx@9 - Vec3_short_ *v15; // ecx@12 - int v16; // edx@13 - bool v18; // esi@14 - int v19; // ecx@14 - int v20; // ecx@16 - int v21; // edx@16 - int v22; // eax@17 - signed int v23; // ebx@18 - int v24; // esi@20 signed int v25; // eax@22 - signed __int64 v26; // qtt@22 bool result; // eax@25 - int v29; // [sp+10h] [bp-Ch]@14 signed int a3a; // [sp+24h] [bp+8h]@14 int a4a; // [sp+28h] [bp+Ch]@2 @@ -967,44 +938,42 @@ //__debugbreak(); - v5 = a4->uAttributes; - v9 = pIndoor->pVertices; - if ( v5 & FACE_XY_PLANE ) + if ( face->uAttributes & FACE_XY_PLANE ) { a4a = x; v8 = y; - for(int i = 0; i < a4->uNumVertices; i++) + for(int i = 0; i < face->uNumVertices; i++) { - dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; - dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].y; + dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].x; + dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].y; } } else { v8 = z; - if ( v5 & FACE_XZ_PLANE ) + if ( face->uAttributes & FACE_XZ_PLANE ) { a4a = x; - for(int i = 0; i < a4->uNumVertices; i++) + for(int i = 0; i < face->uNumVertices; i++) { - dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; - dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].z; + dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].x; + dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].z; } } else { a4a = y; - for(int i = 0; i < a4->uNumVertices; i++) + for(int i = 0; i < face->uNumVertices; i++) { - dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y; - dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].z; + dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].y; + dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].z; } } } a3a = 0; - dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0]; - dword_4F5CC8_ys[a4->uNumVertices] = dword_4F5CC8_ys[0]; - for(int i = 0; i < a4->uNumVertices && a3a < 2; i++) + dword_4F5D98_xs[face->uNumVertices] = dword_4F5D98_xs[0]; + dword_4F5CC8_ys[face->uNumVertices] = dword_4F5CC8_ys[0]; + for(int i = 0; i < face->uNumVertices && a3a < 2; i++) { if ( dword_4F5CC8_ys[i] >= v8 ^ (dword_4F5CC8_ys[i + 1] >= v8) ) { @@ -1019,7 +988,7 @@ else { v25 = fixpoint_div(dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i], dword_4F5CC8_ys[i + 1] - dword_4F5CC8_ys[i]); - if( dword_4F5D98_xs[i] + (fixpoint_mul(v25, (v8 - dword_4F5CC8_ys[i]) << 16) + 32768 >> 16) >= a4a) + if( dword_4F5D98_xs[i] + (fixpoint_mul(v25, (v8 - dword_4F5CC8_ys[i]) << 16) + 0x8000 >> 16) >= a4a) ++a3a; } } @@ -1032,75 +1001,51 @@ } //----- (004077F1) -------------------------------------------------------- -bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) +bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *face, BSPVertexBuffer *a5) { - //ODMFace *v5; // eax@1 - Vec3_int_ *v9; - unsigned int v5; // esi@1 - signed int v7; // edi@1 - //char v8; // zf@2 - //unsigned __int16 *v9; // edx@3 - int v10; // ecx@4 - unsigned __int16 *v11; // edx@8 - int v12; // ecx@9 - int v13; // edx@12 - int v14; // ecx@13 - int v15; // esi@14 - bool v16; // edi@14 - int v17; // ecx@16 - int v18; // edx@16 - int v19; // eax@17 - signed int v20; // ebx@18 - int v21; // edi@20 - signed int v22; // eax@22 - signed __int64 v23; // qtt@22 - //bool result; // eax@25 - //int v25; // [sp+14h] [bp-8h]@14 int a4a; // [sp+28h] [bp+Ch]@2 signed int a5a; // [sp+2Ch] [bp+10h]@14 std::array<int, 52> dword_4F5B24_ys; // idb std::array<int, 52> dword_4F5BF4_xs; // idb - + //__debugbreak(); //срабатывает при нападении стрекозавров с огнём - v5 = a4->uAttributes; - v9 = a5->pVertices; - if ( v5 & FACE_XY_PLANE ) + if ( face->uAttributes & FACE_XY_PLANE ) { a4a = a1; a3 = a2; - for(int i = 0; i < a4->uNumVertices; i++) + for(int i = 0; i < face->uNumVertices; i++) { - dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; - dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].y; + dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].x; + dword_4F5B24_ys[i+1] = a5->pVertices[face->pVertexIDs[i]].y; } } else { - if ( v5 & FACE_XY_PLANE ) + if ( face->uAttributes & FACE_XY_PLANE ) { a4a = a1; - for(int i = 0; i < a4->uNumVertices; i++) + for(int i = 0; i < face->uNumVertices; i++) { - dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; - dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; + dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].x; + dword_4F5B24_ys[i+1] = a5->pVertices[face->pVertexIDs[i]].z; } } else { a4a = a2; - for(int i = 0; i < a4->uNumVertices; i++) + for(int i = 0; i < face->uNumVertices; i++) { - dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].y; - dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; + dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].y; + dword_4F5B24_ys[i+1] = a5->pVertices[face->pVertexIDs[i]].z; } } } a5a = 0; - dword_4F5BF4_xs[a4->uNumVertices + 1] = dword_4F5BF4_xs[1]; - dword_4F5B24_ys[a4->uNumVertices + 1] = dword_4F5B24_ys[1]; - for(int i = 0; i < a4->uNumVertices; i++) + dword_4F5BF4_xs[face->uNumVertices + 1] = dword_4F5BF4_xs[1]; + dword_4F5B24_ys[face->uNumVertices + 1] = dword_4F5B24_ys[1]; + for(int i = 0; i < face->uNumVertices; i++) { if ( a5a >= 2 ) break; @@ -1112,11 +1057,11 @@ ++a5a; else { - v23 = (__int64)(dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1]) << 16; + //v23 = (__int64)(dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1]) << 16; __int64 _a = dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1]; __int64 _b = (__int64)(a3 - dword_4F5B24_ys[i + 1]) << 16; - if (dword_4F5BF4_xs[i + 1] + ((((v23 / _a * _b) >> 16) + 32768) >> 16) >= a4a) + if (dword_4F5BF4_xs[i + 1] + ((((((__int64)(dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1]) << 16) / _a * _b) >> 16) + 0x8000) >> 16) >= a4a) ++a5a; } } @@ -1132,20 +1077,14 @@ //----- (004088E9) -------------------------------------------------------- int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3) { - int v8; // eax@1 signed int result; // eax@1 - int v11; // [sp+18h] [bp+8h]@1 - v11 = abs(x2 - x1); - v8 = abs(y2 - y1); - result = integer_sqrt(v11 * v11 + v8 * v8); + result = integer_sqrt(abs(x2 - x1) * abs(x2 - x1) + abs(y2 - y1) * abs(y2 - y1)); if ( result ) result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result); return result; } - - //----- (0040F82D) -------------------------------------------------------- void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) { @@ -1153,95 +1092,69 @@ ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); } - - //----- (0040F89C) -------------------------------------------------------- void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue) -{ +{//срабатывает при продаже в магазине void *v3; // eax@3 - void *v4; // esi@5 - int *v5; // edi@5 - int v6; // eax@5 + //void *v4; // esi@5 + //int *v5; // edi@5 + //int v6; // eax@5 int v7; // ecx@6 - Texture *v8; // [sp+Ch] [bp-14h]@1 - int *v9; // [sp+10h] [bp-10h]@1 - int v10; // [sp+14h] [bp-Ch]@1 int v11; // [sp+18h] [bp-8h]@1 - void *v12; // [sp+1Ch] [bp-4h]@5 + //void *v12; // [sp+1Ch] [bp-4h]@5 - v10 = pTex->uTextureWidth; - v8 = pTex; - v9 = pZBuffer; - v11 = pTex->uTextureHeight; if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize ) v3 = pTex->UnzipPalette(); else v3 = pTex->pLevelOfDetail0_prolly_alpha_mask; - v12 = v3; - v4 = v3; - v5 = v9; - v6 = 0; - do + //v12 = v3; + //v4 = v3; + //v5 = pZBuffer; + //v6 = 0; + for ( uint i = 0; i < pTex->uTextureHeight; i++ ) { - v7 = v10; - do + for ( uint j = 0; j < pTex->uTextureWidth; j++ ) { - LOBYTE(v6) = *(char *)v4; - v4 = (char *)v4 + 1; - if ( v6 ) - *v5 = uZValue; - ++v5; - --v7; + //LOBYTE(v6) = *(char *)v4; + //v4 = (char *)v4 + 1; + //if ( v6 ) + *pZBuffer = uZValue; + ++pZBuffer; } - while ( v7 ); - v5 += 640 - v10; - --v11; + pZBuffer += 640 - pTex->uTextureWidth; } - while ( v11 ); if ( pIcons_LOD->dword_011BA4 ) { - if ( v8->uDecompressedSize ) - free(v12); + if ( pTex->uDecompressedSize ) + free(v3); } } //----- (0040F92A) -------------------------------------------------------- void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3) -{ - Texture *v3; // esi@1 +{//срабатывает в покупке в магазине void *v4; // eax@3 - int *v5; // edi@5 + //int *v5; // edi@5 int v6; // ecx@6 - int *v7; // [sp+Ch] [bp-10h]@1 - int v8; // [sp+10h] [bp-Ch]@1 int v9; // [sp+18h] [bp-4h]@1 - v3 = a2; - v7 = pZBuffer; - v8 = a2->uTextureWidth; - v9 = a2->uTextureHeight; if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize ) v4 = a2->UnzipPalette(); else v4 = a2->pLevelOfDetail0_prolly_alpha_mask; - v5 = v7; - do + //v5 = pZBuffer; + for ( uint i = 0; i < a2->uTextureHeight; i++ ) { - v6 = v8; - do + for ( uint j = 0; j < a2->uTextureWidth; j++ ) { - *v5 = a3; - ++v5; - --v6; + *pZBuffer = a3; + ++pZBuffer; } - while ( v6 ); - v5 += 640 - v8; - --v9; + pZBuffer += 640 - a2->uTextureWidth; } - while ( v9 ); if ( pIcons_LOD->dword_011BA4 ) { - if ( v3->uDecompressedSize ) + if ( a2->uDecompressedSize ) free(v4); } } @@ -1254,6 +1167,7 @@ const char **v3; // esi@2 char *v4; // ebx@2 + __debugbreak();//Ritor1 v1 = a1; v2 = 1; if ( _stricmp(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) )
--- a/mm7_6.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/mm7_6.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -60,6 +60,7 @@ int v15; // eax@14 signed int result; // eax@17 + __debugbreak();//Ritor1 v5 = pActor->pMonsterInfo.uAC; v6 = 0; if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 ) @@ -439,11 +440,7 @@ DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED)) - _42FA66_do_explosive_impact( - actor->vPosition.x, - actor->vPosition.y, - actor->vPosition.z + actor->uActorHeight / 2, - 0, 512, uActiveCharacter); + _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter); } else if (bow_idx) { @@ -464,7 +461,6 @@ player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); } - int v34 = 0; if (shooting_wand) return; @@ -529,6 +525,7 @@ int i; // [sp+38h] [bp+Ch]@33 signed int v32; // [sp+3Ch] [bp+10h]@32 + __debugbreak();//Ritor1 v4 = 0; v5 = this; v24 = this; @@ -708,16 +705,11 @@ pSpellObject.spell_id = 0; pSpellObject.field_54 = 0; pSpellObject.uType = uSpriteID; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - pObjectDescID = 0; - else + pObjectDescID = 0; + for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) { - pObjectDescID = 0; - for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) - { - if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) - pObjectDescID = i; - } + if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) + pObjectDescID = i; } pSpellObject.uObjectDescID = pObjectDescID; pSpellObject.vPosition.x = x; @@ -770,52 +762,32 @@ //----- (0042F960) -------------------------------------------------------- void __fastcall sub_42F960_create_object(int x, int y, int z) { - int v3; // ebx@1 - int v4; // edi@1 - signed int v5; // edx@1 - char *v6; // ecx@2 unsigned __int16 v7; // ax@5 signed int v8; // eax@6 signed int v9; // eax@7 - //SpriteObject a1; // [sp+Ch] [bp-70h]@1 - v3 = x; - v4 = y; - SpriteObject a1; // [sp+Ch] [bp-70h]@1 //SpriteObject::SpriteObject(&a1); a1.stru_24.Reset(); - v5 = 0; a1.spell_skill = 0; a1.spell_level = 0; a1.spell_id = 0; a1.field_54 = 0; a1.uType = 800; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_5: - v7 = 0; - } - else + v7 = 0; + for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) { - v6 = (char *)&pObjectList->pObjects->uObjectID; - while ( *(short *)v6 != 800 ) - { - ++v5; - v6 += 56; - if ( v5 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_5; - } - v7 = v5; + if ( a1.uType == pObjectList->pObjects[i].uObjectID ) + v7 = i; } a1.uObjectDescID = v7; - a1.vPosition.x = v3; - a1.vPosition.y = v4; + a1.vPosition.x = x; + a1.vPosition.y = y; a1.vPosition.z = z; a1.uSoundID = 0; a1.uAttributes = 0; - a1.uSectorID = pIndoor->GetSector(v3, v4, z); + a1.uSectorID = pIndoor->GetSector(x, y, z); a1.uSpriteFrameID = 0; a1.spell_caster_pid = 0; a1.spell_target_pid = 0; @@ -828,23 +800,11 @@ } } - - //----- (0042FA66) -------------------------------------------------------- void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) { - int v6; // edi@1 - int v7; // esi@1 - char *v8; // ecx@2 unsigned __int16 v9; // ax@5 - //int v10; // eax@10 - //signed int result; // eax@11 - //__int16 v12; // ax@12 - //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 - int v14; // [sp+7Ch] [bp-4h]@1 - v6 = a1; - v7 = a2; SpriteObject a1a; // [sp+Ch] [bp-74h]@1 //SpriteObject::SpriteObject(&a1a); a1a.uType = 600; @@ -853,43 +813,27 @@ a1a.spell_id = SPELL_FIRE_FIREBALL; a1a.spell_level = 8; a1a.spell_skill = 3; - v14 = 0; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_5: - v9 = 0; - } - else + v9 = 0; + for ( uint i = 0; i < pObjectList->uNumObjects; ++i ) { - v8 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1a.uType != *(short *)v8 ) - { - ++v14; - v8 += 56; - if ( v14 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_5; - } - v9 = v14; + if ( a1a.uType == pObjectList->pObjects[i].uObjectID ) + v9 = i; } a1a.uObjectDescID = v9; - a1a.vPosition.x = v6; - a1a.vPosition.y = v7; + a1a.vPosition.x = a1; + a1a.vPosition.y = a2; a1a.vPosition.z = a3; a1a.uAttributes = 0; - a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); + a1a.uSectorID = pIndoor->GetSector(a1, a2, a3); a1a.uSpriteFrameID = 0; a1a.spell_target_pid = 0; a1a.field_60_distance_related_prolly_lod = 0; a1a.uFacing = 0; a1a.uSoundID = 0; if ( a6 >= 1 || a6 <= 4 ) - { a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); - } else - { a1a.spell_caster_pid = 0; - } int id = a1a.Create(0, 0, 0, 0); if (id != -1) @@ -898,63 +842,22 @@ } //----- (0042FB5C) -------------------------------------------------------- -bool _42FB5C_check_spell(signed int a1) +bool _42FB5C_check_spell(signed int spell_id) { - int v1; // ecx@3 - int v2; // ecx@4 - int v3; // ecx@5 - int v4; // ecx@6 - int v5; // ecx@7 - int v6; // ecx@8 - char v7; // zf@9 - - if ( a1 > 39 ) + if ( spell_id > 39 ) { - if ( a1 > 77 ) - { - if ( a1 == 80 ) - return 0; - if ( a1 > 84 ) - { - if ( a1 <= 86 ) - return 0; - v7 = a1 == 95; - goto LABEL_20; - } - } - else - { - if ( a1 == 77 ) - return 0; - if ( a1 >= 46 ) - { - if ( a1 <= 47 || a1 == 51 ) - return 0; - v7 = a1 == 73; - goto LABEL_20; - } - } - return 1; + if ( spell_id == SPELL_SPIRIT_BLESS || spell_id == SPELL_SPIRIT_FATE || spell_id == SPELL_SPIRIT_HEROISM || spell_id == SPELL_BODY_HAMMERHANDS + || spell_id == SPELL_BODY_POWER_CURE ||spell_id == SPELL_LIGHT_DISPEL_MAGIC || spell_id == SPELL_LIGHT_DAY_OF_PROTECTION + || spell_id == SPELL_LIGHT_HOUR_OF_POWER || spell_id == SPELL_DARK_PAIN_REFLECTION) + return false; + return true; } - if ( a1 == 39 || (v1 = a1 - 2) == 0 ) - return 1; - v2 = v1 - 3; - if ( !v2 ) - return 0; - v3 = v2 - 1; - if ( !v3 || (v4 = v3 - 3) == 0 ) - return 1; - v5 = v4 - 8; - if ( !v5 ) - return 0; - v6 = v5 - 1; - if ( !v6 ) - return 1; - v7 = v6 == 20; -LABEL_20: - if ( !v7 ) - return 1; - return 0; + if ( spell_id == SPELL_FIRE_FIRE_BOLT || spell_id == SPELL_FIRE_FIREBALL || spell_id == SPELL_FIRE_METEOR_SHOWER + || spell_id == SPELL_AIR_LIGHNING_BOLT || spell_id == SPELL_EARTH_BLADES ) + return true; + if ( spell_id == SPELL_FIRE_HASTE || spell_id == SPELL_AIR_SHIELD || spell_id == SPELL_EARTH_STONESKIN ) + return false; + return true; } //----- (0042FBDD) -------------------------------------------------------- @@ -977,14 +880,14 @@ void ProcessInputActions() { char v4; // al@9 - char v8; // bl@100 + //char v8; // bl@100 unsigned __int16 v9; // ax@102 - int v10; // eax@103 + int spell_price; // eax@103 char v14; // al@159 unsigned int v15; // eax@168 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 InputAction inputAction; // [sp+0h] [bp-8h]@7 - int v24; // [sp+4h] [bp-4h]@87 + //int v24; // [sp+4h] [bp-4h]@87 pGame->pKeyboardInstance->EnterCriticalSection(); Keyboard* pKeyboard = pGame->pKeyboardInstance; @@ -1208,9 +1111,8 @@ { if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) { - v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); if ( !pParty->bTurnBasedModeOn ) - pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); + pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false) * 2.133333333333333)); CastSpellInfoHelpers::_427D48(); pTurnEngine->ApplyPlayerAction(); } @@ -1244,24 +1146,21 @@ } if ( !uActiveCharacter ) break; - v8 = pPlayers[uActiveCharacter]->uQuickSpell; - if ( !v8 - || bUnderwater - || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? - ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : - (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : - (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : - (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), - v10 > pPlayers[uActiveCharacter]->sMana) ) + v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12]; + if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater + || (( !(HIBYTE(v9) & 1)) ? + ((v9 & 0x80) == 0 ? + ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) : + spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) : + spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana, + spell_price > pPlayers[uActiveCharacter]->sMana) ) { pPartyActionQueue = pPartyActionQueue; pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); break; } else - { - pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); - } + pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); break; case INPUT_Attack: if (pCurrentScreen != SCREEN_GAME)
--- a/mm7_7.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/mm7_7.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -29,7 +29,7 @@ dword_4F8580[0] = 1; return result; */ - + __debugbreak();//Ritor1 for( int i = 0; i < 62; i++ ) { dword_4F8580[i] = 0; @@ -41,18 +41,9 @@ //----- (00423B4A) -------------------------------------------------------- void sub_423B4A() { - float *v0; // eax@1 - signed int v1; // ecx@1 - - v0 = &array_507D30[0].flt_2C; - v1 = 50; - do - { - *v0 = 0.0; - v0 += 12; - --v1; - } - while ( v1 ); + __debugbreak();//Ritor1 + for ( uint i = 0; i < 50; i++ ) + array_507D30[i].flt_2C = 0.0; } /*
--- a/mm7_data.h Mon Dec 23 00:48:53 2013 +0600 +++ b/mm7_data.h Mon Dec 23 17:30:22 2013 +0600 @@ -1062,8 +1062,8 @@ int MakeActorAIList_BLV(); void UpdateActorAI(); bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID); -bool __fastcall sub_4075DB(int a1, int a2, int a3, struct BLVFace *a4); -bool __fastcall sub_4077F1(int a1, int a2, int a3, struct ODMFace *a4, struct BSPVertexBuffer *a5); +bool __fastcall sub_4075DB(int a1, int a2, int a3, struct BLVFace *face); +bool __fastcall sub_4077F1(int a1, int a2, int a3, struct ODMFace *face, struct BSPVertexBuffer *a5); bool __fastcall sub_407A1C(int x, int z, int y, struct Vec3_int_ v); // idb void InitializeActors(); void InitializeSpriteObjects(); @@ -1116,7 +1116,7 @@ void __fastcall sub_42F960_create_object(int x, int y, int z); // idb void CompactLayingItemsList(); void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6); -bool _42FB5C_check_spell(signed int a1); +bool _42FB5C_check_spell(signed int spell_id); void sub_42FBDD(); void CloseWindowBackground(); void ProcessInputActions();