annotate NPC.h @ 1113:39eaa6b00141

something to bool cast (performance warning) mostly fixed
author Grumpy7
date Tue, 28 May 2013 00:19:45 +0200
parents 1ff57450f090
children ab6560001f5b
rev   line source
0
Ritor1
parents:
diff changeset
1 #pragma once
Ritor1
parents:
diff changeset
2
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
3 enum NPCProf
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
4 {
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
5 Smith = 1, // GM Weapon Repair;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
6 Armorer = 2, // GM Armor Repair;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
7 Alchemist = 3, // GM Potion Repair;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
8 Scholar = 4, // GM Item ID; Learning: +5
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
9 Guide = 5, // Travel by foot: -1 day;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
10 Tracker = 6, // Travel by foot: -2 days;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
11 Pathfinder = 7, // Travel by foot: -3 days;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
12 Sailor = 8, // Travel by sea: -2 days;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
13 Navigator = 9, // Travel by sea: -3 days;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
14 Healer = 10,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
15 ExpertHealer = 11,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
16 MasterHealer = 12,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
17 Teacher = 13, // Learning: +10;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
18 Instructor = 14, // Learning: +15;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
19 Armsmaster = 15, // Armsmaster: +2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
20 Weaponsmaster = 16, // Armsmaster: +3;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
21 Apprentice = 17, // Fire: +2; Air: +2; Water: +2; Earth: +2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
22 Mystic = 18, // Fire: +3; Air: +3; Water: +3; Earth: +3;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
23 Spellmaster = 19, // Fire: +4; Air: +4; Water: +4; Earth: +4;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
24 Trader = 20, // Merchant: +4;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
25 Merchant = 21, // Merchant: +6;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
26 Scout = 22, // Perception: +6;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
27 Herbalist = 23, // Alchemy: +4;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
28 Apothecary = 24, // Alchemy: +8;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
29 Tinker = 25, // Traps: +4;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
30 Locksmith = 26, // Traps: +6;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
31 Fool = 27, // Luck: +5;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
32 ChimneySweep = 28, // Luck: +20;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
33 Porter = 29, // Food for rest: -1;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
34 QuarterMaster = 30, // Food for rest: -2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
35 Factor = 31, // Gold finds: +10%;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
36 Banker = 32, // Gold finds: +20%;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
37 Cook = 33,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
38 Chef = 34,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
39 Horseman = 35, // Travel by foot: -2 days;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
40 Bard = 36,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
41 Enchanter = 37, // Resist All: +20;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
42 Cartographer = 38, // Wizard Eye level 2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
43 WindMaster = 39,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
44 WaterMaster = 40,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
45 GateMaster = 41,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
46 Acolyte = 42,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
47 Piper = 43,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
48 Explorer = 44, // Travel by foot -1 day; Travel by sea: -1 day;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
49 Pirate = 45, // Travel by sea: -2 days; Gold finds: +10%; Reputation: +5;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
50 Squire = 46,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
51 Psychic = 47, // Perception: +5; Luck: +10;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
52 Gypsy = 48, // Food for rest: -1; Merchant: +3; Reputation: +5;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
53 Diplomat = 49,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
54 Duper = 50, // Merchant: +8; Reputation: +5;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
55 Burglar = 51, // Traps: +8; Stealing: +8; Reputation: +5;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
56 FallenWizard = 52, // Reputation: +5;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
57 Acolyte2 = 53, // Spirit: +2; Mind: +2; Body: +2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
58 Initiate = 54, // Spirit: +3; Mind: +3; Body: +3;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
59 Prelate = 55, // Spirit: +4; Mind: +4; Body: +4;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
60 Monk = 56, // Unarmed: +2; Dodge: +2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
61 Sage = 57, // Monster ID: +6
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
62 Hunter = 58 // Monster ID: +6
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
63 };
374
Gloval
parents: 353
diff changeset
64
Gloval
parents: 353
diff changeset
65
0
Ritor1
parents:
diff changeset
66
Ritor1
parents:
diff changeset
67 struct NPCTopic
Ritor1
parents:
diff changeset
68 {
Ritor1
parents:
diff changeset
69 const char *pTopic;
Ritor1
parents:
diff changeset
70 const char *pText;
Ritor1
parents:
diff changeset
71 };
Ritor1
parents:
diff changeset
72
Ritor1
parents:
diff changeset
73 extern NPCTopic pNPCTopics[789];
Ritor1
parents:
diff changeset
74
Ritor1
parents:
diff changeset
75
Ritor1
parents:
diff changeset
76 /* 136 */
Ritor1
parents:
diff changeset
77 #pragma pack(push, 1)
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
78 struct NPCData //4Ch
0
Ritor1
parents:
diff changeset
79 {
1113
39eaa6b00141 something to bool cast (performance warning) mostly fixed
Grumpy7
parents: 652
diff changeset
80 inline bool Hired() {return (uFlags & 0x80) != 0;}
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 237
diff changeset
81
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
82 char *pName; //0
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
83 unsigned int uPortraitID; //4
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
84 unsigned int uFlags; //8 // & 0x80 no greeting on dialogue start; looks like hired
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
85 int fame; //c
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
86 int rep; //10
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
87 unsigned int Location2D; //14
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
88 unsigned int uProfession; //18
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
89 int greet; //1c
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
90 int joins; //20
0
Ritor1
parents:
diff changeset
91 int field_24;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
92 unsigned int evt_A; //28
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
93 unsigned int evt_B; //2c evtb
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
94 unsigned int evt_C; // 30 evtc
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
95 unsigned int evt_D; //34
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
96 unsigned int evt_E; //38
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
97 unsigned int evt_F; //3c
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
98 unsigned int uSex; //40
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
99 int bHasUsedTheAbility; //44
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
100 int news_topic; //48
0
Ritor1
parents:
diff changeset
101 };
Ritor1
parents:
diff changeset
102 #pragma pack(pop)
Ritor1
parents:
diff changeset
103
Ritor1
parents:
diff changeset
104
Ritor1
parents:
diff changeset
105 /* 138 */
Ritor1
parents:
diff changeset
106 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
107 struct NPCProfession
Ritor1
parents:
diff changeset
108 {
618
5cfb5dadf330 Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents: 437
diff changeset
109 inline NPCProfession():
5cfb5dadf330 Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents: 437
diff changeset
110 uHirePrice(0), pBenefits(nullptr), pActionText(nullptr), pJoinText(nullptr), pDismissText(nullptr)
5cfb5dadf330 Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents: 437
diff changeset
111 {}
5cfb5dadf330 Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents: 437
diff changeset
112
0
Ritor1
parents:
diff changeset
113 unsigned int uHirePrice;
Ritor1
parents:
diff changeset
114 char *pBenefits;
Ritor1
parents:
diff changeset
115 char *pActionText;
Ritor1
parents:
diff changeset
116 char *pJoinText;
Ritor1
parents:
diff changeset
117 char *pDismissText;
Ritor1
parents:
diff changeset
118 };
Ritor1
parents:
diff changeset
119 #pragma pack(pop)
Ritor1
parents:
diff changeset
120
Ritor1
parents:
diff changeset
121
Ritor1
parents:
diff changeset
122 /* 139 */
Ritor1
parents:
diff changeset
123 #pragma pack(push, 1)
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
124 struct NPCProfessionChance
0
Ritor1
parents:
diff changeset
125 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
126 unsigned int uTotalprofChance; //summ
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
127 char professionChancePerArea[60]; //prof position
0
Ritor1
parents:
diff changeset
128 };
Ritor1
parents:
diff changeset
129 #pragma pack(pop)
Ritor1
parents:
diff changeset
130
Ritor1
parents:
diff changeset
131 /* 140 */
Ritor1
parents:
diff changeset
132 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
133 struct NPCGreeting
Ritor1
parents:
diff changeset
134 {
377
243418228760 GetIdentifiedName
Gloval
parents: 374
diff changeset
135 char *pGreeting1; //at first meet
243418228760 GetIdentifiedName
Gloval
parents: 374
diff changeset
136 char *pGreeting2; // at latest meets
0
Ritor1
parents:
diff changeset
137 };
Ritor1
parents:
diff changeset
138 #pragma pack(pop)
Ritor1
parents:
diff changeset
139
Ritor1
parents:
diff changeset
140
Ritor1
parents:
diff changeset
141 /* 137 */
Ritor1
parents:
diff changeset
142 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
143 struct NPCStats
Ritor1
parents:
diff changeset
144 {
Ritor1
parents:
diff changeset
145 inline NPCStats():
Ritor1
parents:
diff changeset
146 pNPCTextTXT_Raw(nullptr), pNPCTopicTXT_Raw(nullptr), pNPCDistTXT_Raw(nullptr)
Ritor1
parents:
diff changeset
147 {
Ritor1
parents:
diff changeset
148 uNumNPCNames[0] = uNumNPCNames[1] = 0;
Ritor1
parents:
diff changeset
149 }
Ritor1
parents:
diff changeset
150
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
151 void InitializeNPCText();
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
152 void InitializeNPCData();
0
Ritor1
parents:
diff changeset
153 void Initialize();
Ritor1
parents:
diff changeset
154 void Release();
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
155 void InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId);
0
Ritor1
parents:
diff changeset
156 void _476C60();
Ritor1
parents:
diff changeset
157
237
2799737f8a74 more text parsers refactor
Gloval
parents: 188
diff changeset
158
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
159 NPCData pNPCData[501]; //0 - 94BCh count from 1
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
160 NPCData pNewNPCData[501]; //94BCh- 12978h count from 1
0
Ritor1
parents:
diff changeset
161 char *pNPCNames[540][2];
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
162 NPCProfession pProfessions[59]; //count from 1
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
163 NPCData pAdditionalNPC[100];
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
164 char *pCatchPhrases[52]; //15CA4h
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
165 char *pNPCUnicNames[500]; //from first batch
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
166 NPCProfessionChance pProfessionChance[77]; //16544h profession chance in each area
0
Ritor1
parents:
diff changeset
167 int field_17884;
Ritor1
parents:
diff changeset
168 int field_17888;
Ritor1
parents:
diff changeset
169 NPCGreeting pNPCGreetings[205];
Ritor1
parents:
diff changeset
170 unsigned __int16 pGroups[51];
Ritor1
parents:
diff changeset
171 unsigned __int16 pGroups_copy[51];
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
172 unsigned int uNewlNPCBufPos;
0
Ritor1
parents:
diff changeset
173 unsigned int uNumNewNPCs;
Ritor1
parents:
diff changeset
174 int field_17FC8;
Ritor1
parents:
diff changeset
175 unsigned int uNumNPCProfessions;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 253
diff changeset
176 unsigned int uNumNPCNames[2]; //0 male 1 female
0
Ritor1
parents:
diff changeset
177 char *pNPCDataTXT_Raw;
Ritor1
parents:
diff changeset
178 char *pNPCNamesTXT_Raw;
Ritor1
parents:
diff changeset
179 char *pNPCProfTXT_Raw;
Ritor1
parents:
diff changeset
180 char *pNPCNewsTXT_Raw;
Ritor1
parents:
diff changeset
181 char *pNPCTopicTXT_Raw;
Ritor1
parents:
diff changeset
182 char *pNPCTextTXT_Raw;
Ritor1
parents:
diff changeset
183 char *pNPCDistTXT_Raw;
Ritor1
parents:
diff changeset
184 char *pNPCGreetTXT_Raw;
Ritor1
parents:
diff changeset
185 char *pNCPGroupTXT_Raw;
Ritor1
parents:
diff changeset
186 };
Ritor1
parents:
diff changeset
187 #pragma pack(pop)
Ritor1
parents:
diff changeset
188
629
59713bb36033 houses func moved to uihouses
Gloval
parents: 618
diff changeset
189 extern int pDialogueNPCCount;
59713bb36033 houses func moved to uihouses
Gloval
parents: 618
diff changeset
190 extern struct Texture *pDialogueNPCPortraits[6];
59713bb36033 houses func moved to uihouses
Gloval
parents: 618
diff changeset
191 extern int uNumDialogueNPCPortraits; // weak
59713bb36033 houses func moved to uihouses
Gloval
parents: 618
diff changeset
192 extern struct NPCStats *pNPCStats;
59713bb36033 houses func moved to uihouses
Gloval
parents: 618
diff changeset
193
253
Gloval
parents: 252
diff changeset
194 bool PartyHasDragon();
251
48f21f569328 Npc related stuff separated
Gloval
parents: 237
diff changeset
195 bool CheckHiredNPCSpeciality(unsigned int uProfession);