Commit Graph

1680 Commits

Author SHA1 Message Date
Phillip Stephens 83c0ad1e72
Merge pull request #114 from lioncash/model
CModel: Implement CModelFlags' operator!= in terms of operator==
2019-10-26 17:51:40 -07:00
Phillip Stephens 5865552d7f
Merge pull request #113 from lioncash/artifact
CArtifactDoll: Minor changes
2019-10-26 17:51:30 -07:00
Lioncash bbdfe3d962 CParticleGenInfo: Provide slightly more full names for parameters where applicable
Makes Intellisense and any function highlighting systems a little more
informative.
2019-10-26 20:37:35 -04:00
Lioncash a82dd4f11f CParticleGenInfo: Name bool parameter for SetParticleEmission
Allows the parameter name to be visible in code completion and
highlighting.
2019-10-26 20:32:44 -04:00
Lioncash 8f28786048 CModel: Implement CModelFlags' operator!= in terms of operator==
Same behavior, less code.
2019-10-26 14:58:38 -04:00
Lioncash c4ad797953 CArtifactDoll: Collapse loop into std::all_of
Same thing, but directly stores to a variable.
2019-10-26 14:57:21 -04:00
Lioncash 7a8edc8d5e CArtifactDoll: Make use of std::array where applicable 2019-10-26 14:57:21 -04:00
Lioncash 26b24d604a CArtifactDoll: Make use of an anonymous namespace
Provides a unified section to place internally linked data.
2019-10-26 14:57:21 -04:00
Lioncash bea9c5bb74 CArtifactDoll: Organize cpp includes 2019-10-26 14:57:17 -04:00
Phillip Stephens 5efd827e99
Merge pull request #115 from lioncash/const
CAnimData: Remove usage of const_cast within Touch()
2019-10-24 22:47:14 -07:00
Phillip Stephens 246e233dce
Cleanup CPathFindArea 2019-10-24 22:44:37 -07:00
Lioncash eae1a1d06d CAnimData: Remove usage of const_cast within Touch()
We can just call the function normally without the need for a
const_cast.
2019-10-23 20:44:19 -04:00
Phillip Stephens 18382e5bb6
Merge pull request #112 from lioncash/emplace
rstl: Return reference to emplaced element in emplace_back()
2019-10-20 18:33:06 -07:00
Lioncash 18f64dac8d rstl: Amend unrelated clang-format discrepancies
Avoids others being hit by these if any changes in the header ever need
to be made in the future.
2019-10-19 02:06:33 -04:00
Lioncash 15e856404d rstl: Return reference to emplaced element in emplace_back()
Follows the behavior of the C++17 variant of emplace_back, which returns
a reference to the emplaced element.

This allows eliminating cases like:

container.emplace_back(some, things, arguments);
container.back().blah();

... // subsequent modifications to the element

given we can just retrieve the reference from the emplace_back call.
2019-10-19 02:05:09 -04:00
Lioncash 26a9ceab60 CGunWeapon: Eliminate const_cast usages in DrawMuzzleFx()
We can just make the temporary variable non-const to eliminate the need
for const_casts.
2019-10-19 01:11:19 -04:00
Lioncash 271ee6d8c3 CGunWeapon: Make use of algorithms where applicable
We can leverage these to also eliminate some hardcoded sizes.
2019-10-19 01:11:05 -04:00
Lioncash c228baf5f7 CGunWeapon: Make use of std::array where applicable
Makes the arrays strongly typed and also allows us to dehardcode some
loop boundary constants.
2019-10-19 01:07:01 -04:00
Lioncash c36e6a85b9 CGunWeapon: Organize cpp includes
Makes the source file consistent with the header.
2019-10-19 00:03:38 -04:00
Phillip Stephens 6a3eba0091
Merge pull request #103 from lioncash/unique
CParticleDataFactory: Use unique_ptr where applicable
2019-10-18 01:01:40 -07:00
Phillip Stephens c63ee167da
Merge pull request #110 from lioncash/override
MkCastTo: Use override where applicable
2019-10-18 01:00:31 -07:00
Lioncash 853df176ed MkCastTo: Use override where applicable
Generates the derived classes with the override specifier to prevent
warnings.
2019-10-17 22:15:25 -04:00
Lioncash 3a0daa3ab9 CLogBookScreen: Use forward declarations where applicable
Allows for avoiding the over exposing of types through the header when
included in other translation units or headers.
2019-10-15 10:25:43 -04:00
Lioncash 5b8f3f6693 CLogBookScreen: Organize cpp includes
Tidies them up to be consistent with its header.
2019-10-15 10:13:30 -04:00
Lioncash 4db0e49851 CLogBookScreen: Invert conditional within UpdateBodyText()
Allows unindenting the contained code by one level.
2019-10-15 10:05:53 -04:00
Lioncash b93f7a4ceb CLogBookScreen: Use std::u16string's append() member instead of operator+
Appends to the existing buffer instead of constructing a superfluous
temporary.
2019-10-15 10:03:54 -04:00
Lioncash d64824d3e5 CLogBookScreen: Make use of std::any_of within IsScanCategoryReady()
Same thing but collapses into a single return.
2019-10-15 10:00:15 -04:00
Lioncash 251a2a7723 CLogBookScreen: Make use of structured bindings where applicable
Allows decomposing long pair names into their constituent elements
2019-10-15 09:57:24 -04:00
Lioncash f21ee0786a CLogBookScreen: Make signed/unsigned/FP conversions explicit
Silences warnings relating to signed/unsigned comparisons and
conversions to floating-point types.
2019-10-15 09:36:10 -04:00
Lioncash 3951a07bfa CLogBookScreen: Dehardcode constants where applicable
We can just query the containers for the iteration value
2019-10-15 09:16:13 -04:00
Lioncash 4b78d51a85 CLogBookScreen: Use emplace_back where applicable
Allows simplifying code and constructing elements in place instead of
copying them (which is what would occur with the defautl move
constructor).
2019-10-15 07:22:01 -04:00
Phillip Stephens 76f90569ca
Merge pull request #108 from lioncash/case
CAutoMapper: Collapse case statements in ProcessMapZoomInput()
2019-10-13 13:12:20 -07:00
Lioncash 040c724a8a CAutoMapper: Collapse case statements in ProcessMapZoomInput()
Same behavior as the game executable, but without the code duplication.
2019-10-12 13:57:01 -04:00
Phillip Stephens 668f8da97d
Merge pull request #106 from lioncash/find
CCollisionPrimitive: Simplify the InitAdd* member functions
2019-10-12 07:29:13 -07:00
Phillip Stephens 6996ebfbec
Merge pull request #105 from lioncash/collision
CCollisionPrimitive: Minor cleanup
2019-10-12 07:29:04 -07:00
Phillip Stephens aa956fff55
Merge pull request #104 from lioncash/cuv
CUVElement: Provide initial value for cv in GetValueUV()
2019-10-12 07:28:54 -07:00
Lioncash 21c1ed2940 CBallCamera: Use bool instead of float for holding boolean value
Using a float is very suspect and also more expensive in terms of
code-gen to access and modify the variable.
2019-10-12 02:25:24 -04:00
Lioncash 5f4aba60e1 CCollisionPrimitive: Simplify the InitAdd* member functions
We can extract the duplicated behavior out into its own member function
and then reuse it in order to deduplicate repeated behavior.

This allows simplifying the member functions in a manner that allows
declaring most of the variables const. The lack of mutable behavior
within these functions makes it much nicer to read.
2019-10-12 00:27:18 -04:00
Lioncash d2a44dbc0b CollidableAABox: Default destructor
Same behavior, but remains consistent with the rest of the codebase.
2019-10-11 22:53:01 -04:00
Lioncash da4a33f01a CCollisionPrimitive: Default virtual destructor
Same behavior, but more consistent with the existing interface, given
a constructor is defaulted.
2019-10-11 22:39:58 -04:00
Lioncash 9cbe8ba885 CCollisionPrimitive: Use using for type aliases where applicable
Same behavior, better readability.
2019-10-11 22:36:57 -04:00
Lioncash af7d8e9095 CUVElement: Provide initial value for cv in GetValueUV()
The game executable itself sets this variable to an initial value of 1
prior to calling cycleFrames' GetValue() member function.
2019-10-11 17:05:26 -04:00
Lioncash 35fb0e4911 CUVElement: Use const where applicable
While we're at it, we can also make conversions to float explicit.
2019-10-11 17:05:23 -04:00
Lioncash 7430b70b73 CParticleDataFactory: Use unique_ptr where applicable
Same behavior, but makes the functions a little safer in terms of memory
management.
2019-10-11 15:16:13 -04:00
Lioncash 8b58cdc268 CIntElement: Add class to handle RTOI int elements
Within the int element handling code, there seems to be a missing
implementation (with the FourCC 'RTOI'), which seems to take two 32-bit
floating point values, multiplies them, then converts the result to a 32-bit
integer.
2019-10-06 08:52:41 -04:00
Phillip Stephens 5f0f3ea45c
More tweak CVars 2019-10-05 07:07:13 -07:00
Lioncash ff940612bc CIntElement: Make use of std::clamp within CIEClamp's overrides
Same behavior, less code.
2019-10-04 19:51:38 -04:00
Lioncash 3407a59ad7 CIntElement: Simplify CIEKeyframeEmitter's GetMaxValue()
We can just use std::max_element here to collapse the loop into an
assignment.
2019-10-04 19:46:36 -04:00
Lioncash af0c2c41e3 CIntElement: Organize cpp includes 2019-10-04 19:38:31 -04:00
Lioncash 83873b580e CIntElement: Join variable declarations with assignments where applicable 2019-10-04 19:38:26 -04:00
Lioncash d4b9124b9f rstl: Allow move constructors and assignment operators to be conditionally noexcept
Makes the constructors and assignment operators for reserved_vector
noexcept, allowing them to play nicely with standard facilities and
avoid needing to copy construct where avoidable.
2019-10-04 01:28:27 -04:00
Lioncash b2d9283b3c rstl: Provide full set of type aliases in reserved_vector
Allows for better integration with standard library facilities and
templates, now that types can be queried.
2019-10-04 00:43:47 -04:00
Lioncash 00a4df5aa6 rstl: Make use of variable templates where applicable
While we're at it, we can use if constexpr on some conditional checks.
2019-10-04 00:20:31 -04:00
Lioncash cbcba6f184 rstl: Organize headers
We can also make includes a little nicer for the compiler by only
including logvisor headers when performing debug builds.
2019-10-04 00:08:46 -04:00
Phillip Stephens b9b9eddd1e
Merge pull request #99 from lioncash/typo
CElementGen: Correct FourCC in SetTranslation()
2019-10-03 07:01:31 -07:00
Lioncash 66b198d1a4 CElementGen: Correct FourCC in SetTranslation()
The game executable checks for a FourCC of ELSC within this function,
not SELC.
2019-10-03 09:45:26 -04:00
Lioncash 67cd0d44c6 CAtomicBeta: Make skBombLocators an internal array
Like with CAtomicAlpha, we can also fully hide this array from external
view by making it internally linked.
2019-10-03 01:34:45 -04:00
Lioncash abe8b9510b CAtomicBeta: Organize cpp includes 2019-10-03 01:30:04 -04:00
Lioncash e0e38b569e CAtomicAlpha: Remove .data() call in SBomb constructor
We can just use the std::string_view constructor for std::string, which
eliminates an unnecessary strlen call.
2019-10-03 01:26:50 -04:00
Lioncash 18eb2b73b1 CAtomicAlpha: Use emplace_back where applicable
Simplifies the construction of the SBomb instances, while also
constructing in place.
2019-10-03 01:26:50 -04:00
Lioncash c882003d37 CAtomicAlpha: Make skBombLocators an internal array
This is only used within the cpp file, so we can relocate its definition
there to make it fully internally-linked.
2019-10-03 01:26:50 -04:00
Lioncash ee791d6a37 CAtomicAlpha: Organize cpp includes 2019-10-03 01:26:42 -04:00
Lioncash 44306ab528 CAutoMapper: Eliminate cases of variable shadowing
Silences two variable shadowing warnings.
2019-10-01 22:43:23 -04:00
Lioncash 3383e65761 CAutoMapper: Use size_t instead of u32 as loop variable type where applicable
Uses the same sized type as the .size() call to prevent potential
overflow false-positives.
2019-10-01 22:40:13 -04:00
Lioncash eca34bede5 CAutoMapper: Use emplace_back where applicable
Allows for in-place construction.
2019-10-01 22:37:52 -04:00
Lioncash 23ca919c18 CAutoMapper: Use std::array where applicable 2019-10-01 22:31:07 -04:00
Lioncash a5d18002be CAutoMapper: Organize cpp includes 2019-10-01 22:12:15 -04:00
Phillip Stephens b38ba6b636
Revert static_cast in MkCastTo.py 2019-10-01 07:27:20 -07:00
Phillip Stephens df9b8bc05d
Merge pull request #90 from lioncash/noexcept
RetroTypes: Make functions noexcept where applicable
2019-10-01 06:44:39 -07:00
Phillip Stephens 60ecede3fd
Merge pull request #91 from lioncash/string
CAudioSys: Minor cleanup
2019-10-01 06:44:26 -07:00
Phillip Stephens be2da2f363
Merge pull request #92 from lioncash/fwd
ICollisionFilter: Use forward declarations where applicable
2019-10-01 06:44:08 -07:00
Phillip Stephens 7d2ad7b1b2
Merge pull request #93 from lioncash/loop
CSlideShow: Use ranged for loops in constructor
2019-10-01 06:43:56 -07:00
Phillip Stephens 6bcdf98eeb
Merge pull request #94 from lioncash/default
CIOWin: Default the virtual destructor
2019-10-01 06:43:45 -07:00
Phillip Stephens 4d94923a23
Merge pull request #95 from lioncash/gen
MkCastTo: Use '_v' variants of type traits where applicable
2019-10-01 06:43:33 -07:00
Phillip Stephens d2e9495686
Merge pull request #96 from lioncash/array2
CFinalInput, ControlMapper: Use std::array where applicable
2019-10-01 06:43:23 -07:00
Phillip Stephens d5277b4d91
Remove invalid include 2019-10-01 06:41:55 -07:00
Jack Andersen e1d46755a3 Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/urde 2019-09-30 21:41:42 -10:00
Jack Andersen 16ca0d24c2 Explicit Asset ID refactor 2019-09-30 21:38:03 -10:00
Lioncash f0186e7ceb ControlMapper: Use std::array where applicable 2019-10-01 02:11:02 -04:00
Lioncash dc565969e6 CFinalInput: Use std::array where applicable
Allows simplifying copies and gets rid of hardcoded size values.
2019-10-01 01:59:56 -04:00
Lioncash 91bdfa86f6 MkCastTo: Use static_cast instead of reinterpret_cast
If the type is convertible to the other one, then a static_cast will be
able to perform the conversion (assuming the type itself is
constructible). If it isn't, then nullptr will just be converted to a
null version of T*.
2019-09-30 22:22:12 -04:00
Lioncash bf65456a2c MkCastTo: Use '_v' variants of type traits where applicable
Same thing, but less typing, slightly shrinking the file size.
2019-09-30 22:15:53 -04:00
Lioncash 99a7e64a8a CIOWin: Default the virtual destructor
No functional change. Just maintains consistency with the rest of the
codebase.
2019-09-30 18:20:11 -04:00
Lioncash 2eb5e7c446 CSlideShow: Use emplace_back where applicable
Same behavior, but constructs in place instead of potentially copying.
2019-09-30 18:07:34 -04:00
Lioncash b7e0dbd354 CSlideShow: Use ranged for loops in constructor
Same behavior, but without hard-coded magic size values.
2019-09-30 18:06:33 -04:00
Lioncash 4442421586 ICollisionFilter: Use forward declarations where applicable
With the headers all normalized, we can safely convert the only
ICollisionFilter include into a forward declaration.
2019-09-30 17:20:59 -04:00
Lioncash 9af64d3895 CAudioSys: Convert file-scope std::string into a constexpr string_view.
Eliminates a static constructor that needs to run at program start.
2019-09-30 11:03:47 -04:00
Lioncash dea89e7664 CAudioSys: Remove construction of pairs in emplace calls
The purpose of emplace is to construct the pair within the map. While
using make_pair will result in the same behavior, it's a tad more
verbose than it needs to be.
2019-09-30 11:00:49 -04:00
Lioncash f1d08c4fbf CAudioSys: Place file-scope locals within an anonymous namespace
Prevents any potential violations of the ODR from occuring.
2019-09-30 10:59:31 -04:00
Lioncash c77153b03c RetroTypes: Make SObjectTag's operator bool explicit
Prevents potentially error-prone implicit conversions to bool.
2019-09-30 09:00:17 -04:00
Lioncash 8176bf75ef RetroTypes: Make functions noexcept where applicable
Given these are used quite frequently, it's better to explicitly mark
these as noexcept so that they may be used within noexcept contexts.
2019-09-30 08:58:34 -04:00
Lioncash c17b268c57 IVParamObj: Make default constructor of CVParamTransfer constexpr
std::shared_ptr's default constructor is constexpr, so we can apply it
to CVParamTransfer to allow using it within constexpr contexts, granting
more flexibility to the type.
2019-09-30 02:56:00 -04:00
Lioncash cdf6361d6c IVParamObj: Make rest of interface noexcept where applicable
Allows a few of these member functions to be used within noexcept
contexts.
2019-09-30 02:55:39 -04:00
Lioncash 026de44611 IVParamObj: Explicitly supply copy and move constructor/assingnment operators
Since the copy constructor is provided, we should explicitly specify the
others to make behavior explicit (and prevent the copy constructor from
being considered over the move constructor in certain scenarios).
2019-09-30 02:55:25 -04:00
Lioncash 541adb02d2 CToken: std::move buildParams within CObjectReference's constructor
CVParamTransfer contains a std::shared_ptr, so a copy here performs an
unnecessary reference count increment and decrement. We can std::move
here to avoid this.
2019-09-30 02:34:10 -04:00
Lioncash 2014650d58 CToken: Mark CToken's move constructor noexcept
The move constructor doesn't perform any behavior that would result in
an exception being thrown. Marking it as noexcept allows the type to
play nicely with facilities that make use of std::is_move_constructible
to determine whether copies can be avoided or not in certain
circumstances (e.g. the standard library; notably, std::vector).

We can't mark the move assignment operator as noexcept currently,
however, as it calls into interfaces outside of CToken.
2019-09-30 02:32:29 -04:00
Phillip Stephens 79ac5d76df
Update hecl, more CVar imps 2019-09-29 08:17:55 -07:00
Lioncash 6ad5de497f CSeedling: Make skNeedleLocators an array of std::string_view
Makes the strings non-allocating. This also eliminates 12 runtime static
constructors that need to execute on program start.
2019-09-28 20:22:31 -04:00
Lioncash 3f743d5c9f CSeedling: Use std::array with skNeedleLocators
Makes the array strongly-typed and impervious to implicit array to
pointer decay.
2019-09-28 20:21:24 -04:00
Lioncash 2a34b6be68 CSeedling: Move skNeedleLocators into the cpp file
This can be entirely hidden from external view, making it an
implementation detail.
2019-09-28 20:15:39 -04:00