diff mm7_4.cpp @ 727:da130dd3092a

Big time Travel ouverhaul
author Nomad
date Fri, 22 Mar 2013 00:02:31 +0200
parents 735dab8d3c9a
children 9f596a163257
line wrap: on
line diff
--- a/mm7_4.cpp	Thu Mar 21 20:30:17 2013 +0200
+++ b/mm7_4.cpp	Fri Mar 22 00:02:31 2013 +0200
@@ -10060,7 +10060,7 @@
   signed int v2; // edi@1
   unsigned int v3; // eax@1
   signed int v4; // ebx@1
-  char *v5; // esi@7
+  stru365_travel_info *v5; // esi@7
   int v6; // eax@9
   int v7; // eax@9
   int v8; // eax@12
@@ -10078,10 +10078,10 @@
   int v20; // esi@36
   int v21; // eax@36
   void *v22; // eax@39
-  Player *v23; // esi@39
+  int v23; // esi@39
   GUIButton *v24; // ebx@39
   signed int v25; // eax@41
-  int v26; // esi@44
+  //int v26; // esi@44
   const char *v27; // eax@46
   char *v28; // eax@62
   int v29; // eax@62
@@ -10113,10 +10113,10 @@
   int v55; // [sp+260h] [bp-30h]@36
   unsigned int v56; // [sp+264h] [bp-2Ch]@1
   int v57; // [sp+268h] [bp-28h]@1
-  Player *v58; // [sp+26Ch] [bp-24h]@36
+  int v58; // [sp+26Ch] [bp-24h]@36
   GUIWindow *v59; // [sp+270h] [bp-20h]@1
   unsigned int v60; // [sp+274h] [bp-1Ch]@36
-  Player *v61; // [sp+278h] [bp-18h]@1
+  //Player *v61; // [sp+278h] [bp-18h]@1
   int v62; // [sp+27Ch] [bp-14h]@36
   int v63; // [sp+280h] [bp-10h]@14
   char *a1; // [sp+284h] [bp-Ch]@37
@@ -10126,8 +10126,8 @@
   v0 = window_SpeakInHouse;
   memcpy(&v53, window_SpeakInHouse, sizeof(v53));
   v2 = 255;
-  v61 = pPlayers[uActiveCharacter];
-  v1 = v61;
+  //v61 = pPlayers[uActiveCharacter];
+  v1 = pPlayers[uActiveCharacter];
   v53.uFrameX = 483;
   v53.uFrameWidth = 148;
   v53.uFrameZ = 334;
@@ -10146,7 +10146,7 @@
     if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
     {
       v16 = pDialogueWindow;
-      v58 = (Player *)-1;
+      v58 = -1;
       v62 = 0;
       v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
       v59 = pDialogueWindow;
@@ -10168,23 +10168,22 @@
       {
         int v47 = v60;
         v22 = window_SpeakInHouse->ptr_1C;
-        v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
-        v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
+        v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
+        //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
+        //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
         v24 = v16->GetControl(v60);
         if ( v23 != v58
-          && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = (unsigned __int8)*(&byte_4F09B1[32 * (int)v23]
-                                                                        + pParty->uDaysPlayed % 7)),
+          && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]),
               v25
-           && ((v26 = 8 * (int)v23, !dword_4F09CC[v26])
-            || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v26])))) )
-        {
-          v58 = v61;
+           && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) )
+        {
+          v58 = v23;
           v27 = (const char *)v56;
           if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
             v27 = (const char *)v57;
           //v32.uRedbookTrackID = v27;
           sprintf(a1, "\f%05d", v27);
-          v66 = (unsigned __int8)byte_4F09B8[v26 * 4];
+          v66 = array_4F09B0[v23].uTravelTime;
           if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
           {
             if ( CheckHiredNPCSpeciality(Sailor) )
@@ -10205,9 +10204,9 @@
             --v66;
           if ( v66 < 1 )
             v66 = 1;
-          if ( v61 != (Player *)v2 )
+          if ( v23 != v2 )
           {
-            memcpy(&v32, &pMapStats->pInfos[(unsigned __int8)byte_4F09B0[v26 * 4]], 0x44u);
+            memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u);
             sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
               v66, v32.pName);
             strcat(a1, pTmpBuf);
@@ -10281,16 +10280,16 @@
       }
       Party::TakeGold(s1);
       //v47[1] = (const char *)7;
-      v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)];  // negindex with ptr_1C around +0x36
-      if ( v5[pParty->uDaysPlayed % 7 + 1] )
-      {
-        if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) )
+      v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]];
+      if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
+      {
+        if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
         {
           SaveGame(1, 0);
-          strcpy(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename);
-          v8 = *((int *)v5 + 6);
-          v9 = *((int *)v5 + 5);
-          v10 = *((int *)v5 + 4);
+          strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
+          v8 = v5->field_18;
+          v9 = v5->field_14;
+          v10 = v5->field_10;
           dword_6BE364_game_settings_1 |= 1u;
           _5B65B8_npcdata_hiword_house_or_other = 0;
           dword_5B65BC = 0;
@@ -10304,19 +10303,19 @@
         }
         else
         {
-          v6 = *((int *)v5 + 3);
+          v6 = v5->field_C;
           pParty->sRotationX = 0;
           pParty->vPosition.x = v6;
-          v7 = *((int *)v5 + 4);
+          v7 = v5->field_10;
           pIndoorCamera->sRotationY = 0;
           pParty->uFlags |= 2u;
           pParty->vPosition.y = v7;
-          pParty->vPosition.z = *((int *)v5 + 5);
+          pParty->vPosition.z = v5->field_14;
           pParty->uFallStartY = pParty->vPosition.z;
-          pParty->sRotationY = *((int *)v5 + 6);
+          pParty->sRotationY = v5->field_18;
         }
         HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
-        v12 = (unsigned __int8)v5[8];
+        v12 = v5->uTravelTime;
         int _v47;
         if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
         {
@@ -10343,7 +10342,7 @@
         if ( v12 < 1 )
           v12 = 1;
         RestAndHeal(1440 * v12);
-        v61->PlaySound((PlayerSpeech)v63, 0);
+        v1->PlaySound((PlayerSpeech)v63, 0);
         v14 = GetTickCount();
         v15 = v14 + v13;
         if ( v15 < v14 )