Mercurial > mm7
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 | 2 #include <string> |
3 #include "Lights.h" | |
2337
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
4 #include "OSAPI.h" |
0 | 5 |
6 | |
7 //----- (00467D88) -------------------------------------------------------- | |
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) | |
9 { | |
10 if (uNumLightsActive >= 400) | |
11 { | |
12 MessageBoxW(nullptr, L"Too many mobile lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MobileLightStack.cpp:51", 0); | |
13 return false; | |
14 } | |
15 | |
16 pLights[uNumLightsActive].vPosition.x = x; | |
17 pLights[uNumLightsActive].vPosition.y = y; | |
18 pLights[uNumLightsActive].vPosition.z = z; | |
19 pLights[uNumLightsActive].uRadius = uRadius; | |
20 pLights[uNumLightsActive].field_C = (((uRadius < 0) - 1) & 0x3E) - 31; | |
21 pLights[uNumLightsActive].uSectorID = uSectorID; | |
22 pLights[uNumLightsActive].field_10 = uRadius * uRadius >> 5; | |
23 pLights[uNumLightsActive].uLightColorR = r; | |
24 pLights[uNumLightsActive].uLightColorG = g; | |
25 pLights[uNumLightsActive].uLightColorB = b; | |
26 pLights[uNumLightsActive++].uLightType = uLightType; | |
27 | |
28 return true; | |
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 } |