LAB: Use friendlier names for lists
This commit is contained in:
parent
23ace32e09
commit
c9b103b2db
6 changed files with 31 additions and 31 deletions
|
@ -86,7 +86,7 @@ bool Console::Cmd_DumpSceneResources(int argc, const char **argv) {
|
||||||
debugPrintf(" (from %s to %s)", directions[rule->_param1], directions[rule->_param2]);
|
debugPrintf(" (from %s to %s)", directions[rule->_param1], directions[rule->_param2]);
|
||||||
debugPrintf("\n");
|
debugPrintf("\n");
|
||||||
|
|
||||||
Common::List<Action>::iterator action;
|
ActionList::iterator action;
|
||||||
for (action = rule->_actionList.begin(); action != rule->_actionList.end(); ++action) {
|
for (action = rule->_actionList.begin(); action != rule->_actionList.end(); ++action) {
|
||||||
debugPrintf(" - %s ('%s', %d, %d, %d)\n", actionTypes[action->_actionType], action->_messages[0].c_str(), action->_param1, action->_param2, action->_param3);
|
debugPrintf(" - %s ('%s', %d, %d, %d)\n", actionTypes[action->_actionType], action->_messages[0].c_str(), action->_param1, action->_param2, action->_param3);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ bool Console::Cmd_FindAction(int argc, const char **argv) {
|
||||||
_vm->_resource->readViews(i);
|
_vm->_resource->readViews(i);
|
||||||
|
|
||||||
for (RuleList::iterator rule = _vm->_rooms[i]._rules.begin(); rule != _vm->_rooms[i]._rules.end(); ++rule) {
|
for (RuleList::iterator rule = _vm->_rooms[i]._rules.begin(); rule != _vm->_rooms[i]._rules.end(); ++rule) {
|
||||||
Common::List<Action>::iterator action;
|
ActionList::iterator action;
|
||||||
for (action = rule->_actionList.begin(); action != rule->_actionList.end(); ++action) {
|
for (action = rule->_actionList.begin(); action != rule->_actionList.end(); ++action) {
|
||||||
if (action->_actionType == actionId &&
|
if (action->_actionType == actionId &&
|
||||||
(action->_param1 == param1 || param1 == -1) &&
|
(action->_param1 == param1 || param1 == -1) &&
|
||||||
|
|
|
@ -89,6 +89,9 @@ struct CrumbData {
|
||||||
|
|
||||||
typedef CloseData *CloseDataPtr;
|
typedef CloseData *CloseDataPtr;
|
||||||
typedef Common::List<Rule> RuleList;
|
typedef Common::List<Rule> RuleList;
|
||||||
|
typedef Common::List<Action> ActionList;
|
||||||
|
typedef Common::List<CloseData> CloseDataList;
|
||||||
|
typedef Common::List<ViewData> ViewDataList;
|
||||||
|
|
||||||
enum Direction {
|
enum Direction {
|
||||||
kDirectionNorth,
|
kDirectionNorth,
|
||||||
|
@ -230,7 +233,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* Processes the action list.
|
* Processes the action list.
|
||||||
*/
|
*/
|
||||||
void doActions(const Common::List<Action> &actionList, CloseDataPtr *closePtrList);
|
void doActions(const ActionList &actionList, CloseDataPtr *closePtrList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Goes through the rules if an action is taken.
|
* Goes through the rules if an action is taken.
|
||||||
|
@ -350,7 +353,7 @@ private:
|
||||||
* some of the closeups have the same hit boxes, then this returns the first
|
* some of the closeups have the same hit boxes, then this returns the first
|
||||||
* occurrence of the object with the same hit box.
|
* occurrence of the object with the same hit box.
|
||||||
*/
|
*/
|
||||||
CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, Common::List<CloseData> &list);
|
CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataList &list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a floor has been visited.
|
* Checks if a floor has been visited.
|
||||||
|
|
|
@ -56,9 +56,8 @@ ViewData *LabEngine::getViewData(uint16 roomNum, uint16 direction) {
|
||||||
if (_rooms[roomNum]._roomMsg.empty())
|
if (_rooms[roomNum]._roomMsg.empty())
|
||||||
_resource->readViews(roomNum);
|
_resource->readViews(roomNum);
|
||||||
|
|
||||||
Common::List<ViewData> &views = _rooms[roomNum]._view[direction];
|
ViewDataList &views = _rooms[roomNum]._view[direction];
|
||||||
|
ViewDataList::iterator view;
|
||||||
Common::List<ViewData>::iterator view;
|
|
||||||
|
|
||||||
for (view = views.begin(); view != views.end(); ++view) {
|
for (view = views.begin(); view != views.end(); ++view) {
|
||||||
if (checkConditions(view->_condition))
|
if (checkConditions(view->_condition))
|
||||||
|
@ -69,13 +68,14 @@ ViewData *LabEngine::getViewData(uint16 roomNum, uint16 direction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) {
|
CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) {
|
||||||
Common::List<CloseData> *list;
|
CloseDataList *list;
|
||||||
if (!closePtr)
|
if (!closePtr)
|
||||||
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
||||||
else
|
else
|
||||||
list = &(closePtr->_subCloseUps);
|
list = &(closePtr->_subCloseUps);
|
||||||
|
|
||||||
Common::List<CloseData>::iterator wrkClosePtr;
|
CloseDataList::iterator wrkClosePtr;
|
||||||
|
|
||||||
for (wrkClosePtr = list->begin(); wrkClosePtr != list->end(); ++wrkClosePtr) {
|
for (wrkClosePtr = list->begin(); wrkClosePtr != list->end(); ++wrkClosePtr) {
|
||||||
Common::Rect objRect;
|
Common::Rect objRect;
|
||||||
objRect = _utils->rectScale(wrkClosePtr->_x1, wrkClosePtr->_y1, wrkClosePtr->_x2, wrkClosePtr->_y2);
|
objRect = _utils->rectScale(wrkClosePtr->_x1, wrkClosePtr->_y1, wrkClosePtr->_x2, wrkClosePtr->_y2);
|
||||||
|
@ -86,8 +86,8 @@ CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, Common::List<CloseData> &list) {
|
CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, CloseDataList &list) {
|
||||||
Common::List<CloseData>::iterator i;
|
CloseDataList::iterator i;
|
||||||
|
|
||||||
for (i = list.begin(); i != list.end(); ++i) {
|
for (i = list.begin(); i != list.end(); ++i) {
|
||||||
if ((closePtr->_x1 == i->_x1) && (closePtr->_x2 == i->_x2) &&
|
if ((closePtr->_x1 == i->_x1) && (closePtr->_x2 == i->_x2) &&
|
||||||
|
@ -95,8 +95,7 @@ CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, Common::List<Cl
|
||||||
(closePtr->_depth == i->_depth))
|
(closePtr->_depth == i->_depth))
|
||||||
return &(*i);
|
return &(*i);
|
||||||
|
|
||||||
CloseDataPtr resClosePtr;
|
CloseDataPtr resClosePtr = findClosePtrMatch(closePtr, i->_subCloseUps);
|
||||||
resClosePtr = findClosePtrMatch(closePtr, i->_subCloseUps);
|
|
||||||
|
|
||||||
if (resClosePtr)
|
if (resClosePtr)
|
||||||
return resClosePtr;
|
return resClosePtr;
|
||||||
|
@ -173,15 +172,14 @@ uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords, bool next) {
|
void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords, bool next) {
|
||||||
|
CloseDataList *list;
|
||||||
Common::List<CloseData> *list;
|
|
||||||
|
|
||||||
if (!*closePtrList)
|
if (!*closePtrList)
|
||||||
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
||||||
else
|
else
|
||||||
list = &((*closePtrList)->_subCloseUps);
|
list = &((*closePtrList)->_subCloseUps);
|
||||||
|
|
||||||
Common::List<CloseData>::iterator closePtr;
|
CloseDataList::iterator closePtr;
|
||||||
for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) {
|
for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) {
|
||||||
Common::Rect target;
|
Common::Rect target;
|
||||||
if (!useAbsoluteCoords)
|
if (!useAbsoluteCoords)
|
||||||
|
@ -212,7 +210,7 @@ void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, b
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
|
bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
|
||||||
Common::List<CloseData> *list;
|
CloseDataList *list;
|
||||||
if (!*closePtrList) {
|
if (!*closePtrList) {
|
||||||
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
||||||
} else if ((*closePtrList)->_closeUpType < 0) {
|
} else if ((*closePtrList)->_closeUpType < 0) {
|
||||||
|
@ -221,7 +219,7 @@ bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
|
||||||
} else
|
} else
|
||||||
list = &((*closePtrList)->_subCloseUps);
|
list = &((*closePtrList)->_subCloseUps);
|
||||||
|
|
||||||
Common::List<CloseData>::iterator closePtr;
|
CloseDataList::iterator closePtr;
|
||||||
for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) {
|
for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) {
|
||||||
Common::Rect objRect;
|
Common::Rect objRect;
|
||||||
objRect = _utils->rectScale(closePtr->_x1, closePtr->_y1, closePtr->_x2, closePtr->_y2);
|
objRect = _utils->rectScale(closePtr->_x1, closePtr->_y1, closePtr->_x2, closePtr->_y2);
|
||||||
|
@ -234,8 +232,8 @@ bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabEngine::doActions(const Common::List<Action> &actionList, CloseDataPtr *closePtrList) {
|
void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrList) {
|
||||||
Common::List<Action>::const_iterator action;
|
ActionList::const_iterator action;
|
||||||
for (action = actionList.begin(); action != actionList.end(); ++action) {
|
for (action = actionList.begin(); action != actionList.end(); ++action) {
|
||||||
updateMusicAndEvents();
|
updateMusicAndEvents();
|
||||||
|
|
||||||
|
@ -267,7 +265,6 @@ void LabEngine::doActions(const Common::List<Action> &actionList, CloseDataPtr *
|
||||||
if (!action->_messages[0].empty())
|
if (!action->_messages[0].empty())
|
||||||
// Puts a file into memory
|
// Puts a file into memory
|
||||||
_graphics->loadPict(action->_messages[0]);
|
_graphics->loadPict(action->_messages[0]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kActionLoadBitmap:
|
case kActionLoadBitmap:
|
||||||
|
|
|
@ -143,13 +143,13 @@ struct CloseData {
|
||||||
uint16 _depth; // Level of the closeup.
|
uint16 _depth; // Level of the closeup.
|
||||||
Common::String _graphicName;
|
Common::String _graphicName;
|
||||||
Common::String _message;
|
Common::String _message;
|
||||||
Common::List<CloseData> _subCloseUps;
|
CloseDataList _subCloseUps;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ViewData {
|
struct ViewData {
|
||||||
Common::Array<int16> _condition;
|
Common::Array<int16> _condition;
|
||||||
Common::String _graphicName;
|
Common::String _graphicName;
|
||||||
Common::List<CloseData> _closeUps;
|
CloseDataList _closeUps;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Action {
|
struct Action {
|
||||||
|
@ -165,13 +165,13 @@ struct Rule {
|
||||||
int16 _param1;
|
int16 _param1;
|
||||||
int16 _param2;
|
int16 _param2;
|
||||||
Common::Array<int16> _condition;
|
Common::Array<int16> _condition;
|
||||||
Common::List<Action> _actionList;
|
ActionList _actionList;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RoomData {
|
struct RoomData {
|
||||||
uint16 _doors[4];
|
uint16 _doors[4];
|
||||||
byte _transitionType;
|
byte _transitionType;
|
||||||
Common::List<ViewData> _view[4];
|
ViewDataList _view[4];
|
||||||
RuleList _rules;
|
RuleList _rules;
|
||||||
Common::String _roomMsg;
|
Common::String _roomMsg;
|
||||||
};
|
};
|
||||||
|
|
|
@ -253,7 +253,7 @@ void Resource::readRule(Common::File *file, RuleList &rules) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resource::readAction(Common::File *file, Common::List<Action>& list) {
|
void Resource::readAction(Common::File *file, ActionList &list) {
|
||||||
list.clear();
|
list.clear();
|
||||||
|
|
||||||
while (file->readByte() == 1) {
|
while (file->readByte() == 1) {
|
||||||
|
@ -275,7 +275,7 @@ void Resource::readAction(Common::File *file, Common::List<Action>& list) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resource::readCloseUps(uint16 depth, Common::File *file, Common::List<CloseData> &list) {
|
void Resource::readCloseUps(uint16 depth, Common::File *file, CloseDataList &list) {
|
||||||
list.clear();
|
list.clear();
|
||||||
while (file->readByte() != '\0') {
|
while (file->readByte() != '\0') {
|
||||||
list.push_back(CloseData());
|
list.push_back(CloseData());
|
||||||
|
@ -293,7 +293,7 @@ void Resource::readCloseUps(uint16 depth, Common::File *file, Common::List<Close
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resource::readView(Common::File *file, Common::List<ViewData> &list) {
|
void Resource::readView(Common::File *file, ViewDataList &list) {
|
||||||
list.clear();
|
list.clear();
|
||||||
while (file->readByte() == 1) {
|
while (file->readByte() == 1) {
|
||||||
list.push_back(ViewData());
|
list.push_back(ViewData());
|
||||||
|
|
|
@ -110,9 +110,9 @@ private:
|
||||||
Common::String readString(Common::File *file);
|
Common::String readString(Common::File *file);
|
||||||
Common::Array<int16> readConditions(Common::File *file);
|
Common::Array<int16> readConditions(Common::File *file);
|
||||||
void readRule(Common::File *file, RuleList &rules);
|
void readRule(Common::File *file, RuleList &rules);
|
||||||
void readAction(Common::File *file, Common::List<Action> &action);
|
void readAction(Common::File *file, ActionList &action);
|
||||||
void readCloseUps(uint16 depth, Common::File *file, Common::List<CloseData> &close);
|
void readCloseUps(uint16 depth, Common::File *file, CloseDataList &close);
|
||||||
void readView(Common::File *file, Common::List<ViewData> &view);
|
void readView(Common::File *file, ViewDataList &view);
|
||||||
void readStaticText();
|
void readStaticText();
|
||||||
Common::String translateFileName(const Common::String filename);
|
Common::String translateFileName(const Common::String filename);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue