void LoLEngine::timerUpdatePortraitAnimations(int skipUpdate) { if (skipUpdate != 1) skipUpdate = 0; for (int i = 0; i < 4; i++) { if (!(_characters[i].flags & 1) || (_characters[i].flags & 8) || (_characters[i].curFaceFrame > 1)) continue; if (_characters[i].curFaceFrame != 1) { if (--_characters[i].nextAnimUpdateCountdown <= 0 && !skipUpdate) { _characters[i].curFaceFrame = 1; gui_drawCharPortraitWithStats(i); _timer->setCountdown(9, 10); } } else { _characters[i].curFaceFrame = 0; gui_drawCharPortraitWithStats(i); _characters[i].nextAnimUpdateCountdown = rollDice(1, 12) + 6; } } }
void EoBCoreEngine::sparkEffectDefensive(int charIndex) { int first = charIndex; int last = charIndex; if (charIndex == -1) { first = 0; last = 5; } for (int i = 0; i < 8; i++) { for (int ii = first; ii <= last; ii++) { if (!testCharacter(ii, 1) || (_currentControlMode && ii != _updateCharNum)) continue; gui_drawCharPortraitWithStats(ii); for (int iii = 0; iii < 4; iii++) { int shpIndex = ((_sparkEffectDefSteps[i] & _sparkEffectDefSubSteps[iii]) >> _sparkEffectDefShift[iii]); if (!shpIndex) continue; int x = _sparkEffectDefAdd[iii * 2] - 8; int y = _sparkEffectDefAdd[iii * 2 + 1]; if (_currentControlMode) { x += 181; y += 3; } else { x += (_sparkEffectDefX[ii] << 3); y += _sparkEffectDefY[ii]; } _screen->drawShape(0, _sparkShapes[shpIndex - 1], x, y, 0); _screen->updateScreen(); } } delay(2 * _tickLength); } for (int i = first; i < last; i++) gui_drawCharPortraitWithStats(i); }
void LoLEngine::timerRegeneratePoints(int timerNum) { for (int i = 0; i < 4; i++) { if (!(_characters[i].flags & 1)) continue; // check for Duble ring int hInc = (_characters[i].flags & 8) ? 0 : (itemEquipped(i, 228) ? 4 : 1); // check for Talba ring int mInc = _drainMagic ? ((_characters[i].magicPointsMax >> 5) * -1) : ((_characters[i].flags & 8) ? 0 : (itemEquipped(i, 227) ? (_characters[i].magicPointsMax / 10) : 1)); _characters[i].magicPointsCur = CLIP<int16>(_characters[i].magicPointsCur + mInc, 0, _characters[i].magicPointsMax); if (!(_characters[i].flags & 0x80)) increaseCharacterHitpoints(i, hInc, false); gui_drawCharPortraitWithStats(i); } }
void EoBCoreEngine::removeCharacterEffect(int spell, int charIndex, int showWarning) { assert(spell >= 0); EoBCharacter *c = &_characters[charIndex]; EoBSpell *s = &_spells[spell]; if (showWarning) { int od = _screen->curDimIndex(); Screen::FontId of = _screen->setFont(Screen::FID_6_FNT); _screen->setScreenDim(7); printWarning(Common::String::format(_magicStrings3[_flags.gameID == GI_EOB1 ? 3 : 2], c->name, s->name).c_str()); _screen->setScreenDim(od); _screen->setFont(of); } if (s->endCallback) (this->*s->endCallback)(c); if (s->flags & 1) c->effectFlags &= ~s->effectFlags; if (s->flags & 4) _partyEffectFlags &= ~s->effectFlags; if (s->flags & 0x200) { for (int i = 0; i < 6; i++) { if (!testCharacter(i, 1)) continue; if (!testCharacter(i, 2) && !(s->flags & 0x800)) continue; _characters[i].effectFlags &= ~s->effectFlags; } } if (s->flags & 0x2) recalcArmorClass(_activeSpellCharId); if (showWarning) { if (s->flags & 0x20A0) gui_drawCharPortraitWithStats(charIndex); else if (s->flags & 0x40) gui_drawAllCharPortraitsWithStats(); } }
void LoLEngine::timerSpecialCharacterUpdate(int timerNum) { int v = 0; for (int i = 0; i < 4; i++) { if (!(_characters[i].flags & 1)) continue; for (int ii = 0; ii < 5; ii++) { if (!(_characters[i].characterUpdateEvents[ii])) continue; if (--_characters[i].characterUpdateDelay[ii] > 0) { if (_characters[i].characterUpdateDelay[ii] > v) v = _characters[i].characterUpdateDelay[ii]; continue; } switch (_characters[i].characterUpdateEvents[ii] - 1) { case 0: if (_characters[i].weaponHit) { _characters[i].weaponHit = 0; _characters[i].characterUpdateDelay[ii] = calcMonsterSkillLevel(i, 6); if (_characters[i].characterUpdateDelay[ii] > v) v = _characters[i].characterUpdateDelay[ii]; } else { _characters[i].flags &= 0xfffb; } gui_drawCharPortraitWithStats(i); break; case 1: _characters[i].damageSuffered = 0; gui_drawCharPortraitWithStats(i); break; case 2: _characters[i].flags &= 0xffbf; gui_drawCharPortraitWithStats(i); break; case 3: v = rollDice(1, 2); if (inflictDamage(i, v, 0x8000, 0, 0x80)) { _txt->printMessage(2, getLangString(0x4022), _characters[i].name); _characters[i].characterUpdateDelay[ii] = 10; if (_characters[i].characterUpdateDelay[ii] > v) v = _characters[i].characterUpdateDelay[ii]; } break; case 4: _characters[i].flags &= 0xfeff; _txt->printMessage(0, getLangString(0x4027), _characters[i].name); gui_drawCharPortraitWithStats(i); break; case 5: setTemporaryFaceFrame(i, 0, 0, 1); break; case 6: _characters[i].flags &= 0xefff; gui_drawCharPortraitWithStats(i); break; case 7: restoreSwampPalette(); break; default: break; } if (_characters[i].characterUpdateDelay[ii] <= 0) _characters[i].characterUpdateEvents[ii] = 0; } } if (v) { _timer->enable(3); _timer3Para = v * 15; } else { _timer->disable(3); } }
void EoBCoreEngine::usePotion(int charIndex, int weaponSlot) { EoBCharacter *c = &_characters[charIndex]; int val = deleteInventoryItem(charIndex, weaponSlot); snd_playSoundEffect(10); if (_flags.gameID == GI_EOB1) val--; switch (val) { case 0: sparkEffectDefensive(charIndex); c->strengthCur = 22; c->strengthExtCur = 0; setCharEventTimer(charIndex, 546 * rollDice(1, 4, 4), 7, 1); break; case 1: sparkEffectDefensive(charIndex); modifyCharacterHitpoints(charIndex, rollDice(2, 4, 2)); break; case 2: sparkEffectDefensive(charIndex); modifyCharacterHitpoints(charIndex, rollDice(3, 8, 3)); break; case 3: statusAttack(charIndex, 2, _potionStrings[0], 0, 1, 8, 1); c->effectFlags &= ~0x2000; if (c->flags & 2) return; break; case 4: sparkEffectDefensive(charIndex); c->food = 100; if (_currentControlMode) gui_drawCharPortraitWithStats(charIndex); break; case 5: sparkEffectDefensive(charIndex); c->effectFlags |= 0x10000; setCharEventTimer(charIndex, 546 * rollDice(1, 4, 4), 12, 1); snd_playSoundEffect(100); gui_drawCharPortraitWithStats(charIndex); break; case 6: sparkEffectDefensive(charIndex); c->effectFlags |= 0x40; gui_drawCharPortraitWithStats(charIndex); break; case 7: sparkEffectDefensive(charIndex); neutralizePoison(charIndex); break; default: break; } _txt->printMessage(_potionStrings[1], -1, c->name, _potionEffectStrings[val]); }
void EoBCoreEngine::startSpell(int spell) { EoBSpell *s = &_spells[spell]; EoBCharacter *c = &_characters[_activeSpellCharId]; snd_playSoundEffect(s->sound); if (s->flags & 0xA0) sparkEffectDefensive(_activeSpellCharId); else if (s->flags & 0x40) sparkEffectDefensive(-1); else if (s->flags & 0x1000) sparkEffectOffensive(); if (s->flags & 0x20) { _txt->printMessage(c->name); _txt->printMessage(_flags.gameID == GI_EOB1 ? _magicStrings3[1] : _magicStrings1[5]); } if ((s->flags & 0x30) && (s->effectFlags & c->effectFlags)) { if (_flags.gameID == GI_EOB2) printWarning(Common::String::format(_magicStrings7[0], c->name, s->name).c_str()); } else if ((s->flags & 0x50) && (s->effectFlags & _partyEffectFlags)) { if (_flags.gameID == GI_EOB1 && s->effectFlags == 0x400) // EOB 1 only warns in case of a bless spell printWarning(_magicStrings8[1]); else printWarning(Common::String::format(_magicStrings7[1], s->name).c_str()); } else { if (s->flags & 8) setSpellEventTimer(spell, s->timingPara[0], s->timingPara[1], s->timingPara[2], s->timingPara[3]); _returnAfterSpellCallback = false; if (s->startCallback) (this->*s->startCallback)(); if (_returnAfterSpellCallback) return; if (s->flags & 1) c->effectFlags |= s->effectFlags; if (s->flags & 4) _partyEffectFlags |= s->effectFlags; if (s->flags & 0x200) { for (int i = 0; i < 6; i++) { if (!testCharacter(i, 1)) continue; if (!testCharacter(i, 2) && !(s->flags & 0x800)) continue; _characters[i].effectFlags |= s->effectFlags; } } if (s->flags & 2) recalcArmorClass(_activeSpellCharId); if (s->flags & 0x20A0) gui_drawCharPortraitWithStats(_activeSpellCharId); if (s->flags & 0x40) gui_drawAllCharPortraitsWithStats(); } if (_castScrollSlot) { gui_updateSlotAfterScrollUse(); } else { _characters[_openBookChar].disabledSlots |= 4; setCharEventTimer(_openBookChar, 72, 11, 1); gui_toggleButtons(); gui_drawSpellbook(); } if (_flags.gameID == GI_EOB2) { //_castSpellWd1 = spell; runLevelScript(_currentBlock, 0x800); //_castSpellWd1 = 0; } }