comparison mm7_3.cpp @ 259:92a551e4dbeb

Слияние
author Ritor1
date Mon, 18 Feb 2013 09:44:59 +0600
parents 6764ce3cb9bb e9fabaf75628
children c3bfe1eb3de7
comparison
equal deleted inserted replaced
258:6764ce3cb9bb 259:92a551e4dbeb
39 #include "stru220.h" 39 #include "stru220.h"
40 #include "Events2D.h" 40 #include "Events2D.h"
41 #include "stru176.h" 41 #include "stru176.h"
42 #include "stru159.h" 42 #include "stru159.h"
43 #include "stru298.h" 43 #include "stru298.h"
44 #include "texts.h"
44 #include "Log.h" 45 #include "Log.h"
45 46
46 #include "mm7_data.h" 47 #include "mm7_data.h"
47 48
48 49
2674 _view_angle = 128; 2675 _view_angle = 128;
2675 v35 = uActiveCharacter; 2676 v35 = uActiveCharacter;
2676 if ( !uActiveCharacter ) 2677 if ( !uActiveCharacter )
2677 goto LABEL_87; 2678 goto LABEL_87;
2678 v65 = 0; 2679 v65 = 0;
2679 v63 = 63; 2680 v63 = SPEECH_63;
2680 goto LABEL_76; 2681 goto LABEL_76;
2681 case PARTY_LookDown: 2682 case PARTY_LookDown:
2682 __debugbreak(); 2683 __debugbreak();
2683 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); 2684 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
2684 if ( _view_angle < -128 ) 2685 if ( _view_angle < -128 )
2685 _view_angle = -128; 2686 _view_angle = -128;
2686 v35 = uActiveCharacter; 2687 v35 = uActiveCharacter;
2687 if ( uActiveCharacter ) 2688 if ( uActiveCharacter )
2688 { 2689 {
2689 v65 = 0; 2690 v65 = 0;
2690 v63 = 64; 2691 v63 = SPEECH_64;
2691 LABEL_76: 2692 LABEL_76:
2692 pPlayers[v35]->PlaySound(v63, v65); 2693 pPlayers[v35]->PlaySound((PlayerSpeech)v63, v65);
2693 } 2694 }
2694 break; 2695 break;
2695 case PARTY_CenterView: 2696 case PARTY_CenterView:
2696 __debugbreak(); 2697 __debugbreak();
2697 _view_angle = 0; 2698 _view_angle = 0;
3505 case PARTY_LookUp: 3506 case PARTY_LookUp:
3506 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); 3507 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
3507 if ( _angle_x > 128 ) 3508 if ( _angle_x > 128 )
3508 _angle_x = 128; 3509 _angle_x = 128;
3509 if (uActiveCharacter) 3510 if (uActiveCharacter)
3510 pPlayers[uActiveCharacter]->PlaySound(63, 0); 3511 pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0);
3511 break; 3512 break;
3512 3513
3513 case PARTY_LookDown: 3514 case PARTY_LookDown:
3514 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); 3515 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
3515 if ( _angle_x < -128 ) 3516 if ( _angle_x < -128 )
3516 _angle_x = -128; 3517 _angle_x = -128;
3517 if (uActiveCharacter) 3518 if (uActiveCharacter)
3518 pPlayers[uActiveCharacter]->PlaySound(64, 0); 3519 pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0);
3519 break; 3520 break;
3520 3521
3521 case PARTY_Jump: 3522 case PARTY_Jump:
3522 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) 3523 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
3523 { 3524 {
3621 { // falling scream 3622 { // falling scream
3622 for (int i = 0; i < 4; ++i) 3623 for (int i = 0; i < 4; ++i)
3623 { 3624 {
3624 auto player = pParty->pPlayers + i; 3625 auto player = pParty->pPlayers + i;
3625 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct()) 3626 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct())
3626 player->PlaySound(66, 0); 3627 player->PlaySound(SPEECH_66, 0);
3627 } 3628 }
3628 } 3629 }
3629 } 3630 }
3630 else 3631 else
3631 { 3632 {
4745 return result; 4746 return result;
4746 } 4747 }
4747 // 6BE3C5: using guessed type char bNoNPCHiring; 4748 // 6BE3C5: using guessed type char bNoNPCHiring;
4748 4749
4749 //----- (004763E0) -------------------------------------------------------- 4750 //----- (004763E0) --------------------------------------------------------
4750 void __cdecl InitializeAwards() 4751 void InitializeAwards()
4751 { 4752 {
4752 char *v0; // ebx@1 4753
4753 char *v1; // eax@4 4754 int i;
4754 char v2; // dl@5 4755 char* test_string;
4755 char *v3; // ecx@5 4756 unsigned char c;
4756 int v4; // esi@9 4757 bool break_loop;
4757 signed int v5; // [sp+Ch] [bp-Ch]@4 4758 unsigned int temp_str_len;
4758 char *v6; // [sp+10h] [bp-8h]@4 4759 char* tmp_pos;
4759 Award *v7; // [sp+14h] [bp-4h]@3 4760 int decode_step;
4760 4761 int item_counter;
4761 v0 = 0; 4762
4762 if ( pAwardsTXT_Raw ) 4763 if ( pAwardsTXT_Raw )
4763 pAllocator->FreeChunk(pAwardsTXT_Raw); 4764 pAllocator->FreeChunk(pAwardsTXT_Raw);
4764 pAwardsTXT_Raw = 0; 4765 pAwardsTXT_Raw = NULL;
4765 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0); 4766 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0);
4766 strtok(pAwardsTXT_Raw, "\r"); 4767 strtok(pAwardsTXT_Raw, "\r");
4767 v7 = pAwards; 4768
4768 for (uint i = 0; i < 104; ++i) 4769 for (i=1; i<104; ++i)
4769 { 4770 {
4770 v1 = strtok(v0, "\r") + 1; 4771 test_string = strtok(NULL, "\r") + 1;
4771 v6 = v0; 4772 break_loop = false;
4772 v5 = (signed int)v0; 4773 decode_step=0;
4773 do 4774 do
4774 { 4775 {
4775 v2 = *v1; 4776 c = *(unsigned char*)test_string;
4776 v3 = 0; 4777 temp_str_len = 0;
4777 if ( *v1 != 9 ) 4778 while((c!='\t')&&(c>0))
4778 { 4779 {
4779 v0 = 0; 4780 ++temp_str_len;
4780 do 4781 c=test_string[temp_str_len];
4781 { 4782 }
4782 if ( !v2 ) 4783 tmp_pos=test_string+temp_str_len;
4783 break; 4784 if (*tmp_pos == 0)
4784 ++v3; 4785 break_loop = true;
4785 v2 = v1[(int)v3]; 4786 *tmp_pos = 0;
4786 } 4787 if (temp_str_len)
4787 while ( v2 != 9 ); 4788 {
4788 } 4789 if (decode_step==1)
4789 v4 = (int)&v1[(int)v3]; 4790 pAwards[i].pText=RemoveQuotes(test_string);
4790 if ( v1[(int)v3] == (char)v0 ) 4791 else if (decode_step==2)
4791 v5 = 1; 4792 pAwards[i].uSort=atoi(test_string);
4792 *(char *)v4 = (char)v0; 4793 }
4793 if ( v3 == v0 ) 4794 else
4794 { 4795 {
4795 v5 = 1; 4796 break_loop = true;
4796 } 4797 }
4797 else 4798 ++decode_step;
4798 { 4799 test_string=tmp_pos+1;
4799 if ( v6 == (char *)1 ) 4800 } while ((decode_step<3)&&!break_loop);
4800 { 4801 }
4801 v7->pText = RemoveQuotes(v1); 4802
4802 }
4803 else
4804 {
4805 if ( v6 == (char *)2 )
4806 v7->uSort = atoi(v1);
4807 }
4808 }
4809 ++v6;
4810 v1 = (char *)(v4 + 1);
4811 }
4812 while ( (signed int)(v6 - 1) <= 2 && (char *)v5 == v0 );
4813 ++v7;
4814 }
4815 //while ( (signed int)v7 < (signed int)&dword_7241C8 );
4816 } 4803 }
4817 // 7241C8: using guessed type int dword_7241C8; 4804 // 7241C8: using guessed type int dword_7241C8;
4818 4805
4819 //----- (004764C2) -------------------------------------------------------- 4806 //----- (004764C2) --------------------------------------------------------
4820 void __cdecl InitializeScrolls() 4807 void InitializeScrolls()
4821 { 4808 {
4822 char *v0; // ebx@1 4809
4823 char *v1; // eax@4 4810 int i;
4824 int v2; // edi@4 4811 char* test_string;
4825 char v3; // dl@5 4812 unsigned char c;
4826 char *v4; // ecx@5 4813 bool break_loop;
4827 int v5; // esi@9 4814 unsigned int temp_str_len;
4828 const char **v6; // [sp+10h] [bp-8h]@3 4815 char* tmp_pos;
4829 signed int v7; // [sp+14h] [bp-4h]@4 4816 int decode_step;
4830 4817 int item_counter;
4831 v0 = 0; 4818
4832 if ( pScrollsTXT_Raw ) 4819 if ( pScrollsTXT_Raw )
4833 pAllocator->FreeChunk(pScrollsTXT_Raw); 4820 pAllocator->FreeChunk(pScrollsTXT_Raw);
4834 pScrollsTXT_Raw = 0; 4821 pScrollsTXT_Raw = NULL;
4835 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0); 4822 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0);
4836 strtok(pScrollsTXT_Raw, "\r"); 4823 strtok(pScrollsTXT_Raw, "\r");
4837 v6 = pScrolls; 4824 for (i=0; i<82; ++i)
4838 for (uint i = 0; i < 82; ++i) 4825 {
4839 { 4826 test_string = strtok(NULL, "\r") + 1;
4840 v1 = strtok(v0, "\r") + 1; 4827 break_loop = false;
4841 v2 = 0; 4828 decode_step=0;
4842 v7 = (signed int)v0; 4829 do
4843 do 4830 {
4844 { 4831 c = *(unsigned char*)test_string;
4845 v3 = *v1; 4832 temp_str_len = 0;
4846 v4 = 0; 4833 while((c!='\t')&&(c>0))
4847 if ( *v1 != 9 ) 4834 {
4848 { 4835 ++temp_str_len;
4849 v0 = 0; 4836 c=test_string[temp_str_len];
4850 do 4837 }
4851 { 4838 tmp_pos=test_string+temp_str_len;
4852 if ( !v3 ) 4839 if (*tmp_pos == 0)
4853 break; 4840 break_loop = true;
4854 ++v4; 4841 *tmp_pos = 0;
4855 v3 = v1[(int)v4]; 4842 if (temp_str_len)
4856 } 4843 {
4857 while ( v3 != 9 ); 4844 if ( decode_step == 1)
4858 } 4845 pScrolls[i]=RemoveQuotes(test_string);
4859 v5 = (int)&v1[(int)v4]; 4846 }
4860 if ( v1[(int)v4] == (char)v0 ) 4847 else
4861 v7 = 1; 4848 {
4862 *(char *)v5 = (char)v0; 4849 break_loop = true;
4863 if ( v4 == v0 ) 4850 }
4864 { 4851 ++decode_step;
4865 v7 = 1; 4852 test_string=tmp_pos+1;
4866 } 4853 } while ((decode_step<2)&&!break_loop);
4867 else 4854 }
4868 {
4869 if ( v2 == 1 )
4870 *v6 = RemoveQuotes(v1);
4871 }
4872 ++v2;
4873 v1 = (char *)(v5 + 1);
4874 }
4875 while ( v2 - 1 <= 1 && (char *)v7 == v0 );
4876 ++v6;
4877 }
4878 //while ( (signed int)v6 < (signed int)dword_723E80_award_related );
4879 } 4855 }
4880 4856
4881 4857
4882 //----- (00476590) -------------------------------------------------------- 4858 //----- (00476590) --------------------------------------------------------
4883 void __cdecl InitializeMerchants() 4859 void InitializeMerchants()
4884 { 4860 {
4885 char *v0; // ebx@1 4861 int i;
4886 //char **v1; // edi@3 4862 char* test_string;
4887 char *v2; // ecx@4 4863 unsigned char c;
4888 char v3; // dl@5 4864 bool break_loop;
4889 char *v4; // eax@5 4865 unsigned int temp_str_len;
4890 int v5; // esi@9 4866 char* tmp_pos;
4891 signed int v6; // [sp+Ch] [bp-8h]@4 4867 int decode_step;
4892 char *v7; // [sp+10h] [bp-4h]@4 4868 int item_counter;
4893 4869
4894 v0 = 0;
4895 if ( pMerchantsTXT_Raw ) 4870 if ( pMerchantsTXT_Raw )
4896 pAllocator->FreeChunk(pMerchantsTXT_Raw); 4871 pAllocator->FreeChunk(pMerchantsTXT_Raw);
4897 pMerchantsTXT_Raw = 0; 4872 pMerchantsTXT_Raw = NULL;
4898 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0); 4873 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0);
4899 strtok(pMerchantsTXT_Raw, "\r"); 4874 strtok(pMerchantsTXT_Raw, "\r");
4900 //v1 = (char **)pMerchantsRepairPhrases; 4875
4901 for (uint i = 0; i < 7; ++i) 4876 for (i=0; i<7; ++i)
4902 { 4877 {
4903 v7 = v0; 4878 test_string = strtok(NULL, "\r") + 1;
4904 v6 = (signed int)v0; 4879 break_loop = false;
4905 v2 = strtok(v0, "\r") + 1; 4880 decode_step=0;
4906 do 4881 do
4907 { 4882 {
4908 v3 = *v2; 4883 c = *(unsigned char*)test_string;
4909 v4 = 0; 4884 temp_str_len = 0;
4910 if ( *v2 != 9 ) 4885 while((c!='\t')&&(c>0))
4911 { 4886 {
4912 v0 = 0; 4887 ++temp_str_len;
4913 do 4888 c=test_string[temp_str_len];
4914 { 4889 }
4915 if ( !v3 ) 4890 tmp_pos=test_string+temp_str_len;
4916 break; 4891 if (*tmp_pos == 0)
4917 ++v4; 4892 break_loop = true;
4918 v3 = v2[(int)v4]; 4893 *tmp_pos = 0;
4919 } 4894 if (temp_str_len)
4920 while ( v3 != 9 ); 4895 {
4921 } 4896 switch (decode_step)
4922 v5 = (int)&v2[(int)v4]; 4897 {
4923 if ( v2[(int)v4] == (char)v0 ) 4898 case 1:
4924 v6 = 1; 4899 pMerchantsBuyPhrases[i]=RemoveQuotes(test_string);
4925 *(char *)v5 = (char)v0; 4900 break;
4926 if ( v4 == v0 ) 4901 case 2:
4927 { 4902 pMerchantsSellPhrases[i]=RemoveQuotes(test_string);
4928 v6 = 1; 4903 break;
4929 } 4904 case 3:
4930 else 4905 pMerchantsRepairPhrases[i]=RemoveQuotes(test_string);
4931 { 4906 break;
4932 if ( v7 == (char *)1 ) 4907 case 4:
4933 { 4908 pMerchantsIdentifyPhrases[i]=RemoveQuotes(test_string);
4934 pMerchantsBuyPhrases[i] = RemoveQuotes(v2); 4909 break;
4935 } 4910 }
4936 else 4911 }
4937 { 4912 else
4938 if ( v7 == (char *)2 ) 4913 {
4939 { 4914 break_loop = true;
4940 pMerchantsSellPhrases[i] = RemoveQuotes(v2); 4915 }
4941 } 4916 ++decode_step;
4942 else 4917 test_string=tmp_pos+1;
4943 { 4918 } while ((decode_step<5)&&!break_loop);
4944 if ( v7 == (char *)3 ) 4919 }
4945 { 4920
4946 pMerchantsRepairPhrases[i] = RemoveQuotes(v2);
4947 }
4948 else
4949 {
4950 if ( v7 - 3 == (char *)1 )
4951 pMerchantsIdentifyPhrases[i] = RemoveQuotes(v2);
4952 }
4953 }
4954 }
4955 }
4956 ++v7;
4957 v2 = (char *)(v5 + 1);
4958 }
4959 while ( (signed int)(v7 - 1) <= 4 && (char *)v6 == v0 );
4960 //++v1;
4961 }
4962 //while ( (signed int)v1 < (signed int)pMerchantsIdentifyPhrases );
4963 } 4921 }
4964 4922
4965 //----- (00476682) -------------------------------------------------------- 4923 //----- (00476682) --------------------------------------------------------
4966 void __cdecl InitializeTransitions() 4924 void InitializeTransitions()
4967 { 4925 {
4968 char *v0; // ebx@1 4926 int i;
4969 char *v1; // eax@4 4927 char* test_string;
4970 int v2; // edi@4 4928 unsigned char c;
4971 char v3; // dl@5 4929 bool break_loop;
4972 char *v4; // ecx@5 4930 unsigned int temp_str_len;
4973 int v5; // esi@9 4931 char* tmp_pos;
4974 char **v6; // [sp+10h] [bp-8h]@3 4932 int decode_step;
4975 signed int v7; // [sp+14h] [bp-4h]@4 4933 int item_counter;
4976 4934
4977 v0 = 0;
4978 if ( pTransitionsTXT_Raw ) 4935 if ( pTransitionsTXT_Raw )
4979 pAllocator->FreeChunk(pTransitionsTXT_Raw); 4936 pAllocator->FreeChunk(pTransitionsTXT_Raw);
4980 pTransitionsTXT_Raw = 0; 4937 pTransitionsTXT_Raw = NULL;
4981 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0); 4938 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0);
4982 strtok(pTransitionsTXT_Raw, "\r"); 4939 strtok(pTransitionsTXT_Raw, "\r");
4983 v6 = pTransitionStrings; 4940
4984 for (uint i = 0; i < 464; ++i) 4941 for (i=0; i<464; ++i)
4985 { 4942 {
4986 v1 = strtok(v0, "\r") + 1; 4943 test_string = strtok(NULL, "\r") + 1;
4987 v2 = 0; 4944 break_loop = false;
4988 v7 = (signed int)v0; 4945 decode_step=0;
4989 do 4946 do
4990 { 4947 {
4991 v3 = *v1; 4948 c = *(unsigned char*)test_string;
4992 v4 = 0; 4949 temp_str_len = 0;
4993 if ( *v1 != 9 ) 4950 while((c!='\t')&&(c>0))
4994 { 4951 {
4995 v0 = 0; 4952 ++temp_str_len;
4996 do 4953 c=test_string[temp_str_len];
4997 { 4954 }
4998 if ( !v3 ) 4955 tmp_pos=test_string+temp_str_len;
4999 break; 4956 if (*tmp_pos == 0)
5000 ++v4; 4957 break_loop = true;
5001 v3 = v1[(int)v4]; 4958 *tmp_pos = 0;
5002 } 4959 if (temp_str_len)
5003 while ( v3 != 9 ); 4960 {
5004 } 4961 if ( decode_step == 1)
5005 v5 = (int)&v1[(int)v4]; 4962 pTransitionStrings[i]=RemoveQuotes(test_string);
5006 if ( v1[(int)v4] == (char)v0 ) 4963 }
5007 v7 = 1; 4964 else
5008 *(char *)v5 = (char)v0; 4965 {
5009 if ( v4 == v0 ) 4966 break_loop = true;
5010 { 4967 }
5011 v7 = 1; 4968 ++decode_step;
5012 } 4969 test_string=tmp_pos+1;
5013 else 4970 } while ((decode_step<2)&&!break_loop);
5014 { 4971 }
5015 if ( v2 == 1 )
5016 *v6 = (char *)RemoveQuotes(v1);
5017 }
5018 ++v2;
5019 v1 = (char *)(v5 + 1);
5020 }
5021 while ( v2 - 1 <= 1 && (char *)v7 == v0 );
5022 ++v6;
5023 }
5024 //while ( (signed int)v6 < (signed int)"awards.txt" );
5025 } 4972 }
5026 4973
5027 //----- (00476750) -------------------------------------------------------- 4974 //----- (00476750) --------------------------------------------------------
5028 void __cdecl InitializeAutonotes() 4975 void __cdecl InitializeAutonotes()
5029 { 4976 {
5030 Autonote *v0; // ebp@3 4977 int i;
5031 int v1; // ebx@4 4978 char* test_string;
5032 char *v2; // esi@4 4979 unsigned char c;
5033 char v3; // cl@5 4980 bool break_loop;
5034 int v4; // eax@5 4981 unsigned int temp_str_len;
5035 char *v5; // edi@9 4982 char* tmp_pos;
5036 signed int v6; // [sp+0h] [bp-4h]@4 4983 int decode_step;
4984 int item_counter;
5037 4985
5038 if ( pAutonoteTXT_Raw ) 4986 if ( pAutonoteTXT_Raw )
5039 pAllocator->FreeChunk(pAutonoteTXT_Raw); 4987 pAllocator->FreeChunk(pAutonoteTXT_Raw);
5040 pAutonoteTXT_Raw = 0; 4988 pAutonoteTXT_Raw = 0;
5041 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); 4989 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
5042 strtok(pAutonoteTXT_Raw, "\r"); 4990 strtok(pAutonoteTXT_Raw, "\r");
5043 v0 = pAutonoteTxt; 4991
5044 for (uint i = 0; i < 195; ++i) 4992 for (i=0; i<195; ++i)
5045 { 4993 {
5046 v1 = 0; 4994 test_string = strtok(NULL, "\r") + 1;
5047 v2 = strtok(0, "\r") + 1; 4995 break_loop = false;
5048 v6 = 0; 4996 decode_step=0;
5049 do 4997 do
5050 { 4998 {
5051 v3 = *v2; 4999 c = *(unsigned char*)test_string;
5052 v4 = 0; 5000 temp_str_len = 0;
5053 while ( v3 != 9 && v3 ) 5001 while((c!='\t')&&(c>0))
5054 { 5002 {
5055 ++v4; 5003 ++temp_str_len;
5056 v3 = v2[v4]; 5004 c=test_string[temp_str_len];
5057 } 5005 }
5058 v5 = &v2[v4]; 5006 tmp_pos=test_string+temp_str_len;
5059 if ( !v2[v4] ) 5007 if (*tmp_pos == 0)
5060 v6 = 1; 5008 break_loop = true;
5061 *v5 = 0; 5009 *tmp_pos = 0;
5062 if ( v4 ) 5010 if (temp_str_len)
5063 { 5011 {
5064 if ( v1 == 1 ) 5012 switch (decode_step)
5065 { 5013 {
5066 v0->pText = RemoveQuotes(v2); 5014 case 1:
5067 } 5015 pAutonoteTxt[i].pText=RemoveQuotes(test_string);
5068 else 5016 break;
5069 { 5017 case 2:
5070 if ( v1 == 2 ) 5018 {
5071 { 5019 if ( !_strcmpi(test_string, "potion"))
5072 if ( _strcmpi(v2, "potion") ) 5020 {
5073 { 5021 pAutonoteTxt[i].eType = AUTONOTE_POTION_RECEPIE;
5074 if ( _strcmpi(v2, "stat") ) 5022 break;
5075 { 5023 }
5076 if ( _strcmpi(v2, "seer") ) 5024 if ( !_strcmpi(test_string, "stat") )
5077 { 5025 {
5078 if ( _strcmpi(v2, "obelisk") ) 5026 pAutonoteTxt[i].eType = AUTONOTE_STAT_HINT;
5079 v0->eType = (AUTONOTE_TYPE)(5 - (_strcmpi(v2, "teacher") != 0)); 5027 break;
5080 else 5028 }
5081 v0->eType = (AUTONOTE_TYPE)2; 5029 if ( !_strcmpi(test_string, "seer") )
5082 } 5030 {
5083 else 5031 pAutonoteTxt[i].eType = AUTONOTE_SEER;
5084 { 5032 break;
5085 v0->eType = (AUTONOTE_TYPE)3; 5033 }
5086 } 5034 if ( !_strcmpi(test_string, "obelisk") )
5087 } 5035 {
5088 else 5036 pAutonoteTxt[i].eType = AUTONOTE_OBELISK;
5089 { 5037 break;
5090 v0->eType = (AUTONOTE_TYPE)1; 5038 }
5091 } 5039 if ( !_strcmpi(test_string, "teacher") )
5092 } 5040 {
5093 else 5041 pAutonoteTxt[i].eType = AUTONOTE_TEACHER;
5094 { 5042 break;
5095 v0->eType = (AUTONOTE_TYPE)0; 5043 }
5096 } 5044 pAutonoteTxt[i].eType =AUTONOTE_MISC;
5097 } 5045 break;
5098 } 5046 }
5099 } 5047 }
5100 else 5048 }
5101 { 5049 else
5102 v6 = 1; 5050 {
5103 } 5051 break_loop = true;
5104 ++v1; 5052 }
5105 v2 = v5 + 1; 5053 ++decode_step;
5106 } 5054 test_string=tmp_pos+1;
5107 while ( v1 - 1 <= 2 && !v6 ); 5055 } while ((decode_step<3)&&!break_loop);
5108 ++v0; 5056 }
5109 }
5110 //while ( (signed int)v0 < (signed int)&pScrolls[1] );
5111 } 5057 }
5112 5058
5113 5059
5114 //----- (004768A9) -------------------------------------------------------- 5060 //----- (004768A9) --------------------------------------------------------
5115 void __cdecl InitializeQuests() 5061 void __cdecl InitializeQuests()
5116 { 5062 {
5117 char *v0; // ebx@1 5063 int i;
5118 char *v1; // eax@4 5064 char* test_string;
5119 int v2; // edi@4 5065 unsigned char c;
5120 char v3; // dl@5 5066 bool break_loop;
5121 char *v4; // ecx@5 5067 unsigned int temp_str_len;
5122 int v5; // esi@9 5068 char* tmp_pos;
5123 //const char **v6; // [sp+10h] [bp-8h]@3 5069 int decode_step;
5124 signed int v7; // [sp+14h] [bp-4h]@4 5070 int item_counter;
5125 5071
5126 v0 = 0;
5127 if ( pQuestsTXT_Raw ) 5072 if ( pQuestsTXT_Raw )
5128 pAllocator->FreeChunk(pQuestsTXT_Raw); 5073 pAllocator->FreeChunk(pQuestsTXT_Raw);
5129 pQuestsTXT_Raw = 0; 5074 pQuestsTXT_Raw = NULL;
5130 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0); 5075 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0);
5131 strtok(pQuestsTXT_Raw, "\r"); 5076 strtok(pQuestsTXT_Raw, "\r");
5132 5077
5133 //v6 = pQuestTable; 5078 for (i=0; i<512; ++i)
5134 for (uint i = 0; i < 512; ++i) 5079 {
5135 //do 5080 test_string = strtok(NULL, "\r") + 1;
5136 { 5081 break_loop = false;
5137 v1 = strtok(v0, "\r") + 1; 5082 decode_step=0;
5138 v2 = 0; 5083 do
5139 v7 = (signed int)v0; 5084 {
5140 do 5085 c = *(unsigned char*)test_string;
5141 { 5086 temp_str_len = 0;
5142 v3 = *v1; 5087 while((c!='\t')&&(c>0))
5143 v4 = 0; 5088 {
5144 if ( *v1 != '\t' ) 5089 ++temp_str_len;
5145 { 5090 c=test_string[temp_str_len];
5146 v0 = 0; 5091 }
5147 do 5092 tmp_pos=test_string+temp_str_len;
5148 { 5093 if (*tmp_pos == 0)
5149 if ( !v3 ) 5094 break_loop = true;
5150 break; 5095 *tmp_pos = 0;
5151 ++v4; 5096 if (temp_str_len)
5152 v3 = v1[(int)v4]; 5097 {
5153 } 5098 if ( decode_step == 1)
5154 while ( v3 != '\t' ); 5099 pQuestTable[i] =RemoveQuotes(test_string);
5155 } 5100 }
5156 v5 = (int)&v1[(int)v4]; 5101 else
5157 if ( v1[(int)v4] == (char)v0 ) 5102 {
5158 v7 = 1; 5103 break_loop = true;
5159 *(char *)v5 = (char)v0; 5104 }
5160 if ( v4 == v0 ) 5105 ++decode_step;
5161 { 5106 test_string=tmp_pos+1;
5162 v7 = 1; 5107 } while ((decode_step<2)&&!break_loop);
5163 } 5108 }
5164 else
5165 {
5166 if ( v2 == 1 )
5167 pQuestTable[i] = RemoveQuotes(v1);
5168 }
5169 ++v2;
5170 v1 = (char *)(v5 + 1);
5171 }
5172 while ( v2 - 1 <= 1 && (char *)v7 == v0 );
5173 //++v6;
5174 }
5175 //while ( (signed int)v6 < (signed int)&unk_723714 );
5176 } 5109 }
5177 5110
5178 5111
5179 5112
5180 //----- (00476977) -------------------------------------------------------- 5113 //----- (00476977) --------------------------------------------------------
5181 void NPCStats::Initialize2() 5114 void NPCStats::Initialize2()
5182 { 5115 {
5183 char *v4; // eax@4 5116 int i;
5184 char v5; // dl@5 5117 char* test_string;
5185 char *v6; // ecx@5 5118 unsigned char c;
5186 int v7; // edi@9 5119 bool break_loop;
5187 char *v9; // eax@21 5120 unsigned int temp_str_len;
5188 char v10; // dl@22 5121 char* tmp_pos;
5189 char *v11; // ecx@22 5122 int decode_step;
5190 int v12; // edi@26 5123 int item_counter;
5191 char *v14; // eax@39 5124
5192 char v15; // dl@40 5125
5193 int v16; // ecx@40
5194 int v17; // edi@44
5195 char v18; // zf@47
5196 NPCStats_stru0 *v19; // eax@57
5197 signed int v20; // edx@57
5198 signed int v21; // ecx@58
5199 char *v22; // [sp+10h] [bp-10h]@4
5200 char *v23; // [sp+10h] [bp-10h]@21
5201 char *v25; // [sp+14h] [bp-Ch]@4
5202 char *v26; // [sp+14h] [bp-Ch]@21
5203 signed int v27; // [sp+14h] [bp-Ch]@39
5204 //signed int v28; // [sp+18h] [bp-8h]@3
5205 //signed int v29; // [sp+18h] [bp-8h]@20
5206 signed int v30; // [sp+18h] [bp-8h]@37
5207 char *v31; // [sp+1Ch] [bp-4h]@37
5208
5209 //v1 = this;
5210 //v2 = 0;
5211 if (pNPCTextTXT_Raw) 5126 if (pNPCTextTXT_Raw)
5212 pAllocator->FreeChunk(pNPCTextTXT_Raw); 5127 pAllocator->FreeChunk(pNPCTextTXT_Raw);
5213 5128 pNPCTextTXT_Raw =NULL;
5214 //v3 = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
5215 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); 5129 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
5216 strtok(pNPCTextTXT_Raw, "\r"); 5130 strtok(pNPCTextTXT_Raw, "\r");
5217 5131
5218 for (uint i = 0; i < 789; ++i) 5132 for (i=0; i<789; ++i)
5219 { 5133 {
5220 v4 = strtok(nullptr, "\r") + 1; 5134 test_string = strtok(NULL, "\r") + 1;
5221 v22 = nullptr; 5135 break_loop = false;
5222 v25 = nullptr; 5136 decode_step=0;
5223 do 5137 do
5224 { 5138 {
5225 v5 = *v4; 5139 c = *(unsigned char*)test_string;
5226 v6 = 0; 5140 temp_str_len = 0;
5227 if ( *v4 != 9 ) 5141 while((c!='\t')&&(c>0))
5228 { 5142 {
5229 do 5143 ++temp_str_len;
5230 { 5144 c=test_string[temp_str_len];
5231 if ( !v5 ) 5145 }
5232 break; 5146 tmp_pos=test_string+temp_str_len;
5233 ++v6; 5147 if (*tmp_pos == 0)
5234 v5 = v4[(int)v6]; 5148 break_loop = true;
5235 } 5149 *tmp_pos = 0;
5236 while ( v5 != 9 ); 5150 if (temp_str_len)
5237 //v2 = 0; 5151 {
5238 } 5152 if ( decode_step == 1)
5239 v7 = (int)&v4[(int)v6]; 5153 pNPCTopics[i].pText =RemoveQuotes(test_string);
5240 if ( !v4[(int)v6] ) 5154 }
5241 v25 = (char *)1; 5155 else
5242 *(char *)v7 = 0; 5156 {
5243 if ( v6 == nullptr ) 5157 break_loop = true;
5244 { 5158 }
5245 v25 = (char *)1; 5159 ++decode_step;
5246 } 5160 test_string=tmp_pos+1;
5247 else 5161 } while ((decode_step<2)&&!break_loop);
5248 { 5162 }
5249 if ( v22 == (char *)1 )
5250 pNPCTopics[i].pText = RemoveQuotes(v4);
5251 }
5252 ++v22;
5253 v4 = (char *)(v7 + 1);
5254 }
5255 while ( (signed int)(v22 - 1) <= 1 && v25 == nullptr );
5256 }
5257 5163
5258 if (pNPCTopicTXT_Raw) 5164 if (pNPCTopicTXT_Raw)
5259 pAllocator->FreeChunk(pNPCTopicTXT_Raw); 5165 pAllocator->FreeChunk(pNPCTopicTXT_Raw);
5260 5166 pNPCTopicTXT_Raw =NULL;
5261 //v8 = (char *)pEvents_LOD->LoadRaw("npctopic.txt", (int)v2);
5262 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0); 5167 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
5263 strtok(pNPCTopicTXT_Raw, "\r"); 5168 strtok(pNPCTopicTXT_Raw, "\r");
5264 5169
5265 for (uint i = 0; i < 579; ++i) 5170 for (i=0; i<579; ++i)
5266 { 5171 {
5267 v9 = strtok(nullptr, "\r") + 1; 5172 test_string = strtok(NULL, "\r") + 1;
5268 v23 = nullptr; 5173 break_loop = false;
5269 v26 = nullptr; 5174 decode_step=0;
5270 do 5175 do
5271 { 5176 {
5272 v10 = *v9; 5177 c = *(unsigned char*)test_string;
5273 v11 = 0; 5178 temp_str_len = 0;
5274 if ( *v9 != 9 ) 5179 while((c!='\t')&&(c>0))
5275 { 5180 {
5276 do 5181 ++temp_str_len;
5277 { 5182 c=test_string[temp_str_len];
5278 if ( !v10 ) 5183 }
5279 break; 5184 tmp_pos=test_string+temp_str_len;
5280 ++v11; 5185 if (*tmp_pos == 0)
5281 v10 = v9[(int)v11]; 5186 break_loop = true;
5282 } 5187 *tmp_pos = 0;
5283 while ( v10 != 9 ); 5188 if (temp_str_len)
5284 //v2 = 0; 5189 {
5285 } 5190 if ( decode_step == 1)
5286 v12 = (int)&v9[(int)v11]; 5191 pNPCTopics[i].pTopic = RemoveQuotes(test_string);
5287 if ( !v9[(int)v11] ) 5192 }
5288 v26 = (char *)1; 5193 else
5289 *(char *)v12 = 0; 5194 {
5290 if ( v11 == nullptr ) 5195 break_loop = true;
5291 { 5196 }
5292 v26 = (char *)1; 5197 ++decode_step;
5293 } 5198 test_string=tmp_pos+1;
5294 else 5199 } while ((decode_step<2)&&!break_loop);
5295 { 5200 }
5296 if ( v23 == (char *)1 )
5297 pNPCTopics[i].pTopic = RemoveQuotes(v9);
5298 }
5299 ++v23;
5300 v9 = (char *)(v12 + 1);
5301 }
5302 while ( (signed int)(v23 - 1) <= 1 && v26 == nullptr );
5303 }
5304 5201
5305 if (pNPCDistTXT_Raw) 5202 if (pNPCDistTXT_Raw)
5306 pAllocator->FreeChunk(pNPCDistTXT_Raw); 5203 pAllocator->FreeChunk(pNPCDistTXT_Raw);
5307 5204 pNPCDistTXT_Raw = NULL;
5308 //v13 = (char *)pEvents_LOD->LoadRaw("npcdist.txt", (int)v2);
5309 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0); 5205 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0);
5310 strtok(pNPCDistTXT_Raw, "\r"); 5206 strtok(pNPCDistTXT_Raw, "\r");
5311 strtok(nullptr, "\r"); 5207 strtok(NULL, "\r");
5312 v30 = 1; 5208
5313 v31 = &array_16544[0].field_4[1]; 5209 for (i=1; i<59; ++i)
5314 5210 {
5315 char *v2 = 0; 5211 test_string = strtok(NULL, "\r") + 1;
5316 while ( 2 ) 5212 break_loop = false;
5317 { 5213 decode_step=0;
5318 v14 = strtok(nullptr, "\r") + 1; 5214 do
5319 v27 = 0; 5215 {
5320 char *v24 = nullptr; 5216 c = *(unsigned char*)test_string;
5321 do 5217 temp_str_len = 0;
5322 { 5218 while((c!='\t')&&(c>0))
5323 v15 = *v14; 5219 {
5324 v16 = 0; 5220 ++temp_str_len;
5325 if ( *v14 != 9 ) 5221 c=test_string[temp_str_len];
5326 { 5222 }
5327 do 5223 tmp_pos=test_string+temp_str_len;
5328 { 5224 if (*tmp_pos == 0)
5329 if ( !v15 ) 5225 break_loop = true;
5330 break; 5226 *tmp_pos = 0;
5331 ++v16; 5227 if (temp_str_len)
5332 v15 = v14[v16]; 5228 {
5333 } 5229 if ((decode_step>0)&&(decode_step<77))
5334 while ( v15 != 9 ); 5230 {
5335 v2 = v24; 5231 array_16544[decode_step].field_4[i]=atoi(test_string);
5336 } 5232 }
5337 v17 = (int)&v14[v16]; 5233 else if (decode_step==0)
5338 if ( !v14[v16] ) 5234 {
5339 v27 = 1; 5235 array_16544[0].field_4[i]=10;
5340 *(char *)v17 = 0; 5236 }
5341 if ( !v16 ) 5237 }
5342 { 5238 else
5343 v27 = 1; 5239 {
5344 goto LABEL_54; 5240 break_loop = true;
5345 } 5241 }
5346 v18 = v2 == 0; 5242 ++decode_step;
5347 if ( (signed int)v2 > 0 ) 5243 test_string=tmp_pos+1;
5348 { 5244 } while ((decode_step<78)&&!break_loop);
5349 if ( (signed int)v2 < 77 ) 5245 }
5350 { 5246
5351 array_16544[(int)v2].field_4[v30] = atoi(v14); 5247 for (i=0; i<78; ++i)
5352 goto LABEL_54; 5248 {
5353 } 5249 array_16544[i].field_0=0;
5354 v18 = v2 == 0; 5250 for (int ii=1; ii<59; ++ii)
5355 } 5251 {
5356 if ( v18 ) 5252 array_16544[i].field_0+=array_16544[i].field_4[ii];
5357 *v31 = 10; 5253 }
5358 LABEL_54: 5254 }
5359 ++v2;
5360 v14 = (char *)(v17 + 1);
5361 v24 = v2;
5362 }
5363 while ( (signed int)(v2 - 1) <= 77 && !v27 );
5364 ++v30;
5365 ++v31;
5366 if ( v30 < 59 )
5367 {
5368 v2 = 0;
5369 continue;
5370 }
5371 break;
5372 }
5373 v19 = array_16544;
5374 v20 = 77;
5375 do
5376 {
5377 v19->field_0 = 0;
5378 v21 = 1;
5379 do
5380 v19->field_0 += v19->field_4[v21++];
5381 while ( v21 < 59 );
5382 ++v19;
5383 --v20;
5384 }
5385 while ( v20 );
5386 5255
5387 if (pNPCDistTXT_Raw) 5256 if (pNPCDistTXT_Raw)
5388 { 5257 {
5389 pAllocator->FreeChunk(pNPCDistTXT_Raw); 5258 pAllocator->FreeChunk(pNPCDistTXT_Raw);
5390 pNPCDistTXT_Raw = nullptr; 5259 pNPCDistTXT_Raw = NULL;
5391 } 5260 }
5392 } 5261 }
5393 5262
5394 //----- (00476C60) -------------------------------------------------------- 5263 //----- (00476C60) --------------------------------------------------------
5395 void NPCStats::_476C60() 5264 void NPCStats::_476C60()
9662 pOutdoorCamera->uPickDepth = band3 * 512; 9531 pOutdoorCamera->uPickDepth = band3 * 512;
9663 //v4 = stru_76E5C8; // v4: 0 -> 65536 9532 //v4 = stru_76E5C8; // v4: 0 -> 65536
9664 for (uint i = 0; i < 16384; ++i) 9533 for (uint i = 0; i < 16384; ++i)
9665 //do 9534 //do
9666 { 9535 {
9667 auto v4 = stru_76E5C8 + i; 9536 auto v4 = stru_76E5C8[i];
9668 //band3a = 256; 9537 //band3a = 256;
9669 //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8); 9538 //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8);
9670 for (uint j = 0; j < 128; ++j) // band3a: 0 -> 128 9539 for (uint j = 0; j < 128; ++j) // band3a: 0 -> 128
9671 { 9540 {
9672 v5 = pow(j * 512 + 256, 2.0); 9541 v5 = pow(j * 512 + 256, 2.0);
9674 //*((float *)&v5 + 1) = sqrt(v6 + v5); 9543 //*((float *)&v5 + 1) = sqrt(v6 + v5);
9675 int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15; 9544 int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15;
9676 if (v7 >= v10) 9545 if (v7 >= v10)
9677 { 9546 {
9678 if (v7 >= v9) 9547 if (v7 >= v9)
9679 v4->field_0 = ((v7 >= v3) - 1) & 2; 9548 v4.field_0 = ((v7 >= v3) - 1) & 2;
9680 else 9549 else
9681 v4->field_0 = 2; 9550 v4.field_0 = 2;
9682 } 9551 }
9683 else 9552 else
9684 { 9553 {
9685 v4->field_0 = 1; 9554 v4.field_0 = 1;
9686 } 9555 }
9687 //band3a += 512; 9556 //band3a += 512;
9688 v4->distance = v7; 9557 v4.distance = v7;
9689 ++v4; 9558 //++v4;
9690 } 9559 }
9691 //while ( band3a < 65792 ); 9560 //while ( band3a < 65792 );
9692 } 9561 }
9693 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); 9562 //while ( (signed int)v4 < (signed int)arary_77E5C8 );
9694 } 9563 }
9697 9566
9698 9567
9699 //----- (004811A3) -------------------------------------------------------- 9568 //----- (004811A3) --------------------------------------------------------
9700 void stru148::_4811A3() 9569 void stru148::_4811A3()
9701 { 9570 {
9571 __debugbreak();
9572
9702 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); 9573 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0));
9703 pRenderer->DrawTerrainPolygon(uNumVertices, this, 9574 pRenderer->DrawTerrainPolygon(uNumVertices, this,
9704 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]], 9575 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]],
9705 0, 0); 9576 0, 0);
9706 9577
13431 v15->some_y = a2; 13302 v15->some_y = a2;
13432 v15->some_z = a3; 13303 v15->some_z = a3;
13433 v15->uScreenSpaceX = a5; 13304 v15->uScreenSpaceX = a5;
13434 v15->uScreenSpaceY = a6; 13305 v15->uScreenSpaceY = a6;
13435 v23 = 8 * v26; 13306 v23 = 8 * v26;
13436 LOBYTE(v23) = 8 * v26 | 5; 13307 LOBYTE(v23) = 8 * v26 | OBJECT_Decoration;
13437 LOWORD(v22) = 0; 13308 LOWORD(v22) = 0;
13309
13310 //v15->sZValue = v22 + v23;
13311 v15->actual_z = HIWORD(x);
13312 v15->object_pid = 8 * v26 | OBJECT_Decoration;
13313
13438 v15->uTintColor = 0; 13314 v15->uTintColor = 0;
13439 v15->sZValue = v22 + v23;
13440 v15->pSpriteFrame = v12; 13315 v15->pSpriteFrame = v12;
13441 } 13316 }
13442 } 13317 }
13443 } 13318 }
13444 } 13319 }
13605 v22 = v35; 13480 v22 = v35;
13606 v3->uTintColor = 0; 13481 v3->uTintColor = 0;
13607 v3->uScreenSpaceY = v22; 13482 v3->uScreenSpaceY = v22;
13608 LOWORD(v21) = 0; 13483 LOWORD(v21) = 0;
13609 v23 = 8 * i; 13484 v23 = 8 * i;
13610 LOBYTE(v23) = 8 * i | 2; 13485 LOBYTE(v23) = 8 * i | OBJECT_Item;
13611 v3->pSpriteFrame = v24; 13486 v3->pSpriteFrame = v24;
13612 v12 = (p->uAttributes & 0x20) == 0; 13487 v12 = (p->uAttributes & 0x20) == 0;
13613 v3->sZValue = v21 + v23; 13488 v3->sZValue = v21 + v23;
13614 if ( !v12 ) 13489 if ( !v12 )
13615 { 13490 {
14510 //----- (00442955) -------------------------------------------------------- 14385 //----- (00442955) --------------------------------------------------------
14511 int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074) 14386 int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074)
14512 { 14387 {
14513 int v5; // ebx@1 14388 int v5; // ebx@1
14514 int v6; // edi@1 14389 int v6; // edi@1
14515 unsigned int *v7; // eax@8 14390 BLVMapOutlines *v7; // eax@8
14516 unsigned __int8 v8; // zf@8 14391 unsigned __int8 v8; // zf@8
14517 unsigned __int8 v9; // sf@8 14392 unsigned __int8 v9; // sf@8
14518 int v10; // esi@10 14393 int v10; // esi@10
14519 unsigned int v11; // edx@11 14394 unsigned int v11; // edx@11
14520 __int16 v12; // cx@12 14395 __int16 v12; // cx@12
14526 Vec3_short_ *v18; // eax@16 14401 Vec3_short_ *v18; // eax@16
14527 int v19; // ecx@16 14402 int v19; // ecx@16
14528 int v20; // eax@16 14403 int v20; // eax@16
14529 signed int v21; // esi@18 14404 signed int v21; // esi@18
14530 int v22; // ecx@21 14405 int v22; // ecx@21
14531 int v23; // ecx@21 14406 BLVMapOutline *v23; // ecx@21
14532 Vec3_short_ *v24; // edx@21 14407 Vec3_short_ *v24; // edx@21
14533 Vec3_short_ *v25; // eax@21 14408 Vec3_short_ *v25; // eax@21
14534 int v26; // ecx@21 14409 int v26; // ecx@21
14535 unsigned __int16 *v27; // edi@21 14410 unsigned __int16 *v27; // edi@21
14536 int v28; // edx@21 14411 int v28; // edx@21
14537 int v29; // eax@21 14412 int v29; // eax@21
14538 double v30; // st7@23 14413 double v30; // st7@23
14539 signed __int64 v31; // qax@23 14414 signed __int64 v31; // qax@23
14540 char *v32; // edx@23 14415 unsigned short *v32; // edx@23
14541 int v33; // esi@23 14416 int v33; // esi@23
14542 signed int v34; // eax@23 14417 signed int v34; // eax@23
14543 signed int v35; // ecx@23 14418 signed int v35; // ecx@23
14544 int v36; // esi@27 14419 int v36; // esi@27
14545 int v37; // ecx@27 14420 int v37; // ecx@27
14546 int v38; // edx@31 14421 int v38; // edx@31
14547 unsigned int v39; // eax@33 14422 unsigned int v39; // eax@33
14548 const void *v40; // esi@33 14423 short *v40; // esi@33
14549 unsigned __int16 *v41; // edi@33 14424 short *v41; // edi@33
14550 unsigned __int8 v42; // cf@33 14425 unsigned __int8 v42; // cf@33
14551 unsigned int v43; // ecx@33 14426 unsigned int v43; // ecx@33
14552 int v44; // edi@33 14427 short *v44; // edi@33
14553 int v45; // esi@33 14428 short *v45; // esi@33
14554 int v46; // ecx@33 14429 int v46; // ecx@33
14555 signed int v47; // esi@38 14430 signed int v47; // esi@38
14556 signed int v48; // ecx@38 14431 signed int v48; // ecx@38
14557 int v49; // eax@38 14432 int v49; // eax@38
14558 signed int v50; // edx@55 14433 signed int v50; // edx@55
14569 signed __int64 v61; // qax@85 14444 signed __int64 v61; // qax@85
14570 signed int v62; // ebx@85 14445 signed int v62; // ebx@85
14571 signed int v63; // esi@85 14446 signed int v63; // esi@85
14572 int v64; // eax@87 14447 int v64; // eax@87
14573 unsigned int v65; // ebx@95 14448 unsigned int v65; // ebx@95
14574 char *v66; // edx@95 14449 unsigned short *v66; // edx@95
14575 unsigned __int16 *v67; // esi@96 14450 unsigned __int16 *v67; // esi@96
14576 int v68; // edi@98 14451 int v68; // edi@98
14577 unsigned __int16 v69; // cx@99 14452 unsigned __int16 v69; // cx@99
14578 unsigned int v70; // [sp-10h] [bp-48074h]@80 14453 unsigned int v70; // [sp-10h] [bp-48074h]@80
14579 unsigned int v71; // [sp-Ch] [bp-48070h]@80 14454 unsigned int v71; // [sp-Ch] [bp-48070h]@80
14580 unsigned int v72; // [sp-8h] [bp-4806Ch]@80 14455 unsigned int v72; // [sp-8h] [bp-4806Ch]@80
14581 signed int v73; // [sp-4h] [bp-48068h]@59 14456 signed int v73; // [sp-4h] [bp-48068h]@59
14582 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 14457 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79
14583 char v75; // [sp+Ch] [bp-48058h]@23 14458 unsigned short v75[131070]; // [sp+Ch] [bp-48058h]@23
14584 int v76; // [sp+4800Ch] [bp-58h]@23 14459 int v76; // [sp+4800Ch] [bp-58h]@23
14585 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 14460 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
14586 unsigned __int16 *v78; // [sp+48014h] [bp-50h]@23 14461 unsigned __int16 *v78; // [sp+48014h] [bp-50h]@23
14587 unsigned int v79; // [sp+48018h] [bp-4Ch]@1 14462 unsigned int v79; // [sp+48018h] [bp-4Ch]@1
14588 unsigned int y_; // [sp+4801Ch] [bp-48h]@1 14463 unsigned int y_; // [sp+4801Ch] [bp-48h]@1
14597 int black; // [sp+48040h] [bp-24h]@8 14472 int black; // [sp+48040h] [bp-24h]@8
14598 int v90; // [sp+48044h] [bp-20h]@1 14473 int v90; // [sp+48044h] [bp-20h]@1
14599 unsigned int i; // [sp+48048h] [bp-1Ch]@9 14474 unsigned int i; // [sp+48048h] [bp-1Ch]@9
14600 unsigned int v92; // [sp+4804Ch] [bp-18h]@16 14475 unsigned int v92; // [sp+4804Ch] [bp-18h]@16
14601 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 14476 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
14602 unsigned int v94; // [sp+48054h] [bp-10h]@8 14477 signed int v94; // [sp+48054h] [bp-10h]@8
14603 unsigned int v95; // [sp+48058h] [bp-Ch]@16 14478 unsigned int v95; // [sp+48058h] [bp-Ch]@16
14604 int v96; // [sp+4805Ch] [bp-8h]@10 14479 int v96; // [sp+4805Ch] [bp-8h]@10
14605 const void *v97; // [sp+48060h] [bp-4h]@16 14480 const void *v97; // [sp+48060h] [bp-4h]@16
14606 char *a4a; // [sp+4806Ch] [bp+8h]@85 14481 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85
14607 int a5a; // [sp+48070h] [bp+Ch]@86 14482 int a5a; // [sp+48070h] [bp+Ch]@86
14608 14483
14609 x_ = x; 14484 x_ = x;
14610 y_ = y; 14485 y_ = y;
14611 v85 = (signed int)(x + a4) >> 1; 14486 v85 = (signed int)(x + a4) >> 1;
14618 v84 = viewparams->sPartyPosZ; 14493 v84 = viewparams->sPartyPosZ;
14619 if ( viewparams->field_2C != 384 ) 14494 if ( viewparams->field_2C != 384 )
14620 { 14495 {
14621 if ( viewparams->field_2C == 768 ) 14496 if ( viewparams->field_2C == 768 )
14622 { 14497 {
14623 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) 14498 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
14624 goto LABEL_23; 14499 v5 = 680;
14625 v5 = 680; 14500 }
14626 } 14501 }
14627 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 14502 else
14628 goto LABEL_8; 14503 {
14629 LABEL_23: 14504 v6 = viewparams->field_38;
14505 v86 = viewparams->field_38;
14506 v84 = viewparams->field_3A;
14507 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
14508 v5 = viewparams->field_2C - 34;
14509 }
14510 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
14511 {
14630 v94 = a4 - x_ + 1; 14512 v94 = a4 - x_ + 1;
14631 v92 = a5 - y_ + 1; 14513 v92 = a5 - y_ + 1;
14632 v93 = &pRenderer->pTargetSurface[x_ + y_ * v79]; 14514 v93 = &pRenderer->pTargetSurface[x_ + y_ * v79];
14633 v95 = (unsigned int)pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; 14515 v95 = (unsigned int)pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0;
14634 v78 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; 14516 v78 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
14637 black = 22528 / (v5 / 384); 14519 black = 22528 / (v5 / 384);
14638 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; 14520 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16;
14639 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); 14521 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
14640 v96 = 32768 - black - v84; 14522 v96 = 32768 - black - v84;
14641 v31 = (signed __int64)((double)v96 / v30); 14523 v31 = (signed __int64)((double)v96 / v30);
14642 v32 = &v75; 14524 v32 = v75;
14643 v33 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; 14525 v33 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
14644 v34 = (int)v31 << 16; 14526 v34 = (int)v31 << 16;
14645 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); 14527 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
14646 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); 14528 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
14647 v76 = v33; 14529 v76 = v33;
14659 v88 = v94; 14541 v88 = v94;
14660 v37 = black; 14542 v37 = black;
14661 v77 = (unsigned __int16 *)v36; 14543 v77 = (unsigned __int16 *)v36;
14662 do 14544 do
14663 { 14545 {
14664 *(short *)v32 = v78[*((char *)v77 + v37)]; 14546 *(short *)v32 = v78[*((char *)v77 + v37)];//crash
14665 v32 += 2; 14547 ++v32;
14666 v97 = (char *)v97 + v87; 14548 v97 = (char *)v97 + v87;
14667 v37 = (signed int)v97 >> 16; 14549 v37 = (signed int)v97 >> 16;
14668 --i; 14550 --i;
14669 } 14551 }
14670 while ( i ); 14552 while ( i );
14686 do 14568 do
14687 { 14569 {
14688 if ( (signed int)v94 > 0 ) 14570 if ( (signed int)v94 > 0 )
14689 { 14571 {
14690 v39 = v94; 14572 v39 = v94;
14691 v40 = v97; 14573 v40 = (short *)v97;
14692 v41 = v93; 14574 v41 = (short *)v93;
14693 v42 = v94 & 1; 14575 v42 = v94 & 1;
14694 v43 = v94 >> 1; 14576 v43 = v94 >> 1;
14695 memcpy(v93, v97, 4 * (v94 >> 1)); 14577 memcpy(v93, v97, 2 * (v94 >> 1));
14696 v45 = (int)((char *)v40 + 4 * v43); 14578 v45 = &v40[2 * v43];
14697 v44 = (int)&v41[2 * v43]; 14579 v44 = &v41[2 * v43];
14698 v46 = v42; 14580 v46 = v42;
14699 v39 *= 2; 14581 v39 *= 2;
14700 v93 = (unsigned __int16 *)((char *)v93 + v39); 14582 v93 = (unsigned __int16 *)((char *)v93 + v39);
14701 v97 = (char *)v97 + v39; 14583 v97 = (char *)v97 + v39;
14702 while ( v46 ) 14584 while ( v46 )
14703 { 14585 {
14704 *(short *)v44 = *(short *)v45; 14586 *v44 = *v45;
14705 v45 += 2; 14587 ++v45;
14706 v44 += 2; 14588 ++v44;
14707 --v46; 14589 --v46;
14708 } 14590 }
14709 v6 = v86; 14591 v6 = v86;
14710 } 14592 }
14711 v93 = (unsigned __int16 *)((char *)v93 + v38); 14593 v93 = (unsigned __int16 *)((char *)v93 + v38);
14712 --v96; 14594 --v96;
14713 } 14595 }
14714 while ( v96 ); 14596 while ( v96 );
14715 } 14597 }
14716 goto LABEL_38; 14598 }
14717 } 14599 else
14718 v6 = viewparams->field_38; 14600 {
14719 v86 = viewparams->field_38; 14601 black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0);
14720 v84 = viewparams->field_3A; 14602 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu);
14721 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) 14603 v7 = pIndoor->pMapOutlines;
14722 goto LABEL_23; 14604 uNumBlueFacesInBLVMinimap = 0;
14723 v5 = viewparams->field_2C - 34; 14605 v8 = pIndoor->pMapOutlines->uNumOutlines == 0;
14724 LABEL_8: 14606 v9 = pIndoor->pMapOutlines->uNumOutlines < 0;
14725 black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); 14607 v94 = 0;
14726 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); 14608 if ( !(v9 | v8) )
14727 v7 = (uint *)pIndoor->pMapOutlines; 14609 {
14728 uNumBlueFacesInBLVMinimap = 0; 14610 i = 0;
14729 v8 = pIndoor->pMapOutlines->uNumOutlines == 0; 14611 do
14730 v9 = (pIndoor->pMapOutlines->uNumOutlines & 0x80000000u) != 0; 14612 {
14731 v94 = 0; 14613 v10 = (int)((char *)v7 + i + 4);
14732 if ( !(v9 | v8) ) 14614 v96 = pIndoor->pFaces[*(short *)((char *)v7 + i + 8)].uAttributes;
14733 { 14615 if ( !(BYTE1(v96) & 0x20 || (v11 = pIndoor->pFaces[*(short *)((char *)v7 + i + 10)].uAttributes, BYTE1(v11) & 0x20) ))
14734 i = 0; 14616 {
14735 do 14617 v12 = *(short *)((char *)v7 + i + 14);
14736 { 14618 if ( !(v12 & 1) )
14737 v10 = (int)((char *)v7 + i + 4); 14619 {
14738 v96 = pIndoor->pFaces[*(short *)((char *)v7 + i + 8)].uAttributes; 14620 if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 ))
14739 if ( BYTE1(v96) & 0x20 || (v11 = pIndoor->pFaces[*(short *)((char *)v7 + i + 10)].uAttributes, BYTE1(v11) & 0x20) ) 14621 {
14740 goto LABEL_17; 14622 v96 = (signed int)v94 >> 3;
14741 v12 = *(short *)((char *)v7 + i + 14); 14623 v13 = v94;
14742 if ( !(v12 & 1) ) 14624 *(short *)(v10 + 10) = v12 | 1;
14743 { 14625 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8);
14744 if ( !(v96 & 0x80) && (v11 & 0x80u) == 0 ) 14626 }
14745 goto LABEL_17; 14627 }
14746 v96 = (signed int)v94 >> 3; 14628 if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1)
14747 v13 = v94; 14629 {
14748 *(short *)(v10 + 10) = v12 | 1; 14630 v14 = *(short *)v10;
14749 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8); 14631 v88 = v5;
14750 } 14632 v15 = &pIndoor->pVertices[v14];
14751 v14 = *(short *)v10; 14633 v16 = v15->x;
14752 v88 = v5; 14634 v17 = v15->y - v84;
14753 v15 = &pIndoor->pVertices[v14]; 14635 v93 = (unsigned __int16 *)(v16 - v6);
14754 v16 = v15->x; 14636 v92 = v17;
14755 v17 = v15->y - v84; 14637 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)];
14756 v93 = (unsigned __int16 *)(v16 - v6); 14638 v19 = v18->x;
14757 v92 = v17; 14639 v20 = v18->y - v84;
14758 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)]; 14640 v95 = v19 - v6;
14759 v19 = v18->x; 14641 v97 = (const void *)v20;
14760 v20 = v18->y - v84; 14642 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16;
14761 v95 = v19 - v6; 14643 v87 = (unsigned __int64)((signed int)v92 * (signed __int64)v5) >> 16;
14762 v97 = (const void *)v20; 14644 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16);
14763 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16; 14645 v92 = (unsigned __int64)(v20 * (signed __int64)v5) >> 16;
14764 v87 = (unsigned __int64)((signed int)v92 * (signed __int64)v5) >> 16; 14646 pRenderer->Line2D(
14765 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); 14647 v85 + v88,
14766 v92 = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; 14648 v90 - v87,
14767 pRenderer->Line2D( 14649 v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16),
14768 v85 + v88, 14650 v90 - v92,
14769 v90 - v87, 14651 black);
14770 v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), 14652 v7 = pIndoor->pMapOutlines;
14771 v90 - v92, 14653 }
14772 black); 14654 }
14773 v7 = (uint *)pIndoor->pMapOutlines; 14655 ++v94;
14774 LABEL_17: 14656 i += 12;
14775 ++v94; 14657 }
14776 i += 12; 14658 while ( v94 < (signed int)v7->uNumOutlines );
14777 } 14659 }
14778 while ( (signed int)v94 < (signed int)*v7 ); 14660 v21 = 0;
14779 } 14661 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
14780 v21 = 0; 14662 {
14781 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) 14663 while ( 1 )
14782 { 14664 {
14783 while ( 1 ) 14665 v22 = pBlueFacesInBLVMinimapIDs[v21];
14784 { 14666 v87 = v5;
14785 v22 = pBlueFacesInBLVMinimapIDs[v21]; 14667 v23 = &v7->pOutlines[v22];
14786 v87 = v5; 14668 v24 = &pIndoor->pVertices[v23->uVertex1ID];
14787 v23 = (int)&v7[3 * v22 + 1]; 14669 v25 = &pIndoor->pVertices[v23->uVertex2ID];
14788 v24 = &pIndoor->pVertices[*(short *)v23]; 14670 v26 = v25->x;
14789 v25 = &pIndoor->pVertices[*(short *)(v23 + 2)]; 14671 v27 = (unsigned __int16 *)(v24->x - v86);
14790 v26 = v25->x; 14672 v28 = v24->y - v84;
14791 v27 = (unsigned __int16 *)(v24->x - v86); 14673 v29 = v25->y - v84;
14792 v28 = v24->y - v84; 14674 v93 = v27;
14793 v29 = v25->y - v84; 14675 v92 = v28;
14794 v93 = v27; 14676 v97 = (const void *)v29;
14795 v92 = v28; 14677 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16;
14796 v97 = (const void *)v29; 14678 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16;
14797 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16; 14679 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16;
14798 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; 14680 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16;
14799 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; 14681 pRenderer->Line2D(
14800 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; 14682 v85 + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16),
14801 pRenderer->Line2D( 14683 v90 - v88,
14802 v85 + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), 14684 v85 + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16),
14803 v90 - v88, 14685 v90 - v95,
14804 v85 + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), 14686 teal);
14805 v90 - v95, 14687 ++v21;
14806 teal); 14688 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
14807 ++v21; 14689 break;
14808 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) 14690 v7 = pIndoor->pMapOutlines;
14809 break; 14691 }
14810 v7 = (uint *)pIndoor->pMapOutlines; 14692 v6 = v86;
14811 } 14693 }
14812 v6 = v86; 14694 }
14813 }
14814 LABEL_38:
14815 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 3; 14695 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 3;
14816 v81 = pParty->vPosition.y - v84; 14696 v81 = pParty->vPosition.y - v84;
14817 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); 14697 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16);
14818 v48 = 1; 14698 v48 = 1;
14819 v49 = v90 - (int)v97 - 3; 14699 v49 = v90 - (int)v97 - 3;
14863 { 14743 {
14864 if ( (signed int)v51 > 1408 ) 14744 if ( (signed int)v51 > 1408 )
14865 { 14745 {
14866 if ( (signed int)v51 >= 1664 ) 14746 if ( (signed int)v51 >= 1664 )
14867 { 14747 {
14868 if ( (signed int)v51 > 1920 ) 14748 if ( (signed int)v51 <= 1920 )
14869 goto LABEL_71; 14749 v73 = 7;
14870 v73 = 7;
14871 } 14750 }
14872 else 14751 else
14873 { 14752 {
14874 v73 = 6; 14753 v73 = 6;
14875 } 14754 }
14891 } 14770 }
14892 else 14771 else
14893 { 14772 {
14894 v73 = 2; 14773 v73 = 2;
14895 } 14774 }
14896 v50 = v73; 14775 if( (signed int)v51 <=1920)
14897 goto LABEL_71; 14776 v50 = v73;
14898 } 14777 }
14899 v50 = 1; 14778 else
14900 } 14779 v50 = 1;
14901 LABEL_71: 14780 }
14902 pRenderer->_4A6776( 14781 pRenderer->_4A6776(
14903 v47, 14782 v47,
14904 v49, 14783 v49,
14905 (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0)); 14784 (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0));
14906 } 14785 }
14968 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57); 14847 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57);
14969 v78 = (unsigned __int16 *)(v60 >> 16); 14848 v78 = (unsigned __int16 *)(v60 >> 16);
14970 v62 = (int)v61 << 16; 14849 v62 = (int)v61 << 16;
14971 teal = v60 >> 16; 14850 teal = v60 >> 16;
14972 v63 = (signed __int16)v61; 14851 v63 = (signed __int16)v61;
14973 a4a = &v75; 14852 a4a = v75;
14974 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu); 14853 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu);
14975 v85 = 0; 14854 v85 = 0;
14976 for ( i = result; v85 < (signed int)v95; result = v85 ) 14855 for ( i = result; v85 < (signed int)v95; result = v85 )
14977 { 14856 {
14978 a5a = 0; 14857 a5a = 0;
14986 if ( !pOutdoor->_47F04C(v81, v96) ) 14865 if ( !pOutdoor->_47F04C(v81, v96) )
14987 { 14866 {
14988 if ( pOutdoor->_47F097(v81, v96) ) 14867 if ( pOutdoor->_47F097(v81, v96) )
14989 { 14868 {
14990 if ( !((a5a + v85) % 2) ) 14869 if ( !((a5a + v85) % 2) )
14991 *(short *)a4a = i; 14870 *a4a = i;
14992 } 14871 }
14993 else 14872 else
14994 { 14873 {
14995 *(short *)a4a = 0; 14874 *a4a = 0;
14996 } 14875 }
14997 } 14876 }
14998 a4a += 2; 14877 ++a4a;
14999 v97 = (char *)v97 + black; 14878 v97 = (char *)v97 + black;
15000 v64 = (signed int)v97 >> 16; 14879 v64 = (signed int)v97 >> 16;
15001 ++a5a; 14880 ++a5a;
15002 } 14881 }
15003 while ( a5a < v90 ); 14882 while ( a5a < v90 );
15004 } 14883 }
15005 v62 += black; 14884 v62 += black;
15006 v97 = (const void *)v60; 14885 v97 = (const void *)v60;
15007 a4a += 2 * (v90 - a5a); 14886 a4a += v90 - a5a;
15008 v63 = v62 >> 16; 14887 v63 = v62 >> 16;
15009 ++v85; 14888 ++v85;
15010 teal = (unsigned int)v78; 14889 teal = (unsigned int)v78;
15011 } 14890 }
15012 v65 = v95; 14891 v65 = v95;
15013 v66 = &v75; 14892 v66 = v75;
15014 if ( (signed int)v95 > 0 ) 14893 if ( (signed int)v95 > 0 )
15015 { 14894 {
15016 v67 = v77; 14895 v67 = v77;
15017 result = 2 * (v79 - v90); 14896 result = 2 * (v79 - v90);
15018 do 14897 do
15023 do 14902 do
15024 { 14903 {
15025 v69 = *(short *)v66; 14904 v69 = *(short *)v66;
15026 if ( !*(short *)v66 || v69 == (short)i ) 14905 if ( !*(short *)v66 || v69 == (short)i )
15027 *v67 = v69; 14906 *v67 = v69;
15028 v66 += 2; 14907 ++v66;
15029 ++v67; 14908 ++v67;
15030 --v68; 14909 --v68;
15031 } 14910 }
15032 while ( v68 ); 14911 while ( v68 );
15033 } 14912 }
15234 return result; 15113 return result;
15235 } 15114 }
15236 15115
15237 15116
15238 //----- (00443801) -------------------------------------------------------- 15117 //----- (00443801) --------------------------------------------------------
15239 int __cdecl Initialize2DA() 15118 void Initialize2DA()
15240 { 15119 {
15241 const char *v0; // esi@3 15120
15242 _2devent *v1; // edi@3 15121 int i;
15243 char *v2; // esi@5 15122 char* test_string;
15244 int v3; // edx@5 15123 unsigned char c;
15245 char v4; // cl@6 15124 bool break_loop;
15246 int v5; // eax@6 15125 unsigned int temp_str_len;
15247 int v6; // ebx@10 15126 char* tmp_pos;
15248 int v7; // eax@60 15127 int decode_step;
15249 int result; // eax@78 15128
15250 signed int v9; // [sp+10h] [bp-8h]@5 15129 if ( p2DEventsTXT_Raw )
15251 signed int v10; // [sp+14h] [bp-4h]@5 15130 pAllocator->FreeChunk(p2DEventsTXT_Raw);
15252 15131 p2DEventsTXT_Raw = NULL;
15253 int it = 0; 15132 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
15254 15133 strtok(p2DEventsTXT_Raw, "\r");
15255 if ( p2DEventsTXT_Raw ) 15134 strtok(NULL, "\r");
15256 pAllocator->FreeChunk(p2DEventsTXT_Raw); 15135
15257 p2DEventsTXT_Raw = 0; 15136 for (i=0;i<525;++i)
15258 v0 = "\r"; 15137 {
15259 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); 15138 test_string = strtok(NULL, "\r") + 1;
15260 strtok(p2DEventsTXT_Raw, "\r"); 15139 break_loop = false;
15261 strtok(0, "\r"); 15140 decode_step=0;
15262 v1 = p2DEvents; 15141 do
15263 while ( 1 ) 15142 {
15264 { 15143 c = *(unsigned char*)test_string;
15265 v2 = strtok(0, v0) + 1; 15144 temp_str_len = 0;
15266 v10 = 0; 15145 while((c!='\t')&&(c>0))
15267 v3 = -2; 15146 {
15268 v9 = -2; 15147 ++temp_str_len;
15269 do 15148 c=test_string[temp_str_len];
15270 { 15149 }
15271 v4 = *v2; 15150 tmp_pos=test_string+temp_str_len;
15272 v5 = 0; 15151 if (*tmp_pos == 0)
15273 while ( v4 != 9 && v4 ) 15152 break_loop = true;
15274 { 15153 *tmp_pos = 0;
15275 ++v5; 15154 if (temp_str_len)
15276 v4 = v2[v5]; 15155 {
15277 } 15156 switch (decode_step)
15278 v6 = (int)&v2[v5]; 15157 {
15279 if ( !v2[v5] ) 15158 case 2:
15280 v10 = 1; 15159 {
15281 *(char *)v6 = 0; 15160 if ( !_strnicmp(test_string, "wea", 3) )
15282 if ( v5 ) 15161 {
15283 { 15162 p2DEvents[i].uType = 1;
15284 switch ( v3 ) 15163 break;
15285 { 15164 }
15286 case 0: 15165 if ( !_strnicmp(test_string, "arm", 3) )
15287 if ( _strnicmp(v2, "wea", 3u) ) 15166 {
15288 { 15167 p2DEvents[i].uType = 2;
15289 if ( _strnicmp(v2, "arm", 3u) ) 15168 break;
15290 { 15169 }
15291 if ( _strnicmp(v2, "mag", 3u) ) 15170 if ( !_strnicmp(test_string, "mag", 3) )
15292 { 15171 {
15293 if ( _strnicmp(v2, "alc", 3u) ) 15172 p2DEvents[i].uType = 3;
15294 { 15173 break;
15295 if ( _strnicmp(v2, "sta", 3u) ) 15174 }
15296 { 15175 if ( !_strnicmp(test_string, "alc", 3) )
15297 if ( _strnicmp(v2, "boa", 3u) ) 15176 {
15298 { 15177 p2DEvents[i].uType = 4;
15299 if ( _strnicmp(v2, "tem", 3u) ) 15178 break;
15300 { 15179 }
15301 if ( _strnicmp(v2, "tra", 3u) ) 15180 if ( !_strnicmp(test_string, "sta", 3) )
15302 { 15181 {
15303 if ( _strnicmp(v2, "tow", 3u) ) 15182 p2DEvents[i].uType = 27;
15304 { 15183 break;
15305 if ( _strnicmp(v2, "tav", 3u) ) 15184 }
15306 { 15185 if ( !_strnicmp(test_string, "boa", 3) )
15307 if ( _strnicmp(v2, "ban", 3u) ) 15186 {
15308 { 15187 p2DEvents[i].uType = 28;
15309 if ( _strnicmp(v2, "fir", 3u) ) 15188 break;
15310 { 15189 }
15311 if ( _strnicmp(v2, "air", 3u) ) 15190 if ( !_strnicmp(test_string, "tem", 3) )
15312 { 15191 {
15313 if ( _strnicmp(v2, "wat", 3u) ) 15192 p2DEvents[i].uType = 23;
15314 { 15193 break;
15315 if ( _strnicmp(v2, "ear", 3u) ) 15194 }
15316 { 15195 if ( !_strnicmp(test_string, "tra", 3) )
15317 if ( _strnicmp(v2, "spi", 3u) ) 15196 {
15318 { 15197 p2DEvents[i].uType = 30;
15319 if ( _strnicmp(v2, "min", 3u) ) 15198 break;
15320 { 15199 }
15321 if ( _strnicmp(v2, "bod", 3u) ) 15200 if ( !_strnicmp(test_string, "tow", 3) )
15322 { 15201 {
15323 if ( _strnicmp(v2, "lig", 3u) ) 15202 p2DEvents[i].uType = 17;
15324 { 15203 break;
15325 if ( _strnicmp(v2, "dar", 3u) ) 15204 }
15326 { 15205
15327 if ( _strnicmp(v2, "ele", 3u) ) 15206 if ( !_strnicmp(test_string, "tav", 3) )
15328 { 15207 {
15329 if ( _strnicmp(v2, "sel", 3u) ) 15208 p2DEvents[i].uType = 21;
15330 { 15209 break;
15331 if ( _strnicmp(v2, "mir", 3u) ) 15210 }
15332 { 15211 if ( !_strnicmp(test_string, "ban", 3) )
15333 v7 = -(_strnicmp(v2, "mer", 3u) != 0); 15212 {
15334 LOBYTE(v7) = v7 & 0xEE; 15213 p2DEvents[i].uType = 22;
15335 v1->uType = v7 + 18; 15214 break;
15336 } 15215 }
15337 else 15216 if ( !_strnicmp(test_string, "fir", 3) )
15338 { 15217 {
15339 v1->uType = 16; 15218 p2DEvents[i].uType = 5;
15340 } 15219 break;
15341 } 15220 }
15342 else 15221 if ( !_strnicmp(test_string, "air", 3) )
15343 { 15222 {
15344 v1->uType = 15; 15223 p2DEvents[i].uType = 6;
15345 } 15224 break;
15346 } 15225 }
15347 else 15226 if ( !_strnicmp(test_string, "wat", 3) )
15348 { 15227 {
15349 v1->uType = 14; 15228 p2DEvents[i].uType = 7;
15350 } 15229 break;
15351 } 15230 }
15352 else 15231 if ( !_strnicmp(test_string, "ear", 3) )
15353 { 15232 {
15354 v1->uType = 13; 15233 p2DEvents[i].uType = 8;
15355 } 15234 break;
15356 } 15235 }
15357 else 15236 if ( !_strnicmp(test_string, "spi", 3) )
15358 { 15237 {
15359 v1->uType = 12; 15238 p2DEvents[i].uType = 9;
15360 } 15239 break;
15361 } 15240 }
15362 else 15241 if ( !_strnicmp(test_string, "min", 3) )
15363 { 15242 {
15364 v1->uType = 11; 15243 p2DEvents[i].uType = 10;
15365 } 15244 break;
15366 } 15245 }
15367 else 15246 if ( !_strnicmp(test_string, "bod", 3) )
15368 { 15247 {
15369 v1->uType = 10; 15248 p2DEvents[i].uType = 11;
15370 } 15249 break;
15371 } 15250 }
15372 else 15251 if ( !_strnicmp(test_string, "lig", 3) )
15373 { 15252 {
15374 v1->uType = 9; 15253 p2DEvents[i].uType = 12;
15375 } 15254 break;
15376 } 15255 }
15377 else 15256 if ( !_strnicmp(test_string, "dar", 3) )
15378 { 15257 {
15379 v1->uType = 8; 15258 p2DEvents[i].uType = 13;
15380 } 15259 break;
15381 } 15260 }
15382 else 15261 if ( !_strnicmp(test_string, "ele", 3) )
15383 { 15262 {
15384 v1->uType = 7; 15263 p2DEvents[i].uType = 14;
15385 } 15264 break;
15386 } 15265 }
15387 else 15266 if ( !_strnicmp(test_string, "sel", 3) )
15388 { 15267 {
15389 v1->uType = 6; 15268 p2DEvents[i].uType = 15;
15390 } 15269 break;
15391 } 15270 }
15392 else 15271 if ( !_strnicmp(test_string, "mir", 3) )
15393 { 15272 {
15394 v1->uType = 5; 15273 p2DEvents[i].uType = 16;
15395 } 15274 break;
15396 } 15275 }
15397 else 15276 if ( !_strnicmp(test_string, "mer", 3) )
15398 { 15277 {
15399 v1->uType = 22; 15278 p2DEvents[i].uType = 17;
15400 } 15279 break;
15401 } 15280 }
15402 else 15281 p2DEvents[i].uType = 18;
15403 { 15282 }
15404 v1->uType = 21; 15283 break;
15405 } 15284
15406 } 15285 case 4:
15407 else 15286 p2DEvents[i].uAnimationID = atoi(test_string);
15408 { 15287 break;
15409 v1->uType = 17; 15288 case 5:
15410 } 15289 p2DEvents[i].pName = RemoveQuotes(test_string);
15411 } 15290 break;
15412 else 15291 case 6:
15413 { 15292 p2DEvents[i].pProprieterName = RemoveQuotes(test_string);
15414 v1->uType = 30; 15293 break;
15415 } 15294 case 7:
15416 } 15295 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string);
15417 else 15296 break;
15418 { 15297 case 8:
15419 v1->uType = 23; 15298 p2DEvents[i].field_14 = atoi(test_string);
15420 } 15299 break;
15421 } 15300 case 9:
15422 else 15301 p2DEvents[i]._state = atoi(test_string);
15423 { 15302 break;
15424 v1->uType = 28; 15303 case 10:
15425 } 15304 p2DEvents[i]._rep = atoi(test_string);
15426 } 15305 break;
15427 else 15306 case 11:
15428 { 15307 p2DEvents[i]._per = atoi(test_string);
15429 v1->uType = 27; 15308 break;
15430 } 15309 case 12:
15431 } 15310 p2DEvents[i].fPriceMultiplier = atof(test_string);
15432 else 15311 break;
15433 { 15312 case 13:
15434 v1->uType = 4; 15313 p2DEvents[i].flt_24 = atof(test_string);
15435 } 15314 break;
15436 } 15315 case 15:
15437 else 15316 p2DEvents[i].field_1C = atoi(test_string);
15438 { 15317 break;
15439 v1->uType = 3; 15318 case 18:
15440 } 15319 p2DEvents[i].uOpenTime = atoi(test_string);
15441 } 15320 break;
15442 else 15321 case 19:
15443 { 15322 p2DEvents[i].uCloseTime = atoi(test_string);
15444 v1->uType = 2; 15323 break;
15445 } 15324 case 20:
15446 } 15325 p2DEvents[i].uExitPicID = atoi(test_string);
15447 else 15326 break;
15448 { 15327 case 21:
15449 v1->uType = 1; 15328 p2DEvents[i].uExitMapID = atoi(test_string);
15450 } 15329 break;
15451 break; 15330 case 22:
15452 case 2: 15331 p2DEvents[i]._quest_related = atoi(test_string);
15453 v1->uAnimationID = atoi(v2); 15332 break;
15454 break; 15333 case 23:
15455 case 3: 15334 p2DEvents[i].pEnterText = RemoveQuotes(test_string);
15456 v1->pName = (char *)RemoveQuotes(v2); 15335 break;
15457 break; 15336 }
15458 case 4: 15337 }
15459 v1->pProprieterName = RemoveQuotes(v2); 15338 ++decode_step;
15460 break; 15339 test_string=tmp_pos+1;
15461 case 5: 15340 } while ((decode_step<24)&&!break_loop);
15462 v1->pProprieterTitle = RemoveQuotes(v2); 15341 }
15463 break; 15342
15464 case 6:
15465 v1->field_14 = atoi(v2);
15466 break;
15467 case 7:
15468 v1->_state = atoi(v2);
15469 break;
15470 case 8:
15471 v1->_rep = atoi(v2);
15472 break;
15473 case 9:
15474 v1->_per = atoi(v2);
15475 break;
15476 case 10:
15477 v1->fPriceMultiplier = atof(v2);
15478 break;
15479 case 11:
15480 v1->flt_24 = atof(v2);
15481 break;
15482 case 13:
15483 v1->field_1C = atoi(v2);
15484 break;
15485 case 16:
15486 v1->uOpenTime = atoi(v2);
15487 break;
15488 case 17:
15489 v1->uCloseTime = atoi(v2);
15490 break;
15491 case 18:
15492 v1->uExitPicID = atoi(v2);
15493 break;
15494 case 19:
15495 v1->uExitMapID = atoi(v2);
15496 break;
15497 case 20:
15498 v1->_quest_related = atoi(v2);
15499 break;
15500 case 21:
15501 v1->pEnterText = RemoveQuotes(v2);
15502 break;
15503 default:
15504 break;
15505 }
15506 }
15507 v2 = (char *)(v6 + 1);
15508 v3 = v9 + 1;
15509 v9 = v3;
15510 result = v3 + 1;
15511 }
15512 while ( v3 + 1 <= 23 && !v10 );
15513 ++v1;
15514 //if ( (signed int)v1 >= (signed int)&unk_597F10 )
15515 if (++it >= 525)
15516 return result;
15517 v0 = "\r";
15518 }
15519 } 15343 }
15520 15344
15521 //----- (00443CE1) -------------------------------------------------------- 15345 //----- (00443CE1) --------------------------------------------------------
15522 unsigned int __fastcall LoadEventsToBuffer(const char *pContainerName, char *a2, unsigned int uBufferSize) 15346 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize)
15523 { 15347 {
15524 const char *v3; // edi@1 15348 FILE *pLodFile; // eax@1
15525 FILE *v4; // eax@1 15349 unsigned int uTextureSize; // esi@3
15526 unsigned int v5; // esi@3 15350 char Args[60]; // [sp+8h] [bp-B4h]@6
15527 char Args; // [sp+8h] [bp-B4h]@6
15528 //Texture DstBuf; // [sp+6Ch] [bp-50h]@1
15529 void *Dst; // [sp+B4h] [bp-8h]@1
15530 void *ptr; // [sp+B8h] [bp-4h]@1 15351 void *ptr; // [sp+B8h] [bp-4h]@1
15531 15352 Texture DstBuf; // [sp+6Ch] [bp-50h]@1
15532 v3 = pContainerName; 15353
15533 Dst = a2;
15534 ptr = pEvents_LOD->LoadRaw(pContainerName, 0); 15354 ptr = pEvents_LOD->LoadRaw(pContainerName, 0);
15535 15355 pLodFile = pEvents_LOD->FindContainer(pContainerName, 0);
15536 Texture DstBuf; // [sp+6Ch] [bp-50h]@1 15356 if ( !pLodFile )
15537 //Texture::Texture(&DstBuf); 15357 Abortf("Unable to load %s", pContainerName);
15538 15358 fread(&DstBuf, 1, 48, pLodFile);
15539 v4 = pEvents_LOD->FindContainer(v3, 0); 15359 uTextureSize = DstBuf.uDecompressedSize;
15540 if ( !v4 )
15541 Abortf("Unable to load %s", v3);
15542 fread(&DstBuf, 1u, 0x30u, v4);
15543 v5 = DstBuf.uDecompressedSize;
15544 if ( !DstBuf.uDecompressedSize ) 15360 if ( !DstBuf.uDecompressedSize )
15545 v5 = DstBuf.uTextureSize; 15361 uTextureSize = DstBuf.uTextureSize;
15546 memset(&DstBuf, 0, 0x48u); 15362 memset(&DstBuf, 0, 72);
15547 if ( (signed int)v5 >= (signed int)uBufferSize ) 15363 if ( uTextureSize >= (signed int)uBufferSize )
15548 { 15364 {
15549 sprintf(&Args, "File %s Size %lu - Buffer size %lu", v3, v5, uBufferSize); 15365 sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize);
15550 Abortf(&Args); 15366 Abortf(Args);
15551 } 15367 }
15552 memcpy(Dst, ptr, v5); 15368 memcpy(pBuffer, ptr, uTextureSize);
15553 pAllocator->FreeChunk(ptr); 15369 pAllocator->FreeChunk(ptr);
15554 return v5; 15370 return uTextureSize;
15555 } 15371 }
15556 15372
15557 //----- (00443DA1) -------------------------------------------------------- 15373 //----- (00443DA1) --------------------------------------------------------
15558 void __cdecl Initialize_GlobalEVT() 15374 void __cdecl Initialize_GlobalEVT()
15559 { 15375 {
16414 int v12; // esi@39 16230 int v12; // esi@39
16415 char *v13; // eax@41 16231 char *v13; // eax@41
16416 GUIButton *v14; // eax@43 16232 GUIButton *v14; // eax@43
16417 GUIButton *v15; // edi@43 16233 GUIButton *v15; // edi@43
16418 signed int v16; // eax@44 16234 signed int v16; // eax@44
16419 int v17; // eax@46
16420 int v18; // eax@47
16421 int v19; // eax@48
16422 int v20; // eax@49
16423 int v21; // eax@50
16424 int v22; // eax@51
16425 unsigned int v23; // eax@53 16235 unsigned int v23; // eax@53
16426 const char *v24; // eax@59 16236 const char *v24; // eax@59
16427 int v25; // eax@65
16428 int v26; // eax@66
16429 int v27; // eax@67
16430 int v28; // eax@68
16431 int v29; // eax@69
16432 unsigned __int16 v30; // cx@83 16237 unsigned __int16 v30; // cx@83
16433 int v31; // ecx@86 16238 int v31; // ecx@86
16434 int v32; // ebx@93 16239 int v32; // ebx@93
16435 unsigned int v33; // eax@93 16240 unsigned int v33; // eax@93
16436 GUIWindow *v34; // ecx@93 16241 GUIWindow *v34; // ecx@93
16454 GUIWindow v52; // [sp+ACh] [bp-68h]@42 16259 GUIWindow v52; // [sp+ACh] [bp-68h]@42
16455 char *Str; // [sp+100h] [bp-14h]@104 16260 char *Str; // [sp+100h] [bp-14h]@104
16456 __int16 v54[2]; // [sp+104h] [bp-10h]@2 16261 __int16 v54[2]; // [sp+104h] [bp-10h]@2
16457 unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82 16262 unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82
16458 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 16263 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39
16459 char *pInString; // [sp+110h] [bp-4h]@32 16264 char *pInString=NULL; // [sp+110h] [bp-4h]@32
16460 16265
16461 if ( !pDialogueWindow ) 16266 if ( !pDialogueWindow )
16462 return; 16267 return;
16463 memcpy(&v51, pDialogueWindow, sizeof(v51)); 16268 memcpy(&v51, pDialogueWindow, sizeof(v51));
16464 pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); 16269 pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID);
16481 { 16286 {
16482 strcpy(pTmpBuf, pNPC->pName); 16287 strcpy(pTmpBuf, pNPC->pName);
16483 } 16288 }
16484 v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); 16289 v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3);
16485 pParty->GetPartyFame(); 16290 pParty->GetPartyFame();
16486 if ( (signed int)uDialogueType > 89 ) 16291 if ( (signed int)uDialogueType > DIALOGUE_ARENA_WELCOME )
16487 { 16292 {
16488 if ( uDialogueType == 90 ) 16293 if ( uDialogueType == DIALOGUE_ARENA_FIGHT_NOT_OVER_YET )
16489 { 16294 {
16490 pWindow.uFrameWidth = 460; 16295 pWindow.uFrameWidth = 460;
16491 pWindow.uFrameZ = 452; 16296 pWindow.uFrameZ = 452;
16492 pOutString = pFontArrus; 16297 pOutString = pFontArrus;
16493 v12 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;//"Get back in there you wimps:" 16298 v12 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;//"Get back in there you wimps:"
16499 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16304 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16500 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16305 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16501 pRenderer->DrawTextureIndexed(8, 347 - v12, pTexture_591428); 16306 pRenderer->DrawTextureIndexed(8, 347 - v12, pTexture_591428);
16502 v13 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[577], pFontArrus, &pWindow, 0xDu, 0); 16307 v13 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[577], pFontArrus, &pWindow, 0xDu, 0);
16503 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); 16308 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0);
16504 goto LABEL_42; 16309 }
16505 } 16310 else if ( uDialogueType == DIALOGUE_ARENA_REWARD )
16506 if ( uDialogueType == 91 )
16507 { 16311 {
16508 sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold." 16312 sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold."
16509 pInString = v4; 16313 pInString = v4;
16510 v8 = 0;
16511 pWindow.uFrameWidth = 460; 16314 pWindow.uFrameWidth = 460;
16512 pWindow.uFrameZ = 452; 16315 pWindow.uFrameZ = 452;
16513 pOutString = pFontArrus; 16316 pOutString = pFontArrus;
16514 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16317 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16515 if ( 352 - v12 < 8 ) 16318 if ( 352 - v12 < 8 )
16516 { 16319 {
16517 pOutString = pFontCreate; 16320 pOutString = pFontCreate;
16518 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16321 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16519 } 16322 }
16520 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16323 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16521 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16324 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16522 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16325 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16523 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16326 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16524 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16327 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16525 goto LABEL_42; 16328 }
16526 } 16329 else if ( uDialogueType == DIALOGUE_ARENA_ALREADY_WON )
16527 if ( uDialogueType == 92 ) 16330 {
16528 { 16331 pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:"
16529 v7 = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" 16332 pWindow.uFrameWidth = 460;
16530 v8 = 0; 16333 pWindow.uFrameZ = 452;
16334 pOutString = pFontArrus;
16335 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16336 if ( 352 - v12 < 8 )
16337 {
16338 pOutString = pFontCreate;
16339 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16340 }
16341 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16342 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16343 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16344 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16345 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16346 }
16347 }
16348 else
16349 {
16350 if ( uDialogueType == DIALOGUE_ARENA_WELCOME )
16351 {
16352 v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
16531 pInString = v7; 16353 pInString = v7;
16532 pWindow.uFrameWidth = 460; 16354 pWindow.uFrameWidth = 460;
16533 pWindow.uFrameZ = 452; 16355 pWindow.uFrameZ = 452;
16534 pOutString = pFontArrus; 16356 pOutString = pFontArrus;
16535 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16357 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16536 if ( 352 - v12 < 8 ) 16358 if ( 352 - v12 < 8 )
16537 { 16359 {
16538 pOutString = pFontCreate; 16360 pOutString = pFontCreate;
16539 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16361 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16540 } 16362 }
16541 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16363 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16542 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16364 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16543 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16365 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16544 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16366 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16545 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16367 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16546 goto LABEL_42; 16368 }
16547 } 16369 else if ( uDialogueType == DIALOGUE_13 )
16548 }
16549 else
16550 {
16551 if ( uDialogueType == 89 )
16552 {
16553 v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
16554 v8 = 0;
16555 pInString = v7;
16556 pWindow.uFrameWidth = 460;
16557 pWindow.uFrameZ = 452;
16558 pOutString = pFontArrus;
16559 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
16560 if ( 352 - v12 < 8 )
16561 {
16562 pOutString = pFontCreate;
16563 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
16564 }
16565 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16566 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16567 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16568 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
16569 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
16570 goto LABEL_42;
16571 }
16572 if ( uDialogueType == 13 )
16573 { 16370 {
16574 v5 = 5 * pNPC->uProfession; 16371 v5 = 5 * pNPC->uProfession;
16575 v6 = (char *)*(&pNPCStats->field_13A64 + v5); 16372 v6 = (char *)*(&pNPCStats->field_13A64 + v5);
16576 v8 = 0;
16577 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); 16373 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16578 pInString = v7; 16374 pInString = v7;
16579 pWindow.uFrameWidth = 460; 16375 pWindow.uFrameWidth = 460;
16580 pWindow.uFrameZ = 452; 16376 pWindow.uFrameZ = 452;
16581 pOutString = pFontArrus; 16377 pOutString = pFontArrus;
16582 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16378 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16583 if ( 352 - v12 < 8 ) 16379 if ( 352 - v12 < 8 )
16584 { 16380 {
16585 pOutString = pFontCreate; 16381 pOutString = pFontCreate;
16586 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16382 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16587 } 16383 }
16588 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16384 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16589 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16385 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16590 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16386 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16591 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16387 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16592 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16388 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16593 goto LABEL_42; 16389 }
16594 } 16390 else if ( (signed int)uDialogueType > DIALOGUE_18 && !((signed int)uDialogueType > DIALOGUE_24 && uDialogueType != DIALOGUE_77 || byte_5B0938[0]) )
16595 if ( (signed int)uDialogueType > 18 ) 16391 {
16596 { 16392 if ( (signed int)uDialogueType > DIALOGUE_24 && uDialogueType == DIALOGUE_77 )
16597 if ( (signed int)uDialogueType > 24 ) 16393 {
16598 {
16599 if ( uDialogueType == 77 )
16600 {
16601 v5 = 5 * pNPC->uProfession; 16394 v5 = 5 * pNPC->uProfession;
16602 if ( byte_F8B1EC ) 16395 if ( byte_F8B1EC )
16603 { 16396 {
16604 v6 = (char *)*(&pNPCStats->field_13A5C + 5 * pNPC->uProfession); 16397 v6 = (char *)*(&pNPCStats->field_13A5C + 5 * pNPC->uProfession);
16605 v8 = 0;
16606 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); 16398 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16607 pInString = v7; 16399 pInString = v7;
16608 pWindow.uFrameWidth = 460; 16400 pWindow.uFrameWidth = 460;
16609 pWindow.uFrameZ = 452; 16401 pWindow.uFrameZ = 452;
16610 pOutString = pFontArrus; 16402 pOutString = pFontArrus;
16611 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16403 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16612 if ( 352 - v12 < 8 ) 16404 if ( 352 - v12 < 8 )
16613 { 16405 {
16614 pOutString = pFontCreate; 16406 pOutString = pFontCreate;
16615 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16407 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16616 } 16408 }
16617 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16409 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16618 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16410 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16619 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16411 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16620 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16412 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16621 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16413 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16622 goto LABEL_42;
16623 } 16414 }
16624 if ( pNPC->uFlags & 0x80 ) 16415 else if ( pNPC->uFlags & 0x80 )
16625 { 16416 {
16626 v6 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); 16417 v6 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession);
16627 v8 = 0;
16628 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); 16418 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16629 pInString = v7; 16419 pInString = v7;
16630 pWindow.uFrameWidth = 460; 16420 pWindow.uFrameWidth = 460;
16631 pWindow.uFrameZ = 452; 16421 pWindow.uFrameZ = 452;
16632 pOutString = pFontArrus; 16422 pOutString = pFontArrus;
16633 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16423 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16634 if ( 352 - v12 < 8 ) 16424 if ( 352 - v12 < 8 )
16635 { 16425 {
16636 pOutString = pFontCreate; 16426 pOutString = pFontCreate;
16637 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16427 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16638 } 16428 }
16639 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16429 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16640 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16430 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16641 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16431 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16642 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16432 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16643 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16433 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16644 goto LABEL_42;
16645 } 16434 }
16646 v6 = (char *)*(&pNPCStats->field_13A64 + v5); 16435 else
16647 v8 = 0; 16436 {
16648 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); 16437 v6 = (char *)*(&pNPCStats->field_13A64 + v5);
16649 pInString = v7; 16438 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16650 pWindow.uFrameWidth = 460; 16439 pInString = v7;
16651 pWindow.uFrameZ = 452; 16440 pWindow.uFrameWidth = 460;
16652 pOutString = pFontArrus; 16441 pWindow.uFrameZ = 452;
16653 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16442 pOutString = pFontArrus;
16654 if ( 352 - v12 < 8 ) 16443 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16655 { 16444 if ( 352 - v12 < 8 )
16656 pOutString = pFontCreate; 16445 {
16657 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16446 pOutString = pFontCreate;
16658 } 16447 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16659 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16448 }
16660 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16449 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16661 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16450 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16662 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16451 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16663 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16452 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16664 goto LABEL_42; 16453 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16665 } 16454 }
16666 goto LABEL_24; 16455 }
16667 } 16456 else
16668 if ( byte_5B0938[0] ) 16457 {
16669 goto LABEL_24; 16458 v7 = (char *)ptr_F8B1E8;
16670 v7 = (char *)ptr_F8B1E8; 16459 pInString = v7;
16671 v8 = 0; 16460 pWindow.uFrameWidth = 460;
16672 pInString = v7; 16461 pWindow.uFrameZ = 452;
16673 pWindow.uFrameWidth = 460; 16462 pOutString = pFontArrus;
16674 pWindow.uFrameZ = 452; 16463 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16675 pOutString = pFontArrus; 16464 if ( 352 - v12 < 8 )
16676 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16465 {
16677 if ( 352 - v12 < 8 ) 16466 pOutString = pFontCreate;
16678 { 16467 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16679 pOutString = pFontCreate; 16468 }
16680 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16469 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16681 } 16470 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16682 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16471 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16683 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16472 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16684 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16473 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16685 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16474 }
16686 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16475 }
16687 goto LABEL_42; 16476 else
16688 } 16477 {
16689 } 16478 if ( *(int *)v54 == 1 )
16690 LABEL_24: 16479 {
16691 if ( *(int *)v54 == 1 ) 16480 v11 = pNPC->greet;
16692 { 16481 v8 = 0;
16693 v11 = pNPC->greet; 16482 if ( v11 )
16694 v8 = 0; 16483 {
16695 if ( v11 ) 16484 v10 = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * v11);
16696 { 16485 if ( pInString != NULL )
16697 v10 = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * v11); 16486 {
16698 goto LABEL_32; 16487 pWindow.uFrameWidth = 460;
16699 } 16488 pWindow.uFrameZ = 452;
16700 } 16489 pOutString = pFontArrus;
16701 else 16490 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16702 { 16491 if ( 352 - v12 < 8 )
16703 if ( *(int *)v54 == 2 ) 16492 {
16704 { 16493 pOutString = pFontCreate;
16705 v8 = 0; 16494 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16706 if ( pNPC->uFlags & 0x80 ) 16495 }
16707 v9 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); 16496 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16708 else 16497 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16709 v9 = (char *)*(&pNPCStats->field_13A64 + 5 * pNPC->uProfession); //"Invalid String Passed" 16498 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16710 v10 = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0); 16499 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16711 LABEL_32: 16500 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16712 pInString = v10; 16501 }
16713 if ( v10 == (char *)v8 ) 16502 }
16714 goto LABEL_42; 16503 }
16715 pWindow.uFrameWidth = 460; 16504 else
16716 pWindow.uFrameZ = 452; 16505 {
16717 pOutString = pFontArrus; 16506 if ( *(int *)v54 == 2 )
16718 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16507 {
16719 if ( 352 - v12 < 8 ) 16508 if ( pNPC->uFlags & 0x80 )
16720 { 16509 v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pDismissText;
16721 pOutString = pFontCreate; 16510 else
16722 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; 16511 v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; //"Invalid String Passed"
16723 } 16512 pInString = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0);
16724 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16513 if ( pInString != NULL )
16725 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16514 {
16726 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16515 pWindow.uFrameWidth = 460;
16727 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); 16516 pWindow.uFrameZ = 452;
16728 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); 16517 pOutString = pFontArrus;
16729 goto LABEL_42; 16518 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16730 } 16519 if ( 352 - v12 < 8 )
16731 } 16520 {
16732 LABEL_42: 16521 pOutString = pFontCreate;
16522 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16523 }
16524 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16525 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16526 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16527 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16528 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16529 }
16530 }
16531 }
16532 }
16533 }
16733 memcpy(&v52, pDialogueWindow, sizeof(v52)); 16534 memcpy(&v52, pDialogueWindow, sizeof(v52));
16734 v52.uFrameX = 483; 16535 v52.uFrameX = 483;
16735 v52.uFrameWidth = 148; 16536 v52.uFrameWidth = 148;
16736 v52.uFrameZ = 334; 16537 v52.uFrameZ = 334;
16737 for ( pOutString = (GUIFont *)v52.pStartingPosActiveItem; 16538 for ( pOutString = (GUIFont *)v52.pStartingPosActiveItem;
16741 v14 = v52.GetControl((unsigned int)pOutString); 16542 v14 = v52.GetControl((unsigned int)pOutString);
16742 v15 = v14; 16543 v15 = v14;
16743 if ( !v14 ) 16544 if ( !v14 )
16744 break; 16545 break;
16745 v16 = v14->uControlParam; 16546 v16 = v14->uControlParam;
16746 if ( v16 > 24 ) 16547
16747 { 16548 if ( v16 > 88 )
16748 v25 = v16 - 76; 16549 {
16749 if ( v25 )
16750 {
16751 v26 = v25 - 1;
16752 if ( v26 )
16753 {
16754 v27 = v26 - 8;
16755 if ( v27 )
16756 {
16757 v28 = v27 - 1;
16758 if ( v28 )
16759 {
16760 v29 = v28 - 1;
16761 if ( v29 )
16762 {
16763 if ( v29 != 1 )
16764 {
16765 v24 = "";
16766 goto LABEL_79;
16767 }
16768 v24 = pGlobalTXT_LocalizationStrings[581];
16769 }
16770 else
16771 {
16772 v24 = pGlobalTXT_LocalizationStrings[580];
16773 }
16774 }
16775 else
16776 {
16777 v24 = pGlobalTXT_LocalizationStrings[579];
16778 }
16779 }
16780 else
16781 {
16782 v24 = pGlobalTXT_LocalizationStrings[578];
16783 }
16784 }
16785 else
16786 {
16787 v24 = pGlobalTXT_LocalizationStrings[407];
16788 }
16789 }
16790 else
16791 {
16792 if ( pNPC->uFlags & 0x80 )
16793 {
16794 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName);
16795 v24 = pTmpBuf;
16796 goto LABEL_79;
16797 }
16798 v24 = pGlobalTXT_LocalizationStrings[406];
16799 }
16800 }
16801 else
16802 {
16803 if ( v16 == 24 )
16804 {
16805 v23 = pNPC->evtf;
16806 LABEL_63:
16807 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16808 if ( !v24 )
16809 {
16810 v24 = "";
16811 v15->uControlParam = 0;
16812 }
16813 goto LABEL_79;
16814 }
16815 v17 = v16 - 9;
16816 if ( !v17 )
16817 {
16818 v24 = (const char *)sub_445308(pNPC->uProfession);
16819 goto LABEL_79;
16820 }
16821 v18 = v17 - 4;
16822 if ( v18 )
16823 {
16824 v19 = v18 - 6;
16825 if ( !v19 )
16826 {
16827 v23 = pNPC->bDrawSomeAnim;
16828 goto LABEL_63;
16829 }
16830 v20 = v19 - 1;
16831 if ( !v20 )
16832 {
16833 v23 = pNPC->_anim_current_time;
16834 goto LABEL_63;
16835 }
16836 v21 = v20 - 1;
16837 if ( !v21 )
16838 {
16839 v23 = pNPC->_anim_end_time;
16840 goto LABEL_63;
16841 }
16842 v22 = v21 - 1;
16843 if ( !v22 )
16844 {
16845 v23 = pNPC->evtd;
16846 goto LABEL_63;
16847 }
16848 if ( v22 == 1 )
16849 {
16850 v23 = pNPC->evte;
16851 goto LABEL_63;
16852 }
16853 v24 = ""; 16550 v24 = "";
16854 goto LABEL_79; 16551 }
16855 } 16552 else if ( v16 == 88 )
16856 if ( pNPC->uFlags & 0x80 ) 16553 v24 = pGlobalTXT_LocalizationStrings[581];
16857 { 16554 else if ( v16 == 87 )
16858 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); 16555 v24 = pGlobalTXT_LocalizationStrings[580];
16859 v24 = pTmpBuf; 16556 else if ( v16 == 86 )
16860 goto LABEL_79; 16557 v24 = pGlobalTXT_LocalizationStrings[579];
16861 } 16558 else if ( v16 == 85 )
16862 v24 = pGlobalTXT_LocalizationStrings[122]; 16559 v24 = pGlobalTXT_LocalizationStrings[578];
16863 } 16560 else if ( v16 == 77 )
16864 LABEL_79: 16561 v24 = pGlobalTXT_LocalizationStrings[407];
16562 else if ( v16 == 76 )
16563 {
16564 if ( pNPC->uFlags & 0x80 )
16565 {
16566 sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName);
16567 v24 = pTmpBuf;
16568 }
16569 else
16570 v24 = pGlobalTXT_LocalizationStrings[406];
16571 }
16572 else if ( v16 == 24 )
16573 {
16574 v23 = pNPC->evtf;
16575 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16576 if ( !v24 )
16577 {
16578 v24 = "";
16579 v15->uControlParam = 0;
16580 }
16581 }
16582 else if ( v16 == 9 )
16583 v24 = (const char *)sub_445308(pNPC->uProfession);
16584 else if ( v16 == 19 )
16585 {
16586 v23 = pNPC->bDrawSomeAnim;
16587 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16588 if ( !v24 )
16589 {
16590 v24 = "";
16591 v15->uControlParam = 0;
16592 }
16593 }
16594 else if ( v16 == 20 )
16595 {
16596 v23 = pNPC->_anim_current_time;
16597 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16598 if ( !v24 )
16599 {
16600 v24 = "";
16601 v15->uControlParam = 0;
16602 }
16603 }
16604 else if ( v16 == 21 )
16605 {
16606 v23 = pNPC->_anim_end_time;
16607 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16608 if ( !v24 )
16609 {
16610 v24 = "";
16611 v15->uControlParam = 0;
16612 }
16613 }
16614 else if ( v16 == 22 )
16615 {
16616 v23 = pNPC->evtd;
16617 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16618 if ( !v24 )
16619 {
16620 v24 = "";
16621 v15->uControlParam = 0;
16622 }
16623 }
16624 else if ( v16 == 23 )
16625 {
16626 v23 = pNPC->evte;
16627 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16628 if ( !v24 )
16629 {
16630 v24 = "";
16631 v15->uControlParam = 0;
16632 }
16633 }
16634 else if ( v16 == 13 )
16635 {
16636 if ( pNPC->uFlags & 0x80 )
16637 {
16638 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName);
16639 v24 = pTmpBuf;
16640 }
16641 else
16642 v24 = pGlobalTXT_LocalizationStrings[122];
16643 }
16644 else
16645 v24 = "";
16646
16647
16865 if ( pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1 ) 16648 if ( pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1 )
16866 { 16649 {
16867 pInString = 0; 16650 pInString = 0;
16868 if ( (signed int)uNumActors > 0 ) 16651 if ( (signed int)uNumActors > 0 )
16869 { 16652 {
16947 { 16730 {
16948 unsigned int v1; // esi@1 16731 unsigned int v1; // esi@1
16949 NPCData *result; // eax@5 16732 NPCData *result; // eax@5
16950 int v3; // esi@9 16733 int v3; // esi@9
16951 int v4; // ecx@9 16734 int v4; // ecx@9
16952 int v5; // edx@9 16735 //int v5; // edx@9
16953 NPCData *v6; // eax@9 16736 //NPCData *v6; // eax@9
16954 char *v7; // ebx@14 16737 char *v7; // ebx@14
16955 NPCData *v8; // edi@14 16738 NPCData *v8; // edi@14
16956 char v9; // al@22 16739 char v9; // al@22
16957 std::string v10; // [sp-18h] [bp-2Ch]@4 16740 char v10;
16958 const char *v11; // [sp-8h] [bp-1Ch]@4 16741 //std::string v10; // [sp-18h] [bp-2Ch]@4
16742 int v11;
16743 //const char *v11; // [sp-8h] [bp-1Ch]@4
16959 int v12; // [sp-4h] [bp-18h]@4 16744 int v12; // [sp-4h] [bp-18h]@4
16960 std::string *v13; // [sp+Ch] [bp-8h]@4 16745 int v13;
16746 char *v14;
16747 //std::string *v13; // [sp+Ch] [bp-8h]@4
16961 int a3; // [sp+13h] [bp-1h]@4 16748 int a3; // [sp+13h] [bp-1h]@4
16962 16749 int i;
16963 v1 = npcid; 16750
16751 /*v1 = npcid;
16964 if ( (npcid & 0x80000000u) == 0 ) 16752 if ( (npcid & 0x80000000u) == 0 )
16965 { 16753 {
16966 if ( (signed int)npcid < 5000 ) 16754 if ( (signed int)npcid < 5000 )
16967 { 16755 {
16968 if ( (signed int)npcid >= 501 ) 16756 if ( (signed int)npcid >= 501 )
17013 if ( (unsigned __int8)v9 >= 2u ) 16801 if ( (unsigned __int8)v9 >= 2u )
17014 result = &pNPCStats->pNPCData[(unsigned __int8)v9 + 499]; 16802 result = &pNPCStats->pNPCData[(unsigned __int8)v9 + 499];
17015 else 16803 else
17016 result = &pParty->pHirelings[(unsigned __int8)v9]; 16804 result = &pParty->pHirelings[(unsigned __int8)v9];
17017 } 16805 }
17018 return result; 16806 return result;*/
16807 v1 = npcid;
16808 if ( npcid >= 0 )
16809 {
16810 if ( npcid < 5000 )
16811 {
16812 if ( npcid >= 501 )
16813 {
16814 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
16815 }
16816 return &pNPCStats->pNewNPCData[v1];// - 1];
16817 }
16818 return &pNPCStats->array_13EF4[npcid - 5000];
16819 }
16820
16821
16822 if ( npcid >= 5000 )
16823 return &pNPCStats->array_13EF4[npcid - 5000];
16824 if (uDialogue_SpeakingActorNPC_ID >= 0)
16825 {
16826 result = 0;
16827 }
16828 else
16829 {
16830 v3 = uDialogue_SpeakingActorNPC_ID - 1;
16831 v4 = 0;
16832
16833 for (i = 0; i < 4; ++i)
16834 {
16835 if (pParty->pHirelings[i].pName)
16836 pTmpBuf[v4++] = i;
16837 }
16838
16839 if (pNPCStats->uNumNewNPCs > 0)
16840 {
16841 for (i = 0; i < pNPCStats->uNumNewNPCs; ++i)
16842 {
16843 if (pNPCStats->pNewNPCData[i].uFlags & 0x80)
16844 {
16845 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
16846 {
16847 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
16848 pTmpBuf[v4++] = i + 2;
16849 }
16850 }
16851 }
16852 }
16853
16854 v9 = pTmpBuf[v3];
16855 if ( v9 >= 2 )
16856 result = &pNPCStats->pNPCData[499 + v9];
16857 else
16858 result = &pParty->pHirelings[v9];
16859 }
17019 } 16860 }
17020 16861
17021 //----- (00445B2C) -------------------------------------------------------- 16862 //----- (00445B2C) --------------------------------------------------------
17022 NPCData *__fastcall GetNewNPCData(signed int npcid, int a2) 16863 NPCData *__fastcall GetNewNPCData(signed int npcid, int a2)
17023 { 16864 {
18078 v114 = _evt->v6; 17919 v114 = _evt->v6;
18079 v57 = rand() % 4; 17920 v57 = rand() % 4;
18080 LABEL_119: 17921 LABEL_119:
18081 v56 = &pParty->pPlayers[v57]; 17922 v56 = &pParty->pPlayers[v57];
18082 LABEL_120: 17923 LABEL_120:
18083 v56->PlaySound(v114, v118); 17924 v56->PlaySound((PlayerSpeech)v114, v118);
18084 ++v122; 17925 ++v122;
18085 //v4 = v124; 17926 //v4 = v124;
18086 //v5 = pSomeEVT; 17927 //v5 = pSomeEVT;
18087 //v6 = v123; 17928 //v6 = v123;
18088 //v7 = ""; 17929 //v7 = "";
18089 break; 17930 break;
18090 } 17931 }
18091 v55 = pParty->pPlayers; 17932 v55 = pParty->pPlayers;
18092 do 17933 for (int iii = 0; iii < 4; ++iii)
18093 { 17934 {
18094 v55->PlaySound(_evt->v6, 0); 17935 v55->PlaySound((PlayerSpeech)_evt->v6, 0);
18095 ++v55; 17936 ++v55;
18096 } 17937 }
18097 while ( (signed int)v55 < (signed int)pParty->pHirelings ); 17938 //while ( (signed int)v55 < (signed int)pParty->pHirelings );
18098 ++v122; 17939 ++v122;
18099 //v4 = v124; 17940 //v4 = v124;
18100 //v5 = pSomeEVT; 17941 //v5 = pSomeEVT;
18101 //v6 = v123; 17942 //v6 = v123;
18102 //v7 = ""; 17943 //v7 = "";