Commit Graph

2289 Commits

Author SHA1 Message Date
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 ab6c45c7a8 CWorld: Provide parameter names for prototypes
More self-documenting from the interface alone and allows IDE
inspections at callsites to be better.
2020-03-25 01:27:56 -04:00
Lioncash 985b85d9db CAudioGroupSet: Eliminate undefined behavior within LoadData()
Eliminates aliasing violations.
2020-03-25 01:14:27 -04:00
Lioncash 855fc0ced9 CAreaOctTree: Add names to parameters in prototypes
Allows IDEs to perform better inspections at call sites.
2020-03-25 00:45:33 -04:00
Lioncash f2b1e44ee1 CEntity: Rename ConnectionList() to GetConnectionList()
Allows const overloading to function, preventing compilation errors from
occuring across constness changes.
2020-03-24 21:29:44 -04:00
Lioncash 8644b8393b CEntity: Add parameter names to interface
Allows IDEs to perform better parameter inspection.
2020-03-24 21:28:15 -04:00
Lioncash f323638fb7 CCollisionActor: Provide parameter names in interface where applicable
Makes the interface more self-documenting at a glance and allows IDEs to
do better parameter inspection at call sites.
2020-03-24 21:16:30 -04:00
Phillip Stephens e8f0d29a3b
Merge pull request #275 from lioncash/const-over
CPlayerState: Rename HealthInfo() to GetHealthInfo()
2020-03-24 17:45:59 -07:00
Phillip Stephens 01a0c68db9
Merge pull request #274 from lioncash/health
CGameState: Set HP value in LoadGameFileState()
2020-03-24 17:45:43 -07:00
Phillip Stephens c72f388929
Merge pull request #273 from lioncash/team-uninit
CTeamAiMgr: Initialize x90_timeSinceMelee and x90_timeSinceRanged to 0.0f in constructor
2020-03-24 17:45:29 -07:00
Phillip Stephens 9aece39445
Merge pull request #272 from lioncash/uninit
CFluidPlane: Always initialize mul to 0.0f in CalculateRippleIntensity()
2020-03-24 17:45:15 -07:00
Lioncash ef93a601eb CPlayerState: Rename HealthInfo() to GetHealthInfo()
Allows const overloading to function and prevents compilation errors
from occurring if constness changes through future changes of any sort.
2020-03-24 06:20:37 -04:00
Lioncash 9fba0bf50b CGameState: Set HP value in LoadGameFileState()
GM8E v0 stores the HP value of the loaded player state into the returned
GameFileStateInfo instance.

This prevents the health member from being returned uninitialized.
2020-03-24 06:14:26 -04:00
Lioncash 64d0563872 CTeamAiMgr: Initialize x90_timeSinceMelee and x90_timeSinceRanged to 0.0f in constructor
Makes all class members have a deterministic initial state.
2020-03-24 05:19:05 -04:00
Lioncash f416a814a1 CFluidPlane: Always initialize mul to 0.0f in CalculateRippleIntensity()
Avoids a -Wmaybe-uninitialized warning.
2020-03-24 05:14:01 -04:00
Lioncash 35ea097028 CPlayer: Add parameter names to prototypes
Makes them more self-documenting from the interface alone and also
allows IDEs to perform better parameter and argument inspection.
2020-03-24 04:33:54 -04:00
Phillip Stephens fc87bd8022
Merge pull request #270 from lioncash/brace
CPlayer: Un-nest code within FinishNewScan()
2020-03-23 23:29:59 -07:00
Phillip Stephens af2738c7b1
Merge pull request #269 from lioncash/sconv
CParticleSwoosh: Resolve sign-conversion warnings
2020-03-23 23:29:44 -07:00
Phillip Stephens 00691c1175
Merge pull request #268 from lioncash/intconst
CIntElement: Remove const_cast
2020-03-23 23:29:26 -07:00
Phillip Stephens d62c163086
Merge pull request #267 from lioncash/iface
CAnimData: Give names to function prototype parameters
2020-03-23 23:29:12 -07:00
Phillip Stephens bb9359c579
Merge pull request #266 from lioncash/make
CParticleElectric: Use std::make_unique where applicable
2020-03-23 23:28:59 -07:00
Phillip Stephens 498df6588b
Merge pull request #265 from lioncash/type
RetroTypes: Minor adjustments
2020-03-23 23:28:38 -07:00
Phillip Stephens 734f1d2db5
Merge pull request #264 from lioncash/move
General: Remove unnecessary std::move calls
2020-03-23 23:28:24 -07:00
Phillip Stephens 425f8d4cc8
Merge pull request #263 from lioncash/array3
CDecal: Make use of std::array where applicable
2020-03-23 23:28:08 -07: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
Phillip Stephens 1c841d10f8
Merge pull request #261 from lioncash/const7
CBomb: Make file-scope material filter constexpr
2020-03-23 23:27:39 -07:00
Phillip Stephens dc6954491b
Merge pull request #260 from lioncash/array2
CPlayerState: Make g_typeNameMap a compile-time array
2020-03-23 23:27:19 -07:00
Phillip Stephens 4dc73e56a0
Merge pull request #259 from lioncash/default
CPlayerState: Default CPowerUp constructor and also remove undefined behavior
2020-03-23 23:27:06 -07:00
Phillip Stephens 2e43266714
Merge pull request #258 from lioncash/emplaced
General: Make use of emplace_back where applicable
2020-03-23 23:26:51 -07:00
Phillip Stephens 6c7fdc11a0
Merge pull request #257 from lioncash/virt
CWorld: Rename IMapWorld to IGetMapWorld()
2020-03-23 23:26:35 -07:00
Phillip Stephens 6c9d6bc38b
Merge pull request #256 from lioncash/binding
CActorContraption: Make use of structured bindings where applicable
2020-03-23 23:26:19 -07:00
Lioncash 70c51c3a86 CPlayer: Un-nest code within FinishNewScan()
Makes this function much nicer to read.
2020-03-23 02:44:44 -04:00
Lioncash 7a29f4bf52 CParticleSwoosh: Resolve sign-conversion warnings
Resolves trivial warnings within loop condition checks.
2020-03-23 00:38:23 -04:00
Lioncash a2517a504e CIntElement: Remove const_cast
CIESampleAndHold caches values internally for use later in a non-visible
manner to the user of the class. This is a good place for mutable to be
used.

