World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
NPC.cpp
См. документацию.
1 #include "Engine/Objects/NPC.h"
2 
3 #include "Engine/Engine.h"
4 #include "Engine/Localization.h"
5 
6 #include "GUI/UI/UITransition.h"
7 
8 #include "Engine/Events.h"
11 #include "Engine/MapInfo.h"
13 #include "GUI/UI/UIHouses.h"
14 #include "Engine/Objects/Actor.h"
15 #include "Engine/Autonotes.h"
16 #include "Engine/Awards.h"
17 #include "Engine/LOD.h"
18 #include "Engine/Party.h"
20 
21 #include "GUI/GUIButton.h"
22 #include "GUI/UI/UIStatusBar.h"
23 
24 #include "Platform/Api.h"
25 
27 std::array<class Image *, 6> pDialogueNPCPortraits;
29 struct NPCStats *pNPCStats = nullptr;
30 
33 
34 void InitializeAwards();
35 void InitializeScrolls();
36 void InitializeMerchants();
38 void InitializeAutonotes();
39 void InitializeQuests();
40 bool CheckPortretAgainstSex(int portret_num, int sex);
41 
42 //----- (004459F9) --------------------------------------------------------
43 NPCData *GetNPCData(signed int npcid) {
44  unsigned int v1; // esi@1
45  NPCData *result; // eax@5
46  int v3; // esi@9
47  int v4; // ecx@9
48  char v9; // al@22
49  int i;
50 
51  v1 = npcid;
52  if (npcid >= 0) {
53  if (npcid < 5000) {
54  if (npcid >= 501) {
55  logger->Warning(L"NPC id exceeds MAX_DATA!");
56  }
57  return &pNPCStats->pNewNPCData[v1]; // - 1];
58  }
59  return &pNPCStats->pAdditionalNPC[npcid - 5000];
60  }
61 
62  if (npcid >= 5000) return &pNPCStats->pAdditionalNPC[npcid - 5000];
64  result = 0;
65  } else {
67  v4 = 0;
68  char buf[1024];
69 
70  for (i = 0; i < 2; ++i) {
71  if (pParty->pHirelings[i].pName) buf[v4++] = i;
72  }
73 
74  if (pNPCStats->uNumNewNPCs > 0) {
75  for (i = 0; i < pNPCStats->uNumNewNPCs; ++i) {
76  if (pNPCStats->pNewNPCData[i].Hired()) {
77  if (!pParty->pHirelings[0].pName ||
78  strcmp((char *)pNPCStats->pNewNPCData[i].pName,
79  (char *)pParty->pHirelings[0].pName)) {
80  if (!pParty->pHirelings[1].pName ||
81  strcmp((char *)pNPCStats->pNewNPCData[i].pName,
82  (char *)pParty->pHirelings[1].pName))
83  buf[v4++] = i + 2;
84  }
85  }
86  }
87  }
88 
89  v9 = buf[v3];
90  if (v9 >= 2)
91  result = &pNPCStats->pNPCData[499 + v9];
92  else
93  result = &pParty->pHirelings[v9];
94  }
95  return result;
96 }
97 
98 //----- (00445B2C) --------------------------------------------------------
99 struct NPCData *GetNewNPCData(signed int npcid, int *npc_indx) {
100  int *v3; // edi@1
101  NPCData *result; // eax@5
102  int v5; // esi@9
103  int v6; // ecx@9
104  char v11; // al@23
105 
106  v3 = npc_indx;
107  if (npcid >= 0) {
108  if (npcid < 5000) {
109  if (npcid >= 501) {
110  logger->Warning(L"NPC id exceeds MAX_DATA!");
111  }
112  *v3 = npcid;
113  return &pNPCStats->pNewNPCData[npcid];
114  }
115  *npc_indx = npcid - 5000;
116  return &pNPCStats->pAdditionalNPC[npcid - 5000];
117  }
118  if (npcid >= 5000) {
119  *npc_indx = npcid - 5000;
120  return &pNPCStats->pAdditionalNPC[npcid - 5000];
121  }
123  *npc_indx = 0;
124  result = nullptr;
125  } else {
126  v5 = abs(sDialogue_SpeakingActorNPC_ID) - 1;
127  v6 = 0;
128  char buf[1024];
129 
130  for (int i = 0; i < 2; ++i) {
131  if (pParty->pHirelings[i].pName) buf[v6++] = i;
132  }
133  for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) {
134  if (pNPCStats->pNewNPCData[i].Hired() &&
135  (!pParty->pHirelings[0].pName ||
136  strcmp(pNPCStats->pNewNPCData[i].pName,
137  pParty->pHirelings[0].pName)) &&
138  (!pParty->pHirelings[1].pName ||
139  strcmp(pNPCStats->pNewNPCData[i].pName,
140  pParty->pHirelings[1].pName))) {
141  buf[v6++] = i + 2;
142  }
143  }
144  v11 = buf[v5];
145 
146  if (v11 >= 2u) {
147  *v3 = v11 - 2;
148  result = &pNPCStats->pNewNPCData[v11 - 2];
149  } else {
150  *v3 = v11;
151  result = &pParty->pHirelings[v11];
152  }
153  }
154  return result;
155 }
156 
157 //----- (00476977) --------------------------------------------------------
159  int i;
160  char *test_string;
161  unsigned char c;
162  bool break_loop;
163  unsigned int temp_str_len;
164  char *tmp_pos;
165  int decode_step;
166 
167  free(pNPCTextTXT_Raw);
168  pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npctext.txt");
169  strtok(pNPCTextTXT_Raw, "\r");
170 
171  for (i = 0; i < 789; ++i) {
172  test_string = strtok(NULL, "\r") + 1;
173  break_loop = false;
174  decode_step = 0;
175  do {
176  c = *(unsigned char *)test_string;
177  temp_str_len = 0;
178  while ((c != '\t') && (c > 0)) {
179  ++temp_str_len;
180  c = test_string[temp_str_len];
181  }
182  tmp_pos = test_string + temp_str_len;
183  if (*tmp_pos == 0) break_loop = true;
184  *tmp_pos = 0;
185  if (temp_str_len) {
186  if (decode_step == 1)
187  pNPCTopics[i].pText = RemoveQuotes(test_string);
188  } else {
189  break_loop = true;
190  }
191  ++decode_step;
192  test_string = tmp_pos + 1;
193  } while ((decode_step < 2) && !break_loop);
194  }
195  free(pNPCTopicTXT_Raw);
196  pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npctopic.txt");
197  strtok(pNPCTopicTXT_Raw, "\r");
198 
199  for (i = 1; i <= 579; ++i) { // NPC topics count limit
200  test_string = strtok(NULL, "\r") + 1;
201  break_loop = false;
202  decode_step = 0;
203  do {
204  c = *(unsigned char *)test_string;
205  temp_str_len = 0;
206  while ((c != '\t') && (c > 0)) {
207  ++temp_str_len;
208  c = test_string[temp_str_len];
209  }
210  tmp_pos = test_string + temp_str_len;
211  if (*tmp_pos == 0) break_loop = true;
212  *tmp_pos = 0;
213  if (temp_str_len) {
214  if (decode_step == 1)
215  pNPCTopics[i].pTopic = RemoveQuotes(test_string);
216  } else {
217  break_loop = true;
218  }
219  ++decode_step;
220  test_string = tmp_pos + 1;
221  } while ((decode_step < 2) && !break_loop);
222  }
223 
224  free(pNPCDistTXT_Raw);
225  pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npcdist.txt");
226  strtok(pNPCDistTXT_Raw, "\r");
227  strtok(NULL, "\r");
228 
229  for (i = 1; i < 59; ++i) {
230  test_string = strtok(NULL, "\r") + 1;
231  break_loop = false;
232  decode_step = 0;
233  do {
234  c = *(unsigned char *)test_string;
235  temp_str_len = 0;
236  while ((c != '\t') && (c > 0)) {
237  ++temp_str_len;
238  c = test_string[temp_str_len];
239  }
240  tmp_pos = test_string + temp_str_len;
241  if (*tmp_pos == 0) break_loop = true;
242  *tmp_pos = 0;
243  if (temp_str_len) {
244  if ((decode_step > 0) && (decode_step < 77)) {
246  atoi(test_string);
247  } else if (decode_step == 0) {
249  }
250  } else {
251  break_loop = true;
252  }
253  ++decode_step;
254  test_string = tmp_pos + 1;
255  } while ((decode_step < 78) && !break_loop);
256  }
257 
258  for (i = 0; i < 77; ++i) {
260  for (int ii = 1; ii < 59; ++ii) {
263  }
266  }
267 
268  free(pNPCDistTXT_Raw);
269  pNPCDistTXT_Raw = nullptr;
270 }
271 
272 //----- (00476C60) --------------------------------------------------------
274  for (unsigned int i = 1; i < uNumNewNPCs; ++i)
275  pNewNPCData[i].pName = pNPCUnicNames[i - 1];
276 
277  if (pParty->pHirelings[0].pName)
278  pParty->pHirelings[0].pName = pParty->pHireling1Name;
279  if (pParty->pHirelings[1].pName)
280  pParty->pHirelings[1].pName = pParty->pHireling2Name;
281 }
282 
283 //----- (00476CB5) --------------------------------------------------------
285  int i;
286  char *test_string;
287  unsigned char c;
288  bool break_loop;
289  unsigned int temp_str_len;
290  char *tmp_pos;
291  int decode_step;
292 
293  pNPCDataTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npcdata.txt");
294  strtok(pNPCDataTXT_Raw, "\r");
295  strtok(NULL, "\r");
296 
297  for (i = 0; i < 500; ++i) {
298  test_string = strtok(NULL, "\r") + 1;
299  break_loop = false;
300  decode_step = 0;
301  do {
302  c = *(unsigned char *)test_string;
303  temp_str_len = 0;
304  while ((c != '\t') && (c > 0)) {
305  ++temp_str_len;
306  c = test_string[temp_str_len];
307  }
308  tmp_pos = test_string + temp_str_len;
309  if (*tmp_pos == 0) break_loop = true;
310  *tmp_pos = 0;
311  if (temp_str_len) { // i+1
312  switch (decode_step) {
313  case 1:
314  pNPCUnicNames[i] = RemoveQuotes(test_string);
315  pNPCData[i + 1].pName = pNPCUnicNames[i];
316  break;
317  case 2:
318  pNPCData[i + 1].uPortraitID = atoi(test_string);
319  break;
320  case 6:
321  pNPCData[i + 1].Location2D = atoi(test_string);
322  break;
323  case 7:
324  pNPCData[i + 1].uProfession = atoi(test_string);
325  break;
326  case 8:
327  pNPCData[i + 1].greet = atoi(test_string);
328  break;
329  case 9:
330  pNPCData[i + 1].joins = (*test_string == 'y') ? 1 : 0;
331  break;
332  case 10:
333  pNPCData[i + 1].evt_A = atoi(test_string);
334  break;
335  case 11:
336  pNPCData[i + 1].evt_B = atoi(test_string);
337  break;
338  case 12:
339  pNPCData[i + 1].evt_C = atoi(test_string);
340  break;
341  case 13:
342  pNPCData[i + 1].evt_D = atoi(test_string);
343  break;
344  case 14:
345  pNPCData[i + 1].evt_E = atoi(test_string);
346  break;
347  case 15:
348  pNPCData[i + 1].evt_F = atoi(test_string);
349  break;
350  }
351  }
352  ++decode_step;
353  test_string = tmp_pos + 1;
354  } while ((decode_step < 16) && !break_loop);
355  }
356  uNumNewNPCs = 501;
357  pNPCGreetTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npcgreet.txt");
358  strtok(pNPCGreetTXT_Raw, "\r");
359  for (i = 1; i <= 205; ++i) {
360  test_string = strtok(NULL, "\r") + 1;
361  break_loop = false;
362  decode_step = 0;
363  do {
364  c = *(unsigned char *)test_string;
365  temp_str_len = 0;
366  while ((c != '\t') && (c > 0)) {
367  ++temp_str_len;
368  c = test_string[temp_str_len];
369  }
370  tmp_pos = test_string + temp_str_len;
371  if (*tmp_pos == 0) break_loop = true;
372  *tmp_pos = 0;
373  if (temp_str_len) { // i+1
374  switch (decode_step) {
375  case 1:
376  pNPCGreetings[i].pGreetings[0] =
377  RemoveQuotes(test_string);
378  break;
379  case 2:
380  pNPCGreetings[i].pGreetings[1] =
381  RemoveQuotes(test_string);
382  break;
383  }
384  }
385  ++decode_step;
386  test_string = tmp_pos + 1;
387  } while ((decode_step < 3) && !break_loop);
388  }
389 
390  pNCPGroupTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npcgroup.txt");
391  strtok(pNCPGroupTXT_Raw, "\r");
392 
393  for (i = 0; i < 51; ++i) {
394  test_string = strtok(NULL, "\r") + 1;
395  break_loop = false;
396  decode_step = 0;
397  do {
398  c = *(unsigned char *)test_string;
399  temp_str_len = 0;
400  while ((c != '\t') && (c > 0)) {
401  ++temp_str_len;
402  c = test_string[temp_str_len];
403  }
404  tmp_pos = test_string + temp_str_len;
405  if (*tmp_pos == 0) break_loop = true;
406  *tmp_pos = 0;
407  if (temp_str_len) { // i+1
408  if (decode_step == 1) {
409  pGroups[i] = atoi(test_string);
410  }
411  }
412  ++decode_step;
413  test_string = tmp_pos + 1;
414  } while ((decode_step < 2) && !break_loop);
415  }
416 
417  pNPCNewsTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npcnews.txt");
418  strtok(pNPCNewsTXT_Raw, "\r");
419 
420  for (i = 0; i < 51; ++i) {
421  test_string = strtok(NULL, "\r") + 1;
422  break_loop = false;
423  decode_step = 0;
424  do {
425  c = *(unsigned char *)test_string;
426  temp_str_len = 0;
427  while ((c != '\t') && (c > 0)) {
428  ++temp_str_len;
429  c = test_string[temp_str_len];
430  }
431  tmp_pos = test_string + temp_str_len;
432  if (*tmp_pos == 0) break_loop = true;
433  *tmp_pos = 0;
434  if (temp_str_len) { // i+1
435  if (decode_step == 1)
436  pCatchPhrases[i] = RemoveQuotes(test_string);
437  }
438  ++decode_step;
439  test_string = tmp_pos + 1;
440  } while ((decode_step < 2) && !break_loop);
441  }
442 }
443 
444 //----- (0047702F) --------------------------------------------------------
446  int i;
447  char *test_string;
448  unsigned char c;
449  bool break_loop;
450  unsigned int temp_str_len;
451  char *tmp_pos;
452  int decode_step;
453 
462 
463  pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npcnames.txt");
464  strtok(pNPCNamesTXT_Raw, "\r");
465 
466  uNewlNPCBufPos = 0;
467 
468  for (i = 0; i < 540; ++i) {
469  test_string = strtok(NULL, "\r") + 1;
470  break_loop = false;
471  decode_step = 0;
472  do {
473  c = *(unsigned char *)test_string;
474  temp_str_len = 0;
475  if (c == '\t') {
476  if ((decode_step == 1) && (!uNumNPCNames[1]))
477  uNumNPCNames[1] = i;
478  } else {
479  while ((c != '\n') && (c != '\t') && (c > 0)) {
480  ++temp_str_len;
481  c = test_string[temp_str_len];
482  }
483  tmp_pos = test_string + temp_str_len;
484  if (*tmp_pos == 0) break_loop = true;
485 
486  if (temp_str_len) {
487  *tmp_pos = 0;
488  if (decode_step == 0)
489  pNPCNames[i][0] = RemoveQuotes(test_string);
490  else if (decode_step == 1)
491  pNPCNames[i][1] = RemoveQuotes(test_string);
492  } else {
493  if ((decode_step == 1) && (!uNumNPCNames[1]))
494  uNumNPCNames[1] = i;
495  }
496  }
497  ++decode_step;
498  test_string = tmp_pos + 1;
499  } while ((decode_step < 2) && !break_loop);
500  }
501  uNumNPCNames[0] = i;
502 
503  pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("npcprof.txt");
504  strtok(pNPCProfTXT_Raw, "\r");
505  strtok(NULL, "\r");
506  strtok(NULL, "\r");
507  strtok(NULL, "\r");
508 
509  for (i = 1; i < 59; ++i) {
510  test_string = strtok(NULL, "\r") + 1;
511  break_loop = false;
512  decode_step = 0;
513  do {
514  // while (*test_string == '\t') // some steps are separated by
515  // multiple \t's
516  // ++test_string;
517 
518  c = *(unsigned char *)test_string;
519  temp_str_len = 0;
520  while ((c != '\t') && (c > 0)) {
521  ++temp_str_len;
522  c = test_string[temp_str_len];
523  }
524  tmp_pos = test_string + temp_str_len;
525  if (*tmp_pos == 0) break_loop = true;
526  *tmp_pos = 0;
527  if (temp_str_len) {
528  switch (decode_step) {
529  case 2:
530  pProfessions[i].uHirePrice = atoi(test_string);
531  break;
532  case 3:
533  pProfessions[i].pActionText = RemoveQuotes(test_string);
534  break;
535  case 4:
536  pProfessions[i].pBenefits = RemoveQuotes(test_string);
537  break;
538  case 5:
539  pProfessions[i].pJoinText = RemoveQuotes(test_string);
540  break;
541  case 6:
543  RemoveQuotes(test_string);
544  }
545  } else {
546  if (!decode_step) break_loop = true;
547  }
548  ++decode_step;
549  test_string = tmp_pos + 1;
550  } while ((decode_step < 7) && !break_loop);
551  }
552  uNumNPCProfessions = 59;
553 }
554 
555 //----- (00477266) --------------------------------------------------------
557  free(pNPCTopicTXT_Raw);
558  pNPCTopicTXT_Raw = nullptr;
559  free(pNPCTextTXT_Raw);
560  pNPCTextTXT_Raw = nullptr;
561  free(pNPCNewsTXT_Raw);
562  pNPCNewsTXT_Raw = nullptr;
563  free(pNPCProfTXT_Raw);
564  pNPCProfTXT_Raw = nullptr;
565  free(pNPCNamesTXT_Raw);
566  pNPCNamesTXT_Raw = nullptr;
567  free(pNPCDataTXT_Raw);
568  pNPCDataTXT_Raw = nullptr;
569  free(pNPCDistTXT_Raw);
570  pNPCDistTXT_Raw = nullptr;
571  free(pNPCGreetTXT_Raw);
572  pNPCGreetTXT_Raw = nullptr;
573  free(pNCPGroupTXT_Raw);
574  pNCPGroupTXT_Raw = nullptr;
575 }
576 
577 //----- (0047730C) --------------------------------------------------------
578 bool CheckPortretAgainstSex(int a1, int) { return true; }
579 // 47730C: using guessed type int __stdcall const_1(int);
580 
581 //----- (0047732C) --------------------------------------------------------
582 void NPCStats::InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid,
583  int uLocation2D, int uMapId) {
584  int rep_gen;
585  int uNPCSex; // esi@1
586  int uGeneratedPortret; // ecx@23
587  int test_prof_summ; // ecx@37
588  int gen_profession; // eax@37
589  int max_prof_cap; // edx@37
590  // signed int result; // eax@39
591  int uRace; // [sp+Ch] [bp-Ch]@1
592  bool break_gen; // [sp+10h] [bp-8h]@1
593  signed int gen_attempts; // [sp+14h] [bp-4h]@1
594  int uPortretMin; // [sp+24h] [bp+Ch]@1
595  int uPortretMax;
596 
597  static const unsigned __int8 NPCSexGenTable[86] = {
598  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
599  1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0,
600  1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
601  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0};
602  static const unsigned __int8 NPCRaceGenTable[86] = {
603  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
604  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3,
605  1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
606  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0};
607 
608  unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1) / 3.0);
609  uNPCSex = NPCSexGenTable[seed];
610  uRace = NPCRaceGenTable[seed];
611  pNPCDataBuff->uSex = uNPCSex;
612  pNPCDataBuff->pName = pNPCNames[rand() % uNumNPCNames[uNPCSex]][uNPCSex];
613 
614  gen_attempts = 0;
615  break_gen = false;
616 
617  do {
618  switch (uRace) {
619  case 0:
620  if (uNPCSex == 0) {
621  uPortretMin = 2;
622  uPortretMax = 100;
623  } else {
624  uPortretMin = 201;
625  uPortretMax = 250;
626  }
627  case 1:
628  if (uNPCSex == 0) {
629  uPortretMin = 400;
630  uPortretMax = 430;
631  } else {
632  uPortretMin = 460;
633  uPortretMax = 490;
634  }
635  break;
636  case 2:
637  if (uNPCSex == 0) {
638  uPortretMin = 500;
639  uPortretMax = 520;
640  } else {
641  uPortretMin = 530;
642  uPortretMax = 550;
643  }
644  break;
645  case 3:
646  if (uNPCSex == 0) {
647  uPortretMin = 300;
648  uPortretMax = 330;
649  } else {
650  uPortretMin = 360;
651  uPortretMax = 387;
652  }
653 
654  break;
655  }
656 
657  uGeneratedPortret =
658  uPortretMin + rand() % (uPortretMax - uPortretMin + 1);
659  if (CheckPortretAgainstSex(uGeneratedPortret, uNPCSex))
660  break_gen = true;
661  ++gen_attempts;
662  if (gen_attempts >= 4) {
663  uGeneratedPortret = uPortretMin;
664  break_gen = true;
665  }
666  } while (!break_gen);
667 
668  pNPCDataBuff->uPortraitID = uGeneratedPortret;
669  pNPCDataBuff->uFlags = 0;
670  pNPCDataBuff->fame = 0;
671  // generate reputation
672  rep_gen = rand() % 100 + 1;
673 
674  if (rep_gen >= 60) {
675  if (rep_gen >= 90) {
676  if (rep_gen >= 95) {
677  if (rep_gen >= 98)
678  pNPCDataBuff->rep = -600;
679  else
680  pNPCDataBuff->rep = 400;
681  } else {
682  pNPCDataBuff->rep = -300;
683  }
684  } else {
685  pNPCDataBuff->rep = 200;
686  }
687  } else {
688  pNPCDataBuff->rep = 0;
689  }
690 
691  max_prof_cap = rand() % pProfessionChance[uMapId].uTotalprofChance + 1;
692  test_prof_summ = 0;
693  gen_profession = 0;
694 
695  if (max_prof_cap > 0) {
696  do
697  test_prof_summ += pProfessionChance[uMapId]
698  .professionChancePerArea[gen_profession++];
699  while (test_prof_summ < max_prof_cap);
700  }
701  pNPCDataBuff->uProfession = gen_profession - 1;
702  pNPCDataBuff->Location2D = uLocation2D;
703  pNPCDataBuff->field_24 = 1;
704  pNPCDataBuff->joins = 1;
705  pNPCDataBuff->evt_A = 0;
706  pNPCDataBuff->evt_B = 0;
707  pNPCDataBuff->evt_C = 0;
708  pNPCDataBuff->evt_D = 0;
709  pNPCDataBuff->evt_E = 0;
710  pNPCDataBuff->evt_F = 0;
711 }
712 
713 //----- (00495366) --------------------------------------------------------
714 char *NPCStats::sub_495366_MispronounceName(unsigned __int8 firstLetter,
715  unsigned __int8 genderId) {
716  int pickedName; // edx@2
717 
720  } else {
722  if (this->uNumNPCNames[genderId] == 0) {
723  pickedName =
724  rand() %
725  this->uNumNPCNames[(genderId + 1) %
726  2]; // originally without " + 1) % 2", but
727  // that would yield a div by zero
728  } else {
729  int rangeBottom = 0;
730  int rangeTop = 0;
731  for (uint i = 0; i < this->uNumNPCNames[genderId]; ++i) {
732  if (tolower(this->pNPCNames[i][genderId][0])) {
733  if (rangeBottom)
734  rangeTop = i;
735  else
736  rangeBottom = i;
737  }
738  }
739  if (rangeTop != 0)
740  pickedName = rangeBottom + rand() % (rangeTop - rangeBottom);
741  else
742  pickedName = rand() % this->uNumNPCNames[genderId];
743  }
744  }
746  return this->pNPCNames[pickedName][genderId];
747 }
748 
749 //----- (00476387) --------------------------------------------------------
750 bool PartyHasDragon() { return pNPCStats->pNewNPCData[57].Hired(); }
751 
752 //----- (00476395) --------------------------------------------------------
753 // 0x26 Wizard eye at skill level 2
755  if (bNoNPCHiring == 1) return 0;
756 
757  for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) {
760  0x80)) // Uninitialized memory access
761  return true;
762  }
763  if (pParty->pHirelings[0].uProfession == uProfession ||
764  pParty->pHirelings[1].uProfession == uProfession)
765  return true;
766  else
767  return false;
768 }
769 
770 //----- (004763E0) --------------------------------------------------------
772  int i;
773  char *test_string;
774  unsigned char c;
775  bool break_loop;
776  unsigned int temp_str_len;
777  char *tmp_pos;
778  int decode_step;
779 
780  free(pAwardsTXT_Raw);
781  pAwardsTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("awards.txt");
782  strtok(pAwardsTXT_Raw, "\r");
783 
784  for (i = 1; i < 105; ++i) {
785  test_string = strtok(NULL, "\r") + 1;
786  break_loop = false;
787  decode_step = 0;
788  do {
789  c = *(unsigned char *)test_string;
790  temp_str_len = 0;
791  while ((c != '\t') && (c > 0)) {
792  ++temp_str_len;
793  c = test_string[temp_str_len];
794  }
795  tmp_pos = test_string + temp_str_len;
796  if (*tmp_pos == 0) break_loop = true;
797  *tmp_pos = 0;
798  if (temp_str_len) {
799  if (decode_step == 1)
800  pAwards[i].pText = RemoveQuotes(test_string);
801  else if (decode_step == 2)
802  pAwards[i].uPriority = atoi(test_string);
803  } else {
804  break_loop = true;
805  }
806  ++decode_step;
807  test_string = tmp_pos + 1;
808  } while ((decode_step < 3) && !break_loop);
809  }
810 }
811 // 7241C8: using guessed type int dword_7241C8;
812 
813 //----- (004764C2) --------------------------------------------------------
815  int i;
816  char *test_string;
817  unsigned char c;
818  bool break_loop;
819  unsigned int temp_str_len;
820  char *tmp_pos;
821  int decode_step;
822 
823  free(pScrollsTXT_Raw);
824  pScrollsTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("scroll.txt");
825  strtok(pScrollsTXT_Raw, "\r");
826  for (i = 0; i < 82; ++i) {
827  test_string = strtok(NULL, "\r") + 1;
828  break_loop = false;
829  decode_step = 0;
830  do {
831  c = *(unsigned char *)test_string;
832  temp_str_len = 0;
833  while ((c != '\t') && (c > 0)) {
834  ++temp_str_len;
835  c = test_string[temp_str_len];
836  }
837  tmp_pos = test_string + temp_str_len;
838  if (*tmp_pos == 0) break_loop = true;
839  *tmp_pos = 0;
840  if (temp_str_len) {
841  if (decode_step == 1) pScrolls[i] = RemoveQuotes(test_string);
842  } else {
843  break_loop = true;
844  }
845  ++decode_step;
846  test_string = tmp_pos + 1;
847  } while ((decode_step < 2) && !break_loop);
848  }
849 }
850 
851 //----- (00476590) --------------------------------------------------------
853  int i;
854  char *test_string;
855  unsigned char c;
856  bool break_loop;
857  unsigned int temp_str_len;
858  char *tmp_pos;
859  int decode_step;
860 
861  free(pMerchantsTXT_Raw);
862  pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("merchant.txt");
863  strtok(pMerchantsTXT_Raw, "\r");
864 
865  for (i = 0; i < 7; ++i) {
866  test_string = strtok(NULL, "\r") + 1;
867  break_loop = false;
868  decode_step = 0;
869  do {
870  c = *(unsigned char *)test_string;
871  temp_str_len = 0;
872  while ((c != '\t') && (c > 0)) {
873  ++temp_str_len;
874  c = test_string[temp_str_len];
875  }
876  tmp_pos = test_string + temp_str_len;
877  if (*tmp_pos == 0) break_loop = true;
878  *tmp_pos = 0;
879  if (temp_str_len) {
880  switch (decode_step) {
881  case 1:
882  pMerchantsBuyPhrases[i] = RemoveQuotes(test_string);
883  break;
884  case 2:
885  pMerchantsSellPhrases[i] = RemoveQuotes(test_string);
886  break;
887  case 3:
888  pMerchantsRepairPhrases[i] = RemoveQuotes(test_string);
889  break;
890  case 4:
892  RemoveQuotes(test_string);
893  break;
894  }
895  } else {
896  break_loop = true;
897  }
898  ++decode_step;
899  test_string = tmp_pos + 1;
900  } while ((decode_step < 5) && !break_loop);
901  }
902 }
903 
904 //----- (00476682) --------------------------------------------------------
906  int i;
907  char *test_string;
908  unsigned char c;
909  bool break_loop;
910  unsigned int temp_str_len;
911  char *tmp_pos;
912  int decode_step;
913 
914  free(pTransitionsTXT_Raw);
915  pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("trans.txt");
916  strtok(pTransitionsTXT_Raw, "\r");
917 
918  for (i = 0; i < 464; ++i) {
919  test_string = strtok(NULL, "\r") + 1;
920  break_loop = false;
921  decode_step = 0;
922  do {
923  c = *(unsigned char *)test_string;
924  temp_str_len = 0;
925  while ((c != '\t') && (c > 0)) {
926  ++temp_str_len;
927  c = test_string[temp_str_len];
928  }
929  tmp_pos = test_string + temp_str_len;
930  if (*tmp_pos == 0) break_loop = true;
931  *tmp_pos = 0;
932  if (temp_str_len) {
933  if (decode_step == 1)
934  pTransitionStrings[i + 1] = RemoveQuotes(test_string);
935  } else {
936  break_loop = true;
937  }
938  ++decode_step;
939  test_string = tmp_pos + 1;
940  } while ((decode_step < 2) && !break_loop);
941  }
942 }
943 
944 //----- (00476750) --------------------------------------------------------
946  int i;
947  char *test_string;
948  unsigned char c;
949  bool break_loop;
950  unsigned int temp_str_len;
951  char *tmp_pos;
952  int decode_step;
953 
954  free(pAutonoteTXT_Raw);
955  pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("autonote.txt");
956  strtok(pAutonoteTXT_Raw, "\r");
957 
958  for (i = 0; i < 195; ++i) {
959  test_string = strtok(NULL, "\r") + 1;
960  break_loop = false;
961  decode_step = 0;
962  do {
963  c = *(unsigned char *)test_string;
964  temp_str_len = 0;
965  while ((c != '\t') && (c > 0)) {
966  ++temp_str_len;
967  c = test_string[temp_str_len];
968  }
969  tmp_pos = test_string + temp_str_len;
970  if (*tmp_pos == 0) break_loop = true;
971  *tmp_pos = 0;
972  if (temp_str_len) {
973  switch (decode_step) {
974  case 1:
975  pAutonoteTxt[i + 1].pText = RemoveQuotes(test_string);
976  break;
977  case 2: {
978  if (!_stricmp(test_string, "potion")) {
979  pAutonoteTxt[i + 1].eType = AUTONOTE_POTION_RECEPIE;
980  break;
981  }
982  if (!_stricmp(test_string, "stat")) {
983  pAutonoteTxt[i + 1].eType = AUTONOTE_STAT_HINT;
984  break;
985  }
986  if (!_stricmp(test_string, "seer")) {
987  pAutonoteTxt[i + 1].eType = AUTONOTE_SEER;
988  break;
989  }
990  if (!_stricmp(test_string, "obelisk")) {
991  pAutonoteTxt[i + 1].eType = AUTONOTE_OBELISK;
992  break;
993  }
994  if (!_stricmp(test_string, "teacher")) {
995  pAutonoteTxt[i + 1].eType = AUTONOTE_TEACHER;
996  break;
997  }
998  pAutonoteTxt[i + 1].eType = AUTONOTE_MISC;
999  break;
1000  }
1001  }
1002  } else {
1003  break_loop = true;
1004  }
1005  ++decode_step;
1006  test_string = tmp_pos + 1;
1007  } while ((decode_step < 3) && !break_loop);
1008  }
1009 }
1010 
1011 //----- (004768A9) --------------------------------------------------------
1013  int i;
1014  char *test_string;
1015  unsigned char c;
1016  bool break_loop;
1017  unsigned int temp_str_len;
1018  char *tmp_pos;
1019  int decode_step;
1020 
1021  free(pQuestsTXT_Raw);
1022  pQuestsTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("quests.txt");
1023  strtok(pQuestsTXT_Raw, "\r");
1024  memset(pQuestTable.data(), 0, sizeof(pQuestTable));
1025  for (i = 0; i < 512; ++i) {
1026  test_string = strtok(NULL, "\r") + 1;
1027  break_loop = false;
1028  decode_step = 0;
1029  do {
1030  c = *(unsigned char *)test_string;
1031  temp_str_len = 0;
1032  while ((c != '\t') && (c > 0)) {
1033  ++temp_str_len;
1034  c = test_string[temp_str_len];
1035  }
1036  tmp_pos = test_string + temp_str_len;
1037  if (*tmp_pos == 0) break_loop = true;
1038  *tmp_pos = 0;
1039  if (temp_str_len) {
1040  if (decode_step == 1)
1041  pQuestTable[i + 1] = RemoveQuotes(test_string);
1042  } else {
1043  break_loop = true;
1044  }
1045  ++decode_step;
1046  test_string = tmp_pos + 1;
1047  } while ((decode_step < 2) && !break_loop);
1048  }
1049 }
1050 
1051 //----- (004B29F2) --------------------------------------------------------
1052 const char *ContractSelectText(int pEventCode) {
1053  static const int dialogue_base = 110;
1054  contract_approved = 0;
1055  dword_F8B1AC_award_bit_number = pEventCode + 50;
1057 
1058  if (uActiveCharacter == 0)
1059  uActiveCharacter = pParty->GetFirstCanAct(); // avoid nzi
1060 
1061  if (pPlayers[uActiveCharacter]->CanAct()) {
1064  ->_achieved_awards_bits,
1066  return pNPCTopics[dialogue_base + 13].pText;
1067  } else {
1068  if (gold_transaction_amount <= pParty->GetGold()) {
1069  contract_approved = 1;
1070  return pNPCTopics[pEventCode + dialogue_base].pText;
1071  } else {
1072  return pNPCTopics[dialogue_base + 14].pText;
1073  }
1074  }
1075  } else {
1076  return pNPCTopics[dialogue_base + 12].pText;
1077  }
1078 }
1079 //----- (004B40E6) --------------------------------------------------------
1081  signed int v0; // ebx@1
1082  NPCData *v1; // edi@1
1083 
1084  v0 = 0;
1085  v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount +
1086  -(dword_591080 != 0))]; //- 1
1088  pDialogueWindow = new GUIWindow(WINDOW_Dialogue, 0, 0, window->GetWidth(), 350, 0);
1090  471, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0,
1091  localization->GetString(34), // "Cancel"
1092  {{ui_exit_cancel_button_background}});
1093  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0,
1095  if (pNPCStats->pProfessions[v1->uProfession]
1096  .pBenefits) { // *(&pNPCStats->field_13A5C + 5 * v1->uProfession) )
1098  480, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0,
1099  localization->GetString(407)); // "More Information"
1100  v0 = 1;
1101  }
1102  pDialogueWindow->CreateButton(0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0,
1103  UIMSG_ClickNPCTopic, 0x4Cu, 0,
1104  localization->GetString(406)); // "Hire"
1107 }
1108 
1109 //----- (004B4224) --------------------------------------------------------
1110 void _4B4224_UpdateNPCTopics(int _this) {
1111  int num_menu_buttons; // ebx@1
1112  int i; // ebp@5
1113  // signed int v4; // ebp@9
1114  int v6; // eax@16
1115  int v8; // eax@21
1116  int v10; // eax@26
1117  int v12; // eax@31
1118  int v14; // eax@36
1119  int v16; // eax@41
1120  NPCData *v17; // [sp+10h] [bp-4h]@4
1121 
1122  num_menu_buttons = 0;
1123  pDialogueNPCCount = (_this + 1);
1124  if (_this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic) {
1126  pDialogueWindow =
1127  new GUIWindow(WINDOW_Dialogue, 0, 0, window->GetWidth(), window->GetHeight(), 0);
1129  411, pMapStats->pInfos[uHouse_ExitPic].pName); // Enter %s
1131  566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N',
1132  localization->GetString(34), {{ui_buttdesc2}}); // "Cancel"
1134  486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y',
1135  transition_button_label.c_str(), {{ui_buttyes2}});
1137  pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,
1138  UIMSG_BF, 1u, 0x20u, transition_button_label.c_str());
1139  pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u,
1140  transition_button_label.c_str());
1141  } else {
1142  v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) ? 1 : 0)]; //+ 1
1145  } else {
1146  for (i = 0; i < uNumDialogueNPCPortraits; ++i)
1147  HouseNPCPortraitsButtonsList[i]->Release();
1148  }
1149  pDialogueWindow = new GUIWindow(WINDOW_Dialogue, 0, 0, window->GetWidth(), 345, 0);
1151  471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
1152  localization->GetString(74), // "End Conversation"
1153  {{ui_exit_cancel_button_background}});
1155  8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "");
1156  if (pDialogueNPCCount == 1 && dword_591080) {
1158  } else {
1159  if (v17->joins) {
1160  num_menu_buttons = 1;
1161  pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0,
1162  UIMSG_ClickNPCTopic, 0xDu, 0, "");
1163  }
1164  if (v17->evt_A) {
1165  if (num_menu_buttons < 4) {
1166  v6 = NPC_EventProcessor(v17->evt_A);
1167  if (v6 == 1 || v6 == 2)
1169  480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1,
1170  0, UIMSG_ClickNPCTopic, 0x13u, 0, "");
1171  }
1172  }
1173  if (v17->evt_B) {
1174  if (num_menu_buttons < 4) {
1175  v8 = NPC_EventProcessor(v17->evt_B);
1176  if (v8 == 1 || v8 == 2)
1178  480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1,
1179  0, UIMSG_ClickNPCTopic, 0x14u, 0, "");
1180  }
1181  }
1182  if (v17->evt_C) {
1183  if (num_menu_buttons < 4) {
1184  v10 = NPC_EventProcessor(v17->evt_C);
1185  if (v10 == 1 || v10 == 2)
1187  480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1,
1188  0, UIMSG_ClickNPCTopic, 0x15u, 0, "");
1189  }
1190  }
1191 
1192  if (v17->evt_D) {
1193  if (num_menu_buttons < 4) {
1194  v12 = NPC_EventProcessor(v17->evt_D);
1195  if (v12 == 1 || v12 == 2)
1197  0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu,
1198  1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "");
1199  }
1200  }
1201  if (v17->evt_E) {
1202  if (num_menu_buttons < 4) {
1203  v14 = NPC_EventProcessor(v17->evt_E);
1204  if (v14 == 1 || v14 == 2)
1206  0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu,
1207  1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "");
1208  }
1209  }
1210  if (v17->evt_F) {
1211  if (num_menu_buttons < 4) {
1212  v16 = NPC_EventProcessor(v17->evt_F);
1213  if (v16 == 1 || v16 == 2)
1215  0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu,
1216  1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "");
1217  }
1218  }
1220  num_menu_buttons, 1, 0, 2);
1222  }
1224  }
1225 }
1226 //----- (004466C4) --------------------------------------------------------
1227 int NPC_EventProcessor(int npc_event_id, int entry_line) {
1228  signed int event_index; // ebp@1
1229  int evt_seq_num; // esi@3
1230  bool ready_to_exit; // [sp+Ch] [bp-Ch]@3
1231  signed int npc_activity; // [sp+10h] [bp-8h]@3
1232  int result;
1233 
1234  event_index = 0;
1235  if (!npc_event_id) return 0;
1236  evt_seq_num = entry_line;
1237  pSomeOtherEVT = pGlobalEVT.data();
1239  memcpy(pSomeOtherEVT_Events.data(), pGlobalEVT_Index.data(),
1240  sizeof(EventIndex) * 4400);
1241  npc_activity = 1;
1242  ready_to_exit = false;
1243  if (uSomeOtherEVT_NumEvents <= 0) return 2;
1244  do {
1245  if ((pSomeOtherEVT_Events[event_index].uEventID == npc_event_id) &&
1246  (pSomeOtherEVT_Events[event_index].event_sequence_num ==
1247  evt_seq_num)) {
1248  _evt_raw *_evt =
1250  .uEventOffsetInEVT];
1251  switch (_evt->_e_type) {
1252  case EVENT_Exit:
1253  // exit
1254  if (ready_to_exit)
1255  result = npc_activity != 0;
1256  else
1257  result = 2;
1258  return result;
1259  break;
1261  ready_to_exit = true;
1262  // v8 = (unsigned __int8)v7[7] + (((unsigned __int8)v7[8] +
1263  // (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8))
1264  // << 8)) << 8);
1265  for (int i = 0; i < 4; ++i) {
1266  // if (pParty->pPlayers[i].CompareVariable((enum
1267  // VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5]
1268  // + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)),
1269  // v8))
1270  if (pParty->pPlayers[i].CompareVariable(
1271  (enum VariableType)EVT_WORD(_evt->v5),
1272  EVT_DWORD(_evt->v7))) {
1273  event_index = -1;
1274  evt_seq_num =
1275  EVT_BYTE(_evt->v11) -
1276  1; // (unsigned __int8)pSomeOtherEVT[v6 + 11] -
1277  // 1;
1278  break;
1279  }
1280  }
1281  break;
1283  if (ready_to_exit)
1284  result = npc_activity != 0;
1285  else
1286  result = 2;
1287  return result;
1288  break;
1290  ready_to_exit = true;
1291  npc_activity =
1292  EVT_BYTE(_evt->v5); // (unsigned __int8)v7[5];
1293  break;
1295  // if (IsActorAlive( (unsigned __int8)v7[5],
1296  // (unsigned __int8)v7[6] + (((unsigned __int8)v7[7] +
1297  // (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8))
1298  // << 8)) << 8),
1299  // (unsigned __int8)v7[10]) )
1300  if (IsActorAlive(
1301  EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6),
1302  EVT_BYTE(_evt->v10))) { // drop linear sequense,
1303  // going to new seq
1304  event_index = -1;
1305  evt_seq_num =
1306  EVT_BYTE(_evt->v11) -
1307  1; // (unsigned __int8)pSomeOtherEVT[v6 + 11] - 1;
1308  }
1309  break;
1310  }
1311  ++evt_seq_num;
1312  }
1313  ++event_index;
1314  } while (event_index < uSomeOtherEVT_NumEvents);
1315  if (ready_to_exit)
1316  result = npc_activity != 0;
1317  else
1318  result = 2;
1319  return result;
1320 }
1321 //----- (00445C8B) --------------------------------------------------------
1322 int GetGreetType(signed int SpeakingNPC_ID) {
1323  int v1; // ebx@1
1324  int v3; // edi@6
1325  int v4; // ecx@6
1326  int v5; // edx@6
1327  NPCData *v6; // eax@6
1328  char *v7; // ebp@11
1329  NPCData *v8; // esi@11
1330 
1331  v1 = 0;
1332  if (SpeakingNPC_ID >= 0) {
1333  if (SpeakingNPC_ID < 5000) return 1; // QuestNPC_greet
1334  return 2; // HiredNPC_greet
1335  }
1336 
1337  if (SpeakingNPC_ID >= 5000) return 2;
1338 
1339  v3 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1;
1340  v4 = 0;
1341  v5 = 0;
1342  v6 = pParty->pHirelings.data();
1343 
1344  char buf[1024];
1345  do {
1346  if (v6->pName) buf[v4++] = v5;
1347  ++v6;
1348  ++v5;
1349  } while ((signed int)v6 < (signed int)&pParty->pPickedItem);
1350  if ((signed int)pNPCStats->uNumNewNPCs > 0) {
1351  v7 = &buf[v4];
1352  v8 = pNPCStats->pNewNPCData;
1353  do {
1354  if (v8->Hired() &&
1355  (!pParty->pHirelings[0].pName ||
1356  strcmp(v8->pName, pParty->pHirelings[0].pName))) {
1357  if (!pParty->pHirelings[1].pName ||
1358  strcmp(v8->pName, pParty->pHirelings[1].pName))
1359  *v7++ = v1 + 2;
1360  }
1361  ++v1;
1362  ++v8;
1363  } while (v1 < (signed int)pNPCStats->uNumNewNPCs);
1364  }
1365  return ((unsigned __int8)buf[v3] < 2) + 1;
1366 }
1367 
1368 //----- (00445308) --------------------------------------------------------
1369 const char *GetProfessionActionText(int a1) {
1370  if (a1 == 10 || a1 == 11 || a1 == 12 || a1 == 33 || a1 == 34 || a1 == 39 ||
1371  a1 == 40 || a1 == 41 || a1 == 42 || a1 == 43 || a1 == 52)
1372  return pNPCStats->pProfessions[a1 - 1].pActionText;
1373  else
1374  return pNPCTopics[407].pTopic;
1375 }
1376 
1377 //----- (004BB756) --------------------------------------------------------
1378 int UseNPCSkill(NPCProf profession) {
1379  switch (profession) {
1380  case Healer: {
1381  for (int i = 0; i < 4; ++i)
1382  pParty->pPlayers[i].sHealth =
1383  pParty->pPlayers[i].GetMaxHealth();
1384  } break;
1385 
1386  case ExpertHealer: {
1387  for (int i = 0; i < 4; ++i) {
1388  pParty->pPlayers[i].sHealth =
1389  pParty->pPlayers[i].GetMaxHealth();
1390 
1391  for (int j = 0; j < 14; ++j)
1392  pParty->pPlayers[i].conditions_times[j].Reset();
1393  pParty->pPlayers[i].conditions_times[Condition_Good].Reset();
1394  }
1395  } break;
1396 
1397  case MasterHealer: {
1398  for (int i = 0; i < 4; ++i) {
1399  __debugbreak(); // Ritor1:needed cleaned(Необходимо почистить)
1400  Player *player = &pParty->pPlayers[i];
1401  pParty->pPlayers[i].sHealth =
1402  pParty->pPlayers[i].GetMaxHealth();
1403 
1404  int v5 = HEXRAYS_LODWORD(
1405  player->conditions_times[19]); // *((int *)v4 - 32);
1406  int v6 = HEXRAYS_HIDWORD(
1407  player->conditions_times[19]); // *((int *)v4 - 31);
1408  memset(&pParty->pPlayers[i].conditions_times, 0,
1409  sizeof(pParty->pPlayers[i].conditions_times));
1410 
1411  *(int *)&player->pActiveSkills[PLAYER_SKILL_SHIELD] = v5;
1412  *(int *)&player->pActiveSkills[PLAYER_SKILL_CHAIN] = v6;
1413  }
1414  } break;
1415 
1416  case Cook: {
1417  if (pParty->GetFood() >= 13) return 1;
1418 
1419  Party::GiveFood(1);
1420  } break;
1421 
1422  case Chef: {
1423  if (pParty->GetFood() >= 13) return 1;
1424 
1425  if (pParty->GetFood() == 13)
1426  Party::GiveFood(1);
1427  else
1428  Party::GiveFood(2);
1429  } break;
1430 
1431  case WindMaster: {
1434  494)); // Can't fly indoors Нельзя применить знание
1435  // Полет в помещении!
1436  pAudioPlayer->PlaySound(SOUND_fizzle, 0, 0, -1, 0, 0);
1437  } else {
1438  int v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536);
1441  v19, 0);
1442  pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1;
1443  pAudioPlayer->PlaySound(SOUND_21fly03, 0, 0, -1, 0, 0);
1444  }
1445  } break;
1446 
1447  case WaterMaster: {
1448  int v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
1450  GameTime(pParty->GetPlayingTime() + GameTime::FromHours(3)), 3, 0, v20,
1451  0);
1453  pAudioPlayer->PlaySound(SOUND_WaterWalk, 0, 0, -1, 0, 0);
1454  } break;
1455 
1456  case GateMaster: {
1457  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
1458  dword_50C9DC = 195;
1460  } break;
1461 
1462  case Acolyte:
1464  break;
1465  case Piper:
1467  break;
1468  case FallenWizard:
1470  break;
1471 
1472  case Teacher:
1473  case Instructor:
1474  case Armsmaster:
1475  case Weaponsmaster:
1476  case Apprentice:
1477  case Mystic:
1478  case Spellmaster:
1479  case Trader:
1480  case Merchant:
1481  case Scout:
1482  case Herbalist:
1483  case Apothecary:
1484  case Tinker:
1485  case Locksmith:
1486  case Fool:
1487  case ChimneySweep:
1488  case Porter:
1489  case QuarterMaster:
1490  case Factor:
1491  case Banker:
1492  case Horseman:
1493  case Bard:
1494  case Enchanter:
1495  case Cartographer:
1496  case Explorer:
1497  case Pirate:
1498  case Squire:
1499  case Psychic:
1500  case Gypsy:
1501  case Diplomat:
1502  case Duper:
1503  case Burglar:
1504  case Acolyte2:
1505  case Initiate:
1506  case Prelate:
1507  case Monk:
1508  case Sage:
1509  case Hunter:
1510  break;
1511 
1512  default:
1513  assert(false && "Invalid enum value");
1514  }
1515  return 0;
1516 }
EVENT_IsActorAssasinated
@ EVENT_IsActorAssasinated
Definition: Events.h:108
Party::pPickedItem
ItemGen pPickedItem
Definition: Party.h:312
uNumDialogueNPCPortraits
int uNumDialogueNPCPortraits
Definition: NPC.cpp:28
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
pMerchantsIdentifyPhrases
std::array< const char *, 7 > pMerchantsIdentifyPhrases
Definition: mm7_data.cpp:751
AUTONOTE_MISC
@ AUTONOTE_MISC
Definition: Autonotes.h:10
AUTONOTE_OBELISK
@ AUTONOTE_OBELISK
Definition: Autonotes.h:8
Player
Definition: Player.h:401
transition_button_label
String transition_button_label
Definition: UITransition.cpp:30
SOUND_fizzle
@ SOUND_fizzle
Definition: AudioPlayer.h:74
GetNPCData
NPCData * GetNPCData(signed int npcid)
Definition: NPC.cpp:43
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
NPCData::uProfession
unsigned int uProfession
Definition: NPC.h:89
NPCStats::uNumNPCProfessions
unsigned int uNumNPCProfessions
Definition: NPC.h:181
RemoveQuotes
char * RemoveQuotes(char *str)
Definition: Strings.h:17
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
NPCProfession::uHirePrice
unsigned int uHirePrice
Definition: NPC.h:115
MapStats::pInfos
MapInfo pInfos[77]
Definition: MapInfo.h:79
LOD.h
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
EVENT_Exit
@ EVENT_Exit
Definition: Events.h:61
pAwardsTXT_Raw
char * pAwardsTXT_Raw
Definition: mm7_data.cpp:745
PartyHasDragon
bool PartyHasDragon()
Definition: NPC.cpp:750
Teacher
@ Teacher
Definition: NPC.h:18
NPCGreeting::pGreetings
char * pGreetings[2]
Definition: NPC.h:139
Tinker
@ Tinker
Definition: NPC.h:30
GUIWindow
Definition: GUIWindow.h:433
Pirate
@ Pirate
Definition: NPC.h:50
AUTONOTE_STAT_HINT
@ AUTONOTE_STAT_HINT
Definition: Autonotes.h:7
Monk
@ Monk
Definition: NPC.h:65
NPCData::uFlags
unsigned int uFlags
Definition: NPC.h:84
UIMSG_ClickNPCTopic
@ UIMSG_ClickNPCTopic
Definition: GUIWindow.h:142
HouseNPCData
std::array< struct NPCData *, 7 > HouseNPCData
Definition: mm7_data.cpp:617
_evt_raw::v7
unsigned char v7
Definition: Events.h:29
NPCData::Hired
bool Hired()
Definition: NPC.h:80
NPCStats::InitializeAdditionalNPCs
void InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId)
Definition: NPC.cpp:582
NPCStats::pNPCNames
char * pNPCNames[540][2]
Definition: NPC.h:166
uSomeOtherEVT_NumEvents
signed int uSomeOtherEVT_NumEvents
Definition: Events.cpp:37
dword_50C9DC
int dword_50C9DC
Definition: mm7_data.cpp:583
_449B57_test_bit
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
Definition: Party.cpp:1185
GUIWindow::CreateButton
GUIButton * CreateButton(int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
Definition: GUIWindow.cpp:717
dialog_menu_id
HOUSE_DIALOGUE_MENU dialog_menu_id
Definition: UIHouses.cpp:50
gold_transaction_amount
int gold_transaction_amount
Definition: mm7_data.cpp:775
LOD::File::LoadCompressedTexture
void * LoadCompressedTexture(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:921
SPELL_LIGHT_HOUR_OF_POWER
@ SPELL_LIGHT_HOUR_OF_POWER
Definition: Spells.h:105
OtherOverlayList::_4418B1
int _4418B1(int a2, int a3, int a4, int a5)
Definition: Overlays.cpp:29
Psychic
@ Psychic
Definition: NPC.h:53
GetGreetType
int GetGreetType(signed int SpeakingNPC_ID)
Definition: NPC.cpp:1322
NPCStats::pNPCDataTXT_Raw
char * pNPCDataTXT_Raw
Definition: NPC.h:183
pNPCTopics
std::array< NPCTopic, 789 > pNPCTopics
Definition: mm7_data.cpp:740
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
InitializeMerchants
void InitializeMerchants()
Definition: NPC.cpp:852
pTransitionStrings
std::array< char *, 465 > pTransitionStrings
Definition: mm7_data.cpp:309
Diplomat
@ Diplomat
Definition: NPC.h:55
NPCData::evt_B
unsigned int evt_B
Definition: NPC.h:94
NPCStats::pNPCUnicNames
char * pNPCUnicNames[500]
Definition: NPC.h:170
NPCStats::pNPCNewsTXT_Raw
char * pNPCNewsTXT_Raw
Definition: NPC.h:186
bNoNPCHiring
char bNoNPCHiring
Definition: mm7_data.cpp:720
NPCProfession::pActionText
char * pActionText
Definition: NPC.h:117
NPCStats::uNumNPCNames
unsigned int uNumNPCNames[2]
Definition: NPC.h:182
localization
Localization * localization
Definition: Localization.cpp:11
Overlays.h
PARTY_BUFF_WATER_WALK
@ PARTY_BUFF_WATER_WALK
Definition: Party.h:89
Instructor
@ Instructor
Definition: NPC.h:19
pNPCPortraits_y
std::array< std::array< int, 6 >, 6 > pNPCPortraits_y
Definition: mm7_data.cpp:290
Burglar
@ Burglar
Definition: NPC.h:57
_evt_raw::_e_type
unsigned char _e_type
Definition: Events.h:26
NPCStats::sub_495366_MispronounceName
char * sub_495366_MispronounceName(uint8_t firstLetter, uint8_t genderId)
Definition: NPC.cpp:714
InitializaDialogueOptions
void InitializaDialogueOptions(BuildingType type)
Definition: UIHouses.cpp:442
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
pNPCPortraits_x
std::array< std::array< int, 6 >, 6 > pNPCPortraits_x
Definition: mm7_data.cpp:282
FallenWizard
@ FallenWizard
Definition: NPC.h:58
InitializeScrolls
void InitializeScrolls()
Definition: NPC.cpp:814
GUIWindow::Release
virtual void Release()
Definition: GUIWindow.cpp:292
NPCStats::Release
void Release()
Definition: NPC.cpp:556
Apothecary
@ Apothecary
Definition: NPC.h:29
NPCData::evt_E
unsigned int evt_E
Definition: NPC.h:97
HouseNPCPortraitsButtonsList
GUIButton * HouseNPCPortraitsButtonsList[6]
Definition: mm7_data.cpp:618
pTransitionsTXT_Raw
char * pTransitionsTXT_Raw
Definition: mm7_data.cpp:752
NPCData::evt_C
unsigned int evt_C
Definition: NPC.h:95
Player::pActiveSkills
std::array< unsigned __int16, 37 > pActiveSkills
Definition: Player.h:711
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
WaterMaster
@ WaterMaster
Definition: NPC.h:45
dword_591080
int dword_591080
Definition: UIHouses.cpp:47
NPCStats::pNCPGroupTXT_Raw
char * pNCPGroupTXT_Raw
Definition: NPC.h:191
pGlobalEVT
std::array< char, 46080 > pGlobalEVT
Definition: Events.cpp:45
GetProfessionActionText
const char * GetProfessionActionText(int a1)
Definition: NPC.cpp:1369
Engine.h
dword_F8B1E0
int dword_F8B1E0
Definition: mm7_data.cpp:778
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
EventIndex
Definition: Events.h:6
pMapStats
struct MapStats * pMapStats
Definition: mm7_data.cpp:20
Party::pPartyBuffs
std::array< SpellBuff, 20 > pPartyBuffs
Definition: Party.h:309
GameTime::FromHours
static GameTime FromHours(int hours)
Definition: Time.h:89
_42777D_CastSpell_UseWand_ShootArrow
void _42777D_CastSpell_UseWand_ShootArrow(SPELL_TYPE spell, unsigned int uPlayerID, unsigned int a4, __int16 flags, int a6)
Definition: CastSpellInfo.cpp:4369
uHouse_ExitPic
int uHouse_ExitPic
Definition: UIHouses.cpp:45
GUIWindow::_41D08F_set_keyboard_control_group
void _41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5)
Definition: GUIWindow.cpp:273
NPC.h
InitializeAutonotes
void InitializeAutonotes()
Definition: NPC.cpp:945
Events.h
ContractSelectText
const char * ContractSelectText(int pEventCode)
Definition: NPC.cpp:1052
NPCProfessionChance::uTotalprofChance
unsigned int uTotalprofChance
Definition: NPC.h:126
CheckPortretAgainstSex
bool CheckPortretAgainstSex(int portret_num, int sex)
Definition: NPC.cpp:578
pAutonoteTXT_Raw
char * pAutonoteTXT_Raw
Definition: mm7_data.cpp:753
Actor.h
UIHouses.h
pSomeOtherEVT_Events
std::array< EventIndex, 4400 > pSomeOtherEVT_Events
Definition: Events.cpp:36
SOUND_21fly03
@ SOUND_21fly03
Definition: AudioPlayer.h:97
in_current_building_type
BuildingType in_current_building_type
Definition: UIHouses.cpp:49
NPCStats::pNPCNamesTXT_Raw
char * pNPCNamesTXT_Raw
Definition: NPC.h:184
Localization.h
NPCData::evt_A
unsigned int evt_A
Definition: NPC.h:93
_evt_raw::v6
unsigned char v6
Definition: Events.h:28
SOUND_WaterWalk
@ SOUND_WaterWalk
Definition: AudioPlayer.h:98
NPCStats::pCatchPhrases
char * pCatchPhrases[52]
Definition: NPC.h:169
NPCData::evt_D
unsigned int evt_D
Definition: NPC.h:96
NPCStats::uNumNewNPCs
unsigned int uNumNewNPCs
Definition: NPC.h:179
WindMaster
@ WindMaster
Definition: NPC.h:44
uGlobalEVT_NumEvents
unsigned int uGlobalEVT_NumEvents
Definition: Events.cpp:43
Acolyte2
@ Acolyte2
Definition: NPC.h:59
contract_approved
int contract_approved
Definition: mm7_data.cpp:772
Merchant
@ Merchant
Definition: NPC.h:26
InitializeAwards
void InitializeAwards()
Definition: NPC.cpp:771
NPC_EventProcessor
int NPC_EventProcessor(int npc_event_id, int entry_line)
Definition: NPC.cpp:1227
GUIButton.h
InitializeQuests
void InitializeQuests()
Definition: NPC.cpp:1012
pBtn_ExitCancel
GUIButton * pBtn_ExitCancel
Definition: GUIButton.cpp:28
ptr_50C9E0
struct NPCData * ptr_50C9E0
Definition: mm7_data.cpp:584
pGlobalEVT_Index
std::array< EventIndex, 4400 > pGlobalEVT_Index
Definition: Events.cpp:46
pBtn_YES
GUIButton * pBtn_YES
Definition: GUIButton.cpp:29
pParty
Party * pParty
Definition: Party.cpp:30
HOUSE_DIALOGUE_MAIN
@ HOUSE_DIALOGUE_MAIN
Definition: UIHouses.h:8
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: SDL_opengl_glext.h:2483
Herbalist
@ Herbalist
Definition: NPC.h:28
AUTONOTE_POTION_RECEPIE
@ AUTONOTE_POTION_RECEPIE
Definition: Autonotes.h:6
pQuestsTXT_Raw
char * pQuestsTXT_Raw
Definition: mm7_data.cpp:754
NPCStats::pNPCProfTXT_Raw
char * pNPCProfTXT_Raw
Definition: NPC.h:185
NPCData::pName
char * pName
Definition: NPC.h:82
NPCStats::pNewNPCData
NPCData pNewNPCData[501]
Definition: NPC.h:165
Mystic
@ Mystic
Definition: NPC.h:23
GUIWindow::pNumPresenceButton
int pNumPresenceButton
Definition: GUIWindow.h:481
Banker
@ Banker
Definition: NPC.h:37
Gypsy
@ Gypsy
Definition: NPC.h:54
NPCStats::pProfessions
NPCProfession pProfessions[59]
Definition: NPC.h:167
NPCStats::pNPCGreetings
NPCGreeting pNPCGreetings[205]
Definition: NPC.h:175
Party::pHireling2Name
char pHireling2Name[100]
Definition: Party.h:319
NPCStats::pNPCData
NPCData pNPCData[501]
Definition: NPC.h:164
Trader
@ Trader
Definition: NPC.h:25
ExpertHealer
@ ExpertHealer
Definition: NPC.h:16
pScrollsTXT_Raw
char * pScrollsTXT_Raw
Definition: mm7_data.cpp:746
Indoor.h
EVENT_EndCanShowDialogItem
@ EVENT_EndCanShowDialogItem
Definition: Events.h:101
Cook
@ Cook
Definition: NPC.h:38
NPCStats::InitializeNPCData
void InitializeNPCData()
Definition: NPC.cpp:284
WINDOW_Dialogue
@ WINDOW_Dialogue
Definition: GUIWindow.h:298
NPCStats::uNewlNPCBufPos
unsigned int uNewlNPCBufPos
Definition: NPC.h:178
IsActorAlive
int IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive)
Definition: Actor.cpp:3240
v1
GLfloat GLfloat v1
Definition: SDL_opengl_glext.h:694
Cartographer
@ Cartographer
Definition: NPC.h:43
Bard
@ Bard
Definition: NPC.h:41
Log::Warning
void Warning(const wchar_t *pFormat,...)
Definition: Log.cpp:28
Weaponsmaster
@ Weaponsmaster
Definition: NPC.h:21
pQuestTable
std::array< const char *, 513 > pQuestTable
Definition: mm7_data.cpp:741
Party.h
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
NPCProf
NPCProf
Definition: NPC.h:5
NPCData::rep
int rep
Definition: NPC.h:87
AUTONOTE_SEER
@ AUTONOTE_SEER
Definition: Autonotes.h:9
MapInfo::pName
String pName
Definition: MapInfo.h:38
_evt_raw::v10
unsigned char v10
Definition: Events.h:32
NPCStats::pAdditionalNPC
NPCData pAdditionalNPC[100]
Definition: NPC.h:168
NPCData::fame
int fame
Definition: NPC.h:86
HOUSE_DIALOGUE_OTHER
@ HOUSE_DIALOGUE_OTHER
Definition: UIHouses.h:46
GetNewNPCData
struct NPCData * GetNewNPCData(signed int npcid, int *npc_indx)
Definition: NPC.cpp:99
pMerchantsSellPhrases
std::array< const char *, 7 > pMerchantsSellPhrases
Definition: mm7_data.cpp:749
EVENT_SetCanShowDialogItem
@ EVENT_SetCanShowDialogItem
Definition: Events.h:102
NPCData
Definition: NPC.h:79
pScrolls
std::array< const char *, 82 > pScrolls
Definition: mm7_data.cpp:743
_4B4224_UpdateNPCTopics
void _4B4224_UpdateNPCTopics(int _this)
Definition: NPC.cpp:1110
UIMSG_BuyInShop_Identify_Repair
@ UIMSG_BuyInShop_Identify_Repair
Definition: GUIWindow.h:66
pDialogueNPCCount
int pDialogueNPCCount
Definition: NPC.cpp:26
Armsmaster
@ Armsmaster
Definition: NPC.h:20
Squire
@ Squire
Definition: NPC.h:52
Party::GetFood
int GetFood() const
Definition: Party.cpp:272
NPCStats::pNPCGreetTXT_Raw
char * pNPCGreetTXT_Raw
Definition: NPC.h:190
NPCProfessionChance::professionChancePerArea
char professionChancePerArea[60]
Definition: NPC.h:127
Autonotes.h
AUTONOTE_TEACHER
@ AUTONOTE_TEACHER
Definition: Autonotes.h:11
Scout
@ Scout
Definition: NPC.h:27
dword_F8B1AC_award_bit_number
int dword_F8B1AC_award_bit_number
Definition: mm7_data.cpp:773
NPCData::uPortraitID
unsigned int uPortraitID
Definition: NPC.h:83
PLAYER_SKILL_SHIELD
@ PLAYER_SKILL_SHIELD
Definition: Player.h:179
pEvents_LOD
LODFile_IconsBitmaps * pEvents_LOD
Definition: LOD.cpp:10
Sage
@ Sage
Definition: NPC.h:66
NPCStats::_476C60_on_load_game
void _476C60_on_load_game()
Definition: NPC.cpp:273
Hunter
@ Hunter
Definition: NPC.h:67
Explorer
@ Explorer
Definition: NPC.h:49
MasterHealer
@ MasterHealer
Definition: NPC.h:17
LEVEL_Indoor
@ LEVEL_Indoor
Definition: Indoor.h:286
pMerchantsTXT_Raw
char * pMerchantsTXT_Raw
Definition: mm7_data.cpp:747
NPCData::Location2D
unsigned int Location2D
Definition: NPC.h:88
Party::pHirelings
std::array< NPCData, 2 > pHirelings
Definition: Party.h:311
AudioPlayer.h
Horseman
@ Horseman
Definition: NPC.h:40
pDialogueNPCPortraits
std::array< class Image *, 6 > pDialogueNPCPortraits
Definition: NPC.cpp:27
Player::conditions_times
std::array< GameTime, 20 > conditions_times
Definition: Player.h:635
SPELL_SPIRIT_BLESS
@ SPELL_SPIRIT_BLESS
Definition: Spells.h:62
_evt_raw::v11
unsigned char v11
Definition: Events.h:33
GateMaster
@ GateMaster
Definition: NPC.h:46
Party::pHireling1Name
char pHireling1Name[100]
Definition: Party.h:318
MapInfo.h
Initiate
@ Initiate
Definition: NPC.h:61
uint8_t
unsigned __int8 uint8_t
Definition: SDL_config.h:35
PLAYER_SKILL_CHAIN
@ PLAYER_SKILL_CHAIN
Definition: Player.h:181
Factor
@ Factor
Definition: NPC.h:36
NPCProfession::pDismissText
char * pDismissText
Definition: NPC.h:119
Healer
@ Healer
Definition: NPC.h:15
NPCProfession::pJoinText
char * pJoinText
Definition: NPC.h:118
EVENT_OnCanShowDialogItemCmp
@ EVENT_OnCanShowDialogItemCmp
Definition: Events.h:100
NPCStats::dword_AE3370_LastMispronouncedNameResult
static int dword_AE3370_LastMispronouncedNameResult
Definition: NPC.h:194
Prelate
@ Prelate
Definition: NPC.h:63
VariableType
VariableType
Definition: Events.h:128
pOtherOverlayList
struct OtherOverlayList * pOtherOverlayList
Definition: Overlays.cpp:19
NPCData::greet
int greet
Definition: NPC.h:90
UIMSG_BF
@ UIMSG_BF
Definition: GUIWindow.h:158
NPCStats::Initialize
void Initialize()
Definition: NPC.cpp:445
pSomeOtherEVT
char * pSomeOtherEVT
Definition: Events.cpp:38
Acolyte
@ Acolyte
Definition: NPC.h:47
Fool
@ Fool
Definition: NPC.h:32
UIStatusBar.h
NPCStats::pNPCTopicTXT_Raw
char * pNPCTopicTXT_Raw
Definition: NPC.h:187
Awards.h
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
uint
unsigned int uint
Definition: MM7.h:4
UITransition.h
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
Localization::FormatString
String FormatString(unsigned int index,...) const
Definition: Localization.cpp:17
NPCData::evt_F
unsigned int evt_F
Definition: NPC.h:98
__debugbreak
void __cdecl __debugbreak(void)
_evt_raw
Definition: Events.h:20
NPCStats::InitializeNPCText
void InitializeNPCText()
Definition: NPC.cpp:158
NPCData::joins
int joins
Definition: NPC.h:91
pNPCStats
struct NPCStats * pNPCStats
Definition: NPC.cpp:29
NPCStats::pProfessionChance
NPCProfessionChance pProfessionChance[77]
Definition: NPC.h:172
GameUI_StatusBar_OnEvent
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
Definition: UIStatusBar.cpp:33
price_for_membership
std::array< int, 11 > price_for_membership
Definition: mm7_data.cpp:494
PARTY_BUFF_FLY
@ PARTY_BUFF_FLY
Definition: Party.h:78
Condition_Good
@ Condition_Good
Definition: Conditions.h:26
_evt_raw::v5
unsigned char v5
Definition: Events.h:27
Locksmith
@ Locksmith
Definition: NPC.h:31
Duper
@ Duper
Definition: NPC.h:56
NPCProfession::pBenefits
char * pBenefits
Definition: NPC.h:116
uCurrentlyLoadedLevelType
LEVEL_TYPE uCurrentlyLoadedLevelType
Definition: Indoor.cpp:52
Party::GetFirstCanAct
int GetFirstCanAct()
Definition: Party.cpp:156
pMerchantsBuyPhrases
std::array< const char *, 7 > pMerchantsBuyPhrases
Definition: mm7_data.cpp:748
Chef
@ Chef
Definition: NPC.h:39
ChimneySweep
@ ChimneySweep
Definition: NPC.h:33
Apprentice
@ Apprentice
Definition: NPC.h:22
CheckHiredNPCSpeciality
bool CheckHiredNPCSpeciality(unsigned int uProfession)
Definition: NPC.cpp:754
Porter
@ Porter
Definition: NPC.h:34
pMerchantsRepairPhrases
std::array< const char *, 7 > pMerchantsRepairPhrases
Definition: mm7_data.cpp:750
NPCStats::dword_AE336C_LastMispronouncedNameFirstLetter
static int dword_AE336C_LastMispronouncedNameFirstLetter
Definition: NPC.h:193
Enchanter
@ Enchanter
Definition: NPC.h:42
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
v0
GLfloat v0
Definition: SDL_opengl_glext.h:693
pMessageQueue_50CBD0
struct GUIMessageQueue * pMessageQueue_50CBD0
Definition: GUIWindow.cpp:86
logger
Log * logger
Definition: IocContainer.cpp:47
pAutonoteTxt
std::array< Autonote, 196 > pAutonoteTxt
Definition: mm7_data.cpp:25
pAwards
std::array< Award, 105 > pAwards
Definition: mm7_data.cpp:26
pDialogueWindow
GUIWindow * pDialogueWindow
Definition: GUIWindow.cpp:50
QuarterMaster
@ QuarterMaster
Definition: NPC.h:35
UseNPCSkill
int UseNPCSkill(NPCProf profession)
Definition: NPC.cpp:1378
NPCStats::pGroups
uint16_t pGroups[51]
Definition: NPC.h:176
NPCStats::pNPCDistTXT_Raw
char * pNPCDistTXT_Raw
Definition: NPC.h:189
NPCStats::pNPCTextTXT_Raw
char * pNPCTextTXT_Raw
Definition: NPC.h:188
NPCHireableDialogPrepare
void NPCHireableDialogPrepare()
Definition: NPC.cpp:1080
NPCData::uSex
unsigned int uSex
Definition: NPC.h:99
Piper
@ Piper
Definition: NPC.h:48
NPCData::field_24
int field_24
Definition: NPC.h:92
GameTime
Definition: Time.h:14
SPELL_SPIRIT_HEROISM
@ SPELL_SPIRIT_HEROISM
Definition: Spells.h:67
Spellmaster
@ Spellmaster
Definition: NPC.h:24
sDialogue_SpeakingActorNPC_ID
int sDialogue_SpeakingActorNPC_ID
Definition: mm7_data.cpp:605
CastSpellInfo.h
Api.h
InitializeTransitions
void InitializeTransitions()
Definition: NPC.cpp:905
Party::GiveFood
static void GiveFood(int amount)
Definition: Party.cpp:255
NPCStats
Definition: NPC.h:146