aboutsummaryrefslogtreecommitdiff
path: root/engines/cryo/eden.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cryo/eden.cpp')
-rw-r--r--engines/cryo/eden.cpp725
1 files changed, 369 insertions, 356 deletions
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index 04191ffdeb..247754c8ac 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -42,6 +42,7 @@
#include "cryo/cryolib.h"
#include "cryo/eden.h"
#include "cryo/sound.h"
+#include "cryo/eden_graphics.h"
namespace Cryo {
@@ -62,28 +63,26 @@ EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
{ 0x81, 0x90, 1, 0x10}
};
+ _graphics = nullptr;
+
_adamMapMarkPos = Common::Point(-1, -1);
_scrollPos = _oldScrollPos = 0;
_frescoTalk = false;
_torchCursor = false;
_curBankNum = 0;
- _glowH = _glowW = _glowY = _glowX = 0;
_paletteUpdateRequired = false;
_cursorSaved = false;
- _showBlackBars = false;
_backgroundSaved = false;
_bankData = nullptr;
_tyranPtr = nullptr;
_lastAnimFrameNumb = _curAnimFrameNumb = 0;
_lastAnimTicks = 0;
- _curCharacterRect = nullptr;
_numAnimFrames = _maxPersoDesc = _numImgDesc = 0;
_restartAnimation = _animationActive = false;
_animationDelay = _animationIndex = _lastAnimationIndex = 0;
dword_30724 = dword_30728 = _mouthAnimations = _animationTable = nullptr;
_characterBankData = nullptr;
- _savedUnderSubtitles = false;
_numTextLines = 0;
_textOutPtr = textout = nullptr;
_curSpecialObject = nullptr;
@@ -94,7 +93,7 @@ EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
_lastPhrasesFile = 0;
_dialogSkipFlags = 0;
_voiceSamplesBuffer = nullptr;
- _needToFade = false;
+
_mainBankBuf = nullptr;
_musicBuf = nullptr;
_gameLipsync = nullptr;
@@ -115,7 +114,6 @@ EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
_musicChannel = _voiceChannel = nullptr;
_hnmSoundChannel = nullptr;
_voiceSound = nullptr;
- _view2 = _underSubtitlesView = _subtitlesView = _underBarsView = _mainView = _hnmView = nullptr;
_cirsorPanX = 0;
_inventoryScrollDelay = 0;
_cursorPosY = _cursorPosX = 0;
@@ -123,7 +121,6 @@ EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
_currSpot = _curSpot2 = nullptr;
_mouseHeld = false;
_normalCursor = false;
- _showVideoSubtitle = false;
_specialTextMode = false;
_voiceSamplesSize = 0;
_animateTalking = false;
@@ -172,21 +169,24 @@ EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
_cursCenter = 11;
}
+EdenGame::~EdenGame() {
+}
+
void EdenGame::removeConsole() {
}
void EdenGame::scroll() {
restoreFriezes();
- _mainView->_normal._srcLeft = _scrollPos;
- _mainView->_zoom._srcLeft = _scrollPos;
+ _graphics->getMainView()->_normal._srcLeft = _scrollPos;
+ _graphics->getMainView()->_zoom._srcLeft = _scrollPos;
}
void EdenGame::resetScroll() {
_oldScrollPos = _scrollPos;
_scrollPos = 0;
restoreFriezes(); //TODO: inlined scroll() ?
- _mainView->_normal._srcLeft = 0;
- _mainView->_zoom._srcLeft = 0;
+ _graphics->getMainView()->_normal._srcLeft = 0;
+ _graphics->getMainView()->_zoom._srcLeft = 0;
}
void EdenGame::scrollFrescoes() {
@@ -199,18 +199,27 @@ void EdenGame::scrollFrescoes() {
scroll();
}
+bool EdenGame::animationIsActive() {
+ return _animationActive;
+}
+
// Original name: afffresques
void EdenGame::displayFrescoes() {
useBank(_globals->_frescoeImgBank);
- drawSprite(0, 0, 16);
+ _graphics->drawSprite(0, 0, 16);
useBank(_globals->_frescoeImgBank + 1);
- drawSprite(0, 320, 16);
+ _graphics->drawSprite(0, 320, 16);
_paletteUpdateRequired = true;
}
+void EdenGame::setVolume(uint16 vol) {
+ _hnmSoundChannel->setVolumeLeft(vol);
+ _hnmSoundChannel->setVolumeRight(vol);
+}
+
void EdenGame::gametofresques() {
_frescoTalk = false;
- rundcurs();
+ _graphics->rundcurs();
saveFriezes();
displayFrescoes();
_globals->_displayFlags = DisplayFlags::dfFrescoes;
@@ -220,8 +229,8 @@ void EdenGame::gametofresques() {
void EdenGame::doFrescoes() {
_cursorSaved = false;
_torchCursor = true;
- _glowX = -1;
- _glowY = -1;
+ _graphics->setGlowX(-1);
+ _graphics->setGlowY(-1);
_globals->_gameFlags |= GameFlags::gfFlag20;
_globals->_varD4 = 0;
_globals->_curObjectId = 0;
@@ -275,7 +284,7 @@ void EdenGame::scrollPanel() {
// Original name: affsuiveur
void EdenGame::displayFollower(Follower *follower, int16 x, int16 y) {
useBank(follower->_spriteBank);
- drawSprite(follower->_spriteNum, x, y + 16);
+ _graphics->drawSprite(follower->_spriteNum, x, y + 16);
}
// Original name: persoinmiroir
@@ -331,7 +340,7 @@ void EdenGame::characterInMirror() {
// Original name: gametomiroir
void EdenGame::gameToMirror(byte arg1) {
if (_globals->_displayFlags != DisplayFlags::dfFlag2) {
- rundcurs();
+ _graphics->rundcurs();
restoreFriezes();
drawTopScreen();
showObjects();
@@ -343,9 +352,9 @@ void EdenGame::gameToMirror(byte arg1) {
resNum = 2487; // PCIMG.HSQ
useBank(resNum);
- drawSprite(0, 0, 16);
+ _graphics->drawSprite(0, 0, 16);
useBank(resNum + 1);
- drawSprite(0, 320, 16);
+ _graphics->drawSprite(0, 320, 16);
characterInMirror();
_paletteUpdateRequired = true;
_globals->_iconsIndex = 16;
@@ -359,7 +368,7 @@ void EdenGame::flipMode() {
endCharacterSpeech();
if (_globals->_displayFlags == DisplayFlags::dfPerson) {
if (_globals->_characterPtr == &_persons[PER_TAU] && _globals->_phaseNum >= 80)
- displaySubtitles();
+ _graphics->displaySubtitles();
else {
getDataSync();
loadCurrCharacter();
@@ -368,7 +377,7 @@ void EdenGame::flipMode() {
animCharacter();
}
} else
- displaySubtitles();
+ _graphics->displaySubtitles();
persovox();
} else {
if (_globals->_displayFlags != DisplayFlags::dfFrescoes && _globals->_displayFlags != DisplayFlags::dfFlag2) {
@@ -390,7 +399,7 @@ void EdenGame::flipMode() {
// Original name: quitmiroir
void EdenGame::quitMirror() {
- rundcurs();
+ _graphics->rundcurs();
display();
resetScroll();
saveFriezes();
@@ -414,7 +423,7 @@ void EdenGame::actionClickValleyPlan() {
if (_globals->_roomNum == 8 || _globals->_roomNum < 16)
return;
- rundcurs();
+ _graphics->rundcurs();
display();
if (_globals->_displayFlags == DisplayFlags::dfMirror)
quitMirror();
@@ -438,9 +447,9 @@ void EdenGame::gotoPlace(Goto *go) {
closeCharacterScreen();
}
if (go->_enterVideoNum) {
- hideBars();
- playHNM(go->_enterVideoNum);
- _needToFade = true;
+ _graphics->hideBars();
+ _graphics->playHNM(go->_enterVideoNum);
+ _graphics->setFade(true);
}
initPlace(_globals->_newRoomNum);
specialoutside();
@@ -543,7 +552,7 @@ void EdenGame::move(Direction dir) {
int16 roomNum = _globals->_roomNum;
debug("move: from room %4X", roomNum);
char newLoc = 0;
- rundcurs();
+ _graphics->rundcurs();
display();
_globals->_prevLocation = roomNum & 0xFF;
switch (dir) {
@@ -593,8 +602,8 @@ void EdenGame::move2(Direction dir) {
// Original name: dinosoufle
void EdenGame::actionDinoBlow() {
if (_globals->_curObjectId == 0) {
- hideBars();
- playHNM(148);
+ _graphics->hideBars();
+ _graphics->playHNM(148);
maj2();
}
}
@@ -604,9 +613,9 @@ void EdenGame::actionPlateMonk() {
if (_globals->_curObjectId != 0) {
if (_globals->_curObjectId == Objects::obPrism) {
loseObject(Objects::obPrism);
- hideBars();
+ _graphics->hideBars();
_specialTextMode = true;
- playHNM(89);
+ _graphics->playHNM(89);
// CHECKME: Unused code
// word_2F514 |= 0x8000;
maj2();
@@ -614,8 +623,8 @@ void EdenGame::actionPlateMonk() {
showEvents();
}
} else {
- hideBars();
- playHNM(7);
+ _graphics->hideBars();
+ _graphics->playHNM(7);
maj2();
_globals->_eventType = EventType::etEvent4;
showEvents();
@@ -726,7 +735,7 @@ void EdenGame::handleDinaDialog() {
bool res = dialoscansvmas((Dialog *)getElem(_gameDialogs, num));
_frescoTalk = false;
if (res) {
- restoreUnderSubtitles();
+ _graphics->restoreUnderSubtitles();
_frescoTalk = true;
persovox();
}
@@ -737,6 +746,22 @@ void EdenGame::handleDinaDialog() {
}
}
+int16 EdenGame::getCurPosX() {
+ return _cursorPosX;
+}
+
+int16 EdenGame::getCurPosY() {
+ return _cursorPosY;
+}
+
+void EdenGame::setCurPosX(int16 xpos) {
+ _cursorPosX = xpos;
+}
+
+void EdenGame::setCurPosY(int16 ypos) {
+ _cursorPosY = ypos;
+}
+
// Original name: roiparle
void EdenGame::handleKingDialog() {
if (_globals->_phaseNum <= 400)
@@ -747,8 +772,8 @@ void EdenGame::handleKingDialog() {
void EdenGame::actionKingDialog1() {
if (_globals->_curObjectId == Objects::obSword) {
_globals->_gameFlags |= GameFlags::gfFlag80;
- hideBars();
- playHNM(76);
+ _graphics->hideBars();
+ _graphics->playHNM(76);
move2(kCryoNorth);
} else {
_globals->_frescoNumber = 1;
@@ -867,8 +892,8 @@ void EdenGame::actionGetTablet() {
_gameIcons[16]._cursorId |= 0x8000;
showObjects();
_gameRooms[131]._video = 0;
- hideBars();
- playHNM(149);
+ _graphics->hideBars();
+ _graphics->playHNM(149);
_globals->_varF1 = RoomFlags::rf04;
_globals->_drawFlags = DrawFlags::drDrawFlag20;
_normalCursor = true;
@@ -897,8 +922,8 @@ void EdenGame::actionLookLake() {
room->_id = 3;
}
debug("sea monster: room = %X, d0 = %X\n", _globals->_roomNum, _globals->_roomImgBank);
- hideBars();
- playHNM(vid);
+ _graphics->hideBars();
+ _graphics->playHNM(vid);
updateRoom(_globals->_roomNum); //TODO: getting memory trashed here?
if (_globals->_curObjectId == Objects::obApple)
loseObject(Objects::obApple);
@@ -939,7 +964,7 @@ void EdenGame::actionGotoFullNest() {
// Original name: gotoval
void EdenGame::actionGotoVal() {
uint16 target = _globals->_roomNum;
- rundcurs();
+ _graphics->rundcurs();
display();
_scrollPos = 0;
char obj = _curSpot2->_objectId - 14; //TODO
@@ -949,8 +974,8 @@ void EdenGame::actionGotoVal() {
// Original name: visiter
void EdenGame::actionVisit() {
- hideBars();
- playHNM(144);
+ _graphics->hideBars();
+ _graphics->playHNM(144);
_globals->_varF1 = RoomFlags::rf04;
maj2();
}
@@ -960,10 +985,10 @@ void EdenGame::actionFinal() {
if (_globals->_curObjectId != 0)
return;
- hideBars();
+ _graphics->hideBars();
*(int16 *)(_gameRooms + 0x6DC) = 319; //TODO
_globals->_roomImgBank = 319;
- playHNM(97);
+ _graphics->playHNM(97);
maj2();
_globals->_eventType = EventType::etEvent12;
showEvents();
@@ -999,14 +1024,14 @@ void EdenGame::display() {
if (!_globals->_mirrorEffect && !_globals->_var103) {
if (_paletteUpdateRequired) {
_paletteUpdateRequired = false;
- CLPalette_Send2Screen(_globalPalette, 0, 256);
+ _graphics->SendPalette2Screen(256);
}
- CLBlitter_CopyView2Screen(_mainView);
+ CLBlitter_CopyView2Screen(_graphics->getMainView());
} else {
if (_globals->_mirrorEffect)
- displayEffect3();
+ _graphics->displayEffect3();
else
- displayEffect2();
+ _graphics->displayEffect2();
_globals->_var103 = 0;
_globals->_mirrorEffect = 0;
@@ -1015,57 +1040,35 @@ void EdenGame::display() {
void EdenGame::afficher128() {
if (_globals->_updatePaletteFlag == 16) {
- CLPalette_Send2Screen(_globalPalette, 0, 129);
- CLBlitter_CopyView2Screen(_mainView);
+ _graphics->SendPalette2Screen(129);
+ CLBlitter_CopyView2Screen(_graphics->getMainView());
_globals->_updatePaletteFlag = 0;
} else {
- clearScreen();
- fadeToBlackLowPalette(1);
- if (_showBlackBars)
- drawBlackBars();
- CLBlitter_CopyView2Screen(_mainView);
- fadeFromBlackLowPalette(1);
+ _graphics->clearScreen();
+ _graphics->fadeToBlackLowPalette(1);
+ if (_graphics->getShowBlackBars())
+ _graphics->drawBlackBars();
+ CLBlitter_CopyView2Screen(_graphics->getMainView());
+ _graphics->fadeFromBlackLowPalette(1);
}
}
// Original name: sauvefrises
void EdenGame::saveFriezes() {
- saveTopFrieze(0);
- saveBottomFrieze();
-}
-
-// Original name: sauvefriseshaut
-void EdenGame::saveTopFrieze(int16 x) { // Save top bar
- _underTopBarScreenRect = Common::Rect(x, 0, x + 320 - 1, 15);
- _underTopBarBackupRect = Common::Rect(0, 0, 320 - 1, 15);
- CLBlitter_CopyViewRect(_mainView, _underBarsView, &_underTopBarScreenRect, &_underTopBarBackupRect);
-}
-
-// Original name: sauvefrisesbas
-void EdenGame::saveBottomFrieze() { // Save bottom bar
- _underBottomBarScreenRect.left = 0;
- _underBottomBarScreenRect.right = 320 - 1;
- CLBlitter_CopyViewRect(_mainView, _underBarsView, &_underBottomBarScreenRect, &_underBottomBarBackupRect);
+ _graphics->saveTopFrieze(0);
+ _graphics->saveBottomFrieze();
}
// Original name: restaurefrises
void EdenGame::restoreFriezes() {
- restoreTopFrieze();
- restoreBottomFrieze();
+ _graphics->restoreTopFrieze();
+ _graphics->restoreBottomFrieze();
}
-// Original name: restaurefriseshaut
-void EdenGame::restoreTopFrieze() {
- _underTopBarScreenRect.left = _scrollPos;
- _underTopBarScreenRect.right = _scrollPos + 320 - 1;
- CLBlitter_CopyViewRect(_underBarsView, _mainView, &_underTopBarBackupRect, &_underTopBarScreenRect);
-}
-// Original name: restaurefrisesbas
-void EdenGame::restoreBottomFrieze() {
- _underBottomBarScreenRect.left = _scrollPos;
- _underBottomBarScreenRect.right = _scrollPos + 320 - 1;
- CLBlitter_CopyViewRect(_underBarsView, _mainView, &_underBottomBarBackupRect, &_underBottomBarScreenRect);
+
+byte * EdenGame::getBankData() {
+ return _bankData;
}
void EdenGame::useMainBank() {
@@ -1089,68 +1092,15 @@ void EdenGame::useBank(int16 bank) {
}
}
-void EdenGame::readPalette(byte *ptr) {
- bool doit = true;
- color3_t pal_entry;
- while (doit) {
- uint16 idx = *ptr++;
- if (idx != 0xFF) {
- uint16 cnt = *ptr++;
- while (cnt--) {
- if (idx == 0) {
- pal_entry.r = 0;
- pal_entry.g = 0;
- pal_entry.b = 0;
- ptr += 3;
- } else {
- pal_entry.r = *ptr++ << 10;
- pal_entry.g = *ptr++ << 10;
- pal_entry.b = *ptr++ << 10;
- }
- CLPalette_SetRGBColor(_globalPalette, idx, &pal_entry);
- idx++;
- }
- } else
- doit = false;
- }
-}
-
-// Original name: sauvefondbouche
-void EdenGame::saveMouthBackground() {
- rect_src.left = _curCharacterRect->left;
- rect_src.top = _curCharacterRect->top;
- rect_src.right = _curCharacterRect->right;
- rect_src.bottom = _curCharacterRect->bottom;
- rect_dst.left = _curCharacterRect->left + 320;
- rect_dst.top = _curCharacterRect->top;
- rect_dst.right = _curCharacterRect->right + 320;
- rect_dst.bottom = _curCharacterRect->bottom;
- CLBlitter_CopyViewRect(_mainView, _mainView, &rect_src, &rect_dst);
- _backgroundSaved = true;
-}
-
-// Original name: restaurefondbouche
-void EdenGame::restoreMouthBackground() {
- rect_src.left = _curCharacterRect->left;
- rect_src.top = _curCharacterRect->top;
- rect_src.right = _curCharacterRect->right;
- rect_src.bottom = _curCharacterRect->bottom;
- rect_dst.left = _curCharacterRect->left + 320;
- rect_dst.top = _curCharacterRect->top;
- rect_dst.right = _curCharacterRect->right + 320;
- rect_dst.bottom = _curCharacterRect->bottom;
- CLBlitter_CopyViewRect(_mainView, _mainView, &rect_dst, &rect_src);
-}
-
void EdenGame::drawTopScreen() { // Draw top bar (location / party / map)
_globals->_drawFlags &= ~DrawFlags::drDrawTopScreen;
useBank(314);
- drawSprite(36, 83, 0);
- drawSprite(_globals->_areaPtr->_num - 1, 0, 0);
- drawSprite(23, 145, 0);
+ _graphics->drawSprite(36, 83, 0);
+ _graphics->drawSprite(_globals->_areaPtr->_num - 1, 0, 0);
+ _graphics->drawSprite(23, 145, 0);
for (perso_t *perso = &_persons[PER_DINA]; perso != &_persons[PER_UNKN_156]; perso++) {
if ((perso->_flags & PersonFlags::pfInParty) && !(perso->_flags & PersonFlags::pf80))
- drawSprite(perso->_targetLoc + 18, perso->_lastLoc + 120, 0);
+ _graphics->drawSprite(perso->_targetLoc + 18, perso->_lastLoc + 120, 0);
}
_adamMapMarkPos.x = -1;
_adamMapMarkPos.y = -1;
@@ -1161,7 +1111,7 @@ void EdenGame::drawTopScreen() { // Draw top bar (location / party / map)
// Original name: affplanval
void EdenGame::displayValleyMap() { // Draw mini-map
if (_globals->_areaPtr->_type == AreaType::atValley) {
- drawSprite(_globals->_areaPtr->_num + 9, 266, 1);
+ _graphics->drawSprite(_globals->_areaPtr->_num + 9, 266, 1);
for (perso_t *perso = &_persons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) {
if (((perso->_roomNum >> 8) == _globals->_areaNum)
&& !(perso->_flags & PersonFlags::pf80) && (perso->_flags & PersonFlags::pf20))
@@ -1169,20 +1119,20 @@ void EdenGame::displayValleyMap() { // Draw mini-map
}
if (_globals->_areaPtr->_citadelLevel)
displayMapMark(34, _globals->_areaPtr->_citadelRoomPtr->_location);
- saveTopFrieze(0);
+ _graphics->saveTopFrieze(0);
int16 loc = _globals->_roomNum & 0xFF;
if (loc >= 16)
displayAdamMapMark(loc);
- restoreTopFrieze();
+ _graphics->restoreTopFrieze();
} else {
- saveTopFrieze(0);
- restoreTopFrieze();
+ _graphics->saveTopFrieze(0);
+ _graphics->restoreTopFrieze();
}
}
// Original name: affrepere
void EdenGame::displayMapMark(int16 index, int16 location) {
- drawSprite(index, 269 + location % 16 * 4, 2 + (location - 16) / 16 * 3);
+ _graphics->drawSprite(index, 269 + location % 16 * 4, 2 + (location - 16) / 16 * 3);
}
// Original name: affrepereadam
@@ -1194,8 +1144,8 @@ void EdenGame::displayAdamMapMark(int16 location) {
x += (location & 15) * 4;
y += ((location - 16) >> 4) * 3;
saveAdamMapMark(x, y);
- byte *pix = _underBarsView->_bufferPtr;
- int16 w = _underBarsView->_width;
+ byte *pix = _graphics->getUnderBarsView()->_bufferPtr;
+ int16 w = _graphics->getUnderBarsView()->_width;
pix += x + w * y;
pix[1] = 0xC3;
pix[2] = 0xC3;
@@ -1217,8 +1167,8 @@ void EdenGame::restoreAdamMapMark() {
int16 x = _adamMapMarkPos.x;
int16 y = _adamMapMarkPos.y;
- byte *pix = _underBarsView->_bufferPtr;
- int16 w = _underBarsView->_width;
+ byte *pix = _graphics->getUnderBarsView()->_bufferPtr;
+ int16 w = _graphics->getUnderBarsView()->_width;
pix += x + w * y;
pix[1] = _oldPix[0];
pix[2] = _oldPix[1];
@@ -1236,8 +1186,8 @@ void EdenGame::restoreAdamMapMark() {
void EdenGame::saveAdamMapMark(int16 x, int16 y) {
_adamMapMarkPos.x = x;
_adamMapMarkPos.y = y;
- byte *pix = _underBarsView->_bufferPtr;
- int16 w = _underBarsView->_width;
+ byte *pix = _graphics->getUnderBarsView()->_bufferPtr;
+ int16 w = _graphics->getUnderBarsView()->_width;
pix += x + w * y;
_oldPix[0] = pix[1];
_oldPix[1] = pix[2];
@@ -1446,6 +1396,10 @@ void EdenGame::evolveCitadel(int16 level) {
}
}
+int16 EdenGame::getCurBankNum() {
+ return _curBankNum;
+}
+
// Original name: citacapoute
void EdenGame::destroyCitadelRoom(int16 roomNum) {
perso_t *perso = &_persons[PER_UNKN_18C];
@@ -1811,11 +1765,15 @@ void EdenGame::addTime(int16 t) {
}
}
+byte *EdenGame::getImageDesc() {
+ return _imageDesc;
+}
+
// Original name: anim_perso
void EdenGame::animCharacter() {
if (_curBankNum != _globals->_characterImageBank)
loadCharacter(_globals->_characterPtr);
- restoreUnderSubtitles();
+ _graphics->restoreUnderSubtitles();
if (_restartAnimation) {
_lastAnimTicks = _vm->_timerTicks;
_restartAnimation = false;
@@ -1834,7 +1792,7 @@ void EdenGame::animCharacter() {
_mouthAnimations = _imageDesc + 200;
removeMouthSprite();
if (*_mouthAnimations)
- displayImage();
+ _graphics->displayImage();
_animationDelay--;
if (!_animationDelay) {
_globals->_animationFlags = 1;
@@ -1850,8 +1808,10 @@ void EdenGame::animCharacter() {
if (_animateTalking) {
if (!_animationTable) {
_animationTable = _gameLipsync + 7262; //TODO: fix me
- if (!_backgroundSaved)
- saveMouthBackground();
+ if (!_backgroundSaved) {
+ _graphics->saveMouthBackground();
+ _backgroundSaved = true;
+ }
}
if (!_personTalking)
_curAnimFrameNumb = _numAnimFrames - 1;
@@ -1860,16 +1820,16 @@ void EdenGame::animCharacter() {
_animateTalking = false;
else if (_animationIndex != _lastAnimationIndex) {
useCharacterBank();
- restoreMouthBackground();
+ _graphics->restoreMouthBackground();
// debug("perso spr %d", animationIndex);
setCharacterSprite(_globals->_persoSpritePtr2 + _animationIndex * 2); //TODO: int16s?
_mouthAnimations = _imageDesc + 200;
if (*_mouthAnimations)
- displayImage();
+ _graphics->displayImage();
_lastAnimationIndex = _animationIndex;
}
}
- displaySubtitles();
+ _graphics->displaySubtitles();
}
void EdenGame::getanimrnd() {
@@ -1904,7 +1864,7 @@ void EdenGame::addanim() {
if (_globals->_characterPtr->_id != PersonId::pidCabukaOfCantura && _globals->_characterPtr->_targetLoc != 7) //TODO: targetLoc is minisprite idx
removeMouthSprite();
if (*_mouthAnimations)
- displayImage();
+ _graphics->displayImage();
}
// Original name: virespritebouche
@@ -1973,7 +1933,7 @@ void EdenGame::setCharacterSprite(byte *spr) {
// Original name: af_perso1
void EdenGame::displayCharacter1() {
setCharacterSprite(_globals->_persoSpritePtr + READ_LE_UINT16(_globals->_persoSpritePtr));
- displayImage();
+ _graphics->displayImage();
}
// Original name: af_perso
@@ -1993,7 +1953,7 @@ void EdenGame::loadCharacter(perso_t *perso) {
return;
if (perso->_spriteBank != _globals->_characterImageBank) {
- _curCharacterRect = &_characterRects[perso->_id]; //TODO: array of int16?
+ _graphics->setCurCharRect(&_characterRects[perso->_id]); //TODO: array of int16?
dword_30728 = _characterArray[perso->_id];
ef_perso();
_globals->_characterImageBank = perso->_spriteBank;
@@ -2048,9 +2008,9 @@ void EdenGame::no_perso() {
void EdenGame::closeCharacterScreen() {
endCharacterSpeech();
if (_globals->_displayFlags == DisplayFlags::dfPerson && _globals->_characterPtr->_id != PersonId::pidNarrator && _globals->_eventType != EventType::etEventE) {
- rundcurs();
- _savedUnderSubtitles = true;
- restoreUnderSubtitles();
+ _graphics->rundcurs();
+ _graphics->setSavedUnderSubtitles(true);
+ _graphics->restoreUnderSubtitles();
display();
_globals->_var103 = 16;
}
@@ -2100,7 +2060,7 @@ void EdenGame::displayBackgroundFollower() {
if (follower->sx >= 320)
bank = 327;
useBank(bank + _globals->_roomBackgroundBankNum);
- drawSprite(0, 0, 16, true);
+ _graphics->drawSprite(0, 0, 16, true);
break;
}
}
@@ -2110,12 +2070,20 @@ void EdenGame::displayNoFollower(int16 bank) {
if (bank) {
useBank(bank);
if (_globals->_characterPtr == &_persons[PER_UNKN_156])
- drawSprite(0, 0, 16, true);
+ _graphics->drawSprite(0, 0, 16, true);
else
- drawSprite(0, 0, 16);
+ _graphics->drawSprite(0, 0, 16);
}
}
+int16 EdenGame::getGameIconX(int16 index) {
+ return _gameIcons[index].sx;
+}
+
+int16 EdenGame::getGameIconY(int16 index) {
+ return _gameIcons[index].sy;
+}
+
// Original name: af_fondperso1
void EdenGame::displayCharacterBackground1() {
byte bank;
@@ -2197,11 +2165,11 @@ void EdenGame::showCharacter() {
setCharacterIcon();
displayCharacterBackground();
if (perso == &_persons[PER_TAU] && _globals->_curObjectId == Objects::obShell) {
- displaySubtitles();
+ _graphics->displaySubtitles();
updateCursor();
_paletteUpdateRequired = true;
display();
- rundcurs();
+ _graphics->rundcurs();
return;
}
}
@@ -2209,7 +2177,7 @@ void EdenGame::showCharacter() {
addanim();
if (!_globals->_curCharacterAnimPtr) {
displayCharacter();
- displaySubtitles();
+ _graphics->displaySubtitles();
}
_restartAnimation = true;
animCharacter();
@@ -2217,11 +2185,11 @@ void EdenGame::showCharacter() {
updateCursor();
_paletteUpdateRequired = true;
if (perso != &_persons[PER_UNKN_156])
- rundcurs();
+ _graphics->rundcurs();
display();
} else {
displayPlace();
- displaySubtitles();
+ _graphics->displaySubtitles();
}
}
@@ -2232,7 +2200,7 @@ void EdenGame::displayCharacterPanel() {
addanim();
if (!_globals->_curCharacterAnimPtr) {
displayCharacter();
- displaySubtitles();
+ _graphics->displaySubtitles();
}
_restartAnimation = true;
_paletteUpdateRequired = true;
@@ -2243,7 +2211,7 @@ void EdenGame::displayCharacterPanel() {
updateCursor();
display();
if (perso != &_persons[PER_UNKN_156])
- rundcurs();
+ _graphics->rundcurs();
_globals->_drawFlags |= DrawFlags::drDrawFlag8;
_globals->_iconsIndex = 112;
}
@@ -2297,6 +2265,10 @@ void EdenGame::waitEndSpeak() {
_mouseHeld = true;
}
+int16 EdenGame::getNumTextLines() {
+ return _numTextLines;
+}
+
void EdenGame::my_bulle() {
if (!_globals->_textNum)
return;
@@ -2406,19 +2378,31 @@ void EdenGame::my_bulle() {
byte x = *icons++;
byte y = *icons++;
byte s = *icons++;
- drawSprite(52, x + _subtitlesXCenter, y - 1, false, true);
- drawSprite(s + 9, x + _subtitlesXCenter + 1, y, false, true);
+ _graphics->drawSprite(52, x + _subtitlesXCenter, y - 1, false, true);
+ _graphics->drawSprite(s + 9, x + _subtitlesXCenter + 1, y, false, true);
}
}
+int16 EdenGame::getScrollPos() {
+ return _scrollPos;
+}
+
+bool EdenGame::getSpecialTextMode() {
+ return _specialTextMode;
+}
+
+void EdenGame::setSpecialTextMode(bool value) {
+ _specialTextMode = value;
+}
+
void EdenGame::my_pr_bulle() {
- CLBlitter_FillView(_subtitlesView, 0);
+ CLBlitter_FillView(_graphics->getSubtitlesView(), 0);
if (_globals->_prefLanguage == 0)
return;
byte *coo = _sentenceCoordsBuffer;
bool done = false;
- textout = _subtitlesViewBuf;
+ textout = _graphics->getSubtitlesViewBuf();
byte *textPtr = _sentenceBuffer;
int16 lines = 1;
while (!done) {
@@ -2487,41 +2471,6 @@ void EdenGame::drawSubtitleChar(byte c, byte color, int16 width) {
}
}
-// Original name: sauvefondbulle
-void EdenGame::saveUnderSubtitles(int16 y) {
- _underSubtitlesScreenRect.top = y - _numTextLines * FONT_HEIGHT;
- _underSubtitlesScreenRect.left = _scrollPos + _subtitlesXScrMargin;
- _underSubtitlesScreenRect.right = _scrollPos + _subtitlesXScrMargin + _subtitlesXWidth - 1;
- _underSubtitlesScreenRect.bottom = y;
- _underSubtitlesBackupRect.top = 0;
- _underSubtitlesBackupRect.bottom = _numTextLines * FONT_HEIGHT;
- CLBlitter_CopyViewRect(_mainView, _underSubtitlesView, &_underSubtitlesScreenRect, &_underSubtitlesBackupRect);
- _savedUnderSubtitles = true;
-}
-
-// Original name: restaurefondbulle
-void EdenGame::restoreUnderSubtitles() {
- if (!_savedUnderSubtitles)
- return;
- CLBlitter_CopyViewRect(_underSubtitlesView, _mainView, &_underSubtitlesBackupRect, &_underSubtitlesScreenRect);
- _savedUnderSubtitles = false;
-}
-
-// Original name: af_subtitlehnm
-void EdenGame::displayHNMSubtitle() {
- byte *src = _subtitlesViewBuf;
- byte *dst = _hnmViewBuf + _subtitlesXScrMargin + (158 - _numTextLines * FONT_HEIGHT) * 320;
- for (int16 y = 0; y < _numTextLines * FONT_HEIGHT; y++) {
- for (int16 x = 0; x < _subtitlesXWidth; x++) {
- char c = *src++;
- if (c)
- *dst = c;
- dst++;
- }
- dst += 320 - _subtitlesXWidth;
- }
-}
-
// Original name: patchPhrase
void EdenGame::patchSentence() {
_sentenceBuffer[36] = 'c';
@@ -2710,7 +2659,7 @@ void EdenGame::handleCharacterDialog(int16 pers) {
uint16 idx = perso->_id * 8 | _globals->_dialogType;
dialoscansvmas((Dialog *)getElem(_gameDialogs, idx));
displayPlace();
- displaySubtitles();
+ _graphics->displaySubtitles();
persovox();
_globals->_varCA = 0;
_globals->_dialogType = DialogType::dtTalk;
@@ -2943,12 +2892,12 @@ void EdenGame::actionAdam() {
int16 vid = 84;
if (!object->_count)
vid = *objvid;
- hideBars();
+ _graphics->hideBars();
_specialTextMode = true;
- playHNM(vid);
+ _graphics->playHNM(vid);
_paletteUpdateRequired = true;
_globals->_mirrorEffect = 16; // CHECKME: Verify the value
- showBars();
+ _graphics->showBars();
gameToMirror(0);
}
break;
@@ -3489,6 +3438,10 @@ bool EdenGame::dialoscansvmas(Dialog *dial) {
return res;
}
+byte *EdenGame::getGameDialogs() {
+ return _gameDialogs;
+}
+
// Original name: dialo_even
bool EdenGame::dialogEvent(perso_t *perso) {
_globals->_characterPtr = perso;
@@ -3509,12 +3462,12 @@ void EdenGame::characterStayHere() {
// Original name: mort
void EdenGame::endDeath(int16 vid) {
- hideBars();
- playHNM(vid);
- fadeToBlack(2);
+ _graphics->hideBars();
+ _graphics->playHNM(vid);
+ _graphics->fadeToBlack(2);
CLBlitter_FillScreenView(0);
- CLBlitter_FillView(_mainView, 0);
- showBars();
+ CLBlitter_FillView(_graphics->getMainView(), 0);
+ _graphics->showBars();
_globals->_narratorSequence = 51;
_globals->_newMusicType = MusicType::mtNormal;
musique();
@@ -3782,26 +3735,11 @@ void EdenGame::initGlobals() {
_globals->_persoSpritePtr = nullptr;
_globals->_numGiveObjs = 0;
- initRects();
-
- _underSubtitlesScreenRect.top = 0;
- _underSubtitlesScreenRect.left = _subtitlesXScrMargin;
- _underSubtitlesScreenRect.right = _subtitlesXScrMargin + _subtitlesXWidth - 1;
- _underSubtitlesScreenRect.bottom = 176 - 1;
+ _graphics->initRects();
- _underSubtitlesBackupRect.top = 0;
- _underSubtitlesBackupRect.left = _subtitlesXScrMargin;
- _underSubtitlesBackupRect.right = _subtitlesXScrMargin + _subtitlesXWidth - 1;
- _underSubtitlesBackupRect.bottom = 60 - 1;
+ _graphics->initGlobals();
- _savedUnderSubtitles = false;
-}
-
-void EdenGame::initRects() {
- _underTopBarScreenRect = Common::Rect(0, 0, 320 - 1, 16 - 1);
- _underTopBarBackupRect = Common::Rect(0, 0, 320 - 1, 16 - 1);
- _underBottomBarScreenRect = Common::Rect(0, 176, 320 - 1, 200 - 1); //TODO: original bug? this cause crash in copyrect (this, underBottomBarBackupRect)
- _underBottomBarBackupRect = Common::Rect(0, 16, 320 - 1, 40 - 1);
+ _graphics->setSavedUnderSubtitles(false);
}
// Original name: closesalle
@@ -3820,7 +3758,7 @@ void EdenGame::displayPlace() {
_globals->_autoDialog = false;
}
_globals->_nextRoomIcon = &_gameIcons[_roomIconsBase];
- displayRoom();
+ _graphics->displayRoom();
_paletteUpdateRequired = true;
}
@@ -3832,6 +3770,14 @@ void EdenGame::loadPlace(int16 num) {
loadRawFile(num + 419, _placeRawBuf);
}
+byte EdenGame::getActionCursor(byte value) {
+ return _actionCursors[value];
+}
+
+byte *EdenGame::getPlaceRawBuf() {
+ return _placeRawBuf;
+}
+
void EdenGame::specialoutside() {
if (_globals->_lastAreaPtr->_type == AreaType::atValley && (_globals->_party & PersonMask::pmLeader))
perso_ici(5);
@@ -3879,8 +3825,8 @@ void EdenGame::specialin() {
if (_globals->_roomNum == 3075 && _globals->_phaseNum == 546) {
incPhase();
if (_globals->_curItemsMask & 0x2000) { // Morkus' tablet
- hideBars();
- playHNM(92);
+ _graphics->hideBars();
+ _graphics->playHNM(92);
_gameRooms[129]._exits[0] = 0;
_gameRooms[129]._exits[2] = 1;
_globals->_roomNum = 3074;
@@ -3916,13 +3862,13 @@ void EdenGame::animpiece() {
if (_globals->_roomVidNum && _globals->_var100 != 0xFF) {
if (_globals->_valleyVidNum || !room->_level || (room->_flags & RoomFlags::rfHasCitadel)
|| room->_level == _globals->_var100) {
- hideBars();
+ _graphics->hideBars();
_globals->_updatePaletteFlag = 16;
if (!(_globals->_narratorSequence & 0x80)) //TODO: bug? !() @ 100DC
_globals->_mirrorEffect = 0;
- if (!_needToFade)
- _needToFade = room->_flags & RoomFlags::rf02;
- playHNM(_globals->_roomVidNum);
+ if (!_graphics->getFade())
+ _graphics->setFade(room->_flags & RoomFlags::rf02);
+ _graphics->playHNM(_globals->_roomVidNum);
return;
}
}
@@ -4038,16 +3984,16 @@ void EdenGame::maj2() {
if (_globals->_mirrorEffect || _globals->_var103)
display();
else if (_globals->_varF1 == (RoomFlags::rf40 | RoomFlags::rf04 | RoomFlags::rf01)) {
- drawBlackBars();
- displayEffect1();
+ _graphics->drawBlackBars();
+ _graphics->displayEffect1();
} else if (_globals->_varF1 && !(_globals->_varF1 & RoomFlags::rf04) && !r30) {
if (!(_globals->_displayFlags & DisplayFlags::dfPanable))
- drawBlackBars();
+ _graphics->drawBlackBars();
else if (_globals->_valleyVidNum)
- drawBlackBars();
- displayEffect1();
+ _graphics->drawBlackBars();
+ _graphics->displayEffect1();
} else if (r30 && !(_globals->_varF1 & RoomFlags::rf04))
- effetpix();
+ _graphics->effetpix();
else
afficher128();
musique();
@@ -4055,7 +4001,7 @@ void EdenGame::maj2() {
drawTopScreen();
showObjects();
}
- showBars();
+ _graphics->showBars();
showEvents();
_globals->_labyrinthDirections = 0;
specialin();
@@ -4121,6 +4067,10 @@ void EdenGame::EmergencyExit() {
SysBeep(1);
}
+void EdenGame::stopMusic() {
+ _musicChannel->stop();
+}
+
void EdenGame::run() {
_invIconsCount = (_vm->getPlatform() == Common::kPlatformMacintosh) ? 9 : 11;
_roomIconsBase = _invIconsBase + _invIconsCount;
@@ -4136,10 +4086,12 @@ void EdenGame::run() {
_musicChannel = new CSoundChannel(_vm->_mixer, 11025, false);
_voiceChannel = new CSoundChannel(_vm->_mixer, 11025, false);
+ _graphics = new EdenGraphics(this,_vm->_video);
+ _graphics->setSavedUnderSubtitles(false);
allocateBuffers();
openbigfile();
- openWindow();
+ _graphics->openWindow();
loadpermfiles();
if (!_bufferAllocationErrorFl) {
@@ -4154,16 +4106,16 @@ void EdenGame::run() {
_quitFlag3 = false;
_normalCursor = true;
_torchCursor = false;
- _cursKeepPos = Common::Point(-1, -1);
+ _graphics->setCursKeepPos(-1,-1);
if (!_gameLoaded)
intro();
edmain();
startmusique(1);
- drawBlackBars();
+ _graphics->drawBlackBars();
display();
- fadeToBlack(3);
- clearScreen();
- playHNM(95);
+ _graphics->fadeToBlack(3);
+ _graphics->clearScreen();
+ _graphics->playHNM(95);
if (_globals->_endGameFlag == 50) {
loadrestart();
_gameLoaded = false;
@@ -4176,10 +4128,12 @@ void EdenGame::run() {
// LostEdenMac_SavePrefs();
}
+ _graphics->fadeToBlack(4);
+
delete _voiceChannel;
delete _musicChannel;
+ delete _graphics;
- fadeToBlack(4);
closebigfile();
freebuf();
CRYOLib_ManagersDone();
@@ -4193,12 +4147,12 @@ void EdenGame::edmain() {
// if in demo mode, reset game after a while
_demoCurrentTicks = _vm->_timerTicks;
if (_demoCurrentTicks - _demoStartTicks > 3000) {
- rundcurs();
+ _graphics->rundcurs();
display();
fademusica0(2);
- fadeToBlack(3);
+ _graphics->fadeToBlack(3);
CLBlitter_FillScreenView(0);
- CLBlitter_FillView(_mainView, 0);
+ CLBlitter_FillView(_graphics->getMainView(), 0);
_musicChannel->stop();
_musicPlayingFlag = false;
_musicEnabledFlag = false;
@@ -4206,7 +4160,7 @@ void EdenGame::edmain() {
enterGame();
}
}
- rundcurs();
+ _graphics->rundcurs();
musicspy();
FRDevents();
handleNarrator();
@@ -4237,28 +4191,28 @@ void EdenGame::intro() {
_vm->_video->closeSound();
_vm->_video->setupSound(22050, false, true);
_hnmSoundChannel = _vm->_video->getSoundChannel();
- playHNM(2012);
- playHNM(171);
+ _graphics->playHNM(2012);
+ _graphics->playHNM(171);
CLBlitter_FillScreenView(0);
_specialTextMode = false;
- playHNM(2001);
+ _graphics->playHNM(2001);
_hnmSoundChannel->stop();
_vm->_video->closeSound();
_vm->_video->setupSound(11025, false, false);
_hnmSoundChannel = _vm->_video->getSoundChannel();
} else {
if (_vm->isDemo()) {
- playHNM(171); // Virgin logo
- playHNM(98); // Cryo logo
+ _graphics->playHNM(171); // Virgin logo
+ _graphics->playHNM(98); // Cryo logo
}
else {
- playHNM(98); // Cryo logo
- playHNM(171); // Virgin logo
+ _graphics->playHNM(98); // Cryo logo
+ _graphics->playHNM(171); // Virgin logo
}
CLBlitter_FillScreenView(0);
_specialTextMode = false;
startmusique(2); // INTRO.MUS is played during intro video
- playHNM(170); // Intro video
+ _graphics->playHNM(170); // Intro video
}
}
@@ -4287,7 +4241,7 @@ void EdenGame::enterGame() {
showObjects();
drawTopScreen();
saveFriezes();
- _showBlackBars = true;
+ _graphics->setShowBlackBars(true);
_globals->_mirrorEffect = 1;
updateRoom(_globals->_roomNum);
if (flag) {
@@ -4345,14 +4299,14 @@ void EdenGame::FRDevents() {
_curSpot2 = _currSpot;
if (_globals->_displayFlags & DisplayFlags::dfFrescoes) {
if (_frescoTalk)
- restoreUnderSubtitles();
+ _graphics->restoreUnderSubtitles();
if (_currCursor == 9 && !_torchCursor) {
- rundcurs();
+ _graphics->rundcurs();
_torchCursor = true;
- _glowX = -1;
+ _graphics->setGlowX(-1);
}
if (_currCursor != 9 && _torchCursor) {
- unglow();
+ _graphics->unglow();
_torchCursor = false;
_cursorSaved = false;
}
@@ -4426,24 +4380,24 @@ void EdenGame::updateCursor() {
if (!_torchCursor) {
useMainBank();
- sundcurs(_cursorPosX + _scrollPos, _cursorPosY);
+ _graphics->sundcurs(_cursorPosX + _scrollPos, _cursorPosY);
if (_currCursor != 53 && _currCursor < 10) { //TODO: cond
if (_vm->getPlatform() == Common::kPlatformMacintosh)
engineMac();
else
enginePC();
} else
- drawSprite(_currCursor, _cursorPosX + _scrollPos, _cursorPosY);
- _glowX = 1;
+ _graphics->drawSprite(_currCursor, _cursorPosX + _scrollPos, _cursorPosY);
+ _graphics->setGlowX(1);
} else {
useBank(117);
if (_cursorPosX > 294)
_cursorPosX = 294;
- unglow();
- glow(_glowIndex);
- drawSprite(_torchCurIndex, _cursorPosX + _scrollPos, _cursorPosY);
+ _graphics->unglow();
+ _graphics->glow(_glowIndex);
+ _graphics->drawSprite(_torchCurIndex, _cursorPosX + _scrollPos, _cursorPosY);
if (_frescoTalk)
- displaySubtitles();
+ _graphics->displaySubtitles();
}
}
@@ -4838,9 +4792,38 @@ void EdenGame::persovox() {
_lastAnimTicks = _vm->_timerTicks;
}
+bool EdenGame::personIsTalking() {
+ return _personTalking;
+}
+
+perso_t *EdenGame::personSubtitles() {
+ perso_t *perso = nullptr;
+ switch (_globals->_curVideoNum) {
+ case 170:
+ perso = &_persons[PER_UNKN_156];
+ break;
+ case 83:
+ perso = &_persons[PER_MORKUS];
+ break;
+ case 88:
+ perso = &_persons[PER_MORKUS];
+ break;
+ case 89:
+ perso = &_persons[PER_MORKUS];
+ break;
+ case 94:
+ perso = &_persons[PER_MORKUS];
+ break;
+ default:
+ return perso;
+ }
+ return perso;
+}
+
+
// Original name: endpersovox
void EdenGame::endCharacterSpeech() {
- restoreUnderSubtitles();
+ _graphics->restoreUnderSubtitles();
if (_personTalking) {
_voiceChannel->stop();
_personTalking = false;
@@ -4944,22 +4927,33 @@ void EdenGame::showObjects() {
icon->_cursorId |= 0x8000;
}
useMainBank();
- drawSprite(55, 0, 176);
+ _graphics->drawSprite(55, 0, 176);
icon = &_gameIcons[_invIconsBase];
total = _globals->_objCount;
int16 index = _globals->_inventoryScrollPos;
for (int16 i = _invIconsCount; total-- && i--; icon++) {
char obj = _ownObjects[index++];
icon->_objectId = obj;
- drawSprite(obj + 9, icon->sx, 178);
+ _graphics->drawSprite(obj + 9, icon->sx, 178);
}
_paletteUpdateRequired = true;
if ((_globals->_displayFlags & DisplayFlags::dfMirror) || (_globals->_displayFlags & DisplayFlags::dfPanable)) {
- saveBottomFrieze();
+ _graphics->saveBottomFrieze();
scroll();
}
}
+
+byte * EdenGame::getGlowBuffer() {
+ return _glowBuffer;
+}
+
+void EdenGame::setMusicFade(byte value) {
+ _musicFadeFlag = value;
+}
+
+
+
void EdenGame::winObject(int16 id) {
object_t *object = getObjectPtr(id);
object->_flags |= ObjectFlags::ofFlag1;
@@ -5171,15 +5165,31 @@ void EdenGame::gotoPanel() {
_globals->_displayFlags = DisplayFlags::dfFlag2;
_globals->_menuFlags = 0;
displayPanel();
- fadeToBlack(3);
+ _graphics->fadeToBlack(3);
displayTopPanel();
- CLBlitter_CopyView2Screen(_mainView);
- CLPalette_Send2Screen(_globalPalette, 0, 256);
+ CLBlitter_CopyView2Screen(_graphics->getMainView());
+ _graphics->SendPalette2Screen(256);
_cursorPosX = 320 / 2;
_cursorPosY = 200 / 2;
_vm->setMousePosition(_mouseCenterX, _mouseCenterY);
}
+void EdenGame::setMouseCenterX(uint16 xpos) {
+ _mouseCenterX = xpos;
+}
+
+void EdenGame::setMouseCenterY(uint16 ypos) {
+ _mouseCenterY = ypos;
+}
+
+uint16 EdenGame::getMouseCenterX() {
+ return _mouseCenterX;
+}
+
+uint16 EdenGame::getMouseCenterY() {
+ return _mouseCenterY;
+}
+
void EdenGame::noclicpanel() {
if (_globals->_menuFlags & MenuFlags::mfFlag4) {
moveTapeCursor();
@@ -5225,12 +5235,12 @@ skip:
}
void EdenGame::generique() {
- drawBlackBars();
+ _graphics->drawBlackBars();
display();
- fadeToBlack(3);
- clearScreen();
+ _graphics->fadeToBlack(3);
+ _graphics->clearScreen();
int oldmusic = _globals->_currMusicNum;
- playHNM(95);
+ _graphics->playHNM(95);
displayPanel();
displayTopPanel();
_paletteUpdateRequired = true;
@@ -5245,14 +5255,30 @@ void EdenGame::cancel2() {
gameToMirror(1);
}
+byte *EdenGame::getCurKeepBuf() {
+ return _cursKeepBuf;
+}
+
+bool EdenGame::isMouseHeld() {
+ return _mouseHeld;
+}
+
+void EdenGame::setMouseHeld() {
+ _mouseHeld = true;
+}
+
+void EdenGame::setMouseNotHeld() {
+ _mouseHeld = false;
+}
+
void EdenGame::testvoice() {
_globals->_frescoNumber = 0;
_globals->_characterPtr = _persons;
_globals->_dialogType = DialogType::dtInspect;
int16 num = (_persons[PER_KING]._id << 3) | _globals->_dialogType;
dialoscansvmas((Dialog *)getElem(_gameDialogs, num));
- restoreUnderSubtitles();
- displaySubtitles();
+ _graphics->restoreUnderSubtitles();
+ _graphics->displaySubtitles();
persovox();
waitEndSpeak();
endCharacterSpeech();
@@ -5275,7 +5301,7 @@ void EdenGame::load() {
}
_vm->hideMouse();
CLBlitter_FillScreenView(0xFFFFFFFF);
- fadeToBlack(3);
+ _graphics->fadeToBlack(3);
CLBlitter_FillScreenView(0);
if (!_gameLoaded) {
_musicFadeFlag = 3;
@@ -5293,9 +5319,9 @@ void EdenGame::load() {
}
bool talk = _globals->_autoDialog; //TODO check me
initafterload();
- fadeToBlack(3);
+ _graphics->fadeToBlack(3);
CLBlitter_FillScreenView(0);
- CLBlitter_FillView(_mainView, 0);
+ CLBlitter_FillView(_graphics->getMainView(), 0);
drawTopScreen();
_globals->_inventoryScrollPos = 0;
showObjects();
@@ -5343,7 +5369,7 @@ void EdenGame::save() {
saveGame(name);
_vm->hideMouse();
CLBlitter_FillScreenView(0xFFFFFFFF);
- fadeToBlack(3);
+ _graphics->fadeToBlack(3);
CLBlitter_FillScreenView(0);
_musicFadeFlag = 3;
musicspy();
@@ -5351,7 +5377,7 @@ void EdenGame::save() {
}
void EdenGame::desktopcolors() {
- fadeToBlack(3);
+ _graphics->fadeToBlack(3);
CLBlitter_FillScreenView(0xFFFFFFFF);
CLPalette_BeSystem();
_vm->showMouse();
@@ -5389,13 +5415,13 @@ void EdenGame::panelrestart() {
_globals->_currMusicNum = 0;
startmusique(curmus);
}
- fadeToBlack(3);
+ _graphics->fadeToBlack(3);
CLBlitter_FillScreenView(0);
- CLBlitter_FillView(_mainView, 0);
+ CLBlitter_FillView(_graphics->getMainView(), 0);
drawTopScreen();
showObjects();
saveFriezes();
- _showBlackBars = true;
+ _graphics->setShowBlackBars(true);
updateRoom(_globals->_roomNum);
}
@@ -5409,7 +5435,7 @@ void EdenGame::confirmer(char mode, char yesId) {
_gameIcons[119]._objectId = yesId;
_confirmMode = mode;
useBank(65);
- drawSprite(12, 117, 74);
+ _graphics->drawSprite(12, 117, 74);
_cursorPosX = 156;
if (_vm->shouldQuit())
_cursorPosX = 136;
@@ -5451,7 +5477,7 @@ void EdenGame::choseSubtitleOption() {
if (lang > 5)
return;
_globals->_prefLanguage = lang;
- langbuftopanel();
+ _graphics->langbuftopanel();
displayLanguage();
}
@@ -5476,7 +5502,7 @@ void EdenGame::changervol() {
newvol(_curSliderValuePtr, delta);
if (_globals->_menuFlags & MenuFlags::mfFlag2)
newvol(_curSliderValuePtr + 1, delta);
- cursbuftopanel();
+ _graphics->cursbuftopanel();
displayCursors();
_curSliderY = _cursorPosY;
} else
@@ -5569,16 +5595,28 @@ void EdenGame::moveTapeCursor() {
_globals->_menuFlags &= ~MenuFlags::mfFlag4;
}
+void EdenGame::setCursorSaved(bool cursorSaved) {
+ _cursorSaved = cursorSaved;
+}
+
+bool EdenGame::getCursorSaved() {
+ return _cursorSaved;
+}
+
+bool EdenGame::getNoPalette() {
+ return _noPalette;
+}
+
// Original name: affcurstape
void EdenGame::displayTapeCursor() {
if (_globals->_drawFlags & DrawFlags::drDrawFlag8)
_noPalette = true;
useBank(65);
- drawSprite(2, 0, 176);
+ _graphics->drawSprite(2, 0, 176);
int x = (_globals->_tapePtr - _tapes) * 8 + 97;
_gameIcons[112].sx = x - 3;
_gameIcons[112].ex = x + 3;
- drawSprite(5, x, 179);
+ _graphics->drawSprite(5, x, 179);
_noPalette = false;
}
@@ -5610,29 +5648,11 @@ void EdenGame::clickTapeCursor() {
_globals->_menuFlags |= MenuFlags::mfFlag4;
}
-void EdenGame::paneltobuf() {
- setSrcRect(0, 16, 320 - 1, 169 - 1);
- setDestRect(320, 16, 640 - 1, 169 - 1);
- CLBlitter_CopyViewRect(_mainView, _mainView, &rect_src, &rect_dst);
-}
-
-void EdenGame::cursbuftopanel() {
- setSrcRect(434, 40, 525 - 1, 111 - 1);
- setDestRect(114, 40, 205 - 1, 111 - 1);
- CLBlitter_CopyViewRect(_mainView, _mainView, &rect_src, &rect_dst);
-}
-
-void EdenGame::langbuftopanel() {
- setSrcRect(328, 42, 407 - 1, 97 - 1);
- setDestRect(8, 42, 87 - 1, 97 - 1);
- CLBlitter_CopyViewRect(_mainView, _mainView, &rect_src, &rect_dst);
-}
-
// Original name: affpanel
void EdenGame::displayPanel() {
useBank(65);
- drawSprite(0, 0, 16);
- paneltobuf();
+ _graphics->drawSprite(0, 0, 16);
+ _graphics->paneltobuf();
displayLanguage();
displayCursors();
displayTapeCursor();
@@ -5643,8 +5663,8 @@ void EdenGame::displayLanguage() {
useBank(65);
if (_globals->_prefLanguage > 5)
return;
- drawSprite(6, 8, _globals->_prefLanguage * 9 + 43); //TODO: * FONT_HEIGHT
- drawSprite(7, 77, _globals->_prefLanguage * 9 + 44);
+ _graphics->drawSprite(6, 8, _globals->_prefLanguage * 9 + 43); //TODO: * FONT_HEIGHT
+ _graphics->drawSprite(7, 77, _globals->_prefLanguage * 9 + 44);
}
// Original name: affcursvol
@@ -5652,11 +5672,11 @@ void EdenGame::displayVolCursor(int16 x, int16 vol1, int16 vol2) {
int16 slider = 3;
if (_lastMenuItemIdLo && (_lastMenuItemIdLo & 9) != 1) //TODO check me
slider = 4;
- drawSprite(slider, x, 104 - vol1);
+ _graphics->drawSprite(slider, x, 104 - vol1);
slider = 3;
if ((_lastMenuItemIdLo & 9) != 0)
slider = 4;
- drawSprite(slider, x + 12, 104 - vol2);
+ _graphics->drawSprite(slider, x + 12, 104 - vol2);
}
// Original name: affcurseurs
@@ -5681,17 +5701,17 @@ void EdenGame::selectCursor(int itemId) {
// Original name: afftoppano
void EdenGame::displayTopPanel() {
- drawSprite(1, 0, 0);
+ _graphics->drawSprite(1, 0, 0);
}
// Original name: affresult
void EdenGame::displayResult() {
- restoreUnderSubtitles();
+ _graphics->restoreUnderSubtitles();
_globals->_characterPtr = &_persons[19];
_globals->_dialogType = DialogType::dtInspect;
int16 num = (_persons[PER_UNKN_156]._id << 3) | _globals->_dialogType;
if (dialoscansvmas((Dialog *)getElem(_gameDialogs, num)))
- displaySubtitles();
+ _graphics->displaySubtitles();
_globals->_varCA = 0;
_globals->_dialogType = DialogType::dtTalk;
_globals->_characterPtr = nullptr;
@@ -7137,14 +7157,7 @@ void EdenGame::loadMap(int file_id, byte *buffer) {
if (_vm->getPlatform() == Common::kPlatformMacintosh) {
loadpartoffile(file_id, buffer, 32, 256 * 3);
- for (int i = 0; i < 256; i++) {
- color3_t color;
- color.r = buffer[i * 3] << 8;
- color.g = buffer[i * 3 + 1] << 8;
- color.b = buffer[i * 3 + 2] << 8;
- CLPalette_SetRGBColor(_globalPalette, i, &color);
- }
- CLPalette_Send2Screen(_globalPalette, 0, 256);
+ _graphics->setPaletteColor(buffer);
loadpartoffile(file_id, buffer, 32 + 256 * 3, 0x4000);
} else {
@@ -7391,7 +7404,7 @@ void EdenGame::displayPolygoneMapping(Cube *cubep, CubeFace *face) {
ymin = MIN(r31, ymin);
ymax = MAX(r31, ymax);
drawMappingLine(r20, r30, r26, r31, r19, r18, r25, r24, _lines);
- displayMappingLine(ymin, ymax, _mainView->_bufferPtr, face->_texturePtr);
+ displayMappingLine(ymin, ymax, _graphics->getMainView()->_bufferPtr, face->_texturePtr);
}
// Original name: trace_ligne_mapping
@@ -7454,7 +7467,7 @@ void EdenGame::drawMappingLine(int16 r3, int16 r4, int16 r5, int16 r6, int16 r7,
// Original name: affiche_ligne_mapping
void EdenGame::displayMappingLine(int16 r3, int16 r4, byte *target, byte *texture) {
int16 height = r4 - r3;
- byte *trg_line = _mainView->_bufferPtr + r3 * 640; //TODO: target??
+ byte *trg_line = _graphics->getMainView()->_bufferPtr + r3 * 640; //TODO: target??
int16 *line = &_lines[r3 * 8];
// debug("curs: beg draw %d - %d", r3, r4);
for (int r22 = height; r22; r22--, line += 8, trg_line += 640) {
@@ -7703,17 +7716,17 @@ void EdenGame::renderCube() {
const int xshift = -5; // TODO: temporary fix to decrease left margin
unsigned char *cur = _cursor;
- unsigned char *scr = _mainView->_bufferPtr + _cursorPosX + _scrollPos + xshift + _cursorPosY * _mainView->_pitch;
+ unsigned char *scr = _graphics->getMainView()->_bufferPtr + _cursorPosX + _scrollPos + xshift + _cursorPosY * _graphics->getMainView()->_pitch;
for (int y = 0; y < 40; y++) {
for (int x = 0; x < 40; x++) {
- if (x + _cursorPosX + _scrollPos + xshift < _mainView->_pitch && y + _cursorPosY < _mainView->_height)
+ if (x + _cursorPosX + _scrollPos + xshift < _graphics->getMainView()->_pitch && y + _cursorPosY < _graphics->getMainView()->_height)
if (*cur)
*scr = *cur;
scr++;
cur++;
}
- scr += _mainView->_pitch - 40;
+ scr += _graphics->getMainView()->_pitch - 40;
}
}