This improves the readability of the GetValue() implementation.
2020-03-22 06:05:59 -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
Lioncash 34a0e9f23d CParticleElectric: Use std::make_unique where applicable
Makes it obvious that std::unique_ptr instances are being created within the
implementation code.
2020-03-22 05:27:49 -04:00
Lioncash 8cd27ac822 RetroTypes: Take types in comparisons by value where applicable
CAssetId, TEditorId, and TUniqueId are all small enough to fit within
registers as is, so we can take these types by value, which allows for
eliminating unnecessary memory referencing.
2020-03-22 04:44:45 -04:00
Lioncash 6ed2415f6f RetroTypes: Mark return types as [[nodiscard]] where applicable
Given the types within this header are quite widely used within the
codebase, it's worth it in this scenario to annotate functions that
expect their return value to be used with the [[nodiscard]] attribute.
2020-03-22 04:43:26 -04:00
Lioncash 0e54861455 General: Remove unnecessary std::move calls
There's no real need to std::move a primitive type. A copy will be
performed either way. We can remove std::move in this case to improve
readability.
2020-03-22 00:56:04 -04:00
Lioncash 2b4b7c36a5 CDecal: Make use of std::array where applicable
Same behavior, but with stronger-typing and no implicit array to pointer
decay.
2020-03-21 01:53:41 -04: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
Lioncash 83c9af9153 CPlayerState: Make g_typeNameMap a compile-time array
While useful as a map, this causes an allocation that occurs during
program start and lasts until the program terminates, even if the
relevant code is never executed.

Given the total number of elements is quite small, we can convert this
into a compile-time array and perform the lookup with that instead.
While we're at it, we can eliminate an unnecessary second lookup into
said array by reusing the iterator from the first find.
2020-03-21 00:57:05 -04:00
Lioncash ff703b1189 CPlayerState: Remove undefined behavior within CPlayerState constructor
Type-punning via a union is currently undefined behavior according to
the C++ standard, so we can use std::memcpy instead to accomplish the
same thing.
2020-03-21 00:39:40 -04:00
Lioncash ba6f55a928 CPlayerState: Default CPowerUp constructor
Same behavior but allows the constructor to be considered trivial.

