Commit Graph

14318 Commits

Author SHA1 Message Date
Magnus Norddahl 9dbb1d77ce - fix compile error 2018-11-27 17:02:51 +01:00
Magnus Norddahl 73819d45b7 - annotate which function we are calling for better dumpjit info 2018-11-27 17:00:29 +01:00
Magnus Norddahl d195efc431 Merge remote-tracking branch 'origin/master' into asmjit 2018-11-27 15:38:10 +01:00
Magnus Norddahl 5e01a874be - merge the span step code used by both the 8 bit and 32 bit drawers 2018-11-26 17:02:01 +01:00
Magnus Norddahl dbb7df998d - step with SSE 2018-11-26 14:32:56 +01:00
Magnus Norddahl 2db433e68f - only do shade clamps if needed 2018-11-26 12:18:07 +01:00
Magnus Norddahl 8b852ce4d8 - move the jit runtime to its own file 2018-11-26 10:46:09 +01:00
Magnus Norddahl 52b7a77771 - use SSE for the dynlights 2018-11-26 00:49:07 +01:00
Christoph Oelckers 47b1fa774d Merge branch 'asmjit' into weapon_scriptification
# Conflicts:
#	src/gi.cpp
#	wadsrc/static/zscript/base.txt
2018-11-26 00:14:44 +01:00
Christoph Oelckers 90d79865a5 Merge branch 'master' into asmjit 2018-11-25 23:33:23 +01:00
Christoph Oelckers 182d43ae70 - fixed: Any direct native function may not use struct values as parameters, not even something as simple as an FName. 2018-11-25 23:33:15 +01:00
Christoph Oelckers bef5b953b2 - free everything. 2018-11-25 23:33:15 +01:00
Christoph Oelckers 34a1c8e545 - delete JIT data when shutting down. 2018-11-25 23:33:14 +01:00
Magnus Norddahl c164b3c3b0 - fix: float constants got their move instructions inserted after the call instruction 2018-11-25 22:26:38 +01:00
Christoph Oelckers d79ef939e9 - fixed: The serializer must treat object that were already destroyed or are declared transient like a null pointer and not ignore them.
This caused FraggleScript's SpawnedThings array to go out of sync.
2018-11-25 22:13:14 +01:00
Christoph Oelckers 9475bfe4f1 - declare builtins as static. 2018-11-25 21:47:28 +01:00
Christoph Oelckers 176da5de68 - added a direct native variant for A_PlaySound because this function is relatively easy to test. 2018-11-25 18:41:27 +01:00
Magnus Norddahl 61b91f9814 - fix macro expansion error on gcc and clang 2018-11-25 18:37:26 +01:00
Magnus Norddahl d30bf44dcc - use SSE for the normal walls 2018-11-25 17:11:05 +01:00
Christoph Oelckers 2b960aa28f - finished adding direct native functions to vmthunks.cpp. 2018-11-25 16:12:15 +01:00
Magnus Norddahl 53175c49a7 - change DrawSpanOpt32 to render a scanline in multiple steps as the speed is about the same and it will make it easier to use SSE for each of the steps 2018-11-25 15:49:15 +01:00
Christoph Oelckers 03364a8c3e - all sector exports done. 2018-11-25 15:14:48 +01:00
Christoph Oelckers 8e8ee732f4 - another batch of direct native functions. 2018-11-25 14:19:19 +01:00
Christoph Oelckers 6628b34f4a - continued work on adding direct native support. 2018-11-25 13:35:32 +01:00
Christoph Oelckers dc16c1d44e - moved VM thunks from p_sectors.cpp to a separate file and started adding direct native implementations.
For a few larger functions I took them out of sector_t and made them global functions to avoid creating more unnecessary stubs.
2018-11-25 11:34:50 +01:00
Christoph Oelckers a501a22b28 - define the built-in functions defined in codegen.cpp through the regular interface instead uf just hacking them into the symbol table with incompletely set up data.
- added direct native variants to these builtins and fixed problems with builtin processing.
2018-11-25 11:41:29 +01:00
Christoph Oelckers 43d434b071 - removed AStateProvider from native code.
The only place still referencing it was CallStateChain, so this has been made a static function now instead of a class method.
2018-11-25 10:09:06 +01:00
Christoph Oelckers f4789bdefc - fixed handling of dummy flags. 2018-11-25 10:06:00 +01:00
Christoph Oelckers d6b781312c - removed all remaining native components of the weapon class. 2018-11-25 10:00:55 +01:00
Christoph Oelckers 70d3c31551 - allow defining flags in the script declaration of a class and do that for Weapon. 2018-11-25 09:29:12 +01:00
Christoph Oelckers b5c4ab8c47 - removed all direct access to AWeapon's members to prepare moving this class fully to the script side.
Disregarding UI-side and setup-related calls there's unfortunately still 6 places in the native game code which require direct access.
2018-11-25 08:17:37 +01:00
Christoph Oelckers 00a48b09e5 - moved the 'Finalize' methods back into a single function in the parser code.
It has been like this initially but was changed when ZDoom gained an overly complicated polymorphic class descriptor object that required a lot of support code. All these complications have long been removed but these methods remained. Since they prevent a class from being moved to the script side entirely they had to be removed.

This was the last major blocker to make Weapon a purely scripted class, the only remaining native method is Serialize which is of no concern for the coming work.
2018-11-25 08:16:18 +01:00
Christoph Oelckers 7012179904 - moved MarkPrecacheSounds completely to the script side and added native support to make this a usable feature. 2018-11-25 07:43:05 +01:00
Christoph Oelckers 8fa16b6c30 - some cleanup on the weapon slot interface.
This really shouldn't make any decisions from directly reading weapon class defaults.
2018-11-25 07:21:02 +01:00
Christoph Oelckers f218e95c4d - scriptified cht_Takeweaps. 2018-11-25 01:26:19 +01:00
Christoph Oelckers bc86ec4c51 - removed the less-parameters versions of P_SpawnPlayerMissile, because there was only one native call left to them. 2018-11-25 01:14:50 +01:00
Christoph Oelckers 460c400315 - scriptified ApplyKickback. 2018-11-25 01:12:45 +01:00
Christoph Oelckers e856e3c830 - moved the kickback code in P_DamageMobj into a subfunction.
This is a first attempt to reduce the complexity of that 600+ lines monstrosity, and also a good first target for scriptification.
2018-11-25 01:01:34 +01:00
Christoph Oelckers ae27acb944 - scriptified A_WeaponReady and its subfunctions. 2018-11-25 00:54:13 +01:00
Christoph Oelckers 5fcc96a0f2 - fixed: When extracting a MiniBSP for polyobject rendering, the parent subsector must copy all its relevant properties to the children.
The sections pointer was not copied here.
2018-11-25 00:38:04 +01:00
Christoph Oelckers 34b7e5f435 - scriptified P_BobWeapon as a virtual function on PlayerPawn. 2018-11-25 00:23:03 +01:00
Christoph Oelckers b75ee1027a - a little bit of cleanup on some code that repeatedly accessed some fields in AWeapon and produced far too many search results when looking for this. 2018-11-24 23:51:09 +01:00
Christoph Oelckers 8eb4697fbd - removed the bot related properties from AWeapon.
This stuff is now kept locally in the bot code so that it doesn't infest the rest of the engine.
And please don't read the new botsupp.txt file as some new means to configure bots! This was merely done to get this data out of the way.
The bots are still broken beyond repair and virtually unusable, even if proper data is provided for all weapons.
2018-11-24 23:48:23 +01:00
Christoph Oelckers ead28db007 - consolidated the 3 nearly identical code fragments handling the weapon's YAdjust for the different renderers into a utility function in DPSprite. 2018-11-24 22:40:14 +01:00
Christoph Oelckers 4392b4e96d - exported the blood spawning part of P_LineAttack as a virtual ZScript function. 2018-11-24 22:35:50 +01:00
Christoph Oelckers f260709e73 - moved the weapon selection logic to PlayerPawn as overridable virtual functions. 2018-11-24 22:22:36 +01:00
Christoph Oelckers 51ee623b3b - took the weapon selection logic out of the WeaponSlots data and blocked all direct access to the weapon slots internals
This seriously needs to be independent from the data store and better abstracted. More work to come to move this to its proper place.
2018-11-24 22:03:56 +01:00
Christoph Oelckers b6d0d5008e - change teleport freeze handling to a player property plus virtual override on PlayerPawn for increased configurability. 2018-11-24 21:37:00 +01:00
Christoph Oelckers 337750b874 - scriptified BecomeItem and BecomePickup 2018-11-24 21:25:26 +01:00
Christoph Oelckers 3d892d3970 - scriptified FilterCoopRespawnInventory. 2018-11-24 20:58:33 +01:00
Christoph Oelckers c14b7f58d3 - scriptified some simple sound functions. 2018-11-24 20:33:00 +01:00
Christoph Oelckers fb91982da2 - scriptified APlayerPawn::Die and fixed a few things I encountered while doing it. 2018-11-24 20:32:12 +01:00
Christoph Oelckers cf9cd58310 - scriptified ModifyDropAmount as a virtual function hierarchy for Inventory and children. 2018-11-24 19:59:24 +01:00
Christoph Oelckers 652606f70b - scriptified A_Explode and relatives. 2018-11-24 19:29:52 +01:00
Christoph Oelckers 44d51a6de9 - scriptified GetDefaultInventory. 2018-11-24 19:03:33 +01:00
Christoph Oelckers be100fa5d3 - removed MeleeWeapon flag from the tomed PhoenixRod and the fighterhammer.
In both cases, having this flag on will render the monster-backing-off-check for melee attacks ineffective because it would misinterpret these weapons as close range only - which they aren't. Even for the PhoenixRod the range is longer than what gets checked here.
As a consequence, the bot's check for missile shooting melee weapons has also become pointless because no such weapon is defined anymore.
2018-11-24 18:42:10 +01:00
Christoph Oelckers 814af66864 - exported one FraggleScript function for testing. 2018-11-24 18:33:42 +01:00
Christoph Oelckers 595208f2fd - exported a few more weapon handling functions so that the native GetDownState stub could be removed. 2018-11-24 18:21:40 +01:00
Christoph Oelckers d8aa39e03e - let player_t::Resurrect use P_BringUpWeapon to raise the weapon again instead of doing it directly.
This seems a bit safer.
2018-11-24 17:24:08 +01:00
Christoph Oelckers 9584e3bc53 - scriptified P_BringUpWeapon because this was the only native function still referencing AWeapon::GetReadyState. 2018-11-24 17:22:59 +01:00
Christoph Oelckers b4c272ddff - scriptified A_SpawnItem(Ex) and A_ThrowGrenade.
These were the last native functions referencing AWeapon::DepleteAmmo, so that function is now exclusively on the scripting side.
2018-11-24 17:01:12 +01:00
Christoph Oelckers 6be7fc33f3 - scriptified 3 more functions in stateprovider. 2018-11-24 15:42:43 +01:00
Christoph Oelckers 4c1b3f81ab - scriptified A_RailAttack. 2018-11-24 15:12:30 +01:00
Christoph Oelckers 5c130737c4 - scriptified A_CustomPunch 2018-11-24 14:48:30 +01:00
Christoph Oelckers 7bb3855439 - scriptified A_FireProjectile 2018-11-24 14:16:08 +01:00
Christoph Oelckers e071be8371 - scriptified A_FireBullets and A_CustomBulletAttack. 2018-11-24 13:50:27 +01:00
Christoph Oelckers 4440bff83a - deleted redundant native ActivateMorphWeapon method. 2018-11-24 13:08:44 +01:00
Christoph Oelckers 6fc63b9b78 - started with a ScriptUtil class which will allow moving function implementations for ACS and FraggleScript to zscript.txt
So far 3 functions for testing implemented.
2018-11-24 13:06:01 +01:00
Christoph Oelckers ac77ca6474 - scriptified Weapon.CheckAmmo and Weapon.DepleteAmmo 2018-11-24 11:29:57 +01:00
Christoph Oelckers bd84a60663 - scriptified the rest of the morph code. 2018-11-24 10:47:42 +01:00
Christoph Oelckers b267252a09 - fixed: Since out types cannot be marked as such in a function prototype (as it'd cause parameter mismatches in the resolving pass) it is necessary to check the argflags as well when determining the register type. 2018-11-24 09:34:53 +01:00
Christoph Oelckers ac1bffc51b - scriptified P_MorphMonster. 2018-11-24 09:33:03 +01:00
Christoph Oelckers 3ed7f4066d - fixed message output. 2018-11-24 08:41:07 +01:00
Christoph Oelckers cce1bad042 - testing and cleanup of scripted morph code. 2018-11-24 08:39:35 +01:00
Christoph Oelckers 78d6832d14 - P_UndoPlayerMorph scriptified.
Not tested yet and still missing a new native interface.
2018-11-24 08:17:30 +01:00
Christoph Oelckers 192104aea2 - scriptified P_MorphPlayer and dependencies.
It still needs its counterpart scriptified as well before it can work.
2018-11-24 07:45:49 +01:00
Marrub 2e2fe87445 Fix null pointer access in p_terrain.cpp 2018-11-24 07:29:26 +01:00
Magnus Norddahl 31ed1da4e5 Merge remote-tracking branch 'origin/master' into asmjit 2018-11-23 22:57:11 +01:00
Marisa Kirisame ee91cf77e4 expose defaultbloodcolor to ZScript. 2018-11-23 22:15:15 +01:00
alexey.lysiuk dc6ba6bd52 - fixed compilation of POSIX targets
src/doomerrors.h:74:14: error: exception specification of overriding function is more lax than base version
src/posix/sdl/i_main.cpp:272:28: error: 'class std::exception' has no member named 'GetMessage'
2018-11-23 15:14:15 +02:00
Magnus Norddahl 4e2cc1f144 - fix missing include statement 2018-11-23 12:13:53 +01:00
Magnus Norddahl ac62088690 - fix wrong attribute count passed to SetFormat
- fix missing include statement
2018-11-23 12:09:36 +01:00
Magnus Norddahl e02367dd09 - use std::runtime_error instead as the constructor on std::exception is a MSVC extension 2018-11-23 12:06:44 +01:00
Christoph Oelckers ce46f5165a Merge branch 'master' into asmjit 2018-11-23 11:12:52 +01:00
Christoph Oelckers bced30d1e3 - made CDoomError inherit from std::exception so that the main catch block can also deal with exceptions thrown by the STL.
- Also do not ignore empty exception messages as irrelevant. The only irrelevant exception type is CNoRunExit.
2018-11-23 10:18:52 +01:00
Christoph Oelckers 80c6505eee - fixed initialization of default parameters in dynamically created function calls like in the MENUDEF parser 2018-11-23 09:34:38 +01:00
Magnus Norddahl 6f397854d0 - inline VBTL opcode
- remove old META and CLSS implementations
2018-11-23 05:37:26 +01:00
Magnus Norddahl 9ef7212f54 - add return type to CreateFuncSignature 2018-11-23 05:20:12 +01:00
Magnus Norddahl be4b217608 - fix typo 2018-11-23 04:50:01 +01:00
Magnus Norddahl 3ba6290419 - add support in the jit compiler to do direct native calls using the x64 calling convention 2018-11-23 04:47:18 +01:00
Magnus Norddahl d4e630c127 - fix a rendering glitch when changing resolution 2018-11-23 03:00:11 +01:00
Magnus Norddahl 3e9f531b5f - add NUMA awareness to drawer threads 2018-11-22 14:48:09 +01:00
Rachael Alexanderson 4859c3d301 - fix inverted logic of Intel check 2018-11-22 02:02:37 -05:00
Magnus Norddahl b4aa4bf0ac - only use shader cache on Intel 2018-11-22 05:31:10 +01:00
Magnus Norddahl 48fd91227c - fix compile error 2018-11-21 10:46:13 +01:00
Magnus Norddahl dd42557e69 - implement a shader cache 2018-11-20 23:12:20 +01:00
Magnus Norddahl 216191c86d - interpolate the normal for models 2018-11-20 13:41:27 +01:00
Christoph Oelckers a5ee673c91 - exported ADecal to ZScript as a non-native class.
Its one function is still native but this was by far the easiest of the remaining actor classes to export.
2018-11-19 17:54:38 +01:00
Christoph Oelckers e90ed0a01c removed the quite redundant GetStateForButtonName function
Since it forwards directly to FindState and has no script bindings there is no need to keep it, it'd only complicate the full scriptification of the weapon class if it stuck around.
2018-11-19 18:26:23 +01:00
Christoph Oelckers ad04001135 - fixed some issues with the bodyque and moved this variable into FLevelLocals
* it was never saved in savegames, leaving the state of dead bodies undefined
* it shouldn't be subjected to pointer substitution because all it contains is old dead bodies, not live ones.
2018-11-19 18:13:23 +01:00
Christoph Oelckers 02de10f657 - cleaned up the PointerSubstitution code
Since the only thing it gets used for is swapping out PlayerPawns it can safely skip all global variables that never point to a live player, which allowed to remove quite a bit of code here that stood in the way of scriptifying more content
2018-11-19 17:05:00 +01:00
Christoph Oelckers 108874f379 - fixed the reginfo checks for the Draw... functions.
They need to be offset by the same amount as the arguments so that the values are properly matched.
2018-11-18 21:18:15 +01:00
Christoph Oelckers 8bc2d50ad2 Merge branch 'master' into asmjit
# Conflicts:
#	src/p_actionfunctions.cpp
2018-11-18 21:08:16 +01:00
Christoph Oelckers 426ee2b78e - fixed: Ceiling render hack segments were inserted into the floor list and incorrectly rendered. 2018-11-18 20:03:06 +01:00
Christoph Oelckers 3aef8418d9 - fixed the type checks for object arrays.
Null pointers must be allowed and non-object pointers which are not null must be explicitly checked for because the code could crash on them when performing a static_cast on an incorrect type.
2018-11-18 19:48:09 +01:00
Christoph Oelckers a9ec819557 - moved the type infomation entirely out of VMValue.
For the varargs functions that used the Type field to validate their parameters, now a hidden additional argument is passed which contains a byte array with the type info for the current call's arguments. Since this is static per call location it can be better prepared once when the code is being compiled instead of being put in a runtime created array for each invocation. Everything else uses the per-function instance of the same data.

The only thing that still needed the type field with a VMValue is the defaults array, so this uses a different struct type now to store its data.
2018-11-18 19:31:13 +01:00
Christoph Oelckers a981737855 - generate register type info for the parameter lists of all functions.
Currently used for loading parameters into registers.
For checking parameters of native functions some more work is needed to get the info to the function. Currently it doesn't receive the function descriptor.
2018-11-18 17:10:55 +01:00
Major Cooke a8d4d45e89 P_Thing_Raise fixes & cleanup
- Transfer flags directly into the function and process inside instead of the action functions
- Pass in raiser for all function calls
2018-11-18 15:28:05 +01:00
Magnus Norddahl 1ef772d017 - add missing CheckVMFrame call 2018-11-18 14:02:39 +01:00
Magnus Norddahl a8a9ec98f3 - only allocate stack space for vmframe and call returns when we need them 2018-11-18 13:49:19 +01:00
Magnus Norddahl 748dbec77a - improve dumpjit output slightly 2018-11-18 13:14:41 +01:00
Magnus Norddahl e778f05b12 - don't emit VMValue.Type information when we know the receiver isn't going to read it anyway 2018-11-18 12:59:53 +01:00
Magnus Norddahl 486b7e0f3c - delay emitting PARAM and VTBL instructions until CALL/CALL_K 2018-11-18 12:38:55 +01:00
alexey.lysiuk 4624c6e6a3 - use custom offsetof() macro
src/scripting/vm/jit_call.cpp:164:38: warning: offset of on non-standard-layout type 'VMScriptFunction' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:87:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:96:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:257:53: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
2018-11-18 12:48:50 +02:00
alexey.lysiuk e4c238b6c7 - fixed compilation of POSIX targets
src/scripting/backend/vmbuilder.h:169:19: error: no member named 'function' in namespace 'std'
2018-11-18 12:37:07 +02:00
Christoph Oelckers 28db04b501 - missed one OP_RESULT. 2018-11-18 10:09:29 +01:00
Christoph Oelckers fe0a341e0c - moved all code related to function calls into the helper class so that all future work on the calling convention is in one place only. 2018-11-18 10:02:31 +01:00
Christoph Oelckers cbedcff559 - moved all handling for the simple calls into EmitterArray to have it in one place only.
The main case of FxVmFunctionCall is not done yet, though.
2018-11-18 08:29:41 +01:00
Christoph Oelckers 629d329f22 - removed OP_TAIL.
The amount of support code for this minor optimization was quite large and this stood in the way of streamlining the VM's calling convention, so it was preferable to remove it before moving on.
2018-11-18 07:43:03 +01:00
Magnus Norddahl 4e0c5cf16c - fix compile errors 2018-11-18 03:28:57 +01:00
Christoph Oelckers 292cf93fa7 - fixed TArray's Append methods.
I mistakenly assumed that Grow would incease the array's reserved space.
2018-11-18 01:23:14 +01:00
Christoph Oelckers 983c0c56b1 - changed OP_PARAM handling so that all registers remain allocated until the call instruction and reordered instruction emission so that the param instructions all directly precede the call instruction. 2018-11-18 01:06:04 +01:00
Christoph Oelckers b2c07e731f - completed the Dehacked fix.
I missed some arguments that were specified but set to 'not given'.
2018-11-17 21:33:21 +01:00
Christoph Oelckers 5180265ab1 - fixed: The Dehacked function wrappers now need full parameter lists. 2018-11-17 21:21:23 +01:00
Christoph Oelckers 533f66396d Merge branch 'master' into asmjit 2018-11-17 20:16:03 +01:00
Christoph Oelckers 45ef7bca4f - fixed: FTexture::SmoothEdges must forward its result to the base texture in case a redirection is in effect.
Both need the bMasked flag, or some code will think that the texture is not fully opaque if no holes were found.
2018-11-17 18:55:44 +01:00
Christoph Oelckers 08fe9c375b - use the same formula for calculating 3DMidTex offsets as the renderer when per-sidedef scaling is used.
This reuses the FTexCoordInfo class the hardware renderer had been using to calculate wall texture offsetting.
The software renderers still need this sorted out to bring them in line with the rest of the code, though, but they do not have this code sufficiently well organized to make this a straightforward task.
2018-11-17 18:24:14 +01:00
Magnus Norddahl 7e0dacdb1d - disabled code that shows how a thunk function and native setup would look like 2018-11-17 16:26:54 +01:00
Christoph Oelckers 701b793f24 - fixed parameter mixup with P_CanResurrect. 2018-11-17 16:21:08 +01:00
Christoph Oelckers 160f17a907 - fixed stencil cap generation for old hardware and changed it so that it only gets done once for each stencil setup, not for each stencil pass. 2018-11-17 15:34:23 +01:00
Christoph Oelckers bb4007f16a - fixed: CVar.ResetToDefault was missing a check for use outside of menus. 2018-11-17 15:23:57 +01:00
Christoph Oelckers 89cec539fa - fixed IJMP code generation for the JIT compiler.
With a proper count value available this can be done properly. The only relevant targets are the jumps immediately succeeding the IJMP instructions, nothing else.
2018-11-17 13:39:14 +01:00
Christoph Oelckers fcb5684607 - do not use instructions from too recent instruction set extensions.
andn is part of BMI1 which was introduced in 2012, which is far too recent to be used unchecked.
2018-11-17 13:10:18 +01:00
Christoph Oelckers adde0510fe - deconstruct A_Jump with multiple labels into A_Jump(chance, RandomPick(label1, label2, label3,...)) to remove this ugly special case from the VM calling convention.
This also adds the number of available choices to OP_IJMP.
2018-11-17 12:35:03 +01:00
Magnus Norddahl 68afc419af - inline ReadBarrier, GetClass and GetClassMeta 2018-11-17 10:54:16 +01:00
Christoph Oelckers 6398c27646 - fixed RNG setup in FxRandom. 2018-11-17 10:06:01 +01:00
Christoph Oelckers 94ed30e782 - removed the default parameter handling from all native script functions because it is no longer needed. 2018-11-17 10:03:40 +01:00
Christoph Oelckers e643582957 - fixed FxFRandom setup which used a path in FxRandom that is no longer supported. 2018-11-17 08:06:23 +01:00
Magnus Norddahl f99bba48dc - stop using lambda functions for CreateCall because MSVC lambas use a different calling convention and "converts" them to the right one by generating a thunk function 2018-11-17 05:12:47 +01:00
Magnus Norddahl f082a8af98 - removed the SetupSimpleFrameMissingArgs logic as the number of args are now guaranteed 2018-11-17 00:49:22 +01:00
Magnus Norddahl 8ec85cb0ee - add warning text when falling back to the VM 2018-11-17 00:36:40 +01:00
Christoph Oelckers 6423902c63 - removed the unused 'no arguments' cases from the BuiltinRandom functions and split off BuiltinRandom2 into its own function.
This removes the last non-vararg cases where a native VM function checks 'numparam'. As of this commit all function calls will pass the complete list of arguments.
2018-11-17 00:14:39 +01:00
Magnus Norddahl ea26bf6b2f - make functions using too many registers (more than 200) fall back to the VM 2018-11-17 00:04:15 +01:00
Christoph Oelckers 95ab1da6a0 - always pass complete argument lists in the VM. 2018-11-16 22:43:12 +01:00
Christoph Oelckers 16053c7cdb - build full argument lists for action function calls.
This uses one static global array to avoid frequent reallocations.
2018-11-16 20:38:52 +01:00
Christoph Oelckers 97573a0452 - implemented VMCallWithDefaults and used it for all calls with variable arguments.
This isn't used for the 3 action function calls because it requires an array allocation which would be a bit too costly for something as frequently called as action functions.
They will need a different approach.
2018-11-16 19:18:33 +01:00
Christoph Oelckers 6d7710165c - fixed last commit. 2018-11-16 18:50:34 +01:00
Christoph Oelckers c24da62cdd - marked all places where an incomplete parameter list may be passed to the VM by a native call by redirecting VMCall to an intermediate VMCallWithDefaults. This function must later fill in the missing arguments from the default. 2018-11-16 18:41:27 +01:00
Christoph Oelckers acbdfddb26 Merge remote-tracking branch 'remotes/origin/master' into asmjit 2018-11-16 17:20:12 +01:00
Christoph Oelckers 33fb76698b Avoid using argument count for any kind of decision making in native VM functions.
This allows retaining the functionality, even if for the JIT compiler's benefit all default arguments are pushed onto the stack instead of reading them from the defaults array.
2018-11-16 15:25:37 +01:00
Christoph Oelckers 8c57447108 - Restricted argument count check to the void return case.
There were some issues here:

* a check for mismatching count is too strict because it is legal to omit return values
* it failed to detect returning multiple values in a single expression.
2018-11-16 12:28:24 +01:00
Christoph Oelckers 358001c306 fixed right shift operator for unsigned values
This is version protected to avoid breaking old code.
2018-11-16 11:32:24 +01:00
Christoph Oelckers 7cd89fe07b - fixed: FxUnaryNotBitwise modified the source operand instead of allocating a new one. 2018-11-16 11:21:51 +01:00
Christoph Oelckers 1250eb5323 - fixed: AActor' friction field was not saved 2018-11-16 08:06:01 +01:00
Magnus Norddahl ac28f0d34f - remove unused argument 2018-11-16 01:33:41 +01:00
Magnus Norddahl 34b037c9db - avoid calling VMFillParams for simple stack frames
- split Setup into more functions
2018-11-16 01:13:25 +01:00
Player701 c569029b1d - Readonly pointer casting now works in ZScript. 2018-11-15 23:28:37 +01:00
Magnus Norddahl 6c31d2e965 - add dword store to memset code 2018-11-15 23:04:11 +01:00
Magnus Norddahl 00d41432d8 - disable jit in 32-bit builds 2018-11-15 22:47:44 +01:00
Magnus Norddahl 5ef2175c38 - fix wrong offsets 2018-11-15 22:40:12 +01:00
Magnus Norddahl 0394dc56b7 - generate a memset for the allocated stack memory because that's what the VM does
(this really shouldn't be done by the VM either - the compiler backend should clear its registers if it wants them to be zero!)
2018-11-15 22:33:13 +01:00
Magnus Norddahl f3e0db913c - fix operand size mismatch error 2018-11-15 22:07:27 +01:00
Magnus Norddahl 3b2faf5397 Merge remote-tracking branch 'origin/master' into asmjit 2018-11-15 22:02:11 +01:00
Christoph Oelckers 47138b748a Make BounceFlags 32 bit wide. 2018-11-15 16:53:19 +01:00
Cacodemon345 07838f4c2a BOUNCEONUNRIPPABLES flag; makes actors bounce on actors with DONTRIP flag 2018-11-15 12:47:57 +01:00
alexey.lysiuk 39a3527396 - fixed compilation of targets with optimization 2018-11-15 10:59:37 +02:00
Christoph Oelckers aa4de71e6d Merge branch 'master' into asmjit 2018-11-15 09:25:27 +01:00
Christoph Oelckers cf590d73e4 - extended state caller check to work on CustomInventory items as well
Since CallStateChain is a public member in CustomInventory we cannot really be sure that the given state is valid so it needs checking as well.
2018-11-15 09:24:17 +01:00
Christoph Oelckers 0a21d19723 Added a run time check for calling a state action from the wrong actor type.
This can happen if a state that's retrieved with FindState gets used with a different actor type and can lead to hard to trace problems if not checked.
2018-11-15 09:04:38 +01:00
Chronos Ouroboros 96b8f12a30 Fix the code for MODF_RK in the JIT compiler. 2018-11-14 21:05:24 -02:00
Christoph Oelckers 9f6091519f - changed the stencil cap drawer to only cover the area which is actually used by the portal.
This will now both exclude floor caps when only ceiling elements are used and everything outside the bounding box of active portal lines.
Hopefully this is enough to fix the issues with portal caps but of course it is not foolproof if someone just makes the right setup.
2018-11-14 23:30:46 +01:00
Christoph Oelckers a23d1c2d25 - went back to the original portal stencil setup from 3.4.0.
The main reason is to unify the portal hierarchy again. The split into a hardware independent and a hardware dependent part turned out to be unnecessary and complicated matters.
Another issue was that the new stencil setup code was having a few subtle problems, so this recreates the original ones with indirect API calls.
2018-11-14 21:03:54 +01:00
Chronos Ouroboros 566eb58000 Fixed the Vector2/3 != operator. 2018-11-14 20:01:13 +01:00
Chronos Ouroboros 5375a99cf6 Added support for CMP_APPROX to EQV_R and moved the code to a template. 2018-11-14 10:29:48 -02:00
Magnus Norddahl 8429fc8124 - fix missing type check when using Push or Insert for typed arrays 2018-11-14 10:08:04 +01:00
Magnus Norddahl 99849bc0c5 Merge remote-tracking branch 'origin/master' into asmjit 2018-11-14 01:23:17 +01:00
Christoph Oelckers a6b44b02b7 - fixed incompletely initialized secplanes in sprite splitting code.
The recent optimization of the shader setup needs the negiC value properly set.
2018-11-13 20:36:23 +01:00
Major Cooke 55f17fa90c Changed A_RaiseActor to just RaiseActor. 2018-11-13 19:01:56 +01:00
Major Cooke f47210df4e Fixed inconsistency.
- P_Thing_Raise returned true while P_Thing_CanRaise returned false for the condition of having no raise state. P_Thing_Raise now returns false.
2018-11-13 19:01:56 +01:00
Major Cooke 71d2b39d92 Added A_RaiseActor(Actor other, int flags = 0) 2018-11-13 19:01:56 +01:00
Major Cooke b553be153d Added CanResurrect(Actor other, bool passive)
- Works similarly to CanCollideWith.
- Passive means the caller is trying to be resurrected by 'other'.
- Non-passive means the caller is trying to resurrect 'other'.
2018-11-13 19:01:56 +01:00
Christoph Oelckers 33f2f9f34e - fixed: ZScript's finalization code used the last parsed lump for of one translation unit as reference, not the base lump.
This resulted in incorrect messages but also could produce some more subtle errors.
2018-11-12 00:22:50 +01:00
Christoph Oelckers ca2defa6a2 - added ZScript export for side_t::SetSpecialColor. 2018-11-12 00:13:14 +01:00
Christoph Oelckers 65a6866a1b - fixed typo in ceiling render hack code. 2018-11-11 22:22:29 +01:00
Christoph Oelckers 59790302ec - fixed rendering of lower untextured linedef parts. 2018-11-11 22:17:44 +01:00
Christoph Oelckers a0a2230b92 - removed test code that was accidentally left in. 2018-11-11 21:50:33 +01:00
Christoph Oelckers f2dcff4386 - more options for Doom 64 style gradients on walls:
* Colors can npw be defined per sidedef, not only per sector.
* Gradients can be selectively disabled or vertically flipped per wall tier.
* Gradients can be clamped to their respective tier, i.e top and bottom of the tier, not the front sector defines where it starts.

The per-wall colors are implemented for hardware and softpoly renderer only, but not for the classic software renderer, because its code is far too scattered to do this efficiently.
2018-11-11 16:04:36 +01:00
Player701 d37192c1e8 - Fixed: Decal generator should be taken from the current weapon instance instead of the default instance. 2018-11-11 15:07:57 +01:00
Christoph Oelckers d3aa9c6af1 - do not abort on unclosed sections.
Apparently they can indeed happen with broken map setups like isolated linedefs somewhere in the wild (see Strife MAP08.)
Although they are a problem for triangulation, this isn't what sections get used for currently so it's of no real concern.
In case this is needed later their work data gets marked as 'bad' for the time being.
2018-11-11 10:08:13 +01:00
Christoph Oelckers 094afdfd5f - fixed: It may happen that a degenerate subsector ends up without any section or sector. Try to assign the best fit in such a case so that the relevant pointers are not null. 2018-11-11 09:33:40 +01:00
Christoph Oelckers c946edd9bf - instead of copying the sector planes to GLWall, just store pointers to the front and back sector for later use.
Until now this wasn't doable because these could have come from hw_FakeFlat which only were local copies on the stack.
With the recent change these faked sectors live long enough so that they can be passed around here.
2018-11-10 23:19:08 +01:00
Magnus Norddahl e6023c55a8 - modify exception checks to jump ahead if the exception is to be thrown as it limits static misprediction 2018-11-10 22:48:20 +01:00
alexey.lysiuk 67e012e445 - fixed compilation on POSIX-like platforms
src/p_udmf.cpp:2052:6: error: no matching member function for call to 'OpenMem'
src/sc_man.h:24:7: note: candidate function not viable: expects an l-value for 2nd argument
src/sc_man.h:23:7: note: candidate function not viable: requires 3 arguments, but 2 were provided
src/resourcefiles/file_directory.cpp:198:32: error: use of undeclared identifier 'Filename'; did you mean 'FileName'?
2018-11-10 22:32:09 +02:00
Christoph Oelckers a90655b295 - cache the results of hw_FakeFlat for the remainder of the current scene instead of storing this in local variables.
An exception is made for the sprite drawer which needs to call this in the worker thread on some occasions for as-yet unprocessed sectors.
This case may not alter the cache to avoid having to add thread synchronization to it.

The main reason for this change is that pointers to such manipulated sectors can now be considered static in the renderer.
Due to them being short lived local buffers it was not possible to carry them along with the render data for information retrieval.
2018-11-10 20:07:00 +01:00
Magnus Norddahl a7ef178284 - fix a typo 2018-11-10 19:56:54 +01:00
Magnus Norddahl 173fe94736 - fix the throw messages 2018-11-10 19:52:41 +01:00
Major Cooke 9a7f570b19 Added DMG_NO_ENHANCE for DamageMobj.
- Disables PowerDamage's effect, similar to DMG_NO_PROTECT disabling PowerProtect.
2018-11-10 16:18:33 +01:00
Christoph Oelckers 191f2d9d76 - use TArray and FString in resource file management. 2018-11-10 14:19:55 +01:00
Christoph Oelckers 4d06c17a44 - a few more buffers converted. 2018-11-10 14:18:34 +01:00
Christoph Oelckers 6894912f44 - use TArray for most buffers in p_glnodes.cpp. 2018-11-10 14:15:39 +01:00
Christoph Oelckers 3448749de6 - replaced a few temporary allocations with TArray and added a few convenience loader functions for this.
Amazingly with today's optimizers this creates code which is just as good as doing it all manually with the added benefit of being safer.
2018-11-10 11:56:18 +01:00
Christoph Oelckers 602ea8f723 - made some minor changes to TArray after finding out that "new int()" is not the same as "new int".
With parentheses this initializes to 0 which created needless initialization code in a few places.
2018-11-10 10:43:35 +01:00
Christoph Oelckers cfe51f0c30 - hole filling subsectors must also be explicitly triangulated for the automap because they may be non-convex. 2018-11-10 08:04:03 +01:00
Christoph Oelckers fb7345e470 Merge branch 'master' into asmjit 2018-11-09 22:36:16 +01:00
Christoph Oelckers 3c5609537a - fixed vector math instructions to use the same order of operations as the VM. 2018-11-09 22:36:08 +01:00
Christoph Oelckers 0caabbe355 - clear spechit before leaving P_CheckPosition.
Otherwise this may contain residual data from the last call.
One can only hope that this doesn't cause other side effects - this entire code is one horrendous mess of bad ideas.
2018-11-09 19:06:54 +01:00
Christoph Oelckers f6af50fc74 - restored portal code that shouldn't have been deleted. 2018-11-08 20:39:44 +01:00
Major Cooke cdd60b1431 Changed IsPointInMap to use P_PointOnDivlineSide. 2018-11-08 14:50:04 +01:00
alexey.lysiuk ed72843dec - fixed undefined behavior when grouping sections
The current group should not be accessed by reference because its container can be reallocated during iteration

https://forum.zdoom.org/viewtopic.php?t=62487
2018-11-07 23:04:42 +02:00
Major Cooke 9ff7f338fd Added IsPointInMap(Vector3 p).
- Checks if a point is inside the map geometry or not.
2018-11-07 15:16:45 -05:00
Christoph Oelckers 4eecaada67 - added copyright header to p_destructible.cpp 2018-11-07 19:27:35 +01:00
Christoph Oelckers 9661c3b53c - moved hw_Sections to r_data, because this is an essential component of the dynamic light system now so it is needed for all renderers. 2018-11-07 00:53:44 +01:00
Christoph Oelckers bad2a7c49b - silenced debug message in standard mode. 2018-11-07 00:43:11 +01:00
ZZYZX a276ebfb08 Exported destructible geometry to ZScript 2018-11-07 00:12:37 +01:00
ZZYZX ed3355acc6 Explode bouncing projectiles if hit damageable geometry 2018-11-07 00:12:37 +01:00
ZZYZX d85e5afdfb Destructible geometry - minor fixes and 3D floor support 2018-11-07 00:12:37 +01:00
Christoph Oelckers 752a64c840 - fixed typo in sight checking code. 2018-11-07 00:12:03 +01:00
Christoph Oelckers c28f001cb2 Merge branch 'sections' 2018-11-06 23:50:16 +01:00
Christoph Oelckers f2e593f8bf - disabled the hack for fixing the original design of the portal in KDiZD's Z1M1.
This portal got fixed in a later re-release of KDiZD and no other portal needs this runtime fix to my knowledge.
The main problem here is that this runtime fix requires some manipulation of the render data that does not work anymore.

Should other maps need this fix as well they are probably best served with a compatibility entry.
2018-11-06 21:41:16 +01:00
Christoph Oelckers 085bf0d33f - fixed Transfer_Heights and 3D floors. 2018-11-06 20:53:45 +01:00
Christoph Oelckers ddc75f7ba5 - made the common render hacks functional again as separate render items. 2018-11-06 20:31:44 +01:00
Christoph Oelckers a6e77ae094 Refactored the render hack storage so that it can be decoupled from the regular GLFlat render items.
Having these in there makes it impossible to change render techniques so these are better done as separate items.
2018-11-06 18:20:59 +01:00
Christoph Oelckers aee47d23bd - fixed validcount for real and added a side check for intra-section sides to light code. 2018-11-06 11:53:03 +01:00
Christoph Oelckers df52a71475 - fixed validcount. 2018-11-06 01:01:59 +01:00
Christoph Oelckers 87973ff504 - added handling for intra-sector lines to lighting code. 2018-11-06 00:47:43 +01:00
Christoph Oelckers ba66c0c889 - changed dynamic light traversal to use sections instead of the subsectors.
This is mostly complete, except for handling intra-section sidedefs.
2018-11-06 00:13:23 +01:00
Christoph Oelckers 9ddca3c3a9 - removed the subsector light lists as a preparation step to move over the light traversal code to use sections instead of subsectors. 2018-11-05 22:35:24 +01:00
Christoph Oelckers 375dd7e28f - the sections are now being used as the smallest element to draw flat planes.
This also removes one piece of code that was used to cope with the missing clip planes on old ATI cards, so support for those will most likely have to be dropped in the near future.
2018-11-05 22:14:18 +01:00
Christoph Oelckers 50bd9c3594 - flatvertex generation is working again. 2018-11-05 21:29:57 +01:00
Christoph Oelckers 625eb1e76a - FVertexBuilder's output looks correct now. 2018-11-05 21:11:54 +01:00
Christoph Oelckers 950ed07ae6 WIP 2018-11-05 15:30:50 +01:00
Christoph Oelckers d7db00d92e - sector rendering refactoring for sections - work in progress. 2018-11-05 01:01:48 +01:00
Christoph Oelckers 0deb388a75 - automatically create sections and store them with the level data.
- added subsector indexing to sections.

This is needed for finding a section from a point.
2018-11-04 22:19:11 +01:00
Christoph Oelckers 705c87c6cc - fixed bad case in #include. 2018-11-04 21:33:35 +01:00
Christoph Oelckers c847180bdc - reinstated the sector light clamping threshold from before version 3.3.
It turned out that without the clamping the feature does not work well, thanks to a poorly chosen scale of the original arguments.
2018-11-04 20:57:18 +01:00
Christoph Oelckers 49bfdbef9f - create an intermediate structure between sectors and subsectors.
A section is a continuous part of a sector or in some case of several nearby continuous parts. For sectors with far away parts multiple sections will be created, especially when they lie in disjoint parts of the map.
This is mainly supposed to cut down on time for linking dynamic lights. Since they need to traverse subsectors to find all touching sidedefs a more coarse data structure that only contains the info needed for this is more suitable. In particular, this does not contain any intra-sector lines, i.e. those with both sides in the same sector.
2018-11-04 20:10:51 +01:00
Player701 9b7114a96d - undid the save version bump 2018-11-04 19:58:57 +01:00
Player701 56f76a141e - Added a function to get the actor's age in ticks. 2018-11-04 19:58:57 +01:00
Player701 a6dbfcf9c2 - Added a new field to the Actor class which stores the amount of ticks passed since the game started on the moment the actor was spawned.
- Added a function to the Actor class to get its spawn time relative to the current level.
- Added spawn time information to the output of the "info" console command.
2018-11-04 19:58:57 +01:00
Cacodemon345 b1d35eb0b3 Extend SKYEXPLODE flag for LineAttack 2018-11-03 15:24:30 +01:00
alexey.lysiuk 53bf598aee - restored screen clear in Cocoa backend when setting video mode
This still doesn't work well in windowed mode
In fullscreen the effect is quite noticeable thought
2018-11-03 13:09:30 +02:00
Christoph Oelckers 1ccbbcb81d - added a method to FileReader to read the contents into an array and used it on the MIDI sources for testing. 2018-11-02 10:20:12 +01:00
Christoph Oelckers c07aeb7498 - use a single TArray to allocate the memory for the lump manager's hash lists. 2018-11-02 09:51:44 +01:00
Magnus Norddahl 534606f4ce - add vm_jit cvar to control JIT compilation 2018-11-01 21:39:30 +01:00
Magnus Norddahl 369dcfd57f Merge remote-tracking branch 'origin/master' into asmjit 2018-11-01 21:23:26 +01:00
alexey.lysiuk 8597c9e326 - added warning for constant conditional expression
ZScript code like `if (x = 0) // ...` no longer causes assertion failure in Debug but produces a warning regadless of configuration

https://forum.zdoom.org/viewtopic.php?t=62422
2018-11-01 16:05:27 +02:00
alexey.lysiuk d99aeb0895 - fixed potential crash when drawing status bar log
src/g_statusbar/shared_sbar.cpp:1133:34: warning: comparison of integers of different signs: 'unsigned int' and 'int'
[-Wsign-compare]
2018-11-01 13:37:11 +02:00
alexey.lysiuk 504a7f00b6 - fixed two potentially dangerous compilation warnings
src/hwrenderer/dynlights/hw_lightbuffer.h:51:29: warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]
src/hwrenderer/scene/hw_renderstate.h:196:44: warning: operation on '((FRenderState*)this)->FRenderState::mVertexOffsets[0]' may
be undefined [-Wsequence-point]
2018-11-01 12:51:22 +02:00
Christoph Oelckers b9f2cce8de - versioned the return mismatch check to demote it to a warning for older versions than 3.7. 2018-11-01 11:30:53 +01:00
alexey.lysiuk d3461be40c - made 'return void' case a compilation error 2018-11-01 11:18:22 +01:00