Commit graph

15890 commits

Author SHA1 Message Date
Christoph Oelckers
4cedbf6cc2 - split between textures and images is complete now.
* split up FMultiPatchTexture into a builder class and the actual image source.
* since images can now be referenced by multiple textures the old redirection mechanism has been removed. It can be done better and less intrusive now. Simple single patch textures already directly reference the underlying patch image now.
* allocate all image source related data from a memory arena. Since this is all static this makes it a lot easier to free this in bulk.
2018-12-09 15:25:56 +01:00
Christoph Oelckers
91f7121452 - made some changes to the FImageSource interface that allows forwarding the bRemap0 flag, but do it so that it doesn't permanently alter how the image looks.
In ZDoom this would affect everything using a patch that got used in a front sky layer, even if the texture was totally unrelated. It is only owed to the low usability of such patches for other purposes that this hasn't caused problems.
2018-12-09 08:15:05 +01:00
Christoph Oelckers
583a740441 - separated the image converters from the texture offsets.
Mostly done, except for FMultiPatchTexture and FFontChar1 + 2.
Note that this commit leaks those image objects!
2018-12-09 07:39:05 +01:00
Christoph Oelckers
5eab944157 - started separating the texture class from the image format handlers. 2018-12-08 23:28:35 +01:00
Christoph Oelckers
e35d88e039 - moved some utility code out of FTexture. 2018-12-08 20:44:28 +01:00
Christoph Oelckers
03626107eb - changed multipatch texture composition to always composite off full source images and not do it recursively.
Previously it tried to copy all patches of composite sub-images directly onto the main image.
This caused massive complications throughout the entire true color texture code and made any attempt of caching the source data for composition next to impossible because the entire composition process operated on the raw data read from the texture and not some cacheable image. While this may cause more pixel data to be processed, this will be easily offset by being able to reuse patches for multiple textures, once a caching system is in place, which even for the IWADs happens quite frequently.

Removing the now unneeded arguments from the implementation also makes things a lot easier to handle.
2018-12-08 17:23:15 +01:00
Christoph Oelckers
1e070d27bd - replaced FTexture::FillBuffer 2018-12-08 14:06:16 +01:00
Christoph Oelckers
82bd742ea3 - reworked how the software renderer manages its textures.
* it's no longer the main texture objects managing the pixel buffer but FSoftwareTexture.
* create proper spans for true color textures. The paletted spans only match if the image does not have any translucent pixels.
* create proper warp textures instead of working off the paletted variants.

As a side effect, caching of pixel buffers for texture composition is temporarily disabled, as it management of texture redirections. These things will be reimplemented once things progress further. The existing methods here had their share of serious issues that should be fixed.
2018-12-08 12:42:35 +01:00
Christoph Oelckers
69cc1f831c Renamed FTexture::GetPixels
This was needed to allow refactoring without letting all the other GetPixels get in the way.
2018-12-07 03:35:10 +01:00
Christoph Oelckers
9409843931 - replaced the last access operator, too
Now everything uses a function.
This really wasn't what operators are supposef to be used for.
2018-12-07 03:01:40 +01:00
Christoph Oelckers
42b18e6dfb - Disable PALVERS substitution when true color rendering is active. 2018-12-07 02:53:50 +01:00
Christoph Oelckers
79a0f76801 - replaced TexMan.operator() with two functions.
This was done to make reviewing easier, again because it is virtually impossible to search for the operators in the code.

