Merge remote-tracking branch 'scrawl/reputation'

actorid
Marc Zinnschlag 12 years ago
commit a6c7f16a7b

@ -257,6 +257,8 @@ void StatsWindow::onFrame ()
MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
setBirthSign(signId);
setReputation (PCstats.getReputation ());
setBounty (PCstats.getBounty ());
if (mChanged)
updateSkillArea();

@ -38,8 +38,8 @@ namespace MWGui
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
void configureSkills (const SkillList& major, const SkillList& minor);
void setReputation (int reputation) { this->mReputation = reputation; }
void setBounty (int bounty) { this->mBounty = bounty; }
void setReputation (int reputation) { if (reputation != mReputation) mChanged = true; this->mReputation = reputation; }
void setBounty (int bounty) { if (bounty != mBounty) mChanged = true; this->mBounty = bounty; }
void updateSkillArea();
private:

@ -11,6 +11,9 @@
#include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/journal.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "interpretercontext.hpp"
#include "ref.hpp"
@ -126,6 +129,37 @@ namespace MWScript
}
};
template<class R>
class OpModReputation : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (MWWorld::Class::get(ptr).getNpcStats (ptr).getReputation () + value);
}
};
template<class R>
class OpSetReputation : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (value);
}
};
const int opcodeJournal = 0x2000133;
const int opcodeSetJournalIndex = 0x2000134;
const int opcodeGetJournalIndex = 0x2000135;
@ -134,6 +168,10 @@ namespace MWScript
const int opcodeForceGreeting = 0x200014f;
const int opcodeForceGreetingExplicit = 0x2000150;
const int opcodeGoodbye = 0x2000152;
const int opcodeSetReputation = 0x20001ad;
const int opcodeModReputation = 0x20001ae;
const int opcodeSetReputationExplicit = 0x20001af;
const int opcodeModReputationExplicit = 0x20001b0;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -146,6 +184,10 @@ namespace MWScript
extensions.registerInstruction("forcegreeting","",opcodeForceGreeting,
opcodeForceGreetingExplicit);
extensions.registerInstruction("goodbye", "", opcodeGoodbye);
extensions.registerInstruction("setreputation", "l", opcodeSetReputation,
opcodeSetReputationExplicit);
extensions.registerInstruction("modreputation", "l", opcodeModReputation,
opcodeModReputationExplicit);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -158,6 +200,10 @@ namespace MWScript
interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting<ImplicitRef>);
interpreter.installSegment5 (opcodeForceGreetingExplicit, new OpForceGreeting<ExplicitRef>);
interpreter.installSegment5 (opcodeGoodbye, new OpGoodbye);
interpreter.installSegment5 (opcodeSetReputation, new OpSetReputation<ImplicitRef>);
interpreter.installSegment5 (opcodeModReputation, new OpModReputation<ImplicitRef>);
interpreter.installSegment5 (opcodeSetReputationExplicit, new OpSetReputation<ExplicitRef>);
interpreter.installSegment5 (opcodeModReputationExplicit, new OpModReputation<ExplicitRef>);
}
}

@ -222,5 +222,9 @@ op 0x20001a9: CommonDisease, explicit reference
op 0x20001aa: BlightDisease
op 0x20001ab: BlightDisease, explicit reference
op 0x20001ac: ToggleCollisionBoxes
opcodes 0x20001ac-0x3ffffff unused
op 0x20001ad: SetReputation
op 0x20001ae: ModReputation
op 0x20001af: SetReputation, explicit
op 0x20001b0: ModReputation, explicit
opcodes 0x20001b1-0x3ffffff unused

Loading…
Cancel
Save