Mercurial > mm7
changeset 1399:91ff22cc755b
Слияние
author | Ritor1 |
---|---|
date | Thu, 18 Jul 2013 09:40:14 +0600 |
parents | 8557d021a31b (current diff) 613c77e51e38 (diff) |
children | 9b091098c88c |
files | mm7_3.cpp |
diffstat | 26 files changed, 1236 insertions(+), 1623 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/Actor.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -5051,7 +5051,7 @@ v59 = 1; if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) { - auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + auto main_hand_skill = pItemsTable->pItems[player->pInventoryItemList[main_hand_idx - 1].uItemID].uSkillType; //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; //v28 = SkillToMastery(player->pActiveSkills[v55]); auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); @@ -5260,7 +5260,7 @@ { if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) { - auto _s = (ItemGen *)&player->pInventoryItems[v57->uShield - 1]; + auto _s = (ItemGen *)&player->pInventoryItemList[v57->uShield - 1]; a4 = _s->_439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) {
--- a/CastSpellInfo.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/CastSpellInfo.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -467,7 +467,7 @@ pSpellSprite.uFacing = LOWORD(v715.uYawAngle); pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; - memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24)); + memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24)); pSpellSprite.uAttributes = 256; if ( pParty->bTurnBasedModeOn == 1 ) pSpellSprite.uAttributes = 260; @@ -501,7 +501,7 @@ pSpellSprite.uFacing = LOWORD(v715.uYawAngle); pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; - memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); + memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], ); v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); @@ -991,7 +991,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; + v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; auto _itm = &pItemsTable->pItems[v730c->uItemID]; v730c->UpdateTempBonus(pParty->uTimePlayed); if ( v730c->uItemID < 64 || v730c->uItemID > 65 @@ -1879,7 +1879,7 @@ { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; + v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 ) { @@ -1938,7 +1938,7 @@ amount = 10 * v2; v730 = 1; pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - v245 = &pPlayer->pInventoryItems[a2]; + v245 = &pPlayer->pInventoryItemList[a2]; ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; if ( v731 == 1 || v731 == 2 && _v725->uEquipType > 2 || @@ -3639,7 +3639,7 @@ break; __debugbreak(); //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; - ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; + ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID]; _v733->UpdateTempBonus(pParty->uTimePlayed); if ( _v733->uItemID >= 64 && _v733->uItemID <= 65
--- a/Events.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/Events.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -956,10 +956,10 @@ v4 = v124; break; } - v67 = (int)pPlayers[uActiveCharacter]->pInventoryIndices; + v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; for ( v65 = 0; v65 < 126; ++v65 ) { - if ( (int)&pPlayers[uActiveCharacter]->pInventoryItems[v67] == pValue ) + if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue ) { pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); ++curr_seq_num; @@ -972,7 +972,7 @@ v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; for ( v68 = 0; v68 < 16; ++v68 ) { - if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue ) + if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v69] == pValue ) { *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0; ++curr_seq_num; @@ -983,10 +983,10 @@ } for (int i = 1; i < 5; i++) { - v72 = (int)pPlayers[i]->pInventoryIndices; + v72 = (int)pPlayers[i]->pInventoryMatrix; for ( int v71 = 0; v71 < 126; ++v71 ) { - if ( (int)&pPlayers[i]->pInventoryItems[v72] == pValue ) + if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue ) { pPlayers[i]->RemoveItemAtInventoryIndex(v71); break; @@ -995,7 +995,7 @@ } v73 = 0; v74 = (int)&pPlayers[i]->pEquipment; - while ( !*(int *)v74 || (int)&pPlayer->pInventoryItems[v74] != pValue ) + while ( !*(int *)v74 || (int)&pPlayer->pInventoryItemList[v74] != pValue ) { ++v73; v74 += 4;
--- a/Indoor.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/Indoor.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -589,7 +589,7 @@ } if (pFace->uAttributes & FACE_DO_NOT_LIGHT) - _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); + pRenderer->DrawIndoorPolygonNoLight(uNumVerticesa, uFaceID); else pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); return; @@ -5612,9 +5612,9 @@ local_0.x = v5; local_0.y = (double)v2->vPosition.y; local_0.z = (double)v2->vPosition.z; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.flt_28 = 1.0; local_0.timeToLive = (rand() & 0x80) + 128; local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); @@ -7066,7 +7066,7 @@ break; } if ( min_y >= max_y ) - return false;// incorect working portal faceID 1105( 1105 ) + return false; //************************************************************************************************************************************* v59 = min_y; for ( v46 = max_y - min_y + 1; v46; --v46 )
--- a/Items.h Thu Jul 18 09:40:05 2013 +0600 +++ b/Items.h Thu Jul 18 09:40:14 2013 +0600 @@ -112,6 +112,8 @@ ITEM_LICH_JAR_FULL = 601, ITEM_WETSUIT = 604, ITEM_LICH_JAR_EMPTY = 615, + ITEM_RECIPE_REJUVENATION = 740, + ITEM_RECIPE_BODY_RESISTANCE = 771, }; /* 331 */
--- a/LightmapBuilder.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/LightmapBuilder.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -1,3 +1,5 @@ +#include <assert.h> + #include "LightmapBuilder.h" #include "Game.h" #include "stru314.h" @@ -1584,7 +1586,7 @@ //----- (0045D74F) -------------------------------------------------------- char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3) { - char v3; // zf@1 + //char v3; // zf@1 IDirect3DDevice3 *v4; // eax@2 HRESULT v5; // eax@2 //char *v6; // eax@2 @@ -1595,15 +1597,15 @@ HRESULT v11; // eax@8 HRESULT v12; // eax@8 int *v13; // eax@8 - float v14; // ecx@15 - IDirect3DDevice3 *v15; // eax@21 - HRESULT v16; // eax@21 - IDirect3DDevice3 *v17; // eax@21 - HRESULT v18; // eax@21 - IDirect3DDevice3 *v19; // eax@21 - HRESULT v20; // eax@21 - IDirect3DDevice3 *v21; // eax@21 - HRESULT v22; // eax@21 + //float v14; // ecx@15 + //IDirect3DDevice3 *v15; // eax@21 + //HRESULT v16; // eax@21 + //IDirect3DDevice3 *v17; // eax@21 + //HRESULT v18; // eax@21 + //IDirect3DDevice3 *v19; // eax@21 + //HRESULT v20; // eax@21 + //IDirect3DDevice3 *v21; // eax@21 + //HRESULT v22; // eax@21 //IDirect3DDevice3 *v23; // eax@23 std::string v25; // [sp+44h] [bp-44h]@12 signed int v26; // [sp+48h] [bp-40h]@21 @@ -1617,16 +1619,16 @@ int v34; // [sp+74h] [bp-14h]@19 int v35; // [sp+78h] [bp-10h]@2 int *v36; // [sp+7Ch] [bp-Ch]@10 - int a1; // [sp+80h] [bp-8h]@12 - float v38; // [sp+84h] [bp-4h]@1 + //int a1; // [sp+80h] [bp-8h]@12 + //float v38; // [sp+84h] [bp-4h]@1 - v3 = this->std__vector_000004_size == 0; - LODWORD(v38) = (int)this; - if ( !v3 ) - { + if (std__vector_000004_size == 0) + return 1; + + __debugbreak(); //v30 = 0.0; //v4 = pRenderer->pRenderD3D->pDevice; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3)); //v6 = (char *)stru_69BD44.c_str(); //if ( !stru_69BD44.c_str() ) // v6 = (char *)&dword_4D86F0; @@ -1651,12 +1653,9 @@ v36 = a3; do { - v28 = (Lightmap *)(3100 * *v13 + LODWORD(v38) + 4); + v28 = &std__vector_000004[*v13]; if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) ) - { - MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1230", 0); - a1 = 5080812; - } + assert(false && "Invalid lightmap detected!"); v13 = v36 + 1; v36 = v13; } @@ -1665,31 +1664,27 @@ } else { - v14 = v38; v36 = 0; - if ( *(unsigned int *)(LODWORD(v38) + 1587204) > 0 ) + if (std__vector_000004_size > 0 ) { - a1 = LODWORD(v38) + 4; while ( 1 ) { - if ( !DrawLightmap((Lightmap *)a1, (Vec3_float_ *)&arg4, 0.0) ) + auto _a1 = &std__vector_000004[(int)v36]; + if ( !DrawLightmap(_a1, (Vec3_float_ *)&arg4, 0.0) ) { MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0); v35 = 5080812; } v36 = (int *)((char *)v36 + 1); - a1 += 3100; - if ( (signed int)v36 >= *(unsigned int *)(LODWORD(v38) + 1587204) ) + if ( (signed int)v36 >= std__vector_000004_size) break; - v14 = v38; } } } - v15 = pRenderer->pRenderD3D->pDevice; - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); } if ( pRenderer->bUsingSpecular ) { @@ -1705,7 +1700,7 @@ //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice; ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); } - } + return 1; }
--- a/ParticleEngine.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/ParticleEngine.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -65,9 +65,9 @@ v4->_x = a2->x; v4->_y = a2->y; v4->_z = a2->z; - v4->flt_10 = a2->flt_10; - v4->flt_14 = a2->flt_14; - v4->flt_18 = a2->flt_18; + v4->flt_10 = a2->r; + v4->flt_14 = a2->g; + v4->flt_18 = a2->b; v5 = a2->uDiffuse; v4->uParticleColor = v5; v4->uLightColor_bgr = v5;
--- a/ParticleEngine.h Thu Jul 18 09:40:05 2013 +0600 +++ b/ParticleEngine.h Thu Jul 18 09:40:14 2013 +0600 @@ -23,9 +23,9 @@ float x; float y; float z; - float flt_10; - float flt_14; - float flt_18; + float r; + float g; + float b; unsigned int uDiffuse; int timeToLive; unsigned int uTextureID;
--- a/Party.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/Party.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -252,7 +252,7 @@ while ( v2 <= &pParty->pPlayers[3] ) { v3 = 0; - v4 = v2->pInventoryItems; + v4 = v2->pInventoryItemList; do { if ( v4->uItemID == uItemID ) @@ -562,7 +562,7 @@ //v10 = uSkillIdx - 35 < 0; } //while (uSkillIdx < 36); - pItems = pCharacter->pInventoryItems; + pItems = pCharacter->pInventoryItemList; //v13 = 138; for (int i = 0; i < 138; i++) { @@ -1098,7 +1098,7 @@ if ( pPlayer->classType == PLAYER_CLASS_LICH ) { have_vessels_soul = false; - v7 = pPlayer->pInventoryItems;//[0].field_1A; + v7 = pPlayer->pInventoryItemList;//[0].field_1A; for ( uint i = 138; i; --i ) { if ( v7->uItemID == 601 && (unsigned __int8)v7->uHolderPlayer == pPlayerID + 1 ) @@ -1448,7 +1448,7 @@ if ( uActiveCharacter && (v2 = pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) { - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v2-1], &pParty->pPickedItem, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); } else @@ -1460,7 +1460,7 @@ v4 = v3->AddItem(-1, pParty->pPickedItem.uItemID); if ( v4 ) { - memcpy(&pParty->pPlayers[v12].pInventoryItems[v4 - 1], &pParty->pPickedItem, 0x24u); + memcpy(&pParty->pPlayers[v12].pInventoryItemList[v4 - 1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); break; }
--- a/Player.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/Player.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -476,11 +476,11 @@ return 0; } - inv_index = this->pInventoryIndices[item_idx]; + inv_index = this->pInventoryMatrix[item_idx]; if ( inv_index < 0 ) { *pitem_index = -1 - inv_index; - inv_index = this->pInventoryIndices[-1 - inv_index]; + inv_index = this->pInventoryMatrix[-1 - inv_index]; } return inv_index; @@ -510,15 +510,15 @@ { for ( i = 0; i < enchant_count; ++i ) { - if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) - pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; + if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) + pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; } } else { for ( i = 0; i < avalible_items; ++i ) { - pInventoryItems[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; + pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; } } } @@ -849,7 +849,7 @@ int innerLoopPos = startOfInnerLoop; for (unsigned int x = 0; x < slotWidth; x++) { - if (pInventoryIndices[innerLoopPos] != 0) + if (pInventoryMatrix[innerLoopPos] != 0) { return false; } @@ -864,11 +864,11 @@ // 506128: using guessed type int areWeLoadingTexture; //----- (004925E6) -------------------------------------------------------- -int Player::FindFreeInventorySlot() +int Player::FindFreeInventoryListSlot() { for (int i = 0; i < 126; i++ ) { - if (pInventoryItems[i].uItemID == 0) + if (pInventoryItemList[i].uItemID == 0) { return i; } @@ -880,13 +880,9 @@ int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) { int result; // eax@8 - Texture *texturePtr; // esi@10 - int *v9; // esi@13 - unsigned int widthInSlots; // [sp+0h] [bp-Ch]@10 signed int freeSlot; // [sp+8h] [bp-4h]@4 - unsigned int heightInSlots; // [sp+18h] [bp+Ch]@10 - - freeSlot = FindFreeInventorySlot(); + + freeSlot = FindFreeInventoryListSlot(); if ( freeSlot == -1 ) { if ( uActiveCharacter ) @@ -895,26 +891,9 @@ } else { - texturePtr = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); - widthInSlots = GetSizeInInventorySlots(texturePtr->uTextureWidth); - heightInSlots = GetSizeInInventorySlots(texturePtr->uTextureHeight); - if ( !areWeLoadingTexture ) - { - texturePtr->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - if (widthInSlots > 0) - { - v9 = &this->pInventoryIndices[uSlot]; - for (unsigned int i = 0; i < heightInSlots; i++) - { - memset32(v9, -1 - uSlot, widthInSlots); //TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn - v9 += INVETORYSLOTSWIDTH; - } - } + PutItemArInventoryIndex(uItemID, freeSlot, uSlot); result = freeSlot + 1; - this->pInventoryIndices[uSlot] = freeSlot + 1; - this->pInventoryItems[freeSlot].uItemID = uItemID; + this->pInventoryItemList[freeSlot].uItemID = uItemID; } return result; } @@ -923,8 +902,6 @@ //----- (00492700) -------------------------------------------------------- int Player::HasSkill(unsigned int uSkillType) { - signed int result; // eax@3 - if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) { return 1; @@ -938,170 +915,111 @@ } //----- (00492745) -------------------------------------------------------- -int Player::WearItem(unsigned int uItemID) +void Player::WearItem( unsigned int uItemID ) { int item_body_anch; // edi@6 int item_indx; - item_indx = FindFreeInventorySlot(); + item_indx = FindFreeInventoryListSlot(); if ( item_indx != -1 ) { - pInventoryItems[item_indx].uItemID = uItemID; + pInventoryItemList[item_indx].uItemID = uItemID; item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; pEquipment.pIndices[item_body_anch] = item_indx + 1; - pInventoryItems[item_indx].uBodyAnchor = item_body_anch + 1; - } - return 0; + pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; + } } //----- (004927A8) -------------------------------------------------------- -int Player::AddItem(int uSlot, unsigned int uItemID) +int Player::AddItem(int index, unsigned int uItemID) { int xStartValue = 0; - - if ( uSlot == -1 ) + int startOfInnerLoop = 0; + + if ( index == -1 ) { for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) { - for (int xcoord = xStartValue; xcoord < INVETORYSLOTSWIDTH; xcoord++) - { - if ( CanFitItem(xcoord, uItemID) ) + int innerLoopPos = startOfInnerLoop; + for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) + { + if ( CanFitItem(innerLoopPos, uItemID) ) { - return CreateItemInInventory(xcoord, uItemID); + return CreateItemInInventory(innerLoopPos, uItemID); } - } - xStartValue += INVETORYSLOTSWIDTH; + innerLoopPos++; + } + startOfInnerLoop += INVETORYSLOTSWIDTH; } return 0; } - if ( !CanFitItem(uSlot, uItemID) ) + if ( !CanFitItem(index, uItemID) ) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return 0; } - return CreateItemInInventory(uSlot, uItemID); + return CreateItemInInventory(index, uItemID); } //----- (00492826) -------------------------------------------------------- -int Player::AddItem2(int uSlot, ItemGen *Src) -{ - unsigned int v3; // ebx@1 - unsigned int v4; // esi@3 - signed int v5; // edi@3 - unsigned int v7; // [sp-8h] [bp-18h]@9 - ItemGen *v8; // [sp-4h] [bp-14h]@9 - Player *thisa; // [sp+Ch] [bp-4h]@1 - signed int uSlota; // [sp+18h] [bp+8h]@2 - - thisa = this; - v3 = Src->uItemID; +int Player::AddItem2(int index, ItemGen *Src) +{ + int xStartValue = 0; pItemsTable->SetSpecialBonus(Src); - if ( uSlot == -1 ) - { - uSlota = 0; - while ( true ) - { - v4 = uSlota; - v5 = 0; - do - { - if ( CanFitItem(v4, v3) ) + int startOfInnerLoop = 0; + + if ( index == -1 ) + { + for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. + { + int innerLoopPos = startOfInnerLoop; + for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) + { + if ( CanFitItem(innerLoopPos, Src->uItemID) ) { - v8 = Src; - v7 = v4; - return CreateItemInInventory2(v7, v8); + return CreateItemInInventory2(innerLoopPos, Src); } - ++v5; - v4 += 14; - } - while ( v5 < 14 ); - ++uSlota; - if ( uSlota < 9 ) - continue; - break; + innerLoopPos++; + } + startOfInnerLoop += INVETORYSLOTSWIDTH; } return 0; } - if ( !CanFitItem(uSlot, v3) ) + if ( !CanFitItem(index, Src->uItemID) ) return 0; - v8 = Src; - v7 = uSlot; - return CreateItemInInventory2(v7, v8); + return CreateItemInInventory2(index, Src); } //----- (0049289C) -------------------------------------------------------- -int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) -{ - signed int v3; // ebx@1 - ItemGen *v4; // eax@1 +int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) +{ + signed int freeSlot; // ebx@1 int result; // eax@6 - //unsigned int v6; // eax@7 - Texture *item_texture; // esi@7 - unsigned int v8; // edx@9 - int *pInvPos; // esi@10 - unsigned int slot_width; // [sp+4h] [bp-Ch]@7 - unsigned int slot_height; // [sp+8h] [bp-8h]@7 - Player *v12; // [sp+Ch] [bp-4h]@1 - - - v12 = this; - v3 = 0; - v4 = this->pInventoryItems; - while ( v4->uItemID ) - { - ++v3; - ++v4; - if ( v3 >= 126 ) - { - v3 = -1; - break; - } - } - if ( v3 == -1 ) + + freeSlot = FindFreeInventoryListSlot(); + if ( freeSlot == -1 ) { result = 0; } else { - item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); - slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); - if ( !areWeLoadingTexture ) - { - item_texture->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - if ( slot_height > 0 ) - { - pInvPos = &pInventoryIndices[uSlot]; - do - { - if ( slot_width > 0 ) - memset32(pInvPos, -1 - uSlot, slot_width); - pInvPos +=14; - --slot_height; - } - while ( slot_height ); - } - pInventoryIndices[uSlot] = v3 + 1; - memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); - result = v3 + 1; + PutItemArInventoryIndex(Src->uItemID, freeSlot, index); + memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); + result = freeSlot + 1; } return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (0049298B) -------------------------------------------------------- -int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) - { - //Player *v4; // ebx@1 - //unsigned int v5; // eax@1 +void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID +{ Texture *item_texture; // esi@1 int *pInvPos; // esi@4 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 unsigned int slot_height; // [sp+18h] [bp+8h]@1 - item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); if ( !areWeLoadingTexture ) @@ -1109,35 +1027,30 @@ item_texture->Release(); pIcons_LOD->SyncLoadedFilesCount(); } - if ( (signed int)slot_height > 0 ) - { - pInvPos = &pInventoryIndices[uSlot]; //14x9 - do - { - if ( (signed int)slot_width > 0 ) - memset32(pInvPos, -1 - uSlot, slot_width); - pInvPos +=14; - --slot_height; - } - while ( slot_height ); - } - pInventoryIndices[uSlot] = item_id + 1; - return 1; + if ( slot_width > 0 ) + { + pInvPos = &pInventoryMatrix[index]; + for (unsigned int i = 0; i < slot_height; i++) + { + memset32(pInvPos, -1 - index, slot_width);//TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn + pInvPos += INVETORYSLOTSWIDTH; + } + } + pInventoryMatrix[index] = itemListPos + 1; } // 506128: using guessed type int areWeLoadingTexture; //----- (00492A36) -------------------------------------------------------- -void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) - { - +void Player::RemoveItemAtInventoryIndex( unsigned int index ) +{ ItemGen *item_in_slot; // ecx@1 Texture *item_texture; // esi@1 unsigned int slot_height; // ebp@1 int *pInvPos; // edx@4 unsigned int slot_width; // [sp+14h] [bp+4h]@1 - item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; + item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); item_in_slot->Reset(); slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); @@ -1147,201 +1060,103 @@ item_texture->Release(); pIcons_LOD->SyncLoadedFilesCount(); } - if ( slot_height > 0 ) - { - pInvPos = &pInventoryIndices[uSlot]; - do - { - if (slot_width > 0 ) - memset32(pInvPos, 0, slot_width); - pInvPos += 14; - --slot_height; - } - while ( slot_height ); - } - + if ( slot_width > 0 ) + { + pInvPos = &pInventoryMatrix[index]; + for (unsigned int i = 0; i < slot_height; i++) + { + memset32(pInvPos, 0, slot_width); + pInvPos += INVETORYSLOTSWIDTH; + } + } } // 506128: using guessed type int areWeLoadingTexture; -//identf //----- (00490EEE) -------------------------------------------------------- -int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) -{ - int pSkillLevel; // eax@1 - int NotBuy; // eax@1 - int result; - signed int pEquipType; // esi@1 - float *pPriceMultiplier; // esi@26 - int pPriceItemService; // edi@26 - - pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); - NotBuy = 4; - pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; - if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) - && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) - return 5; - if ( building_type == BildingType_WeaponShop ) - { - if ( pEquipType > EQUIP_BOW ) - return NotBuy; - if (pItem->Stolen()) - return 6; - } - if ( building_type == BildingType_ArmorShop ) - { - if ( pEquipType < 3 && pEquipType > 9 ) - return NotBuy; - if (pItem->Stolen()) - return 6; - } - if ( building_type == BildingType_MagicShop ) - { - if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) - { - if (pItem->Stolen()) - return 6; - pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; - pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); - if ( ShopMenuType == 3 )//Sell - { - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); - if (!pItem->Broken()) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 4 )//Identify - { - pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 5 )//Repair - { - pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType != 6 )//Buy and ??? - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; +int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff +{ + unsigned int idemId; // edx@1 + signed int equipType; // esi@1 + float multiplier; // ST04_4@26 + int price; // edi@26 + int merchantLevel; // [sp+10h] [bp-8h]@1 + int itemValue; + + merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); + idemId = pItem->uItemID; + equipType = pItemsTable->pItems[idemId].uEquipType; + itemValue = pItem->GetValue(); + + switch (building_type) + { + case BildingType_WeaponShop: + if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) + return 5; + if (equipType > EQUIP_BOW) + return 4; + break; + case BildingType_ArmorShop: + if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) + return 5; + if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) + return 4; + break; + case BildingType_MagicShop: + if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) + return 5; + if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) + return 4; + break; + case BildingType_AlchemistShop: + if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) + return 5; + if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) + return 4; + break; + default: + assert(false); + break; + } + if (pItem->Stolen()) + return 6; + + multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; + switch (ShopMenuType) + { + case 2: + price = GetBuyingPrice(itemValue, multiplier); + break; + case 3: if (pItem->Broken()) - pPriceItemService = 1; - if ( pPriceItemService >= 1 ) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( pEquipType != EQUIP_BOOK ) - return NotBuy; - } - if ( building_type == BildingType_AlchemistShop ) - { - if ( pEquipType < EQUIP_REAGENT ) - return NotBuy; - if ( pEquipType > EQUIP_POTION ) - { - if ( pEquipType != EQUIP_MESSAGE_SCROLL ) - return NotBuy; - } - if (pItem->Stolen()) - return 6; - } - pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; - pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); - if ( ShopMenuType == 3 )//Sell - { - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); - if (!pItem->Broken()) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; + price = 1; else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 4 )//Identify - { - pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 5 )//Repair - { - pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; + price = this->GetPriceSell(itemValue, multiplier); + break; + case 4: + price = this->GetPriceIdentification(multiplier); + break; + case 5: + price = this->GetPriceRepair(itemValue, multiplier); + break; + default: + assert(false); + break; + } + if ( merchantLevel ) + { + if (price == itemValue) + { + return 3; + } else - result = 1; - return result; - } - if ( ShopMenuType != 6 )//Buy and ??? - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; - if (pItem->Broken()) - pPriceItemService = 1; - if ( pPriceItemService >= 1 ) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; + { + return 2; + } + } else - result = 1; - return result; + { + return 1; + } } //----- (0049107D) -------------------------------------------------------- @@ -1644,9 +1459,9 @@ Player::Player() { memset(&pEquipment, 0, sizeof(PlayerEquipment)); - memset(pInventoryIndices, 0, 126 * sizeof(int)); + memset(pInventoryMatrix, 0, 126 * sizeof(int)); for (uint i = 0; i < 126; ++i) - pInventoryItems[i].Reset(); + pInventoryItemList[i].Reset(); for (uint i = 0; i < 12; ++i) pEquippedItems[i].Reset(); @@ -1677,6 +1492,7 @@ uLuck = uLuckBonus = 0; uLevel = sLevelModifier = 0; sAgeModifier = 0; + sACModifier = 0; // memset(field_1F5, 0, 30); pure_luck_used=0; @@ -1820,7 +1636,7 @@ goto LABEL_15; } } - memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); + memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); pItem->Reset(); pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); v19->PlaySound(SPEECH_60, 0); @@ -2120,7 +1936,7 @@ } if ( HasItemEquipped(EQUIP_MAIN_HAND) ) { - v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; + v6 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uMainHand-1]; v7 = v6->uItemID; v8 = v6->uItemID; v9 = pItemsTable->pItems[v8].uDamageDice; @@ -2192,7 +2008,7 @@ { if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) { - v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; + v15 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uShield - 1]; v16 = v15->uItemID; v17 = v15->uItemID; if ( pItemsTable->pItems[v17].uEquipType != 4 ) @@ -2285,7 +2101,7 @@ int v7; // edi@4 v1 = this; - v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; + v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; if ( v2 < 64 || v2 > 65 ) { v4 = GetActualAccuracy(); @@ -2375,7 +2191,7 @@ result = HasItemEquipped(EQUIP_BOW); if ( !result ) return result; - v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; + v4 = (ItemGen *)&v2->pInventoryItemList[v2->pEquipment.uBow-1]; v5 = v4->uItemID; v6 = v4->uItemID; v15 = pItemsTable->pItems[v6].uDamageRoll; @@ -2625,13 +2441,13 @@ //----- (0048D62C) -------------------------------------------------------- ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) { - return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; + return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; } //----- (0048D651) -------------------------------------------------------- PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) { - return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; + return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; } //----- (0048D676) -------------------------------------------------------- @@ -2674,7 +2490,7 @@ { v6 = 0; while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) - || pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != item_id ) + || pInventoryItemList[pEquipment.pIndices[v6] - 1].uItemID != item_id ) { ++v6; if ( (signed int)v6 >= 16 ) @@ -2682,7 +2498,7 @@ } return 1; } - if ( HasItemEquipped(equip_type) && pInventoryItems[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) + if ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) return 1; return 0; } @@ -3059,7 +2875,7 @@ break; case 17: v12 = 0; - v13 = this->pInventoryItems; + v13 = this->pInventoryItemList; do { if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) @@ -3102,17 +2918,17 @@ LABEL_36: if ( !v4 ) goto LABEL_87; - v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; + v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); break; case 20: v19 = 0; - v20 = this->pInventoryIndices; + v20 = this->pInventoryMatrix; do { if ( *v20 > 0 ) { - v21 = *(int *)&v5->pInventoryItems[*v20-1]; + v21 = *(int *)&v5->pInventoryItemList[*v20-1]; if ( v21 > 0 ) { if ( v21 <= 134 ) @@ -3285,7 +3101,7 @@ goto LABEL_84; } v28 = v47; - memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); + memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); RemoveItemAtInventoryIndex(v28); LABEL_79: v42 = 0; @@ -3339,7 +3155,7 @@ { if ( !HasItemEquipped(EQUIP_BOW) ) goto LABEL_17; - weapon = &pInventoryItems[pEquipment.uBow - 1]; + weapon = &pInventoryItemList[pEquipment.uBow - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; goto LABEL_17; @@ -3355,7 +3171,7 @@ if ( HasItemEquipped(EQUIP_MAIN_HAND) ) { - weapon = &pInventoryItems[pEquipment.uMainHand - 1]; + weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; if (weapon_desc->uEquipType == EQUIP_WAND) { @@ -3369,11 +3185,11 @@ if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled { - auto v12 = &pInventoryItems[pEquipment.uShield - 1]; + auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; auto v12_desc = &pItemsTable->pItems[v12->uItemID]; if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) { - weapon = &pInventoryItems[pEquipment.uShield - 1]; + weapon = &pInventoryItemList[pEquipment.uShield - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; } @@ -3383,7 +3199,7 @@ uint armour_recovery = 0; if ( HasItemEquipped(EQUIP_ARMOUR) ) { - auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; + auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; float armour_recovery_multipliers[4]; @@ -3426,7 +3242,7 @@ { float shield_recovery_multipliers[4] = {1, 0, 0, 0}; - auto shield = &pInventoryItems[pEquipment.uShield - 1]; + auto shield = &pInventoryItemList[pEquipment.uShield - 1]; auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; @@ -3859,12 +3675,12 @@ inv_indx = pEquipment.pIndices[i] - 1; if (a2==17) { - if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery + if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery return 50; } if (a2==24) { - if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. + if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. return 5; } } @@ -4026,7 +3842,7 @@ { if ( v32 <= 11 ) { - v33 = v6->pInventoryItems[v31].uItemID; + v33 = v6->pInventoryItemList[v31].uItemID; v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; } } @@ -5326,7 +5142,7 @@ { if ( v2->HasItemEquipped(v71) ) { - v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; + v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItemList[*(_DWORD *)v9].uItemID].uEquipType; LOBYTE(v12) = this->GetActualSkillLevel(v11); a1 = v12; SkillToMastery(v12); @@ -5384,7 +5200,7 @@ { if ( v2->HasItemEquipped(v20) ) { - v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; + v22 = this->pInventoryItemList[this->pEquipment.pIndices[v20]].uItemID; if ( pItemsTable->pItems[v22].uEquipType <= 1u ) break; } @@ -6756,7 +6572,7 @@ v23 = pParty->pPlayers;//[0].pInventoryItems; do { - v24 = v23->pInventoryItems; + v24 = v23->pInventoryItemList; v25 = 138; do { @@ -6845,7 +6661,7 @@ return v4 >= pValue; } while ( !v3->HasItemEquipped(v26) - || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) + || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) { v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); v27 += 4; @@ -6942,7 +6758,7 @@ return false; case VAR_PlayerItemInHands: v15 = 0; - v16 = v3->pInventoryItems; + v16 = v3->pInventoryItemList; break; case VAR_FixedGold: v4 = pParty->uNumGold; @@ -7327,7 +7143,7 @@ v9 = NULL; for (int i = 0; i < 138; i++) { - v9 = &this->pInventoryItems[i]; + v9 = &this->pInventoryItemList[i]; if (v9->uItemID == ITEM_LICH_JAR_EMPTY) break; } @@ -8472,7 +8288,7 @@ pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); return true; case VAR_PlayerItemInHands: - v15 = this->pInventoryIndices; + v15 = this->pInventoryMatrix; break; case VAR_FixedGold: if ( (unsigned int)pValue > pParty->uNumGold ) @@ -8833,7 +8649,7 @@ } for (v3 = 1; v3 < 126; v3++) { - if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) + if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) { RemoveItemAtInventoryIndex(v3); return true; @@ -8887,11 +8703,11 @@ } else { - v7 = v3->FindFreeInventorySlot(); + v7 = v3->FindFreeInventoryListSlot(); if (v7 >= 0) { pParty->pPickedItem.uBodyAnchor = v2 + 1; - memcpy(&v3->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItems[v7])); + memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItemList[v7])); *v11 = v7 + 1; pMouse->RemoveHoldingItem(); } @@ -8993,9 +8809,9 @@ { for ( uint i = 0; i < 126; ++i ) { - if ( pPlayer->pInventoryIndices[i] > 0 ) - { - if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID ) + if ( pPlayer->pInventoryMatrix[i] > 0 ) + { + if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) return true; } } @@ -9003,7 +8819,7 @@ { if ( pPlayer->pEquipment.pIndices[i] ) { - if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) + if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) return true; } } @@ -9421,7 +9237,7 @@ if ( v45->HasEnchantedItemEquipped(69) ) v77 >>= 1; if ( v45->HasItemEquipped(EQUIP_ARMOUR) - && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uArmor-1] == 504 ) + && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) v77 >>= 1; v75 = 0; v47 = (int)&v45->pEquipment; @@ -9644,7 +9460,7 @@ *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4; - ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1]; + ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; unk_50C9A0 = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; @@ -9663,7 +9479,7 @@ { if ( !v8 ) return; - memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem)); + memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); v0->RemoveItemAtInventoryIndex(a4); v9 = pParty->pPickedItem.uItemID; pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); @@ -9672,7 +9488,7 @@ v13 = v8; if ( v8 ) { - a2.y = (LONG)&v0->pInventoryItems[v8-1]; + a2.y = (LONG)&v0->pInventoryItemList[v8-1]; memcpy(&this_, (const void *)a2.y, sizeof(this_)); v0->RemoveItemAtInventoryIndex(a4); pX = v0->AddItem2(a4, &pParty->pPickedItem); @@ -9681,7 +9497,7 @@ pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); if ( !pX ) { - v0->PutItemArInventoryIndex(&this_, v13 - 1, a4); + v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); memcpy((void *)a2.y, &this_, sizeof(ItemGen)); return; } @@ -9695,7 +9511,7 @@ pX = v10; if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) { - memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u); + memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); } }
--- a/Player.h Thu Jul 18 09:40:05 2013 +0600 +++ b/Player.h Thu Jul 18 09:40:14 2013 +0600 @@ -540,14 +540,14 @@ int GetDisarmTrap(); char GetLearningPercent(); bool CanFitItem(unsigned int uSlot, unsigned int uItemID); - int FindFreeInventorySlot(); + int FindFreeInventoryListSlot(); int CreateItemInInventory(unsigned int uSlot, unsigned int uItemID); int HasSkill(unsigned int uSkillType); - int WearItem(unsigned int uItemID); + void WearItem(unsigned int uItemID); int AddItem(int uSlot, unsigned int uItemID); int AddItem2(int uSlot, ItemGen *Src); - int CreateItemInInventory2(unsigned int uSlot, ItemGen *Src); - int PutItemArInventoryIndex(ItemGen *item, int item_id, int uSlot); + int CreateItemInInventory2(unsigned int index, ItemGen *Src); + void PutItemArInventoryIndex(int uItemID, int itemListPos, int uSlot); void RemoveItemAtInventoryIndex(unsigned int uSlot); bool CanAct(); bool CanSteal(); @@ -710,13 +710,13 @@ { struct { - ItemGen pInventoryItems[126]; + ItemGen pInventoryItemList[126]; ItemGen pEquippedItems[12]; }; ItemGen pOwnItems[138]; }; - int pInventoryIndices[126]; + int pInventoryMatrix[126]; __int16 sResFireBase; __int16 sResAirBase; __int16 sResWaterBase;
--- a/Render.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/Render.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -3715,9 +3715,9 @@ local_0.x = v3; local_0.y = (double)*(signed int *)v0; local_0.z = (double)*((signed int *)v0 + 1); - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.flt_28 = 1.0; local_0.timeToLive = (rand() & 0x80) + 128; local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); @@ -7079,10 +7079,7 @@ pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0); pRenderer->uNumBillboardsToDraw = 0; pRenderD3D->pDevice->BeginScene(); - if (!pRenderD3D->DoesRaiseExceptions()) - { - MessageBoxW(nullptr, L"Error executing scratch 3D operations", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\screen16_3d.cpp:360", 0); - } + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) uFogColor = GetLevelFogColor(); else @@ -7569,6 +7566,433 @@ } } + +//----- (00479A53) -------------------------------------------------------- +void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID) +{ + BLVFace *pFace; // esi@1 + unsigned int v3; // edi@1 + PolygonType v4; // al@1 + double v5; // st7@3 + signed __int64 v6; // qax@3 + PolygonType v7; // cl@3 + int v8; // esi@7 + int v9; // eax@7 + unsigned int v10; // eax@7 + double v11; // st6@7 + int v12; // edx@7 + int v13; // eax@7 + char *v14; // esi@8 + void *v15; // ecx@9 + int v16; // eax@9 + int v17; // edi@9 + double v18; // st7@9 + signed int v19; // ebx@9 + void *v20; // ecx@9 + int v21; // ebx@11 + int v22; // eax@14 + signed __int64 v23; // qtt@16 + double v24; // st7@16 + unsigned __int8 v25; // sf@16 + unsigned __int8 v26; // of@16 + Render *v27; // ecx@17 + double v28; // st7@20 + char *v29; // ebx@20 + char *v30; // edx@20 + unsigned __int8 v31; // c0@21 + unsigned __int8 v32; // c3@21 + double v33; // st6@23 + char *v34; // esi@30 + const void *v35; // ecx@31 + int v36; // eax@31 + const void *v37; // edi@31 + signed __int64 v38; // qax@31 + int v39; // ecx@31 + int v40; // ebx@33 + int v41; // eax@36 + signed __int64 v42; // qtt@39 + int v43; // eax@39 + char v44; // zf@39 + double v45; // st7@39 + double v46; // st7@39 + unsigned int v47; // edx@40 + double v48; // st7@41 + RenderVertexSoft *v49; // ebx@41 + void *v50; // edi@43 + double v51; // st7@46 + RenderVertexSoft *v52; // edx@46 + void *v53; // edi@48 + char *v54; // ebx@52 + unsigned int v55; // eax@53 + unsigned int v56; // eax@55 + int v57; // ST10_4@55 + Texture *v58; // eax@55 + signed int v59; // [sp-4h] [bp-178h]@17 + stru148 *v60; // [sp+0h] [bp-174h]@17 + IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 + stru148 v62; // [sp+14h] [bp-160h]@6 + unsigned int v63; // [sp+120h] [bp-54h]@7 + double v64; // [sp+124h] [bp-50h]@7 + unsigned int v65; // [sp+128h] [bp-4Ch]@1 + unsigned int v66; // [sp+12Ch] [bp-48h]@7 + float v67; // [sp+130h] [bp-44h]@7 + __int64 v68; // [sp+134h] [bp-40h]@3 + __int64 v69; // [sp+13Ch] [bp-38h]@3 + int v70; // [sp+144h] [bp-30h]@3 + int X; // [sp+148h] [bp-2Ch]@9 + int v72; // [sp+14Ch] [bp-28h]@7 + float v73; // [sp+150h] [bp-24h]@16 + unsigned int v74; // [sp+154h] [bp-20h]@3 + RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 + float v76; // [sp+15Ch] [bp-18h]@9 + int v77; // [sp+160h] [bp-14h]@9 + int v78; // [sp+164h] [bp-10h]@7 + void *v79; // [sp+168h] [bp-Ch]@9 + float v80; // [sp+16Ch] [bp-8h]@3 + const void *v81; // [sp+170h] [bp-4h]@7 + + __debugbreak(); + + pFace = &pIndoor->pFaces[uFaceID]; + v65 = uFaceID; + v3 = uNumVertices; + v4 = pFace->uPolygonType; + if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) + { + if ( (signed int)uNumVertices > 0 ) + { + v54 = (char *)&array_507D30[0].u; + LODWORD(v80) = uNumVertices; + do + { + v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; + *(float *)v54 = (double)v69 + *(float *)v54; + *(float *)v54 = *(float *)v54 * 0.25; + v55 = GetTickCount(); + v54 += 48; + v44 = LODWORD(v80)-- == 1; + v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); + *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; + } + while ( !v44 ); + uFaceID = v65; + } + v56 = 8 * uFaceID; + LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); + v57 = v56; + v58 = pFace->GetTexture(); + pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); + return; + } + HIDWORD(v69) = pIndoorCamera->sRotationX; + HIDWORD(v68) = pIndoorCamera->pos.z; + *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; + v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) + / (((double)pBLVRenderParams->field_40 + 16192.0) + * 65536.0) + + *(float *)&v74); + v5 = (double)pIndoorCamera->sRotationX * 0.0030664064; + *(float *)&v75 = v5; + v80 = cos(v5) * 16192.0; + v6 = (signed __int64)(*(float *)&v74 + - (double)pBLVRenderParams->field_40 + / ((v80 + 0.0000001) + * 65535.0) + * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); + v7 = pFace->uPolygonType; + if ( v7 == 4 || v7 == 3 ) + v70 = v6; + stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0); + v62._48607B(&stru_8019C8); + v62.uTileBitmapID = pFace->uBitmapID; + v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); + if ( !v62.pTexture ) + return; + v8 = pBLVRenderParams->sPartyRotX; + v62.dimming_level = 0; + v62.uNumVertices = v3; + v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); + v62.v_18.y = 0; + v62.v_18.x = -v9; + v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); + v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; + memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); + LODWORD(v80) = v10; + v62.field_24 = 33554432; + v64 = (double)(signed int)v10 * 0.5; + v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); + LODWORD(v80) = v62.pTexture->uTextureWidth; + v11 = 1.0 / (double)SLODWORD(v80); + LODWORD(v80) = v62.pTexture->uTextureHeight; + v12 = v62.pTexture->uWidthMinus1; + v13 = v62.pTexture->uHeightMinus1; + v67 = v11; + v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; + v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; + v78 = 0; + v81 = 0; + *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); + if ( (signed int)v62.uNumVertices <= 0 ) + { +LABEL_17: + v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; + v27 = pRenderer; + v60 = &v62; + v59 = v62.uNumVertices; + goto LABEL_18; + } + v14 = (char *)&array_507D30[0].vWorldViewProjY; + while ( 2 ) + { + v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); + LODWORD(v80) = v62.ptr_38->field_14; + v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; + v16 = v77 + v62.ptr_38->field_C; + v77 = (int)v15; + v74 = v16; + LODWORD(v80) = v62.ptr_38->field_20; + v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; + v79 = v15; + v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); + LODWORD(v80) = v62.v_18.z; + v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); + v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); + v18 = *(float *)v14 - 1.0; + v19 = -v62.field_24; + v77 = -v62.field_24; + X = (int)((char *)v79 + v62.v_18.x); + LODWORD(v76) = (signed __int64)v18; + v20 = (void *)(v72 * (v70 - LODWORD(v76))); + while ( 1 ) + { + v79 = v20; + if ( !X ) + goto LABEL_14; + v21 = abs(v19 >> 14); + if ( v21 <= abs(X) ) + break; + if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) + break; + v19 = v77; + v20 = v79; +LABEL_14: + LODWORD(v80) = v62.v_18.z; + v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); + v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; + --LODWORD(v76); + v20 = (char *)v20 + v72; + X = v22 + v62.v_18.x; + v78 = 1; + } + if ( !v78 ) + { + LODWORD(v23) = v77 << 16; + HIDWORD(v23) = v77 >> 16; + v79 = (void *)(v23 / X); + v77 = v17; + LODWORD(v80) = v62.ptr_38->field_10; + v77 = v17; + LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); + LODWORD(v80) = v62.ptr_38->field_1C; + v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); + v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; + LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; + v14 += 48; + LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); + v81 = (char *)v81 + 1; + v24 = (double)SLODWORD(v80) * 0.000015259022; + LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); + v26 = __OFSUB__((int)v81, v62.uNumVertices); + v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; + *((float *)v14 - 10) = v24 * v67; + *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); + *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; + if ( !(v25 ^ v26) ) + goto LABEL_17; + continue; + } + break; + } + LODWORD(v73) = 0; + v80 = v76; + if ( (signed int)v62.uNumVertices > 0 ) + { + v28 = (double)SLODWORD(v76); + LODWORD(v76) = (int)(char *)array_50AC10 + 28; + v29 = (char *)&array_50AC10[0].vWorldViewProjX; + v30 = (char *)&array_507D30[1].vWorldViewProjY; + v79 = array_50AC10; + v81 = array_507D30; + v78 = v62.uNumVertices; + do + { + v31 = v28 < *((float *)v30 - 12); + v32 = v28 == *((float *)v30 - 12); + ++LODWORD(v73); + memcpy(v79, v81, 0x30u); + v79 = (char *)v79 + 48; + LODWORD(v76) += 48; + v29 += 48; + if ( v31 | v32 || v28 >= *(float *)v30 ) + { + if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) + goto LABEL_28; + v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) + + *((float *)v30 - 1); + } + else + { + v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) + + *((float *)v30 - 13); + } + *(float *)v29 = v33; + v79 = (char *)v79 + 48; + v29 += 48; + ++LODWORD(v73); + *(unsigned int *)LODWORD(v76) = v28; + LODWORD(v76) += 48; +LABEL_28: + v81 = (char *)v81 + 48; + v30 += 48; + --v78; + } + while ( v78 ); + } + if ( SLODWORD(v73) <= 0 ) + goto LABEL_40; + v34 = (char *)&array_50AC10[0].vWorldViewProjY; + v65 = v77 >> 14; + HIDWORD(v69) = LODWORD(v73); + do + { + v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); + v78 = v62.ptr_38->field_14; + v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); + v36 = (int)((char *)v81 + v62.ptr_38->field_C); + v81 = v35; + v74 = v36; + v78 = v62.ptr_38->field_20; + v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); + v78 = (int)v35; + v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18); + v81 = (const void *)v62.v_18.z; + v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; + v37 = (const void *)(v72 + * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); + v38 = (signed __int64)(*(float *)v34 - 1.0); + v81 = 0; + LODWORD(v76) = v38; + v39 = v72 * (v70 - v38); + while ( 1 ) + { + v78 = v39; + if ( !X ) + goto LABEL_36; + v40 = abs(X); + if ( abs((signed __int64)v65) <= v40 ) + break; + if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) + break; + v39 = v78; +LABEL_36: + v78 = v62.v_18.z; + v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; + --LODWORD(v76); + v39 += v72; + X = v41 + v62.v_18.x; + v81 = (const void *)1; + } + if ( v81 ) + { + v79 = (void *)v62.v_18.z; + v78 = 2 * LODWORD(v76); + v81 = (const void *)((unsigned __int64)(v62.v_18.z + * (signed __int64)(signed int)(signed __int64)(((double)v70 + - ((double)(2 * LODWORD(v76)) + - *(float *)v34)) + * (double)v72)) >> 16); + X = (int)((char *)v81 + v62.v_18.x); + } + LODWORD(v42) = v77 << 16; + HIDWORD(v42) = v77 >> 16; + v79 = (void *)(v42 / X); + v81 = v37; + v78 = v62.ptr_38->field_10; + v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); + v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); + v74 = (unsigned int)v37; + LODWORD(v76) = v43; + v78 = v62.ptr_38->field_1C; + v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); + v74 = (unsigned __int64)(v43 * v42 / X) >> 16; + v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); + v34 += 48; + v78 = v66 + ((signed int)v74 >> 4); + v44 = HIDWORD(v69)-- == 1; + v45 = (double)v78 * 0.000015259022; + v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); + *((float *)v34 - 10) = v45 * v67; + *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); + v46 = (double)(signed int)v79; + *((float *)v34 - 16) = 0.000015258789 * v46; + *((float *)v34 - 11) = 65536.0 / v46; + } + while ( !v44 ); +LABEL_40: + v47 = 0; + if ( SLODWORD(v73) > 0 ) + { + v48 = (double)SLODWORD(v80); + v75 = array_507D30; + v49 = array_50AC10; + HIDWORD(v69) = LODWORD(v73); + do + { + if ( v48 >= v49->vWorldViewProjY ) + { + v50 = v75; + ++v47; + ++v75; + memcpy(v50, v49, 0x30u); + } + ++v49; + --HIDWORD(v69); + } + while ( HIDWORD(v69) ); + } + v62.uNumVertices = v47; + pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); + *(float *)&v74 = 0.0; + if ( SLODWORD(v73) > 0 ) + { + v51 = (double)SLODWORD(v80); + v75 = array_507D30; + v52 = array_50AC10; + v80 = v73; + do + { + if ( v51 <= v52->vWorldViewProjY ) + { + v53 = v75; + ++v74; + ++v75; + memcpy(v53, v52, 0x30u); + } + ++v52; + --LODWORD(v80); + } + while ( v80 != 0.0 ); + } + v62.uNumVertices = v74; + v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; + v60 = &v62; + v59 = v74; + v27 = pRenderer; +LABEL_18: + v27->_4A2ED5(v59, v60, v61); +} + + //----- (004A2FC0) -------------------------------------------------------- void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) { @@ -7841,54 +8265,54 @@ v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); } //v13 = (double)v25; - pBillboardRenderListD3D[v7].pQuards[0].specular = 0; - pBillboardRenderListD3D[v7].pQuards[0].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; + pBillboardRenderListD3D[v7].pQuads[0].specular = 0; + pBillboardRenderListD3D[v7].pQuads[0].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; //v14 = (double)v24; //v32 = v14; - pBillboardRenderListD3D[v7].pQuards[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; + pBillboardRenderListD3D[v7].pQuads[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894); - pBillboardRenderListD3D[v7].pQuards[0].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[0].pos.z = v15; v16 = 1.0 / pSoftBillboard->zbuffer_depth; - pBillboardRenderListD3D[v7].pQuards[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; - pBillboardRenderListD3D[v7].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v7].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v7].pQuads[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; + pBillboardRenderListD3D[v7].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v7].pQuads[0].texcoord.y = 0.0; v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight); if ( pSoftBillboard->uFlags & 4 ) v17 = v17 * -1.0; - pBillboardRenderListD3D[v7].pQuards[1].specular = 0; - pBillboardRenderListD3D[v7].pQuards[1].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; - pBillboardRenderListD3D[v7].pQuards[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; - pBillboardRenderListD3D[v7].pQuards[1].pos.z = v15; - pBillboardRenderListD3D[v7].pQuards[1].rhw = v16; - pBillboardRenderListD3D[v7].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v7].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v7].pQuads[1].specular = 0; + pBillboardRenderListD3D[v7].pQuads[1].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; + pBillboardRenderListD3D[v7].pQuads[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; + pBillboardRenderListD3D[v7].pQuads[1].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[1].rhw = v16; + pBillboardRenderListD3D[v7].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v7].pQuads[1].texcoord.y = 1.0; v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight; v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); if ( pSoftBillboard->uFlags & 4 ) v20 = v20 * -1.0; - pBillboardRenderListD3D[v7].pQuards[2].specular = 0; - pBillboardRenderListD3D[v7].pQuards[2].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; - pBillboardRenderListD3D[v7].pQuards[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; - pBillboardRenderListD3D[v7].pQuards[2].pos.z = v15; - pBillboardRenderListD3D[v7].pQuards[2].rhw = v16; - pBillboardRenderListD3D[v7].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v7].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v7].pQuads[2].specular = 0; + pBillboardRenderListD3D[v7].pQuads[2].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; + pBillboardRenderListD3D[v7].pQuads[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; + pBillboardRenderListD3D[v7].pQuads[2].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[2].rhw = v16; + pBillboardRenderListD3D[v7].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v7].pQuads[2].texcoord.y = 1.0; v21 = pSprite->uBufferHeight - pSprite->uAreaY; v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); if ( pSoftBillboard->uFlags & 4 ) v22 = v22 * -1.0; - pBillboardRenderListD3D[v7].pQuards[3].specular = 0; - pBillboardRenderListD3D[v7].pQuards[3].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; - pBillboardRenderListD3D[v7].pQuards[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; - pBillboardRenderListD3D[v7].pQuards[3].pos.z = v15; - pBillboardRenderListD3D[v7].pQuards[3].rhw = v16; - pBillboardRenderListD3D[v7].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v7].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v7].pQuads[3].specular = 0; + pBillboardRenderListD3D[v7].pQuads[3].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; + pBillboardRenderListD3D[v7].pQuads[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; + pBillboardRenderListD3D[v7].pQuads[3].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[3].rhw = v16; + pBillboardRenderListD3D[v7].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v7].pQuads[3].texcoord.y = 0.0; //v23 = pSprite->pTexture; pBillboardRenderListD3D[v7].uNumVertices = 4; pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; @@ -7967,7 +8391,7 @@ v19 = stru_5C6E00->Sin(angle); v20 = stru_5C6E00->Sin(angle); v21 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 - ((double)(unsigned __int16)v19 * 0.000015259022 @@ -7979,20 +8403,20 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[0].specular = 0; - pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[0].pos.y = v22; - pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); - pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].specular = 0; + pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[0].pos.y = v22; + pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); + pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); v25 = stru_5C6E00->Cos(angle); v26 = stru_5C6E00->Sin(angle); v27 = stru_5C6E00->Sin(angle); v28 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 + (double)(v25 >> 16)) * v31 - ((double)(unsigned __int16)v26 * 0.000015259022 @@ -8004,47 +8428,47 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuards[0].pos.z; - v30 = pBillboardRenderListD3D[v8].pQuards[0].rhw; - pBillboardRenderListD3D[v8].pQuards[1].pos.y = v29; - pBillboardRenderListD3D[v8].pQuards[1].specular = 0; - pBillboardRenderListD3D[v8].pQuards[1].rhw = v30; - pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuads[0].pos.z; + v30 = pBillboardRenderListD3D[v8].pQuads[0].rhw; + pBillboardRenderListD3D[v8].pQuads[1].pos.y = v29; + pBillboardRenderListD3D[v8].pQuads[1].specular = 0; + pBillboardRenderListD3D[v8].pQuads[1].rhw = v30; + pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); v33 = stru_5C6E00->Cos(angle); v34 = stru_5C6E00->Sin(angle); v35 = stru_5C6E00->Sin(angle); v36 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 + (double)(v33 >> 16)) * v23 - ((double)(unsigned __int16)v34 * 0.000015259022 + (double)(v34 >> 16)) * v24) * v11 + (double) a2->uScreenSpaceX; - v37 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; + v37 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23 - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[2].specular = 0; - pBillboardRenderListD3D[v8].pQuards[2].pos.z = v37; - pBillboardRenderListD3D[v8].pQuards[2].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; - pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[2].pos.y = v38; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].specular = 0; + pBillboardRenderListD3D[v8].pQuads[2].pos.z = v37; + pBillboardRenderListD3D[v8].pQuads[2].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; + pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[2].pos.y = v38; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); v41 = stru_5C6E00->Cos(angle); v42 = stru_5C6E00->Sin(angle); v43 = stru_5C6E00->Sin(angle); v44 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 + (double)(v41 >> 16)) * v39 - ((double)(unsigned __int16)v42 * 0.000015259022 @@ -8056,17 +8480,17 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - v46 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; - pBillboardRenderListD3D[v8].pQuards[3].specular = 0; - pBillboardRenderListD3D[v8].pQuards[3].pos.z = v46; - pBillboardRenderListD3D[v8].pQuards[3].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; - pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; + v46 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; + pBillboardRenderListD3D[v8].pQuads[3].specular = 0; + pBillboardRenderListD3D[v8].pQuads[3].pos.z = v46; + pBillboardRenderListD3D[v8].pQuads[3].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; + pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pTexture = a3; pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; pBillboardRenderListD3D[v8].uNumVertices = 4; - pBillboardRenderListD3D[v8].pQuards[3].pos.y = v45; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[3].pos.y = v45; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; } } } @@ -8141,7 +8565,7 @@ v20 = stru_5C6E00->Sin(angle); v21 = stru_5C6E00->Sin(angle); v22 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 - ((double)(unsigned __int16)v20 * 0.000015259022 @@ -8153,22 +8577,22 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[0].specular = 0; - pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[0].pos.y = v23; + pBillboardRenderListD3D[v8].pQuads[0].specular = 0; + pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23; v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[0].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24; v25 = 1.0 / v6; - pBillboardRenderListD3D[v8].pQuards[0].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; v26 = (double)(a2->uScreenSpaceX - 12) - v13; v27 = (double)a2->uScreenSpaceY - v15; v28 = stru_5C6E00->Cos(angle); v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v31 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v26 - ((double)(unsigned __int16)v29 * 0.000015259022 @@ -8180,20 +8604,20 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[1].pos.z = v24; - pBillboardRenderListD3D[v8].pQuards[1].pos.y = v32; - pBillboardRenderListD3D[v8].pQuards[1].specular = 0; - pBillboardRenderListD3D[v8].pQuards[1].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[1].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[1].pos.y = v32; + pBillboardRenderListD3D[v8].pQuads[1].specular = 0; + pBillboardRenderListD3D[v8].pQuads[1].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; v33 = (double)(a2->uScreenSpaceX + 12) - v13; v34 = (double)a2->uScreenSpaceY - v15; v35 = stru_5C6E00->Cos(angle); v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v38 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v33 - ((double)(unsigned __int16)v36 * 0.000015259022 @@ -8205,20 +8629,20 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[2].specular = 0; - pBillboardRenderListD3D[v8].pQuards[2].pos.z = v24; - pBillboardRenderListD3D[v8].pQuards[2].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[2].pos.y = v39; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].specular = 0; + pBillboardRenderListD3D[v8].pQuads[2].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[2].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; v40 = (double)(a2->uScreenSpaceX + 12) - v13; v41 = (double)(a2->uScreenSpaceY - 25) - v15; v42 = stru_5C6E00->Cos(angle); v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v45 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 + (double)(v42 >> 16)) * v40 - ((double)(unsigned __int16)v43 * 0.000015259022 @@ -8230,16 +8654,16 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[3].specular = 0; - pBillboardRenderListD3D[v8].pQuards[3].pos.z = v24; - pBillboardRenderListD3D[v8].pQuards[3].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[3].specular = 0; + pBillboardRenderListD3D[v8].pQuads[3].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[3].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pTexture = a3; pBillboardRenderListD3D[v8].z_order = v6; pBillboardRenderListD3D[v8].uNumVertices = 4; - pBillboardRenderListD3D[v8].pQuards[3].pos.y = v46; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[3].pos.y = v46; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; } } @@ -8287,53 +8711,53 @@ v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); if (a2->uFlags & 4) v14 *= -1.0; - pBillboardRenderListD3D[v8].pQuards[0].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; - pBillboardRenderListD3D[v8].pQuards[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[0].specular = specular; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; + pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[0].specular = specular; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); if ( a2->uFlags & 4 ) v14 = v14 * -1.0; - pBillboardRenderListD3D[v8].pQuards[1].specular = specular; - pBillboardRenderListD3D[v8].pQuards[1].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; - pBillboardRenderListD3D[v8].pQuards[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[1].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[1].specular = specular; + pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; + pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); if ( a2->uFlags & 4 ) v14 *= -1.0; - pBillboardRenderListD3D[v8].pQuards[2].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[2].specular = specular; - pBillboardRenderListD3D[v8].pQuards[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; - pBillboardRenderListD3D[v8].pQuards[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[2].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[2].specular = specular; + pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; + pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); if ( a2->uFlags & 4 ) v14 *= -1.0; - pBillboardRenderListD3D[v8].pQuards[3].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[3].specular = specular; - pBillboardRenderListD3D[v8].pQuards[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; - pBillboardRenderListD3D[v8].pQuards[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[3].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[3].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[3].specular = specular; + pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; + pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; pBillboardRenderListD3D[v8].uNumVertices = 4; pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture; @@ -8509,79 +8933,54 @@ } //----- (004A4CC9) -------------------------------------------------------- -void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2) -{ - int v3; // eax@1 - int v4; // edx@3 +void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse) +{ unsigned int v5; // eax@7 - int v6; // edi@7 char *v7; // edx@8 - char *v8; // ecx@8 - char v9; // zf@9 double v10; // st6@9 double v11; // st6@10 int v12; // ebx@13 - int v13; // ecx@16 - unsigned int v14; // [sp+Ch] [bp-4h]@1 - - auto _this = this; - - *(float *)&v14 = 1000000.0; - v3 = a1->field_10; - if ( v3 >= 3 ) - { - if ( v3 > 0 ) - { - _this = (Render *)&a1->field_14[62]; - v4 = a1->field_10; - do - { - if ( *(float *)&this->bUserDirect3D < (double)*(float *)&v14 ) - v14 = this->bUserDirect3D; - _this = (Render *)((char *)_this + 16); - --v4; - } - while ( v4 ); - } - v5 = Billboard_ProbablyAddToListAndSortByZOrder(v14); - v6 = 0; - pBillboardRenderListD3D[v5].field_90 = 0; - pBillboardRenderListD3D[v5].uParentBillboardID = -1; - pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; - if ( a1->field_10 > 0 ) - { - v7 = (char *)&a1->field_14[62]; - v8 = (char *)&pBillboardRenderListD3D[v5].pQuards[0].pos.z; - do - { - v9 = uCurrentlyLoadedLevelType == LEVEL_Indoor; - *((int *)v8 - 2) = *((int *)v7 - 2); - *((int *)v8 - 1) = *((int *)v7 - 1); - v10 = *(float *)v7; - if ( v9 ) - v11 = v10 * 0.061758894; - else - v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; - *(float *)v8 = 1.0 - 1.0 / v11; - *((float *)v8 + 1) = 1.0 / *(float *)v7; - if ( a2 & 0xFF000000 ) - v12 = *((int *)v7 + 1); - else - v12 = a2; - *((int *)v8 + 3) = 0; - *((int *)v8 + 2) = v12; - ++v6; - v7 += 16; - *((float *)v8 + 4) = 0.0; - *((float *)v8 + 5) = 0.0; - v8 += 32; - } - while ( v6 < a1->field_10 ); - } - v13 = a1->field_10; - pBillboardRenderListD3D[v5].pTexture = 0; - pBillboardRenderListD3D[v5].uNumVertices = v13; - LODWORD(pBillboardRenderListD3D[v5].z_order) = v14; + + if (a1->uNumVertices < 3) + return; + + float depth = 1000000.0; + for (uint i = 0; i < a1->uNumVertices; ++i) + { + if (a1->field_104[i].z < depth) + depth = a1->field_104[i * 4].z; + } + + v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth); + pBillboardRenderListD3D[v5].field_90 = 0; + pBillboardRenderListD3D[v5].uParentBillboardID = -1; + pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; + pBillboardRenderListD3D[v5].pTexture = 0; + pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices; + pBillboardRenderListD3D[v5].z_order = depth; + + for (uint i = 0; i < a1->uNumVertices; ++i) + { + pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x; + pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y; + + v10 = a1->field_104[i].z; + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + v11 = v10 * 0.061758894; + else + v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; + pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11; + pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z; + + if (diffuse & 0xFF000000) + v12 = a1->field_104[i].diffuse; + else + v12 = diffuse; + pBillboardRenderListD3D[v5].pQuads[i].diffuse = v12; + pBillboardRenderListD3D[v5].pQuads[i].specular = 0; + + pBillboardRenderListD3D[v5].pQuads[i].texcoord.x = 0.0; + pBillboardRenderListD3D[v5].pQuads[i].texcoord.y = 0.0; } } @@ -10649,12 +11048,6 @@ // 6BE364: using guessed type int dword_6BE364_game_settings_1; // A74C88: using guessed type int dword_A74C88; -//----- (0044EC20) -------------------------------------------------------- -bool RenderD3D::DoesRaiseExceptions() -{ - return true; -} - //----- (004524D8) -------------------------------------------------------- HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) @@ -10881,20 +11274,20 @@ auto p = &pRenderer->pBillboardRenderListD3D[0]; for (int i = 0; i < p->uNumVertices; ++i) { - p->pQuards[i].pos.z -= p->pQuards[i].pos.z * 0.6; - //p->pQuards[i].rhw = + 0.8 * (1.0f - p->pQuards[i].rhw); - } - p->pQuards[0].pos.x = 10; - p->pQuards[0].pos.y = 10; - - p->pQuards[1].pos.x = 10; - p->pQuards[1].pos.y = 200; - - p->pQuards[2].pos.x = 100; - p->pQuards[2].pos.y = 200; - - p->pQuards[3].pos.x = 100; - p->pQuards[3].pos.y = 10; + p->pQuads[i].pos.z -= p->pQuads[i].pos.z * 0.6; + //p->pQuads[i].rhw = + 0.8 * (1.0f - p->pQuads[i].rhw); + } + p->pQuads[0].pos.x = 10; + p->pQuads[0].pos.y = 10; + + p->pQuads[1].pos.x = 10; + p->pQuads[1].pos.y = 200; + + p->pQuads[2].pos.x = 100; + p->pQuads[2].pos.y = 200; + + p->pQuads[3].pos.x = 100; + p->pQuads[3].pos.y = 10; if (p->uOpacity != RenderBillboardD3D::NoBlend) SetBillboardBlendOptions(p->uOpacity); @@ -10902,7 +11295,7 @@ pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - p->pQuards, p->uNumVertices, + p->pQuads, p->uNumVertices, D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); }*/ @@ -10917,7 +11310,7 @@ pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - p->pQuards, p->uNumVertices, + p->pQuads, p->uNumVertices, D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); } @@ -10987,3 +11380,11 @@ { pRenderer->Present(); } + + + +//----- (0044EC20) -------------------------------------------------------- +/*bool RenderD3D::DoesRaiseExceptions() +{ + return true; +}*/ \ No newline at end of file
--- a/Render.h Thu Jul 18 09:40:05 2013 +0600 +++ b/Render.h Thu Jul 18 09:40:14 2013 +0600 @@ -196,7 +196,7 @@ IDirect3DTexture2 *pTexture; unsigned int uNumVertices; - RenderVertexD3D3 pQuards[4]; + RenderVertexD3D3 pQuads[4]; float z_order; OpacityType uOpacity; int field_90; @@ -223,8 +223,6 @@ struct RenderD3D { RenderD3D(); - - static bool DoesRaiseExceptions(); void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices); void Release(); @@ -325,13 +323,14 @@ void DrawSkyPolygon(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture); void _4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex); void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8); + void DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID); void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard); void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level); int MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6); void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9); - void _4A4CC9(struct stru6_stru1_indoor_sw_billboard *a1, int a2); + void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse); bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture); bool MoveSpriteToDevice(Sprite *pSprite); void BeginScene();
--- a/SaveLoad.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/SaveLoad.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -185,7 +185,7 @@ uint uEquipIdx = pParty->pPlayers[i].pEquipment.pIndices[j]; if (uEquipIdx) { - auto uItemID = pParty->pPlayers[i].pInventoryItems[uEquipIdx - 1].uItemID; + auto uItemID = pParty->pPlayers[i].pInventoryItemList[uEquipIdx - 1].uItemID; if (pItemsTable->pItems[uItemID].uEquipType == 12) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
--- a/SpriteObject.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/SpriteObject.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -331,9 +331,9 @@ Dst.x = (double)v1->vPosition.x; Dst.y = (double)v1->vPosition.y; Dst.z = (double)v1->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if (v2->uFlags & OBJECT_DESC_TRIAL_FIRE ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; @@ -455,9 +455,9 @@ Dst.x = (double)v1->vPosition.x; Dst.y = (double)v1->vPosition.y; Dst.z = (double)v1->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if ( v2->uFlags & OBJECT_DESC_TRIAL_FIRE ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; @@ -738,9 +738,9 @@ Dst.x = (double)pSpriteObject->vPosition.x; Dst.y = (double)pSpriteObject->vPosition.y; Dst.z = (double)pSpriteObject->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if ( v29 & 0x200 ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; @@ -928,9 +928,9 @@ Dst.x = (double)pSpriteObject->vPosition.x; Dst.y = (double)pSpriteObject->vPosition.y; Dst.z = (double)pSpriteObject->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if ( v10 & 0x200 ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
--- a/UI/UICharacter.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/UI/UICharacter.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -928,14 +928,14 @@ if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); v6 = player->pEquipment.uMainHand; - if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1) + if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItemList[v6-1], pItemsTable->pItems[v7].uEquipType != 1) && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand; if ( pMainHandNum4 ) { - item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum4 - 1]; + item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum4 - 1]; pX_MainHand4 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipX; pY_MainHand4 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipY; if ( item_MainHand4->uItemID == 64 ) //blaster @@ -987,7 +987,7 @@ pBowNum = pPlayers[uPlayerID]->pEquipment.uBow; // if ( pBowNum ) { - itemBow = &pPlayers[uPlayerID]->pInventoryItems[pBowNum - 1]; + itemBow = &pPlayers[uPlayerID]->pInventoryItemList[pBowNum - 1]; pX_Bow = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[itemBow->uItemID].uEquipX; pY_Bow = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[itemBow->uItemID].uEquipY; pBowTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[itemBow->uItemID].pIconName, TEXTURE_16BIT_PALETTE); @@ -1031,7 +1031,7 @@ pCloakNum = pPlayers[uPlayerID]->pEquipment.uCloak;// if ( pCloakNum ) { - item_Cloak = &pPlayers[uPlayerID]->pInventoryItems[pCloakNum - 1]; + item_Cloak = &pPlayers[uPlayerID]->pInventoryItemList[pCloakNum - 1]; switch ( item_Cloak->uItemID ) { case ITEM_RELIC_TWILIGHT: @@ -1096,7 +1096,7 @@ pArmorNum = pPlayers[uPlayerID]->pEquipment.uArmor;// if ( pArmorNum ) { - item_Armor = &pPlayers[uPlayerID]->pInventoryItems[pArmorNum - 1]; + item_Armor = &pPlayers[uPlayerID]->pInventoryItemList[pArmorNum - 1]; switch ( item_Armor->uItemID ) { case 504: @@ -1265,7 +1265,7 @@ pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;// if ( pBootNum ) { - item_Boot = &pPlayers[uPlayerID]->pInventoryItems[pBootNum - 1]; + item_Boot = &pPlayers[uPlayerID]->pInventoryItemList[pBootNum - 1]; switch ( item_Boot->uItemID ) { case 529: @@ -1325,7 +1325,7 @@ } } pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1) + if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1) && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], @@ -1333,7 +1333,7 @@ pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// if ( pBeltNum ) { - item_Belt = &pPlayers[uPlayerID]->pInventoryItems[pBeltNum - 1]; + item_Belt = &pPlayers[uPlayerID]->pInventoryItemList[pBeltNum - 1]; switch ( item_Belt->uItemID ) { case ITEM_RILIC_TITANS_BELT: @@ -1396,7 +1396,7 @@ pMainHandNum2 = pPlayers[uPlayerID]->pEquipment.uMainHand; if ( pMainHandNum2 ) { - v83 = pPlayers[uPlayerID]->pInventoryItems[pMainHandNum2 - 1].uItemID; + v83 = pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum2 - 1].uItemID; if ( pItemsTable->pItems[v83].uEquipType == 1 || pItemsTable->pItems[v83].uSkillType == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], @@ -1406,7 +1406,7 @@ pCloakCollarNum = pPlayers[uPlayerID]->pEquipment.uCloak;// if ( pCloakCollarNum ) { - item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItems[pCloakCollarNum - 1]; + item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItemList[pCloakCollarNum - 1]; switch ( item_CloakCollar->uItemID ) { case 525: @@ -1480,7 +1480,7 @@ pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;// if ( pHelmNum ) { - item_Helm = &pPlayers[uPlayerID]->pInventoryItems[pHelmNum-1]; + item_Helm = &pPlayers[uPlayerID]->pInventoryItemList[pHelmNum-1]; switch ( item_Helm->uItemID ) { case 521: @@ -1551,7 +1551,7 @@ pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand;//weapon in right hand if ( pMainHandNum3 ) { - item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum3 - 1]; + item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum3 - 1]; pX_MainHand3 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipX; pY_MainHand3 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipY; if ( item_MainHand3->uItemID == 64 ) @@ -1600,7 +1600,7 @@ pShieldNum = pPlayers[uPlayerID]->pEquipment.uShield;// if ( pShieldNum ) { - item_Shield = &pPlayers[uPlayerID]->pInventoryItems[pShieldNum - 1]; + item_Shield = &pPlayers[uPlayerID]->pInventoryItemList[pShieldNum - 1]; v149 = pItemsTable->pItems[item_Shield->uItemID].uSkillType; if ( v149 == 2 || v149 == 1 ) { @@ -1677,7 +1677,7 @@ pMainHandNum5 = pPlayers[uPlayerID]->pEquipment.uMainHand; if ( pMainHandNum5 ) { - item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum5 - 1]; + item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum5 - 1]; if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) @@ -1716,13 +1716,13 @@ int i = 0; for (uint i = 0; i < 126; ++i) { - int v26 = (int)(player->pInventoryIndices + i); + int v26 = (int)(player->pInventoryMatrix + i); - if (player->pInventoryIndices[i] <= 0) + if (player->pInventoryMatrix[i] <= 0) continue; - int item_idx = player->pInventoryIndices[i]; - auto item = &player->pInventoryItems[item_idx - 1]; + int item_idx = player->pInventoryMatrix[i]; + auto item = &player->pInventoryItemList[item_idx - 1]; if (!item->uItemID) continue; @@ -1845,7 +1845,7 @@ CharacterUI_DrawItem(pPaperdollRingsX[i], pPaperdollRingsY[i], - &player->pInventoryItems[player->pEquipment.uRings[i] - 1], + &player->pInventoryItemList[player->pEquipment.uRings[i] - 1], player->pEquipment.uRings[i]); } @@ -1853,14 +1853,14 @@ if (player->pEquipment.uAmulet) { CharacterUI_DrawItem(493, 91, - &player->pInventoryItems[player->pEquipment.uAmulet - 1], + &player->pInventoryItemList[player->pEquipment.uAmulet - 1], player->pEquipment.uAmulet); } if (player->pEquipment.uGlove) { CharacterUI_DrawItem(586, 88, - &player->pInventoryItems[player->pEquipment.uGlove - 1], + &player->pInventoryItemList[player->pEquipment.uGlove - 1], player->pEquipment.uGlove); } } @@ -2688,7 +2688,7 @@ v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; //v54 = pPlayers[uActiveCharacter]->pEquipment.uShield; //v53 = v1; - if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1 - 1]].uEquipType == 1 ) + if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uEquipType == 1 ) v51 = v1; v3 = pParty->pPickedItem.uItemID; if ( pParty->pPickedItem.uItemID ) @@ -2712,7 +2712,7 @@ { if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) && v1 - && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uSkillType == 4 ) + && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1-1]].uSkillType == 4 ) { LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); if ( (signed int)SkillToMastery(v5) < 3 ) @@ -2771,12 +2771,12 @@ { if ( !*(int *)v7 ) { - v8 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v8 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v8 >= 0 ) { v9 = v52; pParty->pPickedItem.uBodyAnchor = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v8])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v8])); *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1; pMouse->RemoveHoldingItem(); break; @@ -2830,14 +2830,14 @@ } else { - v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v52 < 0 ) return; if ( !v51 ) { pParty->pPickedItem.uBodyAnchor = 1; v17 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = v17; pMouse->RemoveHoldingItem(); return; @@ -2849,7 +2849,7 @@ pParty->SetHoldingItem((ItemGen *)(v15 + 532)); _this.uBodyAnchor = 1; v16 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = v16; } pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0; @@ -2905,12 +2905,12 @@ } break; } - v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v23 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v23 < 0 ) return; pParty->pPickedItem.uBodyAnchor = 1; - v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v23]; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v23])); + v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItemList[v23]; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v23])); pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; pMouse->RemoveHoldingItem(); if ( v52 != 12 ) @@ -2928,12 +2928,12 @@ } if ( !v1 ) { - v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v26 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v26 < 0 ) return; pParty->pPickedItem.uBodyAnchor = 2; - v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v26]; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v26])); + v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItemList[v26]; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v26])); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; pMouse->RemoveHoldingItem(); if ( v52 != 12 ) @@ -2999,7 +2999,7 @@ } else { - v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v52 >= 0 ) { if ( v2 ) @@ -3011,7 +3011,7 @@ pParty->SetHoldingItem((ItemGen *)(v29 + 532)); _this.uBodyAnchor = 2; v30 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = 0; pPlayers[uActiveCharacter]->pEquipment.uMainHand = v30; } @@ -3019,7 +3019,7 @@ { pParty->pPickedItem.uBodyAnchor = 2; v31 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v31; pMouse->RemoveHoldingItem(); } @@ -3085,7 +3085,7 @@ v35 = pPlayers[uActiveCharacter]->pEquipment.uBow; if ( v35 ) { - auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v35 - 1]; + auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v35 - 1]; pParty->SetHoldingItem(_a); _a->Reset(); pPlayers[uActiveCharacter]->pEquipment.uBow = 0;
--- a/UI/UIShops.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/UI/UIShops.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -266,7 +266,7 @@ pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) return; - v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v79 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; v13 = pPlayer->SelectPhrasesTransaction(v79, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); @@ -285,7 +285,7 @@ pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) return; - v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; if (!v4->Identified()) { v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); @@ -314,7 +314,7 @@ || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) ) return; - v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; @@ -892,7 +892,7 @@ pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) return; - v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10 - 1]; + v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3); v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); @@ -917,7 +917,7 @@ v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); if ( v2 ) { - v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1]; + v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1]; if (v3->Identified()) v5 = "%24"; else @@ -949,8 +949,8 @@ || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) ) return; - v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1]; - v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5); + v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v33 - 1]; + v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5); v15 = (char *)pMerchantsRepairPhrases[v35]; v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; @@ -1386,7 +1386,7 @@ pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) return; - v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v87 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; v45 = pPlayer->SelectPhrasesTransaction(v87, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0); pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); @@ -1404,7 +1404,7 @@ pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) return; - v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v37 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; if (!v37->Identified()) { v42 = pPlayer->SelectPhrasesTransaction(v37, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); @@ -2137,7 +2137,7 @@ || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) return; - item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); v30 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; @@ -2162,7 +2162,7 @@ result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); if ( result ) { - item = &pPlayers[uActiveCharacter]->pInventoryItems[result-1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[result-1]; if ( item->uAttributes & 1 ) { v5 = BuilDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); @@ -2196,8 +2196,8 @@ // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) ) || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) ) return; - item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1]; - v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); + item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; + v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); v30 = BuilDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); @@ -2352,7 +2352,7 @@ if ( taken_item ) { bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1], bought_item, 0x24u); dword_F8B1E4 = 1; Party::TakeGold(uPriceItemService); viewparams->bRedrawGameUI = 1; @@ -2372,7 +2372,7 @@ || pMouse->GetCursorPos(&cursor)->x >= 462 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) return; - if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) + if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) { dword_F8B1E4 = 1; pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); @@ -2395,7 +2395,7 @@ if ( pItemID ) { uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; if ( !(item->uAttributes & 1) ) { if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) @@ -2432,9 +2432,9 @@ pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); if ( pItemID ) { - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); if ( item->uAttributes & 2 ) { @@ -2510,14 +2510,14 @@ if ( v39 ) { bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen)); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); if ( pPlayers[uActiveCharacter]->CanSteal() ) { if ( GetAsyncKeyState(VK_CONTROL) ) { if ( uNumSeconds == 1 || uNumSeconds == 2 ) { - pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen(); + pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); viewparams->bRedrawGameUI = 1; bought_item->Reset(); @@ -2614,7 +2614,7 @@ || pMouse->GetCursorPos(&v12)->x >= 462 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) return; - GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); + GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[v9 - 1]); return; } if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
--- a/UI/UiGame.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/UI/UiGame.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -60,7 +60,7 @@ //v3 = player; if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) { - memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u); + memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u); viewparams->bRedrawGameUI = true; pMouse->RemoveHoldingItem(); return; @@ -1969,7 +1969,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v14-1]; + pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; //goto LABEL_49; v17 = pItemGen->GetDisplayName(); GameUI_SetFooterString(v17);
--- a/Vis.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/Vis.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -173,8 +173,8 @@ //while ( v8 ); } - if (min_x < pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.x || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > min_y || - pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < max_x || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < max_y) + if (min_x < pRenderer->pBillboardRenderListD3D[v13].pQuads[0].pos.x || pRenderer->pBillboardRenderListD3D[v13].pQuads[0].pos.y > min_y || + pRenderer->pBillboardRenderListD3D[v13].pQuads[3].pos.x < max_x || pRenderer->pBillboardRenderListD3D[v13].pQuads[1].pos.y < max_y) return false; return true; @@ -265,12 +265,12 @@ return false; //result = a1; - v5 = a1->pQuards[0].pos.x; - a1a = a1->pQuards[3].pos.x; - v6 = a1->pQuards[0].pos.y; - //result = (RenderBillboardD3D *)LODWORD(result->pQuards[1].pos.y); + v5 = a1->pQuads[0].pos.x; + a1a = a1->pQuads[3].pos.x; + v6 = a1->pQuads[0].pos.y; + //result = (RenderBillboardD3D *)LODWORD(result->pQuads[1].pos.y); v29 = v6; - v28 = a1->pQuards[1].pos.y; + v28 = a1->pQuads[1].pos.y; if ( v5 > a1a ) { v7 = v5; @@ -1548,7 +1548,7 @@ return false; - GetPolygonCenter(pRenderer->pBillboardRenderListD3D[v3].pQuards, 4, &test_x, &test_y); + GetPolygonCenter(pRenderer->pBillboardRenderListD3D[v3].pQuads, 4, &test_x, &test_y); CastPickRay(pPickingRay, test_x, test_y, fDepth); if (uCurrentlyLoadedLevelType == LEVEL_Indoor) PickIndoorFaces_Mouse(fDepth, pPickingRay, &Vis_static_stru_F91E10, &vis_face_filter); @@ -1569,8 +1569,8 @@ for (v40 = 0; v40 < 4; ++v40) { - test_x=pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[v40].pos.x; - test_y= pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[v40].pos.y; + test_x=pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[v40].pos.x; + test_y= pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[v40].pos.y; if ((double)(pViewport->uScreen_TL_X) <= test_x && (double)pViewport->uScreen_BR_X >= test_x && (double)pViewport->uScreen_TL_Y <= test_y && @@ -1595,11 +1595,11 @@ { if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) return false; - t1_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.x; - t2_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[3].pos.x; + t1_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[0].pos.x; + t2_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[3].pos.x; - t1_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.y; - t2_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[1].pos.y; + t1_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[0].pos.y; + t2_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[1].pos.y; if ( t1_x > t2_x ) { swap_temp = t1_x;
--- a/mm7_3.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/mm7_3.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -3830,7 +3830,6 @@ return result; } -// 47730C: using guessed type int __stdcall const_1(int); //----- (004775ED) -------------------------------------------------------- int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) @@ -3875,20 +3874,20 @@ float v39; // [sp+D0h] [bp-8h]@6 int *v40; // [sp+D4h] [bp-4h]@2 - v2 = (char *)&this->field_14[4 * this->field_10 + 20]; + v2 = (char *)&this->field_64[4 * this->uNumVertices]; v38 = 0; - *(int *)v2 = this->field_14[20]; + *(int *)v2 = this->field_64[0]; v2 += 4; - *(int *)v2 = this->field_14[21]; + *(int *)v2 = this->field_64[1]; v2 += 4; - *(int *)v2 = this->field_14[22]; - *((int *)v2 + 1) = this->field_14[23]; - v3 = this->field_10; + *(int *)v2 = this->field_64[2]; + *((int *)v2 + 1) = this->field_64[3]; + v3 = this->uNumVertices; v35 = this; if ( v3 > 0 ) { - v40 = &this->field_14[40]; - v4 = (char *)&this->field_14[23] + 3; + v40 = &this->field_64[20]; + v4 = (char *)&this->field_64[3] + 3; v34 = v3; while ( 1 ) { @@ -3974,9 +3973,7 @@ goto LABEL_10; } LABEL_12: - result = v38; - this->field_10 = v38; - return result; + return this->uNumVertices = v38; } //----- (00477927) -------------------------------------------------------- @@ -4022,20 +4019,20 @@ float v39; // [sp+D0h] [bp-8h]@6 int *v40; // [sp+D4h] [bp-4h]@2 - v2 = (char *)&this->field_14[4 * this->field_10 + 20]; + v2 = (char *)&this->field_64[4 * this->uNumVertices]; v38 = 0; - *(int *)v2 = this->field_14[20]; + *(int *)v2 = this->field_64[0]; v2 += 4; - *(int *)v2 = this->field_14[21]; + *(int *)v2 = this->field_64[1]; v2 += 4; - *(int *)v2 = this->field_14[22]; - *((int *)v2 + 1) = this->field_14[23]; - v3 = this->field_10; + *(int *)v2 = this->field_64[2]; + *((int *)v2 + 1) = this->field_64[3]; + v3 = this->uNumVertices; v35 = this; if ( v3 > 0 ) { - v40 = &this->field_14[40]; - v4 = (char *)&this->field_14[23] + 3; + v40 = &this->field_64[20]; + v4 = (char *)&this->field_64[3] + 3; v34 = v3; while ( 1 ) { @@ -4121,9 +4118,7 @@ goto LABEL_10; } LABEL_12: - result = v38; - this->field_10 = v38; - return result; + return this->uNumVertices = v38; } //----- (00477C61) -------------------------------------------------------- @@ -4175,7 +4170,7 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { v2 = 0; - if ( this->field_10 > 0 ) + if ( this->uNumVertices > 0 ) { v3 = (int)&this->field_14[1]; do @@ -4228,7 +4223,7 @@ *(float *)(v3 + 80) = v11; v3 += 16; } - while ( v2 < this->field_10 ); + while ( v2 < this->uNumVertices ); } } else @@ -4274,7 +4269,7 @@ } while ( v31 ); } - this->field_10 = 3; + this->uNumVertices = 3; return 1; } @@ -4306,7 +4301,7 @@ v10 = (double)pOutdoorCamera->shading_dist_mist; v3 = 8.0; } - v4 = a1->field_10; + v4 = a1->uNumVertices; if ( v4 <= 0 ) goto LABEL_16; v5 = (char *)&a1->field_14[20]; @@ -4329,15 +4324,15 @@ if ( v9 ) { v2->_477927(v10); - return v2->field_10 != 0; + return v2->uNumVertices != 0; } LABEL_16: memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); - return v2->field_10 != 0; + return v2->uNumVertices != 0; } v7 = v3; _4775ED(v7); - return v2->field_10 != 0; + return v2->uNumVertices != 0; } //----- (0047802A) -------------------------------------------------------- @@ -4354,7 +4349,7 @@ v16 = 0; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - for(int i = 0; i < a1->field_10; i++) + for(int i = 0; i < a1->uNumVertices; i++) { v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / a1->field_B4[i*4]; if ( pRenderer->pRenderD3D ) @@ -4385,7 +4380,7 @@ } else { - for(int i = 0; i < a1->field_10; i++) + for(int i = 0; i < a1->uNumVertices; i++) { v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4]; a1->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - v12 * a1->field_B4[i*4+1]; @@ -6118,431 +6113,6 @@ //} } -//----- (00479A53) -------------------------------------------------------- -void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID) -{ - BLVFace *pFace; // esi@1 - unsigned int v3; // edi@1 - PolygonType v4; // al@1 - double v5; // st7@3 - signed __int64 v6; // qax@3 - PolygonType v7; // cl@3 - int v8; // esi@7 - int v9; // eax@7 - unsigned int v10; // eax@7 - double v11; // st6@7 - int v12; // edx@7 - int v13; // eax@7 - char *v14; // esi@8 - void *v15; // ecx@9 - int v16; // eax@9 - int v17; // edi@9 - double v18; // st7@9 - signed int v19; // ebx@9 - void *v20; // ecx@9 - int v21; // ebx@11 - int v22; // eax@14 - signed __int64 v23; // qtt@16 - double v24; // st7@16 - unsigned __int8 v25; // sf@16 - unsigned __int8 v26; // of@16 - Render *v27; // ecx@17 - double v28; // st7@20 - char *v29; // ebx@20 - char *v30; // edx@20 - unsigned __int8 v31; // c0@21 - unsigned __int8 v32; // c3@21 - double v33; // st6@23 - char *v34; // esi@30 - const void *v35; // ecx@31 - int v36; // eax@31 - const void *v37; // edi@31 - signed __int64 v38; // qax@31 - int v39; // ecx@31 - int v40; // ebx@33 - int v41; // eax@36 - signed __int64 v42; // qtt@39 - int v43; // eax@39 - char v44; // zf@39 - double v45; // st7@39 - double v46; // st7@39 - unsigned int v47; // edx@40 - double v48; // st7@41 - RenderVertexSoft *v49; // ebx@41 - void *v50; // edi@43 - double v51; // st7@46 - RenderVertexSoft *v52; // edx@46 - void *v53; // edi@48 - char *v54; // ebx@52 - unsigned int v55; // eax@53 - unsigned int v56; // eax@55 - int v57; // ST10_4@55 - Texture *v58; // eax@55 - signed int v59; // [sp-4h] [bp-178h]@17 - stru148 *v60; // [sp+0h] [bp-174h]@17 - IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 - stru148 v62; // [sp+14h] [bp-160h]@6 - unsigned int v63; // [sp+120h] [bp-54h]@7 - double v64; // [sp+124h] [bp-50h]@7 - unsigned int v65; // [sp+128h] [bp-4Ch]@1 - unsigned int v66; // [sp+12Ch] [bp-48h]@7 - float v67; // [sp+130h] [bp-44h]@7 - __int64 v68; // [sp+134h] [bp-40h]@3 - __int64 v69; // [sp+13Ch] [bp-38h]@3 - int v70; // [sp+144h] [bp-30h]@3 - int X; // [sp+148h] [bp-2Ch]@9 - int v72; // [sp+14Ch] [bp-28h]@7 - float v73; // [sp+150h] [bp-24h]@16 - unsigned int v74; // [sp+154h] [bp-20h]@3 - RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 - float v76; // [sp+15Ch] [bp-18h]@9 - int v77; // [sp+160h] [bp-14h]@9 - int v78; // [sp+164h] [bp-10h]@7 - void *v79; // [sp+168h] [bp-Ch]@9 - float v80; // [sp+16Ch] [bp-8h]@3 - const void *v81; // [sp+170h] [bp-4h]@7 - - __debugbreak(); - - pFace = &pIndoor->pFaces[uFaceID]; - v65 = uFaceID; - v3 = uNumVertices; - v4 = pFace->uPolygonType; - if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) - { - if ( (signed int)uNumVertices > 0 ) - { - v54 = (char *)&array_507D30[0].u; - LODWORD(v80) = uNumVertices; - do - { - v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; - *(float *)v54 = (double)v69 + *(float *)v54; - *(float *)v54 = *(float *)v54 * 0.25; - v55 = GetTickCount(); - v54 += 48; - v44 = LODWORD(v80)-- == 1; - v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); - *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; - } - while ( !v44 ); - uFaceID = v65; - } - v56 = 8 * uFaceID; - LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); - v57 = v56; - v58 = pFace->GetTexture(); - pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); - return; - } - HIDWORD(v69) = pIndoorCamera->sRotationX; - HIDWORD(v68) = pIndoorCamera->pos.z; - *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; - v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) - / (((double)pBLVRenderParams->field_40 + 16192.0) - * 65536.0) - + *(float *)&v74); - v5 = (double)pIndoorCamera->sRotationX * 0.0030664064; - *(float *)&v75 = v5; - v80 = cos(v5) * 16192.0; - v6 = (signed __int64)(*(float *)&v74 - - (double)pBLVRenderParams->field_40 - / ((v80 + 0.0000001) - * 65535.0) - * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); - v7 = pFace->uPolygonType; - if ( v7 == 4 || v7 == 3 ) - v70 = v6; - stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0); - v62._48607B(&stru_8019C8); - v62.uTileBitmapID = pFace->uBitmapID; - v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); - if ( !v62.pTexture ) - return; - v8 = pBLVRenderParams->sPartyRotX; - v62.dimming_level = 0; - v62.uNumVertices = v3; - v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); - v62.v_18.y = 0; - v62.v_18.x = -v9; - v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); - v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; - memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); - LODWORD(v80) = v10; - v62.field_24 = 33554432; - v64 = (double)(signed int)v10 * 0.5; - v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); - LODWORD(v80) = v62.pTexture->uTextureWidth; - v11 = 1.0 / (double)SLODWORD(v80); - LODWORD(v80) = v62.pTexture->uTextureHeight; - v12 = v62.pTexture->uWidthMinus1; - v13 = v62.pTexture->uHeightMinus1; - v67 = v11; - v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; - v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; - v78 = 0; - v81 = 0; - *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); - if ( (signed int)v62.uNumVertices <= 0 ) - { -LABEL_17: - v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; - v27 = pRenderer; - v60 = &v62; - v59 = v62.uNumVertices; - goto LABEL_18; - } - v14 = (char *)&array_507D30[0].vWorldViewProjY; - while ( 2 ) - { - v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); - LODWORD(v80) = v62.ptr_38->field_14; - v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; - v16 = v77 + v62.ptr_38->field_C; - v77 = (int)v15; - v74 = v16; - LODWORD(v80) = v62.ptr_38->field_20; - v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; - v79 = v15; - v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); - LODWORD(v80) = v62.v_18.z; - v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); - v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); - v18 = *(float *)v14 - 1.0; - v19 = -v62.field_24; - v77 = -v62.field_24; - X = (int)((char *)v79 + v62.v_18.x); - LODWORD(v76) = (signed __int64)v18; - v20 = (void *)(v72 * (v70 - LODWORD(v76))); - while ( 1 ) - { - v79 = v20; - if ( !X ) - goto LABEL_14; - v21 = abs(v19 >> 14); - if ( v21 <= abs(X) ) - break; - if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) - break; - v19 = v77; - v20 = v79; -LABEL_14: - LODWORD(v80) = v62.v_18.z; - v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); - v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; - --LODWORD(v76); - v20 = (char *)v20 + v72; - X = v22 + v62.v_18.x; - v78 = 1; - } - if ( !v78 ) - { - LODWORD(v23) = v77 << 16; - HIDWORD(v23) = v77 >> 16; - v79 = (void *)(v23 / X); - v77 = v17; - LODWORD(v80) = v62.ptr_38->field_10; - v77 = v17; - LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); - LODWORD(v80) = v62.ptr_38->field_1C; - v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); - v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; - LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; - v14 += 48; - LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); - v81 = (char *)v81 + 1; - v24 = (double)SLODWORD(v80) * 0.000015259022; - LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); - v26 = __OFSUB__((int)v81, v62.uNumVertices); - v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; - *((float *)v14 - 10) = v24 * v67; - *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); - *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; - if ( !(v25 ^ v26) ) - goto LABEL_17; - continue; - } - break; - } - LODWORD(v73) = 0; - v80 = v76; - if ( (signed int)v62.uNumVertices > 0 ) - { - v28 = (double)SLODWORD(v76); - LODWORD(v76) = (int)(char *)array_50AC10 + 28; - v29 = (char *)&array_50AC10[0].vWorldViewProjX; - v30 = (char *)&array_507D30[1].vWorldViewProjY; - v79 = array_50AC10; - v81 = array_507D30; - v78 = v62.uNumVertices; - do - { - v31 = v28 < *((float *)v30 - 12); - v32 = v28 == *((float *)v30 - 12); - ++LODWORD(v73); - memcpy(v79, v81, 0x30u); - v79 = (char *)v79 + 48; - LODWORD(v76) += 48; - v29 += 48; - if ( v31 | v32 || v28 >= *(float *)v30 ) - { - if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) - goto LABEL_28; - v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) - + *((float *)v30 - 1); - } - else - { - v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) - + *((float *)v30 - 13); - } - *(float *)v29 = v33; - v79 = (char *)v79 + 48; - v29 += 48; - ++LODWORD(v73); - *(unsigned int *)LODWORD(v76) = v28; - LODWORD(v76) += 48; -LABEL_28: - v81 = (char *)v81 + 48; - v30 += 48; - --v78; - } - while ( v78 ); - } - if ( SLODWORD(v73) <= 0 ) - goto LABEL_40; - v34 = (char *)&array_50AC10[0].vWorldViewProjY; - v65 = v77 >> 14; - HIDWORD(v69) = LODWORD(v73); - do - { - v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); - v78 = v62.ptr_38->field_14; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); - v36 = (int)((char *)v81 + v62.ptr_38->field_C); - v81 = v35; - v74 = v36; - v78 = v62.ptr_38->field_20; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); - v78 = (int)v35; - v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18); - v81 = (const void *)v62.v_18.z; - v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; - v37 = (const void *)(v72 - * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); - v38 = (signed __int64)(*(float *)v34 - 1.0); - v81 = 0; - LODWORD(v76) = v38; - v39 = v72 * (v70 - v38); - while ( 1 ) - { - v78 = v39; - if ( !X ) - goto LABEL_36; - v40 = abs(X); - if ( abs((signed __int64)v65) <= v40 ) - break; - if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) - break; - v39 = v78; -LABEL_36: - v78 = v62.v_18.z; - v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; - --LODWORD(v76); - v39 += v72; - X = v41 + v62.v_18.x; - v81 = (const void *)1; - } - if ( v81 ) - { - v79 = (void *)v62.v_18.z; - v78 = 2 * LODWORD(v76); - v81 = (const void *)((unsigned __int64)(v62.v_18.z - * (signed __int64)(signed int)(signed __int64)(((double)v70 - - ((double)(2 * LODWORD(v76)) - - *(float *)v34)) - * (double)v72)) >> 16); - X = (int)((char *)v81 + v62.v_18.x); - } - LODWORD(v42) = v77 << 16; - HIDWORD(v42) = v77 >> 16; - v79 = (void *)(v42 / X); - v81 = v37; - v78 = v62.ptr_38->field_10; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); - v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); - v74 = (unsigned int)v37; - LODWORD(v76) = v43; - v78 = v62.ptr_38->field_1C; - v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); - v74 = (unsigned __int64)(v43 * v42 / X) >> 16; - v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); - v34 += 48; - v78 = v66 + ((signed int)v74 >> 4); - v44 = HIDWORD(v69)-- == 1; - v45 = (double)v78 * 0.000015259022; - v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); - *((float *)v34 - 10) = v45 * v67; - *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); - v46 = (double)(signed int)v79; - *((float *)v34 - 16) = 0.000015258789 * v46; - *((float *)v34 - 11) = 65536.0 / v46; - } - while ( !v44 ); -LABEL_40: - v47 = 0; - if ( SLODWORD(v73) > 0 ) - { - v48 = (double)SLODWORD(v80); - v75 = array_507D30; - v49 = array_50AC10; - HIDWORD(v69) = LODWORD(v73); - do - { - if ( v48 >= v49->vWorldViewProjY ) - { - v50 = v75; - ++v47; - ++v75; - memcpy(v50, v49, 0x30u); - } - ++v49; - --HIDWORD(v69); - } - while ( HIDWORD(v69) ); - } - v62.uNumVertices = v47; - pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); - *(float *)&v74 = 0.0; - if ( SLODWORD(v73) > 0 ) - { - v51 = (double)SLODWORD(v80); - v75 = array_507D30; - v52 = array_50AC10; - v80 = v73; - do - { - if ( v51 <= v52->vWorldViewProjY ) - { - v53 = v75; - ++v74; - ++v75; - memcpy(v53, v52, 0x30u); - } - ++v52; - --LODWORD(v80); - } - while ( v80 != 0.0 ); - } - v62.uNumVertices = v74; - v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; - v60 = &v62; - v59 = v74; - v27 = pRenderer; -LABEL_18: - v27->_4A2ED5(v59, v60, v61); -} - //----- (0047A384) -------------------------------------------------------- void ODM_LoadAndInitialize(const char *pLevelFilename, OutdoorCamera *thisa) {
--- a/mm7_4.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/mm7_4.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -1302,7 +1302,7 @@ { //v23 = v21->pEquipment.pIndices; auto _idx = v21->pEquipment.pIndices[v22]; - v24 = v21->pInventoryItems[_idx].uItemID; + v24 = v21->pInventoryItemList[_idx].uItemID; if ( v24 > 134 ) { if ( v24 == 529 ) @@ -1321,7 +1321,7 @@ } else { - v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; + v25 = v21->pInventoryItemList[_idx].uSpecEnchantmentType; if ( v25 <= 50 ) { if ( v25 != 50 ) @@ -1369,7 +1369,7 @@ if ( v48 ) { v31 = 0; - v32 = (char *)v21->pInventoryItems; + v32 = (char *)v21->pInventoryItemList; while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) { ++v31; @@ -3310,50 +3310,25 @@ } //----- (004A7063) -------------------------------------------------------- -int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) +unsigned int ModulateColor(unsigned int diffuse, float multiplier) { - float v2; // ST1C_4@1 - double v3; // ST14_8@1 - signed int v4; // ebx@1 - float v5; // ST1C_4@1 - double v6; // ST14_8@1 - signed int v7; // edi@1 - double v8; // ST0C_8@1 - signed int v9; // esi@1 - signed int v10; // ecx@1 - double v12; // [sp+8h] [bp-18h]@1 - unsigned __int64 v13; // [sp+18h] [bp-8h]@1 - - v2 = (double)(uDiffuse >> 24) * a2; - v3 = v2 + 6.7553994e15; - v4 = LODWORD(v3); - v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; - v6 = v5 + 6.7553994e15; - v7 = LODWORD(v6); - *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; - v8 = *((float *)&v6 + 1) + 6.7553994e15; - v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); - v9 = LODWORD(v8); - *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; - v12 = *((float *)&v6 + 1) + 6.7553994e15; - v10 = LODWORD(v12); - if ( v4 > 255 ) - v4 = 255; - if ( v4 < 0 ) - v4 = 0; - if ( SHIDWORD(v13) > 255 ) - v7 = 255; - if ( v7 < 0 ) - v7 = 0; - if ( (signed int)v13 > 255 ) - v9 = 255; - if ( v9 < 0 ) - v9 = 0; - if ( SLODWORD(v12) > 255 ) - v10 = 255; - if ( v10 < 0 ) - v10 = 0; - return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); + float alpha = multiplier * ((diffuse >> 24) & 0xFF); + int a = (int)floorf(alpha + 0.5f); + a = max(0, min(255, a)); + + float red = multiplier * ((diffuse >> 16) & 0xFF); + int r = (int)floorf(red + 0.5f); + r = max(0, min(255, r)); + + float green = multiplier * ((diffuse >> 8) & 0xFF); + int g = (int)floorf(green + 0.5f); + g = max(0, min(255, g)); + + float blue = multiplier * ((diffuse >> 0) & 0xFF); + int b = (int)floorf(blue + 0.5f); + b = max(0, min(255, b)); + + return (a << 24) | (r << 16) | (g << 8) | b; } //----- (004AD504) -------------------------------------------------------- @@ -5234,7 +5209,7 @@ v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; do { - v7 = v6->pInventoryItems; + v7 = v6->pInventoryItemList; v8 = 138; do {
--- a/mm7_5.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/mm7_5.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -5617,7 +5617,7 @@ if ( pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE ) { LABEL_116: - GameUI_DrawItemInfo(&v0->pInventoryItems[v10]); + GameUI_DrawItemInfo(&v0->pInventoryItemList[v10]); return; } if ( (signed int)pParty->pPickedItem.uItemID < 200 @@ -5634,7 +5634,7 @@ && pParty->pPickedItem.uItemID != 263 && pParty->pPickedItem.uItemID != 233 ) goto LABEL_116; - v27 = &v0->pInventoryItems[pOut.z]; + v27 = &v0->pInventoryItemList[pOut.z]; v28 = v27->uItemID; v51 = pItemsTable->pItems[v27->uItemID].uEquipType; v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); @@ -5774,7 +5774,7 @@ LABEL_54: pOut.y = 0; pOut.x = v10 + 1; - v17 = (int)v0->pInventoryIndices; + v17 = (int)v0->pInventoryMatrix; while ( *(int *)v17 != pOut.x ) { ++pOut.y; @@ -5836,9 +5836,9 @@ // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; v20 = v47 + 50 * v15; - v0->pInventoryItems[pOut.z].uItemID = v51; - v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + v0->pInventoryItems[pOut.z].uEnchantmentType) + v0->pInventoryItemList[pOut.z].uItemID = v51; + v0->pInventoryItemList[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + v0->pInventoryItemList[pOut.z].uEnchantmentType) / 2; v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: @@ -5903,28 +5903,28 @@ case 0xCAu: case 0xCBu: case 0xCCu: - v0->pInventoryItems[pOut.z].uItemID = 222; + v0->pInventoryItemList[pOut.z].uItemID = 222; break; case 0xCDu: case 0xCEu: case 0xCFu: case 0xD0u: case 0xD1u: - v0->pInventoryItems[pOut.z].uItemID = 223; + v0->pInventoryItemList[pOut.z].uItemID = 223; break; case 0xD2u: case 0xD3u: case 0xD4u: case 0xD5u: case 0xD6u: - v0->pInventoryItems[pOut.z].uItemID = 224; + v0->pInventoryItemList[pOut.z].uItemID = 224; break; case 0xD7u: case 0xD8u: case 0xD9u: case 0xDAu: case 0xDBu: - v0->pInventoryItems[pOut.z].uItemID = 221; + v0->pInventoryItemList[pOut.z].uItemID = 221; break; default: break;
--- a/mm7_6.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/mm7_6.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -2073,7 +2073,7 @@ //v31 = player->pEquipment.uBow; int bow_idx = player->pEquipment.uBow; - if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) + if (bow_idx && player->pInventoryItemList[bow_idx - 1].Broken()) bow_idx = 0; //v32 = 0; @@ -2085,7 +2085,7 @@ int main_hand_idx = player->pEquipment.uMainHand; if (main_hand_idx) { - auto item = &player->pInventoryItems[main_hand_idx - 1]; + auto item = &player->pInventoryItemList[main_hand_idx - 1]; //v5 = (char *)v1 + 36 * v4; if (!item->Broken()) { @@ -2144,9 +2144,9 @@ shooting_wand = true; int main_hand_idx = player->pEquipment.uMainHand; - _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); + _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); - if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) + if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges) player->pEquipment.uMainHand = 0; } else if (target_type == OBJECT_Actor && actor_distance <= 407.2) @@ -2201,7 +2201,7 @@ { int main_hand_idx = player->pEquipment.uMainHand; if (player->HasItemEquipped(EQUIP_MAIN_HAND)) - v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; + v34 = pItemsTable->pItems[*(int *)&player->pInventoryItemList[main_hand_idx - 1]].uSkillType; pTurnEngine->_40471C(); }
--- a/mm7_data.h Thu Jul 18 09:40:05 2013 +0600 +++ b/mm7_data.h Thu Jul 18 09:40:14 2013 +0600 @@ -1385,7 +1385,6 @@ void __cdecl loc_4789D4(); // idb void __cdecl loc_47907F(); // idb bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); -void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID); // idb void __thiscall ODM_LoadAndInitialize(const char *pLevelFilename, struct OutdoorCamera *thisa); unsigned __int16 *__fastcall GetBillboardPalette(struct RenderBillboard *a1, int a2, signed int a3, int a4); int __fastcall sr_sub_47BEB1(signed int a1, stru148 *a2, int terrain_gamma, int a4, int *a5, int *a6, int a7, int a8); @@ -1464,7 +1463,7 @@ int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int z, int a4, unsigned int lightColor); void Present_ColorKey(); void Present_NoColorKey(); -int __thiscall sub_4A7063(unsigned int uDiffuse, float a2); // idb +unsigned int ModulateColor(unsigned int diffuse, float multiplier); // idb struct SoundHeader *__fastcall FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName); struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID); int __fastcall sub_4AAEA6_transform(RenderVertexSoft *a1);
--- a/stru6.cpp Thu Jul 18 09:40:05 2013 +0600 +++ b/stru6.cpp Thu Jul 18 09:40:14 2013 +0600 @@ -61,40 +61,28 @@ } //----- (0047829F) -------------------------------------------------------- -void stru6_stru1_indoor_sw_billboard::_47829F_fireball_collision(float arg0, float a3, float a4, float a5, int a2) +void stru6_stru1_indoor_sw_billboard::_47829F_sphere_particle(float x_offset, float y_offset, float z_offset, float scale, int diffuse) { - 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 + int v7 = 0; - auto a1 = this; - - v6 = a1; - v7 = 0; - for ( i = 0; i < (signed int)v6->uNumVec3sInArray2; ++i ) + for (unsigned int i = 0; i < uNumVec3sInArray2; ++i) { - v8 = (char *)&v6->field_14[1]; - v9 = 3; - do + for (unsigned int j = 0; j < 3; ++j) { - *((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); + field_14[j].x = x_offset + scale * *(&pArray1->field_0 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); + field_14[j].y = y_offset + scale * *(&pArray1->field_4 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); + field_14[j].z = z_offset + scale * *(&pArray1->field_8 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); + int v10 = *(int *)((char *)&pArray2->field_0 + v7); + + field_14[j].diffuse = *((int *)&pArray1[1].field_0 + 4 * v10); 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() ) + + uNumVertices = 3; + if ( sub_477C61() && sub_477F63() ) { - if ( v6->sub_47802A() ) - pRenderer->_4A4CC9(v6, a2); + if ( sub_47802A() ) + pRenderer->_4A4CC9_AddSomeBillboard(this, diffuse); } } } @@ -192,9 +180,9 @@ 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.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.timeToLive = (rand() & 0x40) + 96; local_0.uTextureID = uTextureID; local_0.flt_28 = 1.0; @@ -223,9 +211,9 @@ 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.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.flt_28 = 1.0; local_0.timeToLive = (rand() & 0x7F) + 128; local_0.uTextureID = uTextureID; @@ -255,9 +243,9 @@ 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; + local_0.r = (double)(rand() & 0x1FF) - 255.0; + local_0.g = (double)(rand() & 0x1FF) - 255.0; + local_0.b = (double)(rand() & 0x1FF) - 255.0; pGame->pParticleEngine->AddParticle(&local_0); --v5; } @@ -267,98 +255,76 @@ //----- (004A7688) -------------------------------------------------------- void stru6::_4A7688_fireball_collision_particle(SpriteObject *a2) { - SpriteObject *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_sw 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.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; local_0.uDiffuse = 0xFF3C1E; - local_0.x = v5; + local_0.x = (double)a2->vPosition.x; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; local_0.timeToLive = (rand() & 0x7F) + 128; local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); - i = 10; local_0.flt_28 = 1.0; - do + + // 10 fireball sparks + for (unsigned int i = 0; i < 10; ++i) { - 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; + local_0.r = (rand() & 0x1FF) - 255; + local_0.g = (rand() & 0x1FF) - 255; + local_0.b = (rand() & 0x1FF) - 255; 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); + + v6 = ModulateColor(0xFF3C1E, v4); + v7 = (double)floorf(0.5f + v13); + v8 = (double)a2->vPosition.z; + v9 = (double)a2->vPosition.y; + v10 = (double)a2->vPosition.x; + pStru1->_47829F_sphere_particle(v10, v9, v8, v7, v6); } //----- (004A77FD) -------------------------------------------------------- -void stru6::_4A77FD_some_stuff_d3d(SpriteObject *a1) +void stru6::_4A77FD_implosion_particle(SpriteObject *a1) { - SpriteObject *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); + + v7 = ModulateColor(0x7E7E7E, v5); + v8 = (double)floorf(0.5f + v12); + v9 = (double)a1->vPosition.z; + v10 = (double)a1->vPosition.y; + v11 = (double)a1->vPosition.x; + pStru1->_47829F_sphere_particle(v11, v10, v9, v8, v7); } //----- (004A78AE) -------------------------------------------------------- @@ -379,9 +345,9 @@ local_0.timeToLive = 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.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.uTextureID = pSpriteFrameTable->GetFrame(v2->uSpriteID, v3)->pHwSpriteIDs[0]; LODWORD(local_0.flt_28) = 0x40000000u; pGame->pParticleEngine->AddParticle(&local_0); @@ -413,9 +379,9 @@ Dst.timeToLive = (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; + Dst.r = (double)(rand() & 0x1FF) - 255.0; + Dst.g = (double)(rand() & 0x1FF) - 255.0; + Dst.b = (double)(rand() & 0x1FF) - 255.0; pGame->pParticleEngine->AddParticle(&Dst); --v6; } @@ -466,43 +432,43 @@ local_0.timeToLive = (v6 & 0x7F) + 128; local_0.uTextureID = uTextureID; a1a = v7; - local_0.flt_10 = v7; - local_0.flt_14 = a4; - local_0.flt_18 = a4; + local_0.r = v7; + local_0.g = a4; + local_0.b = 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; + local_0.r = v8; + local_0.g = v8; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_14 = a1a; - local_0.flt_10 = a4; - local_0.flt_18 = a4; + local_0.g = a1a; + local_0.r = a4; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_10 = uDiffusea; - local_0.flt_18 = a4; + local_0.r = uDiffusea; + local_0.b = a4; v9 = -uDiffusea; uTextureIDa = v9; - local_0.flt_14 = v9; + local_0.g = v9; pGame->pParticleEngine->AddParticle(&local_0); v10 = -1.0 * a4; - local_0.flt_10 = a1a; + local_0.r = a1a; v12 = v10; - local_0.flt_14 = v10; - local_0.flt_18 = a4; + local_0.g = v10; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_18 = a4; - local_0.flt_10 = uTextureIDa; - local_0.flt_14 = uTextureIDa; + local_0.b = a4; + local_0.r = uTextureIDa; + local_0.g = uTextureIDa; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_10 = v12; - local_0.flt_14 = a1a; - local_0.flt_18 = a4; + local_0.r = v12; + local_0.g = a1a; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_10 = uTextureIDa; - local_0.flt_14 = uDiffusea; - local_0.flt_18 = a4; + local_0.r = uTextureIDa; + local_0.g = uDiffusea; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); } @@ -540,9 +506,9 @@ 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; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; v10 = rand(); LODWORD(local_0.flt_28) = 0x40400000u; local_0.timeToLive = (v10 & 0x3F) + 64; @@ -572,9 +538,9 @@ 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.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.timeToLive = (rand() & 0x3F) + 64; local_0.uTextureID = pSpriteFrameTable->GetFrame(v5->uSpriteID, a2->uSpriteFrameID)->pHwSpriteIDs[0]; pGame->pParticleEngine->AddParticle(&local_0); @@ -584,32 +550,22 @@ //----- (004A7E05) -------------------------------------------------------- void stru6::AddProjectile(SpriteObject *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 ) + if (a2->field_54) { - v5 = (double)a2->vPosition.z; - v6 = (double)a2->vPosition.y; - v7 = (double)a2->vPosition.x; - DoAddProjectile( - this->array_4[v4 & 0x1F].flt_0_x, - this->array_4[v4 & 0x1F].flt_4_y, - this->array_4[v4 & 0x1F].flt_8_z, - v7, - v6, - v5, - uTextureID); + DoAddProjectile(array_4[a2->field_54 & 0x1F].flt_0_x, + array_4[a2->field_54 & 0x1F].flt_4_y, + array_4[a2->field_54 & 0x1F].flt_8_z, + a2->vPosition.x, + a2->vPosition.y, + a2->vPosition.z, + uTextureID); } else { - a2->field_54 = this->field_0++; - this->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x; - this->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; - this->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; + a2->field_54 = field_0++; + array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x; + array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; + array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; } } @@ -687,9 +643,9 @@ 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; + local_0.r = pRnd->GetRandom() * 400.0 - 200.0; + local_0.g = pRnd->GetRandom() * 400.0 - 200.0; + local_0.b = pRnd->GetRandom() * 150.0 + 50.0; pGame->pParticleEngine->AddParticle(&local_0); --v6; } @@ -731,16 +687,14 @@ //----- (004A80DC) -------------------------------------------------------- void stru6::_4A80DC_some_stuff_sw(SpriteObject *a2) { - stru6 *v2; // esi@1 signed int v3; // ebx@1 Particle_sw local_0; // [sp+Ch] [bp-68h]@1 - v2 = this; memset(&local_0, 0, 0x68u); local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; local_0.uDiffuse = 0x7E7E7E; local_0.timeToLive = (rand() & 0x7F) + 128; - local_0.uTextureID = v2->uTextureID_effpar1; + local_0.uTextureID = uTextureID_effpar1; v3 = 8; local_0.flt_28 = 1.0; do @@ -748,9 +702,9 @@ 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; + local_0.r = pRnd->GetRandom() * 800.0 - 400.0; + local_0.g = pRnd->GetRandom() * 800.0 - 400.0; + local_0.b = pRnd->GetRandom() * 350.0 + 50.0; pGame->pParticleEngine->AddParticle(&local_0); --v3; } @@ -1048,7 +1002,7 @@ if ( result <= 2081 ) { if ( pRenderer->pRenderD3D ) - _4A77FD_some_stuff_d3d(a2); + _4A77FD_implosion_particle(a2); else _4A80DC_some_stuff_sw(a2); return false; @@ -1399,14 +1353,8 @@ //----- (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; + uAnimLength = 8 * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength; + return uAnimLength; } //----- (004A8C27) -------------------------------------------------------- @@ -1580,162 +1528,60 @@ //----- (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); + + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("zapp")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal1")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal2")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal3")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost1")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost2")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost3")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell03")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell05")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell14")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell17")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell21")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell25")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell27")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell36")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell38")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell46")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell51")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell55")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell58")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell69")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell71")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell73")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell75")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell96")); - 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); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell01")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell02")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell03")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell09")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell11")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell18")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell22")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell26")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell29")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell39")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell39c")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell41")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell57c")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell62")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell65")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell66")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell70")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell76")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell84")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell90")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell92")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell93")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97c")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97c")); }
--- a/stru6.h Thu Jul 18 09:40:05 2013 +0600 +++ b/stru6.h Thu Jul 18 09:40:14 2013 +0600 @@ -8,7 +8,7 @@ //----- (004775B1) -------------------------------------------------------- inline stru6_stru1_indoor_sw_billboard() { - field_10 = 0; + uNumVertices = 0; uNumVec4sInArray1 = 0; uNumVec3sInArray2 = 0; pArray1 = nullptr; @@ -24,16 +24,26 @@ bool sub_477F63(); int sub_47802A(); void Initialize(int a2); - void _47829F_fireball_collision(float arg0, float a3, float a4, float a5, int a2); + void _47829F_sphere_particle(float x_offset, float y_offset, float z_offset, float scale, int diffuse); + + struct local_01 + { + float x; + float y; + float z; + int diffuse; + }; unsigned int uNumVec4sInArray1; struct stru16x *pArray1; unsigned int uNumVec3sInArray2; struct stru160 *pArray2; - int field_10; - int field_14[40]; - float field_B4[40]; + int uNumVertices; + local_01 field_14[5]; + int field_64[20]; + float field_B4[20]; + local_01 field_104[5]; }; #pragma pack(pop) @@ -112,7 +122,7 @@ void _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(struct SpriteObject *a2, unsigned int uDiffuse, unsigned int uTextureID); void _4A75CC_single_spell_collision_particle(struct SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID); void _4A7688_fireball_collision_particle(struct SpriteObject *a2); - void _4A77FD_some_stuff_d3d(struct SpriteObject *a1); + void _4A77FD_implosion_particle(struct SpriteObject *a1); void _4A78AE_sparks_spell(struct SpriteObject *a1); void _4A7948_mind_blast_after_effect(struct SpriteObject *a1); bool AddMobileLight(struct SpriteObject *a1, unsigned int uDiffuse, int uRadius);