Mercurial > mm7
changeset 1119:aa706cde7fda
* dark spells working
* found aoe apply buff function
* round() moved
* some global variable fixes
* DecalBuilder::ApplyDecals_OutdoorFace() clean
author | zipi |
---|---|
date | Wed, 29 May 2013 22:51:00 +0100 |
parents | ca415f6bac1c |
children | 17a01695926b |
files | DecalBuilder.cpp MM7.h SpriteObject.h Texture.cpp Texture.h UIBooks.cpp mm7_2.cpp mm7_3.cpp mm7_6.cpp mm7_data.cpp mm7_data.h |
diffstat | 11 files changed, 125 insertions(+), 80 deletions(-) [+] |
line wrap: on
line diff
--- a/DecalBuilder.cpp Wed May 29 20:12:22 2013 +0100 +++ b/DecalBuilder.cpp Wed May 29 22:51:00 2013 +0100 @@ -487,66 +487,38 @@ //----- (0049BCEB) -------------------------------------------------------- char DecalBuilder::ApplyDecals_OutdoorFace(ODMFace *pFace) { - int v2; // edi@1 - unsigned int v3; // eax@2 - char *v4; // edx@5 - double v5; // ST1C_8@12 - double v6; // ST14_8@12 - double v7; // ST0C_8@12 - double v8; // st7@12 - unsigned int v10; // [sp+20h] [bp-1Ch]@1 + double v8; // st7@12 + unsigned int v10; // [sp+20h] [bp-1Ch]@1 + + Bloodsplat *pBloodsplat; - v2 = 0; - this->uNumDecals = 0; - v10 = pBloodsplatContainer->std__vector_pBloodsplats_size; - if ( pBloodsplatContainer->std__vector_pBloodsplats_size ) - { - v3 = pFace->uAttributes; - if ( !(v3 & 0x400000) ) - { - if ( !(v3 & 0x10) && (signed int)pBloodsplatContainer->std__vector_pBloodsplats_size > 0 ) - { - v4 = (char *)&pBloodsplatContainer->std__vector_pBloodsplats[0].y; - do - { - if ( (double)pFace->pBoundingBox.x1 - *((float *)v4 + 2) < *((float *)v4 - 1) ) - { - if ( (double)pFace->pBoundingBox.x2 + *((float *)v4 + 2) > *((float *)v4 - 1) ) - { - if ( (double)pFace->pBoundingBox.y1 - *((float *)v4 + 2) < *(float *)v4 ) - { - if ( (double)pFace->pBoundingBox.y2 + *((float *)v4 + 2) > *(float *)v4 ) - { - if ( (double)pFace->pBoundingBox.z1 - *((float *)v4 + 2) < *((float *)v4 + 1) ) - { - if ( (double)pFace->pBoundingBox.z2 + *((float *)v4 + 2) > *((float *)v4 + 1) ) - { - v5 = *((float *)v4 - 1) + 6.7553994e15; - v6 = *(float *)v4 + 6.7553994e15; - v7 = *((float *)v4 + 1) + 6.7553994e15; - v8 = (double)((pFace->pFacePlane.dist - + LODWORD(v5) * pFace->pFacePlane.vNormal.x - + LODWORD(v6) * pFace->pFacePlane.vNormal.y - + LODWORD(v7) * pFace->pFacePlane.vNormal.z) >> 16); - if ( v8 <= *((float *)v4 + 2) ) - { - *((float *)v4 + 3) = v8; - this->std__vector_30B00C[this->uNumDecals++] = v2; - } - } - } - } - } - } - } - ++v2; - v4 += 40; - } - while ( v2 < (signed int)v10 ); - } - } - } - return 1; + this->uNumDecals = 0; + v10 = pBloodsplatContainer->std__vector_pBloodsplats_size; + if ( !(pFace->uAttributes & 0x400000) && !(pFace->uAttributes & 0x10) ) + { + for(int i = 0; i < pBloodsplatContainer->std__vector_pBloodsplats_size; i++ ) + { + pBloodsplat = &pBloodsplatContainer->std__vector_pBloodsplats[i]; + if ( (double)pFace->pBoundingBox.x1 - pBloodsplat->radius < pBloodsplat->x && + (double)pFace->pBoundingBox.x2 + pBloodsplat->radius > pBloodsplat->x && + (double)pFace->pBoundingBox.y1 - pBloodsplat->radius < pBloodsplat->y && + (double)pFace->pBoundingBox.y2 + pBloodsplat->radius > pBloodsplat->y && + (double)pFace->pBoundingBox.z1 - pBloodsplat->radius < pBloodsplat->z && + (double)pFace->pBoundingBox.z2 + pBloodsplat->radius > pBloodsplat->z ) + { + v8 = (double)((pFace->pFacePlane.dist + + round(pBloodsplat->x) * pFace->pFacePlane.vNormal.x + + round(pBloodsplat->y) * pFace->pFacePlane.vNormal.y + + round(pBloodsplat->z) * pFace->pFacePlane.vNormal.z) >> 16); + if ( v8 <= pBloodsplat->radius ) + { + pBloodsplat->dot_dist = v8; + this->std__vector_30B00C[this->uNumDecals++] = i; + } + } + } + } + return 1; } //----- (0049BE8A) --------------------------------------------------------
--- a/MM7.h Wed May 29 20:12:22 2013 +0100 +++ b/MM7.h Wed May 29 22:51:00 2013 +0100 @@ -23,7 +23,7 @@ #define PID(type, id) (unsigned int)((((8 * (id))) | (type)) & 0xFFFF) // packed id #define PID_TYPE(pid) (unsigned int)((pid) & 7) // extract type #define PID_ID(pid) (unsigned int)(((pid) & 0xFFFF) >> 3) // extract value -inline int round(float x) { return (floor(x + 0.5)); } + typedef unsigned __int16 _WORD; typedef unsigned __int64 _QWORD;
--- a/SpriteObject.h Wed May 29 20:12:22 2013 +0100 +++ b/SpriteObject.h Wed May 29 22:51:00 2013 +0100 @@ -16,7 +16,7 @@ SpriteObject(); int Create(int yaw, int pitch, int a4, int a5); - void _46BEF1_apply_spells(); + void _46BEF1_apply_spells_aoe(); void _438E35(); static void UpdateObject_fn0_BLV(unsigned int uLayingItemID);
--- a/Texture.cpp Wed May 29 20:12:22 2013 +0100 +++ b/Texture.cpp Wed May 29 22:51:00 2013 +0100 @@ -52,7 +52,7 @@ Texture *pTextures_tabs[9][2]; Texture *pTexture_mapbordr; // idb Texture *pTexture_pagemask; // idb -Texture *pSpellBookPagesTextr[8]; +Texture *pSpellBookPagesTextr[9]; Texture *pSpellBookPagesTextr_9; Texture *pSpellBookPagesTextr_10; Texture *pSpellBookPagesTextr_11;
--- a/Texture.h Wed May 29 20:12:22 2013 +0100 +++ b/Texture.h Wed May 29 22:51:00 2013 +0100 @@ -155,7 +155,7 @@ extern Texture *pTextures_tabs[9][2]; extern Texture *pTexture_mapbordr; // idb extern Texture *pTexture_pagemask; // idb -extern Texture *pSpellBookPagesTextr[8]; +extern Texture *pSpellBookPagesTextr[9]; extern Texture *pSpellBookPagesTextr_9; extern Texture *pSpellBookPagesTextr_10; extern Texture *pSpellBookPagesTextr_11;
--- a/UIBooks.cpp Wed May 29 20:12:22 2013 +0100 +++ b/UIBooks.cpp Wed May 29 22:51:00 2013 +0100 @@ -320,11 +320,11 @@ static const char *texNames[9] = // 004E24EC { "SBFB00", "SBAB00", "SBWB00", "SBEB00", - "SBSB00", "SBMB00", "SBBB00", "SBLB00", + "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" }; pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); - for (uint i = 0; i < 8; ++i) + for (uint i = 0; i < 9; ++i) { pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); @@ -432,7 +432,7 @@ pTexture_pagemask->Release(); pTexture_506448->Release(); pTexture_50643C->Release(); - for (uint i = 0; i < 8; ++i) + for (uint i = 0; i < 9; ++i) { pSpellBookPagesTextr[i]->Release(); pTextures_tabs[i][0]->Release(); @@ -1712,7 +1712,7 @@ } ++v4; } - while ( v4 + v1 - 1 < v1 + 11 ); + while ( v4 - 1 < 11 ); }
--- a/mm7_2.cpp Wed May 29 20:12:22 2013 +0100 +++ b/mm7_2.cpp Wed May 29 22:51:00 2013 +0100 @@ -11068,7 +11068,7 @@ } //----- (0046BEF1) -------------------------------------------------------- -void SpriteObject::_46BEF1_apply_spells() +void SpriteObject::_46BEF1_apply_spells_aoe() { SpriteObject *v1; // edi@1 Actor *v2; // esi@2 @@ -11077,6 +11077,8 @@ unsigned __int8 v5; // c3@4 signed int v6; // [sp+8h] [bp-4h]@1 + int v7,v8,v9,v10,v11; + v6 = 0; v1 = this; if ( (signed int)uNumActors > 0 ) @@ -11087,7 +11089,79 @@ if ( v2->CanAct() ) { //UNDEF(v3); - if ( !(v4 | v5) ) + //.text:0046BF26 movsx eax, word ptr [esi-2] + //.text:0046BF2A sub eax, [edi+4] + //.text:0046BF31 mov [ebp+var_8], eax + //.text:0046BF37 fild [ebp+var_8] + // v7 pushed to stack + v7 = v2->vPosition.x - this->vPosition.x; + + //.text:0046BF2D movsx ecx, word ptr [esi+2] + v8 = v2->vPosition.z; + + //.text:0046BF34 movsx eax, word ptr [esi] + //.text:0046BF3A sub eax, [edi+8] + //.text:0046BF3D mov [ebp+var_8], eax + //.text:0046BF44 fild [ebp+var_8] + // v9 pushed to stack + v9 = v2->vPosition.y - this->vPosition.y; + + //.text:0046BF40 movsx eax, word ptr [esi-6] + //.text:0046BF47 sar eax, 1 + //.text:0046BF49 add eax, ecx + //.text:0046BF4B sub eax, [edi+0Ch] + //.text:0046BF4E mov [ebp+var_8], eax + //.text:0046BF51 fild [ebp+var_8] + //.text:0046BF58 fld st + // v10 pushed to stack, two times + v10 = v2->uActorHeight / 2 + v8 - this->vVelocity.y; + + //.text:0046BF54 movsx eax, word ptr [esi-8] + //.text:0046BF5A add eax, 100h + //.text:0046BF63 mov ecx, eax + v11 = this->vVelocity.x; + + //.text:0046BF5F fmul st, st(1) + // stack: v10*v10, v10, v9, v7 + //.text:0046BF61 fld st(2) + // stack: v7, v10*v10, v10, v9, v7 + + + //.text:0046BF65 fmul st, st(3) + // stack: v7*v9, v10*v10, v10, v9, v7 + + //.text:0046BF67 imul ecx, eax + v11 = v11 * v11; + + //.text:0046BF6A faddp st(1), st + // stack: v10*v10+v7*v9, v10, v9, v7 + //.text:0046BF6C fld st(3) + // stack: v7, v10*v10+v7*v9, v10, v9, v7 + //.text:0046BF6E fmul st, st(4) + // stack: v7*v7, v10*v10+v7*v9, v10, v9, v7 + //.text:0046BF70 faddp st(1), st + // stack: v10*v10+v7*v9+v7*v7, v10, v9, v7 + + //.text:0046BF72 mov [ebp+var_8], ecx + //.text:0046BF75 fild [ebp+var_8] + // v11 pushed to stack + + //.text:0046BF78 fcompp + // if ( v11 > v10*v10+v7*v9+v7*v7 ) + // stack: v10, v9, v7 + + //.text:0046BF7A fstp st + // stack: v9, v7 + + //.text:0046BF7C fnstsw ax + //.text:0046BF7E fstp st + // stack: v7 + + //.text:0046BF80 test ah, 41h + //.text:0046BF83 fstp st + //.text:0046BF85 jnz short loc_46BFDD + + if ( v11 >= v10*v10+v7*v9+v7*v7 ) { if ( stru_50C198.GetMagicalResistance(v2, 0xAu) ) { @@ -11348,7 +11422,7 @@ { if ( v6 != 9030 || v2->spell_skill != 4 ) goto LABEL_246; - v2->_46BEF1_apply_spells(); + v2->_46BEF1_apply_spells_aoe(); LABEL_233: if ( !v138 ) { @@ -11457,7 +11531,7 @@ } else { - v2->_46BEF1_apply_spells(); + v2->_46BEF1_apply_spells_aoe(); } v2->spell_level = 0; v2->spell_skill = 0;
--- a/mm7_3.cpp Wed May 29 20:12:22 2013 +0100 +++ b/mm7_3.cpp Wed May 29 22:51:00 2013 +0100 @@ -14558,8 +14558,6 @@ } } } - ++v84; - ++v5; } for(int i = 1; i <= 4; i++) {
--- a/mm7_6.cpp Wed May 29 20:12:22 2013 +0100 +++ b/mm7_6.cpp Wed May 29 22:51:00 2013 +0100 @@ -2647,7 +2647,7 @@ Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 - char v710; // [sp+D8Ch] [bp-F8h]@1156 + int v710; // [sp+D8Ch] [bp-F8h]@1156 __int64 v712; // [sp+D94h] [bp-F0h]@991 int v713; // [sp+D9Ch] [bp-E8h]@324 int n; // [sp+DA0h] [bp-E4h]@1 @@ -6394,7 +6394,7 @@ v643 = rand(); v721 = v642 + pParty->vPosition.x; y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); - v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); + v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, &v710, 0); v644 = rand(); sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); --_v726;
--- a/mm7_data.cpp Wed May 29 20:12:22 2013 +0100 +++ b/mm7_data.cpp Wed May 29 22:51:00 2013 +0100 @@ -390,8 +390,8 @@ char aIcons[777]; // idb char aPending[777]; // idb char aCanTFindS[777]; // idb -char *spellbook_texture_filename_suffices[8] = {"f", "a", "w", "e", "s", "m", "b", "l"}; // weak -__int16 word_4E1D3A[777]; // weak +char *spellbook_texture_filename_suffices[9] = {"f", "a", "w", "e", "s", "m", "b", "l", "d"}; // weak +//__int16 word_4E1D3A[777]; // weak __int16 pTownPortalBook_xs[6] = {260, 324, 147, 385, 390, 19}; __int16 pTownPortalBook_ys[6] = {206, 84, 182, 239, 17, 283}; __int16 pTownPortalBook_ws[6] = { 80, 66, 68, 72, 67, 74}; @@ -1063,9 +1063,9 @@ int dword_50BAE8[777]; // weak int stru_50B700._xs2[3 + 45]; // weak int stru_50B700._xs3[48]; // weak*/ -int dword_50BC10[777]; // weak -int dword_50BDA0[777]; // weak -int dword_50BF30[777]; // weak +int dword_50BC10[100]; // weak +int dword_50BDA0[100]; // weak +int dword_50BF30[100]; // weak char town_portal_caster_id; // weak int some_active_character; // weak //_UNKNOWN unk_50C190; // weak
--- a/mm7_data.h Wed May 29 20:12:22 2013 +0100 +++ b/mm7_data.h Wed May 29 22:51:00 2013 +0100 @@ -1382,6 +1382,7 @@ int __fastcall MakeColorMaskFromBitDepth(int a1); void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels); int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides); // idb +inline int round(float x) { return (floor(x + 0.5)); } inline void __fastcall memset32(void *ptr, unsigned __int32 value, int count) { auto p = (unsigned __int32 *)ptr;