so even with many loud sounds the overall volume isn't reduced by
OpenAL - apparently OpenAL scales down all sounds temporarily if the
mixed result would be too loud or sth like that.
Just sending all sounds to OpenAL with a lower volume prevents that from
happening (just set your system speaker volume a bit higher if needed).
This problem was especially noticable when shooting at metal walls with
the shotgun (each pellet produces an impact sound so it gets kinda loud)
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)
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
as we do int buttonIndex = ev.button.button - SDL_BUTTON_LEFT;
it's only consistent to do if(ev.button.button < SDL_BUTTON_LEFT + 8)
it doesn't really make any difference as long as SDL_BUTTON_LEFT is 1,
but this way it's safe for SDL3 or whatever future version might break
the ABI.
__builtin_trap() causes an illegal instruction and thus the process
can't resume afterwards.
raise(SIGTRAP) only breaks into the debugger and thus allows to
"ignore" the assertion while debugging.
The assertion in idBounds::operator-(const idBounds&) was triggered
from idWeapon::Event_LaunchProjectiles() (ownerBounds - projBounds)
It only happened when using the BFG.
So I added a check to make sure calling operator- is legal.
I guess this also caused #122
The first row of AZERTY-Keyboards (used in France and Belgium) doesn't
have numbers as keys but ², &, é, ", ', (, -, è, _, ç, à, ), =
(with small differences between France and Belgium).
For some of those keys we don't have keycodes - and neither does SDL2.
See also https://bugzilla.libsdl.org/show_bug.cgi?id=3188
As a workaround, just map those keys to 1, 2, ..., 9, 0 anyway, as those
are keys Quake2 already knows (and those chars are printed on the keys
too, for typing they're reachable via shift).
This workaround only works for SDL2, as SDL1.2 doesn't have Scancodes
which we need to identify the keys.
This should obsolete one part of pull request #135
It's an SDL_TEXTEDITING event which we seem to get on Windows whenever
the Window gains focus (or is created). I think it can be safely
ignored, so that's what I do.
I also changed how those warnings are printed - as a hex number now,
because they're defined as hex numbers in the SDL source and it's easier
to find out what kind of event it is this way.
When ingame, Shift-Esc would open the menu and another Shift-Esc the
console. Now it immediately opens the console and only Esc without
Shift opens the menu.
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.
If res_none (event with .evType == EV_NONE) is returned,
idEventLoop::RunEventLoop() will assume there are no more events this
frame => pending events will be delayed til next frame (or later if
again res_none is returned in the meantime).
So res_none shouldn't be returned just because there was an SDL event
we didn't care about or we did care about but don't generate a doom3
event for (but toggle fullscreen or something).
Instead we should just fetch and handle the next SDL event.
Before checking there I look for gamedata next to the executable, but
the check was broken: I got the directory the executable is in and
checked if it exists.. well.. of course it does, but that doesn't mean
there's game data in it..
So now I check if that directory actually has a "base/" subdirectory
(or whatever is #defined in BASE_GAMEDIR) and if that fails
/usr/local/games/doom3/ is tried instead.
Thanks chungy for pointing the bug out in #97 !
* 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.
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.
for some reason neo/tools/compilers/dmap/optimize.cpp included windows.h
and GL/gl.h before including dmap.h, which indirectly includes qgl.h.
This made things in qgl.h explode - seems like APIENTRYP in the
QGLPROC() macro expanded to bullshit because of some APIENTRYP or
APIENTRY definition in windows.h or GL/gl.h
Those includes are totally unnecessary, dmap.h -> qgl.h already includes
GL/gl.h, indirectly via SDL_opengl.h and in that setup things somehow
are fine.
the problem was that the CVar was initialized from the commandline
*after* Posix_InitConsoleInput() is called, so it was too late.
common->StartupVariable() seems to be the right way to initialize a
CVar early.
While I couldn't reproduce the crash, according to the bugreport it
happens if renderSystem->GetScreenWidth()/Height() returned 0 - and
that is indeed the only plausible reason I can imagine for it.
So I check for that case and handle it gracefully by defaulting to
4:3 FOV values.
The version will be 1.4.0 because it's not compatible with
Doom3 1.3.1 mod DLLs.
(Note that this commit doesn't mean 1.4.0 is done, I might do some
minor changes before tagging the Release!)
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
For some reason Gentoo renamed zlibs OF() macro to _Z_OF
Our minizip uses OF(), so add a #define for it in case
_Z_OF is defined.
Thanks to salamanderrake for the fix
The implementation is now in framework/minizip/*
instead of framework/Unzip.cpp
This was version 0.15beta, now we use 1.1 from
zlib 1.2.7/contrib/minizip
Some code had to be adjusted for this, but it got
cleaner on the way
idAnimator::GetJointLocalTransform() miscompiles with gcc 4.5 and
-ftree-vrp (implied by -O2).
Reorder code to avoid the compiler bug, no functional change.
The original commit was for game/ only, but d3xp/ will have the same
issues..
Added r_aspectratio -1 which means "auto" (as new default).
This mode sets fov_x and fov_y according to screen-width/height.
=> No need to set r_aspectratio manually anymore (assuming your display's
pixels are about square).
The standard aspect ratios can still be enforced as before, though.
When one tries to quit the game (via quit in console) while a timedemo
is running, the game freezes indefinitely while displaying the timedemo
results.
This happens because the MessageBox used for that waits for a an event
normally triggered by a timer - but it seems like that does not happen
anymore during Shutdown()
The fix makes sure that this message box isn't displayed.
Commit 9e158470 set the SDL OpenGL attribut SDL_GL_ALPHA_SIZE to 0 since
the alpha channel is used by Wayland. But for X11 the GLX 1.4 specification
clearly states: "If the requested number of bits in attrib_list for a
particular color component is 0 or GLX_DONT_CARE, then the number of
bits for that component is not considered." So if SDL_GL_ALPHA_SIZE is
0 a framebuffer without an alpha channel is created. This is no problem
on the default GLX module due to a non standard implementation but
manifests with Nvidias GLX module. The consequence are render mistakes
like in game display showing static or the flashlight looking weird.
Everytime List.h is included in a new file (and sys/platform.h isn't)
there are confusing compiler-errors..
So just #include sys/platform.h in List.h directly, because it uses
ID_INLINE which is defined there
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
The console history is saved to a file on quit and restored after
starting the game.
So the commands entered in the console the last times the game was run
are still available in the console-history, just like commands that
were just entered.
Some mods/mappacks have their own game dir (fs_game) but no own gamelib.
Doom3 defaulted to the base game dll (I think), so we should do the same.
Fixes#44
* 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
Some functions were duplicated, the only difference was a const in one
parameter. The definitions in the header were with const, so I kept
those versions.
Also, the functions in the header are pure C, so add extern "C",
this fixes issues with MSVC and the formerly duplicated functions.
There used to be a bug (discussed in #40), that ALT was still set after
using ALT-Tab. Thus when next pressing enter fullscreen was toggled.
This should now be fixed by unsetting the modifiers when focus is
regained (SDL_ACTIVEEVENT or SDL_WINDOWEVENT_FOCUS_GAINED).
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).
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.
Set the library name to an empty string to prevent this error:
CMake Error: The following variables are used in this project, but they
are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the
CMake files:
CURL_LIBRARY (ADVANCED)
Since we don't have our own signal handler anymore, those two
init functions can be merged into the existing Sys_Init(), which
is already called by common->Init().
warning: variable ‘err’ set but not used [-Wunused-but-set-variable]
warning: unused variable ‘len’ [-Wunused-variable]
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long long unsigned int’ [-Wformat]