changeset 283:e3b70ba42154

Слияние
author Ritor1
date Sun, 17 Feb 2013 20:54:07 +0600
parents 87ab1603c937 (current diff) 47e06334c564 (diff)
children fcfdb7f40c1b
files Player.cpp mm7_5.cpp mm7_data.cpp
diffstat 9 files changed, 111 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Sun Feb 17 20:53:53 2013 +0600
+++ b/GUIWindow.cpp	Sun Feb 17 20:54:07 2013 +0600
@@ -721,7 +721,7 @@
           {
             v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528];
             v24 = dword_506528 + 1;
-            v22 = (char *)&pStorylineText->field_4[3 * dword_506528 + 2];
+            v22 = (char *)&pStorylineText->StoreLine[dword_506528].pPageTitle;//guess //field_4[3 * dword_506528 + 2];
             do
             {
               v4 = *(char **)v22;
--- a/Items.cpp	Sun Feb 17 20:53:53 2013 +0600
+++ b/Items.cpp	Sun Feb 17 20:54:07 2013 +0600
@@ -1265,7 +1265,7 @@
 			if ( !test_string )
 				break;
 			potion_value = atoi(test_string);
-			char c=*test_string;
+			unsigned char c=*test_string;
 			if ( !potion_value )
 				{
 				if ( tolower(c) == 'e' )
@@ -1347,7 +1347,7 @@
 			if ( !test_string )
 				break;
 			potion_note = atoi(test_string);
-			char c=*test_string;
+			unsigned char c=*test_string;
 			if ( !potion_note )
 				{
 				if ( tolower(c) == 'e' )
--- a/Player.cpp	Sun Feb 17 20:53:53 2013 +0600
+++ b/Player.cpp	Sun Feb 17 20:54:07 2013 +0600
@@ -8378,7 +8378,7 @@
           || var > VAR_History_28
           || (v22 = var - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22])
           || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed),
-              v23 = *(&pStorylineText->field_0 + 3 * v22) == 0,
+              v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0,
               pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed),
               v23) )
           return;
@@ -9309,7 +9309,7 @@
         || var > VAR_History_28
         || (v25 = var - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25])
         || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed),
-            v26 = *(&pStorylineText->field_0 + 3 * v25) == 0,
+            v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0,
             pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed),
             v26) )
         return;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/StorylineTextTable.cpp	Sun Feb 17 20:54:07 2013 +0600
@@ -0,0 +1,81 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "LOD.h"
+#include "allocator.h"
+#include "texts.h"
+#include "StorylineTextTable.h"
+
+char *pHistoryTXT_Raw;
+struct StorylineText *pStorylineText;  
+
+//----- (00453E6D) --------------------------------------------------------
+void StorylineText::Initialize()
+{
+  char *v1; // ebx@1
+  StorylineText *v2; // esi@1
+  char *v3; // ecx@4
+  char v4; // dl@5
+  char *v5; // eax@5
+  int v6; // esi@9
+  int v7; // [sp+Ch] [bp-10h]@3
+  int v8; // [sp+10h] [bp-Ch]@4
+  char *v9; // [sp+14h] [bp-8h]@4
+  int Str; // [sp+18h] [bp-4h]@3
+  int i,j;
+	char* test_string;
+	unsigned char c;
+	bool break_loop;
+	unsigned int temp_str_len;
+	char* tmp_pos;
+	int decode_step;
+  v1 = 0;
+  v2 = this;
+  if ( pHistoryTXT_Raw )
+    pAllocator->FreeChunk(pHistoryTXT_Raw);
+  pHistoryTXT_Raw = NULL;
+  pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0);
+  strtok(pHistoryTXT_Raw, "\r");
+
+  for (i=0;i<29;++i)
+		{
+		test_string = strtok(NULL, "\r") + 1;
+		break_loop = false;
+		decode_step=0;
+		do 
+			{
+			c = *(unsigned char*)test_string;
+			temp_str_len = 0;
+			while((c!='\t')&&(c>0))
+				{
+				++temp_str_len;
+				c=test_string[temp_str_len];
+				}		
+			tmp_pos=test_string+temp_str_len;
+			if (*tmp_pos == 0)
+				break_loop = true;
+			*tmp_pos = 0;
+			if (temp_str_len)
+				{
+				switch (decode_step)
+					{
+				case 1: 
+					StoreLine[i+1].pText=RemoveQuotes(test_string);
+					break;
+				case 2:
+					StoreLine[i+1].uTime=atoi(test_string);  //strange but in text here string not digit
+					break;
+				case 3:
+					StoreLine[i+1].pPageTitle=RemoveQuotes(test_string);
+					break;
+					}
+				}
+			else
+				{ 
+					break_loop = true;
+				}
+			++decode_step;
+			test_string=tmp_pos+1;
+			} while ((decode_step<4)&&!break_loop);
+		}
+}
\ No newline at end of file
--- a/StorylineTextTable.h	Sun Feb 17 20:53:53 2013 +0600
+++ b/StorylineTextTable.h	Sun Feb 17 20:54:07 2013 +0600
@@ -1,15 +1,27 @@
 #pragma once
 
-
+#pragma pack(push, 1)
+struct StorylineRecord
+{
+  char* pText; //0
+  char* pPageTitle; //4
+  unsigned __int8 uTime; //8
+  char f_9;
+  char f_A;
+  char f_B;
+};
+#pragma pack(pop)
 
-
-/*  173 */
+/*  173 */  
 #pragma pack(push, 1)
 struct StorylineText
 {
   void Initialize();
-
-  int field_0;
-  int field_4[87];
+  StorylineRecord StoreLine[30];
+  //int field_0;
+ // int field_4[87];
 };
 #pragma pack(pop)
+
+extern char *pHistoryTXT_Raw;
+extern struct StorylineText *pStorylineText;
\ No newline at end of file
--- a/mm7_2.cpp	Sun Feb 17 20:53:53 2013 +0600
+++ b/mm7_2.cpp	Sun Feb 17 20:54:07 2013 +0600
@@ -9241,86 +9241,6 @@
 
 
 
-//----- (00453E6D) --------------------------------------------------------
-void StorylineText::Initialize()
-{
-  char *v1; // ebx@1
-  StorylineText *v2; // esi@1
-  char *v3; // ecx@4
-  char v4; // dl@5
-  char *v5; // eax@5
-  int v6; // esi@9
-  int v7; // [sp+Ch] [bp-10h]@3
-  int v8; // [sp+10h] [bp-Ch]@4
-  char *v9; // [sp+14h] [bp-8h]@4
-  int Str; // [sp+18h] [bp-4h]@3
-
-  v1 = 0;
-  v2 = this;
-  if ( pHistoryTXT_Raw )
-    pAllocator->FreeChunk(pHistoryTXT_Raw);
-  pHistoryTXT_Raw = 0;
-  pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0);
-  strtok(pHistoryTXT_Raw, "\r");
-  Str = (int)&v2->field_4[4];
-  v7 = 29;
-  do
-  {
-    v9 = v1;
-    v8 = (signed int)v1;
-    v3 = strtok(v1, "\r");
-    do
-    {
-      v4 = *v3;
-      v5 = 0;
-      if ( *v3 != 9 )
-      {
-        v1 = 0;
-        do
-        {
-          if ( !v4 )
-            break;
-          ++v5;
-          v4 = v3[(int)v5];
-        }
-        while ( v4 != 9 );
-      }
-      v6 = (int)&v3[(int)v5];
-      if ( v3[(int)v5] == (char)v1 )
-        v8 = 1;
-      *(char *)v6 = (char)v1;
-      if ( v5 == v1 )
-      {
-        v8 = 1;
-      }
-      else
-      {
-        if ( v9 == (char *)1 )
-        {
-          *(char **)(Str - 8) = RemoveQuotes(v3);
-        }
-        else
-        {
-          if ( v9 == (char *)2 )
-          {
-            *(char *)Str = atoi(v3);
-          }
-          else
-          {
-            if ( v9 - 2 == (char *)1 )
-              *(char * *)(Str - 4) = RemoveQuotes(v3);
-          }
-        }
-      }
-      ++v9;
-      v3 = (char *)(v6 + 1);
-    }
-    while ( (signed int)(v9 - 1) <= 3 && (char *)v8 == v1 );
-    Str += 12;
-    --v7;
-  }
-  while ( v7 );
-}
 
 //----- (00453F62) --------------------------------------------------------
 void MapStats::Initialize()
--- a/mm7_5.cpp	Sun Feb 17 20:53:53 2013 +0600
+++ b/mm7_5.cpp	Sun Feb 17 20:54:07 2013 +0600
@@ -13533,7 +13533,7 @@
     a1.uFrameX = 8;
     a1.uFrameY = 8;
     a1.uFrameHeight = 344;
-    v3 = (const char *)pStorylineText->field_4[3 * v2];
+    v3 = (const char *)pStorylineText->StoreLine[v2].pText;//field_4[];
     a1.uFrameZ = 467;
     a1.uFrameW = 351;
     if ( v3 )
@@ -13569,9 +13569,9 @@
   v6 = pStru179.field_0[dword_506528];
   dword_506548 = 0;
   dword_506520 = 0;
-  v7 = *(&pStorylineText->field_0 + 3 * v6);
+  v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
   v8 = sub_495461(
-         *((char **)&pStorylineText->field_0 + 3 * v6),
+         pStorylineText->StoreLine[v6].pText,
          uActiveCharacter - 1,
          0,
          0,
--- a/mm7_data.cpp	Sun Feb 17 20:53:53 2013 +0600
+++ b/mm7_data.cpp	Sun Feb 17 20:54:07 2013 +0600
@@ -1750,7 +1750,7 @@
 char *pClassTXT_Raw;
 char *pStatsTXT_Raw;
 char *pSkillDescTXT_Raw;
-struct StorylineText *pStorylineText;
+
 struct FactionTable *pFactionTable;
 char byte_5C8D1A[777]; // weak
 
@@ -1764,7 +1764,7 @@
 char *pHostileTXT_Raw;
 char *pPotionsTXT_Raw;
 char *pPotionNotesTXT_Raw;
-char *pHistoryTXT_Raw;
+
 int _6807B8_level_decorations_ids[777]; // idb
 int _6807E0_num_decorations_with_sounds_6807B8; // weak
 int _6807E8_level_decorations_ids[777]; // idb
--- a/mm7_data.h	Sun Feb 17 20:53:53 2013 +0600
+++ b/mm7_data.h	Sun Feb 17 20:54:07 2013 +0600
@@ -1411,7 +1411,7 @@
 extern char *pClassTXT_Raw;
 extern char *pStatsTXT_Raw;
 extern char *pSkillDescTXT_Raw;
-extern struct StorylineText *pStorylineText;
+
 extern struct FactionTable *pFactionTable;
 extern char byte_5C8D1A[]; // weak
 
@@ -1425,7 +1425,7 @@
 extern char *pHostileTXT_Raw;
 extern char *pPotionsTXT_Raw;
 extern char *pPotionNotesTXT_Raw;
-extern char *pHistoryTXT_Raw;
+
 extern int _6807B8_level_decorations_ids[]; // idb
 extern int _6807E0_num_decorations_with_sounds_6807B8; // weak
 extern int _6807E8_level_decorations_ids[]; // idb