Add separate binoculars/lasersight camera types, correct default gunflash ranges

This commit is contained in:
Lwmte 2024-12-16 01:11:33 +01:00
parent 51a6b741db
commit 0abb8981ba
8 changed files with 89 additions and 81 deletions

View file

@ -139,6 +139,14 @@
<td class="summary">Shows the mode of the game camera.</td> <td class="summary">Shows the mode of the game camera.</td>
</tr> </tr>
<tr> <tr>
<td class="name" ><a href="#GetCameraPosition">GetCameraPosition()</a></td>
<td class="summary">Gets current camera position.</td>
</tr>
<tr>
<td class="name" ><a href="#GetCameraTarget">GetCameraTarget()</a></td>
<td class="summary">Gets current camera target.</td>
</tr>
<tr>
<td class="name" ><a href="#GetCameraRoom">GetCameraRoom()</a></td> <td class="name" ><a href="#GetCameraRoom">GetCameraRoom()</a></td>
<td class="summary">Gets current room where camera is positioned.</td> <td class="summary">Gets current room where camera is positioned.</td>
</tr> </tr>
@ -155,14 +163,6 @@
<td class="summary">Sets the post-process tint.</td> <td class="summary">Sets the post-process tint.</td>
</tr> </tr>
<tr> <tr>
<td class="name" ><a href="#GetCameraPosition">GetCameraPosition()</a></td>
<td class="summary">Gets current camera position.</td>
</tr>
<tr>
<td class="name" ><a href="#GetCameraTarget">GetCameraTarget()</a></td>
<td class="summary">Gets current camera target.</td>
</tr>
<tr>
<td class="name" ><a href="#PlayFlyBy">PlayFlyBy(flyby)</a></td> <td class="name" ><a href="#PlayFlyBy">PlayFlyBy(flyby)</a></td>
<td class="summary">Enable FlyBy with specific ID</td> <td class="summary">Enable FlyBy with specific ID</td>
</tr> </tr>
@ -328,6 +328,48 @@
<span class="keyword">end</span></pre> <span class="keyword">end</span></pre>
</ul> </ul>
</dd>
<dt>
<a name = "GetCameraPosition"></a>
<strong>GetCameraPosition()</strong>
</dt>
<dd>
Gets current camera position.
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
current camera position
</ol>
</dd>
<dt>
<a name = "GetCameraTarget"></a>
<strong>GetCameraTarget()</strong>
</dt>
<dd>
Gets current camera target.
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
current camera target
</ol>
</dd> </dd>
<dt> <dt>
<a name = "GetCameraRoom"></a> <a name = "GetCameraRoom"></a>
@ -415,48 +457,6 @@
</dd>
<dt>
<a name = "GetCameraPosition"></a>
<strong>GetCameraPosition()</strong>
</dt>
<dd>
Gets current camera position.
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
current camera position
</ol>
</dd>
<dt>
<a name = "GetCameraTarget"></a>
<strong>GetCameraTarget()</strong>
</dt>
<dd>
Gets current camera target.
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
current camera target
</ol>
</dd> </dd>
<dt> <dt>
<a name = "PlayFlyBy"></a> <a name = "PlayFlyBy"></a>

View file

@ -141,7 +141,8 @@
<li><code>FIXED</code> - classic fixed camera.</li> <li><code>FIXED</code> - classic fixed camera.</li>
<li><code>LOOK</code> - look camera.</li> <li><code>LOOK</code> - look camera.</li>
<li><code>FLYBY</code> - flyby or tracking camera.</li> <li><code>FLYBY</code> - flyby or tracking camera.</li>
<li><code>OPTICS</code> - binoculars or lasersight is active.</li> <li><code>BINOCULARS</code> - binoculars is active.</li>
<li><code>LASERSIGHT</code> - lasersight is active.</li>
</ul> </ul>

View file

