summaryrefslogtreecommitdiffstats
path: root/src/rw
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/rw/Lights.cpp6
-rw-r--r--src/rw/RwHelper.cpp11
-rw-r--r--src/rw/VisibilityPlugins.cpp2
3 files changed, 16 insertions, 3 deletions
diff --git a/src/rw/Lights.cpp b/src/rw/Lights.cpp
index 8f7f92b6..cd45b81f 100644
--- a/src/rw/Lights.cpp
+++ b/src/rw/Lights.cpp
@@ -86,9 +86,9 @@ SetLightsWithTimeOfDayColour(RpWorld *)
RwFrameTransform(RpLightGetFrame(pDirect), &mat, rwCOMBINEREPLACE);
}
- if(CMenuManager::m_PrefsBrightness > 256){
- float f1 = 2.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
- float f2 = 3.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
+ if(FrontEndMenuManager.m_PrefsBrightness > 256){
+ float f1 = 2.0f * (FrontEndMenuManager.m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
+ float f2 = 3.0f * (FrontEndMenuManager.m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
AmbientLightColourForFrame.red = Min(1.0f, AmbientLightColourForFrame.red * f2);
AmbientLightColourForFrame.green = Min(1.0f, AmbientLightColourForFrame.green * f2);
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 91916df3..a87874d7 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -60,6 +60,16 @@ void FlushObrsPrintfs()
void *
RwMallocAlign(RwUInt32 size, RwUInt32 align)
{
+#ifdef FIX_BUGS
+ uintptr ptralign = align-1;
+ void *mem = (void *)malloc(size + sizeof(uintptr) + ptralign);
+
+ ASSERT(mem != nil);
+
+ void *addr = (void *)((((uintptr)mem) + sizeof(uintptr) + ptralign) & ~ptralign);
+
+ ASSERT(addr != nil);
+#else
void *mem = (void *)malloc(size + align);
ASSERT(mem != nil);
@@ -67,6 +77,7 @@ RwMallocAlign(RwUInt32 size, RwUInt32 align)
void *addr = (void *)((((uintptr)mem) + align) & ~(align - 1));
ASSERT(addr != nil);
+#endif
*(((void **)addr) - 1) = mem;
diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index 5a94e8f6..cff1ff16 100644
--- a/src/rw/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
@@ -139,6 +139,8 @@ static float PitchToCamera;
void
CVisibilityPlugins::SetupVehicleVariables(RpClump *vehicle)
{
+ if (RwObjectGetType((RwObject*)vehicle) != rpCLUMP)
+ return;
DistToCameraSq = GetDistanceSquaredFromCamera(RpClumpGetFrame(vehicle));
RwV3d distToCam;
RwV3dSub(&distToCam, ms_pCameraPosn, &RwFrameGetMatrix(RpClumpGetFrame(vehicle))->pos);