Commit Graph

474 Commits

Author SHA1 Message Date
Lioncash 97f2576e2a CFBStreamedCompression: Eliminate undefined pointer casting
Some (but not all pointer casting in this file is undefined behavior).
To rectify this, we can make use of a light wrapper around memcpy to
make all of this well-defined.
2020-08-02 03:34:32 -04:00
Lioncash 4b140d8954 CAnimData: Move variable closer to usage spot
Keeps the code localized, and doesn't unnecessarily execute the
constructor until necessary.
2020-08-02 02:20:10 -04:00
Lioncash 4e9b22962c CModelData: Remove usages of const_cast
Allows readers to know that these functions do affect member state.
2020-08-01 23:45:49 -04:00
Lioncash e9084df80b CFBStreamedAnimReaderTotals: Remove redundant memset
We can just make use of make_unique instead, which does it as part of
the interface.
2020-08-01 06:29:21 -04:00
Luke Street ca96676057 Merge remote-tracking branch 'origin/icesheegoth' 2020-06-06 16:27:08 -04:00
Lioncash a0bdb2588f CParticleDatabase: Make use of heterogenous lookup
Resolves a TODO. (Technically this can be done with C++17 only, as
std::map allows heterogenous lookup since that standard).

Reduces number of allocations necessary for lookups.
2020-05-27 06:54:22 -04:00
Lioncash fecfb14f35 CBodyState: Make references const where applicable
The referenced objects aren't modified
2020-05-25 22:21:36 -04:00
Luke Street 6ad1aa79ab Merge branch 'master' into metroid 2020-05-16 23:12:00 -04:00
Lioncash 4b5074b298 RuntimeCommon: Const qualify auto references where source is const
Marks references that would be deduced as const automatically with const
to be explicit to the reader.
2020-05-12 20:32:51 -04:00
Luke Street 9608efc222 CMetroid: Implement KnockBack, TelegraphAttack & more 2020-05-09 18:39:11 -04:00
Luke Street 7759b3f0dc CBodyStateCmdMgr: constexpr CBodyStateCmds 2020-05-09 18:37:34 -04:00
Luke Street e8ce4c2e27 CMetroid: More function implementations 2020-05-09 02:51:02 -04:00
Lioncash 579ae79291 General: Mark CMaterialFilter instances constexpr where applicable
Allows omission of runtime overhead.
2020-05-07 14:14:18 -04:00
Luke Street 973eb622c7 CAnimTreeSequence: Add EpsilonZero check 2020-04-30 02:17:06 -04:00
Luke Street abfd5a464f CGroundMovement: Fix CheckFalling not being called consistently 2020-04-29 02:09:20 -04:00
Phillip Stephens 7b9fecfdc6
CIceSheegoth: Final state implementations 2020-04-24 07:36:49 -07:00
Phillip Stephens b1a897d246
CIceSheegoth: Implement Think 2020-04-22 15:06:15 -07:00
Luke Street 14c92e85ce Use pas::EAnimationState in CPAS* 2020-04-22 05:09:27 -04:00
Lioncash f24559890a TSegIdMap: Make use of std::array where applicable
Stronger typing and eliminates array to pointer decay.
2020-04-22 01:59:29 -04:00
Lioncash fa3e639a9d RuntimeCommon: Make use of bitfield initializers where applicable
Continues and finishes the migration towards initializing all bitfield
members where applicable
2020-04-21 17:16:19 -04:00
Luke Street 24acb585f8 MSVC & zeus fixes; update hecl-gui 2020-04-19 21:09:30 -04:00
Luke Street 56cebfbacd
Merge pull request #308 from AxioDL/fmtlib-update
Update fmtlib
2020-04-12 03:06:46 -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
Jack Andersen 5b4441ac36 Update fmtlib 2020-04-11 12:51:39 -10:00
Luke Street 0fc53c91dc
Merge pull request #303 from lioncash/size
IAnimReader: Make use of size_t for capacity and iterators
2020-04-11 02:12:41 -04:00
Luke Street 304340bd35
Merge pull request #304 from AxioDL/remove-union-bitfields
Runtime: Replace bitfield unions with explicit initializers
2020-04-11 02:12:21 -04:00
Lioncash 0414235e76 CTransitionDatabaseGame: Tidy up GetMetaTrans()
We can leverage auto here to make the lambda functions significantly
less verbose.
2020-04-10 23:51:18 -04:00
Lioncash 72370910ad IAnimReader: Make use of size_t for capacity and iterators
Allows using container sizes and capacities without needing to cast
them, allowing for dehardcoding of array sizes in some scenarios.
2020-04-10 23:24:52 -04:00
Luke Street 4a3ce8453f Runtime/Graphics: Replace bitfield unions with constructor initializers 2020-04-10 15:03:15 -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 db9a52fae3 CBodyState: Resolve sign conversion warnings in GetLocoAnimation() 2020-04-07 12:56:29 -04:00
Lioncash ce710a94f6 CBodyState: Always initialize x3c8_primeTime
Provides a deterministic consistent state upon construction
2020-04-07 12:55:41 -04:00
Lioncash 5fe494f683 CLayoutDescription: Always initialize xc_scale
Provides a total deterministic initial state for the data member.
2020-04-07 12:34:15 -04:00
Lioncash c3ddbfae89 CBodyState: Always initialize x8_jumpType
Provides a deterministic initial state for the member.
2020-04-07 12:32:06 -04:00
Lioncash 56f48e8745 CAdditiveBodyState: Dehardcode array size 2020-04-07 12:31:33 -04:00
Lioncash 2b1a86794b CAdditiveBodyState: Make use of std::array where applicable
Same behavior, stronger typing.
2020-04-07 12:27:47 -04:00
Lioncash 18c0111edb CModelData: Give all function prototype parameters names
Makes the interface more self-documenting and allows IDE introspection
to function better.
2020-04-07 07:13:18 -04:00
Lioncash f0ff83e39a CTransitionDatabase: Add virtual destructor
Prevents any undefined behavior from occurring through polymorphic
usage.
2020-04-07 06:04:58 -04:00
Lioncash 8182688b34 CAnimationDatabase: Add virtual destructor
Given this class is used polymorphically, this is cautionary to prevent
any potential undefined behavior from occurring through refactors over
time.
2020-04-07 06:03:14 -04:00
Lioncash f96ea81d69 CPASDatabase: Resolve sign-conversion warnings
We can leverage size_t here to resolve sign-conversion warnings.

