changeset 981:a6ef7125f6e4

Autonotes & GameState
author Nomad
date Sat, 11 May 2013 01:28:06 +0200
parents a079c489118d
children 08fd1436ef35
files Autonotes.h GUIWindow.cpp Game.cpp Game.h Party.h Player.cpp UIBooks.cpp mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 10 files changed, 62 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/Autonotes.h	Thu May 09 21:19:59 2013 +0600
+++ b/Autonotes.h	Sat May 11 01:28:06 2013 +0200
@@ -6,21 +6,20 @@
 /*  351 */
 enum AUTONOTE_TYPE : __int32
 {
-  AUTONOTE_POTION_RECEPIE = 0x0,
-  AUTONOTE_STAT_HINT = 0x1,
-  AUTONOTE_OBELISK = 0x2,
-  AUTONOTE_SEER = 0x3,
-  AUTONOTE_MISC = 0x4,
-  AUTONOTE_TEACHER = 0x5,
+  AUTONOTE_POTION_RECEPIE = 0,
+  AUTONOTE_STAT_HINT = 1,
+  AUTONOTE_OBELISK = 2,
+  AUTONOTE_SEER = 3,
+  AUTONOTE_MISC = 4,
+  AUTONOTE_TEACHER = 5,
 };
 
 /*  350 */
 #pragma pack(push, 1)
 struct Autonote
 {
-  const char *pText;
-  enum AUTONOTE_TYPE eType;
+  const char    *pText;
+  AUTONOTE_TYPE  eType;
 };
 #pragma pack(pop)
 extern Autonote pAutonoteTxt[195]; // weak
-
--- a/GUIWindow.cpp	Thu May 09 21:19:59 2013 +0600
+++ b/GUIWindow.cpp	Sat May 11 01:28:06 2013 +0200
@@ -577,6 +577,8 @@
       num_achieved_awards_2 = v12;
       }
       break;
+
+
   case WINDOW_AutonotesBook:
       {
       pTexture_AutonotesBook   = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE);
@@ -612,7 +614,7 @@
       num_achieved_awards = 0;
       while ( v10 < 196 )
           {
-          if ( dword_506568 == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] )
+          if ( _506568_autonote_type == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] )
               {
               //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10];
               v25 = (char *)pAutonoteTxt[v10-1].pText;
--- a/Game.cpp	Thu May 09 21:19:59 2013 +0600
+++ b/Game.cpp	Sat May 11 01:28:06 2013 +0200
@@ -256,8 +256,8 @@
   signed int pNewNPCsCount; // ecx@58
   char *pFlags; // eax@59
   Player *pPlayer; // esi@65
-  OtherOverlay *pOtherOverlay; // esi@67
-  signed int v8; // edi@67
+  //OtherOverlay *pOtherOverlay; // esi@67
+  //signed int v8; // edi@67
   int pPlayerNum; // edi@69
   int *pHealth; // esi@71
   signed int v11; // esi@78
@@ -373,7 +373,7 @@
         pMiscTimer->Resume();
       if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn )
         pEventTimer->bTackGameTime = 0;
-      if ( !pEventTimer->bPaused && !uGameState )
+      if ( !pEventTimer->bPaused && uGameState == GAME_STATE_0)
       {
         if ( !pEventTimer->bTackGameTime )
           _494035_timed_effects__water_walking_damage__etc();
@@ -418,19 +418,21 @@
         bLoadinga = 1;
         continue;
       }
-      if ( uGameState != GAME_STATE_8 )
+      if ( uGameState != GAME_STATE_PARTY_DIED )
       {
         if ( uGameState != GAME_STATE_FINAL_WINDOW )
         {
 //LABEL_85:
           pGame->Draw();
-          continue;
         }
-        pRenderer->BeginScene();
-        GUI_UpdateWindows();
-        pRenderer->EndScene();
-        //goto LABEL_89;
-        pRenderer->Present();
+        else
+        {
+          pRenderer->BeginScene();
+          GUI_UpdateWindows();
+          pRenderer->EndScene();
+          //goto LABEL_89;
+          pRenderer->Present();
+        }
         continue;
       }
       pAudioPlayer->StopChannels(-1, -1);//далее в случае смерти группы
@@ -465,15 +467,9 @@
       pParty->uTimePlayed += 0x276000ui64;
       LOWORD(pParty->uFlags) &= ~0x204;
       pParty->SetGold(0);
-      pOtherOverlay = pOtherOverlayList->pOverlays;
-      v8 = 50;
-      do
-      {
-        pOtherOverlay->Reset();
-        ++pOtherOverlay;
-        --v8;
-      }
-      while ( v8 );
+
+      pOtherOverlayList->Reset();
+
       memset(pParty->pPartyBuffs, 0, 0x140u);
       pPlayerNum = 1;
       if ( pParty->bTurnBasedModeOn == 1 )
@@ -493,7 +489,7 @@
         uActiveCharacter = 1;
       }
     //  while ( (signed int)pHealth < (signed int)&pParty->field_871C[567] );
-      if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 136) )
+      if (_449B57_test_bit(pParty->_quest_bits, PARTY_QUEST_FINISHED_EMERALD_ISLE))
       {
         pParty->vPosition.x = -17331;            // respawn in harmondale
         pParty->vPosition.y = 12547;
--- a/Game.h	Thu May 09 21:19:59 2013 +0600
+++ b/Game.h	Sat May 11 01:28:06 2013 +0200
@@ -27,17 +27,17 @@
 /*  320 */
 enum GAME_STATE
 {
-  GAME_STATE_0 = 0x0,
-  GAME_FINISHED = 0x1,
-  GAME_STATE_2 = 0x2,
-  GAME_STATE_3 = 0x3,
-  GAME_STATE_NEWGAME_OUT_GAMEMENU = 0x4,
-  GAME_STATE_5 = 0x5,
-  GAME_STATE_6 = 0x6,
+  GAME_STATE_0 = 0,
+  GAME_FINISHED = 1,
+  GAME_STATE_2 = 2,
+  GAME_STATE_3 = 3,
+  GAME_STATE_NEWGAME_OUT_GAMEMENU = 4,
+  GAME_STATE_5 = 5,
+  GAME_STATE_6 = 6,
   GAME_STATE_GAME_QUITTING_TO_MAIN_MENU = 7,
-  GAME_STATE_8 = 0x8,
-  GAME_STATE_FINAL_WINDOW = 0x9,
-  GAME_STATE_A = 0xA
+  GAME_STATE_PARTY_DIED = 8,
+  GAME_STATE_FINAL_WINDOW = 9,
+  GAME_STATE_A = 10
 };
 
 
--- a/Party.h	Thu May 09 21:19:59 2013 +0600
+++ b/Party.h	Sat May 11 01:28:06 2013 +0200
@@ -11,6 +11,7 @@
 enum PARTY_QUEST_BITS: unsigned __int32
 {
   PARTY_QUEST_EVENMORN_MAP_FOUND = 64,
+  PARTY_QUEST_FINISHED_EMERALD_ISLE = 136,
   PARTY_QUEST_FOUNTAIN_HARMONDALE = 206,
   PARTY_QUEST_FOUNTAIN_NIGHON = 207,
   PARTY_QUEST_FOUNTAIN_PIERPONT = 208,
--- a/Player.cpp	Thu May 09 21:19:59 2013 +0600
+++ b/Player.cpp	Sat May 11 01:28:06 2013 +0200
@@ -8473,7 +8473,7 @@
       v20->PlaySound(SPEECH_96, 0);
 	  v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
       bFlashAutonotesBook = 1;
-      dword_506568 = v21;
+      _506568_autonote_type = v21;
     }
     _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
     v31 = 1;
@@ -9272,7 +9272,7 @@
       v23->PlaySound(SPEECH_96, 0);
 	  v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val];
       bFlashAutonotesBook = 1;
-      dword_506568 = v24;
+      _506568_autonote_type = v24;
     }
     _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u);
     v3 = 1;
