Commit graph

74 commits

Author SHA1 Message Date
Daniel Gibson
2c58b2fb44 Fix savegame-compatibility of scripts, increase BUILD_NUMBER
"Fix "t->c->value.argSize == func->parmTotal" Assertion in Scripts, #303"
had broken old savegames because the script checksum
(idProgram::CalculateChecksum()) changed, see #344.
This is fixed now, also the BUILD_NUMBER is increased so old savegames
can be identified for a workaround.

Don't use this commit without the next one which will further modify the
savegame format (for the new BUILD_NUMBER 1305)
2021-02-21 06:05:47 +01:00
Daniel Gibson
c4c7236352 Fix "t->c->value.argSize == func->parmTotal" Assertion in Scripts, #303
If a "class" (object) in a Script has multiple member function
prototypes, and one function implementation later calls another before
that is implemented, there was an assertion when the script was parsed
(at map start), because the size of function arguments at the call-site
didn't match what the function expected - because the function hadn't
calculated that size yet, that only happened once its own
implementation was parsed.
Now it's calculated (and stored) when the prototype/declaration is
parsed to prevent this issue, which seems to be kinda common with Mods,
esp. Script-only mods, as the release game DLLs had Assertions disabled.
2020-09-05 20:46:01 +02:00
Daniel Gibson
d708fbd974 Fix lingering messages in HUD after loading savegame
If you save, you get a message like "Game Saved..." which goes away
after a few seconds. This happens at the very end of idPlayer::Save():
    if ( hud ) {
        hud->SetStateString( "message", /* .. left out .. */ );
        hud->HandleNamedEvent( "Message" );
    }
And handled in hud.gui, "onNamedEvent Message { ..."

However, if you save again before it's gone, it'll be shown after
loading the savegame and not go away until you save again..
This works around that issue by setting an empty message after loading
a savegame.

