Mercurial > might-and-magic-trilogy
view stru6.cpp @ 28:18f7a1b94448
Indoor::Load
author | Nomad |
---|---|
date | Tue, 16 Oct 2012 19:31:34 +0200 |
parents | 509744251c8e |
children | bcc051713d20 |
line wrap: on
line source
#include "stru6.h" #include "LayingItem.h" #include "IndoorCameraD3D.h" #include "ParticleEngine.h" #include "Game.h" #include "LOD.h" #include "Sprites.h" #include "DecalBuilder.h" #include "ObjectList.h" #include "Actor.h" #include "Random.h" #include "Spells.h" #include "IconFrameTable.h" #include "Time.h" #include "Viewport.h" #include "PaletteManager.h" #include "Overlays.h" #include "stru160.h" //----- (00478211) -------------------------------------------------------- void stru6_stru1_indoor_sw_billboard::Initialize(int a2) { uNumVec4sInArray1 = 66; pArray1 = new stru16x[66]; uNumVec3sInArray2 = 128; pArray2 = new stru160[128]; for (uint i = 0; i < uNumVec4sInArray1; ++i) { pArray1[i].field_0 = array_4EB8B8[i].field_0; pArray1[i].field_4 = array_4EB8B8[i].field_4; pArray1[i].field_8 = array_4EB8B8[i].field_8; pArray1[i].field_C = a2; } memcpy(pArray2, array_4EBBD0_x/*array_4EBBD0*/, uNumVec3sInArray2 * sizeof(stru160)); } //----- (0047829F) -------------------------------------------------------- void stru6_stru1_indoor_sw_billboard::_47829F_fireball_collision(float arg0, float a3, float a4, float a5, int a2) { stru6_stru1_indoor_sw_billboard *v6; // esi@1 int v7; // edi@1 char *v8; // eax@2 signed int v9; // ecx@2 int v10; // edx@3 signed int i; // [sp+8h] [bp-4h]@1 auto a1 = this; v6 = a1; v7 = 0; for ( i = 0; i < (signed int)v6->uNumVec3sInArray2; ++i ) { v8 = (char *)&v6->field_14[1]; v9 = 3; do { *((float *)v8 - 1) = a5 * *(&v6->pArray1->field_0 + 4 * *(int *)((char *)&v6->pArray2->field_0 + v7)) + arg0; *(float *)v8 = a5 * *(&v6->pArray1->field_4 + 4 * *(int *)((char *)&v6->pArray2->field_0 + v7)) + a3; v8 += 16; *((float *)v8 - 3) = a5 * *(&v6->pArray1->field_8 + 4 * *(int *)((char *)&v6->pArray2->field_0 + v7)) + a4; v10 = *(int *)((char *)&v6->pArray2->field_0 + v7); v7 += 4; --v9; *((int *)v8 - 2) = *((int *)&v6->pArray1[1].field_0 + 4 * v10); } while ( v9 ); v6->field_10 = 3; if ( v6->sub_477C61() && v6->sub_477F63() ) { if ( v6->sub_47802A() ) pRenderer->_4A4CC9(v6, a2); } } } //----- (004A71FE) -------------------------------------------------------- void stru6::DoAddProjectile(float srcX, float srcY, float srcZ, float dstX, float dstY, float dstZ, unsigned int uTextureID) { int v8; // eax@1 v8 = this->uNumProjectiles; if ( v8 != 32 ) { this->pProjectiles[v8].srcX = srcX; *((float *)&this->array_0[0].uSpellAnimLength + 7 * (this->uNumProjectiles + 21)) = srcY; this->pProjectiles[this->uNumProjectiles].srcZ = srcZ; this->pProjectiles[this->uNumProjectiles].dstX = dstX; this->pProjectiles[this->uNumProjectiles].dstY = dstY; this->pProjectiles[this->uNumProjectiles].dstZ = dstZ; this->pProjectiles[this->uNumProjectiles++].uTextureID = uTextureID; } } //----- (004A7298) -------------------------------------------------------- int stru6::DrawProjectiles() { stru6 *v1; // ebx@1 char *v2; // eax@1 signed int v3; // ecx@1 unsigned __int8 v4; // zf@3 unsigned __int8 v5; // sf@3 IndoorCameraD3D *v6; // edi@3 int result; // eax@3 int v8; // esi@4 int v9; // eax@5 float v10; // ST1C_4@8 float v11; // ST0C_4@8 IDirect3DTexture2 *v12; // [sp+20h] [bp-78h]@6 RenderVertexSoft v13[2]; // [sp+30h] [bp-68h]@1 float v14; // [sp+90h] [bp-8h]@3 int v15; // [sp+94h] [bp-4h]@3 v1 = this; v2 = (char *)&v13[0].flt_2C; v3 = 2; do { *(float *)v2 = 0.0; v2 += 48; --v3; } while ( v3 ); v15 = 0; v4 = v1->uNumProjectiles == 0; v5 = v1->uNumProjectiles < 0; v6 = pGame->pIndoorCameraD3D; result = LODWORD(v6->flt_D0); v14 = v6->flt_D0; if ( !(v5 | v4) ) { v8 = (int)&v1->pProjectiles[0].srcY; do { v13[0].vWorldPosition.x = *(float *)(v8 - 4); v13[0].vWorldPosition.y = *(float *)v8; v13[0].vWorldPosition.z = *(float *)(v8 + 4); v13[1].vWorldPosition.x = *(float *)(v8 + 8); v13[1].vWorldPosition.y = *(float *)(v8 + 12); v13[1].vWorldPosition.z = *(float *)(v8 + 16); v6->ViewTransform(v13, 2u); sr_42620A(v13); v6->_436BB7_project_and_stuff(v13, 2u, 0); v9 = *(int *)(v8 + 20); if ( v9 == -1 ) v12 = 0; else v12 = pBitmaps_LOD->pHardwareTextures[v9]; v10 = v14 / v13[1].vWorldViewPosition.x * 20.0; v11 = v14 / v13[0].vWorldViewPosition.x * 20.0; pRenderer->DrawProjectile( v13[0].vWorldViewProjX, v13[0].vWorldViewProjY, v13[0].vWorldViewPosition.x, v11, v13[1].vWorldViewProjX, v13[1].vWorldViewProjY, v13[1].vWorldViewPosition.x, v10, v12); ++v15; v8 += 28; result = v15; } while ( v15 < v1->uNumProjectiles ); } return result; } //----- (004A73AA) -------------------------------------------------------- void stru6::_4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(LayingItem *a2, unsigned int uDiffuse, unsigned int uTextureID) { stru6 *v4; // edi@1 LayingItem *v5; // esi@1 int v6; // eax@1 stru6_stru2 *v7; // eax@2 double v8; // st7@2 double v9; // st6@2 double v10; // st7@3 Particle_ local_0; // [sp+8h] [bp-68h]@1 float x; // [sp+78h] [bp+8h]@2 v4 = this; memset(&local_0, 0, 0x68u); v5 = a2; v6 = a2->field_54; if ( v6 ) { v7 = &v4->array_0[v6 & 0x1F]; x = ((double)a2->vPosition.x - v7->flt_4) * 0.5 + v7->flt_4; v8 = ((double)v5->vPosition.y - v7->flt_8) * 0.5 + v7->flt_8; v9 = ((double)v5->vPosition.z - v7->flt_C) * 0.5 + v7->flt_C; local_0.bFree = 1036; local_0.uDiffuse = uDiffuse; local_0.x = x + 4.0; local_0.y = v8; local_0.z = v9; local_0.flt_10 = 0.0; local_0.flt_14 = 0.0; local_0.flt_18 = 0.0; local_0.field_20 = (rand() & 0x40) + 96; local_0.uTextureID = uTextureID; local_0.flt_28 = 1.0; pGame->pParticleEngine->AddParticle(&local_0); local_0.x = x - 4.0; pGame->pParticleEngine->AddParticle(&local_0); local_0.x = (double)v5->vPosition.x + 4.0; local_0.y = (double)v5->vPosition.y; local_0.z = (double)v5->vPosition.z; pGame->pParticleEngine->AddParticle(&local_0); local_0.x = (double)v5->vPosition.x - 4.0; pGame->pParticleEngine->AddParticle(&local_0); v4->array_0[v5->field_54 & 0x1F].flt_4 = (double)v5->vPosition.x; v4->array_0[v5->field_54 & 0x1F].flt_8 = (double)v5->vPosition.y; v4->array_0[v5->field_54 & 0x1F].flt_C = (double)v5->vPosition.z; } else { a2->field_54 = v4->array_0[0].uSpellAnimLength++; v4->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x; v4->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y; v4->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z; v10 = (double)a2->vPosition.x; local_0.bFree = 1036; local_0.uDiffuse = uDiffuse; local_0.x = v10 + 4.0; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; local_0.flt_10 = 0.0; local_0.flt_14 = 0.0; local_0.flt_18 = 0.0; local_0.flt_28 = 1.0; local_0.field_20 = (rand() & 0x7F) + 128; local_0.uTextureID = uTextureID; pGame->pParticleEngine->AddParticle(&local_0); local_0.x = (double)a2->vPosition.x - 4.0; pGame->pParticleEngine->AddParticle(&local_0); } } //----- (004A75CC) -------------------------------------------------------- void stru6::_4A75CC_single_spell_collision_particle(LayingItem *a1, unsigned int uDiffuse, unsigned int uTextureID) { double v4; // st7@1 signed int v5; // edi@1 Particle_ local_0; // [sp+8h] [bp-68h]@1 memset(&local_0, 0, 0x68u); local_0.bFree = 1029; local_0.x = (double)a1->vPosition.x; local_0.y = (double)a1->vPosition.y; v4 = (double)a1->vPosition.z; local_0.uDiffuse = uDiffuse; local_0.z = v4; v5 = 10; local_0.field_20 = (rand() & 0x7F) + 128; local_0.uTextureID = uTextureID; local_0.flt_28 = 1.0; do { local_0.flt_10 = (double)(rand() & 0x1FF) - 255.0; local_0.flt_14 = (double)(rand() & 0x1FF) - 255.0; local_0.flt_18 = (double)(rand() & 0x1FF) - 255.0; pGame->pParticleEngine->AddParticle(&local_0); --v5; } while ( v5 ); } //----- (004A7688) -------------------------------------------------------- void stru6::_4A7688_fireball_collision_particle(LayingItem *a2) { LayingItem *v2; // esi@1 double v3; // st7@1 double v4; // st7@2 double v5; // st7@4 int v6; // eax@6 float v7; // ST0C_4@6 float v8; // ST08_4@6 float v9; // ST04_4@6 float v10; // ST00_4@6 Particle_ local_0; // [sp+1Ch] [bp-7Ch]@1 stru6 *v12; // [sp+84h] [bp-14h]@1 float v13; // [sp+88h] [bp-10h]@1 double v14; // [sp+8Ch] [bp-Ch]@5 float v15; // [sp+94h] [bp-4h]@4 signed int i; // [sp+A0h] [bp+8h]@4 signed int a2b; // [sp+A0h] [bp+8h]@6 v12 = this; memset(&local_0, 0, 0x68u); v2 = a2; v3 = (double)a2->uSpriteFrameID / (double)pObjectList->pObjects[a2->uObjectDescID].uLifetime; v13 = 512.0 * v3; if ( v3 >= 0.75 ) v4 = (1.0 - v3) * 4.0; else v4 = v3 * 1.333333333333333; v15 = v4; v5 = (double)a2->vPosition.x; local_0.bFree = 1029; local_0.uDiffuse = 0xFF3C1Eu; local_0.x = v5; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; local_0.field_20 = (rand() & 0x7F) + 128; local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); i = 10; local_0.flt_28 = 1.0; do { HIDWORD(v14) = rand() & 0x1FF; local_0.flt_10 = (double)SHIDWORD(v14) - 255.0; HIDWORD(v14) = rand() & 0x1FF; local_0.flt_14 = (double)SHIDWORD(v14) - 255.0; WORD2(v14) = rand() & 0x1FF; HIDWORD(v14) = WORD2(v14); local_0.flt_18 = (double)WORD2(v14) - 255.0; pGame->pParticleEngine->AddParticle(&local_0); --i; } while ( i ); v14 = v13 + 6.7553994e15; a2b = LODWORD(v14); v6 = sub_4A7063(0xFF3C1Eu, v15); v7 = (double)a2b; v8 = (double)v2->vPosition.z; v9 = (double)v2->vPosition.y; v10 = (double)v2->vPosition.x; v12->pStru1->_47829F_fireball_collision(v10, v9, v8, v7, v6); } //----- (004A77FD) -------------------------------------------------------- void stru6::_4A77FD_some_stuff_d3d(LayingItem *a1) { LayingItem *v2; // esi@1 stru6 *v3; // edi@1 double v4; // st7@1 double v5; // st7@2 double v6; // ST1C_8@4 int v7; // eax@4 float v8; // ST0C_4@4 float v9; // ST08_4@4 float v10; // ST04_4@4 float v11; // ST00_4@4 float v12; // [sp+28h] [bp-4h]@1 float a1a; // [sp+34h] [bp+8h]@4 v2 = a1; v3 = this; v4 = (double)a1->uSpriteFrameID / (double)pObjectList->pObjects[a1->uObjectDescID].uLifetime; v12 = 512.0 - v4 * 512.0; if ( v4 >= 0.75 ) v5 = v4 * 4.0; else v5 = v4 * 1.333333333333333; a1a = v5; v6 = v12 + 6.7553994e15; v7 = sub_4A7063(0x7E7E7Eu, a1a); v8 = (double)SLODWORD(v6); v9 = (double)v2->vPosition.z; v10 = (double)v2->vPosition.y; v11 = (double)v2->vPosition.x; v3->pStru1->_47829F_fireball_collision(v11, v10, v9, v8, v7); } //----- (004A78AE) -------------------------------------------------------- void stru6::_4A78AE_sparks_spell(LayingItem *a1) { ObjectDesc *v2; // esi@1 unsigned int v3; // eax@1 double v4; // st7@1 Particle_ local_0; // [sp+8h] [bp-68h]@1 v2 = &pObjectList->pObjects[a1->uObjectDescID]; memset(&local_0, 0, 0x68u); v3 = a1->uSpriteFrameID; local_0.x = (double)a1->vPosition.x; v4 = (double)a1->vPosition.y; local_0.bFree = 2048; local_0.uDiffuse = 0x7F7F7Fu; local_0.field_20 = 1; local_0.y = v4; local_0.z = (double)a1->vPosition.z; local_0.flt_10 = 0.0; local_0.flt_14 = 0.0; local_0.flt_18 = 0.0; local_0.uTextureID = pSpriteFrameTable->GetFrame(v2->uSpriteID, v3)->pHwSpriteIDs[0]; LODWORD(local_0.flt_28) = 0x40000000u; pGame->pParticleEngine->AddParticle(&local_0); } //----- (004A7948) -------------------------------------------------------- void stru6::_4A7948_mind_blast_after_effect(LayingItem *a1) { ObjectDesc *v2; // esi@1 unsigned int v3; // eax@1 double v4; // st7@1 char v5; // al@1 signed int v6; // edi@1 Particle_ Dst; // [sp+8h] [bp-68h]@1 v2 = &pObjectList->pObjects[a1->uObjectDescID]; memset(&Dst, 0, 0x68u); v3 = a1->uSpriteFrameID; Dst.x = (double)a1->vPosition.x; v4 = (double)a1->vPosition.y; Dst.bFree = 2053; Dst.uDiffuse = 0x7F7F7Fu; Dst.y = v4; Dst.z = (double)a1->vPosition.z; Dst.uTextureID = pSpriteFrameTable->GetFrame(v2->uSpriteID, v3)->pHwSpriteIDs[0]; v5 = rand(); v6 = 10; Dst.flt_28 = 1.0; Dst.field_20 = (v5 & 0x7F) + 128; do { Dst.flt_10 = (double)(rand() & 0x1FF) - 255.0; Dst.flt_14 = (double)(rand() & 0x1FF) - 255.0; Dst.flt_18 = (double)(rand() & 0x1FF) - 255.0; pGame->pParticleEngine->AddParticle(&Dst); --v6; } while ( v6 ); } //----- (004A7A27) -------------------------------------------------------- bool stru6::AddMobileLight(LayingItem *a1, unsigned int uDiffuse, int uRadius) { return pMobileLightsStack->AddLight( a1->vPosition.x, a1->vPosition.y, a1->vPosition.z, a1->uSectorID, uRadius, uDiffuse >> 16, BYTE1(uDiffuse), uDiffuse != 0, (int *)byte_4E94D3); } // 4E94D3: using guessed type char byte_4E94D3; //----- (004A7A66) -------------------------------------------------------- void stru6::_4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(LayingItem *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4) { int v5; // eax@1 char v6; // al@1 double v7; // st6@1 double v8; // st6@1 double v9; // st7@1 double v10; // st6@1 Particle_ local_0; // [sp+0h] [bp-6Ch]@1 float v12; // [sp+68h] [bp-4h]@1 float a1a; // [sp+74h] [bp+8h]@1 float uDiffusea; // [sp+78h] [bp+Ch]@1 float uTextureIDa; // [sp+7Ch] [bp+10h]@1 memset(&local_0, 0, 0x68u); local_0.bFree = 1029; local_0.x = (double)a1->vPosition.x; v5 = a1->vPosition.z; local_0.y = (double)a1->vPosition.y; local_0.uDiffuse = uDiffuse; local_0.z = (double)(v5 + 32); v6 = rand(); local_0.flt_28 = 1.0; v7 = 0.0 * a4; local_0.field_20 = (v6 & 0x7F) + 128; local_0.uTextureID = uTextureID; a1a = v7; local_0.flt_10 = v7; local_0.flt_14 = a4; local_0.flt_18 = a4; pGame->pParticleEngine->AddParticle(&local_0); v8 = 0.70710677 * a4; uDiffusea = v8; local_0.flt_10 = v8; local_0.flt_14 = v8; local_0.flt_18 = a4; pGame->pParticleEngine->AddParticle(&local_0); local_0.flt_14 = a1a; local_0.flt_10 = a4; local_0.flt_18 = a4; pGame->pParticleEngine->AddParticle(&local_0); local_0.flt_10 = uDiffusea; local_0.flt_18 = a4; v9 = -uDiffusea; uTextureIDa = v9; local_0.flt_14 = v9; pGame->pParticleEngine->AddParticle(&local_0); v10 = -1.0 * a4; local_0.flt_10 = a1a; v12 = v10; local_0.flt_14 = v10; local_0.flt_18 = a4; pGame->pParticleEngine->AddParticle(&local_0); local_0.flt_18 = a4; local_0.flt_10 = uTextureIDa; local_0.flt_14 = uTextureIDa; pGame->pParticleEngine->AddParticle(&local_0); local_0.flt_10 = v12; local_0.flt_14 = a1a; local_0.flt_18 = a4; pGame->pParticleEngine->AddParticle(&local_0); local_0.flt_10 = uTextureIDa; local_0.flt_14 = uDiffusea; local_0.flt_18 = a4; pGame->pParticleEngine->AddParticle(&local_0); } //----- (004A7C07) -------------------------------------------------------- void stru6::_4A7C07(LayingItem *a2) { stru6 *v2; // edi@1 LayingItem *v3; // esi@1 int v4; // eax@1 ObjectDesc *v5; // ebx@1 stru6_stru2 *v6; // eax@2 double v7; // st6@2 double v8; // st5@2 double v9; // st4@2 char v10; // al@2 double v11; // st7@2 double v12; // st7@3 Particle_ local_0; // [sp+Ch] [bp-68h]@1 float a2a; // [sp+7Ch] [bp+8h]@2 v2 = this; memset(&local_0, 0, 0x68u); v3 = a2; v4 = a2->field_54; v5 = &pObjectList->pObjects[a2->uObjectDescID]; if ( v4 ) { v6 = &v2->array_0[v4 & 0x1F]; v7 = ((double)a2->vPosition.x - v6->flt_4) * 0.5 + v6->flt_4; v8 = ((double)a2->vPosition.y - v6->flt_8) * 0.5 + v6->flt_8; v9 = ((double)a2->vPosition.z - v6->flt_C) * 0.5 + v6->flt_C; local_0.bFree = 2048; local_0.uDiffuse = 0xFFFFFFu; a2a = v9; local_0.x = v7; local_0.z = a2a; local_0.y = v8; local_0.flt_10 = 0.0; local_0.flt_14 = 0.0; local_0.flt_18 = 0.0; v10 = rand(); LODWORD(local_0.flt_28) = 0x40400000u; local_0.field_20 = (v10 & 0x3F) + 64; local_0.uTextureID = pSpriteFrameTable->GetFrame(v5->uSpriteID, v3->uSpriteFrameID)->pHwSpriteIDs[0]; pGame->pParticleEngine->AddParticle(&local_0); v11 = (double)v3->vPosition.x; LODWORD(local_0.flt_28) = 0x40800000u; local_0.x = v11; local_0.y = (double)v3->vPosition.y; local_0.z = (double)v3->vPosition.z; local_0.field_20 = (rand() & 0x3F) + 64; pGame->pParticleEngine->AddParticle(&local_0); v2->array_0[v3->field_54 & 0x1F].flt_4 = (double)v3->vPosition.x; v2->array_0[v3->field_54 & 0x1F].flt_8 = (double)v3->vPosition.y; v2->array_0[v3->field_54 & 0x1F].flt_C = (double)v3->vPosition.z; } else { a2->field_54 = v2->array_0[0].uSpellAnimLength++; v2->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x; v2->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y; v2->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z; v12 = (double)a2->vPosition.x; local_0.bFree = 2048; local_0.uDiffuse = 0xFFFFFFu; LODWORD(local_0.flt_28) = 0x40000000u; local_0.x = v12; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; local_0.flt_10 = 0.0; local_0.flt_14 = 0.0; local_0.flt_18 = 0.0; local_0.field_20 = (rand() & 0x3F) + 64; local_0.uTextureID = pSpriteFrameTable->GetFrame(v5->uSpriteID, a2->uSpriteFrameID)->pHwSpriteIDs[0]; pGame->pParticleEngine->AddParticle(&local_0); } } //----- (004A7E05) -------------------------------------------------------- void stru6::AddProjectile(LayingItem *a2, int a3, unsigned int uTextureID) { int v4; // edx@1 float v5; // ST14_4@2 float v6; // ST10_4@2 float v7; // ST0C_4@2 v4 = a2->field_54; if ( v4 ) { v5 = (double)a2->vPosition.z; v6 = (double)a2->vPosition.y; v7 = (double)a2->vPosition.x; DoAddProjectile( this->array_0[v4 & 0x1F].flt_4, this->array_0[v4 & 0x1F].flt_8, this->array_0[v4 & 0x1F].flt_C, v7, v6, v5, uTextureID); } else { a2->field_54 = this->array_0[0].uSpellAnimLength++; this->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x; this->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y; this->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z; } } //----- (004A7E89) -------------------------------------------------------- int stru6::_4A7E89_sparkles_on_actor_after_it_casts_buff(Actor *pActor, unsigned int uDiffuse) { Actor *v3; // edi@1 int v4; // ebx@3 int result; // eax@5 Particle_ Dst; // [sp+Ch] [bp-6Ch]@1 int v7; // [sp+74h] [bp-4h]@2 signed int pActora; // [sp+80h] [bp+8h]@1 memset(&Dst, 0, 0x68u); Dst.bFree = 1036; Dst.field_20 = (rand() & 0x7F) + 128; v3 = pActor; Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar02", TEXTURE_DEFAULT); pActora = 50; Dst.flt_28 = 1.0; do { v7 = (unsigned __int8)rand() + v3->vPosition.x - 127; Dst.x = (double)v7; v7 = (unsigned __int8)rand() + v3->vPosition.y - 127; Dst.y = (double)v7; v7 = v3->vPosition.z + (unsigned __int8)rand(); Dst.z = (double)v7; if ( uDiffuse ) { Dst.uDiffuse = uDiffuse; } else { v4 = rand() << 16; Dst.uDiffuse = rand() | v4; } pGame->pParticleEngine->AddParticle(&Dst); --pActora; } while ( pActora ); return result; } //----- (004A7F74) -------------------------------------------------------- void stru6::_4A7F74(int x, int y, int z) { stru6 *v4; // esi@1 char v5; // al@1 signed int v6; // edi@1 unsigned int v7; // eax@1 double v8; // st7@2 double v9; // st7@2 Particle_ local_0; // [sp+8h] [bp-78h]@1 double v11; // [sp+70h] [bp-10h]@1 double v12; // [sp+78h] [bp-8h]@1 float z1; // [sp+88h] [bp+8h]@2 v4 = this; memset(&local_0, 0, 0x68u); local_0.bFree = 1029; local_0.uDiffuse = 0x7E7E7Eu; v5 = rand(); local_0.flt_28 = 1.0; v6 = 8; local_0.field_20 = (v5 & 0x7F) + 128; v7 = v4->uTextureID_effpar1; v12 = (double)x; local_0.uTextureID = v7; v11 = (double)y; do { v8 = pRnd->GetRandom(); local_0.x = v8 * 40.0 - 20.0 + v12; v9 = pRnd->GetRandom(); z1 = (double)z; local_0.z = z1; local_0.y = v9 * 40.0 - 20.0 + v11; local_0.flt_10 = pRnd->GetRandom() * 400.0 - 200.0; local_0.flt_14 = pRnd->GetRandom() * 400.0 - 200.0; local_0.flt_18 = pRnd->GetRandom() * 150.0 + 50.0; pGame->pParticleEngine->AddParticle(&local_0); --v6; } while ( v6 ); } //----- (004A806F) -------------------------------------------------------- int stru6::_4A806F(Actor *pActor) { int v2; // ecx@1 unsigned int v3; // eax@1 double v4; // st7@2 float v5; // ST00_4@6 v2 = (int)pActor; v3 = LODWORD(pActor->pActorBuffs[10].uExpireTime) - pMiscTimer->uTotalGameTimeElapsed; if ( (signed int)v3 <= 64 ) { if ( (v3 & 0x80000000u) != 0 ) { pActor->pActorBuffs[10].uExpireTime = 0i64; v4 = 1.0; } else { v2 = v3 * v3; v4 = 1.0 - (double)(signed int)(v3 * v3) * 0.0001953125; } } else { v2 = (v3 - 64) * (v3 - 64); v4 = (double)v2 * 0.0001953125 + 0.2; } v5 = v4; return _48B561_mess_with_scaling_along_z(/*v2, */v5); } //----- (004A80DC) -------------------------------------------------------- void stru6::_4A80DC_some_stuff_sw(LayingItem *a2) { stru6 *v2; // esi@1 signed int v3; // ebx@1 Particle_ local_0; // [sp+Ch] [bp-68h]@1 v2 = this; memset(&local_0, 0, 0x68u); local_0.bFree = 1029; local_0.uDiffuse = 0x7E7E7Eu; local_0.field_20 = (rand() & 0x7F) + 128; local_0.uTextureID = v2->uTextureID_effpar1; v3 = 8; local_0.flt_28 = 1.0; do { local_0.x = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.x - 20.0; local_0.y = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.y - 20.0; local_0.z = (double)a2->vPosition.z; local_0.flt_10 = pRnd->GetRandom() * 800.0 - 400.0; local_0.flt_14 = pRnd->GetRandom() * 800.0 - 400.0; local_0.flt_18 = pRnd->GetRandom() * 350.0 + 50.0; pGame->pParticleEngine->AddParticle(&local_0); --v3; } while ( v3 ); } //----- (004A81CA) -------------------------------------------------------- bool stru6::_4A81CA(LayingItem *a2) { stru6 *v2; // ebx@1 int result; // eax@1 int v4; // eax@27 unsigned int diffuse; // esi@41 int v6; // ecx@49 int v7; // eax@54 int v8; // eax@55 char v9; // zf@56 int v10; // eax@59 int v11; // eax@61 int v12; // eax@85 int v13; // eax@86 int v14; // eax@96 int v15; // eax@111 int v16; // eax@118 int v17; // eax@139 int v18; // eax@140 int v19; // eax@141 int v20; // eax@151 unsigned int v21; // [sp-8h] [bp-20h]@66 LayingItem *v22; // [sp-8h] [bp-20h]@81 unsigned int v23; // [sp-4h] [bp-1Ch]@4 unsigned int v24; // [sp-4h] [bp-1Ch]@5 unsigned int v25; // [sp-4h] [bp-1Ch]@30 unsigned int v26; // [sp-4h] [bp-1Ch]@57 unsigned int v27; // [sp-4h] [bp-1Ch]@66 int v28; // [sp-4h] [bp-1Ch]@81 unsigned int v29; // [sp+0h] [bp-18h]@4 unsigned int v30; // [sp+0h] [bp-18h]@5 int v31; // [sp+0h] [bp-18h]@30 unsigned int v32; // [sp+0h] [bp-18h]@45 float v33; // [sp+0h] [bp-18h]@57 float v34; // [sp+0h] [bp-18h]@66 signed int v35; // [sp+0h] [bp-18h]@81 char pContainer[7]; // [sp+10h] [bp-8h]@81 v2 = this; result = a2->uItemType; if ( result <= 545 ) { if ( result != 545 ) { result -= 500; switch ( result ) { case 0: case 30: v29 = this->uTextureID_effpar1; v23 = 0xAAAFFu; goto LABEL_8; case 1: case 31: v30 = this->uTextureID_effpar1; v24 = 0xAAAFFu; goto LABEL_32; case 5: v29 = this->uTextureID_effpar1; v23 = 0x5C310Eu; goto LABEL_8; case 10: v29 = this->uTextureID_effpar1; v23 = 0xFF3C1Eu; goto LABEL_8; case 15: v29 = this->uTextureID_effpar1; v23 = 0x62D0u; goto LABEL_8; case 16: v30 = this->uTextureID_effpar1; v24 = 0x62D0u; goto LABEL_32; case 20: v29 = this->uTextureID_effpar1; v23 = 0xAB450u; goto LABEL_8; case 21: v30 = this->uTextureID_effpar1; v24 = 0xAB450u; goto LABEL_32; case 25: v29 = this->uTextureID_effpar1; v23 = 0xC8C805u; goto LABEL_8; case 26: v30 = this->uTextureID_effpar1; v24 = 0xC8C805u; goto LABEL_32; case 35: v29 = this->uTextureID_effpar1; v23 = 0xFFFFFFu; goto LABEL_8; case 36: v30 = this->uTextureID_effpar1; goto LABEL_154; case 40: goto LABEL_17; case 11: goto LABEL_31; case 6: goto LABEL_115; case 41: goto LABEL_164; default: goto LABEL_168; } goto LABEL_168; } goto LABEL_34; } if ( result <= 4051 ) { if ( result != 4051 ) { if ( result <= 2031 ) { if ( result != 2031 ) { if ( result <= 1051 ) { if ( result == 1051 ) { result = AddMobileLight(a2, 0xFF3C1Eu, 256);// fireball hit if ( pRenderer->pRenderD3D ) { result = a2->field_58 & 7; if ( result != 3 ) { if ( result != 2 ) { result = (bool)&v2->field_204; v6 = v2->field_204; if ( v6 != 4 ) { *(int *)result = v6 + 1; _4A7688_fireball_collision_particle(a2); } goto LABEL_168; } } } goto LABEL_34; } if ( result <= 600 ) { if ( result == 600 ) { result = AddMobileLight(a2, 0xFF3C1Eu, 256); goto LABEL_34; } result -= 550; if ( !result ) { LABEL_34: LOBYTE(result) = 1; return result; } v4 = result - 1; if ( v4 ) { result = v4 - 4; if ( !result ) goto LABEL_34; --result; if ( !result ) { v31 = 256; v25 = 0xFF0000u; LABEL_144: result = AddMobileLight(a2, v25, v31); goto LABEL_168; } goto LABEL_168; } goto LABEL_31; } if ( result < 811 ) goto LABEL_168; if ( result <= 814 ) goto LABEL_34; if ( result == 1010 ) goto LABEL_41; // fire strike if ( result != 1011 ) { if ( result != 1050 ) goto LABEL_168; LABEL_41: diffuse = 0xFF3C1Eu; LABEL_42: _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc( a2, diffuse, this->uTextureID_effpar1); LABEL_43: v31 = 256; LABEL_44: v25 = diffuse; goto LABEL_144; } v32 = this->uTextureID_effpar1; diffuse = 0xFF3C1Eu; LABEL_146: _4A75CC_single_spell_collision_particle(a2, diffuse, v32); goto LABEL_43; } if ( result <= 1081 ) { if ( result == 1081 ) { diffuse = 0xFF3C1Eu; _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning( a2, 0xFF3C1Eu, this->uTextureID_effpar1, 300.0); _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning( a2, 0xFF3C1Eu, v2->uTextureID_effpar1, 250.0); v33 = 200.0; v26 = v2->uTextureID_effpar1; } else { result -= 1060; if ( !result ) goto LABEL_34; v7 = result - 1; if ( v7 ) { v8 = v7 - 9; if ( !v8 ) { LABEL_31: v30 = this->uTextureID_effpar1; v24 = 0xFF3C1Eu; goto LABEL_32; } result = v8 - 10; v9 = result == 0; LABEL_129: if ( v9 ) goto LABEL_34; goto LABEL_168; } diffuse = 0xFF3C1Eu; v33 = 250.0; v26 = this->uTextureID_effpar1; } LABEL_84: _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, diffuse, v26, v33); goto LABEL_43; } v10 = result - 1090; if ( v10 ) { result = v10 - 10; if ( !result ) goto LABEL_34; v11 = result - 1; if ( !v11 ) { diffuse = 0xFF3C1Eu; _4A75CC_single_spell_collision_particle(a2, 0xFF3C1Eu, this->uTextureID_effpar1); v32 = v2->uTextureID_effpar1; goto LABEL_146; } result = v11 - 929; if ( result ) goto LABEL_168; LABEL_63: if ( !pRenderer->pRenderD3D ) goto LABEL_34; _4A78AE_sparks_spell(a2); v31 = 128; v25 = 0x64640Fu; goto LABEL_144; } v34 = 250.0; v27 = this->uTextureID_effpar1; v21 = 0xFF3C1Eu; LABEL_117: _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, v21, v27, v34); goto LABEL_168; } goto LABEL_67; } if ( result <= 3060 ) { if ( result == 3060 ) goto LABEL_171; // acid burst if ( result <= 2101 ) { if ( result == 2101 ) { v33 = 200.0; v26 = this->uTextureID_effpar1; goto LABEL_83; } if ( result != 2060 ) { if ( result != 2061 ) { if ( result <= 2079 ) goto LABEL_168; if ( result <= 2081 ) { if ( pRenderer->pRenderD3D ) _4A77FD_some_stuff_d3d(a2); else _4A80DC_some_stuff_sw(a2); goto LABEL_168; } v9 = result == 2100; goto LABEL_129; } LABEL_67: v33 = 200.0; v26 = this->uTextureID_effpar2; LABEL_83: diffuse = (unsigned int)&pDecalBuilder->std__vector_pDecals[557].pVertices[57].vWorldViewPosition.y; goto LABEL_84; } if ( !pRenderer->pRenderD3D ) goto LABEL_34; *(int *)pContainer = *(int *)"sp18h1"; *(short *)&pContainer[4] = *(short *)"h1"; pContainer[6] = aSp18h1[6]; pRnd->SetRange(1, 6); pContainer[5] = pRnd->GetInRange() + '0'; v35 = pBitmaps_LOD->LoadTexture(pContainer, TEXTURE_DEFAULT); v28 = 100; v22 = a2; LABEL_157: AddProjectile(v22, v28, v35); goto LABEL_168; } v12 = result - 3010; if ( !v12 ) { LABEL_171: diffuse = 0xAB450u; goto LABEL_42; } v13 = v12 - 1; if ( !v13 ) { v32 = this->uTextureID_effpar1; diffuse = 0xAB450u; goto LABEL_146; } result = v13 - 19; if ( !result ) goto LABEL_34; --result; if ( result ) goto LABEL_168; LABEL_89: v32 = this->uTextureID_effpar1; diffuse = 0x9EB9F1u; goto LABEL_146; } if ( result > 4000 ) { result -= 4030; if ( !result || (--result, !result) ) goto LABEL_34; result -= 19; v9 = result == 0; goto LABEL_129; } if ( result == 4000 ) { if ( !pRenderer->pRenderD3D ) goto LABEL_34; _4A7C07(a2); goto LABEL_168; } result -= 3061; if ( !result || (result -= 29) == 0 ) goto LABEL_34; v14 = result - 1; if ( !v14 ) goto LABEL_89; result = v14 - 1; if ( result ) goto LABEL_168; v29 = this->uTextureID_effpar1; v23 = 0x9EB9F1u; LABEL_8: _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, v23, v29); goto LABEL_168; } goto LABEL_122; } if ( result <= 7090 ) { if ( result == 7090 ) goto LABEL_34; if ( result > 6030 ) { if ( result > 6091 ) { result -= 6100; if ( !result ) goto LABEL_34; result -= 930; if ( result ) { --result; if ( result ) goto LABEL_168; v30 = this->uTextureID_effpar1; v24 = 0xF00000u; goto LABEL_32; } goto LABEL_63; } if ( result != 6091 ) { result -= 6040; if ( !result || (result -= 20) == 0 || (result -= 10) == 0 ) goto LABEL_34; result -= 20; v9 = result == 0; goto LABEL_129; } } else { if ( result == 6030 ) goto LABEL_34; if ( result <= 4091 ) { if ( result != 4091 ) { result -= 4070; if ( !result ) goto LABEL_34; v15 = result - 1; if ( v15 ) { result = v15 - 9; if ( !result ) goto LABEL_34; result -= 10; if ( !result ) { _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc( a2, 0x7E7E7Eu, this->uTextureID_effpar1); goto LABEL_34; } goto LABEL_168; } LABEL_115: v30 = this->uTextureID_effpar1; v24 = 0x5C310Eu; LABEL_32: _4A75CC_single_spell_collision_particle(a2, v24, v30); goto LABEL_168; } v34 = 200.0; v27 = this->uTextureID_effpar1; v21 = 0x7E7E7Eu; goto LABEL_117; } v16 = result - 4092; if ( !v16 ) { LABEL_17: v29 = this->uTextureID_effpar1; v23 = 0x7E7E7Eu; goto LABEL_8; } result = v16 - 8; if ( !result ) goto LABEL_168; result -= 1910; if ( !result ) goto LABEL_34; --result; if ( result ) goto LABEL_168; } LABEL_122: _4A7948_mind_blast_after_effect(a2); goto LABEL_168; } if ( result <= 9000 ) { if ( result == 9000 ) goto LABEL_34; if ( result <= 8030 ) { if ( result == 8030 ) goto LABEL_34; v17 = result - 7091; if ( v17 ) { v18 = v17 - 909; if ( !v18 ) { diffuse = 0xFFFFFFu; _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc( a2, 0xFFFFFFu, this->uTextureID_effpar3); v31 = 128; goto LABEL_44; } v19 = v18 - 1; if ( v19 ) { result = v19 - 9; if ( !result ) { v31 = 64; v25 = 0xFFFFFFu; goto LABEL_144; } goto LABEL_168; } v32 = this->uTextureID_effpar2; diffuse = 0xFFFFFFu; } else { v32 = this->uTextureID_effpar1; diffuse = 0xF00000u; } goto LABEL_146; } result -= 8040; if ( !result || (result -= 20) == 0 ) goto LABEL_34; v20 = result - 30; if ( v20 ) { result = v20 - 1; if ( result ) goto LABEL_168; v30 = this->uTextureID_effpar3; LABEL_154: v24 = 16777215; goto LABEL_32; } result = AddMobileLight(a2, 0xFFFFFFu, 128); if ( !pRenderer->pRenderD3D ) goto LABEL_34; v35 = -1; v28 = 100; v22 = a2; goto LABEL_157; } if ( result > 9050 ) { result -= 9070; if ( !result || (result -= 10) == 0 || (--result, !result) ) goto LABEL_34; goto LABEL_168; } if ( result == 9050 || (result -= 9010) == 0 || (result -= 20) == 0 || (result -= 10) == 0 ) goto LABEL_34; --result; if ( !result ) { LABEL_164: v30 = this->uTextureID_effpar1; v24 = 0x7E7E7Eu; goto LABEL_32; } LABEL_168: LOBYTE(result) = 0; return result; } //----- (004A89BD) -------------------------------------------------------- int stru6::SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID) { stru6 *v3; // edi@1 PlayerBuffAnim *v4; // esi@1 int result; // eax@1 const char *v6; // [sp-4h] [bp-10h]@2 v3 = this; v4 = (PlayerBuffAnim *)((char *)this + 16 * (signed __int16)uPlayerID); v4[32].uSpellIconID_ = 0; v4[32].uSpellID = uSpellID; result = (signed __int16)uSpellID - 3; switch ( uSpellID ) { case (SPELL_WATER_PROTECTION_FROM_WATER|0x80): v6 = "zapp"; goto LABEL_24; case SPELL_AIR_FEATHER_FALL: case SPELL_SPIRIT_DETECT_LIFE: case SPELL_SPIRIT_DOOM: case 0x96u: v6 = "spboost1"; goto LABEL_24; case SPELL_AIR_SHIELD|0x2: case SPELL_WATER_WATER_WALK: case SPELL_SPIRIT_PRESERVE: case 0x97u: v6 = "spboost2"; goto LABEL_24; case SPELL_BODY_CURE_WEAKNESS|0x10: case SPELL_BODY_FIRST_AID|SPELL_AIR_SHIELD: case 0x56u: case SPELL_BODY_CURE_POISON|0x10: case 0x98u: v6 = "spboost3"; goto LABEL_24; case (SPELL_AIR_SHIELD|0x20): case SPELL_MIND_REMOVE_FEAR: case SPELL_BODY_CURE_WEAKNESS: v6 = "spheal1"; goto LABEL_24; case SPELL_SPIRIT_PRESERVE|0x4: case SPELL_MIND_CURE_PARALYSIS: case 0x40u: case SPELL_BODY_FIRST_AID: case SPELL_BODY_CURE_POISON: case SPELL_BODY_CURE_DISEASE: case 0x60u: v6 = "spheal2"; goto LABEL_24; case SPELL_BODY_HAMMERHANDS|0x4: case SPELL_BODY_CURE_WEAKNESS|0x20: v6 = "spheal3"; goto LABEL_24; case SPELL_FIRE_PROTECTION_FROM_FIRE: case SPELL_FIRE_FIRE_RING: v6 = "spell03"; goto LABEL_24; case SPELL_FIRE_HASTE: v6 = "spell05"; goto LABEL_24; case SPELL_AIR_PROTECTION_FROM_AIR: v6 = "spell14"; goto LABEL_24; case SPELL_AIR_SHIELD: v6 = "spell17"; goto LABEL_24; case SPELL_WATER_PROTECTION_FROM_WATER: v6 = "spell25"; goto LABEL_24; case SPELL_EARTH_PROTECTION_FROM_EARTH: v6 = "spell36"; goto LABEL_24; case SPELL_EARTH_STONESKIN: v6 = "spell38"; goto LABEL_24; case SPELL_SPIRIT_BLESS: v6 = "spell46"; goto LABEL_24; case SPELL_SPIRIT_HEROISM: v6 = "spell51"; goto LABEL_24; case SPELL_SPIRIT_HEROISM|0x4: v6 = "spell55"; goto LABEL_24; case SPELL_MIND_PROTECTION_FROM_MIND: v6 = "spell58"; goto LABEL_24; case SPELL_BODY_FIRST_AID|0x1: v6 = "spell69"; goto LABEL_24; case SPELL_BODY_FIRST_AID|SPELL_FIRE_PROTECTION_FROM_FIRE: v6 = "spell71"; goto LABEL_24; case SPELL_BODY_HAMMERHANDS: v6 = "spell73"; goto LABEL_24; case SPELL_BODY_PROTECTION_FROM_MAGIC: v6 = "spell75"; LABEL_24: result = pIconsFrameTable->FindIcon(v6); v4[33].uSpellIconID = result; break; default: v4[32].uSpellID = 0; break; } if ( v4[32].uSpellID ) { result = 8 * pIconsFrameTable->pIcons[v4[33].uSpellIconID].uAnimLength; v3->array_0[(signed __int16)uPlayerID + 33].uSpellAnimLength = result; } return result; } //----- (004A8BDF) -------------------------------------------------------- void stru6::FadeScreen__like_Turn_Undead_and_mb_Armageddon(unsigned int uDiffuseColor, unsigned int uFadeTime) { this->uFadeTime = uFadeTime; this->uFadeTime2 = uFadeTime; this->uFadeColor = uDiffuseColor; } //----- (004A8BFC) -------------------------------------------------------- int stru6::_4A8BFC() { stru6 *v1; // esi@1 int result; // eax@1 v1 = this; result = 8 * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength; v1->uAnimLength = result; return result; } //----- (004A8C27) -------------------------------------------------------- HRESULT stru6::RenderSpecialEffects() { stru6 *v1; // ebx@1 int *v2; // edi@1 HRESULT result; // eax@3 double v4; // st7@4 double v5; // st6@4 double v6; // st7@4 float v7; // ST14_4@6 unsigned int v8; // ST14_4@8 unsigned int v9; // eax@8 SpriteFrame *v10; // eax@8 int v11; // edi@8 double v12; // st7@9 double v13; // st7@9 double v14; // st7@9 double v15; // st6@9 HRESULT v16; // eax@9 HRESULT v17; // eax@9 signed __int64 v18; // qtt@10 const char *v19; // [sp+4h] [bp-E8h]@0 int v20; // [sp+8h] [bp-E4h]@0 unsigned int v21; // [sp+Ch] [bp-E0h]@0 RenderBillboardTransform_local0 vsr; // [sp+10h] [bp-DCh]@10 RenderVertexD3D3 vd3d[4]; // [sp+60h] [bp-8Ch]@9 int v24; // [sp+E0h] [bp-Ch]@10 SpriteFrame *v70; // [sp+E4h] [bp-8h]@8 unsigned int v26; // [sp+E8h] [bp-4h]@3 //by the time we first get in this function, dword_0005D4 is still not initialized in the original exe //maybe the following code in never executed at all v1 = this; v2 = &this->uNumProjectiles; if ( this->uNumProjectiles ) { DrawProjectiles(); *v2 = 0; } result = v1->uFadeTime; v1->field_204 = 0; v26 = result; if ( result > 0 ) { v4 = (double)(signed int)v26 / (double)v1->uFadeTime2; v5 = 1.0 - v4 * v4; v6 = v5; if ( v5 > 0.9 ) v6 = 1.0 - (v5 - 0.9) * 10.0; v7 = v6; pRenderer->_4A52F1(v1->uFadeColor, v7); result = pEventTimer->uTimeElapsed; v1->uFadeTime -= pEventTimer->uTimeElapsed; } if ( v1->uAnimLength > 0 ) { v8 = 8 * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength - v1->uAnimLength; v9 = pSpriteFrameTable->FastFindSprite("spell84"); v10 = pSpriteFrameTable->GetFrame(v9, v8); v11 = v10->pHwSpriteIDs[0]; v70 = v10; v1->uAnimLength -= pEventTimer->uTimeElapsed; if ( pRenderer->pRenderD3D ) { v12 = (double)(signed int)pViewport->uViewportX; vd3d[0].pos.x = v12; vd3d[1].pos.x = v12; v13 = (double)(signed int)pViewport->uViewportZ; v26 = pViewport->uViewportW + 1; vd3d[0].diffuse = 0x7F7F7Fu; vd3d[1].diffuse = 0x7F7F7Fu; vd3d[2].pos.x = v13; vd3d[3].pos.x = v13; v14 = (double)(signed int)pViewport->uViewportY; vd3d[2].diffuse = 0x7F7F7Fu; vd3d[3].diffuse = 0x7F7F7Fu; vd3d[0].specular = 0; vd3d[1].specular = 0; vd3d[0].pos.y = v14; v15 = (double)(pViewport->uViewportW + 1); vd3d[2].specular = 0; vd3d[3].specular = 0; vd3d[1].pos.y = v15; vd3d[2].pos.y = v15; vd3d[3].pos.y = v14; vd3d[0].pos.z = 0.0; vd3d[1].pos.z = 0.0; vd3d[2].pos.z = 0.0; vd3d[3].pos.z = 0.0; vd3d[0].rhw = 1.0; vd3d[1].rhw = 1.0; vd3d[2].rhw = 1.0; vd3d[3].rhw = 1.0; vd3d[0].texcoord.x = 0.0; vd3d[1].texcoord.x = 0.0; vd3d[2].texcoord.x = 1.0; vd3d[3].texcoord.x = 1.0; vd3d[0].texcoord.y = 0.0; vd3d[1].texcoord.y = 1.0; vd3d[2].texcoord.y = 1.0; vd3d[3].texcoord.y = 0.0; pRenderer->pRenderD3D->pDevice->SetTexture( 0, pSprites_LOD->pHardwareSprites[v11].pTexture); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 8u); pRenderer->pRenderD3D->pDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 452, vd3d, 4, 28); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\seffects.cpp:1348"); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\seffects.cpp:1349"); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, true); result = pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2); } else { vsr.pTarget = pRenderer->pTargetSurface; vsr.uParentBillboardID = -1; vsr.pTargetZ = pRenderer->pActiveZBuffer; vsr.field_8 = (signed int)(pViewport->uViewportZ - pViewport->uViewportX) / 2; vsr.field_C = pViewport->uViewportW; v24 = 16777216; LODWORD(v18) = 0; HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportZ) - LOWORD(pViewport->uViewportX)); vsr.field_10 = v18 / 16777216; LODWORD(v18) = 0; HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportW) - LOWORD(pViewport->uViewportY)); v26 = v18 / 16777216; vsr.field_14 = v18 / 16777216; vsr.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v70->uPaletteIndex, 0, 1); vsr.uTargetPitch = pRenderer->uTargetSurfacePitch; vsr.uParentBillboardID = -1; vsr.uViewportX = pViewport->uViewportX; vsr.uViewportZ = pViewport->uViewportZ; vsr.uViewportY = pViewport->uViewportY; result = pViewport->uViewportW; vsr.field_28 = 0; vsr.uViewportW = pViewport->uViewportW; vsr.uFlags = 0; if ( v11 >= 0 ) result = pSprites_LOD->pSpriteHeaders[v11]._4ACC38(&vsr, 1); } } return result; } //----- (004A902A) -------------------------------------------------------- void stru6::DrawPlayerBuffAnims() { __int16 *v1; // edi@1 char *v2; // esi@1 unsigned int v3; // eax@3 unsigned __int8 v4; // zf@3 char v5; // sf@3 unsigned __int8 v6; // of@3 IconFrame *v7; // eax@4 uint _it = 0; v1 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing; v2 = (char *)&this->pPlayerBuffs[0].uSpellIconID; do { if ( *((short *)v2 - 2) ) { v3 = pEventTimer->uTimeElapsed + *(int *)v2; v6 = __OFSUB__(v3, *((int *)v2 + 1)); v4 = v3 == *((int *)v2 + 1); v5 = ((v3 - *((int *)v2 + 1)) & 0x80000000u) != 0; *(int *)v2 = v3; if ( (unsigned __int8)(v5 ^ v6) | v4 ) { v7 = pIconsFrameTable->GetFrame(*((int *)v2 + 2), v3); pRenderer->DrawTextureTransparent(*v1, 0x181u, &pIcons_LOD->pTextures[v7->uTextureID]); pOtherOverlayList->field_3EC = 1; } else { *((short *)v2 - 2) = 0; } } v2 += 16; ++v1; } //while ( (signed int)v1 < (signed int)pBaseHealthByClass ); while (++_it != 4); } //----- (004A90A0) -------------------------------------------------------- void stru6::LoadAnimations() { stru6 *v1; // esi@1 unsigned int v2; // eax@1 unsigned int v3; // eax@1 unsigned int v4; // eax@1 unsigned int v5; // eax@1 unsigned int v6; // eax@1 unsigned int v7; // eax@1 unsigned int v8; // eax@1 unsigned int v9; // eax@1 unsigned int v10; // eax@1 unsigned int v11; // eax@1 unsigned int v12; // eax@1 unsigned int v13; // eax@1 unsigned int v14; // eax@1 unsigned int v15; // eax@1 unsigned int v16; // eax@1 unsigned int v17; // eax@1 unsigned int v18; // eax@1 unsigned int v19; // eax@1 unsigned int v20; // eax@1 unsigned int v21; // eax@1 unsigned int v22; // eax@1 unsigned int v23; // eax@1 unsigned int v24; // eax@1 unsigned int v25; // eax@1 unsigned int v26; // eax@1 unsigned int v27; // eax@1 unsigned int v28; // eax@1 unsigned int v29; // eax@1 unsigned int v30; // eax@1 unsigned int v31; // eax@1 unsigned int v32; // eax@1 unsigned int v33; // eax@1 unsigned int v34; // eax@1 unsigned int v35; // eax@1 unsigned int v36; // eax@1 unsigned int v37; // eax@1 unsigned int v38; // eax@1 unsigned int v39; // eax@1 unsigned int v40; // eax@1 unsigned int v41; // eax@1 unsigned int v42; // eax@1 unsigned int v43; // eax@1 unsigned int v44; // eax@1 unsigned int v45; // eax@1 unsigned int v46; // eax@1 unsigned int v47; // eax@1 unsigned int v48; // eax@1 unsigned int v49; // eax@1 unsigned int v50; // eax@1 unsigned int v51; // eax@1 v1 = this; uTextureID_effpar1 = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); uTextureID_effpar2 = pBitmaps_LOD->LoadTexture("effpar02", TEXTURE_DEFAULT); uTextureID_effpar3 = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT); uSpriteID_sp57c = pSprites_LOD->LoadSprite("sp57c", 6); v2 = pIconsFrameTable->FindIcon("zapp"); pIconsFrameTable->InitializeAnimation(v2); v3 = pIconsFrameTable->FindIcon("spheal1"); pIconsFrameTable->InitializeAnimation(v3); v4 = pIconsFrameTable->FindIcon("spheal2"); pIconsFrameTable->InitializeAnimation(v4); v5 = pIconsFrameTable->FindIcon("spheal3"); pIconsFrameTable->InitializeAnimation(v5); v6 = pIconsFrameTable->FindIcon("spboost1"); pIconsFrameTable->InitializeAnimation(v6); v7 = pIconsFrameTable->FindIcon("spboost2"); pIconsFrameTable->InitializeAnimation(v7); v8 = pIconsFrameTable->FindIcon("spboost3"); pIconsFrameTable->InitializeAnimation(v8); v9 = pIconsFrameTable->FindIcon("spell03"); pIconsFrameTable->InitializeAnimation(v9); v10 = pIconsFrameTable->FindIcon("spell05"); pIconsFrameTable->InitializeAnimation(v10); v11 = pIconsFrameTable->FindIcon("spell14"); pIconsFrameTable->InitializeAnimation(v11); v12 = pIconsFrameTable->FindIcon("spell17"); pIconsFrameTable->InitializeAnimation(v12); v13 = pIconsFrameTable->FindIcon("spell21"); pIconsFrameTable->InitializeAnimation(v13); v14 = pIconsFrameTable->FindIcon("spell25"); pIconsFrameTable->InitializeAnimation(v14); v15 = pIconsFrameTable->FindIcon("spell27"); pIconsFrameTable->InitializeAnimation(v15); v16 = pIconsFrameTable->FindIcon("spell36"); pIconsFrameTable->InitializeAnimation(v16); v17 = pIconsFrameTable->FindIcon("spell38"); pIconsFrameTable->InitializeAnimation(v17); v18 = pIconsFrameTable->FindIcon("spell46"); pIconsFrameTable->InitializeAnimation(v18); v19 = pIconsFrameTable->FindIcon("spell51"); pIconsFrameTable->InitializeAnimation(v19); v20 = pIconsFrameTable->FindIcon("spell55"); pIconsFrameTable->InitializeAnimation(v20); v21 = pIconsFrameTable->FindIcon("spell58"); pIconsFrameTable->InitializeAnimation(v21); v22 = pIconsFrameTable->FindIcon("spell69"); pIconsFrameTable->InitializeAnimation(v22); v23 = pIconsFrameTable->FindIcon("spell71"); pIconsFrameTable->InitializeAnimation(v23); v24 = pIconsFrameTable->FindIcon("spell73"); pIconsFrameTable->InitializeAnimation(v24); v25 = pIconsFrameTable->FindIcon("spell75"); pIconsFrameTable->InitializeAnimation(v25); v26 = pIconsFrameTable->FindIcon("spell96"); pIconsFrameTable->InitializeAnimation(v26); v27 = pSpriteFrameTable->FastFindSprite("spell01"); pSpriteFrameTable->InitializeSprite(v27); v28 = pSpriteFrameTable->FastFindSprite("spell02"); pSpriteFrameTable->InitializeSprite(v28); v29 = pSpriteFrameTable->FastFindSprite("spell03"); pSpriteFrameTable->InitializeSprite(v29); v30 = pSpriteFrameTable->FastFindSprite("spell09"); pSpriteFrameTable->InitializeSprite(v30); v31 = pSpriteFrameTable->FastFindSprite("spell11"); pSpriteFrameTable->InitializeSprite(v31); v32 = pSpriteFrameTable->FastFindSprite("spell18"); pSpriteFrameTable->InitializeSprite(v32); v33 = pSpriteFrameTable->FastFindSprite("spell22"); pSpriteFrameTable->InitializeSprite(v33); v34 = pSpriteFrameTable->FastFindSprite("spell26"); pSpriteFrameTable->InitializeSprite(v34); v35 = pSpriteFrameTable->FastFindSprite("spell29"); pSpriteFrameTable->InitializeSprite(v35); v36 = pSpriteFrameTable->FastFindSprite("spell39"); pSpriteFrameTable->InitializeSprite(v36); v37 = pSpriteFrameTable->FastFindSprite("spell39c"); pSpriteFrameTable->InitializeSprite(v37); v38 = pSpriteFrameTable->FastFindSprite("spell41"); pSpriteFrameTable->InitializeSprite(v38); v39 = pSpriteFrameTable->FastFindSprite("spell57c"); pSpriteFrameTable->InitializeSprite(v39); v40 = pSpriteFrameTable->FastFindSprite("spell62"); pSpriteFrameTable->InitializeSprite(v40); v41 = pSpriteFrameTable->FastFindSprite("spell65"); pSpriteFrameTable->InitializeSprite(v41); v42 = pSpriteFrameTable->FastFindSprite("spell66"); pSpriteFrameTable->InitializeSprite(v42); v43 = pSpriteFrameTable->FastFindSprite("spell70"); pSpriteFrameTable->InitializeSprite(v43); v44 = pSpriteFrameTable->FastFindSprite("spell76"); pSpriteFrameTable->InitializeSprite(v44); v45 = pSpriteFrameTable->FastFindSprite("spell84"); pSpriteFrameTable->InitializeSprite(v45); v46 = pSpriteFrameTable->FastFindSprite("spell90"); pSpriteFrameTable->InitializeSprite(v46); v47 = pSpriteFrameTable->FastFindSprite("spell92"); pSpriteFrameTable->InitializeSprite(v47); v48 = pSpriteFrameTable->FastFindSprite("spell93"); pSpriteFrameTable->InitializeSprite(v48); v49 = pSpriteFrameTable->FastFindSprite("spell97"); pSpriteFrameTable->InitializeSprite(v49); v50 = pSpriteFrameTable->FastFindSprite("spell97c"); pSpriteFrameTable->InitializeSprite(v50); v51 = pSpriteFrameTable->FastFindSprite("spell97c"); pSpriteFrameTable->InitializeSprite(v51); }