Initial commit
This commit is contained in:
398
engines/lastexpress/fight/fight.cpp
Normal file
398
engines/lastexpress/fight/fight.cpp
Normal file
@@ -0,0 +1,398 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fight.h"
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
int LastExpressEngine::doFight(int fightId) {
|
||||
int fightNode;
|
||||
TBM *tbm;
|
||||
|
||||
if (_fightSkipCounter >= 5 && (fightId == 2004 || fightId == 2005)) {
|
||||
_fightSkipCounter = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
getLogicManager()->displayWaitIcon();
|
||||
getMessageManager()->clearClickEvents();
|
||||
|
||||
getLogicManager()->_doubleClickFlag = false;
|
||||
mouseSetLeftClicked(false);
|
||||
mouseSetRightClicked(false);
|
||||
|
||||
getOtisManager()->wipeAllGSysInfo();
|
||||
|
||||
switch (fightId) {
|
||||
case 2001:
|
||||
fightNode = 44 - (getLogicManager()->getModel(1) == 2);
|
||||
break;
|
||||
case 2002:
|
||||
fightNode = 45;
|
||||
break;
|
||||
case 2003:
|
||||
fightNode = 46;
|
||||
break;
|
||||
case 2004:
|
||||
fightNode = 47;
|
||||
break;
|
||||
case 2005:
|
||||
fightNode = 48;
|
||||
break;
|
||||
default:
|
||||
fightNode = 820;
|
||||
break;
|
||||
}
|
||||
|
||||
if (getGraphicsManager()->canDrawMouse()) {
|
||||
getGraphicsManager()->setMouseDrawable(false);
|
||||
getGraphicsManager()->burstMouseArea();
|
||||
}
|
||||
|
||||
char sceneName[12];
|
||||
Common::strcpy_s(sceneName, getLogicManager()->_trainData[fightNode].sceneFilename);
|
||||
|
||||
int bgResult = getArchiveManager()->loadBG(sceneName);
|
||||
if (bgResult <= 0) {
|
||||
if (bgResult)
|
||||
return 1;
|
||||
|
||||
tbm = &getGraphicsManager()->_renderBox1;
|
||||
} else {
|
||||
tbm = &getGraphicsManager()->_renderBox2;
|
||||
}
|
||||
|
||||
getLogicManager()->_activeNode = fightNode;
|
||||
|
||||
(_characters->characters[kCharacterCath]).characterPosition = getLogicManager()->_trainData[fightNode].nodePosition;
|
||||
getSoundManager()->_scanAnySoundLoopingSection = true;
|
||||
|
||||
if (getGraphicsManager()->acquireSurface()) {
|
||||
getGraphicsManager()->copy(getGraphicsManager()->_frontBuffer, (PixMap *)getGraphicsManager()->_screenSurface.getPixels(), tbm->x, tbm->y, tbm->width, tbm->height);
|
||||
getGraphicsManager()->unlockSurface();
|
||||
}
|
||||
|
||||
getMemoryManager()->freeFX();
|
||||
|
||||
_fight = new CFight(this, fightId);
|
||||
|
||||
_fight->timer(0, 0);
|
||||
|
||||
getGraphicsManager()->burstBox(tbm->x, tbm->y, tbm->width, tbm->height);
|
||||
getLogicManager()->restoreEggIcon();
|
||||
|
||||
int outcome = _fight->process();
|
||||
|
||||
delete _fight;
|
||||
_fight = nullptr;
|
||||
|
||||
getMemoryManager()->lockFX();
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
void LastExpressEngine::abortFight() {
|
||||
if (_fight)
|
||||
_fight->setFightHappening(false);
|
||||
}
|
||||
|
||||
CFight::CFight(LastExpressEngine *engine, int fightId) {
|
||||
_engine = engine;
|
||||
|
||||
_currentSeqIdx = 0;
|
||||
|
||||
switch (fightId) {
|
||||
case 2001: // Cath vs Milos
|
||||
_cath = new CCath1(_engine, this);
|
||||
_opponent = new COpponent1(_engine, this);
|
||||
break;
|
||||
case 2002: // Cath vs Vesna (when saving Anna)
|
||||
_cath = new CCath2(_engine, this);
|
||||
_opponent = new COpponent2(_engine, this);
|
||||
break;
|
||||
case 2003: // Cath vs Ivo
|
||||
_cath = new CCath3(_engine, this);
|
||||
_opponent = new COpponent3(_engine, this);
|
||||
break;
|
||||
case 2004: // Cath vs Salko
|
||||
_cath = new CCath4(_engine, this);
|
||||
_opponent = new COpponent4(_engine, this);
|
||||
break;
|
||||
case 2005: // Cath vs Vesna (final fight)
|
||||
_cath = new CCath5(_engine, this);
|
||||
_opponent = new COpponent5(_engine, this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!_cath || !_opponent) {
|
||||
error("Out of memory");
|
||||
}
|
||||
|
||||
if (_cath->init(_opponent) && _opponent->init(_cath)) {
|
||||
_fightIsHappening = true;
|
||||
if (_engine->_fightSkipCounter >= 5) {
|
||||
switch (fightId) {
|
||||
case 2001:
|
||||
_opponent->setHitPoints(1);
|
||||
_cath->doAction(4, 0);
|
||||
_opponent->doAction(0, 0);
|
||||
break;
|
||||
case 2003:
|
||||
_opponent->setHitPoints(1);
|
||||
_cath->doAction(3, 0);
|
||||
_opponent->doAction(6, 0);
|
||||
break;
|
||||
case 2005:
|
||||
_opponent->setHitPoints(1);
|
||||
_cath->doAction(0, 0);
|
||||
_cath->doAction(3, 2);
|
||||
_opponent->doAction(5, 0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
_cath->doAction(0, 0);
|
||||
_opponent->doAction(0, 0);
|
||||
}
|
||||
} else {
|
||||
endFight(0);
|
||||
}
|
||||
|
||||
_savedMouseEventHandle = _engine->getMessageManager()->getEventHandle(1);
|
||||
_savedTimerEventHandle = _engine->getMessageManager()->getEventHandle(3);
|
||||
|
||||
_engine->getMessageManager()->setEventHandle(kEventChannelMouse, &LastExpressEngine::fightMouseWrapper);
|
||||
_engine->getMessageManager()->setEventHandle(kEventChannelTimer, &LastExpressEngine::fightTimerWrapper);
|
||||
|
||||
_engine->setEventTickInternal(false);
|
||||
}
|
||||
|
||||
CFight::~CFight() {
|
||||
if (_cath) {
|
||||
delete _cath;
|
||||
_cath = nullptr;
|
||||
}
|
||||
|
||||
if (_opponent) {
|
||||
delete _opponent;
|
||||
_opponent = nullptr;
|
||||
}
|
||||
|
||||
_engine->getMessageManager()->setEventHandle(kEventChannelMouse, _savedMouseEventHandle);
|
||||
_engine->getMessageManager()->setEventHandle(kEventChannelTimer, _savedTimerEventHandle);
|
||||
}
|
||||
|
||||
int CFight::process() {
|
||||
setOutcome(1);
|
||||
|
||||
while (_fightIsHappening) {
|
||||
do {
|
||||
_engine->getSoundManager()->soundThread();
|
||||
} while (_engine->getMessageManager()->process());
|
||||
|
||||
// Only wait and handle events if we've processed all messages, unlike the original which had a separate thread for input...
|
||||
_engine->waitForTimer(5);
|
||||
}
|
||||
|
||||
return _outcome;
|
||||
}
|
||||
|
||||
void CFight::setOutcome(int outcome) {
|
||||
_outcome = outcome;
|
||||
}
|
||||
|
||||
void CFight::endFight(int outcome) {
|
||||
_engine->_fightSkipCounter = 0;
|
||||
setOutcome(outcome);
|
||||
_engine->abortFight();
|
||||
}
|
||||
|
||||
void CFight::timer(Event *event, bool isProcessing) {
|
||||
_engine->setEventTickInternal(false);
|
||||
|
||||
if (_engine->_gracePeriodTimer) {
|
||||
if ((_engine->getLogicManager()->_globals[kGlobalJacket] < 2 ? 225 : 450) == _engine->_gracePeriodTimer || _engine->_gracePeriodTimer == 900) {
|
||||
_eggIconBrightness = 0;
|
||||
_eggIconBrightnessStep = 1;
|
||||
}
|
||||
|
||||
if (!_engine->_lockGracePeriod) // Gets set to true only by the debugger only...
|
||||
_engine->_gracePeriodTimer--;
|
||||
|
||||
if (_engine->_gracePeriodTimer <= 500 ||
|
||||
!(_engine->_gracePeriodTimer % 5)) {
|
||||
|
||||
if ((_engine->_gracePeriodTimer <= 500 && !(_engine->_gracePeriodTimer % ((_engine->_gracePeriodTimer + 100) / 100))) ||
|
||||
(_engine->_gracePeriodTimer > 500 && !(_engine->_gracePeriodTimer % 5))) {
|
||||
if (_eggIconBrightness) {
|
||||
_engine->getGraphicsManager()->drawItemDim(_engine->_currentGameFileColorId + 39, 608, 448, _eggIconBrightness);
|
||||
} else {
|
||||
_engine->getGraphicsManager()->drawItem(_engine->_currentGameFileColorId + 39, 608, 448);
|
||||
}
|
||||
|
||||
_engine->getGraphicsManager()->burstBox(608, 448, 32, 32);
|
||||
_eggIconBrightness += _eggIconBrightnessStep;
|
||||
|
||||
if (!_eggIconBrightness || _eggIconBrightness == 3)
|
||||
_eggIconBrightnessStep = -_eggIconBrightnessStep;
|
||||
}
|
||||
}
|
||||
|
||||
if (_engine->_gracePeriodTimer == 90) {
|
||||
_engine->getSoundManager()->playSoundFile("TIMER.SND", kSoundTypeMenu | kVolumeFull, 0, 0);
|
||||
}
|
||||
|
||||
if (_engine->_gracePeriodTimer < 90 && !_engine->getLogicManager()->dialogRunning("TIMER"))
|
||||
_engine->_gracePeriodTimer = 0;
|
||||
|
||||
if (!_engine->_gracePeriodTimer) {
|
||||
if (_engine->_cursorX < 608 || _engine->_cursorY < 448 || _engine->_cursorX >= 640 || _engine->_cursorY >= 480) {
|
||||
_engine->getGraphicsManager()->drawItemDim(_engine->_currentGameFileColorId + 39, 608, 448, 1);
|
||||
} else {
|
||||
_engine->getGraphicsManager()->drawItem(_engine->_currentGameFileColorId + 39, 608, 448);
|
||||
}
|
||||
|
||||
_engine->getGraphicsManager()->burstBox(608, 448, 32, 32);
|
||||
_engine->getVCR()->makePermanent();
|
||||
}
|
||||
}
|
||||
|
||||
if (!_currentSeqIdx) {
|
||||
Link *link = nullptr;
|
||||
uint8 location = 0;
|
||||
|
||||
for (Link *i = _engine->getLogicManager()->_trainData[_engine->getLogicManager()->_activeNode].link; i; i = i->next) {
|
||||
if (_engine->getLogicManager()->pointIn(_engine->_cursorX, _engine->_cursorY, i) && location <= i->location) {
|
||||
location = i->location;
|
||||
link = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!link || (_engine->_cursorType = link->cursor, !_cath->actionAvailable(link->action)))
|
||||
_engine->_cursorType = 0;
|
||||
|
||||
_cath->timer();
|
||||
_opponent->timer();
|
||||
|
||||
if (_fightIsHappening) {
|
||||
if (isProcessing) {
|
||||
_engine->getSpriteManager()->drawCycle();
|
||||
} else if (_engine->getGraphicsManager()->acquireSurface()) {
|
||||
_engine->getSpriteManager()->drawCycleSimple((PixMap *)_engine->getGraphicsManager()->_screenSurface.getPixels());
|
||||
_engine->getGraphicsManager()->unlockSurface();
|
||||
}
|
||||
|
||||
if (_currentSeqIdx) {
|
||||
_currentSeqIdx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFight::mouse(Event *event) {
|
||||
if (_currentSeqIdx == 0) {
|
||||
_engine->mouseSetLeftClicked(false);
|
||||
_engine->getGraphicsManager()->setMouseDrawable(false);
|
||||
_engine->mouseSetRightClicked(false);
|
||||
|
||||
_engine->getGraphicsManager()->burstMouseArea(false); // The original updated the screen, we don't to avoid flickering...
|
||||
|
||||
_engine->_cursorX = event->x;
|
||||
_engine->_cursorY = event->y;
|
||||
|
||||
if (_engine->_cursorX < 608 || _engine->_cursorY < 448 || _engine->_cursorX >= 640 || _engine->_cursorY >= 480) {
|
||||
if ((event->flags & kMouseFlagRightDown) != 0) {
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
_engine->abortFight();
|
||||
|
||||
if (_engine->_gracePeriodTimer) {
|
||||
_engine->_fightSkipCounter = 0;
|
||||
} else {
|
||||
_engine->_fightSkipCounter++;
|
||||
}
|
||||
|
||||
_engine->mouseSetRightClicked(true);
|
||||
}
|
||||
|
||||
if (_lowIconToggle) {
|
||||
if (!_engine->_gracePeriodTimer) {
|
||||
_engine->getGraphicsManager()->drawItemDim(_engine->_currentGameFileColorId + 39, 608, 448, 1);
|
||||
_engine->getGraphicsManager()->burstBox(608, 448, 32, 32);
|
||||
}
|
||||
|
||||
_lowIconToggle = false;
|
||||
}
|
||||
|
||||
uint8 location = 0;
|
||||
Link *link = nullptr;
|
||||
|
||||
for (Link *i = _engine->getLogicManager()->_trainData[_engine->getLogicManager()->_activeNode].link; i; i = i->next) {
|
||||
if (_engine->getLogicManager()->pointIn(_engine->_cursorX, _engine->_cursorY, i) && location <= i->location) {
|
||||
location = i->location;
|
||||
link = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (link) {
|
||||
_engine->_cursorType = link->cursor;
|
||||
|
||||
if (_cath->actionAvailable(link->action)) {
|
||||
if ((event->flags & kMouseFlagLeftDown) != 0)
|
||||
_cath->send(link->action);
|
||||
} else {
|
||||
_engine->_cursorType = 0;
|
||||
}
|
||||
} else {
|
||||
_engine->_cursorType = 0;
|
||||
}
|
||||
} else {
|
||||
if (!_lowIconToggle) {
|
||||
if (!_engine->_gracePeriodTimer) {
|
||||
_engine->getGraphicsManager()->drawItem(_engine->_currentGameFileColorId + 39, 608, 448);
|
||||
_engine->getGraphicsManager()->burstBox(608, 448, 32, 32);
|
||||
}
|
||||
|
||||
_lowIconToggle = true;
|
||||
}
|
||||
|
||||
if ((event->flags & kMouseFlagLeftDown) != 0) {
|
||||
_lowIconToggle = false;
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
endFight(2);
|
||||
} else if ((event->flags & kMouseFlagRightDown) != 0 && _engine->_gracePeriodTimer) {
|
||||
if (_engine->getLogicManager()->dialogRunning("TIMER"))
|
||||
_engine->getLogicManager()->endDialog("TIMER");
|
||||
|
||||
_engine->_gracePeriodTimer = 900;
|
||||
}
|
||||
}
|
||||
|
||||
_engine->getGraphicsManager()->setMouseDrawable(true);
|
||||
_engine->getGraphicsManager()->newMouseLoc();
|
||||
_engine->getGraphicsManager()->burstMouseArea();
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
69
engines/lastexpress/fight/fight.h
Normal file
69
engines/lastexpress/fight/fight.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LASTEXPRESS_FIGHT_H
|
||||
#define LASTEXPRESS_FIGHT_H
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
class LastExpressEngine;
|
||||
class CFighter;
|
||||
|
||||
struct Seq;
|
||||
struct Event;
|
||||
|
||||
class CFight {
|
||||
public:
|
||||
CFight(LastExpressEngine *engine, int fightId);
|
||||
~CFight();
|
||||
|
||||
int process();
|
||||
void setOutcome(int outcome);
|
||||
void endFight(int outcome);
|
||||
void timer(Event *event, bool isProcessing);
|
||||
void mouse(Event *event);
|
||||
|
||||
void setFightHappening(bool happening) { _fightIsHappening = happening; }
|
||||
bool fightHappening() { return _fightIsHappening; }
|
||||
|
||||
private:
|
||||
LastExpressEngine *_engine = nullptr;
|
||||
|
||||
CFighter *_cath = nullptr;
|
||||
CFighter *_opponent = nullptr;
|
||||
int _outcome = 0;
|
||||
int _currentSeqIdx = 0;
|
||||
Common::String _seqNames[20];
|
||||
bool _fightIsHappening = false;
|
||||
|
||||
void (LastExpressEngine::*_savedTimerEventHandle)(Event *) = nullptr;
|
||||
void (LastExpressEngine::*_savedMouseEventHandle)(Event *) = nullptr;
|
||||
|
||||
bool _lowIconToggle = false;
|
||||
int _eggIconBrightness = 0;
|
||||
int _eggIconBrightnessStep = 1;
|
||||
};
|
||||
|
||||
} // End of namespace LastExpress
|
||||
|
||||
#endif // LASTEXPRESS_FIGHT_H
|
||||
307
engines/lastexpress/fight/fighter.cpp
Normal file
307
engines/lastexpress/fight/fighter.cpp
Normal file
@@ -0,0 +1,307 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
CFighter::CFighter(LastExpressEngine *engine, CFight *fight) {
|
||||
_engine = engine;
|
||||
_nextMessage = 101;
|
||||
_fight = fight;
|
||||
_currentSeq = 0;
|
||||
_currentSprite = 0;
|
||||
_currentSpriteIdx = 0;
|
||||
_unusedFlag = 0;
|
||||
_currentActionIdx = 0;
|
||||
_nextSequenceIdx = 0;
|
||||
_hitPoints = 1;
|
||||
_dodges = 0;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(_seqs); i++) {
|
||||
_seqs[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CFighter::~CFighter() {
|
||||
_engine->getSpriteManager()->destroySprite(&_currentSprite, false);
|
||||
|
||||
for (int i = 0; i < _numSeqs; i++) {
|
||||
if (_seqs[i]) {
|
||||
_engine->getMemoryManager()->freeMem(_seqs[i]->rawSeqData);
|
||||
delete _seqs[i];
|
||||
_seqs[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFighter::timer() {
|
||||
uint8 soundAction;
|
||||
uint8 sounds[5];
|
||||
char filename[16];
|
||||
|
||||
Sprite *sprite = nullptr;
|
||||
|
||||
if (!_currentSeq) {
|
||||
if (_currentSprite) {
|
||||
_engine->getSpriteManager()->removeSprite(_currentSprite);
|
||||
|
||||
// The original did this, but at this point sprite is necessarily nullptr...
|
||||
// if (!sprite || !sprite->copyScreenAndRedrawFlag)
|
||||
_engine->getSpriteManager()->queueErase(_currentSprite);
|
||||
}
|
||||
|
||||
_currentSprite = sprite;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentSeq->numFrames <= _currentSpriteIdx) {
|
||||
switch (_nextMessage) {
|
||||
case 101:
|
||||
doAction(_nextSequenceIdx, 1);
|
||||
_nextSequenceIdx = 0;
|
||||
break;
|
||||
case 102:
|
||||
_currentSpriteIdx = 0;
|
||||
break;
|
||||
case 103:
|
||||
doAction(0, 1);
|
||||
send(101);
|
||||
_opponent->doAction(0, 1);
|
||||
|
||||
_opponent->send(101);
|
||||
_opponent->timer();
|
||||
break;
|
||||
case 104:
|
||||
_fight->endFight(0);
|
||||
break;
|
||||
case 105:
|
||||
_fight->endFight(1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_fight->fightHappening()) {
|
||||
sprite = &_currentSeq->sprites[_currentSpriteIdx];
|
||||
sprite->hotspotPriority = 1;
|
||||
if (_currentSprite != sprite) {
|
||||
soundAction = sprite->soundAction;
|
||||
if (soundAction) {
|
||||
switch (soundAction) {
|
||||
case 150:
|
||||
sounds[0] = 151;
|
||||
sounds[1] = 152;
|
||||
sounds[2] = 153;
|
||||
sounds[3] = 154;
|
||||
sounds[4] = 155;
|
||||
soundAction = sounds[rnd(5)];
|
||||
break;
|
||||
case 156:
|
||||
sounds[0] = 157;
|
||||
sounds[1] = 158;
|
||||
sounds[2] = 159;
|
||||
sounds[3] = 160;
|
||||
sounds[4] = 161;
|
||||
soundAction = sounds[rnd(5)];
|
||||
break;
|
||||
case 162:
|
||||
sounds[0] = 163;
|
||||
sounds[1] = 164;
|
||||
sounds[2] = 165;
|
||||
sounds[3] = 166;
|
||||
sounds[4] = 167;
|
||||
soundAction = sounds[rnd(5)];
|
||||
break;
|
||||
case 168:
|
||||
sounds[0] = 169;
|
||||
sounds[1] = 170;
|
||||
sounds[2] = 171;
|
||||
sounds[3] = 172;
|
||||
sounds[4] = 173;
|
||||
soundAction = sounds[rnd(5)];
|
||||
break;
|
||||
case 174:
|
||||
sounds[0] = 175;
|
||||
sounds[1] = 176;
|
||||
sounds[2] = 177;
|
||||
soundAction = sounds[rnd(3)];
|
||||
break;
|
||||
case 180:
|
||||
sounds[0] = 181;
|
||||
sounds[1] = 182;
|
||||
sounds[2] = 183;
|
||||
sounds[3] = 184;
|
||||
soundAction = sounds[rnd(4)];
|
||||
break;
|
||||
case 184:
|
||||
sounds[0] = 185;
|
||||
sounds[1] = 186;
|
||||
sounds[2] = 187;
|
||||
soundAction = sounds[rnd(3)];
|
||||
break;
|
||||
case 188:
|
||||
sounds[0] = 189;
|
||||
sounds[1] = 190;
|
||||
sounds[2] = 191;
|
||||
sounds[3] = 192;
|
||||
sounds[4] = 193;
|
||||
soundAction = sounds[rnd(5)];
|
||||
break;
|
||||
case 194:
|
||||
sounds[0] = 195;
|
||||
sounds[1] = 196;
|
||||
sounds[2] = 197;
|
||||
soundAction = sounds[rnd(3)];
|
||||
break;
|
||||
case 198:
|
||||
sounds[0] = 199;
|
||||
sounds[1] = 200;
|
||||
sounds[2] = 201;
|
||||
sounds[3] = 202;
|
||||
sounds[4] = 203;
|
||||
soundAction = sounds[rnd(5)];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Common::sprintf_s(filename, "LIB%03d.SND", soundAction);
|
||||
_engine->getLogicManager()->playDialog(kCharacterClerk, filename, 16, sprite->soundDelay);
|
||||
}
|
||||
|
||||
_engine->getSpriteManager()->drawSprite(sprite);
|
||||
_currentSpriteIdx++;
|
||||
|
||||
if (_currentSprite) {
|
||||
_engine->getSpriteManager()->removeSprite(_currentSprite);
|
||||
if (!sprite || !sprite->copyScreenAndRedrawFlag)
|
||||
_engine->getSpriteManager()->queueErase(_currentSprite);
|
||||
}
|
||||
|
||||
_currentSprite = sprite;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFighter::doAction(int sequenceIndex, int action) {
|
||||
if (sequenceIndex >= 0 && _numSeqs >= sequenceIndex) {
|
||||
switch (action) {
|
||||
case 0:
|
||||
default:
|
||||
if (!_currentActionIdx) {
|
||||
_currentSeq = _seqs[sequenceIndex];
|
||||
_currentActionIdx = sequenceIndex;
|
||||
newSeq();
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
_currentSeq = _seqs[sequenceIndex];
|
||||
_currentActionIdx = sequenceIndex;
|
||||
_nextSequenceIdx = 0;
|
||||
newSeq();
|
||||
break;
|
||||
case 2:
|
||||
_nextSequenceIdx = sequenceIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFighter::newSeq() {
|
||||
_engine->getSpriteManager()->destroySprite(&_currentSprite, false);
|
||||
_currentSpriteIdx = 0;
|
||||
_unusedFlag = 0;
|
||||
}
|
||||
|
||||
bool CFighter::init(CFighter *opponent) {
|
||||
_opponent = opponent;
|
||||
|
||||
if (_numSeqs <= 0)
|
||||
return true;
|
||||
|
||||
for (int i = 0; i < _numSeqs; i++) {
|
||||
if (_seqs[i] == nullptr) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFighter::actionAvailable(int action) {
|
||||
return _nextMessage == 101 && !_currentActionIdx;
|
||||
}
|
||||
|
||||
int CFighter::getAction() {
|
||||
return _currentActionIdx;
|
||||
}
|
||||
|
||||
int CFighter::getDodges() {
|
||||
return _dodges;
|
||||
}
|
||||
|
||||
int CFighter::getHitPoints() {
|
||||
return _hitPoints;
|
||||
}
|
||||
|
||||
void CFighter::setHitPoints(int hitPoints) {
|
||||
_hitPoints = hitPoints;
|
||||
}
|
||||
|
||||
bool CFighter::isDead() {
|
||||
return _hitPoints <= 0;
|
||||
}
|
||||
|
||||
void CFighter::send(int message) {
|
||||
switch (message) {
|
||||
case 101:
|
||||
_nextMessage = message;
|
||||
break;
|
||||
case 102:
|
||||
--_hitPoints;
|
||||
_nextMessage = message;
|
||||
break;
|
||||
case 103:
|
||||
_opponent->send(102);
|
||||
_nextMessage = message;
|
||||
break;
|
||||
case 104:
|
||||
_fight->setOutcome(0);
|
||||
_opponent->send(102);
|
||||
_nextMessage = message;
|
||||
break;
|
||||
case 105:
|
||||
_fight->setOutcome(1);
|
||||
_opponent->send(102);
|
||||
_nextMessage = message;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
187
engines/lastexpress/fight/fighter.h
Normal file
187
engines/lastexpress/fight/fighter.h
Normal file
@@ -0,0 +1,187 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LASTEXPRESS_FIGHTER_H
|
||||
#define LASTEXPRESS_FIGHTER_H
|
||||
|
||||
#include "lastexpress/fight/fight.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
class LastExpressEngine;
|
||||
class CFight;
|
||||
|
||||
struct Seq;
|
||||
struct Sprite;
|
||||
|
||||
class CFighter {
|
||||
|
||||
public:
|
||||
CFighter(LastExpressEngine *engine, CFight *fight);
|
||||
virtual ~CFighter();
|
||||
|
||||
virtual void timer();
|
||||
void doAction(int sequenceIndex, int action);
|
||||
void newSeq();
|
||||
bool init(CFighter *opponent);
|
||||
virtual bool actionAvailable(int action);
|
||||
int getAction();
|
||||
int getDodges();
|
||||
int getHitPoints();
|
||||
void setHitPoints(int hitPoints);
|
||||
bool isDead();
|
||||
virtual void send(int action);
|
||||
|
||||
protected:
|
||||
LastExpressEngine *_engine = nullptr;
|
||||
|
||||
CFight *_fight = nullptr;
|
||||
CFighter *_opponent = nullptr;
|
||||
Seq *_seqs[10];
|
||||
int _numSeqs = 0;
|
||||
int _currentActionIdx = 0;
|
||||
Seq *_currentSeq = nullptr;
|
||||
Sprite *_currentSprite = nullptr;
|
||||
int _currentSpriteIdx = 0;
|
||||
int _unusedFlag = 0;
|
||||
int _nextMessage = 0;
|
||||
int _nextSequenceIdx = 0;
|
||||
int _hitPoints = 0;
|
||||
int _dodges = 0;
|
||||
int _timer = 0;
|
||||
};
|
||||
|
||||
// Generic fighters
|
||||
|
||||
class CCath : public CFighter {
|
||||
public:
|
||||
CCath(LastExpressEngine *engine, CFight *fight) : CFighter(engine, fight) {}
|
||||
|
||||
virtual void timer() override;
|
||||
};
|
||||
|
||||
class COpponent : public CFighter {
|
||||
public:
|
||||
COpponent(LastExpressEngine *engine, CFight *fight) : CFighter(engine, fight) {}
|
||||
|
||||
virtual void timer() override;
|
||||
};
|
||||
|
||||
|
||||
// First fight: Cath vs Milos
|
||||
|
||||
class CCath1 : public CCath {
|
||||
public:
|
||||
CCath1(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
bool actionAvailable(int action) override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
class COpponent1 : public COpponent {
|
||||
public:
|
||||
COpponent1(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
|
||||
// Second fight: Cath vs Vesna (when saving Anna)
|
||||
|
||||
class CCath2 : public CCath {
|
||||
public:
|
||||
CCath2(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
class COpponent2 : public COpponent {
|
||||
public:
|
||||
COpponent2(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
};
|
||||
|
||||
|
||||
// Third fight: Cath vs Ivo
|
||||
|
||||
class CCath3 : public CCath {
|
||||
public:
|
||||
CCath3(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
bool actionAvailable(int action) override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
class COpponent3 : public COpponent {
|
||||
public:
|
||||
COpponent3(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
|
||||
// Fourth fight: Cath vs Salko
|
||||
|
||||
class CCath4 : public CCath {
|
||||
public:
|
||||
CCath4(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
bool actionAvailable(int action) override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
class COpponent4 : public COpponent {
|
||||
public:
|
||||
COpponent4(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
|
||||
// Fifth fight: Cath vs Vesna (final fight)
|
||||
|
||||
class CCath5 : public CCath {
|
||||
public:
|
||||
CCath5(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
bool actionAvailable(int action) override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
class COpponent5 : public COpponent {
|
||||
public:
|
||||
COpponent5(LastExpressEngine *engine, CFight *fight);
|
||||
|
||||
void timer() override;
|
||||
void send(int action) override;
|
||||
};
|
||||
|
||||
} // End of namespace LastExpress
|
||||
|
||||
#endif // LASTEXPRESS_FIGHTER_H
|
||||
505
engines/lastexpress/fight/fighter_cath.cpp
Normal file
505
engines/lastexpress/fight/fighter_cath.cpp
Normal file
@@ -0,0 +1,505 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
void CCath::timer() {
|
||||
CFighter::timer();
|
||||
|
||||
if (_currentSprite) {
|
||||
if (_nextMessage == 102) {
|
||||
_currentSprite->hotspotPriority = 2;
|
||||
} else {
|
||||
_currentSprite->hotspotPriority = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCath1::CCath1(LastExpressEngine *engine, CFight *fight) : CCath(engine, fight) {
|
||||
_numSeqs = 7;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2001cr.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2001cdl.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2001cdr.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2001cdm.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2001csgr.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("2001csgl.seq", 15, 0);
|
||||
_seqs[6] = _engine->getArchiveManager()->loadSeq("2001dbk.seq", 15, 0);
|
||||
}
|
||||
|
||||
void CCath1::timer() {
|
||||
if (_currentSprite && (_currentSprite->flags & 2) != 0) {
|
||||
if (_opponent->isDead()) {
|
||||
doAction(5, 1);
|
||||
_opponent->doAction(6, 1);
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
_engine->getLogicManager()->playDialog(kCharacterClerk, "MUS029", 16, 0);
|
||||
send(104);
|
||||
}
|
||||
|
||||
if (_currentActionIdx == 4) {
|
||||
_opponent->send(4);
|
||||
_fight->setOutcome(0);
|
||||
}
|
||||
}
|
||||
|
||||
CCath::timer();
|
||||
}
|
||||
|
||||
bool CCath1::actionAvailable(int action) {
|
||||
if (action != 128)
|
||||
return CFighter::actionAvailable(action);
|
||||
|
||||
if (_currentActionIdx != 1)
|
||||
return CFighter::actionAvailable(action);
|
||||
|
||||
if (!_currentSprite || (_currentSprite->flags & 4) != 0 || _opponent->getAction() != 1)
|
||||
return CFighter::actionAvailable(action);
|
||||
|
||||
_engine->_cursorType = 9;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCath1::send(int action) {
|
||||
switch (action) {
|
||||
case 1:
|
||||
if (_currentActionIdx != 1 || (_currentSprite->flags & 4) != 0) {
|
||||
doAction(6, 1);
|
||||
_opponent->doAction(3, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
} else {
|
||||
_dodges++;
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if ((_currentActionIdx == 2 || _currentActionIdx == 3) && (_currentSprite->flags & 4) == 0) {
|
||||
_dodges++;
|
||||
} else {
|
||||
doAction(6, 1);
|
||||
_opponent->doAction(4, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
}
|
||||
|
||||
break;
|
||||
case 128:
|
||||
if (_currentActionIdx == 1 && _currentSprite && (_currentSprite->flags & 4) == 0 && _opponent->getAction() == 1) {
|
||||
doAction(4, 1);
|
||||
timer();
|
||||
} else {
|
||||
int opponentAction = _opponent->getAction();
|
||||
if (opponentAction == 1) {
|
||||
doAction(1, 0);
|
||||
} else if (opponentAction == 2) {
|
||||
doAction(3, 0);
|
||||
} else {
|
||||
doAction(rnd(3) + 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
CFighter::send(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CCath2::CCath2(LastExpressEngine *engine, CFight *fight) : CCath(engine, fight) {
|
||||
_numSeqs = 5;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2002cr.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2002cdl.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2002cdr.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2002cdm.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2002lbk.seq", 15, 0);
|
||||
}
|
||||
|
||||
void CCath2::send(int action) {
|
||||
if ((action - 1) > 127) {
|
||||
CFighter::send(action);
|
||||
} else {
|
||||
switch (action) {
|
||||
case 1:
|
||||
if ((_currentActionIdx == 1 || _currentActionIdx == 3) && (_currentSprite->flags & 4) == 0) {
|
||||
_dodges++;
|
||||
} else {
|
||||
doAction(4, 1);
|
||||
_opponent->doAction(4, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ((_currentActionIdx == 2 || _currentActionIdx == 3) && (_currentSprite->flags & 4) == 0) {
|
||||
_dodges++;
|
||||
} else {
|
||||
doAction(4, 1);
|
||||
_opponent->doAction(5, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if ((_currentActionIdx == 2 || _currentActionIdx == 1) && (_currentSprite->flags & 4) == 0) {
|
||||
_dodges++;
|
||||
} else {
|
||||
doAction(4, 1);
|
||||
_opponent->doAction(6, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
}
|
||||
|
||||
break;
|
||||
case 128:
|
||||
{
|
||||
int opponentAction = _opponent->getAction();
|
||||
if (opponentAction == 1) {
|
||||
doAction(1, 0);
|
||||
} else if (opponentAction == 3) {
|
||||
doAction(2, 0);
|
||||
} else {
|
||||
doAction(3, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CFighter::send(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_dodges > 4) {
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
_fight->endFight(0);
|
||||
}
|
||||
}
|
||||
|
||||
CCath3::CCath3(LastExpressEngine *engine, CFight *fight) : CCath(engine, fight) {
|
||||
_numSeqs = 10;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2003cr.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2003car.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2003cal.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2003cdr.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2003cdm.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("2003chr.seq", 15, 0);
|
||||
_seqs[6] = _engine->getArchiveManager()->loadSeq("2003chl.seq", 15, 0);
|
||||
_seqs[9] = _engine->getArchiveManager()->loadSeq("2003ckr.seq", 15, 0);
|
||||
_seqs[7] = _engine->getArchiveManager()->loadSeq("2003lbk.seq", 15, 0);
|
||||
_seqs[8] = _engine->getArchiveManager()->loadSeq("2003fbk.seq", 15, 0);
|
||||
|
||||
_hitPoints = 5;
|
||||
}
|
||||
|
||||
void CCath3::timer() {
|
||||
if ((_currentActionIdx == 4 || _currentActionIdx == 3) && !_currentSpriteIdx)
|
||||
_opponent->send(131);
|
||||
|
||||
if (_currentSprite && (_currentSprite->flags & 2) != 0) {
|
||||
if (_opponent->isDead()) {
|
||||
doAction(9, 1);
|
||||
_opponent->doAction(8, 1);
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
send(104);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentActionIdx == 3)
|
||||
_opponent->send(3);
|
||||
|
||||
if (_currentActionIdx == 4)
|
||||
_opponent->send(4);
|
||||
}
|
||||
|
||||
CCath::timer();
|
||||
}
|
||||
|
||||
bool CCath3::actionAvailable(int action) {
|
||||
if (action == 129 || action == 130) {
|
||||
return _currentActionIdx != 7;
|
||||
} else {
|
||||
return CFighter::actionAvailable(action);
|
||||
}
|
||||
}
|
||||
|
||||
void CCath3::send(int action) {
|
||||
if ((action - 1) > 129) {
|
||||
CFighter::send(action);
|
||||
} else {
|
||||
switch (action) {
|
||||
case 1:
|
||||
if (_currentActionIdx != 1 || (_currentSprite->flags & 4) != 0) {
|
||||
doAction(7, 1);
|
||||
_opponent->doAction(4, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if (_currentActionIdx != 2 || (_currentSprite->flags & 4) != 0) {
|
||||
doAction(7, 1);
|
||||
_opponent->doAction(5, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
}
|
||||
|
||||
break;
|
||||
case 128:
|
||||
if (_opponent->getAction() == 2) {
|
||||
doAction(2, 0);
|
||||
} else {
|
||||
doAction(1, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
case 129:
|
||||
if (_currentActionIdx) {
|
||||
if (_opponent->getHitPoints() > 1) {
|
||||
doAction(4, 2);
|
||||
} else {
|
||||
doAction(3, 2);
|
||||
}
|
||||
} else if (_opponent->getHitPoints() > 1) {
|
||||
doAction(4, 0);
|
||||
} else {
|
||||
doAction(3, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
case 130:
|
||||
if (_currentActionIdx) {
|
||||
doAction(3, 2);
|
||||
} else {
|
||||
doAction(3, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
CFighter::send(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCath4::CCath4(LastExpressEngine *engine, CFight *fight) : CCath(engine, fight) {
|
||||
_numSeqs = 4;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2004cr.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2004cdr.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2004chj.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2004bk.seq", 15, 0);
|
||||
|
||||
_hitPoints = 2;
|
||||
}
|
||||
|
||||
void CCath4::timer() {
|
||||
CCath::timer();
|
||||
|
||||
if ((_currentSprite->flags & 2) != 0) {
|
||||
if (_opponent->isDead()) {
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
_fight->endFight(0);
|
||||
} else if (_currentActionIdx == 2) {
|
||||
_opponent->send(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CCath4::actionAvailable(int action) {
|
||||
if (action != 131)
|
||||
return CFighter::actionAvailable(action);
|
||||
|
||||
if (_currentActionIdx != 1)
|
||||
return false;
|
||||
|
||||
if (_opponent->isDead())
|
||||
_engine->_cursorType = 9;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCath4::send(int action) {
|
||||
if ((action - 1) > 130) {
|
||||
CFighter::send(action);
|
||||
} else {
|
||||
switch (action) {
|
||||
case 1:
|
||||
if (_currentActionIdx != 1 || (_currentSprite->flags & 4) != 0) {
|
||||
_dodges = 0;
|
||||
doAction(3, 1);
|
||||
_opponent->doAction(3, 1);
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
} else {
|
||||
_dodges++;
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if (_currentActionIdx != 1 || (_currentSprite->flags & 4) != 0) {
|
||||
_dodges = 0;
|
||||
doAction(3, 1);
|
||||
_opponent->doAction(4, 1);
|
||||
_opponent->send(103);
|
||||
_hitPoints = 0;
|
||||
timer();
|
||||
} else {
|
||||
_dodges++;
|
||||
}
|
||||
|
||||
break;
|
||||
case 128:
|
||||
doAction(1, 0);
|
||||
_dodges = 0;
|
||||
break;
|
||||
case 131:
|
||||
if (_currentActionIdx) {
|
||||
doAction(2, 2);
|
||||
} else {
|
||||
doAction(2, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
CFighter::send(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCath5::CCath5(LastExpressEngine *engine, CFight *fight) : CCath(engine, fight) {
|
||||
_numSeqs = 6;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2005cr.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2005cdr.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2005cbr.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2005bk.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2005cdm1.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("2005chl.seq", 15, 0);
|
||||
}
|
||||
|
||||
void CCath5::timer() {
|
||||
if (_currentSprite && (_currentSprite->flags & 2) != 0) {
|
||||
if (_currentActionIdx == 3)
|
||||
_opponent->send(3);
|
||||
|
||||
if (_opponent->isDead()) {
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
_fight->endFight(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentActionIdx == 5)
|
||||
_opponent->send(5);
|
||||
}
|
||||
|
||||
CCath::timer();
|
||||
}
|
||||
|
||||
bool CCath5::actionAvailable(int action) {
|
||||
if (action != 128)
|
||||
return CFighter::actionAvailable(action);
|
||||
|
||||
if (_currentActionIdx != 1) {
|
||||
if (_opponent->getAction() == 5) {
|
||||
_engine->_cursorType = 6;
|
||||
return true;
|
||||
}
|
||||
|
||||
return CFighter::actionAvailable(action);
|
||||
}
|
||||
|
||||
if (_opponent->getAction() != 1)
|
||||
return false;
|
||||
|
||||
if (!_currentSprite || (_currentSprite->flags & 4) == 0)
|
||||
return false;
|
||||
|
||||
_engine->_cursorType = 30;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCath5::send(int action) {
|
||||
if ((action - 1) > 131) {
|
||||
CFighter::send(action);
|
||||
} else {
|
||||
switch (action) {
|
||||
case 1:
|
||||
if (_currentActionIdx != 1) {
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
} else {
|
||||
_dodges++;
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if (_currentActionIdx != 2) {
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
} else {
|
||||
_dodges++;
|
||||
}
|
||||
|
||||
break;
|
||||
case 5:
|
||||
if (_currentActionIdx != 3) {
|
||||
_opponent->send(103);
|
||||
timer();
|
||||
}
|
||||
|
||||
break;
|
||||
case 128:
|
||||
if (_currentActionIdx == 1 && _opponent->getAction() == 1 && _currentSprite && (_currentSprite->flags & 4) != 0) {
|
||||
doAction(5, 1);
|
||||
} else if (_opponent->getAction() == 5) {
|
||||
doAction(3, 0);
|
||||
} else {
|
||||
doAction(1, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
case 132:
|
||||
doAction(2, 0);
|
||||
break;
|
||||
default:
|
||||
CFighter::send(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_dodges > 10) {
|
||||
_opponent->doAction(5, 2);
|
||||
_opponent->setHitPoints(1);
|
||||
_dodges = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
38
engines/lastexpress/fight/opponent.cpp
Normal file
38
engines/lastexpress/fight/opponent.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
void COpponent::timer() {
|
||||
CFighter::timer();
|
||||
|
||||
if (_timer && !_currentActionIdx)
|
||||
_timer--;
|
||||
|
||||
if (_currentSprite)
|
||||
_currentSprite->hotspotPriority = 1;
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
135
engines/lastexpress/fight/opponent_ivo.cpp
Normal file
135
engines/lastexpress/fight/opponent_ivo.cpp
Normal file
@@ -0,0 +1,135 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
COpponent3::COpponent3(LastExpressEngine *engine, CFight *fight) : COpponent(engine, fight) {
|
||||
_numSeqs = 9;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2003or.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2003oal.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2003oar.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2003odm.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2003okl.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("2003okj.seq", 15, 0);
|
||||
_seqs[6] = _engine->getArchiveManager()->loadSeq("blank.seq", 15, 0);
|
||||
_seqs[7] = _engine->getArchiveManager()->loadSeq("csdr.seq", 15, 0);
|
||||
_seqs[8] = _engine->getArchiveManager()->loadSeq("2003l.seq", 15, 0);
|
||||
|
||||
_engine->getLogicManager()->playDialog(kCharacterTableA, "MUS032", 16, 0);
|
||||
|
||||
_hitPoints = 5;
|
||||
_timer = 15;
|
||||
}
|
||||
|
||||
void COpponent3::timer() {
|
||||
if (!_timer && actionAvailable(1) && !_nextSequenceIdx) {
|
||||
switch (rnd(5)) {
|
||||
case 0:
|
||||
doAction(1, 0);
|
||||
break;
|
||||
case 1:
|
||||
doAction(2, 0);
|
||||
break;
|
||||
case 2:
|
||||
doAction(1, 0);
|
||||
doAction(2, 2);
|
||||
break;
|
||||
case 3:
|
||||
doAction(2, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
case 4:
|
||||
doAction(1, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_timer = 3 * _hitPoints + rnd(10);
|
||||
}
|
||||
|
||||
if (_currentSprite && (_currentSprite->flags & 2) != 0) {
|
||||
if (_opponent->isDead()) {
|
||||
doAction(7, 1);
|
||||
_opponent->doAction(8, 1);
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
send(105);
|
||||
}
|
||||
|
||||
if (_currentActionIdx == 1)
|
||||
_opponent->send(1);
|
||||
|
||||
if (_currentActionIdx == 2)
|
||||
_opponent->send(2);
|
||||
}
|
||||
|
||||
COpponent::timer();
|
||||
}
|
||||
|
||||
void COpponent3::send(int action) {
|
||||
uint num;
|
||||
|
||||
switch (action) {
|
||||
case 3:
|
||||
if ((_currentActionIdx != 3 && _currentActionIdx != 1) || (_currentSprite->flags & 4) != 0) {
|
||||
doAction(6, 1);
|
||||
_opponent->doAction(6, 1);
|
||||
_opponent->send(103);
|
||||
}
|
||||
|
||||
break;
|
||||
case 4:
|
||||
if ((_currentActionIdx != 3 && _currentActionIdx != 2) || (_currentSprite->flags & 4) != 0) {
|
||||
doAction(6, 1);
|
||||
_opponent->doAction(5, 1);
|
||||
_opponent->send(103);
|
||||
}
|
||||
|
||||
break;
|
||||
case 131:
|
||||
if (!_currentActionIdx) {
|
||||
if (_hitPoints > 2) {
|
||||
num = 60;
|
||||
} else {
|
||||
num = 75;
|
||||
}
|
||||
|
||||
if (num >= rnd(100)) {
|
||||
doAction(3, 1);
|
||||
if (_opponent->getAction() == 4)
|
||||
doAction(2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
CFighter::send(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
105
engines/lastexpress/fight/opponent_milos.cpp
Normal file
105
engines/lastexpress/fight/opponent_milos.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
COpponent1::COpponent1(LastExpressEngine *engine, CFight *fight) : COpponent(engine, fight) {
|
||||
_numSeqs = 7;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2001or.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2001oal.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2001oam.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2001okl.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2001okm.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("2001dbk.seq", 15, 0);
|
||||
_seqs[6] = _engine->getArchiveManager()->loadSeq("2001wbk.seq", 15, 0);
|
||||
|
||||
_engine->getLogicManager()->playDialog(kCharacterTableA, "MUS027", 16, 0);
|
||||
|
||||
_timer = 35;
|
||||
}
|
||||
|
||||
void COpponent1::timer() {
|
||||
if (!_timer && actionAvailable(1) && !_nextSequenceIdx) {
|
||||
if (_opponent->getDodges() >= 2) {
|
||||
switch (rnd(5)) {
|
||||
case 0:
|
||||
doAction(1, 0);
|
||||
break;
|
||||
case 1:
|
||||
doAction(2, 0);
|
||||
break;
|
||||
case 2:
|
||||
doAction(2, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
case 3:
|
||||
doAction(1, 0);
|
||||
doAction(2, 2);
|
||||
break;
|
||||
case 4:
|
||||
doAction(1, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
doAction(2, 0);
|
||||
}
|
||||
|
||||
if (_opponent->getDodges() < 5) {
|
||||
_timer = 6 * (5 - _opponent->getDodges());
|
||||
} else {
|
||||
_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSprite && (_currentSprite->flags & 2) != 0) {
|
||||
if (_currentActionIdx == 1)
|
||||
_opponent->send(1);
|
||||
|
||||
if (_currentActionIdx == 2)
|
||||
_opponent->send(2);
|
||||
|
||||
if (_opponent->isDead()) {
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
send(105);
|
||||
}
|
||||
}
|
||||
|
||||
COpponent::timer();
|
||||
}
|
||||
|
||||
void COpponent1::send(int message) {
|
||||
if (message == 4) {
|
||||
doAction(5, 1);
|
||||
_opponent->send(103);
|
||||
} else if (message != 131) {
|
||||
CFighter::send(message);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
97
engines/lastexpress/fight/opponent_salko.cpp
Normal file
97
engines/lastexpress/fight/opponent_salko.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
COpponent4::COpponent4(LastExpressEngine *engine, CFight *fight) : COpponent(engine, fight) {
|
||||
_numSeqs = 6;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2004or.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2004oam.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2004oar.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2004okr.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2004ohm.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("blank.seq", 15, 0);
|
||||
|
||||
_engine->getLogicManager()->playDialog(kCharacterTableA, "MUS035", 16, 0);
|
||||
|
||||
_hitPoints = 3;
|
||||
_timer = 30;
|
||||
}
|
||||
|
||||
void COpponent4::timer() {
|
||||
if (!_timer && actionAvailable(1) && !_nextSequenceIdx) {
|
||||
switch (rnd(5)) {
|
||||
case 0:
|
||||
doAction(1, 0);
|
||||
break;
|
||||
case 1:
|
||||
doAction(2, 0);
|
||||
break;
|
||||
case 2:
|
||||
doAction(1, 0);
|
||||
doAction(2, 2);
|
||||
break;
|
||||
case 3:
|
||||
doAction(2, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
case 4:
|
||||
doAction(1, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_timer = 4 * _hitPoints;
|
||||
}
|
||||
|
||||
if (_currentSprite && (_currentSprite->flags & 2) != 0) {
|
||||
if (_opponent->isDead()) {
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
_fight->endFight(1);
|
||||
}
|
||||
|
||||
if (_currentActionIdx == 1)
|
||||
_opponent->send(1);
|
||||
|
||||
if (_currentActionIdx == 2)
|
||||
_opponent->send(2);
|
||||
}
|
||||
|
||||
COpponent::timer();
|
||||
}
|
||||
|
||||
void COpponent4::send(int action) {
|
||||
if (action == 2) {
|
||||
doAction(5, 1);
|
||||
return _opponent->send(103);
|
||||
} else {
|
||||
return CFighter::send(action);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
94
engines/lastexpress/fight/opponent_vesna1.cpp
Normal file
94
engines/lastexpress/fight/opponent_vesna1.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
COpponent2::COpponent2(LastExpressEngine *engine, CFight *fight) : COpponent(engine, fight) {
|
||||
_numSeqs = 7;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2002or.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2002oal.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2002oam.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2002oar.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2002okr.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("2002okml.seq", 15, 0);
|
||||
_seqs[6] = _engine->getArchiveManager()->loadSeq("2002okm.seq", 15, 0);
|
||||
|
||||
_engine->getLogicManager()->playDialog(kCharacterTableA, engine->isDemo() ? "MUS030D" : "MUS030", 16, 0);
|
||||
|
||||
_timer = 30;
|
||||
}
|
||||
|
||||
void COpponent2::timer() {
|
||||
if (!_timer && actionAvailable(1) && !_nextSequenceIdx) {
|
||||
switch (rnd(6)) {
|
||||
case 0:
|
||||
doAction(1, 0);
|
||||
break;
|
||||
case 1:
|
||||
doAction(2, 0);
|
||||
break;
|
||||
case 2:
|
||||
doAction(3, 0);
|
||||
break;
|
||||
case 3:
|
||||
doAction(3, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
case 4:
|
||||
doAction(1, 0);
|
||||
doAction(2, 2);
|
||||
break;
|
||||
case 5:
|
||||
doAction(3, 0);
|
||||
doAction(2, 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_timer = rnd(15);
|
||||
}
|
||||
|
||||
if (_currentSprite && (_currentSprite->flags & 2) != 0) {
|
||||
if (_currentActionIdx == 1)
|
||||
_opponent->send(1);
|
||||
|
||||
if (_currentActionIdx == 2)
|
||||
_opponent->send(2);
|
||||
|
||||
if (_currentActionIdx == 3)
|
||||
_opponent->send(3);
|
||||
|
||||
if (_opponent->isDead()) {
|
||||
_engine->getLogicManager()->endDialog(kCharacterTableA);
|
||||
send(105);
|
||||
}
|
||||
}
|
||||
|
||||
COpponent::timer();
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
140
engines/lastexpress/fight/opponent_vesna2.cpp
Normal file
140
engines/lastexpress/fight/opponent_vesna2.cpp
Normal file
@@ -0,0 +1,140 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/fight/fighter.h"
|
||||
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
COpponent5::COpponent5(LastExpressEngine *engine, CFight *fight) : COpponent(engine, fight) {
|
||||
_numSeqs = 8;
|
||||
|
||||
_seqs[0] = _engine->getArchiveManager()->loadSeq("2005or.seq", 15, 0);
|
||||
_seqs[1] = _engine->getArchiveManager()->loadSeq("2005oam.seq", 15, 0);
|
||||
_seqs[2] = _engine->getArchiveManager()->loadSeq("2005oar.seq", 15, 0);
|
||||
_seqs[3] = _engine->getArchiveManager()->loadSeq("2005okml.seq", 15, 0);
|
||||
_seqs[4] = _engine->getArchiveManager()->loadSeq("2005okr.seq", 15, 0);
|
||||
_seqs[5] = _engine->getArchiveManager()->loadSeq("2005odm1.seq", 15, 0);
|
||||
_seqs[6] = _engine->getArchiveManager()->loadSeq("2005csbm.seq", 15, 0);
|
||||
_seqs[7] = _engine->getArchiveManager()->loadSeq("2005oam4.seq", 15, 0);
|
||||
|
||||
_engine->getLogicManager()->playDialog(kCharacterTableA, "MUS038", 16, 0);
|
||||
|
||||
_timer = 30;
|
||||
_hitPoints = 4;
|
||||
}
|
||||
|
||||
void COpponent5::timer() {
|
||||
if (!_timer && actionAvailable(1) && !_nextSequenceIdx) {
|
||||
if (_hitPoints == 1) {
|
||||
doAction(5, 0);
|
||||
} else {
|
||||
switch (rnd(6)) {
|
||||
case 0:
|
||||
doAction(1, 0);
|
||||
break;
|
||||
case 1:
|
||||
doAction(1, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
case 2:
|
||||
doAction(2, 0);
|
||||
break;
|
||||
case 3:
|
||||
doAction(2, 0);
|
||||
doAction(2, 2);
|
||||
break;
|
||||
case 4:
|
||||
doAction(1, 0);
|
||||
doAction(2, 2);
|
||||
break;
|
||||
case 5:
|
||||
doAction(2, 0);
|
||||
doAction(1, 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timer = 4 * _hitPoints;
|
||||
}
|
||||
|
||||
if (!_currentSprite || (_currentSprite->flags & 2) == 0) {
|
||||
COpponent::timer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentActionIdx == 1)
|
||||
_opponent->send(1);
|
||||
|
||||
if (_currentActionIdx == 2)
|
||||
_opponent->send(2);
|
||||
|
||||
if (_currentActionIdx == 5)
|
||||
_opponent->send(5);
|
||||
|
||||
if (_opponent->isDead()) {
|
||||
switch (_currentActionIdx) {
|
||||
case 1:
|
||||
doAction(3, 1);
|
||||
break;
|
||||
case 2:
|
||||
doAction(4, 1);
|
||||
break;
|
||||
case 5:
|
||||
doAction(6, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
_opponent->doAction(4, 1);
|
||||
|
||||
send(105);
|
||||
_opponent->timer();
|
||||
timer();
|
||||
|
||||
_engine->getLogicManager()->endDialog(33);
|
||||
} else {
|
||||
COpponent::timer();
|
||||
}
|
||||
}
|
||||
|
||||
void COpponent5::send(int action) {
|
||||
switch (action) {
|
||||
case 3:
|
||||
_opponent->send(103);
|
||||
break;
|
||||
case 5:
|
||||
doAction(7, 1);
|
||||
_opponent->send(103);
|
||||
if (_hitPoints <= 1)
|
||||
_hitPoints = 1;
|
||||
|
||||
break;
|
||||
case 131:
|
||||
break;
|
||||
default:
|
||||
CFighter::send(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
||||
Reference in New Issue
Block a user