Mercurial > mm7
annotate mm7_6.cpp @ 2292:ab8797ea43b6
stru319::CalcMagicalDamageToActor small cleanups
author | Grumpy7 |
---|---|
date | Sun, 16 Mar 2014 19:37:28 +0100 |
parents | 69661f22ff03 |
children | b0f10ef66e00 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2245
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
0 | 2 #include "MM7.h" |
3 | |
1323 | 4 #include "Weather.h" |
1016 | 5 #include "Sprites.h" |
6 #include "BSPModel.h" | |
7 #include "Mouse.h" | |
8 #include "Keyboard.h" | |
9 #include "stru6.h" | |
10 | |
11 #include "Vis.h" | |
0 | 12 #include "Game.h" |
13 #include "GUIWindow.h" | |
14 #include "GUIFont.h" | |
15 #include "Party.h" | |
16 #include "AudioPlayer.h" | |
17 #include "Outdoor.h" | |
1277 | 18 #include "Outdoor_stuff.h" |
0 | 19 #include "Overlays.h" |
20 #include "LOD.h" | |
21 #include "Actor.h" | |
22 #include "Events.h" | |
23 #include "Viewport.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
1989
diff
changeset
|
24 #include "OurMath.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
25 #include "SpriteObject.h" |
0 | 26 #include "ObjectList.h" |
27 #include "stru123.h" | |
2044 | 28 #include "Timer.h" |
0 | 29 #include "IconFrameTable.h" |
30 #include "Awards.h" | |
31 #include "TurnEngine.h" | |
924 | 32 #include "CastSpellInfo.h" |
0 | 33 #include "stru298.h" |
189 | 34 #include "texts.h" |
0 | 35 |
36 #include "mm7_data.h" | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 //----- (00427546) -------------------------------------------------------- | |
44 int stru319::_427546(int a2) | |
45 { | |
46 int result; // eax@2 | |
47 | |
48 if ( a2 >= 0 ) | |
49 { | |
50 if ( a2 >= 1 ) | |
51 result = (a2 >= 2) + 2; | |
52 else | |
53 result = 1; | |
54 } | |
55 else | |
56 { | |
57 result = 0; | |
58 } | |
59 return result; | |
60 } | |
61 | |
62 //----- (0042756B) -------------------------------------------------------- | |
2292 | 63 int stru319::CalcMagicalDamageToActor(Actor *pActor, DAMAGE_TYPE dmgType, signed int incomingDmg) |
0 | 64 { |
65 int v4; // edx@1 | |
66 int v5; // ecx@1 | |
67 signed int v6; // eax@4 | |
68 signed int result; // eax@17 | |
69 signed int v8; // esi@18 | |
70 | |
71 v4 = 0; | |
72 v5 = 0; | |
2292 | 73 if ( pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 ) |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
74 v5 = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower; |
2292 | 75 switch ( dmgType ) |
0 | 76 { |
2292 | 77 case DMGT_FIRE: |
0 | 78 v6 = pActor->pMonsterInfo.uResFire; |
1419 | 79 v4 = v5; |
80 break; | |
2292 | 81 case DMGT_ELECTR: |
0 | 82 v6 = pActor->pMonsterInfo.uResAir; |
1419 | 83 v4 = v5; |
84 break; | |
2292 | 85 case DMGT_COLD: |
0 | 86 v6 = pActor->pMonsterInfo.uResWater; |
1419 | 87 v4 = v5; |
88 break; | |
2292 | 89 case DMGT_EARTH: |
0 | 90 v6 = pActor->pMonsterInfo.uResEarth; |
1419 | 91 v4 = v5; |
92 break; | |
2292 | 93 case DMGT_PHISYCAL: |
1765 | 94 v6 = pActor->pMonsterInfo.uResPhysical; |
95 break; | |
2292 | 96 case DMGT_SPIRIT: |
0 | 97 v6 = pActor->pMonsterInfo.uResSpirit; |
98 break; | |
2292 | 99 case DMGT_MIND: |
0 | 100 v6 = pActor->pMonsterInfo.uResMind; |
1419 | 101 v4 = v5; |
102 break; | |
2292 | 103 case DMGT_BODY: |
0 | 104 v6 = pActor->pMonsterInfo.uResBody; |
105 v4 = v5; | |
106 break; | |
2292 | 107 case DMGT_LIGHT: |
0 | 108 v6 = pActor->pMonsterInfo.uResLight; |
109 break; | |
2292 | 110 case DMGT_DARK: |
0 | 111 v6 = pActor->pMonsterInfo.uResDark; |
112 break; | |
113 default: | |
114 v6 = 0; | |
115 break; | |
116 } | |
117 if ( v6 < 200 ) | |
118 { | |
119 v8 = v4 + v6 + 30; | |
2292 | 120 for (int i = 0; i < 4; i++) |
0 | 121 { |
2292 | 122 if ( rand() % v8 < 30 ) |
123 break; | |
124 incomingDmg /= 2; | |
0 | 125 } |
2292 | 126 result = incomingDmg; |
0 | 127 } |
128 else | |
129 result = 0; | |
130 return result; | |
131 } | |
132 | |
133 //----- (00427662) -------------------------------------------------------- | |
134 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
135 { | |
1765 | 136 signed int resist; // esi@2 |
0 | 137 bool result; // eax@13 |
138 | |
139 switch ( uType ) | |
140 { | |
1765 | 141 case 0: |
142 resist = pActor->pMonsterInfo.uResFire; | |
143 break; | |
144 case 1: | |
145 resist = pActor->pMonsterInfo.uResAir; | |
146 break; | |
147 case 2: | |
148 resist = pActor->pMonsterInfo.uResWater; | |
149 break; | |
150 case 3: | |
151 resist = pActor->pMonsterInfo.uResEarth; | |
152 break; | |
153 case 4: | |
154 resist = pActor->pMonsterInfo.uResPhysical; | |
155 break; | |
156 case 6: | |
157 resist = pActor->pMonsterInfo.uResSpirit; | |
158 break; | |
159 case 7: | |
160 resist = pActor->pMonsterInfo.uResMind; | |
161 case 8: | |
162 resist = pActor->pMonsterInfo.uResBody; | |
163 break; | |
164 case 9: | |
165 resist = pActor->pMonsterInfo.uResLight; | |
166 break; | |
167 case 10: | |
168 resist = pActor->pMonsterInfo.uResDark; | |
0 | 169 break; |
170 default: | |
1419 | 171 return 1; |
0 | 172 } |
1765 | 173 if ( resist < 200 ) |
174 result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30; | |
1419 | 175 else |
1765 | 176 result = 0; |
0 | 177 return result; |
178 } | |
179 | |
180 //----- (0042EB8D) -------------------------------------------------------- | |
437 | 181 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 182 { |
482 | 183 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 184 if (uNumMessages < 40) |
185 { | |
437 | 186 files[uNumMessages] = file; |
187 lines[uNumMessages] = line; | |
188 | |
0 | 189 pMessages[uNumMessages].eType = msg; |
190 pMessages[uNumMessages].param = param; | |
191 pMessages[uNumMessages++].field_8 = a4; | |
192 } | |
193 } | |
194 | |
195 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 196 int stru193_math::Sin(int angle) |
0 | 197 { |
323 | 198 return Cos(angle - this->uIntegerHalfPi); |
0 | 199 } |
200 | |
201 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 202 void _42ECB5_PlayerAttacksActor() |
0 | 203 { |
204 char *v5; // eax@8 | |
205 unsigned int v9; // ecx@21 | |
206 char *v11; // eax@26 | |
207 unsigned int v12; // eax@47 | |
208 SoundID v24; // [sp-4h] [bp-40h]@58 | |
209 | |
271 | 210 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); |
1980 | 211 Player* player = &pParty->pPlayers[uActiveCharacter - 1]; |
271 | 212 if (!player->CanAct()) |
213 return; | |
214 | |
1517 | 215 CastSpellInfoHelpers::_427D48(); |
295 | 216 //v3 = 0; |
271 | 217 if (pParty->Invisible()) |
218 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
219 | |
220 //v31 = player->pEquipment.uBow; | |
221 int bow_idx = player->pEquipment.uBow; | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1558
diff
changeset
|
222 if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken()) |
271 | 223 bow_idx = 0; |
224 | |
295 | 225 //v32 = 0; |
226 int wand_item_id = 0; | |
271 | 227 //v33 = 0; |
228 //v4 = v1->pEquipment.uMainHand; | |
229 int laser_weapon_item_id = 0; | |
230 | |
231 int main_hand_idx = player->pEquipment.uMainHand; | |
232 if (main_hand_idx) | |
0 | 233 { |
1980 | 234 ItemGen* item = &player->pInventoryItemList[main_hand_idx - 1]; |
112 | 235 //v5 = (char *)v1 + 36 * v4; |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1558
diff
changeset
|
236 if (!item->IsBroken()) |
271 | 237 { |
238 //v28b = &v1->pInventoryItems[v4].uItemID; | |
239 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1685
diff
changeset
|
240 if (item->GetItemEquipType() == EQUIP_WAND) |
0 | 241 { |
295 | 242 if (item->uNumCharges <= 0) |
243 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 244 else |
295 | 245 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 246 } |
271 | 247 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
248 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 249 } |
271 | 250 } |
251 | |
295 | 252 //v30 = 0; |
253 //v29 = 0; | |
254 //v28 = 0; | |
271 | 255 //v7 = pMouse->uPointingObjectID; |
256 | |
257 int target_pid = pMouse->uPointingObjectID; | |
848 | 258 int target_type = PID_TYPE(target_pid), |
259 target_id = PID_ID(target_pid); | |
271 | 260 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
261 { | |
262 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 263 target_type = PID_TYPE(target_pid); |
264 target_id = PID_ID(target_pid); | |
271 | 265 } |
295 | 266 |
1980 | 267 Actor* actor = &pActors[target_id]; |
295 | 268 int actor_distance = 0; |
271 | 269 if (target_type == OBJECT_Actor) |
270 { | |
295 | 271 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
272 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
273 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
274 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
275 if (actor_distance < 0) | |
276 actor_distance = 0; | |
277 } | |
278 | |
279 bool shooting_bow = false, | |
280 shotting_laser = false, | |
816 | 281 shooting_wand = false, |
282 melee_attack = false; | |
295 | 283 if (laser_weapon_item_id) |
284 { | |
285 shotting_laser = true; | |
490 | 286 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 287 } |
288 else if (wand_item_id) | |
289 { | |
290 shooting_wand = true; | |
291 | |
292 int main_hand_idx = player->pEquipment.uMainHand; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1340
diff
changeset
|
293 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 294 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1340
diff
changeset
|
295 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges) |
295 | 296 player->pEquipment.uMainHand = 0; |
297 } | |
303 | 298 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 299 { |
816 | 300 melee_attack = true; |
301 | |
303 | 302 Vec3_int_ a3; |
303 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
304 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
305 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
306 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
307 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
308 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
1989 | 309 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED)) |
2114 | 310 _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter); |
303 | 311 } |
312 else if (bow_idx) | |
313 { | |
314 shooting_bow = true; | |
490 | 315 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 316 } |
317 else | |
318 { | |
816 | 319 melee_attack = true; |
303 | 320 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
321 } | |
322 | |
816 | 323 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 324 { |
816 | 325 int recovery = player->GetAttackRecoveryTime(false); |
303 | 326 if (recovery < 30 ) |
327 recovery = 30; | |
816 | 328 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 329 } |
330 | |
331 int v34 = 0; | |
332 if (shooting_wand) | |
333 return; | |
334 else if (shooting_bow) | |
335 { | |
336 v34 = 5; | |
337 player->PlaySound(SPEECH_50, 0); | |
338 } | |
339 if (shotting_laser) | |
340 v34 = 7; | |
341 else | |
342 { | |
343 int main_hand_idx = player->pEquipment.uMainHand; | |
1989 | 344 if (player->HasItemEquipped(EQUIP_TWO_HANDED)) |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1685
diff
changeset
|
345 v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); |
1448 | 346 pTurnEngine->ApplyPlayerAction(); |
295 | 347 } |
348 | |
349 switch (v34) | |
350 { | |
351 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
352 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
353 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
354 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
355 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
356 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
357 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
358 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
359 } | |
0 | 360 } |
361 | |
362 //----- (0042F184) -------------------------------------------------------- | |
295 | 363 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 364 { |
365 int v4; // edi@1 | |
366 stru319 *v5; // esi@1 | |
367 int v6; // eax@2 | |
368 int v7; // eax@4 | |
369 int result; // eax@5 | |
370 int *v9; // edx@8 | |
371 signed int v10; // ebx@10 | |
372 int v11; // edi@11 | |
2117 | 373 //Actor *v12; // esi@12 |
374 //unsigned __int16 v13; // ax@12 | |
0 | 375 int v14; // eax@22 |
2117 | 376 //char v15; // zf@30 |
0 | 377 int v16; // esi@32 |
378 int v17; // ecx@34 | |
379 stru319 *v18; // eax@39 | |
380 int v19; // edx@39 | |
381 int v20; // ecx@41 | |
382 unsigned __int16 v21; // ax@42 | |
383 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
2117 | 384 //unsigned int v23; // [sp+Ch] [bp-20h]@7 |
0 | 385 stru319 *v24; // [sp+10h] [bp-1Ch]@1 |
386 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
387 int *v26; // [sp+18h] [bp-14h]@8 | |
388 int v27; // [sp+1Ch] [bp-10h]@10 | |
389 int *v28; // [sp+20h] [bp-Ch]@10 | |
2117 | 390 //unsigned int v29; // [sp+24h] [bp-8h]@7 |
0 | 391 int v30; // [sp+28h] [bp-4h]@6 |
392 int i; // [sp+38h] [bp+Ch]@33 | |
393 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
394 | |
395 v4 = 0; | |
396 v5 = this; | |
397 v24 = this; | |
2153 | 398 //if ( pRenderer->pRenderD3D ) |
0 | 399 { |
400 v6 = a3 != 0; | |
401 if ( a4 ) | |
402 LOBYTE(v6) = v6 | 8; | |
295 | 403 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 404 if ( v7 != -1 ) |
405 return (unsigned __int16)v7; | |
295 | 406 else return 0; |
0 | 407 } |
2153 | 408 /*else // software impl |
0 | 409 { |
410 v30 = 0; | |
411 if ( pRenderer->pActiveZBuffer ) | |
412 { | |
692 | 413 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) |
0 | 414 { |
692 | 415 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; |
416 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
2117 | 417 for ( v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; v25; --v25 ) |
0 | 418 { |
2117 | 419 if ( (signed int)viewparams->uScreen_topL_X < (signed int)viewparams->uScreen_BttmR_X ) |
0 | 420 { |
421 v28 = v9; | |
422 v10 = v4; | |
2117 | 423 for ( v27 = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X; v27; --v27 ) |
0 | 424 { |
425 v22 = *v28; | |
426 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
427 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 428 { |
2117 | 429 if ( pActors[PID_ID(v11)].uAIState != Dead ) |
0 | 430 { |
2117 | 431 if ( pActors[PID_ID(v11)].uAIState != Dying && pActors[PID_ID(v11)].uAIState != Removed |
432 && pActors[PID_ID(v11)].uAIState != Summoned && pActors[PID_ID(v11)].uAIState != Disabled | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
433 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 434 { |
2117 | 435 if ( (!a4 || MonsterStats::BelongsToSupertype(pActors[PID_ID(v11)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) |
295 | 436 && v22 <= pick_depth << 16 ) |
0 | 437 { |
438 v14 = 0; | |
439 if ( v10 > 0 ) | |
440 { | |
2117 | 441 for ( v14; v14 < v30; ++v14 ) |
0 | 442 { |
443 if ( dword_50BDA0[v14] == v11 ) | |
444 break; | |
445 } | |
446 } | |
447 if ( v14 == v30 && v10 < 100 ) | |
448 { | |
449 ++v30; | |
450 dword_50BC10[v10] = v22; | |
451 dword_50BDA0[v10] = v11; | |
452 ++v10; | |
453 } | |
454 } | |
455 } | |
456 } | |
457 } | |
458 ++v28; | |
459 } | |
460 v4 = v30; | |
461 v5 = v24; | |
462 } | |
463 v9 = v26 + 640; | |
464 v26 += 640; | |
465 } | |
466 } | |
467 if ( v4 > 0 ) | |
468 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
469 v16 = (int)dword_50BC10.data(); |
2117 | 470 for ( v32 = 1; v32 - 1 < v4; ++v32 ) |
0 | 471 { |
472 for ( i = v32; i < v4; ++i ) | |
473 { | |
474 v17 = dword_50BC10[i]; | |
2117 | 475 if ( dword_50BC10[i] < *(int *)v16 ) |
0 | 476 { |
477 dword_50BC10[i] = *(int *)v16; | |
478 *(int *)v16 = v17; | |
479 } | |
480 } | |
481 v16 += 4; | |
482 } | |
483 v5 = v24; | |
484 if ( v4 > 0 ) | |
485 { | |
486 v18 = v24; | |
2117 | 487 for ( v19 = v4; v19; --v19 ) |
0 | 488 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
489 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF; |
0 | 490 v18 += 4; |
491 } | |
492 } | |
493 } | |
494 v20 = 0; | |
495 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
496 { | |
497 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
498 if ( v21 != 4 && v21 != 5 ) | |
499 break; | |
500 } | |
501 if ( v20 != v4 ) | |
502 { | |
503 result = 8 * *(int *)&v5[4 * v20].field_0; | |
504 LOBYTE(result) = result | 3; | |
505 return result; | |
506 } | |
507 } | |
508 } | |
2153 | 509 return 0;*/ |
0 | 510 } |
511 | |
512 //----- (0042F3D6) -------------------------------------------------------- | |
513 void InitializeTurnBasedAnimations(void *_this) | |
514 { | |
2153 | 515 for (unsigned int i = 0; i < pIconIDs_Turn.size(); ++i) |
516 { | |
517 char icon_name[32]; | |
518 sprintf(icon_name, "turn%u", i); | |
2242 | 519 pIconIDs_Turn[i] = pIconsFrameTable->FindIcon(icon_name); |
2153 | 520 pIconsFrameTable->InitializeAnimation(pIconIDs_Turn[i]); |
521 } | |
0 | 522 |
523 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
524 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
525 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
526 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
527 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
2153 | 528 |
0 | 529 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); |
530 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
531 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
532 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
533 } | |
534 | |
535 //----- (0042F7EB) -------------------------------------------------------- | |
536 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) | |
537 { | |
1406 | 538 unsigned __int16 pObjectDescID; // ax@7 |
539 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1 | |
0 | 540 |
1406 | 541 pSpellObject.stru_24.Reset(); |
0 | 542 if ( a9 ) |
1406 | 543 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24)); |
544 pSpellObject.spell_skill = 0; | |
545 pSpellObject.spell_level = 0; | |
546 pSpellObject.spell_id = 0; | |
547 pSpellObject.field_54 = 0; | |
548 pSpellObject.uType = uSpriteID; | |
2114 | 549 pObjectDescID = 0; |
550 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) | |
0 | 551 { |
2114 | 552 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) |
553 pObjectDescID = i; | |
0 | 554 } |
1406 | 555 pSpellObject.uObjectDescID = pObjectDescID; |
556 pSpellObject.vPosition.x = x; | |
557 pSpellObject.vPosition.y = y; | |
558 pSpellObject.vPosition.z = z; | |
559 pSpellObject.uSoundID = 0; | |
560 pSpellObject.uAttributes = attributes; | |
561 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z); | |
562 pSpellObject.uSpriteFrameID = 0; | |
563 pSpellObject.spell_caster_pid = 0; | |
564 pSpellObject.spell_target_pid = 0; | |
565 if ( !(pSpellObject.uAttributes & 0x10) ) | |
566 { | |
567 if ( pItemsTable->uAllItemsCount ) | |
568 { | |
1729
f44b6e02e81c
pop-up window in character(paperdill) window, alchemy
Ritor1
parents:
1709
diff
changeset
|
569 for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i ) |
1406 | 570 { |
571 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) | |
572 pSpellObject.stru_24.uItemID = i; | |
573 } | |
574 } | |
575 } | |
0 | 576 if ( a7 ) |
577 { | |
578 if ( count > 0 ) | |
579 { | |
1406 | 580 for ( uint i = count; i; --i ) |
0 | 581 { |
1406 | 582 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; |
583 pSpellObject.Create((signed __int16)pSpellObject.uFacing, | |
584 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0); | |
585 | |
0 | 586 } |
587 } | |
588 } | |
589 else | |
590 { | |
1406 | 591 pSpellObject.uFacing = 0; |
0 | 592 if ( count > 0 ) |
593 { | |
1406 | 594 for ( uint i = count; i; --i ) |
0 | 595 { |
1406 | 596 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0); |
0 | 597 } |
598 } | |
599 } | |
1406 | 600 return true; |
0 | 601 } |
602 | |
603 //----- (0042F960) -------------------------------------------------------- | |
604 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
605 { | |
606 unsigned __int16 v7; // ax@5 | |
607 signed int v8; // eax@6 | |
608 signed int v9; // eax@7 | |
609 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
610 SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
611 //SpriteObject::SpriteObject(&a1); |
0 | 612 a1.stru_24.Reset(); |
613 | |
822 | 614 a1.spell_skill = 0; |
615 a1.spell_level = 0; | |
616 a1.spell_id = 0; | |
0 | 617 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
618 a1.uType = 800; |
2114 | 619 v7 = 0; |
620 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) | |
0 | 621 { |
2114 | 622 if ( a1.uType == pObjectList->pObjects[i].uObjectID ) |
623 v7 = i; | |
0 | 624 } |
625 a1.uObjectDescID = v7; | |
2114 | 626 a1.vPosition.x = x; |
627 a1.vPosition.y = y; | |
0 | 628 a1.vPosition.z = z; |
629 a1.uSoundID = 0; | |
630 a1.uAttributes = 0; | |
2114 | 631 a1.uSectorID = pIndoor->GetSector(x, y, z); |
0 | 632 a1.uSpriteFrameID = 0; |
822 | 633 a1.spell_caster_pid = 0; |
823 | 634 a1.spell_target_pid = 0; |
0 | 635 v8 = a1.Create(0, 0, 0, 0); |
636 if ( v8 != -1 ) | |
637 { | |
638 v9 = 8 * v8; | |
639 LOBYTE(v9) = v9 | 2; | |
640 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
641 } | |
642 } | |
643 | |
644 //----- (0042FA66) -------------------------------------------------------- | |
1546 | 645 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) |
0 | 646 { |
647 unsigned __int16 v9; // ax@5 | |
648 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
649 SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
650 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
651 a1a.uType = 600; |
0 | 652 a1a.stru_24.Reset(); |
653 | |
822 | 654 a1a.spell_id = SPELL_FIRE_FIREBALL; |
655 a1a.spell_level = 8; | |
656 a1a.spell_skill = 3; | |
2114 | 657 v9 = 0; |
658 for ( uint i = 0; i < pObjectList->uNumObjects; ++i ) | |
0 | 659 { |
2114 | 660 if ( a1a.uType == pObjectList->pObjects[i].uObjectID ) |
661 v9 = i; | |
0 | 662 } |
663 a1a.uObjectDescID = v9; | |
2114 | 664 a1a.vPosition.x = a1; |
665 a1a.vPosition.y = a2; | |
0 | 666 a1a.vPosition.z = a3; |
667 a1a.uAttributes = 0; | |
2114 | 668 a1a.uSectorID = pIndoor->GetSector(a1, a2, a3); |
0 | 669 a1a.uSpriteFrameID = 0; |
823 | 670 a1a.spell_target_pid = 0; |
0 | 671 a1a.field_60_distance_related_prolly_lod = 0; |
672 a1a.uFacing = 0; | |
673 a1a.uSoundID = 0; | |
674 if ( a6 >= 1 || a6 <= 4 ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
675 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 676 else |
822 | 677 a1a.spell_caster_pid = 0; |
1546 | 678 |
679 int id = a1a.Create(0, 0, 0, 0); | |
680 if (id != -1) | |
2059 | 681 AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y), |
2057 | 682 SLOWORD(a1a.vPosition.z), 0, 0); |
0 | 683 } |
684 | |
685 //----- (0042FBDD) -------------------------------------------------------- | |
1458 | 686 void sub_42FBDD() |
0 | 687 { |
388 | 688 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 689 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
690 pRenderer->Present(); | |
691 } | |
692 | |
693 //----- (0042FC15) -------------------------------------------------------- | |
1458 | 694 void CloseWindowBackground() |
0 | 695 { |
388 | 696 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 697 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
698 pRenderer->Present(); | |
699 } | |
700 | |
701 //----- (0042FC4E) -------------------------------------------------------- | |
1575 | 702 void ProcessInputActions() |
0 | 703 { |
704 char v4; // al@9 | |
2114 | 705 //char v8; // bl@100 |
0 | 706 unsigned __int16 v9; // ax@102 |
2114 | 707 int spell_price; // eax@103 |
0 | 708 char v14; // al@159 |
709 unsigned int v15; // eax@168 | |
710 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
711 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
2114 | 712 //int v24; // [sp+4h] [bp-4h]@87 |
0 | 713 |
714 pGame->pKeyboardInstance->EnterCriticalSection(); | |
1980 | 715 Keyboard* pKeyboard = pGame->pKeyboardInstance; |
0 | 716 if (!bAlwaysRun) |
717 { | |
718 if (pKeyboard->IsShiftHeld()) | |
719 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
720 else | |
721 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
722 } | |
723 else | |
724 { | |
725 if (pKeyboard->IsShiftHeld()) | |
726 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
727 else | |
728 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
729 } | |
730 | |
140 | 731 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
1052 | 732 |
733 | |
734 // WUT? double event trigger | |
735 /*for ( uint i = 0; i < 30; ++i ) | |
998 | 736 { |
737 if ( pKeyActionMap->pToggleTypes[i] ) | |
738 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
739 else | |
740 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1052 | 741 if ( v14 ) |
998 | 742 { |
1052 | 743 if (pCurrentScreen == SCREEN_GAME) |
998 | 744 { |
745 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
746 continue; | |
747 } | |
748 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
749 { | |
750 v15 = pMessageQueue_50CBD0->uNumMessages; | |
751 if ( pMessageQueue_50CBD0->uNumMessages ) | |
752 { | |
753 v15 = 0; | |
754 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
755 { | |
756 v15 = 1; | |
757 pMessageQueue_50CBD0->uNumMessages = 0; | |
758 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
759 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
760 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
761 ++pMessageQueue_50CBD0->uNumMessages; | |
762 continue; | |
763 } | |
764 pMessageQueue_50CBD0->uNumMessages = 0; | |
765 } | |
766 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
767 } | |
768 } | |
1052 | 769 }*/ |
0 | 770 if ( !pEventTimer->bPaused ) |
771 { | |
998 | 772 for ( uint i = 0; i < 30; ++i ) |
0 | 773 { |
998 | 774 inputAction = (InputAction)i; |
2201 | 775 if ( pKeyActionMap->pToggleTypes[inputAction] ) |
776 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[inputAction]); | |
0 | 777 else |
2201 | 778 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[inputAction]); |
0 | 779 if ( v4 ) |
780 { | |
781 switch ( inputAction ) | |
782 { | |
783 case INPUT_MoveForward: | |
271 | 784 if (pCurrentScreen != SCREEN_GAME) |
0 | 785 break; |
786 if (!pParty->bTurnBasedModeOn) | |
787 { | |
140 | 788 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 789 partyAction = PARTY_RunForward; |
790 else | |
791 partyAction = PARTY_WalkForward; | |
998 | 792 pPartyActionQueue->Add(partyAction); |
163 | 793 break; |
794 } | |
2242 | 795 if (pTurnEngine->turn_stage != TE_WAIT && pTurnEngine->turn_stage != TE_ATTACK && pTurnEngine->uActionPointsLeft > 0 ) |
163 | 796 { |
797 pTurnEngine->uActionPointsLeft -= 26; | |
798 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
799 partyAction = PARTY_RunForward; | |
800 else | |
801 partyAction = PARTY_WalkForward; | |
998 | 802 pPartyActionQueue->Add(partyAction); |
163 | 803 break; |
0 | 804 } |
805 break; | |
806 case INPUT_MoveBackwards: | |
271 | 807 if (pCurrentScreen != SCREEN_GAME) |
0 | 808 break; |
809 if (!pParty->bTurnBasedModeOn) | |
17 | 810 { |
811 if ( pParty->uFlags2 & 2 ) | |
812 partyAction = PARTY_RunBackward; | |
813 else | |
814 partyAction = PARTY_WalkBackward; | |
998 | 815 pPartyActionQueue->Add(partyAction); |
163 | 816 break; |
17 | 817 } |
2242 | 818 if ( pTurnEngine->turn_stage != TE_WAIT && pTurnEngine->turn_stage != TE_ATTACK && pTurnEngine->uActionPointsLeft > 0 ) |
0 | 819 { |
820 pTurnEngine->uActionPointsLeft -= 26; | |
821 if ( pParty->uFlags2 & 2 ) | |
822 partyAction = PARTY_RunBackward; | |
823 else | |
824 partyAction = PARTY_WalkBackward; | |
998 | 825 pPartyActionQueue->Add(partyAction); |
163 | 826 break; |
0 | 827 } |
828 break; | |
829 case INPUT_StrafeLeft: | |
271 | 830 if (pCurrentScreen != SCREEN_GAME) |
0 | 831 break; |
832 if (!pParty->bTurnBasedModeOn) | |
17 | 833 { |
834 partyAction = PARTY_StrafeLeft; | |
998 | 835 pPartyActionQueue->Add(partyAction); |
163 | 836 break; |
17 | 837 } |
2242 | 838 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 839 break; |
840 pTurnEngine->uActionPointsLeft -= 26; | |
841 partyAction = PARTY_StrafeLeft; | |
998 | 842 pPartyActionQueue->Add(partyAction); |
843 break; | |
0 | 844 case INPUT_StrafeRight: |
271 | 845 if (pCurrentScreen != SCREEN_GAME) |
0 | 846 break; |
847 if (!pParty->bTurnBasedModeOn) | |
17 | 848 { |
849 partyAction = PARTY_StrafeRight; | |
998 | 850 pPartyActionQueue->Add(partyAction); |
163 | 851 break; |
17 | 852 } |
2242 | 853 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 854 break; |
855 pTurnEngine->uActionPointsLeft -= 26; | |
856 partyAction = PARTY_StrafeRight; | |
998 | 857 pPartyActionQueue->Add(partyAction); |
163 | 858 break; |
0 | 859 case INPUT_TurnLeft: |
271 | 860 if (pCurrentScreen != SCREEN_GAME) |
0 | 861 break; |
862 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
863 { | |
864 if (pParty->bTurnBasedModeOn) | |
865 { | |
2242 | 866 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 867 break; |
868 pTurnEngine->uActionPointsLeft -= 26; | |
869 } | |
998 | 870 partyAction = PARTY_StrafeLeft; |
0 | 871 } |
872 else | |
873 { | |
874 if ( pParty->uFlags2 & 2 ) | |
998 | 875 partyAction = PARTY_FastTurnLeft; |
0 | 876 else |
998 | 877 partyAction = PARTY_TurnLeft; |
0 | 878 } |
998 | 879 pPartyActionQueue->Add(partyAction); |
0 | 880 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
271 | 881 pWeather->OnPlayerTurn(10); |
0 | 882 break; |
883 case INPUT_TurnRight: | |
271 | 884 if (pCurrentScreen != SCREEN_GAME) |
0 | 885 break; |
886 if ( GetAsyncKeyState(17) ) // strafing | |
887 { | |
888 if (pParty->bTurnBasedModeOn) | |
889 { | |
2242 | 890 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 891 break; |
892 pTurnEngine->uActionPointsLeft -= 26; | |
893 } | |
998 | 894 partyAction = PARTY_StrafeRight; |
0 | 895 } |
896 else | |
897 { | |
898 if ( pParty->uFlags2 & 2 ) | |
998 | 899 partyAction = PARTY_FastTurnRight; |
0 | 900 else |
998 | 901 partyAction = PARTY_TurnRight; |
0 | 902 } |
998 | 903 pPartyActionQueue->Add(partyAction); |
0 | 904 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
271 | 905 pWeather->OnPlayerTurn(-10); |
0 | 906 break; |
907 case INPUT_Jump: | |
271 | 908 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 909 break; |
910 partyAction = (PartyAction)12; | |
998 | 911 pPartyActionQueue->Add(partyAction); |
163 | 912 break; |
0 | 913 case INPUT_Yell: |
187 | 914 if (!pCurrentScreen && uActiveCharacter) |
0 | 915 { |
916 pParty->Yell(); | |
187 | 917 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 918 } |
187 | 919 break; |
0 | 920 case INPUT_Pass: |
921 if ( pCurrentScreen ) | |
922 break; | |
2242 | 923 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT) |
17 | 924 { |
1332 | 925 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 926 break; |
927 } | |
0 | 928 if ( uActiveCharacter ) |
929 { | |
998 | 930 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 931 { |
932 if ( !pParty->bTurnBasedModeOn ) | |
2114 | 933 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false) * 2.133333333333333)); |
1517 | 934 CastSpellInfoHelpers::_427D48(); |
1448 | 935 pTurnEngine->ApplyPlayerAction(); |
0 | 936 } |
937 } | |
938 break; | |
998 | 939 case INPUT_Combat://if press ENTER |
271 | 940 if (pCurrentScreen == SCREEN_GAME) |
0 | 941 { |
942 if (pParty->bTurnBasedModeOn) | |
943 { | |
2242 | 944 if (pTurnEngine->turn_stage == TE_MOVEMENT || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 945 { |
946 pParty->bTurnBasedModeOn = 0; | |
947 pTurnEngine->End(true); | |
948 } | |
949 } | |
950 else | |
951 { | |
952 pTurnEngine->Start(); | |
953 pParty->bTurnBasedModeOn = true; | |
954 } | |
955 } | |
956 break; | |
957 case INPUT_CastReady: | |
271 | 958 if (pCurrentScreen != SCREEN_GAME) |
0 | 959 break; |
2242 | 960 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT) |
17 | 961 { |
1332 | 962 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 963 break; |
964 } | |
0 | 965 if ( !uActiveCharacter ) |
966 break; | |
2114 | 967 v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12]; |
968 if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater | |
969 || (( !(HIBYTE(v9) & 1)) ? | |
970 ((v9 & 0x80) == 0 ? | |
971 ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) : | |
972 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) : | |
973 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana, | |
974 spell_price > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 975 { |
998 | 976 pPartyActionQueue = pPartyActionQueue; |
437 | 977 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
978 break; | |
0 | 979 } |
980 else | |
2114 | 981 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); |
0 | 982 break; |
983 case INPUT_Attack: | |
271 | 984 if (pCurrentScreen != SCREEN_GAME) |
0 | 985 break; |
2242 | 986 if (pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == TE_MOVEMENT) |
998 | 987 { |
1332 | 988 pTurnEngine->field_18 |= TE_FLAG_8; |
998 | 989 break; |
990 } | |
991 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 992 break; |
993 case INPUT_EventTrigger: | |
271 | 994 if (pCurrentScreen == SCREEN_GAME) |
0 | 995 { |
437 | 996 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 997 break; |
0 | 998 } |
151 | 999 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 1000 { |
1001 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1002 { | |
437 | 1003 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 1004 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
1005 { | |
1006 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 1007 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 1008 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
1575 | 1009 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 = 0; |
0 | 1010 ++pMessageQueue_50CBD0->uNumMessages; |
1011 break; | |
1012 } | |
437 | 1013 break; |
0 | 1014 } |
437 | 1015 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 1016 } |
1017 break; | |
1018 case INPUT_CharCycle: | |
1012 | 1019 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 1020 break; |
1575 | 1021 |
1012 | 1022 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); |
163 | 1023 break; |
0 | 1024 case INPUT_LookUp: |
1025 if ( pEventTimer->bPaused ) | |
1026 break; | |
1027 partyAction = (PartyAction)7; | |
998 | 1028 pPartyActionQueue->Add(partyAction); |
163 | 1029 break; |
0 | 1030 case INPUT_CenterView: |
1031 if ( pEventTimer->bPaused ) | |
1032 break; | |
1033 partyAction = (PartyAction)9; | |
998 | 1034 pPartyActionQueue->Add(partyAction); |
163 | 1035 break; |
0 | 1036 case INPUT_LookDown: |
1037 if ( pEventTimer->bPaused ) | |
1038 break; | |
1039 partyAction = (PartyAction)8; | |
998 | 1040 pPartyActionQueue->Add(partyAction); |
163 | 1041 break; |
0 | 1042 case INPUT_FlyUp: |
998 | 1043 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 1044 break; |
1045 partyAction = (PartyAction)13; | |
998 | 1046 pPartyActionQueue->Add(partyAction); |
163 | 1047 break; |
0 | 1048 case INPUT_Land: |
998 | 1049 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 1050 break; |
1051 partyAction = (PartyAction)15; | |
998 | 1052 pPartyActionQueue->Add(partyAction); |
163 | 1053 break; |
0 | 1054 case INPUT_FlyDown: |
1055 if ( !pCurrentScreen | |
1056 && !pEventTimer->bPaused ) | |
1057 { | |
1058 partyAction = (PartyAction)14; | |
998 | 1059 pPartyActionQueue->Add(partyAction); |
0 | 1060 } |
1061 break; | |
1062 case INPUT_ZoomIn: | |
1012 | 1063 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); |
163 | 1064 break; |
0 | 1065 case INPUT_ZoomOut: |
1012 | 1066 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); |
0 | 1067 break; |
1068 case INPUT_AlwaysRun: | |
1069 bAlwaysRun = bAlwaysRun == 0; | |
1070 break; | |
17 | 1071 default: |
1072 break; | |
0 | 1073 } |
1074 } | |
1075 } | |
1076 } | |
1077 } |