comparison mm7_4.cpp @ 1461:845907a747d3

Merge
author Gloval
date Wed, 21 Aug 2013 20:59:16 +0400
parents ff2118028c71 2ca62c9e7b3c
children 7ef4b64f6329
comparison
equal deleted inserted replaced
1460:ff2118028c71 1461:845907a747d3
45 #include "Log.h" 45 #include "Log.h"
46 #include "UI\UIHouses.h" 46 #include "UI\UIHouses.h"
47 #include "Lights.h" 47 #include "Lights.h"
48 48
49 //----- (0046CC4B) -------------------------------------------------------- 49 //----- (0046CC4B) --------------------------------------------------------
50 void __cdecl check_event_triggers() 50 void check_event_triggers()
51 { 51 {
52 int v0; // eax@1 52 int v0; // eax@1
53 LevelDecoration *v1; // esi@2 53 LevelDecoration *v1; // esi@2
54 signed int v2; // edi@2 54 signed int v2; // edi@2
55 int v3; // ebx@2 55 int v3; // ebx@2
88 int v36; // [sp+1Ch] [bp-8h]@3 88 int v36; // [sp+1Ch] [bp-8h]@3
89 signed int v37; // [sp+1Ch] [bp-8h]@12 89 signed int v37; // [sp+1Ch] [bp-8h]@12
90 signed int v38; // [sp+20h] [bp-4h]@24 90 signed int v38; // [sp+20h] [bp-4h]@24
91 91
92 v0 = 0; 92 v0 = 0;
93 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) 93 for ( i = 0; i < num_event_triggers; ++i )
94 { 94 {
95 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; 95 v1 = &pLevelDecorations[event_triggers[v0]];
96 v2 = v1->field_18; 96 v2 = v1->field_18;
97 v3 = v1->vPosition.y; 97 v3 = v1->vPosition.y;
98 v33 = v1->vPosition.x; 98 v33 = v1->vPosition.x;
99 v32 = v1->vPosition.y; 99 v32 = v1->vPosition.y;
100 v35 = v1->vPosition.z; 100 v35 = v1->vPosition.z;
438 result = _46BFFA_check_object_intercept(uLayingItemID, a2); 438 result = _46BFFA_check_object_intercept(uLayingItemID, a2);
439 return result; 439 return result;
440 } 440 }
441 441
442 //----- (0046E0B2) -------------------------------------------------------- 442 //----- (0046E0B2) --------------------------------------------------------
443 void __cdecl _46E0B2_collide_against_decorations() 443 void _46E0B2_collide_against_decorations()
444 { 444 {
445 BLVSector *v0; // ebp@1 445 BLVSector *v0; // ebp@1
446 LevelDecoration *v1; // edi@2 446 LevelDecoration *v1; // edi@2
447 DecorationDesc *v2; // esi@3 447 DecorationDesc *v2; // esi@3
448 int v3; // edx@4 448 int v3; // edx@4
530 } 530 }
531 } 531 }
532 } 532 }
533 533
534 //----- (00487DA9) -------------------------------------------------------- 534 //----- (00487DA9) --------------------------------------------------------
535 void __cdecl sub_487DA9() 535 void sub_487DA9()
536 { 536 {
537 for (int i = 0; i < 20000; ++i) 537 for (int i = 0; i < 20000; ++i)
538 array_77EC08[i].field_108 = 0; 538 array_77EC08[i].field_108 = 0;
539 } 539 }
540 540
595 int right = floorf((val - left) * 65536.0f); 595 int right = floorf((val - left) * 65536.0f);
596 return (left << 16) | right; 596 return (left << 16) | right;
597 } 597 }
598 598
599 //----- (00491E3A) -------------------------------------------------------- 599 //----- (00491E3A) --------------------------------------------------------
600 void __cdecl sub_491E3A() 600 void sub_491E3A()
601 { 601 {
602 Player *v0; // ebx@1 602 Player *v0; // ebx@1
603 signed int v1; // esi@3 603 signed int v1; // esi@3
604 char *v2; // eax@4 604 char *v2; // eax@4
605 unsigned int v3; // eax@7 605 unsigned int v3; // eax@7
696 pIcons_LOD->uNumLoadedFiles = v12; 696 pIcons_LOD->uNumLoadedFiles = v12;
697 } 697 }
698 // 4ED498: using guessed type char byte_4ED498; 698 // 4ED498: using guessed type char byte_4ED498;
699 699
700 //----- (00493938) -------------------------------------------------------- 700 //----- (00493938) --------------------------------------------------------
701 int __cdecl _493938_regenerate() 701 int _493938_regenerate()
702 { 702 {
703 int v0; // edi@1 703 int v0; // edi@1
704 signed __int64 v1; // qax@1 704 signed __int64 v1; // qax@1
705 int v2; // ecx@1 705 int v2; // ecx@1
706 int result; // eax@1 706 int result; // eax@1
840 a1.uSectorID = 0; 840 a1.uSectorID = 0;
841 a1.uSpriteFrameID = 0; 841 a1.uSpriteFrameID = 0;
842 a1.spell_caster_pid = v12; 842 a1.spell_caster_pid = v12;
843 a1.uFacing = 0; 843 a1.uFacing = 0;
844 a1.uSoundID = 0; 844 a1.uSoundID = 0;
845 v13 = sub_46A89E((int)v41, 100, 307); 845 v13 = _46A89E_immolation_effect((int)v41, 100, 307);
846 if ( v13 > 0 ) 846 if ( v13 > 0 )
847 { 847 {
848 do 848 do
849 { 849 {
850 v14 = (unsigned int *)&v41[4 * v9]; 850 v14 = (unsigned int *)&v41[4 * v9];
1068 } 1068 }
1069 return result; 1069 return result;
1070 } 1070 }
1071 1071
1072 //----- (00493F79) -------------------------------------------------------- 1072 //----- (00493F79) --------------------------------------------------------
1073 void sub_493F79(stru351_summoned_item *_this, __int64 a2) 1073 void init_summoned_item(stru351_summoned_item *_this, __int64 duration)
1074 { 1074 {
1075 signed __int64 v2; // ST2C_8@1 1075 signed __int64 v2; // ST2C_8@1
1076 signed __int64 v3; // qax@1 1076 signed __int64 v3; // qax@1
1077 //signed __int64 v4; // ST1C_8@1 1077 //signed __int64 v4; // ST1C_8@1
1078 unsigned __int64 v5; // qax@1 1078 unsigned __int64 v5; // qax@1
1079 unsigned int v6; // ebx@1 1079 unsigned int v6; // ebx@1
1080 1080
1081 v2 = (signed __int64)((double)a2 * 0.234375); 1081 v2 = (signed __int64)((double)duration * 0.234375);
1082 v3 = v2 / 60 / 60; 1082 v3 = v2 / 60 / 60;
1083 //v4 = v3; 1083 //v4 = v3;
1084 v5 = (unsigned int)v3 / 0x18; 1084 v5 = (unsigned int)v3 / 0x18;
1085 v6 = (unsigned int)(v5 / 7) >> 2; 1085 v6 = (unsigned int)(v5 / 7) >> 2;
1086 _this->field_0_expire_second = v2 % 60; 1086 _this->field_0_expire_second = v2 % 60;
1883 } 1883 }
1884 } 1884 }
1885 dword_AE3370 = v3; 1885 dword_AE3370 = v3;
1886 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; 1886 return pNPCStats->pNPCNames[0][v11 + 2 * v3];
1887 } 1887 }
1888 // AE336C: using guessed type int dword_AE336C; 1888
1889 // AE3370: using guessed type int dword_AE3370;
1890 1889
1891 //----- (00495430) -------------------------------------------------------- 1890 //----- (00495430) --------------------------------------------------------
1892 char * GetReputationString( signed int a1 ) 1891 char * GetReputationString( signed int a1 )
1893 { 1892 {
1894 if (a1 >= 25) 1893 if (a1 >= 25)
2239 strcat(pTmpBuf2.data(), a4); 2238 strcat(pTmpBuf2.data(), a4);
2240 dst = strlen(pTmpBuf2.data()); 2239 dst = strlen(pTmpBuf2.data());
2241 i += 2; 2240 i += 2;
2242 break; 2241 break;
2243 } 2242 }
2244 sub_493F79(&v56, *a6); 2243 init_summoned_item(&v56, *a6);
2245 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); 2244 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
2246 strcat(pTmpBuf2.data(), a1); 2245 strcat(pTmpBuf2.data(), a1);
2247 dst = strlen(pTmpBuf2.data()); 2246 dst = strlen(pTmpBuf2.data());
2248 i += 2; 2247 i += 2;
2249 break; 2248 break;
2270 strcat(pTmpBuf2.data(), a4); 2269 strcat(pTmpBuf2.data(), a4);
2271 dst = strlen(pTmpBuf2.data()); 2270 dst = strlen(pTmpBuf2.data());
2272 i += 2; 2271 i += 2;
2273 break; 2272 break;
2274 } 2273 }
2275 sub_493F79(&v56, pParty->field_3C._s_times[v17-51]); 2274 init_summoned_item(&v56, pParty->field_3C._s_times[v17-51]);
2276 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); 2275 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
2277 strcat(pTmpBuf2.data(), a1); 2276 strcat(pTmpBuf2.data(), a1);
2278 dst = strlen(pTmpBuf2.data()); 2277 dst = strlen(pTmpBuf2.data());
2279 i += 2; 2278 i += 2;
2280 break; 2279 break;
2613 } 2612 }
2614 return z; 2613 return z;
2615 } 2614 }
2616 2615
2617 //----- (004A57E9) -------------------------------------------------------- 2616 //----- (004A57E9) --------------------------------------------------------
2618 void __cdecl Present_ColorKey() 2617 void Present_ColorKey()
2619 { 2618 {
2620 HRESULT v0; // eax@3 2619 HRESULT v0; // eax@3
2621 HRESULT v1; // eax@3 2620 HRESULT v1; // eax@3
2622 HRESULT v2; // eax@3 2621 HRESULT v2; // eax@3
2623 HRESULT v3; // eax@3 2622 HRESULT v3; // eax@3
2937 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); 2936 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
2938 return result; 2937 return result;
2939 } 2938 }
2940 2939
2941 //----- (004B1523) -------------------------------------------------------- 2940 //----- (004B1523) --------------------------------------------------------
2942 void __thiscall sub_4B1523(int *_this) 2941 void sub_4B1523(int *_this)
2943 { 2942 {
2944 int v1; // esi@1 2943 int v1; // esi@1
2945 int v2; // edx@1 2944 int v2; // edx@1
2946 unsigned int v3; // eax@2 2945 unsigned int v3; // eax@2
2947 int v4; // eax@4 2946 int v4; // eax@4
3007 sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); 3006 sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
3008 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); 3007 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3);
3009 } 3008 }
3010 3009
3011 //----- (004B1ECE) -------------------------------------------------------- 3010 //----- (004B1ECE) --------------------------------------------------------
3012 void __cdecl sub_4B1ECE() 3011 void OracleDialogue()
3013 { 3012 {
3014 __int16 *v0; // edi@1 3013 __int16 *v0; // edi@1
3015 int v1; // ebx@3 3014 int v1; // ebx@3
3016 Player *v2; // esi@3 3015 Player *v2; // esi@3
3017 int v3; // eax@4 3016 int v3; // eax@4
3101 } 3100 }
3102 if ( v9 ) 3101 if ( v9 )
3103 v9->uHolderPlayer = v5; 3102 v9->uHolderPlayer = v5;
3104 } 3103 }
3105 } 3104 }
3106 // 4F08EC: using guessed type int dword_4F08EC[];
3107 // 722B3C: using guessed type int dword_722B3C;
3108 // 722B44: using guessed type int dword_722B44;
3109 // F8B1A8: using guessed type int dword_F8B1A8;
3110 3105
3111 //----- (004B254D) -------------------------------------------------------- 3106 //----- (004B254D) --------------------------------------------------------
3112 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) 3107 char * _4B254D_SkillMasteryTeacher(int _this)
3113 { 3108 {
3114 //Player *v1; // esi@1 3109 //Player *v1; // esi@1
3115 int v2; // edx@1 3110 int v2; // edx@1
3116 int v3; // ecx@1 3111 int v3; // ecx@1
3117 int v4; // edi@1 3112 int v4; // edi@1
3483 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Великий Магистр 3478 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Великий Магистр
3484 return pTmpBuf2.data(); 3479 return pTmpBuf2.data();
3485 } 3480 }
3486 3481
3487 //----- (004B3E1E) -------------------------------------------------------- 3482 //----- (004B3E1E) --------------------------------------------------------
3488 void __cdecl sub_4B3E1E() 3483 void sub_4B3E1E()
3489 { 3484 {
3490 NPCData *v0; // ST40_4@1 3485 NPCData *v0; // ST40_4@1
3491 signed int v1; // edi@1 3486 signed int v1; // edi@1
3492 //GUIWindow *v2; // ecx@1 3487 //GUIWindow *v2; // ecx@1
3493 3488
3504 } 3499 }
3505 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять 3500 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять
3506 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); 3501 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
3507 } 3502 }
3508 3503
3509 // F8B19C: using guessed type int dword_F8B19C;
3510 3504
3511 //----- (004B3FE5) -------------------------------------------------------- 3505 //----- (004B3FE5) --------------------------------------------------------
3512 void __fastcall sub_4B3FE5(int a4) 3506 void __fastcall sub_4B3FE5(int a4)
3513 { 3507 {
3514 int v1; // edi@1 3508 int v1; // edi@1
3542 v4 = pFontLucida->AlignText_Center(450, Str); 3536 v4 = pFontLucida->AlignText_Center(450, Str);
3543 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); 3537 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0);
3544 } 3538 }
3545 3539
3546 //----- (004B46F8) -------------------------------------------------------- 3540 //----- (004B46F8) --------------------------------------------------------
3547 int __fastcall sub_4B46F8(int a1) 3541 __int64 GetExperienceRequiredForLevel(int level)
3548 { 3542 {
3549 int v1; // eax@1 3543 __int64 v1; // eax@1
3550 int i; // edx@1 3544 int i; // edx@1
3551 3545
3552 v1 = 0; 3546 v1 = 0;
3553 for ( i = 0; i < a1; ++i ) 3547 for ( i = 0; i < level; ++i )
3554 v1 += i + 1; 3548 v1 += i + 1;
3555 return 1000 * v1; 3549 return 1000 * v1;
3556 } 3550 }
3557 3551
3558 //----- (004BC49B) -------------------------------------------------------- 3552 //----- (004BC49B) --------------------------------------------------------
3754 else 3748 else
3755 { 3749 {
3756 switch ( npc_event_id ) 3750 switch ( npc_event_id )
3757 { 3751 {
3758 case 139: 3752 case 139:
3759 sub_4B1ECE(); 3753 OracleDialogue();
3760 break; 3754 break;
3761 case 311: 3755 case 311:
3762 sub_4BBA85_bounties(); 3756 sub_4BBA85_bounties();
3763 break; 3757 break;
3764 case 399: 3758 case 399:
3759 __debugbreak(); // what kind of dialogue is that?
3765 sub_4BBCDD(); 3760 sub_4BBCDD();
3766 break; 3761 break;
3767 default: 3762 default:
3768 activeLevelDecoration = (LevelDecoration*)1; 3763 activeLevelDecoration = (LevelDecoration*)1;
3769 current_npc_text = 0; 3764 current_npc_text = 0;