mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Add G keybind to go to room
Ved has this useful feature where instead of having to manually travel to a room whose coordinates you know, you can just press G and type in coordinates to go there. VCE added this, but I changed the text to be "x,y" instead of "(x,y)" because otherwise it could confuse someone into thinking they need to type parentheses when in reality they don't need to and typing them will just make it not work. Also I made sure to add an error message if the user types in an invalid format. Failing silently would just confuse people, and maybe they'll start thinking the feature doesn't work or something like that. VCE doesn't have this helpful error message. Lastly, VCE has a bug where if you use the shortcut to go from one horizontally/vertically warping room to another, the background of the previous room will still be there and scroll off with the background of the room you went to, instead of just having the new background only. This is because they forgot a 'graphics.backgrounddrawn = false;'. But don't worry, *I* didn't forget about it.
This commit is contained in:
parent
76d8dc5bf2
commit
450663594f
2 changed files with 22 additions and 1 deletions
|
@ -4295,6 +4295,20 @@ void editorinput()
|
||||||
key.disabletextentry();
|
key.disabletextentry();
|
||||||
switch (ed.textmod)
|
switch (ed.textmod)
|
||||||
{
|
{
|
||||||
|
case TEXT_GOTOROOM:
|
||||||
|
{
|
||||||
|
std::vector<std::string> coords = split(key.keybuffer, ',');
|
||||||
|
if (coords.size() != 2)
|
||||||
|
{
|
||||||
|
ed.note = "[ ERROR: Invalid format ]";
|
||||||
|
ed.notedelay = 45;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ed.levx = clamp(atoi(coords[0].c_str()) - 1, 0, ed.mapwidth - 1);
|
||||||
|
ed.levy = clamp(atoi(coords[1].c_str()) - 1, 0, ed.mapheight - 1);
|
||||||
|
graphics.backgrounddrawn = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TEXT_LOAD:
|
case TEXT_LOAD:
|
||||||
{
|
{
|
||||||
std::string loadstring = ed.filename + ".vvvvvv";
|
std::string loadstring = ed.filename + ".vvvvvv";
|
||||||
|
@ -4692,6 +4706,12 @@ void editorinput()
|
||||||
ed.getlin(TEXT_ROOMNAME, "Enter new room name:", &(ed.level[ed.levx+(ed.levy*ed.maxwidth)].roomname));
|
ed.getlin(TEXT_ROOMNAME, "Enter new room name:", &(ed.level[ed.levx+(ed.levy*ed.maxwidth)].roomname));
|
||||||
game.mapheld=true;
|
game.mapheld=true;
|
||||||
}
|
}
|
||||||
|
if (key.keymap[SDLK_g])
|
||||||
|
{
|
||||||
|
ed.keydelay = 6;
|
||||||
|
ed.getlin(TEXT_GOTOROOM, "Enter room coordinates x,y:", NULL);
|
||||||
|
game.mapheld=true;
|
||||||
|
}
|
||||||
|
|
||||||
//Save and load
|
//Save and load
|
||||||
if(key.keymap[SDLK_s])
|
if(key.keymap[SDLK_s])
|
||||||
|
|
|
@ -18,7 +18,8 @@ enum textmode {
|
||||||
TEXT_ROOMNAME,
|
TEXT_ROOMNAME,
|
||||||
TEXT_SCRIPT,
|
TEXT_SCRIPT,
|
||||||
TEXT_ROOMTEXT,
|
TEXT_ROOMTEXT,
|
||||||
LAST_EDTEXT = TEXT_ROOMTEXT,
|
TEXT_GOTOROOM,
|
||||||
|
LAST_EDTEXT = TEXT_GOTOROOM,
|
||||||
|
|
||||||
// Settings-mode text fields
|
// Settings-mode text fields
|
||||||
TEXT_TITLE,
|
TEXT_TITLE,
|
||||||
|
|
Loading…
Reference in a new issue