Commit graph

3124 commits

Author SHA1 Message Date
Christoph Oelckers
94a37dfcdc - extended walltype to directly manage Blood's XWALL.
Unfortunately this had to be done in the base class so that we can still maintain the walls in a global array.
The tradeoffs of better abstractions would be far too costly here than the added 16 bytes to the wall struct.
2021-12-25 21:28:47 +01:00
Christoph Oelckers
6217623c24 - Blood: removed unused/redundant functions. 2021-12-25 21:28:47 +01:00
Christoph Oelckers
56a1836e68 - all SectUsers replaced, except for the maintenance code of the array. 2021-12-25 21:28:47 +01:00
Christoph Oelckers
bd43f49c29 - replaced half of the remaining SectUser accesses. 2021-12-25 21:28:46 +01:00
Christoph Oelckers
5cda292d98 - lots of search& replace actions.
This takes care of roughly 2/3 of the SectUser accesses.
2021-12-25 21:28:46 +01:00
Christoph Oelckers
4266edfa04 - SW: automatic ->sector() replacements (lots of them) 2021-12-25 21:28:46 +01:00
Christoph Oelckers
5b87370b5e - SW: wall[] replacements in CopySectorWalls 2021-12-25 21:28:45 +01:00
Christoph Oelckers
a5fac26a90 - DIVx macro removal.
Only DIV2 left because there are too many calls to quickly remove them.
2021-12-25 21:28:45 +01:00
Christoph Oelckers
a6bf9c7208 - use proper owner interface in nnext sound check. 2021-12-25 21:28:45 +01:00
Christoph Oelckers
72da21a7e3 - renamed variable for clarification. 2021-12-25 21:28:45 +01:00
Christoph Oelckers
bee70155d2 - make XSPRITE::target a pointer 2021-12-25 21:28:45 +01:00
Christoph Oelckers
d576e8f438 - removed a few of the remaining shorts. 2021-12-25 21:28:44 +01:00
Christoph Oelckers
28f7303af3 - a few automatic replacements. 2021-12-25 21:28:44 +01:00
Christoph Oelckers
93f5a111bf - all direct references to xsector have been removed. 2021-12-25 21:28:44 +01:00
Christoph Oelckers
c54137766c - iterator loops in sectorfx.cpp. 2021-12-25 21:28:44 +01:00
Christoph Oelckers
b3bf1bc037 - some simple replacements, mostly search & replace. 2021-12-25 21:28:44 +01:00
Christoph Oelckers
8f5b9d2f03 - nXSector is gone. 2021-12-25 21:28:43 +01:00
Christoph Oelckers
a0ef54cb54 - remove XSECTOR::reference. 2021-12-25 21:28:43 +01:00
Christoph Oelckers
4ed1ee77c7 - several more xsector references removed. 2021-12-25 21:28:43 +01:00
Christoph Oelckers
adaa132515 - lots of boilerplate sections to get a pXSector pointer replaced.
Looks like this was originally an inline function, judging from how this was repeated all over again.
2021-12-25 21:28:43 +01:00
Christoph Oelckers
2e8e5544c5 - ActionScan internals cleaned up. 2021-12-25 21:28:43 +01:00
Christoph Oelckers
1a8cf9b2f9 - removed pX... parameter from ActionScan. 2021-12-25 21:28:42 +01:00
Christoph Oelckers
f06697ed29 - removed pX... parameter from from trTriggerSector. 2021-12-25 21:28:42 +01:00
Christoph Oelckers
ccd6af6272 - Blood: transitioned several functions in actor.cpp to the new method to acces the x() data. 2021-12-25 21:28:42 +01:00
Christoph Oelckers
32f141ad39 - XSECTOR::reference is gone. 2021-12-25 21:28:42 +01:00
Christoph Oelckers
576a473ec8 -XWALL::references is not needed anymore. 2021-12-25 21:28:42 +01:00
Christoph Oelckers
db9d12d19f - evrListRedirectors
The wall/sector parts of this look currently unused,
2021-12-25 21:28:42 +01:00
Christoph Oelckers
b23a2865b8 - useSectorLightChanger 2021-12-25 21:28:41 +01:00
Christoph Oelckers
1472d021f6 - use regular indices instead of xindices for the SEQ list.
This also fixes incorrect use of walls in the nnext sector checks for sequences.
2021-12-25 21:28:41 +01:00
Christoph Oelckers
c019e118a5 - cleanup of shadeList, panList and wallPanList.
Made them TArrays and let them store pointers to the contained objects instead of xoffsets.
2021-12-25 21:28:41 +01:00
Christoph Oelckers
c182900425 - cleanup of trTriggerWall's API. 2021-12-25 21:28:41 +01:00
Christoph Oelckers
59312c42bb - eliminated ca. half of the xwall references. 2021-12-25 21:28:41 +01:00
Christoph Oelckers
9cad3196ed - getSourceBusy 2021-12-25 21:28:40 +01:00
Christoph Oelckers
4cfc1577e2 - some simple xwall[] replacements. 2021-12-25 21:28:40 +01:00
Christoph Oelckers
70da9e2526 - first xwall[] removal in Blood. 2021-12-25 21:28:40 +01:00
Christoph Oelckers
19f3365efc - Blood: add x-access functions to spritetype and walltype.
This is merely a refactoring aid to get everything in a state that later allows merging these into one.
2021-12-25 21:28:40 +01:00
Christoph Oelckers
9ab35816ea - the crane still stored a sector index in temp_data. 2021-12-25 21:28:40 +01:00
Christoph Oelckers
69c21407a7 - pass a sector pointer to checkcursectnums. 2021-12-25 21:28:39 +01:00
Christoph Oelckers
3ce2375a3e - LocateTheLocator + related sector storage in temp_data 2021-12-25 21:28:39 +01:00
Christoph Oelckers
64f1029416 - Duke: pass a sector pointer to callsound. 2021-12-25 21:28:39 +01:00
Christoph Oelckers
f6db4a8e51 - SW: move User into DSWActor. 2021-12-25 21:28:39 +01:00
Christoph Oelckers
fe83487c77 - missed one bit of old savegame 2021-12-25 21:28:39 +01:00
Christoph Oelckers
47e207f158 - eliminated spritetype::index.
# Conflicts:
#	source/games/sw/src/swactor.h
2021-12-25 21:28:38 +01:00
Christoph Oelckers
fa48b740c0 -proper owner storage for Duke. 2021-12-25 21:28:38 +01:00
Christoph Oelckers
b9602bbb05 - store owner outside the sprite. 2021-12-25 21:28:38 +01:00
Christoph Oelckers
10e6486744 - fixed typo in GenDudeExtra save check. 2021-12-25 21:28:38 +01:00
Christoph Oelckers
771f5e3338 - removed all old savegame handling 2021-12-25 21:28:38 +01:00
Christoph Oelckers
77a23e39c5 - Blood: added closing EndObject() call to DUDEEXTRA serializer. 2021-12-25 21:28:38 +01:00
Christoph Oelckers
6705e8e51e - moved xsprite into DBloodActor and save all relevant parts of DBloodActor.
This completes Blood's transition.
2021-12-25 21:28:37 +01:00
Christoph Oelckers
766d87106a - we do not need XSPRITE::reference anymore. 2021-12-25 21:28:37 +01:00
Christoph Oelckers
3d22bfa362 - do not crunch condition info to an int.
Once the global sprite array is gone we need full actor info here.
2021-12-25 21:28:37 +01:00
Mitch Richters
c6f2aaf1b7 - Miscellaneous fixes to commit to change sector checks over to validSectorIndex().
* Fix missed changeover in Blood's `actSpawnSprite()`.
* Fix non-negated check on a `validSectorIndex()` call in Blood's `debrisMove()`.
* Removed a superfluous terminator in Duke's `actor.cpp`.
* Fixed bad call to `validSectorIndex()` in Exhumed's `AIAnim::Tick()`.
2021-12-25 21:28:37 +01:00
Christoph Oelckers
999ec3c95a use validSectorIndex checks where appropriate.
Let’s hope that this sloppiness doesn’t have negative effects with broken maps.

# Conflicts:
#	source/games/sw/src/sprite.cpp

# Conflicts:
#	source/games/duke/src/prediction.cpp
#	source/games/duke/src/render.cpp
2021-12-25 21:28:37 +01:00
Christoph Oelckers
2d7c085617 - SW: fixed bad user in SpawnSplash 2021-12-25 21:27:36 +01:00
Christoph Oelckers
d1c6c783a6 - SW: fixed user spawned for wrong actor. 2021-12-25 20:35:53 +01:00
Christoph Oelckers
3ec904d5c0 - SW: fixed several bad User references in missile seeking code. 2021-12-25 20:11:40 +01:00
Christoph Oelckers
1c5fc16fa5 - SW: fixed two bad user assignments 2021-12-25 19:54:45 +01:00
Christoph Oelckers
a94f298600 - print new errors in red. 2021-12-16 11:56:26 +01:00
Christoph Oelckers
d011f3c201 - Blood: validate upper/lower sector links before starting a level.
Originally this just performed an OOB memory access, but with Raze's setup it would dereference a null pointer so these must be eliminated.
2021-12-16 11:54:55 +01:00
Christoph Oelckers
7f1a3431ca - SW: fixed accidentally inverted colliision check in DoMirvMissile. 2021-12-15 20:51:31 +01:00
Christoph Oelckers
4daad25e5c - use WORDS_BIGENDIAN directly in place of B_BIG_ENDIAN 2021-12-14 12:27:41 +01:00
Christoph Oelckers
7c4233bcf7 - replaced fallthrough__ with [[fallthrough]] as we are requiring C++17 and don't need workarounds for that. 2021-12-14 12:27:28 +01:00
Christoph Oelckers
7daa501a4d - removed all #include "compat.h" except the one in build.h
Still all compiles fine.
2021-12-14 12:24:10 +01:00
Christoph Oelckers
6e43f1a15a - Blood: refine picnum 0 filter to apply to face sprites only. 2021-12-13 17:58:11 +01:00
Mitchell Richters
6aecc18c35 - SW: Use floating point radians instead of converting integer Build angle into radians for when updating a sound's angle. 2021-12-13 23:37:11 +11:00
Christoph Oelckers
8abd67a3b1 - fixed sound listener angle for the remote control case.
It was taking the angle of the rotating sector object instead of the angle from the listener's position to it.
2021-12-13 13:24:33 +01:00
Christoph Oelckers
498abf25f3 - Blood: make sure that invalid sprites don't get rendered at all.
Seems the game may have depended on them being clipped by the floor or ceiling.
2021-12-13 11:45:28 +01:00
Christoph Oelckers
e104316e75 - fixed bad parameter to getzrange.
This originated from 1d39bb371e where the getzrange_old function was removed
2021-12-13 09:39:57 +01:00
Christoph Oelckers
507dc10e4f - Duke/RR: Fixed sprite validation checks in animatesprites. 2021-12-11 09:57:02 +01:00
Mitchell Richters
3269d6a398 - Duke: Ensure all weapon variables used for interpolation have the o values set when CON updates them.
* Hasn't been an issue to date but could become one should a mod set these.
* Can't simply back the variable up and set the main one because unless the mod knows we're interpolating, it could have undesirable effects.
2021-12-10 17:31:51 +11:00
Mitchell Richters
ee1ffd2347 - Duke: Fix lotag signedness issue affecting SE10 (door auto-close).
* Originated in 01abe7b2ac while removing a casting to short.
* Fixes #594.
2021-12-10 17:26:56 +11:00
Mitch Richters
5aa4243327 - Duke: Test tsprite's sector in animatesprites_d() following crash while noclipping in Duke WT's E5L1. Apply same fix to animatesprites_r() as well. 2021-12-07 22:55:08 +11:00
Mitch Richters
6aba76cfe5 - Duke/RR: Fix RR crash while operating weapon outside of a sector (noclipping, etc). 2021-12-07 21:42:21 +11:00
Mitchell Richters
af96180123 - Duke/RR; Don't lose the precision of p->MotoSpeed when calculating p->VBumpTarget. 2021-12-07 20:02:30 +11:00
Mitch Richters
63a19bbb15 - Port spritetype::insector() over from develop and use with sector nullptr checks in 6539d72663. 2021-12-07 19:56:50 +11:00
Mitch Richters
6539d72663 - Duke/RR: Add three sector nullptr checks after receiving crash in Redneck Rampage Route 66 while noclipping. 2021-12-07 19:44:35 +11:00
Mitch Richters
85a2e3bd06 - Duke/RR: Do nullptr test in floorspace_d()/floorspace_r() functions to match ceilingspace_*() functions. 2021-12-07 19:41:25 +11:00
Mitch Richters
a7e99a3bd1 - Duke/RR: Do nullptr test in ceilingspace_r() after receiving crash in Redneck Rampage Route 66 (do Duke for parity). 2021-12-07 19:41:22 +11:00
Mitch Richters
96867e15d5 - Duke: Apply same nullptr fix in 2e7496888a to prelevel_r(), and rename sect to sectp for 1:1 match between _d.cpp and _r.cpp files. 2021-12-07 19:41:18 +11:00
Mitch Richters
2e7496888a - Duke: Re-add lost nullptr check in prelevel_d() that was causing a crash while loading Duke Nukem's Penthouse Paradise. 2021-12-03 10:14:41 +01:00
Christoph Oelckers
81268cb9b6 partial Revert of "- optimized vector math."
This reverts commit 826fd7ddb2.

