Mercurial > mm7
changeset 1917:4ecc099ef876
sub_4BD8B5 converted to switch clause
author | zipi |
---|---|
date | Tue, 22 Oct 2013 21:31:24 +0100 |
parents | 918a8cebd7a4 |
children | c77935190b51 |
files | mm7_2.cpp |
diffstat | 1 files changed, 76 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/mm7_2.cpp Tue Oct 22 23:42:46 2013 +0600 +++ b/mm7_2.cpp Tue Oct 22 21:31:24 2013 +0100 @@ -616,77 +616,87 @@ pKeyActionMap->ResetKeys(); activeLevelDecoration = NULL; current_npc_text = 0; - if ( pDialogueNPCCount ) + if ( pDialogueNPCCount == 0) { + return 0; + } + + v0 = dialog_menu_id; + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL + && dialog_menu_id != HOUSE_DIALOGUE_97 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR + && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY && ShopTexture ) + { + ShopTexture->Release(); v0 = dialog_menu_id; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL - && dialog_menu_id != HOUSE_DIALOGUE_97 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR - && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY && ShopTexture ) - { - ShopTexture->Release(); - v0 = dialog_menu_id; - ShopTexture = 0; - } - if ( v0 && v0 != 1 ) - { - if ( v0 == -1 ) - { + ShopTexture = 0; + } + + switch(v0) + { + case -1: _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); pVideoPlayer->_4BF5B2(); - return 1; - } - if ( v0 != 94 && v0 != 96 && v0 != 101 ) - { - if ( v0 == 3 || v0 == 5 || v0 == 4 ) - { - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; - InitializaDialogueOptions_Shops(in_current_building_type); - } - else - { - if ( v0 != 102 && v0 != 103 && v0 != 104 ) - { - pVideoPlayer->_4BF5B2(); - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - InitializaDialogueOptions(in_current_building_type); - return 1; - } - pVideoPlayer->_4BF5B2(); - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; - InitializaDialogueOptions_Tavern(in_current_building_type); - } - return 1; - } - pVideoPlayer->_4BF5B2(); - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - InitializaDialogueOptions(in_current_building_type); - return 1; - } - pDialogueNPCCount = 0; - pDialogueWindow->Release(); - dialog_menu_id = HOUSE_DIALOGUE_NULL; - pDialogueWindow = 0; - pIcons_LOD->SyncLoadedFilesCount(); - if ( uNumDialogueNPCPortraits != 1 ) - { - pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; - if ( uNumDialogueNPCPortraits > 0 ) - { - for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i ) - { - HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i], - pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i], - 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0); - } - } - pVideoPlayer->_4BF5B2(); - return 1; - } + break; + + case 94: + case 96: + case 101: + pVideoPlayer->_4BF5B2(); + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + InitializaDialogueOptions(in_current_building_type); + break; + + case 3: + case 4: + case 5: + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; + InitializaDialogueOptions_Shops(in_current_building_type); + break; + + case 102: + case 103: + case 104: + pVideoPlayer->_4BF5B2(); + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; + InitializaDialogueOptions_Tavern(in_current_building_type); + break; + + case 0: + case 1: + pDialogueNPCCount = 0; + pDialogueWindow->Release(); + dialog_menu_id = HOUSE_DIALOGUE_NULL; + pDialogueWindow = 0; + pIcons_LOD->SyncLoadedFilesCount(); + + if ( uNumDialogueNPCPortraits == 1 ) + return 0; + + pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; + if ( uNumDialogueNPCPortraits > 0 ) + { + for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i ) + { + HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i], + pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i], + 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0); + } + } + + pVideoPlayer->_4BF5B2(); + break; + + default: + pVideoPlayer->_4BF5B2(); + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + InitializaDialogueOptions(in_current_building_type); + break; } - return 0; + + return 1; } //----- (004BF91E) --------------------------------------------------------