HYPNO: correctly implemented the team health in boyz

This commit is contained in:
neuromancer 2022-05-20 17:35:57 +02:00
parent 5a6bb5a691
commit fbe34784ac
7 changed files with 15 additions and 14 deletions

View File

@ -219,8 +219,6 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
_shootSound = arc->shootSound;
_hitSound = arc->hitSound;
_additionalSound = arc->additionalSound;
_health = arc->health;
_maxHealth = _health;
debugC(1, kHypnoDebugArcade, "Starting segment of type %x of size %d", segments[_segmentIdx].type, segments[_segmentIdx].size);
_shoots.clear();
_skipLevel = false;

View File

@ -58,6 +58,7 @@ void BoyzEngine::runBeforeArcade(ArcadeShooting *arc) {
updateFromScript();
_shootsDestroyed.clear();
_health = _previousHealth;
}
void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
@ -66,11 +67,12 @@ void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
delete _playerFrames[i];
}
if (_healthTeam[_currentActor] <= 0) {
if (_health <= 0) {
MVideo video(_deathDay[_currentActor], Common::Point(0, 0), false, true, false);
disableCursor();
runIntro(video);
}
} else
_previousHealth = _health;
}
@ -81,7 +83,6 @@ void BoyzEngine::pressedKey(const int keycode) {
return;
}
} else if (keycode == Common::KEYCODE_k) { // Added for testing
_healthTeam[_currentActor] = 0;
_health = 0;
} else if (keycode == Common::KEYCODE_ESCAPE) {
openMainMenuDialog();
@ -126,7 +127,7 @@ void BoyzEngine::drawPlayer() {
void BoyzEngine::drawHealth() {
updateFromScript();
float w = float(_healthTeam[_currentActor]) / float(_maxHealth);
float w = float(_health) / float(_maxHealth);
Common::Rect healthBarBox(0, 0, int((_healthBar[_currentActor].w - 3) * w), _healthBar[_currentActor].h / 2);
uint32 c = kHypnoColorWhiteOrBlue; // white
@ -161,8 +162,7 @@ void BoyzEngine::hitPlayer() {
_compositeSurface->fillRect(Common::Rect(0, 0, _screenW, _screenH), c);
drawScreen();
if (!_infiniteHealthCheat) {
_healthTeam[_currentActor] = _healthTeam[_currentActor] - 10;
_health = _healthTeam[_currentActor];
_health = _health - 10;
}
if (!_hitSound.empty())
playSound(_soundPath + _hitSound, 1, 11025);

View File

@ -322,9 +322,8 @@ void BoyzEngine::loadAssets() {
_warningHostage = "warnings/w08s.smk";
// Set initial health for the team
for (int i = 0; i < 7; i++) {
_healthTeam[i] = _maxHealth;
}
_health = _maxHealth;
_previousHealth = _maxHealth;
targets->free();
delete targets;

View File

@ -118,8 +118,7 @@ void BoyzEngine::runRetryMenu(Code *code) {
cont = false;
} else if (event.kbd.keycode == Common::KEYCODE_t) {
// Restore initial health for the team
for (int i = 0; i < 7; i++)
_healthTeam[i] = _maxHealth;
_health = _maxHealth;
_nextLevel = firstLevelTerritory(_checkpoint);
cont = false;

View File

@ -571,7 +571,7 @@ public:
int _ammoTeam[7];
int _healthTeam[7];
int _previousHealth;
Graphics::Surface _healthBar[7];
Graphics::Surface _ammoBar[7];
Graphics::Surface _portrait[7];

View File

@ -34,6 +34,9 @@ static const int shootOriginIndex[9][2] = {
{41, 3}, {51, 3}, {65, 6}, {40, 16}, {58, 20}, {67, 10}, {37, 14}, {37, 15}, {67, 22}};
void SpiderEngine::runBeforeArcade(ArcadeShooting *arc) {
_health = arc->health;
_maxHealth = _health;
_checkpoint = _currentLevel;
assert(!arc->player.empty());
_playerFrames = decodeFrames(arc->player);

View File

@ -497,6 +497,8 @@ uint32 WetEngine::findPaletteIndexZones(uint32 id) {
}
void WetEngine::runBeforeArcade(ArcadeShooting *arc) {
_health = arc->health;
_maxHealth = _health;
resetStatistics();
_checkpoint = _currentLevel;
MVideo *video;