Commit Graph

373 Commits

Author SHA1 Message Date
Luke Street 24acb585f8 MSVC & zeus fixes; update hecl-gui 2020-04-19 21:09:30 -04:00
Luke Street 4e88f503ac COmegaPirate: Implement CFlash 2020-04-19 02:47:25 -04:00
Luke Street e50d363e88 CPlayerGun: Rename EMissileState; minor CMotionState::Update fix 2020-04-19 00:26:53 -04:00
Lioncash 3c8ce3dc99 CGuiTextSupport: Amend typo in debug group label
This is within the Render() function, so we can rename the group name.
2020-04-14 13:34:50 -04:00
Luke Street 112322be5a
Merge pull request #311 from lioncash/sign
CScanDisplay: Eliminate implicit sign conversions
2020-04-14 02:10:13 -04:00
Lioncash 2c7d10c4b4 CCompoundTargetReticle: Brace statements where applicable 2020-04-13 17:16:23 -04:00
Lioncash 85f930ef2e CCompoundTargetReticle: Convert unnecessary floats into bools
Using floats here is extremely suspect and almost certainly
unintentional.
2020-04-13 16:54:45 -04:00
Lioncash 1767338aba CCompoundTargetReticle: Make eliminate hardcoded size
We can just query the capacity to dehardcode it.
2020-04-13 16:52:01 -04:00
Lioncash e26afe887f CCompoundTargetReticle: Make use of std::array where applicable
Same behavior, stronger typing.

While we're at it, we can eliminate a case of variable shadowing.
2020-04-13 16:50:37 -04:00
Lioncash c6278c0e9f CCompoundTargetReticle: Initialize all data members
Provides deterministic initial state.
2020-04-13 16:41:28 -04:00
Lioncash 786675f307 CTextExecuteBuffer: Move initialization of xa8_curWordIt into initializer list 2020-04-13 16:18:38 -04:00
Lioncash 50ba80247b CTextExecuteBuffer: Initialize xac_curY and xb0_curX in the constructor
Provides a deterministic initial state upon construction for easier
debugging.
2020-04-13 16:18:02 -04:00
Lioncash 6806d4914c CHudBossEnergyInterface: Initialize x0_alpha on construction
Provides a deterministic initial state which is helpful for debugging.
2020-04-13 15:00:44 -04:00
Lioncash 67786721ff CHudBossEnergyInterface: Make use of structured bindings in constructor
Same behavior, minus a verbose type name.
2020-04-13 14:59:47 -04:00
Lioncash 4e6150acc4 CHudDecoInterface: Make missed virtual call in constructor explicit
Missed this one in the previous commit.
2020-04-13 14:54:15 -04:00
Lioncash c8be142846 CHudDecoInterface: Make virtual calls in constructor explicitly qualified
Virtual functions called in a constructor or destructor are statically
resolved. Given this is a potential source of bugs, we qualify these
functions to make it explicit that this is indeed the kind of behavior
desired.
2020-04-13 14:52:34 -04:00
Lioncash 3a5a3e2011 CHudRadarInterface: Make use of const where applicable
Same behavior, but makes it obvious some references are only used in a
read-only manner.
2020-04-13 14:25:59 -04:00
Lioncash 0a01a30bf5 CScanDisplay: Eliminate implicit sign conversions
Removes implicit sign conversions and also dehardcodes quite a bit of
sizes.
2020-04-12 22:05:52 -04:00
Lioncash 96e3eaf726 CSplashScreen: Make use of std::array where applicable
Same behavior, stronger typing.
2020-04-12 11:30:09 -04:00
Lioncash d5e57b5348 CCompoundTargetReticle: Make skZeroRenderState constexpr
Allows eliding runtime initializers where applicable. Particularly for
the static data.
2020-04-12 04:19:53 -04:00
Jack Andersen 5b4441ac36 Update fmtlib 2020-04-11 12:51:39 -10:00
Luke Street e38a7f97bd Runtime/GuiSys: Replace bitfield unions with constructor initializers 2020-04-10 15:11:10 -04:00
Lioncash 1e6b6622fe CGuiFrame: Remove unnecessary mutable specifiers
We can just drop the const qualifier on ProcessMouseInput() to make the
mutable specifier unnecessary.
2020-04-10 02:17:50 -04:00
Lioncash 2fadaf544d CCompoundTargetReticle: Remove mutable specifier on x28_noDrawTicks
This is no longer needed at all.
2020-04-09 21:35:16 -04:00
Lioncash b72d217a68 CCompoundTargetingReticle: Remove mutable specifier on m_scanRetRenderer
This can be trivially resolved by dropping const qualifiers on the
necessary member functions.
2020-04-09 21:31:22 -04:00
Lioncash 35ca901784 CHudRadarInterface: Remove mutable specifiers from class members
We can just drop the const qualifiers on the relevant member functions
to make these unnecessary.
2020-04-09 21:23:50 -04:00
Lioncash db0091e9cd CWordBreakTables: Make use of std::array where applicable
Same behavior, but allows directly querying iterators. We can also make
these arrays constexpr.
2020-04-07 13:24:23 -04:00
Lioncash f7962cb3f7 CRasterFont: Extend CFontInfo buffer to 64 characters
GM8E v0 seems to be using at least a buffer 64 characters in size, not
40.
2020-04-06 06:59:22 -04:00
Lioncash 94264f6fe6 CRasterFont: Collapse loop into a std::find_if in InternalGetGlyph()
Same behavior, less code.
2020-04-05 06:01:29 -04: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 6dce70895c CIOWin: Make Draw() non-const
Allows removing several const_cast usages within the codebase.
2020-03-29 21:56:49 -04:00
Lioncash 0d3bab4c14 CScanDisplay: Remove use of const_cast
The draw function is essentially not fully const in behavior, so we can
remove the const qualifiers where necessary.
2020-03-29 21:44:10 -04:00
Lioncash 2d8e94911a CGuiTextSupport: Eliminate the use of const_cast
We can supply a const and non-const variant to eliminate the need to
const_cast here.
2020-03-29 21:37:11 -04:00
Lioncash f3afcf7299 CGuiTextPane: Remove stray unnecessary const_cast in Draw()
Draw() isn't const qualified, so there's no need to cast away const
here.
2020-03-29 21:25:47 -04:00
Lioncash 603942daaf CTextRenderBuffer: Remove use of const_cast in Render()
Makes for much less casting.
2020-03-29 20:27:04 -04:00
Lioncash 04a42980ab Revert "Revert "CTextRenderBuffer: Forward declare structs where applicable""
This reverts commit 16745f3a7b.

We can simply default the move constructor and move assignment operator
to make this work.
2020-03-29 20:09:16 -04:00
Phillip Stephens 16745f3a7b
Revert "CTextRenderBuffer: Forward declare structs where applicable" 2020-03-29 16:35:02 -07:00
Phillip Stephens f3721844b9
Merge pull request #282 from lioncash/struct
CTextRenderBuffer: Forward declare structs where applicable
2020-03-29 16:04:32 -07:00
Lioncash 232ae12802 CGuiTextPane: Make use of std::array where applicable
Same behavior, but with stronger typing and allows removing of a
hardcoded array size.
2020-03-29 08:00:40 -04:00
Lioncash 0aff4dc21e CTextRenderBuffer: Remove use of const_cast within Render()
Same behavior but way less casting.
2020-03-29 04:42:58 -04:00
Lioncash 20b74c4818 CTextRenderBuffer: Forward declare structs where applicable
These are only used internally, so we can completely hide these structs
from external view.

This allows their implementation to be changed without needing to
recompile all the headers that include it.
2020-03-29 03:54:29 -04:00
Lioncash fda08db9b1 CHudVisorBeamMenu: Dehardcode array sizes
Same behavior, but queries the container for the size rather than
hardcoding it in loop bounds.
2020-03-29 03:08:41 -04:00
Lioncash 413483a996 CHudFreeLookInterfaceXRay: Assign free look and control held flags in SetFreeLookState()
GM8Ev0 does this.
2020-03-29 02:08:51 -04:00
Lioncash ad07b993c8 CHudFreeLookInterface: Collapse conditional within SetFreeLookState()
Same behavior, less code.
2020-03-29 02:03:20 -04:00
Lioncash 59fbefbd58 CGuiWidget: Provide names for all function prototypes
Makes parameter introspection nicer with IDEs and also renames ambiguous
"v" names to something more self-descriptive.
2020-03-29 01:52:23 -04:00
Lioncash 194cdf145f Runtime: Use nullptr where applicable
Same behavior, but no magic 0 value.

While we're in the same area, we can do minor cosmetic changes.
2020-03-27 20:18:54 -04:00
Phillip Stephens e0fe365dfd
Merge pull request #278 from lioncash/explicit
General: Make use of explicit constructors where applicable
2020-03-27 14:10:19 -07:00
Lioncash 241a66dc0a General: Make use of explicit constructors where applicable
Gets rid of potential error prone implicitly constructing constructors.
2020-03-27 06:00:17 -04:00
Lioncash fcf70aeb2a CGuiWidgetIdDB: Remove redundant std::make_pair funcs
Same behavior, less code.
2020-03-26 03:55:28 -04:00
Lioncash f4b3fb947e CScanDisplay: Make constructor explicit
Prevents error-prone implicit construction from occurring.
2020-03-25 20:46:08 -04:00
Luke Street 8314d5b6ef Merge branch 'pr-255' 2020-03-25 02:09:02 -04:00
Luke Street 3734a09ed3 CGuiWidget: Make GetIsFinishedLoading non-const 2020-03-25 02:01:47 -04:00
Lioncash 40fc3f9dd8 CModelBoo: Remove usages of const_cast
Many functions are modifying internals of CBooModel and const-casting
is performed in order to work around functions being const when they
really shouldn't be.

This amends the function signatures in order to allow these functions to
exist without const_cast, making code much nicer to read.
2020-03-25 02:01:46 -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
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 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 9d5857e139 CGuiSliderGroup: Make use of std::array where applicable
Same behavior, stronger typing.
2020-03-17 22:22:06 -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
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 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 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
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 b492c91ccf
Merge pull request #197 from lioncash/cond
CFontRenderState: Collapse common switch cases in RefreshColor()
2020-03-08 18:03:17 -07: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
Phillip Stephens 2f9dd38bbe
Silence discard errors 2020-03-04 18:40:03 -08:00
Lioncash f1256faeb7 Runtime: Remove unnecessary c_str() calls
Makes for less noisy code and also gets rid of unnecessary std::strlen
calls in the case things are passed to a std::string_view parameter.
2020-02-28 05:26:41 -05:00
Phillip Stephens b1322a5613
Merge pull request #133 from lioncash/trunc-float
CTextParser: Resolve double->float truncation within ParseTag()
2020-01-30 20:11:39 -08:00
Lioncash 03f2ebc768 CTextParser: Resolve double->float truncation within ParseTag()
This should be prepended with the f suffix to prevent double to float
implicit truncation.
2020-01-29 02:26:50 -05:00
Lioncash 7f20cd0883 CGuiTextSupport: Make use of emplace_back() in AddText()
Same behavior, less code.
2020-01-28 00:22:19 -05:00
Lioncash 221cc5c6b8 RuntimeCommonB: Normalize cpp file includes
Like the prior changes normalizing the inclusions within headers, this
tackles the cpp files of the RuntimeCommonB target, making these source
files consistent with their headers.
2019-12-22 18:12:04 -05:00
Phillip Stephens 70747e23d5
Fix font rendering and world teleporter in MPT and PAL 2019-12-11 10:55:19 -08:00
Phillip Stephens 3b101267f8
Merge pull request #88 from lioncash/radar
Graphics/Shaders: Minor changes
2019-11-10 08:03:42 -08:00
Lioncash 902f4fb5c5 Graphics/Shaders: Use forward declarations where applicable
Now, with all of the headers normalized, we can safely convert some
headers into forward declarations without needing to worry about
potentially breaking code in other headers or source files.
2019-11-09 20:22:09 -05: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
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 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 36d04456dd General: Normalize RuntimeCommonB include paths
Finishes the normalizing of all of includes within the RuntimeCommonB target's headers.
2019-09-23 17:22:37 -04:00
Lioncash 06789d1860 General: Normalize several headers' include paths
Normalizes the include paths and makes them consistent. Also adds any
missing includes relevant to the interface.
2019-09-22 20:36:33 -04:00
Phillip Stephens 68e2fad74f
Fix TCastTo.hpp inclusions, add comment to warn against modifying include path 2019-09-21 06:07:13 -07:00
Phillip Stephens a89852fc46
Merge pull request #79 from lioncash/trunc
CAuiEnergyBarT01: Prevent truncation within DownloadBarCoordFunc
2019-09-21 05:44:27 -07:00
Lioncash 3f06dd0a64 CAuiEnergyBarT01: Prevent truncation within DownloadBarCoordFunc
Without float literals, the calculation is performed in double precision
and then truncated down to float implicitly.
2019-09-19 22:31:46 -04:00
Lioncash 04cc300019 CGuiWidgetDrawParms: Mark Default instance as const
This isn't ever modified, so it can be made const to prevent
unintentional modification (and allow it to be placed within the RO
segment).
2019-09-19 21:46:11 -04:00
Phillip Stephens 613f690c42
Merge pull request #66 from lioncash/lockfire
CCompoundTargetReticle: Fix typo in lock fire string
2019-09-13 00:11:37 -07:00
Lioncash 0aa749ce0c CCompoundTargetReticle: Fix typo in lock fire string
In the actual game executable, the string is stored with a lower-case 'i', not an upper-case one.
2019-09-12 06:40:52 -04:00
Lioncash 20696fd500 CCompoundTargetReticle: Declare file-scope strings as arrays
Reduces the overall size of the resulting binary, as only the string
data will be stored rather than the string and a pointer pointing to
said string data.
2019-09-12 06:38:05 -04:00
Lioncash 267fd2962a CCompoundTargetReticle: Move private strings into the cpp file
This is an internal detail, so we don't need to expose this in the
header,
2019-09-12 05:45:53 -04:00
Lioncash f9079f0215 Runtime: Make use of std::make_unique where applicable
Makes use of the C++14 make_unique allocation function to allocate class
instances where applicable instead of a reset with a new operator within
it.

This doesn't touch cases where buffers are allocated, given make_unique
would zero-initialize them.
2019-09-12 04:09:48 -04:00
Lioncash d5fa8b72b0 CStringTable: Remove unnecessary initializer
std::unique_ptr always initializes to nullptr. We can remove this
implicit convertion from 0 to nullptr.
2019-09-01 03:16:54 -04:00
Lioncash e23dfbd8db CStringTable: Use std::array instead of std::vector
Gets rid of a static constructor, as well as a few heap allocations
2019-09-01 03:13:45 -04:00
Lioncash d3d629d405 RuntimeCommon: Use const on member functions where applicable
Adds missing const qualifiers on class member functions that don't
modify instance state.
2019-08-14 09:25:39 -04:00