Commit graph

344 commits

Author SHA1 Message Date
Christoph Oelckers
d85b9cdd71 - scriptified the input methods of DConversationMenu.
- fixed handling of DimAllowed.
2017-02-19 13:07:49 +01:00
Christoph Oelckers
2440951811 -scriptified the ReadThis screen. 2017-02-19 00:08:30 +01:00
Christoph Oelckers
d8ebbcfc08 - fixed: When loading a savegame the player class in the userinfo needs to be updated.
- fixed: Class pointers should not be added to the list of garbage collected pointers.
- fixed several warnings in the event code.
2017-02-15 11:55:08 +01:00
ZZYZX
6a0103a746 Merged p_setup conflict 2017-02-03 13:02:44 +02:00
ZZYZX
27c5e21a1d Moved E_InitStaticHandlers(true) a bit higher in the initialization so that local scripts receive PlayerEntered properly 2017-02-03 09:04:01 +02:00
ZZYZX
490159f6df Removed duplicate PlayerEntered call 2017-02-02 22:37:22 +02:00
ZZYZX
7f2d97d7ef Reverted previous commit 2017-02-02 22:18:28 +02:00
ZZYZX
2f79f74d2d Fixed condition 2017-02-02 22:14:22 +02:00
ZZYZX
dae4a48574 G_FinishTravel: only call RETURN/REOPEN on actual hub return as documented, not on every snapshot/savegame load 2017-02-02 21:52:09 +02:00
ZZYZX
39355cf45d Implemented player scripts. 2017-02-02 21:25:07 +02:00
ZZYZX
19d2f6a4db REOPEN scripts should not be called per player pawn 2017-02-02 20:27:57 +02:00
Christoph Oelckers
6d28aa3541 - do not use strtol for parsing critical values that can get large.
This function will truncate everything that is larger than LONG_MAX or smaller than LONG_MIN to fit into a long variable, but longs are 32 bit on Windows and 64 bit elsewhere, so to ensure consistency and the ability to parse larger values better use strtoll which does not truncate 32 bit values.
2017-02-01 11:19:55 +01:00
ZZYZX
0598c18ad8 Added WorldEventHandler with WorldThingSpawned. WorldThingDestroyed is not implemented because you already can attach an object that would check master's state. 2017-01-30 08:47:15 +02:00
ZZYZX
09ca1f610d Removed World*Unsafe handlers (merged with WorldLoaded/WorldUnloading); Removed the concept of 'map-local static' handlers, static handlers are now only those that run globally. 2017-01-30 07:50:09 +02:00
Christoph Oelckers
1d2ae53ecb Revert "- made r_fullbrightignoresectorcolor a MAPINFO option, so far only working on the software renderer. GL still needs a few changes to handle it correctly."
This reverts commit dd03bb1fcb.

Turns out that making this work in GL will create a complete mess so better remove the option as it would only cause problems.
2017-01-28 18:26:52 +01:00
Christoph Oelckers
dd03bb1fcb - made r_fullbrightignoresectorcolor a MAPINFO option, so far only working on the software renderer. GL still needs a few changes to handle it correctly. 2017-01-28 12:20:18 +01:00
ZZYZX
3e093a20ff First take at serialization 2017-01-24 00:17:12 +02:00
ZZYZX
efb1e5d33a Implemented global EventHandlers in MAPINFO 2017-01-23 20:48:57 +02:00
ZZYZX
76b99da4b3 Added EventHandlers in Map section of MAPINFO 2017-01-23 20:48:57 +02:00
ZZYZX
35ec14f465 Made the EventHandler class tree a bit more branchy. Now disallowing creation of Static* via EventHandler.Create. 2017-01-23 20:48:57 +02:00
Christoph Oelckers
19df603f92 - fixed: P_RailAttack did not make adjustments for the shooter's floorclip. 2017-01-21 10:55:57 +01:00
Christoph Oelckers
3c30b59bab more inventory scriptification
* completely scriptified DehackedPickup and FakeInventory.
* scriptified all remaining virtual functions of Inventory, so that its inheritance is now 100% script-side.
* scriptified CallTryPickup and most of the code called by that.

