Mercurial > mm7
annotate LightsStack.cpp @ 2486:1e70f8470638
simplified SpriteObject::Create
author | Grumpy7 |
---|---|
date | Sun, 07 Sep 2014 01:36:04 +0200 |
parents | 8b04ba723324 |
children |
rev | line source |
---|---|
2415 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
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
|
5 #define _CRT_SECURE_NO_WARNINGS |
0 | 6 #include <string> |
7 #include "Lights.h" | |
2337
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
8 #include "OSAPI.h" |
0 | 9 |
10 | |
11 //----- (00467D88) -------------------------------------------------------- | |
12 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) | |
13 { | |
14 if (uNumLightsActive >= 400) | |
15 { | |
16 MessageBoxW(nullptr, L"Too many mobile lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MobileLightStack.cpp:51", 0); | |
17 return false; | |
18 } | |
19 | |
20 pLights[uNumLightsActive].vPosition.x = x; | |
21 pLights[uNumLightsActive].vPosition.y = y; | |
22 pLights[uNumLightsActive].vPosition.z = z; | |
23 pLights[uNumLightsActive].uRadius = uRadius; | |
24 pLights[uNumLightsActive].field_C = (((uRadius < 0) - 1) & 0x3E) - 31; | |
25 pLights[uNumLightsActive].uSectorID = uSectorID; | |
26 pLights[uNumLightsActive].field_10 = uRadius * uRadius >> 5; | |
27 pLights[uNumLightsActive].uLightColorR = r; | |
28 pLights[uNumLightsActive].uLightColorG = g; | |
29 pLights[uNumLightsActive].uLightColorB = b; | |
30 pLights[uNumLightsActive++].uLightType = uLightType; | |
31 | |
32 return true; | |
33 } | |
2337
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
34 |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
35 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
|
36 { |
2416 | 37 //unsigned int v9; // eax@1 |
38 //std::string v11; // [sp-18h] [bp-18h]@3 | |
2337
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
39 |
2416 | 40 //v9 = this->uNumLightsActive; |
41 if ( (signed int)this->uNumLightsActive >= 400 ) | |
2337
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 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
|
44 return false; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
45 } |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
46 |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
47 StationaryLight* pLight = &pLights[uNumLightsActive++]; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
48 pLight->vPosition.x = x; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
49 pLight->vPosition.y = y; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
50 pLight->vPosition.z = z; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
51 pLight->uRadius = a5; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
52 pLight->uLightColorR = (unsigned __int8)r; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
53 pLight->uLightColorG = g; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
54 pLight->uLightColorB = b; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
55 pLight->uLightType = uLightType; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
56 return true; |
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2253
diff
changeset
|
57 } |