Commit Graph
137 Commits
Author SHA1 Message Date
smallmodel dd1e7469ab fix(script): fix array being freed during evaluation (#904) 2026-03-19 23:30:09 +01:00
smallmodel ab43a0def6 fix(fgame): only throw an error if the target name is not found when g_scriptdebug is set 2026-03-06 00:57:52 +01:00
smallmodel 5e3944d530 fix(script): store the type name rather than throwing an exception when casting an unhandled type to string 2026-02-04 23:51:23 +01:00
smallmodel 3cda08bec4 fix(script): retrieve type name before clearing and printing valid type in array evaluation 2026-01-17 22:10:07 +01:00
smallmodel 098843cd0a refactor(script): use only GetTypeName() to retrieve the type name 2026-01-17 22:09:43 +01:00
smallmodel ecf70528a7 Move all C++ core classes to the corepp directory 2025-08-24 16:51:11 +02:00
smallmodel a3f520de8c Format most source files 2025-07-19 23:30:20 +02:00
smallmodel d567ef9793 Add IsNone() and HasValue() 2025-06-21 22:18:17 +02:00
smallmodel c350b7e9c4 Fix complement operator being incorrect with float values 2025-06-08 22:42:47 +02:00
smallmodel dad49e46ed Use a tiny approximation when comparing float values (#747)
This fixes an issue where very tiny values would fail in comparison operators, for example the comparison `2.00000620 > 2` succeeds in the original game but fails in openmohaa.
2025-06-08 22:42:01 +02:00
smallmodel 50fdc70025 Implement remaining ScriptVariableList methods 2025-06-07 20:45:06 +02:00
smallmodel aa54e3c673 Use an epsilon value to check if float numbers are equal (#713) 2025-04-19 21:11:51 +02:00
smallmodel 3af35fa610 Correctly parse the function name in ScriptDeprecatedAlt 2025-02-15 00:51:19 +01:00
smallmodel 2c12d4f2de Add a newline to ScriptDeprecatedAlt functions 2025-02-15 00:46:24 +01:00
smallmodel 7ab04b0bcb Fix IsEntity() and SimpleEntity() improperly returning true when the listener is NULL 2025-01-18 15:43:20 +01:00
smallmodel 1ea273fba0 Clear the top stack result when self is NULL 2025-01-18 13:02:05 +01:00
smallmodel 6b02457190 Properly correct the opcode in OP_LOAD_STORE_SELF_VAR when self is NULL 2025-01-17 16:49:38 +01:00
smallmodel 87e5b6d41e Clear the top variable when the event is not valid too 2025-01-17 16:21:13 +01:00
smallmodel 539c2df378 Check for valid event on listener and print an error if the command cannot be executed 2025-01-16 23:25:26 +01:00
smallmodel 2dbe61789d Don't use the target list if the world is NULL 2025-01-15 18:29:35 +01:00
smallmodel df22895b94 Fix compile error 2025-01-02 15:30:34 +01:00
smallmodel b3da62f77e Don't use an offset for constArrayValue
This is risky and a bad practice to offset a pointer. This also fixes the compiler warning
2024-11-29 21:58:07 +01:00
smallmodel 7cad7a4bd0 Fix printf format specifiers 2024-11-29 21:34:41 +01:00
smallmodel 7b58fbec8a Fix comparison operator for char 2024-11-17 21:25:54 +01:00
smallmodel 2c4b5fc9ba Rename the type variable to currentType so it doesn't take precedence over the type member
This fixes an issue where it was the type variable that was being set, rather than the type member
2024-11-16 20:07:26 +01:00
smallmodel 8eded28efc Fix the typename in the error message for incompatible types 2024-11-16 19:22:01 +01:00
smallmodel a51c250a31 Add ScriptDeprecated macros 2024-11-08 19:33:15 +01:00
smallmodel 3d454c90cb Rework the target list, use a container instead of an hash set so the target list gets archived correctly
This fixes an issue when loading from a save. A variable referencing target list container would have random entities in it, which would cause errors and crashes when trying to do an action on the array of entities
2024-10-22 20:05:53 +02:00
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