|
From: <ka...@us...> - 2013-11-03 23:17:17
|
Revision: 8055
http://sourceforge.net/p/paintown/code/8055
Author: kazzmir
Date: 2013-11-03 23:17:14 +0000 (Sun, 03 Nov 2013)
Log Message:
-----------
[mugen] serialize ko and dko fight elements
Modified Paths:
--------------
trunk/src/mugen/animation.cpp
trunk/src/mugen/animation.h
trunk/src/mugen/characterhud.cpp
Modified: trunk/src/mugen/animation.cpp
===================================================================
--- trunk/src/mugen/animation.cpp 2013-11-03 22:59:51 UTC (rev 8054)
+++ trunk/src/mugen/animation.cpp 2013-11-03 23:17:14 UTC (rev 8055)
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
+#include "character-state.h"
#include "sprite.h"
#include "util.h"
#include "exception.h"
@@ -492,7 +493,15 @@
void Animation::setState(const AnimationState & state){
this->state = state;
}
+
+Token * Animation::serialize() const {
+ return ::Mugen::serialize(state);
+}
+void Animation::deserialize(const Token * token){
+ setState(deserializeAnimationState(token));
+}
+
/* who uses this function? */
/*
void Animation::reloadBitmaps(){
Modified: trunk/src/mugen/animation.h
===================================================================
--- trunk/src/mugen/animation.h 2013-11-03 22:59:51 UTC (rev 8054)
+++ trunk/src/mugen/animation.h 2013-11-03 23:17:14 UTC (rev 8055)
@@ -209,6 +209,9 @@
AnimationState & getState();
void setState(const AnimationState & state);
+ Token * serialize() const;
+ void deserialize(const Token * token);
+
protected:
void renderFrame(Frame * frame, int xaxis, int yaxis, const Graphics::Bitmap & work, const Mugen::Effects & effects);
Modified: trunk/src/mugen/characterhud.cpp
===================================================================
--- trunk/src/mugen/characterhud.cpp 2013-11-03 22:59:51 UTC (rev 8054)
+++ trunk/src/mugen/characterhud.cpp 2013-11-03 23:17:14 UTC (rev 8055)
@@ -74,6 +74,10 @@
*token << ticker;
*token << soundTicker;
+ if (type == IS_ACTION && action != NULL){
+ *token << action->serialize();
+ }
+
return token;
}
@@ -96,6 +100,12 @@
soundState = SoundState(i);
view >> ticker;
view >> soundTicker;
+
+ if (type == IS_ACTION && action != NULL){
+ const Token * actionToken = NULL;
+ view >> actionToken;
+ action->deserialize(actionToken);
+ }
}
void FightElement::act(){
@@ -876,6 +886,10 @@
*token << currentRound;
*token << roundEnd;
*token << getRoundElement().serialize();
+
+ *token << KO.serialize();
+ *token << DKO.serialize();
+
return token;
}
@@ -890,6 +904,14 @@
const Token * roundToken = NULL;
view >> roundToken;
getRoundElement().deserialize(roundToken);
+
+ const Token * koToken = NULL;
+ view >> koToken;
+ KO.deserialize(koToken);
+
+ const Token * dkoToken = NULL;
+ view >> dkoToken;
+ DKO.deserialize(dkoToken);
}
bool Round::isWinner(const Mugen::Character & who) const {
|