Commit Graph

224 Commits

Author SHA1 Message Date
Lioncash 1bacb69fc2 CPlasmaProjectile: Remove mutable specifier from m_renderObjs
Now that Render() is non-const, this is no longer necessary.
2020-04-09 21:17:20 -04:00
Lioncash 4834720bb0 CGrappleArm: Remove usage of const_cast in RenderXRayModel()
This is no longer necessary.
2020-04-09 20:18:45 -04:00
Lioncash 0c1b47faf8 CProjectileWeapon: Remove usages of const_cast
Now that the base Render() function was made non-const, it's trivial to
apply this to the other classes like CProjectileWeapon.
2020-04-09 20:09:14 -04:00
Lioncash bfd17e4513 CActor: Make Render() a non-const function
A few implementations of Render() contain const-casts nested within its
their call hierarchy to get around the fact that this function is marked
const. We can just make the member function non-const to allow removal
of these casts in follow up changes.
2020-04-09 14:32:20 -04:00
Luke Street 7774bc06ca
Merge pull request #297 from lioncash/render
CActor: Make AddToRenderer() non-const
2020-04-09 10:55:16 -04:00
Luke Street 74bce8458b
Merge pull request #299 from lioncash/const2
CGunWeapon: Eliminate usages of const_cast
2020-04-09 10:46:52 -04:00
Lioncash ad1f56bfda CPowerBeam: Make use of std::array where applicable
Same behavior, stronger typing.

We can also narrow the scope of the array.
2020-04-07 13:57:06 -04:00
Lioncash 5405dad069 CWeaponMgr: Make use of size_t in IncrCount()
Keeps this function consistent with the previous change.
2020-04-07 13:40:14 -04:00
Lioncash 8ba2af9b5a CWeaponMgr: Avoid unnecessary repeated std::map lookups
Avoids trivial redundant std::map indexes by doing the lookup once and
then referring to the looked up object instead of doing repeated
lookups.
2020-04-07 13:38:36 -04:00
Lioncash 2e6bd0f05e CGunWeapon: Eliminate usages of const_cast
Eliminates trivial usages of const_cast by making Draw related functions
non-const. This also allows removing the mutable specifiers from several
shader data members.
2020-04-06 00:52:47 -04:00
Lioncash cabbfcc320 CActor: Make AddToRenderer() non-const
This member function alters instance state in a few implementations, so
it shouldn't be made const.

The state manager parameter also shouldn't be const. Retrieved data
from the post constructed instance is further modified in some
implementations. This removes the constness on this parameter in order
to fix more const_cast usages in a follow-up change.
2020-04-06 00:52:10 -04:00
Lioncash f77fb2089b General: Pass std::nullopt to CAnimData::Render instead of {}
Prevents some implementations (libstdc++ and libc++) from completely zeroing out the underlying
buffer and instead sets a single byte flag.

Eliminates unnecessary memsets.
2020-04-05 08:24:42 -04:00
Phillip Stephens 28853f5ea6
Merge branch 'constexpr5' of https://github.com/lioncash/urde into lioncash-constexpr5 2020-04-05 05:10:42 -07:00
Lioncash b122fd30a8 CGameProjectile: Return std::nullopt in GetTouchBounds()
Same behavior, but doesn't potentially unnecessary zero out the entirety
of the buffer within the optional and only sets a single byte.
2020-04-03 02:07:54 -04:00
Lioncash d47f8c2784 CGameProjectile: Make use of TCastToConstPtr before
Same behavior, but more indiciative of read-only semantics.
2020-04-03 01:58:00 -04:00
Lioncash d240e40a17 CCameraShakeData: Make classes and structs constexpr where applicable
Same behavior, but allows eliminating file-scope initializers needing to
be run on program start.
2020-04-02 21:40:19 -04:00
Lioncash f1e28a1290 CPlasmaBeam: Make use of std::array where applicable
Same behavior, no implicit array to pointer decay.
2020-04-02 21:10:51 -04:00
Lioncash a8594d144b CPlasmaProjectile: Make use of std::array where applicable
Allows dehardcoding array sizes.
2020-04-02 20:55:28 -04:00
Luke Street 1e15e0d1f3 Merge remote-tracking branch 'origin/master' into elitepirate
# Conflicts:
#	Runtime/World/CPatterned.hpp
2020-04-01 15:02:56 -04:00
Lioncash 67f6666ea1 Runtime: Add more usages of explicit
Prevents error-prone implicit conversions where applicable.

This targets the regular RuntimeCommon target this time around.
2020-03-31 03:53:49 -04:00
Luke Street 2e3d1c980b CElitePirate: Implement AttractProjectiles; fix CGameProjectile material list 2020-03-30 23:10:51 -04:00
Lioncash 194cdf145f Runtime: Use nullptr where applicable
Same behavior, but no magic 0 value.

