diff mm7_5.cpp @ 1445:6de9c1316852

Слияние
author Ritor1
date Sat, 03 Aug 2013 00:00:31 +0600
parents 71a2cf416478
children 8b4f4c723edd
line wrap: on
line diff
--- a/mm7_5.cpp	Sat Aug 03 00:00:10 2013 +0600
+++ b/mm7_5.cpp	Sat Aug 03 00:00:31 2013 +0600
@@ -112,10 +112,10 @@
   int v56; // edx@432
   int v57; // eax@432
   Player *pPlayer; // edx@442
-  unsigned int v59; // eax@445
+  unsigned int pMapNum; // eax@445
   signed int v60; // ST64_4@459
-  NPCData *pNPCData2; // eax@467
-  unsigned __int64 v62; // kr00_8@467
+  //NPCData *pNPCData2; // eax@467
+  //unsigned __int64 v62; // kr00_8@467
   __int16 v63; // dx@479
   unsigned int v64; // eax@486
   int v65; // ecx@486
@@ -205,7 +205,7 @@
   int v155; // [sp-4h] [bp-600h]@165
   int v156; // [sp-4h] [bp-600h]@204
   //const char *v157; // [sp-4h] [bp-600h]@444
-  unsigned int v158; // [sp-4h] [bp-600h]@449
+  //unsigned int v158; // [sp-4h] [bp-600h]@449
   //__int16 v159; // [sp-4h] [bp-600h]@550
   int v160; // [sp-4h] [bp-600h]@599
   const char *v161; // [sp-4h] [bp-600h]@637
@@ -232,7 +232,7 @@
   signed int thisb; // [sp+14h] [bp-5E8h]@272
   Player *pPlayer7; // [sp+14h] [bp-5E8h]@373
   Player *pPlayer8; // [sp+14h] [bp-5E8h]@377
-  char *thise; // [sp+14h] [bp-5E8h]@445
+  char *pMapName; // [sp+14h] [bp-5E8h]@445
   Player *pPlayer9; // [sp+14h] [bp-5E8h]@455
   int thisg; // [sp+14h] [bp-5E8h]@467
   int thish; // [sp+14h] [bp-5E8h]@528
@@ -259,7 +259,7 @@
   POINT v209; // [sp+78h] [bp-584h]@777
   POINT v210; // [sp+80h] [bp-57Ch]@397
   POINT v211; // [sp+88h] [bp-574h]@704
-  __int64 v212; // [sp+90h] [bp-56Ch]@467
+  //__int64 v212; // [sp+90h] [bp-56Ch]@467
   int v213; // [sp+98h] [bp-564h]@385
   char pLevelName[32]; // [sp+9Ch] [bp-560h]@380
   char pOut[32]; // [sp+BCh] [bp-540h]@370
@@ -1666,7 +1666,7 @@
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           dword_50CDC8 = 1;
           sub_42FBDD();
-          pNPCData4 = (NPCData *)GetTravelTime();
+          //pNPCData4 = (NPCData *)GetTravelTime();
           strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
           if ( bUnderwater != 1 && pParty->bFlying
             || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 )
@@ -1695,11 +1695,11 @@
             ++pGameLoadingUI_ProgressBar->uProgressMax;
             SaveGame(1, 0);
             pGameLoadingUI_ProgressBar->Progress();
-            RestAndHeal(1440 * (signed int)pNPCData4);
+            RestAndHeal(1440 * (signed int)GetTravelTime());
             if ( pParty->uNumFoodRations )
             {
               pParty->RestAndHeal();
-              if ( ((pParty->uNumFoodRations - (signed int)pNPCData4) & 0x80000000u) != 0 )
+              if ( ((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0 )
               {
                 pPlayer7 = pParty->pPlayers;
                 do
@@ -1710,7 +1710,7 @@
                 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings );
                 ++pParty->days_played_without_rest;
               }
-              Party::TakeFood((unsigned int)pNPCData4);
+              Party::TakeFood((unsigned int)GetTravelTime());
             }
             else
             {
@@ -1964,26 +1964,25 @@
           uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam];
           if ( bRecallingBeacon )
           {
-            if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) )
+            if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) )
               continue;
