Commit graph

26 commits

Author SHA1 Message Date
Maksim Zinal
75e9af81e1 Fixed SIGSEGV caused to references to already deleted data values in idWindow ops and updateVars 2020-05-30 05:28:40 +02:00
gab
7d9d8680e1 Additional fix 2019-01-07 15:06:59 +01:00
gab
12629e1f66 Support for D3 demo data files (minimum viable changes) 2019-01-07 15:06:59 +01:00
Daniel Gibson
cd0a11f974 Allow scaling non-menu WIN_DESKTOP GUIs to 4:3
WIN_DESKTOP means that this can currently only be set for the top-level
window in a .gui (all its subwindows/widgets will be scaled implicitly)

There are two ways to make a GUI use this:
1. in the .gui add a window variable "scaleto43 1", like
    windowDef Desktop {
	rect	0 ,0 ,640 ,480
	nocursor	1
	float	talk 	0

	scaleto43 1

	// .. etc rest of windowDef

2. When creating the GUI from C++ code, you can afterwards make the
   UserInterface scale to 4:3 like this:
    idUserInterface* ui = Whatever(); // create it
    ui->SetStateBool("scaleto43", true);
    ui->StateChanged(gameLocal.time);
   Both lines are important!

As you can see in my changes to Player.cpp, my primary usecase for this
is the cursor/crosshair GUI.
2018-11-05 04:33:57 +01:00
Daniel Gibson
e41bf2b147 Scale "Menu" GUIs (incl. PDA + fullscreen vids) to 4:3
So stuff doesn't look so distorted in widescreen resolutions.
Implies that there are black bars on the left/right then..

Can be disabled with "r_scaleMenusTo43 0"

Does *not* affect the HUD (incl. crosshair) - scaling it automagically
would be very hard (or impossible), because it doesn't only render
the crosshair, healthpoints etc, but also fullscreen effects like the
screen turning red when the player is hit - and fullscreen effects
would look very shitty if they didn't cover the whole screen but had
"empty" bars on left/right.

(Mostly) fixes #188 and #189
2018-10-28 05:29:11 +01:00
Daniel Gibson
7a8f0e9fdb Allow injecting video mode list into Mod menus
Mods that have their own video settings menu can tell dhewm3 to replace
the "choices" and "values" entries in their choiceDef with the
resolutions supported by dhewm3 (and corresponding modes).
So if we add new video modes to dhewm3, they'll automatically appear in
the menu without changing the .gui
To enable this, the mod authors only need to add a "injectResolutions 1"
entry to their resolution choiceDef. By default, the first entry will
be "r_custom*" for r_mode -1, which means "custom resolution, use
r_customWidth and r_customHeight".
If that entry shoud be disabled for the mod, just add another entry:
"injectCustomResolutionMode 0"
2018-10-21 23:56:38 +02:00
Tobias Frost
dbb90b7565 Some spelling error fixes found during Debian build
- s/allready/already
- s/Uknown/Unknown
- s/thier/their
2018-06-30 00:08:45 -01:00
Daniel Gibson
befe732dbb Fix new[]/delete missmatches and memory leaks found by clang's ASAN
Sometimes memory was allocated with new[] but freed with delete instead
of delete[], which is wrong.
And there were some small memory leaks, too.
Furtunately clang's AddressSanitizer detected all that so I could easily
fix it.

(There seem to be some more small memory leaks which are harder to fix,
though)
2015-12-17 18:11:03 +01:00
Daniel Gibson
dad0eda29e Release Candiate 1 preparations, other small fixes 2015-10-03 19:14:22 +02:00
Daniel Gibson
61d3efec98 Fix mouse cursor moving to fast in fullscreen GUIs (main menu, PDA)
The fullscreen guis pretend to be 640x480 internally, also for the mouse
cursor position. So adding the actually moved pixels (when playing the
game at a higher resolution) to the GUIs cursor position makes it move
too fast.
To fix that I detect (hopefully that check is reliable!) if the
idUserInterfaceLocal instance is a fullscreen GUI and if so scale the
reported mouse moved pixels with 640/actual_window_width and
480/actual_window_height.
2015-09-30 18:38:27 +02:00
Daniel Gibson
c0e8e20628 Nasty hack to show more default resolutions in menu
the resolutions are really hardcoded in an ugly combination of the
values r_mode supports, a string in strings/*.lang ("#str_04222")
describing the resolutions r_mode supports
("640x480;800x600;1024x768;1152x864;1280x1024;1600x1200")
and a string in mainmenu.gui with the corresponding r_mode values
("3;4;5;6;7;8").. as neither the strings nor mainmenu.gui are GPL'ed
I can't really redistribute a changed version of them.

So I added lots of resolutions to r_vidModes and wrote two functions
that generate the resolutions list string and r_mode value
string for the GUI.
Then I added a hack in the code that detects when the "window" for the
system options ("choiceDef OS2Primary") is created and overwrites the
hardcoded strings with custom ones from my new functions.

This is tested with both the main game and the official d3xp
(Resurrection of Evil) Addon.
No idea if it works with other mods, depends on whether they just copied
that part of the menu or wrote their own.
2015-09-28 16:01:18 +02:00
Daniel Gibson
1de6ab0d50 Fix some compiler warnings (wrong types, superfluous checks, printf-fuckup) 2015-09-27 18:12:16 +02:00
dhewg
d9bc9c6484 Silence warnings for removed cvars in ChoiceWindow
Disables these warnings:
WARNING: idChoiceWindow::InitVars: gui 'guis/mainmenu.gui' window
'ADVNet5Primary' references undefined cvar 'net_serverAllowServerMod'
WARNING: idChoiceWindow::InitVars: gui 'guis/mainmenu.gui' window
'SNDBPrimary' references undefined cvar 's_driver'

Both cvars have been removed from this tree.
2012-07-20 00:12:56 +02:00
dhewg
91bca094c0 Fix out of bounds access for buggy UIs
Seen with the main menu on the mod 'Classic Doom 3'.
2012-01-12 19:05:51 +01:00
dhewg
736ec20d4d Untangle the epic precompiled.h mess
Don't include the lazy precompiled.h everywhere, only what's
required for the compilation unit.
platform.h needs to be included instead to provide all essential
defines and types.
All includes use the relative path to the neo or the game
specific root.
Move all idlib related includes from idlib/Lib.h to precompiled.h.
precompiled.h still exists for the MFC stuff in tools/.
Add some missing header guards.
2011-12-19 23:21:47 +01:00
dhewg
10e9ef2a52 Fix -Wdelete-non-virtual-dtor warnings
delete called on 'idSIMDProcessor' that is abstract but has
non-virtual destructor
2011-12-13 19:26:16 +01:00
dhewg
1d9fd6948a Fix id[Simple]Window for x86_64 2011-12-10 15:36:11 +01:00
dhewg
e97d328804 Fix -Winvalid-offsetof warnings 2011-12-10 15:36:06 +01:00
dhewg
50a48cdf6b Fix -Woverloaded-virtual warnings
hides overloaded virtual function

Fix member signatures of deriving classes to its super classes.
Removes the unused idGameBustOutWindow::Activate() and the
useless idMarkerWindow::GetWinVarByName().
2011-12-10 15:36:05 +01:00
dhewg
3f5c14ef5f Fix -Wunused-but-set-variable warnings
variable set but not used

Removes some CollisionModel code under _DEBUG which was probably a
leftover, since it was completely useless (its done later anyways).
2011-12-10 15:36:04 +01:00
dhewg
e4771f3a5f Fix -Wunused-variable warnings
unused variable
2011-12-10 15:36:03 +01:00
dhewg
09f03c531a Fix -Wmissing-braces warnings
missing braces around initializer for ‘const char* [2]’
2011-12-10 15:36:01 +01:00
dhewg
14329d47d8 Fix -Wchar-subscripts warnings
array subscript has type ‘char’
2011-12-10 15:36:00 +01:00
dhewg
79ad905e05 Fix all whitespace errors
Excluding 3rd party files.
2011-12-10 15:35:54 +01:00
dhewg
ff493f6847 Fix quoting in GPL headers 2011-12-10 15:34:48 +01:00
Timothee 'TTimo' Besset
fb1609f554 hello world 2011-11-22 15:28:15 -06:00