While we're at it, we can make the constructors constexpr, considering
the data structure only holds two primitives.
2020-03-21 00:34:16 -04:00
Lioncash fc4df76afc General: Make use of emplace_back where applicable
Allows for in-place construction. Also results in less code to read in
certain usages.
2020-03-21 00:30:12 -04:00
Lioncash 8a9e76a345 CWorld: Rename IMapWorld to IGetMapWorld()
Allows const overloading to function properly and prevents potential
compilation errors from occurring if constness on functions is ever
changed.
2020-03-20 23:27:07 -04:00
Lioncash 0cc8e76d64 CActorContraption: Make use of structured bindings where applicable
Same behavior, but with better names than `first` or `second`.
2020-03-20 23:13:29 -04:00
Luke Street 6d757f021f CFlyingPirateRagDoll: Implement Update 2020-03-18 04:50:41 -04:00
Luke Street 851304ded9 CFlyingPirate: Finish Think implementation 2020-03-18 02:53:53 -04:00
Luke Street 642bf379ce CFlyingPirate: Add CPathFindSearch flags 2020-03-18 01:39:32 -04:00
Luke Street 6f89dbb240 CFlyingPirate: More small fixes 2020-03-18 01:20:24 -04:00
Luke Street 932615593e CFlyingPirateRagDoll: Implement PreRender, Prime 2020-03-18 01:20:24 -04:00
Luke Street 57386e6269 CFlyingPirate: Small fixes 2020-03-18 01:19:23 -04:00
Luke Street 8897d38c6a CFlyingPirate: Fix Lurk state delay 2020-03-18 01:19:23 -04:00
Luke Street 651e28e921 CFlyingPirate: Fix TargetPatrol 2020-03-18 01:19:23 -04:00
Luke Street 26ae8beb74 CFlyingPirate: Small fixes 2020-03-18 01:19:23 -04:00
Luke Street 1bcd0916ca CFlyingPirate: Fixes; implement all functions 2020-03-18 01:18:48 -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
Luke Street d4982270e8 CFlyingPirate: Start implementing methods 2020-03-18 01:18:48 -04:00
Luke Street 5765fd8951 CFlyingPirate: Method definitions & CFlyingPirateRagDoll constructor 2020-03-18 01:18:48 -04:00
Luke Street e925dc2628 CFlyingPirate: Start implementation 2020-03-18 01:18:48 -04:00
Luke Street 36ac0a8d78 CStateManager: Fix CMapWorld const reference 2020-03-18 01:18:00 -04:00
Luke Street 9e05819f05
Merge pull request #253 from lioncash/const4
CRelayTracker: Make HasRelay() a const member function
2020-03-18 01:09:31 -04:00
Luke Street f6e2f196ce
Merge pull request #252 from lioncash/resize2
CRumbleVoice: Resize vectors within constructor initializer list
2020-03-18 01:09:09 -04:00
Luke Street 92c9ec02e5
Merge pull request #251 from lioncash/rumble
CInputGenerator: Make use of std::array where applicable
2020-03-18 01:08:12 -04:00
Luke Street dcf96e9826
Merge pull request #250 from lioncash/statemgr
CStateManager: Make use of std::array where applicable
2020-03-18 01:07:21 -04:00
Luke Street 93be0fbc72
Merge pull request #249 from lioncash/list
CObjectList: Make use of std::array where applicable
2020-03-18 01:05:42 -04:00
Luke Street 44325a5ad4
Merge pull request #248 from lioncash/slider
CGuiSliderGroup: Make use of std::array where applicable
2020-03-18 01:05:30 -04:00
Luke Street a7b2ad15dc
Merge pull request #247 from lioncash/sign-mismatch
CFlameThrower: Resolve sign-conversion warnings in DoCollisionCheck()
2020-03-18 01:05:16 -04:00
Luke Street 66c321d4a8
Merge pull request #246 from lioncash/def
CCollisionInfoList: Simplify definition of begin() and end()
2020-03-18 01:04:19 -04:00
Luke Street b13a6b491b
Merge pull request #245 from lioncash/drawstring
CDrawStringOptions: Resize vector within constructor
2020-03-18 01:04:08 -04:00
Luke Street 7c8de88fd7
Merge pull request #244 from lioncash/pane
CAui*: Make use of std::array where applicable
2020-03-18 01:03:50 -04:00
Lioncash cb4884fcef CRelayTracker: Make HasRelay() a const member function
While we're at it, we can make use of HasRelay() internally where
applicable to simplify code a little bit.
2020-03-18 01:03:35 -04:00
Luke Street dcc7affb8f
Merge pull request #243 from lioncash/light
CLight: Minor cleanup
2020-03-18 01:03:04 -04:00
Luke Street b3b8c33006
Merge pull request #242 from lioncash/const2
CMapWorld: Minor changes
2020-03-18 01:01:45 -04:00
Luke Street cecac3472a
Merge pull request #241 from lioncash/float
CMapArea: Minor changes
2020-03-18 01:00:20 -04:00
Luke Street a1c8867e83
Merge pull request #240 from lioncash/move
CMainFlow: std::move shared_ptr in SetGameState
2020-03-18 00:59:24 -04:00
Luke Street 18ef68df2a
Merge pull request #239 from lioncash/line
CLineRenderer: Minor changes
2020-03-18 00:58:46 -04:00
Luke Street dc0c721af7
Merge pull request #238 from lioncash/array2
CFogVolumeFilter: Make use of std::array where applicable
2020-03-18 00:58:28 -04:00
Luke Street fcf7044bf2 Merge remote-tracking branch 'github/recovery' 2020-03-18 00:45:49 -04:00
Lioncash 488e377374 CRumbleVoice: Collapse repeated std::max calls in GetIntensity()
We can make use of the std::max overload that takes an initializer list.
2020-03-18 00:34:29 -04:00
Lioncash 71399d0944 CRumbleVoice: Correct bool->s16 conversion
Given the return type of the function is an s16, we can just use 0
directly here.
2020-03-18 00:32:51 -04:00
Lioncash 2701f060ee CRumbleVoice: Resize vectors within constructor initializer list
Same behavior, but constructs in place with the size, rather than
constructing and then resizing.

