annotate mm7_6.cpp @ 1347:84db43e7db93

Merge
author Grumpy7
date Fri, 12 Jul 2013 23:08:35 +0200
parents 22cb507446a4
children b51332ab228f 5a5d0c713d47
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 //----- (004250FE) --------------------------------------------------------
Ritor1
parents:
diff changeset
192 signed int __fastcall sr_4250FE(unsigned int uVertexID)
Ritor1
parents:
diff changeset
193 {
Ritor1
parents:
diff changeset
194 unsigned int v1; // edx@1
Ritor1
parents:
diff changeset
195 char *v2; // edi@5
Ritor1
parents:
diff changeset
196 char *v3; // esi@5
Ritor1
parents:
diff changeset
197 char *v4; // ecx@5
Ritor1
parents:
diff changeset
198 int v5; // ebx@6
Ritor1
parents:
diff changeset
199 double v6; // st6@11
Ritor1
parents:
diff changeset
200 double v7; // st5@11
Ritor1
parents:
diff changeset
201 double v8; // st6@12
Ritor1
parents:
diff changeset
202 unsigned __int8 v9; // c2@16
Ritor1
parents:
diff changeset
203 unsigned __int8 v10; // c3@16
Ritor1
parents:
diff changeset
204 void *v11; // edi@23
Ritor1
parents:
diff changeset
205 double v12; // st6@23
Ritor1
parents:
diff changeset
206 char *v13; // ecx@23
Ritor1
parents:
diff changeset
207 char v14; // zf@24
Ritor1
parents:
diff changeset
208 signed int result; // eax@25
Ritor1
parents:
diff changeset
209 unsigned int v16; // [sp+8h] [bp-28h]@5
Ritor1
parents:
diff changeset
210 bool v17; // [sp+Ch] [bp-24h]@2
Ritor1
parents:
diff changeset
211 bool v18; // [sp+10h] [bp-20h]@7
Ritor1
parents:
diff changeset
212 char *v19; // [sp+14h] [bp-1Ch]@5
Ritor1
parents:
diff changeset
213 char *v20; // [sp+18h] [bp-18h]@5
Ritor1
parents:
diff changeset
214 signed int v21; // [sp+1Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
215 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5
Ritor1
parents:
diff changeset
216 char *v23; // [sp+24h] [bp-Ch]@5
Ritor1
parents:
diff changeset
217 char *v24; // [sp+28h] [bp-8h]@5
Ritor1
parents:
diff changeset
218 char *v25; // [sp+2Ch] [bp-4h]@5
Ritor1
parents:
diff changeset
219
Ritor1
parents:
diff changeset
220 v1 = uVertexID;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
221 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
0
Ritor1
parents:
diff changeset
222 v21 = 0;
Ritor1
parents:
diff changeset
223 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0;
Ritor1
parents:
diff changeset
224 if ( (signed int)(uVertexID + 1) <= 1 )
Ritor1
parents:
diff changeset
225 return 0;
Ritor1
parents:
diff changeset
226 v2 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
227 v3 = (char *)&array_507D30[0].vWorldViewPosition.y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
228 v24 = (char *)&array_507D30[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
229 v22 = array_507D30;
0
Ritor1
parents:
diff changeset
230 v19 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
231 v20 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
232 v23 = (char *)&array_507D30[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
233 v25 = (char *)&array_507D30[0].flt_2C;
Ritor1
parents:
diff changeset
234 v4 = (char *)&array_50AC10[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
235 v16 = v1;
Ritor1
parents:
diff changeset
236 do
Ritor1
parents:
diff changeset
237 {
Ritor1
parents:
diff changeset
238 v5 = (int)(v4 + 48);
Ritor1
parents:
diff changeset
239 v18 = *((float *)v4 + 12) >= 8.0;
Ritor1
parents:
diff changeset
240 if ( v17 != v18 )
Ritor1
parents:
diff changeset
241 {
Ritor1
parents:
diff changeset
242 if ( v18 )
Ritor1
parents:
diff changeset
243 {
Ritor1
parents:
diff changeset
244 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4);
Ritor1
parents:
diff changeset
245 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1);
Ritor1
parents:
diff changeset
246 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2);
Ritor1
parents:
diff changeset
247 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8);
Ritor1
parents:
diff changeset
248 }
Ritor1
parents:
diff changeset
249 else
Ritor1
parents:
diff changeset
250 {
Ritor1
parents:
diff changeset
251 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5);
Ritor1
parents:
diff changeset
252 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13);
Ritor1
parents:
diff changeset
253 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14);
Ritor1
parents:
diff changeset
254 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20);
Ritor1
parents:
diff changeset
255 }
Ritor1
parents:
diff changeset
256 *(float *)v25 = v7;
Ritor1
parents:
diff changeset
257 *(float *)v23 = 8.0;
Ritor1
parents:
diff changeset
258 *(int *)v24 = 0x3E000000u;
Ritor1
parents:
diff changeset
259 if ( v17 )
Ritor1
parents:
diff changeset
260 {
Ritor1
parents:
diff changeset
261 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) )
Ritor1
parents:
diff changeset
262 {
Ritor1
parents:
diff changeset
263 v9 = 0;
Ritor1
parents:
diff changeset
264 v10 = *(float *)v2 == *((float *)v4 + 2);
Ritor1
parents:
diff changeset
265 goto LABEL_20;
Ritor1
parents:
diff changeset
266 }
Ritor1
parents:
diff changeset
267 }
Ritor1
parents:
diff changeset
268 else
Ritor1
parents:
diff changeset
269 {
Ritor1
parents:
diff changeset
270 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) )
Ritor1
parents:
diff changeset
271 {
Ritor1
parents:
diff changeset
272 v9 = 0;
Ritor1
parents:
diff changeset
273 v10 = *(float *)v2 == *((float *)v4 + 14);
Ritor1
parents:
diff changeset
274 LABEL_20:
Ritor1
parents:
diff changeset
275 if ( v10 | v9 )
Ritor1
parents:
diff changeset
276 goto LABEL_22;
Ritor1
parents:
diff changeset
277 goto LABEL_21;
Ritor1
parents:
diff changeset
278 }
Ritor1
parents:
diff changeset
279 }
Ritor1
parents:
diff changeset
280 LABEL_21:
Ritor1
parents:
diff changeset
281 ++v22;
Ritor1
parents:
diff changeset
282 v23 += 48;
Ritor1
parents:
diff changeset
283 v25 += 48;
Ritor1
parents:
diff changeset
284 v3 += 48;
Ritor1
parents:
diff changeset
285 v2 += 48;
Ritor1
parents:
diff changeset
286 ++v21;
Ritor1
parents:
diff changeset
287 v24 += 48;
Ritor1
parents:
diff changeset
288 v20 = v3;
Ritor1
parents:
diff changeset
289 v19 = v2;
Ritor1
parents:
diff changeset
290 }
Ritor1
parents:
diff changeset
291 LABEL_22:
Ritor1
parents:
diff changeset
292 if ( v18 )
Ritor1
parents:
diff changeset
293 {
Ritor1
parents:
diff changeset
294 v11 = v22;
Ritor1
parents:
diff changeset
295 v20 += 48;
Ritor1
parents:
diff changeset
296 v19 += 48;
Ritor1
parents:
diff changeset
297 v12 = 1.0 / (*(float *)v5 + 0.0000001);
Ritor1
parents:
diff changeset
298 ++v21;
Ritor1
parents:
diff changeset
299 v25 += 48;
Ritor1
parents:
diff changeset
300 v23 += 48;
Ritor1
parents:
diff changeset
301 ++v22;
Ritor1
parents:
diff changeset
302 memcpy(v11, v4 + 36, 0x30u);
Ritor1
parents:
diff changeset
303 v13 = v24;
Ritor1
parents:
diff changeset
304 v24 += 48;
Ritor1
parents:
diff changeset
305 v3 = v20;
Ritor1
parents:
diff changeset
306 v2 = v19;
Ritor1
parents:
diff changeset
307 *(float *)v13 = v12;
Ritor1
parents:
diff changeset
308 }
Ritor1
parents:
diff changeset
309 v14 = v16-- == 1;
Ritor1
parents:
diff changeset
310 v17 = v18;
Ritor1
parents:
diff changeset
311 v4 = (char *)v5;
Ritor1
parents:
diff changeset
312 }
Ritor1
parents:
diff changeset
313 while ( !v14 );
Ritor1
parents:
diff changeset
314 result = v21;
Ritor1
parents:
diff changeset
315 if ( v21 < 3 )
Ritor1
parents:
diff changeset
316 return 0;
Ritor1
parents:
diff changeset
317 return result;
Ritor1
parents:
diff changeset
318 }
Ritor1
parents:
diff changeset
319
Ritor1
parents:
diff changeset
320 //----- (004252E8) --------------------------------------------------------
Ritor1
parents:
diff changeset
321 signed int __fastcall sr_4252E8(unsigned int uVertexID)
Ritor1
parents:
diff changeset
322 {
Ritor1
parents:
diff changeset
323 unsigned int v1; // edx@1
Ritor1
parents:
diff changeset
324 double v2; // st7@1
Ritor1
parents:
diff changeset
325 char *v3; // edi@5
Ritor1
parents:
diff changeset
326 char *v4; // esi@5
Ritor1
parents:
diff changeset
327 char *v5; // ecx@5
Ritor1
parents:
diff changeset
328 int v6; // ebx@6
Ritor1
parents:
diff changeset
329 double v7; // st6@11
Ritor1
parents:
diff changeset
330 double v8; // st5@11
Ritor1
parents:
diff changeset
331 double v9; // st6@12
Ritor1
parents:
diff changeset
332 unsigned __int8 v10; // c2@16
Ritor1
parents:
diff changeset
333 unsigned __int8 v11; // c3@16
Ritor1
parents:
diff changeset
334 void *v12; // edi@23
Ritor1
parents:
diff changeset
335 double v13; // st6@23
Ritor1
parents:
diff changeset
336 char *v14; // ecx@23
Ritor1
parents:
diff changeset
337 char v15; // zf@24
Ritor1
parents:
diff changeset
338 signed int result; // eax@25
Ritor1
parents:
diff changeset
339 unsigned int v17; // [sp+8h] [bp-28h]@5
Ritor1
parents:
diff changeset
340 bool v18; // [sp+Ch] [bp-24h]@2
Ritor1
parents:
diff changeset
341 bool v19; // [sp+10h] [bp-20h]@7
Ritor1
parents:
diff changeset
342 char *v20; // [sp+14h] [bp-1Ch]@5
Ritor1
parents:
diff changeset
343 char *v21; // [sp+18h] [bp-18h]@5
Ritor1
parents:
diff changeset
344 signed int v22; // [sp+1Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
345 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5
Ritor1
parents:
diff changeset
346 char *v24; // [sp+24h] [bp-Ch]@5
Ritor1
parents:
diff changeset
347 char *v25; // [sp+28h] [bp-8h]@5
Ritor1
parents:
diff changeset
348 char *v26; // [sp+2Ch] [bp-4h]@5
Ritor1
parents:
diff changeset
349
Ritor1
parents:
diff changeset
350 v1 = uVertexID;
Ritor1
parents:
diff changeset
351 v2 = (double)pOutdoorCamera->shading_dist_mist;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
352 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
0
Ritor1
parents:
diff changeset
353 v22 = 0;
Ritor1
parents:
diff changeset
354 v18 = array_50AC10[0].vWorldViewPosition.x <= v2;
Ritor1
parents:
diff changeset
355 if ( (signed int)(uVertexID + 1) <= 1 )
Ritor1
parents:
diff changeset
356 return 0;
Ritor1
parents:
diff changeset
357 v3 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
358 v4 = (char *)&array_507D30[0].vWorldViewPosition.y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
359 v25 = (char *)&array_507D30[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
360 v23 = array_507D30;
0
Ritor1
parents:
diff changeset
361 v20 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
362 v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
363 v24 = (char *)&array_507D30[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
364 v26 = (char *)&array_507D30[0].flt_2C;
Ritor1
parents:
diff changeset
365 v5 = (char *)&array_50AC10[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
366 v17 = v1;
Ritor1
parents:
diff changeset
367 do
Ritor1
parents:
diff changeset
368 {
Ritor1
parents:
diff changeset
369 v6 = (int)(v5 + 48);
Ritor1
parents:
diff changeset
370 v19 = v2 >= *((float *)v5 + 12);
Ritor1
parents:
diff changeset
371 if ( v18 != v19 )
Ritor1
parents:
diff changeset
372 {
Ritor1
parents:
diff changeset
373 if ( v19 )
Ritor1
parents:
diff changeset
374 {
Ritor1
parents:
diff changeset
375 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5);
Ritor1
parents:
diff changeset
376 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1);
Ritor1
parents:
diff changeset
377 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2);
Ritor1
parents:
diff changeset
378 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8);
Ritor1
parents:
diff changeset
379 }
Ritor1
parents:
diff changeset
380 else
Ritor1
parents:
diff changeset
381 {
Ritor1
parents:
diff changeset
382 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6);
Ritor1
parents:
diff changeset
383 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13);
Ritor1
parents:
diff changeset
384 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14);
Ritor1
parents:
diff changeset
385 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20);
Ritor1
parents:
diff changeset
386 }
Ritor1
parents:
diff changeset
387 *(float *)v26 = v8;
Ritor1
parents:
diff changeset
388 *(float *)v24 = v2;
Ritor1
parents:
diff changeset
389 *(float *)v25 = 1.0 / v2;
Ritor1
parents:
diff changeset
390 if ( v18 )
Ritor1
parents:
diff changeset
391 {
Ritor1
parents:
diff changeset
392 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) )
Ritor1
parents:
diff changeset
393 {
Ritor1
parents:
diff changeset
394 v10 = 0;
Ritor1
parents:
diff changeset
395 v11 = *(float *)v3 == *((float *)v5 + 2);
Ritor1
parents:
diff changeset
396 goto LABEL_20;
Ritor1
parents:
diff changeset
397 }
Ritor1
parents:
diff changeset
398 }
Ritor1
parents:
diff changeset
399 else
Ritor1
parents:
diff changeset
400 {
Ritor1
parents:
diff changeset
401 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) )
Ritor1
parents:
diff changeset
402 {
Ritor1
parents:
diff changeset
403 v10 = 0;
Ritor1
parents:
diff changeset
404 v11 = *(float *)v3 == *((float *)v5 + 14);
Ritor1
parents:
diff changeset
405 LABEL_20:
Ritor1
parents:
diff changeset
406 if ( v11 | v10 )
Ritor1
parents:
diff changeset
407 goto LABEL_22;
Ritor1
parents:
diff changeset
408 goto LABEL_21;
Ritor1
parents:
diff changeset
409 }
Ritor1
parents:
diff changeset
410 }
Ritor1
parents:
diff changeset
411 LABEL_21:
Ritor1
parents:
diff changeset
412 ++v23;
Ritor1
parents:
diff changeset
413 v24 += 48;
Ritor1
parents:
diff changeset
414 v26 += 48;
Ritor1
parents:
diff changeset
415 v4 += 48;
Ritor1
parents:
diff changeset
416 v3 += 48;
Ritor1
parents:
diff changeset
417 ++v22;
Ritor1
parents:
diff changeset
418 v25 += 48;
Ritor1
parents:
diff changeset
419 v21 = v4;
Ritor1
parents:
diff changeset
420 v20 = v3;
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422 LABEL_22:
Ritor1
parents:
diff changeset
423 if ( v19 )
Ritor1
parents:
diff changeset
424 {
Ritor1
parents:
diff changeset
425 v12 = v23;
Ritor1
parents:
diff changeset
426 v21 += 48;
Ritor1
parents:
diff changeset
427 v20 += 48;
Ritor1
parents:
diff changeset
428 v13 = 1.0 / (*(float *)v6 + 0.0000001);
Ritor1
parents:
diff changeset
429 ++v22;
Ritor1
parents:
diff changeset
430 v26 += 48;
Ritor1
parents:
diff changeset
431 v24 += 48;
Ritor1
parents:
diff changeset
432 ++v23;
Ritor1
parents:
diff changeset
433 memcpy(v12, v5 + 36, 0x30u);
Ritor1
parents:
diff changeset
434 v14 = v25;
Ritor1
parents:
diff changeset
435 v25 += 48;
Ritor1
parents:
diff changeset
436 v4 = v21;
Ritor1
parents:
diff changeset
437 v3 = v20;
Ritor1
parents:
diff changeset
438 *(float *)v14 = v13;
Ritor1
parents:
diff changeset
439 }
Ritor1
parents:
diff changeset
440 v15 = v17-- == 1;
Ritor1
parents:
diff changeset
441 v18 = v19;
Ritor1
parents:
diff changeset
442 v5 = (char *)v6;
Ritor1
parents:
diff changeset
443 }
Ritor1
parents:
diff changeset
444 while ( !v15 );
Ritor1
parents:
diff changeset
445 result = v22;
Ritor1
parents:
diff changeset
446 if ( v22 < 3 )
Ritor1
parents:
diff changeset
447 return 0;
Ritor1
parents:
diff changeset
448 return result;
Ritor1
parents:
diff changeset
449 }
Ritor1
parents:
diff changeset
450
Ritor1
parents:
diff changeset
451 //----- (004254D2) --------------------------------------------------------
Ritor1
parents:
diff changeset
452 int __fastcall sr_4254D2(signed int a1)
Ritor1
parents:
diff changeset
453 {
Ritor1
parents:
diff changeset
454 signed int v1; // ebx@2
Ritor1
parents:
diff changeset
455 int v2; // ecx@2
Ritor1
parents:
diff changeset
456 int result; // eax@11
Ritor1
parents:
diff changeset
457 double v4; // ST74_8@12
Ritor1
parents:
diff changeset
458 bool v5; // edi@12
Ritor1
parents:
diff changeset
459 char *v6; // esi@13
Ritor1
parents:
diff changeset
460 char *v7; // ebx@13
Ritor1
parents:
diff changeset
461 double v8; // st7@15
Ritor1
parents:
diff changeset
462 double v9; // st7@16
Ritor1
parents:
diff changeset
463 double v10; // st6@16
Ritor1
parents:
diff changeset
464 double v11; // st7@17
Ritor1
parents:
diff changeset
465 float v12; // eax@18
Ritor1
parents:
diff changeset
466 double v13; // ST4C_8@19
Ritor1
parents:
diff changeset
467 double v14; // ST10_8@19
Ritor1
parents:
diff changeset
468 double v15; // ST28_8@20
Ritor1
parents:
diff changeset
469 double v16; // ST34_8@20
Ritor1
parents:
diff changeset
470 char v17; // zf@20
Ritor1
parents:
diff changeset
471 double v18; // ST18_8@21
Ritor1
parents:
diff changeset
472 double v19; // ST3C_8@21
Ritor1
parents:
diff changeset
473 double v20; // ST44_8@22
Ritor1
parents:
diff changeset
474 double v21; // ST54_8@22
Ritor1
parents:
diff changeset
475 void *v22; // edi@26
Ritor1
parents:
diff changeset
476 double v23; // ST54_8@29
Ritor1
parents:
diff changeset
477 bool v24; // esi@29
Ritor1
parents:
diff changeset
478 char *v25; // edi@30
Ritor1
parents:
diff changeset
479 char *v26; // ebx@30
Ritor1
parents:
diff changeset
480 bool v27; // ecx@32
Ritor1
parents:
diff changeset
481 double v28; // st7@33
Ritor1
parents:
diff changeset
482 double v29; // st7@34
Ritor1
parents:
diff changeset
483 double v30; // st6@34
Ritor1
parents:
diff changeset
484 double v31; // st7@35
Ritor1
parents:
diff changeset
485 double v32; // ST44_8@37
Ritor1
parents:
diff changeset
486 double v33; // ST3C_8@37
Ritor1
parents:
diff changeset
487 double v34; // ST18_8@38
Ritor1
parents:
diff changeset
488 double v35; // ST34_8@38
Ritor1
parents:
diff changeset
489 char v36; // zf@38
Ritor1
parents:
diff changeset
490 double v37; // ST28_8@39
Ritor1
parents:
diff changeset
491 double v38; // ST10_8@39
Ritor1
parents:
diff changeset
492 double v39; // ST20_8@40
Ritor1
parents:
diff changeset
493 double v40; // ST5C_8@40
Ritor1
parents:
diff changeset
494 void *v41; // edi@44
Ritor1
parents:
diff changeset
495 double v42; // ST5C_8@47
Ritor1
parents:
diff changeset
496 bool v43; // edi@47
Ritor1
parents:
diff changeset
497 char *v44; // esi@48
Ritor1
parents:
diff changeset
498 char *v45; // ebx@48
Ritor1
parents:
diff changeset
499 bool v46; // ecx@49
Ritor1
parents:
diff changeset
500 double v47; // st6@50
Ritor1
parents:
diff changeset
501 double v48; // st6@51
Ritor1
parents:
diff changeset
502 double v49; // st5@51
Ritor1
parents:
diff changeset
503 double v50; // st6@52
Ritor1
parents:
diff changeset
504 double v51; // ST20_8@54
Ritor1
parents:
diff changeset
505 double v52; // ST54_8@54
Ritor1
parents:
diff changeset
506 double v53; // ST44_8@55
Ritor1
parents:
diff changeset
507 double v54; // ST3C_8@55
Ritor1
parents:
diff changeset
508 char v55; // zf@55
Ritor1
parents:
diff changeset
509 double v56; // ST18_8@56
Ritor1
parents:
diff changeset
510 double v57; // ST34_8@56
Ritor1
parents:
diff changeset
511 double v58; // ST28_8@57
Ritor1
parents:
diff changeset
512 double v59; // ST10_8@57
Ritor1
parents:
diff changeset
513 void *v60; // edi@61
Ritor1
parents:
diff changeset
514 double v61; // ST5C_8@64
Ritor1
parents:
diff changeset
515 bool v62; // edi@64
Ritor1
parents:
diff changeset
516 char *v63; // esi@65
Ritor1
parents:
diff changeset
517 char *v64; // ebx@65
Ritor1
parents:
diff changeset
518 bool v65; // ecx@66
Ritor1
parents:
diff changeset
519 double v66; // st6@67
Ritor1
parents:
diff changeset
520 double v67; // st6@68
Ritor1
parents:
diff changeset
521 double v68; // st5@68
Ritor1
parents:
diff changeset
522 double v69; // st6@69
Ritor1
parents:
diff changeset
523 double v70; // ST20_8@71
Ritor1
parents:
diff changeset
524 double v71; // ST54_8@71
Ritor1
parents:
diff changeset
525 double v72; // ST44_8@72
Ritor1
parents:
diff changeset
526 double v73; // ST3C_8@72
Ritor1
parents:
diff changeset
527 char v74; // zf@72
Ritor1
parents:
diff changeset
528 double v75; // ST18_8@73
Ritor1
parents:
diff changeset
529 double v76; // ST34_8@73
Ritor1
parents:
diff changeset
530 double v77; // ST28_8@74
Ritor1
parents:
diff changeset
531 double v78; // ST10_8@74
Ritor1
parents:
diff changeset
532 void *v79; // edi@78
Ritor1
parents:
diff changeset
533 int v80; // ebx@81
Ritor1
parents:
diff changeset
534 char *v81; // ecx@82
Ritor1
parents:
diff changeset
535 signed int v82; // esi@82
Ritor1
parents:
diff changeset
536 float v83; // ST78_4@83
Ritor1
parents:
diff changeset
537 double v84; // ST5C_8@83
Ritor1
parents:
diff changeset
538 float v85; // eax@84
Ritor1
parents:
diff changeset
539 double v86; // ST20_8@85
Ritor1
parents:
diff changeset
540 double v87; // ST54_8@88
Ritor1
parents:
diff changeset
541 float v88; // eax@89
Ritor1
parents:
diff changeset
542 double v89; // ST44_8@90
Ritor1
parents:
diff changeset
543 unsigned __int8 v90; // sf@94
Ritor1
parents:
diff changeset
544 unsigned __int8 v91; // of@94
Ritor1
parents:
diff changeset
545 int v92; // edx@97
Ritor1
parents:
diff changeset
546 int v93; // esi@97
Ritor1
parents:
diff changeset
547 int v94; // edi@97
Ritor1
parents:
diff changeset
548 int v95; // eax@97
Ritor1
parents:
diff changeset
549 int v96; // eax@104
Ritor1
parents:
diff changeset
550 double v97; // [sp+4Ch] [bp-8Ch]@32
Ritor1
parents:
diff changeset
551 double v98; // [sp+54h] [bp-84h]@49
Ritor1
parents:
diff changeset
552 double v99; // [sp+54h] [bp-84h]@66
Ritor1
parents:
diff changeset
553 float v100; // [sp+5Ch] [bp-7Ch]@1
Ritor1
parents:
diff changeset
554 float v101; // [sp+60h] [bp-78h]@1
Ritor1
parents:
diff changeset
555 float v102; // [sp+64h] [bp-74h]@1
Ritor1
parents:
diff changeset
556 double v103; // [sp+6Ch] [bp-6Ch]@14
Ritor1
parents:
diff changeset
557 float v104; // [sp+A8h] [bp-30h]@1
Ritor1
parents:
diff changeset
558 signed int v105; // [sp+A8h] [bp-30h]@96
Ritor1
parents:
diff changeset
559 bool v106; // [sp+ACh] [bp-2Ch]@14
Ritor1
parents:
diff changeset
560 bool v107; // [sp+ACh] [bp-2Ch]@32
Ritor1
parents:
diff changeset
561 bool v108; // [sp+ACh] [bp-2Ch]@49
Ritor1
parents:
diff changeset
562 bool v109; // [sp+ACh] [bp-2Ch]@66
Ritor1
parents:
diff changeset
563 signed int v110; // [sp+B0h] [bp-28h]@12
Ritor1
parents:
diff changeset
564 char *v111; // [sp+B8h] [bp-20h]@30
Ritor1
parents:
diff changeset
565 signed int v112; // [sp+B8h] [bp-20h]@48
Ritor1
parents:
diff changeset
566 signed int v113; // [sp+B8h] [bp-20h]@65
Ritor1
parents:
diff changeset
567 char *v114; // [sp+BCh] [bp-1Ch]@13
Ritor1
parents:
diff changeset
568 signed int v115; // [sp+BCh] [bp-1Ch]@29
Ritor1
parents:
diff changeset
569 signed int v116; // [sp+BCh] [bp-1Ch]@64
Ritor1
parents:
diff changeset
570 signed int v117; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
571 char *v118; // [sp+C0h] [bp-18h]@30
Ritor1
parents:
diff changeset
572 char *v119; // [sp+C0h] [bp-18h]@48
Ritor1
parents:
diff changeset
573 char *v120; // [sp+C0h] [bp-18h]@65
Ritor1
parents:
diff changeset
574 char *v121; // [sp+C4h] [bp-14h]@13
Ritor1
parents:
diff changeset
575 char *v122; // [sp+C4h] [bp-14h]@30
Ritor1
parents:
diff changeset
576 signed int v123; // [sp+C4h] [bp-14h]@47
Ritor1
parents:
diff changeset
577 char *v124; // [sp+C8h] [bp-10h]@30
Ritor1
parents:
diff changeset
578 char *v125; // [sp+C8h] [bp-10h]@48
Ritor1
parents:
diff changeset
579 char *v126; // [sp+C8h] [bp-10h]@65
Ritor1
parents:
diff changeset
580 signed int v127; // [sp+CCh] [bp-Ch]@2
Ritor1
parents:
diff changeset
581 char *v128; // [sp+CCh] [bp-Ch]@13
Ritor1
parents:
diff changeset
582 char *v129; // [sp+CCh] [bp-Ch]@30
Ritor1
parents:
diff changeset
583 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48
Ritor1
parents:
diff changeset
584 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65
Ritor1
parents:
diff changeset
585 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13
Ritor1
parents:
diff changeset
586 char *v133; // [sp+D0h] [bp-8h]@30
Ritor1
parents:
diff changeset
587 char *v134; // [sp+D0h] [bp-8h]@48
Ritor1
parents:
diff changeset
588 char *v135; // [sp+D0h] [bp-8h]@65
Ritor1
parents:
diff changeset
589 signed int v136; // [sp+D4h] [bp-4h]@1
Ritor1
parents:
diff changeset
590 char *v137; // [sp+D4h] [bp-4h]@13
Ritor1
parents:
diff changeset
591 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30
Ritor1
parents:
diff changeset
592 char *v139; // [sp+D4h] [bp-4h]@48
Ritor1
parents:
diff changeset
593 char *v140; // [sp+D4h] [bp-4h]@65
Ritor1
parents:
diff changeset
594
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
595 v101 = (double)(signed int)pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
596 v100 = (double)(signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
597 v117 = a1;
Ritor1
parents:
diff changeset
598 v136 = 1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
599 v104 = (double)(signed int)pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
600 v102 = (double)(pViewport->uViewportBR_Y + 1);
0
Ritor1
parents:
diff changeset
601 if ( a1 <= 0 )
Ritor1
parents:
diff changeset
602 return v117;
Ritor1
parents:
diff changeset
603 v127 = a1;
Ritor1
parents:
diff changeset
604 v1 = a1;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
605 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2));
0
Ritor1
parents:
diff changeset
606 v2 = 0;
Ritor1
parents:
diff changeset
607 do
Ritor1
parents:
diff changeset
608 {
Ritor1
parents:
diff changeset
609 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 )
Ritor1
parents:
diff changeset
610 v136 = 0;
Ritor1
parents:
diff changeset
611 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 )
Ritor1
parents:
diff changeset
612 v136 = 0;
Ritor1
parents:
diff changeset
613 ++v2;
Ritor1
parents:
diff changeset
614 --v127;
Ritor1
parents:
diff changeset
615 }
Ritor1
parents:
diff changeset
616 while ( v127 );
Ritor1
parents:
diff changeset
617 if ( v136 )
Ritor1
parents:
diff changeset
618 return v117;
Ritor1
parents:
diff changeset
619 v110 = 0;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
620 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1]));
0
Ritor1
parents:
diff changeset
621 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
622 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
623 if ( v117 < 1 )
Ritor1
parents:
diff changeset
624 goto LABEL_112;
Ritor1
parents:
diff changeset
625 v6 = (char *)&array_50A2B0[0].vWorldViewProjY;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
626 v132 = array_50A2B0;
0
Ritor1
parents:
diff changeset
627 v137 = (char *)&array_50A2B0[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
628 v128 = (char *)&array_50A2B0[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
629 v121 = (char *)&array_50A2B0[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
630 v114 = (char *)&array_50A2B0[0]._rhw;
0
Ritor1
parents:
diff changeset
631 v7 = (char *)&array_50AC10[0].flt_2C;
Ritor1
parents:
diff changeset
632 do
Ritor1
parents:
diff changeset
633 {
Ritor1
parents:
diff changeset
634 v103 = *((float *)v7 + 7) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
635 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
636 if ( !(v5 ^ v106) )
Ritor1
parents:
diff changeset
637 goto LABEL_25;
Ritor1
parents:
diff changeset
638 v8 = v101;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
639 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X )
0
Ritor1
parents:
diff changeset
640 {
Ritor1
parents:
diff changeset
641 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5));
Ritor1
parents:
diff changeset
642 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4);
Ritor1
parents:
diff changeset
643 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3);
Ritor1
parents:
diff changeset
644 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7;
Ritor1
parents:
diff changeset
645 }
Ritor1
parents:
diff changeset
646 else
Ritor1
parents:
diff changeset
647 {
Ritor1
parents:
diff changeset
648 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7));
Ritor1
parents:
diff changeset
649 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8);
Ritor1
parents:
diff changeset
650 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9);
Ritor1
parents:
diff changeset
651 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12);
Ritor1
parents:
diff changeset
652 }
Ritor1
parents:
diff changeset
653 *(float *)v121 = v10;
Ritor1
parents:
diff changeset
654 *(int *)v137 = LODWORD(v101);
Ritor1
parents:
diff changeset
655 LODWORD(v12) = *(int *)v6;
Ritor1
parents:
diff changeset
656 if ( v5 )
Ritor1
parents:
diff changeset
657 {
Ritor1
parents:
diff changeset
658 v13 = v12 + 6.7553994e15;
Ritor1
parents:
diff changeset
659 v14 = *((float *)v7 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
660 if ( LODWORD(v13) == LODWORD(v14) )
Ritor1
parents:
diff changeset
661 {
Ritor1
parents:
diff changeset
662 v15 = *(float *)v137 + 6.7553994e15;
Ritor1
parents:
diff changeset
663 v16 = *((float *)v7 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
664 v17 = LODWORD(v15) == LODWORD(v16);
Ritor1
parents:
diff changeset
665 goto LABEL_23;
Ritor1
parents:
diff changeset
666 }
Ritor1
parents:
diff changeset
667 }
Ritor1
parents:
diff changeset
668 else
Ritor1
parents:
diff changeset
669 {
Ritor1
parents:
diff changeset
670 v18 = v12 + 6.7553994e15;
Ritor1
parents:
diff changeset
671 v19 = *((float *)v7 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
672 if ( LODWORD(v18) == LODWORD(v19) )
Ritor1
parents:
diff changeset
673 {
Ritor1
parents:
diff changeset
674 v20 = *(float *)v137 + 6.7553994e15;
Ritor1
parents:
diff changeset
675 v21 = *((float *)v7 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
676 v17 = LODWORD(v20) == LODWORD(v21);
Ritor1
parents:
diff changeset
677 LABEL_23:
Ritor1
parents:
diff changeset
678 if ( v17 )
Ritor1
parents:
diff changeset
679 goto LABEL_25;
Ritor1
parents:
diff changeset
680 goto LABEL_24;
Ritor1
parents:
diff changeset
681 }
Ritor1
parents:
diff changeset
682 }
Ritor1
parents:
diff changeset
683 LABEL_24:
Ritor1
parents:
diff changeset
684 v121 += 48;
Ritor1
parents:
diff changeset
685 v114 += 48;
Ritor1
parents:
diff changeset
686 v6 += 48;
Ritor1
parents:
diff changeset
687 ++v110;
Ritor1
parents:
diff changeset
688 ++v132;
Ritor1
parents:
diff changeset
689 v128 = v6;
Ritor1
parents:
diff changeset
690 v137 += 48;
Ritor1
parents:
diff changeset
691 LABEL_25:
Ritor1
parents:
diff changeset
692 if ( v106 )
Ritor1
parents:
diff changeset
693 {
Ritor1
parents:
diff changeset
694 v22 = v132;
Ritor1
parents:
diff changeset
695 v128 += 48;
Ritor1
parents:
diff changeset
696 ++v110;
Ritor1
parents:
diff changeset
697 v114 += 48;
Ritor1
parents:
diff changeset
698 v121 += 48;
Ritor1
parents:
diff changeset
699 v137 += 48;
Ritor1
parents:
diff changeset
700 ++v132;
Ritor1
parents:
diff changeset
701 memcpy(v22, v7 + 4, 0x30u);
Ritor1
parents:
diff changeset
702 v6 = v128;
Ritor1
parents:
diff changeset
703 }
Ritor1
parents:
diff changeset
704 v5 = v106;
Ritor1
parents:
diff changeset
705 v7 += 48;
Ritor1
parents:
diff changeset
706 --v117;
Ritor1
parents:
diff changeset
707 }
Ritor1
parents:
diff changeset
708 while ( v117 );
Ritor1
parents:
diff changeset
709 if ( v110 < 3
Ritor1
parents:
diff changeset
710 || (v115 = 0,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
711 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])),
0
Ritor1
parents:
diff changeset
712 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
713 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X,
0
Ritor1
parents:
diff changeset
714 v110 < 1) )
Ritor1
parents:
diff changeset
715 goto LABEL_112;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
716 v25 = (char *)&array_509950[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
717 v138 = array_509950;
0
Ritor1
parents:
diff changeset
718 v129 = (char *)&array_50A2B0[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
719 v118 = (char *)&array_50A2B0[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
720 v133 = (char *)&array_509950[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
721 v122 = (char *)&array_509950[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
722 v124 = (char *)&array_509950[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
723 v111 = (char *)&array_509950[0]._rhw;
0
Ritor1
parents:
diff changeset
724 v26 = (char *)&array_50A2B0[0].flt_2C;
Ritor1
parents:
diff changeset
725 while ( 2 )
Ritor1
parents:
diff changeset
726 {
Ritor1
parents:
diff changeset
727 v97 = *((float *)v26 + 7) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
728 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
729 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
730 if ( v24 != v27 )
Ritor1
parents:
diff changeset
731 {
Ritor1
parents:
diff changeset
732 v28 = v100;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
733 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X )
0
Ritor1
parents:
diff changeset
734 {
Ritor1
parents:
diff changeset
735 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5));
Ritor1
parents:
diff changeset
736 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4);
Ritor1
parents:
diff changeset
737 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3);
Ritor1
parents:
diff changeset
738 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26;
Ritor1
parents:
diff changeset
739 }
Ritor1
parents:
diff changeset
740 else
Ritor1
parents:
diff changeset
741 {
Ritor1
parents:
diff changeset
742 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7));
Ritor1
parents:
diff changeset
743 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8);
Ritor1
parents:
diff changeset
744 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9);
Ritor1
parents:
diff changeset
745 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12);
Ritor1
parents:
diff changeset
746 }
Ritor1
parents:
diff changeset
747 *(float *)v124 = v30;
Ritor1
parents:
diff changeset
748 *(int *)v133 = LODWORD(v100);
Ritor1
parents:
diff changeset
749 if ( v24 )
Ritor1
parents:
diff changeset
750 {
Ritor1
parents:
diff changeset
751 v32 = *(float *)v122 + 6.7553994e15;
Ritor1
parents:
diff changeset
752 v33 = *((float *)v26 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
753 if ( LODWORD(v32) == LODWORD(v33) )
Ritor1
parents:
diff changeset
754 {
Ritor1
parents:
diff changeset
755 v34 = *(float *)v133 + 6.7553994e15;
Ritor1
parents:
diff changeset
756 v35 = *((float *)v26 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
757 v36 = LODWORD(v34) == LODWORD(v35);
Ritor1
parents:
diff changeset
758 goto LABEL_41;
Ritor1
parents:
diff changeset
759 }
Ritor1
parents:
diff changeset
760 goto LABEL_42;
Ritor1
parents:
diff changeset
761 }
Ritor1
parents:
diff changeset
762 v37 = *(float *)v118 + 6.7553994e15;
Ritor1
parents:
diff changeset
763 v38 = *((float *)v26 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
764 if ( LODWORD(v37) != LODWORD(v38) )
Ritor1
parents:
diff changeset
765 goto LABEL_42;
Ritor1
parents:
diff changeset
766 v39 = *(float *)v129 + 6.7553994e15;
Ritor1
parents:
diff changeset
767 v40 = *((float *)v26 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
768 v36 = LODWORD(v39) == LODWORD(v40);
Ritor1
parents:
diff changeset
769 LABEL_41:
Ritor1
parents:
diff changeset
770 if ( !v36 )
Ritor1
parents:
diff changeset
771 {
Ritor1
parents:
diff changeset
772 LABEL_42:
Ritor1
parents:
diff changeset
773 v129 += 48;
Ritor1
parents:
diff changeset
774 v118 += 48;
Ritor1
parents:
diff changeset
775 v133 += 48;
Ritor1
parents:
diff changeset
776 v122 += 48;
Ritor1
parents:
diff changeset
777 v124 += 48;
Ritor1
parents:
diff changeset
778 v111 += 48;
Ritor1
parents:
diff changeset
779 ++v115;
Ritor1
parents:
diff changeset
780 ++v138;
Ritor1
parents:
diff changeset
781 }
Ritor1
parents:
diff changeset
782 }
Ritor1
parents:
diff changeset
783 if ( v27 )
Ritor1
parents:
diff changeset
784 {
Ritor1
parents:
diff changeset
785 v41 = v138;
Ritor1
parents:
diff changeset
786 ++v115;
Ritor1
parents:
diff changeset
787 v111 += 48;
Ritor1
parents:
diff changeset
788 v124 += 48;
Ritor1
parents:
diff changeset
789 v122 += 48;
Ritor1
parents:
diff changeset
790 v133 += 48;
Ritor1
parents:
diff changeset
791 v118 += 48;
Ritor1
parents:
diff changeset
792 v129 += 48;
Ritor1
parents:
diff changeset
793 ++v138;
Ritor1
parents:
diff changeset
794 memcpy(v41, v26 + 4, 0x30u);
Ritor1
parents:
diff changeset
795 }
Ritor1
parents:
diff changeset
796 v24 = v107;
Ritor1
parents:
diff changeset
797 v26 += 48;
Ritor1
parents:
diff changeset
798 --v110;
Ritor1
parents:
diff changeset
799 if ( v110 )
Ritor1
parents:
diff changeset
800 {
Ritor1
parents:
diff changeset
801 v25 = v111;
Ritor1
parents:
diff changeset
802 continue;
Ritor1
parents:
diff changeset
803 }
Ritor1
parents:
diff changeset
804 break;
Ritor1
parents:
diff changeset
805 }
Ritor1
parents:
diff changeset
806 if ( v115 < 3
Ritor1
parents:
diff changeset
807 || (v123 = 0,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
808 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])),
0
Ritor1
parents:
diff changeset
809 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
810 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
811 v115 < 1) )
Ritor1
parents:
diff changeset
812 goto LABEL_112;
Ritor1
parents:
diff changeset
813 v44 = (char *)&array_508FF0[0].vWorldViewProjX;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
814 v130 = array_508FF0;
0
Ritor1
parents:
diff changeset
815 v119 = (char *)&array_508FF0[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
816 v139 = (char *)&array_508FF0[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
817 v125 = (char *)&array_508FF0[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
818 v134 = (char *)&array_508FF0[0]._rhw;
0
Ritor1
parents:
diff changeset
819 v45 = (char *)&array_509950[0].flt_2C;
Ritor1
parents:
diff changeset
820 v112 = v115;
Ritor1
parents:
diff changeset
821 while ( 2 )
Ritor1
parents:
diff changeset
822 {
Ritor1
parents:
diff changeset
823 v98 = *((float *)v45 + 8) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
824 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
825 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
826 if ( v43 != v46 )
Ritor1
parents:
diff changeset
827 {
Ritor1
parents:
diff changeset
828 v47 = v104;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
829 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y )
0
Ritor1
parents:
diff changeset
830 {
Ritor1
parents:
diff changeset
831 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4));
Ritor1
parents:
diff changeset
832 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5);
Ritor1
parents:
diff changeset
833 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3);
Ritor1
parents:
diff changeset
834 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45;
Ritor1
parents:
diff changeset
835 }
Ritor1
parents:
diff changeset
836 else
Ritor1
parents:
diff changeset
837 {
Ritor1
parents:
diff changeset
838 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8));
Ritor1
parents:
diff changeset
839 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7);
Ritor1
parents:
diff changeset
840 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9);
Ritor1
parents:
diff changeset
841 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12);
Ritor1
parents:
diff changeset
842 }
Ritor1
parents:
diff changeset
843 *(float *)v125 = v49;
Ritor1
parents:
diff changeset
844 *(float *)v139 = v104;
Ritor1
parents:
diff changeset
845 if ( v43 )
Ritor1
parents:
diff changeset
846 {
Ritor1
parents:
diff changeset
847 v51 = v104 + 6.7553994e15;
Ritor1
parents:
diff changeset
848 v52 = *((float *)v45 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
849 if ( LODWORD(v51) == LODWORD(v52) )
Ritor1
parents:
diff changeset
850 {
Ritor1
parents:
diff changeset
851 v53 = *(float *)v44 + 6.7553994e15;
Ritor1
parents:
diff changeset
852 v54 = *((float *)v45 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
853 v55 = LODWORD(v53) == LODWORD(v54);
Ritor1
parents:
diff changeset
854 goto LABEL_58;
Ritor1
parents:
diff changeset
855 }
Ritor1
parents:
diff changeset
856 goto LABEL_59;
Ritor1
parents:
diff changeset
857 }
Ritor1
parents:
diff changeset
858 v56 = v104 + 6.7553994e15;
Ritor1
parents:
diff changeset
859 v57 = *((float *)v45 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
860 if ( LODWORD(v56) != LODWORD(v57) )
Ritor1
parents:
diff changeset
861 goto LABEL_59;
Ritor1
parents:
diff changeset
862 v58 = *(float *)v44 + 6.7553994e15;
Ritor1
parents:
diff changeset
863 v59 = *((float *)v45 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
864 v55 = LODWORD(v58) == LODWORD(v59);
Ritor1
parents:
diff changeset
865 LABEL_58:
Ritor1
parents:
diff changeset
866 if ( !v55 )
Ritor1
parents:
diff changeset
867 {
Ritor1
parents:
diff changeset
868 LABEL_59:
Ritor1
parents:
diff changeset
869 v139 += 48;
Ritor1
parents:
diff changeset
870 v125 += 48;
Ritor1
parents:
diff changeset
871 v134 += 48;
Ritor1
parents:
diff changeset
872 v44 += 48;
Ritor1
parents:
diff changeset
873 ++v123;
Ritor1
parents:
diff changeset
874 ++v130;
Ritor1
parents:
diff changeset
875 v119 = v44;
Ritor1
parents:
diff changeset
876 }
Ritor1
parents:
diff changeset
877 }
Ritor1
parents:
diff changeset
878 if ( v46 )
Ritor1
parents:
diff changeset
879 {
Ritor1
parents:
diff changeset
880 v60 = v130;
Ritor1
parents:
diff changeset
881 v119 += 48;
Ritor1
parents:
diff changeset
882 ++v123;
Ritor1
parents:
diff changeset
883 v134 += 48;
Ritor1
parents:
diff changeset
884 v125 += 48;
Ritor1
parents:
diff changeset
885 v139 += 48;
Ritor1
parents:
diff changeset
886 ++v130;
Ritor1
parents:
diff changeset
887 memcpy(v60, v45 + 4, 0x30u);
Ritor1
parents:
diff changeset
888 v44 = v119;
Ritor1
parents:
diff changeset
889 }
Ritor1
parents:
diff changeset
890 v43 = v108;
Ritor1
parents:
diff changeset
891 v45 += 48;
Ritor1
parents:
diff changeset
892 --v112;
Ritor1
parents:
diff changeset
893 if ( v112 )
Ritor1
parents:
diff changeset
894 continue;
Ritor1
parents:
diff changeset
895 break;
Ritor1
parents:
diff changeset
896 }
Ritor1
parents:
diff changeset
897 if ( v123 < 3
Ritor1
parents:
diff changeset
898 || (v116 = 0,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
899 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])),
0
Ritor1
parents:
diff changeset
900 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
901 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y,
0
Ritor1
parents:
diff changeset
902 v123 < 1) )
Ritor1
parents:
diff changeset
903 goto LABEL_112;
Ritor1
parents:
diff changeset
904 v63 = (char *)&array_508690[0].vWorldViewProjX;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
905 v131 = array_508690;
0
Ritor1
parents:
diff changeset
906 v120 = (char *)&array_508690[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
907 v140 = (char *)&array_508690[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
908 v126 = (char *)&array_508690[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
909 v135 = (char *)&array_508690[0]._rhw;
0
Ritor1
parents:
diff changeset
910 v64 = (char *)&array_508FF0[0].flt_2C;
Ritor1
parents:
diff changeset
911 v113 = v123;
Ritor1
parents:
diff changeset
912 while ( 2 )
Ritor1
parents:
diff changeset
913 {
Ritor1
parents:
diff changeset
914 v99 = *((float *)v64 + 8) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
915 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
916 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y;
0
Ritor1
parents:
diff changeset
917 if ( v62 != v65 )
Ritor1
parents:
diff changeset
918 {
Ritor1
parents:
diff changeset
919 v66 = v102;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
920 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
921 {
Ritor1
parents:
diff changeset
922 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4));
Ritor1
parents:
diff changeset
923 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5);
Ritor1
parents:
diff changeset
924 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3);
Ritor1
parents:
diff changeset
925 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64;
Ritor1
parents:
diff changeset
926 }
Ritor1
parents:
diff changeset
927 else
Ritor1
parents:
diff changeset
928 {
Ritor1
parents:
diff changeset
929 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8));
Ritor1
parents:
diff changeset
930 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7);
Ritor1
parents:
diff changeset
931 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9);
Ritor1
parents:
diff changeset
932 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12);
Ritor1
parents:
diff changeset
933 }
Ritor1
parents:
diff changeset
934 *(float *)v126 = v68;
Ritor1
parents:
diff changeset
935 *(float *)v140 = v102;
Ritor1
parents:
diff changeset
936 if ( v62 )
Ritor1
parents:
diff changeset
937 {
Ritor1
parents:
diff changeset
938 v70 = v102 + 6.7553994e15;
Ritor1
parents:
diff changeset
939 v71 = *((float *)v64 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
940 if ( LODWORD(v70) == LODWORD(v71) )
Ritor1
parents:
diff changeset
941 {
Ritor1
parents:
diff changeset
942 v72 = *(float *)v63 + 6.7553994e15;
Ritor1
parents:
diff changeset
943 v73 = *((float *)v64 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
944 v74 = LODWORD(v72) == LODWORD(v73);
Ritor1
parents:
diff changeset
945 goto LABEL_75;
Ritor1
parents:
diff changeset
946 }
Ritor1
parents:
diff changeset
947 goto LABEL_76;
Ritor1
parents:
diff changeset
948 }
Ritor1
parents:
diff changeset
949 v75 = v102 + 6.7553994e15;
Ritor1
parents:
diff changeset
950 v76 = *((float *)v64 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
951 if ( LODWORD(v75) != LODWORD(v76) )
Ritor1
parents:
diff changeset
952 goto LABEL_76;
Ritor1
parents:
diff changeset
953 v77 = *(float *)v63 + 6.7553994e15;
Ritor1
parents:
diff changeset
954 v78 = *((float *)v64 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
955 v74 = LODWORD(v77) == LODWORD(v78);
Ritor1
parents:
diff changeset
956 LABEL_75:
Ritor1
parents:
diff changeset
957 if ( !v74 )
Ritor1
parents:
diff changeset
958 {
Ritor1
parents:
diff changeset
959 LABEL_76:
Ritor1
parents:
diff changeset
960 v140 += 48;
Ritor1
parents:
diff changeset
961 v126 += 48;
Ritor1
parents:
diff changeset
962 v135 += 48;
Ritor1
parents:
diff changeset
963 v63 += 48;
Ritor1
parents:
diff changeset
964 ++v116;
Ritor1
parents:
diff changeset
965 ++v131;
Ritor1
parents:
diff changeset
966 v120 = v63;
Ritor1
parents:
diff changeset
967 }
Ritor1
parents:
diff changeset
968 }
Ritor1
parents:
diff changeset
969 if ( v65 )
Ritor1
parents:
diff changeset
970 {
Ritor1
parents:
diff changeset
971 v79 = v131;
Ritor1
parents:
diff changeset
972 v120 += 48;
Ritor1
parents:
diff changeset
973 ++v116;
Ritor1
parents:
diff changeset
974 v135 += 48;
Ritor1
parents:
diff changeset
975 v126 += 48;
Ritor1
parents:
diff changeset
976 v140 += 48;
Ritor1
parents:
diff changeset
977 ++v131;
Ritor1
parents:
diff changeset
978 memcpy(v79, v64 + 4, 0x30u);
Ritor1
parents:
diff changeset
979 v63 = v120;
Ritor1
parents:
diff changeset
980 }
Ritor1
parents:
diff changeset
981 v62 = v109;
Ritor1
parents:
diff changeset
982 v64 += 48;
Ritor1
parents:
diff changeset
983 --v113;
Ritor1
parents:
diff changeset
984 if ( v113 )
Ritor1
parents:
diff changeset
985 continue;
Ritor1
parents:
diff changeset
986 break;
Ritor1
parents:
diff changeset
987 }
Ritor1
parents:
diff changeset
988 if ( v116 < 3 )
Ritor1
parents:
diff changeset
989 goto LABEL_112;
Ritor1
parents:
diff changeset
990 v80 = v116;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
991 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116]));
0
Ritor1
parents:
diff changeset
992 if ( v116 > 0 )
Ritor1
parents:
diff changeset
993 {
Ritor1
parents:
diff changeset
994 v81 = (char *)&array_508690[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
995 v82 = v116;
Ritor1
parents:
diff changeset
996 do
Ritor1
parents:
diff changeset
997 {
Ritor1
parents:
diff changeset
998 LODWORD(v83) = *(int *)v81;
Ritor1
parents:
diff changeset
999 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2);
Ritor1
parents:
diff changeset
1000 v84 = v83 + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1001 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X )
0
Ritor1
parents:
diff changeset
1002 {
Ritor1
parents:
diff changeset
1003 v86 = *(float *)v81 + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1004 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X )
0
Ritor1
parents:
diff changeset
1005 goto LABEL_88;
Ritor1
parents:
diff changeset
1006 v85 = v101;
Ritor1
parents:
diff changeset
1007 }
Ritor1
parents:
diff changeset
1008 else
Ritor1
parents:
diff changeset
1009 {
Ritor1
parents:
diff changeset
1010 v85 = v100;
Ritor1
parents:
diff changeset
1011 }
Ritor1
parents:
diff changeset
1012 *(int *)v81 = LODWORD(v85);
Ritor1
parents:
diff changeset
1013 LABEL_88:
Ritor1
parents:
diff changeset
1014 v87 = *((float *)v81 + 1) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1015 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
1016 {
Ritor1
parents:
diff changeset
1017 v88 = v102;
Ritor1
parents:
diff changeset
1018 LABEL_92:
Ritor1
parents:
diff changeset
1019 *((int *)v81 + 1) = LODWORD(v88);
Ritor1
parents:
diff changeset
1020 goto LABEL_93;
Ritor1
parents:
diff changeset
1021 }
Ritor1
parents:
diff changeset
1022 v89 = *((float *)v81 + 1) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1023 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y )
0
Ritor1
parents:
diff changeset
1024 {
Ritor1
parents:
diff changeset
1025 v88 = v104;
Ritor1
parents:
diff changeset
1026 goto LABEL_92;
Ritor1
parents:
diff changeset
1027 }
Ritor1
parents:
diff changeset
1028 LABEL_93:
Ritor1
parents:
diff changeset
1029 v81 += 48;
Ritor1
parents:
diff changeset
1030 --v82;
Ritor1
parents:
diff changeset
1031 }
Ritor1
parents:
diff changeset
1032 while ( v82 );
Ritor1
parents:
diff changeset
1033 }
Ritor1
parents:
diff changeset
1034 v91 = __OFSUB__(v116, 3);
Ritor1
parents:
diff changeset
1035 v90 = v116 - 3 < 0;
Ritor1
parents:
diff changeset
1036 if ( v116 > 3 )
Ritor1
parents:
diff changeset
1037 {
Ritor1
parents:
diff changeset
1038 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1]));
Ritor1
parents:
diff changeset
1039 if ( v116 > 0 )
Ritor1
parents:
diff changeset
1040 {
Ritor1
parents:
diff changeset
1041 v105 = 1;
Ritor1
parents:
diff changeset
1042 do
Ritor1
parents:
diff changeset
1043 {
Ritor1
parents:
diff changeset
1044 v92 = v105;
Ritor1
parents:
diff changeset
1045 v93 = v105 - 1;
Ritor1
parents:
diff changeset
1046 v94 = v105 + 1;
Ritor1
parents:
diff changeset
1047 v95 = v105 + 1;
Ritor1
parents:
diff changeset
1048 if ( v105 - 1 >= v80 )
Ritor1
parents:
diff changeset
1049 v93 -= v80;
Ritor1
parents:
diff changeset
1050 if ( v105 >= v80 )
Ritor1
parents:
diff changeset
1051 v92 = v105 - v80;
Ritor1
parents:
diff changeset
1052 if ( v94 >= v80 )
Ritor1
parents:
diff changeset
1053 v95 = v94 - v80;
Ritor1
parents:
diff changeset
1054 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX)
Ritor1
parents:
diff changeset
1055 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY)
Ritor1
parents:
diff changeset
1056 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX)
Ritor1
parents:
diff changeset
1057 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 )
Ritor1
parents:
diff changeset
1058 {
Ritor1
parents:
diff changeset
1059 ++v105;
Ritor1
parents:
diff changeset
1060 }
Ritor1
parents:
diff changeset
1061 else
Ritor1
parents:
diff changeset
1062 {
Ritor1
parents:
diff changeset
1063 v96 = v105;
Ritor1
parents:
diff changeset
1064 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) )
Ritor1
parents:
diff changeset
1065 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2));
Ritor1
parents:
diff changeset
1066 --v80;
Ritor1
parents:
diff changeset
1067 }
Ritor1
parents:
diff changeset
1068 }
Ritor1
parents:
diff changeset
1069 while ( v105 - 1 < v80 );
Ritor1
parents:
diff changeset
1070 }
Ritor1
parents:
diff changeset
1071 v91 = __OFSUB__(v80, 3);
Ritor1
parents:
diff changeset
1072 v90 = v80 - 3 < 0;
Ritor1
parents:
diff changeset
1073 }
Ritor1
parents:
diff changeset
1074 if ( v90 ^ v91 )
Ritor1
parents:
diff changeset
1075 LABEL_112:
Ritor1
parents:
diff changeset
1076 result = 0;
Ritor1
parents:
diff changeset
1077 else
Ritor1
parents:
diff changeset
1078 result = v80;
Ritor1
parents:
diff changeset
1079 return result;
Ritor1
parents:
diff changeset
1080 }
Ritor1
parents:
diff changeset
1081
Ritor1
parents:
diff changeset
1082 //----- (0042620A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1083 bool __thiscall sr_42620A(RenderVertexSoft *p)
Ritor1
parents:
diff changeset
1084 {
Ritor1
parents:
diff changeset
1085 __int16 v1; // fps@1
Ritor1
parents:
diff changeset
1086 unsigned __int8 v2; // c0@2
Ritor1
parents:
diff changeset
1087 char v3; // c2@2
Ritor1
parents:
diff changeset
1088 unsigned __int8 v4; // c3@2
Ritor1
parents:
diff changeset
1089 bool result; // eax@2
Ritor1
parents:
diff changeset
1090 unsigned __int8 v6; // c0@4
Ritor1
parents:
diff changeset
1091 char v7; // c2@4
Ritor1
parents:
diff changeset
1092 unsigned __int8 v8; // c3@4
Ritor1
parents:
diff changeset
1093 unsigned __int8 v9; // c0@6
Ritor1
parents:
diff changeset
1094 char v10; // c2@6
Ritor1
parents:
diff changeset
1095 unsigned __int8 v11; // c3@6
Ritor1
parents:
diff changeset
1096 double v12; // st6@7
Ritor1
parents:
diff changeset
1097 float v13; // ST04_4@7
Ritor1
parents:
diff changeset
1098 float v14; // ST00_4@7
Ritor1
parents:
diff changeset
1099 double v15; // st7@7
Ritor1
parents:
diff changeset
1100 double v16; // st6@8
Ritor1
parents:
diff changeset
1101 float v17; // ST04_4@8
Ritor1
parents:
diff changeset
1102 float v18; // ST00_4@8
Ritor1
parents:
diff changeset
1103 double v19; // st7@8
Ritor1
parents:
diff changeset
1104
Ritor1
parents:
diff changeset
1105 //UNDEF(v1);
Ritor1
parents:
diff changeset
1106 if ( p->vWorldViewPosition.x < 300.0
Ritor1
parents:
diff changeset
1107 || (v2 = 300.0 < p[1].vWorldViewPosition.x,
Ritor1
parents:
diff changeset
1108 v3 = 0,
Ritor1
parents:
diff changeset
1109 v4 = 300.0 == p[1].vWorldViewPosition.x,
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1110 //BYTE1(result) = HIBYTE(v1),
0
Ritor1
parents:
diff changeset
1111 !(v2 | v4)) )
Ritor1
parents:
diff changeset
1112 {
Ritor1
parents:
diff changeset
1113 if ( p->vWorldViewPosition.x < 300.0 )
Ritor1
parents:
diff changeset
1114 {
Ritor1
parents:
diff changeset
1115 v6 = 300.0 < p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1116 v7 = 0;
Ritor1
parents:
diff changeset
1117 v8 = 300.0 == p[1].vWorldViewPosition.x;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1118 //BYTE1(result) = HIBYTE(v1);
0
Ritor1
parents:
diff changeset
1119 if ( !(v6 | v8) )
Ritor1
parents:
diff changeset
1120 {
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1121 //LOBYTE(result) = 0;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1122 return false;
0
Ritor1
parents:
diff changeset
1123 }
Ritor1
parents:
diff changeset
1124 }
Ritor1
parents:
diff changeset
1125 v9 = 300.0 < p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1126 v10 = 0;
Ritor1
parents:
diff changeset
1127 v11 = 300.0 == p->vWorldViewPosition.x;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1128 //BYTE1(result) = HIBYTE(v1);
0
Ritor1
parents:
diff changeset
1129 if ( v9 | v11 )
Ritor1
parents:
diff changeset
1130 {
Ritor1
parents:
diff changeset
1131 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x);
Ritor1
parents:
diff changeset
1132 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16;
Ritor1
parents:
diff changeset
1133 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16;
Ritor1
parents:
diff changeset
1134 v19 = 300.0 - p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1135 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1136 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
1137 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
1138 }
Ritor1
parents:
diff changeset
1139 else
Ritor1
parents:
diff changeset
1140 {
Ritor1
parents:
diff changeset
1141 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x);
Ritor1
parents:
diff changeset
1142 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12;
Ritor1
parents:
diff changeset
1143 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12;
Ritor1
parents:
diff changeset
1144 v15 = 300.0 - p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1145 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1146 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y;
Ritor1
parents:
diff changeset
1147 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z;
Ritor1
parents:
diff changeset
1148 }
Ritor1
parents:
diff changeset
1149 }
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1150 //LOBYTE(result) = 1;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1151 return true;
0
Ritor1
parents:
diff changeset
1152 }
Ritor1
parents:
diff changeset
1153
Ritor1
parents:
diff changeset
1154 //----- (004268E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1155 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor)
Ritor1
parents:
diff changeset
1156 {
Ritor1
parents:
diff changeset
1157 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
1158 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
1159 int v3; // eax@1
Ritor1
parents:
diff changeset
1160 int v4; // edx@1
Ritor1
parents:
diff changeset
1161 unsigned int v5; // ecx@1
Ritor1
parents:
diff changeset
1162
Ritor1
parents:
diff changeset
1163 v1 = uColor >> 9;
Ritor1
parents:
diff changeset
1164 v2 = uColor >> 6;
Ritor1
parents:
diff changeset
1165 LOWORD(v1) = (uColor >> 9) & 0x7C00;
Ritor1
parents:
diff changeset
1166 LOWORD(v2) = (uColor >> 6) & 0x3E0;
Ritor1
parents:
diff changeset
1167 v3 = v2 | v1;
Ritor1
parents:
diff changeset
1168 v4 = (unsigned __int8)uColor >> 3;
Ritor1
parents:
diff changeset
1169 v5 = uColor >> 16;
Ritor1
parents:
diff changeset
1170 LOWORD(v5) = v5 & 0x8000;
Ritor1
parents:
diff changeset
1171 return v5 | v4 | v3;
Ritor1
parents:
diff changeset
1172 }
Ritor1
parents:
diff changeset
1173
Ritor1
parents:
diff changeset
1174 //----- (0042690D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1175 int __fastcall _42690D_colors_cvt(unsigned int a1)
Ritor1
parents:
diff changeset
1176 {
Ritor1
parents:
diff changeset
1177 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
1178 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
1179
Ritor1
parents:
diff changeset
1180 v1 = a1 >> 8;
Ritor1
parents:
diff changeset
1181 v2 = a1 >> 5;
Ritor1
parents:
diff changeset
1182 LOWORD(v1) = (a1 >> 8) & 0xF800;
Ritor1
parents:
diff changeset
1183 LOWORD(v2) = (a1 >> 5) & 0x7E0;
Ritor1
parents:
diff changeset
1184 return ((unsigned __int8)a1 >> 3) | v2 | v1;
Ritor1
parents:
diff changeset
1185 }
Ritor1
parents:
diff changeset
1186 //----- (00426947) --------------------------------------------------------
Ritor1
parents:
diff changeset
1187 void __cdecl sub_426947()
Ritor1
parents:
diff changeset
1188 {
893
4676774b225c GuildDialogue fix
Ritor1
parents: 890
diff changeset
1189 stru_50C198.field_0 = 0;
0
Ritor1
parents:
diff changeset
1190 dword_50C994 = 0;
Ritor1
parents:
diff changeset
1191 dword_50C998_turnbased_icon_1A = 0;
Ritor1
parents:
diff changeset
1192 }
Ritor1
parents:
diff changeset
1193 // 50C968: using guessed type int dword_50C968;
Ritor1
parents:
diff changeset
1194 // 50C994: using guessed type int dword_50C994;
Ritor1
parents:
diff changeset
1195 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
Ritor1
parents:
diff changeset
1196
Ritor1
parents:
diff changeset
1197 //----- (00426A5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1198 void stru319::LootActor(Actor *pActor)
Ritor1
parents:
diff changeset
1199 {
Ritor1
parents:
diff changeset
1200 signed int v2; // edi@1
Ritor1
parents:
diff changeset
1201 char v3; // zf@1
Ritor1
parents:
diff changeset
1202 unsigned int v4; // eax@13
Ritor1
parents:
diff changeset
1203 unsigned int v5; // esi@13
Ritor1
parents:
diff changeset
1204 int v6; // eax@14
Ritor1
parents:
diff changeset
1205 unsigned __int8 v7; // al@30
Ritor1
parents:
diff changeset
1206 Party *v8; // esi@34
Ritor1
parents:
diff changeset
1207 char *v9; // [sp-4h] [bp-3Ch]@10
Ritor1
parents:
diff changeset
1208 char *v10; // [sp-4h] [bp-3Ch]@31
Ritor1
parents:
diff changeset
1209 char *v11; // [sp-4h] [bp-3Ch]@38
Ritor1
parents:
diff changeset
1210 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1
Ritor1
parents:
diff changeset
1211 int v13; // [sp+30h] [bp-8h]@1
Ritor1
parents:
diff changeset
1212 int v14; // [sp+34h] [bp-4h]@1
Ritor1
parents:
diff changeset
1213
Ritor1
parents:
diff changeset
1214 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1215 Dst.Reset();
Ritor1
parents:
diff changeset
1216 v2 = 0;
Ritor1
parents:
diff changeset
1217 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0;
Ritor1
parents:
diff changeset
1218 v13 = 0;
Ritor1
parents:
diff changeset
1219 v14 = 0;
Ritor1
parents:
diff changeset
1220 if ( v3 )
Ritor1
parents:
diff changeset
1221 {
Ritor1
parents:
diff changeset
1222 if ( !pActor->pMonsterInfo.uTreasureDiceRolls )
Ritor1
parents:
diff changeset
1223 goto LABEL_9;
Ritor1
parents:
diff changeset
1224 do
Ritor1
parents:
diff changeset
1225 {
Ritor1
parents:
diff changeset
1226 ++v2;
Ritor1
parents:
diff changeset
1227 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1;
Ritor1
parents:
diff changeset
1228 }
Ritor1
parents:
diff changeset
1229 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls );
Ritor1
parents:
diff changeset
1230 }
Ritor1
parents:
diff changeset
1231 else
Ritor1
parents:
diff changeset
1232 {
Ritor1
parents:
diff changeset
1233 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 )
Ritor1
parents:
diff changeset
1234 goto LABEL_9;
377
243418228760 GetIdentifiedName
Gloval
parents: 370
diff changeset
1235 v14 = pActor->array_000234[3].uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
1236 pActor->array_000234[3].Reset();
Ritor1
parents:
diff changeset
1237 }
Ritor1
parents:
diff changeset
1238 if ( v14 )
Ritor1
parents:
diff changeset
1239 {
Ritor1
parents:
diff changeset
1240 party_finds_gold(v14, 0);
Ritor1
parents:
diff changeset
1241 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1242 }
Ritor1
parents:
diff changeset
1243 LABEL_9:
Ritor1
parents:
diff changeset
1244 if ( pActor->uCarriedItemID )
Ritor1
parents:
diff changeset
1245 {
Ritor1
parents:
diff changeset
1246 Dst.Reset();
Ritor1
parents:
diff changeset
1247 Dst.uItemID = pActor->uCarriedItemID;
Ritor1
parents:
diff changeset
1248 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
1249 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1250 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[490], v14, v9);
0
Ritor1
parents:
diff changeset
1251 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1252 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[471], v9);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1253 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
1254 v4 = Dst.uItemID;
Ritor1
parents:
diff changeset
1255 v5 = Dst.uItemID;
Ritor1
parents:
diff changeset
1256 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 )
Ritor1
parents:
diff changeset
1257 {
Ritor1
parents:
diff changeset
1258 v5 = Dst.uItemID;
Ritor1
parents:
diff changeset
1259 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1;
Ritor1
parents:
diff changeset
1260 Dst.uNumCharges = v6;
Ritor1
parents:
diff changeset
1261 Dst.uMaxCharges = v6;
Ritor1
parents:
diff changeset
1262 v4 = Dst.uItemID;
Ritor1
parents:
diff changeset
1263 }
Ritor1
parents:
diff changeset
1264 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 )
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 569
diff changeset
1265 Dst.uEnchantmentType = 2 * rand() % 4 + 2;
0
Ritor1
parents:
diff changeset
1266 pItemsTable->SetSpecialBonus(&Dst);
Ritor1
parents:
diff changeset
1267 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
1268 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
1269 pActor->uCarriedItemID = 0;
Ritor1
parents:
diff changeset
1270 if ( pActor->array_000234[0].uItemID )
Ritor1
parents:
diff changeset
1271 {
Ritor1
parents:
diff changeset
1272 if ( !pParty->AddItem(pActor->array_000234) )
Ritor1
parents:
diff changeset
1273 {
Ritor1
parents:
diff changeset
1274 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1275 pParty->SetHoldingItem(pActor->array_000234);
Ritor1
parents:
diff changeset
1276 }
Ritor1
parents:
diff changeset
1277 pActor->array_000234[0].Reset();
Ritor1
parents:
diff changeset
1278 }
Ritor1
parents:
diff changeset
1279 if ( pActor->array_000234[1].uItemID )
Ritor1
parents:
diff changeset
1280 {
Ritor1
parents:
diff changeset
1281 if ( !pParty->AddItem(&pActor->array_000234[1]) )
Ritor1
parents:
diff changeset
1282 {
Ritor1
parents:
diff changeset
1283 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1284 pParty->SetHoldingItem(&pActor->array_000234[1]);
Ritor1
parents:
diff changeset
1285 }
Ritor1
parents:
diff changeset
1286 pActor->array_000234[1].Reset();
Ritor1
parents:
diff changeset
1287 }
Ritor1
parents:
diff changeset
1288 LABEL_55:
Ritor1
parents:
diff changeset
1289 pActor->Remove();
Ritor1
parents:
diff changeset
1290 return;
Ritor1
parents:
diff changeset
1291 }
Ritor1
parents:
diff changeset
1292 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes )
Ritor1
parents:
diff changeset
1293 {
Ritor1
parents:
diff changeset
1294 if ( pActor->array_000234[3].uItemID )
Ritor1
parents:
diff changeset
1295 {
Ritor1
parents:
diff changeset
1296 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst));
Ritor1
parents:
diff changeset
1297 pActor->array_000234[3].Reset();
Ritor1
parents:
diff changeset
1298 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
1299 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1300 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
0
Ritor1
parents:
diff changeset
1301 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1302 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1303 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
1304 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
1305 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
1306 v13 = 1;
Ritor1
parents:
diff changeset
1307 }
Ritor1
parents:
diff changeset
1308 goto LABEL_44;
Ritor1
parents:
diff changeset
1309 }
Ritor1
parents:
diff changeset
1310 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 )
Ritor1
parents:
diff changeset
1311 {
Ritor1
parents:
diff changeset
1312 LABEL_44:
Ritor1
parents:
diff changeset
1313 v8 = pParty;
Ritor1
parents:
diff changeset
1314 goto LABEL_45;
Ritor1
parents:
diff changeset
1315 }
Ritor1
parents:
diff changeset
1316 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst);
Ritor1
parents:
diff changeset
1317 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
1318 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1319 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);
0
Ritor1
parents:
diff changeset
1320 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1321 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1322 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
1323 v8 = pParty;
Ritor1
parents:
diff changeset
1324 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
1325 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
1326 v13 = 1;
Ritor1
parents:
diff changeset
1327 LABEL_45:
Ritor1
parents:
diff changeset
1328 if ( pActor->array_000234[0].uItemID )
Ritor1
parents:
diff changeset
1329 {
Ritor1
parents:
diff changeset
1330 if ( !v8->AddItem(pActor->array_000234) )
Ritor1
parents:
diff changeset
1331 {
Ritor1
parents:
diff changeset
1332 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1333 v8->SetHoldingItem(pActor->array_000234);
Ritor1
parents:
diff changeset
1334 v13 = 1;
Ritor1
parents:
diff changeset
1335 }
Ritor1
parents:
diff changeset
1336 pActor->array_000234[0].Reset();
Ritor1
parents:
diff changeset
1337 }
Ritor1
parents:
diff changeset
1338 if ( pActor->array_000234[1].uItemID )
Ritor1
parents:
diff changeset
1339 {
Ritor1
parents:
diff changeset
1340 if ( !v8->AddItem(&pActor->array_000234[1]) )
Ritor1
parents:
diff changeset
1341 {
Ritor1
parents:
diff changeset
1342 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1343 v8->SetHoldingItem(&pActor->array_000234[1]);
Ritor1
parents:
diff changeset
1344 v13 = 1;
Ritor1
parents:
diff changeset
1345 }
Ritor1
parents:
diff changeset
1346 pActor->array_000234[1].Reset();
Ritor1
parents:
diff changeset
1347 }
Ritor1
parents:
diff changeset
1348 if ( !v13 || rand() % 100 < 90 )
Ritor1
parents:
diff changeset
1349 goto LABEL_55;
Ritor1
parents:
diff changeset
1350 }
Ritor1
parents:
diff changeset
1351
Ritor1
parents:
diff changeset
1352 //----- (00426E10) --------------------------------------------------------
Ritor1
parents:
diff changeset
1353 int stru319::which_player_would_attack(Actor *pActor)
Ritor1
parents:
diff changeset
1354 {
Ritor1
parents:
diff changeset
1355 signed int v2; // ebx@1
Ritor1
parents:
diff changeset
1356 int v3; // ecx@2
Ritor1
parents:
diff changeset
1357 signed int v4; // edx@3
Ritor1
parents:
diff changeset
1358 char v5; // zf@3
Ritor1
parents:
diff changeset
1359 unsigned int v6; // eax@3
Ritor1
parents:
diff changeset
1360 int v7; // eax@6
Ritor1
parents:
diff changeset
1361 int v8; // eax@7
Ritor1
parents:
diff changeset
1362 int v9; // eax@8
Ritor1
parents:
diff changeset
1363 int v10; // eax@9
Ritor1
parents:
diff changeset
1364 int v11; // eax@10
Ritor1
parents:
diff changeset
1365 int v12; // eax@11
Ritor1
parents:
diff changeset
1366 int v13; // esi@35
Ritor1
parents:
diff changeset
1367 signed int v14; // edi@37
Ritor1
parents:
diff changeset
1368 enum CHARACTER_RACE v15; // eax@44
Ritor1
parents:
diff changeset
1369 Player *v16; // ecx@47
Ritor1
parents:
diff changeset
1370 unsigned __int8 v17; // sf@50
Ritor1
parents:
diff changeset
1371 unsigned __int8 v18; // of@50
Ritor1
parents:
diff changeset
1372 int v19; // esi@52
Ritor1
parents:
diff changeset
1373 Player *v20; // ecx@53
Ritor1
parents:
diff changeset
1374 int result; // eax@57
Ritor1
parents:
diff changeset
1375 int v22[16]; // [sp+8h] [bp-140h]@3
Ritor1
parents:
diff changeset
1376 int v23[60]; // [sp+48h] [bp-100h]@48
Ritor1
parents:
diff changeset
1377 int v24; // [sp+138h] [bp-10h]@2
Ritor1
parents:
diff changeset
1378 int v25; // [sp+13Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
1379 int v26; // [sp+140h] [bp-8h]@1
Ritor1
parents:
diff changeset
1380 int v27; // [sp+144h] [bp-4h]@1
Ritor1
parents:
diff changeset
1381
Ritor1
parents:
diff changeset
1382 v27 = -1;
Ritor1
parents:
diff changeset
1383 v26 = -1;
Ritor1
parents:
diff changeset
1384 v25 = -1;
Ritor1
parents:
diff changeset
1385 v2 = 0;
Ritor1
parents:
diff changeset
1386 if ( pActor->pMonsterInfo.uAttackPreference )
Ritor1
parents:
diff changeset
1387 {
Ritor1
parents:
diff changeset
1388 v3 = 0;
Ritor1
parents:
diff changeset
1389 v24 = 0;
Ritor1
parents:
diff changeset
1390 do
Ritor1
parents:
diff changeset
1391 {
Ritor1
parents:
diff changeset
1392 v4 = 1;
Ritor1
parents:
diff changeset
1393 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3);
Ritor1
parents:
diff changeset
1394 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0;
Ritor1
parents:
diff changeset
1395 v22[v3] = v6;
Ritor1
parents:
diff changeset
1396 if ( !v5 )
Ritor1
parents:
diff changeset
1397 {
Ritor1
parents:
diff changeset
1398 if ( (signed int)v6 > 128 )
Ritor1
parents:
diff changeset
1399 {
Ritor1
parents:
diff changeset
1400 switch ( v6 )
Ritor1
parents:
diff changeset
1401 {
Ritor1
parents:
diff changeset
1402 case 0x100u:
Ritor1
parents:
diff changeset
1403 v27 = 8;
Ritor1
parents:
diff changeset
1404 break;
Ritor1
parents:
diff changeset
1405 case 0x200u:
Ritor1
parents:
diff changeset
1406 v25 = 0;
Ritor1
parents:
diff changeset
1407 break;
Ritor1
parents:
diff changeset
1408 case 0x400u:
Ritor1
parents:
diff changeset
1409 v25 = 1;
Ritor1
parents:
diff changeset
1410 break;
Ritor1
parents:
diff changeset
1411 case 0x800u:
Ritor1
parents:
diff changeset
1412 v26 = 0;
Ritor1
parents:
diff changeset
1413 break;
Ritor1
parents:
diff changeset
1414 case 0x1000u:
Ritor1
parents:
diff changeset
1415 v26 = 1;
Ritor1
parents:
diff changeset
1416 break;
Ritor1
parents:
diff changeset
1417 case 0x2000u:
Ritor1
parents:
diff changeset
1418 v26 = 3;
Ritor1
parents:
diff changeset
1419 break;
Ritor1
parents:
diff changeset
1420 case 0x4000u:
Ritor1
parents:
diff changeset
1421 v26 = 2;
Ritor1
parents:
diff changeset
1422 break;
Ritor1
parents:
diff changeset
1423 }
Ritor1
parents:
diff changeset
1424 }
Ritor1
parents:
diff changeset
1425 else
Ritor1
parents:
diff changeset
1426 {
Ritor1
parents:
diff changeset
1427 if ( v6 == 128 )
Ritor1
parents:
diff changeset
1428 {
Ritor1
parents:
diff changeset
1429 v27 = 4;
Ritor1
parents:
diff changeset
1430 }
Ritor1
parents:
diff changeset
1431 else
Ritor1
parents:
diff changeset
1432 {
Ritor1
parents:
diff changeset
1433 v7 = v6 - 1;
Ritor1
parents:
diff changeset
1434 if ( v7 )
Ritor1
parents:
diff changeset
1435 {
Ritor1
parents:
diff changeset
1436 v8 = v7 - 1;
Ritor1
parents:
diff changeset
1437 if ( v8 )
Ritor1
parents:
diff changeset
1438 {
Ritor1
parents:
diff changeset
1439 v9 = v8 - 2;
Ritor1
parents:
diff changeset
1440 if ( v9 )
Ritor1
parents:
diff changeset
1441 {
Ritor1
parents:
diff changeset
1442 v10 = v9 - 4;
Ritor1
parents:
diff changeset
1443 if ( v10 )
Ritor1
parents:
diff changeset
1444 {
Ritor1
parents:
diff changeset
1445 v11 = v10 - 8;
Ritor1
parents:
diff changeset
1446 if ( v11 )
Ritor1
parents:
diff changeset
1447 {
Ritor1
parents:
diff changeset
1448 v12 = v11 - 16;
Ritor1
parents:
diff changeset
1449 if ( v12 )
Ritor1
parents:
diff changeset
1450 {
Ritor1
parents:
diff changeset
1451 if ( v12 == 32 )
Ritor1
parents:
diff changeset
1452 v27 = 20;
Ritor1
parents:
diff changeset
1453 }
Ritor1
parents:
diff changeset
1454 else
Ritor1
parents:
diff changeset
1455 {
Ritor1
parents:
diff changeset
1456 v27 = 32;
Ritor1
parents:
diff changeset
1457 }
Ritor1
parents:
diff changeset
1458 }
Ritor1
parents:
diff changeset
1459 else
Ritor1
parents:
diff changeset
1460 {
Ritor1
parents:
diff changeset
1461 v27 = 24;
Ritor1
parents:
diff changeset
1462 }
Ritor1
parents:
diff changeset
1463 }
Ritor1
parents:
diff changeset
1464 else
Ritor1
parents:
diff changeset
1465 {
Ritor1
parents:
diff changeset
1466 v27 = 28;
Ritor1
parents:
diff changeset
1467 }
Ritor1
parents:
diff changeset
1468 }
Ritor1
parents:
diff changeset
1469 else
Ritor1
parents:
diff changeset
1470 {
Ritor1
parents:
diff changeset
1471 v27 = 16;
Ritor1
parents:
diff changeset
1472 }
Ritor1
parents:
diff changeset
1473 }
Ritor1
parents:
diff changeset
1474 else
Ritor1
parents:
diff changeset
1475 {
Ritor1
parents:
diff changeset
1476 v27 = 12;
Ritor1
parents:
diff changeset
1477 }
Ritor1
parents:
diff changeset
1478 }
Ritor1
parents:
diff changeset
1479 else
Ritor1
parents:
diff changeset
1480 {
Ritor1
parents:
diff changeset
1481 v27 = 0;
Ritor1
parents:
diff changeset
1482 }
Ritor1
parents:
diff changeset
1483 }
Ritor1
parents:
diff changeset
1484 }
Ritor1
parents:
diff changeset
1485 v2 = 0;
Ritor1
parents:
diff changeset
1486 v13 = 0;
Ritor1
parents:
diff changeset
1487 while ( 1 )
Ritor1
parents:
diff changeset
1488 {
Ritor1
parents:
diff changeset
1489 v14 = 0;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 112
diff changeset
1490 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType )
0
Ritor1
parents:
diff changeset
1491 v14 = v4;
Ritor1
parents:
diff changeset
1492 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex )
Ritor1
parents:
diff changeset
1493 v14 = v4;
Ritor1
parents:
diff changeset
1494 if ( v26 != -1 )
Ritor1
parents:
diff changeset
1495 {
Ritor1
parents:
diff changeset
1496 v15 = pPlayers[v13 + 1]->GetRace();
Ritor1
parents:
diff changeset
1497 if ( v26 == v15 )
Ritor1
parents:
diff changeset
1498 v14 = 1;
Ritor1
parents:
diff changeset
1499 }
Ritor1
parents:
diff changeset
1500 if ( v14 == 1 )
Ritor1
parents:
diff changeset
1501 {
Ritor1
parents:
diff changeset
1502 v16 = pPlayers[v13 + 1];
Ritor1
parents:
diff changeset
1503 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) )
Ritor1
parents:
diff changeset
1504 v23[v2++] = v13;
Ritor1
parents:
diff changeset
1505 }
Ritor1
parents:
diff changeset
1506 ++v13;
Ritor1
parents:
diff changeset
1507 if ( v13 >= 4 )
Ritor1
parents:
diff changeset
1508 break;
Ritor1
parents:
diff changeset
1509 v4 = 1;
Ritor1
parents:
diff changeset
1510 }
Ritor1
parents:
diff changeset
1511 }
Ritor1
parents:
diff changeset
1512 v3 = v24 + 1;
Ritor1
parents:
diff changeset
1513 v18 = __OFSUB__(v24 + 1, 15);
Ritor1
parents:
diff changeset
1514 v17 = v24++ - 14 < 0;
Ritor1
parents:
diff changeset
1515 }
Ritor1
parents:
diff changeset
1516 while ( v17 ^ v18 );
Ritor1
parents:
diff changeset
1517 if ( v2 )
Ritor1
parents:
diff changeset
1518 goto LABEL_61;
Ritor1
parents:
diff changeset
1519 }
Ritor1
parents:
diff changeset
1520 v19 = 0;
Ritor1
parents:
diff changeset
1521 do
Ritor1
parents:
diff changeset
1522 {
Ritor1
parents:
diff changeset
1523 v20 = pPlayers[v19 + 1];
Ritor1
parents:
diff changeset
1524 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) )
Ritor1
parents:
diff changeset
1525 v23[v2++] = v19;
Ritor1
parents:
diff changeset
1526 ++v19;
Ritor1
parents:
diff changeset
1527 }
Ritor1
parents:
diff changeset
1528 while ( v19 < 4 );
Ritor1
parents:
diff changeset
1529 if ( v2 )
Ritor1
parents:
diff changeset
1530 LABEL_61:
Ritor1
parents:
diff changeset
1531 result = v23[rand() % v2];
Ritor1
parents:
diff changeset
1532 else
Ritor1
parents:
diff changeset
1533 result = 0;
Ritor1
parents:
diff changeset
1534 return result;
Ritor1
parents:
diff changeset
1535 }
Ritor1
parents:
diff changeset
1536
Ritor1
parents:
diff changeset
1537 //----- (0042704B) --------------------------------------------------------
Ritor1
parents:
diff changeset
1538 bool stru319::special_ability_use_check(Actor *pActor, int a2)
Ritor1
parents:
diff changeset
1539 {
Ritor1
parents:
diff changeset
1540 stru319 *v3; // edi@1
Ritor1
parents:
diff changeset
1541 signed int v4; // ebx@5
Ritor1
parents:
diff changeset
1542 signed int v5; // edi@5
Ritor1
parents:
diff changeset
1543
Ritor1
parents:
diff changeset
1544 v3 = this;
Ritor1
parents:
diff changeset
1545 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2
Ritor1
parents:
diff changeset
1546 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u
Ritor1
parents:
diff changeset
1547 && rand() % 100 < 5 )
Ritor1
parents:
diff changeset
1548 pActor->_44FD29(a2);
Ritor1
parents:
diff changeset
1549 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID);
Ritor1
parents:
diff changeset
1550 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID);
Ritor1
parents:
diff changeset
1551 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance )
Ritor1
parents:
diff changeset
1552 return 2;
Ritor1
parents:
diff changeset
1553 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance )
Ritor1
parents:
diff changeset
1554 return 3;
Ritor1
parents:
diff changeset
1555 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance;
Ritor1
parents:
diff changeset
1556 }
Ritor1
parents:
diff changeset
1557
Ritor1
parents:
diff changeset
1558 //----- (00427102) --------------------------------------------------------
Ritor1
parents:
diff changeset
1559 int stru319::_427102(Actor *pActor, signed int a2)
Ritor1
parents:
diff changeset
1560 {
Ritor1
parents:
diff changeset
1561 unsigned __int8 v3; // cf@11
Ritor1
parents:
diff changeset
1562 unsigned __int8 v4; // zf@11
Ritor1
parents:
diff changeset
1563 SpellBuff *v6; // ecx@46
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1564 Player *v7; // esi@49
0
Ritor1
parents:
diff changeset
1565 signed int v8; // edx@50
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1566 SpellBuff *v9; // ecx@50
0
Ritor1
parents:
diff changeset
1567
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1568 switch(a2)
0
Ritor1
parents:
diff changeset
1569 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1570 case 77:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1571 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1572 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1573 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1574 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1575 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1576 case 80:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1577 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1578 v6 = pParty->pPartyBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1579 while ( (signed __int64)v6->uExpireTime <= 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1580 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1581 ++v6;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1582 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1583 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1584 v7 = pParty->pPlayers;//[0].pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1585 v8 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1586 v9 = v7->pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1587 while ( v9->uExpireTime <= 0i64 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1588 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1589 ++v8;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1590 ++v9;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1591 if ( v8 >= 24 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1592 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1593 ++v7;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1594 if ( v7 <= &pParty->pPlayers[3] )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1595 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1596 v8 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1597 v9 = v7->pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1598 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1599 else
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1600 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1601 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1602 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1603 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1604 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1605 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1606 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1607 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1608 case 85:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1609 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1610 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1611 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1612 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1613 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1614 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1615 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1616 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1617 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1618 case 86:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1619 {
0
Ritor1
parents:
diff changeset
1620 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1621 return 1;
0
Ritor1
parents:
diff changeset
1622 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1623 return 0;
0
Ritor1
parents:
diff changeset
1624 v3 = 0;
Ritor1
parents:
diff changeset
1625 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1626 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1627 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1628 case 95:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1629 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1630 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1631 return 1;
0
Ritor1
parents:
diff changeset
1632 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1633 return 0;
0
Ritor1
parents:
diff changeset
1634 v3 = 0;
Ritor1
parents:
diff changeset
1635 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1636 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1637 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1638 case 73:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1639 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1640 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1641 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1642 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1643 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1644 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1645 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1646 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1647 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1648 case 5:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1649 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1650 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1651 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1652 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1653 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1654 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1655 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1656 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1657 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1658 case 17:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1659 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1660 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1661 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1662 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1663 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1664 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1665 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1666 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1667 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1668 case 38:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1669 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1670 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1671 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1672 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1673 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1674 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1675 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1676 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1677 case 46:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1678 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1679 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 )
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1680 return 1;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1681 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1682 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1683 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1684 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1685 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1686 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1687 case 47:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1688 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1689 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1690 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1691 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1692 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1693 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1694 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1695 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1696 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1697 case 51:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1698 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1699 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1700 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1701 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1702 {
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1703 v3 = 0;
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1704 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0;
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1705 }
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1706 else
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1707 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1708 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1709 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1710 default:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1711 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1712 return 1;
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1713 }
0
Ritor1
parents:
diff changeset
1714 }
Ritor1
parents:
diff changeset
1715 if ( !(v3 | v4) )
Ritor1
parents:
diff changeset
1716 return 0;
Ritor1
parents:
diff changeset
1717 return 1;
Ritor1
parents:
diff changeset
1718 }
Ritor1
parents:
diff changeset
1719
Ritor1
parents:
diff changeset
1720 //----- (004272F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1721 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4)
Ritor1
parents:
diff changeset
1722 {
Ritor1
parents:
diff changeset
1723 signed int v5; // esi@1
Ritor1
parents:
diff changeset
1724 signed int v6; // edi@1
Ritor1
parents:
diff changeset
1725 int v7; // esi@8
Ritor1
parents:
diff changeset
1726 int v8; // eax@9
Ritor1
parents:
diff changeset
1727 int v9; // edx@11
Ritor1
parents:
diff changeset
1728 int v10; // edx@13
Ritor1
parents:
diff changeset
1729 int v11; // esi@13
Ritor1
parents:
diff changeset
1730 unsigned __int8 v12; // sf@13
Ritor1
parents:
diff changeset
1731 unsigned __int8 v13; // of@13
Ritor1
parents:
diff changeset
1732 int v14; // edx@14
Ritor1
parents:
diff changeset
1733 int v15; // eax@14
Ritor1
parents:
diff changeset
1734 signed int result; // eax@17
Ritor1
parents:
diff changeset
1735
Ritor1
parents:
diff changeset
1736 v5 = pActor->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
1737 v6 = 0;
Ritor1
parents:
diff changeset
1738 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1739 v5 /= 2;
Ritor1
parents:
diff changeset
1740 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1741 v6 = pActor->pActorBuffs[15].uPower;
Ritor1
parents:
diff changeset
1742 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 )
Ritor1
parents:
diff changeset
1743 v6 = pActor->pActorBuffs[16].uPower;
Ritor1
parents:
diff changeset
1744 v7 = v6 + v5;
Ritor1
parents:
diff changeset
1745 if ( a3 )
Ritor1
parents:
diff changeset
1746 v8 = pPlayer->GetRangedAttack();
Ritor1
parents:
diff changeset
1747 else
Ritor1
parents:
diff changeset
1748 v8 = pPlayer->GetActualAttack(0);
Ritor1
parents:
diff changeset
1749 v9 = rand() % (v7 + 2 * v8 + 30);
Ritor1
parents:
diff changeset
1750 if ( a3 == 2 )
Ritor1
parents:
diff changeset
1751 {
Ritor1
parents:
diff changeset
1752 v14 = a4 + v9;
Ritor1
parents:
diff changeset
1753 v15 = ((v7 + 15) >> 1) + v7 + 15;
Ritor1
parents:
diff changeset
1754 }
Ritor1
parents:
diff changeset
1755 else
Ritor1
parents:
diff changeset
1756 {
Ritor1
parents:
diff changeset
1757 if ( a3 != 3 )
Ritor1
parents:
diff changeset
1758 {
Ritor1
parents:
diff changeset
1759 v10 = a4 + v9;
Ritor1
parents:
diff changeset
1760 v11 = v7 + 15;
Ritor1
parents:
diff changeset
1761 v13 = __OFSUB__(v10, v11);
Ritor1
parents:
diff changeset
1762 v12 = v10 - v11 < 0;
Ritor1
parents:
diff changeset
1763 goto LABEL_16;
Ritor1
parents:
diff changeset
1764 }
Ritor1
parents:
diff changeset
1765 v14 = a4 + v9;
Ritor1
parents:
diff changeset
1766 v15 = 2 * v7 + 30;
Ritor1
parents:
diff changeset
1767 }
Ritor1
parents:
diff changeset
1768 v13 = __OFSUB__(v14, v15);
Ritor1
parents:
diff changeset
1769 v12 = v14 - v15 < 0;
Ritor1
parents:
diff changeset
1770 LABEL_16:
Ritor1
parents:
diff changeset
1771 if ( v12 ^ v13 )
Ritor1
parents:
diff changeset
1772 result = 0;
Ritor1
parents:
diff changeset
1773 else
Ritor1
parents:
diff changeset
1774 result = 1;
Ritor1
parents:
diff changeset
1775 return result;
Ritor1
parents:
diff changeset
1776 }
Ritor1
parents:
diff changeset
1777
Ritor1
parents:
diff changeset
1778 //----- (004273BB) --------------------------------------------------------
Ritor1
parents:
diff changeset
1779 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4)
Ritor1
parents:
diff changeset
1780 {
Ritor1
parents:
diff changeset
1781 Actor *v5; // ecx@1
Ritor1
parents:
diff changeset
1782 signed int v6; // ebx@1
Ritor1
parents:
diff changeset
1783 signed int v7; // esi@1
Ritor1
parents:
diff changeset
1784 unsigned __int8 v8; // zf@1
Ritor1
parents:
diff changeset
1785 unsigned __int8 v9; // sf@1
Ritor1
parents:
diff changeset
1786 int v10; // ebx@10
Ritor1
parents:
diff changeset
1787 signed int a2a; // [sp+18h] [bp+Ch]@1
Ritor1
parents:
diff changeset
1788
Ritor1
parents:
diff changeset
1789 v5 = a2;
Ritor1
parents:
diff changeset
1790 v6 = a2->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
1791 v7 = 0;
Ritor1
parents:
diff changeset
1792 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0;
Ritor1
parents:
diff changeset
1793 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0;
Ritor1
parents:
diff changeset
1794 a2a = 0;
Ritor1
parents:
diff changeset
1795 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) )
Ritor1
parents:
diff changeset
1796 v6 /= 2;
Ritor1
parents:
diff changeset
1797 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1798 v7 = v5->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1799 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 )
Ritor1
parents:
diff changeset
1800 v7 = v5->pActorBuffs[16].uPower;
Ritor1
parents:
diff changeset
1801 v10 = v7 + v6;
Ritor1
parents:
diff changeset
1802 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1803 a2a = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1804 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a )
Ritor1
parents:
diff changeset
1805 a2a = pActor->pActorBuffs[17].uPower;
Ritor1
parents:
diff changeset
1806 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1807 {
Ritor1
parents:
diff changeset
1808 a2a += pActor->pActorBuffs[11].uPower;
Ritor1
parents:
diff changeset
1809 pActor->pActorBuffs[11].Reset();
Ritor1
parents:
diff changeset
1810 }
Ritor1
parents:
diff changeset
1811 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5;
Ritor1
parents:
diff changeset
1812 }
Ritor1
parents:
diff changeset
1813
Ritor1
parents:
diff changeset
1814 //----- (004274AD) --------------------------------------------------------
Ritor1
parents:
diff changeset
1815 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer)
Ritor1
parents:
diff changeset
1816 {
Ritor1
parents:
diff changeset
1817 signed int v3; // edi@1
Ritor1
parents:
diff changeset
1818 signed int v4; // esi@8
Ritor1
parents:
diff changeset
1819 int v5; // esi@8
Ritor1
parents:
diff changeset
1820
Ritor1
parents:
diff changeset
1821 v3 = 0;
Ritor1
parents:
diff changeset
1822 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1823 v3 = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1824 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 )
Ritor1
parents:
diff changeset
1825 v3 = pActor->pActorBuffs[17].uPower;
Ritor1
parents:
diff changeset
1826 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1827 {
Ritor1
parents:
diff changeset
1828 v3 += pActor->pActorBuffs[11].uPower;
Ritor1
parents:
diff changeset
1829 pActor->pActorBuffs[11].Reset();
Ritor1
parents:
diff changeset
1830 }
Ritor1
parents:
diff changeset
1831 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10;
Ritor1
parents:
diff changeset
1832 v5 = rand() % v4 + 1;
Ritor1
parents:
diff changeset
1833 return v3 + v5 > pPlayer->GetActualAC() + 5;
Ritor1
parents:
diff changeset
1834 }
Ritor1
parents:
diff changeset
1835
Ritor1
parents:
diff changeset
1836 //----- (00427546) --------------------------------------------------------
Ritor1
parents:
diff changeset
1837 int stru319::_427546(int a2)
Ritor1
parents:
diff changeset
1838 {
Ritor1
parents:
diff changeset
1839 int result; // eax@2
Ritor1
parents:
diff changeset
1840
Ritor1
parents:
diff changeset
1841 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
1842 {
Ritor1
parents:
diff changeset
1843 if ( a2 >= 1 )
Ritor1
parents:
diff changeset
1844 result = (a2 >= 2) + 2;
Ritor1
parents:
diff changeset
1845 else
Ritor1
parents:
diff changeset
1846 result = 1;
Ritor1
parents:
diff changeset
1847 }
Ritor1
parents:
diff changeset
1848 else
Ritor1
parents:
diff changeset
1849 {
Ritor1
parents:
diff changeset
1850 result = 0;
Ritor1
parents:
diff changeset
1851 }
Ritor1
parents:
diff changeset
1852 return result;
Ritor1
parents:
diff changeset
1853 }
Ritor1
parents:
diff changeset
1854
Ritor1
parents:
diff changeset
1855 //----- (0042756B) --------------------------------------------------------
Ritor1
parents:
diff changeset
1856 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3)
Ritor1
parents:
diff changeset
1857 {
Ritor1
parents:
diff changeset
1858 int v4; // edx@1
Ritor1
parents:
diff changeset
1859 int v5; // ecx@1
Ritor1
parents:
diff changeset
1860 signed int v6; // eax@4
Ritor1
parents:
diff changeset
1861 signed int result; // eax@17
Ritor1
parents:
diff changeset
1862 signed int v8; // esi@18
Ritor1
parents:
diff changeset
1863
Ritor1
parents:
diff changeset
1864 v4 = 0;
Ritor1
parents:
diff changeset
1865 v5 = 0;
Ritor1
parents:
diff changeset
1866 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1867 v5 = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1868 switch ( a2 )
Ritor1
parents:
diff changeset
1869 {
Ritor1
parents:
diff changeset
1870 case 4:
Ritor1
parents:
diff changeset
1871 v6 = pActor->pMonsterInfo.uResPhysical;
Ritor1
parents:
diff changeset
1872 break;
Ritor1
parents:
diff changeset
1873 case 0:
Ritor1
parents:
diff changeset
1874 v6 = pActor->pMonsterInfo.uResFire;
Ritor1
parents:
diff changeset
1875 goto LABEL_12;
Ritor1
parents:
diff changeset
1876 case 1:
Ritor1
parents:
diff changeset
1877 v6 = pActor->pMonsterInfo.uResAir;
Ritor1
parents:
diff changeset
1878 goto LABEL_12;
Ritor1
parents:
diff changeset
1879 case 2:
Ritor1
parents:
diff changeset
1880 v6 = pActor->pMonsterInfo.uResWater;
Ritor1
parents:
diff changeset
1881 goto LABEL_12;
Ritor1
parents:
diff changeset
1882 case 3:
Ritor1
parents:
diff changeset
1883 v6 = pActor->pMonsterInfo.uResEarth;
Ritor1
parents:
diff changeset
1884 goto LABEL_12;
Ritor1
parents:
diff changeset
1885 case 6:
Ritor1
parents:
diff changeset
1886 v6 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
1887 break;
Ritor1
parents:
diff changeset
1888 case 7:
Ritor1
parents:
diff changeset
1889 v6 = pActor->pMonsterInfo.uResMind;
Ritor1
parents:
diff changeset
1890 goto LABEL_12;
Ritor1
parents:
diff changeset
1891 case 8:
Ritor1
parents:
diff changeset
1892 v6 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
1893 LABEL_12:
Ritor1
parents:
diff changeset
1894 v4 = v5;
Ritor1
parents:
diff changeset
1895 break;
Ritor1
parents:
diff changeset
1896 case 9:
Ritor1
parents:
diff changeset
1897 v6 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
1898 break;
Ritor1
parents:
diff changeset
1899 case 10:
Ritor1
parents:
diff changeset
1900 v6 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
1901 break;
Ritor1
parents:
diff changeset
1902 default:
Ritor1
parents:
diff changeset
1903 v6 = 0;
Ritor1
parents:
diff changeset
1904 break;
Ritor1
parents:
diff changeset
1905 }
Ritor1
parents:
diff changeset
1906 if ( v6 < 200 )
Ritor1
parents:
diff changeset
1907 {
Ritor1
parents:
diff changeset
1908 v8 = v4 + v6 + 30;
Ritor1
parents:
diff changeset
1909 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1910 {
Ritor1
parents:
diff changeset
1911 a3 >>= 1;
Ritor1
parents:
diff changeset
1912 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1913 {
Ritor1
parents:
diff changeset
1914 a3 >>= 1;
Ritor1
parents:
diff changeset
1915 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1916 {
Ritor1
parents:
diff changeset
1917 a3 >>= 1;
Ritor1
parents:
diff changeset
1918 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1919 a3 >>= 1;
Ritor1
parents:
diff changeset
1920 }
Ritor1
parents:
diff changeset
1921 }
Ritor1
parents:
diff changeset
1922 }
Ritor1
parents:
diff changeset
1923 result = a3;
Ritor1
parents:
diff changeset
1924 }
Ritor1
parents:
diff changeset
1925 else
Ritor1
parents:
diff changeset
1926 {
Ritor1
parents:
diff changeset
1927 result = 0;
Ritor1
parents:
diff changeset
1928 }
Ritor1
parents:
diff changeset
1929 return result;
Ritor1
parents:
diff changeset
1930 }
Ritor1
parents:
diff changeset
1931
Ritor1
parents:
diff changeset
1932 //----- (00427662) --------------------------------------------------------
Ritor1
parents:
diff changeset
1933 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType)
Ritor1
parents:
diff changeset
1934 {
Ritor1
parents:
diff changeset
1935 Actor *v3; // edi@2
Ritor1
parents:
diff changeset
1936 signed int v4; // esi@2
Ritor1
parents:
diff changeset
1937 bool result; // eax@13
Ritor1
parents:
diff changeset
1938
Ritor1
parents:
diff changeset
1939 switch ( uType )
Ritor1
parents:
diff changeset
1940 {
Ritor1
parents:
diff changeset
1941 case 0u:
Ritor1
parents:
diff changeset
1942 v3 = pActor;
Ritor1
parents:
diff changeset
1943 v4 = pActor->pMonsterInfo.uResFire;
Ritor1
parents:
diff changeset
1944 goto LABEL_12;
Ritor1
parents:
diff changeset
1945 case 1u:
Ritor1
parents:
diff changeset
1946 v3 = pActor;
Ritor1
parents:
diff changeset
1947 v4 = pActor->pMonsterInfo.uResAir;
Ritor1
parents:
diff changeset
1948 goto LABEL_12;
Ritor1
parents:
diff changeset
1949 case 2u:
Ritor1
parents:
diff changeset
1950 v3 = pActor;
Ritor1
parents:
diff changeset
1951 v4 = pActor->pMonsterInfo.uResWater;
Ritor1
parents:
diff changeset
1952 goto LABEL_12;
Ritor1
parents:
diff changeset
1953 case 3u:
Ritor1
parents:
diff changeset
1954 v3 = pActor;
Ritor1
parents:
diff changeset
1955 v4 = pActor->pMonsterInfo.uResEarth;
Ritor1
parents:
diff changeset
1956 goto LABEL_12;
Ritor1
parents:
diff changeset
1957 case 7u:
Ritor1
parents:
diff changeset
1958 v3 = pActor;
Ritor1
parents:
diff changeset
1959 v4 = pActor->pMonsterInfo.uResMind;
Ritor1
parents:
diff changeset
1960 goto LABEL_12;
Ritor1
parents:
diff changeset
1961 case 6u:
Ritor1
parents:
diff changeset
1962 v3 = pActor;
Ritor1
parents:
diff changeset
1963 v4 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
1964 goto LABEL_12;
Ritor1
parents:
diff changeset
1965 case 8u:
Ritor1
parents:
diff changeset
1966 v3 = pActor;
Ritor1
parents:
diff changeset
1967 v4 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
1968 goto LABEL_12;
Ritor1
parents:
diff changeset
1969 case 9u:
Ritor1
parents:
diff changeset
1970 v3 = pActor;
Ritor1
parents:
diff changeset
1971 v4 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
1972 goto LABEL_12;
Ritor1
parents:
diff changeset
1973 case 0xAu:
Ritor1
parents:
diff changeset
1974 v3 = pActor;
Ritor1
parents:
diff changeset
1975 v4 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
1976 goto LABEL_12;
Ritor1
parents:
diff changeset
1977 case 4u:
Ritor1
parents:
diff changeset
1978 v3 = pActor;
Ritor1
parents:
diff changeset
1979 v4 = pActor->pMonsterInfo.uResPhysical;
Ritor1
parents:
diff changeset
1980 LABEL_12:
Ritor1
parents:
diff changeset
1981 if ( v4 < 200 )
Ritor1
parents:
diff changeset
1982 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30;
Ritor1
parents:
diff changeset
1983 else
Ritor1
parents:
diff changeset
1984 result = 0;
Ritor1
parents:
diff changeset
1985 break;
Ritor1
parents:
diff changeset
1986 default:
Ritor1
parents:
diff changeset
1987 result = 1;
Ritor1
parents:
diff changeset
1988 break;
Ritor1
parents:
diff changeset
1989 }
Ritor1
parents:
diff changeset
1990 return result;
Ritor1
parents:
diff changeset
1991 }
Ritor1
parents:
diff changeset
1992
Ritor1
parents:
diff changeset
1993 //----- (0042EB8D) --------------------------------------------------------
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1994 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
0
Ritor1
parents:
diff changeset
1995 {
482
9898e6b413d8 some debug stuff commented
Nomad
parents: 469
diff changeset
1996 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line);
0
Ritor1
parents:
diff changeset
1997 if (uNumMessages < 40)
Ritor1
parents:
diff changeset
1998 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
1999 files[uNumMessages] = file;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2000 lines[uNumMessages] = line;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2001
0
Ritor1
parents:
diff changeset
2002 pMessages[uNumMessages].eType = msg;
Ritor1
parents:
diff changeset
2003 pMessages[uNumMessages].param = param;
Ritor1
parents:
diff changeset
2004 pMessages[uNumMessages++].field_8 = a4;
Ritor1
parents:
diff changeset
2005 }
Ritor1
parents:
diff changeset
2006 }
Ritor1
parents:
diff changeset
2007
Ritor1
parents:
diff changeset
2008 //----- (0042EBBE) --------------------------------------------------------
Ritor1
parents:
diff changeset
2009 int __fastcall sub_42EBBE(int a1, int a2)
Ritor1
parents:
diff changeset
2010 {
Ritor1
parents:
diff changeset
2011 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16;
Ritor1
parents:
diff changeset
2012 }
Ritor1
parents:
diff changeset
2013 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int);
Ritor1
parents:
diff changeset
2014
Ritor1
parents:
diff changeset
2015 //----- (0042EBDB) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
2016 int stru193_math::Sin(int angle)
0
Ritor1
parents:
diff changeset
2017 {
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
2018 return Cos(angle - this->uIntegerHalfPi);
0
Ritor1
parents:
diff changeset
2019 }
Ritor1
parents:
diff changeset
2020
Ritor1
parents:
diff changeset
2021 //----- (0042ECB5) --------------------------------------------------------
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2022 void _42ECB5_PlayerAttacksActor()
0
Ritor1
parents:
diff changeset
2023 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2024 //unsigned int v0; // ebx@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2025 //Player *v1; // esi@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2026 //bool result; // eax@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2027 //int v3; // edi@2
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2028 //unsigned int v4; // eax@7
0
Ritor1
parents:
diff changeset
2029 char *v5; // eax@8
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2030 //int v6; // ecx@9
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2031 //signed int v7; // eax@16
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2032 //Actor *v8; // edi@20
0
Ritor1
parents:
diff changeset
2033 unsigned int v9; // ecx@21
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2034 //char *v10; // eax@26
0
Ritor1
parents:
diff changeset
2035 char *v11; // eax@26
Ritor1
parents:
diff changeset
2036 unsigned int v12; // eax@47
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2037 //char *v13; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2038 //char *v14; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2039 //unsigned int v15; // ebx@54
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2040 //int v16; // [sp-10h] [bp-4Ch]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2041 //int v17; // [sp-10h] [bp-4Ch]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2042 //unsigned int v18; // [sp-Ch] [bp-48h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2043 //unsigned int v19; // [sp-Ch] [bp-48h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2044 //__int16 v20; // [sp-8h] [bp-44h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2045 //__int16 v21; // [sp-8h] [bp-44h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2046 //int v22; // [sp-4h] [bp-40h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2047 //int v23; // [sp-4h] [bp-40h]@44
0
Ritor1
parents:
diff changeset
2048 SoundID v24; // [sp-4h] [bp-40h]@58
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2049 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2050 //unsigned int a2; // [sp+18h] [bp-24h]@20
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2051 //unsigned int v27; // [sp+1Ch] [bp-20h]@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2052 //int v28; // [sp+20h] [bp-1Ch]@9
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2053 //unsigned int *v28b;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2054 //int v29; // [sp+24h] [bp-18h]@16
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2055 //int v30; // [sp+28h] [bp-14h]@16
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2056 //int v31; // [sp+2Ch] [bp-10h]@4
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2057 //int v32; // [sp+30h] [bp-Ch]@7
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2058 //int v33; // [sp+34h] [bp-8h]@7
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2059 //int v34; // [sp+38h] [bp-4h]@17
0
Ritor1
parents:
diff changeset
2060
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2061 //v0 = uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2062 //v27 = 6972 * uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2063 //v1 = &pParty->pPlayers[uActiveCharacter-1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2064 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2065 auto player = &pParty->pPlayers[uActiveCharacter - 1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2066 if (!player->CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2067 return;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2068
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
2069 pCastSpellInfo.data()->_427D48(uActiveCharacter);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2070 //v3 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2071 if (pParty->Invisible())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2072 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2073
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2074 //v31 = player->pEquipment.uBow;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2075 int bow_idx = player->pEquipment.uBow;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2076 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2077 bow_idx = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2078
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2079 //v32 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2080 int wand_item_id = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2081 //v33 = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2082 //v4 = v1->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2083 int laser_weapon_item_id = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2084
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2085 int main_hand_idx = player->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2086 if (main_hand_idx)
0
Ritor1
parents:
diff changeset
2087 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2088 auto item = &player->pInventoryItems[main_hand_idx - 1];
112
909822c91d47 pointer fixes
zipi
parents: 90
diff changeset
2089 //v5 = (char *)v1 + 36 * v4;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2090 if (!item->Broken())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2091 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2092 //v28b = &v1->pInventoryItems[v4].uItemID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2093 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2094 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND)
0
Ritor1
parents:
diff changeset
2095 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2096 if (item->uNumCharges <= 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2097 player->pEquipment.uMainHand = 0; // wand discharged - unequip
0
Ritor1
parents:
diff changeset
2098 else
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2099 wand_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
2100 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2101 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2102 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
2103 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2104 }
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2105
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2106 //v30 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2107 //v29 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2108 //v28 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2109 //v7 = pMouse->uPointingObjectID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2110
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2111 int target_pid = pMouse->uPointingObjectID;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
2112 int target_type = PID_TYPE(target_pid),
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
2113 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2114 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2115 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2116 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
2117 target_type = PID_TYPE(target_pid);
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
2118 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2119 }
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2120
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2121 auto actor = &pActors[target_id];
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2122 int actor_distance = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2123 if (target_type == OBJECT_Actor)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2124 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2125 int distance_x = actor->vPosition.x - pParty->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2126 distance_y = actor->vPosition.y - pParty->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2127 distance_z = actor->vPosition.z - pParty->vPosition.z;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2128 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
2129 if (actor_distance < 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2130 actor_distance = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2131 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2132
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2133 bool shooting_bow = false,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2134 shotting_laser = false,
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2135 shooting_wand = false,
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2136 melee_attack = false;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2137 if (laser_weapon_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2138 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2139 shotting_laser = true;
490
Nomad
parents: 488
diff changeset
2140 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2141 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2142 else if (wand_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2143 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2144 shooting_wand = true;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2145
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2146 int main_hand_idx = player->pEquipment.uMainHand;
490
Nomad
parents: 488
diff changeset
2147 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2148
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2149 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2150 player->pEquipment.uMainHand = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2151 }
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2152 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2153 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2154 melee_attack = true;
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2155
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2156 Vec3_int_ a3;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2157 a3.x = actor->vPosition.x - pParty->vPosition.x;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2158 a3.y = actor->vPosition.y - pParty->vPosition.y;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2159 a3.z = actor->vPosition.z - pParty->vPosition.z;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2160 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2161
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2162 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1052
diff changeset
2163 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
2164 _42FA66_do_explosive_impact(
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2165 actor->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2166 actor->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2167 actor->vPosition.z + actor->uActorHeight / 2,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2168 0, 512, uActiveCharacter);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2169 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2170 else if (bow_idx)
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2171 {
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2172 shooting_bow = true;
490
Nomad
parents: 488
diff changeset
2173 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2174 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2175 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2176 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2177 melee_attack = true;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2178 ; // actor out of range or no actor; no ranged weapon so melee attacking air
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2179 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2180
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2181 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2182 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2183 int recovery = player->GetAttackRecoveryTime(false);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2184 if (recovery < 30 )
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
2185 recovery = 30;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2186 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2187 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2188
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2189
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2190 int v34 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2191 if (shooting_wand)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2192 return;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2193 else if (shooting_bow)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2194 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2195 v34 = 5;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2196 player->PlaySound(SPEECH_50, 0);
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2197 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2198 if (shotting_laser)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2199 v34 = 7;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2200 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2201 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2202 int main_hand_idx = player->pEquipment.uMainHand;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
2203 if (player->HasItemEquipped(EQUIP_MAIN_HAND))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2204 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2205 pTurnEngine->_40471C();
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2206 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2207
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2208 switch (v34)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2209 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2210 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2211 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2212 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2213 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2214 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2215 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2216 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2217 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2218 }
0
Ritor1
parents:
diff changeset
2219 }
Ritor1
parents:
diff changeset
2220
Ritor1
parents:
diff changeset
2221 //----- (0042F184) --------------------------------------------------------
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2222 int stru319::FindClosestActor(int pick_depth, int a3, int a4)
0
Ritor1
parents:
diff changeset
2223 {
Ritor1
parents:
diff changeset
2224 int v4; // edi@1
Ritor1
parents:
diff changeset
2225 stru319 *v5; // esi@1
Ritor1
parents:
diff changeset
2226 int v6; // eax@2
Ritor1
parents:
diff changeset
2227 int v7; // eax@4
Ritor1
parents:
diff changeset
2228 int result; // eax@5
Ritor1
parents:
diff changeset
2229 int *v9; // edx@8
Ritor1
parents:
diff changeset
2230 signed int v10; // ebx@10
Ritor1
parents:
diff changeset
2231 int v11; // edi@11
Ritor1
parents:
diff changeset
2232 Actor *v12; // esi@12
Ritor1
parents:
diff changeset
2233 unsigned __int16 v13; // ax@12
Ritor1
parents:
diff changeset
2234 int v14; // eax@22
Ritor1
parents:
diff changeset
2235 char v15; // zf@30
Ritor1
parents:
diff changeset
2236 int v16; // esi@32
Ritor1
parents:
diff changeset
2237 int v17; // ecx@34
Ritor1
parents:
diff changeset
2238 stru319 *v18; // eax@39
Ritor1
parents:
diff changeset
2239 int v19; // edx@39
Ritor1
parents:
diff changeset
2240 int v20; // ecx@41
Ritor1
parents:
diff changeset
2241 unsigned __int16 v21; // ax@42
Ritor1
parents:
diff changeset
2242 unsigned int v22; // [sp+8h] [bp-24h]@11
Ritor1
parents:
diff changeset
2243 unsigned int v23; // [sp+Ch] [bp-20h]@7
Ritor1
parents:
diff changeset
2244 stru319 *v24; // [sp+10h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
2245 unsigned int v25; // [sp+14h] [bp-18h]@8
Ritor1
parents:
diff changeset
2246 int *v26; // [sp+18h] [bp-14h]@8
Ritor1
parents:
diff changeset
2247 int v27; // [sp+1Ch] [bp-10h]@10
Ritor1
parents:
diff changeset
2248 int *v28; // [sp+20h] [bp-Ch]@10
Ritor1
parents:
diff changeset
2249 unsigned int v29; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
2250 int v30; // [sp+28h] [bp-4h]@6
Ritor1
parents:
diff changeset
2251 int i; // [sp+38h] [bp+Ch]@33
Ritor1
parents:
diff changeset
2252 signed int v32; // [sp+3Ch] [bp+10h]@32
Ritor1
parents:
diff changeset
2253
Ritor1
parents:
diff changeset
2254 v4 = 0;
Ritor1
parents:
diff changeset
2255 v5 = this;
Ritor1
parents:
diff changeset
2256 v24 = this;
Ritor1
parents:
diff changeset
2257 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
2258 {
Ritor1
parents:
diff changeset
2259 v6 = a3 != 0;
Ritor1
parents:
diff changeset
2260 if ( a4 )
Ritor1
parents:
diff changeset
2261 LOBYTE(v6) = v6 | 8;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2262 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
0
Ritor1
parents:
diff changeset
2263 if ( v7 != -1 )
Ritor1
parents:
diff changeset
2264 return (unsigned __int16)v7;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2265 else return 0;
0
Ritor1
parents:
diff changeset
2266 }
Ritor1
parents:
diff changeset
2267 else
Ritor1
parents:
diff changeset
2268 {
Ritor1
parents:
diff changeset
2269 v30 = 0;
Ritor1
parents:
diff changeset
2270 if ( pRenderer->pActiveZBuffer )
Ritor1
parents:
diff changeset
2271 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
2272 v29 = viewparams->uScreen_topL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
2273 v23 = viewparams->uScreen_BttmR_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
2274 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
0
Ritor1
parents:
diff changeset
2275 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
2276 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
2277 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
2278 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
0
Ritor1
parents:
diff changeset
2279 do
Ritor1
parents:
diff changeset
2280 {
Ritor1
parents:
diff changeset
2281 if ( (signed int)v29 < (signed int)v23 )
Ritor1
parents:
diff changeset
2282 {
Ritor1
parents:
diff changeset
2283 v28 = v9;
Ritor1
parents:
diff changeset
2284 v10 = v4;
Ritor1
parents:
diff changeset
2285 v27 = v23 - v29;
Ritor1
parents:
diff changeset
2286 do
Ritor1
parents:
diff changeset
2287 {
Ritor1
parents:
diff changeset
2288 v22 = *v28;
Ritor1
parents:
diff changeset
2289 v11 = *v28 & 0xFFFF;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2290 if (PID_TYPE(v11) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
2291 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2292 v12 = &pActors[PID_ID(v11)];
0
Ritor1
parents:
diff changeset
2293 v13 = v12->uAIState;
Ritor1
parents:
diff changeset
2294 if ( v13 != 5 )
Ritor1
parents:
diff changeset
2295 {
Ritor1
parents:
diff changeset
2296 if ( v13 != 4
Ritor1
parents:
diff changeset
2297 && v13 != 11
Ritor1
parents:
diff changeset
2298 && v13 != 19
Ritor1
parents:
diff changeset
2299 && v13 != 17
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2300 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) )
0
Ritor1
parents:
diff changeset
2301 {
Ritor1
parents:
diff changeset
2302 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
2303 && v22 <= pick_depth << 16 )
0
Ritor1
parents:
diff changeset
2304 {
Ritor1
parents:
diff changeset
2305 v14 = 0;
Ritor1
parents:
diff changeset
2306 if ( v10 > 0 )
Ritor1
parents:
diff changeset
2307 {
Ritor1
parents:
diff changeset
2308 do
Ritor1
parents:
diff changeset
2309 {
Ritor1
parents:
diff changeset
2310 if ( dword_50BDA0[v14] == v11 )
Ritor1
parents:
diff changeset
2311 break;
Ritor1
parents:
diff changeset
2312 ++v14;
Ritor1
parents:
diff changeset
2313 }
Ritor1
parents:
diff changeset
2314 while ( v14 < v30 );
Ritor1
parents:
diff changeset
2315 }
Ritor1
parents:
diff changeset
2316 if ( v14 == v30 && v10 < 100 )
Ritor1
parents:
diff changeset
2317 {
Ritor1
parents:
diff changeset
2318 ++v30;
Ritor1
parents:
diff changeset
2319 dword_50BC10[v10] = v22;
Ritor1
parents:
diff changeset
2320 dword_50BDA0[v10] = v11;
Ritor1
parents:
diff changeset
2321 ++v10;
Ritor1
parents:
diff changeset
2322 }
Ritor1
parents:
diff changeset
2323 }
Ritor1
parents:
diff changeset
2324 }
Ritor1
parents:
diff changeset
2325 }
Ritor1
parents:
diff changeset
2326 }
Ritor1
parents:
diff changeset
2327 ++v28;
Ritor1
parents:
diff changeset
2328 --v27;
Ritor1
parents:
diff changeset
2329 }
Ritor1
parents:
diff changeset
2330 while ( v27 );
Ritor1
parents:
diff changeset
2331 v4 = v30;
Ritor1
parents:
diff changeset
2332 v5 = v24;
Ritor1
parents:
diff changeset
2333 }
Ritor1
parents:
diff changeset
2334 v9 = v26 + 640;
Ritor1
parents:
diff changeset
2335 v15 = v25-- == 1;
Ritor1
parents:
diff changeset
2336 v26 += 640;
Ritor1
parents:
diff changeset
2337 }
Ritor1
parents:
diff changeset
2338 while ( !v15 );
Ritor1
parents:
diff changeset
2339 }
Ritor1
parents:
diff changeset
2340 if ( v4 > 0 )
Ritor1
parents:
diff changeset
2341 {
Ritor1
parents:
diff changeset
2342 v32 = 1;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2343 v16 = (int)dword_50BC10.data();
0
Ritor1
parents:
diff changeset
2344 do
Ritor1
parents:
diff changeset
2345 {
Ritor1
parents:
diff changeset
2346 for ( i = v32; i < v4; ++i )
Ritor1
parents:
diff changeset
2347 {
Ritor1
parents:
diff changeset
2348 v17 = dword_50BC10[i];
Ritor1
parents:
diff changeset
2349 if ( v17 < *(int *)v16 )
Ritor1
parents:
diff changeset
2350 {
Ritor1
parents:
diff changeset
2351 dword_50BC10[i] = *(int *)v16;
Ritor1
parents:
diff changeset
2352 *(int *)v16 = v17;
Ritor1
parents:
diff changeset
2353 }
Ritor1
parents:
diff changeset
2354 }
Ritor1
parents:
diff changeset
2355 ++v32;
Ritor1
parents:
diff changeset
2356 v16 += 4;
Ritor1
parents:
diff changeset
2357 }
Ritor1
parents:
diff changeset
2358 while ( v32 - 1 < v4 );
Ritor1
parents:
diff changeset
2359 v5 = v24;
Ritor1
parents:
diff changeset
2360 if ( v4 > 0 )
Ritor1
parents:
diff changeset
2361 {
Ritor1
parents:
diff changeset
2362 v18 = v24;
Ritor1
parents:
diff changeset
2363 v19 = v4;
Ritor1
parents:
diff changeset
2364 do
Ritor1
parents:
diff changeset
2365 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2366 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF;
0
Ritor1
parents:
diff changeset
2367 v18 += 4;
Ritor1
parents:
diff changeset
2368 --v19;
Ritor1
parents:
diff changeset
2369 }
Ritor1
parents:
diff changeset
2370 while ( v19 );
Ritor1
parents:
diff changeset
2371 }
Ritor1
parents:
diff changeset
2372 }
Ritor1
parents:
diff changeset
2373 v20 = 0;
Ritor1
parents:
diff changeset
2374 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 )
Ritor1
parents:
diff changeset
2375 {
Ritor1
parents:
diff changeset
2376 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState;
Ritor1
parents:
diff changeset
2377 if ( v21 != 4 && v21 != 5 )
Ritor1
parents:
diff changeset
2378 break;
Ritor1
parents:
diff changeset
2379 }
Ritor1
parents:
diff changeset
2380 if ( v20 != v4 )
Ritor1
parents:
diff changeset
2381 {
Ritor1
parents:
diff changeset
2382 result = 8 * *(int *)&v5[4 * v20].field_0;
Ritor1
parents:
diff changeset
2383 LOBYTE(result) = result | 3;
Ritor1
parents:
diff changeset
2384 return result;
Ritor1
parents:
diff changeset
2385 }
Ritor1
parents:
diff changeset
2386 }
Ritor1
parents:
diff changeset
2387 }
Ritor1
parents:
diff changeset
2388 return 0;
Ritor1
parents:
diff changeset
2389 }
Ritor1
parents:
diff changeset
2390
Ritor1
parents:
diff changeset
2391 //----- (0042F3D6) --------------------------------------------------------
Ritor1
parents:
diff changeset
2392 void InitializeTurnBasedAnimations(void *_this)
Ritor1
parents:
diff changeset
2393 {
Ritor1
parents:
diff changeset
2394 unsigned int *v1; // edi@1
Ritor1
parents:
diff changeset
2395
Ritor1
parents:
diff changeset
2396 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0");
Ritor1
parents:
diff changeset
2397 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1");
Ritor1
parents:
diff changeset
2398 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2");
Ritor1
parents:
diff changeset
2399 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3");
Ritor1
parents:
diff changeset
2400 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4");
Ritor1
parents:
diff changeset
2401 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
Ritor1
parents:
diff changeset
2402 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
Ritor1
parents:
diff changeset
2403 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
Ritor1
parents:
diff changeset
2404 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
Ritor1
parents:
diff changeset
2405 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2406 v1 = pIconIDs_Turn.data();
0
Ritor1
parents:
diff changeset
2407 do
Ritor1
parents:
diff changeset
2408 {
Ritor1
parents:
diff changeset
2409 pIconsFrameTable->InitializeAnimation(*v1);
Ritor1
parents:
diff changeset
2410 ++v1;
Ritor1
parents:
diff changeset
2411 }
Ritor1
parents:
diff changeset
2412 while ( (signed int)v1 < (signed int)&uIconID_TurnStop );
Ritor1
parents:
diff changeset
2413 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
Ritor1
parents:
diff changeset
2414 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
Ritor1
parents:
diff changeset
2415 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
Ritor1
parents:
diff changeset
2416 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
Ritor1
parents:
diff changeset
2417 }
Ritor1
parents:
diff changeset
2418
Ritor1
parents:
diff changeset
2419 //----- (0042F4DA) --------------------------------------------------------
Ritor1
parents:
diff changeset
2420 signed int __cdecl sub_42F4DA()
Ritor1
parents:
diff changeset
2421 {
Ritor1
parents:
diff changeset
2422 signed int v0; // edi@1
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2423 Actor *v1; // esi@4
0
Ritor1
parents:
diff changeset
2424 int v2; // ebx@5
Ritor1
parents:
diff changeset
2425 int v3; // eax@5
Ritor1
parents:
diff changeset
2426 int v4; // ebx@5
Ritor1
parents:
diff changeset
2427 unsigned int v5; // ecx@5
Ritor1
parents:
diff changeset
2428 int v6; // edx@6
Ritor1
parents:
diff changeset
2429 unsigned int v7; // edx@8
Ritor1
parents:
diff changeset
2430 unsigned int v8; // edx@10
Ritor1
parents:
diff changeset
2431 __int16 v9; // ax@12
Ritor1
parents:
diff changeset
2432 signed int result; // eax@20
Ritor1
parents:
diff changeset
2433 int v11; // [sp+Ch] [bp-10h]@5
Ritor1
parents:
diff changeset
2434 int v12; // [sp+10h] [bp-Ch]@5
Ritor1
parents:
diff changeset
2435 signed int v13; // [sp+14h] [bp-8h]@3
Ritor1
parents:
diff changeset
2436
Ritor1
parents:
diff changeset
2437 v0 = 5120;
Ritor1
parents:
diff changeset
2438 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
2439 v0 = 2560;
Ritor1
parents:
diff changeset
2440 v13 = 0;
Ritor1
parents:
diff changeset
2441 if ( (signed int)uNumActors <= 0 )
Ritor1
parents:
diff changeset
2442 {
Ritor1
parents:
diff changeset
2443 LABEL_20:
Ritor1
parents:
diff changeset
2444 result = 0;
Ritor1
parents:
diff changeset
2445 }
Ritor1
parents:
diff changeset
2446 else
Ritor1
parents:
diff changeset
2447 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
2448 v1 = pActors.data();
0
Ritor1
parents:
diff changeset
2449 while ( 1 )
Ritor1
parents:
diff changeset
2450 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2451 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x);
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2452 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y);
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2453 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z);
0
Ritor1
parents:
diff changeset
2454 v3 = v2;
Ritor1
parents:
diff changeset
2455 v4 = v11;
Ritor1
parents:
diff changeset
2456 v5 = v12;
Ritor1
parents:
diff changeset
2457 if ( v3 < v11 )
Ritor1
parents:
diff changeset
2458 {
Ritor1
parents:
diff changeset
2459 v6 = v3;
Ritor1
parents:
diff changeset
2460 v3 = v11;
Ritor1
parents:
diff changeset
2461 v4 = v6;
Ritor1
parents:
diff changeset
2462 }
Ritor1
parents:
diff changeset
2463 if ( v3 < v12 )
Ritor1
parents:
diff changeset
2464 {
Ritor1
parents:
diff changeset
2465 v7 = v3;
Ritor1
parents:
diff changeset
2466 v3 = v12;
Ritor1
parents:
diff changeset
2467 v5 = v7;
Ritor1
parents:
diff changeset
2468 }
Ritor1
parents:
diff changeset
2469 if ( v4 < (signed int)v5 )
Ritor1
parents:
diff changeset
2470 {
Ritor1
parents:
diff changeset
2471 v8 = v5;
Ritor1
parents:
diff changeset
2472 v5 = v4;
Ritor1
parents:
diff changeset
2473 v4 = v8;
Ritor1
parents:
diff changeset
2474 }
Ritor1
parents:
diff changeset
2475 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 )
Ritor1
parents:
diff changeset
2476 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2477 v9 = v1->uAIState;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2478 if ( v1->uAIState != 5 )
0
Ritor1
parents:
diff changeset
2479 {
Ritor1
parents:
diff changeset
2480 if ( v9 != 4
Ritor1
parents:
diff changeset
2481 && v9 != 11
Ritor1
parents:
diff changeset
2482 && v9 != 19
Ritor1
parents:
diff changeset
2483 && v9 != 17
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2484 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) )
0
Ritor1
parents:
diff changeset
2485 break;
Ritor1
parents:
diff changeset
2486 }
Ritor1
parents:
diff changeset
2487 }
Ritor1
parents:
diff changeset
2488 ++v13;
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
2489 ++v1;
0
Ritor1
parents:
diff changeset
2490 if ( v13 >= (signed int)uNumActors )
Ritor1
parents:
diff changeset
2491 goto LABEL_20;
Ritor1
parents:
diff changeset
2492 }
Ritor1
parents:
diff changeset
2493 result = 1;
Ritor1
parents:
diff changeset
2494 }
Ritor1
parents:
diff changeset
2495 return result;
Ritor1
parents:
diff changeset
2496 }
Ritor1
parents:
diff changeset
2497
Ritor1
parents:
diff changeset
2498 //----- (0042F7EB) --------------------------------------------------------
Ritor1
parents:
diff changeset
2499 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
2500 {
Ritor1
parents:
diff changeset
2501 unsigned int v9; // edi@1
Ritor1
parents:
diff changeset
2502 signed int v10; // edx@3
Ritor1
parents:
diff changeset
2503 char *v11; // ecx@4
Ritor1
parents:
diff changeset
2504 unsigned __int16 v12; // ax@7
Ritor1
parents:
diff changeset
2505 unsigned int v13; // edx@9
Ritor1
parents:
diff changeset
2506 char *v14; // ecx@10
Ritor1
parents:
diff changeset
2507 int v15; // esi@17
Ritor1
parents:
diff changeset
2508 int v16; // eax@18
Ritor1
parents:
diff changeset
2509 int v17; // edi@20
Ritor1
parents:
diff changeset
2510 int v18; // esi@20
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2511 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1
0
Ritor1
parents:
diff changeset
2512 int v21; // [sp+7Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
2513 unsigned int v22; // [sp+80h] [bp-4h]@1
Ritor1
parents:
diff changeset
2514
Ritor1
parents:
diff changeset
2515 v9 = uSpriteID;
Ritor1
parents:
diff changeset
2516 v21 = x;
Ritor1
parents:
diff changeset
2517 v22 = uSpriteID;
Ritor1
parents:
diff changeset
2518
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2519 SpriteObject a1a; // [sp+Ch] [bp-78h]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2520 //SpriteObject::SpriteObject(&a1a);
0
Ritor1
parents:
diff changeset
2521 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
2522
Ritor1
parents:
diff changeset
2523 if ( a9 )
Ritor1
parents:
diff changeset
2524 {
Ritor1
parents:
diff changeset
2525 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24));
Ritor1
parents:
diff changeset
2526 v9 = v22;
Ritor1
parents:
diff changeset
2527 }
Ritor1
parents:
diff changeset
2528 v10 = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2529 a1a.spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2530 a1a.spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2531 a1a.spell_id = 0;
0
Ritor1
parents:
diff changeset
2532 a1a.field_54 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2533 a1a.uType = v9;
0
Ritor1
parents:
diff changeset
2534 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
2535 {
Ritor1
parents:
diff changeset
2536 LABEL_7:
Ritor1
parents:
diff changeset
2537 v12 = 0;
Ritor1
parents:
diff changeset
2538 }
Ritor1
parents:
diff changeset
2539 else
Ritor1
parents:
diff changeset
2540 {
Ritor1
parents:
diff changeset
2541 v11 = (char *)&pObjectList->pObjects->uObjectID;
Ritor1
parents:
diff changeset
2542 while ( (short)v9 != *(short *)v11 )
Ritor1
parents:
diff changeset
2543 {
Ritor1
parents:
diff changeset
2544 ++v10;
Ritor1
parents:
diff changeset
2545 v11 += 56;
Ritor1
parents:
diff changeset
2546 if ( v10 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
2547 goto LABEL_7;
Ritor1
parents:
diff changeset
2548 }
Ritor1
parents:
diff changeset
2549 v12 = v10;
Ritor1
parents:
diff changeset
2550 }
Ritor1
parents:
diff changeset
2551 a1a.uObjectDescID = v12;
Ritor1
parents:
diff changeset
2552 a1a.vPosition.z = z;
Ritor1
parents:
diff changeset
2553 a1a.vPosition.x = v21;
Ritor1
parents:
diff changeset
2554 a1a.vPosition.y = y;
Ritor1
parents:
diff changeset
2555 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
2556 a1a.uAttributes = attributes;
Ritor1
parents:
diff changeset
2557 a1a.uSectorID = pIndoor->GetSector(v21, y, z);
Ritor1
parents:
diff changeset
2558 a1a.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2559 a1a.spell_caster_pid = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
2560 a1a.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
2561 if ( !(a1a.uAttributes & 0x10) )
Ritor1
parents:
diff changeset
2562 {
Ritor1
parents:
diff changeset
2563 v13 = 0;
222
8113753ed2ae more item init fixing
Gloval
parents: 190
diff changeset
2564 if ( (signed int)pItemsTable->uAllItemsCount > 0 )
0
Ritor1
parents:
diff changeset
2565 {
Ritor1
parents:
diff changeset
2566 v14 = (char *)&pItemsTable->pItems[0].uSpriteID;
Ritor1
parents:
diff changeset
2567 while ( *(short *)v14 != v9 )
Ritor1
parents:
diff changeset
2568 {
Ritor1
parents:
diff changeset
2569 ++v13;
Ritor1
parents:
diff changeset
2570 v14 += 48;
222
8113753ed2ae more item init fixing
Gloval
parents: 190
diff changeset
2571 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount )
0
Ritor1
parents:
diff changeset
2572 goto LABEL_16;
Ritor1
parents:
diff changeset
2573 }
Ritor1
parents:
diff changeset
2574 a1a.stru_24.uItemID = v13;
Ritor1
parents:
diff changeset
2575 }
Ritor1
parents:
diff changeset
2576 }
Ritor1
parents:
diff changeset
2577 LABEL_16:
Ritor1
parents:
diff changeset
2578 if ( a7 )
Ritor1
parents:
diff changeset
2579 {
Ritor1
parents:
diff changeset
2580 v15 = count;
Ritor1
parents:
diff changeset
2581 if ( count > 0 )
Ritor1
parents:
diff changeset
2582 {
Ritor1
parents:
diff changeset
2583 do
Ritor1
parents:
diff changeset
2584 {
Ritor1
parents:
diff changeset
2585 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
Ritor1
parents:
diff changeset
2586 v16 = rand();
Ritor1
parents:
diff changeset
2587 a1a.Create(
Ritor1
parents:
diff changeset
2588 (signed __int16)a1a.uFacing,
Ritor1
parents:
diff changeset
2589 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1),
Ritor1
parents:
diff changeset
2590 a4,
Ritor1
parents:
diff changeset
2591 0);
Ritor1
parents:
diff changeset
2592 --v15;
Ritor1
parents:
diff changeset
2593 }
Ritor1
parents:
diff changeset
2594 while ( v15 );
Ritor1
parents:
diff changeset
2595 }
Ritor1
parents:
diff changeset
2596 }
Ritor1
parents:
diff changeset
2597 else
Ritor1
parents:
diff changeset
2598 {
Ritor1
parents:
diff changeset
2599 v17 = count;
Ritor1
parents:
diff changeset
2600 v18 = stru_5C6E00->uIntegerHalfPi;
Ritor1
parents:
diff changeset
2601 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
2602 if ( count > 0 )
Ritor1
parents:
diff changeset
2603 {
Ritor1
parents:
diff changeset
2604 do
Ritor1
parents:
diff changeset
2605 {
Ritor1
parents:
diff changeset
2606 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0);
Ritor1
parents:
diff changeset
2607 --v17;
Ritor1
parents:
diff changeset
2608 }
Ritor1
parents:
diff changeset
2609 while ( v17 );
Ritor1
parents:
diff changeset
2610 }
Ritor1
parents:
diff changeset
2611 }
Ritor1
parents:
diff changeset
2612 return 1;
Ritor1
parents:
diff changeset
2613 }
Ritor1
parents:
diff changeset
2614
Ritor1
parents:
diff changeset
2615 //----- (0042F960) --------------------------------------------------------
Ritor1
parents:
diff changeset
2616 void __fastcall sub_42F960_create_object(int x, int y, int z)
Ritor1
parents:
diff changeset
2617 {
Ritor1
parents:
diff changeset
2618 int v3; // ebx@1
Ritor1
parents:
diff changeset
2619 int v4; // edi@1
Ritor1
parents:
diff changeset
2620 signed int v5; // edx@1
Ritor1
parents:
diff changeset
2621 char *v6; // ecx@2
Ritor1
parents:
diff changeset
2622 unsigned __int16 v7; // ax@5
Ritor1
parents:
diff changeset
2623 signed int v8; // eax@6
Ritor1
parents:
diff changeset
2624 signed int v9; // eax@7
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2625 //SpriteObject a1; // [sp+Ch] [bp-70h]@1
0
Ritor1
parents:
diff changeset
2626
Ritor1
parents:
diff changeset
2627 v3 = x;
Ritor1
parents:
diff changeset
2628 v4 = y;
Ritor1
parents:
diff changeset
2629
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2630 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
2631 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
2632 a1.stru_24.Reset();
Ritor1
parents:
diff changeset
2633
Ritor1
parents:
diff changeset
2634 v5 = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2635 a1.spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2636 a1.spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2637 a1.spell_id = 0;
0
Ritor1
parents:
diff changeset
2638 a1.field_54 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2639 a1.uType = 800;
0
Ritor1
parents:
diff changeset
2640 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
2641 {
Ritor1
parents:
diff changeset
2642 LABEL_5:
Ritor1
parents:
diff changeset
2643 v7 = 0;
Ritor1
parents:
diff changeset
2644 }
Ritor1
parents:
diff changeset
2645 else
Ritor1
parents:
diff changeset
2646 {
Ritor1
parents:
diff changeset
2647 v6 = (char *)&pObjectList->pObjects->uObjectID;
Ritor1
parents:
diff changeset
2648 while ( *(short *)v6 != 800 )
Ritor1
parents:
diff changeset
2649 {
Ritor1
parents:
diff changeset
2650 ++v5;
Ritor1
parents:
diff changeset
2651 v6 += 56;
Ritor1
parents:
diff changeset
2652 if ( v5 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
2653 goto LABEL_5;
Ritor1
parents:
diff changeset
2654 }
Ritor1
parents:
diff changeset
2655 v7 = v5;
Ritor1
parents:
diff changeset
2656 }
Ritor1
parents:
diff changeset
2657 a1.uObjectDescID = v7;
Ritor1
parents:
diff changeset
2658 a1.vPosition.x = v3;
Ritor1
parents:
diff changeset
2659 a1.vPosition.y = v4;
Ritor1
parents:
diff changeset
2660 a1.vPosition.z = z;
Ritor1
parents:
diff changeset
2661 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
2662 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
2663 a1.uSectorID = pIndoor->GetSector(v3, v4, z);
Ritor1
parents:
diff changeset
2664 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2665 a1.spell_caster_pid = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
2666 a1.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
2667 v8 = a1.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
2668 if ( v8 != -1 )
Ritor1
parents:
diff changeset
2669 {
Ritor1
parents:
diff changeset
2670 v9 = 8 * v8;
Ritor1
parents:
diff changeset
2671 LOBYTE(v9) = v9 | 2;
Ritor1
parents:
diff changeset
2672 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
2673 }
Ritor1
parents:
diff changeset
2674 }
Ritor1
parents:
diff changeset
2675
810
f5156b8c61ad savegame refactoring
Gloval
parents: 792
diff changeset
2676
0
Ritor1
parents:
diff changeset
2677
Ritor1
parents:
diff changeset
2678 //----- (0042FA66) --------------------------------------------------------
Ritor1
parents:
diff changeset
2679 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
Ritor1
parents:
diff changeset
2680 {
Ritor1
parents:
diff changeset
2681 int v6; // edi@1
Ritor1
parents:
diff changeset
2682 int v7; // esi@1
Ritor1
parents:
diff changeset
2683 char *v8; // ecx@2
Ritor1
parents:
diff changeset
2684 unsigned __int16 v9; // ax@5
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2685 //int v10; // eax@10
0
Ritor1
parents:
diff changeset
2686 signed int result; // eax@11
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2687 //__int16 v12; // ax@12
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2688 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1
0
Ritor1
parents:
diff changeset
2689 int v14; // [sp+7Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
2690
Ritor1
parents:
diff changeset
2691 v6 = a1;
Ritor1
parents:
diff changeset
2692 v7 = a2;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2693 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
2694 //SpriteObject::SpriteObject(&a1a);
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2695 a1a.uType = 600;
0
Ritor1
parents:
diff changeset
2696 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
2697
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2698 a1a.spell_id = SPELL_FIRE_FIREBALL;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2699 a1a.spell_level = 8;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2700 a1a.spell_skill = 3;
0
Ritor1
parents:
diff changeset
2701 v14 = 0;
Ritor1
parents:
diff changeset
2702 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
2703 {
Ritor1
parents:
diff changeset
2704 LABEL_5:
Ritor1
parents:
diff changeset
2705 v9 = 0;
Ritor1
parents:
diff changeset
2706 }
Ritor1
parents:
diff changeset
2707 else
Ritor1
parents:
diff changeset
2708 {
Ritor1
parents:
diff changeset
2709 v8 = (char *)&pObjectList->pObjects->uObjectID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
2710 while ( (short)a1a.uType != *(short *)v8 )
0
Ritor1
parents:
diff changeset
2711 {
Ritor1
parents:
diff changeset
2712 ++v14;
Ritor1
parents:
diff changeset
2713 v8 += 56;
Ritor1
parents:
diff changeset
2714 if ( v14 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
2715 goto LABEL_5;
Ritor1
parents:
diff changeset
2716 }
Ritor1
parents:
diff changeset
2717 v9 = v14;
Ritor1
parents:
diff changeset
2718 }
Ritor1
parents:
diff changeset
2719 a1a.uObjectDescID = v9;
Ritor1
parents:
diff changeset
2720 a1a.vPosition.x = v6;
Ritor1
parents:
diff changeset
2721 a1a.vPosition.y = v7;
Ritor1
parents:
diff changeset
2722 a1a.vPosition.z = a3;
Ritor1
parents:
diff changeset
2723 a1a.uAttributes = 0;
Ritor1
parents:
diff changeset
2724 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3);
Ritor1
parents:
diff changeset
2725 a1a.uSpriteFrameID = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
2726 a1a.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
2727 a1a.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
2728 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
2729 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
2730 if ( a6 >= 1 || a6 <= 4 )
Ritor1
parents:
diff changeset
2731 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2732 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
0
Ritor1
parents:
diff changeset
2733 }
Ritor1
parents:
diff changeset
2734 else
Ritor1
parents:
diff changeset
2735 {
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
2736 a1a.spell_caster_pid = 0;
0
Ritor1
parents:
diff changeset
2737 }
Ritor1
parents:
diff changeset
2738 result = a1a.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
2739 if ( result != -1 )
Ritor1
parents:
diff changeset
2740 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2741 result = stru_50FE08.Add(PID(OBJECT_Item, result),
0
Ritor1
parents:
diff changeset
2742 a5,
Ritor1
parents:
diff changeset
2743 SLOWORD(a1a.vPosition.x),
Ritor1
parents:
diff changeset
2744 SLOWORD(a1a.vPosition.y),
Ritor1
parents:
diff changeset
2745 SLOWORD(a1a.vPosition.z),
Ritor1
parents:
diff changeset
2746 0,
Ritor1
parents:
diff changeset
2747 0);
Ritor1
parents:
diff changeset
2748 }
Ritor1
parents:
diff changeset
2749 return result;
Ritor1
parents:
diff changeset
2750 }
Ritor1
parents:
diff changeset
2751
Ritor1
parents:
diff changeset
2752 //----- (0042FB5C) --------------------------------------------------------
Ritor1
parents:
diff changeset
2753 bool __fastcall sub_42FB5C(signed int a1)
Ritor1
parents:
diff changeset
2754 {
Ritor1
parents:
diff changeset
2755 int v1; // ecx@3
Ritor1
parents:
diff changeset
2756 int v2; // ecx@4
Ritor1
parents:
diff changeset
2757 int v3; // ecx@5
Ritor1
parents:
diff changeset
2758 int v4; // ecx@6
Ritor1
parents:
diff changeset
2759 int v5; // ecx@7
Ritor1
parents:
diff changeset
2760 int v6; // ecx@8
Ritor1
parents:
diff changeset
2761 char v7; // zf@9
Ritor1
parents:
diff changeset
2762
Ritor1
parents:
diff changeset
2763 if ( a1 > 39 )
Ritor1
parents:
diff changeset
2764 {
Ritor1
parents:
diff changeset
2765 if ( a1 > 77 )
Ritor1
parents:
diff changeset
2766 {
Ritor1
parents:
diff changeset
2767 if ( a1 == 80 )
Ritor1
parents:
diff changeset
2768 return 0;
Ritor1
parents:
diff changeset
2769 if ( a1 > 84 )
Ritor1
parents:
diff changeset
2770 {
Ritor1
parents:
diff changeset
2771 if ( a1 <= 86 )
Ritor1
parents:
diff changeset
2772 return 0;
Ritor1
parents:
diff changeset
2773 v7 = a1 == 95;
Ritor1
parents:
diff changeset
2774 goto LABEL_20;
Ritor1
parents:
diff changeset
2775 }
Ritor1
parents:
diff changeset
2776 }
Ritor1
parents:
diff changeset
2777 else
Ritor1
parents:
diff changeset
2778 {
Ritor1
parents:
diff changeset
2779 if ( a1 == 77 )
Ritor1
parents:
diff changeset
2780 return 0;
Ritor1
parents:
diff changeset
2781 if ( a1 >= 46 )
Ritor1
parents:
diff changeset
2782 {
Ritor1
parents:
diff changeset
2783 if ( a1 <= 47 || a1 == 51 )
Ritor1
parents:
diff changeset
2784 return 0;
Ritor1
parents:
diff changeset
2785 v7 = a1 == 73;
Ritor1
parents:
diff changeset
2786 goto LABEL_20;
Ritor1
parents:
diff changeset
2787 }
Ritor1
parents:
diff changeset
2788 }
Ritor1
parents:
diff changeset
2789 return 1;
Ritor1
parents:
diff changeset
2790 }
Ritor1
parents:
diff changeset
2791 if ( a1 == 39 || (v1 = a1 - 2) == 0 )
Ritor1
parents:
diff changeset
2792 return 1;
Ritor1
parents:
diff changeset
2793 v2 = v1 - 3;
Ritor1
parents:
diff changeset
2794 if ( !v2 )
Ritor1
parents:
diff changeset
2795 return 0;
Ritor1
parents:
diff changeset
2796 v3 = v2 - 1;
Ritor1
parents:
diff changeset
2797 if ( !v3 || (v4 = v3 - 3) == 0 )
Ritor1
parents:
diff changeset
2798 return 1;
Ritor1
parents:
diff changeset
2799 v5 = v4 - 8;
Ritor1
parents:
diff changeset
2800 if ( !v5 )
Ritor1
parents:
diff changeset
2801 return 0;
Ritor1
parents:
diff changeset
2802 v6 = v5 - 1;
Ritor1
parents:
diff changeset
2803 if ( !v6 )
Ritor1
parents:
diff changeset
2804 return 1;
Ritor1
parents:
diff changeset
2805 v7 = v6 == 20;
Ritor1
parents:
diff changeset
2806 LABEL_20:
Ritor1
parents:
diff changeset
2807 if ( !v7 )
Ritor1
parents:
diff changeset
2808 return 1;
Ritor1
parents:
diff changeset
2809 return 0;
Ritor1
parents:
diff changeset
2810 }
Ritor1
parents:
diff changeset
2811
Ritor1
parents:
diff changeset
2812 //----- (0042FBDD) --------------------------------------------------------
Ritor1
parents:
diff changeset
2813 void __cdecl sub_42FBDD()
Ritor1
parents:
diff changeset
2814 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
2815 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
2816 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
Ritor1
parents:
diff changeset
2817 pRenderer->Present();
Ritor1
parents:
diff changeset
2818 }
Ritor1
parents:
diff changeset
2819
Ritor1
parents:
diff changeset
2820 //----- (0042FC15) --------------------------------------------------------
11
66319a734368 16.01.13(work)
Ritor1
parents: 0
diff changeset
2821 void __cdecl CloseWindowBackground()
0
Ritor1
parents:
diff changeset
2822 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
2823 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
2824 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
Ritor1
parents:
diff changeset
2825 pRenderer->Present();
Ritor1
parents:
diff changeset
2826 }
Ritor1
parents:
diff changeset
2827
Ritor1
parents:
diff changeset
2828 //----- (0042FC4E) --------------------------------------------------------
Ritor1
parents:
diff changeset
2829 void __cdecl ProcessInputActions()
Ritor1
parents:
diff changeset
2830 {
Ritor1
parents:
diff changeset
2831 char v4; // al@9
Ritor1
parents:
diff changeset
2832 char v8; // bl@100
Ritor1
parents:
diff changeset
2833 unsigned __int16 v9; // ax@102
Ritor1
parents:
diff changeset
2834 int v10; // eax@103
Ritor1
parents:
diff changeset
2835 char v14; // al@159
Ritor1
parents:
diff changeset
2836 unsigned int v15; // eax@168
Ritor1
parents:
diff changeset
2837 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
2838 InputAction inputAction; // [sp+0h] [bp-8h]@7
Ritor1
parents:
diff changeset
2839 int v24; // [sp+4h] [bp-4h]@87
Ritor1
parents:
diff changeset
2840
Ritor1
parents:
diff changeset
2841 pGame->pKeyboardInstance->EnterCriticalSection();
Ritor1
parents:
diff changeset
2842 auto pKeyboard = pGame->pKeyboardInstance;
Ritor1
parents:
diff changeset
2843 if (!bAlwaysRun)
Ritor1
parents:
diff changeset
2844 {
Ritor1
parents:
diff changeset
2845 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
2846 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
2847 else
Ritor1
parents:
diff changeset
2848 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
2849 }
Ritor1
parents:
diff changeset
2850 else
Ritor1
parents:
diff changeset
2851 {
Ritor1
parents:
diff changeset
2852 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
2853 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
2854 else
Ritor1
parents:
diff changeset
2855 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
2856 }
Ritor1
parents:
diff changeset
2857
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
2858 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
2859
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
2860
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
2861 // WUT? double event trigger
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
2862 /*for ( uint i = 0; i < 30; ++i )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2863 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2864 if ( pKeyActionMap->pToggleTypes[i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2865 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2866 else
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2867 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]);
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
2868 if ( v14 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2869 {
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
2870 if (pCurrentScreen == SCREEN_GAME)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2871 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2872 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2873 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2874 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2875 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2876 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2877 v15 = pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2878 if ( pMessageQueue_50CBD0->uNumMessages )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2879 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2880 v15 = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2881 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2882 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2883 v15 = 1;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2884 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2885 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2886 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2887 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2888 ++pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2889 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2890 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2891 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2892 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2893 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2894 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2895 }
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
2896 }*/
0
Ritor1
parents:
diff changeset
2897 if ( !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
2898 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2899 for ( uint i = 0; i < 30; ++i )
0
Ritor1
parents:
diff changeset
2900 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2901 inputAction = (InputAction)i;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2902 if ( pKeyActionMap->pToggleTypes[(InputAction)i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2903 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
2904 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2905 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
2906 if ( v4 )
Ritor1
parents:
diff changeset
2907 {
Ritor1
parents:
diff changeset
2908 switch ( inputAction )
Ritor1
parents:
diff changeset
2909 {
Ritor1
parents:
diff changeset
2910 case INPUT_MoveForward:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2911 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2912 break;
Ritor1
parents:
diff changeset
2913 if (!pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
2914 {
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
2915 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
0
Ritor1
parents:
diff changeset
2916 partyAction = PARTY_RunForward;
Ritor1
parents:
diff changeset
2917 else
Ritor1
parents:
diff changeset
2918 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2919 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2920 break;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2921 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2922 if (pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2923 {
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2924 pTurnEngine->uActionPointsLeft -= 26;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2925 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2926 partyAction = PARTY_RunForward;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2927 else
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2928 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2929 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2930 break;
0
Ritor1
parents:
diff changeset
2931 }
Ritor1
parents:
diff changeset
2932 break;
Ritor1
parents:
diff changeset
2933 case INPUT_MoveBackwards:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2934 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2935 break;
Ritor1
parents:
diff changeset
2936 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2937 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2938 if ( pParty->uFlags2 & 2 )
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2939 partyAction = PARTY_RunBackward;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2940 else
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2941 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2942 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2943 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2944 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2945 if ( pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 )
0
Ritor1
parents:
diff changeset
2946 {
Ritor1
parents:
diff changeset
2947 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2948 if ( pParty->uFlags2 & 2 )
Ritor1
parents:
diff changeset
2949 partyAction = PARTY_RunBackward;
Ritor1
parents:
diff changeset
2950 else
Ritor1
parents:
diff changeset
2951 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2952 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2953 break;
0
Ritor1
parents:
diff changeset
2954 }
Ritor1
parents:
diff changeset
2955 break;
Ritor1
parents:
diff changeset
2956 case INPUT_StrafeLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2957 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2958 break;
Ritor1
parents:
diff changeset
2959 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2960 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2961 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2962 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2963 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2964 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2965 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
2966 break;
Ritor1
parents:
diff changeset
2967 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2968 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2969 pPartyActionQueue->Add(partyAction);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2970 break;
0
Ritor1
parents:
diff changeset
2971 case INPUT_StrafeRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2972 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2973 break;
Ritor1
parents:
diff changeset
2974 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2975 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2976 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2977 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2978 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
2979 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2980 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
2981 break;
Ritor1
parents:
diff changeset
2982 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2983 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2984 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
2985 break;
0
Ritor1
parents:
diff changeset
2986 case INPUT_TurnLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
2987 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
2988 break;
Ritor1
parents:
diff changeset
2989 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing
Ritor1
parents:
diff changeset
2990 {
Ritor1
parents:
diff changeset
2991 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
2992 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
2993 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
2994 break;
Ritor1
parents:
diff changeset
2995 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
2996 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2997 partyAction = PARTY_StrafeLeft;
0
Ritor1
parents:
diff changeset
2998 }
Ritor1
parents:
diff changeset
2999 else
Ritor1
parents:
diff changeset
3000 {
Ritor1
parents:
diff changeset
3001 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3002 partyAction = PARTY_FastTurnLeft;
0
Ritor1
parents:
diff changeset
3003 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3004 partyAction = PARTY_TurnLeft;
0
Ritor1
parents:
diff changeset
3005 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3006 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
3007 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
3008 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3009 pWeather->OnPlayerTurn(10);
0
Ritor1
parents:
diff changeset
3010 }
Ritor1
parents:
diff changeset
3011 break;
Ritor1
parents:
diff changeset
3012 case INPUT_TurnRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3013 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
3014 break;
Ritor1
parents:
diff changeset
3015 if ( GetAsyncKeyState(17) ) // strafing
Ritor1
parents:
diff changeset
3016 {
Ritor1
parents:
diff changeset
3017 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
3018 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
3019 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 )
0
Ritor1
parents:
diff changeset
3020 break;
Ritor1
parents:
diff changeset
3021 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
3022 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3023 partyAction = PARTY_StrafeRight;
0
Ritor1
parents:
diff changeset
3024 }
Ritor1
parents:
diff changeset
3025 else
Ritor1
parents:
diff changeset
3026 {
Ritor1
parents:
diff changeset
3027 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3028 partyAction = PARTY_FastTurnRight;
0
Ritor1
parents:
diff changeset
3029 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3030 partyAction = PARTY_TurnRight;
0
Ritor1
parents:
diff changeset
3031 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3032 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
3033 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
3034 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3035 pWeather->OnPlayerTurn(-10);
0
Ritor1
parents:
diff changeset
3036 }
Ritor1
parents:
diff changeset
3037 break;
Ritor1
parents:
diff changeset
3038 case INPUT_Jump:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3039 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn)
0
Ritor1
parents:
diff changeset
3040 break;
Ritor1
parents:
diff changeset
3041 partyAction = (PartyAction)12;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3042 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3043 break;
0
Ritor1
parents:
diff changeset
3044 case INPUT_Yell:
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
3045 if (!pCurrentScreen && uActiveCharacter)
0
Ritor1
parents:
diff changeset
3046 {
Ritor1
parents:
diff changeset
3047 pParty->Yell();
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
3048 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0);
0
Ritor1
parents:
diff changeset
3049 }
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
3050 break;
0
Ritor1
parents:
diff changeset
3051 case INPUT_Pass:
Ritor1
parents:
diff changeset
3052 if ( pCurrentScreen )
Ritor1
parents:
diff changeset
3053 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
3054 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3055 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
3056 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3057 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3058 }
0
Ritor1
parents:
diff changeset
3059 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
3060 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3061 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery )
0
Ritor1
parents:
diff changeset
3062 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3063 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false);
0
Ritor1
parents:
diff changeset
3064 if ( !pParty->bTurnBasedModeOn )
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
3065 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
3066 pCastSpellInfo.data()->_427D48(uActiveCharacter);
0
Ritor1
parents:
diff changeset
3067 pTurnEngine->_40471C();
Ritor1
parents:
diff changeset
3068 }
Ritor1
parents:
diff changeset
3069 }
Ritor1
parents:
diff changeset
3070 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3071 case INPUT_Combat://if press ENTER
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3072 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
3073 {
Ritor1
parents:
diff changeset
3074 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
3075 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
3076 if (pTurnEngine->turn_stage == 3 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player)
0
Ritor1
parents:
diff changeset
3077 {
Ritor1
parents:
diff changeset
3078 pParty->bTurnBasedModeOn = 0;
Ritor1
parents:
diff changeset
3079 pTurnEngine->End(true);
Ritor1
parents:
diff changeset
3080 }
Ritor1
parents:
diff changeset
3081 }
Ritor1
parents:
diff changeset
3082 else
Ritor1
parents:
diff changeset
3083 {
Ritor1
parents:
diff changeset
3084 pTurnEngine->Start();
Ritor1
parents:
diff changeset
3085 pParty->bTurnBasedModeOn = true;
Ritor1
parents:
diff changeset
3086 }
Ritor1
parents:
diff changeset
3087 }
Ritor1
parents:
diff changeset
3088 break;
Ritor1
parents:
diff changeset
3089 case INPUT_CastReady:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3090 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
3091 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
3092 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3093 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
3094 pTurnEngine->field_18 |= TE_FLAG_8;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3095 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3096 }
0
Ritor1
parents:
diff changeset
3097 if ( !uActiveCharacter )
Ritor1
parents:
diff changeset
3098 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3099 v8 = pPlayers[uActiveCharacter]->uQuickSpell;
0
Ritor1
parents:
diff changeset
3100 if ( !v8
Ritor1
parents:
diff changeset
3101 || bUnderwater
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3102 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ?
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3103 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3104 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3105 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3106 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)),
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3107 v10 > pPlayers[uActiveCharacter]->sMana) )
0
Ritor1
parents:
diff changeset
3108 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3109 pPartyActionQueue = pPartyActionQueue;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3110 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3111 break;
0
Ritor1
parents:
diff changeset
3112 }
Ritor1
parents:
diff changeset
3113 else
Ritor1
parents:
diff changeset
3114 {
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3115 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
0
Ritor1
parents:
diff changeset
3116 }
Ritor1
parents:
diff changeset
3117 break;
Ritor1
parents:
diff changeset
3118 case INPUT_Attack:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3119 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
3120 break;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
3121 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3122 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1323
diff changeset
3123 pTurnEngine->field_18 |= TE_FLAG_8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3124 break;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3125 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3126 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0
Ritor1
parents:
diff changeset
3127 break;
Ritor1
parents:
diff changeset
3128 case INPUT_EventTrigger:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
3129 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
3130 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3131 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3132 break;
0
Ritor1
parents:
diff changeset
3133 }
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 141
diff changeset
3134 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE )
0
Ritor1
parents:
diff changeset
3135 {
Ritor1
parents:
diff changeset
3136 if ( pMessageQueue_50CBD0->uNumMessages )
Ritor1
parents:
diff changeset
3137 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3138 pMessageQueue_50CBD0->uNumMessages = 0;
0
Ritor1
parents:
diff changeset
3139 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
Ritor1
parents:
diff changeset
3140 {
Ritor1
parents:
diff changeset
3141 pMessageQueue_50CBD0->uNumMessages = 1;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3142 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
3143 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
Ritor1
parents:
diff changeset
3144 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
3145 ++pMessageQueue_50CBD0->uNumMessages;
Ritor1
parents:
diff changeset
3146 break;
Ritor1
parents:
diff changeset
3147 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3148 break;
0
Ritor1
parents:
diff changeset
3149 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3150 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
0
Ritor1
parents:
diff changeset
3151 }
Ritor1
parents:
diff changeset
3152 break;
Ritor1
parents:
diff changeset
3153 case INPUT_CharCycle:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3154 if ( pCurrentScreen == SCREEN_SPELL_BOOK )
0
Ritor1
parents:
diff changeset
3155 break;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3156 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3157 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3158 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3159 ++dword_50C9E8;*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3160 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3161 break;
0
Ritor1
parents:
diff changeset
3162 case INPUT_LookUp:
Ritor1
parents:
diff changeset
3163 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
3164 break;
Ritor1
parents:
diff changeset
3165 partyAction = (PartyAction)7;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3166 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3167 break;
0
Ritor1
parents:
diff changeset
3168 case INPUT_CenterView:
Ritor1
parents:
diff changeset
3169 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
3170 break;
Ritor1
parents:
diff changeset
3171 partyAction = (PartyAction)9;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3172 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3173 break;
0
Ritor1
parents:
diff changeset
3174 case INPUT_LookDown:
Ritor1
parents:
diff changeset
3175 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
3176 break;
Ritor1
parents:
diff changeset
3177 partyAction = (PartyAction)8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3178 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3179 break;
0
Ritor1
parents:
diff changeset
3180 case INPUT_FlyUp:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3181 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
3182 break;
Ritor1
parents:
diff changeset
3183 partyAction = (PartyAction)13;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3184 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3185 break;
0
Ritor1
parents:
diff changeset
3186 case INPUT_Land:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3187 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
3188 break;
Ritor1
parents:
diff changeset
3189 partyAction = (PartyAction)15;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3190 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3191 break;
0
Ritor1
parents:
diff changeset
3192 case INPUT_FlyDown:
Ritor1
parents:
diff changeset
3193 if ( !pCurrentScreen
Ritor1
parents:
diff changeset
3194 && !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
3195 {
Ritor1
parents:
diff changeset
3196 partyAction = (PartyAction)14;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
3197 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
3198 }
Ritor1
parents:
diff changeset
3199 break;
Ritor1
parents:
diff changeset
3200 case INPUT_ZoomIn:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3201 /*if ( dword_50C9E8 >= 40 )
0
Ritor1
parents:
diff changeset
3202 break;
Ritor1
parents:
diff changeset
3203 dword_50C9EC[3 * dword_50C9E8] = 367;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3204 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3205 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3206 ++dword_50C9E8;*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3207 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
3208 break;
0
Ritor1
parents:
diff changeset
3209 case INPUT_ZoomOut:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3210 /*if ( dword_50C9E8 < 40 )
0
Ritor1
parents:
diff changeset
3211 {
Ritor1
parents:
diff changeset
3212 dword_50C9EC[3 * dword_50C9E8] = 368;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3213 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
3214 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
0
Ritor1
parents:
diff changeset
3215 ++dword_50C9E8;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3216 }*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
3217 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0);
0
Ritor1
parents:
diff changeset
3218 break;
Ritor1
parents:
diff changeset
3219 case INPUT_AlwaysRun:
Ritor1
parents:
diff changeset
3220 bAlwaysRun = bAlwaysRun == 0;
Ritor1
parents:
diff changeset
3221 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3222 default:
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
3223 break;
0
Ritor1
parents:
diff changeset
3224 }
Ritor1
parents:
diff changeset
3225 }
Ritor1
parents:
diff changeset
3226 }
Ritor1
parents:
diff changeset
3227 }
Ritor1
parents:
diff changeset
3228 }