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
.. despite the lack of depth-fail ("Carmack's Reverse"), which doesn't really matter for that reason.
I have the impression that some people didn't get this.
"source port" is the usual term for this and what people will probably google for.
mentioning the tested platforms right at beginning might also be helpful for people.
also (hopefully) clarified what EFX/EAX is about, some people who wrote comments
about the release seemed confused about that.
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.
Win32: Add an icon to the dhewm3 executable
+ changes to CMakeLists.txt to make it possible by preventing that all kinds of C/C++ compiler flags
are set for windres which doesn't like them
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.