Mercurial > might-and-magic-trilogy
diff LightsStack.cpp @ 0:8b8875f5b359
Initial commit
author | Nomad |
---|---|
date | Fri, 05 Oct 2012 16:07:14 +0200 |
parents | |
children | 5159d2e6f559 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LightsStack.cpp Fri Oct 05 16:07:14 2012 +0200 @@ -0,0 +1,41 @@ +#include <string> +#include "Lights.h" + +#include "mm7_data.h" + +//----- (00467D88) -------------------------------------------------------- +bool LightsStack_MobileLight_::AddLight(__int16 x, __int16 y, __int16 z, __int16 uSectorID, int uRadius, unsigned __int8 r, unsigned __int8 g, unsigned __int8 b, int *a10) +{ + unsigned int v10; // eax@1 + int v11; // esi@2 + MobileLight *result; // eax@2 + std::string v13; // [sp-18h] [bp-1Ch]@3 + const char *v14; // [sp-8h] [bp-Ch]@3 + int v15; // [sp-4h] [bp-8h]@3 + + v10 = this->uNumLightsActive; + if ( (signed int)v10 >= 400 ) + { + MessageBoxW(nullptr, L"Too many mobile lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MobileLightStack.cpp:51", 0); + result = 0; + } + else + { + v11 = uRadius; + result = &this->pLights[v10]; + result->vPosition.x = x; + result->vPosition.y = y; + result->vPosition.z = z; + result->uRadius = v11; + result->field_C = (((v11 < 0) - 1) & 0x3E) - 31; + result->uSectorID = uSectorID; + result->field_10 = v11 * v11 >> 5; + result->uLightColorR = r; + result->uLightColorG = g; + result->uLightColorB = b; + result->field_B = (char)a10; + ++this->uNumLightsActive; + LOBYTE(result) = 1; + } + return (bool)result; +}