Skip to content

Commit

Permalink
Fixed #55 and #87
Browse files Browse the repository at this point in the history
  • Loading branch information
HumanGamer committed May 30, 2021
1 parent 4f8fa1a commit 8538a42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 16 additions & 3 deletions engine/source/terrain/sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ void Sun::onRemove()
// gClientSceneGraph->getLightManager()->sgUnregisterGlobalLight(&mLight);
}

struct SunLight
{
Point3F mPos;
VectorF mDirection;
ColorF mColor;
ColorF mAmbient;
};

void Sun::registerLights(LightManager* lightManager, bool relight)
{
mRegisteredLight = mLight;
Expand All @@ -92,12 +100,17 @@ void Sun::registerLights(LightManager* lightManager, bool relight)
#ifdef MB_ULTRA_PREVIEWS
// This code is not here on MBU x360 but it achieves the same result.
// It likely works on x360 just because it uses the old TSE 0.1 render system.
static LightInfo previewSun = mRegisteredLight;
static SunLight previewSun = {mRegisteredLight.mPos, mRegisteredLight.mDirection, mRegisteredLight.mColor, mRegisteredLight.mAmbient};

if (gSPMode)
previewSun = mRegisteredLight;
previewSun = {mRegisteredLight.mPos, mRegisteredLight.mDirection, mRegisteredLight.mColor, mRegisteredLight.mAmbient};
else
mRegisteredLight = previewSun;
{
mRegisteredLight.mPos = previewSun.mPos;
mRegisteredLight.mDirection = previewSun.mDirection;
mRegisteredLight.mColor = previewSun.mColor;
mRegisteredLight.mAmbient = previewSun.mAmbient;
}
#endif

if (relight)
Expand Down
2 changes: 2 additions & 0 deletions game/marble/client/scripts/playerList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ function handleUpdateLobbyStatus(%msgType, %msgString, %inLobby)
if (!$Client::connectedMultiplayer)
// don't care
return;

registerLights();

%wasInLobby = ServerConnection.inLobby;
ServerConnection.inLobby = %inLobby;
Expand Down

0 comments on commit 8538a42

Please sign in to comment.