Load all UTD fields
This commit is contained in:
parent
75927cca92
commit
66d2a68c45
6 changed files with 81 additions and 49 deletions
|
@ -53,10 +53,11 @@ void Door::loadFromGIT(const GffStruct &gffs) {
|
|||
string templateResRef(boost::to_lower_copy(gffs.getString("TemplateResRef")));
|
||||
loadFromBlueprint(templateResRef);
|
||||
|
||||
_linkedTo = boost::to_lower_copy(gffs.getString("LinkedTo"));
|
||||
_linkedToModule = boost::to_lower_copy(gffs.getString("LinkedToModule"));
|
||||
_linkedTo = boost::to_lower_copy(gffs.getString("LinkedTo"));
|
||||
_linkedToFlags = gffs.getInt("LinkedToFlags");
|
||||
_transitionDestin = Strings::instance().get(gffs.getInt("TransitionDestin"));
|
||||
|
||||
loadTransitionDestinFromGIT(gffs);
|
||||
loadTransformFromGIT(gffs);
|
||||
}
|
||||
|
||||
|
@ -75,13 +76,6 @@ void Door::loadFromBlueprint(const string &resRef) {
|
|||
_open2Walkmesh = Walkmeshes::instance().get(modelName + "2", ResourceType::Dwk);
|
||||
}
|
||||
|
||||
void Door::loadTransitionDestinFromGIT(const GffStruct &gffs) {
|
||||
int transDestStrRef = gffs.getInt("TransitionDestin");
|
||||
if (transDestStrRef != -1) {
|
||||
_transitionDestin = Strings::instance().get(transDestStrRef);
|
||||
}
|
||||
}
|
||||
|
||||
void Door::loadTransformFromGIT(const GffStruct &gffs) {
|
||||
_position[0] = gffs.getFloat("X");
|
||||
_position[1] = gffs.getFloat("Y");
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
void open(const std::shared_ptr<Object> &triggerrer);
|
||||
void close(const std::shared_ptr<Object> &triggerrer);
|
||||
|
||||
bool isLockable() const { return _lockable; }
|
||||
bool isLocked() const { return _locked; }
|
||||
bool isStatic() const { return _static; }
|
||||
bool isKeyRequired() const { return _keyRequired; }
|
||||
|
@ -59,19 +58,39 @@ public:
|
|||
void setLocked(bool locked);
|
||||
|
||||
private:
|
||||
bool _lockable { false };
|
||||
bool _locked { false };
|
||||
int _genericType { 0 };
|
||||
bool _static { false };
|
||||
bool _keyRequired { false };
|
||||
std::string _linkedToModule;
|
||||
std::string _linkedTo;
|
||||
int _linkedToFlags { 0 };
|
||||
std::string _transitionDestin;
|
||||
Faction _faction { Faction::Invalid };
|
||||
int _closeLockDC { 0 };
|
||||
bool _interruptable { false };
|
||||
int _openLockDC { 0 };
|
||||
int _portraitId { 0 };
|
||||
int _animationState { 0 };
|
||||
int _appearance { 0 };
|
||||
int _hardness { 0 };
|
||||
int _fortitude { 0 };
|
||||
int _reflex { 0 };
|
||||
int _will { 0 };
|
||||
int _loadScreenID { 0 };
|
||||
|
||||
// Scripts
|
||||
|
||||
std::string _onOpen;
|
||||
std::string _onFailToOpen;
|
||||
std::string _onClosed;
|
||||
std::string _onDamaged;
|
||||
std::string _onDeath;
|
||||
std::string _onMeleeAttacked;
|
||||
std::string _onSpellCastAt;
|
||||
std::string _onUnlock;
|
||||
std::string _onClick;
|
||||
std::string _onLock;
|
||||
|
||||
// END Scripts
|
||||
|
||||
|
@ -86,14 +105,7 @@ private:
|
|||
void loadTransitionDestinFromGIT(const resource::GffStruct &gffs);
|
||||
void loadTransformFromGIT(const resource::GffStruct &gffs);
|
||||
|
||||
// Blueprint
|
||||
|
||||
void loadUTD(const resource::GffStruct &utd);
|
||||
|
||||
void loadNameFromUTD(const resource::GffStruct &utd);
|
||||
void loadScriptsFromUTD(const resource::GffStruct &utd);
|
||||
|
||||
// END Blueprint
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -34,33 +34,59 @@ namespace reone {
|
|||
namespace game {
|
||||
|
||||
void Door::loadUTD(const GffStruct &utd) {
|
||||
_blueprintResRef = boost::to_lower_copy(utd.getString("TemplateResRef"));
|
||||
_conversation = boost::to_lower_copy(utd.getString("Conversation"));
|
||||
_currentHitPoints = utd.getInt("CurrentHP");
|
||||
_genericType = utd.getInt("GenericType");
|
||||
_hitPoints = utd.getInt("HP");
|
||||
_keyRequired = utd.getBool("KeyRequired");
|
||||
_lockable = utd.getBool("Lockable");
|
||||
_locked = utd.getBool("Locked");
|
||||
_minOneHP = utd.getBool("Min1HP");
|
||||
_static = utd.getBool("Static");
|
||||
_tag = boost::to_lower_copy(utd.getString("Tag"));
|
||||
_name = Strings::instance().get(utd.getInt("LocName"));
|
||||
_blueprintResRef = boost::to_lower_copy(utd.getString("TemplateResRef"));
|
||||
_closeLockDC = utd.getInt("CloseLockDC");
|
||||
_conversation = boost::to_lower_copy(utd.getString("Conversation"));
|
||||
_interruptable = utd.getBool("Interruptable");
|
||||
_faction = utd.getEnum("Faction", Faction::Invalid);
|
||||
_plot = utd.getBool("Plot");
|
||||
_minOneHP = utd.getBool("Min1HP");
|
||||
_keyRequired = utd.getBool("KeyRequired");
|
||||
_locked = utd.getBool("Locked");
|
||||
_openLockDC = utd.getInt("OpenLockDC");
|
||||
_portraitId = utd.getInt("PortraitId");
|
||||
_animationState = utd.getInt("AnimationState");
|
||||
_appearance = utd.getInt("Appearance");
|
||||
_hitPoints = utd.getInt("HP");
|
||||
_currentHitPoints = utd.getInt("CurrentHP");
|
||||
_hardness = utd.getInt("Hardness");
|
||||
_fortitude = utd.getInt("Fort");
|
||||
_reflex = utd.getInt("Ref");
|
||||
_will = utd.getInt("Will");
|
||||
_loadScreenID = utd.getInt("LoadScreenID");
|
||||
_genericType = utd.getInt("GenericType");
|
||||
_static = utd.getBool("Static");
|
||||
|
||||
loadNameFromUTD(utd);
|
||||
loadScriptsFromUTD(utd);
|
||||
}
|
||||
|
||||
void Door::loadNameFromUTD(const GffStruct &utd) {
|
||||
int locNameStrRef = utd.getInt("LocName", -1);
|
||||
if (locNameStrRef != -1) {
|
||||
_name = Strings::instance().get(locNameStrRef);
|
||||
}
|
||||
}
|
||||
|
||||
void Door::loadScriptsFromUTD(const GffStruct &utd) {
|
||||
_onClosed = utd.getString("OnClosed");
|
||||
_onDamaged = utd.getString("OnDamaged");
|
||||
_onDeath = utd.getString("OnDeath");
|
||||
_onHeartbeat = utd.getString("OnHeartbeat");
|
||||
_onFailToOpen = utd.getString("OnFailToOpen");
|
||||
_onLock = utd.getString("OnLock");
|
||||
_onMeleeAttacked = utd.getString("OnMeleeAttacked");
|
||||
_onOpen = utd.getString("OnOpen");
|
||||
_onSpellCastAt = utd.getString("OnSpellCastAt");
|
||||
_onUnlock = utd.getString("OnUnlock");
|
||||
_onUserDefined = utd.getString("OnUserDefined");
|
||||
_onClick = utd.getString("OnClick");
|
||||
_onFailToOpen = utd.getString("OnFailToOpen");
|
||||
|
||||
// These fields are ignored as being most likely unused:
|
||||
//
|
||||
// - AutoRemoveKey
|
||||
// - Lockable
|
||||
// - TrapDetectable
|
||||
// - TrapDetectDC
|
||||
// - TrapDisarmable
|
||||
// - DisarmDC
|
||||
// - TrapFlag
|
||||
// - TrapOneShot
|
||||
// - TrapType
|
||||
// - KeyName
|
||||
// - OnDisarm
|
||||
// - OnLock
|
||||
// - OnTrapTriggered
|
||||
}
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -46,8 +46,8 @@ void Object::setMaxHitPoints(int maxHitPoints) {
|
|||
_maxHitPoints = maxHitPoints;
|
||||
}
|
||||
|
||||
void Object::setPlotFlag(int flag) {
|
||||
_plotFlag = flag;
|
||||
void Object::setPlotFlag(bool plot) {
|
||||
_plot = plot;
|
||||
}
|
||||
|
||||
void Object::setCommandable(bool value) {
|
||||
|
|
|
@ -43,9 +43,9 @@ public:
|
|||
const std::string &name() const { return _name; }
|
||||
const std::string &conversation() const { return _conversation; }
|
||||
ActionQueue &actionQueue() { return _actionQueue; }
|
||||
int plotFlag() const { return _plotFlag; }
|
||||
bool plotFlag() const { return _plot; }
|
||||
|
||||
void setPlotFlag(int flag);
|
||||
void setPlotFlag(bool plot);
|
||||
void setCommandable(bool value);
|
||||
|
||||
// Hit Points
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
int _maxHitPoints { 0 };
|
||||
int _currentHitPoints { 0 };
|
||||
bool _dead { false };
|
||||
int _plotFlag { 0 };
|
||||
bool _plot { false };
|
||||
bool _commandable { true };
|
||||
|
||||
// Scripts
|
||||
|
|
|
@ -337,7 +337,7 @@ Variable Routines::getObjectType(const VariablesList &args, ExecutionContext &ct
|
|||
}
|
||||
|
||||
Variable Routines::getPlotFlag(const VariablesList &args, ExecutionContext &ctx) {
|
||||
int result = 0;
|
||||
bool result = false;
|
||||
|
||||
auto target = getObjectOrCaller(args, 0, ctx);
|
||||
if (target) {
|
||||
|
@ -346,12 +346,12 @@ Variable Routines::getPlotFlag(const VariablesList &args, ExecutionContext &ctx)
|
|||
debug("Script: getPlotFlag: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
}
|
||||
|
||||
Variable Routines::setPlotFlag(const VariablesList &args, ExecutionContext &ctx) {
|
||||
auto target = getObject(args, 0);
|
||||
int plotFlag = getInt(args, 1);
|
||||
bool plotFlag = getBool(args, 1);
|
||||
|
||||
if (target) {
|
||||
target->setPlotFlag(plotFlag);
|
||||
|
|
Loading…
Reference in a new issue