Commit Graph

8375 Commits

Author SHA1 Message Date
Christoph Oelckers 0c95568d98 - exported native fields of several more classes. 2016-11-23 01:31:48 +01:00
Christoph Oelckers 46757ff8bf - exported the native fields of FState and FLevelLocals as well. 2016-11-23 00:35:06 +01:00
Christoph Oelckers 099b9970ef - added proper definitions for all exported native fields.
- synthesize native fields for all declared flags, not just for AActor.
2016-11-22 23:43:32 +01:00
Edoardo Prezioso e1c4e4939a - Fixed the order of the MS sections. 2016-11-22 21:20:42 +01:00
Edoardo Prezioso e2167c661c - Fixed GCC/Clang compile errors. 2016-11-22 21:16:13 +01:00
Christoph Oelckers 980c986305 - allow defining native fields through scripts. Internally this only requires exporting the address, but not the entire field.
- added new VARF_Transient flag so that the decision whether to serialize a field does not depend solely on its native status. It may actually make a lot of sense to use the auto-serializer for native fields, too, as this would eliminate a lot of maintenance code.
- defined (u)int8/16 as aliases to the byte and short types (Can't we not just get rid of this naming convention already...?)
- exporting the fields of Actor revealed a few name clashes between them and some global types, so Actor.Sector was renamed to CurSector and Actor.Inventory was renamed to Actor.Inv.
2016-11-22 19:20:31 +01:00
Christoph Oelckers ab5c11064a - added a few missing tildes. 2016-11-22 13:03:46 +01:00
Christoph Oelckers 03a02a2036 - updated copyrights in a few files. 2016-11-22 12:28:11 +01:00
Christoph Oelckers bbb0778fd4 - scriptified Chicken and Pig - not tested yet, because other things have priority. 2016-11-22 12:21:55 +01:00
Christoph Oelckers 3db712cd73 - fixed: Switch statement without a default jumped to the first first case label instead.
- removed placeholder code from scripted Marine.
2016-11-21 22:20:25 +01:00
Christoph Oelckers 135cfcf016 - implemented State as an actual native struct, so that its fields can be accessed from scripts.
- refactored state bitfield members into a flag word because the address of a bitfield cannot be taken, making such variables inaccessible to scripts.
- actually use PNativeStruct for representing native structs defined in a script.
2016-11-21 21:34:34 +01:00
Christoph Oelckers ff3baac8a7 - made PStatePointer a real pointer pointing to a native struct named 'state', because that's what it really is and what it needs to be if we want to use a state as more than an opaque identifier in the VM 2016-11-21 19:36:14 +01:00
Christoph Oelckers 6cc00e79a6 - made all internal struct types NativeStructs so that all variables of their types are made references. 2016-11-21 19:20:27 +01:00
Christoph Oelckers 360436c201 - scriptified the scripted marines.
- fixed symbol name generation for native functions.
- moved PrintableName to VMFunction so that native functions also have this information.
2016-11-21 19:09:58 +01:00
Christoph Oelckers 97763b5a2b - added scriptable virtual overrides for PostBeginPlay, Tick, BeginPlay, Activate and Deactivate. 2016-11-21 14:59:17 +01:00
Christoph Oelckers 7d99552903 - added two new integral types SpriteID and TextureID, both are needed to allow proper serialization as they require something different to be written out than a regular integer. 2016-11-21 13:45:33 +01:00
Christoph Oelckers 7c122d03e9 - renamed all instances of 'float' parameters to 'double', so that the Float32 type can be made usable for structs. 2016-11-21 13:04:27 +01:00
Christoph Oelckers de2eb18727 - added per-channel access for color variables. However, since they are locally stored in registers, it required a minor bit of fudging for this case.
- make sure that a PFunction's implementation is always initialized before starting the code generator.
2016-11-21 12:38:39 +01:00
Christoph Oelckers 393bcf9e91 - extended ExpEmit::RegNum to 16 bits so that it can hold larger values for constant registers. 2016-11-21 10:50:09 +01:00
Christoph Oelckers 188c0ee932 - removed the REGT_NIL check from the PARAM_EXISTS macro, because with the implemented handling of named arguments it isn't possible that REGT_NIL can end up in the parameters without a programming error.. 2016-11-21 10:28:06 +01:00
Kyle Evans 3270b20045 Remove non-existant source file 2016-11-20 21:33:23 -06:00
Christoph Oelckers e7f6bae83e - implemented named arguments.
- fixed flag CVAR access. As it turned out, OP_LBIT is a bit messy to set up properly when accessing integers that may or may not be big endian, so it now uses a shift and bit masking to do its work.
- used the SpawnPlayerMissile call in A_FireBFG to test named arguments.
2016-11-21 01:32:01 +01:00
Christoph Oelckers 7d8143224e - restored two accidentally deleted VM instructions. 2016-11-21 00:33:55 +01:00
Christoph Oelckers 0cbd260f96 - replaced all calls to GetCVar with direct CVar accesses. 2016-11-20 23:39:37 +01:00
Christoph Oelckers 8f722a3633 - fixed: FxCVar must free its address register. 2016-11-20 23:26:32 +01:00
Christoph Oelckers e93961da96 - removed all constant versions of vector instructions. The vector code does not use compound constants so there's no need to have instructions for them.
- fixed: The code generator had no good safeguards for exceeding the maximum amount of registers.

All there was was a handful of pitiful asserts which in production code do nothing at all but generate broken output.
Even worse, the VM was hardwired to at most 255 constants per type per function by storing the constant count in a byte! This has been extended to 65535, but since many instructions only have a byte available for the constant index, a workaround had to be added to do a two-instruction setup if larger indices are needed.
2016-11-20 23:00:05 +01:00
Christoph Oelckers 1c2c26eb08 - implemented direct CVar access. 2016-11-20 20:24:39 +01:00
Christoph Oelckers 159f09105e - used static constant arrays to shorten some code. 2016-11-20 18:34:27 +01:00
Christoph Oelckers 5951a9449c - added static constant arrays. At the moment they can only be defined inside functions due to lack of dedicated storage inside classes for static data.
- added new VM instructions to access the constant tables with a variable index.
- refactored VMFunctionBuilder's constant tables so that they are not limited to one entry per value. While this works fine for single values, it makes it impossible to store constant arrays in here.
2016-11-20 18:00:37 +01:00
Christoph Oelckers bb25c5faaa - scriptified the remaining Doom weapon code.
- implemented method calls from struct instances.
- optimized disassembly of VM call instructions to print the function's name at the end where it is more visible and does not need to be truncated. Also use the printable name for script functions here.
2016-11-20 12:27:26 +01:00
Christoph Oelckers ab6b2f369e - fixed: For varargs, not only the type but also the flag of the last specified argument need to be stored for later parameters. 2016-11-20 09:47:46 +01:00
Christoph Oelckers 3c726aa570 - scriptified A_FirePlasma. 2016-11-20 01:18:21 +01:00
Christoph Oelckers fdab994fcb - scriptified the Rocket launcher. 2016-11-20 01:11:01 +01:00
Christoph Oelckers 814493b68d - scriptified the Super Shotgun. 2016-11-20 00:45:06 +01:00
Christoph Oelckers af34d82888 - scriptified A_Saw.
- implemented multiple-return-value assignment. Due to some grammar conflicts the originally intended Lua-inspired syntax of 'a, b = Function()' could not be done, so it's '[a, b] = Function()'
2016-11-20 00:25:38 +01:00
Christoph Oelckers 74c5659fc5 - explicitly call Destroy in PClass::StaticShutdown because some class type objects were no longer automatically collected. 2016-11-19 18:09:34 +01:00
Christoph Oelckers 7595343aaa - fixed: Completely empty if statements left the code generator in a broken state. 2016-11-19 18:02:07 +01:00
alexey.lysiuk c28bcca3f3 Print unknown if release information is unavailable on macOS
At least 10.4 Tiger doesn't support required sysctl name
2016-11-19 16:42:16 +01:00
alexey.lysiuk 60ac12be0a Fixed compilation warnings in Cocoa backend 2016-11-19 16:42:16 +01:00
alexey.lysiuk 3b240b73e9 Fixed endianness issue with saved games
See http://forum.zdoom.org/viewtopic.php?t=54272
2016-11-19 16:42:16 +01:00
Christoph Oelckers 0b70df88d8 - scriptified A_FireShotgun and A_FireChaingun. 2016-11-19 16:39:45 +01:00
Christoph Oelckers d50da34664 - scriptified the pistol to test if struct member functions work.
- made APlayerPawn::PlayAttacking(2) virtual script functions so that mods have better control over player animations. Note that these have no native base so they skip the templated interface for managing virtual functions.
2016-11-19 13:56:29 +01:00
Christoph Oelckers de8cacc465 - for struct member calls an address request is needed. 2016-11-19 12:41:00 +01:00
Christoph Oelckers 25e285b65d - fixed bad conversion from FString to const char * in state label type cast. 2016-11-19 12:25:53 +01:00
Christoph Oelckers 9fab8380ff - fixed: FxVMFunctionCall::GetDirectFunction did not check if the function could be called with no arguments. 2016-11-19 12:22:58 +01:00
Christoph Oelckers f11f020b6c - allow functions in structs. This is needed for several internal data types like players, sectors, lines, etc.
- added a new type 'NativeStruct'. This will be used for types that cannot be instantiated, and is also needed to cleanly handle many internal types that only can exist as reference.
2016-11-19 12:12:29 +01:00
Christoph Oelckers df4e9324c9 - added terminators to all flag lists. 2016-11-19 09:24:54 +01:00
Christoph Oelckers 10bc01c000 - fixed yet another place where VS did not warn about improper use of NULL. 2016-11-19 09:10:31 +01:00
Christoph Oelckers 3ce699bf9b - implemented pass-by-reference arguments - so far only for memory based variables.
- changed Dehacked weapon function lookup to check the symbol table instead of directly referencing the VM functions. Once scriptified these pointers will no longer be available.
- removed all special ATAGs from the VM. While well intentioned any pointer tagged with them is basically unusable because it'd trigger asserts all over the place.
- scriptified A_Punch for testing pass-by-reference parameters and stack variables.
2016-11-19 01:23:56 +01:00
Christoph Oelckers 7ff5069617 - added all missing things to enable the scriptified version of A_BrainSpit.
This uses a global function, this has been placed into DObject for now because the scripting interface does not allow non-class-owned functions yet.
2016-11-18 22:12:53 +01:00