[IFxEffectDef] Continue with the efx parser
This commit is contained in:
parent
ac75429d1d
commit
2d828d27db
@ -4,8 +4,8 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
void IFxEffectDef::load(Game::XAssetHeader* /*header*/, std::string name, Components::ZoneBuilder::Zone* /*builder*/)
|
void IFxEffectDef::load(Game::XAssetHeader* /*header*/, std::string name, Components::ZoneBuilder::Zone* /*builder*/)
|
||||||
{
|
{
|
||||||
#if 0
|
#ifdef DEBUG
|
||||||
Components::FileSystem::File rawFx(fmt::sprintf("fx/%s.efx", name.data()));
|
Components::FileSystem::File rawFx(Utils::String::VA("fx/%s.efx", name.data()));
|
||||||
if (rawFx.exists())
|
if (rawFx.exists())
|
||||||
{
|
{
|
||||||
const char* session = rawFx.getBuffer().data();
|
const char* session = rawFx.getBuffer().data();
|
||||||
@ -30,12 +30,48 @@ namespace Assets
|
|||||||
Game::FxEditorEffectDef efx;
|
Game::FxEditorEffectDef efx;
|
||||||
ZeroMemory(&efx, sizeof(efx));
|
ZeroMemory(&efx, sizeof(efx));
|
||||||
|
|
||||||
// for (int i = 0; i < FX_ELEM_FIELD_COUNT; ++i)
|
for (efx.elemCount = 0; ; ++efx.elemCount)
|
||||||
// {
|
{
|
||||||
// Game::s_elemFields[i].handler(&session, efx.elems);
|
const char* value = Game::Com_Parse(&session);
|
||||||
// }
|
if (!value) break;
|
||||||
|
if (*value != '{')
|
||||||
|
{
|
||||||
|
Components::Logger::Error("Expected '{' to start a new segment, found '%s' instead.\n", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (efx.elemCount >= ARRAYSIZE(efx.elems))
|
||||||
|
{
|
||||||
|
Components::Logger::Error("Cannot have more than %i segments.\n", ARRAYSIZE(efx.elems));
|
||||||
|
}
|
||||||
|
|
||||||
|
Game::FxEditorElemDef* element = &efx.elems[efx.elemCount];
|
||||||
|
// TODO: Initialize some stuff here
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
std::string newValue = Game::Com_Parse(&session);
|
||||||
|
if (newValue[0] != '}') break;
|
||||||
|
|
||||||
|
for (int i = 0; i < FX_ELEM_FIELD_COUNT; ++i)
|
||||||
|
{
|
||||||
|
if(Game::s_elemFields[i].keyName == std::string(newValue))
|
||||||
|
{
|
||||||
|
// TODO: Allow loading assets from raw!
|
||||||
|
if(Game::s_elemFields[i].handler(&session, element)) break;
|
||||||
|
Components::Logger::Error("Failed to parse element %s!\n", newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Game::Com_MatchToken(&session, ";", 1))
|
||||||
|
{
|
||||||
|
Components::Logger::Error("Expected token ';'\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Game::Com_EndParseSession();
|
Game::Com_EndParseSession();
|
||||||
|
|
||||||
|
// TODO: Convert editor fx to real fx
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ namespace Game
|
|||||||
Com_BeginParseSession_t Com_BeginParseSession = Com_BeginParseSession_t(0x4AAB80);
|
Com_BeginParseSession_t Com_BeginParseSession = Com_BeginParseSession_t(0x4AAB80);
|
||||||
Com_SetSpaceDelimited_t Com_SetSpaceDelimited = Com_SetSpaceDelimited_t(0x4FC710);
|
Com_SetSpaceDelimited_t Com_SetSpaceDelimited = Com_SetSpaceDelimited_t(0x4FC710);
|
||||||
Com_Parse_t Com_Parse = Com_Parse_t(0x474D60);
|
Com_Parse_t Com_Parse = Com_Parse_t(0x474D60);
|
||||||
|
Com_MatchToken_t Com_MatchToken = Com_MatchToken_t(0x447130);
|
||||||
Com_SetSlowMotion_t Com_SetSlowMotion = Com_SetSlowMotion_t(0x446E20);
|
Com_SetSlowMotion_t Com_SetSlowMotion = Com_SetSlowMotion_t(0x446E20);
|
||||||
|
|
||||||
Con_DrawMiniConsole_t Con_DrawMiniConsole = Con_DrawMiniConsole_t(0x464F30);
|
Con_DrawMiniConsole_t Con_DrawMiniConsole = Con_DrawMiniConsole_t(0x464F30);
|
||||||
|
@ -86,6 +86,9 @@ namespace Game
|
|||||||
typedef char* (__cdecl * Com_Parse_t)(const char **data_p);
|
typedef char* (__cdecl * Com_Parse_t)(const char **data_p);
|
||||||
extern Com_Parse_t Com_Parse;
|
extern Com_Parse_t Com_Parse;
|
||||||
|
|
||||||
|
typedef bool (__cdecl * Com_MatchToken_t)(const char **data_p, const char* token, int size);
|
||||||
|
extern Com_MatchToken_t Com_MatchToken;
|
||||||
|
|
||||||
typedef void(__cdecl * Com_SetSlowMotion_t)(float start, float end, int duration);
|
typedef void(__cdecl * Com_SetSlowMotion_t)(float start, float end, int duration);
|
||||||
extern Com_SetSlowMotion_t Com_SetSlowMotion;
|
extern Com_SetSlowMotion_t Com_SetSlowMotion;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user