Add a player trail to the editor (ghosts)

A few months ago, I added ghosts to the VVVVVV: Community Edition editor. I was told recently I should think
about upstreaming it, and with Terry saying go ahead I finally ported them into VVVVVV. There's one slight
difference however--you can choose whether you have them or not in the editor's settings menu. They're off by
default, and this is saved to the save file.
Anyway, when you're playtesting, the game saves the players position, color, room coordinates and sprite every 3
frames. The max is 100, where if it tries to add more, the oldest one gets removed.
When you exit playtesting, the saved positions appear one at a time, and you can use the Z key to speed it up.

[Here's a video of them in action.](https://o.lol-sa.me/4H21zCv.mp4)
This commit is contained in:
AllyTally
2020-06-12 19:04:35 -03:00
committed by Ethan Lee
parent b2f842376b
commit eb52657c23
8 changed files with 108 additions and 5 deletions

View File

@@ -364,6 +364,8 @@ void Game::init(void)
skipfakeload = false;
ghostsenabled = false;
cliplaytest = false;
playx = 0;
playy = 0;
@@ -4461,6 +4463,11 @@ void Game::loadstats()
}
}
if (pKey == "ghostsenabled")
{
ghostsenabled = atoi(pText);
}
if (pKey == "skipfakeload")
{
skipfakeload = atoi(pText);
@@ -4691,6 +4698,10 @@ void Game::savestats()
msg->LinkEndChild( doc.NewText( help.String(usingmmmmmm).c_str()));
dataNode->LinkEndChild( msg );
msg = doc.NewElement("ghostsenabled");
msg->LinkEndChild(doc.NewText(help.String((int) ghostsenabled).c_str()));
dataNode->LinkEndChild(msg);
msg = doc.NewElement("skipfakeload");
msg->LinkEndChild(doc.NewText(help.String((int) skipfakeload).c_str()));
dataNode->LinkEndChild(msg);
@@ -6778,11 +6789,12 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option("change description");
option("edit scripts");
option("change music");
option("editor ghosts");
option("load level");
option("save level");
option("quit to main menu");
menuxoff = -50;
menuxoff = -46;
menuyoff = -20;
break;
case Menu::ed_desc: