changeset 1430:71a2cf416478

LloydBeacons
author Ritor1
date Fri, 02 Aug 2013 13:48:57 +0600
parents c7489dd19f88
children 4d13549db029
files CastSpellInfo.cpp GUIWindow.cpp Player.cpp Player.h Render.cpp SaveLoad.cpp UI/Books/UIMapBook.cpp mm7_5.cpp
diffstat 8 files changed, 138 insertions(+), 202 deletions(-) [+]
line wrap: on
line diff
--- a/CastSpellInfo.cpp	Thu Aug 01 17:51:16 2013 +0600
+++ b/CastSpellInfo.cpp	Fri Aug 02 13:48:57 2013 +0600
@@ -4088,7 +4088,7 @@
   return -1;
 }
 //----- (00427D48) --------------------------------------------------------
-void CastSpellInfo::_427D48(unsigned int uPlayerID)
+void CastSpellInfo::_427D48(unsigned int uPlayerID)//Press S
 {
   CastSpellInfo *v2; // esi@1
   signed int v3; // ebx@1
--- a/GUIWindow.cpp	Thu Aug 01 17:51:16 2013 +0600
+++ b/GUIWindow.cpp	Fri Aug 02 13:48:57 2013 +0600
@@ -460,9 +460,9 @@
           max_beacons = 3;
 
       
-      __debugbreak(); // warning C4700: uninitialized local variable 'v19' used
+      //__debugbreak(); // warning C4700: uninitialized local variable 'v19' used
       for (int i =0; i< max_beacons; ++i)
-            CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19],
+            CreateButton(pLloydsBeaconsPreviewXs[i], pLloydsBeaconsPreviewYs[i],
                            92, 68, 1, 180, UIMSG_InstallBeacon, i, 0, "", 0);
 
       for (int i =0; i< 5; ++i)
--- a/Player.cpp	Thu Aug 01 17:51:16 2013 +0600
+++ b/Player.cpp	Fri Aug 02 13:48:57 2013 +0600
@@ -8636,7 +8636,7 @@
     }
   }
 
-  assert(false);
+  //assert(false);
   return false;
 }
 // 5B65C4: using guessed type int dword_5B65C4;
--- a/Player.h	Thu Aug 01 17:51:16 2013 +0600
+++ b/Player.h	Fri Aug 02 13:48:57 2013 +0600
@@ -294,11 +294,12 @@
 struct LloydBeacon
 {
   unsigned __int64 uBeaconTime;
-  int field_8;
-  int field_C;
-  int field_10;
-  int field_14;
-  int field_18;
+  int PartyPos_X;
+  int PartyPos_Y;
+  int PartyPos_Z;
+  __int16 PartyRot_X;
+  __int16 PartyRot_Y;
+  int SaveFileID;
 };
 #pragma pack(pop)
 
--- a/Render.cpp	Thu Aug 01 17:51:16 2013 +0600
+++ b/Render.cpp	Fri Aug 02 13:48:57 2013 +0600
@@ -2753,7 +2753,7 @@
 //----- (0049F8B5) --------------------------------------------------------
 FILE *Render::SavePCXImage(const char *Filename, char *a3, int a4, int a5)
 {
-  Render *v5; // esi@1
+  //Render *v5; // esi@1
   FILE *result; // eax@1
   FILE *v7; // edi@4
   int v8; // ecx@5
@@ -2775,7 +2775,6 @@
   int v24; // [sp+9Ch] [bp-8h]@2
   char *i; // [sp+A0h] [bp-4h]@8
 
-  v5 = this;
   result = fopen(Filename, "wb");
   Filename = (const char *)result;
   if ( result )
@@ -2836,16 +2835,16 @@
           i = (char *)ptr + 2 * v24;
           do
           {
-            *((char *)ptr + v10) = (signed int)(v5->uTargetRMask & *(short *)a5) >> (LOBYTE(v5->uTargetGBits)
-                                                                                    + LOBYTE(v5->uTargetBBits)
-                                                                                    + v5->uTargetRBits
+            *((char *)ptr + v10) = (signed int)(this->uTargetRMask & *(short *)a5) >> (LOBYTE(this->uTargetGBits)
+                                                                                    + LOBYTE(this->uTargetBBits)
+                                                                                    + this->uTargetRBits
                                                                                     - 8);
-            a3[v10] = (signed int)(v5->uTargetGMask & *(short *)a5) >> (LOBYTE(v5->uTargetBBits)
-                                                                      + LOBYTE(v5->uTargetGBits)
+            a3[v10] = (signed int)(this->uTargetGMask & *(short *)a5) >> (LOBYTE(this->uTargetBBits)
+                                                                      + LOBYTE(this->uTargetGBits)
                                                                       - 8);
             v11 = a5;
             a5 += 2;
-            i[v10++] = (v5->uTargetBMask & *(char *)v11) << (8 - LOBYTE(v5->uTargetBBits));
+            i[v10++] = (this->uTargetBMask & *(char *)v11) << (8 - LOBYTE(this->uTargetBBits));
           }
           while ( v10 < a4 );
         }
--- a/SaveLoad.cpp	Thu Aug 01 17:51:16 2013 +0600
+++ b/SaveLoad.cpp	Fri Aug 02 13:48:57 2013 +0600
@@ -795,34 +795,27 @@
     v26 = pRenderer->uTargetSurfacePitch;
     if ( pRenderer->pTargetSurface )
     {
-      v29 = 0;
       if ( height > 0 )
       {
-        do
+        for ( v29 = 0; v29 < height; ++v29 )
         {
-          v28 = 0;
           if ( width > 0 )
           {
             v15 = v26 * (unsigned __int64)(signed __int64)((double)v29 * v25 + 8.0);
-            do
+            for ( v28 = 0; v28 < width; v28++ )
             {
-              v16 = (signed __int64)((double)v28++ * v23 + 8.0);
-              *v3 = _this[v15 + (int)v16];
+              *v3 = _this[v15 + (int)(signed __int64)((double)v28 * v23 + 8.0)];
               ++v3;
             }
-            while ( v28 < width );
           }
-          ++v29;
         }
-        while ( v29 < height );
       }
     }
     else
     {
       if ( height > 0 )
       {
-        v17 = height;
-        do
+        for ( v17 = height; v17; --v17 )
         {
           if ( width > 0 )
           {
@@ -835,9 +828,7 @@
             }
             v3 += width;
           }
-          --v17;
         }
-        while ( v17 );
       }
     }
     pRenderer->EndScene();
@@ -847,11 +838,9 @@
 //----- (0045E26C) --------------------------------------------------------
 void __thiscall SaveScreenshot(const char *pFilename)
 {
-  const char *v1; // edi@1
   unsigned __int16 *v2; // esi@1
 
-  v1 = pFilename;
   v2 = MakeScreenshot(92, 68);
-  pRenderer->SavePCXImage(v1, (char *)v2, 92, 68);
+  pRenderer->SavePCXImage(pFilename, (char *)v2, 92, 68);
   free(v2);
 }
\ No newline at end of file
--- a/UI/Books/UIMapBook.cpp	Thu Aug 01 17:51:16 2013 +0600
+++ b/UI/Books/UIMapBook.cpp	Fri Aug 02 13:48:57 2013 +0600
@@ -88,34 +88,34 @@
 unsigned int __cdecl DrawLloydBeaconsScreen()
 {
   Player *pPlayer; // esi@1
-  char *v1; // eax@1
-  unsigned __int16 v2; // ax@6
-  unsigned int result; // eax@11
-  unsigned int v4; // esi@13
-  unsigned int v5; // ecx@13
-  char v6; // zf@13
-  LloydBeacon *v7; // esi@14
-  int v8; // eax@14
-  unsigned __int64 v9; // kr08_8@14
-  unsigned int v10; // esi@14
-  unsigned int v11; // eax@14
-  char *v12; // eax@19
-  char *v13; // ecx@22
-  int v14; // eax@27
+  char *pText; // eax@1
+  //unsigned __int16 v2; // ax@6
+  //unsigned int result; // eax@11
+  //unsigned int v4; // esi@13
+  //unsigned int v5; // ecx@13
+  //char v6; // zf@13
+  //LloydBeacon *v7; // esi@14
+  int pTextHeight; // eax@14
+  int RemainingTime; // kr08_8@14
+  unsigned int pHours; // esi@14
+  unsigned int pDays; // eax@14
+  char *pSelectionText; // eax@19
+  //char *v13; // ecx@22
+  //int v14; // eax@27
   Texture *v19; // [sp-4h] [bp-8Ch]@4
   GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
-  unsigned int v23; // [sp+64h] [bp-24h]@14
-  __int64 v24; // [sp+68h] [bp-20h]@14
-  unsigned int v25; // [sp+70h] [bp-18h]@13
+  //unsigned int v23; // [sp+64h] [bp-24h]@14
+  //__int64 v24; // [sp+68h] [bp-20h]@14
+  //unsigned int v25; // [sp+70h] [bp-18h]@13
   char *Str; // [sp+74h] [bp-14h]@14
-  int v27; // [sp+78h] [bp-10h]@11
-  LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12
-  RGBTexture *v29; // [sp+80h] [bp-8h]@12
+  int BeaconID; // [sp+78h] [bp-10h]@11
+  //LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12
+  //RGBTexture *v29; // [sp+80h] [bp-8h]@12
   int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
 
   pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
-  pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
-  v1 = pGlobalTXT_LocalizationStrings[523];     // Recall Beacon
+  pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
+  pText = pGlobalTXT_LocalizationStrings[523];     // Recall Beacon
   pWindow.uFrameX = game_viewport_x;
   pWindow.uFrameY = game_viewport_y;
   pWindow.uFrameWidth = 428;
@@ -123,9 +123,9 @@
   pWindow.uFrameZ = 435;
   pWindow.uFrameW = game_viewport_w;
   if ( !bRecallingBeacon )
-    v1 = pGlobalTXT_LocalizationStrings[375];   // Set Beacon
-  sprintf(pTmpBuf.data(), "%s", v1);
-  pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3u);
+    pText = pGlobalTXT_LocalizationStrings[375];   // Set Beacon
+  sprintf(pTmpBuf.data(), "%s", pText);
+  pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3);
   if ( bRecallingBeacon )
   {
     pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on);
