annotate mm7_6.cpp @ 1441:b67a3e0d6fc3

Слияние
author Ritor1
date Sat, 27 Jul 2013 09:36:55 +0600
parents d071e0e9ba75
children 9a1adf08f4ed
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 "OutdoorCamera.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
13 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
14 #include "Keyboard.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
15 #include "stru6.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
16
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
17 #include "Vis.h"
0
Ritor1
parents:
diff changeset
18 #include "Game.h"
Ritor1
parents:
diff changeset
19 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
20 #include "GUIFont.h"
Ritor1
parents:
diff changeset
21 #include "Party.h"
Ritor1
parents:
diff changeset
22 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
23 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1207
diff changeset
24 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
25 #include "Overlays.h"
Ritor1
parents:
diff changeset
26 #include "LOD.h"
Ritor1
parents:
diff changeset
27 #include "Actor.h"
Ritor1
parents:
diff changeset
28 #include "Events.h"
Ritor1
parents:
diff changeset
29 #include "Viewport.h"
Ritor1
parents:
diff changeset
30 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
31 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
32 #include "ObjectList.h"
Ritor1
parents:
diff changeset
33 #include "stru123.h"
Ritor1
parents:
diff changeset
34 #include "Time.h"
Ritor1
parents:
diff changeset
35 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
36 #include "Awards.h"
Ritor1
parents:
diff changeset
37 #include "TurnEngine.h"
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
38 #include "CastSpellInfo.h"
0
Ritor1
parents:
diff changeset
39 #include "stru298.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 169
diff changeset
40 #include "texts.h"
0
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42 #include "mm7_data.h"
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44
Ritor1
parents:
diff changeset
45
Ritor1
parents:
diff changeset
46 //----- (00424EE0) --------------------------------------------------------
Ritor1
parents:
diff changeset
47 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID)
Ritor1
parents:
diff changeset
48 {
Ritor1
parents:
diff changeset
49 unsigned int v1; // edx@1
Ritor1
parents:
diff changeset
50 double v2; // st7@1
Ritor1
parents:
diff changeset
51 signed int v3; // edi@1
Ritor1
parents:
diff changeset
52 char *v4; // esi@4
Ritor1
parents:
diff changeset
53 char *v5; // ecx@4
Ritor1
parents:
diff changeset
54 unsigned int v6; // eax@4
Ritor1
parents:
diff changeset
55 char *v7; // edx@4
Ritor1
parents:
diff changeset
56 double v8; // st6@10
Ritor1
parents:
diff changeset
57 double v9; // st5@10
Ritor1
parents:
diff changeset
58 double v10; // st6@11
Ritor1
parents:
diff changeset
59 unsigned __int8 v11; // c2@15
Ritor1
parents:
diff changeset
60 unsigned __int8 v12; // c3@15
Ritor1
parents:
diff changeset
61 void *v13; // edi@22
Ritor1
parents:
diff changeset
62 char *v14; // eax@22
Ritor1
parents:
diff changeset
63 double v15; // st6@22
Ritor1
parents:
diff changeset
64 char *v16; // ecx@22
Ritor1
parents:
diff changeset
65 signed int result; // eax@24
Ritor1
parents:
diff changeset
66 unsigned int v18; // [sp+8h] [bp-2Ch]@4
Ritor1
parents:
diff changeset
67 bool v19; // [sp+Ch] [bp-28h]@6
Ritor1
parents:
diff changeset
68 char *v20; // [sp+10h] [bp-24h]@4
Ritor1
parents:
diff changeset
69 char *v21; // [sp+14h] [bp-20h]@4
Ritor1
parents:
diff changeset
70 signed int v22; // [sp+18h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
71 char *v23; // [sp+1Ch] [bp-18h]@4
Ritor1
parents:
diff changeset
72 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4
Ritor1
parents:
diff changeset
73 char *v25; // [sp+24h] [bp-10h]@4
Ritor1
parents:
diff changeset
74 char *v26; // [sp+28h] [bp-Ch]@4
Ritor1
parents:
diff changeset
75 char *v27; // [sp+2Ch] [bp-8h]@4
Ritor1
parents:
diff changeset
76 char *v28; // [sp+30h] [bp-4h]@4
Ritor1
parents:
diff changeset
77
Ritor1
parents:
diff changeset
78 v1 = uVertexID;
Ritor1
parents:
diff changeset
79 v2 = (double)pOutdoorCamera->shading_dist_mist;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
80 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
0
Ritor1
parents:
diff changeset
81 v3 = 0;
Ritor1
parents:
diff changeset
82 v22 = 0;
Ritor1
parents:
diff changeset
83 if ( array_50AC10[0].vWorldViewPosition.x <= v2 )
Ritor1
parents:
diff changeset
84 v3 = 1;
Ritor1
parents:
diff changeset
85 if ( (signed int)(uVertexID + 1) <= 1 )
Ritor1
parents:
diff changeset
86 return 0;
Ritor1
parents:
diff changeset
87 v4 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
88 v5 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
89 v6 = v1;
Ritor1
parents:
diff changeset
90 v23 = (char *)&array_507D30[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
91 v26 = (char *)&array_507D30[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
92 v24 = array_507D30;
0
Ritor1
parents:
diff changeset
93 v20 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
94 v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
95 v25 = (char *)&array_507D30[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
96 v27 = (char *)&array_507D30[0].v;
Ritor1
parents:
diff changeset
97 v28 = (char *)&array_507D30[0].u;
Ritor1
parents:
diff changeset
98 v7 = (char *)&array_50AC10[0].v;
Ritor1
parents:
diff changeset
99 v18 = v6;
Ritor1
parents:
diff changeset
100 do
Ritor1
parents:
diff changeset
101 {
Ritor1
parents:
diff changeset
102 v19 = v2 >= *((float *)v7 + 5);
Ritor1
parents:
diff changeset
103 if ( v3 != v19 )
Ritor1
parents:
diff changeset
104 {
Ritor1
parents:
diff changeset
105 if ( v19 )
Ritor1
parents:
diff changeset
106 {
Ritor1
parents:
diff changeset
107 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7));
Ritor1
parents:
diff changeset
108 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6);
Ritor1
parents:
diff changeset
109 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5);
Ritor1
parents:
diff changeset
110 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1);
Ritor1
parents:
diff changeset
111 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7;
Ritor1
parents:
diff changeset
112 }
Ritor1
parents:
diff changeset
113 else
Ritor1
parents:
diff changeset
114 {
Ritor1
parents:
diff changeset
115 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5));
Ritor1
parents:
diff changeset
116 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6);
Ritor1
parents:
diff changeset
117 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7);
Ritor1
parents:
diff changeset
118 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11);
Ritor1
parents:
diff changeset
119 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12);
Ritor1
parents:
diff changeset
120 }
Ritor1
parents:
diff changeset
121 *(float *)v27 = v9;
Ritor1
parents:
diff changeset
122 *(float *)v25 = v2;
Ritor1
parents:
diff changeset
123 *(float *)v26 = 1.0 / v2;
Ritor1
parents:
diff changeset
124 if ( v3 )
Ritor1
parents:
diff changeset
125 {
Ritor1
parents:
diff changeset
126 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) )
Ritor1
parents:
diff changeset
127 {
Ritor1
parents:
diff changeset
128 v11 = 0;
Ritor1
parents:
diff changeset
129 v12 = *(float *)v4 == *((float *)v7 - 5);
Ritor1
parents:
diff changeset
130 goto LABEL_19;
Ritor1
parents:
diff changeset
131 }
Ritor1
parents:
diff changeset
132 }
Ritor1
parents:
diff changeset
133 else
Ritor1
parents:
diff changeset
134 {
Ritor1
parents:
diff changeset
135 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) )
Ritor1
parents:
diff changeset
136 {
Ritor1
parents:
diff changeset
137 v11 = 0;
Ritor1
parents:
diff changeset
138 v12 = *(float *)v4 == *((float *)v7 + 7);
Ritor1
parents:
diff changeset
139 LABEL_19:
Ritor1
parents:
diff changeset
140 if ( v12 | v11 )
Ritor1
parents:
diff changeset
141 goto LABEL_21;
Ritor1
parents:
diff changeset
142 goto LABEL_20;
Ritor1
parents:
diff changeset
143 }
Ritor1
parents:
diff changeset
144 }
Ritor1
parents:
diff changeset
145 LABEL_20:
Ritor1
parents:
diff changeset
146 v26 += 48;
Ritor1
parents:
diff changeset
147 ++v24;
Ritor1
parents:
diff changeset
148 v25 += 48;
Ritor1
parents:
diff changeset
149 v27 += 48;
Ritor1
parents:
diff changeset
150 v28 += 48;
Ritor1
parents:
diff changeset
151 v5 += 48;
Ritor1
parents:
diff changeset
152 v4 += 48;
Ritor1
parents:
diff changeset
153 ++v22;
Ritor1
parents:
diff changeset
154 v23 += 48;
Ritor1
parents:
diff changeset
155 v21 = v5;
Ritor1
parents:
diff changeset
156 v20 = v4;
Ritor1
parents:
diff changeset
157 }
Ritor1
parents:
diff changeset
158 LABEL_21:
Ritor1
parents:
diff changeset
159 if ( v19 )
Ritor1
parents:
diff changeset
160 {
Ritor1
parents:
diff changeset
161 v13 = v24;
Ritor1
parents:
diff changeset
162 v14 = v26;
Ritor1
parents:
diff changeset
163 v21 += 48;
Ritor1
parents:
diff changeset
164 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001);
Ritor1
parents:
diff changeset
165 v20 += 48;
Ritor1
parents:
diff changeset
166 ++v22;
Ritor1
parents:
diff changeset
167 v28 += 48;
Ritor1
parents:
diff changeset
168 v27 += 48;
Ritor1
parents:
diff changeset
169 v25 += 48;
Ritor1
parents:
diff changeset
170 ++v24;
Ritor1
parents:
diff changeset
171 v26 += 48;
Ritor1
parents:
diff changeset
172 memcpy(v13, v7 + 8, 0x30u);
Ritor1
parents:
diff changeset
173 v16 = v23;
Ritor1
parents:
diff changeset
174 v23 += 48;
Ritor1
parents:
diff changeset
175 v4 = v20;
Ritor1
parents:
diff changeset
176 *(float *)v14 = v15;
Ritor1
parents:
diff changeset
177 *(int *)v16 = *((int *)v7 + 13);
Ritor1
parents:
diff changeset
178 v5 = v21;
Ritor1
parents:
diff changeset
179 }
Ritor1
parents:
diff changeset
180 v3 = v19;
Ritor1
parents:
diff changeset
181 v7 += 48;
Ritor1
parents:
diff changeset
182 --v18;
Ritor1
parents:
diff changeset
183 }
Ritor1
parents:
diff changeset
184 while ( v18 );
Ritor1
parents:
diff changeset
185 result = v22;
Ritor1
parents:
diff changeset
186 if ( v22 < 3 )
Ritor1
parents:
diff changeset
187 return 0;
Ritor1
parents:
diff changeset
188 return result;
Ritor1
parents:
diff changeset
189 }
Ritor1
parents:
diff changeset
190
Ritor1
parents:
diff changeset
191 //----- (0042620A) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1384
diff changeset
192 bool sr_42620A(RenderVertexSoft *p)
0
Ritor1
parents:
diff changeset
193 {
Ritor1
parents:
diff changeset
194 __int16 v1; // fps@1
Ritor1
parents:
diff changeset
195 unsigned __int8 v2; // c0@2
Ritor1
parents:
diff changeset
196 char v3; // c2@2
Ritor1
parents:
diff changeset
197 unsigned __int8 v4; // c3@2
Ritor1
parents:
diff changeset
198 bool result; // eax@2
Ritor1
parents:
diff changeset
199 unsigned __int8 v6; // c0@4
Ritor1
parents:
diff changeset
200 char v7; // c2@4
Ritor1
parents:
diff changeset
201 unsigned __int8 v8; // c3@4
Ritor1
parents:
diff changeset
202 unsigned __int8 v9; // c0@6
Ritor1
parents:
diff changeset
203 char v10; // c2@6
Ritor1
parents:
diff changeset
204 unsigned __int8 v11; // c3@6
Ritor1
parents:
diff changeset
205 double v12; // st6@7
Ritor1
parents:
diff changeset
206 float v13; // ST04_4@7
Ritor1
parents:
diff changeset
207 float v14; // ST00_4@7
Ritor1
parents:
diff changeset
208 double v15; // st7@7
Ritor1
parents:
diff changeset
209 double v16; // st6@8
Ritor1
parents:
diff changeset
210 float v17; // ST04_4@8
Ritor1
parents:
diff changeset
211 float v18; // ST00_4@8
Ritor1
parents:
diff changeset
212 double v19; // st7@8
Ritor1
parents:
diff changeset
213
Ritor1
parents:
diff changeset
214 //UNDEF(v1);
Ritor1
parents:
diff changeset
215 if ( p->vWorldViewPosition.x < 300.0
Ritor1
parents:
diff changeset
216 || (v2 = 300.0 < p[1].vWorldViewPosition.x,
Ritor1
parents:
diff changeset
217 v3 = 0,
Ritor1
parents:
diff changeset
218 v4 = 300.0 == p[1].vWorldViewPosition.x,
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
219 //BYTE1(result) = HIBYTE(v1),
0
Ritor1
parents:
diff changeset
220 !(v2 | v4)) )
Ritor1
parents:
diff changeset
221 {
Ritor1
parents:
diff changeset
222 if ( p->vWorldViewPosition.x < 300.0 )
Ritor1
parents:
diff changeset
223 {
Ritor1
parents:
diff changeset
224 v6 = 300.0 < p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
225 v7 = 0;
Ritor1
parents:
diff changeset
226 v8 = 300.0 == p[1].vWorldViewPosition.x;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
227 //BYTE1(result) = HIBYTE(v1);
0
Ritor1
parents:
diff changeset
228 if ( !(v6 | v8) )
Ritor1
parents:
diff changeset
229 {
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
230 //LOBYTE(result) = 0;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
231 return false;
0
Ritor1
parents:
diff changeset
232 }
Ritor1
parents:
diff changeset
233 }
Ritor1
parents:
diff changeset
234 v9 = 300.0 < p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
235 v10 = 0;
Ritor1
parents:
diff changeset
236 v11 = 300.0 == p->vWorldViewPosition.x;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
237 //BYTE1(result) = HIBYTE(v1);
0
Ritor1
parents:
diff changeset
238 if ( v9 | v11 )
Ritor1
parents:
diff changeset
239 {
Ritor1
parents:
diff changeset
240 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x);
Ritor1
parents:
diff changeset
241 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16;
Ritor1
parents:
diff changeset
242 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16;
Ritor1
parents:
diff changeset
243 v19 = 300.0 - p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
244 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
245 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
246 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
247 }
Ritor1
parents:
diff changeset
248 else
Ritor1
parents:
diff changeset
249 {
Ritor1
parents:
diff changeset
250 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x);
Ritor1
parents:
diff changeset
251 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12;
Ritor1
parents:
diff changeset
252 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12;
Ritor1
parents:
diff changeset
253 v15 = 300.0 - p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
254 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
255 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y;
Ritor1
parents:
diff changeset
256 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z;
Ritor1
parents:
diff changeset
257 }
Ritor1
parents:
diff changeset
258 }
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
259 //LOBYTE(result) = 1;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
260 return true;
0
Ritor1
parents:
diff changeset
261 }
Ritor1
parents:
diff changeset
262
Ritor1
parents:
diff changeset
263 //----- (004268E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
264 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor)
Ritor1
parents:
diff changeset
265 {
Ritor1
parents:
diff changeset
266 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
267 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
268 int v3; // eax@1
Ritor1
parents:
diff changeset
269 int v4; // edx@1
Ritor1
parents:
diff changeset
270 unsigned int v5; // ecx@1
Ritor1
parents:
diff changeset
271
Ritor1
parents:
diff changeset
272 v1 = uColor >> 9;
Ritor1
parents:
diff changeset
273 v2 = uColor >> 6;
Ritor1
parents:
diff changeset
274 LOWORD(v1) = (uColor >> 9) & 0x7C00;
Ritor1
parents:
diff changeset
275 LOWORD(v2) = (uColor >> 6) & 0x3E0;
Ritor1
parents:
diff changeset
276 v3 = v2 | v1;
Ritor1
parents:
diff changeset
277 v4 = (unsigned __int8)uColor >> 3;
Ritor1
parents:
diff changeset
278 v5 = uColor >> 16;
Ritor1
parents:
diff changeset
279 LOWORD(v5) = v5 & 0x8000;
Ritor1
parents:
diff changeset
280 return v5 | v4 | v3;
Ritor1
parents:
diff changeset
281 }
Ritor1
parents:
diff changeset
282
Ritor1
parents:
diff changeset
283 //----- (0042690D) --------------------------------------------------------
Ritor1
parents:
diff changeset
284 int __fastcall _42690D_colors_cvt(unsigned int a1)
Ritor1
parents:
diff changeset
285 {
Ritor1
parents:
diff changeset
286 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
287 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
288
Ritor1
parents:
diff changeset
289 v1 = a1 >> 8;
Ritor1
parents:
diff changeset
290 v2 = a1 >> 5;
Ritor1
parents:
diff changeset
291 LOWORD(v1) = (a1 >> 8) & 0xF800;
Ritor1
parents:
diff changeset
292 LOWORD(v2) = (a1 >> 5) & 0x7E0;
Ritor1
parents:
diff changeset
293 return ((unsigned __int8)a1 >> 3) | v2 | v1;
Ritor1
parents:
diff changeset
294 }
Ritor1
parents:
diff changeset
295 //----- (00426947) --------------------------------------------------------
Ritor1
parents:
diff changeset
296 void __cdecl sub_426947()
Ritor1
parents:
diff changeset
297 {
893
4676774b225c GuildDialogue fix
Ritor1
parents: 890
diff changeset
298 stru_50C198.field_0 = 0;
0
Ritor1
parents:
diff changeset
299 dword_50C994 = 0;
Ritor1
parents:
diff changeset
300 dword_50C998_turnbased_icon_1A = 0;
Ritor1
parents:
diff changeset
301 }
Ritor1
parents:
diff changeset
302 // 50C968: using guessed type int dword_50C968;
Ritor1
parents:
diff changeset
303 // 50C994: using guessed type int dword_50C994;
Ritor1
parents:
diff changeset
304 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
Ritor1
parents:
diff changeset
305
Ritor1
parents:
diff changeset
306 //----- (00426A5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
307 void stru319::LootActor(Actor *pActor)
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 signed int v2; // edi@1
Ritor1
parents:
diff changeset
310 char v3; // zf@1
Ritor1
parents:
diff changeset
311 unsigned int v4; // eax@13
Ritor1
parents:
diff changeset
312 unsigned int v5; // esi@13
Ritor1
parents:
diff changeset
313 int v6; // eax@14
Ritor1
parents:
diff changeset
314 unsigned __int8 v7; // al@30
Ritor1
parents:
diff changeset
315 Party *v8; // esi@34
Ritor1
parents:
diff changeset
316 char *v9; // [sp-4h] [bp-3Ch]@10
Ritor1
parents:
diff changeset
317 char *v10; // [sp-4h] [bp-3Ch]@31
Ritor1
parents:
diff changeset
318 char *v11; // [sp-4h] [bp-3Ch]@38
Ritor1
parents:
diff changeset
319 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1
Ritor1
parents:
diff changeset
320 int v13; // [sp+30h] [bp-8h]@1
Ritor1
parents:
diff changeset
321 int v14; // [sp+34h] [bp-4h]@1
Ritor1
parents:
diff changeset
322
Ritor1
parents:
diff changeset
323 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
324 Dst.Reset();
Ritor1
parents:
diff changeset
325 v2 = 0;
Ritor1
parents:
diff changeset
326 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0;
Ritor1
parents:
diff changeset
327 v13 = 0;
Ritor1
parents:
diff changeset
328 v14 = 0;
Ritor1
parents:
diff changeset
329 if ( v3 )
Ritor1
parents:
diff changeset
330 {
Ritor1
parents:
diff changeset
331 if ( !pActor->pMonsterInfo.uTreasureDiceRolls )
Ritor1
parents:
diff changeset
332 goto LABEL_9;
Ritor1
parents:
diff changeset
333 do
Ritor1
parents:
diff changeset
334 {
Ritor1
parents:
diff changeset
335 ++v2;
Ritor1
parents:
diff changeset
336 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1;
Ritor1
parents:
diff changeset
337 }
Ritor1
parents:
diff changeset
338 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls );
Ritor1
parents:
diff changeset
339 }
Ritor1
parents:
diff changeset
340 else
Ritor1
parents:
diff changeset
341 {
Ritor1
parents:
diff changeset
342 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 )
Ritor1
parents:
diff changeset
343 goto LABEL_9;
377
243418228760 GetIdentifiedName
Gloval
parents: 370
diff changeset
344 v14 = pActor->array_000234[3].uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
345 pActor->array_000234[3].Reset();
Ritor1
parents:
diff changeset
346 }
Ritor1
parents:
diff changeset
347 if ( v14 )
Ritor1
parents:
diff changeset
348 {
Ritor1
parents:
diff changeset
349 party_finds_gold(v14, 0);
Ritor1
parents:
diff changeset
350 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
351 }
Ritor1
parents:
diff changeset
352 LABEL_9:
Ritor1
parents:
diff changeset
353 if ( pActor->uCarriedItemID )
Ritor1
parents:
diff changeset
354 {
Ritor1
parents:
diff changeset
355 Dst.Reset();
Ritor1
parents:
diff changeset
356 Dst.uItemID = pActor->uCarriedItemID;
Ritor1
parents:
diff changeset
357 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
358 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
359 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[490], v14, v9);
0
Ritor1
parents:
diff changeset
360 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
361 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[471], v9);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
362 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
363 v4 = Dst.uItemID;
Ritor1
parents:
diff changeset
364 v5 = Dst.uItemID;
Ritor1
parents:
diff changeset
365 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 )
Ritor1
parents:
diff changeset
366 {
Ritor1
parents:
diff changeset
367 v5 = Dst.uItemID;
Ritor1
parents:
diff changeset
368 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1;
Ritor1
parents:
diff changeset
369 Dst.uNumCharges = v6;
Ritor1
parents:
diff changeset
370 Dst.uMaxCharges = v6;
Ritor1
parents:
diff changeset
371 v4 = Dst.uItemID;
Ritor1
parents:
diff changeset
372 }
Ritor1
parents:
diff changeset
373 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 )
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 569
diff changeset
374 Dst.uEnchantmentType = 2 * rand() % 4 + 2;
0
Ritor1
parents:
diff changeset
375 pItemsTable->SetSpecialBonus(&Dst);
Ritor1
parents:
diff changeset
376 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
377 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
378 pActor->uCarriedItemID = 0;
Ritor1
parents:
diff changeset
379 if ( pActor->array_000234[0].uItemID )
Ritor1
parents:
diff changeset
380 {
Ritor1
parents:
diff changeset
381 if ( !pParty->AddItem(pActor->array_000234) )
Ritor1
parents:
diff changeset
382 {
Ritor1
parents:
diff changeset
383 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
384 pParty->SetHoldingItem(pActor->array_000234);
Ritor1
parents:
diff changeset
385 }
Ritor1
parents:
diff changeset
386 pActor->array_000234[0].Reset();
Ritor1
parents:
diff changeset
387 }
Ritor1
parents:
diff changeset
388 if ( pActor->array_000234[1].uItemID )
Ritor1
parents:
diff changeset
389 {
Ritor1
parents:
diff changeset
390 if ( !pParty->AddItem(&pActor->array_000234[1]) )
Ritor1
parents:
diff changeset
391 {
Ritor1
parents:
diff changeset
392 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
393 pParty->SetHoldingItem(&pActor->array_000234[1]);
Ritor1
parents:
diff changeset
394 }
Ritor1
parents:
diff changeset
395 pActor->array_000234[1].Reset();
Ritor1
parents:
diff changeset
396 }
Ritor1
parents:
diff changeset
397 LABEL_55:
Ritor1
parents:
diff changeset
398 pActor->Remove();
Ritor1
parents:
diff changeset
399 return;
Ritor1
parents:
diff changeset
400 }
Ritor1
parents:
diff changeset
401 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes )
Ritor1
parents:
diff changeset
402 {
Ritor1
parents:
diff changeset
403 if ( pActor->array_000234[3].uItemID )
Ritor1
parents:
diff changeset
404 {
Ritor1
parents:
diff changeset
405 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst));
Ritor1
parents:
diff changeset
406 pActor->array_000234[3].Reset();
Ritor1
parents:
diff changeset
407 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
408 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
409 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
0
Ritor1
parents:
diff changeset
410 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
411 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
412 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
413 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
414 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
415 v13 = 1;
Ritor1
parents:
diff changeset
416 }
Ritor1
parents:
diff changeset
417 goto LABEL_44;
Ritor1
parents:
diff changeset
418 }
Ritor1
parents:
diff changeset
419 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 )
Ritor1
parents:
diff changeset
420 {
Ritor1
parents:
diff changeset
421 LABEL_44:
Ritor1
parents:
diff changeset
422 v8 = pParty;
Ritor1
parents:
diff changeset
423 goto LABEL_45;
Ritor1
parents:
diff changeset
424 }
Ritor1
parents:
diff changeset
425 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst);
Ritor1
parents:
diff changeset
426 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
427 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
428 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);
0
Ritor1
parents:
diff changeset
429 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
430 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
431 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
432 v8 = pParty;
Ritor1
parents:
diff changeset
433 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
434 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
435 v13 = 1;
Ritor1
parents:
diff changeset
436 LABEL_45:
Ritor1
parents:
diff changeset
437 if ( pActor->array_000234[0].uItemID )
Ritor1
parents:
diff changeset
438 {
Ritor1
parents:
diff changeset
439 if ( !v8->AddItem(pActor->array_000234) )
Ritor1
parents:
diff changeset
440 {
Ritor1
parents:
diff changeset
441 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
442 v8->SetHoldingItem(pActor->array_000234);
Ritor1
parents:
diff changeset
443 v13 = 1;
Ritor1
parents:
diff changeset
444 }
Ritor1
parents:
diff changeset
445 pActor->array_000234[0].Reset();
Ritor1
parents:
diff changeset
446 }
Ritor1
parents:
diff changeset
447 if ( pActor->array_000234[1].uItemID )
Ritor1
parents:
diff changeset
448 {
Ritor1
parents:
diff changeset
449 if ( !v8->AddItem(&pActor->array_000234[1]) )
Ritor1
parents:
diff changeset
450 {
Ritor1
parents:
diff changeset
451 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
452 v8->SetHoldingItem(&pActor->array_000234[1]);
Ritor1
parents:
diff changeset
453 v13 = 1;
Ritor1
parents:
diff changeset
454 }
Ritor1
parents:
diff changeset
455 pActor->array_000234[1].Reset();
Ritor1
parents:
diff changeset
456 }
Ritor1
parents:
diff changeset
457 if ( !v13 || rand() % 100 < 90 )
Ritor1
parents:
diff changeset
458 goto LABEL_55;
Ritor1
parents:
diff changeset
459 }
Ritor1
parents:
diff changeset
460
Ritor1
parents:
diff changeset
461 //----- (00426E10) --------------------------------------------------------
Ritor1
parents:
diff changeset
462 int stru319::which_player_would_attack(Actor *pActor)
Ritor1
parents:
diff changeset
463 {
Ritor1
parents:
diff changeset
464 signed int v2; // ebx@1
Ritor1
parents:
diff changeset
465 int v3; // ecx@2
Ritor1
parents:
diff changeset
466 signed int v4; // edx@3
Ritor1
parents:
diff changeset
467 char v5; // zf@3
Ritor1
parents:
diff changeset
468 unsigned int v6; // eax@3
Ritor1
parents:
diff changeset
469 int v7; // eax@6
Ritor1
parents:
diff changeset
470 int v8; // eax@7
Ritor1
parents:
diff changeset
471 int v9; // eax@8
Ritor1
parents:
diff changeset
472 int v10; // eax@9
Ritor1
parents:
diff changeset
473 int v11; // eax@10
Ritor1
parents:
diff changeset
474 int v12; // eax@11
Ritor1
parents:
diff changeset
475 int v13; // esi@35
Ritor1
parents:
diff changeset
476 signed int v14; // edi@37
Ritor1
parents:
diff changeset
477 enum CHARACTER_RACE v15; // eax@44
Ritor1
parents:
diff changeset
478 Player *v16; // ecx@47
Ritor1
parents:
diff changeset
479 unsigned __int8 v17; // sf@50
Ritor1
parents:
diff changeset
480 unsigned __int8 v18; // of@50
Ritor1
parents:
diff changeset
481 int v19; // esi@52
Ritor1
parents:
diff changeset
482 Player *v20; // ecx@53
Ritor1
parents:
diff changeset
483 int result; // eax@57
Ritor1
parents:
diff changeset
484 int v22[16]; // [sp+8h] [bp-140h]@3
Ritor1
parents:
diff changeset
485 int v23[60]; // [sp+48h] [bp-100h]@48
Ritor1
parents:
diff changeset
486 int v24; // [sp+138h] [bp-10h]@2
Ritor1
parents:
diff changeset
487 int v25; // [sp+13Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
488 int v26; // [sp+140h] [bp-8h]@1
Ritor1
parents:
diff changeset
489 int v27; // [sp+144h] [bp-4h]@1
Ritor1
parents:
diff changeset
490
Ritor1
parents:
diff changeset
491 v27 = -1;
Ritor1
parents:
diff changeset
492 v26 = -1;
Ritor1
parents:
diff changeset
493 v25 = -1;
Ritor1
parents:
diff changeset
494 v2 = 0;
Ritor1
parents:
diff changeset
495 if ( pActor->pMonsterInfo.uAttackPreference )
Ritor1
parents:
diff changeset
496 {
Ritor1
parents:
diff changeset
497 v3 = 0;
Ritor1
parents:
diff changeset
498 v24 = 0;
Ritor1
parents:
diff changeset
499 do
Ritor1
parents:
diff changeset
500 {
Ritor1
parents:
diff changeset
501 v4 = 1;
Ritor1
parents:
diff changeset
502 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3);
Ritor1
parents:
diff changeset
503 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0;
Ritor1
parents:
diff changeset
504 v22[v3] = v6;
Ritor1
parents:
diff changeset
505 if ( !v5 )
Ritor1
parents:
diff changeset
506 {
Ritor1
parents:
diff changeset
507 if ( (signed int)v6 > 128 )
Ritor1
parents:
diff changeset
508 {
Ritor1
parents:
diff changeset
509 switch ( v6 )
Ritor1
parents:
diff changeset
510 {
Ritor1
parents:
diff changeset
511 case 0x100u:
Ritor1
parents:
diff changeset
512 v27 = 8;
Ritor1
parents:
diff changeset
513 break;
Ritor1
parents:
diff changeset
514 case 0x200u:
Ritor1
parents:
diff changeset
515 v25 = 0;
Ritor1
parents:
diff changeset
516 break;
Ritor1
parents:
diff changeset
517 case 0x400u:
Ritor1
parents:
diff changeset
518 v25 = 1;
Ritor1
parents:
diff changeset
519 break;
Ritor1
parents:
diff changeset
520 case 0x800u:
Ritor1
parents:
diff changeset
521 v26 = 0;
Ritor1
parents:
diff changeset
522 break;
Ritor1
parents:
diff changeset
523 case 0x1000u:
Ritor1
parents:
diff changeset
524 v26 = 1;
Ritor1
parents:
diff changeset
525 break;
Ritor1
parents:
diff changeset
526 case 0x2000u:
Ritor1
parents:
diff changeset
527 v26 = 3;
Ritor1
parents:
diff changeset
528 break;
Ritor1
parents:
diff changeset
529 case 0x4000u:
Ritor1
parents:
diff changeset
530 v26 = 2;
Ritor1
parents:
diff changeset
531 break;
Ritor1
parents:
diff changeset
532 }
Ritor1
parents:
diff changeset
533 }
Ritor1
parents:
diff changeset
534 else
Ritor1
parents:
diff changeset
535 {
Ritor1
parents:
diff changeset
536 if ( v6 == 128 )
Ritor1
parents:
diff changeset
537 {
Ritor1
parents:
diff changeset
538 v27 = 4;
Ritor1
parents:
diff changeset
539 }
Ritor1
parents:
diff changeset
540 else
Ritor1
parents:
diff changeset
541 {
Ritor1
parents:
diff changeset
542 v7 = v6 - 1;
Ritor1
parents:
diff changeset
543 if ( v7 )
Ritor1
parents:
diff changeset
544 {
Ritor1
parents:
diff changeset
545 v8 = v7 - 1;
Ritor1
parents:
diff changeset
546 if ( v8 )
Ritor1
parents:
diff changeset
547 {
Ritor1
parents:
diff changeset
548 v9 = v8 - 2;
Ritor1
parents:
diff changeset
549 if ( v9 )
Ritor1
parents:
diff changeset
550 {
Ritor1
parents:
diff changeset
551 v10 = v9 - 4;
Ritor1
parents:
diff changeset
552 if ( v10 )
Ritor1
parents:
diff changeset
553 {
Ritor1
parents:
diff changeset
554 v11 = v10 - 8;
Ritor1
parents:
diff changeset
555 if ( v11 )
Ritor1
parents:
diff changeset
556 {
Ritor1
parents:
diff changeset
557 v12 = v11 - 16;
Ritor1
parents:
diff changeset
558 if ( v12 )
Ritor1
parents:
diff changeset
559 {
Ritor1
parents:
diff changeset
560 if ( v12 == 32 )
Ritor1
parents:
diff changeset
561 v27 = 20;
Ritor1
parents:
diff changeset
562 }
Ritor1
parents:
diff changeset
563 else
Ritor1
parents:
diff changeset
564 {
Ritor1
parents:
diff changeset
565 v27 = 32;
Ritor1
parents:
diff changeset
566 }
Ritor1
parents:
diff changeset
567 }
Ritor1
parents:
diff changeset
568 else
Ritor1
parents:
diff changeset
569 {
Ritor1
parents:
diff changeset
570 v27 = 24;
Ritor1
parents:
diff changeset
571 }
Ritor1
parents:
diff changeset
572 }
Ritor1
parents:
diff changeset
573 else
Ritor1
parents:
diff changeset
574 {
Ritor1
parents:
diff changeset
575 v27 = 28;
Ritor1
parents:
diff changeset
576 }
Ritor1
parents:
diff changeset
577 }
Ritor1
parents:
diff changeset
578 else
Ritor1
parents:
diff changeset
579 {
Ritor1
parents:
diff changeset
580 v27 = 16;
Ritor1
parents:
diff changeset
581 }
Ritor1
parents:
diff changeset
582 }
Ritor1
parents:
diff changeset
583 else
Ritor1
parents:
diff changeset
584 {
Ritor1
parents:
diff changeset
585 v27 = 12;
Ritor1
parents:
diff changeset
586 }
Ritor1
parents:
diff changeset
587 }
Ritor1
parents:
diff changeset
588 else
Ritor1
parents:
diff changeset
589 {
Ritor1
parents:
diff changeset
590 v27 = 0;
Ritor1
parents:
diff changeset
591 }
Ritor1
parents:
diff changeset
592 }
Ritor1
parents:
diff changeset
593 }
Ritor1
parents:
diff changeset
594 v2 = 0;
Ritor1
parents:
diff changeset
595 v13 = 0;
Ritor1
parents:
diff changeset
596 while ( 1 )
Ritor1
parents:
diff changeset
597 {
Ritor1
parents:
diff changeset
598 v14 = 0;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 112
diff changeset
599 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType )
0
Ritor1
parents:
diff changeset
600 v14 = v4;
Ritor1
parents:
diff changeset
601 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex )
Ritor1
parents:
diff changeset
602 v14 = v4;
Ritor1
parents:
diff changeset
603 if ( v26 != -1 )
Ritor1
parents:
diff changeset
604 {
Ritor1
parents:
diff changeset
605 v15 = pPlayers[v13 + 1]->GetRace();
Ritor1
parents:
diff changeset
606 if ( v26 == v15 )
Ritor1
parents:
diff changeset
607 v14 = 1;
Ritor1
parents:
diff changeset
608 }
Ritor1
parents:
diff changeset
609 if ( v14 == 1 )
Ritor1
parents:
diff changeset
610 {
Ritor1
parents:
diff changeset
611 v16 = pPlayers[v13 + 1];
Ritor1
parents:
diff changeset
612 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) )
Ritor1
parents:
diff changeset
613 v23[v2++] = v13;
Ritor1
parents:
diff changeset
614 }
Ritor1
parents:
diff changeset
615 ++v13;
Ritor1
parents:
diff changeset
616 if ( v13 >= 4 )
Ritor1
parents:
diff changeset
617 break;
Ritor1
parents:
diff changeset
618 v4 = 1;
Ritor1
parents:
diff changeset
619 }
Ritor1
parents:
diff changeset
620 }
Ritor1
parents:
diff changeset
621 v3 = v24 + 1;
Ritor1
parents:
diff changeset
622 v18 = __OFSUB__(v24 + 1, 15);
Ritor1
parents:
diff changeset
623 v17 = v24++ - 14 < 0;
Ritor1
parents:
diff changeset
624 }
Ritor1
parents:
diff changeset
625 while ( v17 ^ v18 );
Ritor1
parents:
diff changeset
626 if ( v2 )
Ritor1
parents:
diff changeset
627 goto LABEL_61;
Ritor1
parents:
diff changeset
628 }
Ritor1
parents:
diff changeset
629 v19 = 0;
Ritor1
parents:
diff changeset
630 do
Ritor1
parents:
diff changeset
631 {
Ritor1
parents:
diff changeset
632 v20 = pPlayers[v19 + 1];
Ritor1
parents:
diff changeset
633 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) )
Ritor1
parents:
diff changeset
634 v23[v2++] = v19;
Ritor1
parents:
diff changeset
635 ++v19;
Ritor1
parents:
diff changeset
636 }
Ritor1
parents:
diff changeset
637 while ( v19 < 4 );
Ritor1
parents:
diff changeset
638 if ( v2 )
Ritor1
parents:
diff changeset
639 LABEL_61:
Ritor1
parents:
diff changeset
640 result = v23[rand() % v2];
Ritor1
parents:
diff changeset
641 else
Ritor1
parents:
diff changeset
642 result = 0;
Ritor1
parents:
diff changeset
643 return result;
Ritor1
parents:
diff changeset
644 }
Ritor1
parents:
diff changeset
645
Ritor1
parents:
diff changeset
646 //----- (0042704B) --------------------------------------------------------
Ritor1
parents:
diff changeset
647 bool stru319::special_ability_use_check(Actor *pActor, int a2)
Ritor1
parents:
diff changeset
648 {
Ritor1
parents:
diff changeset
649 stru319 *v3; // edi@1
Ritor1
parents:
diff changeset
650 signed int v4; // ebx@5
Ritor1
parents:
diff changeset
651 signed int v5; // edi@5
Ritor1
parents:
diff changeset
652
Ritor1
parents:
diff changeset
653 v3 = this;
Ritor1
parents:
diff changeset
654 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2
Ritor1
parents:
diff changeset
655 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u
Ritor1
parents:
diff changeset
656 && rand() % 100 < 5 )
Ritor1
parents:
diff changeset
657 pActor->_44FD29(a2);
Ritor1
parents:
diff changeset
658 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID);
Ritor1
parents:
diff changeset
659 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID);
Ritor1
parents:
diff changeset
660 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance )
Ritor1
parents:
diff changeset
661 return 2;
Ritor1
parents:
diff changeset
662 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance )
Ritor1
parents:
diff changeset
663 return 3;
Ritor1
parents:
diff changeset
664 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance;
Ritor1
parents:
diff changeset
665 }
Ritor1
parents:
diff changeset
666
Ritor1
parents:
diff changeset
667 //----- (00427102) --------------------------------------------------------
Ritor1
parents:
diff changeset
668 int stru319::_427102(Actor *pActor, signed int a2)
Ritor1
parents:
diff changeset
669 {
Ritor1
parents:
diff changeset
670 unsigned __int8 v3; // cf@11
Ritor1
parents:
diff changeset
671 unsigned __int8 v4; // zf@11
Ritor1
parents:
diff changeset
672 SpellBuff *v6; // ecx@46
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
673 Player *v7; // esi@49
0
Ritor1
parents:
diff changeset
674 signed int v8; // edx@50
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
675 SpellBuff *v9; // ecx@50
0
Ritor1
parents:
diff changeset
676
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
677 switch(a2)
0
Ritor1
parents:
diff changeset
678 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
679 case 77:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
680 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
681 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
682 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
683 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
684 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
685 case 80:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
686 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
687 v6 = pParty->pPartyBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
688 while ( (signed __int64)v6->uExpireTime <= 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
689 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
690 ++v6;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
691 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
692 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
693 v7 = pParty->pPlayers;//[0].pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
694 v8 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
695 v9 = v7->pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
696 while ( v9->uExpireTime <= 0i64 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
697 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
698 ++v8;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
699 ++v9;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
700 if ( v8 >= 24 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
701 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
702 ++v7;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
703 if ( v7 <= &pParty->pPlayers[3] )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
704 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
705 v8 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
706 v9 = v7->pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
707 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
708 else
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
709 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
710 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
711 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
712 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
713 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
714 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
715 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
716 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
717 case 85:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
718 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
719 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
720 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
721 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
722 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
723 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
724 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
725 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
726 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
727 case 86:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
728 {
0
Ritor1
parents:
diff changeset
729 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
730 return 1;
0
Ritor1
parents:
diff changeset
731 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
732 return 0;
0
Ritor1
parents:
diff changeset
733 v3 = 0;
Ritor1
parents:
diff changeset
734 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
735 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
736 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
737 case 95:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
738 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
739 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
740 return 1;
0
Ritor1
parents:
diff changeset
741 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
742 return 0;
0
Ritor1
parents:
diff changeset
743 v3 = 0;
Ritor1
parents:
diff changeset
744 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
745 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
746 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
747 case 73:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
748 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
749 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
750 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
751 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
752 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
753 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
754 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
755 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
756 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
757 case 5:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
758 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
759 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
760 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
761 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
762 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
763 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
764 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
765 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
766 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
767 case 17:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
768 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
769 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
770 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
771 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
772 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
773 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
774 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
775 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
776 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
777 case 38:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
778 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
779 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
780 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
781 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
782 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
783 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
784 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
785 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
786 case 46:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
787 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
788 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 )
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
789 return 1;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
790 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
791 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
792 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
793 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
794 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
795 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
796 case 47:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
797 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
798 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
799 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
800 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
801 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
802 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
803 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
804 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
805 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
806 case 51:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
807 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
808 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
809 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
810 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
811 {
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
812 v3 = 0;
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
813 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0;
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
814 }
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
815 else
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
816 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
817 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
818 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
819 default:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
820 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
821 return 1;
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
822 }
0
Ritor1
parents:
diff changeset
823 }
Ritor1
parents:
diff changeset
824 if ( !(v3 | v4) )
Ritor1
parents:
diff changeset
825 return 0;
Ritor1
parents:
diff changeset
826 return 1;
Ritor1
parents:
diff changeset
827 }
Ritor1
parents:
diff changeset
828
Ritor1
parents:
diff changeset
829 //----- (004272F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
830 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4)
Ritor1
parents:
diff changeset
831 {
Ritor1
parents:
diff changeset
832 signed int v5; // esi@1
Ritor1
parents:
diff changeset
833 signed int v6; // edi@1
Ritor1
parents:
diff changeset
834 int v7; // esi@8
Ritor1
parents:
diff changeset
835 int v8; // eax@9
Ritor1
parents:
diff changeset
836 int v9; // edx@11
Ritor1
parents:
diff changeset
837 int v10; // edx@13
Ritor1
parents:
diff changeset
838 int v11; // esi@13
Ritor1
parents:
diff changeset
839 unsigned __int8 v12; // sf@13
Ritor1
parents:
diff changeset
840 unsigned __int8 v13; // of@13
Ritor1
parents:
diff changeset
841 int v14; // edx@14
Ritor1
parents:
diff changeset
842 int v15; // eax@14
Ritor1
parents:
diff changeset
843 signed int result; // eax@17
Ritor1
parents:
diff changeset
844
Ritor1
parents:
diff changeset
845 v5 = pActor->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
846 v6 = 0;
Ritor1
parents:
diff changeset
847 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 )
Ritor1
parents:
diff changeset
848 v5 /= 2;
Ritor1
parents:
diff changeset
849 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
850 v6 = pActor->pActorBuffs[15].uPower;
Ritor1
parents:
diff changeset
851 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 )
Ritor1
parents:
diff changeset
852 v6 = pActor->pActorBuffs[16].uPower;
Ritor1
parents:
diff changeset
853 v7 = v6 + v5;
Ritor1
parents:
diff changeset
854 if ( a3 )
Ritor1
parents:
diff changeset
855 v8 = pPlayer->GetRangedAttack();
Ritor1
parents:
diff changeset
856 else
Ritor1
parents:
diff changeset
857 v8 = pPlayer->GetActualAttack(0);
Ritor1
parents:
diff changeset
858 v9 = rand() % (v7 + 2 * v8 + 30);
Ritor1
parents:
diff changeset
859 if ( a3 == 2 )
Ritor1
parents:
diff changeset
860 {
Ritor1
parents:
diff changeset
861 v14 = a4 + v9;
Ritor1
parents:
diff changeset
862 v15 = ((v7 + 15) >> 1) + v7 + 15;
Ritor1
parents:
diff changeset
863 }
Ritor1
parents:
diff changeset
864 else
Ritor1
parents:
diff changeset
865 {
Ritor1
parents:
diff changeset
866 if ( a3 != 3 )
Ritor1
parents:
diff changeset
867 {
Ritor1
parents:
diff changeset
868 v10 = a4 + v9;
Ritor1
parents:
diff changeset
869 v11 = v7 + 15;
Ritor1
parents:
diff changeset
870 v13 = __OFSUB__(v10, v11);
Ritor1
parents:
diff changeset
871 v12 = v10 - v11 < 0;
Ritor1
parents:
diff changeset
872 goto LABEL_16;
Ritor1
parents:
diff changeset
873 }
Ritor1
parents:
diff changeset
874 v14 = a4 + v9;
Ritor1
parents:
diff changeset
875 v15 = 2 * v7 + 30;
Ritor1
parents:
diff changeset
876 }
Ritor1
parents:
diff changeset
877 v13 = __OFSUB__(v14, v15);
Ritor1
parents:
diff changeset
878 v12 = v14 - v15 < 0;
Ritor1
parents:
diff changeset
879 LABEL_16:
Ritor1
parents:
diff changeset
880 if ( v12 ^ v13 )
Ritor1
parents:
diff changeset
881 result = 0;
Ritor1
parents:
diff changeset
882 else
Ritor1
parents:
diff changeset
883 result = 1;
Ritor1
parents:
diff changeset
884 return result;
Ritor1
parents:
diff changeset
885 }
Ritor1
parents:
diff changeset
886
Ritor1
parents:
diff changeset
887 //----- (004273BB) --------------------------------------------------------
Ritor1
parents:
diff changeset
888 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4)
Ritor1
parents:
diff changeset
889 {
Ritor1
parents:
diff changeset
890 Actor *v5; // ecx@1
Ritor1
parents:
diff changeset
891 signed int v6; // ebx@1
Ritor1
parents:
diff changeset
892 signed int v7; // esi@1
Ritor1
parents:
diff changeset
893 unsigned __int8 v8; // zf@1
Ritor1
parents:
diff changeset
894 unsigned __int8 v9; // sf@1
Ritor1
parents:
diff changeset
895 int v10; // ebx@10
Ritor1
parents:
diff changeset
896 signed int a2a; // [sp+18h] [bp+Ch]@1
Ritor1
parents:
diff changeset
897
Ritor1
parents:
diff changeset
898 v5 = a2;
Ritor1
parents:
diff changeset
899 v6 = a2->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
900 v7 = 0;
Ritor1
parents:
diff changeset
901 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0;
Ritor1
parents:
diff changeset
902 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0;
Ritor1
parents:
diff changeset
903 a2a = 0;
Ritor1
parents:
diff changeset
904 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) )
Ritor1
parents:
diff changeset
905 v6 /= 2;
Ritor1
parents:
diff changeset
906 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
907 v7 = v5->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
908 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 )
Ritor1
parents:
diff changeset
909 v7 = v5->pActorBuffs[16].uPower;
Ritor1
parents:
diff changeset
910 v10 = v7 + v6;
Ritor1
parents:
diff changeset
911 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
912 a2a = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
913 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a )
Ritor1
parents:
diff changeset
914 a2a = pActor->pActorBuffs[17].uPower;
Ritor1
parents:
diff changeset
915 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
916 {
Ritor1
parents:
diff changeset
917 a2a += pActor->pActorBuffs[11].uPower;
Ritor1
parents:
diff changeset
918 pActor->pActorBuffs[11].Reset();
Ritor1
parents:
diff changeset
919 }
Ritor1
parents:
diff changeset
920 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5;
Ritor1
parents:
diff changeset
921 }
Ritor1
parents:
diff changeset
922
Ritor1
parents:
diff changeset
923 //----- (004274AD) --------------------------------------------------------
Ritor1
parents:
diff changeset
924 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer)
Ritor1
parents:
diff changeset
925 {
Ritor1
parents:
diff changeset
926 signed int v3; // edi@1
Ritor1
parents:
diff changeset
927 signed int v4; // esi@8
Ritor1
parents:
diff changeset
928 int v5; // esi@8
Ritor1
parents:
diff changeset
929
Ritor1
parents:
diff changeset
930 v3 = 0;
Ritor1
parents:
diff changeset
931 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
932 v3 = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
933 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 )
Ritor1
parents:
diff changeset
934 v3 = pActor->pActorBuffs[17].uPower;
Ritor1
parents:
diff changeset
935 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
936 {
Ritor1
parents:
diff changeset
937 v3 += pActor->pActorBuffs[11].uPower;
Ritor1
parents:
diff changeset
938 pActor->pActorBuffs[11].Reset();
Ritor1
parents:
diff changeset
939 }
Ritor1
parents:
diff changeset
940 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10;
Ritor1
parents:
diff changeset
941 v5 = rand() % v4 + 1;
Ritor1
parents:
diff changeset
942 return v3 + v5 > pPlayer->GetActualAC() + 5;
Ritor1
parents:
diff changeset
943 }
Ritor1
parents:
diff changeset
944
Ritor1
parents:
diff changeset
945 //----- (00427546) --------------------------------------------------------
Ritor1
parents:
diff changeset
946 int stru319::_427546(int a2)
Ritor1
parents:
diff changeset
947 {
Ritor1
parents:
diff changeset
948 int result; // eax@2
Ritor1
parents:
diff changeset
949
Ritor1
parents:
diff changeset
950 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
951 {
Ritor1
parents:
diff changeset
952 if ( a2 >= 1 )
Ritor1
parents:
diff changeset
953 result = (a2 >= 2) + 2;
Ritor1
parents:
diff changeset
954 else
Ritor1
parents:
diff changeset
955 result = 1;
Ritor1
parents:
diff changeset
956 }
Ritor1
parents:
diff changeset
957 else
Ritor1
parents:
diff changeset
958 {
Ritor1
parents:
diff changeset
959 result = 0;
Ritor1
parents:
diff changeset
960 }
Ritor1
parents:
diff changeset
961 return result;
Ritor1
parents:
diff changeset
962 }
Ritor1
parents:
diff changeset
963
Ritor1
parents:
diff changeset
964 //----- (0042756B) --------------------------------------------------------
Ritor1
parents:
diff changeset
965 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3)
Ritor1
parents:
diff changeset
966 {
Ritor1
parents:
diff changeset
967 int v4; // edx@1
Ritor1
parents:
diff changeset
968 int v5; // ecx@1
Ritor1
parents:
diff changeset
969 signed int v6; // eax@4
Ritor1
parents:
diff changeset
970 signed int result; // eax@17
Ritor1
parents:
diff changeset
971 signed int v8; // esi@18
Ritor1
parents:
diff changeset
972
Ritor1
parents:
diff changeset
973 v4 = 0;
Ritor1
parents:
diff changeset
974 v5 = 0;
Ritor1
parents:
diff changeset
975 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
976 v5 = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
977 switch ( a2 )
Ritor1
parents:
diff changeset
978 {
Ritor1
parents:
diff changeset
979 case 4:
Ritor1
parents:
diff changeset
980 v6 = pActor->pMonsterInfo.uResPhysical;
Ritor1
parents:
diff changeset
981 break;
Ritor1
parents:
diff changeset
982 case 0:
Ritor1
parents:
diff changeset
983 v6 = pActor->pMonsterInfo.uResFire;
Ritor1
parents:
diff changeset
984 goto LABEL_12;
Ritor1
parents:
diff changeset
985 case 1:
Ritor1
parents:
diff changeset
986 v6 = pActor->pMonsterInfo.uResAir;
Ritor1
parents:
diff changeset
987 goto LABEL_12;
Ritor1
parents:
diff changeset
988 case 2:
Ritor1
parents:
diff changeset
989 v6 = pActor->pMonsterInfo.uResWater;
Ritor1
parents:
diff changeset
990 goto LABEL_12;
Ritor1
parents:
diff changeset
991 case 3:
Ritor1
parents:
diff changeset
992 v6 = pActor->pMonsterInfo.uResEarth;
Ritor1
parents:
diff changeset
993 goto LABEL_12;
Ritor1
parents:
diff changeset
994 case 6:
Ritor1
parents:
diff changeset
995 v6 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
996 break;
Ritor1
parents:
diff changeset
997 case 7:
Ritor1
parents:
diff changeset
998 v6 = pActor->pMonsterInfo.uResMind;
Ritor1
parents:
diff changeset
999 goto LABEL_12;
Ritor1
parents:
diff changeset
1000 case 8:
Ritor1
parents:
diff changeset
1001 v6 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
1002 LABEL_12:
Ritor1
parents:
diff changeset
1003 v4 = v5;
Ritor1
parents:
diff changeset
1004 break;
Ritor1
parents:
diff changeset
1005 case 9:
Ritor1
parents:
diff changeset
1006 v6 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
1007 break;
Ritor1
parents:
diff changeset
1008 case 10:
Ritor1
parents:
diff changeset
1009 v6 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
1010 break;
Ritor1
parents:
diff changeset
1011 default:
Ritor1
parents:
diff changeset
1012 v6 = 0;
Ritor1
parents:
diff changeset
1013 break;
Ritor1
parents:
diff changeset
1014 }
Ritor1
parents:
diff changeset
1015 if ( v6 < 200 )
Ritor1
parents:
diff changeset
1016 {
Ritor1
parents:
diff changeset
1017 v8 = v4 + v6 + 30;
Ritor1
parents:
diff changeset
1018 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1019 {
Ritor1
parents:
diff changeset
1020 a3 >>= 1;
Ritor1
parents:
diff changeset
1021 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1022 {
Ritor1
parents:
diff changeset
1023 a3 >>= 1;
Ritor1
parents:
diff changeset
1024 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1025 {
Ritor1
parents:
diff changeset
1026 a3 >>= 1;
Ritor1
parents:
diff changeset
1027 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1028 a3 >>= 1;
Ritor1
parents:
diff changeset
1029 }
Ritor1
parents:
diff changeset
1030 }
Ritor1
parents:
diff changeset
1031 }
Ritor1
parents:
diff changeset
1032 result = a3;
Ritor1
parents:
diff changeset
1033 }
Ritor1
parents:
diff changeset
1034 else
Ritor1
parents:
diff changeset
1035 {
Ritor1
parents:
diff changeset
1036 result = 0;
Ritor1
parents:
diff changeset
1037 }
Ritor1
parents:
diff changeset
1038 return result;
Ritor1
parents:
diff changeset
1039 }
Ritor1
parents:
diff changeset
1040
Ritor1
parents:
diff changeset
1041 //----- (00427662) --------------------------------------------------------
Ritor1
parents:
diff changeset
1042 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType)
Ritor1
parents:
diff changeset
1043 {
Ritor1
parents:
diff changeset
1044 Actor *v3; // edi@2
Ritor1
parents:
diff changeset
1045 signed int v4; // esi@2
Ritor1
parents:
diff changeset
1046 bool result; // eax@13
Ritor1
parents:
diff changeset
1047
Ritor1
parents:
diff changeset
1048 switch ( uType )
Ritor1
parents:
diff changeset
1049 {
Ritor1
parents:
diff changeset
1050 case 0u:
Ritor1
parents:
diff changeset
1051 v3 = pActor;
Ritor1
parents:
diff changeset
1052 v4 = pActor->pMonsterInfo.uResFire;
Ritor1
parents:
diff changeset
1053 goto LABEL_12;
Ritor1
parents:
diff changeset
1054 case 1u:
Ritor1
parents:
diff changeset
1055 v3 = pActor;
Ritor1
parents:
diff changeset
1056 v4 = pActor->pMonsterInfo.uResAir;
Ritor1
parents:
diff changeset
1057 goto LABEL_12;
Ritor1
parents:
diff changeset
1058 case 2u:
Ritor1
parents:
diff changeset
1059 v3 = pActor;
Ritor1
parents:
diff changeset
1060 v4 = pActor->pMonsterInfo.uResWater;
Ritor1
parents:
diff changeset
1061 goto LABEL_12;
Ritor1
parents:
diff changeset
1062 case 3u:
Ritor1
parents:
diff changeset
1063 v3 = pActor;
Ritor1
parents:
diff changeset
1064 v4 = pActor->pMonsterInfo.uResEarth;
Ritor1
parents:
diff changeset
1065 goto LABEL_12;
Ritor1
parents:
diff changeset
1066 case 7u:
Ritor1
parents:
diff changeset
1067 v3 = pActor;
Ritor1
parents:
diff changeset
1068 v4 = pActor->pMonsterInfo.uResMind;
Ritor1
parents:
diff changeset
1069 goto LABEL_12;
Ritor1
parents:
diff changeset
1070 case 6u:
Ritor1
parents:
diff changeset
1071 v3 = pActor;
Ritor1
parents:
diff changeset
1072 v4 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
1073 goto LABEL_12;
Ritor1
parents:
diff changeset
1074 case 8u:
Ritor1
parents:
diff changeset
1075 v3 = pActor;
Ritor1
parents:
diff changeset
1076 v4 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
1077 goto LABEL_12;
Ritor1
parents:
diff changeset
1078 case 9u:
Ritor1
parents:
diff changeset
1079 v3 = pActor;
Ritor1
parents:
diff changeset
1080 v4 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
1081 goto LABEL_12;
Ritor1
parents:
diff changeset
1082 case 0xAu:
Ritor1
parents:
diff changeset
1083 v3 = pActor;
Ritor1
parents:
diff changeset
1084 v4 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
1085 goto LABEL_12;
Ritor1
parents:
diff changeset
1086 case 4u:
Ritor1
parents:
diff changeset
1087 v3 = pActor;
Ritor1
parents:
diff changeset
1088 v4 = pActor->pMonsterInfo.uResPhysical;
Ritor1
parents:
diff changeset
1089 LABEL_12:
Ritor1
parents:
diff changeset
1090 if ( v4 < 200 )
Ritor1
parents:
diff changeset
1091 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30;
Ritor1
parents:
diff changeset
1092 else
Ritor1
parents:
diff changeset
1093 result = 0;
Ritor1
parents:
diff changeset
1094 break;
Ritor1
parents:
diff changeset
1095 default:
Ritor1
parents:
diff changeset
1096 result = 1;
Ritor1
parents:
diff changeset
1097 break;
Ritor1
parents:
diff changeset
1098 }
Ritor1
parents:
diff changeset
1099 return result;
Ritor1
parents:
diff changeset
1100 }
Ritor1
parents:
diff changeset
1101
Ritor1
parents:
diff changeset
1102 //----- (0042EB8D) --------------------------------------------------------
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1103 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
0
Ritor1
parents:
diff changeset
1104 {
482
9898e6b413d8 some debug stuff commented
Nomad
parents: 469
diff changeset
1105 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line);
0
Ritor1
parents:
diff changeset
1106 if (uNumMessages < 40)
Ritor1
parents:
diff changeset
1107 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1108 files[uNumMessages] = file;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1109 lines[uNumMessages] = line;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1110
0
Ritor1
parents:
diff changeset
1111 pMessages[uNumMessages].eType = msg;
Ritor1
parents:
diff changeset
1112 pMessages[uNumMessages].param = param;
Ritor1
parents:
diff changeset
1113 pMessages[uNumMessages++].field_8 = a4;
Ritor1
parents:
diff changeset
1114 }
Ritor1
parents:
diff changeset
1115 }
Ritor1
parents:
diff changeset
1116
Ritor1
parents:
diff changeset
1117 //----- (0042EBBE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1118 int __fastcall sub_42EBBE(int a1, int a2)
Ritor1
parents:
diff changeset
1119 {
Ritor1
parents:
diff changeset
1120 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16;
Ritor1
parents:
diff changeset
1121 }
Ritor1
parents:
diff changeset
1122 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int);
Ritor1
parents:
diff changeset
1123
Ritor1
parents:
diff changeset
1124 //----- (0042EBDB) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
1125 int stru193_math::Sin(int angle)
0
Ritor1
parents:
diff changeset
1126 {
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
1127 return Cos(angle - this->uIntegerHalfPi);
0
Ritor1
parents:
diff changeset
1128 }
Ritor1
parents:
diff changeset
1129
Ritor1
parents:
diff changeset
1130 //----- (0042ECB5) --------------------------------------------------------
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1131 void _42ECB5_PlayerAttacksActor()
0
Ritor1
parents:
diff changeset
1132 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1133 //unsigned int v0; // ebx@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1134 //Player *v1; // esi@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1135 //bool result; // eax@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1136 //int v3; // edi@2
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1137 //unsigned int v4; // eax@7
0
Ritor1
parents:
diff changeset
1138 char *v5; // eax@8
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1139 //int v6; // ecx@9
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1140 //signed int v7; // eax@16
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1141 //Actor *v8; // edi@20
0
Ritor1
parents:
diff changeset
1142 unsigned int v9; // ecx@21
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1143 //char *v10; // eax@26
0
Ritor1
parents:
diff changeset
1144 char *v11; // eax@26
Ritor1
parents:
diff changeset
1145 unsigned int v12; // eax@47
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1146 //char *v13; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1147 //char *v14; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1148 //unsigned int v15; // ebx@54
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1149 //int v16; // [sp-10h] [bp-4Ch]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1150 //int v17; // [sp-10h] [bp-4Ch]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1151 //unsigned int v18; // [sp-Ch] [bp-48h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1152 //unsigned int v19; // [sp-Ch] [bp-48h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1153 //__int16 v20; // [sp-8h] [bp-44h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1154 //__int16 v21; // [sp-8h] [bp-44h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1155 //int v22; // [sp-4h] [bp-40h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1156 //int v23; // [sp-4h] [bp-40h]@44
0
Ritor1
parents:
diff changeset
1157 SoundID v24; // [sp-4h] [bp-40h]@58
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1158 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1159 //unsigned int a2; // [sp+18h] [bp-24h]@20
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1160 //unsigned int v27; // [sp+1Ch] [bp-20h]@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1161 //int v28; // [sp+20h] [bp-1Ch]@9
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1162 //unsigned int *v28b;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1163 //int v29; // [sp+24h] [bp-18h]@16
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1164 //int v30; // [sp+28h] [bp-14h]@16
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1165 //int v31; // [sp+2Ch] [bp-10h]@4
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1166 //int v32; // [sp+30h] [bp-Ch]@7
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1167 //int v33; // [sp+34h] [bp-8h]@7
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1168 //int v34; // [sp+38h] [bp-4h]@17
0
Ritor1
parents:
diff changeset
1169
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1170 //v0 = uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1171 //v27 = 6972 * uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1172 //v1 = &pParty->pPlayers[uActiveCharacter-1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1173 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1174 auto player = &pParty->pPlayers[uActiveCharacter - 1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1175 if (!player->CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1176 return;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1177
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
1178 pCastSpellInfo.data()->_427D48(uActiveCharacter);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1179 //v3 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1180 if (pParty->Invisible())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1181 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1182
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1183 //v31 = player->pEquipment.uBow;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1184 int bow_idx = player->pEquipment.uBow;
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1340
diff changeset
1185 if (bow_idx && player->pInventoryItemList[bow_idx - 1].Broken())
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1186 bow_idx = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1187
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1188 //v32 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1189 int wand_item_id = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1190 //v33 = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1191 //v4 = v1->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1192 int laser_weapon_item_id = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1193
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1194 int main_hand_idx = player->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1195 if (main_hand_idx)
0
Ritor1
parents:
diff changeset
1196 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1340
diff changeset
1197 auto item = &player->pInventoryItemList[main_hand_idx - 1];
112
909822c91d47 pointer fixes
zipi
parents: 90
diff changeset
1198 //v5 = (char *)v1 + 36 * v4;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1199 if (!item->Broken())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1200 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1201 //v28b = &v1->pInventoryItems[v4].uItemID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1202 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1203 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND)
0
Ritor1
parents:
diff changeset
1204 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1205 if (item->uNumCharges <= 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1206 player->pEquipment.uMainHand = 0; // wand discharged - unequip
0
Ritor1
parents:
diff changeset
1207 else
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1208 wand_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
1209 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1210 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1211 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
1212 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1213 }
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1214
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1215 //v30 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1216 //v29 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1217 //v28 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1218 //v7 = pMouse->uPointingObjectID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1219
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1220 int target_pid = pMouse->uPointingObjectID;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
1221 int target_type = PID_TYPE(target_pid),
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
1222 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1223 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1224 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1225 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
1226 target_type = PID_TYPE(target_pid);
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
1227 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1228 }
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1229
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1230 auto actor = &pActors[target_id];
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1231 int actor_distance = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1232 if (target_type == OBJECT_Actor)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1233 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1234 int distance_x = actor->vPosition.x - pParty->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1235 distance_y = actor->vPosition.y - pParty->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1236 distance_z = actor->vPosition.z - pParty->vPosition.z;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1237 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
1238 if (actor_distance < 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1239 actor_distance = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1240 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1241
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1242 bool shooting_bow = false,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1243 shotting_laser = false,
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1244 shooting_wand = false,
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1245 melee_attack = false;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1246 if (laser_weapon_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1247 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1248 shotting_laser = true;
490
Nomad
parents: 488
diff changeset
1249 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1250 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1251 else if (wand_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1252 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1253 shooting_wand = true;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1254
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1255 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
1256 _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
1257
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1340
diff changeset
1258 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1259 player->pEquipment.uMainHand = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1260 }
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1261 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1262 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1263 melee_attack = true;
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1264
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1265 Vec3_int_ a3;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1266 a3.x = actor->vPosition.x - pParty->vPosition.x;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1267 a3.y = actor->vPosition.y - pParty->vPosition.y;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1268 a3.z = actor->vPosition.z - pParty->vPosition.z;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1269 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1270
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1271 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1052
diff changeset
1272 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1273 _42FA66_do_explosive_impact(
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1274 actor->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1275 actor->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1276 actor->vPosition.z + actor->uActorHeight / 2,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1277 0, 512, uActiveCharacter);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1278 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1279 else if (bow_idx)
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1280 {
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1281 shooting_bow = true;
490
Nomad
parents: 488
diff changeset
1282 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1283 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1284 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1285 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1286 melee_attack = true;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1287 ; // actor out of range or no actor; no ranged weapon so melee attacking air
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1288 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1289
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1290 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1291 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1292 int recovery = player->GetAttackRecoveryTime(false);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1293 if (recovery < 30 )
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
1294 recovery = 30;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1295 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1296 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1297
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1298
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1299 int v34 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1300 if (shooting_wand)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1301 return;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1302 else if (shooting_bow)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1303 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1304 v34 = 5;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1305 player->PlaySound(SPEECH_50, 0);
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1306 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1307 if (shotting_laser)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1308 v34 = 7;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1309 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1310 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1311 int main_hand_idx = player->pEquipment.uMainHand;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
1312 if (player->HasItemEquipped(EQUIP_MAIN_HAND))
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1340
diff changeset
1313 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItemList[main_hand_idx - 1]].uSkillType;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1314 pTurnEngine->_40471C();
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1315 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1316
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1317 switch (v34)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1318 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1319 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1320 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1321 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1322 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1323 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1324 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1325 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1326 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1327 }
0
Ritor1
parents:
diff changeset
1328 }
Ritor1
parents:
diff changeset
1329
Ritor1
parents:
diff changeset
1330 //----- (0042F184) --------------------------------------------------------
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1331 int stru319::FindClosestActor(int pick_depth, int a3, int a4)
0
Ritor1
parents:
diff changeset
1332 {
Ritor1
parents:
diff changeset
1333 int v4; // edi@1
Ritor1
parents:
diff changeset
1334 stru319 *v5; // esi@1
Ritor1
parents:
diff changeset
1335 int v6; // eax@2
Ritor1
parents:
diff changeset
1336 int v7; // eax@4
Ritor1
parents:
diff changeset
1337 int result; // eax@5
Ritor1
parents:
diff changeset
1338 int *v9; // edx@8
Ritor1
parents:
diff changeset
1339 signed int v10; // ebx@10
Ritor1
parents:
diff changeset
1340 int v11; // edi@11
Ritor1
parents:
diff changeset
1341 Actor *v12; // esi@12
Ritor1
parents:
diff changeset
1342 unsigned __int16 v13; // ax@12
Ritor1
parents:
diff changeset
1343 int v14; // eax@22
Ritor1
parents:
diff changeset
1344 char v15; // zf@30
Ritor1
parents:
diff changeset
1345 int v16; // esi@32
Ritor1
parents:
diff changeset
1346 int v17; // ecx@34
Ritor1
parents:
diff changeset
1347 stru319 *v18; // eax@39
Ritor1
parents:
diff changeset
1348 int v19; // edx@39
Ritor1
parents:
diff changeset
1349 int v20; // ecx@41
Ritor1
parents:
diff changeset
1350 unsigned __int16 v21; // ax@42
Ritor1
parents:
diff changeset
1351 unsigned int v22; // [sp+8h] [bp-24h]@11
Ritor1
parents:
diff changeset
1352 unsigned int v23; // [sp+Ch] [bp-20h]@7
Ritor1
parents:
diff changeset
1353 stru319 *v24; // [sp+10h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
1354 unsigned int v25; // [sp+14h] [bp-18h]@8
Ritor1
parents:
diff changeset
1355 int *v26; // [sp+18h] [bp-14h]@8
Ritor1
parents:
diff changeset
1356 int v27; // [sp+1Ch] [bp-10h]@10
Ritor1
parents:
diff changeset
1357 int *v28; // [sp+20h] [bp-Ch]@10
Ritor1
parents:
diff changeset
1358 unsigned int v29; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
1359 int v30; // [sp+28h] [bp-4h]@6
Ritor1
parents:
diff changeset
1360 int i; // [sp+38h] [bp+Ch]@33
Ritor1
parents:
diff changeset
1361 signed int v32; // [sp+3Ch] [bp+10h]@32
Ritor1
parents:
diff changeset
1362
Ritor1
parents:
diff changeset
1363 v4 = 0;
Ritor1
parents:
diff changeset
1364 v5 = this;
Ritor1
parents:
diff changeset
1365 v24 = this;
Ritor1
parents:
diff changeset
1366 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
1367 {
Ritor1
parents:
diff changeset
1368 v6 = a3 != 0;
Ritor1
parents:
diff changeset
1369 if ( a4 )
Ritor1
parents:
diff changeset
1370 LOBYTE(v6) = v6 | 8;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1371 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
0
Ritor1
parents:
diff changeset
1372 if ( v7 != -1 )
Ritor1
parents:
diff changeset
1373 return (unsigned __int16)v7;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1374 else return 0;
0
Ritor1
parents:
diff changeset
1375 }
Ritor1
parents:
diff changeset
1376 else
Ritor1
parents:
diff changeset
1377 {
Ritor1
parents:
diff changeset
1378 v30 = 0;
Ritor1
parents:
diff changeset
1379 if ( pRenderer->pActiveZBuffer )
Ritor1
parents:
diff changeset
1380 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
1381 v29 = viewparams->uScreen_topL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
1382 v23 = viewparams->uScreen_BttmR_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
1383 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
0
Ritor1
parents:
diff changeset
1384 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
1385 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
1386 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
1387 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
0
Ritor1
parents:
diff changeset
1388 do
Ritor1
parents:
diff changeset
1389 {
Ritor1
parents:
diff changeset
1390 if ( (signed int)v29 < (signed int)v23 )
Ritor1
parents:
diff changeset
1391 {
Ritor1
parents:
diff changeset
1392 v28 = v9;
Ritor1
parents:
diff changeset
1393 v10 = v4;
Ritor1
parents:
diff changeset
1394 v27 = v23 - v29;
Ritor1
parents:
diff changeset
1395 do
Ritor1
parents:
diff changeset
1396 {
Ritor1
parents:
diff changeset
1397 v22 = *v28;
Ritor1
parents:
diff changeset
1398 v11 = *v28 & 0xFFFF;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1399 if (PID_TYPE(v11) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
1400 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1401 v12 = &pActors[PID_ID(v11)];
0
Ritor1
parents:
diff changeset
1402 v13 = v12->uAIState;
Ritor1
parents:
diff changeset
1403 if ( v13 != 5 )
Ritor1
parents:
diff changeset
1404 {
Ritor1
parents:
diff changeset
1405 if ( v13 != 4
Ritor1
parents:
diff changeset
1406 && v13 != 11
Ritor1
parents:
diff changeset
1407 && v13 != 19
Ritor1
parents:
diff changeset
1408 && v13 != 17
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1409 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) )
0
Ritor1
parents:
diff changeset
1410 {
Ritor1
parents:
diff changeset
1411 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
1412 && v22 <= pick_depth << 16 )
0
Ritor1
parents:
diff changeset
1413 {
Ritor1
parents:
diff changeset
1414 v14 = 0;
Ritor1
parents:
diff changeset
1415 if ( v10 > 0 )
Ritor1
parents:
diff changeset
1416 {
Ritor1
parents:
diff changeset
1417 do
Ritor1
parents:
diff changeset
1418 {
Ritor1
parents:
diff changeset
1419 if ( dword_50BDA0[v14] == v11 )
Ritor1
parents:
diff changeset
1420 break;
Ritor1
parents:
diff changeset
1421 ++v14;
Ritor1
parents:
diff changeset
1422 }
Ritor1
parents:
diff changeset
1423 while ( v14 < v30 );
Ritor1
parents:
diff changeset
1424 }
Ritor1
parents:
diff changeset
1425 if ( v14 == v30 && v10 < 100 )
Ritor1
parents:
diff changeset
1426 {
Ritor1
parents:
diff changeset
1427 ++v30;
Ritor1
parents:
diff changeset
1428 dword_50BC10[v10] = v22;
Ritor1
parents:
diff changeset
1429 dword_50BDA0[v10] = v11;
Ritor1
parents:
diff changeset
1430 ++v10;
Ritor1
parents:
diff changeset
1431 }
Ritor1
parents:
diff changeset
1432 }
Ritor1
parents:
diff changeset
1433 }
Ritor1
parents:
diff changeset
1434 }
Ritor1
parents:
diff changeset
1435 }
Ritor1
parents:
diff changeset
1436 ++v28;
Ritor1
parents:
diff changeset
1437 --v27;
Ritor1
parents:
diff changeset
1438 }
Ritor1
parents:
diff changeset
1439 while ( v27 );
Ritor1
parents:
diff changeset
1440 v4 = v30;
Ritor1
parents:
diff changeset
1441 v5 = v24;
Ritor1
parents:
diff changeset
1442 }
Ritor1
parents:
diff changeset
1443 v9 = v26 + 640;
Ritor1
parents:
diff changeset
1444 v15 = v25-- == 1;
Ritor1
parents:
diff changeset
1445 v26 += 640;
Ritor1
parents:
diff changeset
1446 }
Ritor1
parents:
diff changeset
1447 while ( !v15 );
Ritor1
parents:
diff changeset
1448 }
Ritor1
parents:
diff changeset
1449 if ( v4 > 0 )
Ritor1
parents:
diff changeset
1450 {
Ritor1
parents:
diff changeset
1451 v32 = 1;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1452 v16 = (int)dword_50BC10.data();
0
Ritor1
parents:
diff changeset
1453 do
Ritor1
parents:
diff changeset
1454 {
Ritor1
parents:
diff changeset
1455 for ( i = v32; i < v4; ++i )
Ritor1
parents:
diff changeset
1456 {
Ritor1
parents:
diff changeset
1457 v17 = dword_50BC10[i];
Ritor1
parents:
diff changeset
1458 if ( v17 < *(int *)v16 )
Ritor1
parents:
diff changeset
1459 {
Ritor1
parents:
diff changeset
1460 dword_50BC10[i] = *(int *)v16;
Ritor1
parents:
diff changeset
1461 *(int *)v16 = v17;
Ritor1
parents:
diff changeset
1462 }
Ritor1
parents:
diff changeset
1463 }
Ritor1
parents:
diff changeset
1464 ++v32;
Ritor1
parents:
diff changeset
1465 v16 += 4;
Ritor1
parents:
diff changeset
1466 }
Ritor1
parents:
diff changeset
1467 while ( v32 - 1 < v4 );
Ritor1
parents:
diff changeset
1468 v5 = v24;
Ritor1
parents:
diff changeset
1469 if ( v4 > 0 )
Ritor1
parents:
diff changeset
1470 {
Ritor1
parents:
diff changeset
1471 v18 = v24;
Ritor1
parents:
diff changeset
1472 v19 = v4;
Ritor1
parents:
diff changeset
1473 do
Ritor1
parents:
diff changeset
1474 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1475 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF;
0
Ritor1
parents:
diff changeset
1476 v18 += 4;
Ritor1
parents:
diff changeset
1477 --v19;
Ritor1
parents:
diff changeset
1478 }
Ritor1
parents:
diff changeset
1479 while ( v19 );
Ritor1
parents:
diff changeset
1480 }
Ritor1
parents:
diff changeset
1481 }
Ritor1
parents:
diff changeset
1482 v20 = 0;
Ritor1
parents:
diff changeset
1483 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 )
Ritor1
parents:
diff changeset
1484 {
Ritor1
parents:
diff changeset
1485 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState;
Ritor1
parents:
diff changeset
1486 if ( v21 != 4 && v21 != 5 )
Ritor1
parents:
diff changeset
1487 break;
Ritor1
parents:
diff changeset
1488 }
Ritor1
parents:
diff changeset
1489 if ( v20 != v4 )
Ritor1
parents:
diff changeset
1490 {
Ritor1
parents:
diff changeset
1491 result = 8 * *(int *)&v5[4 * v20].field_0;
Ritor1
parents:
diff changeset
1492 LOBYTE(result) = result | 3;
Ritor1
parents:
diff changeset
1493 return result;
Ritor1
parents:
diff changeset
1494 }
Ritor1
parents:
diff changeset
1495 }
Ritor1
parents:
diff changeset
1496 }
Ritor1
parents:
diff changeset
1497 return 0;
Ritor1
parents:
diff changeset
1498 }
Ritor1
parents:
diff changeset
1499
Ritor1
parents:
diff changeset
1500 //----- (0042F3D6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1501 void InitializeTurnBasedAnimations(void *_this)
Ritor1
parents:
diff changeset
1502 {
Ritor1
parents:
diff changeset
1503 unsigned int *v1; // edi@1
Ritor1
parents:
diff changeset
1504
Ritor1
parents:
diff changeset
1505 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0");
Ritor1
parents:
diff changeset
1506 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1");
Ritor1
parents:
diff changeset
1507 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2");
Ritor1
parents:
diff changeset
1508 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3");
Ritor1
parents:
diff changeset
1509 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4");
Ritor1
parents:
diff changeset
1510 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
Ritor1
parents:
diff changeset
1511 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
Ritor1
parents:
diff changeset
1512 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
Ritor1
parents:
diff changeset
1513 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
Ritor1
parents:
diff changeset
1514 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1515 v1 = pIconIDs_Turn.data();
0
Ritor1
parents:
diff changeset
1516 do
Ritor1
parents:
diff changeset
1517 {
Ritor1
parents:
diff changeset
1518 pIconsFrameTable->InitializeAnimation(*v1);
Ritor1
parents:
diff changeset
1519 ++v1;
Ritor1
parents:
diff changeset
1520 }
Ritor1
parents:
diff changeset
1521 while ( (signed int)v1 < (signed int)&uIconID_TurnStop );
Ritor1
parents:
diff changeset
1522 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
Ritor1
parents:
diff changeset
1523 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
Ritor1
parents:
diff changeset
1524 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
Ritor1
parents:
diff changeset
1525 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
Ritor1
parents:
diff changeset
1526 }
Ritor1
parents:
diff changeset
1527
Ritor1
parents:
diff changeset
1528 //----- (0042F4DA) --------------------------------------------------------
Ritor1
parents:
diff changeset
1529 signed int __cdecl sub_42F4DA()
Ritor1
parents:
diff changeset
1530 {
Ritor1
parents:
diff changeset
1531 signed int v0; // edi@1
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1532 Actor *v1; // esi@4
0
Ritor1
parents:
diff changeset
1533 int v2; // ebx@5
Ritor1
parents:
diff changeset
1534 int v3; // eax@5
Ritor1
parents:
diff changeset
1535 int v4; // ebx@5
Ritor1
parents:
diff changeset
1536 unsigned int v5; // ecx@5
Ritor1
parents:
diff changeset
1537 int v6; // edx@6
Ritor1
parents:
diff changeset
1538 unsigned int v7; // edx@8
Ritor1
parents:
diff changeset
1539 unsigned int v8; // edx@10
Ritor1
parents:
diff changeset
1540 __int16 v9; // ax@12
Ritor1
parents:
diff changeset
1541 signed int result; // eax@20
Ritor1
parents:
diff changeset
1542 int v11; // [sp+Ch] [bp-10h]@5
Ritor1
parents:
diff changeset
1543 int v12; // [sp+10h] [bp-Ch]@5
Ritor1
parents:
diff changeset
1544 signed int v13; // [sp+14h] [bp-8h]@3
Ritor1
parents:
diff changeset
1545
Ritor1
parents:
diff changeset
1546 v0 = 5120;
Ritor1
parents:
diff changeset
1547 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
1548 v0 = 2560;
Ritor1
parents:
diff changeset
1549 v13 = 0;
Ritor1
parents:
diff changeset
1550 if ( (signed int)uNumActors <= 0 )
Ritor1
parents:
diff changeset
1551 {
Ritor1
parents:
diff changeset
1552 LABEL_20:
Ritor1
parents:
diff changeset
1553 result = 0;
Ritor1
parents:
diff changeset
1554 }
Ritor1
parents:
diff changeset
1555 else
Ritor1
parents:
diff changeset
1556 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
1557 v1 = pActors.data();
0
Ritor1
parents:
diff changeset
1558 while ( 1 )
Ritor1
parents:
diff changeset
1559 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1560 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x);
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1561 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y);
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1562 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z);
0
Ritor1
parents:
diff changeset
1563 v3 = v2;
Ritor1
parents:
diff changeset
1564 v4 = v11;
Ritor1
parents:
diff changeset
1565 v5 = v12;
Ritor1
parents:
diff changeset
1566 if ( v3 < v11 )
Ritor1
parents:
diff changeset
1567 {
Ritor1
parents:
diff changeset
1568 v6 = v3;
Ritor1
parents:
diff changeset
1569 v3 = v11;
Ritor1
parents:
diff changeset
1570 v4 = v6;
Ritor1
parents:
diff changeset
1571 }
Ritor1
parents:
diff changeset
1572 if ( v3 < v12 )
Ritor1
parents:
diff changeset
1573 {
Ritor1
parents:
diff changeset
1574 v7 = v3;
Ritor1
parents:
diff changeset
1575 v3 = v12;
Ritor1
parents:
diff changeset
1576 v5 = v7;
Ritor1
parents:
diff changeset
1577 }
Ritor1
parents:
diff changeset
1578 if ( v4 < (signed int)v5 )
Ritor1
parents:
diff changeset
1579 {
Ritor1
parents:
diff changeset
1580 v8 = v5;
Ritor1
parents:
diff changeset
1581 v5 = v4;
Ritor1
parents:
diff changeset
1582 v4 = v8;
Ritor1
parents:
diff changeset
1583 }
Ritor1
parents:
diff changeset
1584 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 )
Ritor1
parents:
diff changeset
1585 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1586 v9 = v1->uAIState;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1587 if ( v1->uAIState != 5 )
0
Ritor1
parents:
diff changeset
1588 {
Ritor1
parents:
diff changeset
1589 if ( v9 != 4
Ritor1
parents:
diff changeset
1590 && v9 != 11
Ritor1
parents:
diff changeset
1591 && v9 != 19
Ritor1
parents:
diff changeset
1592 && v9 != 17
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1593 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) )
0
Ritor1
parents:
diff changeset
1594 break;
Ritor1
parents:
diff changeset
1595 }
Ritor1
parents:
diff changeset
1596 }
Ritor1
parents:
diff changeset
1597 ++v13;
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
1598 ++v1;
0
Ritor1
parents:
diff changeset
1599 if ( v13 >= (signed int)uNumActors )
Ritor1
parents:
diff changeset
1600 goto LABEL_20;
Ritor1
parents:
diff changeset
1601 }
Ritor1
parents:
diff changeset
1602 result = 1;
Ritor1
parents:
diff changeset
1603 }
Ritor1
parents:
diff changeset
1604 return result;
Ritor1
parents:
diff changeset
1605 }
Ritor1
parents:
diff changeset
1606
Ritor1
parents:
diff changeset
1607 //----- (0042F7EB) --------------------------------------------------------
Ritor1
parents:
diff changeset
1608 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
1609 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1610 unsigned __int16 pObjectDescID; // ax@7
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1611 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
0
Ritor1
parents:
diff changeset
1612
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1613 pSpellObject.stru_24.Reset();
0
Ritor1
parents:
diff changeset
1614 if ( a9 )
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1615 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24));
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1616 pSpellObject.spell_skill = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1617 pSpellObject.spell_level = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1618 pSpellObject.spell_id = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1619 pSpellObject.field_54 = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1620 pSpellObject.uType = uSpriteID;
0
Ritor1
parents:
diff changeset
1621 if ( (signed int)pObjectList->uNumObjects <= 0 )
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1622 pObjectDescID = 0;
0
Ritor1
parents:
diff changeset
1623 else
Ritor1
parents:
diff changeset
1624 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1625 pObjectDescID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1626 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
0
Ritor1
parents:
diff changeset
1627 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1628 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1629 pObjectDescID = i;
0
Ritor1
parents:
diff changeset
1630 }
Ritor1
parents:
diff changeset
1631 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1632 pSpellObject.uObjectDescID = pObjectDescID;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1633 pSpellObject.vPosition.x = x;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1634 pSpellObject.vPosition.y = y;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1635 pSpellObject.vPosition.z = z;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1636 pSpellObject.uSoundID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1637 pSpellObject.uAttributes = attributes;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1638 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1639 pSpellObject.uSpriteFrameID = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1640 pSpellObject.spell_caster_pid = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1641 pSpellObject.spell_target_pid = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1642 if ( !(pSpellObject.uAttributes & 0x10) )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1643 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1644 if ( pItemsTable->uAllItemsCount )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1645 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1646 for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1647 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1648 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1649 pSpellObject.stru_24.uItemID = i;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1650 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1651 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1652 }
0
Ritor1
parents:
diff changeset
1653 if ( a7 )
Ritor1
parents:
diff changeset
1654 {
Ritor1
parents:
diff changeset
1655 if ( count > 0 )
Ritor1
parents:
diff changeset
1656 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1657 for ( uint i = count; i; --i )
0
Ritor1
parents:
diff changeset
1658 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1659 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1660 pSpellObject.Create((signed __int16)pSpellObject.uFacing,
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1661 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1662
0
Ritor1
parents:
diff changeset
1663 }
Ritor1
parents:
diff changeset
1664 }
Ritor1
parents:
diff changeset
1665 }
Ritor1
parents:
diff changeset
1666 else
Ritor1
parents:
diff changeset
1667 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1668 pSpellObject.uFacing = 0;
0
Ritor1
parents:
diff changeset
1669 if ( count > 0 )
Ritor1
parents:
diff changeset
1670 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1671 for ( uint i = count; i; --i )
0
Ritor1
parents:
diff changeset
1672 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1673 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0);
0
Ritor1
parents:
diff changeset
1674 }
Ritor1
parents:
diff changeset
1675 }
Ritor1
parents:
diff changeset
1676 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1677 return true;
0
Ritor1
parents:
diff changeset
1678 }
Ritor1
parents:
diff changeset
1679
Ritor1
parents:
diff changeset
1680 //----- (0042F960) --------------------------------------------------------
Ritor1
parents:
diff changeset
1681 void __fastcall sub_42F960_create_object(int x, int y, int z)
Ritor1
parents:
diff changeset
1682 {
Ritor1
parents:
diff changeset
1683 int v3; // ebx@1
Ritor1
parents:
diff changeset
1684 int v4; // edi@1
Ritor1
parents:
diff changeset
1685 signed int v5; // edx@1
Ritor1
parents:
diff changeset
1686 char *v6; // ecx@2
Ritor1
parents:
diff changeset
1687 unsigned __int16 v7; // ax@5
Ritor1
parents:
diff changeset
1688 signed int v8; // eax@6
Ritor1
parents:
diff changeset
1689 signed int v9; // eax@7
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1690 //SpriteObject a1; // [sp+Ch] [bp-70h]@1
0
Ritor1
parents:
diff changeset
1691
Ritor1
parents:
diff changeset
1692 v3 = x;
Ritor1
parents:
diff changeset
1693 v4 = y;
Ritor1
parents:
diff changeset
1694
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1695 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
1696 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
1697 a1.stru_24.Reset();
Ritor1
parents:
diff changeset
1698
Ritor1
parents:
diff changeset
1699 v5 = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1700 a1.spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1701 a1.spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1702 a1.spell_id = 0;
0
Ritor1
parents:
diff changeset
1703 a1.field_54 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1704 a1.uType = 800;
0
Ritor1
parents:
diff changeset
1705 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
1706 {
Ritor1
parents:
diff changeset
1707 LABEL_5:
Ritor1
parents:
diff changeset
1708 v7 = 0;
Ritor1
parents:
diff changeset
1709 }
Ritor1
parents:
diff changeset
1710 else
Ritor1
parents:
diff changeset
1711 {
Ritor1
parents:
diff changeset
1712 v6 = (char *)&pObjectList->pObjects->uObjectID;
Ritor1
parents:
diff changeset
1713 while ( *(short *)v6 != 800 )
Ritor1
parents:
diff changeset
1714 {
Ritor1
parents:
diff changeset
1715 ++v5;
Ritor1
parents:
diff changeset
1716 v6 += 56;
Ritor1
parents:
diff changeset
1717 if ( v5 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
1718 goto LABEL_5;
Ritor1
parents:
diff changeset
1719 }
Ritor1
parents:
diff changeset
1720 v7 = v5;
Ritor1
parents:
diff changeset
1721 }
Ritor1
parents:
diff changeset
1722 a1.uObjectDescID = v7;
Ritor1
parents:
diff changeset
1723 a1.vPosition.x = v3;
Ritor1
parents:
diff changeset
1724 a1.vPosition.y = v4;
Ritor1
parents:
diff changeset
1725 a1.vPosition.z = z;
Ritor1
parents:
diff changeset
1726 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
1727 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
1728 a1.uSectorID = pIndoor->GetSector(v3, v4, z);
Ritor1
parents:
diff changeset
1729 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1730 a1.spell_caster_pid = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
1731 a1.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
1732 v8 = a1.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
1733 if ( v8 != -1 )
Ritor1
parents:
diff changeset
1734 {
Ritor1
parents:
diff changeset
1735 v9 = 8 * v8;
Ritor1
parents:
diff changeset
1736 LOBYTE(v9) = v9 | 2;
Ritor1
parents:
diff changeset
1737 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
1738 }
Ritor1
parents:
diff changeset
1739 }
Ritor1
parents:
diff changeset
1740
810
f5156b8c61ad savegame refactoring
Gloval
parents: 792
diff changeset
1741
0
Ritor1
parents:
diff changeset
1742
Ritor1
parents:
diff changeset
1743 //----- (0042FA66) --------------------------------------------------------
Ritor1
parents:
diff changeset
1744 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
Ritor1
parents:
diff changeset
1745 {
Ritor1
parents:
diff changeset
1746 int v6; // edi@1
Ritor1
parents:
diff changeset
1747 int v7; // esi@1
Ritor1
parents:
diff changeset
1748 char *v8; // ecx@2
Ritor1
parents:
diff changeset
1749 unsigned __int16 v9; // ax@5
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1750 //int v10; // eax@10
0
Ritor1
parents:
diff changeset
1751 signed int result; // eax@11
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1752 //__int16 v12; // ax@12
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1753 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1
0
Ritor1
parents:
diff changeset
1754 int v14; // [sp+7Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
1755
Ritor1
parents:
diff changeset
1756 v6 = a1;
Ritor1
parents:
diff changeset
1757 v7 = a2;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1758 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
1759 //SpriteObject::SpriteObject(&a1a);
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1760 a1a.uType = 600;
0
Ritor1
parents:
diff changeset
1761 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
1762
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1763 a1a.spell_id = SPELL_FIRE_FIREBALL;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1764 a1a.spell_level = 8;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1765 a1a.spell_skill = 3;
0
Ritor1
parents:
diff changeset
1766 v14 = 0;
Ritor1
parents:
diff changeset
1767 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
1768 {
Ritor1
parents:
diff changeset
1769 LABEL_5:
Ritor1
parents:
diff changeset
1770 v9 = 0;
Ritor1
parents:
diff changeset
1771 }
Ritor1
parents:
diff changeset
1772 else
Ritor1
parents:
diff changeset
1773 {
Ritor1
parents:
diff changeset
1774 v8 = (char *)&pObjectList->pObjects->uObjectID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
1775 while ( (short)a1a.uType != *(short *)v8 )
0
Ritor1
parents:
diff changeset
1776 {
Ritor1
parents:
diff changeset
1777 ++v14;
Ritor1
parents:
diff changeset
1778 v8 += 56;
Ritor1
parents:
diff changeset
1779 if ( v14 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
1780 goto LABEL_5;
Ritor1
parents:
diff changeset
1781 }
Ritor1
parents:
diff changeset
1782 v9 = v14;
Ritor1
parents:
diff changeset
1783 }
Ritor1
parents:
diff changeset
1784 a1a.uObjectDescID = v9;
Ritor1
parents:
diff changeset
1785 a1a.vPosition.x = v6;
Ritor1
parents:
diff changeset
1786 a1a.vPosition.y = v7;
Ritor1
parents:
diff changeset
1787 a1a.vPosition.z = a3;
Ritor1
parents:
diff changeset
1788 a1a.uAttributes = 0;
Ritor1
parents:
diff changeset
1789 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3);
Ritor1
parents:
diff changeset
1790 a1a.uSpriteFrameID = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
1791 a1a.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
1792 a1a.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
1793 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
1794 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
1795 if ( a6 >= 1 || a6 <= 4 )
Ritor1
parents:
diff changeset
1796 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1797 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
0
Ritor1
parents:
diff changeset
1798 }
Ritor1
parents:
diff changeset
1799 else
Ritor1
parents:
diff changeset
1800 {
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1801 a1a.spell_caster_pid = 0;
0
Ritor1
parents:
diff changeset
1802 }
Ritor1
parents:
diff changeset
1803 result = a1a.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
1804 if ( result != -1 )
Ritor1
parents:
diff changeset
1805 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
1806 result = stru_50FE08.Add(PID(OBJECT_Item, result),
0
Ritor1
parents:
diff changeset
1807 a5,
Ritor1
parents:
diff changeset
1808 SLOWORD(a1a.vPosition.x),
Ritor1
parents:
diff changeset
1809 SLOWORD(a1a.vPosition.y),
Ritor1
parents:
diff changeset
1810 SLOWORD(a1a.vPosition.z),
Ritor1
parents:
diff changeset
1811 0,
Ritor1
parents:
diff changeset
1812 0);
Ritor1
parents:
diff changeset
1813 }
Ritor1
parents:
diff changeset
1814 return result;
Ritor1
parents:
diff changeset
1815 }
Ritor1
parents:
diff changeset
1816
Ritor1
parents:
diff changeset
1817 //----- (0042FB5C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1818 bool __fastcall sub_42FB5C(signed int a1)
Ritor1
parents:
diff changeset
1819 {
Ritor1
parents:
diff changeset
1820 int v1; // ecx@3
Ritor1
parents:
diff changeset
1821 int v2; // ecx@4
Ritor1
parents:
diff changeset
1822 int v3; // ecx@5
Ritor1
parents:
diff changeset
1823 int v4; // ecx@6
Ritor1
parents:
diff changeset
1824 int v5; // ecx@7
Ritor1
parents:
diff changeset
1825 int v6; // ecx@8
Ritor1
parents:
diff changeset
1826 char v7; // zf@9
Ritor1
parents:
diff changeset
1827
Ritor1
parents:
diff changeset
1828 if ( a1 > 39 )
Ritor1
parents:
diff changeset
1829 {
Ritor1
parents:
diff changeset
1830 if ( a1 > 77 )
Ritor1
parents:
diff changeset
1831 {
Ritor1
parents:
diff changeset
1832 if ( a1 == 80 )
Ritor1
parents:
diff changeset
1833 return 0;
Ritor1
parents:
diff changeset
1834 if ( a1 > 84 )
Ritor1
parents:
diff changeset
1835 {
Ritor1
parents:
diff changeset
1836 if ( a1 <= 86 )
Ritor1
parents:
diff changeset
1837 return 0;
Ritor1
parents:
diff changeset
1838 v7 = a1 == 95;
Ritor1
parents:
diff changeset
1839 goto LABEL_20;
Ritor1
parents:
diff changeset
1840 }
Ritor1
parents:
diff changeset
1841 }
Ritor1
parents:
diff changeset
1842 else
Ritor1
parents:
diff changeset
1843 {
Ritor1
parents:
diff changeset
1844 if ( a1 == 77 )
Ritor1
parents:
diff changeset
1845 return 0;
Ritor1
parents:
diff changeset
1846 if ( a1 >= 46 )
Ritor1
parents:
diff changeset
1847 {
Ritor1
parents:
diff changeset
1848 if ( a1 <= 47 || a1 == 51 )
Ritor1
parents:
diff changeset
1849 return 0;
Ritor1
parents:
diff changeset
1850 v7 = a1 == 73;
Ritor1
parents:
diff changeset
1851 goto LABEL_20;
Ritor1
parents:
diff changeset
1852 }
Ritor1
parents:
diff changeset
1853 }
Ritor1
parents:
diff changeset
1854 return 1;
Ritor1
parents:
diff changeset
1855 }
Ritor1
parents:
diff changeset
1856 if ( a1 == 39 || (v1 = a1 - 2) == 0 )
Ritor1
parents:
diff changeset
1857 return 1;
Ritor1
parents:
diff changeset
1858 v2 = v1 - 3;
Ritor1
parents:
diff changeset
1859 if ( !v2 )
Ritor1
parents:
diff changeset
1860 return 0;
Ritor1
parents:
diff changeset
1861 v3 = v2 - 1;
Ritor1
parents:
diff changeset
1862 if ( !v3 || (v4 = v3 - 3) == 0 )
Ritor1
parents:
diff changeset
1863 return 1;
Ritor1
parents:
diff changeset
1864 v5 = v4 - 8;
Ritor1
parents:
diff changeset
1865 if ( !v5 )
Ritor1
parents:
diff changeset
1866 return 0;
Ritor1
parents:
diff changeset
1867 v6 = v5 - 1;
Ritor1
parents:
diff changeset
1868 if ( !v6 )
Ritor1
parents:
diff changeset
1869 return 1;
Ritor1
parents:
diff changeset
1870 v7 = v6 == 20;
Ritor1
parents:
diff changeset
1871 LABEL_20:
Ritor1
parents:
diff changeset
1872 if ( !v7 )
Ritor1
parents:
diff changeset
1873 return 1;
Ritor1
parents:
diff changeset
1874 return 0;
Ritor1
parents:
diff changeset
1875 }
Ritor1
parents:
diff changeset
1876
Ritor1
parents:
diff changeset
1877 //----- (0042FBDD) --------------------------------------------------------
Ritor1
parents:
diff changeset
1878 void __cdecl sub_42FBDD()
Ritor1
parents:
diff changeset
1879 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
1880 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
1881 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
Ritor1
parents:
diff changeset
1882 pRenderer->Present();
Ritor1
parents:
diff changeset
1883 }
Ritor1
parents:
diff changeset
1884
Ritor1
parents:
diff changeset
1885 //----- (0042FC15) --------------------------------------------------------
11
66319a734368 16.01.13(work)
Ritor1
parents: 0
diff changeset
1886 void __cdecl CloseWindowBackground()
0
Ritor1
parents:
diff changeset
1887 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
1888 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
1889 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
Ritor1
parents:
diff changeset
1890 pRenderer->Present();
Ritor1
parents:
diff changeset
1891 }
Ritor1
parents:
diff changeset
1892
Ritor1
parents:
diff changeset
1893 //----- (0042FC4E) --------------------------------------------------------
Ritor1
parents:
diff changeset
1894 void __cdecl ProcessInputActions()
Ritor1
parents:
diff changeset
1895 {
Ritor1
parents:
diff changeset
1896 char v4; // al@9
Ritor1
parents:
diff changeset
1897 char v8; // bl@100
Ritor1
parents:
diff changeset
1898 unsigned __int16 v9; // ax@102
Ritor1
parents:
diff changeset
1899 int v10; // eax@103
Ritor1
parents:
diff changeset
1900 char v14; // al@159
Ritor1
parents:
diff changeset
1901 unsigned int v15; // eax@168
Ritor1
parents:
diff changeset
1902 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
1903 InputAction inputAction; // [sp+0h] [bp-8h]@7
Ritor1
parents:
diff changeset
1904 int v24; // [sp+4h] [bp-4h]@87
Ritor1
parents:
diff changeset
1905
Ritor1
parents:
diff changeset
1906 pGame->pKeyboardInstance->EnterCriticalSection();
Ritor1
parents:
diff changeset
1907 auto pKeyboard = pGame->pKeyboardInstance;
Ritor1
parents:
diff changeset
1908 if (!bAlwaysRun)
Ritor1
parents:
diff changeset
1909 {
Ritor1
parents:
diff changeset
1910 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
1911 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1912 else
Ritor1
parents:
diff changeset
1913 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1914 }
Ritor1
parents:
diff changeset
1915 else
Ritor1
parents:
diff changeset
1916 {
Ritor1
parents:
diff changeset
1917 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
1918 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1919 else
Ritor1
parents:
diff changeset
1920 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
1921 }
Ritor1
parents:
diff changeset
1922
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
1923 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1924
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1925
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1926 // WUT? double event trigger
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1927 /*for ( uint i = 0; i < 30; ++i )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1928 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1929 if ( pKeyActionMap->pToggleTypes[i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1930 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1931 else
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1932 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]);
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1933 if ( v14 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1934 {
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1935 if (pCurrentScreen == SCREEN_GAME)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1936 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1937 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1938 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1939 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1940 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1941 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1942 v15 = pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1943 if ( pMessageQueue_50CBD0->uNumMessages )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1944 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1945 v15 = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1946 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1947 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1948 v15 = 1;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1949 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1950 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1951 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1952 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1953 ++pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1954 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1955 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1956 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1957 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1958 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1959 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1960 }
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
1961 }*/
0
Ritor1
parents:
diff changeset
1962 if ( !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
1963 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1964 for ( uint i = 0; i < 30; ++i )
0
Ritor1
parents:
diff changeset
1965 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1966 inputAction = (InputAction)i;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1967 if ( pKeyActionMap->pToggleTypes[(InputAction)i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1968 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
1969 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1970 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
1971 if ( v4 )
Ritor1
parents:
diff changeset
1972 {
Ritor1
parents:
diff changeset
1973 switch ( inputAction )
Ritor1
parents:
diff changeset
1974 {
Ritor1
parents:
diff changeset
1975 case INPUT_MoveForward:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1976 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
1977 break;
Ritor1
parents:
diff changeset
1978 if (!pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1979 {
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
1980 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
0
Ritor1
parents:
diff changeset
1981 partyAction = PARTY_RunForward;
Ritor1
parents:
diff changeset
1982 else
Ritor1
parents:
diff changeset
1983 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1984 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1985 break;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1986 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
1987 if (pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1988 {
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1989 pTurnEngine->uActionPointsLeft -= 26;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1990 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1991 partyAction = PARTY_RunForward;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1992 else
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1993 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
1994 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
1995 break;
0
Ritor1
parents:
diff changeset
1996 }
Ritor1
parents:
diff changeset
1997 break;
Ritor1
parents:
diff changeset
1998 case INPUT_MoveBackwards:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
1999 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2000 break;
Ritor1
parents:
diff changeset
2001 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2002 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2003 if ( pParty->uFlags2 & 2 )
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2004 partyAction = PARTY_RunBackward;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2005 else
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2006 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2007 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2008 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2009 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2010 if ( pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
0
Ritor1
parents:
diff changeset
2011 {
Ritor1
parents:
diff changeset
2012 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2013 if ( pParty->uFlags2 & 2 )
Ritor1
parents:
diff changeset
2014 partyAction = PARTY_RunBackward;
Ritor1
parents:
diff changeset
2015 else
Ritor1
parents:
diff changeset
2016 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2017 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2018 break;
0
Ritor1
parents:
diff changeset
2019 }
Ritor1
parents:
diff changeset
2020 break;
Ritor1
parents:
diff changeset
2021 case INPUT_StrafeLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2022 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2023 break;
Ritor1
parents:
diff changeset
2024 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2025 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2026 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2027 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2028 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2029 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2030 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
2031 break;
Ritor1
parents:
diff changeset
2032 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2033 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2034 pPartyActionQueue->Add(partyAction);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2035 break;
0
Ritor1
parents:
diff changeset
2036 case INPUT_StrafeRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2037 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2038 break;
Ritor1
parents:
diff changeset
2039 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2040 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2041 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2042 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2043 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2044 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2045 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
2046 break;
Ritor1
parents:
diff changeset
2047 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2048 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2049 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2050 break;
0
Ritor1
parents:
diff changeset
2051 case INPUT_TurnLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2052 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2053 break;
Ritor1
parents:
diff changeset
2054 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing
Ritor1
parents:
diff changeset
2055 {
Ritor1
parents:
diff changeset
2056 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
2057 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2058 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
2059 break;
Ritor1
parents:
diff changeset
2060 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2061 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2062 partyAction = PARTY_StrafeLeft;
0
Ritor1
parents:
diff changeset
2063 }
Ritor1
parents:
diff changeset
2064 else
Ritor1
parents:
diff changeset
2065 {
Ritor1
parents:
diff changeset
2066 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2067 partyAction = PARTY_FastTurnLeft;
0
Ritor1
parents:
diff changeset
2068 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2069 partyAction = PARTY_TurnLeft;
0
Ritor1
parents:
diff changeset
2070 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2071 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
2072 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
2073 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2074 pWeather->OnPlayerTurn(10);
0
Ritor1
parents:
diff changeset
2075 }
Ritor1
parents:
diff changeset
2076 break;
Ritor1
parents:
diff changeset
2077 case INPUT_TurnRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2078 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2079 break;
Ritor1
parents:
diff changeset
2080 if ( GetAsyncKeyState(17) ) // strafing
Ritor1
parents:
diff changeset
2081 {
Ritor1
parents:
diff changeset
2082 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
2083 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2084 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
2085 break;
Ritor1
parents:
diff changeset
2086 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2087 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2088 partyAction = PARTY_StrafeRight;
0
Ritor1
parents:
diff changeset
2089 }
Ritor1
parents:
diff changeset
2090 else
Ritor1
parents:
diff changeset
2091 {
Ritor1
parents:
diff changeset
2092 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2093 partyAction = PARTY_FastTurnRight;
0
Ritor1
parents:
diff changeset
2094 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2095 partyAction = PARTY_TurnRight;
0
Ritor1
parents:
diff changeset
2096 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2097 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
2098 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
2099 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2100 pWeather->OnPlayerTurn(-10);
0
Ritor1
parents:
diff changeset
2101 }
Ritor1
parents:
diff changeset
2102 break;
Ritor1
parents:
diff changeset
2103 case INPUT_Jump:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2104 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn)
0
Ritor1
parents:
diff changeset
2105 break;
Ritor1
parents:
diff changeset
2106 partyAction = (PartyAction)12;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2107 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2108 break;
0
Ritor1
parents:
diff changeset
2109 case INPUT_Yell:
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
2110 if (!pCurrentScreen && uActiveCharacter)
0
Ritor1
parents:
diff changeset
2111 {
Ritor1
parents:
diff changeset
2112 pParty->Yell();
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
2113 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0);
0
Ritor1
parents:
diff changeset
2114 }
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
2115 break;
0
Ritor1
parents:
diff changeset
2116 case INPUT_Pass:
Ritor1
parents:
diff changeset
2117 if ( pCurrentScreen )
Ritor1
parents:
diff changeset
2118 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2119 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2120 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
2121 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2122 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2123 }
0
Ritor1
parents:
diff changeset
2124 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
2125 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2126 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery )
0
Ritor1
parents:
diff changeset
2127 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2128 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false);
0
Ritor1
parents:
diff changeset
2129 if ( !pParty->bTurnBasedModeOn )
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2130 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333));
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
2131 pCastSpellInfo.data()->_427D48(uActiveCharacter);
0
Ritor1
parents:
diff changeset
2132 pTurnEngine->_40471C();
Ritor1
parents:
diff changeset
2133 }
Ritor1
parents:
diff changeset
2134 }
Ritor1
parents:
diff changeset
2135 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2136 case INPUT_Combat://if press ENTER
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2137 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2138 {
Ritor1
parents:
diff changeset
2139 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
2140 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2141 if (pTurnEngine->turn_stage == 3 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player)
0
Ritor1
parents:
diff changeset
2142 {
Ritor1
parents:
diff changeset
2143 pParty->bTurnBasedModeOn = 0;
Ritor1
parents:
diff changeset
2144 pTurnEngine->End(true);
Ritor1
parents:
diff changeset
2145 }
Ritor1
parents:
diff changeset
2146 }
Ritor1
parents:
diff changeset
2147 else
Ritor1
parents:
diff changeset
2148 {
Ritor1
parents:
diff changeset
2149 pTurnEngine->Start();
Ritor1
parents:
diff changeset
2150 pParty->bTurnBasedModeOn = true;
Ritor1
parents:
diff changeset
2151 }
Ritor1
parents:
diff changeset
2152 }
Ritor1
parents:
diff changeset
2153 break;
Ritor1
parents:
diff changeset
2154 case INPUT_CastReady:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2155 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2156 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2157 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2158 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
2159 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2160 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2161 }
0
Ritor1
parents:
diff changeset
2162 if ( !uActiveCharacter )
Ritor1
parents:
diff changeset
2163 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2164 v8 = pPlayers[uActiveCharacter]->uQuickSpell;
0
Ritor1
parents:
diff changeset
2165 if ( !v8
Ritor1
parents:
diff changeset
2166 || bUnderwater
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2167 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ?
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2168 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2169 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2170 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2171 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)),
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2172 v10 > pPlayers[uActiveCharacter]->sMana) )
0
Ritor1
parents:
diff changeset
2173 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2174 pPartyActionQueue = pPartyActionQueue;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2175 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2176 break;
0
Ritor1
parents:
diff changeset
2177 }
Ritor1
parents:
diff changeset
2178 else
Ritor1
parents:
diff changeset
2179 {
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2180 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
0
Ritor1
parents:
diff changeset
2181 }
Ritor1
parents:
diff changeset
2182 break;
Ritor1
parents:
diff changeset
2183 case INPUT_Attack:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2184 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2185 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2186 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2187 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
2188 pTurnEngine->field_18 |= TE_FLAG_8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2189 break;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2190 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2191 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0
Ritor1
parents:
diff changeset
2192 break;
Ritor1
parents:
diff changeset
2193 case INPUT_EventTrigger:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2194 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2195 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2196 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2197 break;
0
Ritor1
parents:
diff changeset
2198 }
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 141
diff changeset
2199 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE )
0
Ritor1
parents:
diff changeset
2200 {
Ritor1
parents:
diff changeset
2201 if ( pMessageQueue_50CBD0->uNumMessages )
Ritor1
parents:
diff changeset
2202 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2203 pMessageQueue_50CBD0->uNumMessages = 0;
0
Ritor1
parents:
diff changeset
2204 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
Ritor1
parents:
diff changeset
2205 {
Ritor1
parents:
diff changeset
2206 pMessageQueue_50CBD0->uNumMessages = 1;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2207 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
2208 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
Ritor1
parents:
diff changeset
2209 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
2210 ++pMessageQueue_50CBD0->uNumMessages;
Ritor1
parents:
diff changeset
2211 break;
Ritor1
parents:
diff changeset
2212 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2213 break;
0
Ritor1
parents:
diff changeset
2214 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2215 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
0
Ritor1
parents:
diff changeset
2216 }
Ritor1
parents:
diff changeset
2217 break;
Ritor1
parents:
diff changeset
2218 case INPUT_CharCycle:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2219 if ( pCurrentScreen == SCREEN_SPELL_BOOK )
0
Ritor1
parents:
diff changeset
2220 break;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2221 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2222 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2223 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2224 ++dword_50C9E8;*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2225 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2226 break;
0
Ritor1
parents:
diff changeset
2227 case INPUT_LookUp:
Ritor1
parents:
diff changeset
2228 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
2229 break;
Ritor1
parents:
diff changeset
2230 partyAction = (PartyAction)7;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2231 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2232 break;
0
Ritor1
parents:
diff changeset
2233 case INPUT_CenterView:
Ritor1
parents:
diff changeset
2234 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
2235 break;
Ritor1
parents:
diff changeset
2236 partyAction = (PartyAction)9;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2237 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2238 break;
0
Ritor1
parents:
diff changeset
2239 case INPUT_LookDown:
Ritor1
parents:
diff changeset
2240 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
2241 break;
Ritor1
parents:
diff changeset
2242 partyAction = (PartyAction)8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2243 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2244 break;
0
Ritor1
parents:
diff changeset
2245 case INPUT_FlyUp:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2246 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
2247 break;
Ritor1
parents:
diff changeset
2248 partyAction = (PartyAction)13;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2249 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2250 break;
0
Ritor1
parents:
diff changeset
2251 case INPUT_Land:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2252 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
2253 break;
Ritor1
parents:
diff changeset
2254 partyAction = (PartyAction)15;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2255 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2256 break;
0
Ritor1
parents:
diff changeset
2257 case INPUT_FlyDown:
Ritor1
parents:
diff changeset
2258 if ( !pCurrentScreen
Ritor1
parents:
diff changeset
2259 && !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
2260 {
Ritor1
parents:
diff changeset
2261 partyAction = (PartyAction)14;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2262 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
2263 }
Ritor1
parents:
diff changeset
2264 break;
Ritor1
parents:
diff changeset
2265 case INPUT_ZoomIn:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2266 /*if ( dword_50C9E8 >= 40 )
0
Ritor1
parents:
diff changeset
2267 break;
Ritor1
parents:
diff changeset
2268 dword_50C9EC[3 * dword_50C9E8] = 367;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2269 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2270 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2271 ++dword_50C9E8;*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2272 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2273 break;
0
Ritor1
parents:
diff changeset
2274 case INPUT_ZoomOut:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2275 /*if ( dword_50C9E8 < 40 )
0
Ritor1
parents:
diff changeset
2276 {
Ritor1
parents:
diff changeset
2277 dword_50C9EC[3 * dword_50C9E8] = 368;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2278 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2279 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
0
Ritor1
parents:
diff changeset
2280 ++dword_50C9E8;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2281 }*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
2282 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0);
0
Ritor1
parents:
diff changeset
2283 break;
Ritor1
parents:
diff changeset
2284 case INPUT_AlwaysRun:
Ritor1
parents:
diff changeset
2285 bAlwaysRun = bAlwaysRun == 0;
Ritor1
parents:
diff changeset
2286 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2287 default:
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2288 break;
0
Ritor1
parents:
diff changeset
2289 }
Ritor1
parents:
diff changeset
2290 }
Ritor1
parents:
diff changeset
2291 }
Ritor1
parents:
diff changeset
2292 }
Ritor1
parents:
diff changeset
2293 }