2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CINGAMETWEAKMANAGERBASE_HPP__
|
|
|
|
#define __URDE_CINGAMETWEAKMANAGERBASE_HPP__
|
2015-08-27 00:23:46 +00:00
|
|
|
|
|
|
|
#include <string>
|
2016-07-24 04:46:32 +00:00
|
|
|
#include <vector>
|
2015-08-27 00:23:46 +00:00
|
|
|
|
2016-07-29 17:00:23 +00:00
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
|
|
|
|
2016-07-29 17:00:23 +00:00
|
|
|
class CTweakValue
|
2016-07-24 04:46:32 +00:00
|
|
|
{
|
2016-07-29 17:00:23 +00:00
|
|
|
public:
|
|
|
|
struct Audio
|
|
|
|
{
|
2017-01-16 08:40:33 +00:00
|
|
|
float x0_fadeIn, x4_fadeOut, x8_volume;
|
|
|
|
std::string xc_fileName;
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId x1c_res;
|
2017-01-16 08:40:33 +00:00
|
|
|
Audio(float fadeIn, float fadeOut, float vol, const std::string& fileName, u32 handle)
|
2017-02-27 05:25:14 +00:00
|
|
|
: x0_fadeIn(fadeIn), x4_fadeOut(fadeOut), x8_volume(vol), xc_fileName(fileName), x1c_res(handle) {}
|
2017-01-16 08:40:33 +00:00
|
|
|
float GetFadeIn() const { return x0_fadeIn; }
|
|
|
|
float GetFadeOut() const { return x4_fadeOut; }
|
|
|
|
float GetVolume() const { return x8_volume; }
|
|
|
|
const std::string& GetFileName() const { return xc_fileName; }
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId GetResId() const { return x1c_res; }
|
2017-01-16 08:40:33 +00:00
|
|
|
static Audio None() { return Audio{0.f, 0.f, 0.f, "", 0}; }
|
2016-07-29 17:00:23 +00:00
|
|
|
};
|
2016-07-24 04:46:32 +00:00
|
|
|
enum class EType
|
|
|
|
{
|
2016-07-29 17:00:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
EType x0_type;
|
2016-07-24 04:46:32 +00:00
|
|
|
std::string x4_key;
|
2017-01-16 08:40:33 +00:00
|
|
|
std::string x14_str;
|
|
|
|
Audio x24_audio;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
u32 x44_int;
|
|
|
|
float x44_flt;
|
|
|
|
};
|
2016-07-29 17:00:23 +00:00
|
|
|
public:
|
|
|
|
CTweakValue()=default;
|
|
|
|
//CTweakValue(CTextInputStream&);
|
|
|
|
//void PutTo(CTextOutStream&);
|
|
|
|
const std::string& GetName() const { return x4_key; }
|
|
|
|
const std::string& GetValueAsString() const;
|
|
|
|
void SetValueFromString(const std::string&);
|
2017-01-16 08:40:33 +00:00
|
|
|
const Audio& GetAudio() const { return x24_audio; }
|
2016-07-29 17:00:23 +00:00
|
|
|
EType GetType() const { return x0_type; }
|
2016-07-24 04:46:32 +00:00
|
|
|
};
|
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
class CInGameTweakManagerBase
|
|
|
|
{
|
2016-07-24 04:46:32 +00:00
|
|
|
protected:
|
|
|
|
std::vector<CTweakValue> x0_values;
|
2015-08-27 00:23:46 +00:00
|
|
|
public:
|
2016-07-24 04:46:32 +00:00
|
|
|
bool HasTweakValue(const std::string& name) const
|
|
|
|
{
|
|
|
|
for (const CTweakValue& val : x0_values)
|
2016-07-29 17:00:23 +00:00
|
|
|
if (val.GetName() == name)
|
2016-07-24 04:46:32 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const CTweakValue* GetTweakValue(const std::string& name) const
|
|
|
|
{
|
|
|
|
for (const CTweakValue& val : x0_values)
|
2016-07-29 17:00:23 +00:00
|
|
|
if (val.GetName() == name)
|
2016-07-24 04:46:32 +00:00
|
|
|
return &val;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
bool ReadFromMemoryCard(const std::string& name)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2017-05-21 16:01:04 +00:00
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area,
|
2017-05-21 16:01:04 +00:00
|
|
|
const std::string& midiObj)
|
|
|
|
{
|
|
|
|
return hecl::Format("World %8.8x Area %8.8x MidiObject: %s",
|
2017-08-13 05:26:14 +00:00
|
|
|
u32(world.Value()), u32(area.Value()), midiObj.c_str());
|
2017-05-21 16:01:04 +00:00
|
|
|
}
|
2015-08-27 00:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CINGAMETWEAKMANAGERBASE_HPP__
|