Commit Graph

3563 Commits

Author SHA1 Message Date
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
Phillip Stephens f26bd01e32
Merge pull request #271 from lioncash/param
CPlayer: Add parameter names to prototypes
2020-03-24 17:45:00 -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