VEFObject *VEFObject::CreateObject(const ieResRef res, SClass_ID id) { if (gamedata->Exists( res, id, true) ) { VEFObject *obj = new VEFObject(); if (id==IE_2DA_CLASS_ID) { obj->Load2DA(res); } else { DataStream* stream = gamedata->GetResource(res, id); strnlwrcpy(obj->ResName, res, 8); obj->LoadVEF(stream); } return obj; } return NULL; }
VEFObject* GameData::GetVEFObject(const char *effect, bool doublehint) { VEFObject *ret = NULL; if (Exists( effect, IE_VEF_CLASS_ID, true ) ) { DataStream *ds = GetResource( effect, IE_VEF_CLASS_ID ); ret = new VEFObject(); strnlwrcpy(ret->ResName, effect, 8); ret->LoadVEF(ds); } else { if (Exists( effect, IE_2DA_CLASS_ID, true ) ) { ret = new VEFObject(); ret->Load2DA(effect); } else { ScriptedAnimation *sca = GetScriptedAnimation(effect, doublehint); if (sca) { ret = new VEFObject(sca); } } } return ret; }