TITANIC: Fixes/renames for files manager

This commit is contained in:
Paul Gilbert 2016-03-20 00:01:40 -04:00
parent 8b5ad45f4a
commit ea54e6244e
10 changed files with 62 additions and 21 deletions

View File

@ -27,7 +27,7 @@
namespace Titanic {
CFilesManager::CFilesManager() : _gameManager(nullptr),
_assetsPath("Assets"), _field0(0), _field14(0),
_assetsPath("Assets"), _field0(0), _drive(-1),
_field18(0), _field1C(0), _field3C(0) {
}
@ -65,12 +65,20 @@ bool CFilesManager::scanForFile(const CString &name) {
return fileExists(fname);
}
void CFilesManager::fn1() {
warning("TODO: CFilesManager::fn1");
void CFilesManager::loadDrive() {
assert(_drive == -1);
resetView();
}
void CFilesManager::debug(CScreenManager *screenManager) {
warning("TODO: CFilesManager::debug");
}
void CFilesManager::resetView() {
if (_gameManager) {
_gameManager->_gameState.setMode(GSMODE_1);
_gameManager->initBounds();
}
}
} // End of namespace Titanic

View File

@ -40,7 +40,7 @@ private:
CString _string1;
CString _string2;
int _field0;
int _field14;
int _drive;
int _field18;
int _field1C;
int _field3C;
@ -65,9 +65,17 @@ public:
*/
bool scanForFile(const CString &name);
void fn1();
/**
* Handles displaying a load drive view if necessary
*/
void loadDrive();
void debug(CScreenManager *screenManager);
/**
* Resets the view being displayed
*/
void resetView();
};
} // End of namespace Titanic

View File

@ -181,8 +181,9 @@ void CGameManager::update() {
// Set the surface bounds
screenManager->setSurfaceBounds(0, _bounds);
// Handle redrawing the view
if (!_bounds.isEmpty()) {
_gameView->proc4(_bounds);
_gameView->draw(_bounds);
_bounds = Common::Rect();
}

View File

@ -67,8 +67,8 @@ void CSTGameView::setView(CViewItem *view) {
_gameWindow->setActiveView(view);
}
void CSTGameView::proc4(const Common::Rect &bounds) {
_gameWindow->fn2();
void CSTGameView::draw(const Common::Rect &bounds) {
_gameWindow->draw();
}
} // End of namespace Titanic

View File

@ -57,7 +57,7 @@ public:
*/
virtual void setView(CViewItem *item) = 0;
virtual void proc4(const Common::Rect &bounds) = 0;
virtual void draw(const Common::Rect &bounds) = 0;
/**
* Creates a surface from a specified resource
@ -76,7 +76,10 @@ public:
*/
virtual void setView(CViewItem *item);
virtual void proc4(const Common::Rect &bounds);
/**
* Handles drawing the view
*/
virtual void draw(const Common::Rect &bounds);
};
} // End of namespace Titanic

View File

@ -53,7 +53,7 @@ void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) {
if (_gameManager->_gameState._mode == GSMODE_1) {
processMessage(&msg);
} else if (!msg.isMouseMsg()) {
g_vm->_filesManager.fn1();
g_vm->_filesManager.loadDrive();
}
}
}

View File

@ -55,7 +55,6 @@ void CMainGameWindow::applicationStarting() {
// Set the video mode
CScreenManager *screenManager = CScreenManager::setCurrent();
screenManager->setMode(640, 480, 16, 1, true);
_inputAllowed = true;
// TODO: Remove initial background and palette
@ -67,6 +66,8 @@ void CMainGameWindow::applicationStarting() {
// Load either a new game or selected existing save
_project->loadGame(saveSlot);
_inputAllowed = true;
_gameManager->_gameState.setMode(GSMODE_1);
// TODO: Cursor/image
@ -109,7 +110,7 @@ void CMainGameWindow::setActiveView(CViewItem *viewItem) {
}
}
void CMainGameWindow::fn2() {
void CMainGameWindow::draw() {
if (_gameManager) {
if (_gameView->_surface) {
CViewItem *view = _gameManager->getView();
@ -128,7 +129,7 @@ void CMainGameWindow::fn2() {
warning("TODO: Stuff");
case GSMODE_5:
g_vm->_filesManager.fn1();
g_vm->_filesManager.debug(scrManager);
break;
default:

View File

@ -74,7 +74,10 @@ public:
*/
void setActiveView(CViewItem *viewItem);
void fn2();
/**
* Main draw method for the window
*/
void draw();
/**
* Called by the event handler when a mouse event has been generated

View File

@ -51,7 +51,7 @@ void CScreenManager::setWindowHandle(int v) {
}
bool CScreenManager::resetWindowHandle(int v) {
proc27();
hideCursor();
return true;
}
@ -79,6 +79,8 @@ OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm),
OSScreenManager::~OSScreenManager() {
destroyFrontAndBackBuffers();
delete _mouseCursor;
delete _textCursor;
}
void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) {
@ -152,8 +154,14 @@ CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) {
void OSScreenManager::proc23() {}
void OSScreenManager::proc24() {}
void OSScreenManager::proc25() {}
void OSScreenManager::showCursor() {}
void OSScreenManager::proc27() {}
void OSScreenManager::showCursor() {
}
void OSScreenManager::hideCursor() {
}
void OSScreenManager::destroyFrontAndBackBuffers() {
delete _frontRenderSurface;
@ -165,7 +173,16 @@ void OSScreenManager::destroyFrontAndBackBuffers() {
}
void OSScreenManager::loadCursors() {
// TODO
if (_mouseCursor) {
hideCursor();
delete _mouseCursor;
}
_mouseCursor = new CMouseCursor();
showCursor();
if (!_textCursor) {
_textCursor = new CTextCursor();
}
}
} // End of namespace Titanic

View File

@ -108,7 +108,7 @@ public:
virtual void proc24() = 0;
virtual void proc25() = 0;
virtual void showCursor() = 0;
virtual void proc27() = 0;
virtual void hideCursor() = 0;
void setSurfaceBounds(int surfaceNum, const Common::Rect &r);
};
@ -177,7 +177,7 @@ public:
virtual void proc24();
virtual void proc25();
virtual void showCursor();
virtual void proc27();
virtual void hideCursor();
};
} // End of namespace Titanic