Blixibon
4c9d71f5e3
Merge pull request #320 from z33ky/vscript-hook-delayed-init
...
Fix ScriptHook_t initialization order
2025-02-01 08:58:15 -06:00
Blixibon
e68b298a4d
Merge pull request #221 from samisalreadytaken/vscript-saverestore
...
VScript serialisation rewrite
2025-02-01 08:06:34 -06:00
samisalreadytaken
3aad0f5245
Cleanup SquirrelVM saverestore
2024-11-21 17:24:48 +03:00
Alexander 'z33ky' Hirsch
6297d2b552
Fix ScriptHook_t initialization order
...
When a ScriptClassDesc_t for is initialized (SCRIPTDESC), it recursively
invokes its parents initializers in order to obtain their pHelper
member.
Initialization is only done once, so repeated initialization is skipped.
Initialization includes assignment of a vector of ScriptHook_t's
(DEFINE_SCRIPTFUNC/BEGIN_SCRIPTHOOK), which must be initialized
beforehand.
Both of these use (static) globals; Within a translation unit,
initialization order is defined to be the same as the order of
declaration. So within a translation unit we must define all
ScriptHook_t's before the ScriptClassDesc_t using them.
A problem occurs with the parent initialization though, since there is
no defined order between translation units, meaning initialization of a
ScriptClassDesc_t can happen before its ScriptHook_t's, despite being
the correct order within its translation unit.
On MSVC it seems this issue is benign. On GCC/Linux however the
initialization of a ScriptHook_t essentially cleared whatever happened
during the initialization of the ScriptClassDesc_t, meaning many hooks
simply didn't work.
This situation is remedied by delaying the initialization of the
ScriptClassDesc_t's ScriptHook_t vector to only when the constructor of
it is invoked from its translation unit. This is accomplished simply by
adding a boolean parameter to the function (GetScriptDesc()) that is
true in the global constructor invocation, and false by default
(including when doing parent ScriptClassDesc_t initialization).
When false, a valid ScriptClassDesc_t pointer is still returned, which
is all that is needed for the initialization of the child
ScriptClassDesc_t. The value of the returned pointer is a fixed memory
location, and does not change due to the delayed initialization.
The script-helper must be initialized eagerly though, for the search of
a base-class helper. This also changes the SCRIPTDESC slightly to
accommodate the eager initialization of helper instance pointer.
Fixes #244 .
2024-11-20 23:02:00 +01:00
Alexander 'z33ky' Hirsch
696036219e
Prevent signed overflow (UB) in SquirrelVM::GenerateUniqueKey()
2024-11-13 00:25:51 +01:00
samisalreadytaken
26346bab5c
Don't save/restore squirrel class attributes
2024-06-29 18:18:54 +03:00
samisalreadytaken
77f645980e
Fix string allocation in SquirrelVM::ReadObject
2024-06-29 18:18:17 +03:00
Blixibon
de01ce6292
Merge pull request #261 from samisalreadytaken/dev
...
Misc vscript additions
2024-02-04 15:20:12 -06:00
samisalreadytaken
f1123ed1e7
Tidy up CSimpleCallChainer::PostScriptExecute()
2024-02-02 17:06:25 +03:00
samisalreadytaken
af7c9365b0
Fix vscript squirrel threads
2024-01-16 18:01:43 +03:00
samisalreadytaken
2d183a8e2a
Add recursive KV read/write on CScriptKeyValues
2023-01-05 20:00:15 +03:00
samisalreadytaken
af6c22e058
Use Assert
instead of assert
2022-12-12 10:44:22 +03:00
samisalreadytaken
5efb650ee3
Rewrite vscript squirrel saverestore
2022-12-12 10:44:22 +03:00
samisalreadytaken
843d748bb0
Use CUtlConstString instead of CUtlString
2022-12-05 14:01:00 +03:00
samisalreadytaken
c3e2ab3385
Add missing vscript const FCVAR_CHEAT
2022-11-17 10:27:48 +03:00
samisalreadytaken
e843aed912
Debug assertion on SquirrelVM::GetValue()
2022-11-17 10:27:46 +03:00
samisalreadytaken
a2cf90e3ac
Remove redundant SquirrelSafeCheck instance
2022-10-17 23:10:10 +03:00
samisalreadytaken
6e6bb4d639
Implement CScriptHookManager
2022-07-22 22:41:32 +03:00
samisalreadytaken
22f0b2c3cc
Refactor script hook system
2022-07-21 17:48:30 +03:00
Blixibon
1143570f3e
Merge pull request #172 from samisalreadytaken/sq-typemask
...
vscript fixes and additions
2022-04-28 13:16:23 -05:00
Blixibon
2aa17fff22
Exposed Mapbase version integer to VScript
2022-03-08 19:14:53 -06:00
samisalreadytaken
f2f874939d
Fix vscript global hook calls
2022-03-04 16:02:00 +03:00
samisalreadytaken
236a9a1468
Set no instanceid warning print level 1
2022-02-11 20:10:00 +03:00
samisalreadytaken
439d3c75ab
Fix VM stack corruption
2022-01-27 00:22:00 +03:00
samisalreadytaken
aac91b6487
Set vscript integer param typemask to allow float
2022-01-19 18:39:59 +03:00
Blixibon
b113d189d6
Merge pull request #171 from samisalreadytaken/docsort
...
Add vscript documentation sorting
2022-01-15 12:14:33 -06:00
samisalreadytaken
9156ba84bd
Add vscript documentation sorting
2022-01-14 22:47:00 +03:00
Blixibon
271f158f79
Merge pull request #168 from samisalreadytaken/squirrel
...
Squirrel update
2022-01-08 23:31:58 -06:00
samisalreadytaken
0de9cf41eb
Update Squirrel
2021-12-11 22:20:00 +03:00
samisalreadytaken
690299b39c
Add missing documentation in vscript
2021-10-01 16:20:24 +03:00
Blixibon
0368abaf29
Made VScript's enum registration use direct API functions to create constant tables instead of declaring them in string literal code
2021-09-19 21:09:25 -05:00
Blixibon
0fb0a3319c
Added misc. new VScript hooks/constants and the code required to implement them
2021-06-28 23:55:42 -05:00
Blixibon
29075a2c90
Added experimental static/global VScript hooks not tied to any particular class, starting with the integration of OnSave/OnRestore
2021-06-28 23:51:24 -05:00
Blixibon
e52835520c
Slightly adjusted hook callback code
2021-05-27 13:16:55 -05:00
Blixibon
0d9a5349b0
Merge branch 'develop' into feature/vscript/hook-handler-prototype-1
...
# Conflicts:
# sp/src/vscript/vscript_squirrel.nut
2021-05-27 12:07:43 -05:00
Blixibon
1de46132d8
Slightly adjusted some prior changes
2021-05-27 12:02:39 -05:00
Blixibon
e28813de7f
Added console message for when VScript documentation is requested while it's disabled
2021-05-27 12:01:55 -05:00
Blixibon
be71cb487f
Merge pull request #122 from samisalreadytaken/cleanup
...
Minor adjustments
2021-05-27 10:49:46 -05:00
Blixibon
3287643c24
Added a few more matrix-related functions for VScript
2021-05-27 09:53:48 -05:00
samisalreadytaken
c62d86e340
Added developer check on script documentation registration
2021-05-10 00:05:08 +03:00
Blixibon
c37f8eefb7
Revisited hook handler based on suggestions and new information
2021-05-09 11:34:38 -05:00
samisalreadytaken
3b51405cac
Minor adjustments and cleanup
2021-05-08 15:16:59 +03:00
Blixibon
a92ca7ceac
Added weakref() and getclass() for Vector and other C++ instances in VScript
2021-04-24 11:44:51 -05:00
Blixibon
bb250dbae6
Merge pull request #112 from ReDucTor/vscript-fix-bad-restore
...
Fixing bug with vscript restore cache not updating soon enough
2021-04-22 12:55:24 -05:00
Blixibon
caaf8836a4
Made VScript data variant returned in function stubs free itself
2021-04-22 11:37:46 -05:00
Blixibon
491b258f70
Fixed Vector unary minus operator modifying the instance itself
2021-04-21 15:09:52 -05:00
James Mitchell
9510c03ab3
Fixing bug with vscript restore cache not updating soon enough
2021-04-11 08:38:02 +10:00
Alexander 'z33ky' Hirsch
49836ab50a
Fix gcc build errors & warnings
2021-03-19 17:41:27 +01:00
Blixibon
38be2ca932
Merge branch 'feature/vscript/hook-handler-prototype-1' of https://github.com/mapbase-source/source-sdk-2013 into feature/vscript/hook-handler-prototype-1
2021-03-19 09:45:14 -05:00
samisalreadytaken
bf182e1c5d
vscript additions and fixes:
...
baseentity_shared.cpp
baseentity.cpp
c_baseentity.h
c_baseentity.cpp
c_world.h
- Fixed critical ScriptSetContextThink bugs
- Added C_BaseEntity::SetContextThink (ScriptSetContextThink)
- Added C_BaseEntity::SetSize
- Added C_BaseEntity::SetModel
- Added C_BaseEntity::Destroy
baseentity.h
baseentity.cpp
- Removed duplicate functions ScriptSetSize and ScriptUtilRemove
player.cpp
- Moved player script instance registration before player_spawn event
vscript_server.cpp
- Added CEntities::FindByClassNearestFacing
vscript_funcs_shared.cpp
- Added GetFrameCount
- Added IntervalPerTick
vscript_singletons.cpp
- Better game event descriptors for CScriptGameEventListener
- Added ::effects (CEffectsScriptHelper)
- Added ::Convars (CScriptConvarAccessor)
vscript_shared.cpp
- Fixed clientside entity printing in script VM
mapbase_con_groups.h
mapbase_con_groups.cpp
- Improved performance by changing string comparisons to direct array access
vscript_bindings_base.h
vscript_bindings_base.cpp
- Added CScriptKeyValues::SubKeysToTable
vscript_bindings_math.cpp
- Added ::SimpleSplineRemapVal
- Added ::SimpleSplineRemapValClamped
- Added ::Bias
- Added ::Gain
- Added ::SmoothCurve
- Added ::SmoothCurve_Tweak
- Added ::ExponentialDecay
vscript_squirrel.nut
- Added ::Lerp
- Added ::FLerp
- Added ::SimpleSpline
vscript_squirrel.cpp
- Added Vector::_unm
- Added Vector::Set
- Added Vector::Add
- Added Vector::Subtract
- Added Vector::Multiply
- Added Vector::Divide
- Added Vector::DistTo
- Added Vector::DistToSqr
- Added Vector::IsEqualTo
- Added Vector::WithinAABox
- Added Vector::FromKVString
- Changed vector print syntax
2021-03-06 02:04:55 +02:00