Commit graph

14193 commits

Author SHA1 Message Date
alexey.lysiuk
9aeeb0dc0f - fixed compilation of POSIX targets
Making callstack resolving operational will require a little bit more effort

src/scripting/vm/jit_runtime.cpp:900:31: error: use of undeclared identifier 'frames'
src/scripting/vm/jit_runtime.cpp:903:23: error: use of undeclared identifier 'cnt'
2019-04-18 14:00:35 +02:00
Magnus Norddahl
a01a468ef8 - add support for writing the native call stack 2019-04-18 14:00:34 +02:00
Magnus Norddahl
e1ed87a64f - improve the stack trace when the jit is active 2019-04-18 14:00:31 +02:00
Christoph Oelckers
77c00d7670 - replaced several explicit allocations with TArrays.
# Conflicts:
#	src/r_data/models/models_voxel.cpp
#	src/textures/formats/jpegtexture.cpp
#	src/textures/formats/pcxtexture.cpp
#	src/textures/formats/tgatexture.cpp

# Conflicts:
#	src/r_data/voxels.cpp
#	src/r_data/voxels.h
2019-04-18 13:58:37 +02:00
drfrag
846f53ba1e - Fixed compilation with MinGW-w64 64 bit. 2019-04-18 13:51:17 +02:00
Christoph Oelckers
f702f6e19e - use TArrays for MD3 storage.
# Conflicts:
#	src/r_data/models/models_md3.cpp
2019-04-18 13:15:00 +02:00
Christoph Oelckers
a9ad3a1e52 - fixed two broken ScriptUtil calls in FraggleScript. 2019-04-18 13:14:51 +02:00
Christoph Oelckers
e87d04d843 - added a 'forceworldpanning' map flag.
Since unfortunately this cannot be set as a general default, let's at least make it as easy as possible to disable that panning+scaling madness without having to edit the texture data.

# Conflicts:
#	src/swrenderer/textures/r_swtexture.h
#	src/textures/texture.cpp

# Conflicts:
#	src/textures/texture.cpp
2019-04-18 13:14:32 +02:00
Christoph Oelckers
c0e9530fd0 - fixed: The light defaults were not fully deleted on an engine restart. 2019-04-18 13:12:55 +02:00
Christoph Oelckers
7e2540732d - store UnchangedSpriteNames in Dehacked in a less hacky manner. 2019-04-18 13:12:53 +02:00
Christoph Oelckers
71e77defa3 - use a TArray to store the particles and remove all 16 bit global variables.
This means one less exit function to deal with - and these days 16 bit variables are a pointless attempt at saving space.
2019-04-18 13:12:51 +02:00
Christoph Oelckers
cee9f52f2f - improved error reporting for badly defined translations.
This needs to be handled by the caller for all use cases because the translation parser lacks the context to do a proper error report.

# Conflicts:
#	src/textures/multipatchtexture.cpp
2019-04-18 13:07:39 +02:00
Christoph Oelckers
ce6b24308e - fixed: sidedef-less GLWalls may not apply per-sidedef render properties.
These always come from open-sector render hacks where the renderer tries to fill in some gaps

# Conflicts:
#	src/hwrenderer/scene/hw_walls.cpp

# Conflicts:
#	src/gl/scene/gl_walls_draw.cpp
2019-04-18 13:05:44 +02:00
Christoph Oelckers
988e8042bb - two more places where explicit allocations could be replaced. 2019-04-18 13:02:23 +02:00
Christoph Oelckers
d4611683a6 - let FxNop have a value type, even if it's just TypeError. 2019-04-18 13:02:21 +02:00
Magnus Norddahl
bafc5e6a3c - add vanilla lightmode that behaves exactly as Doom's original light did
# Conflicts:
#	src/hwrenderer/scene/hw_drawinfo.cpp
#	src/hwrenderer/scene/hw_renderstate.cpp
#	src/hwrenderer/scene/hw_renderstate.h
#	src/hwrenderer/scene/hw_skyportal.cpp
#	src/hwrenderer/scene/hw_weapon.cpp

# Conflicts:
#	src/g_level.cpp
#	src/gl/compatibility/gl_20.cpp
#	src/gl/renderer/gl_lightdata.cpp
#	src/gl/renderer/gl_renderstate.h
#	src/gl/scene/gl_skydome.cpp
#	src/gl/scene/gl_weapon.cpp
#	src/hwrenderer/scene/hw_weapon.cpp
#	src/hwrenderer/utility/hw_lighting.cpp
2019-04-18 12:50:03 +02:00
Rachael Alexanderson
f442d4bd54 - split gl_texture_hqresize into two variables - one for mode, one for multiplier.
# Conflicts:
#	src/textures/hires/hqresize.cpp

# Conflicts:
#	src/gl/textures/gl_hqresize.cpp
#	src/r_videoscale.cpp
2019-04-17 21:04:41 +02:00
Rachael Alexanderson
301246236c - added normal5x and normal6x 2019-04-17 20:59:20 +02:00
drfrag
96f996d8aa Revert "Revert "- update xBRZ upscaler to version 1.6""
This reverts commit 285791622d.

# Conflicts:
#	src/gl/textures/gl_hqresize.cpp
#	wadsrc/static/menudef.txt

Goodbye to TDM-GCC.
2019-04-17 20:33:41 +02:00
Christoph Oelckers
c47549c009 - code simplification. 2019-04-17 20:00:29 +02:00
Christoph Oelckers
4cdfd7ff33 - fixed incorrect alignment of scaled world panned textures combined with per-sidedef scaling in the hardware renderer
This particular case incorrectly factored in the sidedef's scaling factor for how to calculate the offset.
Fortunately this is a very rare case - a quick check yielded no maps depending on it.
Should any map surface that depends on this bug a compatibility option may be needed but it doesn't seem likely that this may be the case.
2019-04-17 20:00:28 +02:00
alexey.lysiuk
a93807833a - disable music playback if WinMM stream cannot be opened
https://forum.zdoom.org/viewtopic.php?t=62888
2019-04-17 19:59:16 +02:00
alexey.lysiuk
ec432beea0 - print VM stack trace on startup abort exception
https://forum.zdoom.org/viewtopic.php?t=62650
2019-04-17 19:57:22 +02:00
Christoph Oelckers
3a3ae0bcd5 - fixed deprecation warnings for member functions not checking the version. 2019-04-17 19:44:10 +02:00
Christoph Oelckers
8ad73d32b8 - fixed: The JIT compiler crashed on missing ArgFlags.
For ad-hoc Dehacked state functions no ArgFlags are created, in this case they can just be assumed to not be relevant here, because none of these function produces reference arguments.
2019-04-17 19:44:07 +02:00
alexey.lysiuk
e6590f6ad9 - fixed return value of native call to dynamic array's Reserve()
https://forum.zdoom.org/viewtopic.php?t=62841
2019-04-17 19:44:05 +02:00
alexey.lysiuk
c4aa2c5e46 - server CVARs can be changed only by settings controller
Initially, settings controller flag was false by default
It was not touched during construction and destruction of player_t instances though
Now, with all members initialized in class definition, this flag must be saved and restored manually

https://forum.zdoom.org/viewtopic.php?t=62830
2019-04-17 19:44:04 +02:00
Magnus Norddahl
e4502de60b - workaround pointer truncation bug in asmjit 2019-04-17 19:44:02 +02:00
alexey.lysiuk
651dce449a - removed erroneous assertion
https://forum.zdoom.org/viewtopic.php?t=62815
2019-04-17 19:44:00 +02:00
alexey.lysiuk
9b49c6777d - fixed Actor.A_StopSound() native call
Wrong function overload was selected by compiler

https://forum.zdoom.org/viewtopic.php?t=62820
2019-04-17 18:44:14 +02:00
Magnus Norddahl
60a35e0bb3 - moved argsCache out of JitCompiler::CreateFuncSignature 2019-04-17 18:44:12 +02:00
Christoph Oelckers
10aea91745 - don't put mutexes into static local variables.
Their initialization semantics are not safe for synchronization objects.
2019-04-17 18:44:08 +02:00
Christoph Oelckers
da8686813d - fixed crash with FraggleScript in Nimrod MAP02. 2019-04-17 18:40:00 +02:00
alexey.lysiuk
84c7a810b1 - fixed broken Z coordinate in Actor.Vec3Angle() native call 2019-04-17 18:39:56 +02:00
alexey.lysiuk
7ba1e5945f - fixed native calls to LevelLocals.GetUDMF*() functions
https://forum.zdoom.org/viewtopic.php?t=62774
2019-04-17 18:39:53 +02:00
Christoph Oelckers
c90e4b773a - this "genuine hack" was totally redundant... 2019-04-17 17:44:07 +02:00
Christoph Oelckers
a6ff1637df - more direct native stuff, this is a week old but was almost forgotten.
# Conflicts:
#	src/hwrenderer/postprocessing/hw_postprocessshader.cpp
2019-04-17 17:42:24 +02:00
Christoph Oelckers
013040eacd - missed one definition for adding a direct native call. 2019-04-17 17:27:42 +02:00
Christoph Oelckers
cf4f573a25 - more direct native entry points.
- disallow bool as a return value for direct native calls because it only sets the lowest 8 bits of the return register.
- changed return type for several functions from bool to int where the return type was the only thing blocking use as direct native call.
2019-04-17 17:27:39 +02:00
Christoph Oelckers
082cb5b656 - scriptified P_CheckMeleeRange2. 2019-04-17 16:24:10 +02:00
Christoph Oelckers
c054389345 - fixed: Direct native functions for the JIT compiler may not return bool.
A bool will only set the al register on x64, but the entire eax needs to be set for the JIT code to deal with it.
2019-04-17 16:24:07 +02:00
Christoph Oelckers
15ab1fb09b - deprecated a few functions that depend on AAPTR_* to be useful.
- fixed wrong name for the LineAttack action function.
2019-04-17 16:24:05 +02:00
alexey.lysiuk
3252390642 - fixed linking of optimized targets
CMakeFiles/zdoom.dir/r_utility.cpp.o: In function `R_SetupFrame(FRenderViewpoint&, FViewWindow&, AActor*)':
/home/travis/build/coelckers/gzdoom/src/r_utility.cpp:832: undefined reference to `AActor::GetCameraHeight() const'
CMakeFiles/zdoom.dir/g_shared/a_action.cpp.o: In function `A_Unblock(AActor*, bool)':
/home/travis/build/coelckers/gzdoom/src/g_shared/a_action.cpp:64: undefined reference to `AActor::GetDropItems() const'
2019-04-17 15:11:26 +02:00
Christoph Oelckers
61b91f4897 - fix it 2019-04-17 15:11:24 +02:00
Christoph Oelckers
792aaa5b88 Added direct native entry points to a larger number of functions.
# Conflicts:
#	src/scripting/vmthunks_actors.cpp
2019-04-17 15:11:22 +02:00
alexey.lysiuk
ab111aa034 - fixed linking of optimized POSIX targets
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_Distance2DSquared(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x6ab): undefined reference to `AActor::PosRelative(AActor const*) const'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_Distance3DSquared(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x75f): undefined reference to `AActor::PosRelative(AActor const*) const'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_Vec3To(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x850): undefined reference to `AActor::PosRelative(AActor const*) const'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_Vec2To(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x930): undefined reference to `AActor::PosRelative(AActor const*) const'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_DistanceBySpeed(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0xa00): undefined reference to `AActor::PosRelative(AActor const*) const'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o:vmthunks_actors.cpp:(.text+0xad3): more undefined references to `AActor::PosRelative(AActor const*) const' follow
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_PosRelative(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x1200): undefined reference to `AActor::PosRelative(sector_t*) const'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_ClearInterpolation(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x127d): undefined reference to `AActor::ClearInterpolation()'
vmthunks_actors.cpp:(.text+0x1298): undefined reference to `AActor::ClearInterpolation()'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_GetBobOffset(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x135a): undefined reference to `AActor::GetBobOffset(double) const'
CMakeFiles/zdoom.dir/scripting/vmthunks_actors.cpp.o: In function `AF_AActor_Distance2D(VMValue*, int, VMReturn*, int)':
vmthunks_actors.cpp:(.text+0x222b): undefined reference to `AActor::PosRelative(AActor const*) const'
2019-04-17 15:11:18 +02:00
Christoph Oelckers
c0c5df0e6e - fixed: ST_FormatMapName did not clear the string it wrote to before appending text. 2019-04-17 15:11:17 +02:00
Christoph Oelckers
22b8bdc02d fixed missing include. 2019-04-17 15:11:15 +02:00
Christoph Oelckers
1fce3298ba - fixed definition of GetUDMFString export. 2019-04-17 15:11:14 +02:00
Rachael Alexanderson
a4e09f1947 - Enforce CheckCheatmode() for cheat-enforced CVARs, allowing them to be changed in normal single player games 2019-04-17 15:11:11 +02:00
drfrag
a235d23c94 - Missing include. 2019-04-17 15:10:11 +02:00
Christoph Oelckers
a5e16e3261 - moved a large part of the VM thunks out of p_mobj.cpp. 2019-04-17 14:55:58 +02:00
Christoph Oelckers
1e4c22f8d4 - more direct native entry points. 2019-04-17 14:55:56 +02:00
Christoph Oelckers
3fb3831843 - fixed: SBar_SetClipRect had a superfluous argument resulting in incorrect behavior 2019-04-17 14:32:19 +02:00
Christoph Oelckers
89e6c400af - missed the header... 2019-04-17 14:32:17 +02:00
Christoph Oelckers
93dedcfd4b - the native APlayerPawn::PlayAttacking2 function is not needed anymore. 2019-04-17 14:32:16 +02:00
Christoph Oelckers
54d1ee2244 - fix bad return type. 2019-04-17 14:32:14 +02:00
Christoph Oelckers
d52889e71e - handle JIT errors in a more user-friendly fashion than aborting.
* use I_Error instead of I_FatalError to abort. I_FatalError is only for things that are not recoverable and should not be handled outside of error cleanup and rethrowing.
* only catch CRecoverableError in JitCompile. Everything else should fall through to the outermost catch block.
* Do not I_FatalError out after handling the exception locally. Just print an error and return null, indicating failure.
2019-04-17 14:32:12 +02:00
Christoph Oelckers
f22aaca74d - scriptified ASpecialSpot.
This only had two simple native methods so the class is not fully scripted.
2019-04-17 14:32:10 +02:00
Christoph Oelckers
92b245d220 - treat REGT_STRING | REGT_ADDROF just like REGT_STRING for direct native functions.
Both pass a reference so there's no need to treat them differently.
2019-04-17 14:32:08 +02:00
Christoph Oelckers
044b635a26 - more direct native function calls. 2019-04-17 14:32:06 +02:00
drfrag
03853930aa - Fixed compilation. 2019-04-17 12:21:08 +02:00
Christoph Oelckers
c87724ef0a Removed all native components from AInventory. 2019-04-16 23:57:22 +02:00
Christoph Oelckers
d40de21bae - scriptified A_SpawnSingleItem, which was the last piece of native code still referencing AInventory 2019-04-16 23:57:19 +02:00
Christoph Oelckers
558c9b48de - scriptified A_SelectWeapon and inlined the last remaining use of APlayerPawn::SelectWeapon. 2019-04-16 23:57:17 +02:00
Christoph Oelckers
d2225040ea - scriptified A_SelectWeapon 2019-04-16 23:57:15 +02:00
Christoph Oelckers
b8e1218645 Removed all remaining references to AInventory
What remains is the class definition and one single reference that will be scriptified.
2019-04-16 23:57:12 +02:00
Christoph Oelckers
b762c0f49c Removed more literal references to AInventory.
# Conflicts:
#	src/hwrenderer/scene/hw_drawinfo.cpp
#	src/v_draw.cpp
2019-04-16 23:57:07 +02:00
Christoph Oelckers
d173ad753f - started removing literal references of AInventory, so far only simple stuff. 2019-04-16 23:57:02 +02:00
drfrag666
ab5e5e0389 - The GetBlend script call is needed in another place as well.
# Conflicts:
#	src/gl/scene/gl_scene.cpp
2019-04-16 22:09:46 +02:00
Christoph Oelckers
e969e8a86b - moved the GetBlend script call to the one single place where it is needed to get rid of one native AInventory method.
# Conflicts:
#	src/g_inventory/a_pickups.cpp
#	src/g_inventory/a_pickups.h
#	src/hwrenderer/scene/hw_drawinfo.cpp
2019-04-16 22:01:08 +02:00
Christoph Oelckers
fa2e2e78b4 - removed all direct access to AInventory's members.
We are getting closer to make class Inventory fully scripted.
2019-04-16 22:01:04 +02:00
Magnus Norddahl
c8b5276981 - gcc/clang didn't like having this in a class 2019-04-16 22:01:01 +02:00
Magnus Norddahl
82a0acbc19 - add bool and unsigned int to the allowed types
- fix one case where floats were used (the JIT always calls with doubles)
2019-04-16 22:00:57 +02:00
Magnus Norddahl
89fd819926 - perform compile time validation of direct native function signatures 2019-04-16 22:00:55 +02:00
Magnus Norddahl
9e432c0c9f - fix VM native calls containing strings and enable them again 2019-04-16 22:00:53 +02:00
Magnus Norddahl
6090e5ec24 - fix compile error 2019-04-16 22:00:50 +02:00
Magnus Norddahl
cd03a487fe - GetInventoryIcon must return an integer for it to work for VM native calls 2019-04-16 22:00:48 +02:00
Christoph Oelckers
a42ece4fb4 - added missing min/max unsigned instructions for the VM. 2019-04-16 22:00:46 +02:00
Rachael Alexanderson
b7d22e2b1e - always apply vid_scalefactor now, even when vid_scalemode is not 0 or 1.
# Conflicts:
#	src/r_videoscale.cpp
2019-04-16 21:57:07 +02:00
Christoph Oelckers
e176410ab6 - fixed crash with weapons which remove themselves from the inventory but continue calling action functions.
This is still an error, so now this throws a meaningful exception.
2019-04-16 21:53:00 +02:00
Christoph Oelckers
d8d52f67b4 - hardened the seg integrity checks against extremely broken mods.
Temple of the Lizardmen 3 has segs lumps in every level that seem to use a different data format and are completely unusable, up to triggering undefined behavior.
2019-04-16 21:52:58 +02:00
Christoph Oelckers
59e0871f00 - fixed: The static variant of PClass::FindFunction may only be used for actual static variables. 2019-04-16 21:52:56 +02:00
Christoph Oelckers
c0686309fc - removed all direct references of AInventory::Owner and AInventory::Amount from the C++ code. 2019-04-16 21:52:53 +02:00
Christoph Oelckers
fc341c901f - fixed issues with Dehacked's ad-hoc script code generation
* The functions had no prototype and caused crashes.
* even after creating a prototype it didn't work because CreateAnonymousFunction was set up incorrectly for the case where a known return type was given.
2019-04-16 21:52:47 +02:00
drfrag
48c2f6451e - disable alpha test on models if the renderstyle isn't STYLE_Normal
- compare against the thing renderstyle since the local copy has been modified
(patches by dpJudas)
2019-04-16 21:51:19 +02:00
Christoph Oelckers
ba0e19f2a2 - made the BUddha checks readable again. 2019-04-16 21:34:55 +02:00
Christoph Oelckers
dc29eee077 - fixed compile warning 2019-04-16 21:34:53 +02:00
Christoph Oelckers
0a36ad0182 - removed assert that got triggered in an edge case that must pass here. 2019-04-16 21:34:51 +02:00
Christoph Oelckers
1bfa1fd5a6 - implemented missing 'exact' parameter for ThinkerIterator.Next. 2019-04-16 21:34:49 +02:00
Christoph Oelckers
5043106e97 - started replacing direct references to class AInventory.
The easiest part was the type checks which could be changed to the name variant with a global search and replace.

# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp

# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp
2019-04-16 21:34:23 +02:00
Major Cooke
4e8d88f7df - fixed: P_PoisonPlayer and P_PoisonDamage did not check for NODAMAGE.
- fixed: P_PoisonDamage's check for Buddha2 and the Buddha powerup were inverted.
- fixed: P_PoisonDamage checked the modified damage instead of the raw, allowing amplifiers to boost the damage beyond telefrag and circumventing regular buddha.
2019-04-16 21:28:39 +02:00
Christoph Oelckers
9f2b62c99c - scriptified AInventory::Tick.
This was the last bit of code standing in the way of making AInventory a fully scripted class.
All that's left to sort out is some variable accesses - the vast majority of them in SBARINFO.
2019-04-16 21:28:37 +02:00
Magnus Norddahl
abc4406d18 - ptest is a SSE 4.1 instruction 2019-04-16 21:28:35 +02:00
Christoph Oelckers
bdd6d31a63 - scriptified the AutoUseHealth feature.
This again is a piece of code that reads and even writes to inventory items' properties, so better have it on the script side.
2019-04-16 21:28:34 +02:00
Christoph Oelckers
80e3ce735b - scriptified the decision making of the invuseall CCMD.
Custom items had no way to adjust to this - and it also was the last native access to ItemFlags.
2019-04-16 21:28:32 +02:00
Christoph Oelckers
9ff5257ce9 - scriptified P_DropItem. 2019-04-16 21:28:30 +02:00
Christoph Oelckers
17862639a1 - scriptified the no-spawn flag check for armor and health items. 2019-04-16 21:28:29 +02:00
Christoph Oelckers
e9dd8f3e4f - consolidated the check for "is actor an owned inventory item" into a subfunction.
This check occured 9 times in the source, better have it only once.
2019-04-16 21:28:26 +02:00
Christoph Oelckers
e8a6f82682 - scriptified G_PlayerFinishLevel.
Outside of SBARINFO this was the biggest remaining piece of code that referenced AInventory internals.
2019-04-16 21:28:24 +02:00
Christoph Oelckers
9315a217b3 - scriptified AActor::ClearInventory 2019-04-16 21:28:21 +02:00
Christoph Oelckers
a2ffe6327b - took the last methods aside from Tick and Serialize out of AInventory.
# Conflicts:
#	src/g_inventory/a_pickups.cpp
#	src/g_inventory/a_pickups.h
2019-04-16 21:28:19 +02:00
drfrag
8ef732704c - Missing include. 2019-04-16 19:55:28 +02:00
Christoph Oelckers
a1615457ac - properly hook up the alt HUD with the status bar.
# Conflicts:
#	src/d_main.cpp
2019-04-16 19:09:14 +02:00
Christoph Oelckers
0d8975ed31 - scriptified the last components of the alternative HUD.
- moved the ALTHUDCF parser PClass::StaticInit, so that it gets done right after creating the actor definitions.

All left to do is not to reallocate the AltHud object for each frame but store it in a better suited place.

# Conflicts:
#	src/d_main.cpp

# Conflicts:
#	src/info.cpp
2019-04-16 19:03:43 +02:00
Christoph Oelckers
376266b6a0 - scriptified the main drawer for the in-game HUD and removed all intermediate VM calls from the native source. 2019-04-16 19:02:01 +02:00
Christoph Oelckers
9d8dd5c529 - scriptified the AltHUD'S powerup drawer. 2019-04-16 19:01:55 +02:00
Christoph Oelckers
f509fdfdaa - scriptified and cleaned up the AltHUD's DrawCoordinates, DrawTime and DrawLatency functions.
Some backing functionality was moved elsewhere because scripting should not have access to low level system information.
2019-04-16 19:01:53 +02:00
Christoph Oelckers
eb07b8e543 - scriptified the AltHUD's inventory drawer and fixed the InvPrev CCMD. 2019-04-16 19:01:51 +02:00
Christoph Oelckers
e0915877b4 - scriptified the AltHUD's weapon drawer. 2019-04-16 19:01:50 +02:00
Christoph Oelckers
045d6d4355 - added the missing TNT1A0 check for icon-less keys.
Since it tries to get the icon from the spawn state it also has to check if that actually has a valid sprite.
2019-04-16 19:01:48 +02:00
Christoph Oelckers
437c72a089 - AltHUD ammo drawer scriptified. 2019-04-16 19:01:46 +02:00
Christoph Oelckers
cbb92af1db - allow %*d etc. format specifiers in ZScript, but only for numeric types. 2019-04-16 19:01:45 +02:00
Christoph Oelckers
1033dc3b10 - Alt HUD scriptification, part 1. 2019-04-16 19:01:43 +02:00
Magnus Norddahl
08f415bad9 - don't use SSE for integer min/max 2019-04-16 18:46:09 +02:00
Magnus Norddahl
1e533d726c - Use SSE2 for min/max instead 2019-04-16 18:46:07 +02:00
Christoph Oelckers
ca67327d1c - this was wrong... 2019-04-16 18:46:01 +02:00
Christoph Oelckers
ff9eaed1ba - fixed script call in PickNewWeapon. 2019-04-16 18:45:58 +02:00
Christoph Oelckers
53c1614a51 - fixed: P_Massacre without a class restriction no longer worked. 2019-04-16 18:45:56 +02:00
Christoph Oelckers
d18ed18d2e - scriptified invnext and invprev CCMDs. 2019-04-16 18:45:54 +02:00
Christoph Oelckers
081d0bbcca - moved ValidateInvFirst to the script side because this was one of the major functions that directly reference AInventory. 2019-04-16 18:45:52 +02:00
Christoph Oelckers
d021d63d33 - moved AInventory::DoRespawn fully to the script side. 2019-04-16 18:45:49 +02:00
Christoph Oelckers
a7909c16e5 - made CallTryPickup a global function.
This one still gets called in too many places but stands in the way of moving Inventory fully to the script side.
2019-04-16 18:45:47 +02:00
Christoph Oelckers
9981674a27 - re-fixed the massacre fix for Dehacked-modified inventory items.
Instead of overriding the Massacre method it is preferable to clear the flags causing the bad behavior, most notably ISMONSTER.

# Conflicts:
#	src/g_inventory/a_pickups.cpp
#	src/g_inventory/a_pickups.h
2019-04-16 18:45:43 +02:00
Christoph Oelckers
be8d1c950d - scriptified GiveAmmo and the one remaining piece of native code still using it. 2019-04-16 18:45:41 +02:00
Christoph Oelckers
f1bf1cc44e - scriptified DropInventory. 2019-04-16 18:45:38 +02:00
Christoph Oelckers
a614f2a81e - scriptified UseInventory and several functions using the already scriptified ones,
# Conflicts:
#	src/g_statusbar/sbar.h
2019-04-16 18:45:36 +02:00
Christoph Oelckers
e7c798f58f - scriptified TakeInventory, including the ACS/FS interfaces. 2019-04-16 18:45:03 +02:00
Christoph Oelckers
390f8ef209 - code consolidation in invnext and invprev. 2019-04-16 18:45:01 +02:00
Christoph Oelckers
d2741813ab - scriptified RemoveInventory and Inventory.OnDestroy. 2019-04-16 18:44:59 +02:00
Christoph Oelckers
8609e2ba68 - scriptified GiveInventory and made the interface a bit more configurable by mods.
Now a child type can decide for itself how to treat 'amount'.
The scripting interfaces to this function in ACS and FraggleScript have been consolidated and also scriptified.
2019-04-16 18:44:56 +02:00
Christoph Oelckers
2a192cde92 - scriptified AddInventory. 2019-04-16 18:44:53 +02:00
Christoph Oelckers
de6916756b - disabled direct native functions for now until the problems with string arguments are fixed. 2019-04-16 18:44:50 +02:00
Christoph Oelckers
057604a7b1 - added direct native variants to nearly all status bar function.
I skipped ValidateInvFirst because that one will have to be scriptified soon.
2019-04-16 18:44:49 +02:00
Magnus Norddahl
b6737c0cd3 - minor code cleanup now that it is working 2019-04-16 18:18:30 +02:00
Christoph Oelckers
712b85fc61 - removed the no longer needed exception prevention hack.
# Conflicts:
#	src/scripting/vm/vmframe.cpp

# Conflicts:
#	src/scripting/vm/vmframe.cpp
2019-04-16 18:18:16 +02:00
Christoph Oelckers
fc4b757b17 - fixed: V_FindFontColor is not suitable for direct calls from JIT code, thanks to its FName parameter. 2019-04-16 18:17:32 +02:00
Christoph Oelckers
4049b56d50 - a bit of code reordering for adding direct native entry points.
- offloaded key list generation for alternative HUD to non-UI parts.

This change also revealed a problem with handling empty sprites in the key list so this got fixed, too.

# Conflicts:
#	src/g_shared/shared_hud.cpp
2019-04-16 18:17:05 +02:00
Magnus Norddahl
c84f13829f - fix augmentation length bug 2019-04-16 18:14:40 +02:00
Magnus Norddahl
4393684831 - unwind data is now working on macOS 2019-04-16 18:14:39 +02:00
Christoph Oelckers
56228a853b - moved all exports from class Font to vmthunks.cpp and gave them direct native entrypoints.
- changed PARAM_STRING to use the passed string by reference instead of by value. The 3 instances where passing by value was needed now use PARAM_STRING_VAL.

# Conflicts:
#	src/v_video.h
2019-04-16 18:14:09 +02:00
Christoph Oelckers
798cebf891 - fixed character to int conversion for UTF8-characters. 2019-04-16 17:43:33 +02:00
alexey.lysiuk
e9daf31b23 - previous fix attempts done right
# Conflicts:
#	src/m_cheat.cpp
2019-04-16 17:43:23 +02:00
SanyaWaffles
a00a567532 Attempts to fix errors introduced by merging of asmjit branch and wea… (#649)
* Attempts to fix errors introduced by merging of asmjit branch and weapons scripting branch

* This didn't work. The others should work though.

* fix scriptutil.cpp:(.text+0x18d): undefined reference to `PClass::FindActor(FName)'

* Attempt to fix compilation on macOS

# Conflicts:
#	src/m_cheat.cpp
2019-04-16 17:42:13 +02:00
Magnus Norddahl
0746784965 - implemented unwind data on Unix - does it work? no idea, there's no easy way to tell when the debugger doesn't support the interface.. 2019-04-16 17:40:48 +02:00
Christoph Oelckers
f2ac0f4c53 - removed the longjmp based exception catch/rethrow mechanism and instead force-terminate in case a user exception is thrown while the VM is executing JITed code on a non-Windows system
On Windows none of this is needed, because we can generate a proper unwind frame for the JITed functions, but even on Linux, it would require manual additions to each single piece of native code that ever gets called from inside a JIT compiled function.
This is an utterly prohibitive proposition because it makes direct native calls a virtual impossibility
So, in order to get the thrown error properly presented both I_Error and ThrowAbortException will now forward to I_FatalError if it is called from inside a JIT context.

# Conflicts:
#	src/scripting/vm/vmframe.cpp
2019-04-16 17:32:32 +02:00
Christoph Oelckers
bd4e41d6cb -add a dummy definition for vm_jit in 32 bit. 2019-04-16 17:28:36 +02:00
Christoph Oelckers
a7913e9ba9 - fixed: the direct native GetTextureSize used the wrong calling convention. 2019-04-16 17:28:35 +02:00
Player701
e5fa48ae79 - Added a flag to make bouncing objects disappear when hitting sky surfaces 2019-04-16 17:28:33 +02:00
Christoph Oelckers
5c91df5c73 - let FOBJModel::ParseVector actually use its templated size parameter
In this setup the array can be statically updated because the size is always constant per instantiation
2019-04-16 17:28:31 +02:00
Christoph Oelckers
94424aeed8 - Changed a few allocations into usin TArrays
S_SoundCurve in particular looked like a candidate for leaking memory.
2019-04-16 17:28:30 +02:00
drfrag
999f6f6920 - Fixed warning. 2019-04-16 17:25:08 +02:00
Magnus Norddahl
7c1730f221 - fix native call crash and assertion error 2019-04-16 17:14:31 +02:00
Magnus Norddahl
f65b7fb1be - hook up unix unwind info (still not working) 2019-04-16 17:14:30 +02:00
Magnus Norddahl
d65298e929 - fix WriteSLEB128 2019-04-16 17:14:28 +02:00
Magnus Norddahl
14bb291901 - fix compile errors 2019-04-16 17:14:26 +02:00
Magnus Norddahl
fd0104bc71 - implemented unwind info for Linux and macOS - now to fix the bugs that cannot be fixed when the documentation is as useless as it is for those platforms.. 2019-04-16 17:14:25 +02:00
Christoph Oelckers
2f68a0681d - fixed code generation for dummy results. 2019-04-16 17:10:39 +02:00
Christoph Oelckers
ebf368ffc6 - fixed compilation warnings. 2019-04-16 17:10:35 +02:00
Christoph Oelckers
4bffe69912 - direct native methods for dynamic arrays. 2019-04-16 17:10:33 +02:00
Christoph Oelckers
3758e3e1fa Add direct native calls to TexMan's native methods.
# Conflicts:
#	src/textures/texturemanager.cpp
2019-04-16 16:37:37 +02:00
Christoph Oelckers
09f4c7e4a9 Made all virtual base functions for the event handler scripted
This was by far the largest block of native virtuals, and they were only native to be able to allow checking if the event was implemented for the current handler. This can easily be done by looking at the byte code, just like VMCall also does but in turn it removes more than half of the existing native virtuals from the interface.
2019-04-16 15:26:14 +02:00
Christoph Oelckers
76ac8bf27c Direct native functions for SBarInfo
Mostly pointless because they all get used only once and aren't even virtual overrides, but I only realized this after everything was complete…
2019-04-16 15:26:13 +02:00
Christoph Oelckers
b033fd3d52 Added direct native functions to the remaining content of vmthunks.cpp 2019-04-16 15:12:47 +02:00
Christoph Oelckers
3c11090d09 - more direct native functions for sector utilities. 2019-04-16 15:12:45 +02:00
Magnus Norddahl
e4ce93382b - Emit DW_CFA_advance_loc and DW_CFA_def_cfa_offset codes 2019-04-16 15:12:43 +02:00
Christoph Oelckers
4ac866aedc - added a few more direct native entry points. 2019-04-16 15:12:41 +02:00
Christoph Oelckers
03b7d84058 - added a direct native function for NextHighestCeilingAt to test multiple return values. 2019-04-16 15:12:37 +02:00
Magnus Norddahl
29e051a36a - fix typo in macro 2019-04-16 15:12:34 +02:00
Magnus Norddahl
48d211c79b - add .eh_frame generation code except for building the actual CIE and FDE instructions 2019-04-16 15:12:31 +02:00
Christoph Oelckers
d5f4f93dd2 - allocate storage for all of a function's return values 2019-04-16 14:58:41 +02:00
Christoph Oelckers
179f5720cd - moved the remaining exports from p_sectors.cpp to vmthunks.cpp 2019-04-16 14:58:39 +02:00
Magnus Norddahl
c8c671bbe0 - pass additional return values as the last args to a direct native call 2019-04-16 14:58:37 +02:00
Magnus Norddahl
0f27d0cd66 - use the OP_PARAM and OP_RESULT opcodes to build the function signature 2019-04-16 14:58:35 +02:00
Magnus Norddahl
4e5415d371 - fixed missing setRet call for REGT_POINTER return types 2019-04-16 14:58:34 +02:00
Magnus Norddahl
a557042bcc - fix compile error 2019-04-16 14:58:32 +02:00
Magnus Norddahl
7c75776273 - annotate which function we are calling for better dumpjit info 2019-04-16 14:58:30 +02:00
Magnus Norddahl
ee7d6abdd3 - move the jit runtime to its own file 2019-04-16 14:58:27 +02:00
Christoph Oelckers
f3171c95cc - fixed: Any direct native function may not use struct values as parameters, not even something as simple as an FName. 2019-04-16 14:58:25 +02:00
Christoph Oelckers
c0a26afab9 - free everything. 2019-04-16 14:58:24 +02:00
Christoph Oelckers
7c649a9f0c - delete JIT data when shutting down. 2019-04-16 14:58:21 +02:00
Magnus Norddahl
8fc8dee090 - fix: float constants got their move instructions inserted after the call instruction 2019-04-16 14:58:19 +02:00
Christoph Oelckers
29eee14549 - declare builtins as static. 2019-04-16 14:58:18 +02:00
Christoph Oelckers
3f1c7bdbe8 - added a direct native variant for A_PlaySound because this function is relatively easy to test. 2019-04-16 14:58:15 +02:00
Magnus Norddahl
6289e0ad3d - fix macro expansion error on gcc and clang 2019-04-16 12:41:21 +02:00
Christoph Oelckers
5efa21ad31 - finished adding direct native functions to vmthunks.cpp. 2019-04-16 12:40:48 +02:00
Christoph Oelckers
63575d22c0 - all sector exports done. 2019-04-16 12:40:46 +02:00
Christoph Oelckers
7f4ed65123 - another batch of direct native functions. 2019-04-16 12:40:43 +02:00
Christoph Oelckers
10588add9c - continued work on adding direct native support. 2019-04-16 12:40:40 +02:00
Christoph Oelckers
178c1a41a6 - 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.

# Conflicts:
#	src/p_sectors.cpp
2019-04-16 12:37:04 +02:00
Christoph Oelckers
c01981d08a - 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.
2019-04-15 22:30:01 +02:00
Christoph Oelckers
20ec6ddce4 - 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.
2019-04-15 22:29:58 +02:00
Christoph Oelckers
376c47bef6 - fixed handling of dummy flags. 2019-04-15 22:29:55 +02:00
Christoph Oelckers
96e9dbd967 - removed all remaining native components of the weapon class. 2019-04-15 22:29:52 +02:00
Christoph Oelckers
d871072f28 - allow defining flags in the script declaration of a class and do that for Weapon. 2019-04-15 22:29:47 +02:00
Christoph Oelckers
309cc57504 - 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.
2019-04-15 22:29:43 +02:00
Christoph Oelckers
ce5792242c - 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.
2019-04-15 22:29:39 +02:00
Christoph Oelckers
7caa6a922d - moved MarkPrecacheSounds completely to the script side and added native support to make this a usable feature.
# Conflicts:
#	src/g_inventory/a_pickups.cpp
2019-04-15 22:29:35 +02:00
Christoph Oelckers
ac754b5e96 - some cleanup on the weapon slot interface.
This really shouldn't make any decisions from directly reading weapon class defaults.
2019-04-15 22:29:32 +02:00
Christoph Oelckers
f9dfdace16 - scriptified cht_Takeweaps. 2019-04-15 22:29:30 +02:00
Christoph Oelckers
dadf0394c0 - removed the less-parameters versions of P_SpawnPlayerMissile, because there was only one native call left to them. 2019-04-15 22:29:28 +02:00
Christoph Oelckers
94b0338c31 - scriptified ApplyKickback. 2019-04-15 22:29:26 +02:00
Christoph Oelckers
2145db9fbd - 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.
2019-04-15 22:29:24 +02:00
Christoph Oelckers
59bffe2f55 - scriptified A_WeaponReady and its subfunctions. 2019-04-15 22:29:22 +02:00
Christoph Oelckers
951ed466b3 - scriptified P_BobWeapon as a virtual function on PlayerPawn. 2019-04-15 22:29:19 +02:00
Christoph Oelckers
04cd432159 - 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. 2019-04-15 22:29:17 +02:00
Christoph Oelckers
0515af2bd3 - 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.
2019-04-15 22:29:15 +02:00
Christoph Oelckers
d31f67cb43 - consolidated the 3 nearly identical code fragments handling the weapon's YAdjust for the different renderers into a utility function in DPSprite.
# Conflicts:
#	src/hwrenderer/scene/hw_weapon.cpp
#	src/polyrenderer/scene/poly_playersprite.cpp
#	src/swrenderer/things/r_playersprite.cpp
2019-04-15 22:07:45 +02:00
Christoph Oelckers
681009e1ea - exported the blood spawning part of P_LineAttack as a virtual ZScript function. 2019-04-15 21:59:08 +02:00
Christoph Oelckers
82ffdd5e6b - moved the weapon selection logic to PlayerPawn as overridable virtual functions. 2019-04-15 21:59:07 +02:00
Christoph Oelckers
af4c37471e - 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.

# Conflicts:
#	src/g_inventory/a_pickups.cpp
2019-04-15 21:59:05 +02:00
Christoph Oelckers
27c67716df - change teleport freeze handling to a player property plus virtual override on PlayerPawn for increased configurability.
# Conflicts:
#	src/g_inventory/a_pickups.cpp
2019-04-15 21:59:03 +02:00
Christoph Oelckers
7c1416cb6f - scriptified BecomeItem and BecomePickup
# Conflicts:
#	src/g_inventory/a_pickups.cpp
2019-04-15 21:59:01 +02:00
Christoph Oelckers
08059f718b - scriptified FilterCoopRespawnInventory. 2019-04-15 21:59:00 +02:00
Christoph Oelckers
1ecada388c - scriptified some simple sound functions. 2019-04-15 21:58:58 +02:00
Christoph Oelckers
d123230fb1 - scriptified APlayerPawn::Die and fixed a few things I encountered while doing it. 2019-04-15 21:58:56 +02:00
Christoph Oelckers
0eec8b293a - scriptified ModifyDropAmount as a virtual function hierarchy for Inventory and children. 2019-04-15 21:58:54 +02:00
Christoph Oelckers
f1c7815b16 - scriptified A_Explode and relatives. 2019-04-15 21:58:52 +02:00
Christoph Oelckers
e234d450aa - scriptified GetDefaultInventory. 2019-04-15 21:58:50 +02:00
Christoph Oelckers
864796a6a2 - 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.
2019-04-15 21:58:48 +02:00
Christoph Oelckers
beae232f83 - exported one FraggleScript function for testing. 2019-04-15 21:58:46 +02:00
Christoph Oelckers
c326c4c521 - exported a few more weapon handling functions so that the native GetDownState stub could be removed. 2019-04-15 21:58:45 +02:00
Christoph Oelckers
53b41cf32f - let player_t::Resurrect use P_BringUpWeapon to raise the weapon again instead of doing it directly.
This seems a bit safer.
2019-04-15 21:58:43 +02:00
Christoph Oelckers
c1442fae0d - scriptified P_BringUpWeapon because this was the only native function still referencing AWeapon::GetReadyState. 2019-04-15 21:58:41 +02:00
Christoph Oelckers
8c2c888d82 - 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.
2019-04-15 21:58:39 +02:00
Christoph Oelckers
1b225588d1 - scriptified 3 more functions in stateprovider. 2019-04-15 21:58:37 +02:00
Christoph Oelckers
05e8a6c62d - scriptified A_RailAttack. 2019-04-15 21:58:35 +02:00
Christoph Oelckers
394d8e414f - scriptified A_CustomPunch 2019-04-15 21:58:33 +02:00
Christoph Oelckers
54ba5b4829 - scriptified A_FireProjectile 2019-04-15 21:58:31 +02:00
Christoph Oelckers
d99b46c861 - scriptified A_FireBullets and A_CustomBulletAttack. 2019-04-15 21:58:30 +02:00
Christoph Oelckers
f794cab92f - deleted redundant native ActivateMorphWeapon method. 2019-04-15 21:58:28 +02:00
Christoph Oelckers
4c7096ffac - 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.

# Conflicts:
#	src/p_acs.cpp
2019-04-15 21:58:26 +02:00
Christoph Oelckers
1b6af10f38 - scriptified Weapon.CheckAmmo and Weapon.DepleteAmmo 2019-04-15 21:56:30 +02:00
Christoph Oelckers
9e6279ed5b - scriptified the rest of the morph code. 2019-04-15 21:56:28 +02:00
Christoph Oelckers
5f5410e35f - 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. 2019-04-15 21:56:26 +02:00
Christoph Oelckers
b886219f53 - scriptified P_MorphMonster. 2019-04-15 21:56:23 +02:00
Christoph Oelckers
d4ff49e110 - fixed message output. 2019-04-15 21:56:22 +02:00
Christoph Oelckers
02f785f794 - testing and cleanup of scripted morph code. 2019-04-15 21:56:20 +02:00
Christoph Oelckers
9b1e96262c - P_UndoPlayerMorph scriptified.
Not tested yet and still missing a new native interface.
2019-04-15 21:56:18 +02:00
Christoph Oelckers
395413fc9a - scriptified P_MorphPlayer and dependencies.
It still needs its counterpart scriptified as well before it can work.

# Conflicts:
#	src/gi.cpp
#	wadsrc/static/zscript/base.txt
2019-04-15 21:56:16 +02:00
Christoph Oelckers
8669dbdcfe - removed test and debug code.
# Conflicts:
#	src/gl/scene/gl_scenedrawer.h
2019-04-15 21:50:57 +02:00
drfrag
60e667f732 - Fixed compilation. 2019-04-15 21:48:55 +02:00
Magnus Norddahl
5f7aeb3186 - fix missing include statement 2019-04-15 16:09:14 +02:00
Christoph Oelckers
1fd23f5228 - fixed initialization of default parameters in dynamically created function calls like in the MENUDEF parser 2019-04-15 16:09:13 +02:00
Magnus Norddahl
31f524fd6b - inline VBTL opcode
- remove old META and CLSS implementations
2019-04-15 16:09:11 +02:00
Magnus Norddahl
d4e3bee7c6 - add return type to CreateFuncSignature 2019-04-15 16:09:10 +02:00
Magnus Norddahl
1aebbfb3b5 - fix typo 2019-04-15 16:09:08 +02:00
Magnus Norddahl
815b7d8b7e - add support in the jit compiler to do direct native calls using the x64 calling convention 2019-04-15 16:09:07 +02:00
Christoph Oelckers
f00892e06d - 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.
2019-04-15 16:09:05 +02:00
Christoph Oelckers
cc8e390dce 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.
2019-04-15 16:09:04 +02:00
Christoph Oelckers
95767fb63a - 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.

# Conflicts:
#	src/r_data/r_translate.cpp
2019-04-15 16:08:18 +02:00
Christoph Oelckers
edfe8b36c6 - 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
2019-04-15 16:06:22 +02:00
Christoph Oelckers
f2fe079ddb - 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.

# Conflicts:
#	src/v_draw.cpp
2019-04-15 16:03:51 +02:00
Christoph Oelckers
5e63252fdc - 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.

# Conflicts:
#	src/v_draw.cpp
2019-04-15 16:02:17 +02:00
Christoph Oelckers
cb9c1f021c - 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.
2019-04-15 15:52:22 +02:00
Magnus Norddahl
a277137d85 - add missing CheckVMFrame call 2019-04-15 15:52:21 +02:00
Magnus Norddahl
0fe213765b - only allocate stack space for vmframe and call returns when we need them 2019-04-15 15:52:20 +02:00
Magnus Norddahl
03258d1334 - improve dumpjit output slightly 2019-04-15 15:52:19 +02:00
Magnus Norddahl
ec3b491f19 - don't emit VMValue.Type information when we know the receiver isn't going to read it anyway 2019-04-15 15:52:18 +02:00
Magnus Norddahl
fe64de28d4 - delay emitting PARAM and VTBL instructions until CALL/CALL_K 2019-04-15 15:52:16 +02:00
alexey.lysiuk
5d0bf48e22 - 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]
2019-04-15 15:52:15 +02:00
alexey.lysiuk
4edcb06a9d - fixed compilation of POSIX targets
src/scripting/backend/vmbuilder.h:169:19: error: no member named 'function' in namespace 'std'
2019-04-15 15:52:14 +02:00
Christoph Oelckers
b33fd19fa2 - missed one OP_RESULT. 2019-04-15 15:52:13 +02:00
Christoph Oelckers
6727301330 - 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. 2019-04-15 15:52:12 +02:00
Christoph Oelckers
a900390683 - 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.
2019-04-15 15:52:11 +02:00
Christoph Oelckers
054640ce41 - 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.
2019-04-15 15:52:10 +02:00
Magnus Norddahl
33bef2183e - fix compile errors 2019-04-15 15:52:08 +02:00
Christoph Oelckers
ab689c0984 - fixed TArray's Append methods.
I mistakenly assumed that Grow would incease the array's reserved space.
2019-04-15 15:52:07 +02:00
Christoph Oelckers
e9a5f094c9 - 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. 2019-04-15 15:48:37 +02:00
Christoph Oelckers
9380ccb922 - completed the Dehacked fix.
I missed some arguments that were specified but set to 'not given'.
2019-04-15 15:48:35 +02:00
Christoph Oelckers
f10c927850 - fixed: The Dehacked function wrappers now need full parameter lists. 2019-04-15 15:48:32 +02:00
Magnus Norddahl
783adc7be1 - disabled code that shows how a thunk function and native setup would look like 2019-04-15 15:48:31 +02:00
Christoph Oelckers
03001991f1 - 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.
2019-04-15 15:48:30 +02:00
Christoph Oelckers
f557c77602 - 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.
2019-04-15 15:48:29 +02:00
Christoph Oelckers
9456c877d4 - 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.
2019-04-15 15:48:27 +02:00
Magnus Norddahl
44b89bba96 - inline ReadBarrier, GetClass and GetClassMeta 2019-04-15 15:48:25 +02:00
Christoph Oelckers
05fd4d8b62 - fixed RNG setup in FxRandom. 2019-04-15 15:48:24 +02:00
Christoph Oelckers
9d126954d1 - removed the default parameter handling from all native script functions because it is no longer needed.
# Conflicts:
#	src/p_actionfunctions.cpp

# Conflicts:
#	src/hwrenderer/postprocessing/hw_postprocessshader.cpp
#	src/v_2ddrawer.cpp
2019-04-15 14:59:00 +02:00
Christoph Oelckers
6d8cf38cef - fixed FxFRandom setup which used a path in FxRandom that is no longer supported. 2019-04-15 14:37:46 +02:00
Magnus Norddahl
075a666c75 - 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 2019-04-15 14:37:44 +02:00
Magnus Norddahl
51900d5d98 - removed the SetupSimpleFrameMissingArgs logic as the number of args are now guaranteed 2019-04-15 14:37:43 +02:00
Magnus Norddahl
66a970059b - add warning text when falling back to the VM 2019-04-15 14:37:41 +02:00
Christoph Oelckers
7d2c4a05e2 - 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.
2019-04-15 14:37:40 +02:00
Magnus Norddahl
ac01af3ef0 - make functions using too many registers (more than 200) fall back to the VM 2019-04-15 14:37:38 +02:00
Christoph Oelckers
a0b4f5ad68 - always pass complete argument lists in the VM. 2019-04-15 14:37:37 +02:00
Christoph Oelckers
44eee13aa7 - build full argument lists for action function calls.
This uses one static global array to avoid frequent reallocations.
2019-04-15 14:37:35 +02:00
Christoph Oelckers
a371a8456a - 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.
2019-04-15 14:37:34 +02:00
Christoph Oelckers
29d7e11937 - fixed last commit. 2019-04-15 14:37:31 +02:00
Christoph Oelckers
28461de6ec - 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. 2019-04-15 14:37:30 +02:00
Christoph Oelckers
7fe33d336c 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.

# Conflicts:
#	src/r_data/r_sections.h
2019-04-15 14:37:28 +02:00
Magnus Norddahl
2dd03270b2 - remove unused argument 2019-04-15 14:37:26 +02:00
Magnus Norddahl
fd955249fd - avoid calling VMFillParams for simple stack frames
- split Setup into more functions
2019-04-15 14:37:24 +02:00
Magnus Norddahl
5181106264 - add dword store to memset code 2019-04-15 14:37:23 +02:00
Magnus Norddahl
43cfedbd23 - disable jit in 32-bit builds 2019-04-15 14:37:21 +02:00
Magnus Norddahl
18258c6cd5 - fix wrong offsets 2019-04-15 14:37:20 +02:00
Magnus Norddahl
c9a20d56d1 - 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!)
2019-04-15 14:37:19 +02:00
Magnus Norddahl
8fd2bd1d51 - fix operand size mismatch error 2019-04-15 14:37:17 +02:00
Chronos Ouroboros
104f49e589 Fix the code for MODF_RK in the JIT compiler. 2019-04-15 14:37:16 +02:00
Chronos Ouroboros
c8e56f4dda Fixed the Vector2/3 != operator. 2019-04-15 14:37:14 +02:00
Chronos Ouroboros
c3c100bf9f Added support for CMP_APPROX to EQV_R and moved the code to a template. 2019-04-15 14:37:13 +02:00
Magnus Norddahl
b4db05a7ff - modify exception checks to jump ahead if the exception is to be thrown as it limits static misprediction 2019-04-15 14:37:11 +02:00
Magnus Norddahl
3504f48bfa - fix a typo 2019-04-15 14:37:10 +02:00
Magnus Norddahl
3f952e94cd - fix the throw messages 2019-04-15 14:37:09 +02:00
Christoph Oelckers
74d02811c7 - fixed vector math instructions to use the same order of operations as the VM. 2019-04-15 14:37:07 +02:00
Magnus Norddahl
64387abcce - add vm_jit cvar to control JIT compilation 2019-04-15 14:37:05 +02:00
Magnus Norddahl
87744b22ab - update JIT PARAM handling to match the VM instruction change 2019-04-15 14:37:04 +02:00
Magnus Norddahl
43a6fc7227 - RUNTIME_FUNCTION only exists in 64-bit Windows 2019-04-15 14:37:02 +02:00
Magnus Norddahl
a54dbec73a - fix wrong shift direction 2019-04-15 14:37:01 +02:00
Magnus Norddahl
bd1f529574 - build enough of the unwind opcodes for visual studio's debugger to produce the correct call stack 2019-04-15 14:36:59 +02:00
Magnus Norddahl
ea8725f03b - construct our own runtime as the one provided by asmjit is too primitive 2019-04-15 14:36:58 +02:00
Magnus Norddahl
89bf3f0455 - add more names to asmjit objects 2019-04-15 14:36:56 +02:00
Magnus Norddahl
7e9e823674 - remove the frameX registers as they were just constant offsets to vmframe that could be merged into other constant offsets 2019-04-15 14:36:55 +02:00
Magnus Norddahl
475510c8ea - give the remaining virtual registers names 2019-04-15 14:36:53 +02:00
Magnus Norddahl
68c05a424b - give temp registers names and reuse the FString object for formatting names 2019-04-15 14:36:52 +02:00
Magnus Norddahl
d48738437b - skip RESULT opcodes when outputting assembly 2019-04-15 14:36:51 +02:00
Magnus Norddahl
77850c1ec5 - clean up assembly output slightly by only generating labels for the opcodes jumped to 2019-04-15 14:36:49 +02:00
Magnus Norddahl
316010378d - fix CASTB opcode implementation 2019-04-15 14:36:48 +02:00
Magnus Norddahl
2c89d1e694 - fix missing convert from float to double in LSP and LSP_R opcodes
- fix missing convert from double to float in SSP and SSP_R opcodes
2019-04-15 14:36:46 +02:00
Magnus Norddahl
9b9113d0c4 - fix debug build compile error 2019-04-15 14:36:44 +02:00
Magnus Norddahl
7230974c1e - remove the need to do any VARF_Native runtime checks by making native functions use the same calling convention as the script version 2019-04-15 14:36:43 +02:00
Magnus Norddahl
ae6c7e541c - do script calls directly from asmjit without using a lambda wrapper
- do VARF_Native check at compile time when possible
2019-04-15 14:36:41 +02:00
Magnus Norddahl
37dfbba232 - add -dumpjit command line parameter that dumps the JIT log for all functions to dumpjit.txt
# Conflicts:
#	src/scripting/backend/vmbuilder.cpp
2019-04-15 14:36:39 +02:00
Magnus Norddahl
a60ac7b47d - fix return warning 2019-04-15 14:33:49 +02:00
Magnus Norddahl
e7f0b7a0bd - switch to using setjmp/longjmp for exception handling 2019-04-15 14:33:47 +02:00
Magnus Norddahl
b24ec1f9cc - add disabled code that attempts to load registers directly from function arguments 2019-04-15 14:33:46 +02:00
Magnus Norddahl
04ba3ede16 - add missing include statement 2019-04-15 14:33:44 +02:00
Magnus Norddahl
6db9b1394c - allocate VMFrame on the stack for simple functions with no strings 2019-04-15 14:33:43 +02:00
Magnus Norddahl
84d2de34f0 - remove argument not used anymore 2019-04-15 14:33:41 +02:00
Magnus Norddahl
f0c059678b - move VM creation into the jitted function. this will allow the jit compiler to skip vm frame creation when possible 2019-04-15 14:33:39 +02:00
Magnus Norddahl
baaed0920a - create ScriptCall function pointer on VMScriptFunction 2019-04-15 14:33:37 +02:00
Magnus Norddahl
03689cf004 - modify the VM calling convention so that the callee sets up its own VM frame 2019-04-15 14:33:35 +02:00
Magnus Norddahl
992c097ad1 - fix wrong registers getting saved when passing parameters by reference 2019-04-15 14:33:34 +02:00
Magnus Norddahl
19ae43be17 - removed CanJit as all opcodes are now implemented
- fix some store bugs
2019-04-15 14:33:32 +02:00
Magnus Norddahl
b3aeb37189 - fix 32 bit compile errors 2019-04-15 14:33:31 +02:00
Magnus Norddahl
e2dcca611c - catch and rethrow c++ exceptions 2019-04-15 14:33:29 +02:00
Magnus Norddahl
22e60d74ad - reuse temp virtual registers 2019-04-15 14:33:28 +02:00
Magnus Norddahl
80cda43370 - workaround bug in asmjit's register allocator for calls where the return register is already allocated in a physical register needed by one of the call arguments 2019-04-15 14:33:26 +02:00
Magnus Norddahl
bb3d0021d6 - switch ToMemAddress to imm_ptr where allowed 2019-04-15 14:33:25 +02:00
Magnus Norddahl
f90019561d - switch from ASMJIT_ARCH_X64 to ASMJIT_ARCH_64BIT when checking if we need to use 64-bit pointers 2019-04-15 14:33:23 +02:00
Magnus Norddahl
e0f0511d29 - create a very basic OP_IJMP implementation 2019-04-15 14:33:22 +02:00
Magnus Norddahl
812a4290b1 - create CreateCall helper to get rid of a lot of the cc.call boilerplate 2019-04-15 14:33:20 +02:00
Magnus Norddahl
ff6317d6f4 - implement OP_TAIL and OP_TAIL_K 2019-04-15 14:33:19 +02:00
Magnus Norddahl
be6637dd17 - use the ParamOpcodes array for finding the OP_PARAM's used by a call 2019-04-15 14:33:17 +02:00
Magnus Norddahl
f1f2dca792 - implement string version of OP_CAST 2019-04-15 14:33:16 +02:00
Magnus Norddahl
0cf5f3704b - implement string part of OP_CASTB 2019-04-15 14:33:14 +02:00
Magnus Norddahl
097de74510 - implement OP_LFP 2019-04-15 14:33:13 +02:00
Magnus Norddahl
7f996b5334 - read the parameters and registers directly off the stack 2019-04-15 14:33:11 +02:00
Jonathan Russell
ff421eda63 - changed a bunch of manual address additions in string opcodes to leas 2019-04-15 14:33:10 +02:00
Magnus Norddahl
b6521467f3 - more load fixes 2019-04-15 14:33:08 +02:00
Magnus Norddahl
e28389ad12 - fix truncated load addresses due to a bug in asmjit
- change ToMemAddress to use uint64_t
2019-04-15 14:33:06 +02:00
Magnus Norddahl
db0c516693 - avoid certain x86::ptr overloads as the last argument is not always an offset 2019-04-15 14:33:05 +02:00
Jonathan Russell
0da351bfea - fixed typo in last commit 2019-04-15 14:33:03 +02:00
Jonathan Russell
2dd2344e80 - implemented SS_R, LCS_R, and LKS_R 2019-04-15 14:33:02 +02:00
Magnus Norddahl
fb7df75011 - fix bug in LKF_R 2019-04-15 14:33:00 +02:00
Magnus Norddahl
d74cc3e49e - fixed OP_VTBL bug 2019-04-15 14:32:59 +02:00
Magnus Norddahl
e93d9570dc - fix crash in OP_RET handling 2019-04-15 14:32:57 +02:00
Magnus Norddahl
378e58731a - simplify some code 2019-04-15 14:32:56 +02:00
Jonathan Russell
b342dbc8db - added string PARAM and RET 2019-04-15 14:32:54 +02:00
Magnus Norddahl
608f49a4a8 - fix clang errors and warnings 2019-04-15 14:32:53 +02:00
Jonathan Russell
06780bf228 - added OP_MOVES, OP_CONCAT, OP_LENS, OP_CMPS 2019-04-15 14:32:52 +02:00
Magnus Norddahl
a4b3536caf - fix opcodes not being listed in jit debug assembly 2019-04-15 14:32:50 +02:00
Magnus Norddahl
c328f9c85c - move EmitRESULT to jit_call 2019-04-15 14:32:49 +02:00
Magnus Norddahl
ff8d21b2ec - minor cleanups in header file 2019-04-15 14:32:47 +02:00
Magnus Norddahl
9d970a1acb - split JitCompiler into multiple files 2019-04-15 14:32:46 +02:00
Jonathan Russell
8905701df7 - added strings and a few string opcodes 2019-04-15 14:32:44 +02:00
Magnus Norddahl
f3ca96373a - fix CALL_K and disable CALL 2019-04-15 14:32:43 +02:00
Magnus Norddahl
56fe7af9d3 - implement OP_CALL and OP_CALL_K 2019-04-15 14:32:41 +02:00
Magnus Norddahl
60ee2c91a4 - fix misc integer opcodes and remove mov statements when they have no effect 2019-04-15 14:32:40 +02:00
Jonathan Russell
279e97fcc9 - changed the way EmitComparisonOpcode works to get rid of the temporary register that was used previously 2019-04-15 14:32:38 +02:00
Magnus Norddahl
c248fad17f - implement PARAM and PARAMI 2019-04-15 14:32:37 +02:00
Magnus Norddahl
53b11dd0d8 - fix missing zero extend 2019-04-15 14:32:36 +02:00
Magnus Norddahl
29f6258d33 - fix that the code for META and CLSS was swapped 2019-04-15 14:32:34 +02:00
Magnus Norddahl
c2669d3a03 - some jump fixes 2019-04-15 14:32:33 +02:00
Magnus Norddahl
f7dd6a1313 - fix jump direction in EmitComparisonOpcode 2019-04-15 14:32:31 +02:00
Jonathan Russell
9530a2e43c - more spelling mistakes... 2019-04-15 14:32:29 +02:00
Jonathan Russell
a770b3af16 - fix minor spelling error 2019-04-15 14:32:28 +02:00
Jonathan Russell
821c336c5e - add vector comparison opcodes 2019-04-15 14:32:26 +02:00
Magnus Norddahl
14d6aa8cac - remove some macros and add functions checking if a register needs to be copied 2019-04-15 14:32:25 +02:00
Magnus Norddahl
35a8162022 - implemented LBIT, SBIT, VTBL, SCOPE, NEW, NEW_K, THROW, EQA_R and EQA_K 2019-04-15 14:32:23 +02:00
Magnus Norddahl
4cab630871 - implement emitter functions for LKP_R, META, CLSS, LO, LO_R, LP, LP_R, SO, SO_R, SP, SP_R
- add emit code for throwing exceptions on null pointers
2019-04-15 14:32:22 +02:00
Magnus Norddahl
2efaa7846d - improve jit debug output slightly 2019-04-15 14:32:20 +02:00
Magnus Norddahl
f0dbc8414a - fix offsetting bug when loading address registers 2019-04-15 14:32:19 +02:00
Magnus Norddahl
db78d02d79 - fix swapped operands in EmitSUBF_KR 2019-04-15 14:32:17 +02:00
Magnus Norddahl
ede8c6d86b - implement MODF_RR, MODF_RK and MODF_KR 2019-04-15 14:32:16 +02:00
Magnus Norddahl
708362b31f - fix mul using wrong instruction 2019-04-15 14:32:14 +02:00
Magnus Norddahl
c46a4d4483 - implement BOUND opcodes and add logging the resulting assembly code if asmjit throws an exception 2019-04-15 14:32:13 +02:00
Magnus Norddahl
c2938926a7 - implement a few more opcodes and fix some bugs 2019-04-15 14:32:11 +02:00
Magnus Norddahl
9427e22d7c - implemented pow, min, max 2019-04-15 14:32:10 +02:00
Magnus Norddahl
f4181be6b8 - implement ATAN2 and FLOP 2019-04-15 14:32:08 +02:00
Magnus Norddahl
77fe376eca - implement DYNCAST*, TEST, TESTN and JMP opcodes 2019-04-15 14:32:07 +02:00
Magnus Norddahl
9474a2554d - convert JitCompile's switch into a class to enable easier code reuse 2019-04-15 14:32:05 +02:00
Magnus Norddahl
9889d2fbb6 - fix clang compile error 2019-04-15 14:32:03 +02:00
Magnus Norddahl
976a7fab3a - implement throwing by storing exception information in a struct, then return from the jitted function and throw from c++ 2019-04-15 14:32:02 +02:00
Jonathan Russell
45bc0d266e - removed the ability to use printf-like formatting in emitAbortExceptionCall, it barely worked 2019-04-15 14:32:00 +02:00
Jonathan Russell
197b20af5d - add first draft of abort exceptions 2019-04-15 14:31:58 +02:00
Magnus Norddahl
c65b7076eb - call play sqrt when calculating lengths 2019-04-15 14:31:57 +02:00
Magnus Norddahl
50d0049460 - fix 8 and 16 bit store 2019-04-15 14:31:55 +02:00
Magnus Norddahl
76c08bf725 - destroy the jit runtime when all script functions are destroyed 2019-04-15 14:31:54 +02:00
Magnus Norddahl
4820c32794 - disable all unimplemented opcodes in the switch to ensure 'Unknown VM opcode' fatal error is generated if CanJit has a bug 2019-04-15 14:31:52 +02:00
Magnus Norddahl
e9914f38af Fix compile errors on macOS 2019-04-15 14:31:51 +02:00
Jonathan Russell
601c492cf2 - added remaining int arithmetic opcodes (and fixed float loading offset issue) 2019-04-15 14:31:49 +02:00
Jonathan Russell
e771064657 - forgot to turn off debug switch in last commit 2019-04-15 14:31:47 +02:00
Jonathan Russell
4228891da2 - made absMaskInt const 2019-04-15 14:31:46 +02:00
Jonathan Russell
8306815292 - implemented CMP_APPROX for OP_EQF_*, making ~== work for doubles 2019-04-15 14:31:44 +02:00
Chronos Ouroboros
e07af1428c Updated CanJit's supported opcodes list. 2019-04-15 14:31:43 +02:00
Chronos Ouroboros
63cda1c13d Pointer addition opcodes must leave NULL pointers as they are. 2019-04-15 14:31:41 +02:00
Chronos Ouroboros
3c8aa9f641 Changed binary int ops to use a temporary register, fixed some opcodes.
For some reason, binary ops might reuse one of the input registers as the output register.
This is a problem for very obvious reasons.
2019-04-15 14:31:39 +02:00
Jonathan Russell
62ece01c0a - made CMP_CHECK checking compile time 2019-04-15 14:31:37 +02:00
Jonathan Russell
f897f2bfd3 - added exact floating point comparison opcodes 2019-04-15 14:31:36 +02:00
Jonathan Russell
5846357268 - implemented all integer comparison operators 2019-04-15 14:31:34 +02:00
Jonathan Russell
166ce87a86 - adds OP_EQ_R, the first instruction using jumps 2019-04-15 14:31:33 +02:00
Magnus Norddahl
5c3ef8ac15 - add misc float opcodes 2019-04-15 14:31:31 +02:00
Jonathan Russell
b242ffdbbe - added most vector maths opcodes 2019-04-15 14:31:29 +02:00
Chronos Ouroboros
73892f4a6e Fix floats and implement some more opcodes. 2019-04-15 14:31:27 +02:00
Magnus Norddahl
113714990e - copy initial register values from the VM frame 2019-04-15 14:31:26 +02:00
Magnus Norddahl
10a6ab4d56 - implement most of the integer math opcodes 2019-04-15 14:31:24 +02:00
Magnus Norddahl
d651c02b17 - embed and use asmjit to JIT ZScript VM functions 2019-04-15 14:31:22 +02:00
drfrag
2039a306ae - Disable HRTF by default, it's slow on weak CPUs with many ambient sounds. 2019-04-15 13:30:21 +02:00
drfrag666
eafac3db33 - Fixed bad merge of "- more options for Doom 64 style gradients on walls". 2018-12-08 10:07:51 +01:00
drfrag666
6eca20a592 - Bumped version number for a new beta. 2018-12-04 18:54:17 +01:00
drfrag666
825a720b09 - Default gender for sound classes should be male and not other since it could be undefined in SNDINFO. 2018-12-03 20:19:46 +01:00
Player701
d72d820bba - Exported AActor::Grind to ZScript. 2018-11-30 10:18:43 +01:00
drfrag666
cdb60486c7 - Fixed compilation of previous commit. 2018-11-30 10:16:55 +01:00
Magnus Norddahl
e76a9c3085 - forgot to set the light level 2018-11-29 11:26:32 +01:00
Magnus Norddahl
20d5b904b2 - use psprite renderstyle on HUD models 2018-11-29 11:26:20 +01:00
Christoph Oelckers
7600b65810 - fixed: P_Recalculate3DFloors may not be called before the vertex buffer has been set up.
Since this function creates dynamic copies for 3D floors that need to be split it requires the vertex buffer index to be set up.
In older versions this did not produce errors because there was a fallback render path that was less efficient.
Now with that fallback removed this resulted in temporary 3D floors being created without valid vertex data.

# Conflicts:
#	src/p_setup.cpp

# Conflicts:
#	src/p_setup.cpp
2018-11-29 11:26:08 +01:00
Christoph Oelckers
0ddb5038c3 - fixed the mapping of additive translucency to color-based translucency.
The destination mode sould be 'One', not 'InvSrcColor'.
Now both of these are available as explicit modes, not just through the optional mapping.

# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp
#	src/r_data/renderstyle.cpp
#	src/r_data/renderstyle.h

With additional render styles from " - abstraction of render style in render state.". drfrag

# Conflicts:
#	src/r_data/renderstyle.cpp
#	src/r_data/renderstyle.h

With additional render styles from "- made the screen blend work for the software renderer.". drfrag
2018-11-28 14:39:54 +01:00
Christoph Oelckers
273c02ee73 - 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-26 11:28:31 +01:00
Marrub
3cf4a77c30 Fix null pointer access in p_terrain.cpp 2018-11-24 11:27:51 +01:00
Marisa Kirisame
9022c98732 expose defaultbloodcolor to ZScript. 2018-11-24 00:18:24 +01:00
alexey.lysiuk
9cf8be0259 - 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 19:41:07 +01:00
Magnus Norddahl
7675e7a6dc - use std::runtime_error instead as the constructor on std::exception is a MSVC extension 2018-11-23 19:41:06 +01:00
Christoph Oelckers
831cfd5280 - 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 19:41:05 +01:00
drfrag666
e1c521f4ce - Made previous condition more clear. 2018-11-22 11:16:46 +01:00
Rachael Alexanderson
d24d25ef55 - fix inverted logic of Intel check 2018-11-22 10:59:17 +01:00
Magnus Norddahl
edd58e6abf - only use shader cache on Intel
# Conflicts:
#	src/gl/shaders/gl_shaderprogram.cpp
2018-11-22 10:59:05 +01:00
Magnus Norddahl
ff761c9864 - fix compile error 2018-11-21 20:19:14 +01:00
Christoph Oelckers
34e003f7cd - regenerated gl_load with full OpenGL 4.5 declarations, mostly to get the direct state access functions. 2018-11-21 20:18:45 +01:00
Magnus Norddahl
e4dc685202 - implement a shader cache
# Conflicts:
#	src/gl/shaders/gl_shader.cpp
#	src/gl/shaders/gl_shaderprogram.cpp

# Conflicts:
#	src/gl/shaders/gl_shader.cpp
#	src/gl/shaders/gl_shaderprogram.h
2018-11-21 14:26:37 +01:00
Christoph Oelckers
b8ca67f426 - 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 21:57:12 +01:00
Major Cooke
eb1c356d41 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 21:57:11 +01:00
Christoph Oelckers
ebf46b8d04 - 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.

# Conflicts:
#	src/gl/textures/gl_material.h
#	src/textures/texture.cpp
2018-11-17 21:12:22 +01:00
Christoph Oelckers
6c76566bb1 - 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.

# Conflicts:
#	src/hwrenderer/textures/hw_material.cpp
#	src/textures/textures.h
2018-11-17 20:43:52 +01:00
Christoph Oelckers
40bd248da2 - fixed parameter mixup with P_CanResurrect. 2018-11-17 20:20:03 +01:00
Christoph Oelckers
17a33b609a - fixed: CVar.ResetToDefault was missing a check for use outside of menus. 2018-11-17 20:19:21 +01:00
Christoph Oelckers
692d6e9045 - 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 21:33:22 +01:00
Christoph Oelckers
c1edaa317d fixed right shift operator for unsigned values
This is version protected to avoid breaking old code.
2018-11-16 21:33:20 +01:00
Christoph Oelckers
38fe0b2fe1 - fixed: FxUnaryNotBitwise modified the source operand instead of allocating a new one. 2018-11-16 21:33:19 +01:00
Christoph Oelckers
c9f389770d - fixed: AActor' friction field was not saved 2018-11-16 21:33:18 +01:00
Player701
3bd16afc0f - Readonly pointer casting now works in ZScript. 2018-11-16 21:33:17 +01:00
Christoph Oelckers
834a96662b Make BounceFlags 32 bit wide. 2018-11-16 21:33:13 +01:00
Cacodemon345
0f2a4abe8f BOUNCEONUNRIPPABLES flag; makes actors bounce on actors with DONTRIP flag 2018-11-16 21:33:12 +01:00
alexey.lysiuk
6e922761a8 - fixed compilation of targets with optimization 2018-11-16 21:33:11 +01:00
Christoph Oelckers
645c7fb192 - 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.

# Conflicts:
#	.gitignore
2018-11-16 21:31:53 +01:00
Christoph Oelckers
67bde8090a 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-16 21:28:10 +01:00
Magnus Norddahl
7567462328 - fix missing type check when using Push or Insert for typed arrays 2018-11-16 21:26:33 +01:00
drfrag666
f9fff8bbce - fixed incompletely initialized secplanes in sprite splitting code.
(patch by Graf)

# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp

LZDoom was not affected tough.

# Conflicts:
#	src/gl/scene/gl_sprite.cpp
2018-11-16 21:26:15 +01:00
Major Cooke
57efd617fa Changed A_RaiseActor to just RaiseActor. 2018-11-16 21:17:53 +01:00
Major Cooke
bddf94d780 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-16 21:17:52 +01:00
Major Cooke
a083eb6421 Added A_RaiseActor(Actor other, int flags = 0) 2018-11-16 21:17:51 +01:00
Major Cooke
24fdaf751c 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-16 21:17:49 +01:00
Christoph Oelckers
1dad5101f1 - 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-16 21:17:46 +01:00
Christoph Oelckers
4183615495 - added ZScript export for side_t::SetSpecialColor. 2018-11-16 21:17:45 +01:00
Christoph Oelckers
79b2a7e043 - removed test code that was accidentally left in. 2018-11-16 21:17:11 +01:00
Christoph Oelckers
8368331481 - 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.

# Conflicts:
#	src/hwrenderer/scene/hw_renderstate.h
#	src/hwrenderer/scene/hw_walls.cpp

# Conflicts:
#	src/gl/scene/gl_walls_draw.cpp
2018-11-16 21:16:15 +01:00
Player701
e00db66432 - Fixed: Decal generator should be taken from the current weapon instance instead of the default instance. 2018-11-16 20:40:05 +01:00
drfrag666
f232ebb5b6 - Fixed TArray::Reset().
(patch by Graf)
2018-11-16 20:39:52 +01:00
Christoph Oelckers
07d5efcacb - 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.

# Conflicts:
#	src/hwrenderer/scene/hw_decal.cpp
#	src/hwrenderer/scene/hw_walls.cpp

# Conflicts:
#	src/gl/scene/gl_wall.h
#	src/gl/scene/gl_walls.cpp
#	src/gl/scene/gl_walls_draw.cpp
#	src/hwrenderer/scene/hw_decal.cpp
2018-11-16 20:39:22 +01:00
Christoph Oelckers
103f3f4cf9 - 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.

# Conflicts:
#	src/gl/renderer/gl_renderer.cpp
#	src/hwrenderer/scene/hw_bsp.cpp
#	src/hwrenderer/scene/hw_drawinfo.h
#	src/hwrenderer/scene/hw_drawlist.cpp
#	src/hwrenderer/scene/hw_fakeflat.cpp
#	src/hwrenderer/scene/hw_renderhacks.cpp

# Conflicts:
#	src/gl/renderer/gl_renderer.cpp
#	src/gl/renderer/gl_renderer.h
#	src/gl/scene/gl_bsp.cpp
#	src/gl/scene/gl_drawinfo.cpp
#	src/gl/scene/gl_fakeflat.cpp
#	src/gl/scene/gl_renderhacks.cpp
#	src/gl/scene/gl_scene.cpp
#	src/hwrenderer/scene/hw_drawinfo.h
#	src/hwrenderer/scene/hw_drawlist.cpp
#	src/hwrenderer/scene/hw_fakeflat.h
#	src/hwrenderer/scene/hw_sprites.cpp
#	src/hwrenderer/scene/hw_weapon.cpp
2018-11-16 15:10:50 +01:00
drfrag666
7f5bf11f12 - Forgot to update the version number after the beta 2 release. 2018-11-14 11:46:22 +01:00
Major Cooke
be2d5ba9ec Added DMG_NO_ENHANCE for DamageMobj.
- Disables PowerDamage's effect, similar to DMG_NO_PROTECT disabling PowerProtect.
2018-11-12 22:04:17 +01:00
alexey.lysiuk
e820880d46 - 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-12 21:53:14 +01:00
Christoph Oelckers
2fe54f4a53 - use TArray and FString in resource file management. 2018-11-12 21:53:13 +01:00
Christoph Oelckers
9a8e4a6285 - a few more buffers converted.
# Conflicts:
#	src/f_wipe.cpp
2018-11-12 21:53:12 +01:00
Christoph Oelckers
f744b9a0f8 - use TArray for most buffers in p_glnodes.cpp. 2018-11-12 21:53:11 +01:00
Christoph Oelckers
91663e1202 - 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-12 21:53:10 +01:00
Christoph Oelckers
3db6fc0900 - 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-12 21:53:09 +01:00
drfrag666
ab66abfdc1 - Some TArray changes.
(patches by Graf)
2018-11-12 21:53:08 +01:00
drfrag666
5740421d54 - Even more TArray changes.
(patches by Graf)
2018-11-12 21:52:16 +01:00
drfrag666
63edabba16 - Changed default GL fuzz type to software. 2018-11-12 11:16:01 +01:00
drfrag666
c2a3895bfe Revert "- add dithering to present shader"
This reverts commit 60ae0915b9.

This was extremely slow on intel, the dither matrix was recreated on every frame even when not used.
2018-11-12 11:11:28 +01:00
Christoph Oelckers
709a573355 - 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-10 11:19:25 +01:00
Major Cooke
484a44a0be Changed IsPointInMap to use P_PointOnDivlineSide. 2018-11-08 16:18:30 +01:00
Major Cooke
b34bc0947e Added IsPointInMap(Vector3 p).
- Checks if a point is inside the map geometry or not.
2018-11-08 16:18:29 +01:00
Christoph Oelckers
e261c73b31 - added copyright header to p_destructible.cpp 2018-11-08 00:18:09 +01:00
ZZYZX
7905a0e041 Exported destructible geometry to ZScript 2018-11-07 11:00:08 +01:00
ZZYZX
89bdd1adf0 Explode bouncing projectiles if hit damageable geometry 2018-11-07 11:00:06 +01:00
ZZYZX
b581648d6f Destructible geometry - minor fixes and 3D floor support 2018-11-07 11:00:05 +01:00
Christoph Oelckers
b6e032e9ae - fixed typo in sight checking code. 2018-11-07 11:00:02 +01:00
Christoph Oelckers
a42f30b3ea - 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-05 01:38:45 +01:00
Player701
ce481b2553 - undid the save version bump 2018-11-05 01:38:37 +01:00
Player701
4751181eb6 - Added a function to get the actor's age in ticks. 2018-11-05 01:38:37 +01:00
Player701
905146d87c - 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-05 01:38:35 +01:00
Cacodemon345
57e51debec Extend SKYEXPLODE flag for LineAttack 2018-11-03 21:52:25 +01:00
Christoph Oelckers
0357cd451e - added a method to FileReader to read the contents into an array and used it on the MIDI sources for testing. 2018-11-02 14:41:28 +01:00
Christoph Oelckers
a2760d7da2 - use a single TArray to allocate the memory for the lump manager's hash lists.
# Conflicts:
#	src/w_wad.cpp
#	src/w_wad.h
2018-11-02 14:40:51 +01:00
alexey.lysiuk
08dfdd2687 - 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-02 13:31:43 +01:00
alexey.lysiuk
bde980d5e8 - 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-02 13:31:41 +01:00
drfrag666
683aba3dd9 - bump ZScript version number to 3.7.0 2018-11-02 13:31:25 +01:00
Christoph Oelckers
6daece72c9 - versioned the return mismatch check to demote it to a warning for older versions than 3.7.
# Conflicts:
#	wadsrc/static/zscript.txt
2018-11-02 13:31:10 +01:00
alexey.lysiuk
7226f38375 - made 'return void' case a compilation error 2018-11-02 13:30:42 +01:00
Christoph Oelckers
16b3ccf930 - added far stronger restrictions for when the Boom-Texture-Y-offset compatibility flag may trigger.
This had absolutely no sanity checks and unconditionally picked the source texture if one existed.
It should only be done for wall textures, only for those defined in TEXTUREx and only for those where the scale is identical with the underlying texture.
2018-11-02 13:22:09 +01:00
Christoph Oelckers
da5fccb598 - fixed: Do not pass Sysex messages to Windows's GS Wavetable synth.
This will totally refuse to play a MIDI if that happens.
Duke Nukem's Alienz.mid, which did not play before works after this change.
2018-11-02 13:20:57 +01:00
Christoph Oelckers
9410e5ea98 - fixed: P_DamageMobj should clear reactiontime only for non-players.
For players this variable has an entirely different meaning which does not agree with being modified here.
2018-11-02 13:20:35 +01:00
Christoph Oelckers
3e4f1ea813 - fixed handling of wrapped midtextures to be actually useful when used in sky sectors.
# Conflicts:
#	src/hwrenderer/scene/hw_walls.cpp
2018-11-02 13:08:00 +01:00
Christoph Oelckers
be673459bd - made DBrokenLines serializable. 2018-11-02 13:07:28 +01:00
ZippeyKeys12
96fafa9c59 Export AllClasses 2018-11-02 13:07:12 +01:00
Cacodemon345
341105a15f Fix bounce state not entering when hit from top. 2018-11-02 13:06:48 +01:00
drfrag666
557380a769 - Added alpha parameter to DrawLine for the GL renderer, it's a fake parameter for the software renderer so mods don't crash. 2018-11-02 13:04:37 +01:00
Major Cooke
7eef13c859 Added VelIntercept.
- Uses the same code as Thing_ProjectileIntercept to aim and move the projectile.
  - targ: The actor the caller will aim at.
  - speed: Used for calculating the new angle/pitch and adjusts the speed accordingly. Default is -1 (current speed).
  - aimpitch: If true, aims the pitch in the travelling direction. Default is true.
  - oldvel: If true, does not replace the velocity with the specified speed. Default is false.

- Split the code from Thing_ProjectileIntercept and have that function call VelIntercept.
2018-11-01 21:25:56 +01:00
ZZYZX
a40d717006 Fixed sector floor/ceiling actions not triggering in P_XYMovement 2018-11-01 21:08:53 +01:00
ZZYZX
d2f6834da6 Implemented loading/saving of line/sector health and health groups in savegames 2018-11-01 21:08:51 +01:00
Christoph Oelckers
c17c6d97ad - missed one place where FBrokenLines was used. 2018-11-01 21:08:40 +01:00
Christoph Oelckers
cd3b0643a8 - fixed: An exception inside DestroyAllThinkers could send the engine into an endless loop of failed destructions. 2018-11-01 21:08:29 +01:00
Christoph Oelckers
0dba8e4f4a - use a saner data structure to store the BrokenLines.
Calling the old method with a pointer to an array of unspecified length 'dirty' would be an understatement.
Now it uses a TArray to store the single elements

# Conflicts:
#	src/g_shared/hudmessages.cpp
#	src/v_font.cpp
2018-11-01 21:08:17 +01:00
ZZYZX
82a2bf3ac5 Single commit - destructible geometry feature
# Conflicts:
#	src/p_setup.cpp
2018-11-01 21:02:25 +01:00
Player701
8e8d3719f7 - Introduced an enum named EventHandlerType and changed the bool argument in E_NewGame to this type. 2018-11-01 20:56:51 +01:00
player701
e04613811d - Static NewGame events now fire before loading a map, and normal NewGame events fire after registering per-map handlers and before all other events.
- Static event handlers now unregister after per-map handlers.
- All event handlers now unregister in reverse order.
2018-11-01 20:56:50 +01:00
Christoph Oelckers
1e84327c40 - added missing nullptr check.
# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp

# Conflicts:
#	src/gl/scene/gl_sprite.cpp
2018-11-01 20:55:53 +01:00
Christoph Oelckers
39d4db0a38 - added option to disable alpha testing for user shaders.
# Conflicts:
#	src/gl/shaders/gl_shader.cpp
#	src/hwrenderer/scene/hw_sprites.cpp

# Conflicts:
#	src/hwrenderer/textures/hw_material.cpp
#	src/r_data/gldefs.cpp
2018-11-01 20:51:08 +01:00
Christoph Oelckers
0623a92363 - use standard sprite lighting for voxels.
Per-pixel lighting requires normals which voxels do not have.

# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp

# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp
2018-11-01 20:02:46 +01:00
Rachael Alexanderson
6aa51b08da - do a texture check when drawing fog borders in the software renderer. this does not fix the crash issue, but mitigates it enough with a check that likely should be in place, anyhow. 2018-11-01 19:10:55 +01:00
Marrub
0f6f23350d Add "neutral" gender option and better obit formatting 2018-10-31 11:24:01 +01:00
drfrag666
3d66b9af09 - Doubled initial size for the light buffer.
(patch by Graf)
2018-10-30 13:05:55 +01:00
drfrag666
eebd6c8319 Revert "- removed the 8x8 block drawing code from softpoly"
This reverts commit d086c3d4dc.

# Conflicts:
#	src/polyrenderer/drawers/poly_triangle.cpp
#	src/polyrenderer/drawers/poly_triangle.h

The softpoly renderer crashed at high resolutions without them.
2018-10-26 19:51:30 +02:00
drfrag666
2c8b5e700f Revert "- use the worker threads to clear the stencil buffer"
This reverts commit 0a265d028d.

# Conflicts:
#	src/polyrenderer/drawers/poly_triangle.cpp
#	src/polyrenderer/drawers/poly_triangle.h
2018-10-26 19:39:38 +02:00
Magnus Norddahl
9882cd9d6b - fix softpoly bug where sprites and translucent walls in front of models would disappear 2018-10-25 13:57:03 +02:00
Tommy Nguyen
0403fb5416 - use value initialization for secspecial_t 2018-10-23 21:31:26 +02:00
Magnus Norddahl
b011900f48 - fix null pointer crash 2018-10-23 13:39:01 +02:00
Magnus Norddahl
6ca14ac8c6 - portal check is overridden by a different inverted check in the software renderer 2018-10-23 13:38:58 +02:00
Magnus Norddahl
a8112d4815 - Cull two-sided lines using the same rules as the software renderer is using (as suspicious as they may be) 2018-10-23 13:38:51 +02:00
alexey.lysiuk
063efa1ccd - fixed default values for S_ChangeMusic
https://forum.zdoom.org/viewtopic.php?t=62323#p1076849
2018-10-22 10:28:22 +02:00
Rachael Alexanderson
35bf70456a - fixed: attaching a new status bar to a player now calls 'setsizeneeded' - fixes an issue where the screen geometry is out of sync with the characteristics of the new status bar. 2018-10-20 21:22:24 +02:00
Marisa Kirisame
100ad0ac6d Preserve line locknumber in savegames. 2018-10-16 20:50:52 +02:00
drfrag666
2183f71ec6 - Make 160x100 scaling actually work, not that it's really useful.
This partially reverts "- don't let the video scale let the screen end up with a client size less than 320x200, which may cause undefined behavior and trigger asserts in debug builds."
2018-10-15 11:58:09 +02:00
Rachael Alexanderson
d3bdeacd09 - fixed: use 'setsizeneeded' more often in the scaling code. recalculating screen geometry for 2D elements when it changes never really hurts. 2018-10-15 11:32:34 +02:00
Rachael Alexanderson
24d42b74a7 - fixed: use templates.h function for minimal value check
# Conflicts:
#	src/r_videoscale.cpp
2018-10-15 11:32:06 +02:00
Rachael Alexanderson
c42c4afeeb - enforce 160x100 minimum in actual scaling code
# Conflicts:
#	src/r_videoscale.cpp
2018-10-15 11:28:08 +02:00
Christoph Oelckers
53c87fd5eb - extended the register limit for 'param'.
The instruction one free instruction byte so it's now using that to extend its argument's register range to 65535.
For param this is needed because it passes strings by reference and creating an implicit temporary copy for string constants does not work here.
2018-10-14 10:31:48 +02:00
player701
dcc2006c76 - Exported PickNewWeapon function from PlayerPawn to ZScript. 2018-10-14 10:31:46 +02:00
Christoph Oelckers
979c3022c4 - fixed: MD3s with a skin-less surface left the renderer in an undefined state.
The frame interpolation factor wasn't reset and rendering prematurely aborted with no chance to recover.
2018-10-09 22:00:04 +02:00
Magnus Norddahl
770c676ac9 - add gl_dither for toggling dithered output on and off
# Conflicts:
#	src/gl/renderer/gl_postprocess.cpp
#	src/gl/renderer/gl_stereo3d.cpp
#	src/hwrenderer/postprocessing/hw_presentshader.h
2018-10-09 21:57:14 +02:00
Rachael Alexanderson
960661df49 - fixed: smooth teleporters could fudge the player over an adjacent line, causing the player to appear on top of a cliff that is much higher than the original teleport. 2018-10-09 13:01:00 +02:00
Kevin Caccamo
434ffe542a Attempt to fix warnings from VS2017 Win64 compiler 2018-10-05 22:24:39 +02:00
Kevin Caccamo
a628cff085 Calculate normals for OBJ models with smooth groups
Add smoothGroup member to OBJFace struct, and assign the current smooth group number to it
Move face normal calculation code to CalculateNormalFlat
Add AddVertFaces method, which initializes and populates the vertFaces array of arrays, which holds references to triangle references per vertex
Only initialize and populate vertFaces if the model has missing normals and smooth groups
Assign smooth groups to triangle data
Add CalculateNormalSmooth method, which calculates the normals for each face the vertex is attached to, depending on whether or not the faces are part of the given smooth group, and averages them out
Add OBJTriRef struct, which holds references to triangles on OBJ surfaces

Make {agg,cur}SurfFaceCount unsigned ints
Change nvec to a value instead of a pointer
2018-10-05 22:24:26 +02:00
Christoph Oelckers
6df918341a - be more thorough with 'in menu' checks for certain protected functions.
They would also pass the test if a menu just was open but not the actual invoker.
Also error out if this happens so that modders can see that they are doing unsupported things. Silent failure is not a good idea here.
2018-10-05 22:24:25 +02:00
Christoph Oelckers
4cd4e01fff - fixed some warnings in OBJ model code.
(This clearly shows that using 'long' as parameters in any interface must be stopped. It is fundamentally unsafe to have a type whose size is not reliable - it's either an int-sized nor a pointer sized value, depending on the platform, and essentially worthless.)
2018-10-05 22:24:23 +02:00
drfrag666
dfe032dc8a - Fixed no rendering with shadowmaps enabled and render buffers disabled. 2018-10-05 01:56:28 +02:00
Marisa Kirisame
c674c3ff72 Computed facet normals for UE1 models were not normalized when they were supposed to. 2018-10-05 01:23:38 +02:00
drfrag666
9d10545ff2 - Fixed non valid value. 2018-10-04 21:10:05 +02:00
Vitaly Novichkov
72affb2c2e Upgrade libADLMIDI and libOPNMIDI
Added full-panning stereo, improvement of channel management, and many other things.

Also, I have implemented an ability to use custom WOPL (for libADLMIDI) and WOPN (for libOPNMIDI) banks from the same path as "soundfonts", but also, in the same environment, the "fm_banks" folder was added for WOPL/WOPN storing purposes.
To toggle usage of embedded or custom bank, I have added togglable booleans. When bank fails to be loaded, the default embedded bank is getting to be used as fallback.

ADLMIDI 1.4.0   2018-10-01
 * Implemented a full support for Portamento! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for SysEx event handling! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for GS way of custom drum channels (through SysEx events)
 * Ignore some NRPN events and lsb bank number when using GS standard (after catching of GS Reset SysEx call)
 * Added support for CC66-Sostenuto controller (Pedal hold of currently-pressed notes only while CC64 holds also all next notes)
 * Added support for CC67-SoftPedal controller (SoftPedal lowers the volume of notes played)
 * Fixed correctness of CMF files playing
 * Fixed unnecessary overuse of chip channels by blank notes
 * Added API to disable specific MIDI tracks or play one of MIDI tracks solo
 * Added support for more complex loop (loopStart=XX, loopEnd=0). Where XX - count of loops, or 0 - infinite. Nested loops are supported without of any limits.
 * Added working implementation of TMB's velocity offset
 * Added support for full-panning stereo option (Thanks to [Christopher Snowhill](https://github.com/kode54) for a work!)
 * Fixed inability to play high notes due physical tone frequency out of range on the OPL3 chip

OPNMIDI 1.4.0   2018-10-01
 * Implemented a full support for Portamento! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for SysEx event handling! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for GS way of custom drum channels (through SysEx events)
 * Ignore some NRPN events and lsb bank number when using GS standard (after catching of GS Reset SysEx call)
 * Added support for CC66-Sostenuto controller (Pedal hold of currently-pressed notes only while CC64 holds also all next notes)
 * Added support for CC67-SoftPedal controller (SoftPedal lowers the volume of notes played)
 * Resolved a trouble which sometimes makes a junk noise sound and unnecessary overuse of chip channels
 * Volume models support taken from libADLMIDI has been adapted to OPN2's chip speficis
 * Fixed inability to play high notes due physical tone frequency out of range on the OPN2 chip
 * Added support for full-panning stereo option

ADL&OPN Hotfix: re-calculated default banks
The fix on side of measurer of OPL3-BE and OPN2-BE where some instruments getting zero releasing time.

# Conflicts:
#	src/sound/mididevices/music_adlmidi_mididevice.cpp
#	src/sound/mididevices/music_opnmidi_mididevice.cpp
#	wadsrc/static/menudef.txt
2018-10-04 20:25:02 +02:00
Christoph Oelckers
48bf320570 - fixed warning in ADLMidi. 2018-10-04 19:53:21 +02:00
Marisa Kirisame
5877c0248d Exports various resurrection-related functions to ZScript. 2018-10-04 19:30:39 +02:00
Christoph Oelckers
24d09fe56a - some tweaking of shadowmap filter setting to allow changing the PCF filter's number of samplings.
# Conflicts:
#	src/gl/system/gl_cvars.h
#	src/gl/system/gl_menu.cpp
2018-10-04 19:19:56 +02:00
drfrag666
58b7967eea - enabled the linear shadowmap filter.
Although this doesn't look as good as the PCF version it is a lot less calculation intensive and therefore more suitable for weaker hardware.
It also tends to bleed through walls a lot less.
(refactored patch by Graf)
2018-10-04 19:08:49 +02:00
drfrag666
a51151d563 - Bumped ZScript version number so it's the same as in GZDoom. 2018-09-30 21:23:38 +02:00
Rachael Alexanderson
92d631deb7 - changed macro into a regular function 2018-09-29 21:26:56 +02:00
Rachael Alexanderson
f06501da22 - implement normalNx scaling
# Conflicts:
#	wadsrc/static/menudef.txt
2018-09-29 21:26:54 +02:00
drfrag666
c1f0335bb4 - Do not allow the TC_USE_SSE2 option on 64 bit targets. 2018-09-28 13:04:32 +02:00
Marisa Kirisame
7b28c224f0 Fix a major oversight that caused UE1 models to use the normals of the first frame for all frames. 2018-09-26 10:34:45 +02:00
Marisa Kirisame
a7952bc49b Hotfix: The output from CheckReplacement no longer permanently overrides an actor's replacement. 2018-09-24 01:07:14 +02:00
Marisa Kirisame
9028bbd473 Adds OnDrop virtual to inventory items. Called on the dropped item at the end of AActor::DropInventory. 2018-09-17 01:18:51 +02:00
Rachael Alexanderson
7227f54d1c - archive 'multiplayer' flag in savegames. https://forum.zdoom.org/viewtopic.php?f=2&t=61980 2018-09-15 20:41:18 +02:00
Major Cooke
78d4a87cd1 Added DMG_EXPLOSION flag.
- This allows modders to determine if damage is caused by an actual explosion, assigned by P_RadiusAttack and BlastActor for +TOUCHY actors.
2018-09-15 20:41:17 +02:00
Major Cooke
3d52b093a5 Allow LineAttack's LAF_NOINTERACT to fill FTranslatedLineTarget's information.
- Originally when the flag was made, LineAttack was not yet exported. This can now be benefitted directly from ZScript.
2018-09-15 20:41:16 +02:00
ZippeyKeys12
b26aad2741 Add NewGame to EventHandler
https://forum.zdoom.org/viewtopic.php?t=61908
2018-09-15 20:33:13 +02:00
alexey.lysiuk
7736504a22 Fixed code generation of infinite for loop
https://forum.zdoom.org/viewtopic.php?t=62023
2018-09-15 20:33:10 +02:00
drfrag666
c320a92dcf - Fixed gcc warning. 2018-09-09 13:35:50 +02:00
Christoph Oelckers
f039fabfb8 - fixed the use of Doom-Legacy-style 3D floor lighting in light mode 8.
Legacy used some strange blending formula to calculate its colormaps for colored 3D floor lighting, this is not available in the software lighting mode, so for these the engine has to temporarily revert to light mode 2 to render them correctly.

# Conflicts:
#	src/gl/compatibility/gl_20.cpp
#	src/gl/renderer/gl_lightdata.cpp
#	src/gl/renderer/gl_renderstate.h
#	src/gl/scene/gl_sprite.cpp
#	src/hwrenderer/scene/hw_weapon.cpp
#	src/hwrenderer/utility/hw_lighting.cpp
#	src/hwrenderer/utility/hw_lighting.h
#	src/v_2ddrawer.cpp
2018-09-09 13:09:31 +02:00
Christoph Oelckers
7848bab7b3 - fixed math imprecisions in horizon vertex generation.
Floats are not precise enough to be used as a loop counter.
2018-09-09 11:29:19 +02:00
Christoph Oelckers
608e5f5bcf - fixed bad code for OP_SRL_KR. 2018-09-02 18:47:42 +02:00
Christoph Oelckers
1e487ee30a - added profiling for postprocessing code.
# Conflicts:
#	src/gl/scene/gl_scene.cpp
#	src/gl/utility/gl_clock.cpp
#	src/hwrenderer/utility/hw_clock.h
2018-09-02 13:07:02 +02:00
drfrag666
a2674eb4cf - Added fake DrawThickLine action function so mods using it don't crash. DrawLine will be called instead. 2018-09-02 00:29:11 +02:00
Kevin Caccamo
50327255ed Update usage of LastIndexOf
Now that LastIndexOf works properly, update the code that uses it to find OBJ models

Also, make UE1 model finder use LastIndexOf
2018-09-01 11:15:18 +02:00
Kevin Caccamo
639d68277e Fix OBJ rendering in software renderers, and other things
Pass surf->vbStart to SetupFrame instead of 0, and pass 0 to DrawArrays instead of surf->vbStart.

Use a potentially faster method of modifying the OBJ file text buffer by modifying it directly.

Add RealignVector and FixUV methods to begin work on re-aligning OBJ models to the same orientation as MD3 models.

Re-align OBJ models to match MD3 models

Fix normal calculation for re-aligned OBJs

Ensure AddSkins does not go out of bounds of surfaceskinIDs

Do not precache skins that were replaced by the user.

Fix OBJs with a large number of materials not being fully rendered

Print a warning message if a material referenced by the OBJ could not be found.

Free surface triangles once they are no longer needed

Also, use continue instead of return so that surfaces after those with missing materials are still rendered.

Fail if a face side has no vertex reference. Vertex references are required for a valid OBJ.

Clean up OBJ model code

Remove commented code, mainly Printf's that aren't used any more.

Add more documentation comments, and tweak existing documentation comments

Replace ParseVector2 and ParseVector3 with a template ParseVector function
2018-09-01 11:15:16 +02:00
Kevin Caccamo
f785886c4b Fix rendering and parsing of OBJ models
Create a new surface for each 'usemtl' statement in the OBJ file, and fix memory errors caused by TriangulateQuad.

Calculate missing normals, and fix incorrect UV coordinates

Fix construction of vertex buffer for objects with multiple surfaces

Localize curMtl, curSurface, aggSurfFaceCount, and curSurfFaceCount to FOBJModel::Load(), since they are not used anywhere else.

Fix parsing of OBJs without UV references

Internally, I replaced hashtag line comments with C-style line comments, and I replaced each forward slash with newSideSep.

If no UV coordinates are available, add a default vector of (0,0).

Also, remove "this->" from ResolveIndex to make the code a bit cleaner, and fix a minor garbage issue I failed to notice earlier (normref would pick up garbage if there was no normal reference).

Ensure usemtl statements remain intact

It may be a bit inefficient, but I tried modifying the buffer directly, and I got memory corruption errors. In this case, it's a lot better to be safe than sorry.
2018-09-01 11:15:15 +02:00
Kevin Caccamo
188d8704e1 Initial work on OBJ model support
What works:
- Parsing the model
- Constructing geometry (surfaces) for triangulated models

What doesn't:
- Rendering the model
- Building the vertex buffer
- Triangulating quads
2018-09-01 11:15:13 +02:00
ZippeyKeys12
564d0af331 Moved FConfigFile over to FileReader/FileWriter
Don't use new operator, use value instead
2018-08-31 21:04:17 +02:00
alexey.lysiuk
a75cd861c2 - fixed: always initialize active colors in special font
https://forum.zdoom.org/viewtopic.php?t=61859
2018-08-31 11:11:57 +02:00
Braden Obrzut
870228c833 - Added paths for all games on Steam for Linux since they now offer the ability to download all games for Proton/Wine.
- Check ~/.steam on Linux for the config since either they moved it at some point or my setup changed and that's where it is for me now.
2018-08-29 19:28:43 +02:00
Christoph Oelckers
4efb5187c7 - defaulted constructors and assignment operators of several trivial types.
# Conflicts:
#	src/hwrenderer/textures/hw_material.cpp
2018-08-28 13:43:51 +02:00
drfrag666
9677ffe5b0 - Bumped ZScript version. 2018-08-26 14:04:33 +02:00
Rachael Alexanderson
342b476781 - fixed: sound from poly objects through portals will now propegate properly 2018-08-26 13:52:25 +02:00
Christoph Oelckers
80da2e74c5 - removed most of the old LastIndexOf methods in FString, only leaving one for ZScript and clearly giving it a name that says it all. RIndexOf has been made the proper version of LastIndexOf internally now. 2018-08-26 13:51:30 +02:00
Christoph Oelckers
23f2d9aaa0 - renamed RIndexOf to RightIndexOf 2018-08-26 13:51:28 +02:00
Kevin Caccamo
b57d2f11f3 Add the "RIndexOf" method to FString, which works like String.lastIndexOf from JavaScript
RIndexOf returns the index where the substring starts, instead of the index where the substring ends - 1.

Deprecate the LastIndexOf method of StringStruct
2018-08-26 13:51:27 +02:00
Magnus Norddahl
908f7d639d - only render visual portals if they are front facing 2018-08-23 20:54:31 +02:00
argv-minus-one
66933d6b91 Add ZScript method LevelLocals.SphericalCoords.
It computes spherical coordinates from one point in the world to another. Useful for checking whether one actor is inside another actor's view cone.
2018-08-22 12:14:19 +02:00
Christoph Oelckers
d729e31603 - made the MapSectionGenerator a class to remove a global array. 2018-08-22 12:02:16 +02:00
Christoph Oelckers
390c9117f1 - fixed bad comparators for std::sort 2018-08-22 02:16:19 +02:00
Christoph Oelckers
4ee0cc7841 - use std::sort to sort the draw lists to avoid having to go through global variables. 2018-08-22 01:53:55 +02:00
Christoph Oelckers
cad63e9b48 - removed access to deleted variable. 2018-08-22 01:49:53 +02:00
Christoph Oelckers
26a782031c - no, we do not want to use global variables to pass parameters around...
# Conflicts:
#	src/gl/models/gl_models.h
2018-08-22 01:49:33 +02:00
Christoph Oelckers
ec1c71feb1 - removed empty header gl_convert.h
# Conflicts:
#	src/gl/scene/gl_flats.cpp
#	src/gl/scene/gl_scene.cpp
2018-08-22 01:21:20 +02:00
Christoph Oelckers
542da7425c Fixed: DBaseStatusBar::Draw did not use its ticFrac parameter when being called from scripts
Instead it directly went to the global viewpoint again which would be inconsistent.
2018-08-22 01:01:47 +02:00
Christoph Oelckers
54e6922f28 Don't let DEarthquake depend on r_viewpoint.
The ticFrac value should be passed as a parameter, especially since this gets called from code that sets up r_viewpoint.
2018-08-22 00:51:59 +02:00
drfrag666
d79855d26b - disable any texture clamping for textures with a user shader.
This cannot be reliably determined so the least restrictive setting must be used.
(refactored patch by Graf)
2018-08-21 15:06:53 +02:00
Magnus Norddahl
a1c5194a25 - fix missing forward declaration when falling back to older user shaders 2018-08-20 20:11:36 +02:00
drfrag666
76dffaf658 - Fixed bad merge of "- rewrite the user shader support for materials - new syntax is to create a 'Material ProcessMaterial()' function". 2018-08-20 12:50:54 +02:00
Magnus Norddahl
fb31572ba3 - fix user defines and textures not working 2018-08-20 01:43:22 +02:00