Mercurial > mm7
comparison mm7_2.cpp @ 1413:3881d2f94eb1
UseNPCSkill
DIALOGUE_USE_NPC_ABILITY
author | Nomad |
---|---|
date | Sat, 27 Jul 2013 16:09:00 +0200 |
parents | 2423bc2af692 |
children | 110eac219e5a |
comparison
equal
deleted
inserted
replaced
1412:182d58b2a34c | 1413:3881d2f94eb1 |
---|---|
67 #include "texts.h" | 67 #include "texts.h" |
68 #include "MM7.h" | 68 #include "MM7.h" |
69 #include "Lights.h" | 69 #include "Lights.h" |
70 | 70 |
71 //----- (004BB756) -------------------------------------------------------- | 71 //----- (004BB756) -------------------------------------------------------- |
72 signed int __fastcall sub_4BB756(signed int a1) | 72 int UseNPCSkill(NPCProf profession) |
73 { | 73 { |
74 unsigned int v1; // esi@8 | 74 switch (profession) |
75 unsigned int v3; // ecx@10 | 75 { |
76 Player *v4; // esi@15 | 76 case Healer: |
77 int v5; // ebx@16 | 77 { |
78 int v6; // ST38_4@16 | 78 for (int i = 0; i < 4; ++i) |
79 Player *v7; // esi@18 | 79 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); |
80 int v8; // ebx@19 | 80 } |
81 int v9; // ST30_4@19 | 81 break; |
82 int v10; // ST44_4@19 | 82 |
83 int v11; // ST48_4@19 | 83 case ExpertHealer: |
84 int v12; // ST4C_4@19 | 84 { |
85 int v13; // ST50_4@19 | 85 for (int i = 0; i < 4; ++i) |
86 int v14; // ST3C_4@19 | 86 { |
87 int v15; // ST40_4@19 | 87 auto player = &pParty->pPlayers[i]; |
88 int v16; // ST34_4@19 | 88 player->sHealth = player->GetMaxHealth(); |
89 int v17; // ST38_4@19 | 89 |
90 Player *v18; // esi@21 | 90 for (int j = 0; j < 14; ++j) |
91 int v19; // eax@26 | 91 player->pConditions[i] = 0; |
92 int v20; // eax@39 | 92 player->pConditions[18] = 0; |
93 SoundID v21; // [sp-20h] [bp-54h]@25 | 93 } |
94 signed int v22; // [sp-1Ch] [bp-50h]@25 | 94 } |
95 unsigned int v23; // [sp-18h] [bp-4Ch]@25 | 95 break; |
96 signed int v24; // [sp-14h] [bp-48h]@25 | 96 |
97 signed int v25; // [sp-10h] [bp-44h]@25 | 97 case MasterHealer: |
98 int v26; // [sp-10h] [bp-44h]@32 | 98 { |
99 int v27; // [sp-Ch] [bp-40h]@25 | 99 for (int i = 0; i < 4; ++i) |
100 unsigned int v28; // [sp-Ch] [bp-40h]@32 | 100 { |
101 unsigned int v29; // [sp-8h] [bp-3Ch]@25 | 101 auto player = &pParty->pPlayers[i]; |
102 __int16 v30; // [sp-8h] [bp-3Ch]@32 | 102 player->sHealth = player->GetMaxHealth(); |
103 int v31; // [sp-4h] [bp-38h]@25 | 103 |
104 int v32; // [sp-4h] [bp-38h]@32 | 104 auto v5 = LODWORD(player->pConditions[19]);//*((int *)v4 - 32); |
105 | 105 auto v6 = HIDWORD(player->pConditions[19]);//*((int *)v4 - 31); |
106 if ( a1 > 39 ) | 106 memset(player->pConditions, 0, 0xA0u); |
107 { | 107 |
108 if ( a1 != 40 ) | 108 __debugbreak(); |
109 { | 109 *(int *)&player->pActiveSkills[8] = v5; |
110 if ( a1 == 41 ) | 110 *(int *)&player->pActiveSkills[10] = v6; |
111 } | |
112 } | |
113 break; | |
114 | |
115 case Cook: | |
116 { | |
117 if (pParty->uNumFoodRations >= 13) | |
118 return 1; | |
119 | |
120 Party::GiveFood(1); | |
121 } | |
122 break; | |
123 | |
124 case Chef: | |
125 { | |
126 if (pParty->uNumFoodRations >= 13) | |
127 return 1; | |
128 | |
129 if (pParty->uNumFoodRations == 13) | |
130 Party::GiveFood(1); | |
131 else | |
132 Party::GiveFood(2); | |
133 } | |
134 break; | |
135 | |
136 case WindMaster: | |
137 { | |
138 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
139 { | |
140 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); | |
141 pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0); | |
142 } | |
143 else | |
144 { | |
145 auto v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
146 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 60 * (256 * 2), 3, 1, v19, 0); | |
147 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1u; | |
148 pAudioPlayer->PlaySound(SOUND_11090, 0, 0, -1, 0, 0, 0, 0); | |
149 } | |
150 } | |
151 break; | |
152 | |
153 case WaterMaster: | |
154 { | |
155 auto v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
156 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 60 * (256 * (2 + 1)), 3, 0, v20, 0); | |
157 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1u; | |
158 pAudioPlayer->PlaySound(SOUND_12040, 0, 0, -1, 0, 0, 0, 0); | |
159 } | |
160 break; | |
161 | |
162 case GateMaster: | |
163 { | |
164 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
165 dword_50C9DC = 195; | |
166 ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
167 } | |
168 break; | |
169 | |
170 case Acolyte: _42777D_CastSpell_UseWand_ShootArrow(46, 0, 133, 0, 0); break; | |
171 case Piper: _42777D_CastSpell_UseWand_ShootArrow(51, 0, 133, 0, 0); break; | |
172 case FallenWizard: _42777D_CastSpell_UseWand_ShootArrow(86, 0, 133, 0, 0); break; | |
173 | |
174 case Teacher: | |
175 case Instructor: | |
176 case Armsmaster: | |
177 case Weaponsmaster: | |
178 case Apprentice: | |
179 case Mystic: | |
180 case Spellmaster: | |
181 case Trader: | |
182 case Merchant: | |
183 case Scout: | |
184 case Herbalist: | |
185 case Apothecary: | |
186 case Tinker: | |
187 case Locksmith: | |
188 case Fool: | |
189 case ChimneySweep: | |
190 case Porter: | |
191 case QuarterMaster: | |
192 case Factor: | |
193 case Banker: | |
194 case Horseman: | |
195 case Bard: | |
196 case Enchanter: | |
197 case Cartographer: | |
198 case Explorer: | |
199 case Pirate: | |
200 case Squire: | |
201 case Psychic: | |
202 case Gypsy: | |
203 case Diplomat: | |
204 case Duper: | |
205 case Burglar: | |
206 case Acolyte2: | |
207 case Initiate: | |
208 case Prelate: | |
209 case Monk: | |
210 case Sage: | |
211 case Hunter: | |
212 break; | |
213 | |
214 default: | |
215 assert(false && "Invalid enum value"); | |
216 } | |
217 return 0; | |
218 | |
219 | |
220 /* | |
221 if ( profession > 39 ) | |
222 { | |
223 if ( profession != 40 ) | |
224 { | |
225 if ( profession == 41 ) | |
111 { | 226 { |
112 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | 227 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
113 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
114 { | |
115 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
116 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
117 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
118 ++pMessageQueue_50CBD0->uNumMessages; | |
119 }*/ | |
120 dword_50C9DC = 195; | 228 dword_50C9DC = 195; |
121 ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); | 229 ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
122 return 0; | 230 return 0; |
123 } | 231 } |
124 if ( a1 == 42 ) | 232 if ( profession == 42 ) |
125 { | 233 { |
126 v32 = 0; | 234 v32 = 0; |
127 v30 = 0; | 235 v30 = 0; |
128 v28 = 133; | 236 v28 = 133; |
129 v26 = 46; | 237 v26 = 46; |
130 } | 238 } |
131 else | 239 else |
132 { | 240 { |
133 if ( a1 == 43 ) | 241 if ( profession == 43 ) |
134 { | 242 { |
135 v32 = 0; | 243 v32 = 0; |
136 v30 = 0; | 244 v30 = 0; |
137 v28 = 133; | 245 v28 = 133; |
138 v26 = 51; | 246 v26 = 51; |
139 } | 247 } |
140 else | 248 else |
141 { | 249 { |
142 if ( a1 != 52 ) | 250 if ( profession != 52 ) |
143 return 0; | 251 return 0; |
144 v32 = 0; | 252 v32 = 0; |
145 v30 = 0; | 253 v30 = 0; |
146 v28 = 133; | 254 v28 = 133; |
147 v26 = 86; | 255 v26 = 86; |
163 v21 = (SoundID)12040; | 271 v21 = (SoundID)12040; |
164 LABEL_40: | 272 LABEL_40: |
165 pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31); | 273 pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31); |
166 return 0; | 274 return 0; |
167 } | 275 } |
168 if ( a1 == 39 ) | 276 if ( profession == 39 ) |
169 { | 277 { |
170 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | 278 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
171 { | 279 { |
172 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2u); | 280 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2u); |
173 v31 = 0; | 281 v31 = 0; |
194 v21 = (SoundID)11090; | 302 v21 = (SoundID)11090; |
195 } | 303 } |
196 pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31); | 304 pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31); |
197 return 0; | 305 return 0; |
198 } | 306 } |
199 if ( a1 == 10 ) | 307 if ( profession == 10 ) |
200 { | 308 { |
201 v18 = pParty->pPlayers; | 309 v18 = pParty->pPlayers; |
202 do | 310 do |
203 { | 311 { |
204 v18->sHealth = v18->GetMaxHealth(); | 312 v18->sHealth = v18->GetMaxHealth(); |
205 ++v18; | 313 ++v18; |
206 } | 314 } |
207 while ( (signed int)v18 < (signed int)pParty->pHirelings ); | 315 while ( (signed int)v18 < (signed int)pParty->pHirelings ); |
208 return 0; | 316 return 0; |
209 } | 317 } |
210 if ( a1 == 11 ) | 318 if ( profession == 11 ) |
211 { | 319 { |
212 v7 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pConditions[15]; | 320 v7 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pConditions[15]; |
213 do | 321 do |
214 { | 322 { |
215 /*v8 = *((int *)v7 - 2); | |
216 v9 = *((int *)v7 - 1); | |
217 v10 = *(int *)v7; | |
218 v11 = *((int *)v7 + 1); | |
219 v12 = *((int *)v7 + 2); | |
220 v13 = *((int *)v7 + 3); | |
221 v14 = *((int *)v7 + 8); | |
222 v15 = *((int *)v7 + 9); | |
223 v16 = *((int *)v7 + 4); | |
224 v17 = *((int *)v7 + 5);*/ | |
225 v8 = LODWORD(v7->pConditions[14]); | 323 v8 = LODWORD(v7->pConditions[14]); |
226 v9 = HIDWORD(v7->pConditions[14]); | 324 v9 = HIDWORD(v7->pConditions[14]); |
227 v10 = LODWORD(v7->pConditions[15]); | 325 v10 = LODWORD(v7->pConditions[15]); |
228 v11 = HIDWORD(v7->pConditions[15]); | 326 v11 = HIDWORD(v7->pConditions[15]); |
229 v12 = LODWORD(v7->pConditions[16]); | 327 v12 = LODWORD(v7->pConditions[16]); |
247 ++v7; | 345 ++v7; |
248 } | 346 } |
249 while ( v7 <= pPlayers[3] ); | 347 while ( v7 <= pPlayers[3] ); |
250 return 0; | 348 return 0; |
251 } | 349 } |
252 if ( a1 == 12 ) | 350 if ( profession == 12 ) |
253 { | 351 { |
254 v4 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pActiveSkills[8]; | 352 v4 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pActiveSkills[8]; |
255 do | 353 do |
256 { | 354 { |
257 v5 = LODWORD(v4->pConditions[19]);//*((int *)v4 - 32); | 355 v5 = LODWORD(v4->pConditions[19]);//*((int *)v4 - 32); |
263 ++v4; | 361 ++v4; |
264 } | 362 } |
265 while ( v4 <= pPlayers[3] ); | 363 while ( v4 <= pPlayers[3] ); |
266 return 0; | 364 return 0; |
267 } | 365 } |
268 if ( a1 == 33 ) | 366 if ( profession == 33 ) |
269 { | 367 { |
270 v1 = 14; | 368 v1 = 14; |
271 if ( pParty->uNumFoodRations >= 0xE ) | 369 if ( pParty->uNumFoodRations >= 0xE ) |
272 return 1; | 370 return 1; |
273 v3 = 1; | 371 v3 = 1; |
275 Party::GiveFood(v3); | 373 Party::GiveFood(v3); |
276 if ( pParty->uNumFoodRations > v1 ) | 374 if ( pParty->uNumFoodRations > v1 ) |
277 pParty->uNumFoodRations = v1; | 375 pParty->uNumFoodRations = v1; |
278 return 0; | 376 return 0; |
279 } | 377 } |
280 if ( a1 == 34 ) | 378 if ( profession == 34 ) |
281 { | 379 { |
282 v1 = 14; | 380 v1 = 14; |
283 if ( pParty->uNumFoodRations >= 0xE ) | 381 if ( pParty->uNumFoodRations >= 0xE ) |
284 return 1; | 382 return 1; |
285 v3 = 2; | 383 v3 = 2; |
286 goto LABEL_13; | 384 goto LABEL_13; |
287 } | 385 } |
288 return 0; | 386 return 0;*/ |
289 } | 387 } |
290 // 50C9DC: using guessed type int dword_50C9DC; | |
291 | 388 |
292 //----- (004BBA85) -------------------------------------------------------- | 389 //----- (004BBA85) -------------------------------------------------------- |
293 const char *sub_4BBA85_bounties() | 390 const char *sub_4BBA85_bounties() |
294 { | 391 { |
295 int v0; // edi@1 | 392 int v0; // edi@1 |