mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-08 18:09:45 +01:00
Add setactivityposition(x,y)
, add new textbox color transparent
(#847)
* Add `setactivityposition(x,y)`, add new textbox color `transparent` This commit adds a new internal command as a part of the visual activity zone changes I've been making. This one allows the user to reposition the activity zone to anywhere on the screen. In addition, this commit adds the textbox color `transparent`, which just sets r, g and b to 0. rgb(0, 0, 0) normally creates the color black, however in VVVVVV textboxes, it makes the background of them invisible, and makes the text the off-white color which the game uses elsewhere. * add new variables to hardreset * Fix unwanted text centering; offset position by 16, 4 It makes sense for `setactivityposition(0, 0)` to place the activity zone in the default position, so the x has been offset by 16, and the y has been offset by 4. Text was being automatically centered, meaning any activity zone which wasn't centered had misplaced text. This has been fixed by calculating the center manually, and offsetting it by the passed value.
This commit is contained in:
parent
700be11137
commit
f3786a8e3f
9 changed files with 56 additions and 3 deletions
|
@ -25,6 +25,9 @@ void blockclass::clear(void)
|
|||
g = 0;
|
||||
b = 0;
|
||||
|
||||
activity_x = 0;
|
||||
activity_y = 0;
|
||||
|
||||
/* std::strings get initialized automatically, but this is */
|
||||
/* in case this function gets called again after construction */
|
||||
script.clear();
|
||||
|
@ -95,6 +98,12 @@ void blockclass::setblockcolour(const char* col)
|
|||
g = 130;
|
||||
b = 20;
|
||||
}
|
||||
else if (SDL_strcmp(col, "transparent") == 0)
|
||||
{
|
||||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//use a gray
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
int xp, yp, wp, hp;
|
||||
std::string script, prompt;
|
||||
int r, g, b;
|
||||
int activity_x, activity_y;
|
||||
};
|
||||
|
||||
#endif /* BLOCKV_H */
|
||||
|
|
|
@ -71,6 +71,8 @@ void entityclass::init(void)
|
|||
customenemy = 0;
|
||||
customwarpmode = false; customwarpmodevon = false; customwarpmodehon = false;
|
||||
customactivitycolour = "";
|
||||
customactivitypositionx = -1;
|
||||
customactivitypositiony = -1;
|
||||
customactivitytext = "";
|
||||
trophytext = 0;
|
||||
oldtrophytext = 0;
|
||||
|
@ -1082,6 +1084,19 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
|
|||
customactivitycolour = "";
|
||||
}
|
||||
|
||||
if (customactivitypositionx != -1)
|
||||
{
|
||||
block.activity_x = customactivitypositionx;
|
||||
block.activity_y = customactivitypositiony;
|
||||
customactivitypositionx = -1;
|
||||
customactivitypositiony = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
block.activity_x = 0;
|
||||
block.activity_y = 0;
|
||||
}
|
||||
|
||||
if (!reuse)
|
||||
{
|
||||
blocks.push_back(block);
|
||||
|
|
|
@ -205,6 +205,8 @@ public:
|
|||
bool customcrewmoods[Game::numcrew];
|
||||
std::string customactivitycolour;
|
||||
std::string customactivitytext;
|
||||
int customactivitypositionx;
|
||||
int customactivitypositiony;
|
||||
};
|
||||
|
||||
#ifndef OBJ_DEFINITION
|
||||
|
|
|
@ -218,6 +218,8 @@ void Game::init(void)
|
|||
activity_r = 0;
|
||||
activity_g = 0;
|
||||
activity_b = 0;
|
||||
activity_x = 0;
|
||||
activity_y = 0;
|
||||
creditposition = 0;
|
||||
oldcreditposition = 0;
|
||||
bestgamedeaths = -1;
|
||||
|
|
|
@ -389,7 +389,7 @@ public:
|
|||
bool activetele;
|
||||
int readytotele;
|
||||
int oldreadytotele;
|
||||
int activity_r, activity_g, activity_b;
|
||||
int activity_r, activity_g, activity_b, activity_x, activity_y;
|
||||
std::string activity_lastprompt;
|
||||
|
||||
std::string telesummary, quicksummary, customquicksummary;
|
||||
|
|
|
@ -1414,6 +1414,8 @@ void gamelogic(void)
|
|||
game.activity_r = obj.blocks[game.activeactivity].r;
|
||||
game.activity_g = obj.blocks[game.activeactivity].g;
|
||||
game.activity_b = obj.blocks[game.activeactivity].b;
|
||||
game.activity_x = obj.blocks[game.activeactivity].activity_x;
|
||||
game.activity_y = obj.blocks[game.activeactivity].activity_y;
|
||||
}
|
||||
|
||||
game.oldreadytotele = game.readytotele;
|
||||
|
|
|
@ -1985,8 +1985,17 @@ void gamerender(void)
|
|||
game.activity_lastprompt.c_str()
|
||||
);
|
||||
|
||||
graphics.drawtextbox(16, 4, 36, 3, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha);
|
||||
graphics.Print(5, 12, final_string, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha, true);
|
||||
int centered_x = ((160 ) - ((graphics.len(final_string)) / 2));
|
||||
|
||||
if (game.activity_r == 0 && game.activity_g == 0 && game.activity_b == 0)
|
||||
{
|
||||
graphics.bprint(centered_x + game.activity_x, game.activity_y + 12, final_string, 196*act_alpha, 196*act_alpha, (255 - help.glow)*act_alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.drawtextbox(game.activity_x + 16, game.activity_y + 4, 36, 3, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha);
|
||||
graphics.Print(centered_x + game.activity_x, game.activity_y + 12, final_string, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.trophytext > 0 || obj.oldtrophytext > 0)
|
||||
|
|
|
@ -468,6 +468,12 @@ void scriptclass::run(void)
|
|||
g = 130;
|
||||
b = 20;
|
||||
}
|
||||
else if (words[1] == "transparent")
|
||||
{
|
||||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//use a gray
|
||||
|
@ -1629,6 +1635,11 @@ void scriptclass::run(void)
|
|||
obj.customactivitytext = commands[position];
|
||||
}
|
||||
}
|
||||
else if (words[0] == "setactivityposition")
|
||||
{
|
||||
obj.customactivitypositionx = ss_toi(words[1]);
|
||||
obj.customactivitypositiony = ss_toi(words[2]);
|
||||
}
|
||||
else if (words[0] == "createrescuedcrew")
|
||||
{
|
||||
//special for final level cutscene
|
||||
|
@ -3274,6 +3285,8 @@ void scriptclass::hardreset(void)
|
|||
|
||||
obj.customactivitycolour = "";
|
||||
obj.customactivitytext = "";
|
||||
obj.customactivitypositionx = -1;
|
||||
obj.customactivitypositiony = -1;
|
||||
}
|
||||
|
||||
void scriptclass::loadcustom(const std::string& t)
|
||||
|
|
Loading…
Reference in a new issue