comparison UIHouses.cpp @ 735:6daaa2f18d0d

Fixed some house sounds & shop-related stuff
author Nomad
date Fri, 22 Mar 2013 20:01:46 +0200
parents 9f596a163257
children 9cc972ebd3cf
comparison
equal deleted inserted replaced
734:2f4e33c1ed24 735:6daaa2f18d0d
355 //return result; 355 //return result;
356 } 356 }
357 357
358 358
359 //----- (0044622E) -------------------------------------------------------- 359 //----- (0044622E) --------------------------------------------------------
360 bool EnterHouse(enum HOUSE_ID uHouseID) 360 bool EnterHouse(enum HOUSE_ID uHouseID)
361 { 361 {
362 //enum HOUSE_ID v1; // edi@1 362 //enum HOUSE_ID v1; // edi@1
363 //int v2; // edi@5 363 //int v2; // edi@5
364 signed int uOpenTime; // eax@5 364 signed int uOpenTime; // eax@5
365 signed int uCloseTime; // esi@5 365 signed int uCloseTime; // esi@5
366 unsigned int v5; // esi@5 366 unsigned int v5; // esi@5
496 { 496 {
497 return 1; 497 return 1;
498 } 498 }
499 } 499 }
500 else 500 else
501 { //guilds 501 { //guilds
502 v19 = guild_mambership_flags[uHouseID-139]; //guilds flags 502 v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags
503 //v20 = uHouseID; 503 //v20 = uHouseID;
504 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) 504 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
505 if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19)) 505 if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
506 { 506 {
507 HousePlaySomeSound(uHouseID, 3); 507 PlayHouseSound(uHouseID, HouseSound_Greeting_2);
508 return 1; 508 return 1;
509 } 509 }
510 } 510 }
511 HousePlaySomeSound(uHouseID, 1); 511 PlayHouseSound(uHouseID, HouseSound_Greeting);
512 dword_5C35D4 = 1; 512 dword_5C35D4 = 1;
513 return 1; 513 return 1;
514 } 514 }
515 } 515 }
516 516
517 //----- (004B1E92) -------------------------------------------------------- 517 //----- (004B1E92) --------------------------------------------------------
518 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2) 518 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
519 { 519 {
520 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) 520 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
521 if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId ) 521 if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId )
522 pAudioPlayer->PlaySound( 522 pAudioPlayer->PlaySound(
523 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), 523 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)),
524 (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300), 524 (SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId + 300)),
525 806, 0, -1, 0, 0, 0, 0); 525 806, 0, -1, 0, 0, 0, 0);
526 } 526 }
527 527
528 //----- (004B4F4F) -------------------------------------------------------- 528 //----- (004B4F4F) --------------------------------------------------------
529 char *__cdecl JailDialog() 529 char *__cdecl JailDialog()
530 { 530 {
531 const char *v0; // esi@1 531 const char *v0; // esi@1
732 }*/ 732 }*/
733 return; 733 return;
734 } 734 }
735 if ( v1 > pParty->uNumGold ) 735 if ( v1 > pParty->uNumGold )
736 { 736 {
737 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 737 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
738 v2 = pParty->uNumGold; 738 v2 = pParty->uNumGold;
739 } 739 }
740 if ( v2 > pParty->uFine ) 740 if ( v2 > pParty->uFine )
741 v2 = pParty->uFine; 741 v2 = pParty->uFine;
742 Party::TakeGold(v2); 742 Party::TakeGold(v2);
828 }*/ 828 }*/
829 return; 829 return;
830 } 830 }
831 if ( v6 > pParty->uNumGold ) 831 if ( v6 > pParty->uNumGold )
832 { 832 {
833 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 833 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
834 v7 = pParty->uNumGold; 834 v7 = pParty->uNumGold;
835 } 835 }
836 if ( v7 ) 836 if ( v7 )
837 { 837 {
838 Party::TakeGold(v7); 838 Party::TakeGold(v7);
875 v3 = v2; 875 v3 = v2;
876 if ( v2 ) 876 if ( v2 )
877 { 877 {
878 if ( v2 > pParty->uNumGoldInBank ) 878 if ( v2 > pParty->uNumGoldInBank )
879 { 879 {
880 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 880 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
881 v3 = pParty->uNumGoldInBank; 881 v3 = pParty->uNumGoldInBank;
882 } 882 }
883 if ( v3 ) 883 if ( v3 )
884 { 884 {
885 Party::SetGold(pParty->uNumGold + v3); 885 Party::SetGold(pParty->uNumGold + v3);
1185 { 1185 {
1186 if ( pParty->uNumGold >= (unsigned int)pOutString ) 1186 if ( pParty->uNumGold >= (unsigned int)pOutString )
1187 { 1187 {
1188 Party::TakeGold((unsigned int)pOutString); 1188 Party::TakeGold((unsigned int)pOutString);
1189 v27 = (int)window_SpeakInHouse->ptr_1C; 1189 v27 = (int)window_SpeakInHouse->ptr_1C;
1190 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 1190 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
1191 dialog_menu_id = 0; 1191 dialog_menu_id = 0;
1192 sub_4BD8B5(); 1192 sub_4BD8B5();
1193 sub_4B1D27(); 1193 sub_4B1D27();
1194 pVideoPlayer->Unload(); 1194 pVideoPlayer->Unload();
1195 window_SpeakInHouse->Release(); 1195 window_SpeakInHouse->Release();
1201 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; 1201 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
1202 ++pMessageQueue_50CBD0->uNumMessages; 1202 ++pMessageQueue_50CBD0->uNumMessages;
1203 return; 1203 return;
1204 } 1204 }
1205 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); 1205 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
1206 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); 1206 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_4);
1207 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); 1207 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
1208 break; 1208 break;
1209 } 1209 }
1210 case DIALOG_SHOP_SKILLS: 1210 case DIALOG_SHOP_SKILLS:
1211 { 1211 {
1295 if ( pParty->uNumGold >= v7 ) 1295 if ( pParty->uNumGold >= v7 )
1296 { 1296 {
1297 Party::TakeGold(v7); 1297 Party::TakeGold(v7);
1298 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; 1298 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
1299 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; 1299 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1300 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); 1300 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
1301 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 1301 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
1302 return; 1302 return;
1303 } 1303 }
1304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); 1304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold"
1305 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); 1305 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_4);
1306 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); 1306 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
1307 break; 1307 break;
1308 } 1308 }
1309 case DIALOG_SHOP_ARCOMAGE_MAIN: 1309 case DIALOG_SHOP_ARCOMAGE_MAIN:
1310 { 1310 {
3222 else 3222 else
3223 { 3223 {
3224 if ( pParty->uNumGold < v63 ) 3224 if ( pParty->uNumGold < v63 )
3225 { 3225 {
3226 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" 3226 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
3227 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 3227 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
3228 } 3228 }
3229 else 3229 else
3230 { 3230 {
3231 Party::TakeGold(v63); 3231 Party::TakeGold(v63);
3232 v58->pActiveSkills[dialog_menu_id-36] = 1; 3232 v58->pActiveSkills[dialog_menu_id-36] = 1;
3706 v25 = 0; 3706 v25 = 0;
3707 if ( pParty->uNumGold < v2 ) 3707 if ( pParty->uNumGold < v2 )
3708 { 3708 {
3709 LABEL_55: 3709 LABEL_55:
3710 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 3710 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
3711 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 3711 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
3712 goto LABEL_46; 3712 goto LABEL_46;
3713 } 3713 }
3714 Party::TakeGold(v2); 3714 Party::TakeGold(v2);
3715 v35 = LODWORD(v1->pConditions[17]); 3715 v35 = LODWORD(v1->pConditions[17]);
3716 v59 = v1->pConditions[14]; 3716 v59 = v1->pConditions[14];
4055 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) 4055 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
4056 { 4056 {
4057 if ( pParty->uNumGold >= v11) 4057 if ( pParty->uNumGold >= v11)
4058 { 4058 {
4059 Party::TakeGold(v11); 4059 Party::TakeGold(v11);
4060 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 4060 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
4061 ++pPlayers[uActiveCharacter]->uLevel; 4061 ++pPlayers[uActiveCharacter]->uLevel;
4062 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; 4062 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5;
4063 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); 4063 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
4064 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); 4064 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
4065 v37 = 0; 4065 v37 = 0;
4092 return true; 4092 return true;
4093 } 4093 }
4094 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" 4094 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
4095 v63 = 4; 4095 v63 = 4;
4096 LABEL_55: 4096 LABEL_55:
4097 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63); 4097 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63);
4098 //LABEL_56: 4098 //LABEL_56:
4099 /*result = pMessageQueue_50CBD0->uNumMessages; 4099 /*result = pMessageQueue_50CBD0->uNumMessages;
4100 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 4100 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
4101 { 4101 {
4102 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 4102 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;