mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-13 05:57:05 +03:00
Don't add same renderer objects on frameskip, fix room light collection
This commit is contained in:
parent
13dbbe2dc9
commit
ea69f610fa
11 changed files with 161 additions and 104 deletions
|
@ -97,7 +97,7 @@ short NextFxFree;
|
||||||
int DrawPhase()
|
int DrawPhase()
|
||||||
{
|
{
|
||||||
g_Renderer.Draw();
|
g_Renderer.Draw();
|
||||||
Camera.numberFrames = g_Renderer.SyncRenderer();
|
Camera.numberFrames = g_Renderer.Sync();
|
||||||
return Camera.numberFrames;
|
return Camera.numberFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,9 @@ GameStatus ControlPhase(int numFrames, int demoMode)
|
||||||
|
|
||||||
g_GameStringsHandler->ProcessDisplayStrings(DELTA_TIME);
|
g_GameStringsHandler->ProcessDisplayStrings(DELTA_TIME);
|
||||||
|
|
||||||
|
bool firstTime = true;
|
||||||
static int framesCount = 0;
|
static int framesCount = 0;
|
||||||
|
|
||||||
for (framesCount += numFrames; framesCount > 0; framesCount -= 2)
|
for (framesCount += numFrames; framesCount > 0; framesCount -= 2)
|
||||||
{
|
{
|
||||||
GlobalCounter++;
|
GlobalCounter++;
|
||||||
|
@ -184,7 +186,7 @@ GameStatus ControlPhase(int numFrames, int demoMode)
|
||||||
while (g_Gui.GetInventoryMode() == InventoryMode::Pause)
|
while (g_Gui.GetInventoryMode() == InventoryMode::Pause)
|
||||||
{
|
{
|
||||||
g_Gui.DrawInventory();
|
g_Gui.DrawInventory();
|
||||||
g_Renderer.SyncRenderer();
|
g_Renderer.Sync();
|
||||||
|
|
||||||
if (g_Gui.DoPauseMenu() == InventoryResult::ExitToTitle)
|
if (g_Gui.DoPauseMenu() == InventoryResult::ExitToTitle)
|
||||||
return GameStatus::ExitToTitle;
|
return GameStatus::ExitToTitle;
|
||||||
|
@ -350,6 +352,13 @@ GameStatus ControlPhase(int numFrames, int demoMode)
|
||||||
// Update timers
|
// Update timers
|
||||||
HealthBarTimer--;
|
HealthBarTimer--;
|
||||||
GameTimer++;
|
GameTimer++;
|
||||||
|
|
||||||
|
// Add renderer objects on the first processed frame
|
||||||
|
if (firstTime)
|
||||||
|
{
|
||||||
|
g_Renderer.Lock();
|
||||||
|
firstTime = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GameStatus::None;
|
return GameStatus::None;
|
||||||
|
@ -416,7 +425,7 @@ GameStatus DoTitle(int index, std::string const& ambient)
|
||||||
g_GameScript->InitCallbacks();
|
g_GameScript->InitCallbacks();
|
||||||
g_GameStringsHandler->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
g_GameStringsHandler->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
||||||
{
|
{
|
||||||
g_Renderer.DrawString(float(x)/float(g_Configuration.Width) * REFERENCE_RES_WIDTH, float(y)/float(g_Configuration.Height) * REFERENCE_RES_HEIGHT, key.c_str(), col, flags);
|
g_Renderer.AddString(float(x)/float(g_Configuration.Width) * REFERENCE_RES_WIDTH, float(y)/float(g_Configuration.Height) * REFERENCE_RES_HEIGHT, key.c_str(), col, flags);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +476,7 @@ GameStatus DoTitle(int index, std::string const& ambient)
|
||||||
if (status != InventoryResult::None)
|
if (status != InventoryResult::None)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Camera.numberFrames = g_Renderer.SyncRenderer();
|
Camera.numberFrames = g_Renderer.Sync();
|
||||||
frames = Camera.numberFrames;
|
frames = Camera.numberFrames;
|
||||||
ControlPhase(frames, 0);
|
ControlPhase(frames, 0);
|
||||||
}
|
}
|
||||||
|
@ -520,7 +529,7 @@ GameStatus DoLevel(int index, std::string const& ambient, bool loadFromSavegame)
|
||||||
g_GameScript->InitCallbacks();
|
g_GameScript->InitCallbacks();
|
||||||
g_GameStringsHandler->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
g_GameStringsHandler->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
||||||
{
|
{
|
||||||
g_Renderer.DrawString(float(x)/float(g_Configuration.Width) * REFERENCE_RES_WIDTH, float(y)/float(g_Configuration.Height) * REFERENCE_RES_HEIGHT, key.c_str(), col, flags);
|
g_Renderer.AddString(float(x)/float(g_Configuration.Width) * REFERENCE_RES_WIDTH, float(y)/float(g_Configuration.Height) * REFERENCE_RES_HEIGHT, key.c_str(), col, flags);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -954,12 +954,12 @@ void GuiController::HandleControlSettingsInput(bool pause)
|
||||||
if (pause)
|
if (pause)
|
||||||
{
|
{
|
||||||
g_Renderer.RenderInventory();
|
g_Renderer.RenderInventory();
|
||||||
Camera.numberFrames = g_Renderer.SyncRenderer();
|
Camera.numberFrames = g_Renderer.Sync();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Renderer.RenderTitle();
|
g_Renderer.RenderTitle();
|
||||||
Camera.numberFrames = g_Renderer.SyncRenderer();
|
Camera.numberFrames = g_Renderer.Sync();
|
||||||
int nframes = Camera.numberFrames;
|
int nframes = Camera.numberFrames;
|
||||||
ControlPhase(nframes, 0);
|
ControlPhase(nframes, 0);
|
||||||
}
|
}
|
||||||
|
@ -2300,7 +2300,7 @@ void GuiController::DoInventory()
|
||||||
|
|
||||||
if (rings[(int)RingTypes::Ammo]->ringactive)
|
if (rings[(int)RingTypes::Ammo]->ringactive)
|
||||||
{
|
{
|
||||||
g_Renderer.DrawString(phd_centerx, phd_centery, g_GameFlow->GetString(optmessages[5]), PRINTSTRING_COLOR_WHITE, PRINTSTRING_BLINK | PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
g_Renderer.AddString(phd_centerx, phd_centery, g_GameFlow->GetString(optmessages[5]), PRINTSTRING_COLOR_WHITE, PRINTSTRING_BLINK | PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
||||||
|
|
||||||
if (rings[(int)RingTypes::Inventory]->objlistmovement)
|
if (rings[(int)RingTypes::Inventory]->objlistmovement)
|
||||||
return;
|
return;
|
||||||
|
@ -2492,12 +2492,12 @@ void GuiController::DoInventory()
|
||||||
{
|
{
|
||||||
if (i == current_selected_option)
|
if (i == current_selected_option)
|
||||||
{
|
{
|
||||||
g_Renderer.DrawString(phd_centerx, ypos, current_options[i].text, PRINTSTRING_COLOR_WHITE, PRINTSTRING_BLINK | PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
g_Renderer.AddString(phd_centerx, ypos, current_options[i].text, PRINTSTRING_COLOR_WHITE, PRINTSTRING_BLINK | PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
||||||
ypos += line_height;
|
ypos += line_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Renderer.DrawString(phd_centerx, ypos, current_options[i].text, PRINTSTRING_COLOR_WHITE, PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
g_Renderer.AddString(phd_centerx, ypos, current_options[i].text, PRINTSTRING_COLOR_WHITE, PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
||||||
ypos += line_height;
|
ypos += line_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2762,7 +2762,7 @@ void GuiController::DrawAmmoSelector()
|
||||||
sprintf(&invTextBuffer[0], "%d x %s", ammo_object_list[n].amount, g_GameFlow->GetString(inventry_objects_list[ammo_object_list[n].invitem].objname));
|
sprintf(&invTextBuffer[0], "%d x %s", ammo_object_list[n].amount, g_GameFlow->GetString(inventry_objects_list[ammo_object_list[n].invitem].objname));
|
||||||
|
|
||||||
if (ammo_selector_fade_val)
|
if (ammo_selector_fade_val)
|
||||||
g_Renderer.DrawString(phd_centerx, 380, &invTextBuffer[0], PRINTSTRING_COLOR_YELLOW, PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
g_Renderer.AddString(phd_centerx, 380, &invTextBuffer[0], PRINTSTRING_COLOR_YELLOW, PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
||||||
|
|
||||||
|
|
||||||
if (n == *current_ammo_type)
|
if (n == *current_ammo_type)
|
||||||
|
@ -3067,7 +3067,7 @@ void GuiController::DrawCurrentObjectList(int ringnum)
|
||||||
else
|
else
|
||||||
objmeup = (int)(phd_centery + (REFERENCE_RES_HEIGHT + 1) * 0.0625 * 2.0);
|
objmeup = (int)(phd_centery + (REFERENCE_RES_HEIGHT + 1) * 0.0625 * 2.0);
|
||||||
|
|
||||||
g_Renderer.DrawString(phd_centerx, objmeup, textbufme, PRINTSTRING_COLOR_YELLOW, PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
g_Renderer.AddString(phd_centerx, objmeup, textbufme, PRINTSTRING_COLOR_YELLOW, PRINTSTRING_CENTER | PRINTSTRING_OUTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!i && !rings[ringnum]->objlistmovement)
|
if (!i && !rings[ringnum]->objlistmovement)
|
||||||
|
@ -3288,7 +3288,7 @@ bool GuiController::CallInventory(bool reset_mode)
|
||||||
if (useItem && !TrInput)
|
if (useItem && !TrInput)
|
||||||
exitLoop = true;
|
exitLoop = true;
|
||||||
|
|
||||||
Camera.numberFrames = g_Renderer.SyncRenderer();
|
Camera.numberFrames = g_Renderer.Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
lastInvItem = rings[(int)RingTypes::Inventory]->current_object_list[rings[(int)RingTypes::Inventory]->curobjinlist].invitem;
|
lastInvItem = rings[(int)RingTypes::Inventory]->current_object_list[rings[(int)RingTypes::Inventory]->curobjinlist].invitem;
|
||||||
|
|
|
@ -63,7 +63,12 @@ namespace TEN::Renderer
|
||||||
gameCamera.clear();
|
gameCamera.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Renderer11::SyncRenderer()
|
void Renderer11::Lock()
|
||||||
|
{
|
||||||
|
m_Locked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Renderer11::Sync()
|
||||||
{
|
{
|
||||||
// Sync the renderer
|
// Sync the renderer
|
||||||
int nf = Sync();
|
int nf = Sync();
|
||||||
|
|
|
@ -408,6 +408,9 @@ namespace TEN::Renderer
|
||||||
int m_screenHeight;
|
int m_screenHeight;
|
||||||
bool m_windowed;
|
bool m_windowed;
|
||||||
|
|
||||||
|
// A flag to prevent extra renderer object addition
|
||||||
|
bool m_Locked = false;
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
int m_pickupRotation = 0;
|
int m_pickupRotation = 0;
|
||||||
|
|
||||||
|
@ -598,6 +601,7 @@ namespace TEN::Renderer
|
||||||
void Create();
|
void Create();
|
||||||
void Initialise(int w, int h, bool windowed, HWND handle);
|
void Initialise(int w, int h, bool windowed, HWND handle);
|
||||||
void Draw();
|
void Draw();
|
||||||
|
void Lock();
|
||||||
bool PrepareDataForTheRenderer();
|
bool PrepareDataForTheRenderer();
|
||||||
void UpdateCameraMatrices(CAMERA_INFO* cam, float roll, float fov, float farView);
|
void UpdateCameraMatrices(CAMERA_INFO* cam, float roll, float fov, float farView);
|
||||||
void RenderSimpleScene(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, RenderView& view);
|
void RenderSimpleScene(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, RenderView& view);
|
||||||
|
@ -609,8 +613,8 @@ namespace TEN::Renderer
|
||||||
void DrawDebugInfo(RenderView& view);
|
void DrawDebugInfo(RenderView& view);
|
||||||
void SwitchDebugPage(bool back);
|
void SwitchDebugPage(bool back);
|
||||||
void DrawPickup(short objectNum);
|
void DrawPickup(short objectNum);
|
||||||
int SyncRenderer();
|
int Sync();
|
||||||
void DrawString(int x, int y, const char* string, D3DCOLOR color, int flags);
|
void AddString(int x, int y, const char* string, D3DCOLOR color, int flags);
|
||||||
void FreeRendererData();
|
void FreeRendererData();
|
||||||
void AddDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b);
|
void AddDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b);
|
||||||
void RenderLoadingScreen(float percentage);
|
void RenderLoadingScreen(float percentage);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace TEN::Renderer
|
||||||
_vsprintf_l(buffer, message, NULL, args);
|
_vsprintf_l(buffer, message, NULL, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
DrawString(10, m_currentY, buffer, 0xFFFFFFFF, PRINTSTRING_OUTLINE);
|
AddString(10, m_currentY, buffer, 0xFFFFFFFF, PRINTSTRING_OUTLINE);
|
||||||
|
|
||||||
m_currentY += 20;
|
m_currentY += 20;
|
||||||
}
|
}
|
||||||
|
|
|
@ -788,6 +788,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddLine3D(Vector3 start, Vector3 end, Vector4 color)
|
void Renderer11::AddLine3D(Vector3 start, Vector3 end, Vector4 color)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
RendererLine3D line;
|
RendererLine3D line;
|
||||||
|
|
||||||
line.Start = start;
|
line.Start = start;
|
||||||
|
@ -799,6 +802,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddSphere(Vector3 center, float radius, Vector4 color)
|
void Renderer11::AddSphere(Vector3 center, float radius, Vector4 color)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
constexpr auto subdivisions = 10;
|
constexpr auto subdivisions = 10;
|
||||||
constexpr auto steps = 6;
|
constexpr auto steps = 6;
|
||||||
constexpr auto step = PI / steps;
|
constexpr auto step = PI / steps;
|
||||||
|
@ -842,6 +848,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddBox(Vector3* corners, Vector4 color)
|
void Renderer11::AddBox(Vector3* corners, Vector4 color)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
RendererLine3D line;
|
RendererLine3D line;
|
||||||
|
@ -861,7 +870,6 @@ namespace TEN::Renderer
|
||||||
line.End = corners[0];
|
line.End = corners[0];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 4: line.Start = corners[4];
|
case 4: line.Start = corners[4];
|
||||||
line.End = corners[5];
|
line.End = corners[5];
|
||||||
break;
|
break;
|
||||||
|
@ -875,7 +883,6 @@ namespace TEN::Renderer
|
||||||
line.End = corners[4];
|
line.End = corners[4];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 8: line.Start = corners[0];
|
case 8: line.Start = corners[0];
|
||||||
line.End = corners[4];
|
line.End = corners[4];
|
||||||
break;
|
break;
|
||||||
|
@ -897,6 +904,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddBox(Vector3 min, Vector3 max, Vector4 color)
|
void Renderer11::AddBox(Vector3 min, Vector3 max, Vector4 color)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
RendererLine3D line;
|
RendererLine3D line;
|
||||||
|
@ -971,6 +981,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b)
|
void Renderer11::AddDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
RendererLight dynamicLight = {};
|
RendererLight dynamicLight = {};
|
||||||
|
|
||||||
if (falloff >= 8)
|
if (falloff >= 8)
|
||||||
|
@ -1429,6 +1442,7 @@ namespace TEN::Renderer
|
||||||
void Renderer11::RenderScene(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, RenderView& view)
|
void Renderer11::RenderScene(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, RenderView& view)
|
||||||
{
|
{
|
||||||
ResetDebugVariables();
|
ResetDebugVariables();
|
||||||
|
m_Locked = false;
|
||||||
|
|
||||||
using ns = std::chrono::nanoseconds;
|
using ns = std::chrono::nanoseconds;
|
||||||
using get_time = std::chrono::steady_clock;
|
using get_time = std::chrono::steady_clock;
|
||||||
|
@ -1567,7 +1581,6 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
DrawDebugInfo(view);
|
DrawDebugInfo(view);
|
||||||
DrawAllStrings();
|
DrawAllStrings();
|
||||||
|
|
||||||
DrawFadeAndBars(target, depthTarget, view);
|
DrawFadeAndBars(target, depthTarget, view);
|
||||||
|
|
||||||
ClearScene();
|
ClearScene();
|
||||||
|
|
|
@ -109,15 +109,15 @@ namespace TEN::Renderer
|
||||||
y = initialY;
|
y = initialY;
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_DISPLAY), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 0));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_DISPLAY), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 0));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Other options
|
// Other options
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OTHER_SETTINGS), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 1));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OTHER_SETTINGS), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 1));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CONTROLS), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 2));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CONTROLS), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Menu::Display:
|
case Menu::Display:
|
||||||
|
@ -126,40 +126,40 @@ namespace TEN::Renderer
|
||||||
y = MenuVerticalDisplaySettings;
|
y = MenuVerticalDisplaySettings;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_DISPLAY), PRINTSTRING_COLOR_YELLOW, SF_Center());
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_DISPLAY), PRINTSTRING_COLOR_YELLOW, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Screen resolution
|
// Screen resolution
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SCREEN_RESOLUTION), PRINTSTRING_COLOR_ORANGE, SF(title_option == 0));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SCREEN_RESOLUTION), PRINTSTRING_COLOR_ORANGE, SF(title_option == 0));
|
||||||
DrawString(MenuRightSideEntry, y, stringBuffer, PRINTSTRING_COLOR_WHITE, SF(title_option == 0));
|
AddString(MenuRightSideEntry, y, stringBuffer, PRINTSTRING_COLOR_WHITE, SF(title_option == 0));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Windowed mode
|
// Windowed mode
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_WINDOWED), PRINTSTRING_COLOR_ORANGE, SF(title_option == 1));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_WINDOWED), PRINTSTRING_COLOR_ORANGE, SF(title_option == 1));
|
||||||
DrawString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.Windowed), PRINTSTRING_COLOR_WHITE, SF(title_option == 1));
|
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.Windowed), PRINTSTRING_COLOR_WHITE, SF(title_option == 1));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Enable dynamic shadows
|
// Enable dynamic shadows
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SHADOWS), PRINTSTRING_COLOR_ORANGE, SF(title_option == 2));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SHADOWS), PRINTSTRING_COLOR_ORANGE, SF(title_option == 2));
|
||||||
DrawString(MenuRightSideEntry, y, g_GameFlow->GetString(shadowMode), PRINTSTRING_COLOR_WHITE, SF(title_option == 2));
|
AddString(MenuRightSideEntry, y, g_GameFlow->GetString(shadowMode), PRINTSTRING_COLOR_WHITE, SF(title_option == 2));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Enable caustics
|
// Enable caustics
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_CAUSTICS), PRINTSTRING_COLOR_ORANGE, SF(title_option == 3));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_CAUSTICS), PRINTSTRING_COLOR_ORANGE, SF(title_option == 3));
|
||||||
DrawString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableCaustics), PRINTSTRING_COLOR_WHITE, SF(title_option == 3));
|
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableCaustics), PRINTSTRING_COLOR_WHITE, SF(title_option == 3));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Enable volumetric fog
|
// Enable volumetric fog
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_VOLUMETRIC_FOG), PRINTSTRING_COLOR_ORANGE, SF(title_option == 4));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_VOLUMETRIC_FOG), PRINTSTRING_COLOR_ORANGE, SF(title_option == 4));
|
||||||
DrawString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableVolumetricFog), PRINTSTRING_COLOR_WHITE, SF(title_option == 4));
|
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableVolumetricFog), PRINTSTRING_COLOR_WHITE, SF(title_option == 4));
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_APPLY), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 5));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_APPLY), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 5));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CANCEL), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 6));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CANCEL), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 6));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Menu::OtherSettings:
|
case Menu::OtherSettings:
|
||||||
|
@ -168,12 +168,12 @@ namespace TEN::Renderer
|
||||||
y = MenuVerticalOtherSettings;
|
y = MenuVerticalOtherSettings;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OTHER_SETTINGS), PRINTSTRING_COLOR_YELLOW, SF_Center());
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OTHER_SETTINGS), PRINTSTRING_COLOR_YELLOW, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Enable sound special effects
|
// Enable sound special effects
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_REVERB), PRINTSTRING_COLOR_ORANGE, SF(title_option == 0));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_REVERB), PRINTSTRING_COLOR_ORANGE, SF(title_option == 0));
|
||||||
DrawString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableReverb), PRINTSTRING_COLOR_WHITE, SF(title_option == 0));
|
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableReverb), PRINTSTRING_COLOR_WHITE, SF(title_option == 0));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Initialise bars, if not yet done. Must be done here because we're calculating Y coord on the fly.
|
// Initialise bars, if not yet done. Must be done here because we're calculating Y coord on the fly.
|
||||||
|
@ -181,38 +181,38 @@ namespace TEN::Renderer
|
||||||
InitialiseMenuBars(y);
|
InitialiseMenuBars(y);
|
||||||
|
|
||||||
// Music volume
|
// Music volume
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_MUSIC_VOLUME), PRINTSTRING_COLOR_ORANGE, SF(title_option == 1));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_MUSIC_VOLUME), PRINTSTRING_COLOR_ORANGE, SF(title_option == 1));
|
||||||
DrawBar(g_Gui.GetCurrentSettings().conf.MusicVolume / 100.0f, g_MusicVolumeBar, ID_SFX_BAR_TEXTURE, 0, false);
|
DrawBar(g_Gui.GetCurrentSettings().conf.MusicVolume / 100.0f, g_MusicVolumeBar, ID_SFX_BAR_TEXTURE, 0, false);
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Sound FX volume
|
// Sound FX volume
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SFX_VOLUME), PRINTSTRING_COLOR_ORANGE, SF(title_option == 2));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SFX_VOLUME), PRINTSTRING_COLOR_ORANGE, SF(title_option == 2));
|
||||||
DrawBar(g_Gui.GetCurrentSettings().conf.SfxVolume / 100.0f, g_SFXVolumeBar, ID_SFX_BAR_TEXTURE, 0, false);
|
DrawBar(g_Gui.GetCurrentSettings().conf.SfxVolume / 100.0f, g_SFXVolumeBar, ID_SFX_BAR_TEXTURE, 0, false);
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
|
|
||||||
// Auto targeting
|
// Auto targeting
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_AUTOTARGET), PRINTSTRING_COLOR_ORANGE, SF(title_option == 3));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_AUTOTARGET), PRINTSTRING_COLOR_ORANGE, SF(title_option == 3));
|
||||||
DrawString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.AutoTarget), PRINTSTRING_COLOR_WHITE, SF(title_option == 3));
|
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.AutoTarget), PRINTSTRING_COLOR_WHITE, SF(title_option == 3));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Vibration
|
// Vibration
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_RUMBLE), PRINTSTRING_COLOR_ORANGE, SF(title_option == 4));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_RUMBLE), PRINTSTRING_COLOR_ORANGE, SF(title_option == 4));
|
||||||
DrawString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableRumble), PRINTSTRING_COLOR_WHITE, SF(title_option == 4));
|
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableRumble), PRINTSTRING_COLOR_WHITE, SF(title_option == 4));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Thumbstick camera
|
// Thumbstick camera
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_THUMBSTICK_CAMERA), PRINTSTRING_COLOR_ORANGE, SF(title_option == 5));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_THUMBSTICK_CAMERA), PRINTSTRING_COLOR_ORANGE, SF(title_option == 5));
|
||||||
DrawString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableThumbstickCameraControl), PRINTSTRING_COLOR_WHITE, SF(title_option == 5));
|
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().conf.EnableThumbstickCameraControl), PRINTSTRING_COLOR_WHITE, SF(title_option == 5));
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_APPLY), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 6));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_APPLY), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 6));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CANCEL), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 7));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CANCEL), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 7));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Menu::Controls:
|
case Menu::Controls:
|
||||||
|
@ -221,20 +221,20 @@ namespace TEN::Renderer
|
||||||
y = MenuVerticalTop;
|
y = MenuVerticalTop;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CONTROLS), PRINTSTRING_COLOR_YELLOW, SF_Center());
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CONTROLS), PRINTSTRING_COLOR_YELLOW, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Control listing
|
// Control listing
|
||||||
for (int k = 0; k < KEY_COUNT; k++)
|
for (int k = 0; k < KEY_COUNT; k++)
|
||||||
{
|
{
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(controlmsgs[k]), PRINTSTRING_COLOR_WHITE, SF(title_option == k));
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(controlmsgs[k]), PRINTSTRING_COLOR_WHITE, SF(title_option == k));
|
||||||
|
|
||||||
if (g_Gui.GetCurrentSettings().waitingForkey && title_option == k)
|
if (g_Gui.GetCurrentSettings().waitingForkey && title_option == k)
|
||||||
DrawString(MenuRightSideEntry, y, g_GameFlow->GetString(STRING_WAITING_FOR_KEY), PRINTSTRING_COLOR_YELLOW, SF(true));
|
AddString(MenuRightSideEntry, y, g_GameFlow->GetString(STRING_WAITING_FOR_KEY), PRINTSTRING_COLOR_YELLOW, SF(true));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int index = KeyboardLayout[1][k] ? KeyboardLayout[1][k] : KeyboardLayout[0][k];
|
int index = KeyboardLayout[1][k] ? KeyboardLayout[1][k] : KeyboardLayout[0][k];
|
||||||
DrawString(MenuRightSideEntry, y, (char*)g_KeyNames[index], PRINTSTRING_COLOR_ORANGE, SF(false));
|
AddString(MenuRightSideEntry, y, (char*)g_KeyNames[index], PRINTSTRING_COLOR_ORANGE, SF(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k < KEY_COUNT - 1)
|
if (k < KEY_COUNT - 1)
|
||||||
|
@ -244,11 +244,11 @@ namespace TEN::Renderer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_APPLY), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 17));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_APPLY), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 17));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CANCEL), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 18));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CANCEL), PRINTSTRING_COLOR_ORANGE, SF_Center(title_option == 18));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,19 +267,19 @@ namespace TEN::Renderer
|
||||||
case Menu::Title:
|
case Menu::Title:
|
||||||
|
|
||||||
// New game
|
// New game
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_NEW_GAME), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 0));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_NEW_GAME), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 0));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Load game
|
// Load game
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_LOAD_GAME), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 1));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_LOAD_GAME), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 1));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OPTIONS), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 2));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OPTIONS), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 2));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Exit game
|
// Exit game
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_EXIT_GAME), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 3));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_EXIT_GAME), PRINTSTRING_COLOR_WHITE, SF_Center(title_option == 3));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Menu::LoadGame:
|
case Menu::LoadGame:
|
||||||
|
@ -292,13 +292,13 @@ namespace TEN::Renderer
|
||||||
y = MenuVerticalLineSpacing;
|
y = MenuVerticalLineSpacing;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
DrawString(MenuCenterEntry, 26, g_GameFlow->GetString(STRING_SELECT_LEVEL), PRINTSTRING_COLOR_ORANGE, SF_Center());
|
AddString(MenuCenterEntry, 26, g_GameFlow->GetString(STRING_SELECT_LEVEL), PRINTSTRING_COLOR_ORANGE, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Level listing (starts with 1 because 0 is always title)
|
// Level listing (starts with 1 because 0 is always title)
|
||||||
for (int i = 1; i < g_GameFlow->GetNumLevels(); i++)
|
for (int i = 1; i < g_GameFlow->GetNumLevels(); i++)
|
||||||
{
|
{
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(g_GameFlow->GetLevel(i)->NameStringKey.c_str()),
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(g_GameFlow->GetLevel(i)->NameStringKey.c_str()),
|
||||||
PRINTSTRING_COLOR_WHITE, SF_Center(title_option == i - 1));
|
PRINTSTRING_COLOR_WHITE, SF_Center(title_option == i - 1));
|
||||||
GetNextNarrowLinePosition(&y);
|
GetNextNarrowLinePosition(&y);
|
||||||
}
|
}
|
||||||
|
@ -326,19 +326,19 @@ namespace TEN::Renderer
|
||||||
y = MenuVerticalPause;
|
y = MenuVerticalPause;
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CONTROLS_PAUSE), PRINTSTRING_COLOR_ORANGE, SF_Center());
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_CONTROLS_PAUSE), PRINTSTRING_COLOR_ORANGE, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_STATISTICS), PRINTSTRING_COLOR_WHITE, SF_Center(pause_option == 0));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_STATISTICS), PRINTSTRING_COLOR_WHITE, SF_Center(pause_option == 0));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OPTIONS), PRINTSTRING_COLOR_WHITE, SF_Center(pause_option == 1));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_OPTIONS), PRINTSTRING_COLOR_WHITE, SF_Center(pause_option == 1));
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Exit to title
|
// Exit to title
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_EXIT_TO_TITLE), PRINTSTRING_COLOR_WHITE, SF_Center(pause_option == 2));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_EXIT_TO_TITLE), PRINTSTRING_COLOR_WHITE, SF_Center(pause_option == 2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Menu::Statistics:
|
case Menu::Statistics:
|
||||||
|
@ -372,7 +372,7 @@ namespace TEN::Renderer
|
||||||
LoadSavegameInfos();
|
LoadSavegameInfos();
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
DrawString(MenuCenterEntry, MenuVerticalNarrowLineSpacing, Str_LoadSave(g_Gui.GetInventoryMode() == InventoryMode::Save),
|
AddString(MenuCenterEntry, MenuVerticalNarrowLineSpacing, Str_LoadSave(g_Gui.GetInventoryMode() == InventoryMode::Save),
|
||||||
PRINTSTRING_COLOR_ORANGE, SF_Center());
|
PRINTSTRING_COLOR_ORANGE, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
|
@ -383,20 +383,20 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
if (!save.Present)
|
if (!save.Present)
|
||||||
{
|
{
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_UNUSED), PRINTSTRING_COLOR_WHITE, SF_Center(selection == n));
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_UNUSED), PRINTSTRING_COLOR_WHITE, SF_Center(selection == n));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Number
|
// Number
|
||||||
sprintf(stringBuffer, "%03d", save.Count);
|
sprintf(stringBuffer, "%03d", save.Count);
|
||||||
DrawString(MenuLoadNumberLeftSide, y, stringBuffer, PRINTSTRING_COLOR_WHITE, SF(selection == n));
|
AddString(MenuLoadNumberLeftSide, y, stringBuffer, PRINTSTRING_COLOR_WHITE, SF(selection == n));
|
||||||
|
|
||||||
// Level name
|
// Level name
|
||||||
DrawString(MenuLoadNameLeftSide, y, (char*)save.LevelName.c_str(), PRINTSTRING_COLOR_WHITE, SF(selection == n));
|
AddString(MenuLoadNameLeftSide, y, (char*)save.LevelName.c_str(), PRINTSTRING_COLOR_WHITE, SF(selection == n));
|
||||||
|
|
||||||
// Timestamp
|
// Timestamp
|
||||||
sprintf(stringBuffer, g_GameFlow->GetString(STRING_SAVEGAME_TIMESTAMP), save.Days, save.Hours, save.Minutes, save.Seconds);
|
sprintf(stringBuffer, g_GameFlow->GetString(STRING_SAVEGAME_TIMESTAMP), save.Days, save.Hours, save.Minutes, save.Seconds);
|
||||||
DrawString(MenuRightSideEntry, y, stringBuffer, PRINTSTRING_COLOR_WHITE, SF(selection == n));
|
AddString(MenuRightSideEntry, y, stringBuffer, PRINTSTRING_COLOR_WHITE, SF(selection == n));
|
||||||
}
|
}
|
||||||
|
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
@ -419,41 +419,41 @@ namespace TEN::Renderer
|
||||||
auto y = MenuVerticalStatisticsTitle;
|
auto y = MenuVerticalStatisticsTitle;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_STATISTICS), PRINTSTRING_COLOR_ORANGE, SF_Center());
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_STATISTICS), PRINTSTRING_COLOR_ORANGE, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Level name
|
// Level name
|
||||||
DrawString(MenuCenterEntry, y, g_GameFlow->GetString(lvl->NameStringKey.c_str()), PRINTSTRING_COLOR_WHITE, SF_Center());
|
AddString(MenuCenterEntry, y, g_GameFlow->GetString(lvl->NameStringKey.c_str()), PRINTSTRING_COLOR_WHITE, SF_Center());
|
||||||
GetNextBlockPosition(&y);
|
GetNextBlockPosition(&y);
|
||||||
|
|
||||||
// Time taken
|
// Time taken
|
||||||
sprintf(buffer, "%02d:%02d:%02d", (days * 24) + hours, min, sec);
|
sprintf(buffer, "%02d:%02d:%02d", (days * 24) + hours, min, sec);
|
||||||
DrawString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_TIME_TAKEN), PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_TIME_TAKEN), PRINTSTRING_COLOR_WHITE, SF());
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Distance travelled
|
// Distance travelled
|
||||||
sprintf(buffer, "%dm", Statistics.Game.Distance / UnitsToMeters);
|
sprintf(buffer, "%dm", Statistics.Game.Distance / UnitsToMeters);
|
||||||
DrawString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_DISTANCE_TRAVELLED), PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_DISTANCE_TRAVELLED), PRINTSTRING_COLOR_WHITE, SF());
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Ammo used
|
// Ammo used
|
||||||
sprintf(buffer, "%d", Statistics.Game.AmmoUsed);
|
sprintf(buffer, "%d", Statistics.Game.AmmoUsed);
|
||||||
DrawString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_USED_AMMOS), PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_USED_AMMOS), PRINTSTRING_COLOR_WHITE, SF());
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Medipacks used
|
// Medipacks used
|
||||||
sprintf(buffer, "%d", Statistics.Game.HealthUsed);
|
sprintf(buffer, "%d", Statistics.Game.HealthUsed);
|
||||||
DrawString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_USED_MEDIPACKS), PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_USED_MEDIPACKS), PRINTSTRING_COLOR_WHITE, SF());
|
||||||
GetNextLinePosition(&y);
|
GetNextLinePosition(&y);
|
||||||
|
|
||||||
// Secrets found
|
// Secrets found
|
||||||
sprintf(buffer, "%d / 36", Statistics.Game.Secrets);
|
sprintf(buffer, "%d / 36", Statistics.Game.Secrets);
|
||||||
DrawString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
||||||
DrawString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SECRETS_FOUND), PRINTSTRING_COLOR_WHITE, SF());
|
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SECRETS_FOUND), PRINTSTRING_COLOR_WHITE, SF());
|
||||||
|
|
||||||
DrawAllStrings();
|
DrawAllStrings();
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ namespace TEN::Renderer
|
||||||
while (currentFade <= 1.0f)
|
while (currentFade <= 1.0f)
|
||||||
{
|
{
|
||||||
DrawFullScreenImage(texture.ShaderResourceView.Get(), currentFade, m_backBufferRTV, m_depthStencilView);
|
DrawFullScreenImage(texture.ShaderResourceView.Get(), currentFade, m_backBufferRTV, m_depthStencilView);
|
||||||
SyncRenderer();
|
Sync();
|
||||||
currentFade += FADE_FACTOR;
|
currentFade += FADE_FACTOR;
|
||||||
m_swapChain->Present(0, 0);
|
m_swapChain->Present(0, 0);
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ namespace TEN::Renderer
|
||||||
for (int i = 0; i < 20; i++)
|
for (int i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
DrawFullScreenImage(texture.ShaderResourceView.Get(), 1.0f, m_backBufferRTV, m_depthStencilView);
|
DrawFullScreenImage(texture.ShaderResourceView.Get(), 1.0f, m_backBufferRTV, m_depthStencilView);
|
||||||
SyncRenderer();
|
Sync();
|
||||||
m_swapChain->Present(0, 0);
|
m_swapChain->Present(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ namespace TEN::Renderer
|
||||||
while (currentFade >= 0.0f)
|
while (currentFade >= 0.0f)
|
||||||
{
|
{
|
||||||
DrawFullScreenImage(texture.ShaderResourceView.Get(), currentFade, m_backBufferRTV, m_depthStencilView);
|
DrawFullScreenImage(texture.ShaderResourceView.Get(), currentFade, m_backBufferRTV, m_depthStencilView);
|
||||||
SyncRenderer();
|
Sync();
|
||||||
currentFade -= FADE_FACTOR;
|
currentFade -= FADE_FACTOR;
|
||||||
m_swapChain->Present(0, 0);
|
m_swapChain->Present(0, 0);
|
||||||
}
|
}
|
||||||
|
@ -694,7 +694,7 @@ namespace TEN::Renderer
|
||||||
Strings[i].y && !Lara.Inventory.Diary.Pages[Lara.Inventory.Diary.currentPage].Strings[i].stringID)
|
Strings[i].y && !Lara.Inventory.Diary.Pages[Lara.Inventory.Diary.currentPage].Strings[i].stringID)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//DrawString(Lara.Diary.Pages[currentPage].Strings[i].x, Lara.Diary.Pages[currentPage].Strings[i].y, g_GameFlow->GetString(Lara.Diary.Pages[currentPage].Strings[i].stringID), PRINTSTRING_COLOR_WHITE, 0);
|
//AddString(Lara.Diary.Pages[currentPage].Strings[i].x, Lara.Diary.Pages[currentPage].Strings[i].y, g_GameFlow->GetString(Lara.Diary.Pages[currentPage].Strings[i].stringID), PRINTSTRING_COLOR_WHITE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawAllStrings();
|
DrawAllStrings();
|
||||||
|
@ -828,7 +828,7 @@ namespace TEN::Renderer
|
||||||
m_swapChain->Present(0, 0);
|
m_swapChain->Present(0, 0);
|
||||||
m_context->ClearState();
|
m_context->ClearState();
|
||||||
|
|
||||||
SyncRenderer();
|
Sync();
|
||||||
UpdateFadeScreenAndCinematicBars();
|
UpdateFadeScreenAndCinematicBars();
|
||||||
|
|
||||||
} while (ScreenFading || !ScreenFadedOut);
|
} while (ScreenFading || !ScreenFadedOut);
|
||||||
|
@ -852,7 +852,7 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
RenderInventoryScene(m_backBufferRTV, m_depthStencilView, nullptr);
|
RenderInventoryScene(m_backBufferRTV, m_depthStencilView, nullptr);
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
DrawString(0, 0, commit.c_str(), D3DCOLOR_ARGB(255, 255, 255, 255), 0);
|
AddString(0, 0, commit.c_str(), D3DCOLOR_ARGB(255, 255, 255, 255), 0);
|
||||||
DrawAllStrings();
|
DrawAllStrings();
|
||||||
#else
|
#else
|
||||||
DrawAllStrings();
|
DrawAllStrings();
|
||||||
|
|
|
@ -251,16 +251,20 @@ namespace TEN::Renderer
|
||||||
if (nativeRoom->flags & ENV_FLAG_OUTSIDE)
|
if (nativeRoom->flags & ENV_FLAG_OUTSIDE)
|
||||||
m_outside = true;
|
m_outside = true;
|
||||||
|
|
||||||
m_rooms[roomNumber].Distance = distance;
|
if (!m_rooms[roomNumber].Visited)
|
||||||
m_rooms[roomNumber].Visited = true;
|
|
||||||
|
|
||||||
if (!onlyRooms)
|
|
||||||
{
|
{
|
||||||
CollectLightsForRoom(roomNumber, renderView);
|
CollectLightsForRoom(roomNumber, renderView);
|
||||||
CollectItems(roomNumber, renderView);
|
|
||||||
CollectStatics(roomNumber, renderView);
|
if (!onlyRooms)
|
||||||
CollectEffects(roomNumber);
|
{
|
||||||
|
CollectItems(roomNumber, renderView);
|
||||||
|
CollectStatics(roomNumber, renderView);
|
||||||
|
CollectEffects(roomNumber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_rooms[roomNumber].Distance = distance;
|
||||||
|
m_rooms[roomNumber].Visited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nativeRoom->flags & ENV_FLAG_OUTSIDE)
|
if (nativeRoom->flags & ENV_FLAG_OUTSIDE)
|
||||||
|
@ -672,20 +676,19 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
RendererRoom& room = m_rooms[roomNumber];
|
RendererRoom& room = m_rooms[roomNumber];
|
||||||
ROOM_INFO* r = &g_Level.Rooms[roomNumber];
|
ROOM_INFO* r = &g_Level.Rooms[roomNumber];
|
||||||
|
|
||||||
int numLights = room.Lights.size();
|
Vector3 boxMin = Vector3(r->x + WALL_SIZE, r->maxceiling - STEP_SIZE, r->z + WALL_SIZE);
|
||||||
|
Vector3 boxMax = Vector3(r->x + (r->xSize - 1) * WALL_SIZE, r->minfloor + STEP_SIZE, r->z + (r->zSize - 1) * WALL_SIZE);
|
||||||
|
|
||||||
// Collect dynamic lights for rooms
|
// Collect dynamic lights for rooms
|
||||||
for (int i = 0; i < dynamicLights.size(); i++)
|
for (int i = 0; i < dynamicLights.size(); i++)
|
||||||
{
|
{
|
||||||
RendererLight* light = &dynamicLights[i];
|
RendererLight* light = &dynamicLights[i];
|
||||||
|
|
||||||
Vector3 boxMin = Vector3(r->x - 2 * WALL_SIZE, -(r->minfloor + STEP_SIZE), r->z - 2 * WALL_SIZE);
|
Vector3 center = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
||||||
Vector3 boxMax = Vector3(r->x + (r->xSize + 1) * WALL_SIZE, -(r->maxceiling - STEP_SIZE), r->z + (r->zSize + 1) * WALL_SIZE);
|
|
||||||
Vector3 center = Vector3(light->Position.x, -light->Position.y, light->Position.z);
|
|
||||||
|
|
||||||
if (renderView.lightsToDraw.size() < NUM_LIGHTS_PER_BUFFER - 1 &&
|
if (renderView.lightsToDraw.size() < NUM_LIGHTS_PER_BUFFER - 1 &&
|
||||||
SphereBoxIntersection(boxMin, boxMax, center, light->Out))
|
SphereBoxIntersection(boxMin, boxMax, center, 0.0f))
|
||||||
renderView.lightsToDraw.push_back(light);
|
renderView.lightsToDraw.push_back(light);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,8 +373,16 @@ namespace TEN::Renderer
|
||||||
Vector3 centre = (boxMin + boxMax) / 2.0f;
|
Vector3 centre = (boxMin + boxMax) / 2.0f;
|
||||||
Vector3 extens = boxMax - centre;
|
Vector3 extens = boxMax - centre;
|
||||||
BoundingBox box = BoundingBox(centre, extens);
|
BoundingBox box = BoundingBox(centre, extens);
|
||||||
BoundingSphere sphere = BoundingSphere(sphereCentre, sphereRadius);
|
|
||||||
return box.Intersects(sphere);
|
if (sphereRadius == 0.0f)
|
||||||
|
{
|
||||||
|
return box.Contains(sphereCentre);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BoundingSphere sphere = BoundingSphere(sphereCentre, sphereRadius);
|
||||||
|
return box.Intersects(sphere);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::GetLaraBonePosition(Vector3 *pos, int bone) {}
|
void Renderer11::GetLaraBonePosition(Vector3 *pos, int bone) {}
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
|
|
||||||
namespace TEN::Renderer
|
namespace TEN::Renderer
|
||||||
{
|
{
|
||||||
void Renderer11::DrawString(int x, int y, const char* string, D3DCOLOR color, int flags)
|
void Renderer11::AddString(int x, int y, const char* string, D3DCOLOR color, int flags)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddSpriteBillboard(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, RenderView& view)
|
void Renderer11::AddSpriteBillboard(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, RenderView& view)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
if (scale <= 0.0f)
|
if (scale <= 0.0f)
|
||||||
scale = 1.0f;
|
scale = 1.0f;
|
||||||
|
|
||||||
|
@ -45,6 +48,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddSpriteBillboardConstrained(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, Vector3 constrainAxis, RenderView& view)
|
void Renderer11::AddSpriteBillboardConstrained(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, Vector3 constrainAxis, RenderView& view)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
if (scale <= 0.0f)
|
if (scale <= 0.0f)
|
||||||
scale = 1.0f;
|
scale = 1.0f;
|
||||||
|
|
||||||
|
@ -69,6 +75,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddSpriteBillboardConstrainedLookAt(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, Vector3 lookAtAxis, RenderView& view)
|
void Renderer11::AddSpriteBillboardConstrainedLookAt(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, Vector3 lookAtAxis, RenderView& view)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
if (scale <= 0.0f)
|
if (scale <= 0.0f)
|
||||||
scale = 1.0f;
|
scale = 1.0f;
|
||||||
|
|
||||||
|
@ -92,6 +101,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer11::AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2, Vector3 vtx3, Vector3 vtx4, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, RenderView& view)
|
void Renderer11::AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2, Vector3 vtx3, Vector3 vtx4, Vector4 color, float rotation, float scale, Vector2 size, BLEND_MODES blendMode, RenderView& view)
|
||||||
{
|
{
|
||||||
|
if (m_Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
if (scale <= 0.0f)
|
if (scale <= 0.0f)
|
||||||
scale = 1.0f;
|
scale = 1.0f;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue