Mercurial > mm7
comparison mm7_4.cpp @ 652:1ff57450f090
* Some fixes to TravelByTransport
* Minor bug with npc profession names
* Fixed not loading npc profession decriptions
* NPC professions enum
author | Nomad |
---|---|
date | Tue, 12 Mar 2013 04:45:38 +0200 |
parents | 2bf48d11d742 |
children | 6a2d29c21d09 |
comparison
equal
deleted
inserted
replaced
651:2bf48d11d742 | 652:1ff57450f090 |
---|---|
10810 } | 10810 } |
10811 | 10811 |
10812 | 10812 |
10813 //----- (004BC49B) -------------------------------------------------------- | 10813 //----- (004BC49B) -------------------------------------------------------- |
10814 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) | 10814 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
10815 { | 10815 { |
10816 //unsigned int v1; // esi@1 | 10816 //unsigned int v1; // esi@1 |
10817 NPCData *speakingNPC; // ebp@1 | 10817 NPCData *speakingNPC; // ebp@1 |
10818 //unsigned int v3; // eax@1 | 10818 //unsigned int v3; // eax@1 |
10819 int npc_event_id; // ecx@10 | 10819 int npc_event_id; // ecx@10 |
10820 signed int v5; // edi@14 | 10820 signed int v5; // edi@14 |
10828 char *v13; // [sp-8h] [bp-18h]@60 | 10828 char *v13; // [sp-8h] [bp-18h]@60 |
10829 size_t v14; // [sp-4h] [bp-14h]@46 | 10829 size_t v14; // [sp-4h] [bp-14h]@46 |
10830 const char *v15; // [sp-4h] [bp-14h]@60 | 10830 const char *v15; // [sp-4h] [bp-14h]@60 |
10831 | 10831 |
10832 //v1 = _this; | 10832 //v1 = _this; |
10833 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); | 10833 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
10834 //v3 = v1; | 10834 //v3 = v1; |
10835 uDialogueType = newDialogueType; | 10835 uDialogueType = newDialogueType; |
10836 if ( !speakingNPC->uFlags ) | 10836 if (!speakingNPC->uFlags) |
10837 { | 10837 { |
10838 speakingNPC->uFlags = 1; | 10838 speakingNPC->uFlags = 1; |
10839 //v3 = uDialogueType; | 10839 //v3 = uDialogueType; |
10840 } | 10840 } |
10841 if ((newDialogueType>DIALOGUE_24)||(newDialogueType<DIALOGUE_19)) | 10841 if ((newDialogueType > DIALOGUE_24) || (newDialogueType < DIALOGUE_19)) |
10842 { | 10842 { |
10843 | |
10844 if (newDialogueType != DIALOGUE_76) | 10843 if (newDialogueType != DIALOGUE_76) |
10845 { | 10844 { |
10846 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) | 10845 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) |
10847 { | 10846 { |
10848 dialogue_show_profession_details = ~dialogue_show_profession_details; | 10847 dialogue_show_profession_details = ~dialogue_show_profession_details; |
11348 const char *v27; // eax@46 | 11347 const char *v27; // eax@46 |
11349 char *v28; // eax@62 | 11348 char *v28; // eax@62 |
11350 int v29; // eax@62 | 11349 int v29; // eax@62 |
11351 unsigned int v30; // ecx@62 | 11350 unsigned int v30; // ecx@62 |
11352 char *v31; // eax@63 | 11351 char *v31; // eax@63 |
11353 char v32; // [sp-3Ch] [bp-2CCh]@62 | 11352 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 |
11354 int v33; // [sp-38h] [bp-2C8h]@62 | 11353 /*int v33; // [sp-38h] [bp-2C8h]@62 |
11355 int v34; // [sp-34h] [bp-2C4h]@62 | 11354 int v34; // [sp-34h] [bp-2C4h]@62 |
11356 int v35; // [sp-30h] [bp-2C0h]@62 | 11355 int v35; // [sp-30h] [bp-2C0h]@62 |
11357 int v36; // [sp-2Ch] [bp-2BCh]@62 | 11356 int v36; // [sp-2Ch] [bp-2BCh]@62 |
11358 int v37; // [sp-28h] [bp-2B8h]@62 | 11357 int v37; // [sp-28h] [bp-2B8h]@62 |
11359 int v38; // [sp-24h] [bp-2B4h]@62 | 11358 int v38; // [sp-24h] [bp-2B4h]@62 |
11363 int v42; // [sp-14h] [bp-2A4h]@62 | 11362 int v42; // [sp-14h] [bp-2A4h]@62 |
11364 char *v43; // [sp-10h] [bp-2A0h]@62 | 11363 char *v43; // [sp-10h] [bp-2A0h]@62 |
11365 char *v44; // [sp-Ch] [bp-29Ch]@62 | 11364 char *v44; // [sp-Ch] [bp-29Ch]@62 |
11366 unsigned int v45; // [sp-8h] [bp-298h]@62 | 11365 unsigned int v45; // [sp-8h] [bp-298h]@62 |
11367 char *v46; // [sp-4h] [bp-294h]@62 | 11366 char *v46; // [sp-4h] [bp-294h]@62 |
11368 const char *v47[5]; // [sp+0h] [bp-290h]@7 | 11367 const char *v47[5]; // [sp+0h] [bp-290h]@7*/ |
11369 char v48; // [sp+14h] [bp-27Ch]@37 | 11368 char v48[100]; // [sp+14h] [bp-27Ch]@37 |
11370 char v49; // [sp+78h] [bp-218h]@68 | 11369 char v49[100]; // [sp+78h] [bp-218h]@68 |
11371 char v50; // [sp+DCh] [bp-1B4h]@68 | 11370 char v50[100]; // [sp+DCh] [bp-1B4h]@68 |
11372 char v51; // [sp+140h] [bp-150h]@68 | 11371 char v51[100]; // [sp+140h] [bp-150h]@68 |
11373 char Dest; // [sp+1A4h] [bp-ECh]@36 | 11372 char Dest[100]; // [sp+1A4h] [bp-ECh]@36 |
11374 GUIWindow v53; // [sp+208h] [bp-88h]@1 | 11373 GUIWindow v53; // [sp+208h] [bp-88h]@1 |
11375 int v54; // [sp+25Ch] [bp-34h]@36 | 11374 int v54; // [sp+25Ch] [bp-34h]@36 |
11376 int v55; // [sp+260h] [bp-30h]@36 | 11375 int v55; // [sp+260h] [bp-30h]@36 |
11377 unsigned int v56; // [sp+264h] [bp-2Ch]@1 | 11376 unsigned int v56; // [sp+264h] [bp-2Ch]@1 |
11378 __int16 v57[2]; // [sp+268h] [bp-28h]@1 | 11377 int v57; // [sp+268h] [bp-28h]@1 |
11379 Player *v58; // [sp+26Ch] [bp-24h]@36 | 11378 Player *v58; // [sp+26Ch] [bp-24h]@36 |
11380 GUIWindow *v59; // [sp+270h] [bp-20h]@1 | 11379 GUIWindow *v59; // [sp+270h] [bp-20h]@1 |
11381 unsigned int v60; // [sp+274h] [bp-1Ch]@36 | 11380 unsigned int v60; // [sp+274h] [bp-1Ch]@36 |
11382 Player *v61; // [sp+278h] [bp-18h]@1 | 11381 Player *v61; // [sp+278h] [bp-18h]@1 |
11383 int v62; // [sp+27Ch] [bp-14h]@36 | 11382 int v62; // [sp+27Ch] [bp-14h]@36 |
11392 v61 = pPlayers[uActiveCharacter]; | 11391 v61 = pPlayers[uActiveCharacter]; |
11393 v1 = v61; | 11392 v1 = v61; |
11394 v53.uFrameX = 483; | 11393 v53.uFrameX = 483; |
11395 v53.uFrameWidth = 148; | 11394 v53.uFrameWidth = 148; |
11396 v53.uFrameZ = 334; | 11395 v53.uFrameZ = 334; |
11397 *(int *)v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | 11396 v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); |
11398 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | 11397 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); |
11399 v3 = 52 * (unsigned int)v0->ptr_1C; | 11398 v3 = 52 * (unsigned int)v0->ptr_1C; |
11400 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); | 11399 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); |
11401 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50); | 11400 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50); |
11402 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); | 11401 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); |
11412 v58 = (Player *)-1; | 11411 v58 = (Player *)-1; |
11413 v62 = 0; | 11412 v62 = 0; |
11414 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; | 11413 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; |
11415 v59 = pDialogueWindow; | 11414 v59 = pDialogueWindow; |
11416 v54 = v17; | 11415 v54 = v17; |
11417 strcpy(&Dest, ""); | 11416 strcpy(Dest, ""); |
11418 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); | 11417 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold |
11419 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); | 11418 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); |
11420 v19 = v16->pNumPresenceButton; | 11419 v19 = v16->pNumPresenceButton; |
11421 v20 = v18 + v17 + 146; | 11420 v20 = v18 + v17 + 146; |
11422 v21 = v16->pStartingPosActiveItem; | 11421 v21 = v16->pStartingPosActiveItem; |
11423 v63 = v20; | 11422 v63 = v20; |
11424 v55 = v20; | 11423 v55 = v20; |
11425 v60 = v21; | 11424 v60 = v21; |
11426 if ( v21 >= v21 + v19 ) | 11425 if ( v21 >= v21 + v19 ) |
11427 goto LABEL_71; | 11426 goto LABEL_71; |
11428 s1 = 2; | 11427 s1 = 2; |
11429 a1 = &v48; | 11428 a1 = v48; |
11430 while ( 1 ) | 11429 while ( 1 ) |
11431 { | 11430 { |
11432 v47[1] = (const char *)v60; | 11431 int v47 = v60; |
11433 v22 = window_SpeakInHouse->ptr_1C; | 11432 v22 = window_SpeakInHouse->ptr_1C; |
11434 v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62); | 11433 v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 |
11435 v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62); | 11434 v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land |
11436 v24 = v16->GetControl(v60); | 11435 v24 = v16->GetControl(v60); |
11437 if ( v23 != v58 | 11436 if ( v23 != v58 |
11438 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = (unsigned __int8)*(&byte_4F09B1[32 * (int)v23] | 11437 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = (unsigned __int8)*(&byte_4F09B1[32 * (int)v23] |
11439 + pParty->uDaysPlayed % 7)), | 11438 + pParty->uDaysPlayed % 7)), |
11440 v25 | 11439 v25 |
11442 || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v26])))) ) | 11441 || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v26])))) ) |
11443 { | 11442 { |
11444 v58 = v61; | 11443 v58 = v61; |
11445 v27 = (const char *)v56; | 11444 v27 = (const char *)v56; |
11446 if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) | 11445 if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) |
11447 v27 = *(const char **)v57; | 11446 v27 = (const char *)v57; |
11448 v47[1] = v27; | 11447 //v32.uRedbookTrackID = v27; |
11449 sprintf(a1, "\xC" "%05d", v27); | 11448 sprintf(a1, "\xC" "%05d", v27); |
11450 v66 = (unsigned __int8)byte_4F09B8[v26 * 4]; | 11449 v66 = (unsigned __int8)byte_4F09B8[v26 * 4]; |
11451 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) | 11450 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
11452 { | 11451 { |
11453 if ( CheckHiredNPCSpeciality(8u) ) | 11452 if ( CheckHiredNPCSpeciality(Sailor) ) |
11454 v66 -= 2; | 11453 v66 -= 2; |
11455 if ( CheckHiredNPCSpeciality(9u) ) | 11454 if ( CheckHiredNPCSpeciality(Navigator) ) |
11456 v66 -= 3; | 11455 v66 -= 3; |
11457 v47[1] = (const char *)45; | 11456 //v47 = Pirate; |
11457 if ( CheckHiredNPCSpeciality(Pirate) ) | |
11458 v66 -= 2; | |
11458 } | 11459 } |
11459 else | 11460 else |
11460 { | 11461 { |
11461 v47[1] = (const char *)35; | 11462 //v47 = Horseman; |
11463 if ( CheckHiredNPCSpeciality(Horseman) ) | |
11464 v66 -= 2; | |
11462 } | 11465 } |
11463 if ( CheckHiredNPCSpeciality((unsigned int)v47[1]) ) | 11466 if ( CheckHiredNPCSpeciality(Explorer) ) |
11464 v66 -= 2; | |
11465 if ( CheckHiredNPCSpeciality(0x2Cu) ) | |
11466 --v66; | 11467 --v66; |
11467 if ( v66 < 1 ) | 11468 if ( v66 < 1 ) |
11468 v66 = 1; | 11469 v66 = 1; |
11469 if ( v61 != (Player *)v2 ) | 11470 if ( v61 != (Player *)v2 ) |
11470 { | 11471 { |
11471 memcpy(&v32, (char *)&pMapStats + 68 * (unsigned __int8)byte_4F09B0[v26 * 4], 0x44u); | 11472 memcpy(&v32, &pMapStats->pInfos[(unsigned __int8)byte_4F09B0[v26 * 4]], 0x44u); |
11472 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[404], | 11473 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s |
11473 v66, | 11474 v66, v32.pName); |
11474 *(int *)&v32, | |
11475 v33, | |
11476 v34, | |
11477 v35, | |
11478 v36, | |
11479 v37, | |
11480 v38, | |
11481 v39, | |
11482 v40, | |
11483 v41, | |
11484 v42, | |
11485 v43, | |
11486 v44, | |
11487 v45, | |
11488 v46, | |
11489 *(_QWORD *)v47); | |
11490 strcat(a1, pTmpBuf); | 11475 strcat(a1, pTmpBuf); |
11491 v28 = a1; | 11476 v28 = a1; |
11492 a1 += 100; | 11477 a1 += 100; |
11493 ++v62; | 11478 ++v62; |
11494 ++s1; | 11479 ++s1; |
11521 break; | 11506 break; |
11522 v16 = v59; | 11507 v16 = v59; |
11523 } | 11508 } |
11524 if ( v63 != v55 ) | 11509 if ( v63 != v55 ) |
11525 { | 11510 { |
11526 v47[1] = &Dest; | 11511 /*v47[1] = &Dest; |
11527 v47[0] = &v51; | 11512 v47[0] = &v51; |
11528 v46 = &v50; | 11513 v46 = &v50; |
11529 v45 = (unsigned int)&v49; | 11514 v45 = (unsigned int)&v49; |
11530 v44 = &v48; | 11515 v44 = &v48; |
11531 v43 = pTmpBuf2; | 11516 v43 = pTmpBuf2;*/ |
11532 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, &v48, &v49, &v50, &v51, &Dest); | 11517 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest); |
11533 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | 11518 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); |
11534 } | 11519 } |
11535 else | 11520 else |
11536 { | 11521 { |
11537 LABEL_71: | 11522 LABEL_71: |
11538 v47[1] = (const char *)3; | 11523 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, |
11539 v47[0] = pGlobalTXT_LocalizationStrings[561]; | 11524 v57, pGlobalTXT_LocalizationStrings[561], 3); |
11540 v46 = *(char **)v57; | |
11541 v45 = (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138; | |
11542 v53.DrawTitleText(pFontArrus, 0, v45, (unsigned __int16)v46, v47[0], (unsigned int)v47[1]); | |
11543 pAudioPlayer->StopChannels(-1, -1); | 11525 pAudioPlayer->StopChannels(-1, -1); |
11544 } | 11526 } |
11545 } | 11527 } |
11546 } | 11528 } |
11547 else | 11529 else |
11558 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | 11540 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
11559 goto LABEL_33;*/ | 11541 goto LABEL_33;*/ |
11560 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 11542 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
11561 } | 11543 } |
11562 Party::TakeGold(s1); | 11544 Party::TakeGold(s1); |
11563 v47[1] = (const char *)7; | 11545 //v47[1] = (const char *)7; |
11564 v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)]; | 11546 v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)]; // negindex with ptr_1C around +0x36 |
11565 if ( v5[pParty->uDaysPlayed % 7 + 1] ) | 11547 if ( v5[pParty->uDaysPlayed % 7 + 1] ) |
11566 { | 11548 { |
11567 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) ) | 11549 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) ) |
11568 { | 11550 { |
11569 SaveGame(1, 0); | 11551 SaveGame(1, 0); |
11595 pParty->uFallStartY = pParty->vPosition.z; | 11577 pParty->uFallStartY = pParty->vPosition.z; |
11596 pParty->sRotationY = *((int *)v5 + 6); | 11578 pParty->sRotationY = *((int *)v5 + 6); |
11597 } | 11579 } |
11598 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); | 11580 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); |
11599 v12 = (unsigned __int8)v5[8]; | 11581 v12 = (unsigned __int8)v5[8]; |
11582 int _v47; | |
11600 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) | 11583 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
11601 { | 11584 { |
11602 v63 = SPEECH_72; | 11585 v63 = SPEECH_SetSail; |
11603 v13 = 2500; | 11586 v13 = 2500; |
11604 if ( CheckHiredNPCSpeciality(8u) ) | 11587 if ( CheckHiredNPCSpeciality(Sailor) ) |
11605 v12 -= 2; | 11588 v12 -= 2; |
11606 if ( CheckHiredNPCSpeciality(9u) ) | 11589 if ( CheckHiredNPCSpeciality(Navigator) ) |
11607 v12 -= 3; | 11590 v12 -= 3; |
11608 v47[1] = (const char *)45; | 11591 //_v47 = 45; |
11592 if ( CheckHiredNPCSpeciality(Pirate) ) | |
11593 v12 -= 2; | |
11609 } | 11594 } |
11610 else | 11595 else |
11611 { | 11596 { |
11612 v63 = SPEECH_71; | 11597 v63 = SPEECH_CarriageReady; |
11613 v13 = 1500; | 11598 v13 = 1500; |
11614 v47[1] = (const char *)35; | 11599 //_v47 = 35; |
11615 } | 11600 if ( CheckHiredNPCSpeciality(Horseman) ) |
11616 if ( CheckHiredNPCSpeciality((unsigned int)v47[1]) ) | 11601 v12 -= 2; |
11617 v12 -= 2; | 11602 } |
11618 if ( CheckHiredNPCSpeciality(0x2Cu) ) | 11603 if ( CheckHiredNPCSpeciality(Explorer) ) |
11619 --v12; | 11604 --v12; |
11620 if ( v12 < 1 ) | 11605 if ( v12 < 1 ) |
11621 v12 = 1; | 11606 v12 = 1; |
11622 RestAndHeal(1440 * v12); | 11607 RestAndHeal(1440 * v12); |
11623 v61->PlaySound((PlayerSpeech)v63, 0); | 11608 v61->PlaySound((PlayerSpeech)v63, 0); |