Commit graph

90 commits

Author SHA1 Message Date
Daniel Gibson
5c1e1d7708 Fix ParticleEditor's Materialpicker screwing up ViewPort
In short, it uses a idGLDrawableMaterial widget that calls
renderSystem->BeginFrame(w, h); (with w and h being small for the texture
preview window) and BeginFrame() sets glConfig.vidWidth and vidHeight to
w/h and that never got reset to the original value (window width/height).
This breaks everything because for some reason
renderSystem->GetSCreenWidth()/Height() return glConfig.vidWidth/Height
so it will just continue to render everything at that resolution (in a
small rectangle on the lower left corner of the window).
This bug has already existed in Doom3 1.3.1 (but was less noticable because
apparently  when switching away from Doom3 and back to the window it reset
vidWidth/Height to the window resolution)
I only implemented a workaround (restore glConfig.vid* after rendering the
texture preview), it's possible that the same issue exists in other
(probably editor-) code - but a "proper fix" might also break code (and I'm
not super-familiar with the editor code or even just using them)
2019-03-10 05:23:06 +01:00
Daniel Gibson
b0d022f559 Fix crash when selecting nonexistant texture in D3Radiant
When selecting a texture in Inspectors -> Media -> Textures that doesn't
really exist (.mtr defines it, but referenced image files are missing),
the game/editor used to crash.
The problem was that somehow people thought the best way to communicate
that a file wasn't found was by setting the timestamp to 0xFFFFFFFF
and then checking for that - sometimes (incorrectly) by comparing it to -1.
That worked for 32bit ID_TIME_T (typedefed to time_t), but not with 64bit
time_t, which now seems to be the default for Win32 in VS.
So I replaced a few -1 and 0xFF... with FILE_NOT_FOUND_TIMESTAMP and now it
works.
FILE_NOT_FOUND_TIMESTAMP is still defined as 0xFFFFFFFF, maybe I should
change that, unsure if that'd break anything though..
When changing it one should keep in mind that time_t might still be 32bit
on some platforms (Linux x86?) so that should still work.. (-1 could work)
2019-03-10 05:11:33 +01:00
Daniel Gibson
9a95a2a1cf Building with editor support (on Win w/ VS2017) works \o/
Editor also seems to start, didn't test much further.

Only tested 32bit Windows, I fear the editor code isn't 64bit clean..

I hope I haven't broken anything elsewhere..
2019-01-13 22:52:28 +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
Daniel Gibson
519cc68b0e idCommon::SetCallback() and GetAdditionalFunction() - for Mods
This is an ugly hack that allows both exporting additional functions
(incl. methods via static function + void* userArg) to Game DLLs
and setting callback functions from the Game DLL that the Engine will
call, without breaking the Game API (again after this change).
This is mostly meant for replacing ugly hacks with SourceHook and
similar and mods (yes, this is still an ugly hack, but less ugly).

See the huge comment in Common.h for more information.

Right now the only thing implemented is a Callback for when images
are reloaded (via reloadImages or vid_restart) - Ruiner needs that.

Also increased GAME_API_VERSION to 9, because this breaks the A[PB]I
(hopefully after the next release it won't be broken in the foreseeable
 future)
2018-09-30 05:06:20 +02:00
Andre Heider
83b358ddbe Fix color glitches on cinematics for selected archs
These two casts assumed char is signed, which is not a valid assumption.
Be explicit.

Fixes idlogo.roq on e.g. aarch64.
2018-02-23 13:40:11 +01:00
Kalamatee
f83e270cdb revert changes committed in error 2017-04-02 00:42:28 +01:00
Kalamatee
46279bf11f import AROS changes 2017-04-02 00:42:28 +01:00
Turo Lamminen
d535e54c90 Add 2560x1440 screen mode 2017-04-02 00:48:40 +02:00
Daniel Gibson
3d57e99e0a Hopefully fix built on OSX El Capitan with libjpeg9 2017-02-27 20:19:20 +01:00
Daniel Gibson
9950a5721f Fix heap corruption when loading (broken?) .ma models
On FreeBSD, the game used to crash when loading the last level of RoE
(d3xp), while loading models/david/hell_h7.ma.
The problem could be reproduced on Linux whith #define USE_LIBC_MALLOC 1
and clang's AddressSanitizer.
Turns out that this file specifies a vertex transform for a non-existent
vertex (index 31, while we only have 0-30) and thus the bounds of
pMesh->vertexes[] are violated.
I added a check to ensure the index is within the bounds and a Warning
if it isn't.
It should work now. If however it turns out that more files have this
problem, maybe .ma is parsed incorrectly and we need a differently fix.

