void AGOSEngine::vcStopAnimation(uint16 zone, uint16 sprite) { uint16 oldCurSpriteId, oldCurZoneNum; VgaSprite *vsp; VgaTimerEntry *vte; const byte *vcPtrOrg; oldCurSpriteId = _vgaCurSpriteId; oldCurZoneNum = _vgaCurZoneNum; vcPtrOrg = _vcPtr; _vgaCurZoneNum = zone; _vgaCurSpriteId = sprite; vsp = findCurSprite(); if (vsp->id) { vc25_halt_sprite(); vte = _vgaTimerList; while (vte->delay) { if (vte->id == _vgaCurSpriteId && vte->zoneNum == _vgaCurZoneNum) { deleteVgaEvent(vte); break; } vte++; } } _vgaCurZoneNum = oldCurZoneNum; _vgaCurSpriteId = oldCurSpriteId; _vcPtr = vcPtrOrg; }
void AGOSEngine::processVgaEvents() { VgaTimerEntry *vte = _vgaTimerList; _vgaTickCounter++; while (vte->delay) { vte->delay -= _vgaBaseDelay; if (vte->delay <= 0) { uint16 curZoneNum = vte->zoneNum; uint16 curSprite = vte->id; const byte *script_ptr = vte->codePtr; switch (vte->type) { case ANIMATE_INT: vte->delay = (getGameType() == GType_SIMON2) ? 5 : _frameCount; animateSprites(); vte++; break; case ANIMATE_EVENT: _nextVgaTimerToProcess = vte + 1; deleteVgaEvent(vte); animateEvent(script_ptr, curZoneNum, curSprite); vte = _nextVgaTimerToProcess; break; case SCROLL_EVENT: _nextVgaTimerToProcess = vte + 1; deleteVgaEvent(vte); scrollEvent(); vte = _nextVgaTimerToProcess; break; case PLAYER_DAMAGE_EVENT: playerDamageEvent(vte, curZoneNum); vte = _nextVgaTimerToProcess; break; case MONSTER_DAMAGE_EVENT: monsterDamageEvent(vte, curZoneNum); vte = _nextVgaTimerToProcess; break; default: error("processVgaEvents: Unknown event type %d", vte->type); } } else { vte++; } } }
void AGOSEngine_Simon1::vcStopAnimation(uint16 zone, uint16 sprite) { uint16 oldCurSpriteId, oldCurZoneNum; VgaSleepStruct *vfs; VgaSprite *vsp; VgaTimerEntry *vte; const byte *vcPtrOrg; oldCurSpriteId = _vgaCurSpriteId; oldCurZoneNum = _vgaCurZoneNum; vcPtrOrg = _vcPtr; _vgaCurZoneNum = zone; _vgaCurSpriteId = sprite; vfs = _waitSyncTable; while (vfs->ident != 0) { if (vfs->id == _vgaCurSpriteId && vfs->zoneNum == _vgaCurZoneNum) { while (vfs->ident != 0) { memcpy(vfs, vfs + 1, sizeof(VgaSleepStruct)); vfs++; } break; } vfs++; } vsp = findCurSprite(); if (vsp->id) { vc25_halt_sprite(); vte = _vgaTimerList; while (vte->delay) { if (vte->id == _vgaCurSpriteId && vte->zoneNum == _vgaCurZoneNum) { deleteVgaEvent(vte); break; } vte++; } } _vgaCurZoneNum = oldCurZoneNum; _vgaCurSpriteId = oldCurSpriteId; _vcPtr = vcPtrOrg; }
void AGOSEngine::monsterDamageEvent(VgaTimerEntry * vte, uint dx) { // Draws damage indicator gauge when monster hit _nextVgaTimerToProcess = vte + 1; if (!_opcode178Var1) { drawStuff(_image3, 275 + _opcode178Var2 * 4); _opcode178Var2++; if (_opcode178Var2 >= 10 || _opcode178Var2 == dx) { _opcode178Var1 = 1; vte->delay = 16 - dx; } else { vte->delay = 1; } } else if (_opcode178Var2) { _opcode178Var2--; drawStuff(_image4, 275 + _opcode178Var2 * 4); vte->delay = 3; } else { deleteVgaEvent(vte); } }