-            v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName;
+            v173 = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName;
             sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s"
             GameUI_SetFooterString(pTmpBuf.data());
             continue;
           }
-          v59 = pMapStats->GetMapInfo(pCurrentMapName.data());
-          thise = "Not in Map Stats";
-          if ( v59 )
-            thise = pMapStats->pInfos[v59].pName;
-          if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) || !v59 )
+          pMapNum = pMapStats->GetMapInfo(pCurrentMapName.data());
+          pMapName = "Not in Map Stats";
+          if ( pMapNum )
+            pMapName = pMapStats->pInfos[pMapNum].pName;
+          if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum )
           {
-            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s"
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s"
             GameUI_SetFooterString(pTmpBuf.data());
             continue;
           }
           v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName;
-          v158 = (unsigned int)thise;
-          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s"
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s"
           GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_CloseAfterInstallBeacon:
@@ -1998,8 +1997,7 @@
           continue;
         case UIMSG_InstallBeacon:
           pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1];
-          pNPCData4 = (NPCData *)&pPlayer9->pInstalledBeacons[uMessageParam];
-          if ( !*(_QWORD *)&pNPCData4->pName && bRecallingBeacon )
+          if ( !pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon )
             continue;
           byte_506360 = 1;
           pPlayer9->CanCastSpell(uRequiredMana);
@@ -2017,38 +2015,30 @@
           pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0);
           if ( bRecallingBeacon )
           {
-            if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) )
+            if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) )
             {
               SaveGame(1, 0);
               OnMapLeave();
-              strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]);
+              strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]);
               dword_6BE364_game_settings_1 |= 1;
               uGameState = GAME_STATE_2;
-              _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags;
-              _5B65AC_npcdata_fame_or_other = pNPCData4->fame;
-              _5B65B0_npcdata_rep_or_other = pNPCData4->rep;
-              _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D);
-              _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D);
+              _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
+              _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y;
+              _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z;
+              _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X;
+              _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y;
               dword_5B65C0 = 1;
             }
             else
             {
-              pParty->vPosition.x = pNPCData4->uFlags;
-              pParty->vPosition.y = pNPCData4->fame;
-              pParty->vPosition.z = pNPCData4->rep;
+              pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
+              pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y;
+              pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z;
               pParty->uFallStartY = pParty->vPosition.z;
-              pParty->sRotationY = LOWORD(pNPCData4->Location2D);
-              pParty->sRotationX = HIWORD(pNPCData4->Location2D);
+              pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X;
+              pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y;
             }
             pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
-            /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-            {
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
-              *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-              ++pMessageQueue_50CBD0->uNumMessages;
-            }*/
-            //crt_deconstruct_ptr_6A0118();
             pBooksWindow->Release();
             pGUIWindow_CurrentMenu->Release();
             pBooksWindow = 0;
@@ -2059,28 +2049,19 @@
             sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1);
             SaveScreenshot(a1);
             LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1);
-            v212 = qword_506350 << 7;
-            pNPCData2 = pNPCData4;
-            thisg = 0;
-            v62 = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335);
-            pNPCData4->pName = (char *)v62;
-            pNPCData2->uPortraitID = HIDWORD(v62);
-            pNPCData2->uFlags = pParty->vPosition.x;
-            pNPCData2->fame = pParty->vPosition.y;
-            pNPCData2->rep = pParty->vPosition.z;
-            LOWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationY);
-            HIWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationX);
+            pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335);
+            pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x;
+            pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y;
+            pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z;
+            pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY);
+            pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX);
             if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 )
               continue;
-            uAction = 0;
-            while ( _stricmp((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName.data()) )
+            for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg )
             {
-              ++thisg;
-              uAction += 32;
-              if ( thisg >= (signed int)pGames_LOD->uNumSubDirs / 2 )
-                continue;
+              if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName.data()) )
+                pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg;
             }
-            HIWORD(pNPCData4->uProfession) = thisg;
           }
           continue;
         case UIMSG_ClickTownInTP:
@@ -3017,8 +2998,8 @@
           continue;
         case UIMSG_ShowStatus_Funds:
           v174 = (char *)pParty->uNumGoldInBank;
-          v158 = pParty->uNumGold + pParty->uNumGoldInBank;
-          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank"
+          //v158 = pParty->uNumGold + pParty->uNumGoldInBank;
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank"
           GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_ShowStatus_DateTime:
