diff mm7_5.cpp @ 1025:8b492d4722d4

Intersection
author Ritor1
date Tue, 21 May 2013 12:42:57 +0600
parents 54f74d2c894f
children 6afa77761a00
line wrap: on
line diff
--- a/mm7_5.cpp	Wed May 15 09:32:39 2013 +0600
+++ b/mm7_5.cpp	Tue May 21 12:42:57 2013 +0600
@@ -47,7 +47,7 @@
 void __cdecl GameUI_MsgProc()
 {
   //signed int v0; // edi@6
-  char *v1; // esi@6
+  //char *v1; // esi@6
   unsigned int v2; // edx@7
   Actor *pActor; // ecx@13
   int v4; // ecx@18
@@ -280,7 +280,7 @@
   }
   if ( pMessageQueue_50CBD0->uNumMessages )
   {
-    v1 = "";
+    //v1 = "";
     while ( 2 )
     {
       if ( !pMessageQueue_50CBD0->uNumMessages )
@@ -549,48 +549,48 @@
           pGUIWindow_CurrentMenu->CreateButton(22, 270,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
-                                               1, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0);
+                                               1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(93, 270,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight,
-                                               1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0);
+                                               1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(164, 270,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight,
-                                               1, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0);
+                                               1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0);
 
           pGUIWindow_CurrentMenu->CreateButton(20, 303,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight,
-                                               1, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0);
+                                               1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(128, 303,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight,
-                                               1, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0);
+                                               1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(20, 325,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight,
-                                               1, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0);
+                                               1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(128, 325,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth,
                                                pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight,
-                                               1, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0);
-
-          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
-          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
-          pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0);
-
-          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
-          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
-          pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0);
-
-          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
-          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
-          pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0);
+                                               1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0);
+
+          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
+          pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0);
+
+          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
+          pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0);
+
+          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
+          pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0);
 
           pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game"
-          pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0);
-          pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0);
           continue;
 
         case UIMSG_OpenKeyMappingOptions://Open
@@ -629,7 +629,7 @@
           memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
           //*(_WORD *)KeyButtonArray[28] = 0;
           memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
-          v1 = "";
+          //v1 = "";
           //v0 = 1;
           continue;
         case UIMSG_ChangeKeyButton:
@@ -706,21 +706,21 @@
           uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE);
           uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0);
           if ( pRenderer->pRenderD3D )
           {
-            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0);
-            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0);
-            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, v1, 0);
+            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0);
+            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0);
+            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0);
           }
           if ( !pRenderer->bWindowMode )
           {
             //v0 = 1;
             if ( GammaController::IsGammaSupported() )
             {
-              pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C20), 0);
-              pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C24), 0);
-              pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, v1, 0);
+              pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0);
+              pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0);
+              pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0);
             }
           }
           continue;
@@ -2294,10 +2294,7 @@
             pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2);
             v70 = atoi(v216.pProperties[0]);
             if ( v70 <= 0 || v70 >= 77 )
-            {
-              v1 = "";
               continue;
-            }
             v71 = v70;
             strcpy(Str2, pMapStats->pInfos[v70].pFilename);
             pNPCData3 = 0;
@@ -2318,7 +2315,6 @@
                 dword_6BE364_game_settings_1 |= 1u;
                 uGameState = GAME_STATE_2;
                 OnMapLeave();
-                v1 = "";
                 continue;
               }
             }
@@ -2328,10 +2324,7 @@
           else
           {
             if ( v216.uPropCount != 3 )
-            {
-              v1 = "";
               continue;
-            }
             v74 = atoi(v216.pProperties[0]);
             thisi = atoi(v216.pProperties[1]);
             v75 = atoi(v216.pProperties[2]);
@@ -2345,7 +2338,6 @@
                 pParty->vPosition.y = v77;
                 pParty->vPosition.z = v76;
                 pParty->uFallStartY = v76;
-                v1 = "";
                 continue;
               }
             }
@@ -2364,7 +2356,6 @@
                       pParty->vPosition.y = v77;
                       pParty->vPosition.z = v76;
                       pParty->uFallStartY = v76;
-                      v1 = "";
                       continue;
                     }
                   }
@@ -2375,7 +2366,6 @@
             v73 = "Can't jump to that location!";
           }
           ShowStatusBarString(v73, 6u);
-          v1 = "";
           continue;
         case UIMSG_CastQuickSpell:
           if ( bUnderwater == 1 )
@@ -2385,10 +2375,7 @@
             continue;
           }
           if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
-          {
-            v1 = "";
             continue;
-          }
           _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
           continue;
         case UIMSG_CastSpell_Monster_Improvement:
@@ -2407,10 +2394,7 @@
           v44 = (unsigned __int16)v81;
           v84 = v83 >> 16;
           if ( PID_TYPE(v44) != 3 || v84 >= 5120 )
-          {
-            v1 = "";
             continue;
-          }
           pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
           if ( uMessage == UIMSG_CastSpell_Shoot_Monster )
           {
@@ -2436,10 +2420,7 @@
         case UIMSG_1C:
 			__debugbreak();
           if ( !uActiveCharacter || pCurrentScreen )
-          {
-            v1 = "";
             continue;
-          }
           ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0);
           pCurrentScreen = SCREEN_19;
           pEventTimer->Pause();
@@ -2447,10 +2428,7 @@
         case UIMSG_1B:
 			__debugbreak();
           if ( !uActiveCharacter )
-          {
-            v1 = "";
             continue;
-          }
           if ( pParty->bTurnBasedModeOn != 1 )
           {
             if ( pActors[uMessageParam].uAIState == 5 )
@@ -2460,10 +2438,7 @@
             continue;
           }
           if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
-          {
-            v1 = "";
             continue;
-          }
           if ( !(pTurnEngine->field_18 & 2) )
           {
             if ( pActors[uMessageParam].uAIState == 5 )
@@ -2475,20 +2450,14 @@
 
         case UIMSG_Attack:
           if ( !uActiveCharacter )
-          {
-            v1 = "";
             continue;
-          }
           if ( pParty->bTurnBasedModeOn != 1 )
           {
             _42ECB5_PlayerAttacksActor();
             continue;
           }
           if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
-          {
-            v1 = "";
             continue;
-          }
           if ( !(pTurnEngine->field_18 & 2) )
             _42ECB5_PlayerAttacksActor();
           continue;
@@ -2551,10 +2520,7 @@
               v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
             ShowStatusBarString(v88, 2);
             if ( !uActiveCharacter )
-            {
-              v1 = "";
               continue;
-            }
             pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
             continue;
           }
@@ -2578,10 +2544,7 @@
             v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
           ShowStatusBarString(v88, 2u);
           if ( !uActiveCharacter )
-          {
-            v1 = "";
             continue;
-          }
           pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
           continue;
         case UIMSG_Rest8Hour:
@@ -2942,7 +2905,7 @@
           pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0,
                          pGlobalTXT_LocalizationStrings[64],// "Detail Toggle"
                          0);
-          pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, v1, 0);
+          pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);
           viewparams->bRedrawGameUI = 1;
           continue;
         case UIMSG_ClickPaperdoll:
@@ -3664,15 +3627,9 @@
 //----- (004369DB) --------------------------------------------------------
 void Vec3_float_::Normalize()
 {
-  Vec3_float_ *v1; // esi@1
-  double v2; // st7@1
-
-  auto a1 = this;
-  v1 = a1;
-  v2 = 1.0 / sqrt(a1->x * a1->x + a1->y * a1->y + a1->z * a1->z);
-  v1->x = v2 * v1->x;
-  v1->y = v2 * v1->y;
-  v1->z = v2 * v1->z;
+  this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x;
+  this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y;
+  this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z;
 }
 
 //----- (004385B5) --------------------------------------------------------
@@ -5396,41 +5353,32 @@
   int v8; // ST14_4@1
   int v9; // edi@1
   int anglea; // [sp+20h] [bp+8h]@1
+
   v7 = sRotX;
   v8 = sDepth;
   v9 = sRotY;
   anglea = (unsigned __int64)(stru_5C6E00->SinCos(sRotX) * (signed __int64)sDepth) >> 16;
-  *outx = v.x + ((unsigned __int64)(stru_5C6E00->SinCos(v9) * (signed __int64)anglea) >> 16);
-  *outy = v.y
-        + ((unsigned __int64)(stru_5C6E00->SinCos(v9 - stru_5C6E00->uIntegerHalfPi)
-                            * (signed __int64)anglea) >> 16);
-  *outz = v.z
-        + ((unsigned __int64)(stru_5C6E00->SinCos(v7 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)v8) >> 16);*/
+  *outx = v.x + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY) * (signed __int64)anglea) >> 16);
+  *outy = v.y + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY - stru_5C6E00->uIntegerHalfPi) * (signed __int64)anglea) >> 16);
+  *outz = v.z + ((unsigned __int64)(stru_5C6E00->SinCos(sRotX - stru_5C6E00->uIntegerHalfPi) * (signed __int64)sDepth) >> 16);*/
 
  float cosf_x = cosf(3.14159265f * sRotX / 1024.0f),
+       sinf_x = sinf(3.14159265f * sRotX / 1024.0f),
        cosf_y = cosf(3.14159265f * sRotY / 1024.0f),
-       sinf_x = sinf(3.14159265f * sRotX / 1024.0f),
        sinf_y = sinf(3.14159265f * sRotY / 1024.0f);
-
- *outx = v.x + ((unsigned __int64)((double)sDepth * cosf_y * cosf_x) >> 16);
- *outy = v.y + ((unsigned __int64)((double)sDepth * sinf_y * cosf_x) >> 16);
- *outz = v.z + ((unsigned __int64)((double)sDepth * sinf_x) >> 16);
+ sDepth = 14000000;
+ *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
+ *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
+ *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16);
 
 }
 
 //----- (0043AB61) --------------------------------------------------------
 void Vec3_int_::Normalize(int *x, int *y, int *z)
 {
-  int *v3; // edi@1
-  int *v4; // esi@1
-  signed int v5; // eax@1
-
-  v3 = x;
-  v4 = y;
-  v5 = integer_sqrt(*y * *y + *z * *z + *x * *x);
-  *v3 *= 65536 / (v5 | 1);
-  *v4 *= 65536 / (v5 | 1);
-  *z *= 65536 / (v5 | 1);
+  *x *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1);
+  *y *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1);
+  *z *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1);
 }
 
 //----- (0043AE12) --------------------------------------------------------