Commit Graph

100 Commits

Author SHA1 Message Date
teejusb 53dcbed80d Revert "Change some RString methods to free functions" 2025-06-22 23:31:56 -07:00
Arthur Eubanks 995f0ea8c1 Change some RString methods to free functions
These ones aren't a std::string method. Doing this helps the RString to
std::string migration.
2025-05-17 14:02:12 -07:00
Arthur Eubanks ecfcb11a00 Remove implicit conversion operator from RString to const char*
This is required for the RString to std::string migration.

Mostly automated from https://github.com/aeubanks/rewriter/blob/main/c_str.cc, with some manual intervention required for fixing up `a + b.c_str()` to `(a + b).c_str()`.

Added some overloads for some common global functions like sm_crash to reduce the number of changes required here.
2025-05-15 21:14:54 -07:00
Brandon W 8dcb01f3ee Remove COMPARE and COMPARE_FLOAT macros for equivalent if statements.
This is both for clarity, and to conform with the google c++ style
guide.

https://google.github.io/styleguide/cppguide.html#Preprocessor_Macros
2025-04-29 21:37:45 -07:00
Brandon W 448a2be7cd Add alias_ member to the Actor class. 2025-04-11 09:04:36 -07:00
teejusb 368c257e95 Rename to rate_scaling_enable_ + Expose functions to lua 2025-03-02 10:34:28 -08:00
Brandon W 9789ef9697 Give actors the ability to undo the rate change triggered by holding
tilde or tab.

This is gated by a new boolean, `tab_tilde_scaling_enabled_`, and
applied only to banners by default.
2025-03-02 10:34:28 -08:00
sukibaby e0b254968d std::size_t -> size_t
Removing std prefix from all size_t.
2024-10-01 01:46:26 -07:00
sukibaby bcd7e8e1d2 put the enum class back 2024-09-30 17:17:02 -07:00
sukibaby d13740ce33 Rename the StretchType enum in Actor
The lowercase enum is confusing because it looks like a variable. This prefixes it with a class name so it's easier to understand its purpose.
2024-09-30 17:17:02 -07:00
sukibaby abf89ec2b1 Replace SAFE_DELETE / SAFE_DELETE_ARRAY macros
SAFE_DELETE -> RageUtil::SafeDelete
SAFE_DELETE_ARRAY -> RageUtil::SafeDeleteArray

Update JsonUtil.h to include RageUtil.h - MSVC doesn't need it included for some reason, but GCC and XCode does.
2024-09-30 15:13:32 -07:00
sukibaby eb35a9b9af Switch from Float to Integer Time Values
- Use fast data types where possible so the compiler can optimize for speed based on platform
    - for example, 128 bits might be fastest on ARM
    - good future-proofing

- Refactor GetTimeSinceStart() to be a bit faster
    - multiplication is much faster than division

- Implement a RageTimer method to get the seconds value as a plain int, for the places which cast the seconds value to an int

- Changing from GetTimeSinceStartFast() to GetTimeSinceStart() where accuracy is important

- Changing from GetTimeSinceStart() to GetUsecsSinceStart() for timestamp diffs

- Adjust RageThreads to accomodate an unsigned timestamp value
   - a constant for the maximum value of `uint_fast64_t` replaces `-1` to accommodate the change from signed to unsigned for the `locked_at` variable
   - i have separate constants for `std::numeric_limits<std::uint_fast64_t>::max()` and `static_cast<std::uint_fast64_t>(-1)`, so the reader understands -1 represents an error code, though they evaluate to the same value, so i could remove one of the two

- Add two methods to calculate the MMSSMsMs / MMSSMsMsMs time value from usecs directly instead of inferring it from a seconds value, in RageUtil

- Use a similar counter/modulo based method for WheelNotifyIcon, similar to what i did for text_glow in NoteField in 2eeee03

- Make `g_iStartTime` static const for safety

Rename two timer functions:
GetUsecsSinceStart -> GetTimeSinceStartMicroseconds
GetMicrosecondsSinceStart -> GetSystemTimeAsMicroseconds

Remove std prefix from uint_fast64_t
2024-09-22 01:27:45 -07:00
sukibaby e60cf2aa0d Use stdlib for trigonometric functions
Profiling showed this performed significantly faster than the RageFast_ implementations.
2024-08-06 16:18:39 -07:00
sukibaby 6f86f3eae5 Restore comment in Actor.cpp 2024-05-29 10:30:49 -07:00
sukibaby 03033857c2 Actor optimizations 2024-05-28 10:24:23 -07:00
Martin Natano bacecae1f7 Decouple <vector> 2023-04-21 22:13:41 +02:00
Martin Natano 78fb2e9fc3 Decouple <cstddef> 2023-04-20 11:21:29 +02:00
Martin Natano b68ca517e6 Clean up math functions
- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include

e.g. floorf(x) -> std::floor(x)
2023-04-19 19:31:40 +02:00
Brian Phlipot 4a6b1a743c Enable more compiler warnings and treat them as errors. 2023-02-02 11:54:17 -08:00
Michael Sundqvist 0cba3579de Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements
Fix whitespace changes
2022-07-31 22:14:38 +02:00
teejusb 7e3789b131 Integrate C++11 branch into 5_1-new 2019-06-22 12:35:38 -07:00
Drew Barbarello 557be7cf1b 5 1 new backport x11 fs rework (#1485)
* Use XRandR 1.2 to set fullscreen resolution for single output

Squash of roothorick's PR #497
(also includes Kyzentun's CMake changes from PR #716)

* Cherry-pick json c++1x stuff (b9e3d7174e)

* Cherry-pick c++11 support from 5bba5c0038 and 9f8b045309

* rework Linux (X11) fullscreen, improve display-related Graphics Options

Implement option to select between monitors for exclusive fullscreen mode
on X11 (using XRandR 1.2), or use a fullscreen borderless window.

Reimplement resolution/refresh rate/display mode-related option rows
using Lua, update choices dynamically so only known-good groupings of
resolution/refresh rate/aspect ratio can be selected.

Minimally update Windows/MacOS LowLevelWindow implementations to support
changes made for Linux side. Fullscreen Borderless Window/multi monitor
support from X11 not implemented for those in this commit.

* allow forcibly disabling xinerama use on Linux

When libXinerama is available, SM tries to use it to find the proper
monitor indexes to use to set _NET_WM_FULLSCREEN_MONITORS (on borderless
fullscreen). xfwm4 seems to assume that monitors are numbered in increasing
order from left to right (rather than using the Xinerama-assigned numbers),
so _NET_WM_FULLSCREEN_MONITORS misbehaves on Xfce.

This commit bypasses use of libXinerama, and instead forces SM to induce fullscreen
on the desired monitor in the backup, hacky way: remove all window hints, move window
to desired monitor, then add _NET_WM_STATE_FULLSCREEN hint. This works on
mutter and Xfce.

* Remove multiple warnings on redundant define.

This used to be hard-coded due to pthread related items, but now it's dynamically determined.

* fix _fallback menu behavior for unrecognized aspect ratios

* Fix error recreating existing FS texture

* Bump deployment target to 10.7 to use libc++ on XCode 8

* Add explicit casts to please clang

* Update changelog
2017-06-18 08:55:16 -07:00
Colby Klein b4e02821e8 Revert "Improve handling of errors in lua functions and speed up calls. (#1427)"
This reverts commit f10e3ae36a.

(it was a joke PR, do not fear)
2017-04-04 17:21:55 -07:00
Kyzentun f10e3ae36a Improve handling of errors in lua functions and speed up calls. (#1427) 2017-04-04 11:36:23 -07:00
MrThatKid 02d863397a Don't use static temp state for actor effects
because actors are nested
2016-11-29 18:00:39 -08:00
Kyzentun Keeslala 073ba9f10b Forgot to initialize m_tween_uses_effect_delta. 2016-04-24 17:43:52 -06:00
Kyzentun Keeslala a4ecf15ce3 Added flag for making an actor use the effect delta for tweening. Updated changelog. 2016-03-17 19:37:27 -06:00
Kyzentun Keeslala 86470b7977 Reinstate RageFastSin because it's faster on Windows. 2016-02-07 21:04:10 -07:00
Kyzentun Keeslala acda44238d Replace RageFastSin and RageFastCos with standard library versions because the standard library is faster. Use fmod in spline evaluation. 2016-02-07 15:35:05 -07:00
Kyzentun Keeslala 189cf77cab Changed PlayCommandNoRecurse to check whether the command is nil before running it, so that a command metric set to a nil function isn't an error. Removed TextBannerHighScores::AfterSetCommand metric from _fallback because it pointed to a function that does not exist. 2015-10-22 12:24:04 -06:00
Kyzentun Keeslala f423af397a Removed superfluous assignments from Actor bounce/bob logic. 2015-06-03 17:15:26 -06:00
Kyzentun Keeslala f133272807 Removed pixel coordinate rounding from bounce and bob effects because it causes jumping when a slow move is combined with a slow bounce or bob. 2015-06-03 15:49:00 -06:00
Kyzentun 9b6ae296c7 Fixed automagic typing. Added debug overlay line for conversion. 2015-05-05 21:41:15 -06:00
Kyzentun 5eba25a495 Added hold at full to actor effect timing. Added the xml to lua converter. 2015-05-01 07:50:34 -06:00
Kyzentun 2656123464 RageTextureManager now keeps a map of textures by pointer for quicker lookup when deleting.
RageTextureManager now keeps a map of textures that need updating, which is none of them because I couldn't find a class that inherits from RageTexture that doesn't have an empty Update function.
ArrowEffects now requires setting the current PlayerOptions before calling any functions.  This might make moving to per-column mods easier, and reduces the direct usage of PlayerState.
Tipsy calculations for each column are done in ArrowEffects::Update instead of GetYPos and GetYOffset.
DrawHold changed to only call DrawHoldBody once.  DrawHoldBody now does the normal and glow passes together instead of needing to be called twice.
DrawHoldPart changed to take most of its args in a struct.
Giant copy paste mess that NoteField was using to draw timing segment text replaced with a couple functions and a macro.
Selection glow for notefield is only calculated if a section is selected.
Added RageVector3 functions to CubicSplineN for NoteDisplay to use.
Actor effect period is cached now.  Sprites and Models cache their animation length now.
ReceptorArrowRow no longer calls ArrowEffects::Update in gameplay.
2015-04-24 15:55:54 -06:00
Kyzentun 8b09da8e64 Various changes to speed up start up time:
Added delay_save_cache to SongCacheIndex so that it doesn't write the entire cache index file after every song is loaded when loading songs.
Added m_SongsByDir to SongManager so that GetSongFromDir doesn't have to walk the entire list of songs.
Minor changes to when LoadEnabledSongsFromPref occurs and how SanityCheckGroupDir works to speed up loading.
Song::ReloadFromSongDir removes cache file to force an actual reload from the song dir instead of reloading from the cache.  ReloadFromSongDir exposed to lua.
Reordered Actor::LoadFromNode to put Command first because that case is more common.
Course::GetTrailUnsorted reserves entries before starting to save time reallocating.
join in RageUtil calculates the final size of the concatenated strings reserves it to save time reallocating.
Added time log file to RageLog for profiling.
2015-03-30 17:45:52 -06:00
Kyzentun d617321766 Emit an error for negative tweening hurry factor. 2015-03-08 10:12:42 -06:00
Kyzentun b4ede3f977 Stupid LuaHelpes::Push doesn't have a size_t specialization. 2015-01-30 09:30:50 -07:00
Kyzentun 647b361284 Added wrapper states to actors. Wrapping an actor inside a frame when building a screen is now unnecessary. 2015-01-30 09:05:09 -07:00
Kyzentun 40b25e6220 Fixed conflicts to merge kickbox in. 2015-01-27 18:03:41 -07:00
Kyzentun aeaead95c9 Changed default ScreenSelecStyle to use functions for choice names and positions instead of metrics. _fallback SSS remains the same for compatibility. Fixed style stomping bug in SetCompatibleStylesForPlayers. 2015-01-20 18:40:59 -07:00
Kyzentun 65187a55c6 CubicSpline class created. Temp spline rendering stuff in AMV. 2014-12-27 21:41:55 -07:00
Kyzentun 64d384410c Created NoteColumnRenderer to handle column rendering. Added m_FakeParent to Actor to solve part of the problem. 2014-12-26 01:54:34 -07:00
Kyzentun 4f95bf08ad Function chaining for actors and singletons. 2014-12-01 22:31:30 -07:00
Kyzentun 50df61a0ca Fixed RollingNumbers to work with corner diffuse colors. Changed diffuse loops to use NUM_DIFFUSE_COLORS instead of 4. 2014-11-01 16:42:51 -06:00
Kyzentun a5289ddaca Fixed broken else-if chain in Actor::SetEffectClockString. Changed error to not crash Stepmania. 2014-10-29 17:43:37 -06:00
Kyzentun 5639a0d31f Lineage reporting for nil commands in RunCommands. Stricter type checking for FormatPercentScore in PercentageDisplay. 2014-10-28 20:32:38 -06:00
sigatrev d8b86fa3c5 make internal diffuse apply to bmt attributes
diffuse from BitmapText attributes were not receiving internal diffuse
from their parent ActorFrames. This change waits until after the draw
cycle to reset the internal diffuse and glow, so any color applications
separate from generic diffuse can use the internal diffuse when desired.
2014-08-16 16:38:26 -05:00
Kyzentun 63311ab62f Moved error reporting to ScreenSystemLayer error.lua. ScreenSystemLayer overlay/default.lua restored to previous. Error messages are now broadcast with the ScriptError message instead of SystemMessage. Added show/hide error messages toggle and clear error messages to debug menu. Nuked ScreenConsoleOverlay for being unfinished and duplicating ScreenSystemLayer. Changed Actor:tween and Tween::CreateFromStack to use ReportScriptError on invalid tween params. Changed some OptionRowList things to use ReportScriptError on invalid metrics. 2014-07-08 20:01:33 -06:00
Kyzentun 026f968fa4 Changed many uses of Dialog::OK and LOG->Warn to use ReportScriptError. 2014-07-07 00:39:27 -06:00