@@ -4712,7 +4693,7 @@
   v19 = 0;
   v29 = 0;
   if ( v17 <= 0 )
-    goto LABEL_29;
+    return 0;
   do
   {
     if ( a3a >= 2 )
@@ -4747,7 +4728,6 @@
   while ( v29 < v28 );
   result = 1;
   if ( a3a != 1 )
-LABEL_29:
     result = 0;
   return result;
 }
@@ -4847,7 +4827,7 @@
   v25 = 0;
   v16 = dword_4F5B24_ys[1] >= a3;
   if ( v15 <= 0 )
-    goto LABEL_29;
+    return 0;
   do
   {
     if ( a5a >= 2 )
@@ -4882,7 +4862,6 @@
   while ( v25 < v15 );
   result = 1;
   if ( a5a != 1 )
-LABEL_29:
     result = 0;
   return result;
 }
@@ -5193,14 +5172,22 @@
         {
           v35 = v27->uAttributes;
           if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 )
-            goto LABEL_92;
+		  {
+			pMouse->RemoveHoldingItem();
+			dword_50CDCC = 1;
+			return;
+		  }
           LOWORD(v35) = v35 | 0x210;
           v27->uAttributes = v35;
         }
         else
         {
           if ( (signed int)pParty->pPickedItem.uItemID <= 245 )
-            goto LABEL_92;
+		  {
+			pMouse->RemoveHoldingItem();
+			dword_50CDCC = 1;
+			return;
+		  }
           if ( (signed int)pParty->pPickedItem.uItemID <= 250 )
           {
             v27->UpdateTempBonus(pParty->uTimePlayed);
@@ -5211,7 +5198,11 @@
               || v27->uEnchantmentType
               || v51 && v51 != 1 && v51 != 2
               || (signed int)v33 >= 500 )
-              goto LABEL_92;
+			{
+				pMouse->RemoveHoldingItem();
+				dword_50CDCC = 1;
+				return;
+			}
             v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4];
             a2.y = (int)v29 << 7;
             v31 = (double)(signed int)((int)v29 << 7);
@@ -5227,7 +5218,11 @@
               || v27->uEnchantmentType
               || v51 && v51 != 1 && v51 != 2
               || (signed int)v30 >= 500 )
-              goto LABEL_92;
+			{
+				pMouse->RemoveHoldingItem();
+				dword_50CDCC = 1;
+				return;
+			}
             a2.y = (int)v29 << 7;
             v27->uSpecEnchantmentType = 40;
             v31 = (double)a2.y;
@@ -5240,7 +5235,9 @@
           v27->uAttributes = v32;
         }
         _50C9A8_item_enchantment_timer = 256;
-        goto LABEL_92;
+		pMouse->RemoveHoldingItem();
+		dword_50CDCC = 1;
+		return;
       }
       v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01;
       if ( v36 < 0.0 )
@@ -5254,7 +5251,9 @@
       v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y);
       v27->uMaxCharges = v37;
       v27->uNumCharges = (unsigned __int8)v37;
-      goto LABEL_92;
+		pMouse->RemoveHoldingItem();
+		dword_50CDCC = 1;
+		return;
     }
     v14 = v13 - 222;
     v15 = pParty->pPickedItem.uItemID - 222;
@@ -5395,9 +5394,16 @@
               if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) )
                 *(int *)(v22 + 552) |= 1u;
               if ( !dword_4E455C )
-                goto LABEL_92;
+			  {
+				pMouse->RemoveHoldingItem();
+				dword_50CDCC = 1;
+				return;
+			  }
               v0->PlaySound(SPEECH_16, 0);
-              goto LABEL_91;
+			  dword_4E455C = 0;
+			  pMouse->RemoveHoldingItem();
+			  dword_50CDCC = 1;
+			  return;
             }
             if ( v45 )
             {
@@ -5436,10 +5442,8 @@
       if ( v0->CanAct() )
         v0->PlaySound(SPEECH_17, 0);
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u);
-LABEL_91:
       dword_4E455C = 0;
     }
-LABEL_92:
     pMouse->RemoveHoldingItem();
     dword_50CDCC = 1;
     return;