osuplusplus/include/config_def.hpp
2024-03-18 11:25:15 +01:00

207 lines
4.7 KiB
C++

#ifndef CONFIG
#define CONFIG_DEFINED
#define CONFIG(name, ...)
#define SECTION(name, ...)
#define UINT
#define VAR_UINT(section, name)
#define VAR_UINT_D(section, name, default)
#define INT
#define VAR_INT(section, name)
#define VAR_INT_D(section, name, default)
#define STRING
#define VAR_STRING(section, name)
#define VAR_STRING_D(section, name, default)
#define BOOL
#define VAR_BOOL(section, name)
#define VAR_BOOL_D(section, name, default)
#define FLOAT
#define VAR_FLOAT(section, name)
#define VAR_FLOAT_D(section, name, default)
#define COLOUR
#define VAR_COLOUR(section, name)
#define VAR_COLOUR_D(section, name, default)
#define ENUM(name, ...)
#define VAR_ENUM(section, name, enum_type)
#define VAR_ENUM_D(section, name, enum_type, default)
#define VAR_BITS(section, name, amount, offset)
#define STRUCT(name, ...)
#define VAR_STRUCT(section, name, struct_type)
#define VAR_STRUCT_D(section, name, struct_type, default)
#define VAR_LIST(section, name, type)
#define VAR_LIST_SEP(section, name, type, sep)
#define VAR_LIST_NUMBERED(section, name, type)
#endif // CONFIG
ENUM(Countdown,
NONE,
NORMAL,
HALF,
DOUBLE
)
ENUM(SampleSet,
DEFAULT,
NORMAL,
SOFT,
DRUM
)
ENUM(Mode,
STANDARD,
TAIKO,
CATCH,
MANIA
)
ENUM(OverlayPosition,
NO_CHANGE,
BELOW,
ABOVE
)
STRUCT(TimingPoint,
VAR_UINT(, time)
VAR_FLOAT(, beatLength)
VAR_UINT(, meter)
VAR_ENUM(, sampleSet, SampleSet)
VAR_UINT(, sampleIndex)
VAR_UINT(, volume)
VAR_BOOL(, uninherited)
VAR_UINT(, effects)
)
STRUCT(HitObjectType,
VAR_BITS(, hitCircle, 1, 0)
VAR_BITS(, slider, 1, 1)
VAR_BITS(, newCombo, 1, 2)
VAR_BITS(, spinner, 1, 3)
VAR_BITS(, colourHax, 3, 4)
VAR_BITS(, holdNote, 1, 7)
)
STRUCT(HitSound,
VAR_BITS(, normal, 1, 0)
VAR_BITS(, whistle, 1, 1)
VAR_BITS(, finish, 1, 2)
VAR_BITS(, clap, 1, 3)
)
STRUCT(HitObject,
VAR_INT(, x)
VAR_INT(, y)
VAR_INT(, time)
VAR_STRUCT(, type, HitObjectType)
VAR_STRUCT(, hitSound ,HitSound)
)
// https://osu.ppy.sh/wiki/en/Client/File_formats/osu_%28file_format%29
CONFIG(Difficulty,
VAR_UINT(, formatVersion)
SECTION(general,
VAR_STRING(.general, audioFilename)
VAR_UINT_D(.general, audioLeadIn, 0)
VAR_INT_D(.general, previewTime, -1)
VAR_ENUM_D(.general, countdown, Countdown, NORMAL)
VAR_ENUM_D(.general, sampleSet, SampleSet, NORMAL)
VAR_FLOAT_D(.general, stackLeniency, 0.7)
VAR_ENUM_D(.general, mode, Mode, STANDARD)
VAR_BOOL_D(.general, letterboxInBreaks, false)
VAR_BOOL_D(.general, useSkinSprites, false)
VAR_ENUM_D(.general, overlayPosition, OverlayPosition, NO_CHANGE)
VAR_STRING(.general, skinPreference)
VAR_BOOL_D(.general, epilepsyWarning, false)
VAR_UINT_D(.general, countdownOffset, 0)
VAR_BOOL_D(.general, specialStyle, false)
VAR_BOOL_D(.general, widescreenStoryboard, false)
VAR_BOOL_D(.general, sampleMatchPlaybackRate, false)
)
SECTION(editor,
VAR_LIST_SEP(.editor, bookmarks, UINT, ",")
VAR_FLOAT(.editor, distanceSpacing)
VAR_UINT(.editor, beatDivisor)
VAR_UINT(.editor, gridSize)
VAR_FLOAT(.editor, timelineZoom)
)
SECTION(metadata,
VAR_STRING(.metadata, title)
VAR_STRING(.metadata, titleUnicode)
VAR_STRING(.metadata, artist)
VAR_STRING(.metadata, artistUnicode)
VAR_STRING(.metadata, creator)
VAR_STRING(.metadata, version)
VAR_STRING(.metadata, source)
VAR_LIST_SEP(.metadata, tags, STRING, " ")
VAR_UINT(.metadata, beatmapID)
VAR_UINT(.metadata, beatmapSetID)
)
SECTION(difficulty,
VAR_FLOAT(.difficulty, hpDrainRate)
VAR_FLOAT(.difficulty, circleSize)
VAR_FLOAT(.difficulty, overallDifficulty)
VAR_FLOAT(.difficulty, approachRate)
VAR_FLOAT(.difficulty, sliderMultiplier)
VAR_FLOAT(.difficulty, sliderTickRate)
)
VAR_LIST(, timingPoints, TimingPoint)
SECTION(colours,
VAR_LIST_NUMBERED(.colours, combo, COLOUR)
VAR_COLOUR(.colours, sliderTrackOverride)
VAR_COLOUR(.colours, sliderBorder)
)
VAR_LIST(, hitObjects, HitObject)
)
#ifdef CONFIG_DEFINED
#undef CONFIG
#undef SECTION
#undef UINT
#undef VAR_UINT
#undef VAR_UINT_D
#undef INT
#undef VAR_INT
#undef VAR_INT_D
#undef STRING
#undef VAR_STRING
#undef VAR_STRING_D
#undef BOOL
#undef VAR_BOOL
#undef VAR_BOOL_D
#undef FLOAT
#undef VAR_FLOAT
#undef VAR_FLOAT_D
#undef COLOUR
#undef VAR_COLOUR
#undef VAR_COLOUR_D
#undef ENUM
#undef VAR_ENUM
#undef VAR_ENUM_D
#undef VAR_BITS
#undef STRUCT
#undef VAR_STRUCT
#undef VAR_STRUCT_D
#undef VAR_LIST
#undef VAR_LIST_SEP
#undef VAR_LIST_NUMBERED
#endif // CONFIG_DEFINED