aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-05-13 16:47:55 +0200
committeruruk2014-05-13 16:47:55 +0200
commit78429a723863728b2c95f286a1c313cc6f17d010 (patch)
treedccc298cef26f51ac25a18a7fde0a3cf8c82c9dc
parente8148cf1deafc0300ea758ab06e7a95d382c0fc6 (diff)
downloadscummvm-rg350-78429a723863728b2c95f286a1c313cc6f17d010.tar.gz
scummvm-rg350-78429a723863728b2c95f286a1c313cc6f17d010.tar.bz2
scummvm-rg350-78429a723863728b2c95f286a1c313cc6f17d010.zip
CGE2: More revision and stubbing in Sprite.
-rw-r--r--engines/cge2/cge2.cpp2
-rw-r--r--engines/cge2/vga13h.cpp87
-rw-r--r--engines/cge2/vga13h.h34
3 files changed, 49 insertions, 74 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index 0c8318a507..4afafdc807 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -135,7 +135,7 @@ bool CGE2Engine::showTitle(const char *name) {
LB[1] = NULL;
_bitmapPalette = NULL;
- Sprite D(this, LB);
+ Sprite D(this, LB, 2);
D._flags._kill = true;
// D._flags._bDel = true;
warning("STUB: Sprite::showTitle() - Flags changed compared to CGE1's Sprite type.");
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp
index 79c4861b4a..47b0d6fa0f 100644
--- a/engines/cge2/vga13h.cpp
+++ b/engines/cge2/vga13h.cpp
@@ -56,41 +56,33 @@ Seq *getConstantSeq(bool seqFlag) {
return seq;
}
+void(*Sprite::notify) (void) = nullptr;
+
byte Sprite::_constY = 0;
byte Sprite::_follow = 0;
Sprite::Sprite(CGE2Engine *vm)
- : _siz(_vm, 0, 0), _nearPtr(0), _takePtr(0),
- _next(NULL), _prev(NULL), _seqPtr(kNoSeq), _time(0),
+ : _siz(_vm, 0, 0), _seqPtr(kNoSeq), _seqCnt(0), _shpCnt(0),
+ _next(NULL), _prev(NULL), _time(0),
_ext(NULL), _ref(-1), _scene(0), _vm(vm),
_pos2D(_vm, kScrWidth >> 1, 0), _pos3D(kScrWidth >> 1, 0, 0) {
memset(_actionCtrl, 0, sizeof(_actionCtrl));
memset(_file, 0, sizeof(_file));
memset(&_flags, 0, sizeof(_flags));
_flags._frnt = 1;
-
- _ref = 0;
- _w = _h = 0;
- _seqPtr = 0;
- _shpCnt = 0;
}
-Sprite::Sprite(CGE2Engine *vm, BitmapPtr *shpP)
- : _siz(_vm, 0, 0), _nearPtr(0), _takePtr(0),
- _next(NULL), _prev(NULL), _seqPtr(kNoSeq), _time(0),
- _ext(NULL), _ref(-1), _scene(0), _vm(vm),
- _pos2D(_vm, kScrWidth >> 1, 0), _pos3D(kScrWidth >> 1, 0, 0) {
+Sprite::Sprite(CGE2Engine *vm, BitmapPtr *shpP, int cnt)
+ : _siz(_vm, 0, 0), _seqPtr(kNoSeq), _seqCnt(0), _shpCnt(0),
+ _next(NULL), _prev(NULL), _time(0),
+ _ext(NULL), _ref(-1), _scene(0), _vm(vm),
+ _pos2D(_vm, kScrWidth >> 1, 0), _pos3D(kScrWidth >> 1, 0, 0) {
memset(_actionCtrl, 0, sizeof(_actionCtrl));
memset(_file, 0, sizeof(_file));
memset(&_flags, 0, sizeof(_flags));
_flags._frnt = 1;
- _ref = 0;
- _w = _h = 0;
- _seqPtr = 0;
- _shpCnt = 0;
-
- setShapeList(shpP);
+ setShapeList(shpP, cnt);
}
Sprite::~Sprite() {
@@ -111,33 +103,8 @@ BitmapPtr Sprite::shp() {
return e->_shpList[i];
}
-BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) {
- BitmapPtr *r = (_ext) ? _ext->_shpList : NULL;
-
- _shpCnt = 0;
- _w = 0;
- _h = 0;
-
- if (shpP) {
- BitmapPtr *p;
- for (p = shpP; *p; p++) {
- BitmapPtr b = (*p); // ->Code();
- if (b->_w > _w)
- _w = b->_w;
- if (b->_h > _h)
- _h = b->_h;
- _shpCnt++;
- }
- expand();
- _ext->_shpList = shpP;
-
- //_flags._bDel = true;
- warning("STUB: Sprite::sync() - Flags changed compared to CGE1's Sprite type.");
-
- if (!_ext->_seq)
- setSeq(getConstantSeq(_shpCnt < 2));
- }
- return r;
+void Sprite::setShapeList(BitmapPtr *shp, int cnt) {
+ warning("STUB: Sprite::setShapeList()");
}
bool Sprite::works(Sprite *spr) {
@@ -492,7 +459,7 @@ void Sprite::gotoxyz(V3D pos) {
}
void Sprite::center() {
- gotoxyz((kScrWidth - _w) / 2, (kScrHeight - _h) / 2);
+ gotoxyz(kScrWidth >> 1, (kWorldHeight - _siz.y) >> 1, 0);
}
void Sprite::show() {
@@ -577,11 +544,7 @@ void Sprite::sync(Common::Serializer &s) {
s.syncAsUint16LE(_pos3D._x);
s.syncAsUint16LE(_pos3D._y);
s.syncAsByte(_pos3D._z);
- s.syncAsUint16LE(_w);
- s.syncAsUint16LE(_h);
s.syncAsUint16LE(_time);
- s.syncAsByte(_nearPtr);
- s.syncAsByte(_takePtr);
s.syncAsSint16LE(_seqPtr);
s.syncAsUint16LE(_shpCnt);
s.syncBytes((byte *)&_file[0], 9);
@@ -1019,35 +982,41 @@ void Bitmap::hide(int16 x, int16 y) {
/*--------------------------------------------------------------------------*/
-HorizLine::HorizLine(CGE2Engine *vm) : Sprite(vm, NULL), _vm(vm) {
+HorizLine::HorizLine(CGE2Engine *vm) : Sprite(vm), _vm(vm) {
// Set the sprite list
BitmapPtr *HL = new BitmapPtr[2];
HL[0] = new Bitmap(_vm, "HLINE");
HL[1] = NULL;
- setShapeList(HL);
+ setShapeList(HL, 1);
+
+ warning("HorizLine::HorizLine() - Recheck this!");
}
-SceneLight::SceneLight(CGE2Engine *vm) : Sprite(vm, NULL), _vm(vm) {
+SceneLight::SceneLight(CGE2Engine *vm) : Sprite(vm), _vm(vm) {
// Set the sprite list
BitmapPtr *PR = new BitmapPtr[2];
PR[0] = new Bitmap(_vm, "PRESS");
PR[1] = NULL;
- setShapeList(PR);
+ setShapeList(PR, 1);
+
+ warning("SceneLight::SceneLight() - Recheck this!");
}
-Speaker::Speaker(CGE2Engine *vm): Sprite(vm, NULL), _vm(vm) {
+Speaker::Speaker(CGE2Engine *vm): Sprite(vm), _vm(vm) {
// Set the sprite list
BitmapPtr *SP = new BitmapPtr[3];
SP[0] = new Bitmap(_vm, "SPK_L");
SP[1] = new Bitmap(_vm, "SPK_R");
SP[2] = NULL;
- setShapeList(SP);
+ setShapeList(SP, 2);
+
+ warning("Speaker::Speaker() - Recheck this!");
}
-PocLight::PocLight(CGE2Engine *vm): Sprite(vm, NULL), _vm(vm) {
+PocLight::PocLight(CGE2Engine *vm): Sprite(vm), _vm(vm) {
// Set the sprite list
BitmapPtr *LI = new BitmapPtr[5];
LI[0] = new Bitmap(_vm, "LITE0");
@@ -1056,9 +1025,11 @@ PocLight::PocLight(CGE2Engine *vm): Sprite(vm, NULL), _vm(vm) {
LI[3] = new Bitmap(_vm, "LITE3");
LI[4] = NULL;
- setShapeList(LI);
+ setShapeList(LI, 4);
_flags._kill = false;
+
+ warning("PocLight::PocLight() - Recheck this!");
}
} // End of namespace CGE2
diff --git a/engines/cge2/vga13h.h b/engines/cge2/vga13h.h
index d2fb198470..437cba05f1 100644
--- a/engines/cge2/vga13h.h
+++ b/engines/cge2/vga13h.h
@@ -100,20 +100,18 @@ public:
uint16 _zmov : 1; // sprite needs Z-update in queue
uint16 _tran : 1; // transparent (untouchable)
} _flags;
- uint16 _w;
- uint16 _h;
+ V2D _pos2D;
+ V3D _pos3D;
+ V2D _siz;
uint16 _time;
- uint8 _nearPtr;
- uint8 _takePtr;
+ struct { byte _ptr, _cnt; } _actionCtrl[kActions];
int _seqPtr;
+ int _seqCnt;
int _shpCnt;
char _file[kMaxFile];
+ // Following trailer is not saved with the game:
Sprite *_prev;
Sprite *_next;
- struct { byte _ptr, _cnt; } _actionCtrl[kActions];
- V2D _pos2D;
- V3D _pos3D;
- V2D _siz;
static byte _constY;
static byte _follow;
@@ -122,12 +120,14 @@ public:
inline bool active() {
return _ext != NULL;
}
-
Sprite(CGE2Engine *vm);
- Sprite(CGE2Engine *vm, BitmapPtr *shp);
+ Sprite(CGE2Engine *vm, BitmapPtr *shp, int cnt);
virtual ~Sprite();
BitmapPtr shp();
- BitmapPtr *setShapeList(BitmapPtr *shp);
+ void setShapeList(BitmapPtr *shp, int cnt);
+ void moveShapesHi(void);
+ void moveShapesLo(void);
+ int LabVal(Action snq, int lab);
Sprite *expand();
Sprite *contract();
Sprite *backShow(bool fast = false);
@@ -141,18 +141,22 @@ public:
void gotoxyz_(V2D pos);
void gotoxyz(V3D pos);
void center();
+ void show(uint16 pg);
+ void hide(uint16 pg);
void show();
void hide();
BitmapPtr ghost();
- void show(uint16 pg);
void makeXlat(uint8 *x);
void killXlat();
void step(int nr = -1);
Seq *setSeq(Seq *seq);
- //CommandHandler::Command *snList(SnList type);
- /*virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode);
- virtual void tick();*/
+ CommandHandler::Command *snList(Action type);
+ //virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode);
+ //virtual void tick();
+ void clrHide(void) { if (_ext) _ext->_b0 = NULL; }
void sync(Common::Serializer &s);
+
+ static void (*notify) (void);
};
class Queue {