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("\n");
|
||||
|
||||
Common::List<Action>::iterator action;
|
||||
ActionList::iterator 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);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ bool Console::Cmd_FindAction(int argc, const char **argv) {
|
|||
_vm->_resource->readViews(i);
|
||||
|
||||
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) {
|
||||
if (action->_actionType == actionId &&
|
||||
(action->_param1 == param1 || param1 == -1) &&
|
||||
|
|
|
@ -89,6 +89,9 @@ struct CrumbData {
|
|||
|
||||
typedef CloseData *CloseDataPtr;
|
||||
typedef Common::List<Rule> RuleList;
|
||||
typedef Common::List<Action> ActionList;
|
||||
typedef Common::List<CloseData> CloseDataList;
|
||||
typedef Common::List<ViewData> ViewDataList;
|
||||
|
||||
enum Direction {
|
||||
kDirectionNorth,
|
||||
|
@ -230,7 +233,7 @@ private:
|
|||
/**
|
||||
* 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.
|
||||
|
@ -350,7 +353,7 @@ private:
|
|||
* some of the closeups have the same hit boxes, then this returns the first
|
||||
* 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.
|
||||
|
|
|
@ -56,9 +56,8 @@ ViewData *LabEngine::getViewData(uint16 roomNum, uint16 direction) {
|
|||
if (_rooms[roomNum]._roomMsg.empty())
|
||||
_resource->readViews(roomNum);
|
||||
|
||||
Common::List<ViewData> &views = _rooms[roomNum]._view[direction];
|
||||
|
||||
Common::List<ViewData>::iterator view;
|
||||
ViewDataList &views = _rooms[roomNum]._view[direction];
|
||||
ViewDataList::iterator view;
|
||||
|
||||
for (view = views.begin(); view != views.end(); ++view) {
|
||||
if (checkConditions(view->_condition))
|
||||
|
@ -69,13 +68,14 @@ ViewData *LabEngine::getViewData(uint16 roomNum, uint16 direction) {
|
|||
}
|
||||
|
||||
CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) {
|
||||
Common::List<CloseData> *list;
|
||||
CloseDataList *list;
|
||||
if (!closePtr)
|
||||
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
||||
else
|
||||
list = &(closePtr->_subCloseUps);
|
||||
|
||||
Common::List<CloseData>::iterator wrkClosePtr;
|
||||
CloseDataList::iterator wrkClosePtr;
|
||||
|
||||
for (wrkClosePtr = list->begin(); wrkClosePtr != list->end(); ++wrkClosePtr) {
|
||||
Common::Rect objRect;
|
||||
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;
|
||||
}
|
||||
|
||||
CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, Common::List<CloseData> &list) {
|
||||
Common::List<CloseData>::iterator i;
|
||||
CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, CloseDataList &list) {
|
||||
CloseDataList::iterator i;
|
||||
|
||||
for (i = list.begin(); i != list.end(); ++i) {
|
||||
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))
|
||||
return &(*i);
|
||||
|
||||
CloseDataPtr resClosePtr;
|
||||
resClosePtr = findClosePtrMatch(closePtr, i->_subCloseUps);
|
||||
CloseDataPtr resClosePtr = findClosePtrMatch(closePtr, i->_subCloseUps);
|
||||
|
||||
if (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) {
|
||||
|
||||
Common::List<CloseData> *list;
|
||||
CloseDataList *list;
|
||||
|
||||
if (!*closePtrList)
|
||||
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
||||
else
|
||||
list = &((*closePtrList)->_subCloseUps);
|
||||
|
||||
Common::List<CloseData>::iterator closePtr;
|
||||
CloseDataList::iterator closePtr;
|
||||
for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) {
|
||||
Common::Rect target;
|
||||
if (!useAbsoluteCoords)
|
||||
|
@ -212,7 +210,7 @@ void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, b
|
|||
}
|
||||
|
||||
bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
|
||||
Common::List<CloseData> *list;
|
||||
CloseDataList *list;
|
||||
if (!*closePtrList) {
|
||||
list = &(getViewData(_roomNum, _direction)->_closeUps);
|
||||
} else if ((*closePtrList)->_closeUpType < 0) {
|
||||
|
@ -221,7 +219,7 @@ bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
|
|||
} else
|
||||
list = &((*closePtrList)->_subCloseUps);
|
||||
|
||||
Common::List<CloseData>::iterator closePtr;
|
||||
CloseDataList::iterator closePtr;
|
||||
for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) {
|
||||
Common::Rect objRect;
|
||||
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;
|
||||
}
|
||||
|
||||
void LabEngine::doActions(const Common::List<Action> &actionList, CloseDataPtr *closePtrList) {
|
||||
Common::List<Action>::const_iterator action;
|
||||
void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrList) {
|
||||
ActionList::const_iterator action;
|
||||
for (action = actionList.begin(); action != actionList.end(); ++action) {
|
||||
updateMusicAndEvents();
|
||||
|
||||
|
@ -267,7 +265,6 @@ void LabEngine::doActions(const Common::List<Action> &actionList, CloseDataPtr *
|
|||
if (!action->_messages[0].empty())
|
||||
// Puts a file into memory
|
||||
_graphics->loadPict(action->_messages[0]);
|
||||
|
||||
break;
|
||||
|
||||
case kActionLoadBitmap:
|
||||
|
|
|
@ -143,13 +143,13 @@ struct CloseData {
|
|||
uint16 _depth; // Level of the closeup.
|
||||
Common::String _graphicName;
|
||||
Common::String _message;
|
||||
Common::List<CloseData> _subCloseUps;
|
||||
CloseDataList _subCloseUps;
|
||||
};
|
||||
|
||||
struct ViewData {
|
||||
Common::Array<int16> _condition;
|
||||
Common::String _graphicName;
|
||||
Common::List<CloseData> _closeUps;
|
||||
CloseDataList _closeUps;
|
||||
};
|
||||
|
||||
struct Action {
|
||||
|
@ -165,13 +165,13 @@ struct Rule {
|
|||
int16 _param1;
|
||||
int16 _param2;
|
||||
Common::Array<int16> _condition;
|
||||
Common::List<Action> _actionList;
|
||||
ActionList _actionList;
|
||||
};
|
||||
|
||||
struct RoomData {
|
||||
uint16 _doors[4];
|
||||
byte _transitionType;
|
||||
Common::List<ViewData> _view[4];
|
||||
ViewDataList _view[4];
|
||||
RuleList _rules;
|
||||
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();
|
||||
|
||||
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();
|
||||
while (file->readByte() != '\0') {
|
||||
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();
|
||||
while (file->readByte() == 1) {
|
||||
list.push_back(ViewData());
|
||||
|
|
|
@ -110,9 +110,9 @@ private:
|
|||
Common::String readString(Common::File *file);
|
||||
Common::Array<int16> readConditions(Common::File *file);
|
||||
void readRule(Common::File *file, RuleList &rules);
|
||||
void readAction(Common::File *file, Common::List<Action> &action);
|
||||
void readCloseUps(uint16 depth, Common::File *file, Common::List<CloseData> &close);
|
||||
void readView(Common::File *file, Common::List<ViewData> &view);
|
||||
void readAction(Common::File *file, ActionList &action);
|
||||
void readCloseUps(uint16 depth, Common::File *file, CloseDataList &close);
|
||||
void readView(Common::File *file, ViewDataList &view);
|
||||
void readStaticText();
|
||||
Common::String translateFileName(const Common::String filename);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue