EMI: Stub more Lua_V2-functions, and read most parameters.

CompleteChore
GetSoundVolume
SetSoundVolume
UpdateSoundPosition
ImStateHasLooped
GetCameraPitch
PitchCamera
RollCamera
YawCamera
NukeAllScriptLocks
FRUTEY_Begin
FRUTEY_End
This commit is contained in:
Einar Johan Trøan Sømåen 2013-07-12 17:06:50 +02:00
parent 8637a4adfe
commit ec697300b3
3 changed files with 118 additions and 12 deletions

View File

@ -537,17 +537,62 @@ static void stubError(const char *funcName) {
// STUB_FUNC2(Lua_V2::IsPointInSector)
// STUB_FUNC2(Lua_V2::ThumbnailFromFile)
// Stubbed functions with semi-known arguments:
// TODO: Verify and implement these: (And add type-checking), also rename params
void Lua_V2::GetCameraPitch() {
error("Lua_V2::GetCameraPitch() - TODO: Implement opcode");
}
// No idea about parameter types for these three, presumably float
void Lua_V2::PitchCamera() {
lua_Object param1 = lua_getparam(1);
if (!lua_isnumber(param1))
error("Lua_V2::PitchCamera - Unknown parameters");
float floatValue = lua_getnumber(param1);
error("Lua_V2::PitchCamera(%f) - TODO: Implement opcode", floatValue);
}
void Lua_V2::RollCamera() {
lua_Object param1 = lua_getparam(1);
if (!lua_isnumber(param1))
error("Lua_V2::RollCamera - Unknown parameters");
float floatValue = lua_getnumber(param1);
error("Lua_V2::RollCamera(%f) - TODO: Implement opcode", floatValue);
}
void Lua_V2::YawCamera() {
lua_Object param1 = lua_getparam(1);
if (!lua_isnumber(param1))
error("Lua_V2::YawCamera - Unknown parameters");
float floatValue = lua_getnumber(param1);
error("Lua_V2::YawCamera(%f) - TODO: Implement opcode", floatValue);
}
void Lua_V2::NukeAllScriptLocks() {
error("Lua_V2::NukeAllScriptLocks() - TODO: Implement opcode");
}
void Lua_V2::FRUTEY_Begin() {
lua_Object param1 = lua_getparam(1);
if (!lua_isstring(param1))
error("Lua_V2::FRUTEY_Begin - Unknown parameters");
const char *paramText = lua_getstring(param1);
error("Lua_V2::FRUTEY_Begin(%s) - TODO: Implement opcode", paramText);
}
void Lua_V2::FRUTEY_End() {
error("Lua_V2::FRUTEY_End() - TODO: Implement opcode");
}
// Monkey specific LUA_OPCODEs
STUB_FUNC2(Lua_V2::CompleteChore)
STUB_FUNC2(Lua_V2::GetSoundVolume)
STUB_FUNC2(Lua_V2::SetSoundVolume)
STUB_FUNC2(Lua_V2::UpdateSoundPosition)
STUB_FUNC2(Lua_V2::ImStateHasLooped)
STUB_FUNC2(Lua_V2::YawCamera)
STUB_FUNC2(Lua_V2::GetCameraPitch)
STUB_FUNC2(Lua_V2::PitchCamera)
STUB_FUNC2(Lua_V2::RollCamera)
STUB_FUNC2(Lua_V2::NukeAllScriptLocks)
STUB_FUNC2(Lua_V2::ToggleDebugDraw)
STUB_FUNC2(Lua_V2::ToggleDrawCameras)
STUB_FUNC2(Lua_V2::ToggleDrawLights)
@ -562,8 +607,6 @@ STUB_FUNC2(Lua_V2::SectEditDelete)
STUB_FUNC2(Lua_V2::SectEditInsert)
STUB_FUNC2(Lua_V2::SectEditSortAdd)
STUB_FUNC2(Lua_V2::SectEditForgetIt)
STUB_FUNC2(Lua_V2::FRUTEY_Begin)
STUB_FUNC2(Lua_V2::FRUTEY_End)
struct luaL_reg monkeyMainOpcodes[] = {
// Monkey specific LUA_OPCODEs:

View File

@ -303,6 +303,21 @@ void Lua_V2::AdvanceChore() {
}
}
// TODO: Implement, verify, and rename parameters
void Lua_V2::CompleteChore() {
lua_Object param1 = lua_getparam(1);
lua_Object param2 = lua_getparam(2);
if (!lua_isuserdata(param1) || !lua_isnumber(param2))
error("Lua_V2::CompleteChore - Unknown params");
// Guesswork based on StopChore:
int chore = lua_getuserdata(param1);
float time = lua_getnumber(param2);
error("Lua_V2::CompleteChore(%d, %f) - TODO: Implement opcode", chore, time);
}
void Lua_V2::SetActorSortOrder() {
lua_Object actorObj = lua_getparam(1);
lua_Object orderObj = lua_getparam(2);

View File

@ -117,6 +117,19 @@ void Lua_V2::ImStateHasEnded() {
warning("Lua_V2::ImStateHasEnded: state %d.", state);
}
// TODO: Implement this:
void Lua_V2::ImStateHasLooped() {
lua_Object stateObj = lua_getparam(1);
if (!lua_isnumber(stateObj))
return;
int state = (int)lua_getnumber(stateObj);
// See ImStateHasEnded for clues to return-value
pushbool(false); // TODO: Implement
error("Lua_V2::ImStateHasLooped(%d) - TODO: Implement opcode", state);
}
void Lua_V2::EnableVoiceFX() {
lua_Object stateObj = lua_getparam(1);
@ -315,6 +328,41 @@ void Lua_V2::PlaySoundFrom() {
return PlaySound();
}
// TODO: Implement, verify, and rename parameters
void Lua_V2::GetSoundVolume() {
error("Lua_V2::GetSoundVolume - TODO: Implement opcode");
}
// TODO: Implement, verify, and rename parameters
void Lua_V2::SetSoundVolume() {
lua_Object param1 = lua_getparam(1);
lua_Object param2 = lua_getparam(2);
if (!lua_isuserdata(param1) || !lua_isnumber(param2))
error("Lua_V2::SetSoundVolume - ERROR: Unknown parameters");
int volume = (int)lua_getnumber(param2);
error("Lua_V2::SetSoundVolume(???, %d) - TODO: Implement opcode", volume);
}
// TODO: Implement, verify, and rename parameters
void Lua_V2::UpdateSoundPosition() {
lua_Object param1 = lua_getparam(1);
lua_Object param2 = lua_getparam(2);
lua_Object param3 = lua_getparam(3);
lua_Object param4 = lua_getparam(4);
if (lua_isuserdata(param1) && lua_isnumber(param2) && lua_isnumber(param3) && lua_isnumber(param4)) {
float x = lua_getnumber(param2);
float y = lua_getnumber(param3);
float z = lua_getnumber(param4);
error("Lua_V2::UpdateSoundPosition(???, %f, %f, %f) - TODO: Implement opcode", x, y, z);
} else {
error("Lua_V2::UpdateSoundPosition - ERROR: Unknown parameters");
}
}
void Lua_V2::ImSetMusicVol() {
// This only seems to be used in the demo.
lua_Object volumeObj = lua_getparam(1);