# HG changeset patch # User Ritor1 # Date 1379513089 -21600 # Node ID 4bbb80c7dba7c254d93648044bfb01f2ab319fbc # Parent 014eb02bd0e62e3f9382be97489f77e0da07ccca# Parent c586fa9e4cbb30a6d463e018ffb8c502ee2725d5 Merge diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Actor.cpp --- a/Actor.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Actor.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -3144,8 +3144,8 @@ v18 = -16; v7->uYawAngle = stru_5C6E00->Atan2( - pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, - pParty->vPosition.y + fixpoint_sub0(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); + pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, + pParty->vPosition.y + fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); if ( uActionLength ) v7->uCurrentActionLength = uActionLength; else diff -r 014eb02bd0e6 -r 4bbb80c7dba7 AudioPlayer.cpp --- a/AudioPlayer.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/AudioPlayer.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -1494,10 +1494,10 @@ a1.vWorldPosition.z = v11; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - v16 = pBLVRenderParams->fCosineNegX; - v17 = pBLVRenderParams->fSineNegX; - v55 = pBLVRenderParams->fCosineY; - v56 = pBLVRenderParams->fSineY; + v16 = pGame->pIndoorCameraD3D->fRotationXCosine; + v17 = pGame->pIndoorCameraD3D->fRotationXSine; + v55 = pGame->pIndoorCameraD3D->fRotationYCosine; + v56 = pGame->pIndoorCameraD3D->fRotationYSine; if (pGame->pIndoorCameraD3D->sRotationX) { v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; diff -r 014eb02bd0e6 -r 4bbb80c7dba7 CastSpellInfo.cpp --- a/CastSpellInfo.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/CastSpellInfo.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -1349,9 +1349,9 @@ else { v155 = stru_5C6E00->Cos(pParty->sRotationY); - uRequiredMana = pParty->vPosition.x + fixpoint_sub0(2048, v155); + uRequiredMana = pParty->vPosition.x + fixpoint_mul(2048, v155); v156 = stru_5C6E00->Sin(pParty->sRotationY); - LODWORD(v727) = pParty->vPosition.y + fixpoint_sub0(2048, v156); + LODWORD(v727) = pParty->vPosition.y + fixpoint_mul(2048, v156); v154 = pParty->vPosition.z; } unsigned __int64 k = 0; @@ -1656,9 +1656,9 @@ else { v212 = stru_5C6E00->Cos(pParty->sRotationY); - LODWORD(v718) = pParty->vPosition.x + fixpoint_sub0(2048, v212); + LODWORD(v718) = pParty->vPosition.x + fixpoint_mul(2048, v212); v213 = stru_5C6E00->Sin(pParty->sRotationY); - v214 = fixpoint_sub0(2048, v213); + v214 = fixpoint_mul(2048, v213); v211 = pParty->vPosition.z; v713 = pParty->vPosition.y + v214; v208 = LODWORD(v725); diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Events2D.h --- a/Events2D.h Wed Sep 18 20:04:30 2013 +0600 +++ b/Events2D.h Wed Sep 18 20:04:49 2013 +0600 @@ -16,8 +16,8 @@ BuildingType_BodyGuild = 11, BuildingType_LightGuild = 12, BuildingType_DarkGuild = 13, - BuildingType_14 = 14, - BuildingType_15 = 15, + BuildingType_ElementalGuild = 14, + BuildingType_SelfGuild = 15, BuildingType_16 = 16, BuildingType_TownHall = 17, BuildingType_18 = 18, diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Game.cpp --- a/Game.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Game.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -81,20 +81,7 @@ pGame->pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353 //pIndoorCamera->Initialize2(); - { - pIndoorCameraD3D->fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationY / 2048.0); - pIndoorCameraD3D->fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationY / 2048.0); - if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - pIndoorCameraD3D->fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-pParty->sRotationX / 2048.0); - pIndoorCameraD3D->fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)-pParty->sRotationX / 2048.0); - } - else - { - pIndoorCameraD3D->fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationX / 2048.0); - pIndoorCameraD3D->fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationX / 2048.0); - } - } + pIndoorCameraD3D->CalculateRotations(pParty->sRotationX, pParty->sRotationY); pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff(); pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum(); diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Indoor.cpp --- a/Indoor.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Indoor.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -195,11 +195,11 @@ this->field_0_timer_ = pEventTimer->uTotalGameTimeElapsed; - this->uFlags = 0; + pGame->pIndoorCameraD3D->debug_flags = 0; if (viewparams->draw_sw_outlines) - this->uFlags |= BLV_RENDER_DRAW_SW_OUTLINES; + pGame->pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_SW_OUTLINES; if (viewparams->draw_d3d_outlines) - this->uFlags |= BLV_RENDER_DRAW_D3D_OUTLINES; + pGame->pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_D3D_OUTLINES; //v2 = a2; //this->field_0_timer_ = a2->field_0_timer; @@ -228,14 +228,14 @@ } if ( pRenderer->pRenderD3D ) { - this->sCosineY = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); - this->sSineY = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); - this->sCosineNegX = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX); - this->sSineNegX = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX); - this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); - this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); - this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); - this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); + //this->sCosineY = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + //this->sSineY = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); + //this->sCosineNegX = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX); + //this->sSineNegX = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX); + //this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); + //this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); + //this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); + //this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); this->field_64 = pViewport->field_30; this->uViewportX = pViewport->uScreen_TL_X; @@ -397,8 +397,8 @@ _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; //_this.fov_deg = 65; - //_this.vPosition.x = pParty->vPosition.x - fixpoint_sub0(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity); - //_this.vPosition.y = pParty->vPosition.y - fixpoint_sub0(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity); + //_this.vPosition.x = pParty->vPosition.x - fixpoint_mul(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity); + //_this.vPosition.y = pParty->vPosition.y - fixpoint_mul(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity); //_this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel; //_this.sRotationX = pParty->sRotationX; //_this.sRotationY = pParty->sRotationY; @@ -818,7 +818,7 @@ nodes[num_nodes].viewing_portal_id = uFaceID; AddBspNodeToRenderList(++num_nodes - 1); } - if (pBLVRenderParams->uFlags & BLV_RENDER_DRAW_SW_OUTLINES) + if (pGame->pIndoorCameraD3D->debug_flags & BLV_RENDER_DRAW_SW_OUTLINES) pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF); //pGame->pIndoorCameraD3D->DebugDrawPortal(pFace); } @@ -2573,16 +2573,16 @@ HIDWORD(v33) = v32 >> 16;*/ //fixpoint_div(v1->x - v2->x, v1->y - v2->y); //_a58 = v33 / (v1->y - v2->y); - //_a59 = fixpoint_sub0(_a58, sY - v2->y); + //_a59 = fixpoint_mul(_a58, sY - v2->y); auto x_div_y = fixpoint_div(v1->x - v2->x, v1->y - v2->y); - auto res = fixpoint_sub0(x_div_y, sY - v2->y); // a / b * c - looks like projection + auto res = fixpoint_mul(x_div_y, sY - v2->y); // a / b * c - looks like projection if (res + v2->x > sX) ++v54; } else { auto x_div_y = fixpoint_div(v2->x - v1->x, v2->y - v1->y); - auto res = fixpoint_sub0(x_div_y, sY - v1->y); + auto res = fixpoint_mul(x_div_y, sY - v1->y); if (res + v1->x > sX) ++v54; @@ -2593,7 +2593,7 @@ LODWORD(v33) = v32 << 16; HIDWORD(v33) = v32 >> 16; _a58 = v33 / (v2->y - v1->y); - _a59 = fixpoint_sub0(_a58, sY - v1->y); + _a59 = fixpoint_mul(_a58, sY - v1->y); if (_a59 + pVertices[k].x > sX) ++v54;*/ @@ -3445,9 +3445,9 @@ } else { - v30 = v0->vPosition.x + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); - v31 = v0->vPosition.y + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); - v32 = v0->vPosition.z + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); + v30 = v0->vPosition.x + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); + v31 = v0->vPosition.y + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); + v32 = v0->vPosition.z + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); } v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID); v34 = pIndoor->pFaces[uFaceID].uAttributes; @@ -3472,12 +3472,12 @@ goto LABEL_123; } //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; - v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); + v0->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; - v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); + v0->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16; v36 = stru_721530.uFaceID; - v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); + v0->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); v0->uSectorID = LOWORD(stru_721530.uSectorID); stru_721530.field_70 += stru_721530.field_7C; v37 = PID_ID(v36); @@ -3491,8 +3491,8 @@ v45 = stru_5C6E00->Atan2( v0->vPosition.x - pLevelDecorations[v37].vPosition.x, v0->vPosition.y - pLevelDecorations[v37].vPosition.y); - v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v45), _this); - v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v45), _this); + v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v45), _this); + v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v45), _this); goto LABEL_119; } if ( PID_TYPE(v36) == OBJECT_BModel) @@ -3521,9 +3521,9 @@ if ( (stru_721530.speed >> 3) > v61 ) v61 = stru_721530.speed >> 3; - v0->vVelocity.x += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.x); - v0->vVelocity.y += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.y); - v0->vVelocity.z += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.z); + v0->vVelocity.x += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.x); + v0->vVelocity.y += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.y); + v0->vVelocity.z += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.z); v41 = v38->uPolygonType; if ( v41 != 4 && v41 != 3 ) { @@ -3547,9 +3547,9 @@ EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1); } LABEL_119: - v0->vVelocity.x = fixpoint_sub0(58500, v0->vVelocity.x); - v0->vVelocity.y = fixpoint_sub0(58500, v0->vVelocity.y); - v0->vVelocity.z = fixpoint_sub0(58500, v0->vVelocity.z); + v0->vVelocity.x = fixpoint_mul(58500, v0->vVelocity.x); + v0->vVelocity.y = fixpoint_mul(58500, v0->vVelocity.y); + v0->vVelocity.z = fixpoint_mul(58500, v0->vVelocity.z); v22 = 0; goto LABEL_120; } @@ -4070,7 +4070,7 @@ else { auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); - auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); + auto res = fixpoint_mul((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); if (res + word_721460_xs[j] >= x) ++v53; @@ -4088,7 +4088,7 @@ } else { - v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); + v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); } blv_floor_level[v55] = v21; blv_floor_id[v55] = pSector->pFloors[i]; @@ -4141,7 +4141,7 @@ else { auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); - auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); + auto res = fixpoint_mul(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); if (res + word_721460_xs[j] >= x) ++v54; } @@ -5164,9 +5164,9 @@ { v16 = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y; v17 = -65536 * pGame->pIndoorCameraD3D->vPartyPos.z; - this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9); + this->field_0_party_dir_x = fixpoint_mul(v16, v28) + fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9); this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x; - this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9); + this->field_8_party_dir_z = fixpoint_mul(v17, v28) - fixpoint_mul(v16, v9); } else { @@ -5177,31 +5177,31 @@ if (pGame->pIndoorCameraD3D->sRotationX) { - v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); - - this->field_C = fixpoint_sub0(v19, v28) + fixpoint_sub0(a4, v9); - this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); - this->field_14 = fixpoint_sub0(a4, v28) - fixpoint_sub0(v19, v9); + v19 = fixpoint_mul(a2, v8) + fixpoint_mul(a3, v29); + + this->field_C = fixpoint_mul(v19, v28) + fixpoint_mul(a4, v9); + this->field_10 = fixpoint_mul(a3, v8) - fixpoint_mul(a2, v29); + this->field_14 = fixpoint_mul(a4, v28) - fixpoint_mul(v19, v9); } else { - this->field_C = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); - this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); + this->field_C = fixpoint_mul(a2, v8) + fixpoint_mul(a3, v29); + this->field_10 = fixpoint_mul(a3, v8) - fixpoint_mul(a2, v29); this->field_14 = a4; } if (pGame->pIndoorCameraD3D->sRotationX) { - v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29); - - this->field_18 = fixpoint_sub0(v21, v28) + fixpoint_sub0(a7, v9); - this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29); - this->field_20 = fixpoint_sub0(a7, v28) - fixpoint_sub0(v21, v9); + v21 = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29); + + this->field_18 = fixpoint_mul(v21, v28) + fixpoint_mul(a7, v9); + this->field_1C = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29); + this->field_20 = fixpoint_mul(a7, v28) - fixpoint_mul(v21, v9); } else { - this->field_18 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29); - this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29); + this->field_18 = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29); + this->field_1C = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29); this->field_20 = a7; } @@ -5535,9 +5535,9 @@ if ( v108 >= 0 ) { if ( sub_4075DB( - pOut.x + ((signed int)(fixpoint_sub0(v108, v143) + 32768) >> 16), - pOut.y + ((signed int)(fixpoint_sub0(v108, v147) + 32768) >> 16), - outz + ((signed int)(fixpoint_sub0(v108, v151) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_mul(v108, v143) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_mul(v108, v147) + 32768) >> 16), + outz + ((signed int)(fixpoint_mul(v108, v151) + 32768) >> 16), v62) ) { v114 = 1; @@ -5661,9 +5661,9 @@ || v132 < v90->pBounding.y1 || v136 > v90->pBounding.z2 || v140 < v90->pBounding.z1 - || (yb = fixpoint_sub0(v144, v90->pFacePlane_old.vNormal.x), - v_4b = fixpoint_sub0(v148, v90->pFacePlane_old.vNormal.y), - vf = fixpoint_sub0(v152, v90->pFacePlane_old.vNormal.z), + || (yb = fixpoint_mul(v144, v90->pFacePlane_old.vNormal.x), + v_4b = fixpoint_mul(v148, v90->pFacePlane_old.vNormal.y), + vf = fixpoint_mul(v152, v90->pFacePlane_old.vNormal.z), v20 = yb + vf + v_4b == 0, v91 = yb + vf + v_4b, vc = yb + vf + v_4b, @@ -5704,9 +5704,9 @@ if ( vd >= 0 ) { if ( sub_4075DB( - pOut.x + ((signed int)(fixpoint_sub0(vd, v144) + 32768) >> 16), - pOut.y + ((signed int)(fixpoint_sub0(vd, v148) + 32768) >> 16), - outz + ((signed int)(fixpoint_sub0(vd, v152) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_mul(vd, v144) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_mul(vd, v148) + 32768) >> 16), + outz + ((signed int)(fixpoint_mul(vd, v152) + 32768) >> 16), v90) ) { v113 = 1; @@ -5804,9 +5804,9 @@ || v137 < v16->pBoundingBox.y1 || v133 > v16->pBoundingBox.z2 || v129 < v16->pBoundingBox.z1 - || (v17 = fixpoint_sub0(v125, v16->pFacePlane.vNormal.x), - v18 = fixpoint_sub0(v121, v16->pFacePlane.vNormal.y), - v19 = fixpoint_sub0(v117, v16->pFacePlane.vNormal.z), + || (v17 = fixpoint_mul(v125, v16->pFacePlane.vNormal.x), + v18 = fixpoint_mul(v121, v16->pFacePlane.vNormal.y), + v19 = fixpoint_mul(v117, v16->pFacePlane.vNormal.z), v20 = v17 + v18 + v19 == 0, v21 = v17 + v18 + v19, v109 = v17 + v18 + v19, @@ -5835,9 +5835,9 @@ if ( v110 >= 0 ) { if ( sub_4077F1( - pOut.x + ((signed int)(fixpoint_sub0(v110, v125) + 32768) >> 16), - pOut.y + ((signed int)(fixpoint_sub0(v110, v121) + 32768) >> 16), - outz + ((signed int)(fixpoint_sub0(v110, v117) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_mul(v110, v125) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_mul(v110, v121) + 32768) >> 16), + outz + ((signed int)(fixpoint_mul(v110, v117) + 32768) >> 16), v16, (BSPVertexBuffer *)a5) ) { @@ -5938,9 +5938,9 @@ || v138 < v39->pBoundingBox.y1 || v134 > v39->pBoundingBox.z2 || v130 < v39->pBoundingBox.z1 - || (ya = fixpoint_sub0(v126, v39->pFacePlane.vNormal.x), - ve = fixpoint_sub0(v122, v39->pFacePlane.vNormal.y), - v_4 = fixpoint_sub0(v118, v39->pFacePlane.vNormal.z), + || (ya = fixpoint_mul(v126, v39->pFacePlane.vNormal.x), + ve = fixpoint_mul(v122, v39->pFacePlane.vNormal.y), + v_4 = fixpoint_mul(v118, v39->pFacePlane.vNormal.z), v20 = ya + ve + v_4 == 0, v40 = ya + ve + v_4, va = ya + ve + v_4, @@ -5968,9 +5968,9 @@ if ( vb >= 0 ) { if ( sub_4077F1( - pOut.x + ((signed int)(fixpoint_sub0(vb, v126) + 32768) >> 16), - pOut.y + ((signed int)(fixpoint_sub0(vb, v122) + 32768) >> 16), - outz + ((signed int)(fixpoint_sub0(vb, v118) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_mul(vb, v126) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_mul(vb, v122) + 32768) >> 16), + outz + ((signed int)(fixpoint_mul(vb, v118) + 32768) >> 16), v39, (BSPVertexBuffer *)a5a) ) { @@ -6892,16 +6892,16 @@ v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z; //if ( pRenderer->pRenderD3D ) //{ - v5 = v11 * pBLVRenderParams->fSineY + v13 * pBLVRenderParams->fCosineY; - a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY - v11 * pBLVRenderParams->fCosineY; + v5 = v11 * pGame->pIndoorCameraD3D->fRotationYSine + v13 * pGame->pIndoorCameraD3D->fRotationYCosine; + a1->vWorldViewPosition.y = v13 * pGame->pIndoorCameraD3D->fRotationYSine - v11 * pGame->pIndoorCameraD3D->fRotationYCosine; /*} else { v5 = v13 * pBLVRenderParams->fCosineY - v11 * pBLVRenderParams->fSineY; a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY + v11 * pBLVRenderParams->fCosineY; }*/ - a1->vWorldViewPosition.x = v5 * pBLVRenderParams->fCosineNegX - v4 * pBLVRenderParams->fSineNegX; - a1->vWorldViewPosition.z = v5 * pBLVRenderParams->fSineNegX + v4 * pBLVRenderParams->fCosineNegX; + a1->vWorldViewPosition.x = v5 * pGame->pIndoorCameraD3D->fRotationXCosine - v4 * pGame->pIndoorCameraD3D->fRotationXSine; + a1->vWorldViewPosition.z = v5 * pGame->pIndoorCameraD3D->fRotationXSine + v4 * pGame->pIndoorCameraD3D->fRotationXCosine; } else { @@ -6910,8 +6910,8 @@ a1->vWorldViewPosition.z = a1->vWorldPosition.z - (double)pParty->vPosition.z; //if ( pRenderer->pRenderD3D ) //{ - a1->vWorldViewPosition.x = v12 * pBLVRenderParams->fSineY + v14 * pBLVRenderParams->fCosineY; - a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY - v12 * pBLVRenderParams->fCosineY; + a1->vWorldViewPosition.x = v12 * pGame->pIndoorCameraD3D->fRotationYSine + v14 * pGame->pIndoorCameraD3D->fRotationYCosine; + a1->vWorldViewPosition.y = v14 * pGame->pIndoorCameraD3D->fRotationYSine - v12 * pGame->pIndoorCameraD3D->fRotationYCosine; /*} else { diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Indoor.h --- a/Indoor.h Wed Sep 18 20:04:30 2013 +0600 +++ b/Indoor.h Wed Sep 18 20:04:49 2013 +0600 @@ -469,15 +469,12 @@ -#define BLV_RENDER_DRAW_SW_OUTLINES 1 -#define BLV_RENDER_DRAW_D3D_OUTLINES 2 /* 162 */ #pragma pack(push, 1) struct BLVRenderParams { - inline BLVRenderParams(): - uFlags(0) + inline BLVRenderParams() { uViewportX = 0; uViewportY = 0; @@ -488,19 +485,19 @@ void Reset(); int field_0_timer_; - int uFlags; // & INDOOR_CAMERA_DRAW_D3D_OUTLINES: render d3d outlines + int _unused_uFlags; // & INDOOR_CAMERA_DRAW_D3D_OUTLINES: render d3d outlines Vec3_int_ _unused_vPartyPos; int _unused_sPartyRotY; int _unused_sPartyRotX; int uPartySectorID; - int sCosineY; - int sSineY; - int sCosineNegX; - int sSineNegX; - float fCosineY; - float fSineY; - float fCosineNegX; - float fSineNegX; + int _unused_sCosineY; // matches ODMRenderParams::int sines and cosines + int _unused_sSineY; // computed in 0048600E + int _unused_sCosineNegX; // merged into IndoorCameraD3D + int _unused_sSineNegX; // --//-- + float _unused_fCosineY; // matches old IndoorCamera::fRotationCosineY (new IndoorCameraD3D::fRotationCosineY) + float _unused_fSineY; // matches old IndoorCamera::fRotationSineY (new IndoorCameraD3D::fRotationSineY) + float _unused_fCosineNegX; // the same + float _unused_fSineNegX; // the same int fov_rad_fixpoint; int fov_rad_inv_fixpoint;//float unsigned __int16 *pRenderTarget; diff -r 014eb02bd0e6 -r 4bbb80c7dba7 IndoorCameraD3D.cpp --- a/IndoorCameraD3D.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/IndoorCameraD3D.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -160,18 +160,18 @@ to_z = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; //if ( pRenderer->pRenderD3D ) //{ - v14 = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) - + (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY); - v9 = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) - - (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY); + v14 = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) + + (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y); + v9 = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) + - (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y); //} a3a = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; - a2b = (unsigned __int64)(to_z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; + a2b = (unsigned __int64)(to_z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; //v10 = pOutX; - *pOutX = ((unsigned __int64)(v14 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - a2b; + *pOutX = ((unsigned __int64)(v14 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - a2b; *pOutZ = v9; - *pOutY = ((unsigned __int64)(v14 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(a3a * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); + *pOutY = ((unsigned __int64)(v14 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(a3a * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); } else { @@ -179,10 +179,10 @@ //if ( pRenderer->pRenderD3D ) //{ //v10 = pOutX; - *pOutX = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) - + (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY); - *pOutZ = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) - - (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY); + *pOutX = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) + + (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y); + *pOutZ = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) + - (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y); //} } if (!bDoNotShow) @@ -1608,4 +1608,39 @@ while ( v3 ); } return result; +} + + + +// -- new +// merged from IndoorCamera::Initialize2 +// and ODMRenderParams::RotationToInts +// and BLVRenderParams::Reset +void IndoorCameraD3D::CalculateRotations(int camera_rot_x, int camera_rot_y) +{ + sRotationX = camera_rot_x; + sRotationY = camera_rot_y; + + fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationY / 2048.0); + fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)sRotationY / 2048.0); + if (byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor) + { + fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-sRotationX / 2048.0); + fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)-sRotationX / 2048.0); + + int_sine_y = stru_5C6E00->Sin( pGame->pIndoorCameraD3D->sRotationY); + int_cosine_y = stru_5C6E00->Cos( pGame->pIndoorCameraD3D->sRotationY); + int_sine_x = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX); + int_cosine_x = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX); + } + else + { + fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationX / 2048.0); + fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)sRotationX / 2048.0); + + int_sine_y = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); + int_cosine_y = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + int_sine_x = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); + int_cosine_x = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); + } } \ No newline at end of file diff -r 014eb02bd0e6 -r 4bbb80c7dba7 IndoorCameraD3D.h --- a/IndoorCameraD3D.h Wed Sep 18 20:04:30 2013 +0600 +++ b/IndoorCameraD3D.h Wed Sep 18 20:04:49 2013 +0600 @@ -110,6 +110,13 @@ }; #pragma pack(pop) + + +#define BLV_RENDER_DRAW_SW_OUTLINES (1 << 0) // 1 +#define BLV_RENDER_DRAW_D3D_OUTLINES (1 << 1) // 2 +#define ODM_RENDER_DRAW_D3D_OUTLINES (1 << 2) // 4 +#define ODM_RENDER_DRAW_TERRAIN_OUTLINES (1 << 3) // 8 + /* 123 */ #pragma pack(push, 1) struct IndoorCameraD3D @@ -223,7 +230,9 @@ unsigned int list_0037C_size; IndoorCameraD3D_stru2 list_E0380[256]; int list_E0380_size; - + + + void CalculateRotations(int camera_rot_x, int camera_rot_y); int sRotationY; // moved from 157 struct IndoorCamera::18 int sRotationX; // moved from 157 struct IndoorCamera::14 float fRotationYSine; // moved from 157 struct IndoorCamera::2C @@ -232,5 +241,15 @@ float fRotationXCosine; // moved from 157 struct IndoorCamera::38 Vec3 vPartyPos; // moved from 157 struct IndoorCamera::00 // merged from 162 struct BLVRenderParams::08 + int debug_flags; // moved from 157 struct IndoorCamera::4C + // merged from 162 struct BLVRenderParams::04 + int int_sine_y; // moved from 157 struct ODMRenderParams::1C + // merged from 162 struct BLVRenderParams::24 + int int_cosine_y; // moved from 157 struct ODMRenderParams::20 + // merged from 162 struct BLVRenderParams::20 + int int_sine_x; // moved from 157 struct ODMRenderParams::24 + // merged from 162 struct BLVRenderParams::2C + int int_cosine_x; // moved from 157 struct ODMRenderParams::28 + // merged from 162 struct BLVRenderParams::28 }; #pragma pack(pop) \ No newline at end of file diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Items.cpp --- a/Items.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Items.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -2191,7 +2191,7 @@ NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5); NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING, 5); - itemId = ITEM_ARTICACT_GOVERNONS_ARMOR; + itemId = ITEM_ARTIFACT_GOVERNORS_ARMOR; NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10); NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10); diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Items.h --- a/Items.h Wed Sep 18 20:04:30 2013 +0600 +++ b/Items.h Wed Sep 18 20:04:49 2013 +0600 @@ -103,7 +103,7 @@ ITEM_ARTIFACT_IRON_FEATHER = 501, ITEM_ARTIFACT_WALLACE = 502, ITEM_ARTIFACT_CORSAIR = 503, - ITEM_ARTICACT_GOVERNONS_ARMOR = 504,//1F8 + ITEM_ARTIFACT_GOVERNORS_ARMOR = 504,//1F8 ITEM_ARTIFACT_YORUBA = 505,//1F9 ITEM_ARTIFACT_SPLITTER = 506,//1FA ITEM_ARTIFACT_GHOULSBANE = 507,//1FA diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Math.h --- a/Math.h Wed Sep 18 20:04:30 2013 +0600 +++ b/Math.h Wed Sep 18 20:04:49 2013 +0600 @@ -24,11 +24,10 @@ }; #pragma pack(pop) -__int64 fixpoint_sub0(int, int); -__int64 fixpoint_sub2(int, int); +__int64 fixpoint_mul(int, int); __int64 fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2); __int64 fixpoint_div(int, int); -__int64 fixpoint_mul(int, int); +__int64 fixpoint_sub_unknown(int, int); int fixpoint_from_float(float value); int fixpoint_from_int(int lhv, int rhv); diff -r 014eb02bd0e6 -r 4bbb80c7dba7 NPC.cpp --- a/NPC.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/NPC.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -290,7 +290,7 @@ pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0); strtok(pNPCTopicTXT_Raw, "\r"); - for (i=0; i<579; ++i) + for ( i = 1; i <= 579; ++i )//NPC topics count limit { test_string = strtok(NULL, "\r") + 1; break_loop = false; @@ -480,7 +480,7 @@ uNumNewNPCs = 501; pNPCGreetTXT_Raw = (char*)pEvents_LOD->LoadRaw("npcgreet.txt", 0); strtok(pNPCGreetTXT_Raw, "\r"); - for (i=0; i<205; ++i) + for ( i = 1; i <= 205; ++i ) { test_string = strtok(NULL, "\r") + 1; break_loop = false; @@ -503,10 +503,10 @@ switch (decode_step) { case 1: - pNPCGreetings[i].pGreeting1 = RemoveQuotes(test_string); + pNPCGreetings[i].pGreetings[0] = RemoveQuotes(test_string); break; case 2: - pNPCGreetings[i].pGreeting2 = RemoveQuotes(test_string); + pNPCGreetings[i].pGreetings[1] = RemoveQuotes(test_string); break; } } diff -r 014eb02bd0e6 -r 4bbb80c7dba7 NPC.h --- a/NPC.h Wed Sep 18 20:04:30 2013 +0600 +++ b/NPC.h Wed Sep 18 20:04:49 2013 +0600 @@ -132,8 +132,15 @@ #pragma pack(push, 1) struct NPCGreeting { - char *pGreeting1; //at first meet - char *pGreeting2; // at latest meets + union + { + struct + { + char *pGreeting1; //at first meet + char *pGreeting2; // at latest meets + }; + char *pGreetings[2]; + }; }; #pragma pack(pop) diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Outdoor.cpp --- a/Outdoor.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Outdoor.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -87,14 +87,13 @@ int v4; // ST04_4@19 int v5; // eax@19 - pODMRenderParams->flags = 0; + pGame->pIndoorCameraD3D->debug_flags = 0; if (viewparams->draw_d3d_outlines) - pODMRenderParams->flags |= ODM_RENDER_DRAW_D3D_OUTLINES; - //INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES + pGame->pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES; if (bRedraw || pRenderer->pRenderD3D) { - pODMRenderParams->RotationToInts(); + //pODMRenderParams->RotationToInts(); sub_481ED9_MessWithODMRenderParams(); } @@ -3005,34 +3004,34 @@ if (pGame->pIndoorCameraD3D->sRotationX) { v18 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v47 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); - v50 = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; - v53 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; + v47 = ((unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + + ((unsigned __int64)(v18 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); + v50 = (unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v53 = (unsigned __int64)(v18 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; v44 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; - v19 = ((unsigned __int64)(v44 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16) - + ((unsigned __int64)(v47 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16); - X = ((unsigned __int64)(v44 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16) - + ((unsigned __int64)(v47 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16); + v19 = ((unsigned __int64)(v44 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(v47 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); + X = ((unsigned __int64)(v44 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(v47 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 ) continue; v20 = v53 - v50; v42 = v53 - v50; - v21 = ((unsigned __int64)(v44 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) - - ((unsigned __int64)(v47 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); + v21 = ((unsigned __int64)(v44 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + - ((unsigned __int64)(v47 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); } else { v48 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v51 = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; - v22 = (unsigned __int64)(v48 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + v51 = (unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; + v22 = (unsigned __int64)(v48 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; X = v22 + v51; if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 ) continue; v23 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16) - * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; - v20 = ((unsigned __int64)(v48 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v23; - v42 = ((unsigned __int64)(v48 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v23; + * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v20 = ((unsigned __int64)(v48 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v23; + v42 = ((unsigned __int64)(v48 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v23; v21 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; } v45 = v21; @@ -3519,7 +3518,7 @@ pActors[ai_near_actors_ids[i]].uAttributes |= 0x0400; } //----- (0046BE0A) -------------------------------------------------------- -void ODM_UpdateUserInputAndOther() +void ODM_UpdateUserInputAndOther() { bool v0; // eax@5 char pOut[32]; // [sp+8h] [bp-20h]@5 @@ -3554,7 +3553,7 @@ check_event_triggers(); } //----- (0041F54A) -------------------------------------------------------- -void LoadActualSkyFrame() +void LoadActualSkyFrame() { if ( pTexture_RestUI_CurrentSkyFrame ) pTexture_RestUI_CurrentSkyFrame->Release(); @@ -3646,14 +3645,5 @@ this->int_fov_rad_inv = 65536 / v4; this->field_50 = 115; //sr_6BE060[1] = 1; - RotationToInts(); + //RotationToInts(); } - -//----- (0048600E) -------------------------------------------------------- -void ODMRenderParams::RotationToInts() -{ - camera_rotation_y_int_sine = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); - camera_rotation_y_int_cosine = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); - camera_rotation_x_int_sine = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); - camera_rotation_x_int_cosine = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); -} \ No newline at end of file diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Outdoor_stuff.h --- a/Outdoor_stuff.h Wed Sep 18 20:04:30 2013 +0600 +++ b/Outdoor_stuff.h Wed Sep 18 20:04:49 2013 +0600 @@ -36,8 +36,8 @@ int field_34; struct stru149 *ptr_38; struct Texture *pTexture; - struct Span *prolly_head; - struct Span *prolly_tail; + struct Span *_unused_prolly_head; + struct Span *_unused_prolly_tail; int **ptr_48; unsigned __int16 uTileBitmapID; __int16 field_4E; @@ -88,11 +88,6 @@ extern stru149 stru_8019C8; - - -#define ODM_RENDER_DRAW_D3D_OUTLINES (1 << 1) // 2 -#define ODM_RENDER_DRAW_TERRAIN_OUTLINES (1 << 2) // 4 - /* 88 */ #pragma pack(push, 1) struct ODMRenderParams @@ -114,23 +109,22 @@ } void Initialize(); - void RotationToInts(); int uPickDepth; int shading_dist_shade; int shading_dist_shademist; int shading_dist_mist; unsigned int uCameraFovInDegrees; - int int_fov_rad; // 157 struct IndoorCamera::fov_rad - int int_fov_rad_inv; // 157 struct IndoorCamera::fov_rad_inv - int camera_rotation_y_int_sine; - int camera_rotation_y_int_cosine; - int camera_rotation_x_int_sine; - int camera_rotation_x_int_cosine; + int int_fov_rad; // 157 struct IndoorCamera::fov_rad + int int_fov_rad_inv; // 157 struct IndoorCamera::fov_rad_inv + int _unused_camera_rotation_y_int_sine; // merged with BLVRenderParams equivalents + int _unused_camera_rotation_y_int_cosine; // into IndoorCameraD3D + int _unused_camera_rotation_x_int_sine; // --//-- + int _unused_camera_rotation_x_int_cosine; // --//-- int uNumPolygons; - unsigned int uNumEdges; - unsigned int uNumSurfs; - unsigned int uNumSpans; + unsigned int _unused_uNumEdges; + unsigned int _unused_uNumSurfs; + unsigned int _unused_uNumSpans; unsigned int uNumBillboards; float field_40; int field_44; @@ -146,7 +140,6 @@ int building_gamme; int terrain_gamma; - unsigned int flags; // moved from 157 struct IndoorCamera::4C unsigned int uMapGridCellX; // moved from 157 struct IndoorCamera::0C unsigned int uMapGridCellZ; // moved from 157 struct IndoorCamera::10 }; diff -r 014eb02bd0e6 -r 4bbb80c7dba7 ParticleEngine.cpp --- a/ParticleEngine.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/ParticleEngine.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -313,22 +313,22 @@ int _uParticleID = (int)(floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16; //v12 = pParticle->_y + 6.7553994e15; y = (int)(floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16; - z = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + z = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - z; - a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; + a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; //v13 = pParticle->_z + 6.7553994e15; _uParticleID = (int)(floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; - z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); + z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); v14 = z; - HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16; + HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16; //LODWORD(v15) = pBLVRenderParams->field_40 << 16; //HIDWORD(v15) = pBLVRenderParams->field_40 >> 16; //v16 = v15 / z; v16 = fixpoint_div(pBLVRenderParams->field_40, z); - v17 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; + v17 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; pParticle->_screenspace_scale = v16; _uParticleID = (unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16; LODWORD(v18) = pBLVRenderParams->uViewportCenterX @@ -343,20 +343,20 @@ } int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; - HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; - z_int_4 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; + HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + - ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); + a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + z_int_4 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; _uParticleID = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; - v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v21; - z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v21; + v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v21; + z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v21; if ( v22 < (signed int)0x40000u || v22 > (signed int)0x1F400000u ) return 0; v23 = a6 + z_int_4; a2 = a6 + z_int_4; - v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); + v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); } else { @@ -366,17 +366,17 @@ int _uParticleID = ((int)floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16; //v26 = pParticle->_y + 6.7553994e15; y = ((int)floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16; - auto _hiword_v25 = (__int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - _hiword_v25; - z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - _hiword_v25; - v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; + auto _hiword_v25 = (__int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25; + z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25; + v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; //a5 = pParticle->_z + 6.7553994e15; v29 = ((int)floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; //LODWORD(v30) = pBLVRenderParams->field_40 << 16; //HIDWORD(v30) = pBLVRenderParams->field_40 >> 16; //v31 = v30 / z; v31 = fixpoint_div(pBLVRenderParams->field_40, z); - v32 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; + v32 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; pParticle->_screenspace_scale = v31; _uParticleID = (unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16; LODWORD(v33) = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16) >> 16); @@ -388,15 +388,15 @@ } int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; - v36 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; - z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; + v36 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v36; + z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v36; if ( v22 < 262144 || v22 > 524288000 ) return 0; - v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; - _uParticleID = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; - v23 = v37 + ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - a2 = v37 + ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); + v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + _uParticleID = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; + v23 = v37 + ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + a2 = v37 + ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); v24 = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; } int _uParticleID = abs(v23); @@ -415,7 +415,7 @@ //uParticleID = v44 >> 16; LODWORD(v44) = (signed int)(v44 >> 16) >> 16; pParticle->uScreenSpaceY = pBLVRenderParams->uViewportCenterY - v44; - pParticle->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(pParticle->flt_28), pParticle->_screenspace_scale); + pParticle->_screenspace_scale = fixpoint_mul(fixpoint_from_float(pParticle->flt_28), pParticle->_screenspace_scale); pParticle->sZValue = z; return true; } @@ -442,7 +442,7 @@ //v7 = pParticle->flt_28; //pParticle->_screenspace_scale = v6 / x; //v8 = v7; - pParticle->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(pParticle->flt_28), v6 / x); + pParticle->_screenspace_scale = fixpoint_mul(fixpoint_from_float(pParticle->flt_28), v6 / x); pParticle->sZValue = x; return true; } @@ -527,11 +527,11 @@ //uIDc = (LODWORD(v8) - pIndoorCamera->pos.x) << 16; //v9 = v6->_y + 6.7553994e15; //v10 = (LODWORD(v9) - pIndoorCamera->pos.y) << 16; - v11 = fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); - //HIDWORD(v8) = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); + v11 = fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); + //HIDWORD(v8) = fixpoint_sub_unknown(v6->x - pIndoorCamera->pos.x, v5); //v12 = v6->_z + 6.7553994e15; //uIDd = (LODWORD(v12) - pIndoorCamera->pos.z) << 16; - auto _hidword_v12 = fixpoint_sub0(v11, v3) + fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44); + auto _hidword_v12 = fixpoint_mul(v11, v3) + fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44); LODWORD(v13) = 0; HIDWORD(v13) = SLOWORD(pODMRenderParams->int_fov_rad); //v14 = v13 / _hidword_v12; @@ -539,24 +539,24 @@ //v15 = v6->_screenspace_scale; v6->uScreenSpaceX = pViewport->uScreenCenterX - ((signed int)((unsigned __int64)(v6->_screenspace_scale - * (signed __int64)(fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); + * (signed __int64)(fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) + - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); v6->uScreenSpaceY = pViewport->uScreenCenterY - ((signed int)((unsigned __int64)(v6->_screenspace_scale - * (signed __int64)(fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) + * (signed __int64)(fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) - ((unsigned __int64)(v11 * (signed __int64)v44) >> 16))) >> 16) >> 16); v6->sZValue = _hidword_v12; } //uIDe = (v41 - pIndoorCamera->pos.x) << 16; //v47 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; - v45 = fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); - //HIDWORD(v42) = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); + v45 = fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); + //HIDWORD(v42) = fixpoint_sub_unknown(v6->x - pIndoorCamera->pos.x, v5); //uIDa = (LODWORD(v42) - pIndoorCamera->pos.z) << 16; - X_4 = fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44) + fixpoint_sub0(v45, v3); + X_4 = fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44) + fixpoint_mul(v45, v3); if ( X_4 < 0x40000 ) return 0; - v16 = fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); - v17 = fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) - fixpoint_sub0(v45, v44); + v16 = fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); + v17 = fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) - fixpoint_mul(v45, v44); } else { @@ -569,26 +569,26 @@ //v21 = v6->_z + 6.7553994e15; LODWORD(v22) = 0; HIDWORD(v22) = SLOWORD(pODMRenderParams->int_fov_rad); - auto _var_123 = fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); + auto _var_123 = fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); //v23 = v22 / _var_123; v6->_screenspace_scale = v22 / _var_123; //v24 = v6->_screenspace_scale; v6->uScreenSpaceX = pViewport->uScreenCenterX - ((signed int)((unsigned __int64)(v6->_screenspace_scale - * (signed __int64)(fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); - v6->uScreenSpaceY = pViewport->uScreenCenterY - (fixpoint_mul(v6->z, v6->_screenspace_scale) >> 16); + * (signed __int64)(fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) + - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); + v6->uScreenSpaceY = pViewport->uScreenCenterY - (fixpoint_sub_unknown(v6->z, v6->_screenspace_scale) >> 16); v6->sZValue = _var_123; } //uIDb = (v41 - pIndoorCamera->pos.x) << 16; //v48 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; - v26 = fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); + v26 = fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); //v27 = v26 + ((unsigned __int64)(uIDb * (signed __int64)v4) >> 16); - X_4 = v26 + fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4); + X_4 = v26 + fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4); if ( X_4 < 0x40000 || X_4 > (pODMRenderParams->uPickDepth - 1000) << 16 ) return 0; v17 = v6->z; - v16 = fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); + v16 = fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); } v40 = v17; v28 = abs(v16); @@ -604,7 +604,7 @@ v33 = (signed int)((unsigned __int64)(v6->_screenspace_scale * (signed __int64)v40) >> 16) >> 16; //v34 = pViewport->uScreenCenterY - v33; v6->uScreenSpaceY = pViewport->uScreenCenterY - v33; - v6->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(v6->flt_28), v6->_screenspace_scale); + v6->_screenspace_scale = fixpoint_mul(fixpoint_from_float(v6->flt_28), v6->_screenspace_scale); v6->sZValue = X_4; v36 = v6->uScreenSpaceX; if ( v36 >= (signed int)pViewport->uViewportTL_X ) diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Party.cpp --- a/Party.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Party.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -620,7 +620,7 @@ bTurnBasedModeOn = false; uActiveCharacter = 1; - ::pPlayers[0] = pPlayers; + ::pPlayers.ZerothIndex() = pPlayers; for (uint i = 0; i < 4; ++i) ::pPlayers[i + 1] = &pPlayers[i]; diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Player.cpp --- a/Player.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Player.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -7450,106 +7450,72 @@ return false; } //----- (0043ED6F) -------------------------------------------------------- -bool _43ED6F_check_party_races(bool a1) -{ - bool v6; // zf@5 - +bool IsDwarfPresentInParty(bool a1) +{ for (uint i = 0; i < 4; ++i) { - auto player = pParty->pPlayers + i; - auto race = player->GetRace(); - - if (race != CHARACTER_RACE_HUMAN && - race != CHARACTER_RACE_ELF && - race != CHARACTER_RACE_GOBLIN) - v6 = a1 == 1; - else - v6 = !a1; - - if (v6) + CHARACTER_RACE race = pParty->pPlayers[i].GetRace(); + + if (race == CHARACTER_RACE_DWARF && a1) + return true; + else if (race != CHARACTER_RACE_DWARF && !a1) return true; } return false; } + + + //----- (00439FCB) -------------------------------------------------------- void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) { signed int v4; // esi@1 unsigned int v5; // ecx@1 - Player *v6; // ebx@3 - Actor *v7; // esi@3 + Player *playerPtr; // ebx@3 + Actor *actorPtr; // esi@3 unsigned int v8; // eax@4 - char *v9; // eax@5 - signed int v10; // eax@6 int v11; // edx@8 - int v12; // edx@9 - int v13; // edx@10 int v14; // edx@16 - int v15; // edx@17 - int v16; // edx@18 enum SoundID v17; // eax@24 - int v18; // eax@26 - unsigned __int8 v19; // zf@26 - unsigned __int8 v20; // sf@26 unsigned __int16 v21; // ax@29 signed int v22; // edi@36 int v23; // eax@38 signed int v24; // eax@44 - unsigned __int16 v25; // cx@47 + AIState v25; // cx@47 signed int v26; // eax@49 int v27; // eax@54 - float v28; // ST18_4@58 - double v29; // st7@58 - float v30; // ST08_4@58 - double v31; // st7@58 - float v32; // ST04_4@58 - float v33; // ST00_4@58 int v34; // edi@61 int v35; // eax@70 - double v36; // st7@70 + int v36; // st7@70 SpriteObject *v37; // ebx@77 int v38; // edi@77 int v39; // esi@77 int v40; // eax@77 int v41; // eax@77 - int v42; // eax@78 Player *v43; // eax@81 - Actor *v44; // esi@82 + //Actor *actorPtr; // esi@82 Player *v45; // edi@84 unsigned __int16 v46; // ax@84 - int v47; // ebx@105 int v48; // eax@107 unsigned __int16 v49; // ax@116 int v50; // ebx@123 unsigned __int16 v51; // ax@124 - char v52; // bl@124 int v53; // eax@128 signed int v54; // eax@134 unsigned __int16 v55; // cx@137 - signed int v56; // eax@139 + signed int recvdMagicDmg; // eax@139 int v57; // eax@144 - float v58; // ST18_4@148 - double v59; // st7@148 - float v60; // ST08_4@148 - double v61; // st7@148 - float v62; // ST04_4@148 - float v63; // ST00_4@148 int v64; // ebx@151 int v65; // eax@161 - double v66; // st7@161 - signed int v67; // ecx@164 + int v66; // st7@161 signed int v68; // eax@170 int v69; // ecx@170 int v70; // eax@171 - enum SoundID v71; // [sp+20h] [bp-34h]@12 - int v72; // [sp+30h] [bp-24h]@164 - double v73; // [sp+40h] [bp-14h]@72 + int v72[4]; // [sp+30h] [bp-24h]@164 signed int v74; // [sp+44h] [bp-10h]@1 - unsigned int v75; // [sp+48h] [bp-Ch]@3 + int healthBeforeRecvdDamage; // [sp+48h] [bp-Ch]@3 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 - int v77; // [sp+50h] [bp-4h]@26 - signed int a4a; // [sp+60h] [bp+Ch]@162 - Player *a4b; // [sp+60h] [bp+Ch]@168 + int dmgToReceive; // [sp+50h] [bp-4h]@26 v4 = PID_ID(uObjID); v5 = PID_TYPE(uObjID) - 2; @@ -7557,423 +7523,313 @@ uActorID = v4; if ( v5 ) { - if ( v5 != 1 - || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], - v75 = v6->sHealth, - !stru_50C198.ActorHitOrMiss(v7, v6)) ) + playerPtr = &pParty->pPlayers[a4]; + actorPtr = &pActors[v4]; + healthBeforeRecvdDamage = playerPtr->sHealth; + if ( v5 != 1 || !stru_50C198.ActorHitOrMiss(actorPtr, playerPtr) ) return; - v8 = v6->pEquipment.uArmor; + v8 = playerPtr->pEquipment.uArmor; if ( !v8 - || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) - || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) - || v10 > 11 ) + || playerPtr->pInventoryItemList[v8 - 1].IsBroken() + || + (pItemsTable->pItems[playerPtr->pInventoryItemList[v8 - 1].uItemID].uSkillType != PLAYER_SKILL_CHAIN + && pItemsTable->pItems[playerPtr->pInventoryItemList[v8 - 1].uItemID].uSkillType != PLAYER_SKILL_PLATE + ) + ) { v14 = rand() % 4; - if ( !v14 ) - { - v71 = (SoundID)108; - goto LABEL_24; - } - v15 = v14 - 1; - if ( !v15 ) + switch (v14) { - v71 = (SoundID)109; - goto LABEL_24; - } - v16 = v15 - 1; - if ( !v16 ) - { - v71 = (SoundID)110; - goto LABEL_24; - } - if ( v16 == 1 ) - { - v71 = (SoundID)44; - goto LABEL_24; + case 0 : v17 = (SoundID)108; break; + case 1 : v17 = (SoundID)109; break; + case 2 : v17 = (SoundID)110; break; + case 3 : v17 = (SoundID)44; break; } } else { v11 = rand() % 4; - if ( !v11 ) - { - v71 = (SoundID)105; - goto LABEL_24; - } - v12 = v11 - 1; - if ( !v12 ) + switch (v11) { - v71 = (SoundID)106; - goto LABEL_24; + case 0 : v17 = (SoundID)105; break; + case 1 : v17 = (SoundID)106; break; + case 2 : v17 = (SoundID)107; break; + case 3 : v17 = (SoundID)45; break; } - v13 = v12 - 1; - if ( !v13 ) - { - v71 = (SoundID)107; - goto LABEL_24; - } - if ( v13 == 1 ) + } + pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); + dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, v74); + if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) + { + v21 = actorPtr->pActorBuffs[3].uPower; + if ( v21 ) + dmgToReceive /= (signed int)v21; + } + switch (v74) + { + case 0: v22 = actorPtr->pMonsterInfo.uAttack1Type; + break; + case 1: v22 = actorPtr->pMonsterInfo.uAttack2Type; + break; + case 2: v23 = actorPtr->pMonsterInfo.uSpell1ID; + v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); + break; + case 3: v23 = actorPtr->pMonsterInfo.uSpell2ID; + v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); + break; + case 4: v22 = actorPtr->pMonsterInfo.field_3C_some_special_attack; + break; + default: + case 5: v22 = 4; //yes, the original just assigned the value 4 + break; + } + if ( !(dword_6BE368_debug_settings_2 & 0x10) ) + { + v24 = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)v22); + if ( playerPtr->pPlayerBuffs[10].uExpireTime > 0 ) { - v71 = (SoundID)45; -LABEL_24: - v17 = v71; - goto LABEL_26; + v25 = actorPtr->uAIState; + if ( v25 != Dying && v25 != Dead) + { + v26 = stru_50C198.CalcMagicalDamageToActor(actorPtr, v22, v24); + actorPtr->sCurrentHP -= v26; + if ( v26 >= 0 ) + { + if ( actorPtr->sCurrentHP >= 1 ) + { + Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); + Actor::AggroSurroundingPeasants(uActorID, 1); + } + else + { + if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS) + { + v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; + pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)v27, 0, 0); + } + Actor::Die(uActorID); + Actor::ApplyFineForKillingPeasant(uActorID); + Actor::AggroSurroundingPeasants(uActorID, 1); + if ( actorPtr->pMonsterInfo.uExp ) + GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp); + v34 = SPEECH_51; + if ( rand() % 100 < 20 ) + v34 = ((signed int)actorPtr->pMonsterInfo.uHP >= 100) + 1; + playerPtr->PlaySound((PlayerSpeech)v34, 0); + } + } + } } - } - v17 = (SoundID)a4; -LABEL_26: - pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); - v18 = Actor::_43B3E0_CalcDamage(v7, v74); - v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; - v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; - v77 = v18; - if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) - { - v21 = v7->pActorBuffs[3].uPower; - if ( v21 ) - v77 /= (signed int)v21; - } - if ( v74 ) - { - if ( v74 == 1 ) + if ( !(dword_6BE368_debug_settings_2 & 0x10) + && actorPtr->pMonsterInfo.uSpecialAttack + && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackType ) { - v22 = v7->pMonsterInfo.uAttack2Type; + playerPtr->_48DCF6(actorPtr->pMonsterInfo.uSpecialAttack, actorPtr); + } + } + if ( !pParty->bTurnBasedModeOn ) + { + v35 = playerPtr->GetActualEndurance(); + v36 = (int)((20 - playerPtr->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333); + playerPtr->SetRecoveryTime(v36); + } + int yellThreshold = playerPtr->GetMaxHealth() / 4; + if ( yellThreshold < playerPtr->sHealth && yellThreshold >= healthBeforeRecvdDamage && playerPtr->sHealth > 0 ) + { + playerPtr->PlaySound(SPEECH_48, 0); + } + viewparams->bRedrawGameUI = 1; + return; + } + else + { + v37 = &pSpriteObjects[uActorID]; + v38 = PID_TYPE(v37->spell_caster_pid); + v39 = PID_ID(v37->spell_caster_pid); + v40 = PID_TYPE(v37->spell_caster_pid); + uActorID = PID_ID(v37->spell_caster_pid); + v41 = v40 - 2; + if ( v40 == 2 ) + { + if ( a4 != -1 ) + { + v43 = &pParty->pPlayers[a4]; } else { - if ( v74 == 2 ) + v74 = 0; + for (int i = 1; i <= 4; i++) { - v23 = v7->pMonsterInfo.uSpell1ID; + v72[v74] = i; + v74++; } - else + if ( v74 ) { - if ( v74 != 3 ) - { - if ( v74 == 4 ) - v22 = v7->pMonsterInfo.field_3C_some_special_attack; - else - v22 = 4; - goto LABEL_43; - } - v23 = v7->pMonsterInfo.uSpell2ID; + v43 = &pParty->pPlayers[v72[rand() % v74]];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; } - v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); + } + if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) + { + v70 = v43->GetMaxHealth(); + v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); + v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); + } + else + { + v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); + v69 = 0; + } + v43->ReceiveDamage(v68, (DAMAGE_TYPE)v69); + if ( v38 == OBJECT_Player && !qword_A750D8 ) + { + qword_A750D8 = 256i64; + PlayerSpeechID = SPEECH_44; + uSpeakingCharacter = uActorID + 1; + } + return; + } + else if ( v40 == 3 ) + { + actorPtr = &pActors[v39]; + if ( a4 == -1 ) + a4 = stru_50C198.which_player_would_attack(actorPtr); + v45 = &pParty->pPlayers[a4]; + dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, v74); + v46 = v37->uType; + if ( v37->uType == 545 ) + { + v51 = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); + if ( SkillToMastery(v51) >= 4 && rand() % 100 < (v51 & 0x3F) ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); + ShowStatusBarString(pTmpBuf.data(), 2u); + v45->PlaySound(SPEECH_6, 0); + return; + } } - } - else - { - v22 = v7->pMonsterInfo.uAttack1Type; - } -LABEL_43: - if ( !(dword_6BE368_debug_settings_2 & 0x10) ) - { - v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); - if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 - && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) + else if ( v46 == 555 + || v46 == 510 + || v46 == 500 + || v46 == 515 + || v46 == 505 + || v46 == 530 + || v46 == 525 + || v46 == 520 + || v46 == 535 + || v46 == 540 ) + { + if ( !stru_50C198.ActorHitOrMiss(actorPtr, v45) ) + return; + if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) + dmgToReceive >>= 1; + if ( v45->HasEnchantedItemEquipped(36) ) + dmgToReceive >>= 1; + if ( v45->HasEnchantedItemEquipped(69) ) + dmgToReceive >>= 1; + if ( v45->HasItemEquipped(EQUIP_ARMOUR) + && v45->pInventoryItemList[v45->pEquipment.uArmor-1].uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR ) + dmgToReceive >>= 1; + if ( v45->HasItemEquipped(EQUIP_MAIN_HAND)) + { + v48 = v45->pInventoryItemList[v45->pEquipment.uMainHand - 1].uItemID; + if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + dmgToReceive >>= 1; + } + if ( v45->HasItemEquipped(EQUIP_OFF_HAND)) + { + v48 = v45->pInventoryItemList[v45->pEquipment.uShield - 1].uItemID; + if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + dmgToReceive >>= 1; + } + } + if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) { - v25 = v7->uAIState; - if ( v25 != 5 ) + v49 = actorPtr->pActorBuffs[3].uPower; + if ( v49 ) + dmgToReceive /= (signed int)v49; + } + switch(v74) + { + case 0: + v50 = actorPtr->pMonsterInfo.uAttack1Type; + break; + case 1: + v50 = actorPtr->pMonsterInfo.uAttack2Type; + break; + case 2: + v53 = actorPtr->pMonsterInfo.uSpell1ID; + v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); + break; + case 3: + v53 = actorPtr->pMonsterInfo.uSpell2ID; + v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); + break; + case 4: + v50 = actorPtr->pMonsterInfo.field_3C_some_special_attack; + break; + case 5: + v50 = 4; + break; + } + if ( !(dword_6BE368_debug_settings_2 & 0x10) ) + { + v54 = v45->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)v50); + if ( v45->pPlayerBuffs[10].uExpireTime > 0 ) { - if ( v25 != 4 ) + v55 = actorPtr->uAIState; + if ( v55 != Dying && v55 != Dead) { - v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); - v7->sCurrentHP -= v26; - if ( v26 ) + recvdMagicDmg = stru_50C198.CalcMagicalDamageToActor(actorPtr, v50, v54); + actorPtr->sCurrentHP -= recvdMagicDmg; + if ( recvdMagicDmg >= 0 ) { - if ( v7->sCurrentHP >= 1 ) + if ( actorPtr->sCurrentHP >= 1 ) { Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else { - if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) + if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { - v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; - v74 = v27; - if ( pRenderer->pRenderD3D ) - { - if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) - { - v28 = (double)v74; - v74 = v7->vPosition.z; - v29 = (double)v74; - v74 = v7->vPosition.y; - v30 = v29; - v31 = (double)v74; - v74 = v7->vPosition.x; - v32 = v31; - v33 = (double)v74; - pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); - } - } + v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; + pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)v57, 0, 0); } Actor::Die(uActorID); Actor::ApplyFineForKillingPeasant(uActorID); Actor::AggroSurroundingPeasants(uActorID, 1); - if ( v7->pMonsterInfo.uExp ) - GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); - v34 = SPEECH_51; + if ( actorPtr->pMonsterInfo.uExp ) + GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp); + v64 = SPEECH_51; if ( rand() % 100 < 20 ) - v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; - v6->PlaySound((PlayerSpeech)v34, 0); + v64 = ((signed int)actorPtr->pMonsterInfo.uHP >= 100) + 1; + v45->PlaySound((PlayerSpeech)v64, 0); } } } } } - if ( !(dword_6BE368_debug_settings_2 & 0x10) - && v7->pMonsterInfo.uSpecialAttack - && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) - v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); - } - if ( !pParty->bTurnBasedModeOn ) - { - v35 = v6->GetActualEndurance(); - v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; - v6->SetRecoveryTime((signed __int64)v36); - } - if ( v77 ) - { - v73 = (double)(signed int)v75; - if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) + if ( !v74 + && !(dword_6BE368_debug_settings_2 & 0x10) + && actorPtr->pMonsterInfo.uSpecialAttack + && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackType ) { - if ( v6->sHealth > 0 ) - { - if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) - v6->PlaySound(SPEECH_48, 0); - } - } - } - viewparams->bRedrawGameUI = 1; - return; - } - v37 = &pSpriteObjects[uActorID]; - v38 = PID_TYPE(v37->spell_caster_pid); - v39 = PID_ID(v37->spell_caster_pid); - v40 = PID_TYPE(v37->spell_caster_pid); - uActorID = PID_ID(v37->spell_caster_pid); - v41 = v40 - 2; - if ( !v41 ) - goto LABEL_80; - v42 = v41 - 1; - if ( !v42 ) - { - v44 = &pActors[v39]; - if ( a4 == -1 ) - a4 = stru_50C198.which_player_would_attack(v44); - v45 = &pParty->pPlayers[a4]; - v77 = Actor::_43B3E0_CalcDamage(v44, v74); - v46 = v37->uType; - if ( v37->uType == 545 ) - { - LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); - v52 = v51; - if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); - ShowStatusBarString(pTmpBuf.data(), 2u); - v45->PlaySound(SPEECH_6, 0); - return; + v45->_48DCF6(actorPtr->pMonsterInfo.uSpecialAttack, actorPtr); } - } - else - { - if ( v46 != 555 - && v46 != 510 - && v46 != 500 - && v46 != 515 - && v46 != 505 - && v46 != 530 - && v46 != 525 - && v46 != 520 - && v46 != 535 - && v46 != 540 ) - goto LABEL_115; - } - if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) - return; - if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) - v77 >>= 1; - if ( v45->HasEnchantedItemEquipped(36) ) - v77 >>= 1; - if ( v45->HasEnchantedItemEquipped(69) ) - v77 >>= 1; - if ( v45->HasItemEquipped(EQUIP_ARMOUR) - && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) - v77 >>= 1; - v75 = 0; - v47 = (int)&v45->pEquipment; - do - { - if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) + if ( !pParty->bTurnBasedModeOn ) { - v48 = *(int *)&v45[36 * *(int *)v47 + 496]; - if ( v48 == 520 ) - v77 >>= 1; - if ( v48 == 531 ) - v77 >>= 1; - if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) - v77 >>= 1; + v65 = v45->GetActualEndurance(); + v66 = (int)((20 - v45->GetParameterBonus(v65)) + * flt_6BE3A4_debug_recmod1 + * 2.133333333333333); + v45->SetRecoveryTime(v66); } - ++v75; - v47 += 4; - } - while ( (signed int)v75 <= 1 ); -LABEL_115: - if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) - { - v49 = v44->pActorBuffs[3].uPower; - if ( v49 ) - v77 /= (signed int)v49; - } - if ( !v74 ) - { - v50 = v44->pMonsterInfo.uAttack1Type; - goto LABEL_133; - } - if ( v74 == 1 ) - { - v50 = v44->pMonsterInfo.uAttack2Type; - goto LABEL_133; - } - if ( v74 == 2 ) - { - v53 = v44->pMonsterInfo.uSpell1ID; + return; } else { - if ( v74 != 3 ) - { - if ( v74 == 4 ) - v50 = v44->pMonsterInfo.field_3C_some_special_attack; - else - v50 = 4; -LABEL_133: - if ( !(dword_6BE368_debug_settings_2 & 0x10) ) - { - v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); - if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) - { - if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) - { - v55 = v44->uAIState; - if ( v55 != 5 ) - { - if ( v55 != 4 ) - { - v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); - v44->sCurrentHP -= v56; - if ( v56 ) - { - if ( v44->sCurrentHP >= 1 ) - { - Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); - Actor::AggroSurroundingPeasants(uActorID, 1); - } - else - { - if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) - { - v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; - v75 = v57; - if ( pRenderer->pRenderD3D ) - { - if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) - { - v58 = (double)(signed int)v75; - v75 = v44->vPosition.z; - v59 = (double)(signed int)v75; - v75 = v44->vPosition.y; - v60 = v59; - v61 = (double)(signed int)v75; - v75 = v44->vPosition.x; - v62 = v61; - v63 = (double)(signed int)v75; - pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); - } - } - } - Actor::Die(uActorID); - Actor::ApplyFineForKillingPeasant(uActorID); - Actor::AggroSurroundingPeasants(uActorID, 1); - if ( v44->pMonsterInfo.uExp ) - GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); - v64 = SPEECH_51; - if ( rand() % 100 < 20 ) - v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; - v45->PlaySound((PlayerSpeech)v64, 0); - } - } - } - } - } - } - } - if ( !v74 - && !(dword_6BE368_debug_settings_2 & 0x10) - && v44->pMonsterInfo.uSpecialAttack - && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) - v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); - if ( !pParty->bTurnBasedModeOn ) - { - v65 = v45->GetActualEndurance(); - v66 = (double)(20 - v45->GetParameterBonus(v65)) - * flt_6BE3A4_debug_recmod1 - * 2.133333333333333; - v45->SetRecoveryTime((signed __int64)v66); - } - return; - } - v53 = v44->pMonsterInfo.uSpell2ID; - } - v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); - goto LABEL_133; - } - if ( v42 != 1 ) - return; -LABEL_80: - if ( a4 != -1 ) - { - v43 = &pParty->pPlayers[a4]; -LABEL_168: - a4b = v43; - if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) - { - v70 = v43->GetMaxHealth(); - v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); - v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); - } - else - { - v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); - v69 = 0; - } - a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); - if ( v38 == OBJECT_Player && !qword_A750D8 ) - { - qword_A750D8 = 256i64; - PlayerSpeechID = SPEECH_44; - uSpeakingCharacter = uActorID + 1; - } - return; - } - v74 = 0; - a4a = 1; - do - { - if ( pPlayers[a4a]->CanAct() ) - { - v67 = v74++; - *(&v72 + v67) = a4a; - } - ++a4a; - } - while ( a4a <= 4 ); - if ( v74 ) - { - v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; - goto LABEL_168; + return; + } } } //----- (00421EA6) -------------------------------------------------------- diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Render.cpp --- a/Render.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Render.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -546,36 +546,36 @@ if (pGame->pIndoorCameraD3D->sRotationX) { v13 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v30 = ((unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); - v37 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; - a6a = (unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; + v30 = ((unsigned __int64)(v12 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + + ((unsigned __int64)(v13 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); + v37 = (unsigned __int64)(v12 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + a6a = (unsigned __int64)(v13 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; v33 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; - v14 = (unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; - v15 = (unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; + v14 = (unsigned __int64)(v30 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16; + v15 = (unsigned __int64)(v33 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; v16 = v15 + v14; v42 = v15 + v14; if ( v15 + v14 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) { v17 = a6a - v37; v40 = a6a - v37; - v18 = ((unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) - - ((unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); + v18 = ((unsigned __int64)(v33 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + - ((unsigned __int64)(v30 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); goto LABEL_29; } } else { v34 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v19 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; - v20 = (unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + v19 = (unsigned __int64)(v12 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; + v20 = (unsigned __int64)(v34 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; v16 = v20 + v19; v42 = v20 + v19; if ( v20 + v19 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) { - v21 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; - v17 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; - v40 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; + v21 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v17 = ((unsigned __int64)(v34 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v21; + v40 = ((unsigned __int64)(v34 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v21; v18 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; LABEL_29: v31 = v18; @@ -1044,23 +1044,23 @@ if (pGame->pIndoorCameraD3D->sRotationX) { v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v18 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); + v18 = ((unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + + ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); v42 = v18; - b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; + b = (unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; v40 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; - v41 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; - v19 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; - v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); - v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); + v41 = (unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + v19 = (unsigned __int64)(v18 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16; + v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); + v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) { v21 = a5 - b; v41 = a5 - b; - a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; - v22 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) - a5; + a5 = (unsigned __int64)(v42 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16; + v22 = ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - a5; LABEL_30: v42 = v22; v40 = 2 * abs(v20); @@ -1127,16 +1127,16 @@ { v42 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; - v20 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); - v39 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); + b = (unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v20 = b + ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); + v39 = b + ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) { - a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; - v21 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; - v41 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; + a5 = (unsigned __int64)(v42 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; + v21 = ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - a5; + v41 = ((unsigned __int64)(v40 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - a5; v22 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; goto LABEL_30; } @@ -2094,10 +2094,14 @@ hd_water_current_frame = 0; } -bool Render::Initialize(bool bWindowed, uint32_t uDefaultDevice, bool bColoredLights, uint32_t uDetailLevel, bool bTinting) +bool Render::Initialize(bool bWindowed, int windowed_width, int windowed_height, uint32_t uDefaultDevice, + bool bColoredLights, uint32_t uDetailLevel, bool bTinting) { bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0); + bStartInWindow = bWindowed; + windowed_mode_width = windowed_width; + windowed_mode_height = windowed_height; uDesiredDirect3DDevice = uDefaultDevice;//ReadWindowsRegistryInt("D3D Device", 1); @@ -2177,30 +2181,21 @@ //----- (0049ED18) -------------------------------------------------------- void Render::PresentBlackScreen() { - LONG w; // edx@3 IDirectDrawSurface *v2; // eax@3 DDBLTFX v3; // [sp+4h] [bp-74h]@5 RECT x; // [sp+68h] [bp-10h]@3 memset(&v3, 0, sizeof(DDBLTFX)); + GetWindowRect(hWnd, &x); if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5) { - x.left = uWindowX; - x.right = uWindowX + uWindowHeight; - x.top = uWindowY; - w = uWindowY + uWindowWidth; v2 = (IDirectDrawSurface *)this->pBackBuffer4; } else { - x.left = uWindowX; - x.right = uWindowX + uWindowHeight; - x.top = uWindowY; - w = uWindowY + uWindowWidth; v2 = (IDirectDrawSurface *)this->pBackBuffer2; } - x.bottom = w; v3.dwFillColor = 0; v3.dwSize = 100; v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3); @@ -4916,7 +4911,7 @@ } //if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES) - if (pODMRenderParams->flags & ODM_RENDER_DRAW_TERRAIN_OUTLINES) + if (pGame->pIndoorCameraD3D->debug_flags & ODM_RENDER_DRAW_TERRAIN_OUTLINES) pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); } // 4A26BC: could not find valid save-restore pair for esi @@ -5008,20 +5003,20 @@ void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID) { BLVFace *pFace; // esi@1 - unsigned int v3; // edi@1 - PolygonType v4; // al@1 + //unsigned int v3; // edi@1 + //PolygonType v4; // al@1 double v5; // st7@3 signed __int64 v6; // qax@3 - PolygonType v7; // cl@3 - int v8; // esi@7 - int v9; // eax@7 - unsigned int v10; // eax@7 - double v11; // st6@7 + //PolygonType v7; // cl@3 + //int v8; // esi@7 + //int v9; // eax@7 + //unsigned int v10; // eax@7 + //double v11; // st6@7 int v12; // edx@7 int v13; // eax@7 - char *v14; // esi@8 + //char *v14; // esi@8 void *v15; // ecx@9 - int v16; // eax@9 + //int v16; // eax@9 int v17; // edi@9 double v18; // st7@9 signed int v19; // ebx@9 @@ -5059,21 +5054,21 @@ double v51; // st7@46 RenderVertexSoft *v52; // edx@46 void *v53; // edi@48 - char *v54; // ebx@52 - unsigned int v55; // eax@53 - unsigned int v56; // eax@55 - int v57; // ST10_4@55 - Texture *v58; // eax@55 + //char *v54; // ebx@52 + //unsigned int v55; // eax@53 + //unsigned int v56; // eax@55 + //int v57; // ST10_4@55 + //Texture *v58; // eax@55 signed int v59; // [sp-4h] [bp-178h]@17 struct Polygon *v60; // [sp+0h] [bp-174h]@17 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 struct Polygon v62; // [sp+14h] [bp-160h]@6 unsigned int v63; // [sp+120h] [bp-54h]@7 - double v64; // [sp+124h] [bp-50h]@7 + //double v64; // [sp+124h] [bp-50h]@7 unsigned int v65; // [sp+128h] [bp-4Ch]@1 unsigned int v66; // [sp+12Ch] [bp-48h]@7 float v67; // [sp+130h] [bp-44h]@7 - __int64 v68; // [sp+134h] [bp-40h]@3 + //__int64 v68; // [sp+134h] [bp-40h]@3 __int64 v69; // [sp+13Ch] [bp-38h]@3 int v70; // [sp+144h] [bp-30h]@3 int X; // [sp+148h] [bp-2Ch]@9 @@ -5088,41 +5083,20 @@ float v80; // [sp+16Ch] [bp-8h]@3 const void *v81; // [sp+170h] [bp-4h]@7 - __debugbreak(); - pFace = &pIndoor->pFaces[uFaceID]; - v65 = uFaceID; - v3 = uNumVertices; - v4 = pFace->uPolygonType; - if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) - { - if ( (signed int)uNumVertices > 0 ) - { - v54 = (char *)&array_507D30[0].u; - LODWORD(v80) = uNumVertices; - do - { - v69 = (GetTickCount() >> 5) - pGame->pIndoorCameraD3D->vPartyPos.x; - *(float *)v54 = (double)v69 + *(float *)v54; - *(float *)v54 = *(float *)v54 * 0.25; - v55 = GetTickCount(); - v54 += 48; - v44 = LODWORD(v80)-- == 1; - v68 = pGame->pIndoorCameraD3D->vPartyPos.y + (v55 >> 5); - *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; - } - while ( !v44 ); - uFaceID = v65; - } - v56 = 8 * uFaceID; - LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); - v57 = v56; - v58 = pFace->GetTexture(); - pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); + if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) + { + int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x; + int v55 = (GetTickCount() / 32) + pGame->pIndoorCameraD3D->vPartyPos.y; + for (uint i = 0; i < uNumVertices; ++i) + { + array_507D30[i].u = (v69 + array_507D30[i].u) * 0.25f; + array_507D30[i].v = (v55 + array_507D30[i].v) * 0.25f; + } + pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0); return; } - HIDWORD(v69) = pGame->pIndoorCameraD3D->sRotationX; - HIDWORD(v68) = pGame->pIndoorCameraD3D->vPartyPos.z; + *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z) / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0) @@ -5130,45 +5104,41 @@ + *(float *)&v74); v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064; *(float *)&v75 = v5; - v80 = cos(v5) * 16192.0; v6 = (signed __int64)(*(float *)&v74 - (double)pBLVRenderParams->fov_rad_fixpoint - / ((v80 + 0.0000001) + / ((cos(v5) * 16192.0 + 0.0000001) * 65535.0) - * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); - v7 = pFace->uPolygonType; - if ( v7 == 4 || v7 == 3 ) - v70 = v6; + * (sin(*(float *)&v75) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z)); + + stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); v62.Create_48607B(&stru_8019C8); v62.uTileBitmapID = pFace->uBitmapID; - v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); + + v62.pTexture = pBitmaps_LOD->GetTexture(v62.uTileBitmapID); if ( !v62.pTexture ) return; - v8 = pGame->pIndoorCameraD3D->sRotationX; + v62.dimming_level = 0; - v62.uNumVertices = v3; - v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); + v62.uNumVertices = uNumVertices; v62.v_18.y = 0; - v62.v_18.x = -v9; - v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); - v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; - memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); - LODWORD(v80) = v10; - v62.field_24 = 33554432; - v64 = (double)(signed int)v10 * 0.5; - v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); - LODWORD(v80) = v62.pTexture->uTextureWidth; - v11 = 1.0 / (double)SLODWORD(v80); - LODWORD(v80) = v62.pTexture->uTextureHeight; + v62.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); + v62.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16); + memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); + v62.field_24 = 0x2000000; + + extern float _calc_fov(int viewport_width, int angle_degree); + //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5; + //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); + v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74); v12 = v62.pTexture->uWidthMinus1; v13 = v62.pTexture->uHeightMinus1; - v67 = v11; + v67 = 1.0 / (double)v62.pTexture->uTextureWidth; v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; v78 = 0; v81 = 0; - *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); + float v68 = 1.0 / (double)v62.pTexture->uTextureHeight; if ( (signed int)v62.uNumVertices <= 0 ) { LABEL_17: @@ -5178,23 +5148,21 @@ v59 = v62.uNumVertices; goto LABEL_18; } - v14 = (char *)&array_507D30[0].vWorldViewProjY; + + //v14 = (char *)&array_507D30[0].vWorldViewProjY; + int _507D30_idx = 0; while ( 2 ) { - v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); - LODWORD(v80) = v62.ptr_38->field_14; - v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; - v16 = v77 + v62.ptr_38->field_C; + v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY)); + v77 = (unsigned __int64)(v62.ptr_38->field_14 * (signed __int64)(signed int)v15) >> 16; + v74 = v77 + v62.ptr_38->field_C; v77 = (int)v15; - v74 = v16; - LODWORD(v80) = v62.ptr_38->field_20; - v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; + v77 = (unsigned __int64)(v62.ptr_38->field_20 * (signed __int64)(signed int)v15) >> 16; v79 = v15; v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); - LODWORD(v80) = v62.v_18.z; v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); - v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); - v18 = *(float *)v14 - 1.0; + v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX); + v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0; v19 = -v62.field_24; v77 = -v62.field_24; X = (int)((char *)v79 + v62.v_18.x); @@ -5213,7 +5181,6 @@ v19 = v77; v20 = v79; LABEL_14: - LODWORD(v80) = v62.v_18.z; v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; --LODWORD(v76); @@ -5227,23 +5194,22 @@ HIDWORD(v23) = v77 >> 16; v79 = (void *)(v23 / X); v77 = v17; - LODWORD(v80) = v62.ptr_38->field_10; v77 = v17; - LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); - LODWORD(v80) = v62.ptr_38->field_1C; - v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); + LODWORD(v76) = v74 + ((unsigned __int64)(v62.ptr_38->field_10 * (signed __int64)v17) >> 16); + v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v62.ptr_38->field_1C * (signed __int64)v17) >> 16)); v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; - v14 += 48; + //v14 += 48; LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); v81 = (char *)v81 + 1; v24 = (double)SLODWORD(v80) * 0.000015259022; LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); v26 = __OFSUB__((int)v81, v62.uNumVertices); v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; - *((float *)v14 - 10) = v24 * v67; - *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); - *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; + array_507D30[_507D30_idx].u = v24 * v67; + array_507D30[_507D30_idx].v = (double)SLODWORD(v80) * 0.000015259022 * v68; + array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79; + _507D30_idx++; if ( !(v25 ^ v26) ) goto LABEL_17; continue; @@ -5369,7 +5335,7 @@ v45 = (double)v78 * 0.000015259022; v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); *((float *)v34 - 10) = v45 * v67; - *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); + *((float *)v34 - 9) = (double)v78 * 0.000015259022 * v68; v46 = (double)(signed int)v79; *((float *)v34 - 16) = 0.000015258789 * v46; *((float *)v34 - 11) = 65536.0 / v46; @@ -8390,13 +8356,6 @@ } if ( pRenderer->bWindowMode ) { - if ( GetWindowRect(hWnd, &Rect) ) - { - WriteWindowsRegistryInt("window X", Rect.left); - WriteWindowsRegistryInt("window Y", Rect.top); - uWindowX = Rect.left; - uWindowY = Rect.top; - } SetMenu(hWnd, 0); SetWindowLongA(hWnd, -20, 0); SetWindowLongA(hWnd, -16, 0x10000000u); @@ -8408,7 +8367,6 @@ { ClipCursor(0); pRenderer->SwitchToWindow(hWnd); - SetWindowLongA(hWnd, -16, uWindowStyle); } if ( pRenderer->pRenderD3D ) { @@ -8463,14 +8421,14 @@ pMouse->SetCurrentCursorBitmap(); if ( pRenderer->bWindowMode ) { - InvalidateRect(0, 0, 0); - MoveWindow(hWnd, uWindowX, uWindowY, uWindowWidth, uWindowHeight, 0); + //MoveWindow(hWnd, uWindowX, uWindowY, uWindowWidth, uWindowHeight, 0); + CenterWindowAndAdjustSize(hWnd, windowed_mode_width, windowed_mode_height); ShowWindow(hWnd, SW_SHOWNORMAL); } pMouse->bActive = 1; if ( pVideoPlayer->AnyMovieLoaded() ) pVideoPlayer->SelectMovieType(); - if ( BYTE1(dword_6BE364_game_settings_1) & 8 ) + if (dword_6BE364_game_settings_1 & 0x0800 ) BYTE1(dword_6BE364_game_settings_1) &= 0xF7u; else pEventTimer->Resume(); diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Render.h --- a/Render.h Wed Sep 18 20:04:30 2013 +0600 +++ b/Render.h Wed Sep 18 20:04:49 2013 +0600 @@ -269,7 +269,7 @@ static Render *Create() {return new Render;} - bool Initialize(bool bWindowed, uint32_t uDefaultDevice, + bool Initialize(bool bWindowed, int window_width, int window_height, uint32_t uDefaultDevice, bool bColoredLights, uint32_t uDetailLevel, bool bTinting); @@ -457,6 +457,10 @@ unsigned int uCurrentlyLockedSurfacePitch; unsigned __int16 *pCurrentlyLockedSurfaceDataPtr; unsigned __int16 *pCurrentlyLockedSoftSurface; + + + int windowed_mode_width; + int windowed_mode_height; }; #pragma pack(pop) diff -r 014eb02bd0e6 -r 4bbb80c7dba7 SpriteObject.cpp --- a/SpriteObject.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/SpriteObject.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -82,11 +82,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); - a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); - pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); - pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); - pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); + v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); } else { @@ -107,11 +107,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); - a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); - pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); - pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); - pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); + v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); } else { @@ -132,11 +132,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16; - a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); - pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); - pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); + v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16; + a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16; + pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); } else { @@ -157,11 +157,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); - a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); - pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); - pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); - pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); + v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); } else { @@ -182,11 +182,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); - a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); - pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); - pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); - pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); + v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); } else { @@ -311,11 +311,11 @@ v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16; //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16); - v1->vVelocity.x += fixpoint_sub0(v56, v51.x); + v1->vVelocity.x += fixpoint_mul(v56, v51.x); //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16); - v1->vVelocity.y += fixpoint_sub0(v56, v51.y); + v1->vVelocity.y += fixpoint_mul(v56, v51.y); //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16); - v1->vVelocity.z += fixpoint_sub0(v56, v51.z); + v1->vVelocity.z += fixpoint_mul(v56, v51.z); LABEL_12: v7 = v54; goto LABEL_13; @@ -331,9 +331,9 @@ if ( !(v2->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) ) v1->vVelocity.z = 0; - v1->vVelocity.x = fixpoint_sub0(58500, v1->vVelocity.x); - v1->vVelocity.y = fixpoint_sub0(58500, v1->vVelocity.y); - v1->vVelocity.z = fixpoint_sub0(58500, v1->vVelocity.z); + v1->vVelocity.x = fixpoint_mul(58500, v1->vVelocity.x); + v1->vVelocity.y = fixpoint_mul(58500, v1->vVelocity.y); + v1->vVelocity.z = fixpoint_mul(58500, v1->vVelocity.z); if ( (v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x) < 400 ) { @@ -503,12 +503,12 @@ return; } //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16); - v1->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); + v1->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16); - v1->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); + v1->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16); v28 = LOWORD(stru_721530.uSectorID); - v1->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); + v1->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); v29 = v1->vPosition.z; v1->uSectorID = v28; stru_721530.field_70 += stru_721530.field_7C; @@ -786,11 +786,11 @@ return; } //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; - pSpriteObject->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); + pSpriteObject->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; - pSpriteObject->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); + pSpriteObject->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16; - pSpriteObject->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); + pSpriteObject->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); pSpriteObject->uSectorID = stru_721530.uSectorID; stru_721530.field_70 += stru_721530.field_7C; if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) @@ -801,8 +801,8 @@ 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); - pSpriteObject->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v23), v40); - pSpriteObject->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v23), v40); + pSpriteObject->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v23), v40); + pSpriteObject->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v23), v40); } else { @@ -816,9 +816,9 @@ + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; if ( (stru_721530.speed >> 3) > v42 ) v42 = stru_721530.speed >> 3; - pSpriteObject->vVelocity.x += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.x); - pSpriteObject->vVelocity.y += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.y); - v39 = fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.z); + pSpriteObject->vVelocity.x += 2 * fixpoint_mul(v42, v16->pFacePlane_old.vNormal.x); + pSpriteObject->vVelocity.y += 2 * fixpoint_mul(v42, v16->pFacePlane_old.vNormal.y); + v39 = fixpoint_mul(v42, v16->pFacePlane_old.vNormal.z); if ( v16->pFacePlane_old.vNormal.z <= 32000 ) { v22 = 2 * v39; @@ -826,7 +826,7 @@ else { pSpriteObject->vVelocity.z += v39; - v22 = fixpoint_sub0(32000, v39); + v22 = fixpoint_mul(32000, v39); } pSpriteObject->vVelocity.z += v22; if ( BYTE3(v16->uAttributes) & 0x10 ) @@ -861,9 +861,9 @@ LABEL_63: //v2 = v37; LABEL_64: - pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x); - pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y); - pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z); + pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); + pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); + pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); ++uFaceID; v28 = __OFSUB__(uFaceID, 100); v27 = uFaceID - 100 < 0; @@ -893,9 +893,9 @@ pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); v8 = 0; } - pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x); - pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y); - pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z); + pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); + pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); + pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); v9 = pSpriteObject->vVelocity.x; if ( v9 * v9 + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 ) { diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Texture.cpp --- a/Texture.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Texture.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -129,7 +129,9 @@ unsigned int uTextureID_ib_td5_A; -unsigned int uTextureID_ib_td2_A; // weak +unsigned int uTextureID_ib_td4_A; +unsigned int uTextureID_ib_td3_A; +unsigned int uTextureID_ib_td2_A; unsigned int uTextureID_ib_td1_A; int uTextureID_CharacterUI_InventoryBackground; // weak int uTextureID_50795C; // weak diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Texture.h --- a/Texture.h Wed Sep 18 20:04:30 2013 +0600 +++ b/Texture.h Wed Sep 18 20:04:49 2013 +0600 @@ -228,7 +228,9 @@ extern unsigned int uTextureID_ib_td5_A; -extern unsigned int uTextureID_ib_td2_A; // weak +extern unsigned int uTextureID_ib_td4_A; +extern unsigned int uTextureID_ib_td3_A; +extern unsigned int uTextureID_ib_td2_A; extern unsigned int uTextureID_ib_td1_A; extern int uTextureID_CharacterUI_InventoryBackground; // weak extern int uTextureID_50795C; // weak diff -r 014eb02bd0e6 -r 4bbb80c7dba7 UI/UICharacter.cpp --- a/UI/UICharacter.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/UI/UICharacter.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -942,7 +942,7 @@ item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uArmor - 1]; switch ( item->uItemID ) { - case ITEM_ARTICACT_GOVERNONS_ARMOR: + case ITEM_ARTIFACT_GOVERNORS_ARMOR: index = 15; break; case ITEM_ARTIFACT_YORUBA: @@ -1140,7 +1140,7 @@ item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uArmor - 1]; switch ( item->uItemID ) { - case ITEM_ARTICACT_GOVERNONS_ARMOR: + case ITEM_ARTIFACT_GOVERNORS_ARMOR: index = 15; break; case ITEM_ARTIFACT_YORUBA: @@ -1766,7 +1766,7 @@ { auto player = pParty->pPlayers + i; - if (player->HasItem(ITEM_ARTICACT_GOVERNONS_ARMOR, 1)) byte_5111F6[0] = 1; + if (player->HasItem(ITEM_ARTIFACT_GOVERNORS_ARMOR, 1)) byte_5111F6[0] = 1; if (player->HasItem(ITEM_ARTIFACT_YORUBA, 1)) byte_5111F6[1] = 1; if (player->HasItem(ITEM_RELIC_HARECS_LEATHER, 1)) byte_5111F6[2] = 1; if (player->HasItem(ITEM_ARTIFACT_LEAGUE_BOOTS, 1)) byte_5111F6[3] = 1; @@ -1809,7 +1809,7 @@ paperdoll_helm_texture[i][14] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); GetItemTextureFilename(pContainer, 544, i + 1, 0); paperdoll_helm_texture[i][15] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - if ( _43ED6F_check_party_races(true) ) + if ( IsDwarfPresentInParty(true) ) //the phynaxian helm uses a slightly different graphic for dwarves papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE); } //v43 = 0; diff -r 014eb02bd0e6 -r 4bbb80c7dba7 UI/UIGuilds.cpp --- a/UI/UIGuilds.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/UI/UIGuilds.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -26,28 +26,21 @@ const char *statusbar_string; // ecx@26 POINT *v12; // esi@30 int v13; // ecx@30 - void *v14; // ST1C_4@31 + //void *v14; // ST1C_4@31 ItemGen *v15; // ST18_4@31 - int v16; // ST10_4@31 + //int v16; // ST10_4@31 int v17; // eax@31 char *v18; // edx@31 - int v19; // eax@32 int pActiveItem; // esi@35 - int v22; // eax@35 - unsigned int v23; // eax@36 int v24; // eax@39 int v25; // eax@40 int v26; // ecx@47 GUIButton *pButton; // eax@49 - unsigned int v29; // eax@49 int pTextHeight; // eax@55 - unsigned int v32; // ecx@55 - int v33; // eax@55 unsigned __int16 pTextColor; // ax@55 int v35; // eax@58 const char *v36; // ST20_4@61 unsigned __int16 v37; // ST1C_2@61 - int v38; // eax@61 int v40; // [sp-14h] [bp-300h]@31 int v41; // [sp-10h] [bp-2FCh]@31 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 @@ -66,13 +59,11 @@ int pColorWhite; // [sp+2CCh] [bp-20h]@1 int pColorYellow; // [sp+2D0h] [bp-1Ch]@1 int v58; // [sp+2D4h] [bp-18h]@1 - unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 + //unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 int v61; // [sp+2E0h] [bp-Ch]@35 - int pItemNum; unsigned int v62; // [sp+2E4h] [bp-8h]@13 int pPrice; // [sp+2E8h] [bp-4h]@1 - int pNumActivItem; int all_text_height; int pX; @@ -91,35 +82,110 @@ strcpy(v47, ""); strcpy(v48, ""); strcpy(v49, ""); - if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, + guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) + { //you must me member + pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3); + pDialogueWindow->pNumPresenceButton = 0; + return; + } + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) { - if ( HouseUI_CheckIfPlayerCanInteract() ) + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); + return; + } + v61 = 0; + pSkillFlag = false; + all_text_height = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( pDialogueWindow->GetControl(i)->msg_param == 18 ) + { + all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" + v61++; + } + else { - if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) + if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" - ShowStatusBarString(pTmpBuf.data(), 2); - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &working_window, 0, 0); + v61++; + pSkillFlag = true; + } + } + } + if ( !v61 ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); + return; + } + if ( pSkillFlag ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu" + working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + } + v58 = (149 - all_text_height) / v61; + if ( v58 > 32 ) + v58 = 32; + v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( pButton->msg_param == 18 ) + { + pButton->uY = v58 + v26; + pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); + pButton->uHeight = pTextHeight; + v26 = pButton->uY + pTextHeight - 1; + pButton->uW = v26; + pTextColor = pColorYellow; + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = pColorWhite; + working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells" + } + else + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uY = v58 + v26; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0); + pButton->uHeight = pTextHeight; + v26 = pButton->uY + pTextHeight - 1; + pButton->uW = v26; + pTextColor = pColorYellow; + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = pColorWhite; + working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); } else { - if ( pParty->uNumGold < pPrice ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - } - else - { - Party::TakeGold(pPrice); - pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; - } + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; } } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; } + return; + } + if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill + { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); v6 = 0; v62 = 0; @@ -168,134 +234,43 @@ v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) { - v14 = window_SpeakInHouse->ptr_1C; - v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); - v16 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BuildingType_MagicShop, v16, 2); - v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); - v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3); + v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C)); + v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); + v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v18, 3); return; } } return; } - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, - guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) - { //you must me member - v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - v61 = 0; - pSkillFlag = false; - pActiveItem = pDialogueWindow->pStartingPosActiveItem; - v22 = pActiveItem + pDialogueWindow->pNumPresenceButton; - pItemNum = 0; - if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - all_text_height = 0; - do - { - v23 = pDialogueWindow->GetControl(pActiveItem)->msg_param; - if ( v23 == 18 ) + if ( HouseUI_CheckIfPlayerCanInteract() ) { - all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" - v61++; - } - else - { - if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23 - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[v23 - 36] ) + if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v23 - 36], &working_window, 0, 0); - v61++; - pSkillFlag = true; - } - } - ++pActiveItem; - } - while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v61 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - if ( pSkillFlag ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu" - working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - } - v58 = (149 - all_text_height) / v61; - if ( v58 > 32 ) - v58 = 32; - v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162; - pNumActivItem = pDialogueWindow->pStartingPosActiveItem; - if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - pItemNum = 2; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - v29 = pButton->msg_param; - if ( v29 == 18 ) - { - pButton->uY = v58 + v26; - pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); - v32 = pButton->uY; - pButton->uHeight = pTextHeight; - v33 = v32 + pTextHeight - 1; - pButton->uW = v33; - v26 = v33; - pTextColor = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pTextColor = pColorWhite; - working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells" + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" + ShowStatusBarString(pTmpBuf.data(), 2); + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); } else { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] ) + if ( pParty->uNumGold < pPrice ) { - pButton->uY = v58 + v26; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v29 - 36], &working_window, 0, 0); - v32 = pButton->uY; - pButton->uHeight = pTextHeight; - v33 = v32 + pTextHeight - 1; - pButton->uW = v33; - v26 = v33; - pTextColor = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pTextColor = pColorWhite; - working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pSkillNames[v29 - 36], 3); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); } else { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; + Party::TakeGold(pPrice); + pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; } } - ++pItemNum; } - while ( pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; } - return; } //----- (004BC8D5) -------------------------------------------------------- void SpellBookGenerator()//for GuildDialogs diff -r 014eb02bd0e6 -r 4bbb80c7dba7 UI/UIHouses.cpp --- a/UI/UIHouses.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/UI/UIHouses.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -459,7 +459,7 @@ } break; - case BuildingType_14: + case BuildingType_ElementalGuild: { CreateButtonInColumn(0, 18); CreateButtonInColumn(1, 48); @@ -470,7 +470,7 @@ } break; - case BuildingType_15: + case BuildingType_SelfGuild: { CreateButtonInColumn(0, 18); CreateButtonInColumn(1, 52); @@ -1087,8 +1087,8 @@ case BuildingType_BodyGuild: case BuildingType_LightGuild: case BuildingType_DarkGuild: - case BuildingType_14: - case BuildingType_15: + case BuildingType_ElementalGuild: + case BuildingType_SelfGuild: case BuildingType_16: { if ( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed ) @@ -2984,20 +2984,8 @@ signed int v10; // esi@6 int pPrice; // ecx@6 signed int v14; // esi@14 - //unsigned int v15; // esi@16 int v16; // eax@16 - //unsigned int v17; // eax@17 int v19; // ecx@24 - //GUIButton *v20; // eax@26 - //GUIButton *v21; // esi@26 - //int v22; // eax@26 - //const char *v23; // eax@28 - //int v24; // eax@28 - //unsigned int v25; // ecx@28 - //int v26; // eax@28 - //unsigned __int16 v27; // ax@28 - //unsigned __int16 v29; // ST14_2@34 - //int v30; // eax@34 int v33; // eax@36 unsigned int v36; // eax@38 unsigned int v42; // eax@46 @@ -3008,7 +2996,6 @@ int pTextHeight; // eax@71 unsigned __int16 pTextColor; // ax@71 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 - //int v68; // [sp+6Ch] [bp-18h]@3 int v69; // [sp+70h] [bp-14h]@6 int v73; // [sp+80h] [bp-4h]@14 @@ -3065,7 +3052,6 @@ v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) { - //int pCurrentItem = 2; index = 0; for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) @@ -3080,7 +3066,6 @@ if ( pDialogueWindow->pCurrentPosActiveItem != i ) pTextColor = TargetColor(255, 255, 255); training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); - //++pCurrentItem; ++index; } } @@ -3096,7 +3081,6 @@ pDialogueWindow->pNumPresenceButton = 0; return; } - //v34 = pPlayers[uActiveCharacter]->uLevel; if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] ) { if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) @@ -3232,7 +3216,7 @@ unsigned int v5; // esi@5 int v6; // edi@6 int result; // eax@13 - int v12; // eax@20 + int all_text_height; // eax@20 int v13; // eax@21 GUIButton *pButton; // esi@27 unsigned int v16; // eax@28 @@ -3242,7 +3226,7 @@ int v27; // [sp-4h] [bp-80h]@8 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1 int v32; // [sp+6Ch] [bp-10h]@1 - int v34; // [sp+74h] [bp-8h]@17 + int index; // [sp+74h] [bp-8h]@17 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; @@ -3265,18 +3249,19 @@ } if ( !HouseUI_CheckIfPlayerCanInteract() ) return; - v34 = 0; + all_text_height = 0; + index = 0; for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36] && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) { - v12 += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); - ++v34; + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + ++index; } } - if ( !v34 ) + if ( !index ) { sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); strcat(pTmpBuf.data(), "\n \n"); @@ -3287,10 +3272,10 @@ } sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Ņōîčėîņōü íāâûęā: %lu dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v32 = (149 - v12) / v34; - if ( (149 - v12) / v34 > 32 ) + v32 = (149 - all_text_height) / index; + if ( v32 > 32 ) v32 = 32; - v34 = (149 - v34 * v32 - v12) / 2 - v32 / 2 + 162; + index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162; if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) { for ( int i = pDialogueWindow->pStartingPosActiveItem; @@ -3301,11 +3286,11 @@ { if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) { - pButton->uY = v32 + v34; + pButton->uY = v32 + index; pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); pButton->uHeight = pTextHeight; pButton->uW = pButton->uY + pTextHeight - 1; - v34 = pButton->uY + pTextHeight - 1; + index = pButton->uY + pTextHeight - 1; pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); if ( pDialogueWindow->pCurrentPosActiveItem != i ) pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); @@ -3366,26 +3351,18 @@ //----- (004B2A74) -------------------------------------------------------- void SimpleHouseDialog() { - char *v2; // eax@3 - unsigned int i; // eax@5 NPCData *pNPC; // esi@6 char *v15; // esi@14 GUIButton *pButton; // eax@15 - int v18; // ecx@17 char *v29; // esi@42 int v31; // ST1C_4@42 - int v34; // esi@51 - unsigned int v36; // edi@51 - GUIButton *v37; // eax@52 - int v38; // eax@52 - signed int v39; // ecx@54 + int index; // esi@51 + int v36; + signed int all_text_height; // ecx@54 int v40; // edi@57 - const char *v43; // ebx@60 - int v44; // eax@60 - unsigned int v45; // ecx@60 - unsigned __int16 v46; // ax@60 - GUIFont *v47; // ebx@64 - int v48; // esi@64 + unsigned __int16 pTextColor; // ax@60 + GUIFont *pTextFont; // ebx@64 + int pTextHeight; GUIWindow w; // [sp+Ch] [bp-110h]@64 GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13 GUIWindow house_window; // [sp+B4h] [bp-68h]@1 @@ -3401,13 +3378,14 @@ house_window.uFrameX = 483; house_window.uFrameWidth = 148; house_window.uFrameZ = 334; - v2 = pTransitionStrings[uHouse_ExitPic]; - if ( !v2 ) + if ( !pTransitionStrings[uHouse_ExitPic] ) { sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Âîéōč â ^Pv[%s] - v2 = pTmpBuf.data(); + house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &house_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); + return; } - house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(v2, &house_window, 0, 0)) / 2 + 101, 0, v2, 3); + house_window.DrawTitleText(pFontCreate, 0, + (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uHouse_ExitPic], &house_window, 0, 0)) / 2 + 101, 0, pTransitionStrings[uHouse_ExitPic], 3); return; } house_window.uFrameWidth -= 10; @@ -3426,7 +3404,8 @@ { house_window.uFrameWidth = game_viewport_width; house_window.uFrameZ = 452; - pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); + pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)]; + //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); @@ -3448,7 +3427,7 @@ switch ( pButton->msg_param ) { case 19://evt_A - v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic; + v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic; if ( !v15 ) { pButton->msg_param = 0; @@ -3457,145 +3436,138 @@ strcpy(pButton->pButtonName, v15); continue; case 20://evt_B - v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic; + v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + if ( uDialogueType != 84 ) + { + strcpy(pButton->pButtonName, v15); + continue; + } + sprintf(pTmpBuf.data(), format_4E2D80, TargetColor(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName); + sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); + current_npc_text = pTmpBuf2.data(); + strcpy(pButton->pButtonName, v15); + continue; + case 21://evt_C + v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 22://evt_D + v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 23://evt_E + v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 24://evt_F + v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic; if ( !v15 ) { pButton->msg_param = 0; v15 = ""; - } - if ( uDialogueType != 84 ) - { - strcpy(pButton->pButtonName, v15); - continue; - } - sprintf(pTmpBuf.data(), format_4E2D80, TargetColor(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName); - sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); - current_npc_text = pTmpBuf2.data(); - strcpy(pButton->pButtonName, v15); - continue; - case 21://evt_C - v15 = (char *)pNPCTopics[pNPC->evt_C-1].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 22://evt_D - v15 = (char *)pNPCTopics[pNPC->evt_D-1].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 23://evt_E - v15 = (char *)pNPCTopics[pNPC->evt_E-1].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 24://evt_F - v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 76: - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Íāíĸōü - continue; - case 77: - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Ïîäðîáíåå - continue; - case 79: - strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C)); - continue; - case 82: - strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C)); - continue; - case 83: - v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; - v31 = *(int *)v29; - sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu)); - sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); - current_npc_text = pTmpBuf2.data(); - strcpy(pButton->pButtonName, ""); - continue; } - if ( pButton->msg_param > 0 && pButton->msg_param < 13 ) - { - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Âņōóïčōü - continue; - } - if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) - { - strcpy(pButton->pButtonName, ""); - continue; - } - if ( pButton->msg_param != 93 ) - { - strcpy(pButton->pButtonName, ""); - continue; - } + strcpy(pButton->pButtonName, v15); + continue; + case 76: + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Íāíĸōü + continue; + case 77: + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Ïîäðîáíåå + continue; + case 79: + strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C)); + continue; + case 82: + strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C)); + continue; + case 83: + v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; + v31 = *(int *)v29; + sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu)); + sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); + current_npc_text = pTmpBuf2.data(); + strcpy(pButton->pButtonName, ""); + continue; + } + if ( pButton->msg_param > 0 && pButton->msg_param < 13 ) + { + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Âņōóïčōü + continue; } - v34 = 0; - v36 = pDialogueWindow->pStartingPosActiveItem; - for ( i = v36 + pDialogueWindow->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton - + pDialogueWindow->pStartingPosActiveItem ) - { - v37 = pDialogueWindow->GetControl(v36); - v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &right_panel_window, 0, 0); - v34 += v38; - ++v36; + if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) + { + strcpy(pButton->pButtonName, ""); + continue; + } + if ( pButton->msg_param != 93 ) + { + strcpy(pButton->pButtonName, ""); + continue; + } } - v39 = pDialogueWindow->pNumPresenceButton; - if ( v39 ) + index = 0; + all_text_height = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) { - pNPC = (NPCData *)((174 - v34) / v39); - if ( (signed int)pNPC > 32 ) - pNPC = (NPCData *)32; - pInString = (char *)2; - v40 = (174 - (signed int)pNPC * v39 - v34) / 2 - (signed int)pNPC / 2 + 138; - for ( i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + pButton = pDialogueWindow->GetControl(i); + all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); + index++; + } + if ( index ) + { + v36 = (174 - all_text_height) / index; + if ( v36 > 32 ) + v36 = 32; + v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { pButton = pDialogueWindow->GetControl(i); - //v42 = v41; - v43 = pButton->pButtonName; - pButton->uY = (unsigned int)((char *)pNPC + v40); - v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); - v45 = pButton->uY; - pButton->uHeight = v44; - v40 = v45 + v44 - 1; + pButton->uY = v36 + v40; + pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); + pButton->uHeight = pTextHeight; + v40 = pButton->uY + pTextHeight - 1; pButton->uW = v40; - v46 = TargetColor(0xE1u, 0xCDu, 0x23u); - if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) - v46 = TargetColor(0xFFu, 0xFFu, 0xFFu); - right_panel_window.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3); - ++pInString; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); + right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); } } if ( current_npc_text ) { w.uFrameWidth = 458; w.uFrameZ = 457; - v47 = pFontArrus; - v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; - if ( 352 - v48 < 8 ) + pTextFont = pFontArrus; + pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + if ( 352 - pTextHeight < 8 ) { - v47 = pFontCreate; - v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + pTextFont = pFontCreate; + pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; } - pRenderer->GetLeather(8, 352 - v48, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); - pRenderer->DrawTextureIndexed(8, 347 - v48, pTexture_591428); - house_window.DrawText(v47, 13, 354 - v48, 0, FitTextInAWindow(current_npc_text, v47, &w, 13, 0), 0, 0, 0); + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0); } } diff -r 014eb02bd0e6 -r 4bbb80c7dba7 UI/UIMainMenu.cpp --- a/UI/UIMainMenu.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/UI/UIMainMenu.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -17,7 +17,6 @@ #include "..\mm7_data.h" - //----- (0041B578) -------------------------------------------------------- void MainMenuUI_LoadFontsAndSomeStuff() { @@ -68,278 +67,240 @@ //----- (0041B690) -------------------------------------------------------- void MainMenuUI_Create() { - Texture *v6; // ST78_4@1 - //const char *v7; // ST5C_4@1 - unsigned __int8 v8; // al@1 - //Texture *v9; // ST60_4@1 - Texture *v10; // ST78_4@1 - //const char *v11; // ST5C_4@1 - unsigned __int8 v12; // al@1 - //Texture *v13; // ST60_4@1 - unsigned int v14; // eax@1 - Texture *v15; // ST78_4@1 - //const char *v16; // ST5C_4@1 - unsigned __int8 v17; // al@1 - //Texture *v18; // ST60_4@1 - unsigned int uTextureID_ib_td4_A; // eax@1 - Texture *v20; // ST78_4@1 - unsigned __int8 v22; // al@1 - //Texture *v23; // ST60_4@1 - Texture *v24; // eax@1 - //Texture *v25; // esi@1 - //Texture *v26; // ST60_4@1 - //const char *v27; // ST5C_4@1 - unsigned __int8 v28; // al@1 - Texture *v29; // eax@1 - //Texture *v30; // esi@1 - //Texture *v31; // ST60_4@1 - //const char *v32; // ST5C_4@1 - unsigned __int8 v33; // al@1 + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA")); + + pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA")); - - pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); + uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); + uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); + uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE); + uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE); + uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE); + pTexture_Leather = pIcons_LOD->LoadTexturePtr("ibground", TEXTURE_16BIT_PALETTE); + uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE); + uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE); - uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); - uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); - uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE); - uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE); - uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE); - pTexture_Leather = pIcons_LOD->LoadTexturePtr("ibground", TEXTURE_16BIT_PALETTE); - uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE); - uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE); + pPrimaryWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); + pPrimaryWindow->CreateButton(7, 8, 460, 343, 1, 0, UIMSG_MouseLeftClickInGame, 0, 0, "", 0); + + pPrimaryWindow->CreateButton(61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + pPrimaryWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + pPrimaryWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + pPrimaryWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + pPrimaryWindow->CreateButton(24, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0); + pPrimaryWindow->CreateButton(139, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); + pPrimaryWindow->CreateButton(255, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); + pPrimaryWindow->CreateButton(370, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); + + pPrimaryWindow->CreateButton(97, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0); + pPrimaryWindow->CreateButton(212, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); + pPrimaryWindow->CreateButton(328, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); + pPrimaryWindow->CreateButton(443, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); + + uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); + pBtn_Quests = pPrimaryWindow->CreateButton(491, 353, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureHeight, 1, 0, UIMSG_OpenQuestBook, 0, pKeyActionMap->GetActionVKey(INPUT_Quest), + pGlobalTXT_LocalizationStrings[174], pIcons_LOD->GetTexture(uTextureID_ib_td1_A), 0); //Quests - pPrimaryWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); - pPrimaryWindow->CreateButton(7u, 8u, 0x1CCu, 0x157u, 1, 0, UIMSG_MouseLeftClickInGame, 0, 0, "", 0); - pPrimaryWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - pPrimaryWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - pPrimaryWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - pPrimaryWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1, 0, "", 0); - pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2, 0, "", 0); - pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3, 0, "", 0); - pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4, 0, "", 0); - pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1, 0, "", 0); - pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2, 0, "", 0); - pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3, 0, "", 0); - pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4, 0, "", 0); + uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE); + pBtn_Autonotes = pPrimaryWindow->CreateButton(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureHeight, 1, 0, UIMSG_OpenAutonotes, 0, pKeyActionMap->GetActionVKey(INPUT_Autonotes), + pGlobalTXT_LocalizationStrings[154], pIcons_LOD->GetTexture(uTextureID_ib_td2_A), 0);//Autonotes - uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); - v6 = pIcons_LOD->GetTexture(uTextureID_ib_td1_A); - v8 = pKeyActionMap->GetActionVKey(INPUT_Quest); - pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, UIMSG_OpenQuestBook, 0, v8, pGlobalTXT_LocalizationStrings[174], v6, 0); //Quests + uTextureID_ib_td3_A = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE); + pBtn_Maps = pPrimaryWindow->CreateButton(546, 353, pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureHeight, 1, 0, UIMSG_OpenMapBook, 0, pKeyActionMap->GetActionVKey(INPUT_Mapbook), + pGlobalTXT_LocalizationStrings[139], pIcons_LOD->GetTexture(uTextureID_ib_td3_A), 0); //Maps + + uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE); + pBtn_Calendar = pPrimaryWindow->CreateButton(570, 353, pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureHeight, 1, 0, UIMSG_OpenCalendar, 0, pKeyActionMap->GetActionVKey(INPUT_TimeCal), + pGlobalTXT_LocalizationStrings[78], pIcons_LOD->GetTexture(uTextureID_ib_td4_A), 0);//Calendar - uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE); - v10 = pIcons_LOD->GetTexture(uTextureID_ib_td2_A); - v12 = pKeyActionMap->GetActionVKey(INPUT_Autonotes); - pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, UIMSG_OpenAutonotes, 0, v12, pGlobalTXT_LocalizationStrings[154], v10, 0);//Autonotes - - v14 = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE); - v15 = pIcons_LOD->GetTexture(v14); - v17 = pKeyActionMap->GetActionVKey(INPUT_Mapbook); - pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, UIMSG_OpenMapBook, 0, v17, pGlobalTXT_LocalizationStrings[139], v15, 0); //Maps + uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE); + pBtn_History = pPrimaryWindow->CreateButton(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureHeight, 1, 0, UIMSG_OpenHistoryBook, 0, 72,//ascii + pGlobalTXT_LocalizationStrings[602], pIcons_LOD->GetTexture(uTextureID_ib_td5_A), 0);//History - uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE); - v20 = pIcons_LOD->GetTexture(uTextureID_ib_td4_A); - v22 = pKeyActionMap->GetActionVKey(INPUT_TimeCal); - pBtn_Calendar = pPrimaryWindow->CreateButton(0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, UIMSG_OpenCalendar, 0, v22, - pGlobalTXT_LocalizationStrings[78],//Calendar - v20, 0); + bFlashAutonotesBook = 0; + bFlashQuestBook = 0; + bFlashHistoryBook = 0; - uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE); - pBtn_History = pPrimaryWindow->CreateButton(0x258u, 0x169u, - pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureHeight, - 1, 0, UIMSG_OpenHistoryBook, 0, 0x48u, pGlobalTXT_LocalizationStrings[602],//History - pIcons_LOD->GetTexture(uTextureID_ib_td5_A), 0); + pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureWidth, + pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureHeight, 2, 0, UIMSG_ClickZoomInBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomIn), + pGlobalTXT_LocalizationStrings[252], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], 0); // Zoom In + + pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureWidth, + pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureHeight, 2, 0, UIMSG_ClickZoomOutBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomOut), + pGlobalTXT_LocalizationStrings[251], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], 0); // Zoom Out - bFlashAutonotesBook = 0; - bFlashQuestBook = 0; - bFlashHistoryBook = 0; + pPrimaryWindow->CreateButton(481, 0, 153, 67, 1, 92, UIMSG_0, 0, 0, "", 0); + pPrimaryWindow->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_StartHireling1Dialogue, 0, '5', "", 0); + pPrimaryWindow->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_StartHireling2Dialogue, 0, '6', "", 0); + pPrimaryWindow->CreateButton(476, 322, 77, 17, 1, 100, UIMSG_0, 0, 0, "", 0); + pPrimaryWindow->CreateButton(555, 322, 77, 17, 1, 101, UIMSG_0, 0, 0, "", 0); - v24 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn]; - v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn); - pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, v24->uTextureWidth, v24->uTextureHeight, 2, 0, UIMSG_ClickZoomInBtn, 0, v28, pGlobalTXT_LocalizationStrings[252], // Zoom In - v24, 0); - v29 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut]; - v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut); - pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, v29->uTextureWidth, v29->uTextureHeight, 2, 0, UIMSG_ClickZoomOutBtn, 0, v33, pGlobalTXT_LocalizationStrings[251], // Zoom Out - v29, 0); - pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, UIMSG_0, 0, 0, "", 0); - pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, UIMSG_StartHireling1Dialogue, 0, '5', "", 0); - pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, UIMSG_StartHireling2Dialogue, 0, '6', "", 0); - pPrimaryWindow->CreateButton(0x1DCu, 0x142u, 0x4Du, 0x11u, 1, 100, UIMSG_0, 0, 0, "", 0); - pPrimaryWindow->CreateButton(0x22Bu, 0x142u, 0x4Du, 0x11u, 1, 101, UIMSG_0, 0, 0, "", 0); - pBtn_CastSpell = pPrimaryWindow->CreateButton(0x1DCu, 0x1C2u, - pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureHeight, - 1, 0, UIMSG_SpellBookWindow, 0, 0x43u, pGlobalTXT_LocalizationStrings[38], pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell), - 0); - pBtn_Rest = pPrimaryWindow->CreateButton(0x206u, 0x1C2u, - pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureHeight, - 1, 0, UIMSG_RestWindow, 0, 0x52u, pGlobalTXT_LocalizationStrings[182], pIcons_LOD->GetTexture(uTextureID_Btn_Rest), 0); - pBtn_QuickReference = pPrimaryWindow->CreateButton(0x230u, 0x1C2u, - pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureHeight, - 1, 0, UIMSG_QuickReference, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173], pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference), 0); - pBtn_GameSettings = pPrimaryWindow->CreateButton(0x25Au, 0x1C2u, - pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureHeight, - 1, 0, UIMSG_GameMenuButton, 0, 0, pGlobalTXT_LocalizationStrings[93], pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings), 0); - pBtn_NPCLeft = pPrimaryWindow->CreateButton(0x1D5u, 0xB2u, - pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, - 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); - pBtn_NPCRight = pPrimaryWindow->CreateButton(0x272u, 0xB2u, - pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, - 1, 0, UIMSG_ScrollNPCPanel, 1u, 0, "", pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); - LoadPartyBuffIcons(); + pBtn_CastSpell = pPrimaryWindow->CreateButton(476, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureHeight, + 1, 0, UIMSG_SpellBookWindow, 0, 67, pGlobalTXT_LocalizationStrings[38], pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell), 0); + pBtn_Rest = pPrimaryWindow->CreateButton(518, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureHeight, + 1, 0, UIMSG_RestWindow, 0, 82, pGlobalTXT_LocalizationStrings[182], pIcons_LOD->GetTexture(uTextureID_Btn_Rest), 0); + pBtn_QuickReference = pPrimaryWindow->CreateButton(560, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureHeight, + 1, 0, UIMSG_QuickReference, 0, 90, pGlobalTXT_LocalizationStrings[173], pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference), 0); + pBtn_GameSettings = pPrimaryWindow->CreateButton(602, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureHeight, + 1, 0, UIMSG_GameMenuButton, 0, 0, pGlobalTXT_LocalizationStrings[93], pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings), 0); + + pBtn_NPCLeft = pPrimaryWindow->CreateButton(469, 178, + pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, + 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); + pBtn_NPCRight = pPrimaryWindow->CreateButton(626, 178, + pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, + 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); + LoadPartyBuffIcons(); } //----- (004979D2) -------------------------------------------------------- MENU_STATE MainMenuUI_Credits_Loop() { - char *v0; // eax@5 - char *v1; // edi@5 - FILE *pFile; // eax@5 - unsigned int pSize; // esi@7 - GUIFont *pFont; // edx@9 - GUIFont *pFont2; // ecx@9 - __int16 pHeight; // ax@9 - void *v7; // eax@9 - unsigned int pNumPixels; // ST2C_4@9 - unsigned int teal; // eax@9 - unsigned int v10; // ST2C_4@19 - MSG Msg; // [sp+84h] [bp-B8h]@10 - int v17; // [sp+A0h] [bp-9Ch]@9 - GUIWindow a2; - int pColor2; // [sp+F8h] [bp-44h]@9 - int pColor1; // [sp+FCh] [bp-40h]@9 - int a5; // [sp+128h] [bp-14h]@1 - char *pString; // [sp+12Ch] [bp-10h]@9 - char *ptr; // [sp+130h] [bp-Ch]@5 - GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 - GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 - RGBTexture pTexture; // [sp+54h] [bp-E8h]@1 - RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1 - Texture pTexture3; // [sp+Ch] [bp-130h]@5 + char *v1; // edi@5 + FILE *pFile; // eax@5 + unsigned int pSize; // esi@7 + __int16 pHeight; // ax@9 + void *v7; // eax@9 + unsigned int pNumPixels; // ST2C_4@9 + unsigned int v10; // ST2C_4@19 + MSG Msg; // [sp+84h] [bp-B8h]@10 + int v17; // [sp+A0h] [bp-9Ch]@9 + GUIWindow credit_window; + int a5; // [sp+128h] [bp-14h]@1 + char *pString; // [sp+12Ch] [bp-10h]@9 + char *ptr; // [sp+130h] [bp-Ch]@5 + GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 + GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 + RGBTexture pTexture; // [sp+54h] [bp-E8h]@1 + RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1 + Texture pTexture3; // [sp+Ch] [bp-130h]@5 - a5 = 0; - pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); - pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - dword_A74C88 = 0; - pAudioPlayer->PlayMusicTrack(MUSIC_Credits); - pTexture.Load("mm6title.pcx", 0); - v0 = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); - v1 = v0; - ptr = v0; - pFile = pEvents_LOD->FindContainer("credits.txt", 0); - if ( !pFile ) - Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. + a5 = 0; + pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); + pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + dword_A74C88 = 0; + pAudioPlayer->PlayMusicTrack(MUSIC_Credits); + pTexture.Load("mm6title.pcx", 0); + ptr = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); + v1 = ptr; + pFile = pEvents_LOD->FindContainer("credits.txt", 0); + if ( !pFile ) + Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. - // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." - fread(&pTexture3, 1, 0x30, pFile); - pSize = pTexture3.uDecompressedSize; - if ( !pTexture3.uDecompressedSize ) - pSize = pTexture3.uTextureSize; - memset(&pTexture3, 0, 0x48); - pFont = pFontCChar; - pFont2 = pFontQuick; - v1[pSize] = 0; - - a2.uFrameWidth = 250; - a2.uFrameHeight = 440; - a2.uFrameX = 389; - a2.uFrameY = 19; + // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." + fread(&pTexture3, 1, 0x30, pFile); + pSize = pTexture3.uDecompressedSize; + if ( !pTexture3.uDecompressedSize ) + pSize = pTexture3.uTextureSize; + memset(&pTexture3, 0, 0x48); + v1[pSize] = 0; + + credit_window.uFrameWidth = 250; + credit_window.uFrameHeight = 440; + credit_window.uFrameX = 389; + credit_window.uFrameY = 19; - pTexture2.uWidth = 250; - pHeight = pFont2->GetStringHeight2(pFont, v1, &a2, 0, 1); - pTexture2.uHeight = pHeight + 2 * a2.uFrameHeight; - pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight; - v7 = malloc(2 * pTexture2.uNumPixels);//, "scrollermap"); - pNumPixels = pTexture2.uNumPixels; - pTexture2.pPixels = (unsigned __int16 *)v7; - teal = TargetColor(0, 0xFFu, 0xFFu); - fill_pixels_fast(teal, pTexture2.pPixels, pNumPixels); - pTexture2._allocation_flags = 0; - pColor1 = TargetColor(0x70u, 0x8Fu, 0xFEu); - pColor2 = TargetColor(0xECu, 0xE6u, 0x9Cu); - pString = (char *)malloc(2 * pSize); - strncpy(pString, ptr, pSize); - pString[pSize]=0; - pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a2.uFrameHeight, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, pColor1, - pColor2, pString, pTexture2.pPixels, (signed __int16)pTexture2.uWidth); - free(pString); - pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, ptr); - pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 0x1Bu, "", 0); - pCurrentScreen = SCREEN_CREATORS; - SetCurrentMenuID(MENU_CREDITSPROC); - do - { - while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) - { - if ( Msg.message == 18 ) - Game_DeinitializeAndTerminate(0); - TranslateMessage(&Msg); - DispatchMessageA(&Msg); - } - if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) - { - WaitMessage(); - } - else - { - pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &pTexture); - pRenderer->SetTextureClipRect(a2.uFrameX, a2.uFrameY, a2.uFrameX + a2.uFrameWidth, a2.uFrameY + a2.uFrameHeight); - pRenderer->_4A5D33(a2.uFrameX, a2.uFrameY, 0, a5, &pTexture2); - pRenderer->ResetTextureClipRect(); - pRenderer->EndScene(); - ++a5; - if ( a5 >= (signed __int16)pTexture2.uHeight ) - SetCurrentMenuID(MENU_MAIN); - pRenderer->Present(); - pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() - GUI_MainMenuMessageProc(); - } - } - while ( GetCurrentMenuID() == MENU_CREDITSPROC ); - pAudioPlayer->_4AA258(1); - free(ptr); - free(pFontQuick); - free(pFontCChar); - pWindow_MainMenu->Release(); - pIcons_LOD->RemoveTexturesPackFromTextureList(); - pTexture.Release(); - pTexture2.Release(); - return MENU_MAIN; // return MENU_Main - } + pTexture2.uWidth = 250; + pHeight = pFontQuick->GetStringHeight2(pFontCChar, v1, &credit_window, 0, 1); + pTexture2.uHeight = pHeight + 2 * credit_window.uFrameHeight; + pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight; + v7 = malloc(2 * pTexture2.uNumPixels);//, "scrollermap"); + pNumPixels = pTexture2.uNumPixels; + pTexture2.pPixels = (unsigned __int16 *)v7; + fill_pixels_fast(TargetColor(0, 0xFFu, 0xFFu), pTexture2.pPixels, pNumPixels); + pTexture2._allocation_flags = 0; + pString = (char *)malloc(2 * pSize); + strncpy(pString, ptr, pSize); + pString[pSize]=0; + pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, (signed __int16)pTexture2.uWidth, + (signed __int16)pTexture2.uHeight, TargetColor(0x70u, 0x8Fu, 0xFEu), TargetColor(0xECu, 0xE6u, 0x9Cu), pString, pTexture2.pPixels, + (signed __int16)pTexture2.uWidth); + free(pString); + pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, ptr); + pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 0x1Bu, "", 0); + pCurrentScreen = SCREEN_CREATORS; + SetCurrentMenuID(MENU_CREDITSPROC); + do + { + while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) + { + if ( Msg.message == 18 ) + Game_DeinitializeAndTerminate(0); + TranslateMessage(&Msg); + DispatchMessageA(&Msg); + } + if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) + { + WaitMessage(); + } + else + { + pRenderer->BeginScene(); + pRenderer->DrawTextureRGB(0, 0, &pTexture); + pRenderer->SetTextureClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth, + credit_window.uFrameY + credit_window.uFrameHeight); + pRenderer->_4A5D33(credit_window.uFrameX, credit_window.uFrameY, 0, a5, &pTexture2); + pRenderer->ResetTextureClipRect(); + pRenderer->EndScene(); + ++a5; + if ( a5 >= (signed __int16)pTexture2.uHeight ) + SetCurrentMenuID(MENU_MAIN); + pRenderer->Present(); + pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() + GUI_MainMenuMessageProc(); + } + } + while ( GetCurrentMenuID() == MENU_CREDITSPROC ); + pAudioPlayer->_4AA258(1); + free(ptr); + free(pFontQuick); + free(pFontCChar); + pWindow_MainMenu->Release(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); + pTexture.Release(); + pTexture2.Release(); + return MENU_MAIN; // return MENU_Main +} \ No newline at end of file diff -r 014eb02bd0e6 -r 4bbb80c7dba7 UI/UiGame.cpp --- a/UI/UiGame.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/UI/UiGame.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -348,7 +348,6 @@ int pTextHeight; // esi@39 GUIButton *pButton; // eax@43 int v32; // ebx@93 - //uint v35; // esi@93 int v38; // eax@95 signed int v39; // esi@99 signed int v40; // eax@102 @@ -390,19 +389,19 @@ switch (uDialogueType) { case DIALOGUE_13: - pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); break; case DIALOGUE_PROFESSION_DETAILS: { - auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; + //auto prof = pNPCStats->pProfessions[pNPC->uProfession]; if (dialogue_show_profession_details) - pInString = BuildDialogueString(prof->pBenefits, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pBenefits, uActiveCharacter - 1, 0, 0, 0, 0); else if (pNPC->Hired()) - pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); else - pInString = BuildDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); } break; @@ -434,9 +433,9 @@ if (pNPC->greet) { if ((pNPC->uFlags & 3) == 2) - pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting2; + pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting2; else - pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1; + pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting1; } } else if (pGreetType == 2)//HiredNPC_greet @@ -501,71 +500,64 @@ else if (pButton->msg_param == 24) { __debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_F - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) + if (!pNPC->evt_F) + { + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; + } + else + strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_F].pTopic); + } + else if (pButton->msg_param == 9) + strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession)); + else if (pButton->msg_param == 19) // Scavenger Hunt + { + if (!pNPC->evt_A) { pButton->pButtonName[0] = 0; pButton->msg_param = 0; } else - strcpy(pButton->pButtonName, topic); + strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_A].pTopic); } - else if (pButton->msg_param == 9) - strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession)); - else if (pButton->msg_param == 19) + else if (pButton->msg_param == 20) // Scavenger Hunt { - // __debugbreak(); // learn conditions of this event Scavenger Hunt - auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) + if (!pNPC->evt_B) { pButton->pButtonName[0] = 0; pButton->msg_param = 0; } - else strcpy(pButton->pButtonName, topic); - } - else if (pButton->msg_param == 20) - { - //__debugbreak(); // learn conditions of this event instruments - auto topic = pNPCTopics[pNPC->evt_B - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) - { - pButton->pButtonName[0] = 0; - pButton->msg_param = 0; - } - else strcpy(pButton->pButtonName, topic); + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_B].pTopic); } else if (pButton->msg_param == 21) { //__debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_C - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) + if (!pNPC->evt_C) { pButton->pButtonName[0] = 0; pButton->msg_param = 0; } - else strcpy(pButton->pButtonName, topic); + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_C].pTopic); } else if (pButton->msg_param == 22) { //__debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_D - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) + if (!pNPC->evt_D) { pButton->pButtonName[0] = 0; pButton->msg_param = 0; } - else strcpy(pButton->pButtonName, topic); + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_D].pTopic); } else if (pButton->msg_param == 23) { //__debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_E - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) + if (!pNPC->evt_E) { pButton->pButtonName[0] = 0; pButton->msg_param = 0; } - else strcpy(pButton->pButtonName, topic); + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_E].pTopic); } else if (pButton->msg_param == 13) { diff -r 014eb02bd0e6 -r 4bbb80c7dba7 Viewport.cpp --- a/Viewport.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/Viewport.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -54,7 +54,7 @@ this->uScreenHeight = br_y - tl_y + 1; this->uScreenCenterX = (signed int)(br_x + tl_x) /2; if ( pRenderer->pRenderD3D == 0 ) - this->uScreenCenterY = this->uScreen_BR_Y - fixpoint_sub0(field_30, uScreenHeight); + this->uScreenCenterY = this->uScreen_BR_Y - fixpoint_mul(field_30, uScreenHeight); else this->uScreenCenterY = uScreenHeight/2; SetViewport(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y); diff -r 014eb02bd0e6 -r 4bbb80c7dba7 _deleted.cpp --- a/_deleted.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/_deleted.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -1176,8 +1176,8 @@ v28 = v3->sTextureDeltaU << 16; v35 = v3->sTextureDeltaV << 16; v10 = v2->field_8; - v29 = pODMRenderParams->camera_rotation_y_int_sine; - v32 = pODMRenderParams->camera_rotation_y_int_cosine; + v29 = pGame->pIndoorCameraD3D->int_sine_y; + v32 = pGame->pIndoorCameraD3D->int_cosine_y; a1.field_28 = v2->field_C; v11 = v3->field_24; v37 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v10); @@ -2325,8 +2325,8 @@ v8 = v3->ptr_38; v42 = ((unsigned __int64)(v3->ptr_38->field_14 * (signed __int64)v7) >> 16) + v8->field_C; v40 = ((unsigned __int64)(v8->field_20 * (signed __int64)v7) >> 16) + v3->ptr_38->field_18; - v38 = pODMRenderParams->camera_rotation_y_int_sine; - HIDWORD(v35) = pODMRenderParams->camera_rotation_y_int_cosine; + v38 = pGame->pIndoorCameraD3D->int_sine_y; + HIDWORD(v35) = pGame->pIndoorCameraD3D->int_cosine_y; v45 = v4->field_C; v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v7) >> 16) + v3->v_18.x; v10 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8); @@ -10177,78 +10177,78 @@ stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; if ( pBLVRenderParams->sPartyRotX ) { - v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; - X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; + v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v74; + X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - X; stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z - * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; - v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; - X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; - v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; - v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); + v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v70; + v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v70; + stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); + v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v70; + X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; + v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v70; + stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); + v74 = pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y + - pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x; + v11 = -(pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y + + pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x); v73 = -65536 * pBLVRenderParams->vPartyPos.z; - v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; - v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; + v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; + v12 = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v70; + v69 = (unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; v13 = pBLVRenderParams->vPartyPos.y; - v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); + v70 = ((unsigned __int64)(v74 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); v14 = pBLVRenderParams->vPartyPos.x; } else { - v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; + v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v70; stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v70; stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; + stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v70; - v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; + v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; v14 = pBLVRenderParams->vPartyPos.x; stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; v13 = pBLVRenderParams->vPartyPos.y; - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; - v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); + stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + v12 = pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y + - pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x; + v11 = -(pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y + + pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x); v70 = -65536 * pBLVRenderParams->vPartyPos.z; } stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; @@ -10603,74 +10603,74 @@ stru_F8AD28.uDefaultAmbientLightLevel = 0; if ( pBLVRenderParams->sPartyRotX ) { - v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) + v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); + stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z - * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); + * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z - * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); - v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; - v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); + v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); + stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); + stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); + v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); + stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); + stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16); + v3 = -(pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y + + pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x); + v4 = pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y + - pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x; + v5 = ((unsigned __int64)(v4 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); v6 = pBLVRenderParams->vPartyPos.z; - v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); + v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) + + ((unsigned __int64)(v4 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); v8 = pBLVRenderParams->vPartyPos.y; v9 = pBLVRenderParams->vPartyPos.x; } else { stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sSineY) >> 16); + * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) + * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); + * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); + stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); + stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) + - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); v8 = pBLVRenderParams->vPartyPos.y; - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); + stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16) + + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; v9 = pBLVRenderParams->vPartyPos.x; - v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; + v5 = pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y + - pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x; v6 = pBLVRenderParams->vPartyPos.z; - v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); + v3 = -(pGame->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y + + pGame->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x); v7 = -65536 * pBLVRenderParams->vPartyPos.z; } stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; @@ -10856,8 +10856,8 @@ v45 = v14->field_4 >> 3; v44 = v16 >> 3; v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; - v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; - v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; + v52 = (unsigned __int64)(v17 * (signed __int64)-pGame->pIndoorCameraD3D->int_sine_y) >> 16; + v53 = (unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; v18 = v14->field_28; v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13); LOWORD(v18) = 0; @@ -13198,9 +13198,14 @@ _int_sine_2 = stru_5C6E00->Sin(sRotationX); _int_cosine_2 = stru_5C6E00->Cos(sRotationX); } -// 4D864C: using guessed type char byte_4D864C; - - +//----- (0048600E) -------------------------------------------------------- +void ODMRenderParams::RotationToInts() +{ + camera_rotation_y_int_sine = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); + camera_rotation_y_int_cosine = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + camera_rotation_x_int_sine = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); + camera_rotation_x_int_cosine = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); +} diff -r 014eb02bd0e6 -r 4bbb80c7dba7 mm7_1.cpp --- a/mm7_1.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/mm7_1.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -52,7 +52,7 @@ return ((__int64)a1 << 16) / a2; } -__int64 fixpoint_mul(int a1, int a2) +__int64 fixpoint_sub_unknown(int a1, int a2) { return (((__int64)a1 << 16) * a2) >> 16; } @@ -61,24 +61,16 @@ //----- (0042EBBE) -------------------------------------------------------- //----- (004453C0) mm6----------------------------------------------------- //----- (004A1760) mm6_chinese--------------------------------------------- -__int64 fixpoint_sub0(int a1, int a2) +__int64 fixpoint_mul(int a1, int a2) { return ((__int64)a1 * (__int64)a2) >> 16; } -__int64 fixpoint_sub2(int a1, int a2) -{ - signed __int64 v3; // qtt@1 - - LODWORD(v3) = a1 << 16; - HIDWORD(v3) = a1 >> 16; - return v3 / a2; -} __int64 fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2) { - return fixpoint_sub0(x1, x2) + - fixpoint_sub0(y1, y2) + - fixpoint_sub0(z1, z2); + return fixpoint_mul(x1, x2) + + fixpoint_mul(y1, y2) + + fixpoint_mul(z1, z2); } //----- (0041D20D) -------------------------------------------------------- diff -r 014eb02bd0e6 -r 4bbb80c7dba7 mm7_2.cpp --- a/mm7_2.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/mm7_2.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -1343,15 +1343,15 @@ v6->pMonsterInfo.uExp = 0; v6->uMovementSpeed = v9; v10 = rand() % 2048; - //v11 = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); + //v11 = pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v10), v19); uFaceID = stru_5C6E00->Sin(v10); //v12 = pParty->vPosition.y; - //v13 = fixpoint_sub0(uFaceID, v19); - //v14 = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); + //v13 = fixpoint_mul(uFaceID, v19); + //v14 = pParty->vPosition.y + fixpoint_mul(uFaceID, v19); //LOWORD(v12) = v22; - v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); + v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v10), v19); v6->vPosition.x = v6->vInitialPosition.x; - v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); + v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_mul(uFaceID, v19); v6->vPosition.y = v6->vInitialPosition.y; v6->vInitialPosition.z = pParty->vPosition.z; v6->vPosition.z = v6->vInitialPosition.z; @@ -3719,8 +3719,11 @@ case WM_SETFOCUS: dword_4E98BC_bApplicationActive = 0; - if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) - SetWindowPos(hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); + if (pRenderer) + { + if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) + SetWindowPos(hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); + } ClipCursor(0); return DefWindowProcW(hWnd, uMsg, wParam, lParam); @@ -4277,8 +4280,35 @@ } } + + +void CenterWindowAndAdjustSize(HWND hwnd, int client_width, int client_height) +{ + RECT rcWindow; + GetWindowRect(hWnd, &rcWindow); + + RECT rcClient; + GetClientRect(hWnd, &rcClient); + + int window_borders_width = (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left), + window_borders_height = (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top); + int window_total_width = client_width + window_borders_width, + window_total_height = client_height + window_borders_height; + + MoveWindow(hWnd, (GetSystemMetrics(SM_CXSCREEN) - window_total_width) / 2, + (GetSystemMetrics(SM_CYSCREEN) - window_total_height) / 2, + window_total_width, + window_total_height, 0); +/* + auto hDesktopDC = GetDC(nullptr); + uint uDesktopWidth = GetDeviceCaps(hDesktopDC, HORZRES); + uint uDesktopHeight = GetDeviceCaps(hDesktopDC, VERTRES); + ReleaseDC(nullptr, hDesktopDC); +*/ +} + //----- (004651F4) -------------------------------------------------------- -bool MM7_Initialize() +bool MM7_Initialize(int game_width, int game_height) { wchar_t pCurrentDir[1024]; _wgetcwd(pCurrentDir, 1024); @@ -4318,29 +4348,10 @@ return false; } - auto hDesktopDC = GetDC(nullptr); - uint uDesktopWidth = GetDeviceCaps(hDesktopDC, HORZRES); - uint uDesktopHeight = GetDeviceCaps(hDesktopDC, VERTRES); - ReleaseDC(nullptr, hDesktopDC); - - uint uTotalWinWidth = 2 * GetSystemMetrics(SM_CXFRAME) + 640; - uint uTotalWinHeight = GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYFRAME) + 480; - - uint uWinCenteredPosX = (uDesktopWidth - uTotalWinWidth) / 2; - uint uWinCenteredPosY = (uDesktopHeight - uTotalWinHeight) / 2; - - uWindowX = ReadWindowsRegistryInt("window X", uWinCenteredPosX); - uWindowX = uDesktopWidth / 2 - 640 / 2; - WriteWindowsRegistryInt("window X", uWindowX); - - uWindowY = ReadWindowsRegistryInt("window Y", uWinCenteredPosY); - uWindowY = uDesktopHeight / 2 - 480 / 2; - WriteWindowsRegistryInt("window Y", uWindowY); - hWnd = CreateWindowExW(0, wcxw.lpszClassName, L"Might and MagicŪ VII", - uWindowStyle = WS_SYSMENU | WS_GROUP | WS_DLGFRAME | WS_BORDER, - uWindowX, uWindowY, - 640, 480, + WS_SYSMENU | WS_GROUP | WS_DLGFRAME | WS_BORDER, + 0, 0, + 1, 1, nullptr, nullptr, wcxw.hInstance, @@ -4485,7 +4496,10 @@ } } } + SetMenu(hWnd, menu); + CenterWindowAndAdjustSize(hWnd, game_width, game_height); + ShowWindow(hWnd, SW_SHOWNORMAL); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); @@ -4503,7 +4517,7 @@ uint uLevelOfDetail = ReadWindowsRegistryInt("Detail Level", 1); uint bTinting = ReadWindowsRegistryInt("Tinting", 1) != 0; - if (!pRenderer->Initialize(bWindowMode, uDefaultDevice, bColoredLights, uLevelOfDetail, bTinting)) + if (!pRenderer->Initialize(bWindowMode, game_width, game_height, uDefaultDevice, bColoredLights, uLevelOfDetail, bTinting)) { Log::Warning(L"Render failed to initialize"); return false; @@ -4532,18 +4546,7 @@ GameUI_StatusBar_UpdateTimedString(1); pGame = Game::Create(); pMouse = pGame->pMouseInstance; - - - RECT rcWindow; - GetWindowRect(hWnd, &rcWindow); - - RECT rcClient; - GetClientRect(hWnd, &rcClient); - uWindowWidth = rcClient.left - rcClient.right - rcWindow.left + rcWindow.right + 640; - uWindowHeight = rcClient.top - rcClient.bottom - rcWindow.top + rcWindow.bottom + 480; - MoveWindow(hWnd, uWindowX, uWindowY, - rcClient.left - rcClient.right - rcWindow.left + rcWindow.right + 640, - rcClient.top - rcClient.bottom - rcWindow.top + rcWindow.bottom + 480, 0); + pIcons_LOD = new LODFile_IconsBitmaps; if (!pIcons_LOD->Load("data\\icons.lod", "icons")) @@ -4858,7 +4861,6 @@ break; } - ShowWindow(hWnd, SW_SHOWNORMAL); return true; } @@ -5065,7 +5067,7 @@ assert(sizeof(MonsterInfo) == 0x58); assert(sizeof(MonsterStats) == 0x5BA0); assert(sizeof(RenderD3D) == 0x148); - assert(sizeof(Render) == 0x129844); +// assert(sizeof(Render) == 0x129844); assert(sizeof(Player) == 0x1B3C); assert(sizeof(Party_stru0) == 0x678); assert(sizeof(Party) == 0x16238); @@ -5153,7 +5155,7 @@ uCPUSpeed = 2048; // about 2GHz - if (!MM7_Initialize()) + if (!MM7_Initialize(640, 480)) { Log::Warning(L"MM init: failed"); pGame->Deinitialize(); diff -r 014eb02bd0e6 -r 4bbb80c7dba7 mm7_3.cpp --- a/mm7_3.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/mm7_3.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -794,22 +794,22 @@ else v7 = pEventTimer->dt_in_some_format; - v8 = fixpoint_sub0(v7, speed) - v2->field_70; // speed * dt - something + v8 = fixpoint_mul(v7, speed) - v2->field_70; // speed * dt - something v2->field_6C = v8; if ( v8 > 0 ) { - v10 = fixpoint_sub0(v8, v2->direction.x) + v2->normal.x; + v10 = fixpoint_mul(v8, v2->direction.x) + v2->normal.x; v2->field_4C = v10; v2->normal2.x = v10; - v11 = fixpoint_sub0(v2->field_6C, v2->direction.y) + v2->normal.y; + v11 = fixpoint_mul(v2->field_6C, v2->direction.y) + v2->normal.y; v2->field_50 = v11; v2->normal2.y = v11; - v2->normal2.z = fixpoint_sub0(v2->field_6C, v2->direction.z) + v2->normal.z; + v2->normal2.z = fixpoint_mul(v2->field_6C, v2->direction.z) + v2->normal.z; v12 = v2->position.z; v13 = v2->normal.x; v14 = v2->normal2.x; v15 = v2->prolly_normal_d; - v16 = v12 + fixpoint_sub0(v2->field_6C, v2->direction.z); + v16 = v12 + fixpoint_mul(v2->field_6C, v2->direction.z); v28 = v16; v2->field_54 = v16; v17 = v13; @@ -991,21 +991,21 @@ if ( v8 > 1000 ) v8 = 1000; - v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v0->uYawAngle), v8); - v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v0->uYawAngle), v8); + v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v0->uYawAngle), v8); + v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v0->uYawAngle), v8); if ( uIsFlying ) { - v0->vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(v0->uPitchAngle), v8); + v0->vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(v0->uPitchAngle), v8); } //v7 = v68; } else { - v0->vVelocity.x = fixpoint_sub0(55000, v0->vVelocity.x); - v0->vVelocity.y = fixpoint_sub0(55000, v0->vVelocity.y); + v0->vVelocity.x = fixpoint_mul(55000, v0->vVelocity.x); + v0->vVelocity.y = fixpoint_mul(55000, v0->vVelocity.y); if ( uIsFlying ) { - v0->vVelocity.z = fixpoint_sub0(55000, v0->vVelocity.z); + v0->vVelocity.z = fixpoint_mul(55000, v0->vVelocity.z); } } if ( v0->vPosition.z < v5 ) @@ -1028,9 +1028,9 @@ v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; int v73 = abs(v62.x * v0->vVelocity.x + v62.z * v0->vVelocity.z + v62.y * v0->vVelocity.y) >> 16; //v72b = v21; - v0->vVelocity.x += fixpoint_sub0(v73, v62.x); - v0->vVelocity.y += fixpoint_sub0(v73, v62.y); - v0->vVelocity.z += fixpoint_sub0(v73, v62.z); + v0->vVelocity.x += fixpoint_mul(v73, v62.x); + v0->vVelocity.y += fixpoint_mul(v73, v62.y); + v0->vVelocity.z += fixpoint_mul(v73, v62.z); //v17 = 0; } } @@ -1097,7 +1097,7 @@ } v71 = i > 1; if ( stru_721530.field_7C < stru_721530.field_6C ) - v70 = fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); + v70 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); //v34 = 0; v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; v36 = ODM_GetFloorLevel(stru_721530.normal2.x, @@ -1130,12 +1130,12 @@ v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; break; } - //v72b = fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.x); - v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); + //v72b = fixpoint_mul(stru_721530.field_7C, stru_721530.field_58.x); + v0->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; - v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); + v0->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; - v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); + v0->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); v38 = stru_721530.uFaceID; stru_721530.field_70 += stru_721530.field_7C; v39 = PID_ID(v38); @@ -1193,8 +1193,8 @@ v0->vPosition.x - pLevelDecorations[v39].vPosition.x, v0->vPosition.y - pLevelDecorations[v39].vPosition.y); v49 = v48; - v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v48), v47); - v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v48), v47); + v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v48), v47); + v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v48), v47); break; case OBJECT_BModel: v40 = &pOutdoor->pBModels[v38 >> 9]; @@ -1221,9 +1221,9 @@ if ( (stru_721530.speed >> 3) > v72b ) v72b = stru_721530.speed >> 3; - v0->vVelocity.x += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.x); - v0->vVelocity.y += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.y); - v0->vVelocity.z += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.z); + v0->vVelocity.x += fixpoint_mul(v72b, v41->pFacePlane.vNormal.x); + v0->vVelocity.y += fixpoint_mul(v72b, v41->pFacePlane.vNormal.y); + v0->vVelocity.z += fixpoint_mul(v72b, v41->pFacePlane.vNormal.z); if ( v42 != 4 ) { v45 = v0->vPosition.z; @@ -1245,9 +1245,9 @@ break; } - v0->vVelocity.x = fixpoint_sub0(58500, v0->vVelocity.x); - v0->vVelocity.y = fixpoint_sub0(58500, v0->vVelocity.y); - v0->vVelocity.z = fixpoint_sub0(58500, v0->vVelocity.z); + v0->vVelocity.x = fixpoint_mul(58500, v0->vVelocity.x); + v0->vVelocity.y = fixpoint_mul(58500, v0->vVelocity.y); + v0->vVelocity.z = fixpoint_mul(58500, v0->vVelocity.z); ++v69; if ( v69 >= 100 ) @@ -1696,37 +1696,37 @@ break; case PARTY_StrafeLeft: - v2 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); - v1 += fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); + v2 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); + v1 += fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); v78 = 1; break; case PARTY_StrafeRight: - v2 += fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); - v1 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); + v2 += fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); + v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); v78 = 1; break; case PARTY_WalkForward: - v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier); - v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier); + v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier); + v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier); v78 = 1; break; case PARTY_WalkBackward: - v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); - v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); + v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); + v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); v78 = 1; break; case PARTY_RunForward: - v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier); - v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier); + v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier); + v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier); v72 = 1; break; case PARTY_RunBackward: //v32 = stru_5C6E00->SinCos(angle); //v33 = (double)v81; //v88 = (double)v81; - v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); + v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); + v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); v72 = 1; break; case PARTY_LookUp: @@ -2693,10 +2693,10 @@ } else { - _angle_x = pX + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); - _angle_y = pY + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); - pModel = (BSPModel *)fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); - v40 = fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z) + pZ; + _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); + _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); + pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); + v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ; } v122 = v40; ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); @@ -4067,8 +4067,8 @@ v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; //if ( pRenderer->pRenderD3D ) //{ - v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5; - v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6; + v41 = pGame->pIndoorCameraD3D->fRotationYSine * v6 + pGame->pIndoorCameraD3D->fRotationYCosine * v5; + v7 = pGame->pIndoorCameraD3D->fRotationYSine * v5 - pGame->pIndoorCameraD3D->fRotationYCosine * v6; /*} else { @@ -4077,9 +4077,9 @@ }*/ v8 = v7; v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; - v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9; + v10 = pGame->pIndoorCameraD3D->fRotationXCosine * v41 - pGame->pIndoorCameraD3D->fRotationXSine * v9; v11 = v8; - v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41; + v12 = pGame->pIndoorCameraD3D->fRotationXCosine * v9 + pGame->pIndoorCameraD3D->fRotationXSine * v41; } else { @@ -4087,8 +4087,8 @@ v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; //if ( pRenderer->pRenderD3D ) //{ - v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42; - v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39; + v10 = pGame->pIndoorCameraD3D->fRotationYSine * v39 + pGame->pIndoorCameraD3D->fRotationYCosine * v42; + v11 = pGame->pIndoorCameraD3D->fRotationYSine * v42 - pGame->pIndoorCameraD3D->fRotationYCosine * v39; /*} else { @@ -5448,8 +5448,8 @@ v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16); screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16); - v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8; - screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(screen_center_x, pShading) / 8; + v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, pShading) / 8; + screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(screen_center_x, pShading) / 8; //array_50AC10[i].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist; //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0); @@ -5560,7 +5560,7 @@ pWeather->Initialize(); pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; - pODMRenderParams->RotationToInts(); + //pODMRenderParams->RotationToInts(); pOutdoor->UpdateSunlightVectors(); float fov_rad; @@ -5583,9 +5583,7 @@ for (int i = 0; i < 20000; ++i) { array_77EC08[i].ptr_38 = &stru_8019C8; - - array_77EC08[i].prolly_head = nullptr; - array_77EC08[i].prolly_tail = nullptr; + array_77EC08[i].ptr_48 = nullptr; } @@ -5898,9 +5896,9 @@ { stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0); pODMRenderParams->uNumPolygons = 0; - pODMRenderParams->uNumEdges = 0; - pODMRenderParams->uNumSpans = 0; - pODMRenderParams->uNumSurfs = 0; + //pODMRenderParams->uNumEdges = 0; + //pODMRenderParams->uNumSpans = 0; + //pODMRenderParams->uNumSurfs = 0; pODMRenderParams->uNumBillboards = 0; pODMRenderParams->field_44 = 0; } @@ -6067,7 +6065,7 @@ v15 = grid_x2 - a1; v13 = grid_z1 - a2; } - return v14 + v8 + fixpoint_sub0(v13, (v10 - v8) * 128) + fixpoint_sub0(v15, (v9 - v8) * 128); + return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128); } else return y_x1z1; @@ -6145,20 +6143,20 @@ //int v28; // [sp+30h] [bp+8h]@10 //int v29; // [sp+3Ch] [bp+14h]@10 - v25 = pODMRenderParams->camera_rotation_x_int_cosine; - v7 = pODMRenderParams->camera_rotation_y_int_sine; - v27 = pODMRenderParams->camera_rotation_x_int_sine; + v25 = pGame->pIndoorCameraD3D->int_cosine_x; + v7 = pGame->pIndoorCameraD3D->int_sine_y; + v27 = pGame->pIndoorCameraD3D->int_sine_x; //v8 = -pIndoorCamera->pos.y; - v9 = pODMRenderParams->camera_rotation_y_int_cosine; + v9 = pGame->pIndoorCameraD3D->int_cosine_y; //v26 = -pIndoorCamera->pos.z; - v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.x + pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.y; - v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.y - pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.x; + v11 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.x + pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.y; + v24 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.y - pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.x; if (pGame->pIndoorCameraD3D->sRotationX) { - this->field_0_party_dir_x = fixpoint_sub0(v11, pODMRenderParams->camera_rotation_x_int_cosine) + - fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine); + this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) + + fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); this->field_4_party_dir_y = v24; - this->field_8_party_dir_z = fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27); + this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27); } else { @@ -6169,31 +6167,31 @@ if (pGame->pIndoorCameraD3D->sRotationX) { - v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); - - this->field_C = fixpoint_sub0(v17, v25) + fixpoint_sub0(a4, v27); - this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); - this->field_14 = fixpoint_sub0(a4, v25) - fixpoint_sub0(v17, v27); + v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); + + this->field_C = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27); + this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); + this->field_14 = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27); } else { - this->field_C = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); - this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); + this->field_C = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); + this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); this->field_14 = a4; } if (pGame->pIndoorCameraD3D->sRotationX) { - v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7); - - this->field_18 = fixpoint_sub0(v19, v25) + fixpoint_sub0(a7, v27); - this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7); - this->field_20 = fixpoint_sub0(a7, v25) - fixpoint_sub0(v19, v27); + v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); + + this->field_18 = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27); + this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); + this->field_20 = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27); } else { - this->field_18 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7); - this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7); + this->field_18 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); + this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); this->field_20 = a7; } @@ -6455,14 +6453,14 @@ p2DEvents[i].uType = BuildingType_DarkGuild; break; } - if ( !_strnicmp(test_string, "ele", 3) ) + if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6 { - p2DEvents[i].uType = BuildingType_14; + p2DEvents[i].uType = BuildingType_ElementalGuild; break; } if ( !_strnicmp(test_string, "sel", 3) ) { - p2DEvents[i].uType = BuildingType_15; + p2DEvents[i].uType = BuildingType_SelfGuild; break; } if ( !_strnicmp(test_string, "mir", 3) ) @@ -6470,7 +6468,7 @@ p2DEvents[i].uType = BuildingType_16; break; } - if ( !_strnicmp(test_string, "mer", 3) ) + if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6 { p2DEvents[i].uType = BuildingType_TownHall; break; diff -r 014eb02bd0e6 -r 4bbb80c7dba7 mm7_4.cpp --- a/mm7_4.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/mm7_4.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -363,7 +363,7 @@ if ( v9 > 0 ) { v10 = v1->vPosition.z; - v11 = stru_721530.normal.z + fixpoint_sub0(stru_721530.direction.z, v9); + v11 = stru_721530.normal.z + fixpoint_mul(stru_721530.direction.z, v9); if ( v11 >= v10 ) { if ( v11 <= v18 + v10 ) diff -r 014eb02bd0e6 -r 4bbb80c7dba7 mm7_5.cpp --- a/mm7_5.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/mm7_5.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -4476,9 +4476,9 @@ continue; } - v32 = fixpoint_sub0(v29->pFacePlane_old.vNormal.x,v49); - v33 = fixpoint_sub0(v29->pFacePlane_old.vNormal.z,v47); - v34 = fixpoint_sub0(v29->pFacePlane_old.vNormal.y,v48); + v32 = fixpoint_mul(v29->pFacePlane_old.vNormal.x,v49); + v33 = fixpoint_mul(v29->pFacePlane_old.vNormal.z,v47); + v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48); v59 = v32 + v33 + v34; if ( v59 ) { @@ -4504,7 +4504,7 @@ if( abs(v38) >> 14 > abs(v59) ) continue; - v58 = fixpoint_sub2(v38,v59); + v58 = fixpoint_div(v38,v59); if( v58 < 0 ) { @@ -4512,9 +4512,9 @@ } if(!sub_4075DB( - obj1_x + ((fixpoint_sub0(v49,v58) + 32768) >> 16), - obj1_y + ((fixpoint_sub0(v48,v58) + 32768) >> 16), - obj1_z + ((fixpoint_sub0(v47,v58) + 32768) >> 16), + 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; @@ -4637,8 +4637,8 @@ // + 32768) >> 16) >= a4a) ) else { - v25 = fixpoint_sub2(dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i], dword_4F5CC8_ys[i + 1] - dword_4F5CC8_ys[i]); - if( dword_4F5D98_xs[i] + (fixpoint_sub0(v25, (v8 - dword_4F5CC8_ys[i]) << 16) + 32768 >> 16) >= a4a) + 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) ++a3a; } } diff -r 014eb02bd0e6 -r 4bbb80c7dba7 mm7_data.cpp --- a/mm7_data.cpp Wed Sep 18 20:04:30 2013 +0600 +++ b/mm7_data.cpp Wed Sep 18 20:04:49 2013 +0600 @@ -1198,11 +1198,6 @@ float fTurnSpeedMultiplier = 1.0f; // weak float flt_6BE150_look_up_down_dangle = 1.0f; // weak HWND hWnd; // idb -int uWindowWidth; // idb -int uWindowHeight; // idb -int uWindowX; // idb -int uWindowY; // idb -LONG uWindowStyle; // idb int dword_6BE340; // weak char pCurrentMapName[32]; // idb unsigned int uLevelMapStatsID; @@ -1317,7 +1312,7 @@ struct Texture *pTexture_PlayerFaceEradicated; struct Texture *pTexture_PlayerFaceDead; std::array< std::array, 4> pTextures_PlayerFaces; -std::array pPlayers; +NZIArray pPlayers; __int64 qword_A750D8; // weak enum PlayerSpeech PlayerSpeechID; int uSpeakingCharacter; // weak diff -r 014eb02bd0e6 -r 4bbb80c7dba7 mm7_data.h --- a/mm7_data.h Wed Sep 18 20:04:30 2013 +0600 +++ b/mm7_data.h Wed Sep 18 20:04:49 2013 +0600 @@ -3,6 +3,7 @@ #include "VectorTypes.h" #include "OSAPI.h" #include +#include typedef char _UNKNOWN; typedef unsigned int uint; @@ -282,7 +283,44 @@ return uint64(x) > uint64(x+y); } +template +class NZIArray : std::array<_Ty, _Size> +{ +public: + reference ZerothIndex() + { + return std::array<_Ty, _Size>::operator [](0); + } + reference operator[](size_type _Pos) + { // subscript nonmutable sequence +#if _ITERATOR_DEBUG_LEVEL == 2 + assert(_Pos != 0 && "not allowed to access zeroth element"); + +#elif _ITERATOR_DEBUG_LEVEL == 1 + _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); +#endif /* _ITERATOR_DEBUG_LEVEL */ + + __analysis_assume(_Pos != 0); + + return std::array<_Ty, _Size>::operator [](_Pos); + } + + const_reference operator[](size_type _Pos) const + { // subscript nonmutable sequence +#if _ITERATOR_DEBUG_LEVEL == 2 + assert(_Pos != 0 && "not allowed to access zeroth element"); + +#elif _ITERATOR_DEBUG_LEVEL == 1 + _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); +#endif /* _ITERATOR_DEBUG_LEVEL */ + + __analysis_assume(_Pos != 0); + + return std::array<_Ty, _Size>::operator [](_Pos); + } +}; //------------------------------------------------------------------------- // Data declarations @@ -847,11 +885,6 @@ //extern HINSTANCE hInstance; // idb //extern char *pCmdLine; extern HWND hWnd; // idb -extern int uWindowWidth; // idb -extern int uWindowHeight; // idb -extern int uWindowX; // idb -extern int uWindowY; // idb -extern LONG uWindowStyle; // idb extern int dword_6BE340; // weak extern char pCurrentMapName[32]; // idb extern unsigned int uLevelMapStatsID; @@ -975,7 +1008,7 @@ extern struct Texture *pTexture_PlayerFaceDead; extern std::array< std::array, 4> pTextures_PlayerFaces; extern int dword_A75070; // weak -extern std::array pPlayers; +extern NZIArray pPlayers; extern __int64 qword_A750D8; // weak extern enum PlayerSpeech PlayerSpeechID; extern int uSpeakingCharacter; // weak @@ -1137,7 +1170,7 @@ void sub_43B1B0(signed int a1, unsigned int a2, struct Vec3_int_ *pVelocity, signed int a4); void CharacterUI_LoadPaperdollTextures(); int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder); -bool _43ED6F_check_party_races(bool b); +bool IsDwarfPresentInParty(bool b); bool ShouldLoadTexturesForRaceAndGender(unsigned int _this); void WetsuitOn(unsigned int uPlayerID); // idb void WetsuitOff(unsigned int uPlayerID); @@ -1369,6 +1402,7 @@ } //inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);} +void CenterWindowAndAdjustSize(HWND hwnd, int client_width, int client_height); #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)