Mercurial > mm7
comparison mm7_1.cpp @ 1038:39f42990698f
Cleanings
author | Nomad |
---|---|
date | Thu, 23 May 2013 03:29:29 +0200 |
parents | 7735bdb3c30f |
children | d36681a9e4f8 |
comparison
equal
deleted
inserted
replaced
1035:306ec23b37df | 1038:39f42990698f |
---|---|
382 if ( (unsigned int)v8 / 0x18 ) | 382 if ( (unsigned int)v8 / 0x18 ) |
383 { | 383 { |
384 v10 = pGlobalTXT_LocalizationStrings[57]; // Days | 384 v10 = pGlobalTXT_LocalizationStrings[57]; // Days |
385 if ( v19 <= 1 ) | 385 if ( v19 <= 1 ) |
386 v10 = pGlobalTXT_LocalizationStrings[56]; // Day | 386 v10 = pGlobalTXT_LocalizationStrings[56]; // Day |
387 sprintf(pTmpBuf2, "%d %s ", v19, v10); | 387 sprintfex(pTmpBuf2, "%d %s ", v19, v10); |
388 strcat(pTmpBuf, pTmpBuf2); | 388 strcat(pTmpBuf, pTmpBuf2); |
389 } | 389 } |
390 if ( v9 ) | 390 if ( v9 ) |
391 { | 391 { |
392 if ( v9 <= 1 ) | 392 if ( v9 <= 1 ) |
393 v11 = pGlobalTXT_LocalizationStrings[109];// Hour | 393 v11 = pGlobalTXT_LocalizationStrings[109];// Hour |
394 else | 394 else |
395 v11 = pGlobalTXT_LocalizationStrings[110];// Hours | 395 v11 = pGlobalTXT_LocalizationStrings[110];// Hours |
396 sprintf(pTmpBuf2, "%d %s ", v9, v11); | 396 sprintfex(pTmpBuf2, "%d %s ", v9, v11); |
397 strcat(pTmpBuf, pTmpBuf2); | 397 strcat(pTmpBuf, pTmpBuf2); |
398 } | 398 } |
399 if ( v17 && !v19 ) | 399 if ( v17 && !v19 ) |
400 { | 400 { |
401 if ( v17 <= 1 ) | 401 if ( v17 <= 1 ) |
402 v12 = pGlobalTXT_LocalizationStrings[437];// Minute | 402 v12 = pGlobalTXT_LocalizationStrings[437];// Minute |
403 else | 403 else |
404 v12 = pGlobalTXT_LocalizationStrings[436];// Minutes | 404 v12 = pGlobalTXT_LocalizationStrings[436];// Minutes |
405 sprintf(pTmpBuf2, "%d %s ", v17, v12); | 405 sprintfex(pTmpBuf2, "%d %s ", v17, v12); |
406 strcat(pTmpBuf, pTmpBuf2); | 406 strcat(pTmpBuf, pTmpBuf2); |
407 } | 407 } |
408 if ( v18 && !v9 ) | 408 if ( v18 && !v9 ) |
409 { | 409 { |
410 if ( v18 <= 1 ) | 410 if ( v18 <= 1 ) |
411 v13 = pGlobalTXT_LocalizationStrings[439];// Second | 411 v13 = pGlobalTXT_LocalizationStrings[439];// Second |
412 else | 412 else |
413 v13 = pGlobalTXT_LocalizationStrings[438];// Seconds | 413 v13 = pGlobalTXT_LocalizationStrings[438];// Seconds |
414 sprintf(pTmpBuf2, "%d %s ", v18, v13); | 414 sprintfex(pTmpBuf2, "%d %s ", v18, v13); |
415 strcat(pTmpBuf, pTmpBuf2); | 415 strcat(pTmpBuf, pTmpBuf2); |
416 } | 416 } |
417 a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); | 417 a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); |
418 } | 418 } |
419 | 419 |
432 //----- (0041F5BE) -------------------------------------------------------- | 432 //----- (0041F5BE) -------------------------------------------------------- |
433 void __cdecl Sleep6Hours() | 433 void __cdecl Sleep6Hours() |
434 { | 434 { |
435 if ( _506F18_num_hours_to_sleep < 6 ) | 435 if ( _506F18_num_hours_to_sleep < 6 ) |
436 { | 436 { |
437 pParty->pPlayers[3].pConditions[2] = 0i64; | 437 pParty->pPlayers[3].SetAsleep(false); |
438 pParty->pPlayers[2].pConditions[2] = 0i64; | 438 pParty->pPlayers[2].SetAsleep(false); |
439 pParty->pPlayers[1].pConditions[2] = 0i64; | 439 pParty->pPlayers[1].SetAsleep(false); |
440 pParty->pPlayers[0].pConditions[2] = 0i64; | 440 pParty->pPlayers[0].SetAsleep(false); |
441 if ( _506F18_num_hours_to_sleep ) | 441 if ( _506F18_num_hours_to_sleep ) |
442 { | 442 { |
443 Rest(_506F18_num_hours_to_sleep); | 443 Rest(_506F18_num_hours_to_sleep); |
444 _506F18_num_hours_to_sleep = 0; | 444 _506F18_num_hours_to_sleep = 0; |
445 LoadActualSkyFrame(); | 445 LoadActualSkyFrame(); |
482 int v1; // ecx@2 | 482 int v1; // ecx@2 |
483 const char *v2; // eax@3 | 483 const char *v2; // eax@3 |
484 POINT v3; // [sp+0h] [bp-10h]@2 | 484 POINT v3; // [sp+0h] [bp-10h]@2 |
485 POINT a2; // [sp+8h] [bp-8h]@1 | 485 POINT a2; // [sp+8h] [bp-8h]@1 |
486 | 486 |
487 __debugbreak(); // invalid indexing | |
487 if ( pMouse->GetCursorPos(&a2)->y < 350 ) | 488 if ( pMouse->GetCursorPos(&a2)->y < 350 ) |
488 { | 489 { |
489 v0 = pMouse->GetCursorPos(&a2); | 490 v0 = pMouse->GetCursorPos(&a2); |
490 v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]]; | 491 v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]]; |
491 if ( v1 ) | 492 if ( v1 ) |
753 pIcons_LOD->SyncLoadedFilesCount(); | 754 pIcons_LOD->SyncLoadedFilesCount(); |
754 } | 755 } |
755 return 1; | 756 return 1; |
756 } | 757 } |
757 | 758 |
758 //----- (00421D00) -------------------------------------------------------- | |
759 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) | |
760 { | |
761 //unsigned int v1; // esi@1 | |
762 //int v2; // eax@2 | |
763 //Player *v3; // ecx@2 | |
764 //Player *v4; // ecx@5 | |
765 unsigned int v5; // [sp-4h] [bp-10h]@21 | |
766 | |
767 //v1 = uPlayerID; | |
768 auto player = &pParty->pPlayers[uPlayerID - 1]; | |
769 if (pParty->pPickedItem.uItemID) | |
770 { | |
771 //v3 = player; | |
772 if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) | |
773 { | |
774 memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u); | |
775 viewparams->bRedrawGameUI = true; | |
776 pMouse->RemoveHoldingItem(); | |
777 return; | |
778 } | |
779 | |
780 if (!player->CanAct()) | |
781 { | |
782 player = pPlayers[uActiveCharacter]; | |
783 } | |
784 if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) | |
785 player->PlaySound(SPEECH_NoRoom, 0); | |
786 } | |
787 | |
788 //LABEL_9: | |
789 if (pCurrentScreen == SCREEN_GAME) | |
790 { | |
791 viewparams->bRedrawGameUI = true; | |
792 if ( uActiveCharacter != uPlayerID ) | |
793 //goto LABEL_27; | |
794 { | |
795 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
796 return; | |
797 | |
798 uActiveCharacter = uPlayerID; | |
799 return; | |
800 } | |
801 v5 = 7; | |
802 //LABEL_22: | |
803 pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); | |
804 return; | |
805 } | |
806 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) | |
807 return; | |
808 if ( pCurrentScreen == SCREEN_CHEST ) | |
809 { | |
810 //LABEL_23: | |
811 viewparams->bRedrawGameUI = true; | |
812 if ( uActiveCharacter == uPlayerID ) | |
813 { | |
814 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
815 pCurrentScreen = SCREEN_CHEST_INVENTORY; | |
816 //goto LABEL_28; | |
817 uActiveCharacter = uPlayerID; | |
818 return; | |
819 } | |
820 //LABEL_27: | |
821 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
822 return; | |
823 //goto LABEL_28; | |
824 uActiveCharacter = uPlayerID; | |
825 return; | |
826 } | |
827 if ( pCurrentScreen != SCREEN_HOUSE ) | |
828 { | |
829 if ( pCurrentScreen == SCREEN_E ) | |
830 { | |
831 //LABEL_28: | |
832 uActiveCharacter = uPlayerID; | |
833 return; | |
834 } | |
835 if ( pCurrentScreen != SCREEN_CHEST_INVENTORY ) | |
836 { | |
837 viewparams->bRedrawGameUI = true; | |
838 uActiveCharacter = uPlayerID; | |
839 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) | |
840 FillAwardsData(); | |
841 return; | |
842 } | |
843 //goto LABEL_23; | |
844 viewparams->bRedrawGameUI = true; | |
845 if ( uActiveCharacter == uPlayerID ) | |
846 { | |
847 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
848 pCurrentScreen = SCREEN_CHEST_INVENTORY; | |
849 //goto LABEL_28; | |
850 uActiveCharacter = uPlayerID; | |
851 return; | |
852 } | |
853 //LABEL_27: | |
854 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
855 return; | |
856 //goto LABEL_28; | |
857 uActiveCharacter = uPlayerID; | |
858 return; | |
859 } | |
860 if ( window_SpeakInHouse->field_40 == 1 ) | |
861 return; | |
862 viewparams->bRedrawGameUI = true; | |
863 if ( uActiveCharacter != uPlayerID ) | |
864 //goto LABEL_28; | |
865 uActiveCharacter = uPlayerID; | |
866 return; | |
867 if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) | |
868 { | |
869 __debugbreak(); // fix indexing | |
870 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
871 v5 = 14; | |
872 //goto LABEL_22; | |
873 pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); | |
874 return; | |
875 } | |
876 } | |
877 // 4E28F8: using guessed type int pCurrentScreen; | |
878 // F8B19C: using guessed type int dword_F8B19C; | |
879 | 759 |
880 //----- (00421EA6) -------------------------------------------------------- | 760 //----- (00421EA6) -------------------------------------------------------- |
881 void __cdecl OnInventoryLeftClick() | 761 void __cdecl OnInventoryLeftClick() |
882 { | 762 { |
883 Player *v0; // ebx@1 | 763 Player *v0; // ebx@1 |
992 BLVFace *v3; // eax@10 | 872 BLVFace *v3; // eax@10 |
993 unsigned int v4; // eax@11 | 873 unsigned int v4; // eax@11 |
994 unsigned __int16 v5; // dx@14 | 874 unsigned __int16 v5; // dx@14 |
995 signed int v6; // eax@14 | 875 signed int v6; // eax@14 |
996 char *v7; // esi@15 | 876 char *v7; // esi@15 |
997 int *v8; // eax@19 | 877 //int *v8; // eax@19 |
998 int v9; // eax@19 | 878 int v9; // eax@19 |
999 unsigned int v10; // eax@19 | 879 unsigned int v10; // eax@19 |
1000 int v11; // ecx@21 | 880 int v11; // ecx@21 |
1001 ODMFace *v12; // eax@22 | 881 ODMFace *v12; // eax@22 |
1002 LevelDecoration *v13; // esi@24 | 882 LevelDecoration *v13; // esi@24 |
1009 const char *v20; // eax@51 | 889 const char *v20; // eax@51 |
1010 signed int v21; // eax@58 | 890 signed int v21; // eax@58 |
1011 ItemGen *v22; // esi@62 | 891 ItemGen *v22; // esi@62 |
1012 unsigned int v23; // eax@62 | 892 unsigned int v23; // eax@62 |
1013 SpriteObject a1; // [sp+Ch] [bp-80h]@1 | 893 SpriteObject a1; // [sp+Ch] [bp-80h]@1 |
1014 POINT v25; // [sp+7Ch] [bp-10h]@3 | 894 //POINT v25; // [sp+7Ch] [bp-10h]@3 |
1015 POINT a2; // [sp+84h] [bp-8h]@3 | 895 POINT a2; // [sp+84h] [bp-8h]@3 |
1016 | 896 |
1017 if ( pRenderer->pRenderD3D ) | 897 if ( pRenderer->pRenderD3D ) |
1018 { | 898 { |
1019 v0 = pGame->pVisInstance->get_picked_object_zbuf_val(); | 899 v0 = pGame->pVisInstance->get_picked_object_zbuf_val(); |
1020 } | 900 } |
1021 else | 901 else |
1022 { | 902 { |
1023 v1 = pMouse->GetCursorPos(&a2); | 903 v1 = pMouse->GetCursorPos(&a2); |
1024 v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]]; | 904 v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]]; |
1025 } | 905 } |
906 | |
1026 if ( PID_TYPE(v0) == OBJECT_Item) | 907 if ( PID_TYPE(v0) == OBJECT_Item) |
1027 { | 908 { |
1028 a2.y = (signed int)(unsigned __int16)v0 >> 3; | 909 a2.y = (signed int)(unsigned __int16)v0 >> 3; |
1029 v21 = (signed int)(unsigned __int16)v0 >> 3; | 910 v21 = (signed int)(unsigned __int16)v0 >> 3; |
1030 if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) | 911 if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) |
1142 pParty->vPosition.x, | 1023 pParty->vPosition.x, |
1143 pParty->vPosition.y, | 1024 pParty->vPosition.y, |
1144 pParty->sEyelevel + pParty->vPosition.z); | 1025 pParty->sEyelevel + pParty->vPosition.z); |
1145 a1.uSpriteFrameID = 0; | 1026 a1.uSpriteFrameID = 0; |
1146 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); | 1027 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); |
1147 v8 = (int *)pMouse->GetCursorPos(&v25); | 1028 |
1148 v9 = UnprojectX(*v8); | 1029 extern int UnprojectX(int); |
1030 v9 = UnprojectX(v1->x); | |
1149 a1.Create(pParty->sRotationY + v9, 184, 200, 0); | 1031 a1.Create(pParty->sRotationY + v9, 184, 200, 0); |
1150 v10 = pIcons_LOD->LoadTexture( | 1032 v10 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1151 pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, | |
1152 TEXTURE_16BIT_PALETTE); | |
1153 if (v10 != -1) | 1033 if (v10 != -1) |
1154 pIcons_LOD->pTextures[v10].Release(); | 1034 pIcons_LOD->pTextures[v10].Release(); |
1155 pMouse->RemoveHoldingItem(); | 1035 pMouse->RemoveHoldingItem(); |
1156 pIcons_LOD->SyncLoadedFilesCount(); | 1036 pIcons_LOD->SyncLoadedFilesCount(); |
1157 return; | 1037 return; |
1523 else assert(false); | 1403 else assert(false); |
1524 | 1404 |
1525 uGameUIFontMain = v3; | 1405 uGameUIFontMain = v3; |
1526 uGameUIFontShadow = TargetColor(v5, v4, v6); | 1406 uGameUIFontShadow = TargetColor(v5, v4, v6); |
1527 } | 1407 } |
1408 | |
1409 | |
1410 | |
1411 | |
1528 | 1412 |
1529 //----- (00423AEE) -------------------------------------------------------- | 1413 //----- (00423AEE) -------------------------------------------------------- |
1530 void __cdecl reset_some_strus_flt_2Cs() | 1414 void __cdecl reset_some_strus_flt_2Cs() |
1531 { | 1415 { |
1532 float *v0; // eax@1 | 1416 float *v0; // eax@1 |