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
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2337
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2337
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2337
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2337
diff changeset
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
Ritor1
parents:
diff changeset
6 #include <string>
Ritor1
parents:
diff changeset
7 #include "Lights.h"
2337
d04017f3d2fa LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents: 2253
diff changeset
8 #include "OSAPI.h"
0
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11 //----- (00467D88) --------------------------------------------------------
Ritor1
parents:
diff changeset
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)
Ritor1
parents:
diff changeset
13 {
Ritor1
parents:
diff changeset
14 if (uNumLightsActive >= 400)
Ritor1
parents:
diff changeset
15 {
Ritor1
parents:
diff changeset
16 MessageBoxW(nullptr, L"Too many mobile lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MobileLightStack.cpp:51", 0);
Ritor1
parents:
diff changeset
17 return false;
Ritor1
parents:
diff changeset
18 }
Ritor1
parents:
diff changeset
19
Ritor1
parents:
diff changeset
20 pLights[uNumLightsActive].vPosition.x = x;
Ritor1
parents:
diff changeset
21 pLights[uNumLightsActive].vPosition.y = y;
Ritor1
parents:
diff changeset
22 pLights[uNumLightsActive].vPosition.z = z;
Ritor1
parents:
diff changeset
23 pLights[uNumLightsActive].uRadius = uRadius;
Ritor1
parents:
diff changeset
24 pLights[uNumLightsActive].field_C = (((uRadius < 0) - 1) & 0x3E) - 31;
Ritor1
parents:
diff changeset
25 pLights[uNumLightsActive].uSectorID = uSectorID;
Ritor1
parents:
diff changeset
26 pLights[uNumLightsActive].field_10 = uRadius * uRadius >> 5;
Ritor1
parents:
diff changeset
27 pLights[uNumLightsActive].uLightColorR = r;
Ritor1
parents:
diff changeset
28 pLights[uNumLightsActive].uLightColorG = g;
Ritor1
parents:
diff changeset
29 pLights[uNumLightsActive].uLightColorB = b;
Ritor1
parents:
diff changeset
30 pLights[uNumLightsActive++].uLightType = uLightType;
Ritor1
parents:
diff changeset
31
Ritor1
parents:
diff changeset
32 return true;
Ritor1
parents:
diff changeset
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
8b04ba723324 misstake in LoadSound
Ritor1
parents: 2415
diff changeset
37 //unsigned int v9; // eax@1
8b04ba723324 misstake in LoadSound
Ritor1
parents: 2415
diff changeset
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
8b04ba723324 misstake in LoadSound
Ritor1
parents: 2415
diff changeset
40 //v9 = this->uNumLightsActive;
8b04ba723324 misstake in LoadSound
Ritor1
parents: 2415
diff changeset
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 }