Mercurial > mm7
comparison mm7_4.cpp @ 656:6abf5b610585
OnSelectNPCDialogueOption clean
author | zipi |
---|---|
date | Tue, 12 Mar 2013 21:58:10 +0000 |
parents | 6a2d29c21d09 |
children | c10163a6d946 |
comparison
equal
deleted
inserted
replaced
655:6a2d29c21d09 | 656:6abf5b610585 |
---|---|
10809 | 10809 |
10810 | 10810 |
10811 //----- (004BC49B) -------------------------------------------------------- | 10811 //----- (004BC49B) -------------------------------------------------------- |
10812 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) | 10812 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
10813 { | 10813 { |
10814 //unsigned int v1; // esi@1 | 10814 //unsigned int v1; // esi@1 |
10815 NPCData *speakingNPC; // ebp@1 | 10815 NPCData *speakingNPC; // ebp@1 |
10816 //unsigned int v3; // eax@1 | 10816 //unsigned int v3; // eax@1 |
10817 int npc_event_id; // ecx@10 | 10817 int npc_event_id; // ecx@10 |
10818 signed int v5; // edi@14 | 10818 signed int v5; // edi@14 |
10819 char *v6; // esi@15 | 10819 char *v6; // esi@15 |
10826 char *v13; // [sp-8h] [bp-18h]@60 | 10826 char *v13; // [sp-8h] [bp-18h]@60 |
10827 size_t v14; // [sp-4h] [bp-14h]@46 | 10827 size_t v14; // [sp-4h] [bp-14h]@46 |
10828 const char *v15; // [sp-4h] [bp-14h]@60 | 10828 const char *v15; // [sp-4h] [bp-14h]@60 |
10829 | 10829 |
10830 //v1 = _this; | 10830 //v1 = _this; |
10831 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); | 10831 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
10832 //v3 = v1; | 10832 //v3 = v1; |
10833 uDialogueType = newDialogueType; | 10833 uDialogueType = newDialogueType; |
10834 if (!speakingNPC->uFlags) | 10834 if (!speakingNPC->uFlags) |
10835 { | 10835 { |
10836 speakingNPC->uFlags = 1; | 10836 speakingNPC->uFlags = 1; |
10837 //v3 = uDialogueType; | 10837 //v3 = uDialogueType; |
10838 } | 10838 } |
10839 if ((newDialogueType > DIALOGUE_24) || (newDialogueType < DIALOGUE_19)) | 10839 |
10840 { | 10840 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) |
10841 if (newDialogueType != DIALOGUE_76) | 10841 { |
10842 { | 10842 dialogue_show_profession_details = ~dialogue_show_profession_details; |
10843 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) | 10843 } |
10844 { | 10844 else if(newDialogueType == DIALOGUE_76) |
10845 dialogue_show_profession_details = ~dialogue_show_profession_details; | 10845 { |
10846 } | 10846 if (speakingNPC->Hired()) |
10847 else | 10847 { |
10848 { | 10848 v8 = 0; |
10849 if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | 10849 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) |
10850 { | 10850 { |
10851 ArenaFight(); | 10851 v6 = (char *)pNPCStats->pNewNPCData; |
10852 return; | 10852 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) |
10853 } | 10853 { |
10854 } | 10854 ++v8; |
10855 goto LABEL_87; | 10855 v6 += 76; |
10856 } | 10856 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) |
10857 if (speakingNPC->Hired()) | 10857 break; |
10858 { | 10858 } |
10859 v8 = 0; | 10859 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) |
10860 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | 10860 v6[8] &= 0x7Fu; |
10861 { | 10861 } |
10862 v6 = (char *)pNPCStats->pNewNPCData; | 10862 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
10863 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | 10863 { |
10864 { | 10864 v11 = pParty->pHirelings; |
10865 ++v8; | 10865 memset(v11, 0, sizeof(NPCData)); |
10866 v6 += 76; | 10866 } |
10867 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | 10867 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
10868 goto LABEL_44; | 10868 { |
10869 } | 10869 v11 = &pParty->pHirelings[1]; |
10870 goto LABEL_43; | 10870 memset(v11, 0, sizeof(NPCData)); |
10871 } | 10871 } |
10872 LABEL_44: | 10872 pParty->field_709 = 0; |
10873 if ( !pParty->pHirelings[0].pName || _strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | 10873 sub_44A56A(); |
10874 { | 10874 dword_591084 = 0; |
10875 if ( !pParty->pHirelings[1].pName || _strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | 10875 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
10876 { | 10876 dword_7241C8 = 0; |
10877 LABEL_51: | 10877 return; |
10878 pParty->field_709 = 0; | 10878 } |
10879 sub_44A56A(); | 10879 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) |
10880 dword_591084 = 0; | 10880 { |
10881 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 10881 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" |
10882 | 10882 ShowStatusBarString(v7, 2u); |
10883 goto LABEL_89; | 10883 } |
10884 } | 10884 else |
10885 v11 = &pParty->pHirelings[1]; | 10885 { |
10886 } | 10886 //v9 = v2->uProfession; |
10887 else | 10887 if ( speakingNPC->uProfession != 51 ) |
10888 { | 10888 { |
10889 v11 = pParty->pHirelings; | 10889 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; |
10890 } | 10890 if ( pParty->uNumGold < v10 ) |
10891 memset(v11, 0, sizeof(NPCData)); | 10891 { |
10892 goto LABEL_51; | 10892 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" |
10893 } | 10893 dialogue_show_profession_details = false; |
10894 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | 10894 uDialogueType = 13; |
10895 { | 10895 if ( uActiveCharacter ) |
10896 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | 10896 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
10897 LABEL_64: | 10897 v7 = pGlobalTXT_LocalizationStrings[155]; |
10898 ShowStatusBarString(v7, 2u); | 10898 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); |
10899 goto LABEL_87; | 10899 if ( !dword_7241C8 ) |
10900 } | 10900 pGame->Draw(); |
10901 //v9 = v2->uProfession; | 10901 dword_7241C8 = 0; |
10902 if ( speakingNPC->uProfession != 51 ) | 10902 return; |
10903 { | 10903 } |
10904 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | 10904 Party::TakeGold(v10); |
10905 if ( pParty->uNumGold < v10 ) | 10905 } |
10906 { | 10906 LOBYTE(speakingNPC->uFlags) |= 0x80u; |
10907 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | 10907 if ( pParty->pHirelings[0].pName ) |
10908 dialogue_show_profession_details = false; | 10908 { |
10909 uDialogueType = 13; | 10909 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); |
10910 if ( uActiveCharacter ) | 10910 v15 = speakingNPC->pName; |
10911 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | 10911 v13 = pParty->pHireling2Name; |
10912 v7 = pGlobalTXT_LocalizationStrings[155]; | 10912 } |
10913 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | 10913 else |
10914 goto LABEL_87; | 10914 { |
10915 } | 10915 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); |
10916 Party::TakeGold(v10); | 10916 v15 = speakingNPC->pName; |
10917 } | 10917 v13 = pParty->pHireling1Name; |
10918 LOBYTE(speakingNPC->uFlags) |= 0x80u; | 10918 } |
10919 if ( pParty->pHirelings[0].pName ) | 10919 strcpy(v13, v15); |
10920 { | 10920 pParty->field_709 = 0; |
10921 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | 10921 sub_44A56A(); |
10922 v15 = speakingNPC->pName; | 10922 |
10923 v13 = pParty->pHireling2Name; | 10923 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
10924 } | 10924 |
10925 else | 10925 if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) |
10926 { | 10926 pDialogue_SpeakingActor->uAIState = Removed; |
10927 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | 10927 if ( uActiveCharacter ) |
10928 v15 = speakingNPC->pName; | 10928 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); |
10929 v13 = pParty->pHireling1Name; | 10929 } |
10930 } | 10930 } |
10931 strcpy(v13, v15); | 10931 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) |
10932 pParty->field_709 = 0; | 10932 { |
10933 sub_44A56A(); | 10933 ArenaFight(); |
10934 | 10934 return; |
10935 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 10935 } |
10936 | 10936 else if(newDialogueType == DIALOGUE_9) |
10937 if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) | 10937 { |
10938 pDialogue_SpeakingActor->uAIState = Removed; | 10938 if ( !sub_4BB756(speakingNPC->uProfession) ) |
10939 if ( uActiveCharacter ) | 10939 { |
10940 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | 10940 if ( speakingNPC->uProfession != 41 ) |
10941 goto LABEL_87; | 10941 speakingNPC->bHasUsedTheAbility = 1; |
10942 if (newDialogueType == DIALOGUE_9) | 10942 |
10943 { | 10943 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
10944 if ( !sub_4BB756(speakingNPC->uProfession) ) | 10944 } |
10945 { | 10945 else |
10946 if ( speakingNPC->uProfession != 41 ) | 10946 { |
10947 speakingNPC->bHasUsedTheAbility = 1; | 10947 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" |
10948 | 10948 } |
10949 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 10949 } |
10950 } | 10950 else if(newDialogueType == DIALOGUE_13) |
10951 else | 10951 { |
10952 { | 10952 if (!speakingNPC->Hired()) |
10953 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | 10953 { |
10954 } | 10954 sub_4B3E1E(); |
10955 | 10955 dialogue_show_profession_details = false; |
10956 goto LABEL_87; | 10956 } |
10957 } | 10957 else |
10958 if (newDialogueType == DIALOGUE_13) | 10958 { |
10959 { | 10959 v5 = 0; |
10960 if (!speakingNPC->Hired()) | 10960 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) |
10961 { | 10961 { |
10962 sub_4B3E1E(); | 10962 v6 = (char *)pNPCStats->pNewNPCData; |
10963 dialogue_show_profession_details = false; | 10963 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) |
10964 goto LABEL_87; | 10964 { |
10965 } | 10965 ++v5; |
10966 else | 10966 v6 += 76; |
10967 { | 10967 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) |
10968 v5 = 0; | 10968 break; |
10969 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | 10969 } |
10970 { | 10970 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) |
10971 v6 = (char *)pNPCStats->pNewNPCData; | 10971 v6[8] &= 0x7Fu; |
10972 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | 10972 } |
10973 { | 10973 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
10974 ++v5; | 10974 { |
10975 v6 += 76; | 10975 v11 = pParty->pHirelings; |
10976 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | 10976 memset(v11, 0, sizeof(NPCData)); |
10977 goto LABEL_44; | 10977 } |
10978 } | 10978 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
10979 LABEL_43: | 10979 { |
10980 v6[8] &= 0x7Fu; | 10980 v11 = &pParty->pHirelings[1]; |
10981 goto LABEL_44; | 10981 memset(v11, 0, sizeof(NPCData)); |
10982 } | 10982 } |
10983 goto LABEL_44; | 10983 pParty->field_709 = 0; |
10984 } | 10984 sub_44A56A(); |
10985 } | 10985 dword_591084 = 0; |
10986 } | 10986 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
10987 else | 10987 dword_7241C8 = 0; |
10988 { | 10988 return; |
10989 switch(newDialogueType) | 10989 } |
10990 { | 10990 } |
10991 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | 10991 else if(newDialogueType >= 19 && newDialogueType <= 24) |
10992 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | 10992 { |
10993 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | 10993 switch(newDialogueType) |
10994 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | 10994 { |
10995 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | 10995 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; |
10996 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | 10996 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; |
10997 } | 10997 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; |
10998 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | 10998 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; |
10999 sub_4B3FE5(npc_event_id); //200-310 | 10999 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; |
11000 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | 11000 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; |
11001 { //400-410 | 11001 } |
11002 dword_F8B1D8 = newDialogueType; | 11002 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) |
11003 DrawJoinGuildWindow(npc_event_id - 400); | 11003 sub_4B3FE5(npc_event_id); //200-310 |
11004 } | 11004 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) |
11005 else | 11005 { //400-410 |
11006 { | 11006 dword_F8B1D8 = newDialogueType; |
11007 switch ( npc_event_id ) | 11007 DrawJoinGuildWindow(npc_event_id - 400); |
11008 { | 11008 } |
11009 case 139: | 11009 else |
11010 sub_4B1ECE(); | 11010 { |
11011 break; | 11011 switch ( npc_event_id ) |
11012 case 311: | 11012 { |
11013 sub_4BBA85_bounties(); | 11013 case 139: |
11014 break; | 11014 sub_4B1ECE(); |
11015 case 399: | 11015 break; |
11016 sub_4BBCDD(); | 11016 case 311: |
11017 break; | 11017 sub_4BBA85_bounties(); |
11018 default: | 11018 break; |
11019 activeLevelDecoration = (LevelDecoration*)1; | 11019 case 399: |
11020 ptr_F8B1E8 = 0; | 11020 sub_4BBCDD(); |
11021 EventProcessor(npc_event_id, 0, 1); | 11021 break; |
11022 activeLevelDecoration = NULL; | 11022 default: |
11023 break; | 11023 activeLevelDecoration = (LevelDecoration*)1; |
11024 } | 11024 ptr_F8B1E8 = 0; |
11025 } | 11025 EventProcessor(npc_event_id, 0, 1); |
11026 } | 11026 activeLevelDecoration = NULL; |
11027 LABEL_87: | 11027 break; |
11028 if ( !dword_7241C8 ) | 11028 } |
11029 pGame->Draw(); | 11029 } |
11030 LABEL_89: | 11030 } |
11031 dword_7241C8 = 0; | 11031 if ( !dword_7241C8 ) |
11032 } | 11032 pGame->Draw(); |
11033 dword_7241C8 = 0; | |
11034 } | |
11033 | 11035 |
11034 | 11036 |
11035 | 11037 |
11036 //----- (004BDAAF) -------------------------------------------------------- | 11038 //----- (004BDAAF) -------------------------------------------------------- |
11037 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | 11039 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) |