The underlying problem (which is not fixed!) seems to be that the
transition GUI command (that's executed when hud.gui handles the
"Message" event that's used to show this message) is probably not
properly saved/restored so fading out the message isn't continued
after loading.
2020-07-27 03:39:12 +02:00
Daniel Gibson
5e7019ebfe Support reproducible builds, fixes #172
If REPRODUCIBLE_BUILD is enabled in CMake, the code will not use
__DATE__ or __TIME__ macros, but instead hardcoded values.

Wherever __DATE__ or __TIME__ were previously used, we now use
ID__DATE__ and ID__TIME__, which are either set to hardcoded values or
to __DATE__ and __TIME__ in neo/framework/Licensee.h.
2020-07-13 01:33:40 +02:00
Daniel Gibson
e24b62d3e0 Use g_hitEffect CVar variable directly instead of getting it by name
No need to do a lookup of the CVar by name every time the player is hit,
we can just access the variable holding it.
2020-05-30 05:41:22 +02:00
dobosken
e93ba6ce0c Added "g_hitEffect" CVar to disable damage effects to the player camera
Defaults to "1" (on) so the default behavior is like in the original
game, but setting it to 0 disables the effects.
2020-05-30 05:23:13 +02:00
Daniel Gibson
42886f0e4b Modify check for Demo version to not break Game DLL ABI
Changing idSession would break the interface for Game DLLs, making the
existing ports of Mods incompatible.
Luckily we have idCommon::GetAdditionalFunction() for cases like this..

Also added a check for WEAPON_NETFIRING in idWeapon::EnterCinematic(),
I got an Assert() there in Debug builds.

Running the Demo seems to work now, at least I could finish it without
any problems (ignoring some warnings in the console)
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
f5dfdead43 Do the cursor/crosshair scaling to 4:3 also when loading savegame 2018-11-05 04:54:53 +01:00
Daniel Gibson
f407b2b8e9 Increase Script MAX_GLOBALS in vanilla game DLL
It's the same value d3xp uses.
This is for mods that have their own (more complex) scripts, but use
the standard base.dll/.so
2018-11-05 04:33:57 +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
Tobias Frost
be5f1dac91 Revise patch after comments 2018-10-28 19:53:39 +01: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
Kalamatee
46279bf11f import AROS changes 2017-04-02 00:42:28 +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
b03fc9271a Fix crash by assert in last RoE level (and maybe elsewhere)
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
2015-12-13 03:30:03 +01:00
leffmann
61aee9ed29 make base build with Visual Studio 14 2015-10-11 23:27:42 +02:00
Daniel Gibson
1de6ab0d50 Fix some compiler warnings (wrong types, superfluous checks, printf-fuckup) 2015-09-27 18:12:16 +02:00
Daniel Gibson
275d890e01 (Hopefully) fix crashes in MP if r_aspectRatio = -1, fix #70
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.
2015-09-27 04:16:47 +02:00
Tobias Frost
73fa334c2a Fixing some spelling errors: s/unkown/unknown, s/seperate/separate. (#107) 2015-02-25 22:01:00 +01:00
Daniel Gibson
fe0ee16ccb Guess x/y FOV/aspectratio from resolution
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.
2012-11-13 23:40:37 +01:00
dhewg
2a3d07e174 More logging cleanup 2012-07-20 00:12:55 +02:00
dhewg
b58f51dbfa Get rid of Sys_FPU_StackIsEmpty()
Same as with Sys_FPU_GetState().
2012-07-06 01:06:53 +02:00
dhewg
0ccef1eba8 Get rid of Sys_FPU_GetState()
This was only implemented with MSVC style asm.
Comments suggest that it was used to help catch invalid FOV calculations,
which were probably only happening with ancient compiler bugs.
2012-07-06 01:06:53 +02:00
dhewg
b049ea78e9 Don't try to extract libraries from gamepaks. 2012-07-04 02:18:47 +02:00
dhewg
3256783af1 Get rid of ID_DEMO_BUILD
There are no demo pk4s compatible to this 1.3.1 codebase.
2012-07-03 21:12:55 +02:00
dhewg
112c00d409 Rename PVS vars to match their type 2012-06-28 13:52:26 +02:00
dhewg
902a9cee8a s/ReadDeltaLong/ReadDeltaInt/
to match the argument type
2012-06-28 13:52:25 +02:00
dhewg
f767af9d72 s/WriteDeltaLong/WriteDeltaInt/
to match the return type
2012-06-28 13:52:25 +02:00
dhewg
9034da11d0 s/ReadLong/ReadInt/ to match the return type 2012-06-28 13:52:24 +02:00
dhewg
94df46637a s/WriteLong/WriteInt/ to match the argument type 2012-06-28 13:52:23 +02:00
Daniel Gibson
b9247b67b4 Remove longs from game/ and d3xp/
(Except for handling of longs in TypeInfo and win32-only Maya import stuff).

sizeof(long) == sizeof(int) on x86 and win64,
but not on 64bit (x86_64) linux/unix/osx/.. so they should be avoided.
2012-06-22 18:20:09 +02:00
Daniel Gibson
4244436d7d Fix PVS calculations on 64bit systems
Monsters got stuck in same places of d3xp because PVS calculations
returned that they were not in the players PVS.
This only happened on LP64 systems like Unix/Linux amd64 where
sizeof(long) == 8 - it did not happen on Win64 because it's LLP64, i.e.
sizeof(long) == 4 (like on x86 32bit).

Bit fiddling code in Pvs.cpp seemed to assume that sizeof(long) == 4
like on win32.

Fixes #7.
2012-06-22 16:13:08 +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
dhewg
6d6c5c8ce7 Fix "unreachable code" warnings 2012-01-15 14:13:44 +01:00
dhewg
898f690fc4 This is dhewm 3
Rename project, now at https://github.com/dhewm
2012-01-14 20:06:05 +01:00
dhewg
db4aca78d6 Get rid of CPU_EASYARGS
Never use the event callbacks with mismatching prototypes.
2012-01-14 15:19:38 +01:00
dhewg
b7ce0ef149 CMake: Use config.h for BUILD_OS and BUILD_CPU
This fixes, among others, FreeBSD 64bit builds where the build
system used a "amd64" suffix and runtime "x86_64".
2012-01-14 15:19:12 +01:00
dhewg
2b9e2e5193 More fixes regarding event saving and restoring
Fix silly issue from 3d692b58 (sizeof(E_EVENT_SIZEOF_VEC)).
Align entity values of events to the native pointer size, which
is noticeably faster on x86_64 and fixes another assert() in
debug builds.

Past savegames with entities in events are not compatible.
2012-01-13 01:45:19 +01:00
dhewg
3d692b58de Prevent assert() while saving and restoring events
The argument size of each event is checked in debug builds
and this change was missing from the x86_64 commits.

Surprisingly this didn't trigger yet with the original game,
only with the mod 'Classic Doom 3'.
2012-01-12 19:05:52 +01:00
dhewg
3c96e19610 Fix miscompilation with gcc 4.5
idAnimator::GetJointLocalTransform() miscompiles with gcc 4.5 and
-ftree-vrp (implied by -O2).

Reorder code to avoid the compiler bug, no functional change.
2012-01-05 00:21:43 +01:00
dhewg
57dc097fb0 Use correct idStr::Append() while saving event strings
Used the wrong Append() in fad99572, we want to stop at a
terminating null char.
2012-01-02 15:43:44 -05:00
dhewg
fad995722c Implement saving and restoring of event strings
Required for events with string arguments. On debug builds
an assert() is triggered when trying to save such an event,
while events could not be properly restored in any build.

This happens when going from map delta4 to hell1 and the
autosave feature kicks in. The trigger event 'selectWeapon'
with the string argument 'weapon_fists' is in the event queue.

With the binary from id a warning is issued:
WARNING: player1 is not carrying weapon ''
so the bug exists in there too, just that its a release build
and doesn't abort().

I also managed to trigger this while saving shortly after
activating an elevator switch.
2011-12-27 21:27:27 +01:00
spiral
1507a657d4 Add ID_GAME_API for dllexport/attribute(visibility)
Delete obsolete Game.def exports files
2011-12-23 13:24:47 +01:00
spiral
13bab7a7e5 Remove MWERKS stuff 2011-12-23 13:04:21 +01:00
dhewg
2c1186dc1b Fix -Woverloaded-virtual warnings
We want to use the SIMD functions of the base class if the
deriving class does not implement every overloaded variant.

Added missing idLight::SetColor(idVec3) which is declared in
idEntity.
2011-12-22 12:33:27 +01:00
dhewg
280c95b52c Use idSys::GetMilliseconds() for idTimer
The class is only used for debugging and statistical purposes.
The precision is now reduced to milliseconds, but that's only
relevant for fine grained debug timings - where the old code
was inaccurate at anyway.
2011-12-22 10:38:39 +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
18526bf4eb Split Game_local.h
New header GameBase.h with all the defines from Game_local.h and
gameError() to reduce header dependencies.
2011-12-19 23:21:41 +01:00
dhewg
dbf3b43140 Move the virtual abstract idGame to framework/Game.h
This is game independent and code outside of game/ and d3xp/
doesn't need to know about anything game specific.
2011-12-19 20:19:14 +01:00