Commit Graph
109 Commits
Author SHA1 Message Date
smallmodel f9d264058b Use safe version of sprintf and strcpy 2024-09-20 23:08:53 +02:00
smallmodel 322ca2b42e Fix the loop protection not working when multiple scripts are executed
This fix will apply the protection globally
2024-08-24 18:50:04 +02:00
smallmodel 13197acb3a Uses a signed char instead of a char for opcode stack offset. On some platforms like ARM, char is unsigned by default
This fixes #311 where a memory corruption that occurred in ARM was caused because of insufficient ScriptVM stack size. The stack size was incorrectly calculated because the stack offset was using unsigned values instead of signed in ARM.
2024-06-22 19:18:08 +02:00
smallmodel 2f48ca6adb Adds assertion check to check if top stack is out of bounds 2024-06-22 19:03:27 +02:00
smallmodel 11349f9ad5 Fixes the source pos access for ENUM_if_statement (out of bounds index) 2024-06-22 16:08:33 +02:00
smallmodel a7c5067475 Fixed the execution of a method on the correct class 2024-06-09 00:07:11 +02:00
smallmodel 5155c10136 Fixed scripts not working on big-endian architectures 2024-06-08 14:40:35 +02:00
smallmodel 884a76db4c Drop error instead of throwing an exception to meet non-throwing exception specification 2024-06-07 19:55:33 +02:00
smallmodel e03b976ffd Added missing header on scriptclass.cpp source file 2024-06-07 19:42:10 +02:00
smallmodel db01f72adc Reimplemented ScriptVariable::entityValue
Some script events don't check if it's an actual entity, it would cause crashes.
E3L3 would crash after the player got out of the AB41: the AB41 was targetting a VehiclePoint and vehicles_thinkers.scr script set the `self.collisionent` to `self.target` which caused a crash as `VehiclePoint` doesn't inherit from `Entity`
2024-05-01 20:41:57 +02:00
smallmodel 3cd5acf3aa Fixed issue with case-sensitive variables.
normal/return commands are case-insensitive
getter/setter commands are case-sensitive
2024-04-22 20:10:01 +02:00
smallmodel 6731f56aea Fixed m_PrevCodePos usage 2024-04-10 23:42:09 +02:00
smallmodel dc60cb45b2 Fixed scripts using syntax like $self 2024-04-09 23:22:54 +02:00
smallmodel e3beec985e When parsing and compiling a script, return the length in an output parameter instead so the method can return a boolean to indicate success.
This fixes #221 where a script with no code would fail.
2024-04-08 21:04:26 +02:00
smallmodel b4bce3431b Archive LightClass object pointer instead of a Class object pointer 2024-03-04 22:51:29 +01:00
smallmodel 302f06f8d2 Clear the variable if the field cannot be found 2024-03-03 18:54:22 +01:00
smallmodel 960469be77 Implemented MakePrimitive() 2024-02-28 22:52:25 +01:00
smallmodel 8a3b62e93f Fixed targetname error 2024-02-16 23:50:57 +01:00
smallmodel 0ed92943de Fixed commands not being executed properly on a specific type of array of listeners 2024-02-03 23:22:06 +01:00
smallmodel 45f50cfe25 Fixed array variable being case-sensitive 2024-01-28 23:53:02 +01:00
smallmodel d8505eff2b Fixed label parameters being incorrectly case-sensitive 2024-01-28 23:17:00 +01:00
smallmodel 75f8f86f86 Fixed compilation error on some compilers 2023-11-29 00:08:35 +01:00
smallmodel b10ce9a426 Added GetKey() / SetKey() in con_set's Entry, so ScriptVariable can override it and set the key appropriately 2023-11-28 19:50:19 +01:00
smallmodel 2ac2800ecb Only archive used variables on the local VM stack 2023-11-28 19:14:09 +01:00
smallmodel fad555308b Archive ScriptVM and ScriptThread appropriately 2023-11-27 19:30:40 +01:00
smallmodel 37de859bee Fixed field var breaking code position on exception 2023-11-14 00:16:09 +01:00
smallmodel befcedcf58 Fixed OPCODE_STORE_FIELD_REF incorrectly not skipping field on exception
It would cause invalid opcode afterwards.
2023-11-14 00:06:23 +01:00
smallmodel e8aad97975 Fixed alignment issue on ARM CPUs 2023-11-13 23:28:42 +01:00
smallmodel 1698f6d1bf The return value of an event must be the first value 2023-11-02 19:53:26 +01:00
smallmodel 7c655944a5 Convert fields name to lower 2023-11-01 19:16:01 +01:00
smallmodel 4695932ea1 Added StoppedNotify()
This fixes scripts waiting for another executing script which fixes Actor being stuck on some animations
2023-11-01 17:31:46 +01:00
smallmodel 7c5c34741c Added more script trace and initialize state to STATE_EXECUTION in ScriptVM constructor 2023-11-01 16:52:30 +01:00
smallmodel ff3ee39830 Fixed field name not showing in the exception message 2023-10-31 20:39:28 +01:00
smallmodel dd1f8bd92a Compare with STATE_RUNNING instead 2023-10-30 22:46:59 +01:00
smallmodel 57e450a745 Thread state fix 2023-10-27 20:41:47 +02:00
smallmodel 481cd760a9 Added ScriptTrace/GetSourcePos 2023-10-27 20:00:48 +02:00
smallmodel 6d6043775e Use const unsigned char* for sourcepos 2023-10-27 19:59:29 +02:00
smallmodel a6e602af1d Renamed variables in ScriptClass::RemoveThread for more clarification 2023-10-26 20:18:50 +02:00
smallmodel 04a6012e5d Renamed thread parameters 2023-10-26 20:17:53 +02:00
smallmodel 0f7691c722 Reordered NotifyDelete switch statement for more clarity 2023-10-26 20:17:42 +02:00
smallmodel f01a0a17c1 Added script traces 2023-10-26 20:13:07 +02:00
smallmodel b291ab92b6 Fixed script class being always created even when a thread was started in the same group 2023-10-26 20:08:09 +02:00
smallmodel d757fa6306 Renamed world.cpp and world.h to worldspawn.cpp and worldspawn.h 2023-10-08 00:08:47 +02:00
smallmodel 673a42242d Formatted source files 2023-10-01 22:47:25 +02:00
smallmodel 3317345d92 Use a const string for target name 2023-10-01 22:45:41 +02:00
smallmodel f7bfa47f2e Made ScriptVariable classes part of LightClass 2023-09-13 23:51:33 +02:00
smallmodel 9f6ef14ea1 GetCompiledScript should remain unused 2023-09-13 21:32:58 +02:00
smallmodel c5a46be23e Optimized calls to Event() (avoid allocating a new Event when it can be reused) 2023-09-07 18:22:07 +02:00
smallmodel 47a3c0bf55 Optimized event name
Use a static char*, instead of an allocated str
2023-09-07 18:05:49 +02:00
smallmodel f2ec502dc2 Fixed str allocation 2023-09-04 22:06:13 +02:00