While we're in the same area, we can do minor cosmetic changes.
2020-03-27 20:18:54 -04:00
Lioncash 241a66dc0a General: Make use of explicit constructors where applicable
Gets rid of potential error prone implicitly constructing constructors.
2020-03-27 06:00:17 -04:00
Lioncash 98b9556f3e CProjectileWeapon: Return std::nullopt instead of {} where applicable
Prevents some implementations from zeroing out their internal buffer
unnecessarily (libstdc++ and libc++).
2020-03-25 16:03:09 -04:00
Lioncash 6365f2ee1c CPowerBomb: Return std::nullopt in GetTouchBounds()
Avoids unnecessary zeroing of the internal buffer of std::optional in
some implementations (libstdc++ and libc++).
2020-03-25 15:56:59 -04:00
Luke Street 7ee2a3b912
Merge pull request #254 from AxioDL/flyingpirate
CFlyingPirate implementation
2020-03-25 03:01:10 -04:00
Phillip Stephens dbbf9e33fd
Merge pull request #262 from lioncash/nullopt
CBeamProjectile: Explicitly return std::nullopt in GetTouchBounds()
2020-03-23 23:27:54 -07:00
Lioncash bf590dd855 CBeamProjectile: Explicitly return std::nullopt in GetTouchBounds()
Allows some implementations to completely avoid zeroing out the internal
buffer within the std::optional instance.
2020-03-21 01:46:59 -04:00
Lioncash 5b7e440ff7 CBomb: Make file-scope material filter constexpr
Allows the data to be placed into the read-only segment.
2020-03-21 01:42:46 -04:00
Luke Street 13d8c3fdd1 CFlyingPirate: First draft almost done 2020-03-18 01:18:48 -04:00
Luke Street 11ea9d3aa6 CFlyingPirate: More method implementations 2020-03-18 01:18:48 -04:00
Lioncash fc466ff062 CFlameThrower: Resolve sign-conversion warnings in DoCollisionCheck()
Resolves trivial sign conversion warnings and also makes some variables
const where applicable.
2020-03-17 21:55:24 -04:00
Lioncash 258409bc7d CGrappleArm: Remove const_cast within RenderXRayModel()
Same behavior, but without a cast.
2020-03-16 19:53:04 -04:00
Lioncash 9063b16d36 CGrappleArm: Convert reinterpret_cast to static_cast in PointGenerator()
It's permissible to use static_cast when converting from void* to
another type.
2020-03-16 19:16:46 -04:00
Lioncash 0cbfc6d169 CGrappleArm: Move skDependencyNames into BuildSuitDependencyList()
Same behavior, but narrows the visible scope of the array.
2020-03-16 19:12:55 -04:00
Lioncash d0d6210ccd CGrappleArm: Resolve sign mismatch warnings in loops 2020-03-16 19:11:16 -04:00
Lioncash 097d4a4422 Runtime: Collapse emplace_back() calls where applicable
Same behavior, but with less code.
2020-03-13 17:14:44 -04:00
Phillip Stephens eb38d96d9a
Merge pull request #214 from lioncash/virtual
CGunWeapon: Make destructor virtual
2020-03-12 15:11:02 -07:00
Phillip Stephens 7601888e34
Merge pull request #212 from lioncash/power-color
CPowerBomb: Make kFadeColor internally linked
2020-03-12 15:10:40 -07:00
Phillip Stephens ce5ce35743
Merge pull request #210 from lioncash/bob
CPlayerCameraBob: Minor cleanup
2020-03-12 15:10:19 -07:00
Phillip Stephens 2a2b471671
Merge pull request #209 from lioncash/cast
CPlayerGun: Minor cleanup
2020-03-12 15:10:07 -07:00
Phillip Stephens ac46b898bc
Merge pull request #208 from lioncash/wave
CWaveBuster: Implement GetTouchBounds()
2020-03-12 15:09:57 -07:00
Phillip Stephens 196a545f9a
Merge pull request #207 from lioncash/get
CElectricBeamProjectile: Remove unnecessary get() calls in PreRender()
2020-03-12 15:09:47 -07:00
Lioncash 2c091ac124 CGunWeapon: Make destructor virtual
This class is used as polymorphic type, so the destructor should be
marked as virtual to prevent any potential undefined behavior.

This also more closely matches the GM8E v0 binary itself.
2020-03-12 17:20:45 -04:00
Lioncash ee952b9c99 CPowerBomb: Make kFadeColor internally linked
Hides the name from external view entirely and allows the color instance
to be constexpr.
2020-03-12 10:13:37 -04:00
Lioncash 179d19412b CPlayerCameraBob: Make static non-const member variables private
Prevents accidental modification of the values from occurring in code
that makes use of them. Many of these constants aren't even used outside
of the class itself in the first place.
2020-03-09 20:55:12 -04:00
Lioncash 73f11a6132 CPlayerGun: Make use of std::array where applicable 2020-03-09 16:33:10 -04:00
Lioncash 1838e43078 CPlayerGun: Relocate file-static variables and constants into a single anonymous namespace
Keeps all file-static variables organized together.
2020-03-09 16:15:55 -04:00
Lioncash 3abaccb238 CPlayerGun: Resolve trivial implicit sign conversion warnings 2020-03-09 16:04:13 -04:00
Lioncash 9e5dc627ea CWaveBuster: Implement GetTouchBounds()
Implements GetTouchBounds() according to the implementation within the
GM8E v0 binary.

Fills out the implementation of CWaveBuster a little bit.
2020-03-09 14:51:04 -04:00