--- a/UIBooks.cpp	Thu May 09 21:19:59 2013 +0600
+++ b/UIBooks.cpp	Sat May 11 01:28:06 2013 +0200
@@ -648,7 +648,7 @@
   pRenderer->DrawTextureTransparent(v1, v18, v25);
   if ( !dword_506540 )
   {
-    if ( dword_506568 )
+    if (_506568_autonote_type != AUTONOTE_POTION_RECEPIE)
     {
       pRenderer->DrawTextureTransparent(
         pViewport->uViewportTL_X + 408,
@@ -659,7 +659,7 @@
     }
     goto LABEL_14;
   }
-  if ( !dword_506568 )
+  if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)
   {
 LABEL_14:
     v2 = 1;
@@ -669,12 +669,12 @@
   v31 = 1;
   pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
 LABEL_15:
-  dword_506568 = 0;
+  _506568_autonote_type = AUTONOTE_POTION_RECEPIE;
   pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394);
 LABEL_16:
   if ( dword_50653C )
   {
-    if ( dword_506568 != v2 )
+    if ( _506568_autonote_type != v2 )
     {
       v31 = v2;
       pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
@@ -682,7 +682,7 @@
   }
   else
   {
-    if ( dword_506568 != v2 )
+    if ( _506568_autonote_type != v2 )
     {
       v26 = pTexture_506388;
       v19 = pViewport->uViewportTL_Y + 150;
@@ -691,14 +691,14 @@
     }
   }
   v26 = pTexture_50638C;
-  dword_506568 = v2;
+  _506568_autonote_type = v2;
   v19 = pViewport->uViewportTL_Y + 150;
   v3 = pViewport->uViewportTL_X + 399;
 LABEL_22:
   pRenderer->DrawTextureTransparent(v3, v19, v26);
   if ( dword_506538 )
   {
-    if ( dword_506568 != 2 )
+    if ( _506568_autonote_type != AUTONOTE_OBELISK)
     {
       v31 = v2;
       pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
@@ -706,7 +706,7 @@
   }
   else
   {
-    if ( dword_506568 != 2 )
+    if ( _506568_autonote_type != AUTONOTE_OBELISK)
     {
       v27 = pTexture_506380;
       v20 = pViewport->uViewportTL_Y + 188;
@@ -715,14 +715,14 @@
     }
   }
   v27 = pTexture_506384;
-  dword_506568 = 2;
+  _506568_autonote_type = AUTONOTE_OBELISK;
   v20 = pViewport->uViewportTL_Y + 188;
   v4 = pViewport->uViewportTL_X + 397;
 LABEL_28:
   pRenderer->DrawTextureTransparent(v4, v20, v27);
   if ( dword_506534 )
   {
-    if ( dword_506568 != 3 )
+    if ( _506568_autonote_type != AUTONOTE_SEER)
     {
       v31 = v2;
       pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
@@ -730,7 +730,7 @@
   }
   else
   {
-    if ( dword_506568 != 3 )
+    if ( _506568_autonote_type != AUTONOTE_SEER)
     {
       v28 = pTexture_506378;
       v21 = pViewport->uViewportTL_Y + 226;
@@ -739,14 +739,14 @@
     }
   }
   v28 = pTexture_50637C;
-  dword_506568 = 3;
+  _506568_autonote_type = AUTONOTE_SEER;
   v21 = pViewport->uViewportTL_Y + 226;
   v5 = pViewport->uViewportTL_X + 397;
 LABEL_34:
   pRenderer->DrawTextureTransparent(v5, v21, v28);
   if ( dword_506530 )
   {
-    if ( dword_506568 != 4 )
+    if ( _506568_autonote_type != AUTONOTE_MISC)
     {
       v31 = v2;
       pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
@@ -754,7 +754,7 @@
   }
   else
   {
-    if ( dword_506568 != 4 )
+    if ( _506568_autonote_type != AUTONOTE_MISC)
     {
       v29 = pTexture_506370;
       v22 = pViewport->uViewportTL_Y + 263;
@@ -763,14 +763,14 @@
     }
   }
   v29 = pTexture_506374;
-  dword_506568 = 4;
+  _506568_autonote_type = AUTONOTE_MISC;
   v22 = pViewport->uViewportTL_Y + 264;
   v6 = pViewport->uViewportTL_X + 397;
 LABEL_40:
   pRenderer->DrawTextureTransparent(v6, v22, v29);
   if ( dword_50652C )
   {
-    if ( dword_506568 != 5 )
+    if ( _506568_autonote_type != AUTONOTE_TEACHER)
     {
       v31 = v2;
       pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
@@ -778,7 +778,7 @@
   }
   else
   {
-    if ( dword_506568 != 5 )
+    if ( _506568_autonote_type != AUTONOTE_TEACHER)
     {
       v30 = pTexture_506368;
       v23 = pViewport->uViewportTL_Y + 302;
@@ -787,7 +787,7 @@
     }
   }
   v30 = pTexture_50636C;
-  dword_506568 = 5;
+  _506568_autonote_type = AUTONOTE_TEACHER;
   v23 = pViewport->uViewportTL_Y + 302;
   v7 = pViewport->uViewportTL_X + 397;
 LABEL_46:
@@ -815,7 +815,7 @@
     do
     {
       //if ( dword_72371C[2 * v8] == dword_506568 )
-	  if ( pAutonoteTxt[v8-1].eType == dword_506568 )
+	  if ( pAutonoteTxt[v8-1].eType == _506568_autonote_type )
       {
         //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8];
 		v32 = (char *)pAutonoteTxt[v8-1].pText;
--- a/mm7_4.cpp	Thu May 09 21:19:59 2013 +0600
+++ b/mm7_4.cpp	Sat May 11 01:28:06 2013 +0200
@@ -2794,7 +2794,7 @@
 LABEL_135:
     if ( pCurrentScreen != SCREEN_REST
       && (!v51 || dword_5C35C0) )
-      uGameState = GAME_STATE_8;
+      uGameState = GAME_STATE_PARTY_DIED;
   }
   if ( uActiveCharacter )
   {
--- a/mm7_data.cpp	Thu May 09 21:19:59 2013 +0600
+++ b/mm7_data.cpp	Sat May 11 01:28:06 2013 +0200
@@ -1502,7 +1502,7 @@
 int quick_spell_at_page; // weak
 char byte_506550; // weak
 char *aMoonPhaseNames[5];
-int dword_506568; // weak
+int _506568_autonote_type; // weak
 char bRecallingBeacon; // weak
 int uLastPointedObjectID; // weak
 //unsigned __int8 bMonsterInfoUI_bDollInitialized;
--- a/mm7_data.h	Thu May 09 21:19:59 2013 +0600
+++ b/mm7_data.h	Sat May 11 01:28:06 2013 +0200
@@ -930,7 +930,7 @@
 extern int quick_spell_at_page; // weak
 extern char byte_506550; // weak
 extern char *aMoonPhaseNames[5];
-extern int dword_506568; // weak
+extern int _506568_autonote_type; // 506568
 extern char bRecallingBeacon; // weak
 extern int uLastPointedObjectID; // weak
 //extern unsigned __int8 bMonsterInfoUI_bDollInitialized;