@ -58,7 +58,7 @@ local settings = Flow.Settings.new()
settings.Weapons[WeaponType.PISTOLS].interval = 9 settings.Weapons[WeaponType.PISTOLS].interval = 9
settings.Weapons[WeaponType.PISTOLS].waterLevel = 650 settings.Weapons[WeaponType.PISTOLS].waterLevel = 650
settings.Weapons[WeaponType.PISTOLS].flashDuration = 3 settings.Weapons[WeaponType.PISTOLS].flashDuration = 3
settings.Weapons[WeaponType.PISTOLS].flashRange = 12 settings.Weapons[WeaponType.PISTOLS].flashRange = 9
settings.Weapons[WeaponType.PISTOLS].flashColor = Color(192, 128, 0) settings.Weapons[WeaponType.PISTOLS].flashColor = Color(192, 128, 0)
settings.Weapons[WeaponType.PISTOLS].damage = 1 settings.Weapons[WeaponType.PISTOLS].damage = 1
settings.Weapons[WeaponType.PISTOLS].smoke = true settings.Weapons[WeaponType.PISTOLS].smoke = true
@ -72,7 +72,7 @@ local settings = Flow.Settings.new()
settings.Weapons[WeaponType.REVOLVER].interval = 16 settings.Weapons[WeaponType.REVOLVER].interval = 16
settings.Weapons[WeaponType.REVOLVER].waterLevel = 650 settings.Weapons[WeaponType.REVOLVER].waterLevel = 650
settings.Weapons[WeaponType.REVOLVER].flashDuration = 3 settings.Weapons[WeaponType.REVOLVER].flashDuration = 3
settings.Weapons[WeaponType.REVOLVER].flashRange = 12 settings.Weapons[WeaponType.REVOLVER].flashRange = 9
settings.Weapons[WeaponType.REVOLVER].flashColor = Color(192, 128, 0) settings.Weapons[WeaponType.REVOLVER].flashColor = Color(192, 128, 0)
settings.Weapons[WeaponType.REVOLVER].damage = 21 settings.Weapons[WeaponType.REVOLVER].damage = 21
settings.Weapons[WeaponType.REVOLVER].alternateDamage = 21 settings.Weapons[WeaponType.REVOLVER].alternateDamage = 21
@ -87,7 +87,7 @@ local settings = Flow.Settings.new()
settings.Weapons[WeaponType.UZI].interval = 3 settings.Weapons[WeaponType.UZI].interval = 3
settings.Weapons[WeaponType.UZI].waterLevel = 650 settings.Weapons[WeaponType.UZI].waterLevel = 650
settings.Weapons[WeaponType.UZI].flashDuration = 2 settings.Weapons[WeaponType.UZI].flashDuration = 2
settings.Weapons[WeaponType.UZI].flashRange = 12 settings.Weapons[WeaponType.UZI].flashRange = 9
settings.Weapons[WeaponType.UZI].flashColor = Color(192, 128, 0) settings.Weapons[WeaponType.UZI].flashColor = Color(192, 128, 0)
settings.Weapons[WeaponType.UZI].damage = 1 settings.Weapons[WeaponType.UZI].damage = 1
settings.Weapons[WeaponType.UZI].smoke = true settings.Weapons[WeaponType.UZI].smoke = true

View file

@ -319,8 +319,9 @@ void HandlePistols(ItemInfo& laraItem, LaraWeaponType weaponType)
auto basePos = GetJointPosition(&laraItem, (lara.LeftArm.GunFlash != 0) ? LM_LHAND : LM_RHAND).ToVector3(); auto basePos = GetJointPosition(&laraItem, (lara.LeftArm.GunFlash != 0) ? LM_LHAND : LM_RHAND).ToVector3();
auto sphere = BoundingSphere(basePos, BLOCK(1 / 8.0f)); auto sphere = BoundingSphere(basePos, BLOCK(1 / 8.0f));
auto lightPos = Random::GeneratePointInSphere(sphere); auto lightPos = Random::GeneratePointInSphere(sphere);
TriggerDynamicPointLight(lightPos, color, CLICK(settings.FlashRange)); int range = abs(Random::GenerateInt(settings.FlashRange - 2, settings.FlashRange + 2));
TriggerDynamicPointLight(lightPos, color, CLICK(range));
} }
} }

View file

@ -17,7 +17,8 @@ enum class CameraType
Combat, Combat,
Heavy, // HACK: Fixed camera type, but activated with heavy trigger. Heavy, // HACK: Fixed camera type, but activated with heavy trigger.
Flyby, // Used as script function return type only. Flyby, // Used as script function return type only.
Optics // Used as script function return type only. Binoculars, // Used as script function return type only.
Lasersight // Used as script function return type only.
}; };
struct CAMERA_INFO struct CAMERA_INFO

View file

@ -24,9 +24,9 @@ namespace TEN::Scripting
// NOTE: Since Weapons array is bound to Lua directly and Lua accesses this array by native enum, where 0 is NONE, and 1 is PISTOLS, // NOTE: Since Weapons array is bound to Lua directly and Lua accesses this array by native enum, where 0 is NONE, and 1 is PISTOLS,
// 0 index is omitted due to Lua indexing arrays starting from 1. 1 must be subtracted from initializer index. // 0 index is omitted due to Lua indexing arrays starting from 1. 1 must be subtracted from initializer index.
Weapons[(int)LaraWeaponType::Pistol - 1] = { 8.0f, BLOCK(8), 9, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 12, 3, true, true, true, false }; Weapons[(int)LaraWeaponType::Pistol - 1] = { 8.0f, BLOCK(8), 9, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 3, true, true, true, false };
Weapons[(int)LaraWeaponType::Revolver - 1] = { 4.0f, BLOCK(8), 16, (int)BLOCK(0.65f), 21, 21, 6, ScriptColor(192, 128, 0), 12, 3, true, false, true, false }; Weapons[(int)LaraWeaponType::Revolver - 1] = { 4.0f, BLOCK(8), 16, (int)BLOCK(0.65f), 21, 21, 6, ScriptColor(192, 128, 0), 9, 3, true, false, true, false };
Weapons[(int)LaraWeaponType::Uzi - 1] = { 8.0f, BLOCK(8), 3, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 12, 2, true, true, true, false }; Weapons[(int)LaraWeaponType::Uzi - 1] = { 8.0f, BLOCK(8), 3, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 2, true, true, true, false };
Weapons[(int)LaraWeaponType::Shotgun - 1] = { 10.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 3, 3, 6, ScriptColor(192, 128, 0), 12, 3, true, true, false, false }; Weapons[(int)LaraWeaponType::Shotgun - 1] = { 10.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 3, 3, 6, ScriptColor(192, 128, 0), 12, 3, true, true, false, false };
Weapons[(int)LaraWeaponType::HK - 1] = { 4.0f, BLOCK(12), 0, (int)BLOCK(0.50f), 4, 4, 30, ScriptColor(192, 128, 0), 12, 2, true, true, true, false }; Weapons[(int)LaraWeaponType::HK - 1] = { 4.0f, BLOCK(12), 0, (int)BLOCK(0.50f), 4, 4, 30, ScriptColor(192, 128, 0), 12, 2, true, true, true, false };
Weapons[(int)LaraWeaponType::Crossbow - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 5, 20, 10, ScriptColor(192, 128, 0), 0, 0, false, false, false, false }; Weapons[(int)LaraWeaponType::Crossbow - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 5, 20, 10, ScriptColor(192, 128, 0), 0, 0, false, false, false, false };