Looks like there's dependencies on the intermediate variables. The optimized code gave the same result but did not work anymore.
2021-12-02 23:32:20 +01:00
Christoph Oelckers
c2baa68160 - fixed camera textures breaking in SW when restarting a level.
This was caused by attempting to delete the camera textures when cleaning up the mirror array.
The Build tile manager was not prepared for such a use case and left a broken texture behind.

To allow this to function it now resets the texture replacement type when deleting a tile and to avoid creating new camera textures these will now be stored in a cache and recycled later.
2021-12-02 21:40:43 +01:00
Christoph Oelckers
60630f5b84 - do not init pointers to 0xffffffffffffffff.
These will most certainly crash when used in any way.
2021-12-02 18:42:02 +01:00
Christoph Oelckers
cb099b1b66 - added two missing semicolons.
Unbelievable that this was legal C++ and didn't even get a warning!
2021-12-01 23:30:02 +01:00
Christoph Oelckers
57aca0ed07 - SW: fixed sector object setup with vator effect.
This used some weird initialization logic that was missed when first modifying this code.
2021-12-01 21:00:00 +01:00
Christoph Oelckers
324e35e776 - SW: fixed use of uninitialized variable in WallSetup 2021-12-01 19:55:18 +01:00
Christoph Oelckers
5bb114ba6e - fixed two bad actor references in Exhumed's radial damage code.
The radial source is passed through pRadialActor, not pObjActor.
2021-11-30 22:44:54 +01:00
Christoph Oelckers
690994ea1e - Duke: fix missing sectp update in processinput_d.
RR version had this correct
2021-11-30 00:20:16 +01:00
Christoph Oelckers
64cad55d73 - fixed updatesector and changed updatesectorz to use the same search algorithm.
The initial distance check in updatesectorneighbor had a far too low threshold which would skip the breadth-first search for relatively small distances already.
Exhumed's LEV1 and Duke's Lunatic Fringe were the most obvious candidates where this could cause problems.
Changed to use a mixture of the original updatesector with the revised algorithm so that all immediate neighbors of the start sector will get visited unconditionally.

