annotate LightsStack.cpp @ 2383:342b73a61a60

sub_407A1C - refactoring min-max
author zipi
date Sun, 22 Jun 2014 14:39:50 +0100
parents d04017f3d2fa
children f4af3b203f65
rev   line source
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 1262
diff changeset
1 #define _CRT_SECURE_NO_WARNINGS
0
Ritor1
parents:
diff changeset
2 #include <string>
Ritor1
parents:
diff changeset
3 #include "Lights.h"
2337
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
4 #include "OSAPI.h"
0
Ritor1
parents:
diff changeset
5
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7 //----- (00467D88) --------------------------------------------------------
Ritor1
parents:
diff changeset
8 bool LightsStack_MobileLight_::AddLight(__int16 x, __int16 y, __int16 z, __int16 uSectorID, int uRadius, unsigned __int8 r, unsigned __int8 g, unsigned __int8 b, char uLightType)
Ritor1
parents:
diff changeset
9 {
Ritor1
parents:
diff changeset
10 if (uNumLightsActive >= 400)
Ritor1
parents:
diff changeset
11 {
Ritor1
parents:
diff changeset
12 MessageBoxW(nullptr, L"Too many mobile lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MobileLightStack.cpp:51", 0);
Ritor1
parents:
diff changeset
13 return false;
Ritor1
parents:
diff changeset
14 }
Ritor1
parents:
diff changeset
15
Ritor1
parents:
diff changeset
16 pLights[uNumLightsActive].vPosition.x = x;
Ritor1
parents:
diff changeset
17 pLights[uNumLightsActive].vPosition.y = y;
Ritor1
parents:
diff changeset
18 pLights[uNumLightsActive].vPosition.z = z;
Ritor1
parents:
diff changeset
19 pLights[uNumLightsActive].uRadius = uRadius;
Ritor1
parents:
diff changeset
20 pLights[uNumLightsActive].field_C = (((uRadius < 0) - 1) & 0x3E) - 31;
Ritor1
parents:
diff changeset
21 pLights[uNumLightsActive].uSectorID = uSectorID;
Ritor1
parents:
diff changeset
22 pLights[uNumLightsActive].field_10 = uRadius * uRadius >> 5;
Ritor1
parents:
diff changeset
23 pLights[uNumLightsActive].uLightColorR = r;
Ritor1
parents:
diff changeset
24 pLights[uNumLightsActive].uLightColorG = g;
Ritor1
parents:
diff changeset
25 pLights[uNumLightsActive].uLightColorB = b;
Ritor1
parents:
diff changeset
26 pLights[uNumLightsActive++].uLightType = uLightType;
Ritor1
parents:
diff changeset
27
Ritor1
parents:
diff changeset
28 return true;
Ritor1
parents:
diff changeset
29 }
2337
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
30
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
31 bool LightsStack_StationaryLight_::AddLight( __int16 x, __int16 y, __int16 z, __int16 a5, unsigned char r, unsigned char g, unsigned char b, char uLightType )
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
32 {
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
33 unsigned int v9; // eax@1
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
34 std::string v11; // [sp-18h] [bp-18h]@3
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
35
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
36 v9 = this->uNumLightsActive;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
37 if ( (signed int)v9 >= 400 )
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
38 {
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
39 MessageBoxW(nullptr, L"Too many stationary lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\StationaryLightStack.cpp:45", 0);
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
40 return false;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
41 }
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
42
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
43 StationaryLight* pLight = &pLights[uNumLightsActive++];
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
44 pLight->vPosition.x = x;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
45 pLight->vPosition.y = y;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
46 pLight->vPosition.z = z;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
47 pLight->uRadius = a5;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
48 pLight->uLightColorR = (unsigned __int8)r;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
49 pLight->uLightColorG = g;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
50 pLight->uLightColorB = b;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
51 pLight->uLightType = uLightType;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
52 return true;
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
53 }