@@ -137,109 +137,75 @@
     v19 = pTex_tab_an_6b__zoom_on;
   }
   pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
-  v2 = pPlayer->pActiveSkills[14];
   uNumMaxBeacons = 1;
-  if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 )
+  if ( HIBYTE(pPlayer->pActiveSkills[14]) & 1 || (pPlayer->pActiveSkills[14] & 0x80u) != 0 )
   {
     uNumMaxBeacons = 5;
   }
   else
   {
-    if ( v2 & 0x40 )
+    if ( pPlayer->pActiveSkills[14] & 0x40 )
       uNumMaxBeacons = 3;
   }
-  result = 0;
-  v27 = 0;
   if ( uNumMaxBeacons > 0 )
   {
-    v29 = pSavegameThumbnails.data();
-    v28 = pPlayer->pInstalledBeacons;
-    while ( 1 )
+    for ( BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++ )
     {
       pWindow.uFrameWidth = 92;
-      v4 = result;
       pWindow.uFrameHeight = 68;
-      v5 = pLloydsBeaconsPreviewXs[result];
-      pWindow.uFrameY = pLloydsBeaconsPreviewYs[result];
-      v25 = pWindow.uFrameY;
-      pWindow.uFrameX = v5;
+      pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID];
+      pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID];
       pWindow.uFrameW = pWindow.uFrameY + 67;
-      v6 = v29->pPixels == 0;
-      pWindow.uFrameZ = v5 + 91;
-      if ( !v6 )
-        break;
+      pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91;
+      //if ( pSavegameThumbnails[BeaconID].pPixels != 0 )
+      if ( pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0 )
+      {
+        pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
+        pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]);
+        Str = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName;
+        pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
+        pWindow.uFrameY += -6 - pTextHeight;
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3);
+        RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed;
+        pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60;
+        pDays = pHours / 24;
+        if ( pDays )
+        {
+          sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days
+          pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
+          pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+          continue;
+        }
+        else
+        {
+          if ( pHours + 1 <= 23 )
+          {
+            if ( pHours < 1 )
+              pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour
+            else
+              pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours
+            sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText);
+            pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
+            pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+            continue;
+          }
+        }
+        sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day
+        pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+        continue;
+      }
       if ( !bRecallingBeacon )
       {
-        pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
-        v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
-        pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);
-      }
-LABEL_29:
-      ++v29;
-      ++v28;
-      result = v27++ + 1;
-      if ( v27 >= uNumMaxBeacons )
-        goto LABEL_30;
-    }
-    pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
-    pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29);
-    v7 = v28;
-    Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName;
-    v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
-    pWindow.uFrameY += -6 - v8;
-    pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u);
-    v9 = v7->uBeaconTime - pParty->uTimePlayed;
-    LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed);
-    HIDWORD(v24) = HIDWORD(v9);
-    v23 = (unsigned __int64)((signed __int64)((double)v24 * 0.234375) / 60 / 60) >> 32;
-    v10 = (signed __int64)((double)v24 * 0.234375) / 60 / 60;
-    v11 = v10 / 0x18;
-    if ( (unsigned int)((signed __int64)((double)v24 * 0.234375) / 60 / 60) / 0x18 )
-    {
-      v13 = pGlobalTXT_LocalizationStrings[57]; // Days
-      if ( v11 > 1 )
-      {
-        sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
-        pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
-        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
-        goto LABEL_29;
+        pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
+        pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
+        pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно
       }
     }
-    else
-    {
-      if ( (signed __int64)(__PAIR__(v23, v10) + 1) <= 23 )
-      {
-        if ( (v23 & 0x80000000u) != 0 || (signed int)v23 <= 0 && v10 <= 1 )
-          v12 = pGlobalTXT_LocalizationStrings[109];// Hour
-        else
-          v12 = pGlobalTXT_LocalizationStrings[110];// Hours
-        sprintf(pTmpBuf.data(), "%lu %s", v10 + 1, v12);
-        pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
-        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
-        goto LABEL_29;
-      }
-    }
-    v13 = pGlobalTXT_LocalizationStrings[56];   // Day
-    sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
-    pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
-    pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
-    goto LABEL_29;
   }
-LABEL_30:
   if ( byte_506360 )
-  {
-    /*result = pMessageQueue_50CBD0->uNumMessages;
-    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-    {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon;
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-      *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
-      ++pMessageQueue_50CBD0->uNumMessages;
-    }*/
     pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
-  }
-  return result;
+  return BeaconID;
 }
 
 
--- a/mm7_5.cpp	Thu Aug 01 17:51:16 2013 +0600
+++ b/mm7_5.cpp	Fri Aug 02 13:48:57 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: