diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index e38ed3ac..73c813dd 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -3204,6 +3204,19 @@ SDL_Color Graphics::bigchunkygetcol(int t) return color; } +void Graphics::textboxforcepos(int x, int y) +{ + if (!INBOUNDS_VEC(m, textboxes)) + { + vlog_error("textboxforcepos() out-of-bounds!"); + return; + } + + textboxes[m].position_forced = true; + textboxes[m].xp = x; + textboxes[m].yp = y; +} + void Graphics::textboxcenterx(void) { if (!INBOUNDS_VEC(m, textboxes)) diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index bc1dba69..4f805c56 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -94,6 +94,8 @@ public: int r, int g, int b ); + void textboxforcepos(int x, int y); + void textboxcenterx(void); int textboxwidth(void); diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 6a75d560..f3e95342 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -53,6 +53,7 @@ scriptclass::scriptclass(void) textlarge = false; textbox_sprites.clear(); textbox_image = TEXTIMAGE_NONE; + textbox_forcepos = false; } void scriptclass::add_default_colours(void) @@ -566,11 +567,13 @@ void scriptclass::run(void) textcrewmateposition = TextboxCrewmatePosition(); textbox_sprites.clear(); textbox_image = TEXTIMAGE_NONE; + textbox_forcepos = false; } else if (words[0] == "position") { //are we facing left or right? for some objects we don't care, default at 0. j = 0; + textbox_forcepos = false; //the first word is the object to position relative to if (words[1] == "centerx") @@ -592,6 +595,13 @@ void scriptclass::run(void) textx = -500; texty = -500; } + else if (words[1] == "force") + { + words[2] = "donothing"; + j = -1; + textbox_forcepos = true; + + } else // Well, are they asking for a crewmate...? { i = getcrewmanfromname(words[1]); @@ -774,16 +784,23 @@ void scriptclass::run(void) graphics.setimage(textbox_image); - if (textx == -500 || textx == -1) + if (textbox_forcepos) { - graphics.textboxcenterx(); - textcrewmateposition.override_x = false; + graphics.textboxforcepos(textx, texty); } - - if (texty == -500) + else { - graphics.textboxcentery(); - textcrewmateposition.override_y = false; + if (textx == -500 || textx == -1) + { + graphics.textboxcenterx(); + textcrewmateposition.override_x = false; + } + + if (texty == -500) + { + graphics.textboxcentery(); + textcrewmateposition.override_y = false; + } } TextboxOriginalContext context = TextboxOriginalContext(); diff --git a/desktop_version/src/Script.h b/desktop_version/src/Script.h index aa71220d..304f1276 100644 --- a/desktop_version/src/Script.h +++ b/desktop_version/src/Script.h @@ -122,6 +122,7 @@ public: int textboxtimer; std::vector textbox_sprites; TextboxImage textbox_image; + bool textbox_forcepos; //Misc int i, j, k; diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index a95eb87c..5a57a88b 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -29,6 +29,8 @@ textboxclass::textboxclass(int gap) large = false; + position_forced = false; + should_centerx = false; should_centery = false; @@ -78,18 +80,21 @@ void textboxclass::centery(void) void textboxclass::applyposition(void) { resize(); - reposition(); - if (should_centerx) + if (!position_forced) { - centerx(); - } - if (should_centery) - { - centery(); - } - if (translate == TEXTTRANSLATE_CUTSCENE) - { - adjust(); + reposition(); + if (should_centerx) + { + centerx(); + } + if (should_centery) + { + centery(); + } + if (translate == TEXTTRANSLATE_CUTSCENE) + { + adjust(); + } } } diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index 97b12d61..edd7a5de 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -125,6 +125,8 @@ public: bool large; + bool position_forced; + bool should_centerx; bool should_centery;