mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Save text box centering state
This is another piece of state that needs to be kept and re-played when switching language, because a different language could change the dimensions of the text box, which affects how it's centered. Also, to make sure that crewmate positions override any text centering, the scriptclass variables textx and texty should be reset in the position and customposition commands.
This commit is contained in:
parent
e8a231f2e2
commit
0ea0b8e00b
4 changed files with 20 additions and 2 deletions
|
@ -3191,7 +3191,7 @@ void Graphics::textboxcenterx(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textboxes[m].centerx();
|
textboxes[m].should_centerx = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Graphics::textboxwidth(void)
|
int Graphics::textboxwidth(void)
|
||||||
|
@ -3224,7 +3224,7 @@ void Graphics::textboxcentery(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textboxes[m].centery();
|
textboxes[m].should_centery = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Graphics::textboxwrap(int pad)
|
int Graphics::textboxwrap(int pad)
|
||||||
|
|
|
@ -569,6 +569,8 @@ void scriptclass::run(void)
|
||||||
textcrewmateposition.text_above = true;
|
textcrewmateposition.text_above = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textx = 0;
|
||||||
|
texty = 0;
|
||||||
textcrewmateposition.x = obj.entities[i].xp;
|
textcrewmateposition.x = obj.entities[i].xp;
|
||||||
textcrewmateposition.override_x = true;
|
textcrewmateposition.override_x = true;
|
||||||
textcrewmateposition.y = obj.entities[i].yp;
|
textcrewmateposition.y = obj.entities[i].yp;
|
||||||
|
@ -653,6 +655,8 @@ void scriptclass::run(void)
|
||||||
textcrewmateposition.text_above = true;
|
textcrewmateposition.text_above = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textx = 0;
|
||||||
|
texty = 0;
|
||||||
textcrewmateposition.x = obj.entities[i].xp;
|
textcrewmateposition.x = obj.entities[i].xp;
|
||||||
textcrewmateposition.override_x = true;
|
textcrewmateposition.override_x = true;
|
||||||
textcrewmateposition.y = obj.entities[i].xp;
|
textcrewmateposition.y = obj.entities[i].xp;
|
||||||
|
|
|
@ -28,6 +28,9 @@ textboxclass::textboxclass(int gap)
|
||||||
|
|
||||||
large = false;
|
large = false;
|
||||||
|
|
||||||
|
should_centerx = false;
|
||||||
|
should_centery = false;
|
||||||
|
|
||||||
print_flags = PR_FONT_LEVEL;
|
print_flags = PR_FONT_LEVEL;
|
||||||
fill_buttons = false;
|
fill_buttons = false;
|
||||||
|
|
||||||
|
@ -72,6 +75,14 @@ void textboxclass::adjust(void)
|
||||||
{
|
{
|
||||||
resize();
|
resize();
|
||||||
repositionfromcrewmate();
|
repositionfromcrewmate();
|
||||||
|
if (should_centerx)
|
||||||
|
{
|
||||||
|
centerx();
|
||||||
|
}
|
||||||
|
if (should_centery)
|
||||||
|
{
|
||||||
|
centery();
|
||||||
|
}
|
||||||
if (xp < 10) xp = 10;
|
if (xp < 10) xp = 10;
|
||||||
if (yp < 10) yp = 10;
|
if (yp < 10) yp = 10;
|
||||||
if (xp + w > 310) xp = 310 - w;
|
if (xp + w > 310) xp = 310 - w;
|
||||||
|
|
|
@ -94,6 +94,9 @@ public:
|
||||||
|
|
||||||
bool large;
|
bool large;
|
||||||
|
|
||||||
|
bool should_centerx;
|
||||||
|
bool should_centery;
|
||||||
|
|
||||||
uint32_t print_flags;
|
uint32_t print_flags;
|
||||||
bool fill_buttons;
|
bool fill_buttons;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue