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