comparison mm7_4.cpp @ 775:7994986603d5

Moved some subs
author Nomad
date Sat, 23 Mar 2013 21:40:30 +0200
parents 67b77b052ef3
children c47efaf23642 b27dd658ea77
comparison
equal deleted inserted replaced
774:c319601893af 775:7994986603d5
8656 return; 8656 return;
8657 } 8657 }
8658 8658
8659 8659
8660 8660
8661 //----- (004B6943) --------------------------------------------------------
8662 void __cdecl TravelByTransport()
8663 {
8664 GUIWindow *v0; // ebx@1
8665 Player *v1; // esi@1
8666 signed int v2; // edi@1
8667 unsigned int v3; // eax@1
8668 signed int v4; // ebx@1
8669 stru365_travel_info *v5; // esi@7
8670 int v6; // eax@9
8671 int v7; // eax@9
8672 int v8; // eax@12
8673 int v9; // edi@12
8674 int v10; // edx@12
8675 int v11; // ecx@12
8676 signed int v12; // esi@13
8677 signed int v13; // edi@14
8678 DWORD v14; // eax@26
8679 DWORD v15; // edi@26
8680 GUIWindow *v16; // ebx@36
8681 int v17; // esi@36
8682 int v18; // eax@36
8683 int v19; // ecx@36
8684 int v20; // esi@36
8685 int v21; // eax@36
8686 void *v22; // eax@39
8687 int v23; // esi@39
8688 GUIButton *v24; // ebx@39
8689 signed int v25; // eax@41
8690 //int v26; // esi@44
8691 const char *v27; // eax@46
8692 char *v28; // eax@62
8693 int v29; // eax@62
8694 unsigned int v30; // ecx@62
8695 char *v31; // eax@63
8696 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
8697 /*int v33; // [sp-38h] [bp-2C8h]@62
8698 int v34; // [sp-34h] [bp-2C4h]@62
8699 int v35; // [sp-30h] [bp-2C0h]@62
8700 int v36; // [sp-2Ch] [bp-2BCh]@62
8701 int v37; // [sp-28h] [bp-2B8h]@62
8702 int v38; // [sp-24h] [bp-2B4h]@62
8703 int v39; // [sp-20h] [bp-2B0h]@62
8704 int v40; // [sp-1Ch] [bp-2ACh]@62
8705 int v41; // [sp-18h] [bp-2A8h]@62
8706 int v42; // [sp-14h] [bp-2A4h]@62
8707 char *v43; // [sp-10h] [bp-2A0h]@62
8708 char *v44; // [sp-Ch] [bp-29Ch]@62
8709 unsigned int v45; // [sp-8h] [bp-298h]@62
8710 char *v46; // [sp-4h] [bp-294h]@62
8711 const char *v47[5]; // [sp+0h] [bp-290h]@7*/
8712 char v48[100]; // [sp+14h] [bp-27Ch]@37
8713 char v49[100]; // [sp+78h] [bp-218h]@68
8714 char v50[100]; // [sp+DCh] [bp-1B4h]@68
8715 char v51[100]; // [sp+140h] [bp-150h]@68
8716 char Dest[100]; // [sp+1A4h] [bp-ECh]@36
8717 GUIWindow v53; // [sp+208h] [bp-88h]@1
8718 int v54; // [sp+25Ch] [bp-34h]@36
8719 int v55; // [sp+260h] [bp-30h]@36
8720 unsigned int v56; // [sp+264h] [bp-2Ch]@1
8721 int v57; // [sp+268h] [bp-28h]@1
8722 int v58; // [sp+26Ch] [bp-24h]@36
8723 GUIWindow *v59; // [sp+270h] [bp-20h]@1
8724 unsigned int v60; // [sp+274h] [bp-1Ch]@36
8725 //Player *v61; // [sp+278h] [bp-18h]@1
8726 int v62; // [sp+27Ch] [bp-14h]@36
8727 int v63; // [sp+280h] [bp-10h]@14
8728 char *a1; // [sp+284h] [bp-Ch]@37
8729 unsigned int s1; // [sp+288h] [bp-8h]@1
8730 int v66; // [sp+28Ch] [bp-4h]@48
8731
8732 v0 = window_SpeakInHouse;
8733 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
8734 v2 = 255;
8735 //v61 = pPlayers[uActiveCharacter];
8736 v1 = pPlayers[uActiveCharacter];
8737 v53.uFrameX = 483;
8738 v53.uFrameWidth = 148;
8739 v53.uFrameZ = 334;
8740 v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
8741 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
8742 v3 = 52 * (unsigned int)v0->ptr_1C;
8743 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
8744 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50);
8745 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
8746 v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
8747 s1 = v4 * (100 - v1->GetMerchant()) / 100;
8748 if ( (signed int)s1 < v4 / 3 )
8749 s1 = v4 / 3;
8750 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
8751 {
8752 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
8753 {
8754 v16 = pDialogueWindow;
8755 v58 = -1;
8756 v62 = 0;
8757 v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
8758 v59 = pDialogueWindow;
8759 v54 = v17;
8760 strcpy(Dest, "");
8761 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
8762 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
8763 v19 = v16->pNumPresenceButton;
8764 v20 = v18 + v17 + 146;
8765 v21 = v16->pStartingPosActiveItem;
8766 v63 = v20;
8767 v55 = v20;
8768 v60 = v21;
8769 if ( v21 >= v21 + v19 )
8770 goto LABEL_71;
8771 s1 = 2;
8772 a1 = v48;
8773 while ( 1 )
8774 {
8775 int v47 = v60;
8776 v22 = window_SpeakInHouse->ptr_1C;
8777 v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
8778 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
8779 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
8780 v24 = v16->GetControl(v60);
8781 if ( v23 != v58
8782 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]),
8783 v25
8784 && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) )
8785 {
8786 v58 = v23;
8787 v27 = (const char *)v56;
8788 if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
8789 v27 = (const char *)v57;
8790 //v32.uRedbookTrackID = v27;
8791 sprintf(a1, "\f%05d", v27);
8792 v66 = array_4F09B0[v23].uTravelTime;
8793 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
8794 {
8795 if ( CheckHiredNPCSpeciality(Sailor) )
8796 v66 -= 2;
8797 if ( CheckHiredNPCSpeciality(Navigator) )
8798 v66 -= 3;
8799 //v47 = Pirate;
8800 if ( CheckHiredNPCSpeciality(Pirate) )
8801 v66 -= 2;
8802 }
8803 else
8804 {
8805 //v47 = Horseman;
8806 if ( CheckHiredNPCSpeciality(Horseman) )
8807 v66 -= 2;
8808 }
8809 if ( CheckHiredNPCSpeciality(Explorer) )
8810 --v66;
8811 if ( v66 < 1 )
8812 v66 = 1;
8813 if ( v23 != v2 )
8814 {
8815 memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u);
8816 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
8817 v66, v32.pName);
8818 strcat(a1, pTmpBuf);
8819 v28 = a1;
8820 a1 += 100;
8821 ++v62;
8822 ++s1;
8823 strcat(v28, "\n \n");
8824 v24->uY = v63;
8825 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0);
8826 v30 = v24->uY;
8827 v24->uHeight = v29;
8828 v2 = 255;
8829 v24->uW = v30 + v29 - 1;
8830 v63 += v54 + v29;
8831 }
8832 }
8833 else
8834 {
8835 v31 = a1;
8836 ++v62;
8837 ++s1;
8838 a1 += 100;
8839 strcpy(v31, "");
8840 if ( v24 )
8841 {
8842 v24->uW = 0;
8843 v24->uHeight = 0;
8844 v24->uY = 0;
8845 }
8846 }
8847 ++v60;
8848 if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem )
8849 break;
8850 v16 = v59;
8851 }
8852 if ( v63 != v55 )
8853 {
8854 /*v47[1] = &Dest;
8855 v47[0] = &v51;
8856 v46 = &v50;
8857 v45 = (unsigned int)&v49;
8858 v44 = &v48;
8859 v43 = pTmpBuf2;*/
8860 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest);
8861 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
8862 }
8863 else
8864 {
8865 LABEL_71:
8866 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
8867 v57, pGlobalTXT_LocalizationStrings[561], 3);
8868 pAudioPlayer->StopChannels(-1, -1);
8869 }
8870 }
8871 }
8872 else
8873 {
8874 if ( dialog_menu_id > HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT && dialog_menu_id <= HOUSE_DIALOGUE_108 )
8875 {
8876 if ( pParty->uNumGold < s1 )
8877 {
8878 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
8879 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
8880 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
8881 return;
8882 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
8883 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
8884 goto LABEL_33;*/
8885 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
8886 }
8887 Party::TakeGold(s1);
8888 //v47[1] = (const char *)7;
8889 v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]];
8890 if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
8891 {
8892 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
8893 {
8894 SaveGame(1, 0);
8895 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
8896 v8 = v5->field_18;
8897 v9 = v5->field_14;
8898 v10 = v5->field_10;
8899 dword_6BE364_game_settings_1 |= 1u;
8900 _5B65B8_npcdata_hiword_house_or_other = 0;
8901 dword_5B65BC = 0;
8902 _5B65B4_npcdata_loword_house_or_other = v8;
8903 v11 = *((int *)v5 + 3);
8904 uGameState = 2;
8905 _5B65A8_npcdata_uflags_or_other = v11;
8906 _5B65AC_npcdata_fame_or_other = v10;
8907 _5B65B0_npcdata_rep_or_other = v9;
8908 dword_5B65C0 = v11 | v10 | v9 | v8;
8909 }
8910 else
8911 {
8912 v6 = v5->field_C;
8913 pParty->sRotationX = 0;
8914 pParty->vPosition.x = v6;
8915 v7 = v5->field_10;
8916 pIndoorCamera->sRotationY = 0;
8917 pParty->uFlags |= 2u;
8918 pParty->vPosition.y = v7;
8919 pParty->vPosition.z = v5->field_14;
8920 pParty->uFallStartY = pParty->vPosition.z;
8921 pParty->sRotationY = v5->field_18;
8922 }
8923 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
8924 v12 = v5->uTravelTime;
8925 int _v47;
8926 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
8927 {
8928 v63 = SPEECH_SetSail;
8929 v13 = 2500;
8930 if ( CheckHiredNPCSpeciality(Sailor) )
8931 v12 -= 2;
8932 if ( CheckHiredNPCSpeciality(Navigator) )
8933 v12 -= 3;
8934 //_v47 = 45;
8935 if ( CheckHiredNPCSpeciality(Pirate) )
8936 v12 -= 2;
8937 }
8938 else
8939 {
8940 v63 = SPEECH_CarriageReady;
8941 v13 = 1500;
8942 //_v47 = 35;
8943 if ( CheckHiredNPCSpeciality(Horseman) )
8944 v12 -= 2;
8945 }
8946 if ( CheckHiredNPCSpeciality(Explorer) )
8947 --v12;
8948 if ( v12 < 1 )
8949 v12 = 1;
8950 RestAndHeal(1440 * v12);
8951 v1->PlaySound((PlayerSpeech)v63, 0);
8952 v14 = GetTickCount();
8953 v15 = v14 + v13;
8954 if ( v15 < v14 )
8955 v15 = v14;
8956 while ( GetTickCount() < v15 )
8957 sqrt(3.1415926);
8958 while ( sub_4BD8B5() )
8959 ;
8960 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
8961 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
8962 {
8963 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
8964 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
8965 LABEL_33:
8966 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
8967 ++pMessageQueue_50CBD0->uNumMessages;
8968 return;
8969 }*/
8970 }
8971 else
8972 {
8973 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
8974 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
8975 }
8976 }
8977 }
8978 }
8979
8980
8981
8982 8661
8983 8662
8984 //----- (00405CFF) -------------------------------------------------------- 8663 //----- (00405CFF) --------------------------------------------------------
8985 void stru262_TurnBased::End(bool bPlaySound) 8664 void stru262_TurnBased::End(bool bPlaySound)
8986 { 8665 {