annotate NPC.cpp @ 1982:2647e2f820a6

Слияние
author Ritor1
date Fri, 01 Nov 2013 14:44:06 +0600
parents a86c60679949
children 03d9336e862f
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
3 #endif
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
4
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
5 #include "texts.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
6 #include "LOD.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
7 #include "Autonotes.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
8 #include "Awards.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
9 #include "mm7_data.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
10 #include "MM7.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 949
diff changeset
11 #include "Party.h"
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
12 #include "NPC.h"
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
13 #include "GUIWindow.h"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
14 #include "VideoPlayer.h"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
15 #include "Events.h"
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1295
diff changeset
16 #include "UI\UIHouses.h"
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
17 #include "Indoor.h"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
18 #include "MapInfo.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1793
diff changeset
19 #include "Level/Decoration.h"
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
20
629
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
21 int pDialogueNPCCount;
1206
ab6560001f5b arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents: 1165
diff changeset
22 std::array<struct Texture *, 6> pDialogueNPCPortraits;
629
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
23 int uNumDialogueNPCPortraits; // weak
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
24 struct NPCStats *pNPCStats = nullptr;
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
25
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
26 void InitializeAwards();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
27 void InitializeScrolls();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
28 void InitializeMerchants();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
29 void InitializeTransitions();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
30 void InitializeAutonotes();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
31 void InitializeQuests();
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
32 bool CheckPortretAgainstSex(int portret_num, int sex);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
33
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
34 //----- (004459F9) --------------------------------------------------------
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
35 NPCData *__fastcall GetNPCData(signed int npcid)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
36 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
37 unsigned int v1; // esi@1
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
38 NPCData *result; // eax@5
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
39 int v3; // esi@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
40 int v4; // ecx@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
41 //int v5; // edx@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
42 //NPCData *v6; // eax@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
43 char *v7; // ebx@14
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
44 NPCData *v8; // edi@14
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
45 char v9; // al@22
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
46 char v10;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
47 //std::string v10; // [sp-18h] [bp-2Ch]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
48 int v11;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
49 //const char *v11; // [sp-8h] [bp-1Ch]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
50 int v12; // [sp-4h] [bp-18h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
51 int v13;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
52 char *v14;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
53 //std::string *v13; // [sp+Ch] [bp-8h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
54 int a3; // [sp+13h] [bp-1h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
55 int i;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
56
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
57 /*v1 = npcid;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
58 if ( (npcid & 0x80000000u) == 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
59 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
60 if ( (signed int)npcid < 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
61 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
62 if ( (signed int)npcid >= 501 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
63 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
64 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
65 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
66 return &pNPCStats->pNewNPCData[v1];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
67 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
68 return &pNPCStats->array_13EF4[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
69 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
70 if ( (signed int)npcid >= 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
71 return &pNPCStats->array_13EF4[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
72 if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
73 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
74 result = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
75 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
76 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
77 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
78 v3 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
79 v4 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
80 v5 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
81 v6 = pParty->pHirelings;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
82 do
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
83 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
84 if ( v6->pName )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
85 pTmpBuf[v4++] = v5;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
86 ++v6;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
87 ++v5;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
88 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
89 while ( (signed int)v6 < (signed int)&pParty->pPickedItem );
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
90 v13 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
91 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
92 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
93 v7 = &pTmpBuf[v4];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
94 v8 = pNPCStats->pNewNPCData;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
95 do
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
96 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
97 if ( v8->uFlags & 0x80
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
98 && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName))
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
99 && (!pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName)) )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
100 *v7++ = (char)v13 + 2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
101 v13 = (std::string *)((char *)v13 + 1);
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
102 ++v8;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
103 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
104 while ( (signed int)v13 < (signed int)pNPCStats->uNumNewNPCs );
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
105 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
106 v9 = pTmpBuf[v3];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
107 if ( (unsigned __int8)v9 >= 2u )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
108 result = &pNPCStats->pNPCData[(unsigned __int8)v9 + 499];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
109 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
110 result = &pParty->pHirelings[(unsigned __int8)v9];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
111 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
112 return result;*/
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
113 v1 = npcid;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
114 if ( npcid >= 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
115 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
116 if ( npcid < 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
117 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
118 if ( npcid >= 501 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
119 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
120 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
121 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
122 return &pNPCStats->pNewNPCData[v1];// - 1];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
123 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
124 return &pNPCStats->pAdditionalNPC[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
125 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
126
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
127
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
128 if ( npcid >= 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
129 return &pNPCStats->pAdditionalNPC[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
130 if (sDialogue_SpeakingActorNPC_ID >= 0)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
131 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
132 result = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
133 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
134 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
135 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
136 v3 = abs(sDialogue_SpeakingActorNPC_ID) - 1;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
137 v4 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
138
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
139 for (i = 0; i < 2; ++i)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
140 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
141 if (pParty->pHirelings[i].pName)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
142 pTmpBuf[v4++] = i;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
143 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
144
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
145 if (pNPCStats->uNumNewNPCs > 0)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
146 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
147 for (i = 0; i < pNPCStats->uNumNewNPCs; ++i)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
148 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
149 if (pNPCStats->pNewNPCData[i].Hired())
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
150 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
151 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
152 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
153 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
154 pTmpBuf[v4++] = i + 2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
155 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
156 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
157 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
158 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
159
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
160 v9 = pTmpBuf[v3];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
161 if ( v9 >= 2 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
162 result = &pNPCStats->pNPCData[499 + v9];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
163 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
164 result = &pParty->pHirelings[v9];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
165 }
1099
94aff285558e Right click NPC fix
Grumpy7
parents: 1094
diff changeset
166 return result;
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
167 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
168
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
169 //----- (00445B2C) --------------------------------------------------------
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
170 struct NPCData * GetNewNPCData( signed int npcid, int* npc_indx )
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
171 {
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
172
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
173 int* v3; // edi@1
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
174 NPCData *result; // eax@5
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
175 int v5; // esi@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
176 int v6; // ecx@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
177 char v11; // al@23
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
178
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
179 v3 = npc_indx;
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
180 if ( npcid >= 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
181 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
182 if ( npcid < 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
183 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
184 if ( npcid >= 501 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
185 {
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
186 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:2040", 0);
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
187 }
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
188 *v3 = npcid;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
189 return &pNPCStats->pNewNPCData[npcid];
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
190 }
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
191 *npc_indx = npcid - 5000;
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
192 return &pNPCStats->pAdditionalNPC[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
193 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
194 if ( npcid >= 5000 )
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
195 {
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
196 *npc_indx = npcid - 5000;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
197 return &pNPCStats->pAdditionalNPC[npcid - 5000];
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
198 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
199 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
200 {
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
201 *npc_indx = 0;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
202 result = NULL;
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
203 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
204 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
205 {
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
206 v5 = abs(sDialogue_SpeakingActorNPC_ID) - 1;
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
207 v6 = 0;
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
208 for (int i=0; i<2; ++i)
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
209 {
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
210 if ( pParty->pHirelings[i].pName )
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
211 pTmpBuf[v6++] = i;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
212
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
213 }
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
214 for (int i=0; i< pNPCStats->uNumNewNPCs; ++i)
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
215 {
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
216 if ( pNPCStats->pNewNPCData[i].Hired()
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
217 && (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName))
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
218 && (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName)) )
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
219 {
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
220 pTmpBuf[v6++]=i+2;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
221 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
222 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
223 v11 = pTmpBuf[v5];
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
224
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
225 if ( v11 >= 2u )
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
226 {
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
227 *v3 = v11 - 2;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
228 result = &pNPCStats->pNewNPCData[v11 - 2];
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
229 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
230 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
231 {
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
232 *v3 = v11;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
233 result = &pParty->pHirelings[v11];
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
234 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
235 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
236 return result;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
237 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
238
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
239 //----- (00476977) --------------------------------------------------------
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
240 void NPCStats::InitializeNPCText()
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
241 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
242 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
243 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
244 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
245 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
246 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
247 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
248 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
249
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
250 if (pNPCTextTXT_Raw)
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
251 free(pNPCTextTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
252 pNPCTextTXT_Raw =NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
253 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
254 strtok(pNPCTextTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
255
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
256 for (i=0; i<789; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
257 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
258 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
259 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
260 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
261 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
262 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
263 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
264 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
265 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
266 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
267 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
268 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
269 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
270 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
271 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
272 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
273 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
274 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
275 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
276 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
277 pNPCTopics[i].pText =RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
278 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
279 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
280 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
281 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
282 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
283 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
284 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
285 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
286 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
287
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
288 if (pNPCTopicTXT_Raw)
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
289 free(pNPCTopicTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
290 pNPCTopicTXT_Raw =NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
291 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
292 strtok(pNPCTopicTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
293
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1653
diff changeset
294 for ( i = 1; i <= 579; ++i )//NPC topics count limit
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
295 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
296 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
297 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
298 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
299 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
300 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
301 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
302 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
303 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
304 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
305 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
306 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
307 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
308 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
309 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
310 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
311 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
312 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
313 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
314 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
315 pNPCTopics[i].pTopic = RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
316 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
317 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
318 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
319 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
320 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
321 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
322 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
323 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
324 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
325
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
326 if (pNPCDistTXT_Raw)
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
327 free(pNPCDistTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
328 pNPCDistTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
329 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
330 strtok(pNPCDistTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
331 strtok(NULL, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
332
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
333 for (i=1; i<59; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
334 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
335 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
336 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
337 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
338 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
339 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
340 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
341 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
342 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
343 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
344 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
345 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
346 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
347 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
348 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
349 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
350 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
351 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
352 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
353 if ((decode_step>0)&&(decode_step<77))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
354 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
355 pProfessionChance[decode_step].professionChancePerArea[i]=atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
356 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
357 else if (decode_step==0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
358 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
359 pProfessionChance[0].professionChancePerArea[i]=10;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
360 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
361 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
362 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
363 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
364 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
365 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
366 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
367 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
368 } while ((decode_step<78)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
369 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
370
825
Ritor1
parents: 781
diff changeset
371 for ( i = 0; i < 77; ++i )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
372 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
373 pProfessionChance[i].uTotalprofChance=0;
825
Ritor1
parents: 781
diff changeset
374 for ( int ii = 1; ii < 59; ++ii )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
375 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
376 pProfessionChance[i].uTotalprofChance+=pProfessionChance[i].professionChancePerArea[ii];
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
377 }
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
378 pProfessionChance[i].professionChancePerArea[0]=0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
379 pProfessionChance[i].professionChancePerArea[59]=0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
380 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
381
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
382 if (pNPCDistTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
383 {
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
384 free(pNPCDistTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
385 pNPCDistTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
386 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
387 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
388
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
389 //----- (00476C60) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
390 void NPCStats::_476C60()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
391 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
392 for (unsigned int i = 1; i < uNumNewNPCs; ++i)
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
393 pNewNPCData[i].pName = pNPCUnicNames[i - 1];
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
394
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
395 if (pParty->pHirelings[0].pName)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
396 pParty->pHirelings[0].pName = pParty->pHireling1Name;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
397 if (pParty->pHirelings[1].pName)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
398 pParty->pHirelings[1].pName = pParty->pHireling2Name;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
399 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
400
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
401 //----- (00476CB5) --------------------------------------------------------
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
402 void NPCStats::InitializeNPCData()
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
403 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
404 int i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
405 char* test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
406 unsigned char c;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
407 bool break_loop;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
408 unsigned int temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
409 char* tmp_pos;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
410 int decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
411
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
412 pNPCDataTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdata.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
413 strtok(pNPCDataTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
414 strtok(NULL, "\r");
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
415
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
416 for (i=0; i<500; ++i)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
417 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
418 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
419 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
420 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
421 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
422 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
423 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
424 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
425 while((c!='\t')&&(c>0))
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
426 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
427 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
428 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
429 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
430 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
431 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
432 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
433 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
434 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
435 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
436 switch (decode_step)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
437 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
438 case 1:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
439 pNPCUnicNames[i] = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
440 pNPCData[i+1].pName=pNPCUnicNames[i];
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
441 break;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
442 case 2:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
443 pNPCData[i+1].uPortraitID = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
444 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
445 case 6:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
446 pNPCData[i+1].Location2D = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
447 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
448 case 7:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
449 pNPCData[i+1].uProfession = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
450 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
451 case 8:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
452 pNPCData[i+1].greet = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
453 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
454 case 9:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
455 pNPCData[i+1].joins = (*test_string == 'y')?1:0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
456 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
457 case 10:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
458 pNPCData[i+1].evt_A = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
459 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
460 case 11:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
461 pNPCData[i+1].evt_B = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
462 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
463 case 12:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
464 pNPCData[i+1].evt_C = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
465 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
466 case 13:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
467 pNPCData[i+1].evt_D = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
468 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
469 case 14:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
470 pNPCData[i+1].evt_E = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
471 break;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
472 case 15:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
473 pNPCData[i+1].evt_F = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
474 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
475 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
476 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
477 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
478 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
479 } while ((decode_step<16)&&!break_loop);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
480 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
481 uNumNewNPCs = 501;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
482 pNPCGreetTXT_Raw = (char*)pEvents_LOD->LoadRaw("npcgreet.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
483 strtok(pNPCGreetTXT_Raw, "\r");
1653
d453ed393d6e NPCGreetings
Ritor1
parents: 1590
diff changeset
484 for ( i = 1; i <= 205; ++i )
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
485 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
486 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
487 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
488 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
489 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
490 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
491 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
492 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
493 while((c!='\t')&&(c>0))
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
494 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
495 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
496 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
497 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
498 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
499 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
500 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
501 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
502 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
503 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
504 switch (decode_step)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
505 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
506 case 1:
1655
a7eebb6ee7a2 Window Resize (change arguments to MM7_Initialize)
Nomad
parents: 1653
diff changeset
507 pNPCGreetings[i].pGreetings[0] = RemoveQuotes(test_string);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
508 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
509 case 2:
1655
a7eebb6ee7a2 Window Resize (change arguments to MM7_Initialize)
Nomad
parents: 1653
diff changeset
510 pNPCGreetings[i].pGreetings[1] = RemoveQuotes(test_string);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
511 break;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
512 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
513 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
514 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
515 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
516 } while ((decode_step<3)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
517 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
518
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
519 pNCPGroupTXT_Raw = (char*)pEvents_LOD->LoadRaw("npcgroup.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
520 strtok(pNCPGroupTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
521
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
522 for (i=0; i<51; ++i)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
523 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
524 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
525 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
526 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
527 do
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
528 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
529 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
530 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
531 while((c!='\t')&&(c>0))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
532 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
533 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
534 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
535 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
536 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
537 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
538 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
539 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
540 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
541 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
542 if (decode_step==1)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
543 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
544 pGroups[i] = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
545 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
546 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
547 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
548 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
549 } while ((decode_step<2)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
550 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
551
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
552 pNPCNewsTXT_Raw = (char*)pEvents_LOD->LoadRaw("npcnews.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
553 strtok(pNPCNewsTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
554
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
555
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
556 for (i=0; i<51; ++i)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
557 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
558 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
559 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
560 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
561 do
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
562 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
563 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
564 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
565 while((c!='\t')&&(c>0))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
566 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
567 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
568 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
569 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
570 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
571 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
572 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
573 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
574 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
575 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
576 if (decode_step==1)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
577 pCatchPhrases[i] = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
578 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
579 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
580 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
581 } while ((decode_step<2)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
582 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
583 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
584
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
585 //----- (0047702F) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
586 void NPCStats::Initialize()
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
587 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
588 int i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
589 char* test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
590 unsigned char c;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
591 bool break_loop;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
592 unsigned int temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
593 char* tmp_pos;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
594 int decode_step;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
595
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
596 InitializeNPCData();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
597 InitializeNPCText();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
598 InitializeQuests();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
599 InitializeAutonotes();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
600 InitializeAwards();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
601 InitializeTransitions();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
602 InitializeMerchants();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
603 InitializeScrolls();
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
604
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
605 pNPCNamesTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
606 pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
607 strtok(pNPCNamesTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
608
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
609 uNewlNPCBufPos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
610
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
611 for (i=0; i<540; ++i)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
612 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
613 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
614 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
615 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
616 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
617 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
618 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
619 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
620 if (c=='\t')
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
621 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
622 if ( (decode_step == 1)&&(!uNumNPCNames[1]))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
623 uNumNPCNames[1]=i;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
624 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
625 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
626 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
627 while((c!='\n')&&(c!='\t')&&(c>0))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
628 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
629 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
630 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
631 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
632 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
633 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
634 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
635
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
636 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
637 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
638 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
639 if ( decode_step == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
640 pNPCNames[i][0] =RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
641 else if ( decode_step == 1)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
642 pNPCNames[i][1] =RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
643 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
644 else
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
645 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
646 if ( (decode_step == 1)&&(!uNumNPCNames[1]))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
647 uNumNPCNames[1]=i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
648 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
649 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
650 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
651 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
652 } while ((decode_step<2)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
653 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
654 uNumNPCNames[0] = i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
655
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
656 pNPCProfTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
657 pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
658 strtok(pNPCProfTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
659 strtok(NULL, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
660 strtok(NULL, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
661 strtok(NULL, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
662
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
663 for (i=1; i<59; ++i)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
664 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
665 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
666 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
667 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
668 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
669 {
667
8c6c41037c39 profession NPC dialogue fixed
zipi
parents: 659
diff changeset
670 //while (*test_string == '\t') // some steps are separated by multiple \t's
8c6c41037c39 profession NPC dialogue fixed
zipi
parents: 659
diff changeset
671 //++test_string;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
672
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
673 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
674 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
675 while((c!='\t')&&(c>0))
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
676 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
677 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
678 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
679 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
680 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
681 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
682 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
683 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
684 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
685 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
686 switch(decode_step)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
687 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
688 case 2:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
689 pProfessions[i].uHirePrice = atoi(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
690 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
691 case 3:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
692 pProfessions[i].pActionText = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
693 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
694 case 4:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
695 pProfessions[i].pBenefits= RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
696 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
697 case 5:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
698 pProfessions[i].pJoinText = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
699 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
700 case 6:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
701 pProfessions[i].pDismissText = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
702 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
703 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
704 else
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
705 {
667
8c6c41037c39 profession NPC dialogue fixed
zipi
parents: 659
diff changeset
706 if (!decode_step)
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
707 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
708 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
709 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
710 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
711 } while ((decode_step<7)&&!break_loop);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
712 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
713 uNumNPCProfessions = 59;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
714 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
715
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
716 //----- (00477266) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
717 void NPCStats::Release()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
718 {
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
719 free(pNPCTopicTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
720 pNPCTopicTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
721 free(pNPCTextTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
722 pNPCTextTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
723 free(pNPCNewsTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
724 pNPCNewsTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
725 free(pNPCProfTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
726 pNPCProfTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
727 free(pNPCNamesTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
728 pNPCNamesTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
729 free(pNPCDataTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
730 pNPCDataTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
731 free(pNPCDistTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
732 pNPCDistTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
733 free(pNPCGreetTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
734 pNPCGreetTXT_Raw = NULL;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
735 free(pNCPGroupTXT_Raw);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
736 pNCPGroupTXT_Raw = NULL;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
737 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
738
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
739 //----- (0047730C) --------------------------------------------------------
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
740 bool CheckPortretAgainstSex(int a1, int)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
741 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
742 return true;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
743 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
744 // 47730C: using guessed type int __stdcall const_1(int);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
745
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
746 //----- (0047732C) --------------------------------------------------------
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
747 void NPCStats::InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
748 {
292
5586bb4e8395 build fix
Gloval
parents: 291
diff changeset
749 int rep_gen;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
750 int uNPCSex; // esi@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
751 int uGeneratedPortret; // ecx@23
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
752 int test_prof_summ; // ecx@37
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
753 int gen_profession; // eax@37
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
754 int max_prof_cap; // edx@37
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
755 signed int result; // eax@39
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
756 int uRace; // [sp+Ch] [bp-Ch]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
757 bool break_gen; // [sp+10h] [bp-8h]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
758 signed int gen_attempts; // [sp+14h] [bp-4h]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
759 int uPortretMin; // [sp+24h] [bp+Ch]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
760 int uPortretMax;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
761
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
762 static const unsigned __int8 NPCSexGenTable[86] ={
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
764 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
765 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
766 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
767 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 };
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
768 static const unsigned __int8 NPCRaceGenTable[86] ={
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
769 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
770 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
771 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
772 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
773 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0};
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
774
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
775 unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1)/3.0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
776 uNPCSex = NPCSexGenTable[seed];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
777 uRace = NPCRaceGenTable[seed];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
778 pNPCDataBuff->uSex = uNPCSex;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
779 pNPCDataBuff->pName = pNPCNames[rand() % uNumNPCNames[uNPCSex]][uNPCSex];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
780
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
781 gen_attempts = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
782 break_gen = false;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
783
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
784 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
785 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
786 switch ( uRace )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
787 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
788 case 0:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
789 if ( uNPCSex == 0 )
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
790 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
791 uPortretMin = 2;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
792 uPortretMax = 100;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
793 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
794 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
795 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
796 uPortretMin = 201;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
797 uPortretMax = 250;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
798 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
799 case 1:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
800 if ( uNPCSex == 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
801 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
802 uPortretMin = 400;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
803 uPortretMax = 430;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
804 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
805 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
806 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
807 uPortretMin = 460;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
808 uPortretMax = 490;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
809 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
810 break;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
811 case 2:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
812 if ( uNPCSex == 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
813 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
814 uPortretMin = 500;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
815 uPortretMax = 520;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
816 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
817 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
818 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
819 uPortretMin = 530;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
820 uPortretMax = 550;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
821 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
822 break;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
823 case 3:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
824 if ( uNPCSex == 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
825 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
826 uPortretMin = 300;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
827 uPortretMax = 330;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
828 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
829 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
830 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
831 uPortretMin = 360;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
832 uPortretMax = 387;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
833 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
834
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
835 break;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
836 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
837
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
838 uGeneratedPortret = uPortretMin + rand() % (uPortretMax - uPortretMin + 1);
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
839 if ( CheckPortretAgainstSex(uGeneratedPortret, uNPCSex))
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
840 break_gen = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
841 ++gen_attempts;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
842 if ( gen_attempts >= 4 )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
843 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
844 uGeneratedPortret = uPortretMin;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
845 break_gen = true;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
846 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
847 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
848 while(!break_gen);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
849
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
850 pNPCDataBuff->uPortraitID = uGeneratedPortret;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
851 pNPCDataBuff->uFlags = 0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
852 pNPCDataBuff->fame = 0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
853 //generate reputation
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
854 rep_gen = rand() % 100 + 1;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
855
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
856 if ( rep_gen >= 60 )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
857 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
858 if ( rep_gen >= 90 )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
859 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
860 if ( rep_gen >= 95 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
861 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
862 if ( rep_gen >= 98 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
863 pNPCDataBuff->rep = -600;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
864 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
865 pNPCDataBuff->rep = 400;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
866 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
867 else
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
868 pNPCDataBuff->rep = -300;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
869 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
870 else
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
871 pNPCDataBuff->rep = 200;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
872 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
873 else
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
874 pNPCDataBuff->rep = 0;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
875
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
876 max_prof_cap = rand() % pProfessionChance[uMapId].uTotalprofChance+1;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
877 test_prof_summ = 0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
878 gen_profession = 0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
879
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
880 if ( max_prof_cap > 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
881 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
882 do
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
883 test_prof_summ += pProfessionChance[uMapId].professionChancePerArea[gen_profession++];
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
884 while ( test_prof_summ < max_prof_cap );
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
885 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
886 pNPCDataBuff->uProfession = gen_profession - 1;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
887 pNPCDataBuff->Location2D = uLocation2D;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
888 pNPCDataBuff->field_24 = 1;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
889 pNPCDataBuff->joins = 1;
659
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
890 pNPCDataBuff->evt_A = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
891 pNPCDataBuff->evt_B = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
892 pNPCDataBuff->evt_C = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
893 pNPCDataBuff->evt_D = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
894 pNPCDataBuff->evt_E = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
895 pNPCDataBuff->evt_F = 0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
896 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
897
257
Nomad
parents: 253
diff changeset
898 //----- (00476387) --------------------------------------------------------
Nomad
parents: 253
diff changeset
899 bool PartyHasDragon()
Nomad
parents: 253
diff changeset
900 {
Nomad
parents: 253
diff changeset
901 return pNPCStats->pNewNPCData[57].Hired();
Nomad
parents: 253
diff changeset
902 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
903
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
904 //----- (00476395) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
905 //0x26 Wizard eye at skill level 2
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1411
diff changeset
906 bool CheckHiredNPCSpeciality(unsigned int uProfession)
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
907 {
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
908
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
909 if ( bNoNPCHiring == 1 )
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
910 return 0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
911
1094
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
912 for (int i=0; i<pNPCStats->uNumNewNPCs; ++i )
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
913 {
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
914 if ( pNPCStats->pNewNPCData[i].uProfession == uProfession &&
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
915 (pNPCStats->pNewNPCData[i].uFlags & 0x80) )
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
916 return true;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
917 }
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
918 if ( pParty->pHirelings[0].uProfession == uProfession ||
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
919 pParty->pHirelings[1].uProfession == uProfession)
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
920 return true;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
921 else
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
922 return false;
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
923
c40d40027b77 npc some clean
Gloval
parents: 1016
diff changeset
924 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
925 // 6BE3C5: using guessed type char bNoNPCHiring;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
926
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
927 //----- (004763E0) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
928 void InitializeAwards()
949
Nomad
parents: 825
diff changeset
929 {
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
930 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
931 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
932 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
933 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
934 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
935 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
936 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
937
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
938 if ( pAwardsTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
939 free(pAwardsTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
940 pAwardsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
941 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
942 strtok(pAwardsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
943
949
Nomad
parents: 825
diff changeset
944 for (i=1; i<105; ++i)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
945 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
946 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
947 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
948 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
949 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
950 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
951 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
952 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
953 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
954 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
955 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
956 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
957 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
958 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
959 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
960 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
961 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
962 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
963 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
964 if (decode_step==1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
965 pAwards[i].pText=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
966 else if (decode_step==2)
949
Nomad
parents: 825
diff changeset
967 pAwards[i].uPriority = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
968 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
969 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
970 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
971 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
972 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
973 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
974 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
975 } while ((decode_step<3)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
976 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
977 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
978 // 7241C8: using guessed type int dword_7241C8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
979
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
980 //----- (004764C2) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
981 void InitializeScrolls()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
982 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
983
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
984 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
985 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
986 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
987 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
988 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
989 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
990 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
991
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
992 if ( pScrollsTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
993 free(pScrollsTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
994 pScrollsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
995 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
996 strtok(pScrollsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
997 for (i=0; i<82; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
998 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
999 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1000 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1001 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1002 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1003 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1004 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1005 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1006 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1007 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1008 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1009 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1010 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1011 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1012 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1013 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1014 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1015 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1016 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1017 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1018 pScrolls[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1019 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1020 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1021 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1022 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1023 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1024 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1025 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1026 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1027 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1028 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1029
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1030 //----- (00476590) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1031 void InitializeMerchants()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1032 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1033 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1034 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1035 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1036 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1037 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1038 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1039 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1040
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1041 if ( pMerchantsTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
1042 free(pMerchantsTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1043 pMerchantsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1044 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1045 strtok(pMerchantsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1046
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1047 for (i=0; i<7; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1048 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1049 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1050 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1051 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1052 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1053 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1054 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1055 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1056 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1057 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1058 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1059 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1060 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1061 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1062 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1063 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1064 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1065 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1066 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1067 switch (decode_step)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1068 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1069 case 1:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1070 pMerchantsBuyPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1071 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1072 case 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1073 pMerchantsSellPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1074 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1075 case 3:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1076 pMerchantsRepairPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1077 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1078 case 4:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1079 pMerchantsIdentifyPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1080 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1081 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1082 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1083 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1084 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1085 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1086 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1087 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1088 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1089 } while ((decode_step<5)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1090 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1091
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1092 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1093
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1094 //----- (00476682) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1095 void InitializeTransitions()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1096 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1097 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1098 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1099 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1100 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1101 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1102 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1103 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1104
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1105 if ( pTransitionsTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
1106 free(pTransitionsTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1107 pTransitionsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1108 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1109 strtok(pTransitionsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1110
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1111 for (i=0; i<464; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1112 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1113 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1114 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1115 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1116 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1117 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1118 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1119 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1120 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1121 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1122 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1123 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1124 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1125 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1126 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1127 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1128 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1129 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1130 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1131 if ( decode_step == 1)
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 353
diff changeset
1132 pTransitionStrings[i + 1]=RemoveQuotes(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1133 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1134 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1135 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1136 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1137 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1138 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1139 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1140 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1141 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1142 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1143
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1144 //----- (00476750) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1411
diff changeset
1145 void InitializeAutonotes()
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1146 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1147 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1148 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1149 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1150 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1151 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1152 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1153 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1154
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1155 if ( pAutonoteTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
1156 free(pAutonoteTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1157 pAutonoteTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1158 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1159 strtok(pAutonoteTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1160
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1161 for (i=0; i<195; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1162 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1163 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1164 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1165 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1166 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1167 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1168 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1169 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1170 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1171 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1172 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1173 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1174 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1175 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1176 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1177 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1178 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1179 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1180 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1181 switch (decode_step)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1182 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1183 case 1:
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1184 pAutonoteTxt[i+1].pText=RemoveQuotes(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1185 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1186 case 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1187 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1099
diff changeset
1188 if ( !_stricmp(test_string, "potion"))
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1189 {
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1190 pAutonoteTxt[i+1].eType = AUTONOTE_POTION_RECEPIE;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1191 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1192 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1099
diff changeset
1193 if ( !_stricmp(test_string, "stat") )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1194 {
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1195 pAutonoteTxt[i+1].eType = AUTONOTE_STAT_HINT;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1196 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1197 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1099
diff changeset
1198 if ( !_stricmp(test_string, "seer") )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1199 {
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1200 pAutonoteTxt[i+1].eType = AUTONOTE_SEER;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1201 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1202 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1099
diff changeset
1203 if ( !_stricmp(test_string, "obelisk") )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1204 {
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1205 pAutonoteTxt[i+1].eType = AUTONOTE_OBELISK;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1206 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1207 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1099
diff changeset
1208 if ( !_stricmp(test_string, "teacher") )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1209 {
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1210 pAutonoteTxt[i+1].eType = AUTONOTE_TEACHER;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1211 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1212 }
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1213 pAutonoteTxt[i+1].eType =AUTONOTE_MISC;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1214 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1215 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1216 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1217 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1218 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1219 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1220 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1221 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1222 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1223 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1224 } while ((decode_step<3)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1225 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1226 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1227
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1228
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1229 //----- (004768A9) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1411
diff changeset
1230 void InitializeQuests()
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1231 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1232 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1233 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1234 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1235 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1236 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1237 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1238 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1239
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1240 if ( pQuestsTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1529
diff changeset
1241 free(pQuestsTXT_Raw);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1242 pQuestsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1243 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1244 strtok(pQuestsTXT_Raw, "\r");
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1245 memset(pQuestTable.data(),0, sizeof(pQuestTable));
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1246 for (i=0; i<512; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1247 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1248 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1249 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1250 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1251 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1252 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1253 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1254 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1255 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1256 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1257 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1258 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1259 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1260 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1261 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1262 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1263 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1264 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1265 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1266 if ( decode_step == 1)
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
1267 pQuestTable[i+1] =RemoveQuotes(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1268 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1269 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1270 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1271 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1272 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1273 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1274 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1275 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1276 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1277 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1278
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1279 //----- (004B2001) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1280 void __fastcall ClickNPCTopic(signed int uMessageParam)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1281 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1282 //signed int v1; // eax@1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1283 NPCData *pCurrentNPCInfo; // ebp@1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1284 int pEventNumber; // ecx@8
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1285 Player *v4; // esi@20
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1286 //int v5; // eax@28
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1287 //int v6; // eax@31
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1288 //int v7; // eax@34
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1289 //int v8; // eax@37
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1290 //int v9; // eax@40
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1291 //unsigned int v10; // eax@43
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1292 char *v12; // eax@53
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1293 char *v13; // eax@56
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1294 char *v14; // eax@57
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1295 char *v15; // eax@58
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1296 //unsigned int v16; // ebp@62
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1297 char *v17; // ecx@63
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1298 char *v18; // eax@65
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1299 const char *v19; // ecx@68
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1300 //unsigned int v20; // eax@69
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1301 signed int pPrice; // ecx@70
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1302 char *v22; // [sp-Ch] [bp-18h]@73
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1303 //int v23; // [sp-8h] [bp-14h]@49
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1304 char *v24; // [sp-8h] [bp-14h]@73
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1305 //int v25; // [sp-4h] [bp-10h]@49
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1306
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1307 uDialogueType = uMessageParam + 1;
1313
ae6c8e1ddef4 fix enter house error
Gloval
parents: 1310
diff changeset
1308 pCurrentNPCInfo = HouseNPCData[pDialogueNPCCount -((dword_591080 != 0)?1:0 )];//- 1
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1309 if ( uMessageParam <= 24 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1310 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1311 switch ( uMessageParam )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1312 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1313 case 13:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1314 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1828
diff changeset
1315 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1316 NPCHireableDialogPrepare();
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1317 dialogue_show_profession_details = false;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1318 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1319 case 19:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1320 pEventNumber = pCurrentNPCInfo->evt_A;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1321 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1322 case 20:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1323 pEventNumber = pCurrentNPCInfo->evt_B;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1324 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1325 case 21:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1326 pEventNumber = pCurrentNPCInfo->evt_C;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1327 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1328 case 22:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1329 pEventNumber = pCurrentNPCInfo->evt_D;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1330 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1331 case 23:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1332 pEventNumber = pCurrentNPCInfo->evt_E;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1333 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1334 case 24:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1335 pEventNumber = pCurrentNPCInfo->evt_F;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1336 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1337 default:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1338 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1339 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1340 /*switch ( pEventNumber )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1341 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1342 case 139:
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
1343 OracleDialogue();
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1344 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1345 case 311:
1529
61458df2cb4f bountyHunting fix
Ritor1
parents: 1461
diff changeset
1346 CheckBountyRespawnAndAward();
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1347 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1348 }*/
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1349 if ( pEventNumber < 200 || pEventNumber > 310 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1350 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1351 if ( pEventNumber < 400 || pEventNumber > 410 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1352 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1353 if ( pEventNumber == 139 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1354 {
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
1355 OracleDialogue();
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1356 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1357 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1358 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1359 if ( pEventNumber == 311 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1360 {
1529
61458df2cb4f bountyHunting fix
Ritor1
parents: 1461
diff changeset
1361 CheckBountyRespawnAndAward();
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1362 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1363 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1364 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1365 current_npc_text = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1366 activeLevelDecoration = (LevelDecoration*)1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1367 EventProcessor(pEventNumber, 0, 1);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1368 activeLevelDecoration = NULL;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1369 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1370 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1371 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1372 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1373 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1374 dword_F8B1D8 = uMessageParam;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1375 DrawJoinGuildWindow(pEventNumber - 400);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1376 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1377 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1378 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1379 {
1582
d3d539924e5e _4B3FE5_training_dialogue
Ritor1
parents: 1529
diff changeset
1380 _4B3FE5_training_dialogue(pEventNumber);
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1381 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1382 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1383 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1384 if ( uMessageParam != 76 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1385 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1386 if ( uMessageParam == 77 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1387 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1388 //v16 = pCurrentNPCInfo->uProfession;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1389 if (dialogue_show_profession_details)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1390 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1391 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1392 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1393 current_npc_text = v17;
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1313
diff changeset
1394 v18 = BuildDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1395 dialogue_show_profession_details = ~dialogue_show_profession_details;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1396 current_npc_text = v18;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1397 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1398 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1399 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1400 if ( uMessageParam == 79 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1401 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1402 if ( contract_approved )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1403 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1404 Party::TakeGold(gold_transaction_amount);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1405 if ( uActiveCharacter )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1406 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1407 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1408 *(short *)v12 &= 0x3Fu;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1409 switch ( dword_F8B1B0 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1410 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1411 case 2:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1412 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1413 *v15 |= 0x40u;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1414 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1415 case 3:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1416 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1417 *v14 |= 0x80u;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1418 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1419 case 4:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1420 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1421 v13[1] |= 1u;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1422 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1423 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1424 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1425 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1426 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1427 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1428 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1429 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1430 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1431 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1432 ++pMessageQueue_50CBD0->uNumMessages;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1433 }*/
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1434 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1435 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1436 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1437 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1438 if ( uMessageParam == 82 && contract_approved ) //join guild
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1439 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1440 Party::TakeGold(gold_transaction_amount);
1861
a86c60679949 changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents: 1843
diff changeset
1441 v4 = pParty->pPlayers.data();
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1442 do
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1443 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1444 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1445 ++v4;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1446 }
1861
a86c60679949 changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents: 1843
diff changeset
1447 while ( (signed int)v4 < (signed int)pParty->pHirelings.data() );
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1448 switch ( dword_F8B1D8 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1449 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1450 case 19:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1451 pEventNumber = pCurrentNPCInfo->evt_A;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1452 if ( pEventNumber >= 400 && pEventNumber <= 416 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1453 pCurrentNPCInfo->evt_A = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1454 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1455 case 20:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1456 pEventNumber = pCurrentNPCInfo->evt_B;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1457 if ( pEventNumber >= 400 && pEventNumber <= 416 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1458 pCurrentNPCInfo->evt_B = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1459 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1460 case 21:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1461 pEventNumber = pCurrentNPCInfo->evt_C;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1462 if ( pEventNumber >= 400 && pEventNumber <= 416 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1463 pCurrentNPCInfo->evt_C = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1464 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1465 case 22:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1466 pEventNumber = pCurrentNPCInfo->evt_D;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1467 if ( pEventNumber >= 400 && pEventNumber <= 416 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1468 pCurrentNPCInfo->evt_D = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1469 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1470 case 23:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1471 pEventNumber = pCurrentNPCInfo->evt_E;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1472 if ( pEventNumber >= 400 && pEventNumber <= 416 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1473 pCurrentNPCInfo->evt_E = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1474 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1475 case 24:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1476 pEventNumber = pCurrentNPCInfo->evt_F;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1477 if ( pEventNumber >= 400 && pEventNumber <= 416)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1478 pCurrentNPCInfo->evt_F = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1479 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1480 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1481 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1482 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1483 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1484 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1485 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1486 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1487 ++pMessageQueue_50CBD0->uNumMessages;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1488 }*/
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1489 //v11 = uActiveCharacter;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1490 if ( uActiveCharacter )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1491 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1492 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1493 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1494 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1495 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1496 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1497 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1498 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1499 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1500 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1501 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1502 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1503 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1504 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1505 if ( pCurrentNPCInfo->uProfession != 51 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1506 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1507 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1508 if ( pParty->uNumGold < pPrice )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1509 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1510 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1511 dialogue_show_profession_details = false;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1512 uDialogueType = 13;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1513 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1828
diff changeset
1514 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1515 if ( uActiveCharacter )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1516 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1517 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1518 goto _return;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1519 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1520 Party::TakeGold(pPrice);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1521 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1522 //LOBYTE(v2->uFlags) |= 0x80u;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1523 pCurrentNPCInfo->uFlags |= 128;
1793
4dee76d79c78 dword_5B65CC to npcIdToDismissAfterDialogue, Party::field_709 to Party::hirelingScrollPosition
Grumpy7
parents: 1662
diff changeset
1524 pParty->hirelingScrollPosition = 0;
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1525 pParty->CountHirelings();
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1526 if ( pParty->pHirelings[0].pName )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1527 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1528 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1]));
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1529 v24 = pCurrentNPCInfo->pName;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1530 v22 = pParty->pHireling2Name;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1531 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1532 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1533 {
1861
a86c60679949 changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents: 1843
diff changeset
1534 memcpy(pParty->pHirelings.data(), pCurrentNPCInfo, 0x4Cu);
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1535 v24 = pCurrentNPCInfo->pName;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1536 v22 = pParty->pHireling1Name;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1537 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1538 strcpy(v22, v24);
1793
4dee76d79c78 dword_5B65CC to npcIdToDismissAfterDialogue, Party::field_709 to Party::hirelingScrollPosition
Grumpy7
parents: 1662
diff changeset
1539 pParty->hirelingScrollPosition = 0;
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1540 pParty->CountHirelings();
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1541 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1542 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1543
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1544 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1545 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1546 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1547 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1548 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1549 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1550 ++pMessageQueue_50CBD0->uNumMessages;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1551 }*/
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1552 if ( uActiveCharacter )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1553 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1554 _return:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1555 pVideoPlayer->_4BF5B2();//HouseVideo
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1556 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1557 //----- (004B29F2) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1558 const char * ContractSelectText( int pEventCode )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1559 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1560 static const int dialogue_base=110;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1561 contract_approved = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1562 dword_F8B1AC_award_bit_number = pEventCode + 50;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1563 gold_transaction_amount = price_for_membership[pEventCode];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1564 if ( pPlayers[uActiveCharacter]->CanAct() )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1565 {
1460
ff2118028c71 renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents: 1411
diff changeset
1566 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, dword_F8B1AC_award_bit_number) )
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1567 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1568 return pNPCTopics[dialogue_base+13].pText;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1569 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1570 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1571 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1572 if ( gold_transaction_amount <= pParty->uNumGold )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1573 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1574 contract_approved = 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1575 return pNPCTopics[pEventCode + dialogue_base].pText;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1576 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1577 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1578 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1579 return pNPCTopics[dialogue_base+14].pText;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1580 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1581 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1582 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1583 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1584 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1585 return pNPCTopics[dialogue_base+12].pText;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1586 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1587 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1588 //----- (004B40E6) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1589 void NPCHireableDialogPrepare()
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1590 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1591 signed int v0; // ebx@1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1592 NPCData *v1; // edi@1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1593
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1594 v0 = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1595 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1596 pDialogueWindow->Release();
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1597 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1598 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0,
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1599 pGlobalTXT_LocalizationStrings[34], //"Cancel"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1600 pIcons_LOD->GetTexture(uExitCancelTextureId),
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1601 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1602 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1603 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1604 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1605 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0,
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1606 pGlobalTXT_LocalizationStrings[407], 0);//"More Information"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1607 v0 = 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1608 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1609 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0,
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1610 pGlobalTXT_LocalizationStrings[406], 0); //"Hire"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1611 pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1612 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1613 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1614
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1615 //----- (004B4224) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1616 void _4B4224_UpdateNPCTopics( int _this )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1617 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1618 int num_menu_buttons; // ebx@1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1619 int i; // ebp@5
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1620 // signed int v4; // ebp@9
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1621 int v6; // eax@16
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1622 int v8; // eax@21
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1623 int v10; // eax@26
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1624 int v12; // eax@31
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1625 int v14; // eax@36
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1626 int v16; // eax@41
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1627 NPCData *v17; // [sp+10h] [bp-4h]@4
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1628
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1629 num_menu_buttons = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1630 pDialogueNPCCount = (_this + 1);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1631 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1632 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1633 pDialogueWindow->Release();
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1634 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1635 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1636 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1637 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName.data(), pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1638 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName.data(), 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1639 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName.data(), 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1640 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1641 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1642 {
1313
ae6c8e1ddef4 fix enter house error
Gloval
parents: 1310
diff changeset
1643 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0)?1:0 )];//+ 1
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1644 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1645 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1646 pDialogueWindow->Release();
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1647 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1648 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1649 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1650 for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
1589
Ritor1
parents: 1529
diff changeset
1651 HouseNPCPortraitsButtonsList[i]->Release();
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1652 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1653 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1654 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0,
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1655 pGlobalTXT_LocalizationStrings[74],// "End Conversation"
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1656 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1657 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1658 if ( pDialogueNPCCount == 1 && dword_591080 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1659 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1660 InitializaDialogueOptions(in_current_building_type);
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1661 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1662 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1663 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1664 if ( v17->joins )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1665 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1666 num_menu_buttons = 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1667 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1668 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1669 if ( v17->evt_A)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1670 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1671 if ( num_menu_buttons < 4 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1672 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1673 v6 = NPC_EventProcessor(v17->evt_A);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1674 if ( v6 == 1 || v6 == 2 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1675 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1676 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1677 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1678 if ( v17->evt_B )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1679 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1680 if ( num_menu_buttons < 4 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1681 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1682 v8 = NPC_EventProcessor(v17->evt_B);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1683 if ( v8 == 1 || v8 == 2 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1684 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1685 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1686 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1687 if ( v17->evt_C )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1688 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1689 if ( num_menu_buttons < 4 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1690 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1691 v10 = NPC_EventProcessor(v17->evt_C);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1692 if ( v10 == 1 || v10 == 2 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1693 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1694 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1695 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1696
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1697 if ( v17->evt_D )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1698 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1699 if ( num_menu_buttons < 4 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1700 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1701 v12 = NPC_EventProcessor(v17->evt_D);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1702 if ( v12 == 1 || v12 == 2 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1703 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1704 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1705 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1706 if ( v17->evt_E )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1707 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1708 if ( num_menu_buttons < 4 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1709 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1710 v14 = NPC_EventProcessor(v17->evt_E);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1711 if ( v14 == 1 || v14 == 2 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1712 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1713 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1714 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1715 if ( v17->evt_F )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1716 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1717 if ( num_menu_buttons < 4 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1718 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1719 v16 = NPC_EventProcessor(v17->evt_F);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1720 if ( v16 == 1 || v16 == 2 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1721 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1722 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1723 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1724 pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1725 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1726 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1727 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1728 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1729
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1730 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1731 //----- (004466C4) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1732 int NPC_EventProcessor(int npc_event_id, int entry_line)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1733 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1734 signed int event_index; // ebp@1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1735 int evt_seq_num; // esi@3
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1736 bool ready_to_exit; // [sp+Ch] [bp-Ch]@3
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1737 signed int npc_activity; // [sp+10h] [bp-8h]@3
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1738 int result;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1739
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1740 event_index = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1741 if ( !npc_event_id )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1742 return 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1743 evt_seq_num = entry_line;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1744 pSomeOtherEVT = pGlobalEVT.data();
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1745 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1746 memcpy(pSomeOtherEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1747 npc_activity = 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1748 ready_to_exit = false;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1749 if ( uSomeOtherEVT_NumEvents <= 0 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1750 return 2;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1751 do
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1752 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1753 if ( (pSomeOtherEVT_Events[event_index].uEventID == npc_event_id) && (pSomeOtherEVT_Events[event_index].event_sequence_num == evt_seq_num) )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1754 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1755 _evt_raw *_evt = (_evt_raw *)&pSomeOtherEVT[pSomeOtherEVT_Events[event_index].uEventOffsetInEVT];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1756 switch(_evt->_e_type)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1757 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1758 case EVENT_Exit:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1759 //exit
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1760 if ( ready_to_exit )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1761 result = npc_activity != 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1762 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1763 result = 2;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1764 return result;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1765 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1766 case EVENT_OnCanShowDialogItemCmp:
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1767 ready_to_exit = true;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1768 //v8 = (unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8);
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1769 for(int i=0; i<4; ++i)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1770 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1771 // if (pParty->pPlayers[i].CompareVariable((enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)),
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1772 // v8))
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1773 if (pParty->pPlayers[i].CompareVariable((enum VariableType)EVT_WORD(_evt->v5), EVT_DWORD(_evt->v7)))
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1774 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1775 event_index = -1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1776 evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1777 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1778 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1779 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1780 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1781 case EVENT_EndCanShowDialogItem :
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1782 if ( ready_to_exit )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1783 result = npc_activity != 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1784 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1785 result = 2;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1786 return result;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1787 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1788 case EVENT_SetCanShowDialogItem :
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1789 ready_to_exit = true;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1790 npc_activity = EVT_BYTE(_evt->v5); //(unsigned __int8)v7[5];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1791 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1792 case EVENT_IsActorAssasinated :
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1793 // if (IsActorAlive( (unsigned __int8)v7[5],
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1794 // (unsigned __int8)v7[6] + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8),
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1795 // (unsigned __int8)v7[10]) )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1796 if (IsActorAlive( EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10)))
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1797 { // drop linear sequense, going to new seq
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1798 event_index = -1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1799 evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1800 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1801 break;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1802 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1803 ++evt_seq_num;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1804 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1805 ++event_index;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1806 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1807 while ( event_index < uSomeOtherEVT_NumEvents );
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1808 if ( ready_to_exit )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1809 result = npc_activity != 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1810 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1811 result = 2;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1812 return result;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1813 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1814 //----- (00445C8B) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1815 int __fastcall GetGreetType(signed int SpeakingNPC_ID)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1816 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1817 signed int v1; // ebx@1
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1818 int v3; // edi@6
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1819 int v4; // ecx@6
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1820 int v5; // edx@6
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1821 NPCData *v6; // eax@6
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1822 char *v7; // ebp@11
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1823 NPCData *v8; // esi@11
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1824
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1825 v1 = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1826 if ( SpeakingNPC_ID >= 0 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1827 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1828 if ( SpeakingNPC_ID < 5000 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1829 return 1;//QuestNPC_greet
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1830 return 2;//HiredNPC_greet
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1831 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1832 if ( SpeakingNPC_ID >= 5000 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1833 return 2;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1834 v3 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1835 v4 = 0;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1836 v5 = 0;
1861
a86c60679949 changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents: 1843
diff changeset
1837 v6 = pParty->pHirelings.data();
1295
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1838 do
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1839 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1840 if ( v6->pName )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1841 pTmpBuf[v4++] = v5;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1842 ++v6;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1843 ++v5;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1844 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1845 while ( (signed int)v6 < (signed int)&pParty->pPickedItem );
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1846 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1847 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1848 v7 = &pTmpBuf[v4];
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1849 v8 = pNPCStats->pNewNPCData;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1850 do
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1851 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1852 if (v8->Hired() && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName)) )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1853 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1854 if ( !pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName) )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1855 *v7++ = v1 + 2;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1856 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1857 ++v1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1858 ++v8;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1859 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1860 while ( v1 < (signed int)pNPCStats->uNumNewNPCs );
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1861 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1862 return ((unsigned __int8)pTmpBuf[v3] < 2) + 1;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1863 }
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1864 //----- (00445308) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1865 const char *GetProfessionActionText(int a1)
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1866 {
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1867 if ( a1 == 10
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1868 || a1 == 11
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1869 || a1 == 12
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1870 || a1 == 33
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1871 || a1 == 34
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1872 || a1 == 39
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1873 || a1 == 40
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1874 || a1 == 41
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1875 || a1 == 42
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1876 || a1 == 43
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1877 || a1 == 52 )
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1878 return pNPCStats->pProfessions[a1 - 1].pActionText;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1879 else
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1880 return pNPCTopics[407].pTopic;
86a83e12d795 moving files
Ritor1
parents: 1206
diff changeset
1881 }