comparison UI/UIHouses.cpp @ 1628:7ce831a2a393

m
author Ritor1
date Mon, 16 Sep 2013 09:37:08 +0600
parents fe2be40018a5
children 2149b14614ad
comparison
equal deleted inserted replaced
1627:361b63797bdf 1628:7ce831a2a393
2832 } 2832 }
2833 2833
2834 //----- (004B705E) -------------------------------------------------------- 2834 //----- (004B705E) --------------------------------------------------------
2835 void TempleDialog() 2835 void TempleDialog()
2836 { 2836 {
2837 GUIWindow *v0; // ebx@1 2837 //GUIWindow *v0; // ebx@1
2838 Player *v1; // esi@1 2838 //Player *v1; // esi@1
2839 int v2; // edi@1 2839 int v2; // edi@1
2840 int result; // eax@4 2840 int result; // eax@4
2841 GUIWindow *v4; // edi@6 2841 GUIWindow *v4; // edi@6
2842 void *v5; // eax@6 2842 void *v5; // eax@6
2843 int v6; // eax@6 2843 int v6; // eax@6
2897 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 2897 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64
2898 int v64; // [sp+1B8h] [bp-Ch]@6 2898 int v64; // [sp+1B8h] [bp-Ch]@6
2899 unsigned int v65; // [sp+1BCh] [bp-8h]@6 2899 unsigned int v65; // [sp+1BCh] [bp-8h]@6
2900 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 2900 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6
2901 2901
2902 v0 = window_SpeakInHouse; 2902 //v0 = window_SpeakInHouse;
2903 memcpy(&v57, window_SpeakInHouse, sizeof(v57)); 2903 memcpy(&v57, window_SpeakInHouse, sizeof(v57));
2904 v57.uFrameX = 483; 2904 v57.uFrameX = 483;
2905 v57.uFrameWidth = 148; 2905 v57.uFrameWidth = 148;
2906 v57.uFrameZ = 334; 2906 v57.uFrameZ = 334;
2907 HIDWORD(v58) = TargetColor(0xFFu, 0xFFu, 0xFFu); 2907 HIDWORD(v58) = TargetColor(0xFFu, 0xFFu, 0xFFu);
2908 HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu); 2908 HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu);
2909 v1 = pPlayers[uActiveCharacter]; 2909 //v1 = pPlayers[uActiveCharacter];
2910 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); 2910 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
2911 v2 = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[v0->par1C - 1].fPriceMultiplier); 2911 v2 = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier);
2912 HIDWORD(v60) = v2; 2912 HIDWORD(v60) = v2;
2913 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) 2913 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
2914 { 2914 {
2915 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) 2915 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL )
2916 { 2916 {
2924 v61 = pDialogueWindow; 2924 v61 = pDialogueWindow;
2925 v5 = window_SpeakInHouse->ptr_1C; 2925 v5 = window_SpeakInHouse->ptr_1C;
2926 v66 = 0; 2926 v66 = 0;
2927 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); 2927 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
2928 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); 2928 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
2929 v6 = v1->GetMerchant(); 2929 v6 = pPlayers[uActiveCharacter]->GetMerchant();
2930 v64 = (signed int)(v65 * (100 - v6)) / 100; 2930 v64 = (signed int)(v65 * (100 - v6)) / 100;
2931 if ( v64 < (signed int)v65 / 3 ) 2931 if ( v64 < (signed int)v65 / 3 )
2932 v64 = (signed int)v65 / 3; 2932 v64 = (signed int)v65 / 3;
2933 v7 = v4->pStartingPosActiveItem; 2933 v7 = v4->pStartingPosActiveItem;
2934 v8 = v7 + v4->pNumPresenceButton; 2934 v8 = v7 + v4->pNumPresenceButton;
2937 if ( (signed int)v7 >= v8 ) 2937 if ( (signed int)v7 >= v8 )
2938 goto LABEL_78; 2938 goto LABEL_78;
2939 do 2939 do
2940 { 2940 {
2941 v9 = v4->GetControl(v62)->msg_param - 36; 2941 v9 = v4->GetControl(v62)->msg_param - 36;
2942 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) 2942 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v9] && !pPlayers[uActiveCharacter]->pActiveSkills[v9] )
2943 { 2943 {
2944 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); 2944 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
2945 v66 = (DDM_DLV_Header *)((char *)v66 + v10); 2945 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
2946 ++v65; 2946 ++v65;
2947 } 2947 }
2967 while ( 1 ) 2967 while ( 1 )
2968 { 2968 {
2969 v14 = v12->GetControl(v62); 2969 v14 = v12->GetControl(v62);
2970 v15 = v14; 2970 v15 = v14;
2971 v16 = v14->msg_param - 36; 2971 v16 = v14->msg_param - 36;
2972 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) 2972 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v16] || pPlayers[uActiveCharacter]->pActiveSkills[v16] )
2973 { 2973 {
2974 v15->uW = 0; 2974 v15->uW = 0;
2975 v15->uHeight = 0; 2975 v15->uHeight = 0;
2976 v15->uY = 0; 2976 v15->uY = 0;
2977 } 2977 }
3001 } 3001 }
3002 } 3002 }
3003 else 3003 else
3004 { 3004 {
3005 LABEL_78: 3005 LABEL_78:
3006 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); 3006 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
3007 strcat(pTmpBuf.data(), "\n \n"); 3007 strcat(pTmpBuf.data(), "\n \n");
3008 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); 3008 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
3009 v22 = WORD2(v59); 3009 v22 = WORD2(v59);
3010 v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v57, 0, 0); 3010 v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v57, 0, 0);
3011 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u); 3011 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
3068 LOBYTE(v34) = v34 | 0x80; 3068 LOBYTE(v34) = v34 | 0x80;
3069 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0); 3069 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
3070 } 3070 }
3071 } 3071 }
3072 ++byte_F8B1EF[uActiveCharacter]; 3072 ++byte_F8B1EF[uActiveCharacter];
3073 v1->PlaySound(SPEECH_83, 0); 3073 pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0);
3074 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" 3074 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
3075 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 3075 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3076 return; 3076 return;
3077 } 3077 }
3078 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 3078 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
3079 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 3079 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3080 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 3080 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3081 return; 3081 return;
3082 } 3082 }
3083 if ( !v1->IsPlayerHealableByTemple() ) 3083 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
3084 return; 3084 return;
3085 v25 = 0; 3085 v25 = 0;
3086 if ( pParty->uNumGold < v2 ) 3086 if ( pParty->uNumGold < v2 )
3087 { 3087 {
3088 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 3088 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
3089 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 3089 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3090 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 3090 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3091 return; 3091 return;
3092 } 3092 }
3093 Party::TakeGold(v2); 3093 Party::TakeGold(v2);
3094 v35 = LODWORD(v1->pConditions[17]); 3094 v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[17]);
3095 v59 = v1->pConditions[14]; 3095 v59 = pPlayers[uActiveCharacter]->pConditions[14];
3096 v58 = v1->pConditions[15]; 3096 v58 = pPlayers[uActiveCharacter]->pConditions[15];
3097 v60 = v1->pConditions[16]; 3097 v60 = pPlayers[uActiveCharacter]->pConditions[16];
3098 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]); 3098 v61 = (GUIWindow *)HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]);
3099 memset(v1, 0, 0xA0u); 3099 memset(pPlayers[uActiveCharacter], 0, 0xA0u);
3100 v1->sHealth = v1->GetMaxHealth(); 3100 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
3101 v1->sMana = v1->GetMaxMana(); 3101 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
3102 v36 = (signed int)window_SpeakInHouse->ptr_1C; 3102 v36 = (signed int)window_SpeakInHouse->ptr_1C;
3103 if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) 3103 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
3104 { 3104 {
3105 if ( (unsigned int)v61 | v35 ) 3105 if ( (unsigned int)v61 | v35 )
3106 { 3106 {
3107 v37 = LOBYTE(v1->uPrevFace); 3107 v37 = LOBYTE(pPlayers[uActiveCharacter]->uPrevFace);
3108 v38 = v1->uPrevVoiceID; 3108 v38 = pPlayers[uActiveCharacter]->uPrevVoiceID;
3109 v1->uCurrentFace = v37; 3109 pPlayers[uActiveCharacter]->uCurrentFace = v37;
3110 v1->uVoiceID = v38; 3110 pPlayers[uActiveCharacter]->uVoiceID = v38;
3111 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); 3111 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
3112 } 3112 }
3113 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 3113 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
3114 v1->PlaySound(SPEECH_82, 0); 3114 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
3115 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 3115 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
3116 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 3116 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3117 return; 3117 return;
3118 } 3118 }
3119 v39 = v61; 3119 v39 = v61;
3120 if ( (unsigned int)v61 | v35 ) 3120 if ( (unsigned int)v61 | v35 )
3121 { 3121 {
3122 LODWORD(v1->pConditions[17]) = v35; 3122 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = v35;
3123 } 3123 }
3124 else 3124 else
3125 { 3125 {
3126 if ( !v60 && !v58 && !v59 ) 3126 if ( !v60 && !v58 && !v59 )
3127 { 3127 {
3128 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 3128 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
3129 v1->PlaySound(SPEECH_82, 0); 3129 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
3130 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 3130 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
3131 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 3131 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3132 return; 3132 return;
3133 } 3133 }
3134 v1->uPrevFace = v1->uCurrentFace; 3134 pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace;
3135 v1->uPrevVoiceID = v1->uVoiceID; 3135 pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID;
3136 v1->SetCondition(0x11u, 1); 3136 pPlayers[uActiveCharacter]->SetCondition(0x11u, 1);
3137 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23; 3137 pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
3138 v40 = (v1->GetSexByVoice() != 0) + 23; 3138 v40 = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
3139 v1->uCurrentFace = v40; 3139 pPlayers[uActiveCharacter]->uCurrentFace = v40;
3140 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40); 3140 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
3141 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed); 3141 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = LODWORD(pParty->uTimePlayed);
3142 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); 3142 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
3143 } 3143 }
3144 HIDWORD(v1->pConditions[17]) = (int)v39; 3144 HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]) = (int)v39;
3145 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 3145 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
3146 v1->PlaySound(SPEECH_82, 0); 3146 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
3147 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 3147 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
3148 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 3148 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3149 return; // void func 3149 return; // void func
3150 } 3150 }
3151 v63 = 1; 3151 v63 = 1;
3152 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); 3152 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
3153 strcpy(a1, ""); 3153 strcpy(a1, "");
3154 v41->uHeight = 0; 3154 v41->uHeight = 0;
3155 v41->uY = 0; 3155 v41->uY = 0;
3156 if ( v1->IsPlayerHealableByTemple() ) 3156 if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
3157 { 3157 {
3158 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); 3158 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
3159 v63 = 0; 3159 v63 = 0;
3160 } 3160 }
3161 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]); 3161 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]);