view LightsStack.cpp @ 14:b47e9c80e741

On UI
author Nomad
date Sat, 13 Oct 2012 17:09:02 +0200
parents 8b8875f5b359
children 5159d2e6f559
line wrap: on
line source

#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;
}