GRIM: Lua_L1 -> Lua_V1 and Lua_L2 -> Lua_V2.

This commit is contained in:
Giulio Camuffo 2011-10-13 15:41:22 +02:00
parent 5ca9cae83c
commit 782bfdecf7
9 changed files with 796 additions and 796 deletions

View file

@ -258,14 +258,14 @@ Common::Error GrimEngine::run() {
LuaBase *lua = NULL; LuaBase *lua = NULL;
if (getGameType() == GType_GRIM) { if (getGameType() == GType_GRIM) {
lua = new Lua_L1(); lua = new Lua_V1();
// FIXME/HACK: see PutActorInSet // FIXME/HACK: see PutActorInSet
const char *func = "function reset_doorman() doorman_in_hot_box = FALSE end"; const char *func = "function reset_doorman() doorman_in_hot_box = FALSE end";
lua_pushstring(func); lua_pushstring(func);
lua_call("dostring"); lua_call("dostring");
} else { } else {
lua = new Lua_L2(); lua = new Lua_V2();
} }
lua->registerOpcodes(); lua->registerOpcodes();

File diff suppressed because it is too large Load diff

View file

@ -27,9 +27,9 @@
namespace Grim { namespace Grim {
class Lua_L1 : public LuaBase { class Lua_V1 : public LuaBase {
public: public:
typedef Lua_L1 LuaClass; typedef Lua_V1 LuaClass;
void registerOpcodes(); void registerOpcodes();
// Opcodes // Opcodes

View file

@ -33,7 +33,7 @@
namespace Grim { namespace Grim {
void Lua_L1::LoadActor() { void Lua_V1::LoadActor() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
const char *name; const char *name;
@ -45,7 +45,7 @@ void Lua_L1::LoadActor() {
lua_pushusertag(a->getId(), MKTAG('A','C','T','R')); lua_pushusertag(a->getId(), MKTAG('A','C','T','R'));
} }
void Lua_L1::GetActorTimeScale() { void Lua_V1::GetActorTimeScale() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -54,7 +54,7 @@ void Lua_L1::GetActorTimeScale() {
lua_pushnumber(actor->getTimeScale()); lua_pushnumber(actor->getTimeScale());
} }
void Lua_L1::SetSelectedActor() { void Lua_V1::SetSelectedActor() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -66,13 +66,13 @@ void Lua_L1::SetSelectedActor() {
* "Camera-Relative" mode to handle the appropriate * "Camera-Relative" mode to handle the appropriate
* actor for movement * actor for movement
*/ */
void Lua_L1::GetCameraActor() { void Lua_V1::GetCameraActor() {
// TODO verify what is going on with selected actor // TODO verify what is going on with selected actor
Actor *actor = g_grim->getSelectedActor(); Actor *actor = g_grim->getSelectedActor();
lua_pushusertag(actor->getId(), MKTAG('A','C','T','R')); lua_pushusertag(actor->getId(), MKTAG('A','C','T','R'));
} }
void Lua_L1::SetActorTalkColor() { void Lua_V1::SetActorTalkColor() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object colorObj = lua_getparam(2); lua_Object colorObj = lua_getparam(2);
@ -85,7 +85,7 @@ void Lua_L1::SetActorTalkColor() {
actor->setTalkColor(color); actor->setTalkColor(color);
} }
void Lua_L1::GetActorTalkColor() { void Lua_V1::GetActorTalkColor() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) { if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) {
lua_pushnil(); lua_pushnil();
@ -95,7 +95,7 @@ void Lua_L1::GetActorTalkColor() {
lua_pushusertag(actor->getTalkColor()->getId(), MKTAG('C','O','L','R')); lua_pushusertag(actor->getTalkColor()->getId(), MKTAG('C','O','L','R'));
} }
void Lua_L1::SetActorRestChore() { void Lua_V1::SetActorRestChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3); lua_Object costumeObj = lua_getparam(3);
@ -120,7 +120,7 @@ void Lua_L1::SetActorRestChore() {
actor->setRestChore(chore, costume); actor->setRestChore(chore, costume);
} }
void Lua_L1::SetActorWalkChore() { void Lua_V1::SetActorWalkChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3); lua_Object costumeObj = lua_getparam(3);
@ -145,7 +145,7 @@ void Lua_L1::SetActorWalkChore() {
actor->setWalkChore(chore, costume); actor->setWalkChore(chore, costume);
} }
void Lua_L1::SetActorTurnChores() { void Lua_V1::SetActorTurnChores() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object leftChoreObj = lua_getparam(2); lua_Object leftChoreObj = lua_getparam(2);
lua_Object rightChoreObj = lua_getparam(3); lua_Object rightChoreObj = lua_getparam(3);
@ -167,7 +167,7 @@ void Lua_L1::SetActorTurnChores() {
actor->setTurnChores(leftChore, rightChore, costume); actor->setTurnChores(leftChore, rightChore, costume);
} }
void Lua_L1::SetActorTalkChore() { void Lua_V1::SetActorTalkChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object indexObj = lua_getparam(2); lua_Object indexObj = lua_getparam(2);
lua_Object choreObj = lua_getparam(3); lua_Object choreObj = lua_getparam(3);
@ -200,7 +200,7 @@ void Lua_L1::SetActorTalkChore() {
actor->setTalkChore(index, chore, costume); actor->setTalkChore(index, chore, costume);
} }
void Lua_L1::SetActorMumblechore() { void Lua_V1::SetActorMumblechore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3); lua_Object costumeObj = lua_getparam(3);
@ -228,7 +228,7 @@ void Lua_L1::SetActorMumblechore() {
actor->setMumbleChore(chore, costume); actor->setMumbleChore(chore, costume);
} }
void Lua_L1::SetActorVisibility() { void Lua_V1::SetActorVisibility() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -239,7 +239,7 @@ void Lua_L1::SetActorVisibility() {
actor->setVisibility(val); actor->setVisibility(val);
} }
void Lua_L1::SetActorScale() { void Lua_V1::SetActorScale() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object scaleObj = lua_getparam(2); lua_Object scaleObj = lua_getparam(2);
@ -255,7 +255,7 @@ void Lua_L1::SetActorScale() {
actor->setScale(scale); actor->setScale(scale);
} }
void Lua_L1::SetActorTimeScale() { void Lua_V1::SetActorTimeScale() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object scaleObj = lua_getparam(2); lua_Object scaleObj = lua_getparam(2);
@ -271,7 +271,7 @@ void Lua_L1::SetActorTimeScale() {
actor->setTimeScale(scale); actor->setTimeScale(scale);
} }
void Lua_L1::SetActorCollisionMode() { void Lua_V1::SetActorCollisionMode() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object modeObj = lua_getparam(2); lua_Object modeObj = lua_getparam(2);
@ -286,7 +286,7 @@ void Lua_L1::SetActorCollisionMode() {
actor->setCollisionMode(mode); actor->setCollisionMode(mode);
} }
void Lua_L1::SetActorCollisionScale() { void Lua_V1::SetActorCollisionScale() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object scaleObj = lua_getparam(2); lua_Object scaleObj = lua_getparam(2);
@ -301,7 +301,7 @@ void Lua_L1::SetActorCollisionScale() {
actor->setCollisionScale(scale); actor->setCollisionScale(scale);
} }
void Lua_L1::PutActorAt() { void Lua_V1::PutActorAt() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object xObj = lua_getparam(2); lua_Object xObj = lua_getparam(2);
lua_Object yObj = lua_getparam(3); lua_Object yObj = lua_getparam(3);
@ -319,7 +319,7 @@ void Lua_L1::PutActorAt() {
actor->setPos(Math::Vector3d(x, y, z)); actor->setPos(Math::Vector3d(x, y, z));
} }
void Lua_L1::GetActorPos() { void Lua_V1::GetActorPos() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
@ -332,7 +332,7 @@ void Lua_L1::GetActorPos() {
lua_pushnumber(pos.z()); lua_pushnumber(pos.z());
} }
void Lua_L1::SetActorRot() { void Lua_V1::SetActorRot() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
@ -353,7 +353,7 @@ void Lua_L1::SetActorRot() {
actor->setRot(pitch, yaw, roll); actor->setRot(pitch, yaw, roll);
} }
void Lua_L1::GetActorRot() { void Lua_V1::GetActorRot() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
@ -365,7 +365,7 @@ void Lua_L1::GetActorRot() {
lua_pushnumber(actor->getRoll().getDegrees()); lua_pushnumber(actor->getRoll().getDegrees());
} }
void Lua_L1::IsActorTurning() { void Lua_V1::IsActorTurning() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
@ -375,7 +375,7 @@ void Lua_L1::IsActorTurning() {
pushbool(actor->isTurning()); pushbool(actor->isTurning());
} }
void Lua_L1::GetAngleBetweenActors() { void Lua_V1::GetAngleBetweenActors() {
lua_Object actor1Obj = lua_getparam(1); lua_Object actor1Obj = lua_getparam(1);
lua_Object actor2Obj = lua_getparam(2); lua_Object actor2Obj = lua_getparam(2);
@ -398,7 +398,7 @@ void Lua_L1::GetAngleBetweenActors() {
lua_pushnumber(actor1->getYawTo(actor2).getDegrees()); lua_pushnumber(actor1->getYawTo(actor2).getDegrees());
} }
void Lua_L1::GetActorYawToPoint() { void Lua_V1::GetActorYawToPoint() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object pointObj = lua_getparam(2); lua_Object pointObj = lua_getparam(2);
lua_Object xObj, yObj, zObj; lua_Object xObj, yObj, zObj;
@ -437,7 +437,7 @@ void Lua_L1::GetActorYawToPoint() {
* by changing the set to "nil" an actor is disabled * by changing the set to "nil" an actor is disabled
* but should still not be destroyed. * but should still not be destroyed.
*/ */
void Lua_L1::PutActorInSet() { void Lua_V1::PutActorInSet() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object setObj = lua_getparam(2); lua_Object setObj = lua_getparam(2);
@ -473,7 +473,7 @@ void Lua_L1::PutActorInSet() {
actor->putInSet(set); actor->putInSet(set);
} }
void Lua_L1::SetActorWalkRate() { void Lua_V1::SetActorWalkRate() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object rateObj = lua_getparam(2); lua_Object rateObj = lua_getparam(2);
@ -487,7 +487,7 @@ void Lua_L1::SetActorWalkRate() {
actor->setWalkRate(rate); actor->setWalkRate(rate);
} }
void Lua_L1::GetActorWalkRate() { void Lua_V1::GetActorWalkRate() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -496,7 +496,7 @@ void Lua_L1::GetActorWalkRate() {
lua_pushnumber(actor->getWalkRate()); lua_pushnumber(actor->getWalkRate());
} }
void Lua_L1::SetActorTurnRate() { void Lua_V1::SetActorTurnRate() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object rateObj = lua_getparam(2); lua_Object rateObj = lua_getparam(2);
@ -510,7 +510,7 @@ void Lua_L1::SetActorTurnRate() {
actor->setTurnRate(rate); actor->setTurnRate(rate);
} }
void Lua_L1::WalkActorForward() { void Lua_V1::WalkActorForward() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -518,7 +518,7 @@ void Lua_L1::WalkActorForward() {
actor->walkForward(); actor->walkForward();
} }
void Lua_L1::SetActorReflection() { void Lua_V1::SetActorReflection() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object angleObj = lua_getparam(2); lua_Object angleObj = lua_getparam(2);
@ -530,7 +530,7 @@ void Lua_L1::SetActorReflection() {
actor->setReflection(angle); actor->setReflection(angle);
} }
void Lua_L1::GetActorPuckVector() { void Lua_V1::GetActorPuckVector() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object addObj = lua_getparam(2); lua_Object addObj = lua_getparam(2);
@ -554,7 +554,7 @@ void Lua_L1::GetActorPuckVector() {
lua_pushnumber(result.z()); lua_pushnumber(result.z());
} }
void Lua_L1::ActorPuckOrient() { void Lua_V1::ActorPuckOrient() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) { if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) {
@ -565,7 +565,7 @@ void Lua_L1::ActorPuckOrient() {
actor->setPuckOrient(getbool(2)); actor->setPuckOrient(getbool(2));
} }
void Lua_L1::WalkActorTo() { void Lua_V1::WalkActorTo() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object xObj = lua_getparam(2); lua_Object xObj = lua_getparam(2);
lua_Object yObj = lua_getparam(3); lua_Object yObj = lua_getparam(3);
@ -601,7 +601,7 @@ void Lua_L1::WalkActorTo() {
actor->walkTo(destVec); actor->walkTo(destVec);
} }
void Lua_L1::ActorToClean() { void Lua_V1::ActorToClean() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) { if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) {
@ -617,7 +617,7 @@ void Lua_L1::ActorToClean() {
actor->_toClean = true; actor->_toClean = true;
} }
void Lua_L1::IsActorMoving() { void Lua_V1::IsActorMoving() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -626,7 +626,7 @@ void Lua_L1::IsActorMoving() {
pushbool(actor->isWalking()); pushbool(actor->isWalking());
} }
void Lua_L1::IsActorResting() { void Lua_V1::IsActorResting() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -643,7 +643,7 @@ void Lua_L1::IsActorResting() {
* in Rubacava. It is also used for calculating many positions * in Rubacava. It is also used for calculating many positions
* passed to ActorLookAt. * passed to ActorLookAt.
*/ */
void Lua_L1::GetActorNodeLocation() { void Lua_V1::GetActorNodeLocation() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object nodeObj = lua_getparam(2); lua_Object nodeObj = lua_getparam(2);
@ -679,7 +679,7 @@ void Lua_L1::GetActorNodeLocation() {
lua_pushnumber(pos.z()); lua_pushnumber(pos.z());
} }
void Lua_L1::SetActorWalkDominate() { void Lua_V1::SetActorWalkDominate() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object modeObj = lua_getparam(2); lua_Object modeObj = lua_getparam(2);
@ -691,7 +691,7 @@ void Lua_L1::SetActorWalkDominate() {
actor->setRunning(mode); actor->setRunning(mode);
} }
void Lua_L1::SetActorColormap() { void Lua_V1::SetActorColormap() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object nameObj = lua_getparam(2); lua_Object nameObj = lua_getparam(2);
@ -708,7 +708,7 @@ void Lua_L1::SetActorColormap() {
} }
} }
void Lua_L1::TurnActor() { void Lua_V1::TurnActor() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object dirObj = lua_getparam(2); lua_Object dirObj = lua_getparam(2);
@ -724,7 +724,7 @@ void Lua_L1::TurnActor() {
actor->turn(dir); actor->turn(dir);
} }
void Lua_L1::PushActorCostume() { void Lua_V1::PushActorCostume() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object nameObj = lua_getparam(2); lua_Object nameObj = lua_getparam(2);
@ -739,7 +739,7 @@ void Lua_L1::PushActorCostume() {
actor->pushCostume(costumeName); actor->pushCostume(costumeName);
} }
void Lua_L1::SetActorCostume() { void Lua_V1::SetActorCostume() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object costumeObj = lua_getparam(2); lua_Object costumeObj = lua_getparam(2);
@ -762,7 +762,7 @@ void Lua_L1::SetActorCostume() {
pushbool(true); pushbool(true);
} }
void Lua_L1::GetActorCostume() { void Lua_V1::GetActorCostume() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object costumeObj = lua_getparam(2); lua_Object costumeObj = lua_getparam(2);
@ -787,7 +787,7 @@ void Lua_L1::GetActorCostume() {
lua_pushnil(); lua_pushnil();
} }
void Lua_L1::PopActorCostume() { void Lua_V1::PopActorCostume() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return; return;
@ -800,7 +800,7 @@ void Lua_L1::PopActorCostume() {
lua_pushnil(); lua_pushnil();
} }
void Lua_L1::GetActorCostumeDepth() { void Lua_V1::GetActorCostumeDepth() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) { if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) {
lua_pushnil(); lua_pushnil();
@ -811,11 +811,11 @@ void Lua_L1::GetActorCostumeDepth() {
lua_pushnumber(actor->getCostumeStackDepth()); lua_pushnumber(actor->getCostumeStackDepth());
} }
void Lua_L1::PrintActorCostumes() { void Lua_V1::PrintActorCostumes() {
// dummy // dummy
} }
void Lua_L1::LoadCostume() { void Lua_V1::LoadCostume() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
if (lua_isstring(nameObj)) { if (lua_isstring(nameObj)) {
// FIXME disable loading costume due creating issue with colormap, this opcode is unknown purpose // FIXME disable loading costume due creating issue with colormap, this opcode is unknown purpose
@ -825,7 +825,7 @@ void Lua_L1::LoadCostume() {
lua_pushnil(); lua_pushnil();
} }
void Lua_L1::PlayActorChore() { void Lua_V1::PlayActorChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3); lua_Object costumeObj = lua_getparam(3);
@ -854,7 +854,7 @@ void Lua_L1::PlayActorChore() {
pushbool(true); pushbool(true);
} }
void Lua_L1::CompleteActorChore() { void Lua_V1::CompleteActorChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3); lua_Object costumeObj = lua_getparam(3);
@ -883,7 +883,7 @@ void Lua_L1::CompleteActorChore() {
pushbool(true); pushbool(true);
} }
void Lua_L1::PlayActorChoreLooping() { void Lua_V1::PlayActorChoreLooping() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3); lua_Object costumeObj = lua_getparam(3);
@ -912,7 +912,7 @@ void Lua_L1::PlayActorChoreLooping() {
pushbool(true); pushbool(true);
} }
void Lua_L1::SetActorChoreLooping() { void Lua_V1::SetActorChoreLooping() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(4); lua_Object costumeObj = lua_getparam(4);
@ -937,7 +937,7 @@ void Lua_L1::SetActorChoreLooping() {
} }
} }
void Lua_L1::StopActorChore() { void Lua_V1::StopActorChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3); lua_Object costumeObj = lua_getparam(3);
@ -962,7 +962,7 @@ void Lua_L1::StopActorChore() {
} }
} }
void Lua_L1::FadeOutChore() { void Lua_V1::FadeOutChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object costumeObj = lua_getparam(2); lua_Object costumeObj = lua_getparam(2);
lua_Object choreObj = lua_getparam(3); lua_Object choreObj = lua_getparam(3);
@ -988,7 +988,7 @@ void Lua_L1::FadeOutChore() {
} }
} }
void Lua_L1::FadeInChore() { void Lua_V1::FadeInChore() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object costumeObj = lua_getparam(2); lua_Object costumeObj = lua_getparam(2);
lua_Object choreObj = lua_getparam(3); lua_Object choreObj = lua_getparam(3);
@ -1014,7 +1014,7 @@ void Lua_L1::FadeInChore() {
} }
} }
void Lua_L1::IsActorChoring() { void Lua_V1::IsActorChoring() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2); lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(4); lua_Object costumeObj = lua_getparam(4);
@ -1067,7 +1067,7 @@ void Lua_L1::IsActorChoring() {
lua_pushnil(); lua_pushnil();
} }
void Lua_L1::ActorLookAt() { void Lua_V1::ActorLookAt() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object xObj = lua_getparam(2); lua_Object xObj = lua_getparam(2);
lua_Object yObj = lua_getparam(3); lua_Object yObj = lua_getparam(3);
@ -1140,7 +1140,7 @@ void Lua_L1::ActorLookAt() {
* This function must use a yaw value around the unit * This function must use a yaw value around the unit
* circle and not just a difference in angles. * circle and not just a difference in angles.
*/ */
void Lua_L1::TurnActorTo() { void Lua_V1::TurnActorTo() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object xObj = lua_getparam(2); lua_Object xObj = lua_getparam(2);
lua_Object yObj = lua_getparam(3); lua_Object yObj = lua_getparam(3);
@ -1180,7 +1180,7 @@ void Lua_L1::TurnActorTo() {
pushbool(actor->getYaw() != yaw); pushbool(actor->getYaw() != yaw);
} }
void Lua_L1::PointActorAt() { void Lua_V1::PointActorAt() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object xObj = lua_getparam(2); lua_Object xObj = lua_getparam(2);
lua_Object yObj = lua_getparam(3); lua_Object yObj = lua_getparam(3);
@ -1219,7 +1219,7 @@ void Lua_L1::PointActorAt() {
pushbool(false); pushbool(false);
} }
void Lua_L1::WalkActorVector() { void Lua_V1::WalkActorVector() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object actor2Obj = lua_getparam(2); lua_Object actor2Obj = lua_getparam(2);
// lua_Object xObj = lua_getparam(3); // lua_Object xObj = lua_getparam(3);
@ -1268,7 +1268,7 @@ void Lua_L1::WalkActorVector() {
* This is used when Glottis runs over the signpost in * This is used when Glottis runs over the signpost in
* the Petrified Forest * the Petrified Forest
*/ */
void Lua_L1::SetActorPitch() { void Lua_V1::SetActorPitch() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object pitchObj = lua_getparam(2); lua_Object pitchObj = lua_getparam(2);
@ -1280,7 +1280,7 @@ void Lua_L1::SetActorPitch() {
actor->setRot(pitch, actor->getYaw(), actor->getRoll()); actor->setRot(pitch, actor->getYaw(), actor->getRoll());
} }
void Lua_L1::SetActorLookRate() { void Lua_V1::SetActorLookRate() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object rateObj = lua_getparam(2); lua_Object rateObj = lua_getparam(2);
@ -1298,7 +1298,7 @@ void Lua_L1::SetActorLookRate() {
actor->setLookAtRate(rate); actor->setLookAtRate(rate);
} }
void Lua_L1::GetActorLookRate() { void Lua_V1::GetActorLookRate() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
@ -1311,7 +1311,7 @@ void Lua_L1::GetActorLookRate() {
lua_pushnumber(actor->getLookAtRate()); lua_pushnumber(actor->getLookAtRate());
} }
void Lua_L1::SetActorHead() { void Lua_V1::SetActorHead() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object joint1Obj = lua_getparam(2); lua_Object joint1Obj = lua_getparam(2);
lua_Object joint2Obj = lua_getparam(3); lua_Object joint2Obj = lua_getparam(3);
@ -1337,7 +1337,7 @@ void Lua_L1::SetActorHead() {
actor->setHead(joint1, joint2, joint3, maxRoll, maxPitch, maxYaw); actor->setHead(joint1, joint2, joint3, maxRoll, maxPitch, maxYaw);
} }
void Lua_L1::PutActorAtInterest() { void Lua_V1::PutActorAtInterest() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
@ -1370,7 +1370,7 @@ void Lua_L1::PutActorAtInterest() {
actor->setPos(resultPt); actor->setPos(resultPt);
} }
void Lua_L1::SetActorFollowBoxes() { void Lua_V1::SetActorFollowBoxes() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object modeObj = lua_getparam(2); lua_Object modeObj = lua_getparam(2);
bool mode = true; bool mode = true;
@ -1389,7 +1389,7 @@ void Lua_L1::SetActorFollowBoxes() {
actor->setConstrain(mode); actor->setConstrain(mode);
} }
void Lua_L1::SetActorConstrain() { void Lua_V1::SetActorConstrain() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
// lua_Object constrainObj = lua_getparam(2); // lua_Object constrainObj = lua_getparam(2);
@ -1404,7 +1404,7 @@ void Lua_L1::SetActorConstrain() {
// actor->setConstrain(constrain); // actor->setConstrain(constrain);
} }
void Lua_L1::GetVisibleThings() { void Lua_V1::GetVisibleThings() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
Actor *actor = NULL; Actor *actor = NULL;
if (lua_isnil(actorObj)) { if (lua_isnil(actorObj)) {
@ -1434,7 +1434,7 @@ void Lua_L1::GetVisibleThings() {
lua_pushobject(result); lua_pushobject(result);
} }
void Lua_L1::SetShadowColor() { void Lua_V1::SetShadowColor() {
int r = (int)lua_getnumber(lua_getparam(1)); int r = (int)lua_getnumber(lua_getparam(1));
int g = (int)lua_getnumber(lua_getparam(2)); int g = (int)lua_getnumber(lua_getparam(2));
int b = (int)lua_getnumber(lua_getparam(3)); int b = (int)lua_getnumber(lua_getparam(3));
@ -1442,7 +1442,7 @@ void Lua_L1::SetShadowColor() {
g_driver->setShadowColor(r, g, b); g_driver->setShadowColor(r, g, b);
} }
void Lua_L1::KillActorShadows() { void Lua_V1::KillActorShadows() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) { if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) {
@ -1453,7 +1453,7 @@ void Lua_L1::KillActorShadows() {
actor->clearShadowPlanes(); actor->clearShadowPlanes();
} }
void Lua_L1::SetActiveShadow() { void Lua_V1::SetActiveShadow() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object shadowIdObj = lua_getparam(2); lua_Object shadowIdObj = lua_getparam(2);
@ -1466,7 +1466,7 @@ void Lua_L1::SetActiveShadow() {
actor->setActiveShadow(shadowId); actor->setActiveShadow(shadowId);
} }
void Lua_L1::SetActorShadowPoint() { void Lua_V1::SetActorShadowPoint() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object xObj = lua_getparam(2); lua_Object xObj = lua_getparam(2);
lua_Object yObj = lua_getparam(3); lua_Object yObj = lua_getparam(3);
@ -1484,7 +1484,7 @@ void Lua_L1::SetActorShadowPoint() {
actor->setShadowPoint(Math::Vector3d(x, y, z)); actor->setShadowPoint(Math::Vector3d(x, y, z));
} }
void Lua_L1::SetActorShadowPlane() { void Lua_V1::SetActorShadowPlane() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object nameObj = lua_getparam(2); lua_Object nameObj = lua_getparam(2);
@ -1498,7 +1498,7 @@ void Lua_L1::SetActorShadowPlane() {
actor->setShadowPlane(name); actor->setShadowPlane(name);
} }
void Lua_L1::AddShadowPlane() { void Lua_V1::AddShadowPlane() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object nameObj = lua_getparam(2); lua_Object nameObj = lua_getparam(2);
@ -1512,7 +1512,7 @@ void Lua_L1::AddShadowPlane() {
actor->addShadowPlane(name); actor->addShadowPlane(name);
} }
void Lua_L1::ActivateActorShadow() { void Lua_V1::ActivateActorShadow() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object shadowIdObj = lua_getparam(2); lua_Object shadowIdObj = lua_getparam(2);
lua_Object stateObj = lua_getparam(3); lua_Object stateObj = lua_getparam(3);
@ -1529,7 +1529,7 @@ void Lua_L1::ActivateActorShadow() {
g_grim->flagRefreshShadowMask(true); g_grim->flagRefreshShadowMask(true);
} }
void Lua_L1::SetActorShadowValid() { void Lua_V1::SetActorShadowValid() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
lua_Object numObj = lua_getparam(2); lua_Object numObj = lua_getparam(2);

View file

@ -51,7 +51,7 @@ void killBitmapPrimitives(Bitmap *bitmap) {
} }
#endif #endif
void Lua_L1::GetImage() { void Lua_V1::GetImage() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
if (!lua_isstring(nameObj)) { if (!lua_isstring(nameObj)) {
lua_pushnil(); lua_pushnil();
@ -62,7 +62,7 @@ void Lua_L1::GetImage() {
lua_pushusertag(b->getId(), MKTAG('V','B','U','F')); lua_pushusertag(b->getId(), MKTAG('V','B','U','F'));
} }
void Lua_L1::FreeImage() { void Lua_V1::FreeImage() {
lua_Object param = lua_getparam(1); lua_Object param = lua_getparam(1);
if (!lua_isuserdata(param) || lua_tag(param) != MKTAG('V','B','U','F')) if (!lua_isuserdata(param) || lua_tag(param) != MKTAG('V','B','U','F'))
return; return;
@ -70,7 +70,7 @@ void Lua_L1::FreeImage() {
delete bitmap; delete bitmap;
} }
void Lua_L1::BlastImage() { void Lua_V1::BlastImage() {
lua_Object param = lua_getparam(1); lua_Object param = lua_getparam(1);
if (!lua_isuserdata(param) || lua_tag(param) != MKTAG('V','B','U','F')) if (!lua_isuserdata(param) || lua_tag(param) != MKTAG('V','B','U','F'))
return; return;
@ -88,17 +88,17 @@ void Lua_L1::BlastImage() {
g_driver->drawBitmap(bitmap); g_driver->drawBitmap(bitmap);
} }
void Lua_L1::CleanBuffer() { void Lua_V1::CleanBuffer() {
g_driver->copyStoredToDisplay(); g_driver->copyStoredToDisplay();
} }
void Lua_L1::StartFullscreenMovie() { void Lua_V1::StartFullscreenMovie() {
lua_Object name = lua_getparam(1); lua_Object name = lua_getparam(1);
if (!lua_isstring(name)) { if (!lua_isstring(name)) {
lua_pushnil(); lua_pushnil();
return; return;
} }
Lua_L1::CleanBuffer(); Lua_V1::CleanBuffer();
GrimEngine::EngineMode prevEngineMode = g_grim->getMode(); GrimEngine::EngineMode prevEngineMode = g_grim->getMode();
g_grim->setMode(GrimEngine::SmushMode); g_grim->setMode(GrimEngine::SmushMode);
@ -109,7 +109,7 @@ void Lua_L1::StartFullscreenMovie() {
pushbool(result); pushbool(result);
} }
void Lua_L1::StartMovie() { void Lua_V1::StartMovie() {
lua_Object name = lua_getparam(1); lua_Object name = lua_getparam(1);
if (!lua_isstring(name)) { if (!lua_isstring(name)) {
lua_pushnil(); lua_pushnil();
@ -135,30 +135,30 @@ void Lua_L1::StartMovie() {
* query should actually detect correctly and not * query should actually detect correctly and not
* just return true whenever ANY movie is playing * just return true whenever ANY movie is playing
*/ */
void Lua_L1::IsFullscreenMoviePlaying() { void Lua_V1::IsFullscreenMoviePlaying() {
pushbool(g_movie->isPlaying()); pushbool(g_movie->isPlaying());
} }
void Lua_L1::IsMoviePlaying() { void Lua_V1::IsMoviePlaying() {
// Previously, if the game was *not* the demo, this checked also if the mode // Previously, if the game was *not* the demo, this checked also if the mode
// was GrimEngine::NormalMode. This doesn't seem to be what original does, and causes // was GrimEngine::NormalMode. This doesn't seem to be what original does, and causes
// bug #301 because the movie eldepot.snm is played before legslide.snm ends. // bug #301 because the movie eldepot.snm is played before legslide.snm ends.
pushbool(g_movie->isPlaying()); pushbool(g_movie->isPlaying());
} }
void Lua_L1::StopMovie() { void Lua_V1::StopMovie() {
g_movie->stop(); g_movie->stop();
} }
void Lua_L1::PauseMovie() { void Lua_V1::PauseMovie() {
g_movie->pause(lua_isnil(lua_getparam(1)) == 0); g_movie->pause(lua_isnil(lua_getparam(1)) == 0);
} }
void Lua_L1::PurgePrimitiveQueue() { void Lua_V1::PurgePrimitiveQueue() {
PrimitiveObject::getPool()->deleteObjects(); PrimitiveObject::getPool()->deleteObjects();
} }
void Lua_L1::DrawPolygon() { void Lua_V1::DrawPolygon() {
lua_Object pointObj; lua_Object pointObj;
Common::Point p1, p2, p3, p4; Common::Point p1, p2, p3, p4;
PoolColor *color = NULL; PoolColor *color = NULL;
@ -225,7 +225,7 @@ void Lua_L1::DrawPolygon() {
lua_pushusertag(p->getId(), MKTAG('P','R','I','M')); lua_pushusertag(p->getId(), MKTAG('P','R','I','M'));
} }
void Lua_L1::DrawLine() { void Lua_V1::DrawLine() {
Common::Point p1, p2; Common::Point p1, p2;
PoolColor *color = NULL;; PoolColor *color = NULL;;
lua_Object x1Obj = lua_getparam(1); lua_Object x1Obj = lua_getparam(1);
@ -264,7 +264,7 @@ void Lua_L1::DrawLine() {
lua_pushusertag(p->getId(), MKTAG('P','R','I','M')); lua_pushusertag(p->getId(), MKTAG('P','R','I','M'));
} }
void Lua_L1::ChangePrimitive() { void Lua_V1::ChangePrimitive() {
PrimitiveObject *psearch, *pmodify = NULL; PrimitiveObject *psearch, *pmodify = NULL;
PoolColor *color = NULL; PoolColor *color = NULL;
@ -373,7 +373,7 @@ void Lua_L1::ChangePrimitive() {
} }
} }
void Lua_L1::DrawRectangle() { void Lua_V1::DrawRectangle() {
Common::Point p1, p2; Common::Point p1, p2;
PoolColor *color = NULL; PoolColor *color = NULL;
lua_Object objX1 = lua_getparam(1); lua_Object objX1 = lua_getparam(1);
@ -412,7 +412,7 @@ void Lua_L1::DrawRectangle() {
lua_pushusertag(p->getId(), MKTAG('P','R','I','M')); // FIXME: we use PRIM usetag here lua_pushusertag(p->getId(), MKTAG('P','R','I','M')); // FIXME: we use PRIM usetag here
} }
void Lua_L1::BlastRect() { void Lua_V1::BlastRect() {
Common::Point p1, p2; Common::Point p1, p2;
PoolColor *color = NULL; PoolColor *color = NULL;
lua_Object objX1 = lua_getparam(1); lua_Object objX1 = lua_getparam(1);
@ -452,7 +452,7 @@ void Lua_L1::BlastRect() {
delete p; delete p;
} }
void Lua_L1::KillPrimitive() { void Lua_V1::KillPrimitive() {
lua_Object primObj = lua_getparam(1); lua_Object primObj = lua_getparam(1);
if (!lua_isuserdata(primObj) || lua_tag(primObj) != MKTAG('P','R','I','M')) if (!lua_isuserdata(primObj) || lua_tag(primObj) != MKTAG('P','R','I','M'))
@ -462,12 +462,12 @@ void Lua_L1::KillPrimitive() {
delete prim; delete prim;
} }
void Lua_L1::DimScreen() { void Lua_V1::DimScreen() {
g_driver->storeDisplay(); g_driver->storeDisplay();
g_driver->dimScreen(); g_driver->dimScreen();
} }
void Lua_L1::DimRegion() { void Lua_V1::DimRegion() {
int x = (int)lua_getnumber(lua_getparam(1)); int x = (int)lua_getnumber(lua_getparam(1));
int y = (int)lua_getnumber(lua_getparam(2)); int y = (int)lua_getnumber(lua_getparam(2));
int w = (int)lua_getnumber(lua_getparam(3)); int w = (int)lua_getnumber(lua_getparam(3));
@ -476,7 +476,7 @@ void Lua_L1::DimRegion() {
g_driver->dimRegion(x, y, w, h, level); g_driver->dimRegion(x, y, w, h, level);
} }
void Lua_L1::ScreenShot() { void Lua_V1::ScreenShot() {
int width = (int)lua_getnumber(lua_getparam(1)); int width = (int)lua_getnumber(lua_getparam(1));
int height = (int)lua_getnumber(lua_getparam(2)); int height = (int)lua_getnumber(lua_getparam(2));
GrimEngine::EngineMode mode = g_grim->getMode(); GrimEngine::EngineMode mode = g_grim->getMode();
@ -492,7 +492,7 @@ void Lua_L1::ScreenShot() {
} }
} }
void Lua_L1::SetGamma() { void Lua_V1::SetGamma() {
lua_Object levelObj = lua_getparam(1); lua_Object levelObj = lua_getparam(1);
if (!lua_isnumber(levelObj)) if (!lua_isnumber(levelObj))
@ -500,16 +500,16 @@ void Lua_L1::SetGamma() {
int level = (int)lua_getnumber(levelObj); int level = (int)lua_getnumber(levelObj);
// FIXME: func(level) // FIXME: func(level)
warning("Lua_L1::SetGamma, implement opcode, level: %d", level); warning("Lua_V1::SetGamma, implement opcode, level: %d", level);
} }
void Lua_L1::Display() { void Lua_V1::Display() {
if (g_grim->getFlipEnable()) { if (g_grim->getFlipEnable()) {
g_driver->flipBuffer(); g_driver->flipBuffer();
} }
} }
void Lua_L1::EngineDisplay() { void Lua_V1::EngineDisplay() {
// it enable/disable updating display // it enable/disable updating display
bool mode = (int)lua_getnumber(lua_getparam(1)) != 0; bool mode = (int)lua_getnumber(lua_getparam(1)) != 0;
if (mode) { if (mode) {
@ -519,11 +519,11 @@ void Lua_L1::EngineDisplay() {
} }
} }
void Lua_L1::ForceRefresh() { void Lua_V1::ForceRefresh() {
g_grim->refreshDrawMode(); g_grim->refreshDrawMode();
} }
void Lua_L1::RenderModeUser() { void Lua_V1::RenderModeUser() {
lua_Object param1 = lua_getparam(1); lua_Object param1 = lua_getparam(1);
if (!lua_isnil(param1) && g_grim->getMode() != GrimEngine::DrawMode) { if (!lua_isnil(param1) && g_grim->getMode() != GrimEngine::DrawMode) {
g_grim->setPreviousMode(g_grim->getMode()); g_grim->setPreviousMode(g_grim->getMode());
@ -536,7 +536,7 @@ void Lua_L1::RenderModeUser() {
} }
} }
void Lua_L1::IrisUp() { void Lua_V1::IrisUp() {
lua_Object xObj = lua_getparam(1); lua_Object xObj = lua_getparam(1);
lua_Object yObj = lua_getparam(2); lua_Object yObj = lua_getparam(2);
lua_Object timeObj = lua_getparam(3); lua_Object timeObj = lua_getparam(3);
@ -544,7 +544,7 @@ void Lua_L1::IrisUp() {
g_grim->playIrisAnimation(Iris::Open, (int)lua_getnumber(xObj), (int)lua_getnumber(yObj), (int)lua_getnumber(timeObj)); g_grim->playIrisAnimation(Iris::Open, (int)lua_getnumber(xObj), (int)lua_getnumber(yObj), (int)lua_getnumber(timeObj));
} }
void Lua_L1::IrisDown() { void Lua_V1::IrisDown() {
lua_Object xObj = lua_getparam(1); lua_Object xObj = lua_getparam(1);
lua_Object yObj = lua_getparam(2); lua_Object yObj = lua_getparam(2);
lua_Object timeObj = lua_getparam(3); lua_Object timeObj = lua_getparam(3);
@ -552,7 +552,7 @@ void Lua_L1::IrisDown() {
g_grim->playIrisAnimation(Iris::Close, (int)lua_getnumber(xObj), (int)lua_getnumber(yObj), (int)lua_getnumber(timeObj)); g_grim->playIrisAnimation(Iris::Close, (int)lua_getnumber(xObj), (int)lua_getnumber(yObj), (int)lua_getnumber(timeObj));
} }
void Lua_L1::PreRender() { void Lua_V1::PreRender() {
g_driver->renderBitmaps(getbool(1)); g_driver->renderBitmaps(getbool(1));
g_driver->renderZBitmaps(getbool(2)); g_driver->renderZBitmaps(getbool(2));
} }

View file

@ -44,7 +44,7 @@ enum ImuseParam {
IM_SOUND_PAN = 0x700 IM_SOUND_PAN = 0x700
}; };
void Lua_L1::ImStartSound() { void Lua_V1::ImStartSound() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
lua_Object priorityObj = lua_getparam(2); lua_Object priorityObj = lua_getparam(2);
lua_Object groupObj = lua_getparam(3); lua_Object groupObj = lua_getparam(3);
@ -65,7 +65,7 @@ void Lua_L1::ImStartSound() {
} }
} }
void Lua_L1::ImStopSound() { void Lua_V1::ImStopSound() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
if (lua_isnumber(nameObj)) if (lua_isnumber(nameObj))
error("ImStopsound: name from value not supported"); error("ImStopsound: name from value not supported");
@ -74,59 +74,59 @@ void Lua_L1::ImStopSound() {
g_imuse->stopSound(soundName); g_imuse->stopSound(soundName);
} }
void Lua_L1::ImStopAllSounds() { void Lua_V1::ImStopAllSounds() {
g_imuse->stopAllSounds(); g_imuse->stopAllSounds();
} }
void Lua_L1::ImPause() { void Lua_V1::ImPause() {
g_imuse->pause(true); g_imuse->pause(true);
} }
void Lua_L1::ImResume() { void Lua_V1::ImResume() {
g_imuse->pause(false); g_imuse->pause(false);
} }
void Lua_L1::ImSetVoiceEffect() { void Lua_V1::ImSetVoiceEffect() {
const char *effectName; const char *effectName;
effectName = luaL_check_string(1); effectName = luaL_check_string(1);
Debug::warning(Debug::Imuse, "ImSetVoiceEffect(%s) Voice effects are not yet supported", effectName); Debug::warning(Debug::Imuse, "ImSetVoiceEffect(%s) Voice effects are not yet supported", effectName);
} }
void Lua_L1::ImSetMusicVol() { void Lua_V1::ImSetMusicVol() {
lua_Object volObj = lua_getparam(1); lua_Object volObj = lua_getparam(1);
if (!lua_isnumber(volObj)) if (!lua_isnumber(volObj))
return; return;
g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (int)lua_getnumber(volObj)); g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (int)lua_getnumber(volObj));
} }
void Lua_L1::ImGetMusicVol() { void Lua_V1::ImGetMusicVol() {
lua_pushnumber(g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kMusicSoundType)); lua_pushnumber(g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kMusicSoundType));
} }
void Lua_L1::ImSetVoiceVol() { void Lua_V1::ImSetVoiceVol() {
lua_Object volObj = lua_getparam(1); lua_Object volObj = lua_getparam(1);
if (!lua_isnumber(volObj)) if (!lua_isnumber(volObj))
return; return;
g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, (int)lua_getnumber(volObj)); g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, (int)lua_getnumber(volObj));
} }
void Lua_L1::ImGetVoiceVol() { void Lua_V1::ImGetVoiceVol() {
lua_pushnumber(g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType)); lua_pushnumber(g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType));
} }
void Lua_L1::ImSetSfxVol() { void Lua_V1::ImSetSfxVol() {
lua_Object volObj = lua_getparam(1); lua_Object volObj = lua_getparam(1);
if (!lua_isnumber(volObj)) if (!lua_isnumber(volObj))
return; return;
g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, (int)lua_getnumber(volObj)); g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, (int)lua_getnumber(volObj));
} }
void Lua_L1::ImGetSfxVol() { void Lua_V1::ImGetSfxVol() {
lua_pushnumber(g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kSFXSoundType)); lua_pushnumber(g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kSFXSoundType));
} }
void Lua_L1::ImSetParam() { void Lua_V1::ImSetParam() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
lua_Object paramObj = lua_getparam(2); lua_Object paramObj = lua_getparam(2);
lua_Object valueObj = lua_getparam(3); lua_Object valueObj = lua_getparam(3);
@ -155,7 +155,7 @@ void Lua_L1::ImSetParam() {
} }
} }
void Lua_L1::ImGetParam() { void Lua_V1::ImGetParam() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
lua_Object paramObj = lua_getparam(2); lua_Object paramObj = lua_getparam(2);
@ -180,7 +180,7 @@ void Lua_L1::ImGetParam() {
} }
} }
void Lua_L1::ImFadeParam() { void Lua_V1::ImFadeParam() {
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
lua_Object opcodeObj = lua_getparam(2); lua_Object opcodeObj = lua_getparam(2);
lua_Object valueObj = lua_getparam(3); lua_Object valueObj = lua_getparam(3);
@ -212,7 +212,7 @@ void Lua_L1::ImFadeParam() {
} }
} }
void Lua_L1::ImSetState() { void Lua_V1::ImSetState() {
lua_Object stateObj = lua_getparam(1); lua_Object stateObj = lua_getparam(1);
if (!lua_isnumber(stateObj)) if (!lua_isnumber(stateObj))
return; return;
@ -220,7 +220,7 @@ void Lua_L1::ImSetState() {
g_imuseState = (int)lua_getnumber(stateObj); g_imuseState = (int)lua_getnumber(stateObj);
} }
void Lua_L1::ImSetSequence() { void Lua_V1::ImSetSequence() {
lua_Object stateObj = lua_getparam(1); lua_Object stateObj = lua_getparam(1);
if (!lua_isnumber(stateObj)) if (!lua_isnumber(stateObj))
return; return;
@ -229,7 +229,7 @@ void Lua_L1::ImSetSequence() {
lua_pushnumber(g_imuse->setMusicSequence(state)); lua_pushnumber(g_imuse->setMusicSequence(state));
} }
void Lua_L1::SaveIMuse() { void Lua_V1::SaveIMuse() {
SaveGame *savedIMuse = SaveGame::openForSaving("grim.tmp"); SaveGame *savedIMuse = SaveGame::openForSaving("grim.tmp");
if (!savedIMuse) if (!savedIMuse)
return; return;
@ -237,7 +237,7 @@ void Lua_L1::SaveIMuse() {
delete savedIMuse; delete savedIMuse;
} }
void Lua_L1::RestoreIMuse() { void Lua_V1::RestoreIMuse() {
SaveGame *savedIMuse = SaveGame::openForLoading("grim.tmp"); SaveGame *savedIMuse = SaveGame::openForLoading("grim.tmp");
if (!savedIMuse) if (!savedIMuse)
return; return;
@ -248,7 +248,7 @@ void Lua_L1::RestoreIMuse() {
g_system->getSavefileManager()->removeSavefile("grim.tmp"); g_system->getSavefileManager()->removeSavefile("grim.tmp");
} }
void Lua_L1::SetSoundPosition() { void Lua_V1::SetSoundPosition() {
Math::Vector3d pos; Math::Vector3d pos;
int minVolume = 10; int minVolume = 10;
int maxVolume = 127; int maxVolume = 127;
@ -309,19 +309,19 @@ void Lua_L1::SetSoundPosition() {
} }
} }
void Lua_L1::IsSoundPlaying() { void Lua_V1::IsSoundPlaying() {
// dummy // dummy
} }
void Lua_L1::PlaySoundAt() { void Lua_V1::PlaySoundAt() {
// dummy // dummy
} }
void Lua_L1::LoadBundle() { void Lua_V1::LoadBundle() {
// loading grimdemo.mus is allready handled // loading grimdemo.mus is allready handled
} }
void Lua_L1::PlaySound() { void Lua_V1::PlaySound() {
// dummy // dummy
} }

View file

@ -45,7 +45,7 @@ namespace Grim {
* note that the menu creates more objects than it needs, * note that the menu creates more objects than it needs,
* so it deletes some objects right after creating them * so it deletes some objects right after creating them
*/ */
void Lua_L1::KillTextObject() { void Lua_V1::KillTextObject() {
lua_Object textObj = lua_getparam(1); lua_Object textObj = lua_getparam(1);
if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) { if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
@ -56,7 +56,7 @@ void Lua_L1::KillTextObject() {
/* Make changes to a text object based on the parameters passed /* Make changes to a text object based on the parameters passed
* in the table in the LUA parameter 2. * in the table in the LUA parameter 2.
*/ */
void Lua_L1::ChangeTextObject() { void Lua_V1::ChangeTextObject() {
const char *line; const char *line;
lua_Object textObj = lua_getparam(1); lua_Object textObj = lua_getparam(1);
int paramId = 2; int paramId = 2;
@ -88,11 +88,11 @@ void Lua_L1::ChangeTextObject() {
* to prevent errors in the "Options" menu even though * to prevent errors in the "Options" menu even though
* we're not currently using the value * we're not currently using the value
*/ */
void Lua_L1::GetTextSpeed() { void Lua_V1::GetTextSpeed() {
lua_pushnumber(g_grim->getTextSpeed()); lua_pushnumber(g_grim->getTextSpeed());
} }
void Lua_L1::SetTextSpeed() { void Lua_V1::SetTextSpeed() {
lua_Object speedObj = lua_getparam(1); lua_Object speedObj = lua_getparam(1);
if (!lua_isnumber(speedObj)) if (!lua_isnumber(speedObj))
return; return;
@ -101,7 +101,7 @@ void Lua_L1::SetTextSpeed() {
g_grim->setTextSpeed(speed); g_grim->setTextSpeed(speed);
} }
void Lua_L1::MakeTextObject() { void Lua_V1::MakeTextObject() {
lua_Object textObj = lua_getparam(1); lua_Object textObj = lua_getparam(1);
if (!lua_isstring(textObj)) { if (!lua_isstring(textObj)) {
return; return;
@ -125,7 +125,7 @@ void Lua_L1::MakeTextObject() {
} }
} }
void Lua_L1::GetTextObjectDimensions() { void Lua_V1::GetTextObjectDimensions() {
lua_Object textObj = lua_getparam(1); lua_Object textObj = lua_getparam(1);
if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) { if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
@ -135,7 +135,7 @@ void Lua_L1::GetTextObjectDimensions() {
} }
} }
void Lua_L1::ExpireText() { void Lua_V1::ExpireText() {
// Expire all the text objects // Expire all the text objects
for (TextObject::Pool::Iterator i = TextObject::getPool()->getBegin(); for (TextObject::Pool::Iterator i = TextObject::getPool()->getBegin();
i != TextObject::getPool()->getEnd(); ++i) i != TextObject::getPool()->getEnd(); ++i)
@ -146,7 +146,7 @@ void Lua_L1::ExpireText() {
i->_value->lineCleanup(); i->_value->lineCleanup();
} }
void Lua_L1::GetTextCharPosition() { void Lua_V1::GetTextCharPosition() {
lua_Object textObj = lua_getparam(1); lua_Object textObj = lua_getparam(1);
if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) { if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
TextObject *textObject = gettextobject(textObj); TextObject *textObject = gettextobject(textObj);
@ -155,7 +155,7 @@ void Lua_L1::GetTextCharPosition() {
} }
} }
void Lua_L1::BlastText() { void Lua_V1::BlastText() {
lua_Object textObj = lua_getparam(1); lua_Object textObj = lua_getparam(1);
if (!lua_isstring(textObj)) { if (!lua_isstring(textObj)) {
return; return;
@ -176,8 +176,8 @@ void Lua_L1::BlastText() {
delete textObject; delete textObject;
} }
void Lua_L1::SetOffscreenTextPos() { void Lua_V1::SetOffscreenTextPos() {
warning("Lua_L1::SetOffscreenTextPos: implement opcode"); warning("Lua_V1::SetOffscreenTextPos: implement opcode");
// this sets where we shouldn't put dialog maybe? // this sets where we shouldn't put dialog maybe?
} }
@ -305,7 +305,7 @@ void LuaBase::setTextObjectParams(TextObjectCommon *textObject, lua_Object table
} }
} }
void Lua_L1::TextFileGetLine() { void Lua_V1::TextFileGetLine() {
char textBuf[1000]; char textBuf[1000];
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
lua_Object posObj = lua_getparam(2); lua_Object posObj = lua_getparam(2);
@ -333,7 +333,7 @@ void Lua_L1::TextFileGetLine() {
lua_pushstring(textBuf); lua_pushstring(textBuf);
} }
void Lua_L1::TextFileGetLineCount() { void Lua_V1::TextFileGetLineCount() {
char textBuf[1000]; char textBuf[1000];
lua_Object nameObj = lua_getparam(1); lua_Object nameObj = lua_getparam(1);
@ -375,7 +375,7 @@ void Lua_L1::TextFileGetLineCount() {
// Localization function // Localization function
void Lua_L1::LocalizeString() { void Lua_V1::LocalizeString() {
char msgId[50], buf[1000]; char msgId[50], buf[1000];
lua_Object strObj = lua_getparam(1); lua_Object strObj = lua_getparam(1);
@ -393,13 +393,13 @@ void Lua_L1::LocalizeString() {
} }
} }
void Lua_L1::SetSayLineDefaults() { void Lua_V1::SetSayLineDefaults() {
lua_Object tableObj = lua_getparam(1); lua_Object tableObj = lua_getparam(1);
if (tableObj && lua_istable(tableObj)) if (tableObj && lua_istable(tableObj))
setTextObjectParams(&g_grim->_sayLineDefaults, tableObj); setTextObjectParams(&g_grim->_sayLineDefaults, tableObj);
} }
void Lua_L1::SayLine() { void Lua_V1::SayLine() {
int vol = 127, buffer = 64, paramId = 1, x = -1, y = -1; int vol = 127, buffer = 64, paramId = 1, x = -1, y = -1;
bool background = true; bool background = true;
const char *msgId = NULL;; const char *msgId = NULL;;
@ -434,7 +434,7 @@ void Lua_L1::SayLine() {
} }
} }
void Lua_L1::ShutUpActor() { void Lua_V1::ShutUpActor() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
@ -444,7 +444,7 @@ void Lua_L1::ShutUpActor() {
actor->shutUp(); actor->shutUp();
} }
void Lua_L1::PrintLine() { void Lua_V1::PrintLine() {
int vol = 127, buffer = 64, /*paramId = 1, */x = -1, y = -1; int vol = 127, buffer = 64, /*paramId = 1, */x = -1, y = -1;
bool background = true; bool background = true;
char msgId[50]; char msgId[50];
@ -467,7 +467,7 @@ void Lua_L1::PrintLine() {
} }
} }
void Lua_L1::InputDialog() { void Lua_V1::InputDialog() {
lua_Object titleObj = lua_getparam(1); lua_Object titleObj = lua_getparam(1);
lua_Object messageObj = lua_getparam(2); lua_Object messageObj = lua_getparam(2);
lua_Object defaultObj = lua_getparam(3); lua_Object defaultObj = lua_getparam(3);
@ -492,7 +492,7 @@ void Lua_L1::InputDialog() {
} }
} }
void Lua_L1::IsMessageGoing() { void Lua_V1::IsMessageGoing() {
lua_Object actorObj = lua_getparam(1); lua_Object actorObj = lua_getparam(1);
if (!actorObj || (lua_isuserdata(actorObj) && lua_tag(actorObj) == MKTAG('A','C','T','R')) || lua_isnil(actorObj)) { if (!actorObj || (lua_isuserdata(actorObj) && lua_tag(actorObj) == MKTAG('A','C','T','R')) || lua_isnil(actorObj)) {

File diff suppressed because it is too large Load diff

View file

@ -27,9 +27,9 @@
namespace Grim { namespace Grim {
class Lua_L2 : public Lua_L1 { class Lua_V2 : public Lua_V1 {
public: public:
typedef Lua_L2 LuaClass; typedef Lua_V2 LuaClass;
void registerOpcodes(); void registerOpcodes();
DECLARE_LUA_OPCODE(UndimAll); DECLARE_LUA_OPCODE(UndimAll);