annotate mm7_6.cpp @ 2136:d145d0e93a16

Merge
author Ritor1
date Tue, 31 Dec 2013 23:03:01 +0600
parents f6e59446c133
children d28d3c006077
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"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 1989
diff changeset
29 #include "OurMath.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"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2037
diff changeset
33 #include "Timer.h"
0
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
Ritor1
parents:
diff changeset
46
Ritor1
parents:
diff changeset
47 //----- (004272F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
48 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4)
Ritor1
parents:
diff changeset
49 {
Ritor1
parents:
diff changeset
50 signed int v5; // esi@1
Ritor1
parents:
diff changeset
51 signed int v6; // edi@1
Ritor1
parents:
diff changeset
52 int v7; // esi@8
Ritor1
parents:
diff changeset
53 int v8; // eax@9
Ritor1
parents:
diff changeset
54 int v9; // edx@11
Ritor1
parents:
diff changeset
55 unsigned __int8 v12; // sf@13
Ritor1
parents:
diff changeset
56 unsigned __int8 v13; // of@13
Ritor1
parents:
diff changeset
57 int v14; // edx@14
Ritor1
parents:
diff changeset
58 int v15; // eax@14
Ritor1
parents:
diff changeset
59 signed int result; // eax@17
Ritor1
parents:
diff changeset
60
Ritor1
parents:
diff changeset
61 v5 = pActor->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
62 v6 = 0;
1952
4ed7d18abe93 pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents: 1936
diff changeset
63 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
64 v5 /= 2;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
65 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
66 v6 = pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uPower;
1960
f92fc67d66cb pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents: 1959
diff changeset
67 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
68 v6 = pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
0
Ritor1
parents:
diff changeset
69 v7 = v6 + v5;
Ritor1
parents:
diff changeset
70 if ( a3 )
Ritor1
parents:
diff changeset
71 v8 = pPlayer->GetRangedAttack();
Ritor1
parents:
diff changeset
72 else
1685
2a309997c42f Player::StealFromShop started cleanup, fixing a few errors caused by not commiting everything
Grumpy7
parents: 1637
diff changeset
73 v8 = pPlayer->GetActualAttack(false);
0
Ritor1
parents:
diff changeset
74 v9 = rand() % (v7 + 2 * v8 + 30);
Ritor1
parents:
diff changeset
75 if ( a3 == 2 )
Ritor1
parents:
diff changeset
76 {
Ritor1
parents:
diff changeset
77 v14 = a4 + v9;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
78 v15 = ((v7 + 15) / 2) + v7 + 15;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
79 v13 = __OFSUB__(v14, v15);
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
80 v12 = v14 - v15 < 0;
0
Ritor1
parents:
diff changeset
81 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
82 else if ( a3 == 3 )
0
Ritor1
parents:
diff changeset
83 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
84 v14 = a4 + v9;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
85 v15 = 2 * v7 + 30;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
86 v13 = __OFSUB__(v14, v15);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
87 v12 = v14 - v15 < 0;
0
Ritor1
parents:
diff changeset
88 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
89 else
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
90 {
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
91 v14 = a4 + v9;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
92 v15 = v7 + 15;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
93 v13 = __OFSUB__(v14, v15);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
94 v12 = v14 - v15 < 0;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
95 }
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
96
0
Ritor1
parents:
diff changeset
97 if ( v12 ^ v13 )
Ritor1
parents:
diff changeset
98 result = 0;
Ritor1
parents:
diff changeset
99 else
Ritor1
parents:
diff changeset
100 result = 1;
Ritor1
parents:
diff changeset
101 return result;
Ritor1
parents:
diff changeset
102 }
Ritor1
parents:
diff changeset
103
Ritor1
parents:
diff changeset
104 //----- (004274AD) --------------------------------------------------------
Ritor1
parents:
diff changeset
105 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer)
Ritor1
parents:
diff changeset
106 {
Ritor1
parents:
diff changeset
107 signed int v3; // edi@1
Ritor1
parents:
diff changeset
108 signed int v4; // esi@8
Ritor1
parents:
diff changeset
109 int v5; // esi@8
Ritor1
parents:
diff changeset
110
Ritor1
parents:
diff changeset
111 v3 = 0;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
112 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
113 v3 = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
1961
592d604088b3 pActorBuffs[17] to pActorBuffs[ACTOR_BUFF_BLESS]
Grumpy7
parents: 1960
diff changeset
114 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
115 v3 = pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower;
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
116 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
117 {
1955
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
118 v3 += pActor->pActorBuffs[ACTOR_BUFF_FATE].uPower;
0c5326e2044a pActorBuffs[11] to pActorBuffs[ACTOR_BUFF_FATE]
Grumpy7
parents: 1952
diff changeset
119 pActor->pActorBuffs[ACTOR_BUFF_FATE].Reset();
0
Ritor1
parents:
diff changeset
120 }
Ritor1
parents:
diff changeset
121 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10;
Ritor1
parents:
diff changeset
122 v5 = rand() % v4 + 1;
Ritor1
parents:
diff changeset
123 return v3 + v5 > pPlayer->GetActualAC() + 5;
Ritor1
parents:
diff changeset
124 }
Ritor1
parents:
diff changeset
125
Ritor1
parents:
diff changeset
126 //----- (00427546) --------------------------------------------------------
Ritor1
parents:
diff changeset
127 int stru319::_427546(int a2)
Ritor1
parents:
diff changeset
128 {
Ritor1
parents:
diff changeset
129 int result; // eax@2
Ritor1
parents:
diff changeset
130
Ritor1
parents:
diff changeset
131 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
132 {
Ritor1
parents:
diff changeset
133 if ( a2 >= 1 )
Ritor1
parents:
diff changeset
134 result = (a2 >= 2) + 2;
Ritor1
parents:
diff changeset
135 else
Ritor1
parents:
diff changeset
136 result = 1;
Ritor1
parents:
diff changeset
137 }
Ritor1
parents:
diff changeset
138 else
Ritor1
parents:
diff changeset
139 {
Ritor1
parents:
diff changeset
140 result = 0;
Ritor1
parents:
diff changeset
141 }
Ritor1
parents:
diff changeset
142 return result;
Ritor1
parents:
diff changeset
143 }
Ritor1
parents:
diff changeset
144
Ritor1
parents:
diff changeset
145 //----- (0042756B) --------------------------------------------------------
Ritor1
parents:
diff changeset
146 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3)
Ritor1
parents:
diff changeset
147 {
Ritor1
parents:
diff changeset
148 int v4; // edx@1
Ritor1
parents:
diff changeset
149 int v5; // ecx@1
Ritor1
parents:
diff changeset
150 signed int v6; // eax@4
Ritor1
parents:
diff changeset
151 signed int result; // eax@17
Ritor1
parents:
diff changeset
152 signed int v8; // esi@18
Ritor1
parents:
diff changeset
153
Ritor1
parents:
diff changeset
154 v4 = 0;
Ritor1
parents:
diff changeset
155 v5 = 0;
1958
95095c2a5e19 pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents: 1957
diff changeset
156 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
157 v5 = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
0
Ritor1
parents:
diff changeset
158 switch ( a2 )
Ritor1
parents:
diff changeset
159 {
Ritor1
parents:
diff changeset
160 case 0:
Ritor1
parents:
diff changeset
161 v6 = pActor->pMonsterInfo.uResFire;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
162 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
163 break;
0
Ritor1
parents:
diff changeset
164 case 1:
Ritor1
parents:
diff changeset
165 v6 = pActor->pMonsterInfo.uResAir;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
166 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
167 break;
0
Ritor1
parents:
diff changeset
168 case 2:
Ritor1
parents:
diff changeset
169 v6 = pActor->pMonsterInfo.uResWater;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
170 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
171 break;
0
Ritor1
parents:
diff changeset
172 case 3:
Ritor1
parents:
diff changeset
173 v6 = pActor->pMonsterInfo.uResEarth;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
174 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
175 break;
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
176 case 4:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
177 v6 = pActor->pMonsterInfo.uResPhysical;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
178 break;
0
Ritor1
parents:
diff changeset
179 case 6:
Ritor1
parents:
diff changeset
180 v6 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
181 break;
Ritor1
parents:
diff changeset
182 case 7:
Ritor1
parents:
diff changeset
183 v6 = pActor->pMonsterInfo.uResMind;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
184 v4 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
185 break;
0
Ritor1
parents:
diff changeset
186 case 8:
Ritor1
parents:
diff changeset
187 v6 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
188 v4 = v5;
Ritor1
parents:
diff changeset
189 break;
Ritor1
parents:
diff changeset
190 case 9:
Ritor1
parents:
diff changeset
191 v6 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
192 break;
Ritor1
parents:
diff changeset
193 case 10:
Ritor1
parents:
diff changeset
194 v6 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
195 break;
Ritor1
parents:
diff changeset
196 default:
Ritor1
parents:
diff changeset
197 v6 = 0;
Ritor1
parents:
diff changeset
198 break;
Ritor1
parents:
diff changeset
199 }
Ritor1
parents:
diff changeset
200 if ( v6 < 200 )
Ritor1
parents:
diff changeset
201 {
Ritor1
parents:
diff changeset
202 v8 = v4 + v6 + 30;
Ritor1
parents:
diff changeset
203 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
204 {
Ritor1
parents:
diff changeset
205 a3 >>= 1;
Ritor1
parents:
diff changeset
206 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
207 {
Ritor1
parents:
diff changeset
208 a3 >>= 1;
Ritor1
parents:
diff changeset
209 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
210 {
Ritor1
parents:
diff changeset
211 a3 >>= 1;
Ritor1
parents:
diff changeset
212 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
213 a3 >>= 1;
Ritor1
parents:
diff changeset
214 }
Ritor1
parents:
diff changeset
215 }
Ritor1
parents:
diff changeset
216 }
Ritor1
parents:
diff changeset
217 result = a3;
Ritor1
parents:
diff changeset
218 }
Ritor1
parents:
diff changeset
219 else
Ritor1
parents:
diff changeset
220 {
Ritor1
parents:
diff changeset
221 result = 0;
Ritor1
parents:
diff changeset
222 }
Ritor1
parents:
diff changeset
223 return result;
Ritor1
parents:
diff changeset
224 }
Ritor1
parents:
diff changeset
225
Ritor1
parents:
diff changeset
226 //----- (00427662) --------------------------------------------------------
Ritor1
parents:
diff changeset
227 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType)
Ritor1
parents:
diff changeset
228 {
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
229 signed int resist; // esi@2
0
Ritor1
parents:
diff changeset
230 bool result; // eax@13
Ritor1
parents:
diff changeset
231
Ritor1
parents:
diff changeset
232 switch ( uType )
Ritor1
parents:
diff changeset
233 {
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
234 case 0:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
235 resist = pActor->pMonsterInfo.uResFire;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
236 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
237 case 1:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
238 resist = pActor->pMonsterInfo.uResAir;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
239 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
240 case 2:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
241 resist = pActor->pMonsterInfo.uResWater;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
242 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
243 case 3:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
244 resist = pActor->pMonsterInfo.uResEarth;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
245 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
246 case 4:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
247 resist = pActor->pMonsterInfo.uResPhysical;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
248 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
249 case 6:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
250 resist = pActor->pMonsterInfo.uResSpirit;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
251 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
252 case 7:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
253 resist = pActor->pMonsterInfo.uResMind;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
254 case 8:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
255 resist = pActor->pMonsterInfo.uResBody;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
256 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
257 case 9:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
258 resist = pActor->pMonsterInfo.uResLight;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
259 break;
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
260 case 10:
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
261 resist = pActor->pMonsterInfo.uResDark;
0
Ritor1
parents:
diff changeset
262 break;
Ritor1
parents:
diff changeset
263 default:
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
264 return 1;
0
Ritor1
parents:
diff changeset
265 }
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
266 if ( resist < 200 )
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
267 result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1406
diff changeset
268 else
1765
53c0453f4eb2 new_draw_object_dist
Ritor1
parents: 1759
diff changeset
269 result = 0;
0
Ritor1
parents:
diff changeset
270 return result;
Ritor1
parents:
diff changeset
271 }
Ritor1
parents:
diff changeset
272
Ritor1
parents:
diff changeset
273 //----- (0042EB8D) --------------------------------------------------------
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
274 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
0
Ritor1
parents:
diff changeset
275 {
482
9898e6b413d8 some debug stuff commented
Nomad
parents: 469
diff changeset
276 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line);
0
Ritor1
parents:
diff changeset
277 if (uNumMessages < 40)
Ritor1
parents:
diff changeset
278 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
279 files[uNumMessages] = file;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
280 lines[uNumMessages] = line;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
281
0
Ritor1
parents:
diff changeset
282 pMessages[uNumMessages].eType = msg;
Ritor1
parents:
diff changeset
283 pMessages[uNumMessages].param = param;
Ritor1
parents:
diff changeset
284 pMessages[uNumMessages++].field_8 = a4;
Ritor1
parents:
diff changeset
285 }
Ritor1
parents:
diff changeset
286 }
Ritor1
parents:
diff changeset
287
Ritor1
parents:
diff changeset
288
Ritor1
parents:
diff changeset
289 //----- (0042EBDB) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
290 int stru193_math::Sin(int angle)
0
Ritor1
parents:
diff changeset
291 {
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
292 return Cos(angle - this->uIntegerHalfPi);
0
Ritor1
parents:
diff changeset
293 }
Ritor1
parents:
diff changeset
294
Ritor1
parents:
diff changeset
295 //----- (0042ECB5) --------------------------------------------------------
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
296 void _42ECB5_PlayerAttacksActor()
0
Ritor1
parents:
diff changeset
297 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
298 //unsigned int v0; // ebx@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
299 //Player *v1; // esi@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
300 //bool result; // eax@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
301 //int v3; // edi@2
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
302 //unsigned int v4; // eax@7
0
Ritor1
parents:
diff changeset
303 char *v5; // eax@8
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
304 //int v6; // ecx@9
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
305 //signed int v7; // eax@16
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
306 //Actor *v8; // edi@20
0
Ritor1
parents:
diff changeset
307 unsigned int v9; // ecx@21
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
308 //char *v10; // eax@26
0
Ritor1
parents:
diff changeset
309 char *v11; // eax@26
Ritor1
parents:
diff changeset
310 unsigned int v12; // eax@47
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
311 //char *v13; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
312 //char *v14; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
313 //unsigned int v15; // ebx@54
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
314 //int v16; // [sp-10h] [bp-4Ch]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
315 //int v17; // [sp-10h] [bp-4Ch]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
316 //unsigned int v18; // [sp-Ch] [bp-48h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
317 //unsigned int v19; // [sp-Ch] [bp-48h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
318 //__int16 v20; // [sp-8h] [bp-44h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
319 //__int16 v21; // [sp-8h] [bp-44h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
320 //int v22; // [sp-4h] [bp-40h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
321 //int v23; // [sp-4h] [bp-40h]@44
0
Ritor1
parents:
diff changeset
322 SoundID v24; // [sp-4h] [bp-40h]@58
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
323 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
324 //unsigned int a2; // [sp+18h] [bp-24h]@20
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
325 //unsigned int v27; // [sp+1Ch] [bp-20h]@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
326 //int v28; // [sp+20h] [bp-1Ch]@9
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
327 //unsigned int *v28b;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
328 //int v29; // [sp+24h] [bp-18h]@16
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
329 //int v30; // [sp+28h] [bp-14h]@16
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
330 //int v31; // [sp+2Ch] [bp-10h]@4
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
331 //int v32; // [sp+30h] [bp-Ch]@7
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
332 //int v33; // [sp+34h] [bp-8h]@7
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
333 //int v34; // [sp+38h] [bp-4h]@17
0
Ritor1
parents:
diff changeset
334
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
335 //v0 = uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
336 //v27 = 6972 * uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
337 //v1 = &pParty->pPlayers[uActiveCharacter-1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
338 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1974
diff changeset
339 Player* player = &pParty->pPlayers[uActiveCharacter - 1];
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
340 if (!player->CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
341 return;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
342
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1459
diff changeset
343 CastSpellInfoHelpers::_427D48();
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
344 //v3 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
345 if (pParty->Invisible())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
346 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
347
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
348 //v31 = player->pEquipment.uBow;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
349 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
350 if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken())
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
351 bow_idx = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
352
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
353 //v32 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
354 int wand_item_id = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
355 //v33 = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
356 //v4 = v1->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
357 int laser_weapon_item_id = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
358
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
359 int main_hand_idx = player->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
360 if (main_hand_idx)
0
Ritor1
parents:
diff changeset
361 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1974
diff changeset
362 ItemGen* item = &player->pInventoryItemList[main_hand_idx - 1];
112
909822c91d47 pointer fixes
zipi
parents: 90
diff changeset
363 //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
364 if (!item->IsBroken())
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
365 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
366 //v28b = &v1->pInventoryItems[v4].uItemID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
367 //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
368 if (item->GetItemEquipType() == EQUIP_WAND)
0
Ritor1
parents:
diff changeset
369 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
370 if (item->uNumCharges <= 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
371 player->pEquipment.uMainHand = 0; // wand discharged - unequip
0
Ritor1
parents:
diff changeset
372 else
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
373 wand_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
374 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
375 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
376 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
377 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
378 }
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
379
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
380 //v30 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
381 //v29 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
382 //v28 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
383 //v7 = pMouse->uPointingObjectID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
384
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
385 int target_pid = pMouse->uPointingObjectID;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
386 int target_type = PID_TYPE(target_pid),
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
387 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
388 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
389 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
390 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
391 target_type = PID_TYPE(target_pid);
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
392 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
393 }
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
394
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1974
diff changeset
395 Actor* actor = &pActors[target_id];
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
396 int actor_distance = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
397 if (target_type == OBJECT_Actor)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
398 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
399 int distance_x = actor->vPosition.x - pParty->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
400 distance_y = actor->vPosition.y - pParty->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
401 distance_z = actor->vPosition.z - pParty->vPosition.z;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
402 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
403 if (actor_distance < 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
404 actor_distance = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
405 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
406
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
407 bool shooting_bow = false,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
408 shotting_laser = false,
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
409 shooting_wand = false,
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
410 melee_attack = false;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
411 if (laser_weapon_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
412 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
413 shotting_laser = true;
490
Nomad
parents: 488
diff changeset
414 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
415 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
416 else if (wand_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
417 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
418 shooting_wand = true;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
419
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
420 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
421 _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
422
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1340
diff changeset
423 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
424 player->pEquipment.uMainHand = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
425 }
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
426 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
427 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
428 melee_attack = true;
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
429
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
430 Vec3_int_ a3;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
431 a3.x = actor->vPosition.x - pParty->vPosition.x;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
432 a3.y = actor->vPosition.y - pParty->vPosition.y;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
433 a3.z = actor->vPosition.z - pParty->vPosition.z;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
434 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
435
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
436 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
1989
33787c8938a5 Single and Two-handed ENUM
zipi
parents: 1980
diff changeset
437 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED))
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
438 _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
439 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
440 else if (bow_idx)
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
441 {
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
442 shooting_bow = true;
490
Nomad
parents: 488
diff changeset
443 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
444 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
445 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
446 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
447 melee_attack = true;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
448 ; // actor out of range or no actor; no ranged weapon so melee attacking air
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
449 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
450
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
451 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
452 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
453 int recovery = player->GetAttackRecoveryTime(false);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
454 if (recovery < 30 )
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
455 recovery = 30;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
456 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
457 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
458
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
459 int v34 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
460 if (shooting_wand)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
461 return;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
462 else if (shooting_bow)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
463 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
464 v34 = 5;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
465 player->PlaySound(SPEECH_50, 0);
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
466 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
467 if (shotting_laser)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
468 v34 = 7;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
469 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
470 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
471 int main_hand_idx = player->pEquipment.uMainHand;
1989
33787c8938a5 Single and Two-handed ENUM
zipi
parents: 1980
diff changeset
472 if (player->HasItemEquipped(EQUIP_TWO_HANDED))
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1685
diff changeset
473 v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1340
diff changeset
474 pTurnEngine->ApplyPlayerAction();
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
475 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
476
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
477 switch (v34)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
478 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
479 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
480 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
481 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
482 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
483 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
484 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
485 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
486 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
487 }
0
Ritor1
parents:
diff changeset
488 }
Ritor1
parents:
diff changeset
489
Ritor1
parents:
diff changeset
490 //----- (0042F184) --------------------------------------------------------
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
491 int stru319::FindClosestActor(int pick_depth, int a3, int a4)
0
Ritor1
parents:
diff changeset
492 {
Ritor1
parents:
diff changeset
493 int v4; // edi@1
Ritor1
parents:
diff changeset
494 stru319 *v5; // esi@1
Ritor1
parents:
diff changeset
495 int v6; // eax@2
Ritor1
parents:
diff changeset
496 int v7; // eax@4
Ritor1
parents:
diff changeset
497 int result; // eax@5
Ritor1
parents:
diff changeset
498 int *v9; // edx@8
Ritor1
parents:
diff changeset
499 signed int v10; // ebx@10
Ritor1
parents:
diff changeset
500 int v11; // edi@11
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
501 //Actor *v12; // esi@12
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
502 //unsigned __int16 v13; // ax@12
0
Ritor1
parents:
diff changeset
503 int v14; // eax@22
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
504 //char v15; // zf@30
0
Ritor1
parents:
diff changeset
505 int v16; // esi@32
Ritor1
parents:
diff changeset
506 int v17; // ecx@34
Ritor1
parents:
diff changeset
507 stru319 *v18; // eax@39
Ritor1
parents:
diff changeset
508 int v19; // edx@39
Ritor1
parents:
diff changeset
509 int v20; // ecx@41
Ritor1
parents:
diff changeset
510 unsigned __int16 v21; // ax@42
Ritor1
parents:
diff changeset
511 unsigned int v22; // [sp+8h] [bp-24h]@11
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
512 //unsigned int v23; // [sp+Ch] [bp-20h]@7
0
Ritor1
parents:
diff changeset
513 stru319 *v24; // [sp+10h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
514 unsigned int v25; // [sp+14h] [bp-18h]@8
Ritor1
parents:
diff changeset
515 int *v26; // [sp+18h] [bp-14h]@8
Ritor1
parents:
diff changeset
516 int v27; // [sp+1Ch] [bp-10h]@10
Ritor1
parents:
diff changeset
517 int *v28; // [sp+20h] [bp-Ch]@10
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
518 //unsigned int v29; // [sp+24h] [bp-8h]@7
0
Ritor1
parents:
diff changeset
519 int v30; // [sp+28h] [bp-4h]@6
Ritor1
parents:
diff changeset
520 int i; // [sp+38h] [bp+Ch]@33
Ritor1
parents:
diff changeset
521 signed int v32; // [sp+3Ch] [bp+10h]@32
Ritor1
parents:
diff changeset
522
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
523 //__debugbreak();//Ritor1
0
Ritor1
parents:
diff changeset
524 v4 = 0;
Ritor1
parents:
diff changeset
525 v5 = this;
Ritor1
parents:
diff changeset
526 v24 = this;
Ritor1
parents:
diff changeset
527 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
528 {
Ritor1
parents:
diff changeset
529 v6 = a3 != 0;
Ritor1
parents:
diff changeset
530 if ( a4 )
Ritor1
parents:
diff changeset
531 LOBYTE(v6) = v6 | 8;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
532 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
0
Ritor1
parents:
diff changeset
533 if ( v7 != -1 )
Ritor1
parents:
diff changeset
534 return (unsigned __int16)v7;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
535 else return 0;
0
Ritor1
parents:
diff changeset
536 }
Ritor1
parents:
diff changeset
537 else
Ritor1
parents:
diff changeset
538 {
Ritor1
parents:
diff changeset
539 v30 = 0;
Ritor1
parents:
diff changeset
540 if ( pRenderer->pActiveZBuffer )
Ritor1
parents:
diff changeset
541 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
542 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
0
Ritor1
parents:
diff changeset
543 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
544 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
545 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
546 for ( v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; v25; --v25 )
0
Ritor1
parents:
diff changeset
547 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
548 if ( (signed int)viewparams->uScreen_topL_X < (signed int)viewparams->uScreen_BttmR_X )
0
Ritor1
parents:
diff changeset
549 {
Ritor1
parents:
diff changeset
550 v28 = v9;
Ritor1
parents:
diff changeset
551 v10 = v4;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
552 for ( v27 = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X; v27; --v27 )
0
Ritor1
parents:
diff changeset
553 {
Ritor1
parents:
diff changeset
554 v22 = *v28;
Ritor1
parents:
diff changeset
555 v11 = *v28 & 0xFFFF;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
556 if (PID_TYPE(v11) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
557 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
558 if ( pActors[PID_ID(v11)].uAIState != Dead )
0
Ritor1
parents:
diff changeset
559 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
560 if ( pActors[PID_ID(v11)].uAIState != Dying && pActors[PID_ID(v11)].uAIState != Removed
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
561 && pActors[PID_ID(v11)].uAIState != Summoned && pActors[PID_ID(v11)].uAIState != Disabled
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
562 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) )
0
Ritor1
parents:
diff changeset
563 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
564 if ( (!a4 || MonsterStats::BelongsToSupertype(pActors[PID_ID(v11)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
565 && v22 <= pick_depth << 16 )
0
Ritor1
parents:
diff changeset
566 {
Ritor1
parents:
diff changeset
567 v14 = 0;
Ritor1
parents:
diff changeset
568 if ( v10 > 0 )
Ritor1
parents:
diff changeset
569 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
570 for ( v14; v14 < v30; ++v14 )
0
Ritor1
parents:
diff changeset
571 {
Ritor1
parents:
diff changeset
572 if ( dword_50BDA0[v14] == v11 )
Ritor1
parents:
diff changeset
573 break;
Ritor1
parents:
diff changeset
574 }
Ritor1
parents:
diff changeset
575 }
Ritor1
parents:
diff changeset
576 if ( v14 == v30 && v10 < 100 )
Ritor1
parents:
diff changeset
577 {
Ritor1
parents:
diff changeset
578 ++v30;
Ritor1
parents:
diff changeset
579 dword_50BC10[v10] = v22;
Ritor1
parents:
diff changeset
580 dword_50BDA0[v10] = v11;
Ritor1
parents:
diff changeset
581 ++v10;
Ritor1
parents:
diff changeset
582 }
Ritor1
parents:
diff changeset
583 }
Ritor1
parents:
diff changeset
584 }
Ritor1
parents:
diff changeset
585 }
Ritor1
parents:
diff changeset
586 }
Ritor1
parents:
diff changeset
587 ++v28;
Ritor1
parents:
diff changeset
588 }
Ritor1
parents:
diff changeset
589 v4 = v30;
Ritor1
parents:
diff changeset
590 v5 = v24;
Ritor1
parents:
diff changeset
591 }
Ritor1
parents:
diff changeset
592 v9 = v26 + 640;
Ritor1
parents:
diff changeset
593 v26 += 640;
Ritor1
parents:
diff changeset
594 }
Ritor1
parents:
diff changeset
595 }
Ritor1
parents:
diff changeset
596 if ( v4 > 0 )
Ritor1
parents:
diff changeset
597 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
598 v16 = (int)dword_50BC10.data();
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
599 for ( v32 = 1; v32 - 1 < v4; ++v32 )
0
Ritor1
parents:
diff changeset
600 {
Ritor1
parents:
diff changeset
601 for ( i = v32; i < v4; ++i )
Ritor1
parents:
diff changeset
602 {
Ritor1
parents:
diff changeset
603 v17 = dword_50BC10[i];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
604 if ( dword_50BC10[i] < *(int *)v16 )
0
Ritor1
parents:
diff changeset
605 {
Ritor1
parents:
diff changeset
606 dword_50BC10[i] = *(int *)v16;
Ritor1
parents:
diff changeset
607 *(int *)v16 = v17;
Ritor1
parents:
diff changeset
608 }
Ritor1
parents:
diff changeset
609 }
Ritor1
parents:
diff changeset
610 v16 += 4;
Ritor1
parents:
diff changeset
611 }
Ritor1
parents:
diff changeset
612 v5 = v24;
Ritor1
parents:
diff changeset
613 if ( v4 > 0 )
Ritor1
parents:
diff changeset
614 {
Ritor1
parents:
diff changeset
615 v18 = v24;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
616 for ( v19 = v4; v19; --v19 )
0
Ritor1
parents:
diff changeset
617 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
618 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF;
0
Ritor1
parents:
diff changeset
619 v18 += 4;
Ritor1
parents:
diff changeset
620 }
Ritor1
parents:
diff changeset
621 }
Ritor1
parents:
diff changeset
622 }
Ritor1
parents:
diff changeset
623 v20 = 0;
Ritor1
parents:
diff changeset
624 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 )
Ritor1
parents:
diff changeset
625 {
Ritor1
parents:
diff changeset
626 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState;
Ritor1
parents:
diff changeset
627 if ( v21 != 4 && v21 != 5 )
Ritor1
parents:
diff changeset
628 break;
Ritor1
parents:
diff changeset
629 }
Ritor1
parents:
diff changeset
630 if ( v20 != v4 )
Ritor1
parents:
diff changeset
631 {
Ritor1
parents:
diff changeset
632 result = 8 * *(int *)&v5[4 * v20].field_0;
Ritor1
parents:
diff changeset
633 LOBYTE(result) = result | 3;
Ritor1
parents:
diff changeset
634 return result;
Ritor1
parents:
diff changeset
635 }
Ritor1
parents:
diff changeset
636 }
Ritor1
parents:
diff changeset
637 }
Ritor1
parents:
diff changeset
638 return 0;
Ritor1
parents:
diff changeset
639 }
Ritor1
parents:
diff changeset
640
Ritor1
parents:
diff changeset
641 //----- (0042F3D6) --------------------------------------------------------
Ritor1
parents:
diff changeset
642 void InitializeTurnBasedAnimations(void *_this)
Ritor1
parents:
diff changeset
643 {
Ritor1
parents:
diff changeset
644 unsigned int *v1; // edi@1
Ritor1
parents:
diff changeset
645
Ritor1
parents:
diff changeset
646 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0");
Ritor1
parents:
diff changeset
647 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1");
Ritor1
parents:
diff changeset
648 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2");
Ritor1
parents:
diff changeset
649 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3");
Ritor1
parents:
diff changeset
650 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4");
Ritor1
parents:
diff changeset
651 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
Ritor1
parents:
diff changeset
652 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
Ritor1
parents:
diff changeset
653 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
Ritor1
parents:
diff changeset
654 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
Ritor1
parents:
diff changeset
655 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
656 v1 = pIconIDs_Turn.data();
0
Ritor1
parents:
diff changeset
657 do
Ritor1
parents:
diff changeset
658 {
Ritor1
parents:
diff changeset
659 pIconsFrameTable->InitializeAnimation(*v1);
Ritor1
parents:
diff changeset
660 ++v1;
Ritor1
parents:
diff changeset
661 }
Ritor1
parents:
diff changeset
662 while ( (signed int)v1 < (signed int)&uIconID_TurnStop );
Ritor1
parents:
diff changeset
663 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
Ritor1
parents:
diff changeset
664 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
Ritor1
parents:
diff changeset
665 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
Ritor1
parents:
diff changeset
666 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
Ritor1
parents:
diff changeset
667 }
Ritor1
parents:
diff changeset
668
Ritor1
parents:
diff changeset
669 //----- (0042F7EB) --------------------------------------------------------
Ritor1
parents:
diff changeset
670 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
671 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
672 unsigned __int16 pObjectDescID; // ax@7
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
673 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
0
Ritor1
parents:
diff changeset
674
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
675 pSpellObject.stru_24.Reset();
0
Ritor1
parents:
diff changeset
676 if ( a9 )
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
677 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24));
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
678 pSpellObject.spell_skill = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
679 pSpellObject.spell_level = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
680 pSpellObject.spell_id = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
681 pSpellObject.field_54 = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
682 pSpellObject.uType = uSpriteID;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
683 pObjectDescID = 0;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
684 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
0
Ritor1
parents:
diff changeset
685 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
686 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
687 pObjectDescID = i;
0
Ritor1
parents:
diff changeset
688 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
689 pSpellObject.uObjectDescID = pObjectDescID;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
690 pSpellObject.vPosition.x = x;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
691 pSpellObject.vPosition.y = y;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
692 pSpellObject.vPosition.z = z;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
693 pSpellObject.uSoundID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
694 pSpellObject.uAttributes = attributes;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
695 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
696 pSpellObject.uSpriteFrameID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
697 pSpellObject.spell_caster_pid = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
698 pSpellObject.spell_target_pid = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
699 if ( !(pSpellObject.uAttributes & 0x10) )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
700 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
701 if ( pItemsTable->uAllItemsCount )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
702 {
1729
f44b6e02e81c pop-up window in character(paperdill) window, alchemy
Ritor1
parents: 1709
diff changeset
703 for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i )
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
704 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
705 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
706 pSpellObject.stru_24.uItemID = i;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
707 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
708 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
709 }
0
Ritor1
parents:
diff changeset
710 if ( a7 )
Ritor1
parents:
diff changeset
711 {
Ritor1
parents:
diff changeset
712 if ( count > 0 )
Ritor1
parents:
diff changeset
713 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
714 for ( uint i = count; i; --i )
0
Ritor1
parents:
diff changeset
715 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
716 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
717 pSpellObject.Create((signed __int16)pSpellObject.uFacing,
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
718 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
719
0
Ritor1
parents:
diff changeset
720 }
Ritor1
parents:
diff changeset
721 }
Ritor1
parents:
diff changeset
722 }
Ritor1
parents:
diff changeset
723 else
Ritor1
parents:
diff changeset
724 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
725 pSpellObject.uFacing = 0;
0
Ritor1
parents:
diff changeset
726 if ( count > 0 )
Ritor1
parents:
diff changeset
727 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
728 for ( uint i = count; i; --i )
0
Ritor1
parents:
diff changeset
729 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
730 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0);
0
Ritor1
parents:
diff changeset
731 }
Ritor1
parents:
diff changeset
732 }
Ritor1
parents:
diff changeset
733 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
734 return true;
0
Ritor1
parents:
diff changeset
735 }
Ritor1
parents:
diff changeset
736
Ritor1
parents:
diff changeset
737 //----- (0042F960) --------------------------------------------------------
Ritor1
parents:
diff changeset
738 void __fastcall sub_42F960_create_object(int x, int y, int z)
Ritor1
parents:
diff changeset
739 {
Ritor1
parents:
diff changeset
740 unsigned __int16 v7; // ax@5
Ritor1
parents:
diff changeset
741 signed int v8; // eax@6
Ritor1
parents:
diff changeset
742 signed int v9; // eax@7
Ritor1
parents:
diff changeset
743
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
744 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
745 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
746 a1.stru_24.Reset();
Ritor1
parents:
diff changeset
747
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
748 a1.spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
749 a1.spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
750 a1.spell_id = 0;
0
Ritor1
parents:
diff changeset
751 a1.field_54 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
752 a1.uType = 800;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
753 v7 = 0;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
754 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
0
Ritor1
parents:
diff changeset
755 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
756 if ( a1.uType == pObjectList->pObjects[i].uObjectID )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
757 v7 = i;
0
Ritor1
parents:
diff changeset
758 }
Ritor1
parents:
diff changeset
759 a1.uObjectDescID = v7;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
760 a1.vPosition.x = x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
761 a1.vPosition.y = y;
0
Ritor1
parents:
diff changeset
762 a1.vPosition.z = z;
Ritor1
parents:
diff changeset
763 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
764 a1.uAttributes = 0;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
765 a1.uSectorID = pIndoor->GetSector(x, y, z);
0
Ritor1
parents:
diff changeset
766 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
767 a1.spell_caster_pid = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
768 a1.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
769 v8 = a1.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
770 if ( v8 != -1 )
Ritor1
parents:
diff changeset
771 {
Ritor1
parents:
diff changeset
772 v9 = 8 * v8;
Ritor1
parents:
diff changeset
773 LOBYTE(v9) = v9 | 2;
Ritor1
parents:
diff changeset
774 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
775 }
Ritor1
parents:
diff changeset
776 }
Ritor1
parents:
diff changeset
777
Ritor1
parents:
diff changeset
778 //----- (0042FA66) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
779 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
0
Ritor1
parents:
diff changeset
780 {
Ritor1
parents:
diff changeset
781 unsigned __int16 v9; // ax@5
Ritor1
parents:
diff changeset
782
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
783 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
784 //SpriteObject::SpriteObject(&a1a);
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
785 a1a.uType = 600;
0
Ritor1
parents:
diff changeset
786 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
787
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
788 a1a.spell_id = SPELL_FIRE_FIREBALL;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
789 a1a.spell_level = 8;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
790 a1a.spell_skill = 3;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
791 v9 = 0;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
792 for ( uint i = 0; i < pObjectList->uNumObjects; ++i )
0
Ritor1
parents:
diff changeset
793 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
794 if ( a1a.uType == pObjectList->pObjects[i].uObjectID )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
795 v9 = i;
0
Ritor1
parents:
diff changeset
796 }
Ritor1
parents:
diff changeset
797 a1a.uObjectDescID = v9;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
798 a1a.vPosition.x = a1;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
799 a1a.vPosition.y = a2;
0
Ritor1
parents:
diff changeset
800 a1a.vPosition.z = a3;
Ritor1
parents:
diff changeset
801 a1a.uAttributes = 0;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
802 a1a.uSectorID = pIndoor->GetSector(a1, a2, a3);
0
Ritor1
parents:
diff changeset
803 a1a.uSpriteFrameID = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
804 a1a.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
805 a1a.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
806 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
807 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
808 if ( a6 >= 1 || a6 <= 4 )
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
809 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
0
Ritor1
parents:
diff changeset
810 else
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
811 a1a.spell_caster_pid = 0;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
812
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
813 int id = a1a.Create(0, 0, 0, 0);
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1517
diff changeset
814 if (id != -1)
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
815 AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y),
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
816 SLOWORD(a1a.vPosition.z), 0, 0);
0
Ritor1
parents:
diff changeset
817 }
Ritor1
parents:
diff changeset
818
Ritor1
parents:
diff changeset
819 //----- (0042FB5C) --------------------------------------------------------
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
820 bool _42FB5C_check_spell(signed int spell_id)
0
Ritor1
parents:
diff changeset
821 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
822 if ( spell_id > 39 )
0
Ritor1
parents:
diff changeset
823 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
824 if ( spell_id == SPELL_SPIRIT_BLESS || spell_id == SPELL_SPIRIT_FATE || spell_id == SPELL_SPIRIT_HEROISM || spell_id == SPELL_BODY_HAMMERHANDS
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
825 || spell_id == SPELL_BODY_POWER_CURE ||spell_id == SPELL_LIGHT_DISPEL_MAGIC || spell_id == SPELL_LIGHT_DAY_OF_PROTECTION
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
826 || spell_id == SPELL_LIGHT_HOUR_OF_POWER || spell_id == SPELL_DARK_PAIN_REFLECTION)
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
827 return false;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
828 return true;
0
Ritor1
parents:
diff changeset
829 }
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
830 if ( spell_id == SPELL_FIRE_FIRE_BOLT || spell_id == SPELL_FIRE_FIREBALL || spell_id == SPELL_FIRE_METEOR_SHOWER
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
831 || spell_id == SPELL_AIR_LIGHNING_BOLT || spell_id == SPELL_EARTH_BLADES )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
832 return true;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
833 if ( spell_id == SPELL_FIRE_HASTE || spell_id == SPELL_AIR_SHIELD || spell_id == SPELL_EARTH_STONESKIN )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
834 return false;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
835 return true;
0
Ritor1
parents:
diff changeset
836 }
Ritor1
parents:
diff changeset
837
Ritor1
parents:
diff changeset
838 //----- (0042FBDD) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1450
diff changeset
839 void sub_42FBDD()
0
Ritor1
parents:
diff changeset
840 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
841 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
842 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
Ritor1
parents:
diff changeset
843 pRenderer->Present();
Ritor1
parents:
diff changeset
844 }
Ritor1
parents:
diff changeset
845
Ritor1
parents:
diff changeset
846 //----- (0042FC15) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1450
diff changeset
847 void CloseWindowBackground()
0
Ritor1
parents:
diff changeset
848 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
849 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
850 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
Ritor1
parents:
diff changeset
851 pRenderer->Present();
Ritor1
parents:
diff changeset
852 }
Ritor1
parents:
diff changeset
853
Ritor1
parents:
diff changeset
854 //----- (0042FC4E) --------------------------------------------------------
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1574
diff changeset
855 void ProcessInputActions()
0
Ritor1
parents:
diff changeset
856 {
Ritor1
parents:
diff changeset
857 char v4; // al@9
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
858 //char v8; // bl@100
0
Ritor1
parents:
diff changeset
859 unsigned __int16 v9; // ax@102
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
860 int spell_price; // eax@103
0
Ritor1
parents:
diff changeset
861 char v14; // al@159
Ritor1
parents:
diff changeset
862 unsigned int v15; // eax@168
Ritor1
parents:
diff changeset
863 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
864 InputAction inputAction; // [sp+0h] [bp-8h]@7
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
865 //int v24; // [sp+4h] [bp-4h]@87
0
Ritor1
parents:
diff changeset
866
Ritor1
parents:
diff changeset
867 pGame->pKeyboardInstance->EnterCriticalSection();
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1974
diff changeset
868 Keyboard* pKeyboard = pGame->pKeyboardInstance;
0
Ritor1
parents:
diff changeset
869 if (!bAlwaysRun)
Ritor1
parents:
diff changeset
870 {
Ritor1
parents:
diff changeset
871 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
872 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
873 else
Ritor1
parents:
diff changeset
874 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
875 }
Ritor1
parents:
diff changeset
876 else
Ritor1
parents:
diff changeset
877 {
Ritor1
parents:
diff changeset
878 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
879 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
880 else
Ritor1
parents:
diff changeset
881 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
882 }
Ritor1
parents:
diff changeset
883
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
884 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
885
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
886
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
887 // WUT? double event trigger
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
888 /*for ( uint i = 0; i < 30; ++i )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
889 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
890 if ( pKeyActionMap->pToggleTypes[i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
891 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
892 else
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
893 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]);
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
894 if ( v14 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
895 {
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
896 if (pCurrentScreen == SCREEN_GAME)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
897 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
898 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
899 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
900 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
901 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
902 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
903 v15 = pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
904 if ( pMessageQueue_50CBD0->uNumMessages )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
905 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
906 v15 = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
907 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
908 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
909 v15 = 1;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
910 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
911 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
912 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
913 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
914 ++pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
915 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
916 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
917 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
918 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
919 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
920 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
921 }
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
922 }*/
0
Ritor1
parents:
diff changeset
923 if ( !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
924 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
925 for ( uint i = 0; i < 30; ++i )
0
Ritor1
parents:
diff changeset
926 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
927 inputAction = (InputAction)i;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
928 if ( pKeyActionMap->pToggleTypes[(InputAction)i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
929 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
930 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
931 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
932 if ( v4 )
Ritor1
parents:
diff changeset
933 {
Ritor1
parents:
diff changeset
934 switch ( inputAction )
Ritor1
parents:
diff changeset
935 {
Ritor1
parents:
diff changeset
936 case INPUT_MoveForward:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
937 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
938 break;
Ritor1
parents:
diff changeset
939 if (!pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
940 {
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
941 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
0
Ritor1
parents:
diff changeset
942 partyAction = PARTY_RunForward;
Ritor1
parents:
diff changeset
943 else
Ritor1
parents:
diff changeset
944 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
945 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
946 break;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
947 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
948 if (pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
949 {
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
950 pTurnEngine->uActionPointsLeft -= 26;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
951 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
952 partyAction = PARTY_RunForward;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
953 else
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
954 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
955 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
956 break;
0
Ritor1
parents:
diff changeset
957 }
Ritor1
parents:
diff changeset
958 break;
Ritor1
parents:
diff changeset
959 case INPUT_MoveBackwards:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
960 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
961 break;
Ritor1
parents:
diff changeset
962 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
963 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
964 if ( pParty->uFlags2 & 2 )
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
965 partyAction = PARTY_RunBackward;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
966 else
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
967 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
968 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
969 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
970 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
971 if ( pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
0
Ritor1
parents:
diff changeset
972 {
Ritor1
parents:
diff changeset
973 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
974 if ( pParty->uFlags2 & 2 )
Ritor1
parents:
diff changeset
975 partyAction = PARTY_RunBackward;
Ritor1
parents:
diff changeset
976 else
Ritor1
parents:
diff changeset
977 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
978 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
979 break;
0
Ritor1
parents:
diff changeset
980 }
Ritor1
parents:
diff changeset
981 break;
Ritor1
parents:
diff changeset
982 case INPUT_StrafeLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
983 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
984 break;
Ritor1
parents:
diff changeset
985 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
986 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
987 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
988 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
989 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
990 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
991 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
992 break;
Ritor1
parents:
diff changeset
993 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
994 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
995 pPartyActionQueue->Add(partyAction);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
996 break;
0
Ritor1
parents:
diff changeset
997 case INPUT_StrafeRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
998 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
999 break;
Ritor1
parents:
diff changeset
1000 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1001 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1002 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1003 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1004 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1005 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1006 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
1007 break;
Ritor1
parents:
diff changeset
1008 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1009 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1010 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1011 break;
0
Ritor1
parents:
diff changeset
1012 case INPUT_TurnLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1013 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1014 break;
Ritor1
parents:
diff changeset
1015 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing
Ritor1
parents:
diff changeset
1016 {
Ritor1
parents:
diff changeset
1017 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1018 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1019 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
1020 break;
Ritor1
parents:
diff changeset
1021 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1022 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1023 partyAction = PARTY_StrafeLeft;
0
Ritor1
parents:
diff changeset
1024 }
Ritor1
parents:
diff changeset
1025 else
Ritor1
parents:
diff changeset
1026 {
Ritor1
parents:
diff changeset
1027 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1028 partyAction = PARTY_FastTurnLeft;
0
Ritor1
parents:
diff changeset
1029 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1030 partyAction = PARTY_TurnLeft;
0
Ritor1
parents:
diff changeset
1031 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1032 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
1033 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1034 pWeather->OnPlayerTurn(10);
0
Ritor1
parents:
diff changeset
1035 break;
Ritor1
parents:
diff changeset
1036 case INPUT_TurnRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1037 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1038 break;
Ritor1
parents:
diff changeset
1039 if ( GetAsyncKeyState(17) ) // strafing
Ritor1
parents:
diff changeset
1040 {
Ritor1
parents:
diff changeset
1041 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1042 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1043 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
1044 break;
Ritor1
parents:
diff changeset
1045 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
1046 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1047 partyAction = PARTY_StrafeRight;
0
Ritor1
parents:
diff changeset
1048 }
Ritor1
parents:
diff changeset
1049 else
Ritor1
parents:
diff changeset
1050 {
Ritor1
parents:
diff changeset
1051 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1052 partyAction = PARTY_FastTurnRight;
0
Ritor1
parents:
diff changeset
1053 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1054 partyAction = PARTY_TurnRight;
0
Ritor1
parents:
diff changeset
1055 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1056 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
1057 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1058 pWeather->OnPlayerTurn(-10);
0
Ritor1
parents:
diff changeset
1059 break;
Ritor1
parents:
diff changeset
1060 case INPUT_Jump:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1061 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn)
0
Ritor1
parents:
diff changeset
1062 break;
Ritor1
parents:
diff changeset
1063 partyAction = (PartyAction)12;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1064 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1065 break;
0
Ritor1
parents:
diff changeset
1066 case INPUT_Yell:
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
1067 if (!pCurrentScreen && uActiveCharacter)
0
Ritor1
parents:
diff changeset
1068 {
Ritor1
parents:
diff changeset
1069 pParty->Yell();
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
1070 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0);
0
Ritor1
parents:
diff changeset
1071 }
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
1072 break;
0
Ritor1
parents:
diff changeset
1073 case INPUT_Pass:
Ritor1
parents:
diff changeset
1074 if ( pCurrentScreen )
Ritor1
parents:
diff changeset
1075 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1076 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1077 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
1078 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1079 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1080 }
0
Ritor1
parents:
diff changeset
1081 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
1082 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1083 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery )
0
Ritor1
parents:
diff changeset
1084 {
Ritor1
parents:
diff changeset
1085 if ( !pParty->bTurnBasedModeOn )
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1086 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false) * 2.133333333333333));
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1459
diff changeset
1087 CastSpellInfoHelpers::_427D48();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1340
diff changeset
1088 pTurnEngine->ApplyPlayerAction();
0
Ritor1
parents:
diff changeset
1089 }
Ritor1
parents:
diff changeset
1090 }
Ritor1
parents:
diff changeset
1091 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1092 case INPUT_Combat://if press ENTER
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1093 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1094 {
Ritor1
parents:
diff changeset
1095 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1096 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1097 if (pTurnEngine->turn_stage == 3 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player)
0
Ritor1
parents:
diff changeset
1098 {
Ritor1
parents:
diff changeset
1099 pParty->bTurnBasedModeOn = 0;
Ritor1
parents:
diff changeset
1100 pTurnEngine->End(true);
Ritor1
parents:
diff changeset
1101 }
Ritor1
parents:
diff changeset
1102 }
Ritor1
parents:
diff changeset
1103 else
Ritor1
parents:
diff changeset
1104 {
Ritor1
parents:
diff changeset
1105 pTurnEngine->Start();
Ritor1
parents:
diff changeset
1106 pParty->bTurnBasedModeOn = true;
Ritor1
parents:
diff changeset
1107 }
Ritor1
parents:
diff changeset
1108 }
Ritor1
parents:
diff changeset
1109 break;
Ritor1
parents:
diff changeset
1110 case INPUT_CastReady:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1111 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1112 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1113 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1114 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
1115 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1116 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1117 }
0
Ritor1
parents:
diff changeset
1118 if ( !uActiveCharacter )
Ritor1
parents:
diff changeset
1119 break;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1120 v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1121 if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1122 || (( !(HIBYTE(v9) & 1)) ?
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1123 ((v9 & 0x80) == 0 ?
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1124 ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) :
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1125 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) :
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1126 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana,
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1127 spell_price > pPlayers[uActiveCharacter]->sMana) )
0
Ritor1
parents:
diff changeset
1128 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1129 pPartyActionQueue = pPartyActionQueue;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1130 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1131 break;
0
Ritor1
parents:
diff changeset
1132 }
Ritor1
parents:
diff changeset
1133 else
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2059
diff changeset
1134 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
0
Ritor1
parents:
diff changeset
1135 break;
Ritor1
parents:
diff changeset
1136 case INPUT_Attack:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1137 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1138 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1139 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1140 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
1141 pTurnEngine->field_18 |= TE_FLAG_8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1142 break;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1143 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1144 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0
Ritor1
parents:
diff changeset
1145 break;
Ritor1
parents:
diff changeset
1146 case INPUT_EventTrigger:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1147 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1148 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1149 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1150 break;
0
Ritor1
parents:
diff changeset
1151 }
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 141
diff changeset
1152 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE )
0
Ritor1
parents:
diff changeset
1153 {
Ritor1
parents:
diff changeset
1154 if ( pMessageQueue_50CBD0->uNumMessages )
Ritor1
parents:
diff changeset
1155 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1156 pMessageQueue_50CBD0->uNumMessages = 0;
0
Ritor1
parents:
diff changeset
1157 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
Ritor1
parents:
diff changeset
1158 {
Ritor1
parents:
diff changeset
1159 pMessageQueue_50CBD0->uNumMessages = 1;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1160 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
1161 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1574
diff changeset
1162 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 = 0;
0
Ritor1
parents:
diff changeset
1163 ++pMessageQueue_50CBD0->uNumMessages;
Ritor1
parents:
diff changeset
1164 break;
Ritor1
parents:
diff changeset
1165 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1166 break;
0
Ritor1
parents:
diff changeset
1167 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1168 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
0
Ritor1
parents:
diff changeset
1169 }
Ritor1
parents:
diff changeset
1170 break;
Ritor1
parents:
diff changeset
1171 case INPUT_CharCycle:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1172 if ( pCurrentScreen == SCREEN_SPELL_BOOK )
0
Ritor1
parents:
diff changeset
1173 break;
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1574
diff changeset
1174
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1175 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1176 break;
0
Ritor1
parents:
diff changeset
1177 case INPUT_LookUp:
Ritor1
parents:
diff changeset
1178 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1179 break;
Ritor1
parents:
diff changeset
1180 partyAction = (PartyAction)7;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1181 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1182 break;
0
Ritor1
parents:
diff changeset
1183 case INPUT_CenterView:
Ritor1
parents:
diff changeset
1184 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1185 break;
Ritor1
parents:
diff changeset
1186 partyAction = (PartyAction)9;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1187 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1188 break;
0
Ritor1
parents:
diff changeset
1189 case INPUT_LookDown:
Ritor1
parents:
diff changeset
1190 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1191 break;
Ritor1
parents:
diff changeset
1192 partyAction = (PartyAction)8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1193 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1194 break;
0
Ritor1
parents:
diff changeset
1195 case INPUT_FlyUp:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1196 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
1197 break;
Ritor1
parents:
diff changeset
1198 partyAction = (PartyAction)13;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1199 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1200 break;
0
Ritor1
parents:
diff changeset
1201 case INPUT_Land:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1202 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
1203 break;
Ritor1
parents:
diff changeset
1204 partyAction = (PartyAction)15;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1205 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1206 break;
0
Ritor1
parents:
diff changeset
1207 case INPUT_FlyDown:
Ritor1
parents:
diff changeset
1208 if ( !pCurrentScreen
Ritor1
parents:
diff changeset
1209 && !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1210 {
Ritor1
parents:
diff changeset
1211 partyAction = (PartyAction)14;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1212 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
1213 }
Ritor1
parents:
diff changeset
1214 break;
Ritor1
parents:
diff changeset
1215 case INPUT_ZoomIn:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1216 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1217 break;
0
Ritor1
parents:
diff changeset
1218 case INPUT_ZoomOut:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
1219 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0);
0
Ritor1
parents:
diff changeset
1220 break;
Ritor1
parents:
diff changeset
1221 case INPUT_AlwaysRun:
Ritor1
parents:
diff changeset
1222 bAlwaysRun = bAlwaysRun == 0;
Ritor1
parents:
diff changeset
1223 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1224 default:
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
1225 break;
0
Ritor1
parents:
diff changeset
1226 }
Ritor1
parents:
diff changeset
1227 }
Ritor1
parents:
diff changeset
1228 }
Ritor1
parents:
diff changeset
1229 }
Ritor1
parents:
diff changeset
1230 }