updatesectorz was still the original function from Shadow Warrior, this also was changed to use the same algorithm as uodatesector.
2021-11-30 00:15:25 +01:00
Christoph Oelckers
71dfe7ecfe - fixed handling for cl_capfps and cl_nointerpolate to never use any smoothratio value other than 1.0. 2021-11-29 00:57:11 +01:00
Christoph Oelckers
b54e52330c - Blood: don't play the same looped sound multiple times on the same actor.
This caused some strong echoing on E4M6.
2021-11-29 00:57:11 +01:00
Christoph Oelckers
1de9c63d45 - fixed center aligned rendering of 2D content.
This calculates the centered pivot point in integer texel coordinate space so for odd numbers it must round down instead of using a fractional position.
2021-11-29 00:57:10 +01:00
Christoph Oelckers
ec63dd4cb3 - SW: precacheMap cleanup 2021-11-29 00:57:09 +01:00
Christoph Oelckers
b73ea76c18 - cleaned out Bunny_Count declarations.
One is enough.
2021-11-29 00:57:09 +01:00
Mitch Richters
73c5bef580 - Blood: Remove duplicated code from render3DViewPolymost() that's already performed in viewDrawScreen(). 2021-11-29 00:56:33 +01:00
carnivoroussociety
61cafc7d57 [Blood] Fix self collisions for lifeleech projectiles 2021-11-29 00:56:33 +01:00
carnivoroussociety
958d004119 [Blood] Match view height clamping behavior to 1.21 2021-11-29 00:56:32 +01:00
Christoph Oelckers
cd3288860a - fixed automap player drawing for follpw mode off in all games. 2021-11-29 00:56:32 +01:00
Christoph Oelckers
2949361c82 - Duke/RR: added null checks to all spawn() calls 2021-11-29 00:56:32 +01:00
Christoph Oelckers
d5a6be3d96 - cleaned up Duke's spawn code.
The paths for initializing a map placed sprite and spawning a new actor at run time are now fully separate aside from the actual initialization of the actor.
2021-11-29 00:56:31 +01:00
Christoph Oelckers
4c7662b4ea - Duke/RR: guard all calls to EGS with a null pointer check.
Spawning sprites into the void will crash the engine so these must be blocked which requires a failure check here.
With this pressing fire while in the void no longer crashes the game - it won't fire anything, either, though.
2021-11-29 00:56:31 +01:00
Christoph Oelckers
fcbb7320a8 - Duke/RR: added all checks needed for not letting Duke crash with noclip when not accepting -1 as a valid sector pointer.
All places that were causing a crash are now guared by calling 'insector()'.
2021-11-29 00:56:31 +01:00
Christoph Oelckers
8972dbe5da - actorstayput 2021-11-29 00:56:31 +01:00
Christoph Oelckers
4a81d45630 - the remaining sector[] stuff in Duke/RR.
What remains is either engine interface code or not easily replaced.
2021-11-29 00:56:31 +01:00
Christoph Oelckers
5e66a3331d - getanimationgoal. 2021-11-29 00:56:30 +01:00
Christoph Oelckers
baf36a321b - inside, haskey and removed unused processmove functions. 2021-11-29 00:56:30 +01:00
Christoph Oelckers
3970c9a757 - use sector pointers in actors_lava.cpp 2021-11-29 00:56:30 +01:00
Christoph Oelckers
9b6d6eb7f9 - sector[] in render interface 2021-11-29 00:56:30 +01:00
Christoph Oelckers
db96e93adc - animatesect, setanimation and related stuff. 2021-11-29 00:56:30 +01:00
Christoph Oelckers
b0ced98d5e - changed main EGS function. 2021-11-29 00:56:29 +01:00
Christoph Oelckers
09c2677fe7 - lots of EGS calls. 2021-11-29 00:56:29 +01:00
Christoph Oelckers
876d1dbe1f - operatesectors and activatebysector. 2021-11-29 00:56:29 +01:00
Christoph Oelckers
c57c007010 - do the remaining st handlers. 2021-11-29 00:56:29 +01:00
Christoph Oelckers
2aec8f47d3 - more st functions. 2021-11-29 00:56:29 +01:00
Christoph Oelckers
2a290dec48 - handle_st15 / handle_st16. 2021-11-29 00:56:29 +01:00
Christoph Oelckers
da4df04e7d - sector[] in handle_st09. 2021-11-29 00:56:28 +01:00
Christoph Oelckers
45519f67c1 - Duke: let neartag return pointers 2021-11-29 00:56:28 +01:00
Christoph Oelckers
a9aadfd63d - neartag cleanup in checksectors. 2021-11-29 00:56:28 +01:00
Christoph Oelckers
3d05020f4c - checkhitceiling + ceilingglass are sector[] free. 2021-11-29 00:56:28 +01:00
Christoph Oelckers
747fc11eb7 - Duke: use sector pointer in movement code 2021-11-29 00:56:28 +01:00
Christoph Oelckers
931c71a78c - use sector iterator for cheatUnlock 2021-11-29 00:56:27 +01:00
Christoph Oelckers
a7634c4cad - Duke: use pointers in interpolation interface. 2021-11-29 00:56:27 +01:00
Christoph Oelckers
0d8b380b05 - use wallsofsector for all remaining iterations over a sector's walls. 2021-11-29 00:56:27 +01:00
Christoph Oelckers
ac5425a545 - extended player_orig.os to full int.
This was the last remaining short variable in Duke/RR that holds a sector index.
2021-11-29 00:56:27 +01:00
Christoph Oelckers
a0950081ad - fixed bad sector use in handle_st18 2021-11-29 00:56:27 +01:00
Christoph Oelckers
5c9327a788 - use pointer variant of nextsectorneighborz. 2021-11-29 00:56:27 +01:00
Christoph Oelckers
0f2f46ec35 - made one_parallax_sectnum a pointer 2021-11-29 00:56:26 +01:00
Christoph Oelckers
bc199d00c7 - made 'clouds' a pointer array. 2021-11-29 00:56:26 +01:00
Christoph Oelckers
7a9e39a96b - delete some inactive code. 2021-11-29 00:56:26 +01:00
Christoph Oelckers
adf3133fdc - use sectnum and wallnum to get an index from pointers instead of subtracting the array base. 2021-11-29 00:56:26 +01:00
Christoph Oelckers
4e31360fe4 - cleaned up dragpoint
This still contained some code for EDuke32's TROR and used a shared static global array.
It now uses the BFSSearch class to manage its bit array to unlimit the size of its working set and to avoid reallocation.
2021-11-29 00:56:25 +01:00
Christoph Oelckers
7126aa22f4 - preparations in the map loader for dynamically sized data storage.
This also consolidates these parts for Blood with the other games.
2021-11-29 00:56:25 +01:00
Christoph Oelckers
33a3e0d8bf - deleted some unused global variables, code simplification plus extended wall index field in Trap
Todo: give fields more meaningful names!
2021-11-29 00:56:25 +01:00
Christoph Oelckers
c1c59006bc - Exhumed: cleaned up disassembly-like code in SnapSectors 2021-11-29 00:56:25 +01:00
Christoph Oelckers
e6682f4489 - Exhumed: some simple wall stuff 2021-11-29 00:56:25 +01:00
Christoph Oelckers
7b1345d3e5 - Exhumed: wall stuff in AddFlash 2021-11-29 00:56:24 +01:00
Christoph Oelckers
c31d8a93fd - a few more
Enough of this - Duke is clearly clean of bad storage now
2021-11-29 00:56:24 +01:00
Christoph Oelckers
53122355fe - more sectors in spawn.cpp 2021-11-29 00:56:24 +01:00
Christoph Oelckers
c79dace730 - eliminated sector[] in position checkers 2021-11-29 00:56:24 +01:00
Christoph Oelckers
27af8a52e9 - the final walls
What is left now of wall[] and wallnum() needs to remain.
2021-11-29 00:56:24 +01:00
Christoph Oelckers
a26dc25e97 - lotsofpopcorn 2021-11-29 00:56:24 +01:00
Christoph Oelckers
35eb94b89a - lotsofcolourglass 2021-11-29 00:56:23 +01:00
Christoph Oelckers
344041167e - add setanimation variant taking a wall pointer
Mainly to get rid of wallnum()calls elsewhere.
2021-11-29 00:56:23 +01:00
Christoph Oelckers
83344818fd - pass wall pointer to breakwall 2021-11-29 00:56:23 +01:00
Christoph Oelckers
567a360092 - store wall pointers in animwall 2021-11-29 00:56:23 +01:00
Christoph Oelckers
6b73a37b56 - made mirrorsector a pointer array 2021-11-29 00:56:23 +01:00
Christoph Oelckers
58cd8bd6b9 - make mirrorwall a pointer array 2021-11-29 00:56:23 +01:00
Christoph Oelckers
caa9ef6dd3 - make access_wallnum a pointer 2021-11-29 00:56:22 +01:00
Christoph Oelckers
e7369a2796 - use pointers for checkhitswitch and took separated clearcameras to a new functions to make this free of gotos. 2021-11-29 00:56:22 +01:00
Christoph Oelckers
9d8e7ea759 - crane cleanup
This now uses its own struct where it can store the needed actor pointer directly.
2021-11-29 00:56:22 +01:00