View file

@ -15,17 +15,19 @@ Constants for the type of the Camera.
- `FIXED` - classic fixed camera. - `FIXED` - classic fixed camera.
- `LOOK` - look camera. - `LOOK` - look camera.
- `FLYBY` - flyby or tracking camera. - `FLYBY` - flyby or tracking camera.
- `OPTICS` - binoculars or lasersight is active. - `BINOCULARS` - binoculars is active.
- `LASERSIGHT` - lasersight is active.
*/ */
static const std::unordered_map<std::string, CameraType> CAMERA_TYPE static const std::unordered_map<std::string, CameraType> CAMERA_TYPE
{ {
{ "CHASE", CameraType::Chase }, // DEPRECATED { "CHASE", CameraType::Chase }, // DEPRECATED
{ "NORMAL", CameraType::Chase }, { "NORMAL", CameraType::Chase },
{ "COMBAT", CameraType::Combat }, { "COMBAT", CameraType::Combat },
{ "FIXED", CameraType::Fixed }, { "FIXED", CameraType::Fixed },
{ "HEAVY", CameraType::Fixed }, // DEPRECATED { "HEAVY", CameraType::Fixed }, // DEPRECATED
{ "LOOK", CameraType::Look }, { "LOOK", CameraType::Look },
{ "FLYBY", CameraType::Flyby }, { "FLYBY", CameraType::Flyby },
{ "OPTICS", CameraType::Optics } { "BINOCULARS", CameraType::Binoculars },
{ "LASERSIGHT", CameraType::Lasersight }
}; };

View file

@ -72,8 +72,11 @@ namespace TEN::Scripting::View
if (UseSpotCam) if (UseSpotCam)
return CameraType::Flyby; return CameraType::Flyby;
if (Lara.Control.Look.IsUsingBinoculars || Lara.Control.Look.IsUsingLasersight) if (Lara.Control.Look.IsUsingLasersight)
return CameraType::Optics; return CameraType::Lasersight;
if (Lara.Control.Look.IsUsingBinoculars)
return CameraType::Binoculars;
if (Camera.oldType == CameraType::Heavy) if (Camera.oldType == CameraType::Heavy)
return CameraType::Fixed; return CameraType::Fixed;
@ -187,6 +190,16 @@ namespace TEN::Scripting::View
//end //end
tableView.set_function(ScriptReserved_GetCameraType, &GetCameraType); tableView.set_function(ScriptReserved_GetCameraType, &GetCameraType);
///Gets current camera position.
//@function GetCameraPosition
//@treturn Vec3 current camera position
tableView.set_function(ScriptReserved_GetCameraPosition, &GetCameraPosition);
///Gets current camera target.
//@function GetCameraTarget
//@treturn Vec3 current camera target
tableView.set_function(ScriptReserved_GetCameraTarget, &GetCameraTarget);
///Gets current room where camera is positioned. ///Gets current room where camera is positioned.
//@function GetCameraRoom //@function GetCameraRoom
//@treturn Objects.Room current room of the camera //@treturn Objects.Room current room of the camera
@ -207,16 +220,6 @@ namespace TEN::Scripting::View
//@tparam Color tint value to use. //@tparam Color tint value to use.
tableView.set_function(ScriptReserved_SetPostProcessTint, &SetPostProcessTint); tableView.set_function(ScriptReserved_SetPostProcessTint, &SetPostProcessTint);
///Gets current camera position.
//@function GetCameraPosition
//@treturn Vec3 current camera position
tableView.set_function(ScriptReserved_GetCameraPosition, &GetCameraPosition);
///Gets current camera target.
//@function GetCameraTarget
//@treturn Vec3 current camera target
tableView.set_function(ScriptReserved_GetCameraTarget, &GetCameraTarget);
///Enable FlyBy with specific ID ///Enable FlyBy with specific ID
//@function PlayFlyBy //@function PlayFlyBy
//@tparam short flyby (ID of flyby) //@tparam short flyby (ID of flyby)