Commit graph

227 commits

Author SHA1 Message Date
Magnus Norddahl
d667a0192a - fix null pointer crash 2018-05-06 02:31:58 +02:00
Christoph Oelckers
de15b589c0 - moved the screen blending code out of the renderer.
This is better be made part of the 2D interface.
That would have been done long ago if it hadn't been for the totally incompatible way this was handled by the purely paletted software renderer.
Now with that out of the way there is no point keeping this code this deeply embedded in the renderer.
2018-05-05 11:20:37 +02:00
alexey.lysiuk
2ae8d39441 Removed all superfluous #include's
Automatically optimized by CLion IDE with manual corrections
2018-04-24 14:30:35 +03:00
alexey.lysiuk
4ab6034a36 Cleaned up Windows backend from remains of Direct3D
Removed obsolete CMake settings, useless #include's, dead code
2018-04-18 17:05:25 +03:00
alexey.lysiuk
8cd3cf04e7 Fixed a few compilation warnings
src/gl/renderer/gl_renderer.cpp:775:39: warning: comparison of two values with different enumeration types ('F2DDrawer::ETextureDrawMode' and 'TexMode') [-Wenum-compare]
src/gl/renderer/gl_renderer.cpp:776:39: warning: comparison of two values with different enumeration types ('F2DDrawer::ETextureDrawMode' and 'TexMode') [-Wenum-compare]
src/gl/renderer/gl_renderer.cpp:777:39: warning: comparison of two values with different enumeration types ('F2DDrawer::ETextureDrawMode' and 'TexMode') [-Wenum-compare]
src/gl/renderer/gl_renderer.cpp:778:45: warning: comparison of two values with different enumeration types ('F2DDrawer::ETextureDrawMode' and 'TexMode') [-Wenum-compare]
src/gl/renderer/gl_renderer.cpp:779:40: warning: comparison of two values with different enumeration types ('F2DDrawer::ETextureDrawMode' and 'TexMode') [-Wenum-compare]
src/gl/renderer/gl_renderer.cpp:780:45: warning: comparison of two values with different enumeration types ('F2DDrawer::ETextureDrawMode' and 'TexMode') [-Wenum-compare]

src/v_draw.cpp:1144:51: warning: '&' within '|' [-Wbitwise-op-parentheses]

src/textures/texture.cpp:1050:20: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

