comparison mm7_4.cpp @ 248:37dcbe8f3cca

Dialogue stuff
author Nomad
date Mon, 18 Feb 2013 07:11:43 +0200
parents c879446b4a22
children 9a8d37c07e50
comparison
equal deleted inserted replaced
247:fb8a876f41e1 248:37dcbe8f3cca
3517 } 3517 }
3518 while ( v9 < v13 ); 3518 while ( v9 < v13 );
3519 } 3519 }
3520 } 3520 }
3521 v44 = 0; 3521 v44 = 0;
3522 if ( sub_476387() == 1 ) 3522 if (PartyHasDragon())
3523 v44 = 1; 3523 v44 = 1;
3524 v49 = 0; 3524 v49 = 0;
3525 LABEL_25: 3525 LABEL_25:
3526 v20 = 0; 3526 v20 = 0;
3527 v21 = &pParty->pPlayers[v49]; 3527 v21 = &pParty->pPlayers[v49];
4903 if ( IsBadStringPtrA(lpsz, 1u) ) 4903 if ( IsBadStringPtrA(lpsz, 1u) )
4904 return "Invalid String Passed"; 4904 return "Invalid String Passed";
4905 v60 = strlen(Str); 4905 v60 = strlen(Str);
4906 a1[0] = 0; 4906 a1[0] = 0;
4907 pPlayer = &pParty->pPlayers[v6]; 4907 pPlayer = &pParty->pPlayers[v6];
4908 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 4908 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155);
4909 v61 = pPlayer; 4909 v61 = pPlayer;
4910 memset(pTmpBuf2, 0, 0x7D0u); 4910 memset(pTmpBuf2, 0, 0x7D0u);
4911 if ( dword_5C35D4 ) 4911 if ( dword_5C35D4 )
4912 {
4913 __debugbreak(); // fix
4912 v9 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; 4914 v9 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
4915 }
4913 else 4916 else
4914 v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID); 4917 v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID);
4915 v65 = v9; 4918 v65 = v9;
4916 v10 = 0; 4919 v10 = 0;
4917 v64 = 0; 4920 v64 = 0;
9402 char *v15; // eax@58 9405 char *v15; // eax@58
9403 unsigned int v16; // ebp@62 9406 unsigned int v16; // ebp@62
9404 char *v17; // ecx@63 9407 char *v17; // ecx@63
9405 char *v18; // eax@65 9408 char *v18; // eax@65
9406 const char *v19; // ecx@68 9409 const char *v19; // ecx@68
9407 unsigned int v20; // eax@69 9410 //unsigned int v20; // eax@69
9408 unsigned int v21; // ecx@70 9411 unsigned int v21; // ecx@70
9409 char *v22; // [sp-Ch] [bp-18h]@73 9412 char *v22; // [sp-Ch] [bp-18h]@73
9410 int v23; // [sp-8h] [bp-14h]@49 9413 int v23; // [sp-8h] [bp-14h]@49
9411 char *v24; // [sp-8h] [bp-14h]@73 9414 char *v24; // [sp-8h] [bp-14h]@73
9412 int v25; // [sp-4h] [bp-10h]@49 9415 int v25; // [sp-4h] [bp-10h]@49
9425 if ( a1 == 13 ) 9428 if ( a1 == 13 )
9426 { 9429 {
9427 ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); 9430 ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
9428 ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); 9431 ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
9429 sub_4B40E6(); 9432 sub_4B40E6();
9430 byte_F8B1EC = 0; 9433 dialogue_show_profession_details = false;
9431 goto _return; 9434 goto _return;
9432 } 9435 }
9433 switch ( a1 ) 9436 switch ( a1 )
9434 { 9437 {
9435 case 19: 9438 case 19:
9492 if ( a1 != 76 ) 9495 if ( a1 != 76 )
9493 { 9496 {
9494 if ( a1 == 77 ) 9497 if ( a1 == 77 )
9495 { 9498 {
9496 v16 = v2->uProfession; 9499 v16 = v2->uProfession;
9497 if ( byte_F8B1EC ) 9500 if (dialogue_show_profession_details)
9498 v17 = (char *)*(&pNPCStats->field_13A64 + 5 * v16); 9501 v17 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
9499 else 9502 else
9500 v17 = (char *)*(&pNPCStats->field_13A5C + 5 * v16); 9503 v17 = pNPCStats->pProfessions[v2->uProfession - 1].pBenefits;
9501 ptr_F8B1E8 = v17; 9504 ptr_F8B1E8 = v17;
9502 v18 = sub_495461(v17, uActiveCharacter - 1, 0, 0, 0, 0); 9505 v18 = sub_495461(v17, uActiveCharacter - 1, 0, 0, 0, 0);
9503 byte_F8B1EC ^= 1u; 9506 dialogue_show_profession_details = ~dialogue_show_profession_details;
9504 ptr_F8B1E8 = v18; 9507 ptr_F8B1E8 = v18;
9505 } 9508 }
9506 else 9509 else
9507 { 9510 {
9508 if ( a1 == 79 ) 9511 if ( a1 == 79 )
9614 v19 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" 9617 v19 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full""
9615 LABEL_77: 9618 LABEL_77:
9616 ShowStatusBarString(v19, 2u); 9619 ShowStatusBarString(v19, 2u);
9617 goto _return; 9620 goto _return;
9618 } 9621 }
9619 v20 = v2->uProfession; 9622 //v20 = v2->uProfession;
9620 if ( v20 != 51 ) 9623 if ( v2->uProfession != 51 )
9621 { 9624 {
9622 v21 = *(&pNPCStats->field_13A58 + 5 * v20); 9625 v21 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice;
9623 if ( pParty->uNumGold < v21 ) 9626 if ( pParty->uNumGold < v21 )
9624 { 9627 {
9625 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 9628 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
9626 byte_F8B1EC = 0; 9629 dialogue_show_profession_details = false;
9627 uDialogueType = 13; 9630 uDialogueType = 13;
9628 ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); 9631 ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
9629 ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); 9632 ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
9630 if ( uActiveCharacter ) 9633 if ( uActiveCharacter )
9631 pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); 9634 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
9632 v19 = pGlobalTXT_LocalizationStrings[155]; 9635 v19 = pGlobalTXT_LocalizationStrings[155];
9633 goto LABEL_77; 9636 goto LABEL_77;
9634 } 9637 }
9635 Party::TakeGold(v21); 9638 Party::TakeGold(v21);
9636 } 9639 }
12536 } 12539 }
12537 return result; 12540 return result;
12538 } 12541 }
12539 12542
12540 //----- (004BC49B) -------------------------------------------------------- 12543 //----- (004BC49B) --------------------------------------------------------
12541 void __thiscall sub_4BC49B(unsigned int _this) 12544 void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType)
12542 { 12545 {
12543 unsigned int v1; // esi@1 12546 //unsigned int v1; // esi@1
12544 NPCData *v2; // ebp@1 12547 NPCData *v2; // ebp@1
12545 unsigned int v3; // eax@1 12548 //unsigned int v3; // eax@1
12546 int v4; // ecx@10 12549 int v4; // ecx@10
12547 signed int v5; // edi@14 12550 signed int v5; // edi@14
12548 char *v6; // esi@15 12551 char *v6; // esi@15
12549 const char *v7; // ecx@22 12552 const char *v7; // ecx@22
12550 signed int v8; // edi@37 12553 signed int v8; // edi@37
12551 unsigned int v9; // eax@56 12554 //unsigned int v9; // eax@56
12552 unsigned int v10; // ecx@57 12555 unsigned int v10; // ecx@57
12553 void *v11; // [sp-Ch] [bp-1Ch]@46 12556 void *v11; // [sp-Ch] [bp-1Ch]@46
12554 int v12; // [sp-8h] [bp-18h]@46 12557 int v12; // [sp-8h] [bp-18h]@46
12555 char *v13; // [sp-8h] [bp-18h]@60 12558 char *v13; // [sp-8h] [bp-18h]@60
12556 size_t v14; // [sp-4h] [bp-14h]@46 12559 size_t v14; // [sp-4h] [bp-14h]@46
12557 const char *v15; // [sp-4h] [bp-14h]@60 12560 const char *v15; // [sp-4h] [bp-14h]@60
12558 12561
12559 v1 = _this; 12562 //v1 = _this;
12560 v2 = GetNPCData(uDialogue_SpeakingActorNPC_ID); 12563 v2 = GetNPCData(uDialogue_SpeakingActorNPC_ID);
12561 v3 = v1; 12564 //v3 = v1;
12562 uDialogueType = v1; 12565 uDialogueType = newDialogueType;
12563 if ( !v2->uFlags ) 12566 if ( !v2->uFlags )
12564 { 12567 {
12565 v2->uFlags = 1; 12568 v2->uFlags = 1;
12566 v3 = uDialogueType; 12569 //v3 = uDialogueType;
12567 } 12570 }
12568 if ( (signed int)v3 > 22 ) 12571 if ( (signed int)newDialogueType > 22 )
12569 { 12572 {
12570 if ( v3 == 23 ) 12573 if ( newDialogueType == DIALOGUE_23 )
12571 { 12574 {
12572 v4 = v2->evte; 12575 v4 = v2->evte;
12573 goto LABEL_74; 12576 goto LABEL_74;
12574 } 12577 }
12575 if ( v3 == 24 ) 12578 if (newDialogueType == DIALOGUE_24)
12576 { 12579 {
12577 v4 = v2->evtf; 12580 v4 = v2->evtf;
12578 goto LABEL_74; 12581 goto LABEL_74;
12579 } 12582 }
12580 if ( v3 != 76 ) 12583 if (newDialogueType != DIALOGUE_76)
12581 { 12584 {
12582 if ( v3 == 77 ) 12585 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS)
12583 { 12586 {
12584 byte_F8B1EC ^= 1u; 12587 dialogue_show_profession_details = ~dialogue_show_profession_details;
12585 } 12588 }
12586 else 12589 else
12587 { 12590 {
12588 if ( (signed int)v3 > 84 && (signed int)v3 <= 88 ) 12591 if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 )
12589 { 12592 {
12590 ArenaFight(); 12593 ArenaFight();
12591 return; 12594 return;
12592 } 12595 }
12593 } 12596 }
12594 goto LABEL_87; 12597 goto LABEL_87;
12595 } 12598 }
12596 if ( v2->uFlags & 0x80 ) 12599 if (v2->Hired())
12597 { 12600 {
12598 v8 = 0; 12601 v8 = 0;
12599 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) 12602 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
12600 { 12603 {
12601 v6 = (char *)pNPCStats->pNewNPCData; 12604 v6 = (char *)pNPCStats->pNewNPCData;
12644 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" 12647 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full""
12645 LABEL_64: 12648 LABEL_64:
12646 ShowStatusBarString(v7, 2u); 12649 ShowStatusBarString(v7, 2u);
12647 goto LABEL_87; 12650 goto LABEL_87;
12648 } 12651 }
12649 v9 = v2->uProfession; 12652 //v9 = v2->uProfession;
12650 if ( v9 != 51 ) 12653 if ( v2->uProfession != 51 )
12651 { 12654 {
12652 v10 = *(&pNPCStats->field_13A58 + 5 * v9); 12655 v10 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice;
12653 if ( pParty->uNumGold < v10 ) 12656 if ( pParty->uNumGold < v10 )
12654 { 12657 {
12655 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" 12658 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
12656 byte_F8B1EC = 0; 12659 dialogue_show_profession_details = false;
12657 uDialogueType = 13; 12660 uDialogueType = 13;
12658 if ( uActiveCharacter ) 12661 if ( uActiveCharacter )
12659 pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); 12662 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
12660 v7 = pGlobalTXT_LocalizationStrings[155]; 12663 v7 = pGlobalTXT_LocalizationStrings[155];
12661 goto LABEL_64; 12664 goto LABEL_64;
12662 } 12665 }
12663 Party::TakeGold(v10); 12666 Party::TakeGold(v10);
12664 } 12667 }
12689 pDialogue_SpeakingActor->uAIState = Removed; 12692 pDialogue_SpeakingActor->uAIState = Removed;
12690 if ( uActiveCharacter ) 12693 if ( uActiveCharacter )
12691 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); 12694 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
12692 goto LABEL_87; 12695 goto LABEL_87;
12693 } 12696 }
12694 if ( v3 == 22 ) 12697 if (newDialogueType == DIALOGUE_22)
12695 { 12698 {
12696 v4 = v2->evtd; 12699 v4 = v2->evtd;
12697 goto LABEL_74; 12700 goto LABEL_74;
12698 } 12701 }
12699 if ( v3 == 9 ) 12702 if (newDialogueType == DIALOGUE_9)
12700 { 12703 {
12701 if ( !sub_4BB756(v2->uProfession) ) 12704 if ( !sub_4BB756(v2->uProfession) )
12702 { 12705 {
12703 if ( v2->uProfession != 41 ) 12706 if ( v2->uProfession != 41 )
12704 v2->bHasUsedTheAbility = 1; 12707 v2->bHasUsedTheAbility = 1;
12712 goto LABEL_87; 12715 goto LABEL_87;
12713 } 12716 }
12714 v7 = pGlobalTXT_LocalizationStrings[140]; 12717 v7 = pGlobalTXT_LocalizationStrings[140];
12715 goto LABEL_64; 12718 goto LABEL_64;
12716 } 12719 }
12717 if ( v3 == 13 ) 12720 if (newDialogueType == DIALOGUE_13)
12718 { 12721 {
12719 if ( !(v2->uFlags & 0x80) ) 12722 if (!v2->Hired())
12720 { 12723 {
12721 sub_4B3E1E(); 12724 sub_4B3E1E();
12722 byte_F8B1EC = 0; 12725 dialogue_show_profession_details = false;
12723 goto LABEL_87; 12726 goto LABEL_87;
12724 } 12727 }
12725 v5 = 0; 12728 v5 = 0;
12726 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) 12729 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
12727 { 12730 {
12737 v6[8] &= 0x7Fu; 12740 v6[8] &= 0x7Fu;
12738 goto LABEL_44; 12741 goto LABEL_44;
12739 } 12742 }
12740 goto LABEL_44; 12743 goto LABEL_44;
12741 } 12744 }
12742 if ( v3 == 19 ) 12745 if (newDialogueType == DIALOGUE_19)
12743 { 12746 {
12744 v4 = v2->bDrawSomeAnim; 12747 v4 = v2->bDrawSomeAnim;
12745 goto LABEL_74; 12748 goto LABEL_74;
12746 } 12749 }
12747 if ( v3 == 20 ) 12750 if (newDialogueType == DIALOGUE_20)
12748 { 12751 {
12749 v4 = v2->_anim_current_time; 12752 v4 = v2->_anim_current_time;
12750 goto LABEL_74; 12753 goto LABEL_74;
12751 } 12754 }
12752 if ( v3 == 21 ) 12755 if (newDialogueType == DIALOGUE_21)
12753 { 12756 {
12754 v4 = v2->_anim_end_time; 12757 v4 = v2->_anim_end_time;
12755 LABEL_74: 12758 LABEL_74:
12756 if ( v4 < 200 || v4 > 310 ) 12759 if ( v4 < 200 || v4 > 310 )
12757 { 12760 {
12776 break; 12779 break;
12777 } 12780 }
12778 } 12781 }
12779 else 12782 else
12780 { 12783 {
12781 dword_F8B1D8 = v3; 12784 dword_F8B1D8 = newDialogueType;
12782 sub_4B3EF0(v4 - 400); 12785 sub_4B3EF0(v4 - 400);
12783 } 12786 }
12784 } 12787 }
12785 else 12788 else
12786 { 12789 {