mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 12:09:15 +00:00
TITANIC: Implementing more CTelevision code, CGameState movie list
This commit is contained in:
parent
0b37ac1869
commit
7320498409
@ -304,4 +304,20 @@ void CGameObject::fn1(int val1, int val2, int val3) {
|
||||
warning("TODO: CGameObject::fn1");
|
||||
}
|
||||
|
||||
void CGameObject::changeStatus(int newStatus) {
|
||||
if (_frameNumber == -1 && !_resource.empty()) {
|
||||
loadResource(_resource);
|
||||
_resource.clear();
|
||||
}
|
||||
|
||||
CVideoSurface *surface = (newStatus & 4) ? _surface : nullptr;
|
||||
if (_surface) {
|
||||
_surface->proc32(newStatus, surface);
|
||||
|
||||
if (newStatus & 0x10) {
|
||||
getGameManager()->_gameState.addMovie(_surface->_movie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -130,6 +130,11 @@ public:
|
||||
bool checkPoint(const Point &pt, int v0, int v1);
|
||||
|
||||
void fn1(int val1, int val2, int val3);
|
||||
|
||||
/**
|
||||
* Change the object's status
|
||||
*/
|
||||
void changeStatus(int newStatus);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
template<typename T>
|
||||
class List : public CSaveableObject, public Common::List<T *> {
|
||||
public:
|
||||
virtual ~List() { destroyContents(); }
|
||||
|
||||
/**
|
||||
* Save the data for the class to file
|
||||
*/
|
||||
@ -145,6 +147,16 @@ public:
|
||||
Common::List<T *>::push_back(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
bool contains(const T *item) const {
|
||||
for (Common::List<T *>::const_iterator i = Common::List<T *>::begin();
|
||||
i != Common::List<T *>::end(); ++i) {
|
||||
if (*i == item)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -164,7 +164,7 @@ bool CTelevision::handleMessage(CPETDownMsg &msg) {
|
||||
bool CTelevision::handleMessage(CStatusChangeMsg &msg) {
|
||||
if (_isOn) {
|
||||
stopMovie();
|
||||
// TODO:
|
||||
changeStatus(1);
|
||||
}
|
||||
warning("TODO");
|
||||
|
||||
|
@ -27,9 +27,18 @@
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
bool CGameStateList::isViewChanging() const {
|
||||
warning("TODO: CGameStateList::isViewChanging");
|
||||
return false;
|
||||
bool CGameStateMovieList::clear() {
|
||||
for (iterator i = begin(); i != end(); ) {
|
||||
CMovieListItem *listItem = *i;
|
||||
++i;
|
||||
|
||||
if (!g_vm->_movieList.contains(listItem->_item)) {
|
||||
remove(listItem);
|
||||
delete listItem;
|
||||
}
|
||||
}
|
||||
|
||||
return size() > 0;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
@ -98,20 +107,20 @@ void CGameState::enterNode() {
|
||||
|
||||
void CGameState::enterView() {
|
||||
CViewItem *oldView = _gameLocation.getView();
|
||||
CViewItem *newView = _list._view;
|
||||
CViewItem *newView = _movieList._view;
|
||||
oldView->preEnterView(newView);
|
||||
|
||||
_gameManager->_gameView->setView(newView);
|
||||
CRoomItem *oldRoom = oldView->findNode()->findRoom();
|
||||
CRoomItem *newRoom = newView->findNode()->findRoom();
|
||||
_gameManager->playClip(_list._movieClip, oldRoom, newRoom);
|
||||
_gameManager->playClip(_movieList._movieClip, oldRoom, newRoom);
|
||||
|
||||
_gameManager->_sound.preEnterView(newView, newRoom != oldRoom);
|
||||
_gameManager->dec54();
|
||||
oldView->enterView(newView);
|
||||
|
||||
_list._view = nullptr;
|
||||
_list._movieClip = nullptr;
|
||||
_movieList._view = nullptr;
|
||||
_movieList._movieClip = nullptr;
|
||||
}
|
||||
|
||||
void CGameState::triggerLink(CLinkItem *link) {
|
||||
@ -128,8 +137,8 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) {
|
||||
clip = nullptr;
|
||||
|
||||
if (_mode == GSMODE_2) {
|
||||
_list._view = newView;
|
||||
_list._movieClip = clip;
|
||||
_movieList._view = newView;
|
||||
_movieList._movieClip = clip;
|
||||
} else {
|
||||
oldView->preEnterView(newView);
|
||||
_gameManager->_gameView->setView(newView);
|
||||
@ -147,11 +156,16 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) {
|
||||
}
|
||||
|
||||
void CGameState::checkForViewChange() {
|
||||
if (_mode == GSMODE_2 && _list.isViewChanging()) {
|
||||
if (_mode == GSMODE_2 && _movieList.clear()) {
|
||||
setMode(GSMODE_1);
|
||||
if (_list._view)
|
||||
if (_movieList._view)
|
||||
enterView();
|
||||
}
|
||||
}
|
||||
|
||||
void CGameState::addMovie(CMovie *movie) {
|
||||
_movieList.push_back(new CMovieListItem(movie));
|
||||
setMode(GSMODE_2);
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "titanic/core/link_item.h"
|
||||
#include "titanic/simple_file.h"
|
||||
#include "titanic/game_location.h"
|
||||
#include "titanic/movie.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
@ -34,21 +35,25 @@ class CGameManager;
|
||||
|
||||
enum GameStateMode { GSMODE_0 = 0, GSMODE_1 = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 };
|
||||
|
||||
class CGameStateList : public List<ListItem> {
|
||||
PTR_LIST_ITEM(CMovie);
|
||||
class CGameStateMovieList : public List<CMovieListItem> {
|
||||
public:
|
||||
CViewItem *_view;
|
||||
CMovieClip *_movieClip;
|
||||
public:
|
||||
CGameStateList() : List<ListItem>(), _view(nullptr), _movieClip(nullptr) {}
|
||||
CGameStateMovieList() : List<CMovieListItem>(), _view(nullptr), _movieClip(nullptr) {}
|
||||
|
||||
bool isViewChanging() const;
|
||||
/**
|
||||
* Clear the movie list
|
||||
*/
|
||||
bool clear();
|
||||
};
|
||||
|
||||
class CGameState {
|
||||
public:
|
||||
CGameManager *_gameManager;
|
||||
CGameLocation _gameLocation;
|
||||
CGameStateList _list;
|
||||
CGameStateMovieList _movieList;
|
||||
int _field8;
|
||||
int _fieldC;
|
||||
GameStateMode _mode;
|
||||
@ -108,6 +113,11 @@ public:
|
||||
* Check for whether it's time to change the active view
|
||||
*/
|
||||
void checkForViewChange();
|
||||
|
||||
/**
|
||||
* Adds a movie to the movie list
|
||||
*/
|
||||
void addMovie(CMovie *movie);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "titanic/movie.h"
|
||||
#include "titanic/titanic.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
@ -28,7 +29,7 @@ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurfa
|
||||
// _aviDecoder.loadFile(name.getString());
|
||||
}
|
||||
|
||||
void OSMovie::proc8() {
|
||||
void OSMovie::proc8(int v1, CVideoSurface *surface) {
|
||||
warning("TODO: OSMovie::proc8");
|
||||
}
|
||||
|
||||
@ -91,4 +92,10 @@ void *OSMovie::proc21() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool OSMovie::isInGlobalList() const {
|
||||
return g_vm->_movieList.contains(this);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -33,7 +33,7 @@ class CVideoSurface;
|
||||
|
||||
class CMovie : public ListItem {
|
||||
public:
|
||||
virtual void proc8() = 0;
|
||||
virtual void proc8(int v1, CVideoSurface *surface) = 0;
|
||||
virtual void proc9() = 0;
|
||||
virtual void proc10() = 0;
|
||||
virtual void proc11() = 0;
|
||||
@ -56,7 +56,7 @@ private:
|
||||
public:
|
||||
OSMovie(const CResourceKey &name, CVideoSurface *surface);
|
||||
|
||||
virtual void proc8();
|
||||
virtual void proc8(int v1, CVideoSurface *surface);
|
||||
virtual void proc9();
|
||||
virtual void proc10();
|
||||
virtual void proc11();
|
||||
@ -75,6 +75,12 @@ public:
|
||||
virtual void proc19();
|
||||
virtual void proc20();
|
||||
virtual void *proc21();
|
||||
|
||||
bool isInGlobalList() const;
|
||||
};
|
||||
|
||||
class CGlobalMovies : public List<CMovie> {
|
||||
public:
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "titanic/debugger.h"
|
||||
#include "titanic/events.h"
|
||||
#include "titanic/files_manager.h"
|
||||
#include "titanic/movie.h"
|
||||
#include "titanic/screen_manager.h"
|
||||
#include "titanic/main_game_window.h"
|
||||
|
||||
@ -101,6 +102,7 @@ public:
|
||||
OSScreenManager *_screenManager;
|
||||
CMainGameWindow *_window;
|
||||
Common::RandomSource _randomSource;
|
||||
CGlobalMovies _movieList;
|
||||
public:
|
||||
TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
|
||||
virtual ~TitanicEngine();
|
||||
|
@ -299,6 +299,11 @@ void OSVideoSurface::shiftColors() {
|
||||
unlock();
|
||||
}
|
||||
|
||||
void OSVideoSurface::proc32(int v1, CVideoSurface *surface) {
|
||||
if (loadIfReady() && _movie)
|
||||
_movie->proc8(v1, surface);
|
||||
}
|
||||
|
||||
void OSVideoSurface::stopMovie() {
|
||||
if (_movie)
|
||||
_movie->stop();
|
||||
|
@ -57,7 +57,6 @@ protected:
|
||||
CResourceKey _resourceKey;
|
||||
DirectDrawSurface *_ddSurface;
|
||||
Graphics::ManagedSurface *_rawSurface;
|
||||
CMovie *_movie;
|
||||
bool _pendingLoad;
|
||||
void *_field40;
|
||||
int _field44;
|
||||
@ -66,6 +65,7 @@ protected:
|
||||
int _field50;
|
||||
int _lockCount;
|
||||
public:
|
||||
CMovie *_movie;
|
||||
bool _blitFlag;
|
||||
bool _blitStyleFlag;
|
||||
public:
|
||||
@ -139,6 +139,8 @@ public:
|
||||
*/
|
||||
virtual void shiftColors() = 0;
|
||||
|
||||
virtual void proc32(int v1, CVideoSurface *surface) = 0;
|
||||
|
||||
/**
|
||||
* Stops any movie currently attached to the surface
|
||||
*/
|
||||
@ -248,6 +250,8 @@ public:
|
||||
*/
|
||||
virtual void shiftColors();
|
||||
|
||||
virtual void proc32(int v1, CVideoSurface *surface);
|
||||
|
||||
/**
|
||||
* Stops any movie currently attached to the surface
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user