annotate LightsStack.cpp @ 0:8b8875f5b359

Initial commit
author Nomad
date Fri, 05 Oct 2012 16:07:14 +0200
parents
children 5159d2e6f559
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include <string>
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 #include "Lights.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 //----- (00467D88) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 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)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9 unsigned int v10; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10 int v11; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11 MobileLight *result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12 std::string v13; // [sp-18h] [bp-1Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13 const char *v14; // [sp-8h] [bp-Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14 int v15; // [sp-4h] [bp-8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16 v10 = this->uNumLightsActive;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17 if ( (signed int)v10 >= 400 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 MessageBoxW(nullptr, L"Too many mobile lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MobileLightStack.cpp:51", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24 v11 = uRadius;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25 result = &this->pLights[v10];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26 result->vPosition.x = x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 result->vPosition.y = y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 result->vPosition.z = z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 result->uRadius = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 result->field_C = (((v11 < 0) - 1) & 0x3E) - 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31 result->uSectorID = uSectorID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32 result->field_10 = v11 * v11 >> 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33 result->uLightColorR = r;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 result->uLightColorG = g;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35 result->uLightColorB = b;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 result->field_B = (char)a10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 ++this->uNumLightsActive;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40 return (bool)result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 }