Commit graph

121 commits

Author SHA1 Message Date
davidmarr
4f95efa011
add View.GetAspectRatio() function (#1243)
* add GetScreenAspectRatio() function
* Add Moveable:GetEndFrame() lua function
* Update Util.cpp
* Update ReservedScriptNames.h
* Update Changes.txt
* Update Changes.txt
* Update MoveableObject.cpp
* Update MoveableObject.cpp
* update of the function GetDisplayAspectRatio()
* Update Changes.txt
* Revert newlines
* Update ViewHandler.cpp
* Update Changes.txt
* Correct naming, remove misleading usage example
* Update Changes.txt
* Update Changes.txt

---------

Co-authored-by: Sezz <sezzary@outlook.com>
Co-authored-by: Lwmte <3331699+Lwmte@users.noreply.github.com>
2023-11-05 10:04:09 +02:00
Sezz
5284c9695b
Vec3 and Vec2 scripting object refactor (#1191)
* Upgrade Vec3

* Use parentheses

* Partial merge error fix

* Fix compile error

* Change casting to be compliant with standards

* Minor changes

* Implement various Vec3 methods

* Add static variants of methods

* Fix compilation error

* Remove fake static methods; update doc comments

* Update method names

* Update doc comment

* Rename ToLength() to SetLength()

* Simplify Vec3 API

* Remove methods

* Remove method

* Reorder methods

* Update doc comment

* Update doc comments

* Update doc comment

* Reorder methods

* Add comment

* Move doc comments

* Maybe fix * overloads; remove SetLength()

* Reorder methods

* Maybe fix overloads

* Update method names

* Add Vec2 methods

* Newline

* Add constructors

* Update doc comments

* Update doc comments

* Update Vec3.cpp

* Handle division by 0

---------

Co-authored-by: hispidence <squidshirehimself@gmail.com>
Co-authored-by: Adngel <adngel@hotmail.com>
2023-10-16 10:44:08 +01:00
Sezz
e10607e733 Update doc comments 2023-10-06 13:25:02 +11:00
Lwmte
d7ccf2aaf1 Fix lua moveable constructor forcing animation and HP to certain values 2023-08-25 01:30:02 +02:00
Lwmte
7095c42875 Fix another 64-bit specific crash with ID_NO_OBJECT 2023-07-09 19:38:56 +02:00
Sezz
f979e147e3 Further scripting code formatting 2023-06-26 17:54:06 +10:00
Lwmte
35304ce84a
Dynamic bridge collision (#1137)
* Initial commit

* Don't update bridge offset if not necessary

* Don't stick to bridge when in air

* Update Changes.txt

* Minor simplification

* Simplify

* Update collide_room.h

* Update collide_room.h

* Use real floor height to determine bridge collision

* Detect bridges first to avoid potential issues with item init

* Remove incorrect forward declaration

* Move pickups on dynamic bridges

* Push player away from moving bridges

* Update Changes.txt

* Use actual pickup bounds for collision detection

* Stabilize collision by using both abs Y and bb Y ref points

* Update collide_item.cpp

* Swap function parameters

* Update collide_room.cpp

* Increase movement tolerance

---------

Co-authored-by: Sezz <sezzary@outlook.com>
Co-authored-by: Jakub <80340234+Kubsy@users.noreply.github.com>
2023-06-17 10:52:02 +01:00
Lwmte
b91dce1ce1 Fix various discarded W4 compiler warnings 2023-06-16 23:07:37 +02:00
Sezz
1caa6f4994
Animation refactors tier 3 (#1092)
* Remove most direct accesses to g_Level.Anims

* Make all anim and frame data access read-only

* Simplify

* Simplify

* Use GetAnimData()

* g_Level.Anims to GetAnimData() conversions

* Use SetAnimation() in wraith trap init

* Minor formatting fixes
2023-05-11 13:30:41 +01:00
Kubsy
7f2baaf53f
Object init organize (#1090)
* start reorganize

* progress

* address some of @Lwmte suggestions

* Move setup.cpp to Game folder and capitalize it

* Include corrections

* include the new Setup.cpp in vcxproj

---------

Co-authored-by: Lwmte <3331699+Lwmte@users.noreply.github.com>
Co-authored-by: Sezz <sezzary@outlook.com>
2023-05-01 11:24:48 +01:00
Sezz
b5b133911f
Initialize with a z (#1077)
* Initialise -> initialize

* Update new functions

* Fix typo
2023-04-21 10:39:31 +01:00
Sezz
2ca8812c93 Fix formatting 2023-04-21 14:29:14 +10:00
hispidence
51e083a7de Fixed and regened docs; partial fix for #750 2023-03-31 20:51:44 +01:00
Nemoel-Tomo
ba47fb1273
Corpse object (#1031)
* start to add visuals to the cadaver effect

* Add new slot - 1086: ID_CORPSE

* store changes so that I can switch to another branch

* update

* progress

* add falling corpse (OCB1)

* fixed hitroutine on not intelligent enemies in los.cpp

fixed Compy idle before die animation, finished corpse object

* formatting

* renamed cadaver to corpse

* Fix formatting

* removed effectID corpse, give the corpse object the effect only

trigger/antitrigger the effect on the corpse object as your wish

* compies now attack only on floor lying cadavers

* corpse object should fall down even if not triggered

---------

Co-authored-by: Stranger1992 <84292688+Stranger1992@users.noreply.github.com>
Co-authored-by: Sezz <sezzary@outlook.com>
Co-authored-by: Kubsy <80340234+Kubsy@users.noreply.github.com>
2023-03-25 14:03:28 +00:00
Nemoel-Tomo
1566fd19e4
Tr3 small dinosaur fix (#1002)
* adding compies, test phase

* formatting

* removed SAS test flag

* added script command EffectID Cadaver

* formatting

* formatting

* limit the item timer to 250

* bugfixing
2023-02-13 18:49:15 +00:00
Adngel
3b5328241b Changes in lua GetSet ItemFlags description 2023-02-04 12:28:44 +01:00
Adngel
02bbf48b57
More lua funcs adngel (#967)
* Updated Camera:SetPosition

Created a function to for the fixed camera position Update for those cases where this change (by lua) but there are not other game events to refresh the change.

For example: If Lara is moving, the camera is constantly refreshing, she can step triggers that change camera and this will work fine.

But if Lara is stopped, no keyboard input comming, and the fixed camera change its position externally (lua, evensequence, etc) these wouldn't be refreshed in the camera until a game Event happens (like player pressing any key).

This commitmment aims to solve that issue.

* Get Set Airborne

* Moveable Get direction Vectors

Available the functions to get the RIGHT, FORWARD and UP vector of the object. To help with some translations in lua.

* Revert "Moveable Get direction Vectors"

This reverts commit ce378f6a71.

* Update Changes.txt

* Moved Airborne getters to LaraObject functions.

* Update descriptions.

* Function name changed

* Get Set for creature->LocationAI

* Added Safety check.

* Added informative error lines for TEN Log.

* Updated feedback

* Update Changes.txt

---------

Co-authored-by: Kubsy <kubadd475@gmail.com>
2023-02-04 10:32:51 +00:00
hispidence
d2e27d4d8e Add Rotation constructor that takes a Vector3 ref. This will get called upon loading, when the saved Vector3 will be put back into the Rotation object. 2023-01-16 20:05:52 +00:00
Adngel
8041a04db4
Lua new functions adngel (#934)
* Function: Update Floor Collision

Adds a new function to allow update the Floor collision of some objects (bridges, trapdoors, platforms, etc).

* Function: Play Camera

Allows to set activate a camera while this function is called.

Right now, it requires the position and room of the target. (WIP)

* Update

* Removed the duplicated comment for UpdateFloorCollision.
* Added new function GetIndex to the class Moveable.
* Added new function GetIndex to the class CameraObject.
* Added a new variable to the object LevelCameraInfo (Index).
* Edited the function PlayCamera

* Function: GetCameraType

* Update descriptions

Updated descriptions for.
* GetItemFlags(index)
* SetItemFlags (value, index)

* Bug fix on FixedCameras.

Bug description: When a fixed camera was being triggered, and, if the target go behind and obstacle, then the screen turned black.

Reason: In those conditions, the move camera check the origin vector received, however, that vector was incomplete because it had the room 0, so although Move camera corrected the room later, it was already using some wrong calculus at room 0 that caused the black camera (this got an offset that places it out of the real room).

The reason why the vector was getting room 0, was because the operator function = of the GameVector class, was forgetting to copy the Room Number.

After this fix, the bug is not observed anymore.

* Removal of Function UpdateFloorCollision

* Erasing of forgotten line

It was included for the UpdateBridgeFunction, but as that function is not here anymore, this include is not necessary.

* GetIndex functions hidden from public lua API

They still remain as they are being used by other classes, but they can't be called by lua script anymore.

* First attempht of new Enum for lua

Need to test first.

* Removal of GetIndex() in CameraObject

The GetIndex from the moveable class, is used in CameraObject class.

But this one from CameraObject, although I created it was still unused. So I'm unmaking it.

The Index var in the LevelCameraInfo.cpp is still there and is required for PlayCamera() function to work.

* Update GetCameraType() @usage example.

* Branch Update

- Extracted CameraType enumerator to its own header.
- Fixed formatting of CameraObject.cpp line 70

* Added comments for the doc

- Added comments to the enumerator for the doc.
- Removed datar from the function description, guiding to the enumerator CameraType info.

* Update Changes.txt

Added the content of this branch to the changes.txt

* Error correction in CameraTypes enumerator header.

* Updated usage example.

Updated for a shorter example.

* Update Changes.txt

Co-authored-by: Lwmte <3331699+Lwmte@users.noreply.github.com>
2023-01-13 00:10:47 +02:00
hispidence
a10f71a754 Fix doc comment 2023-01-06 20:45:12 +00:00
hispidence
0512b213b5 Rename MeshIsSwapped to GetMeshSwapped. 2023-01-06 20:44:14 +00:00
hispidence
6ca9b10689 MeshIsVisible -> GetMeshVisible
ShowMesh/HideMesh -> SetMeshVisible
2023-01-06 20:24:35 +00:00
hispidence
8775ad5660 Give RemoveActiveItem a 'killed' arg so determine whether it should call OnKilled callbacks. Allow the distinction between 'killed' and 'destroyed' - a baddy killed with guns is killed, but their body remains, so they are not destroyed. 2023-01-02 19:24:37 +00:00
hispidence
d298b522d5 Merge branch 'master' into TriggerEnhancements 2023-01-01 16:59:51 +00:00
hispidence
6c78fa231e Initial implementation of trigger/antitrigger stuff for Lua API. 2022-12-30 15:58:52 +00:00
Anatoly
d916761cc2
Merge pull request #915 from MontyTRC89/room_scripting
Room scripting
2022-12-25 13:48:02 +02:00
Lwmte
b68b08ade1 Add GetRoom script function for all related object types 2022-12-25 12:42:54 +02:00
Lwmte
e6f51fab3c Rename all get/set room script methods 2022-12-25 03:50:01 +02:00
Sezz
a45cb253e8 Move entity Color member to model struct 2022-12-24 22:01:02 +11:00
Lwmte
5d94e71520 Merge branch 'master' into room_scripting 2022-12-17 03:21:15 +02:00
Lwmte
0ce6d12f97 Add room properties to savegame, fixes 2022-12-17 01:25:37 +02:00
Lwmte
8d8f77b98b Update MoveableObject.cpp 2022-12-16 20:10:24 +02:00
hispidence
1afcfac55b Fix doc comments 2022-12-16 18:36:21 +00:00
Lwmte
8af424dd3f Fix doc comment 2022-12-16 19:14:00 +02:00
Lwmte
4df08c1a1b Fix issues with fractional script rotations 2022-12-14 01:26:43 +02:00
Sezz
2b6cf98f04 Make angle functions constexpr; remove duplicate function 2022-12-12 18:59:40 +11:00
hispidence
80aca7572d Doc fixes 2022-12-11 18:37:06 +00:00
Lwmte
e1165360f0 Force predictive room update if UpdateRoom param is true for SetPosition 2022-12-10 20:39:36 +02:00
Lwmte
f77a39ee2c Fix linked list corruption 2022-12-07 00:48:31 +02:00
Lwmte
015bd844f9 Implement predictive room change for SetPosition, fix buggy IsPointInRoom 2022-12-06 14:27:38 +02:00
Anatoly
b7dc44129a
Lua additions for 1.0.4 (#881)
* Add GetTarget / GetVehicle
* Activate Lara-bound volumes with mounted vehicle
* Add ActionID enum to be used with KeyIsHeld etc
* Update Changes.txt
* Fix typo
* Remove unused include
* Allow to explode / shatter mounted vehicles
* Move vehicle handling to more appropriate place
* Update lara_helpers.cpp
* Update Changes.txt
* Add warning if velocity is attempted to be set on creature
2022-12-03 14:46:37 +02:00
hispidence
e91e254c3c Doc comment fixes. 2022-12-01 21:16:44 +00:00
Lwmte
7e9fb02b6c Cleanups, fixes and renames 2022-11-30 01:31:04 +02:00
Nemoel-Tomo
9eafbdc1aa latest changes 2022-11-30 00:57:25 +01:00
Nemoel-Tomo
ab64f466ff fixed commit 2022-11-29 17:00:16 +01:00
Nemoel-Tomo
1959d62294 fixed code stuff and flame_emitters.cpp
I removed my additional code in BurnNearbyItems function, so now Lara can run into flameemitter with any other burn status and get fire burn status back
2022-11-27 14:26:00 +01:00
Nemoel-Tomo
c156f45a63 fixed shockwave stuff and made effect lightning as int 2022-11-27 13:34:04 +01:00
Nemoel-Tomo
27c42733cf SETHa-Fix, new Effects, custom burn types
Moveable:SetCustomEffect( effectType, color1, color2, timeout)
New effects: MagicFire, ColoredFire

new effects for SetEffect(effectType, timeout)
New effects: ElectricDeath, LaserDeath

Seth Fix

TODO: someone must add
EntityEffectData.EffectColor1
EntityEffectData.EffectColor2
to savegame data
2022-11-25 01:45:29 +01:00
Anatoly
53ce6192b9
Universal burn (#858)
* Initial Commit
* Fixes
* Process burn for Lara
* Save burn type in savegames
* Generalize burning effects into Effects::Items namespace
* Use flame types instead of ints, beautify item flame effect
* Add missing changes
* Add timeouts, adjust NPC burn speed
* Update TombEngine.vcxproj
* Reorganize AnimateItem to place ProcessSectorFlags there
* Implement real electric sparks
* Don't check for item burning on every frame
* Correct flame emitter size
* Add script function to set moveable effect
* Tune up sparkles
* Occasionally burn enemies on explosive damage
* Update TombEngine.vcxproj
* Add timeouts to effect script functions
* Cleanup
* Update Changes.txt
* Rename effect enums
* Change SetEffect timeout to -1 by default
2022-11-22 19:16:35 +02:00
Lwmte
577827846f Also reset model when object ID is changed via script 2022-11-20 04:51:09 +02:00