mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 20:51:14 +00:00
TITANIC: Flesh out the CPETElement class
This commit is contained in:
parent
fee937c6ef
commit
08a801b112
@ -363,4 +363,16 @@ void CGameObject::setPetArea(PetArea newArea) const {
|
||||
pet->setArea(newArea);
|
||||
}
|
||||
|
||||
bool CGameObject::hasActiveMovie() const {
|
||||
if (_surface && _surface->_movie)
|
||||
return _surface->_movie->isActive();
|
||||
return false;
|
||||
}
|
||||
|
||||
int CGameObject::getMovie19() const {
|
||||
if (_surface && _surface->_movie)
|
||||
return _surface->_movie->proc19();
|
||||
return _field78;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -80,11 +80,6 @@ protected:
|
||||
CString _resource;
|
||||
int _fieldB8;
|
||||
protected:
|
||||
/**
|
||||
* Loads a frame
|
||||
*/
|
||||
void loadFrame(int frameNumber);
|
||||
|
||||
/**
|
||||
* Saves the current position the object is located at
|
||||
*/
|
||||
@ -164,6 +159,18 @@ public:
|
||||
* Set the position of the object
|
||||
*/
|
||||
void setPosition(const Common::Point &newPos);
|
||||
|
||||
/**
|
||||
* Returns true if the object has a currently active movie
|
||||
*/
|
||||
bool hasActiveMovie() const;
|
||||
|
||||
int getMovie19() const;
|
||||
|
||||
/**
|
||||
* Loads a frame
|
||||
*/
|
||||
void loadFrame(int frameNumber);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -20,12 +20,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TITANIC_PET_VAL_BASE_H
|
||||
#define TITANIC_PET_VAL_BASE_H
|
||||
#ifndef TITANIC_pet_element_H
|
||||
#define TITANIC_pet_element_H
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CPetValBase {
|
||||
class CPetElement {
|
||||
protected:
|
||||
int _field4;
|
||||
int _field8;
|
||||
@ -33,7 +33,7 @@ protected:
|
||||
int _field10;
|
||||
int _field14;
|
||||
public:
|
||||
CPetValBase();
|
||||
CPetElement();
|
||||
|
||||
virtual void proc1() {}
|
||||
virtual void proc2() {}
|
||||
@ -58,4 +58,4 @@ public:
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_PET_VAL_BASE_H */
|
||||
#endif /* TITANIC_pet_element_H */
|
||||
|
@ -383,6 +383,7 @@ MODULE_OBJS := \
|
||||
pet_control/pet_control_list_item.o \
|
||||
pet_control/pet_control_list_item2.o \
|
||||
pet_control/pet_conversation_section.o \
|
||||
pet_control/pet_element.o \
|
||||
pet_control/pet_inventory_section.o \
|
||||
pet_control/pet_rooms_section.o \
|
||||
pet_control/pet_remote_section.o \
|
||||
@ -394,7 +395,6 @@ MODULE_OBJS := \
|
||||
pet_control/pet_control_sub10.o \
|
||||
pet_control/pet_control_sub11.o \
|
||||
pet_control/pet_control_sub12.o \
|
||||
pet_control/pet_val_base.o \
|
||||
pet_control/pet_val.o \
|
||||
sound/auto_music_player.o \
|
||||
sound/auto_music_player_base.o \
|
||||
|
@ -25,6 +25,12 @@
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
bool CMovie::isActive() const {
|
||||
return g_vm->_movieList.contains(this);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) {
|
||||
// _aviDecoder.loadFile(name.getString());
|
||||
}
|
||||
@ -79,8 +85,9 @@ void OSMovie::proc18() {
|
||||
warning("TODO: OSMovie::proc18");
|
||||
}
|
||||
|
||||
void OSMovie::proc19() {
|
||||
int OSMovie::proc19() {
|
||||
warning("TODO: OSMovie::proc19");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OSMovie::proc20() {
|
||||
@ -92,10 +99,4 @@ void *OSMovie::proc21() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool OSMovie::isInGlobalList() const {
|
||||
return g_vm->_movieList.contains(this);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -44,9 +44,11 @@ public:
|
||||
virtual void proc16() = 0;
|
||||
virtual void proc17() = 0;
|
||||
virtual void proc18() = 0;
|
||||
virtual void proc19() = 0;
|
||||
virtual int proc19() = 0;
|
||||
virtual void proc20() = 0;
|
||||
virtual void *proc21() = 0;
|
||||
|
||||
bool isActive() const;
|
||||
};
|
||||
|
||||
class OSMovie : public CMovie {
|
||||
@ -72,11 +74,9 @@ public:
|
||||
virtual void proc16();
|
||||
virtual void proc17();
|
||||
virtual void proc18();
|
||||
virtual void proc19();
|
||||
virtual int proc19();
|
||||
virtual void proc20();
|
||||
virtual void *proc21();
|
||||
|
||||
bool isInGlobalList() const;
|
||||
};
|
||||
|
||||
class CGlobalMovies : public List<CMovie> {
|
||||
|
100
engines/titanic/pet_control/pet_element.cpp
Normal file
100
engines/titanic/pet_control/pet_element.cpp
Normal file
@ -0,0 +1,100 @@
|
||||
/* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
#include "titanic/pet_control/pet_element.h"
|
||||
#include "titanic/core/game_object.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
CPetElement::CPetElement() : _mode(MODE_0) {}
|
||||
|
||||
void CPetElement::getBounds(Rect *rect) {
|
||||
if (rect)
|
||||
*rect = Rect();
|
||||
}
|
||||
|
||||
bool CPetElement::proc6(const Common::Point &pt) {
|
||||
bool result = _bounds.contains(pt);
|
||||
if (result)
|
||||
setMode(MODE_1);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CPetElement::proc7(const Common::Point &pt) {
|
||||
bool result = _bounds.contains(pt);
|
||||
if (result)
|
||||
setMode(MODE_0);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CPetElement::contains1(const Common::Point &pt) const {
|
||||
return _bounds.contains(pt);
|
||||
}
|
||||
|
||||
int CPetElement::proc9(const Common::Point &pt) {
|
||||
bool result = _bounds.contains(pt);
|
||||
if (result)
|
||||
setMode(MODE_2);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CPetElement::contains2(const Common::Point &pt) const {
|
||||
return _bounds.contains(pt);
|
||||
}
|
||||
|
||||
void CPetElement::proc11(int val1, int val2) const {
|
||||
CGameObject *gameObject = getObject();
|
||||
|
||||
if (gameObject)
|
||||
gameObject->fn1(val1, val2, 0);
|
||||
}
|
||||
|
||||
void CPetElement::changeStatus(int newStatus) const {
|
||||
CGameObject *gameObject = getObject();
|
||||
|
||||
if (gameObject)
|
||||
gameObject->changeStatus(newStatus);
|
||||
}
|
||||
|
||||
bool CPetElement::hasActiveMovie() const {
|
||||
CGameObject *gameObject = getObject();
|
||||
return gameObject ? gameObject->hasActiveMovie() : false;
|
||||
}
|
||||
|
||||
void CPetElement::loadFrame(int frameNumber) {
|
||||
CGameObject *gameObject = getObject();
|
||||
if (gameObject)
|
||||
gameObject->loadFrame(frameNumber);
|
||||
}
|
||||
|
||||
int CPetElement::proc15() {
|
||||
CGameObject *gameObject = getObject();
|
||||
return gameObject ? gameObject->getMovie19() : 0;
|
||||
}
|
||||
|
||||
void CPetElement::setMode(PetElementMode newMode) {
|
||||
if (newMode >= MODE_0 && newMode <= MODE_2)
|
||||
changeMode(newMode);
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
104
engines/titanic/pet_control/pet_element.h
Normal file
104
engines/titanic/pet_control/pet_element.h
Normal file
@ -0,0 +1,104 @@
|
||||
/* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TITANIC_PET_ELEMENT_H
|
||||
#define TITANIC_PET_ELEMENT_H
|
||||
|
||||
#include "titanic/simple_file.h"
|
||||
#include "titanic/core/link_item.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
enum PetElementMode { MODE_0 = 0, MODE_1 = 1, MODE_2 = 2 };
|
||||
|
||||
class CGameObject;
|
||||
|
||||
class CPetElement {
|
||||
protected:
|
||||
Common::Rect _bounds;
|
||||
PetElementMode _mode;
|
||||
public:
|
||||
CPetElement();
|
||||
virtual ~CPetElement() {}
|
||||
|
||||
virtual void proc1() {}
|
||||
virtual void proc2() {}
|
||||
|
||||
/**
|
||||
* Draw the item
|
||||
*/
|
||||
virtual void draw() {}
|
||||
|
||||
virtual void proc4() {}
|
||||
|
||||
/**
|
||||
* Get the bounds for the element
|
||||
*/
|
||||
virtual void getBounds(Rect *rect);
|
||||
|
||||
virtual bool proc6(const Common::Point &pt);
|
||||
virtual bool proc7(const Common::Point &pt);
|
||||
|
||||
/**
|
||||
* Returns whether the passed point falls inside the item
|
||||
*/
|
||||
virtual bool contains1(const Common::Point &pt) const;
|
||||
|
||||
virtual int proc9(const Common::Point &pt);
|
||||
|
||||
/**
|
||||
* Returns whether the passed point falls inside the item
|
||||
*/
|
||||
virtual bool contains2(const Common::Point &pt) const;
|
||||
|
||||
virtual void proc11(int val1, int val2) const;
|
||||
|
||||
/**
|
||||
* Change the status of the associated object
|
||||
*/
|
||||
virtual void changeStatus(int newStatus) const;
|
||||
|
||||
/**
|
||||
* Returns true if the object associated with the item has an active movie
|
||||
*/
|
||||
virtual bool hasActiveMovie() const;
|
||||
|
||||
/**
|
||||
* Loads a frame
|
||||
*/
|
||||
virtual void loadFrame(int frameNumber);
|
||||
|
||||
virtual int proc15();
|
||||
|
||||
/**
|
||||
* Get the game object associated with this item
|
||||
*/
|
||||
virtual CGameObject *getObject() const { return nullptr; }
|
||||
|
||||
virtual void changeMode(PetElementMode newMode) { _mode = newMode; }
|
||||
|
||||
void setMode(PetElementMode mode);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_PET_ELEMENT_H */
|
@ -46,12 +46,12 @@ void CPetVal::proc5(Rect *rect) {
|
||||
}
|
||||
|
||||
int CPetVal::proc16() {
|
||||
switch (_field14) {
|
||||
case 0:
|
||||
switch (_mode) {
|
||||
case MODE_0:
|
||||
return _field18;
|
||||
case 1:
|
||||
case MODE_1:
|
||||
return _field1C;
|
||||
case 2:
|
||||
case MODE_2:
|
||||
return _field20;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -23,17 +23,17 @@
|
||||
#ifndef TITANIC_PET_VAL_H
|
||||
#define TITANIC_PET_VAL_H
|
||||
|
||||
#include "titanic/pet_control/pet_val_base.h"
|
||||
#include "titanic/pet_control/pet_element.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CPetVal: public CPetValBase {
|
||||
class CPetVal: public CPetElement {
|
||||
protected:
|
||||
int _field18;
|
||||
int _field1C;
|
||||
int _field20;
|
||||
public:
|
||||
CPetVal() : CPetValBase(), _field18(0), _field1C(0), _field20(0) {}
|
||||
CPetVal() : CPetElement(), _field18(0), _field1C(0), _field20(0) {}
|
||||
|
||||
virtual void proc1();
|
||||
virtual void proc2();
|
||||
|
@ -1,76 +0,0 @@
|
||||
/* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
#include "titanic/pet_control/pet_val_base.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
CPetValBase::CPetValBase() : _field4(0), _field8(0), _fieldC(0),
|
||||
_field10(0), _field14(0) {}
|
||||
|
||||
void CPetValBase::proc5(Rect *rect) {
|
||||
if (rect)
|
||||
*rect = Rect();
|
||||
}
|
||||
|
||||
int CPetValBase::proc6() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
int CPetValBase::proc7() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
void CPetValBase::proc8() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
int CPetValBase::proc9() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
void CPetValBase::proc10() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
void CPetValBase::proc11() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
void CPetValBase::proc12() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
void CPetValBase::proc13() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
void CPetValBase::proc14() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
void CPetValBase::proc15() {
|
||||
error("TODO");
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
@ -1,67 +0,0 @@
|
||||
/* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TITANIC_PET_VAL_BASE_H
|
||||
#define TITANIC_PET_VAL_BASE_H
|
||||
|
||||
#include "titanic/simple_file.h"
|
||||
#include "titanic/core/link_item.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CPetValBase {
|
||||
protected:
|
||||
int _field4;
|
||||
int _field8;
|
||||
int _fieldC;
|
||||
int _field10;
|
||||
int _field14;
|
||||
public:
|
||||
CPetValBase();
|
||||
virtual ~CPetValBase() {}
|
||||
|
||||
virtual void proc1() {}
|
||||
virtual void proc2() {}
|
||||
virtual void proc3() {}
|
||||
virtual void proc4() {}
|
||||
|
||||
virtual void proc5(Rect *rect);
|
||||
|
||||
virtual int proc6();
|
||||
virtual int proc7();
|
||||
virtual void proc8();
|
||||
virtual int proc9();
|
||||
virtual void proc10();
|
||||
virtual void proc11();
|
||||
virtual void proc12();
|
||||
virtual void proc13();
|
||||
virtual void proc14();
|
||||
virtual void proc15();
|
||||
|
||||
virtual int proc16() { return 0; }
|
||||
|
||||
virtual void proc17(int v) { _field14 = v; }
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_PET_VAL_BASE_H */
|
Loading…
x
Reference in New Issue
Block a user