changed collision mode instruction from enable/disable to toggle

actorid
Marc Zinnschlag 14 years ago
parent 42ef7a61a0
commit 46a8ccc2ff

@ -37,32 +37,24 @@ namespace MWScript
}
};
class OpSetCollision : public Interpreter::Opcode0
class OpToggleCollision : public Interpreter::Opcode0
{
bool mEnable;
public:
OpSetCollision (bool enable)
: mEnable (enable)
{}
virtual void execute (Interpreter::Runtime& runtime)
{
InterpreterContext& context
= static_cast<InterpreterContext&> (runtime.getContext());
context.getWorld().getPlayer().setCollisionMode (mEnable);
context.getWorld().getPlayer().toggleCollisionMode();
}
};
const int numberOfControls = 7;
const int opcodeEnable = 0x200007e;
const int opcodeDisable = 0x2000085;
const int opcodeEnableCollision = 0x2000130;
const int opcodeDisableCollision = 0x2000131;
const int opcodeToggleCollision = 0x2000130;
const char *controls[numberOfControls] =
{
@ -81,8 +73,7 @@ namespace MWScript
extensions.registerInstruction (disable + controls[i], "", opcodeDisable+i);
}
extensions.registerInstruction ("enablecollision", "", opcodeEnableCollision);
extensions.registerInstruction ("disablecollision", "", opcodeDisableCollision);
extensions.registerInstruction ("togglecollision", "", opcodeToggleCollision);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -93,8 +84,7 @@ namespace MWScript
interpreter.installSegment5 (opcodeDisable+i, new OpSetControl (controls[i], false));
}
interpreter.installSegment5 (opcodeEnableCollision, new OpSetCollision (true));
interpreter.installSegment5 (opcodeDisableCollision, new OpSetCollision (false));
interpreter.installSegment5 (opcodeToggleCollision, new OpToggleCollision);
}
}
}

@ -101,6 +101,5 @@ op 0x20000c4-0x20000de: SetSkill
op 0x20000df-0x20000f9: SetSkill, explicit reference
op 0x20000fa-0x2000114: ModSkill
op 0x2000115-0x200012f: ModSKill, explicit reference
op 0x2000130: EnableCollision
op 0x2000131: DisableCollision
opcodes 0x2000130-0x3ffffff unused
op 0x2000130: ToggleCollision
opcodes 0x2000131-0x3ffffff unused

@ -104,9 +104,9 @@ namespace MWWorld
return *mClass;
}
void setCollisionMode (bool enable)
void toggleCollisionMode()
{
mCollisionMode = enable;
mCollisionMode = !mCollisionMode;
}
};
}

Loading…
Cancel
Save