x20_handleIds cannot be done the same way unfortunately, as
reserved_vector doesn't have a constructor accepting a size argument
like std::vector does.
2020-03-18 00:28:44 -04:00
Lioncash e83d5caea6 CInputGenerator: Make use of std::array where applicable
Allows removing hardcoded array sizes.
2020-03-17 23:29:11 -04:00
Lioncash bf11be46ad CStateManager: Make use of std::array where applicable
Same behavior, but allows dehardcoding array sizes and makes the array
types more strongly typed.
2020-03-17 23:10:41 -04:00
Lioncash 9e6f86cb16 CObjectList: Make use of std::array where applicable
Same behavior, but with stronger typing.
2020-03-17 22:38:21 -04:00
Lioncash 9d5857e139 CGuiSliderGroup: Make use of std::array where applicable
Same behavior, stronger typing.
2020-03-17 22:22:06 -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 457c116275 CCollisionInfoList: Simplify definition of begin() and end()
Same behavior, but without a verbose return type.
2020-03-17 21:41:54 -04:00
Lioncash 1d6354ba26 CDrawStringOptions: Resize vector within constructor
Same behavior, but constructs the vector with the necessary size, rather
than constructing and resizing after the fact.
2020-03-17 21:35:08 -04:00
Lioncash fa6006003d CAuiEnergyBarT01: Make use of std::array where applicable
Same behavior, but allows dehardcoding array sizes.
2020-03-17 21:26:57 -04:00
Lioncash e534f00706 CAuiEnergyBarT01: Convert typedef into using alias
Same behavior, but nicer to read.
2020-03-17 21:24:01 -04:00
Lioncash 15e4d4aa01 CAuiImagePane: Make use of std::array where applicable
Same behavior, stronger typing.
2020-03-17 21:22:17 -04:00
Lioncash ec7bca8c20 CLight: Collapse std::max calls into one
We can use the overload that takes an initializer list to make it easier
to read.
2020-03-17 20:54:56 -04:00
Lioncash e821f736de CLight: Mark caching member variables as mutable
Member variables acting as caches is one of the areas where marking
variables as mutable makes sense.

We can do this to allow for the elimination of const_cast in some member
functions.
2020-03-17 20:47:12 -04:00
Lioncash 9483b64c91 CLight: Mark kDefaultPosition and kDefaultDirection as constexpr
Same behavior, but allows runtime constructors to be elided.
2020-03-17 20:44:22 -04:00
Lioncash 17a1f90a89 CLight: Prevent implicit double->float truncations
We can just mark these literals as floats to keep the arithmetic
operating on floats instead of doubles.
2020-03-17 20:42:39 -04:00
Lioncash 1dd1542106 CLight: Remove unnecessary initializer list initializers
These are already initialized within the class definition, so they don't
need to be respecified here.
2020-03-17 20:39:29 -04:00
Lioncash 6077814a0e CMapWorld: Provide parameter names in header for functions
Makes it more self-documenting from the interface alone and also allows
IDE inspections to be more convenient.
2020-03-17 20:12:32 -04:00
Lioncash 1fa74087fc CMapWorld: Remove usages of const_cast
Internals of this class are definitely being modified through some of
these calls, so they should be made non-const. This allows the
modifications to have their const_cast calls removed, making the code a
little nicer to read.
2020-03-17 20:00:14 -04:00
Lioncash 03f7047549 CMapArea: Make use of std::array where applicable 2020-03-17 19:36:19 -04:00
Lioncash 62682fe19f CMapArea: Resolve variable name shadowing 2020-03-17 19:22:13 -04:00
Lioncash b570168359 CMapArea: Remove type-punning undefined behavior within PostConstruct()
Casting up from unsigned char or char to an unrelated type isn't
permitted by the C++ standard in the manner it's currently being done.

We can utilize std::memcpy to mitigate this.
2020-03-17 19:20:37 -04:00
Lioncash b52e8dc6aa CMainFlow: std::move shared_ptr in SetGameState
Same behavior, but without a redundant atomic reference count
increment/decrement.
2020-03-17 19:15:09 -04:00
Lioncash e5e4a6482c CLineRenderer: Make use of std::array where applicable
Same behavior, but without the potential for unintentional array to
pointer decay.
2020-03-17 19:07:27 -04:00
Lioncash 858162e0c1 CLineRenderer: Remove unnecessary casts to bool
These constructs function identically without the need for casting.
2020-03-17 19:04:01 -04:00
Lioncash b1e5bf72b6 CFogVolumeFilter: Make use of std::array where applicable
Makes data strongly typed and also allows for the removal of some
hardcoded array sizes.
2020-03-17 18:52:47 -04:00
Luke Street 6ddbd15cfc
Merge pull request #237 from lioncash/state
CStateManager: Casting-related cleanups
2020-03-16 20:19:31 -04:00
Luke Street 488614563e
Merge pull request #236 from lioncash/sign
CGrappleArm: Minor changes
2020-03-16 20:18:31 -04:00
Lioncash 179f0b5f08 CStateManager: Remove instances of const_cast where applicable
Eliminates trivial casts that don't require much modifications to other
existing interfaces.
2020-03-16 20:16:15 -04:00
Luke Street 87eeafe0b0 CSnakeWeedSwarm: Renaming & cleanup 2020-03-16 20:15:22 -04:00
Lioncash 58b112dbe6 CStateManager: Convert reinterpret_cast instances over to static_cast
Conversions from void* can be done with static_cast.
2020-03-16 20:05:41 -04:00
Lioncash 0ae2364b24 CStateManager: Remove unnecessary casts 2020-03-16 20:01:57 -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
Luke Street dc77fb0c41
Merge pull request #234 from lioncash/puddle
CPuddleSpore: Make static const class data internally linked
2020-03-16 19:11:04 -04:00
Lioncash ff8e4c18a1 CPuffer: Make use of std::array where applicable
Allows direct size querying, which allows removing the use of direct
hardcoded array sizes.
2020-03-16 16:37:40 -04:00
Lioncash 2ae02eefb0 CPuddleSpore: Make static const class data internally linked
Makes the data an implementation detail and also allows for the
string_view array to be declared constexpr.
2020-03-16 16:26:19 -04:00
Luke Street 7039232a95
Merge pull request #233 from lioncash/pos
CPoseAsTransforms: Make use of std::array where applicable
2020-03-16 16:14:40 -04:00
Luke Street 4a64d92433
Merge pull request #232 from lioncash/blur2
CPhazonSuitFilter: Convert define into local variable
2020-03-16 16:14:25 -04:00
Luke Street 2f7e2dd85e
Merge pull request #231 from lioncash/blur
CPauseScreenBlur: Remove const_cast in Draw()
2020-03-16 16:14:03 -04:00
Luke Street 6ea64becb4
Merge pull request #230 from lioncash/pause2
CPauseScreenBase: Minor cleanup
2020-03-16 16:13:42 -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
Lioncash b9be092635 CPauseScreenBlur: Remove const_cast in Draw()
Draw() clearly modifies the internals of the class in a non-caching
manner, so this member function should really not have a const qualifier
on it.
2020-03-16 16:00:12 -04:00
Lioncash bb075d51ed CPhazonSuitFilter: Convert define into local variable
Same behavior, but with a more localized scope.
2020-03-16 15:57:21 -04:00
Phillip Stephens 574fc9b840
CJellyZap fixes 2020-03-15 19:00:52 -07:00
Lioncash 1a7ad1a7f6 CPauseScreenBase: Make use of std::array in GetImagePaneName()
We can make use of std::array here and also make the array constexpr.
This can also be moved into the function in order to hide its scope.
2020-03-15 21:26:59 -04:00
Lioncash 6e921e3258 CPauseScreenBase: Mark colors as constexpr within UpdateSideTable()
Same behavior, but allows eliding construction at runtime.
2020-03-15 21:26:47 -04:00
Lioncash a9082bc445 CCollisionActor: Mark gkDefaultCollisionActorMaterials as constexpr
While we're at it, change the g to s, since it's internally linked.
2020-03-15 20:04:15 -04:00
Luke Street eeb09f512d
Merge pull request #220 from lioncash/array
CHud*: Make use of std::array where applicable
2020-03-15 19:56:33 -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
Luke Street 70c60ecf2f
Merge pull request #225 from lioncash/bool
CArchitectureQueue: Make operator bool explicit
2020-03-15 19:45:22 -04:00
Luke Street 04c226e645
Merge pull request #224 from lioncash/explicit2
CMemoryCardSys: Make CardResult's conversion operator explicit
2020-03-15 19:45:13 -04:00
Luke Street 5804032fb4
Merge pull request #223 from lioncash/ref
CGameHintInfo: Take CVParamTransfer parameter by const reference
2020-03-15 19:45:02 -04:00
Luke Street 4eaed95c11
Merge pull request #222 from lioncash/view
CGameOptions: Make use of std::string_view where applicable
2020-03-15 19:44:47 -04:00
Luke Street e1d622d47b
Merge pull request #221 from lioncash/emplace
CFontImageDef: Make use of emplace_back where applicable
2020-03-15 19:44:23 -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
Lioncash ff92b72f91 CMemoryCardSys: Make CardResult's conversion operator explicit
Prevents implicit error-prone conversions to bool
2020-03-14 22:18:42 -04:00
Lioncash e6812a7cd9 CArchitectureQueue: Make operator bool explicit
Prevents potentially error-prone implicit conversion contexts.
2020-03-14 21:42:38 -04:00
Lioncash f5cc056a9e CGameHintInfo: Take CVParamTransfer parameter by const reference
Avoids trivial unnecessary copies.
2020-03-14 21:28:46 -04:00
Lioncash 659b8a43d3 CGameOptions: Make use of std::string_view where applicable
Enforces the use of valid strings in the interface. Also reduces c_str()
noise a little bit.
2020-03-14 20:09:23 -04:00
Lioncash e64dfe76b2 CFontImageDef: Make use of emplace_back where applicable
Same behavior, but constructs the instances directly within the
container.
2020-03-14 18:45:37 -04:00
Lioncash e0392d69c4 CHudEnergyInterface: Make use of std::array where applicable 2020-03-14 17:59:39 -04:00
Lioncash c4796ed090 CHudMissileInterface: Make use of std::array where applicable 2020-03-14 17:57:05 -04:00
Lioncash 9fafb24fb9 CHudVisorBeamMenu: Make use of std::array where applicable 2020-03-14 17:52:30 -04:00
Lioncash 07542ff335 CHudThreatInterface: Make use of std::array where applicable
Same behavior, but with stronger typing.
2020-03-14 17:38:57 -04:00
Phillip Stephens f7fdbc07ba
Merge pull request #219 from lioncash/false
CPathCamera: Change 0 to false in CPathCamera constructor
2020-03-13 15:30:59 -07: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 55955973a1
Merge pull request #217 from lioncash/sign
AutoMapper/*: Resolve sign conversion warnings
2020-03-13 15:30:24 -07:00
Phillip Stephens 0c17e4fdd7
Merge pull request #216 from lioncash/line
CLineRenderer: Silence -Wmaybe-uninitialized warning
2020-03-13 15:30:14 -07:00
Phillip Stephens 75c184d710
CHierarchyPoseBuilder corrections 2020-03-13 15:29:20 -07:00
Lioncash 92fb31fd40 CPathCamera: Change 0 to false in CPathCamera constructor
Same thing, but without implicit conversion to bool
2020-03-13 17:38:14 -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
Lioncash 7c1e468d31 CMapWorldInfo: Rename IsAreaVisted -> IsAreaVisted
Same thing, but without the typo.
2020-03-13 16:19:02 -04:00
Lioncash ddcbf51260 CMapUniverse: Resolve sign conversion warning in Draw()
Resolves a trivial implicit sign conversion warning.
2020-03-13 16:11:40 -04:00
Lioncash 014601cf67 CMapWorldInfo: Resolve sign conversion warnings
Resolves trivial implicit sign conversion warnings.
2020-03-13 16:10:23 -04:00
Lioncash 4601abf5df CMapArea: Resolve sign conversion warning in Draw()
Resolves a trivial sign-conversion warning.
2020-03-13 16:07:41 -04:00
Lioncash c37b3df27b CLineRenderer: Silence -Wmaybe-uninitialized warning
We can just initialize maxTriVerts to zero to prevent warnings from
occurring.
2020-03-12 19:15:51 -04:00
Phillip Stephens df4487bae8
Merge pull request #215 from lioncash/none
CFrontEndUI: Default initialize SFrontEndFrame's x4_action to EAction::None
2020-03-12 15:11:11 -07: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 97e33bdf11
Merge pull request #213 from lioncash/unique
CProjectileWeaponDataFactory: Make GetGeneratorDesc() return a unique_ptr
2020-03-12 15:10:49 -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 8badbd3f35
Merge pull request #211 from lioncash/init
CPlayerEnergyDrain: Initialize x10_energyDrainTime on construction
2020-03-12 15:10:28 -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
Phillip Stephens bb8e33461d
Merge pull request #206 from lioncash/gen
CElementGen: Minor cleanup
2020-03-12 15:09:36 -07:00
Phillip Stephens 5f2db40528
Merge pull request #205 from lioncash/fn
CFactoryMgr: Minor cleanup
2020-03-12 15:09:11 -07: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
Phillip Stephens 3a37be9d27
Minor CFlaahgra fixes 2020-03-12 15:06:01 -07:00
Lioncash 90e866d2d5 CFrontEndUI: Default initialize SFrontEndFrame's x4_action to EAction::None
This is the initial value that GM8E v0 assigns to this member variable.
Previously it was being left uninitialized on construction.
2020-03-12 17:35:36 -04: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 05bccae70e CDecalDataFactory: Make GetGeneratorDesc() return a unique_ptr
Same behavior, but with safer memory management.
2020-03-12 14:46:02 -04:00
Lioncash 1f42b9be93 CParticleElectricDataFactory: Make GetGeneratorDesc() return a unique_ptr
Same behavior, but with safer memory management.
2020-03-12 14:20:48 -04:00
Lioncash 59bbbdf41c CParticleSwooshDataFactory: Make GetGeneratorDesc() return a unique_ptr
Same behavior, but with safer memory management.
2020-03-12 14:17:42 -04:00
Lioncash 93121c38f7 CProjectileWeaponDataFactory: Make GetGeneratorDesc() return a unique_ptr
Same behavior, but with safer memory management.
2020-03-12 14:00:23 -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 d51518dc57 CPlayerEnergyDrain: Make constructor explicit
Prevents error-prone implicit constructions from occurring.
2020-03-12 10:01:31 -04:00
Lioncash e628cbf1be CPlayerEnergyDrain: Initialize x10_energyDrainTime on construction
GM8E v0 initializes this to zero when constructing the class. This also
makes the entire class have a consistent initial state.
2020-03-12 09:57:43 -04:00
Luke Street cfd568bb39 Merge branch 'chozoghosts' 2020-03-11 17:17:00 -04:00
Phillip Stephens 190c369aeb
Fix crashes with FusionSuit active 2020-03-11 06:48:30 -07:00
Luke Street 860f7c7f33 CChozoGhost: Minor fixes & renaming 2020-03-11 02:16:55 -04:00
Luke Street 123ddfd33a CChozoGhost: InPosition -> ShouldAttack 2020-03-11 00:22:03 -04:00
Luke Street 155cd3759f CChozoGhost: Minor FindBestAnchor fixes 2020-03-10 23:47:14 -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 f622ed364d CPlayerCameraBob: Make use of std::array where applicable 2020-03-09 20:33:37 -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
Lioncash 06dfc3406e CElectricBeamProjectile: Remove unnecessary get() calls in PreRender()
Same behavior, less code.
2020-03-09 13:55:26 -04:00
Lioncash 15dce1683e CElementGen: std::move TToken instance in constructor
Allows the parameter to be moved into via calling code.
2020-03-09 13:07:53 -04:00
Lioncash af2a82b5a7 CElementGen: Make GetSystemCount() a const member function
This doesn't modify internal member state, so this can be made a const
member function.
2020-03-09 13:03:42 -04:00
Lioncash a8486cf479 CElementGen: Resolve sign-conversion warnings in loops
Prevents implicit truncation to int from occurring.
2020-03-09 13:01:42 -04:00
Lioncash 9db07b037a CElementGen: Make use of std::array where applicable 2020-03-09 12:53:28 -04:00
Lioncash 35adfe8abf CElementGen: Alphabetize forward declarations
Makes them nicer to visually scan over.
2020-03-09 12:33:24 -04:00
Luke Street 985daa3092 CCharAnimTime: Re-add algorithm include 2020-03-09 12:21:08 -04:00
Lioncash 0a158af0cb CFactoryMgr: Resolve variable shadowing warning in MakeObjectFromMemory()
Resolvable with a trivial variable renaming.
2020-03-09 12:19:58 -04:00
Lioncash 91a2562fff CFactoryMgr: Make use of std::array
Same behavior, with stronger typing. We can also leverage the iterator
member functions directly.
2020-03-09 12:17:18 -04:00
Luke Street 24817d6b01 CCharAnimTime: Fixes & cleanup 2020-03-09 12:09:54 -04:00
Lioncash 34eb507a9d CFactoryMgr: std::move function instances in AddFactory()
std::function is allowed to allocate on the heap, so this potentially
prevents unnecessary allocations.

We can also use insert_or_assign() to prevent unnecessary default
initialization of std::function that immediately get overridden.
2020-03-09 12:04:51 -04:00
Lioncash 39b561b089 CTransitionManager: std::move constructor parameters where applicable
Allows calling code to move into the constructor
2020-03-09 11:58:10 -04:00
Lioncash 3a96c574b2 CTransitionDatabaseGame: std::move constructor parameters where applicable
Same behavior, but allows the parameters to be moved into from calling
code.
2020-03-09 11:58:10 -04:00
Lioncash 815f492e0f CSequenceHelper: std::move constructor parameters where applicable
Same behavior, but allows for calling code to move into the interface.
2020-03-09 11:58:10 -04:00
Lioncash cff12f0986 TAnimSourceInfo: std::move constructor parameter where applicable
Allows calling code to move into the constructor.
2020-03-09 11:58:10 -04:00
Lioncash 9fe671af99 CAnimTreeSequence: std::move constructor parameters where applicable
Allows the constructor arguments to be moved into the constructor.
2020-03-09 11:58:07 -04:00
Lioncash fa23d0bb9c CAnimTreeLoopIn: std::move constructor parameters where applicable
Allows the constructor parameters to be moved into.
2020-03-09 11:31:53 -04:00
Lioncash ab17c1cf2f CAnimationManager: std::move parameters to constructor where applicable
Allows calling code to move into the respective arguments.
2020-03-09 11:27:36 -04:00
Lioncash e289643742 CAnimData: std::move constructor arguments where applicable
Same behavior, but allows calling code to move into the respective
parameters now.
2020-03-09 11:25:23 -04:00
Lioncash 79565d7f52 CAnimSourceInfo: std::move TSubAnimTypeToken instance in constructor
Provides the same behavior, but allows calling code to move into the
constructor.
2020-03-09 11:11:27 -04:00
Lioncash 3cec19437a CAnimSysContext: std::move TToken instance in constructor
Provides the same interface, but allows for calling code to move into
the constructor.
2020-03-09 11:08:17 -04:00
Lioncash 280e4ce07d CAnimTreeAnimReaderContainer: std::move shared_ptr in constructor
Provides the same behavior, but without a redundant atomic reference
count increment and decrement.
2020-03-09 11:06:20 -04:00
Luke Street 5c9dd55b80 CChozoGhost: Fix IsOnGround 2020-03-09 10:41:34 -04:00
Luke Street 830db8772d Merge remote-tracking branch 'origin/master' into chozoghosts 2020-03-09 10:12:40 -04:00
Phillip Stephens d93df18a37
Fix `CScriptDistanceFog::AcceptScriptMessage` 2020-03-08 23:18:57 -07:00
Luke Street 7b9a037c95
Merge pull request #203 from lioncash/identical
CBallCamera: Collapse identical switch cases within AvoidGeometry()
2020-03-08 23:45:52 -04:00
Luke Street 6e9a80de5d CVisorFlare: Rename "near" to avoid MSVC conflict 2020-03-08 23:44:44 -04:00
Lioncash 363386cbd9 CBallCamera: Collapse identical switch cases within AvoidGeometry()
Same behavior, but less code.

This is identical in behavior to the code within the GM8E v0 binary.
2020-03-08 23:40:22 -04:00
Lioncash 45c1bc9652 CStaticRes: Make use of CAssetId's IsValid() member function within operator bool
We should be testing against IsValid() here to handle all cases that
indicate invalid values, as opposed to only handling the zero case.
2020-03-08 22:49:33 -04:00
Lioncash 209cd4a54e CStaticRes: Make operator bool explicit
Prevents potentially error-prone conversions to bool. Similar to the
changes recently made to CToken.
2020-03-08 21:20:08 -04:00
Lioncash 2233a78fe2 CToken: Add HasReference() member function
Has the same semantics of operator bool(), but explains at the call site
what is actually being tested for in the relation to the object itself.

Aims to make readability slightly better (and removed the need for
casts).
2020-03-08 21:13:37 -04:00
Phillip Stephens fc5170ede9
Merge pull request #200 from lioncash/temp
CLogBookScreen: Remove unconditional return true in IsScanComplete()
2020-03-08 18:03:54 -07:00
Phillip Stephens a28b7a8df7
Merge pull request #199 from lioncash/octree
CPVSVisOctree: Use static qualifying name for ReadBoundingBoxBig()
2020-03-08 18:03:44 -07:00
Phillip Stephens f07d4e9630
Merge pull request #198 from lioncash/move
CResFactory: Resolve use-after-move in AddToLoadList()
2020-03-08 18:03:28 -07:00
Phillip Stephens b492c91ccf
Merge pull request #197 from lioncash/cond
CFontRenderState: Collapse common switch cases in RefreshColor()
2020-03-08 18:03:17 -07:00
Phillip Stephens b01fa0c5bf
Merge pull request #196 from lioncash/saveable
CSaveableState: Initialize vectors in the constructor initializer list
2020-03-08 18:03:01 -07:00
Phillip Stephens dd54f93da4
Merge pull request #195 from lioncash/unused
CPlayer: Make use of unused CCollidableAABox in ProcessInput()
2020-03-08 18:02:52 -07:00
Phillip Stephens 3011a839eb
Merge pull request #194 from lioncash/init
CProjectileInfo: Initialize result variable to false within PredictInterceptPos
2020-03-08 18:02:41 -07:00
Phillip Stephens 51bb2244da
Merge pull request #193 from lioncash/explicit
CToken: Make operator bool explicit
2020-03-08 18:02:30 -07:00
Phillip Stephens 3e59f7a455
Prepare for pr-193 2020-03-08 18:01:29 -07:00
Lioncash 2a1df559a9 CLogBookScreen: Remove unconditional return true in IsScanComplete()
This was temporarily added in for debugging purposes in the past but was
never removed.
2020-03-08 11:15:13 -04:00
Phillip Stephens f06c26e7d6
Fix infinite loop in CObjectList, and add an assert to detect invalid assignments 2020-03-07 09:14:07 -08:00
Lioncash 8d42eb4287 CPVSVisOctree: Initialize in-class member variables where applicable
Provides a deterministic initial state for the default constructor.
2020-03-07 05:01:29 -05:00
Lioncash 4034e3b31f CPVSVisOctree: Make use of std::array where applicable
Makes the arrays strongly typed.
2020-03-07 04:50:19 -05:00
Lioncash 969bcdba35 CPVSVisOctree: Use static qualifying name for ReadBoundingBoxBig()
It looks very odd using the name of the object being initialized to call
through to a static member function. We can disambiguate this by making
use of the qualifying name directly.
2020-03-07 04:46:19 -05:00
Lioncash 0a47e623fd CResFactory: Resolve use-after-move in AddToLoadList()
The behavior on the right hand side would occur before the actual
assignment, making the tag value invalidated. Instead, we copy the tag
before the move is performed to keep the data valid when inserting it
into the map.
2020-03-07 03:56:16 -05:00
Lioncash a490eaf8ff CFontRenderState: Collapse common switch cases in RefreshColor()
Same behavior, less code.
2020-03-07 03:44:54 -05:00
Lioncash 815a38288a CSaveableState: Initialize vectors in the constructor initializer list
Initializes the vectors in place, rather than constructing them and then
resizing.
2020-03-06 22:47:39 -05:00
Lioncash 830e1c59d2 CPlayer: Make nearby variables const
Makes nearby variables from the previous change const to make their
immutability explicit.
2020-03-06 22:08:56 -05:00