bool Game::cop_isObjectNotIntersectingBox() { debug(DBG_OPCODES, "Game::cop_isObjectNotIntersectingBox()"); int16 var1A = _objectScript.fetchNextWord(); int var18 = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (var18 != -1) { SceneObject *so = derefSceneObject(var18); if (so->statePrev != 0) { int16 var1E = getObjectTransformXPos(var18); int16 var22 = getObjectTransformYPos(var18); var18 = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (var18 != -1) { so = derefSceneObject(var18); if (so->statePrev != 0) { int16 var20 = getObjectTransformXPos(var18); int16 var24 = getObjectTransformYPos(var18); bool foundBox = false; for (int i = 0; i < _boxesCountTable[var1A]; ++i) { if (intersectsBox(var1A, i, var1E, var22, var20, var24)) { foundBox = true; break; } } if (foundBox) { if (var18 == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX return true; } return false; } foundBox = false; for (int i = 0; i < _boxesCountTable[10 + var1A]; ++i) { if (intersectsBox(10 + var1A, i, var1E, var22, var20, var24)) { foundBox = true; break; } } if (foundBox) { if (var18 == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX return true; } return false; } return true; } } } } if (var18 == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX return true; } return false; }
void Game::changeObjectMotionFrame(int object, int object2, int useObject2, int count1, int count2, int useDx, int dx, int useDy, int dy) { debug(DBG_GAME, "Game::changeObjectMotionFrame()"); SceneObject *so = derefSceneObject(object); if (so->statePrev != 0) { int num; if (useObject2) { num = derefSceneObject(object2)->motionInit; } else { num = _animationsTable[_sceneObjectMotionsTable[so->motionNum1].animNum].firstMotionIndex; } so->motionNum2 = num + count2 - 1; so->frameNum = _sceneObjectMotionsTable[so->motionNum2].firstFrameIndex + count1 - 1; if (so->flipPrev == 2) { int x = so->xPrev + _sceneObjectFramesTable[so->frameNumPrev].hdr.xPos; if (useDx) { x -= dx; } else { x -= _sceneObjectFramesTable[so->frameNum].hdr.xPos; } so->x = x + _sceneObjectFramesTable[so->frameNumPrev].hdr.w - _sceneObjectFramesTable[so->frameNum].hdr.w; /* int y = so->yPrev - _sceneObjectFramesTable[so->frameNumPrev].hdr.yPos; if (useDy) { y += dy; } else { y += _sceneObjectFramesTable[so->frameNum].hdr.yPos; } so->y = y;*/ } else { int x = so->xPrev - _sceneObjectFramesTable[so->frameNumPrev].hdr.xPos; if (useDx) { x += dx; } else { x += _sceneObjectFramesTable[so->frameNum].hdr.xPos; } so->x = x; /* int y = so->yPrev - _sceneObjectFramesTable[so->frameNumPrev].hdr.yPos; if (useDy) { y += dy; } else { y += _sceneObjectFramesTable[so->frameNum].hdr.yPos; } so->y = y;*/ } int y = so->yPrev - _sceneObjectFramesTable[so->frameNumPrev].hdr.yPos; if (useDy) { y += dy; } else { y += _sceneObjectFramesTable[so->frameNum].hdr.yPos; } so->y = y; } }
bool Game::cop_isObjectNotInBox() { debug(DBG_OPCODES, "Game::cop_isObjectNotInBox()"); bool ret = true; int16 var1A = _objectScript.fetchNextWord(); // boxNum int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); // var18 if (index == -1) { ret = false; } if (ret) { SceneObject *so = derefSceneObject(index); if (so->statePrev != 0) { int16 var1E = getObjectTransformXPos(index); int16 var20 = getObjectTransformXPos(index); int16 var22 = getObjectTransformYPos(index); int16 var24 = getObjectTransformYPos(index); bool foundBox = false; for (int i = 0; i < _boxesCountTable[var1A]; ++i) { Box *box = derefBox(var1A, i); if (boxInRect(box, var1E, var20, var22, var24) && box->state == 1) { foundBox = true; break; } } if (foundBox) { if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } return ret; } foundBox = false; for (int i = 0; i < _boxesCountTable[10 + var1A]; ++i) { Box *box = derefBox(10 + var1A, i); if (boxInRect(box, var1E, var20, var22, var24) && box->state == 1) { foundBox = true; break; } } if (foundBox) { if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } return ret; } return true; } } if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } return ret; }
bool Game::cop_testMotionNum() { debug(DBG_OPCODES, "Game::cop_testMotionNum"); bool ret = true; int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index == -1) { ret = false; } if (ret) { SceneObject *so = derefSceneObject(index); if (so->statePrev != 0) { int16 _dx = so->motionNum2 - _animationsTable[_sceneObjectMotionsTable[so->motionNum1].animNum].firstMotionIndex; int16 _ax = 0; if (_objectScript.objectFound) { if (_sceneObjectMotionsTable[so->motionNum1].animNum != _sceneObjectMotionsTable[so->motionInit].animNum) { _ax = _animationsTable[_sceneObjectMotionsTable[so->motionNum1].animNum].unk26; } } if (testExpr(_ax + _dx + 1)) { return true; } } if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } } return ret; }
bool Game::cop_isObjectInRect() { debug(DBG_OPCODES, "Game::cop_isObjectInRect"); bool ret = true; int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index == -1) { ret = false; } int16 var1E = _objectScript.fetchNextWord(); // x1 int16 var22 = _objectScript.fetchNextWord(); // y1 int16 var20 = _objectScript.fetchNextWord(); // x2 int16 var24 = _objectScript.fetchNextWord(); // y2 assert(var1E <= var20); assert(var22 <= var24); if (ret) { SceneObject *so = derefSceneObject(index); if (so->state != 0) { int xObj = so->xPrev + _sceneObjectFramesTable[so->frameNumPrev].hdr.w; if (xObj >= var1E && so->xPrev <= var20) { int yObj = so->yPrev + _sceneObjectFramesTable[so->frameNumPrev].hdr.h; if (yObj >= var22 && so->yPrev <= var24) { return ret; } } } if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } } return ret; }
void Game::oop_addObjectToBag() { debug(DBG_OPCODES, "Game::oop_addObjectToBag()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); if (findBagObjectByName(so->name) == -1) { assert(_bagObjectsCount < NUM_BAG_OBJECTS); BagObject *bo = &_bagObjectsTable[_bagObjectsCount]; strcpy(bo->name, so->name); SceneObjectFrame *sof = &_sceneObjectFramesTable[so->frameNumPrev]; uint32 size = sof->hdr.w * sof->hdr.h + 4; bo->data = (uint8 *)malloc(size); if (bo->data) { bo->dataSize = decodeLzss(sof->data, bo->data); assert(bo->dataSize == size); } ++_bagObjectsCount; if (_bagObjectsCount != 0 && _currentBagObject == -1) { _currentBagObject = 0; } } } }
bool Game::compareObjectTransformXPos(int object, bool fetchCmp, int cmpX) { debug(DBG_GAME, "Game::compareObjectTransformXPos(%d)", object); SceneObject *so = derefSceneObject(object); const int w = derefSceneObjectFrame(so->frameNum)->hdr.w; int16_t a0 = _objectScript.fetchNextWord(); int16_t a2 = _objectScript.fetchNextWord(); int16_t a4 = _objectScript.fetchNextWord(); int16_t a6 = _objectScript.fetchNextWord(); int16_t a8 = _objectScript.fetchNextWord(); int16_t aA = _objectScript.fetchNextWord(); if (fetchCmp) { cmpX = _objectScript.fetchNextWord(); } int16_t xmin = a0 * w / a2 + a4; int16_t xmax = a6 * w / a8 + aA; if (so->flip == 2) { xmin = w - xmin; xmax = w - xmax; } if (xmax < xmin) { SWAP(xmax, xmin); } return so->state != 0 && so->x + xmin <= cmpX && so->x + xmax >= cmpX; }
bool Game::compareObjectTransformYPos(int object, bool fetchCmp, int cmpY) { debug(DBG_GAME, "Game::compareObjectTransformYPos(%d)", object); SceneObject *so = derefSceneObject(object); const int h = derefSceneObjectFrame(so->frameNum)->hdr.h; int16_t a0 = _objectScript.fetchNextWord(); int16_t a2 = _objectScript.fetchNextWord(); int16_t a4 = _objectScript.fetchNextWord(); int16_t a6 = _objectScript.fetchNextWord(); int16_t a8 = _objectScript.fetchNextWord(); int16_t aA = _objectScript.fetchNextWord(); if (fetchCmp) { cmpY = _objectScript.fetchNextWord(); } int16_t ymin = a0 * h / a2 + a4; int16_t ymax = a6 * h / a8 + aA; if (so->flip == 1) { ymin = h - ymin; ymax = h - ymax; } if (ymax < ymin) { SWAP(ymax, ymin); } return so->state != 0 && so->y + ymin <= cmpY && so->y + ymax >= cmpY; }
bool Game::cop_testObjectMotionYPos() { debug(DBG_OPCODES, "Game::cop_testObjectMotionYPos()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); int num = so->motionNum + so->motionInit; int16 var1A = _sceneObjectMotionsTable[num].firstFrameIndex + so->motionFrameNum; int _ax = so->yPrev - so->yInit; _ax -= _sceneObjectFramesTable[so->frameNumPrev].hdr.yPos; _ax += _sceneObjectFramesTable[var1A].hdr.yPos; int16 div = _objectScript.fetchNextWord(); var1A = _ax % div; if (var1A < 0) { var1A += div; } int16 cmp = _objectScript.fetchNextWord(); if (var1A == cmp && so->state == 1) { return true; } if (index == _objectScript.testObjectNum) { assert(0); _objectScript.dataOffset = _objectScript.testDataOffset; return true; } } else { _objectScript.dataOffset += 4; } return false; }
bool Game::cop_testObjectAndObjectYPos() { debug(DBG_OPCODES, "Game::cop_testObjectAndObjectYPos()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); if (so->statePrev != 0) { int16 var22 = getObjectTransformYPos(index); int16 var24 = getObjectTransformYPos(index); int var18 = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (var18 != -1) { so = derefSceneObject(var18); if (so->statePrev == 0) { if (var18 == _objectScript.testObjectNum) { assert(0); _objectScript.dataOffset = _objectScript.testDataOffset; return true; } return false; } int16 var1E = getObjectTransformYPos(var18); int16 var20 = getObjectTransformYPos(var18); int16 _dx = MIN(var22, var24); int16 _ax = MAX(var1E, var20); if (_dx <= _ax) { _dx = MAX(var22, var24); _ax = MIN(var1E, var20); if (_dx >= _ax) { return true; } } if (index == _objectScript.testObjectNum || var18 == _objectScript.testObjectNum) { assert(0); _objectScript.dataOffset = _objectScript.testDataOffset; return true; } } return false; } if (index == _objectScript.testObjectNum) { assert(0); _objectScript.dataOffset = _objectScript.testDataOffset; return true; } } return false; }
void Game::oop_evalCurrentObjectY() { debug(DBG_OPCODES, "Game::oop_evalCurrentObjectY()"); SceneObject *so = derefSceneObject(_objectScript.currentObjectNum); if (so->state != 0) { _objectScript.dataOffset += 6; evalExpr(&so->y); } else { _objectScript.dataOffset += 6 + 4; } }
void Game::oop_evalObjectZ() { debug(DBG_OPCODES, "Game::oop_evalObjectZ()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); evalExpr(&so->z); } else { _objectScript.dataOffset += 4; } }
void Game::oop_setObjectFlip() { debug(DBG_OPCODES, "Game::oop_setObjectFlip()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); so->flip = _objectScript.fetchNextWord(); } else { _objectScript.dataOffset += 2; } }
void Game::oop_resetObjectCel() { debug(DBG_OPCODES, "Game::oop_resetObjectCel()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); so->motionNum = _objectScript.fetchNextWord() - 1; so->motionFrameNum = 0; } else { _objectScript.dataOffset += 2; } }
void Game::oop_setObjectTransformInitPos() { debug(DBG_OPCODES, "Game::oop_setObjectTransformInitPos()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); so->xInit = getObjectTransformXPos(_objectScript.currentObjectNum); so->yInit = getObjectTransformYPos(_objectScript.currentObjectNum); } else { _objectScript.dataOffset += 12; } }
void Game::oop_evalObjectVar() { debug(DBG_OPCODES, "Game::oop_evalObjectVar()"); int var = _objectScript.fetchNextWord(); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { assert(var >= 0 && var < 10); SceneObject *so = derefSceneObject(index); evalExpr(&so->varsTable[var]); } else { _objectScript.dataOffset += 4; } }
int16_t Game::getObjectTransformYPos(int object) { debug(DBG_GAME, "Game::getObjectTransformYPos(%d)", object); SceneObject *so = derefSceneObject(object); const int h = derefSceneObjectFrame(so->frameNumPrev)->hdr.h; int16_t a0 = _objectScript.fetchNextWord(); int16_t a2 = _objectScript.fetchNextWord(); int16_t a4 = _objectScript.fetchNextWord(); int16_t dy = a0 * h / a2 + a4; if (so->flipPrev == 1) { dy = h - dy - 1; } return so->yPrev + dy; }
void Game::oop_playSoundLowerPriority() { debug(DBG_OPCODES, "Game::oop_playSoundLowerPriority()"); int num = _objectScript.fetchNextWord(); int priority = _objectScript.fetchNextWord(); if (priority >= _currentPlayingSoundPriority) { if (win16_sndPlaySound(22) == 0) { return; } } SceneObject *so = derefSceneObject(_objectScript.currentObjectNum); num += _animationsTable[_sceneObjectMotionsTable[so->motionNum1].animNum].firstSoundBufferIndex - 1; assert(num >= 0 && num < _soundBuffersCount); win16_sndPlaySound(3, _soundBuffersTable[num].filename); // win16_sndPlaySound(7, _soundBuffersTable[num].buffer); _currentPlayingSoundPriority = priority; }
int16_t Game::getObjectTransformXPos(int object) { debug(DBG_GAME, "Game::getObjectTransformXPos(%d)", object); SceneObject *so = derefSceneObject(object); const int w = derefSceneObjectFrame(so->frameNumPrev)->hdr.w; int16_t a0 = _objectScript.fetchNextWord(); int16_t a2 = _objectScript.fetchNextWord(); int16_t a4 = _objectScript.fetchNextWord(); int16_t dx = a0 * w / a2 + a4; if (so->flipPrev == 2) { dx = w - dx - 1; } return so->xPrev + dx; }
void Game::oop_setObjectMode() { debug(DBG_OPCODES, "Game::oop_setObjectMode()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); int mode = _objectScript.fetchNextWord(); int modeRndMul = 0; if (mode == 2) { modeRndMul = _objectScript.fetchNextWord(); } if (index != -1) { SceneObject *so = derefSceneObject(index); so->mode = mode; if (mode == 2) { so->modeRndMul = modeRndMul; } } }
void Game::oop_saveObjectStatus() { debug(DBG_OPCODES, "Game::oop_saveObjectStatus()"); SceneObject *so = derefSceneObject(_objectScript.currentObjectNum); int xPrev; if (so->flipPrev == 2) { xPrev = so->xPrev + _sceneObjectFramesTable[so->frameNumPrev].hdr.w - 1; } else { xPrev = so->xPrev; } int index = _objectScript.fetchNextWord(); SceneObjectStatus *stat = derefSceneObjectStatus(index); stat->x = xPrev; stat->y = so->yPrev; stat->z = so->zPrev; stat->motionNum = so->motionNum1 - _animationsTable[_sceneObjectMotionsTable[so->motionNum1].animNum].firstMotionIndex; stat->frameNum = so->frameNumPrev - _sceneObjectMotionsTable[so->motionNum1].firstFrameIndex; stat->flip = so->flipPrev; }
void Game::reinitializeObject(int object) { debug(DBG_GAME, "Game::reinitializeObject(%d)", object); SceneObject *so = derefSceneObject(object); if (so->state != 1 && so->state != 2) { int16_t state = 0; switch (so->mode) { case 1: state = 1; break; case 2: { int16_t rnd = _rnd.getNumber(); int t = (rnd * so->modeRndMul) / 0x8000; if ((t & 0xFFFF) == 0) { state = 1; } } break; case 3: state = 2; break; } if (state != 0) { so->x = so->xInit; so->y = so->yInit; so->zPrev = so->z = so->zInit; so->flipPrev = so->flip = so->flipInit; so->motionNum1 = so->motionNum2 = so->motionNum + so->motionInit; so->frameNum = _sceneObjectMotionsTable[so->motionNum2].firstFrameIndex + so->motionFrameNum; if (so->flip == 2) { so->x -= _sceneObjectFramesTable[so->frameNum].hdr.w - 1; } if (so->flip == 1) { so->y -= _sceneObjectFramesTable[so->frameNum].hdr.h - 1; } if (so->state == 0) { so->xPrev = so->x; so->yPrev = so->y; so->frameNumPrev = so->frameNum; } so->state = so->statePrev = state; } } }
void Game::oop_translateObjectYPos() { debug(DBG_OPCODES, "Game::oop_translateObjectYPos()"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); int16 a0 = _objectScript.fetchNextWord(); int16 a2 = _objectScript.fetchNextWord(); int16 a4 = _objectScript.fetchNextWord(); int16 a6 = _objectScript.fetchNextWord(); int16 var1A = getObjectTranslateYPos(index, a0, a2, a4); if (a2 / 2 >= var1A) { so->y -= MIN<int16>(a6, var1A); } else { so->y += MIN<int16>(a6, a2 - var1A); } } else { _objectScript.dataOffset += 8; } }
void Game::oop_initializeObject() { debug(DBG_OPCODES, "Game::oop_initializeObject"); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); int16 op = _objectScript.fetchNextWord(); if (op == 0) { if (so->state != 0) { so->x = so->xPrev; so->y = so->yPrev; so->frameNum = so->frameNumPrev; if (so->state == 2) { SceneObjectFrame *sof = derefSceneObjectFrame(so->frameNum); copyBufferToBuffer(so->x, _bitmapBuffer1.h + 1 - so->y - sof->hdr.h, sof->hdr.w, sof->hdr.h, &_bitmapBuffer3, &_bitmapBuffer1); } so->state = -1; } } else if (op == 1) { int16 mode = so->mode; so->mode = 1; reinitializeObject(index); so->mode = mode; if (so->state == 2) { so->state = 1; } } else if (op == 2) { if (so->state == 1) { so->x = so->xPrev; so->y = so->yPrev; so->frameNum = so->frameNumPrev; so->state = 2; } else { int16 mode = so->mode; so->mode = 3; reinitializeObject(index); so->mode = mode; } } } else { _objectScript.dataOffset += 2; } }
bool Game::cop_testObjectTransformYPos() { debug(DBG_OPCODES, "Game::cop_testObjectTransformYPos"); bool ret = true; int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index == -1) { ret = false; } if (ret && derefSceneObject(index)->state != 0) { if (!compareObjectTransformYPos(index)) { if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } } } else { _objectScript.dataOffset += 14; } return ret; }
void Game::oop_setBoxToObject() { debug(DBG_OPCODES, "Game::oop_setBoxToObject()"); int16 var1A = _objectScript.fetchNextWord(); int16 var1C = _objectScript.fetchNextWord(); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index != -1) { SceneObject *so = derefSceneObject(index); if (so->statePrev != 0) { int16 var1E = getObjectTransformXPos(index); int16 var20 = getObjectTransformXPos(index); int16 var22 = getObjectTransformYPos(index); int16 var24 = getObjectTransformYPos(index); Box *box = derefBox(var1A, var1C); box->x1 = MIN(var1E, var20); box->x2 = MAX(var1E, var20); box->y1 = MIN(var24, var22); box->y2 = MAX(var24, var22); return; } } _objectScript.dataOffset += 24; }
bool Game::cop_testObjectFlip() { debug(DBG_OPCODES, "Game::cop_testObjectFlip"); bool ret = true; int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index == -1) { ret = false; } if (ret) { SceneObject *so = derefSceneObject(index); int16 flip = _objectScript.fetchNextWord(); if (flip != so->flip) { if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } } } else { _objectScript.dataOffset += 2; } return ret; }
bool Game::cop_testObjectVar() { debug(DBG_OPCODES, "Game::cop_testObjectVar()"); bool ret = true; int var = _objectScript.fetchNextWord(); int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index == -1) { ret = false; } if (ret) { SceneObject *so = derefSceneObject(index); assert(var >= 0 && var < 10); if (!testExpr(so->varsTable[var])) { if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } } //_logExpr = false; } return ret; }
int Game::getObjectTranslateYPos(int object, int dy1, int div, int dy2) { debug(DBG_GAME, "Game::getObjectTranslateYPos(%d, %d, %d, %d)", object, dy1, div, dy2); SceneObject *so = derefSceneObject(object); int16_t _di = _sceneObjectMotionsTable[so->motionNum + so->motionInit].firstFrameIndex + so->motionFrameNum; int16_t _ax, _dx; if (so->flip == 1) { _ax = _sceneObjectFramesTable[_di].hdr.yPos - _sceneObjectFramesTable[so->frameNum].hdr.yPos; _ax += _sceneObjectFramesTable[_di].hdr.h - _sceneObjectFramesTable[so->frameNum].hdr.h; _ax += dy1; } else { _ax = _sceneObjectFramesTable[so->frameNum].hdr.yPos - _sceneObjectFramesTable[_di].hdr.yPos; } if (so->flipInit == 1) { _dx = 1 - _sceneObjectFramesTable[_di].hdr.h - dy1; } else { _dx = 0; } _ax = so->y - so->yInit - _dx - _ax - dy2; int16_t _si = _ax % div; if (_si < 0) { _si += div; } return _si; }
bool Game::cop_testObjectFrameNum() { debug(DBG_OPCODES, "Game::cop_testObjectFrameNum"); bool ret = true; int index = findObjectByName(_objectScript.currentObjectNum, _objectScript.testObjectNum, &_objectScript.objectFound); if (index == -1) { ret = false; } if (ret) { SceneObject *so = derefSceneObject(index); if (so->statePrev != 0) { int16 val = so->frameNum - _sceneObjectMotionsTable[so->motionNum2].firstFrameIndex + 1; if (testExpr(val)) { return true; } } if (index == _objectScript.testObjectNum) { _objectScript.dataOffset = _objectScript.testDataOffset; assert(0); // XXX } else { ret = false; } } return ret; }