mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 10:52:19 -05:00
refactor: use LUS 1.0 RC
Co-authored-by: kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: KiritoDv <kiritodev01@gmail.com> Co-authored-by: Christopher Leggett <chris@leggett.dev>
This commit is contained in:
parent
ab104623a7
commit
ba13e6b2c4
@ -1,11 +1,11 @@
|
|||||||
#include "AnimationExporter.h"
|
#include "AnimationExporter.h"
|
||||||
#include <Animation.h>
|
#include <resource/type/Animation.h>
|
||||||
|
|
||||||
void OTRExporter_Animation::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
void OTRExporter_Animation::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
||||||
{
|
{
|
||||||
ZAnimation* anim = (ZAnimation*)res;
|
ZAnimation* anim = (ZAnimation*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::Animation);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_Animation);
|
||||||
|
|
||||||
ZNormalAnimation* normalAnim = dynamic_cast<ZNormalAnimation*>(anim);
|
ZNormalAnimation* normalAnim = dynamic_cast<ZNormalAnimation*>(anim);
|
||||||
ZCurveAnimation* curveAnim = dynamic_cast<ZCurveAnimation*>(anim);
|
ZCurveAnimation* curveAnim = dynamic_cast<ZCurveAnimation*>(anim);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "AudioExporter.h"
|
#include "AudioExporter.h"
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
#include <Animation.h>
|
|
||||||
#include <Utils/MemoryStream.h>
|
#include <Utils/MemoryStream.h>
|
||||||
#include <Globals.h>
|
#include <Globals.h>
|
||||||
#include <Utils/File.h>
|
#include <Utils/File.h>
|
||||||
@ -30,7 +29,7 @@ void OTRExporter_Audio::WriteSampleEntryReference(ZAudio* audio, SampleEntry* en
|
|||||||
|
|
||||||
void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* writer)
|
void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* writer)
|
||||||
{
|
{
|
||||||
WriteHeader(nullptr, "", writer, Ship::ResourceType::AudioSample, Ship::Version::Rachael);
|
WriteHeader(nullptr, "", writer, Ship::ResourceType::SOH_AudioSample, Ship::Version::Rachael);
|
||||||
|
|
||||||
writer->Write(entry->codec);
|
writer->Write(entry->codec);
|
||||||
writer->Write(entry->medium);
|
writer->Write(entry->medium);
|
||||||
@ -82,7 +81,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
|
|||||||
{
|
{
|
||||||
ZAudio* audio = (ZAudio*)res;
|
ZAudio* audio = (ZAudio*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::Audio, Ship::Version::Rachael);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_Audio, Ship::Version::Rachael);
|
||||||
|
|
||||||
// Write Samples as individual files
|
// Write Samples as individual files
|
||||||
for (auto pair : audio->samples)
|
for (auto pair : audio->samples)
|
||||||
@ -115,7 +114,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
|
|||||||
MemoryStream* fntStream = new MemoryStream();
|
MemoryStream* fntStream = new MemoryStream();
|
||||||
BinaryWriter fntWriter = BinaryWriter(fntStream);
|
BinaryWriter fntWriter = BinaryWriter(fntStream);
|
||||||
|
|
||||||
WriteHeader(nullptr, "", &fntWriter, Ship::ResourceType::AudioSoundFont, Ship::Version::Rachael);
|
WriteHeader(nullptr, "", &fntWriter, Ship::ResourceType::SOH_AudioSoundFont, Ship::Version::Rachael);
|
||||||
|
|
||||||
fntWriter.Write((uint32_t)i);
|
fntWriter.Write((uint32_t)i);
|
||||||
fntWriter.Write(audio->soundFontTable[i].medium);
|
fntWriter.Write(audio->soundFontTable[i].medium);
|
||||||
@ -174,7 +173,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
|
|||||||
MemoryStream* seqStream = new MemoryStream();
|
MemoryStream* seqStream = new MemoryStream();
|
||||||
BinaryWriter seqWriter = BinaryWriter(seqStream);
|
BinaryWriter seqWriter = BinaryWriter(seqStream);
|
||||||
|
|
||||||
WriteHeader(nullptr, "", &seqWriter, Ship::ResourceType::AudioSequence, Ship::Version::Rachael);
|
WriteHeader(nullptr, "", &seqWriter, Ship::ResourceType::SOH_AudioSequence, Ship::Version::Rachael);
|
||||||
|
|
||||||
seqWriter.Write((uint32_t)seq.size());
|
seqWriter.Write((uint32_t)seq.size());
|
||||||
seqWriter.Write(seq.data(), seq.size());
|
seqWriter.Write(seq.data(), seq.size());
|
||||||
|
@ -5,6 +5,10 @@ void OTRExporter_Background::Save(ZResource* res, const fs::path& outPath, Binar
|
|||||||
{
|
{
|
||||||
ZBackground* bg = (ZBackground*)res;
|
ZBackground* bg = (ZBackground*)res;
|
||||||
|
|
||||||
|
WriteHeader(bg, outPath, writer, Ship::ResourceType::SOH_Background);
|
||||||
|
|
||||||
|
writer->Write((uint32_t)bg->GetRawDataSize());
|
||||||
|
|
||||||
auto data = bg->parent->GetRawData();
|
auto data = bg->parent->GetRawData();
|
||||||
writer->Write((char*)data.data() + bg->GetRawDataIndex(), bg->GetRawDataSize());
|
writer->Write((char*)data.data() + bg->GetRawDataIndex(), bg->GetRawDataSize());
|
||||||
}
|
}
|
@ -158,16 +158,19 @@ endif()
|
|||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPD/
|
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPD/
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/ZAPDUtils
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/tinyxml2
|
# TODO: these should no longer be necessary if we were to link against LUS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/src
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/src
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/src/resource
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/src/resource/types
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/spdlog/include
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/Mercury
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/src/graphic/Fast3D/U64
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/tinyxml2
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/ZAPDUtils
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/StormLib/src
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/StormLib/src
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/spdlog/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/nlohmann-json/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/src/resource
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../soh/soh
|
||||||
.
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "CollisionExporter.h"
|
#include "CollisionExporter.h"
|
||||||
#include <Resource.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
void OTRExporter_Collision::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
void OTRExporter_Collision::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
||||||
{
|
{
|
||||||
ZCollisionHeader* col = (ZCollisionHeader*)res;
|
ZCollisionHeader* col = (ZCollisionHeader*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::CollisionHeader);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_CollisionHeader);
|
||||||
|
|
||||||
writer->Write(col->absMinX);
|
writer->Write(col->absMinX);
|
||||||
writer->Write(col->absMinY);
|
writer->Write(col->absMinY);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "CutsceneExporter.h"
|
#include "CutsceneExporter.h"
|
||||||
#include <Resource.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
||||||
{
|
{
|
||||||
ZCutscene* cs = (ZCutscene*)res;
|
ZCutscene* cs = (ZCutscene*)res;
|
||||||
|
|
||||||
WriteHeader(cs, outPath, writer, Ship::ResourceType::Cutscene);
|
WriteHeader(cs, outPath, writer, Ship::ResourceType::SOH_Cutscene);
|
||||||
|
|
||||||
//writer->Write((uint32_t)cs->commands.size() + 2 + 2);
|
//writer->Write((uint32_t)cs->commands.size() + 2 + 2);
|
||||||
writer->Write((uint32_t)0);
|
writer->Write((uint32_t)0);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <Utils/BitConverter.h>
|
#include <Utils/BitConverter.h>
|
||||||
#include "StrHash64/StrHash64.h"
|
#include "StrHash64/StrHash64.h"
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
#include "PR/ultra64/gbi.h"
|
#include <libultraship/libultra/gbi.h>
|
||||||
#include <Globals.h>
|
#include <Globals.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "ZArray.h"
|
#include "ZArray.h"
|
||||||
//#include "OTRExporter.h"
|
//#include "OTRExporter.h"
|
||||||
#include <Utils/BinaryWriter.h>
|
#include <Utils/BinaryWriter.h>
|
||||||
#include <Resource.h>
|
#include <libultraship/bridge.h>
|
||||||
#include "VersionInfo.h"
|
#include "VersionInfo.h"
|
||||||
|
|
||||||
class OTRExporter : public ZResourceExporter
|
class OTRExporter : public ZResourceExporter
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <Archive.h>
|
#include "Main.h"
|
||||||
#include "BackgroundExporter.h"
|
#include "BackgroundExporter.h"
|
||||||
#include "TextureExporter.h"
|
#include "TextureExporter.h"
|
||||||
#include "RoomExporter.h"
|
#include "RoomExporter.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Archive.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
extern std::shared_ptr<Ship::Archive> otrArchive;
|
extern std::shared_ptr<Ship::Archive> otrArchive;
|
||||||
extern std::map<std::string, std::vector<char>> files;
|
extern std::map<std::string, std::vector<char>> files;
|
||||||
|
@ -5,7 +5,7 @@ void OTRExporter_Path::Save(ZResource* res, const fs::path& outPath, BinaryWrite
|
|||||||
{
|
{
|
||||||
ZPath* path = (ZPath*)res;
|
ZPath* path = (ZPath*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::Path);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_Path);
|
||||||
|
|
||||||
writer->Write((uint32_t)path->pathways.size());
|
writer->Write((uint32_t)path->pathways.size());
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "PlayerAnimationExporter.h"
|
#include "PlayerAnimationExporter.h"
|
||||||
#include <Resource.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
void OTRExporter_PlayerAnimationExporter::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
void OTRExporter_PlayerAnimationExporter::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
||||||
{
|
{
|
||||||
ZPlayerAnimationData* anim = (ZPlayerAnimationData*)res;
|
ZPlayerAnimationData* anim = (ZPlayerAnimationData*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::PlayerAnimation);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_PlayerAnimation);
|
||||||
|
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <ZRoom/Commands/SetAlternateHeaders.h>
|
#include <ZRoom/Commands/SetAlternateHeaders.h>
|
||||||
#include "CollisionExporter.h"
|
#include "CollisionExporter.h"
|
||||||
#include "DisplayListExporter.h"
|
#include "DisplayListExporter.h"
|
||||||
#include "Resource.h"
|
#include <libultraship/bridge.h>
|
||||||
#include <Globals.h>
|
#include <Globals.h>
|
||||||
#include <ZRoom/Commands/SetExitList.h>
|
#include <ZRoom/Commands/SetExitList.h>
|
||||||
#include <ZRoom/Commands/SetPathways.h>
|
#include <ZRoom/Commands/SetPathways.h>
|
||||||
@ -39,7 +39,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite
|
|||||||
{
|
{
|
||||||
ZRoom* room = (ZRoom*)res;
|
ZRoom* room = (ZRoom*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::Room);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_Room);
|
||||||
|
|
||||||
writer->Write((uint32_t)room->commands.size());
|
writer->Write((uint32_t)room->commands.size());
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "SkeletonExporter.h"
|
#include "SkeletonExporter.h"
|
||||||
#include <Resource.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Globals.h>
|
#include <Globals.h>
|
||||||
#include "DisplayListExporter.h"
|
#include "DisplayListExporter.h"
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ void OTRExporter_Skeleton::Save(ZResource* res, const fs::path& outPath, BinaryW
|
|||||||
{
|
{
|
||||||
ZSkeleton* skel = (ZSkeleton*)res;
|
ZSkeleton* skel = (ZSkeleton*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::Skeleton);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_Skeleton);
|
||||||
|
|
||||||
writer->Write((uint8_t)skel->type);
|
writer->Write((uint8_t)skel->type);
|
||||||
writer->Write((uint8_t)skel->limbType);
|
writer->Write((uint8_t)skel->limbType);
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "SkeletonLimbExporter.h"
|
#include "SkeletonLimbExporter.h"
|
||||||
#include "DisplayListExporter.h"
|
#include "DisplayListExporter.h"
|
||||||
#include <Resource.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Globals.h>
|
#include <Globals.h>
|
||||||
|
|
||||||
void OTRExporter_SkeletonLimb::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
void OTRExporter_SkeletonLimb::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
||||||
{
|
{
|
||||||
ZLimb* limb = (ZLimb*)res;
|
ZLimb* limb = (ZLimb*)res;
|
||||||
|
|
||||||
WriteHeader(res, outPath, writer, Ship::ResourceType::SkeletonLimb);
|
WriteHeader(res, outPath, writer, Ship::ResourceType::SOH_SkeletonLimb);
|
||||||
|
|
||||||
writer->Write((uint8_t)limb->type);
|
writer->Write((uint8_t)limb->type);
|
||||||
writer->Write((uint8_t)limb->skinSegmentType);
|
writer->Write((uint8_t)limb->skinSegmentType);
|
||||||
|
@ -5,7 +5,7 @@ void OTRExporter_Text::Save(ZResource* res, const fs::path& outPath, BinaryWrite
|
|||||||
{
|
{
|
||||||
ZText* txt = (ZText*)res;
|
ZText* txt = (ZText*)res;
|
||||||
|
|
||||||
WriteHeader(txt, outPath, writer, Ship::ResourceType::Text);
|
WriteHeader(txt, outPath, writer, Ship::ResourceType::SOH_Text);
|
||||||
|
|
||||||
writer->Write((uint32_t)txt->messages.size());
|
writer->Write((uint32_t)txt->messages.size());
|
||||||
|
|
||||||
|
@ -1,27 +1,25 @@
|
|||||||
#include "VersionInfo.h"
|
#include "VersionInfo.h"
|
||||||
#include <Resource.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
std::map<Ship::ResourceType, uint32_t> resourceVersions;
|
std::map<Ship::ResourceType, uint32_t> resourceVersions;
|
||||||
|
|
||||||
void InitVersionInfo()
|
void InitVersionInfo()
|
||||||
{
|
{
|
||||||
resourceVersions = std::map<Ship::ResourceType, uint32_t> {
|
resourceVersions = std::map<Ship::ResourceType, uint32_t> {
|
||||||
{ Ship::ResourceType::Animation, 0 },
|
{ Ship::ResourceType::SOH_Animation, 0 },
|
||||||
{ Ship::ResourceType::Model, 0 },
|
|
||||||
{ Ship::ResourceType::Texture, 0 },
|
{ Ship::ResourceType::Texture, 0 },
|
||||||
{ Ship::ResourceType::Material, 0 },
|
{ Ship::ResourceType::SOH_PlayerAnimation, 0 },
|
||||||
{ Ship::ResourceType::PlayerAnimation, 0 },
|
|
||||||
{ Ship::ResourceType::DisplayList, 0 },
|
{ Ship::ResourceType::DisplayList, 0 },
|
||||||
{ Ship::ResourceType::Room, 0 },
|
{ Ship::ResourceType::SOH_Room, 0 },
|
||||||
{ Ship::ResourceType::CollisionHeader, 0 },
|
{ Ship::ResourceType::SOH_CollisionHeader, 0 },
|
||||||
{ Ship::ResourceType::Skeleton, 0 },
|
{ Ship::ResourceType::SOH_Skeleton, 0 },
|
||||||
{ Ship::ResourceType::SkeletonLimb, 0 },
|
{ Ship::ResourceType::SOH_SkeletonLimb, 0 },
|
||||||
{ Ship::ResourceType::Matrix, 0 },
|
{ Ship::ResourceType::Matrix, 0 },
|
||||||
{ Ship::ResourceType::Path, 0 },
|
{ Ship::ResourceType::SOH_Path, 0 },
|
||||||
{ Ship::ResourceType::Vertex, 0 },
|
{ Ship::ResourceType::Vertex, 0 },
|
||||||
{ Ship::ResourceType::Cutscene, 0 },
|
{ Ship::ResourceType::SOH_Cutscene, 0 },
|
||||||
{ Ship::ResourceType::Array, 0 },
|
{ Ship::ResourceType::Array, 0 },
|
||||||
{ Ship::ResourceType::Text, 0 },
|
{ Ship::ResourceType::SOH_Text, 0 },
|
||||||
{ Ship::ResourceType::Blob, 0 },
|
{ Ship::ResourceType::Blob, 0 },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "VtxExporter.h"
|
#include "VtxExporter.h"
|
||||||
#include "Resource.h"
|
#include <libultraship/bridge.h>
|
||||||
#include "VersionInfo.h"
|
#include "VersionInfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define Z64CUTSCENE_H
|
#define Z64CUTSCENE_H
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u16 entrance; // entrance index upon which the cutscene should trigger
|
/* 0x00 */ u16 entrance; // entrance index upon which the cutscene should trigger
|
||||||
|
@ -336,6 +336,8 @@ find_package(PNG REQUIRED)
|
|||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/ZAPDUtils
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/ZAPDUtils
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/src/resource
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/tinyxml2
|
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/tinyxml2
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/libgfxd
|
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/libgfxd
|
||||||
${PNG_PNG_INCLUDE_DIR}/
|
${PNG_PNG_INCLUDE_DIR}/
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Declaration.h"
|
#include "Declaration.h"
|
||||||
#include "Utils/BinaryWriter.h"
|
#include <Utils/BinaryWriter.h>
|
||||||
#include "Utils/Directory.h"
|
#include <Utils/Directory.h>
|
||||||
#include "tinyxml2.h"
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
#define SEGMENT_SCENE 2
|
#define SEGMENT_SCENE 2
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit b1c75c86e902e5036ee1d36afad1a35313988fe7
|
Subproject commit c5bab5aef8a9dd77047438718de64fb2e27eedfc
|
@ -123,7 +123,7 @@ set(Header_Files__include
|
|||||||
#"include/stdbool_n64.h"
|
#"include/stdbool_n64.h"
|
||||||
#"include/stddef_n64.h"
|
#"include/stddef_n64.h"
|
||||||
#"include/stdlib_n64.h"
|
#"include/stdlib_n64.h"
|
||||||
"include/ultra64.h"
|
# "include/ultra64.h"
|
||||||
"include/unk.h"
|
"include/unk.h"
|
||||||
"include/variables.h"
|
"include/variables.h"
|
||||||
"include/vt.h"
|
"include/vt.h"
|
||||||
@ -288,6 +288,194 @@ set(Source_Files__soh
|
|||||||
)
|
)
|
||||||
source_group("Source Files\\soh" FILES ${Source_Files__soh})
|
source_group("Source Files\\soh" FILES ${Source_Files__soh})
|
||||||
|
|
||||||
|
set(Header_Files__soh__resourceTypes
|
||||||
|
"soh/resource/type/Animation.h"
|
||||||
|
"soh/resource/type/AudioSample.h"
|
||||||
|
"soh/resource/type/AudioSequence.h"
|
||||||
|
"soh/resource/type/AudioSoundFont.h"
|
||||||
|
"soh/resource/type/CollisionHeader.h"
|
||||||
|
"soh/resource/type/Cutscene.h"
|
||||||
|
"soh/resource/type/Path.h"
|
||||||
|
"soh/resource/type/PlayerAnimation.h"
|
||||||
|
"soh/resource/type/Scene.h"
|
||||||
|
"soh/resource/type/Skeleton.h"
|
||||||
|
"soh/resource/type/SkeletonLimb.h"
|
||||||
|
"soh/resource/type/Text.h"
|
||||||
|
"soh/resource/type/Background.h"
|
||||||
|
)
|
||||||
|
source_group("Header Files\\soh\\resource\\type" FILES ${Header_Files__soh__resourceTypes})
|
||||||
|
|
||||||
|
set(Source_Files__soh__resourceTypes
|
||||||
|
"soh/resource/type/Animation.cpp"
|
||||||
|
"soh/resource/type/AudioSample.cpp"
|
||||||
|
"soh/resource/type/AudioSequence.cpp"
|
||||||
|
"soh/resource/type/AudioSoundFont.cpp"
|
||||||
|
"soh/resource/type/CollisionHeader.cpp"
|
||||||
|
"soh/resource/type/Cutscene.cpp"
|
||||||
|
"soh/resource/type/Path.cpp"
|
||||||
|
"soh/resource/type/PlayerAnimation.cpp"
|
||||||
|
"soh/resource/type/Scene.cpp"
|
||||||
|
"soh/resource/type/Skeleton.cpp"
|
||||||
|
"soh/resource/type/SkeletonLimb.cpp"
|
||||||
|
"soh/resource/type/Text.cpp"
|
||||||
|
"soh/resource/type/Background.cpp"
|
||||||
|
)
|
||||||
|
source_group("Source Files\\soh\\resource\\type" FILES ${Source_Files__soh__resourceTypes})
|
||||||
|
|
||||||
|
set(Header_Files__soh__resourceFactories
|
||||||
|
"soh/resource/importer/AnimationFactory.h"
|
||||||
|
"soh/resource/importer/AudioSampleFactory.h"
|
||||||
|
"soh/resource/importer/AudioSequenceFactory.h"
|
||||||
|
"soh/resource/importer/AudioSoundFontFactory.h"
|
||||||
|
"soh/resource/importer/CollisionHeaderFactory.h"
|
||||||
|
"soh/resource/importer/CutsceneFactory.h"
|
||||||
|
"soh/resource/importer/PathFactory.h"
|
||||||
|
"soh/resource/importer/PlayerAnimationFactory.h"
|
||||||
|
"soh/resource/importer/SceneFactory.h"
|
||||||
|
"soh/resource/importer/SkeletonFactory.h"
|
||||||
|
"soh/resource/importer/SkeletonLimbFactory.h"
|
||||||
|
"soh/resource/importer/TextFactory.h"
|
||||||
|
"soh/resource/importer/BackgroundFactory.h"
|
||||||
|
)
|
||||||
|
source_group("Header Files\\soh\\resource\\importer" FILES ${Header_Files__soh__resourceFactories})
|
||||||
|
|
||||||
|
set(Source_Files__soh__resourceFactories
|
||||||
|
"soh/resource/importer/AnimationFactory.cpp"
|
||||||
|
"soh/resource/importer/AudioSampleFactory.cpp"
|
||||||
|
"soh/resource/importer/AudioSequenceFactory.cpp"
|
||||||
|
"soh/resource/importer/AudioSoundFontFactory.cpp"
|
||||||
|
"soh/resource/importer/CollisionHeaderFactory.cpp"
|
||||||
|
"soh/resource/importer/CutsceneFactory.cpp"
|
||||||
|
"soh/resource/importer/PathFactory.cpp"
|
||||||
|
"soh/resource/importer/PlayerAnimationFactory.cpp"
|
||||||
|
"soh/resource/importer/SceneFactory.cpp"
|
||||||
|
"soh/resource/importer/SkeletonFactory.cpp"
|
||||||
|
"soh/resource/importer/SkeletonLimbFactory.cpp"
|
||||||
|
"soh/resource/importer/TextFactory.cpp"
|
||||||
|
"soh/resource/importer/BackgroundFactory.cpp"
|
||||||
|
)
|
||||||
|
source_group("Source Files\\soh\\resource\\importer" FILES ${Source_Files__soh__resourceFactories})
|
||||||
|
|
||||||
|
set(Header_Files__soh__scenecommandTypes
|
||||||
|
"soh/resource/type/scenecommand/EndMarker.h"
|
||||||
|
"soh/resource/type/scenecommand/RomFile.h"
|
||||||
|
"soh/resource/type/scenecommand/SceneCommand.h"
|
||||||
|
"soh/resource/type/scenecommand/SetActorList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetAlternateHeaders.h"
|
||||||
|
"soh/resource/type/scenecommand/SetCameraSettings.h"
|
||||||
|
"soh/resource/type/scenecommand/SetCollisionHeader.h"
|
||||||
|
"soh/resource/type/scenecommand/SetCsCamera.h"
|
||||||
|
"soh/resource/type/scenecommand/SetCutscenes.h"
|
||||||
|
"soh/resource/type/scenecommand/SetEchoSettings.h"
|
||||||
|
"soh/resource/type/scenecommand/SetEntranceList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetExitList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetLightingSettings.h"
|
||||||
|
"soh/resource/type/scenecommand/SetLightList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetMesh.h"
|
||||||
|
"soh/resource/type/scenecommand/SetObjectList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetPathways.h"
|
||||||
|
"soh/resource/type/scenecommand/SetRoomBehavior.h"
|
||||||
|
"soh/resource/type/scenecommand/SetRoomList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetSkyboxModifier.h"
|
||||||
|
"soh/resource/type/scenecommand/SetSkyboxSettings.h"
|
||||||
|
"soh/resource/type/scenecommand/SetSoundSettings.h"
|
||||||
|
"soh/resource/type/scenecommand/SetSpecialObjects.h"
|
||||||
|
"soh/resource/type/scenecommand/SetStartPositionList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetTimeSettings.h"
|
||||||
|
"soh/resource/type/scenecommand/SetTransitionActorList.h"
|
||||||
|
"soh/resource/type/scenecommand/SetWindSettings.h"
|
||||||
|
)
|
||||||
|
source_group("Header Files\\soh\\resource\\type\\scenecommand" FILES ${Header_Files__soh__scenecommandTypes})
|
||||||
|
|
||||||
|
set(Source_Files__soh__scenecommandTypes
|
||||||
|
"soh/resource/type/scenecommand/EndMarker.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetActorList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetAlternateHeaders.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetCameraSettings.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetCollisionHeader.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetCsCamera.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetCutscenes.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetEchoSettings.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetEntranceList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetExitList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetLightingSettings.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetLightList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetMesh.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetObjectList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetPathways.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetRoomBehavior.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetRoomList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetSkyboxModifier.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetSkyboxSettings.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetSoundSettings.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetSpecialObjects.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetStartPositionList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetTimeSettings.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetTransitionActorList.cpp"
|
||||||
|
"soh/resource/type/scenecommand/SetWindSettings.cpp"
|
||||||
|
)
|
||||||
|
source_group("Source Files\\soh\\resource\\type\\scenecommand" FILES ${Source_Files__soh__scenecommandTypes})
|
||||||
|
|
||||||
|
set(Header_Files__soh__scenecommandFactories
|
||||||
|
"soh/resource/importer/scenecommand/EndMarkerFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetActorListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetCameraSettingsFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetCsCameraFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetCutscenesFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetEchoSettingsFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetEntranceListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetExitListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetLightingSettingsFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetLightListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetMeshFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetObjectListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetPathwaysFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetRoomListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetSoundSettingsFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetStartPositionListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetTimeSettingsFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetTransitionActorListFactory.h"
|
||||||
|
"soh/resource/importer/scenecommand/SetWindSettingsFactory.h"
|
||||||
|
)
|
||||||
|
source_group("Header Files\\soh\\resource\\importer\\scenecommand" FILES ${Header_Files__soh__scenecommandFactories})
|
||||||
|
|
||||||
|
set(Source_Files__soh__scenecommandFactories
|
||||||
|
"soh/resource/importer/scenecommand/EndMarkerFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SceneCommandFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetActorListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetCsCameraFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetCutscenesFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetEntranceListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetExitListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetLightListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetMeshFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetObjectListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetPathwaysFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetRoomListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp"
|
||||||
|
"soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp"
|
||||||
|
)
|
||||||
|
source_group("Source Files\\soh\\resource\\importer\\scenecommand" FILES ${Source_Files__soh__scenecommandFactories})
|
||||||
|
|
||||||
set(Source_Files__soh__Enhancements
|
set(Source_Files__soh__Enhancements
|
||||||
"soh/Enhancements/bootcommands.c"
|
"soh/Enhancements/bootcommands.c"
|
||||||
"soh/Enhancements/debugconsole.cpp"
|
"soh/Enhancements/debugconsole.cpp"
|
||||||
@ -1655,6 +1843,14 @@ set(ALL_FILES
|
|||||||
${Source_Files__src__overlays__gamestates__ovl_title}
|
${Source_Files__src__overlays__gamestates__ovl_title}
|
||||||
${Source_Files__src__overlays__misc__ovl_kaleido_scope}
|
${Source_Files__src__overlays__misc__ovl_kaleido_scope}
|
||||||
${Source_Files__src__overlays__misc__ovl_map_mark_data}
|
${Source_Files__src__overlays__misc__ovl_map_mark_data}
|
||||||
|
${Header_Files__soh__resourceTypes}
|
||||||
|
${Source_Files__soh__resourceTypes}
|
||||||
|
${Header_Files__soh__resourceFactories}
|
||||||
|
${Source_Files__soh__resourceFactories}
|
||||||
|
${Header_Files__soh__scenecommandTypes}
|
||||||
|
${Source_Files__soh__scenecommandTypes}
|
||||||
|
${Source_Files__soh__scenecommandFactories}
|
||||||
|
${Header_Files__soh__scenecommandFactories}
|
||||||
)
|
)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -1741,7 +1937,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/misc
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/misc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/core
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/core
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource/types
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource/type
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/audio
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/audio
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/Mercury
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/Mercury
|
||||||
@ -1752,6 +1948,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic/Fast3D/U64/PR
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic/Fast3D/U64/PR
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils
|
${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD/resource/type
|
||||||
${SDL2-INCLUDE}
|
${SDL2-INCLUDE}
|
||||||
${SDL2-NET-INCLUDE}
|
${SDL2-NET-INCLUDE}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/assets/
|
${CMAKE_CURRENT_SOURCE_DIR}/assets/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef FP_H
|
#ifndef FP_H
|
||||||
#define FP_H
|
#define FP_H
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
extern f32 qNaN0x3FFFFF;
|
extern f32 qNaN0x3FFFFF;
|
||||||
extern f32 qNaN0x10000;
|
extern f32 qNaN0x10000;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FUNCTIONS_H
|
#define FUNCTIONS_H
|
||||||
|
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define this thisx
|
#define this thisx
|
||||||
@ -97,8 +98,6 @@ void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s3
|
|||||||
void LogUtils_LogThreadId(const char* name, s32 line);
|
void LogUtils_LogThreadId(const char* name, s32 line);
|
||||||
void LogUtils_HungupThread(const char* name, s32 line);
|
void LogUtils_HungupThread(const char* name, s32 line);
|
||||||
void LogUtils_ResetHungup(void);
|
void LogUtils_ResetHungup(void);
|
||||||
s32 vsprintf(char* dst, const char* fmt, va_list args);
|
|
||||||
s32 sprintf(char* dst, const char* fmt, ...);
|
|
||||||
void __osPiCreateAccessQueue(void);
|
void __osPiCreateAccessQueue(void);
|
||||||
void __osPiGetAccess(void);
|
void __osPiGetAccess(void);
|
||||||
void __osPiRelAccess(void);
|
void __osPiRelAccess(void);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "soh/OTRGlobals.h"
|
#include "soh/OTRGlobals.h"
|
||||||
#include "soh/Enhancements/gameconsole.h"
|
#include "soh/Enhancements/gameconsole.h"
|
||||||
#include "soh/Enhancements/gameplaystats.h"
|
#include "soh/Enhancements/gameplaystats.h"
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
#define _AudioseqSegmentRomStart "Audioseq"
|
#define _AudioseqSegmentRomStart "Audioseq"
|
||||||
#define _AudiobankSegmentRomStart "Audiobank"
|
#define _AudiobankSegmentRomStart "Audiobank"
|
||||||
@ -38,4 +38,8 @@
|
|||||||
#define _z_select_staticSegmentRomStart 0
|
#define _z_select_staticSegmentRomStart 0
|
||||||
#define _z_select_staticSegmentRomEnd 0
|
#define _z_select_staticSegmentRomEnd 0
|
||||||
|
|
||||||
|
// TODO: POSIX/BSD Bug, this is a hack to fix the build compilation on any BSD system (Switch, Wii-U, Vita, etc)
|
||||||
|
// <sys/types.h> defines quad as a macro, which conflicts with the quad parameter on z_collision_check.c
|
||||||
|
#undef quad
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef MATH_H
|
#ifndef MATH_H
|
||||||
#define MATH_H
|
#define MATH_H
|
||||||
|
|
||||||
#include "ultra64/types.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
#define M_PI 3.14159265358979323846f
|
#define M_PI 3.14159265358979323846f
|
||||||
#define M_SQRT2 1.41421356237309504880f
|
#define M_SQRT2 1.41421356237309504880f
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef STDLIB_H
|
#ifndef STDLIB_H
|
||||||
#define STDLIB_H
|
#define STDLIB_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
@ -300,9 +300,9 @@ extern GraphicsContext* __gfxCtx;
|
|||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region SOH [Enhancements]
|
// #region SOH [Enhancements]
|
||||||
#define CHECK_EQUIPMENT_AGE(i, j) (CVar_GetS32("gTimelessEquipment", 0) || (gEquipAgeReqs[i][j] == 9) || (gEquipAgeReqs[i][j] == ((void)0, gSaveContext.linkAge)))
|
#define CHECK_EQUIPMENT_AGE(i, j) (CVarGetInteger("gTimelessEquipment", 0) || (gEquipAgeReqs[i][j] == 9) || (gEquipAgeReqs[i][j] == ((void)0, gSaveContext.linkAge)))
|
||||||
#define CHECK_SLOT_AGE(slotIndex) (CVar_GetS32("gTimelessEquipment", 0) || (gSlotAgeReqs[slotIndex] == 9) || gSlotAgeReqs[slotIndex] == ((void)0, gSaveContext.linkAge))
|
#define CHECK_SLOT_AGE(slotIndex) (CVarGetInteger("gTimelessEquipment", 0) || (gSlotAgeReqs[slotIndex] == 9) || gSlotAgeReqs[slotIndex] == ((void)0, gSaveContext.linkAge))
|
||||||
#define CHECK_ITEM_AGE(itemIndex) (CVar_GetS32("gTimelessEquipment", 0) || (gItemAgeReqs[itemIndex] == 9) || (gItemAgeReqs[itemIndex] == gSaveContext.linkAge))
|
#define CHECK_ITEM_AGE(itemIndex) (CVarGetInteger("gTimelessEquipment", 0) || (gItemAgeReqs[itemIndex] == 9) || (gItemAgeReqs[itemIndex] == gSaveContext.linkAge))
|
||||||
|
|
||||||
#define DPAD_ITEM(button) ((gSaveContext.buttonStatus[(button) + 5] != BTN_DISABLED) \
|
#define DPAD_ITEM(button) ((gSaveContext.buttonStatus[(button) + 5] != BTN_DISABLED) \
|
||||||
? gSaveContext.equips.buttonItems[(button) + 4] \
|
? gSaveContext.equips.buttonItems[(button) + 4] \
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
#ifndef ULTRA64_H
|
|
||||||
#define ULTRA64_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "ultra64/types.h"
|
|
||||||
#include "unk.h"
|
|
||||||
|
|
||||||
#include "libc/stdarg.h"
|
|
||||||
#include "libc/stdbool.h"
|
|
||||||
#include "libc/stddef.h"
|
|
||||||
#include "libc/stdlib.h"
|
|
||||||
#include "libc/math.h"
|
|
||||||
|
|
||||||
#include "ultra64/exception.h"
|
|
||||||
#include "ultra64/rcp.h"
|
|
||||||
#include "ultra64/rdp.h"
|
|
||||||
#include "ultra64/rsp.h"
|
|
||||||
#include "ultra64/thread.h"
|
|
||||||
#include "ultra64/convert.h"
|
|
||||||
#include "ultra64/time.h"
|
|
||||||
#include "ultra64/message.h"
|
|
||||||
#include "ultra64/sptask.h"
|
|
||||||
#include "ultra64/gu.h"
|
|
||||||
#include "ultra64/vi.h"
|
|
||||||
#include "ultra64/pi.h"
|
|
||||||
#include "ultra64/controller.h"
|
|
||||||
#include "ultra64/printf.h"
|
|
||||||
#include "ultra64/mbi.h"
|
|
||||||
#include "ultra64/pfs.h"
|
|
||||||
#include "ultra64/motor.h"
|
|
||||||
#include "ultra64/r4300.h"
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef Z64_H
|
#ifndef Z64_H
|
||||||
#define Z64_H
|
#define Z64_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
#include "ultra64/gs2dex.h"
|
#include "unk.h" // this used to get pulled in via ultra64.h
|
||||||
#include "z64save.h"
|
#include "z64save.h"
|
||||||
#include "z64light.h"
|
#include "z64light.h"
|
||||||
#include "z64bgcheck.h"
|
#include "z64bgcheck.h"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
#include "alignment.h"
|
#include "alignment.h"
|
||||||
#include "sequence.h"
|
#include "sequence.h"
|
||||||
#include "sfx.h"
|
#include "sfx.h"
|
||||||
#include <color.h>
|
#include <libultraship/color.h>
|
||||||
#include "ichain.h"
|
#include "ichain.h"
|
||||||
#include "regs.h"
|
#include "regs.h"
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ namespace Ship
|
|||||||
class Scene;
|
class Scene;
|
||||||
class DisplayList;
|
class DisplayList;
|
||||||
};
|
};
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SCREEN_WIDTH 320
|
#define SCREEN_WIDTH 320
|
||||||
@ -948,14 +949,6 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ Gfx* opa;
|
/* 0x00 */ Gfx* opa;
|
||||||
/* 0x04 */ Gfx* xlu;
|
/* 0x04 */ Gfx* xlu;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
Ship::DisplayList* opaDL;
|
|
||||||
Ship::DisplayList* xluDL;
|
|
||||||
#else
|
|
||||||
void* opaDL;
|
|
||||||
void* xluDL;
|
|
||||||
#endif
|
|
||||||
} PolygonDlist; // size = 0x8
|
} PolygonDlist; // size = 0x8
|
||||||
|
|
||||||
|
|
||||||
@ -1016,14 +1009,6 @@ typedef struct {
|
|||||||
/* 0x06 */ s16 unk_06;
|
/* 0x06 */ s16 unk_06;
|
||||||
/* 0x08 */ Gfx* opa;
|
/* 0x08 */ Gfx* opa;
|
||||||
/* 0x0C */ Gfx* xlu;
|
/* 0x0C */ Gfx* xlu;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
Ship::DisplayList* opaDL;
|
|
||||||
Ship::DisplayList* xluDL;
|
|
||||||
#else
|
|
||||||
void* opaDL;
|
|
||||||
void* xluDL;
|
|
||||||
#endif
|
|
||||||
} PolygonDlist2; // size = 0x8
|
} PolygonDlist2; // size = 0x8
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -1087,12 +1072,7 @@ typedef struct {
|
|||||||
/* 0x58 */ OSMesgQueue loadQueue;
|
/* 0x58 */ OSMesgQueue loadQueue;
|
||||||
/* 0x70 */ OSMesg loadMsg;
|
/* 0x70 */ OSMesg loadMsg;
|
||||||
/* 0x74 */ s16 unk_74[2]; // context-specific data used by the current scene draw config
|
/* 0x74 */ s16 unk_74[2]; // context-specific data used by the current scene draw config
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
Ship::Scene* roomToLoad;
|
|
||||||
#else
|
|
||||||
void* roomToLoad;
|
void* roomToLoad;
|
||||||
#endif
|
|
||||||
} RoomContext; // size = 0x78
|
} RoomContext; // size = 0x78
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -1310,13 +1290,7 @@ typedef struct PlayState {
|
|||||||
/* 0x000A4 */ s16 sceneNum;
|
/* 0x000A4 */ s16 sceneNum;
|
||||||
/* 0x000A6 */ u8 sceneConfig;
|
/* 0x000A6 */ u8 sceneConfig;
|
||||||
/* 0x000A7 */ char unk_A7[0x9];
|
/* 0x000A7 */ char unk_A7[0x9];
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
Ship::Scene* sceneSegment;
|
|
||||||
#else
|
|
||||||
/* 0x000B0 */ void* sceneSegment;
|
/* 0x000B0 */ void* sceneSegment;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 0x000B8 */ View view;
|
/* 0x000B8 */ View view;
|
||||||
/* 0x001E0 */ Camera mainCamera;
|
/* 0x001E0 */ Camera mainCamera;
|
||||||
/* 0x0034C */ Camera subCameras[NUM_CAMS - SUBCAM_FIRST];
|
/* 0x0034C */ Camera subCameras[NUM_CAMS - SUBCAM_FIRST];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64_ANIMATION_H
|
#ifndef Z64_ANIMATION_H
|
||||||
#define Z64_ANIMATION_H
|
#define Z64_ANIMATION_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
#include "z64dma.h"
|
#include "z64dma.h"
|
||||||
#include "z64math.h"
|
#include "z64math.h"
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ s32 order;
|
/* 0x00 */ s32 order;
|
||||||
/* 0x04 */ s32 npredictors;
|
/* 0x04 */ s32 npredictors;
|
||||||
/* 0x08 */ s16 book[]; // size 8 * order * npredictors. 8-byte aligned
|
/* 0x08 */ s16* book; // size 8 * order * npredictors. 8-byte aligned
|
||||||
} AdpcmBook; // size >= 0x8
|
} AdpcmBook; // size >= 0x8
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -137,7 +137,7 @@ typedef struct
|
|||||||
/* 0x00 */ u32 codec : 4;
|
/* 0x00 */ u32 codec : 4;
|
||||||
/* 0x00 */ u32 medium : 2;
|
/* 0x00 */ u32 medium : 2;
|
||||||
/* 0x00 */ u32 unk_bit26 : 1;
|
/* 0x00 */ u32 unk_bit26 : 1;
|
||||||
/* 0x00 */ u32 unk_bit25 : 1;
|
/* 0x00 */ u32 unk_bit25 : 1; // this has been named isRelocated in zret
|
||||||
/* 0x01 */ u32 size : 24;
|
/* 0x01 */ u32 size : 24;
|
||||||
};
|
};
|
||||||
u32 asU32;
|
u32 asU32;
|
||||||
@ -819,7 +819,7 @@ typedef struct {
|
|||||||
/* 0x0E */ u8 ttl; // duration after which the DMA can be discarded
|
/* 0x0E */ u8 ttl; // duration after which the DMA can be discarded
|
||||||
} SampleDma; // size = 0x10
|
} SampleDma; // size = 0x10
|
||||||
|
|
||||||
#include <ultra64/abi.h>
|
#include <libultraship/libultra/abi.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x0000 */ char unk_0000;
|
/* 0x0000 */ char unk_0000;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64CAMERA_H
|
#ifndef Z64CAMERA_H
|
||||||
#define Z64CAMERA_H
|
#define Z64CAMERA_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
#include "z64cutscene.h"
|
#include "z64cutscene.h"
|
||||||
|
|
||||||
#define CAM_STAT_CUT 0
|
#define CAM_STAT_CUT 0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64CUTSCENE_H
|
#ifndef Z64CUTSCENE_H
|
||||||
#define Z64CUTSCENE_H
|
#define Z64CUTSCENE_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u16 entrance; // entrance index upon which the cutscene should trigger
|
/* 0x00 */ u16 entrance; // entrance index upon which the cutscene should trigger
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64_DMA_H
|
#ifndef Z64_DMA_H
|
||||||
#define Z64_DMA_H
|
#define Z64_DMA_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ uintptr_t vromAddr; // VROM address (source)
|
/* 0x00 */ uintptr_t vromAddr; // VROM address (source)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64EFFECT_H
|
#ifndef Z64EFFECT_H
|
||||||
#define Z64EFFECT_H
|
#define Z64EFFECT_H
|
||||||
|
|
||||||
#include <color.h>
|
#include <libultraship/color.h>
|
||||||
|
|
||||||
struct GraphicsContext;
|
struct GraphicsContext;
|
||||||
struct PlayState;
|
struct PlayState;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64ELF_MESSAGE_H
|
#ifndef Z64ELF_MESSAGE_H
|
||||||
#define Z64ELF_MESSAGE_H
|
#define Z64ELF_MESSAGE_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
// Checks the condition and exits the script if the check passes
|
// Checks the condition and exits the script if the check passes
|
||||||
#define ELF_MSG_TYPE_CHECK 0
|
#define ELF_MSG_TYPE_CHECK 0
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef Z64LIGHT_H
|
#ifndef Z64LIGHT_H
|
||||||
#define Z64LIGHT_H
|
#define Z64LIGHT_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
#include "ultra64/gbi.h"
|
#include <libultraship/libultra/gbi.h>
|
||||||
#include "z64math.h"
|
#include "z64math.h"
|
||||||
#include <color.h>
|
#include <libultraship/color.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x0 */ s16 x;
|
/* 0x0 */ s16 x;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64MAP_MARK_H
|
#ifndef Z64MAP_MARK_H
|
||||||
#define Z64MAP_MARK_H
|
#define Z64MAP_MARK_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
|
||||||
#define MAP_MARK_NONE -1
|
#define MAP_MARK_NONE -1
|
||||||
#define MAP_MARK_CHEST 0
|
#define MAP_MARK_CHEST 0
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#ifndef Z64MATH_H
|
#ifndef Z64MATH_H
|
||||||
#define Z64MATH_H
|
#define Z64MATH_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
|
#include <include/libc/math.h>
|
||||||
|
|
||||||
#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z)
|
#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef Z64SAVE_H
|
#ifndef Z64SAVE_H
|
||||||
#define Z64SAVE_H
|
#define Z64SAVE_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
#include "z64math.h"
|
#include "z64math.h"
|
||||||
#include "z64audio.h"
|
#include "z64audio.h"
|
||||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef Z64TRANSITION_H
|
#ifndef Z64TRANSITION_H
|
||||||
#define Z64TRANSITION_H
|
#define Z64TRANSITION_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
#include <color.h>
|
#include <libultraship/color.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
f32 unk_0;
|
f32 unk_0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <CrashHandler.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
#include "gameconsole.h"
|
#include "gameconsole.h"
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
#include <ultra64.h>
|
#include <libultraship/libultra.h>
|
||||||
|
#include <libultraship/bridge.h>
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include <variables.h>
|
#include <variables.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
#include <ultra64/gbi.h>
|
|
||||||
#include <ultra64/gs2dex.h>
|
|
||||||
#include <ultra64/controller.h>
|
|
||||||
|
|
||||||
uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0;
|
uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0;
|
||||||
|
|
||||||
@ -22,12 +20,12 @@ static BootCommand sCommands[] = { { "--skiplogo", BootCommands_Command_SkipLogo
|
|||||||
|
|
||||||
void BootCommands_Init()
|
void BootCommands_Init()
|
||||||
{
|
{
|
||||||
CVar_RegisterS32("gDebugEnabled", 0);
|
CVarRegisterInteger("gDebugEnabled", 0);
|
||||||
CVar_RegisterS32("gLanguages", LANGUAGE_ENG);
|
CVarRegisterInteger("gLanguages", LANGUAGE_ENG);
|
||||||
CVar_RegisterS32("gInvertYAxis", 1);
|
CVarRegisterInteger("gInvertYAxis", 1);
|
||||||
CVar_SetS32("gRandoGenerating", 0); // Clear when a crash happened during rando seed generation
|
CVarSetInteger("gRandoGenerating", 0); // Clear when a crash happened during rando seed generation
|
||||||
#if defined(__SWITCH__) || defined(__WIIU__)
|
#if defined(__SWITCH__) || defined(__WIIU__)
|
||||||
CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u
|
CVarRegisterInteger("gControlNav", 1); // always enable controller nav on switch/wii u
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef _BOOTCOMMANDS_H_
|
#ifndef _BOOTCOMMANDS_H_
|
||||||
#define _BOOTCOMMANDS_H_
|
#define _BOOTCOMMANDS_H_
|
||||||
#include <ultra64.h>
|
#include <libultraship/libultra.h>
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
|
|
||||||
typedef s32 (*BootCommandFunc)(char** argv, s32 argc); // Returns the number of arguments it read
|
typedef s32 (*BootCommandFunc)(char** argv, s32 argc); // Returns the number of arguments it read
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include <ImGui/imgui.h>
|
#include <ImGui/imgui.h>
|
||||||
#include <ImGui/imgui_internal.h>
|
#include <ImGui/imgui_internal.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <UltraController.h>
|
#include <libultraship/libultra/controller.h>
|
||||||
#include <Utils/StringHelper.h>
|
#include <Utils/StringHelper.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ namespace GameControlEditor {
|
|||||||
// Draw a button mapping setting consisting of a padded label and button dropdown.
|
// Draw a button mapping setting consisting of a padded label and button dropdown.
|
||||||
// excludedButtons indicates which buttons are unavailable to choose from.
|
// excludedButtons indicates which buttons are unavailable to choose from.
|
||||||
void DrawMapping(CustomButtonMap& mapping, float labelWidth, N64ButtonMask excludedButtons) {
|
void DrawMapping(CustomButtonMap& mapping, float labelWidth, N64ButtonMask excludedButtons) {
|
||||||
N64ButtonMask currentButton = CVar_GetS32(mapping.cVarName, mapping.defaultBtn);
|
N64ButtonMask currentButton = CVarGetInteger(mapping.cVarName, mapping.defaultBtn);
|
||||||
|
|
||||||
const char* preview;
|
const char* preview;
|
||||||
if (buttonNames.contains(currentButton)) {
|
if (buttonNames.contains(currentButton)) {
|
||||||
@ -134,7 +134,7 @@ namespace GameControlEditor {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ImGui::Selectable(i->second, i->first == currentButton)) {
|
if (ImGui::Selectable(i->second, i->first == currentButton)) {
|
||||||
CVar_SetS32(mapping.cVarName, i->first);
|
CVarSetInteger(mapping.cVarName, i->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
@ -158,11 +158,11 @@ namespace GameControlEditor {
|
|||||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||||
UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", "gCustomOcarinaControls");
|
UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", "gCustomOcarinaControls");
|
||||||
|
|
||||||
if (CVar_GetS32("gCustomOcarinaControls", 0) == 1) {
|
if (CVarGetInteger("gCustomOcarinaControls", 0) == 1) {
|
||||||
if (ImGui::BeginTable("tableCustomMainOcarinaControls", 2, ImGuiTableFlags_SizingStretchProp)) {
|
if (ImGui::BeginTable("tableCustomMainOcarinaControls", 2, ImGuiTableFlags_SizingStretchProp)) {
|
||||||
float labelWidth;
|
float labelWidth;
|
||||||
N64ButtonMask disableMask = BTN_B;
|
N64ButtonMask disableMask = BTN_B;
|
||||||
if (CVar_GetS32("gDpadOcarina", 0)) {
|
if (CVarGetInteger("gDpadOcarina", 0)) {
|
||||||
disableMask |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT;
|
disableMask |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,11 +242,11 @@ namespace GameControlEditor {
|
|||||||
UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", "gDisableAutoCenterViewFirstPerson");
|
UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", "gDisableAutoCenterViewFirstPerson");
|
||||||
DrawHelpIcon("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
|
DrawHelpIcon("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false);
|
||||||
if (CVar_GetS32("gEnableFirstPersonSensitivity", 0)) {
|
if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
|
||||||
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Sensitivity: %d %%", "##FirstPersonSensitivity",
|
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Sensitivity: %d %%", "##FirstPersonSensitivity",
|
||||||
"gFirstPersonCameraSensitivity", 0.01f, 5.0f, "", 1.0f, true, true);
|
"gFirstPersonCameraSensitivity", 0.01f, 5.0f, "", 1.0f, true, true);
|
||||||
} else {
|
} else {
|
||||||
CVar_SetFloat("gFirstPersonCameraSensitivity", 1.0f);
|
CVarSetFloat("gFirstPersonCameraSensitivity", 1.0f);
|
||||||
}
|
}
|
||||||
SohImGui::EndGroupPanel();
|
SohImGui::EndGroupPanel();
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ namespace GameControlEditor {
|
|||||||
SohImGui::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail());
|
SohImGui::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail());
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Enable walk speed modifiers", "gEnableWalkModify", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Enable walk speed modifiers", "gEnableWalkModify", true, false);
|
||||||
DrawHelpIcon("Hold the assigned button to change the maximum walking speed\nTo change the assigned button, go into the Ports tabs above");
|
DrawHelpIcon("Hold the assigned button to change the maximum walking speed\nTo change the assigned button, go into the Ports tabs above");
|
||||||
if (CVar_GetS32("gEnableWalkModify", 0)) {
|
if (CVarGetInteger("gEnableWalkModify", 0)) {
|
||||||
UIWidgets::Spacer(5);
|
UIWidgets::Spacer(5);
|
||||||
SohImGui::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail());
|
SohImGui::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail());
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
|
||||||
@ -317,7 +317,7 @@ namespace GameControlEditor {
|
|||||||
|
|
||||||
void DrawUI(bool& open) {
|
void DrawUI(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gGameControlEditorEnabled", false);
|
CVarSetInteger("gGameControlEditorEnabled", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
|
|
||||||
#define PATCH_GFX(path, name, cvar, index, instruction) \
|
#define PATCH_GFX(path, name, cvar, index, instruction) \
|
||||||
if (CVar_GetS32(cvar, 0)) { \
|
if (CVarGetInteger(cvar, 0)) { \
|
||||||
ResourceMgr_PatchGfxByName(path, name, index, instruction); \
|
ResourceMgr_PatchGfxByName(path, name, index, instruction); \
|
||||||
} else { \
|
} else { \
|
||||||
ResourceMgr_UnpatchGfxByName(path, name); \
|
ResourceMgr_UnpatchGfxByName(path, name); \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifdef ENABLE_CROWD_CONTROL
|
#ifdef ENABLE_CROWD_CONTROL
|
||||||
|
|
||||||
#include "CrowdControl.h"
|
#include "CrowdControl.h"
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Console.h>
|
#include <Console.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
@ -27,7 +27,7 @@ extern "C" {
|
|||||||
extern PlayState* gPlayState;
|
extern PlayState* gPlayState;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include "overlays/actors/ovl_En_Niw/z_en_niw.h"
|
#include "overlays/actors/ovl_En_Niw/z_en_niw.h"
|
||||||
|
|
||||||
#define CMD_REGISTER SohImGui::GetConsole()->AddCommand
|
#define CMD_REGISTER SohImGui::GetConsole()->AddCommand
|
||||||
@ -944,9 +944,9 @@ static bool SetCVarHandler(std::shared_ptr<Ship::Console> Console, const std::ve
|
|||||||
int vType = CheckVarType(args[2]);
|
int vType = CheckVarType(args[2]);
|
||||||
|
|
||||||
if (vType == VARTYPE_STRING)
|
if (vType == VARTYPE_STRING)
|
||||||
CVar_SetString(args[1].c_str(), args[2].c_str());
|
CVarSetString(args[1].c_str(), args[2].c_str());
|
||||||
else if (vType == VARTYPE_FLOAT)
|
else if (vType == VARTYPE_FLOAT)
|
||||||
CVar_SetFloat((char*)args[1].c_str(), std::stof(args[2]));
|
CVarSetFloat((char*)args[1].c_str(), std::stof(args[2]));
|
||||||
else if (vType == VARTYPE_RGBA)
|
else if (vType == VARTYPE_RGBA)
|
||||||
{
|
{
|
||||||
uint32_t val = std::stoul(&args[2].c_str()[1], nullptr, 16);
|
uint32_t val = std::stoul(&args[2].c_str()[1], nullptr, 16);
|
||||||
@ -955,12 +955,12 @@ static bool SetCVarHandler(std::shared_ptr<Ship::Console> Console, const std::ve
|
|||||||
clr.g = val >> 16;
|
clr.g = val >> 16;
|
||||||
clr.b = val >> 8;
|
clr.b = val >> 8;
|
||||||
clr.a = val & 0xFF;
|
clr.a = val & 0xFF;
|
||||||
CVar_SetRGBA((char*)args[1].c_str(), clr);
|
CVarSetColor((char*)args[1].c_str(), clr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CVar_SetS32(args[1].c_str(), std::stoi(args[2]));
|
CVarSetInteger(args[1].c_str(), std::stoi(args[2]));
|
||||||
|
|
||||||
CVar_Save();
|
CVarSave();
|
||||||
|
|
||||||
//SohImGui::GetConsole()->SendInfoMessage("[SOH] Updated player position to [ %.2f, %.2f, %.2f ]", pos.x, pos.y, pos.z);
|
//SohImGui::GetConsole()->SendInfoMessage("[SOH] Updated player position to [ %.2f, %.2f, %.2f ]", pos.x, pos.y, pos.z);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -970,18 +970,18 @@ static bool GetCVarHandler(std::shared_ptr<Ship::Console> Console, const std::ve
|
|||||||
if (args.size() < 2)
|
if (args.size() < 2)
|
||||||
return CMD_FAILED;
|
return CMD_FAILED;
|
||||||
|
|
||||||
CVar* cvar = CVar_Get(args[1].c_str());
|
auto cvar = CVarGet(args[1].c_str());
|
||||||
|
|
||||||
if (cvar != nullptr)
|
if (cvar != nullptr)
|
||||||
{
|
{
|
||||||
if (cvar->Type == CVarType::S32)
|
if (cvar->Type == Ship::ConsoleVariableType::Integer)
|
||||||
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %i", args[1].c_str(), cvar->value.ValueS32);
|
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %i", args[1].c_str(), cvar->Integer);
|
||||||
else if (cvar->Type == CVarType::Float)
|
else if (cvar->Type == Ship::ConsoleVariableType::Float)
|
||||||
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %f", args[1].c_str(), cvar->value.ValueFloat);
|
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %f", args[1].c_str(), cvar->Float);
|
||||||
else if (cvar->Type == CVarType::String)
|
else if (cvar->Type == Ship::ConsoleVariableType::String)
|
||||||
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %s", args[1].c_str(), cvar->value.ValueStr);
|
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %s", args[1].c_str(), cvar->String.c_str());
|
||||||
else if (cvar->Type == CVarType::RGBA)
|
else if (cvar->Type == Ship::ConsoleVariableType::Color)
|
||||||
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %08X", args[1].c_str(), cvar->value.ValueRGBA);
|
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %08X", args[1].c_str(), cvar->Color);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1159,5 +1159,5 @@ void DebugConsole_Init(void) {
|
|||||||
|
|
||||||
CMD_REGISTER("cucco_storm", { CuccoStormHandler, "Cucco Storm" });
|
CMD_REGISTER("cucco_storm", { CuccoStormHandler, "Cucco Storm" });
|
||||||
|
|
||||||
CVar_Load();
|
CVarLoad();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <bit>
|
#include <bit>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -531,7 +531,7 @@ void PopulateActorDropdown(int i, std::vector<Actor*>& data) {
|
|||||||
|
|
||||||
void DrawActorViewer(bool& open) {
|
void DrawActorViewer(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gActorViewerEnabled", 0);
|
CVarSetInteger("gActorViewerEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -53,7 +53,7 @@ static std::vector<Vtx> sphereVtx;
|
|||||||
// Draws the ImGui window for the collision viewer
|
// Draws the ImGui window for the collision viewer
|
||||||
void DrawColViewerWindow(bool& open) {
|
void DrawColViewerWindow(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gCollisionViewerEnabled", 0);
|
CVarSetInteger("gCollisionViewerEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
|
|||||||
alpha = 0xFF;
|
alpha = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gColViewerDecal", 0) != 0) {
|
if (CVarGetInteger("gColViewerDecal", 0) != 0) {
|
||||||
rm |= ZMODE_DEC;
|
rm |= ZMODE_DEC;
|
||||||
} else if (setting == ColRenderSetting::Transparent) {
|
} else if (setting == ColRenderSetting::Transparent) {
|
||||||
rm |= ZMODE_XLU;
|
rm |= ZMODE_XLU;
|
||||||
@ -327,7 +327,7 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
|
|||||||
gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE));
|
gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE));
|
||||||
gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2));
|
gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2));
|
||||||
|
|
||||||
if (CVar_GetS32("gColViewerShaded", 0) != 0) {
|
if (CVarGetInteger("gColViewerShaded", 0) != 0) {
|
||||||
gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA));
|
gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA));
|
||||||
gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING));
|
gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING));
|
||||||
} else {
|
} else {
|
||||||
@ -340,9 +340,9 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
|
|||||||
|
|
||||||
// Draws a dynapoly structure (scenes or Bg Actors)
|
// Draws a dynapoly structure (scenes or Bg Actors)
|
||||||
void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
|
void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
|
||||||
uint32_t colorR = CVar_GetS32("gColViewerColorNormalR", 255);
|
uint32_t colorR = CVarGetInteger("gColViewerColorNormalR", 255);
|
||||||
uint32_t colorG = CVar_GetS32("gColViewerColorNormalG", 255);
|
uint32_t colorG = CVarGetInteger("gColViewerColorNormalG", 255);
|
||||||
uint32_t colorB = CVar_GetS32("gColViewerColorNormalB", 255);
|
uint32_t colorB = CVarGetInteger("gColViewerColorNormalB", 255);
|
||||||
uint32_t colorA = 255;
|
uint32_t colorA = 255;
|
||||||
|
|
||||||
uint32_t lastColorR = colorR;
|
uint32_t lastColorR = colorR;
|
||||||
@ -359,35 +359,35 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
|
|||||||
CollisionPoly* poly = &col->polyList[i];
|
CollisionPoly* poly = &col->polyList[i];
|
||||||
|
|
||||||
if (SurfaceType_IsHookshotSurface(&gPlayState->colCtx, poly, bgId)) {
|
if (SurfaceType_IsHookshotSurface(&gPlayState->colCtx, poly, bgId)) {
|
||||||
colorR = CVar_GetS32("gColViewerColorHookshotR", 128);
|
colorR = CVarGetInteger("gColViewerColorHookshotR", 128);
|
||||||
colorG = CVar_GetS32("gColViewerColorHookshotG", 128);
|
colorG = CVarGetInteger("gColViewerColorHookshotG", 128);
|
||||||
colorB = CVar_GetS32("gColViewerColorHookshotB", 255);
|
colorB = CVarGetInteger("gColViewerColorHookshotB", 255);
|
||||||
} else if (func_80041D94(&gPlayState->colCtx, poly, bgId) > 0x01) {
|
} else if (func_80041D94(&gPlayState->colCtx, poly, bgId) > 0x01) {
|
||||||
colorR = CVar_GetS32("gColViewerColorInteractableR", 192);
|
colorR = CVarGetInteger("gColViewerColorInteractableR", 192);
|
||||||
colorG = CVar_GetS32("gColViewerColorInteractableG", 0);
|
colorG = CVarGetInteger("gColViewerColorInteractableG", 0);
|
||||||
colorB = CVar_GetS32("gColViewerColorInteractableB", 192);
|
colorB = CVarGetInteger("gColViewerColorInteractableB", 192);
|
||||||
} else if (func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x0C) {
|
} else if (func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x0C) {
|
||||||
colorR = CVar_GetS32("gColViewerColorVoidR", 255);
|
colorR = CVarGetInteger("gColViewerColorVoidR", 255);
|
||||||
colorG = CVar_GetS32("gColViewerColorVoidG", 0);
|
colorG = CVarGetInteger("gColViewerColorVoidG", 0);
|
||||||
colorB = CVar_GetS32("gColViewerColorVoidB", 0);
|
colorB = CVarGetInteger("gColViewerColorVoidB", 0);
|
||||||
} else if (SurfaceType_GetSceneExitIndex(&gPlayState->colCtx, poly, bgId) ||
|
} else if (SurfaceType_GetSceneExitIndex(&gPlayState->colCtx, poly, bgId) ||
|
||||||
func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x05) {
|
func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x05) {
|
||||||
colorR = CVar_GetS32("gColViewerColorEntranceR", 0);
|
colorR = CVarGetInteger("gColViewerColorEntranceR", 0);
|
||||||
colorG = CVar_GetS32("gColViewerColorEntranceG", 255);
|
colorG = CVarGetInteger("gColViewerColorEntranceG", 255);
|
||||||
colorB = CVar_GetS32("gColViewerColorEntranceB", 0);
|
colorB = CVarGetInteger("gColViewerColorEntranceB", 0);
|
||||||
} else if (func_80041D4C(&gPlayState->colCtx, poly, bgId) != 0 ||
|
} else if (func_80041D4C(&gPlayState->colCtx, poly, bgId) != 0 ||
|
||||||
SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) {
|
SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) {
|
||||||
colorR = CVar_GetS32("gColViewerColorSpecialSurfaceR", 192);
|
colorR = CVarGetInteger("gColViewerColorSpecialSurfaceR", 192);
|
||||||
colorG = CVar_GetS32("gColViewerColorSpecialSurfaceG", 255);
|
colorG = CVarGetInteger("gColViewerColorSpecialSurfaceG", 255);
|
||||||
colorB = CVar_GetS32("gColViewerColorSpecialSurfaceB", 192);
|
colorB = CVarGetInteger("gColViewerColorSpecialSurfaceB", 192);
|
||||||
} else if (SurfaceType_GetSlope(&gPlayState->colCtx, poly, bgId) == 0x01) {
|
} else if (SurfaceType_GetSlope(&gPlayState->colCtx, poly, bgId) == 0x01) {
|
||||||
colorR = CVar_GetS32("gColViewerColorSlopeR", 255);
|
colorR = CVarGetInteger("gColViewerColorSlopeR", 255);
|
||||||
colorG = CVar_GetS32("gColViewerColorSlopeG", 255);
|
colorG = CVarGetInteger("gColViewerColorSlopeG", 255);
|
||||||
colorB = CVar_GetS32("gColViewerColorSlopeB", 128);
|
colorB = CVarGetInteger("gColViewerColorSlopeB", 128);
|
||||||
} else {
|
} else {
|
||||||
colorR = CVar_GetS32("gColViewerColorNormalR", 255);
|
colorR = CVarGetInteger("gColViewerColorNormalR", 255);
|
||||||
colorG = CVar_GetS32("gColViewerColorNormalG", 255);
|
colorG = CVarGetInteger("gColViewerColorNormalG", 255);
|
||||||
colorB = CVar_GetS32("gColViewerColorNormalB", 255);
|
colorB = CVarGetInteger("gColViewerColorNormalB", 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colorR != lastColorR || colorG != lastColorG || colorB != lastColorB) {
|
if (colorR != lastColorR || colorG != lastColorG || colorB != lastColorB) {
|
||||||
@ -435,9 +435,9 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
|
|||||||
|
|
||||||
// Draws the scene
|
// Draws the scene
|
||||||
void DrawSceneCollision() {
|
void DrawSceneCollision() {
|
||||||
ColRenderSetting showSceneColSetting = (ColRenderSetting)CVar_GetS32("gColViewerScene", 0);
|
ColRenderSetting showSceneColSetting = (ColRenderSetting)CVarGetInteger("gColViewerScene", 0);
|
||||||
|
|
||||||
if (showSceneColSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
|
if (showSceneColSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,8 +450,8 @@ void DrawSceneCollision() {
|
|||||||
|
|
||||||
// Draws all Bg Actors
|
// Draws all Bg Actors
|
||||||
void DrawBgActorCollision() {
|
void DrawBgActorCollision() {
|
||||||
ColRenderSetting showBgActorSetting = (ColRenderSetting)CVar_GetS32("gColViewerBgActors", 0);
|
ColRenderSetting showBgActorSetting = (ColRenderSetting)CVarGetInteger("gColViewerBgActors", 0);
|
||||||
if (showBgActorSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
|
if (showBgActorSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,8 +575,8 @@ void DrawColCheckList(std::vector<Gfx>& dl, Collider** objects, int32_t count) {
|
|||||||
|
|
||||||
// Draws all Col Check objects
|
// Draws all Col Check objects
|
||||||
void DrawColCheckCollision() {
|
void DrawColCheckCollision() {
|
||||||
ColRenderSetting showColCheckSetting = (ColRenderSetting)CVar_GetS32("gColViewerColCheck", 0);
|
ColRenderSetting showColCheckSetting = (ColRenderSetting)CVarGetInteger("gColViewerColCheck", 0);
|
||||||
if (showColCheckSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
|
if (showColCheckSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,14 +586,14 @@ void DrawColCheckCollision() {
|
|||||||
|
|
||||||
CollisionCheckContext& col = gPlayState->colChkCtx;
|
CollisionCheckContext& col = gPlayState->colChkCtx;
|
||||||
|
|
||||||
dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorOCR", 255), CVar_GetS32("gColViewerColorOCG", 255),
|
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorOCR", 255), CVarGetInteger("gColViewerColorOCG", 255),
|
||||||
CVar_GetS32("gColViewerColorOCB", 255), 255));
|
CVarGetInteger("gColViewerColorOCB", 255), 255));
|
||||||
DrawColCheckList(dl, col.colOC, col.colOCCount);
|
DrawColCheckList(dl, col.colOC, col.colOCCount);
|
||||||
dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorACR", 0), CVar_GetS32("gColViewerColorACG", 0),
|
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorACR", 0), CVarGetInteger("gColViewerColorACG", 0),
|
||||||
CVar_GetS32("gColViewerColorACB", 255), 255));
|
CVarGetInteger("gColViewerColorACB", 255), 255));
|
||||||
DrawColCheckList(dl, col.colAC, col.colACCount);
|
DrawColCheckList(dl, col.colAC, col.colACCount);
|
||||||
dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorATR", 255), CVar_GetS32("gColViewerColorATG", 0),
|
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorATR", 255), CVarGetInteger("gColViewerColorATG", 0),
|
||||||
CVar_GetS32("gColViewerColorATB", 0), 255));
|
CVarGetInteger("gColViewerColorATB", 0), 255));
|
||||||
|
|
||||||
DrawColCheckList(dl, col.colAT, col.colATCount);
|
DrawColCheckList(dl, col.colAT, col.colATCount);
|
||||||
}
|
}
|
||||||
@ -628,8 +628,8 @@ extern "C" f32 zdWaterBoxMinY;
|
|||||||
|
|
||||||
// Draws all waterboxes
|
// Draws all waterboxes
|
||||||
void DrawWaterboxList() {
|
void DrawWaterboxList() {
|
||||||
ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVar_GetS32("gColViewerWaterbox", 0);
|
ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVarGetInteger("gColViewerWaterbox", 0);
|
||||||
if (showWaterboxSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
|
if (showWaterboxSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,9 +637,9 @@ void DrawWaterboxList() {
|
|||||||
InitGfx(dl, showWaterboxSetting);
|
InitGfx(dl, showWaterboxSetting);
|
||||||
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
|
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
|
||||||
|
|
||||||
dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorWaterboxR", 0),
|
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorWaterboxR", 0),
|
||||||
CVar_GetS32("gColViewerColorWaterboxG", 0),
|
CVarGetInteger("gColViewerColorWaterboxG", 0),
|
||||||
CVar_GetS32("gColViewerColorWaterboxB", 255), 255));
|
CVarGetInteger("gColViewerColorWaterboxB", 255), 255));
|
||||||
|
|
||||||
CollisionHeader* col = gPlayState->colCtx.colHeader;
|
CollisionHeader* col = gPlayState->colCtx.colHeader;
|
||||||
for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) {
|
for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <bit>
|
#include <bit>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -1622,7 +1622,7 @@ void DrawPlayerTab() {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL);
|
ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL);
|
||||||
|
|
||||||
if (CVar_GetS32("gDpadEquips", 0)) {
|
if (CVarGetInteger("gDpadEquips", 0)) {
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::Text("Current D-pad Equips");
|
ImGui::Text("Current D-pad Equips");
|
||||||
ImGui::InputScalar("D-pad Up ", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[4], &one, NULL); // Two spaces at the end for aligning, not elegant but it's working
|
ImGui::InputScalar("D-pad Up ", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[4], &one, NULL); // Two spaces at the end for aligning, not elegant but it's working
|
||||||
@ -1663,7 +1663,7 @@ void DrawPlayerTab() {
|
|||||||
|
|
||||||
void DrawSaveEditor(bool& open) {
|
void DrawSaveEditor(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gSaveEditorEnabled", 0);
|
CVarSetInteger("gSaveEditorEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ extern "C" uint8_t GetRandomizedEnemy(PlayState* play, int16_t *actorId, f32 *po
|
|||||||
}
|
}
|
||||||
|
|
||||||
EnemyEntry GetRandomizedEnemyEntry(uint32_t seed) {
|
EnemyEntry GetRandomizedEnemyEntry(uint32_t seed) {
|
||||||
if (CVar_GetS32("gSeededRandomizedEnemies", 0) && gSaveContext.n64ddFlag) {
|
if (CVarGetInteger("gSeededRandomizedEnemies", 0) && gSaveContext.n64ddFlag) {
|
||||||
uint32_t finalSeed = seed + gSaveContext.seedIcons[0] + gSaveContext.seedIcons[1] + gSaveContext.seedIcons[2] +
|
uint32_t finalSeed = seed + gSaveContext.seedIcons[0] + gSaveContext.seedIcons[1] + gSaveContext.seedIcons[2] +
|
||||||
gSaveContext.seedIcons[3] + gSaveContext.seedIcons[4];
|
gSaveContext.seedIcons[3] + gSaveContext.seedIcons[4];
|
||||||
Random_Init(finalSeed);
|
Random_Init(finalSeed);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
typedef struct EnemyEntry {
|
typedef struct EnemyEntry {
|
||||||
int16_t id;
|
int16_t id;
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
#include "../OTRGlobals.h"
|
#include "../OTRGlobals.h"
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
#include <ultra64.h>
|
#include <libultraship/libultra.h>
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include <variables.h>
|
#include <variables.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
#include <ultra64/gbi.h>
|
#include <libultraship/libultra/gbi.h>
|
||||||
#include <ultra64/gs2dex.h>
|
#include <libultraship/libultra/gs2dex.h>
|
||||||
#include <ultra64/controller.h>
|
#include <libultraship/libultra/controller.h>
|
||||||
#include <string.h> /* memcpy */
|
#include <string.h> /* memcpy */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef _GAMECONSOLE_H_
|
#ifndef _GAMECONSOLE_H_
|
||||||
#define _GAMECONSOLE_H_
|
#define _GAMECONSOLE_H_
|
||||||
|
|
||||||
#include <ultra64.h>
|
#include <libultraship/libultra.h>
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
#define MAX_CVARS 2048
|
#define MAX_CVARS 2048
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Hooks.h>
|
#include <Hooks.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -110,7 +110,7 @@ void DisplayStatIfNonZero(const char* text, uint32_t value) {
|
|||||||
|
|
||||||
void DrawStatsTracker(bool& open) {
|
void DrawStatsTracker(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gGameplayStatsEnabled", 0);
|
CVarSetInteger("gGameplayStatsEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ void DrawStatsTracker(bool& open) {
|
|||||||
DisplayStat("Sword Swings: ", gSaveContext.sohStats.count[COUNT_SWORD_SWINGS]);
|
DisplayStat("Sword Swings: ", gSaveContext.sohStats.count[COUNT_SWORD_SWINGS]);
|
||||||
DisplayStat("Steps Taken: ", gSaveContext.sohStats.count[COUNT_STEPS]);
|
DisplayStat("Steps Taken: ", gSaveContext.sohStats.count[COUNT_STEPS]);
|
||||||
// If using MM Bunny Hood enhancement, show how long it's been equipped (not counting pause time)
|
// If using MM Bunny Hood enhancement, show how long it's been equipped (not counting pause time)
|
||||||
if (CVar_GetS32("gMMBunnyHood", 0) || gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] > 0) {
|
if (CVarGetInteger("gMMBunnyHood", 0) || gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] > 0) {
|
||||||
DisplayTimeHHMMSS(gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] / 2, "Bunny Hood Time: ", COLOR_WHITE);
|
DisplayTimeHHMMSS(gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] / 2, "Bunny Hood Time: ", COLOR_WHITE);
|
||||||
}
|
}
|
||||||
DisplayStat("Rolls: ", gSaveContext.sohStats.count[COUNT_ROLLS]);
|
DisplayStat("Rolls: ", gSaveContext.sohStats.count[COUNT_ROLLS]);
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include "soh/UIWidgets.hpp"
|
#include "soh/UIWidgets.hpp"
|
||||||
|
|
||||||
void clearCvars(std::vector<const char*> cvarsToClear) {
|
void clearCvars(std::vector<const char*> cvarsToClear) {
|
||||||
for(const char* cvar : cvarsToClear) {
|
for(const char* cvar : cvarsToClear) {
|
||||||
CVar_Clear(cvar);
|
CVarClear(cvar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,13 +16,13 @@ void applyPreset(std::vector<PresetEntry> entries) {
|
|||||||
for(auto& [cvar, type, value] : entries) {
|
for(auto& [cvar, type, value] : entries) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PRESET_ENTRY_TYPE_S32:
|
case PRESET_ENTRY_TYPE_S32:
|
||||||
CVar_SetS32(cvar, std::get<int32_t>(value));
|
CVarSetInteger(cvar, std::get<int32_t>(value));
|
||||||
break;
|
break;
|
||||||
case PRESET_ENTRY_TYPE_FLOAT:
|
case PRESET_ENTRY_TYPE_FLOAT:
|
||||||
CVar_SetFloat(cvar, std::get<float>(value));
|
CVarSetFloat(cvar, std::get<float>(value));
|
||||||
break;
|
break;
|
||||||
case PRESET_ENTRY_TYPE_STRING:
|
case PRESET_ENTRY_TYPE_STRING:
|
||||||
CVar_SetString(cvar, std::get<const char*>(value));
|
CVarSetString(cvar, std::get<const char*>(value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ void applyPreset(std::vector<PresetEntry> entries) {
|
|||||||
void DrawPresetSelector(PresetType presetTypeId) {
|
void DrawPresetSelector(PresetType presetTypeId) {
|
||||||
const std::string presetTypeCvar = "gPreset" + std::to_string(presetTypeId);
|
const std::string presetTypeCvar = "gPreset" + std::to_string(presetTypeId);
|
||||||
const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId);
|
const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId);
|
||||||
const uint16_t selectedPresetId = CVar_GetS32(presetTypeCvar.c_str(), 0);
|
const uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0);
|
||||||
const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId);
|
const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId);
|
||||||
std::string comboboxTooltip = "";
|
std::string comboboxTooltip = "";
|
||||||
for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) {
|
for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) {
|
||||||
@ -43,7 +43,7 @@ void DrawPresetSelector(PresetType presetTypeId) {
|
|||||||
if (ImGui::BeginCombo("##PresetsComboBox", selectedPresetDef.label)) {
|
if (ImGui::BeginCombo("##PresetsComboBox", selectedPresetDef.label)) {
|
||||||
for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) {
|
for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) {
|
||||||
if (ImGui::Selectable(iter->second.label, iter->first == selectedPresetId)) {
|
if (ImGui::Selectable(iter->second.label, iter->first == selectedPresetId)) {
|
||||||
CVar_SetS32(presetTypeCvar.c_str(), iter->first);
|
CVarSetInteger(presetTypeCvar.c_str(), iter->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
#include "location_access.hpp"
|
#include "location_access.hpp"
|
||||||
#include "rando_main.hpp"
|
#include "rando_main.hpp"
|
||||||
// #include <soh/Enhancements/randomizer.h>
|
// #include <soh/Enhancements/randomizer.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <ultra64/types.h>
|
#include <libultraship/libultra/types.h>
|
||||||
|
|
||||||
#define TICKS_PER_SEC 268123480.0
|
#define TICKS_PER_SEC 268123480.0
|
||||||
|
|
||||||
@ -17,14 +17,14 @@ void RandoMain::GenerateRando(std::unordered_map<RandomizerSettingKey, u8> cvarS
|
|||||||
LocationTable_Init();
|
LocationTable_Init();
|
||||||
|
|
||||||
// std::string settingsFileName = "./randomizer/latest_settings.json";
|
// std::string settingsFileName = "./randomizer/latest_settings.json";
|
||||||
// CVar_SetString("gLoadedPreset", settingsFileName.c_str());
|
// CVarSetString("gLoadedPreset", settingsFileName.c_str());
|
||||||
|
|
||||||
std::string fileName = Ship::Window::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations).c_str());
|
std::string fileName = Ship::Window::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations).c_str());
|
||||||
CVar_SetString("gSpoilerLog", fileName.c_str());
|
CVarSetString("gSpoilerLog", fileName.c_str());
|
||||||
|
|
||||||
CVar_Save();
|
CVarSave();
|
||||||
CVar_Load();
|
CVarLoad();
|
||||||
CVar_SetS32("gNewSeedGenerated", 1);
|
CVarSetInteger("gNewSeedGenerated", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<Item, KEY_ENUM_MAX>* RandoMain::GetFullItemTable() {
|
std::array<Item, KEY_ENUM_MAX>* RandoMain::GetFullItemTable() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEntry) {
|
extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEntry) {
|
||||||
s32 pad;
|
s32 pad;
|
||||||
s8 isColoredKeysEnabled = CVar_GetS32("gRandoMatchKeyColors", 0);
|
s8 isColoredKeysEnabled = CVarGetInteger("gRandoMatchKeyColors", 0);
|
||||||
s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY;
|
s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY;
|
||||||
s16 colors[9][3] = {
|
s16 colors[9][3] = {
|
||||||
{ 4, 195, 46 }, // Forest Temple
|
{ 4, 195, 46 }, // Forest Temple
|
||||||
@ -49,7 +49,7 @@ extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEn
|
|||||||
|
|
||||||
extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEntry) {
|
extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEntry) {
|
||||||
s32 pad;
|
s32 pad;
|
||||||
s8 isColoredKeysEnabled = CVar_GetS32("gRandoMatchKeyColors", 0);
|
s8 isColoredKeysEnabled = CVarGetInteger("gRandoMatchKeyColors", 0);
|
||||||
s16 color_slot;
|
s16 color_slot;
|
||||||
color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY;
|
color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY;
|
||||||
s16 colors[6][3] = {
|
s16 colors[6][3] = {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <objects/gameplay_keep/gameplay_keep.h>
|
#include <objects/gameplay_keep/gameplay_keep.h>
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <textures/icon_item_static/icon_item_static.h>
|
#include <textures/icon_item_static/icon_item_static.h>
|
||||||
#include <textures/icon_item_24_static/icon_item_24_static.h>
|
#include <textures/icon_item_24_static/icon_item_24_static.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
@ -2643,112 +2643,112 @@ RandomizerCheck Randomizer::GetCheckFromRandomizerInf(RandomizerInf randomizerIn
|
|||||||
std::thread randoThread;
|
std::thread randoThread;
|
||||||
|
|
||||||
void GenerateRandomizerImgui() {
|
void GenerateRandomizerImgui() {
|
||||||
CVar_SetS32("gRandoGenerating", 1);
|
CVarSetInteger("gRandoGenerating", 1);
|
||||||
CVar_Save();
|
CVarSave();
|
||||||
|
|
||||||
std::unordered_map<RandomizerSettingKey, u8> cvarSettings;
|
std::unordered_map<RandomizerSettingKey, u8> cvarSettings;
|
||||||
cvarSettings[RSK_LOGIC_RULES] = CVar_GetS32("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS);
|
cvarSettings[RSK_LOGIC_RULES] = CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS);
|
||||||
cvarSettings[RSK_ALL_LOCATIONS_REACHABLE] = CVar_GetS32("gRandomizeAllLocationsReachable", RO_GENERIC_ON);
|
cvarSettings[RSK_ALL_LOCATIONS_REACHABLE] = CVarGetInteger("gRandomizeAllLocationsReachable", RO_GENERIC_ON);
|
||||||
cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", RO_FOREST_CLOSED);
|
cvarSettings[RSK_FOREST] = CVarGetInteger("gRandomizeForest", RO_FOREST_CLOSED);
|
||||||
cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", RO_KAK_GATE_CLOSED);
|
cvarSettings[RSK_KAK_GATE] = CVarGetInteger("gRandomizeKakarikoGate", RO_KAK_GATE_CLOSED);
|
||||||
cvarSettings[RSK_DOOR_OF_TIME] = CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED);
|
cvarSettings[RSK_DOOR_OF_TIME] = CVarGetInteger("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED);
|
||||||
cvarSettings[RSK_ZORAS_FOUNTAIN] = CVar_GetS32("gRandomizeZorasFountain", 0);
|
cvarSettings[RSK_ZORAS_FOUNTAIN] = CVarGetInteger("gRandomizeZorasFountain", 0);
|
||||||
cvarSettings[RSK_STARTING_AGE] = CVar_GetS32("gRandomizeStartingAge", RO_AGE_CHILD);
|
cvarSettings[RSK_STARTING_AGE] = CVarGetInteger("gRandomizeStartingAge", RO_AGE_CHILD);
|
||||||
cvarSettings[RSK_GERUDO_FORTRESS] = CVar_GetS32("gRandomizeGerudoFortress", RO_GF_NORMAL);
|
cvarSettings[RSK_GERUDO_FORTRESS] = CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL);
|
||||||
cvarSettings[RSK_RAINBOW_BRIDGE] = CVar_GetS32("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA);
|
cvarSettings[RSK_RAINBOW_BRIDGE] = CVarGetInteger("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA);
|
||||||
cvarSettings[RSK_RAINBOW_BRIDGE_STONE_COUNT] = CVar_GetS32("gRandomizeStoneCount", 3);
|
cvarSettings[RSK_RAINBOW_BRIDGE_STONE_COUNT] = CVarGetInteger("gRandomizeStoneCount", 3);
|
||||||
cvarSettings[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT] = CVar_GetS32("gRandomizeMedallionCount", 6);
|
cvarSettings[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT] = CVarGetInteger("gRandomizeMedallionCount", 6);
|
||||||
cvarSettings[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = CVar_GetS32("gRandomizeRewardCount", 9);
|
cvarSettings[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = CVarGetInteger("gRandomizeRewardCount", 9);
|
||||||
cvarSettings[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = CVar_GetS32("gRandomizeDungeonCount", 8);
|
cvarSettings[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = CVarGetInteger("gRandomizeDungeonCount", 8);
|
||||||
cvarSettings[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = CVar_GetS32("gRandomizeTokenCount", 100);
|
cvarSettings[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = CVarGetInteger("gRandomizeTokenCount", 100);
|
||||||
cvarSettings[RSK_GANONS_TRIALS] = CVar_GetS32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER);
|
cvarSettings[RSK_GANONS_TRIALS] = CVarGetInteger("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER);
|
||||||
cvarSettings[RSK_TRIAL_COUNT] = CVar_GetS32("gRandomizeGanonTrialCount", 6);
|
cvarSettings[RSK_TRIAL_COUNT] = CVarGetInteger("gRandomizeGanonTrialCount", 6);
|
||||||
cvarSettings[RSK_STARTING_OCARINA] = CVar_GetS32("gRandomizeStartingOcarina", 0);
|
cvarSettings[RSK_STARTING_OCARINA] = CVarGetInteger("gRandomizeStartingOcarina", 0);
|
||||||
cvarSettings[RSK_SHUFFLE_OCARINA] = CVar_GetS32("gRandomizeShuffleOcarinas", 0) ||
|
cvarSettings[RSK_SHUFFLE_OCARINA] = CVarGetInteger("gRandomizeShuffleOcarinas", 0) ||
|
||||||
CVar_GetS32("gRandomizeStartingOcarina", 0);
|
CVarGetInteger("gRandomizeStartingOcarina", 0);
|
||||||
cvarSettings[RSK_STARTING_KOKIRI_SWORD] = CVar_GetS32("gRandomizeStartingKokiriSword", 0);
|
cvarSettings[RSK_STARTING_KOKIRI_SWORD] = CVarGetInteger("gRandomizeStartingKokiriSword", 0);
|
||||||
cvarSettings[RSK_SHUFFLE_KOKIRI_SWORD] = CVar_GetS32("gRandomizeShuffleKokiriSword", 0) ||
|
cvarSettings[RSK_SHUFFLE_KOKIRI_SWORD] = CVarGetInteger("gRandomizeShuffleKokiriSword", 0) ||
|
||||||
CVar_GetS32("gRandomizeStartingKokiriSword", 0);
|
CVarGetInteger("gRandomizeStartingKokiriSword", 0);
|
||||||
cvarSettings[RSK_STARTING_DEKU_SHIELD] = CVar_GetS32("gRandomizeStartingDekuShield", 0);
|
cvarSettings[RSK_STARTING_DEKU_SHIELD] = CVarGetInteger("gRandomizeStartingDekuShield", 0);
|
||||||
cvarSettings[RSK_STARTING_SKULLTULA_TOKEN] = CVar_GetS32("gRandomizeStartingSkulltulaToken", 0);
|
cvarSettings[RSK_STARTING_SKULLTULA_TOKEN] = CVarGetInteger("gRandomizeStartingSkulltulaToken", 0);
|
||||||
cvarSettings[RSK_STARTING_MAPS_COMPASSES] = CVar_GetS32("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
|
cvarSettings[RSK_STARTING_MAPS_COMPASSES] = CVarGetInteger("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
|
||||||
cvarSettings[RSK_SHUFFLE_DUNGEON_REWARDS] = CVar_GetS32("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON);
|
cvarSettings[RSK_SHUFFLE_DUNGEON_REWARDS] = CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON);
|
||||||
cvarSettings[RSK_SHUFFLE_SONGS] = CVar_GetS32("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_SONG_LOCATIONS);
|
cvarSettings[RSK_SHUFFLE_SONGS] = CVarGetInteger("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_SONG_LOCATIONS);
|
||||||
cvarSettings[RSK_SHUFFLE_TOKENS] = CVar_GetS32("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF);
|
cvarSettings[RSK_SHUFFLE_TOKENS] = CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF);
|
||||||
cvarSettings[RSK_SHOPSANITY] = CVar_GetS32("gRandomizeShopsanity", RO_SHOPSANITY_OFF);
|
cvarSettings[RSK_SHOPSANITY] = CVarGetInteger("gRandomizeShopsanity", RO_SHOPSANITY_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_SCRUBS] = CVar_GetS32("gRandomizeShuffleScrubs", RO_SCRUBS_OFF);
|
cvarSettings[RSK_SHUFFLE_SCRUBS] = CVarGetInteger("gRandomizeShuffleScrubs", RO_SCRUBS_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_COWS] = CVar_GetS32("gRandomizeShuffleCows", 0);
|
cvarSettings[RSK_SHUFFLE_COWS] = CVarGetInteger("gRandomizeShuffleCows", 0);
|
||||||
cvarSettings[RSK_SHUFFLE_ADULT_TRADE] = CVar_GetS32("gRandomizeShuffleAdultTrade", 0);
|
cvarSettings[RSK_SHUFFLE_ADULT_TRADE] = CVarGetInteger("gRandomizeShuffleAdultTrade", 0);
|
||||||
cvarSettings[RSK_SHUFFLE_MAGIC_BEANS] = CVar_GetS32("gRandomizeShuffleBeans", 0);
|
cvarSettings[RSK_SHUFFLE_MAGIC_BEANS] = CVarGetInteger("gRandomizeShuffleBeans", 0);
|
||||||
cvarSettings[RSK_SHUFFLE_MERCHANTS] = CVar_GetS32("gRandomizeShuffleMerchants", RO_SHUFFLE_MERCHANTS_OFF);
|
cvarSettings[RSK_SHUFFLE_MERCHANTS] = CVarGetInteger("gRandomizeShuffleMerchants", RO_SHUFFLE_MERCHANTS_OFF);
|
||||||
cvarSettings[RSK_ENABLE_BOMBCHU_DROPS] = CVar_GetS32("gRandomizeEnableBombchuDrops", 0);
|
cvarSettings[RSK_ENABLE_BOMBCHU_DROPS] = CVarGetInteger("gRandomizeEnableBombchuDrops", 0);
|
||||||
cvarSettings[RSK_BOMBCHUS_IN_LOGIC] = CVar_GetS32("gRandomizeBombchusInLogic", 0);
|
cvarSettings[RSK_BOMBCHUS_IN_LOGIC] = CVarGetInteger("gRandomizeBombchusInLogic", 0);
|
||||||
cvarSettings[RSK_SKIP_CHILD_ZELDA] = CVar_GetS32("gRandomizeSkipChildZelda", 0);
|
cvarSettings[RSK_SKIP_CHILD_ZELDA] = CVarGetInteger("gRandomizeSkipChildZelda", 0);
|
||||||
|
|
||||||
// if we skip child zelda, we start with zelda's letter, and malon starts
|
// if we skip child zelda, we start with zelda's letter, and malon starts
|
||||||
// at the ranch, so we should *not* shuffle the weird egg
|
// at the ranch, so we should *not* shuffle the weird egg
|
||||||
cvarSettings[RSK_SHUFFLE_WEIRD_EGG] = ((CVar_GetS32("gRandomizeSkipChildZelda", 0) == 0) &&
|
cvarSettings[RSK_SHUFFLE_WEIRD_EGG] = ((CVarGetInteger("gRandomizeSkipChildZelda", 0) == 0) &&
|
||||||
CVar_GetS32("gRandomizeShuffleWeirdEgg", 0));
|
CVarGetInteger("gRandomizeShuffleWeirdEgg", 0));
|
||||||
|
|
||||||
cvarSettings[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD] = CVar_GetS32("gRandomizeShuffleGerudoToken", 0);
|
cvarSettings[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD] = CVarGetInteger("gRandomizeShuffleGerudoToken", 0);
|
||||||
cvarSettings[RSK_SHUFFLE_FROG_SONG_RUPEES] = CVar_GetS32("gRandomizeShuffleFrogSongRupees", 0);
|
cvarSettings[RSK_SHUFFLE_FROG_SONG_RUPEES] = CVarGetInteger("gRandomizeShuffleFrogSongRupees", 0);
|
||||||
cvarSettings[RSK_ITEM_POOL] = CVar_GetS32("gRandomizeItemPool", RO_ITEM_POOL_BALANCED);
|
cvarSettings[RSK_ITEM_POOL] = CVarGetInteger("gRandomizeItemPool", RO_ITEM_POOL_BALANCED);
|
||||||
cvarSettings[RSK_ICE_TRAPS] = CVar_GetS32("gRandomizeIceTraps", RO_ICE_TRAPS_NORMAL);
|
cvarSettings[RSK_ICE_TRAPS] = CVarGetInteger("gRandomizeIceTraps", RO_ICE_TRAPS_NORMAL);
|
||||||
cvarSettings[RSK_GOSSIP_STONE_HINTS] = CVar_GetS32("gRandomizeGossipStoneHints", RO_GOSSIP_STONES_NEED_NOTHING);
|
cvarSettings[RSK_GOSSIP_STONE_HINTS] = CVarGetInteger("gRandomizeGossipStoneHints", RO_GOSSIP_STONES_NEED_NOTHING);
|
||||||
cvarSettings[RSK_HINT_CLARITY] = CVar_GetS32("gRandomizeHintClarity", RO_HINT_CLARITY_CLEAR);
|
cvarSettings[RSK_HINT_CLARITY] = CVarGetInteger("gRandomizeHintClarity", RO_HINT_CLARITY_CLEAR);
|
||||||
cvarSettings[RSK_HINT_DISTRIBUTION] = CVar_GetS32("gRandomizeHintDistribution", RO_HINT_DIST_BALANCED);
|
cvarSettings[RSK_HINT_DISTRIBUTION] = CVarGetInteger("gRandomizeHintDistribution", RO_HINT_DIST_BALANCED);
|
||||||
cvarSettings[RSK_BLUE_FIRE_ARROWS] = CVar_GetS32("gRandomizeBlueFireArrows", 0);
|
cvarSettings[RSK_BLUE_FIRE_ARROWS] = CVarGetInteger("gRandomizeBlueFireArrows", 0);
|
||||||
cvarSettings[RSK_SUNLIGHT_ARROWS] = CVar_GetS32("gRandomizeSunlightArrows", 0);
|
cvarSettings[RSK_SUNLIGHT_ARROWS] = CVarGetInteger("gRandomizeSunlightArrows", 0);
|
||||||
cvarSettings[RSK_KEYSANITY] = CVar_GetS32("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
|
cvarSettings[RSK_KEYSANITY] = CVarGetInteger("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
|
||||||
cvarSettings[RSK_GERUDO_KEYS] = CVar_GetS32("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA);
|
cvarSettings[RSK_GERUDO_KEYS] = CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA);
|
||||||
cvarSettings[RSK_KEYRINGS] = CVar_GetS32("gRandomizeShuffleKeyRings", RO_KEYRINGS_OFF);
|
cvarSettings[RSK_KEYRINGS] = CVarGetInteger("gRandomizeShuffleKeyRings", RO_KEYRINGS_OFF);
|
||||||
cvarSettings[RSK_KEYRINGS_RANDOM_COUNT] = CVar_GetS32("gRandomizeShuffleKeyRingsRandomCount", 8);
|
cvarSettings[RSK_KEYRINGS_RANDOM_COUNT] = CVarGetInteger("gRandomizeShuffleKeyRingsRandomCount", 8);
|
||||||
cvarSettings[RSK_KEYRINGS_FOREST_TEMPLE] = CVar_GetS32("gRandomizeShuffleKeyRingsForestTemple", 0);
|
cvarSettings[RSK_KEYRINGS_FOREST_TEMPLE] = CVarGetInteger("gRandomizeShuffleKeyRingsForestTemple", 0);
|
||||||
cvarSettings[RSK_KEYRINGS_FIRE_TEMPLE] = CVar_GetS32("gRandomizeShuffleKeyRingsFireTemple", 0);
|
cvarSettings[RSK_KEYRINGS_FIRE_TEMPLE] = CVarGetInteger("gRandomizeShuffleKeyRingsFireTemple", 0);
|
||||||
cvarSettings[RSK_KEYRINGS_WATER_TEMPLE] = CVar_GetS32("gRandomizeShuffleKeyRingsWaterTemple", 0);
|
cvarSettings[RSK_KEYRINGS_WATER_TEMPLE] = CVarGetInteger("gRandomizeShuffleKeyRingsWaterTemple", 0);
|
||||||
cvarSettings[RSK_KEYRINGS_SPIRIT_TEMPLE] = CVar_GetS32("gRandomizeShuffleKeyRingsSpiritTemple", 0);
|
cvarSettings[RSK_KEYRINGS_SPIRIT_TEMPLE] = CVarGetInteger("gRandomizeShuffleKeyRingsSpiritTemple", 0);
|
||||||
cvarSettings[RSK_KEYRINGS_SHADOW_TEMPLE] = CVar_GetS32("gRandomizeShuffleKeyRingsShadowTemple", 0);
|
cvarSettings[RSK_KEYRINGS_SHADOW_TEMPLE] = CVarGetInteger("gRandomizeShuffleKeyRingsShadowTemple", 0);
|
||||||
cvarSettings[RSK_KEYRINGS_BOTTOM_OF_THE_WELL] = CVar_GetS32("gRandomizeShuffleKeyRingsBottomOfTheWell", 0);
|
cvarSettings[RSK_KEYRINGS_BOTTOM_OF_THE_WELL] = CVarGetInteger("gRandomizeShuffleKeyRingsBottomOfTheWell", 0);
|
||||||
cvarSettings[RSK_KEYRINGS_GTG] = CVar_GetS32("gRandomizeShuffleKeyRingsGTG", 0);
|
cvarSettings[RSK_KEYRINGS_GTG] = CVarGetInteger("gRandomizeShuffleKeyRingsGTG", 0);
|
||||||
cvarSettings[RSK_KEYRINGS_GANONS_CASTLE] = CVar_GetS32("gRandomizeShuffleKeyRingsGanonsCastle", 0);
|
cvarSettings[RSK_KEYRINGS_GANONS_CASTLE] = CVarGetInteger("gRandomizeShuffleKeyRingsGanonsCastle", 0);
|
||||||
cvarSettings[RSK_BOSS_KEYSANITY] = CVar_GetS32("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
|
cvarSettings[RSK_BOSS_KEYSANITY] = CVarGetInteger("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
|
||||||
cvarSettings[RSK_GANONS_BOSS_KEY] = CVar_GetS32("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA);
|
cvarSettings[RSK_GANONS_BOSS_KEY] = CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA);
|
||||||
cvarSettings[RSK_LACS_STONE_COUNT] = CVar_GetS32("gRandomizeLacsStoneCount", 3);
|
cvarSettings[RSK_LACS_STONE_COUNT] = CVarGetInteger("gRandomizeLacsStoneCount", 3);
|
||||||
cvarSettings[RSK_LACS_MEDALLION_COUNT] = CVar_GetS32("gRandomizeLacsMedallionCount", 6);
|
cvarSettings[RSK_LACS_MEDALLION_COUNT] = CVarGetInteger("gRandomizeLacsMedallionCount", 6);
|
||||||
cvarSettings[RSK_LACS_REWARD_COUNT] = CVar_GetS32("gRandomizeLacsRewardCount", 9);
|
cvarSettings[RSK_LACS_REWARD_COUNT] = CVarGetInteger("gRandomizeLacsRewardCount", 9);
|
||||||
cvarSettings[RSK_LACS_DUNGEON_COUNT] = CVar_GetS32("gRandomizeLacsDungeonCount", 8);
|
cvarSettings[RSK_LACS_DUNGEON_COUNT] = CVarGetInteger("gRandomizeLacsDungeonCount", 8);
|
||||||
cvarSettings[RSK_LACS_TOKEN_COUNT] = CVar_GetS32("gRandomizeLacsTokenCount", 100);
|
cvarSettings[RSK_LACS_TOKEN_COUNT] = CVarGetInteger("gRandomizeLacsTokenCount", 100);
|
||||||
cvarSettings[RSK_STARTING_CONSUMABLES] = CVar_GetS32("gRandomizeStartingConsumables", 0);
|
cvarSettings[RSK_STARTING_CONSUMABLES] = CVarGetInteger("gRandomizeStartingConsumables", 0);
|
||||||
cvarSettings[RSK_FULL_WALLETS] = CVar_GetS32("gRandomizeFullWallets", 0);
|
cvarSettings[RSK_FULL_WALLETS] = CVarGetInteger("gRandomizeFullWallets", 0);
|
||||||
|
|
||||||
// RANDOTODO implement chest minigame shuffle with keysanity
|
// RANDOTODO implement chest minigame shuffle with keysanity
|
||||||
cvarSettings[RSK_SHUFFLE_CHEST_MINIGAME] = false;
|
cvarSettings[RSK_SHUFFLE_CHEST_MINIGAME] = false;
|
||||||
|
|
||||||
cvarSettings[RSK_LANGUAGE] = CVar_GetS32("gLanguages", 0);
|
cvarSettings[RSK_LANGUAGE] = CVarGetInteger("gLanguages", 0);
|
||||||
|
|
||||||
cvarSettings[RSK_CUCCO_COUNT] = CVar_GetS32("gRandomizeCuccosToReturn", 7);
|
cvarSettings[RSK_CUCCO_COUNT] = CVarGetInteger("gRandomizeCuccosToReturn", 7);
|
||||||
cvarSettings[RSK_BIG_POE_COUNT] = CVar_GetS32("gRandomizeBigPoeTargetCount", 10);
|
cvarSettings[RSK_BIG_POE_COUNT] = CVarGetInteger("gRandomizeBigPoeTargetCount", 10);
|
||||||
|
|
||||||
// If we skip child zelda, skip child stealth is pointless, so this needs to be reflected in the spoiler log
|
// If we skip child zelda, skip child stealth is pointless, so this needs to be reflected in the spoiler log
|
||||||
cvarSettings[RSK_SKIP_CHILD_STEALTH] =
|
cvarSettings[RSK_SKIP_CHILD_STEALTH] =
|
||||||
!CVar_GetS32("gRandomizeSkipChildZelda", 0) && CVar_GetS32("gRandomizeSkipChildStealth", 0);
|
!CVarGetInteger("gRandomizeSkipChildZelda", 0) && CVarGetInteger("gRandomizeSkipChildStealth", 0);
|
||||||
|
|
||||||
cvarSettings[RSK_SKIP_EPONA_RACE] = CVar_GetS32("gRandomizeSkipEponaRace", 0);
|
cvarSettings[RSK_SKIP_EPONA_RACE] = CVarGetInteger("gRandomizeSkipEponaRace", 0);
|
||||||
cvarSettings[RSK_SKIP_TOWER_ESCAPE] = CVar_GetS32("gRandomizeSkipTowerEscape", 0);
|
cvarSettings[RSK_SKIP_TOWER_ESCAPE] = CVarGetInteger("gRandomizeSkipTowerEscape", 0);
|
||||||
cvarSettings[RSK_COMPLETE_MASK_QUEST] = CVar_GetS32("gRandomizeCompleteMaskQuest", 0);
|
cvarSettings[RSK_COMPLETE_MASK_QUEST] = CVarGetInteger("gRandomizeCompleteMaskQuest", 0);
|
||||||
cvarSettings[RSK_SKIP_SCARECROWS_SONG] = CVar_GetS32("gRandomizeSkipScarecrowsSong", 0);
|
cvarSettings[RSK_SKIP_SCARECROWS_SONG] = CVarGetInteger("gRandomizeSkipScarecrowsSong", 0);
|
||||||
cvarSettings[RSK_ENABLE_GLITCH_CUTSCENES] = CVar_GetS32("gRandomizeEnableGlitchCutscenes", 0);
|
cvarSettings[RSK_ENABLE_GLITCH_CUTSCENES] = CVarGetInteger("gRandomizeEnableGlitchCutscenes", 0);
|
||||||
|
|
||||||
cvarSettings[RSK_SKULLS_SUNS_SONG] = CVar_GetS32("gRandomizeGsExpectSunsSong", 0);
|
cvarSettings[RSK_SKULLS_SUNS_SONG] = CVarGetInteger("gRandomizeGsExpectSunsSong", 0);
|
||||||
// Link's Pocket has to have a dungeon reward if the other rewards are shuffled to end of dungeon.
|
// Link's Pocket has to have a dungeon reward if the other rewards are shuffled to end of dungeon.
|
||||||
cvarSettings[RSK_LINKS_POCKET] = CVar_GetS32("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != RO_DUNGEON_REWARDS_END_OF_DUNGEON ?
|
cvarSettings[RSK_LINKS_POCKET] = CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != RO_DUNGEON_REWARDS_END_OF_DUNGEON ?
|
||||||
CVar_GetS32("gRandomizeLinksPocket", RO_LINKS_POCKET_DUNGEON_REWARD) :
|
CVarGetInteger("gRandomizeLinksPocket", RO_LINKS_POCKET_DUNGEON_REWARD) :
|
||||||
RO_LINKS_POCKET_DUNGEON_REWARD;
|
RO_LINKS_POCKET_DUNGEON_REWARD;
|
||||||
|
|
||||||
if (OTRGlobals::Instance->HasMasterQuest() && OTRGlobals::Instance->HasOriginal()) {
|
if (OTRGlobals::Instance->HasMasterQuest() && OTRGlobals::Instance->HasOriginal()) {
|
||||||
// If both OTRs are loaded.
|
// If both OTRs are loaded.
|
||||||
cvarSettings[RSK_RANDOM_MQ_DUNGEONS] = CVar_GetS32("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE);
|
cvarSettings[RSK_RANDOM_MQ_DUNGEONS] = CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE);
|
||||||
cvarSettings[RSK_MQ_DUNGEON_COUNT] = CVar_GetS32("gRandomizeMqDungeonCount", 12);
|
cvarSettings[RSK_MQ_DUNGEON_COUNT] = CVarGetInteger("gRandomizeMqDungeonCount", 12);
|
||||||
} else if (OTRGlobals::Instance->HasMasterQuest()) {
|
} else if (OTRGlobals::Instance->HasMasterQuest()) {
|
||||||
// If only Master Quest is loaded.
|
// If only Master Quest is loaded.
|
||||||
cvarSettings[RSK_RANDOM_MQ_DUNGEONS] = RO_MQ_DUNGEONS_SET_NUMBER;
|
cvarSettings[RSK_RANDOM_MQ_DUNGEONS] = RO_MQ_DUNGEONS_SET_NUMBER;
|
||||||
@ -2760,31 +2760,31 @@ void GenerateRandomizerImgui() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable if any of the entrance rando options are enabled.
|
// Enable if any of the entrance rando options are enabled.
|
||||||
cvarSettings[RSK_SHUFFLE_ENTRANCES] = CVar_GetS32("gRandomizeShuffleDungeonsEntrances", RO_DUNGEON_ENTRANCE_SHUFFLE_OFF) ||
|
cvarSettings[RSK_SHUFFLE_ENTRANCES] = CVarGetInteger("gRandomizeShuffleDungeonsEntrances", RO_DUNGEON_ENTRANCE_SHUFFLE_OFF) ||
|
||||||
CVar_GetS32("gRandomizeShuffleOverworldEntrances", RO_GENERIC_OFF) ||
|
CVarGetInteger("gRandomizeShuffleOverworldEntrances", RO_GENERIC_OFF) ||
|
||||||
CVar_GetS32("gRandomizeShuffleInteriorsEntrances", RO_INTERIOR_ENTRANCE_SHUFFLE_OFF) ||
|
CVarGetInteger("gRandomizeShuffleInteriorsEntrances", RO_INTERIOR_ENTRANCE_SHUFFLE_OFF) ||
|
||||||
CVar_GetS32("gRandomizeShuffleGrottosEntrances", RO_GENERIC_OFF) ||
|
CVarGetInteger("gRandomizeShuffleGrottosEntrances", RO_GENERIC_OFF) ||
|
||||||
CVar_GetS32("gRandomizeShuffleOwlDrops", RO_GENERIC_OFF) ||
|
CVarGetInteger("gRandomizeShuffleOwlDrops", RO_GENERIC_OFF) ||
|
||||||
CVar_GetS32("gRandomizeShuffleWarpSongs", RO_GENERIC_OFF) ||
|
CVarGetInteger("gRandomizeShuffleWarpSongs", RO_GENERIC_OFF) ||
|
||||||
CVar_GetS32("gRandomizeShuffleOverworldSpawns", RO_GENERIC_OFF);
|
CVarGetInteger("gRandomizeShuffleOverworldSpawns", RO_GENERIC_OFF);
|
||||||
|
|
||||||
cvarSettings[RSK_SHUFFLE_DUNGEON_ENTRANCES] = CVar_GetS32("gRandomizeShuffleDungeonsEntrances", RO_DUNGEON_ENTRANCE_SHUFFLE_OFF);
|
cvarSettings[RSK_SHUFFLE_DUNGEON_ENTRANCES] = CVarGetInteger("gRandomizeShuffleDungeonsEntrances", RO_DUNGEON_ENTRANCE_SHUFFLE_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_OVERWORLD_ENTRANCES] = CVar_GetS32("gRandomizeShuffleOverworldEntrances", RO_GENERIC_OFF);
|
cvarSettings[RSK_SHUFFLE_OVERWORLD_ENTRANCES] = CVarGetInteger("gRandomizeShuffleOverworldEntrances", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_INTERIOR_ENTRANCES] = CVar_GetS32("gRandomizeShuffleInteriorsEntrances", RO_INTERIOR_ENTRANCE_SHUFFLE_OFF);
|
cvarSettings[RSK_SHUFFLE_INTERIOR_ENTRANCES] = CVarGetInteger("gRandomizeShuffleInteriorsEntrances", RO_INTERIOR_ENTRANCE_SHUFFLE_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_GROTTO_ENTRANCES] = CVar_GetS32("gRandomizeShuffleGrottosEntrances", RO_GENERIC_OFF);
|
cvarSettings[RSK_SHUFFLE_GROTTO_ENTRANCES] = CVarGetInteger("gRandomizeShuffleGrottosEntrances", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_OWL_DROPS] = CVar_GetS32("gRandomizeShuffleOwlDrops", RO_GENERIC_OFF);
|
cvarSettings[RSK_SHUFFLE_OWL_DROPS] = CVarGetInteger("gRandomizeShuffleOwlDrops", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_WARP_SONGS] = CVar_GetS32("gRandomizeShuffleWarpSongs", RO_GENERIC_OFF);
|
cvarSettings[RSK_SHUFFLE_WARP_SONGS] = CVarGetInteger("gRandomizeShuffleWarpSongs", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_SHUFFLE_OVERWORLD_SPAWNS] = CVar_GetS32("gRandomizeShuffleOverworldSpawns", RO_GENERIC_OFF);
|
cvarSettings[RSK_SHUFFLE_OVERWORLD_SPAWNS] = CVarGetInteger("gRandomizeShuffleOverworldSpawns", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_MIXED_ENTRANCE_POOLS] = CVar_GetS32("gRandomizeMixedEntrances", RO_GENERIC_OFF);
|
cvarSettings[RSK_MIXED_ENTRANCE_POOLS] = CVarGetInteger("gRandomizeMixedEntrances", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_MIX_DUNGEON_ENTRANCES] = CVar_GetS32("gRandomizeMixDungeons", RO_GENERIC_OFF);
|
cvarSettings[RSK_MIX_DUNGEON_ENTRANCES] = CVarGetInteger("gRandomizeMixDungeons", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_MIX_OVERWORLD_ENTRANCES] = CVar_GetS32("gRandomizeMixOverworld", RO_GENERIC_OFF);
|
cvarSettings[RSK_MIX_OVERWORLD_ENTRANCES] = CVarGetInteger("gRandomizeMixOverworld", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_MIX_INTERIOR_ENTRANCES] = CVar_GetS32("gRandomizeMixInteriors", RO_GENERIC_OFF);
|
cvarSettings[RSK_MIX_INTERIOR_ENTRANCES] = CVarGetInteger("gRandomizeMixInteriors", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_MIX_GROTTO_ENTRANCES] = CVar_GetS32("gRandomizeMixGrottos", RO_GENERIC_OFF);
|
cvarSettings[RSK_MIX_GROTTO_ENTRANCES] = CVarGetInteger("gRandomizeMixGrottos", RO_GENERIC_OFF);
|
||||||
cvarSettings[RSK_DECOUPLED_ENTRANCES] = CVar_GetS32("gRandomizeDecoupleEntrances", RO_GENERIC_OFF);
|
cvarSettings[RSK_DECOUPLED_ENTRANCES] = CVarGetInteger("gRandomizeDecoupleEntrances", RO_GENERIC_OFF);
|
||||||
|
|
||||||
// todo: this efficently when we build out cvar array support
|
// todo: this efficently when we build out cvar array support
|
||||||
std::set<RandomizerCheck> excludedLocations;
|
std::set<RandomizerCheck> excludedLocations;
|
||||||
std::stringstream excludedLocationStringStream(CVar_GetString("gRandomizeExcludedLocations", ""));
|
std::stringstream excludedLocationStringStream(CVarGetString("gRandomizeExcludedLocations", ""));
|
||||||
std::string excludedLocationString;
|
std::string excludedLocationString;
|
||||||
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
|
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
|
||||||
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
|
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
|
||||||
@ -2792,9 +2792,9 @@ void GenerateRandomizerImgui() {
|
|||||||
|
|
||||||
RandoMain::GenerateRando(cvarSettings, excludedLocations);
|
RandoMain::GenerateRando(cvarSettings, excludedLocations);
|
||||||
|
|
||||||
CVar_SetS32("gRandoGenerating", 0);
|
CVarSetInteger("gRandoGenerating", 0);
|
||||||
CVar_Save();
|
CVarSave();
|
||||||
CVar_Load();
|
CVarLoad();
|
||||||
|
|
||||||
generated = 1;
|
generated = 1;
|
||||||
}
|
}
|
||||||
@ -2806,7 +2806,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gRandomizerSettingsEnabled", 0);
|
CVarSetInteger("gRandomizerSettingsEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2875,22 +2875,22 @@ void DrawRandoEditor(bool& open) {
|
|||||||
|
|
||||||
DrawPresetSelector(PRESET_TYPE_RANDOMIZER);
|
DrawPresetSelector(PRESET_TYPE_RANDOMIZER);
|
||||||
|
|
||||||
bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || CVar_GetS32("gOnFileSelectNameEntry", 0);
|
bool disableEditingRandoSettings = CVarGetInteger("gRandoGenerating", 0) || CVarGetInteger("gOnFileSelectNameEntry", 0);
|
||||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings);
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f));
|
||||||
|
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
if (ImGui::Button("Generate Seed")) {
|
if (ImGui::Button("Generate Seed")) {
|
||||||
if (CVar_GetS32("gRandoGenerating", 0) == 0) {
|
if (CVarGetInteger("gRandoGenerating", 0) == 0) {
|
||||||
randoThread = std::thread(&GenerateRandomizerImgui);
|
randoThread = std::thread(&GenerateRandomizerImgui);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
std::string spoilerfilepath = CVar_GetString("gSpoilerLog", "");
|
std::string spoilerfilepath = CVarGetString("gSpoilerLog", "");
|
||||||
ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str());
|
ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str());
|
||||||
|
|
||||||
// RANDOTODO settings presets
|
// RANDOTODO settings presets
|
||||||
// std::string presetfilepath = CVar_GetString("gLoadedPreset", "");
|
// std::string presetfilepath = CVarGetString("gLoadedPreset", "");
|
||||||
// ImGui::Text("Settings File: %s", presetfilepath.c_str());
|
// ImGui::Text("Settings File: %s", presetfilepath.c_str());
|
||||||
|
|
||||||
UIWidgets::PaddedSeparator();
|
UIWidgets::PaddedSeparator();
|
||||||
@ -2990,10 +2990,10 @@ void DrawRandoEditor(bool& open) {
|
|||||||
//Starting Age
|
//Starting Age
|
||||||
//Disabled when Forest is set to Closed or under very specific conditions
|
//Disabled when Forest is set to Closed or under very specific conditions
|
||||||
//RANDOTODO: Replace magic number checks with enums
|
//RANDOTODO: Replace magic number checks with enums
|
||||||
bool disableRandoStartingAge = (CVar_GetS32("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) &&
|
bool disableRandoStartingAge = (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) &&
|
||||||
((CVar_GetS32("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED) ||
|
((CVarGetInteger("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED) ||
|
||||||
((CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED) &&
|
((CVarGetInteger("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED) &&
|
||||||
(CVar_GetS32("gRandomizeShuffleOcarinas", 0) == 0))); // ocarinas not shuffled
|
(CVarGetInteger("gRandomizeShuffleOcarinas", 0) == 0))); // ocarinas not shuffled
|
||||||
|
|
||||||
static const char* disableRandoStartingAgeText = "This option is disabled due to other options making the game unbeatable.";
|
static const char* disableRandoStartingAgeText = "This option is disabled due to other options making the game unbeatable.";
|
||||||
ImGui::Text(Settings::StartingAge.GetName().c_str());
|
ImGui::Text(Settings::StartingAge.GetName().c_str());
|
||||||
@ -3011,7 +3011,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||||
ImGui::SetTooltip("%s", disableRandoStartingAgeText);
|
ImGui::SetTooltip("%s", disableRandoStartingAgeText);
|
||||||
}
|
}
|
||||||
CVar_SetS32("gRandomizeStartingAge", RO_AGE_CHILD);
|
CVarSetInteger("gRandomizeStartingAge", RO_AGE_CHILD);
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
ImGui::PopItemFlag();
|
ImGui::PopItemFlag();
|
||||||
}
|
}
|
||||||
@ -3059,7 +3059,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
|
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, RO_BRIDGE_MAX, RO_BRIDGE_VANILLA);
|
UIWidgets::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, RO_BRIDGE_MAX, RO_BRIDGE_VANILLA);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
switch (CVar_GetS32("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA)) {
|
switch (CVarGetInteger("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA)) {
|
||||||
case RO_BRIDGE_ALWAYS_OPEN:
|
case RO_BRIDGE_ALWAYS_OPEN:
|
||||||
break;
|
break;
|
||||||
case RO_BRIDGE_VANILLA:
|
case RO_BRIDGE_VANILLA:
|
||||||
@ -3108,7 +3108,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
);
|
);
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, RO_GANONS_TRIALS_MAX, RO_GANONS_TRIALS_SET_NUMBER);
|
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, RO_GANONS_TRIALS_MAX, RO_GANONS_TRIALS_SET_NUMBER);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
if (CVar_GetS32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER) == RO_GANONS_TRIALS_SET_NUMBER) {
|
if (CVarGetInteger("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER) == RO_GANONS_TRIALS_SET_NUMBER) {
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
UIWidgets::EnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount",
|
UIWidgets::EnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount",
|
||||||
"gRandomizeGanonTrialCount", 1, 6, "", 6, true);
|
"gRandomizeGanonTrialCount", 1, 6, "", 6, true);
|
||||||
@ -3132,10 +3132,10 @@ void DrawRandoEditor(bool& open) {
|
|||||||
);
|
);
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeMqDungeons", randoMqDungeons, RO_MQ_DUNGEONS_MAX, RO_MQ_DUNGEONS_NONE);
|
UIWidgets::EnhancementCombobox("gRandomizeMqDungeons", randoMqDungeons, RO_MQ_DUNGEONS_MAX, RO_MQ_DUNGEONS_NONE);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
if (CVar_GetS32("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER) {
|
if (CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER) {
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
UIWidgets::EnhancementSliderInt("Master Quest Dungeon Count: %d", "##RandoMqDungeonCount",
|
UIWidgets::EnhancementSliderInt("Master Quest Dungeon Count: %d", "##RandoMqDungeonCount",
|
||||||
"gRandomizeMqDungeonCount", 1, 12, "", CVar_GetS32("gRandomizeMqDungeonCount", 12), true);
|
"gRandomizeMqDungeonCount", 1, 12, "", CVarGetInteger("gRandomizeMqDungeonCount", 12), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3253,26 +3253,26 @@ void DrawRandoEditor(bool& open) {
|
|||||||
"vice versa, while overworld entrances are shuffled in their own separate pool and indoors stay vanilla."
|
"vice versa, while overworld entrances are shuffled in their own separate pool and indoors stay vanilla."
|
||||||
);
|
);
|
||||||
|
|
||||||
if (CVar_GetS32("gRandomizeMixedEntrances", RO_GENERIC_OFF)) {
|
if (CVarGetInteger("gRandomizeMixedEntrances", RO_GENERIC_OFF)) {
|
||||||
if (CVar_GetS32("gRandomizeShuffleDungeonsEntrances", RO_GENERIC_OFF)) {
|
if (CVarGetInteger("gRandomizeShuffleDungeonsEntrances", RO_GENERIC_OFF)) {
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
ImGui::SetCursorPosX(20);
|
ImGui::SetCursorPosX(20);
|
||||||
UIWidgets::EnhancementCheckbox("Mix Dungeons", "gRandomizeMixDungeons");
|
UIWidgets::EnhancementCheckbox("Mix Dungeons", "gRandomizeMixDungeons");
|
||||||
UIWidgets::InsertHelpHoverText("Dungeon entrances will be part of the mixed pool");
|
UIWidgets::InsertHelpHoverText("Dungeon entrances will be part of the mixed pool");
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gRandomizeShuffleOverworldEntrances", RO_GENERIC_OFF)) {
|
if (CVarGetInteger("gRandomizeShuffleOverworldEntrances", RO_GENERIC_OFF)) {
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
ImGui::SetCursorPosX(20);
|
ImGui::SetCursorPosX(20);
|
||||||
UIWidgets::EnhancementCheckbox("Mix Overworld", "gRandomizeMixOverworld");
|
UIWidgets::EnhancementCheckbox("Mix Overworld", "gRandomizeMixOverworld");
|
||||||
UIWidgets::InsertHelpHoverText("Overworld entrances will be part of the mixed pool");
|
UIWidgets::InsertHelpHoverText("Overworld entrances will be part of the mixed pool");
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gRandomizeShuffleInteriorsEntrances", RO_GENERIC_OFF)) {
|
if (CVarGetInteger("gRandomizeShuffleInteriorsEntrances", RO_GENERIC_OFF)) {
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
ImGui::SetCursorPosX(20);
|
ImGui::SetCursorPosX(20);
|
||||||
UIWidgets::EnhancementCheckbox("Mix Interiors", "gRandomizeMixInteriors");
|
UIWidgets::EnhancementCheckbox("Mix Interiors", "gRandomizeMixInteriors");
|
||||||
UIWidgets::InsertHelpHoverText("Interior entrances will be part of the mixed pool");
|
UIWidgets::InsertHelpHoverText("Interior entrances will be part of the mixed pool");
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gRandomizeShuffleGrottosEntrances", RO_GENERIC_OFF)) {
|
if (CVarGetInteger("gRandomizeShuffleGrottosEntrances", RO_GENERIC_OFF)) {
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
ImGui::SetCursorPosX(20);
|
ImGui::SetCursorPosX(20);
|
||||||
UIWidgets::EnhancementCheckbox("Mix Grottos", "gRandomizeMixGrottos");
|
UIWidgets::EnhancementCheckbox("Mix Grottos", "gRandomizeMixGrottos");
|
||||||
@ -3352,7 +3352,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
|
|
||||||
// Shuffle Kokiri Sword
|
// Shuffle Kokiri Sword
|
||||||
// Disabled when Start with Kokiri Sword is active
|
// Disabled when Start with Kokiri Sword is active
|
||||||
bool disableShuffleKokiriSword = CVar_GetS32("gRandomizeStartingKokiriSword", 0);
|
bool disableShuffleKokiriSword = CVarGetInteger("gRandomizeStartingKokiriSword", 0);
|
||||||
static const char* disableShuffleKokiriSwordText = "This option is disabled because \"Start with Kokiri Sword\" is enabled.";
|
static const char* disableShuffleKokiriSwordText = "This option is disabled because \"Start with Kokiri Sword\" is enabled.";
|
||||||
UIWidgets::EnhancementCheckbox(Settings::ShuffleKokiriSword.GetName().c_str(), "gRandomizeShuffleKokiriSword",
|
UIWidgets::EnhancementCheckbox(Settings::ShuffleKokiriSword.GetName().c_str(), "gRandomizeShuffleKokiriSword",
|
||||||
disableShuffleKokiriSword, disableShuffleKokiriSwordText);
|
disableShuffleKokiriSword, disableShuffleKokiriSwordText);
|
||||||
@ -3366,7 +3366,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
|
|
||||||
// Shuffle Ocarinas
|
// Shuffle Ocarinas
|
||||||
// Disabled when Start with Ocarina is active
|
// Disabled when Start with Ocarina is active
|
||||||
bool disableShuffleOcarinas = CVar_GetS32("gRandomizeStartingOcarina", 0);
|
bool disableShuffleOcarinas = CVarGetInteger("gRandomizeStartingOcarina", 0);
|
||||||
static const char* disableShuffleOcarinasText = "This option is disabled because \"Start with Fairy Ocarina\" is enabled.";
|
static const char* disableShuffleOcarinasText = "This option is disabled because \"Start with Fairy Ocarina\" is enabled.";
|
||||||
UIWidgets::EnhancementCheckbox(Settings::ShuffleOcarinas.GetName().c_str(), "gRandomizeShuffleOcarinas",
|
UIWidgets::EnhancementCheckbox(Settings::ShuffleOcarinas.GetName().c_str(), "gRandomizeShuffleOcarinas",
|
||||||
disableShuffleOcarinas, disableShuffleOcarinasText);
|
disableShuffleOcarinas, disableShuffleOcarinasText);
|
||||||
@ -3380,7 +3380,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
|
|
||||||
// Shuffle Weird Egg
|
// Shuffle Weird Egg
|
||||||
// Disabled when Skip Child Zelda is active
|
// Disabled when Skip Child Zelda is active
|
||||||
bool disableShuffleWeirdEgg = CVar_GetS32("gRandomizeSkipChildZelda", 0);
|
bool disableShuffleWeirdEgg = CVarGetInteger("gRandomizeSkipChildZelda", 0);
|
||||||
static const char* disableShuffleWeirdEggText = "This option is disabled because \"Skip Child Zelda\" is enabled.";
|
static const char* disableShuffleWeirdEggText = "This option is disabled because \"Skip Child Zelda\" is enabled.";
|
||||||
UIWidgets::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg",
|
UIWidgets::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg",
|
||||||
disableShuffleWeirdEgg, disableShuffleWeirdEggText);
|
disableShuffleWeirdEgg, disableShuffleWeirdEggText);
|
||||||
@ -3584,7 +3584,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
);
|
);
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeShuffleKeyRings", randoShuffleKeyRings, RO_KEYRINGS_MAX, RO_KEYRINGS_OFF);
|
UIWidgets::EnhancementCombobox("gRandomizeShuffleKeyRings", randoShuffleKeyRings, RO_KEYRINGS_MAX, RO_KEYRINGS_OFF);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
switch (CVar_GetS32("gRandomizeShuffleKeyRings", RO_KEYRINGS_OFF)) {
|
switch (CVarGetInteger("gRandomizeShuffleKeyRings", RO_KEYRINGS_OFF)) {
|
||||||
case RO_KEYRINGS_COUNT:
|
case RO_KEYRINGS_COUNT:
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
UIWidgets::EnhancementSliderInt("Key Ring Count: %d", "##RandomizeShuffleKeyRingsRandomCount",
|
UIWidgets::EnhancementSliderInt("Key Ring Count: %d", "##RandomizeShuffleKeyRingsRandomCount",
|
||||||
@ -3666,7 +3666,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
);
|
);
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, RO_GANON_BOSS_KEY_MAX, RO_GANON_BOSS_KEY_VANILLA);
|
UIWidgets::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, RO_GANON_BOSS_KEY_MAX, RO_GANON_BOSS_KEY_VANILLA);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
switch (CVar_GetS32("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA)) {
|
switch (CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA)) {
|
||||||
case RO_GANON_BOSS_KEY_LACS_MEDALLIONS:
|
case RO_GANON_BOSS_KEY_LACS_MEDALLIONS:
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
UIWidgets::EnhancementSliderInt("Medallion Count: %d", "##RandoLacsMedallionCount",
|
UIWidgets::EnhancementSliderInt("Medallion Count: %d", "##RandoLacsMedallionCount",
|
||||||
@ -3739,7 +3739,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
|
|
||||||
// Skip child stealth
|
// Skip child stealth
|
||||||
// Disabled when Skip Child Zelda is active
|
// Disabled when Skip Child Zelda is active
|
||||||
bool disableChildStealth = CVar_GetS32("gRandomizeSkipChildZelda", 0);
|
bool disableChildStealth = CVarGetInteger("gRandomizeSkipChildZelda", 0);
|
||||||
static const char* disableChildStealthText = "This option is disabled because \"Skip Child Zelda\" is enabled";
|
static const char* disableChildStealthText = "This option is disabled because \"Skip Child Zelda\" is enabled";
|
||||||
UIWidgets::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), "gRandomizeSkipChildStealth", disableChildStealth, disableChildStealthText);
|
UIWidgets::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), "gRandomizeSkipChildStealth", disableChildStealth, disableChildStealthText);
|
||||||
UIWidgets::InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping the guards.");
|
UIWidgets::InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping the guards.");
|
||||||
@ -3840,7 +3840,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
"\n"
|
"\n"
|
||||||
"Need Mask of Truth - Hints are only available whilst wearing the Mask of Truth.\n");
|
"Need Mask of Truth - Hints are only available whilst wearing the Mask of Truth.\n");
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, RO_GOSSIP_STONES_MAX, RO_GOSSIP_STONES_NEED_NOTHING);
|
UIWidgets::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, RO_GOSSIP_STONES_MAX, RO_GOSSIP_STONES_NEED_NOTHING);
|
||||||
if (CVar_GetS32("gRandomizeGossipStoneHints", RO_GOSSIP_STONES_NEED_NOTHING) != RO_GOSSIP_STONES_NONE) {
|
if (CVarGetInteger("gRandomizeGossipStoneHints", RO_GOSSIP_STONES_NEED_NOTHING) != RO_GOSSIP_STONES_NONE) {
|
||||||
// Hint Clarity
|
// Hint Clarity
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
@ -3946,7 +3946,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
locationsTabOpen = true;
|
locationsTabOpen = true;
|
||||||
RandomizerCheckObjects::UpdateImGuiVisibility();
|
RandomizerCheckObjects::UpdateImGuiVisibility();
|
||||||
// todo: this efficently when we build out cvar array support
|
// todo: this efficently when we build out cvar array support
|
||||||
std::stringstream excludedLocationStringStream(CVar_GetString("gRandomizeExcludedLocations", ""));
|
std::stringstream excludedLocationStringStream(CVarGetString("gRandomizeExcludedLocations", ""));
|
||||||
std::string excludedLocationString;
|
std::string excludedLocationString;
|
||||||
excludedLocations.clear();
|
excludedLocations.clear();
|
||||||
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
|
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
|
||||||
@ -3996,7 +3996,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
excludedLocationString += std::to_string(excludedLocationIt);
|
excludedLocationString += std::to_string(excludedLocationIt);
|
||||||
excludedLocationString += ",";
|
excludedLocationString += ",";
|
||||||
}
|
}
|
||||||
CVar_SetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -4037,7 +4037,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
excludedLocationString += std::to_string(excludedLocationIt);
|
excludedLocationString += std::to_string(excludedLocationIt);
|
||||||
excludedLocationString += ",";
|
excludedLocationString += ",";
|
||||||
}
|
}
|
||||||
CVar_SetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -4072,7 +4072,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
"No logic - Item placement is completely random. MAY BE IMPOSSIBLE TO BEAT."
|
"No logic - Item placement is completely random. MAY BE IMPOSSIBLE TO BEAT."
|
||||||
);
|
);
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeLogicRules", randoLogicRules, RO_LOGIC_MAX, RO_LOGIC_GLITCHLESS);
|
UIWidgets::EnhancementCombobox("gRandomizeLogicRules", randoLogicRules, RO_LOGIC_MAX, RO_LOGIC_GLITCHLESS);
|
||||||
if (CVar_GetS32("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) {
|
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
UIWidgets::EnhancementCheckbox(Settings::LocationsReachable.GetName().c_str(), "gRandomizeAllLocationsReachable", false, "", UIWidgets::CheckboxGraphics::Cross, RO_GENERIC_ON);
|
UIWidgets::EnhancementCheckbox(Settings::LocationsReachable.GetName().c_str(), "gRandomizeAllLocationsReachable", false, "", UIWidgets::CheckboxGraphics::Cross, RO_GENERIC_ON);
|
||||||
UIWidgets::InsertHelpHoverText(
|
UIWidgets::InsertHelpHoverText(
|
||||||
@ -4145,7 +4145,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
ImGui::BeginChild("ChildStartingEquipment", ImVec2(0, -8));
|
ImGui::BeginChild("ChildStartingEquipment", ImVec2(0, -8));
|
||||||
// Don't display this option if Dungeon Rewards are Shuffled to End of Dungeon.
|
// Don't display this option if Dungeon Rewards are Shuffled to End of Dungeon.
|
||||||
// TODO: Show this but disabled when we have options for disabled Comboboxes.
|
// TODO: Show this but disabled when we have options for disabled Comboboxes.
|
||||||
if (CVar_GetS32("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != RO_DUNGEON_REWARDS_END_OF_DUNGEON) {
|
if (CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != RO_DUNGEON_REWARDS_END_OF_DUNGEON) {
|
||||||
ImGui::Text(Settings::LinksPocketItem.GetName().c_str());
|
ImGui::Text(Settings::LinksPocketItem.GetName().c_str());
|
||||||
UIWidgets::EnhancementCombobox("gRandomizeLinksPocket", randoLinksPocket, RO_LINKS_POCKET_MAX, RO_LINKS_POCKET_DUNGEON_REWARD);
|
UIWidgets::EnhancementCombobox("gRandomizeLinksPocket", randoLinksPocket, RO_LINKS_POCKET_MAX, RO_LINKS_POCKET_DUNGEON_REWARD);
|
||||||
UIWidgets::PaddedSeparator();
|
UIWidgets::PaddedSeparator();
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../../../include/ultra64.h"
|
#include <libultraship/libultra.h>
|
||||||
#include "../../../include/z64item.h"
|
#include "z64item.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <soh/Enhancements/randomizer/randomizerTypes.h>
|
#include <soh/Enhancements/randomizer/randomizerTypes.h>
|
||||||
#include "soh/Enhancements/randomizer/randomizer_check_objects.h"
|
#include "soh/Enhancements/randomizer/randomizer_check_objects.h"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "randomizer_check_objects.h"
|
#include "randomizer_check_objects.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -924,40 +924,40 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
|
|||||||
(locationIt.rc != RC_UNKNOWN_CHECK) &&
|
(locationIt.rc != RC_UNKNOWN_CHECK) &&
|
||||||
(!RandomizerCheckObjects::AreaIsDungeon(locationIt.rcArea) ||
|
(!RandomizerCheckObjects::AreaIsDungeon(locationIt.rcArea) ||
|
||||||
locationIt.vOrMQ == RCVORMQ_BOTH ||
|
locationIt.vOrMQ == RCVORMQ_BOTH ||
|
||||||
locationIt.vOrMQ == RCVORMQ_MQ && CVar_GetS32("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_NONE && CVar_GetS32("gRandomizeMqDungeonCount", 0) > 0 || //at least one MQ dungeon
|
locationIt.vOrMQ == RCVORMQ_MQ && CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_NONE && CVarGetInteger("gRandomizeMqDungeonCount", 0) > 0 || //at least one MQ dungeon
|
||||||
locationIt.vOrMQ == RCVORMQ_VANILLA && (CVar_GetS32("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_NONE || CVar_GetS32("gRandomizeMqDungeonCount", 0) < 12) //at least one vanilla dungeon
|
locationIt.vOrMQ == RCVORMQ_VANILLA && (CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_NONE || CVarGetInteger("gRandomizeMqDungeonCount", 0) < 12) //at least one vanilla dungeon
|
||||||
) &&
|
) &&
|
||||||
(locationIt.rcType != RCTYPE_SHOP || CVar_GetS32("gRandomizeShopsanity", RO_SHOPSANITY_OFF) > RO_SHOPSANITY_ZERO_ITEMS) &&
|
(locationIt.rcType != RCTYPE_SHOP || CVarGetInteger("gRandomizeShopsanity", RO_SHOPSANITY_OFF) > RO_SHOPSANITY_ZERO_ITEMS) &&
|
||||||
(locationIt.rcType != RCTYPE_SCRUB || CVar_GetS32("gRandomizeShuffleScrubs", RO_SCRUBS_OFF) != RO_SCRUBS_OFF ||
|
(locationIt.rcType != RCTYPE_SCRUB || CVarGetInteger("gRandomizeShuffleScrubs", RO_SCRUBS_OFF) != RO_SCRUBS_OFF ||
|
||||||
locationIt.rc == RC_HF_DEKU_SCRUB_GROTTO || locationIt.rc == RC_LW_DEKU_SCRUB_GROTTO_FRONT || locationIt.rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE) && //The 3 scrubs that are always randomized
|
locationIt.rc == RC_HF_DEKU_SCRUB_GROTTO || locationIt.rc == RC_LW_DEKU_SCRUB_GROTTO_FRONT || locationIt.rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE) && //The 3 scrubs that are always randomized
|
||||||
(locationIt.rcType != RCTYPE_MERCHANT || CVar_GetS32("gRandomizeShuffleMerchants", RO_SHUFFLE_MERCHANTS_OFF) != RO_SHUFFLE_MERCHANTS_OFF) &&
|
(locationIt.rcType != RCTYPE_MERCHANT || CVarGetInteger("gRandomizeShuffleMerchants", RO_SHUFFLE_MERCHANTS_OFF) != RO_SHUFFLE_MERCHANTS_OFF) &&
|
||||||
(locationIt.rcType != RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?)
|
(locationIt.rcType != RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?)
|
||||||
(locationIt.rcType != RCTYPE_LINKS_POCKET) &&
|
(locationIt.rcType != RCTYPE_LINKS_POCKET) &&
|
||||||
(locationIt.rcType != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
|
(locationIt.rcType != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
|
||||||
((locationIt.rcType != RCTYPE_SKULL_TOKEN) ||
|
((locationIt.rcType != RCTYPE_SKULL_TOKEN) ||
|
||||||
(CVar_GetS32("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_ALL) ||
|
(CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_ALL) ||
|
||||||
((CVar_GetS32("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_OVERWORLD) && RandomizerCheckObjects::AreaIsOverworld(locationIt.rcArea)) ||
|
((CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_OVERWORLD) && RandomizerCheckObjects::AreaIsOverworld(locationIt.rcArea)) ||
|
||||||
((CVar_GetS32("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_DUNGEONS) && RandomizerCheckObjects::AreaIsDungeon(locationIt.rcArea))
|
((CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_DUNGEONS) && RandomizerCheckObjects::AreaIsDungeon(locationIt.rcArea))
|
||||||
) &&
|
) &&
|
||||||
((locationIt.rcType != RCTYPE_COW) || CVar_GetS32("gRandomizeShuffleCows", RO_GENERIC_NO)) &&
|
((locationIt.rcType != RCTYPE_COW) || CVarGetInteger("gRandomizeShuffleCows", RO_GENERIC_NO)) &&
|
||||||
((locationIt.rcType != RCTYPE_ADULT_TRADE) || CVar_GetS32("gRandomizeShuffleAdultTrade", RO_GENERIC_NO)) &&
|
((locationIt.rcType != RCTYPE_ADULT_TRADE) || CVarGetInteger("gRandomizeShuffleAdultTrade", RO_GENERIC_NO)) &&
|
||||||
((locationIt.rc != RC_KF_KOKIRI_SWORD_CHEST) || CVar_GetS32("gRandomizeShuffleKokiriSword", RO_GENERIC_NO)) &&
|
((locationIt.rc != RC_KF_KOKIRI_SWORD_CHEST) || CVarGetInteger("gRandomizeShuffleKokiriSword", RO_GENERIC_NO)) &&
|
||||||
((locationIt.rc != RC_ZR_MAGIC_BEAN_SALESMAN) || CVar_GetS32("gRandomizeShuffleBeans", RO_GENERIC_NO) == RO_GENERIC_YES) &&
|
((locationIt.rc != RC_ZR_MAGIC_BEAN_SALESMAN) || CVarGetInteger("gRandomizeShuffleBeans", RO_GENERIC_NO) == RO_GENERIC_YES) &&
|
||||||
((locationIt.rc != RC_HC_MALON_EGG) || CVar_GetS32("gRandomizeShuffleWeirdEgg", RO_GENERIC_NO)) &&
|
((locationIt.rc != RC_HC_MALON_EGG) || CVarGetInteger("gRandomizeShuffleWeirdEgg", RO_GENERIC_NO)) &&
|
||||||
((locationIt.rcType != RCTYPE_FROG_SONG) || CVar_GetS32("gRandomizeShuffleFrogSongRupees", RO_GENERIC_NO)) &&
|
((locationIt.rcType != RCTYPE_FROG_SONG) || CVarGetInteger("gRandomizeShuffleFrogSongRupees", RO_GENERIC_NO)) &&
|
||||||
((locationIt.rcType != RCTYPE_MAP_COMPASS) || CVar_GetS32("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) &&
|
((locationIt.rcType != RCTYPE_MAP_COMPASS) || CVarGetInteger("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) &&
|
||||||
((locationIt.rcType != RCTYPE_SMALL_KEY) || CVar_GetS32("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) &&
|
((locationIt.rcType != RCTYPE_SMALL_KEY) || CVarGetInteger("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) &&
|
||||||
((locationIt.rcType != RCTYPE_BOSS_KEY) || CVar_GetS32("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) &&
|
((locationIt.rcType != RCTYPE_BOSS_KEY) || CVarGetInteger("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) &&
|
||||||
((locationIt.rcType != RCTYPE_GANON_BOSS_KEY) || CVar_GetS32("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_VANILLA) &&
|
((locationIt.rcType != RCTYPE_GANON_BOSS_KEY) || CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_VANILLA) &&
|
||||||
(locationIt.rcType != RCTYPE_GF_KEY && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD ||
|
(locationIt.rcType != RCTYPE_GF_KEY && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD ||
|
||||||
(CVar_GetS32("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_OPEN && locationIt.rcType != RCTYPE_GF_KEY && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD) ||
|
(CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_OPEN && locationIt.rcType != RCTYPE_GF_KEY && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD) ||
|
||||||
(CVar_GetS32("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_FAST &&
|
(CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_FAST &&
|
||||||
((locationIt.rc == RC_GF_GERUDO_MEMBERSHIP_CARD && CVar_GetS32("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) ||
|
((locationIt.rc == RC_GF_GERUDO_MEMBERSHIP_CARD && CVarGetInteger("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) ||
|
||||||
(locationIt.rc == RC_GF_NORTH_F1_CARPENTER && CVar_GetS32("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))
|
(locationIt.rc == RC_GF_NORTH_F1_CARPENTER && CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))
|
||||||
) ||
|
) ||
|
||||||
(CVar_GetS32("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_NORMAL &&
|
(CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_NORMAL &&
|
||||||
((locationIt.rc == RC_GF_GERUDO_MEMBERSHIP_CARD && CVar_GetS32("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) ||
|
((locationIt.rc == RC_GF_GERUDO_MEMBERSHIP_CARD && CVarGetInteger("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) ||
|
||||||
(locationIt.rcType == RCTYPE_GF_KEY && CVar_GetS32("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))
|
(locationIt.rcType == RCTYPE_GF_KEY && CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Hooks.h>
|
#include <Hooks.h>
|
||||||
#include "3drando/item_location.hpp"
|
#include "3drando/item_location.hpp"
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ std::vector<uint32_t> buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT,
|
|||||||
|
|
||||||
void DrawCheckTracker(bool& open) {
|
void DrawCheckTracker(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gCheckTrackerEnabled", 0);
|
CVarSetInteger("gCheckTrackerEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,14 +120,14 @@ void DrawCheckTracker(bool& open) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gCheckTrackerWindowType", 1) == 0) {
|
if (CVarGetInteger("gCheckTrackerWindowType", 1) == 0) {
|
||||||
if (CVar_GetS32("gCheckTrackerShowOnlyPaused", 0) == 1)
|
if (CVarGetInteger("gCheckTrackerShowOnlyPaused", 0) == 1)
|
||||||
if (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)
|
if (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CVar_GetS32("gCheckTrackerDisplayType", 0) == 1) {
|
if (CVarGetInteger("gCheckTrackerDisplayType", 0) == 1) {
|
||||||
int comboButton1Mask = buttons[CVar_GetS32("gCheckTrackerComboButton1", 6)];
|
int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", 6)];
|
||||||
int comboButton2Mask = buttons[CVar_GetS32("gCheckTrackerComboButton2", 8)];
|
int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", 8)];
|
||||||
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
|
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
|
||||||
trackerButtonsPressed[0].button & comboButton1Mask &&
|
trackerButtonsPressed[0].button & comboButton1Mask &&
|
||||||
trackerButtonsPressed[0].button & comboButton2Mask;
|
trackerButtonsPressed[0].button & comboButton2Mask;
|
||||||
@ -213,17 +213,17 @@ void DrawCheckTracker(bool& open) {
|
|||||||
RainbowTick();
|
RainbowTick();
|
||||||
bool doDraw = false;
|
bool doDraw = false;
|
||||||
bool thisAreaFullyChecked = false;
|
bool thisAreaFullyChecked = false;
|
||||||
bool showHidden = CVar_GetS32("gCheckTrackerOptionShowHidden", 0);
|
bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0);
|
||||||
bool hideIncomplete = CVar_GetS32("gCheckTrackerAreaIncompleteHide", 0);
|
bool hideIncomplete = CVarGetInteger("gCheckTrackerAreaIncompleteHide", 0);
|
||||||
bool hideComplete = CVar_GetS32("gCheckTrackerAreaCompleteHide", 0);
|
bool hideComplete = CVarGetInteger("gCheckTrackerAreaCompleteHide", 0);
|
||||||
bool collapseLogic;
|
bool collapseLogic;
|
||||||
bool doingCollapseOrExpand = optExpandAll || optCollapseAll;
|
bool doingCollapseOrExpand = optExpandAll || optCollapseAll;
|
||||||
bool isThisAreaSpoiled;
|
bool isThisAreaSpoiled;
|
||||||
RandomizerCheckArea lastArea = RCAREA_INVALID;
|
RandomizerCheckArea lastArea = RCAREA_INVALID;
|
||||||
Color_RGBA8 areaCompleteColor = CVar_GetRGBA("gCheckTrackerAreaMainCompleteColor", Color_Main_Default);
|
Color_RGBA8 areaCompleteColor = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default);
|
||||||
Color_RGBA8 areaIncompleteColor = CVar_GetRGBA("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
|
Color_RGBA8 areaIncompleteColor = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
|
||||||
Color_RGBA8 extraCompleteColor = CVar_GetRGBA("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default);
|
Color_RGBA8 extraCompleteColor = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default);
|
||||||
Color_RGBA8 extraIncompleteColor = CVar_GetRGBA("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
|
Color_RGBA8 extraIncompleteColor = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
|
||||||
Color_RGBA8 mainColor;
|
Color_RGBA8 mainColor;
|
||||||
Color_RGBA8 extraColor;
|
Color_RGBA8 extraColor;
|
||||||
std::string stemp;
|
std::string stemp;
|
||||||
@ -283,7 +283,7 @@ void DrawCheckTracker(bool& open) {
|
|||||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f,
|
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f,
|
||||||
extraColor.b / 255.0f, extraColor.a / 255.0f));
|
extraColor.b / 255.0f, extraColor.a / 255.0f));
|
||||||
|
|
||||||
isThisAreaSpoiled = areasSpoiled & areaMask || CVar_GetS32("gCheckTrackerOptionMQSpoilers", 0);
|
isThisAreaSpoiled = areasSpoiled & areaMask || CVarGetInteger("gCheckTrackerOptionMQSpoilers", 0);
|
||||||
|
|
||||||
if (isThisAreaSpoiled) {
|
if (isThisAreaSpoiled) {
|
||||||
if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(obj.rcArea)) {
|
if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(obj.rcArea)) {
|
||||||
@ -334,12 +334,12 @@ void BeginFloatWindows(std::string UniqueName, ImGuiWindowFlags flags) {
|
|||||||
ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoFocusOnAppearing;
|
ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoFocusOnAppearing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CVar_GetS32("gCheckTrackerWindowType", 1)) {
|
if (!CVarGetInteger("gCheckTrackerWindowType", 1)) {
|
||||||
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
|
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
|
||||||
windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar |
|
windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar |
|
||||||
ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar;
|
ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar;
|
||||||
|
|
||||||
if (!CVar_GetS32("gCheckTrackerHudEditMode", 0)) {
|
if (!CVarGetInteger("gCheckTrackerHudEditMode", 0)) {
|
||||||
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
|
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -602,7 +602,7 @@ bool SlowUpdateCheck() {
|
|||||||
|
|
||||||
bool ShouldUpdateChecks() {
|
bool ShouldUpdateChecks() {
|
||||||
// TODO eventually will need to be hooked into game elements rather than just save file
|
// TODO eventually will need to be hooked into game elements rather than just save file
|
||||||
if (CVar_GetS32("gCheckTrackerOptionPerformanceMode", 0))
|
if (CVarGetInteger("gCheckTrackerOptionPerformanceMode", 0))
|
||||||
return SlowUpdateCheck();
|
return SlowUpdateCheck();
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
@ -742,7 +742,7 @@ bool HasItemBeenCollected(RandomizerCheckObject obj) {
|
|||||||
case SpoilerCollectionCheckType::SPOILER_CHK_GRAVEDIGGER:
|
case SpoilerCollectionCheckType::SPOILER_CHK_GRAVEDIGGER:
|
||||||
// Gravedigger has a fix in place that means one of two save locations. Check both.
|
// Gravedigger has a fix in place that means one of two save locations. Check both.
|
||||||
return (gSaveContext.itemGetInf[1] & 0x1000) || // vanilla flag
|
return (gSaveContext.itemGetInf[1] & 0x1000) || // vanilla flag
|
||||||
((gSaveContext.n64ddFlag || CVar_GetS32("gGravediggingTourFix", 0)) &&
|
((gSaveContext.n64ddFlag || CVarGetInteger("gGravediggingTourFix", 0)) &&
|
||||||
gSaveContext.sceneFlags[scene].collect & (1 << flag)); // rando/fix flag
|
gSaveContext.sceneFlags[scene].collect & (1 << flag)); // rando/fix flag
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -754,43 +754,43 @@ void DrawLocation(RandomizerCheckObject rcObj, RandomizerCheckShow* thisCheckSta
|
|||||||
Color_RGBA8 mainColor;
|
Color_RGBA8 mainColor;
|
||||||
Color_RGBA8 extraColor;
|
Color_RGBA8 extraColor;
|
||||||
std::string txt;
|
std::string txt;
|
||||||
bool showHidden = CVar_GetS32("gCheckTrackerOptionShowHidden", 0);
|
bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0);
|
||||||
|
|
||||||
if (*thisCheckStatus == RCSHOW_UNCHECKED) {
|
if (*thisCheckStatus == RCSHOW_UNCHECKED) {
|
||||||
if (!showHidden && CVar_GetS32("gCheckTrackerUncheckedHide", 0))
|
if (!showHidden && CVarGetInteger("gCheckTrackerUncheckedHide", 0))
|
||||||
return;
|
return;
|
||||||
mainColor = CVar_GetRGBA("gCheckTrackerUncheckedMainColor", Color_Main_Default);
|
mainColor = CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default);
|
||||||
extraColor = CVar_GetRGBA("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default);
|
extraColor = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default);
|
||||||
} else if (*thisCheckStatus == RCSHOW_SKIPPED) {
|
} else if (*thisCheckStatus == RCSHOW_SKIPPED) {
|
||||||
if (!showHidden && CVar_GetS32("gCheckTrackerSkippedHide", 0))
|
if (!showHidden && CVarGetInteger("gCheckTrackerSkippedHide", 0))
|
||||||
return;
|
return;
|
||||||
mainColor = CVar_GetRGBA("gCheckTrackerSkippedMainColor", Color_Main_Default);
|
mainColor = CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default);
|
||||||
extraColor = CVar_GetRGBA("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default);
|
extraColor = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default);
|
||||||
} else if (*thisCheckStatus == RCSHOW_SEEN) {
|
} else if (*thisCheckStatus == RCSHOW_SEEN) {
|
||||||
if (!showHidden && CVar_GetS32("gCheckTrackerSeenHide", 0))
|
if (!showHidden && CVarGetInteger("gCheckTrackerSeenHide", 0))
|
||||||
return;
|
return;
|
||||||
mainColor = CVar_GetRGBA("gCheckTrackerSeenMainColor", Color_Main_Default);
|
mainColor = CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default);
|
||||||
extraColor = CVar_GetRGBA("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default);
|
extraColor = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default);
|
||||||
} else if (*thisCheckStatus == RCSHOW_HINTED) {
|
} else if (*thisCheckStatus == RCSHOW_HINTED) {
|
||||||
if (!showHidden && CVar_GetS32("gCheckTrackerHintedHide", 0))
|
if (!showHidden && CVarGetInteger("gCheckTrackerHintedHide", 0))
|
||||||
return;
|
return;
|
||||||
mainColor = CVar_GetRGBA("gCheckTrackerHintedMainColor", Color_Main_Default);
|
mainColor = CVarGetColor("gCheckTrackerHintedMainColor", Color_Main_Default);
|
||||||
extraColor = CVar_GetRGBA("gCheckTrackerHintedExtraColor", Color_Hinted_Extra_Default);
|
extraColor = CVarGetColor("gCheckTrackerHintedExtraColor", Color_Hinted_Extra_Default);
|
||||||
} else if (*thisCheckStatus == RCSHOW_CHECKED) {
|
} else if (*thisCheckStatus == RCSHOW_CHECKED) {
|
||||||
if (!showHidden && CVar_GetS32("gCheckTrackerCheckedHide", 0))
|
if (!showHidden && CVarGetInteger("gCheckTrackerCheckedHide", 0))
|
||||||
return;
|
return;
|
||||||
mainColor = CVar_GetRGBA("gCheckTrackerCheckedMainColor", Color_Main_Default);
|
mainColor = CVarGetColor("gCheckTrackerCheckedMainColor", Color_Main_Default);
|
||||||
extraColor = CVar_GetRGBA("gCheckTrackerCheckedExtraColor", Color_Checked_Extra_Default);
|
extraColor = CVarGetColor("gCheckTrackerCheckedExtraColor", Color_Checked_Extra_Default);
|
||||||
} else if (*thisCheckStatus == RCSHOW_SCUMMED) {
|
} else if (*thisCheckStatus == RCSHOW_SCUMMED) {
|
||||||
if (!showHidden && CVar_GetS32("gCheckTrackerScummedHide", 0))
|
if (!showHidden && CVarGetInteger("gCheckTrackerScummedHide", 0))
|
||||||
return;
|
return;
|
||||||
mainColor = CVar_GetRGBA("gCheckTrackerScummedMainColor", Color_Main_Default);
|
mainColor = CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default);
|
||||||
extraColor = CVar_GetRGBA("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default);
|
extraColor = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default);
|
||||||
} else if (*thisCheckStatus == RCSHOW_SAVED) {
|
} else if (*thisCheckStatus == RCSHOW_SAVED) {
|
||||||
if (!showHidden && CVar_GetS32("gCheckTrackerSavedHide", 0))
|
if (!showHidden && CVarGetInteger("gCheckTrackerSavedHide", 0))
|
||||||
return;
|
return;
|
||||||
mainColor = CVar_GetRGBA("gCheckTrackerSavedMainColor", Color_Main_Default);
|
mainColor = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default);
|
||||||
extraColor = CVar_GetRGBA("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
|
extraColor = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Main Text
|
//Main Text
|
||||||
@ -870,9 +870,9 @@ static std::set<std::string> rainbowCVars = {
|
|||||||
|
|
||||||
int hue = 0;
|
int hue = 0;
|
||||||
void RainbowTick() {
|
void RainbowTick() {
|
||||||
float freqHue = hue * 2 * M_PI / (360 * CVar_GetFloat("gCosmetics.RainbowSpeed", 0.6f));
|
float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f));
|
||||||
for (auto cvar : rainbowCVars) {
|
for (auto cvar : rainbowCVars) {
|
||||||
if (CVar_GetS32((cvar + "RBM").c_str(), 0) == 0)
|
if (CVarGetInteger((cvar + "RBM").c_str(), 0) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Color_RGBA8 newColor;
|
Color_RGBA8 newColor;
|
||||||
@ -881,7 +881,7 @@ void RainbowTick() {
|
|||||||
newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128;
|
newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128;
|
||||||
newColor.a = 255;
|
newColor.a = 255;
|
||||||
|
|
||||||
CVar_SetRGBA(cvar.c_str(), newColor);
|
CVarSetColor(cvar.c_str(), newColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
hue++;
|
hue++;
|
||||||
@ -891,8 +891,8 @@ void RainbowTick() {
|
|||||||
void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName, const char* cvarExtraName,
|
void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName, const char* cvarExtraName,
|
||||||
Color_RGBA8& main_color, Color_RGBA8& extra_color, Color_RGBA8& main_default_color,
|
Color_RGBA8& main_color, Color_RGBA8& extra_color, Color_RGBA8& main_default_color,
|
||||||
Color_RGBA8& extra_default_color, const char* cvarHideName) {
|
Color_RGBA8& extra_default_color, const char* cvarHideName) {
|
||||||
Color_RGBA8 cvarMainColor = CVar_GetRGBA(cvarMainName, main_default_color);
|
Color_RGBA8 cvarMainColor = CVarGetColor(cvarMainName, main_default_color);
|
||||||
Color_RGBA8 cvarExtraColor = CVar_GetRGBA(cvarExtraName, extra_default_color);
|
Color_RGBA8 cvarExtraColor = CVarGetColor(cvarExtraName, extra_default_color);
|
||||||
main_color = cvarMainColor;
|
main_color = cvarMainColor;
|
||||||
extra_color = cvarExtraColor;
|
extra_color = cvarExtraColor;
|
||||||
|
|
||||||
@ -914,7 +914,7 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
|
|||||||
ImVec4(main_color.r, main_color.g, main_color.b, main_color.a),
|
ImVec4(main_color.r, main_color.g, main_color.b, main_color.a),
|
||||||
ImVec4(main_default_color.r, main_default_color.g, main_default_color.b, main_default_color.a)))
|
ImVec4(main_default_color.r, main_default_color.g, main_default_color.b, main_default_color.a)))
|
||||||
{
|
{
|
||||||
main_color = CVar_GetRGBA(cvarMainName, main_default_color);
|
main_color = CVarGetColor(cvarMainName, main_default_color);
|
||||||
};
|
};
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
|
|||||||
ImVec4(extra_color.r, extra_color.g, extra_color.b, extra_color.a),
|
ImVec4(extra_color.r, extra_color.g, extra_color.b, extra_color.a),
|
||||||
ImVec4(extra_default_color.r, extra_default_color.g, extra_default_color.b, extra_default_color.a)))
|
ImVec4(extra_default_color.r, extra_default_color.g, extra_default_color.b, extra_default_color.a)))
|
||||||
{
|
{
|
||||||
extra_color = CVar_GetRGBA(cvarExtraName, extra_default_color);
|
extra_color = CVarGetColor(cvarExtraName, extra_default_color);
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Le
|
|||||||
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
|
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
|
||||||
void DrawCheckTrackerOptions(bool& open) {
|
void DrawCheckTrackerOptions(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gCheckTrackerSettingsEnabled", 0);
|
CVarSetInteger("gCheckTrackerSettingsEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -966,7 +966,7 @@ void DrawCheckTrackerOptions(bool& open) {
|
|||||||
ImVec4(Color_Bg_Default.r, Color_Bg_Default.g, Color_Bg_Default.b, Color_Bg_Default.a),
|
ImVec4(Color_Bg_Default.r, Color_Bg_Default.g, Color_Bg_Default.b, Color_Bg_Default.a),
|
||||||
false, true))
|
false, true))
|
||||||
{
|
{
|
||||||
Color_Background = CVar_GetRGBA("gCheckTrackerBgColor", Color_Bg_Default);
|
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
@ -974,13 +974,13 @@ void DrawCheckTrackerOptions(bool& open) {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
UIWidgets::EnhancementCombobox("gCheckTrackerWindowType", windowType, 2, 1);
|
UIWidgets::EnhancementCombobox("gCheckTrackerWindowType", windowType, 2, 1);
|
||||||
|
|
||||||
if (CVar_GetS32("gCheckTrackerWindowType", 1) == 0) {
|
if (CVarGetInteger("gCheckTrackerWindowType", 1) == 0) {
|
||||||
UIWidgets::EnhancementCheckbox("Enable Dragging", "gCheckTrackerHudEditMode");
|
UIWidgets::EnhancementCheckbox("Enable Dragging", "gCheckTrackerHudEditMode");
|
||||||
UIWidgets::EnhancementCheckbox("Only enable while paused", "gCheckTrackerShowOnlyPaused");
|
UIWidgets::EnhancementCheckbox("Only enable while paused", "gCheckTrackerShowOnlyPaused");
|
||||||
ImGui::Text("Display Mode");
|
ImGui::Text("Display Mode");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
UIWidgets::EnhancementCombobox("gCheckTrackerDisplayType", displayType, 2, 0);
|
UIWidgets::EnhancementCombobox("gCheckTrackerDisplayType", displayType, 2, 0);
|
||||||
if (CVar_GetS32("gCheckTrackerDisplayType", 0) > 0) {
|
if (CVarGetInteger("gCheckTrackerDisplayType", 0) > 0) {
|
||||||
ImGui::Text("Combo Button 1");
|
ImGui::Text("Combo Button 1");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
UIWidgets::EnhancementCombobox("gCheckTrackerComboButton1", buttonStrings, 14, 6);
|
UIWidgets::EnhancementCombobox("gCheckTrackerComboButton1", buttonStrings, 14, 6);
|
||||||
@ -1012,27 +1012,27 @@ void DrawCheckTrackerOptions(bool& open) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InitCheckTracker() {
|
void InitCheckTracker() {
|
||||||
SohImGui::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVar_GetS32("gCheckTrackerEnabled", 0) == 1);
|
SohImGui::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVarGetInteger("gCheckTrackerEnabled", 0) == 1);
|
||||||
SohImGui::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions);
|
SohImGui::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions);
|
||||||
Color_Background = CVar_GetRGBA("gCheckTrackerBgColor", Color_Bg_Default);
|
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
|
||||||
Color_Area_Incomplete_Main = CVar_GetRGBA("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
|
Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
|
||||||
Color_Area_Incomplete_Extra = CVar_GetRGBA("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
|
Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
|
||||||
Color_Area_Complete_Main = CVar_GetRGBA("gCheckTrackerAreaMainCompleteColor", Color_Main_Default);
|
Color_Area_Complete_Main = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default);
|
||||||
Color_Area_Complete_Extra = CVar_GetRGBA("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default);
|
Color_Area_Complete_Extra = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default);
|
||||||
Color_Unchecked_Main = CVar_GetRGBA("gCheckTrackerUncheckedMainColor", Color_Main_Default);
|
Color_Unchecked_Main = CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default);
|
||||||
Color_Unchecked_Extra = CVar_GetRGBA("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default);
|
Color_Unchecked_Extra = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default);
|
||||||
Color_Skipped_Main = CVar_GetRGBA("gCheckTrackerSkippedMainColor", Color_Main_Default);
|
Color_Skipped_Main = CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default);
|
||||||
Color_Skipped_Extra = CVar_GetRGBA("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default);
|
Color_Skipped_Extra = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default);
|
||||||
Color_Seen_Main = CVar_GetRGBA("gCheckTrackerSeenMainColor", Color_Main_Default);
|
Color_Seen_Main = CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default);
|
||||||
Color_Seen_Extra = CVar_GetRGBA("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default);
|
Color_Seen_Extra = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default);
|
||||||
Color_Hinted_Main = CVar_GetRGBA("gCheckTrackerHintedMainColor", Color_Main_Default);
|
Color_Hinted_Main = CVarGetColor("gCheckTrackerHintedMainColor", Color_Main_Default);
|
||||||
Color_Hinted_Extra = CVar_GetRGBA("gCheckTrackerHintedExtraColor", Color_Hinted_Extra_Default);
|
Color_Hinted_Extra = CVarGetColor("gCheckTrackerHintedExtraColor", Color_Hinted_Extra_Default);
|
||||||
Color_Checked_Main = CVar_GetRGBA("gCheckTrackerCheckedMainColor", Color_Main_Default);
|
Color_Checked_Main = CVarGetColor("gCheckTrackerCheckedMainColor", Color_Main_Default);
|
||||||
Color_Checked_Extra = CVar_GetRGBA("gCheckTrackerCheckedExtraColor", Color_Checked_Extra_Default);
|
Color_Checked_Extra = CVarGetColor("gCheckTrackerCheckedExtraColor", Color_Checked_Extra_Default);
|
||||||
Color_Scummed_Main = CVar_GetRGBA("gCheckTrackerScummedMainColor", Color_Main_Default);
|
Color_Scummed_Main = CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default);
|
||||||
Color_Scummed_Extra = CVar_GetRGBA("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default);
|
Color_Scummed_Extra = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default);
|
||||||
Color_Saved_Main = CVar_GetRGBA("gCheckTrackerSavedMainColor", Color_Main_Default);
|
Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default);
|
||||||
Color_Saved_Extra = CVar_GetRGBA("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
|
Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
|
||||||
|
|
||||||
Ship::RegisterHook<Ship::ControllerRead>([](OSContPad* cont_pad) {
|
Ship::RegisterHook<Ship::ControllerRead>([](OSContPad* cont_pad) {
|
||||||
trackerButtonsPressed = cont_pad;
|
trackerButtonsPressed = cont_pad;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Hooks.h>
|
#include <Hooks.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -607,7 +607,7 @@ void InitEntranceTrackingData() {
|
|||||||
|
|
||||||
void DrawEntranceTracker(bool& open) {
|
void DrawEntranceTracker(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gEntranceTrackerEnabled", 0);
|
CVarSetInteger("gEntranceTrackerEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,8 +717,8 @@ void DrawEntranceTracker(bool& open) {
|
|||||||
nextTreeState = 2;
|
nextTreeState = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t destToggle = CVar_GetS32("gEntranceTrackerSortBy", 0);
|
uint8_t destToggle = CVarGetInteger("gEntranceTrackerSortBy", 0);
|
||||||
uint8_t groupToggle = CVar_GetS32("gEntranceTrackerGroupBy", 0);
|
uint8_t groupToggle = CVarGetInteger("gEntranceTrackerGroupBy", 0);
|
||||||
|
|
||||||
// Combine destToggle and groupToggle to get a range of 0-3
|
// Combine destToggle and groupToggle to get a range of 0-3
|
||||||
uint8_t groupType = destToggle + (groupToggle * 2);
|
uint8_t groupType = destToggle + (groupToggle * 2);
|
||||||
@ -765,8 +765,8 @@ void DrawEntranceTracker(bool& open) {
|
|||||||
|
|
||||||
bool isDiscovered = IsEntranceDiscovered(entrance.index);
|
bool isDiscovered = IsEntranceDiscovered(entrance.index);
|
||||||
|
|
||||||
bool showOriginal = (!destToggle ? CVar_GetS32("gEntranceTrackerShowTo", 0) : CVar_GetS32("gEntranceTrackerShowFrom", 0)) || isDiscovered;
|
bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered;
|
||||||
bool showOverride = (!destToggle ? CVar_GetS32("gEntranceTrackerShowFrom", 0) : CVar_GetS32("gEntranceTrackerShowTo", 0)) || isDiscovered;
|
bool showOverride = (!destToggle ? CVarGetInteger("gEntranceTrackerShowFrom", 0) : CVarGetInteger("gEntranceTrackerShowTo", 0)) || isDiscovered;
|
||||||
|
|
||||||
const char* origSrcAreaName = spoilerEntranceGroupNames[original->srcGroup].c_str();
|
const char* origSrcAreaName = spoilerEntranceGroupNames[original->srcGroup].c_str();
|
||||||
const char* origTypeName = groupTypeNames[original->type].c_str();
|
const char* origTypeName = groupTypeNames[original->type].c_str();
|
||||||
@ -779,7 +779,7 @@ void DrawEntranceTracker(bool& open) {
|
|||||||
const char* rplcDstName = showOverride ? override->destination.c_str() : "";
|
const char* rplcDstName = showOverride ? override->destination.c_str() : "";
|
||||||
|
|
||||||
// Filter for entrances by group name, type, source/destination names, and meta tags
|
// Filter for entrances by group name, type, source/destination names, and meta tags
|
||||||
if ((!locationSearch.IsActive() && (showOriginal || showOverride || !CVar_GetS32("gEntranceTrackerCollapseUndiscovered", 0))) ||
|
if ((!locationSearch.IsActive() && (showOriginal || showOverride || !CVarGetInteger("gEntranceTrackerCollapseUndiscovered", 0))) ||
|
||||||
((showOriginal && (locationSearch.PassFilter(origSrcName) ||
|
((showOriginal && (locationSearch.PassFilter(origSrcName) ||
|
||||||
locationSearch.PassFilter(origDstName) || locationSearch.PassFilter(origSrcAreaName) ||
|
locationSearch.PassFilter(origDstName) || locationSearch.PassFilter(origSrcAreaName) ||
|
||||||
locationSearch.PassFilter(origTypeName) || locationSearch.PassFilter(original->metaTag.c_str()))) ||
|
locationSearch.PassFilter(origTypeName) || locationSearch.PassFilter(original->metaTag.c_str()))) ||
|
||||||
@ -817,8 +817,8 @@ void DrawEntranceTracker(bool& open) {
|
|||||||
|
|
||||||
bool isDiscovered = IsEntranceDiscovered(entrance.index);
|
bool isDiscovered = IsEntranceDiscovered(entrance.index);
|
||||||
|
|
||||||
bool showOriginal = (!destToggle ? CVar_GetS32("gEntranceTrackerShowTo", 0) : CVar_GetS32("gEntranceTrackerShowFrom", 0)) || isDiscovered;
|
bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered;
|
||||||
bool showOverride = (!destToggle ? CVar_GetS32("gEntranceTrackerShowFrom", 0) : CVar_GetS32("gEntranceTrackerShowTo", 0)) || isDiscovered;
|
bool showOverride = (!destToggle ? CVarGetInteger("gEntranceTrackerShowFrom", 0) : CVarGetInteger("gEntranceTrackerShowTo", 0)) || isDiscovered;
|
||||||
|
|
||||||
const char* unknown = "???";
|
const char* unknown = "???";
|
||||||
|
|
||||||
@ -831,18 +831,18 @@ void DrawEntranceTracker(bool& open) {
|
|||||||
|
|
||||||
// Handle highlighting and auto scroll
|
// Handle highlighting and auto scroll
|
||||||
if (LinkIsInArea(original) != -1) {
|
if (LinkIsInArea(original) != -1) {
|
||||||
if (CVar_GetS32("gEntranceTrackerHighlightAvailable", 0)) {
|
if (CVarGetInteger("gEntranceTrackerHighlightAvailable", 0)) {
|
||||||
color = COLOR_GREEN;
|
color = COLOR_GREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doAreaScroll) {
|
if (doAreaScroll) {
|
||||||
doAreaScroll = false;
|
doAreaScroll = false;
|
||||||
if (CVar_GetS32("gEntranceTrackerAutoScroll", 0)) {
|
if (CVarGetInteger("gEntranceTrackerAutoScroll", 0)) {
|
||||||
ImGui::SetScrollHereY(0.0f);
|
ImGui::SetScrollHereY(0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (original->index == lastEntranceIndex) {
|
} else if (original->index == lastEntranceIndex) {
|
||||||
if (CVar_GetS32("gEntranceTrackerHighlightPrevious", 0)) {
|
if (CVarGetInteger("gEntranceTrackerHighlightPrevious", 0)) {
|
||||||
color = COLOR_ORANGE;
|
color = COLOR_ORANGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -887,5 +887,5 @@ void DrawEntranceTracker(bool& open) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InitEntranceTracker() {
|
void InitEntranceTracker() {
|
||||||
SohImGui::AddWindow("Randomizer", "Entrance Tracker", DrawEntranceTracker, CVar_GetS32("gEntranceTrackerEnabled", 0) == 1);
|
SohImGui::AddWindow("Randomizer", "Entrance Tracker", DrawEntranceTracker, CVarGetInteger("gEntranceTrackerEnabled", 0) == 1);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Hooks.h>
|
#include <Hooks.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -352,11 +352,11 @@ ItemTrackerNumbers GetItemCurrentAndMax(ItemTrackerItem item) {
|
|||||||
#define IM_COL_PURPLE IM_COL32(180, 90, 200, 255)
|
#define IM_COL_PURPLE IM_COL32(180, 90, 200, 255)
|
||||||
|
|
||||||
void DrawItemCount(ItemTrackerItem item) {
|
void DrawItemCount(ItemTrackerItem item) {
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ItemTrackerNumbers currentAndMax = GetItemCurrentAndMax(item);
|
ItemTrackerNumbers currentAndMax = GetItemCurrentAndMax(item);
|
||||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
int32_t trackerNumberDisplayMode = CVar_GetS32("gItemTrackerCapacityTrack", 1);
|
int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", 1);
|
||||||
int32_t trackerKeyNumberDisplayMode = CVar_GetS32("gItemTrackerKeyTrack", 0);
|
int32_t trackerKeyNumberDisplayMode = CVarGetInteger("gItemTrackerKeyTrack", 0);
|
||||||
|
|
||||||
if (item.id == ITEM_KEY_SMALL && IsValidSaveFile()) {
|
if (item.id == ITEM_KEY_SMALL && IsValidSaveFile()) {
|
||||||
std::string currentString = "";
|
std::string currentString = "";
|
||||||
@ -387,7 +387,7 @@ void DrawItemCount(ItemTrackerItem item) {
|
|||||||
ImU32 currentColor = IM_COL_WHITE;
|
ImU32 currentColor = IM_COL_WHITE;
|
||||||
ImU32 maxColor = item.id == QUEST_SKULL_TOKEN ? IM_COL_RED : IM_COL_GREEN;
|
ImU32 maxColor = item.id == QUEST_SKULL_TOKEN ? IM_COL_RED : IM_COL_GREEN;
|
||||||
|
|
||||||
bool shouldAlignToLeft = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) &&
|
bool shouldAlignToLeft = CVarGetInteger("gItemTrackerCurrentOnLeft", 0) &&
|
||||||
trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_CAPACITY &&
|
trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_CAPACITY &&
|
||||||
trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_AMMO;
|
trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_AMMO;
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ void DrawItemCount(ItemTrackerItem item) {
|
|||||||
|
|
||||||
void DrawEquip(ItemTrackerItem item) {
|
void DrawEquip(ItemTrackerItem item) {
|
||||||
bool hasEquip = (item.data & gSaveContext.inventory.equipment) != 0;
|
bool hasEquip = (item.data & gSaveContext.inventory.equipment) != 0;
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::Image(SohImGui::GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(SohImGui::GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ void DrawEquip(ItemTrackerItem item) {
|
|||||||
|
|
||||||
void DrawQuest(ItemTrackerItem item) {
|
void DrawQuest(ItemTrackerItem item) {
|
||||||
bool hasQuestItem = (item.data & gSaveContext.inventory.questItems) != 0;
|
bool hasQuestItem = (item.data & gSaveContext.inventory.questItems) != 0;
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::Image(SohImGui::GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(SohImGui::GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
@ -471,7 +471,7 @@ void DrawQuest(ItemTrackerItem item) {
|
|||||||
|
|
||||||
void DrawItem(ItemTrackerItem item) {
|
void DrawItem(ItemTrackerItem item) {
|
||||||
uint32_t actualItemId = INV_CONTENT(item.id);
|
uint32_t actualItemId = INV_CONTENT(item.id);
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
bool hasItem = actualItemId != ITEM_NONE;
|
bool hasItem = actualItemId != ITEM_NONE;
|
||||||
|
|
||||||
if (item.id == ITEM_NONE) {
|
if (item.id == ITEM_NONE) {
|
||||||
@ -532,7 +532,7 @@ void DrawBottle(ItemTrackerItem item) {
|
|||||||
item = actualItemTrackerItemMap[actualItemId];
|
item = actualItemTrackerItemMap[actualItemId];
|
||||||
}
|
}
|
||||||
|
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::Image(SohImGui::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(SohImGui::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
|
||||||
@ -543,7 +543,7 @@ void DrawDungeonItem(ItemTrackerItem item) {
|
|||||||
uint32_t itemId = item.id;
|
uint32_t itemId = item.id;
|
||||||
ImU32 dungeonColor = IM_COL_WHITE;
|
ImU32 dungeonColor = IM_COL_WHITE;
|
||||||
uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
|
uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[item.data]) != 0;
|
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[item.data]) != 0;
|
||||||
bool hasSmallKey = (gSaveContext.inventory.dungeonKeys[item.data]) >= 0;
|
bool hasSmallKey = (gSaveContext.inventory.dungeonKeys[item.data]) >= 0;
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
@ -587,7 +587,7 @@ void DrawDungeonItem(ItemTrackerItem item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawSong(ItemTrackerItem item) {
|
void DrawSong(ItemTrackerItem item) {
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
uint32_t bitMask = 1 << item.id;
|
uint32_t bitMask = 1 << item.id;
|
||||||
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
|
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
|
||||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
@ -601,8 +601,8 @@ static ImVector<char> itemTrackerNotes;
|
|||||||
|
|
||||||
void DrawNotes(bool resizeable = false) {
|
void DrawNotes(bool resizeable = false) {
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
int iconSpacing = CVar_GetS32("gItemTrackerIconSpacing", 12);
|
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12);
|
||||||
|
|
||||||
struct ItemTrackerNotes {
|
struct ItemTrackerNotes {
|
||||||
static int TrackerNotesResizeCallback(ImGuiInputTextCallbackData* data) {
|
static int TrackerNotesResizeCallback(ImGuiInputTextCallbackData* data) {
|
||||||
@ -627,7 +627,7 @@ void DrawNotes(bool resizeable = false) {
|
|||||||
ImVec2 size = resizeable ? ImVec2(-FLT_MIN, ImGui::GetContentRegionAvail().y) : ImVec2(((iconSize + iconSpacing) * 6) - 8, 200);
|
ImVec2 size = resizeable ? ImVec2(-FLT_MIN, ImGui::GetContentRegionAvail().y) : ImVec2(((iconSize + iconSpacing) * 6) - 8, 200);
|
||||||
ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput);
|
ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput);
|
||||||
if (ImGui::IsItemDeactivatedAfterEdit() && IsValidSaveFile()) {
|
if (ImGui::IsItemDeactivatedAfterEdit() && IsValidSaveFile()) {
|
||||||
CVar_SetString(("gItemTrackerNotes" + std::to_string(gSaveContext.fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str());
|
CVarSetString(("gItemTrackerNotes" + std::to_string(gSaveContext.fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str());
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
@ -642,11 +642,11 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) {
|
|||||||
windowFlags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize;
|
windowFlags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CVar_GetS32("gItemTrackerWindowType", 0)) {
|
if (!CVarGetInteger("gItemTrackerWindowType", 0)) {
|
||||||
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
|
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
|
||||||
windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar;
|
windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar;
|
||||||
|
|
||||||
if (!CVar_GetS32("gItemTrackerHudEditMode", 0)) {
|
if (!CVarGetInteger("gItemTrackerHudEditMode", 0)) {
|
||||||
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
|
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -667,9 +667,9 @@ void EndFloatingWindows() {
|
|||||||
* Takes in a vector of ItemTrackerItem and draws them in rows of N items
|
* Takes in a vector of ItemTrackerItem and draws them in rows of N items
|
||||||
*/
|
*/
|
||||||
void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
|
void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
int iconSpacing = CVar_GetS32("gItemTrackerIconSpacing", 12);
|
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12);
|
||||||
int topPadding = CVar_GetS32("gItemTrackerWindowType", 0) ? 20 : 0;
|
int topPadding = CVarGetInteger("gItemTrackerWindowType", 0) ? 20 : 0;
|
||||||
|
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
int row = i / columns;
|
int row = i / columns;
|
||||||
@ -684,8 +684,8 @@ void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
|
|||||||
* Takes in a vector of ItemTrackerItem and draws them evenly spread across a circle
|
* Takes in a vector of ItemTrackerItem and draws them evenly spread across a circle
|
||||||
*/
|
*/
|
||||||
void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
|
void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
int iconSpacing = CVar_GetS32("gItemTrackerIconSpacing", 12);
|
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12);
|
||||||
|
|
||||||
ImVec2 max = ImGui::GetWindowContentRegionMax();
|
ImVec2 max = ImGui::GetWindowContentRegionMax();
|
||||||
float radius = (iconSize + iconSpacing) * 2;
|
float radius = (iconSize + iconSpacing) * 2;
|
||||||
@ -705,8 +705,8 @@ void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
|
|||||||
* to then call DrawItemsInRows
|
* to then call DrawItemsInRows
|
||||||
*/
|
*/
|
||||||
std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeon> dungeons, int columns = 6) {
|
std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeon> dungeons, int columns = 6) {
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
int iconSpacing = CVar_GetS32("gItemTrackerIconSpacing", 12);
|
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12);
|
||||||
std::vector<ItemTrackerItem> dungeonItems = {};
|
std::vector<ItemTrackerItem> dungeonItems = {};
|
||||||
|
|
||||||
int rowCount = 0;
|
int rowCount = 0;
|
||||||
@ -752,7 +752,7 @@ std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeo
|
|||||||
|
|
||||||
/* TODO: These need to be moved to a common imgui file */
|
/* TODO: These need to be moved to a common imgui file */
|
||||||
void LabeledComboBoxRightAligned(const char* label, const char* cvar, std::vector<std::string> options, s32 defaultValue) {
|
void LabeledComboBoxRightAligned(const char* label, const char* cvar, std::vector<std::string> options, s32 defaultValue) {
|
||||||
s32 currentValue = CVar_GetS32(cvar, defaultValue);
|
s32 currentValue = CVarGetInteger(cvar, defaultValue);
|
||||||
std::string hiddenLabel = "##" + std::string(cvar);
|
std::string hiddenLabel = "##" + std::string(cvar);
|
||||||
ImGui::Text(label);
|
ImGui::Text(label);
|
||||||
#ifdef __WIIU__
|
#ifdef __WIIU__
|
||||||
@ -765,7 +765,7 @@ void LabeledComboBoxRightAligned(const char* label, const char* cvar, std::vecto
|
|||||||
if (ImGui::BeginCombo(hiddenLabel.c_str(), options[currentValue].c_str())) {
|
if (ImGui::BeginCombo(hiddenLabel.c_str(), options[currentValue].c_str())) {
|
||||||
for (int i = 0; i < options.size(); i++) {
|
for (int i = 0; i < options.size(); i++) {
|
||||||
if (ImGui::Selectable(options[i].c_str())) {
|
if (ImGui::Selectable(options[i].c_str())) {
|
||||||
CVar_SetS32(cvar, i);
|
CVarSetInteger(cvar, i);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
shouldUpdateVectors = true;
|
shouldUpdateVectors = true;
|
||||||
}
|
}
|
||||||
@ -780,9 +780,9 @@ void PaddedEnhancementCheckbox(const char* text, const char* cvarName, s32 defau
|
|||||||
if (padTop) {
|
if (padTop) {
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
}
|
}
|
||||||
bool val = (bool)CVar_GetS32(cvarName, defaultValue);
|
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
|
||||||
if (ImGui::Checkbox(text, &val)) {
|
if (ImGui::Checkbox(text, &val)) {
|
||||||
CVar_SetS32(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
shouldUpdateVectors = true;
|
shouldUpdateVectors = true;
|
||||||
}
|
}
|
||||||
@ -802,8 +802,8 @@ void UpdateVectors() {
|
|||||||
dungeonRewards.insert(dungeonRewards.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end());
|
dungeonRewards.insert(dungeonRewards.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end());
|
||||||
|
|
||||||
dungeonItems.clear();
|
dungeonItems.clear();
|
||||||
if (CVar_GetS32("gItemTrackerDisplayDungeonItemsHorizontal", 1) && CVar_GetS32("gItemTrackerDungeonItemsDisplayType", 0) == 2) {
|
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1) && CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 2) {
|
||||||
if (CVar_GetS32("gItemTrackerDisplayDungeonItemsMaps", 1)) {
|
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) {
|
||||||
dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsHorizontal, 12);
|
dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsHorizontal, 12);
|
||||||
// Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item
|
// Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item
|
||||||
dungeonItems[23] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_GERUDOWAY, DrawDungeonItem);
|
dungeonItems[23] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_GERUDOWAY, DrawDungeonItem);
|
||||||
@ -813,7 +813,7 @@ void UpdateVectors() {
|
|||||||
dungeonItems[15] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_GERUDOWAY, DrawDungeonItem);
|
dungeonItems[15] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_GERUDOWAY, DrawDungeonItem);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (CVar_GetS32("gItemTrackerDisplayDungeonItemsMaps", 1)) {
|
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) {
|
||||||
dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsCompact);
|
dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsCompact);
|
||||||
// Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item
|
// Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item
|
||||||
dungeonItems[35] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_GERUDOWAY, DrawDungeonItem);
|
dungeonItems[35] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_GERUDOWAY, DrawDungeonItem);
|
||||||
@ -823,28 +823,28 @@ void UpdateVectors() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainWindowItems.clear();
|
mainWindowItems.clear();
|
||||||
if (CVar_GetS32("gItemTrackerInventoryItemsDisplayType", 1) == 1) {
|
if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", 1) == 1) {
|
||||||
mainWindowItems.insert(mainWindowItems.end(), inventoryItems.begin(), inventoryItems.end());
|
mainWindowItems.insert(mainWindowItems.end(), inventoryItems.begin(), inventoryItems.end());
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gItemTrackerEquipmentItemsDisplayType", 1) == 1) {
|
if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", 1) == 1) {
|
||||||
mainWindowItems.insert(mainWindowItems.end(), equipmentItems.begin(), equipmentItems.end());
|
mainWindowItems.insert(mainWindowItems.end(), equipmentItems.begin(), equipmentItems.end());
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gItemTrackerMiscItemsDisplayType", 1) == 1) {
|
if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 1) {
|
||||||
mainWindowItems.insert(mainWindowItems.end(), miscItems.begin(), miscItems.end());
|
mainWindowItems.insert(mainWindowItems.end(), miscItems.begin(), miscItems.end());
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gItemTrackerDungeonRewardsDisplayType", 1) == 1) {
|
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 1) {
|
||||||
mainWindowItems.insert(mainWindowItems.end(), dungeonRewardStones.begin(), dungeonRewardStones.end());
|
mainWindowItems.insert(mainWindowItems.end(), dungeonRewardStones.begin(), dungeonRewardStones.end());
|
||||||
mainWindowItems.insert(mainWindowItems.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end());
|
mainWindowItems.insert(mainWindowItems.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end());
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gItemTrackerSongsDisplayType", 1) == 1) {
|
if (CVarGetInteger("gItemTrackerSongsDisplayType", 1) == 1) {
|
||||||
if (CVar_GetS32("gItemTrackerMiscItemsDisplayType", 1) == 1 && CVar_GetS32("gItemTrackerDungeonRewardsDisplayType", 1) != 1) {
|
if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 1 && CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) != 1) {
|
||||||
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
|
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
|
||||||
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
|
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
|
||||||
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
|
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
|
||||||
}
|
}
|
||||||
mainWindowItems.insert(mainWindowItems.end(), songItems.begin(), songItems.end());
|
mainWindowItems.insert(mainWindowItems.end(), songItems.begin(), songItems.end());
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gItemTrackerDungeonItemsDisplayType", 0) == 1) {
|
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 1) {
|
||||||
mainWindowItems.insert(mainWindowItems.end(), dungeonItems.begin(), dungeonItems.end());
|
mainWindowItems.insert(mainWindowItems.end(), dungeonItems.begin(), dungeonItems.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,56 +854,56 @@ void UpdateVectors() {
|
|||||||
void DrawItemTracker(bool& open) {
|
void DrawItemTracker(bool& open) {
|
||||||
UpdateVectors();
|
UpdateVectors();
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gItemTrackerEnabled", 0);
|
CVarSetInteger("gItemTrackerEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int iconSize = CVar_GetS32("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
int iconSpacing = CVar_GetS32("gItemTrackerIconSpacing", 12);
|
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12);
|
||||||
int comboButton1Mask = buttonMap[CVar_GetS32("gItemTrackerComboButton1", 6)];
|
int comboButton1Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton1", 6)];
|
||||||
int comboButton2Mask = buttonMap[CVar_GetS32("gItemTrackerComboButton2", 8)];
|
int comboButton2Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton2", 8)];
|
||||||
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask;
|
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask;
|
||||||
bool isPaused = CVar_GetS32("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0;
|
bool isPaused = CVarGetInteger("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0;
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerWindowType", 0) == 1 || isPaused && (CVar_GetS32("gItemTrackerDisplayType", 0) == 0 ? CVar_GetS32("gItemTrackerEnabled", 0) : comboButtonsHeld)) {
|
if (CVarGetInteger("gItemTrackerWindowType", 0) == 1 || isPaused && (CVarGetInteger("gItemTrackerDisplayType", 0) == 0 ? CVarGetInteger("gItemTrackerEnabled", 0) : comboButtonsHeld)) {
|
||||||
if (
|
if (
|
||||||
(CVar_GetS32("gItemTrackerInventoryItemsDisplayType", 1) == 1) ||
|
(CVarGetInteger("gItemTrackerInventoryItemsDisplayType", 1) == 1) ||
|
||||||
(CVar_GetS32("gItemTrackerEquipmentItemsDisplayType", 1) == 1) ||
|
(CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", 1) == 1) ||
|
||||||
(CVar_GetS32("gItemTrackerMiscItemsDisplayType", 1) == 1) ||
|
(CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 1) ||
|
||||||
(CVar_GetS32("gItemTrackerDungeonRewardsDisplayType", 1) == 1) ||
|
(CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 1) ||
|
||||||
(CVar_GetS32("gItemTrackerSongsDisplayType", 1) == 1) ||
|
(CVarGetInteger("gItemTrackerSongsDisplayType", 1) == 1) ||
|
||||||
(CVar_GetS32("gItemTrackerDungeonItemsDisplayType", 0) == 1) ||
|
(CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 1) ||
|
||||||
(CVar_GetS32("gItemTrackerNotesDisplayType", 0) == 1)
|
(CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 1)
|
||||||
) {
|
) {
|
||||||
BeginFloatingWindows("Item Tracker##main window");
|
BeginFloatingWindows("Item Tracker##main window");
|
||||||
DrawItemsInRows(mainWindowItems, 6);
|
DrawItemsInRows(mainWindowItems, 6);
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerNotesDisplayType", 0) == 1 && CVar_GetS32("gItemTrackerDisplayType", 0) == 0) {
|
if (CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 1 && CVarGetInteger("gItemTrackerDisplayType", 0) == 0) {
|
||||||
DrawNotes();
|
DrawNotes();
|
||||||
}
|
}
|
||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerInventoryItemsDisplayType", 1) == 2) {
|
if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", 1) == 2) {
|
||||||
BeginFloatingWindows("Inventory Items Tracker");
|
BeginFloatingWindows("Inventory Items Tracker");
|
||||||
DrawItemsInRows(inventoryItems);
|
DrawItemsInRows(inventoryItems);
|
||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerEquipmentItemsDisplayType", 1) == 2) {
|
if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", 1) == 2) {
|
||||||
BeginFloatingWindows("Equipment Items Tracker");
|
BeginFloatingWindows("Equipment Items Tracker");
|
||||||
DrawItemsInRows(equipmentItems, 3);
|
DrawItemsInRows(equipmentItems, 3);
|
||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerMiscItemsDisplayType", 1) == 2) {
|
if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 2) {
|
||||||
BeginFloatingWindows("Misc Items Tracker");
|
BeginFloatingWindows("Misc Items Tracker");
|
||||||
DrawItemsInRows(miscItems, 4);
|
DrawItemsInRows(miscItems, 4);
|
||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerDungeonRewardsDisplayType", 1) == 2) {
|
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 2) {
|
||||||
BeginFloatingWindows("Dungeon Rewards Tracker");
|
BeginFloatingWindows("Dungeon Rewards Tracker");
|
||||||
if (CVar_GetS32("gItemTrackerDungeonRewardsCircle", 0) == 1) {
|
if (CVarGetInteger("gItemTrackerDungeonRewardsCircle", 0) == 1) {
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
DrawItemsInACircle(dungeonRewardMedallions);
|
DrawItemsInACircle(dungeonRewardMedallions);
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
@ -916,16 +916,16 @@ void DrawItemTracker(bool& open) {
|
|||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerSongsDisplayType", 1) == 2) {
|
if (CVarGetInteger("gItemTrackerSongsDisplayType", 1) == 2) {
|
||||||
BeginFloatingWindows("Songs Tracker");
|
BeginFloatingWindows("Songs Tracker");
|
||||||
DrawItemsInRows(songItems);
|
DrawItemsInRows(songItems);
|
||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerDungeonItemsDisplayType", 0) == 2) {
|
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 2) {
|
||||||
BeginFloatingWindows("Dungeon Items Tracker");
|
BeginFloatingWindows("Dungeon Items Tracker");
|
||||||
if (CVar_GetS32("gItemTrackerDisplayDungeonItemsHorizontal", 1)) {
|
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1)) {
|
||||||
if (CVar_GetS32("gItemTrackerDisplayDungeonItemsMaps", 1)) {
|
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) {
|
||||||
DrawItemsInRows(dungeonItems, 12);
|
DrawItemsInRows(dungeonItems, 12);
|
||||||
} else {
|
} else {
|
||||||
DrawItemsInRows(dungeonItems, 8);
|
DrawItemsInRows(dungeonItems, 8);
|
||||||
@ -936,7 +936,7 @@ void DrawItemTracker(bool& open) {
|
|||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerNotesDisplayType", 0) == 2 && CVar_GetS32("gItemTrackerDisplayType", 0) == 0) {
|
if (CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 2 && CVarGetInteger("gItemTrackerDisplayType", 0) == 0) {
|
||||||
ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver);
|
||||||
BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing);
|
BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing);
|
||||||
DrawNotes(true);
|
DrawNotes(true);
|
||||||
@ -950,7 +950,7 @@ const char* itemTrackerKeyTrackOptions[3] = { "Collected / Max", "Current / Coll
|
|||||||
|
|
||||||
void DrawItemTrackerOptions(bool& open) {
|
void DrawItemTrackerOptions(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gItemTrackerSettingsEnabled", 0);
|
CVarSetInteger("gItemTrackerSettingsEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -972,21 +972,21 @@ void DrawItemTrackerOptions(bool& open) {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
if (ImGui::ColorEdit4("BG Color##gItemTrackerBgColor", (float*)&ChromaKeyBackground, ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoLabel)) {
|
if (ImGui::ColorEdit4("BG Color##gItemTrackerBgColor", (float*)&ChromaKeyBackground, ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoLabel)) {
|
||||||
CVar_SetFloat("gItemTrackerBgColorR", ChromaKeyBackground.x);
|
CVarSetFloat("gItemTrackerBgColorR", ChromaKeyBackground.x);
|
||||||
CVar_SetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y);
|
CVarSetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y);
|
||||||
CVar_SetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z);
|
CVarSetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z);
|
||||||
CVar_SetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w);
|
CVarSetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
LabeledComboBoxRightAligned("Window Type", "gItemTrackerWindowType", { "Floating", "Window" }, 0);
|
LabeledComboBoxRightAligned("Window Type", "gItemTrackerWindowType", { "Floating", "Window" }, 0);
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerWindowType", 0) == 0) {
|
if (CVarGetInteger("gItemTrackerWindowType", 0) == 0) {
|
||||||
PaddedEnhancementCheckbox("Enable Dragging", "gItemTrackerHudEditMode", 0);
|
PaddedEnhancementCheckbox("Enable Dragging", "gItemTrackerHudEditMode", 0);
|
||||||
PaddedEnhancementCheckbox("Only enable while paused", "gItemTrackerShowOnlyPaused", 0);
|
PaddedEnhancementCheckbox("Only enable while paused", "gItemTrackerShowOnlyPaused", 0);
|
||||||
LabeledComboBoxRightAligned("Display Mode", "gItemTrackerDisplayType", { "Always", "Combo Button Hold" }, 0);
|
LabeledComboBoxRightAligned("Display Mode", "gItemTrackerDisplayType", { "Always", "Combo Button Hold" }, 0);
|
||||||
if (CVar_GetS32("gItemTrackerDisplayType", 0) > 0) {
|
if (CVarGetInteger("gItemTrackerDisplayType", 0) > 0) {
|
||||||
LabeledComboBoxRightAligned("Combo Button 1", "gItemTrackerComboButton1", { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }, 6);
|
LabeledComboBoxRightAligned("Combo Button 1", "gItemTrackerComboButton1", { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }, 6);
|
||||||
LabeledComboBoxRightAligned("Combo Button 2", "gItemTrackerComboButton2", { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }, 8);
|
LabeledComboBoxRightAligned("Combo Button 2", "gItemTrackerComboButton2", { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }, 8);
|
||||||
}
|
}
|
||||||
@ -999,7 +999,7 @@ void DrawItemTrackerOptions(bool& open) {
|
|||||||
UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", itemTrackerCapacityTrackOptions, 5, 1);
|
UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", itemTrackerCapacityTrackOptions, 5, 1);
|
||||||
UIWidgets::InsertHelpHoverText("Customize what the numbers under each item are tracking."
|
UIWidgets::InsertHelpHoverText("Customize what the numbers under each item are tracking."
|
||||||
"\n\nNote: items without capacity upgrades will track ammo even in capacity mode");
|
"\n\nNote: items without capacity upgrades will track ammo even in capacity mode");
|
||||||
if (CVar_GetS32("gItemTrackerCapacityTrack", 1) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVar_GetS32("gItemTrackerCapacityTrack", 1) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) {
|
if (CVarGetInteger("gItemTrackerCapacityTrack", 1) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger("gItemTrackerCapacityTrack", 1) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) {
|
||||||
PaddedEnhancementCheckbox("Align count to left side", "gItemTrackerCurrentOnLeft", 0);
|
PaddedEnhancementCheckbox("Align count to left side", "gItemTrackerCurrentOnLeft", 0);
|
||||||
}
|
}
|
||||||
ImGui::Text("Key Count Tracking");
|
ImGui::Text("Key Count Tracking");
|
||||||
@ -1012,19 +1012,19 @@ void DrawItemTrackerOptions(bool& open) {
|
|||||||
LabeledComboBoxRightAligned("Equipment", "gItemTrackerEquipmentItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
LabeledComboBoxRightAligned("Equipment", "gItemTrackerEquipmentItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
||||||
LabeledComboBoxRightAligned("Misc", "gItemTrackerMiscItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
LabeledComboBoxRightAligned("Misc", "gItemTrackerMiscItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
||||||
LabeledComboBoxRightAligned("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
LabeledComboBoxRightAligned("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
||||||
if (CVar_GetS32("gItemTrackerDungeonRewardsDisplayType", 1) == 2) {
|
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 2) {
|
||||||
PaddedEnhancementCheckbox("Circle display", "gItemTrackerDungeonRewardsCircle", 1);
|
PaddedEnhancementCheckbox("Circle display", "gItemTrackerDungeonRewardsCircle", 1);
|
||||||
}
|
}
|
||||||
LabeledComboBoxRightAligned("Songs", "gItemTrackerSongsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
LabeledComboBoxRightAligned("Songs", "gItemTrackerSongsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
|
||||||
LabeledComboBoxRightAligned("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 0);
|
LabeledComboBoxRightAligned("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 0);
|
||||||
if (CVar_GetS32("gItemTrackerDungeonItemsDisplayType", 0) != 0) {
|
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) != 0) {
|
||||||
if (CVar_GetS32("gItemTrackerDungeonItemsDisplayType", 0) == 2) {
|
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 2) {
|
||||||
PaddedEnhancementCheckbox("Horizontal display", "gItemTrackerDisplayDungeonItemsHorizontal", 1);
|
PaddedEnhancementCheckbox("Horizontal display", "gItemTrackerDisplayDungeonItemsHorizontal", 1);
|
||||||
}
|
}
|
||||||
PaddedEnhancementCheckbox("Maps and compasses", "gItemTrackerDisplayDungeonItemsMaps", 1);
|
PaddedEnhancementCheckbox("Maps and compasses", "gItemTrackerDisplayDungeonItemsMaps", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gItemTrackerDisplayType", 0) != 1) {
|
if (CVarGetInteger("gItemTrackerDisplayType", 0) != 1) {
|
||||||
LabeledComboBoxRightAligned("Personal notes", "gItemTrackerNotesDisplayType", { "Hidden", "Main Window", "Seperate" }, 0);
|
LabeledComboBoxRightAligned("Personal notes", "gItemTrackerNotesDisplayType", { "Hidden", "Main Window", "Seperate" }, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1035,12 +1035,12 @@ void DrawItemTrackerOptions(bool& open) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InitItemTracker() {
|
void InitItemTracker() {
|
||||||
SohImGui::AddWindow("Randomizer", "Item Tracker", DrawItemTracker, CVar_GetS32("gItemTrackerEnabled", 0) == 1);
|
SohImGui::AddWindow("Randomizer", "Item Tracker", DrawItemTracker, CVarGetInteger("gItemTrackerEnabled", 0) == 1);
|
||||||
SohImGui::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions);
|
SohImGui::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions);
|
||||||
float trackerBgR = CVar_GetFloat("gItemTrackerBgColorR", 0);
|
float trackerBgR = CVarGetFloat("gItemTrackerBgColorR", 0);
|
||||||
float trackerBgG = CVar_GetFloat("gItemTrackerBgColorG", 0);
|
float trackerBgG = CVarGetFloat("gItemTrackerBgColorG", 0);
|
||||||
float trackerBgB = CVar_GetFloat("gItemTrackerBgColorB", 0);
|
float trackerBgB = CVarGetFloat("gItemTrackerBgColorB", 0);
|
||||||
float trackerBgA = CVar_GetFloat("gItemTrackerBgColorA", 1);
|
float trackerBgA = CVarGetFloat("gItemTrackerBgColorA", 1);
|
||||||
ChromaKeyBackground = {
|
ChromaKeyBackground = {
|
||||||
trackerBgR,
|
trackerBgR,
|
||||||
trackerBgG,
|
trackerBgG,
|
||||||
@ -1055,11 +1055,11 @@ void InitItemTracker() {
|
|||||||
buttonsPressed = cont_pad;
|
buttonsPressed = cont_pad;
|
||||||
});
|
});
|
||||||
Ship::RegisterHook<Ship::LoadFile>([](uint32_t fileNum) {
|
Ship::RegisterHook<Ship::LoadFile>([](uint32_t fileNum) {
|
||||||
const char* initialTrackerNotes = CVar_GetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||||
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
|
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
|
||||||
});
|
});
|
||||||
Ship::RegisterHook<Ship::DeleteFile>([](uint32_t fileNum) {
|
Ship::RegisterHook<Ship::DeleteFile>([](uint32_t fileNum) {
|
||||||
CVar_SetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "sequence.h"
|
#include "sequence.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include "../randomizer/3drando/random.hpp"
|
#include "../randomizer/3drando/random.hpp"
|
||||||
@ -216,7 +216,7 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const std::string cvarKey = "gSfxEditor_" + sfxKey;
|
const std::string cvarKey = "gSfxEditor_" + sfxKey;
|
||||||
CVar_SetS32(cvarKey.c_str(), defaultValue);
|
CVarSetInteger(cvarKey.c_str(), defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
@ -242,7 +242,7 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const int randomValue = values.back();
|
const int randomValue = values.back();
|
||||||
CVar_SetS32(cvarKey.c_str(), randomValue);
|
CVarSetInteger(cvarKey.c_str(), randomValue);
|
||||||
values.pop_back();
|
values.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
const std::string previewButton = "Preview" + hiddenKey;
|
const std::string previewButton = "Preview" + hiddenKey;
|
||||||
const std::string resetButton = "Reset" + hiddenKey;
|
const std::string resetButton = "Reset" + hiddenKey;
|
||||||
const std::string randomizeButton = "Randomize" + hiddenKey;
|
const std::string randomizeButton = "Randomize" + hiddenKey;
|
||||||
const int currentValue = CVar_GetS32(cvarKey.c_str(), defaultValue);
|
const int currentValue = CVarGetInteger(cvarKey.c_str(), defaultValue);
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
@ -289,7 +289,7 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Selectable(std::get<0>(seqData).c_str())) {
|
if (ImGui::Selectable(std::get<0>(seqData).c_str())) {
|
||||||
CVar_SetS32(cvarKey.c_str(), value);
|
CVarSetInteger(cvarKey.c_str(), value);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
UpdateCurrentBGM(defaultValue, type);
|
UpdateCurrentBGM(defaultValue, type);
|
||||||
}
|
}
|
||||||
@ -299,16 +299,16 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
}
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::PushItemWidth(-FLT_MIN);
|
ImGui::PushItemWidth(-FLT_MIN);
|
||||||
if (CVar_GetS32("gSfxEditor_playing", 0) == currentValue) {
|
if (CVarGetInteger("gSfxEditor_playing", 0) == currentValue) {
|
||||||
if (ImGui::Button(stopButton.c_str())) {
|
if (ImGui::Button(stopButton.c_str())) {
|
||||||
func_800F5C2C();
|
func_800F5C2C();
|
||||||
CVar_SetS32("gSfxEditor_playing", 0);
|
CVarSetInteger("gSfxEditor_playing", 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ImGui::Button(previewButton.c_str())) {
|
if (ImGui::Button(previewButton.c_str())) {
|
||||||
if (CVar_GetS32("gSfxEditor_playing", 0) != 0) {
|
if (CVarGetInteger("gSfxEditor_playing", 0) != 0) {
|
||||||
func_800F5C2C();
|
func_800F5C2C();
|
||||||
CVar_SetS32("gSfxEditor_playing", 0);
|
CVarSetInteger("gSfxEditor_playing", 0);
|
||||||
} else {
|
} else {
|
||||||
if (type == SEQ_SFX) {
|
if (type == SEQ_SFX) {
|
||||||
Audio_PlaySoundGeneral(defaultValue, &pos, 4, &freqScale, &freqScale, &reverbAdd);
|
Audio_PlaySoundGeneral(defaultValue, &pos, 4, &freqScale, &freqScale, &reverbAdd);
|
||||||
@ -318,7 +318,7 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
} else {
|
} else {
|
||||||
// TODO: Cant do both here, so have to click preview button twice
|
// TODO: Cant do both here, so have to click preview button twice
|
||||||
func_800F5ACC(defaultValue);
|
func_800F5ACC(defaultValue);
|
||||||
CVar_SetS32("gSfxEditor_playing", currentValue);
|
CVarSetInteger("gSfxEditor_playing", currentValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::PushItemWidth(-FLT_MIN);
|
ImGui::PushItemWidth(-FLT_MIN);
|
||||||
if (ImGui::Button(resetButton.c_str())) {
|
if (ImGui::Button(resetButton.c_str())) {
|
||||||
CVar_SetS32(cvarKey.c_str(), defaultValue);
|
CVarSetInteger(cvarKey.c_str(), defaultValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
UpdateCurrentBGM(defaultValue, seqType);
|
UpdateCurrentBGM(defaultValue, seqType);
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
|||||||
const auto& [value, seqData] = *std::next(it, rand() % map.size());
|
const auto& [value, seqData] = *std::next(it, rand() % map.size());
|
||||||
const auto& [name, sfxKey, seqType] = seqData;
|
const auto& [name, sfxKey, seqType] = seqData;
|
||||||
if (seqType & type) {
|
if (seqType & type) {
|
||||||
CVar_SetS32(cvarKey.c_str(), value);
|
CVarSetInteger(cvarKey.c_str(), value);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
UpdateCurrentBGM(defaultValue, type);
|
UpdateCurrentBGM(defaultValue, type);
|
||||||
break;
|
break;
|
||||||
@ -354,7 +354,7 @@ extern "C" u16 SfxEditor_GetReplacementSeq(u16 seqId) {
|
|||||||
// for Hyrule Field instead. Otherwise, leave it alone, so that without any sfx editor modifications we will
|
// for Hyrule Field instead. Otherwise, leave it alone, so that without any sfx editor modifications we will
|
||||||
// play the normal track as usual.
|
// play the normal track as usual.
|
||||||
if (seqId == NA_BGM_FIELD_MORNING) {
|
if (seqId == NA_BGM_FIELD_MORNING) {
|
||||||
if (CVar_GetS32("gSfxEditor_NA_BGM_FIELD_LOGIC", NA_BGM_FIELD_LOGIC) != NA_BGM_FIELD_LOGIC) {
|
if (CVarGetInteger("gSfxEditor_NA_BGM_FIELD_LOGIC", NA_BGM_FIELD_LOGIC) != NA_BGM_FIELD_LOGIC) {
|
||||||
seqId = NA_BGM_FIELD_LOGIC;
|
seqId = NA_BGM_FIELD_LOGIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ extern "C" u16 SfxEditor_GetReplacementSeq(u16 seqId) {
|
|||||||
|
|
||||||
const auto& [name, sfxKey, seqType] = sfxEditorSequenceMap.at(seqId);
|
const auto& [name, sfxKey, seqType] = sfxEditorSequenceMap.at(seqId);
|
||||||
const std::string cvarKey = "gSfxEditor_" + sfxKey;
|
const std::string cvarKey = "gSfxEditor_" + sfxKey;
|
||||||
int replacementSeq = CVar_GetS32(cvarKey.c_str(), seqId);
|
int replacementSeq = CVarGetInteger(cvarKey.c_str(), seqId);
|
||||||
if (!sfxEditorSequenceMap.contains(replacementSeq)) {
|
if (!sfxEditorSequenceMap.contains(replacementSeq)) {
|
||||||
replacementSeq = seqId;
|
replacementSeq = seqId;
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ extern "C" u16 SfxEditor_GetReverseReplacementSeq(u16 seqId) {
|
|||||||
for (const auto& [id, nameAndsfxKey] : sfxEditorSequenceMap) {
|
for (const auto& [id, nameAndsfxKey] : sfxEditorSequenceMap) {
|
||||||
const auto& [name, sfxKey, seqType] = sfxEditorSequenceMap.at(id);
|
const auto& [name, sfxKey, seqType] = sfxEditorSequenceMap.at(id);
|
||||||
const std::string cvarKey = "gSfxEditor_" + sfxKey;
|
const std::string cvarKey = "gSfxEditor_" + sfxKey;
|
||||||
if (CVar_GetS32(cvarKey.c_str(), id) == seqId){
|
if (CVarGetInteger(cvarKey.c_str(), id) == seqId){
|
||||||
return static_cast<u16>(id);
|
return static_cast<u16>(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ extern "C" u16 SfxEditor_GetReverseReplacementSeq(u16 seqId) {
|
|||||||
|
|
||||||
void DrawSfxEditor(bool& open) {
|
void DrawSfxEditor(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gSfxEditor", 0);
|
CVarSetInteger("gSfxEditor", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ImGui::SetNextWindowSize(ImVec2(900, 630), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(900, 630), ImGuiCond_FirstUseEver);
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
#include <ImGui/imgui_internal.h>
|
#include <ImGui/imgui_internal.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Hooks.h>
|
#include <Hooks.h>
|
||||||
#include <ultra64/types.h>
|
#include <libultraship/libultra/types.h>
|
||||||
#include <ultra64/pi.h>
|
#include <libultraship/libultra/pi.h>
|
||||||
#include <ultra64/sptask.h>
|
#include <libultraship/libultra/sptask.h>
|
||||||
|
|
||||||
#ifdef __SWITCH__
|
#ifdef __SWITCH__
|
||||||
#include <port/switch/SwitchImpl.h>
|
#include <port/switch/SwitchImpl.h>
|
||||||
@ -82,22 +82,22 @@ namespace GameMenuBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BindAudioSlider(const char* name, const char* key, float defaultValue, SeqPlayers playerId) {
|
void BindAudioSlider(const char* name, const char* key, float defaultValue, SeqPlayers playerId) {
|
||||||
float value = CVar_GetFloat(key, defaultValue);
|
float value = CVarGetFloat(key, defaultValue);
|
||||||
|
|
||||||
ImGui::Text(name, static_cast<int>(100 * value));
|
ImGui::Text(name, static_cast<int>(100 * value));
|
||||||
if (ImGui::SliderFloat((std::string("##") + key).c_str(), &value, 0.0f, 1.0f, "")) {
|
if (ImGui::SliderFloat((std::string("##") + key).c_str(), &value, 0.0f, 1.0f, "")) {
|
||||||
const float volume = floorf(value * 100) / 100;
|
const float volume = floorf(value * 100) / 100;
|
||||||
CVar_SetFloat(key, volume);
|
CVarSetFloat(key, volume);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
Audio_SetGameVolume(playerId, volume);
|
Audio_SetGameVolume(playerId, volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAudio() {
|
void UpdateAudio() {
|
||||||
Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1));
|
Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1));
|
||||||
Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1));
|
Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1));
|
||||||
Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1));
|
Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gSFXMusicVolume", 1));
|
||||||
Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1));
|
Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gFanfareVolume", 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Delegates
|
// MARK: - Delegates
|
||||||
@ -153,12 +153,12 @@ namespace GameMenuBar {
|
|||||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
|
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
|
||||||
if (ImGui::Button(GetWindowButtonText("Controller Configuration", CVar_GetS32("gControllerConfigurationEnabled", 0)).c_str()))
|
if (ImGui::Button(GetWindowButtonText("Controller Configuration", CVarGetInteger("gControllerConfigurationEnabled", 0)).c_str()))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gControllerConfigurationEnabled", 0);
|
bool currentValue = CVarGetInteger("gControllerConfigurationEnabled", 0);
|
||||||
CVar_SetS32("gControllerConfigurationEnabled", !currentValue);
|
CVarSetInteger("gControllerConfigurationEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::ToggleInputEditorWindow(CVar_GetS32("gControllerConfigurationEnabled", 0));
|
SohImGui::ToggleInputEditorWindow(CVarGetInteger("gControllerConfigurationEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor(1);
|
ImGui::PopStyleColor(1);
|
||||||
ImGui::PopStyleVar(3);
|
ImGui::PopStyleVar(3);
|
||||||
@ -188,18 +188,18 @@ namespace GameMenuBar {
|
|||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true, true);
|
UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true, true);
|
||||||
UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing");
|
UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing");
|
||||||
SohImGui::SetResolutionMultiplier(CVar_GetFloat("gInternalResolution", 1));
|
SohImGui::SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
|
||||||
#endif
|
#endif
|
||||||
#ifndef __WIIU__
|
#ifndef __WIIU__
|
||||||
UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, false, true, false);
|
UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, false, true, false);
|
||||||
UIWidgets::Tooltip("Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel");
|
UIWidgets::Tooltip("Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel");
|
||||||
SohImGui::SetMSAALevel(CVar_GetS32("gMSAAValue", 1));
|
SohImGui::SetMSAALevel(CVarGetInteger("gMSAAValue", 1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SohImGui::WindowBackend() == SohImGui::Backend::DX11)
|
if (SohImGui::WindowBackend() == SohImGui::Backend::DX11)
|
||||||
{
|
{
|
||||||
const char* cvar = "gExtraLatencyThreshold";
|
const char* cvar = "gExtraLatencyThreshold";
|
||||||
int val = CVar_GetS32(cvar, 80);
|
int val = CVarGetInteger(cvar, 80);
|
||||||
val = fmax(fmin(val, 360), 0);
|
val = fmax(fmin(val, 360), 0);
|
||||||
int fps = val;
|
int fps = val;
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ namespace GameMenuBar {
|
|||||||
std::string PlusBTNELT = " + ##ExtraLatencyThreshold";
|
std::string PlusBTNELT = " + ##ExtraLatencyThreshold";
|
||||||
if (ImGui::Button(MinusBTNELT.c_str())) {
|
if (ImGui::Button(MinusBTNELT.c_str())) {
|
||||||
val--;
|
val--;
|
||||||
CVar_SetS32(cvar, val);
|
CVarSetInteger(cvar, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -232,7 +232,7 @@ namespace GameMenuBar {
|
|||||||
#endif
|
#endif
|
||||||
if (ImGui::SliderInt("##ExtraLatencyThreshold", &val, 0, 360, "", ImGuiSliderFlags_AlwaysClamp))
|
if (ImGui::SliderInt("##ExtraLatencyThreshold", &val, 0, 360, "", ImGuiSliderFlags_AlwaysClamp))
|
||||||
{
|
{
|
||||||
CVar_SetS32(cvar, val);
|
CVarSetInteger(cvar, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
@ -242,7 +242,7 @@ namespace GameMenuBar {
|
|||||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
|
||||||
if (ImGui::Button(PlusBTNELT.c_str())) {
|
if (ImGui::Button(PlusBTNELT.c_str())) {
|
||||||
val++;
|
val++;
|
||||||
CVar_SetS32(cvar, val);
|
CVarSetInteger(cvar, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,11 +338,11 @@ namespace GameMenuBar {
|
|||||||
" - Skulltula Tokens: Small skulltula chest\n"
|
" - Skulltula Tokens: Small skulltula chest\n"
|
||||||
);
|
);
|
||||||
if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 4, 0)) {
|
if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 4, 0)) {
|
||||||
if (CVar_GetS32("gChestSizeAndTextureMatchesContents", 0) == 0) {
|
if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) == 0) {
|
||||||
CVar_SetS32("gChestSizeDependsStoneOfAgony", 0);
|
CVarSetInteger("gChestSizeDependsStoneOfAgony", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CVar_GetS32("gChestSizeAndTextureMatchesContents", 0) > 0) {
|
if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) > 0) {
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false);
|
||||||
UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony.");
|
UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony.");
|
||||||
}
|
}
|
||||||
@ -461,7 +461,7 @@ namespace GameMenuBar {
|
|||||||
{
|
{
|
||||||
UIWidgets::EnhancementCheckbox("Change Red Potion Effect", "gRedPotionEffect");
|
UIWidgets::EnhancementCheckbox("Change Red Potion Effect", "gRedPotionEffect");
|
||||||
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Red Potions");
|
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Red Potions");
|
||||||
bool disabledRedPotion = !CVar_GetS32("gRedPotionEffect", 0);
|
bool disabledRedPotion = !CVarGetInteger("gRedPotionEffect", 0);
|
||||||
const char* disabledTooltipRedPotion = "This option is disabled because \"Change Red Potion Effect\" is turned off";
|
const char* disabledTooltipRedPotion = "This option is disabled because \"Change Red Potion Effect\" is turned off";
|
||||||
UIWidgets::EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", "gRedPotionHealth", 1, 100, "", 0, true, disabledRedPotion, disabledTooltipRedPotion);
|
UIWidgets::EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", "gRedPotionHealth", 1, 100, "", 0, true, disabledRedPotion, disabledTooltipRedPotion);
|
||||||
UIWidgets::Tooltip("Changes the amount of health restored by Red Potions");
|
UIWidgets::Tooltip("Changes the amount of health restored by Red Potions");
|
||||||
@ -472,7 +472,7 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
UIWidgets::EnhancementCheckbox("Change Green Potion Effect", "gGreenPotionEffect");
|
UIWidgets::EnhancementCheckbox("Change Green Potion Effect", "gGreenPotionEffect");
|
||||||
UIWidgets::Tooltip("Enable the following changes to the amount of mana restored by Green Potions");
|
UIWidgets::Tooltip("Enable the following changes to the amount of mana restored by Green Potions");
|
||||||
bool disabledGreenPotion = !CVar_GetS32("gGreenPotionEffect", 0);
|
bool disabledGreenPotion = !CVarGetInteger("gGreenPotionEffect", 0);
|
||||||
const char* disabledTooltipGreenPotion = "This option is disabled because \"Change Green Potion Effect\" is turned off";
|
const char* disabledTooltipGreenPotion = "This option is disabled because \"Change Green Potion Effect\" is turned off";
|
||||||
UIWidgets::EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", "gGreenPotionMana", 1, 100, "", 0, true, disabledGreenPotion, disabledTooltipGreenPotion);
|
UIWidgets::EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", "gGreenPotionMana", 1, 100, "", 0, true, disabledGreenPotion, disabledTooltipGreenPotion);
|
||||||
UIWidgets::Tooltip("Changes the amount of mana restored by Green Potions, base max mana is 48, max upgraded mana is 96");
|
UIWidgets::Tooltip("Changes the amount of mana restored by Green Potions, base max mana is 48, max upgraded mana is 96");
|
||||||
@ -483,7 +483,7 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
UIWidgets::EnhancementCheckbox("Change Blue Potion Effects", "gBluePotionEffects");
|
UIWidgets::EnhancementCheckbox("Change Blue Potion Effects", "gBluePotionEffects");
|
||||||
UIWidgets::Tooltip("Enable the following changes to the amount of health and mana restored by Blue Potions");
|
UIWidgets::Tooltip("Enable the following changes to the amount of health and mana restored by Blue Potions");
|
||||||
bool disabledBluePotion = !CVar_GetS32("gBluePotionEffects", 0);
|
bool disabledBluePotion = !CVarGetInteger("gBluePotionEffects", 0);
|
||||||
const char* disabledTooltipBluePotion = "This option is disabled because \"Change Blue Potion Effects\" is turned off";
|
const char* disabledTooltipBluePotion = "This option is disabled because \"Change Blue Potion Effects\" is turned off";
|
||||||
UIWidgets::EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", "gBluePotionHealth", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion);
|
UIWidgets::EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", "gBluePotionHealth", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion);
|
||||||
UIWidgets::Tooltip("Changes the amount of health restored by Blue Potions");
|
UIWidgets::Tooltip("Changes the amount of health restored by Blue Potions");
|
||||||
@ -501,7 +501,7 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
UIWidgets::EnhancementCheckbox("Change Milk Effect", "gMilkEffect");
|
UIWidgets::EnhancementCheckbox("Change Milk Effect", "gMilkEffect");
|
||||||
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Milk");
|
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Milk");
|
||||||
bool disabledMilk = !CVar_GetS32("gMilkEffect", 0);
|
bool disabledMilk = !CVarGetInteger("gMilkEffect", 0);
|
||||||
const char* disabledTooltipMilk = "This option is disabled because \"Change Milk Effect\" is turned off";
|
const char* disabledTooltipMilk = "This option is disabled because \"Change Milk Effect\" is turned off";
|
||||||
UIWidgets::EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", "gMilkHealth", 1, 100, "", 0, true, disabledMilk, disabledTooltipMilk);
|
UIWidgets::EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", "gMilkHealth", 1, 100, "", 0, true, disabledMilk, disabledTooltipMilk);
|
||||||
UIWidgets::Tooltip("Changes the amount of health restored by Milk");
|
UIWidgets::Tooltip("Changes the amount of health restored by Milk");
|
||||||
@ -512,7 +512,7 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
UIWidgets::EnhancementCheckbox("Separate Half Milk Effect", "gSeparateHalfMilkEffect", disabledMilk, disabledTooltipMilk);
|
UIWidgets::EnhancementCheckbox("Separate Half Milk Effect", "gSeparateHalfMilkEffect", disabledMilk, disabledTooltipMilk);
|
||||||
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Half Milk\nIf this is disabled, Half Milk will behave the same as Full Milk.");
|
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Half Milk\nIf this is disabled, Half Milk will behave the same as Full Milk.");
|
||||||
bool disabledHalfMilk = disabledMilk || !CVar_GetS32("gSeparateHalfMilkEffect", 0);
|
bool disabledHalfMilk = disabledMilk || !CVarGetInteger("gSeparateHalfMilkEffect", 0);
|
||||||
const char* disabledTooltipHalfMilk = "This option is disabled because \"Separate Half Milk Effect\" is turned off";
|
const char* disabledTooltipHalfMilk = "This option is disabled because \"Separate Half Milk Effect\" is turned off";
|
||||||
UIWidgets::EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", "gHalfMilkHealth", 1, 100, "", 0, true, disabledHalfMilk, disabledTooltipHalfMilk);
|
UIWidgets::EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", "gHalfMilkHealth", 1, 100, "", 0, true, disabledHalfMilk, disabledTooltipHalfMilk);
|
||||||
UIWidgets::Tooltip("Changes the amount of health restored by Half Milk");
|
UIWidgets::Tooltip("Changes the amount of health restored by Half Milk");
|
||||||
@ -523,7 +523,7 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
UIWidgets::EnhancementCheckbox("Change Fairy Effect", "gFairyEffect");
|
UIWidgets::EnhancementCheckbox("Change Fairy Effect", "gFairyEffect");
|
||||||
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairies");
|
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairies");
|
||||||
bool disabledFairy = !CVar_GetS32("gFairyEffect", 0);
|
bool disabledFairy = !CVarGetInteger("gFairyEffect", 0);
|
||||||
const char* disabledTooltipFairy = "This option is disabled because \"Change Fairy Effect\" is turned off";
|
const char* disabledTooltipFairy = "This option is disabled because \"Change Fairy Effect\" is turned off";
|
||||||
UIWidgets::EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", "gFairyHealth", 1, 100, "", 0, true, disabledFairy, disabledTooltipFairy);
|
UIWidgets::EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", "gFairyHealth", 1, 100, "", 0, true, disabledFairy, disabledTooltipFairy);
|
||||||
UIWidgets::Tooltip("Changes the amount of health restored by Fairies");
|
UIWidgets::Tooltip("Changes the amount of health restored by Fairies");
|
||||||
@ -534,7 +534,7 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
UIWidgets::EnhancementCheckbox("Change Fairy Revive Effect", "gFairyReviveEffect");
|
UIWidgets::EnhancementCheckbox("Change Fairy Revive Effect", "gFairyReviveEffect");
|
||||||
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairy Revivals");
|
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairy Revivals");
|
||||||
bool disabledFairyRevive = !CVar_GetS32("gFairyReviveEffect", 0);
|
bool disabledFairyRevive = !CVarGetInteger("gFairyReviveEffect", 0);
|
||||||
const char* disabledTooltipFairyRevive = "This option is disabled because \"Change Fairy Revive Effect\" is turned off";
|
const char* disabledTooltipFairyRevive = "This option is disabled because \"Change Fairy Revive Effect\" is turned off";
|
||||||
UIWidgets::EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", "gFairyReviveHealth", 1, 100, "", 0, true, disabledFairyRevive, disabledTooltipFairyRevive);
|
UIWidgets::EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", "gFairyReviveHealth", 1, 100, "", 0, true, disabledFairyRevive, disabledTooltipFairyRevive);
|
||||||
UIWidgets::Tooltip("Changes the amount of health restored by Fairy Revivals");
|
UIWidgets::Tooltip("Changes the amount of health restored by Fairy Revivals");
|
||||||
@ -549,7 +549,7 @@ namespace GameMenuBar {
|
|||||||
if (ImGui::BeginMenu("Shooting Gallery")) {
|
if (ImGui::BeginMenu("Shooting Gallery")) {
|
||||||
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeShootingGallery");
|
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeShootingGallery");
|
||||||
UIWidgets::Tooltip("Turn on/off changes to the shooting gallery behavior");
|
UIWidgets::Tooltip("Turn on/off changes to the shooting gallery behavior");
|
||||||
bool disabled = !CVar_GetS32("gCustomizeShootingGallery", 0);
|
bool disabled = !CVarGetInteger("gCustomizeShootingGallery", 0);
|
||||||
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
|
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantShootingGalleryWin", true, false, disabled, disabledTooltip);
|
UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantShootingGalleryWin", true, false, disabled, disabledTooltip);
|
||||||
UIWidgets::Tooltip("Skips the shooting gallery minigame");
|
UIWidgets::Tooltip("Skips the shooting gallery minigame");
|
||||||
@ -567,7 +567,7 @@ namespace GameMenuBar {
|
|||||||
if (ImGui::BeginMenu("Bombchu Bowling")) {
|
if (ImGui::BeginMenu("Bombchu Bowling")) {
|
||||||
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeBombchuBowling");
|
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeBombchuBowling");
|
||||||
UIWidgets::Tooltip("Turn on/off changes to the bombchu bowling behavior");
|
UIWidgets::Tooltip("Turn on/off changes to the bombchu bowling behavior");
|
||||||
bool disabled = CVar_GetS32("gCustomizeBombchuBowling", 0) == 0;
|
bool disabled = CVarGetInteger("gCustomizeBombchuBowling", 0) == 0;
|
||||||
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
|
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Remove Small Cucco", "gBombchuBowlingNoSmallCucco", true, false, disabled, disabledTooltip);
|
UIWidgets::PaddedEnhancementCheckbox("Remove Small Cucco", "gBombchuBowlingNoSmallCucco", true, false, disabled, disabledTooltip);
|
||||||
UIWidgets::Tooltip("Prevents the small cucco from appearing in the bombchu bowling minigame");
|
UIWidgets::Tooltip("Prevents the small cucco from appearing in the bombchu bowling minigame");
|
||||||
@ -583,7 +583,7 @@ namespace GameMenuBar {
|
|||||||
if (ImGui::BeginMenu("Fishing")) {
|
if (ImGui::BeginMenu("Fishing")) {
|
||||||
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeFishing");
|
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeFishing");
|
||||||
UIWidgets::Tooltip("Turn on/off changes to the fishing behavior");
|
UIWidgets::Tooltip("Turn on/off changes to the fishing behavior");
|
||||||
bool disabled = !CVar_GetS32("gCustomizeFishing", 0);
|
bool disabled = !CVarGetInteger("gCustomizeFishing", 0);
|
||||||
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
|
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Instant Fishing", "gInstantFishing", true, false, disabled, disabledTooltip);
|
UIWidgets::PaddedEnhancementCheckbox("Instant Fishing", "gInstantFishing", true, false, disabled, disabledTooltip);
|
||||||
UIWidgets::Tooltip("All fish will be caught instantly");
|
UIWidgets::Tooltip("All fish will be caught instantly");
|
||||||
@ -669,7 +669,7 @@ namespace GameMenuBar {
|
|||||||
UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the C-buttons\nUse C-Up or C-Down to reset Link's rotation");
|
UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the C-buttons\nUse C-Up or C-Down to reset Link's rotation");
|
||||||
UIWidgets::EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3);
|
UIWidgets::EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3);
|
||||||
UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the Right Stick\nYou can zoom in by pointing up and reset Link's rotation by pointing down");
|
UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the Right Stick\nYou can zoom in by pointing up and reset Link's rotation by pointing down");
|
||||||
if (CVar_GetS32("gPauseLiveLinkRotation", 0) != 0) {
|
if (CVarGetInteger("gPauseLiveLinkRotation", 0) != 0) {
|
||||||
UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", "gPauseLiveLinkRotationSpeed", 1, 20, "");
|
UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", "gPauseLiveLinkRotationSpeed", 1, 20, "");
|
||||||
}
|
}
|
||||||
UIWidgets::PaddedSeparator();
|
UIWidgets::PaddedSeparator();
|
||||||
@ -697,7 +697,7 @@ namespace GameMenuBar {
|
|||||||
UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time");
|
UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time");
|
||||||
UIWidgets::EnhancementRadioButton("Random cycle (Idle)", "gPauseLiveLink", 17);
|
UIWidgets::EnhancementRadioButton("Random cycle (Idle)", "gPauseLiveLink", 17);
|
||||||
UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time (Idle animations only)");
|
UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time (Idle animations only)");
|
||||||
if (CVar_GetS32("gPauseLiveLink", 0) >= 16) {
|
if (CVarGetInteger("gPauseLiveLink", 0) >= 16) {
|
||||||
UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", "gMinFrameCount", 1, 1000, "", 0, true);
|
UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", "gMinFrameCount", 1, 1000, "", 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,8 +741,8 @@ namespace GameMenuBar {
|
|||||||
UIWidgets::Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield");
|
UIWidgets::Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield");
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix", true, false);
|
||||||
UIWidgets::Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally");
|
UIWidgets::Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally");
|
||||||
if (CVar_GetS32("gCrouchStabHammerFix", 0) == 0) {
|
if (CVarGetInteger("gCrouchStabHammerFix", 0) == 0) {
|
||||||
CVar_SetS32("gCrouchStabFix", 0);
|
CVarSetInteger("gCrouchStabFix", 0);
|
||||||
} else {
|
} else {
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix", true, false);
|
||||||
UIWidgets::Tooltip("Make crouch stabbing always do the same damage as a regular slash");
|
UIWidgets::Tooltip("Make crouch stabbing always do the same damage as a regular slash");
|
||||||
@ -792,32 +792,32 @@ namespace GameMenuBar {
|
|||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
|
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
|
||||||
|
|
||||||
if (ImGui::Button(GetWindowButtonText("Customize Game Controls", CVar_GetS32("gGameControlEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("Customize Game Controls", CVarGetInteger("gGameControlEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gGameControlEditorEnabled", 0);
|
bool currentValue = CVarGetInteger("gGameControlEditorEnabled", 0);
|
||||||
CVar_SetS32("gGameControlEditorEnabled", !currentValue);
|
CVarSetInteger("gGameControlEditorEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Game Control Editor", CVar_GetS32("gGameControlEditorEnabled", 0));
|
SohImGui::EnableWindow("Game Control Editor", CVarGetInteger("gGameControlEditorEnabled", 0));
|
||||||
}
|
}
|
||||||
if (ImGui::Button(GetWindowButtonText("Cosmetics Editor", CVar_GetS32("gCosmeticsEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gCosmeticsEditorEnabled", 0);
|
bool currentValue = CVarGetInteger("gCosmeticsEditorEnabled", 0);
|
||||||
CVar_SetS32("gCosmeticsEditorEnabled", !currentValue);
|
CVarSetInteger("gCosmeticsEditorEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Cosmetics Editor", CVar_GetS32("gCosmeticsEditorEnabled", 0));
|
SohImGui::EnableWindow("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0));
|
||||||
}
|
}
|
||||||
if (ImGui::Button(GetWindowButtonText("SFX Editor", CVar_GetS32("gSfxEditor", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("SFX Editor", CVarGetInteger("gSfxEditor", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gSfxEditor", 0);
|
bool currentValue = CVarGetInteger("gSfxEditor", 0);
|
||||||
CVar_SetS32("gSfxEditor", !currentValue);
|
CVarSetInteger("gSfxEditor", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("SFX Editor", CVar_GetS32("gSfxEditor", 0));
|
SohImGui::EnableWindow("SFX Editor", CVarGetInteger("gSfxEditor", 0));
|
||||||
}
|
}
|
||||||
if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVar_GetS32("gGameplayStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) {
|
if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) {
|
||||||
bool currentValue = CVar_GetS32("gGameplayStatsEnabled", 0);
|
bool currentValue = CVarGetInteger("gGameplayStatsEnabled", 0);
|
||||||
CVar_SetS32("gGameplayStatsEnabled", !currentValue);
|
CVarSetInteger("gGameplayStatsEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Gameplay Stats", CVar_GetS32("gGameplayStatsEnabled", 0));
|
SohImGui::EnableWindow("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(3);
|
ImGui::PopStyleVar(3);
|
||||||
ImGui::PopStyleColor(1);
|
ImGui::PopStyleColor(1);
|
||||||
@ -834,7 +834,7 @@ namespace GameMenuBar {
|
|||||||
int maxFps = 360;
|
int maxFps = 360;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int val = CVar_GetS32(fps_cvar, minFps);
|
int val = CVarGetInteger(fps_cvar, minFps);
|
||||||
val = fmax(fmin(val, maxFps), 20);
|
val = fmax(fmin(val, maxFps), 20);
|
||||||
|
|
||||||
#ifdef __WIIU__
|
#ifdef __WIIU__
|
||||||
@ -862,7 +862,7 @@ namespace GameMenuBar {
|
|||||||
#else
|
#else
|
||||||
val--;
|
val--;
|
||||||
#endif
|
#endif
|
||||||
CVar_SetS32(fps_cvar, val);
|
CVarSetInteger(fps_cvar, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -889,7 +889,7 @@ namespace GameMenuBar {
|
|||||||
val = 20;
|
val = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVar_SetS32(fps_cvar, val);
|
CVarSetInteger(fps_cvar, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
@ -909,7 +909,7 @@ namespace GameMenuBar {
|
|||||||
#else
|
#else
|
||||||
val++;
|
val++;
|
||||||
#endif
|
#endif
|
||||||
CVar_SetS32(fps_cvar, val);
|
CVarSetInteger(fps_cvar, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -923,7 +923,7 @@ namespace GameMenuBar {
|
|||||||
int hz = roundf(SohImGui::WindowRefreshRate());
|
int hz = roundf(SohImGui::WindowRefreshRate());
|
||||||
if (hz >= 20 && hz <= 360)
|
if (hz >= 20 && hz <= 360)
|
||||||
{
|
{
|
||||||
CVar_SetS32(fps_cvar, hz);
|
CVarSetInteger(fps_cvar, hz);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -933,12 +933,12 @@ namespace GameMenuBar {
|
|||||||
UIWidgets::EnhancementCheckbox("Disable LOD", "gDisableLOD");
|
UIWidgets::EnhancementCheckbox("Disable LOD", "gDisableLOD");
|
||||||
UIWidgets::Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance");
|
UIWidgets::Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance");
|
||||||
if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false)) {
|
if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false)) {
|
||||||
if (CVar_GetS32("gDisableDrawDistance", 0) == 0) {
|
if (CVarGetInteger("gDisableDrawDistance", 0) == 0) {
|
||||||
CVar_SetS32("gDisableKokiriDrawDistance", 0);
|
CVarSetInteger("gDisableKokiriDrawDistance", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIWidgets::Tooltip("Turns off the objects draw distance, making objects being visible from a longer range");
|
UIWidgets::Tooltip("Turns off the objects draw distance, making objects being visible from a longer range");
|
||||||
if (CVar_GetS32("gDisableDrawDistance", 0) == 1) {
|
if (CVarGetInteger("gDisableDrawDistance", 0) == 1) {
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance", true, false);
|
||||||
UIWidgets::Tooltip("The Kokiri are mystical beings that fade into view when approached\nEnabling this will remove their draw distance");
|
UIWidgets::Tooltip("The Kokiri are mystical beings that fade into view when approached\nEnabling this will remove their draw distance");
|
||||||
}
|
}
|
||||||
@ -947,13 +947,13 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
#ifdef __SWITCH__
|
#ifdef __SWITCH__
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
int slot = CVar_GetS32("gSwitchPerfMode", (int)Ship::SwitchProfiles::STOCK);
|
int slot = CVarGetInteger("gSwitchPerfMode", (int)Ship::SwitchProfiles::STOCK);
|
||||||
ImGui::Text("Switch performance mode");
|
ImGui::Text("Switch performance mode");
|
||||||
if (ImGui::BeginCombo("##perf", SWITCH_CPU_PROFILES[slot])) {
|
if (ImGui::BeginCombo("##perf", SWITCH_CPU_PROFILES[slot])) {
|
||||||
for (int sId = 0; sId <= Ship::SwitchProfiles::POWERSAVINGM3; sId++) {
|
for (int sId = 0; sId <= Ship::SwitchProfiles::POWERSAVINGM3; sId++) {
|
||||||
if (ImGui::Selectable(SWITCH_CPU_PROFILES[sId], sId == slot)) {
|
if (ImGui::Selectable(SWITCH_CPU_PROFILES[sId], sId == slot)) {
|
||||||
SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[sId]);
|
SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[sId]);
|
||||||
CVar_SetS32("gSwitchPerfMode", sId);
|
CVarSetInteger("gSwitchPerfMode", sId);
|
||||||
Ship::Switch::ApplyOverclock();
|
Ship::Switch::ApplyOverclock();
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
@ -1011,9 +1011,9 @@ namespace GameMenuBar {
|
|||||||
UIWidgets::Tooltip("This syncs the ingame time with the real world time");
|
UIWidgets::Tooltip("This syncs the ingame time with the real world time");
|
||||||
|
|
||||||
{
|
{
|
||||||
static int32_t betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
|
static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0);
|
||||||
static int32_t lastBetaQuestEnabled = betaQuestEnabled;
|
static int32_t lastBetaQuestEnabled = betaQuestEnabled;
|
||||||
static int32_t betaQuestWorld = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
|
static int32_t betaQuestWorld = CVarGetInteger("gBetaQuestWorld", 0xFFEF);
|
||||||
static int32_t lastBetaQuestWorld = betaQuestWorld;
|
static int32_t lastBetaQuestWorld = betaQuestWorld;
|
||||||
|
|
||||||
if (!isBetaQuestEnabled) {
|
if (!isBetaQuestEnabled) {
|
||||||
@ -1023,7 +1023,7 @@ namespace GameMenuBar {
|
|||||||
|
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest", true, false);
|
||||||
UIWidgets::Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game.");
|
UIWidgets::Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game.");
|
||||||
betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
|
betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0);
|
||||||
if (betaQuestEnabled) {
|
if (betaQuestEnabled) {
|
||||||
if (betaQuestEnabled != lastBetaQuestEnabled) {
|
if (betaQuestEnabled != lastBetaQuestEnabled) {
|
||||||
betaQuestWorld = 0;
|
betaQuestWorld = 0;
|
||||||
@ -1055,15 +1055,15 @@ namespace GameMenuBar {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lastBetaQuestWorld = betaQuestWorld = 0xFFEF;
|
lastBetaQuestWorld = betaQuestWorld = 0xFFEF;
|
||||||
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
|
CVarSetInteger("gBetaQuestWorld", betaQuestWorld);
|
||||||
}
|
}
|
||||||
if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld)
|
if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld)
|
||||||
{
|
{
|
||||||
// Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene.
|
// Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene.
|
||||||
lastBetaQuestEnabled = betaQuestEnabled;
|
lastBetaQuestEnabled = betaQuestEnabled;
|
||||||
lastBetaQuestWorld = betaQuestWorld;
|
lastBetaQuestWorld = betaQuestWorld;
|
||||||
CVar_SetS32("gEnableBetaQuest", betaQuestEnabled);
|
CVarSetInteger("gEnableBetaQuest", betaQuestEnabled);
|
||||||
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
|
CVarSetInteger("gBetaQuestWorld", betaQuestWorld);
|
||||||
|
|
||||||
SohImGui::DispatchConsoleCommand("reset");
|
SohImGui::DispatchConsoleCommand("reset");
|
||||||
|
|
||||||
@ -1077,7 +1077,7 @@ namespace GameMenuBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Change Age")) {
|
if (ImGui::Button("Change Age")) {
|
||||||
CVar_SetS32("gSwitchAge", 1);
|
CVarSetInteger("gSwitchAge", 1);
|
||||||
}
|
}
|
||||||
UIWidgets::Tooltip("Switches links age and reloads the area.");
|
UIWidgets::Tooltip("Switches links age and reloads the area.");
|
||||||
|
|
||||||
@ -1094,7 +1094,7 @@ namespace GameMenuBar {
|
|||||||
UIWidgets::Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map icons (boss key, compass, map screen locations, etc) will set the GS bits in that area.\nUSE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT.");
|
UIWidgets::Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map icons (boss key, compass, map screen locations, etc) will set the GS bits in that area.\nUSE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT.");
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Fast File Select", "gSkipLogoTitle", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Fast File Select", "gSkipLogoTitle", true, false);
|
||||||
UIWidgets::Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu");
|
UIWidgets::Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu");
|
||||||
if (CVar_GetS32("gSkipLogoTitle", 0)) {
|
if (CVarGetInteger("gSkipLogoTitle", 0)) {
|
||||||
const char* FastFileSelect[5] = {
|
const char* FastFileSelect[5] = {
|
||||||
"File N.1",
|
"File N.1",
|
||||||
"File N.2",
|
"File N.2",
|
||||||
@ -1114,46 +1114,46 @@ namespace GameMenuBar {
|
|||||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0,0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0,0));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
|
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
|
||||||
if (ImGui::Button(GetWindowButtonText("Stats", CVar_GetS32("gStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("Stats", CVarGetInteger("gStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gStatsEnabled", 0);
|
bool currentValue = CVarGetInteger("gStatsEnabled", 0);
|
||||||
CVar_SetS32("gStatsEnabled", !currentValue);
|
CVarSetInteger("gStatsEnabled", !currentValue);
|
||||||
SohImGui::ToggleStatisticsWindow(true);
|
SohImGui::ToggleStatisticsWindow(true);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
UIWidgets::Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on");
|
UIWidgets::Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on");
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
if (ImGui::Button(GetWindowButtonText("Console", CVar_GetS32("gConsoleEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("Console", CVarGetInteger("gConsoleEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gConsoleEnabled", 0);
|
bool currentValue = CVarGetInteger("gConsoleEnabled", 0);
|
||||||
CVar_SetS32("gConsoleEnabled", !currentValue);
|
CVarSetInteger("gConsoleEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::ToggleConsoleWindow(!currentValue);
|
SohImGui::ToggleConsoleWindow(!currentValue);
|
||||||
}
|
}
|
||||||
UIWidgets::Tooltip("Enables the console window, allowing you to input commands, type help for some examples");
|
UIWidgets::Tooltip("Enables the console window, allowing you to input commands, type help for some examples");
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
if (ImGui::Button(GetWindowButtonText("Save Editor", CVar_GetS32("gSaveEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gSaveEditorEnabled", 0);
|
bool currentValue = CVarGetInteger("gSaveEditorEnabled", 0);
|
||||||
CVar_SetS32("gSaveEditorEnabled", !currentValue);
|
CVarSetInteger("gSaveEditorEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Save Editor", CVar_GetS32("gSaveEditorEnabled", 0));
|
SohImGui::EnableWindow("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0));
|
||||||
}
|
}
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
if (ImGui::Button(GetWindowButtonText("Collision Viewer", CVar_GetS32("gCollisionViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gCollisionViewerEnabled", 0);
|
bool currentValue = CVarGetInteger("gCollisionViewerEnabled", 0);
|
||||||
CVar_SetS32("gCollisionViewerEnabled", !currentValue);
|
CVarSetInteger("gCollisionViewerEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Collision Viewer", CVar_GetS32("gCollisionViewerEnabled", 0));
|
SohImGui::EnableWindow("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0));
|
||||||
}
|
}
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
if (ImGui::Button(GetWindowButtonText("Actor Viewer", CVar_GetS32("gActorViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
if (ImGui::Button(GetWindowButtonText("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gActorViewerEnabled", 0);
|
bool currentValue = CVarGetInteger("gActorViewerEnabled", 0);
|
||||||
CVar_SetS32("gActorViewerEnabled", !currentValue);
|
CVarSetInteger("gActorViewerEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Actor Viewer", CVar_GetS32("gActorViewerEnabled", 0));
|
SohImGui::EnableWindow("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(3);
|
ImGui::PopStyleVar(3);
|
||||||
ImGui::PopStyleColor(1);
|
ImGui::PopStyleColor(1);
|
||||||
@ -1174,52 +1174,52 @@ namespace GameMenuBar {
|
|||||||
#else
|
#else
|
||||||
static ImVec2 buttonSize(200.0f, 0.0f);
|
static ImVec2 buttonSize(200.0f, 0.0f);
|
||||||
#endif
|
#endif
|
||||||
if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVar_GetS32("gRandomizerSettingsEnabled", 0)).c_str(), buttonSize))
|
if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0)).c_str(), buttonSize))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gRandomizerSettingsEnabled", 0);
|
bool currentValue = CVarGetInteger("gRandomizerSettingsEnabled", 0);
|
||||||
CVar_SetS32("gRandomizerSettingsEnabled", !currentValue);
|
CVarSetInteger("gRandomizerSettingsEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Randomizer Settings", CVar_GetS32("gRandomizerSettingsEnabled", 0));
|
SohImGui::EnableWindow("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
if (ImGui::Button(GetWindowButtonText("Item Tracker", CVar_GetS32("gItemTrackerEnabled", 0)).c_str(), buttonSize))
|
if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonSize))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gItemTrackerEnabled", 0);
|
bool currentValue = CVarGetInteger("gItemTrackerEnabled", 0);
|
||||||
CVar_SetS32("gItemTrackerEnabled", !currentValue);
|
CVarSetInteger("gItemTrackerEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Item Tracker", CVar_GetS32("gItemTrackerEnabled", 0));
|
SohImGui::EnableWindow("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVar_GetS32("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize))
|
if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gItemTrackerSettingsEnabled", 0);
|
bool currentValue = CVarGetInteger("gItemTrackerSettingsEnabled", 0);
|
||||||
CVar_SetS32("gItemTrackerSettingsEnabled", !currentValue);
|
CVarSetInteger("gItemTrackerSettingsEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Item Tracker Settings", CVar_GetS32("gItemTrackerSettingsEnabled", 0));
|
SohImGui::EnableWindow("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVar_GetS32("gEntranceTrackerEnabled", 0)).c_str(), buttonSize))
|
if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonSize))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gEntranceTrackerEnabled", 0);
|
bool currentValue = CVarGetInteger("gEntranceTrackerEnabled", 0);
|
||||||
CVar_SetS32("gEntranceTrackerEnabled", !currentValue);
|
CVarSetInteger("gEntranceTrackerEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Entrance Tracker", CVar_GetS32("gEntranceTrackerEnabled", 0));
|
SohImGui::EnableWindow("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
if (ImGui::Button(GetWindowButtonText("Check Tracker", CVar_GetS32("gCheckTrackerEnabled", 0)).c_str(), buttonSize))
|
if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonSize))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gCheckTrackerEnabled", 0);
|
bool currentValue = CVarGetInteger("gCheckTrackerEnabled", 0);
|
||||||
CVar_SetS32("gCheckTrackerEnabled", !currentValue);
|
CVarSetInteger("gCheckTrackerEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Check Tracker", CVar_GetS32("gCheckTrackerEnabled", 0));
|
SohImGui::EnableWindow("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||||
if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVar_GetS32("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize))
|
if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize))
|
||||||
{
|
{
|
||||||
bool currentValue = CVar_GetS32("gCheckTrackerSettingsEnabled", 0);
|
bool currentValue = CVarGetInteger("gCheckTrackerSettingsEnabled", 0);
|
||||||
CVar_SetS32("gCheckTrackerSettingsEnabled", !currentValue);
|
CVarSetInteger("gCheckTrackerSettingsEnabled", !currentValue);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
SohImGui::EnableWindow("Check Tracker Settings", CVar_GetS32("gCheckTrackerSettingsEnabled", 0));
|
SohImGui::EnableWindow("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0));
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(3);
|
ImGui::PopStyleVar(3);
|
||||||
ImGui::PopStyleColor(1);
|
ImGui::PopStyleColor(1);
|
||||||
@ -1278,7 +1278,7 @@ namespace GameMenuBar {
|
|||||||
UIWidgets::EnhancementCheckbox("Crowd Control", "gCrowdControl");
|
UIWidgets::EnhancementCheckbox("Crowd Control", "gCrowdControl");
|
||||||
UIWidgets::Tooltip("Will attempt to connect to the Crowd Control server. Check out crowdcontrol.live for more information.");
|
UIWidgets::Tooltip("Will attempt to connect to the Crowd Control server. Check out crowdcontrol.live for more information.");
|
||||||
|
|
||||||
if (CVar_GetS32("gCrowdControl", 0)) {
|
if (CVarGetInteger("gCrowdControl", 0)) {
|
||||||
CrowdControl::Instance->Enable();
|
CrowdControl::Instance->Enable();
|
||||||
} else {
|
} else {
|
||||||
CrowdControl::Instance->Disable();
|
CrowdControl::Instance->Disable();
|
||||||
@ -1293,7 +1293,7 @@ namespace GameMenuBar {
|
|||||||
"Enemies that need more than Deku Nuts + either Deku Sticks or a sword to kill are excluded from spawning in \"clear enemy\" rooms."
|
"Enemies that need more than Deku Nuts + either Deku Sticks or a sword to kill are excluded from spawning in \"clear enemy\" rooms."
|
||||||
);
|
);
|
||||||
|
|
||||||
if (CVar_GetS32("gRandomizedEnemies", 0)) {
|
if (CVarGetInteger("gRandomizedEnemies", 0)) {
|
||||||
|
|
||||||
bool disableSeededEnemies = !gSaveContext.n64ddFlag && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2;
|
bool disableSeededEnemies = !gSaveContext.n64ddFlag && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2;
|
||||||
const char* disableSeededEnemiesText = "This setting is disabled because it relies on a randomizer savefile.";
|
const char* disableSeededEnemiesText = "This setting is disabled because it relies on a randomizer savefile.";
|
||||||
|
@ -16,10 +16,10 @@ int32_t OTRGetLastScancode();
|
|||||||
void ResourceMgr_CacheDirectory(const char* resName);
|
void ResourceMgr_CacheDirectory(const char* resName);
|
||||||
void ResourceMgr_LoadFile(const char* resName);
|
void ResourceMgr_LoadFile(const char* resName);
|
||||||
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
||||||
char* ResourceMgr_LoadTexByName(char* texPath);
|
char* GetResourceDataByName(char* texPath);
|
||||||
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||||
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||||
uint32_t ResourceMgr_LoadTexSizeByName(char* texPath);
|
size_t GetResourceTexSizeByName(const char* name);
|
||||||
char* ResourceMgr_LoadTexOrDListByName(char* filePath);
|
char* ResourceMgr_LoadTexOrDListByName(char* filePath);
|
||||||
char* ResourceMgr_LoadPlayerAnimByName(char* animPath);
|
char* ResourceMgr_LoadPlayerAnimByName(char* animPath);
|
||||||
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
||||||
|
@ -7,24 +7,19 @@
|
|||||||
|
|
||||||
#include <ResourceMgr.h>
|
#include <ResourceMgr.h>
|
||||||
#include <DisplayList.h>
|
#include <DisplayList.h>
|
||||||
#include <PlayerAnimation.h>
|
|
||||||
#include <Skeleton.h>
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <GameVersions.h>
|
#include <GameVersions.h>
|
||||||
|
|
||||||
#include "z64animation.h"
|
#include "z64animation.h"
|
||||||
#include "z64bgcheck.h"
|
#include "z64bgcheck.h"
|
||||||
#include "Enhancements/gameconsole.h"
|
#include "Enhancements/gameconsole.h"
|
||||||
#include <ultra64/gbi.h>
|
#include <libultraship/libultra/gbi.h>
|
||||||
#include <Animation.h>
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#else
|
#else
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
#include <CollisionHeader.h>
|
|
||||||
#include <Array.h>
|
#include <Array.h>
|
||||||
#include <Cutscene.h>
|
|
||||||
#include <stb/stb_image.h>
|
#include <stb/stb_image.h>
|
||||||
#define DRMP3_IMPLEMENTATION
|
#define DRMP3_IMPLEMENTATION
|
||||||
#include <dr_libs/mp3.h>
|
#include <dr_libs/mp3.h>
|
||||||
@ -66,8 +61,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "Enhancements/custom-message/CustomMessageTypes.h"
|
#include "Enhancements/custom-message/CustomMessageTypes.h"
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include "Enhancements/item-tables/ItemTableManager.h"
|
#include "Enhancements/item-tables/ItemTableManager.h"
|
||||||
@ -78,6 +71,35 @@
|
|||||||
CrowdControl* CrowdControl::Instance;
|
CrowdControl* CrowdControl::Instance;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "libultraship/libultraship.h"
|
||||||
|
|
||||||
|
// Resource Types/Factories
|
||||||
|
#include "soh/resource/type/Animation.h"
|
||||||
|
#include "soh/resource/type/AudioSample.h"
|
||||||
|
#include "soh/resource/type/AudioSequence.h"
|
||||||
|
#include "soh/resource/type/AudioSoundFont.h"
|
||||||
|
#include "soh/resource/type/CollisionHeader.h"
|
||||||
|
#include "soh/resource/type/Cutscene.h"
|
||||||
|
#include "soh/resource/type/Path.h"
|
||||||
|
#include "soh/resource/type/PlayerAnimation.h"
|
||||||
|
#include "soh/resource/type/Scene.h"
|
||||||
|
#include "soh/resource/type/Skeleton.h"
|
||||||
|
#include "soh/resource/type/SkeletonLimb.h"
|
||||||
|
#include "soh/resource/type/Text.h"
|
||||||
|
#include "soh/resource/importer/AnimationFactory.h"
|
||||||
|
#include "soh/resource/importer/AudioSampleFactory.h"
|
||||||
|
#include "soh/resource/importer/AudioSequenceFactory.h"
|
||||||
|
#include "soh/resource/importer/AudioSoundFontFactory.h"
|
||||||
|
#include "soh/resource/importer/CollisionHeaderFactory.h"
|
||||||
|
#include "soh/resource/importer/CutsceneFactory.h"
|
||||||
|
#include "soh/resource/importer/PathFactory.h"
|
||||||
|
#include "soh/resource/importer/PlayerAnimationFactory.h"
|
||||||
|
#include "soh/resource/importer/SceneFactory.h"
|
||||||
|
#include "soh/resource/importer/SkeletonFactory.h"
|
||||||
|
#include "soh/resource/importer/SkeletonLimbFactory.h"
|
||||||
|
#include "soh/resource/importer/TextFactory.h"
|
||||||
|
#include "soh/resource/importer/BackgroundFactory.h"
|
||||||
|
|
||||||
OTRGlobals* OTRGlobals::Instance;
|
OTRGlobals* OTRGlobals::Instance;
|
||||||
SaveManager* SaveManager::Instance;
|
SaveManager* SaveManager::Instance;
|
||||||
CustomMessageManager* CustomMessageManager::Instance;
|
CustomMessageManager* CustomMessageManager::Instance;
|
||||||
@ -121,6 +143,21 @@ OTRGlobals::OTRGlobals() {
|
|||||||
OOT_PAL_GC_DBG2
|
OOT_PAL_GC_DBG2
|
||||||
};
|
};
|
||||||
context = Ship::Window::CreateInstance("Ship of Harkinian", OTRFiles);
|
context = Ship::Window::CreateInstance("Ship of Harkinian", OTRFiles);
|
||||||
|
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Animation, std::make_shared<Ship::AnimationFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_PlayerAnimation, std::make_shared<Ship::PlayerAnimationFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Room, std::make_shared<Ship::SceneFactory>()); // Is room scene? maybe?
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_CollisionHeader, std::make_shared<Ship::CollisionHeaderFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Skeleton, std::make_shared<Ship::SkeletonFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_SkeletonLimb, std::make_shared<Ship::SkeletonLimbFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Path, std::make_shared<Ship::PathFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Cutscene, std::make_shared<Ship::CutsceneFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Text, std::make_shared<Ship::TextFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_AudioSample, std::make_shared<Ship::AudioSampleFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_AudioSoundFont, std::make_shared<Ship::AudioSoundFontFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_AudioSequence, std::make_shared<Ship::AudioSequenceFactory>());
|
||||||
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Background, std::make_shared<Ship::BackgroundFactory>());
|
||||||
|
|
||||||
gSaveStateMgr = std::make_shared<SaveStateMgr>();
|
gSaveStateMgr = std::make_shared<SaveStateMgr>();
|
||||||
gRandomizer = std::make_shared<Randomizer>();
|
gRandomizer = std::make_shared<Randomizer>();
|
||||||
|
|
||||||
@ -454,9 +491,9 @@ extern "C" void InitOTR() {
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
tm *tm_now = localtime(&now);
|
tm *tm_now = localtime(&now);
|
||||||
if (tm_now->tm_mon == 11 && tm_now->tm_mday >= 24 && tm_now->tm_mday <= 25) {
|
if (tm_now->tm_mon == 11 && tm_now->tm_mday >= 24 && tm_now->tm_mday <= 25) {
|
||||||
CVar_RegisterS32("gLetItSnow", 1);
|
CVarRegisterInteger("gLetItSnow", 1);
|
||||||
} else {
|
} else {
|
||||||
CVar_Clear("gLetItSnow");
|
CVarClear("gLetItSnow");
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_CROWD_CONTROL
|
#ifdef ENABLE_CROWD_CONTROL
|
||||||
CrowdControl::Instance = new CrowdControl();
|
CrowdControl::Instance = new CrowdControl();
|
||||||
@ -586,7 +623,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
|||||||
|
|
||||||
audio.cv_to_thread.notify_one();
|
audio.cv_to_thread.notify_one();
|
||||||
std::vector<std::unordered_map<Mtx*, MtxF>> mtx_replacements;
|
std::vector<std::unordered_map<Mtx*, MtxF>> mtx_replacements;
|
||||||
int target_fps = CVar_GetS32("gInterpolationFPS", 20);
|
int target_fps = CVarGetInteger("gInterpolationFPS", 20);
|
||||||
static int last_fps;
|
static int last_fps;
|
||||||
static int last_update_rate;
|
static int last_update_rate;
|
||||||
static int time;
|
static int time;
|
||||||
@ -617,7 +654,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
|||||||
|
|
||||||
OTRGlobals::Instance->context->SetTargetFps(fps);
|
OTRGlobals::Instance->context->SetTargetFps(fps);
|
||||||
|
|
||||||
int threshold = CVar_GetS32("gExtraLatencyThreshold", 80);
|
int threshold = CVarGetInteger("gExtraLatencyThreshold", 80);
|
||||||
OTRGlobals::Instance->context->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
|
OTRGlobals::Instance->context->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
|
||||||
|
|
||||||
RunCommands(commands, mtx_replacements);
|
RunCommands(commands, mtx_replacements);
|
||||||
@ -795,21 +832,17 @@ extern "C" char* ResourceMgr_LoadJPEG(char* data, int dataSize)
|
|||||||
return (char*)finalBuffer;
|
return (char*)finalBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadTexByName(const char* texPath);
|
|
||||||
|
|
||||||
extern "C" uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
extern "C" uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||||
|
|
||||||
extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||||
|
|
||||||
extern "C" uint32_t ResourceMgr_LoadTexSizeByName(const char* texPath);
|
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
||||||
auto res = ResourceMgr_LoadResource(filePath);
|
auto res = ResourceMgr_LoadResource(filePath);
|
||||||
|
|
||||||
if (res->ResType == Ship::ResourceType::DisplayList)
|
if (res->Type == Ship::ResourceType::DisplayList)
|
||||||
return (char*)&((std::static_pointer_cast<Ship::DisplayList>(res))->instructions[0]);
|
return (char*)&((std::static_pointer_cast<Ship::DisplayList>(res))->Instructions[0]);
|
||||||
else if (res->ResType == Ship::ResourceType::Array)
|
else if (res->Type == Ship::ResourceType::Array)
|
||||||
return (char*)(std::static_pointer_cast<Ship::Array>(res))->vertices.data();
|
return (char*)(std::static_pointer_cast<Ship::Array>(res))->Vertices.data();
|
||||||
else {
|
else {
|
||||||
std::string Path = filePath;
|
std::string Path = filePath;
|
||||||
if (ResourceMgr_IsGameMasterQuest()) {
|
if (ResourceMgr_IsGameMasterQuest()) {
|
||||||
@ -818,7 +851,7 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
|||||||
Path.replace(pos, 7, "/mq/");
|
Path.replace(pos, 7, "/mq/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResourceMgr_LoadTexByName(Path.c_str());
|
return (char*)GetResourceDataByName(Path.c_str(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +868,7 @@ extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) {
|
|||||||
extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path)
|
extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path)
|
||||||
{
|
{
|
||||||
auto res = std::static_pointer_cast<Ship::DisplayList>(ResourceMgr_LoadResource(path));
|
auto res = std::static_pointer_cast<Ship::DisplayList>(ResourceMgr_LoadResource(path));
|
||||||
return (Gfx*)&res->instructions[0];
|
return (Gfx*)&res->Instructions[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -865,11 +898,11 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Index refers to individual gfx words, which are half the size on 32-bit
|
// Index refers to individual gfx words, which are half the size on 32-bit
|
||||||
if (sizeof(uintptr_t) < 8) {
|
// if (sizeof(uintptr_t) < 8) {
|
||||||
index /= 2;
|
// index /= 2;
|
||||||
}
|
// }
|
||||||
|
|
||||||
Gfx* gfx = (Gfx*)&res->instructions[index];
|
Gfx* gfx = (Gfx*)&res->Instructions[index];
|
||||||
|
|
||||||
if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) {
|
if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) {
|
||||||
originalGfx[path][patchName] = {
|
originalGfx[path][patchName] = {
|
||||||
@ -886,7 +919,7 @@ extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patch
|
|||||||
auto res = std::static_pointer_cast<Ship::DisplayList>(
|
auto res = std::static_pointer_cast<Ship::DisplayList>(
|
||||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
|
|
||||||
Gfx* gfx = (Gfx*)&res->instructions[originalGfx[path][patchName].index];
|
Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index];
|
||||||
*gfx = originalGfx[path][patchName].instruction;
|
*gfx = originalGfx[path][patchName].instruction;
|
||||||
|
|
||||||
originalGfx[path].erase(patchName);
|
originalGfx[path].erase(patchName);
|
||||||
@ -897,154 +930,48 @@ extern "C" char* ResourceMgr_LoadArrayByName(const char* path)
|
|||||||
{
|
{
|
||||||
auto res = std::static_pointer_cast<Ship::Array>(ResourceMgr_LoadResource(path));
|
auto res = std::static_pointer_cast<Ship::Array>(ResourceMgr_LoadResource(path));
|
||||||
|
|
||||||
return (char*)res->scalars.data();
|
return (char*)res->Scalars.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
|
extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
|
||||||
auto res = std::static_pointer_cast<Ship::Array>(ResourceMgr_LoadResource(path));
|
auto res = std::static_pointer_cast<Ship::Array>(ResourceMgr_LoadResource(path));
|
||||||
|
|
||||||
if (res->CachedGameAsset != nullptr)
|
// if (res->CachedGameAsset != nullptr)
|
||||||
return (char*)res->CachedGameAsset;
|
// return (char*)res->CachedGameAsset;
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Vec3s* data = (Vec3s*)malloc(sizeof(Vec3s) * res->scalars.size());
|
Vec3s* data = (Vec3s*)malloc(sizeof(Vec3s) * res->Scalars.size());
|
||||||
|
|
||||||
for (size_t i = 0; i < res->scalars.size(); i += 3) {
|
for (size_t i = 0; i < res->Scalars.size(); i += 3) {
|
||||||
data[(i / 3)].x = res->scalars[i + 0].s16;
|
data[(i / 3)].x = res->Scalars[i + 0].s16;
|
||||||
data[(i / 3)].y = res->scalars[i + 1].s16;
|
data[(i / 3)].y = res->Scalars[i + 1].s16;
|
||||||
data[(i / 3)].z = res->scalars[i + 2].s16;
|
data[(i / 3)].z = res->Scalars[i + 2].s16;
|
||||||
}
|
}
|
||||||
|
|
||||||
res->CachedGameAsset = data;
|
// res->CachedGameAsset = data;
|
||||||
|
|
||||||
return (char*)data;
|
return (char*)data;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path)
|
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) {
|
||||||
{
|
return (CollisionHeader*)GetResourceDataByName(path, false);
|
||||||
auto colRes = std::static_pointer_cast<Ship::CollisionHeader>(ResourceMgr_LoadResource(path));
|
|
||||||
|
|
||||||
if (colRes->CachedGameAsset != nullptr)
|
|
||||||
return (CollisionHeader*)colRes->CachedGameAsset;
|
|
||||||
|
|
||||||
CollisionHeader* colHeader = (CollisionHeader*)malloc(sizeof(CollisionHeader));
|
|
||||||
|
|
||||||
colHeader->minBounds.x = colRes->absMinX;
|
|
||||||
colHeader->minBounds.y = colRes->absMinY;
|
|
||||||
colHeader->minBounds.z = colRes->absMinZ;
|
|
||||||
|
|
||||||
colHeader->maxBounds.x = colRes->absMaxX;
|
|
||||||
colHeader->maxBounds.y = colRes->absMaxY;
|
|
||||||
colHeader->maxBounds.z = colRes->absMaxZ;
|
|
||||||
|
|
||||||
colHeader->vtxList = (Vec3s*)malloc(sizeof(Vec3s) * colRes->vertices.size());
|
|
||||||
colHeader->numVertices = colRes->vertices.size();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < colRes->vertices.size(); i++)
|
|
||||||
{
|
|
||||||
colHeader->vtxList[i].x = colRes->vertices[i].x;
|
|
||||||
colHeader->vtxList[i].y = colRes->vertices[i].y;
|
|
||||||
colHeader->vtxList[i].z = colRes->vertices[i].z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
colHeader->polyList = (CollisionPoly*)malloc(sizeof(CollisionPoly) * colRes->polygons.size());
|
extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) {
|
||||||
colHeader->numPolygons = colRes->polygons.size();
|
return (Vtx*)GetResourceDataByName(path, false);
|
||||||
|
|
||||||
for (size_t i = 0; i < colRes->polygons.size(); i++)
|
|
||||||
{
|
|
||||||
colHeader->polyList[i].type = colRes->polygons[i].type;
|
|
||||||
colHeader->polyList[i].flags_vIA = colRes->polygons[i].vtxA;
|
|
||||||
colHeader->polyList[i].flags_vIB = colRes->polygons[i].vtxB;
|
|
||||||
colHeader->polyList[i].vIC = colRes->polygons[i].vtxC;
|
|
||||||
colHeader->polyList[i].normal.x = colRes->polygons[i].a;
|
|
||||||
colHeader->polyList[i].normal.y = colRes->polygons[i].b;
|
|
||||||
colHeader->polyList[i].normal.z = colRes->polygons[i].c;
|
|
||||||
colHeader->polyList[i].dist = colRes->polygons[i].d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
colHeader->surfaceTypeList = (SurfaceType*)malloc(colRes->polygonTypes.size() * sizeof(SurfaceType));
|
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
||||||
|
SequenceData* sequence = (SequenceData*)GetResourceDataByName(path, false);
|
||||||
for (size_t i = 0; i < colRes->polygonTypes.size(); i++)
|
return *sequence;
|
||||||
{
|
|
||||||
colHeader->surfaceTypeList[i].data[0] = colRes->polygonTypes[i] >> 32;
|
|
||||||
colHeader->surfaceTypeList[i].data[1] = colRes->polygonTypes[i] & 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
colHeader->cameraDataList = (CamData*)malloc(sizeof(CamData) * colRes->camData->entries.size());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < colRes->camData->entries.size(); i++)
|
|
||||||
{
|
|
||||||
colHeader->cameraDataList[i].cameraSType = colRes->camData->entries[i]->cameraSType;
|
|
||||||
colHeader->cameraDataList[i].numCameras = colRes->camData->entries[i]->numData;
|
|
||||||
|
|
||||||
int idx = colRes->camData->entries[i]->cameraPosDataIdx;
|
|
||||||
|
|
||||||
colHeader->cameraDataList[i].camPosData = (Vec3s*)malloc(sizeof(Vec3s));
|
|
||||||
|
|
||||||
if (colRes->camData->cameraPositionData.size() > 0)
|
|
||||||
{
|
|
||||||
colHeader->cameraDataList[i].camPosData->x = colRes->camData->cameraPositionData[idx]->x;
|
|
||||||
colHeader->cameraDataList[i].camPosData->y = colRes->camData->cameraPositionData[idx]->y;
|
|
||||||
colHeader->cameraDataList[i].camPosData->z = colRes->camData->cameraPositionData[idx]->z;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colHeader->cameraDataList[i].camPosData->x = 0;
|
|
||||||
colHeader->cameraDataList[i].camPosData->y = 0;
|
|
||||||
colHeader->cameraDataList[i].camPosData->z = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
colHeader->numWaterBoxes = colRes->waterBoxes.size();
|
|
||||||
colHeader->waterBoxes = (WaterBox*)malloc(sizeof(WaterBox) * colHeader->numWaterBoxes);
|
|
||||||
|
|
||||||
for (int i = 0; i < colHeader->numWaterBoxes; i++)
|
|
||||||
{
|
|
||||||
colHeader->waterBoxes[i].xLength = colRes->waterBoxes[i].xLength;
|
|
||||||
colHeader->waterBoxes[i].ySurface = colRes->waterBoxes[i].ySurface;
|
|
||||||
colHeader->waterBoxes[i].xMin = colRes->waterBoxes[i].xMin;
|
|
||||||
colHeader->waterBoxes[i].zMin = colRes->waterBoxes[i].zMin;
|
|
||||||
colHeader->waterBoxes[i].xLength = colRes->waterBoxes[i].xLength;
|
|
||||||
colHeader->waterBoxes[i].zLength = colRes->waterBoxes[i].zLength;
|
|
||||||
colHeader->waterBoxes[i].properties = colRes->waterBoxes[i].properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
colRes->CachedGameAsset = colHeader;
|
|
||||||
|
|
||||||
return (CollisionHeader*)colHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" Vtx* ResourceMgr_LoadVtxByName(const char* path)
|
|
||||||
{
|
|
||||||
auto res = std::static_pointer_cast<Ship::Array>(ResourceMgr_LoadResource(path));
|
|
||||||
return (Vtx*)res->vertices.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path)
|
|
||||||
{
|
|
||||||
auto file = std::static_pointer_cast<Ship::AudioSequence>(OTRGlobals::Instance->context->GetResourceManager()
|
|
||||||
->LoadResource(path));
|
|
||||||
|
|
||||||
SequenceData seqData;
|
|
||||||
seqData.seqNumber = file->seqNumber;
|
|
||||||
seqData.medium = file->medium;
|
|
||||||
seqData.cachePolicy = file->cachePolicy;
|
|
||||||
seqData.numFonts = file->fonts.size();
|
|
||||||
|
|
||||||
for (int i = 0; i < seqData.numFonts; i++)
|
|
||||||
seqData.fonts[i] = file->fonts[i];
|
|
||||||
|
|
||||||
seqData.seqData = file->seqData.data();
|
|
||||||
seqData.seqDataSize = file->seqData.size();
|
|
||||||
|
|
||||||
return seqData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, SoundFontSample*> cachedCustomSFs;
|
std::map<std::string, SoundFontSample*> cachedCustomSFs;
|
||||||
|
|
||||||
extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
||||||
|
return nullptr;
|
||||||
|
/*
|
||||||
if (!ExtensionCache.contains(path))
|
if (!ExtensionCache.contains(path))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@ -1097,189 +1024,15 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
||||||
{
|
return (SoundFontSample*)GetResourceDataByName(path, false);
|
||||||
if (std::string(path) == "")
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
if (cachedCustomSFs.find(path) != cachedCustomSFs.end())
|
|
||||||
return cachedCustomSFs[path];
|
|
||||||
|
|
||||||
SoundFontSample* cSample = ReadCustomSample(path);
|
|
||||||
|
|
||||||
if (cSample != nullptr)
|
|
||||||
return cSample;
|
|
||||||
|
|
||||||
auto sample = std::static_pointer_cast<Ship::AudioSample>(ResourceMgr_LoadResource(path));
|
|
||||||
|
|
||||||
if (sample == nullptr)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (sample->CachedGameAsset != nullptr)
|
|
||||||
{
|
|
||||||
SoundFontSample* sampleC = (SoundFontSample*)sample->CachedGameAsset;
|
|
||||||
return (SoundFontSample*)sample->CachedGameAsset;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SoundFontSample* sampleC = new SoundFontSample;
|
|
||||||
|
|
||||||
sampleC->sampleAddr = sample->data.data();
|
|
||||||
|
|
||||||
sampleC->size = sample->data.size();
|
|
||||||
sampleC->codec = sample->codec;
|
|
||||||
sampleC->medium = sample->medium;
|
|
||||||
sampleC->unk_bit26 = sample->unk_bit26;
|
|
||||||
sampleC->unk_bit25 = sample->unk_bit25;
|
|
||||||
|
|
||||||
sampleC->book = (AdpcmBook*) malloc(sizeof(AdpcmBook) + sample->book.books.size() * sizeof(int16_t));
|
|
||||||
sampleC->book->npredictors = sample->book.npredictors;
|
|
||||||
sampleC->book->order = sample->book.order;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < sample->book.books.size(); i++)
|
|
||||||
sampleC->book->book[i] = sample->book.books[i];
|
|
||||||
|
|
||||||
sampleC->loop = new AdpcmLoop;
|
|
||||||
sampleC->loop->start = sample->loop.start;
|
|
||||||
sampleC->loop->end = sample->loop.end;
|
|
||||||
sampleC->loop->count = sample->loop.count;
|
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
sampleC->loop->state[i] = 0;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < sample->loop.states.size(); i++)
|
|
||||||
sampleC->loop->state[i] = sample->loop.states[i];
|
|
||||||
|
|
||||||
sample->CachedGameAsset = sampleC;
|
|
||||||
return sampleC;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
||||||
auto soundFont = std::static_pointer_cast<Ship::AudioSoundFont>(ResourceMgr_LoadResource(path));
|
return (SoundFont*)GetResourceDataByName(path, false);
|
||||||
|
|
||||||
if (soundFont == nullptr)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (soundFont->CachedGameAsset != nullptr)
|
|
||||||
{
|
|
||||||
return (SoundFont*)soundFont->CachedGameAsset;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SoundFont* soundFontC = (SoundFont*)malloc(sizeof(SoundFont));
|
|
||||||
|
|
||||||
soundFontC->fntIndex = soundFont->id;
|
|
||||||
soundFontC->numDrums = soundFont->drums.size();
|
|
||||||
soundFontC->numInstruments = soundFont->instruments.size();
|
|
||||||
soundFontC->numSfx = soundFont->soundEffects.size();
|
|
||||||
soundFontC->sampleBankId1 = soundFont->data1 >> 8;
|
|
||||||
soundFontC->sampleBankId2 = soundFont->data1 & 0xFF;
|
|
||||||
|
|
||||||
soundFontC->drums = (Drum**)malloc(sizeof(Drum*) * soundFont->drums.size());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < soundFont->drums.size(); i++)
|
|
||||||
{
|
|
||||||
Drum* drum = (Drum*)malloc(sizeof(Drum));
|
|
||||||
|
|
||||||
drum->releaseRate = soundFont->drums[i].releaseRate;
|
|
||||||
drum->pan = soundFont->drums[i].pan;
|
|
||||||
drum->loaded = 0;
|
|
||||||
|
|
||||||
if (soundFont->drums[i].env.size() == 0)
|
|
||||||
drum->envelope = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
drum->envelope = (AdsrEnvelope*)malloc(sizeof(AdsrEnvelope) * soundFont->drums[i].env.size());
|
|
||||||
|
|
||||||
for (size_t k = 0; k < soundFont->drums[i].env.size(); k++)
|
|
||||||
{
|
|
||||||
drum->envelope[k].delay = BE16SWAP(soundFont->drums[i].env[k]->delay);
|
|
||||||
drum->envelope[k].arg = BE16SWAP(soundFont->drums[i].env[k]->arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
drum->sound.sample = ResourceMgr_LoadAudioSample(soundFont->drums[i].sampleFileName.c_str());
|
|
||||||
drum->sound.tuning = soundFont->drums[i].tuning;
|
|
||||||
|
|
||||||
soundFontC->drums[i] = drum;
|
|
||||||
}
|
|
||||||
|
|
||||||
soundFontC->instruments = (Instrument**)malloc(sizeof(Instrument*) * soundFont->instruments.size());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < soundFont->instruments.size(); i++) {
|
|
||||||
|
|
||||||
if (soundFont->instruments[i].isValidEntry)
|
|
||||||
{
|
|
||||||
Instrument* inst = (Instrument*)malloc(sizeof(Instrument));
|
|
||||||
|
|
||||||
inst->loaded = 0;
|
|
||||||
inst->releaseRate = soundFont->instruments[i].releaseRate;
|
|
||||||
inst->normalRangeLo = soundFont->instruments[i].normalRangeLo;
|
|
||||||
inst->normalRangeHi = soundFont->instruments[i].normalRangeHi;
|
|
||||||
|
|
||||||
if (soundFont->instruments[i].env.size() == 0)
|
|
||||||
inst->envelope = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
inst->envelope = (AdsrEnvelope*)malloc(sizeof(AdsrEnvelope) * soundFont->instruments[i].env.size());
|
|
||||||
|
|
||||||
for (int k = 0; k < soundFont->instruments[i].env.size(); k++)
|
|
||||||
{
|
|
||||||
inst->envelope[k].delay = BE16SWAP(soundFont->instruments[i].env[k]->delay);
|
|
||||||
inst->envelope[k].arg = BE16SWAP(soundFont->instruments[i].env[k]->arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (soundFont->instruments[i].lowNotesSound != nullptr)
|
|
||||||
{
|
|
||||||
inst->lowNotesSound.sample =
|
|
||||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].lowNotesSound->sampleFileName.c_str());
|
|
||||||
inst->lowNotesSound.tuning = soundFont->instruments[i].lowNotesSound->tuning;
|
|
||||||
} else {
|
|
||||||
inst->lowNotesSound.sample = NULL;
|
|
||||||
inst->lowNotesSound.tuning = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (soundFont->instruments[i].normalNotesSound != nullptr) {
|
|
||||||
inst->normalNotesSound.sample =
|
|
||||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].normalNotesSound->sampleFileName.c_str());
|
|
||||||
inst->normalNotesSound.tuning = soundFont->instruments[i].normalNotesSound->tuning;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
inst->normalNotesSound.sample = NULL;
|
|
||||||
inst->normalNotesSound.tuning = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (soundFont->instruments[i].highNotesSound != nullptr) {
|
|
||||||
inst->highNotesSound.sample =
|
|
||||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].highNotesSound->sampleFileName.c_str());
|
|
||||||
inst->highNotesSound.tuning = soundFont->instruments[i].highNotesSound->tuning;
|
|
||||||
} else {
|
|
||||||
inst->highNotesSound.sample = NULL;
|
|
||||||
inst->highNotesSound.tuning = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
soundFontC->instruments[i] = inst;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
soundFontC->instruments[i] = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
soundFontC->soundEffects = (SoundFontSound*)malloc(sizeof(SoundFontSound) * soundFont->soundEffects.size());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < soundFont->soundEffects.size(); i++)
|
|
||||||
{
|
|
||||||
soundFontC->soundEffects[i].sample = ResourceMgr_LoadAudioSample(soundFont->soundEffects[i]->sampleFileName.c_str());
|
|
||||||
soundFontC->soundEffects[i].tuning = soundFont->soundEffects[i]->tuning;
|
|
||||||
}
|
|
||||||
|
|
||||||
soundFont->CachedGameAsset = soundFontC;
|
|
||||||
return soundFontC;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
||||||
@ -1301,263 +1054,15 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
||||||
auto res = std::static_pointer_cast<Ship::Animation>(ResourceMgr_LoadResource(path));
|
return (AnimationHeaderCommon*)GetResourceDataByName(path, false);
|
||||||
|
|
||||||
if (res->CachedGameAsset != nullptr)
|
|
||||||
return (AnimationHeaderCommon*)res->CachedGameAsset;
|
|
||||||
|
|
||||||
AnimationHeaderCommon* anim = nullptr;
|
|
||||||
|
|
||||||
if (res->type == Ship::AnimationType::Normal) {
|
|
||||||
AnimationHeader* animNormal = (AnimationHeader*)malloc(sizeof(AnimationHeader));
|
|
||||||
|
|
||||||
animNormal->common.frameCount = res->frameCount;
|
|
||||||
animNormal->frameData = (int16_t*)malloc(res->rotationValues.size() * sizeof(int16_t));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < res->rotationValues.size(); i++)
|
|
||||||
animNormal->frameData[i] = res->rotationValues[i];
|
|
||||||
|
|
||||||
animNormal->jointIndices = (JointIndex*)malloc(res->rotationIndices.size() * sizeof(Vec3s));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < res->rotationIndices.size(); i++) {
|
|
||||||
animNormal->jointIndices[i].x = res->rotationIndices[i].x;
|
|
||||||
animNormal->jointIndices[i].y = res->rotationIndices[i].y;
|
|
||||||
animNormal->jointIndices[i].z = res->rotationIndices[i].z;
|
|
||||||
}
|
|
||||||
|
|
||||||
animNormal->staticIndexMax = res->limit;
|
|
||||||
|
|
||||||
anim = (AnimationHeaderCommon*)animNormal;
|
|
||||||
}
|
|
||||||
else if (res->type == Ship::AnimationType::Curve)
|
|
||||||
{
|
|
||||||
TransformUpdateIndex* animCurve = (TransformUpdateIndex*)malloc(sizeof(TransformUpdateIndex));
|
|
||||||
|
|
||||||
animCurve->copyValues = (s16*)malloc(res->copyValuesArr.size() * sizeof(s16));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < res->copyValuesArr.size(); i++)
|
|
||||||
animCurve->copyValues[i] = res->copyValuesArr[i];
|
|
||||||
|
|
||||||
animCurve->transformData = (TransformData*)malloc(res->transformDataArr.size() * sizeof(TransformData));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < res->transformDataArr.size(); i++)
|
|
||||||
{
|
|
||||||
animCurve->transformData[i].unk_00 = res->transformDataArr[i].unk_00;
|
|
||||||
animCurve->transformData[i].unk_02 = res->transformDataArr[i].unk_02;
|
|
||||||
animCurve->transformData[i].unk_04 = res->transformDataArr[i].unk_04;
|
|
||||||
animCurve->transformData[i].unk_06 = res->transformDataArr[i].unk_06;
|
|
||||||
animCurve->transformData[i].unk_08 = res->transformDataArr[i].unk_08;
|
|
||||||
}
|
|
||||||
|
|
||||||
animCurve->refIndex = (u8*)malloc(res->refIndexArr.size());
|
|
||||||
for (size_t i = 0; i < res->refIndexArr.size(); i++)
|
|
||||||
animCurve->refIndex[i] = res->refIndexArr[i];
|
|
||||||
|
|
||||||
anim = (AnimationHeaderCommon*)animCurve;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LinkAnimationHeader* animLink = (LinkAnimationHeader*)malloc(sizeof(LinkAnimationHeader));
|
|
||||||
animLink->common.frameCount = res->frameCount;
|
|
||||||
animLink->segment = (void*)res->segPtr;
|
|
||||||
|
|
||||||
anim = (AnimationHeaderCommon*)animLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
res->CachedGameAsset = anim;
|
|
||||||
|
|
||||||
return anim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path) {
|
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path) {
|
||||||
auto res = std::static_pointer_cast<Ship::Skeleton>(ResourceMgr_LoadResource(path));
|
return (SkeletonHeader*)GetResourceDataByName(path, false);
|
||||||
|
|
||||||
if (res->CachedGameAsset != nullptr)
|
|
||||||
return (SkeletonHeader*)res->CachedGameAsset;
|
|
||||||
|
|
||||||
SkeletonHeader* baseHeader = nullptr;
|
|
||||||
|
|
||||||
if (res->type == Ship::SkeletonType::Normal)
|
|
||||||
{
|
|
||||||
baseHeader = (SkeletonHeader*)malloc(sizeof(SkeletonHeader));
|
|
||||||
}
|
|
||||||
else if (res->type == Ship::SkeletonType::Curve)
|
|
||||||
{
|
|
||||||
SkelCurveLimbList* curve = (SkelCurveLimbList*)malloc(sizeof(SkelCurveLimbList));
|
|
||||||
curve->limbCount = res->limbCount;
|
|
||||||
curve->limbs = (SkelCurveLimb**)malloc(res->limbCount * sizeof(SkelCurveLimb*));
|
|
||||||
baseHeader = (SkeletonHeader*)curve;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
FlexSkeletonHeader* flex = (FlexSkeletonHeader*)malloc(sizeof(FlexSkeletonHeader));
|
|
||||||
flex->dListCount = res->dListCount;
|
|
||||||
|
|
||||||
baseHeader = (SkeletonHeader*)flex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res->type != Ship::SkeletonType::Curve)
|
extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
|
||||||
{
|
return (s32*)GetResourceDataByName(path, false);
|
||||||
baseHeader->limbCount = res->limbCount;
|
|
||||||
baseHeader->segment = (void**)malloc(sizeof(StandardLimb*) * res->limbTable.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < res->limbTable.size(); i++) {
|
|
||||||
std::string limbStr = res->limbTable[i];
|
|
||||||
auto limb = std::static_pointer_cast<Ship::SkeletonLimb>(ResourceMgr_LoadResource(limbStr.c_str()));
|
|
||||||
|
|
||||||
if (limb->limbType == Ship::LimbType::LOD) {
|
|
||||||
LodLimb* limbC = (LodLimb*)malloc(sizeof(LodLimb));
|
|
||||||
limbC->jointPos.x = limb->transX;
|
|
||||||
limbC->jointPos.y = limb->transY;
|
|
||||||
limbC->jointPos.z = limb->transZ;
|
|
||||||
limbC->child = limb->childIndex;
|
|
||||||
limbC->sibling = limb->siblingIndex;
|
|
||||||
|
|
||||||
if (limb->dListPtr != "") {
|
|
||||||
auto dList = ResourceMgr_LoadGfxByName(limb->dListPtr.c_str());
|
|
||||||
limbC->dLists[0] = dList;
|
|
||||||
} else {
|
|
||||||
limbC->dLists[0] = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (limb->dList2Ptr != "") {
|
|
||||||
auto dList = ResourceMgr_LoadGfxByName(limb->dList2Ptr.c_str());
|
|
||||||
limbC->dLists[1] = dList;
|
|
||||||
} else {
|
|
||||||
limbC->dLists[1] = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
baseHeader->segment[i] = limbC;
|
|
||||||
}
|
|
||||||
else if (limb->limbType == Ship::LimbType::Standard)
|
|
||||||
{
|
|
||||||
const auto limbC = new StandardLimb;
|
|
||||||
limbC->jointPos.x = limb->transX;
|
|
||||||
limbC->jointPos.y = limb->transY;
|
|
||||||
limbC->jointPos.z = limb->transZ;
|
|
||||||
limbC->child = limb->childIndex;
|
|
||||||
limbC->sibling = limb->siblingIndex;
|
|
||||||
limbC->dList = nullptr;
|
|
||||||
|
|
||||||
if (!limb->dListPtr.empty()) {
|
|
||||||
const auto dList = ResourceMgr_LoadGfxByName(limb->dListPtr.c_str());
|
|
||||||
limbC->dList = dList;
|
|
||||||
}
|
|
||||||
|
|
||||||
baseHeader->segment[i] = limbC;
|
|
||||||
}
|
|
||||||
else if (limb->limbType == Ship::LimbType::Curve)
|
|
||||||
{
|
|
||||||
const auto limbC = new SkelCurveLimb;
|
|
||||||
|
|
||||||
limbC->firstChildIdx = limb->childIndex;
|
|
||||||
limbC->nextLimbIdx = limb->siblingIndex;
|
|
||||||
limbC->dList[0] = nullptr;
|
|
||||||
limbC->dList[1] = nullptr;
|
|
||||||
|
|
||||||
if (!limb->dListPtr.empty()) {
|
|
||||||
const auto dList = ResourceMgr_LoadGfxByName(limb->dListPtr.c_str());
|
|
||||||
limbC->dList[0] = dList;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!limb->dList2Ptr.empty()) {
|
|
||||||
const auto dList = ResourceMgr_LoadGfxByName(limb->dList2Ptr.c_str());
|
|
||||||
limbC->dList[1] = dList;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto curve = reinterpret_cast<SkelCurveLimbList*>(baseHeader);
|
|
||||||
curve->limbs[i] = limbC;
|
|
||||||
}
|
|
||||||
else if (limb->limbType == Ship::LimbType::Skin)
|
|
||||||
{
|
|
||||||
const auto limbC = new SkinLimb;
|
|
||||||
limbC->jointPos.x = limb->transX;
|
|
||||||
limbC->jointPos.y = limb->transY;
|
|
||||||
limbC->jointPos.z = limb->transZ;
|
|
||||||
limbC->child = limb->childIndex;
|
|
||||||
limbC->sibling = limb->siblingIndex;
|
|
||||||
|
|
||||||
if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList)
|
|
||||||
limbC->segmentType = static_cast<int32_t>(limb->skinSegmentType);
|
|
||||||
else if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4)
|
|
||||||
limbC->segmentType = 4;
|
|
||||||
else if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_5)
|
|
||||||
limbC->segmentType = 5;
|
|
||||||
else
|
|
||||||
limbC->segmentType = 0;
|
|
||||||
|
|
||||||
if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList)
|
|
||||||
limbC->segment = ResourceMgr_LoadGfxByName(limb->skinDList.c_str());
|
|
||||||
else if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) {
|
|
||||||
const auto animData = new SkinAnimatedLimbData;
|
|
||||||
const int skinDataSize = limb->skinData.size();
|
|
||||||
|
|
||||||
animData->totalVtxCount = limb->skinVtxCnt;
|
|
||||||
animData->limbModifCount = skinDataSize;
|
|
||||||
animData->limbModifications = new SkinLimbModif[animData->limbModifCount];
|
|
||||||
animData->dlist = ResourceMgr_LoadGfxByName(limb->skinDList2.c_str());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < skinDataSize; i++)
|
|
||||||
{
|
|
||||||
animData->limbModifications[i].vtxCount = limb->skinData[i].unk_8_arr.size();
|
|
||||||
animData->limbModifications[i].transformCount = limb->skinData[i].unk_C_arr.size();
|
|
||||||
animData->limbModifications[i].unk_4 = limb->skinData[i].unk_4;
|
|
||||||
|
|
||||||
animData->limbModifications[i].skinVertices = new SkinVertex[limb->skinData[i].unk_8_arr.size()];
|
|
||||||
|
|
||||||
for (int k = 0; k < limb->skinData[i].unk_8_arr.size(); k++)
|
|
||||||
{
|
|
||||||
animData->limbModifications[i].skinVertices[k].index = limb->skinData[i].unk_8_arr[k].unk_0;
|
|
||||||
animData->limbModifications[i].skinVertices[k].s = limb->skinData[i].unk_8_arr[k].unk_2;
|
|
||||||
animData->limbModifications[i].skinVertices[k].t = limb->skinData[i].unk_8_arr[k].unk_4;
|
|
||||||
animData->limbModifications[i].skinVertices[k].normX = limb->skinData[i].unk_8_arr[k].unk_6;
|
|
||||||
animData->limbModifications[i].skinVertices[k].normY = limb->skinData[i].unk_8_arr[k].unk_7;
|
|
||||||
animData->limbModifications[i].skinVertices[k].normZ = limb->skinData[i].unk_8_arr[k].unk_8;
|
|
||||||
animData->limbModifications[i].skinVertices[k].alpha = limb->skinData[i].unk_8_arr[k].unk_9;
|
|
||||||
}
|
|
||||||
|
|
||||||
animData->limbModifications[i].limbTransformations =
|
|
||||||
new SkinTransformation[limb->skinData[i].unk_C_arr.size()];
|
|
||||||
|
|
||||||
for (int k = 0; k < limb->skinData[i].unk_C_arr.size(); k++)
|
|
||||||
{
|
|
||||||
animData->limbModifications[i].limbTransformations[k].limbIndex = limb->skinData[i].unk_C_arr[k].unk_0;
|
|
||||||
animData->limbModifications[i].limbTransformations[k].x = limb->skinData[i].unk_C_arr[k].x;
|
|
||||||
animData->limbModifications[i].limbTransformations[k].y = limb->skinData[i].unk_C_arr[k].y;
|
|
||||||
animData->limbModifications[i].limbTransformations[k].z = limb->skinData[i].unk_C_arr[k].z;
|
|
||||||
animData->limbModifications[i].limbTransformations[k].scale = limb->skinData[i].unk_C_arr[k].unk_8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
limbC->segment = animData;
|
|
||||||
|
|
||||||
//limbC->segment = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if (limb->dListPtr != "") {
|
|
||||||
auto dList = ResourceMgr_LoadGfxByName((char*)limb->dListPtr.c_str());
|
|
||||||
limbC->unk_8 = dList;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
limbC->unk_8 = nullptr;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
baseHeader->segment[i] = limbC;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// OTRTODO: Print error here...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res->CachedGameAsset = baseHeader;
|
|
||||||
|
|
||||||
return baseHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" s32* ResourceMgr_LoadCSByName(const char* path)
|
|
||||||
{
|
|
||||||
auto res = std::static_pointer_cast<Ship::Cutscene>(ResourceMgr_LoadResource(path));
|
|
||||||
return (s32*)res->commands.data();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path GetSaveFile(std::shared_ptr<Mercury> Conf) {
|
std::filesystem::path GetSaveFile(std::shared_ptr<Mercury> Conf) {
|
||||||
@ -1936,7 +1441,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
|||||||
if (player->getItemEntry.getItemId == RG_ICE_TRAP) {
|
if (player->getItemEntry.getItemId == RG_ICE_TRAP) {
|
||||||
u16 iceTrapTextId = Random(0, NUM_ICE_TRAP_MESSAGES);
|
u16 iceTrapTextId = Random(0, NUM_ICE_TRAP_MESSAGES);
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, iceTrapTextId);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, iceTrapTextId);
|
||||||
if (CVar_GetS32("gLetItSnow", 0)) {
|
if (CVarGetInteger("gLetItSnow", 0)) {
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, NUM_ICE_TRAP_MESSAGES + 1);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, NUM_ICE_TRAP_MESSAGES + 1);
|
||||||
}
|
}
|
||||||
} else if (player->getItemEntry.getItemId >= RG_DEKU_TREE_MAP && player->getItemEntry.getItemId <= RG_ICE_CAVERN_MAP) {
|
} else if (player->getItemEntry.getItemId >= RG_DEKU_TREE_MAP && player->getItemEntry.getItemId <= RG_ICE_CAVERN_MAP) {
|
||||||
@ -1998,12 +1503,12 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
|||||||
RandomizerInf randoInf = (RandomizerInf)((textId - (TEXT_SHOP_ITEM_RANDOM + NUM_SHOP_ITEMS)) + RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
RandomizerInf randoInf = (RandomizerInf)((textId - (TEXT_SHOP_ITEM_RANDOM + NUM_SHOP_ITEMS)) + RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
||||||
messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SHOP_ITEM_RANDOM_CONFIRM);
|
messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SHOP_ITEM_RANDOM_CONFIRM);
|
||||||
}
|
}
|
||||||
} else if (CVar_GetS32("gRandomizeRupeeNames", 0) &&
|
} else if (CVarGetInteger("gRandomizeRupeeNames", 0) &&
|
||||||
(textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE ||
|
(textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE ||
|
||||||
textId == TEXT_HUGE_RUPEE)) {
|
textId == TEXT_HUGE_RUPEE)) {
|
||||||
messageEntry = Randomizer::GetRupeeMessage(textId);
|
messageEntry = Randomizer::GetRupeeMessage(textId);
|
||||||
// In rando, replace Navi's general overworld hints with rando-related gameplay tips
|
// In rando, replace Navi's general overworld hints with rando-related gameplay tips
|
||||||
} else if (CVar_GetS32("gRandoRelevantNavi", 1) && textId >= 0x0140 && textId <= 0x015F) {
|
} else if (CVarGetInteger("gRandoRelevantNavi", 1) && textId >= 0x0140 && textId <= 0x015F) {
|
||||||
u16 naviTextId = Random(0, NUM_NAVI_MESSAGES);
|
u16 naviTextId = Random(0, NUM_NAVI_MESSAGES);
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::NaviRandoMessageTableID, naviTextId);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::NaviRandoMessageTableID, naviTextId);
|
||||||
} else if (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS) && textId == TEXT_BEAN_SALESMAN) {
|
} else if (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS) && textId == TEXT_BEAN_SALESMAN) {
|
||||||
@ -2024,7 +1529,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) {
|
if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) {
|
||||||
if (CVar_GetS32("gInjectItemCounts", 0) != 0) {
|
if (CVarGetInteger("gInjectItemCounts", 0) != 0) {
|
||||||
// The freeze text cannot be manually dismissed and must be auto-dismissed.
|
// The freeze text cannot be manually dismissed and must be auto-dismissed.
|
||||||
// This is fine and even wanted when skull tokens are not shuffled, but when
|
// This is fine and even wanted when skull tokens are not shuffled, but when
|
||||||
// when they are shuffled we don't want to be able to manually dismiss the box.
|
// when they are shuffled we don't want to be able to manually dismiss the box.
|
||||||
@ -2032,7 +1537,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
|||||||
// animation until the text box auto-dismisses.
|
// animation until the text box auto-dismisses.
|
||||||
// RANDOTODO: Implement a way to determine if an item came from a skulltula and
|
// RANDOTODO: Implement a way to determine if an item came from a skulltula and
|
||||||
// inject the auto-dismiss control code if it did.
|
// inject the auto-dismiss control code if it did.
|
||||||
if (CVar_GetS32("gSkulltulaFreeze", 0) != 0 &&
|
if (CVarGetInteger("gSkulltulaFreeze", 0) != 0 &&
|
||||||
!(gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) {
|
!(gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) {
|
||||||
textId = TEXT_GS_NO_FREEZE;
|
textId = TEXT_GS_NO_FREEZE;
|
||||||
} else {
|
} else {
|
||||||
@ -2042,15 +1547,15 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
|||||||
CustomMessageManager::ReplaceStringInMessage(messageEntry, "{{gsCount}}", std::to_string(gSaveContext.inventory.gsTokens + 1));
|
CustomMessageManager::ReplaceStringInMessage(messageEntry, "{{gsCount}}", std::to_string(gSaveContext.inventory.gsTokens + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (textId == TEXT_HEART_CONTAINER && CVar_GetS32("gInjectItemCounts", 0)) {
|
if (textId == TEXT_HEART_CONTAINER && CVarGetInteger("gInjectItemCounts", 0)) {
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_CONTAINER);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_CONTAINER);
|
||||||
CustomMessageManager::ReplaceStringInMessage(messageEntry, "{{heartContainerCount}}", std::to_string(gSaveContext.sohStats.heartContainers + 1));
|
CustomMessageManager::ReplaceStringInMessage(messageEntry, "{{heartContainerCount}}", std::to_string(gSaveContext.sohStats.heartContainers + 1));
|
||||||
}
|
}
|
||||||
if (textId == TEXT_HEART_PIECE && CVar_GetS32("gInjectItemCounts", 0)) {
|
if (textId == TEXT_HEART_PIECE && CVarGetInteger("gInjectItemCounts", 0)) {
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_PIECE);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_PIECE);
|
||||||
CustomMessageManager::ReplaceStringInMessage(messageEntry, "{{heartPieceCount}}", std::to_string(gSaveContext.sohStats.heartPieces + 1));
|
CustomMessageManager::ReplaceStringInMessage(messageEntry, "{{heartPieceCount}}", std::to_string(gSaveContext.sohStats.heartPieces + 1));
|
||||||
}
|
}
|
||||||
if (textId == TEXT_MARKET_GUARD_NIGHT && CVar_GetS32("gMarketSneak", 0) && play->sceneNum == SCENE_ENTRA_N) {
|
if (textId == TEXT_MARKET_GUARD_NIGHT && CVarGetInteger("gMarketSneak", 0) && play->sceneNum == SCENE_ENTRA_N) {
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT);
|
||||||
}
|
}
|
||||||
if (messageEntry.textBoxType != -1) {
|
if (messageEntry.textBoxType != -1) {
|
||||||
|
@ -62,10 +62,8 @@ char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
|
|||||||
void ResourceMgr_LoadFile(const char* resName);
|
void ResourceMgr_LoadFile(const char* resName);
|
||||||
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
||||||
char* ResourceMgr_LoadJPEG(char* data, int dataSize);
|
char* ResourceMgr_LoadJPEG(char* data, int dataSize);
|
||||||
char* ResourceMgr_LoadTexByName(const char* texPath);
|
|
||||||
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||||
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||||
uint32_t ResourceMgr_LoadTexSizeByName(char* texPath);
|
|
||||||
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
|
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
|
||||||
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
||||||
AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path);
|
AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path);
|
||||||
@ -77,7 +75,7 @@ void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName);
|
|||||||
char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path);
|
char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path);
|
||||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||||
|
|
||||||
Vtx* ResourceMgr_LoadVtxByName(const char* path);
|
Vtx* ResourceMgr_LoadVtxByName(char* path);
|
||||||
SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path);
|
SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path);
|
||||||
SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||||
SoundFontSample* ResourceMgr_LoadAudioSample(const char* path);
|
SoundFontSample* ResourceMgr_LoadAudioSample(const char* path);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include <Hooks.h>
|
#include <Hooks.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
#define NOGDI // avoid various windows defines that conflict with things in z64.h
|
#define NOGDI // avoid various windows defines that conflict with things in z64.h
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
@ -801,7 +801,7 @@ void SaveManager::AddPostFunction(const std::string& name, PostFunc func) {
|
|||||||
void SaveManager::CreateDefaultGlobal() {
|
void SaveManager::CreateDefaultGlobal() {
|
||||||
gSaveContext.audioSetting = 0;
|
gSaveContext.audioSetting = 0;
|
||||||
gSaveContext.zTargetSetting = 0;
|
gSaveContext.zTargetSetting = 0;
|
||||||
gSaveContext.language = CVar_GetS32("gLanguages", LANGUAGE_ENG);
|
gSaveContext.language = CVarGetInteger("gLanguages", LANGUAGE_ENG);
|
||||||
|
|
||||||
SaveGlobal();
|
SaveGlobal();
|
||||||
}
|
}
|
||||||
@ -1962,7 +1962,7 @@ void SaveManager::ConvertFromUnversioned() {
|
|||||||
gSaveContext.zTargetSetting = data[SRAM_HEADER_ZTARGET] & 1;
|
gSaveContext.zTargetSetting = data[SRAM_HEADER_ZTARGET] & 1;
|
||||||
gSaveContext.language = data[SRAM_HEADER_LANGUAGE];
|
gSaveContext.language = data[SRAM_HEADER_LANGUAGE];
|
||||||
if (gSaveContext.language >= LANGUAGE_MAX) {
|
if (gSaveContext.language >= LANGUAGE_MAX) {
|
||||||
gSaveContext.language = CVar_GetS32("gLanguages", LANGUAGE_ENG);
|
gSaveContext.language = CVarGetInteger("gLanguages", LANGUAGE_ENG);
|
||||||
}
|
}
|
||||||
SaveGlobal();
|
SaveGlobal();
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ultra64/gbi.h>
|
#include <libultraship/libultra/gbi.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 valid;
|
u8 valid;
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
#include <ImGui/imgui_internal.h>
|
#include <ImGui/imgui_internal.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <ImGuiImpl.h>
|
||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
#include <ultra64/types.h>
|
#include <libultraship/libultra/types.h>
|
||||||
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
|
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
|
||||||
|
|
||||||
namespace UIWidgets {
|
namespace UIWidgets {
|
||||||
@ -59,7 +59,7 @@ namespace UIWidgets {
|
|||||||
defaultColors.b = default_colors.z;
|
defaultColors.b = default_colors.z;
|
||||||
defaultColors.a = default_colors.w;
|
defaultColors.a = default_colors.w;
|
||||||
|
|
||||||
Color_RGBA8 cvarColor = CVar_GetRGBA(cvarname, defaultColors);
|
Color_RGBA8 cvarColor = CVarGetColor(cvarname, defaultColors);
|
||||||
|
|
||||||
ColorArray.x = cvarColor.r / 255.0;
|
ColorArray.x = cvarColor.r / 255.0;
|
||||||
ColorArray.y = cvarColor.g / 255.0;
|
ColorArray.y = cvarColor.g / 255.0;
|
||||||
@ -202,9 +202,9 @@ namespace UIWidgets {
|
|||||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||||
}
|
}
|
||||||
bool val = (bool)CVar_GetS32(cvarName, defaultValue);
|
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
|
||||||
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
|
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
|
||||||
CVar_SetS32(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -233,10 +233,10 @@ namespace UIWidgets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue) {
|
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue) {
|
||||||
if (ImGui::BeginCombo(name.c_str(), items[static_cast<int>(CVar_GetS32(cvarName, defaultValue))].c_str())) {
|
if (ImGui::BeginCombo(name.c_str(), items[static_cast<int>(CVarGetInteger(cvarName, defaultValue))].c_str())) {
|
||||||
for (int settingIndex = 0; settingIndex < (int) items.size(); settingIndex++) {
|
for (int settingIndex = 0; settingIndex < (int) items.size(); settingIndex++) {
|
||||||
if (ImGui::Selectable(items[settingIndex].c_str())) {
|
if (ImGui::Selectable(items[settingIndex].c_str())) {
|
||||||
CVar_SetS32(cvarName, settingIndex);
|
CVarSetInteger(cvarName, settingIndex);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -250,14 +250,14 @@ namespace UIWidgets {
|
|||||||
if (FirstTimeValue <= 0) {
|
if (FirstTimeValue <= 0) {
|
||||||
FirstTimeValue = 0;
|
FirstTimeValue = 0;
|
||||||
}
|
}
|
||||||
uint8_t selected = CVar_GetS32(name, FirstTimeValue);
|
uint8_t selected = CVarGetInteger(name, FirstTimeValue);
|
||||||
uint8_t DefaultValue = selected;
|
uint8_t DefaultValue = selected;
|
||||||
std::string comboName = std::string("##") + std::string(name);
|
std::string comboName = std::string("##") + std::string(name);
|
||||||
if (ImGui::BeginCombo(comboName.c_str(), ComboArray[DefaultValue])) {
|
if (ImGui::BeginCombo(comboName.c_str(), ComboArray[DefaultValue])) {
|
||||||
for (uint8_t i = 0; i < arraySize; i++) {
|
for (uint8_t i = 0; i < arraySize; i++) {
|
||||||
if (strlen(ComboArray[i]) > 1) {
|
if (strlen(ComboArray[i]) > 1) {
|
||||||
if (ImGui::Selectable(ComboArray[i], i == selected)) {
|
if (ImGui::Selectable(ComboArray[i], i == selected)) {
|
||||||
CVar_SetS32(name, i);
|
CVarSetInteger(name, i);
|
||||||
selected = i;
|
selected = i;
|
||||||
changed = true;
|
changed = true;
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
@ -294,7 +294,7 @@ namespace UIWidgets {
|
|||||||
|
|
||||||
bool EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue, bool PlusMinusButton, bool disabled, const char* disabledTooltipText) {
|
bool EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue, bool PlusMinusButton, bool disabled, const char* disabledTooltipText) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
int val = CVar_GetS32(cvarName, defaultValue);
|
int val = CVarGetInteger(cvarName, defaultValue);
|
||||||
|
|
||||||
float alpha;
|
float alpha;
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
@ -315,7 +315,7 @@ namespace UIWidgets {
|
|||||||
MinusBTNName += cvarName;
|
MinusBTNName += cvarName;
|
||||||
if (ImGui::Button(MinusBTNName.c_str())) {
|
if (ImGui::Button(MinusBTNName.c_str())) {
|
||||||
val--;
|
val--;
|
||||||
CVar_SetS32(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ namespace UIWidgets {
|
|||||||
}
|
}
|
||||||
if (ImGui::SliderInt(id, &val, min, max, format))
|
if (ImGui::SliderInt(id, &val, min, max, format))
|
||||||
{
|
{
|
||||||
CVar_SetS32(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ namespace UIWidgets {
|
|||||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
|
||||||
if (ImGui::Button(PlusBTNName.c_str())) {
|
if (ImGui::Button(PlusBTNName.c_str())) {
|
||||||
val++;
|
val++;
|
||||||
CVar_SetS32(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ namespace UIWidgets {
|
|||||||
if (val < min)
|
if (val < min)
|
||||||
{
|
{
|
||||||
val = min;
|
val = min;
|
||||||
CVar_SetS32(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ namespace UIWidgets {
|
|||||||
if (val > max)
|
if (val > max)
|
||||||
{
|
{
|
||||||
val = max;
|
val = max;
|
||||||
CVar_SetS32(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -390,7 +390,7 @@ namespace UIWidgets {
|
|||||||
|
|
||||||
bool EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton, bool disabled, const char* disabledTooltipText) {
|
bool EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton, bool disabled, const char* disabledTooltipText) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
float val = CVar_GetFloat(cvarName, defaultValue);
|
float val = CVarGetFloat(cvarName, defaultValue);
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||||
@ -412,7 +412,7 @@ namespace UIWidgets {
|
|||||||
} else {
|
} else {
|
||||||
val -= 0.01f;
|
val -= 0.01f;
|
||||||
}
|
}
|
||||||
CVar_SetFloat(cvarName, val);
|
CVarSetFloat(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -430,9 +430,9 @@ namespace UIWidgets {
|
|||||||
}
|
}
|
||||||
if (ImGui::SliderFloat(id, &val, min, max, format)) {
|
if (ImGui::SliderFloat(id, &val, min, max, format)) {
|
||||||
if (isPercentage) {
|
if (isPercentage) {
|
||||||
CVar_SetFloat(cvarName, roundf(val * 100) / 100);
|
CVarSetFloat(cvarName, roundf(val * 100) / 100);
|
||||||
} else {
|
} else {
|
||||||
CVar_SetFloat(cvarName, val);
|
CVarSetFloat(cvarName, val);
|
||||||
}
|
}
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -451,7 +451,7 @@ namespace UIWidgets {
|
|||||||
} else {
|
} else {
|
||||||
val += 0.01f;
|
val += 0.01f;
|
||||||
}
|
}
|
||||||
CVar_SetFloat(cvarName, val);
|
CVarSetFloat(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -467,14 +467,14 @@ namespace UIWidgets {
|
|||||||
|
|
||||||
if (val < min) {
|
if (val < min) {
|
||||||
val = min;
|
val = min;
|
||||||
CVar_SetFloat(cvarName, val);
|
CVarSetFloat(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val > max) {
|
if (val > max) {
|
||||||
val = max;
|
val = max;
|
||||||
CVar_SetFloat(cvarName, val);
|
CVarSetFloat(cvarName, val);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -507,9 +507,9 @@ namespace UIWidgets {
|
|||||||
make_invisible += text;
|
make_invisible += text;
|
||||||
make_invisible += cvarName;
|
make_invisible += cvarName;
|
||||||
|
|
||||||
int val = CVar_GetS32(cvarName, 0);
|
int val = CVarGetInteger(cvarName, 0);
|
||||||
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
|
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
|
||||||
CVar_SetS32(cvarName, id);
|
CVarSetInteger(cvarName, id);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -536,8 +536,8 @@ namespace UIWidgets {
|
|||||||
colorsRGBA.b = defaultcolors.z;
|
colorsRGBA.b = defaultcolors.z;
|
||||||
colorsRGBA.a = has_alpha ? defaultcolors.w : 255.0f;
|
colorsRGBA.a = has_alpha ? defaultcolors.w : 255.0f;
|
||||||
|
|
||||||
CVar_SetRGBA(cvarName, colorsRGBA);
|
CVarSetColor(cvarName, colorsRGBA);
|
||||||
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -566,8 +566,8 @@ namespace UIWidgets {
|
|||||||
NewColors.r = fmin(fmax(colors->x * 255, 0), 255);
|
NewColors.r = fmin(fmax(colors->x * 255, 0), 255);
|
||||||
NewColors.g = fmin(fmax(colors->y * 255, 0), 255);
|
NewColors.g = fmin(fmax(colors->y * 255, 0), 255);
|
||||||
NewColors.b = fmin(fmax(colors->z * 255, 0), 255);
|
NewColors.b = fmin(fmax(colors->z * 255, 0), 255);
|
||||||
CVar_SetRGBA(cvarName, NewColors);
|
CVarSetColor(cvarName, NewColors);
|
||||||
CVar_SetS32(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
|
CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -578,7 +578,7 @@ namespace UIWidgets {
|
|||||||
void DrawLockColorCheckbox(const char* cvarName) {
|
void DrawLockColorCheckbox(const char* cvarName) {
|
||||||
std::string Cvar_Lock = cvarName;
|
std::string Cvar_Lock = cvarName;
|
||||||
Cvar_Lock += "Lock";
|
Cvar_Lock += "Lock";
|
||||||
s32 lock = CVar_GetS32(Cvar_Lock.c_str(), 0);
|
s32 lock = CVarGetInteger(Cvar_Lock.c_str(), 0);
|
||||||
std::string FullName = "Lock##" + Cvar_Lock;
|
std::string FullName = "Lock##" + Cvar_Lock;
|
||||||
EnhancementCheckbox(FullName.c_str(), Cvar_Lock.c_str());
|
EnhancementCheckbox(FullName.c_str(), Cvar_Lock.c_str());
|
||||||
Tooltip("Prevents this color from being changed upon selecting \"Randomize all\"");
|
Tooltip("Prevents this color from being changed upon selecting \"Randomize all\"");
|
||||||
@ -618,7 +618,7 @@ namespace UIWidgets {
|
|||||||
colors.b = ColorRGBA.z * 255.0;
|
colors.b = ColorRGBA.z * 255.0;
|
||||||
colors.a = 255.0;
|
colors.a = 255.0;
|
||||||
|
|
||||||
CVar_SetRGBA(cvarName, colors);
|
CVarSetColor(cvarName, colors);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -634,7 +634,7 @@ namespace UIWidgets {
|
|||||||
colors.b = ColorRGBA.z * 255.0;
|
colors.b = ColorRGBA.z * 255.0;
|
||||||
colors.a = ColorRGBA.w * 255.0;
|
colors.a = ColorRGBA.w * 255.0;
|
||||||
|
|
||||||
CVar_SetRGBA(cvarName, colors);
|
CVarSetColor(cvarName, colors);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <Cvar.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -451,7 +451,7 @@ void FrameInterpolation_StartRecord(void) {
|
|||||||
current_recording = {};
|
current_recording = {};
|
||||||
current_path.clear();
|
current_path.clear();
|
||||||
current_path.push_back(¤t_recording.root_path);
|
current_path.push_back(¤t_recording.root_path);
|
||||||
if (CVar_GetS32("gInterpolationFPS", 20) != 20) {
|
if (CVarGetInteger("gInterpolationFPS", 20) != 20) {
|
||||||
is_recording = true;
|
is_recording = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
103
soh/soh/resource/importer/AnimationFactory.cpp
Normal file
103
soh/soh/resource/importer/AnimationFactory.cpp
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
#include "soh/resource/importer/AnimationFactory.h"
|
||||||
|
#include "soh/resource/type/Animation.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> AnimationFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader) {
|
||||||
|
auto resource = std::make_shared<Animation>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version) {
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<AnimationFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr) {
|
||||||
|
SPDLOG_ERROR("Failed to load Animation with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) {
|
||||||
|
std::shared_ptr<Animation> animation = std::static_pointer_cast<Animation>(resource);
|
||||||
|
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, animation);
|
||||||
|
|
||||||
|
AnimationType animType = (AnimationType)reader->ReadUInt32();
|
||||||
|
animation->type = animType;
|
||||||
|
|
||||||
|
if (animType == AnimationType::Normal) {
|
||||||
|
// Set frame count
|
||||||
|
animation->animationData.animationHeader.common.frameCount = reader->ReadInt16();
|
||||||
|
|
||||||
|
// Populate frame data
|
||||||
|
uint32_t rotValuesCnt = reader->ReadUInt32();
|
||||||
|
animation->rotationValues.reserve(rotValuesCnt);
|
||||||
|
for (uint32_t i = 0; i < rotValuesCnt; i++) {
|
||||||
|
animation->rotationValues.push_back(reader->ReadUInt16());
|
||||||
|
}
|
||||||
|
animation->animationData.animationHeader.frameData = (int16_t*)animation->rotationValues.data();
|
||||||
|
|
||||||
|
// Populate joint indices
|
||||||
|
uint32_t rotIndCnt = reader->ReadUInt32();
|
||||||
|
animation->rotationIndices.reserve(rotIndCnt);
|
||||||
|
for (size_t i = 0; i < rotIndCnt; i++) {
|
||||||
|
uint16_t x = reader->ReadUInt16();
|
||||||
|
uint16_t y = reader->ReadUInt16();
|
||||||
|
uint16_t z = reader->ReadUInt16();
|
||||||
|
animation->rotationIndices.push_back(RotationIndex(x, y, z));
|
||||||
|
}
|
||||||
|
animation->animationData.animationHeader.jointIndices = (JointIndex*)animation->rotationIndices.data();
|
||||||
|
|
||||||
|
// Set static index max
|
||||||
|
animation->animationData.animationHeader.staticIndexMax = reader->ReadInt16();
|
||||||
|
} else if (animType == AnimationType::Curve) {
|
||||||
|
// Read frame count (unused in this animation type)
|
||||||
|
reader->ReadInt16();
|
||||||
|
|
||||||
|
// Set refIndex
|
||||||
|
uint32_t refArrCnt = reader->ReadUInt32();
|
||||||
|
animation->refIndexArr.reserve(refArrCnt);
|
||||||
|
for (uint32_t i = 0; i < refArrCnt; i++) {
|
||||||
|
animation->refIndexArr.push_back(reader->ReadUByte());
|
||||||
|
}
|
||||||
|
animation->animationData.transformUpdateIndex.refIndex = animation->refIndexArr.data();
|
||||||
|
|
||||||
|
// Populate transform data
|
||||||
|
uint32_t transformDataCnt = reader->ReadUInt32();
|
||||||
|
animation->transformDataArr.reserve(transformDataCnt);
|
||||||
|
for (uint32_t i = 0; i < transformDataCnt; i++) {
|
||||||
|
TransformData data;
|
||||||
|
data.unk_00 = reader->ReadUInt16();
|
||||||
|
data.unk_02 = reader->ReadInt16();
|
||||||
|
data.unk_04 = reader->ReadInt16();
|
||||||
|
data.unk_06 = reader->ReadInt16();
|
||||||
|
data.unk_08 = reader->ReadFloat();
|
||||||
|
|
||||||
|
animation->transformDataArr.push_back(data);
|
||||||
|
}
|
||||||
|
animation->animationData.transformUpdateIndex.transformData = animation->transformDataArr.data();
|
||||||
|
|
||||||
|
// Populate copy values
|
||||||
|
uint32_t copyValuesCnt = reader->ReadUInt32();
|
||||||
|
animation->copyValuesArr.reserve(copyValuesCnt);
|
||||||
|
for (uint32_t i = 0; i < copyValuesCnt; i++) {
|
||||||
|
animation->copyValuesArr.push_back(reader->ReadInt16());
|
||||||
|
}
|
||||||
|
animation->animationData.transformUpdateIndex.copyValues = animation->copyValuesArr.data();
|
||||||
|
} else if (animType == AnimationType::Link) {
|
||||||
|
// Read the frame count
|
||||||
|
animation->animationData.linkAnimationHeader.common.frameCount = reader->ReadInt16();
|
||||||
|
|
||||||
|
// Read the segment pointer (always 32 bit, doesn't adjust for system pointer size)
|
||||||
|
animation->animationData.linkAnimationHeader.segment = (void*)reader->ReadUInt32();
|
||||||
|
} else if (animType == AnimationType::Legacy) {
|
||||||
|
SPDLOG_DEBUG("BEYTAH ANIMATION?!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
16
soh/soh/resource/importer/AnimationFactory.h
Normal file
16
soh/soh/resource/importer/AnimationFactory.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class AnimationFactory : public ResourceFactory {
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class AnimationFactoryV0 : public ResourceVersionFactory {
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
143
soh/soh/resource/importer/AudioSampleFactory.cpp
Normal file
143
soh/soh/resource/importer/AudioSampleFactory.cpp
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
#include "soh/resource/importer/AudioSampleFactory.h"
|
||||||
|
#include "soh/resource/type/AudioSample.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> AudioSampleFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<AudioSample>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
factory = std::make_shared<AudioSampleFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load AudioSample with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
||||||
|
|
||||||
|
audioSample->sample.codec = reader->ReadUByte();
|
||||||
|
audioSample->sample.medium = reader->ReadUByte();
|
||||||
|
audioSample->sample.unk_bit26 = reader->ReadUByte();
|
||||||
|
audioSample->sample.unk_bit25 = reader->ReadUByte();
|
||||||
|
audioSample->sample.size = reader->ReadUInt32();
|
||||||
|
|
||||||
|
audioSample->audioSampleData.reserve(audioSample->sample.size);
|
||||||
|
for (uint32_t i = 0; i < audioSample->sample.size; i++) {
|
||||||
|
audioSample->audioSampleData.push_back(reader->ReadUByte());
|
||||||
|
}
|
||||||
|
audioSample->sample.sampleAddr = audioSample->audioSampleData.data();
|
||||||
|
|
||||||
|
audioSample->loop.start = reader->ReadUInt32();
|
||||||
|
audioSample->loop.end = reader->ReadUInt32();
|
||||||
|
audioSample->loop.count = reader->ReadUInt32();
|
||||||
|
|
||||||
|
audioSample->loopStateCount = reader->ReadUInt32();
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
audioSample->loop.state[i] = 0;
|
||||||
|
}
|
||||||
|
for (uint32_t i = 0; i < audioSample->loopStateCount; i++) {
|
||||||
|
audioSample->loop.state[i] = reader->ReadInt16();
|
||||||
|
}
|
||||||
|
audioSample->sample.loop = &audioSample->loop;
|
||||||
|
|
||||||
|
audioSample->book.order = reader->ReadInt32();
|
||||||
|
audioSample->book.npredictors = reader->ReadInt32();
|
||||||
|
audioSample->bookDataCount = reader->ReadUInt32();
|
||||||
|
|
||||||
|
audioSample->bookData.reserve(audioSample->bookDataCount);
|
||||||
|
for (uint32_t i = 0; i < audioSample->bookDataCount; i++) {
|
||||||
|
audioSample->bookData.push_back(reader->ReadInt16());
|
||||||
|
}
|
||||||
|
audioSample->book.book = audioSample->bookData.data();
|
||||||
|
audioSample->sample.book = &audioSample->book;
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
in ResourceMgr_LoadAudioSample we used to have
|
||||||
|
--------------
|
||||||
|
if (cachedCustomSFs.find(path) != cachedCustomSFs.end())
|
||||||
|
return cachedCustomSFs[path];
|
||||||
|
|
||||||
|
SoundFontSample* cSample = ReadCustomSample(path);
|
||||||
|
|
||||||
|
if (cSample != nullptr)
|
||||||
|
return cSample;
|
||||||
|
--------------
|
||||||
|
before the rest of the standard sample reading, this is the ReadCustomSample code we used to have
|
||||||
|
|
||||||
|
extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
||||||
|
|
||||||
|
if (!ExtensionCache.contains(path))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
ExtensionEntry entry = ExtensionCache[path];
|
||||||
|
|
||||||
|
auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(entry.path);
|
||||||
|
uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get();
|
||||||
|
uint8_t* strem2 = (uint8_t*)strem;
|
||||||
|
|
||||||
|
SoundFontSample* sampleC = new SoundFontSample;
|
||||||
|
|
||||||
|
if (entry.ext == "wav") {
|
||||||
|
drwav_uint32 channels;
|
||||||
|
drwav_uint32 sampleRate;
|
||||||
|
drwav_uint64 totalPcm;
|
||||||
|
drmp3_int16* pcmData =
|
||||||
|
drwav_open_memory_and_read_pcm_frames_s16(strem2, sampleRaw->BufferSize, &channels, &sampleRate, &totalPcm, NULL);
|
||||||
|
sampleC->size = totalPcm;
|
||||||
|
sampleC->sampleAddr = (uint8_t*)pcmData;
|
||||||
|
sampleC->codec = CODEC_S16;
|
||||||
|
|
||||||
|
sampleC->loop = new AdpcmLoop;
|
||||||
|
sampleC->loop->start = 0;
|
||||||
|
sampleC->loop->end = sampleC->size - 1;
|
||||||
|
sampleC->loop->count = 0;
|
||||||
|
sampleC->sampleRateMagicValue = 'RIFF';
|
||||||
|
sampleC->sampleRate = sampleRate;
|
||||||
|
|
||||||
|
cachedCustomSFs[path] = sampleC;
|
||||||
|
return sampleC;
|
||||||
|
} else if (entry.ext == "mp3") {
|
||||||
|
drmp3_config mp3Info;
|
||||||
|
drmp3_uint64 totalPcm;
|
||||||
|
drmp3_int16* pcmData =
|
||||||
|
drmp3_open_memory_and_read_pcm_frames_s16(strem2, sampleRaw->BufferSize, &mp3Info, &totalPcm, NULL);
|
||||||
|
|
||||||
|
sampleC->size = totalPcm * mp3Info.channels * sizeof(short);
|
||||||
|
sampleC->sampleAddr = (uint8_t*)pcmData;
|
||||||
|
sampleC->codec = CODEC_S16;
|
||||||
|
|
||||||
|
sampleC->loop = new AdpcmLoop;
|
||||||
|
sampleC->loop->start = 0;
|
||||||
|
sampleC->loop->end = sampleC->size;
|
||||||
|
sampleC->loop->count = 0;
|
||||||
|
sampleC->sampleRateMagicValue = 'RIFF';
|
||||||
|
sampleC->sampleRate = mp3Info.sampleRate;
|
||||||
|
|
||||||
|
cachedCustomSFs[path] = sampleC;
|
||||||
|
return sampleC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
18
soh/soh/resource/importer/AudioSampleFactory.h
Normal file
18
soh/soh/resource/importer/AudioSampleFactory.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class AudioSampleFactory : public ResourceFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class AudioSampleFactoryV0 : public ResourceVersionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
54
soh/soh/resource/importer/AudioSequenceFactory.cpp
Normal file
54
soh/soh/resource/importer/AudioSequenceFactory.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include "soh/resource/importer/AudioSequenceFactory.h"
|
||||||
|
#include "soh/resource/type/AudioSequence.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<AudioSequence>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
factory = std::make_shared<AudioSequenceFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load AudioSequence with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
||||||
|
|
||||||
|
audioSequence->sequence.seqDataSize = reader->ReadInt32();
|
||||||
|
audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize);
|
||||||
|
for (uint32_t i = 0; i < audioSequence->sequence.seqDataSize; i++) {
|
||||||
|
audioSequence->sequenceData.push_back(reader->ReadChar());
|
||||||
|
}
|
||||||
|
audioSequence->sequence.seqData = audioSequence->sequenceData.data();
|
||||||
|
|
||||||
|
audioSequence->sequence.seqNumber = reader->ReadUByte();
|
||||||
|
audioSequence->sequence.medium = reader->ReadUByte();
|
||||||
|
audioSequence->sequence.cachePolicy = reader->ReadUByte();
|
||||||
|
|
||||||
|
audioSequence->sequence.numFonts = reader->ReadUInt32();
|
||||||
|
for (uint32_t i = 0; i < 16; i++) {
|
||||||
|
audioSequence->sequence.fonts[i] = 0;
|
||||||
|
}
|
||||||
|
for (uint32_t i = 0; i < audioSequence->sequence.numFonts; i++) {
|
||||||
|
audioSequence->sequence.fonts[i] = reader->ReadUByte();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
18
soh/soh/resource/importer/AudioSequenceFactory.h
Normal file
18
soh/soh/resource/importer/AudioSequenceFactory.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class AudioSequenceFactory : public ResourceFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class AudioSequenceFactoryV0 : public ResourceVersionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
187
soh/soh/resource/importer/AudioSoundFontFactory.cpp
Normal file
187
soh/soh/resource/importer/AudioSoundFontFactory.cpp
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
#include "soh/resource/importer/AudioSoundFontFactory.h"
|
||||||
|
#include "soh/resource/type/AudioSoundFont.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
#include "libultraship/bridge.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<AudioSoundFont>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
||||||
|
|
||||||
|
audioSoundFont->soundFont.fntIndex = reader->ReadInt32();
|
||||||
|
audioSoundFont->medium = reader->ReadInt8();
|
||||||
|
audioSoundFont->cachePolicy = reader->ReadInt8();
|
||||||
|
|
||||||
|
audioSoundFont->data1 = reader->ReadUInt16();
|
||||||
|
audioSoundFont->soundFont.sampleBankId1 = audioSoundFont->data1 >> 8;
|
||||||
|
audioSoundFont->soundFont.sampleBankId2 = audioSoundFont->data1 & 0xFF;
|
||||||
|
|
||||||
|
audioSoundFont->data2 = reader->ReadUInt16();
|
||||||
|
audioSoundFont->data3 = reader->ReadUInt16();
|
||||||
|
|
||||||
|
uint32_t drumCount = reader->ReadUInt32();
|
||||||
|
audioSoundFont->soundFont.numDrums = drumCount;
|
||||||
|
|
||||||
|
uint32_t instrumentCount = reader->ReadUInt32();
|
||||||
|
audioSoundFont->soundFont.numInstruments = instrumentCount;
|
||||||
|
|
||||||
|
uint32_t soundEffectCount = reader->ReadUInt32();
|
||||||
|
audioSoundFont->soundFont.numSfx = soundEffectCount;
|
||||||
|
|
||||||
|
// 🥁 DRUMS 🥁
|
||||||
|
audioSoundFont->drums.reserve(audioSoundFont->soundFont.numDrums);
|
||||||
|
audioSoundFont->drumAddresses.reserve(audioSoundFont->soundFont.numDrums);
|
||||||
|
for (uint32_t i = 0; i < audioSoundFont->soundFont.numDrums; i++) {
|
||||||
|
Drum drum;
|
||||||
|
drum.releaseRate = reader->ReadUByte();
|
||||||
|
drum.pan = reader->ReadUByte();
|
||||||
|
drum.loaded = reader->ReadUByte();
|
||||||
|
drum.loaded = 0; // this was always getting set to zero in ResourceMgr_LoadAudioSoundFont
|
||||||
|
|
||||||
|
uint32_t envelopeCount = reader->ReadUInt32();
|
||||||
|
audioSoundFont->drumEnvelopeCounts.push_back(envelopeCount);
|
||||||
|
std::vector<AdsrEnvelope> drumEnvelopes;
|
||||||
|
drumEnvelopes.reserve(audioSoundFont->drumEnvelopeCounts[i]);
|
||||||
|
for (uint32_t j = 0; j < audioSoundFont->drumEnvelopeCounts.back(); j++) {
|
||||||
|
AdsrEnvelope env;
|
||||||
|
|
||||||
|
int16_t delay = reader->ReadInt16();
|
||||||
|
int16_t arg = reader->ReadInt16();
|
||||||
|
|
||||||
|
env.delay = BE16SWAP(delay);
|
||||||
|
env.arg = BE16SWAP(arg);
|
||||||
|
|
||||||
|
drumEnvelopes.push_back(env);
|
||||||
|
}
|
||||||
|
audioSoundFont->drumEnvelopeArrays.push_back(drumEnvelopes);
|
||||||
|
drum.envelope = audioSoundFont->drumEnvelopeArrays.back().data();
|
||||||
|
|
||||||
|
bool hasSample = reader->ReadInt8();
|
||||||
|
std::string sampleFileName = reader->ReadString();
|
||||||
|
drum.sound.tuning = reader->ReadFloat();
|
||||||
|
|
||||||
|
if (sampleFileName.empty()) {
|
||||||
|
drum.sound.sample = nullptr;
|
||||||
|
} else {
|
||||||
|
drum.sound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
audioSoundFont->drums.push_back(drum);
|
||||||
|
audioSoundFont->drumAddresses.push_back(&audioSoundFont->drums.back());
|
||||||
|
}
|
||||||
|
audioSoundFont->soundFont.drums = audioSoundFont->drumAddresses.data();
|
||||||
|
|
||||||
|
// 🎺🎻🎷🎸🎹 INSTRUMENTS 🎹🎸🎷🎻🎺
|
||||||
|
audioSoundFont->instruments.reserve(audioSoundFont->soundFont.numInstruments);
|
||||||
|
for (uint32_t i = 0; i < audioSoundFont->soundFont.numInstruments; i++) {
|
||||||
|
Instrument instrument;
|
||||||
|
|
||||||
|
uint8_t isValidEntry = reader->ReadUByte();
|
||||||
|
instrument.loaded = reader->ReadUByte();
|
||||||
|
instrument.loaded = 0; // this was always getting set to zero in ResourceMgr_LoadAudioSoundFont
|
||||||
|
|
||||||
|
instrument.normalRangeLo = reader->ReadUByte();
|
||||||
|
instrument.normalRangeHi = reader->ReadUByte();
|
||||||
|
instrument.releaseRate = reader->ReadUByte();
|
||||||
|
|
||||||
|
uint32_t envelopeCount = reader->ReadInt32();
|
||||||
|
audioSoundFont->instrumentEnvelopeCounts.push_back(envelopeCount);
|
||||||
|
std::vector<AdsrEnvelope> instrumentEnvelopes;
|
||||||
|
for (uint32_t j = 0; j < audioSoundFont->instrumentEnvelopeCounts.back(); j++) {
|
||||||
|
AdsrEnvelope env;
|
||||||
|
|
||||||
|
int16_t delay = reader->ReadInt16();
|
||||||
|
int16_t arg = reader->ReadInt16();
|
||||||
|
|
||||||
|
env.delay = BE16SWAP(delay);
|
||||||
|
env.arg = BE16SWAP(arg);
|
||||||
|
|
||||||
|
instrumentEnvelopes.push_back(env);
|
||||||
|
}
|
||||||
|
audioSoundFont->instrumentEnvelopeArrays.push_back(instrumentEnvelopes);
|
||||||
|
instrument.envelope = audioSoundFont->instrumentEnvelopeArrays.back().data();
|
||||||
|
|
||||||
|
bool hasLowNoteSoundFontEntry = reader->ReadInt8();
|
||||||
|
if (hasLowNoteSoundFontEntry) {
|
||||||
|
bool hasSampleRef = reader->ReadInt8();
|
||||||
|
std::string sampleFileName = reader->ReadString();
|
||||||
|
instrument.lowNotesSound.tuning = reader->ReadFloat();
|
||||||
|
instrument.lowNotesSound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
|
||||||
|
} else {
|
||||||
|
instrument.lowNotesSound.sample = nullptr;
|
||||||
|
instrument.lowNotesSound.tuning = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasNormalNoteSoundFontEntry = reader->ReadInt8();
|
||||||
|
if (hasNormalNoteSoundFontEntry) {
|
||||||
|
bool hasSampleRef = reader->ReadInt8();
|
||||||
|
std::string sampleFileName = reader->ReadString();
|
||||||
|
instrument.normalNotesSound.tuning = reader->ReadFloat();
|
||||||
|
instrument.normalNotesSound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
|
||||||
|
} else {
|
||||||
|
instrument.normalNotesSound.sample = nullptr;
|
||||||
|
instrument.normalNotesSound.tuning = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasHighNoteSoundFontEntry = reader->ReadInt8();
|
||||||
|
if (hasHighNoteSoundFontEntry) {
|
||||||
|
bool hasSampleRef = reader->ReadInt8();
|
||||||
|
std::string sampleFileName = reader->ReadString();
|
||||||
|
instrument.highNotesSound.tuning = reader->ReadFloat();
|
||||||
|
instrument.highNotesSound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
|
||||||
|
} else {
|
||||||
|
instrument.highNotesSound.sample = nullptr;
|
||||||
|
instrument.highNotesSound.tuning = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
audioSoundFont->instruments.push_back(instrument);
|
||||||
|
audioSoundFont->instrumentAddresses.push_back(isValidEntry ?
|
||||||
|
&audioSoundFont->instruments.back() :
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
audioSoundFont->soundFont.instruments = audioSoundFont->instrumentAddresses.data();
|
||||||
|
|
||||||
|
// 🔊 SOUND EFFECTS 🔊
|
||||||
|
audioSoundFont->soundEffects.reserve(audioSoundFont->soundFont.numSfx);
|
||||||
|
for (uint32_t i = 0; i < audioSoundFont->soundFont.numSfx; i++) {
|
||||||
|
SoundFontSound soundEffect;
|
||||||
|
|
||||||
|
bool hasSFEntry = reader->ReadInt8();
|
||||||
|
if (hasSFEntry) {
|
||||||
|
bool hasSampleRef = reader->ReadInt8();
|
||||||
|
std::string sampleFileName = reader->ReadString();
|
||||||
|
soundEffect.tuning = reader->ReadFloat();
|
||||||
|
soundEffect.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
audioSoundFont->soundEffects.push_back(soundEffect);
|
||||||
|
}
|
||||||
|
audioSoundFont->soundFont.soundEffects = audioSoundFont->soundEffects.data();
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
18
soh/soh/resource/importer/AudioSoundFontFactory.h
Normal file
18
soh/soh/resource/importer/AudioSoundFontFactory.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class AudioSoundFontFactory : public ResourceFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class AudioSoundFontFactoryV0 : public ResourceVersionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
38
soh/soh/resource/importer/BackgroundFactory.cpp
Normal file
38
soh/soh/resource/importer/BackgroundFactory.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "soh/resource/importer/BackgroundFactory.h"
|
||||||
|
#include "soh/resource/type/Background.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> BackgroundFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader) {
|
||||||
|
auto resource = std::make_shared<Background>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version) {
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<BackgroundFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr) {
|
||||||
|
SPDLOG_ERROR("Failed to load Background with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) {
|
||||||
|
std::shared_ptr<Background> background = std::static_pointer_cast<Background>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, background);
|
||||||
|
|
||||||
|
uint32_t dataSize = reader->ReadUInt32();
|
||||||
|
|
||||||
|
background->Data.reserve(dataSize);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < dataSize; i++) {
|
||||||
|
background->Data.push_back(reader->ReadUByte());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
16
soh/soh/resource/importer/BackgroundFactory.h
Normal file
16
soh/soh/resource/importer/BackgroundFactory.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "resource/Resource.h"
|
||||||
|
#include "resource/ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class BackgroundFactory : public ResourceFactory {
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class BackgroundFactoryV0 : public ResourceVersionFactory {
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
144
soh/soh/resource/importer/CollisionHeaderFactory.cpp
Normal file
144
soh/soh/resource/importer/CollisionHeaderFactory.cpp
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
#include "soh/resource/importer/CollisionHeaderFactory.h"
|
||||||
|
#include "soh/resource/type/CollisionHeader.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<CollisionHeader>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load Collision Header with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
||||||
|
|
||||||
|
collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16();
|
||||||
|
collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16();
|
||||||
|
collisionHeader->collisionHeaderData.minBounds.z = reader->ReadInt16();
|
||||||
|
|
||||||
|
collisionHeader->collisionHeaderData.maxBounds.x = reader->ReadInt16();
|
||||||
|
collisionHeader->collisionHeaderData.maxBounds.y = reader->ReadInt16();
|
||||||
|
collisionHeader->collisionHeaderData.maxBounds.z = reader->ReadInt16();
|
||||||
|
|
||||||
|
collisionHeader->collisionHeaderData.numVertices = reader->ReadInt32();
|
||||||
|
collisionHeader->vertices.reserve(collisionHeader->collisionHeaderData.numVertices);
|
||||||
|
for (int32_t i = 0; i < collisionHeader->collisionHeaderData.numVertices; i++) {
|
||||||
|
Vec3s vtx;
|
||||||
|
vtx.x = reader->ReadInt16();
|
||||||
|
vtx.y = reader->ReadInt16();
|
||||||
|
vtx.z = reader->ReadInt16();
|
||||||
|
collisionHeader->vertices.push_back(vtx);
|
||||||
|
}
|
||||||
|
collisionHeader->collisionHeaderData.vtxList = collisionHeader->vertices.data();
|
||||||
|
|
||||||
|
collisionHeader->collisionHeaderData.numPolygons = reader->ReadUInt32();
|
||||||
|
collisionHeader->polygons.reserve(collisionHeader->collisionHeaderData.numPolygons);
|
||||||
|
for (uint32_t i = 0; i < collisionHeader->collisionHeaderData.numPolygons; i++) {
|
||||||
|
CollisionPoly polygon;
|
||||||
|
|
||||||
|
polygon.type = reader->ReadUInt16();
|
||||||
|
|
||||||
|
polygon.flags_vIA = reader->ReadUInt16();
|
||||||
|
polygon.flags_vIB = reader->ReadUInt16();
|
||||||
|
polygon.vIC = reader->ReadUInt16();
|
||||||
|
|
||||||
|
polygon.normal.x = reader->ReadUInt16();
|
||||||
|
polygon.normal.y = reader->ReadUInt16();
|
||||||
|
polygon.normal.z = reader->ReadUInt16();
|
||||||
|
|
||||||
|
polygon.dist = reader->ReadUInt16();
|
||||||
|
|
||||||
|
collisionHeader->polygons.push_back(polygon);
|
||||||
|
|
||||||
|
}
|
||||||
|
collisionHeader->collisionHeaderData.polyList = collisionHeader->polygons.data();
|
||||||
|
|
||||||
|
collisionHeader->surfaceTypesCount = reader->ReadUInt32();
|
||||||
|
collisionHeader->surfaceTypes.reserve(collisionHeader->surfaceTypesCount);
|
||||||
|
for (uint32_t i = 0; i < collisionHeader->surfaceTypesCount; i++) {
|
||||||
|
SurfaceType surfaceType;
|
||||||
|
|
||||||
|
surfaceType.data[1] = reader->ReadUInt32();
|
||||||
|
surfaceType.data[0] = reader->ReadUInt32();
|
||||||
|
|
||||||
|
collisionHeader->surfaceTypes.push_back(surfaceType);
|
||||||
|
}
|
||||||
|
collisionHeader->collisionHeaderData.surfaceTypeList = collisionHeader->surfaceTypes.data();
|
||||||
|
|
||||||
|
collisionHeader->camDataCount = reader->ReadUInt32();
|
||||||
|
collisionHeader->camData.reserve(collisionHeader->camDataCount);
|
||||||
|
collisionHeader->camPosDataIndices.reserve(collisionHeader->camDataCount);
|
||||||
|
for (uint32_t i = 0; i < collisionHeader->camDataCount; i++) {
|
||||||
|
CamData camDataEntry;
|
||||||
|
camDataEntry.cameraSType = reader->ReadUInt16();
|
||||||
|
camDataEntry.numCameras = reader->ReadInt16();
|
||||||
|
collisionHeader->camData.push_back(camDataEntry);
|
||||||
|
|
||||||
|
int32_t camPosDataIdx = reader->ReadInt32();
|
||||||
|
collisionHeader->camPosDataIndices.push_back(camPosDataIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
collisionHeader->camPosCount = reader->ReadInt32();
|
||||||
|
collisionHeader->camPosData.reserve(collisionHeader->camPosCount);
|
||||||
|
for (int32_t i = 0; i < collisionHeader->camPosCount; i++) {
|
||||||
|
Vec3s pos;
|
||||||
|
pos.x = reader->ReadInt16();
|
||||||
|
pos.y = reader->ReadInt16();
|
||||||
|
pos.z = reader->ReadInt16();
|
||||||
|
collisionHeader->camPosData.push_back(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec3s zero;
|
||||||
|
zero.x = 0;
|
||||||
|
zero.y = 0;
|
||||||
|
zero.z = 0;
|
||||||
|
collisionHeader->camPosDataZero = zero;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < collisionHeader->camDataCount; i++) {
|
||||||
|
int32_t idx = collisionHeader->camPosDataIndices[i];
|
||||||
|
|
||||||
|
if (collisionHeader->camPosCount > 0) {
|
||||||
|
collisionHeader->camData[i].camPosData = &collisionHeader->camPosData[idx];
|
||||||
|
} else {
|
||||||
|
collisionHeader->camData[i].camPosData = &collisionHeader->camPosDataZero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
collisionHeader->collisionHeaderData.cameraDataList = collisionHeader->camData.data();
|
||||||
|
collisionHeader->collisionHeaderData.cameraDataListLen = collisionHeader->camDataCount;
|
||||||
|
|
||||||
|
collisionHeader->collisionHeaderData.numWaterBoxes = reader->ReadInt32();
|
||||||
|
collisionHeader->waterBoxes.reserve(collisionHeader->collisionHeaderData.numWaterBoxes);
|
||||||
|
for (int32_t i = 0; i < collisionHeader->collisionHeaderData.numWaterBoxes; i++) {
|
||||||
|
WaterBox waterBox;
|
||||||
|
waterBox.xMin = reader->ReadInt16();
|
||||||
|
waterBox.ySurface = reader->ReadInt16();
|
||||||
|
waterBox.zMin = reader->ReadInt16();
|
||||||
|
waterBox.xLength = reader->ReadInt16();
|
||||||
|
waterBox.zLength = reader->ReadInt16();
|
||||||
|
waterBox.properties = reader->ReadInt32();
|
||||||
|
|
||||||
|
collisionHeader->waterBoxes.push_back(waterBox);
|
||||||
|
}
|
||||||
|
collisionHeader->collisionHeaderData.waterBoxes = collisionHeader->waterBoxes.data();
|
||||||
|
}
|
||||||
|
}
|
16
soh/soh/resource/importer/CollisionHeaderFactory.h
Normal file
16
soh/soh/resource/importer/CollisionHeaderFactory.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class CollisionHeaderFactory : public ResourceFactory {
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CollisionHeaderFactoryV0 : public ResourceVersionFactory {
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
473
soh/soh/resource/importer/CutsceneFactory.cpp
Normal file
473
soh/soh/resource/importer/CutsceneFactory.cpp
Normal file
@ -0,0 +1,473 @@
|
|||||||
|
#include "soh/resource/importer/CutsceneFactory.h"
|
||||||
|
#include "soh/resource/type/Cutscene.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> CutsceneFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<Cutscene>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<CutsceneFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load Cutscene with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t read_CMD_BBBB(std::shared_ptr<BinaryReader> reader) {
|
||||||
|
uint32_t v;
|
||||||
|
reader->Read((char*)&v, sizeof(uint32_t));
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t read_CMD_BBH(std::shared_ptr<BinaryReader> reader) {
|
||||||
|
uint32_t v;
|
||||||
|
reader->Read((char*)&v, sizeof(uint32_t));
|
||||||
|
|
||||||
|
// swap the half word to match endianness
|
||||||
|
if (reader->GetEndianness() != Ship::Endianness::Native) {
|
||||||
|
uint8_t* b = (uint8_t*)&v;
|
||||||
|
uint8_t tmp = b[2];
|
||||||
|
b[2] = b[3];
|
||||||
|
b[3] = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t read_CMD_HBB(std::shared_ptr<BinaryReader> reader) {
|
||||||
|
uint32_t v;
|
||||||
|
reader->Read((char*)&v, sizeof(uint32_t));
|
||||||
|
|
||||||
|
// swap the half word to match endianness
|
||||||
|
if (reader->GetEndianness() != Ship::Endianness::Native) {
|
||||||
|
uint8_t* b = (uint8_t*)&v;
|
||||||
|
uint8_t tmp = b[0];
|
||||||
|
b[0] = b[1];
|
||||||
|
b[1] = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t read_CMD_HH(std::shared_ptr<BinaryReader> reader) {
|
||||||
|
uint32_t v;
|
||||||
|
reader->Read((char*)&v, sizeof(uint32_t));
|
||||||
|
|
||||||
|
// swap the half words to match endianness
|
||||||
|
if (reader->GetEndianness() != Ship::Endianness::Native) {
|
||||||
|
uint8_t* b = (uint8_t*)&v;
|
||||||
|
uint8_t tmp = b[0];
|
||||||
|
b[0] = b[1];
|
||||||
|
b[1] = tmp;
|
||||||
|
tmp = b[2];
|
||||||
|
b[2] = b[3];
|
||||||
|
b[3] = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
||||||
|
|
||||||
|
uint32_t numEntries = reader->ReadUInt32();
|
||||||
|
cutscene->commands.reserve(numEntries);
|
||||||
|
|
||||||
|
cutscene->numCommands = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(cutscene->numCommands);
|
||||||
|
|
||||||
|
cutscene->endFrame = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(cutscene->endFrame);
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
uint32_t commandId = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(commandId);
|
||||||
|
|
||||||
|
switch (commandId) {
|
||||||
|
case (uint32_t)CutsceneCommands::SetCameraPos: {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
uint32_t val = read_CMD_BBH(reader);
|
||||||
|
int8_t continueFlag = ((int8_t*)&val)[0];
|
||||||
|
|
||||||
|
cutscene->commands.push_back(val);
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
if (continueFlag == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case (uint32_t)CutsceneCommands::SetCameraFocus: {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
uint32_t val = read_CMD_BBH(reader);
|
||||||
|
int8_t continueFlag = ((int8_t*)&val)[0];
|
||||||
|
|
||||||
|
cutscene->commands.push_back(val);
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
if (continueFlag == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::SpecialAction: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::SetLighting: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::SetCameraPosLink: {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
uint32_t val = read_CMD_BBH(reader);
|
||||||
|
int8_t continueFlag = ((int8_t*)&val)[0];
|
||||||
|
|
||||||
|
cutscene->commands.push_back(val);
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
if (continueFlag == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::SetCameraFocusLink: {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
uint32_t val = read_CMD_BBH(reader);
|
||||||
|
int8_t continueFlag = ((int8_t*)&val)[0];
|
||||||
|
|
||||||
|
cutscene->commands.push_back(val);
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
|
||||||
|
if (continueFlag == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::Cmd09: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HBB(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_BBH(reader));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x15:
|
||||||
|
case (uint32_t)CutsceneCommands::Unknown: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case (uint32_t)CutsceneCommands::Textbox: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction0:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction1:
|
||||||
|
case 17:
|
||||||
|
case 18:
|
||||||
|
case 23:
|
||||||
|
case 34:
|
||||||
|
case 39:
|
||||||
|
case 46:
|
||||||
|
case 76:
|
||||||
|
case 85:
|
||||||
|
case 93:
|
||||||
|
case 105:
|
||||||
|
case 107:
|
||||||
|
case 110:
|
||||||
|
case 119:
|
||||||
|
case 123:
|
||||||
|
case 138:
|
||||||
|
case 139:
|
||||||
|
case 144:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction2:
|
||||||
|
case 16:
|
||||||
|
case 24:
|
||||||
|
case 35:
|
||||||
|
case 40:
|
||||||
|
case 48:
|
||||||
|
case 64:
|
||||||
|
case 68:
|
||||||
|
case 70:
|
||||||
|
case 78:
|
||||||
|
case 80:
|
||||||
|
case 94:
|
||||||
|
case 116:
|
||||||
|
case 118:
|
||||||
|
case 120:
|
||||||
|
case 125:
|
||||||
|
case 131:
|
||||||
|
case 141:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction3:
|
||||||
|
case 36:
|
||||||
|
case 41:
|
||||||
|
case 50:
|
||||||
|
case 67:
|
||||||
|
case 69:
|
||||||
|
case 72:
|
||||||
|
case 74:
|
||||||
|
case 81:
|
||||||
|
case 106:
|
||||||
|
case 117:
|
||||||
|
case 121:
|
||||||
|
case 126:
|
||||||
|
case 132:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction4:
|
||||||
|
case 37:
|
||||||
|
case 42:
|
||||||
|
case 51:
|
||||||
|
case 53:
|
||||||
|
case 63:
|
||||||
|
case 65:
|
||||||
|
case 66:
|
||||||
|
case 75:
|
||||||
|
case 82:
|
||||||
|
case 108:
|
||||||
|
case 127:
|
||||||
|
case 133:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction5:
|
||||||
|
case 38:
|
||||||
|
case 43:
|
||||||
|
case 47:
|
||||||
|
case 54:
|
||||||
|
case 79:
|
||||||
|
case 83:
|
||||||
|
case 128:
|
||||||
|
case 135:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction6:
|
||||||
|
case 55:
|
||||||
|
case 77:
|
||||||
|
case 84:
|
||||||
|
case 90:
|
||||||
|
case 129:
|
||||||
|
case 136:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction7:
|
||||||
|
case 52:
|
||||||
|
case 57:
|
||||||
|
case 58:
|
||||||
|
case 88:
|
||||||
|
case 115:
|
||||||
|
case 130:
|
||||||
|
case 137:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction8:
|
||||||
|
case 60:
|
||||||
|
case 89:
|
||||||
|
case 111:
|
||||||
|
case 114:
|
||||||
|
case 134:
|
||||||
|
case 142:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction9:
|
||||||
|
case (uint32_t)CutsceneCommands::SetActorAction10: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::SetSceneTransFX: {
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::PlayBGM: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::StopBGM: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::FadeBGM: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::SetTime: {
|
||||||
|
uint32_t size = reader->ReadUInt32();
|
||||||
|
cutscene->commands.push_back(size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++) {
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HBB(reader));
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (uint32_t)CutsceneCommands::Terminator: {
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
cutscene->commands.push_back(read_CMD_HH(reader));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xFFFFFFFF: // CS_END
|
||||||
|
{
|
||||||
|
cutscene->commands.push_back(reader->ReadUInt32());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
SPDLOG_TRACE("CutsceneV0: Unknown command {}\n", commandId);
|
||||||
|
// error?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
18
soh/soh/resource/importer/CutsceneFactory.h
Normal file
18
soh/soh/resource/importer/CutsceneFactory.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class CutsceneFactory : public ResourceFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CutsceneFactoryV0 : public ResourceVersionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
59
soh/soh/resource/importer/PathFactory.cpp
Normal file
59
soh/soh/resource/importer/PathFactory.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#include "soh/resource/importer/PathFactory.h"
|
||||||
|
#include "soh/resource/type/Path.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> PathFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<Path>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<PathFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load Path with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, path);
|
||||||
|
|
||||||
|
path->numPaths = reader->ReadUInt32();
|
||||||
|
path->paths.reserve(path->numPaths);
|
||||||
|
for (uint32_t k = 0; k < path->numPaths; k++) {
|
||||||
|
std::vector<Vec3s> points;
|
||||||
|
uint32_t pointCount = reader->ReadUInt32();
|
||||||
|
points.reserve(pointCount);
|
||||||
|
for (uint32_t i = 0; i < pointCount; i++) {
|
||||||
|
Vec3s point;
|
||||||
|
point.x = reader->ReadInt16();
|
||||||
|
point.y = reader->ReadInt16();
|
||||||
|
point.z = reader->ReadInt16();
|
||||||
|
|
||||||
|
points.push_back(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
PathData pathDataEntry;
|
||||||
|
pathDataEntry.count = pointCount;
|
||||||
|
|
||||||
|
path->paths.push_back(points);
|
||||||
|
pathDataEntry.points = path->paths.back().data();
|
||||||
|
|
||||||
|
path->pathData.push_back(pathDataEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
18
soh/soh/resource/importer/PathFactory.h
Normal file
18
soh/soh/resource/importer/PathFactory.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class PathFactory : public ResourceFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class PathFactoryV0 : public ResourceVersionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
42
soh/soh/resource/importer/PlayerAnimationFactory.cpp
Normal file
42
soh/soh/resource/importer/PlayerAnimationFactory.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "soh/resource/importer/PlayerAnimationFactory.h"
|
||||||
|
#include "soh/resource/type/PlayerAnimation.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<PlayerAnimation>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
||||||
|
|
||||||
|
uint32_t numEntries = reader->ReadUInt32();
|
||||||
|
playerAnimation->limbRotData.reserve(numEntries);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < numEntries; i++) {
|
||||||
|
playerAnimation->limbRotData.push_back(reader->ReadInt16());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
16
soh/soh/resource/importer/PlayerAnimationFactory.h
Normal file
16
soh/soh/resource/importer/PlayerAnimationFactory.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class PlayerAnimationFactory : public ResourceFactory {
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class PlayerAnimationFactoryV0 : public ResourceVersionFactory {
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
118
soh/soh/resource/importer/SceneFactory.cpp
Normal file
118
soh/soh/resource/importer/SceneFactory.cpp
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
#include "soh/resource/importer/SceneFactory.h"
|
||||||
|
#include "soh/resource/type/Scene.h"
|
||||||
|
#include "soh/resource/type/scenecommand/SceneCommand.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetLightingSettingsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetWindSettingsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetExitListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetTimeSettingsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetEchoSettingsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetSoundSettingsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetCsCameraFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetCameraSettingsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetRoomListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetEntranceListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetObjectListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetStartPositionListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetActorListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetTransitionActorListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/EndMarkerFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetPathwaysFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetCutscenesFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetLightListFactory.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SetMeshFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
|
||||||
|
std::shared_ptr<Resource> SceneFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
if (SceneFactory::sceneCommandFactories.empty()) {
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetTimeSettings] = std::make_shared<SetTimeSettingsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxModifier] = std::make_shared<SetSkyboxModifierFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetEchoSettings] = std::make_shared<SetEchoSettingsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxSettings] = std::make_shared<SetSkyboxSettingsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetRoomBehavior] = std::make_shared<SetRoomBehaviorFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCsCamera] = std::make_shared<SetCsCameraFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCameraSettings] = std::make_shared<SetCameraSettingsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetRoomList] = std::make_shared<SetRoomListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCollisionHeader] = std::make_shared<SetCollisionHeaderFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetEntranceList] = std::make_shared<SetEntranceListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSpecialObjects] = std::make_shared<SetSpecialObjectsFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetObjectList] = std::make_shared<SetObjectListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetStartPositionList] = std::make_shared<SetStartPositionListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetActorList] = std::make_shared<SetActorListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetTransitionActorList] = std::make_shared<SetTransitionActorListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::EndMarker] = std::make_shared<EndMarkerFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetAlternateHeaders] = std::make_shared<SetAlternateHeadersFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetPathways] = std::make_shared<SetPathwaysFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCutscenes] = std::make_shared<SetCutscenesFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetLightList] = std::make_shared<SetLightListFactory>();
|
||||||
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto resource = std::make_shared<Scene>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
resource->ResourceVersion = version;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<SceneFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load Scene with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
||||||
|
|
||||||
|
uint32_t commandCount = reader->ReadUInt32();
|
||||||
|
scene->commands.reserve(commandCount);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < commandCount; i++) {
|
||||||
|
scene->commands.push_back(ParseSceneCommand(resource->ResourceVersion, reader));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<SceneCommand> SceneFactoryV0::ParseSceneCommand(uint32_t version, std::shared_ptr<BinaryReader> reader) {
|
||||||
|
SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32();
|
||||||
|
|
||||||
|
reader->Seek(-sizeof(int32_t), SeekOffsetType::Current);
|
||||||
|
|
||||||
|
std::shared_ptr<SceneCommand> result = nullptr;
|
||||||
|
std::shared_ptr<SceneCommandFactory> commandFactory = SceneFactory::sceneCommandFactories[cmdID];
|
||||||
|
|
||||||
|
if (commandFactory != nullptr) {
|
||||||
|
result = std::static_pointer_cast<SceneCommand>(commandFactory->ReadResource(version, reader));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == nullptr) {
|
||||||
|
SPDLOG_ERROR("Failed to load scene command of type {}", (uint32_t)cmdID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Ship
|
26
soh/soh/resource/importer/SceneFactory.h
Normal file
26
soh/soh/resource/importer/SceneFactory.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "soh/resource/type/Scene.h"
|
||||||
|
#include "soh/resource/type/scenecommand/SceneCommand.h"
|
||||||
|
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class SceneFactory : public ResourceFactory {
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
|
||||||
|
// Doing something very similar to what we do on the ResourceLoader.
|
||||||
|
// Eventually, scene commands should be moved up to the ResourceLoader as well.
|
||||||
|
// They can not right now because the exporter does not give them a proper resource type enum value,
|
||||||
|
// and the exporter does not export the commands with a proper OTR header.
|
||||||
|
static inline std::unordered_map<SceneCommandID, std::shared_ptr<SceneCommandFactory>> sceneCommandFactories;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SceneFactoryV0 : public ResourceVersionFactory {
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
std::shared_ptr<SceneCommand> ParseSceneCommand(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
81
soh/soh/resource/importer/SkeletonFactory.cpp
Normal file
81
soh/soh/resource/importer/SkeletonFactory.cpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#include "soh/resource/importer/SkeletonFactory.h"
|
||||||
|
#include "soh/resource/type/Skeleton.h"
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> SkeletonFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<Skeleton>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<SkeletonFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load Skeleton with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Skeleton> skeleton = std::static_pointer_cast<Skeleton>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, skeleton);
|
||||||
|
|
||||||
|
skeleton->type = (SkeletonType)reader->ReadInt8();
|
||||||
|
skeleton->limbType = (LimbType)reader->ReadInt8();
|
||||||
|
skeleton->limbCount = reader->ReadUInt32();
|
||||||
|
skeleton->dListCount = reader->ReadUInt32();
|
||||||
|
skeleton->limbTableType = (LimbType)reader->ReadInt8();
|
||||||
|
skeleton->limbTableCount = reader->ReadUInt32();
|
||||||
|
|
||||||
|
skeleton->limbTable.reserve(skeleton->limbTableCount);
|
||||||
|
for (uint32_t i = 0; i < skeleton->limbTableCount; i++) {
|
||||||
|
std::string limbPath = reader->ReadString();
|
||||||
|
|
||||||
|
skeleton->limbTable.push_back(limbPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skeleton->type == Ship::SkeletonType::Curve) {
|
||||||
|
skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount;
|
||||||
|
skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount);
|
||||||
|
} else if (skeleton->type == Ship::SkeletonType::Flex) {
|
||||||
|
skeleton->skeletonData.flexSkeletonHeader.dListCount = skeleton->dListCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skeleton->type == Ship::SkeletonType::Normal) {
|
||||||
|
skeleton->skeletonData.skeletonHeader.limbCount = skeleton->limbCount;
|
||||||
|
skeleton->standardLimbArray.reserve(skeleton->skeletonData.skeletonHeader.limbCount);
|
||||||
|
} else if (skeleton->type == Ship::SkeletonType::Flex) {
|
||||||
|
skeleton->skeletonData.flexSkeletonHeader.sh.limbCount = skeleton->limbCount;
|
||||||
|
skeleton->standardLimbArray.reserve(skeleton->skeletonData.flexSkeletonHeader.sh.limbCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < skeleton->limbTable.size(); i++) {
|
||||||
|
std::string limbStr = skeleton->limbTable[i];
|
||||||
|
auto limb = GetResourceDataByName(limbStr.c_str(), true);
|
||||||
|
skeleton->skeletonHeaderSegments.push_back(limb);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skeleton->type == Ship::SkeletonType::Normal) {
|
||||||
|
skeleton->skeletonData.skeletonHeader.segment = (void**)skeleton->skeletonHeaderSegments.data();
|
||||||
|
} else if (skeleton->type == Ship::SkeletonType::Flex) {
|
||||||
|
skeleton->skeletonData.flexSkeletonHeader.sh.segment = (void**)skeleton->skeletonHeaderSegments.data();
|
||||||
|
} else if (skeleton->type == Ship::SkeletonType::Curve) {
|
||||||
|
skeleton->skeletonData.skelCurveLimbList.limbs = (SkelCurveLimb**)skeleton->skeletonHeaderSegments.data();
|
||||||
|
} else {
|
||||||
|
SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
18
soh/soh/resource/importer/SkeletonFactory.h
Normal file
18
soh/soh/resource/importer/SkeletonFactory.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Resource.h"
|
||||||
|
#include "ResourceFactory.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
class SkeletonFactory : public ResourceFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
class SkeletonFactoryV0 : public ResourceVersionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
||||||
|
};
|
||||||
|
}; // namespace Ship
|
195
soh/soh/resource/importer/SkeletonLimbFactory.cpp
Normal file
195
soh/soh/resource/importer/SkeletonLimbFactory.cpp
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
#include "soh/resource/importer/SkeletonLimbFactory.h"
|
||||||
|
#include "soh/resource/type/SkeletonLimb.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
#include "libultraship/bridge.h"
|
||||||
|
|
||||||
|
namespace Ship {
|
||||||
|
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
||||||
|
{
|
||||||
|
auto resource = std::make_shared<SkeletonLimb>();
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factory == nullptr)
|
||||||
|
{
|
||||||
|
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", version);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
|
std::shared_ptr<Resource> resource)
|
||||||
|
{
|
||||||
|
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||||
|
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
||||||
|
|
||||||
|
skeletonLimb->limbType = (LimbType)reader->ReadInt8();
|
||||||
|
skeletonLimb->skinSegmentType = (ZLimbSkinType)reader->ReadInt8();
|
||||||
|
skeletonLimb->skinDList = reader->ReadString();
|
||||||
|
|
||||||
|
skeletonLimb->skinVtxCnt = reader->ReadUInt16();
|
||||||
|
|
||||||
|
skeletonLimb->skinLimbModifCount = reader->ReadUInt32();
|
||||||
|
skeletonLimb->skinLimbModifArray.reserve(skeletonLimb->skinLimbModifCount);
|
||||||
|
skeletonLimb->skinLimbModifVertexArrays.reserve(skeletonLimb->skinLimbModifCount);
|
||||||
|
skeletonLimb->skinLimbModifTransformationArrays.reserve(skeletonLimb->skinLimbModifCount);
|
||||||
|
for (size_t i = 0; i < skeletonLimb->skinLimbModifCount; i++) {
|
||||||
|
SkinLimbModif skinLimbModif;
|
||||||
|
skinLimbModif.unk_4 = reader->ReadUInt16();
|
||||||
|
skeletonLimb->skinLimbModifArray.push_back(skinLimbModif);
|
||||||
|
|
||||||
|
std::vector<SkinVertex> skinVertexArray;
|
||||||
|
int32_t skinVertexCount = reader->ReadInt32();
|
||||||
|
skinVertexArray.reserve(skinVertexCount);
|
||||||
|
for (int32_t k = 0; k < skinVertexCount; k++) {
|
||||||
|
SkinVertex skinVertex;
|
||||||
|
|
||||||
|
skinVertex.index = reader->ReadInt16();
|
||||||
|
skinVertex.s = reader->ReadInt16();
|
||||||
|
skinVertex.t = reader->ReadInt16();
|
||||||
|
skinVertex.normX = reader->ReadInt8();
|
||||||
|
skinVertex.normY = reader->ReadInt8();
|
||||||
|
skinVertex.normZ = reader->ReadInt8();
|
||||||
|
skinVertex.alpha = reader->ReadUByte();
|
||||||
|
|
||||||
|
skinVertexArray.push_back(skinVertex);
|
||||||
|
}
|
||||||
|
skeletonLimb->skinLimbModifVertexArrays.push_back(skinVertexArray);
|
||||||
|
|
||||||
|
std::vector<SkinTransformation> skinTransformationArray;
|
||||||
|
int32_t skinTransformationCount = reader->ReadInt32();
|
||||||
|
skinTransformationArray.reserve(skinTransformationCount);
|
||||||
|
for (int32_t k = 0; k < skinTransformationCount; k++) {
|
||||||
|
SkinTransformation skinTransformation;
|
||||||
|
|
||||||
|
skinTransformation.limbIndex = reader->ReadUByte();
|
||||||
|
skinTransformation.x = reader->ReadInt16();
|
||||||
|
skinTransformation.y = reader->ReadInt16();
|
||||||
|
skinTransformation.z = reader->ReadInt16();
|
||||||
|
skinTransformation.scale = reader->ReadUByte();
|
||||||
|
|
||||||
|
skinTransformationArray.push_back(skinTransformation);
|
||||||
|
}
|
||||||
|
skeletonLimb->skinLimbModifTransformationArrays.push_back(skinTransformationArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
skeletonLimb->skinDList2 = reader->ReadString();
|
||||||
|
|
||||||
|
skeletonLimb->legTransX = reader->ReadFloat();
|
||||||
|
skeletonLimb->legTransY = reader->ReadFloat();
|
||||||
|
skeletonLimb->legTransZ = reader->ReadFloat();
|
||||||
|
|
||||||
|
skeletonLimb->rotX = reader->ReadUInt16();
|
||||||
|
skeletonLimb->rotY = reader->ReadUInt16();
|
||||||
|
skeletonLimb->rotZ = reader->ReadUInt16();
|
||||||
|
|
||||||
|
skeletonLimb->childPtr = reader->ReadString();
|
||||||
|
skeletonLimb->siblingPtr = reader->ReadString();
|
||||||
|
skeletonLimb->dListPtr = reader->ReadString();
|
||||||
|
skeletonLimb->dList2Ptr = reader->ReadString();
|
||||||
|
|
||||||
|
skeletonLimb->transX = reader->ReadInt16();
|
||||||
|
skeletonLimb->transY = reader->ReadInt16();
|
||||||
|
skeletonLimb->transZ = reader->ReadInt16();
|
||||||
|
|
||||||
|
skeletonLimb->childIndex = reader->ReadUByte();
|
||||||
|
skeletonLimb->siblingIndex = reader->ReadUByte();
|
||||||
|
|
||||||
|
if (skeletonLimb->limbType == Ship::LimbType::LOD) {
|
||||||
|
skeletonLimb->limbData.lodLimb.jointPos.x = skeletonLimb->transX;
|
||||||
|
skeletonLimb->limbData.lodLimb.jointPos.y = skeletonLimb->transY;
|
||||||
|
skeletonLimb->limbData.lodLimb.jointPos.z = skeletonLimb->transZ;
|
||||||
|
skeletonLimb->limbData.lodLimb.child = skeletonLimb->childIndex;
|
||||||
|
skeletonLimb->limbData.lodLimb.sibling = skeletonLimb->siblingIndex;
|
||||||
|
|
||||||
|
if (skeletonLimb->dListPtr != "") {
|
||||||
|
auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true);
|
||||||
|
skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)dList;
|
||||||
|
} else {
|
||||||
|
skeletonLimb->limbData.lodLimb.dLists[0] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skeletonLimb->dList2Ptr != "") {
|
||||||
|
auto dList = GetResourceDataByName(skeletonLimb->dList2Ptr.c_str(), true);
|
||||||
|
skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)dList;
|
||||||
|
} else {
|
||||||
|
skeletonLimb->limbData.lodLimb.dLists[1] = nullptr;
|
||||||
|
}
|
||||||
|
} else if (skeletonLimb->limbType == Ship::LimbType::Standard) {
|
||||||
|
skeletonLimb->limbData.standardLimb.jointPos.x = skeletonLimb->transX;
|
||||||
|
skeletonLimb->limbData.standardLimb.jointPos.y = skeletonLimb->transY;
|
||||||
|
skeletonLimb->limbData.standardLimb.jointPos.z = skeletonLimb->transZ;
|
||||||
|
skeletonLimb->limbData.standardLimb.child = skeletonLimb->childIndex;
|
||||||
|
skeletonLimb->limbData.standardLimb.sibling = skeletonLimb->siblingIndex;
|
||||||
|
skeletonLimb->limbData.standardLimb.dList = nullptr;
|
||||||
|
|
||||||
|
if (!skeletonLimb->dListPtr.empty()) {
|
||||||
|
const auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true);
|
||||||
|
skeletonLimb->limbData.standardLimb.dList = (Gfx*)dList;
|
||||||
|
}
|
||||||
|
} else if (skeletonLimb->limbType == Ship::LimbType::Curve) {
|
||||||
|
skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex;
|
||||||
|
skeletonLimb->limbData.skelCurveLimb.nextLimbIdx = skeletonLimb->siblingIndex;
|
||||||
|
skeletonLimb->limbData.skelCurveLimb.dList[0] = nullptr;
|
||||||
|
skeletonLimb->limbData.skelCurveLimb.dList[1] = nullptr;
|
||||||
|
|
||||||
|
if (!skeletonLimb->dListPtr.empty()) {
|
||||||
|
const auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true);
|
||||||
|
skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)dList;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skeletonLimb->dList2Ptr.empty()) {
|
||||||
|
const auto dList = GetResourceDataByName(skeletonLimb->dList2Ptr.c_str(), true);
|
||||||
|
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)dList;
|
||||||
|
}
|
||||||
|
} else if (skeletonLimb->limbType == Ship::LimbType::Skin) {
|
||||||
|
skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX;
|
||||||
|
skeletonLimb->limbData.skinLimb.jointPos.y = skeletonLimb->transY;
|
||||||
|
skeletonLimb->limbData.skinLimb.jointPos.z = skeletonLimb->transZ;
|
||||||
|
skeletonLimb->limbData.skinLimb.child = skeletonLimb->childIndex;
|
||||||
|
skeletonLimb->limbData.skinLimb.sibling = skeletonLimb->siblingIndex;
|
||||||
|
|
||||||
|
if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList) {
|
||||||
|
skeletonLimb->limbData.skinLimb.segmentType = static_cast<int32_t>(skeletonLimb->skinSegmentType);
|
||||||
|
} else if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) {
|
||||||
|
skeletonLimb->limbData.skinLimb.segmentType = 4;
|
||||||
|
} else if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_5) {
|
||||||
|
skeletonLimb->limbData.skinLimb.segmentType = 5;
|
||||||
|
} else {
|
||||||
|
skeletonLimb->limbData.skinLimb.segmentType = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList) {
|
||||||
|
skeletonLimb->limbData.skinLimb.segment = GetResourceDataByName(skeletonLimb->skinDList.c_str(), true);
|
||||||
|
} else if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) {
|
||||||
|
skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt;
|
||||||
|
skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount;
|
||||||
|
skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data();
|
||||||
|
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)GetResourceDataByName(skeletonLimb->skinDList2.c_str(), true);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++)
|
||||||
|
{
|
||||||
|
skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size();
|
||||||
|
skeletonLimb->skinAnimLimbData.limbModifications[i].skinVertices = skeletonLimb->skinLimbModifVertexArrays[i].data();
|
||||||
|
|
||||||
|
skeletonLimb->skinAnimLimbData.limbModifications[i].transformCount = skeletonLimb->skinLimbModifTransformationArrays[i].size();
|
||||||
|
skeletonLimb->skinAnimLimbData.limbModifications[i].limbTransformations = skeletonLimb->skinLimbModifTransformationArrays[i].data();
|
||||||
|
|
||||||
|
skeletonLimb->skinAnimLimbData.limbModifications[i].unk_4 = skeletonLimb->skinLimbModifArray[i].unk_4;
|
||||||
|
}
|
||||||
|
|
||||||
|
skeletonLimb->limbData.skinLimb.segment = &skeletonLimb->skinAnimLimbData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace Ship
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user