mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Merge branch 'develop_60fps' into develop
This commit is contained in:
commit
1ba72e669c
8 changed files with 178 additions and 68 deletions
|
@ -122,11 +122,11 @@ pickups, and Lara herself (see also <a href="../2 classes/Objects.LaraObject.htm
|
|||
<td class="summary">Shatter item.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#Moveable:SetEffect">Moveable:SetEffect(effect, timeout)</a></td>
|
||||
<td class="name" ><a href="#Moveable:SetEffect">Moveable:SetEffect(effect[, timeout])</a></td>
|
||||
<td class="summary">Set effect to moveable</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#Moveable:SetCustomEffect">Moveable:SetCustomEffect(Color1, Color2, timeout)</a></td>
|
||||
<td class="name" ><a href="#Moveable:SetCustomEffect">Moveable:SetCustomEffect(Color1, Color2[, timeout])</a></td>
|
||||
<td class="summary">Set custom colored burn effect to moveable</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -227,10 +227,14 @@ pickups, and Lara herself (see also <a href="../2 classes/Objects.LaraObject.htm
|
|||
<td class="summary">Determine whether the moveable is active or not</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#Moveable:GetJointPosition">Moveable:GetJointPosition(index)</a></td>
|
||||
<td class="name" ><a href="#Moveable:GetJointPosition">Moveable:GetJointPosition(index[, offset])</a></td>
|
||||
<td class="summary">Get the object's joint position</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#Moveable:GetJointRotation">Moveable:GetJointRotation(index)</a></td>
|
||||
<td class="summary">Get the object's joint rotation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#Moveable:GetRotation">Moveable:GetRotation()</a></td>
|
||||
<td class="summary">Get the moveable's rotation</td>
|
||||
</tr>
|
||||
|
@ -496,7 +500,7 @@ most can just be ignored (see usage).
|
|||
</dd>
|
||||
<dt>
|
||||
<a name = "Moveable:SetEffect"></a>
|
||||
<strong>Moveable:SetEffect(effect, timeout)</strong>
|
||||
<strong>Moveable:SetEffect(effect[, timeout])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set effect to moveable
|
||||
|
@ -511,7 +515,8 @@ most can just be ignored (see usage).
|
|||
</li>
|
||||
<li><span class="parameter">timeout</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
time (in seconds) after which effect turns off (optional).
|
||||
time (in seconds) after which effect turns off.
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -522,7 +527,7 @@ most can just be ignored (see usage).
|
|||
</dd>
|
||||
<dt>
|
||||
<a name = "Moveable:SetCustomEffect"></a>
|
||||
<strong>Moveable:SetCustomEffect(Color1, Color2, timeout)</strong>
|
||||
<strong>Moveable:SetCustomEffect(Color1, Color2[, timeout])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set custom colored burn effect to moveable
|
||||
|
@ -541,7 +546,8 @@ most can just be ignored (see usage).
|
|||
</li>
|
||||
<li><span class="parameter">timeout</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
time (in seconds) after which effect turns off (optional).
|
||||
time (in seconds) after which effect turns off.
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -1098,7 +1104,7 @@ shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM)</pre>
|
|||
</dd>
|
||||
<dt>
|
||||
<a name = "Moveable:GetJointPosition"></a>
|
||||
<strong>Moveable:GetJointPosition(index)</strong>
|
||||
<strong>Moveable:GetJointPosition(index[, offset])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the object's joint position
|
||||
|
@ -1111,13 +1117,46 @@ shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM)</pre>
|
|||
<span class="types"><span class="type">int</span></span>
|
||||
of a joint to get position
|
||||
</li>
|
||||
<li><span class="parameter">offset</span>
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||
a pre-rotation offset to the joint
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||
a copy of the moveable's position
|
||||
a copy of the moveable's joint position
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Moveable:GetJointRotation"></a>
|
||||
<strong>Moveable:GetJointRotation(index)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the object's joint rotation
|
||||
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
of a joint to get rotation
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
|
||||
a calculated copy of the moveable's joint rotation
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -1361,7 +1400,10 @@ shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM)</pre>
|
|||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">LevelFuncs.objCollided = <span class="keyword">function</span>(obj1, obj2)
|
||||
<pre class="example"><span class="comment">-- obj1 is the collision moveable
|
||||
</span><span class="comment">-- obj2 is the collider moveable
|
||||
</span>
|
||||
LevelFuncs.objCollided = <span class="keyword">function</span>(obj1, obj2)
|
||||
<span class="global">print</span>(obj1:GetName() .. <span class="string">" collided with "</span> .. obj2:GetName())
|
||||
<span class="keyword">end</span>
|
||||
baddy:SetOnCollidedWithObject(LevelFuncs.objCollided)</pre>
|
||||
|
|
|
@ -127,7 +127,7 @@ void DrawPhase(bool isTitle, float interpolationFactor)
|
|||
g_Renderer.Lock();
|
||||
}
|
||||
|
||||
GameStatus ControlPhase()
|
||||
GameStatus ControlPhase(bool insideMenu)
|
||||
{
|
||||
auto time1 = std::chrono::high_resolution_clock::now();
|
||||
bool isTitle = (CurrentLevel == 0);
|
||||
|
@ -226,14 +226,17 @@ GameStatus ControlPhase()
|
|||
g_GameScript->OnLoop(DELTA_TIME, true);
|
||||
|
||||
// Handle inventory, pause, load, save screens.
|
||||
auto result = HandleMenuCalls(isTitle);
|
||||
if (result != GameStatus::Normal)
|
||||
return result;
|
||||
if (!insideMenu)
|
||||
{
|
||||
auto result = HandleMenuCalls(isTitle);
|
||||
if (result != GameStatus::Normal)
|
||||
return result;
|
||||
|
||||
// Handle global input events.
|
||||
result = HandleGlobalInputEvents(isTitle);
|
||||
if (result != GameStatus::Normal)
|
||||
return result;
|
||||
// Handle global input events.
|
||||
result = HandleGlobalInputEvents(isTitle);
|
||||
if (result != GameStatus::Normal)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Clear savegame loaded flag.
|
||||
JustLoaded = false;
|
||||
|
@ -534,7 +537,7 @@ GameStatus DoGameLoop(int levelIndex)
|
|||
|
||||
// Before entering actual game loop, ControlPhase() must be
|
||||
// called once to sort out various runtime shenanigangs (e.g. hair).
|
||||
status = ControlPhase();
|
||||
status = ControlPhase(false);
|
||||
|
||||
g_Synchronizer.Init();
|
||||
bool legacy30FpsDoneDraw = false;
|
||||
|
@ -545,7 +548,7 @@ GameStatus DoGameLoop(int levelIndex)
|
|||
|
||||
while (g_Synchronizer.Synced())
|
||||
{
|
||||
status = ControlPhase();
|
||||
status = ControlPhase(false);
|
||||
g_Synchronizer.Step();
|
||||
|
||||
legacy30FpsDoneDraw = false;
|
||||
|
|
|
@ -80,7 +80,7 @@ extern std::vector<short> OutsideRoomTable[OUTSIDE_SIZE][OUTSIDE_SIZE];
|
|||
|
||||
void DrawPhase(bool isTitle, float interpolationFactor);
|
||||
|
||||
GameStatus ControlPhase();
|
||||
GameStatus ControlPhase(bool insideMenu);
|
||||
GameStatus DoLevel(int levelIndex, bool loadGame = false);
|
||||
GameStatus DoGameLoop(int levelIndex);
|
||||
void EndGameLoop(int levelIndex, GameStatus reason);
|
||||
|
|
|
@ -627,6 +627,8 @@ namespace TEN::Gui
|
|||
g_Renderer.ChangeScreenResolution(CurrentSettings.Configuration.ScreenWidth, CurrentSettings.Configuration.ScreenHeight,
|
||||
CurrentSettings.Configuration.EnableWindowedMode);
|
||||
|
||||
g_Renderer.SetGraphicsSettingsChanged();
|
||||
|
||||
MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options;
|
||||
SelectedOption = fromPauseMenu ? 1 : 0;
|
||||
}
|
||||
|
@ -684,77 +686,114 @@ namespace TEN::Gui
|
|||
{
|
||||
ClearAllActions();
|
||||
|
||||
g_Synchronizer.Init();
|
||||
|
||||
bool legacy30FpsDoneDraw = false;
|
||||
bool decreaseCounter = false;
|
||||
|
||||
while (CurrentSettings.NewKeyWaitTimer > 0.0f)
|
||||
{
|
||||
CurrentSettings.NewKeyWaitTimer -= 1.0f;
|
||||
if (CurrentSettings.NewKeyWaitTimer <= 0.0f)
|
||||
CurrentSettings.NewKeyWaitTimer = 0.0f;
|
||||
g_Synchronizer.Sync();
|
||||
|
||||
UpdateInputActions(item);
|
||||
while (g_Synchronizer.Synced())
|
||||
{
|
||||
CurrentSettings.NewKeyWaitTimer -= 1.0f;
|
||||
if (CurrentSettings.NewKeyWaitTimer <= 0.0f)
|
||||
CurrentSettings.NewKeyWaitTimer = 0.0f;
|
||||
|
||||
if (CurrentSettings.IgnoreInput)
|
||||
{
|
||||
if (NoAction())
|
||||
CurrentSettings.IgnoreInput = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int selectedKey = 0;
|
||||
for (selectedKey = 0; selectedKey < MAX_INPUT_SLOTS; selectedKey++)
|
||||
if (!fromPauseMenu)
|
||||
{
|
||||
if (KeyMap[selectedKey])
|
||||
break;
|
||||
ControlPhase(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just for updating blink time
|
||||
g_Renderer.PrepareScene();
|
||||
}
|
||||
|
||||
if (selectedKey == MAX_INPUT_SLOTS)
|
||||
selectedKey = 0;
|
||||
UpdateInputActions(item);
|
||||
|
||||
if (selectedKey && !g_KeyNames[selectedKey].empty())
|
||||
if (CurrentSettings.IgnoreInput)
|
||||
{
|
||||
unsigned int baseIndex = 0;
|
||||
switch (MenuToDisplay)
|
||||
if (NoAction())
|
||||
CurrentSettings.IgnoreInput = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int selectedKey = 0;
|
||||
for (selectedKey = 0; selectedKey < MAX_INPUT_SLOTS; selectedKey++)
|
||||
{
|
||||
case Menu::VehicleActions:
|
||||
baseIndex = (unsigned int)GeneralActionStrings.size();
|
||||
break;
|
||||
|
||||
case Menu::QuickActions:
|
||||
baseIndex = unsigned int(GeneralActionStrings.size() + VehicleActionStrings.size());
|
||||
break;
|
||||
|
||||
case Menu::MenuActions:
|
||||
baseIndex = unsigned int(GeneralActionStrings.size() + VehicleActionStrings.size() + QuickActionStrings.size());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
if (KeyMap[selectedKey])
|
||||
break;
|
||||
}
|
||||
|
||||
Bindings[1][baseIndex + SelectedOption] = selectedKey;
|
||||
DefaultConflict();
|
||||
if (selectedKey == MAX_INPUT_SLOTS)
|
||||
selectedKey = 0;
|
||||
|
||||
CurrentSettings.NewKeyWaitTimer = 0.0f;
|
||||
CurrentSettings.IgnoreInput = true;
|
||||
return;
|
||||
if (selectedKey && !g_KeyNames[selectedKey].empty())
|
||||
{
|
||||
unsigned int baseIndex = 0;
|
||||
switch (MenuToDisplay)
|
||||
{
|
||||
case Menu::VehicleActions:
|
||||
baseIndex = (unsigned int)GeneralActionStrings.size();
|
||||
break;
|
||||
|
||||
case Menu::QuickActions:
|
||||
baseIndex = unsigned int(GeneralActionStrings.size() + VehicleActionStrings.size());
|
||||
break;
|
||||
|
||||
case Menu::MenuActions:
|
||||
baseIndex = unsigned int(GeneralActionStrings.size() + VehicleActionStrings.size() + QuickActionStrings.size());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Bindings[1][baseIndex + SelectedOption] = selectedKey;
|
||||
DefaultConflict();
|
||||
|
||||
CurrentSettings.NewKeyWaitTimer = 0.0f;
|
||||
CurrentSettings.IgnoreInput = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_Synchronizer.Step();
|
||||
|
||||
legacy30FpsDoneDraw = false;
|
||||
}
|
||||
|
||||
if (fromPauseMenu)
|
||||
if (!g_Configuration.EnableHighFramerate)
|
||||
{
|
||||
g_Renderer.RenderInventory();
|
||||
if (!g_Configuration.EnableHighFramerate)
|
||||
if (!legacy30FpsDoneDraw)
|
||||
{
|
||||
g_Renderer.Synchronize();
|
||||
if (fromPauseMenu)
|
||||
{
|
||||
g_Renderer.RenderInventory();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Renderer.RenderTitle(0);
|
||||
}
|
||||
g_Renderer.Lock();
|
||||
legacy30FpsDoneDraw = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Renderer.RenderTitle(0);
|
||||
if (!g_Configuration.EnableHighFramerate)
|
||||
//g_Renderer.PrepareScene();
|
||||
|
||||
if (fromPauseMenu)
|
||||
{
|
||||
g_Renderer.Synchronize();
|
||||
g_Renderer.RenderInventory();
|
||||
}
|
||||
ControlPhase();
|
||||
else
|
||||
{
|
||||
g_Renderer.RenderTitle(0);
|
||||
}
|
||||
g_Renderer.Lock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,4 +419,9 @@ namespace TEN::Renderer
|
|||
|
||||
_context->RSSetScissorRects(1, rects);
|
||||
}
|
||||
|
||||
void Renderer::SetGraphicsSettingsChanged()
|
||||
{
|
||||
_graphicsSettingsChanged = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -384,6 +384,8 @@ namespace TEN::Renderer
|
|||
// High framerate.
|
||||
float _interpolationFactor = 0.0f;
|
||||
|
||||
bool _graphicsSettingsChanged = false;
|
||||
|
||||
// Private functions
|
||||
void ApplySMAA(RenderTarget2D* renderTarget, RenderView& view);
|
||||
void ApplyFXAA(RenderTarget2D* renderTarget, RenderView& view);
|
||||
|
@ -667,6 +669,8 @@ namespace TEN::Renderer
|
|||
void SetPostProcessStrength(float strength);
|
||||
Vector3 GetPostProcessTint();
|
||||
void SetPostProcessTint(Vector3 color);
|
||||
|
||||
void SetGraphicsSettingsChanged();
|
||||
};
|
||||
|
||||
extern Renderer g_Renderer;
|
||||
|
|
|
@ -2156,6 +2156,8 @@ namespace TEN::Renderer
|
|||
void Renderer::DumpGameScene()
|
||||
{
|
||||
RenderScene(&_dumpScreenRenderTarget, false, _gameCamera);
|
||||
|
||||
_graphicsSettingsChanged = false;
|
||||
}
|
||||
|
||||
void Renderer::DrawItems(RenderView& view, RendererPass rendererPass)
|
||||
|
|
|
@ -1138,9 +1138,24 @@ namespace TEN::Renderer
|
|||
|
||||
void Renderer::RenderInventory()
|
||||
{
|
||||
if (_graphicsSettingsChanged)
|
||||
{
|
||||
_currentGameCamera = RenderView(&Camera, Camera.Roll, Camera.Fov, 32, BLOCK(g_GameFlow->GetLevel(CurrentLevel)->GetFarView()), g_Configuration.ScreenWidth, g_Configuration.ScreenHeight);
|
||||
_gameCamera = RenderView(&Camera, Camera.Roll, Camera.Fov, 32, BLOCK(g_GameFlow->GetLevel(CurrentLevel)->GetFarView()), g_Configuration.ScreenWidth, g_Configuration.ScreenHeight);
|
||||
|
||||
Camera.DisableInterpolation = true;
|
||||
|
||||
DumpGameScene();
|
||||
}
|
||||
|
||||
_context->ClearDepthStencilView(_backBuffer.DepthStencilView.Get(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0);
|
||||
_context->ClearRenderTargetView(_backBuffer.RenderTargetView.Get(), Colors::Black);
|
||||
|
||||
// Reset GPU state.
|
||||
SetBlendMode(BlendMode::Opaque, true);
|
||||
SetDepthState(DepthState::Write, true);
|
||||
SetCullMode(CullMode::CounterClockwise, true);
|
||||
|
||||
RenderInventoryScene(&_backBuffer, &_dumpScreenRenderTarget, 0.5f);
|
||||
|
||||
_swapChain->Present(1, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue