World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Структура NPCStats

#include <NPC.h>

+ Граф связей класса NPCStats:

Открытые члены

 NPCStats ()
 
void InitializeNPCText ()
 
void InitializeNPCData ()
 
void Initialize ()
 
void Release ()
 
void InitializeAdditionalNPCs (NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId)
 
void _476C60_on_load_game ()
 
char * sub_495366_MispronounceName (uint8_t firstLetter, uint8_t genderId)
 

Открытые атрибуты

NPCData pNPCData [501]
 
NPCData pNewNPCData [501]
 
char * pNPCNames [540][2]
 
NPCProfession pProfessions [59]
 
NPCData pAdditionalNPC [100]
 
char * pCatchPhrases [52]
 
char * pNPCUnicNames [500]
 
NPCProfessionChance pProfessionChance [77]
 
int field_17884
 
int field_17888
 
NPCGreeting pNPCGreetings [205]
 
uint16_t pGroups [51]
 
uint16_t pGroups_copy [51]
 
unsigned int uNewlNPCBufPos
 
unsigned int uNumNewNPCs
 
int field_17FC8
 
unsigned int uNumNPCProfessions
 
unsigned int uNumNPCNames [2]
 
char * pNPCDataTXT_Raw
 
char * pNPCNamesTXT_Raw
 
char * pNPCProfTXT_Raw
 
char * pNPCNewsTXT_Raw
 
char * pNPCTopicTXT_Raw
 
char * pNPCTextTXT_Raw
 
char * pNPCDistTXT_Raw
 
char * pNPCGreetTXT_Raw
 
char * pNCPGroupTXT_Raw
 

Статические открытые данные

static int dword_AE336C_LastMispronouncedNameFirstLetter = -1
 
static int dword_AE3370_LastMispronouncedNameResult = -1
 

Подробное описание

См. определение в файле NPC.h строка 146

Конструктор(ы)

◆ NPCStats()

NPCStats::NPCStats ( )
inline

См. определение в файле NPC.h строка 147

148  : pNPCTopicTXT_Raw(nullptr),
149  pNPCTextTXT_Raw(nullptr),
150  pNPCDistTXT_Raw(nullptr) {
151  uNumNPCNames[0] = uNumNPCNames[1] = 0;
152  }

Перекрестные ссылки uNumNPCNames.

Методы

◆ InitializeNPCText()

void NPCStats::InitializeNPCText ( )

См. определение в файле NPC.cpp строка 158

158  {
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 }

Перекрестные ссылки LOD::File::LoadCompressedTexture(), pEvents_LOD, pNPCDistTXT_Raw, pNPCTextTXT_Raw, pNPCTopics, pNPCTopicTXT_Raw, pProfessionChance, NPCProfessionChance::professionChancePerArea, RemoveQuotes() и NPCProfessionChance::uTotalprofChance.

Используется в Initialize().

+ Граф вызовов:
+ Граф вызова функции:

◆ InitializeNPCData()

void NPCStats::InitializeNPCData ( )

См. определение в файле NPC.cpp строка 284

284  {
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 }

Перекрестные ссылки NPCData::evt_A, NPCData::evt_B, NPCData::evt_C, NPCData::evt_D, NPCData::evt_E, NPCData::evt_F, NPCData::greet, NPCData::joins, LOD::File::LoadCompressedTexture(), NPCData::Location2D, pCatchPhrases, pEvents_LOD, NPCGreeting::pGreetings, pGroups, NPCData::pName, pNCPGroupTXT_Raw, pNPCData, pNPCDataTXT_Raw, pNPCGreetings, pNPCGreetTXT_Raw, pNPCNewsTXT_Raw, pNPCUnicNames, RemoveQuotes(), uNumNewNPCs, NPCData::uPortraitID и NPCData::uProfession.

Используется в Initialize().

+ Граф вызовов:
+ Граф вызова функции:

◆ Initialize()

void NPCStats::Initialize ( )

См. определение в файле NPC.cpp строка 445

445  {
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 }

Перекрестные ссылки InitializeAutonotes(), InitializeAwards(), InitializeMerchants(), InitializeNPCData(), InitializeNPCText(), InitializeQuests(), InitializeScrolls(), InitializeTransitions(), LOD::File::LoadCompressedTexture(), NPCProfession::pActionText, NPCProfession::pBenefits, NPCProfession::pDismissText, pEvents_LOD, NPCProfession::pJoinText, pNPCNames, pNPCNamesTXT_Raw, pNPCProfTXT_Raw, pProfessions, RemoveQuotes(), NPCProfession::uHirePrice, uNewlNPCBufPos, uNumNPCNames и uNumNPCProfessions.

Используется в Engine::SecondaryInitialization().

+ Граф вызовов:
+ Граф вызова функции:

◆ Release()

void NPCStats::Release ( )

См. определение в файле NPC.cpp строка 556

556  {
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 }

Перекрестные ссылки pNCPGroupTXT_Raw, pNPCDataTXT_Raw, pNPCDistTXT_Raw, pNPCGreetTXT_Raw, pNPCNamesTXT_Raw, pNPCNewsTXT_Raw, pNPCProfTXT_Raw, pNPCTextTXT_Raw и pNPCTopicTXT_Raw.

Используется в Engine::Deinitialize().

+ Граф вызова функции:

◆ InitializeAdditionalNPCs()

void NPCStats::InitializeAdditionalNPCs ( NPCData pNPCDataBuff,
int  npc_uid,
int  uLocation2D,
int  uMapId 
)

См. определение в файле NPC.cpp строка 582

583  {
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 }

Перекрестные ссылки CheckPortretAgainstSex(), NPCData::evt_A, NPCData::evt_B, NPCData::evt_C, NPCData::evt_D, NPCData::evt_E, NPCData::evt_F, NPCData::fame, NPCData::field_24, NPCData::joins, NPCData::Location2D, NPCData::pName, pNPCNames, pProfessionChance, NPCProfessionChance::professionChancePerArea, NPCData::rep, NPCData::uFlags, uNumNPCNames, NPCData::uPortraitID, NPCData::uProfession, NPCData::uSex и NPCProfessionChance::uTotalprofChance.

Используется в Engine::_461103_load_level_sub().

+ Граф вызовов:
+ Граф вызова функции:

◆ _476C60_on_load_game()

void NPCStats::_476C60_on_load_game ( )

См. определение в файле NPC.cpp строка 273

273  {
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 }

Перекрестные ссылки Party::pHireling1Name, Party::pHireling2Name, Party::pHirelings, NPCData::pName, pNewNPCData, pNPCUnicNames, pParty и uNumNewNPCs.

Используется в LoadGame().

+ Граф вызова функции:

◆ sub_495366_MispronounceName()

char * NPCStats::sub_495366_MispronounceName ( uint8_t  firstLetter,
uint8_t  genderId 
)

См. определение в файле NPC.cpp строка 714

715  {
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 }

Перекрестные ссылки dword_AE336C_LastMispronouncedNameFirstLetter, dword_AE3370_LastMispronouncedNameResult, pNPCNames и uNumNPCNames.

Используется в BuildDialogueString().

+ Граф вызова функции:

Данные класса

◆ pNPCData

NPCData NPCStats::pNPCData[501]

См. определение в файле NPC.h строка 164

Используется в GameUI_DrawHiredNPCs(), GetNPCData(), InitializeNPCData(), Party::PartyFindsGold(), Party::Reset() и Engine::SecondaryInitialization().

◆ pNewNPCData

◆ pNPCNames

char* NPCStats::pNPCNames[540][2]

См. определение в файле NPC.h строка 166

Используется в Initialize(), InitializeAdditionalNPCs(), Player::RandomizeName() и sub_495366_MispronounceName().

◆ pProfessions

◆ pAdditionalNPC

NPCData NPCStats::pAdditionalNPC[100]

См. определение в файле NPC.h строка 168

Используется в Engine::_461103_load_level_sub(), GetNewNPCData() и GetNPCData().

◆ pCatchPhrases

char* NPCStats::pCatchPhrases[52]

См. определение в файле NPC.h строка 169

Используется в ActorInteraction() и InitializeNPCData().

◆ pNPCUnicNames

char* NPCStats::pNPCUnicNames[500]

См. определение в файле NPC.h строка 170

Используется в _476C60_on_load_game() и InitializeNPCData().

◆ pProfessionChance

NPCProfessionChance NPCStats::pProfessionChance[77]

См. определение в файле NPC.h строка 172

