EMI: Honor X and Y attributes to spoken lines, rebased from Botje.

This commit is contained in:
Joseph Jezak 2014-07-11 11:52:10 -04:00
parent 12f2ef5154
commit 2c563d41b4
5 changed files with 15 additions and 10 deletions

View File

@ -1089,7 +1089,7 @@ Math::Angle Actor::getYawTo(const Math::Vector3d &p) const {
return Math::Angle::arcTangent2(-dpos.x(), dpos.y());
}
void Actor::sayLine(const char *msgId, bool background) {
void Actor::sayLine(const char *msgId, bool background, float x, float y) {
assert(msgId);
if (msgId[0] == 0) {
@ -1209,7 +1209,10 @@ void Actor::sayLine(const char *msgId, bool background) {
if (m == GrimEngine::TextOnly || g_grim->getMode() == GrimEngine::SmushMode) {
textObject->setDuration(500 + msg.size() * 15 * (11 - g_grim->getTextSpeed()));
}
if (g_grim->getMode() == GrimEngine::SmushMode) {
if (g_grim->getGameType() == GType_MONKEY4 && (x != -1 || y != -1)) {
textObject->setX(320 * (x + 1));
textObject->setY(240 * (y + 1));
} else if (g_grim->getMode() == GrimEngine::SmushMode) {
textObject->setX(640 / 2);
textObject->setY(456);
g_grim->setMovieSubtitle(textObject);

View File

@ -428,7 +428,7 @@ public:
* @see isTalking
* @see shutUp
*/
void sayLine(const char *msgId, bool background);
void sayLine(const char *msgId, bool background, float x, float y);
// When we clean all text objects we don't want the actors to clean their
// objects again since they're already freed
void lineCleanup();

View File

@ -427,7 +427,7 @@ Common::String LuaBase::parseMsgText(const char *msg, char *msgId) {
return translation;
}
void LuaBase::parseSayLineTable(lua_Object paramObj, bool *background, int *vol, int *pan, int *x, int *y) {
void LuaBase::parseSayLineTable(lua_Object paramObj, bool *background, int *vol, int *pan, float *x, float *y) {
lua_Object tableObj;
lua_pushobject(paramObj);
@ -435,7 +435,7 @@ void LuaBase::parseSayLineTable(lua_Object paramObj, bool *background, int *vol,
tableObj = lua_gettable();
if (lua_isnumber(tableObj)) {
if (x)
*x = (int)lua_getnumber(tableObj);
*x = lua_getnumber(tableObj);
}
lua_pushobject(paramObj);
@ -443,7 +443,7 @@ void LuaBase::parseSayLineTable(lua_Object paramObj, bool *background, int *vol,
tableObj = lua_gettable();
if (lua_isnumber(tableObj)) {
if (y)
*y = (int)lua_getnumber(tableObj);
*y = lua_getnumber(tableObj);
}
lua_pushobject(paramObj);

View File

@ -112,7 +112,7 @@ public:
virtual bool findCostume(lua_Object costumeObj, Actor *actor, Costume **costume);
virtual Common::String parseMsgText(const char *msg, char *msgId);
virtual void parseSayLineTable(lua_Object paramObj, bool *background, int *vol, int *pan, int *x, int *y);
virtual void parseSayLineTable(lua_Object paramObj, bool *background, int *vol, int *pan, float *x, float *y);
virtual void setTextObjectParams(TextObjectCommon *textObject, lua_Object tableObj);
void update(int frameTime, int movieTime);

View File

@ -268,7 +268,8 @@ void Lua_V1::SetSayLineDefaults() {
}
void Lua_V1::SayLine() {
int vol = 127, buffer = 64, paramId = 1, x = -1, y = -1;
int vol = 127, buffer = 64, paramId = 1;
float x = -1, y = -1;
bool background = true;
const char *msgId = nullptr;
Common::String msg;
@ -297,7 +298,7 @@ void Lua_V1::SayLine() {
paramObj = lua_getparam(paramId++);
}
actor->sayLine(msgId, background); //background, vol, pan, x, y
actor->sayLine(msgId, background, x, y); //background, vol, pan, x, y
}
}
}
@ -313,7 +314,8 @@ void Lua_V1::ShutUpActor() {
}
void Lua_V1::PrintLine() {
int vol = 127, buffer = 64, /*paramId = 1, */x = -1, y = -1;
int vol = 127, buffer = 64; /*paramId = 1, */
float x = -1, y = -1;
bool background = true;
char msgId[50];
Common::String msg;