|
From: <ka...@us...> - 2012-12-30 06:08:53
|
Revision: 7708
http://paintown.svn.sourceforge.net/paintown/?rev=7708&view=rev
Author: kazzmir
Date: 2012-12-30 06:08:35 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
[mugen] have local data and state data for characters
Modified Paths:
--------------
trunk/src/mugen/character.cpp
trunk/src/mugen/character.h
trunk/src/mugen/common.h
trunk/src/mugen/helper.cpp
trunk/src/mugen/state/character-data
trunk/src/mugen/state/serialize.py
trunk/src/mugen/state/state.py
Added Paths:
-----------
trunk/src/mugen/character-state.h
trunk/src/mugen/state/character-data-all
Added: trunk/src/mugen/character-state.h
===================================================================
--- trunk/src/mugen/character-state.h (rev 0)
+++ trunk/src/mugen/character-state.h 2012-12-30 06:08:35 UTC (rev 7708)
@@ -0,0 +1,20 @@
+
+#ifndef _serialize_Mugen_c196ec88f8ebda3f63878e9129656533
+#define _serialize_Mugen_c196ec88f8ebda3f63878e9129656533
+
+#include "common.h"
+
+namespace Mugen{
+
+struct StateData{
+ StateData(){
+
+ }
+
+
+};
+
+}
+
+#endif
+
Modified: trunk/src/mugen/character.cpp
===================================================================
--- trunk/src/mugen/character.cpp 2012-12-30 05:27:08 UTC (rev 7707)
+++ trunk/src/mugen/character.cpp 2012-12-30 06:08:35 UTC (rev 7708)
@@ -561,13 +561,13 @@
Character::Character(const Filesystem::AbsolutePath & s, int alliance):
Object(alliance){
- getStateData().location = s;
+ getLocalData().location = s;
initialize();
}
Character::Character(const Filesystem::AbsolutePath & s, const int x, const int y, int alliance):
Object(x,y, alliance){
- getStateData().location = s;
+ getLocalData().location = s;
initialize();
}
@@ -578,51 +578,51 @@
Character::~Character(){
stopRecording();
- for (vector<Command*>::iterator it = getStateData().commands.begin(); it != getStateData().commands.end(); it++){
+ for (vector<Command*>::iterator it = getLocalData().commands.begin(); it != getLocalData().commands.end(); it++){
delete (*it);
}
}
void Character::initialize(){
- getStateData().max_health = 0;
- getStateData().health = 0;
- getStateData().maxChangeStates = 0;
- getStateData().currentState = Standing;
- getStateData().currentPhysics = Physics::Stand;
- getStateData().moveType = Move::Idle;
- getStateData().wasHitCounter = 0;
- getStateData().frozen = false;
- getStateData().reversalActive = false;
- getStateData().previousState = getStateData().currentState;
- getStateData().stateType = StateType::Stand;
- getStateData().currentAnimation = Standing;
- getStateData().ownPalette = false;
- getStateData().drawAngle = 0;
+ getLocalData().max_health = 0;
+ getLocalData().health = 0;
+ getLocalData().maxChangeStates = 0;
+ getLocalData().currentState = Standing;
+ getLocalData().currentPhysics = Physics::Stand;
+ getLocalData().moveType = Move::Idle;
+ getLocalData().wasHitCounter = 0;
+ getLocalData().frozen = false;
+ getLocalData().reversalActive = false;
+ getLocalData().previousState = getLocalData().currentState;
+ getLocalData().stateType = StateType::Stand;
+ getLocalData().currentAnimation = Standing;
+ getLocalData().ownPalette = false;
+ getLocalData().drawAngle = 0;
/* FIXME: whats the default sprite priority? */
- getStateData().spritePriority = 0;
- getStateData().juggleRemaining = 0;
- getStateData().koecho = false;
- getStateData().defense = 0;
- getStateData().fallDefenseUp = 0;
- getStateData().defenseMultiplier = 1;
- getStateData().attackMultiplier = 1;
- getStateData().lieDownTime = 0;
- getStateData().xscale = 1;
- getStateData().yscale = 1;
- getStateData().debug = false;
- getStateData().has_control = true;
- getStateData().blocking = false;
- getStateData().airjumpnum = 0;
- getStateData().airjumpheight = 35;
- getStateData().guarding = false;
- getStateData().behavior = NULL;
+ getLocalData().spritePriority = 0;
+ getLocalData().juggleRemaining = 0;
+ getLocalData().koecho = false;
+ getLocalData().defense = 0;
+ getLocalData().fallDefenseUp = 0;
+ getLocalData().defenseMultiplier = 1;
+ getLocalData().attackMultiplier = 1;
+ getLocalData().lieDownTime = 0;
+ getLocalData().xscale = 1;
+ getLocalData().yscale = 1;
+ getLocalData().debug = false;
+ getLocalData().has_control = true;
+ getLocalData().blocking = false;
+ getLocalData().airjumpnum = 0;
+ getLocalData().airjumpheight = 35;
+ getLocalData().guarding = false;
+ getLocalData().behavior = NULL;
- getStateData().intpersistindex = 0;
- getStateData().floatpersistindex = 0;
+ getLocalData().intpersistindex = 0;
+ getLocalData().floatpersistindex = 0;
- getStateData().matchWins = 0;
+ getLocalData().matchWins = 0;
- getStateData().combo = 1;
+ getLocalData().combo = 1;
// nextCombo = 0;
// lastTicket = 0;
@@ -631,53 +631,53 @@
//loadSelectData();
/* provide sensible defaults */
- getStateData().walkfwd = 0;
- getStateData().walkback = 0;
- getStateData().runbackx = 0;
- getStateData().runbacky = 0;
- getStateData().runforwardx = 0;
- getStateData().runforwardy = 0;
- getStateData().power = 0;
+ getLocalData().walkfwd = 0;
+ getLocalData().walkback = 0;
+ getLocalData().runbackx = 0;
+ getLocalData().runbacky = 0;
+ getLocalData().runforwardx = 0;
+ getLocalData().runforwardy = 0;
+ getLocalData().power = 0;
- getStateData().velocity_x = 0;
- getStateData().velocity_y = 0;
+ getLocalData().velocity_x = 0;
+ getLocalData().velocity_y = 0;
- getStateData().gravity = 0.1;
- getStateData().standFriction = 0.85;
- getStateData().crouchFriction = 0.82;
+ getLocalData().gravity = 0.1;
+ getLocalData().standFriction = 0.85;
+ getLocalData().crouchFriction = 0.82;
- getStateData().stateTime = 0;
+ getLocalData().stateTime = 0;
/* Regeneration */
- getStateData().regenerateHealth = false;
- getStateData().regenerating = false;
- getStateData().regenerateTime = REGENERATE_TIME;
- getStateData().regenerateHealthDifference = 0;
+ getLocalData().regenerateHealth = false;
+ getLocalData().regenerating = false;
+ getLocalData().regenerateTime = REGENERATE_TIME;
+ getLocalData().regenerateHealthDifference = 0;
}
void Character::loadSelectData(){
/* Load up info for the select screen */
try{
- Filesystem::AbsolutePath baseDir = getStateData().location.getDirectory();
+ Filesystem::AbsolutePath baseDir = getLocalData().location.getDirectory();
Global::debug(1) << baseDir.path() << endl;
- Filesystem::RelativePath str = Filesystem::RelativePath(getStateData().location.getFilename().path());
+ Filesystem::RelativePath str = Filesystem::RelativePath(getLocalData().location.getFilename().path());
const Filesystem::AbsolutePath ourDefFile = Util::fixFileName(baseDir, str.path() + ".def");
if (ourDefFile.isEmpty()){
- Global::debug(1) << "Cannot locate player definition file for: " << getStateData().location.path() << endl;
+ Global::debug(1) << "Cannot locate player definition file for: " << getLocalData().location.path() << endl;
}
AstRef parsed(Util::parseDef(ourDefFile));
// Set name of character
- this->getStateData().name = Mugen::Util::probeDef(parsed, "info", "name");
- this->getStateData().displayName = Mugen::Util::probeDef(parsed, "info", "displayname");
- this->getStateData().sffFile = Mugen::Util::probeDef(parsed, "files", "sprite");
+ this->getLocalData().name = Mugen::Util::probeDef(parsed, "info", "name");
+ this->getLocalData().displayName = Mugen::Util::probeDef(parsed, "info", "displayname");
+ this->getLocalData().sffFile = Mugen::Util::probeDef(parsed, "files", "sprite");
// Get necessary sprites 9000 & 9001 for select screen
/* FIXME: replace 9000 with some readable constant */
- Filesystem::AbsolutePath absoluteSff = Storage::instance().lookupInsensitive(baseDir, Filesystem::RelativePath(this->getStateData().sffFile));
+ Filesystem::AbsolutePath absoluteSff = Storage::instance().lookupInsensitive(baseDir, Filesystem::RelativePath(this->getLocalData().sffFile));
/* FIXME: use getIconAndPortrait so we only load the sff once */
- this->getStateData().sprites[9000][0] = Mugen::Util::probeSff(absoluteSff, 9000, 0, true);
- this->getStateData().sprites[9000][1] = Mugen::Util::probeSff(absoluteSff, 9000, 1, true);
+ this->getLocalData().sprites[9000][0] = Mugen::Util::probeSff(absoluteSff, 9000, 0, true);
+ this->getLocalData().sprites[9000][1] = Mugen::Util::probeSff(absoluteSff, 9000, 1, true);
} catch (const MugenException &ex){
Global::debug(1) << "Couldn't grab details for character!" << endl;
@@ -686,13 +686,13 @@
}
void Character::addCommand(Command * command){
- getStateData().commands.push_back(command);
+ getLocalData().commands.push_back(command);
}
void Character::setAnimation(int animation, int element){
if (getAnimation(animation) != NULL){
- getStateData().foreignAnimation = NULL;
- getStateData().currentAnimation = animation;
+ getLocalData().foreignAnimation = NULL;
+ getLocalData().currentAnimation = animation;
if (getCurrentAnimation() != NULL){
getCurrentAnimation()->reset();
getCurrentAnimation()->setPosition(element);
@@ -710,7 +710,7 @@
}
void Character::loadCmdFile(const Filesystem::RelativePath & path){
- Filesystem::AbsolutePath full = Storage::instance().lookupInsensitive(getStateData().baseDir, path);
+ Filesystem::AbsolutePath full = Storage::instance().lookupInsensitive(getLocalData().baseDir, path);
map<int, PaintownUtil::ReferenceCount<State> > out;
try{
int defaultTime = 15;
@@ -843,7 +843,7 @@
throw MugenException(out.str(), __FILE__, __LINE__);
}
- mergeStates(getStateData().states, out);
+ mergeStates(getLocalData().states, out);
}
static bool isStateDefSection(string name){
@@ -907,28 +907,28 @@
bool Character::canBeHit(Character * enemy){
for (int slot = 0; slot < 2; slot++){
/* Only check active slots */
- if (getStateData().hitByOverride[slot].time > 0){
+ if (getLocalData().hitByOverride[slot].time > 0){
/* FIXME: use hasHitAttribute from above */
/* Check the state type */
if (enemy->getHit().attribute.state == StateType::Crouch &&
- !getStateData().hitByOverride[slot].crouching){
+ !getLocalData().hitByOverride[slot].crouching){
return false;
}
if (enemy->getHit().attribute.state == StateType::Stand &&
- !getStateData().hitByOverride[slot].standing){
+ !getLocalData().hitByOverride[slot].standing){
return false;
}
if (enemy->getHit().attribute.state == StateType::Air &&
- !getStateData().hitByOverride[slot].aerial){
+ !getLocalData().hitByOverride[slot].aerial){
return false;
}
/* Then check the physics type */
AttackType::Attribute hitType = parseAttribute(enemy->getHit().attribute.attackType, enemy->getHit().attribute.physics);
- const vector<AttackType::Attribute> & attributes = getStateData().hitByOverride[slot].attributes;
+ const vector<AttackType::Attribute> & attributes = getLocalData().hitByOverride[slot].attributes;
bool ok = false;
/* The hit type of the hit definition must be in the list of attributes somewhere */
@@ -946,24 +946,24 @@
}
}
- return (getStateData().moveType != Move::Hit) ||
- (getStateData().moveType == Move::Hit && getStateData().juggleRemaining >= enemy->getCurrentJuggle());
+ return (getLocalData().moveType != Move::Hit) ||
+ (getLocalData().moveType == Move::Hit && getLocalData().juggleRemaining >= enemy->getCurrentJuggle());
}
void Character::setConstant(std::string name, const vector<double> & values){
- getStateData().constants[name] = Constant(values);
+ getLocalData().constants[name] = Constant(values);
}
void Character::setConstant(std::string name, double value){
- getStateData().constants[name] = Constant(value);
+ getLocalData().constants[name] = Constant(value);
}
void Character::setFloatVariable(int index, const RuntimeValue & value){
- getStateData().floatVariables[index] = value;
+ getLocalData().floatVariables[index] = value;
}
void Character::setVariable(int index, const RuntimeValue & value){
- getStateData().variables[index] = value;
+ getLocalData().variables[index] = value;
}
static RuntimeValue extractVariable(const map<int, RuntimeValue> & stuff, int index){
@@ -975,27 +975,27 @@
}
RuntimeValue Character::getVariable(int index) const {
- return extractVariable(getStateData().variables, index);
+ return extractVariable(getLocalData().variables, index);
}
RuntimeValue Character::getFloatVariable(int index) const {
- return extractVariable(getStateData().floatVariables, index);
+ return extractVariable(getLocalData().floatVariables, index);
}
void Character::setSystemVariable(int index, const RuntimeValue & value){
- getStateData().systemVariables[index] = value;
+ getLocalData().systemVariables[index] = value;
}
RuntimeValue Character::getSystemVariable(int index) const {
- return extractVariable(getStateData().systemVariables, index);
+ return extractVariable(getLocalData().systemVariables, index);
}
void Character::resetStateTime(){
- getStateData().stateTime = 0;
+ getLocalData().stateTime = 0;
}
void Character::resetJugglePoints(){
- getStateData().juggleRemaining = getJugglePoints();
+ getLocalData().juggleRemaining = getJugglePoints();
}
/*
@@ -1009,8 +1009,8 @@
* pause time reaches 0.
*/
void Character::delayChangeState(Mugen::Stage & stage, int stateNumber){
- getStateData().maxChangeStates += 1;
- if (getStateData().maxChangeStates > 100){
+ getLocalData().maxChangeStates += 1;
+ if (getLocalData().maxChangeStates > 100){
std::ostringstream out;
out << "ChangeState called more than 100 times, most likely this is a bug";
Global::debug(0) << out.str() << std::endl;
@@ -1029,17 +1029,17 @@
/* FIXME: handle movehitpersist
* Note 2: the values of the four Move* triggers reset to 0 and stop incrementing after a state transition. See "movehitpersist" parameter for StateDefs (CNS docs) for how to override this behavior.
*/
- getStateData().hitState.moveContact = 0;
+ getLocalData().hitState.moveContact = 0;
/* reset hit count */
- getStateData().hitCount = 0;
+ getLocalData().hitCount = 0;
ostringstream debug;
debug << getDisplayName() << "-" << getObjectId();
- Global::debug(1, debug.str()) << "Change from state " << getStateData().currentState << " to state " << stateNumber << endl;
- getStateData().previousState = getStateData().currentState;
- getStateData().currentState = stateNumber;
- getStateData().stateTime = -1;
+ Global::debug(1, debug.str()) << "Change from state " << getLocalData().currentState << " to state " << stateNumber << endl;
+ getLocalData().previousState = getLocalData().currentState;
+ getLocalData().currentState = stateNumber;
+ getLocalData().stateTime = -1;
/*
if (getState(currentState) != NULL){
PaintownUtil::ReferenceCount<State> state = getState(currentState);
@@ -1054,8 +1054,8 @@
/* Immediately changes to a state and activates it */
void Character::changeState(Mugen::Stage & stage, int stateNumber){
- getStateData().maxChangeStates += 1;
- if (getStateData().maxChangeStates > 100){
+ getLocalData().maxChangeStates += 1;
+ if (getLocalData().maxChangeStates > 100){
std::ostringstream out;
out << "ChangeState called more than 100 times, most likely this is a bug";
Global::debug(0) << out.str() << std::endl;
@@ -1074,35 +1074,35 @@
/* FIXME: handle movehitpersist
* Note 2: the values of the four Move* triggers reset to 0 and stop incrementing after a state transition. See "movehitpersist" parameter for StateDefs (CNS docs) for how to override this behavior.
*/
- getStateData().hitState.moveContact = 0;
+ getLocalData().hitState.moveContact = 0;
/* reset hit count */
- getStateData().hitCount = 0;
+ getLocalData().hitCount = 0;
ostringstream debug;
debug << getDisplayName() << "-" << getObjectId();
- Global::debug(1, debug.str()) << "Change from state " << getStateData().currentState << " to state " << stateNumber << endl;
- getStateData().previousState = getStateData().currentState;
- getStateData().currentState = stateNumber;
+ Global::debug(1, debug.str()) << "Change from state " << getLocalData().currentState << " to state " << stateNumber << endl;
+ getLocalData().previousState = getLocalData().currentState;
+ getLocalData().currentState = stateNumber;
resetStateTime();
- if (getState(getStateData().currentState) != NULL){
- PaintownUtil::ReferenceCount<State> state = getState(getStateData().currentState);
+ if (getState(getLocalData().currentState) != NULL){
+ PaintownUtil::ReferenceCount<State> state = getState(getLocalData().currentState);
state->transitionTo(stage, *this);
- doStates(stage, getStateData().active, getStateData().currentState);
+ doStates(stage, getLocalData().active, getLocalData().currentState);
} else {
- Global::debug(0, debug.str()) << "Unknown state " << getStateData().currentState << endl;
+ Global::debug(0, debug.str()) << "Unknown state " << getLocalData().currentState << endl;
}
}
/* TODO: get rid of the inputs parameter */
void Character::changeOwnState(Mugen::Stage & stage, int state, const std::vector<std::string> & inputs){
- getStateData().characterData.who = NULL;
- getStateData().characterData.enabled = false;
+ getLocalData().characterData.who = NULL;
+ getLocalData().characterData.enabled = false;
changeState(stage, state);
}
void Character::loadCnsFile(const Filesystem::RelativePath & path){
- Filesystem::AbsolutePath full = Storage::instance().findInsensitive(Storage::instance().cleanse(getStateData().baseDir).join(path));
+ Filesystem::AbsolutePath full = Storage::instance().findInsensitive(Storage::instance().cleanse(getLocalData().baseDir).join(path));
try{
/* cns can use the Cmd parser */
AstRef parsed(Util::parseCmd(full));
@@ -1334,41 +1334,41 @@
simple.view() >> x;
self.setHeight(x);
} else if (simple == "xscale"){
- simple.view() >> self.getStateData().xscale;
+ simple.view() >> self.getLocalData().xscale;
} else if (simple == "yscale"){
- simple.view() >> self.getStateData().yscale;
+ simple.view() >> self.getLocalData().yscale;
} else if (simple == "ground.back"){
- simple.view() >> self.getStateData().groundback;
+ simple.view() >> self.getLocalData().groundback;
} else if (simple == "ground.front"){
- simple.view() >> self.getStateData().groundfront;
+ simple.view() >> self.getLocalData().groundfront;
} else if (simple == "air.back"){
- simple.view() >> self.getStateData().airback;
+ simple.view() >> self.getLocalData().airback;
} else if (simple == "air.front"){
- simple.view() >> self.getStateData().airfront;
+ simple.view() >> self.getLocalData().airfront;
} else if (simple == "attack.dist"){
- simple.view() >> self.getStateData().attackdist;
+ simple.view() >> self.getLocalData().attackdist;
} else if (simple == "proj.attack.dist"){
- simple.view() >> self.getStateData().projattackdist;
+ simple.view() >> self.getLocalData().projattackdist;
} else if (simple == "proj.doscale"){
- simple.view() >> self.getStateData().projdoscale;
+ simple.view() >> self.getLocalData().projdoscale;
} else if (simple == "head.pos"){
int x=0,y=0;
try{
- simple.view() >> self.getStateData().headPosition.x >> self.getStateData().headPosition.y;
+ simple.view() >> self.getLocalData().headPosition.x >> self.getLocalData().headPosition.y;
} catch (const Ast::Exception & e){
}
} else if (simple == "mid.pos"){
int x=0,y=0;
try{
- simple.view() >> self.getStateData().midPosition.x >> self.getStateData().midPosition.y;
+ simple.view() >> self.getLocalData().midPosition.x >> self.getLocalData().midPosition.y;
} catch (const Ast::Exception & e){
}
} else if (simple == "shadowoffset"){
- simple.view() >> self.getStateData().shadowoffset;
+ simple.view() >> self.getLocalData().shadowoffset;
} else if (simple == "draw.offset"){
int x=0,y=0;
try{
- simple.view() >> self.getStateData().drawOffset.x >> self.getStateData().drawOffset.y;
+ simple.view() >> self.getLocalData().drawOffset.x >> self.getLocalData().drawOffset.y;
} catch (const Ast::Exception & e){
}
}
@@ -1750,18 +1750,18 @@
}
}
- mergeStates(getStateData().states, out);
+ mergeStates(getLocalData().states, out);
}
void Character::startRecording(int count){
- getStateData().record = PaintownUtil::ReferenceCount<RecordingInformation>(new RecordingInformation());
+ getLocalData().record = PaintownUtil::ReferenceCount<RecordingInformation>(new RecordingInformation());
ostringstream filename;
filename << getDisplayName() << "-" << count << ".txt";
- getStateData().record->out.open(filename.str().c_str());
- if (!getStateData().record->out.good()){
+ getLocalData().record->out.open(filename.str().c_str());
+ if (!getLocalData().record->out.good()){
Global::debug(0) << "Could not record " << filename.str() << std::endl;
}
- getStateData().record->ticks = 1;
+ getLocalData().record->ticks = 1;
}
static bool differentCommands(std::vector<std::string> list1, std::vector<std::string> list2){
@@ -1782,13 +1782,13 @@
}
void Character::recordCommands(const std::vector<std::string> & commands){
- if (getStateData().record != NULL){
- if (differentCommands(commands, getStateData().record->commands)){
- getStateData().record->out << getStateData().record->ticks << " " << PaintownUtil::join(getStateData().record->commands, ", ") << std::endl;
- getStateData().record->ticks = 1;
- getStateData().record->commands = commands;
+ if (getLocalData().record != NULL){
+ if (differentCommands(commands, getLocalData().record->commands)){
+ getLocalData().record->out << getLocalData().record->ticks << " " << PaintownUtil::join(getLocalData().record->commands, ", ") << std::endl;
+ getLocalData().record->ticks = 1;
+ getLocalData().record->commands = commands;
} else {
- getStateData().record->ticks += 1;
+ getLocalData().record->ticks += 1;
}
}
}
@@ -1797,11 +1797,11 @@
/* force the last set of commands to be written if any */
std::vector<std::string> last;
recordCommands(last);
- getStateData().record = NULL;
+ getLocalData().record = NULL;
}
void Character::checkStateControllers(){
- for (map<int, PaintownUtil::ReferenceCount<State> >::iterator it = getStateData().states.begin(); it != getStateData().states.end(); it++){
+ for (map<int, PaintownUtil::ReferenceCount<State> >::iterator it = getLocalData().states.begin(); it != getLocalData().states.end(); it++){
PaintownUtil::ReferenceCount<State> state = it->second;
if (state->getControllers().size() == 0){
std::ostringstream out;
@@ -1834,20 +1834,20 @@
}
#endif
- MessageQueue::info("Loading " + getStateData().location.getFilename().path());
+ MessageQueue::info("Loading " + getLocalData().location.getFilename().path());
// baseDir = Filesystem::cleanse(Mugen::Util::getFileDir(location));
- getStateData().baseDir = getStateData().location.getDirectory();
+ getLocalData().baseDir = getLocalData().location.getDirectory();
// const std::string ourDefFile = location;
- AstRef parsed(Util::parseDef(getStateData().location));
+ AstRef parsed(Util::parseDef(getLocalData().location));
try{
/* Every character should have a [Files] section at least. Possibly [Info] as well
* but I'm not sure yet.
*/
if (parsed->findSection("files") == NULL){
std::ostringstream out;
- out << "Could not find a [Files] section in " << getStateData().location.path();
+ out << "Could not find a [Files] section in " << getLocalData().location.path();
throw MugenException(out.str(), __FILE__, __LINE__);
}
/* Extract info for our first section of our stage */
@@ -1869,34 +1869,34 @@
virtual void onAttributeSimple(const Ast::AttributeSimple & simple){
if (simple == "name"){
try{
- simple.view() >> self.getStateData().name;
+ simple.view() >> self.getLocalData().name;
} catch (const Ast::Exception & fail){
}
} else if (simple == "displayname"){
try{
- simple.view() >> self.getStateData().displayName;
+ simple.view() >> self.getLocalData().displayName;
} catch (const Ast::Exception & fail){
}
} else if (simple == "versiondate"){
try{
- simple.view() >> self.getStateData().versionDate;
+ simple.view() >> self.getLocalData().versionDate;
} catch (const Ast::Exception & fail){
}
} else if (simple == "mugenversion"){
try{
- simple.view() >> self.getStateData().mugenVersion;
+ simple.view() >> self.getLocalData().mugenVersion;
} catch (const Ast::Exception & fail){
}
} else if (simple == "author"){
try{
- simple.view() >> self.getStateData().author;
+ simple.view() >> self.getLocalData().author;
} catch (const Ast::Exception & fail){
}
} else if (simple == "pal.defaults"){
vector<int> numbers;
simple.view() >> numbers;
for (vector<int>::iterator it = numbers.begin(); it != numbers.end(); it++){
- self.getStateData().palDefaults.push_back((*it) - 1);
+ self.getLocalData().palDefaults.push_back((*it) - 1);
}
// Global::debug(1) << "Pal" << self.palDefaults.size() << ": " << num << endl;
} else if (simple == "localcoord"){
@@ -1926,7 +1926,7 @@
if (simple == "cmd"){
string file;
simple.view() >> file;
- self.getStateData().cmdFile = Filesystem::RelativePath(file);
+ self.getLocalData().cmdFile = Filesystem::RelativePath(file);
/* loaded later after the state files */
} else if (simple == "cns"){
string file;
@@ -1938,25 +1938,25 @@
if (num >= 0 && num <= 12){
string path;
simple.view() >> path;
- stateFiles.push_back(Location(self.getStateData().baseDir, path));
+ stateFiles.push_back(Location(self.getLocalData().baseDir, path));
// simple >> self.stFile[num];
}
} else if (simple == "stcommon"){
string path;
simple.view() >> path;
- stateFiles.insert(stateFiles.begin(), Location(self.getStateData().baseDir, path));
+ stateFiles.insert(stateFiles.begin(), Location(self.getLocalData().baseDir, path));
} else if (simple == "st"){
string path;
simple.view() >> path;
- stateFiles.push_back(Location(self.getStateData().baseDir, path));
+ stateFiles.push_back(Location(self.getLocalData().baseDir, path));
} else if (simple == "sprite"){
- simple.view() >> self.getStateData().sffFile;
+ simple.view() >> self.getLocalData().sffFile;
} else if (simple == "anim"){
- simple.view() >> self.getStateData().airFile;
+ simple.view() >> self.getLocalData().airFile;
} else if (simple == "sound"){
- simple.view() >> self.getStateData().sndFile;
+ simple.view() >> self.getLocalData().sndFile;
// Mugen::Util::readSounds(Mugen::Util::fixFileName(self.baseDir, self.sndFile), self.sounds);
- Util::readSounds(Storage::instance().lookupInsensitive(self.getStateData().baseDir, Filesystem::RelativePath(self.getStateData().sndFile)), self.getStateData().sounds);
+ Util::readSounds(Storage::instance().lookupInsensitive(self.getLocalData().baseDir, Filesystem::RelativePath(self.getLocalData().sndFile)), self.getLocalData().sounds);
} else if (PaintownUtil::matchRegex(PaintownUtil::lowerCaseAll(simple.idString()), PaintownUtil::Regex("pal[0-9]+"))){
int num = atoi(PaintownUtil::captureRegex(PaintownUtil::lowerCaseAll(simple.idString()), PaintownUtil::Regex("pal([0-9]+)"), 0).c_str());
try{
@@ -1965,7 +1965,7 @@
* pal2 =
*/
simple.view() >> what;
- self.getStateData().palFile[num] = what;
+ self.getLocalData().palFile[num] = what;
} catch (const Ast::Exception & fail){
Global::debug(1) << "No palette defined for " << num << std::endl;
}
@@ -1975,7 +1975,7 @@
}
};
- FilesWalker walker(*this, getStateData().location);
+ FilesWalker walker(*this, getLocalData().location);
Ast::Section * section = *section_it;
section->walk(walker);
@@ -2002,7 +2002,7 @@
}
- loadCmdFile(getStateData().cmdFile);
+ loadCmdFile(getLocalData().cmdFile);
compileTime.endTime();
Global::debug(1) << compileTime.printTime("Compile time") << std::endl;
@@ -2078,12 +2078,12 @@
virtual void onAttributeSimple(const Ast::AttributeSimple & simple){
if (simple == "intro.storyboard"){
try{
- simple.view() >> self.getStateData().introFile;
+ simple.view() >> self.getLocalData().introFile;
} catch (const Ast::Exception & fail){
}
} else if (simple == "ending.storyboard"){
try{
- simple.view() >> self.getStateData().endingFile;
+ simple.view() >> self.getLocalData().endingFile;
} catch (const Ast::Exception & fail){
}
} else {
@@ -2099,7 +2099,7 @@
}
} catch (const Ast::Exception & e){
ostringstream out;
- out << "Could not load " << getStateData().location.path() << ": " << e.getReason();
+ out << "Could not load " << getLocalData().location.path() << ": " << e.getReason();
throw MugenException(out.str(), __FILE__, __LINE__);
}
@@ -2113,10 +2113,10 @@
}
// Current palette
- if (getStateData().palDefaults.empty()){
+ if (getLocalData().palDefaults.empty()){
// Correct the palette defaults
- for (unsigned int i = 0; i < getStateData().palFile.size(); ++i){
- getStateData().palDefaults.push_back(i);
+ for (unsigned int i = 0; i < getLocalData().palFile.size(); ++i){
+ getLocalData().palDefaults.push_back(i);
}
}
/*
@@ -2138,19 +2138,19 @@
}
*/
std::string paletteFile = "";
- getStateData().currentPalette = useAct;
- if (getStateData().palFile.find(getStateData().currentPalette) == getStateData().palFile.end()){
+ getLocalData().currentPalette = useAct;
+ if (getLocalData().palFile.find(getLocalData().currentPalette) == getLocalData().palFile.end()){
/* FIXME: choose a default. its not just palette 1 because that palette
* might not exist
*/
- Global::debug(1) << "Couldn't find palette: " << getStateData().currentPalette << " in palette collection. Defaulting to internal palette if available." << endl;
- if (getStateData().palFile.size() > 0){
- paletteFile = getStateData().palFile.begin()->second;
+ Global::debug(1) << "Couldn't find palette: " << getLocalData().currentPalette << " in palette collection. Defaulting to internal palette if available." << endl;
+ if (getLocalData().palFile.size() > 0){
+ paletteFile = getLocalData().palFile.begin()->second;
}
} else {
- if (getStateData().currentPalette < getStateData().palFile.size()){
- paletteFile = getStateData().palFile[getStateData().currentPalette];
- Global::debug(2) << "Current pal: " << getStateData().currentPalette << " | Palette File: " << paletteFile << endl;
+ if (getLocalData().currentPalette < getLocalData().palFile.size()){
+ paletteFile = getLocalData().palFile[getLocalData().currentPalette];
+ Global::debug(2) << "Current pal: " << getLocalData().currentPalette << " | Palette File: " << paletteFile << endl;
}
}
/*
@@ -2163,16 +2163,16 @@
// Mugen::Util::readSprites( Mugen::Util::fixFileName(baseDir, sffFile), Mugen::Util::fixFileName(baseDir, paletteFile), sprites);
Filesystem::AbsolutePath finalPalette;
try{
- finalPalette = Storage::instance().lookupInsensitive(getStateData().baseDir, Filesystem::RelativePath(paletteFile));
+ finalPalette = Storage::instance().lookupInsensitive(getLocalData().baseDir, Filesystem::RelativePath(paletteFile));
} catch (const Filesystem::Exception & fail){
Global::debug(0) << "Couldn't find palette for '" << paletteFile << "' because " << fail.getTrace() << endl;
/* ignore palette */
}
- Util::readSprites(Storage::instance().lookupInsensitive(getStateData().baseDir, Filesystem::RelativePath(getStateData().sffFile)), finalPalette, getStateData().sprites, true);
+ Util::readSprites(Storage::instance().lookupInsensitive(getLocalData().baseDir, Filesystem::RelativePath(getLocalData().sffFile)), finalPalette, getLocalData().sprites, true);
Global::debug(2) << "Reading Air (animation) Data..." << endl;
/* Animations */
// animations = Mugen::Util::loadAnimations(Mugen::Util::fixFileName(baseDir, airFile), sprites);
- getStateData().animations = Util::loadAnimations(Storage::instance().lookupInsensitive(getStateData().baseDir, Filesystem::RelativePath(getStateData().airFile)), getStateData().sprites, true);
+ getLocalData().animations = Util::loadAnimations(Storage::instance().lookupInsensitive(getLocalData().baseDir, Filesystem::RelativePath(getLocalData().airFile)), getLocalData().sprites, true);
fixAssumptions();
@@ -2185,15 +2185,15 @@
}
bool Character::isBound() const {
- return getStateData().bind.time > 0;
+ return getLocalData().bind.time > 0;
}
void Character::bindTo(const Character * bound, int time, int facing, double offsetX, double offsetY){
- getStateData().bind.bound = bound;
- getStateData().bind.time = time;
- getStateData().bind.facing = facing;
- getStateData().bind.offsetX = offsetX;
- getStateData().bind.offsetY = offsetY;
+ getLocalData().bind.bound = bound;
+ getLocalData().bind.time = time;
+ getLocalData().bind.facing = facing;
+ getLocalData().bind.offsetX = offsetX;
+ getLocalData().bind.offsetY = offsetY;
}
bool Character::hasAnimation(int index) const {
@@ -2243,10 +2243,10 @@
/* TODO: get rid of inputs */
void Character::stopGuarding(Mugen::Stage & stage, const vector<string> & inputs){
- getStateData().guarding = false;
- if (getStateData().stateType == StateType::Crouch){
+ getLocalData().guarding = false;
+ if (getLocalData().stateType == StateType::Crouch){
changeState(stage, Crouching);
- } else if (getStateData().stateType == StateType::Air){
+ } else if (getLocalData().stateType == StateType::Air){
changeState(stage, 51);
} else {
changeState(stage, Standing);
@@ -2277,7 +2277,7 @@
* or holdback is pressed
*/
- if (getStateData().states[-1] != 0){
+ if (getLocalData().states[-1] != 0){
/* walk */
{
ostringstream raw;
@@ -2286,7 +2286,7 @@
raw << "trigger1 = command = \"holdfwd\"\n";
raw << "trigger2 = command = \"holdback\"\n";
raw << "value = " << WalkingForwards << "\n";
- getStateData().states[-1]->addController(parseController(raw.str(), "paintown internal walk", -1, StateController::ChangeState));
+ getLocalData().states[-1]->addController(parseController(raw.str(), "paintown internal walk", -1, StateController::ChangeState));
}
@@ -2300,7 +2300,7 @@
raw << "trigger2 = stateno = " << WalkingForwards << "\n";
raw << "triggerall = command = \"holddown\"\n";
- getStateData().states[-1]->addControllerFront(parseController(raw.str(), "paintown internal crouch", -1, StateController::ChangeState));
+ getLocalData().states[-1]->addControllerFront(parseController(raw.str(), "paintown internal crouch", -1, StateController::ChangeState));
}
/* jump */
@@ -2328,7 +2328,7 @@
controller->addTrigger(1, Compiler::compileAndDelete(new Ast::ExpressionInfix(-1, -1, Ast::ExpressionInfix::Equals,
new Ast::SimpleIdentifier("command"),
new Ast::String(-1, -1, new string("holdup")))));
- getStateData().states[-1]->addController(controller);
+ getLocalData().states[-1]->addController(controller);
}
/* double jump */
@@ -2375,12 +2375,12 @@
// new Ast::String(new string("holdup")
new Ast::String(-1, -1, new string(jumpCommand)
))));
- getStateData().states[-1]->addController(controller);
+ getLocalData().states[-1]->addController(controller);
}
}
{
- if (getStateData().states[StopGuardStand] != 0){
+ if (getLocalData().states[StopGuardStand] != 0){
class StopGuardStandController: public StateController {
public:
StopGuardStandController():
@@ -2400,55 +2400,55 @@
controller->addTrigger(1, Compiler::compileAndDelete(new Ast::ExpressionInfix(-1, -1, Ast::ExpressionInfix::Equals,
new Ast::SimpleIdentifier("animtime"),
new Ast::Number(-1, -1, 0))));
- getStateData().states[StopGuardStand]->addController(controller);
+ getLocalData().states[StopGuardStand]->addController(controller);
}
}
/* need a 20 state controller that changes to state 0 if holdfwd
* or holdback is not pressed
*/
- if (getStateData().states[20] != 0){
+ if (getLocalData().states[20] != 0){
ostringstream raw;
raw << "[State 20, paintown-internal-stop-walking]\n";
raw << "value = " << Standing << "\n";
raw << "trigger1 = command != \"holdfwd\"\n";
raw << "trigger1 = command != \"holdback\"\n";
- getStateData().states[20]->addController(parseController(raw.str(), "paintown internal stop walking", 20, StateController::ChangeState));
+ getLocalData().states[20]->addController(parseController(raw.str(), "paintown internal stop walking", 20, StateController::ChangeState));
}
- if (getStateData().states[Standing] != 0){
- getStateData().states[Standing]->setControl(Compiler::compile(1));
+ if (getLocalData().states[Standing] != 0){
+ getLocalData().states[Standing]->setControl(Compiler::compile(1));
}
- if (getStateData().states[StandToCrouch] != NULL){
+ if (getLocalData().states[StandToCrouch] != NULL){
ostringstream raw;
raw << "[State " << StandToCrouch << ", paintown-internal-stand-while-crouching]\n";
raw << "value = " << CrouchToStand << "\n";
raw << "trigger1 = command != \"holddown\"\n";
- getStateData().states[StandToCrouch]->addController(parseController(raw.str(), "stand while crouching", StandToCrouch, StateController::ChangeState));
+ getLocalData().states[StandToCrouch]->addController(parseController(raw.str(), "stand while crouching", StandToCrouch, StateController::ChangeState));
}
/* stand after crouching */
- if (getStateData().states[11] != 0){
+ if (getLocalData().states[11] != 0){
ostringstream raw;
raw << "[State 11, paintown-internal-stand-after-crouching]\n";
raw << "value = " << CrouchToStand << "\n";
raw << "trigger1 = command != \"holddown\"\n";
- getStateData().states[11]->addController(parseController(raw.str(), "stand after crouching", 11, StateController::ChangeState));
+ getLocalData().states[11]->addController(parseController(raw.str(), "stand after crouching", 11, StateController::ChangeState));
}
/* get up kids */
- if (getStateData().states[Liedown] != 0){
+ if (getLocalData().states[Liedown] != 0){
ostringstream raw;
raw << "[State " << Liedown << ", paintown-internal-get-up]\n";
raw << "value = " << GetUpFromLiedown << "\n";
raw << "trigger1 = time >= " << getLieDownTime() << "\n";
- getStateData().states[Liedown]->addController(parseController(raw.str(), "get up", Liedown, StateController::ChangeState));
+ getLocalData().states[Liedown]->addController(parseController(raw.str(), "get up", Liedown, StateController::ChangeState));
}
/* standing turn state */
@@ -2456,7 +2456,7 @@
State * turn = new State(StandTurning);
turn->setType(State::Unchanged);
turn->setAnimation(Compiler::compile(StandTurning));
- getStateData().states[StandTurning] = turn;
+ getLocalData().states[StandTurning] = turn;
ostringstream raw;
raw << "[State 5, paintown-internal-turn]\n";
@@ -2471,7 +2471,7 @@
State * turn = new State(CrouchTurning);
turn->setType(State::Unchanged);
turn->setAnimation(Compiler::compile(CrouchTurning));
- getStateData().states[CrouchTurning] = turn;
+ getLocalData().states[CrouchTurning] = turn;
ostringstream raw;
raw << "[State 5, paintown-internal-crouch-turn]\n";
@@ -2484,7 +2484,7 @@
/* if y reaches 0 then auto-transition to state 52.
* probably just add a trigger to state 50
*/
- if (getStateData().states[50] != 0){
+ if (getLocalData().states[50] != 0){
/*
ostringstream raw;
raw << "[State 50, paintown-internal-land]\n";
@@ -2513,7 +2513,7 @@
// Render sprite
void Character::renderSprite(const int x, const int y, const unsigned int group, const unsigned int image, Graphics::Bitmap *bmp , const int flip, const double scalex, const double scaley ){
- PaintownUtil::ReferenceCount<Mugen::Sprite> sprite = getStateData().sprites[group][image];
+ PaintownUtil::ReferenceCount<Mugen::Sprite> sprite = getLocalData().sprites[group][image];
if (sprite != NULL){
Mugen::Effects effects;
effects.facing = flip == 1;
@@ -2547,21 +2547,21 @@
}
void Character::nextPalette(){
- if (getStateData().currentPalette < getStateData().palDefaults.size()-1){
- getStateData().currentPalette++;
+ if (getLocalData().currentPalette < getLocalData().palDefaults.size()-1){
+ getLocalData().currentPalette++;
} else {
- getStateData().currentPalette = 0;
+ getLocalData().currentPalette = 0;
}
- Global::debug(1) << "Current pal: " << getStateData().currentPalette << " | Location: " << getStateData().palDefaults[getStateData().currentPalette] << " | Palette File: " << getStateData().palFile[getStateData().palDefaults[getStateData().currentPalette]] << endl;
+ Global::debug(1) << "Current pal: " << getLocalData().currentPalette << " | Location: " << getLocalData().palDefaults[getLocalData().currentPalette] << " | Palette File: " << getLocalData().palFile[getLocalData().palDefaults[getLocalData().currentPalette]] << endl;
}
void Character::priorPalette(){
- if (getStateData().currentPalette > 0){
- getStateData().currentPalette--;
+ if (getLocalData().currentPalette > 0){
+ getLocalData().currentPalette--;
} else {
- getStateData().currentPalette = getStateData().palDefaults.size() -1;
+ getLocalData().currentPalette = getLocalData().palDefaults.size() -1;
}
- Global::debug(1) << "Current pal: " << getStateData().currentPalette << " | Palette File: " << getStateData().palFile[getStateData().palDefaults[getStateData().currentPalette]] << endl;
+ Global::debug(1) << "Current pal: " << getLocalData().currentPalette << " | Palette File: " << getLocalData().palFile[getLocalData().palDefaults[getLocalData().currentPalette]] << endl;
}
/* players are their own root normally, only helpers differ */
@@ -2578,29 +2578,29 @@
}
void Character::drawReflection(Graphics::Bitmap * work, int rel_x, int rel_y, int intensity){
- if (getStateData().special.invisible){
+ if (getLocalData().special.invisible){
return;
}
if (getCurrentAnimation() != NULL){
- getCurrentAnimation()->renderReflection(getFacing() == FacingLeft, true, intensity, (int)(getX() - rel_x), (int)(getZ() - getY() - rel_y), *work, getStateData().xscale, getStateData().yscale);
+ getCurrentAnimation()->renderReflection(getFacing() == FacingLeft, true, intensity, (int)(getX() - rel_x), (int)(getZ() - getY() - rel_y), *work, getLocalData().xscale, getLocalData().yscale);
}
}
int Character::getAnimation() const {
- if (getStateData().foreignAnimation != NULL){
- return getStateData().foreignAnimationNumber;
+ if (getLocalData().foreignAnimation != NULL){
+ return getLocalData().foreignAnimationNumber;
}
- return getStateData().currentAnimation;
+ return getLocalData().currentAnimation;
}
PaintownUtil::ReferenceCount<Animation> Character::getCurrentAnimation() const {
/* Foreign animation is set by ChangeAnim2 */
- if (getStateData().foreignAnimation != NULL){
- return getStateData().foreignAnimation;
+ if (getLocalData().foreignAnimation != NULL){
+ return getLocalData().foreignAnimation;
}
- return getAnimation(getStateData().currentAnimation);
+ return getAnimation(getLocalData().currentAnimation);
/*
typedef std::map< int, Animation * > Animations;
Animations::const_iterator it = getAnimations().find(currentAnimation);
@@ -2613,33 +2613,33 @@
}
void Character::startInput(const Mugen::Stage & stage){
- if (getStateData().behavior != NULL){
- getStateData().behavior->start(stage, this, getStateData().commands, getFacing() == FacingRight);
+ if (getLocalData().behavior != NULL){
+ getLocalData().behavior->start(stage, this, getLocalData().commands, getFacing() == FacingRight);
}
}
/* returns all the commands that are currently active */
vector<string> Character::doInput(const Mugen::Stage & stage){
- if (getStateData().behavior == NULL){
+ if (getLocalData().behavior == NULL){
throw MugenException("Internal error: No behavior specified", __FILE__, __LINE__);
}
- return getStateData().behavior->currentCommands(stage, this, getStateData().commands, getFacing() == FacingRight);
+ return getLocalData().behavior->currentCommands(stage, this, getLocalData().commands, getFacing() == FacingRight);
}
bool Character::isPaused() const {
- return getStateData().hitState.shakeTime > 0;
+ return getLocalData().hitState.shakeTime > 0;
}
int Character::pauseTime() const {
- return getStateData().hitState.shakeTime;
+ return getLocalData().hitState.shakeTime;
}
double Character::getHealth() const {
- if (getStateData().health < 0){
+ if (getLocalData().health < 0){
return 0;
}
- return getStateData().health;
+ return getLocalData().health;
}
/*
@@ -2662,31 +2662,31 @@
}
void Character::processAfterImages(){
- if (getStateData().afterImage.lifetime > 0){
- getStateData().afterImage.lifetime -= 1;
+ if (getLocalData().afterImage.lifetime > 0){
+ getLocalData().afterImage.lifetime -= 1;
}
- if (getStateData().afterImage.currentTime > 0){
- getStateData().afterImage.currentTime -= 1;
+ if (getLocalData().afterImage.currentTime > 0){
+ getLocalData().afterImage.currentTime -= 1;
}
int x = (int) getX();
int y = (int) getRY();
/* not sure if checking for the timegap > 0 is the right thing.. */
- if (getStateData().afterImage.timegap > 0 && getStateData().afterImage.currentTime <= 0){
- getStateData().afterImage.currentTime += getStateData().afterImage.timegap;
+ if (getLocalData().afterImage.timegap > 0 && getLocalData().afterImage.currentTime <= 0){
+ getLocalData().afterImage.currentTime += getLocalData().afterImage.timegap;
PaintownUtil::ReferenceCount<Animation> animation = getCurrentAnimation();
if (animation != NULL){
// afterImage.currentTime -= afterImage.timegap;
Frame * currentSprite = animation->getCurrentFrame();
- getStateData().afterImage.frames.push_front(AfterImage::Image(*currentSprite, animation->getCurrentEffects(getFacing() == FacingLeft, false, getStateData().xscale, getStateData().yscale), getStateData().life, x, y, getStateData().afterImage.lifetime > 0));
+ getLocalData().afterImage.frames.push_front(AfterImage::Image(*currentSprite, animation->getCurrentEffects(getFacing() == FacingLeft, false, getLocalData().xscale, getLocalData().yscale), getLocalData().life, x, y, getLocalData().afterImage.lifetime > 0));
}
}
- if (getStateData().afterImage.length > 0 &&
- getStateData().afterImage.frames.size() >= getStateData().afterImage.length){
+ if (getLocalData().afterImage.length > 0 &&
+ getLocalData().afterImage.frames.size() >= getLocalData().afterImage.length){
- getStateData().afterImage.frames.resize(getStateData().afterImage.length - 1);
+ getLocalData().afterImage.frames.resize(getLocalData().afterImage.length - 1);
}
#if 0
@@ -2727,36 +2727,36 @@
/* Inherited members */
void Character::act(vector<Mugen::Character*>* others, Stage * stage, vector<Mugen::Character*>* add){
- getStateData().maxChangeStates = 0;
+ getLocalData().maxChangeStates = 0;
/* Reversals deactivate on state change or if a reversal actually occurs */
// reversalActive = false;
- getStateData().special.reset();
- getStateData().blocking = false;
+ getLocalData().special.reset();
+ getLocalData().blocking = false;
- if (getStateData().frozen){
- getStateData().frozen = false;
+ if (getLocalData().frozen){
+ getLocalData().frozen = false;
}
//! Check pushable
- if (getStateData().pushPlayer > 0){
- getStateData().pushPlayer--;
+ if (getLocalData().pushPlayer > 0){
+ getLocalData().pushPlayer--;
}
/* reset some stuff */
- getStateData().widthOverride.enabled = false;
- getStateData().transOverride.enabled = false;
- getStateData().drawAngleData.enabled = false;
+ getLocalData().widthOverride.enabled = false;
+ getLocalData().transOverride.enabled = false;
+ getLocalData().drawAngleData.enabled = false;
processAfterImages();
- if (getStateData().paletteEffects.time > 0){
- getStateData().paletteEffects.counter += 1;
- getStateData().paletteEffects.time -= 1;
+ if (getLocalData().paletteEffects.time > 0){
+ getLocalData().paletteEffects.counter += 1;
+ getLocalData().paletteEffects.time -= 1;
}
- for (map<int, HitOverride>::iterator it = getStateData().hitOverrides.begin(); it != getStateData().hitOverrides.end(); it++){
+ for (map<int, HitOverride>::iterator it = getLocalData().hitOverrides.begin(); it != getLocalData().hitOverrides.end(); it++){
HitOverride & override = it->second;
if (override.time > 0){
override.time -= 1;
@@ -2764,25 +2764,25 @@
}
for (int slot = 0; slot < 2; slot++){
- if (getStateData().hitByOverride[slot].time > 0){
- getStateData().hitByOverride[slot].time -= 1;
+ if (getLocalData().hitByOverride[slot].time > 0){
+ getLocalData().hitByOverride[slot].time -= 1;
}
}
/* active is the current set of commands */
- getStateData().active = doInput(*stage);
+ getLocalData().active = doInput(*stage);
- recordCommands(getStateData().active);
+ recordCommands(getLocalData().active);
- if (getStateData().hitState.recoverTime > 0){
- getStateData().hitState.recoverTime -= 1;
+ if (getLocalData().hitState.recoverTime > 0){
+ getLocalData().hitState.recoverTime -= 1;
}
- getStateData().blocking = holdingBlock(getStateData().active);
+ getLocalData().blocking = holdingBlock(getLocalData().active);
// if (hitState.shakeTime > 0 && moveType != Move::Hit){
- if (getStateData().hitState.shakeTime > 0){
- getStateData().hitState.shakeTime -= 1;
+ if (getLocalData().hitState.shakeTime > 0){
+ getLocalData().hitState.shakeTime -= 1;
/* Need to update the animation so it doesn't get stuck */
PaintownUtil::ReferenceCount<Animation> animation = getCurrentAnimation();
@@ -2794,12 +2794,12 @@
* from a hitdef or reversaldef. When shaketime reaches 0 we need to activate
* the new state that was set from delayChangeState.
*/
- if (getStateData().stateTime == -1){
- if (getState(getStateData().currentState) != NULL){
- PaintownUtil::ReferenceCount<State> state = getState(getStateData().currentState);
+ if (getLocalData().stateTime == -1){
+ if (getState(getLocalData().currentState) != NULL){
+ PaintownUtil::ReferenceCount<State> state = getState(getLocalData().currentState);
state->transitionTo(*stage, *this);
} else {
- Global::debug(0) << "Unknown state " << getStateData().currentState << endl;
+ Global::debug(0) << "Unknown state " << getLocalData().currentState << endl;
}
}
@@ -2807,7 +2807,7 @@
PaintownUtil::ReferenceCount<Animation> animation = getCurrentAnimation();
if (animation != NULL){
/* Check debug state */
- if (getStateData().debug && !isHelper()){
+ if (getLocalData().debug && !isHelper()){
if (!animation->showingDefense()){
animation->toggleDefense();
}
@@ -2825,19 +2825,19 @@
animation->logic();
}
- if (getStateData().hitState.hitTime > -1){
- getStateData().hitState.hitTime -= 1;
+ if (getLocalData().hitState.hitTime > -1){
+ getLocalData().hitState.hitTime -= 1;
}
- if (isAttacking() && getStateData().hitState.moveContact > 0){
- getStateData().hitState.moveContact += 1;
+ if (isAttacking() && getLocalData().hitState.moveContact > 0){
+ getLocalData().hitState.moveContact += 1;
}
/* if shakeTime is non-zero should we update stateTime? */
- getStateData().stateTime += 1;
+ getLocalData().stateTime += 1;
/* FIXME: there are a bunch more states that are considered blocking */
- if (getStateData().blocking && !blockingState(getCurrentState()) &&
+ if (getLocalData().blocking && !blockingState(getCurrentState()) &&
getMoveType() == Move::Idle &&
stage->getEnemy(this)->getMoveType() == Move::Attack &&
withinGuardDistance(stage->getEnemy(this))){
@@ -2863,21 +2863,21 @@
/* always run through the negative states unless we are borrowing another
* players states
*/
- if (!getStateData().characterData.enabled){
- doStates(*stage, getStateData().active, -3);
- doStates(*stage, getStateData().active, -2);
- doStates(*stage, getStateData().active, -1);
+ if (!getLocalData().characterData.enabled){
+ doStates(*stage, getLocalData().active, -3);
+ doStates(*stage, getLocalData().active, -2);
+ doStates(*stage, getLocalData().active, -1);
}
- doStates(*stage, getStateData().active, getStateData().currentState);
+ doStates(*stage, getLocalData().active, getLocalData().currentState);
/*! do regeneration if set, but only for main players */
- if (getStateData().regenerateHealth && !isHelper()){
+ if (getLocalData().regenerateHealth && !isHelper()){
if (getHealth() < 5){
setHealth(5);
- getStateData().regenerateTime = REGENERATE_TIME;
+ getLocalData().regenerateTime = REGENERATE_TIME;
}
- if (getStateData().regenerating){
+ if (getLocalData().regenerating){
/* avoid rounding errors */
if (getHealth() >= getMaxHealth() - 2){
@@ -2887,15 +2887,15 @@
}
if (getHealth() == getMaxHealth()){
- getStateData().regenerating = false;
+ getLocalData().regenerating = false;
}
- getStateData().regenerateTime = REGENERATE_TIME;
- } else if (getHealth() < getMaxHealth() && getStateData().regenerateT...
[truncated message content] |