diff --git a/CHANGELOG.md b/CHANGELOG.md index 301a29fcb..983158c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,6 @@ TombEngine releases are located in this repository (alongside with Tomb Editor): * Added TR4 Statue Plinth. ### Lua API changes - * Added Collision.Probe class for basic room collision detection. * Added advanced particle emitter allowing animations and other effects. * Added diary module. @@ -46,11 +45,13 @@ TombEngine releases are located in this repository (alongside with Tomb Editor): * Added Effects.EmitStreamer() function to emit streamers. * Added Moveable:GetScale() and Movebale:SetScale() methods to set visible scale of moveables. * Added Rotation:Lerp() function to allow linear interpolation between rotations. +* Added ability to perform additive and subtractive operations on Rotation class and compare one Rotation to another. * Added various Translate() methods to Vec2 and Vec3 script objects. * Added alpha transparency functionality for statics and moveables to be used with SetColor() method. * Added extra arguments for sprite object slots and starting rotation value for EmitParticle function. -* Added ability to save Flow.Level fields such as fog or horizon to a savegame. +* Added ability to dynamically change Flow.Level fields such as fog, starfield or horizon, and save them to a savegame. * Added pickup count to Flow.Statistics class. +* Changed Flow.StarField and Flow.LensFlare primitive types to use parameters instead of getters and setters. * Fixed medipack level count in Flow.Statistics class. ## [Version 1.7.1](https://github.com/TombEngine/TombEditorReleases/releases/tag/v1.7.4) - 2025-04-01 diff --git a/Documentation/config.ld b/Documentation/config.ld index bae3388cd..abc23eb0c 100644 --- a/Documentation/config.ld +++ b/Documentation/config.ld @@ -12,27 +12,27 @@ new_type("luautil", "5 Lua utility modules", true) not_luadoc = true -local version = "1.7.2 (Developer)" +local version = "1.8" project = " TombEngine" 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. +full_description = [[Welcome to the TombEngine scripting API. +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 TombEngine website. -####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. + +####Module Hierarchy +Other than the "special tables" (`GameVars`, `LevelVars` and `LevelFuncs`), every module described herein is held in a master table called TEN. For convenience, these modules and classes are automatically put in the global table. For example, you can call GetMoveableByName either of these two ways: local door = TEN.Objects.GetMoveableByName("door_type4_14") local door = GetMoveableByName("door_type4_14") ####Always check logs/TENLog.txt -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`. +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. +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. If this happens, check __logs/TENLog.txt__ and look for an error message with the word "unrecoverable". -If this happens, check __logs/TENLog.txt__ and look for an error message with the word "unrecoverable". - -Enjoy. +Happy building! \- _squidshire and the TombEngine development team._ ]] diff --git a/Documentation/doc/1 modules/Effects.html b/Documentation/doc/1 modules/Effects.html index 3e7751034..1a475096e 100644 --- a/Documentation/doc/1 modules/Effects.html +++ b/Documentation/doc/1 modules/Effects.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/Flow.html b/Documentation/doc/1 modules/Flow.html index 4d7ffc676..2adf40fd9 100644 --- a/Documentation/doc/1 modules/Flow.html +++ b/Documentation/doc/1 modules/Flow.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/Input.html b/Documentation/doc/1 modules/Input.html index ab68d0a53..7e0bbc989 100644 --- a/Documentation/doc/1 modules/Input.html +++ b/Documentation/doc/1 modules/Input.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/Inventory.html b/Documentation/doc/1 modules/Inventory.html index b16cba1f0..67a567fc8 100644 --- a/Documentation/doc/1 modules/Inventory.html +++ b/Documentation/doc/1 modules/Inventory.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/Logic.html b/Documentation/doc/1 modules/Logic.html index 607c77c99..e1e0aa7df 100644 --- a/Documentation/doc/1 modules/Logic.html +++ b/Documentation/doc/1 modules/Logic.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/Objects.html b/Documentation/doc/1 modules/Objects.html index ae8c45650..3f9e4d031 100644 --- a/Documentation/doc/1 modules/Objects.html +++ b/Documentation/doc/1 modules/Objects.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/Sound.html b/Documentation/doc/1 modules/Sound.html index 5cfa41484..4c8cf0da5 100644 --- a/Documentation/doc/1 modules/Sound.html +++ b/Documentation/doc/1 modules/Sound.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -124,40 +124,40 @@

    Functions

    - - + + - + - + - + - + - - + + - - + + - - + + - + @@ -174,22 +174,22 @@
    - PlayAudioTrack(name, type) + PlayAudioTrack(filename, type)
    - Play an audio track + Play an audio track. Supported formats are wav, mp3 and ogg.

    Parameters:

    @@ -203,7 +203,7 @@ SetAmbientTrack(name, fromStart)
    - Set and play an ambient track + Set and play an ambient track. @@ -211,11 +211,11 @@ @@ -229,7 +229,7 @@ StopAudioTracks()
    - Stop any audio tracks currently playing + Stop any audio tracks currently playing. @@ -244,7 +244,7 @@ StopAudioTrack(type)
    - Stop audio track that is currently playing + Stop audio track that is currently playing. @@ -252,7 +252,7 @@ @@ -266,7 +266,7 @@ GetAudioTrackLoudness(type)
    - Get current loudness level for specified track type + Get current loudness level for specified track type. @@ -274,7 +274,7 @@ @@ -282,7 +282,7 @@
      float - current loudness of a specified audio track + Current loudness of a specified audio track.
    @@ -291,18 +291,18 @@
    - PlaySound(sound[, position]) + PlaySound(soundID[, position])
    - Play sound effect + Play sound effect.

    Parameters:

    - StopSound(sound) + StopSound(soundID)
    - Stop sound effect + Stop sound effect.

    Parameters:

    @@ -340,18 +340,18 @@
    - IsSoundPlaying(Sound) + IsSoundPlaying(soundID)
    - Check if the sound effect is playing + Check if the sound effect is playing.

    Parameters:

    @@ -365,7 +365,7 @@ IsAudioTrackPlaying(Track)
    - Check if the audio track is playing + Check if the audio track is playing. @@ -373,7 +373,7 @@ @@ -388,8 +388,8 @@
    Get current subtitle string for a voice track currently playing. -Subtitle file must be in .srt format, have same filename as voice track, and be placed in same directory as voice track. -Returns nil if no voice track is playing or no subtitle present. + Subtitle file must be in .srt format, have same filename as voice track, and be placed in same directory as voice track. + Returns nil if no voice track is playing or no subtitle present. @@ -398,7 +398,7 @@ Returns nil if no voice track is playing or no subtitle present.
      string - current subtitle string + Current subtitle string.
    diff --git a/Documentation/doc/1 modules/Strings.html b/Documentation/doc/1 modules/Strings.html index 0dde6ad65..c3c57ea92 100644 --- a/Documentation/doc/1 modules/Strings.html +++ b/Documentation/doc/1 modules/Strings.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/Util.html b/Documentation/doc/1 modules/Util.html index 97a387d2a..6e7bf0f91 100644 --- a/Documentation/doc/1 modules/Util.html +++ b/Documentation/doc/1 modules/Util.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/1 modules/View.html b/Documentation/doc/1 modules/View.html index e1bb7aa4d..45bcd0fc5 100644 --- a/Documentation/doc/1 modules/View.html +++ b/Documentation/doc/1 modules/View.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Collision.Probe.html b/Documentation/doc/2 classes/Collision.Probe.html index 7470c4456..d897d847f 100644 --- a/Documentation/doc/2 classes/Collision.Probe.html +++ b/Documentation/doc/2 classes/Collision.Probe.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Flow.Level.html b/Documentation/doc/2 classes/Flow.Level.html index 780c9ba38..88af887a2 100644 --- a/Documentation/doc/2 classes/Flow.Level.html +++ b/Documentation/doc/2 classes/Flow.Level.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -143,31 +143,31 @@
    - + - + - + - - + + - + - + @@ -199,11 +199,11 @@ - + - +
    PlayAudioTrack(name, type)Play an audio trackPlayAudioTrack(filename, type)Play an audio track.
    SetAmbientTrack(name, fromStart)Set and play an ambient trackSet and play an ambient track.
    StopAudioTracks()Stop any audio tracks currently playingStop any audio tracks currently playing.
    StopAudioTrack(type)Stop audio track that is currently playingStop audio track that is currently playing.
    GetAudioTrackLoudness(type)Get current loudness level for specified track typeGet current loudness level for specified track type.
    PlaySound(sound[, position])Play sound effectPlaySound(soundID[, position])Play sound effect.
    StopSound(sound)Stop sound effectStopSound(soundID)Stop sound effect.
    IsSoundPlaying(Sound)Check if the sound effect is playingIsSoundPlaying(soundID)Check if the sound effect is playing.
    IsAudioTrackPlaying(Track)Check if the audio track is playingCheck if the audio track is playing.
    GetCurrentSubtitle()
    layer1(Flow.SkyLayer) Primary sky layer(Flow.SkyLayer) Primary sky cloud layer.
    layer2(Flow.SkyLayer) Secondary sky layer(Flow.SkyLayer) Secondary sky cloud layer.
    horizon1 (Flow.Horizon) First horizon layer.
    horizon1horizon2 (Flow.Horizon) Second horizon layer.
    starfield(Flow.Starfield) Starfield.starField(Flow.StarField) Starfield in the sky.
    lensFlare(Flow.LensFlare) Global lens flare .(Flow.LensFlare) Global lens flare.
    fog(Flow.Fog) omni fog RGB color and distance.(Flow.Fog) Global distance fog, with specified RGB color and distance.
    storm
    objects(table of Flow.InventoryItems) table of inventory object overrides(table of Flow.InventoryItems) A table of inventory object layout overrides.
    secrets(short) Set Secrets for Level(short) Set total secret count for current level.

    Functions

    @@ -306,7 +306,7 @@ layer1
    - (Flow.SkyLayer) Primary sky layer + (Flow.SkyLayer) Primary sky cloud layer. @@ -321,7 +321,7 @@ layer2
    - (Flow.SkyLayer) Secondary sky layer + (Flow.SkyLayer) Secondary sky cloud layer. @@ -347,8 +347,8 @@
    - - horizon1 + + horizon2
    (Flow.Horizon) Second horizon layer. @@ -362,11 +362,11 @@
    - - starfield + + starField
    - (Flow.Starfield) Starfield. + (Flow.StarField) Starfield in the sky. @@ -381,7 +381,7 @@ lensFlare
    - (Flow.LensFlare) Global lens flare . + (Flow.LensFlare) Global lens flare. @@ -396,9 +396,8 @@ fog
    - (Flow.Fog) omni fog RGB color and distance. - As seen in TR4's Desert Railroad. - If not provided, distance fog will be black. + (Flow.Fog) Global distance fog, with specified RGB color and distance. + If not provided, distance fog will not be visible. @@ -537,7 +536,7 @@ Invisible objects
    - (table of Flow.InventoryItems) table of inventory object overrides + (table of Flow.InventoryItems) A table of inventory object layout overrides. @@ -552,7 +551,7 @@ Invisible secrets
    - (short) Set Secrets for Level + (short) Set total secret count for current level. @@ -580,7 +579,7 @@ Invisible
      Level - a Level object + a Level object.
    diff --git a/Documentation/doc/2 classes/Flow.Settings.html b/Documentation/doc/2 classes/Flow.Settings.html index 092587e0b..dd633bb6d 100644 --- a/Documentation/doc/2 classes/Flow.Settings.html +++ b/Documentation/doc/2 classes/Flow.Settings.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Flow.Statistics.html b/Documentation/doc/2 classes/Flow.Statistics.html index 030cb81b1..ce7559423 100644 --- a/Documentation/doc/2 classes/Flow.Statistics.html +++ b/Documentation/doc/2 classes/Flow.Statistics.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Objects.AIObject.html b/Documentation/doc/2 classes/Objects.AIObject.html index fcb918837..49df5459e 100644 --- a/Documentation/doc/2 classes/Objects.AIObject.html +++ b/Documentation/doc/2 classes/Objects.AIObject.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Objects.Camera.html b/Documentation/doc/2 classes/Objects.Camera.html index c79508433..385089252 100644 --- a/Documentation/doc/2 classes/Objects.Camera.html +++ b/Documentation/doc/2 classes/Objects.Camera.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Objects.LaraObject.html b/Documentation/doc/2 classes/Objects.LaraObject.html index ef3373f39..950ff7df3 100644 --- a/Documentation/doc/2 classes/Objects.LaraObject.html +++ b/Documentation/doc/2 classes/Objects.LaraObject.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Objects.Moveable.html b/Documentation/doc/2 classes/Objects.Moveable.html index b088b9ea2..f2b624dc6 100644 --- a/Documentation/doc/2 classes/Objects.Moveable.html +++ b/Documentation/doc/2 classes/Objects.Moveable.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -118,8 +118,6 @@

    Represents a moveable object in the game world.

    Examples include the player, traps, enemies, doors, and pickups. See also Objects.LaraObject for player-specific features.

    -

    pragma nostrip

    -

    Functions

    diff --git a/Documentation/doc/2 classes/Objects.Room.html b/Documentation/doc/2 classes/Objects.Room.html index e4eb0369b..8e2a5ac4c 100644 --- a/Documentation/doc/2 classes/Objects.Room.html +++ b/Documentation/doc/2 classes/Objects.Room.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -177,7 +177,7 @@ Room:GetRoomNumber()
    - Get the room's number. () + Get the room's number. @@ -198,7 +198,7 @@ Room:GetName()
    - Get the room's unique string identifier. () + Get the room's unique string identifier. @@ -219,7 +219,7 @@ Room:GetColor()
    - Get the room's ambient light color. () + Get the room's ambient light color. @@ -240,7 +240,7 @@ Room:GetReverbType()
    - Get the room's reverb type. () + Get the room's reverb type. @@ -261,7 +261,7 @@ Room:SetName(name)
    - Set the room's unique string identifier. () + Set the room's unique string identifier. @@ -283,7 +283,7 @@ Room:SetReverbType(Reverb)
    - Set the room's reverb type. () + Set the room's reverb type. @@ -305,7 +305,7 @@ Room:SetFlag(flagID, Boolean)
    - Set the room's specified flag. () + Set the room's specified flag. @@ -331,7 +331,7 @@ Room:GetFlag(flagID)
    - Get the room's specified flag value (true or false). () + Get the room's specified flag value (true or false). @@ -353,7 +353,7 @@ Room:IsTagPresent(tag)
    - Check if the specified tag is set for the room. () + Check if the specified tag is set for the room. @@ -381,7 +381,7 @@ Room:GetActive()
    - Check if the room is active. () + Check if the room is active. diff --git a/Documentation/doc/2 classes/Objects.Sink.html b/Documentation/doc/2 classes/Objects.Sink.html index e9e57c4fe..84b307826 100644 --- a/Documentation/doc/2 classes/Objects.Sink.html +++ b/Documentation/doc/2 classes/Objects.Sink.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Objects.SoundSource.html b/Documentation/doc/2 classes/Objects.SoundSource.html index 5c685ab95..051f35de9 100644 --- a/Documentation/doc/2 classes/Objects.SoundSource.html +++ b/Documentation/doc/2 classes/Objects.SoundSource.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Objects.Static.html b/Documentation/doc/2 classes/Objects.Static.html index f8afe4407..4adcdd058 100644 --- a/Documentation/doc/2 classes/Objects.Static.html +++ b/Documentation/doc/2 classes/Objects.Static.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Objects.Volume.html b/Documentation/doc/2 classes/Objects.Volume.html index 7b8534235..7976ec63a 100644 --- a/Documentation/doc/2 classes/Objects.Volume.html +++ b/Documentation/doc/2 classes/Objects.Volume.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/Strings.DisplayString.html b/Documentation/doc/2 classes/Strings.DisplayString.html index d1a494957..df98e9f4f 100644 --- a/Documentation/doc/2 classes/Strings.DisplayString.html +++ b/Documentation/doc/2 classes/Strings.DisplayString.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/2 classes/View.DisplaySprite.html b/Documentation/doc/2 classes/View.DisplaySprite.html index f9d3c07f0..a17294a5b 100644 --- a/Documentation/doc/2 classes/View.DisplaySprite.html +++ b/Documentation/doc/2 classes/View.DisplaySprite.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/3 primitive classes/Color.html b/Documentation/doc/3 primitive classes/Color.html index 0d2993bd9..c2ae23ee2 100644 --- a/Documentation/doc/3 primitive classes/Color.html +++ b/Documentation/doc/3 primitive classes/Color.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/3 primitive classes/Flow.Fog.html b/Documentation/doc/3 primitive classes/Flow.Fog.html index 3bd25c6b4..c2aa2554e 100644 --- a/Documentation/doc/3 primitive classes/Flow.Fog.html +++ b/Documentation/doc/3 primitive classes/Flow.Fog.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -115,10 +115,8 @@

    Primitive Class Flow.Fog

    -

    Distance fog.

    -

    - -

    +

    Represesnts distance fog.

    +

    To be used with Flow.Level.fog property.

    Members

    diff --git a/Documentation/doc/3 primitive classes/Flow.Horizon.html b/Documentation/doc/3 primitive classes/Flow.Horizon.html index 5beccaa2b..fd74cd004 100644 --- a/Documentation/doc/3 primitive classes/Flow.Horizon.html +++ b/Documentation/doc/3 primitive classes/Flow.Horizon.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -116,63 +116,127 @@

    Primitive Class Flow.Horizon

    Represents a horizon.

    -

    - -

    +

    To be used with Flow.Level.horizon1 and Flow.Level.horizon2 properties.

    +

    Members

    +
    + + + + + + + + + + + + + + + + + + + + +
    enabled(bool) Horizon enabled state.
    objectID(Objects.ObjID) Horizon object ID.
    position(Vec3) Horizon position.
    rotation(Rotation) Horizon rotation.
    transparency(float) Horizon transparency.

    Functions

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Horizon(objectID) Create a horizon object.
    GetEnabled()Get the horizon's enabled state.
    GetObjectID()Get the horizon's slot object ID.
    GetPosition()Get the horizon's world position.
    GetRotation()Get the horizon's rotation.
    GetTransparency()Get the horizon's transparency.
    SetEnabled(enabled)Set the horizon's enabled state.
    SetObjectID(objectID)Set the horizon's object ID.
    SetPosition(pos[, noInterpolation])Set the horizon's world position.
    SetRotation(rot[, noInterpolation])Set the horizon's rotation.
    SetTransparency(transparency)Set the horizon's transparency.


    +

    Members

    + +
    +
    + + enabled +
    +
    + (bool) Horizon enabled state. + If set to true, horizon will be visible. + + + + + + + + +
    +
    + + objectID +
    +
    + (Objects.ObjID) Horizon object ID. + + + + + + + + +
    +
    + + position +
    +
    + (Vec3) Horizon position. + Specifies an offset from the camera origin. + + + + + + + + +
    +
    + + rotation +
    +
    + (Rotation) Horizon rotation. + Specifies horizon rotation. + + + + + + + + +
    +
    + + transparency +
    +
    + (float) Horizon transparency. + Specifies horizon transparency on a range from 0 to 1. + + + + + + + + +
    +

    Functions

    @@ -203,231 +267,6 @@ -
    -
    - - GetEnabled() -
    -
    - Get the horizon's enabled state. - - - - -

    Returns:

    -
      - - bool - Enabled state. -
    - - - - -
    -
    - - GetObjectID() -
    -
    - Get the horizon's slot object ID. - - - - -

    Returns:

    -
      - - ObjID - Object ID. -
    - - - - -
    -
    - - GetPosition() -
    -
    - Get the horizon's world position. - - - - -

    Returns:

    -
      - - Vec3 - Position. -
    - - - - -
    -
    - - GetRotation() -
    -
    - Get the horizon's rotation. - - - - -

    Returns:

    -
      - - Rotation - Rotation. -
    - - - - -
    -
    - - GetTransparency() -
    -
    - Get the horizon's transparency. - - - - -

    Returns:

    -
      - - float - Transparency. -
    - - - - -
    -
    - - SetEnabled(enabled) -
    -
    - Set the horizon's enabled state. - - - -

    Parameters:

    - - - - - - -
    -
    - - SetObjectID(objectID) -
    -
    - Set the horizon's object ID. - - - -

    Parameters:

    - - - - - - -
    -
    - - SetPosition(pos[, noInterpolation]) -
    -
    - Set the horizon's world position. - - - -

    Parameters:

    - - - - - - -
    -
    - - SetRotation(rot[, noInterpolation]) -
    -
    - Set the horizon's rotation. - - - -

    Parameters:

    - - - - - - -
    -
    - - SetTransparency(transparency) -
    -
    - Set the horizon's transparency. - - - -

    Parameters:

    - - - - - -
    diff --git a/Documentation/doc/3 primitive classes/Flow.InventoryItem.html b/Documentation/doc/3 primitive classes/Flow.InventoryItem.html index 1586a6072..0fc41f7b1 100644 --- a/Documentation/doc/3 primitive classes/Flow.InventoryItem.html +++ b/Documentation/doc/3 primitive classes/Flow.InventoryItem.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -116,9 +116,7 @@

    Primitive Class Flow.InventoryItem

    Represents the properties of an object as it appears in the inventory.

    -

    - -

    +

    To be used in Flow.Level.objects list.

    Functions

    diff --git a/Documentation/doc/3 primitive classes/Flow.LensFlare.html b/Documentation/doc/3 primitive classes/Flow.LensFlare.html index ad3f0f67a..c2e8a2807 100644 --- a/Documentation/doc/3 primitive classes/Flow.LensFlare.html +++ b/Documentation/doc/3 primitive classes/Flow.LensFlare.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -116,59 +116,124 @@

    Primitive Class Flow.LensFlare

    Represents a global lens flare (not to be confused with the lens flare object).

    -

    - -

    +

    To be used with Flow.Level.lensFlare property.

    +

    Members

    + + + + + + + + + + + + + + + + + + + + + +
    enabled(bool) Lens flare enabled state.
    spriteID(int) Lens flare's sun sprite object ID.
    pitch(float) Lens flare's pitch (vertical) angle in degrees.
    yaw(float) Lens flare's yaw (horizontal) angle in degrees.
    color(Color) Lens flare's color.

    Functions

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    LensFlare(pitch, yaw, color) Create a LensFlare object.
    LensFlare:GetSunSpriteID()Get this lens flare's sun sprite ID.
    LensFlare:GetPitch()Get this lens flare's pitch angle in degrees.
    LensFlare:GetYaw()Get this lens flare's yaw angle in degrees.
    LensFlare:GetColor()Get the lens flare's color.
    LensFlare:GetEnabled()Get this lens flare's enabled status.
    LensFlare:SetSunSpriteID(spriteID)Set this lens flare's sun sprite ID.
    LensFlare:SetPitch(pitch)Set this lens flare's pitch angle.
    LensFlare:SetYaw(yaw)Set this lens flare's yaw angle.
    LensFlare:SetColor(color)Set this lens flare's color.


    +

    Members

    + +
    +
    + + enabled +
    +
    + (bool) Lens flare enabled state. + If set to true, lens flare will be visible. + + + + + + + + +
    +
    + + spriteID +
    +
    + (int) Lens flare's sun sprite object ID. + + + + + + + + +
    +
    + + pitch +
    +
    + (float) Lens flare's pitch (vertical) angle in degrees. + + + + + + + + +
    +
    + + yaw +
    +
    + (float) Lens flare's yaw (horizontal) angle in degrees. + + + + + + + + +
    +
    + + color +
    +
    + (Color) Lens flare's color. + + + + + + + + +
    +

    Functions

    @@ -207,193 +272,6 @@ - -
    - - LensFlare:GetSunSpriteID() -
    -
    - Get this lens flare's sun sprite ID. - - - - -

    Returns:

    -
      - - int - Sprite ID. -
    - - - - -
    -
    - - LensFlare:GetPitch() -
    -
    - Get this lens flare's pitch angle in degrees. - - - - -

    Returns:

    -
      - - float - Pitch angle in degrees. -
    - - - - -
    -
    - - LensFlare:GetYaw() -
    -
    - Get this lens flare's yaw angle in degrees. - - - - -

    Returns:

    -
      - - float - Yaw angle in degrees. -
    - - - - -
    -
    - - LensFlare:GetColor() -
    -
    - Get the lens flare's color. - - - - - - - - -
    -
    - - LensFlare:GetEnabled() -
    -
    - Get this lens flare's enabled status. - - - - -

    Returns:

    -
      - - bool - Enabled status. true: enabled, false: disabled -
    - - - - -
    -
    - - LensFlare:SetSunSpriteID(spriteID) -
    -
    - Set this lens flare's sun sprite ID. - - - -

    Parameters:

    - - - - - - -
    -
    - - LensFlare:SetPitch(pitch) -
    -
    - Set this lens flare's pitch angle. - - - -

    Parameters:

    - - - - - - -
    -
    - - LensFlare:SetYaw(yaw) -
    -
    - Set this lens flare's yaw angle. - - - -

    Parameters:

    - - - - - - -
    -
    - - LensFlare:SetColor(color) -
    -
    - Set this lens flare's color. - - - -

    Parameters:

    - - - - - -
    diff --git a/Documentation/doc/3 primitive classes/Flow.SkyLayer.html b/Documentation/doc/3 primitive classes/Flow.SkyLayer.html index 03d2a46af..b64f57108 100644 --- a/Documentation/doc/3 primitive classes/Flow.SkyLayer.html +++ b/Documentation/doc/3 primitive classes/Flow.SkyLayer.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -116,7 +116,7 @@

    Primitive Class Flow.SkyLayer

    Describes a layer of moving clouds.

    -

    As seen in TR4's City of the Dead.

    +

    To be used with Flow.Level.layer1 and Flow.Level.layer2 properties.

    Members

    diff --git a/Documentation/doc/3 primitive classes/Flow.Starfield.html b/Documentation/doc/3 primitive classes/Flow.Starfield.html index 05934ae6b..df49ddf8b 100644 --- a/Documentation/doc/3 primitive classes/Flow.Starfield.html +++ b/Documentation/doc/3 primitive classes/Flow.Starfield.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -114,75 +114,116 @@
    -

    Primitive Class Flow.Starfield

    -

    Represents a starfield in the sky.

    -

    - -

    +

    Primitive Class Flow.StarField

    +

    Represents a star field in the sky.

    +

    To be used with Flow.Level.starField property.

    +

    Members

    + + + + + + + + + + + + + + + + + +
    starCount(int) Amount of visible stars.
    meteorCount(int) Amount of visible meteors.
    meteorSpawnDensity(int) Meteor spawn density.
    meteorVelocity(int) Meteor velocity.

    Functions

    - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Starfield(starCount)StarField(starCount) Create a starfield object with only stars.
    Starfield(starCount, meteorCount, meteorSpawnDensity, meteorVel)StarField(starCount, meteorCount, meteorSpawnDensity, meteorVel) Create a starfield object with stars and meteors.
    Starfield:GetStarCount()Get this starfield's number of stars.
    Starfield:GetMeteorCount()Get this starfield's number of meteors.
    Starfield:GetMeteorSpawnDensity()Get this starfield's meteor spawn density.
    Starfield:GetMeteorVelocity()Get this starfield's meteor velocity.
    Starfield:GetStarsEnabled()Get this starfield's stars enabled status.
    Starfield:GetMeteorsEnabled()Get this starfield's meteors enabled status.
    Starfield:SetStarCount(count)Set this starfield's number of stars.
    Starfield:SetMeteorCount(count)Set this starfield's number of meteors.
    Starfield:SetMeteorSpawnDensity(density)Set this starfield's meteor spawn density.
    Starfield:SetMeteorVelocity(velocity)Set this starfield's meteor velocity.


    +

    Members

    + +
    +
    + + starCount +
    +
    + (int) Amount of visible stars. + + + + + + + + +
    +
    + + meteorCount +
    +
    + (int) Amount of visible meteors. + + + + + + + + +
    +
    + + meteorSpawnDensity +
    +
    + (int) Meteor spawn density. + + + + + + + + +
    +
    + + meteorVelocity +
    +
    + (int) Meteor velocity. + + + + + + + + +
    +

    Functions

    - - Starfield(starCount) + + StarField(starCount)
    Create a starfield object with only stars. @@ -200,8 +241,8 @@

    Returns:

      - Starfield - A new Starfield object. + Starfield + A new StarField object.
    @@ -209,8 +250,8 @@
    - - Starfield(starCount, meteorCount, meteorSpawnDensity, meteorVel) + + StarField(starCount, meteorCount, meteorSpawnDensity, meteorVel)
    Create a starfield object with stars and meteors. @@ -240,227 +281,13 @@

    Returns:

      - Starfield - A new Starfield object. + StarField + A new StarField object.
    -
    -
    - - Starfield:GetStarCount() -
    -
    - Get this starfield's number of stars. - - - - -

    Returns:

    -
      - - int - Count. -
    - - - - -
    -
    - - Starfield:GetMeteorCount() -
    -
    - Get this starfield's number of meteors. - - - - -

    Returns:

    -
      - - int - Count. -
    - - - - -
    -
    - - Starfield:GetMeteorSpawnDensity() -
    -
    - Get this starfield's meteor spawn density. - - - - -

    Returns:

    -
      - - int - Spawn density. -
    - - - - -
    -
    - - Starfield:GetMeteorVelocity() -
    -
    - Get this starfield's meteor velocity. - - - - -

    Returns:

    -
      - - float - Velocity. -
    - - - - -
    -
    - - Starfield:GetStarsEnabled() -
    -
    - Get this starfield's stars enabled status. - - - - -

    Returns:

    -
      - - bool - Stars enabled status. true: enabled, false: disabled -
    - - - - -
    -
    - - Starfield:GetMeteorsEnabled() -
    -
    - Get this starfield's meteors enabled status. - - - - -

    Returns:

    -
      - - bool - Meteors enabled status. true: enabled, false: disabled -
    - - - - -
    -
    - - Starfield:SetStarCount(count) -
    -
    - Set this starfield's number of stars. - - - -

    Parameters:

    -
      -
    • count - int - New star count. -
    • -
    - - - - - -
    -
    - - Starfield:SetMeteorCount(count) -
    -
    - Set this starfield's number of meteors. - - - -

    Parameters:

    -
      -
    • count - int - New meteor count. -
    • -
    - - - - - -
    -
    - - Starfield:SetMeteorSpawnDensity(density) -
    -
    - Set this starfield's meteor spawn density. - - - -

    Parameters:

    -
      -
    • density - int - New meteor spawn density. -
    • -
    - - - - - -
    -
    - - Starfield:SetMeteorVelocity(velocity) -
    -
    - Set this starfield's meteor velocity. - - - -

    Parameters:

    -
      -
    • velocity - float - New meteor velocity. -
    • -
    - - - - -
    diff --git a/Documentation/doc/3 primitive classes/Rotation.html b/Documentation/doc/3 primitive classes/Rotation.html index 607218c1a..900fda280 100644 --- a/Documentation/doc/3 primitive classes/Rotation.html +++ b/Documentation/doc/3 primitive classes/Rotation.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/3 primitive classes/Time.html b/Documentation/doc/3 primitive classes/Time.html index 5cc1949f6..6de872b0c 100644 --- a/Documentation/doc/3 primitive classes/Time.html +++ b/Documentation/doc/3 primitive classes/Time.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/3 primitive classes/Vec2.html b/Documentation/doc/3 primitive classes/Vec2.html index 5c7f7e5c4..de9e80f16 100644 --- a/Documentation/doc/3 primitive classes/Vec2.html +++ b/Documentation/doc/3 primitive classes/Vec2.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -143,23 +143,19 @@ Create a Vec2 object. - __tostring(This) - Metafunction. - - Vec2:Normalize() Get a copy of this Vec2 normalized to length 1. - Translate(dir, dist) + Vec2:Translate(dir, dist) Get a copy of this Vec2 translated in the input Vec2 direction by the input distance. - Translate(rot, dist) + Vec2:Translate(rot, dist) Get a copy of this Vec2 translated in the direction of the input rotation in degrees by the input distance. - Translate(rot, relOffset) + Vec2:Translate(rot, relOffset) Get a copy of this Vec2 translated by an offset, where the input relative offset Vec2 is rotated according to the input rotation in degrees. @@ -186,6 +182,10 @@ Vec2:Length() Get the length of this Vec2. + + __tostring(This) + Metafunction. +
    @@ -288,34 +288,6 @@ - -
    - - __tostring(This) -
    -
    - Metafunction. Use tostring(vector). - - - -

    Parameters:

    - - -

    Returns:

    -
      - - string - A string showing the X and Y components of the Vec2. -
    - - - -
    @@ -339,8 +311,8 @@
    - - Translate(dir, dist) + + Vec2:Translate(dir, dist)
    Get a copy of this Vec2 translated in the input Vec2 direction by the input distance. @@ -371,8 +343,8 @@
    - - Translate(rot, dist) + + Vec2:Translate(rot, dist)
    Get a copy of this Vec2 translated in the direction of the input rotation in degrees by the input distance. @@ -403,8 +375,8 @@
    - - Translate(rot, relOffset) + + Vec2:Translate(rot, relOffset)
    Get a copy of this Vec2 translated by an offset, where the input relative offset Vec2 is rotated according to the input rotation in degrees. @@ -598,6 +570,34 @@ +
    +
    + + __tostring(This) +
    +
    + Metafunction. Use tostring(vector). + + + +

    Parameters:

    + + +

    Returns:

    +
      + + string + A string showing the X and Y components of the Vec2. +
    + + + +
    diff --git a/Documentation/doc/3 primitive classes/Vec3.html b/Documentation/doc/3 primitive classes/Vec3.html index 715d39062..bf9c41551 100644 --- a/Documentation/doc/3 primitive classes/Vec3.html +++ b/Documentation/doc/3 primitive classes/Vec3.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Collision.MaterialType.html b/Documentation/doc/4 enums/Collision.MaterialType.html index 560cb4d9f..693d6c9ae 100644 --- a/Documentation/doc/4 enums/Collision.MaterialType.html +++ b/Documentation/doc/4 enums/Collision.MaterialType.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Effects.BlendID.html b/Documentation/doc/4 enums/Effects.BlendID.html index 540ac8415..eecc444ff 100644 --- a/Documentation/doc/4 enums/Effects.BlendID.html +++ b/Documentation/doc/4 enums/Effects.BlendID.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Effects.EffectID.html b/Documentation/doc/4 enums/Effects.EffectID.html index 577ca2670..9072c82aa 100644 --- a/Documentation/doc/4 enums/Effects.EffectID.html +++ b/Documentation/doc/4 enums/Effects.EffectID.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Effects.FeatherMode.html b/Documentation/doc/4 enums/Effects.FeatherMode.html index f4a4fb39f..8fbae4b2c 100644 --- a/Documentation/doc/4 enums/Effects.FeatherMode.html +++ b/Documentation/doc/4 enums/Effects.FeatherMode.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Effects.ParticleAnimationType.html b/Documentation/doc/4 enums/Effects.ParticleAnimationType.html index 5da6ba0e8..8799d2677 100644 --- a/Documentation/doc/4 enums/Effects.ParticleAnimationType.html +++ b/Documentation/doc/4 enums/Effects.ParticleAnimationType.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -116,9 +116,7 @@

    Enum Effects.ParticleAnimationType

    Constants for particle animation type constants.

    -

    - -

    +

    To be used with Effects.EmitAdvancedParticle function.

    Tables

    diff --git a/Documentation/doc/4 enums/Flow.ErrorMode.html b/Documentation/doc/4 enums/Flow.ErrorMode.html index a972c1369..625510196 100644 --- a/Documentation/doc/4 enums/Flow.ErrorMode.html +++ b/Documentation/doc/4 enums/Flow.ErrorMode.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Flow.FreezeMode.html b/Documentation/doc/4 enums/Flow.FreezeMode.html index cff19f990..c24cf87bb 100644 --- a/Documentation/doc/4 enums/Flow.FreezeMode.html +++ b/Documentation/doc/4 enums/Flow.FreezeMode.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Flow.GameStatus.html b/Documentation/doc/4 enums/Flow.GameStatus.html index 27324b7b4..556a27170 100644 --- a/Documentation/doc/4 enums/Flow.GameStatus.html +++ b/Documentation/doc/4 enums/Flow.GameStatus.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Input.ActionID.html b/Documentation/doc/4 enums/Input.ActionID.html index 270c5a9e7..c198d7fcd 100644 --- a/Documentation/doc/4 enums/Input.ActionID.html +++ b/Documentation/doc/4 enums/Input.ActionID.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Objects.AmmoType.html b/Documentation/doc/4 enums/Objects.AmmoType.html index 80d10b754..b094c086f 100644 --- a/Documentation/doc/4 enums/Objects.AmmoType.html +++ b/Documentation/doc/4 enums/Objects.AmmoType.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Objects.HandStatus.html b/Documentation/doc/4 enums/Objects.HandStatus.html index 639793907..9e74accee 100644 --- a/Documentation/doc/4 enums/Objects.HandStatus.html +++ b/Documentation/doc/4 enums/Objects.HandStatus.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Objects.MoveableStatus.html b/Documentation/doc/4 enums/Objects.MoveableStatus.html index abc608b8a..5b55c96b6 100644 --- a/Documentation/doc/4 enums/Objects.MoveableStatus.html +++ b/Documentation/doc/4 enums/Objects.MoveableStatus.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Objects.ObjID.html b/Documentation/doc/4 enums/Objects.ObjID.html index 74e2413d8..ad84d4d32 100644 --- a/Documentation/doc/4 enums/Objects.ObjID.html +++ b/Documentation/doc/4 enums/Objects.ObjID.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Objects.RoomFlagID.html b/Documentation/doc/4 enums/Objects.RoomFlagID.html index a472524ec..820cc66fd 100644 --- a/Documentation/doc/4 enums/Objects.RoomFlagID.html +++ b/Documentation/doc/4 enums/Objects.RoomFlagID.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Objects.RoomReverb.html b/Documentation/doc/4 enums/Objects.RoomReverb.html index 9ecacbbbf..66b7ff482 100644 --- a/Documentation/doc/4 enums/Objects.RoomReverb.html +++ b/Documentation/doc/4 enums/Objects.RoomReverb.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Objects.WeaponType.html b/Documentation/doc/4 enums/Objects.WeaponType.html index ded6644fb..868204528 100644 --- a/Documentation/doc/4 enums/Objects.WeaponType.html +++ b/Documentation/doc/4 enums/Objects.WeaponType.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Sound.SoundTrackType.html b/Documentation/doc/4 enums/Sound.SoundTrackType.html index 322be1ca6..e5f87781c 100644 --- a/Documentation/doc/4 enums/Sound.SoundTrackType.html +++ b/Documentation/doc/4 enums/Sound.SoundTrackType.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Strings.DisplayStringOption.html b/Documentation/doc/4 enums/Strings.DisplayStringOption.html index 193062a2a..2f723c0c8 100644 --- a/Documentation/doc/4 enums/Strings.DisplayStringOption.html +++ b/Documentation/doc/4 enums/Strings.DisplayStringOption.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/Util.LogLevel.html b/Documentation/doc/4 enums/Util.LogLevel.html index e460b478b..17187a588 100644 --- a/Documentation/doc/4 enums/Util.LogLevel.html +++ b/Documentation/doc/4 enums/Util.LogLevel.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/View.AlignMode.html b/Documentation/doc/4 enums/View.AlignMode.html index c1f559c82..03e0c821d 100644 --- a/Documentation/doc/4 enums/View.AlignMode.html +++ b/Documentation/doc/4 enums/View.AlignMode.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/View.CameraType.html b/Documentation/doc/4 enums/View.CameraType.html index a6a4f12ba..43a092345 100644 --- a/Documentation/doc/4 enums/View.CameraType.html +++ b/Documentation/doc/4 enums/View.CameraType.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/View.PostProcessMode.html b/Documentation/doc/4 enums/View.PostProcessMode.html index 83657e992..ba5d9076f 100644 --- a/Documentation/doc/4 enums/View.PostProcessMode.html +++ b/Documentation/doc/4 enums/View.PostProcessMode.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/4 enums/View.ScaleMode.html b/Documentation/doc/4 enums/View.ScaleMode.html index 3ced09b6a..c2fed2a54 100644 --- a/Documentation/doc/4 enums/View.ScaleMode.html +++ b/Documentation/doc/4 enums/View.ScaleMode.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/5 lua utility modules/CustomBar.html b/Documentation/doc/5 lua utility modules/CustomBar.html index 293044e74..d809f3d8e 100644 --- a/Documentation/doc/5 lua utility modules/CustomBar.html +++ b/Documentation/doc/5 lua utility modules/CustomBar.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/5 lua utility modules/Diary.html b/Documentation/doc/5 lua utility modules/Diary.html index 3a0a4c6d5..ff4412fa6 100644 --- a/Documentation/doc/5 lua utility modules/Diary.html +++ b/Documentation/doc/5 lua utility modules/Diary.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/5 lua utility modules/EventSequence.html b/Documentation/doc/5 lua utility modules/EventSequence.html index 21199ec26..8b1aeeff6 100644 --- a/Documentation/doc/5 lua utility modules/EventSequence.html +++ b/Documentation/doc/5 lua utility modules/EventSequence.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/5 lua utility modules/Timer.html b/Documentation/doc/5 lua utility modules/Timer.html index 263709641..a8ac29923 100644 --- a/Documentation/doc/5 lua utility modules/Timer.html +++ b/Documentation/doc/5 lua utility modules/Timer.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/5 lua utility modules/Type.html b/Documentation/doc/5 lua utility modules/Type.html index ab0d9dcff..acadc9fc1 100644 --- a/Documentation/doc/5 lua utility modules/Type.html +++ b/Documentation/doc/5 lua utility modules/Type.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • diff --git a/Documentation/doc/index.html b/Documentation/doc/index.html index 1d5a3c407..dab35622b 100644 --- a/Documentation/doc/index.html +++ b/Documentation/doc/index.html @@ -3,7 +3,7 @@ - TombEngine 1.7.2 (Developer) Lua API + TombEngine 1.8 Lua API @@ -68,7 +68,7 @@
  • Flow.InventoryItem
  • Flow.LensFlare
  • Flow.SkyLayer
  • -
  • Flow.Starfield
  • +
  • Flow.StarField
  • Color
  • Rotation
  • Time
  • @@ -115,25 +115,25 @@
    -

    TombEngine 1.7.2 (Developer) scripting interface

    -

    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.

    +

    TombEngine 1.8 scripting interface

    +

    Welcome to the TombEngine scripting API.

    -

    At the time of writing, there is a tutorial describing the basics of Lua, as well as a number of example scripts, on the TombEngine website.

    -

    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. +

    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 TombEngine website.

    + +

    Module Hierarchy

    +

    Other than the "special tables" (GameVars, LevelVars and LevelFuncs), every module described herein is held in a master table called TEN. For convenience, these modules and classes are automatically put in the global table. For example, you can call GetMoveableByName either of these two ways:

    local door = TEN.Objects.GetMoveableByName("door_type4_14")
     local door = GetMoveableByName("door_type4_14")
     

    Always check logs/TENLog.txt

    -

    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.

    +

    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.

    +

    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. If this happens, check logs/TENLog.txt and look for an error message with the word "unrecoverable".

    -

    If this happens, check logs/TENLog.txt and look for an error message with the word "unrecoverable".

    - -

    Enjoy.

    +

    Happy building!

    - squidshire and the TombEngine development team.

    @@ -247,7 +247,7 @@ local door = GetMoveableByName("door_type4_14") - + @@ -266,8 +266,8 @@ local door = GetMoveableByName("door_type4_14") - - + + diff --git a/TombEngine/Game/effects/weather.cpp b/TombEngine/Game/effects/weather.cpp index 472e76fe0..34a235054 100644 --- a/TombEngine/Game/effects/weather.cpp +++ b/TombEngine/Game/effects/weather.cpp @@ -232,52 +232,65 @@ namespace TEN::Effects::Environment void EnvironmentController::UpdateStarfield(const ScriptInterfaceLevel& level) { - if (!level.GetStarfieldStarsEnabled()) + int starCount = level.GetStarfieldStarCount(); + if (starCount == 0) return; if (ResetStarField) { - int starCount = level.GetStarfieldStarCount(); - Stars.clear(); - Stars.reserve(starCount); + ResetStarField = false; + } - for (int i = 0; i < starCount; i++) + if (starCount != Stars.size()) + { + // If starCount increased, add new stars to existing list. + if (starCount > Stars.size()) { - auto starDir = Random::GenerateDirectionInCone(-Vector3::UnitY, 70.0f); - starDir.Normalize(); + // Reserve space for new stars if necessary. + Stars.reserve(starCount); - auto star = StarParticle{}; - star.Direction = starDir; - star.Color = Vector3( - Random::GenerateFloat(0.6f, 1.0f), - Random::GenerateFloat(0.6f, 1.0f), - Random::GenerateFloat(0.6f, 1.0f)); - star.Scale = Random::GenerateFloat(0.5f, 1.5f); - - float cosine = Vector3::UnitY.Dot(starDir); - float maxCosine = cos(DEG_TO_RAD(50.0f)); - float minCosine = cos(DEG_TO_RAD(70.0f)); - - if (cosine >= minCosine && cosine <= maxCosine) + for (int i = (int)Stars.size(); i < starCount; i++) { - star.Extinction = (cosine - minCosine) / (maxCosine - minCosine); - } - else - { - star.Extinction = 1.0f; - } + auto starDir = Random::GenerateDirectionInCone(-Vector3::UnitY, 70.0f); + starDir.Normalize(); - Stars.push_back(star); + auto star = StarParticle{}; + star.Direction = starDir; + star.Color = Vector3( + Random::GenerateFloat(0.6f, 1.0f), + Random::GenerateFloat(0.6f, 1.0f), + Random::GenerateFloat(0.6f, 1.0f)); + star.Scale = Random::GenerateFloat(0.5f, 1.5f); + + float cosine = Vector3::UnitY.Dot(starDir); + float maxCosine = cos(DEG_TO_RAD(50.0f)); + float minCosine = cos(DEG_TO_RAD(70.0f)); + + if (cosine >= minCosine && cosine <= maxCosine) + { + star.Extinction = (cosine - minCosine) / (maxCosine - minCosine); + } + else + { + star.Extinction = 1.0f; + } + + Stars.push_back(star); + } + } + // If starCount decreased, resize vector without reinitializing. + else + { + Stars.resize(starCount); } - ResetStarField = false; } for (auto& star : Stars) star.Blinking = Random::GenerateFloat(0.5f, 1.0f); - if (level.GetStarfieldMeteorsEnabled()) + if (level.GetStarfieldMeteorCount() > 0) { for (auto& meteor : Meteors) { @@ -639,7 +652,7 @@ namespace TEN::Effects::Environment Meteors.end()); } - if (!level.GetStarfieldMeteorsEnabled()) + if (level.GetStarfieldMeteorCount() == 0) return; int density = level.GetStarfieldMeteorSpawnDensity(); diff --git a/TombEngine/Scripting/Include/ScriptInterfaceLevel.h b/TombEngine/Scripting/Include/ScriptInterfaceLevel.h index 0bef47771..e091044b0 100644 --- a/TombEngine/Scripting/Include/ScriptInterfaceLevel.h +++ b/TombEngine/Scripting/Include/ScriptInterfaceLevel.h @@ -62,8 +62,6 @@ public: virtual Color GetLensFlareColor() const = 0; // Starfield getters - virtual bool GetStarfieldStarsEnabled() const = 0; - virtual bool GetStarfieldMeteorsEnabled() const = 0; virtual int GetStarfieldStarCount() const = 0; virtual int GetStarfieldMeteorCount() const = 0; virtual int GetStarfieldMeteorSpawnDensity() const = 0; diff --git a/TombEngine/Scripting/Internal/ReservedScriptNames.h b/TombEngine/Scripting/Internal/ReservedScriptNames.h index 7db33a007..c3307b918 100644 --- a/TombEngine/Scripting/Internal/ReservedScriptNames.h +++ b/TombEngine/Scripting/Internal/ReservedScriptNames.h @@ -433,25 +433,6 @@ constexpr char ScriptReserved_ProbePreview[] = "Preview"; constexpr char ScriptReserved_MaterialType[] = "MaterialType"; -// ==== -// FLOW -// ==== - -// Horizon - -constexpr char ScriptReserved_Horizon[] = "Horizon"; -constexpr char ScriptReserved_HorizonGetEnabled[] = "GetEnabled"; -constexpr char ScriptReserved_HorizonGetObjectID[] = "GetObjectID"; -constexpr char ScriptReserved_HorizonGetPosition[] = "GetPosition"; -constexpr char ScriptReserved_HorizonGetRotation[] = "GetRotation"; -constexpr char ScriptReserved_HorizonGetTransparency[] = "GetTransparency"; -constexpr char ScriptReserved_HorizonSetEnabled[] = "SetEnabled"; -constexpr char ScriptReserved_HorizonSetObjectID[] = "SetObjectID"; -constexpr char ScriptReserved_HorizonSetPosition[] = "SetPosition"; -constexpr char ScriptReserved_HorizonSetRotation[] = "SetRotation"; -constexpr char ScriptReserved_HorizonSetTransparency[] = "SetTransparency"; - - // ======= // OBJECTS // ======= diff --git a/TombEngine/Scripting/Internal/TEN/Effects/ParticleAnimTypes.h b/TombEngine/Scripting/Internal/TEN/Effects/ParticleAnimTypes.h index d992641fa..1adae829e 100644 --- a/TombEngine/Scripting/Internal/TEN/Effects/ParticleAnimTypes.h +++ b/TombEngine/Scripting/Internal/TEN/Effects/ParticleAnimTypes.h @@ -4,7 +4,7 @@ namespace TEN::Scripting::Effects { - /// Constants for particle animation type constants. + /// Constants for particle animation type constants. To be used with @{Effects.EmitAdvancedParticle} function. // @enum Effects.ParticleAnimationType // @pragma nostrip diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.cpp index ffc6032f9..bb7612114 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.cpp @@ -6,7 +6,7 @@ using namespace TEN::Scripting::Types; /*** -Distance fog. +Represesnts distance fog. To be used with @{Flow.Level.fog} property. @tenprimitive Flow.Fog @pragma nostrip diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Horizon/Horizon.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Horizon/Horizon.cpp index 52f24820d..1d4ef80a4 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/Horizon/Horizon.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Horizon/Horizon.cpp @@ -9,7 +9,7 @@ namespace TEN::Scripting { - /// Represents a horizon. + /// Represents a horizon. To be used with @{Flow.Level.horizon1} and @{Flow.Level.horizon2} properties. // // @tenprimitive Flow.Horizon // @pragma nostrip @@ -22,22 +22,32 @@ namespace TEN::Scripting // Register type. parent.new_usertype( - ScriptReserved_Horizon, + "Horizon", ctors(), sol::call_constructor, ctors(), - // Getters - ScriptReserved_HorizonGetEnabled, &Horizon::GetEnabled, - ScriptReserved_HorizonGetObjectID, &Horizon::GetObjectID, - ScriptReserved_HorizonGetPosition, &Horizon::GetPosition, - ScriptReserved_HorizonGetRotation, &Horizon::GetRotation, - ScriptReserved_HorizonGetTransparency, &Horizon::GetTransparency, + /// (bool) Horizon enabled state. + // If set to true, horizon will be visible. + // @mem enabled + "enabled", sol::property(&Horizon::GetEnabled, &Horizon::SetEnabled), - // Setters - ScriptReserved_HorizonSetEnabled, &Horizon::SetEnabled, - ScriptReserved_HorizonSetObjectID, &Horizon::SetObjectID, - ScriptReserved_HorizonSetPosition, &Horizon::SetPosition, - ScriptReserved_HorizonSetRotation, &Horizon::SetRotation, - ScriptReserved_HorizonSetTransparency, &Horizon::SetTransparency); + /// (Objects.ObjID) Horizon object ID. + // @mem objectID + "objectID", sol::property(&Horizon::GetObjectID, &Horizon::SetObjectID), + + /// (Vec3) Horizon position. + // Specifies an offset from the camera origin. + // @mem position + "position", sol::property(&Horizon::GetPosition, &Horizon::SetPosition), + + /// (Rotation) Horizon rotation. + // Specifies horizon rotation. + // @mem rotation + "rotation", sol::property(&Horizon::GetRotation, &Horizon::SetRotation), + + /// (float) Horizon transparency. + // Specifies horizon transparency on a range from 0 to 1. + // @mem transparency + "transparency", sol::property(&Horizon::GetTransparency, &Horizon::SetTransparency)); } /// Create a horizon object. @@ -56,89 +66,53 @@ namespace TEN::Scripting _enabled = enabled; } - /// Get the horizon's enabled state. - // @function GetEnabled - // @treturn bool Enabled state. bool Horizon::GetEnabled() const { return _enabled; } - /// Get the horizon's slot object ID. - // @function GetObjectID - // @treturn Objects.ObjID Object ID. GAME_OBJECT_ID Horizon::GetObjectID() const { return _objectID; } - /// Get the horizon's world position. - // @function GetPosition - // @treturn Vec3 Position. const Vec3 Horizon::GetPosition() const { return _position; } - /// Get the horizon's rotation. - // @function GetRotation - // @treturn Rotation Rotation. const Rotation Horizon::GetRotation() const { return _rotation; } - /// Get the horizon's transparency. - // @function GetTransparency - // @treturn float Transparency. const float Horizon::GetTransparency() const { return _transparency; } - /// Set the horizon's enabled state. - // @function SetEnabled - // @tparam bool enabled New enabled state. void Horizon::SetEnabled(bool value) { _enabled = value; } - /// Set the horizon's object ID. - // @function SetObjectID - // @tparam Objects.ObjID objectID Object ID. void Horizon::SetObjectID(GAME_OBJECT_ID objectID) { _objectID = objectID; } - /// Set the horizon's world position. - // @function SetPosition - // @tparam Vec3 pos New world position. - // @tparam[opt] bool noInterpolation Disable interpolation with the previous frame's position. __default: false__ void Horizon::SetPosition(const Vec3& pos, TypeOrNil noInterpolation) { - bool convertedDisableInterp = ValueOr(noInterpolation, false); - - _prevPosition = convertedDisableInterp ? pos : _position; + _prevPosition = ValueOr(noInterpolation, false) ? pos : _position; _position = pos; } - /// Set the horizon's rotation. - // @function SetRotation - // @tparam Rotation rot New rotation. - // @tparam[opt] bool noInterpolation Disable interpolation with the previous frame's rotation. __default: false__ void Horizon::SetRotation(const Rotation& rot, TypeOrNil noInterpolation) { - bool convertedDisableInterp = ValueOr(noInterpolation, false); - - _prevRotation = convertedDisableInterp ? rot : _rotation; + _prevRotation = ValueOr(noInterpolation, false) ? rot : _rotation; _rotation = rot; } - /// Set the horizon's transparency. - // @function SetTransparency - // @tparam float transparency New transparency alpha. void Horizon::SetTransparency(float value) { _transparency = value; diff --git a/TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.cpp b/TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.cpp index 5037763ca..9d229fb41 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.cpp @@ -4,9 +4,7 @@ #include "Scripting/Internal/ReservedScriptNames.h" #include "Scripting/Internal/ScriptAssert.h" -/*** -Represents the properties of an object as it appears in the inventory. - +/*** Represents the properties of an object as it appears in the inventory. To be used in @{Flow.Level.objects} list. @tenprimitive Flow.InventoryItem @pragma nostrip */ diff --git a/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.cpp b/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.cpp index 30e0718a0..2db27d8db 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.cpp @@ -8,7 +8,7 @@ using namespace TEN::Scripting::Types; -/// Represents a global lens flare (not to be confused with the lens flare object). +/// Represents a global lens flare (not to be confused with the lens flare object). To be used with @{Flow.Level.lensFlare} property. // // @tenprimitive Flow.LensFlare // @pragma nostrip @@ -25,16 +25,39 @@ namespace TEN::Scripting "LensFlare", ctors(), sol::call_constructor, ctors(), + /// (bool) Lens flare enabled state. + // If set to true, lens flare will be visible. + // @mem enabled + "enabled", sol::property(&LensFlare::GetEnabled, &LensFlare::SetEnabled), + + /// (int) Lens flare's sun sprite object ID. + // @mem spriteID + "spriteID", sol::property(&LensFlare::GetSunSpriteID, &LensFlare::SetSunSpriteID), + + /// (float) Lens flare's pitch (vertical) angle in degrees. + // @mem pitch + "pitch", sol::property(&LensFlare::GetPitch, &LensFlare::SetPitch), + + /// (float) Lens flare's yaw (horizontal) angle in degrees. + // @mem yaw + "yaw", sol::property(&LensFlare::GetYaw, &LensFlare::SetYaw), + + /// (Color) Lens flare's color. + // @mem color + "color", sol::property(&LensFlare::GetColor, &LensFlare::SetColor), + + // Compatibility. "GetSunSpriteID", &LensFlare::GetSunSpriteID, "GetPitch", &LensFlare::GetPitch, "GetYaw", &LensFlare::GetYaw, "GetColor", &LensFlare::GetColor, - "GetEnabled", &LensFlare::GetEnabledStatus, + "GetEnabled", &LensFlare::GetEnabled, "SetSunSpriteID", &LensFlare::SetSunSpriteID, "SetPitch", &LensFlare::SetPitch, "SetYaw", &LensFlare::SetYaw, - "SetColor", &LensFlare::SetColor); + "SetColor", &LensFlare::SetColor, + "SetEnabled", &LensFlare::SetEnabled); } /// Create a LensFlare object. @@ -50,48 +73,31 @@ namespace TEN::Scripting _rotation = Rotation(pitch, yaw, 0.0f); } - /// Get this lens flare's sun sprite ID. - // @function LensFlare:GetSunSpriteID - // @treturn int Sprite ID. int LensFlare::GetSunSpriteID() const { return _sunSpriteID; } - /// Get this lens flare's pitch angle in degrees. - // @function LensFlare:GetPitch - // @treturn float Pitch angle in degrees. float LensFlare::GetPitch() const { return _rotation.x; } - /// Get this lens flare's yaw angle in degrees. - // @function LensFlare:GetYaw - // @treturn float Yaw angle in degrees. float LensFlare::GetYaw() const { return _rotation.y; } - /// Get the lens flare's color. - // @function LensFlare:GetColor ScriptColor LensFlare::GetColor() const { return _color; } - /// Get this lens flare's enabled status. - // @function LensFlare:GetEnabled - // @treturn bool Enabled status. __true: enabled__, __false: disabled__ - bool LensFlare::GetEnabledStatus() const + bool LensFlare::GetEnabled() const { return _isEnabled; } - /// Set this lens flare's sun sprite ID. - // @function LensFlare:SetSunSpriteID - // @tparam int spriteID New sun sprite ID. void LensFlare::SetSunSpriteID(int spriteID) { // Sprite ID out of range; return early. @@ -104,27 +110,23 @@ namespace TEN::Scripting _sunSpriteID = spriteID; } - /// Set this lens flare's pitch angle. - // @function LensFlare:SetPitch - // @tparam float pitch New pitch angle in degrees. void LensFlare::SetPitch(float pitch) { _rotation.x = pitch; } - /// Set this lens flare's yaw angle. - // @function LensFlare:SetYaw - // @tparam float yaw New yaw angle in degrees. void LensFlare::SetYaw(float yaw) { _rotation.y = yaw; } - - /// Set this lens flare's color. - // @function LensFlare:SetColor - // @tparam Color color New color. + void LensFlare::SetColor(const ScriptColor& color) { _color = color; } + + void LensFlare::SetEnabled(bool value) + { + _isEnabled = value; + } } diff --git a/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.h b/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.h index d1585ac5d..bbf2f1cff 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.h +++ b/TombEngine/Scripting/Internal/TEN/Flow/LensFlare/LensFlare.h @@ -39,7 +39,7 @@ namespace TEN::Scripting float GetPitch() const; float GetYaw() const; ScriptColor GetColor() const; - bool GetEnabledStatus() const; + bool GetEnabled() const; // Setters @@ -47,5 +47,6 @@ namespace TEN::Scripting void SetPitch(float pitch); void SetYaw(float yaw); void SetColor(const ScriptColor& color); + void SetEnabled(bool value); }; } diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.cpp index 837b6af77..410311789 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.cpp @@ -15,7 +15,7 @@ These are things things which aren't present in the compiled level file itself. /// Make a new Level object. //@function Level -//@treturn Level a Level object +//@treturn Level a Level object. void Level::Register(sol::table& parent) { // Register type. @@ -49,11 +49,11 @@ void Level::Register(sol::table& parent) //@mem ambientTrack "ambientTrack", &Level::AmbientTrack, -/// (@{Flow.SkyLayer}) Primary sky layer +/// (@{Flow.SkyLayer}) Primary sky cloud layer. //@mem layer1 "layer1", &Level::Layer1, -/// (@{Flow.SkyLayer}) Secondary sky layer +/// (@{Flow.SkyLayer}) Secondary sky cloud layer. //@mem layer2 "layer2", &Level::Layer2, @@ -63,20 +63,20 @@ void Level::Register(sol::table& parent) "horizon", sol::property(&Level::GetHorizon1Enabled, &Level::SetHorizon1Enabled), // Compatibility. /// (@{Flow.Horizon}) Second horizon layer. -//@mem horizon1 +//@mem horizon2 "horizon2", &Level::Horizon2, -/// (@{Flow.Starfield}) Starfield. -// @mem starfield - "starfield", &Level::Starfield, +/// (@{Flow.StarField}) Starfield in the sky. +// @mem starField + "starField", &Level::Starfield, + "starfield", &Level::Starfield, // Compatibility. -/// (@{Flow.LensFlare}) Global lens flare . +/// (@{Flow.LensFlare}) Global lens flare. // @mem lensFlare "lensFlare", &Level::LensFlare, -/// (@{Flow.Fog}) omni fog RGB color and distance. -// As seen in TR4's Desert Railroad. -// If not provided, distance fog will be black. +/// (@{Flow.Fog}) Global distance fog, with specified RGB color and distance. +// If not provided, distance fog will not be visible. //@mem fog "fog", &Level::Fog, @@ -126,11 +126,11 @@ e.g. `myLevel.laraType = LaraType.Divesuit` //@mem resetHub "resetHub", &Level::ResetHub, -/// (table of @{Flow.InventoryItem}s) table of inventory object overrides +/// (table of @{Flow.InventoryItem}s) A table of inventory object layout overrides. //@mem objects "objects", &Level::InventoryObjects, -/// (short) Set Secrets for Level +/// (short) Set total secret count for current level. //@mem secrets "secrets", sol::property(&Level::GetSecrets, &Level::SetSecrets) ); @@ -308,7 +308,7 @@ EulerAngles Level::GetHorizonPrevOrientation(int index) const bool Level::GetLensFlareEnabled() const { - return LensFlare.GetEnabledStatus(); + return LensFlare.GetEnabled(); } int Level::GetLensFlareSunSpriteID() const @@ -331,16 +331,6 @@ Color Level::GetLensFlareColor() const return LensFlare.GetColor(); } -bool Level::GetStarfieldStarsEnabled() const -{ - return Starfield.GetStarsEnabledStatus(); -} - -bool Level::GetStarfieldMeteorsEnabled() const -{ - return Starfield.GetMeteorsEnabledStatus(); -} - int Level::GetStarfieldStarCount() const { return Starfield.GetStarCount(); diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.h b/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.h index d9b46a253..4abfd5c23 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.h +++ b/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.h @@ -93,8 +93,6 @@ struct Level : public ScriptInterfaceLevel Color GetLensFlareColor() const override; // Starfield getters - bool GetStarfieldStarsEnabled() const override; - bool GetStarfieldMeteorsEnabled() const override; int GetStarfieldStarCount() const override; int GetStarfieldMeteorCount() const override; int GetStarfieldMeteorSpawnDensity() const override; diff --git a/TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.cpp b/TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.cpp index 027572219..33bf45fa1 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.cpp @@ -7,9 +7,7 @@ namespace TEN::Scripting::Types { class ScriptColor; } using namespace TEN::Scripting::Types; -/*** Describes a layer of moving clouds. -As seen in TR4's City of the Dead. - +/*** Describes a layer of moving clouds. To be used with @{Flow.Level.layer1} and @{Flow.Level.layer2} properties. @tenprimitive Flow.SkyLayer @pragma nostrip */ diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.cpp index 5502b8d59..35c857b47 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.cpp @@ -6,9 +6,8 @@ using namespace TEN::Effects::Environment; -/// Represents a starfield in the sky. -// -// @tenprimitive Flow.Starfield +/// Represents a star field in the sky. To be used with @{Flow.Level.starField} property. +// @tenprimitive Flow.StarField // @pragma nostrip namespace TEN::Scripting @@ -21,38 +20,55 @@ namespace TEN::Scripting // Register type. parent.new_usertype( - "Starfield", + "StarField", ctors(), sol::call_constructor, ctors(), + /// (int) Amount of visible stars. + // @mem starCount + "starCount", sol::property(&Starfield::GetStarCount, &Starfield::SetStarCount), + + /// (int) Amount of visible meteors. + // @mem meteorCount + "meteorCount", sol::property(&Starfield::GetMeteorCount, &Starfield::SetMeteorCount), + + /// (int) Meteor spawn density. + // @mem meteorSpawnDensity + "meteorSpawnDensity", sol::property(&Starfield::GetMeteorSpawnDensity, &Starfield::SetMeteorSpawnDensity), + + /// (int) Meteor velocity. + // @mem meteorVelocity + "meteorVelocity", sol::property(&Starfield::GetMeteorVelocity, &Starfield::SetMeteorVelocity), + + // Compatibility. "GetStarCount", &Starfield::GetStarCount, "GetMeteorCount", &Starfield::GetMeteorCount, "GetMeteorSpawnDensity", &Starfield::GetMeteorSpawnDensity, "GetMeteorVelocity", &Starfield::GetMeteorVelocity, - "GetStarsEnabled", &Starfield::GetStarsEnabledStatus, - "GetMeteorsEnabled", &Starfield::GetMeteorsEnabledStatus, "SetStarCount", &Starfield::SetStarCount, "SetMeteorCount", &Starfield::SetMeteorCount, "SetMeteorSpawnDensity", &Starfield::SetMeteorSpawnDensity, "SetMeteorVelocity", &Starfield::SetMeteorVelocity); + + parent["StarField"] = parent["Starfield"]; } /// Create a starfield object with only stars. - // @function Starfield + // @function StarField // @tparam int starCount Star count. - // @treturn Starfield A new Starfield object. + // @treturn Starfield A new StarField object. Starfield::Starfield(int starCount) { _starCount = starCount; } /// Create a starfield object with stars and meteors. - // @function Starfield + // @function StarField // @tparam int starCount Star count. __Max: 6000__ // @tparam int meteorCount Meteor count. __Max: 100__ // @tparam int meteorSpawnDensity Meteor spawn density. // @tparam int meteorVel Meteor velocity. - // @treturn Starfield A new Starfield object. + // @treturn StarField A new StarField object. Starfield::Starfield(int starCount, int meteorCount, int meteorSpawnDensity, float meteorVel) { if (starCount < 0 || starCount > STAR_COUNT_MAX) @@ -67,57 +83,26 @@ namespace TEN::Scripting _meteorVelocity = meteorVel; } - /// Get this starfield's number of stars. - // @function Starfield:GetStarCount - // @treturn int Count. int Starfield::GetStarCount() const { return _starCount; } - /// Get this starfield's number of meteors. - // @function Starfield:GetMeteorCount - // @treturn int Count. int Starfield::GetMeteorCount() const { return _meteorCount; } - /// Get this starfield's meteor spawn density. - // @function Starfield:GetMeteorSpawnDensity - // @treturn int Spawn density. int Starfield::GetMeteorSpawnDensity() const { return _meteorSpawnDensity; } - /// Get this starfield's meteor velocity. - // @function Starfield:GetMeteorVelocity - // @treturn float Velocity. float Starfield::GetMeteorVelocity() const { return _meteorVelocity; } - /// Get this starfield's stars enabled status. - // @function Starfield:GetStarsEnabled - // @treturn bool Stars enabled status. __true: enabled__, __false: disabled__ - bool Starfield::GetStarsEnabledStatus() const - { - return (_starCount > 0); - } - - /// Get this starfield's meteors enabled status. - // @function Starfield:GetMeteorsEnabled - // @treturn bool Meteors enabled status. __true: enabled__, __false: disabled__ - bool Starfield::GetMeteorsEnabledStatus() const - { - return (_meteorCount > 0); - } - - /// Set this starfield's number of stars. - // @function Starfield:SetStarCount - // @tparam int count New star count. void Starfield::SetStarCount(int count) { if (count < 0 || count > STAR_COUNT_MAX) @@ -126,9 +111,6 @@ namespace TEN::Scripting _starCount = std::clamp(count, 0, STAR_COUNT_MAX); } - /// Set this starfield's number of meteors. - // @function Starfield:SetMeteorCount - // @tparam int count New meteor count. void Starfield::SetMeteorCount(int count) { if (count < 0 || count > METEOR_COUNT_MAX) @@ -137,17 +119,11 @@ namespace TEN::Scripting _meteorCount = std::clamp(count, 0, METEOR_COUNT_MAX); } - /// Set this starfield's meteor spawn density. - // @function Starfield:SetMeteorSpawnDensity - // @tparam int density New meteor spawn density. void Starfield::SetMeteorSpawnDensity(int spawnDensity) { _meteorSpawnDensity = spawnDensity; } - /// Set this starfield's meteor velocity. - // @function Starfield:SetMeteorVelocity - // @tparam float velocity New meteor velocity. void Starfield::SetMeteorVelocity(float vel) { _meteorVelocity = vel; diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.h b/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.h index 4f7045b8c..7e918e996 100644 --- a/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.h +++ b/TombEngine/Scripting/Internal/TEN/Flow/Starfield/Starfield.h @@ -35,8 +35,6 @@ namespace TEN::Scripting int GetMeteorCount() const; int GetMeteorSpawnDensity() const; float GetMeteorVelocity() const; - bool GetStarsEnabledStatus() const; - bool GetMeteorsEnabledStatus() const; // Setters diff --git a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp index 70f2ca4aa..30fd28657 100644 --- a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp @@ -30,7 +30,7 @@ using namespace TEN::Scripting::Types; // Examples include the player, traps, enemies, doors, and pickups. See also @{Objects.LaraObject} for player-specific features. // // @tenclass Objects.Moveable -// pragma nostrip +// @pragma nostrip static auto IndexError = IndexErrorMaker(Moveable, ScriptReserved_Moveable); static auto NewIndexError = NewIndexErrorMaker(Moveable, ScriptReserved_Moveable); diff --git a/TombEngine/Scripting/Internal/TEN/Objects/Room/RoomObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Room/RoomObject.cpp index dfd348284..1dc91890a 100644 --- a/TombEngine/Scripting/Internal/TEN/Objects/Room/RoomObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/Room/RoomObject.cpp @@ -51,7 +51,7 @@ using namespace TEN::Scripting::Types; } /// Get the room's number. - // @function Room:GetRoomNumber() + // @function Room:GetRoomNumber // @treturn int Room number. int Room::GetRoomNumber() const { @@ -59,7 +59,7 @@ using namespace TEN::Scripting::Types; } /// Get the room's unique string identifier. - // @function Room:GetName() + // @function Room:GetName // @treturn string Room name. std::string Room::GetName() const { @@ -67,7 +67,7 @@ using namespace TEN::Scripting::Types; } /// Get the room's ambient light color. - // @function Room:GetColor() + // @function Room:GetColor // @treturn Color Ambient light color. ScriptColor Room::GetColor() const { @@ -75,7 +75,7 @@ using namespace TEN::Scripting::Types; } /// Get the room's reverb type. - // @function Room:GetReverbType() + // @function Room:GetReverbType // @treturn Objects.RoomReverb Reverb type. ReverbType Room::GetReverbType() const { @@ -83,7 +83,7 @@ using namespace TEN::Scripting::Types; } /// Set the room's unique string identifier. - // @function Room:SetName() + // @function Room:SetName // @tparam string name New name. void Room::SetName(const std::string& name) { @@ -104,7 +104,7 @@ using namespace TEN::Scripting::Types; } /// Set the room's reverb type. - // @function Room:SetReverbType() + // @function Room:SetReverbType // @tparam Objects.RoomReverb Reverb type. void Room::SetReverbType(ReverbType reverb) { @@ -112,7 +112,7 @@ using namespace TEN::Scripting::Types; } /// Set the room's specified flag. - // @function Room:SetFlag() + // @function Room:SetFlag // @tparam Objects.RoomFlagID flagID Room flag ID. // @tparam bool Boolean to set the flag to. void Room::SetFlag(RoomEnvFlags flag, bool value) @@ -128,7 +128,7 @@ using namespace TEN::Scripting::Types; } /// Get the room's specified flag value (true or false). - // @function Room:GetFlag() + // @function Room:GetFlag // @tparam Objects.RoomFlagID flagID Room flag ID. bool Room::IsTagPresent(const std::string& tag) const { @@ -144,7 +144,7 @@ using namespace TEN::Scripting::Types; } /// Check if the specified tag is set for the room. - // @function Room:IsTagPresent() + // @function Room:IsTagPresent // @tparam string tag Text tag to check (case sensitive). // @treturn bool Boolean of the tag's presence. bool Room::GetActive() const @@ -153,7 +153,7 @@ using namespace TEN::Scripting::Types; } /// Check if the room is active. - // @function Room:GetActive() + // @function Room:GetActive // @treturn bool Boolean of the room's active status. bool Room::GetFlag(RoomEnvFlags flag) const { diff --git a/TombEngine/Scripting/Internal/TEN/Sound/SoundHandler.cpp b/TombEngine/Scripting/Internal/TEN/Sound/SoundHandler.cpp index 713b7f2d5..73522ae03 100644 --- a/TombEngine/Scripting/Internal/TEN/Sound/SoundHandler.cpp +++ b/TombEngine/Scripting/Internal/TEN/Sound/SoundHandler.cpp @@ -14,90 +14,90 @@ namespace TEN::Scripting::Sound { - /// Play an audio track - //@function PlayAudioTrack - //@tparam string name of track (without file extension) to play - //@tparam Sound.SoundTrackType type of the audio track to play + /// Play an audio track. Supported formats are wav, mp3 and ogg. + // @function PlayAudioTrack + // @tparam string filename Filename of a track (without file extension) to play. + // @tparam Sound.SoundTrackType type Type of the audio track to play. static void PlayAudioTrack(const std::string& trackName, TypeOrNil mode) { auto playMode = ValueOr(mode, SoundTrackType::OneShot); PlaySoundTrack(trackName, playMode); } - /// Set and play an ambient track + /// Set and play an ambient track. // @function SetAmbientTrack - // @tparam string name of track (without file extension) to play - // @tparam bool fromStart specifies whether ambient track should play from the start, or crossfade at a random position + // @tparam string name Name of track (without file extension) to play. + // @tparam bool fromStart Specifies whether ambient track should play from the start, or crossfade at a random position. static void SetAmbientTrack(const std::string& trackName, TypeOrNil fromTheBeginning) { auto pos = ValueOr(fromTheBeginning, false) ? std::optional(0) : std::optional(); PlaySoundTrack(trackName, SoundTrackType::BGM, pos, pos.has_value() ? SOUND_XFADETIME_ONESHOT : SOUND_XFADETIME_BGM); } - ///Stop any audio tracks currently playing - //@function StopAudioTracks + /// Stop any audio tracks currently playing. + // @function StopAudioTracks static void StopAudioTracks() { StopSoundTracks(); } - ///Stop audio track that is currently playing - //@function StopAudioTrack - //@tparam Sound.SoundTrackType type of the audio track + /// Stop audio track that is currently playing. + // @function StopAudioTrack + // @tparam Sound.SoundTrackType type Type of the audio track. static void StopAudioTrack(TypeOrNil mode) { auto playMode = ValueOr(mode, SoundTrackType::OneShot); StopSoundTrack(playMode, SOUND_XFADETIME_ONESHOT); } - ///Get current loudness level for specified track type - //@function GetAudioTrackLoudness - //@tparam Sound.SoundTrackType type of the audio track - //@treturn float current loudness of a specified audio track + /// Get current loudness level for specified track type. + // @function GetAudioTrackLoudness + // @tparam Sound.SoundTrackType type Type of the audio track. + // @treturn float Current loudness of a specified audio track. static float GetAudioTrackLoudness(TypeOrNil mode) { auto playMode = ValueOr(mode, SoundTrackType::OneShot); return GetSoundTrackLoudness(playMode); } - /// Play sound effect - //@function PlaySound - //@tparam int sound ID to play. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window. - ////@tparam[opt] Vec3 position The 3D position of the sound, i.e. where the sound "comes from". If not given, the sound will not be positional. + /// Play sound effect. + // @function PlaySound + // @tparam int soundID Sound ID to play. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window. + // @tparam[opt] Vec3 position The 3D position of the sound, i.e. where the sound "comes from". If not given, the sound will not be positional. static void PlaySoundEffect(int soundID, sol::optional pos) { SoundEffect(soundID, pos.has_value() ? &Pose(pos->ToVector3i()) : nullptr, SoundEnvironment::Always); } - /// Stop sound effect - //@function StopSound - //@tparam int sound ID to play. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window. + /// Stop sound effect. + // @function StopSound + // @tparam int soundID Sound ID to play. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window. static void StopSound(int id) { StopSoundEffect(id); } - /// Check if the sound effect is playing - //@function IsSoundPlaying - //@tparam int Sound ID to check. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window. + /// Check if the sound effect is playing. + // @function IsSoundPlaying + // @tparam int soundID Sound ID to check. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window. static bool IsSoundPlaying(int effectID) { return (Sound_EffectIsPlaying(effectID, nullptr) != SOUND_NO_CHANNEL); } - /// Check if the audio track is playing - //@function IsAudioTrackPlaying - //@tparam string Track filename to check. Should be without extension and without full directory path. + /// Check if the audio track is playing. + // @function IsAudioTrackPlaying + // @tparam string Track Filename to check. Should be without extension and without full directory path. static bool IsAudioTrackPlaying(const std::string& trackName) { return Sound_TrackIsPlaying(trackName); } - ///Get current subtitle string for a voice track currently playing. - //Subtitle file must be in .srt format, have same filename as voice track, and be placed in same directory as voice track. - //Returns nil if no voice track is playing or no subtitle present. - //@function GetCurrentSubtitle - //@treturn string current subtitle string + /// Get current subtitle string for a voice track currently playing. + // Subtitle file must be in .srt format, have same filename as voice track, and be placed in same directory as voice track. + // Returns nil if no voice track is playing or no subtitle present. + // @function GetCurrentSubtitle + // @treturn string Current subtitle string. static TypeOrNil GetCurrentVoiceTrackSubtitle() { auto& result = GetCurrentSubtitle(); diff --git a/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.cpp b/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.cpp index 8b8b5e25f..e5d93f2e5 100644 --- a/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.cpp +++ b/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.cpp @@ -25,6 +25,9 @@ namespace TEN::Scripting // Meta functions sol::meta_function::to_string, &Rotation::ToString, + sol::meta_function::equal_to, &Rotation::operator ==, + sol::meta_function::addition, &Rotation::operator +, + sol::meta_function::subtraction, &Rotation::operator -, // Utilities ScriptReserved_RotationLerp, &Rotation::Lerp, @@ -108,4 +111,41 @@ namespace TEN::Scripting { return Vector3(x, y, z); }; + + bool Rotation::operator ==(const Rotation& rot) const + { + return (rot.x == x && rot.y == y && rot.z == z); + } + + Rotation Rotation::operator +(const Rotation& rot) const + { + return Rotation(WrapAngle(x + rot.x), WrapAngle(y + rot.y), WrapAngle(z + rot.z)); + } + + Rotation Rotation::operator -(const Rotation& rot) const + { + return Rotation(WrapAngle(x - rot.x), WrapAngle(y - rot.y), WrapAngle(z - rot.z)); + } + + Rotation& Rotation::operator +=(const Rotation& rot) + { + x = WrapAngle(x + rot.x); + y = WrapAngle(y + rot.y); + z = WrapAngle(z + rot.z); + return *this; + } + + Rotation& Rotation::operator -=(const Rotation& rot) + { + x = WrapAngle(x - rot.x); + y = WrapAngle(y - rot.y); + z = WrapAngle(z - rot.z); + return *this; + } + + float Rotation::WrapAngle(float angle) const + { + angle -= std::floor(angle / 360.0f) * 360.0f; + return ((angle < 0.0f) ? (angle + 360.0f) : angle); + } } diff --git a/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.h b/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.h index af835a1c3..084977b4b 100644 --- a/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.h +++ b/TombEngine/Scripting/Internal/TEN/Types/Rotation/Rotation.h @@ -40,5 +40,16 @@ namespace TEN::Scripting // Operators operator Vector3() const; + + bool operator ==(const Rotation& rot) const; + Rotation operator +(const Rotation& rot) const; + Rotation operator -(const Rotation& rot) const; + Rotation& operator +=(const Rotation& rot); + Rotation& operator -=(const Rotation& rot); + + private: + // Helpers + + float WrapAngle(float angle) const; }; } diff --git a/TombEngine/Scripting/Internal/TEN/Types/Vec2/Vec2.cpp b/TombEngine/Scripting/Internal/TEN/Types/Vec2/Vec2.cpp index cb99bc588..33b8caac9 100644 --- a/TombEngine/Scripting/Internal/TEN/Types/Vec2/Vec2.cpp +++ b/TombEngine/Scripting/Internal/TEN/Types/Vec2/Vec2.cpp @@ -84,15 +84,6 @@ Vec2::Vec2(const Vector2& vector) y = vector.y; }*/ -/// Metafunction. Use tostring(vector). -// @tparam Vec2 This Vec2. -// @treturn string A string showing the X and Y components of the Vec2. -// @function __tostring -std::string Vec2::ToString() const -{ - return "{" + std::to_string(x) + ", " + std::to_string(y) + "}"; -} - /// Get a copy of this Vec2 normalized to length 1. // @function Vec2:Normalize // @treturn Vec2 Normalized vector. @@ -105,7 +96,7 @@ Vec2 Vec2::Normalize() const } /// Get a copy of this Vec2 translated in the input Vec2 direction by the input distance. -// @function Translate +// @function Vec2:Translate // @tparam Vec2 dir Direction vector. Normalized automatically to length 1. // @tparam float dist Distance. // @treturn Vec2 Translated vector. @@ -115,7 +106,7 @@ Vec2 Vec2::Translate(const Vec2& dir, float dist) } /// Get a copy of this Vec2 translated in the direction of the input rotation in degrees by the input distance. -// @function Translate +// @function Vec2:Translate // @tparam Rotation rot Rotation in degrees defining the direction. // @tparam float dist Distance. // @treturn Vec2 Translated vector. @@ -125,7 +116,7 @@ Vec2 Vec2::Translate(float rot, float dist) } /// Get a copy of this Vec2 translated by an offset, where the input relative offset Vec2 is rotated according to the input rotation in degrees. -// @function Translate +// @function Vec2:Translate // @tparam float rot Rotation in degrees rotating the input relative offset vector. // @tparam Vec2 relOffset Relative offset vector before rotation. // @treturn Vec2 Translated vector. @@ -203,6 +194,15 @@ float Vec2::Length() const return ToVector2().Length(); } +/// Metafunction. Use tostring(vector). +// @tparam Vec2 This Vec2. +// @treturn string A string showing the X and Y components of the Vec2. +// @function __tostring +std::string Vec2::ToString() const +{ + return "{" + std::to_string(x) + ", " + std::to_string(y) + "}"; +} + Vec2 Vec2::Add(const Vec2& vector0, const Vec2& vector1) { return Vec2(vector0.x + vector1.x, vector0.y + vector1.y);
    Flow.FogDistance fog.Represesnts distance fog.
    Flow.HorizonDescribes a layer of moving clouds.
    Flow.StarfieldRepresents a starfield in the sky.Flow.StarFieldRepresents a star field in the sky.
    Color