mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 00:41:12 +00:00
FULLPIPE: Change more object-related functions to use Common::String
This commit is contained in:
parent
56ec429537
commit
93982b2ca9
@ -70,7 +70,7 @@ void BehaviorManager::initBehavior(Scene *sc, GameVar *var) {
|
||||
|
||||
_behaviors.push_back(behinfo);
|
||||
} else {
|
||||
StaticANIObject *ani = sc->getStaticANIObject1ByName((char *)subvar->_varName.c_str(), -1);
|
||||
StaticANIObject *ani = sc->getStaticANIObject1ByName(subvar->_varName, -1);
|
||||
if (ani) {
|
||||
for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) {
|
||||
if (((StaticANIObject *)sc->_staticANIObjectList1[i])->_id == ani->_id) {
|
||||
@ -279,7 +279,7 @@ void BehaviorInfo::initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject *
|
||||
if (strcmp(var->_value.stringValue, "ROOT"))
|
||||
break;
|
||||
|
||||
GameVar *v1 = g_fp->getGameLoaderGameVar()->getSubVarByName("BEHAVIOR")->getSubVarByName(ani->getName().c_str());
|
||||
GameVar *v1 = g_fp->getGameLoaderGameVar()->getSubVarByName("BEHAVIOR")->getSubVarByName(ani->getName());
|
||||
if (v1 == var)
|
||||
return;
|
||||
|
||||
@ -317,7 +317,7 @@ BehaviorAnim::BehaviorAnim(GameVar *var, Scene *sc, StaticANIObject *ani, int *m
|
||||
_flags = 0;
|
||||
_behaviorMoves = 0;
|
||||
|
||||
Statics *st = ani->getStaticsByName((char *)var->_varName.c_str());
|
||||
Statics *st = ani->getStaticsByName(var->_varName);
|
||||
if (st)
|
||||
_staticsId = st->_staticsId;
|
||||
|
||||
@ -346,7 +346,7 @@ BehaviorMove::BehaviorMove(GameVar *subvar, Scene *sc, int *delay) {
|
||||
_delay = 0;
|
||||
_percent = 0;
|
||||
_flags = 0;
|
||||
_messageQueue = sc->getMessageQueueByName((char *)subvar->_varName.c_str());
|
||||
_messageQueue = sc->getMessageQueueByName(subvar->_varName);
|
||||
|
||||
GameVar *vart = subvar->getSubVarByName("dwDelay");
|
||||
if (vart)
|
||||
|
@ -552,7 +552,7 @@ void FullpipeEngine::updateScreen() {
|
||||
++_updateTicks;
|
||||
}
|
||||
|
||||
int FullpipeEngine::getObjectEnumState(const char *name, const char *state) {
|
||||
int FullpipeEngine::getObjectEnumState(Common::String name, const char *state) {
|
||||
GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES");
|
||||
|
||||
if (!var) {
|
||||
@ -569,7 +569,7 @@ int FullpipeEngine::getObjectEnumState(const char *name, const char *state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FullpipeEngine::getObjectState(const char *objname) {
|
||||
int FullpipeEngine::getObjectState(Common::String objname) {
|
||||
GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES");
|
||||
|
||||
if (var)
|
||||
@ -578,7 +578,7 @@ int FullpipeEngine::getObjectState(const char *objname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FullpipeEngine::setObjectState(const char *name, int state) {
|
||||
void FullpipeEngine::setObjectState(Common::String name, int state) {
|
||||
GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES");
|
||||
|
||||
if (!var) {
|
||||
|
@ -272,9 +272,9 @@ public:
|
||||
void setCursor(int id);
|
||||
void updateCursorCommon();
|
||||
|
||||
int getObjectState(const char *objname);
|
||||
void setObjectState(const char *name, int state);
|
||||
int getObjectEnumState(const char *name, const char *state);
|
||||
int getObjectState(Common::String objname);
|
||||
void setObjectState(Common::String name, int state);
|
||||
int getObjectEnumState(Common::String name, const char *state);
|
||||
|
||||
void sceneAutoScrolling();
|
||||
bool sceneSwitcher(EntranceInfo *entrance);
|
||||
|
@ -493,20 +493,20 @@ bool Interaction::canInteract(GameObject *obj1, GameObject *obj2, int invId) {
|
||||
|
||||
if (_objectState1) {
|
||||
if (_flags & 0x10) {
|
||||
if ((g_fp->getObjectState(obj1->getName().c_str()) & _objectState1) == 0)
|
||||
if ((g_fp->getObjectState(obj1->getName()) & _objectState1) == 0)
|
||||
return false;
|
||||
} else {
|
||||
if (g_fp->getObjectState(obj1->getName().c_str()) != _objectState1)
|
||||
if (g_fp->getObjectState(obj1->getName()) != _objectState1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_objectState2) {
|
||||
if (_flags & 0x10) {
|
||||
if ((g_fp->getObjectState(obj2->getName().c_str()) & _objectState2) == 0)
|
||||
if ((g_fp->getObjectState(obj2->getName()) & _objectState2) == 0)
|
||||
return false;
|
||||
} else {
|
||||
if (g_fp->getObjectState(obj2->getName().c_str()) != _objectState2)
|
||||
if (g_fp->getObjectState(obj2->getName()) != _objectState2)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ int MctlLadder::findObjectPos(StaticANIObject *obj) {
|
||||
bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement) {
|
||||
debugC(4, kDebugPathfinding, "MctlLadder::initMovement(*%d, ...)", ani->_id);
|
||||
|
||||
GameVar *v = g_fp->getGameLoaderGameVar()->getSubVarByName(ani->getName().c_str());
|
||||
GameVar *v = g_fp->getGameLoaderGameVar()->getSubVarByName(ani->getName());
|
||||
|
||||
if (!v)
|
||||
return false;
|
||||
@ -1744,7 +1744,7 @@ bool MctlGraph::fillData(StaticANIObject *obj, MctlAni *item) {
|
||||
item->_obj = obj;
|
||||
item->_objectId = obj->_id;
|
||||
|
||||
GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(obj->_objectName.c_str());
|
||||
GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(obj->_objectName);
|
||||
if (!var)
|
||||
return false;
|
||||
|
||||
|
@ -90,10 +90,10 @@ class GameVar : public CObject {
|
||||
|
||||
virtual bool load(MfcArchive &file);
|
||||
virtual void save(MfcArchive &file);
|
||||
GameVar *getSubVarByName(const char *name);
|
||||
bool setSubVarAsInt(const char *name, int value);
|
||||
int getSubVarAsInt(const char *name);
|
||||
GameVar *addSubVarAsInt(const char *name, int value);
|
||||
GameVar *getSubVarByName(Common::String name);
|
||||
bool setSubVarAsInt(Common::String name, int value);
|
||||
int getSubVarAsInt(Common::String name);
|
||||
GameVar *addSubVarAsInt(Common::String name, int value);
|
||||
bool addSubVar(GameVar *subvar);
|
||||
int getSubVarsCount();
|
||||
GameVar *getSubVarByIndex(int idx);
|
||||
|
@ -304,9 +304,9 @@ StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
StaticANIObject *Scene::getStaticANIObject1ByName(char *name, int a3) {
|
||||
StaticANIObject *Scene::getStaticANIObject1ByName(Common::String &name, int a3) {
|
||||
for (uint i = 0; i < _staticANIObjectList1.size(); i++) {
|
||||
if (_staticANIObjectList1[i]->_objectName == name && (a3 == -1 || _staticANIObjectList1[i]->_odelay == a3))
|
||||
if ((_staticANIObjectList1[i]->_objectName == name) && (a3 == -1 || _staticANIObjectList1[i]->_odelay == a3))
|
||||
return _staticANIObjectList1[i];
|
||||
}
|
||||
|
||||
@ -365,9 +365,9 @@ PictureObject *Scene::getPictureObjectById(int objId, int flags) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PictureObject *Scene::getPictureObjectByName(const char *objName, int flags) {
|
||||
PictureObject *Scene::getPictureObjectByName(Common::String objName, int flags) {
|
||||
for (uint i = 0; i < _picObjList.size(); i++) {
|
||||
if (((PictureObject *)_picObjList[i])->_objectName == objName && (((PictureObject *)_picObjList[i])->_odelay == flags || flags == -1))
|
||||
if ((((PictureObject *)_picObjList[i])->_objectName == objName) && (((PictureObject *)_picObjList[i])->_odelay == flags || flags == -1))
|
||||
return (PictureObject *)_picObjList[i];
|
||||
}
|
||||
|
||||
@ -393,9 +393,9 @@ MessageQueue *Scene::getMessageQueueById(int messageId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MessageQueue *Scene::getMessageQueueByName(char *name) {
|
||||
MessageQueue *Scene::getMessageQueueByName(Common::String &name) {
|
||||
for (uint i = 0; i < _messageQueueList.size(); i++)
|
||||
if (!strcmp(_messageQueueList[i]->_queueName.c_str(), name))
|
||||
if (_messageQueueList[i]->_queueName == name)
|
||||
return _messageQueueList[i];
|
||||
|
||||
return 0;
|
||||
@ -407,14 +407,14 @@ void Scene::preloadMovements(GameVar *var) {
|
||||
return;
|
||||
|
||||
for (GameVar *i = preload->_subVars; i; i = i->_nextVarObj) {
|
||||
StaticANIObject *ani = getStaticANIObject1ByName((char *)i->_varName.c_str(), -1);
|
||||
StaticANIObject *ani = getStaticANIObject1ByName(i->_varName, -1);
|
||||
|
||||
if (ani) {
|
||||
GameVar *subVars = i->_subVars;
|
||||
|
||||
if (subVars) {
|
||||
for (;subVars; subVars = subVars->_nextVarObj) {
|
||||
Movement *mov = ani->getMovementByName((char *)subVars->_varName.c_str());
|
||||
Movement *mov = ani->getMovementByName(subVars->_varName);
|
||||
|
||||
if (mov)
|
||||
mov->loadPixelData();
|
||||
@ -436,9 +436,9 @@ void Scene::initObjectCursors(const char *varname) {
|
||||
int minId = 0xffff;
|
||||
|
||||
for (GameVar *sub = cursorsVar->_subVars; sub; sub = sub->_nextVarObj) {
|
||||
GameObject *obj = getPictureObjectByName((char *)sub->_varName.c_str(), -1);
|
||||
GameObject *obj = getPictureObjectByName(sub->_varName, -1);
|
||||
|
||||
if (obj || (obj = getStaticANIObject1ByName((char *)sub->_varName.c_str(), -1)) != 0) {
|
||||
if (obj || (obj = getStaticANIObject1ByName(sub->_varName, -1)) != 0) {
|
||||
if (obj->_id < minId)
|
||||
minId = obj->_id;
|
||||
if (obj->_id > maxId)
|
||||
@ -452,10 +452,10 @@ void Scene::initObjectCursors(const char *varname) {
|
||||
g_fp->_objectIdCursors.resize(maxId - minId + 1);
|
||||
|
||||
for (GameVar *sub = cursorsVar->_subVars; sub; sub = sub->_nextVarObj) {
|
||||
GameObject *obj = getPictureObjectByName((char *)sub->_varName.c_str(), -1);
|
||||
GameObject *obj = getPictureObjectByName(sub->_varName, -1);
|
||||
|
||||
if (!obj)
|
||||
obj = getStaticANIObject1ByName((char *)sub->_varName.c_str(), -1);
|
||||
obj = getStaticANIObject1ByName(sub->_varName, -1);
|
||||
|
||||
PictureObject *pic = getGameLoaderInventory()->getScene()->getPictureObjectByName(sub->_value.stringValue, -1);
|
||||
|
||||
|
@ -59,16 +59,16 @@ class Scene : public Background {
|
||||
|
||||
StaticANIObject *getAniMan();
|
||||
StaticANIObject *getStaticANIObject1ById(int obj, int a3);
|
||||
StaticANIObject *getStaticANIObject1ByName(char *name, int a3);
|
||||
StaticANIObject *getStaticANIObject1ByName(Common::String &name, int a3);
|
||||
MessageQueue *getMessageQueueById(int messageId);
|
||||
MessageQueue *getMessageQueueByName(char *name);
|
||||
MessageQueue *getMessageQueueByName(Common::String &name);
|
||||
|
||||
void deleteStaticANIObject(StaticANIObject *obj);
|
||||
void addStaticANIObject(StaticANIObject *obj, bool addList2);
|
||||
|
||||
void setPictureObjectsFlag4();
|
||||
PictureObject *getPictureObjectById(int objId, int flags);
|
||||
PictureObject *getPictureObjectByName(const char *name, int keyCode);
|
||||
PictureObject *getPictureObjectByName(Common::String name, int keyCode);
|
||||
void deletePictureObject(PictureObject *obj);
|
||||
void preloadMovements(GameVar *var);
|
||||
|
||||
|
@ -492,18 +492,18 @@ bool GameVar::load(MfcArchive &file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
GameVar *GameVar::getSubVarByName(const char *name) {
|
||||
GameVar *GameVar::getSubVarByName(Common::String name) {
|
||||
GameVar *sv = 0;
|
||||
|
||||
if (_subVars != 0) {
|
||||
sv = _subVars;
|
||||
for (;sv && scumm_stricmp(sv->_varName.c_str(), name); sv = sv->_nextVarObj)
|
||||
for (;sv && scumm_stricmp(sv->_varName.c_str(), name.c_str()); sv = sv->_nextVarObj)
|
||||
;
|
||||
}
|
||||
return sv;
|
||||
}
|
||||
|
||||
bool GameVar::setSubVarAsInt(const char *name, int value) {
|
||||
bool GameVar::setSubVarAsInt(Common::String name, int value) {
|
||||
GameVar *var = getSubVarByName(name);
|
||||
|
||||
if (var) {
|
||||
@ -523,7 +523,7 @@ bool GameVar::setSubVarAsInt(const char *name, int value) {
|
||||
return addSubVar(var);
|
||||
}
|
||||
|
||||
int GameVar::getSubVarAsInt(const char *name) {
|
||||
int GameVar::getSubVarAsInt(Common::String name) {
|
||||
GameVar *var = getSubVarByName(name);
|
||||
|
||||
if (var)
|
||||
@ -532,7 +532,7 @@ int GameVar::getSubVarAsInt(const char *name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GameVar *GameVar::addSubVarAsInt(const char *name, int value) {
|
||||
GameVar *GameVar::addSubVarAsInt(Common::String name, int value) {
|
||||
if (getSubVarByName(name)) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -418,7 +418,7 @@ Statics *StaticANIObject::getStaticsById(int itemId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Statics *StaticANIObject::getStaticsByName(char *name) {
|
||||
Statics *StaticANIObject::getStaticsByName(Common::String &name) {
|
||||
for (uint i = 0; i < _staticsList.size(); i++)
|
||||
if (_staticsList[i]->_staticsName == name)
|
||||
return _staticsList[i];
|
||||
@ -450,7 +450,7 @@ int StaticANIObject::getMovementIdById(int itemId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Movement *StaticANIObject::getMovementByName(char *name) {
|
||||
Movement *StaticANIObject::getMovementByName(Common::String &name) {
|
||||
for (uint i = 0; i < _movements.size(); i++)
|
||||
if (_movements[i]->_objectName == name)
|
||||
return _movements[i];
|
||||
@ -681,7 +681,7 @@ void StaticANIObject::draw2() {
|
||||
}
|
||||
|
||||
MovTable *StaticANIObject::countMovements() {
|
||||
GameVar *preloadSubVar = g_fp->getGameLoaderGameVar()->getSubVarByName(getName().c_str())->getSubVarByName("PRELOAD");
|
||||
GameVar *preloadSubVar = g_fp->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("PRELOAD");
|
||||
|
||||
if (!preloadSubVar || preloadSubVar->getSubVarsCount() == 0)
|
||||
return 0;
|
||||
@ -706,7 +706,7 @@ MovTable *StaticANIObject::countMovements() {
|
||||
}
|
||||
|
||||
void StaticANIObject::setSpeed(int speed) {
|
||||
GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(getName().c_str())->getSubVarByName("SpeedUp");
|
||||
GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("SpeedUp");
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
|
@ -204,10 +204,10 @@ public:
|
||||
|
||||
void setOXY(int x, int y);
|
||||
Statics *getStaticsById(int id);
|
||||
Statics *getStaticsByName(char *name);
|
||||
Statics *getStaticsByName(Common::String &name);
|
||||
Movement *getMovementById(int id);
|
||||
int getMovementIdById(int itemId);
|
||||
Movement *getMovementByName(char *name);
|
||||
Movement *getMovementByName(Common::String &name);
|
||||
Common::Point *getCurrDimensions(Common::Point &p);
|
||||
|
||||
Common::Point *getSomeXY(Common::Point &p);
|
||||
|
Loading…
Reference in New Issue
Block a user