comparison stru6.cpp @ 486:7887a9cf9e7b

Spells
author Nomad
date Wed, 27 Feb 2013 17:29:05 +0200
parents 58b71c1af7d8
children a3939d5067c4
comparison
equal deleted inserted replaced
485:b6bdfaa3ae0f 486:7887a9cf9e7b
84 84
85 85
86 //----- (004A71FE) -------------------------------------------------------- 86 //----- (004A71FE) --------------------------------------------------------
87 void stru6::DoAddProjectile(float srcX, float srcY, float srcZ, float dstX, float dstY, float dstZ, unsigned int uTextureID) 87 void stru6::DoAddProjectile(float srcX, float srcY, float srcZ, float dstX, float dstY, float dstZ, unsigned int uTextureID)
88 { 88 {
89 int v8; // eax@1 89 //int v8; // eax@1
90 90
91 v8 = uNumProjectiles; 91 //v8 = uNumProjectiles;
92 if ( v8 != 32 ) 92 if (uNumProjectiles < 32)
93 { 93 {
94 pProjectiles[v8].srcX = srcX; 94 pProjectiles[uNumProjectiles].srcX = srcX;
95 *((float *)&this->array_0[0].uSpellAnimLength + 7 * (uNumProjectiles + 21)) = srcY; 95 pProjectiles[uNumProjectiles].srcY = srcY;
96 pProjectiles[uNumProjectiles].srcZ = srcZ; 96 pProjectiles[uNumProjectiles].srcZ = srcZ;
97 pProjectiles[uNumProjectiles].dstX = dstX; 97 pProjectiles[uNumProjectiles].dstX = dstX;
98 pProjectiles[uNumProjectiles].dstY = dstY; 98 pProjectiles[uNumProjectiles].dstY = dstY;
99 pProjectiles[uNumProjectiles].dstZ = dstZ; 99 pProjectiles[uNumProjectiles].dstZ = dstZ;
100 pProjectiles[uNumProjectiles++].uTextureID = uTextureID; 100 pProjectiles[uNumProjectiles++].uTextureID = uTextureID;
162 memset(&local_0, 0, 0x68u); 162 memset(&local_0, 0, 0x68u);
163 v5 = a2; 163 v5 = a2;
164 v6 = a2->field_54; 164 v6 = a2->field_54;
165 if ( v6 ) 165 if ( v6 )
166 { 166 {
167 v7 = &v4->array_0[v6 & 0x1F]; 167 v7 = &v4->array_4[v6 & 0x1F];
168 x = ((double)a2->vPosition.x - v7->flt_4) * 0.5 + v7->flt_4; 168 x = ((double)a2->vPosition.x - v7->flt_0_x) * 0.5 + v7->flt_0_x;
169 v8 = ((double)v5->vPosition.y - v7->flt_8) * 0.5 + v7->flt_8; 169 v8 = ((double)v5->vPosition.y - v7->flt_4_y) * 0.5 + v7->flt_4_y;
170 v9 = ((double)v5->vPosition.z - v7->flt_C) * 0.5 + v7->flt_C; 170 v9 = ((double)v5->vPosition.z - v7->flt_8_z) * 0.5 + v7->flt_8_z;
171 local_0.bFree = 1036; 171 local_0.bFree = 1036;
172 local_0.uDiffuse = uDiffuse; 172 local_0.uDiffuse = uDiffuse;
173 local_0.x = x + 4.0; 173 local_0.x = x + 4.0;
174 local_0.y = v8; 174 local_0.y = v8;
175 local_0.z = v9; 175 local_0.z = v9;
186 local_0.y = (double)v5->vPosition.y; 186 local_0.y = (double)v5->vPosition.y;
187 local_0.z = (double)v5->vPosition.z; 187 local_0.z = (double)v5->vPosition.z;
188 pGame->pParticleEngine->AddParticle(&local_0); 188 pGame->pParticleEngine->AddParticle(&local_0);
189 local_0.x = (double)v5->vPosition.x - 4.0; 189 local_0.x = (double)v5->vPosition.x - 4.0;
190 pGame->pParticleEngine->AddParticle(&local_0); 190 pGame->pParticleEngine->AddParticle(&local_0);
191 v4->array_0[v5->field_54 & 0x1F].flt_4 = (double)v5->vPosition.x; 191 v4->array_4[v5->field_54 & 0x1F].flt_0_x = (double)v5->vPosition.x;
192 v4->array_0[v5->field_54 & 0x1F].flt_8 = (double)v5->vPosition.y; 192 v4->array_4[v5->field_54 & 0x1F].flt_4_y = (double)v5->vPosition.y;
193 v4->array_0[v5->field_54 & 0x1F].flt_C = (double)v5->vPosition.z; 193 v4->array_4[v5->field_54 & 0x1F].flt_8_z = (double)v5->vPosition.z;
194 } 194 }
195 else 195 else
196 { 196 {
197 a2->field_54 = v4->array_0[0].uSpellAnimLength++; 197 a2->field_54 = v4->field_0++;
198 v4->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x; 198 v4->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x;
199 v4->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y; 199 v4->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y;
200 v4->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z; 200 v4->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z;
201 v10 = (double)a2->vPosition.x; 201 v10 = (double)a2->vPosition.x;
202 local_0.bFree = 1036; 202 local_0.bFree = 1036;
203 local_0.uDiffuse = uDiffuse; 203 local_0.uDiffuse = uDiffuse;
204 local_0.x = v10 + 4.0; 204 local_0.x = v10 + 4.0;
205 local_0.y = (double)a2->vPosition.y; 205 local_0.y = (double)a2->vPosition.y;
509 v3 = a2; 509 v3 = a2;
510 v4 = a2->field_54; 510 v4 = a2->field_54;
511 v5 = &pObjectList->pObjects[a2->uObjectDescID]; 511 v5 = &pObjectList->pObjects[a2->uObjectDescID];
512 if ( v4 ) 512 if ( v4 )
513 { 513 {
514 v6 = &v2->array_0[v4 & 0x1F]; 514 v6 = &v2->array_4[v4 & 0x1F];
515 v7 = ((double)a2->vPosition.x - v6->flt_4) * 0.5 + v6->flt_4; 515 v7 = ((double)a2->vPosition.x - v6->flt_0_x) * 0.5 + v6->flt_0_x;
516 v8 = ((double)a2->vPosition.y - v6->flt_8) * 0.5 + v6->flt_8; 516 v8 = ((double)a2->vPosition.y - v6->flt_4_y) * 0.5 + v6->flt_4_y;
517 v9 = ((double)a2->vPosition.z - v6->flt_C) * 0.5 + v6->flt_C; 517 v9 = ((double)a2->vPosition.z - v6->flt_8_z) * 0.5 + v6->flt_8_z;
518 local_0.bFree = 2048; 518 local_0.bFree = 2048;
519 local_0.uDiffuse = 0xFFFFFFu; 519 local_0.uDiffuse = 0xFFFFFFu;
520 a2a = v9; 520 a2a = v9;
521 local_0.x = v7; 521 local_0.x = v7;
522 local_0.z = a2a; 522 local_0.z = a2a;
534 local_0.x = v11; 534 local_0.x = v11;
535 local_0.y = (double)v3->vPosition.y; 535 local_0.y = (double)v3->vPosition.y;
536 local_0.z = (double)v3->vPosition.z; 536 local_0.z = (double)v3->vPosition.z;
537 local_0.timeToLive = (rand() & 0x3F) + 64; 537 local_0.timeToLive = (rand() & 0x3F) + 64;
538 pGame->pParticleEngine->AddParticle(&local_0); 538 pGame->pParticleEngine->AddParticle(&local_0);
539 v2->array_0[v3->field_54 & 0x1F].flt_4 = (double)v3->vPosition.x; 539 v2->array_4[v3->field_54 & 0x1F].flt_0_x = (double)v3->vPosition.x;
540 v2->array_0[v3->field_54 & 0x1F].flt_8 = (double)v3->vPosition.y; 540 v2->array_4[v3->field_54 & 0x1F].flt_4_y = (double)v3->vPosition.y;
541 v2->array_0[v3->field_54 & 0x1F].flt_C = (double)v3->vPosition.z; 541 v2->array_4[v3->field_54 & 0x1F].flt_8_z = (double)v3->vPosition.z;
542 } 542 }
543 else 543 else
544 { 544 {
545 a2->field_54 = v2->array_0[0].uSpellAnimLength++; 545 a2->field_54 = v2->field_0++;
546 v2->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x; 546 v2->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x;
547 v2->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y; 547 v2->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y;
548 v2->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z; 548 v2->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z;
549 v12 = (double)a2->vPosition.x; 549 v12 = (double)a2->vPosition.x;
550 local_0.bFree = 2048; 550 local_0.bFree = 2048;
551 local_0.uDiffuse = 0xFFFFFFu; 551 local_0.uDiffuse = 0xFFFFFFu;
552 LODWORD(local_0.flt_28) = 0x40000000u; 552 LODWORD(local_0.flt_28) = 0x40000000u;
553 local_0.x = v12; 553 local_0.x = v12;
575 { 575 {
576 v5 = (double)a2->vPosition.z; 576 v5 = (double)a2->vPosition.z;
577 v6 = (double)a2->vPosition.y; 577 v6 = (double)a2->vPosition.y;
578 v7 = (double)a2->vPosition.x; 578 v7 = (double)a2->vPosition.x;
579 DoAddProjectile( 579 DoAddProjectile(
580 this->array_0[v4 & 0x1F].flt_4, 580 this->array_4[v4 & 0x1F].flt_0_x,
581 this->array_0[v4 & 0x1F].flt_8, 581 this->array_4[v4 & 0x1F].flt_4_y,
582 this->array_0[v4 & 0x1F].flt_C, 582 this->array_4[v4 & 0x1F].flt_8_z,
583 v7, 583 v7,
584 v6, 584 v6,
585 v5, 585 v5,
586 uTextureID); 586 uTextureID);
587 } 587 }
588 else 588 else
589 { 589 {
590 a2->field_54 = this->array_0[0].uSpellAnimLength++; 590 a2->field_54 = this->field_0++;
591 this->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x; 591 this->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x;
592 this->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y; 592 this->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y;
593 this->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z; 593 this->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z;
594 } 594 }
595 } 595 }
596 596
597 //----- (004A7E89) -------------------------------------------------------- 597 //----- (004A7E89) --------------------------------------------------------
598 void stru6::_4A7E89_sparkles_on_actor_after_it_casts_buff(Actor *pActor, unsigned int uDiffuse) 598 void stru6::_4A7E89_sparkles_on_actor_after_it_casts_buff(Actor *pActor, unsigned int uDiffuse)
1317 LOBYTE(result) = 0; 1317 LOBYTE(result) = 0;
1318 return result; 1318 return result;
1319 } 1319 }
1320 1320
1321 //----- (004A89BD) -------------------------------------------------------- 1321 //----- (004A89BD) --------------------------------------------------------
1322 int stru6::SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID) 1322 void stru6::SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID)
1323 { 1323 {
1324 stru6 *v3; // edi@1 1324 //stru6 *v3; // edi@1
1325 PlayerBuffAnim *v4; // esi@1 1325 PlayerBuffAnim *v4; // esi@1
1326 int result; // eax@1
1327 const char *v6; // [sp-4h] [bp-10h]@2 1326 const char *v6; // [sp-4h] [bp-10h]@2
1328 1327
1329 v3 = this; 1328 //v3 = this;
1330 v4 = (PlayerBuffAnim *)((char *)this + 16 * (signed __int16)uPlayerID); 1329 //v4 = &array_0[uPlayerID];
1331 v4[32].uSpellIconID_ = 0; 1330 //v4[32].uSpellIconID_ = 0; pPlayerBuffs[]::field_4
1332 v4[32].uSpellID = uSpellID; 1331 //v4[32].uSpellID = uSpellID; pPlayerBuffs[]::bRender
1333 result = (signed __int16)uSpellID - 3; 1332
1334 switch ( uSpellID ) 1333 v4 = &pPlayerBuffs[uPlayerID];
1335 { 1334 v4->field_4 = 0;
1336 case (SPELL_WATER_PROTECTION_FROM_WATER|0x80): 1335 v4->bRender = uSpellID != 0;
1336
1337 switch (uSpellID)
1338 {
1339 case 153:
1340 __debugbreak(); // spell id == 153 wtf
1337 v6 = "zapp"; 1341 v6 = "zapp";
1338 goto LABEL_24; 1342 break;
1343
1344 case 150:
1345 __debugbreak(); // spell id == 150 wtf
1339 case SPELL_AIR_FEATHER_FALL: 1346 case SPELL_AIR_FEATHER_FALL:
1340 case SPELL_SPIRIT_DETECT_LIFE: 1347 case SPELL_SPIRIT_DETECT_LIFE:
1341 case SPELL_SPIRIT_DOOM: 1348 case SPELL_SPIRIT_FATE:
1342 case 0x96u:
1343 v6 = "spboost1"; 1349 v6 = "spboost1";
1344 goto LABEL_24; 1350 break;
1345 case SPELL_AIR_SHIELD|0x2: 1351
1352 case 151:
1353 __debugbreak(); // spell id == 151 wtf
1354 case SPELL_AIR_INVISIBILITY:
1346 case SPELL_WATER_WATER_WALK: 1355 case SPELL_WATER_WATER_WALK:
1347 case SPELL_SPIRIT_PRESERVE: 1356 case SPELL_SPIRIT_PRESERVATION:
1348 case 0x97u:
1349 v6 = "spboost2"; 1357 v6 = "spboost2";
1350 goto LABEL_24; 1358 break;
1351 case SPELL_BODY_CURE_WEAKNESS|0x10: 1359
1352 case SPELL_BODY_FIRST_AID|SPELL_AIR_SHIELD: 1360 case 152:
1353 case 0x56u: 1361 __debugbreak(); // spell id == 152 wtf
1354 case SPELL_BODY_CURE_POISON|0x10: 1362 case SPELL_LIGHT_HOUR_OF_POWER:
1355 case 0x98u: 1363 case SPELL_LIGHT_DAY_OF_THE_GODS:
1364 case SPELL_LIGHT_DAY_OF_PROTECTION:
1365 case SPELL_LIGHT_DIVINE_INTERVENTION:
1356 v6 = "spboost3"; 1366 v6 = "spboost3";
1357 goto LABEL_24; 1367 break;
1358 case (SPELL_AIR_SHIELD|0x20): 1368
1369 case SPELL_SPIRIT_REMOVE_CURSE:
1359 case SPELL_MIND_REMOVE_FEAR: 1370 case SPELL_MIND_REMOVE_FEAR:
1360 case SPELL_BODY_CURE_WEAKNESS: 1371 case SPELL_BODY_CURE_WEAKNESS:
1361 v6 = "spheal1"; 1372 v6 = "spheal1";
1362 goto LABEL_24; 1373 break;
1363 case SPELL_SPIRIT_PRESERVE|0x4: 1374
1375 case SPELL_SPIRIT_SHARED_LIFE:
1364 case SPELL_MIND_CURE_PARALYSIS: 1376 case SPELL_MIND_CURE_PARALYSIS:
1365 case 0x40u: 1377 case SPELL_MIND_CURE_INSANITY:
1366 case SPELL_BODY_FIRST_AID: 1378 case SPELL_BODY_FIRST_AID:
1367 case SPELL_BODY_CURE_POISON: 1379 case SPELL_BODY_CURE_POISON:
1368 case SPELL_BODY_CURE_DISEASE: 1380 case SPELL_BODY_CURE_DISEASE:
1369 case 0x60u: 1381 case SPELL_DARK_SACRIFICE:
1370 v6 = "spheal2"; 1382 v6 = "spheal2";
1371 goto LABEL_24; 1383 break;
1372 case SPELL_BODY_HAMMERHANDS|0x4: 1384
1373 case SPELL_BODY_CURE_WEAKNESS|0x20: 1385 case SPELL_BODY_POWER_CURE:
1386 case SPELL_DARK_SOULDRINKER:
1374 v6 = "spheal3"; 1387 v6 = "spheal3";
1375 goto LABEL_24; 1388 break;
1389
1376 case SPELL_FIRE_PROTECTION_FROM_FIRE: 1390 case SPELL_FIRE_PROTECTION_FROM_FIRE:
1377 case SPELL_FIRE_FIRE_RING: 1391 case SPELL_FIRE_IMMOLATION:
1378 v6 = "spell03"; 1392 v6 = "spell03";
1379 goto LABEL_24; 1393 break;
1380 case SPELL_FIRE_HASTE: 1394
1381 v6 = "spell05"; 1395 case SPELL_FIRE_HASTE: v6 = "spell05"; break;
1382 goto LABEL_24; 1396 case SPELL_AIR_PROTECTION_FROM_AIR: v6 = "spell14"; break;
1383 case SPELL_AIR_PROTECTION_FROM_AIR: 1397 case SPELL_AIR_SHIELD: v6 = "spell17"; break;
1384 v6 = "spell14"; 1398 case SPELL_WATER_PROTECTION_FROM_WATER: v6 = "spell25"; break;
1385 goto LABEL_24; 1399 case SPELL_EARTH_PROTECTION_FROM_EARTH: v6 = "spell36"; break;
1386 case SPELL_AIR_SHIELD: 1400 case SPELL_EARTH_STONESKIN: v6 = "spell38"; break;
1387 v6 = "spell17"; 1401 case SPELL_SPIRIT_BLESS: v6 = "spell46"; break;
1388 goto LABEL_24; 1402 case SPELL_SPIRIT_HEROISM: v6 = "spell51"; break;
1389 case SPELL_WATER_PROTECTION_FROM_WATER: 1403 case SPELL_SPIRIT_RESSURECTION: v6 = "spell55"; break;
1390 v6 = "spell25"; 1404 case SPELL_MIND_PROTECTION_FROM_MIND: v6 = "spell58"; break;
1391 goto LABEL_24; 1405 case SPELL_BODY_PROTECTION_FROM_BODY: v6 = "spell69"; break;
1392 case SPELL_EARTH_PROTECTION_FROM_EARTH: 1406 case SPELL_BODY_REGENERATION: v6 = "spell71"; break;
1393 v6 = "spell36"; 1407 case SPELL_BODY_HAMMERHANDS: v6 = "spell73"; break;
1394 goto LABEL_24; 1408 case SPELL_BODY_PROTECTION_FROM_MAGIC: v6 = "spell75"; break;
1395 case SPELL_EARTH_STONESKIN: 1409
1396 v6 = "spell38";
1397 goto LABEL_24;
1398 case SPELL_SPIRIT_BLESS:
1399 v6 = "spell46";
1400 goto LABEL_24;
1401 case SPELL_SPIRIT_HEROISM:
1402 v6 = "spell51";
1403 goto LABEL_24;
1404 case SPELL_SPIRIT_HEROISM|0x4:
1405 v6 = "spell55";
1406 goto LABEL_24;
1407 case SPELL_MIND_PROTECTION_FROM_MIND:
1408 v6 = "spell58";
1409 goto LABEL_24;
1410 case SPELL_BODY_FIRST_AID|0x1:
1411 v6 = "spell69";
1412 goto LABEL_24;
1413 case SPELL_BODY_FIRST_AID|SPELL_FIRE_PROTECTION_FROM_FIRE:
1414 v6 = "spell71";
1415 goto LABEL_24;
1416 case SPELL_BODY_HAMMERHANDS:
1417 v6 = "spell73";
1418 goto LABEL_24;
1419 case SPELL_BODY_PROTECTION_FROM_MAGIC:
1420 v6 = "spell75";
1421 LABEL_24:
1422 result = pIconsFrameTable->FindIcon(v6);
1423 v4[33].uSpellIconID = result;
1424 break;
1425 default: 1410 default:
1426 v4[32].uSpellID = 0; 1411 //v4[32].uSpellID = 0;
1427 break; 1412 v4->bRender = false;
1428 } 1413 return;
1429 if ( v4[32].uSpellID ) 1414 }
1430 { 1415
1431 result = 8 * pIconsFrameTable->pIcons[v4[33].uSpellIconID].uAnimLength; 1416 //v4[33].uSpellIconID = pIconsFrameTable->FindIcon(v6);
1432 v3->array_0[(signed __int16)uPlayerID + 33].uSpellAnimLength = result; 1417 v4->uSpellIconID = pIconsFrameTable->FindIcon(v6);
1433 } 1418 //if ( v4[32].uSpellID )
1434 return result; 1419 if (v4->bRender)
1420 //v3->array_0[(signed __int16)uPlayerID + 33].uSpellAnimLength = 8 * pIconsFrameTable->pIcons[v4[33].uSpellIconID].uAnimLength;
1421 v4->uSpellAnimTime = 8 * pIconsFrameTable->pIcons[v4->uSpellIconID].uAnimLength;
1435 } 1422 }
1436 1423
1437 //----- (004A8BDF) -------------------------------------------------------- 1424 //----- (004A8BDF) --------------------------------------------------------
1438 void stru6::FadeScreen__like_Turn_Undead_and_mb_Armageddon(unsigned int uDiffuseColor, unsigned int uFadeTime) 1425 void stru6::FadeScreen__like_Turn_Undead_and_mb_Armageddon(unsigned int uDiffuseColor, unsigned int uFadeTime)
1439 { 1426 {