Merge branch 'master' into very_experimental_input_stuff

This commit is contained in:
Sezz 2022-08-12 23:44:05 +10:00
commit c32be322ab
81 changed files with 1287 additions and 850 deletions

View file

@ -1,12 +1,26 @@
Version 1.0.1
=============
- Added antialiasing support.
- Fixed some issues with shimmying between diagonal ledges and walls.
- Fixed rope transparency.
- Fixed objects disappearing under certain angles at the edges of the screen.
- Fixed incorrect polerope grabbing.
- Fixed camera behaviour with pushable blocks.
- Fixed minecart unduck on inclines.
- Fixed quadbike dismount with jump key and allow to shoot big gun with action key.
- Fixed rollingball incorrectly killing Lara in water and in jump.
- Fixed resurfacing on underwater death.
- Fixed ripples not appearing on water connections higher than room bottom.
- Prevent title music audio from starting in a random place.
- Update harpoon speed on room change.
- Timer.Create now lets you choose the units to display remaining time.
- Fatal script errors now boot you to the title (it will crash if the title itself has these errors).
- SetFarView has been removed, and Flow.Level.farView is now uncapped.
- DisplayString text will now be cleared when a level is exited or reloaded.
- EventSequence.lua has been added and documented.
Version 1.0
===========
First beta release.
First beta release.

View file

@ -9,9 +9,13 @@ new_type("tenclass", "2 Classes", true)
new_type("tenprimitive", "3 Primitive Classes", true)
new_type("enum", "4 Enums", true)
new_type("luautil", "5 Lua utility modules", true)
not_luadoc = true
local version = "1.0.1"
project = "TombEngine"
title = "TombEngine Lua API"
description = "TombEngine scripting interface"
title = "TombEngine " .. version .. " Lua API"
description = "TombEngine " .. version .. " scripting interface"
full_description = [[Welcome to the TombEngine scripting API. This is a work in progress and some information might be wrong or outdated. Please also note that this is primarily a reference document, not a tutorial, so expect descriptions to be fairly sparse. At the time of writing, there is a tutorial describing the basics of Lua, as well as a number of example scripts, on the wiki at https://github.com/MontyTRC89/TombEngine/wiki.
####Module Hierarchy (boring but important)
Other than the "special tables" (GameVars, LevelVars and LevelFuncs), every module described herein is held in a master table called TEN.
@ -24,7 +28,7 @@ This will put the modules and classes in the global table. In other words, it me
local door = GetMoveableByName("door_type4_14")
####Always check logs/TENLog.txt
If you are scripting levels, TombEngine will often crash, even if `errorMode` (see Flow.Settings) is set to `ErrorMode.WARN` or `ErrorMode.SILENT`.
If you are scripting levels, TombEngine will often kick you back to the title screen, even if `errorMode` (see Flow.Settings) is set to `ErrorMode.WARN` or `ErrorMode.SILENT`.
This might get annoying, but it's on purpose. If your Lua script contains a syntax error (e.g. you're missing `end` at the end of a function), the Lua interpreter will not be able to continue running the script. If it tried to keep running, you'd probably see some pretty strange behaviour, and would possibly get a crash regardless.
@ -34,10 +38,11 @@ Enjoy.
\- _squidshire_
]]
style = true
wrap = true
template = true
format = 'markdown'
format='markdown'
no_space_before_args = true
custom_display_name_handler = function(item, default_handler)

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -244,7 +245,7 @@
</li>
<li><span class="parameter">blendMode</span>
<span class="types"><span class="type">BlendID</span></span>
(default TEN.Misc.BlendID.ALPHABLEND) How will we blend this with its surroundings?
(default TEN.Effects.BlendID.ALPHABLEND) How will we blend this with its surroundings?
</li>
<li><span class="parameter">startSize</span>
<span class="types"><span class="type">int</span></span>
@ -281,7 +282,7 @@
</span> -<span class="number">2</span>, <span class="comment">-- rot
</span> Color(<span class="number">255</span>, <span class="number">0</span>, <span class="number">0</span>), <span class="comment">-- startColor
</span> Color(<span class="number">0</span>, <span class="number">255</span>, <span class="number">0</span>), <span class="comment">-- endColor
</span> TEN.Misc.BlendID.ADDITIVE, <span class="comment">-- blendMode
</span> TEN.Effects.BlendID.ADDITIVE, <span class="comment">-- blendMode
</span> <span class="number">15</span>, <span class="comment">-- startSize
</span> <span class="number">50</span>, <span class="comment">-- endSize
</span> <span class="number">20</span>, <span class="comment">-- lifetime
@ -510,7 +511,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -79,6 +79,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -108,10 +109,6 @@
<td class="name" ><a href="#SetTitleScreenImagePath">SetTitleScreenImagePath(path)</a></td>
<td class="summary">Image to show in the background of the title screen.</td>
</tr>
<tr>
<td class="name" ><a href="#SetFarView">SetFarView(farview)</a></td>
<td class="summary">Maximum draw distance.</td>
</tr>
</table>
<h2><a href="#settings_lua">settings.lua </a></h2>
<table class="function_list">
@ -221,30 +218,6 @@ Must be a .jpg or .png image.
</dd>
<dt>
<a name = "SetFarView"></a>
<strong>SetFarView(farview)</strong>
</dt>
<dd>
Maximum draw distance.
The maximum draw distance, in sectors (blocks), of any level in the game.
This is equivalent to TRNG's WorldFarView variable.
<strong>(not yet implemented)</strong>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">farview</span>
<span class="types"><span class="type">byte</span></span>
Number of sectors. Must be in the range [1, 127].
</li>
</ul>
</dd>
</dl>
<h2 class="section-header has-description"><a name="settings_lua"></a>settings.lua </h2>
@ -380,7 +353,7 @@ Specify which translations in the strings table correspond to which languages.
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -203,7 +204,7 @@ Similar to <a href="../1 modules/Inventory.html#GiveItem">GiveItem</a> but repla
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -78,6 +78,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -278,7 +279,7 @@ and provides the delta time (a float representing game time since last call) via
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -632,7 +633,7 @@ To be used with <a href="../2 classes/Strings.DisplayString.html#DisplayString:G
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-08-02 21:24:26 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -296,7 +297,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -168,7 +169,7 @@ with a call to <a href="../1 modules/Strings.html#ShowString">ShowString</a>, or
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -73,6 +73,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -99,7 +100,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -78,6 +78,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -226,7 +227,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -181,7 +182,7 @@ EXAMINE
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -78,6 +78,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -159,10 +160,6 @@
<td class="summary">(<a href="../2 classes/Flow.Mirror.html#">Flow.Mirror</a>) Location and size of the level's mirror, if present.</td>
</tr>
<tr>
<td class="name" ><a href="#farView">farView</a></td>
<td class="summary">(byte) The maximum draw distance for level.</td>
</tr>
<tr>
<td class="name" ><a href="#unlimitedAir">unlimitedAir</a></td>
<td class="summary">(bool) Enable unlimited oxygen supply when in water.</td>
</tr>
@ -170,6 +167,10 @@
<td class="name" ><a href="#objects">objects</a></td>
<td class="summary">(table of <a href="../2 classes/Flow.InventoryItem.html#">Flow.InventoryItem</a>s) table of inventory object overrides</td>
</tr>
<tr>
<td class="name" ><a href="#farView">farView</a></td>
<td class="summary">(int) The maximum draw distance for level.</td>
</tr>
</table>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
@ -297,9 +298,7 @@
<dd>
(<a href="../2 classes/Flow.Fog.html#">Flow.Fog</a>) omni fog RGB color and distance.
As seen in TR4's Desert Railroad.
If not provided, distance fog will be black.</p>
<p> <strong>(not yet implemented)</strong>
If not provided, distance fog will be black.
@ -441,26 +440,6 @@ Invisible
</dd>
<dt>
<a name = "farView"></a>
<strong>farView</strong>
</dt>
<dd>
(byte) The maximum draw distance for level.
Given in sectors (blocks).
Must be in the range [1, 127], and equal to or less than the value passed to SetGameFarView.</p>
<p>This is equivalent to TRNG's LevelFarView variable.</p>
<p><strong>(not yet implemented)</strong>
</dd>
<dt>
<a name = "unlimitedAir"></a>
@ -491,6 +470,24 @@ Must be in the range [1, 127], and equal to or less than the value passed to Set
</dd>
<dt>
<a name = "farView"></a>
<strong>farView</strong>
</dt>
<dd>
(int) The maximum draw distance for level.
Given in sectors (blocks).
Must be at least 4.</p>
<p>This is equivalent to TRNG's LevelFarView variable.
</dd>
</dl>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
@ -522,7 +519,7 @@ Must be in the range [1, 127], and equal to or less than the value passed to Set
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -73,6 +73,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -99,7 +100,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -142,7 +143,7 @@ an invalid argument.</p>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -78,6 +78,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -198,7 +199,7 @@ Less is more. City of The Dead, for example, uses a speed value of 16.
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -371,7 +372,7 @@ aiObj:SetObjectID(TEN.Objects.ObjID.AI_PATROL1)</pre>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -259,7 +260,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -99,11 +100,11 @@ pickups, and Lara herself.</p>
associated getters and setters.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:EnableItem">Moveable:EnableItem()</a></td>
<td class="name" ><a href="#Moveable:Enable">Moveable:Enable()</a></td>
<td class="summary">Enable the item, as if a trigger for it had been stepped on.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:DisableItem">Moveable:DisableItem()</a></td>
<td class="name" ><a href="#Moveable:Disable">Moveable:Disable()</a></td>
<td class="summary">Disable the item</td>
</tr>
<tr>
@ -401,8 +402,8 @@ most can just be ignored (see usage).
</dd>
<dt>
<a name = "Moveable:EnableItem"></a>
<strong>Moveable:EnableItem()</strong>
<a name = "Moveable:Enable"></a>
<strong>Moveable:Enable()</strong>
</dt>
<dd>
Enable the item, as if a trigger for it had been stepped on.
@ -415,8 +416,8 @@ most can just be ignored (see usage).
</dd>
<dt>
<a name = "Moveable:DisableItem"></a>
<strong>Moveable:DisableItem()</strong>
<a name = "Moveable:Disable"></a>
<strong>Moveable:Disable()</strong>
</dt>
<dd>
Disable the item
@ -1487,7 +1488,7 @@ sas:SetPosition(destinationPosition)</pre>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -261,7 +262,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -259,7 +260,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -357,7 +358,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -306,7 +307,7 @@ TEN.Strings.DisplayStringOption.SHADOW -- will give the text a small shadow
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -78,6 +78,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -311,7 +312,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -78,6 +78,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -249,7 +250,7 @@ All values will be clamped to [-32768, 32767].</p>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -78,6 +78,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -276,7 +277,7 @@ However, this function would return it as (0, 1, 1).
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -148,7 +149,7 @@ ALPHABLEND
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -357,7 +358,7 @@ EXAMINE_ITEM8_COMBO2
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -77,6 +77,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -1095,7 +1096,7 @@ PANEL_MIDDLE_CORNER
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -38,6 +38,7 @@
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><strong>Timer</strong></li>
<li><a href="../5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -89,17 +90,26 @@
<p>Basic timer - after a specified number of seconds, the specified thing happens.</p>
<p>
<p> Usage:</p>
<p> Example usage:</p>
<pre>
<span class="keyword">local</span> Timer = <span class="global">require</span>(<span class="string">"Timer"</span>)
LevelFuncs.FinishTimer = <span class="keyword">function</span>(healthWhenStarted, victoryMessage)
DoSomething(healthWhenStarted, victoryMessage)
<span class="comment">-- This will be called when the timer runs out
</span>LevelFuncs.FinishTimer = <span class="keyword">function</span>(healthWhenStarted, victoryMessage)
<span class="comment">-- Open a door, display a message, make an explosion... whatever you wish
</span> DoSomething(healthWhenStarted, victoryMessage)
<span class="keyword">end</span>
LevelFuncs.TriggerTimer = <span class="keyword">function</span>(obj)
<span class="keyword">local</span> myTimer = Timer.Create(<span class="string">"my_timer"</span>, <span class="number">5.0</span>, <span class="keyword">false</span>, <span class="keyword">true</span>, <span class="string">"FinishTimer"</span>, Lara:GetHP(), <span class="string">"Well done!"</span>)
<span class="comment">-- This function triggers the timer
</span>LevelFuncs.TriggerTimer = <span class="keyword">function</span>(obj)
<span class="keyword">local</span> myTimer = Timer.Create(<span class="string">"my_timer"</span>,
<span class="number">5.0</span>,
<span class="keyword">false</span>,
{minutes = <span class="keyword">false</span>, seconds = <span class="keyword">true</span>, deciseconds = <span class="keyword">true</span>},
<span class="string">"FinishTimer"</span>,
Lara:GetHP(),
<span class="string">"Well done!"</span>)
myTimer:Start()
<span class="keyword">end</span>
@ -114,7 +124,7 @@ LevelFuncs.OnControlPhase = <span class="keyword">function</span>(dt)
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" ><a href="#Create">Create(name, totalTime, loop, showString, func, funcArgs)</a></td>
<td class="name" ><a href="#Create">Create(name, totalTime, loop, timerFormat, func[, ...])</a></td>
<td class="summary">Create (but do not start) a new timer.</td>
</tr>
<tr>
@ -122,45 +132,53 @@ LevelFuncs.OnControlPhase = <span class="keyword">function</span>(dt)
<td class="summary">Get a timer by its name.</td>
</tr>
<tr>
<td class="name" ><a href="#SetFunction">SetFunction(t, func, funcArgs)</a></td>
<td class="name" ><a href="#UpdateAll">UpdateAll(dt)</a></td>
<td class="summary">Update all active timers.</td>
</tr>
<tr>
<td class="name" ><a href="#myTimer:SetFunction">myTimer:SetFunction(func[, ...])</a></td>
<td class="summary">Give the timer a new function and args</td>
</tr>
<tr>
<td class="name" ><a href="#Start">Start(t)</a></td>
<td class="name" ><a href="#myTimer:Start">myTimer:Start()</a></td>
<td class="summary">Begin or unpause a timer.</td>
</tr>
<tr>
<td class="name" ><a href="#Pause">Pause(t)</a></td>
<td class="summary">Pause the timer.</td>
</tr>
<tr>
<td class="name" ><a href="#Stop">Stop(t)</a></td>
<td class="name" ><a href="#myTimer:Stop">myTimer:Stop()</a></td>
<td class="summary">Stop the timer.</td>
</tr>
<tr>
<td class="name" ><a href="#GetRemainingTime">GetRemainingTime(t)</a></td>
<td class="name" ><a href="#myTimer:IsActive">myTimer:IsActive()</a></td>
<td class="summary">Get whether or not the timer is active</td>
</tr>
<tr>
<td class="name" ><a href="#myTimer:SetPaused">myTimer:SetPaused(p)</a></td>
<td class="summary">Pause or unpause the timer.</td>
</tr>
<tr>
<td class="name" ><a href="#myTimer:IsPaused">myTimer:IsPaused()</a></td>
<td class="summary">Get whether or not the timer is paused</td>
</tr>
<tr>
<td class="name" ><a href="#myTimer:GetRemainingTime">myTimer:GetRemainingTime()</a></td>
<td class="summary">Get the remaining time for a timer.</td>
</tr>
<tr>
<td class="name" ><a href="#SetRemainingTime">SetRemainingTime(t, remainingTime)</a></td>
<td class="name" ><a href="#myTimer:SetRemainingTime">myTimer:SetRemainingTime(remainingTime)</a></td>
<td class="summary">Set the remaining time for a timer</td>
</tr>
<tr>
<td class="name" ><a href="#GetTotalTime">GetTotalTime(t)</a></td>
<td class="name" ><a href="#myTimer:GetRemainingTime">myTimer:GetRemainingTime()</a></td>
<td class="summary">Get the total time for a timer.</td>
</tr>
<tr>
<td class="name" ><a href="#SetTotalTime">SetTotalTime(t, totalTime)</a></td>
<td class="name" ><a href="#myTimer:SetTotalTime">myTimer:SetTotalTime(totalTime)</a></td>
<td class="summary">Set the total time for a timer</td>
</tr>
<tr>
<td class="name" ><a href="#SetLooping">SetLooping(t, looping)</a></td>
<td class="name" ><a href="#myTimer:SetLooping">myTimer:SetLooping(looping)</a></td>
<td class="summary">Set whether or not the timer loops</td>
</tr>
<tr>
<td class="name" ><a href="#UpdateAll">UpdateAll(dt)</a></td>
<td class="summary">Update all active timers.</td>
</tr>
</table>
<br/>
@ -172,10 +190,31 @@ LevelFuncs.OnControlPhase = <span class="keyword">function</span>(dt)
<dl class="function">
<dt>
<a name = "Create"></a>
<strong>Create(name, totalTime, loop, showString, func, funcArgs)</strong>
<strong>Create(name, totalTime, loop, timerFormat, func[, ...])</strong>
</dt>
<dd>
Create (but do not start) a new timer.
Create (but do not start) a new timer. </p>
<p> You have the option of displaying the remaining time on the clock. Timer format details:</p>
<pre><code>-- deciseconds are 1/10th of a second
-- mins:secs
local myTimeFormat1 = {minutes = true, seconds = true, deciseconds = false}
-- also mins:secs
local myTimeFormat2 = {minutes = true, seconds = true}
-- secs:decisecs
local myTimeFormat3 = {seconds = true, deciseconds = true}
-- secs; also what is printed if you pass true instead of a table
local myTimeFormat4 = {seconds = true}
</code></pre>
<p><strong>At any given time, only one timer can show its countdown</strong>.</p>
<p>Use this sparingly; in the classics, timed challenges did not have visible countdowns. For shorter timers, the gameplay benefit from showing the remaining time might not be necessary, and could interfere with the atmosphere of the level.
<h3>Parameters:</h3>
@ -192,16 +231,17 @@ LevelFuncs.OnControlPhase = <span class="keyword">function</span>(dt)
<span class="types"><span class="type">bool</span></span>
if true, the timer will start again immediately after the time has elapsed
</li>
<li><span class="parameter">showString</span>
<span class="types"><span class="type">bool</span></span>
if true, the remaining time, rounded up, will show at the bottom of the screen. <strong>At any given time, only one timer can show its remaining time</strong>.
<li><span class="parameter">timerFormat</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a> or <span class="type">bool</span></span>
If a table is given, the remaining time will be shown as a string, formatted according to the values in the table. If true, the remaining seconds, rounded up, will show at the bottom of the screen. If false, the remaining time will not be shown on screen.
</li>
<li><span class="parameter">func</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The name of the LevelFunc member to call when the time is up
The name of the LevelFunc member to call when the time is upssss
</li>
<li><span class="parameter">funcArgs</span>
the arguments with which the above function will be called
<li><span class="parameter">...</span>
a variable number of arguments with which the above function will be called
(<em>optional</em>)
</li>
</ul>
@ -240,216 +280,6 @@ LevelFuncs.OnControlPhase = <span class="keyword">function</span>(dt)
</dd>
<dt>
<a name = "SetFunction"></a>
<strong>SetFunction(t, func, funcArgs)</strong>
</dt>
<dd>
Give the timer a new function and args
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
<li><span class="parameter">func</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The name of the LevelFunc member to call when the time is up
</li>
<li><span class="parameter">funcArgs</span>
the arguments with which the above function will be called
</li>
</ul>
</dd>
<dt>
<a name = "Start"></a>
<strong>Start(t)</strong>
</dt>
<dd>
Begin or unpause a timer. If showing the remaining time on-screen, its color will be set to white.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
</ul>
</dd>
<dt>
<a name = "Pause"></a>
<strong>Pause(t)</strong>
</dt>
<dd>
Pause the timer. If showing the remaining time on-screen, its color will be set to yellow.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
</ul>
</dd>
<dt>
<a name = "Stop"></a>
<strong>Stop(t)</strong>
</dt>
<dd>
Stop the timer.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
</ul>
</dd>
<dt>
<a name = "GetRemainingTime"></a>
<strong>GetRemainingTime(t)</strong>
</dt>
<dd>
Get the remaining time for a timer.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
</ul>
<h3>Returns:</h3>
<ol>
the time in seconds remaining on the clock
</ol>
</dd>
<dt>
<a name = "SetRemainingTime"></a>
<strong>SetRemainingTime(t, remainingTime)</strong>
</dt>
<dd>
Set the remaining time for a timer
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
<li><span class="parameter">remainingTime</span>
<span class="types"><span class="type">number</span></span>
the new time remaining for the timer
</li>
</ul>
</dd>
<dt>
<a name = "GetTotalTime"></a>
<strong>GetTotalTime(t)</strong>
</dt>
<dd>
Get the total time for a timer.
This is the amount of time the timer will start with, as well as when starting a new loop
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
</ul>
<h3>Returns:</h3>
<ol>
the timer's total time
</ol>
</dd>
<dt>
<a name = "SetTotalTime"></a>
<strong>SetTotalTime(t, totalTime)</strong>
</dt>
<dd>
Set the total time for a timer
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
<li><span class="parameter">totalTime</span>
<span class="types"><span class="type">number</span></span>
timer's new total time
</li>
</ul>
</dd>
<dt>
<a name = "SetLooping"></a>
<strong>SetLooping(t, looping)</strong>
</dt>
<dd>
Set whether or not the timer loops
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
the timer in question
</li>
<li><span class="parameter">looping</span>
<span class="types"><span class="type">bool</span></span>
whether or not the timer loops
</li>
</ul>
</dd>
<dt>
<a name = "UpdateAll"></a>
@ -472,6 +302,220 @@ LevelFuncs.OnControlPhase = <span class="keyword">function</span>(dt)
</dd>
<dt>
<a name = "myTimer:SetFunction"></a>
<strong>myTimer:SetFunction(func[, ...])</strong>
</dt>
<dd>
Give the timer a new function and args
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">func</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The name of the LevelFunc member to call when the time is up
</li>
<li><span class="parameter">...</span>
a variable number of arguments with which the above function will be called
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "myTimer:Start"></a>
<strong>myTimer:Start()</strong>
</dt>
<dd>
Begin or unpause a timer. If showing the remaining time on-screen, its color will be set to white.
</dd>
<dt>
<a name = "myTimer:Stop"></a>
<strong>myTimer:Stop()</strong>
</dt>
<dd>
Stop the timer.
</dd>
<dt>
<a name = "myTimer:IsActive"></a>
<strong>myTimer:IsActive()</strong>
</dt>
<dd>
Get whether or not the timer is active
<h3>Returns:</h3>
<ol>
true if the timer is active, false if otherwise
</ol>
</dd>
<dt>
<a name = "myTimer:SetPaused"></a>
<strong>myTimer:SetPaused(p)</strong>
</dt>
<dd>
Pause or unpause the timer. If showing the remaining time on-screen, its color will be set to yellow (paused) or white (unpaused).
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">p</span>
<span class="types"><span class="type">bool</span></span>
if true, the timer will be paused; if false, it would be unpaused
</li>
</ul>
</dd>
<dt>
<a name = "myTimer:IsPaused"></a>
<strong>myTimer:IsPaused()</strong>
</dt>
<dd>
Get whether or not the timer is paused
<h3>Returns:</h3>
<ol>
true if the timer is paused, false if otherwise
</ol>
</dd>
<dt>
<a name = "myTimer:GetRemainingTime"></a>
<strong>myTimer:GetRemainingTime()</strong>
</dt>
<dd>
Get the remaining time for a timer.
<h3>Returns:</h3>
<ol>
the time in seconds remaining on the clock
</ol>
</dd>
<dt>
<a name = "myTimer:SetRemainingTime"></a>
<strong>myTimer:SetRemainingTime(remainingTime)</strong>
</dt>
<dd>
Set the remaining time for a timer
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">remainingTime</span>
<span class="types"><span class="type">number</span></span>
the new time remaining for the timer
</li>
</ul>
</dd>
<dt>
<a name = "myTimer:GetRemainingTime"></a>
<strong>myTimer:GetRemainingTime()</strong>
</dt>
<dd>
Get the total time for a timer.
This is the amount of time the timer will start with, as well as when starting a new loop
<h3>Returns:</h3>
<ol>
the timer's total time
</ol>
</dd>
<dt>
<a name = "myTimer:SetTotalTime"></a>
<strong>myTimer:SetTotalTime(totalTime)</strong>
</dt>
<dd>
Set the total time for a timer
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">totalTime</span>
<span class="types"><span class="type">number</span></span>
timer's new total time
</li>
</ul>
</dd>
<dt>
<a name = "myTimer:SetLooping"></a>
<strong>myTimer:SetLooping(looping)</strong>
</dt>
<dd>
Set whether or not the timer loops
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">looping</span>
<span class="types"><span class="type">bool</span></span>
whether or not the timer loops
</li>
</ul>
</dd>
</dl>
@ -480,7 +524,7 @@ LevelFuncs.OnControlPhase = <span class="keyword">function</span>(dt)
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-08-01 20:38:26 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -38,6 +38,7 @@
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="../5 lua utility modules/Timer.html">Timer</a></li>
<li><strong>Util</strong></li>
</ul>
@ -137,7 +138,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>TombEngine Lua API</title>
<title>TombEngine 1.0.1 Lua API</title>
<link rel="stylesheet" href="ldoc.css" type="text/css" />
</head>
<body>
@ -70,6 +70,7 @@
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
<li><a href="5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li><a href="5 lua utility modules/Timer.html">Timer</a></li>
<li><a href="5 lua utility modules/Util.html">Util</a></li>
</ul>
@ -79,7 +80,7 @@
<div id="content">
<h2>TombEngine scripting interface</h2>
<h2>TombEngine 1.0.1 scripting interface</h2>
<p>Welcome to the TombEngine scripting API. This is a work in progress and some information might be wrong or outdated. Please also note that this is primarily a reference document, not a tutorial, so expect descriptions to be fairly sparse. At the time of writing, there is a tutorial describing the basics of Lua, as well as a number of example scripts, on the wiki at https://github.com/MontyTRC89/TombEngine/wiki.</p>
<h4>Module Hierarchy (boring but important)</h4>
<p>Other than the "special tables" (GameVars, LevelVars and LevelFuncs), every module described herein is held in a master table called TEN.
@ -95,7 +96,7 @@ Util.ShortenTENCalls()
</code></pre>
<h4>Always check logs/TENLog.txt</h4>
<p>If you are scripting levels, TombEngine will often crash, even if <code>errorMode</code> (see Flow.Settings) is set to <code>ErrorMode.WARN</code> or <code>ErrorMode.SILENT</code>.</p>
<p>If you are scripting levels, TombEngine will often kick you back to the title screen, even if <code>errorMode</code> (see Flow.Settings) is set to <code>ErrorMode.WARN</code> or <code>ErrorMode.SILENT</code>.</p>
<p>This might get annoying, but it's on purpose. If your Lua script contains a syntax error (e.g. you're missing <code>end</code> at the end of a function), the Lua interpreter will not be able to continue running the script. If it tried to keep running, you'd probably see some pretty strange behaviour, and would possibly get a crash regardless.</p>
@ -227,6 +228,10 @@ Util.ShortenTENCalls()
</table>
<h2>5 Lua utility modules</h2>
<table class="module_list">
<tr>
<td class="name" ><a href="5 lua utility modules/EventSequence.html">EventSequence</a></td>
<td class="summary">Event sequence - a chain of functions to call at specified times, modeled after TRNG's organizers.</td>
</tr>
<tr>
<td class="name" ><a href="5 lua utility modules/Timer.html">Timer</a></td>
<td class="summary">Basic timer - after a specified number of seconds, the specified thing happens.</td>
@ -241,7 +246,7 @@ Util.ShortenTENCalls()
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-07-31 20:38:24 </i>
<i style="float:right;">Last updated 2022-08-11 22:43:52 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -1,3 +1,20 @@
/* styles for prettification of source */
pre .comment { color: #558817; }
pre .constant { color: #a8660d; }
pre .escape { color: #844631; }
pre .keyword { color: #aa5050; font-weight: bold; }
pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #800080; }
pre .user-keyword { color: #800080; }
pre .prompt { color: #558817; }
pre .url { color: #272fc2; text-decoration: underline; }
body {
margin-left: 1em;
margin-right: 1em;

View file

@ -1,3 +1,20 @@
/* styles for prettification of source */
pre .comment { color: #558817; }
pre .constant { color: #a8660d; }
pre .escape { color: #844631; }
pre .keyword { color: #aa5050; font-weight: bold; }
pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #800080; }
pre .user-keyword { color: #800080; }
pre .prompt { color: #558817; }
pre .url { color: #272fc2; text-decoration: underline; }
body {
margin-left: 1em;
margin-right: 1em;
@ -19,7 +36,10 @@ p, ul { margin: 10px 0 0 0px;}
strong { font-weight: bold;}
em { font-style: italic;}
address,caption,cite,code,dfn,em,strong,th,var,optgroup {
font-style: inherit;
font-weight: inherit;
}
h1 {
font-size: 1.5em;
margin: 20px 0 20px 0;

View file

@ -1,11 +1,81 @@
-----
--- Event sequence - a chain of functions to call at specified times, modeled after TRNG's organizers.
-- Example usage:
-- local EventSequence = require("EventSequence")
--
-- -- These will be called by the sequence
-- LevelFuncs.HealLara = function()
-- Lara:SetHP(Lara:GetHP()+10)
-- end
--
-- local nSpawned = 0
-- LevelFuncs.SpawnBaddy = function(baddy, name, pos)
-- local myBaddy = TEN.Objects.Moveable(baddy, name..nSpawned, pos, nil, 0)
-- myBaddy:Enable()
-- nSpawned = nSpawned + 1
-- end
--
-- -- This function triggers the sequence
-- LevelFuncs.TriggerSequence = function(obj)
-- local posSteve = TEN.Objects.GetMoveableByName("stevePosNullmesh"):GetPosition()
-- local posChris = TEN.Objects.GetMoveableByName("chrisPosNullmesh"):GetPosition()
-- local mySeq = EventSequence.Create("my_seq",
-- false, -- does not loop
-- {seconds = true, deciseconds = true}, -- timer format, see Timer for details
-- 6, -- seconds until call the function specified in next arg
-- "HealLara", -- first function to call. If we don't need to pass any arguments, we can just give the func name as a string
-- 2.1, -- seconds until the next function, after the previous one has been called
-- {"SpawnBaddy", TEN.Objects.ObjID.BADDY1, "steve", posSteve}, -- if we DO want to pass arguments to the function to be called, we give a table with the name of the function ("SpawnBaddy" in this case) followed by the args to pass to it
-- 0.5,
-- {"SpawnBaddy", TEN.Objects.ObjID.SAS_CAIRO, "chris", posChris},
-- 1,
-- "HealLara")
--
-- -- event sequences are inactive to begin with and so need to be started
-- mySeq:Start()
-- end
--
-- -- EventSequence runs on Timer, so this call is required
-- LevelFuncs.OnControlPhase = function(dt)
-- Timer.UpdateAll(dt)
-- end
--
-- @luautil EventSequence
local Timer = require("Timer")
local EventSequence
LevelVars.__TEN_eventSequence = {sequences = {}}
LevelFuncs.__TEN_eventSequence_callNext = function(sequenceName, nextTimerName, func, ...)
local thisES = LevelVars.__TEN_eventSequence.sequences[sequenceName]
LevelFuncs[func](...)
thisES.currentTimer = thisES.currentTimer + 1
if thisES.currentTimer <= #thisES.timers then
local theTimer = Timer.Get(nextTimerName)
theTimer:SetRemainingTime(theTimer:GetTotalTime())
theTimer:Start()
elseif thisES.loop then
local theTimer = Timer.Get(thisES.firstTimerName)
theTimer:SetRemainingTime(theTimer:GetTotalTime())
theTimer:Start()
thisES.currentTimer = 1
else
thisES.currentTimer = 1
end
end
EventSequence = {
Create = function(name, showString, ...)
--- Create (but do not start) a new event sequence.
--
-- @string name A label to give the sequence; used to retrieve the timer later as well as internally by TEN.
-- @bool loop if true, the sequence will start again from its first timer once its final function has been called
-- @tparam ?table|bool timerFormat same as in Timer. This is mainly for debugging. __This will not work properly if another sequence or timer is showing a countdown.__
-- @param[opt] ... a variable number of pairs of arguments - a time in seconds, followed by the function (must be defined in the LevelFuncs table) to call once the time has elapsed, followed by another duration in seconds, another function name, etc. You can specify a function either by its name as a string, or by a table with the function name as the first member, followed by its arguments (see above example).
-- @return The inactive sequence.
Create = function(name, loop, timerFormat, ...)
local obj = {}
local mt = {}
mt.__index = EventSequence
@ -13,10 +83,11 @@ EventSequence = {
obj.name = name
LevelVars.__TEN_eventSequence.sequences[name] ={}
LevelVars.__TEN_eventSequence.sequences[name] = {}
local thisES = LevelVars.__TEN_eventSequence.sequences[name]
thisES.name = name
thisES.timesFuncsAndArgs = {...}
thisES.loop = loop
local tfa = thisES.timesFuncsAndArgs
thisES.timers = {}
@ -35,6 +106,10 @@ EventSequence = {
local funcAndArgs = tfa[i+1]
local func
if i == 1 then
thisES.firstTimerName = timerName
end
if type(funcAndArgs) == "string" then
-- we only have a function
func = funcAndArgs
@ -44,29 +119,15 @@ EventSequence = {
func = table.remove(funcAndArgs, 1)
end
if nextTimer < #tfa then
-- This function must start next timer
-- AND do its function
LevelFuncs[funcName] = function(...)
LevelFuncs[func](...)
Timer.Get(nextTimerName):Start()
thisES.currentTimer = timerIndex + 1
end
else
-- final timer
LevelFuncs[funcName] = function(...)
LevelFuncs[func](...)
Timer.Get(timerName):Stop()
thisES.currentTimer = 1
end
end
local thisTimer = Timer.Create(timerName,
tfa[i], -- time
false,
showString,
funcName,
funcAndArgs -- now with func removed
timerFormat,
"__TEN_eventSequence_callNext",
name,
nextTimerName,
func,
table.unpack(funcAndArgs) -- now with func removed
)
thisES.timers[timerIndex] = timerName
@ -75,6 +136,9 @@ EventSequence = {
return obj
end;
--- Get an event sequence by its name.
-- @string name The label that was given to the sequence when it was created
-- @return The sequence
Get = function(name)
if LevelVars.__TEN_eventSequence.sequences[name] then
local obj = {}
@ -85,22 +149,45 @@ EventSequence = {
return obj
end
return nil
end,
end;
Pause = function(t)
--- Pause or unpause the sequence. If showing the remaining time on-screen, its color will be set to yellow (paused) or white (unpaused).
-- @function mySequence:SetPaused
-- @bool p if true, the sequence will be paused; if false, it will be unpaused
SetPaused = function(t, p)
local thisES = LevelVars.__TEN_eventSequence.sequences[t.name]
Timer.Get(thisES.timers[thisES.currentTimer]):Pause()
end,
Timer.Get(thisES.timers[thisES.currentTimer]):SetPaused(p)
end;
Stop = function(t)
--- Get whether or not the sequence is paused
-- @function mySequence:IsPaused
-- @return true if the timer is paused, false if otherwise
IsPaused = function(t)
local thisES = LevelVars.__TEN_eventSequence.sequences[t.name]
Timer.Get(thisES.timers[thisES.currentTimer]):Stop()
end,
return Timer.Get(thisES.timers[thisES.currentTimer]):IsPaused()
end;
--- Begin or unpause a sequence. If showing the remaining time on-screen, its color will be set to white.
-- @function mySequence:Start
Start = function(t)
local thisES = LevelVars.__TEN_eventSequence.sequences[t.name]
Timer.Get(thisES.timers[thisES.currentTimer]):Start()
end;
--- Stop the sequence.
--@function mySequence:Stop
Stop = function(t)
local thisES = LevelVars.__TEN_eventSequence.sequences[t.name]
Timer.Get(thisES.timers[thisES.currentTimer]):Stop()
end;
--- Get whether or not the sequence is active
-- @function mySequence:IsActive
-- @return true if the sequence is active, false if otherwise
IsActive = function(t)
local thisES = LevelVars.__TEN_eventSequence.sequences[t.name]
return Timer.Get(thisES.timers[thisES.currentTimer]):IsActive()
end;
}
return EventSequence

View file

@ -17,10 +17,6 @@ local ItemAction = Flow.ItemAction
Flow.SetIntroImagePath("Screens\\main.jpg")
Flow.SetTitleScreenImagePath("Screens\\main.jpg")
-- Flow.SetFarView sets global far view distance in blocks.
-- It will be overwritten by level.farView value, if it is specified.
Flow.SetFarView(20)
--------------------------------------------------
@ -71,7 +67,6 @@ test.objects = {
-1,
ItemAction.USE
),
myObj,
InventoryItem.new(
"tut1_ba_cartouche2",
InvID.PUZZLE_ITEM3_COMBO2,
@ -114,4 +109,4 @@ test.objects = {
)
}
Flow.AddLevel(test)
Flow.AddLevel(test)

View file

@ -1109,6 +1109,46 @@ local strings = {
"",
""
},
antialiasing = {
"Antialiasing",
"",
"",
"",
"",
"",
"",
""
},
low = {
"Low",
"",
"",
"",
"",
"",
"",
""
},
medium = {
"Medium",
"",
"",
"",
"",
"",
"",
""
},
high = {
"High",
"",
"",
"",
"",
"",
"",
""
},
waiting_for_key = {
"Waiting For Key",
"",

View file

@ -3,9 +3,17 @@
local Util = require("Util")
Util.ShortenTENCalls()
-- Called when entering a level, not called when loading from a save
LevelFuncs.OnStart = function() end
-- Called only when loading from a save
LevelFuncs.OnLoad = function() end
LevelFuncs.OnSave = function() end
LevelFuncs.OnControlPhase = function() end
-- dt stands for "delta time", and holds the time in seconds since the last call to OnControlPhase
LevelFuncs.OnControlPhase = function(dt) end
LevelFuncs.OnEnd = function() end
-- An example function which prints a string and leaves it on screen for 1 second.
@ -114,4 +122,4 @@ LevelFuncs.EmitHaloOnActionPush = function(Triggerer)
Effects.EmitParticle(pos, velocity, 2, 1, rot, Color.new(color * 0.5, color * 0.5, color), Color.new(color * 0.2, color * 0.1, color), 2, 16, 64, 1, false, false)
Effects.EmitLight(pos, Color.new(color * 0.5, color * 0.5, color), 7)
end
end

View file

@ -1,14 +1,23 @@
-----
--- Basic timer - after a specified number of seconds, the specified thing happens.
-- Usage:
-- Example usage:
-- local Timer = require("Timer")
--
-- -- This will be called when the timer runs out
-- LevelFuncs.FinishTimer = function(healthWhenStarted, victoryMessage)
-- -- Open a door, display a message, make an explosion... whatever you wish
-- DoSomething(healthWhenStarted, victoryMessage)
-- end
--
-- -- This function triggers the timer
-- LevelFuncs.TriggerTimer = function(obj)
-- local myTimer = Timer.Create("my_timer", 5.0, false, true, "FinishTimer", Lara:GetHP(), "Well done!")
-- local myTimer = Timer.Create("my_timer",
-- 5.0,
-- false,
-- {minutes = false, seconds = true, deciseconds = true},
-- "FinishTimer",
-- Lara:GetHP(),
-- "Well done!")
-- myTimer:Start()
-- end
--
@ -22,20 +31,42 @@ LevelVars.__TEN_timer = {timers = {}}
local Timer
local unpausedColor = Color(255, 255, 255)
local pausedColor = Color(255, 255, 0)
local unpausedColor = TEN.Color(255, 255, 255)
local pausedColor = TEN.Color(255, 255, 0)
local str = TEN.Strings.DisplayString("TIMER", 0, 0, unpausedColor, false, {TEN.Strings.DisplayStringOption.CENTER, TEN.Strings.DisplayStringOption.SHADOW} )
Timer = {
--- Create (but do not start) a new timer.
--
-- You have the option of displaying the remaining time on the clock. Timer format details:
--
-- -- deciseconds are 1/10th of a second
--
-- -- mins:secs
-- local myTimeFormat1 = {minutes = true, seconds = true, deciseconds = false}
--
-- -- also mins:secs
-- local myTimeFormat2 = {minutes = true, seconds = true}
--
-- -- secs:decisecs
-- local myTimeFormat3 = {seconds = true, deciseconds = true}
--
-- -- secs; also what is printed if you pass true instead of a table
-- local myTimeFormat4 = {seconds = true}
--
--__At any given time, only one timer can show its countdown__.
--
--Use this sparingly; in the classics, timed challenges did not have visible countdowns. For shorter timers, the gameplay benefit from showing the remaining time might not be necessary, and could interfere with the atmosphere of the level.
--
-- @string name A label to give this timer; used to retrieve the timer later
-- @number totalTime The duration of the timer, in seconds
-- @bool loop if true, the timer will start again immediately after the time has elapsed
-- @bool showString if true, the remaining time, rounded up, will show at the bottom of the screen. __At any given time, only one timer can show its remaining time__.
-- @string func The name of the LevelFunc member to call when the time is up
-- @param funcArgs the arguments with which the above function will be called
-- @tparam ?table|bool timerFormat If a table is given, the remaining time will be shown as a string, formatted according to the values in the table. If true, the remaining seconds, rounded up, will show at the bottom of the screen. If false, the remaining time will not be shown on screen.
-- @string func The name of the LevelFunc member to call when the time is upssss
-- @param[opt] ... a variable number of arguments with which the above function will be called
-- @return The timer in its paused state
Create = function(name, totalTime, loop, showString, func, ...)
--
Create = function(name, totalTime, loop, timerFormat, func, ...)
local obj = {}
local mt = {}
mt.__index = Timer
@ -45,7 +76,6 @@ Timer = {
LevelVars.__TEN_timer.timers[name] ={}
local thisTimer = LevelVars.__TEN_timer.timers[name]
thisTimer.name = name
thisTimer.showString = showString
thisTimer.totalTime = totalTime
thisTimer.remainingTime = totalTime
thisTimer.func = func
@ -53,6 +83,11 @@ Timer = {
thisTimer.loop = loop
thisTimer.active = false
thisTimer.paused = true
if type(timerFormat) == "table" then
thisTimer.timerFormat = timerFormat
elseif timerFormat then
thisTimer.timerFormat = {seconds = true}
end
return obj
end;
@ -69,92 +104,6 @@ Timer = {
return obj
end
return nil
end,
--- Give the timer a new function and args
-- @param t the timer in question
-- @string func The name of the LevelFunc member to call when the time is up
-- @param funcArgs the arguments with which the above function will be called
SetFunction = function(t, func, ...)
local thisTimer = LevelVars.__TEN_timer.timers[t.name]
thisTimer.func = func
thisTimer.funcArgs = {...}
end,
--- Begin or unpause a timer. If showing the remaining time on-screen, its color will be set to white.
-- @param t the timer in question
Start = function(t)
local thisTimer = LevelVars.__TEN_timer.timers[t.name]
if not thisTimer.active then
thisTimer.active = true
end
LevelVars.__TEN_timer.timers[t.name].paused = false
if thisTimer.showString then
str:SetColor(unpausedColor)
end
end;
--- Pause the timer. If showing the remaining time on-screen, its color will be set to yellow.
-- @param t the timer in question
Pause = function(t)
local thisTimer = LevelVars.__TEN_timer.timers[t.name]
thisTimer.paused = true
if thisTimer.showString then
str:SetColor(pausedColor)
end
end,
--- Stop the timer.
-- @param t the timer in question
Stop = function(t)
LevelVars.__TEN_timer.timers[t.name].active = false
end,
--- Get the remaining time for a timer.
-- @param t the timer in question
-- @return the time in seconds remaining on the clock
GetRemainingTime = function(t)
return LevelVars.__TEN_timer.timers[t.name].remainingTime
end,
--- Set the remaining time for a timer
-- @param t the timer in question
-- @number remainingTime the new time remaining for the timer
SetRemainingTime = function(t, remainingTime)
LevelVars.__TEN_timer.timers[t.name].remainingTime = remainingTime
end,
--- Get the total time for a timer.
-- This is the amount of time the timer will start with, as well as when starting a new loop
-- @param t the timer in question
-- @return the timer's total time
GetTotalTime = function(t)
return LevelVars.__TEN_timer.timers[t.name].totalTime
end,
--- Set the total time for a timer
-- @param t the timer in question
-- @number totalTime timer's new total time
SetTotalTime = function(t, totalTime)
LevelVars.__TEN_timer.timers[t.name].totalTime = totalTime
end,
--- Set whether or not the timer loops
-- @param t the timer in question
-- @bool looping whether or not the timer loops
SetLooping = function(t, looping)
LevelVars.__TEN_timer.timers[t.name].loop = looping
end,
--- Update all active timers.
-- Should be called in LevelFuncs.OnControlPhase
-- @number dt The time in seconds since the last frame
UpdateAll = function(dt)
for _, t in pairs(LevelVars.__TEN_timer.timers) do
Timer.Update(t, dt)
end
end;
Update = function(t, dt)
@ -173,17 +122,178 @@ Timer = {
end
end
if t.showString then
if t.timerFormat then
TEN.Strings.HideString(str)
str:SetKey(tostring(math.ceil(t.remainingTime)))
local fmt = ""
local remaining = math.max(t.remainingTime, 0)
local round = math.floor
local subSecond = remaining - math.floor(remaining)
local fmtBefore = false
-- deciseconds
if t.timerFormat.deciseconds then
fmt = math.floor(10*subSecond)
fmtBefore = true
end
-- seconds
if t.timerFormat.seconds then
if not fmtBefore then
round = math.ceil
else
round = math.floor
fmt = ":" .. fmt
end
local roundedSeconds = round(remaining)
local toBeDisplayed = roundedSeconds
if t.timerFormat.minutes then
toBeDisplayed = roundedSeconds % 60
end
fmt = string.format("%02d", toBeDisplayed) .. fmt
remaining = roundedSeconds
fmtBefore = true
end
-- minutes
if t.timerFormat.minutes then
if not fmtBefore then
round = math.ceil
else
round = math.floor
fmt = ":" .. fmt
end
local roundedMinutes = round(remaining/60)
local toBeDisplayed = roundedMinutes
fmt = string.format("%02d", toBeDisplayed) .. fmt
fmtBefore = true
end
str:SetKey(fmt)
local myX, myY = PercentToScreen(50, 90)
str:SetPosition(myX, myY)
-- Do this again in case the player has loaded while the timer was paused already
-- Need a better solution for this
if t.paused then
str:SetColor(pausedColor)
end
TEN.Strings.ShowString(str, 1)
end
end
end;
--- Update all active timers.
-- Should be called in LevelFuncs.OnControlPhase
-- @number dt The time in seconds since the last frame
UpdateAll = function(dt)
for _, t in pairs(LevelVars.__TEN_timer.timers) do
Timer.Update(t, dt)
end
end;
--- Give the timer a new function and args
-- @function myTimer:SetFunction
-- @string func The name of the LevelFunc member to call when the time is up
-- @param[opt] ... a variable number of arguments with which the above function will be called
SetFunction = function(t, func, ...)
local thisTimer = LevelVars.__TEN_timer.timers[t.name]
thisTimer.func = func
thisTimer.funcArgs = {...}
end;
--- Begin or unpause a timer. If showing the remaining time on-screen, its color will be set to white.
-- @function myTimer:Start
Start = function(t)
local thisTimer = LevelVars.__TEN_timer.timers[t.name]
if not thisTimer.active then
thisTimer.active = true
end
thisTimer.paused = false
if thisTimer.timerFormat then
str:SetColor(unpausedColor)
end
end;
--- Stop the timer.
-- @function myTimer:Stop
Stop = function(t)
LevelVars.__TEN_timer.timers[t.name].active = false
end;
--- Get whether or not the timer is active
-- @function myTimer:IsActive
-- @return true if the timer is active, false if otherwise
IsActive = function(t)
return LevelVars.__TEN_timer.timers[t.name].active
end;
--- Pause or unpause the timer. If showing the remaining time on-screen, its color will be set to yellow (paused) or white (unpaused).
-- @function myTimer:SetPaused
-- @bool p if true, the timer will be paused; if false, it would be unpaused
SetPaused = function(t, p)
local thisTimer = LevelVars.__TEN_timer.timers[t.name]
thisTimer.paused = p
if thisTimer.timerFormat then
if p then
str:SetColor(pausedColor)
else
str:SetColor(unpausedColor)
end
end
end;
--- Get whether or not the timer is paused
-- @function myTimer:IsPaused
-- @return true if the timer is paused, false if otherwise
IsPaused = function(t)
return LevelVars.__TEN_timer.timers[t.name].paused
end;
--- Get the remaining time for a timer.
-- @function myTimer:GetRemainingTime
-- @return the time in seconds remaining on the clock
GetRemainingTime = function(t)
return LevelVars.__TEN_timer.timers[t.name].remainingTime
end;
--- Set the remaining time for a timer
-- @function myTimer:SetRemainingTime
-- @number remainingTime the new time remaining for the timer
SetRemainingTime = function(t, remainingTime)
LevelVars.__TEN_timer.timers[t.name].remainingTime = remainingTime
end;
--- Get the total time for a timer.
-- This is the amount of time the timer will start with, as well as when starting a new loop
-- @function myTimer:GetRemainingTime
-- @return the timer's total time
GetTotalTime = function(t)
return LevelVars.__TEN_timer.timers[t.name].totalTime
end;
--- Set the total time for a timer
-- @function myTimer:SetTotalTime
-- @number totalTime timer's new total time
SetTotalTime = function(t, totalTime)
LevelVars.__TEN_timer.timers[t.name].totalTime = totalTime
end;
--- Set whether or not the timer loops
-- @function myTimer:SetLooping
-- @bool looping whether or not the timer loops
SetLooping = function(t, looping)
LevelVars.__TEN_timer.timers[t.name].loop = looping
end;
}
return Timer

View file

@ -555,6 +555,16 @@ void LaraControl(ItemInfo* item, CollisionInfo* coll)
break;
case WaterStatus::Underwater:
// Disable potential Lara resurfacing if her health is zero or below.
// For some reason, originals worked without this condition, but TEN does not. -- Lwmte, 11.08.22
if (item->HitPoints <= 0)
break;
// Determine if Lara's head is above water surface. This is needed to prevent
// pre-TR5 bug where Lara would keep submerged until her root mesh (butt) is above water level.
isWaterOnHeadspace = TestEnvironment(ENV_FLAG_WATER, item->Pose.Position.x, item->Pose.Position.y - CLICK(1), item->Pose.Position.z,
GetCollision(item->Pose.Position.x, item->Pose.Position.y - CLICK(1), item->Pose.Position.z, item->RoomNumber).RoomNumber);

View file

@ -504,7 +504,6 @@ void HarpoonBoltControl(short itemNumber)
// Store old position for later
auto oldPos = item->Pose.Position;
short roomNumber = item->RoomNumber;
bool aboveWater = false;
// Update speed and check if above water
@ -525,10 +524,9 @@ void HarpoonBoltControl(short itemNumber)
else
{
// Create bubbles
if ((Wibble & 15) == 0)
CreateBubble((Vector3Int*)&item->Pose, item->RoomNumber, 0, 0, BUBBLE_FLAG_CLUMP | BUBBLE_FLAG_HIGH_AMPLITUDE, 0, 0, 0); // CHECK
if (Wibble & 4)
CreateBubble((Vector3Int*)&item->Pose, item->RoomNumber, 0, 0, BUBBLE_FLAG_CLUMP | BUBBLE_FLAG_HIGH_AMPLITUDE, 0, 0, 0);
TriggerRocketSmoke(item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z, 64);
item->Animation.VerticalVelocity = -HARPOON_VELOCITY * phd_sin(item->Pose.Orientation.x) / 2;
item->Animation.Velocity = HARPOON_VELOCITY * phd_cos(item->Pose.Orientation.x) / 2;
aboveWater = false;
@ -561,8 +559,8 @@ void HarpoonBoltControl(short itemNumber)
}
// Has harpoon changed room?
if (item->RoomNumber != roomNumber)
ItemNewRoom(itemNumber, roomNumber);
if (item->RoomNumber != probe.RoomNumber)
ItemNewRoom(itemNumber, probe.RoomNumber);
// If now in water and before in land, add a ripple
if (TestEnvironment(ENV_FLAG_WATER, item) && aboveWater)

View file

@ -95,10 +95,9 @@ void LookAt(CAMERA_INFO* cam, short roll)
float fov = TO_RAD(CurrentFOV / 1.333333f);
float r = TO_RAD(roll);
float gameFarView = g_GameFlow->GetGameFarView() * float(SECTOR(1));
float levelFarView = g_GameFlow->GetLevel(CurrentLevel)->GetFarView() * float(SECTOR(1));
g_Renderer.UpdateCameraMatrices(cam, r, fov, std::min(gameFarView, levelFarView));
g_Renderer.UpdateCameraMatrices(cam, r, fov, levelFarView);
}
void AlterFOV(int value)

View file

@ -946,6 +946,12 @@ short GetNearestLedgeAngle(ItemInfo* item, CollisionInfo* coll, float& distance)
auto ffpX = eX + frontFloorProbeOffset * s;
auto ffpZ = eZ + frontFloorProbeOffset * c;
// Calculate block min/max points to filter out out-of-bounds checks.
float minX = floor(ffpX / WALL_SIZE) * WALL_SIZE - 1.0f;
float minZ = floor(ffpZ / WALL_SIZE) * WALL_SIZE - 1.0f;
float maxX = ceil(ffpX / WALL_SIZE) * WALL_SIZE + 1.0f;
float maxZ = ceil(ffpZ / WALL_SIZE) * WALL_SIZE + 1.0f;
// Get front floor block
auto room = GetRoom(item->Location, ffpX, y, ffpZ).roomNumber;
auto block = GetCollision(ffpX, y, ffpZ, room).Block;
@ -1072,6 +1078,11 @@ short GetNearestLedgeAngle(ItemInfo* item, CollisionInfo* coll, float& distance)
if (!ray.Intersects(plane[i], distance))
continue;
// Intersection point is out of block bounds, discard
auto cPoint = ray.position + ray.direction * distance;
if (cPoint.x < minX || cPoint.x > maxX || cPoint.z < minZ || cPoint.z > maxZ)
continue;
// Process plane intersection only if distance is smaller
// than already found minimum
if (distance < closestDistance[p])
@ -1122,8 +1133,8 @@ short GetNearestLedgeAngle(ItemInfo* item, CollisionInfo* coll, float& distance)
// Remember distance to the closest plane with same angle (it happens sometimes with bridges)
float dist1 = FLT_MAX;
float dist2 = FLT_MAX;
auto r1 = originRay.Intersects(closestPlane[p], dist1);
auto r2 = originRay.Intersects(closestPlane[firstEqualAngle], dist2);
bool r1 = originRay.Intersects(closestPlane[p], dist1);
bool r2 = originRay.Intersects(closestPlane[firstEqualAngle], dist2);
finalDistance[h] = (dist1 > dist2 && r2) ? dist2 : (r1 ? dist1 : dist2);
finalResult[h] = result[p];
@ -1131,16 +1142,41 @@ short GetNearestLedgeAngle(ItemInfo* item, CollisionInfo* coll, float& distance)
}
}
// Store first result in case all 3 results are different (no priority) or prioritized result if long-distance misfire occured
// A case when all 3 results are different (no priority) or prioritized result
// is a long-distance misfire
if (finalDistance[h] == FLT_MAX || finalDistance[h] > WALL_SIZE / 2)
{
finalDistance[h] = closestDistance[0];
finalResult[h] = result[0];
// Prioritize angle which is similar to coll setup's forward angle.
// This helps to solve some borderline cases with diagonal shimmying,
// when centerpoint probe lands exactly on a block which has no
// diagonal split. If no angle similarity exists, just use centerpoint angle.
auto itr = std::find(result, result + 3, coll->Setup.ForwardAngle);
int prioritizedAngle = (itr != std::end(result)) ? std::distance(result, itr) : 0;
finalDistance[h] = closestDistance[prioritizedAngle];
finalResult[h] = result[prioritizedAngle];
}
}
int usedProbe = 0; // 0 = upper probe
// Return upper probe result in case it returned lower distance or has hit a bridge.
auto usedProbe = ((finalDistance[0] < finalDistance[1]) || hitBridge) ? 0 : 1;
// For unique case when both distances are equal, again make a comparison to current
// forward angle and return prioritized result.
if (!hitBridge)
{
if (floor(finalDistance[0]) == floor(finalDistance[1]))
{
auto itr = std::find(finalDistance, finalDistance + 2, coll->Setup.ForwardAngle);
usedProbe = (itr != std::end(finalDistance)) ? std::distance(finalDistance, itr) : 0;
}
else if (finalDistance[1] < finalDistance[0])
usedProbe = 1;
}
distance = finalDistance[usedProbe] - (coll->Setup.Radius - frontalOffset);
return finalResult[usedProbe];
}

View file

@ -363,33 +363,24 @@ GameStatus ControlPhase(int numFrames, int demoMode)
unsigned CALLBACK GameMain(void *)
{
try
{
TENLog("Starting GameMain...", LogLevel::Info);
TENLog("Starting GameMain...", LogLevel::Info);
TimeInit();
TimeInit();
if (g_GameFlow->IntroImagePath.empty())
throw TENScriptException("Intro image path is not set.");
if (g_GameFlow->IntroImagePath.empty())
throw TENScriptException("Intro image path is not set.");
// Do a fixed time title image
g_Renderer.RenderTitleImage();
// Do a fixed time title image
g_Renderer.RenderTitleImage();
// Execute the LUA gameflow and play the game
g_GameFlow->DoFlow();
// Execute the LUA gameflow and play the game
g_GameFlow->DoFlow();
DoTheGame = false;
DoTheGame = false;
// Finish the thread
PostMessage(WindowsHandle, WM_CLOSE, NULL, NULL);
EndThread();
}
catch (TENScriptException const& e)
{
std::string msg = std::string{ "An unrecoverable error occurred in " } + __func__ + ": " + e.what();
TENLog(msg, LogLevel::Error, LogConfig::All);
throw;
}
// Finish the thread
PostMessage(WindowsHandle, WM_CLOSE, NULL, NULL);
EndThread();
return true;
}
@ -404,6 +395,9 @@ GameStatus DoTitle(int index, std::string const& ambient)
InventoryResult inventoryResult;
g_GameStringsHandler->ClearDisplayStrings();
g_GameScript->ResetScripts(true);
if (g_GameFlow->TitleType == TITLE_TYPE::FLYBY)
{
// Initialise items, effects, lots, camera
@ -411,8 +405,6 @@ GameStatus DoTitle(int index, std::string const& ambient)
InitialisePickupDisplay();
InitialiseCamera();
g_GameScript->ResetScripts(true);
// Run the level script
ScriptInterfaceLevel* level = g_GameFlow->GetLevel(index);
@ -515,6 +507,7 @@ GameStatus DoLevel(int index, std::string const& ambient, bool loadFromSavegame)
InitialisePickupDisplay();
InitialiseCamera();
g_GameStringsHandler->ClearDisplayStrings();
g_GameScript->ResetScripts(loadFromSavegame);
// Run the level script

View file

@ -37,6 +37,7 @@ enum TriggerVolumeActivators
struct TriggerVolume
{
TriggerVolumeType Type;
std::string LuaName;
int EventSetIndex;
Vector3 Position;

View file

@ -22,11 +22,11 @@ void InitTENLog()
logger->set_pattern("[%Y-%b-%d %T] [%^%l%$] %v");
}
void TENLog(std::string_view str, LogLevel level, LogConfig config)
void TENLog(std::string_view str, LogLevel level, LogConfig config, bool allowSpam)
{
static std::string lastString = {};
if (lastString == str)
if (lastString == str && !allowSpam)
return;
if constexpr (!DebugBuild)
@ -40,7 +40,7 @@ void TENLog(std::string_view str, LogLevel level, LogConfig config)
{
case LogLevel::Error:
logger->error(str);
break;
break;
case LogLevel::Warning:
logger->warn(str);
break;

View file

@ -21,7 +21,7 @@ enum class LogConfig
All
};
void TENLog(std::string_view str, LogLevel level = LogLevel::Info, LogConfig config = LogConfig::All);
void TENLog(std::string_view str, LogLevel level = LogLevel::Info, LogConfig config = LogConfig::All, bool allowSpam = false);
void ShutdownTENLog();
void InitTENLog();

View file

@ -1214,19 +1214,11 @@ void SetupRipple(int x, int y, int z, int size, int flags)
void WadeSplash(ItemInfo* item, int wh, int wd)
{
short roomNumber = item->RoomNumber;
GetFloor(item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z, &roomNumber);
auto* room = &g_Level.Rooms[roomNumber];
if (!TestEnvironment(ENV_FLAG_WATER, room))
return;
short roomNumber2 = item->RoomNumber;
GetFloor(item->Pose.Position.x, room->y - 128, item->Pose.Position.z, &roomNumber2);
auto* room2 = &g_Level.Rooms[roomNumber2];
if (TestEnvironment(ENV_FLAG_WATER, room2))
auto probe1 = GetCollision(item);
auto probe2 = GetCollision(probe1.Block, item->Pose.Position.x, probe1.Position.Ceiling, item->Pose.Position.z);
if (!TestEnvironment(ENV_FLAG_WATER, probe1.RoomNumber) ||
TestEnvironment(ENV_FLAG_WATER, probe1.RoomNumber) == TestEnvironment(ENV_FLAG_WATER, probe2.RoomNumber))
return;
auto* frame = GetBestFrame(item);
@ -1256,7 +1248,7 @@ void WadeSplash(ItemInfo* item, int wh, int wd)
SplashSetup.z = item->Pose.Position.z;
SplashSetup.innerRadius = 16;
SplashSetup.splashPower = item->Animation.Velocity;
SetupSplash(&SplashSetup, roomNumber);
SetupSplash(&SplashSetup, probe1.RoomNumber);
SplashCount = 16;
}
}
@ -1390,52 +1382,6 @@ void TriggerRocketFire(int x, int y, int z)
void TriggerRocketSmoke(int x, int y, int z, int bodyPart)
{
/*auto* sptr = GetFreeParticle();
sptr->on = true;
sptr->sR = 0;
sptr->sG = 0;
sptr->sB = 0;
sptr->dR = 64 + bodyPart;
sptr->dG = 64 + bodyPart;
sptr->dB = 64 + bodyPart;
sptr->colFadeSpeed = 4 + (GetRandomControl() & 3);
sptr->fadeToBlack = 12;
sptr->sLife = sptr->life = (GetRandomControl() & 3) + 20;
sptr->blendMode = BLEND_MODES::BLENDMODE_ADDITIVE;
sptr->extras = 0;
sptr->dynamic = -1;
sptr->x = x + ((GetRandomControl() & 15) - 8);
sptr->y = y + ((GetRandomControl() & 15) - 8);
sptr->z = z + ((GetRandomControl() & 15) - 8);
sptr->xVel = ((GetRandomControl() & 255) - 128);
sptr->yVel = -(GetRandomControl() & 3) - 4;
sptr->zVel = ((GetRandomControl() & 255) - 128);
sptr->friction = 4;
if (GetRandomControl() & 1)
{
sptr->flags = SP_SCALE | SP_DEF | SP_ROTATE | SP_EXPDEF;
sptr->rotAng = GetRandomControl() & 4095;
if (GetRandomControl() & 1)
sptr->rotAdd = -(GetRandomControl() & 15) - 16;
else
sptr->rotAdd = (GetRandomControl() & 15) + 16;
}
else
sptr->flags = SP_SCALE | SP_DEF | SP_EXPDEF;
// TODO: right sprite
sptr->def = Objects[ID_DEFAULT_SPRITES].meshIndex;
sptr->scalar = 15;
sptr->gravity = -(GetRandomControl() & 3) - 4;
sptr->maxYvel = -(GetRandomControl() & 3) - 4;
int size = (GetRandomControl() & 7) + 32;
sptr->size = sptr->sSize = size >> 2;*/
TEN::Effects::Smoke::TriggerRocketSmoke(x, y, z, 0);
}

View file

@ -339,10 +339,12 @@ namespace TEN::Gui
case 2:
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
if (CurrentSettings.Configuration.ShadowType == ShadowMode::None)
CurrentSettings.Configuration.ShadowType = ShadowMode::All;
else
CurrentSettings.Configuration.ShadowType = ShadowMode(int(CurrentSettings.Configuration.ShadowType) - 1);
break;
case 3:
@ -352,7 +354,12 @@ namespace TEN::Gui
case 4:
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
CurrentSettings.Configuration.EnableVolumetricFog = !CurrentSettings.Configuration.EnableVolumetricFog;
if (CurrentSettings.Configuration.Antialiasing == AntialiasingMode::None)
CurrentSettings.Configuration.Antialiasing = AntialiasingMode::High;
else
CurrentSettings.Configuration.Antialiasing = AntialiasingMode(int(CurrentSettings.Configuration.Antialiasing) - 1);
break;
}
}
@ -387,7 +394,12 @@ namespace TEN::Gui
case 4:
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
CurrentSettings.Configuration.EnableVolumetricFog = !CurrentSettings.Configuration.EnableVolumetricFog;
if (CurrentSettings.Configuration.Antialiasing == AntialiasingMode::High)
CurrentSettings.conf.Antialiasing = AntialiasingMode::None;
else
CurrentSettings.Configuration.Antialiasing = AntialiasingMode(int(CurrentSettings.Configuration.Antialiasing) + 1);
break;
}
}

View file

@ -195,7 +195,7 @@ namespace TEN::Entities::Vehicles
bigGun->Flags = BGUN_FLAG_AUTO_ROT;
else
{
if (TrInput & VEHICLE_IN_FIRE && !bigGun->FireCount)
if (TrInput & (VEHICLE_IN_ACCELERATE | VEHICLE_IN_FIRE) && !bigGun->FireCount)
{
BigGunFire(bigGunItem, laraItem);
bigGun->FireCount = BGUN_RECOIL_TIME;

View file

@ -959,7 +959,7 @@ namespace TEN::Entities::Vehicles
}
// Driving back / braking.
if (TrInput & (VEHICLE_IN_REVERSE | VEHICLE_IN_BRAKE))
if (TrInput & VEHICLE_IN_REVERSE)
{
if (TrInput & VEHICLE_IN_SPEED &&
(quadBike->CanStartDrift || quadBike->DriftStarting))

View file

@ -4,6 +4,7 @@
#include "Game/camera.h"
#include "Game/control/control.h"
#include "Game/Lara/lara.h"
#include "Game/Lara/lara_helpers.h"
#include "Specific/setup.h"
#include "Sound/sound.h"
#include "Game/effects/effects.h"
@ -19,11 +20,14 @@ void RollingBallCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* c
{
auto* ballItem = &g_Level.Items[itemNumber];
if (TestBoundsCollide(ballItem, laraItem, coll->Setup.Radius))
if (TestBoundsCollide(ballItem, laraItem, coll->Setup.Radius) &&
TestCollision(ballItem, laraItem))
{
if (TestCollision(ballItem, laraItem))
if (TriggerActive(ballItem) && (ballItem->ItemFlags[0] || ballItem->Animation.VerticalVelocity))
{
if (TriggerActive(ballItem) && (ballItem->ItemFlags[0] || ballItem->Animation.VerticalVelocity))
if (laraItem->Animation.IsAirborne || TestEnvironment(RoomEnvFlags::ENV_FLAG_WATER, laraItem))
laraItem->HitPoints = 0;
else
{
laraItem->Animation.AnimNumber = LA_BOULDER_DEATH;
laraItem->Animation.FrameNumber = g_Level.Anims[laraItem->Animation.AnimNumber].frameBase;
@ -31,9 +35,9 @@ void RollingBallCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* c
laraItem->Animation.ActiveState = LS_DEATH;
laraItem->Animation.IsAirborne = false;
}
else
ObjectCollision(itemNumber, laraItem, coll);
}
else
ObjectCollision(itemNumber, laraItem, coll);
}
}

View file

@ -4,4 +4,5 @@ struct alignas(16) CPostProcessBuffer
float ScreenFadeFactor;
int ViewportWidth;
int ViewportHeight;
int FXAA;
};

View file

@ -1,6 +1,7 @@
#include "framework.h"
#include "RenderTarget2D.h"
#include "Utils.h"
#include "Specific/configuration.h"
namespace TEN::Renderer
{
@ -8,13 +9,36 @@ namespace TEN::Renderer
RenderTarget2D::RenderTarget2D(ID3D11Device* device, int w, int h, DXGI_FORMAT colorFormat, DXGI_FORMAT depthFormat)
{
// Check if antialiasing quality is available, and set it if it is.
D3D11_SRV_DIMENSION srvDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
D3D11_DSV_DIMENSION dsvDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
D3D11_RTV_DIMENSION rtvDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
int sampleCount = 1;
if (g_Configuration.Antialiasing > AntialiasingMode::Low)
{
int potentialSampleCount = (g_Configuration.Antialiasing == AntialiasingMode::Medium) ? 2 : 4;
unsigned int qualityLevels = 0;
if (device->CheckMultisampleQualityLevels(colorFormat, potentialSampleCount, &qualityLevels) == S_OK &&
qualityLevels > 0)
{
sampleCount = potentialSampleCount;
dsvDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS;
rtvDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
srvDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
}
}
// Now set up render target.
D3D11_TEXTURE2D_DESC desc = {};
desc.Width = w;
desc.Height = h;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = colorFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Count = sampleCount;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
@ -26,7 +50,7 @@ namespace TEN::Renderer
D3D11_RENDER_TARGET_VIEW_DESC viewDesc;
viewDesc.Format = desc.Format;
viewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
viewDesc.ViewDimension = rtvDimension;
viewDesc.Texture2D.MipSlice = 0;
res = device->CreateRenderTargetView(Texture.Get(), &viewDesc, &RenderTargetView);
@ -35,7 +59,7 @@ namespace TEN::Renderer
// Setup the description of the shader resource view.
D3D11_SHADER_RESOURCE_VIEW_DESC shaderDesc;
shaderDesc.Format = desc.Format;
shaderDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
shaderDesc.ViewDimension = srvDimension;
shaderDesc.Texture2D.MostDetailedMip = 0;
shaderDesc.Texture2D.MipLevels = 1;
@ -47,7 +71,7 @@ namespace TEN::Renderer
depthTexDesc.Height = h;
depthTexDesc.MipLevels = 1;
depthTexDesc.ArraySize = 1;
depthTexDesc.SampleDesc.Count = 1;
depthTexDesc.SampleDesc.Count = sampleCount;
depthTexDesc.SampleDesc.Quality = 0;
depthTexDesc.Format = depthFormat;
depthTexDesc.Usage = D3D11_USAGE_DEFAULT;
@ -61,7 +85,7 @@ namespace TEN::Renderer
D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc = {};
dsvDesc.Format = depthTexDesc.Format;
dsvDesc.Flags = 0;
dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
dsvDesc.ViewDimension = dsvDimension;
dsvDesc.Texture2D.MipSlice = 0;
res = device->CreateDepthStencilView(DepthStencilTexture.Get(), &dsvDesc, &DepthStencilView);

View file

@ -526,7 +526,7 @@ namespace TEN::Renderer
void DrawSimpleParticles(RenderView& view);
void DrawFootprints(RenderView& view);
void DrawLoadingBar(float percent);
void DrawFadeAndBars(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, RenderView& view);
void DrawPostprocess(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, RenderView& view);
void RenderInventoryScene(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget,
ID3D11ShaderResourceView* background);

View file

@ -357,56 +357,54 @@ namespace TEN::Renderer
void Renderer11::DrawRopes(RenderView& view)
{
for (int n = 0; n < Ropes.size(); n++)
for (auto& rope : Ropes)
{
ROPE_STRUCT* rope = &Ropes[n];
if (!rope.active)
continue;
if (rope->active)
Matrix world = Matrix::CreateTranslation(
rope.position.x,
rope.position.y,
rope.position.z
);
Vector3 absolute[24];
for (int n = 0; n < ROPE_SEGMENTS; n++)
{
Matrix world = Matrix::CreateTranslation(
rope->position.x,
rope->position.y,
rope->position.z
);
Vector3Int* s = &rope.meshSegment[n];
Vector3 t;
Vector3 output;
Vector3 absolute[24];
t.x = s->x >> FP_SHIFT;
t.y = s->y >> FP_SHIFT;
t.z = s->z >> FP_SHIFT;
for (int n = 0; n < ROPE_SEGMENTS; n++)
{
Vector3Int* s = &rope->meshSegment[n];
Vector3 t;
Vector3 output;
output = Vector3::Transform(t, world);
t.x = s->x >> FP_SHIFT;
t.y = s->y >> FP_SHIFT;
t.z = s->z >> FP_SHIFT;
Vector3 absolutePosition = Vector3(output.x, output.y, output.z);
absolute[n] = absolutePosition;
}
output = Vector3::Transform(t, world);
for (int n = 0; n < ROPE_SEGMENTS - 1; n++)
{
Vector3 pos1 = Vector3(absolute[n].x, absolute[n].y, absolute[n].z);
Vector3 pos2 = Vector3(absolute[n + 1].x, absolute[n + 1].y, absolute[n + 1].z);
Vector3 absolutePosition = Vector3(output.x, output.y, output.z);
absolute[n] = absolutePosition;
}
Vector3 d = pos2 - pos1;
d.Normalize();
for (int n = 0; n < ROPE_SEGMENTS - 1; n++)
{
Vector3 pos1 = Vector3(absolute[n].x, absolute[n].y, absolute[n].z);
Vector3 pos2 = Vector3(absolute[n + 1].x, absolute[n + 1].y, absolute[n + 1].z);
Vector3 c = (pos1 + pos2) / 2.0f;
Vector3 d = pos2 - pos1;
d.Normalize();
Vector3 c = (pos1 + pos2) / 2.0f;
AddSpriteBillboardConstrained(&m_sprites[Objects[ID_DEFAULT_SPRITES].meshIndex + SPR_EMPTY1],
c,
m_rooms[rope->room].AmbientLight,
(PI / 2),
1.0f,
{ 32,
Vector3::Distance(pos1, pos2) },
BLENDMODE_ALPHABLEND,
d, view);
}
AddSpriteBillboardConstrained(&m_sprites[Objects[ID_DEFAULT_SPRITES].meshIndex + SPR_EMPTY1],
c,
m_rooms[rope.room].AmbientLight,
(PI / 2),
1.0f,
{ 32,
Vector3::Distance(pos1, pos2) },
BLENDMODE_ALPHATEST,
d, view);
}
}
}
@ -1550,6 +1548,8 @@ namespace TEN::Renderer
DrawTransparentFaces(view);
DrawPostprocess(target, depthTarget, view);
// Draw GUI stuff at the end
DrawLines2D();
@ -1565,7 +1565,6 @@ namespace TEN::Renderer
DrawDebugInfo(view);
DrawAllStrings();
DrawFadeAndBars(target, depthTarget, view);
ClearScene();
}
@ -2281,8 +2280,9 @@ namespace TEN::Renderer
BindTexture(TEXTURE_NORMAL_MAP, &std::get<1>(m_moveablesTextures[bucket.Texture]),
SAMPLER_NONE);
SetBlendMode(bucket.BlendMode);
SetAlphaTest(bucket.BlendMode == BLEND_MODES::BLENDMODE_ALPHATEST ? ALPHA_TEST_GREATER_THAN : ALPHA_TEST_NONE, ALPHA_TEST_THRESHOLD);
// Always render horizon as alpha-blended surface
SetBlendMode(bucket.BlendMode == BLEND_MODES::BLENDMODE_ALPHATEST ? BLEND_MODES::BLENDMODE_ALPHABLEND : bucket.BlendMode);
SetAlphaTest(ALPHA_TEST_NONE, ALPHA_TEST_THRESHOLD);
// Draw vertices
DrawIndexedTriangles(bucket.NumIndices, bucket.StartIndex, 0);

View file

@ -251,8 +251,7 @@ namespace TEN::Renderer
}
}
void Renderer11::DrawFadeAndBars(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget,
RenderView& view)
void Renderer11::DrawPostprocess(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, RenderView& view)
{
SetBlendMode(BLENDMODE_OPAQUE);
SetCullMode(CULL_MODE_CCW);
@ -299,6 +298,7 @@ namespace TEN::Renderer
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
m_context->IASetInputLayout(m_inputLayout.Get());
m_stPostProcessBuffer.FXAA = g_Configuration.Antialiasing == AntialiasingMode::Low ? 1 : 0;
m_stPostProcessBuffer.ViewportWidth = m_screenWidth;
m_stPostProcessBuffer.ViewportHeight = m_screenHeight;
m_stPostProcessBuffer.ScreenFadeFactor = ScreenFadeCurrent;

View file

@ -808,9 +808,20 @@ namespace TEN::Renderer
void Renderer11::DrawSprites(RenderView& view)
{
const int numSpritesToDraw = view.spritesToDraw.size();
if (numSpritesToDraw == 0)
return;
BindRenderTargetAsTexture(TEXTURE_DEPTH_MAP, &m_depthMap, SAMPLER_LINEAR_CLAMP);
SetDepthState(DEPTH_STATE_READ_ONLY_ZBUFFER);
SetCullMode(CULL_MODE_NONE);
m_context->VSSetShader(m_vsSprites.Get(), NULL, 0);
m_context->PSSetShader(m_psSprites.Get(), NULL, 0);
BindConstantBufferVS(CB_SPRITE, m_cbSprite.get());
std::sort(
view.spritesToDraw.begin(),
view.spritesToDraw.end(),
@ -853,9 +864,8 @@ namespace TEN::Renderer
spriteMatrix = Matrix::Identity;
}
if (DoesBlendModeRequireSorting(spr.BlendMode))
if (DoesBlendModeRequireSorting(spr.BlendMode)) // Collect sprites
{
// Collect sprites
int distance = (spr.pos - Vector3(Camera.pos.x, Camera.pos.y, Camera.pos.z)).Length();
RendererTransparentFace face;
face.type = RendererTransparentFaceType::TRANSPARENT_FACE_SPRITE;
@ -867,36 +877,31 @@ namespace TEN::Renderer
RendererRoom& room = m_rooms[FindRoomNumber(Vector3Int(spr.pos))];
room.TransparentFacesToDraw.push_back(face);
}
else
else // Draw sprites immediately
{
// Draw sprites immediately
SetBlendMode(spr.BlendMode);
// Set up vertex buffer and parameters
UINT stride = sizeof(RendererVertex);
UINT offset = 0;
m_context->IASetInputLayout(m_inputLayout.Get());
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_context->IASetVertexBuffers(0, 1, quadVertexBuffer.GetAddressOf(), &stride, &offset);
SetBlendMode(spr.BlendMode);
BindTexture(TEXTURE_COLOR_MAP, spr.Sprite->Texture, SAMPLER_LINEAR_CLAMP);
if (spr.BlendMode == BLEND_MODES::BLENDMODE_ALPHATEST)
SetAlphaTest(ALPHA_TEST_GREATER_THAN, ALPHA_TEST_THRESHOLD, true);
else
SetAlphaTest(ALPHA_TEST_NONE, 0);
Matrix scale = Matrix::CreateScale((spr.Width) * spr.Scale, (spr.Height) * spr.Scale, spr.Scale);
if (spr.Type == RENDERER_SPRITE_TYPE::SPRITE_TYPE_BILLBOARD)
{
UINT stride = sizeof(RendererVertex);
UINT offset = 0;
SetDepthState(DEPTH_STATE_READ_ONLY_ZBUFFER);
SetCullMode(CULL_MODE_NONE);
SetAlphaTest(ALPHA_TEST_GREATER_THAN, ALPHA_TEST_THRESHOLD);
m_context->VSSetShader(m_vsSprites.Get(), NULL, 0);
m_context->PSSetShader(m_psSprites.Get(), NULL, 0);
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_context->IASetInputLayout(m_inputLayout.Get());
m_context->IASetVertexBuffers(0, 1, quadVertexBuffer.GetAddressOf(), &stride, &offset);
m_stSprite.billboardMatrix = spriteMatrix;
m_stSprite.color = spr.color;
m_stSprite.isBillboard = true;
m_cbSprite.updateData(m_stSprite, m_context.Get());
BindConstantBufferVS(CB_SPRITE, m_cbSprite.get());
m_context->Draw(4, 0);
m_numDrawCalls++;
@ -906,26 +911,10 @@ namespace TEN::Renderer
}
else if (spr.Type == RENDERER_SPRITE_TYPE::SPRITE_TYPE_BILLBOARD_CUSTOM)
{
UINT stride = sizeof(RendererVertex);
UINT offset = 0;
SetDepthState(DEPTH_STATE_READ_ONLY_ZBUFFER);
SetCullMode(CULL_MODE_NONE);
m_context->VSSetShader(m_vsSprites.Get(), NULL, 0);
m_context->PSSetShader(m_psSprites.Get(), NULL, 0);
SetAlphaTest(ALPHA_TEST_GREATER_THAN, ALPHA_TEST_THRESHOLD);
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_context->IASetInputLayout(m_inputLayout.Get());
m_context->IASetVertexBuffers(0, 1, quadVertexBuffer.GetAddressOf(), &stride, &offset);
m_stSprite.billboardMatrix = spriteMatrix;
m_stSprite.color = spr.color;
m_stSprite.isBillboard = true;
m_cbSprite.updateData(m_stSprite, m_context.Get());
BindConstantBufferVS(CB_SPRITE, m_cbSprite.get());
m_context->Draw(4, 0);
m_numDrawCalls++;
@ -935,25 +924,10 @@ namespace TEN::Renderer
}
else if (spr.Type == RENDERER_SPRITE_TYPE::SPRITE_TYPE_BILLBOARD_LOOKAT)
{
UINT stride = sizeof(RendererVertex);
UINT offset = 0;
SetDepthState(DEPTH_STATE_READ_ONLY_ZBUFFER);
SetCullMode(CULL_MODE_NONE);
m_context->VSSetShader(m_vsSprites.Get(), NULL, 0);
m_context->PSSetShader(m_psSprites.Get(), NULL, 0);
SetAlphaTest(ALPHA_TEST_GREATER_THAN, ALPHA_TEST_THRESHOLD);
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_context->IASetInputLayout(m_inputLayout.Get());
m_context->IASetVertexBuffers(0, 1, quadVertexBuffer.GetAddressOf(), &stride, &offset);
m_stSprite.billboardMatrix = spriteMatrix;
m_stSprite.color = spr.color;
m_stSprite.isBillboard = true;
m_cbSprite.updateData(m_stSprite, m_context.Get());
BindConstantBufferVS(CB_SPRITE, m_cbSprite.get());
m_context->Draw(4, 0);
m_numDrawCalls++;
@ -963,19 +937,6 @@ namespace TEN::Renderer
}
else if (spr.Type == RENDERER_SPRITE_TYPE::SPRITE_TYPE_3D)
{
UINT stride = sizeof(RendererVertex);
UINT offset = 0;
SetDepthState(DEPTH_STATE_READ_ONLY_ZBUFFER);
SetCullMode(CULL_MODE_NONE);
m_context->VSSetShader(m_vsSprites.Get(), NULL, 0);
m_context->PSSetShader(m_psSprites.Get(), NULL, 0);
SetAlphaTest(ALPHA_TEST_GREATER_THAN, ALPHA_TEST_THRESHOLD);
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_context->IASetInputLayout(m_inputLayout.Get());
m_context->IASetVertexBuffers(0, 1, quadVertexBuffer.GetAddressOf(), &stride, &offset);
Vector3 p0t = spr.vtx1;
Vector3 p1t = spr.vtx2;
Vector3 p2t = spr.vtx3;
@ -1016,7 +977,6 @@ namespace TEN::Renderer
m_stSprite.color = spr.color;
m_stSprite.isBillboard = false;
m_cbSprite.updateData(m_stSprite, m_context.Get());
BindConstantBufferVS(CB_SPRITE, m_cbSprite.get());
m_primitiveBatch->Begin();
m_primitiveBatch->DrawTriangle(v0, v1, v3);

View file

@ -101,6 +101,27 @@ namespace TEN::Renderer
auto* shadowMode = g_Gui.GetCurrentSettings().Configuration.ShadowType != ShadowMode::None ?
(g_Gui.GetCurrentSettings().Configuration.ShadowType == ShadowMode::Lara ? STRING_SHADOWS_PLAYER : STRING_SHADOWS_ALL) : STRING_SHADOWS_NONE;
const char* antialiasMode;
switch (g_Gui.GetCurrentSettings().conf.Antialiasing)
{
default:
case AntialiasingMode::None:
antialiasMode = STRING_ANTIALIASING_NONE;
break;
case AntialiasingMode::Low:
antialiasMode = STRING_ANTIALIASING_LOW;
break;
case AntialiasingMode::Medium:
antialiasMode = STRING_ANTIALIASING_MEDIUM;
break;
case AntialiasingMode::High:
antialiasMode = STRING_ANTIALIASING_HIGH;
break;
}
switch (menu)
{
case Menu::Options:
@ -149,9 +170,9 @@ namespace TEN::Renderer
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableCaustics), PRINTSTRING_COLOR_WHITE, SF(title_option == 3));
GetNextLinePosition(&y);
// Enable volumetric fog
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_VOLUMETRIC_FOG), PRINTSTRING_COLOR_ORANGE, SF(title_option == 4));
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableVolumetricFog), PRINTSTRING_COLOR_WHITE, SF(title_option == 4));
// Enable antialiasing
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_ANTIALIASING), PRINTSTRING_COLOR_ORANGE, SF(title_option == 4));
AddString(MenuRightSideEntry, y, g_GameFlow->GetString(antialiasMode), PRINTSTRING_COLOR_WHITE, SF(title_option == 4));
GetNextBlockPosition(&y);
// Apply
@ -468,6 +489,7 @@ namespace TEN::Renderer
g_Gui.DrawAmmoSelector();
g_Gui.FadeAmmoSelector();
g_Gui.DrawCompass(LaraItem);
DrawAllStrings();
}

View file

@ -69,6 +69,14 @@ enum class ShadowMode
All
};
enum class AntialiasingMode
{
None,
Low,
Medium,
High
};
enum LIGHT_MODES
{
LIGHT_MODE_DYNAMIC,

View file

@ -363,10 +363,8 @@ namespace TEN::Renderer
if (obj.ShadowType == ShadowMode::None)
{
auto bounds = TO_DX_BBOX(item->Pose, GetBoundsAccurate(item));
Vector3 min = bounds.Center - bounds.Extents;
Vector3 max = bounds.Center + bounds.Extents;
if (!renderView.camera.frustum.AABBInFrustum(min, max))
auto length = Vector3(bounds.Extents).Length();
if (!renderView.camera.frustum.SphereInFrustum(bounds.Center, length))
continue;
}
@ -419,10 +417,8 @@ namespace TEN::Renderer
auto stat = &StaticObjects[mesh->staticNumber];
auto bounds = TO_DX_BBOX(mesh->pos, &stat->visibilityBox);
Vector3 min = bounds.Center - bounds.Extents;
Vector3 max = bounds.Center + bounds.Extents;
if (!renderView.camera.frustum.AABBInFrustum(min, max))
auto length = Vector3(bounds.Extents).Length();
if (!renderView.camera.frustum.SphereInFrustum(bounds.Center, length))
continue;
std::vector<RendererLight*> lights;

Binary file not shown.

View file

@ -27,7 +27,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,5,1,0
PRODUCTVERSION 1,5,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -48,7 +48,7 @@ BEGIN
VALUE "LegalCopyright", "Copyright (C) 2022"
VALUE "OriginalFilename", "TombEngine.exe"
VALUE "ProductName", "Tomb Engine"
VALUE "ProductVersion", "1.5.1.0"
VALUE "ProductVersion", "1.5.2.0"
END
END
BLOCK "VarFileInfo"
@ -82,7 +82,7 @@ BEGIN
CONTROL "TXT_Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,103,115,10
CONTROL "TXT Shadows",IDC_SHADOWS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,79,159,10
CONTROL "TXT Caustics",IDC_CAUSTICS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,94,160,10
CONTROL "TXT Volumetric Fog",IDC_VOLUMETRIC_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,109,160,10
CONTROL "TXT Antialiasing",IDC_ANTIALIASING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,109,160,10
GROUPBOX "Txt_Sound",IDC_GROUP_SOUND,7,151,320,33
CONTROL "TXT_Enable",IDC_ENABLE_SOUNDS,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,254,150,67,10
COMBOBOX IDC_SNDADAPTER,13,164,308,71,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP

View file

@ -33,7 +33,6 @@ public:
virtual bool HasSlideExtended() const = 0;
virtual ScriptInterfaceLevel * GetLevel(int level) = 0;
virtual int GetLevelNumber(std::string const& flieName) = 0;
virtual short GetGameFarView() const = 0;
virtual bool CanPlayAnyLevel() const = 0;
virtual bool DoFlow() = 0;
};

View file

@ -10,6 +10,7 @@ class ScriptInterfaceStringsHandler {
public:
virtual ~ScriptInterfaceStringsHandler() = default;
virtual void ProcessDisplayStrings(float dt) = 0;
virtual void ClearDisplayStrings() = 0;
virtual void SetCallbackDrawString(CallbackDrawString) = 0;
};

View file

@ -68,6 +68,11 @@
#define STRING_SHADOWS_NONE "none"
#define STRING_CAUSTICS "caustics"
#define STRING_VOLUMETRIC_FOG "volumetric_fog"
#define STRING_ANTIALIASING "antialiasing"
#define STRING_ANTIALIASING_NONE "none"
#define STRING_ANTIALIASING_LOW "low"
#define STRING_ANTIALIASING_MEDIUM "medium"
#define STRING_ANTIALIASING_HIGH "high"
#define STRING_APPLY "apply"
#define STRING_BACK "back"
#define STRING_SOUND "sound"

View file

@ -107,7 +107,7 @@ namespace Effects
@tparam float rot (default 0) specifies a speed with which it will rotate (0 = no rotation, negative = anticlockwise rotation, positive = clockwise rotation).
@tparam Color startColor (default Color(255, 255, 255)) color at start of life
@tparam Color endColor (default Color(255, 255, 255)) color to fade to - at the time of writing this fade will finish long before the end of the particle's life due to internal maths
@tparam BlendID blendMode (default TEN.Misc.BlendID.ALPHABLEND) How will we blend this with its surroundings?
@tparam BlendID blendMode (default TEN.Effects.BlendID.ALPHABLEND) How will we blend this with its surroundings?
@tparam int startSize (default 10) Size on spawn. A value of 15 is approximately the size of Lara's head.
@tparam int endSize (default 0) Size on death - the particle will linearly shrink or grow to this size during its lifespan
@tparam float lifetime (default 2) Lifespan in seconds
@ -122,7 +122,7 @@ namespace Effects
-2, -- rot
Color(255, 0, 0), -- startColor
Color(0, 255, 0), -- endColor
TEN.Misc.BlendID.ADDITIVE, -- blendMode
TEN.Effects.BlendID.ADDITIVE, -- blendMode
15, -- startSize
50, -- endSize
20, -- lifetime

View file

@ -61,15 +61,6 @@ __(not yet implemented)__
*/
table_flow.set_function(ScriptReserved_SetTitleScreenImagePath, &FlowHandler::SetTitleScreenImagePath, this);
/*** Maximum draw distance.
The maximum draw distance, in sectors (blocks), of any level in the game.
This is equivalent to TRNG's WorldFarView variable.
__(not yet implemented)__
@function SetFarView
@tparam byte farview Number of sectors. Must be in the range [1, 127].
*/
table_flow.set_function(ScriptReserved_SetFarView, &FlowHandler::SetGameFarView, this);
/*** settings.lua.
These functions are called in settings.lua, a file which holds your local settings.
settings.lua shouldn't be bundled with any finished levels/games.
@ -171,19 +162,6 @@ void FlowHandler::SetTitleScreenImagePath(std::string const& path)
TitleScreenImagePath = path;
}
void FlowHandler::SetGameFarView(short val)
{
bool cond = val <= 127 && val >= 1;
std::string msg{ "Game far view value must be in the range [1, 255]." };
if (!ScriptAssert(cond, msg))
{
ScriptWarn("Setting game far view to 32.");
GameFarView = 32;
}
else
GameFarView = val;
}
void FlowHandler::LoadFlowScript()
{
m_handler.ExecuteScript("Scripts/Gameflow.lua");
@ -260,7 +238,16 @@ bool FlowHandler::DoFlow()
if (CurrentLevel == 0)
{
status = DoTitle(0, level->AmbientTrack);
try
{
status = DoTitle(0, level->AmbientTrack);
}
catch (TENScriptException const& e)
{
std::string msg = std::string{ "An unrecoverable error occurred in " } + __func__ + ": " + e.what();
TENLog(msg, LogLevel::Error, LogConfig::All);
throw;
}
}
else
{
@ -284,7 +271,16 @@ bool FlowHandler::DoFlow()
}
}
status = DoLevel(CurrentLevel, level->AmbientTrack, loadFromSavegame);
try
{
status = DoLevel(CurrentLevel, level->AmbientTrack, loadFromSavegame);
}
catch (TENScriptException const& e)
{
std::string msg = std::string{ "An unrecoverable error occurred in " } + __func__ + ": " + e.what();
TENLog(msg, LogLevel::Error, LogConfig::All);
status = GameStatus::ExitToTitle;
}
loadFromSavegame = false;
}
@ -329,7 +325,3 @@ bool FlowHandler::CanPlayAnyLevel() const
return PlayAnyLevel;
}
short FlowHandler::GetGameFarView() const
{
return GameFarView;
}

View file

@ -27,7 +27,6 @@ public:
bool PlayAnyLevel{ true };
bool FlyCheat{ true };
bool DebugMode{ false };
short GameFarView{ 0 };
// New animation flag table
Animations Anims{};
@ -51,8 +50,6 @@ public:
int GetNumLevels() const;
void SetIntroImagePath(std::string const& path);
void SetTitleScreenImagePath(std::string const& path);
void SetGameFarView(short val);
short GetGameFarView() const;
bool IsFlyCheatEnabled() const;
bool CanPlayAnyLevel() const;

View file

@ -56,8 +56,6 @@ void Level::Register(sol::table & parent)
/// (@{Flow.Fog}) omni fog RGB color and distance.
// As seen in TR4's Desert Railroad.
// If not provided, distance fog will be black.
//
// __(not yet implemented)__
//@mem fog
"fog", &Level::Fog,
@ -117,15 +115,6 @@ e.g. `myLevel.laraType = LaraType.Divesuit`
//@mem mirror
"mirror", &Level::Mirror,
/*** (byte) The maximum draw distance for level.
Given in sectors (blocks).
Must be in the range [1, 255], and equal to or less than the value passed to SetGameFarView.
This is equivalent to TRNG's LevelFarView variable.
__(not yet implemented)__
@mem farView
*/
"farView", sol::property(&Level::SetLevelFarView),
/*** (bool) Enable unlimited oxygen supply when in water.
@ -156,14 +145,25 @@ void Level::SetWeatherStrength(float val)
}
}
/*** (int) The maximum draw distance for level.
Given in sectors (blocks).
Must be at least 4.
This is equivalent to TRNG's LevelFarView variable.
@mem farView
*/
void Level::SetLevelFarView(short val)
{
bool cond = val <= 255 && val >= 1;
std::string msg{ "levelFarView value must be in the range [1, 127]." };
static_assert(MIN_FAR_VIEW == 3200.0f, "Please update the comment, docs, and warning message if this number changes.");
const short min = std::ceil(MIN_FAR_VIEW / SECTOR(1));
bool cond = val >= min;
std::string msg{ "farView value must be 4 or greater." };
if (!ScriptAssert(cond, msg))
{
ScriptWarn("Setting levelFarView view to 32.");
LevelFarView = 32;
// Will be set to default by the renderer
LevelFarView = 0;
}
else
{

View file

@ -114,7 +114,7 @@ void LogicHandler::LogPrint(sol::variadic_args va)
str += strPart;
str += "\t";
}
TENLog(str);
TENLog(str, LogLevel::Info, LogConfig::All, true);
}
void LogicHandler::ResetScripts(bool clearGameVars)

View file

@ -141,11 +141,11 @@ void Moveable::Register(sol::table & parent)
sol::meta_function::equal_to, std::equal_to<Moveable const>(),
/// Enable the item, as if a trigger for it had been stepped on.
// @function Moveable:EnableItem
// @function Moveable:Enable
ScriptReserved_Enable, &Moveable::EnableItem,
/// Disable the item
// @function Moveable:DisableItem
// @function Moveable:Disable
ScriptReserved_Disable, &Moveable::DisableItem,
/// Make the item invisible. Use EnableItem to make it visible again.

View file

@ -88,7 +88,7 @@ void StringsHandler::ProcessDisplayStrings(float dt)
while (it != std::end(m_userDisplayStrings))
{
auto& str = it->second;
bool endOfLife = (0.0f >= str.m_timeRemaining);
bool endOfLife = 0.0f >= str.m_timeRemaining;
if (str.m_deleteWhenZero && endOfLife)
{
ScriptAssertF(!str.m_isInfinite, "The infinite string {} (key \"{}\") went out of scope without being hidden.", it->first, str.m_key);
@ -116,3 +116,9 @@ void StringsHandler::ProcessDisplayStrings(float dt)
}
}
void StringsHandler::ClearDisplayStrings()
{
m_userDisplayStrings.clear();
}

View file

@ -16,6 +16,7 @@ public:
StringsHandler(sol::state* lua, sol::table & parent);
void SetCallbackDrawString(CallbackDrawString cb) override;
void ProcessDisplayStrings(float dt) override;
void ClearDisplayStrings() override;
bool SetDisplayString(DisplayStringIDType id, UserDisplayString const& ds);
std::optional<std::reference_wrapper<UserDisplayString>> GetDisplayString(DisplayStringIDType id);

View file

@ -1,4 +1,9 @@
#include "./VertexInput.hlsli"
#include "./Math.hlsli"
#define FXAA_SPAN_MAX 8.0
#define FXAA_REDUCE_MUL 1.0/4.0
#define FXAA_REDUCE_MIN 1.0/64.0
cbuffer PostProcessBuffer : register(b7)
{
@ -6,6 +11,7 @@ cbuffer PostProcessBuffer : register(b7)
float ScreenFadeFactor;
int ViewportWidth;
int ViewportHeight;
int FXAA;
};
struct PixelShaderInput
@ -18,6 +24,53 @@ struct PixelShaderInput
Texture2D Texture : register(t0);
SamplerState Sampler : register(s0);
float4 Antialias(PixelShaderInput input)
{
float2 add = float2(1.0f, 1.0f) / float2(ViewportWidth, ViewportHeight);
float3 rgbNW = Texture.Sample(Sampler, input.UV + float2(-add.x, -add.y));
float3 rgbNE = Texture.Sample(Sampler, input.UV + float2(add.x, -add.y));
float3 rgbSW = Texture.Sample(Sampler, input.UV + float2(-add.x, add.y));
float3 rgbSE = Texture.Sample(Sampler, input.UV + float2(add.x, add.y));
float3 rgbM = Texture.Sample(Sampler, input.UV);
float lumaNW = Luma(rgbNW);
float lumaNE = Luma(rgbNE);
float lumaSW = Luma(rgbSW);
float lumaSE = Luma(rgbSE);
float lumaM = Luma(rgbM);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
float2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
float dirReduce = max(
(lumaNW + lumaNE + lumaSW + lumaSE) * (0.25f * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
float rcpDirMin = 1.0f / (min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = min(float2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),
max(float2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * add;
float3 rgbA = (1.0f / 2.0f) *
(Texture.Sample(Sampler, input.UV + dir * (1.0f / 3.0f - 0.5f)) +
Texture.Sample(Sampler, input.UV + dir * (2.0f / 2.0f - 0.5f)));
float3 rgbB = rgbA * (1.0f / 2.0f) + (1.0f / 4.0f) *
(Texture.Sample(Sampler, input.UV + dir * (0.0f / 3.0f - 0.5f)) +
Texture.Sample(Sampler, input.UV + dir * (3.0f / 3.0f - 0.5f)));
float lumaB = Luma(rgbB);
if ((lumaB < lumaMin) || (lumaB > lumaMax))
return float4(rgbA, 1.0f);
else
return float4(rgbB, 1.0f);
}
PixelShaderInput VS(VertexShaderInput input)
{
PixelShaderInput output;
@ -31,7 +84,8 @@ PixelShaderInput VS(VertexShaderInput input)
float4 PS(PixelShaderInput input) : SV_TARGET
{
float4 output = Texture.Sample(Sampler, input.UV);
float4 output = FXAA ? Antialias(input) : Texture.Sample(Sampler, input.UV);
float3 colorMul = min(input.Color.xyz, 1.0f);
float y = input.Position.y / ViewportHeight;

View file

@ -60,6 +60,8 @@ float4 PS(PixelShaderInput input) : SV_TARGET
{
float4 output = Texture.Sample(Sampler, input.UV) * input.Color;
DoAlphaTest(output);
float particleDepth = input.PositionCopy.z / input.PositionCopy.w;
input.PositionCopy.xy /= input.PositionCopy.w;
float2 texCoord = 0.5f * (float2(input.PositionCopy.x, -input.PositionCopy.y) + 1);

View file

@ -444,7 +444,7 @@ void PlaySoundTrack(std::string track, SoundTrackType mode, QWORD position)
// BGM tracks are crossfaded, and additionally shuffled a bit to make things more natural.
// Think everybody are fed up with same start-up sounds of Caves ambience...
if (crossfade)
if (crossfade && BASS_ChannelIsActive(BASS_Soundtrack[(int)SoundTrackType::BGM].Channel))
{
// Crossfade...
BASS_ChannelSetAttribute(stream, BASS_ATTRIB_VOL, 0.0f);

View file

@ -78,7 +78,7 @@ BOOL CALLBACK DialogProc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
SendMessageA(GetDlgItem(handle, IDC_GROUP_RENDER_OPTIONS), WM_SETTEXT, 0, (LPARAM)g_GameFlow->GetString(STRING_RENDER_OPTIONS));
SendMessageA(GetDlgItem(handle, IDC_SHADOWS), WM_SETTEXT, 0, (LPARAM)g_GameFlow->GetString(STRING_SHADOWS));
SendMessageA(GetDlgItem(handle, IDC_CAUSTICS), WM_SETTEXT, 0, (LPARAM)g_GameFlow->GetString(STRING_CAUSTICS));
SendMessageA(GetDlgItem(handle, IDC_VOLUMETRIC_FOG), WM_SETTEXT, 0, (LPARAM)g_GameFlow->GetString(STRING_VOLUMETRIC_FOG));
SendMessageA(GetDlgItem(handle, IDC_ANTIALIASING), WM_SETTEXT, 0, (LPARAM)g_GameFlow->GetString(STRING_ANTIALIASING));
LoadResolutionsInCombobox(handle);
LoadSoundDevicesInCombobox(handle);
@ -86,8 +86,8 @@ BOOL CALLBACK DialogProc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
// Set some default values
g_Configuration.AutoTarget = true;
g_Configuration.EnableVolumetricFog = true;
SendDlgItemMessage(handle, IDC_VOLUMETRIC_FOG, BM_SETCHECK, 1, 0);
g_Configuration.Antialiasing = AntialiasingMode::Low;
SendDlgItemMessage(handle, IDC_ANTIALIASING, BM_SETCHECK, 1, 0);
g_Configuration.ShadowType = ShadowMode::Lara;
SendDlgItemMessage(handle, IDC_SHADOWS, BM_SETCHECK, 1, 0);
@ -116,7 +116,7 @@ BOOL CALLBACK DialogProc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
g_Configuration.Windowed = (SendDlgItemMessage(handle, IDC_WINDOWED, BM_GETCHECK, 0, 0));
g_Configuration.ShadowType = (ShadowMode)(SendDlgItemMessage(handle, IDC_SHADOWS, BM_GETCHECK, 0, 0));
g_Configuration.EnableCaustics = (SendDlgItemMessage(handle, IDC_CAUSTICS, BM_GETCHECK, 0, 0));
g_Configuration.EnableVolumetricFog = (SendDlgItemMessage(handle, IDC_VOLUMETRIC_FOG, BM_GETCHECK, 0, 0));
g_Configuration.Antialiasing = (AntialiasingMode)(SendDlgItemMessage(handle, IDC_ANTIALIASING, BM_GETCHECK, 0, 0));
g_Configuration.EnableSound = (SendDlgItemMessage(handle, IDC_ENABLE_SOUNDS, BM_GETCHECK, 0, 0));
selectedMode = (SendDlgItemMessage(handle, IDC_RESOLUTION, CB_GETCURSEL, 0, 0));
mode = g_Configuration.SupportedScreenResolutions[selectedMode];
@ -210,7 +210,7 @@ bool SaveConfiguration()
return false;
}
if (SetBoolRegKey(rootKey, REGKEY_VOLUMETRIC_FOG, g_Configuration.EnableVolumetricFog) != ERROR_SUCCESS)
if (SetDWORDRegKey(rootKey, REGKEY_ANTIALIASING, DWORD(g_Configuration.Antialiasing)) != ERROR_SUCCESS)
{
RegCloseKey(rootKey);
return false;
@ -299,7 +299,7 @@ void InitDefaultConfiguration()
g_Configuration.EnableCaustics = true;
g_Configuration.ShadowType = ShadowMode::Lara;
g_Configuration.EnableSound = true;
g_Configuration.EnableVolumetricFog = true;
g_Configuration.Antialiasing = AntialiasingMode::Low;
g_Configuration.MusicVolume = 100;
g_Configuration.SfxVolume = 100;
g_Configuration.Width = currentScreenResolution.x;
@ -345,8 +345,8 @@ bool LoadConfiguration()
return false;
}
bool volumetricFog = false;
if (GetBoolRegKey(rootKey, REGKEY_VOLUMETRIC_FOG, &volumetricFog, true) != ERROR_SUCCESS)
DWORD antialiasing = 1;
if (GetDWORDRegKey(rootKey, REGKEY_ANTIALIASING, &antialiasing, true) != ERROR_SUCCESS)
{
RegCloseKey(rootKey);
return false;
@ -452,7 +452,7 @@ bool LoadConfiguration()
g_Configuration.ShadowType = ShadowMode(shadowMode);
g_Configuration.ShadowMaxBlobs = shadowBlobs;
g_Configuration.EnableCaustics = caustics;
g_Configuration.EnableVolumetricFog = volumetricFog;
g_Configuration.Antialiasing = AntialiasingMode(antialiasing);
g_Configuration.ShadowMapSize = shadowMapSize;
g_Configuration.EnableSound = enableSound;

View file

@ -13,7 +13,7 @@
#define REGKEY_SHADOW_MAP "ShadowMap"
#define REGKEY_SHADOW_BLOBS "ShadowBlobs"
#define REGKEY_CAUSTICS "Caustics"
#define REGKEY_VOLUMETRIC_FOG "VolumetricFog"
#define REGKEY_ANTIALIASING "Antialiasing"
#define REGKEY_SOUND_DEVICE "SoundDevice"
#define REGKEY_ENABLE_SOUND "EnableSound"
@ -39,7 +39,7 @@ struct GameConfiguration
int SfxVolume;
bool EnableCaustics;
bool EnableVolumetricFog;
AntialiasingMode Antialiasing;
ShadowMode ShadowType;
int ShadowMapSize = 1024;
int ShadowMaxBlobs = 16;

View file

@ -34,19 +34,16 @@ using std::string;
using namespace TEN::Input;
using namespace TEN::Entities::Doors;
uintptr_t hLoadLevel;
unsigned int ThreadId;
char* LevelDataPtr;
bool IsLevelLoading;
bool LoadedSuccessfully;
vector<int> MoveablesIds;
vector<int> StaticObjectsIds;
ChunkReader* g_levelChunkIO;
LEVEL g_Level;
short ReadInt8()
unsigned char ReadUInt8()
{
byte value = *(byte*)LevelDataPtr;
unsigned char value = *(unsigned char*)LevelDataPtr;
LevelDataPtr += 1;
return value;
}
@ -106,22 +103,54 @@ Vector4 ReadVector4()
return value;
}
bool ReadBool()
{
return bool(ReadUInt8());
}
void ReadBytes(void* dest, int count)
{
memcpy(dest, LevelDataPtr, count);
LevelDataPtr += count;
}
long long ReadLEB128(bool sign)
{
long long result = 0;
int currentShift = 0;
unsigned char currentByte;
do
{
currentByte = ReadUInt8();
result |= (long long)(currentByte & 0x7F) << currentShift;
currentShift += 7;
} while ((currentByte & 0x80) != 0);
if (sign) // Sign extend
{
int shift = 64 - currentShift;
if (shift > 0)
result = (long long)(result << shift) >> shift;
}
return result;
}
std::string ReadString()
{
byte numBytes = ReadInt8(); // FIXME: incorrect, should be read in LEB128 format
auto numBytes = ReadLEB128(false);
if (!numBytes)
return std::string();
char buffer[255];
ReadBytes(buffer, numBytes);
return std::string(buffer, buffer + numBytes);
else
{
auto newPtr = LevelDataPtr + numBytes;
auto result = std::string(LevelDataPtr, newPtr);
LevelDataPtr = newPtr;
return result;
}
}
void LoadItems()
@ -178,7 +207,7 @@ void LoadObjects()
{
MESH mesh;
mesh.lightMode = (LIGHT_MODES)ReadInt8();
mesh.lightMode = (LIGHT_MODES)ReadUInt8();
mesh.sphere.Center.x = ReadFloat();
mesh.sphere.Center.y = ReadFloat();
@ -206,8 +235,8 @@ void LoadObjects()
BUCKET bucket;
bucket.texture = ReadInt32();
bucket.blendMode = (BLEND_MODES)ReadInt8();
bucket.animated = ReadInt8();
bucket.blendMode = (BLEND_MODES)ReadUInt8();
bucket.animated = ReadBool();
bucket.numQuads = 0;
bucket.numTriangles = 0;
@ -442,7 +471,7 @@ void LoadTextures()
texture.colorMapData.resize(size);
ReadBytes(texture.colorMapData.data(), size);
byte hasNormalMap = ReadInt8();
bool hasNormalMap = ReadBool();
if (hasNormalMap)
{
size = ReadInt32();
@ -468,7 +497,7 @@ void LoadTextures()
texture.colorMapData.resize(size);
ReadBytes(texture.colorMapData.data(), size);
bool hasNormalMap = ReadInt8();
bool hasNormalMap = ReadBool();
if (hasNormalMap)
{
size = ReadInt32();
@ -494,7 +523,7 @@ void LoadTextures()
texture.colorMapData.resize(size);
ReadBytes(texture.colorMapData.data(), size);
bool hasNormalMap = ReadInt8();
bool hasNormalMap = ReadBool();
if (hasNormalMap)
{
size = ReadInt32();
@ -520,7 +549,7 @@ void LoadTextures()
texture.colorMapData.resize(size);
ReadBytes(texture.colorMapData.data(), size);
bool hasNormalMap = ReadInt8();
bool hasNormalMap = ReadBool();
if (hasNormalMap)
{
size = ReadInt32();
@ -591,8 +620,8 @@ void ReadRooms()
BUCKET bucket;
bucket.texture = ReadInt32();
bucket.blendMode = (BLEND_MODES)ReadInt8();
bucket.animated = ReadInt8();
bucket.blendMode = (BLEND_MODES)ReadUInt8();
bucket.animated = ReadBool();
bucket.numQuads = 0;
bucket.numTriangles = 0;
@ -687,15 +716,15 @@ void ReadRooms()
floor.CeilingCollision.Planes[1].z = ReadFloat();
floor.WallPortal = ReadInt32();
floor.Flags.Death = ReadInt8();
floor.Flags.Monkeyswing = ReadInt8();
floor.Flags.ClimbNorth = ReadInt8();
floor.Flags.ClimbSouth = ReadInt8();
floor.Flags.ClimbEast = ReadInt8();
floor.Flags.ClimbWest = ReadInt8();
floor.Flags.MarkTriggerer = ReadInt8();
floor.Flags.Death = ReadBool();
floor.Flags.Monkeyswing = ReadBool();
floor.Flags.ClimbNorth = ReadBool();
floor.Flags.ClimbSouth = ReadBool();
floor.Flags.ClimbEast = ReadBool();
floor.Flags.ClimbWest = ReadBool();
floor.Flags.MarkTriggerer = ReadBool();
floor.Flags.MarkTriggererActive = 0; // TODO: IT NEEDS TO BE WRITTEN/READ FROM SAVEGAMES!
floor.Flags.MarkBeetle = ReadInt8();
floor.Flags.MarkBeetle = ReadBool();
floor.Room = i;
@ -726,8 +755,8 @@ void ReadRooms()
light.out = ReadFloat();
light.length = ReadFloat();
light.cutoff = ReadFloat();
light.type = ReadInt8();
light.castShadows = ReadInt8();
light.type = ReadUInt8();
light.castShadows = ReadBool();
room.lights.push_back(light);
}
@ -772,6 +801,7 @@ void ReadRooms()
volume.Scale.y = ReadFloat();
volume.Scale.z = ReadFloat();
//volume.LuaName = ReadString(); // TODO: Uncomment when lua API for volumes is implemented -- Lwmte, 09.08.22
volume.EventSetIndex = ReadInt32();
volume.Status = TriggerStatus::Outside;
@ -1057,14 +1087,12 @@ unsigned int _stdcall LoadLevel(void* data)
else
TENLog("Level compiler version: " + std::to_string(version[0]) + "." + std::to_string(version[1]) + "." + std::to_string(version[2]), LogLevel::Info);
// Check if level version is higher than engine version
auto assemblyVersion = TEN::Utils::GetProductOrFileVersion(true);
for (int i = 0; i < assemblyVersion.size(); i++)
{
if (assemblyVersion[i] != version[i])
{
TENLog("Level compiler version does not match with TEN version. Errors or crashes may be possible.", LogLevel::Warning);
break;
}
if (assemblyVersion[i] < version[i])
throw std::exception("Level version is higher than TEN version. Please update TEN.");
}
// Check system name hash and reset it if it's valid (because we use build & play feature only once)
@ -1152,6 +1180,7 @@ unsigned int _stdcall LoadLevel(void* data)
TENLog("Error while loading level: " + std::string(ex.what()), LogLevel::Error);
LoadedSuccessfully = false;
SystemNameHash = 0;
}
if (dataPtr)
@ -1254,13 +1283,14 @@ int LoadLevelFile(int levelIndex)
// Loading level is done is two threads, one for loading level and one for drawing loading screen
IsLevelLoading = true;
hLoadLevel = _beginthreadex(
_beginthreadex(
nullptr,
0,
LoadLevel,
reinterpret_cast<void*>(levelIndex),
0,
&ThreadId);
NULL);
while (IsLevelLoading);

View file

@ -18,8 +18,7 @@
#define IDC_BILINEAR 1032
#define IDC_CAUSTICS 1032
#define IDC_TEXRESTXT 1033
#define IDC_LOWTEXT 1034
#define IDC_VOLUMETRIC_FOG 1034
#define IDC_ANTIALIASING 1034
#define IDC_LOWBUMP 1035
#define IDC_BUMPMAP 1036
#define IDC_SNDADAPTERTXT 1037