mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
fixed asset_enums.h
This commit is contained in:
Binary file not shown.
BIN
Binary file not shown.
@@ -59,7 +59,8 @@ BuildFonts::BuildFonts(DkrAssetsSettings &settings, BuildInfo &info) : _settings
|
||||
outFontFile->textureIndices[texIndex] = fontTextureIndex;
|
||||
}
|
||||
|
||||
std::string encodingType = fontJson->get_string("/encoding/type");
|
||||
// Assume ASCII by default.
|
||||
std::string encodingType = fontJson->get_string("/encoding/type", "ASCII");
|
||||
|
||||
StringHelper::make_uppercase(encodingType); // Make sure string is uppercase.
|
||||
|
||||
@@ -71,8 +72,6 @@ BuildFonts::BuildFonts(DkrAssetsSettings &settings, BuildInfo &info) : _settings
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper::info(info.dstPath);
|
||||
|
||||
FileHelper::write_binary_file(rawData, rawDataSize, _info.dstPath, true);
|
||||
|
||||
delete rawData;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "helpers/c/cEnumsHelper.h"
|
||||
|
||||
AssetEnums::AssetEnums(DkrAssetsSettings &settings) : _settings(settings) {
|
||||
_outFilepath = _settings.pathToInclude / "/asset_enums.h";
|
||||
_outFilepath = _settings.pathToInclude / "asset_enums.h";
|
||||
|
||||
_cHeader.write_comment("This file is automatically generated. Any changes you make to this file will get overwritten.");
|
||||
_cHeader.write_newline();
|
||||
@@ -43,6 +43,8 @@ void AssetEnums::_write_asset_section_enums() {
|
||||
_cHeader.write_newline();
|
||||
_cHeader.write_header_comment(sectionId.c_str());
|
||||
_write_asset_section_enums(sectionId, sectionJson);
|
||||
} else if(sectionJson->has("/filename")) {
|
||||
_write_single_asset_section_enums(sectionId, sectionJson);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -68,6 +70,36 @@ void AssetEnums::_write_main_asset_enum(std::vector<std::string> &mainOrder) {
|
||||
_cHeader.write_raw_text(mainEnum.to_string());
|
||||
}
|
||||
|
||||
void AssetEnums::_write_single_asset_section_enums(const std::string §ionId, JsonFile *sectionJson) {
|
||||
if(sectionId != "ASSET_FONTS") {
|
||||
return; // This function is just for the fonts.
|
||||
}
|
||||
_cHeader.write_newline();
|
||||
_cHeader.write_header_comment(sectionId.c_str());
|
||||
|
||||
std::string sectionEnumName = StringHelper::upper_snake_case_to_pascal_case(sectionId) + "Enum";
|
||||
WriteableCEnum sectionEnum(sectionEnumName);
|
||||
|
||||
fs::path fontSubfolder = sectionJson->get_path("/folder");
|
||||
fs::path fontJsonPath = _settings.pathToAssets;
|
||||
if(!fontSubfolder.empty()) {
|
||||
fontJsonPath /= fontSubfolder;
|
||||
}
|
||||
fontJsonPath /= sectionJson->get_string("/filename");
|
||||
JsonFile *fontsJson;
|
||||
DebugHelper::assert(JsonHelper::get().get_file(fontJsonPath, &fontsJson),
|
||||
"(AssetEnums::_write_single_asset_section_enums) Could not load fonts json!");
|
||||
|
||||
std::vector<std::string> fontIds;
|
||||
fontsJson->get_array<std::string>("/fonts-order", fontIds);
|
||||
for(std::string &fontId : fontIds) {
|
||||
sectionEnum.add_symbol(fontId);
|
||||
}
|
||||
|
||||
_cHeader.write_raw_text(sectionEnum.to_string());
|
||||
}
|
||||
|
||||
|
||||
void AssetEnums::_write_asset_section_enums(const std::string §ionId, JsonFile *sectionJson) {
|
||||
std::string sectionEnumName = StringHelper::upper_snake_case_to_pascal_case(sectionId) + "Enum";
|
||||
WriteableCEnum sectionEnum(sectionEnumName);
|
||||
@@ -80,6 +112,20 @@ void AssetEnums::_write_asset_section_enums(const std::string §ionId, JsonFi
|
||||
}
|
||||
|
||||
_cHeader.write_raw_text(sectionEnum.to_string());
|
||||
|
||||
if(sectionId == "ASSET_MENU_TEXT") {
|
||||
std::string menuTextIdsEnumName = StringHelper::upper_snake_case_to_pascal_case(sectionId) + "IdsEnum";
|
||||
WriteableCEnum menuTextIdsEnum(menuTextIdsEnumName);
|
||||
|
||||
std::vector<std::string> menuTextIds;
|
||||
sectionJson->get_array<std::string>("/menu-text-build-ids", menuTextIds);
|
||||
for(std::string &textId : menuTextIds) {
|
||||
menuTextIdsEnum.add_symbol(textId);
|
||||
}
|
||||
|
||||
_cHeader.write_newline();
|
||||
_cHeader.write_raw_text(menuTextIdsEnum.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
void AssetEnums::_write_deferred_asset_section_enums(const std::string §ionId, JsonFile *mainJson, const std::string &deferInfoPtr) {
|
||||
|
||||
@@ -19,6 +19,7 @@ private:
|
||||
|
||||
void _write_asset_section_enums();
|
||||
void _write_main_asset_enum(std::vector<std::string> &mainOrder);
|
||||
void _write_single_asset_section_enums(const std::string §ionId, JsonFile *sectionJson);
|
||||
void _write_asset_section_enums(const std::string §ionId, JsonFile *sectionJson);
|
||||
|
||||
void _write_deferred_asset_section_enums(const std::string §ionId, JsonFile *mainJson,
|
||||
|
||||
Reference in New Issue
Block a user