Commit graph

1925 commits

Author SHA1 Message Date
Christoph Oelckers
40a307650d - the really final parts of the shared code using s() cleaned up. 2021-12-30 09:57:15 +01:00
Christoph Oelckers
09634c4993 - use actors instead of sprites in the new renderer's API. 2021-12-30 09:57:15 +01:00
Christoph Oelckers
f602cf3806 - deal with s() in shared code.
clip.cpp was left alone, except for the actual call.
2021-12-30 09:57:14 +01:00
Christoph Oelckers
d0143db8fe - got rid of sx() and sm() inlines. 2021-12-30 09:57:13 +01:00
Mitchell Richters
baf78848eb - Replace spritetypebase z with pos.Z calls and eliminate spritetypebase pos union. 2021-12-30 09:57:06 +01:00
Mitchell Richters
cecb8dc48e - Replace spritetypebase y with pos.Y calls. 2021-12-30 09:57:05 +01:00
Mitchell Richters
33ca55023f - Replace spritetypebase x with pos.X calls. 2021-12-30 09:57:05 +01:00
Mitchell Richters
09e00a69fe - Replace walltype y with pos.Y calls and eliminate walltype pos union. 2021-12-30 09:57:04 +01:00
Mitchell Richters
51b647da87 - Replace walltype x with pos.X calls. 2021-12-30 09:57:04 +01:00
Mitchell Richters
b24f07f281 - Capitalise vec2_16_t y variable. 2021-12-30 09:57:03 +01:00
Mitchell Richters
e52c3e6d82 - Capitalise vec2_16_t x variable. 2021-12-30 09:57:03 +01:00
Mitchell Richters
b2ab64bb62 - Capitalise vec3_t z variable. 2021-12-30 09:57:03 +01:00
Mitchell Richters
68e2691be7 - Capitalise vec3_t y variable. 2021-12-30 09:57:03 +01:00
Mitchell Richters
c549cc5276 - Capitalise vec3_t x variable. 2021-12-30 09:57:02 +01:00
Mitchell Richters
118ceb18ca - Capitalise vec2_t y variable. 2021-12-30 09:57:02 +01:00
Mitchell Richters
3c9cd926ba - Capitalise vec2_t x variable. 2021-12-30 09:57:02 +01:00
Christoph Oelckers
8ce4edc7ad - fixed bad sprite offsetting in polymost.
This was introduced by incompletely merging the changes for sloped sprites.
2021-12-30 09:57:01 +01:00
Christoph Oelckers
d9d05e90b5 - globally replaced all occurences of '->s().' with '->spr.' 2021-12-30 09:57:00 +01:00
Christoph Oelckers
beddf1e1ca - add slope sprite support to the new renderer.
Some fudging was needed to avoid positioning problems as the renderer is more sensitive to this than Polymost.
2021-12-30 09:56:55 +01:00
Christoph Oelckers
6fd4d6d550 - ported slope sorite support from NBlood.
For Polymost only so far.
2021-12-30 09:56:54 +01:00
Christoph Oelckers
df0c577cf4 - replaced most of numsectors, too. 2021-12-30 09:56:54 +01:00
Christoph Oelckers
6e3b6028e9 - reinstated bug in pushmove not to check the first wall when scanning backwards.
For real this time
2021-12-30 09:56:53 +01:00
Christoph Oelckers
c546bfc1ca - reinstated bug in pushmove not to check the first wall when scanning backwards.
Seems we need this in a few places.
2021-12-30 09:56:53 +01:00
Christoph Oelckers
986fccfddc - use symbolic constants for all places where globalorientation is checked for the alignment bits. 2021-12-30 09:56:51 +01:00
Christoph Oelckers
8f0f0e8816 - manual sprite flag replacements in Duke. 2021-12-30 09:56:49 +01:00
Christoph Oelckers
ace01d02bc - alignment flags and a few leftovers. 2021-12-30 09:56:48 +01:00
Christoph Oelckers
82fb03e399 - another batch of search&replace, with smaller results. 2021-12-30 09:56:48 +01:00
Christoph Oelckers
c5ae454207 - another big batch of automatic replacements. 2021-12-30 09:56:48 +01:00
Christoph Oelckers
8f012d1beb - made wall flags type safe 2021-12-30 09:56:47 +01:00
Christoph Oelckers
1e30f461e6 - flags in Polymost 2021-12-30 09:56:47 +01:00
Christoph Oelckers
adbf5177a7 - flag combo stuff. 2021-12-30 09:56:46 +01:00
Christoph Oelckers
d0a06ae961 - deal with most of CSTAT_SECTOR_SKY and CSTAT_SECTOR_SLOPE 2021-12-30 09:56:45 +01:00
Christoph Oelckers
1edccf1423 - added slope setter methods to sectortype.
To make sure that setting the slope flags is always done properly. (Why are the flags even needed?)
As a nice side effect, this, plus use of other inlines made the align*slope functions implode into virtually nothing.
2021-12-30 09:53:56 +01:00
Christoph Oelckers
11f41a97d5 - made gotpic a FixedBitArray.
gets rid of some inline garbage.
2021-12-30 09:53:56 +01:00
Christoph Oelckers
5f18109371 - consolidated all getslope code into a single function.
This also caches a wall's length to avoid taking the square root every single time for a slope calculation.
2021-12-30 09:53:55 +01:00
Christoph Oelckers
dddf48fd3e - cleaned up and renamed buildtypes.h.
Content was reordered so that the file can contain the inlines belonging to the map data types that previously had to be stored elsewhere.
Also moved out of the Build folder because virtually everything in here can be traced to content available in Duke Nukem 3D's and Shadow Warrior's source releases.
2021-12-30 09:53:46 +01:00
Christoph Oelckers
4a5de6f56e - make sure that all changes of wall coordinates invalidate associated data.
walltype::move should be the preferred function to be used for this, otherwise walltype::moved needs to be called.
2021-12-30 09:53:11 +01:00
Christoph Oelckers
69593fd5c7 - Triangulation WIP
# Conflicts:
#	source/core/sectorgeometry.cpp
2021-12-30 09:53:07 +01:00
Christoph Oelckers
a255e90c96 - more work on the new section creator. 2021-12-30 09:53:06 +01:00
Christoph Oelckers
504bb08a64 - we do not really need the old rintersect function.
Its only difference is using potentially overflowing 32 bit math for demo compatibility. Aside from that it has no real-life advantage.
2021-12-26 23:10:07 +01:00
Christoph Oelckers
a23d2ae656 - fixed OOB access in pushmove.
The backwards search loop starts at one element behind the data it is supposed to check. If this is the last wall in the map it accesses undefined memory.

