Commit Graph

824 Commits

Author SHA1 Message Date
Lioncash 14f6dd2cd8 CFluidUVMotion: Return std::array by value from CalculateFluidTextureOffset()
Same behavior, but allows for easier use of API and makes it harder to
misuse. It also makes it easier for analysis to determine out of bounds,
given we leverage std::array rather than a pointer that causes arrays to
decay and lose their size information.
2020-04-12 09:23:52 -04:00
Lioncash 3c8619ba44 CFluidPlaneManager: Make use of std::array where applicable
Eliminates any potential implicit array to pointer decay.
2020-04-12 09:09:18 -04:00
Lioncash 2069694b59 CFluidPlane: Make use of HasReference() instead of operator bool
Looks a little less out of place while performing the same behavior.
IDE's can also do lookup more reliably on a regular function as opposed
to a conversion operator.
2020-04-12 08:52:23 -04:00
Lioncash aa8f17d847 CFire: Return std::nullopt in GetTouchBounds()
Avoids unnecessarily zeroing out the entire internal buffer in
std::optional in some implementations (libstdc++/libc++).
2020-04-12 08:46:23 -04:00
Luke Street 32134990c3
Merge pull request #309 from lioncash/constexpr8
CMorphBall: Make use of constexpr on file-scope arrays
2020-04-12 03:06:59 -04:00
Luke Street 56cebfbacd
Merge pull request #308 from AxioDL/fmtlib-update
Update fmtlib
2020-04-12 03:06:46 -04:00
Luke Street 9f8064b4a1
Merge pull request #307 from lioncash/constexpr7
CModel: Mark CModelFlag instances as constexpr where applicable
2020-04-12 03:06:12 -04:00
Lioncash 1fff540102 CAnimPlaybackParms: Make class constexpr constructible
Allows for removal of some trivial runtime initializers.
2020-04-11 20:55:46 -04:00
Lioncash fef6711ce8 CMorphBall: Make use of constexpr on file-scope arrays
Same behavior, but allows elision of runtime initializers.
2020-04-11 20:41:52 -04:00
Lioncash 76e226f831 CWorldTransManager: Convert one missed array over to std::array 2020-04-11 19:55:23 -04:00
Lioncash 58fdb64ab5 CWorldTransManager: Initialize all members on construction
Provides a deterministic initial state upon construction, making
debugging easier.
2020-04-11 19:53:30 -04:00
Lioncash e72507b20c CWorldTransManager: Make use of std::array where applicable
Provides stronger typing, and eliminates any potential implicit array to
pointer decay.
2020-04-11 19:50:49 -04:00
Jack Andersen 5b4441ac36 Update fmtlib 2020-04-11 12:51:39 -10:00
Lioncash 75c07677ed CModel: Mark CModelFlag instances as constexpr where applicable
Allows more runtime initializes to potentially be elided.
2020-04-11 16:56:13 -04:00
Lioncash 75d8988ee8 CRandom16: Make constructor explicit
Same behavior, minus the implicit conversions upon construction.
2020-04-11 16:15:05 -04:00
Lioncash 01bb0f3840 CWorld: Separate enum definition from declaration
Allows more flexibility if anything ever gets moved around and is
arguably nicer to read.
2020-04-11 15:29:01 -04:00
Luke Street 072ac0df16 Runtime: Wrap printf calls in #ifndef NDEBUG 2020-04-11 02:35:55 -04:00
Luke Street e23c3d3705 Runtime: Wrap fmt::print calls in #ifndef NDEBUG 2020-04-11 02:25:41 -04:00
Luke Street 22ac7d8099 CScriptCoverPoint: Fix GetAttackDirection return value 2020-04-11 02:09:58 -04:00
Luke Street 0339c16e20 CScriptCoverPoint: Fix GetAttackDirection 2020-04-11 02:02:28 -04:00
Luke Street bb7e94f304 Runtime/World: Replace bitfield unions with constructor initializers 2020-04-11 01:50:10 -04:00
Lioncash f74c2d446f CEnvFxManager: Remove mutable keywords where applicable
We can just make the relevant functions non-const to remove the use of
mutable here.
2020-04-10 13:22:22 -04:00
Lioncash e0a4dc37a4 CPathFindSearch: Remove use of mutable on m_viz
We can just drop the const qualifier on DebugDraw() to get rid of the
need to specify this.
2020-04-09 21:50:01 -04:00
Lioncash 549f58d835 CScriptDamageableTrigger: Remove mutable specifier on x254_fluidPlane
This is no longer necessary now that Render() is non-const.
2020-04-09 21:46:57 -04:00
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