diff mm7_4.cpp @ 492:0e27362ac1d9

guild
author Gloval
date Thu, 28 Feb 2013 01:38:46 +0400
parents d5da524ec901
children 59649750a054
line wrap: on
line diff
--- a/mm7_4.cpp	Wed Feb 27 22:48:10 2013 +0400
+++ b/mm7_4.cpp	Thu Feb 28 01:38:46 2013 +0400
@@ -5011,7 +5011,7 @@
                 v24 = v23;
                 dword_A74CDC = v23;
               }
-              v11 = (char *)pAwards[v55[v24]-1].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
+              v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
             }
             else
             {
@@ -9503,20 +9503,20 @@
           Party::TakeGold(gold_transaction_amount);
           if ( uActiveCharacter )
           {
-            v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards];
+            v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
             *(short *)v12 &= 0x3Fu;
             switch ( dword_F8B1B0 )
             {
               case 2:
-                v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards];
+                v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
                 *v15 |= 0x40u;
                 break;
               case 3:
-                v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards];
+                v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
                 *v14 |= 0x80u;
                 break;
               case 4:
-                v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards];
+                v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
                 v13[1] |= 1u;
                 break;
             }
@@ -9534,13 +9534,13 @@
       }
       else
       {
-        if ( uMessageParam == 82 && contract_approved )
+        if ( uMessageParam == 82 && contract_approved ) //join guild
         {
           Party::TakeGold(gold_transaction_amount);
           v4 = pParty->pPlayers;
           do
           {
-            v4->SetVariable(VAR_Award, dword_F8B1AC_something_todo_with_awards);
+            v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number);
             ++v4;
           }
           while ( (signed int)v4 < (signed int)pParty->pHirelings );
@@ -9699,7 +9699,7 @@
   v3 = (_this - 200) / 3;
   v4 = v2;
   v35 = (char *)pNPCTopics[127].pText;
-  dword_F8B1AC_something_todo_with_awards = v3;
+  dword_F8B1AC_award_bit_number = v3;
   if ( v2 )
   {
     if ( v2 == 1 )
@@ -9795,8 +9795,8 @@
     {
       if ( (signed int)v16 >= 2 && v7 >= 7 )
       {
-        v17 = dword_F8B1AC_something_todo_with_awards;
-        switch ( dword_F8B1AC_something_todo_with_awards )
+        v17 = dword_F8B1AC_award_bit_number;
+        switch ( dword_F8B1AC_award_bit_number )
         {
           default:
             goto LABEL_41;
@@ -9858,13 +9858,13 @@
       if ( v34 != 4 )
       {
 LABEL_40:
-        v17 = dword_F8B1AC_something_todo_with_awards;
+        v17 = dword_F8B1AC_award_bit_number;
         goto LABEL_41;
       }
       if ( (signed int)v16 >= 3 && v7 >= 10 )
       {
-        v17 = dword_F8B1AC_something_todo_with_awards;
-        switch ( dword_F8B1AC_something_todo_with_awards )
+        v17 = dword_F8B1AC_award_bit_number;
+        switch ( dword_F8B1AC_award_bit_number )
         {
           case 19:
             if ( v1->_49327B(0x22u, 1) == 1 )
@@ -9921,12 +9921,12 @@
   }
   if ( v7 < 4 )
     return v35;
-  v17 = dword_F8B1AC_something_todo_with_awards;
-  if ( dword_F8B1AC_something_todo_with_awards > 27 )
-  {
-    if ( dword_F8B1AC_something_todo_with_awards != 29
-      && dword_F8B1AC_something_todo_with_awards != 32
-      && (dword_F8B1AC_something_todo_with_awards <= 33 || dword_F8B1AC_something_todo_with_awards > 35) )
+  v17 = dword_F8B1AC_award_bit_number;
+  if ( dword_F8B1AC_award_bit_number > 27 )
+  {
+    if ( dword_F8B1AC_award_bit_number != 29
+      && dword_F8B1AC_award_bit_number != 32
+      && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) )
     {
 LABEL_41:
       if ( !gold_transaction_amount )
@@ -9937,18 +9937,18 @@
     gold_transaction_amount = 500;
     goto LABEL_41;
   }
-  if ( dword_F8B1AC_something_todo_with_awards >= 23 )
+  if ( dword_F8B1AC_award_bit_number >= 23 )
     goto LABEL_87;
-  if ( dword_F8B1AC_something_todo_with_awards == 7 )
+  if ( dword_F8B1AC_award_bit_number == 7 )
   {
     gold_transaction_amount = 0;
     goto LABEL_79;
   }
-  if ( dword_F8B1AC_something_todo_with_awards <= 7 )
+  if ( dword_F8B1AC_award_bit_number <= 7 )
     goto LABEL_41;
-  if ( dword_F8B1AC_something_todo_with_awards > 18 )
-  {
-    if ( dword_F8B1AC_something_todo_with_awards != 21 )
+  if ( dword_F8B1AC_award_bit_number > 18 )
+  {
+    if ( dword_F8B1AC_award_bit_number != 21 )
       goto LABEL_41;
     goto LABEL_87;
   }
@@ -9986,33 +9986,34 @@
 
 
 //----- (004B29F2) --------------------------------------------------------
-const char *__fastcall ContractSelectText(int pEventNumber)
-{
+const char * ContractSelectText( int pEventCode )
+	{
+static const int dialogue_base=110;
   contract_approved = 0;
-  dword_F8B1AC_something_todo_with_awards = pEventNumber + 50;
-  gold_transaction_amount = price_for_membership[pEventNumber];
+  dword_F8B1AC_award_bit_number = pEventCode + 50;
+  gold_transaction_amount = price_for_membership[pEventCode];
   if ( pPlayers[uActiveCharacter]->CanAct() )
   {
-    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_something_todo_with_awards) )
-    {
-      return pNPCTopics[123].pText;
+    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) )
+    {
+      return pNPCTopics[dialogue_base+13].pText;
     }
     else
     {
       if ( gold_transaction_amount <= pParty->uNumGold )
       {
         contract_approved = 1;
-        return pNPCTopics[pEventNumber + 110].pText;
+        return pNPCTopics[pEventCode + dialogue_base].pText;
       }
       else
       {
-        return pNPCTopics[124].pText; 
+        return pNPCTopics[dialogue_base+14].pText; 
       }
     }
   }
   else
   {
-    return pNPCTopics[122].pText; 
+    return pNPCTopics[dialogue_base+12].pText; 
   }
 }
 
@@ -10622,13 +10623,13 @@
 }
 
 //----- (004B3EF0) --------------------------------------------------------
-void __fastcall DrawJoinGuildWindow(int pEventNumber)
-{
+void DrawJoinGuildWindow( int pEventCode )
+	{
   uDialogueType = 81;//enum JoinGuildDialog
-  ptr_F8B1E8 = (char *)pNPCTopics[pEventNumber + 99].pText;
-  ContractSelectText(pEventNumber);
+  ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText;
+  ContractSelectText(pEventCode);
   pDialogueWindow->Release();
-  pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventNumber, 0);
+  pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0);
   pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34],
                  (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0);
   pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
@@ -10651,16 +10652,7 @@
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0);
   v2 = "";
-  pBtn_ExitCancel = pDialogueWindow->CreateButton(
-                 0x1D7u,
-                 0x1BDu,
-                 0xA9u,
-                 0x23u,
-                 1,
-                 0,
-                 0x71u,
-                 0,
-                 0,
+  pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u,  0x23u,   1,  0, 0x71u, 0,   0,
                  pGlobalTXT_LocalizationStrings[34],
                  (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0),
                  0);
@@ -14383,7 +14375,7 @@
 	memset(byte_F8B148, 0, 16);
 	pRenderer->ClearZBuffer(0, 479);
 
-	if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour >=uOpenTime)||(pParty->uCurrentHour <=(uCloseTime - 1))))||
+	if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))||
 		((uCloseTime - 1 >  uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) 
 
 		{