changeset 81:377535d6e366

structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
author zipi
date Sun, 03 Feb 2013 15:36:54 +0000
parents 48f69ae3bc8d
children 1faa29fd4c2d
files GUIWindow.cpp Player.cpp mm7_1.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp stru179.h
diffstat 9 files changed, 86 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/GUIWindow.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -20,6 +20,7 @@
 #include "FactionTable.h"
 #include "StorylineTextTable.h"
 #include "Events2D.h"
+#include "Autonotes.h"
 
 
 #include "mm7_data.h"
@@ -477,7 +478,7 @@
   dword_506524 = 0;
   dword_506528 = 0;
   dword_50651C = 0;
-  dword_506520 = 0;
+  dword_506520 = 0;  
   if ( v1->ptr_1C == (void *)177 )
   {
     byte_506360 = 0;
@@ -562,11 +563,11 @@
         memset(&pStru179, 0, 0xFA0u);
         for ( i = dword_506528; i < 512; ++i )
         {
-          v14 = (&dword_722F10)[4 * i];
+          v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i];
           if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, i) && v14 )
           {
             v15 = dword_506520++;
-            pStru179->field_0[v15] = i;
+            pStru179.field_0[v15] = i;
           }
         }
       }
@@ -613,15 +614,16 @@
           dword_506520 = 0;
           while ( v10 < 196 )
           {
-            if ( dword_506568 == dword_72371C[2 * v10] )
+			if ( dword_506568 == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] )
             {
-              v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10];
+              //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10];
+			  v25 = (char *)pAutonoteTxt[v10-1].pText;
               if ( (short)v10 )
               {
                 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v10) && v25 )
                 {
                   v11 = dword_506520++;
-                  pStru179->field_0[v11] = (signed __int16)v10;
+                  pStru179.field_0[v11] = (signed __int16)v10;
                 }
               }
             }
--- a/Player.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/Player.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -18,7 +18,8 @@
 #include "Events2D.h"
 #include "Outdoor.h"
 #include "StorylineTextTable.h"
-
+#include "Autonotes.h"
+#include "Awards.h"
 #include "mm7_data.h"
 
 
@@ -8413,12 +8414,13 @@
   if ( var == VAR_AutoNotes )
   {
     if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_autonote_bits[((signed __int16)a3 - 1) >> 3])
-      && (&dword_723718_autonote_related)[8 * a3] )
+      //&& (&dword_723718_autonote_related)[8 * a3] )
+	  && pAutonoteTxt[a3-1].pText )
     {
       v20 = pPlayers[v3 + 1];
       v30 = 1;
       v20->PlaySound(96, 0);
-      v21 = dword_72371C[2 * a3];
+	  v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3];
       bFlashAutonotesBook = 1;
       dword_506568 = v21;
     }
@@ -8482,7 +8484,8 @@
           return;
         case VAR_Award:
           if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->field_152[((signed __int16)a3 - 1) >> 3])
-            && dword_723E80_award_related[2 * a3] )
+            //&& dword_723E80_award_related[2 * a3] )
+			&& pAwards[a3-1].pText )
           {
             v12 = pPlayers[v3 + 1];
             v30 = 1;
@@ -8496,7 +8499,8 @@
           goto LABEL_124;
         case VAR_QBits_QuestsDone:
           if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_award_bits[((signed __int16)a3 - 1) >> 3])
-            && (&dword_722F10)[4 * a3] )
+           // && (&dword_722F10)[4 * a3] )
+		   && pQuestTable[a3-1] )
           {
             v14 = pPlayers[v3 + 1];
             bFlashQuestBook = 1;
@@ -8909,7 +8913,8 @@
               v13 = pPlayers[uPlayerIdx + 1];
               v33 = 0x80u >> ((signed __int16)val - 1) % 8;
               if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->field_152[((signed __int16)val - 1) >> 3])
-                && dword_723E80_award_related[2 * val] )
+                //&& dword_723E80_award_related[2 * val] )
+				&& pAwards[val-1].pText )
               {
                 v14 = pPlayers[uPlayerIdx + 1];
                 v34 = 1;
@@ -8927,7 +8932,8 @@
               goto _play_anim_and_exit;
             case VAR_QBits_QuestsDone:
               if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_award_bits[((signed __int16)val - 1) >> 3])
