diff NPC.cpp @ 2463:0f17a30149ec

cleaning project part 1
author zipi
date Sun, 17 Aug 2014 15:13:18 +0100
parents 2a8010d99cf8
children 104fdbea0386
line wrap: on
line diff
--- a/NPC.cpp	Tue Aug 12 21:34:18 2014 +0300
+++ b/NPC.cpp	Sun Aug 17 15:13:18 2014 +0100
@@ -1297,286 +1297,6 @@
 		}
 	}
 
-//----- (004B2001) --------------------------------------------------------
-void __fastcall ClickNPCTopic(signed int uMessageParam)
-{
-  //signed int v1; // eax@1
-  NPCData *pCurrentNPCInfo; // ebp@1
-  int pEventNumber; // ecx@8
-  Player *v4; // esi@20
-  //int v5; // eax@28
-  //int v6; // eax@31
-  //int v7; // eax@34
-  //int v8; // eax@37
-  //int v9; // eax@40
-  //unsigned int v10; // eax@43
-  char *v12; // eax@53
-  char *v13; // eax@56
-  char *v14; // eax@57
-  char *v15; // eax@58
-  //unsigned int v16; // ebp@62
-  char *v17; // ecx@63
-  char *v18; // eax@65
-//  const char *v19; // ecx@68
-  //unsigned int v20; // eax@69
-  signed int pPrice; // ecx@70
-  char *v22; // [sp-Ch] [bp-18h]@73
-  //int v23; // [sp-8h] [bp-14h]@49
-  char *v24; // [sp-8h] [bp-14h]@73
-  //int v25; // [sp-4h] [bp-10h]@49
-
-  uDialogueType = uMessageParam + 1;
-  pCurrentNPCInfo = HouseNPCData[pDialogueNPCCount -((dword_591080 != 0)?1:0 )];//- 1
-  if ( uMessageParam <= 24 )
-  {
-  switch ( uMessageParam )
-  {
-    case 13:
-      current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
-      current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
-      NPCHireableDialogPrepare();
-      dialogue_show_profession_details = false;
-      goto _return;
-    case 19:
-      pEventNumber = pCurrentNPCInfo->evt_A;
-      break;
-    case 20:
-      pEventNumber = pCurrentNPCInfo->evt_B;
-      break;
-    case 21:
-      pEventNumber = pCurrentNPCInfo->evt_C;
-      break;
-    case 22:
-      pEventNumber = pCurrentNPCInfo->evt_D;
-      break;
-    case 23:
-      pEventNumber = pCurrentNPCInfo->evt_E;
-      break;
-    case 24:
-      pEventNumber = pCurrentNPCInfo->evt_F;
-      break;
-    default:
-      goto _return;
-  }
-  /*switch ( pEventNumber )
-  {
-    case 139:
-      OracleDialogue();
-      goto _return;
-    case 311:
-      CheckBountyRespawnAndAward();
-    goto _return;
-  }*/
-  if ( pEventNumber < 200 || pEventNumber > 310 )
-    {
-      if ( pEventNumber < 400 || pEventNumber > 410 )
-      {
-        if ( pEventNumber == 139 )
-        {
-          OracleDialogue();
-        }
-        else
-        { 
-          if ( pEventNumber == 311 )
-          {
-            CheckBountyRespawnAndAward();
-          }
-          else
-          {
-            current_npc_text = 0;
-            activeLevelDecoration = (LevelDecoration*)1;
-            EventProcessor(pEventNumber, 0, 1);
-            activeLevelDecoration = nullptr;
-          }
-        }
-      }
-      else
-      {
-        dword_F8B1D8 = uMessageParam;
-        DrawJoinGuildWindow(pEventNumber - 400);
-      }
-    }
-    else
-    {
-      _4B3FE5_training_dialogue(pEventNumber);
-    }
-    goto _return;
-  }
-  if ( uMessageParam != 76 )
-  {
-    if ( uMessageParam == 77 )
-    {
-      //v16 = pCurrentNPCInfo->uProfession;
-    __debugbreak();  // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok
-      if (dialogue_show_profession_details)
-        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
-      else
-        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pBenefits;
-      current_npc_text = v17;
-      v18 = BuildDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
-      dialogue_show_profession_details = ~dialogue_show_profession_details;
-      current_npc_text = v18;
-    }
-    else
-    {
-      if ( uMessageParam == 79 )
-      {
-        if ( contract_approved )
-        {
-          Party::TakeGold(gold_transaction_amount);
-          if ( uActiveCharacter )
-          {
-            v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
-            *(short *)v12 &= 0x3Fu;
-            switch ( dword_F8B1B0_MasteryBeingTaught )
-            {
-              case 2:
-                v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
-                *v15 |= 0x40u;
-                break;
-              case 3:
-                v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
-                *v14 |= 0x80u;
-                break;
-              case 4:
-                v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
-                v13[1] |= 1u;
-                break;
-            }
-            pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0);
-          }
-          pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
-          /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-          {
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-            ++pMessageQueue_50CBD0->uNumMessages;
-          }*/
-        }
-      }
-      else
-      {
-        if ( uMessageParam == 82 && contract_approved ) //join guild
-        {
-          Party::TakeGold(gold_transaction_amount);
-          v4 = pParty->pPlayers.data();
-          do
-          {
-            v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number);
-            ++v4;
-          }
-          while ( (signed int)v4 < (signed int)pParty->pHirelings.data() );
-          switch ( dword_F8B1D8 )
-          {
-            case 19:
-              pEventNumber = pCurrentNPCInfo->evt_A;
-              if ( pEventNumber >= 400 && pEventNumber <= 416 )
-                pCurrentNPCInfo->evt_A = 0;
-              break;
-            case 20:
-              pEventNumber = pCurrentNPCInfo->evt_B;
-              if ( pEventNumber >= 400 && pEventNumber <= 416 )
-                pCurrentNPCInfo->evt_B = 0;
-              break;
-            case 21:
-              pEventNumber = pCurrentNPCInfo->evt_C;
-              if ( pEventNumber >= 400 && pEventNumber <= 416 )
-                pCurrentNPCInfo->evt_C = 0;
-              break;
-            case 22:
-              pEventNumber = pCurrentNPCInfo->evt_D;
-              if ( pEventNumber >= 400 && pEventNumber <= 416 )
-                pCurrentNPCInfo->evt_D = 0;
-              break;
-            case 23:
-              pEventNumber = pCurrentNPCInfo->evt_E;
-              if ( pEventNumber >= 400 && pEventNumber <= 416 )
-                pCurrentNPCInfo->evt_E = 0;
-              break;
-            case 24:
-              pEventNumber = pCurrentNPCInfo->evt_F;
-              if ( pEventNumber >= 400 && pEventNumber <= 416)
-                pCurrentNPCInfo->evt_F = 0;
-              break;
-          }
-          pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
-          /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-          {
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-            ++pMessageQueue_50CBD0->uNumMessages;
-          }*/
-          //v11 = uActiveCharacter;
-          if ( uActiveCharacter )
-          {
-            pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0);
-            goto _return;
-          }
-        }
-      }
-    }
-    goto _return;
-  }
-  if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
-  {
-    ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
-    goto _return;
-  }
-  if ( pCurrentNPCInfo->uProfession != 51 ) //burglars have no hiring price
-  {
-    __debugbreak();  // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok
-    pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].uHirePrice;
-    if ( pParty->uNumGold < (unsigned int)pPrice )
-    {
-      ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
-      dialogue_show_profession_details = false;
-      uDialogueType = 13;
-      current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
-      current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
-      if ( uActiveCharacter )
-        pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
-      ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
-      goto _return;
-    }
-    Party::TakeGold(pPrice);
-  }
-  //LOBYTE(v2->uFlags) |= 0x80u;
-  pCurrentNPCInfo->uFlags |= 128;
-  pParty->hirelingScrollPosition = 0;
-  pParty->CountHirelings();
-  if ( pParty->pHirelings[0].pName )
-  {
-    memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1]));
-    v24 = pCurrentNPCInfo->pName;
-    v22 = pParty->pHireling2Name;
-  }
-  else
-  {
-    memcpy(pParty->pHirelings.data(), pCurrentNPCInfo, 0x4Cu);
-    v24 = pCurrentNPCInfo->pName;
-    v22 = pParty->pHireling1Name;
-  }
-  strcpy(v22, v24);
-  pParty->hirelingScrollPosition = 0;
-  pParty->CountHirelings();
-  PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C);
-  dialog_menu_id = HOUSE_DIALOGUE_MAIN;
-
-  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
-  /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-  {
-    pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-    pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-    *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-    ++pMessageQueue_50CBD0->uNumMessages;
-  }*/
-  if ( uActiveCharacter )
-    pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0);
-_return:
-  BackToHouseMenu();
-}
 //----- (004B29F2) --------------------------------------------------------
 const char * ContractSelectText( int pEventCode )
 {