Mercurial > might-and-magic-trilogy
view LayingItem.cpp @ 59:5159d2e6f559
BLV render
author | Nomad |
---|---|
date | Fri, 26 Oct 2012 02:38:26 +0200 |
parents | 41cbaabde2cb |
children | 8be5293b6b33 |
line wrap: on
line source
#include "LayingItem.h" #include "Party.h" #include "TurnEngine.h" #include "MapInfo.h" #include "mm7_data.h" size_t uNumLayingItems; LayingItem pLayingItems[1000]; //----- (00438E35) -------------------------------------------------------- __int16 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->field_2E ) { do { ++v17; v11 += rand() % 20 + 1; } while ( v17 < pMapInfo->field_2E ); } 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 v10; v18 = 8; break; } v12 = &pPlayers[1]; do { if ( (*v12)->CanAct() && (v13 = (*v12)->GetPerception() + 20, rand() % v13 > 20) ) LOWORD(v10) = (*v12)->PlaySound(6, 0); else LOWORD(v10) = (*v12)->ReceiveDamage(v11, v18); ++v12; } while ( (signed int)v12 <= (signed int)&pPlayers[4] ); } return v10; } //----- (0042F933) -------------------------------------------------------- void LayingItem::_42F933(unsigned int uLayingItemID) { unsigned int v1; // ecx@1 unsigned __int16 *pAttributes; // ecx@2 unsigned __int16 v3; // ax@2 v1 = uLayingItemID; pLayingItems[v1].uObjectDescID = 0; if ( pParty->bTurnBasedModeOn == 1 ) { pAttributes = &pLayingItems[v1].uAttributes; v3 = *pAttributes; if ( *pAttributes & 4 ) { LOBYTE(v3) = v3 & 0xFB; --pTurnEngine->field_1C; *pAttributes = v3; } } }