diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index d994ecd1..b40947ea 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -3344,6 +3344,8 @@ void Graphics::textboxoriginalcontextauto(void) { context.script_name = script.scriptname; } + context.x = textboxes[m].xp; + context.y = textboxes[m].yp; textboxes[m].original = context; } diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index f36c1636..0c08673a 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -773,6 +773,8 @@ void scriptclass::run(void) context.text_case = textcase; context.lines = std::vector(txt); context.script_name = scriptname; + context.x = textx; + context.y = texty; graphics.textboxcrewmateposition(&textcrewmateposition); graphics.textboxoriginalcontext(&context); diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 1d44b2d9..499440ad 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -78,7 +78,7 @@ void textboxclass::centery(void) void textboxclass::applyposition(void) { resize(); - repositionfromcrewmate(); + reposition(); if (should_centerx) { centerx(); @@ -165,11 +165,18 @@ void textboxclass::resize(void) h = lines.size()*(font::height(print_flags) + linegap) + 16 - linegap; } -void textboxclass::repositionfromcrewmate(void) +void textboxclass::reposition(void) { + // Function-based translation overrides position. + if (translate == TEXTTRANSLATE_FUNCTION) + { + return; + } + const int font_height = font::height(print_flags); // Reposition based off crewmate position, if applicable + // Otherwise use original position, if applicable if (crewmate_position.override_x) { if (crewmate_position.dir == 1) // left @@ -181,6 +188,11 @@ void textboxclass::repositionfromcrewmate(void) xp = crewmate_position.x - 16; } } + else + { + xp = original.x; + } + if (crewmate_position.override_y) { if (crewmate_position.text_above) @@ -199,6 +211,10 @@ void textboxclass::repositionfromcrewmate(void) yp = crewmate_position.y + 26; } } + else + { + yp = original.y; + } } void textboxclass::addline(const std::string& t) diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index aaa54ea4..4483491c 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -19,6 +19,8 @@ struct TextboxCrewmatePosition struct TextboxOriginalContext { + int x; + int y; std::vector lines; std::string script_name; char text_case; @@ -85,7 +87,7 @@ public: void resize(void); - void repositionfromcrewmate(void); + void reposition(void); void addline(const std::string& t);