comparison mm7_6.cpp @ 1911:af38275939cc

which_player_to_attack rename and cleaning
author Ritor1
date Tue, 22 Oct 2013 15:52:01 +0600
parents b6a7410ff0ef
children 68f2d9d3a1d9
comparison
equal deleted inserted replaced
1909:18dacb49efe9 1911:af38275939cc
201 if ( !v13 || rand() % 100 < 90 ) 201 if ( !v13 || rand() % 100 < 90 )
202 { 202 {
203 pActor->Remove(); 203 pActor->Remove();
204 } 204 }
205 } 205 }
206
207 //----- (00426E10) --------------------------------------------------------
208 int stru319::which_player_would_attack(Actor *pActor)
209 {
210 signed int v2; // ebx@1
211 int v3; // ecx@2
212 signed int v4; // edx@3
213 char v5; // zf@3
214 unsigned int v6; // eax@3
215 int v7; // eax@6
216 int v8; // eax@7
217 int v9; // eax@8
218 int v10; // eax@9
219 int v11; // eax@10
220 int v12; // eax@11
221 int v13; // esi@35
222 signed int v14; // edi@37
223 enum CHARACTER_RACE v15; // eax@44
224 Player *v16; // ecx@47
225 unsigned __int8 v17; // sf@50
226 unsigned __int8 v18; // of@50
227 int v19; // esi@52
228 Player *v20; // ecx@53
229 int result; // eax@57
230 int v22[16]; // [sp+8h] [bp-140h]@3
231 int v23[60]; // [sp+48h] [bp-100h]@48
232 int v24; // [sp+138h] [bp-10h]@2
233 int v25; // [sp+13Ch] [bp-Ch]@1
234 int v26; // [sp+140h] [bp-8h]@1
235 int v27; // [sp+144h] [bp-4h]@1
236
237 v27 = -1;
238 v26 = -1;
239 v25 = -1;
240 v2 = 0;
241 if ( pActor->pMonsterInfo.uAttackPreference )
242 {
243 v3 = 0;
244 v24 = 0;
245 do
246 {
247 v4 = 1;
248 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3);
249 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0;
250 v22[v3] = v6;
251 if ( !v5 )
252 {
253 if ( (signed int)v6 > 128 )
254 {
255 switch ( v6 )
256 {
257 case 0x100u:
258 v27 = 8;
259 break;
260 case 0x200u:
261 v25 = 0;
262 break;
263 case 0x400u:
264 v25 = 1;
265 break;
266 case 0x800u:
267 v26 = 0;
268 break;
269 case 0x1000u:
270 v26 = 1;
271 break;
272 case 0x2000u:
273 v26 = 3;
274 break;
275 case 0x4000u:
276 v26 = 2;
277 break;
278 }
279 }
280 else
281 {
282 if ( v6 == 128 )
283 {
284 v27 = 4;
285 }
286 else
287 {
288 v7 = v6 - 1;
289 if ( v7 )
290 {
291 v8 = v7 - 1;
292 if ( v8 )
293 {
294 v9 = v8 - 2;
295 if ( v9 )
296 {
297 v10 = v9 - 4;
298 if ( v10 )
299 {
300 v11 = v10 - 8;
301 if ( v11 )
302 {
303 v12 = v11 - 16;
304 if ( v12 )
305 {
306 if ( v12 == 32 )
307 v27 = 20;
308 }
309 else
310 {
311 v27 = 32;
312 }
313 }
314 else
315 {
316 v27 = 24;
317 }
318 }
319 else
320 {
321 v27 = 28;
322 }
323 }
324 else
325 {
326 v27 = 16;
327 }
328 }
329 else
330 {
331 v27 = 12;
332 }
333 }
334 else
335 {
336 v27 = 0;
337 }
338 }
339 }
340 v2 = 0;
341 v13 = 0;
342 while ( 1 )
343 {
344 v14 = 0;
345 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType )
346 v14 = v4;
347 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex )
348 v14 = v4;
349 if ( v26 != -1 )
350 {
351 v15 = pPlayers[v13 + 1]->GetRace();
352 if ( v26 == v15 )
353 v14 = 1;
354 }
355 if ( v14 == 1 )
356 {
357 v16 = pPlayers[v13 + 1];
358 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) )
359 v23[v2++] = v13;
360 }
361 ++v13;
362 if ( v13 >= 4 )
363 break;
364 v4 = 1;
365 }
366 }
367 v3 = v24 + 1;
368 v18 = __OFSUB__(v24 + 1, 15);
369 v17 = v24++ - 14 < 0;
370 }
371 while ( v17 ^ v18 );
372 if ( v2 )
373 return v23[rand() % v2];
374 }
375 v19 = 0;
376 do
377 {
378 v20 = pPlayers[v19 + 1];
379 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) )
380 v23[v2++] = v19;
381 ++v19;
382 }
383 while ( v19 < 4 );
384 if ( v2 )
385 result = v23[rand() % v2];
386 else
387 result = 0;
388 return result;
389 }
390
391 //----- (0042704B) -------------------------------------------------------- 206 //----- (0042704B) --------------------------------------------------------
392 int stru319::special_ability_use_check( struct Actor *pActor, int a2 ) 207 int stru319::special_ability_use_check( struct Actor *pActor, int a2 )
393 { 208 {
394 stru319 *v3; // edi@1 209 stru319 *v3; // edi@1
395 signed int v4; // ebx@5 210 signed int v4; // ebx@5