diff options
-rw-r--r-- | engines/cge2/cge2.cpp | 8 | ||||
-rw-r--r-- | engines/cge2/cge2.h | 7 | ||||
-rw-r--r-- | engines/cge2/general.h | 4 | ||||
-rw-r--r-- | engines/cge2/hero.cpp | 140 | ||||
-rw-r--r-- | engines/cge2/hero.h | 98 | ||||
-rw-r--r-- | engines/cge2/module.mk | 3 | ||||
-rw-r--r-- | engines/cge2/vga13h.h | 3 |
7 files changed, 258 insertions, 5 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index 853f84f25d..cf521907a9 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -32,6 +32,7 @@ #include "cge2/vga13h.h" #include "cge2/sound.h" #include "cge2/text.h" +#include "cge2/hero.h" namespace CGE2 { @@ -44,6 +45,8 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _fx = nullptr; _sound = nullptr; _text = nullptr; + for (int i = 0; i < 2; i++) + _heroTab[i] = nullptr; _quitFlag = false; _bitmapPalette = nullptr; @@ -51,6 +54,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _music = true; _startupMode = 1; _now = 1; + _sex = true; } void CGE2Engine::init() { @@ -60,6 +64,8 @@ void CGE2Engine::init() { _sound = new Sound(this); _midiPlayer = new MusicPlayer(this); _text = new Text(this, "CGE"); + for (int i = 0; i < 2; i++) + _heroTab[i] = new HeroTab(); } void CGE2Engine::deinit() { @@ -70,6 +76,8 @@ void CGE2Engine::deinit() { delete _sound; delete _midiPlayer; delete _text; + for (int i = 0; i < 2; i++) + delete _heroTab[i]; } bool CGE2Engine::hasFeature(EngineFeature f) const { diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index e4426433e4..c0a7d4a3bf 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -42,11 +42,16 @@ class MusicPlayer; class Fx; class Sound; class Text; +struct HeroTab; #define kScrWidth 320 #define kScrHeight 240 #define kMaxFile 128 #define kPathMax 128 +#define kDimMax 8 +#define kWayMax 10 +#define kPocketMax 4 +#define kCaveMax 100 class CGE2Engine : public Engine { public: @@ -75,6 +80,7 @@ public: bool _music; int _startupMode; int _now; + bool _sex; ResourceManager *_resman; Vga *_vga; @@ -83,6 +89,7 @@ public: Fx *_fx; Sound *_sound; Text *_text; + HeroTab *_heroTab[2]; private: void init(); void deinit(); diff --git a/engines/cge2/general.h b/engines/cge2/general.h index a9b7002235..9da00be6cd 100644 --- a/engines/cge2/general.h +++ b/engines/cge2/general.h @@ -60,8 +60,8 @@ public: }; class V2D : public Common::Point { - double trunc(double d) { return (d > 0) ? floor(d) : ceil(d); } - double round(double number) { return number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5); } + static double trunc(double d) { return (d > 0) ? floor(d) : ceil(d); } + static double round(double number) { return number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5); } public: V2D& operator = (const V3D& p3) { double m = Eye._z / (p3._z - Eye._z); diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp new file mode 100644 index 0000000000..8f5c44d776 --- /dev/null +++ b/engines/cge2/hero.cpp @@ -0,0 +1,140 @@ +/* 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. + * + */ + +/* + * This code is based on original Sfinx source code + * Copyright (c) 1994-1997 Janus B. Wisniewski and L.K. Avalon + */ + +#include "cge2/hero.h" + +namespace CGE2 { + +Sprite *Hero::expand(void) { + warning("STUB: Hero::expand()"); + return this; +} + +void Hero::setCurrent(void) { + warning("STUB: Hero::setCurrent()"); +} + +void Hero::hStep(void) { + warning("STUB: Hero::hStep()"); +} + +Sprite *Hero::setContact(void) { + warning("STUB: Hero::setContact()"); + return this; +} + +void Hero::tick(void) { + warning("STUB: Hero::tick()"); +} + +int Hero::distance(V3D pos) { + warning("STUB: Hero::distance()"); + return 0; +} + +int Hero::distance(Sprite *spr) { + warning("STUB: Hero::distance()"); + return 0; +} + +void Hero::turn(Dir d) { + warning("STUB: Hero::turn()"); +} + +void Hero::park(void) { + warning("STUB: Hero::park()"); +} + +bool Hero::lower(Sprite * spr) { + warning("STUB: Hero::lower()"); + return false; +} + +void Hero::reach(int mode) { + warning("STUB: Hero::reach()"); +} + +void Hero::fun(void) { + warning("STUB: Hero::fun()"); +} + +void Hero::operator ++ (void) { + warning("STUB: Hero::operator ++()"); +} + +void Hero::operator -- (void) { + warning("STUB: Hero::operator --()"); +} + +bool Sprite::works(Sprite *spr) { + warning("STUB: Hero::works()"); + return false; +} + +uint32 Hero::len(V2D v) { + warning("STUB: Hero::works()"); + return 0; +} + +bool Hero::findWay(void){ + warning("STUB: Hero::findWay()"); + return false; +} + +int Hero::snap(int p, int q, int grid) { + warning("STUB: Hero::findWay()"); + return 0; +} + +void Hero::walkTo(V3D pos) { + warning("STUB: Hero::walkTo()"); +} + +void Hero::walkTo(Sprite *spr) { + warning("STUB: Hero::walkTo()"); +} + +int Hero::cross(const V2D &a, const V2D &b) { + warning("STUB: Hero::cross()"); + return 0; +} + +int Hero::mapCross(const V2D &a, const V2D &b) { + warning("STUB: Hero::mapCross()"); + return 0; +} + +int Hero::mapCross(const V3D &a, const V3D &b) { + warning("STUB: Hero::mapCross()"); + return 0; +} + +void Hero::setCave(int c) { + warning("STUB: Hero::mapCross()"); +} + +} // End of namespace CGE2 diff --git a/engines/cge2/hero.h b/engines/cge2/hero.h new file mode 100644 index 0000000000..50020dab42 --- /dev/null +++ b/engines/cge2/hero.h @@ -0,0 +1,98 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * 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. + * + */ + +/* + * This code is based on original Sfinx source code + * Copyright (c) 1994-1997 Janus B. Wisniewski and L.K. Avalon + */ + +#ifndef CGE2_HERO_H +#define CGE2_HERO_H + +#include "cge2/cge2.h" +#include "cge2/vga13h.h" +#include "cge2/snail.h" + +namespace CGE2 { + +#define kMaxTry 400 + +class Hero; + +struct HeroTab { + Hero *_ptr; + Sprite *_face; + Sprite *_pocket[kPocketMax + 1]; + int _pocPtr; + V2D _posTab[kCaveMax]; +}; + +class Hero : public Sprite { + int _hig[kDimMax]; + Sprite *_contact; +public: + BitmapPtr _dim[kDimMax]; + V3D _trace[kWayMax]; + enum Dir { kNoDir = -1, kSS, kWW, kNN, kEE } _dir; + int _curDim; + int _tracePtr; + int _reachStart, _reachCycle, _sayStart, _funStart; + int _funDel0, _funDel; + int _maxDist; + bool _ignoreMap; + Hero(void); + void tick(void); + Sprite *expand(void); + Sprite *contract(void) { return this; } + Sprite *setContact(void); + int stepSize(void) { return _ext->_seq[7]._dx; } + int distance(V3D pos); + int distance(Sprite * spr); + void turn(Dir d); + void park(void); + static uint32 len(V2D v); + bool findWay(void); + static int snap(int p, int q, int grid); + void walkTo(V3D pos); + void walkTo(V2D pos) { walkTo(V2D::screenToGround(pos)); } + void walkTo(Sprite *spr); + void say(void) { step(_sayStart); } + void fun(void); + void resetFun(void) { _funDel = _funDel0; } + void hStep(void); + bool lower(Sprite * spr); + int cross(const V2D &a, const V2D &b); + int mapCross(const V2D &a, const V2D &b); + int mapCross(const V3D &a, const V3D &b); + Hero *other(void) { return _vm->_heroTab[!(_ref & 1)]->_ptr;} + Action action(void) { return (Action)(_ref % 10); } + void reach(int mode); + void setCurrent(void); + void setCave(int c); + void operator ++ (void); + void operator -- (void); +}; + + + +} // End of namespace CGE2 + +#endif // CGE2_HERO_H diff --git a/engines/cge2/module.mk b/engines/cge2/module.mk index 4fb9156fce..62ce51ebb6 100644 --- a/engines/cge2/module.mk +++ b/engines/cge2/module.mk @@ -8,7 +8,8 @@ MODULE_OBJS = \ bitmap.o \ sound.o \ cge2_main.o \ - text.o + text.o \ + hero.o # This module can be built as a plugin ifeq ($(ENABLE_CGE2), DYNAMIC_PLUGIN) diff --git a/engines/cge2/vga13h.h b/engines/cge2/vga13h.h index e761c5c35c..b7325d8b9a 100644 --- a/engines/cge2/vga13h.h +++ b/engines/cge2/vga13h.h @@ -83,6 +83,7 @@ public: class Sprite { protected: SprExt *_ext; + CGE2Engine *_vm; public: int _ref; signed char _scene; @@ -149,8 +150,6 @@ public: /*virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode); virtual void tick();*/ void sync(Common::Serializer &s); -private: - CGE2Engine *_vm; }; class Queue { |