bool MessageQueue::checkGlobalExCommandList1() { ExCommand *ex, *ex1; for (uint i = 0; i < getCount(); i++) { ex = getExCommandByIndex(i); if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27) continue; for (Common::List<ExCommand *>::iterator it = g_fullpipe->_exCommandList.begin(); it != g_fullpipe->_exCommandList.end(); it++) { ex1 = *it; if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27) continue; if (ex1->_keyCode != ex->_keyCode && ex1->_keyCode != -1 && ex->_keyCode != -1) continue; MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex1->_parId); if (mq) { if (mq->getFlags() & 1) return false; } } } return true; }
void MessageQueue::replaceKeyCode(int key1, int key2) { for (uint i = 0; i < getCount(); i++) { ExCommand *ex = getExCommandByIndex(i); int k = ex->_messageKind; if ((k == 1 || k == 20 || k == 5 || k == 6 || k == 2 || k == 18 || k == 19 || k == 22 || k == 55) && ex->_keyCode == key1) ex->_keyCode = key2; } }
void MessageQueue::setParamInt(int key1, int key2) { for (uint i = 0; i < getCount(); i++) { ExCommand *ex = getExCommandByIndex(i); int k = ex->_messageKind; if ((k == 1 || k == 20 || k == 5 || k == 6 || k == 2 || k == 18 || k == 19 || k == 22 || k == 55) && ex->_param == key1) ex->_param = key2; } }
void MessageQueue::changeParam28ForObjectId(int objId, int oldParam28, int newParam28) { for (uint i = 0; i < _exCommands.size(); i++) { ExCommand *ex = getExCommandByIndex(i); int k = ex->_messageKind; if ((k == 1 || k == 20 || k == 5 || k == 6 || k == 2 || k == 18 || k == 19 || k == 22 || k == 55) && ex->_keyCode == oldParam28 && ex->_parentId == objId) ex->_keyCode = newParam28; } }
int MessageQueue::activateExCommandsByKind(int kind) { int res = 0; for (uint i = 0; i < getCount(); i++) { ExCommand *ex = getExCommandByIndex(i); if (ex->_messageKind == kind) { ex->_messageKind = 0; ex->_excFlags |= 1; res++; } } return res; }
int MessageQueue::calcDuration(StaticANIObject *obj) { int res = 0; ExCommand *ex; Movement *mov; for (uint i = 0; (ex = getExCommandByIndex(i)); i++) if (ex->_parentId == obj->_id) { if (ex->_messageKind == 1 || ex->_messageKind == 20) { if ((mov = obj->getMovementById(ex->_messageNum)) != 0) { if (ex->_field_14 >= 1) res += ex->_field_14; else res += mov->calcDuration(); } } } return res; }
bool MessageQueue::checkGlobalExCommandList2() { ExCommand *ex, *ex1; for (uint i = 0; i < getCount(); i++) { ex = getExCommandByIndex(i); if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27) continue; for (Common::List<ExCommand *>::iterator it = g_fp->_exCommandList.begin(); it != g_fp->_exCommandList.end();) { ex1 = *it; if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27) { it++; continue; } if (ex1->_param != ex->_param && ex1->_param != -1 && ex->_param != -1) { it++; continue; } MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex1->_parId); if (mq) { if (mq->getFlags() & 1) return false; delete mq; } it = g_fp->_exCommandList.erase(it); if (ex1->_excFlags & 2) { delete ex1; } } } return true; }