Commit Graph

800 Commits

Author SHA1 Message Date
Lioncash a2f7527388 CScriptPlayerActor: Remove two usages of const_cast
While we're at it, we can also simplify the implementation of
GetPostConstructed().
2020-04-09 20:05:53 -04:00
Lioncash c796cf5315 CScriptSpecialFunction: Remove unnecessary const_cast in AcceptScriptMsg()
This const_cast isn't required at all any more.
2020-04-09 19:55:31 -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
Lioncash 139d290d7d CWorldTransManager: Mark lightPos as constexpr in UpdateLights()
Allows the compiler to optimize the initialization away if it chooses to
do so.
2020-04-07 07:23:14 -04:00
Lioncash 7ba5a5b183 CWorldLight: Explicitly default copy assignment, move assignment and move constructor
Makes the interface consistent with how the constructor is specified.
2020-04-07 07:19:50 -04:00
Lioncash dd7d9c024f CGameLight: Add parameter names to function prototypes
Same behavior, but more self-documenting from interface alone. Also
allows better parameter introspection.
2020-04-06 08:46:38 -04:00
Lioncash 41c2ede092 CScriptWater: Make private const data internally linked
Same behavior, but allows completely hiding it from external view and
also allows making the data constexpr.
2020-04-06 05:42:15 -04:00
Lioncash c9e8b3366d CFluidPlane: Resolve constness related compile errors that slipped through
Gotta love Find References not, in fact, finding all the references.
2020-04-06 05:31:09 -04:00
Lioncash d708337e90 CScriptDamageableTrigger: Make member variables private
Previously, everything about the class was made public.
2020-04-06 04:48:10 -04:00
Lioncash 27f3078c8a CScriptDamageableTrigger: Mark x254_fluidPlane as mutable
A temporary stop-gap to hold over until Render is made non-const.
2020-04-06 04:45:33 -04:00
Lioncash 402216447a CFluidPlane: Make Render() non-const
Allows making the shader instances non-mutable.
2020-04-06 02:18:14 -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
Lioncash ad30f0c61c CActorModelParticles: Make GetParticleDGRPTokens take a std::string_view
Same behavior, but provides a more type-safe interface. All internal
functions called within the function operate on std::string_view
anyways.
2020-04-03 00:36:53 -04:00
Lioncash 75aa359855 CActorModelParticles: Use static_cast instead of reinterpret_cast in PointGenerator()
Casting from void* to a concrete type is permitted with static_cast.
2020-04-03 00:28:14 -04:00
Lioncash a80838b2df CActorModelParticles: Don't cast away const in SetupHook()
Now that we have a non-const overload, we don't need to cast away const
any longer, removing a cast-qual warning.
2020-04-03 00:26:35 -04:00
Lioncash 9ac1a94a5f CActorModelParticles: Add non-const overload of FindSystem()
Same behavior but returns a non-const iterator, which will be used in a
following change.
2020-04-03 00:24:52 -04:00
Lioncash b33fcf9e02 CActorModelParticles: Collapse FindSystem() into a find_if call
Same behavior, less code.
2020-04-03 00:22:37 -04:00
Lioncash c913502d90 CActorModelParticles: Dehardcode container sizes where applicable 2020-04-03 00:08:09 -04:00
Lioncash 93dd28988d CGameArea: Make use of std::make_unique where applicable 2020-04-02 22:02:57 -04:00
Lioncash 333fee56e3 CPlayer: Const correctness and bracing consistency changes
Minor surface-level changes to make it nicer to see that certain
variables don't get modified within some operations.

Given some functions are quite large, this is generally nice to see.
2020-04-02 07:39:00 -04:00
Lioncash e7e73e8658 CPlayer: Make use of std::make_unique for x76c_cameraBob
Same behavior, but more consistent with other usages of
std::make_unique.
2020-04-02 03:48:31 -04:00
Lioncash e956402956 CPlayerEnergyDrain: Collapse loop into std::accumulate
Same behavior, less code.
2020-04-02 03:45:07 -04:00
Luke Street 206be48b43
Merge pull request #292 from lioncash/automap
CAutoMapper: Eliminate usages of const_cast
2020-04-02 02:31:00 -04:00
Luke Street de59ea45eb ScriptLoader: Zero out itemCounts 2020-04-01 21:17:05 -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
Luke Street ffd94d1106 COmegaPirate: Stub 2020-03-31 14:17:47 -04:00
Lioncash 47555c725b CAutoMapper: Eliminate usages of const_cast
Same behavior, but makes it explicit from the interface that
modifications are clearly going on from within the class.
2020-03-31 06:57:07 -04:00
Phillip Stephens 7b0c043721
Merge pull request #288 from lioncash/explicit
Runtime: Add more usages of explicit
2020-03-31 01:19:40 -07: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
Lioncash 260dbaca7d CAnimData: Rename IceModel() to GetIceModel()
Allows const overloading to work and prevents compilation errors from
occuring if the const qualifier on an instance changes over refactoring.
2020-03-31 01:26:00 -04:00
Luke Street 2e3d1c980b CElitePirate: Implement AttractProjectiles; fix CGameProjectile material list 2020-03-30 23:10:51 -04:00
Luke Street 684bbd5903 CElitePirate: Bug fixes, make member variables private, cleanup 2020-03-30 20:40:38 -04:00
Lioncash 3e4731bf7f CWallCrawlerSwarm: Minor tidying changes
- Amends formatting according to clang-format.
- Makes use of const where applicable
- More consistent bracing
2020-03-30 19:05:48 -04:00
Lioncash e5a0959ef0 CWallCrawlerSwarm: Make use of size_t where applicable
Avoids unnecessary upper register clearing.
2020-03-30 19:05:48 -04:00
Lioncash e1273faa68 CWallCrawlerSwarm: Eliminate some sign conversion warnings
Same behavior, less warnings.
2020-03-30 19:05:48 -04:00
Lioncash 7ff3d29794 CWallCrawlerSwarm: Mark static const data as constexpr
Same behavior, but allows elision of initializers. While we're at it, we
can convert an array over to std::array.
2020-03-30 05:44:35 -04:00
Luke Street bc08792523 CBouncyGrenade implementation 2020-03-30 03:05:16 -04:00
Lioncash 312b8f219a CWorld: Dehardcode magic number in CheckWorldComplete()
Same behavior, no magic number.
2020-03-30 00:58:03 -04:00
Lioncash 802ac13812 CWorld: Make use of std::array where applicable 2020-03-30 00:54:38 -04:00
Lioncash 79b1e26052 IGameArea: Amend formatting of EChain
Makes for nicer visual scanning.
2020-03-30 00:47:29 -04:00
Phillip Stephens 0db6f96a17
Merge pull request #279 from lioncash/constexpr
CScannableParameters: Mark CScannableParameters as constexpr
2020-03-27 23:54:26 -07:00
Lioncash 2558da714e Runtime: Remove unnecessary smart pointer .get() calls
Same behavior, less code to read.
2020-03-27 20:50:45 -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 05988ce31c CScannableParameters: Mark CScannableParameters as constexpr
This only contains a single member, so this can trivially be marked
constexpr.
2020-03-27 20:07:33 -04:00
Phillip Stephens e0fe365dfd
Merge pull request #278 from lioncash/explicit
General: Make use of explicit constructors where applicable
2020-03-27 14:10:19 -07: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
Luke Street c33703bd93 CElitePirate: Start impl; create CGrenadeLauncher 2020-03-26 03:30:54 -04:00
Lioncash 74600588fa Add missing includes pt.2
Some missing includes that actually need to be present.
2020-03-26 03:14:03 -04:00