changeset 351:5f36449527c6

stru351 -> summoned/spell-enchanted item
author Nomad
date Thu, 21 Feb 2013 03:04:08 +0200
parents 77601b0fb14b
children ec6cc5cefa4b
files Party.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_data.cpp mm7_data.h stru272.h stru351.h
diffstat 9 files changed, 53 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Thu Feb 21 02:13:46 2013 +0200
+++ b/Party.cpp	Thu Feb 21 03:04:08 2013 +0200
@@ -888,7 +888,7 @@
   //unsigned int v10; // edi@62
   //signed int v11; // [sp+0h] [bp-4h]@2
 
-  if (dword_A75070 == stru_51076C.field_8)
+  if (dword_A75070 == stru_51076C.field_8) // stru_51076C.field_8 is incremented each time after this function is called, so this is useless
     return;
 
   dword_A75070 = stru_51076C.field_8;
--- a/mm7_1.cpp	Thu Feb 21 02:13:46 2013 +0200
+++ b/mm7_1.cpp	Thu Feb 21 03:04:08 2013 +0200
@@ -49,6 +49,7 @@
 #include "StorylineTextTable.h"
 #include "Events2D.h"
 #include "texts.h"
+#include "stru351.h"
 
 #include "mm7_data.h"
 
@@ -2356,12 +2357,13 @@
   //char v64[100]; // [sp+D0h] [bp-1A8h]@40
   char v65[120]; // [sp+134h] [bp-144h]@92
   char Source[40]; // [sp+1ACh] [bp-CCh]@49
-  int v67; // [sp+1D4h] [bp-A4h]@91
-  int v68; // [sp+1D8h] [bp-A0h]@106
-  int v69; // [sp+1DCh] [bp-9Ch]@101
-  int v70; // [sp+1E0h] [bp-98h]@97
-  int v71; // [sp+1E8h] [bp-90h]@93
-  int v72; // [sp+1ECh] [bp-8Ch]@91
+  stru351_summoned_item v67;
+  //int v67; // [sp+1D4h] [bp-A4h]@91
+  //int v68; // [sp+1D8h] [bp-A0h]@106
+  //int v69; // [sp+1DCh] [bp-9Ch]@101
+  //int v70; // [sp+1E0h] [bp-98h]@97
+  //int v71; // [sp+1E8h] [bp-90h]@93
+  //int v72; // [sp+1ECh] [bp-8Ch]@91
   int var88; // [sp+1F0h] [bp-88h]@1
   Texture *v73; // [sp+1F4h] [bp-84h]@5
   //unsigned int v75; // [sp+1F8h] [bp-80h]@5
@@ -2656,21 +2658,21 @@
       {
         if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) )
         {
-          sub_493F79((stru351 *)&v67, _this->uExpireTime - pParty->uTimePlayed);
+          sub_493F79(&v67, _this->uExpireTime - pParty->uTimePlayed);
           strcpy(pTmpBuf, "Duration:");
-          Str = (char *)(v72 - 1168);
-          if ( v72 != 1168 )
+          Str = (char *)(v67.field_18_expire_year - 1168);
+          if (v67.field_18_expire_year != 1168 )
           {
-            sprintf(v65, " %d:yr", v72 - 1168);
+            sprintf(v65, " %d:yr", v67.field_18_expire_year - 1168);
             strcat(pTmpBuf, v65);
           }
-          if ( (((v71 || Str) && ((sprintf(v65, " %d:mo", v71), strcat(pTmpBuf, v65), v71) || Str) || v70)
-             && ((sprintf(v65, " %d:dy", v70), strcat(pTmpBuf, v65), v71) || Str || v70)
-             || v69)
-            && ((sprintf(v65, " %d:hr", v69), strcat(pTmpBuf, v65), v71) || Str || v70 || v69)
-            || v68 )
+          if ( (((v67.field_14_exprie_month || Str) && ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str) || v67.field_C_expire_day)
+             && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || v67.field_C_expire_day)
+             || v67.field_8_expire_hour)
+            && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || v67.field_C_expire_day || v67.field_8_expire_hour)
+            || v67.field_4_expire_minute )
           {
-            sprintf(v65, " %d:mn", v68);
+            sprintf(v65, " %d:mn", v67.field_4_expire_minute);
             strcat(pTmpBuf, v65);
           }
           v79.DrawText(v82, 100, v79.uFrameHeight - 2 * LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0);
--- a/mm7_2.cpp	Thu Feb 21 02:13:46 2013 +0200
+++ b/mm7_2.cpp	Thu Feb 21 03:04:08 2013 +0200
@@ -12972,6 +12972,7 @@
     return false;
   }
   
+  game_starting_year = 1168;
 
   pParty = new Party;
   memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings));
--- a/mm7_3.cpp	Thu Feb 21 02:13:46 2013 +0200
+++ b/mm7_3.cpp	Thu Feb 21 03:04:08 2013 +0200
@@ -9541,14 +9541,7 @@
   }
   return 0;
 }
-// 4D864C: using guessed type char byte_4D864C;
-// 6BE0E4: using guessed type int mipmapping_building_mm1;
-// 6BE0E8: using guessed type int mipmapping_building_mm2;
-// 6BE0EC: using guessed type int mipmapping_building_mm3;
-// 80AA14: using guessed type int dword_80AA14;
-// 80AA18: using guessed type int dword_80AA18;
-// 80AA1C: using guessed type int dword_80AA1C;
-// 80AA20: using guessed type int dword_80AA20;
+
 
 //----- (004839BD) --------------------------------------------------------
 signed int __fastcall sr_sub_4839BD(Span *ecx0, unsigned __int16 *pTargetSurface)
--- a/mm7_4.cpp	Thu Feb 21 02:13:46 2013 +0200
+++ b/mm7_4.cpp	Thu Feb 21 03:04:08 2013 +0200
@@ -3728,29 +3728,26 @@
 
 
 //----- (00493F79) --------------------------------------------------------
-int sub_493F79(stru351 *_this, __int64 a2)
+void sub_493F79(stru351_summoned_item *_this, __int64 a2)
 {
   signed __int64 v2; // ST2C_8@1
   signed __int64 v3; // qax@1
-  signed __int64 v4; // ST1C_8@1
+  //signed __int64 v4; // ST1C_8@1
   unsigned __int64 v5; // qax@1
   unsigned int v6; // ebx@1
-  int result; // eax@1
 
   v2 = (signed __int64)((double)a2 * 0.234375);
   v3 = v2 / 60 / 60;
-  v4 = v3;
+  //v4 = v3;
   v5 = (unsigned int)v3 / 0x18;
   v6 = (unsigned int)(v5 / 7) >> 2;
-  _this->field_0 = v2 % 60;
-  _this->field_4 = v2 / 60 % 60;
-  _this->field_8 = v4 % 24;
-  _this->field_10 = v5 / 7 & 3;
-  _this->field_C = (unsigned int)v5 % 0x1C;
-  result = v6 / 0xC + 1168;
-  _this->field_14 = v6 % 0xC;
-  _this->field_18 = result;
-  return result;
+  _this->field_0_expire_second = v2 % 60;
+  _this->field_4_expire_minute = v2 / 60 % 60;
+  _this->field_8_expire_hour = v3 % 24;
+  _this->field_10_expire_week = v5 / 7 & 3;
+  _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
+  _this->field_14_exprie_month = v6 % 0xC;
+  _this->field_18_expire_year = v6 / 0xC + 1168;
 }
 
 
@@ -4889,8 +4886,8 @@
   int v53; // [sp-4h] [bp-13Ch]@107
   int v54; // [sp+0h] [bp-138h]@107
   __int16 v55[56]; // [sp+10h] [bp-128h]@34
-  stru351 v56; // [sp+80h] [bp-B8h]@107
-  stru351 v57; // [sp+9Ch] [bp-9Ch]@115
+  stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
+  stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115
   char a1[100]; // [sp+B8h] [bp-80h]@3
   unsigned int v59; // [sp+11Ch] [bp-1Ch]@3
   //size_t v60; // [sp+120h] [bp-18h]@3
@@ -5239,9 +5236,9 @@
                 if ( !a6 )
       goto _continue_strcat;
     sub_493F79(&v57, *a6);
-    v54 = v57.field_18;
-    v53 = v57.field_C + 1;
-    v50 = v57.field_14;
+    v54 = v57.field_18_expire_year;
+    v53 = v57.field_C_expire_day + 1;
+    v50 = v57.field_14_exprie_month;
     sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
     v11 = a1;
     goto _continue_strcat;
@@ -5263,9 +5260,9 @@
             HIDWORD(v49) = pParty->field_3C.field_440[2 * v17 + 1];
             LODWORD(v49) = pParty->field_3C.field_440[2 * v17];
             sub_493F79(&v56, v49);
-            v54 = v56.field_18;
-            v53 = v56.field_C + 1;
-            v50 = v56.field_14;
+            v54 = v56.field_18_expire_year;
+            v53 = v56.field_C_expire_day + 1;
+            v50 = v56.field_14_exprie_month;
             sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
             v11 = a1;
             goto _continue_strcat;
--- a/mm7_data.cpp	Thu Feb 21 02:13:46 2013 +0200
+++ b/mm7_data.cpp	Thu Feb 21 03:04:08 2013 +0200
@@ -509,6 +509,8 @@
 //-------------------------------------------------------------------------
 // Data declarations
 
+int game_starting_year = 0;
+
 int pWindowList_at_506F50_minus1_indexing[1];
 int dword_4C9890[10]; // weak
 int dword_4C9920[16]; // weak
--- a/mm7_data.h	Thu Feb 21 02:13:46 2013 +0200
+++ b/mm7_data.h	Thu Feb 21 03:04:08 2013 +0200
@@ -311,6 +311,8 @@
 //-------------------------------------------------------------------------
 // Data declarations
 
+extern int game_starting_year;
+
 extern int pWindowList_at_506F50_minus1_indexing[1];
 extern int dword_4C9890[10]; // weak
 extern int dword_4C9920[16]; // weak
@@ -2248,7 +2250,7 @@
 signed int __thiscall CycleCharacter(unsigned int _this);
 void __fastcall Rest(unsigned int uHoursToSleep);
 int __cdecl _493938_regenerate();
-int __thiscall sub_493F79(struct stru351 *_this, __int64 a2);
+void sub_493F79(struct stru351_summoned_item *_this, __int64 a2);
 void __cdecl _494035_timed_effects__water_walking_damage__etc();
 unsigned int __fastcall sub_494820(unsigned int a1);
 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2);
--- a/stru272.h	Thu Feb 21 02:13:46 2013 +0200
+++ b/stru272.h	Thu Feb 21 03:04:08 2013 +0200
@@ -4,7 +4,7 @@
 
 /*  270 */
 #pragma pack(push, 1)
-struct stru272_stru0
+struct stru272_stru0         // ARCOMAGE stuff
 {
   int _40DFFE();
   int _40E01A(int a2);
--- a/stru351.h	Thu Feb 21 02:13:46 2013 +0200
+++ b/stru351.h	Thu Feb 21 03:04:08 2013 +0200
@@ -3,14 +3,14 @@
 
 /*  391 */
 #pragma pack(push, 1)
-struct stru351
+struct stru351_summoned_item
 {
-  int field_0;
-  int field_4;
-  int field_8;
-  int field_C;
-  int field_10;
-  int field_14;
-  int field_18;
+  int field_0_expire_second;
+  int field_4_expire_minute;
+  int field_8_expire_hour;
+  int field_C_expire_day;
+  int field_10_expire_week;
+  int field_14_exprie_month;
+  int field_18_expire_year;
 };
 #pragma pack(pop)
\ No newline at end of file