annotate mm7_6.cpp @ 1966:7840fe323f67

stru319::LootActor(struct Actor *pActor) to Actor::LootActor
author Grumpy7
date Fri, 25 Oct 2013 13:03:08 -0700
parents 182d49f28170
children 7d2c5fa98584
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
4
0
Ritor1
parents:
diff changeset
5 #include "MM7.h"
Ritor1
parents:
diff changeset
6
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
7
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
8
1323
bfde0563ecdc removed weather.h from indoor.h
Grumpy7
parents: 1296
diff changeset
9 #include "Weather.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
10 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
11 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
12 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
13 #include "Keyboard.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
14 #include "stru6.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
15
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
16 #include "Vis.h"
0
Ritor1
parents:
diff changeset
17 #include "Game.h"
Ritor1
parents:
diff changeset
18 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
19 #include "GUIFont.h"
Ritor1
parents:
diff changeset
20 #include "Party.h"
Ritor1
parents:
diff changeset
21 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
22 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1207
diff changeset
23 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
24 #include "Overlays.h"
Ritor1
parents:
diff changeset
25 #include "LOD.h"
Ritor1
parents:
diff changeset
26 #include "Actor.h"
Ritor1
parents:
diff changeset
27 #include "Events.h"
Ritor1
parents:
diff changeset
28 #include "Viewport.h"
Ritor1
parents:
diff changeset
29 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
30 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
31 #include "ObjectList.h"
Ritor1
parents:
diff changeset
32 #include "stru123.h"
Ritor1
parents:
diff changeset
33 #include "Time.h"
Ritor1
parents:
diff changeset
34 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
35 #include "Awards.h"
Ritor1
parents:
diff changeset
36 #include "TurnEngine.h"
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
37 #include "CastSpellInfo.h"
0
Ritor1
parents:
diff changeset
38 #include "stru298.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 169
diff changeset
39 #include "texts.h"
0
Ritor1
parents:
diff changeset
40
Ritor1
parents:
diff changeset
41 #include "mm7_data.h"
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44
Ritor1
parents:
diff changeset
45 //----- (0042704B) --------------------------------------------------------
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1449
diff changeset
46 int stru319::special_ability_use_check( struct Actor *pActor, int a2 )
8ff3c675a726 more renaming TE
Gloval
parents: 1449
diff changeset
47 {
0
Ritor1
parents:
diff changeset
48 stru319 *v3; // edi@1
Ritor1
parents:
diff changeset
49 signed int v4; // ebx@5
Ritor1
parents:
diff changeset
50 signed int v5; // edi@5
Ritor1
parents:
diff changeset
51
Ritor1
parents:
diff changeset
52 v3 = this;
Ritor1
parents:
diff changeset
53 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2
Ritor1
parents:
diff changeset
54 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u
Ritor1
parents:
diff changeset
55 && rand() % 100 < 5 )
1896
b6a7410ff0ef renaming dword_4DF380 to dword_4DF380_hostilityRanges, moved it to actor.cpp
Grumpy7
parents: 1861
diff changeset
56 pActor->SummonMinion(a2);
0
Ritor1
parents:
diff changeset
57 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID);
Ritor1
parents:
diff changeset
58 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID);
Ritor1
parents:
diff changeset
59 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance )
Ritor1
parents:
diff changeset
60 return 2;
Ritor1
parents:
diff changeset
61 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance )
Ritor1
parents:
diff changeset
62 return 3;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1449
diff changeset
63 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance?1:0;
0
Ritor1
parents:
diff changeset
64 }
Ritor1
parents:
diff changeset
65
Ritor1
parents:
diff changeset
66 //----- (00427102) --------------------------------------------------------
Ritor1
parents:
diff changeset
67 int stru319::_427102(Actor *pActor, signed int a2)
Ritor1
parents:
diff changeset
68 {
Ritor1
parents:
diff changeset
69 unsigned __int8 v3; // cf@11
Ritor1
parents:
diff changeset
70 unsigned __int8 v4; // zf@11
Ritor1
parents:
diff changeset
71 SpellBuff *v6; // ecx@46
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
72 Player *v7; // esi@49
0
Ritor1
parents:
diff changeset
73 signed int v8; // edx@50
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
74 SpellBuff *v9; // ecx@50
0
Ritor1
parents:
diff changeset
75
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
76 switch(a2)
0
Ritor1
parents:
diff changeset
77 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
78 case 77:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
79 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
80 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
81 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
82 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
83 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
84 case 80:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
85 {
1861
a86c60679949 changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents: 1843
diff changeset
86 v6 = pParty->pPartyBuffs.data();
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
87 while ( (signed __int64)v6->uExpireTime <= 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
88 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
89 ++v6;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
90 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
91 {
1861
a86c60679949 changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents: 1843
diff changeset
92 v7 = pParty->pPlayers.data();//[0].pPlayerBuffs;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
93 v8 = 0;
1826
bdac32c645c5 Changing arrays in class Player to std::array
Grumpy7
parents: 1787
diff changeset
94 v9 = v7->pPlayerBuffs.data();
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
95 while ( v9->uExpireTime <= 0i64 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
96 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
97 ++v8;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
98 ++v9;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
99 if ( v8 >= 24 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
100 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
101 ++v7;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
102 if ( v7 <= &pParty->pPlayers[3] )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
103 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
104 v8 = 0;
1826
bdac32c645c5 Changing arrays in class Player to std::array
Grumpy7
parents: 1787
diff changeset
105 v9 = v7->pPlayerBuffs.data();
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
106 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
107 else
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
108 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
109 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
110 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
111 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
112 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
113 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
114 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
115 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
116 case 85:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
117 {
1957
3d0c57c4fa83 pActorBuffs[13] to pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION]
Grumpy7
parents: 1955
diff changeset
118 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
119 return 1;
1957
3d0c57c4fa83 pActorBuffs[13] to pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION]
Grumpy7
parents: 1955
diff changeset
120 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
121 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
122 v3 = 0;
1957
3d0c57c4fa83 pActorBuffs[13] to pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION]
Grumpy7
parents: 1955
diff changeset
123 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
124 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
125 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
126 case 86:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
127 {
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
128 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
129 return 1;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
130 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
131 return 0;
0
Ritor1
parents:
diff changeset
132 v3 = 0;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
133 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
134 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
135 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
136 case 95:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
137 {
1964
2b6c6ff66823 pActorBuffs[20] to pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION]
Grumpy7
parents: 1963
diff changeset
138 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
139 return 1;
1964
2b6c6ff66823 pActorBuffs[20] to pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION]
Grumpy7
parents: 1963
diff changeset
140 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
141 return 0;
0
Ritor1
parents:
diff changeset
142 v3 = 0;
1964
2b6c6ff66823 pActorBuffs[20] to pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION]
Grumpy7
parents: 1963
diff changeset
143 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
144 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
145 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
146 case 73:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
147 {
1965
182d49f28170 pActorBuffs[21] to pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS]
Grumpy7
parents: 1964
diff changeset
148 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
149 return 1;
1965
182d49f28170 pActorBuffs[21] to pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS]
Grumpy7
parents: 1964
diff changeset
150 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
151 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
152 v3 = 0;
1965
182d49f28170 pActorBuffs[21] to pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS]
Grumpy7
parents: 1964
diff changeset
153 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
154 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
155 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
156 case 5:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
157 {
1963
223143ef1289 pActorBuffs[19] to pActorBuffs[ACTOR_BUFF_HASTE]
Grumpy7
parents: 1962
diff changeset
158 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
159 return 1;
1963
223143ef1289 pActorBuffs[19] to pActorBuffs[ACTOR_BUFF_HASTE]
Grumpy7
parents: 1962
diff changeset
160 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
161 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
162 v3 = 0;
1963
223143ef1289 pActorBuffs[19] to pActorBuffs[ACTOR_BUFF_HASTE]
Grumpy7
parents: 1962
diff changeset
163 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
164 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
165 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
166 case 17:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
167 {
1959
4fbffad6e011 pActorBuffs[15] to pActorBuffs[ACTOR_BUFF_SHIELD]
Grumpy7
parents: 1958
diff changeset
168 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
169 return 1;
1959
4fbffad6e011 pActorBuffs[15] to pActorBuffs[ACTOR_BUFF_SHIELD]
Grumpy7
parents: 1958
diff changeset
170 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
171 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
172 v3 = 0;
1959
4fbffad6e011 pActorBuffs[15] to pActorBuffs[ACTOR_BUFF_SHIELD]
Grumpy7
parents: 1958
diff changeset
173 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
174 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
175 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
176 case 38:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
177 {
1960
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
178 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
179 return 1;
1960
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
180 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
181 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
182 v3 = 0;
1960
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
183 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
184 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
185 case 46:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
186 {
1961
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
187 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) < 0 )
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
188 return 1;
1961
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
189 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
190 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
191 v3 = 0;
1961
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
192 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
193 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
194 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
195 case 47:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
196 {
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
197 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
198 return 1;
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
199 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
200 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
201 v3 = 0;
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
202 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
203 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
204 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
205 case 51:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
206 {
1962
39a68477ead3 pActorBuffs[18] to pActorBuffs[ACTOR_BUFF_HEROISM]
Grumpy7
parents: 1961
diff changeset
207 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
208 return 1;
1962
39a68477ead3 pActorBuffs[18] to pActorBuffs[ACTOR_BUFF_HEROISM]
Grumpy7
parents: 1961
diff changeset
209 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) <= 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
210 {
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
211 v3 = 0;
1962
39a68477ead3 pActorBuffs[18] to pActorBuffs[ACTOR_BUFF_HEROISM]
Grumpy7
parents: 1961
diff changeset
212 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) == 0;
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
213 }
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
214 else
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
215 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
216 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
217 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
218 default:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
219 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
220 return 1;
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
221 }
0
Ritor1
parents:
diff changeset
222 }
Ritor1
parents:
diff changeset
223 if ( !(v3 | v4) )
Ritor1
parents:
diff changeset
224 return 0;
Ritor1
parents:
diff changeset
225 return 1;
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227
Ritor1
parents:
diff changeset
228 //----- (004272F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
229 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4)
Ritor1
parents:
diff changeset
230 {
Ritor1
parents:
diff changeset
231 signed int v5; // esi@1
Ritor1
parents:
diff changeset
232 signed int v6; // edi@1
Ritor1
parents:
diff changeset
233 int v7; // esi@8
Ritor1
parents:
diff changeset
234 int v8; // eax@9
Ritor1
parents:
diff changeset
235 int v9; // edx@11
Ritor1
parents:
diff changeset
236 int v10; // edx@13
Ritor1
parents:
diff changeset
237 int v11; // esi@13
Ritor1
parents:
diff changeset
238 unsigned __int8 v12; // sf@13
Ritor1
parents:
diff changeset
239 unsigned __int8 v13; // of@13
Ritor1
parents:
diff changeset
240 int v14; // edx@14
Ritor1
parents:
diff changeset
241 int v15; // eax@14
Ritor1
parents:
diff changeset
242 signed int result; // eax@17
Ritor1
parents:
diff changeset
243
Ritor1
parents:
diff changeset
244 v5 = pActor->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
245 v6 = 0;
1952
4ed7d18abe93 pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents: 1936
diff changeset
246 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
247 v5 /= 2;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
248 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
1959
4fbffad6e011 pActorBuffs[15] to pActorBuffs[ACTOR_BUFF_SHIELD]
Grumpy7
parents: 1958
diff changeset
249 v6 = pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uPower;
1960
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
250 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > v6 )
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
251 v6 = pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
0
Ritor1
parents:
diff changeset
252 v7 = v6 + v5;
Ritor1
parents:
diff changeset
253 if ( a3 )
Ritor1
parents:
diff changeset
254 v8 = pPlayer->GetRangedAttack();
Ritor1
parents:
diff changeset
255 else
1685
2a309997c42f Player::StealFromShop started cleanup, fixing a few errors caused by not commiting everything
Grumpy7
parents: 1637
diff changeset
256 v8 = pPlayer->GetActualAttack(false);
0
Ritor1
parents:
diff changeset
257 v9 = rand() % (v7 + 2 * v8 + 30);
Ritor1
parents:
diff changeset
258 if ( a3 == 2 )
Ritor1
parents:
diff changeset
259 {
Ritor1
parents:
diff changeset
260 v14 = a4 + v9;
Ritor1
parents:
diff changeset
261 v15 = ((v7 + 15) >> 1) + v7 + 15;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
262 v13 = __OFSUB__(v14, v15);
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
263 v12 = v14 - v15 < 0;
0
Ritor1
parents:
diff changeset
264 }
Ritor1
parents:
diff changeset
265 else
Ritor1
parents:
diff changeset
266 {
Ritor1
parents:
diff changeset
267 if ( a3 != 3 )
Ritor1
parents:
diff changeset
268 {
Ritor1
parents:
diff changeset
269 v10 = a4 + v9;
Ritor1
parents:
diff changeset
270 v11 = v7 + 15;
Ritor1
parents:
diff changeset
271 v13 = __OFSUB__(v10, v11);
Ritor1
parents:
diff changeset
272 v12 = v10 - v11 < 0;
Ritor1
parents:
diff changeset
273 }
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
274 else
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
275 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
276 v14 = a4 + v9;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
277 v15 = 2 * v7 + 30;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
278 v13 = __OFSUB__(v14, v15);
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
279 v12 = v14 - v15 < 0;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
280 }
0
Ritor1
parents:
diff changeset
281 }
Ritor1
parents:
diff changeset
282 if ( v12 ^ v13 )
Ritor1
parents:
diff changeset
283 result = 0;
Ritor1
parents:
diff changeset
284 else
Ritor1
parents:
diff changeset
285 result = 1;
Ritor1
parents:
diff changeset
286 return result;
Ritor1
parents:
diff changeset
287 }
Ritor1
parents:
diff changeset
288
Ritor1
parents:
diff changeset
289 //----- (004273BB) --------------------------------------------------------
Ritor1
parents:
diff changeset
290 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4)
Ritor1
parents:
diff changeset
291 {
Ritor1
parents:
diff changeset
292 Actor *v5; // ecx@1
Ritor1
parents:
diff changeset
293 signed int v6; // ebx@1
Ritor1
parents:
diff changeset
294 signed int v7; // esi@1
Ritor1
parents:
diff changeset
295 unsigned __int8 v8; // zf@1
Ritor1
parents:
diff changeset
296 unsigned __int8 v9; // sf@1
Ritor1
parents:
diff changeset
297 int v10; // ebx@10
Ritor1
parents:
diff changeset
298 signed int a2a; // [sp+18h] [bp+Ch]@1
Ritor1
parents:
diff changeset
299
Ritor1
parents:
diff changeset
300 v5 = a2;
Ritor1
parents:
diff changeset
301 v6 = a2->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
302 v7 = 0;
1952
4ed7d18abe93 pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents: 1936
diff changeset
303 v8 = HIDWORD(a2->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime) == 0;
4ed7d18abe93 pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents: 1936
diff changeset
304 v9 = SHIDWORD(a2->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime) < 0;
0
Ritor1
parents:
diff changeset
305 a2a = 0;
1952
4ed7d18abe93 pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents: 1936
diff changeset
306 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime) > 0) )
0
Ritor1
parents:
diff changeset
307 v6 /= 2;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
308 if ( (signed __int64)v5->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
309 v7 = v5->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
1960
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
310 if ( (signed __int64)v5->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && v5->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > v7 )
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
311 v7 = v5->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
0
Ritor1
parents:
diff changeset
312 v10 = v7 + v6;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
313 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
314 a2a = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
1961
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
315 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower > a2a )
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
316 a2a = pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower;
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
317 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
318 {
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
319 a2a += pActor->pActorBuffs[ACTOR_BUFF_FATE].uPower;
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
320 pActor->pActorBuffs[ACTOR_BUFF_FATE].Reset();
0
Ritor1
parents:
diff changeset
321 }
Ritor1
parents:
diff changeset
322 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5;
Ritor1
parents:
diff changeset
323 }
Ritor1
parents:
diff changeset
324
Ritor1
parents:
diff changeset
325 //----- (004274AD) --------------------------------------------------------
Ritor1
parents:
diff changeset
326 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer)
Ritor1
parents:
diff changeset
327 {
Ritor1
parents:
diff changeset
328 signed int v3; // edi@1
Ritor1
parents:
diff changeset
329 signed int v4; // esi@8
Ritor1
parents:
diff changeset
330 int v5; // esi@8
Ritor1
parents:
diff changeset
331
Ritor1
parents:
diff changeset
332 v3 = 0;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
333 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
334 v3 = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
1961
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
335 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower > v3 )
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
336 v3 = pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower;
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
337 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
338 {
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
339 v3 += pActor->pActorBuffs[ACTOR_BUFF_FATE].uPower;
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
340 pActor->pActorBuffs[ACTOR_BUFF_FATE].Reset();
0
Ritor1
parents:
diff changeset
341 }
Ritor1
parents:
diff changeset
342 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10;
Ritor1
parents:
diff changeset
343 v5 = rand() % v4 + 1;
Ritor1
parents:
diff changeset
344 return v3 + v5 > pPlayer->GetActualAC() + 5;
Ritor1
parents:
diff changeset
345 }
Ritor1
parents:
diff changeset
346
Ritor1
parents:
diff changeset
347 //----- (00427546) --------------------------------------------------------
Ritor1
parents:
diff changeset
348 int stru319::_427546(int a2)
Ritor1
parents:
diff changeset
349 {
Ritor1
parents:
diff changeset
350 int result; // eax@2
Ritor1
parents:
diff changeset
351
Ritor1
parents:
diff changeset
352 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
353 {
Ritor1
parents:
diff changeset
354 if ( a2 >= 1 )
Ritor1
parents:
diff changeset
355 result = (a2 >= 2) + 2;
Ritor1
parents:
diff changeset
356 else
Ritor1
parents:
diff changeset
357 result = 1;
Ritor1
parents:
diff changeset
358 }
Ritor1
parents:
diff changeset
359 else
Ritor1
parents:
diff changeset
360 {
Ritor1
parents:
diff changeset
361 result = 0;
Ritor1
parents:
diff changeset
362 }
Ritor1
parents:
diff changeset
363 return result;
Ritor1
parents:
diff changeset
364 }
Ritor1
parents:
diff changeset
365
Ritor1
parents:
diff changeset
366 //----- (0042756B) --------------------------------------------------------
Ritor1
parents:
diff changeset
367 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3)
Ritor1
parents:
diff changeset
368 {
Ritor1
parents:
diff changeset
369 int v4; // edx@1
Ritor1
parents:
diff changeset
370 int v5; // ecx@1
Ritor1
parents:
diff changeset
371 signed int v6; // eax@4
Ritor1
parents:
diff changeset
372 signed int result; // eax@17
Ritor1
parents:
diff changeset
373 signed int v8; // esi@18
Ritor1
parents:
diff changeset
374
Ritor1
parents:
diff changeset
375 v4 = 0;
Ritor1
parents:
diff changeset
376 v5 = 0;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
377 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
378 v5 = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
0
Ritor1
parents:
diff changeset
379 switch ( a2 )
Ritor1
parents:
diff changeset
380 {
Ritor1
parents:
diff changeset
381 case 0:
Ritor1
parents:
diff changeset
382 v6 = pActor->pMonsterInfo.uResFire;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
383 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
384 break;
0
Ritor1
parents:
diff changeset
385 case 1:
Ritor1
parents:
diff changeset
386 v6 = pActor->pMonsterInfo.uResAir;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
387 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
388 break;
0
Ritor1
parents:
diff changeset
389 case 2:
Ritor1
parents:
diff changeset
390 v6 = pActor->pMonsterInfo.uResWater;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
391 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
392 break;
0
Ritor1
parents:
diff changeset
393 case 3:
Ritor1
parents:
diff changeset
394 v6 = pActor->pMonsterInfo.uResEarth;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
395 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
396 break;
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
397 case 4:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
398 v6 = pActor->pMonsterInfo.uResPhysical;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
399 break;
0
Ritor1
parents:
diff changeset
400 case 6:
Ritor1
parents:
diff changeset
401 v6 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
402 break;
Ritor1
parents:
diff changeset
403 case 7:
Ritor1
parents:
diff changeset
404 v6 = pActor->pMonsterInfo.uResMind;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
405 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
406 break;
0
Ritor1
parents:
diff changeset
407 case 8:
Ritor1
parents:
diff changeset
408 v6 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
409 v4 = v5;
Ritor1
parents:
diff changeset
410 break;
Ritor1
parents:
diff changeset
411 case 9:
Ritor1
parents:
diff changeset
412 v6 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
413 break;
Ritor1
parents:
diff changeset
414 case 10:
Ritor1
parents:
diff changeset
415 v6 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
416 break;
Ritor1
parents:
diff changeset
417 default:
Ritor1
parents:
diff changeset
418 v6 = 0;
Ritor1
parents:
diff changeset
419 break;
Ritor1
parents:
diff changeset
420 }
Ritor1
parents:
diff changeset
421 if ( v6 < 200 )
Ritor1
parents:
diff changeset
422 {
Ritor1
parents:
diff changeset
423 v8 = v4 + v6 + 30;
Ritor1
parents:
diff changeset
424 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
425 {
Ritor1
parents:
diff changeset
426 a3 >>= 1;
Ritor1
parents:
diff changeset
427 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
428 {
Ritor1
parents:
diff changeset
429 a3 >>= 1;
Ritor1
parents:
diff changeset
430 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
431 {
Ritor1
parents:
diff changeset
432 a3 >>= 1;
Ritor1
parents:
diff changeset
433 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
434 a3 >>= 1;
Ritor1
parents:
diff changeset
435 }
Ritor1
parents:
diff changeset
436 }
Ritor1
parents:
diff changeset
437 }
Ritor1
parents:
diff changeset
438 result = a3;
Ritor1
parents:
diff changeset
439 }
Ritor1
parents:
diff changeset
440 else
Ritor1
parents:
diff changeset
441 {
Ritor1
parents:
diff changeset
442 result = 0;
Ritor1
parents:
diff changeset
443 }
Ritor1
parents:
diff changeset
444 return result;
Ritor1
parents:
diff changeset
445 }
Ritor1
parents:
diff changeset
446
Ritor1
parents:
diff changeset
447 //----- (00427662) --------------------------------------------------------
Ritor1
parents:
diff changeset
448 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType)
Ritor1
parents:
diff changeset
449 {
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
450 signed int resist; // esi@2
0
Ritor1
parents:
diff changeset
451 bool result; // eax@13
Ritor1
parents:
diff changeset
452
Ritor1
parents:
diff changeset
453 switch ( uType )
Ritor1
parents:
diff changeset
454 {
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
455 case 0:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
456 resist = pActor->pMonsterInfo.uResFire;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
457 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
458 case 1:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
459 resist = pActor->pMonsterInfo.uResAir;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
460 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
461 case 2:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
462 resist = pActor->pMonsterInfo.uResWater;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
463 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
464 case 3:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
465 resist = pActor->pMonsterInfo.uResEarth;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
466 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
467 case 4:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
468 resist = pActor->pMonsterInfo.uResPhysical;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
469 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
470 case 6:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
471 resist = pActor->pMonsterInfo.uResSpirit;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
472 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
473 case 7:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
474 resist = pActor->pMonsterInfo.uResMind;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
475 case 8:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
476 resist = pActor->pMonsterInfo.uResBody;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
477 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
478 case 9:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
479 resist = pActor->pMonsterInfo.uResLight;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
480 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
481 case 10:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
482 resist = pActor->pMonsterInfo.uResDark;
0
Ritor1
parents:
diff changeset
483 break;
Ritor1
parents:
diff changeset
484 default:
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
485 return 1;
0
Ritor1
parents:
diff changeset
486 }
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
487 if ( resist < 200 )
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
488 result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
489 else
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
490 result = 0;
0
Ritor1
parents:
diff changeset
491 return result;
Ritor1
parents:
diff changeset
492 }
Ritor1
parents:
diff changeset
493
Ritor1
parents:
diff changeset
494 //----- (0042EB8D) --------------------------------------------------------
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
495 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
0
Ritor1
parents:
diff changeset
496 {
482
9898e6b413d8 some debug stuff commented
Nomad
parents: 469
diff changeset
497 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line);
0
Ritor1
parents:
diff changeset
498 if (uNumMessages < 40)
Ritor1
parents:
diff changeset
499 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
500 files[uNumMessages] = file;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
501 lines[uNumMessages] = line;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
502
0
Ritor1
parents:
diff changeset
503 pMessages[uNumMessages].eType = msg;
Ritor1
parents:
diff changeset
504 pMessages[uNumMessages].param = param;
Ritor1
parents:
diff changeset
505 pMessages[uNumMessages++].field_8 = a4;
Ritor1
parents:
diff changeset
506 }
Ritor1
parents:
diff changeset
507 }
Ritor1
parents:
diff changeset
508
Ritor1
parents:
diff changeset
509
Ritor1
parents:
diff changeset
510 //----- (0042EBDB) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
511 int stru193_math::Sin(int angle)
0
Ritor1
parents:
diff changeset
512 {
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
513 return Cos(angle - this->uIntegerHalfPi);
0
Ritor1
parents:
diff changeset
514 }
Ritor1
parents:
diff changeset
515
Ritor1
parents:
diff changeset
516 //----- (0042ECB5) --------------------------------------------------------
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
517 void _42ECB5_PlayerAttacksActor()
0
Ritor1
parents:
diff changeset
518 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
519 //unsigned int v0; // ebx@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
520 //Player *v1; // esi@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
521 //bool result; // eax@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
522 //int v3; // edi@2
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
523 //unsigned int v4; // eax@7
0
Ritor1
parents:
diff changeset
524 char *v5; // eax@8
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
525 //int v6; // ecx@9
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
526 //signed int v7; // eax@16
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
527 //Actor *v8; // edi@20
0
Ritor1
parents:
diff changeset
528 unsigned int v9; // ecx@21
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
529 //char *v10; // eax@26
0
Ritor1
parents:
diff changeset
530 char *v11; // eax@26
Ritor1
parents:
diff changeset
531 unsigned int v12; // eax@47
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
532 //char *v13; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
533 //char *v14; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
534 //unsigned int v15; // ebx@54
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
535 //int v16; // [sp-10h] [bp-4Ch]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
536 //int v17; // [sp-10h] [bp-4Ch]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
537 //unsigned int v18; // [sp-Ch] [bp-48h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
538 //unsigned int v19; // [sp-Ch] [bp-48h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
539 //__int16 v20; // [sp-8h] [bp-44h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
540 //__int16 v21; // [sp-8h] [bp-44h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
541 //int v22; // [sp-4h] [bp-40h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
542 //int v23; // [sp-4h] [bp-40h]@44
0
Ritor1
parents:
diff changeset
543 SoundID v24; // [sp-4h] [bp-40h]@58
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
544 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
545 //unsigned int a2; // [sp+18h] [bp-24h]@20
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
546 //unsigned int v27; // [sp+1Ch] [bp-20h]@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
547 //int v28; // [sp+20h] [bp-1Ch]@9
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
548 //unsigned int *v28b;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
549 //int v29; // [sp+24h] [bp-18h]@16
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
550 //int v30; // [sp+28h] [bp-14h]@16
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
551 //int v31; // [sp+2Ch] [bp-10h]@4
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
552 //int v32; // [sp+30h] [bp-Ch]@7
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
553 //int v33; // [sp+34h] [bp-8h]@7
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
554 //int v34; // [sp+38h] [bp-4h]@17
0
Ritor1
parents:
diff changeset
555
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
556 //v0 = uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
557 //v27 = 6972 * uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
558 //v1 = &pParty->pPlayers[uActiveCharacter-1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
559 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
560 auto player = &pParty->pPlayers[uActiveCharacter - 1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
561 if (!player->CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
562 return;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
563
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1459
diff changeset
564 CastSpellInfoHelpers::_427D48();
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
565 //v3 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
566 if (pParty->Invisible())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
567 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
568
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
569 //v31 = player->pEquipment.uBow;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
570 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
571 if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken())
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
572 bow_idx = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
573
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
574 //v32 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
575 int wand_item_id = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
576 //v33 = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
577 //v4 = v1->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
578 int laser_weapon_item_id = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
579
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
580 int main_hand_idx = player->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
581 if (main_hand_idx)
0
Ritor1
parents:
diff changeset
582 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1340
diff changeset
583 auto item = &player->pInventoryItemList[main_hand_idx - 1];
112
909822c91d47 pointer fixes
zipi
parents: 90
diff changeset
584 //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
585 if (!item->IsBroken())
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
586 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
587 //v28b = &v1->pInventoryItems[v4].uItemID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
588 //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
589 if (item->GetItemEquipType() == EQUIP_WAND)
0
Ritor1
parents:
diff changeset
590 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
591 if (item->uNumCharges <= 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
592 player->pEquipment.uMainHand = 0; // wand discharged - unequip
0
Ritor1
parents:
diff changeset
593 else
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
594 wand_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
595 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
596 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
597 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
598 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
599 }
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
600
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
601 //v30 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
602 //v29 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
603 //v28 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
604 //v7 = pMouse->uPointingObjectID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
605
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
606 int target_pid = pMouse->uPointingObjectID;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
607 int target_type = PID_TYPE(target_pid),
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
608 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
609 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
610 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
611 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
612 target_type = PID_TYPE(target_pid);
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
613 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
614 }
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
615
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
616 auto actor = &pActors[target_id];
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
617 int actor_distance = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
618 if (target_type == OBJECT_Actor)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
619 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
620 int distance_x = actor->vPosition.x - pParty->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
621 distance_y = actor->vPosition.y - pParty->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
622 distance_z = actor->vPosition.z - pParty->vPosition.z;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
623 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
624 if (actor_distance < 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
625 actor_distance = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
626 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
627
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
628 bool shooting_bow = false,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
629 shotting_laser = false,
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
630 shooting_wand = false,
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
631 melee_attack = false;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
632 if (laser_weapon_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
633 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
634 shotting_laser = true;
490
Nomad
parents: 488
diff changeset
635 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
636 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
637 else if (wand_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
638 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
639 shooting_wand = true;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
640
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
641 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
642 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
643
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1340
diff changeset
644 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
645 player->pEquipment.uMainHand = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
646 }
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
647 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
648 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
649 melee_attack = true;
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
650
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
651 Vec3_int_ a3;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
652 a3.x = actor->vPosition.x - pParty->vPosition.x;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
653 a3.y = actor->vPosition.y - pParty->vPosition.y;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
654 a3.z = actor->vPosition.z - pParty->vPosition.z;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
655 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
656
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
657 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1052
diff changeset
658 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
659 _42FA66_do_explosive_impact(
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
660 actor->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
661 actor->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
662 actor->vPosition.z + actor->uActorHeight / 2,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
663 0, 512, uActiveCharacter);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
664 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
665 else if (bow_idx)
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
666 {
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
667 shooting_bow = true;
490
Nomad
parents: 488
diff changeset
668 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
669 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
670 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
671 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
672 melee_attack = true;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
673 ; // actor out of range or no actor; no ranged weapon so melee attacking air
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
674 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
675
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
676 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
677 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
678 int recovery = player->GetAttackRecoveryTime(false);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
679 if (recovery < 30 )
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
680 recovery = 30;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
681 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
682 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
683
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
684
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
685 int v34 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
686 if (shooting_wand)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
687 return;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
688 else if (shooting_bow)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
689 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
690 v34 = 5;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
691 player->PlaySound(SPEECH_50, 0);
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
692 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
693 if (shotting_laser)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
694 v34 = 7;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
695 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
696 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
697 int main_hand_idx = player->pEquipment.uMainHand;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
698 if (player->HasItemEquipped(EQUIP_MAIN_HAND))
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1685
diff changeset
699 v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1340
diff changeset
700 pTurnEngine->ApplyPlayerAction();
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
701 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
702
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
703 switch (v34)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
704 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
705 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
706 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
707 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
708 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
709 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
710 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
711 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
712 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
713 }
0
Ritor1
parents:
diff changeset
714 }
Ritor1
parents:
diff changeset
715
Ritor1
parents:
diff changeset
716 //----- (0042F184) --------------------------------------------------------
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
717 int stru319::FindClosestActor(int pick_depth, int a3, int a4)
0
Ritor1
parents:
diff changeset
718 {
Ritor1
parents:
diff changeset
719 int v4; // edi@1
Ritor1
parents:
diff changeset
720 stru319 *v5; // esi@1
Ritor1
parents:
diff changeset
721 int v6; // eax@2
Ritor1
parents:
diff changeset
722 int v7; // eax@4
Ritor1
parents:
diff changeset
723 int result; // eax@5
Ritor1
parents:
diff changeset
724 int *v9; // edx@8
Ritor1
parents:
diff changeset
725 signed int v10; // ebx@10
Ritor1
parents:
diff changeset
726 int v11; // edi@11
Ritor1
parents:
diff changeset
727 Actor *v12; // esi@12
Ritor1
parents:
diff changeset
728 unsigned __int16 v13; // ax@12
Ritor1
parents:
diff changeset
729 int v14; // eax@22
Ritor1
parents:
diff changeset
730 char v15; // zf@30
Ritor1
parents:
diff changeset
731 int v16; // esi@32
Ritor1
parents:
diff changeset
732 int v17; // ecx@34
Ritor1
parents:
diff changeset
733 stru319 *v18; // eax@39
Ritor1
parents:
diff changeset
734 int v19; // edx@39
Ritor1
parents:
diff changeset
735 int v20; // ecx@41
Ritor1
parents:
diff changeset
736 unsigned __int16 v21; // ax@42
Ritor1
parents:
diff changeset
737 unsigned int v22; // [sp+8h] [bp-24h]@11
Ritor1
parents:
diff changeset
738 unsigned int v23; // [sp+Ch] [bp-20h]@7
Ritor1
parents:
diff changeset
739 stru319 *v24; // [sp+10h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
740 unsigned int v25; // [sp+14h] [bp-18h]@8
Ritor1
parents:
diff changeset
741 int *v26; // [sp+18h] [bp-14h]@8
Ritor1
parents:
diff changeset
742 int v27; // [sp+1Ch] [bp-10h]@10
Ritor1
parents:
diff changeset
743 int *v28; // [sp+20h] [bp-Ch]@10
Ritor1
parents:
diff changeset
744 unsigned int v29; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
745 int v30; // [sp+28h] [bp-4h]@6
Ritor1
parents:
diff changeset
746 int i; // [sp+38h] [bp+Ch]@33
Ritor1
parents:
diff changeset
747 signed int v32; // [sp+3Ch] [bp+10h]@32
Ritor1
parents:
diff changeset
748
Ritor1
parents:
diff changeset
749 v4 = 0;
Ritor1
parents:
diff changeset
750 v5 = this;
Ritor1
parents:
diff changeset
751 v24 = this;
Ritor1
parents:
diff changeset
752 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
753 {
Ritor1
parents:
diff changeset
754 v6 = a3 != 0;
Ritor1
parents:
diff changeset
755 if ( a4 )
Ritor1
parents:
diff changeset
756 LOBYTE(v6) = v6 | 8;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
757 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
0
Ritor1
parents:
diff changeset
758 if ( v7 != -1 )
Ritor1
parents:
diff changeset
759 return (unsigned __int16)v7;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
760 else return 0;
0
Ritor1
parents:
diff changeset
761 }
Ritor1
parents:
diff changeset
762 else
Ritor1
parents:
diff changeset
763 {
Ritor1
parents:
diff changeset
764 v30 = 0;
Ritor1
parents:
diff changeset
765 if ( pRenderer->pActiveZBuffer )
Ritor1
parents:
diff changeset
766 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
767 v29 = viewparams->uScreen_topL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
768 v23 = viewparams->uScreen_BttmR_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
769 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
0
Ritor1
parents:
diff changeset
770 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
771 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
772 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
773 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
0
Ritor1
parents:
diff changeset
774 do
Ritor1
parents:
diff changeset
775 {
Ritor1
parents:
diff changeset
776 if ( (signed int)v29 < (signed int)v23 )
Ritor1
parents:
diff changeset
777 {
Ritor1
parents:
diff changeset
778 v28 = v9;
Ritor1
parents:
diff changeset
779 v10 = v4;
Ritor1
parents:
diff changeset
780 v27 = v23 - v29;
Ritor1
parents:
diff changeset
781 do
Ritor1
parents:
diff changeset
782 {
Ritor1
parents:
diff changeset
783 v22 = *v28;
Ritor1
parents:
diff changeset
784 v11 = *v28 & 0xFFFF;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
785 if (PID_TYPE(v11) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
786 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
787 v12 = &pActors[PID_ID(v11)];
0
Ritor1
parents:
diff changeset
788 v13 = v12->uAIState;
Ritor1
parents:
diff changeset
789 if ( v13 != 5 )
Ritor1
parents:
diff changeset
790 {
Ritor1
parents:
diff changeset
791 if ( v13 != 4
Ritor1
parents:
diff changeset
792 && v13 != 11
Ritor1
parents:
diff changeset
793 && v13 != 19
Ritor1
parents:
diff changeset
794 && v13 != 17
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
795 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) )
0
Ritor1
parents:
diff changeset
796 {
Ritor1
parents:
diff changeset
797 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
798 && v22 <= pick_depth << 16 )
0
Ritor1
parents:
diff changeset
799 {
Ritor1
parents:
diff changeset
800 v14 = 0;
Ritor1
parents:
diff changeset
801 if ( v10 > 0 )
Ritor1
parents:
diff changeset
802 {
Ritor1
parents:
diff changeset
803 do
Ritor1
parents:
diff changeset
804 {
Ritor1
parents:
diff changeset
805 if ( dword_50BDA0[v14] == v11 )
Ritor1
parents:
diff changeset
806 break;
Ritor1
parents:
diff changeset
807 ++v14;
Ritor1
parents:
diff changeset
808 }
Ritor1
parents:
diff changeset
809 while ( v14 < v30 );
Ritor1
parents:
diff changeset
810 }
Ritor1
parents:
diff changeset
811 if ( v14 == v30 && v10 < 100 )
Ritor1
parents:
diff changeset
812 {
Ritor1
parents:
diff changeset
813 ++v30;
Ritor1
parents:
diff changeset
814 dword_50BC10[v10] = v22;
Ritor1
parents:
diff changeset
815 dword_50BDA0[v10] = v11;
Ritor1
parents:
diff changeset
816 ++v10;
Ritor1
parents:
diff changeset
817 }
Ritor1
parents:
diff changeset
818 }
Ritor1
parents:
diff changeset
819 }
Ritor1
parents:
diff changeset
820 }
Ritor1
parents:
diff changeset
821 }
Ritor1
parents:
diff changeset
822 ++v28;
Ritor1
parents:
diff changeset
823 --v27;
Ritor1
parents:
diff changeset
824 }
Ritor1
parents:
diff changeset
825 while ( v27 );
Ritor1
parents:
diff changeset
826 v4 = v30;
Ritor1
parents:
diff changeset
827 v5 = v24;
Ritor1
parents:
diff changeset
828 }
Ritor1
parents:
diff changeset
829 v9 = v26 + 640;
Ritor1
parents:
diff changeset
830 v15 = v25-- == 1;
Ritor1
parents:
diff changeset
831 v26 += 640;
Ritor1
parents:
diff changeset
832 }
Ritor1
parents:
diff changeset
833 while ( !v15 );
Ritor1
parents:
diff changeset
834 }
Ritor1
parents:
diff changeset
835 if ( v4 > 0 )
Ritor1
parents:
diff changeset
836 {
Ritor1
parents:
diff changeset
837 v32 = 1;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
838 v16 = (int)dword_50BC10.data();
0
Ritor1
parents:
diff changeset
839 do
Ritor1
parents:
diff changeset
840 {
Ritor1
parents:
diff changeset
841 for ( i = v32; i < v4; ++i )
Ritor1
parents:
diff changeset
842 {
Ritor1
parents:
diff changeset
843 v17 = dword_50BC10[i];
Ritor1
parents:
diff changeset
844 if ( v17 < *(int *)v16 )
Ritor1
parents:
diff changeset
845 {
Ritor1
parents:
diff changeset
846 dword_50BC10[i] = *(int *)v16;
Ritor1
parents:
diff changeset
847 *(int *)v16 = v17;
Ritor1
parents:
diff changeset
848 }
Ritor1
parents:
diff changeset
849 }
Ritor1
parents:
diff changeset
850 ++v32;
Ritor1
parents:
diff changeset
851 v16 += 4;
Ritor1
parents:
diff changeset
852 }
Ritor1
parents:
diff changeset
853 while ( v32 - 1 < v4 );
Ritor1
parents:
diff changeset
854 v5 = v24;
Ritor1
parents:
diff changeset
855 if ( v4 > 0 )
Ritor1
parents:
diff changeset
856 {
Ritor1
parents:
diff changeset
857 v18 = v24;
Ritor1
parents:
diff changeset
858 v19 = v4;
Ritor1
parents:
diff changeset
859 do
Ritor1
parents:
diff changeset
860 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
861 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF;
0
Ritor1
parents:
diff changeset
862 v18 += 4;
Ritor1
parents:
diff changeset
863 --v19;
Ritor1
parents:
diff changeset
864 }
Ritor1
parents:
diff changeset
865 while ( v19 );
Ritor1
parents:
diff changeset
866 }
Ritor1
parents:
diff changeset
867 }
Ritor1
parents:
diff changeset
868 v20 = 0;
Ritor1
parents:
diff changeset
869 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 )
Ritor1
parents:
diff changeset
870 {
Ritor1
parents:
diff changeset
871 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState;
Ritor1
parents:
diff changeset
872 if ( v21 != 4 && v21 != 5 )
Ritor1
parents:
diff changeset
873 break;
Ritor1
parents:
diff changeset
874 }
Ritor1
parents:
diff changeset
875 if ( v20 != v4 )
Ritor1
parents:
diff changeset
876 {
Ritor1
parents:
diff changeset
877 result = 8 * *(int *)&v5[4 * v20].field_0;
Ritor1
parents:
diff changeset
878 LOBYTE(result) = result | 3;
Ritor1
parents:
diff changeset
879 return result;
Ritor1
parents:
diff changeset
880 }
Ritor1
parents:
diff changeset
881 }
Ritor1
parents:
diff changeset
882 }
Ritor1
parents:
diff changeset
883 return 0;
Ritor1
parents:
diff changeset
884 }
Ritor1
parents:
diff changeset
885
Ritor1
parents:
diff changeset
886 //----- (0042F3D6) --------------------------------------------------------
Ritor1
parents:
diff changeset
887 void InitializeTurnBasedAnimations(void *_this)
Ritor1
parents:
diff changeset
888 {
Ritor1
parents:
diff changeset
889 unsigned int *v1; // edi@1
Ritor1
parents:
diff changeset
890
Ritor1
parents:
diff changeset
891 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0");
Ritor1
parents:
diff changeset
892 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1");
Ritor1
parents:
diff changeset
893 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2");
Ritor1
parents:
diff changeset
894 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3");
Ritor1
parents:
diff changeset
895 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4");
Ritor1
parents:
diff changeset
896 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
Ritor1
parents:
diff changeset
897 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
Ritor1
parents:
diff changeset
898 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
Ritor1
parents:
diff changeset
899 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
Ritor1
parents:
diff changeset
900 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
901 v1 = pIconIDs_Turn.data();
0
Ritor1
parents:
diff changeset
902 do
Ritor1
parents:
diff changeset
903 {
Ritor1
parents:
diff changeset
904 pIconsFrameTable->InitializeAnimation(*v1);
Ritor1
parents:
diff changeset
905 ++v1;
Ritor1
parents:
diff changeset
906 }
Ritor1
parents:
diff changeset
907 while ( (signed int)v1 < (signed int)&uIconID_TurnStop );
Ritor1
parents:
diff changeset
908 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
Ritor1
parents:
diff changeset
909 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
Ritor1
parents:
diff changeset
910 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
Ritor1
parents:
diff changeset
911 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
Ritor1
parents:
diff changeset
912 }
Ritor1
parents:
diff changeset
913
Ritor1
parents:
diff changeset
914 //----- (0042F7EB) --------------------------------------------------------
Ritor1
parents:
diff changeset
915 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)
Ritor1
parents:
diff changeset
916 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
917 unsigned __int16 pObjectDescID; // ax@7
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
918 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
0
Ritor1
parents:
diff changeset
919
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
920 pSpellObject.stru_24.Reset();
0
Ritor1
parents:
diff changeset
921 if ( a9 )
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
922 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24));
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
923 pSpellObject.spell_skill = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
924 pSpellObject.spell_level = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
925 pSpellObject.spell_id = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
926 pSpellObject.field_54 = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
927 pSpellObject.uType = uSpriteID;
0
Ritor1
parents:
diff changeset
928 if ( (signed int)pObjectList->uNumObjects <= 0 )
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
929 pObjectDescID = 0;
0
Ritor1
parents:
diff changeset
930 else
Ritor1
parents:
diff changeset
931 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
932 pObjectDescID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
933 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
0
Ritor1
parents:
diff changeset
934 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
935 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
936 pObjectDescID = i;
0
Ritor1
parents:
diff changeset
937 }
Ritor1
parents:
diff changeset
938 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
939 pSpellObject.uObjectDescID = pObjectDescID;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
940 pSpellObject.vPosition.x = x;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
941 pSpellObject.vPosition.y = y;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
942 pSpellObject.vPosition.z = z;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
943 pSpellObject.uSoundID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
944 pSpellObject.uAttributes = attributes;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
945 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
946 pSpellObject.uSpriteFrameID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
947 pSpellObject.spell_caster_pid = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
948 pSpellObject.spell_target_pid = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
949 if ( !(pSpellObject.uAttributes & 0x10) )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
950 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
951 if ( pItemsTable->uAllItemsCount )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
952 {
1729
f44b6e02e81c pop-up window in character(paperdill) window, alchemy
Ritor1
parents: 1709
diff changeset
953 for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i )
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
954 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
955 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
956 pSpellObject.stru_24.uItemID = i;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
957 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
958 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
959 }
0
Ritor1
parents:
diff changeset
960 if ( a7 )
Ritor1
parents:
diff changeset
961 {
Ritor1
parents:
diff changeset
962 if ( count > 0 )
Ritor1
parents:
diff changeset
963 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
964 for ( uint i = count; i; --i )
0
Ritor1
parents:
diff changeset
965 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
966 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
967 pSpellObject.Create((signed __int16)pSpellObject.uFacing,
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
968 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
969
0
Ritor1
parents:
diff changeset
970 }
Ritor1
parents:
diff changeset
971 }
Ritor1
parents:
diff changeset
972 }
Ritor1
parents:
diff changeset
973 else
Ritor1
parents:
diff changeset
974 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
975 pSpellObject.uFacing = 0;
0
Ritor1
parents:
diff changeset
976 if ( count > 0 )
Ritor1
parents:
diff changeset
977 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
978 for ( uint i = count; i; --i )
0
Ritor1
parents:
diff changeset
979 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
980 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0);
0
Ritor1
parents:
diff changeset
981 }
Ritor1
parents:
diff changeset
982 }
Ritor1
parents:
diff changeset
983 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
984 return true;
0
Ritor1
parents:
diff changeset
985 }
Ritor1
parents:
diff changeset
986
Ritor1
parents:
diff changeset
987 //----- (0042F960) --------------------------------------------------------
Ritor1
parents:
diff changeset
988 void __fastcall sub_42F960_create_object(int x, int y, int z)
Ritor1
parents:
diff changeset
989 {
Ritor1
parents:
diff changeset
990 int v3; // ebx@1
Ritor1
parents:
diff changeset
991 int v4; // edi@1
Ritor1
parents:
diff changeset
992 signed int v5; // edx@1
Ritor1
parents:
diff changeset
993 char *v6; // ecx@2
Ritor1
parents:
diff changeset
994 unsigned __int16 v7; // ax@5
Ritor1
parents:
diff changeset
995 signed int v8; // eax@6
Ritor1
parents:
diff changeset
996 signed int v9; // eax@7
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
997 //SpriteObject a1; // [sp+Ch] [bp-70h]@1
0
Ritor1
parents:
diff changeset
998
Ritor1
parents:
diff changeset
999 v3 = x;
Ritor1
parents:
diff changeset
1000 v4 = y;
Ritor1
parents:
diff changeset
1001
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1002 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
1003 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
1004 a1.stru_24.Reset();
Ritor1
parents:
diff changeset
1005
Ritor1
parents:
diff changeset
1006 v5 = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1007 a1.spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1008 a1.spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1009 a1.spell_id = 0;
0
Ritor1
parents:
diff changeset
1010 a1.field_54 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1011 a1.uType = 800;
0
Ritor1
parents:
diff changeset
1012 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
1013 {
Ritor1
parents:
diff changeset
1014 LABEL_5:
Ritor1
parents:
diff changeset
1015 v7 = 0;
Ritor1
parents:
diff changeset
1016 }
Ritor1
parents:
diff changeset
1017 else
Ritor1
parents:
diff changeset
1018 {
Ritor1
parents:
diff changeset
1019 v6 = (char *)&pObjectList->pObjects->uObjectID;
Ritor1
parents:
diff changeset
1020 while ( *(short *)v6 != 800 )
Ritor1
parents:
diff changeset
1021 {
Ritor1
parents:
diff changeset
1022 ++v5;
Ritor1
parents:
diff changeset
1023 v6 += 56;
Ritor1
parents:
diff changeset
1024 if ( v5 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
1025 goto LABEL_5;
Ritor1
parents:
diff changeset
1026 }
Ritor1
parents:
diff changeset
1027 v7 = v5;
Ritor1
parents:
diff changeset
1028 }
Ritor1
parents:
diff changeset
1029 a1.uObjectDescID = v7;
Ritor1
parents:
diff changeset
1030 a1.vPosition.x = v3;
Ritor1
parents:
diff changeset
1031 a1.vPosition.y = v4;
Ritor1
parents:
diff changeset
1032 a1.vPosition.z = z;
Ritor1
parents:
diff changeset
1033 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
1034 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
1035 a1.uSectorID = pIndoor->GetSector(v3, v4, z);
Ritor1
parents:
diff changeset
1036 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1037 a1.spell_caster_pid = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
1038 a1.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
1039 v8 = a1.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
1040 if ( v8 != -1 )
Ritor1
parents:
diff changeset
1041 {
Ritor1
parents:
diff changeset
1042 v9 = 8 * v8;
Ritor1
parents:
diff changeset
1043 LOBYTE(v9) = v9 | 2;
Ritor1
parents:
diff changeset
1044 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
1045 }
Ritor1
parents:
diff changeset
1046 }
Ritor1
parents:
diff changeset
1047
810
f5156b8c61ad savegame refactoring
Gloval
parents: 792
diff changeset
1048
0
Ritor1
parents:
diff changeset
1049
Ritor1
parents:
diff changeset
1050 //----- (0042FA66) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
1051 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
0
Ritor1
parents:
diff changeset
1052 {
Ritor1
parents:
diff changeset
1053 int v6; // edi@1
Ritor1
parents:
diff changeset
1054 int v7; // esi@1
Ritor1
parents:
diff changeset
1055 char *v8; // ecx@2
Ritor1
parents:
diff changeset
1056 unsigned __int16 v9; // ax@5
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1057 //int v10; // eax@10
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
1058 //signed int result; // eax@11
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1059 //__int16 v12; // ax@12
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1060 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1
0
Ritor1
parents:
diff changeset
1061 int v14; // [sp+7Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
1062
Ritor1
parents:
diff changeset
1063 v6 = a1;
Ritor1
parents:
diff changeset
1064 v7 = a2;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1065 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
1066 //SpriteObject::SpriteObject(&a1a);
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1067 a1a.uType = 600;
0
Ritor1
parents:
diff changeset
1068 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
1069
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1070 a1a.spell_id = SPELL_FIRE_FIREBALL;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1071 a1a.spell_level = 8;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1072 a1a.spell_skill = 3;
0
Ritor1
parents:
diff changeset
1073 v14 = 0;
Ritor1
parents:
diff changeset
1074 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
1075 {
Ritor1
parents:
diff changeset
1076 LABEL_5:
Ritor1
parents:
diff changeset
1077 v9 = 0;
Ritor1
parents:
diff changeset
1078 }
Ritor1
parents:
diff changeset
1079 else
Ritor1
parents:
diff changeset
1080 {
Ritor1
parents:
diff changeset
1081 v8 = (char *)&pObjectList->pObjects->uObjectID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1082 while ( (short)a1a.uType != *(short *)v8 )
0
Ritor1
parents:
diff changeset
1083 {
Ritor1
parents:
diff changeset
1084 ++v14;
Ritor1
parents:
diff changeset
1085 v8 += 56;
Ritor1
parents:
diff changeset
1086 if ( v14 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
1087 goto LABEL_5;
Ritor1
parents:
diff changeset
1088 }
Ritor1
parents:
diff changeset
1089 v9 = v14;
Ritor1
parents:
diff changeset
1090 }
Ritor1
parents:
diff changeset
1091 a1a.uObjectDescID = v9;
Ritor1
parents:
diff changeset
1092 a1a.vPosition.x = v6;
Ritor1
parents:
diff changeset
1093 a1a.vPosition.y = v7;
Ritor1
parents:
diff changeset
1094 a1a.vPosition.z = a3;
Ritor1
parents:
diff changeset
1095 a1a.uAttributes = 0;
Ritor1
parents:
diff changeset
1096 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3);
Ritor1
parents:
diff changeset
1097 a1a.uSpriteFrameID = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
1098 a1a.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
1099 a1a.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
1100 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
1101 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
1102 if ( a6 >= 1 || a6 <= 4 )
Ritor1
parents:
diff changeset
1103 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1104 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
0
Ritor1
parents:
diff changeset
1105 }
Ritor1
parents:
diff changeset
1106 else
Ritor1
parents:
diff changeset
1107 {
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1108 a1a.spell_caster_pid = 0;
0
Ritor1
parents:
diff changeset
1109 }
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
1110
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
1111 int id = a1a.Create(0, 0, 0, 0);
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
1112 if (id != -1)
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
1113 stru_50FE08.Add(PID(OBJECT_Item, id),
0
Ritor1
parents:
diff changeset
1114 a5,
Ritor1
parents:
diff changeset
1115 SLOWORD(a1a.vPosition.x),
Ritor1
parents:
diff changeset
1116 SLOWORD(a1a.vPosition.y),
Ritor1
parents:
diff changeset
1117 SLOWORD(a1a.vPosition.z),
Ritor1
parents:
diff changeset
1118 0,
Ritor1
parents:
diff changeset
1119 0);
Ritor1
parents:
diff changeset
1120 }
Ritor1
parents:
diff changeset
1121
Ritor1
parents:
diff changeset
1122 //----- (0042FB5C) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1450
diff changeset
1123 bool _42FB5C_check_spell(signed int a1)
0
Ritor1
parents:
diff changeset
1124 {
Ritor1
parents:
diff changeset
1125 int v1; // ecx@3
Ritor1
parents:
diff changeset
1126 int v2; // ecx@4
Ritor1
parents:
diff changeset
1127 int v3; // ecx@5
Ritor1
parents:
diff changeset
1128 int v4; // ecx@6
Ritor1
parents:
diff changeset
1129 int v5; // ecx@7
Ritor1
parents:
diff changeset
1130 int v6; // ecx@8
Ritor1
parents:
diff changeset
1131 char v7; // zf@9
Ritor1
parents:
diff changeset
1132
Ritor1
parents:
diff changeset
1133 if ( a1 > 39 )
Ritor1
parents:
diff changeset
1134 {
Ritor1
parents:
diff changeset
1135 if ( a1 > 77 )
Ritor1
parents:
diff changeset
1136 {
Ritor1
parents:
diff changeset
1137 if ( a1 == 80 )
Ritor1
parents:
diff changeset
1138 return 0;
Ritor1
parents:
diff changeset
1139 if ( a1 > 84 )
Ritor1
parents:
diff changeset
1140 {
Ritor1
parents:
diff changeset
1141 if ( a1 <= 86 )
Ritor1
parents:
diff changeset
1142 return 0;
Ritor1
parents:
diff changeset
1143 v7 = a1 == 95;
Ritor1
parents:
diff changeset
1144 goto LABEL_20;
Ritor1
parents:
diff changeset
1145 }
Ritor1
parents:
diff changeset
1146 }
Ritor1
parents:
diff changeset
1147 else
Ritor1
parents:
diff changeset
1148 {
Ritor1
parents:
diff changeset
1149 if ( a1 == 77 )
Ritor1
parents:
diff changeset
1150 return 0;
Ritor1
parents:
diff changeset
1151 if ( a1 >= 46 )
Ritor1
parents:
diff changeset
1152 {
Ritor1
parents:
diff changeset
1153 if ( a1 <= 47 || a1 == 51 )
Ritor1
parents:
diff changeset
1154 return 0;
Ritor1
parents:
diff changeset
1155 v7 = a1 == 73;
Ritor1
parents:
diff changeset
1156 goto LABEL_20;
Ritor1
parents:
diff changeset
1157 }
Ritor1
parents:
diff changeset
1158 }
Ritor1
parents:
diff changeset
1159 return 1;
Ritor1
parents:
diff changeset
1160 }
Ritor1
parents:
diff changeset
1161 if ( a1 == 39 || (v1 = a1 - 2) == 0 )
Ritor1
parents:
diff changeset
1162 return 1;
Ritor1
parents:
diff changeset
1163 v2 = v1 - 3;
Ritor1
parents:
diff changeset
1164 if ( !v2 )
Ritor1
parents:
diff changeset
1165 return 0;
Ritor1
parents:
diff changeset
1166 v3 = v2 - 1;
Ritor1
parents:
diff changeset
1167 if ( !v3 || (v4 = v3 - 3) == 0 )
Ritor1
parents:
diff changeset
1168 return 1;
Ritor1
parents:
diff changeset
1169 v5 = v4 - 8;
Ritor1
parents:
diff changeset
1170 if ( !v5 )
Ritor1
parents:
diff changeset
1171 return 0;
Ritor1
parents:
diff changeset
1172 v6 = v5 - 1;
Ritor1
parents:
diff changeset
1173 if ( !v6 )
Ritor1
parents:
diff changeset
1174 return 1;
Ritor1
parents:
diff changeset
1175 v7 = v6 == 20;
Ritor1
parents:
diff changeset
1176 LABEL_20:
Ritor1
parents:
diff changeset
1177 if ( !v7 )
Ritor1
parents:
diff changeset
1178 return 1;
Ritor1
parents:
diff changeset
1179 return 0;
Ritor1
parents:
diff changeset
1180 }
Ritor1
parents:
diff changeset
1181
Ritor1
parents:
diff changeset
1182 //----- (0042FBDD) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1450
diff changeset
1183 void sub_42FBDD()
0
Ritor1
parents:
diff changeset
1184 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
1185 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
1186 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
Ritor1
parents:
diff changeset
1187 pRenderer->Present();
Ritor1
parents:
diff changeset
1188 }
Ritor1
parents:
diff changeset
1189
Ritor1
parents:
diff changeset
1190 //----- (0042FC15) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1450
diff changeset
1191 void CloseWindowBackground()
0
Ritor1
parents:
diff changeset
1192 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
1193 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
1194 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
Ritor1
parents:
diff changeset
1195 pRenderer->Present();
Ritor1
parents:
diff changeset
1196 }
Ritor1
parents:
diff changeset
1197
Ritor1
parents:
diff changeset
1198 //----- (0042FC4E) --------------------------------------------------------
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1574
diff changeset
1199 void ProcessInputActions()
0
Ritor1
parents:
diff changeset
1200 {
Ritor1
parents:
diff changeset
1201 char v4; // al@9
Ritor1
parents:
diff changeset
1202 char v8; // bl@100
Ritor1
parents:
diff changeset
1203 unsigned __int16 v9; // ax@102
Ritor1
parents:
diff changeset
1204 int v10; // eax@103
Ritor1
parents:
diff changeset
1205 char v14; // al@159
Ritor1
parents:
diff changeset
1206 unsigned int v15; // eax@168
Ritor1
parents:
diff changeset
1207 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
1208 InputAction inputAction; // [sp+0h] [bp-8h]@7
Ritor1
parents:
diff changeset
1209 int v24; // [sp+4h] [bp-4h]@87
Ritor1
parents:
diff changeset
1210
Ritor1
parents:
diff changeset
1211 pGame->pKeyboardInstance->EnterCriticalSection();
Ritor1
parents:
diff changeset
1212 auto pKeyboard = pGame->pKeyboardInstance;
Ritor1
parents:
diff changeset
1213 if (!bAlwaysRun)
Ritor1
parents:
diff changeset
1214 {
Ritor1
parents:
diff changeset
1215 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
1216 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1217 else
Ritor1
parents:
diff changeset
1218 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1219 }
Ritor1
parents:
diff changeset
1220 else
Ritor1
parents:
diff changeset
1221 {
Ritor1
parents:
diff changeset
1222 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
1223 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1224 else
Ritor1
parents:
diff changeset
1225 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1226 }
Ritor1
parents:
diff changeset
1227
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
1228 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1229
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1230
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1231 // WUT? double event trigger
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1232 /*for ( uint i = 0; i < 30; ++i )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1233 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1234 if ( pKeyActionMap->pToggleTypes[i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1235 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1236 else
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1237 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]);
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1238 if ( v14 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1239 {
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1240 if (pCurrentScreen == SCREEN_GAME)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1241 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1242 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1243 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1244 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1245 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1246 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1247 v15 = pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1248 if ( pMessageQueue_50CBD0->uNumMessages )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1249 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1250 v15 = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1251 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1252 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1253 v15 = 1;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1254 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1255 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1256 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1257 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1258 ++pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1259 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1260 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1261 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1262 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1263 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1264 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1265 }
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1266 }*/
0
Ritor1
parents:
diff changeset
1267 if ( !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1268 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1269 for ( uint i = 0; i < 30; ++i )
0
Ritor1
parents:
diff changeset
1270 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1271 inputAction = (InputAction)i;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1272 if ( pKeyActionMap->pToggleTypes[(InputAction)i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1273 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
1274 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1275 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
1276 if ( v4 )
Ritor1
parents:
diff changeset
1277 {
Ritor1
parents:
diff changeset
1278 switch ( inputAction )
Ritor1
parents:
diff changeset
1279 {
Ritor1
parents:
diff changeset
1280 case INPUT_MoveForward:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1281 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1282 break;
Ritor1
parents:
diff changeset
1283 if (!pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1284 {
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
1285 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
0
Ritor1
parents:
diff changeset
1286 partyAction = PARTY_RunForward;
Ritor1
parents:
diff changeset
1287 else
Ritor1
parents:
diff changeset
1288 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1289 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1290 break;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1291 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1292 if (pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1293 {
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1294 pTurnEngine->uActionPointsLeft -= 26;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1295 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1296 partyAction = PARTY_RunForward;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1297 else
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1298 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1299 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1300 break;
0
Ritor1
parents:
diff changeset
1301 }
Ritor1
parents:
diff changeset
1302 break;
Ritor1
parents:
diff changeset
1303 case INPUT_MoveBackwards:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1304 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1305 break;
Ritor1
parents:
diff changeset
1306 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1307 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1308 if ( pParty->uFlags2 & 2 )
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1309 partyAction = PARTY_RunBackward;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1310 else
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1311 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1312 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1313 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1314 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1315 if ( pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
0
Ritor1
parents:
diff changeset
1316 {
Ritor1
parents:
diff changeset
1317 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1318 if ( pParty->uFlags2 & 2 )
Ritor1
parents:
diff changeset
1319 partyAction = PARTY_RunBackward;
Ritor1
parents:
diff changeset
1320 else
Ritor1
parents:
diff changeset
1321 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1322 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1323 break;
0
Ritor1
parents:
diff changeset
1324 }
Ritor1
parents:
diff changeset
1325 break;
Ritor1
parents:
diff changeset
1326 case INPUT_StrafeLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1327 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1328 break;
Ritor1
parents:
diff changeset
1329 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1330 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1331 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1332 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1333 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1334 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1335 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
1336 break;
Ritor1
parents:
diff changeset
1337 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1338 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1339 pPartyActionQueue->Add(partyAction);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1340 break;
0
Ritor1
parents:
diff changeset
1341 case INPUT_StrafeRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1342 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1343 break;
Ritor1
parents:
diff changeset
1344 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1345 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1346 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1347 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1348 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1349 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1350 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
1351 break;
Ritor1
parents:
diff changeset
1352 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1353 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1354 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1355 break;
0
Ritor1
parents:
diff changeset
1356 case INPUT_TurnLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1357 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1358 break;
Ritor1
parents:
diff changeset
1359 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing
Ritor1
parents:
diff changeset
1360 {
Ritor1
parents:
diff changeset
1361 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1362 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1363 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
1364 break;
Ritor1
parents:
diff changeset
1365 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1366 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1367 partyAction = PARTY_StrafeLeft;
0
Ritor1
parents:
diff changeset
1368 }
Ritor1
parents:
diff changeset
1369 else
Ritor1
parents:
diff changeset
1370 {
Ritor1
parents:
diff changeset
1371 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1372 partyAction = PARTY_FastTurnLeft;
0
Ritor1
parents:
diff changeset
1373 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1374 partyAction = PARTY_TurnLeft;
0
Ritor1
parents:
diff changeset
1375 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1376 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
1377 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
1378 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1379 pWeather->OnPlayerTurn(10);
0
Ritor1
parents:
diff changeset
1380 }
Ritor1
parents:
diff changeset
1381 break;
Ritor1
parents:
diff changeset
1382 case INPUT_TurnRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1383 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1384 break;
Ritor1
parents:
diff changeset
1385 if ( GetAsyncKeyState(17) ) // strafing
Ritor1
parents:
diff changeset
1386 {
Ritor1
parents:
diff changeset
1387 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1388 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1389 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
1390 break;
Ritor1
parents:
diff changeset
1391 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1392 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1393 partyAction = PARTY_StrafeRight;
0
Ritor1
parents:
diff changeset
1394 }
Ritor1
parents:
diff changeset
1395 else
Ritor1
parents:
diff changeset
1396 {
Ritor1
parents:
diff changeset
1397 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1398 partyAction = PARTY_FastTurnRight;
0
Ritor1
parents:
diff changeset
1399 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1400 partyAction = PARTY_TurnRight;
0
Ritor1
parents:
diff changeset
1401 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1402 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
1403 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
1404 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1405 pWeather->OnPlayerTurn(-10);
0
Ritor1
parents:
diff changeset
1406 }
Ritor1
parents:
diff changeset
1407 break;
Ritor1
parents:
diff changeset
1408 case INPUT_Jump:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1409 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn)
0
Ritor1
parents:
diff changeset
1410 break;
Ritor1
parents:
diff changeset
1411 partyAction = (PartyAction)12;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1412 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1413 break;
0
Ritor1
parents:
diff changeset
1414 case INPUT_Yell:
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
1415 if (!pCurrentScreen && uActiveCharacter)
0
Ritor1
parents:
diff changeset
1416 {
Ritor1
parents:
diff changeset
1417 pParty->Yell();
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
1418 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0);
0
Ritor1
parents:
diff changeset
1419 }
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
1420 break;
0
Ritor1
parents:
diff changeset
1421 case INPUT_Pass:
Ritor1
parents:
diff changeset
1422 if ( pCurrentScreen )
Ritor1
parents:
diff changeset
1423 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1424 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1425 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
1426 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1427 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1428 }
0
Ritor1
parents:
diff changeset
1429 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
1430 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1431 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery )
0
Ritor1
parents:
diff changeset
1432 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1433 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false);
0
Ritor1
parents:
diff changeset
1434 if ( !pParty->bTurnBasedModeOn )
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1435 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333));
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1459
diff changeset
1436 CastSpellInfoHelpers::_427D48();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1340
diff changeset
1437 pTurnEngine->ApplyPlayerAction();
0
Ritor1
parents:
diff changeset
1438 }
Ritor1
parents:
diff changeset
1439 }
Ritor1
parents:
diff changeset
1440 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1441 case INPUT_Combat://if press ENTER
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1442 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1443 {
Ritor1
parents:
diff changeset
1444 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1445 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1446 if (pTurnEngine->turn_stage == 3 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player)
0
Ritor1
parents:
diff changeset
1447 {
Ritor1
parents:
diff changeset
1448 pParty->bTurnBasedModeOn = 0;
Ritor1
parents:
diff changeset
1449 pTurnEngine->End(true);
Ritor1
parents:
diff changeset
1450 }
Ritor1
parents:
diff changeset
1451 }
Ritor1
parents:
diff changeset
1452 else
Ritor1
parents:
diff changeset
1453 {
Ritor1
parents:
diff changeset
1454 pTurnEngine->Start();
Ritor1
parents:
diff changeset
1455 pParty->bTurnBasedModeOn = true;
Ritor1
parents:
diff changeset
1456 }
Ritor1
parents:
diff changeset
1457 }
Ritor1
parents:
diff changeset
1458 break;
Ritor1
parents:
diff changeset
1459 case INPUT_CastReady:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1460 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1461 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1462 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1463 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
1464 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1465 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1466 }
0
Ritor1
parents:
diff changeset
1467 if ( !uActiveCharacter )
Ritor1
parents:
diff changeset
1468 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1469 v8 = pPlayers[uActiveCharacter]->uQuickSpell;
0
Ritor1
parents:
diff changeset
1470 if ( !v8
Ritor1
parents:
diff changeset
1471 || bUnderwater
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1472 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ?
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1473 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1474 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1475 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1476 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)),
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1477 v10 > pPlayers[uActiveCharacter]->sMana) )
0
Ritor1
parents:
diff changeset
1478 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1479 pPartyActionQueue = pPartyActionQueue;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1480 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1481 break;
0
Ritor1
parents:
diff changeset
1482 }
Ritor1
parents:
diff changeset
1483 else
Ritor1
parents:
diff changeset
1484 {
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1485 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
0
Ritor1
parents:
diff changeset
1486 }
Ritor1
parents:
diff changeset
1487 break;
Ritor1
parents:
diff changeset
1488 case INPUT_Attack:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1489 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1490 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1491 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1492 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
1493 pTurnEngine->field_18 |= TE_FLAG_8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1494 break;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1495 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1496 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0
Ritor1
parents:
diff changeset
1497 break;
Ritor1
parents:
diff changeset
1498 case INPUT_EventTrigger:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1499 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1500 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1501 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1502 break;
0
Ritor1
parents:
diff changeset
1503 }
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 141
diff changeset
1504 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE )
0
Ritor1
parents:
diff changeset
1505 {
Ritor1
parents:
diff changeset
1506 if ( pMessageQueue_50CBD0->uNumMessages )
Ritor1
parents:
diff changeset
1507 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1508 pMessageQueue_50CBD0->uNumMessages = 0;
0
Ritor1
parents:
diff changeset
1509 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
Ritor1
parents:
diff changeset
1510 {
Ritor1
parents:
diff changeset
1511 pMessageQueue_50CBD0->uNumMessages = 1;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1512 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
1513 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1574
diff changeset
1514 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 = 0;
0
Ritor1
parents:
diff changeset
1515 ++pMessageQueue_50CBD0->uNumMessages;
Ritor1
parents:
diff changeset
1516 break;
Ritor1
parents:
diff changeset
1517 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1518 break;
0
Ritor1
parents:
diff changeset
1519 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1520 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
0
Ritor1
parents:
diff changeset
1521 }
Ritor1
parents:
diff changeset
1522 break;
Ritor1
parents:
diff changeset
1523 case INPUT_CharCycle:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1524 if ( pCurrentScreen == SCREEN_SPELL_BOOK )
0
Ritor1
parents:
diff changeset
1525 break;
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1574
diff changeset
1526
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1527 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1528 break;
0
Ritor1
parents:
diff changeset
1529 case INPUT_LookUp:
Ritor1
parents:
diff changeset
1530 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1531 break;
Ritor1
parents:
diff changeset
1532 partyAction = (PartyAction)7;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1533 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1534 break;
0
Ritor1
parents:
diff changeset
1535 case INPUT_CenterView:
Ritor1
parents:
diff changeset
1536 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1537 break;
Ritor1
parents:
diff changeset
1538 partyAction = (PartyAction)9;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1539 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1540 break;
0
Ritor1
parents:
diff changeset
1541 case INPUT_LookDown:
Ritor1
parents:
diff changeset
1542 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1543 break;
Ritor1
parents:
diff changeset
1544 partyAction = (PartyAction)8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1545 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1546 break;
0
Ritor1
parents:
diff changeset
1547 case INPUT_FlyUp:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1548 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
1549 break;
Ritor1
parents:
diff changeset
1550 partyAction = (PartyAction)13;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1551 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1552 break;
0
Ritor1
parents:
diff changeset
1553 case INPUT_Land:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1554 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
1555 break;
Ritor1
parents:
diff changeset
1556 partyAction = (PartyAction)15;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1557 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1558 break;
0
Ritor1
parents:
diff changeset
1559 case INPUT_FlyDown:
Ritor1
parents:
diff changeset
1560 if ( !pCurrentScreen
Ritor1
parents:
diff changeset
1561 && !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1562 {
Ritor1
parents:
diff changeset
1563 partyAction = (PartyAction)14;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1564 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
1565 }
Ritor1
parents:
diff changeset
1566 break;
Ritor1
parents:
diff changeset
1567 case INPUT_ZoomIn:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1568 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1569 break;
0
Ritor1
parents:
diff changeset
1570 case INPUT_ZoomOut:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1571 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0);
0
Ritor1
parents:
diff changeset
1572 break;
Ritor1
parents:
diff changeset
1573 case INPUT_AlwaysRun:
Ritor1
parents:
diff changeset
1574 bAlwaysRun = bAlwaysRun == 0;
Ritor1
parents:
diff changeset
1575 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1576 default:
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1577 break;
0
Ritor1
parents:
diff changeset
1578 }
Ritor1
parents:
diff changeset
1579 }
Ritor1
parents:
diff changeset
1580 }
Ritor1
parents:
diff changeset
1581 }
Ritor1
parents:
diff changeset
1582 }