|
From: <ka...@us...> - 2013-11-03 08:00:30
|
Revision: 8053
http://sourceforge.net/p/paintown/code/8053
Author: kazzmir
Date: 2013-11-03 08:00:25 +0000 (Sun, 03 Nov 2013)
Log Message:
-----------
[mugen] dont use stage ticks to keep track of the current logic cycle
Modified Paths:
--------------
trunk/src/mugen/characterhud.cpp
trunk/src/test/mugen/replay.cpp
Modified: trunk/src/mugen/characterhud.cpp
===================================================================
--- trunk/src/mugen/characterhud.cpp 2013-10-23 19:39:53 UTC (rev 8052)
+++ trunk/src/mugen/characterhud.cpp 2013-11-03 08:00:25 UTC (rev 8053)
@@ -1258,7 +1258,15 @@
player2.setBehavior(player2Behavior);
break;
/* FIXME: not sure what to set for these */
- case RoundOver:
+ case RoundOver: {
+ if (ticker >= overWaitTime){
+ // Remove player control
+ player1.setBehavior(&dummyBehavior);
+ player2.setBehavior(&dummyBehavior);
+ }
+
+ break;
+ }
case DoTimeOver:
default:
break;
@@ -1268,63 +1276,63 @@
void Round::setState(const State & state, Mugen::Stage & stage, Mugen::Character & player1, Mugen::Character & player2){
this->state = state;
switch (this->state){
- case WaitForIntro:
+ case WaitForIntro:
player1.changeState(stage, Mugen::Initialize);
- player2.changeState(stage, Mugen::Initialize);
- break;
- case DisplayIntro:
+ player2.changeState(stage, Mugen::Initialize);
+ break;
+ case DisplayIntro:
/* The initialize state (5900) will call a change state controller
* to change to Intro (190) so there doesn't seem to be a need
* to force the characters to change to their intro's.
* Look in common1.cns
*/
/*
- player1.changeState(stage, Mugen::Intro, vec);
- player2.changeState(stage, Mugen::Intro, vec);
- */
- break;
- case WaitForRound:
+ player1.changeState(stage, Mugen::Intro, vec);
+ player2.changeState(stage, Mugen::Intro, vec);
+ */
+ break;
+ case WaitForRound:
player1.changeState(stage, Mugen::Standing);
player2.changeState(stage, Mugen::Standing);
- break;
- case DisplayRound: {
- FightElement & element = getRoundElement();
- FightElement & soundElement = getRoundSoundElement();
- if (element.notStarted()){
- ostringstream str;
- str << currentRound;
- std::string temp = replaceString("%i",str.str(),defaultText);
- Global::debug(1) << "Displaying Round info: " << temp << endl;
- element.setText(temp);
- element.play();
- soundElement.play();
- }
+ break;
+ case DisplayRound: {
+ FightElement & element = getRoundElement();
+ FightElement & soundElement = getRoundSoundElement();
+ if (element.notStarted()){
+ ostringstream str;
+ str << currentRound;
+ std::string temp = replaceString("%i",str.str(),defaultText);
+ Global::debug(1) << "Displaying Round info: " << temp << endl;
+ element.setText(temp);
+ element.play();
+ soundElement.play();
+ }
+ }
+ break;
+ case WaitForFight:
+ break;
+ case DisplayFight:
+ if (fight.notStarted()){
+ fight.play();
+ fightSound.play();
}
- break;
- case WaitForFight:
break;
- case DisplayFight:
- if (fight.notStarted()){
- fight.play();
- fightSound.play();
- }
- break;
- case PlayingGame:
- // Give control back
+ case PlayingGame:
+ // Give control back
player1.setBehavior(player1Behavior);
player2.setBehavior(player2Behavior);
- break;
- case RoundOver:
- roundEnd = true;
+ break;
+ case RoundOver:
+ roundEnd = true;
overByKO = true;
- // Start slow time
- stage.setGameRate(0.4);
- break;
+ // Start slow time
+ stage.setGameRate(0.4);
+ break;
case DoTimeOver:
overByKO = false;
break;
- default:
- break;
+ default:
+ break;
}
ticker = 0;
}
Modified: trunk/src/test/mugen/replay.cpp
===================================================================
--- trunk/src/test/mugen/replay.cpp 2013-10-23 19:39:53 UTC (rev 8052)
+++ trunk/src/test/mugen/replay.cpp 2013-11-03 08:00:25 UTC (rev 8053)
@@ -362,7 +362,7 @@
Mugen::Input input = inputs[stage.getTicks()];
- Global::debug(0) << "Tick " << stage.getTicks() << " input: " << describeInput(input) << std::endl;
+ Global::debug(1) << "Tick " << stage.getTicks() << " input: " << describeInput(input) << std::endl;
for (vector<Mugen::Command2*>::const_iterator it = commands.begin(); it != commands.end(); it++){
Mugen::Command2 * command = *it;
@@ -559,6 +559,8 @@
stage->logic();
}
}
+
+ Global::debug(0) << worlds.size() << " world states" << std::endl;
Mugen::Random::setState(randomState);
{
@@ -571,13 +573,17 @@
stage->setMatchWins(1);
Global::debug(0) << "Running duplicate simulation" << std::endl;
+ /* We have to keep track of the logic cycles ourselves because the stage ticks
+ * can be unstable depending on the game rate
+ */
+ int logicCycle = 0;
while (!stage->isMatchOver()){
PaintownUtil::ReferenceCount<Mugen::World> newWorld = stage->snapshotState();
- PaintownUtil::ReferenceCount<Mugen::World> oldWorld = worlds[stage->getTicks()];
+ PaintownUtil::ReferenceCount<Mugen::World> oldWorld = worlds[logicCycle];
if (*newWorld != *oldWorld){
string world1 = newWorld->serialize()->toString();
string world2 = oldWorld->serialize()->toString();
- Global::debug(0) << "Worlds are not the same at tick " << stage->getTicks() << std::endl;
+ Global::debug(0) << "Worlds are not the same logic state " << logicCycle << " stage tick " << stage->getTicks() << std::endl;
/*
Global::debug(0) << "Old World: " << oldWorld->serialize()->toString() << std::endl;
Global::debug(0) << "New World: " << newWorld->serialize()->toString() << std::endl;
@@ -590,13 +596,15 @@
return 1;
}
stage->logic();
+ logicCycle += 1;
/* Go back 100 ticks and rerun the simulation */
- if (stage->getTicks() == count){
+ if (logicCycle == count){
int before = count - 100;
Global::debug(0) << "Rewinding by 100 ticks to " << before << std::endl;
stage->updateState(*worlds[before]);
count += 100;
+ logicCycle -= 100;
}
}
}
@@ -618,7 +626,7 @@
} catch (QuitGameException & quit){
}
} else {
- Global::setDebug(1);
+ Global::setDebug(0);
try{
return play();
} catch (...){
|