Going through this revealed quite a few places where texture animations were on but shouldn't and even more places that did not check PASLVERS, although they were preparing some paletted rendering.
2018-12-07 02:53:18 +01:00
Christoph Oelckers
3dc9eab743 Renamed the operator() and [] methods in FTextureManager which take a name
The operators cannot be easily searched for so this makes it hard to do any evaluations on the use of this method.
2018-12-07 02:43:27 +01:00
Christoph Oelckers
9fedecbe60 Renamed FTextureManager::GetTexture to GetTextureID
It doesn't return a texture after all and I want to repurpose the name for something else.
2018-12-07 02:31:30 +01:00
Christoph Oelckers
3491182ac3 - fixed compilation 2018-12-07 02:21:39 +01:00
Christoph Oelckers
bde3558dc2 - moved the bit size variables to FSoftwareTexture
They are only needed by the software rasterizer.
2018-12-07 02:13:11 +01:00
Christoph Oelckers
18c1a3abe5 - make the FWarpTexture class local to the software renderer.
This class has only meaning for software-based warping so it doesn't have to be a part of the FTexture hierarchy.
Making it a subclass of FSoftwareTexture is fully sufficient.
2018-12-07 00:58:37 +01:00
Christoph Oelckers
4c67785c40 - moved the span and swtruecolor creation code into FSoftwareTexture. 2018-12-07 00:04:39 +01:00
Christoph Oelckers
32e245f2b9 - moved the software rendering specific parts of the sky setup to r_skyplane.cpp. 2018-12-06 20:52:03 +01:00
Christoph Oelckers
d500dc99ea - handle the Harmony status bar icon scaling a bit more robustly.
Considering that the physical texture size should be abstracted away from modding this needs to be done differently.
Doing any calculations with physical texture sizes on the mod side is only going to cause errors so this had been changed to always return scaled size.
2018-12-06 20:21:33 +01:00
Christoph Oelckers
a4d61e6fb1 - everything compiles again.
As a bonus this already fixes several bugs caused by the botched texture scaling implementation the original texture manager came with.
System cursors are currently disabled because they rely on functionality that needs to be moved to different classes.
2018-12-06 20:12:15 +01:00
Christoph Oelckers
6eab4a882c - narrowing down the public interface of the texture class
Cannot refactor if the entire class is this wide open to everything.
Not complete yet, doesn't fully compile!
2018-12-06 01:11:04 +01:00
Magnus Norddahl
e83af15907 - remove some redundant variables 2018-12-06 04:34:19 +01:00
Magnus Norddahl
2aefeb6401 - Use static ifs (C++11 version of them, anyhow) for the triangle draw function 2018-12-06 03:10:14 +01:00
Christoph Oelckers
e22e249287 - this "genuine hack" was totally redundant... 2018-12-06 00:34:17 +01:00
Christoph Oelckers
aef882c137 - more direct native stuff, this is a week old but was almost forgotten. 2018-12-06 00:28:05 +01:00
Christoph Oelckers
e01306d403 - missed one definition for adding a direct native call. 2018-12-06 00:17:07 +01:00
Christoph Oelckers
494a113920 - 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.
2018-12-05 20:10:44 +01:00
Christoph Oelckers
2e7e6cba9d - scriptified P_CheckMeleeRange2. 2018-12-05 18:58:15 +01:00
Christoph Oelckers
e4e86dd4f8 - 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.
2018-12-05 18:41:19 +01:00
Christoph Oelckers
de5ab0b4b6 - deprecated a few functions that depend on AAPTR_* to be useful. 2018-12-05 18:33:59 +01:00
alexey.lysiuk
b8c4a506a7 - 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'
2018-12-05 18:10:22 +02:00
Christoph Oelckers
148d75251f - fix it 2018-12-05 17:41:25 +01:00
Christoph Oelckers
eb282c0d11 Merge branch 'master' of https://github.com/coelckers/gzdoom
# Conflicts:
#	src/scripting/vmthunks_actors.cpp
2018-12-05 17:34:53 +01:00
Christoph Oelckers
6c9d0b166a Added direct native entry points to a larger number of functions. 2018-12-05 17:34:11 +01:00
alexey.lysiuk
101ebe1731
- 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'
2018-12-05 10:25:07 +02:00
Christoph Oelckers
a846ed391e - fixed: ST_FormatMapName did not clear the string it wrote to before appending text. 2018-12-05 08:29:39 +01:00
Christoph Oelckers
5e1fc45816 fixed missing include. 2018-12-05 08:22:24 +01:00
Christoph Oelckers
2f2ce8126b - fixed definition of GetUDMFString export. 2018-12-05 08:18:07 +01:00
Christoph Oelckers
fd801ca91b - fixed: SlotPriority must be a float.
It was a fixed before but I missed that when refactoring it into an automatic property.
2018-12-05 08:13:52 +01:00
Rachael Alexanderson
0d891b6289 - Enforce CheckCheatmode() for cheat-enforced CVARs, allowing them to be changed in normal single player games 2018-12-05 00:21:39 +01:00
Christoph Oelckers
33db5792b4 - moved a large part of the VM thunks out of p_mobj.cpp. 2018-12-05 00:21:16 +01:00
Christoph Oelckers
a3265c2963 - more direct native entry points. 2018-12-04 23:12:16 +01:00
Christoph Oelckers
3b5ce4ecca - fixed: SBar_SetClipRect had a superfluous argument resulting in incorrect behavior 2018-12-04 19:14:14 +01:00
Christoph Oelckers
e928b94ab2 - missed the header... 2018-12-04 18:53:12 +01:00
Christoph Oelckers
d0f037d14f - the native APlayerPawn::PlayAttacking2 function is not needed anymore. 2018-12-04 18:51:03 +01:00
Christoph Oelckers
8025f02935 - fix bad return type. 2018-12-04 18:47:03 +01:00
Christoph Oelckers
d7da2d838f - 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.
2018-12-04 18:45:07 +01:00
Christoph Oelckers
45d7e5a038 - scriptified ASpecialSpot.
This only had two simple native methods so the class is not fully scripted.
2018-12-04 18:21:48 +01:00
Christoph Oelckers
de9805d5c7 - 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.
2018-12-04 18:21:00 +01:00