Mercurial > mm7
changeset 722:70c5a87a1307
Слияние
author | Ritor1 |
---|---|
date | Wed, 20 Mar 2013 17:49:15 +0600 |
parents | f39d5902c85a (diff) d6236f6a9882 (current diff) |
children | 256211e8243a |
files | mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp |
diffstat | 13 files changed, 454 insertions(+), 463 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/Indoor.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -3160,10 +3160,10 @@ //Vec3_short_ *v34; // edx@27 int v35; // edx@32 int v37; // edi@38 - int v38; // ebx@40 + int pSectorID; // ebx@40 int v39; // eax@41 - BLVFace *v40; // esi@42 - PolygonType v41; // dl@42 + BLVFace *pFace; // esi@42 + PolygonType pPolygonType; // dl@42 int v42; // edx@43 int v43[50]; // [sp+Ch] [bp-108h]@1 //int v44; // [sp+D4h] [bp-40h]@9 @@ -3236,10 +3236,10 @@ //pVertexIDs = pFace->pVertexIDs; //v19 = this->pVertices; //v20 = pVertices[pFace->pVertexIDs[0]].y; - v54 = 0; - //v57 = 0; - //v5 = v16->uNumVertices == 0; - v59 = pVertices[pFace->pVertexIDs[0]].y >= sY; + v54 = 0; + //v57 = 0; + //v5 = v16->uNumVertices == 0; + v59 = pVertices[pFace->pVertexIDs[0]].y >= sY; //v21 = pFace->pVertexIDs + 1; for (uint k = 1; k < pFace->uNumVertices; ++k) @@ -3297,24 +3297,24 @@ ++v54; } } - } - } - - v59 = v50; - } - - if (pFace->uNumVertices) - { - if (v54 == 1) - { - v35 = v55++; - v43[v35] = uFaceID; - } - } - } + } + } + + v59 = v50; + } + + if (pFace->uNumVertices) + { + if (v54 == 1) + { + v35 = v55++; + v43[v35] = uFaceID; + } + } } - v4 = v43[0]; } + v4 = v43[0]; + } } if ( v55 == 1 ) @@ -3322,45 +3322,46 @@ v37 = 0; if ( !v55 ) return 0; - v38 = 0; + pSectorID = 0; v53 = 0xFFFFFFu; if ( v55 > 0 ) { v39 = sY; while ( 1 ) { - v40 = &this->pFaces[v43[v37]]; - v41 = v40->uPolygonType; - if ( v41 == 3 ) - break; - if ( v41 == 4 ) + pFace = &this->pFaces[v43[v37]]; + //pPolygonType = pFace->uPolygonType; + if ( pFace->uPolygonType == POLYGON_Floor ) { - v51 = v40->zCalc1; - v57 = (unsigned __int64)(v51 * (signed __int64)(sX << 16)) >> 16; - v56 = sY << 16; - v51 = v40->zCalc2; - v56 = (unsigned __int64)(v51 * (signed __int64)(sY << 16)) >> 16; - v42 = (v56 + v40->zCalc3 + v57 + 32768) >> 16; + v42 = this->pVertices[*pFace->pVertexIDs].z; + v39 = sZ - v42; + //goto LABEL_47; + } + if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) + { + //v51 = pFace->zCalc1; + v57 = (unsigned __int64)(pFace->zCalc1 * (signed __int64)(sX << 16)) >> 16; + //v56 = sY << 16; + //v51 = pFace->zCalc2; + v56 = (unsigned __int64)(pFace->zCalc2 * (signed __int64)(sY << 16)) >> 16; + v42 = (v56 + pFace->zCalc3 + v57 + 32768) >> 16; v39 = sZ - v42; } -LABEL_47: +//LABEL_47: if ( v39 >= 0 ) { if ( v39 < v53 ) { - v38 = v40->uSectorID; + pSectorID = pFace->uSectorID; v53 = v39; } } ++v37; if ( v37 >= v55 ) - return v38; + return pSectorID; } - v42 = this->pVertices[*v40->pVertexIDs].z; - v39 = sZ - v42; - goto LABEL_47; } - return v38; + //return pSectorID; } // 49AC17: using guessed type int var_108[50];
--- a/Player.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/Player.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -8979,7 +8979,7 @@ goto LABEL_82; case VAR_FixedFood: Party::GiveFood(val); - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); ShowStatusBarString(pTmpBuf, 2u); if ( pParty->uNumFoodRations > 0xFFFF ) Party::SetFood(0xFFFFu);
--- a/Render.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/Render.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -7213,7 +7213,7 @@ } ++v7; } -LABEL_23: +//LABEL_23: uNumBillboardsToDraw++; return v7; } @@ -7231,7 +7231,9 @@ } while ( v12 ); } - goto LABEL_23; + //goto LABEL_23; + uNumBillboardsToDraw++; + return v7; } return v7; } @@ -8075,19 +8077,19 @@ //----- (004A43B1) -------------------------------------------------------- -void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *a3, int dimming_level) -{ - RenderBillboardTransform_local0 *v4; // ebx@2 - double v5; // st7@2 - float v6; // ST08_4@2 +void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) +{ + //RenderBillboardTransform_local0 *v4; // ebx@2 + //double v5; // st7@2 + //float v6; // ST08_4@2 unsigned int v7; // eax@2 - int v8; // ecx@2 - unsigned int v9; // esi@2 - Sprite *v10; // edi@5 + //int v8; // ecx@2 + //unsigned int v9; // esi@2 + //Sprite *v10; // edi@5 signed int v11; // eax@9 signed int v12; // eax@9 - double v13; // st7@12 - double v14; // st6@12 + //double v13; // st7@12 + //double v14; // st6@12 double v15; // st5@12 double v16; // st4@12 double v17; // st3@12 @@ -8096,109 +8098,109 @@ double v20; // st3@14 int v21; // ecx@16 double v22; // st3@16 - IDirect3DTexture2 *v23; // eax@18 - signed int v24; // [sp+18h] [bp-18h]@5 - signed int v25; // [sp+1Ch] [bp-14h]@5 - Render *v26; // [sp+20h] [bp-10h]@1 + //IDirect3DTexture2 *v23; // eax@18 + //signed int v24; // [sp+18h] [bp-18h]@5 + //signed int v25; // [sp+1Ch] [bp-14h]@5 + //Render *v26; // [sp+20h] [bp-10h]@1 float v27; // [sp+24h] [bp-Ch]@5 int v28; // [sp+28h] [bp-8h]@2 float v29; // [sp+2Ch] [bp-4h]@5 - float pSoftBillboarda; // [sp+38h] [bp+8h]@2 + //float pSoftBillboarda; // [sp+38h] [bp+8h]@2 float v31; // [sp+3Ch] [bp+Ch]@5 - float v32; // [sp+3Ch] [bp+Ch]@12 + //float v32; // [sp+3Ch] [bp+Ch]@12 float a1; // [sp+40h] [bp+10h]@5 - v26 = this; + //v26 = this; if ( this->uNumD3DSceneBegins ) { - v4 = pSoftBillboard; - v5 = (double)pSoftBillboard->zbuffer_depth; - pSoftBillboarda = v5; - v6 = v5; - v7 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v6)); - v8 = dimming_level; - v9 = v7; + //v4 = pSoftBillboard; + //v5 = (double)pSoftBillboard->zbuffer_depth; + //pSoftBillboarda = pSoftBillboard->zbuffer_depth; + //v6 = pSoftBillboard->zbuffer_depth; + v7 = Billboard_ProbablyAddToListAndSortByZOrder(pSoftBillboard->zbuffer_depth); + //v8 = dimming_level; + //v9 = v7; v28 = dimming_level & 0xFF000000; if ( dimming_level & 0xFF000000 ) - pBillboardRenderListD3D[v9].uOpacity = RenderBillboardD3D::Opaque_3; + pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Opaque_3; else - pBillboardRenderListD3D[v9].uOpacity = RenderBillboardD3D::Transparent; - v10 = a3; - pBillboardRenderListD3D[v9].field_90 = v4->field_44; - pBillboardRenderListD3D[v9].sZValue = v4->sZValue; - pBillboardRenderListD3D[v9].uParentBillboardID = v4->uParentBillboardID; - v25 = v4->uScreenSpaceX; - v24 = v4->uScreenSpaceY; - a1 = (v4->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(v4->_screenspace_x_scaler_packedfloat); - v29 = (v4->_screenspace_y_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(v4->_screenspace_y_scaler_packedfloat); - v31 = (double)((v10->uBufferWidth >> 1) - v10->uAreaX); - v27 = (double)(v10->uBufferHeight - v10->uAreaY); - if ( v4->uFlags & 4 ) + pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Transparent; + //v10 = a3; + pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44; + pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue; + pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID; + //v25 = pSoftBillboard->uScreenSpaceX; + //v24 = pSoftBillboard->uScreenSpaceY; + a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat); + v29 = (pSoftBillboard->_screenspace_y_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_y_scaler_packedfloat); + v31 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); + v27 = (double)(pSprite->uBufferHeight - pSprite->uAreaY); + if ( pSoftBillboard->uFlags & 4 ) v31 = v31 * -1.0; - if ( v4->uTintColor && v26->bTinting ) - { - v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboarda, 0, 0); - v12 = sub_4A19D8(v4->uTintColor, v11); + if ( pSoftBillboard->uTintColor && this->bTinting ) + { + v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); + v12 = sub_4A19D8(pSoftBillboard->uTintColor, v11); if ( v28 ) v12 = (unsigned int)((char *)&array_77EC08[1852].pEdgeList1[17] + 3) & ((unsigned int)v12 >> 1); } else { - v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboarda, 0, 0); - } - v13 = (double)v25; - pBillboardRenderListD3D[v9].pQuards[0].specular = 0; - pBillboardRenderListD3D[v9].pQuards[0].diffuse = v12; - pBillboardRenderListD3D[v9].pQuards[0].pos.x = v13 - v31 * a1; - v14 = (double)v24; - v32 = v14; - pBillboardRenderListD3D[v9].pQuards[0].pos.y = v14 - v27 * v29; - v15 = 1.0 - 1.0 / (pSoftBillboarda * 0.061758894); - pBillboardRenderListD3D[v9].pQuards[0].pos.z = v15; - v16 = 1.0 / pSoftBillboarda; - pBillboardRenderListD3D[v9].pQuards[0].rhw = 1.0 / pSoftBillboarda; - pBillboardRenderListD3D[v9].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v9].pQuards[0].texcoord.y = 0.0; - v17 = (double)((v10->uBufferWidth >> 1) - v10->uAreaX); - v18 = (double)(v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight); - if ( v4->uFlags & 4 ) + v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); + } + //v13 = (double)v25; + pBillboardRenderListD3D[v7].pQuards[0].specular = 0; + pBillboardRenderListD3D[v7].pQuards[0].diffuse = v12; + pBillboardRenderListD3D[v7].pQuards[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; + //v14 = (double)v24; + //v32 = v14; + pBillboardRenderListD3D[v7].pQuards[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; + v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894); + pBillboardRenderListD3D[v7].pQuards[0].pos.z = v15; + v16 = 1.0 / pSoftBillboard->zbuffer_depth; + pBillboardRenderListD3D[v7].pQuards[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; + pBillboardRenderListD3D[v7].pQuards[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v7].pQuards[0].texcoord.y = 0.0; + v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); + v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight); + if ( pSoftBillboard->uFlags & 4 ) v17 = v17 * -1.0; - pBillboardRenderListD3D[v9].pQuards[1].specular = 0; - pBillboardRenderListD3D[v9].pQuards[1].diffuse = v12; - pBillboardRenderListD3D[v9].pQuards[1].pos.x = v13 - v17 * a1; - pBillboardRenderListD3D[v9].pQuards[1].pos.y = v32 - v18 * v29; - pBillboardRenderListD3D[v9].pQuards[1].pos.z = v15; - pBillboardRenderListD3D[v9].pQuards[1].rhw = v16; - pBillboardRenderListD3D[v9].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v9].pQuards[1].texcoord.y = 1.0; - v19 = v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight; - v20 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth); - if ( v4->uFlags & 4 ) + pBillboardRenderListD3D[v7].pQuards[1].specular = 0; + pBillboardRenderListD3D[v7].pQuards[1].diffuse = v12; + pBillboardRenderListD3D[v7].pQuards[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; + pBillboardRenderListD3D[v7].pQuards[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; + pBillboardRenderListD3D[v7].pQuards[1].pos.z = v15; + pBillboardRenderListD3D[v7].pQuards[1].rhw = v16; + pBillboardRenderListD3D[v7].pQuards[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v7].pQuards[1].texcoord.y = 1.0; + v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight; + v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); + if ( pSoftBillboard->uFlags & 4 ) v20 = v20 * -1.0; - pBillboardRenderListD3D[v9].pQuards[2].specular = 0; - pBillboardRenderListD3D[v9].pQuards[2].diffuse = v12; - pBillboardRenderListD3D[v9].pQuards[2].pos.x = v20 * a1 + v13; - pBillboardRenderListD3D[v9].pQuards[2].pos.y = v32 - (double)v19 * v29; - pBillboardRenderListD3D[v9].pQuards[2].pos.z = v15; - pBillboardRenderListD3D[v9].pQuards[2].rhw = v16; - pBillboardRenderListD3D[v9].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v9].pQuards[2].texcoord.y = 1.0; - v21 = v10->uBufferHeight - v10->uAreaY; - v22 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth); - if ( v4->uFlags & 4 ) + pBillboardRenderListD3D[v7].pQuards[2].specular = 0; + pBillboardRenderListD3D[v7].pQuards[2].diffuse = v12; + pBillboardRenderListD3D[v7].pQuards[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; + pBillboardRenderListD3D[v7].pQuards[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; + pBillboardRenderListD3D[v7].pQuards[2].pos.z = v15; + pBillboardRenderListD3D[v7].pQuards[2].rhw = v16; + pBillboardRenderListD3D[v7].pQuards[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v7].pQuards[2].texcoord.y = 1.0; + v21 = pSprite->uBufferHeight - pSprite->uAreaY; + v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); + if ( pSoftBillboard->uFlags & 4 ) v22 = v22 * -1.0; - pBillboardRenderListD3D[v9].pQuards[3].specular = 0; - pBillboardRenderListD3D[v9].pQuards[3].diffuse = v12; - pBillboardRenderListD3D[v9].pQuards[3].pos.x = v22 * a1 + v13; - pBillboardRenderListD3D[v9].pQuards[3].pos.y = v32 - (double)v21 * v29; - pBillboardRenderListD3D[v9].pQuards[3].pos.z = v15; - pBillboardRenderListD3D[v9].pQuards[3].rhw = v16; - pBillboardRenderListD3D[v9].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v9].pQuards[3].texcoord.y = 0.0; - v23 = v10->pTexture; - pBillboardRenderListD3D[v9].uNumVertices = 4; - pBillboardRenderListD3D[v9].z_order = pSoftBillboarda; - pBillboardRenderListD3D[v9].pTexture = v23; + pBillboardRenderListD3D[v7].pQuards[3].specular = 0; + pBillboardRenderListD3D[v7].pQuards[3].diffuse = v12; + pBillboardRenderListD3D[v7].pQuards[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; + pBillboardRenderListD3D[v7].pQuards[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; + pBillboardRenderListD3D[v7].pQuards[3].pos.z = v15; + pBillboardRenderListD3D[v7].pQuards[3].rhw = v16; + pBillboardRenderListD3D[v7].pQuards[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v7].pQuards[3].texcoord.y = 0.0; + //v23 = pSprite->pTexture; + pBillboardRenderListD3D[v7].uNumVertices = 4; + pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; + pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture; } }
--- a/Render.h Tue Mar 19 21:53:21 2013 +0400 +++ b/Render.h Wed Mar 20 17:49:15 2013 +0600 @@ -329,7 +329,7 @@ void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard); - void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *a3, int dimming_level); + void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level); int MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6); void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9); void _4A4CC9(struct stru6_stru1_indoor_sw_billboard *a1, int a2);
--- a/SpriteObject.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/SpriteObject.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -594,10 +594,10 @@ //----- (0047136C) -------------------------------------------------------- void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID) { - SpriteObject *v1; // esi@1 - ObjectDesc *v2; // edi@1 - int v3; // ST08_4@1 - __int16 v4; // ax@5 + SpriteObject *pSpriteObject; // esi@1 + ObjectDesc *pObject; // edi@1 + //int v3; // ST08_4@1 + //__int16 v4; // ax@5 __int16 v5; // ax@7 BLVFace *v6; // ecx@11 BLVFace *v7; // eax@11 @@ -629,8 +629,8 @@ enum TEXTURE_TYPE v33; // [sp-4h] [bp-94h]@19 enum TEXTURE_TYPE v34; // [sp-4h] [bp-94h]@68 Particle_sw Dst; // [sp+Ch] [bp-84h]@18 - unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 - ObjectDesc *v37; // [sp+78h] [bp-18h]@1 + //unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 + //ObjectDesc *v37; // [sp+78h] [bp-18h]@1 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 int v39; // [sp+80h] [bp-10h]@33 Actor *v39b; @@ -638,24 +638,24 @@ int v41; // [sp+88h] [bp-8h]@34 int v42; // [sp+8Ch] [bp-4h]@4 - uLayingItemID_ = uLayingItemID; - v1 = &pSpriteObjects[uLayingItemID]; - v2 = &pObjectList->pObjects[v1->uObjectDescID]; - v3 = v1->vPosition.x; - v37 = &pObjectList->pObjects[v1->uObjectDescID]; - if ( abs(v3) > 32767 - || abs(v1->vPosition.y) > 32767 - || abs(v1->vPosition.z) > 20000 - || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v1->uSectorID, &uFaceID), - v42 <= -30000) - && ((v4 = pIndoor->GetSector(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z), - (v1->uSectorID = v4) == 0) - || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &uFaceID), v42 == -30000)) ) + //uLayingItemID_ = uLayingItemID; + pSpriteObject = &pSpriteObjects[uLayingItemID]; + pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID]; + //v3 = pSpriteObject->vPosition.x; + //v37 = &pObjectList->pObjects[pSpriteObject->uObjectDescID]; + pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z); + v42 = _46CEC3_get_floor_level(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID); + if ( abs(pSpriteObject->vPosition.x) > 32767 + || abs(pSpriteObject->vPosition.y) > 32767 + || abs(pSpriteObject->vPosition.z) > 20000 + || v42 <= -30000 + && (pSpriteObject->uSectorID == 0)) +// || (v42 = _46CEC3_get_floor_level(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, v4, &uFaceID), v42 == -30000)) ) { - SpriteObject::OnInteraction(uLayingItemID_); + SpriteObject::OnInteraction(uLayingItemID); return; } - v5 = v2->uFlags; + v5 = pObject->uFlags; if ( v5 & 0x20 ) { LABEL_24: @@ -663,24 +663,24 @@ LABEL_25: stru_721530.field_0 = v8; uFaceID = v8; - stru_721530.prolly_normal_d = v2->uRadius; - v12 = v2->uHeight; + stru_721530.prolly_normal_d = pObject->uRadius; + v12 = pObject->uHeight; stru_721530.field_84 = -1; stru_721530.field_C = v12; stru_721530.field_8 = v8; stru_721530.field_70 = v8; while ( 1 ) { - stru_721530.field_34.x = v1->vPosition.x; + stru_721530.field_34.x = pSpriteObject->vPosition.x; stru_721530.normal.x = stru_721530.field_34.x; - stru_721530.field_34.y = v1->vPosition.y; + stru_721530.field_34.y = pSpriteObject->vPosition.y; stru_721530.normal.y = stru_721530.field_34.y; - stru_721530.field_34.z = stru_721530.prolly_normal_d + v1->vPosition.z + 1; + stru_721530.field_34.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1; stru_721530.normal.z = stru_721530.field_34.z; - stru_721530.field_1C = v1->vVelocity.x; - stru_721530.field_20 = v1->vVelocity.y; - stru_721530.field_24 = v1->vVelocity.z; - stru_721530.uSectorID = v1->uSectorID; + stru_721530.field_1C = pSpriteObject->vVelocity.x; + stru_721530.field_20 = pSpriteObject->vVelocity.y; + stru_721530.field_24 = pSpriteObject->vVelocity.z; + stru_721530.uSectorID = pSpriteObject->uSectorID; if ( stru_721530._47050A(v8) ) return; v40 = v8; @@ -688,9 +688,9 @@ { _46E44E_collide_against_faces_and_portals(0); _46E0B2_collide_against_decorations(); - if ( (v1->field_58_pid & 7) != OBJECT_Player) + if ( (pSpriteObject->field_58_pid & 7) != OBJECT_Player) _46EF01_collision_chech_player(1); - v13 = v1->field_58_pid; + v13 = pSpriteObject->field_58_pid; v42 = v8; if ( (v13 & 7) == OBJECT_Actor) { @@ -703,7 +703,7 @@ //v14 = (signed __int64)((double)v41 * 0.3333333333333333); //v41 = *(short *)(v39 - 38) - 1; //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) - if( pActors[v1->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) + if( pActors[pSpriteObject->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); ++v42; @@ -733,17 +733,17 @@ while ( v40 < 100 ); if ( stru_721530.field_7C >= stru_721530.field_6C ) { - v1->vPosition.x = stru_721530.normal2.x; - v1->vPosition.y = stru_721530.normal2.y; - v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; - v1->uSectorID = LOWORD(stru_721530.uSectorID); - if ( !(HIBYTE(v2->uFlags) & 1) ) + pSpriteObject->vPosition.x = stru_721530.normal2.x; + pSpriteObject->vPosition.y = stru_721530.normal2.y; + pSpriteObject->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; + pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); + if ( !(HIBYTE(pObject->uFlags) & 1) ) return; memset(&Dst, v8, 0x68u); - v29 = v2->uFlags; - Dst.x = (double)v1->vPosition.x; - Dst.y = (double)v1->vPosition.y; - Dst.z = (double)v1->vPosition.z; + v29 = pObject->uFlags; + Dst.x = (double)pSpriteObject->vPosition.x; + Dst.y = (double)pSpriteObject->vPosition.y; + Dst.z = (double)pSpriteObject->vPosition.z; Dst.flt_10 = 0.0; Dst.flt_14 = 0.0; Dst.flt_18 = 0.0; @@ -758,7 +758,15 @@ else { if ( v29 & 0x400 ) - goto LABEL_70; + { + Dst.type = ParticleType_Line; + Dst.uDiffuse = rand(); + Dst.timeToLive = 64; + Dst.uTextureID = v8; + Dst.flt_28 = 1.0; + pGame->pParticleEngine->AddParticle(&Dst); + return; + } Dst.type = ParticleType_Bitmap | ParticleType_8; Dst.uDiffuse = rand(); v30 = rand(); @@ -767,34 +775,35 @@ } Dst.timeToLive = (unsigned __int8)(v30 & 0x80) + 128; Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34); - goto LABEL_71; + Dst.flt_28 = 1.0; + pGame->pParticleEngine->AddParticle(&Dst); + return; } v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; - v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; + pSpriteObject->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; - v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; + pSpriteObject->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; - v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; - v1->uSectorID = LOWORD(stru_721530.uSectorID); + pSpriteObject->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; + pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); stru_721530.field_70 += stru_721530.field_7C; - if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) + if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) return; v15 = (signed int)stru_721530.uFaceID >> 3; if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) { - v40 = integer_sqrt(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y); - v23 = stru_5C6E00->Atan2( - v1->vPosition.x - pLevelDecorations[v15].vPosition.x, - v1->vPosition.y - pLevelDecorations[v15].vPosition.y); + v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y); + v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x, + pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y); v42 = stru_5C6E00->Cos(v23); v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; v24 = v23; - v1->vVelocity.x = (unsigned int)(v42 * v40) >> 16; + pSpriteObject->vVelocity.x = (unsigned int)(v42 * v40) >> 16; v25 = stru_5C6E00->Sin(v23); v42 = v25; v26 = v25 * (signed __int64)v40; v41 = v26 >> 16; - v1->vVelocity.y = WORD1(v26); + pSpriteObject->vVelocity.y = WORD1(v26); } else { @@ -804,8 +813,8 @@ v16 = &pIndoor->pFaces[v15]; if ( v16->uPolygonType != 3 ) { - v42 = abs(v16->pFacePlane_old.vNormal.x * v1->vVelocity.x + v16->pFacePlane_old.vNormal.z * v1->vVelocity.z - + v16->pFacePlane_old.vNormal.y * v1->vVelocity.y) >> 16; + v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z + + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; if ( stru_721530.field_64 >> 3 > v42 ) v42 = stru_721530.field_64 >> 3; v40 = v16->pFacePlane_old.vNormal.x; @@ -814,8 +823,8 @@ v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; v39 = v16->pFacePlane_old.vNormal.z; v39 = (unsigned __int64)(v42 * (signed __int64)v39) >> 16; - v1->vVelocity.x += 2 * v40; - v1->vVelocity.y += 2 * v41; + pSpriteObject->vVelocity.x += 2 * v40; + pSpriteObject->vVelocity.y += 2 * v41; if ( v16->pFacePlane_old.vNormal.z <= 32000 ) { v22 = 2 * v39; @@ -824,102 +833,107 @@ { v21 = v39; v40 = 32000; - v1->vVelocity.z += v39; + pSpriteObject->vVelocity.z += v39; v41 = (unsigned __int64)(v40 * (signed __int64)v21) >> 16; v22 = (unsigned int)(v40 * v21) >> 16; } - v1->vVelocity.z += v22; - goto LABEL_60; + pSpriteObject->vVelocity.z += v22; + if ( BYTE3(v16->uAttributes) & 0x10 ) + EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); + goto LABEL_63; } - if ( v37->uFlags & 0x80 ) + if ( pObject->uFlags & 0x80 ) { - v17 = -v1->vVelocity.z >> 1; - v1->vVelocity.z = v17; + v17 = -pSpriteObject->vVelocity.z >> 1; + pSpriteObject->vVelocity.z = v17; if ( (signed __int16)v17 < 10 ) - v1->vVelocity.z = 0; -LABEL_60: + pSpriteObject->vVelocity.z = 0; if ( BYTE3(v16->uAttributes) & 0x10 ) EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); goto LABEL_63; } - v18 = v1->vVelocity.y; - v19 = v1->vVelocity.x; - v1->vVelocity.z = 0; + v18 = pSpriteObject->vVelocity.y; + v19 = pSpriteObject->vVelocity.x; + pSpriteObject->vVelocity.z = 0; if ( v19 * v19 + v18 * v18 >= 400 ) - goto LABEL_60; + { + if ( BYTE3(v16->uAttributes) & 0x10 ) + EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); + goto LABEL_63; + } v20 = pIndoor->pVertices; - v1->vVelocity.z = 0; - v1->vVelocity.y = 0; - v1->vVelocity.x = 0; - v1->vPosition.z = v20[*v16->pVertexIDs].z + 1; + pSpriteObject->vVelocity.z = 0; + pSpriteObject->vVelocity.y = 0; + pSpriteObject->vVelocity.x = 0; + pSpriteObject->vPosition.z = v20[*v16->pVertexIDs].z + 1; } LABEL_63: - v2 = v37; + //v2 = v37; LABEL_64: - v41 = v1->vVelocity.x; + v41 = pSpriteObject->vVelocity.x; v40 = 58500; v41 = (unsigned __int64)(58500i64 * v41) >> 16; - v1->vVelocity.x = v41; - v41 = v1->vVelocity.y; + pSpriteObject->vVelocity.x = v41; + v41 = pSpriteObject->vVelocity.y; v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; v40 = 58500; - v1->vVelocity.y = v41; - v41 = v1->vVelocity.z; + pSpriteObject->vVelocity.y = v41; + v41 = pSpriteObject->vVelocity.z; v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; ++uFaceID; v28 = __OFSUB__(uFaceID, 100); v27 = uFaceID - 100 < 0; - v1->vVelocity.z = v41; + pSpriteObject->vVelocity.z = v41; if ( !(v27 ^ v28) ) return; v8 = 0; } } - if ( v42 <= v1->vPosition.z - 3 ) + if ( v42 <= pSpriteObject->vPosition.z - 3 ) { - v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); + pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); goto LABEL_24; } - if ( !(v5 & 0x40) || _46BFFA_check_object_intercept(uLayingItemID_, 0) ) + if ( !(v5 & 0x40) || _46BFFA_check_object_intercept(uLayingItemID, 0) ) { v6 = pIndoor->pFaces; - v1->vPosition.z = v42 + 1; + pSpriteObject->vPosition.z = v42 + 1; v7 = &v6[uFaceID]; if ( v7->uPolygonType == 3 ) { v8 = 0; - v1->vVelocity.z = 0; + pSpriteObject->vVelocity.z = 0; } else { if ( v7->pFacePlane_old.vNormal.z < 45000 ) - v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); + pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); v8 = 0; } - v42 = v1->vVelocity.x; + v42 = pSpriteObject->vVelocity.x; uFaceID = 58500; v42 = (unsigned __int64)(58500i64 * v42) >> 16; - v1->vVelocity.x = v42; - v42 = v1->vVelocity.y; + pSpriteObject->vVelocity.x = v42; + v42 = pSpriteObject->vVelocity.y; v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; uFaceID = 58500; - v1->vVelocity.y = v42; - v42 = v1->vVelocity.z; + pSpriteObject->vVelocity.y = v42; + v42 = pSpriteObject->vVelocity.z; v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; - v9 = v1->vVelocity.x; - v1->vVelocity.z = v42; - if ( v9 * v9 + v1->vVelocity.y * v1->vVelocity.y < 400 ) + v9 = pSpriteObject->vVelocity.x; + pSpriteObject->vVelocity.z = v42; + if ( v9 * v9 + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 ) { - v1->vVelocity.z = v8; - v1->vVelocity.y = v8; - v1->vVelocity.x = v8; - if ( !(HIBYTE(v2->uFlags) & 1) ) + pSpriteObject->vVelocity.z = v8; + pSpriteObject->vVelocity.y = v8; + pSpriteObject->vVelocity.x = v8; + if ( !(pObject->uFlags & 1) ) return; memset(&Dst, v8, 0x68u); - v10 = v2->uFlags; - Dst.x = (double)v1->vPosition.x; - Dst.y = (double)v1->vPosition.y; - Dst.z = (double)v1->vPosition.z; + v10 = pObject->uFlags; + Dst.x = (double)pSpriteObject->vPosition.x; + Dst.y = (double)pSpriteObject->vPosition.y; + Dst.z = (double)pSpriteObject->vPosition.z; Dst.flt_10 = 0.0; Dst.flt_14 = 0.0; Dst.flt_18 = 0.0; @@ -936,14 +950,13 @@ { if ( v10 & 0x400 ) { -LABEL_70: Dst.type = ParticleType_Line; Dst.uDiffuse = rand(); Dst.timeToLive = 64; Dst.uTextureID = v8; -LABEL_71: Dst.flt_28 = 1.0; - goto LABEL_72; + pGame->pParticleEngine->AddParticle(&Dst); + return; } Dst.type = ParticleType_Bitmap | ParticleType_8; Dst.uDiffuse = rand(); @@ -954,7 +967,6 @@ } Dst.timeToLive = (unsigned __int8)(v11 & 0x80) + 128; Dst.uTextureID = pBitmaps_LOD->LoadTexture(v31, v33); -LABEL_72: pGame->pParticleEngine->AddParticle(&Dst); return; }
--- a/UIHouses.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/UIHouses.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -3823,7 +3823,7 @@ //----- (004B4710) -------------------------------------------------------- int __cdecl TrainingDialog() { - Player *v0; // ebx@1 + //Player *v0; // ebx@1 int color2; // eax@1 //unsigned int v2; // ecx@1 //int v3; // eax@1 @@ -3898,7 +3898,7 @@ int v72; // [sp+7Ch] [bp-8h]@16 int v73; // [sp+80h] [bp-4h]@14 - v0 = pPlayers[uActiveCharacter]; + //v0 = pPlayers[uActiveCharacter]; memcpy(&v65, window_SpeakInHouse, sizeof(v65)); v65.uFrameX = 483; v65.uFrameWidth = 148; @@ -3912,22 +3912,22 @@ //for ( i = v2; v4 < (signed int)v2; ++v4 ) // v3 += v4 + 1; //v5 = 1000 * v3; - v5 = 1000ui64 * v0->uLevel * (v0->uLevel + 1) / 2; // E n = n(n + 1) / 2 + v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 //v6 = HIDWORD(v0->uExperience); //v7 = window_SpeakInHouse->ptr_1C; v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89]; //v66 = 1000 * v3; - if (v0->uExperience >= v5) + if (pPlayers[uActiveCharacter]->uExperience >= v5) { - v8 = v0->classType % 4 + 1; + v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; if ( v8 == 4 ) v8 = 3; - v9 = (double)v0->uLevel; + v9 = (double)pPlayers[uActiveCharacter]->uLevel; //i = 0; v69 = v8; //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8); v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); - v11 = v10 * (100 - v0->GetMerchant()) / 100; + v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; if ( v11 < v10 / 3 ) v11 = v10 / 3; //i = v11; @@ -3950,7 +3950,7 @@ v13 = pDialogueWindow; //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - v73 = v14 * (100 - v0->GetMerchant()) / 100; + v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; if ( v73 < v14 / 3 ) v73 = v14 / 3; v15 = v13->pStartingPosActiveItem; @@ -3961,7 +3961,7 @@ do { v17 = v13->GetControl(v15)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] ) + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] ) { v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0); _v0 += v18; @@ -3989,7 +3989,7 @@ v20 = v13->GetControl(_v1); v21 = v20; v22 = v20->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] ) + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] ) { v21->uW = 0; v21->uHeight = 0; @@ -4022,7 +4022,7 @@ else { LABEL_76: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);// + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// // "Seek knowledge elsewhere %s the %s" strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." @@ -4039,24 +4039,24 @@ v31 = pNPCTopics[122].pText; v32 = color2; v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); - v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u); + v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3); result = (int)pDialogueWindow; pDialogueWindow->pNumPresenceButton = 0; return result; } - v34 = v0->uLevel; + v34 = pPlayers[uActiveCharacter]->uLevel; if ( v34 < v68 ) { - if ( (signed __int64)v0->uExperience >= v5 ) + if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) { if ( pParty->uNumGold >= v11) { Party::TakeGold(v11); HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - ++v0->uLevel; - v0->uSkillPoints += v0->uLevel / 10 + 5; - v0->sHealth = v0->GetMaxHealth(); - v0->sMana = v0->GetMaxMana(); + ++pPlayers[uActiveCharacter]->uLevel; + pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; + pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); + pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); v37 = 0; v38 = byte_F8B148; do @@ -4079,17 +4079,18 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) pOutdoor->SetFog(); } - v0->PlaySound(SPEECH_87, 0); - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// + pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// // "%s is now Level %lu and has earned %lu Skill Points!" - ShowStatusBarString(pTmpBuf, 2u); - goto LABEL_56; + ShowStatusBarString(pTmpBuf, 2); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return true; } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" v63 = 4; LABEL_55: HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63); -LABEL_56: +//LABEL_56: /*result = pMessageQueue_50CBD0->uNumMessages; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { @@ -4103,7 +4104,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); return 1; // void function actually } - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - v0->uExperience), v34 + 1);// + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// // "You need %d more experience to train to level %d" v35 = 0; v62 = 3; @@ -4142,13 +4143,13 @@ { if ( v43->GetControl(v73)->uControlParam == 17 ) { - v46 = v0->uLevel; + v46 = pPlayers[uActiveCharacter]->uLevel; if ( v46 < v68 ) { - if ( (signed __int64)v0->uExperience < v5 ) + if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < v5 ) { v64 = (char *)(v46 + 1); - v61 = (char *)(v5 - LODWORD(v0->uExperience)); + v61 = (char *)(v5 - LODWORD(pPlayers[uActiveCharacter]->uExperience)); v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d" } else @@ -4180,7 +4181,7 @@ v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; v50 = -v43->pNumPresenceButton < 0; v73 = v43->pStartingPosActiveItem; - if ( v50 ^ __OFSUB__(result, v48) ) + if ( v50 ^ result < v48 ) { int _v3 = 2; v51 = pShopOptions;
--- a/mm7_1.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/mm7_1.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -1144,7 +1144,7 @@ } else { - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName); ShowStatusBarString(pTmpBuf2, 2u); if ( v22->uItemID == 506 ) _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
--- a/mm7_2.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/mm7_2.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -11930,7 +11930,7 @@ if ( pParty->pPickedItem.uItemID ) return 1; v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName; - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24); ShowStatusBarString(pTmpBuf2, 2u); if ( v19->uItemID == 506 ) _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
--- a/mm7_3.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/mm7_3.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -56,18 +56,18 @@ //----- (0046E44E) -------------------------------------------------------- int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1) { - BLVSector *v1; // edi@1 + BLVSector *pSector; // edi@1 signed int v2; // ebx@1 - BLVFace *v3; // esi@2 - __int16 v4; // si@10 - int v5; // ecx@12 + BLVFace *pFace; // esi@2 + __int16 pNextSector; // si@10 + int pArrayNum; // ecx@12 unsigned __int8 v6; // sf@12 unsigned __int8 v7; // of@12 int result; // eax@14 - BLVSector *v9; // ebx@15 + //BLVSector *v9; // ebx@15 int v10; // ecx@15 - int v11; // eax@16 - BLVFace *v12; // ebp@16 + int pFloor; // eax@16 + //BLVFace *v12; // ebp@16 int v13; // eax@24 int v14; // esi@24 int v15; // eax@24 @@ -88,31 +88,31 @@ int v30; // [sp+24h] [bp-34h]@35 int v31; // [sp+28h] [bp-30h]@24 int v32; // [sp+2Ch] [bp-2Ch]@15 - int v33[10]; // [sp+30h] [bp-28h]@1 - - v1 = &pIndoor->pSectors[stru_721530.uSectorID]; + int pSectorsArray[10]; // [sp+30h] [bp-28h]@1 + + pSector = &pIndoor->pSectors[stru_721530.uSectorID]; v2 = 0; a10 = b1; - v33[0] = stru_721530.uSectorID; - for ( i = 1; v2 < v1->uNumPortals; ++v2 ) - { - v3 = &pIndoor->pFaces[v1->pPortals[v2]]; - if ( stru_721530.sMaxX <= v3->pBounding.x2 - && stru_721530.sMinX >= v3->pBounding.x1 - && stru_721530.sMaxY <= v3->pBounding.y2 - && stru_721530.sMinY >= v3->pBounding.y1 - && stru_721530.sMaxZ <= v3->pBounding.z2 - && stru_721530.sMinZ >= v3->pBounding.z1 - && abs((v3->pFacePlane_old.dist - + stru_721530.normal.x * v3->pFacePlane_old.vNormal.x - + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y - + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 ) - { - v4 = v3->uSectorID == stru_721530.uSectorID ? v3->uBackSectorID : v3->uSectorID; - v5 = i++; - v7 = __OFSUB__(i, 10); + pSectorsArray[0] = stru_721530.uSectorID; + for ( i = 1; v2 < pSector->uNumPortals; ++v2 ) + { + pFace = &pIndoor->pFaces[pSector->pPortals[v2]]; + if ( stru_721530.sMaxX <= pFace->pBounding.x2 + && stru_721530.sMinX >= pFace->pBounding.x1 + && stru_721530.sMaxY <= pFace->pBounding.y2 + && stru_721530.sMinY >= pFace->pBounding.y1 + && stru_721530.sMaxZ <= pFace->pBounding.z2 + && stru_721530.sMinZ >= pFace->pBounding.z1 + && abs((pFace->pFacePlane_old.dist + + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y + + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 ) + { + pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID + pArrayNum = i++; + v7 = i < 10; v6 = i - 10 < 0; - v33[v5] = v4; + pSectorsArray[pArrayNum] = pNextSector; if ( !(v6 ^ v7) ) break; } @@ -123,9 +123,9 @@ { while ( 1 ) { - v9 = &pIndoor->pSectors[v33[result]]; + pSector = &pIndoor->pSectors[pSectorsArray[result]]; v10 = 0; - v32 = v9->uNumFloors + v9->uNumWalls + v9->uNumCeilings; + v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings; v26 = 0; if ( v32 > 0 ) break; @@ -136,53 +136,40 @@ } while ( 1 ) { - v11 = v9->pFloors[v10]; - v12 = &pIndoor->pFaces[v11]; - if ( v12->Portal() - || stru_721530.sMaxX > v12->pBounding.x2 - || stru_721530.sMinX < v12->pBounding.x1 - || stru_721530.sMaxY > v12->pBounding.y2 - || stru_721530.sMinY < v12->pBounding.y1 - || stru_721530.sMaxZ > v12->pBounding.z2 - || stru_721530.sMinZ < v12->pBounding.z1 - || v11 == stru_721530.field_84 ) + pFloor = pSector->pFloors[v10]; + pFace = &pIndoor->pFaces[pFloor]; + if ( pFace->Portal() + || stru_721530.sMaxX > pFace->pBounding.x2 + || stru_721530.sMinX < pFace->pBounding.x1 + || stru_721530.sMaxY > pFace->pBounding.y2 + || stru_721530.sMinY < pFace->pBounding.y1 + || stru_721530.sMaxZ > pFace->pBounding.z2 + || stru_721530.sMinZ < pFace->pBounding.z1 + || pFloor == stru_721530.field_84 ) goto LABEL_45; - v13 = v12->pFacePlane_old.vNormal.y; - v14 = v12->pFacePlane_old.dist; + v13 = pFace->pFacePlane_old.vNormal.y; + v14 = pFace->pFacePlane_old.dist; v31 = v13; - v15 = (stru_721530.normal.x * v12->pFacePlane_old.vNormal.x - + v14 - + stru_721530.normal.y * v13 - + stru_721530.normal.z * v12->pFacePlane_old.vNormal.z) >> 16; + v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13 + + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16; if ( v15 > 0 ) { - v16 = (stru_721530.normal2.y * v31 - + v12->pFacePlane_old.dist - + stru_721530.normal2.z * v12->pFacePlane_old.vNormal.z - + stru_721530.normal2.x * v12->pFacePlane_old.vNormal.x) >> 16; + v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z + + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16; if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) { if ( v16 <= v15 ) { a3 = stru_721530.field_6C; - if ( sub_47531C( - stru_721530.prolly_normal_d, - &a3, - stru_721530.normal.x, - stru_721530.normal.y, - stru_721530.normal.z, - stru_721530.field_58.x, - stru_721530.field_58.y, - stru_721530.field_58.z, - v12, - a10) ) + if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, + stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) ) { v17 = a3; } else { a3 = stru_721530.field_6C + stru_721530.prolly_normal_d; - if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, v12) ) + if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, pFace) ) goto LABEL_34; v17 = a3 - stru_721530.prolly_normal_d; a3 -= stru_721530.prolly_normal_d; @@ -190,7 +177,7 @@ if ( v17 < stru_721530.field_7C ) { stru_721530.field_7C = v17; - v18 = 8 * v9->pFloors[v26]; + v18 = 8 * pSector->pFloors[v26]; LOBYTE(v18) = v18 | 6; stru_721530.uFaceID = v18; } @@ -199,40 +186,27 @@ } LABEL_34: if ( !(stru_721530.field_0 & 1) - || (v19 = v12->pFacePlane_old.vNormal.x, - v20 = v12->pFacePlane_old.vNormal.y, + || (v19 = pFace->pFacePlane_old.vNormal.x, + v20 = pFace->pFacePlane_old.vNormal.y, v30 = v19, - v21 = (stru_721530.field_34.x * v19 - + v12->pFacePlane_old.dist - + stru_721530.field_34.y * v20 - + stru_721530.field_34.z * v12->pFacePlane_old.vNormal.z) >> 16, + v21 = (stru_721530.field_34.x * v19 + pFace->pFacePlane_old.dist + stru_721530.field_34.y * v20 + + stru_721530.field_34.z * pFace->pFacePlane_old.vNormal.z) >> 16, v21 <= 0) - || (v22 = (stru_721530.field_4C * v30 - + v12->pFacePlane_old.dist - + stru_721530.field_50 * v20 - + stru_721530.field_54 * v12->pFacePlane_old.vNormal.z) >> 16, + || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20 + + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16, v21 > stru_721530.prolly_normal_d) && v22 > stru_721530.prolly_normal_d || v22 > v21 ) goto LABEL_45; a3 = stru_721530.field_6C; - if ( sub_47531C( - stru_721530.field_8, - &a3, - stru_721530.field_34.x, - stru_721530.field_34.y, - stru_721530.field_34.z, - stru_721530.field_58.x, - stru_721530.field_58.y, - stru_721530.field_58.z, - v12, - a10) ) + if ( sub_47531C(stru_721530.field_8, &a3, stru_721530.field_34.x, stru_721530.field_34.y, stru_721530.field_34.z, + stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) ) { v23 = a3; goto LABEL_43; } a3 = stru_721530.field_6C + stru_721530.field_8; - if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, v12) ) + if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, pFace) ) { v23 = a3 - stru_721530.prolly_normal_d; a3 -= stru_721530.prolly_normal_d; @@ -240,7 +214,7 @@ if ( v23 < stru_721530.field_7C ) { stru_721530.field_7C = v23; - v24 = 8 * v9->pFloors[v26]; + v24 = 8 * pSector->pFloors[v26]; LOBYTE(v24) = v24 | 6; stru_721530.uFaceID = v24; } @@ -1631,15 +1605,15 @@ int new_party_y; // [sp+48h] [bp-18h]@1 int new_party_x; // [sp+4Ch] [bp-14h]@1 int party_z; // [sp+50h] [bp-10h]@1 - int v89; // [sp+58h] [bp-8h]@1 + //int v89; // [sp+58h] [bp-8h]@1 int angle; // [sp+5Ch] [bp-4h]@47 uFaceEvent = 0; - v89 = pParty->uFallSpeed; + //v89 = pParty->uFallSpeed; v1 = 0; - new_party_y = pParty->vPosition.y; v2 = 0; new_party_x = pParty->vPosition.x; + new_party_y = pParty->vPosition.y; party_z = pParty->vPosition.z; uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v72 = 0; @@ -1730,7 +1704,6 @@ pParty->field_6F8 -= pEventTimer->uTimeElapsed; if ( party_z > v80 + 1 ) { -LABEL_43: if ( bJumping ) goto LABEL_45; goto LABEL_44; @@ -1745,7 +1718,9 @@ if (pFace->uAttributes & 0x04000000 ) { uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; - goto LABEL_43; + if ( bJumping ) + goto LABEL_45; + goto LABEL_44; } } LABEL_44: @@ -1770,13 +1745,22 @@ if ( uTurnSpeed ) goto LABEL_58; v13 = (double)v82 * fTurnSpeedMultiplier; - goto LABEL_51; + v14 = angle + (unsigned __int64)(signed __int64)v13; + angle = stru_5C6E00->uDoublePiMask & v14; + goto LABEL_87; case PARTY_TurnRight: LODWORD(v15) = uTurnSpeed; if ( uTurnSpeed ) - goto LABEL_56; + { + angle = stru_5C6E00->uDoublePiMask & (angle - v15); + goto LABEL_87; + } v16 = (double)v82 * fTurnSpeedMultiplier; - goto LABEL_55; + //{ + v15 = (signed __int64)v16; + angle = stru_5C6E00->uDoublePiMask & (angle - v15); + goto LABEL_87; + //} case PARTY_FastTurnLeft: v12 = uTurnSpeed; if ( uTurnSpeed ) @@ -1787,7 +1771,6 @@ else { v13 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82; -LABEL_51: v14 = angle + (unsigned __int64)(signed __int64)v13; } angle = stru_5C6E00->uDoublePiMask & v14; @@ -1797,13 +1780,11 @@ if ( !uTurnSpeed ) { v16 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82; -LABEL_55: v15 = (signed __int64)v16; } -LABEL_56: angle = stru_5C6E00->uDoublePiMask & (angle - v15); goto LABEL_87; - case PARTY_StrafeLeft: + case PARTY_StrafeLeft://Ctrl + <- __debugbreak(); v17 = stru_5C6E00->Sin(angle); v18 = (double)v81; @@ -1812,7 +1793,9 @@ v2 -= v78; v19 = stru_5C6E00->Cos(angle); v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16; - goto LABEL_63; + v1 += v78; + v78 = 1; + goto LABEL_87; case PARTY_StrafeRight: __debugbreak(); v20 = stru_5C6E00->Sin(angle); @@ -1822,7 +1805,10 @@ v2 += v78; v22 = stru_5C6E00->Cos(angle); v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16; - goto LABEL_68; + //goto LABEL_68; + v1 -= v78; + v78 = 1; + goto LABEL_87; case PARTY_WalkForward: __debugbreak(); v23 = stru_5C6E00->Cos(angle); @@ -1832,9 +1818,9 @@ v2 += v78; v25 = stru_5C6E00->Sin(angle); v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; -LABEL_63: v1 += v78; - goto LABEL_64; + v78 = 1; + goto LABEL_87; case PARTY_WalkBackward: __debugbreak(); v26 = stru_5C6E00->Cos(angle); @@ -1844,9 +1830,7 @@ v2 -= v78; v28 = stru_5C6E00->Sin(angle); v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; -LABEL_68: v1 -= v78; -LABEL_64: v78 = 1; goto LABEL_87; case PARTY_RunForward: @@ -1865,7 +1849,6 @@ v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; -//LABEL_70: v72 = 1; goto LABEL_87; case PARTY_LookUp: @@ -1875,30 +1858,24 @@ v35 = uActiveCharacter; if ( !uActiveCharacter ) goto LABEL_87; - v65 = 0; - v63 = SPEECH_63; - goto LABEL_76; + pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0); + break; case PARTY_LookDown: _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); if ( _view_angle < -128 ) _view_angle = -128; v35 = uActiveCharacter; if ( uActiveCharacter ) - { - v65 = 0; - v63 = SPEECH_64; -LABEL_76: - pPlayers[v35]->PlaySound((PlayerSpeech)v63, v65); - } + pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0); break; case PARTY_CenterView: _view_angle = 0; break; case PARTY_Jump: - if ( (!bJumping || party_z <= v80 + 6 && v89 <= 0) && pParty->field_24 ) + if ( (!bJumping || party_z <= v80 + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 ) { bJumping = 1; - v89 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v89); + pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); } break; default: @@ -1910,22 +1887,22 @@ pParty->sRotationX = _view_angle; if ( bJumping ) { - v89 += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); + pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); } else { if ( pIndoor->pFaces[v68].pFacePlane_old.vNormal.z < 32768 ) { - v89 -= pEventTimer->uTimeElapsed * GetGravityStrength(); + pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength(); goto LABEL_92; } if (pParty->uFlags & PARTY_FLAGS_1_LANDING) goto LABEL_92; - v89 = 0; - } - if ( bJumping != v36 && v89 <= v36 ) - { - if ( v89 < -500 && !pParty->bFlying ) + pParty->uFallSpeed = 0; + } + if ( bJumping != v36 && pParty->uFallSpeed <= v36 ) + { + if ( pParty->uFallSpeed < -500 && !pParty->bFlying ) { v41 = &pPlayers[1]; do @@ -1964,7 +1941,7 @@ stru_721530.field_20 = v1; stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1; stru_721530.field_34.z = stru_721530.field_C + party_z + 1; - stru_721530.field_24 = v89; + stru_721530.field_24 = pParty->uFallSpeed; stru_721530.uSectorID = uSectorID; v38 = 0; if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) @@ -2023,8 +2000,7 @@ { v53 = integer_sqrt(v2 * v2 + v1 * v1); v80 = v53; - v54 = stru_5C6E00->Atan2( - new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, + v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16; v55 = stru_5C6E00->Sin(v54); @@ -2038,8 +2014,8 @@ v45 = v44->uPolygonType; if ( v45 == 3 ) { - if ( v89 < 0 ) - v89 = 0; + if ( pParty->uFallSpeed < 0 ) + pParty->uFallSpeed = 0; v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1; if ( pParty->uFallStartY - v87 < 512 ) pParty->uFallStartY = v87; @@ -2048,9 +2024,11 @@ v1 = 0; v2 = 0; } - goto LABEL_143; - } - v46 = v89 * v44->pFacePlane_old.vNormal.z; + if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) + uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; + goto LABEL_152; + } + v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z; v47 = v45 == 4; v48 = v44->pFacePlane_old.vNormal.x; if ( !v47 ) @@ -2064,7 +2042,7 @@ v82 = v44->pFacePlane_old.vNormal.z; v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; v2 += v50; - v89 += v82; + pParty->uFallSpeed += v82; v74 = v44->pFacePlane_old.vNormal.z; v51 = v44->pFacePlane_old.vNormal.y; v69 = v44->pFacePlane_old.vNormal.x; @@ -2077,9 +2055,7 @@ new_party_y += v52 * v80 >> 16; v87 += v52 * v74 >> 16; } -LABEL_142: v43 = stru_721530.uFaceID; -LABEL_143: if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; goto LABEL_152; @@ -2094,19 +2070,24 @@ v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; v2 += v49; v1 += v81; - v89 += v82; + pParty->uFallSpeed += v82; if ( v2 * v2 + v1 * v1 >= 400 ) - goto LABEL_142; + { + v43 = stru_721530.uFaceID; + if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) + uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; + goto LABEL_152; + } v2 = 0; v1 = 0; - v89 = 0; + pParty->uFallSpeed = 0; } } LABEL_152: v2 = (unsigned __int64)(58500i64 * v2) >> 16; v1 = (unsigned __int64)(58500i64 * v1) >> 16; ++v83; - v89 = (unsigned __int64)(58500i64 * v89) >> 16; + pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; if ( v83 >= 100 ) { new_party_z = v87; @@ -2116,9 +2097,8 @@ if ( bWalkSound && pParty->field_6F8 <= 0 ) { if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y) - * (pParty->vPosition.y - new_party_y) - + (pParty->vPosition.z - new_party_z) - * (pParty->vPosition.z - new_party_z)) <= 16 ) + * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z) + * (pParty->vPosition.z - new_party_z)) <= 16 ) goto LABEL_188; if ( v72 && (!bJumping || bFeatherFall) ) { @@ -2139,7 +2119,6 @@ goto LABEL_175; } v57 = (SoundID)63; -LABEL_174: v56 = pAudioPlayer; goto LABEL_175; } @@ -2155,7 +2134,8 @@ if ( v71 ) { v57 = (SoundID)102; - goto LABEL_174; + v56 = pAudioPlayer; + goto LABEL_175; } v56 = pAudioPlayer; if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) @@ -2180,7 +2160,7 @@ pParty->vPosition.x = new_party_x; pParty->vPosition.z = new_party_z; pParty->vPosition.y = new_party_y; - pParty->uFallSpeed = v89; + //pParty->uFallSpeed = v89; if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) pParty->uFlags |= 0x200; if (uFaceEvent)
--- a/mm7_4.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/mm7_4.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -272,7 +272,7 @@ signed int v34; // eax@54 signed int v35; // esi@56 int result; // eax@57 - int v37; // edi@61 + int pPartyOpp; // edi@61 int v38; // edx@62 //int v39; // [sp+Ch] [bp-34h]@1 //int v40; // [sp+10h] [bp-30h]@2 @@ -496,7 +496,7 @@ } } - v35 = 1; + //v35 = 1; if ( v55 == 1 ) { *pFaceID = dword_721200[0]; @@ -508,25 +508,29 @@ result = dword_7212C8[0]; if ( v55 > 1 ) { - v37 = z + 5; - while ( 1 ) + pPartyOpp = z + 5; + //while ( 1 ) + for ( v35 = 1; v35 < v55; ++v35 ) { v38 = dword_7212C8[v35]; - if ( result <= v37 ) - break; + if ( result <= pPartyOpp ) + { + if ( v38 >= result || v38 > pPartyOpp ) + continue; + result = dword_7212C8[v35]; + *pFaceID = dword_721200[v35]; + continue; + } if ( v38 < result ) - goto LABEL_67; -LABEL_68: - ++v35; - if ( v35 >= v55 ) - return result; - } - if ( v38 <= result || v38 > v37 ) - goto LABEL_68; -LABEL_67: - result = dword_7212C8[v35]; - *pFaceID = dword_721200[v35]; - goto LABEL_68; + { + result = dword_7212C8[v35]; + *pFaceID = dword_721200[v35]; + } +//LABEL_68: + //++v35; + //if ( v35 >= v55 ) + //return result; + } } return result; } @@ -8763,7 +8767,7 @@ v2 = pTransitionStrings[uHouse_ExitPic]; if ( !v2 ) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); v2 = pTmpBuf; } v3 = v2; @@ -10974,10 +10978,7 @@ v14 = pMapStats->GetMapInfo(pCurrentMapName); if ( v14 ) { - v20 = pMapStats->pInfos[v14].pName; - v18 = pGlobalTXT_LocalizationStrings[410]; -LABEL_10: - sprintf(sHouseName, v18, v20); + sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); goto LABEL_20; } v21 = pGlobalTXT_LocalizationStrings[79]; @@ -10990,9 +10991,8 @@ v16 = pMapStats->GetMapInfo(v15); if ( v16 ) { - v20 = pMapStats->pInfos[v16].pName; - v18 = pGlobalTXT_LocalizationStrings[411]; - goto LABEL_10; + sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); + goto LABEL_20; } v21 = pGlobalTXT_LocalizationStrings[73]; LABEL_19:
--- a/mm7_6.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/mm7_6.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -1416,9 +1416,9 @@ Dst.uItemID = pActor->uCarriedItemID; v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; if ( v14 ) - sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); + sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); else - sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); + sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); ShowStatusBarString(pTmpBuf2, 2u); v4 = Dst.uItemID; v5 = Dst.uItemID; @@ -1466,9 +1466,9 @@ pActor->array_000234[3].Reset(); v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; if ( v14 ) - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); else - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); ShowStatusBarString(pTmpBuf2, 2u); if ( !pParty->AddItem(&Dst) ) pParty->SetHoldingItem(&Dst); @@ -1485,9 +1485,9 @@ pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; if ( v14 ) - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); else - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); ShowStatusBarString(pTmpBuf2, 2u); v8 = pParty; if ( !pParty->AddItem(&Dst) ) @@ -6319,7 +6319,7 @@ } else { - sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); + sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); ShowStatusBarString(pTmpBuf2, 2u); if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
--- a/stru6.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/stru6.cpp Wed Mar 20 17:49:15 2013 +0600 @@ -1503,12 +1503,8 @@ pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS); - pRenderer->pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, - D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - vd3d, - 4, - 28); + pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, + D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, vd3d, 4, 28); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);