mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-28 19:23:53 +00:00
remove frame recording (Demo.cpp) and related code
This commit is contained in:
parent
9bcb34c984
commit
ca4d56b620
7 changed files with 3 additions and 259 deletions
|
@ -11,7 +11,6 @@ SET(AQUARIA_SRCS
|
|||
Continuity.cpp
|
||||
Credits.cpp
|
||||
CurrentRender.cpp
|
||||
Demo.cpp
|
||||
DSQ.cpp
|
||||
Element.cpp
|
||||
Emote.cpp
|
||||
|
|
|
@ -267,7 +267,6 @@ void DSQ::rumble(float leftMotor, float rightMotor, float time, int source, Inpu
|
|||
void DSQ::newGame()
|
||||
{
|
||||
dsq->game->resetFromTitle();
|
||||
dsq->initScene = ;
|
||||
dsq->game->transitionToScene("NaijaCave");
|
||||
}
|
||||
|
||||
|
@ -565,10 +564,8 @@ void DSQ::debugMenu()
|
|||
{
|
||||
dsq->quitNestedMain();
|
||||
}
|
||||
|
||||
else if (c == '5')
|
||||
{
|
||||
|
||||
dsq->game->invinciblity = !dsq->game->invinciblity;
|
||||
}
|
||||
else if (c == '6')
|
||||
|
@ -604,8 +601,6 @@ void DSQ::debugMenu()
|
|||
char read=' ';
|
||||
is >> read >> num;
|
||||
dsq->continuity.learnSong(num);
|
||||
|
||||
|
||||
}
|
||||
else if (c == 'F')
|
||||
{
|
||||
|
@ -627,32 +622,6 @@ void DSQ::debugMenu()
|
|||
is >> read >> nm;
|
||||
dsq->continuity.setCostume(nm);
|
||||
}
|
||||
else if (c == 'R')
|
||||
{
|
||||
dsq->demo.toggleRecord(true);
|
||||
}
|
||||
else if (c == 'P')
|
||||
{
|
||||
dsq->demo.togglePlayback(true);
|
||||
}
|
||||
else if (c == 'T')
|
||||
{
|
||||
if (dsq->demo.frames.size()> 0)
|
||||
{
|
||||
dsq->game->avatar->position = dsq->demo.frames[0].avatarPos;
|
||||
dsq->game->avatar->rotation.z = dsq->demo.frames[0].rot;
|
||||
}
|
||||
}
|
||||
else if (c == 'U')
|
||||
{
|
||||
dsq->demo.renderFramesToDisk();
|
||||
|
||||
|
||||
}
|
||||
else if (c == 'K')
|
||||
{
|
||||
dsq->demo.clearRecordedFrames();
|
||||
}
|
||||
else if (c == 'H')
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
@ -661,12 +630,8 @@ void DSQ::debugMenu()
|
|||
float h = 0;
|
||||
is >> h;
|
||||
dsq->game->avatar->health = h;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3826,8 +3791,6 @@ void DSQ::onUpdate(float dt)
|
|||
|
||||
subtitlePlayer.update(dt);
|
||||
|
||||
demo.update(dt);
|
||||
|
||||
if (joystickEnabled)
|
||||
{
|
||||
if (dsq->getInputMode() != INPUT_JOYSTICK)
|
||||
|
@ -4205,11 +4168,6 @@ void DSQ::modifyDt(float &dt)
|
|||
dt = 1.0f/60.0f;
|
||||
doScreenshot = true;
|
||||
}
|
||||
|
||||
if (dsq->demo.mode == Demo::DEMOMODE_RECORD)
|
||||
{
|
||||
dt = 1.0f/60.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void DSQ::removeElement(Element *element)
|
||||
|
|
|
@ -126,42 +126,6 @@ extern GameplayVariables *vars;
|
|||
|
||||
#include "UserSettings.h"
|
||||
|
||||
struct DemoFrame
|
||||
{
|
||||
float t;
|
||||
Vector avatarPos, vel, vel2;
|
||||
Mouse mouse;
|
||||
float rot;
|
||||
};
|
||||
|
||||
class Demo
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
DEMOMODE_NONE = -1,
|
||||
DEMOMODE_RECORD = 0,
|
||||
DEMOMODE_PLAYBACK = 1
|
||||
};
|
||||
Demo();
|
||||
void toggleRecord(bool on);
|
||||
void togglePlayback(bool on);
|
||||
void renderFramesToDisk();
|
||||
void clearRecordedFrames();
|
||||
|
||||
void update(float dt);
|
||||
|
||||
bool getQuitKey();
|
||||
|
||||
void save(const std::string &name);
|
||||
void load(const std::string &name);
|
||||
|
||||
unsigned int frame;
|
||||
float time;
|
||||
float timeDiff;
|
||||
std::vector <DemoFrame> frames;
|
||||
int mode;
|
||||
};
|
||||
|
||||
enum NagType
|
||||
{
|
||||
NAG_TOTITLE = 0,
|
||||
|
@ -374,8 +338,6 @@ public:
|
|||
|
||||
std::string returnToScene;
|
||||
|
||||
Demo demo;
|
||||
|
||||
DebugFont *fpsText, *cmDebug;
|
||||
DebugFont *console;
|
||||
BitmapText *versionLabel;
|
||||
|
|
168
Aquaria/Demo.cpp
168
Aquaria/Demo.cpp
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2007, 2010 - Bit-Blot
|
||||
|
||||
This file is part of Aquaria.
|
||||
|
||||
Aquaria is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "DSQ.h"
|
||||
#include "Game.h"
|
||||
#include "Avatar.h"
|
||||
|
||||
Demo::Demo()
|
||||
{
|
||||
time = 0;
|
||||
mode = DEMOMODE_NONE;
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
void Demo::toggleRecord(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
togglePlayback(false);
|
||||
frames.clear();
|
||||
mode = DEMOMODE_RECORD;
|
||||
time = 0;
|
||||
timeDiff = 0;
|
||||
frame = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = DEMOMODE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void Demo::togglePlayback(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
core->updateMouse = false;
|
||||
mode = DEMOMODE_PLAYBACK;
|
||||
time = 0;
|
||||
timeDiff = 0;
|
||||
frame = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
core->frameOutputMode = false;
|
||||
core->updateMouse = true;
|
||||
mode = DEMOMODE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void Demo::renderFramesToDisk()
|
||||
{
|
||||
core->frameOutputMode = true;
|
||||
togglePlayback(true);
|
||||
}
|
||||
|
||||
void Demo::save(const std::string &name)
|
||||
{
|
||||
togglePlayback(false);
|
||||
toggleRecord(false);
|
||||
|
||||
std::string filename = "" + name + ".demo";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Demo::load(const std::string &name)
|
||||
{
|
||||
togglePlayback(false);
|
||||
toggleRecord(false);
|
||||
|
||||
// UNFINISHED
|
||||
std::string filename = "" + name + ".demo";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Demo::clearRecordedFrames()
|
||||
{
|
||||
frames.clear();
|
||||
}
|
||||
|
||||
bool Demo::getQuitKey()
|
||||
{
|
||||
return core->getKeyState(KEY_ESCAPE) && core->getShiftState();
|
||||
}
|
||||
|
||||
void Demo::update(float dt)
|
||||
{
|
||||
if (core->getNestedMains() > 1) return;
|
||||
|
||||
if (mode == DEMOMODE_RECORD)
|
||||
{
|
||||
DemoFrame f;
|
||||
f.avatarPos = dsq->game->avatar->position;
|
||||
f.vel = dsq->game->avatar->vel;
|
||||
f.vel2 = dsq->game->avatar->vel2;
|
||||
f.rot = dsq->game->avatar->rotation.z;
|
||||
|
||||
f.mouse = core->mouse;
|
||||
f.t = time;
|
||||
|
||||
frames.push_back(f);
|
||||
|
||||
|
||||
time += dt;
|
||||
|
||||
if (getQuitKey())
|
||||
{
|
||||
toggleRecord(false);
|
||||
dsq->centerMessage(stringbank.get(2010));
|
||||
}
|
||||
}
|
||||
else if (mode == DEMOMODE_PLAYBACK)
|
||||
{
|
||||
while (frame < frames.size())
|
||||
{
|
||||
DemoFrame *f = &frames[frame];
|
||||
if (f->t <= time) {
|
||||
// temporarily deactivate for seahorse footage
|
||||
|
||||
dsq->game->avatar->vel = f->vel;
|
||||
dsq->game->avatar->vel2 = f->vel2;
|
||||
dsq->game->avatar->rotation.z = f->rot;
|
||||
dsq->game->avatar->position = f->avatarPos;
|
||||
|
||||
|
||||
core->mouse = f->mouse;
|
||||
|
||||
frame++;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
time += dt;
|
||||
|
||||
|
||||
if (getQuitKey() || (!frames.empty() && frame >= frames.size())) {
|
||||
togglePlayback(false);
|
||||
dsq->centerMessage(stringbank.get(2011));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -184,9 +184,7 @@ BANKSTRING(2006, "Page")
|
|||
BANKSTRING(2007, "Recipes")
|
||||
BANKSTRING(2008, "error")
|
||||
BANKSTRING(2009, "No Description")
|
||||
BANKSTRING(2010, "Stopped Recording")
|
||||
BANKSTRING(2011, "Stopped Playback")
|
||||
BANKSTRING(2012, "1: Refresh\n2: Heal\n3: Reset Cont.\n5: Set Invincible\n6: Set Flag\n8: All Songs\n9: All Ups\nS: learn song #\nF: Find Entity\nC: Set Costume\n0: Learn MArea Songs\nR: Record Demo\nP: Playback Demo\nT: Rewind Demo\nU: Ouput Demo Frames\nB: Unload Resources\nA: Reload Resources\nM: AutoMap\nJ: JumpState\nQ: QuitNestedMain")
|
||||
BANKSTRING(2012, "1: Refresh\n2: Heal\n3: Reset Cont.\n5: Set Invincible\n6: Set Flag\n8: All Songs\n9: All Ups\nS: learn song #\nF: Find Entity\nC: Set Costume\n0: Learn MArea Songs\nB: Unload Resources\nA: Reload Resources\nJ: JumpState\nQ: QuitNestedMain")
|
||||
BANKSTRING(2013, "health")
|
||||
BANKSTRING(2014, "Enter Flag to Set")
|
||||
BANKSTRING(2015, "Enter Value to Set Flag To")
|
||||
|
@ -263,3 +261,4 @@ BANKSTRING(2156, "Invalid mouse button id: ")
|
|||
BANKSTRING(2157, "Invalid joy axis(+): ")
|
||||
BANKSTRING(2158, "Invalid joy axis(-): ")
|
||||
BANKSTRING(2159, "Press key to assign, Esc to abort, same key or Backspace/Del to clear")
|
||||
|
||||
|
|
|
@ -183,9 +183,7 @@
|
|||
2007 Recipes
|
||||
2008 error
|
||||
2009 No Description
|
||||
2010 Stopped Recording
|
||||
2011 Stopped Playback
|
||||
2012 1: Refresh|2: Heal|3: Reset Cont.|5: Set Invincible|6: Set Flag|8: All Songs|9: All Ups|S: learn song #|F: Find Entity|C: Set Costume|0: Learn MArea Songs|R: Record Demo|P: Playback Demo|T: Rewind Demo|U: Ouput Demo Frames|B: Unload Resources|A: Reload Resources|M: AutoMap|J: JumpState|Q: QuitNestedMain
|
||||
2012 1: Refresh|2: Heal|3: Reset Cont.|5: Set Invincible|6: Set Flag|8: All Songs|9: All Ups|S: learn song #|F: Find Entity|C: Set Costume|0: Learn MArea Songs|B: Unload Resources|A: Reload Resources|J: JumpState|Q: QuitNestedMain
|
||||
2013 health
|
||||
2014 Enter Flag to Set
|
||||
2015 Enter Value to Set Flag To
|
||||
|
|
|
@ -423,10 +423,6 @@
|
|||
RelativePath="..\..\Aquaria\Damage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\Demo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\DSQ.cpp"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue