Mercurial > mm7
changeset 536:55d0794848d1
Слияние
author | Ritor1 |
---|---|
date | Sat, 02 Mar 2013 00:24:27 +0600 |
parents | 426682cf4a75 (current diff) cb0ad52d6a26 (diff) |
children | db4631a484ae |
files | Chest.cpp LayingItem.cpp LayingItem.h |
diffstat | 21 files changed, 1566 insertions(+), 1527 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/Actor.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -1,7 +1,7 @@ #include <assert.h> #include "Actor.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "Math.h" #include "Party.h" #include "Outdoor.h" @@ -469,7 +469,7 @@ float v112; // [sp+3Ch] [bp-94h]@49 int v113; // [sp+40h] [bp-90h]@41 int v114; // [sp+48h] [bp-88h]@41 - LayingItem a1; // [sp+4Ch] [bp-84h]@1 + SpriteObject a1; // [sp+4Ch] [bp-84h]@1 int v116; // [sp+BCh] [bp-14h]@49 AIDirection *v117; // [sp+C0h] [bp-10h]@1 int v118; // [sp+C4h] [bp-Ch]@29 @@ -561,7 +561,7 @@ v10 = v105; LABEL_29: spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; - a1.uItemType = stru_4E3ACC[15].field_0; + a1.uType = stru_4E3ACC[15].field_0; v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1); v11 = 0; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -642,7 +642,7 @@ return; } LABEL_159: - a1.uItemType = stru_4E3ACC[spellnum].field_0; + a1.uType = stru_4E3ACC[spellnum].field_0; v119 = 0.0; if ( (signed int)pObjectList->uNumObjects <= 0 ) { @@ -652,7 +652,7 @@ else { v66 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1.uItemType != *(short *)v66 ) + while ( (short)a1.uType != *(short *)v66 ) { ++LODWORD(v119); v66 += 56; @@ -790,7 +790,7 @@ pitch = stru_5C6E00->Atan2(v31, (signed __int64)spellnumc); } a1.stru_24.Reset(); - a1.uItemType = stru_4E3ACC[9].field_0; + a1.uType = stru_4E3ACC[9].field_0; spellnumd = 0; if ( (signed int)pObjectList->uNumObjects <= 0 ) { @@ -800,7 +800,7 @@ else { v33 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1.uItemType != *(short *)v33 ) + while ( (short)a1.uType != *(short *)v33 ) { ++spellnumd; v33 += 56; @@ -1334,7 +1334,7 @@ v70 = v108; LABEL_179: spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; - a1.uItemType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].field_0; + a1.uType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].field_0; v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1); v71 = 0; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -1482,7 +1482,7 @@ signed int v11; // ecx@19 int v12; // eax@19 int v13; // edx@28 - //LayingItem a1; // [sp+Ch] [bp-74h]@1 + //SpriteObject a1; // [sp+Ch] [bp-74h]@1 unsigned int v15; // [sp+7Ch] [bp-4h]@1 signed int v16; // [sp+88h] [bp+8h]@14 signed int v17; // [sp+88h] [bp+8h]@19 @@ -1491,47 +1491,47 @@ v4 = a2; v5 = &pActors[uActorID]; - LayingItem a1; // [sp+Ch] [bp-74h]@1 - //LayingItem::LayingItem(&a1); + SpriteObject a1; // [sp+Ch] [bp-74h]@1 + //SpriteObject::SpriteObject(&a1); result = a3 - 1; switch ( a3 ) { case 1: - a1.uItemType = 545; + a1.uType = 545; goto LABEL_14; case 2: - a1.uItemType = 550; + a1.uType = 550; goto LABEL_14; case 3: - a1.uItemType = 510; + a1.uType = 510; goto LABEL_14; case 4: - a1.uItemType = 500; + a1.uType = 500; goto LABEL_14; case 5: - a1.uItemType = 515; + a1.uType = 515; goto LABEL_14; case 6: - a1.uItemType = 505; + a1.uType = 505; goto LABEL_14; case 7: - a1.uItemType = 530; + a1.uType = 530; goto LABEL_14; case 8: - a1.uItemType = 525; + a1.uType = 525; goto LABEL_14; case 9: - a1.uItemType = 520; + a1.uType = 520; goto LABEL_14; case 10: - a1.uItemType = 535; + a1.uType = 535; goto LABEL_14; case 11: - a1.uItemType = 540; + a1.uType = 540; goto LABEL_14; case 13: - a1.uItemType = 555; + a1.uType = 555; LABEL_14: v16 = 0; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -1541,7 +1541,7 @@ default: return result; } - while ( (short)a1.uItemType != *(short *)v7 ) + while ( (short)a1.uType != *(short *)v7 ) { ++v16; v7 += 56; @@ -1636,14 +1636,14 @@ int v5; // ebx@6 int v6; // ecx@6 int v7; // eax@6 - LayingItem a1; // [sp+Ch] [bp-78h]@1 + SpriteObject a1; // [sp+Ch] [bp-78h]@1 unsigned int v10; // [sp+7Ch] [bp-8h]@1 int v11; // [sp+80h] [bp-4h]@6 v10 = uActorID; v1 = &pActors[uActorID]; v2 = 0; - a1.uItemType = 600; + a1.uType = 600; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_5: @@ -1692,7 +1692,7 @@ // // // // // // object1 & object2 format : objectType | (objectID << 3) -// // objectType == 2 - LayingItem +// // objectType == 2 - SpriteObject // // objectType == 3 - Actor // // objectType == 4 - Party // // objectType == 5 - Decoration @@ -1755,9 +1755,9 @@ if ( !v5 ) { v19 = v4; - outx = pLayingItems[v19].vPosition.x; - v13 = pLayingItems[v19].vPosition.y; - v14 = pLayingItems[v19].vPosition.z; + outx = pSpriteObjects[v19].vPosition.x; + v13 = pSpriteObjects[v19].vPosition.y; + v14 = pSpriteObjects[v19].vPosition.z; goto LABEL_26; } v7 = v5 - 1; @@ -1865,9 +1865,9 @@ if ( v21 == 2 ) { v30 = v22; - LODWORD(v45) = pLayingItems[v30].vPosition.x; - v27 = pLayingItems[v30].vPosition.y; - v28 = pLayingItems[v30].vPosition.z; + LODWORD(v45) = pSpriteObjects[v30].vPosition.x; + v27 = pSpriteObjects[v30].vPosition.y; + v28 = pSpriteObjects[v30].vPosition.z; goto LABEL_43; } if ( v21 == 3 )
--- a/AudioPlayer.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/AudioPlayer.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -5,7 +5,7 @@ #include "Allocator.h" #include "FrameTableInc.h" #include "Indoor.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "Party.h" #include "Actor.h" #include "Game.h" @@ -635,7 +635,7 @@ signed int v14; // eax@20 int v15; // eax@24 signed int v16; // eax@25 - LayingItem *pLayingItem; // eax@28 + SpriteObject *pLayingItem; // eax@28 signed int v18; // eax@29 Actor *pActor1; // eax@32 signed int v20; // ecx@32 @@ -662,7 +662,7 @@ char *v41; // edi@82 int v42; // esi@82 double v43; // st7@91 - LayingItem *pLayingItem2; // eax@92 + SpriteObject *pLayingItem2; // eax@92 Actor *pActor; // eax@93 signed int v46; // ecx@93 double v47; // st7@93 @@ -675,7 +675,7 @@ float v54; // ST04_4@106 //AudioPlayer *pAudioPlayer3; // edx@106 SoundDesc *pSoundDesc; // edx@107 - LayingItem *pLayingItem3; // eax@114 + SpriteObject *pLayingItem3; // eax@114 //int v58; // edx@115 //int v59; // ecx@115 //Actor *pActor2; // eax@118 @@ -695,7 +695,7 @@ //unsigned int pVolume; // eax@157 //int pPartyX; // ebx@159 //int v76; // ebx@160 - //LayingItem *pLayingItem4; // edi@164 + //SpriteObject *pLayingItem4; // edi@164 //unsigned int pPosY; // edx@166 //unsigned int pPosX; // ecx@166 //int v80; // eax@167 @@ -829,8 +829,8 @@ start_channel = 5; end_channel = 7; - assert(object_id < uNumLayingItems); - auto object = &pLayingItems[object_id]; + assert(object_id < uNumSpriteObjects); + auto object = &pSpriteObjects[object_id]; sample_volume = GetSoundStrengthByDistanceFromParty(object->vPosition.x, object->vPosition.y, object->vPosition.z); if (!sample_volume) @@ -1008,8 +1008,8 @@ } else if (object_type == OBJECT_Item) { - assert(object_id < uNumLayingItems); - auto object = &pLayingItems[object_id]; + assert(object_id < uNumSpriteObjects); + auto object = &pSpriteObjects[object_id]; if (!GetSoundStrengthByDistanceFromParty(object->vPosition.x, object->vPosition.y, object->vPosition.z) ) return; AIL_set_sample_pan(channel->hSample, sub_4AB66C(object->vPosition.x, object->vPosition.y)); @@ -1087,7 +1087,7 @@ v96 = 7; v12 = 5; } - pLayingItem = &pLayingItems[a3 >> 3]; + pLayingItem = &pSpriteObjects[a3 >> 3]; } else { @@ -1160,7 +1160,7 @@ v12 = 4; v96 = 4; } - pLayingItem = (LayingItem *)&pLevelDecorations[a3 >> 3]; + pLayingItem = (SpriteObject *)&pLevelDecorations[a3 >> 3]; } pRenderVertexSoft.vWorldPosition.x = (double)pLayingItem->vPosition.x; pRenderVertexSoft.vWorldPosition.y = (double)pLayingItem->vPosition.y; @@ -1334,7 +1334,7 @@ } if ( (a3 & 7) == 2 ) { - pLayingItem2 = &pLayingItems[a3 >> 3]; + pLayingItem2 = &pSpriteObjects[a3 >> 3]; } else { @@ -1357,7 +1357,7 @@ v47 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_101; } - pLayingItem2 = (LayingItem *)&pLevelDecorations[a3 >> 3]; + pLayingItem2 = (SpriteObject *)&pLevelDecorations[a3 >> 3]; } pRenderVertexSoft.vWorldPosition.x = (double)pLayingItem2->vPosition.x; pRenderVertexSoft.vWorldPosition.y = (double)pLayingItem2->vPosition.y; @@ -1393,7 +1393,7 @@ int v9; // ebx@10 int v10; // ebx@11 double v11; // st7@13 - LayingItem *v12; // eax@14 + SpriteObject *v12; // eax@14 Actor *v13; // eax@15 signed int v14; // edx@15 BLVDoor *v15; // eax@19 @@ -1413,12 +1413,12 @@ //unsigned __int8 v29; // of@43 //MixerChannel *v30; // esi@44 //int v31; // eax@45 - //LayingItem *v32; // eax@49 + //SpriteObject *v32; // eax@49 //Actor *v33; // edi@50 //int v34; // eax@50 //unsigned int v35; // edx@51 //unsigned int v36; // ecx@51 - //LayingItem *v37; // edi@53 + //SpriteObject *v37; // edi@53 int v38; // eax@53 //BLVDoor *v39; // edi@56 //int v40; // eax@57 @@ -1527,11 +1527,11 @@ v11 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_21; } - v12 = (LayingItem *)&pLevelDecorations[v6->field_4 >> 3]; + v12 = (SpriteObject *)&pLevelDecorations[v6->field_4 >> 3]; } else { - v12 = &pLayingItems[v6->field_4 >> 3]; + v12 = &pSpriteObjects[v6->field_4 >> 3]; } a1.vWorldPosition.x = (double)v12->vPosition.x; a1.vWorldPosition.y = (double)v12->vPosition.y; @@ -1662,8 +1662,8 @@ case OBJECT_Item: { - assert(source_id < uNumLayingItems); - auto object = &pLayingItems[source_id]; + assert(source_id < uNumSpriteObjects); + auto object = &pSpriteObjects[source_id]; source_x = object->vPosition.x; source_y = object->vPosition.y; @@ -1674,7 +1674,7 @@ case OBJECT_Decoration: { assert(source_id < uNumLevelDecorations); - auto object = (LayingItem *)&pLevelDecorations[source_id]; + auto object = (SpriteObject *)&pLevelDecorations[source_id]; source_x = object->vPosition.x; source_y = object->vPosition.y;
--- a/Chest.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/Chest.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -61,7 +61,7 @@ signed int v25; // ecx@28 char *v26; // edx@29 unsigned __int16 v27; // ax@32 - //LayingItem a1; // [sp+14h] [bp-B0h]@28 + //SpriteObject a1; // [sp+14h] [bp-B0h]@28 int v29; // [sp+84h] [bp-40h]@16 int v30; // [sp+88h] [bp-3Ch]@16 int v31; // [sp+8Ch] [bp-38h]@16 @@ -169,8 +169,8 @@ v23 = (unsigned int *)(&v29 + v35); sub_42F7EB_DropItemAt(*v23, pOut.x, pOut.z, pOut.y, 0, 1, 0, 0x30u, 0); - LayingItem a1; // [sp+14h] [bp-B0h]@28 - //LayingItem::LayingItem(&a1); + SpriteObject a1; // [sp+14h] [bp-B0h]@28 + //SpriteObject::SpriteObject(&a1); a1.stru_24.Reset(); v24 = *(short *)v23; @@ -179,7 +179,7 @@ a1.field_4C = 0; a1.field_48 = 0; a1.field_54 = 0; - a1.uItemType = v24; + a1.uType = v24; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_32:
--- a/Indoor.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/Indoor.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -2,7 +2,7 @@ #include "Outdoor.h" #include "Render.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "Events.h" #include "Game.h" #include "Viewport.h" @@ -1892,7 +1892,7 @@ int v72; // eax@38 unsigned __int16 v73; // ax@42 char *v74; // ecx@42 - LayingItem *v75; // ecx@44 + SpriteObject *v75; // ecx@44 size_t v76; // eax@45 int j; // edx@46 unsigned __int16 v78; // ax@50 @@ -2362,13 +2362,13 @@ while ( Argsi < (signed int)uNumLevelDecorations ); } fseek(v7, v219, 0); - fread(&uNumLayingItems, 4u, 1u, v7); + fread(&uNumSpriteObjects, 4u, 1u, v7); fseek(v7, v220, 0); - fread(pLayingItems, 0x70u, uNumLayingItems, v7); - if ( (signed int)uNumLayingItems > 0 ) + fread(pSpriteObjects, 0x70u, uNumSpriteObjects, v7); + if ( (signed int)uNumSpriteObjects > 0 ) { - v75 = pLayingItems; - pDest = (char *)uNumLayingItems; + v75 = pSpriteObjects; + pDest = (char *)uNumSpriteObjects; do { Argsj = 0; @@ -2517,7 +2517,7 @@ assert(sizeof(SpawnPointMM7) == 24); assert(sizeof(DDM_DLV_Header) == 40); assert(sizeof(Actor) == 836); - assert(sizeof(LayingItem) == 112); + assert(sizeof(SpriteObject) == 112); assert(sizeof(Chest) == 5324); assert(sizeof(stru123) == 0xC8); assert(sizeof(BLVMapOutline) == 12); @@ -2972,23 +2972,23 @@ pGameLoadingUI_ProgressBar->Progress(); pGameLoadingUI_ProgressBar->Progress(); - memcpy(&uNumLayingItems, pData, 4); - memcpy(pLayingItems, pData + 4, uNumLayingItems * sizeof(LayingItem)); - pData += 4 + uNumLayingItems * sizeof(LayingItem); + memcpy(&uNumSpriteObjects, pData, 4); + memcpy(pSpriteObjects, pData + 4, uNumSpriteObjects * sizeof(SpriteObject)); + pData += 4 + uNumSpriteObjects * sizeof(SpriteObject); pGameLoadingUI_ProgressBar->Progress(); - for (uint i = 0; i < uNumLayingItems; ++i) + for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto pItem = pLayingItems + i; + auto pItem = pSpriteObjects + i; if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100)) { - pItem->uItemType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID; + pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID; uint uObjectID = 0; for (uint j = 0; j < pObjectList->uNumObjects; ++j) - if (pItem->uItemType == pObjectList->pObjects[j].uObjectID) + if (pItem->uType == pObjectList->pObjects[j].uObjectID) { pItem->uObjectDescID = j; break; @@ -4138,7 +4138,7 @@ _46E44E_collide_against_faces_and_portals(1u); _46E0B2_collide_against_decorations(); _46EF01_collision_chech_player(0); - _46ED8A_collide_against_layingItems(_this); + _46ED8A_collide_against_sprite_objects(_this); v25 = 0; v56 = 0; if ( ai_arrays_size > v22 ) @@ -4487,7 +4487,7 @@ if ( !(dword_6BE364_game_settings_1 & 0x2000) ) { InitializeActors(); - InitializeLayingItems(); + InitializeSpriteObjects(); } BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; if ( !v39 ) @@ -4658,9 +4658,9 @@ pGameLoadingUI_ProgressBar->Progress(); - for (uint i = 0; i < uNumLayingItems; ++i) + for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto p = pLayingItems + i; + auto p = pSpriteObjects + i; if (p->uObjectDescID) { auto uItemID = p->stru_24.uItemID;
--- a/LayingItem.cpp Sat Mar 02 00:24:12 2013 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -#include "LayingItem.h" -#include "Party.h" -#include "TurnEngine.h" -#include "MapInfo.h" - -#include "mm7_data.h" - - - - -size_t uNumLayingItems; -LayingItem pLayingItems[1000]; - - -//----- (00438E35) -------------------------------------------------------- -void LayingItem::_438E35() -{ - LayingItem *v1; // edi@1 - MapInfo *pMapInfo; // esi@1 - int v3; // ebx@1 - int v4; // eax@1 - int v5; // ebx@1 - unsigned int v6; // ecx@1 - int v7; // edx@2 - unsigned int v8; // edx@4 - unsigned int v9; // edx@6 - unsigned int v10; // eax@7 - signed int v11; // ebx@8 - Player **v12; // esi@18 - signed int v13; // edi@20 - int v15; // [sp+Ch] [bp-Ch]@1 - int v16; // [sp+10h] [bp-8h]@1 - signed int v17; // [sp+14h] [bp-4h]@8 - int v18; // [sp+14h] [bp-4h]@14 - - v1 = this; - pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]; - v3 = abs(pParty->vPosition.x - v1->vPosition.x); - v15 = abs(pParty->vPosition.y - v1->vPosition.y); - v16 = abs(pParty->vPosition.z + pParty->sEyelevel - v1->vPosition.z); - v4 = v3; - v5 = v15; - v6 = v16; - if ( v4 < v15 ) - { - v7 = v4; - v4 = v15; - v5 = v7; - } - if ( v4 < v16 ) - { - v8 = v4; - v4 = v16; - v6 = v8; - } - if ( v5 < (signed int)v6 ) - { - v9 = v6; - v6 = v5; - v5 = v9; - } - v10 = ((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4; - if ( (signed int)v10 <= 768 ) - { - v17 = 0; - v11 = 5; - if ( pMapInfo->Trap_D20 ) - { - do - { - ++v17; - v11 += rand() % 20 + 1; - } - while ( v17 < pMapInfo->Trap_D20 ); - } - switch ( v1->uItemType ) - { - case 0x32Bu: - v18 = 0; - break; - case 0x32Cu: - v18 = 1; - break; - case 0x32Du: - v18 = 2; - break; - default: - //LOWORD(v10) = v1->uItemType - 814; - if ( v1->uItemType != 814 ) - return; - v18 = 8; - break; - } - v12 = &pPlayers[1]; - do - { - if ( (*v12)->CanAct() && (v13 = (*v12)->GetPerception() + 20, rand() % v13 > 20) ) - (*v12)->PlaySound(SPEECH_6, 0); - else - (*v12)->ReceiveDamage(v11, v18); - ++v12; - } - while ( (signed int)v12 <= (signed int)&pPlayers[4] ); - } -} - - - -//----- (0042F933) -------------------------------------------------------- -void LayingItem::OnItemPickup(unsigned int uLayingItemID) -{ - unsigned int v1; // ecx@1 - unsigned __int16 *pAttributes; // ecx@2 - unsigned __int16 v3; // ax@2 - - //__debugbreak(); // find out what's going on - - v1 = uLayingItemID; - pLayingItems[v1].uObjectDescID = 0; - if ( pParty->bTurnBasedModeOn == 1 ) - { - pAttributes = &pLayingItems[v1].uAttributes; - v3 = *pAttributes; - if ( *pAttributes & 4 ) - { - v3 = v3 & 0xFB; - --pTurnEngine->field_1C; - *pAttributes = v3; - } - } -}
--- a/LayingItem.h Sat Mar 02 00:24:12 2013 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -#pragma once -#include "VectorTypes.h" -#include "Items.h" - -enum -{ - OBJECT_ATTACHED_TO_ACTOR = 0x80, -}; - - -/* 72 */ -#pragma pack(push, 1) -struct LayingItem -{ - inline bool AttachedToActor() const {return uAttributes & OBJECT_ATTACHED_TO_ACTOR;} - - LayingItem(); - int Create(int yaw, int pitch, int a4, int a5); - void _46BEF1_apply_spells(); - void _438E35(); - - static void UpdateObject_fn0_BLV(unsigned int uLayingItemID); - static void UpdateObject_fn0_ODM(unsigned int uLayingItemID); - static void OnItemPickup(unsigned int uLayingItemID); - - - unsigned __int16 uItemType; - unsigned __int16 uObjectDescID; - struct Vec3_int_ vPosition; - struct Vec3_short_ vVelocity; - unsigned __int16 uFacing; - unsigned __int16 uSoundID; - unsigned __int16 uAttributes; - __int16 uSectorID; - unsigned __int16 uSpriteFrameID; - __int16 field_20; - __int16 field_22_glow_radius_multiplier; - struct ItemGen stru_24; - int field_48; - int field_4C; - int field_50; - int field_54; - int field_58_pid; - int field_5C; - char field_60_distance_related_prolly_lod; - char field_61; - char field_62[14]; -}; -#pragma pack(pop) - - - -extern size_t uNumLayingItems; -extern LayingItem pLayingItems[1000]; \ No newline at end of file
--- a/Outdoor.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/Outdoor.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -2,7 +2,7 @@ #include "Outdoor.h" #include "Party.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "LOD.h" #include "Render.h" #include "MapInfo.h" @@ -135,7 +135,7 @@ if (!pOutdoorCamera->bDoNotRenderDecorations) pRenderer->PrepareDecorationsRenderList_ODM(); - pRenderer->DrawLayingItems_Shooting_Magic_ODM(); + pRenderer->DrawSpriteObjects_ODM(); pRenderer->TransformBillboardsAndSetPalettesODM(); sub_485F53((Vec2_int_ *)unnamed_6BE060); } @@ -1209,7 +1209,7 @@ __int16 v20; // ax@16 int v21; // ecx@16 ODMFace *v22; // ebx@26 - LayingItem *pItems; // ecx@27 + SpriteObject *pItems; // ecx@27 unsigned int v24; // eax@28 //unsigned __int8 v25; // zf@28 //unsigned __int8 v26; // sf@28 @@ -1391,7 +1391,7 @@ fseek((FILE *)v7, v114, 0); fread(&uNumBModels, 4u, 1u, (FILE *)v7); fseek((FILE *)v7, v115, 0); - fread(&uNumLayingItems, 4u, 1u, (FILE *)v7); + fread(&uNumSpriteObjects, 4u, 1u, (FILE *)v7); fseek((FILE *)v7, v116, 0); fread(&uNumLevelDecorations, 4u, 1u, (FILE *)v7); fseek((FILE *)v7, v117, 0); @@ -1518,11 +1518,11 @@ LABEL_26: v22 = File; fseek((FILE *)File, v124, 0); - fread(pLayingItems, 0x70u, uNumLayingItems, (FILE *)v22); - if ( (signed int)uNumLayingItems > 0 ) + fread(pSpriteObjects, 0x70u, uNumSpriteObjects, (FILE *)v22); + if ( (signed int)uNumSpriteObjects > 0 ) { - pItems = pLayingItems; - pNumItems = uNumLayingItems; + pItems = pSpriteObjects; + pNumItems = uNumSpriteObjects; do { v24 = pItems->stru_24.uItemID; @@ -2222,15 +2222,15 @@ //v92 = (char *)v91 + (int)pFilename; pGameLoadingUI_ProgressBar->Progress(); - memcpy(&uNumLayingItems, pSrc, 4); - assert(uNumLayingItems <= 1000 && "Too many objects"); - assert(sizeof(LayingItem) == 112); + memcpy(&uNumSpriteObjects, pSrc, 4); + assert(uNumSpriteObjects <= 1000 && "Too many objects"); + assert(sizeof(SpriteObject) == 112); pGameLoadingUI_ProgressBar->Progress(); - //pFilename = (char *)(112 * uNumLayingItems); - memcpy(pLayingItems, pSrc + 4, uNumLayingItems * sizeof(LayingItem)); - pSrc += 4 + uNumLayingItems * sizeof(LayingItem); + //pFilename = (char *)(112 * uNumSpriteObjects); + memcpy(pSpriteObjects, pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject)); + pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject); //v94 = (char *)v93 + (int)pFilename; pGameLoadingUI_ProgressBar->Progress(); @@ -2730,9 +2730,9 @@ v5 = this; v1 = 0; - if ( (signed int)uNumLayingItems > 0 ) + if ( (signed int)uNumSpriteObjects > 0 ) { - v2 = (char *)&pLayingItems[0].uObjectDescID; + v2 = (char *)&pSpriteObjects[0].uObjectDescID; do { if ( *(short *)v2 ) @@ -2750,7 +2750,7 @@ ++v1; v2 += 112; } - while ( v1 < (signed int)uNumLayingItems ); + while ( v1 < (signed int)uNumSpriteObjects ); } pGameLoadingUI_ProgressBar->Progress(); return 1;
--- a/Render.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/Render.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -14,7 +14,7 @@ #include "LightmapBuilder.h" #include "stru220.h" #include "ObjectList.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "DecorationList.h" #include "Allocator.h" #include "OSInfo.h" @@ -3050,7 +3050,7 @@ //----- (0047AF11) -------------------------------------------------------- -void Render::DrawLayingItems_Shooting_Magic_ODM() +void Render::DrawSpriteObjects_ODM() { //char *v0; // edi@2 //ObjectDesc *v1; // ebx@4 @@ -3101,11 +3101,11 @@ signed __int16 v46; // [sp+3Ch] [bp-4h]@12 //v41 = 0; - for (int i = 0; i < uNumLayingItems; ++i) - { - auto object = pLayingItems + i; - //auto v0 = (char *)&pLayingItems[i].uSectorID; - //v0 = (char *)&pLayingItems[0].uSectorID; + for (int i = 0; i < uNumSpriteObjects; ++i) + { + auto object = pSpriteObjects + i; + //auto v0 = (char *)&pSpriteObjects[i].uSectorID; + //v0 = (char *)&pSpriteObjects[0].uSectorID; //do //{ if (!object->uObjectDescID) // item probably pciked up @@ -3120,7 +3120,7 @@ //if ( !(v1->uFlags & 1) ) //{ //v2 = *((short *)v0 - 14) - v2 = object->uItemType; + v2 = object->uType; if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) ) { //a5 = *(short *)v0; @@ -3249,7 +3249,7 @@ //++v41; //v0 += 112; //} - //while ( v41 < (signed int)uNumLayingItems ); + //while ( v41 < (signed int)uNumSpriteObjects ); } } // 4E94D3: using guessed type char byte_4E94D3;
--- a/Render.h Sat Mar 02 00:24:12 2013 +0600 +++ b/Render.h Sat Mar 02 00:24:27 2013 +0600 @@ -362,7 +362,7 @@ void DrawSkyD3D(); int DrawSkySW(struct Span *a1, stru148 *a2, int a3); void PrepareDecorationsRenderList_ODM(); - void DrawLayingItems_Shooting_Magic_ODM(); + void DrawSpriteObjects_ODM(); void TransformBillboardsAndSetPalettesODM(); float DrawBezierTerrain(); void RenderTerrainD3D();
--- a/SaveLoad.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/SaveLoad.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -14,7 +14,7 @@ #include "GUIWindow.h" #include "GUIFont.h" #include "Overlays.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "Viewport.h" #include "stru123.h" #include "texts.h" @@ -467,10 +467,10 @@ v12 = (char *)v11 + 4; memcpy(v12, pActors, 836 * uNumActors); v13 = (char *)v12 + 836 * uNumActors; - memcpy(v13, &uNumLayingItems, 4); + memcpy(v13, &uNumSpriteObjects, 4); v13 = (char *)v13 + 4; - memcpy(v13, pLayingItems, 112 * uNumLayingItems); - v14 = (char *)v13 + 112 * uNumLayingItems; + memcpy(v13, pSpriteObjects, 112 * uNumSpriteObjects); + v14 = (char *)v13 + 112 * uNumSpriteObjects; memcpy(v14, &uNumChests, 4); v14 = (char *)v14 + 4; memcpy(v14, pChests, 5324 * uNumChests); @@ -546,10 +546,10 @@ v28 = (char *)v22 + 4; memcpy(v28, pActors, 836 * uNumActors); v29 = (char *)v28 + 836 * uNumActors; - memcpy(v29, &uNumLayingItems, 4); + memcpy(v29, &uNumSpriteObjects, 4); v29 = (char *)v29 + 4; - memcpy(v29, pLayingItems, 112 * uNumLayingItems); - v30 = (char *)v29 + 112 * uNumLayingItems; + memcpy(v29, pSpriteObjects, 112 * uNumSpriteObjects); + v30 = (char *)v29 + 112 * uNumSpriteObjects; memcpy(v30, &uNumChests, 4); v30 = (char *)v30 + 4; memcpy(v30, pChests, 5324 * uNumChests);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SpriteObject.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -0,0 +1,1085 @@ +#include <assert.h> + +#include "SpriteObject.h" +#include "Party.h" +#include "TurnEngine.h" +#include "MapInfo.h" +#include "Math.h" +#include "ObjectList.h" +#include "Indoor.h" +#include "Outdoor.h" +#include "ParticleEngine.h" +#include "Time.h" +#include "Game.h" +#include "LOD.h" +#include "Actor.h" +#include "Events.h" + +#include "mm7_data.h" + + + + +size_t uNumSpriteObjects; +SpriteObject pSpriteObjects[1000]; + + + + +//----- (0042F5ED) -------------------------------------------------------- +int SpriteObject::Create(int yaw, int pitch, int a4, int a5) +{ + //SpriteObject *v5; // eax@1 + signed int v6; // ebx@2 + //char *v7; // ecx@2 + //signed int result; // eax@6 + SpriteObject *v9; // ebx@7 + int v10; // edx@11 + int v11; // edi@18 + __int16 v12; // ax@18 + int v13; // ST2C_4@20 + int v14; // eax@20 + int v15; // [sp-28h] [bp-38h]@14 + int v16; // [sp-24h] [bp-34h]@11 + Vec3_int_ v17; // [sp-20h] [bp-30h]@11 + int *v18; // [sp-14h] [bp-24h]@11 + int *v19; // [sp-10h] [bp-20h]@11 + int *v20; // [sp-Ch] [bp-1Ch]@11 + //signed int v21; // [sp+8h] [bp-8h]@2 + int angle; // [sp+Ch] [bp-4h]@1 + int a4a; // [sp+1Ch] [bp+Ch]@20 + int a4b; // [sp+1Ch] [bp+Ch]@20 + int a5a; // [sp+20h] [bp+10h]@20 + + //auto a1 = this; + angle = yaw; + //v5 = a1; + if (!uObjectDescID) + return -1; + + v6 = 1000; + //v7 = (char *)&pSpriteObjects[0].uObjectDescID; + /*v21 = 0; + do + { + if ( !*(short *)v7 ) + break; + v7 += 112; + ++v6; + v21 = v6; + } + while ( (signed int)v7 < (signed int)((char *)&pObjectList->uNumObjects + 2) );*/ + for (uint i = 0; i < 1000; ++i) + if (!pSpriteObjects[i].uObjectDescID) + { + v6 = i; + break; + } + + if ( v6 >= 1000 ) + return -1; + field_64.x = vPosition.x; + field_64.y = vPosition.y; + v9 = &pSpriteObjects[v6]; + field_64.z = vPosition.z; + + assert(sizeof(SpriteObject) == 0x70); + memcpy(v9, this, sizeof(*this)); + if ( a5 == 1 ) + { + v20 = &v9->vPosition.z; + v19 = &v9->vPosition.y; + v18 = (int *)&v9->vPosition; + v17.x = vPosition.x; + v17.y = vPosition.y; + v17.z = vPosition.z; + v16 = 0; + v10 = stru_5C6E00->uIntegerHalfPi + v9->uFacing; + goto LABEL_16; + } + if ( a5 == 2 ) + { + v20 = &v9->vPosition.z; + v19 = &v9->vPosition.y; + v18 = (int *)&v9->vPosition; + v17.x = vPosition.x; + v17.y = vPosition.y; + v17.z = vPosition.z; + v16 = 0; + v10 = stru_5C6E00->uIntegerHalfPi + v9->uFacing; + goto LABEL_14; + } + if ( a5 == 3 ) + { + v20 = &v9->vPosition.z; + v19 = &v9->vPosition.y; + v18 = (int *)&v9->vPosition; + v17.x = vPosition.x; + v17.y = vPosition.y; + v17.z = vPosition.z; + v16 = 0; + v10 = v9->uFacing - stru_5C6E00->uIntegerHalfPi; +LABEL_14: + v15 = 8; +LABEL_17: + Vec3_int_::Rotate(v15, v10, v16, v17, v18, v19, v20); + goto LABEL_18; + } + if ( a5 == 4 ) + { + v20 = &v9->vPosition.z; + v19 = &v9->vPosition.y; + v18 = (int *)&v9->vPosition; + v17.x = vPosition.x; + v17.y = vPosition.y; + v17.z = vPosition.z; + v16 = 0; + v10 = v9->uFacing - stru_5C6E00->uIntegerHalfPi; +LABEL_16: + v15 = 24; + goto LABEL_17; + } +LABEL_18: + v11 = a4; + v12 = 0; + if ( a4 ) + { + a4a = stru_5C6E00->Cos(angle); + v13 = (unsigned __int64)(a4a * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; + a4b = stru_5C6E00->Sin(angle); + a5a = (unsigned __int64)(a4b * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; + v14 = stru_5C6E00->Sin(pitch); + v9->vVelocity.x = (unsigned int)(v13 * v11) >> 16; + v9->vVelocity.y = (unsigned int)(a5a * v11) >> 16; + v12 = (unsigned int)(v14 * v11) >> 16; + } + else + { + v9->vVelocity.y = 0; + v9->vVelocity.x = 0; + } + v9->vVelocity.z = v12; + + if ( v6 >= (signed int)uNumSpriteObjects ) + uNumSpriteObjects = v6 + 1; + return v6; +} + + + +//----- (00471C03) -------------------------------------------------------- +void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID) +{ + SpriteObject *v1; // esi@1 + ObjectDesc *v2; // ebx@1 + signed int v3; // edx@1 + int v4; // ecx@1 + int v5; // ST04_4@1 + int v6; // eax@1 + int v7; // ecx@1 + int v8; // edi@1 + int v9; // eax@4 + __int16 v10; // ax@7 + int v11; // edx@11 + int v12; // ecx@11 + signed int v13; // edx@14 + signed int v14; // edx@16 + int v15; // eax@24 + int v16; // eax@25 + int v17; // ST10_4@25 + signed int v18; // eax@25 + signed int v19; // eax@28 + Actor *v20; // edi@31 + int v21; // eax@41 + int v22; // ecx@43 + __int16 v23; // bx@45 + char v24; // al@46 + signed int i; // edi@50 + int v26; // edi@52 + int v27; // eax@52 + __int16 v28; // cx@55 + int v29; // eax@55 + signed int v30; // edi@59 + BSPModel *v31; // ecx@61 + ODMFace *v32; // edi@61 + int v33; // eax@62 + int v34; // ecx@62 + int v35; // eax@63 + Actor *v36; // ecx@67 + __int16 v37; // ax@67 + int v38; // eax@72 + int v39; // eax@72 + unsigned __int64 v40; // qax@72 + int v41; // eax@72 + unsigned __int8 v42; // sf@74 + unsigned __int8 v43; // of@74 + int v44; // eax@77 + __int16 v45; // bx@81 + int v46; // eax@85 + const char *v47; // [sp-8h] [bp-B0h]@83 + enum TEXTURE_TYPE v48; // [sp-4h] [bp-ACh]@46 + int v49; // [sp+Ch] [bp-9Ch]@52 + int v50; // [sp+10h] [bp-98h]@52 + Vec3_int_ v51; // [sp+14h] [bp-94h]@11 + Particle_ Dst; // [sp+20h] [bp-88h]@45 + unsigned int uLayingItemID_; // [sp+88h] [bp-20h]@1 + int v54; // [sp+8Ch] [bp-1Ch]@1 + int v55; // [sp+90h] [bp-18h]@1 + int v56; // [sp+94h] [bp-14h]@11 + int v57; // [sp+98h] [bp-10h]@1 + int v58; // [sp+9Ch] [bp-Ch]@1 + int v59; // [sp+A0h] [bp-8h]@1 + Actor *v60; // [sp+A4h] [bp-4h]@11 + + uLayingItemID_ = uLayingItemID; + v1 = &pSpriteObjects[uLayingItemID]; + v58 = 0; + v2 = &pObjectList->pObjects[v1->uObjectDescID]; + v57 = IsTerrainSlopeTooHigh(v1->vPosition.x, v1->vPosition.y); + v3 = v1->vPosition.y; + v4 = v1->vPosition.x; + v5 = v2->uHeight; + v55 = 0; + v6 = sub_46D49E_prolly_get_world_y_under_party(v4, v3, v1->vPosition.z, v5, &v59, &v55, 0); + v7 = v6; + v54 = v6; + v8 = v6 + 1; + if ( v1->vPosition.z <= v6 + 1 ) + { + if ( v59 ) + { + v9 = v6 + 60; + if ( v55 ) + v9 = v7 + 30; + sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v9); + SpriteObject::OnInteraction(uLayingItemID_); + v7 = v54; + } + } + else + { + v58 = 1; + } + v10 = v2->uFlags; + if ( !(v10 & 0x20) ) + { + if ( v58 ) + { + v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); + goto LABEL_13; + } + if ( v57 ) + { + v11 = v1->vPosition.y; + v12 = v1->vPosition.x; + v1->vPosition.z = v8; + ODM_GetTerrainNormalAt(v12, v11, &v51); + v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); + v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16; + v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16); + v1->vVelocity.x += (unsigned int)(v56 * v51.x) >> 16; + v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16); + v1->vVelocity.y += (unsigned int)(v56 * v51.y) >> 16; + v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16); + v1->vVelocity.z += (unsigned int)(v56 * v51.z) >> 16; +LABEL_12: + v7 = v54; + goto LABEL_13; + } + if ( v10 & 0x40 ) + { + if ( v1->vPosition.z < v7 ) + v1->vPosition.z = v8; + if ( !_46BFFA_check_object_intercept(uLayingItemID_, 0) ) + return; + } + v1->vPosition.z = v8; + if ( !(v2->uFlags & 0x80) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) ) + v1->vVelocity.z = 0; + v60 = (Actor *)v1->vVelocity.x; + v55 = 58500; + v60 = (Actor *)((unsigned __int64)(58500i64 * (signed int)v60) >> 16); + v1->vVelocity.x = (signed __int16)v60; + v60 = (Actor *)v1->vVelocity.y; + v60 = (Actor *)((unsigned __int64)(v55 * (signed __int64)(signed int)v60) >> 16); + v55 = 58500; + v1->vVelocity.y = (signed __int16)v60; + v60 = (Actor *)v1->vVelocity.z; + v60 = (Actor *)((unsigned __int64)(v55 * (signed __int64)(signed int)v60) >> 16); + v22 = v1->vVelocity.x; + v1->vVelocity.z = (signed __int16)v60; + if ( v1->vVelocity.y * v1->vVelocity.y + v22 * v22 >= 400 ) + goto LABEL_12; + v1->vVelocity.y = 0; + v1->vVelocity.x = 0; + if ( !(HIBYTE(v2->uFlags) & 1) ) + return; + memset(&Dst, 0, 0x68u); + v23 = v2->uFlags; + 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; + if ( HIBYTE(v23) & 2 ) + { + Dst.bFree = 1036; + Dst.uDiffuse = 16727070; + v24 = rand(); + v48 = (TEXTURE_TYPE)0; +LABEL_83: + v47 = "effpar01"; + } + else + { + if ( HIBYTE(v23) & 4 ) + { + Dst.bFree = 512; + Dst.uDiffuse = rand(); + Dst.timeToLive = 64; + Dst.uTextureID = 0; +LABEL_89: + Dst.flt_28 = 1.0; + pGame->pParticleEngine->AddParticle(&Dst); + return; + } + Dst.bFree = 1032; + Dst.uDiffuse = rand(); + v24 = rand(); + v48 = (TEXTURE_TYPE)0; +LABEL_87: + v47 = "effpar03"; + } + Dst.timeToLive = (unsigned __int8)(v24 & 0x80) + 128; + Dst.uTextureID = pBitmaps_LOD->LoadTexture(v47, v48); + goto LABEL_89; + } +LABEL_13: + if ( v1->vPosition.z > v7 + && (v13 = v1->vPosition.x, v13 >= -32768) + && v13 <= 32768 + && (v14 = v1->vPosition.y, v14 >= -32768) + && v14 <= 32768 + && v1->vPosition.z <= 13000 + || !(v2->uFlags & 0x40) ) + goto LABEL_92; + if ( v1->vPosition.z < v7 ) + v1->vPosition.z = v8; + if ( _46BFFA_check_object_intercept(uLayingItemID_, 0) ) + { +LABEL_92: + stru_721530.field_0 = 0; + v55 = 0; + stru_721530.prolly_normal_d = v2->uRadius; + stru_721530.field_C = v2->uHeight; + stru_721530.field_8 = 0; + stru_721530.field_70 = 0; + while ( 1 ) + { + stru_721530.field_34.x = v1->vPosition.x; + stru_721530.normal.x = stru_721530.field_34.x; + v15 = v1->vPosition.y; + stru_721530.uSectorID = 0; + stru_721530.field_34.y = v15; + stru_721530.normal.y = v15; + stru_721530.field_34.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1; + stru_721530.normal.z = stru_721530.field_34.z; + stru_721530.field_1C = v1->vVelocity.x; + stru_721530.field_20 = v1->vVelocity.y; + stru_721530.field_24 = v1->vVelocity.z; + if ( stru_721530._47050A(0) ) + return; + _46E889_collide_against_bmodels(0); + v16 = WorldPosToGridCellZ(v1->vPosition.y); + v17 = v1->vPosition.x; + v58 = v16; + v18 = WorldPosToGridCellX(v17); + _46E26D_collide_against_sprites(v18, v58); + if ( (v1->field_58_pid & 7) != OBJECT_Player) + _46EF01_collision_chech_player(0); + if ( (v1->field_58_pid & 7) == OBJECT_Actor) + { + v19 = v1->field_58_pid >> 3; + if ( v19 >= 0 ) + { + if ( v19 < (signed int)(uNumActors - 1) ) + { + v56 = 0; + if ( (signed int)uNumActors > 0 ) + { + v60 = pActors; + v20 = &pActors[v19]; + do + { + if ( v20->GetActorsRelation(v60) ) + _46DF1A_collide_against_actor(v56, 0); + ++v56; + ++v60; + } + while ( v56 < (signed int)uNumActors ); + } + } + } + } + else + { + for ( i = 0; i < (signed int)uNumActors; ++i ) + _46DF1A_collide_against_actor(i, 0); + } + v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; + v27 = sub_46D49E_prolly_get_world_y_under_party( + stru_721530.normal2.x, + stru_721530.normal2.y, + stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, + v2->uHeight, + &v49, + &v50, + 0); + if ( v59 && v26 < v27 + 60 ) + { + if ( v50 ) + v44 = v27 + 30; + else + v44 = v54 + 60; + sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v44); + SpriteObject::OnInteraction(uLayingItemID_); + return; + } + if ( stru_721530.field_7C >= stru_721530.field_6C ) + { + v1->vPosition.x = stru_721530.normal2.x; + v1->vPosition.y = stru_721530.normal2.y; + v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; + v1->uSectorID = LOWORD(stru_721530.uSectorID); + if ( !(HIBYTE(v2->uFlags) & 1) ) + return; + memset(&Dst, 0, 0x68u); + v45 = v2->uFlags; + 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; + if ( HIBYTE(v45) & 2 ) + { + Dst.bFree = 1036; + Dst.uDiffuse = 16727070; + v24 = rand(); + v48 = (TEXTURE_TYPE)0; + goto LABEL_83; + } + if ( HIBYTE(v45) & 4 ) + { + Dst.bFree = 512; + v46 = rand(); + Dst.uTextureID = 0; + Dst.uDiffuse = v46; + Dst.timeToLive = 64; + goto LABEL_89; + } + Dst.bFree = 1032; + Dst.uDiffuse = rand(); + v24 = rand(); + v48 = (TEXTURE_TYPE)0; + goto LABEL_87; + } + v60 = (Actor *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); + v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; + v60 = (Actor *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); + v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; + v60 = (Actor *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); + v28 = LOWORD(stru_721530.uSectorID); + v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; + v29 = v1->vPosition.z; + v1->uSectorID = v28; + stru_721530.field_70 += stru_721530.field_7C; + if ( v2->uFlags & 0x40 ) + { + if ( v29 < v54 ) + v1->vPosition.z = v54 + 1; + if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) + return; + } + v30 = (signed int)stru_721530.uFaceID >> 3; + if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) + break; + if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) + { + v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; + v32 = &v31->pFaces[v30 & 0x3F]; + if ( v32->uPolygonType != 3 ) + { + v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y + + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16; + if ( stru_721530.field_64 >> 3 > v56 ) + v56 = stru_721530.field_64 >> 3; + v57 = v32->pFacePlane.vNormal.x; + v57 = (unsigned __int64)(v56 * (signed __int64)v57) >> 16; + v58 = v32->pFacePlane.vNormal.y; + v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16; + v60 = (Actor *)v32->pFacePlane.vNormal.z; + v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)(signed int)v60) >> 16); + v1->vVelocity.x += 2 * v57; + v1->vVelocity.y += 2 * v58; + if ( v32->pFacePlane.vNormal.z <= 32000 ) + { + v37 = 2 * (short)v60; + } + else + { + v36 = v60; + v57 = 32000; + v1->vVelocity.z += (signed __int16)v60; + v58 = (unsigned __int64)(v57 * (signed __int64)(signed int)v36) >> 16; + v37 = (unsigned int)(v57 * (int)v36) >> 16; + } + v1->vVelocity.z += v37; +LABEL_70: + if ( BYTE3(v32->uAttributes) & 0x10 ) + EventProcessor(v32->sCogTriggeredID, 0, 1); + goto LABEL_74; + } + v33 = v31->pVertices.pVertices[v32->pVertexIDs[0]].z; + v34 = v1->vVelocity.x; + v1->vPosition.z = v33 + 1; + if ( v1->vVelocity.y * v1->vVelocity.y + v34 * v34 >= 400 ) + goto LABEL_70; + LOWORD(v35) = 0; + v1->vVelocity.z = 0; + v1->vVelocity.x = 0; + goto LABEL_73; + } +LABEL_74: + v58 = v1->vVelocity.x; + v57 = 58500; + v58 = (unsigned __int64)(58500i64 * v58) >> 16; + v1->vVelocity.x = v58; + v58 = v1->vVelocity.y; + v58 = (unsigned __int64)(v57 * (signed __int64)v58) >> 16; + v57 = 58500; + v1->vVelocity.y = v58; + v58 = v1->vVelocity.z; + v58 = (unsigned __int64)(v57 * (signed __int64)v58) >> 16; + ++v55; + v43 = __OFSUB__(v55, 100); + v42 = v55 - 100 < 0; + v1->vVelocity.z = v58; + if ( !(v42 ^ v43) ) + return; + } + v57 = integer_sqrt(v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x); + v38 = stru_5C6E00->Atan2( + v1->vPosition.x - pLevelDecorations[v30].vPosition.x, + v1->vPosition.y - pLevelDecorations[v30].vPosition.y); + v56 = v38; + v39 = stru_5C6E00->Cos(v38); + v60 = (Actor *)v39; + v40 = v39 * (signed __int64)v57; + v58 = v40 >> 16; + v1->vVelocity.x = WORD1(v40); + v41 = stru_5C6E00->Sin(v56 - stru_5C6E00->uIntegerHalfPi); + v60 = (Actor *)v41; + v35 = (unsigned __int64)(v41 * (signed __int64)v57) >> 16; + v58 = v35; +LABEL_73: + v1->vVelocity.y = v35; + goto LABEL_74; + } +} + + + +//----- (0047136C) -------------------------------------------------------- +void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID) +{ + SpriteObject *v1; // esi@1 + ObjectDesc *v2; // edi@1 + int v3; // ST08_4@1 + __int16 v4; // ax@5 + __int16 v5; // ax@7 + BLVFace *v6; // ecx@11 + BLVFace *v7; // eax@11 + signed int v8; // ebx@12 + int v9; // ecx@16 + __int16 v10; // di@18 + char v11; // al@19 + int v12; // eax@25 + int v13; // eax@31 + int v14; // ebx@34 + signed int v15; // ebx@46 + BLVFace *v16; // edi@48 + int v17; // eax@50 + int v18; // eax@52 + int v19; // ecx@52 + Vec3_short_ *v20; // ecx@53 + int v21; // ecx@57 + __int16 v22; // ax@57 + int v23; // edi@62 + int v24; // edi@62 + int v25; // eax@62 + unsigned __int64 v26; // qax@62 + unsigned __int8 v27; // sf@64 + unsigned __int8 v28; // of@64 + __int16 v29; // di@67 + char v30; // al@68 + const char *v31; // [sp-8h] [bp-98h]@19 + const char *v32; // [sp-8h] [bp-98h]@68 + enum TEXTURE_TYPE v33; // [sp-4h] [bp-94h]@19 + enum TEXTURE_TYPE v34; // [sp-4h] [bp-94h]@68 + Particle_ Dst; // [sp+Ch] [bp-84h]@18 + unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 + ObjectDesc *v37; // [sp+78h] [bp-18h]@1 + unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 + int v39; // [sp+80h] [bp-10h]@33 + Actor *v39b; + int v40; // [sp+84h] [bp-Ch]@28 + int v41; // [sp+88h] [bp-8h]@34 + int v42; // [sp+8Ch] [bp-4h]@4 + + uLayingItemID_ = uLayingItemID; + v1 = &pSpriteObjects[uLayingItemID]; + v2 = &pObjectList->pObjects[v1->uObjectDescID]; + v3 = v1->vPosition.x; + v37 = &pObjectList->pObjects[v1->uObjectDescID]; + if ( abs(v3) > 32767 + || abs(v1->vPosition.y) > 32767 + || abs(v1->vPosition.z) > 20000 + || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v1->uSectorID, &uFaceID), + v42 <= -30000) + && ((v4 = pIndoor->GetSector(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z), + (v1->uSectorID = v4) == 0) + || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &uFaceID), v42 == -30000)) ) + { + SpriteObject::OnInteraction(uLayingItemID_); + return; + } + v5 = v2->uFlags; + if ( v5 & 0x20 ) + { +LABEL_24: + v8 = 0; +LABEL_25: + stru_721530.field_0 = v8; + uFaceID = v8; + stru_721530.prolly_normal_d = v2->uRadius; + v12 = v2->uHeight; + stru_721530.field_84 = -1; + stru_721530.field_C = v12; + stru_721530.field_8 = v8; + stru_721530.field_70 = v8; + while ( 1 ) + { + stru_721530.field_34.x = v1->vPosition.x; + stru_721530.normal.x = stru_721530.field_34.x; + stru_721530.field_34.y = v1->vPosition.y; + stru_721530.normal.y = stru_721530.field_34.y; + stru_721530.field_34.z = stru_721530.prolly_normal_d + v1->vPosition.z + 1; + stru_721530.normal.z = stru_721530.field_34.z; + stru_721530.field_1C = v1->vVelocity.x; + stru_721530.field_20 = v1->vVelocity.y; + stru_721530.field_24 = v1->vVelocity.z; + stru_721530.uSectorID = v1->uSectorID; + if ( stru_721530._47050A(v8) ) + return; + v40 = v8; + do + { + _46E44E_collide_against_faces_and_portals(0); + _46E0B2_collide_against_decorations(); + if ( (v1->field_58_pid & 7) != OBJECT_Player) + _46EF01_collision_chech_player(1); + v13 = v1->field_58_pid; + v42 = v8; + if ( (v13 & 7) == OBJECT_Actor) + { + if ( (signed int)uNumActors > v8 ) + { + v39b = pActors;//[0].word_000086_some_monster_id; + do + { + //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1; + //v14 = (signed __int64)((double)v41 * 0.3333333333333333); + //v41 = *(short *)(v39 - 38) - 1; + //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) + if( pActors[v1->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) + //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius + _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); + ++v42; + ++v39b;// += 836; + } + while ( v42 < (signed int)uNumActors ); + v8 = 0; + } + } + else + { + if ( (signed int)uNumActors > v8 ) + { + v39b = pActors;//[0].word_000086_some_monster_id; + do + { + _46DF1A_collide_against_actor(v42++, *((short *)&pMonsterList->pMonsters[*(short *)v39b] - 73)); + ++v39b; + } + while ( v42 < (signed int)uNumActors ); + } + } + if ( _46F04E_collide_against_portals() ) + break; + ++v40; + } + while ( v40 < 100 ); + if ( stru_721530.field_7C >= stru_721530.field_6C ) + { + v1->vPosition.x = stru_721530.normal2.x; + v1->vPosition.y = stru_721530.normal2.y; + v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; + v1->uSectorID = LOWORD(stru_721530.uSectorID); + if ( !(HIBYTE(v2->uFlags) & 1) ) + return; + memset(&Dst, v8, 0x68u); + v29 = v2->uFlags; + 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; + if ( v29 & 0x200 ) + { + Dst.bFree = 1036; + Dst.uDiffuse = 0xFF3C1Eu; + v30 = rand(); + v34 = (TEXTURE_TYPE)v8; + v32 = "effpar01"; + } + else + { + if ( v29 & 0x400 ) + goto LABEL_70; + Dst.bFree = 1032; + Dst.uDiffuse = rand(); + v30 = rand(); + v34 = (TEXTURE_TYPE)v8; + v32 = "effpar03"; + } + Dst.timeToLive = (unsigned __int8)(v30 & 0x80) + 128; + Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34); + goto LABEL_71; + } + v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; + v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; + v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; + v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; + v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; + v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; + v1->uSectorID = LOWORD(stru_721530.uSectorID); + stru_721530.field_70 += stru_721530.field_7C; + if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) + return; + v15 = (signed int)stru_721530.uFaceID >> 3; + if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) + { + v40 = integer_sqrt(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y); + v23 = stru_5C6E00->Atan2( + v1->vPosition.x - pLevelDecorations[v15].vPosition.x, + v1->vPosition.y - pLevelDecorations[v15].vPosition.y); + v42 = stru_5C6E00->Cos(v23); + v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; + v24 = v23; + v1->vVelocity.x = (unsigned int)(v42 * v40) >> 16; + v25 = stru_5C6E00->Sin(v23); + v42 = v25; + v26 = v25 * (signed __int64)v40; + v41 = v26 >> 16; + v1->vVelocity.y = WORD1(v26); + } + else + { + if ( (stru_721530.uFaceID & 7) != OBJECT_BModel) + goto LABEL_64; + stru_721530.field_84 = (signed int)stru_721530.uFaceID >> 3; + v16 = &pIndoor->pFaces[v15]; + if ( v16->uPolygonType != 3 ) + { + v42 = abs(v16->pFacePlane_old.vNormal.x * v1->vVelocity.x + v16->pFacePlane_old.vNormal.z * v1->vVelocity.z + + v16->pFacePlane_old.vNormal.y * v1->vVelocity.y) >> 16; + if ( stru_721530.field_64 >> 3 > v42 ) + v42 = stru_721530.field_64 >> 3; + v40 = v16->pFacePlane_old.vNormal.x; + v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; + v41 = v16->pFacePlane_old.vNormal.y; + v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; + v39 = v16->pFacePlane_old.vNormal.z; + v39 = (unsigned __int64)(v42 * (signed __int64)v39) >> 16; + v1->vVelocity.x += 2 * v40; + v1->vVelocity.y += 2 * v41; + if ( v16->pFacePlane_old.vNormal.z <= 32000 ) + { + v22 = 2 * v39; + } + else + { + v21 = v39; + v40 = 32000; + v1->vVelocity.z += v39; + v41 = (unsigned __int64)(v40 * (signed __int64)v21) >> 16; + v22 = (unsigned int)(v40 * v21) >> 16; + } + v1->vVelocity.z += v22; + goto LABEL_60; + } + if ( v37->uFlags & 0x80 ) + { + v17 = -v1->vVelocity.z >> 1; + v1->vVelocity.z = v17; + if ( (signed __int16)v17 < 10 ) + v1->vVelocity.z = 0; +LABEL_60: + if ( BYTE3(v16->uAttributes) & 0x10 ) + EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); + goto LABEL_63; + } + v18 = v1->vVelocity.y; + v19 = v1->vVelocity.x; + v1->vVelocity.z = 0; + if ( v19 * v19 + v18 * v18 >= 400 ) + goto LABEL_60; + v20 = pIndoor->pVertices; + v1->vVelocity.z = 0; + v1->vVelocity.y = 0; + v1->vVelocity.x = 0; + v1->vPosition.z = v20[*v16->pVertexIDs].z + 1; + } +LABEL_63: + v2 = v37; +LABEL_64: + v41 = v1->vVelocity.x; + v40 = 58500; + v41 = (unsigned __int64)(58500i64 * v41) >> 16; + v1->vVelocity.x = v41; + v41 = v1->vVelocity.y; + v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; + v40 = 58500; + v1->vVelocity.y = v41; + v41 = v1->vVelocity.z; + v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; + ++uFaceID; + v28 = __OFSUB__(uFaceID, 100); + v27 = uFaceID - 100 < 0; + v1->vVelocity.z = v41; + if ( !(v27 ^ v28) ) + return; + v8 = 0; + } + } + if ( v42 <= v1->vPosition.z - 3 ) + { + v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); + goto LABEL_24; + } + if ( !(v5 & 0x40) || _46BFFA_check_object_intercept(uLayingItemID_, 0) ) + { + v6 = pIndoor->pFaces; + v1->vPosition.z = v42 + 1; + v7 = &v6[uFaceID]; + if ( v7->uPolygonType == 3 ) + { + v8 = 0; + v1->vVelocity.z = 0; + } + else + { + if ( v7->pFacePlane_old.vNormal.z < 45000 ) + v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); + v8 = 0; + } + v42 = v1->vVelocity.x; + uFaceID = 58500; + v42 = (unsigned __int64)(58500i64 * v42) >> 16; + v1->vVelocity.x = v42; + v42 = v1->vVelocity.y; + v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; + uFaceID = 58500; + v1->vVelocity.y = v42; + v42 = v1->vVelocity.z; + v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; + v9 = v1->vVelocity.x; + v1->vVelocity.z = v42; + if ( v9 * v9 + v1->vVelocity.y * v1->vVelocity.y < 400 ) + { + v1->vVelocity.z = v8; + v1->vVelocity.y = v8; + v1->vVelocity.x = v8; + if ( !(HIBYTE(v2->uFlags) & 1) ) + return; + memset(&Dst, v8, 0x68u); + v10 = v2->uFlags; + 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; + if ( v10 & 0x200 ) + { + Dst.bFree = 1036; + Dst.uDiffuse = 0xFF3C1Eu; + Dst.flt_28 = 1.0; + v11 = rand(); + v33 = (TEXTURE_TYPE)v8; + v31 = "effpar01"; + } + else + { + if ( v10 & 0x400 ) + { +LABEL_70: + Dst.bFree = 512; + Dst.uDiffuse = rand(); + Dst.timeToLive = 64; + Dst.uTextureID = v8; +LABEL_71: + Dst.flt_28 = 1.0; + goto LABEL_72; + } + Dst.bFree = 1032; + Dst.uDiffuse = rand(); + Dst.flt_28 = 1.0; + v11 = rand(); + v33 = (TEXTURE_TYPE)v8; + v31 = "effpar03"; + } + Dst.timeToLive = (unsigned __int8)(v11 & 0x80) + 128; + Dst.uTextureID = pBitmaps_LOD->LoadTexture(v31, v33); +LABEL_72: + pGame->pParticleEngine->AddParticle(&Dst); + return; + } + goto LABEL_25; + } +} +// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); + + + + +//----- (00438E35) -------------------------------------------------------- +void SpriteObject::_438E35() +{ + SpriteObject *v1; // edi@1 + MapInfo *pMapInfo; // esi@1 + int v3; // ebx@1 + int v4; // eax@1 + int v5; // ebx@1 + unsigned int v6; // ecx@1 + int v7; // edx@2 + unsigned int v8; // edx@4 + unsigned int v9; // edx@6 + unsigned int v10; // eax@7 + signed int v11; // ebx@8 + Player **v12; // esi@18 + signed int v13; // edi@20 + int v15; // [sp+Ch] [bp-Ch]@1 + int v16; // [sp+10h] [bp-8h]@1 + signed int v17; // [sp+14h] [bp-4h]@8 + int v18; // [sp+14h] [bp-4h]@14 + + v1 = this; + pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]; + v3 = abs(pParty->vPosition.x - v1->vPosition.x); + v15 = abs(pParty->vPosition.y - v1->vPosition.y); + v16 = abs(pParty->vPosition.z + pParty->sEyelevel - v1->vPosition.z); + v4 = v3; + v5 = v15; + v6 = v16; + if ( v4 < v15 ) + { + v7 = v4; + v4 = v15; + v5 = v7; + } + if ( v4 < v16 ) + { + v8 = v4; + v4 = v16; + v6 = v8; + } + if ( v5 < (signed int)v6 ) + { + v9 = v6; + v6 = v5; + v5 = v9; + } + v10 = ((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4; + if ( (signed int)v10 <= 768 ) + { + v17 = 0; + v11 = 5; + if ( pMapInfo->Trap_D20 ) + { + do + { + ++v17; + v11 += rand() % 20 + 1; + } + while ( v17 < pMapInfo->Trap_D20 ); + } + switch ( v1->uType ) + { + case 0x32Bu: + v18 = 0; + break; + case 0x32Cu: + v18 = 1; + break; + case 0x32Du: + v18 = 2; + break; + default: + //LOWORD(v10) = v1->uItemType - 814; + if ( v1->uType != 814 ) + return; + v18 = 8; + break; + } + v12 = &pPlayers[1]; + do + { + if ( (*v12)->CanAct() && (v13 = (*v12)->GetPerception() + 20, rand() % v13 > 20) ) + (*v12)->PlaySound(SPEECH_6, 0); + else + (*v12)->ReceiveDamage(v11, v18); + ++v12; + } + while ( (signed int)v12 <= (signed int)&pPlayers[4] ); + } +} + + + +//----- (0042F933) -------------------------------------------------------- +void SpriteObject::OnInteraction(unsigned int uLayingItemID) +{ + unsigned int v1; // ecx@1 + unsigned __int16 *pAttributes; // ecx@2 + unsigned __int16 v3; // ax@2 + + //__debugbreak(); // find out what's going on + + v1 = uLayingItemID; + pSpriteObjects[v1].uObjectDescID = 0; + if ( pParty->bTurnBasedModeOn == 1 ) + { + pAttributes = &pSpriteObjects[v1].uAttributes; + v3 = *pAttributes; + if ( *pAttributes & 4 ) + { + v3 = v3 & 0xFB; + --pTurnEngine->field_1C; + *pAttributes = v3; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SpriteObject.h Sat Mar 02 00:24:27 2013 +0600 @@ -0,0 +1,55 @@ +#pragma once +#include "VectorTypes.h" +#include "Items.h" + +enum +{ + OBJECT_ATTACHED_TO_ACTOR = 0x80, +}; + + +/* 72 */ +#pragma pack(push, 1) +struct SpriteObject +{ + inline bool AttachedToActor() const {return uAttributes & OBJECT_ATTACHED_TO_ACTOR;} + + SpriteObject(); + int Create(int yaw, int pitch, int a4, int a5); + void _46BEF1_apply_spells(); + void _438E35(); + + static void UpdateObject_fn0_BLV(unsigned int uLayingItemID); + static void UpdateObject_fn0_ODM(unsigned int uLayingItemID); + static void OnInteraction(unsigned int uLayingItemID); + + + unsigned __int16 uType; + unsigned __int16 uObjectDescID; + struct Vec3_int_ vPosition; + struct Vec3_short_ vVelocity; + unsigned __int16 uFacing; + unsigned __int16 uSoundID; + unsigned __int16 uAttributes; + __int16 uSectorID; + unsigned __int16 uSpriteFrameID; + __int16 field_20; + __int16 field_22_glow_radius_multiplier; + struct ItemGen stru_24; + int field_48; + int field_4C; + int field_50; + int field_54; + int field_58_pid; + int field_5C; + char field_60_distance_related_prolly_lod; + char field_61; + char field_62[2]; + Vec3_int_ field_64; +}; +#pragma pack(pop) + + + +extern size_t uNumSpriteObjects; +extern SpriteObject pSpriteObjects[1000]; \ No newline at end of file
--- a/mm7_1.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/mm7_1.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -29,7 +29,7 @@ #include "Viewport.h" #include "FrameTableInc.h" #include "Math.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "ObjectList.h" #include "Chest.h" #include "PaletteManager.h" @@ -4024,12 +4024,12 @@ int v3; // ebx@4 int v4; // esi@6 int v5; // ecx@6 - //LayingItem v6; // [sp+Ch] [bp-80h]@1 + //SpriteObject v6; // [sp+Ch] [bp-80h]@1 char v7; // [sp+7Ch] [bp-10h]@2 POINT a2; // [sp+84h] [bp-8h]@2 - LayingItem v6; // [sp+Ch] [bp-80h]@1 - //LayingItem::LayingItem(&v6); + SpriteObject v6; // [sp+Ch] [bp-80h]@1 + //SpriteObject::SpriteObject(&v6); v0 = pGUIWindow_CurrentMenu->ptr_1C; if ( pParty->pPickedItem.uItemID ) @@ -4155,7 +4155,7 @@ if ( (v18 & 7) == OBJECT_Item ) { v30 = v19; - if ( pObjectList->pObjects[pLayingItems[v30].uObjectDescID].uFlags & 0x10 ) + if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 ) //goto LABEL_73; { pMouse->uPointingObjectID = 0; @@ -4174,7 +4174,7 @@ } if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) { - v22 = pLayingItems[v30].stru_24.GetDisplayName(); + v22 = pSpriteObjects[v30].stru_24.GetDisplayName(); //LABEL_93: v26 = v22; //goto LABEL_87; @@ -4190,7 +4190,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - v31 = pLayingItems[v30].stru_24.GetDisplayName(); + v31 = pSpriteObjects[v30].stru_24.GetDisplayName(); v28 = pTmpBuf; sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s" } @@ -4847,7 +4847,7 @@ signed int v6; // eax@11 char *v7; // edi@12 __int16 v8; // ax@16 - LayingItem a1; // [sp+4h] [bp-78h]@11 + SpriteObject a1; // [sp+4h] [bp-78h]@11 int v11; // [sp+74h] [bp-8h]@2 int v12; // [sp+78h] [bp-4h]@5 @@ -4884,7 +4884,7 @@ { v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; v6 = 0; - a1.uItemType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; + a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LOWORD(v6) = 0; @@ -5186,7 +5186,7 @@ signed int v21; // eax@58 ItemGen *v22; // esi@62 unsigned int v23; // eax@62 - LayingItem a1; // [sp+Ch] [bp-80h]@1 + SpriteObject a1; // [sp+Ch] [bp-80h]@1 POINT v25; // [sp+7Ch] [bp-10h]@3 POINT a2; // [sp+84h] [bp-8h]@3 @@ -5203,13 +5203,13 @@ { a2.y = (signed int)(unsigned __int16)v0 >> 3; v21 = (signed int)(unsigned __int16)v0 >> 3; - if ( !(pObjectList->pObjects[pLayingItems[v21].uObjectDescID].uFlags & 0x10) + if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) && a2.y < 1000 - && pLayingItems[v21].uObjectDescID + && pSpriteObjects[v21].uObjectDescID && (unsigned int)v0 < 0x2000000 ) { - v22 = &pLayingItems[v21].stru_24; - v23 = pLayingItems[v21].stru_24.uItemID; + v22 = &pSpriteObjects[v21].stru_24; + v23 = pSpriteObjects[v21].stru_24.uItemID; if ( pItemsTable->pItems[v23].uEquipType == 18 ) { party_finds_gold(v22->uSpecEnchantmentType, 0); @@ -5226,7 +5226,7 @@ if ( !pParty->AddItem(v22) ) pParty->SetHoldingItem(v22); } - LayingItem::OnItemPickup(a2.y); + SpriteObject::OnInteraction(a2.y); return; } goto LABEL_13; @@ -5269,7 +5269,7 @@ LABEL_14: v5 = pItemsTable->pItems[v4].uSpriteID; v6 = 0; - a1.uItemType = v5; + a1.uType = v5; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_18:
--- a/mm7_2.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/mm7_2.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -21,7 +21,7 @@ #include "Viewport.h" #include "FrameTableInc.h" #include "Math.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "ObjectList.h" #include "Chest.h" #include "PaletteManager.h" @@ -7872,7 +7872,7 @@ //int v28; // eax@35 //int v29; // esi@35 //__int16 v30; // ax@35 - LayingItem a1a; // [sp+Ch] [bp-7Ch]@1 + SpriteObject a1a; // [sp+Ch] [bp-7Ch]@1 //int v32; // [sp+7Ch] [bp-Ch]@1 //int v33; // [sp+80h] [bp-8h]@1 int v34; // [sp+84h] [bp-4h]@1 @@ -7932,7 +7932,7 @@ LABEL_20: v15 = 0; v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; - a1a.uItemType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; + a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_24: @@ -7977,7 +7977,7 @@ return result; v23 = 0; v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; - a1a.uItemType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; + a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_33: @@ -8025,14 +8025,14 @@ unsigned __int16 v9; // cx@1 char *v10; // edx@2 unsigned __int16 v11; // ax@5 - LayingItem a1; // [sp+8h] [bp-70h]@1 + SpriteObject a1; // [sp+8h] [bp-70h]@1 v6 = ecx0; v7 = a2; pItemsTable->GenerateItem(v6, v7, &a1.stru_24); v8 = 0; v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; - a1.uItemType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; + a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_5: @@ -12215,7 +12215,7 @@ _strrev(Str1); for (uint i = 0; i < 1000; ++i) - pLayingItems[i].uObjectDescID = 0; + pSpriteObjects[i].uObjectDescID = 0; v5 = pMapStats->GetMapInfo(pCurrentMapName); bUnderwater = 0; @@ -14939,12 +14939,12 @@ v17 = a1 >> 3; v26 = a1 >> 3; v18 = a1 >> 3; - if ( pObjectList->pObjects[pLayingItems[v18].uObjectDescID].uFlags & 0x10 + if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10 || v17 >= 1000 - || !pLayingItems[v18].uObjectDescID ) + || !pSpriteObjects[v18].uObjectDescID ) return 1; - v19 = &pLayingItems[v18].stru_24; - v20 = pLayingItems[v18].stru_24.uItemID; + v19 = &pSpriteObjects[v18].stru_24; + v20 = pSpriteObjects[v18].stru_24.uItemID; if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) { party_finds_gold(v19->uSpecEnchantmentType, 0); @@ -14966,7 +14966,7 @@ pParty->SetHoldingItem(v19); v21 = v26; } - LayingItem::OnItemPickup(v21); + SpriteObject::OnInteraction(v21); break; case OBJECT_Actor: @@ -15442,9 +15442,9 @@ { if ( v20 >= 0x3E8 ) return 0; - if ( !(pLayingItems[v20].uAttributes & 0x10) ) - { - v23 = pLayingItems[v20].stru_24.GetDisplayName(); + if ( !(pSpriteObjects[v20].uAttributes & 0x10) ) + { + v23 = pSpriteObjects[v20].stru_24.GetDisplayName(); LABEL_36: v24 = v23; goto LABEL_51; @@ -15591,9 +15591,9 @@ //----- (0046BEF1) -------------------------------------------------------- -void LayingItem::_46BEF1_apply_spells() -{ - LayingItem *v1; // edi@1 +void SpriteObject::_46BEF1_apply_spells() +{ + SpriteObject *v1; // edi@1 Actor *v2; // esi@2 __int16 v3; // fps@4 unsigned __int8 v4; // c0@4 @@ -15635,7 +15635,7 @@ //----- (0046BFFA) -------------------------------------------------------- bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) { - LayingItem *v2; // esi@1 + SpriteObject *v2; // esi@1 ObjectDesc *v3; // ebx@1 unsigned __int16 v5; // cx@9 unsigned __int16 v6; // cx@14 @@ -15788,7 +15788,7 @@ unsigned int v153; // [sp+28h] [bp-4h]@1 v153 = uLayingItemID; - v2 = &pLayingItems[uLayingItemID]; + v2 = &pSpriteObjects[uLayingItemID]; v3 = &pObjectList->pObjects[v2->uObjectDescID]; v145 = a2; v151 = a2 & 7; @@ -15813,8 +15813,8 @@ } if ( v151 == OBJECT_BModel && (v2->field_58_pid & 7) != OBJECT_Player) BYTE2(pActors[v2->field_58_pid >> 3].uAttributes) |= 4u; - v6 = v2->uItemType; - v7 = v2->uItemType; + v6 = v2->uType; + v7 = v2->uType; if ( v7 > 3060 ) { if ( v7 > 6090 ) @@ -15833,7 +15833,7 @@ v98 = v6 + 1; v99 = pObjectList->uNumObjects; v32 = 0; - v2->uItemType = v98; + v2->uType = v98; v146 = 0; if ( (signed int)v99 > 0 ) { @@ -15877,7 +15877,7 @@ if ( !v138 ) { v109 = pObjectList->uNumObjects; - ++v2->uItemType; + ++v2->uType; v110 = 0; if ( (signed int)v109 <= 0 ) { @@ -15887,7 +15887,7 @@ else { v111 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uItemType != *(short *)v111 ) + while ( v2->uType != *(short *)v111 ) { ++v110; v111 += 56; @@ -15898,7 +15898,7 @@ } v2->uObjectDescID = v112; if ( !v112 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v2->vVelocity.z = 0; v2->vVelocity.y = 0; v2->vVelocity.x = 0; @@ -15921,7 +15921,7 @@ goto LABEL_269; } LABEL_246: - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); return 0; } v106 = v145; @@ -15966,7 +15966,7 @@ if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) { v138 = 0; - if ( v2->uItemType == 8030 ) + if ( v2->uType == 8030 ) { pActors[v108].uAIState = Standing; pActors[v108].UpdateAnimation(); @@ -16002,13 +16002,13 @@ && MonsterStats::BelongsToSupertype(pActors[v145 >> 3].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) sub_43A97E(v153, v145); v93 = pObjectList->uNumObjects; - ++v2->uItemType; + ++v2->uType; v9 = 0; v52 = 0; if ( (signed int)v93 > 0 ) { v94 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uItemType != *(short *)v94 ) + while ( v2->uType != *(short *)v94 ) { ++v52; v94 += 56; @@ -16048,7 +16048,7 @@ v56 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = v54; + v2->uType = v54; if ( v20 | v44 ) { LABEL_102: @@ -16068,7 +16068,7 @@ } v2->uObjectDescID = v58; if ( !v58 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v14 = v153; v2->vVelocity.z = 0; v2->vVelocity.y = 0; @@ -16104,7 +16104,7 @@ v61 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = v59; + v2->uType = v59; if ( v20 | v44 ) { LABEL_111: @@ -16124,7 +16124,7 @@ } v2->uObjectDescID = v63; if ( !v63 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; v44 = v2->field_50 == 4; v2->vVelocity.z = 0; @@ -16147,7 +16147,7 @@ LABEL_160: v14 = v153; LABEL_34: - LayingItem::OnItemPickup(v14); + SpriteObject::OnInteraction(v14); goto LABEL_35; } if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) @@ -16157,7 +16157,7 @@ v69 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = v67; + v2->uType = v67; if ( v20 | v44 ) { LABEL_128: @@ -16177,7 +16177,7 @@ } v2->uObjectDescID = v71; if ( !v71 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v134 = 0; v72 = v153; v132 = 0; @@ -16213,7 +16213,7 @@ v86 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = v84; + v2->uType = v84; if ( v20 | v44 ) { LABEL_155: @@ -16233,7 +16233,7 @@ } v2->uObjectDescID = v88; if ( !v88 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; v2->vVelocity.z = 0; v2->vVelocity.y = 0; @@ -16260,7 +16260,7 @@ v81 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = 4091; + v2->uType = 4091; if ( v20 | v44 ) { LABEL_144: @@ -16280,7 +16280,7 @@ } v2->uObjectDescID = v83; if ( !v83 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v134 = 0; v72 = v153; v132 = v2->field_61; @@ -16302,7 +16302,7 @@ { sub_43A97E(v153, v145); v23 = pObjectList->uNumObjects; - ++v2->uItemType; + ++v2->uType; v18 = 0; v24 = 0; if ( (signed int)v23 <= 0 ) @@ -16313,7 +16313,7 @@ else { v25 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uItemType != *(short *)v25 ) + while ( v2->uType != *(short *)v25 ) { ++v24; v25 += 56; @@ -16325,7 +16325,7 @@ LABEL_42: v2->uObjectDescID = v22; if ( v22 == v18 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v2->vVelocity.z = v18; v2->vVelocity.y = v18; v2->vVelocity.x = v18; @@ -16346,7 +16346,7 @@ case 540: sub_43A97E(v153, v145); v8 = pObjectList->uNumObjects; - ++v2->uItemType; + ++v2->uType; v9 = 0; v10 = 0; if ( (signed int)v8 <= 0 ) @@ -16371,7 +16371,7 @@ v19 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = 600; + v2->uType = 600; if ( v20 | v44 ) goto LABEL_41; v21 = (char *)&pObjectList->pObjects->uObjectID; @@ -16387,7 +16387,7 @@ default: return 0; } - while ( v2->uItemType != *(short *)v11 ) + while ( v2->uType != *(short *)v11 ) { ++v10; v11 += 56; @@ -16402,8 +16402,8 @@ LABEL_24: v2->uObjectDescID = v12; if ( !v12 ) - LayingItem::OnItemPickup(v153); - v44 = v2->uItemType == 555; + SpriteObject::OnInteraction(v153); + v44 = v2->uType == 555; v2->vVelocity.z = 0; v2->vVelocity.y = 0; v2->vVelocity.x = 0; @@ -16433,13 +16433,13 @@ LABEL_93: sub_43A97E(v153, v145); v51 = pObjectList->uNumObjects; - ++v2->uItemType; + ++v2->uType; v9 = 0; v52 = 0; if ( (signed int)v51 > 0 ) { v53 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uItemType != *(short *)v53 ) + while ( v2->uType != *(short *)v53 ) { ++v52; v53 += 56; @@ -16453,7 +16453,7 @@ LABEL_182: v2->uObjectDescID = v95; if ( v95 == (short)v9 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v96 = v2->uSoundID; v2->vVelocity.z = v9; v2->vVelocity.y = v9; @@ -16478,7 +16478,7 @@ v34 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = 601; + v2->uType = 601; if ( v20 | v44 ) { LABEL_69: @@ -16498,7 +16498,7 @@ } v2->uObjectDescID = v36; if ( !v36 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v37 = v2->vPosition.z; v2->vVelocity.z = 0; v38 = 8 * v153; @@ -16538,7 +16538,7 @@ v30 = v6 + 1; v31 = pObjectList->uNumObjects; v32 = 0; - v2->uItemType = v30; + v2->uType = v30; v146 = 0; if ( (signed int)v31 > 0 ) { @@ -16555,7 +16555,7 @@ LABEL_196: v2->uObjectDescID = v46; if ( v46 == (short)v32 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v100 = v2->field_61; v101 = v2->vPosition.z; v2->uSpriteFrameID = v32; @@ -16600,12 +16600,12 @@ { sub_43A97E(v153, v145); v122 = pObjectList->uNumObjects; - ++v2->uItemType; + ++v2->uType; v52 = 0; if ( (signed int)v122 > 0 ) { v123 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uItemType != *(short *)v123 ) + while ( v2->uType != *(short *)v123 ) { ++v52; v123 += 56; @@ -16623,7 +16623,7 @@ v119 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uItemType = v117; + v2->uType = v117; if ( v20 | v44 ) { LABEL_255: @@ -16643,7 +16643,7 @@ } v2->uObjectDescID = v121; if ( !v121 ) - LayingItem::OnItemPickup(v153); + SpriteObject::OnInteraction(v153); v2->vVelocity.z = 0; v2->vVelocity.y = 0; v2->vVelocity.x = 0;
--- a/mm7_3.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/mm7_3.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -20,7 +20,7 @@ #include "Viewport.h" #include "FrameTableInc.h" #include "Math.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "ObjectList.h" #include "Chest.h" #include "PaletteManager.h" @@ -543,7 +543,7 @@ } //----- (0046ED8A) -------------------------------------------------------- -void __fastcall _46ED8A_collide_against_layingItems(unsigned int _this) +void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this) { int v1; // ebx@2 ObjectDesc *v2; // edx@4 @@ -563,10 +563,10 @@ v15 = 0; v12 = _this; - if ( (signed int)uNumLayingItems > 0 ) - { - v1 = (int)&pLayingItems[0].uObjectDescID; - v14 = (char *)&pLayingItems[0].uObjectDescID; + if ( (signed int)uNumSpriteObjects > 0 ) + { + v1 = (int)&pSpriteObjects[0].uObjectDescID; + v14 = (char *)&pSpriteObjects[0].uObjectDescID; do { if ( *(short *)v1 ) @@ -625,7 +625,7 @@ v1 = (int)(v14 + 112); v14 += 112; } - while ( (signed int)v15 < (signed int)uNumLayingItems ); + while ( (signed int)v15 < (signed int)uNumSpriteObjects ); } } @@ -1161,7 +1161,7 @@ v30 = WorldPosToGridCellX(v0->vPosition.x); _46E26D_collide_against_sprites(v30, v29); _46EF01_collision_chech_player(0); - _46ED8A_collide_against_layingItems(8 * v75 | 3); + _46ED8A_collide_against_sprite_objects(8 * v75 | OBJECT_Actor); v31 = 0; for ( i = 0; v31 < ai_arrays_size; ++v31 ) { @@ -1387,801 +1387,6 @@ -//----- (0047136C) -------------------------------------------------------- -void LayingItem::UpdateObject_fn0_BLV(unsigned int uLayingItemID) -{ - LayingItem *v1; // esi@1 - ObjectDesc *v2; // edi@1 - int v3; // ST08_4@1 - __int16 v4; // ax@5 - __int16 v5; // ax@7 - BLVFace *v6; // ecx@11 - BLVFace *v7; // eax@11 - signed int v8; // ebx@12 - int v9; // ecx@16 - __int16 v10; // di@18 - char v11; // al@19 - int v12; // eax@25 - int v13; // eax@31 - int v14; // ebx@34 - signed int v15; // ebx@46 - BLVFace *v16; // edi@48 - int v17; // eax@50 - int v18; // eax@52 - int v19; // ecx@52 - Vec3_short_ *v20; // ecx@53 - int v21; // ecx@57 - __int16 v22; // ax@57 - int v23; // edi@62 - int v24; // edi@62 - int v25; // eax@62 - unsigned __int64 v26; // qax@62 - unsigned __int8 v27; // sf@64 - unsigned __int8 v28; // of@64 - __int16 v29; // di@67 - char v30; // al@68 - const char *v31; // [sp-8h] [bp-98h]@19 - const char *v32; // [sp-8h] [bp-98h]@68 - enum TEXTURE_TYPE v33; // [sp-4h] [bp-94h]@19 - enum TEXTURE_TYPE v34; // [sp-4h] [bp-94h]@68 - Particle_ Dst; // [sp+Ch] [bp-84h]@18 - unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 - ObjectDesc *v37; // [sp+78h] [bp-18h]@1 - unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 - int v39; // [sp+80h] [bp-10h]@33 - Actor *v39b; - int v40; // [sp+84h] [bp-Ch]@28 - int v41; // [sp+88h] [bp-8h]@34 - int v42; // [sp+8Ch] [bp-4h]@4 - - uLayingItemID_ = uLayingItemID; - v1 = &pLayingItems[uLayingItemID]; - v2 = &pObjectList->pObjects[v1->uObjectDescID]; - v3 = v1->vPosition.x; - v37 = &pObjectList->pObjects[v1->uObjectDescID]; - if ( abs(v3) > 32767 - || abs(v1->vPosition.y) > 32767 - || abs(v1->vPosition.z) > 20000 - || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v1->uSectorID, &uFaceID), - v42 <= -30000) - && ((v4 = pIndoor->GetSector(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z), - (v1->uSectorID = v4) == 0) - || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &uFaceID), v42 == -30000)) ) - { - LayingItem::OnItemPickup(uLayingItemID_); - return; - } - v5 = v2->uFlags; - if ( v5 & 0x20 ) - { -LABEL_24: - v8 = 0; -LABEL_25: - stru_721530.field_0 = v8; - uFaceID = v8; - stru_721530.prolly_normal_d = v2->uRadius; - v12 = v2->uHeight; - stru_721530.field_84 = -1; - stru_721530.field_C = v12; - stru_721530.field_8 = v8; - stru_721530.field_70 = v8; - while ( 1 ) - { - stru_721530.field_34.x = v1->vPosition.x; - stru_721530.normal.x = stru_721530.field_34.x; - stru_721530.field_34.y = v1->vPosition.y; - stru_721530.normal.y = stru_721530.field_34.y; - stru_721530.field_34.z = stru_721530.prolly_normal_d + v1->vPosition.z + 1; - stru_721530.normal.z = stru_721530.field_34.z; - stru_721530.field_1C = v1->vVelocity.x; - stru_721530.field_20 = v1->vVelocity.y; - stru_721530.field_24 = v1->vVelocity.z; - stru_721530.uSectorID = v1->uSectorID; - if ( stru_721530._47050A(v8) ) - return; - v40 = v8; - do - { - _46E44E_collide_against_faces_and_portals(0); - _46E0B2_collide_against_decorations(); - if ( (v1->field_58_pid & 7) != OBJECT_Player) - _46EF01_collision_chech_player(1); - v13 = v1->field_58_pid; - v42 = v8; - if ( (v13 & 7) == OBJECT_Actor) - { - if ( (signed int)uNumActors > v8 ) - { - v39b = pActors;//[0].word_000086_some_monster_id; - do - { - //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1; - //v14 = (signed __int64)((double)v41 * 0.3333333333333333); - //v41 = *(short *)(v39 - 38) - 1; - //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) - if( pActors[v1->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) - //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius - _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); - ++v42; - ++v39b;// += 836; - } - while ( v42 < (signed int)uNumActors ); - v8 = 0; - } - } - else - { - if ( (signed int)uNumActors > v8 ) - { - v39b = pActors;//[0].word_000086_some_monster_id; - do - { - _46DF1A_collide_against_actor(v42++, *((short *)&pMonsterList->pMonsters[*(short *)v39b] - 73)); - ++v39b; - } - while ( v42 < (signed int)uNumActors ); - } - } - if ( _46F04E_collide_against_portals() ) - break; - ++v40; - } - while ( v40 < 100 ); - if ( stru_721530.field_7C >= stru_721530.field_6C ) - { - v1->vPosition.x = stru_721530.normal2.x; - v1->vPosition.y = stru_721530.normal2.y; - v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; - v1->uSectorID = LOWORD(stru_721530.uSectorID); - if ( !(HIBYTE(v2->uFlags) & 1) ) - return; - memset(&Dst, v8, 0x68u); - v29 = v2->uFlags; - 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; - if ( v29 & 0x200 ) - { - Dst.bFree = 1036; - Dst.uDiffuse = 0xFF3C1Eu; - v30 = rand(); - v34 = (TEXTURE_TYPE)v8; - v32 = "effpar01"; - } - else - { - if ( v29 & 0x400 ) - goto LABEL_70; - Dst.bFree = 1032; - Dst.uDiffuse = rand(); - v30 = rand(); - v34 = (TEXTURE_TYPE)v8; - v32 = "effpar03"; - } - Dst.timeToLive = (unsigned __int8)(v30 & 0x80) + 128; - Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34); - goto LABEL_71; - } - v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; - v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; - v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; - v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; - v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; - v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; - v1->uSectorID = LOWORD(stru_721530.uSectorID); - stru_721530.field_70 += stru_721530.field_7C; - if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) - return; - v15 = (signed int)stru_721530.uFaceID >> 3; - if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) - { - v40 = integer_sqrt(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y); - v23 = stru_5C6E00->Atan2( - v1->vPosition.x - pLevelDecorations[v15].vPosition.x, - v1->vPosition.y - pLevelDecorations[v15].vPosition.y); - v42 = stru_5C6E00->Cos(v23); - v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v24 = v23; - v1->vVelocity.x = (unsigned int)(v42 * v40) >> 16; - v25 = stru_5C6E00->Sin(v23); - v42 = v25; - v26 = v25 * (signed __int64)v40; - v41 = v26 >> 16; - v1->vVelocity.y = WORD1(v26); - } - else - { - if ( (stru_721530.uFaceID & 7) != OBJECT_BModel) - goto LABEL_64; - stru_721530.field_84 = (signed int)stru_721530.uFaceID >> 3; - v16 = &pIndoor->pFaces[v15]; - if ( v16->uPolygonType != 3 ) - { - v42 = abs(v16->pFacePlane_old.vNormal.x * v1->vVelocity.x + v16->pFacePlane_old.vNormal.z * v1->vVelocity.z - + v16->pFacePlane_old.vNormal.y * v1->vVelocity.y) >> 16; - if ( stru_721530.field_64 >> 3 > v42 ) - v42 = stru_721530.field_64 >> 3; - v40 = v16->pFacePlane_old.vNormal.x; - v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v41 = v16->pFacePlane_old.vNormal.y; - v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; - v39 = v16->pFacePlane_old.vNormal.z; - v39 = (unsigned __int64)(v42 * (signed __int64)v39) >> 16; - v1->vVelocity.x += 2 * v40; - v1->vVelocity.y += 2 * v41; - if ( v16->pFacePlane_old.vNormal.z <= 32000 ) - { - v22 = 2 * v39; - } - else - { - v21 = v39; - v40 = 32000; - v1->vVelocity.z += v39; - v41 = (unsigned __int64)(v40 * (signed __int64)v21) >> 16; - v22 = (unsigned int)(v40 * v21) >> 16; - } - v1->vVelocity.z += v22; - goto LABEL_60; - } - if ( v37->uFlags & 0x80 ) - { - v17 = -v1->vVelocity.z >> 1; - v1->vVelocity.z = v17; - if ( (signed __int16)v17 < 10 ) - v1->vVelocity.z = 0; -LABEL_60: - if ( BYTE3(v16->uAttributes) & 0x10 ) - EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); - goto LABEL_63; - } - v18 = v1->vVelocity.y; - v19 = v1->vVelocity.x; - v1->vVelocity.z = 0; - if ( v19 * v19 + v18 * v18 >= 400 ) - goto LABEL_60; - v20 = pIndoor->pVertices; - v1->vVelocity.z = 0; - v1->vVelocity.y = 0; - v1->vVelocity.x = 0; - v1->vPosition.z = v20[*v16->pVertexIDs].z + 1; - } -LABEL_63: - v2 = v37; -LABEL_64: - v41 = v1->vVelocity.x; - v40 = 58500; - v41 = (unsigned __int64)(58500i64 * v41) >> 16; - v1->vVelocity.x = v41; - v41 = v1->vVelocity.y; - v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; - v40 = 58500; - v1->vVelocity.y = v41; - v41 = v1->vVelocity.z; - v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; - ++uFaceID; - v28 = __OFSUB__(uFaceID, 100); - v27 = uFaceID - 100 < 0; - v1->vVelocity.z = v41; - if ( !(v27 ^ v28) ) - return; - v8 = 0; - } - } - if ( v42 <= v1->vPosition.z - 3 ) - { - v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); - goto LABEL_24; - } - if ( !(v5 & 0x40) || _46BFFA_check_object_intercept(uLayingItemID_, 0) ) - { - v6 = pIndoor->pFaces; - v1->vPosition.z = v42 + 1; - v7 = &v6[uFaceID]; - if ( v7->uPolygonType == 3 ) - { - v8 = 0; - v1->vVelocity.z = 0; - } - else - { - if ( v7->pFacePlane_old.vNormal.z < 45000 ) - v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); - v8 = 0; - } - v42 = v1->vVelocity.x; - uFaceID = 58500; - v42 = (unsigned __int64)(58500i64 * v42) >> 16; - v1->vVelocity.x = v42; - v42 = v1->vVelocity.y; - v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; - uFaceID = 58500; - v1->vVelocity.y = v42; - v42 = v1->vVelocity.z; - v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; - v9 = v1->vVelocity.x; - v1->vVelocity.z = v42; - if ( v9 * v9 + v1->vVelocity.y * v1->vVelocity.y < 400 ) - { - v1->vVelocity.z = v8; - v1->vVelocity.y = v8; - v1->vVelocity.x = v8; - if ( !(HIBYTE(v2->uFlags) & 1) ) - return; - memset(&Dst, v8, 0x68u); - v10 = v2->uFlags; - 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; - if ( v10 & 0x200 ) - { - Dst.bFree = 1036; - Dst.uDiffuse = 0xFF3C1Eu; - Dst.flt_28 = 1.0; - v11 = rand(); - v33 = (TEXTURE_TYPE)v8; - v31 = "effpar01"; - } - else - { - if ( v10 & 0x400 ) - { -LABEL_70: - Dst.bFree = 512; - Dst.uDiffuse = rand(); - Dst.timeToLive = 64; - Dst.uTextureID = v8; -LABEL_71: - Dst.flt_28 = 1.0; - goto LABEL_72; - } - Dst.bFree = 1032; - Dst.uDiffuse = rand(); - Dst.flt_28 = 1.0; - v11 = rand(); - v33 = (TEXTURE_TYPE)v8; - v31 = "effpar03"; - } - Dst.timeToLive = (unsigned __int8)(v11 & 0x80) + 128; - Dst.uTextureID = pBitmaps_LOD->LoadTexture(v31, v33); -LABEL_72: - pGame->pParticleEngine->AddParticle(&Dst); - return; - } - goto LABEL_25; - } -} -// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); - -//----- (00471C03) -------------------------------------------------------- -void LayingItem::UpdateObject_fn0_ODM(unsigned int uLayingItemID) -{ - LayingItem *v1; // esi@1 - ObjectDesc *v2; // ebx@1 - signed int v3; // edx@1 - int v4; // ecx@1 - int v5; // ST04_4@1 - int v6; // eax@1 - int v7; // ecx@1 - int v8; // edi@1 - int v9; // eax@4 - __int16 v10; // ax@7 - int v11; // edx@11 - int v12; // ecx@11 - signed int v13; // edx@14 - signed int v14; // edx@16 - int v15; // eax@24 - int v16; // eax@25 - int v17; // ST10_4@25 - signed int v18; // eax@25 - signed int v19; // eax@28 - Actor *v20; // edi@31 - int v21; // eax@41 - int v22; // ecx@43 - __int16 v23; // bx@45 - char v24; // al@46 - signed int i; // edi@50 - int v26; // edi@52 - int v27; // eax@52 - __int16 v28; // cx@55 - int v29; // eax@55 - signed int v30; // edi@59 - BSPModel *v31; // ecx@61 - ODMFace *v32; // edi@61 - int v33; // eax@62 - int v34; // ecx@62 - int v35; // eax@63 - Actor *v36; // ecx@67 - __int16 v37; // ax@67 - int v38; // eax@72 - int v39; // eax@72 - unsigned __int64 v40; // qax@72 - int v41; // eax@72 - unsigned __int8 v42; // sf@74 - unsigned __int8 v43; // of@74 - int v44; // eax@77 - __int16 v45; // bx@81 - int v46; // eax@85 - const char *v47; // [sp-8h] [bp-B0h]@83 - enum TEXTURE_TYPE v48; // [sp-4h] [bp-ACh]@46 - int v49; // [sp+Ch] [bp-9Ch]@52 - int v50; // [sp+10h] [bp-98h]@52 - Vec3_int_ v51; // [sp+14h] [bp-94h]@11 - Particle_ Dst; // [sp+20h] [bp-88h]@45 - unsigned int uLayingItemID_; // [sp+88h] [bp-20h]@1 - int v54; // [sp+8Ch] [bp-1Ch]@1 - int v55; // [sp+90h] [bp-18h]@1 - int v56; // [sp+94h] [bp-14h]@11 - int v57; // [sp+98h] [bp-10h]@1 - int v58; // [sp+9Ch] [bp-Ch]@1 - int v59; // [sp+A0h] [bp-8h]@1 - Actor *v60; // [sp+A4h] [bp-4h]@11 - - uLayingItemID_ = uLayingItemID; - v1 = &pLayingItems[uLayingItemID]; - v58 = 0; - v2 = &pObjectList->pObjects[v1->uObjectDescID]; - v57 = IsTerrainSlopeTooHigh(v1->vPosition.x, v1->vPosition.y); - v3 = v1->vPosition.y; - v4 = v1->vPosition.x; - v5 = v2->uHeight; - v55 = 0; - v6 = sub_46D49E_prolly_get_world_y_under_party(v4, v3, v1->vPosition.z, v5, &v59, &v55, 0); - v7 = v6; - v54 = v6; - v8 = v6 + 1; - if ( v1->vPosition.z <= v6 + 1 ) - { - if ( v59 ) - { - v9 = v6 + 60; - if ( v55 ) - v9 = v7 + 30; - sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v9); - LayingItem::OnItemPickup(uLayingItemID_); - v7 = v54; - } - } - else - { - v58 = 1; - } - v10 = v2->uFlags; - if ( !(v10 & 0x20) ) - { - if ( v58 ) - { - v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); - goto LABEL_13; - } - if ( v57 ) - { - v11 = v1->vPosition.y; - v12 = v1->vPosition.x; - v1->vPosition.z = v8; - ODM_GetTerrainNormalAt(v12, v11, &v51); - v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); - v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16; - v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16); - v1->vVelocity.x += (unsigned int)(v56 * v51.x) >> 16; - v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16); - v1->vVelocity.y += (unsigned int)(v56 * v51.y) >> 16; - v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16); - v1->vVelocity.z += (unsigned int)(v56 * v51.z) >> 16; -LABEL_12: - v7 = v54; - goto LABEL_13; - } - if ( v10 & 0x40 ) - { - if ( v1->vPosition.z < v7 ) - v1->vPosition.z = v8; - if ( !_46BFFA_check_object_intercept(uLayingItemID_, 0) ) - return; - } - v1->vPosition.z = v8; - if ( !(v2->uFlags & 0x80) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) ) - v1->vVelocity.z = 0; - v60 = (Actor *)v1->vVelocity.x; - v55 = 58500; - v60 = (Actor *)((unsigned __int64)(58500i64 * (signed int)v60) >> 16); - v1->vVelocity.x = (signed __int16)v60; - v60 = (Actor *)v1->vVelocity.y; - v60 = (Actor *)((unsigned __int64)(v55 * (signed __int64)(signed int)v60) >> 16); - v55 = 58500; - v1->vVelocity.y = (signed __int16)v60; - v60 = (Actor *)v1->vVelocity.z; - v60 = (Actor *)((unsigned __int64)(v55 * (signed __int64)(signed int)v60) >> 16); - v22 = v1->vVelocity.x; - v1->vVelocity.z = (signed __int16)v60; - if ( v1->vVelocity.y * v1->vVelocity.y + v22 * v22 >= 400 ) - goto LABEL_12; - v1->vVelocity.y = 0; - v1->vVelocity.x = 0; - if ( !(HIBYTE(v2->uFlags) & 1) ) - return; - memset(&Dst, 0, 0x68u); - v23 = v2->uFlags; - 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; - if ( HIBYTE(v23) & 2 ) - { - Dst.bFree = 1036; - Dst.uDiffuse = 16727070; - v24 = rand(); - v48 = (TEXTURE_TYPE)0; -LABEL_83: - v47 = "effpar01"; - } - else - { - if ( HIBYTE(v23) & 4 ) - { - Dst.bFree = 512; - Dst.uDiffuse = rand(); - Dst.timeToLive = 64; - Dst.uTextureID = 0; -LABEL_89: - Dst.flt_28 = 1.0; - pGame->pParticleEngine->AddParticle(&Dst); - return; - } - Dst.bFree = 1032; - Dst.uDiffuse = rand(); - v24 = rand(); - v48 = (TEXTURE_TYPE)0; -LABEL_87: - v47 = "effpar03"; - } - Dst.timeToLive = (unsigned __int8)(v24 & 0x80) + 128; - Dst.uTextureID = pBitmaps_LOD->LoadTexture(v47, v48); - goto LABEL_89; - } -LABEL_13: - if ( v1->vPosition.z > v7 - && (v13 = v1->vPosition.x, v13 >= -32768) - && v13 <= 32768 - && (v14 = v1->vPosition.y, v14 >= -32768) - && v14 <= 32768 - && v1->vPosition.z <= 13000 - || !(v2->uFlags & 0x40) ) - goto LABEL_92; - if ( v1->vPosition.z < v7 ) - v1->vPosition.z = v8; - if ( _46BFFA_check_object_intercept(uLayingItemID_, 0) ) - { -LABEL_92: - stru_721530.field_0 = 0; - v55 = 0; - stru_721530.prolly_normal_d = v2->uRadius; - stru_721530.field_C = v2->uHeight; - stru_721530.field_8 = 0; - stru_721530.field_70 = 0; - while ( 1 ) - { - stru_721530.field_34.x = v1->vPosition.x; - stru_721530.normal.x = stru_721530.field_34.x; - v15 = v1->vPosition.y; - stru_721530.uSectorID = 0; - stru_721530.field_34.y = v15; - stru_721530.normal.y = v15; - stru_721530.field_34.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1; - stru_721530.normal.z = stru_721530.field_34.z; - stru_721530.field_1C = v1->vVelocity.x; - stru_721530.field_20 = v1->vVelocity.y; - stru_721530.field_24 = v1->vVelocity.z; - if ( stru_721530._47050A(0) ) - return; - _46E889_collide_against_bmodels(0); - v16 = WorldPosToGridCellZ(v1->vPosition.y); - v17 = v1->vPosition.x; - v58 = v16; - v18 = WorldPosToGridCellX(v17); - _46E26D_collide_against_sprites(v18, v58); - if ( (v1->field_58_pid & 7) != OBJECT_Player) - _46EF01_collision_chech_player(0); - if ( (v1->field_58_pid & 7) == OBJECT_Actor) - { - v19 = v1->field_58_pid >> 3; - if ( v19 >= 0 ) - { - if ( v19 < (signed int)(uNumActors - 1) ) - { - v56 = 0; - if ( (signed int)uNumActors > 0 ) - { - v60 = pActors; - v20 = &pActors[v19]; - do - { - if ( v20->GetActorsRelation(v60) ) - _46DF1A_collide_against_actor(v56, 0); - ++v56; - ++v60; - } - while ( v56 < (signed int)uNumActors ); - } - } - } - } - else - { - for ( i = 0; i < (signed int)uNumActors; ++i ) - _46DF1A_collide_against_actor(i, 0); - } - v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; - v27 = sub_46D49E_prolly_get_world_y_under_party( - stru_721530.normal2.x, - stru_721530.normal2.y, - stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, - v2->uHeight, - &v49, - &v50, - 0); - if ( v59 && v26 < v27 + 60 ) - { - if ( v50 ) - v44 = v27 + 30; - else - v44 = v54 + 60; - sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v44); - LayingItem::OnItemPickup(uLayingItemID_); - return; - } - if ( stru_721530.field_7C >= stru_721530.field_6C ) - { - v1->vPosition.x = stru_721530.normal2.x; - v1->vPosition.y = stru_721530.normal2.y; - v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; - v1->uSectorID = LOWORD(stru_721530.uSectorID); - if ( !(HIBYTE(v2->uFlags) & 1) ) - return; - memset(&Dst, 0, 0x68u); - v45 = v2->uFlags; - 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; - if ( HIBYTE(v45) & 2 ) - { - Dst.bFree = 1036; - Dst.uDiffuse = 16727070; - v24 = rand(); - v48 = (TEXTURE_TYPE)0; - goto LABEL_83; - } - if ( HIBYTE(v45) & 4 ) - { - Dst.bFree = 512; - v46 = rand(); - Dst.uTextureID = 0; - Dst.uDiffuse = v46; - Dst.timeToLive = 64; - goto LABEL_89; - } - Dst.bFree = 1032; - Dst.uDiffuse = rand(); - v24 = rand(); - v48 = (TEXTURE_TYPE)0; - goto LABEL_87; - } - v60 = (Actor *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); - v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; - v60 = (Actor *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); - v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; - v60 = (Actor *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); - v28 = LOWORD(stru_721530.uSectorID); - v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; - v29 = v1->vPosition.z; - v1->uSectorID = v28; - stru_721530.field_70 += stru_721530.field_7C; - if ( v2->uFlags & 0x40 ) - { - if ( v29 < v54 ) - v1->vPosition.z = v54 + 1; - if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) - return; - } - v30 = (signed int)stru_721530.uFaceID >> 3; - if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) - break; - if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) - { - v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; - v32 = &v31->pFaces[v30 & 0x3F]; - if ( v32->uPolygonType != 3 ) - { - v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y - + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16; - if ( stru_721530.field_64 >> 3 > v56 ) - v56 = stru_721530.field_64 >> 3; - v57 = v32->pFacePlane.vNormal.x; - v57 = (unsigned __int64)(v56 * (signed __int64)v57) >> 16; - v58 = v32->pFacePlane.vNormal.y; - v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16; - v60 = (Actor *)v32->pFacePlane.vNormal.z; - v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)(signed int)v60) >> 16); - v1->vVelocity.x += 2 * v57; - v1->vVelocity.y += 2 * v58; - if ( v32->pFacePlane.vNormal.z <= 32000 ) - { - v37 = 2 * (short)v60; - } - else - { - v36 = v60; - v57 = 32000; - v1->vVelocity.z += (signed __int16)v60; - v58 = (unsigned __int64)(v57 * (signed __int64)(signed int)v36) >> 16; - v37 = (unsigned int)(v57 * (int)v36) >> 16; - } - v1->vVelocity.z += v37; -LABEL_70: - if ( BYTE3(v32->uAttributes) & 0x10 ) - EventProcessor(v32->sCogTriggeredID, 0, 1); - goto LABEL_74; - } - v33 = v31->pVertices.pVertices[v32->pVertexIDs[0]].z; - v34 = v1->vVelocity.x; - v1->vPosition.z = v33 + 1; - if ( v1->vVelocity.y * v1->vVelocity.y + v34 * v34 >= 400 ) - goto LABEL_70; - LOWORD(v35) = 0; - v1->vVelocity.z = 0; - v1->vVelocity.x = 0; - goto LABEL_73; - } -LABEL_74: - v58 = v1->vVelocity.x; - v57 = 58500; - v58 = (unsigned __int64)(58500i64 * v58) >> 16; - v1->vVelocity.x = v58; - v58 = v1->vVelocity.y; - v58 = (unsigned __int64)(v57 * (signed __int64)v58) >> 16; - v57 = 58500; - v1->vVelocity.y = v58; - v58 = v1->vVelocity.z; - v58 = (unsigned __int64)(v57 * (signed __int64)v58) >> 16; - ++v55; - v43 = __OFSUB__(v55, 100); - v42 = v55 - 100 < 0; - v1->vVelocity.z = v58; - if ( !(v42 ^ v43) ) - return; - } - v57 = integer_sqrt(v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x); - v38 = stru_5C6E00->Atan2( - v1->vPosition.x - pLevelDecorations[v30].vPosition.x, - v1->vPosition.y - pLevelDecorations[v30].vPosition.y); - v56 = v38; - v39 = stru_5C6E00->Cos(v38); - v60 = (Actor *)v39; - v40 = v39 * (signed __int64)v57; - v58 = v40 >> 16; - v1->vVelocity.x = WORD1(v40); - v41 = stru_5C6E00->Sin(v56 - stru_5C6E00->uIntegerHalfPi); - v60 = (Actor *)v41; - v35 = (unsigned __int64)(v41 * (signed __int64)v57) >> 16; - v58 = v35; -LABEL_73: - v1->vVelocity.y = v35; - goto LABEL_74; - } -} - - //----- (0047253E) -------------------------------------------------------- void UpdateObjects() @@ -2210,9 +1415,9 @@ //v1 = 0; //v20 = 0; - for (uint i = 0; i < uNumLayingItems; ++i) - { - auto item = pLayingItems + i; + for (uint i = 0; i < uNumSpriteObjects; ++i) + { + auto item = pSpriteObjects + i; v2 = (char *)&item->uSpriteFrameID; //do //{ @@ -2253,7 +1458,7 @@ { v10 = i; LABEL_35: - LayingItem::OnItemPickup(v10); + SpriteObject::OnInteraction(v10); goto LABEL_36; } v11 = v4->uLifetime; @@ -2263,9 +1468,9 @@ { LABEL_22: if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - LayingItem::UpdateObject_fn0_BLV(i); + SpriteObject::UpdateObject_fn0_BLV(i); else - LayingItem::UpdateObject_fn0_ODM(i); + SpriteObject::UpdateObject_fn0_ODM(i); if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) ) goto LABEL_36; v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26)); @@ -2309,7 +1514,7 @@ //v2 += 112; //v1 = v20++ + 1; //} - //while ( v20 < (signed int)uNumLayingItems ); + //while ( v20 < (signed int)uNumSpriteObjects ); } } @@ -3668,7 +2873,7 @@ v37 = WorldPosToGridCellZ(pParty->vPosition.y); v38 = WorldPosToGridCellX(pParty->vPosition.x); _46E26D_collide_against_sprites(v38, v37); - _46ED8A_collide_against_layingItems(4u); + _46ED8A_collide_against_sprite_objects(4u); for ( i = 0; i < (signed int)uNumActors; ++i ) _46DF1A_collide_against_actor(i, 0); if ( stru_721530.field_7C >= stru_721530.field_6C ) @@ -7525,7 +6730,7 @@ if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x20) ) { InitializeActors(); - InitializeLayingItems(); + InitializeSpriteObjects(); } BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; //v5 = 0; @@ -12177,15 +11382,15 @@ signed int y; // [sp+54h] [bp-8h]@24 signed int x; // [sp+58h] [bp-4h]@24 - for (uint i = 0; i < uNumLayingItems; ++i) - { - auto p = pLayingItems + i; + for (uint i = 0; i < uNumSpriteObjects; ++i) + { + auto p = pSpriteObjects + i; if (p->uObjectDescID) { v1 = &pObjectList->pObjects[p->uObjectDescID]; if ( !(v1->uFlags & 1) ) { - if ( ((v2 = p->uItemType, v2 < 1000) || v2 >= 10000) + if ( ((v2 = p->uType, v2 < 1000) || v2 >= 10000) && (v2 < 500 || v2 >= 600) && (v2 < 811 || v2 >= 815) || pGame->pStru6Instance->_4A81CA(p)) @@ -13014,10 +12219,10 @@ if ( bWizardEyeActive = true) { uZe = 0; - //for (uint i = 0; i < uNumLayingItems; ++i) - if (uNumLayingItems > 0) - { - a2c = (char *)&pLayingItems[0].uObjectDescID; + //for (uint i = 0; i < uNumSpriteObjects; ++i) + if (uNumSpriteObjects > 0) + { + a2c = (char *)&pSpriteObjects[0].uObjectDescID; while ( 1 ) { if ( !*((short *)a2c - 1) @@ -13055,7 +12260,7 @@ LABEL_83: ++uZe; a2c += 112; - if ( uZe >= (signed int)uNumLayingItems ) + if ( uZe >= (signed int)uNumSpriteObjects ) { v36 = 255; v33 = 0; @@ -16344,7 +15549,7 @@ int v55; // [sp+28h] [bp-8Ch]@7 unsigned int yaw; // [sp+30h] [bp-84h]@7 int pitch; // [sp+34h] [bp-80h]@7 - //LayingItem a1; // [sp+38h] [bp-7Ch]@12 + //SpriteObject a1; // [sp+38h] [bp-7Ch]@12 int v59; // [sp+A8h] [bp-Ch]@1 int v60; // [sp+ACh] [bp-8h]@1 int spellnum_; // [sp+B0h] [bp-4h]@1 @@ -16401,10 +15606,10 @@ v15 = 1; a7b = v15; - LayingItem a1; // [sp+38h] [bp-7Ch]@12 - //LayingItem::LayingItem(&a1); - - a1.uItemType = stru_4E3ACC[spellnum_].field_0; + SpriteObject a1; // [sp+38h] [bp-7Ch]@12 + //SpriteObject::SpriteObject(&a1); + + a1.uType = stru_4E3ACC[spellnum_].field_0; if ( spellnum_ > 58 ) { if ( spellnum_ == 69 ) @@ -16467,7 +15672,7 @@ if ( (signed int)pObjectList->uNumObjects <= 0 ) goto LABEL_34; v17 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1.uItemType != *(short *)v17 ) + while ( (short)a1.uType != *(short *)v17 ) { ++v16; v17 += 56; @@ -16510,7 +15715,7 @@ else { v22 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1.uItemType != *(short *)v22 ) + while ( (short)a1.uType != *(short *)v22 ) { ++v21; v22 += 56; @@ -16550,7 +15755,7 @@ v19 = (char *)&pObjectList->pObjects->uObjectID; do { - if ( (short)a1.uItemType == *(short *)v19 ) + if ( (short)a1.uType == *(short *)v19 ) goto LABEL_20; ++v16; v19 += 56; @@ -16601,7 +15806,7 @@ if ( (signed int)pObjectList->uNumObjects <= 0 ) goto LABEL_59; v26 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1.uItemType != *(short *)v26 ) + while ( (short)a1.uType != *(short *)v26 ) { ++v25; v26 += 56; @@ -16757,7 +15962,7 @@ default: return; } - while ( (short)a1.uItemType != *(short *)v30 ) + while ( (short)a1.uType != *(short *)v30 ) { ++v29; v30 += 56; @@ -18560,27 +17765,24 @@ //----- (00404828) -------------------------------------------------------- -LayingItem::LayingItem() -{ - LayingItem *v1; // esi@1 - - v1 = this; - v1->field_22_glow_radius_multiplier = 1; - v1->uSoundID = 0; - v1->uFacing = 0; - v1->vVelocity.z = 0; - v1->vVelocity.y = 0; - v1->vVelocity.x = 0; - v1->uItemType = 0; - v1->uObjectDescID = 0; - v1->field_61 = 0; - v1->field_60_distance_related_prolly_lod = 0; - v1->field_20 = 0; - v1->uSpriteFrameID = 0; - v1->field_50 = 0; - v1->field_4C = 0; - v1->field_48 = 0; - v1->field_54 = 0; +SpriteObject::SpriteObject() +{ + field_22_glow_radius_multiplier = 1; + uSoundID = 0; + uFacing = 0; + vVelocity.z = 0; + vVelocity.y = 0; + vVelocity.x = 0; + uType = 0; + uObjectDescID = 0; + field_61 = 0; + field_60_distance_related_prolly_lod = 0; + field_20 = 0; + uSpriteFrameID = 0; + field_50 = 0; + field_4C = 0; + field_48 = 0; + field_54 = 0; }
--- a/mm7_4.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/mm7_4.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -23,7 +23,7 @@ #include "Viewport.h" #include "FrameTableInc.h" #include "Math.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "ObjectList.h" #include "Chest.h" #include "PaletteManager.h" @@ -194,9 +194,9 @@ if ( v1->field_2 & 4 ) { v38 = 0; - if ( (signed int)uNumLayingItems > 0 ) - { - v17 = (char *)&pLayingItems[0].vPosition.y; + if ( (signed int)uNumSpriteObjects > 0 ) + { + v17 = (char *)&pSpriteObjects[0].vPosition.y; do { v18 = abs(v33 - *((int *)v17 - 1)); @@ -228,7 +228,7 @@ ++v38; v17 += 112; } - while ( v38 < (signed int)uNumLayingItems ); + while ( v38 < (signed int)uNumSpriteObjects ); } } v0 = i + 1; @@ -1062,7 +1062,7 @@ unsigned int result; // eax@1 result = uLayingItemID; - if ( pObjectList->pObjects[pLayingItems[uLayingItemID].uObjectDescID].uFlags & 0x10 ) + if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) result = _46BFFA_check_object_intercept(uLayingItemID, a2); return result; } @@ -3401,7 +3401,7 @@ int v39; // edi@111 int v40; // ecx@113 char v41[400]; // [sp+4h] [bp-22Ch]@20 - LayingItem a1; // [sp+194h] [bp-9Ch]@15 + SpriteObject a1; // [sp+194h] [bp-9Ch]@15 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 int v44; // [sp+210h] [bp-20h]@22 int v45; // [sp+214h] [bp-1Ch]@25 @@ -3462,7 +3462,7 @@ } if (pParty->ImmolationActive()) { - //LayingItem::LayingItem(&a1); + //SpriteObject::SpriteObject(&a1); v9 = 0; a3.z = 0; a3.y = 0; @@ -3471,7 +3471,7 @@ a1.field_4C = pParty->pPartyBuffs[10].uPower; a1.field_50 = pParty->ImmolationSkillLevel(); v10 = 0; - a1.uItemType = 1070; + a1.uType = 1070; a1.field_48 = 8; if ( (signed int)pObjectList->uNumObjects <= 0 ) { @@ -13560,10 +13560,10 @@ } while ( v4 < v2->uActorQueueSize ); } - if ( (signed int)uNumLayingItems > 0 ) - { - pAttributes = &pLayingItems[0].uAttributes; - v9 = uNumLayingItems; + if ( (signed int)uNumSpriteObjects > 0 ) + { + pAttributes = &pSpriteObjects[0].uAttributes; + v9 = uNumSpriteObjects; do { v10 = *pAttributes;
--- a/mm7_5.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/mm7_5.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -22,7 +22,7 @@ #include "Viewport.h" #include "FrameTableInc.h" #include "Math.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "ObjectList.h" #include "Chest.h" #include "PaletteManager.h" @@ -1783,7 +1783,7 @@ } if ( v45 == 2 ) { - v47 = (pObjectList->pObjects[pLayingItems[v46].uObjectDescID].uFlags & 0x10) == 0; + v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; //LABEL_400: if ( !v47 ) continue; @@ -4679,7 +4679,7 @@ char *v1; // esi@2 int v2; // ecx@3 signed int v3; // eax@3 - LayingItem *v4; // eax@4 + SpriteObject *v4; // eax@4 signed int v5; // eax@4 signed int v6; // eax@6 unsigned int v7; // edi@6 @@ -4711,7 +4711,7 @@ int v33; // ST24_4@29 Vec3_int_ v34; // ST04_12@30 Vec3_int_ *v35; // eax@31 - LayingItem *v36; // [sp+0h] [bp-28h]@0 + SpriteObject *v36; // [sp+0h] [bp-28h]@0 signed int v37; // [sp+4h] [bp-24h]@5 int v38; // [sp+4h] [bp-24h]@15 signed int v39; // [sp+8h] [bp-20h]@3 @@ -4738,7 +4738,7 @@ v39 = (signed int)*((short *)v1 - 300) >> 3; if ( v2 == 2 ) { - v4 = &pLayingItems[v3]; + v4 = &pSpriteObjects[v3]; v36 = v4; v5 = v4->field_58_pid; v2 = v5 & 7; @@ -4904,12 +4904,12 @@ void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) { //signed int v3; // eax@1 - LayingItem *v4; // ebx@1 + SpriteObject *v4; // ebx@1 //int v5; // edx@3 //bool uPlayerID; // eax@3 //Player *pPlayer; // edi@4 Actor *pMonster; // esi@7 - LayingItem *v9; // ebx@12 + SpriteObject *v9; // ebx@12 int v10; // eax@12 int v11; // ebx@12 unsigned int v12; // ecx@12 @@ -4978,7 +4978,7 @@ v62 = 0; if ( (a1 & 7) == OBJECT_Item) { - v4 = &pLayingItems[a1 >> 3]; + v4 = &pSpriteObjects[a1 >> 3]; //uDamageAmount = (int)v4; v61 = v4->field_60_distance_related_prolly_lod; a1 = v4->field_58_pid; @@ -5054,7 +5054,7 @@ v61 = v4->field_60_distance_related_prolly_lod; if ( !v19 ) { - v9 = (LayingItem *)uDamageAmount; + v9 = (SpriteObject *)uDamageAmount; v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); //v55 = abs(v50); pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y); @@ -5094,7 +5094,7 @@ { v61 = 1; } - v4 = (LayingItem *)uDamageAmount; + v4 = (SpriteObject *)uDamageAmount; } v15 = v4->field_48; @@ -5409,7 +5409,7 @@ int v34; // edi@61 int v35; // eax@70 double v36; // st7@70 - LayingItem *v37; // ebx@77 + SpriteObject *v37; // ebx@77 int v38; // edi@77 int v39; // esi@77 int v40; // eax@77 @@ -5650,7 +5650,7 @@ viewparams->bRedrawGameUI = 1; return; } - v37 = &pLayingItems[uActorID]; + v37 = &pSpriteObjects[uActorID]; v38 = v37->field_58_pid & 7; v39 = v37->field_58_pid >> 3; v40 = v37->field_58_pid & 7; @@ -5666,8 +5666,8 @@ a4 = stru_50C198.which_player_would_attack(v44); v45 = &pParty->pPlayers[a4]; v77 = Actor::_43B3E0_CalcDamage(v44, v74); - v46 = v37->uItemType; - if ( v37->uItemType == 545 ) + v46 = v37->uType; + if ( v37->uType == 545 ) { LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); v52 = v51; @@ -5892,29 +5892,29 @@ v6 = uLayingItemID; v2 = uLayingItemID; v3 = a2 >> 3; - v4 = pLayingItems[uLayingItemID].field_58_pid & 7; + v4 = pSpriteObjects[uLayingItemID].field_58_pid & 7; v5 = (a2 & 7) - 3; if ( v5 ) { if ( v5 == 1 ) { - layingitem_vel_50FDFC.x = pLayingItems[v2].vVelocity.x; - layingitem_vel_50FDFC.y = pLayingItems[v2].vVelocity.y; - layingitem_vel_50FDFC.z = pLayingItems[v2].vVelocity.z; + layingitem_vel_50FDFC.x = pSpriteObjects[v2].vVelocity.x; + layingitem_vel_50FDFC.y = pSpriteObjects[v2].vVelocity.y; + layingitem_vel_50FDFC.z = pSpriteObjects[v2].vVelocity.z; Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); - DamagePlayerFromMonster(8 * v6 | 2, pLayingItems[v2].field_61, &layingitem_vel_50FDFC, 0xFFFFFFFFu); - } - } - else - { - layingitem_vel_50FDFC.x = pLayingItems[v2].vVelocity.x; - layingitem_vel_50FDFC.y = pLayingItems[v2].vVelocity.y; - layingitem_vel_50FDFC.z = pLayingItems[v2].vVelocity.z; + DamagePlayerFromMonster(8 * v6 | 2, pSpriteObjects[v2].field_61, &layingitem_vel_50FDFC, 0xFFFFFFFFu); + } + } + else + { + layingitem_vel_50FDFC.x = pSpriteObjects[v2].vVelocity.x; + layingitem_vel_50FDFC.y = pSpriteObjects[v2].vVelocity.y; + layingitem_vel_50FDFC.z = pSpriteObjects[v2].vVelocity.z; Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); switch ( v4 ) { case OBJECT_Actor: - sub_43B1B0(8 * v6 | AI_OBJECT_LAYING_ITEM, v3, &layingitem_vel_50FDFC, pLayingItems[v2].field_61); + sub_43B1B0(8 * v6 | AI_OBJECT_LAYING_ITEM, v3, &layingitem_vel_50FDFC, pSpriteObjects[v2].field_61); break; case OBJECT_Player: DamageMonsterFromParty(8 * v6 | AI_OBJECT_LAYING_ITEM, v3, &layingitem_vel_50FDFC); @@ -6053,7 +6053,7 @@ void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) { Actor *pActor; // esi@1 - LayingItem *v4; // eax@3 + SpriteObject *v4; // eax@3 int v5; // ecx@3 int v6; // eax@4 int v7; // edi@4 @@ -6068,7 +6068,7 @@ { if ( (a2 & 7) == OBJECT_Item) { - v4 = &pLayingItems[(signed int)a2 >> 3]; + v4 = &pSpriteObjects[(signed int)a2 >> 3]; v5 = v4->field_48; if ( v5 ) { @@ -6108,7 +6108,7 @@ void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) { int v4; // ebx@1 - LayingItem *v5; // eax@2 + SpriteObject *v5; // eax@2 bool v6; // eax@3 Actor *v7; // esi@4 Actor *v8; // edi@4 @@ -6127,7 +6127,7 @@ v17 = a1; if ( (a1 & 7) == OBJECT_Item) { - v5 = &pLayingItems[a1 >> 3]; + v5 = &pSpriteObjects[a1 >> 3]; v4 = v5->field_60_distance_related_prolly_lod; v17 = v5->field_58_pid; } @@ -10844,10 +10844,10 @@ else { v10 = v2; - v63 = pLayingItems[v10].vPosition.x; - v64 = pLayingItems[v10].vPosition.y; - v11 = pLayingItems[v10].vPosition.z; - v7 = pLayingItems[v10].uSectorID; + v63 = pSpriteObjects[v10].vPosition.x; + v64 = pSpriteObjects[v10].vPosition.y; + v11 = pSpriteObjects[v10].vPosition.z; + v7 = pSpriteObjects[v10].uSectorID; v65 = v11; } v66 = v7; @@ -10893,10 +10893,10 @@ else { v22 = v12; - v18 = pLayingItems[v22].vPosition.x; - v17 = pLayingItems[v22].vPosition.z; - v60 = pLayingItems[v22].vPosition.y; - v19 = pLayingItems[v22].uSectorID; + v18 = pSpriteObjects[v22].vPosition.x; + v17 = pSpriteObjects[v22].vPosition.z; + v60 = pSpriteObjects[v22].vPosition.y; + v19 = pSpriteObjects[v22].uSectorID; } v62 = v19; v23 = v18 - v63; @@ -12116,15 +12116,15 @@ } //----- (00408896) -------------------------------------------------------- -void InitializeLayingItems() -{ - for (uint i = 0; i < uNumLayingItems; ++i) - { - auto item = pLayingItems + i; - - if (item->uItemType && - (item->uSoundID & 8 || pObjectList->pObjects[item->uItemType].uFlags & 0x10)) - LayingItem::OnItemPickup(i); +void InitializeSpriteObjects() +{ + for (uint i = 0; i < uNumSpriteObjects; ++i) + { + auto item = pSpriteObjects + i; + + if (item->uType && + (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & 0x10)) + SpriteObject::OnInteraction(i); } for (uint i = 0; i < 100; ++i) @@ -16426,9 +16426,9 @@ goto LABEL_132; } v7 = v6 >> 3; - if ( pObjectList->pObjects[pLayingItems[v7].uObjectDescID].uFlags & 0x10 ) + if ( pObjectList->pObjects[pSpriteObjects[v7].uObjectDescID].uFlags & 0x10 ) goto LABEL_132; - v8 = &pLayingItems[v7].stru_24; + v8 = &pSpriteObjects[v7].stru_24; } GameUI_DrawItemInfo(v8); goto LABEL_132;
--- a/mm7_6.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/mm7_6.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -20,7 +20,7 @@ #include "Viewport.h" #include "FrameTableInc.h" #include "Math.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "ObjectList.h" #include "Chest.h" #include "PaletteManager.h" @@ -2578,9 +2578,9 @@ //unsigned __int64 v28; // qax@102 int v29; // ecx@105 int v30; // ecx@106 - int v31; // eax@112 - int v32; // eax@112 - char *v33; // edx@113 + //int v31; // eax@112 + //int v32; // eax@112 + //char *v33; // edx@113 int v34; // eax@121 int v35; // eax@123 int v36; // edx@125 @@ -3269,7 +3269,7 @@ signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 char *y; // [sp+DD4h] [bp-B0h]@325 int v721; // [sp+DD8h] [bp-ACh]@163 - //LayingItem a1; // [sp+DDCh] [bp-A8h]@1 + //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 int v723; // [sp+E4Ch] [bp-38h]@1 ItemGen *_this; // [sp+E50h] [bp-34h]@23 float v725; // [sp+E54h] [bp-30h]@23 @@ -3291,8 +3291,8 @@ v711 = ecx0; - LayingItem a1; // [sp+DDCh] [bp-A8h]@1 - //LayingItem::LayingItem(&a1); + SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 + //SpriteObject::SpriteObject(&a1); //v1 = 0; v2 = 0; @@ -3336,8 +3336,8 @@ } - a1.uItemType = stru_4E3ACC[v3->spellnum].field_0; - if (a1.uItemType) + a1.uType = stru_4E3ACC[v3->spellnum].field_0; + if (a1.uType) { if ( (a2 & 7) == OBJECT_Actor) { @@ -3460,8 +3460,9 @@ switch ( v3->spellnum ) { + case SPELL_101: + assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); case SPELL_BOW_ARROW: - case SPELL_101: v17 = pPlayer; _this = (ItemGen *)1; if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) @@ -3472,7 +3473,7 @@ a1.field_4C = v2; a1.field_48 = v18; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); if ( v17->WearsItem(510, 2) ) a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); a1.vPosition.x = pParty->vPosition.x; @@ -3513,7 +3514,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v723; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.x = pParty->vPosition.x; a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = 0; @@ -3565,7 +3566,7 @@ pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); goto LABEL_1056; - case 7: + case SPELL_FIRE_FIRE_SPIKE: v29 = v12 - 2; if ( v29 ) { @@ -3586,14 +3587,19 @@ { amount = 5; } - v31 = v3->uPlayerID; + //v31 = v3->uPlayerID; + //v32 = 8 * v31; + //LOBYTE(v32) = v32 | OBJECT_Player; + + //if ( (signed int)uNumSpriteObjects > 0 ) HIDWORD(v733) = 0; - v32 = 8 * v31; - LOBYTE(v32) = v32 | OBJECT_Player; - if ( (signed int)uNumLayingItems > 0 ) - { - v33 = (char *)&pLayingItems[0].field_48; - v730 = uNumLayingItems; + for (uint i = 0; i < uNumSpriteObjects; ++i) + { + auto object = pSpriteObjects + i; + if (object->uType && object->field_48 == 7 && object->field_58_pid == 8 * (int)v3->uPlayerID | OBJECT_Player) + ++HIDWORD(v733); + /*v33 = (char *)&pSpriteObjects[0].field_48; + v730 = uNumSpriteObjects; do { if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) @@ -3601,17 +3607,18 @@ v33 += 112; --v730; } - while ( v730 ); + while ( v730 );*/ } if ( SHIDWORD(v733) > amount ) goto LABEL_200; if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto play_sound_and_continue; + a1.stru_24.Reset(); a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = 0; @@ -3648,7 +3655,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -3687,7 +3694,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -3724,7 +3731,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.x = *(short *)(HIDWORD(v733) + 142); a1.vPosition.y = *(short *)(HIDWORD(v733) + 144); v48 = *(short *)(HIDWORD(v733) + 138); @@ -3769,7 +3776,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = 0; @@ -3801,7 +3808,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; a1.vPosition.y = pParty->vPosition.y; v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; @@ -3908,14 +3915,14 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uItemType); + v60 = pObjectList->ObjectIDByItemID(a1.uType); v61 = a2 >> 3; goto LABEL_1086; case 92: if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto play_sound_and_continue; a1.stru_24.Reset(); - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.x = pParty->vPosition.x; a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = 0; @@ -4310,7 +4317,7 @@ a1.field_48 = *(int *)HIDWORD(v733); a1.field_4C = v723; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -4492,7 +4499,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.vPosition.x = uRequiredMana; a1.vPosition.y = LODWORD(v727); @@ -4539,7 +4546,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -4662,7 +4669,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = 0; @@ -4856,7 +4863,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.vPosition.x = LODWORD(v718); a1.vPosition.y = v713; @@ -4945,7 +4952,7 @@ a1.field_48 = v3->spellnum; a1.field_50 = v731; a1.field_4C = v2; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.y = pParty->vPosition.y; v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; @@ -4983,7 +4990,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = 0; @@ -5560,7 +5567,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = 0; @@ -5588,12 +5595,12 @@ goto LABEL_200; if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto play_sound_and_continue; - a1.uItemType = 4090; + a1.uType = 4090; a1.stru_24.Reset(); a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.x = pParty->vPosition.x; a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = 0; @@ -5780,12 +5787,12 @@ goto play_sound_and_continue; v726 = (Player *)sub_46A6AC((int)dword_50BF30, 100, 4096); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); - ++a1.uItemType; + ++a1.uType; a1.stru_24.Reset(); a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -6120,7 +6127,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.x = *(short *)(v730 + 142); a1.vPosition.y = *(short *)(v730 + 144); v676 = *(short *)(v730 + 138); @@ -6166,7 +6173,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uItemType); + v60 = pObjectList->ObjectIDByItemID(a1.uType); v61 = v426; goto LABEL_1086; case 66: @@ -6192,7 +6199,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uItemType); + v60 = pObjectList->ObjectIDByItemID(a1.uType); v61 = v427; goto LABEL_1086; case 63: @@ -6206,12 +6213,12 @@ goto play_sound_and_continue; v726 = (Player *)sub_46A6AC((int)dword_50BF30, 100, 4096); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); - ++a1.uItemType; + ++a1.uType; a1.stru_24.Reset(); a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -6300,7 +6307,7 @@ v445 = a2 >> 3; if ( (a2 & 7) == OBJECT_Item) { - v449 = (char *)&pLayingItems[v445].stru_24; + v449 = (char *)&pSpriteObjects[v445].stru_24; v450 = *(int *)v449; if ( pItemsTable->pItems[v450].uEquipType == 18 ) { @@ -6311,10 +6318,10 @@ { sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); ShowStatusBarString(pTmpBuf2, 2u); - if ( !pParty->AddItem(&pLayingItems[v445].stru_24) ) - pParty->SetHoldingItem(&pLayingItems[v445].stru_24); + if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) + pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); } - LayingItem::OnItemPickup(v445); + SpriteObject::OnInteraction(v445); } else { @@ -6626,7 +6633,7 @@ pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); - ++a1.uItemType; + ++a1.uType; HIDWORD(v733) = v505; v690 = 0; v689 = 0; @@ -6635,7 +6642,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -6789,7 +6796,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto play_sound_and_continue; v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); - ++a1.uItemType; + ++a1.uType; v726 = (Player *)v531; v696 = 0; v695 = 0; @@ -6798,7 +6805,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -7014,12 +7021,12 @@ v721 = v578; if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) goto LABEL_200; - ++a1.uItemType; + ++a1.uType; a1.stru_24.Reset(); a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -7118,7 +7125,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.vPosition.x = pParty->vPosition.x; a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = 0; @@ -7192,7 +7199,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uItemType); + v60 = pObjectList->ObjectIDByItemID(a1.uType); v61 = v599; LABEL_1086: v600 = pActors[v61].vPosition.y; @@ -7340,7 +7347,7 @@ a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); + a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; @@ -8114,131 +8121,6 @@ return result; } -//----- (0042F5ED) -------------------------------------------------------- -int LayingItem::Create(int yaw, int pitch, int a4, int a5) -{ - LayingItem *v5; // eax@1 - signed int v6; // ebx@2 - char *v7; // ecx@2 - signed int result; // eax@6 - LayingItem *v9; // ebx@7 - int v10; // edx@11 - int v11; // edi@18 - __int16 v12; // ax@18 - int v13; // ST2C_4@20 - int v14; // eax@20 - int v15; // [sp-28h] [bp-38h]@14 - int v16; // [sp-24h] [bp-34h]@11 - Vec3_int_ v17; // [sp-20h] [bp-30h]@11 - int *v18; // [sp-14h] [bp-24h]@11 - int *v19; // [sp-10h] [bp-20h]@11 - int *v20; // [sp-Ch] [bp-1Ch]@11 - signed int v21; // [sp+8h] [bp-8h]@2 - int angle; // [sp+Ch] [bp-4h]@1 - int a4a; // [sp+1Ch] [bp+Ch]@20 - int a4b; // [sp+1Ch] [bp+Ch]@20 - int a5a; // [sp+20h] [bp+10h]@20 - - auto a1 = this; - angle = yaw; - v5 = a1; - if ( !a1->uObjectDescID ) - return -1; - v6 = 0; - v7 = (char *)&pLayingItems[0].uObjectDescID; - v21 = 0; - do - { - if ( !*(short *)v7 ) - break; - v7 += 112; - ++v6; - v21 = v6; - } - while ( (signed int)v7 < (signed int)((char *)&pObjectList->uNumObjects + 2) ); - if ( v6 >= 1000 ) - return -1; - *(int *)&v5->field_62[2] = v5->vPosition.x; - *(int *)&v5->field_62[6] = v5->vPosition.y; - v9 = &pLayingItems[v6]; - *(int *)&v5->field_62[10] = v5->vPosition.z; - memcpy(v9, v5, 0x70u); - if ( a5 == 1 ) - { - v20 = &v9->vPosition.z; - v19 = &v9->vPosition.y; - v18 = (int *)&v9->vPosition; - v17.z = v5->vPosition.z; - *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x; - v16 = 0; - v10 = stru_5C6E00->uIntegerHalfPi + v9->uFacing; - goto LABEL_16; - } - if ( a5 == 2 ) - { - v20 = &v9->vPosition.z; - v19 = &v9->vPosition.y; - v18 = (int *)&v9->vPosition; - v17.z = v5->vPosition.z; - *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x; - v16 = 0; - v10 = stru_5C6E00->uIntegerHalfPi + v9->uFacing; - goto LABEL_14; - } - if ( a5 == 3 ) - { - v20 = &v9->vPosition.z; - v19 = &v9->vPosition.y; - v18 = (int *)&v9->vPosition; - v17.z = v5->vPosition.z; - *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x; - v16 = 0; - v10 = v9->uFacing - stru_5C6E00->uIntegerHalfPi; -LABEL_14: - v15 = 8; -LABEL_17: - Vec3_int_::Rotate(v15, v10, v16, v17, v18, v19, v20); - goto LABEL_18; - } - if ( a5 == 4 ) - { - v20 = &v9->vPosition.z; - v19 = &v9->vPosition.y; - v18 = (int *)&v9->vPosition; - v17.z = v5->vPosition.z; - *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x; - v16 = 0; - v10 = v9->uFacing - stru_5C6E00->uIntegerHalfPi; -LABEL_16: - v15 = 24; - goto LABEL_17; - } -LABEL_18: - v11 = a4; - v12 = 0; - if ( a4 ) - { - a4a = stru_5C6E00->Cos(angle); - v13 = (unsigned __int64)(a4a * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a4b = stru_5C6E00->Sin(angle); - a5a = (unsigned __int64)(a4b * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - v14 = stru_5C6E00->Sin(pitch); - v9->vVelocity.x = (unsigned int)(v13 * v11) >> 16; - v9->vVelocity.y = (unsigned int)(a5a * v11) >> 16; - v12 = (unsigned int)(v14 * v11) >> 16; - } - else - { - v9->vVelocity.y = 0; - v9->vVelocity.x = 0; - } - v9->vVelocity.z = v12; - result = v21; - if ( v21 >= (signed int)uNumLayingItems ) - uNumLayingItems = v21 + 1; - return result; -} - //----- (0042F7EB) -------------------------------------------------------- bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) { @@ -8252,7 +8134,7 @@ int v16; // eax@18 int v17; // edi@20 int v18; // esi@20 - //LayingItem a1a; // [sp+Ch] [bp-78h]@1 + //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 int v21; // [sp+7Ch] [bp-8h]@1 unsigned int v22; // [sp+80h] [bp-4h]@1 @@ -8260,8 +8142,8 @@ v21 = x; v22 = uSpriteID; - LayingItem a1a; // [sp+Ch] [bp-78h]@1 - //LayingItem::LayingItem(&a1a); + SpriteObject a1a; // [sp+Ch] [bp-78h]@1 + //SpriteObject::SpriteObject(&a1a); a1a.stru_24.Reset(); if ( a9 ) @@ -8274,7 +8156,7 @@ a1a.field_4C = 0; a1a.field_48 = 0; a1a.field_54 = 0; - a1a.uItemType = v9; + a1a.uType = v9; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_7: @@ -8366,13 +8248,13 @@ unsigned __int16 v7; // ax@5 signed int v8; // eax@6 signed int v9; // eax@7 - //LayingItem a1; // [sp+Ch] [bp-70h]@1 + //SpriteObject a1; // [sp+Ch] [bp-70h]@1 v3 = x; v4 = y; - LayingItem a1; // [sp+Ch] [bp-70h]@1 - //LayingItem::LayingItem(&a1); + SpriteObject a1; // [sp+Ch] [bp-70h]@1 + //SpriteObject::SpriteObject(&a1); a1.stru_24.Reset(); v5 = 0; @@ -8380,7 +8262,7 @@ a1.field_4C = 0; a1.field_48 = 0; a1.field_54 = 0; - a1.uItemType = 800; + a1.uType = 800; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_5: @@ -8418,18 +8300,18 @@ } //----- (0042FA22) -------------------------------------------------------- -LayingItem *__cdecl sub_42FA22_mess_with_laying_item_list() +SpriteObject *__cdecl sub_42FA22_mess_with_laying_item_list() { size_t v0; // edx@1 int v1; // ebp@1 - LayingItem *result; // eax@1 - LayingItem *v3; // ebx@1 + SpriteObject *result; // eax@1 + SpriteObject *v3; // ebx@1 v0 = 0; v1 = 0; - //result = (char *)&pLayingItems[0].uObjectDescID; - result = pLayingItems; - v3 = pLayingItems; + //result = (char *)&pSpriteObjects[0].uObjectDescID; + result = pSpriteObjects; + v3 = pSpriteObjects; do { if ( result->uObjectDescID ) @@ -8446,8 +8328,8 @@ ++v1; } //while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) ); - while( result <= &pLayingItems[999] ); - uNumLayingItems = v0; + while( result <= &pSpriteObjects[999] ); + uNumSpriteObjects = v0; return result; } @@ -8461,14 +8343,14 @@ int v10; // eax@10 signed int result; // eax@11 __int16 v12; // ax@12 - //LayingItem a1a; // [sp+Ch] [bp-74h]@1 + //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 int v14; // [sp+7Ch] [bp-4h]@1 v6 = a1; v7 = a2; - LayingItem a1a; // [sp+Ch] [bp-74h]@1 - //LayingItem::LayingItem(&a1a); - a1a.uItemType = 600; + SpriteObject a1a; // [sp+Ch] [bp-74h]@1 + //SpriteObject::SpriteObject(&a1a); + a1a.uType = 600; a1a.stru_24.Reset(); a1a.field_48 = 6; @@ -8483,7 +8365,7 @@ else { v8 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1a.uItemType != *(short *)v8 ) + while ( (short)a1a.uType != *(short *)v8 ) { ++v14; v8 += 56;
--- a/mm7_data.h Sat Mar 02 00:24:12 2013 +0600 +++ b/mm7_data.h Sat Mar 02 00:24:27 2013 +0600 @@ -1,7 +1,7 @@ #pragma once #include <string> #include "OSAPI.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "VectorTypes.h" typedef char _UNKNOWN; @@ -1760,7 +1760,7 @@ bool __fastcall sub_4077F1(int a1, int a2, int a3, struct ODMFace *a4, struct BSPVertexBuffer *a5); bool __fastcall sub_407A1C(int x, int z, int y, struct Vec3_int_ v); // idb void InitializeActors(); -void InitializeLayingItems(); +void InitializeSpriteObjects(); int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6); unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors); unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID); @@ -1939,7 +1939,7 @@ signed int __cdecl sub_42F4DA(); bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9); void __fastcall sub_42F960_create_object(int x, int y, int z); // idb -LayingItem *__cdecl sub_42FA22_mess_with_laying_item_list(); +SpriteObject *__cdecl sub_42FA22_mess_with_laying_item_list(); signed int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6); bool __fastcall sub_42FB5C(signed int a1); // int __cdecl crt_sub_42FBB7(); @@ -2165,7 +2165,7 @@ int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1); // idb int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0); int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb -void __fastcall _46ED8A_collide_against_layingItems(unsigned int _this); +void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this); int __thiscall _46EF01_collision_chech_player(int a1); // idb signed int __cdecl _46F04E_collide_against_portals(); void __cdecl BLV_UpdateDoors();
--- a/stru6.cpp Sat Mar 02 00:24:12 2013 +0600 +++ b/stru6.cpp Sat Mar 02 00:24:27 2013 +0600 @@ -1,5 +1,5 @@ #include "stru6.h" -#include "LayingItem.h" +#include "SpriteObject.h" #include "IndoorCameraD3D.h" #include "ParticleEngine.h" #include "Game.h" @@ -146,10 +146,10 @@ } //----- (004A73AA) -------------------------------------------------------- -void stru6::_4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(LayingItem *a2, unsigned int uDiffuse, unsigned int uTextureID) +void stru6::_4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(SpriteObject *a2, unsigned int uDiffuse, unsigned int uTextureID) { stru6 *v4; // edi@1 - LayingItem *v5; // esi@1 + SpriteObject *v5; // esi@1 int v6; // eax@1 stru6_stru2 *v7; // eax@2 double v8; // st7@2 @@ -217,7 +217,7 @@ } //----- (004A75CC) -------------------------------------------------------- -void stru6::_4A75CC_single_spell_collision_particle(LayingItem *a1, unsigned int uDiffuse, unsigned int uTextureID) +void stru6::_4A75CC_single_spell_collision_particle(SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID) { double v4; // st7@1 signed int v5; // edi@1 @@ -246,9 +246,9 @@ } //----- (004A7688) -------------------------------------------------------- -void stru6::_4A7688_fireball_collision_particle(LayingItem *a2) +void stru6::_4A7688_fireball_collision_particle(SpriteObject *a2) { - LayingItem *v2; // esi@1 + SpriteObject *v2; // esi@1 double v3; // st7@1 double v4; // st7@2 double v5; // st7@4 @@ -309,9 +309,9 @@ } //----- (004A77FD) -------------------------------------------------------- -void stru6::_4A77FD_some_stuff_d3d(LayingItem *a1) +void stru6::_4A77FD_some_stuff_d3d(SpriteObject *a1) { - LayingItem *v2; // esi@1 + SpriteObject *v2; // esi@1 stru6 *v3; // edi@1 double v4; // st7@1 double v5; // st7@2 @@ -343,7 +343,7 @@ } //----- (004A78AE) -------------------------------------------------------- -void stru6::_4A78AE_sparks_spell(LayingItem *a1) +void stru6::_4A78AE_sparks_spell(SpriteObject *a1) { ObjectDesc *v2; // esi@1 unsigned int v3; // eax@1 @@ -369,7 +369,7 @@ } //----- (004A7948) -------------------------------------------------------- -void stru6::_4A7948_mind_blast_after_effect(LayingItem *a1) +void stru6::_4A7948_mind_blast_after_effect(SpriteObject *a1) { ObjectDesc *v2; // esi@1 unsigned int v3; // eax@1 @@ -404,7 +404,7 @@ } //----- (004A7A27) -------------------------------------------------------- -bool stru6::AddMobileLight(LayingItem *a1, unsigned int uDiffuse, int uRadius) +bool stru6::AddMobileLight(SpriteObject *a1, unsigned int uDiffuse, int uRadius) { return pMobileLightsStack->AddLight( a1->vPosition.x, @@ -420,7 +420,7 @@ // 4E94D3: using guessed type char byte_4E94D3; //----- (004A7A66) -------------------------------------------------------- -void stru6::_4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(LayingItem *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4) +void stru6::_4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4) { int v5; // eax@1 char v6; // al@1 @@ -488,10 +488,10 @@ } //----- (004A7C07) -------------------------------------------------------- -void stru6::_4A7C07(LayingItem *a2) +void stru6::_4A7C07(SpriteObject *a2) { stru6 *v2; // edi@1 - LayingItem *v3; // esi@1 + SpriteObject *v3; // esi@1 int v4; // eax@1 ObjectDesc *v5; // ebx@1 stru6_stru2 *v6; // eax@2 @@ -563,7 +563,7 @@ } //----- (004A7E05) -------------------------------------------------------- -void stru6::AddProjectile(LayingItem *a2, int a3, unsigned int uTextureID) +void stru6::AddProjectile(SpriteObject *a2, int a3, unsigned int uTextureID) { int v4; // edx@1 float v5; // ST14_4@2 @@ -710,7 +710,7 @@ } //----- (004A80DC) -------------------------------------------------------- -void stru6::_4A80DC_some_stuff_sw(LayingItem *a2) +void stru6::_4A80DC_some_stuff_sw(SpriteObject *a2) { stru6 *v2; // esi@1 signed int v3; // ebx@1 @@ -739,7 +739,7 @@ } //----- (004A81CA) -------------------------------------------------------- -bool stru6::_4A81CA(LayingItem *a2) +bool stru6::_4A81CA(SpriteObject *a2) { stru6 *v2; // ebx@1 int result; // eax@1 @@ -761,7 +761,7 @@ int v19; // eax@141 int v20; // eax@151 unsigned int v21; // [sp-8h] [bp-20h]@66 - LayingItem *v22; // [sp-8h] [bp-20h]@81 + SpriteObject *v22; // [sp-8h] [bp-20h]@81 unsigned int v23; // [sp-4h] [bp-1Ch]@4 unsigned int v24; // [sp-4h] [bp-1Ch]@5 unsigned int v25; // [sp-4h] [bp-1Ch]@30 @@ -779,7 +779,7 @@ __debugbreak(); // need to refactor carefully & collect data v2 = this; - result = a2->uItemType; + result = a2->uType; if ( result <= 545 ) { if ( result != 545 )
--- a/stru6.h Sat Mar 02 00:24:12 2013 +0600 +++ b/stru6.h Sat Mar 02 00:24:27 2013 +0600 @@ -118,21 +118,21 @@ void DoAddProjectile(float srcX, float srcY, float srcZ, float dstX, float dstY, float dstZ, unsigned int uTextureID); void DrawProjectiles(); - void _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(struct LayingItem *a2, unsigned int uDiffuse, unsigned int uTextureID); - void _4A75CC_single_spell_collision_particle(struct LayingItem *a1, unsigned int uDiffuse, unsigned int uTextureID); - void _4A7688_fireball_collision_particle(struct LayingItem *a2); - void _4A77FD_some_stuff_d3d(struct LayingItem *a1); - void _4A78AE_sparks_spell(struct LayingItem *a1); - void _4A7948_mind_blast_after_effect(struct LayingItem *a1); - bool AddMobileLight(struct LayingItem *a1, unsigned int uDiffuse, int uRadius); - void _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(LayingItem *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4); - void _4A7C07(struct LayingItem *a2); - void AddProjectile(struct LayingItem *a2, int a3, unsigned int uTextureID); + 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 _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); + void _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4); + void _4A7C07(struct SpriteObject *a2); + void AddProjectile(struct SpriteObject *a2, int a3, unsigned int uTextureID); void _4A7E89_sparkles_on_actor_after_it_casts_buff(struct Actor *pActor, unsigned int uDiffuse); void _4A7F74(int x, int y, int z); int _4A806F(struct Actor *pActor); - void _4A80DC_some_stuff_sw(struct LayingItem *a2); - bool _4A81CA(struct LayingItem *a2); + void _4A80DC_some_stuff_sw(struct SpriteObject *a2); + bool _4A81CA(struct SpriteObject *a2); void SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID); void FadeScreen__like_Turn_Undead_and_mb_Armageddon(unsigned int uDiffuseColor, unsigned int uFadeTime); int _4A8BFC();