(Should) fix #138
2015-12-17 18:07:35 +01:00
Daniel Gibson
1680603d8c Sort vidmodes in menu, add 2880x1800
it's the native resolution of "Macbook Pro retina 15-inch mid 2014"
2015-10-30 21:41:18 +01:00
Daniel Gibson
6ba1b71fb1 Change default values for some video and sound (EAX) CVars
* r_mode defaults to 5 (1024x768), I think that's more sane than 640x480
* r_fullscreen defaults to 0 (=> windowed mode) because fullscreen in
  the wrong resolution sucks.. let people do their initial configuration
  in windowed mode
* r_swapInterval defaults to 1 (=> VSync active by default) because that
  makes the game feel more smooth and most PCs should be able to 60fps
  in this 11years old game anyway

* s_useEAXReverb defaults to 1 (=> use EAX/EFX effects by default),
  because OpenAL-soft supports them on all platforms/hardware and if
  for some reason the used OpenAL implementation doesn't support it,
  it's deactivated automatically anyway.

All these things can be configured in the Options Menu.
2015-09-29 21:14:45 +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
657ad99bf1 Remove jpeg_memory_src hack that worked around old libjpeg versions
Because Debian Squeeze's libjpeg6 didn't have jpeg_mem_src(), we added
jpeg_memory_src() to provide the functionality.
This shouldn't be needed anymore and without it we can drop libjpeg code
from our repo.

Fixes #110
2015-03-22 16:49:26 +01:00
Daniel Gibson
3202f0aa0f Get rid of some compiler warnings
GCC had shitloads of superfluous warnings wherever List.h and Str.h were
included.. get rid of them by using #pragma GCC diagnostic at some places
in List.h and Str.h.
Also add some casts, initialize some variables for other warnings
2012-11-13 23:24:13 +01:00
Daniel Gibson
105fdb0624 Fix dedicated server for Windows
* the OpenAL function definitions mustn't include __declspec(dllimport)
  => fixed by pretending to compile OpenAL statically
* glimp.cpp shouldn't be used in dedicated-only mode (as it was already
  the case on Linux and OSX)
  => No special handling for ID_DEDICATED needed in glimp.cpp, as it's not
   used anyway
* add APIENTRY to every gl function in stub_gl.cpp for compatibility
  with windows headers and MSVC
* remove GL/gl.h #include from win_local.h as it's not needed
* in qgl.h, when building dedicated server for windows, redefine WINGDIAPI
  to nothing for SDL_opengl.h #include to get rid off __declspec(dllimport)
  by using #pragma push_macro and pop_macro, because our stub is no dll.

Fixes https://github.com/dhewm/dhewm3/issues/39
2012-11-12 20:18:00 +01:00
Daniel Gibson
844cd2d8a8 Don't un-grab mouse when taking screenshots (fixes #18)
On windows un-grabbing (or possibly re-grabbing) the mouse seems to
mess up the view angly (view is centered afterwards), see
https://github.com/dhewm/dhewm3/issues/18
That's fixed by not releasing the mouse (there is no reason to do that
anyway).
2012-08-27 21:27:05 +02:00
dhewg
b8765ccf22 Move GrabInput() and rename to GLimp_GrabInput()
SDL2 supports multiple windows, and the grabbing is set per
window, so move it to sys/glimp.cpp.
2012-07-20 17:34:34 +02:00
dhewg
e62e3870a3 Don't link against OpenGL
Dynamically load all symbols at runtime.
This in in preparation for SDL2/OpenGLES.
2012-07-20 16:43:37 +02:00
dhewg
63fdea82b4 Get rid of wglext.h
Good riddance.
2012-07-20 16:43:37 +02:00
dhewg
227fac443d Fix description of r_swapInterval
This isn't specific to wgl.
2012-07-20 00:13:07 +02:00
dhewg
bf922dfc59 Get rid of glConfig.wgl_extensions_string
Unused and nobody cares.
2012-07-20 00:13:05 +02:00
dhewg
7f3fc825ed Get rid of GetCardCaps()
Useless now.
2012-07-20 00:13:04 +02:00
dhewg
3cdc5cec5c Get rid of unused var allowNV30Path 2012-07-20 00:13:03 +02:00
dhewg
de1b7b9adb Remove spurious call to SetBackEndRenderer()
Like the comment above said, this is invalid and can't work.
The backend is properly set via R_InitOpenGL().
2012-07-20 00:13:03 +02:00
dhewg
f4de0ed8c1 Remove the deprecated arb renderer 2012-07-20 00:13:02 +02:00
dhewg
a5678d2368 Remove the monochrome hack
This was only used for the nv20 renderer.
2012-07-20 00:13:02 +02:00
dhewg
6aa9b3602e Remove the deprecated nv20 renderer 2012-07-20 00:13:01 +02:00
dhewg
3f67a28abe Remove the deprecated nv10 renderer 2012-07-20 00:13:00 +02:00
dhewg
4b67aae8fe Remove the deprecated r200 renderer 2012-07-20 00:12:59 +02:00
dhewg
2a3d07e174 More logging cleanup 2012-07-20 00:12:55 +02:00
dhewg
373fccbd59 Cleanup OpenGL logging 2012-07-20 00:12:54 +02:00
dhewg
8aa0a4a9c9 Fix "black box" effect on ase meshes
In 09ea2ca8 we fixed a memset(), but it turns out wiping memory at that
position is wrong in the first place:
If an ase mesh has a GEOMOBJECT/NODE_TM transform matrix before the
GEOMOBJECT/MESH entry, the prior parsed TM will be wiped.
Since a GEOMOBJECT aseObject_t is already calling memset() upon
initialisation, we can just drop the spurios call.

