Mercurial > mm7
comparison UI/UIHouses.cpp @ 1573:6d759814a817
BankDialog() cleaned
author | Ritor1 |
---|---|
date | Sun, 08 Sep 2013 19:16:37 +0600 |
parents | c4ab816fcc5e |
children | 1264fce1a17f e6ac4919b22c |
comparison
equal
deleted
inserted
replaced
1572:19f1735fca80 | 1573:6d759814a817 |
---|---|
2365 } | 2365 } |
2366 | 2366 |
2367 //----- (004B7D7E) -------------------------------------------------------- | 2367 //----- (004B7D7E) -------------------------------------------------------- |
2368 void BankDialog() | 2368 void BankDialog() |
2369 { | 2369 { |
2370 GUIWindow *v0; // eax@4 | 2370 int entered_sum; // eax@19 |
2371 //int v1; // ecx@5 | 2371 unsigned int takes_sum; // esi@19 |
2372 int v2; // eax@6 | 2372 unsigned __int16 pColorText; // ax@27 |
2373 unsigned int v3; // esi@6 | 2373 GUIWindow bank_window; // [sp+Ch] [bp-5Ch]@1 |
2374 GUIFont *v4; // ST10_4@12 | 2374 |
2375 int v5; // eax@12 | 2375 memcpy(&bank_window, window_SpeakInHouse, sizeof(bank_window)); |
2376 int v6; // eax@19 | 2376 bank_window.uFrameX = 483; |
2377 unsigned int v7; // esi@19 | 2377 bank_window.uFrameWidth = 148; |
2378 unsigned __int16 v8; // ax@27 | 2378 bank_window.uFrameZ = 334; |
2379 unsigned __int16 v9; // ax@29 | 2379 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);//Баланс |
2380 char *v10; // [sp-8h] [bp-70h]@11 | 2380 bank_window.DrawTitleText(pFontArrus, 0, 220, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
2381 char *v11; // [sp-4h] [bp-6Ch]@11 | |
2382 GUIWindow _this; // [sp+Ch] [bp-5Ch]@1 | |
2383 __int16 v13[2]; // [sp+60h] [bp-8h]@1 | |
2384 __int16 v14[2]; // [sp+64h] [bp-4h]@1 | |
2385 | |
2386 memcpy(&_this, window_SpeakInHouse, sizeof(_this)); | |
2387 _this.uFrameX = 483; | |
2388 _this.uFrameWidth = 148; | |
2389 _this.uFrameZ = 334; | |
2390 *(int *)v13 = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
2391 *(int *)v14 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
2392 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); | |
2393 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf.data(), 3u); | |
2394 switch(dialog_menu_id) | 2381 switch(dialog_menu_id) |
2395 { | 2382 { |
2396 case HOUSE_DIALOGUE_MAIN: | 2383 case HOUSE_DIALOGUE_MAIN: |
2397 { | 2384 { |
2398 v8 = v14[0]; | 2385 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
2399 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) | 2386 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) |
2400 v8 = v13[0]; | 2387 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
2401 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); | 2388 bank_window.DrawTitleText(pFontArrus, 0, 146, pColorText, pGlobalTXT_LocalizationStrings[60], 3); |
2402 v9 = v14[0]; | 2389 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
2403 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) | 2390 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) |
2404 v9 = v13[0]; | 2391 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
2405 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); | 2392 bank_window.DrawTitleText(pFontArrus, 0, 176, pColorText, pGlobalTXT_LocalizationStrings[244], 3); |
2406 break; | 2393 break; |
2407 } | 2394 } |
2408 case HOUSE_DIALOGUE_BANK_7: | 2395 case HOUSE_DIALOGUE_BANK_PUT_GOLD: |
2409 { | 2396 { |
2410 v0 = window_SpeakInHouse; | 2397 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
2411 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) | 2398 { |
2412 { | 2399 sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"Положить" "Сколько?" |
2413 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | 2400 bank_window.DrawTitleText(pFontArrus, 0, 146, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
2414 { | 2401 bank_window.DrawTitleText(pFontArrus, 0, 186, TargetColor(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); |
2415 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | 2402 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
2416 v7 = v6; | 2403 return; |
2417 if ( !v6 ) | 2404 } |
2418 { | 2405 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) |
2419 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 2406 { |
2420 return; | 2407 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); |
2421 } | 2408 takes_sum = entered_sum; |
2422 if ( v6 > pParty->uNumGold ) | 2409 if ( !entered_sum ) |
2423 { | 2410 { |
2424 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | 2411 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2425 v7 = pParty->uNumGold; | 2412 return; |
2426 } | 2413 } |
2427 if ( v7 ) | 2414 if ( entered_sum > pParty->uNumGold ) |
2428 { | 2415 { |
2429 Party::TakeGold(v7); | 2416 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2430 pParty->uNumGoldInBank += v7; | 2417 takes_sum = pParty->uNumGold; |
2431 if ( uActiveCharacter ) | 2418 } |
2432 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); | 2419 if ( takes_sum ) |
2433 } | 2420 { |
2434 v0 = window_SpeakInHouse; | 2421 Party::TakeGold(takes_sum); |
2435 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 2422 pParty->uNumGoldInBank += takes_sum; |
2436 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 2423 if ( uActiveCharacter ) |
2437 return; | 2424 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); |
2438 } | 2425 } |
2439 if (window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) | 2426 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
2440 return; | 2427 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2441 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 2428 return; |
2442 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 2429 } |
2443 return; | 2430 if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) |
2444 } | 2431 { |
2445 v11 = pGlobalTXT_LocalizationStrings[112]; | 2432 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
2446 v10 = pGlobalTXT_LocalizationStrings[60]; | 2433 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2447 sprintf(pTmpBuf.data(), "%s\n%s", v10, v11); | 2434 } |
2448 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf.data(), 3u); | 2435 return; |
2449 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); | 2436 } |
2450 v4 = pFontArrus; | 2437 case HOUSE_DIALOGUE_BANK_GET_GOLD: |
2451 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); | 2438 { |
2452 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); | 2439 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
2453 break; | 2440 { |
2454 } | 2441 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"Снять" "Сколько?" |
2455 | 2442 bank_window.DrawTitleText(pFontArrus, 0, 146, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
2456 case HOUSE_DIALOGUE_BANK_8: | 2443 bank_window.DrawTitleText(pFontArrus, 0, 186, TargetColor(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); |
2457 { | 2444 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
2458 v0 = window_SpeakInHouse; | 2445 return; |
2459 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) | 2446 } |
2460 { | 2447 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) |
2461 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | 2448 { |
2462 { | 2449 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
2463 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 2450 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); |
2464 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | 2451 takes_sum = entered_sum; |
2465 v3 = v2; | 2452 if ( entered_sum ) |
2466 if ( v2 ) | 2453 { |
2467 { | 2454 if ( entered_sum > pParty->uNumGoldInBank ) |
2468 if ( v2 > pParty->uNumGoldInBank ) | 2455 { |
2469 { | 2456 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2470 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | 2457 takes_sum = pParty->uNumGoldInBank; |
2471 v3 = pParty->uNumGoldInBank; | 2458 } |
2472 } | 2459 if ( takes_sum ) |
2473 if ( v3 ) | 2460 { |
2474 { | 2461 Party::SetGold(pParty->uNumGold + takes_sum); |
2475 Party::SetGold(pParty->uNumGold + v3); | 2462 pParty->uNumGoldInBank -= takes_sum; |
2476 pParty->uNumGoldInBank -= v3; | 2463 } |
2477 } | 2464 } |
2478 } | 2465 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
2479 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 2466 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2480 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 2467 return; |
2481 return; | 2468 } |
2482 } | 2469 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) |
2483 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) | 2470 { |
2484 return; | 2471 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
2485 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 2472 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2486 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 2473 } |
2487 return; | 2474 return; |
2488 } | 2475 } |
2489 v11 = pGlobalTXT_LocalizationStrings[112]; | 2476 default: |
2490 v10 = pGlobalTXT_LocalizationStrings[244]; | 2477 { |
2491 sprintfex(pTmpBuf.data(), "%s\n%s", v10, v11); | 2478 break; |
2492 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf.data(), 3u); | 2479 } |
2493 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); | |
2494 v4 = pFontArrus; | |
2495 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2496 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); | |
2497 return; | |
2498 break; | |
2499 } | |
2500 | |
2501 default: | |
2502 { | |
2503 break; | |
2504 } | |
2505 } | 2480 } |
2506 } | 2481 } |
2507 // F8B19C: using guessed type int dword_F8B19C; | 2482 // F8B19C: using guessed type int dword_F8B19C; |
2508 | 2483 |
2509 //----- (004B8285) -------------------------------------------------------- | 2484 //----- (004B8285) -------------------------------------------------------- |
4085 v15 = ""; | 4060 v15 = ""; |
4086 v16 = (GUIButton *)pInString; | 4061 v16 = (GUIButton *)pInString; |
4087 goto LABEL_49; | 4062 goto LABEL_49; |
4088 } | 4063 } |
4089 if ( v28 != 10 ) | 4064 if ( v28 != 10 ) |
4090 goto LABEL_41; | 4065 { |
4066 v15 = ""; | |
4067 goto LABEL_49; | |
4068 } | |
4091 } | 4069 } |
4092 else | 4070 else |
4093 { | 4071 { |
4094 if ( v17 == 24 ) | 4072 if ( v17 == 24 ) |
4095 { | 4073 { |