- fixed: Passing local variables by reference did not work in the VM.
2017-01-19 23:42:12 +01:00
Christoph Oelckers
d2d6e5d486 - scriptified PowerFlight and PowerWeaponLevel2. 2017-01-15 23:21:38 +01:00
Christoph Oelckers
7503937a84 - scriptified PowerTargeter. 2017-01-15 19:44:43 +01:00
Christoph Oelckers
cd7986b1b1 - refactored global sides array to be more VM friendly.
- moved FLevelLocals to its own header to resolve some circular include conflicts.
2017-01-08 18:46:17 +01:00
Christoph Oelckers
c02281a439 - refactored the global sectors array into a more VM friendly type and moved it into FLevelLocals. 2017-01-07 19:32:24 +01:00
Christoph Oelckers
15f30886cd - scriptified the TimeFreezer powerup. 2017-01-03 20:06:20 +01:00
ZZYZX
ed2b73833b Enabled simple intermission for hubs 2016-12-28 14:06:28 +01:00
Christoph Oelckers
80f1661931 - fixed: The player checking code after loading a savegame was not changed when tracer was replaced with alternative for holding the player's unmorphed version. 2016-12-27 22:44:22 +01:00
Christoph Oelckers
04ff4282ef - removed the global 'sector_list' variable.
If the calling code wants to recycle this it will have to pass a container variable to AActor::UnlinkFromWorld and AActor::LinkToWorld.
This was changed because keeping such data in a global variable is dangerous for a set of functions that can be called from a script.
Note that the scripted versions do not yet support saving of the touching_sectorlist.
2016-12-25 22:40:26 +01:00
Christoph Oelckers
3af9232fca - scriptified a_strifeitems.cpp and a_debris.cpp.
- Changed the glass shards so that they do not have to override FloorBounceMissile. It was the only place where this was virtually overridden and provided little usefulness.
- made 'out' variables work.
- fixed virtual call handling for HandlePickup.
2016-11-29 12:17:05 +01:00
Christoph Oelckers
7ea9f60464 - scriptified the Acolyte. 2016-11-28 10:41:36 +01:00
Christoph Oelckers
5ce5466e18 - scriptified hexenspecialdecs.
- made '->' a single token. Although ZScript does not use it, the parser tends to get confused and fatally chokes on leftover arrows so this ensures more robust error handling.
2016-11-27 20:14:43 +01:00
Christoph Oelckers
66d28a24b8 - disabled the scripted virtual function module after finding out that it only works if each single class that may serve as a parent for scripting is explicitly declared.
Needless to say, this is simply too volatile and would require constant active maintenance, not to mention a huge amount of work up front to get going.
It also hid a nasty problem with the Destroy method. Due to the way the garbage collector works, Destroy cannot be exposed to scripts as-is. It may be called from scripts but it may not be overridden from scripts because the garbage collector can call this function after all data needed for calling a scripted override has already been destroyed because if that data is also being collected there is no guarantee that proper order of destruction is observed. So for now Destroy is just a normal native method to scripted classes
2016-11-25 00:25:26 +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
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
Leonard2
7dbc4710f1 Add the new argument to all uses of the implement macro 2016-11-09 17:45:55 +01:00
Leonard2
bb2d61de50 Replaced the many implement macros with a single one that takes arguments instead 2016-11-09 17:45:53 +01:00
Christoph Oelckers
9563045305 - moved declaration of native fields into the respective class definitions.
This bypasses a declaration in the script in favor of a simpler implementation. In order to work it is always necessary to have an offset table to map the variables to, but doing it fully on the native side only requires adding the type to the declaration.
2016-11-04 00:19:36 +01:00
Christoph Oelckers
a45523fb63 - scriptified A_SpawnFly.
- added support for global variables to the code generator - not the compiler, though. For the handful of entries this is needed for it may just as well be done manually. So far FLevelLocals level is the only one being exported.
- fixed: The VM disassembler truncated 64 bit pointers to 15 digits because the output buffer was too small.
- resolve entire FxSequences instead of aborting on the first failed entry. This allows to output all errors at once.
2016-11-03 13:38:40 +01:00
Rachael Alexanderson
6755373f46 - fixed: map commands will now take capslock DM/COOP as arguments 2016-11-01 15:09:09 +01:00
Rachael Alexanderson
f72ebe6768 - Extended map, recordmap, and open commands to accept "dm/coop" as an extra parameter - to open maps in multiplayer mode with the requested ruleset. 2016-11-01 15:09:08 +01:00
Rachael Alexanderson
043e761eec - Implemented sv_singleplayerrespawn 2016-10-25 09:25:56 +02:00
Christoph Oelckers
59d5b42abf - fixed: G_UnsnapshotLevel should abort with an error if it cannot read the savegame.
- fixed: The exception handler in G_DoLoadGame needs to rethrow the exception it receives.
2016-10-05 19:02:53 +02:00
Christoph Oelckers
6a6a0e8017 - removed some more hubtravel related player start fudging.
* do not skip the player_t init when travelling in a hub. The old player may still be needed in some edge cases. This applies only to singleplayer for now. The multiplayer version still needs reviewing. I left it alone because it may shuffle players around which is not wanted when doing hub travelling.
 * do not spawn two temp players in G_FinishTravel. Instead handle the case where no player_t::mo can be found gracefully by adding a few nullptr checks. This temp player served no real purpose except for having a valid pointer. The actual start position was retrieved from somewhere else.
2016-09-25 01:28:27 +02:00
Christoph Oelckers
86e9282193 - removed the sequential processing of JSON objects because the benefit is too small.
After testing with a savegame on ZDCMP2 which is probably the largest map in existence, timing both methods resulted in a speed difference of less than 40 ms (70 vs 110 ms for reading all sectory, linedefs, sidedefs and objects).
This compares to an overall restoration time, including reloading the level, precaching all textures and setting everything up, of approx. 1.2 s, meaning an increase of 3% of the entire reloading time.
That's simply not worth all the negative side effects that may happen with a method that highly depends on proper code construction.
On the other hand, using random access means that a savegame version change is only needed now when the semantics of a field change, but not if some get added or deleted.

- do not I_Error out in the serializer unless caused by a programming error.

It is better to let the serializer finish, collect all the errors and I_Error out when the game is known to be in a stable enough state to allow unwinding.
2016-09-23 14:04:05 +02:00
Christoph Oelckers
c17da32dbd - added object deserialization. It seems to work, at least the stuff I sampled looked like it was properly reatored and it triggers no error condition.
- always make the top level object randomaccess when opening a JSON file for reading. Some things won't work right if this is opened for sequential access.
2016-09-23 00:45:41 +02:00
Christoph Oelckers
f52e2a8cc4 - removed bogus BeginObject call in deferred script serializer. 2016-09-22 12:36:29 +02:00
Christoph Oelckers
68dc75bf9e - fixed: array clamping may only be done when reading a savegame.
- fixed generation of savegame names for level snapshots.
2016-09-22 11:51:29 +02:00
Christoph Oelckers
f0e8e860f1 Merge branch 'master' into json 2016-09-22 09:09:48 +02:00