Commit graph

14082 commits

Author SHA1 Message Date
Christoph Oelckers
1462cb5e9d - refactored some of WW2GI's gamewar stuff so that it is accessible to ZScript as well.
The features here are useful, the way they were handled not so much. What is there now can also be set from proper definition files instead of CON hacks.
2023-04-16 16:53:50 +02:00
Christoph Oelckers
1597cf5400 - exported the grower's shoot function and moved stuff to a separate file. 2023-04-16 11:49:47 +02:00
Christoph Oelckers
71a005fda6 - added a few 'const'. 2023-04-16 11:47:56 +02:00
Christoph Oelckers
77d14ec721 - scriptified shootshrinker and moved all shrinker code to a separate file. 2023-04-16 11:47:56 +02:00
Mitchell Richters
e82981929d - Exhumed: Make overridesect global local to movespritez().
* Fixes #933.
2023-04-16 19:30:35 +10:00
Mitchell Richters
b803a8299d Revert "- Blood: Repair velocity scaling in ConcussSprite()."
This reverts commit 7da3c62ea8.

* 7554808104 has the proper fix.
2023-04-16 16:11:57 +10:00
Christoph Oelckers
e15517cf57 - fixed some issues with projectile ownership.
Some init code was run here that should not be run. Added a new flag to handle this case without major code explosion.
2023-04-16 07:54:26 +02:00
Christoph Oelckers
c73830992f - added a few exports and properties for weapon shooting and added missing 'const' annotations for ShootThis overrides. 2023-04-15 23:23:09 +02:00
Christoph Oelckers
17cde1e3ca - Duke: fixed bad init of hitag in initspriteforspawn 2023-04-15 19:53:04 +02:00
Christoph Oelckers
ecd0c8c1ff - fixed a few bad scaling values. 2023-04-15 12:20:10 +02:00
Christoph Oelckers
b191491bbb - backend update from GZDoom. 2023-04-15 11:51:31 +02:00
Christoph Oelckers
812b9d76d6 - Blood: display the charge meter for the dynamite also on the alternative HUD. 2023-04-15 09:33:46 +02:00
Christoph Oelckers
0a91a9a199 - route checkhitsprite fully through the virtual interface so that the player class can finally be exported. 2023-04-12 22:02:01 +02:00
Christoph Oelckers
60af1b4c62 - renamed temp_data[0] to 'counter' and map temp_data[5] to the now free temp_data[0].
This not only matches its use in CON but seems to be used as a counter in most other places as well.
The main reason is to improve readability of CON to ZScript conversions.
2023-04-12 21:54:33 +02:00
Christoph Oelckers
8bd88b8678 - migrate all script related info to the data stored in the actor classes.
This also needs cactor to really change the class descriptor now so that the correct script code is found.
2023-04-12 21:54:20 +02:00
Christoph Oelckers
c418356420 - added the action, move and ai properties. 2023-04-12 21:52:56 +02:00
Christoph Oelckers
947d427a9d - merged tileinfo and actorinfo. 2023-04-12 21:52:28 +02:00
Christoph Oelckers
ebf7b4a121 - copy the CON defined info into the actual actors.
Only using the strength value right now.
2023-04-12 20:29:37 +02:00
Christoph Oelckers
a155a09f9f - deleted the setflag inlines. 2023-04-12 20:07:12 +02:00
Christoph Oelckers
62ace9371f - moved the 3 actor properties out of the global data. 2023-04-12 20:07:12 +02:00
Christoph Oelckers
cc8495c31e - got rid of the g_t pointer in the CON interpreter.
Using g_ac->temp_data now.
2023-04-12 20:07:12 +02:00
Christoph Oelckers
f0637cfc83 - moved actioncounter and curframe to a dedicated variable.
The third generic counter is not as easy to fix as its use is far more widespread
2023-04-12 20:07:12 +02:00
Christoph Oelckers
4b096f4f3e - nulling contents of a freshly spawned actor is not necessary.
All objects are zero inited.
2023-04-12 20:07:11 +02:00
Christoph Oelckers
14dd9c3711 - refactored AI storage as well to not use ScriptCode anymore. 2023-04-12 20:07:11 +02:00
Christoph Oelckers
b9702fbb66 - moved 'move' data out of the ScriptCode array as well. 2023-04-12 20:07:11 +02:00
Christoph Oelckers
30ccbe2710 - moved actions out of the ScriptCode array and gave them a dedicated struct with meaningful member names. 2023-04-12 20:07:11 +02:00
Christoph Oelckers
94b676bd7c - wrapped access to the current 'move' values read from CON. 2023-04-12 20:07:11 +02:00
Christoph Oelckers
c76c511da2 - moved sprite animation code out of 'execute'. 2023-04-12 20:07:10 +02:00
Christoph Oelckers
0c17a369db - Duke: changed skill filter to be solely controlled by the spawnclasses definitions.
All classes with no skill filter now need an explicit noskill declaration.
The only exception is inert sprites using DukeActor directly, these will never get filtered by skill.
2023-04-12 20:06:25 +02:00
Christoph Oelckers
53e41bd3b3 - Duke: added missing texture alias for the cannon. 2023-04-11 20:23:34 +02:00
Christoph Oelckers
660227e175 - Duke: restrict skill filter to those actors which originally handled it.
For flexibility there now is a flag that can be set on any actor class, but due to precedent it needs to be off by default.
2023-04-11 20:14:02 +02:00
Christoph Oelckers
ee61daed97 - reinstate code from e2db4a8 that got removed by a badly resolved merge conflict in ae4ef64 . 2023-04-10 16:48:08 +02:00
Christoph Oelckers
2f61a44329 - Duke: do not clear the KILLCOUNT flag.
This seems to have gotten back by accident.
2023-04-10 16:41:58 +02:00
Christoph Oelckers
ec9ed9588c - Exhumed: don't pass uninitialized data to the sound engine.
This was creating very noisy warnings.
2023-04-10 09:49:38 +02:00
Christoph Oelckers
1d79d0cee3 - Duke: fixed pitch calculation for explosion sounds.
This part was missed when the backend's pitch management was changed to floats instead of Q1.7 fixed point numbers.
2023-04-10 09:13:33 +02:00
Christoph Oelckers
7b1ef9e020 - Duke: Do not set SFLAG_BADGUY for internal bad guys.
This will pass an incorrect value for clipdist to clipmove.
2023-04-10 08:56:37 +02:00
Christoph Oelckers
3df7539eb9 - fixed return values of badguy() and bossguy() functions. 2023-04-09 15:45:19 +02:00
Christoph Oelckers
684fb5eb74 - added a few things missing for RR and Route 66.
R66's gator was also added - this is the only completely new actor in this mod.
2023-04-09 09:46:10 +02:00
Christoph Oelckers
7f758eef2b - got rid of the script-side flag wrappers. 2023-04-09 09:46:09 +02:00
Christoph Oelckers
04a027f748 - removed most parameters from fall_common. 2023-04-09 09:46:09 +02:00
Christoph Oelckers
cfa18952d1 - deleted the native flag setter code. 2023-04-09 09:46:09 +02:00
Christoph Oelckers
918c75cb6e - validate statnum before spawning an actor. 2023-04-09 09:46:09 +02:00
Christoph Oelckers
da0b429751 - migrated attackertype to class objects. 2023-04-09 09:46:09 +02:00
Christoph Oelckers
ae4ef6401c - use the actual actor flags.
Not fully working yet...
2023-04-09 09:45:42 +02:00
Christoph Oelckers
510afe16fb - NODAMAGEPUSH is the default for RR.
The game never had this feature
2023-04-09 09:35:38 +02:00
Christoph Oelckers
b908ede470 - reviewed actor flags and applied several fixes. 2023-04-09 09:35:37 +02:00
Christoph Oelckers
8172a9ac0c - moved all flags into the actor definitions. 2023-04-09 09:35:37 +02:00
Christoph Oelckers
672374c5f4 - added fullbright flags where appropriate 2023-04-09 09:35:37 +02:00
Christoph Oelckers
f4c176988a - first round of flag additions. 2023-04-09 09:35:36 +02:00
Christoph Oelckers
50d406be4e - Duke: Do not call Initialize() for player actors.
The base function is doing things not meant for players, and we do not have a proper class yet that can deal with it.
2023-04-09 08:15:23 +02:00
Christoph Oelckers
7554808104 - Blood: fixed bad damage scaling in ConcussSprite
This uses the square of the distance, so the factor between Build's Q28.4 format and floats is not 16, but 16*16 = 256.
2023-04-08 10:46:35 +02:00
Christoph Oelckers
307276a276 - WIP for a default scale property.
For now a NOP, we need to get a little further with the scriptification work before this can be made operational.
2023-04-08 09:38:46 +02:00
Christoph Oelckers
e2db4a834e - Duke: apply default scale only to enemies defined in CON.
This code does not apply to the Recon!
2023-04-08 09:37:51 +02:00
Christoph Oelckers
9c164ad290 - fixed crash when stomping shrunk enemies. 2023-04-08 07:14:07 +02:00
Christoph Oelckers
60339a217c - moved a lot of shareable code out of the CON interpreter. 2023-04-07 13:15:06 +02:00
Christoph Oelckers
9ba0b18013 - moved the 3 health related instructions out of the CON interpreter.
This code can be shared with ZScript so it needs to be elsewhere.
2023-04-07 13:15:06 +02:00
Christoph Oelckers
980b3f257a - converted the final set of actor classes the native code needs to reference. 2023-04-07 13:15:06 +02:00
Christoph Oelckers
2ba204444c - merged the spawn init code now that all differences are externalized 2023-04-07 13:15:06 +02:00
Christoph Oelckers
aae2c2dc3c - exported RR's enemies 2023-04-07 13:15:06 +02:00
Christoph Oelckers
779026162d - exported all of RR's pickup items. 2023-04-07 13:14:19 +02:00
Christoph Oelckers
3dd87cfd7f - got rid of checkType. 2023-04-07 12:22:46 +02:00
Christoph Oelckers
f2d802b537 - exported RR's remaining controllers. 2023-04-07 12:22:45 +02:00
Christoph Oelckers
98d5a2686e - use for loop instead of repeating the same line 10x. 2023-04-07 12:22:45 +02:00
Christoph Oelckers
0e169759d5 - animatesprites_r.cpp cleanup 2023-04-07 12:22:45 +02:00
Christoph Oelckers
f9e5f2c137 - final clenaup on animatesprites_d.cpp.
Only the player actor is left, which is also the messiest part...
2023-04-07 12:22:44 +02:00
Christoph Oelckers
ce00183707 - scriptified PlayerOnWater. 2023-04-07 12:17:56 +02:00
Christoph Oelckers
3106c8e6f5 - exported most of the remaining content in spawn_d.cpp 2023-04-07 12:14:16 +02:00
Christoph Oelckers
8b04f42ab5 - exported several fire related actors. 2023-04-07 11:52:53 +02:00
Christoph Oelckers
ef6a8c010a - exported ceilingsteam and consolidated movefallers functions. 2023-04-07 11:52:53 +02:00
Christoph Oelckers
82d04756be - exported a few of Duke's decorations 2023-04-07 11:52:53 +02:00
Christoph Oelckers
551e0af58d - exported the egg, also marking it non-killcount. 2023-04-07 11:52:53 +02:00
Christoph Oelckers
b4dcf8ddcf - exported the remaining Duke enemies. 2023-04-07 11:52:53 +02:00
Christoph Oelckers
0636358b5f - fixes for RR items. 2023-04-07 11:52:53 +02:00
Christoph Oelckers
1bc7c53351 - move the recon's FTA sound into the scripted actor. 2023-04-07 11:52:52 +02:00
Christoph Oelckers
ef54987a58 - exported WT's Firefly 2023-04-07 11:52:52 +02:00
Christoph Oelckers
4e0dad54a5 - exported all of Duke's pickup items. 2023-04-07 11:51:41 +02:00
Christoph Oelckers
7a699e032f - cleaned up Duke's very broken kill count system.
This now uses a static flag to denote an actor as countable and an internal flag to track its killed state, because CON can toggle that at will.
2023-04-07 09:49:20 +02:00
Mitchell Richters
85482b0951 - Fix CVAR comments from previous commit. 2023-04-05 17:59:04 +10:00
Mitchell Richters
32e6e1ce5f - Allow disabling of level start/end cutscenes if a user desires.
* Allows for situations where in Blood or Exhumed, you wish to have a shortcut that directly gets you into a level.
* Could be used for seamless playing options if a user doesn't care for level ending screens.
* Not exposing this to the menu for now as I doubt demand would be high for such a thing.
2023-04-05 17:46:40 +10:00
Mitchell Richters
0f07ea9e37 - Fix skip size in SkipTicCmd() missed during 8bfcb8c939. 2023-04-05 15:00:47 +10:00
Mitchell Richters
c4bd550483 - Change InputState::KeyStatus to be a FixedBitArray object. 2023-04-05 12:57:48 +10:00
Mitchell Richters
2658af9fd0 - Use weapon enums when determining max slot numbers. 2023-04-05 10:22:18 +10:00
Mitchell Richters
4d82a0effa - Put SB_QUICK_KICK into the correct mask. 2023-04-05 10:20:54 +10:00
Mitchell Richters
3951407b68 - Fix issue with memset calls from 0eba341ac1. 2023-04-05 07:39:31 +10:00
Mitchell Richters
6403c7291f - Update player camera angles right before drawing a frame.
* Also stops situations where `GameInput::getInput()` was being called incessantly while in the menu, during screenjobs, etc.
2023-04-04 20:55:09 +10:00
Mitchell Richters
0eba341ac1 - Remove GameInput::prepareHidInput() and GameInput::resetHidInput().
* Also reverts 23bff9f701, but changes the loop into a `memset()` call instead.
2023-04-04 20:07:06 +10:00
Mitchell Richters
d454455d22 - Move invertmouse CVARs into common code.
* Removes duplication of CVAR definitions between Raze and GZDoom.
2023-04-04 20:01:21 +10:00
Mitchell Richters
12c50b4af0 - Blood: Fix missing input bit in GameInteface::reapplyInputBits(). 2023-04-04 16:55:44 +10:00
Mitchell Richters
bf58879b08 - Duke/RRRA: Fix HUD tilting when reversing motorcycle backwards. 2023-04-04 15:14:44 +10:00
Mitchell Richters
b4ea03b8ef - Ensure GameInput::Clear() clears the entire object.
* Unused mouse input could still accumulate during screenjobs (level end stats, etc).
2023-04-04 10:53:19 +10:00
Mitchell Richters
23bff9f701 - Don't loop through all joystick axes and zero them in I_GetAxes().
* The caller should be passing a 0-init'd array through.
2023-04-04 09:55:44 +10:00
Mitchell Richters
133c8fa80b - Only scale the mouse input in GameInput::processMovement(), where it's needed.
* Also fixes a potential signedness issue for `processVehicle()` if `m_yaw` is negatively set.
2023-04-04 09:53:43 +10:00
Mitchell Richters
a68fcfc71c - Remove GameInterface::getConsoleAngles(), it's not needed anymore. 2023-04-04 07:02:39 +10:00
Mitchell Richters
3ef431a428 - Make scaleAdjust a float since it's what's needed anyway. 2023-04-03 19:38:00 +10:00
Mitchell Richters
69c65dfe7e - Internalise InputPacket used in movement functions. 2023-04-03 19:35:35 +10:00
Mitchell Richters
dbba0abb2e - Move all mouse handling into GameInput class. 2023-04-03 18:47:14 +10:00
Mitchell Richters
8d11fef916 - Initial conversion of game input into class GameInput. 2023-04-03 18:46:36 +10:00
Mitchell Richters
23186cd8bb - Relocate processCrouchToggle(). 2023-04-03 18:38:10 +10:00
Mitchell Richters
31d3349d93 - Rearrange bools in processVehicleInput(). 2023-04-03 18:37:38 +10:00
Mitchell Richters
fb519e9c53 - Move PlayerAngles constants into the class. 2023-04-03 17:07:34 +10:00
Christoph Oelckers
0706a8a5bb - exported LizTrooper and Lizman. 2023-04-02 17:37:30 +02:00
Christoph Oelckers
240b24d771 - exported all females. 2023-04-02 17:34:37 +02:00
Christoph Oelckers
810977f19f - made RR thunder effect also work for Duke.
This mainly meant adding support for random sounds and playing the thunder sound by name instead of by index.
2023-04-02 17:20:06 +02:00
Christoph Oelckers
0cd0f28317 - fixed initialization of RR's thunder effect 2023-04-02 17:09:28 +02:00
Christoph Oelckers
eee551ce15 - take care of the last tileGetTexture call in Duke. 2023-04-02 16:45:43 +02:00
Christoph Oelckers
6248c8813b - make RR's ingame thunder effect not depend on having seen one specific texture.
This really should check if the player has seen one sector where the effect is active.
2023-04-02 16:45:43 +02:00
Christoph Oelckers
8208c7fc0b - some texture name cleanup 2023-04-02 16:45:43 +02:00
Johan Mattsson
cebab8f85d
Small fixes (#910)
* Fix potential index out of bounds

* Fix potential index out of bounds

* Use 'MAXGEOSECTORS' instead of magic constant
2023-04-02 22:10:57 +10:00
Christoph Oelckers
52ea497b50 - fixed lotsofstuff VM export. 2023-04-02 13:19:35 +02:00
Christoph Oelckers
30d066cee9 - added script exports for Duke's bosses.
This allows removing a few hack checks.
2023-04-02 13:13:45 +02:00
Christoph Oelckers
26c8e948f7 deleted debug code 2023-04-02 13:13:45 +02:00
Christoph Oelckers
7f240a0a7a - converted all remaining classes used by PicForName.
This means all functions using this can now pass class pointers directly to the native code.
2023-04-02 13:13:45 +02:00
Christoph Oelckers
c9888ae6cb - exported several RR enemies/animals needed for the UFO spawner. 2023-04-02 13:13:06 +02:00
Christoph Oelckers
9b96f8312a - pig cop converted 2023-04-02 13:13:06 +02:00
Christoph Oelckers
bc50f596e8 - exported two more classes used by PicForName. 2023-04-02 13:10:34 +02:00
Christoph Oelckers
7b4d5eb26d - scriptified SHRINKEREXPLOSION and WATERBUBBLE. 2023-04-02 13:10:26 +02:00
Christoph Oelckers
673ea69d35 - scriptified a few more skeleton items needed by PicforName. 2023-04-02 13:00:13 +02:00
Christoph Oelckers
ccc048136f - exported TOILETWATER, BURNING and EXPLOSION2.
All types needed for cleaning up PicForName
2023-04-02 13:00:13 +02:00
Christoph Oelckers
e0bd038391 - scriptified the native parts of TRANSPORTERSTAR and TRANSPORTERBEAM 2023-04-02 13:00:13 +02:00
Mitchell Richters
07ea5d06ae - Update version.h. 2023-04-02 20:11:51 +10:00
Mitchell Richters
2c6d8b50ea - Exhumed: Tidy up bubbles.cpp.
* Extend `BuildBubbles()` to use the actual player's angle for if we ever get multiplayer going.
2023-04-02 19:56:54 +10:00
Mitchell Richters
4c11fb1b2a - Exhumed: Tidy up remainder of anubis.cpp. 2023-04-02 19:56:54 +10:00
Mitchell Richters
754d27a8f0 - Exhumed: Tidy up AIAnubis::Tick(). 2023-04-02 19:56:54 +10:00
Mitchell Richters
8d48252f1a - Exhumed: Backup actor location in BuildAnubis(). 2023-04-02 19:56:54 +10:00
Mitchell Richters
b10b909440 - Exhumed: Rename last argument in seq_MoveSequence() to nFrame. 2023-04-02 19:56:53 +10:00
Mitchell Richters
cf63d1ab74 - Exhumed: Tidy up remainder of anims.cpp. 2023-04-02 19:56:53 +10:00
Mitchell Richters
a2bd2b17a2 - Exhumed: Tidy up BuildAnim().
* Also rename two rather unnamed args to something more appropriate.
2023-04-02 19:56:53 +10:00
Mitchell Richters
b5d4bc8573 - Exhumed: Tidy up 2d.cpp. 2023-04-02 19:56:53 +10:00
Mitchell Richters
345f45ed12 - Fixed messed up formatting in savegamehelp.cpp. 2023-04-02 19:56:53 +10:00
Mitchell Richters
10445635cf - Tidy up autosaving for all the games.
* There's not really any reason to need the game's world to tic once, it's already fully loaded during the `gi->NewGame()`/`gi->NextLevel()` calls.
2023-04-02 19:56:52 +10:00
Mitchell Richters
0052ae4172 - Duke: Ensure we backup player angles and not just pos when loading a save. 2023-04-02 19:51:12 +10:00
Mitchell Richters
bcbebc5c1a - Blood: Fix potential null actor access in gi->CanSave(). 2023-04-02 19:51:12 +10:00
Mitchell Richters
9dfb805b38 - Duke: Fix potential null actor access in gi->CanSave(). 2023-04-02 19:51:12 +10:00
Mitchell Richters
7217ce6ff9 - Duke: Ensure hard landing check is done after pitch keys.
* Oversight from e9a5f745fc.
2023-04-02 19:51:12 +10:00
Mitchell Richters
272dfa762d - Remove backend crouch toggle solution redeploy with Duke/Exhumed/Blood using new ESyncBit bit.
* I tried to make this work in 2020 but its been nothing but headache. It's something for the game to control via a flag, not the backend to determine.
* For SW, this restores its original implementation.
2023-04-02 18:32:40 +10:00
Mitchell Richters
b9cf8a13c6 - Inline the remainder of InputState methods. 2023-04-02 18:32:40 +10:00
Mitchell Richters
ea4e850674 - Move remaining mouse CVARs from inputstate.cpp to gameinput.cpp. 2023-04-02 18:32:39 +10:00
Mitchell Richters
13cb52a0db - Move HIDInput struct from inputstate.h to gameinput.h. 2023-04-02 18:32:39 +10:00
Mitchell Richters
10cd63f383 - Use an FVector2 inside HIDInput. 2023-04-02 18:32:39 +10:00
Mitchell Richters
4387294aff - Eliminate the duplicate mouse storage since we have things in the right spot now. 2023-04-02 18:32:39 +10:00
Mitchell Richters
eeb67a2cdd - Move all mouse CVARs from inputstate.cpp to gameinput.cpp. 2023-04-02 18:32:39 +10:00
Mitchell Richters
64b05b6f06 - Move remaining CCMDs and non-inputstate related items to gameinput.cpp. 2023-04-02 18:32:38 +10:00
Mitchell Richters
43febd5aa1 - Stop passing inputBuffer around within gameinput.cpp since everything's local now. 2023-04-02 18:32:38 +10:00
Mitchell Richters
3c82014d0e - Move ApplyGlobalInput() into gameinput.cpp.
* Doesn't really belong in inputstate.cpp, it was just placed there in 2020 for lack of a better spot at the time.
2023-04-02 18:32:38 +10:00
Mitchell Richters
9e1ca0cb8f - Make the turbo turn functions static within gameinput.cpp. 2023-04-02 18:32:38 +10:00
Mitchell Richters
359371527b - Move Duke's vehicle input processor into gameinput.cpp. 2023-04-02 18:32:36 +10:00
Mitchell Richters
563c79322d - Duke: Make vehicle input code work generically for possible reusage. 2023-04-02 18:25:04 +10:00
Mitchell Richters
5e153d6404 - Duke: Merge vehicle input code into one function. 2023-04-02 18:24:05 +10:00
Mitchell Richters
03eb105df1 - Duke: Move RRRA vehicle tilting out of the input code and into the playsim. 2023-04-02 18:24:05 +10:00
Mitchell Richters
c13745efc8 - Remove the mouse input negation out of the event handler. 2023-04-02 18:24:05 +10:00
Mitchell Richters
b340807a6b - Remove now-unneeded inline wrapper getHidInput(). 2023-04-02 18:24:05 +10:00
Mitchell Richters
46b5977a6a - Recover two ESyncBit values for other uses.
* By masking aiming+centering, we have look bits :)
2023-04-02 18:24:05 +10:00
Christoph Oelckers
e1ea0492e1 - savegame version bump. 2023-04-02 08:50:05 +02:00
Christoph Oelckers
1e7850b17e - fixed last commit 2023-04-01 12:27:48 +02:00
Christoph Oelckers
a64f19c16d - had to apply the RapidJson NaN workaround to another place.
So instead of fixing the bug they actually replicated it into a second function. :(
It's too bad that we cannot enable proper writing of NaNs and Infs because it makes most JSON formatters emit an error on this undefined extension of the format.
2023-04-01 10:26:51 +02:00
Christoph Oelckers
5f3065d9f1 - Duke: fixed weapon spread with non-pistol hitscan weapons. 2023-04-01 09:49:22 +02:00
Mitchell Richters
86711f666b - Exhumed: Tidy up StartDeathSeq(). 2023-03-29 19:41:05 +11:00
Mitchell Richters
3e4dd94fe5 - Exhumed: Tidy up a bunch of small player functions. 2023-03-29 19:40:42 +11:00
Mitchell Richters
0467b02393 - Exhumed: Mark all player static arrays as const. 2023-03-29 19:39:54 +11:00
Mitchell Richters
daf63ce209 Revert "- InputState::ClearAllInput(): Only clear crouch_toggle bool if outside of a level, and resend SB_CROUCH sync bit if inside a level and crouch_toggle is true."
This reverts commit c076310e34.

* It's no longer needed with 70706d3da8.
2023-03-29 13:21:14 +11:00
Mitchell Richters
70706d3da8 - Don't stop getting input when we're paused.
* This is the cause of the long-standing crouch toggle issues, as well as a few other things.
2023-03-29 13:20:55 +11:00
Mitchell Richters
7feb5a9a9b Revert "- Duke: Temporary workaround for last commit so the player returns to centre on level load."
This reverts commit 2b22e49a9b.

* It's no longer needed with 06dd971291.
2023-03-29 13:20:55 +11:00
Mitchell Richters
06dd971291 - When the gameaction is ga_level, return and don't break.
* This was causing the first input packet to only be sent to the playsim after the first tic occurred.
* Previous: player 1 of 1 (1 nodes); E1L1: Hollywood Holocaust; PlayClock: 4; PlayClock: 4; PlayClock: 12;, etc.
* Current: player 1 of 1 (1 nodes); E1L1: Hollywood Holocaust; PlayClock: 0; PlayClock: 4; PlayClock: 8;, etc.
* Fixes #900.
2023-03-29 13:20:47 +11:00
Mitchell Richters
7caec5fa69 - Clean out where inputState.ClearAllInput() is called.
* We can do this from just a few places and achieve the same result as having it sprinkled everywhere did.
2023-03-29 09:05:49 +11:00
Mitchell Richters
9f8cda4be3 - Move call to I_GetInputFrac() to ensure we're never stalled waiting for a tic. 2023-03-29 09:04:40 +11:00
Mitchell Richters
d665037075 - Clean out where Net_ClearFifo() is called.
* We can do this from one place and achieve the same result as having it sprinkled everywhere did.
2023-03-29 09:04:38 +11:00
Mitchell Richters
96055fbc03 - Clean out all games setting gameaction = ga_level and do it centrally. 2023-03-29 03:10:16 +11:00
Mitchell Richters
9618ba1e78 - Don't serialise player angles twice. 2023-03-28 09:15:58 +11:00
Mitchell Richters
72be2623c3 - Exhumed: Remove useless sectortype extern pointer. 2023-03-28 08:51:51 +11:00
Mitchell Richters
c6a53265eb - Exhumed: Misc tidy-ups.
* The setting of `Player::bIsFiring` needs to be done before setting a new weapon.
* Tidy up some weird reverse engineering `while (1)` loop which GDX doesn't do.
2023-03-28 08:45:14 +11:00
Mitchell Richters
42d791e7c2 - Exhumed: Fix clip calculation setup.
* Since game maintains its own clip capacities, we need to use them instead of the generic handler for the games that do not.
* Clean up the game-side code in `CheckClip()` to use `min()`.
* Repair issue with pistol clip calculation that was using modulo when it shouldn't. A full weapon with 300 will divide into 6 with no remainder, therefore nothing in the clip.
* Fixes #906.
2023-03-27 22:05:35 +11:00
Mitchell Richters
892dde030f - Tidy up nested branch in calcChaseCamPos(). 2023-03-27 20:43:55 +11:00
Mitchell Richters
6c2717fcde - Avoid testing if we're synchronising input twice in getInput(). 2023-03-27 20:01:56 +11:00
Mitchell Richters
79745668a6 - Exhumed: Take advantage of getWrappedIndex() in updatePlayerInventory() as well. 2023-03-27 18:47:30 +11:00
Mitchell Richters
1ed655e0e7 - Exhumed: Further clean up updatePlayerWeapon().
* Rename a few variables for better clarity as to what's going on.
* Add new inline to the backend `getWrappedIndex()` that properly wraps around negative values based on the supplied maximum using modulo.
* Directly set the weapon when doing the next/prev tests to avoid unnecessary tests to see whether the player has the weapon or not.
2023-03-27 18:47:05 +11:00
Mitchell Richters
ebedf46434 - Exhumed: Reset view pitch back to 0 when doing Ramses, using game's formula.
* Ensure's a smooth return to 0 so the player's actual pitch can be targeted towards Ramses.
* In situations where the player had their view pitch changed in the ticker, this would have never reset.
2023-03-27 18:08:56 +11:00
Mitchell Richters
0594a5cb91 - Exhumed: Properly repair height test after reviewing GDX.
* The code in this game is so much tidier to understand what's what...
2023-03-27 18:08:55 +11:00
Mitchell Richters
bd8b033120 - Exhumed: Logic fixes to some underwater tests following review of GDX.
* Necessitated a little bit of rearranging in the player ticker but the grouping of all inputs into one function makes sense.
2023-03-27 18:08:55 +11:00
Mitchell Richters
94f188c926 - Exhumed: Restore original grenade pickup code.
* When I read this against the generic weapon pickup code, it looked similar enough but the grenade's logic is reversed. That is, after picking up the weapon, equip the player. The generic weapon handler equips the player, then gives them ammo.
* Fixes #904.
2023-03-27 18:08:55 +11:00
Mitchell Richters
99e23a8d24 - Exhumed: Move Player::nCurrentItem usage into the right spot.
* Originally, `updatePlayerInventory()` was in the main loop and not the player ticker. Now that it's been relocated, this makes sense.
2023-03-27 18:06:35 +11:00
Mitchell Richters
d66f97e5dc - Exhumed: Clean up weapon selection code a bit.
* Concentrate it all in the `updatePlayerWeapon()` function.
2023-03-27 17:08:59 +11:00
Mitchell Richters
cb3fec39df - Exhumed: Move a line out of doPlayerMovement() and into updatePlayerViewSector().
* It needs to come after the function it's been moved into, but its confusing why its calculating a new pos delta when there's one on the stack.
* By directly nesting it in, it's a lot clearer.
2023-03-27 08:36:04 +11:00
Mitchell Richters
d858856e06 - Exhumed: Store a pos delta on the stack in `doPlayerMovement().
* We need this in a few places.
* Z is inverted because pitch is negated. Previously I just swapped the operation around.
2023-03-27 08:32:52 +11:00
Mitchell Richters
4fa12a9e30 - Exhumed/SW: Make sure the pitch keys are done after the slope tilting.
* Pitch key code does player horizon bounding.
2023-03-27 08:28:32 +11:00
Mitchell Richters
4bf2f70d7b - Exhumed: Remove Player::nDestVertPan entirely.
* We can just pass the needed value into `doPlayerPitch()`.
* For Ramses, no need to set `nDestVertPan` to the map value, just use the map value.
* Avoids an excess `atan2()` call by way of `maphoriz()`.
2023-03-27 08:14:42 +11:00
Mitchell Richters
b5123ac69f - Exhumed: Split pitch and yaw input again.
* They need to be called in different places inside of `doPlayerMovement()`.
2023-03-27 08:03:35 +11:00
Mitchell Richters
6aceb7bda3 - Exhumed: Clean up some of the repeated sector gets in doPlayerMovement(). 2023-03-27 08:03:14 +11:00
Mitchell Richters
d45be79c24 - Exhumed: Adjust yaw adjustment for Ramses to use the same formula as pitch.
* Rather than just snapping the angle, the player's yaw and pitch move evenly towards Ramses.
2023-03-26 22:13:57 +11:00
Mitchell Richters
b5a9085aed - Exhumed: Restore more accurate pitch adjustment for Ramses.
* Use `maphoriz(-11)` instead of some voodoo degree amount so it's clear when comparing sources.
* Don't stop interpolating while doing Ramses.
* Apply Ramses pitch amount to `nVertDestPan`, just like the original.
* Don't reset all angles when initialising Ramses, just set the yaw angle.
* Don't return player's view to center when doing Ramses, use the delta between `nDestVertPan` and the player's pitch, using same formula as original.
* Comment in how normal/non-ramses `nDestVertPan` setting should be 8x the sprite Z move delta, not 2x. I know it's not correct, but its been this way for a long time and we probably should CVAR it.
* When doing the player's death pitch, it's 40.156 degrees (horizon of 108), not 38 degrees (horizon of 100). This was a misread of mine way back when.
2023-03-26 22:13:57 +11:00
Christoph Oelckers
b6da4ecddf - backend update from GZDoom. 2023-03-26 11:45:25 +02:00
Mitchell Richters
0840e547b7 - Exhumed: Reset the player actor's pitch with the rest of the actor resets. 2023-03-26 20:12:59 +11:00
Mitchell Richters
1888b7ee9f - Exhumed: Ensure we back up the player actor's location after doing everything and not mid-way through a reset. 2023-03-26 20:09:43 +11:00
Mitchell Richters
950f4c2c38 - Exhumed: Restore nStandHeight global and move to Player struct.
* Was dropped in 572869f502.
* Game's crouch testing necessitates that this value be pre-cached.
* Interestingly, this value is 62.5 whereas the game's view height is 55. Change in late development to make the world feel larger?
2023-03-26 20:06:25 +11:00
Mitchell Richters
fd62f1fb68 Revert "- Exhumed: Increase quake precision in SetQuake()."
This reverts commit fb9ff7d105.

* The game relies on this being low precision. It was causing a weird tremor in the training map.
2023-03-26 19:52:55 +11:00
Mitchell Richters
71aad07913 - Exhumed: Fix backwards logic from new pitch panning refactor.
* From 79f7ca976b.
* Fixes #901.
2023-03-26 18:56:01 +11:00
Mitchell Richters
e9a5f745fc - Duke: Ensure pitch keys are done after adding player's input.
* As this function includes the actor's pitch clamp, it's important its done afterwards.
* Setup is already right for all the other games.
2023-03-26 16:40:25 +11:00
Mitchell Richters
0387282e37 - Fix two particularly loud warnings from GCC builds.
* `warning: type qualifiers ignored on function return type`.
2023-03-26 15:35:33 +11:00
Mitchell Richters
7d5ca901eb - Exhumed: Clear all input out upon restarting the player.
* Stale accumulation from the last round can apply on the next tic.
2023-03-26 15:17:28 +11:00
Mitchell Richters
776c58c58a - Duke: If we enter playerCenterView() and put SB_CENTERVIEW() back on, we need to null and lock input. 2023-03-26 14:36:23 +11:00
Mitchell Richters
0da2afe3d7 - Duke: Tidy up some of the pitch stuff.
* Remove some extern'd CVARs that didn't need externing.
* Change `player_struct::centeringView()` bool into proper method to handle the operation.
* Operation now properly unsets `SB_CENTERVIEW` if conditions aren't met instead of relying on implied behaviour from the rest of the playsim.
2023-03-26 13:35:12 +11:00