Mercurial > mm7
comparison mm7_4.cpp @ 518:9c984eef0a7d
m2
author | Gloval |
---|---|
date | Fri, 01 Mar 2013 22:17:32 +0400 |
parents | 7c86030324a5 |
children | 8f70e52646eb |
comparison
equal
deleted
inserted
replaced
517:aaefd101c3b1 | 518:9c984eef0a7d |
---|---|
11940 | 11940 |
11941 //----- (004BC49B) -------------------------------------------------------- | 11941 //----- (004BC49B) -------------------------------------------------------- |
11942 void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) | 11942 void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) |
11943 { | 11943 { |
11944 //unsigned int v1; // esi@1 | 11944 //unsigned int v1; // esi@1 |
11945 NPCData *v2; // ebp@1 | 11945 NPCData *speakingNPC; // ebp@1 |
11946 //unsigned int v3; // eax@1 | 11946 //unsigned int v3; // eax@1 |
11947 int v4; // ecx@10 | 11947 int npc_event_id; // ecx@10 |
11948 signed int v5; // edi@14 | 11948 signed int v5; // edi@14 |
11949 char *v6; // esi@15 | 11949 char *v6; // esi@15 |
11950 const char *v7; // ecx@22 | 11950 const char *v7; // ecx@22 |
11951 signed int v8; // edi@37 | 11951 signed int v8; // edi@37 |
11952 //unsigned int v9; // eax@56 | 11952 //unsigned int v9; // eax@56 |
11956 char *v13; // [sp-8h] [bp-18h]@60 | 11956 char *v13; // [sp-8h] [bp-18h]@60 |
11957 size_t v14; // [sp-4h] [bp-14h]@46 | 11957 size_t v14; // [sp-4h] [bp-14h]@46 |
11958 const char *v15; // [sp-4h] [bp-14h]@60 | 11958 const char *v15; // [sp-4h] [bp-14h]@60 |
11959 | 11959 |
11960 //v1 = _this; | 11960 //v1 = _this; |
11961 v2 = GetNPCData(uDialogue_SpeakingActorNPC_ID); | 11961 speakingNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); |
11962 //v3 = v1; | 11962 //v3 = v1; |
11963 uDialogueType = newDialogueType; | 11963 uDialogueType = newDialogueType; |
11964 if ( !v2->uFlags ) | 11964 if ( !speakingNPC->uFlags ) |
11965 { | 11965 { |
11966 v2->uFlags = 1; | 11966 speakingNPC->uFlags = 1; |
11967 //v3 = uDialogueType; | 11967 //v3 = uDialogueType; |
11968 } | 11968 } |
11969 if ( (signed int)newDialogueType > 22 ) | 11969 if ((newDialogueType>DIALOGUE_24)||(newDialogueType<DIALOGUE_19)) |
11970 { | 11970 { |
11971 if ( newDialogueType == DIALOGUE_23 ) | 11971 |
11972 { | 11972 if (newDialogueType != DIALOGUE_76) |
11973 v4 = v2->evt_E; | 11973 { |
11974 goto LABEL_74; | 11974 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) |
11975 } | 11975 { |
11976 if (newDialogueType == DIALOGUE_24) | 11976 dialogue_show_profession_details = ~dialogue_show_profession_details; |
11977 { | 11977 } |
11978 v4 = v2->evt_F; | 11978 else |
11979 goto LABEL_74; | 11979 { |
11980 } | 11980 if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) |
11981 if (newDialogueType != DIALOGUE_76) | 11981 { |
11982 { | 11982 ArenaFight(); |
11983 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) | 11983 return; |
11984 { | 11984 } |
11985 dialogue_show_profession_details = ~dialogue_show_profession_details; | 11985 } |
11986 } | 11986 goto LABEL_87; |
11987 else | 11987 } |
11988 { | 11988 if (speakingNPC->Hired()) |
11989 if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | 11989 { |
11990 { | 11990 v8 = 0; |
11991 ArenaFight(); | 11991 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) |
11992 return; | 11992 { |
11993 } | 11993 v6 = (char *)pNPCStats->pNewNPCData; |
11994 } | 11994 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) |
11995 goto LABEL_87; | 11995 { |
11996 } | 11996 ++v8; |
11997 if (v2->Hired()) | 11997 v6 += 76; |
11998 { | 11998 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) |
11999 v8 = 0; | 11999 goto LABEL_44; |
12000 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | 12000 } |
12001 { | 12001 goto LABEL_43; |
12002 v6 = (char *)pNPCStats->pNewNPCData; | 12002 } |
12003 while ( !(v6[8] & 0x80) || strcmp(v2->pName, *(const char **)v6) ) | |
12004 { | |
12005 ++v8; | |
12006 v6 += 76; | |
12007 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
12008 goto LABEL_44; | |
12009 } | |
12010 goto LABEL_43; | |
12011 } | |
12012 LABEL_44: | 12003 LABEL_44: |
12013 if ( !pParty->pHirelings[0].pName || _strcmpi(pParty->pHirelings[0].pName, v2->pName) ) | 12004 if ( !pParty->pHirelings[0].pName || _strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
12014 { | 12005 { |
12015 if ( !pParty->pHirelings[1].pName || _strcmpi(pParty->pHirelings[1].pName, v2->pName) ) | 12006 if ( !pParty->pHirelings[1].pName || _strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
12016 { | 12007 { |
12017 LABEL_51: | 12008 LABEL_51: |
12018 pParty->field_709 = 0; | 12009 pParty->field_709 = 0; |
12019 sub_44A56A(); | 12010 sub_44A56A(); |
12020 dword_591084 = 0; | 12011 dword_591084 = 0; |
12021 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 12012 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
12022 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | 12013 |
12023 { | 12014 goto LABEL_89; |
12024 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | 12015 } |
12025 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | 12016 v11 = &pParty->pHirelings[1]; |
12026 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | 12017 } |
12027 ++pMessageQueue_50CBD0->uNumMessages; | 12018 else |
12028 }*/ | 12019 { |
12029 goto LABEL_89; | 12020 v11 = pParty->pHirelings; |
12030 } | 12021 } |
12031 v14 = 76; | 12022 memset(v11, 0, sizeof(NPCData)); |
12032 v12 = 0; | 12023 goto LABEL_51; |
12033 v11 = &pParty->pHirelings[1]; | 12024 } |
12034 } | 12025 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) |
12035 else | 12026 { |
12036 { | 12027 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" |
12037 v14 = 76; | |
12038 v12 = 0; | |
12039 v11 = pParty->pHirelings; | |
12040 } | |
12041 memset(v11, v12, v14); | |
12042 goto LABEL_51; | |
12043 } | |
12044 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
12045 { | |
12046 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
12047 LABEL_64: | 12028 LABEL_64: |
12048 ShowStatusBarString(v7, 2u); | 12029 ShowStatusBarString(v7, 2u); |
12049 goto LABEL_87; | 12030 goto LABEL_87; |
12050 } | 12031 } |
12051 //v9 = v2->uProfession; | 12032 //v9 = v2->uProfession; |
12052 if ( v2->uProfession != 51 ) | 12033 if ( speakingNPC->uProfession != 51 ) |
12053 { | 12034 { |
12054 v10 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice; | 12035 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; |
12055 if ( pParty->uNumGold < v10 ) | 12036 if ( pParty->uNumGold < v10 ) |
12056 { | 12037 { |
12057 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | 12038 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" |
12058 dialogue_show_profession_details = false; | 12039 dialogue_show_profession_details = false; |
12059 uDialogueType = 13; | 12040 uDialogueType = 13; |
12060 if ( uActiveCharacter ) | 12041 if ( uActiveCharacter ) |
12061 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | 12042 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
12062 v7 = pGlobalTXT_LocalizationStrings[155]; | 12043 v7 = pGlobalTXT_LocalizationStrings[155]; |
12063 goto LABEL_64; | 12044 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); |
12064 } | 12045 goto LABEL_87; |
12065 Party::TakeGold(v10); | 12046 } |
12066 } | 12047 Party::TakeGold(v10); |
12067 LOBYTE(v2->uFlags) |= 0x80u; | 12048 } |
12068 if ( pParty->pHirelings[0].pName ) | 12049 LOBYTE(speakingNPC->uFlags) |= 0x80u; |
12069 { | 12050 if ( pParty->pHirelings[0].pName ) |
12070 memcpy(&pParty->pHirelings[1], v2, sizeof(pParty->pHirelings[1])); | 12051 { |
12071 v15 = v2->pName; | 12052 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); |
12072 v13 = pParty->pHireling2Name; | 12053 v15 = speakingNPC->pName; |
12073 } | 12054 v13 = pParty->pHireling2Name; |
12074 else | 12055 } |
12075 { | 12056 else |
12076 memcpy(pParty->pHirelings, v2, 0x4Cu); | 12057 { |
12077 v15 = v2->pName; | 12058 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); |
12078 v13 = pParty->pHireling1Name; | 12059 v15 = speakingNPC->pName; |
12079 } | 12060 v13 = pParty->pHireling1Name; |
12080 strcpy(v13, v15); | 12061 } |
12081 pParty->field_709 = 0; | 12062 strcpy(v13, v15); |
12082 sub_44A56A(); | 12063 pParty->field_709 = 0; |
12083 | 12064 sub_44A56A(); |
12084 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 12065 |
12085 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | 12066 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
12086 { | 12067 |
12087 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | 12068 if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) |
12088 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | 12069 pDialogue_SpeakingActor->uAIState = Removed; |
12089 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | 12070 if ( uActiveCharacter ) |
12090 ++pMessageQueue_50CBD0->uNumMessages; | 12071 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); |
12091 }*/ | 12072 goto LABEL_87; |
12092 if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) | 12073 |
12093 pDialogue_SpeakingActor->uAIState = Removed; | 12074 |
12094 if ( uActiveCharacter ) | 12075 if (newDialogueType == DIALOGUE_9) |
12095 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | 12076 { |
12096 goto LABEL_87; | 12077 if ( !sub_4BB756(speakingNPC->uProfession) ) |
12097 } | 12078 { |
12098 if (newDialogueType == DIALOGUE_22) | 12079 if ( speakingNPC->uProfession != 41 ) |
12099 { | 12080 speakingNPC->bHasUsedTheAbility = 1; |
12100 v4 = v2->evt_D; | 12081 |
12101 goto LABEL_74; | 12082 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
12102 } | 12083 } |
12103 if (newDialogueType == DIALOGUE_9) | 12084 else |
12104 { | 12085 { |
12105 if ( !sub_4BB756(v2->uProfession) ) | 12086 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" |
12106 { | 12087 } |
12107 if ( v2->uProfession != 41 ) | 12088 |
12108 v2->bHasUsedTheAbility = 1; | 12089 goto LABEL_87; |
12109 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | 12090 } |
12110 { | 12091 if (newDialogueType == DIALOGUE_13) |
12111 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | 12092 { |
12112 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | 12093 if (!speakingNPC->Hired()) |
12113 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | 12094 { |
12114 ++pMessageQueue_50CBD0->uNumMessages; | 12095 sub_4B3E1E(); |
12115 }*/ | 12096 dialogue_show_profession_details = false; |
12116 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 12097 goto LABEL_87; |
12117 goto LABEL_87; | 12098 } |
12118 } | 12099 else |
12119 v7 = pGlobalTXT_LocalizationStrings[140]; | 12100 { |
12120 goto LABEL_64; | 12101 v5 = 0; |
12121 } | 12102 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) |
12122 if (newDialogueType == DIALOGUE_13) | 12103 { |
12123 { | 12104 v6 = (char *)pNPCStats->pNewNPCData; |
12124 if (!v2->Hired()) | 12105 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) |
12125 { | 12106 { |
12126 sub_4B3E1E(); | 12107 ++v5; |
12127 dialogue_show_profession_details = false; | 12108 v6 += 76; |
12128 goto LABEL_87; | 12109 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) |
12129 } | 12110 goto LABEL_44; |
12130 v5 = 0; | 12111 } |
12131 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
12132 { | |
12133 v6 = (char *)pNPCStats->pNewNPCData; | |
12134 while ( !(v6[8] & 0x80) || strcmp(v2->pName, *(const char **)v6) ) | |
12135 { | |
12136 ++v5; | |
12137 v6 += 76; | |
12138 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
12139 goto LABEL_44; | |
12140 } | |
12141 LABEL_43: | 12112 LABEL_43: |
12142 v6[8] &= 0x7Fu; | 12113 v6[8] &= 0x7Fu; |
12143 goto LABEL_44; | 12114 goto LABEL_44; |
12144 } | 12115 } |
12145 goto LABEL_44; | 12116 goto LABEL_44; |
12146 } | 12117 } |
12147 if (newDialogueType == DIALOGUE_19) | 12118 } |
12148 { | 12119 |
12149 v4 = v2->evt_A; | 12120 } |
12150 goto LABEL_74; | 12121 else |
12151 } | 12122 { |
12152 if (newDialogueType == DIALOGUE_20) | 12123 switch(newDialogueType) |
12153 { | 12124 { |
12154 v4 = v2->evt_B; | 12125 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; |
12155 goto LABEL_74; | 12126 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; |
12156 } | 12127 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; |
12157 if (newDialogueType == DIALOGUE_21) | 12128 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; |
12158 { | 12129 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; |
12159 v4 = v2->evt_C; | 12130 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; |
12160 LABEL_74: | 12131 } |
12161 if ( v4 < 200 || v4 > 310 ) | 12132 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) |
12162 { | 12133 sub_4B3FE5(npc_event_id); //200-310 |
12163 if ( v4 < 400 || v4 > 410 ) | 12134 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) |
12164 { | 12135 { //400-410 |
12165 switch ( v4 ) | 12136 dword_F8B1D8 = newDialogueType; |
12166 { | 12137 DrawJoinGuildWindow(npc_event_id - 400); |
12167 case 139: | 12138 } |
12168 sub_4B1ECE(); | 12139 else |
12169 break; | 12140 { |
12170 case 311: | 12141 switch ( npc_event_id ) |
12171 sub_4BBA85_bounties(); | 12142 { |
12172 break; | 12143 case 139: |
12173 case 399: | 12144 sub_4B1ECE(); |
12174 sub_4BBCDD(); | 12145 break; |
12175 break; | 12146 case 311: |
12176 default: | 12147 sub_4BBA85_bounties(); |
12177 GlobalEventInfo = 1; | 12148 break; |
12178 ptr_F8B1E8 = 0; | 12149 case 399: |
12179 EventProcessor(v4, 0, 1); | 12150 sub_4BBCDD(); |
12180 GlobalEventInfo = 0; | 12151 break; |
12181 break; | 12152 default: |
12182 } | 12153 GlobalEventInfo = 1; |
12183 } | 12154 ptr_F8B1E8 = 0; |
12184 else | 12155 EventProcessor(npc_event_id, 0, 1); |
12185 { | 12156 GlobalEventInfo = 0; |
12186 dword_F8B1D8 = newDialogueType; | 12157 break; |
12187 DrawJoinGuildWindow(v4 - 400); | 12158 } |
12188 } | 12159 } |
12189 } | 12160 |
12190 else | 12161 |
12191 { | 12162 |
12192 sub_4B3FE5(v4); | 12163 |
12193 } | 12164 |
12194 } | |
12195 LABEL_87: | 12165 LABEL_87: |
12196 if ( !dword_7241C8 ) | 12166 if ( !dword_7241C8 ) |
12197 pGame->Draw(); | 12167 pGame->Draw(); |
12198 LABEL_89: | 12168 LABEL_89: |
12199 dword_7241C8 = 0; | 12169 dword_7241C8 = 0; |