-                && (&dword_722F10)[4 * val] )
+                //&& (&dword_722F10)[4 * val] )
+				&& pQuestTable[val-1] )
               {
                 v17 = pPlayers[uPlayerIdx + 1];
                 bFlashQuestBook = 1;
@@ -9191,12 +9197,13 @@
       goto _play_sound;
     }
     if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_autonote_bits[((signed __int16)val - 1) >> 3])
-      && (&dword_723718_autonote_related)[8 * val] )
+      //&& (&dword_723718_autonote_related)[8 * val] )
+	  && pAutonoteTxt[val-1].pText )
     {
       v23 = pPlayers[uPlayerIdx + 1];
       v34 = 1;
       v23->PlaySound(96, 0);
-      v24 = dword_72371C[2 * val];
+	  v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val];
       bFlashAutonotesBook = 1;
       dword_506568 = v24;
     }
--- a/mm7_1.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/mm7_1.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -691,9 +691,9 @@
   {
     while ( 1 )
     {
-      v5 = pStru179->field_0[v21];
-      v20 = 8 * pStru179->field_0[v21];
-      v6 = (char *)dword_723E80_award_related[v20 / 4];
+      v5 = pStru179.field_0[v21];
+      v20 = 8 * pStru179.field_0[v21];
+      v6 = (char *)pAwards[v20/8-1].pText;//(char *)dword_723E80_award_related[v20 / 4];
       if ( v5 != 1 )
         break;
       v17 = pParty->uFine;
@@ -701,7 +701,7 @@
       sprintf(pTmpBuf, v6, v17);
       v6 = pTmpBuf;
 LABEL_43:
-      v14 = dword_723E84[v20 / 4];
+	  v14 = pAwards[v20/8-1].uSort;//dword_723E84[v20 / 4];
       ++dword_506520;
       v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(
               pAwardsTextColors[3 * v14 % 6],
--- a/mm7_3.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/mm7_3.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -5031,12 +5031,12 @@
 //----- (00476750) --------------------------------------------------------
 void __cdecl InitializeAutonotes()
 {
-  char *v0; // ebp@3
+  Autonote *v0; // ebp@3
   int v1; // ebx@4
   char *v2; // esi@4
   char v3; // cl@5
   int v4; // eax@5
-  int v5; // edi@9
+  char *v5; // edi@9
   signed int v6; // [sp+0h] [bp-4h]@4
 
   if ( pAutonoteTXT_Raw )
@@ -5044,7 +5044,7 @@
   pAutonoteTXT_Raw = 0;
   pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
   strtok(pAutonoteTXT_Raw, "\r");
-  v0 = (char *)&pAutonoteTxt[0].eType;
+  v0 = pAutonoteTxt;
   for (uint i = 0; i < 195; ++i)
   {
     v1 = 0;
@@ -5059,15 +5059,15 @@
         ++v4;
         v3 = v2[v4];
       }
-      v5 = (int)&v2[v4];
+      v5 = &v2[v4];
       if ( !v2[v4] )
         v6 = 1;
-      *(char *)v5 = 0;
+      *v5 = 0;
       if ( v4 )
       {
         if ( v1 == 1 )
         {
-          *((int *)v0 - 1) = (int)RemoveQuotes(v2);
+			v0->pText = RemoveQuotes(v2);
         }
         else
         {
@@ -5080,23 +5080,23 @@
                 if ( _strcmpi(v2, "seer") )
                 {
                   if ( _strcmpi(v2, "obelisk") )
-                    *(int *)v0 = 5 - (_strcmpi(v2, "teacher") != 0);
+					  v0->eType = (AUTONOTE_TYPE)(5 - (_strcmpi(v2, "teacher") != 0));
                   else
-                    *(int *)v0 = 2;
+					  v0->eType = (AUTONOTE_TYPE)2;
                 }
                 else
                 {
-                  *(int *)v0 = 3;
+                  v0->eType = (AUTONOTE_TYPE)3;
                 }
               }
               else
               {
-                *(int *)v0 = 1;
+                v0->eType = (AUTONOTE_TYPE)1;
               }
             }
             else
             {
-              *(int *)v0 = 0;
+              v0->eType = (AUTONOTE_TYPE)0;
             }
           }
         }
@@ -5106,10 +5106,10 @@
         v6 = 1;
       }
       ++v1;
-      v2 = (char *)(v5 + 1);
+      v2 = v5 + 1;
     }
     while ( v1 - 1 <= 2 && !v6 );
-    v0 += 8;
+    ++v0;
   }
   //while ( (signed int)v0 < (signed int)&pScrolls[1] );
 }
@@ -16244,7 +16244,7 @@
       {
         v23 = v0->evtf;
 LABEL_63:
-        v24 = (&dword_721660)[8 * v23];
+		v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
         if ( !v24 )
         {
           v24 = "";
@@ -17807,12 +17807,12 @@
             {
               if ( _5C3420_pDecoration == (LevelDecoration *)1 )
               {
-                ptr_F8B1E8 = (&dword_721664)[8 * v90];
+				  ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
                 goto LABEL_291;
               }
               if ( a3 == 1 )
               {
-                v91 = (&dword_721664)[8 * v90];
+                v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
 LABEL_248:
                 ShowStatusBarString(v91, 2u);
                 goto LABEL_291;
@@ -17831,7 +17831,7 @@
             v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
             if ( _5C3420_pDecoration )
             {
-              v93 = (&dword_721664)[8 * v92];
+              v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
               byte_5B0938[0] = 0;
               ptr_F8B1E8 = v93;
             }
--- a/mm7_4.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/mm7_4.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -5042,7 +5042,7 @@
                 v24 = v23;
                 dword_A74CDC = v23;
               }
-              v11 = (char *)dword_723E80_award_related[2 * v55[v24]];
+              v11 = (char *)pAwards[v55[v24]-1].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
             }
             else
             {
@@ -10298,7 +10298,7 @@
         {
           v23 = v58->evtf;
 LABEL_33:
-          v15 = (&dword_721660)[8 * v23];
+          v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
           if ( !v15 )
           {
             v16->uControlParam = 0;
@@ -10318,7 +10318,7 @@
           v20 = v19 - 1;
           if ( !v20 )
           {
-            v15 = (&dword_721660)[8 * v58->evtb];
+			v15 = (char *)pNPCTopics[v58->evtb-1].pTopic;//(&dword_721660)[8 * v58->evtb];
             if ( !v15 )
             {
               v16->uControlParam = 0;
--- a/mm7_5.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/mm7_5.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -13539,7 +13539,7 @@
   pRenderer->DrawTextureTransparent(v1, v12, v14);
   if ( !byte_5C6D50[dword_506528] )
   {
-    v2 = pStru179->field_0[dword_506528];
+    v2 = pStru179.field_0[dword_506528];
     a1.uFrameWidth = 460;
     a1.uFrameX = 8;
     a1.uFrameY = 8;
@@ -13577,7 +13577,7 @@
     dword_50651C = 0;
   }
   dword_506544 = 0;
-  v6 = pStru179->field_0[dword_506528];
+  v6 = pStru179.field_0[dword_506528];
   dword_506548 = 0;
   dword_506520 = 0;
   v7 = *(&pStorylineText->field_0 + 3 * v6);
@@ -13679,10 +13679,10 @@
   dword_506520 = 0;
   while ( v3 < dword_506524 )
   {
-    v4 = pStru179->field_0[v3];
+    v4 = pStru179.field_0[v3];
     ++dword_506520;
-    v5 = (&dword_722F10)[4 * v4];
-    a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_722F10)[4 * v4], 0, 0, 0);
+    v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4];
+    a1.DrawText(pAutonoteFont, 1, 0, 0, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0);
     v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0);
     v7 = a1.uFrameY + v6;
     if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight )
@@ -13928,15 +13928,17 @@
     v8 = 0;
     do
     {
-      if ( dword_72371C[2 * v8] == dword_506568 )
-      {
-        v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8];
+      //if ( dword_72371C[2 * v8] == dword_506568 )
+	  if ( pAutonoteTxt[v8-1].eType == dword_506568 )
+      {
+        //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8];
+		v32 = (char *)pAutonoteTxt[v8-1].pText;
         if ( (short)v8 )
         {
           if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 )
           {
             v9 = dword_506520++;
-            pStru179->field_0[v9] = (signed __int16)v8;
+            pStru179.field_0[v9] = (signed __int16)v8;
           }
         }
       }
@@ -13982,10 +13984,12 @@
   dword_506540 = 0;
   while ( v12 < dword_506524 )
   {
-    v13 = pStru179->field_0[v12];
+    v13 = pStru179.field_0[v12];
     ++dword_506520;
-    v14 = (&dword_723718_autonote_related)[8 * v13];
-    a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0);
+    //v14 = (&dword_723718_autonote_related)[8 * v13];
+	v14 = pAutonoteTxt[v13-1].pText;
+    //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0);
+	a1.DrawText(pAutonoteFont, 1, 0, 0, pAutonoteTxt[v13-1].pText, 0, 0, 0);
     v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0);
     v16 = a1.uFrameY + v15;
     if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight )
@@ -14224,6 +14228,15 @@
   a1.uFrameZ = 467;
   a1.uFrameW = 467;
   a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[186], 3u);
+  if ( pParty->uCurrentHour >= 12 )
+  {
+    if ( pParty->uCurrentHour >= 24 )
+		v2=0;
+	else
+		v2=1;
+  }
+  else
+    v2=0;
   v1 = GetDayPart();
   sprintf(
     pTmpBuf,
@@ -17627,7 +17640,7 @@
   unsigned __int8 v10; // of@7
   stru179 *v11; // edi@9
   int v12; // edx@11
-  int v13; // [sp+Ch] [bp-8h]@2
+  char *v13; // [sp+Ch] [bp-8h]@2
   signed int v14; // [sp+Ch] [bp-8h]@9
   int i; // [sp+10h] [bp-4h]@10
 
@@ -17643,11 +17656,11 @@
   v2 = (unsigned __int8 *)pPlayer->field_152;
   do
   {
-    v13 = dword_723E80_award_related[2 * v1];
+    v13 = (char *)pAwards[v1-1].pText;//dword_723E80_award_related[2 * v1];
     if ( (unsigned __int16)_449B57_test_bit(v2, v1) && v13 )
     {
       v3 = dword_506520++;
-      pStru179->field_0[v3] = v1;
+      pStru179.field_0[v3] = v1;
     }
     ++v1;
   }
@@ -17667,21 +17680,22 @@
       v9 = dword_506524 + v5++;
       v10 = v5 > dword_506524;//__OFSUB__(v5, dword_506524);
       v7 = v5 - dword_506524 < 0;
-      pStru179->field_0[v9] = v8;
+      pStru179.field_0[v9] = v8;
     }
     while ( v7 ^ v10 );
     if ( result > 0 )
     {
       v14 = 1;
-      v11 = pStru179;
+      v11 = &pStru179;
       do
       {
         for ( i = v14; i < result; ++i )
         {
-          v12 = pStru179->field_0[i];
-          if ( dword_723E84[2 * v12] < dword_723E84[2 * v11->field_0[0]] )
-          {
-            pStru179->field_0[i] = v11->field_0[0];
+          v12 = pStru179.field_0[i];
+          //if ( dword_723E84[2 * v12] < dword_723E84[2 * v11->field_0[0]] )
+		  if(pAwards[v12-1].uSort < pAwards[v11->field_0[0]].uSort)
+          {
+            pStru179.field_0[i] = v11->field_0[0];
             v11->field_0[0] = v12;
           }
         }
--- a/mm7_6.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/mm7_6.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -7476,7 +7476,7 @@
           if ( *(int *)v605 != v1 )
           {
             v606 = HIDWORD(v733)++;
-            pStru179->field_0[v606] = (int)((char *)&_this->uItemID + 1);
+            pStru179.field_0[v606] = (int)((char *)&_this->uItemID + 1);
           }
           _this = (ItemGen *)((char *)_this + 1);
           v605 += 76;
--- a/mm7_data.cpp	Sat Feb 02 16:56:01 2013 +0000
+++ b/mm7_data.cpp	Sun Feb 03 15:36:54 2013 +0000
@@ -55,7 +55,7 @@
 stru157 a3; // idb
 
 #include "stru179.h"
-stru179 *pStru179;
+stru179 pStru179;
 
 #include "stru123.h"
 stru123 stru_5E4C90;
--- a/stru179.h	Sat Feb 02 16:56:01 2013 +0000
+++ b/stru179.h	Sun Feb 03 15:36:54 2013 +0000
@@ -9,4 +9,4 @@
 };
 #pragma pack(pop)
 
-extern struct stru179 *pStru179;
\ No newline at end of file
+extern struct stru179 pStru179;
\ No newline at end of file