Используется в InitializeAdditionalNPCs() и InitializeNPCText().

◆ field_17884

int NPCStats::field_17884

См. определение в файле NPC.h строка 173

◆ field_17888

int NPCStats::field_17888

См. определение в файле NPC.h строка 174

◆ pNPCGreetings

NPCGreeting NPCStats::pNPCGreetings[205]

См. определение в файле NPC.h строка 175

Используется в InitializeNPCData(), SimpleHouseDialog() и GUIWindow_Dialogue::Update().

◆ pGroups

uint16_t NPCStats::pGroups[51]

См. определение в файле NPC.h строка 176

Используется в InitializeNPCData() и Party::Reset().

◆ pGroups_copy

uint16_t NPCStats::pGroups_copy[51]

См. определение в файле NPC.h строка 177

Используется в ActorInteraction(), EventProcessor(), LoadGame(), Party::Reset() и SaveGame().

◆ uNewlNPCBufPos

unsigned int NPCStats::uNewlNPCBufPos

См. определение в файле NPC.h строка 178

Используется в Engine::_461103_load_level_sub() и Initialize().

◆ uNumNewNPCs

◆ field_17FC8

int NPCStats::field_17FC8

См. определение в файле NPC.h строка 180

◆ uNumNPCProfessions

unsigned int NPCStats::uNumNPCProfessions

См. определение в файле NPC.h строка 181

Используется в Initialize().

◆ uNumNPCNames

unsigned int NPCStats::uNumNPCNames[2]

См. определение в файле NPC.h строка 182

Используется в Initialize(), InitializeAdditionalNPCs(), NPCStats(), Player::RandomizeName() и sub_495366_MispronounceName().

◆ pNPCDataTXT_Raw

char* NPCStats::pNPCDataTXT_Raw

См. определение в файле NPC.h строка 183

Используется в InitializeNPCData() и Release().

◆ pNPCNamesTXT_Raw

char* NPCStats::pNPCNamesTXT_Raw

См. определение в файле NPC.h строка 184

Используется в Initialize() и Release().

◆ pNPCProfTXT_Raw

char* NPCStats::pNPCProfTXT_Raw

См. определение в файле NPC.h строка 185

Используется в Initialize() и Release().

◆ pNPCNewsTXT_Raw

char* NPCStats::pNPCNewsTXT_Raw

См. определение в файле NPC.h строка 186

Используется в InitializeNPCData() и Release().

◆ pNPCTopicTXT_Raw

char* NPCStats::pNPCTopicTXT_Raw

См. определение в файле NPC.h строка 187

Используется в InitializeNPCText() и Release().

◆ pNPCTextTXT_Raw

char* NPCStats::pNPCTextTXT_Raw

См. определение в файле NPC.h строка 188

Используется в InitializeNPCText() и Release().

◆ pNPCDistTXT_Raw

char* NPCStats::pNPCDistTXT_Raw

См. определение в файле NPC.h строка 189

Используется в InitializeNPCText() и Release().

◆ pNPCGreetTXT_Raw

char* NPCStats::pNPCGreetTXT_Raw

См. определение в файле NPC.h строка 190

Используется в InitializeNPCData() и Release().

◆ pNCPGroupTXT_Raw

char* NPCStats::pNCPGroupTXT_Raw

См. определение в файле NPC.h строка 191

Используется в InitializeNPCData() и Release().

◆ dword_AE336C_LastMispronouncedNameFirstLetter

int NPCStats::dword_AE336C_LastMispronouncedNameFirstLetter = -1
static

См. определение в файле NPC.h строка 193

Используется в GameUI_InitializeDialogue() и sub_495366_MispronounceName().

◆ dword_AE3370_LastMispronouncedNameResult

int NPCStats::dword_AE3370_LastMispronouncedNameResult = -1
static

См. определение в файле NPC.h строка 194

Используется в sub_495366_MispronounceName().


