diff options
author | uruk | 2014-05-09 13:11:50 +0200 |
---|---|---|
committer | uruk | 2014-05-09 13:11:50 +0200 |
commit | cb6548919712d91ae4cfbdefd20f6f0f147ced6c (patch) | |
tree | 18bc05eeac6b41c01e156311e20475886649cb24 | |
parent | b674ab2a09bec35b27583d8c463d137ded285e52 (diff) | |
download | scummvm-rg350-cb6548919712d91ae4cfbdefd20f6f0f147ced6c.tar.gz scummvm-rg350-cb6548919712d91ae4cfbdefd20f6f0f147ced6c.tar.bz2 scummvm-rg350-cb6548919712d91ae4cfbdefd20f6f0f147ced6c.zip |
CGE2: Implement CGE2Engine::loadSprite().
Add Snail during the process and revise or expand a lot of other parts of the engine.
-rw-r--r-- | engines/cge2/cge2.cpp | 3 | ||||
-rw-r--r-- | engines/cge2/cge2.h | 1 | ||||
-rw-r--r-- | engines/cge2/cge2_main.cpp | 139 | ||||
-rw-r--r-- | engines/cge2/cge2_main.h | 3 | ||||
-rw-r--r-- | engines/cge2/fileio.cpp | 20 | ||||
-rw-r--r-- | engines/cge2/fileio.h | 4 | ||||
-rw-r--r-- | engines/cge2/hero.cpp | 9 | ||||
-rw-r--r-- | engines/cge2/hero.h | 2 | ||||
-rw-r--r-- | engines/cge2/module.mk | 3 | ||||
-rw-r--r-- | engines/cge2/snail.cpp | 60 | ||||
-rw-r--r-- | engines/cge2/snail.h | 85 | ||||
-rw-r--r-- | engines/cge2/vga13h.cpp | 71 | ||||
-rw-r--r-- | engines/cge2/vga13h.h | 18 |
13 files changed, 359 insertions, 59 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index cf521907a9..c3ec6a92eb 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -126,7 +126,8 @@ bool CGE2Engine::showTitle(const char *name) { Sprite D(this, LB); D._flags._kill = true; - D._flags._bDel = true; + // D._flags._bDel = true; + warning("STUB: Sprite::showTitle() - Flags changed compared to CGE1's Sprite type."); D.center(); D.show(2); diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index c0a7d4a3bf..79ac2c7488 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -71,6 +71,7 @@ public: void runGame(); void loadScript(const char *fname); void loadSprite(const char *fname, int ref, int scene, V3D &pos); + void badLab(const char *fn); const ADGameDescription *_gameDescription; diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 117385adf0..23fe4cbfa9 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -35,20 +35,25 @@ namespace CGE2 { +void CGE2Engine::badLab(const char *fn) { + error("Misplaced label in %s!", fn); +} + void CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos) { int shpcnt = 0; int seqcnt = 0; int cnt[kActions]; for (int i = 0; i < kActions; i++) cnt[i] = 0; - int section = kIdPhase; + ID section = kIdPhase; bool frnt = true; bool east = false; bool port = false; bool tran = false; Hero *h; + ID id; - char tmpStr[kLineMax]; + char tmpStr[kLineMax + 1]; mergeExt(tmpStr, fname, kSprExt); if (_resman->exist(tmpStr)) { // sprite description file exist @@ -56,9 +61,137 @@ void CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos) { if (sprf.err()) error("Bad SPR [%s]", tmpStr); + int label = kNoByte; + Common::String line; + + for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()){ + int len = line.size(); + if (len == 0 || *tmpStr == ';') + continue; + + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); + + char *p; + p = EncryptedStream::token(tmpStr); + if (*p == '@') { + if (label != kNoByte) + badLab(fname); + label = atoi(p + 1); + continue; + } + + id = EncryptedStream::ident(p); + switch (id) { + case kIdName: // will be taken in Expand routine + if (label != kNoByte) + badLab(fname); + break; + case kIdType: + if (label != kNoByte) + badLab(fname); + break; + case kIdNear: + case kIdMTake: + case kIdFTake: + case kIdPhase: + case kIdSeq: + if (label != kNoByte) + badLab(fname); + section = id; + break; + case kIdFront: + if (label != kNoByte) + badLab(fname); + p = EncryptedStream::token(nullptr); + frnt = EncryptedStream::testBool(p); + break; + case kIdEast: + if (label != kNoByte) + badLab(fname); + p = EncryptedStream::token(nullptr); + east = EncryptedStream::testBool(p); + break; + case kIdPortable: + if (label != kNoByte) + badLab(fname); + p = EncryptedStream::token(nullptr); + port = EncryptedStream::testBool(p); + break; + case kIdTransparent: + if (label != kNoByte) + badLab(fname); + p = EncryptedStream::token(nullptr); + tran = EncryptedStream::testBool(p); + break; + default: + if (id >= kIdNear) + break; + switch (section) { + case kIdNear: + case kIdMTake: + case kIdFTake: + if (Snail::com(p) >= 0) + ++cnt[section]; + else + error("Bad line %d [%s]", sprf.getLineCount(), tmpStr); + break; + case kIdPhase: + if (label != kNoByte) + badLab(fname); + ++shpcnt; + break; + case kIdSeq: + if (label != kNoByte) + badLab(fname); + ++seqcnt; + break; + } + break; + } + label = kNoByte; + } + + if (!shpcnt) { + error("No shapes - %s", fname); + } + } else // No sprite description: mono-shaped sprite with only .BMP file. + ++shpcnt; + + // Make sprite of choosen type: + char c = *fname | 0x20; + if (c >= 'a' && c <= 'z' && fname[1] == '0' && fname[2] == '\0') { + h = new Hero(this); + if (h) { + h->gotoxyz(pos); + _sprite = h; + } + } else { + if (_sprite) + delete _sprite; + _sprite = new Sprite(this); + if (_sprite) + _sprite->gotoxyz(pos); } - warning("STUB: CGE2Engine::loadSprite()"); + if (_sprite) { + _sprite->_flags._frnt = frnt; + _sprite->_flags._east = east; + _sprite->_flags._port = port; + _sprite->_flags._tran = tran; + _sprite->_flags._kill = true; + + // Extract the filename, without the extension + Common::strlcpy(_sprite->_file, fname, sizeof(_sprite->_file)); + char *p = strchr(_sprite->_file, '.'); + if (p) + *p = '\0'; + + _sprite->_shpCnt = shpcnt; + _sprite->_seqPtr = seqcnt; + + for (int i = 0; i < kActions; i++) + _sprite->_actionCtrl[i]._cnt = cnt[i]; + } } void CGE2Engine::loadScript(const char *fname) { diff --git a/engines/cge2/cge2_main.h b/engines/cge2/cge2_main.h index a1fb071b69..8420a2d1db 100644 --- a/engines/cge2/cge2_main.h +++ b/engines/cge2/cge2_main.h @@ -30,8 +30,9 @@ namespace CGE2 { -#define kLineMax 512 +#define kLineMax 512 #define kIntroExt ".I80" +#define kNoByte -1 } // End of namespace CGE2 diff --git a/engines/cge2/fileio.cpp b/engines/cge2/fileio.cpp index 91a9954e94..6a20b6b561 100644 --- a/engines/cge2/fileio.cpp +++ b/engines/cge2/fileio.cpp @@ -245,15 +245,23 @@ char *EncryptedStream::token(char *s) { return strtok(s, " =\t,;/()"); } -ID EncryptedStream::ident(const char *s) { - if (s) { - for (const char **e = kIdTab; *e; e++) { - if (scumm_stricmp(s, *e) == 0) { - return ID(e - kIdTab); +int EncryptedStream::takeEnum(const char **tab, const char *text) { + if (text) { + for (const char **e = tab; *e; e++) { + if (scumm_stricmp(text, *e) == 0) { + return e - tab; } } } - return kIdNone; + return -1; +} + +ID EncryptedStream::ident(const char *s) { + return ID(takeEnum(kIdTab, s)); +} + +bool EncryptedStream::testBool(char *s) { + return number(s) != 0; } int32 EncryptedStream::size() { diff --git a/engines/cge2/fileio.h b/engines/cge2/fileio.h index fdf1b8325e..758d841226 100644 --- a/engines/cge2/fileio.h +++ b/engines/cge2/fileio.h @@ -49,7 +49,7 @@ enum ID { kIdNear, kIdMTake, kIdFTake, kIdPhase, kIdSeq, kIdName, kIdType, kIdFront, kIdEast, kIdPortable, kIdTransparent, - kIdNone + kIdNone = -1 }; struct BtKeypack { @@ -126,7 +126,9 @@ public: Common::String readLine(); static int number(char *s); static char *token(char *s); + static int takeEnum(const char **tab, const char *text); static ID ident(const char *s); + static bool testBool(char *s); int getLineCount() { return _lineCount; } }; diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp index 8f5c44d776..44ff85040d 100644 --- a/engines/cge2/hero.cpp +++ b/engines/cge2/hero.cpp @@ -29,6 +29,10 @@ namespace CGE2 { +Hero::Hero(CGE2Engine *vm) : Sprite(vm) { + warning("STUB: Hero::Hero()"); +} + Sprite *Hero::expand(void) { warning("STUB: Hero::expand()"); return this; @@ -90,11 +94,6 @@ 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; diff --git a/engines/cge2/hero.h b/engines/cge2/hero.h index 893c36b189..21f4ec39e7 100644 --- a/engines/cge2/hero.h +++ b/engines/cge2/hero.h @@ -58,7 +58,7 @@ public: int _funDel0, _funDel; int _maxDist; bool _ignoreMap; - Hero(void); + Hero(CGE2Engine *vm); void tick(void); Sprite *expand(void); Sprite *contract(void) { return this; } diff --git a/engines/cge2/module.mk b/engines/cge2/module.mk index 62ce51ebb6..4a7a412152 100644 --- a/engines/cge2/module.mk +++ b/engines/cge2/module.mk @@ -9,7 +9,8 @@ MODULE_OBJS = \ sound.o \ cge2_main.o \ text.o \ - hero.o + hero.o \ + snail.o # This module can be built as a plugin ifeq ($(ENABLE_CGE2), DYNAMIC_PLUGIN) diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp new file mode 100644 index 0000000000..245da9972a --- /dev/null +++ b/engines/cge2/snail.cpp @@ -0,0 +1,60 @@ +/* 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/snail.h" +#include "cge2/fileio.h" + +namespace CGE2 { + +const char *Snail::comTxt[] = { + "NOP", "USE", "PAUSE", "INF", "CAVE", + "SLAVE", "FOCUS", "SETX", "SETY", "SETZ", + "ADD", "SUB", "MUL", "DIV", "IF", "FLAG", + "FLASH", "LIGHT", "CYCLE", + "CLEAR", "TALK", "MOUSE", + "MAP", "COUNT", "MIDI", + "SETDLG", "MSKDLG", + ".DUMMY.", + "WAIT", "HIDE", "ROOM", + "SAY", "SOUND", "TIME", "KILL", + "RSEQ", "SEQ", "SEND", "SWAP", + "KEEP", "GIVE", + "GETPOS", "GOTO", "MOVEX", "MOVEY", + "MOVEZ", "TRANS", "PORT", + "NEXT", "NNEXT", "MTNEXT", "FTNEXT", + "RNNEXT", "RMTNEXT", "RFTNEXT", + "RMNEAR", "RMMTAKE", "RMFTAKE", + "SETREF", "BACKPT", + "WALKTO", "REACH", "COVER", "UNCOVER", + NULL }; + +int Snail::com(const char *com) { + int i = EncryptedStream::takeEnum(comTxt, com); + return (i < 0) ? i : i + kSNCom0 + 1; +} + +} // End of namespace CGE2. diff --git a/engines/cge2/snail.h b/engines/cge2/snail.h index cc60882962..5cdb22150f 100644 --- a/engines/cge2/snail.h +++ b/engines/cge2/snail.h @@ -28,10 +28,95 @@ #ifndef CGE2_SNAIL_H #define CGE2_SNAIL_H +#include "cge2/cge2_main.h" + namespace CGE2 { enum Action { kNear, kMTake, kFTake, kActions }; +enum SNCom { + kSNCom0 = 128, + kSNNop, // NOP instrukcja "pusta" :: do nothing + kSNUse, // USE <spr> <cav>|<lab> hint for using + kSNPause, // PAUSE -1 <dly> oczekiwanie <dly>/72 sekund :: delay <dly>/72 seconds + kSNInf, // INF -1 <ref> prezentacja tekstu o numerze <ref> :: show text referrenced by <ref> + kSNCave, // CAVE -1 <cav> przejście na planszę <cav> :: go to board <cav> + kSNSlave, // SLAVE + kSNFocus, // FOCUS zmiana aktywnego bohatera (-1 cyklicznie) :: change active hero + kSNSetX, // SETX <x> <idx> ustawienie przesunięcia sprajtu :: set sprite shift in x axis + kSNSetY, // SETX <y> <idx> ustawienie przesunięcia sprajtu :: set sprite shift in y axis + kSNSetZ, // SETX <z> <idx> ustawienie przesunięcia sprajtu :: set sprite shift in z axis + kSNAdd, // ADD <idx1> <idx2> suma dwóch wektorów :: sum vectors + kSNSub, // SUB <idx1> <idx2> różnica dwóch wektorów :: subtract vectors + kSNMul, // MUL <idx> <nr> iloczyn wektora przez liczbę :: multiply vector by number + kSNDiv, // DIV <idx> <nr> iloraz wektora przez liczbę :: divide vector by number + kSNIf, // IF + kSNFlag, // FLAG <nr> <val> nadanie wartości znacznikowi <nr> :: set flag <nr> to <val> + kSNFlash, // FLASH -1 0|1 rozjaśnienie całego obrazu (tak/nie) :: lighten whole image (on/off) + kSNLight, // LIGHT + kSNCycle, // CYCLE <cnt> cykliczne przesuwanie <cnt> kolorow od 1 :: rotate <cnt> colors from 1 + kSNClear, // CLEAR -1 0 wyzerowanie kolejki kSNAIL :: clear kSNAIL queue + kSNTalk, // TALK -1 0|1 zezwolenie na dialogi (tak/nie) :: enable speach (on/off) + kSNMouse, // MOUSE -1 0|1 zezwolenie na mysz (tak/nie) :: enable mouse (on/off) + kSNMap, // MAP 0|1 0 chwilowe wylaczenie mapy dla bohatera :: temporarily turn off map for hero + kSNCount, // COUNT + kSNMidi, // MIDI -1 <midi> muzyka MIDI nr <midi> (-1 = cisza) :: play MIDI referenced by <midi> (-1 = off) + kSNSetDlg, // SETDLG 0..3 0..3 przelaczenie trybu mowy :: switch of speach mode + kSNMskDlg, // MSKDLG 0..3 0..3 przelaczenie maski trybu mowy :: switch of speach mode mask + + kSNSpr, + + kSNWait, // WAIT <spr> <seq>|-1 oczekiwanie na SEQ <seq> (-1 = stoi) :: wait for SEQ <seq> (-1 = freeze) + kSNHide, // HIDE <spr> 0|1 widzialność sprajtu :: visibility of sprite + kSNRoom, // ROOM <hero> 0|1 dodatkowe miejsce w kieszeni (nie/tak) :: additional room in pocket (no/yes) + kSNSay, // SAY <spr> <ref> wygłoszenie tekstu o numerze <ref> :: say text referenced by <ref> + kSNSound, // SOUND <spr> <ref> wyemitowanie efektu <ref> :: play sound effect referenced by <ref> + kSNTime, // TIME <spr> 0 wygłoszenie bieżącego czasu :: say current time + kSNKill, // KILL <spr> 0 usunięcie sprajtu :: remove sprite + kSNRSeq, // RSEQ <spr> <nr> względny skok SEQ o <nr> :: relative jump SEQ <nr> lines + kSNSeq, // SEQ <spr> <seq> skok do SEQ <seq> :: jump to certain SEQ + kSNSend, // SEND <spr> <cav> przeniesienie sprajtu na planszę <cav> :: move sprite to board <cav> + kSNSwap, // SWAP <spr1> spr2> zamiana sprajtów :: sprite exchange + kSNKeep, // KEEP <spr> <seq> sprajt do kieszeni ze skokiem do <seq> :: take sprite into pocket and jump to <seq> + kSNGive, // GIVE <spr> <seq> sprajt z kieszeni ze skokiem do <seq> :: remove sprite from pocket and jump to <seq> + kSNGetPos, // GETPOS <spr> <idx> pobranie pozycji sprajtu :: take sprite's position + kSNGoto, // GOTO <spr> <idx> przesunięcie sprajtu na dana pozycje :: move sprite to position + kSNMoveX, // MOVEX <spr> <dx> przesunięcie względne po osi X :: relative move along X axis + kSNMoveY, // MOVEY <spr> <dy> przesunięcie względne po osi Y :: relative move along Y axis + kSNMoveZ, // MOVEZ <spr> <dz> przesunięcie względne po osi Z :: relative move along Z axis + kSNTrans, // TRANS <spr> 0|1 ustalenie przezroczystości logicznej :: clear/set logical transparency + kSNPort, // PORT <spr> 0|1 ustalenie "bralności" sprajtu :: clear/set "takeability" of sprite + kSNNext, // NEXT <spr> <nr> skok do <nr> - NEAR lub TAKE :: jump to <nr> - NEAR or TAKE + kSNNNext, // NNEXT <spr> <nr> skok do <nr> - NEAR :: jump to <nr> - NEAR + kSNMTNext, // MTNEXT <spr> <nr> skok do <nr> - TAKE :: jump to <nr> - TAKE + kSNFTNext, // FTNEXT <spr> <nr> skok do <nr> - TAKE :: jump to <nr> - TAKE + kSNRNNext, // RNNEXT <spr> <nr> skok względny do <nr> - NEAR :: relative jump to <nr> - NEAR + kSNRMTNext, // RMTNEXT <spr> <nr> skok względny do <nr> - TAKE :: relative jump to <nr> - TAKE + kSNRFTNext, // RFTNEXT <spr> <nr> skok względny do <nr> - TAKE :: relative jump to <nr> - TAKE + kSNRMNear, // RMNEAR <spr> 0 usunięcie listy NEAR :: remove NEAR list + kSNRMMTake, // RMMTAKE <spr> 0 usunięcie listy TAKE :: remove TAKE list + kSNRMFTake, // RMFTAKE <spr> 0 usunięcie listy TAKE :: remove TAKE list + kSNSetRef, // RETREF <spr> <ref> zmiana numeru <ref> sprajta <spr> :: change reference of sprite <spr> to <ref> + kSNBackPt, // BACKPT <spr> 0 wmalowanie sprajtu w tło :: paint sprite onto the background + kSNWalk, // WALK <hero> <ref>|<point> podejdż do sprajtu lub punktu :: go close to the sprite or point + kSNReach, // REACH <hero> <ref>|<m> sięgnij do <ref> lub sposobem <m> :: reach the sprite or point with <m> method + kSNCover, // COVER <sp1> <sp2> przykrycie sprajtu <sp1> sprajtem <sp2> :: cover sprite <sp1> with sprite <sp2> + kSNUncover, // UNCOVER <sp1> <sp2> odtworzenie sytuacji sprzed COVER :: restore the state before COVER + + kSNDim, + kSNExec, + kSNStep, + kSNGhost, + + kSNNOne = kNoByte +}; + +class Snail { + static const char *comTxt[]; +public: + static int com(const char *com); +}; + } // End of namespace CGE2 #endif diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 26fba8bfd8..1d757ff63f 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -56,6 +56,10 @@ Seq *getConstantSeq(bool seqFlag) { return seq; } +Sprite::Sprite(CGE2Engine *vm) { + warning("STUB: Sprite::Sprite()"); +} + Sprite::Sprite(CGE2Engine *vm, BitmapPtr *shpP) : _x(0), _y(0), _z(0), _nearPtr(0), _takePtr(0), _next(NULL), _prev(NULL), _seqPtr(kNoSeq), _time(0), @@ -74,10 +78,7 @@ Sprite::Sprite(CGE2Engine *vm, BitmapPtr *shpP) } Sprite::~Sprite() { - if (_vm->_sprite == this) - _vm->_sprite = NULL; - - contract(); + warning("STUB: Sprite::~Sprite()"); } BitmapPtr Sprite::shp() { @@ -110,7 +111,10 @@ BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) { } expand(); _ext->_shpList = shpP; - _flags._bDel = true; + + //_flags._bDel = true; + warning("STUB: Sprite::sync() - Flags changed compared to CGE1's Sprite type."); + if (!_ext->_seq) setSeq(getConstantSeq(_shpCnt < 2)); } @@ -371,7 +375,7 @@ void Sprite::step(int nr) { _seqPtr = _ext->_seq[_seqPtr]._next; seq = _ext->_seq + _seqPtr; if (seq->_dly >= 0) { - gotoxy(_x + (seq->_dx), _y + (seq->_dy)); + gotoxyz(_x + (seq->_dx), _y + (seq->_dy)); _time = seq->_dly; } } @@ -404,31 +408,28 @@ void Sprite::killXlat() { _flags._xlat = false; } -void Sprite::gotoxy(int x, int y) { - int xo = _x, yo = _y; - if (_x < kScrWidth) { - if (x < 0) - x = 0; - if (x + _w > kScrWidth) - x = (kScrWidth - _w); - _x = x; - } - if (_h < kScrHeight) { - if (y < 0) - y = 0; - if (y + _h > kScrHeight) - y = (kScrHeight - _h); - _y = y; - } - if (_next) - if (_next->_flags._slav) - _next->gotoxy(_next->_x - xo + _x, _next->_y - yo + _y); - if (_flags._shad) - _prev->gotoxy(_prev->_x - xo + _x, _prev->_y - yo + _y); +void Sprite::gotoxyz(int x, int y, int z) { + warning("STUB: Sprite::gotoxyz()"); +} + +void Sprite::gotoxyz(void) { + warning("STUB: Sprite::gotoxyz()"); +} + +void Sprite::gotoxyz(V2D pos) { + warning("STUB: Sprite::gotoxyz()"); +} + +void Sprite::gotoxyz_(V2D pos) { + warning("STUB: Sprite::gotoxyz()"); +} + +void Sprite::gotoxyz(V3D pos) { + warning("STUB: Sprite::gotoxyz()"); } void Sprite::center() { - gotoxy((kScrWidth - _w) / 2, (kScrHeight - _h) / 2); + gotoxyz((kScrWidth - _w) / 2, (kScrHeight - _h) / 2); } void Sprite::show() { @@ -494,9 +495,9 @@ void Sprite::sync(Common::Serializer &s) { _flags._near = flags & 0x0002 ? true : false; _flags._drag = flags & 0x0004 ? true : false; _flags._hold = flags & 0x0008 ? true : false; - _flags._dummy = flags & 0x0010 ? true : false; + //_flags._dummy = flags & 0x0010 ? true : false; _flags._slav = flags & 0x0020 ? true : false; - _flags._syst = flags & 0x0040 ? true : false; + //_flags._syst = flags & 0x0040 ? true : false; _flags._kill = flags & 0x0080 ? true : false; _flags._xlat = flags & 0x0100 ? true : false; _flags._port = flags & 0x0200 ? true : false; @@ -504,11 +505,11 @@ void Sprite::sync(Common::Serializer &s) { _flags._east = flags & 0x0800 ? true : false; _flags._shad = flags & 0x1000 ? true : false; _flags._back = flags & 0x2000 ? true : false; - _flags._bDel = flags & 0x4000 ? true : false; + //_flags._bDel = flags & 0x4000 ? true : false; _flags._tran = flags & 0x8000 ? true : false; } else { flags = (flags << 1) | _flags._tran; - flags = (flags << 1) | _flags._bDel; + //flags = (flags << 1) | _flags._bDel; flags = (flags << 1) | _flags._back; flags = (flags << 1) | _flags._shad; flags = (flags << 1) | _flags._east; @@ -516,9 +517,9 @@ void Sprite::sync(Common::Serializer &s) { flags = (flags << 1) | _flags._port; flags = (flags << 1) | _flags._xlat; flags = (flags << 1) | _flags._kill; - flags = (flags << 1) | _flags._syst; + //flags = (flags << 1) | _flags._syst; flags = (flags << 1) | _flags._slav; - flags = (flags << 1) | _flags._dummy; + //flags = (flags << 1) | _flags._dummy; flags = (flags << 1) | _flags._hold; flags = (flags << 1) | _flags._drag; flags = (flags << 1) | _flags._near; @@ -526,6 +527,8 @@ void Sprite::sync(Common::Serializer &s) { s.syncAsUint16LE(flags); } + warning("STUB: Sprite::sync() - Flags changed compared to CGE1's Sprite type."); + s.syncAsUint16LE(_x); s.syncAsUint16LE(_y); s.syncAsByte(_z); diff --git a/engines/cge2/vga13h.h b/engines/cge2/vga13h.h index b7325d8b9a..8061acf411 100644 --- a/engines/cge2/vga13h.h +++ b/engines/cge2/vga13h.h @@ -33,7 +33,7 @@ #include "graphics/surface.h" #include "cge2/general.h" #include "cge2/bitmap.h" -//#include "cge/snail.h" +#include "cge2/snail.h" #include "cge2/cge2.h" namespace CGE2 { @@ -89,20 +89,20 @@ public: signed char _scene; struct Flags { uint16 _hide : 1; // general visibility switch - uint16 _near : 1; // Near action lock uint16 _drag : 1; // sprite is moveable uint16 _hold : 1; // sprite is held with mouse - uint16 _dummy : 1; // intrrupt driven animation + uint16 _trim : 1; // Trim flag uint16 _slav : 1; // slave object - uint16 _syst : 1; // system object uint16 _kill : 1; // dispose memory after remove uint16 _xlat : 1; // 2nd way display: xlat table uint16 _port : 1; // portable uint16 _kept : 1; // kept in pocket + uint16 _frnt : 1; // stay in front of sprite uint16 _east : 1; // talk to east (in opposite to west) + uint16 _near : 1; // Near action lock uint16 _shad : 1; // shadow uint16 _back : 1; // 'send to background' request - uint16 _bDel : 1; // delete bitmaps in ~SPRITE + uint16 _zmov : 1; // sprite needs Z-update in queue uint16 _tran : 1; // transparent (untouchable) } _flags; int _x; @@ -118,6 +118,7 @@ public: char _file[kMaxFile]; Sprite *_prev; Sprite *_next; + struct { byte _ptr, _cnt; } _actionCtrl[kActions]; bool works(Sprite *spr); bool seqTest(int n); @@ -125,6 +126,7 @@ public: return _ext != NULL; } + Sprite(CGE2Engine *vm); Sprite(CGE2Engine *vm, BitmapPtr *shp); virtual ~Sprite(); BitmapPtr shp(); @@ -136,7 +138,11 @@ public: inline char *name() { return (_ext) ? _ext->_name : NULL; } - void gotoxy(int x, int y); + void gotoxyz(int x, int y, int z = 0); + void gotoxyz(void); + void gotoxyz(V2D pos); + void gotoxyz_(V2D pos); + void gotoxyz(V3D pos); void center(); void show(); void hide(); |