Fixes #13.
2012-07-18 19:53:08 +02:00
Andre d
7a5b8b1ec0 Remove (faulty/outdated) video ram detection 2012-07-04 22:47:38 +02:00
dhewg
49c4d028a5 s/LittleLong/LittleInt/ to match the return type 2012-06-28 13:02:47 +02:00
Daniel Gibson
600531ec98 Don't use long for DDS magic number
It's a DWORD (i.e. 32bit int) according to spec, so using long is
actually wrong when sizeof(long) == 8.
2012-06-28 13:02:46 +02:00
Daniel Gibson
94cd0ee559 Fix several bugs from iodoom3 bugtracker
rhyskidd@gmail.com found them (with PVS studio IIRC), reported them and posted
patches.
Some of the patches were incorrect so I rewrote them.
2012-06-02 10:12:22 +02:00
Daniel Gibson
5b2c78b9ff Fix wrong length used in memset() in idMegaTexture::GenerateMegaMipMaps()
it should be tileSize, not sizeof( tileSize ), as it was also used for
allocating that block of memory
2012-05-13 02:52:12 +02:00
dhewg
a18650b27e Remove initial R_SetColorMappings() call
This happens before the SDL GL window is set up, which just
results in a warning. Another call will properly set the
gamma table after the window is initialized.
Make gammaTable a stack variable. This is sufficient, since SDL
already restores the gamma values for us on exit.
2012-01-19 00:53:13 +01:00
dhewg
6d6c5c8ce7 Fix "unreachable code" warnings 2012-01-15 14:13:44 +01:00
dhewg
16958d070b Fix [record|play|time]Demo for x86_64
These are still fragile due to restored stale pointers (!).
But at least the vanilla demos can now be used to check for
performance regressions.
2012-01-10 22:54:01 +01:00
dhewg
035dcbcd46 Move jpeg_memory_src()
Found another copy in renderer/Cinematic.cpp. Move the
newer implementation from renderer/Image_files.cpp in its
own file and use the libjpeg v8c license blob (which is where
this code comes from).

Adapt README too with the v8c license.
2012-01-07 20:57:07 +01:00
dhewg
522c5bbccf R_GetModeInfo() doesn't need to be public on OSX
Remove redundant special case.
2012-01-05 00:24:14 +01:00
dhewg
8ae3ab7641 Get rid of unhooked draw_exp.cpp
Unused experimental Windows-only renderer.
2012-01-05 00:21:43 +01:00
dhewg
13bf514a8f Get rid of Cg leftovers 2012-01-05 00:21:42 +01:00
dhewg
cf9f5a2623 Use SDL_opengl.h
That already contains an up to date glext.h.
2012-01-05 00:21:10 +01:00
dhewg
8370a7d213 Turn a Warning() in R_FlareDeform into a DPrintf()
The warning is printed on every frame in some areas and slows
down the whole game. Use DPrintf() instead to prevent the
slowdown.
2012-01-03 18:14:21 +01:00
dhewg
b83868090c Use SDL GLimp and input implementations on Windows
The DirectX SDK is not required anymore.
2012-01-02 15:44:40 -05:00