src\intermission\intermission.cpp(80): warning C4101: 'lumpnum': unreferenced local variable
2018-04-08 13:55:46 +03:00
Christoph Oelckers
211a7f2569 - made the screen blend work for the software renderer.
It may use the same calculations as the hardware renderer but must use the 2D drawer for display.
It should be investigated if the hardware renderer can do this as well.
2018-04-07 10:53:20 +02:00
Christoph Oelckers
853903bb7e - removed the border refresh counter.
This was just a relic of DirectDraw as main backend and is no longer needed.
2018-04-03 00:50:40 +02:00
Christoph Oelckers
6d6196388e - made SPROFS a more usable feature.
This was originally invented to fix the sprite offsets for the hardware renderer.
Changed it so that it doesn't override the original offsets but acts as a second set.
A new CVAR has been added to allow controlling the behavior per renderer.
2018-03-31 10:37:46 +02:00
Christoph Oelckers
a40e085a46 - 2D drawer implementation complete for hardware renderer.
This also replaces DTA_ColormapStyle with proper implementations of its components. As implemented it was a very awkward mixture of various effects that already existed in a separate form. As a result of its implementation it required additional but completely redundant shader support which could be removed now. As a side effect of this change a new DTA_Desaturate option was added.
2018-03-29 16:21:21 +02:00
Christoph Oelckers
3ca3193379 - fixed a few things, but still not working. 2018-03-28 23:42:06 +02:00
Christoph Oelckers
16480a3f4b - it compiles again.
This won't work, though, because no backend for the new 2D code exists yet.
2018-03-28 16:40:09 +02:00
Christoph Oelckers
d650e37497 - stripped out the entire software 2D renderer and moved all 2D drawing functions to DFrameBuffer so that they cannot be used with software DSimpleCanvas anymore. 2018-03-26 23:16:27 +02:00
Christoph Oelckers
e89a598b31 - renamed FTexture's UseType flags and gave them a dedicated type.
This was done mainly to reduce the amount of occurences of the word FTexture but it immediately helped detect two small and mostly harmless bugs that were found due to the stricter type checks.
2018-03-25 20:26:16 +02:00
Jonathan Russell
708d24aba7 - added Screen.getViewWindow function 2018-01-20 21:56:34 +01:00
Rachael Alexanderson
d10304ea4e Merge commit 'refs/pull/355/head' of https://github.com/coelckers/gzdoom 2017-12-24 07:48:11 -05:00
Rachael Alexanderson
45d5eac6ad - fix last commit - somehow it pushed an old version of the fix (yet again?...) - this is the proper fix. 2017-08-19 06:03:26 -04:00
Rachael Alexanderson
dae83f989b - fixed: changing 'uiscale' did not always update the screen size properly. 2017-08-19 05:58:04 -04:00
Jonathan Russell
03640a16ea - removed ZScript DrawLine palcolor arg 2017-08-03 02:09:48 +01:00
Jonathan Russell
941d89042a - externalise DCanvas::DrawLine to ZScript 2017-08-03 01:20:55 +01:00
Rachael Alexanderson
cc9fa8a6f5 - fixed: Prevent /0 errors when calculating console scale, which could happen in certain rare situations. 2017-06-19 23:46:07 -04:00
alexey.lysiuk
c7b895c8ff Fixed applying of clip rect to screen dimming
https://forum.zdoom.org/viewtopic.php?t=56719
2017-06-05 09:48:09 +03:00
Christoph Oelckers
c519e76280 - fixed calculation of clipping rect's lower edge. 2017-04-23 12:58:40 +02:00
Christoph Oelckers
1135f154b7 - fixed: For Screen.SetClipRect, -1 is a valid value for width and height so it must not be clamped away. 2017-04-14 15:41:36 +02:00
Christoph Oelckers
6599e2c425 - moved the VM types into their own file and only include it where really needed. 2017-04-13 01:12:04 +02:00
Christoph Oelckers
5601364aaf - fixed some issues with Set/GetClipRect. 2017-03-30 21:12:39 +02:00
Christoph Oelckers
3a1228bf95 - exported the clipping rectangle to scripting and added a statusbar scaling wrapper for it.
- fixed: BaseStatusBar.Fill did not pass its flags parameter to the native function.
2017-03-30 12:13:28 +02:00
Christoph Oelckers
a3ef711d1d - added a special slider type for the scaling options that prints a descriptive text instead of the slider for the special settings.
- fixed the adaptive scale calculation in GetUIScale which had the coordinates mixed up.
2017-03-30 11:30:09 +02:00
Christoph Oelckers
f95c29ad28 cleaned up the scaling options.
- all 5 settings affected by uiscale have been changed to have the exact same semantics: -1, if supported means special scaling, this is available for HUD and status bar, 0 means to use uiscale, any larger value is a direct scaling factor.
- scaling is cut off when the factor is larger than screenwidth/320 or screenheight/200 because anything larger will definitely not fit.
- a lot of code has been cleaned up and consolidated. Especially the message code had an incredible amount of redundancy.
- all scaling options have been moved into a submenu. This menu is not complete, though - it still requires a special menu widget to convey the intended information without confusing the user.
2017-03-30 02:16:23 +02:00
Christoph Oelckers
01b095c911 - added colorization for untranslated fonts. This uses the light color of the vertices. The software rendered 2D code will ignore this infomation.
- added a virtual OnRetrun method to menus.
2017-03-29 21:22:05 +02:00
Christoph Oelckers
1d4ab0cc2a - implemented proper scaling for the status bar itself.
This allows using the UI scale or its own value, like all other scaling values.
In addition there is a choice between preserving equal pixel size or aspect ratio because the squashed non-corrected versions tend to look odd, but since proper scaling requires ununiform pixel sizes it is an option.

- changed how status bar sizes are being handled.