This tripped the range check in TArray for wall[].
2021-12-26 23:10:06 +01:00
Christoph Oelckers
d8ccfa1a5f - cleaned up nextsectorneighborz, added a safe variant and use this in all places where the sector pointer is not validated. 2021-12-26 23:10:05 +01:00
Mitchell Richters
1ee1c0c920 Revert "- fixed: updatesectorneighborz may not return -1."
This reverts commit c074b0995648a4057c516e5646f5fe7a11719317.

* The commit notes talk about `updatesectorneighborz()`, but the change is applied to `nextsectorneighborz()`. Further to this, `nextsectorneighborz()` is only called from some ptr wrappers in `build.h` and they both test against `-1` return values.

```
inline sectortype* nextsectorneighborzptr(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction)
{
	auto sect = nextsectorneighborz(sectnum, refz, topbottom, direction);
	return sect == -1? nullptr : &sector[sect];
}

inline sectortype* nextsectorneighborzptr(sectortype* sectp, int32_t refz, int16_t topbottom, int16_t direction)
{
	auto sect = nextsectorneighborz(sector.IndexOf(sectp), refz, topbottom, direction);
	return sect == -1? nullptr : &sector[sect];
}
```

* Also fixes broken Duke elevators and possibly a whole raft of issues.
2021-12-26 23:10:04 +01:00
Christoph Oelckers
8e2d324e85 - fixed: updatesectorneighborz may not return -1.
This value gets never validated by any caller and isn't really what is wanted in this situation.
2021-12-26 23:10:03 +01:00
Christoph Oelckers
b8c4354691 - got rid of the MAX... constants and adjusted all places still using them. 2021-12-26 23:10:02 +01:00
Christoph Oelckers
1a3b9f8ac0 - made several arrays holding sector related data dynamic. 2021-12-26 23:10:02 +01:00
Christoph Oelckers
2a07159c8d - removed some unused and obsolete content from engine files. 2021-12-26 23:10:02 +01:00
Christoph Oelckers
923a2b6a79 - unlimit the number of sectors/walls for real.
All remaining 16 bit values storing indices have been widened to 32 bit.
2021-12-26 23:10:01 +01:00
Christoph Oelckers
838bed7800 - final cleanup of sectnum related stuff.
Made sure that remaining uses of sector indices are safe to be kept and deleted a few redundant functions.
2021-12-26 23:10:01 +01:00
Christoph Oelckers
6d432fca0a - made spritetype::sectnum a pointer. 2021-12-26 23:10:01 +01:00