Объявления и описания членов структур находятся в файлах:
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
NPCProfession::uHirePrice
unsigned int uHirePrice
Definition: NPC.h:115
NPCGreeting::pGreetings
char * pGreetings[2]
Definition: NPC.h:139
NPCData::uFlags
unsigned int uFlags
Definition: NPC.h:84
NPCStats::pNPCNames
char * pNPCNames[540][2]
Definition: NPC.h:166
LOD::File::LoadCompressedTexture
void * LoadCompressedTexture(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:921
NPCStats::pNPCDataTXT_Raw
char * pNPCDataTXT_Raw
Definition: NPC.h:183
pNPCTopics
std::array< NPCTopic, 789 > pNPCTopics
Definition: mm7_data.cpp:740
InitializeMerchants
void InitializeMerchants()
Definition: NPC.cpp:852
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
NPCProfession::pActionText
char * pActionText
Definition: NPC.h:117
NPCStats::uNumNPCNames
unsigned int uNumNPCNames[2]
Definition: NPC.h:182
InitializeScrolls
void InitializeScrolls()
Definition: NPC.cpp:814
NPCData::evt_E
unsigned int evt_E
Definition: NPC.h:97
NPCData::evt_C
unsigned int evt_C
Definition: NPC.h:95
NPCStats::pNCPGroupTXT_Raw
char * pNCPGroupTXT_Raw
Definition: NPC.h:191
InitializeAutonotes
void InitializeAutonotes()
Definition: NPC.cpp:945
NPCProfessionChance::uTotalprofChance
unsigned int uTotalprofChance
Definition: NPC.h:126
CheckPortretAgainstSex
bool CheckPortretAgainstSex(int portret_num, int sex)
Definition: NPC.cpp:578
NPCStats::pNPCNamesTXT_Raw
char * pNPCNamesTXT_Raw
Definition: NPC.h:184
NPCData::evt_A
unsigned int evt_A
Definition: NPC.h:93
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
InitializeAwards
void InitializeAwards()
Definition: NPC.cpp:771
InitializeQuests
void InitializeQuests()
Definition: NPC.cpp:1012
pParty
Party * pParty
Definition: Party.cpp:30
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
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
NPCStats::InitializeNPCData
void InitializeNPCData()
Definition: NPC.cpp:284
NPCStats::uNewlNPCBufPos
unsigned int uNewlNPCBufPos
Definition: NPC.h:178
NPCData::rep
int rep
Definition: NPC.h:87
NPCData::fame
int fame
Definition: NPC.h:86
NPCStats::pNPCGreetTXT_Raw
char * pNPCGreetTXT_Raw
Definition: NPC.h:190
NPCProfessionChance::professionChancePerArea
char professionChancePerArea[60]
Definition: NPC.h:127
NPCData::uPortraitID
unsigned int uPortraitID
Definition: NPC.h:83
pEvents_LOD
LODFile_IconsBitmaps * pEvents_LOD
Definition: LOD.cpp:10
NPCData::Location2D
unsigned int Location2D
Definition: NPC.h:88
Party::pHirelings
std::array< NPCData, 2 > pHirelings
Definition: Party.h:311
Party::pHireling1Name
char pHireling1Name[100]
Definition: Party.h:318
NPCProfession::pDismissText
char * pDismissText
Definition: NPC.h:119
NPCProfession::pJoinText
char * pJoinText
Definition: NPC.h:118
NPCStats::dword_AE3370_LastMispronouncedNameResult
static int dword_AE3370_LastMispronouncedNameResult
Definition: NPC.h:194
NPCData::greet
int greet
Definition: NPC.h:90
NPCStats::pNPCTopicTXT_Raw
char * pNPCTopicTXT_Raw
Definition: NPC.h:187
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
uint
unsigned int uint
Definition: MM7.h:4
NPCData::evt_F
unsigned int evt_F
Definition: NPC.h:98
NPCStats::InitializeNPCText
void InitializeNPCText()
Definition: NPC.cpp:158
NPCData::joins
int joins
Definition: NPC.h:91
NPCStats::pProfessionChance
NPCProfessionChance pProfessionChance[77]
Definition: NPC.h:172
NPCProfession::pBenefits
char * pBenefits
Definition: NPC.h:116
NPCStats::dword_AE336C_LastMispronouncedNameFirstLetter
static int dword_AE336C_LastMispronouncedNameFirstLetter
Definition: NPC.h:193
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
NPCData::uSex
unsigned int uSex
Definition: NPC.h:99
NPCData::field_24
int field_24
Definition: NPC.h:92
InitializeTransitions
void InitializeTransitions()
Definition: NPC.cpp:905