While we're in the same area, we can remove a use of at() for
std::vector, given a bounds check already precedes it.
2020-04-06 13:21:06 -04:00
Lioncash 8dcd6b3109 CBodyState: Make use of HasAnims()
We can replace the usages of GetNumAnims with this now.
2020-04-06 13:17:19 -04:00
Lioncash 891fd05442 CPASAnimState: Add HasAnims()
GetNumAnims() is only used in two places to do existence checking. We
can just provide a dedicated function for this and also have size
querying as well.
2020-04-06 13:15:13 -04:00
Lioncash 6381f021b7 CPASAnimState: Make use of size_t for GetAnimParmData()
Given the rest of the interface now uses size_t, we can convert this
over. While we're at it, we can also take the result of the at() call
inside of it in order to avoid any copies of data altogether.
2020-04-06 13:10:43 -04:00
Lioncash 17c1582ba2 CPASAnimState: Make PickRandomAnimation() private
This isn't used externally anywhere.
2020-04-06 13:06:31 -04:00
Lioncash 0b74a3e995 CPASAnimState: Make use of size_t for indices
Same behavior, but plays nicer with containers.

This can technically result in less zero-extensions with regards to
memory indexing and registers, but this wasn't the underlying reason for the change.
2020-04-06 13:02:22 -04:00
Lioncash 4043b63721 CPASAnimState: Make computation functions private
These are currently only used internally.
2020-04-06 12:56:29 -04:00
Lioncash 0e0ca4caa9 CAnimSource: Eliminate variable shadowing
Gets rid of two -Wshadow warnings.
2020-04-06 07:04:49 -04:00
Lioncash 741adfe45c CPASAnimParm: Make constexpr capable
Allows the type to be used in constexpr scenarios and allows for
compile-time elimination of initializers.
2020-04-06 02:55:05 -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 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 0a7ccace44 CCharacterFactory: Eliminate usages of const_cast within CreateCharacter()
We can simply make this member function non-const and eliminate the need
for casts like this.
2020-04-05 08:11:51 -04:00
Lioncash 852dd5c6bf CParticleGenInfo: Collapse TCastToPtr into conditions
Same behavior, but more compact.
2020-04-05 05:10:28 -04:00
Lioncash 39e8ee9a80 CBodyState: Return 1.0f directly in UpdateLocomotionAnimation()
Same behavior, but less verbose.
2020-04-05 03:24:56 -04:00
Lioncash 71e3fb1817 CBodyState: Eliminate usages of const_cast
This is clearly modifying the command, so we should allow for modifying
of command instances if necessary.
2020-04-05 03:21:33 -04:00
Lioncash 1fb28a03a3 CBodyState: Mark reference parameters as const where applicable
Makes the parameters explicit about whether or not they're modified.
2020-04-05 03:10:35 -04:00
Lioncash 9ddb726155 CBodyState: Make use of const where applicable
Same behavior, but makes read-only intent explicit.
2020-04-05 02:58:22 -04:00
Luke Street ca6b3dd3f6
Merge pull request #294 from lioncash/cseg
CSegStatementSet: Minor changes
2020-04-02 02:32:00 -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 233b2ccbbf CSegStatementSet: Make use of std::array
Same behavior, but without implicit array to pointer decay.
2020-04-01 00:36:50 -04:00
Lioncash c02d5a91b8 CSegStatementSet: Make x4_segData private
Accessors already exist to access the data individually, so we can just
use those instead.
2020-04-01 00:34:12 -04:00
Lioncash 7117e298d9 IVaryingAnimationTimeScale: Add virtual destructor
This is used in a polymorphic context, so we should be specifying a
virtual destructor to prevent undefined behavior when deleting instances
from the base class.
2020-03-31 23:55:15 -04:00
Lioncash 91f75a4c60 IAnimReader: Add missing override specifiers 2020-03-31 06:11:08 -04:00
Lioncash 2f0d774ed8 General: Make use of emplace_back where applicable 2020-03-31 05:33:10 -04:00
Lioncash 7b9018dbf0 CModelData: Initialize m_drawInstCount to zero
Allows for deterministic initial state to make debugging nicer.
2020-03-31 04:53:04 -04:00
Lioncash 1415265ef2 Runtime: Default destructors where applicable
Same behavior, but allows the destructors to be trivial, etc.
2020-03-31 04:50:26 -04:00
Phillip Stephens d167293552
Merge pull request #291 from lioncash/name
IAnimReader: Make use of std::string_view where applicable
2020-03-31 01:20:20 -07: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 2c36b0bb83 IAnimReader: Make use of std::string_view where applicable
Same behavior, but allows interoperating with different string types in
a more straightforward manner.
2020-03-31 03:13:02 -04:00
Lioncash aa8d147350 CAnimTreeDoubleChild: Correct call to VGetBoolPOIState() in VGetInt32POIState()
Like the previous change, it's awfully suspect to be interpreting all
integer values as bools.
2020-03-31 02:43:48 -04:00
Lioncash 03c0a8a5f6 CAnimTreeAnimReaderContainer: Correct call to VGetBoolPOIState() within VGetInt32POIState()
It seems quite suspect to read all integral values as bools.
2020-03-31 02:06:56 -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 4ada5a00cb CElitePirate: Nearly complete implementation 2020-03-29 03:28:14 -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
Lioncash 51afa94e8c Add missing includes where applicable
Resolves a few required dependencies
2020-03-26 01:10:55 -04:00
Luke Street 7ee2a3b912
Merge pull request #254 from AxioDL/flyingpirate
CFlyingPirate implementation
2020-03-25 03:01:10 -04:00
Lioncash a862b792de CBoneTracking: Make use of parameter in SetActive()
GM8E v0 makes use of the parameter and doesn't always set the value to
true.
2020-03-25 02:12:56 -04:00
Lioncash 22036859db CPASDatabase: Add names to parameters in prototypes
Makes IDE introspection better.
2020-03-25 01:43:27 -04:00
Lioncash fad980dc19 CBodyController: Make HasBodyInfo() accept a const reference
This only queries state and doesn't actually modify it.
2020-03-25 01:39:08 -04:00
Lioncash f875bdf024 CBodyController: Add names to parameters in interface
Makes the interface more self-documenting and allows IDEs to perform
better introspection at call sites.
2020-03-25 01:36:54 -04:00
Lioncash cd184daeba CAnimData: Give names to function prototype parameters
Provides at least some form of name for all functions in the interface.
This allows IDEs to perform proper name inspection (as well as being
slightly more informative to the reader in some cases).
2020-03-22 05:42:11 -04:00
Luke Street 851304ded9 CFlyingPirate: Finish Think implementation 2020-03-18 02:53:53 -04:00
Luke Street 932615593e CFlyingPirateRagDoll: Implement PreRender, Prime 2020-03-18 01:20:24 -04:00
Luke Street 26ae8beb74 CFlyingPirate: Small fixes 2020-03-18 01:19:23 -04:00
Luke Street 13d8c3fdd1 CFlyingPirate: First draft almost done 2020-03-18 01:18:48 -04:00
Luke Street fcf7044bf2 Merge remote-tracking branch 'github/recovery' 2020-03-18 00:45:49 -04:00
Lioncash f45e2362c5 CPoseAsTransforms: Make use of std::array where applicable 2020-03-16 16:08:25 -04:00
Lioncash cc6d50a1aa CPoseAsTransforms: Mark constructor as explicit
Prevents potentially error-prone implicit constructions.
2020-03-16 16:05:52 -04:00
Luke Street 79f6dbac73
Merge pull request #228 from lioncash/time
CCharAnimTime: Make constructors constexpr where applicable
2020-03-15 19:46:39 -04:00
Luke Street 76f12c5c38
Merge pull request #227 from lioncash/pair
CAnimSourceReader: Minor cleanup
2020-03-15 19:46:21 -04:00
Luke Street 797c583ed7
Merge pull request #226 from lioncash/clamp
CAnimSource: Simplify ClampZeroToOne()
2020-03-15 19:45:37 -04:00
Lioncash 1926966d21 CCharAnimTime: Make constructors constexpr where applicable
These can be made constexpr to allow use at compile-time, given these
only hold an enum and a floating point value.
2020-03-15 19:41:54 -04:00
Lioncash 15db1b2647 CAnimSourceReader: Make use of std::find_if where applicable 2020-03-15 18:55:30 -04:00
Lioncash 9541ed1919 CAnimSourceReader: Make use of emplace() where applicable
Same behavior, but with less code.
2020-03-15 18:42:19 -04:00
Lioncash 7c1528688b CAnimSource: Simplify ClampZeroToOne()
We can make use of std::clamp instead of std::min and std::max
2020-03-15 18:30:58 -04:00
Phillip Stephens 6567ae8d42
Merge pull request #218 from lioncash/emplace
Runtime: Collapse emplace_back() calls where applicable
2020-03-13 15:30:43 -07:00
Phillip Stephens 75c184d710
CHierarchyPoseBuilder corrections 2020-03-13 15:29:20 -07: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 12ad192436
Merge pull request #204 from lioncash/move
Character/*: std::move constructor parameters where applicable
2020-03-12 15:09:00 -07:00
Luke Street 985daa3092 CCharAnimTime: Re-add algorithm include 2020-03-09 12:21:08 -04:00