EMI: Implement ToggleOverworld, render overworld

This commit is contained in:
Dries Harnie 2012-02-18 22:20:16 +01:00
parent c91896a0b9
commit 0a4e46827b
4 changed files with 25 additions and 16 deletions

View File

@ -197,7 +197,17 @@ void Lua_V2::GetTextObjectDimensions() {
}
void Lua_V2::ToggleOverworld() {
warning("Lua_V2::ToggleOverworld: implement opcode");
lua_Object boolObj = lua_getparam(1);
bool backToNormal = (lua_isnil(boolObj) == 0);
if (backToNormal) {
GrimEngine::EngineMode previous = g_grim->getPreviousMode();
g_grim->setPreviousMode(GrimEngine::OverworldMode);
g_grim->setMode(previous);
} else {
GrimEngine::EngineMode previous = g_grim->getMode();
g_grim->setPreviousMode(previous);
g_grim->setMode(GrimEngine::OverworldMode);
}
}
void Lua_V2::ClearOverworld() {

View File

@ -461,7 +461,7 @@ void GrimEngine::updateDisplayScene() {
p->draw();
}
drawPrimitives();
} else if (_mode == NormalMode) {
} else if (_mode == NormalMode || _mode == OverworldMode) {
if (!_currSet)
return;

View File

@ -70,7 +70,8 @@ public:
PauseMode = 1,
NormalMode = 2,
SmushMode = 3,
DrawMode = 4
DrawMode = 4,
OverworldMode = 5
};
enum SpeechMode {
TextOnly = 1,

View File

@ -153,20 +153,18 @@ void TextObject::reposition() {
_posX = _x;
_posY = _y;
if (g_grim->getGameType() == GType_MONKEY4) {
if (Overworld::inOverworld) {
if (_posX >= 320) {
_posY = abs(_posY);
} else {
_posX = 320 + _posX;
_posY = 240 - _posY;
}
if (_isSpeech || abs(_posX) >= 320 || abs(_posY) >= 240) {
_posY = _posY > 0 ? 480 - _posY : abs(_posY);
if (_posX < 0)
_posX = _posX + 640;
if (_justify == CENTER && _posX == 0)
_posX = 320;
} else if (g_grim->getMode() == GrimEngine::OverworldMode) {
_posX = 320 + _posX;
_posY = 240 - _posY;
} else {
if (_isSpeech) {
_posY = 480 - _posY;
} else {
_posX = 320 + _posX;
_posY = abs(_posY);
}
_posX = 320 + _posX;
_posY = abs(_posY);
}
Debug::debug(Debug::TextObjects, "Repositioning (%d, %d) -> (%d, %d)", _x, _y, _posX, _posY);
assert(0 <= _posX && _posX <= 640);