mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
CGE2: Implement CGE2Engine::loadSprite().
Add Snail during the process and revise or expand a lot of other parts of the engine.
This commit is contained in:
parent
b674ab2a09
commit
cb65489197
@ -126,7 +126,8 @@ bool CGE2Engine::showTitle(const char *name) {
|
|||||||
|
|
||||||
Sprite D(this, LB);
|
Sprite D(this, LB);
|
||||||
D._flags._kill = true;
|
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.center();
|
||||||
D.show(2);
|
D.show(2);
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ public:
|
|||||||
void runGame();
|
void runGame();
|
||||||
void loadScript(const char *fname);
|
void loadScript(const char *fname);
|
||||||
void loadSprite(const char *fname, int ref, int scene, V3D &pos);
|
void loadSprite(const char *fname, int ref, int scene, V3D &pos);
|
||||||
|
void badLab(const char *fn);
|
||||||
|
|
||||||
const ADGameDescription *_gameDescription;
|
const ADGameDescription *_gameDescription;
|
||||||
|
|
||||||
|
@ -35,20 +35,25 @@
|
|||||||
|
|
||||||
namespace CGE2 {
|
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) {
|
void CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos) {
|
||||||
int shpcnt = 0;
|
int shpcnt = 0;
|
||||||
int seqcnt = 0;
|
int seqcnt = 0;
|
||||||
int cnt[kActions];
|
int cnt[kActions];
|
||||||
for (int i = 0; i < kActions; i++)
|
for (int i = 0; i < kActions; i++)
|
||||||
cnt[i] = 0;
|
cnt[i] = 0;
|
||||||
int section = kIdPhase;
|
ID section = kIdPhase;
|
||||||
bool frnt = true;
|
bool frnt = true;
|
||||||
bool east = false;
|
bool east = false;
|
||||||
bool port = false;
|
bool port = false;
|
||||||
bool tran = false;
|
bool tran = false;
|
||||||
Hero *h;
|
Hero *h;
|
||||||
|
ID id;
|
||||||
|
|
||||||
char tmpStr[kLineMax];
|
char tmpStr[kLineMax + 1];
|
||||||
mergeExt(tmpStr, fname, kSprExt);
|
mergeExt(tmpStr, fname, kSprExt);
|
||||||
|
|
||||||
if (_resman->exist(tmpStr)) { // sprite description file exist
|
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())
|
if (sprf.err())
|
||||||
error("Bad SPR [%s]", tmpStr);
|
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) {
|
void CGE2Engine::loadScript(const char *fname) {
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
|
|
||||||
namespace CGE2 {
|
namespace CGE2 {
|
||||||
|
|
||||||
#define kLineMax 512
|
#define kLineMax 512
|
||||||
#define kIntroExt ".I80"
|
#define kIntroExt ".I80"
|
||||||
|
#define kNoByte -1
|
||||||
|
|
||||||
} // End of namespace CGE2
|
} // End of namespace CGE2
|
||||||
|
|
||||||
|
@ -245,15 +245,23 @@ char *EncryptedStream::token(char *s) {
|
|||||||
return strtok(s, " =\t,;/()");
|
return strtok(s, " =\t,;/()");
|
||||||
}
|
}
|
||||||
|
|
||||||
ID EncryptedStream::ident(const char *s) {
|
int EncryptedStream::takeEnum(const char **tab, const char *text) {
|
||||||
if (s) {
|
if (text) {
|
||||||
for (const char **e = kIdTab; *e; e++) {
|
for (const char **e = tab; *e; e++) {
|
||||||
if (scumm_stricmp(s, *e) == 0) {
|
if (scumm_stricmp(text, *e) == 0) {
|
||||||
return ID(e - kIdTab);
|
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() {
|
int32 EncryptedStream::size() {
|
||||||
|
@ -49,7 +49,7 @@ enum ID {
|
|||||||
kIdNear, kIdMTake, kIdFTake, kIdPhase, kIdSeq,
|
kIdNear, kIdMTake, kIdFTake, kIdPhase, kIdSeq,
|
||||||
kIdName, kIdType, kIdFront, kIdEast,
|
kIdName, kIdType, kIdFront, kIdEast,
|
||||||
kIdPortable, kIdTransparent,
|
kIdPortable, kIdTransparent,
|
||||||
kIdNone
|
kIdNone = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BtKeypack {
|
struct BtKeypack {
|
||||||
@ -126,7 +126,9 @@ public:
|
|||||||
Common::String readLine();
|
Common::String readLine();
|
||||||
static int number(char *s);
|
static int number(char *s);
|
||||||
static char *token(char *s);
|
static char *token(char *s);
|
||||||
|
static int takeEnum(const char **tab, const char *text);
|
||||||
static ID ident(const char *s);
|
static ID ident(const char *s);
|
||||||
|
static bool testBool(char *s);
|
||||||
int getLineCount() { return _lineCount; }
|
int getLineCount() { return _lineCount; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
namespace CGE2 {
|
namespace CGE2 {
|
||||||
|
|
||||||
|
Hero::Hero(CGE2Engine *vm) : Sprite(vm) {
|
||||||
|
warning("STUB: Hero::Hero()");
|
||||||
|
}
|
||||||
|
|
||||||
Sprite *Hero::expand(void) {
|
Sprite *Hero::expand(void) {
|
||||||
warning("STUB: Hero::expand()");
|
warning("STUB: Hero::expand()");
|
||||||
return this;
|
return this;
|
||||||
@ -90,11 +94,6 @@ void Hero::operator -- (void) {
|
|||||||
warning("STUB: Hero::operator --()");
|
warning("STUB: Hero::operator --()");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sprite::works(Sprite *spr) {
|
|
||||||
warning("STUB: Hero::works()");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 Hero::len(V2D v) {
|
uint32 Hero::len(V2D v) {
|
||||||
warning("STUB: Hero::works()");
|
warning("STUB: Hero::works()");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
int _funDel0, _funDel;
|
int _funDel0, _funDel;
|
||||||
int _maxDist;
|
int _maxDist;
|
||||||
bool _ignoreMap;
|
bool _ignoreMap;
|
||||||
Hero(void);
|
Hero(CGE2Engine *vm);
|
||||||
void tick(void);
|
void tick(void);
|
||||||
Sprite *expand(void);
|
Sprite *expand(void);
|
||||||
Sprite *contract(void) { return this; }
|
Sprite *contract(void) { return this; }
|
||||||
|
@ -9,7 +9,8 @@ MODULE_OBJS = \
|
|||||||
sound.o \
|
sound.o \
|
||||||
cge2_main.o \
|
cge2_main.o \
|
||||||
text.o \
|
text.o \
|
||||||
hero.o
|
hero.o \
|
||||||
|
snail.o
|
||||||
|
|
||||||
# This module can be built as a plugin
|
# This module can be built as a plugin
|
||||||
ifeq ($(ENABLE_CGE2), DYNAMIC_PLUGIN)
|
ifeq ($(ENABLE_CGE2), DYNAMIC_PLUGIN)
|
||||||
|
60
engines/cge2/snail.cpp
Normal file
60
engines/cge2/snail.cpp
Normal file
@ -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.
|
@ -28,10 +28,95 @@
|
|||||||
#ifndef CGE2_SNAIL_H
|
#ifndef CGE2_SNAIL_H
|
||||||
#define CGE2_SNAIL_H
|
#define CGE2_SNAIL_H
|
||||||
|
|
||||||
|
#include "cge2/cge2_main.h"
|
||||||
|
|
||||||
namespace CGE2 {
|
namespace CGE2 {
|
||||||
|
|
||||||
enum Action { kNear, kMTake, kFTake, kActions };
|
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
|
} // End of namespace CGE2
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,6 +56,10 @@ Seq *getConstantSeq(bool seqFlag) {
|
|||||||
return seq;
|
return seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sprite::Sprite(CGE2Engine *vm) {
|
||||||
|
warning("STUB: Sprite::Sprite()");
|
||||||
|
}
|
||||||
|
|
||||||
Sprite::Sprite(CGE2Engine *vm, BitmapPtr *shpP)
|
Sprite::Sprite(CGE2Engine *vm, BitmapPtr *shpP)
|
||||||
: _x(0), _y(0), _z(0), _nearPtr(0), _takePtr(0),
|
: _x(0), _y(0), _z(0), _nearPtr(0), _takePtr(0),
|
||||||
_next(NULL), _prev(NULL), _seqPtr(kNoSeq), _time(0),
|
_next(NULL), _prev(NULL), _seqPtr(kNoSeq), _time(0),
|
||||||
@ -74,10 +78,7 @@ Sprite::Sprite(CGE2Engine *vm, BitmapPtr *shpP)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Sprite::~Sprite() {
|
Sprite::~Sprite() {
|
||||||
if (_vm->_sprite == this)
|
warning("STUB: Sprite::~Sprite()");
|
||||||
_vm->_sprite = NULL;
|
|
||||||
|
|
||||||
contract();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapPtr Sprite::shp() {
|
BitmapPtr Sprite::shp() {
|
||||||
@ -110,7 +111,10 @@ BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) {
|
|||||||
}
|
}
|
||||||
expand();
|
expand();
|
||||||
_ext->_shpList = shpP;
|
_ext->_shpList = shpP;
|
||||||
_flags._bDel = true;
|
|
||||||
|
//_flags._bDel = true;
|
||||||
|
warning("STUB: Sprite::sync() - Flags changed compared to CGE1's Sprite type.");
|
||||||
|
|
||||||
if (!_ext->_seq)
|
if (!_ext->_seq)
|
||||||
setSeq(getConstantSeq(_shpCnt < 2));
|
setSeq(getConstantSeq(_shpCnt < 2));
|
||||||
}
|
}
|
||||||
@ -371,7 +375,7 @@ void Sprite::step(int nr) {
|
|||||||
_seqPtr = _ext->_seq[_seqPtr]._next;
|
_seqPtr = _ext->_seq[_seqPtr]._next;
|
||||||
seq = _ext->_seq + _seqPtr;
|
seq = _ext->_seq + _seqPtr;
|
||||||
if (seq->_dly >= 0) {
|
if (seq->_dly >= 0) {
|
||||||
gotoxy(_x + (seq->_dx), _y + (seq->_dy));
|
gotoxyz(_x + (seq->_dx), _y + (seq->_dy));
|
||||||
_time = seq->_dly;
|
_time = seq->_dly;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,31 +408,28 @@ void Sprite::killXlat() {
|
|||||||
_flags._xlat = false;
|
_flags._xlat = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::gotoxy(int x, int y) {
|
void Sprite::gotoxyz(int x, int y, int z) {
|
||||||
int xo = _x, yo = _y;
|
warning("STUB: Sprite::gotoxyz()");
|
||||||
if (_x < kScrWidth) {
|
}
|
||||||
if (x < 0)
|
|
||||||
x = 0;
|
void Sprite::gotoxyz(void) {
|
||||||
if (x + _w > kScrWidth)
|
warning("STUB: Sprite::gotoxyz()");
|
||||||
x = (kScrWidth - _w);
|
}
|
||||||
_x = x;
|
|
||||||
}
|
void Sprite::gotoxyz(V2D pos) {
|
||||||
if (_h < kScrHeight) {
|
warning("STUB: Sprite::gotoxyz()");
|
||||||
if (y < 0)
|
}
|
||||||
y = 0;
|
|
||||||
if (y + _h > kScrHeight)
|
void Sprite::gotoxyz_(V2D pos) {
|
||||||
y = (kScrHeight - _h);
|
warning("STUB: Sprite::gotoxyz()");
|
||||||
_y = y;
|
}
|
||||||
}
|
|
||||||
if (_next)
|
void Sprite::gotoxyz(V3D pos) {
|
||||||
if (_next->_flags._slav)
|
warning("STUB: Sprite::gotoxyz()");
|
||||||
_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::center() {
|
void Sprite::center() {
|
||||||
gotoxy((kScrWidth - _w) / 2, (kScrHeight - _h) / 2);
|
gotoxyz((kScrWidth - _w) / 2, (kScrHeight - _h) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::show() {
|
void Sprite::show() {
|
||||||
@ -494,9 +495,9 @@ void Sprite::sync(Common::Serializer &s) {
|
|||||||
_flags._near = flags & 0x0002 ? true : false;
|
_flags._near = flags & 0x0002 ? true : false;
|
||||||
_flags._drag = flags & 0x0004 ? true : false;
|
_flags._drag = flags & 0x0004 ? true : false;
|
||||||
_flags._hold = flags & 0x0008 ? 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._slav = flags & 0x0020 ? true : false;
|
||||||
_flags._syst = flags & 0x0040 ? true : false;
|
//_flags._syst = flags & 0x0040 ? true : false;
|
||||||
_flags._kill = flags & 0x0080 ? true : false;
|
_flags._kill = flags & 0x0080 ? true : false;
|
||||||
_flags._xlat = flags & 0x0100 ? true : false;
|
_flags._xlat = flags & 0x0100 ? true : false;
|
||||||
_flags._port = flags & 0x0200 ? 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._east = flags & 0x0800 ? true : false;
|
||||||
_flags._shad = flags & 0x1000 ? true : false;
|
_flags._shad = flags & 0x1000 ? true : false;
|
||||||
_flags._back = flags & 0x2000 ? 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;
|
_flags._tran = flags & 0x8000 ? true : false;
|
||||||
} else {
|
} else {
|
||||||
flags = (flags << 1) | _flags._tran;
|
flags = (flags << 1) | _flags._tran;
|
||||||
flags = (flags << 1) | _flags._bDel;
|
//flags = (flags << 1) | _flags._bDel;
|
||||||
flags = (flags << 1) | _flags._back;
|
flags = (flags << 1) | _flags._back;
|
||||||
flags = (flags << 1) | _flags._shad;
|
flags = (flags << 1) | _flags._shad;
|
||||||
flags = (flags << 1) | _flags._east;
|
flags = (flags << 1) | _flags._east;
|
||||||
@ -516,9 +517,9 @@ void Sprite::sync(Common::Serializer &s) {
|
|||||||
flags = (flags << 1) | _flags._port;
|
flags = (flags << 1) | _flags._port;
|
||||||
flags = (flags << 1) | _flags._xlat;
|
flags = (flags << 1) | _flags._xlat;
|
||||||
flags = (flags << 1) | _flags._kill;
|
flags = (flags << 1) | _flags._kill;
|
||||||
flags = (flags << 1) | _flags._syst;
|
//flags = (flags << 1) | _flags._syst;
|
||||||
flags = (flags << 1) | _flags._slav;
|
flags = (flags << 1) | _flags._slav;
|
||||||
flags = (flags << 1) | _flags._dummy;
|
//flags = (flags << 1) | _flags._dummy;
|
||||||
flags = (flags << 1) | _flags._hold;
|
flags = (flags << 1) | _flags._hold;
|
||||||
flags = (flags << 1) | _flags._drag;
|
flags = (flags << 1) | _flags._drag;
|
||||||
flags = (flags << 1) | _flags._near;
|
flags = (flags << 1) | _flags._near;
|
||||||
@ -526,6 +527,8 @@ void Sprite::sync(Common::Serializer &s) {
|
|||||||
s.syncAsUint16LE(flags);
|
s.syncAsUint16LE(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warning("STUB: Sprite::sync() - Flags changed compared to CGE1's Sprite type.");
|
||||||
|
|
||||||
s.syncAsUint16LE(_x);
|
s.syncAsUint16LE(_x);
|
||||||
s.syncAsUint16LE(_y);
|
s.syncAsUint16LE(_y);
|
||||||
s.syncAsByte(_z);
|
s.syncAsByte(_z);
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
#include "cge2/general.h"
|
#include "cge2/general.h"
|
||||||
#include "cge2/bitmap.h"
|
#include "cge2/bitmap.h"
|
||||||
//#include "cge/snail.h"
|
#include "cge2/snail.h"
|
||||||
#include "cge2/cge2.h"
|
#include "cge2/cge2.h"
|
||||||
|
|
||||||
namespace CGE2 {
|
namespace CGE2 {
|
||||||
@ -89,20 +89,20 @@ public:
|
|||||||
signed char _scene;
|
signed char _scene;
|
||||||
struct Flags {
|
struct Flags {
|
||||||
uint16 _hide : 1; // general visibility switch
|
uint16 _hide : 1; // general visibility switch
|
||||||
uint16 _near : 1; // Near action lock
|
|
||||||
uint16 _drag : 1; // sprite is moveable
|
uint16 _drag : 1; // sprite is moveable
|
||||||
uint16 _hold : 1; // sprite is held with mouse
|
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 _slav : 1; // slave object
|
||||||
uint16 _syst : 1; // system object
|
|
||||||
uint16 _kill : 1; // dispose memory after remove
|
uint16 _kill : 1; // dispose memory after remove
|
||||||
uint16 _xlat : 1; // 2nd way display: xlat table
|
uint16 _xlat : 1; // 2nd way display: xlat table
|
||||||
uint16 _port : 1; // portable
|
uint16 _port : 1; // portable
|
||||||
uint16 _kept : 1; // kept in pocket
|
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 _east : 1; // talk to east (in opposite to west)
|
||||||
|
uint16 _near : 1; // Near action lock
|
||||||
uint16 _shad : 1; // shadow
|
uint16 _shad : 1; // shadow
|
||||||
uint16 _back : 1; // 'send to background' request
|
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)
|
uint16 _tran : 1; // transparent (untouchable)
|
||||||
} _flags;
|
} _flags;
|
||||||
int _x;
|
int _x;
|
||||||
@ -118,6 +118,7 @@ public:
|
|||||||
char _file[kMaxFile];
|
char _file[kMaxFile];
|
||||||
Sprite *_prev;
|
Sprite *_prev;
|
||||||
Sprite *_next;
|
Sprite *_next;
|
||||||
|
struct { byte _ptr, _cnt; } _actionCtrl[kActions];
|
||||||
|
|
||||||
bool works(Sprite *spr);
|
bool works(Sprite *spr);
|
||||||
bool seqTest(int n);
|
bool seqTest(int n);
|
||||||
@ -125,6 +126,7 @@ public:
|
|||||||
return _ext != NULL;
|
return _ext != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sprite(CGE2Engine *vm);
|
||||||
Sprite(CGE2Engine *vm, BitmapPtr *shp);
|
Sprite(CGE2Engine *vm, BitmapPtr *shp);
|
||||||
virtual ~Sprite();
|
virtual ~Sprite();
|
||||||
BitmapPtr shp();
|
BitmapPtr shp();
|
||||||
@ -136,7 +138,11 @@ public:
|
|||||||
inline char *name() {
|
inline char *name() {
|
||||||
return (_ext) ? _ext->_name : NULL;
|
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 center();
|
||||||
void show();
|
void show();
|
||||||
void hide();
|
void hide();
|
||||||
|
Loading…
Reference in New Issue
Block a user