# HG changeset patch
# User Ritor1
# Date 1391599478 -21600
# Node ID db94443ea4e726ca3f59ee16b30cb555fe93ba54
# Parent 23e7c7299ea86978d684dcac9c87efeff76d5043
_44100D_should_alter_right_panel()
diff -r 23e7c7299ea8 -r db94443ea4e7 Build/Visual Studio 2010/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Wed Feb 05 00:59:33 2014 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Wed Feb 05 17:24:38 2014 +0600
@@ -402,6 +402,7 @@
+
diff -r 23e7c7299ea8 -r db94443ea4e7 Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Wed Feb 05 00:59:33 2014 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Wed Feb 05 17:24:38 2014 +0600
@@ -501,6 +501,7 @@
lib\OpenAL
+
diff -r 23e7c7299ea8 -r db94443ea4e7 Game.cpp
--- a/Game.cpp Wed Feb 05 00:59:33 2014 +0600
+++ b/Game.cpp Wed Feb 05 17:24:38 2014 +0600
@@ -185,7 +185,7 @@
GameUI_DrawPortraits(v4);
GameUI_DrawLifeManaBars();
GameUI_DrawCharacterSelectionFrame();
- if ( sub_44100D() )
+ if ( _44100D_should_alter_right_panel() )
GameUI_DrawRightPanel();
if ( !pVideoPlayer->AnyMovieLoaded() )
{
diff -r 23e7c7299ea8 -r db94443ea4e7 Indoor.cpp
--- a/Indoor.cpp Wed Feb 05 00:59:33 2014 +0600
+++ b/Indoor.cpp Wed Feb 05 17:24:38 2014 +0600
@@ -4428,7 +4428,7 @@
int v35; // eax@39
int v36; // ebx@39
int v37; // edx@41
- char *v38; // edi@51
+ //char *v38; // edi@51
ODMFace *odm_face; // esi@54
int v40; // ebx@60
int v41; // eax@61
@@ -4493,8 +4493,8 @@
int v101; // [sp-8h] [bp-84h]@126
int v102; // [sp-4h] [bp-80h]@88
int v103; // [sp-4h] [bp-80h]@126
- int v104; // [sp+Ch] [bp-70h]@13
- int v105; // [sp+Ch] [bp-70h]@48
+ //int v104; // [sp+Ch] [bp-70h]@13
+ //int v105; // [sp+Ch] [bp-70h]@48
int v106; // [sp+10h] [bp-6Ch]@18
int v107; // [sp+10h] [bp-6Ch]@98
int v108; // [sp+10h] [bp-6Ch]@104
@@ -4546,11 +4546,11 @@
int sDeptha; // [sp+58h] [bp-24h]@52
int sDepthb; // [sp+58h] [bp-24h]@90
char *a5; // [sp+5Ch] [bp-20h]@16
- char *a5a; // [sp+5Ch] [bp-20h]@51
+ //char *a5a; // [sp+5Ch] [bp-20h]@51
signed int a5b; // [sp+5Ch] [bp-20h]@83
signed int a5c; // [sp+5Ch] [bp-20h]@121
- signed int v160; // [sp+60h] [bp-1Ch]@12
- signed int v161; // [sp+60h] [bp-1Ch]@47
+ //signed int v160; // [sp+60h] [bp-1Ch]@12
+ //signed int v161; // [sp+60h] [bp-1Ch]@47
int v162; // [sp+60h] [bp-1Ch]@128
int v163; // [sp+64h] [bp-18h]@2
int outx; // [sp+68h] [bp-14h]@2
@@ -4579,7 +4579,7 @@
v97.x = x;
v97.y = z;
v113 = 0;
- a4_8 = v4;
+ a4_8 = stru_5C6E00->Atan2(v.x - x, v.y - z);
if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
{
Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz);
@@ -4931,95 +4931,68 @@
v133 = v163;
v129 = outz;
}
- v160 = 0;
- if ( (signed int)pOutdoor->uNumBModels > 0 )
+ for ( uint model_id = 0; model_id < pOutdoor->uNumBModels; model_id++)
{
- v104 = 0;
- while ( 1 )
+ if ( sub_4088E9(pOut.x, pOut.y, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y)
+ <= pOutdoor->pBModels[model_id].sBoundingRadius + 128 )
{
- v15 = (char *)&pOutdoor->pBModels[v104].pVertices;
- a5 = (char *)&pOutdoor->pBModels[v104].pVertices;
- if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 )
+ for ( uint face_id = 0; face_id < pOutdoor->pBModels[model_id].uNumFaces; ++face_id )
{
- sDepth = 0;
- if ( *((int *)v15 + 2) > 0 )
- break;
- }
-LABEL_36:
- ++v160;
- ++v104;
- if ( v160 >= (signed int)pOutdoor->uNumBModels )
- goto LABEL_37;
- v14 = outy;
- v13 = pOut.x;
- }
- v106 = 0;
- while ( 1 )
- {
- odm_face = (ODMFace *)(v106 + *((int *)a5 + 4));
- if ( v149 > odm_face->pBoundingBox.x2
- || v145 < odm_face->pBoundingBox.x1
- || v141 > odm_face->pBoundingBox.y2
- || v137 < odm_face->pBoundingBox.y1
- || v133 > odm_face->pBoundingBox.z2
- || v129 < odm_face->pBoundingBox.z1
- || (v17 = fixpoint_mul(v125, odm_face->pFacePlane.vNormal.x),
- v18 = fixpoint_mul(v121, odm_face->pFacePlane.vNormal.y),
- v19 = fixpoint_mul(v117, odm_face->pFacePlane.vNormal.z),
- v20 = v17 + v18 + v19 == 0,
- v21 = v17 + v18 + v19,
- v109 = v17 + v18 + v19,
- v20) )
- goto LABEL_33;
- //v22 = pOut.y * odm_face->pFacePlane.vNormal.y;
- v23 = -(odm_face->pFacePlane.dist + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z
- + pOut.x * odm_face->pFacePlane.vNormal.x);
- if ( v21 <= 0 )
- {
- if ( odm_face->pFacePlane.dist + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z
- + pOut.x * odm_face->pFacePlane.vNormal.x < 0 )
- goto LABEL_33;
- }
- else
- {
- if ( odm_face->pFacePlane.dist + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z
- + pOut.x * odm_face->pFacePlane.vNormal.x > 0 )
- goto LABEL_33;
- }
- v24 = abs(-(odm_face->pFacePlane.dist + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z
- + pOut.x * odm_face->pFacePlane.vNormal.x)) >> 14;
- if ( v24 <= abs(v21) )
- {
- //LODWORD(v25) = v23 << 16;
- //HIDWORD(v25) = v23 >> 16;
- //v26 = v25 / v109;
- //v110 = v25 / v109;
- v110 = fixpoint_div(v23, v109);
- if ( v110 >= 0 )
+ odm_face = &pOutdoor->pBModels[model_id].pFaces[face_id];
+ v17 = fixpoint_mul(v125, odm_face->pFacePlane.vNormal.x);
+ v18 = fixpoint_mul(v121, odm_face->pFacePlane.vNormal.y);
+ v19 = fixpoint_mul(v117, odm_face->pFacePlane.vNormal.z);
+ v20 = v17 + v18 + v19;
+ v21 = v17 + v18 + v19;
+ v109 = v17 + v18 + v19;
+ if ( v149 > odm_face->pBoundingBox.x2 || v145 < odm_face->pBoundingBox.x1
+ || v141 > odm_face->pBoundingBox.y2 || v137 < odm_face->pBoundingBox.y1
+ || v133 > odm_face->pBoundingBox.z2 || v129 < odm_face->pBoundingBox.z1
+ || !v20 )
+ continue;
+ v23 = -(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z);
+ if ( v21 <= 0 )
+ {
+ if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z < 0 )
+ continue;
+ }
+ else
{
- if ( sub_4077F1(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),
- odm_face,
- (BSPVertexBuffer *)a5) )
+ if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z > 0 )
+ continue;
+ }
+ v24 = abs(-(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z)) >> 14;
+ if ( v24 <= abs(v21) )
+ {
+ //LODWORD(v25) = v23 << 16;
+ //HIDWORD(v25) = v23 >> 16;
+ //v26 = v25 / v109;
+ //v110 = v25 / v109;
+ v110 = fixpoint_div(v23, v109);
+ if ( v110 >= 0 )
{
- v114 = 1;
- goto LABEL_36;
+ if ( sub_4077F1(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),
+ odm_face,
+ &pOutdoor->pBModels[model_id].pVertices) )
+ {
+ v114 = 1;
+ break;
+ }
}
}
}
-LABEL_33:
- ++sDepth;
- v106 += 308;
- if ( sDepth >= *((int *)a5 + 2) )
- goto LABEL_36;
}
}
-LABEL_37:
v27.z = y;
v27.x = x;
v27.y = z;
@@ -5066,84 +5039,66 @@
v134 = v163;
v130 = outz;
}
- //v161 = 0;
- if ( (signed int)pOutdoor->uNumBModels > 0 )
+
+ for ( uint model_id = 0; model_id < (signed int)pOutdoor->uNumBModels; ++model_id )
{
- v105 = 0;
- //while ( 1 )
- for ( v161 = 0; v161 < (signed int)pOutdoor->uNumBModels; ++v161 )
+ if ( sub_4088E9(pOut.x, pOut.y, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y)
+ <= pOutdoor->pBModels[model_id].sBoundingRadius + 128 )
{
- v38 = (char *)&pOutdoor->pBModels[v105].pVertices;
- a5a = (char *)&pOutdoor->pBModels[v105].pVertices;
- if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 )
+ for ( uint face_id = 0; face_id < pOutdoor->pBModels[model_id].uNumFaces; ++face_id )
{
-
- if ( *((int *)v38 + 2) > 0 )
- {
- //v_8 = 0;
- //while ( 1 )
- for ( sDeptha = 0; sDeptha < *((int *)a5a + 2); ++sDeptha )
+ odm_face = &pOutdoor->pBModels[model_id].pFaces[face_id];
+ ya = fixpoint_mul(v126, odm_face->pFacePlane.vNormal.x);
+ ve = fixpoint_mul(v122, odm_face->pFacePlane.vNormal.y);
+ v_4 = fixpoint_mul(v118, odm_face->pFacePlane.vNormal.z);
+ v20 = ya + ve + v_4;
+ v40 = ya + ve + v_4;
+ va = ya + ve + v_4;
+ if ( v150 > odm_face->pBoundingBox.x2 || v146 < odm_face->pBoundingBox.x1
+ || v142 > odm_face->pBoundingBox.y2 || v138 < odm_face->pBoundingBox.y1
+ || v134 > odm_face->pBoundingBox.z2 || v130 < odm_face->pBoundingBox.z1
+ || !v20 )
+ continue;
+ v42 = -(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z);
+ if ( v40 <= 0 )
+ {
+ if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z < 0 )
+ continue;
+ }
+ else
+ {
+ if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z > 0 )
+ continue;
+ }
+ v_4a = abs(-(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
+ + pOut.y * odm_face->pFacePlane.vNormal.y
+ + outz * odm_face->pFacePlane.vNormal.z )) >> 14;
+ if ( v_4a <= abs(v40) )
+ {
+ //LODWORD(v43) = v42 << 16;
+ //HIDWORD(v43) = v42 >> 16;
+ //vb = v43 / va;
+ vb = fixpoint_div(v42, va);
+ if ( vb >= 0 )
{
- odm_face = &pOutdoor->pBModels[v105].pFaces[sDeptha];
- if ( v150 > odm_face->pBoundingBox.x2
- || v146 < odm_face->pBoundingBox.x1
- || v142 > odm_face->pBoundingBox.y2
- || v138 < odm_face->pBoundingBox.y1
- || v134 > odm_face->pBoundingBox.z2
- || v130 < odm_face->pBoundingBox.z1
- || (ya = fixpoint_mul(v126, odm_face->pFacePlane.vNormal.x),
- ve = fixpoint_mul(v122, odm_face->pFacePlane.vNormal.y),
- v_4 = fixpoint_mul(v118, odm_face->pFacePlane.vNormal.z),
- v20 = ya + ve + v_4 == 0,
- v40 = ya + ve + v_4,
- va = ya + ve + v_4,
- v20) )
- goto LABEL_68;
- v41 = pOut.y * odm_face->pFacePlane.vNormal.y;
- v42 = -(odm_face->pFacePlane.dist + v41 + outz * odm_face->pFacePlane.vNormal.z + pOut.x * odm_face->pFacePlane.vNormal.x);
- if ( v40 <= 0 )
+ if ( sub_4077F1(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),
+ odm_face,
+ &pOutdoor->pBModels[model_id].pVertices) )
{
- if ( odm_face->pFacePlane.dist + v41 + outz * odm_face->pFacePlane.vNormal.z + pOut.x * odm_face->pFacePlane.vNormal.x < 0 )
- goto LABEL_68;
- }
- else
- {
- if ( odm_face->pFacePlane.dist + v41 + outz * odm_face->pFacePlane.vNormal.z + pOut.x * odm_face->pFacePlane.vNormal.x > 0 )
- goto LABEL_68;
- }
- v_4a = abs(-(odm_face->pFacePlane.dist + v41 + outz * odm_face->pFacePlane.vNormal.z + pOut.x * odm_face->pFacePlane.vNormal.x)) >> 14;
- if ( v_4a <= abs(v40) )
- {
- //LODWORD(v43) = v42 << 16;
- //HIDWORD(v43) = v42 >> 16;
- //vb = v43 / va;
- vb = fixpoint_div(v42, va);
- if ( vb >= 0 )
- {
- if ( sub_4077F1(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),
- odm_face,
- (BSPVertexBuffer *)a5a) )
- {
- v113 = 1;
- goto LABEL_71;
- }
- }
- }
-LABEL_68:
- ;
- //++sDeptha;
- //v_8 += 308;
- //if ( sDeptha >= *((int *)a5a + 2) )
- //goto LABEL_71;
+ v113 = 1;
+ break;
+ }
}
- }
+ }
}
-LABEL_71:
- ++v105;
- v37 = outy;
- v36 = pOut.x;
}
}
diff -r 23e7c7299ea8 -r db94443ea4e7 UI/UiGame.cpp
--- a/UI/UiGame.cpp Wed Feb 05 00:59:33 2014 +0600
+++ b/UI/UiGame.cpp Wed Feb 05 17:24:38 2014 +0600
@@ -980,7 +980,7 @@
if ( uGameState != GAME_STATE_FINAL_WINDOW )
{
- text_y = sub_44100D() != 0 ? 381 : 322;
+ text_y = _44100D_should_alter_right_panel() != 0 ? 381 : 322;
sprintf(pTmpBuf.data(), "\r087%lu", pParty->uNumFoodRations);
pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
sprintf(pTmpBuf.data(), "\r028%lu", pParty->uNumGold);
diff -r 23e7c7299ea8 -r db94443ea4e7 mm7_3.cpp
--- a/mm7_3.cpp Wed Feb 05 00:59:33 2014 +0600
+++ b/mm7_3.cpp Wed Feb 05 17:24:38 2014 +0600
@@ -43,6 +43,16 @@
#include "MM7.h"
+
+//----- (0044100D) --------------------------------------------------------
+bool _44100D_should_alter_right_panel()
+{
+ return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
+ pCurrentScreen == SCREEN_HOUSE || pCurrentScreen == SCREEN_E ||
+ pCurrentScreen == SCREEN_CHANGE_LOCATION || pCurrentScreen == SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
+}
+
+
//----- (0046E44E) --------------------------------------------------------
int _46E44E_collide_against_faces_and_portals(unsigned int b1)
{
@@ -3311,14 +3321,6 @@
this->viewing_angle_from_north_south, this->field_8_party_dir_z);
}
-//----- (0044100D) --------------------------------------------------------
-bool sub_44100D()
-{
- return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
- pCurrentScreen == SCREEN_HOUSE || pCurrentScreen == SCREEN_E ||
- pCurrentScreen == SCREEN_CHANGE_LOCATION || pCurrentScreen == SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
-}
-// 4E28F8: using guessed type int pCurrentScreen;
//----- (00441A4E) --------------------------------------------------------
__int16 __fastcall sub_441A4E(int a1)//for blessing
diff -r 23e7c7299ea8 -r db94443ea4e7 mm7_5.cpp
--- a/mm7_5.cpp Wed Feb 05 00:59:33 2014 +0600
+++ b/mm7_5.cpp Wed Feb 05 17:24:38 2014 +0600
@@ -60,7 +60,7 @@
int attacker_id; // [sp+10h] [bp-18h]@1
int v44; // [sp+14h] [bp-14h]@15
//Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2
- int a1; // [sp+20h] [bp-8h]@8
+ signed int a1; // [sp+20h] [bp-8h]@8
int v48; // [sp+24h] [bp-4h]@8
@@ -157,19 +157,19 @@
{
if ( pActors[actorID].CanAct() )
{
- v30 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
+ //v30 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
a1 = pActors[actorID].vPosition.x - AttackerInfo.pXs[attacker_id];
v31 = pActors[actorID].vPosition.z;
- v48 = v30;
+ v48 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
v44 = pActors[actorID].vPosition.z;
- v32 = (pActors[actorID].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id];
+ v32 = (pActors[actorID].uActorHeight / 2) - AttackerInfo.pZs[attacker_id];
v33 = pActors[actorID].uActorRadius + AttackerInfo.pYs[attacker_id];
if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) )
{
attacker_coord.x = AttackerInfo.pXs[attacker_id];
attacker_coord.y = AttackerInfo.pYs[attacker_id];
attacker_coord.z = AttackerInfo.pZs[attacker_id];
- if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, attacker_coord) )
+ if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, attacker_coord) )//что делает ф-ция?
{
Vec3_int_::Normalize(&a1, &v48, &v44);
AttackerInfo.vec_4B4[attacker_id].x = a1;
diff -r 23e7c7299ea8 -r db94443ea4e7 mm7_unsorted_subs.h
--- a/mm7_unsorted_subs.h Wed Feb 05 00:59:33 2014 +0600
+++ b/mm7_unsorted_subs.h Wed Feb 05 17:24:38 2014 +0600
@@ -105,7 +105,7 @@
void PrepareItemsRenderList_BLV();
void AddBspNodeToRenderList(unsigned int node_id);
void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode); // idb
-bool sub_44100D();
+bool _44100D_should_alter_right_panel();
__int16 __fastcall sub_441A4E(int a1);
void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb
void Initialize2DA();