annotate NPC.cpp @ 2456:83174b7b3763

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