This has to recalculate all scaling and positioning factors, which can cause problems if the drawer leaves with some temporary values that do not reflect the status bar as a whole.
Changed it so that the status bar stores the base values and restores them after drawing is complete.
2017-03-29 19:23:40 +02:00
Magnus Norddahl
d160424aea - added DFrameBuffer::HasBegun2D to allow scripting to test if 2D drawing is active (instead of using IsLocked, which may return false when vid_hw2d is active) 2017-03-29 00:45:53 +02:00
Christoph Oelckers
e2e17f575c - added safeguards to all 2D drawing functions to throw an exception if used outside a valid 2D draw context.
This is necessary because the hardware accelerated renderers will hide the problem, but with pure software rendering to a locked hardware surface, like DirectDraw can result in a crash.
Note that ANY mod that gets caught in this did something wrong!
2017-03-28 13:25:17 +02:00
Christoph Oelckers
f3db5f3803 - added a clipping rectangle to DCanvas that can be used independently of DrawTexture calls.
Currently this is only being used for draw operations that are not automap related, i.e. DrawLine, DrawPixel and FillSimplePoly are not subjected to it.
2017-03-28 13:06:24 +02:00
alexey.lysiuk
c8eabe57ff Fixed compilation warning reported by GCC/Clang
src/v_draw.cpp:503:25: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
2017-03-26 22:10:05 +03:00
Christoph Oelckers
3e67a8bafa - let hud_scale act like an override to uiscale, just like con_scale does.
- better handling of ForceScale for the fullscreen HUD that doesn't mess around with CVARs.
- moved the mug shot into the status bar, because this is global state that needs to be shared between different pieces of code which want to display a mug shot.
- SBARINFO should work off the current status bar settings instead of the ones stored in its script object
2017-03-25 18:32:47 +01:00
Christoph Oelckers
b17b8d32ad completely redid the active powerup drawer for the HUD
- replaced Inventory.DrawPowerup with a GetPowerupIcon method so that the calling code can handle the drawing and apply its own rules. This was a major design flaw of allowing the inventory items to handle the drawing themselves, because they were unable to adjust to different HUD frontends. Note that any mod that overrides DrawPowerup will not draw any icon that expects to be handled that way!
- the alternative HUD now has its own, separate drawer that obeys the AltHUD's rules, and not the ones of the normal fullscreen HUD.
- the standard drawer has been scriptified as a virtual function.
- Both drawers now handle positioning of the icon inside its assigned box themselves instead of trusting the powerup item to do it correctly.
- DTA_HUDRules and Screen.DrawHUDTexture are to be considered deprecated because both do not integrate into the redesigned HUD code.
2017-03-24 22:58:16 +01:00
Christoph Oelckers
a3ee3c287e - major progress on the status bar code: SBARINFO's DrawGraphic has been ported into a generic function of the base statusbar class and put to use for a few items on the Strife status bar.
- decided to ditch the widget system I had started to lay out. As it turns out that would make things far more complicated and slower than they need to be.
2017-03-24 00:47:08 +01:00
Christoph Oelckers
4c51a4fc59 - reimplemented the health bar for Strife's status bar. 2017-03-22 14:59:12 +01:00
Christoph Oelckers
9bffe4ee50 - scriptified the main statusbar interface and the Strife status bar.
Note that the Strife status bar does not draw the health bars yet. I tried to replace the hacky custom texture with a single fill operation but had to find out that all the coordinate mangling for the status bar is being done deep in the video code. This needs to be fixed before this can be made to work.

Currently this is not usable in mods because they cannot initialize custom status bars yet.
2017-03-22 00:32:52 +01:00
Christoph Oelckers
9a24771a7d - refactored FDynamicColormap out of sector_t.
This has increasingly become an obstacle with the hardware renderer, so now the values are being stored as plain data in the sector, with the software renderer getting the actual color tables when needed. While this is a bit slower than storing the pregenerated colormap, in realistic situations the added time is mostly negligible in the microseconds range.
2017-03-15 22:04:59 +01:00
Christoph Oelckers
bd7476fb8d - untangled r_defs.h from actor.h
Both files can now be included independently without causing problems.
This also required moving some inline functions into separate files and splitting off the GC definitions from dobject.h to ensure that r_defs does not need to pull in any part of the object hierarchy.
2017-03-10 02:22:42 +01:00
Christoph Oelckers
9b87a167d7 - replaced a large batch of DWORDs.
Most of those which still rely on ZDoom's own definition should be gone, unfortunately the code in files that include Windows headers is a gigantic mess with DWORDs being longs there intead of ints, so this needs to be done with care. DWORD should only remain where the Windows type is actually wanted.
2017-03-09 20:19:55 +01:00
Christoph Oelckers
d2beacfc5f - except for DWORD, all homegrown integer types are gone - a handful were left where they represent genuine Windows types. 2017-03-09 19:54:41 +01:00
Christoph Oelckers
c008ddaf66 - replaced homegrown SWORD, SBYTE and uint32_t types. 2017-03-09 19:31:45 +01:00
Rachael Alexanderson
404b326812 Merge https://github.com/coelckers/gzdoom 2017-02-25 18:32:06 -05:00
Christoph Oelckers
8dac678200 - added DAMAGE_NO_ARMOR flag for ACS's SectorDamage function. 2017-02-25 19:10:49 +01:00
Magnus Norddahl
9159e3b1f0 Move software canvas drawing to its own file in the software renderer 2017-02-13 17:32:52 +01:00
Magnus Norddahl
10b36934c2 Fix vid_hw2d 0 translation bug 2017-02-13 16:13:24 +01:00
Magnus Norddahl
93f43e8751 Menu code accessed the screen buffer without a lock 2017-02-13 15:42:35 +01:00
Magnus Norddahl
69787fac72 Fix translation issue 2017-02-13 15:08:11 +01:00