annotate Engine/Objects/NPC.h @ 2516:56b6d74ce716

.
author Ritor1
date Thu, 02 Oct 2014 22:01:06 +0600
parents 92eeeb5200f2
children 117c219bf913
rev   line source
2498
Ritor1
parents:
diff changeset
1 #pragma once
Ritor1
parents:
diff changeset
2
Ritor1
parents:
diff changeset
3 enum NPCProf
Ritor1
parents:
diff changeset
4 {
Ritor1
parents:
diff changeset
5 Smith = 1, // GM Weapon Repair;
Ritor1
parents:
diff changeset
6 Armorer = 2, // GM Armor Repair;
Ritor1
parents:
diff changeset
7 Alchemist = 3, // GM Potion Repair;
Ritor1
parents:
diff changeset
8 Scholar = 4, // GM Item ID; Learning: +5
Ritor1
parents:
diff changeset
9 Guide = 5, // Travel by foot: -1 day;
Ritor1
parents:
diff changeset
10 Tracker = 6, // Travel by foot: -2 days;
Ritor1
parents:
diff changeset
11 Pathfinder = 7, // Travel by foot: -3 days;
Ritor1
parents:
diff changeset
12 Sailor = 8, // Travel by sea: -2 days;
Ritor1
parents:
diff changeset
13 Navigator = 9, // Travel by sea: -3 days;
Ritor1
parents:
diff changeset
14 Healer = 10,
Ritor1
parents:
diff changeset
15 ExpertHealer = 11,
Ritor1
parents:
diff changeset
16 MasterHealer = 12,
Ritor1
parents:
diff changeset
17 Teacher = 13, // Learning: +10;
Ritor1
parents:
diff changeset
18 Instructor = 14, // Learning: +15;
Ritor1
parents:
diff changeset
19 Armsmaster = 15, // Armsmaster: +2;
Ritor1
parents:
diff changeset
20 Weaponsmaster = 16, // Armsmaster: +3;
Ritor1
parents:
diff changeset
21 Apprentice = 17, // Fire: +2; Air: +2; Water: +2; Earth: +2;
Ritor1
parents:
diff changeset
22 Mystic = 18, // Fire: +3; Air: +3; Water: +3; Earth: +3;
Ritor1
parents:
diff changeset
23 Spellmaster = 19, // Fire: +4; Air: +4; Water: +4; Earth: +4;
Ritor1
parents:
diff changeset
24 Trader = 20, // Merchant: +4;
Ritor1
parents:
diff changeset
25 Merchant = 21, // Merchant: +6;
Ritor1
parents:
diff changeset
26 Scout = 22, // Perception: +6;
Ritor1
parents:
diff changeset
27 Herbalist = 23, // Alchemy: +4;
Ritor1
parents:
diff changeset
28 Apothecary = 24, // Alchemy: +8;
Ritor1
parents:
diff changeset
29 Tinker = 25, // Traps: +4;
Ritor1
parents:
diff changeset
30 Locksmith = 26, // Traps: +6;
Ritor1
parents:
diff changeset
31 Fool = 27, // Luck: +5;
Ritor1
parents:
diff changeset
32 ChimneySweep = 28, // Luck: +20;
Ritor1
parents:
diff changeset
33 Porter = 29, // Food for rest: -1;
Ritor1
parents:
diff changeset
34 QuarterMaster = 30, // Food for rest: -2;
Ritor1
parents:
diff changeset
35 Factor = 31, // Gold finds: +10%;
Ritor1
parents:
diff changeset
36 Banker = 32, // Gold finds: +20%;
Ritor1
parents:
diff changeset
37 Cook = 33,
Ritor1
parents:
diff changeset
38 Chef = 34,
Ritor1
parents:
diff changeset
39 Horseman = 35, // Travel by foot: -2 days;
Ritor1
parents:
diff changeset
40 Bard = 36,
Ritor1
parents:
diff changeset
41 Enchanter = 37, // Resist All: +20;
Ritor1
parents:
diff changeset
42 Cartographer = 38, // Wizard Eye level 2;
Ritor1
parents:
diff changeset
43 WindMaster = 39,
Ritor1
parents:
diff changeset
44 WaterMaster = 40,
Ritor1
parents:
diff changeset
45 GateMaster = 41,
Ritor1
parents:
diff changeset
46 Acolyte = 42,
Ritor1
parents:
diff changeset
47 Piper = 43,
Ritor1
parents:
diff changeset
48 Explorer = 44, // Travel by foot -1 day; Travel by sea: -1 day;
Ritor1
parents:
diff changeset
49 Pirate = 45, // Travel by sea: -2 days; Gold finds: +10%; Reputation: +5;
Ritor1
parents:
diff changeset
50 Squire = 46,
Ritor1
parents:
diff changeset
51 Psychic = 47, // Perception: +5; Luck: +10;
Ritor1
parents:
diff changeset
52 Gypsy = 48, // Food for rest: -1; Merchant: +3; Reputation: +5;
Ritor1
parents:
diff changeset
53 Diplomat = 49,
Ritor1
parents:
diff changeset
54 Duper = 50, // Merchant: +8; Reputation: +5;
Ritor1
parents:
diff changeset
55 Burglar = 51, // Traps: +8; Stealing: +8; Reputation: +5;
Ritor1
parents:
diff changeset
56 FallenWizard = 52, // Reputation: +5;
Ritor1
parents:
diff changeset
57 Acolyte2 = 53, // Spirit: +2; Mind: +2; Body: +2;
Ritor1
parents:
diff changeset
58 Initiate = 54, // Spirit: +3; Mind: +3; Body: +3;
Ritor1
parents:
diff changeset
59 Prelate = 55, // Spirit: +4; Mind: +4; Body: +4;
Ritor1
parents:
diff changeset
60 Monk = 56, // Unarmed: +2; Dodge: +2;
Ritor1
parents:
diff changeset
61 Sage = 57, // Monster ID: +6
Ritor1
parents:
diff changeset
62 Hunter = 58 // Monster ID: +6
Ritor1
parents:
diff changeset
63 };
Ritor1
parents:
diff changeset
64
Ritor1
parents:
diff changeset
65
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 std::array<NPCTopic, 789> pNPCTopics;
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)
Ritor1
parents:
diff changeset
78 struct NPCData //4Ch
Ritor1
parents:
diff changeset
79 {
Ritor1
parents:
diff changeset
80 inline bool Hired() {return (uFlags & 0x80) != 0;}
Ritor1
parents:
diff changeset
81
Ritor1
parents:
diff changeset
82 char *pName; //0
Ritor1
parents:
diff changeset
83 unsigned int uPortraitID; //4
Ritor1
parents:
diff changeset
84 unsigned int uFlags; //8 // & 0x80 no greeting on dialogue start; looks like hired
Ritor1
parents:
diff changeset
85 int fame; //c
Ritor1
parents:
diff changeset
86 int rep; //10
Ritor1
parents:
diff changeset
87 unsigned int Location2D; //14
Ritor1
parents:
diff changeset
88 unsigned int uProfession; //18
Ritor1
parents:
diff changeset
89 int greet; //1c
Ritor1
parents:
diff changeset
90 int joins; //20
Ritor1
parents:
diff changeset
91 int field_24;
Ritor1
parents:
diff changeset
92 unsigned int evt_A; //28
Ritor1
parents:
diff changeset
93 unsigned int evt_B; //2c evtb
Ritor1
parents:
diff changeset
94 unsigned int evt_C; // 30 evtc
Ritor1
parents:
diff changeset
95 unsigned int evt_D; //34
Ritor1
parents:
diff changeset
96 unsigned int evt_E; //38
Ritor1
parents:
diff changeset
97 unsigned int evt_F; //3c
Ritor1
parents:
diff changeset
98 unsigned int uSex; //40
Ritor1
parents:
diff changeset
99 int bHasUsedTheAbility; //44
Ritor1
parents:
diff changeset
100 int news_topic; //48
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 {
Ritor1
parents:
diff changeset
109 inline NPCProfession():
Ritor1
parents:
diff changeset
110 uHirePrice(0), pBenefits(nullptr), pActionText(nullptr), pJoinText(nullptr), pDismissText(nullptr)
Ritor1
parents:
diff changeset
111 {}
Ritor1
parents:
diff changeset
112
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)
Ritor1
parents:
diff changeset
124 struct NPCProfessionChance
Ritor1
parents:
diff changeset
125 {
Ritor1
parents:
diff changeset
126 unsigned int uTotalprofChance; //summ
Ritor1
parents:
diff changeset
127 char professionChancePerArea[60]; //prof position
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 {
Ritor1
parents:
diff changeset
135 union
Ritor1
parents:
diff changeset
136 {
Ritor1
parents:
diff changeset
137 struct
Ritor1
parents:
diff changeset
138 {
Ritor1
parents:
diff changeset
139 char *pGreeting1; //at first meet
Ritor1
parents:
diff changeset
140 char *pGreeting2; // at latest meets
Ritor1
parents:
diff changeset
141 };
Ritor1
parents:
diff changeset
142 char *pGreetings[2];
Ritor1
parents:
diff changeset
143 };
Ritor1
parents:
diff changeset
144 };
Ritor1
parents:
diff changeset
145 #pragma pack(pop)
Ritor1
parents:
diff changeset
146
Ritor1
parents:
diff changeset
147
Ritor1
parents:
diff changeset
148 /* 137 */
Ritor1
parents:
diff changeset
149 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
150 struct NPCStats
Ritor1
parents:
diff changeset
151 {
Ritor1
parents:
diff changeset
152 inline NPCStats():
Ritor1
parents:
diff changeset
153 pNPCTextTXT_Raw(nullptr), pNPCTopicTXT_Raw(nullptr), pNPCDistTXT_Raw(nullptr)
Ritor1
parents:
diff changeset
154 {
Ritor1
parents:
diff changeset
155 uNumNPCNames[0] = uNumNPCNames[1] = 0;
Ritor1
parents:
diff changeset
156 }
Ritor1
parents:
diff changeset
157
Ritor1
parents:
diff changeset
158 void InitializeNPCText();
Ritor1
parents:
diff changeset
159 void InitializeNPCData();
Ritor1
parents:
diff changeset
160 void Initialize();
Ritor1
parents:
diff changeset
161 void Release();
Ritor1
parents:
diff changeset
162 void InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId);
Ritor1
parents:
diff changeset
163 void _476C60();
Ritor1
parents:
diff changeset
164 char * sub_495366_MispronounceName(unsigned __int8 firstLetter, unsigned __int8 genderId);
Ritor1
parents:
diff changeset
165
Ritor1
parents:
diff changeset
166
Ritor1
parents:
diff changeset
167 NPCData pNPCData[501]; //0 - 94BCh count from 1
Ritor1
parents:
diff changeset
168 NPCData pNewNPCData[501]; //94BCh- 12978h count from 1
Ritor1
parents:
diff changeset
169 char *pNPCNames[540][2];
Ritor1
parents:
diff changeset
170 NPCProfession pProfessions[59]; //count from 1
Ritor1
parents:
diff changeset
171 NPCData pAdditionalNPC[100];
Ritor1
parents:
diff changeset
172 char *pCatchPhrases[52]; //15CA4h
Ritor1
parents:
diff changeset
173 char *pNPCUnicNames[500]; //from first batch
Ritor1
parents:
diff changeset
174 NPCProfessionChance pProfessionChance[77]; //16544h profession chance in each area
Ritor1
parents:
diff changeset
175 int field_17884;
Ritor1
parents:
diff changeset
176 int field_17888;
Ritor1
parents:
diff changeset
177 NPCGreeting pNPCGreetings[205];
Ritor1
parents:
diff changeset
178 unsigned __int16 pGroups[51];
Ritor1
parents:
diff changeset
179 unsigned __int16 pGroups_copy[51];
Ritor1
parents:
diff changeset
180 unsigned int uNewlNPCBufPos;
Ritor1
parents:
diff changeset
181 unsigned int uNumNewNPCs;
Ritor1
parents:
diff changeset
182 int field_17FC8;
Ritor1
parents:
diff changeset
183 unsigned int uNumNPCProfessions;
Ritor1
parents:
diff changeset
184 unsigned int uNumNPCNames[2]; //0 male 1 female
Ritor1
parents:
diff changeset
185 char *pNPCDataTXT_Raw;
Ritor1
parents:
diff changeset
186 char *pNPCNamesTXT_Raw;
Ritor1
parents:
diff changeset
187 char *pNPCProfTXT_Raw;
Ritor1
parents:
diff changeset
188 char *pNPCNewsTXT_Raw;
Ritor1
parents:
diff changeset
189 char *pNPCTopicTXT_Raw;
Ritor1
parents:
diff changeset
190 char *pNPCTextTXT_Raw;
Ritor1
parents:
diff changeset
191 char *pNPCDistTXT_Raw;
Ritor1
parents:
diff changeset
192 char *pNPCGreetTXT_Raw;
Ritor1
parents:
diff changeset
193 char *pNCPGroupTXT_Raw;
Ritor1
parents:
diff changeset
194
Ritor1
parents:
diff changeset
195 static int dword_AE336C_LastMispronouncedNameFirstLetter;
Ritor1
parents:
diff changeset
196 static int dword_AE3370_LastMispronouncedNameResult;
Ritor1
parents:
diff changeset
197 };
Ritor1
parents:
diff changeset
198 #pragma pack(pop)
Ritor1
parents:
diff changeset
199
Ritor1
parents:
diff changeset
200 extern int pDialogueNPCCount;
Ritor1
parents:
diff changeset
201 extern std::array<struct Texture *, 6> pDialogueNPCPortraits;
Ritor1
parents:
diff changeset
202 extern int uNumDialogueNPCPortraits; // weak
Ritor1
parents:
diff changeset
203 extern struct NPCStats *pNPCStats;
Ritor1
parents:
diff changeset
204
Ritor1
parents:
diff changeset
205 bool PartyHasDragon();
Ritor1
parents:
diff changeset
206 bool CheckHiredNPCSpeciality(unsigned int uProfession);
Ritor1
parents:
diff changeset
207
Ritor1
parents:
diff changeset
208 int UseNPCSkill(NPCProf profession);
Ritor1
parents:
diff changeset
209 const char *ContractSelectText(int pEventCode);
Ritor1
parents:
diff changeset
210 void NPCHireableDialogPrepare();
Ritor1
parents:
diff changeset
211 void _4B4224_UpdateNPCTopics(int _this);
Ritor1
parents:
diff changeset
212 const char *GetProfessionActionText(int a1);
Ritor1
parents:
diff changeset
213 struct NPCData *__fastcall GetNPCData(signed int npcid);
Ritor1
parents:
diff changeset
214 struct NPCData * GetNewNPCData(signed int npcid, int* npc_indx);
Ritor1
parents:
diff changeset
215 int __fastcall GetGreetType(signed int SpeakingNPC_ID);
Ritor1
parents:
diff changeset
216 int NPC_EventProcessor(int npc_event_id, int entry_line = 0);