CGE: Some more renaming (wip)

This commit is contained in:
Strangerke 2011-07-01 08:37:40 +02:00
parent f59c910b8f
commit 0000a3139a
23 changed files with 473 additions and 468 deletions

View File

@ -35,7 +35,7 @@
namespace CGE {
DAC *Bitmap::_pal = NULL;
Dac *Bitmap::_pal = NULL;
#define MAXPATH 128
void Bitmap::init() {
@ -53,7 +53,7 @@ Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL) {
#if (BMP_MODE < 2)
if (rem && PIC_FILE::exist(pat)) {
PIC_FILE file(pat);
if ((file.Error == 0) && (!loadVBM(&file)))
if ((file._error == 0) && (!loadVBM(&file)))
error("Bad VBM [%s]", fname);
} else
#endif
@ -61,7 +61,7 @@ Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL) {
#if (BMP_MODE)
ForceExt(pat, fname, ".BMP");
PIC_FILE file(pat);
if (file.Error == 0) {
if (file._error == 0) {
if (loadBMP(&file)) {
Code();
if (rem) {
@ -366,47 +366,47 @@ bool Bitmap::solidAt(int x, int y) {
}
bool Bitmap::saveVBM(XFILE *f) {
bool Bitmap::saveVBM(XFile *f) {
uint16 p = (_pal != NULL),
n = ((uint16)(((uint8 *)_b) - _v)) + _h * sizeof(HideDesc);
if (f->Error == 0)
if (f->_error == 0)
f->write((uint8 *)&p, sizeof(p));
if (f->Error == 0)
if (f->_error == 0)
f->write((uint8 *)&n, sizeof(n));
if (f->Error == 0)
if (f->_error == 0)
f->write((uint8 *)&_w, sizeof(_w));
if (f->Error == 0)
if (f->_error == 0)
f->write((uint8 *)&_h, sizeof(_h));
if (f->Error == 0)
if (f->_error == 0)
if (p)
f->write((uint8 *)_pal, 256 * 3);
if (f->Error == 0)
if (f->_error == 0)
f->write(_v, n);
return (f->Error == 0);
return (f->_error == 0);
}
bool Bitmap::loadVBM(XFILE *f) {
bool Bitmap::loadVBM(XFile *f) {
uint16 p = 0, n = 0;
if (f->Error == 0)
if (f->_error == 0)
f->read((uint8 *)&p, sizeof(p));
if (f->Error == 0)
if (f->_error == 0)
f->read((uint8 *)&n, sizeof(n));
if (f->Error == 0)
if (f->_error == 0)
f->read((uint8 *)&_w, sizeof(_w));
if (f->Error == 0)
if (f->_error == 0)
f->read((uint8 *)&_h, sizeof(_h));
if (f->Error == 0) {
if (f->_error == 0) {
if (p) {
if (_pal) {
byte palData[PAL_SIZ];
@ -419,14 +419,14 @@ bool Bitmap::loadVBM(XFILE *f) {
if ((_v = farnew(uint8, n)) == NULL)
return false;
if (f->Error == 0)
if (f->_error == 0)
f->read(_v, n);
_b = (HideDesc *)(_v + n - _h * sizeof(HideDesc));
return (f->Error == 0);
return (f->_error == 0);
}
bool Bitmap::loadBMP(XFILE * f) {
bool Bitmap::loadBMP(XFile *f) {
struct {
char BM[2];
union { int16 len; int32 len_; };
@ -446,16 +446,16 @@ bool Bitmap::loadBMP(XFILE * f) {
BGR4 bpal[256];
f->read((byte *)&hea, sizeof(hea));
if (f->Error == 0) {
if (f->_error == 0) {
if (hea.hdr == 0x436L) {
int16 i = (hea.hdr - sizeof(hea)) / sizeof(BGR4);
f->read((byte *)&bpal, sizeof(bpal));
if (f->Error == 0) {
if (f->_error == 0) {
if (_pal) {
for (i = 0; i < 256; i ++) {
_pal[i].R = bpal[i].R;
_pal[i].G = bpal[i].G;
_pal[i].B = bpal[i].B;
_pal[i]._r = bpal[i].R;
_pal[i]._g = bpal[i].G;
_pal[i]._b = bpal[i].B;
}
_pal = NULL;
}
@ -466,9 +466,9 @@ bool Bitmap::loadBMP(XFILE * f) {
byte buf[3]; int i;
for (i = _h - 1; i >= 0; i--) {
f->read(_m + (_w * i), _w);
if (r && f->Error == 0)
if (r && f->_error == 0)
f->read(buf, r);
if (f->Error)
if (f->_error)
break;
}
if (i < 0)

View File

@ -60,10 +60,10 @@ struct HideDesc {
#include "common/pack-end.h"
class Bitmap {
bool loadBMP(XFILE *f);
bool loadVBM(XFILE *f);
bool loadBMP(XFile *f);
bool loadVBM(XFile *f);
public:
static DAC *_pal;
static Dac *_pal;
uint16 _w;
uint16 _h;
uint8 *_m;
@ -85,7 +85,7 @@ public:
void show(int x, int y);
void xShow(int x, int y);
bool solidAt(int x, int y);
bool saveVBM(XFILE *f);
bool saveVBM(XFile *f);
uint16 moveVmap(uint8 *buf);
};

View File

@ -55,7 +55,7 @@ BtFile::BtFile(const char *name, IOMODE mode, CRYPT *crpt)
BtFile::~BtFile(void) {
for (int i = 0; i < BT_LEVELS; i++) {
putPage(i);
putPage(i, false);
delete _buff[i]._page;
}
}
@ -73,7 +73,7 @@ void BtFile::putPage(int lev, bool hard) {
BtPage *BtFile::getPage(int lev, uint16 pgn) {
if (_buff[lev]._pgNo != pgn) {
int32 pos = pgn * sizeof(BtPage);
putPage(lev);
putPage(lev, false);
_buff[lev]._pgNo = pgn;
if (size() > pos) {
seek((uint32) pgn * sizeof(BtPage));
@ -93,7 +93,7 @@ BtPage *BtFile::getPage(int lev, uint16 pgn) {
BtKeypack *BtFile::find(const char *key) {
int lev = 0;
uint16 nxt = BT_ROOT;
while (! Error) {
while (!_error) {
BtPage *pg = getPage(lev, nxt);
// search
if (pg->_hea._down != BT_NONE) {

View File

@ -80,10 +80,10 @@ class BtFile : public IoHand {
bool _updt;
} _buff[BT_LEVELS];
void putPage(int lev, bool hard = false);
void putPage(int lev, bool hard);
BtPage *getPage(int lev, uint16 pgn);
public:
BtFile(const char *name, IOMODE mode = REA, CRYPT *crpt = NULL);
BtFile(const char *name, IOMODE mode, CRYPT *crpt);
virtual ~BtFile();
BtKeypack *find(const char *key);
BtKeypack *next();

View File

@ -54,7 +54,7 @@ IoBuf::IoBuf(const char *name, IOMODE mode, CRYPT *crpt)
}
IoBuf::~IoBuf(void) {
if (Mode > REA)
if (_mode > REA)
writeBuff();
if (_buff)
free(_buff);
@ -210,7 +210,7 @@ CFile::~CFile(void) {
void CFile::flush(void) {
if (Mode > REA)
if (_mode > REA)
writeBuff();
else
_lim = 0;
@ -225,16 +225,16 @@ void CFile::flush(void) {
long CFile::mark(void) {
return _bufMark + ((Mode > REA) ? _lim : _ptr);
return _bufMark + ((_mode > REA) ? _lim : _ptr);
}
long CFile::seek(long pos) {
if (pos >= _bufMark && pos < _bufMark + _lim) {
((Mode == REA) ? _ptr : _lim) = (uint16)(pos - _bufMark);
((_mode == REA) ? _ptr : _lim) = (uint16)(pos - _bufMark);
return pos;
} else {
if (Mode > REA)
if (_mode > REA)
writeBuff();
else
_lim = 0;
@ -247,13 +247,13 @@ long CFile::seek(long pos) {
void CFile::append(CFile &f) {
seek(size());
if (f.Error == 0) {
if (f._error == 0) {
while (true) {
if ((_lim = f.IoHand::read(_buff, IOBUF_SIZE)) == IOBUF_SIZE)
writeBuff();
else
break;
if ((Error = f.Error) != 0)
if ((_error = f._error) != 0)
break;
}
}

View File

@ -56,40 +56,40 @@ public:
}
void cge_main();
void SwitchCave(int cav);
void StartCountDown();
void Quit();
void ResetQSwitch();
void OptionTouch(int opt, uint16 mask);
void LoadGame(XFILE &file, bool tiny);
void SetMapBrick(int x, int z);
void SwitchMapping();
void LoadSprite(const char *fname, int ref, int cav, int col, int row, int pos);
void LoadScript(const char *fname);
void LoadUser();
void RunGame();
bool ShowTitle(const char *name);
void Movie(const char *ext);
void TakeName();
void Inf(const char *txt);
void SelectSound();
void switchCave(int cav);
void startCountDown();
void quit();
void resetQSwitch();
void optionTouch(int opt, uint16 mask);
void loadGame(XFile &file, bool tiny);
void setMapBrick(int x, int z);
void switchMapping();
void loadSprite(const char *fname, int ref, int cav, int col, int row, int pos);
void loadScript(const char *fname);
void loadUser();
void runGame();
bool showTitle(const char *name);
void movie(const char *ext);
void takeName();
void inf(const char *txt);
void selectSound();
void SNSelect();
void dummy() {}
void NONE();
void SB();
void CaveDown();
void XCave();
void QGame();
void caveDown();
void xCave();
void qGame();
void SBM();
void GUS();
void GUSM();
void MIDI();
void AUTO();
void SetPortD();
void SetPortM();
void SetIRQ();
void SetDMA();
void MainLoop();
void setPortD();
void setPortM();
void setIRQ();
void setDMA();
void mainLoop();
private:
CGEConsole *_console;

View File

@ -133,7 +133,7 @@ bool JBW = false;
//-------------------------------------------------------------------------
int PocPtr = 0;
static EMS *Mini = MiniEmm.Alloc((uint16)MINI_EMM_SIZE);
static EMS *Mini = MiniEmm.alloc((uint16)MINI_EMM_SIZE);
static BMP_PTR *MiniShpList = NULL;
static BMP_PTR MiniShp[] = { NULL, NULL };
static KEYBOARD Keyboard;
@ -148,18 +148,18 @@ BAR Barriers[1 + CAVE_MAX] = { { 0xFF, 0xFF } };
extern int FindPocket(Sprite *);
extern DAC StdPal[58];
extern Dac _stdPal[58];
void FeedSnail(Sprite *spr, SNLIST snq); // defined in SNAIL
uint8 CLUSTER::Map[MAP_ZCNT][MAP_XCNT];
uint8 Cluster::_map[MAP_ZCNT][MAP_XCNT];
uint8 &CLUSTER::Cell(void) {
return Map[B][A];
uint8 &Cluster::cell(void) {
return _map[_b][_a];
}
bool CLUSTER::Protected(void) {
bool Cluster::Protected(void) {
/*
if (A == Barriers[Now].Vert || B == Barriers[Now].Horz)
return true;
@ -202,20 +202,20 @@ bool CLUSTER::Protected(void) {
}
CLUSTER XZ(int x, int y) {
Cluster XZ(int x, int y) {
if (y < MAP_TOP)
y = MAP_TOP;
if (y > MAP_TOP + MAP_HIG - MAP_ZGRID)
y = MAP_TOP + MAP_HIG - MAP_ZGRID;
return CLUSTER(x / MAP_XGRID, (y - MAP_TOP) / MAP_ZGRID);
return Cluster(x / MAP_XGRID, (y - MAP_TOP) / MAP_ZGRID);
}
CLUSTER XZ(COUPLE xy) {
Cluster XZ(Couple xy) {
signed char x, y;
xy.Split(x, y);
xy.split(x, y);
return XZ(x, y);
}
@ -249,13 +249,13 @@ SavTab _savTab[] = {
};
void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
void CGEEngine::loadGame(XFile &file, bool tiny = false) {
SavTab *st;
Sprite *spr;
int i;
for (st = _savTab; st->Ptr; st++) {
if (file.Error)
if (file._error)
error("Bad SVG");
file.read((uint8 *)((tiny || st->Flg) ? st->Ptr : &i), st->Len);
}
@ -274,7 +274,7 @@ void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
}
if (! tiny) { // load sprites & pocket
while (! file.Error) {
while (!file._error) {
Sprite S(this, NULL);
uint16 n = file.read((uint8 *) &S, sizeof(S));
@ -282,7 +282,7 @@ void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
break;
S._prev = S._next = NULL;
spr = (scumm_stricmp(S.File + 2, "MUCHA") == 0) ? new FLY(this, NULL)
spr = (scumm_stricmp(S.File + 2, "MUCHA") == 0) ? new Fly(this, NULL)
: new Sprite(this, NULL);
if (spr == NULL)
error("No core");
@ -300,12 +300,12 @@ void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
static void SaveSound(void) {
CFile cfg(UsrPath(ProgName(CFG_EXT)), WRI);
if (! cfg.Error)
if (!cfg._error)
cfg.write(&SNDDrvInfo, sizeof(SNDDrvInfo) - sizeof(SNDDrvInfo.VOL2));
}
static void SaveGame(XFILE &file) {
static void SaveGame(XFile &file) {
SavTab *st;
Sprite *spr;
int i;
@ -319,7 +319,7 @@ static void SaveGame(XFILE &file) {
volume[1] = SNDDrvInfo.VOL2.M;
for (st = _savTab; st->Ptr; st++) {
if (file.Error)
if (file._error)
error("Bad SVG");
file.write((uint8 *) st->Ptr, st->Len);
}
@ -328,7 +328,7 @@ static void SaveGame(XFILE &file) {
for (spr = Vga->SpareQ->First(); spr; spr = spr->_next)
if (spr->_ref >= 1000)
if (!file.Error)
if (!file._error)
file.write((uint8 *)spr, sizeof(*spr));
}
@ -339,7 +339,7 @@ static void HeroCover(int cvr) {
static void Trouble(int seq, int txt) {
Hero->Park();
Hero->park();
SNPOST(SNWAIT, -1, -1, Hero);
SNPOST(SNSEQ, -1, seq, Hero);
SNPOST(SNSOUND, -1, 2, Hero);
@ -359,7 +359,7 @@ static void TooFar(void) {
// Used in stubbed function, do not remove!
static void NoWay(void) {
static void noWay() {
Trouble(NO_WAY, NO_WAY_TEXT);
}
@ -367,7 +367,7 @@ static void NoWay(void) {
static void LoadHeroXY(void) {
INI_FILE cf(ProgName(".HXY"));
memset(HeroXY, 0, sizeof(HeroXY));
if (! cf.Error)
if (!cf._error)
cf.CFREAD(&HeroXY);
}
@ -375,35 +375,35 @@ static void LoadHeroXY(void) {
static void LoadMapping(void) {
if (Now <= CAVE_MAX) {
INI_FILE cf(ProgName(".TAB"));
if (! cf.Error) {
memset(CLUSTER::Map, 0, sizeof(CLUSTER::Map));
cf.seek((Now - 1) * sizeof(CLUSTER::Map));
cf.read((uint8 *) CLUSTER::Map, sizeof(CLUSTER::Map));
if (!cf._error) {
memset(Cluster::_map, 0, sizeof(Cluster::_map));
cf.seek((Now - 1) * sizeof(Cluster::_map));
cf.read((uint8 *) Cluster::_map, sizeof(Cluster::_map));
}
}
}
CLUSTER Trace[MAX_FIND_LEVEL];
Cluster Trace[MAX_FIND_LEVEL];
int FindLevel;
WALK::WALK(CGEEngine *vm, BMP_PTR *shpl)
: Sprite(vm, shpl), Dir(NO_DIR), TracePtr(-1), _vm(vm) {
: Sprite(vm, shpl), Dir(NO_DIR), _tracePtr(-1), _vm(vm) {
}
void WALK::Tick(void) {
void WALK::tick() {
if (_flags._hide)
return;
Here = XZ(_x + _w / 2, _y + _h);
_here = XZ(_x + _w / 2, _y + _h);
if (Dir != NO_DIR) {
Sprite *spr;
Sys->FunTouch();
for (spr = Vga->ShowQ->First(); spr; spr = spr->_next) {
if (Distance(spr) < 2) {
if (distance(spr) < 2) {
if (!spr->_flags._near) {
FeedSnail(spr, NEAR);
spr->_flags._near = true;
@ -414,33 +414,33 @@ void WALK::Tick(void) {
}
}
if (_flags._hold || TracePtr < 0)
Park();
if (_flags._hold || _tracePtr < 0)
park();
else {
if (Here == Trace[TracePtr]) {
if (--TracePtr < 0)
Park();
if (_here == Trace[_tracePtr]) {
if (--_tracePtr < 0)
park();
} else {
signed char dx, dz;
(Trace[TracePtr] - Here).Split(dx, dz);
(Trace[_tracePtr] - _here).split(dx, dz);
DIR d = (dx) ? ((dx > 0) ? EE : WW) : ((dz > 0) ? SS : NN);
Turn(d);
turn(d);
}
}
Step();
if ((Dir == WW && _x <= 0) ||
(Dir == EE && _x + _w >= SCR_WID) ||
(Dir == SS && _y + _w >= WORLD_HIG - 2))
Park();
park();
else {
signed char x; // dummy var
Here.Split(x, _z); // take current Z position
_here.split(x, _z); // take current Z position
SNPOST_(SNZTRIM, -1, 0, this); // update Hero's pos in show queue
}
}
int WALK::Distance(Sprite *spr) {
int WALK::distance(Sprite *spr) {
int dx, dz;
dx = spr->_x - (_x + _w - WALKSIDE);
if (dx < 0)
@ -462,7 +462,7 @@ int WALK::Distance(Sprite *spr) {
}
void WALK::Turn(DIR d) {
void WALK::turn(DIR d) {
DIR dir = (Dir == NO_DIR) ? SS : Dir;
if (d != Dir) {
Step((d == dir) ? (1 + dir + dir) : (9 + 4 * dir + d));
@ -471,20 +471,20 @@ void WALK::Turn(DIR d) {
}
void WALK::Park(void) {
void WALK::park(void) {
if (_time == 0)
++_time;
if (Dir != NO_DIR) {
Step(9 + 4 * Dir + Dir);
Dir = NO_DIR;
TracePtr = -1;
_tracePtr = -1;
}
}
void WALK::FindWay(CLUSTER c) {
warning("STUB: Find1Way");
void WALK::findWay(Cluster c) {
warning("STUB: WALK::findWay");
/*
bool Find1Way(void);
extern uint16 Target;
@ -508,7 +508,7 @@ void WALK::FindWay(CLUSTER c) {
}
void WALK::FindWay(Sprite *spr) {
void WALK::findWay(Sprite *spr) {
if (spr && spr != this) {
int x = spr->_x;
int z = spr->_z;
@ -516,24 +516,24 @@ void WALK::FindWay(Sprite *spr) {
x += spr->_w + _w / 2 - WALKSIDE;
else
x -= _w / 2 - WALKSIDE;
FindWay(CLUSTER((x / MAP_XGRID),
findWay(Cluster((x / MAP_XGRID),
((z < MAP_ZCNT - MAX_DISTANCE) ? (z + 1)
: (z - 1))));
}
}
bool WALK::Lower(Sprite *spr) {
bool WALK::lower(Sprite *spr) {
return (spr->_y > _y + (_h * 3) / 5);
}
void WALK::Reach(Sprite *spr, int mode) {
void WALK::reach(Sprite *spr, int mode) {
if (spr) {
Hero->FindWay(spr);
Hero->findWay(spr);
if (mode < 0) {
mode = spr->_flags._east;
if (Lower(spr))
if (lower(spr))
mode += 2;
}
}
@ -568,20 +568,20 @@ SQUARE::SQUARE(CGEEngine *vm)
void SQUARE::Touch(uint16 mask, int x, int y) {
Sprite::Touch(mask, x, y);
if (mask & L_UP) {
XZ(_x + x, _y + y).Cell() = 0;
XZ(_x + x, _y + y).cell() = 0;
SNPOST_(SNKILL, -1, 0, this);
}
}
void CGEEngine::SetMapBrick(int x, int z) {
void CGEEngine::setMapBrick(int x, int z) {
SQUARE *s = new SQUARE(this);
if (s) {
static char n[] = "00:00";
s->Goto(x * MAP_XGRID, MAP_TOP + z * MAP_ZGRID);
wtom(x, n + 0, 10, 2);
wtom(z, n + 3, 10, 2);
CLUSTER::Map[z][x] = 1;
Cluster::_map[z][x] = 1;
s->SetName(n);
Vga->ShowQ->Insert(s, Vga->ShowQ->First());
}
@ -601,23 +601,23 @@ static void KeyClick(void) {
}
void CGEEngine::ResetQSwitch() {
void CGEEngine::resetQSwitch() {
SNPOST_(SNSEQ, 123, 0, NULL);
KeyClick();
}
void CGEEngine::Quit() {
void CGEEngine::quit() {
static CHOICE QuitMenu[] = {
{ NULL, &CGEEngine::StartCountDown },
{ NULL, &CGEEngine::ResetQSwitch },
{ NULL, &CGEEngine::startCountDown },
{ NULL, &CGEEngine::resetQSwitch },
{ NULL, &CGEEngine::dummy }
};
if (Snail->Idle() && ! Hero->_flags._hide) {
if (VMENU::Addr) {
SNPOST_(SNKILL, -1, 0, VMENU::Addr);
ResetQSwitch();
resetQSwitch();
} else {
QuitMenu[0].Text = Text->getText(QUIT_TEXT);
QuitMenu[1].Text = Text->getText(NOQUIT_TEXT);
@ -634,7 +634,7 @@ static void AltCtrlDel(void) {
}
// Used in stubbed function, do not remove!
static void MiniStep(int stp) {
static void miniStep(int stp) {
if (stp < 0)
_miniCave->_flags._hide = true;
else {
@ -657,11 +657,11 @@ static void PostMiniStep(int stp) {
void SYSTEM::SetPal(void) {
uint i;
DAC *p = VGA::SysPal + 256 - ArrayCount(StdPal);
for (i = 0; i < ArrayCount(StdPal); i++) {
p[i].R = StdPal[i].R >> 2;
p[i].G = StdPal[i].G >> 2;
p[i].B = StdPal[i].B >> 2;
Dac *p = VGA::SysPal + 256 - ArrayCount(_stdPal);
for (i = 0; i < ArrayCount(_stdPal); i++) {
p[i]._r = _stdPal[i]._r >> 2;
p[i]._g = _stdPal[i]._g >> 2;
p[i]._b = _stdPal[i]._b >> 2;
}
}
@ -687,7 +687,7 @@ static void ShowBak(int ref) {
}
static void CaveUp(void) {
static void caveUp() {
int BakRef = 1000 * Now;
if (Music)
LoadMIDI(Now);
@ -732,7 +732,7 @@ static void CaveUp(void) {
if (_shadow) {
Vga->ShowQ->Remove(_shadow);
_shadow->MakeXlat(Glass(VGA::SysPal, 204, 204, 204));
_shadow->MakeXlat(glass(VGA::SysPal, 204, 204, 204));
Vga->ShowQ->Insert(_shadow, Hero);
_shadow->_z = Hero->_z;
}
@ -749,10 +749,10 @@ static void CaveUp(void) {
}
void CGEEngine::CaveDown() {
void CGEEngine::caveDown() {
Sprite *spr;
if (!_horzLine->_flags._hide)
SwitchMapping();
switchMapping();
for (spr = Vga->ShowQ->First(); spr;) {
Sprite *n = spr->_next;
@ -767,14 +767,14 @@ void CGEEngine::CaveDown() {
}
void CGEEngine::XCave() {
CaveDown();
CaveUp();
void CGEEngine::xCave() {
caveDown();
caveUp();
}
void CGEEngine::QGame() {
CaveDown();
void CGEEngine::qGame() {
caveDown();
OldLev = Lev;
SaveSound();
CFile file = CFile(UsrPath(UsrFnam), WRI, RCrypt);
@ -784,7 +784,7 @@ void CGEEngine::QGame() {
}
void CGEEngine::SwitchCave(int cav) {
void CGEEngine::switchCave(int cav) {
if (cav != Now) {
_heart->_enable = false;
if (cav < 0) {
@ -796,7 +796,7 @@ void CGEEngine::SwitchCave(int cav) {
Now = cav;
Mouse->Off();
if (Hero) {
Hero->Park();
Hero->park();
Hero->Step(0);
if (!_isDemo)
///// protection: auto-destruction on! ----------------------
@ -865,7 +865,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
if (KEYBOARD::Key[ALT])
SaveMapping();
else
_vm->SwitchMapping();
_vm->switchMapping();
break;
case F1:
SwitchDebug();
@ -914,7 +914,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
break;
case F10 :
if (Snail->Idle() && ! Hero->_flags._hide)
_vm->StartCountDown();
_vm->startCountDown();
break;
case 'J':
if (pp == 0)
@ -958,21 +958,21 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
PostMiniStep(cav - 1);
if (mask & L_UP) {
if (cav && Snail->Idle() && Hero->TracePtr < 0)
_vm->SwitchCave(cav);
if (cav && Snail->Idle() && Hero->_tracePtr < 0)
_vm->switchCave(cav);
if (!_horzLine->_flags._hide) {
if (y >= MAP_TOP && y < MAP_TOP + MAP_HIG) {
int8 x1, z1;
XZ(x, y).Split(x1, z1);
CLUSTER::Map[z1][x1] = 1;
_vm->SetMapBrick(x1, z1);
XZ(x, y).split(x1, z1);
Cluster::_map[z1][x1] = 1;
_vm->setMapBrick(x1, z1);
}
} else
{
if (! Talk && Snail->Idle() && Hero
&& y >= MAP_TOP && y < MAP_TOP + MAP_HIG && ! Game) {
Hero->FindWay(XZ(x, y));
Hero->findWay(XZ(x, y));
}
}
}
@ -1042,7 +1042,7 @@ static void SwitchMusic(void) {
else {
SNPOST_(SNSEQ, 122, (Music = false), NULL);
//TODO Change the SNPOST message send to a special way to send function pointer
// SNPOST(SNEXEC, -1, 0, (void *)&SelectSound);
// SNPOST(SNEXEC, -1, 0, (void *)&selectSound);
warning("SwitchMusic() - SNPOST");
}
} else {
@ -1060,13 +1060,13 @@ static void SwitchMusic(void) {
}
void CGEEngine::StartCountDown() {
void CGEEngine::startCountDown() {
//SNPOST(SNSEQ, 123, 0, NULL);
SwitchCave(-1);
switchCave(-1);
}
void CGEEngine::TakeName() {
void CGEEngine::takeName() {
if (GET_TEXT::Ptr)
SNPOST_(SNKILL, -1, 0, GET_TEXT::Ptr);
else {
@ -1082,14 +1082,14 @@ void CGEEngine::TakeName() {
}
void CGEEngine::SwitchMapping() {
void CGEEngine::switchMapping() {
if (_horzLine->_flags._hide) {
int i;
for (i = 0; i < MAP_ZCNT; i++) {
int j;
for (j = 0; j < MAP_XCNT; j++) {
if (CLUSTER::Map[i][j])
SetMapBrick(j, i);
if (Cluster::_map[i][j])
setMapBrick(j, i);
}
}
} else {
@ -1144,17 +1144,17 @@ static void NextStep(void) {
}
static void SaveMapping(void) {
static void SaveMapping() {
{
IoHand cf(ProgName(".TAB"), UPD);
if (!cf.Error) {
cf.seek((Now - 1) * sizeof(CLUSTER::Map));
cf.write((uint8 *) CLUSTER::Map, sizeof(CLUSTER::Map));
if (!cf._error) {
cf.seek((Now - 1) * sizeof(Cluster::_map));
cf.write((uint8 *) Cluster::_map, sizeof(Cluster::_map));
}
}
{
IoHand cf(ProgName(".HXY"), WRI);
if (!cf.Error) {
if (!cf._error) {
HeroXY[Now - 1]._x = Hero->_x;
HeroXY[Now - 1]._y = Hero->_y;
cf.write((uint8 *) HeroXY, sizeof(HeroXY));
@ -1229,7 +1229,7 @@ static void SwitchDebug(void) {
}
void CGEEngine::OptionTouch(int opt, uint16 mask) {
void CGEEngine::optionTouch(int opt, uint16 mask) {
switch (opt) {
case 1 :
if (mask & L_UP)
@ -1246,7 +1246,7 @@ void CGEEngine::OptionTouch(int opt, uint16 mask) {
break;
case 3 :
if (mask & L_UP)
Quit();
quit();
break;
}
}
@ -1260,7 +1260,7 @@ void Sprite::Touch(uint16 mask, int x, int y) {
if (mask & (R_DN | L_DN))
_sprite = this;
if (_ref / 10 == 12) {
_vm->OptionTouch(_ref % 10, mask);
_vm->optionTouch(_ref % 10, mask);
return;
}
if (_flags._syst)
@ -1272,7 +1272,7 @@ void Sprite::Touch(uint16 mask, int x, int y) {
if ((mask & R_UP) && Snail->Idle()) {
Sprite *ps = (_pocLight->_seqPtr) ? _pocket[PocPtr] : NULL;
if (ps) {
if (_flags._kept || Hero->Distance(this) < MAX_DISTANCE) {
if (_flags._kept || Hero->distance(this) < MAX_DISTANCE) {
if (Works(ps)) {
FeedSnail(ps, TAKE);
} else
@ -1284,7 +1284,7 @@ void Sprite::Touch(uint16 mask, int x, int y) {
if (_flags._kept)
mask |= L_UP;
else {
if (Hero->Distance(this) < MAX_DISTANCE) {
if (Hero->distance(this) < MAX_DISTANCE) {
///
if (_flags._port) {
if (FindPocket(NULL) < 0)
@ -1325,7 +1325,7 @@ void Sprite::Touch(uint16 mask, int x, int y) {
}
void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int row = 0, int pos = 0) {
void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int row = 0, int pos = 0) {
static const char *Comd[] = { "Name", "Type", "Phase", "East",
"Left", "Right", "Top", "Bottom",
"Seq", "Near", "Take",
@ -1348,7 +1348,7 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
MergeExt(line, fname, SPR_EXT);
if (INI_FILE::exist(line)) { // sprite description file exist
INI_FILE sprf(line);
if (sprf.Error)
if (sprf._error)
error("Bad SPR [%s]", line);
while ((len = sprf.read((uint8 *)line)) != 0) {
@ -1445,7 +1445,7 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
break;
}
case 5 : { // FLY
FLY *f = new FLY(this, NULL);
Fly *f = new Fly(this, NULL);
_sprite = f;
//////Sprite->Time = 1;//-----------$$$$$$$$$$$$$$
break;
@ -1479,7 +1479,7 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
}
void CGEEngine::LoadScript(const char *fname) {
void CGEEngine::loadScript(const char *fname) {
char line[LINE_MAX];
char *SpN;
int SpI, SpA, SpX, SpY, SpZ;
@ -1488,13 +1488,13 @@ void CGEEngine::LoadScript(const char *fname) {
int lcnt = 0;
bool ok = true;
if (scrf.Error)
if (scrf._error)
return;
while (scrf.read((uint8 *)line) != 0) {
char *p;
++lcnt;
lcnt++;
if (*line == 0 || *line == '\n' || *line == '.')
continue;
@ -1530,7 +1530,7 @@ void CGEEngine::LoadScript(const char *fname) {
ok = true; // no break: OK
_sprite = NULL;
LoadSprite(SpN, SpI, SpA, SpX, SpY, SpZ);
loadSprite(SpN, SpI, SpA, SpX, SpY, SpZ);
if (_sprite && BkG)
_sprite->_flags._back = true;
}
@ -1539,7 +1539,7 @@ void CGEEngine::LoadScript(const char *fname) {
}
void CGEEngine::MainLoop() {
void CGEEngine::mainLoop() {
SayDebug();
if (_isDemo) {
@ -1564,28 +1564,28 @@ void CGEEngine::MainLoop() {
}
void CGEEngine::LoadUser() {
void CGEEngine::loadUser() {
// set scene
if (STARTUP::Mode == 0) { // user .SVG file found
CFile cfile = CFile(UsrPath(UsrFnam), REA, RCrypt);
LoadGame(cfile);
loadGame(cfile);
} else {
if (STARTUP::Mode == 1) {
SVG0FILE file = SVG0FILE(SVG0NAME);
LoadGame(file);
loadGame(file);
} else {
LoadScript(ProgName(INI_EXT));
loadScript(ProgName(INI_EXT));
Music = true;
CFile file = CFile(SVG0NAME, WRI);
SaveGame(file);
error("Ok [%s]", SVG0NAME);
}
}
LoadScript(ProgName(IN0_EXT));
loadScript(ProgName(IN0_EXT));
}
void CGEEngine::RunGame() {
void CGEEngine::runGame() {
Text->Clear();
Text->Preload(100, 1000);
LoadHeroXY();
@ -1613,7 +1613,7 @@ void CGEEngine::RunGame() {
// Vga->ShowQ->Append(Mouse);
// ___________
LoadUser();
loadUser();
// ~~~~~~~~~~~
if ((_sprite = Vga->SpareQ->Locate(121)) != NULL)
@ -1627,7 +1627,7 @@ void CGEEngine::RunGame() {
if (Mini && INI_FILE::exist("MINI.SPR")) {
uint8 *ptr = (uint8 *) &*Mini;
if (ptr != NULL) {
LoadSprite("MINI", -1, 0, MINI_X, MINI_Y);
loadSprite("MINI", -1, 0, MINI_X, MINI_Y);
ExpandSprite(_miniCave = _sprite); // NULL is ok
if (_miniCave) {
_miniCave->_flags._hide = true;
@ -1643,7 +1643,7 @@ void CGEEngine::RunGame() {
ExpandSprite(Hero);
Hero->Goto(HeroXY[Now - 1]._x, HeroXY[Now - 1]._y);
if (INI_FILE::exist("00SHADOW.SPR")) {
LoadSprite("00SHADOW", -1, 0, Hero->_x + 14, Hero->_y + 51);
loadSprite("00SHADOW", -1, 0, Hero->_x + 14, Hero->_y + 51);
if ((_shadow = _sprite) != NULL) {
_shadow->_ref = 2;
_shadow->_flags._tran = true;
@ -1674,7 +1674,7 @@ void CGEEngine::RunGame() {
SNPOST(SNLEVEL, -1, OldLev, &_cavLight);
_cavLight->Goto(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX,
CAVE_Y + ((Now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY);
CaveUp();
caveUp();
KEYBOARD::SetClient(Sys);
// main loop
@ -1682,7 +1682,7 @@ void CGEEngine::RunGame() {
//TODO Change the SNPOST message send to a special way to send function pointer
// if (FINIS) SNPOST(SNEXEC, -1, 0, (void *)&QGame);
warning("RunGame: problematic use of SNPOST");
MainLoop();
mainLoop();
}
KEYBOARD::SetClient(NULL);
@ -1697,10 +1697,10 @@ void CGEEngine::RunGame() {
}
void CGEEngine::Movie(const char *ext) {
void CGEEngine::movie(const char *ext) {
const char *fn = ProgName(ext);
if (INI_FILE::exist(fn)) {
LoadScript(fn);
loadScript(fn);
ExpandSprite(Vga->SpareQ->Locate(999));
FeedSnail(Vga->ShowQ->Locate(999), TAKE);
@ -1710,7 +1710,7 @@ void CGEEngine::Movie(const char *ext) {
_heart->_enable = true;
KEYBOARD::SetClient(Sys);
while (!Snail->Idle())
MainLoop();
mainLoop();
KEYBOARD::SetClient(NULL);
_heart->_enable = false;
@ -1722,7 +1722,7 @@ void CGEEngine::Movie(const char *ext) {
}
bool CGEEngine::ShowTitle(const char *name) {
bool CGEEngine::showTitle(const char *name) {
Bitmap::_pal = VGA::SysPal;
BMP_PTR LB[] = { new Bitmap(name, true), NULL };
Bitmap::_pal = NULL;
@ -1735,7 +1735,7 @@ bool CGEEngine::ShowTitle(const char *name) {
D.Show(2);
if (STARTUP::Mode == 2) {
Inf(SVG0NAME);
inf(SVG0NAME);
Talk->Show(2);
}
@ -1751,8 +1751,8 @@ bool CGEEngine::ShowTitle(const char *name) {
Vga->ShowQ->Append(Mouse);
_heart->_enable = true;
Mouse->On();
for (SelectSound(); !Snail->Idle() || VMENU::Addr;)
MainLoop();
for (selectSound(); !Snail->Idle() || VMENU::Addr;)
mainLoop();
Mouse->Off();
_heart->_enable = false;
Vga->ShowQ->Clear();
@ -1781,14 +1781,14 @@ bool CGEEngine::ShowTitle(const char *name) {
STARTUP::Summa |= Lo(sn) | Hi(sn);
#endif
//-----------------------------------------
Movie("X00"); // paylist
movie("X00"); // paylist
Vga->CopyPage(1, 2);
Vga->CopyPage(0, 1);
Vga->ShowQ->Append(Mouse);
//Mouse.On();
_heart->_enable = true;
for (TakeName(); GET_TEXT::Ptr;)
MainLoop();
for (takeName(); GET_TEXT::Ptr;)
mainLoop();
_heart->_enable = false;
if (KEYBOARD::Last() == Enter && *UsrFnam)
usr_ok = true;
@ -1804,7 +1804,7 @@ bool CGEEngine::ShowTitle(const char *name) {
const char *n = UsrPath(UsrFnam);
if (CFile::exist(n)) {
CFile file = CFile(n, REA, RCrypt);
LoadGame(file, true); // only system vars
loadGame(file, true); // only system vars
Vga->SetColors(VGA::SysPal, 64);
Vga->Update();
if (FINIS) {
@ -1817,7 +1817,7 @@ bool CGEEngine::ShowTitle(const char *name) {
}
if (STARTUP::Mode < 2)
Movie("X01"); // wink
movie("X01"); // wink
Vga->CopyPage(0, 2);
@ -1859,14 +1859,14 @@ void CGEEngine::cge_main(void) {
if (Music && STARTUP::SoundOk)
LoadMIDI(0);
if (STARTUP::Mode < 2)
Movie(LGO_EXT);
if (ShowTitle("WELCOME")) {
movie(LGO_EXT);
if (showTitle("WELCOME")) {
if ((!_isDemo) && (STARTUP::Mode == 1))
Movie("X02"); // intro
RunGame();
movie("X02"); // intro
runGame();
Startup = 2;
if (FINIS)
Movie("X03");
movie("X03");
} else
Vga->Sunset();
error("%s", Text->getText(EXIT_OK_TEXT + FINIS));

View File

@ -129,39 +129,39 @@ private:
};
class CLUSTER : public COUPLE {
class Cluster : public Couple {
public:
static uint8 Map[MAP_ZCNT][MAP_XCNT];
uint8 &Cell(void);
CLUSTER(void) : COUPLE() { }
CLUSTER(int a, int b) : COUPLE(a, b) { }
static uint8 _map[MAP_ZCNT][MAP_XCNT];
uint8 &cell(void);
Cluster(void) : Couple() { }
Cluster(int a, int b) : Couple(a, b) { }
bool Protected(void);
};
class WALK : public Sprite {
public:
CLUSTER Here;
int TracePtr;
Cluster _here;
int _tracePtr;
enum DIR { NO_DIR = -1, NN, EE, SS, WW } Dir;
WALK(CGEEngine *vm, BMP_PTR *shpl);
void Tick(void);
void FindWay(CLUSTER c);
void FindWay(Sprite *spr);
int Distance(Sprite *spr);
void Turn(DIR d);
void Park(void);
bool Lower(Sprite *spr);
void Reach(Sprite *spr, int mode = -1);
void tick();
void findWay(Cluster c);
void findWay(Sprite *spr);
int distance(Sprite *spr);
void turn(DIR d);
void park();
bool lower(Sprite *spr);
void reach(Sprite *spr, int mode = -1);
private:
CGEEngine *_vm;
};
CLUSTER XZ(int x, int y);
CLUSTER XZ(COUPLE xy);
Cluster XZ(int x, int y);
Cluster XZ(Couple xy);
void ExpandSprite(Sprite *spr);
void ContractSprite(Sprite *spr);

View File

@ -77,76 +77,76 @@ static CHOICE DevMenu[] = {
static CHOICE DigiPorts[] = {
{ " 210h", &CGEEngine::SetPortD },
{ " 220h", &CGEEngine::SetPortD },
{ " 230h", &CGEEngine::SetPortD },
{ " 240h", &CGEEngine::SetPortD },
{ " 250h", &CGEEngine::SetPortD },
{ " 260h", &CGEEngine::SetPortD },
{ "AUTO ", &CGEEngine::SetPortD },
{ " 210h", &CGEEngine::setPortD },
{ " 220h", &CGEEngine::setPortD },
{ " 230h", &CGEEngine::setPortD },
{ " 240h", &CGEEngine::setPortD },
{ " 250h", &CGEEngine::setPortD },
{ " 260h", &CGEEngine::setPortD },
{ "AUTO ", &CGEEngine::setPortD },
{ NULL, NULL }
};
static CHOICE MIDIPorts[] = {
{ " 220h", &CGEEngine::SetPortM },
{ " 230h", &CGEEngine::SetPortM },
{ " 240h", &CGEEngine::SetPortM },
{ " 250h", &CGEEngine::SetPortM },
{ " 300h", &CGEEngine::SetPortM },
{ " 320h", &CGEEngine::SetPortM },
{ " 330h", &CGEEngine::SetPortM },
{ " 340h", &CGEEngine::SetPortM },
{ " 350h", &CGEEngine::SetPortM },
{ " 360h", &CGEEngine::SetPortM },
{ "AUTO ", &CGEEngine::SetPortM },
{ " 220h", &CGEEngine::setPortM },
{ " 230h", &CGEEngine::setPortM },
{ " 240h", &CGEEngine::setPortM },
{ " 250h", &CGEEngine::setPortM },
{ " 300h", &CGEEngine::setPortM },
{ " 320h", &CGEEngine::setPortM },
{ " 330h", &CGEEngine::setPortM },
{ " 340h", &CGEEngine::setPortM },
{ " 350h", &CGEEngine::setPortM },
{ " 360h", &CGEEngine::setPortM },
{ "AUTO ", &CGEEngine::setPortM },
{ NULL, NULL }
};
static CHOICE BlsterIRQ[] = {
{ "IRQ 2", &CGEEngine::SetIRQ },
{ "IRQ 5", &CGEEngine::SetIRQ },
{ "IRQ 7", &CGEEngine::SetIRQ },
{ "IRQ 10", &CGEEngine::SetIRQ },
{ "AUTO ", &CGEEngine::SetIRQ },
{ "IRQ 2", &CGEEngine::setIRQ },
{ "IRQ 5", &CGEEngine::setIRQ },
{ "IRQ 7", &CGEEngine::setIRQ },
{ "IRQ 10", &CGEEngine::setIRQ },
{ "AUTO ", &CGEEngine::setIRQ },
{ NULL, NULL }
};
static CHOICE GravisIRQ[] = {
{ "IRQ 2", &CGEEngine::SetIRQ },
{ "IRQ 5", &CGEEngine::SetIRQ },
{ "IRQ 7", &CGEEngine::SetIRQ },
{ "IRQ 11", &CGEEngine::SetIRQ },
{ "IRQ 12", &CGEEngine::SetIRQ },
{ "IRQ 15", &CGEEngine::SetIRQ },
{ "AUTO ", &CGEEngine::SetIRQ },
{ "IRQ 2", &CGEEngine::setIRQ },
{ "IRQ 5", &CGEEngine::setIRQ },
{ "IRQ 7", &CGEEngine::setIRQ },
{ "IRQ 11", &CGEEngine::setIRQ },
{ "IRQ 12", &CGEEngine::setIRQ },
{ "IRQ 15", &CGEEngine::setIRQ },
{ "AUTO ", &CGEEngine::setIRQ },
{ NULL, NULL }
};
static CHOICE GravisDMA[] = {
{ "DMA 1", &CGEEngine::SetDMA },
{ "DMA 3", &CGEEngine::SetDMA },
{ "DMA 5", &CGEEngine::SetDMA },
{ "DMA 6", &CGEEngine::SetDMA },
{ "DMA 7", &CGEEngine::SetDMA },
{ "AUTO ", &CGEEngine::SetDMA },
{ "DMA 1", &CGEEngine::setDMA },
{ "DMA 3", &CGEEngine::setDMA },
{ "DMA 5", &CGEEngine::setDMA },
{ "DMA 6", &CGEEngine::setDMA },
{ "DMA 7", &CGEEngine::setDMA },
{ "AUTO ", &CGEEngine::setDMA },
{ NULL, NULL }
};
static CHOICE BlsterDMA[] = {
{ "DMA 0", &CGEEngine::SetDMA },
{ "DMA 1", &CGEEngine::SetDMA },
{ "DMA 3", &CGEEngine::SetDMA },
{ "AUTO ", &CGEEngine::SetDMA },
{ "DMA 0", &CGEEngine::setDMA },
{ "DMA 1", &CGEEngine::setDMA },
{ "DMA 3", &CGEEngine::setDMA },
{ "AUTO ", &CGEEngine::setDMA },
{ NULL, NULL }
};
void CGEEngine::SelectSound() {
void CGEEngine::selectSound() {
int i;
Sound.Close();
if (VMENU::Addr)
SNPOST_(SNKILL, -1, 0, VMENU::Addr);
Inf(Text->getText(STYPE_TEXT));
inf(Text->getText(STYPE_TEXT));
Talk->Goto(Talk->_x, FONT_HIG / 2);
for (i = 0; i < ArrayCount(DevName); i++)
DevMenu[i].Text = Text->getText(DevName[i]);
@ -183,7 +183,7 @@ static CHOICE *Cho;
static int Hlp;
void CGEEngine::SNSelect() {
Inf(Text->getText(Hlp));
inf(Text->getText(Hlp));
Talk->Goto(Talk->_x, FONT_HIG / 2);
(new VMENU(this, Cho, SCR_WID / 2, Talk->_y + Talk->_h + TEXT_VM + FONT_HIG))->SetName(Text->getText(MENU_TEXT));
}
@ -253,25 +253,25 @@ void CGEEngine::AUTO() {
}
void CGEEngine::SetPortD() {
void CGEEngine::setPortD() {
SNDDrvInfo.DBASE = xdeco(DigiPorts[VMENU::Recent].Text);
Select((SNDDrvInfo.DDEV == DEV_SB) ? BlsterIRQ : GravisIRQ, SIRQ_TEXT);
}
void CGEEngine::SetPortM() {
void CGEEngine::setPortM() {
SNDDrvInfo.MBASE = xdeco(MIDIPorts[VMENU::Recent].Text);
Sound.Open();
}
void CGEEngine::SetIRQ() {
void CGEEngine::setIRQ() {
SNDDrvInfo.DIRQ = ddeco(((SNDDrvInfo.DDEV == DEV_SB) ? BlsterIRQ : GravisIRQ)[VMENU::Recent].Text);
Select((SNDDrvInfo.DDEV == DEV_SB) ? BlsterDMA : GravisDMA, SDMA_TEXT);
}
void CGEEngine::SetDMA() {
void CGEEngine::setDMA() {
SNDDrvInfo.DDMA = ddeco(((SNDDrvInfo.DDEV == DEV_SB) ? BlsterDMA : GravisDMA)[VMENU::Recent].Text);
if (SNDDrvInfo.MDEV != SNDDrvInfo.DDEV)
Select(MIDIPorts, MPORT_TEXT);

View File

@ -30,7 +30,7 @@
namespace CGE {
void SelectSound(void);
void selectSound();
} // End of namespace CGE

View File

@ -41,10 +41,10 @@ enum EMM_FUN {
};
void *EMM::Frame = NULL;
void *EMM::_frame = NULL;
EMM::EMM(long size): Han(-1), Top(0), Lim(0), List(NULL) {
EMM::EMM(long size): _han(-1), _top(0), _lim(0), _list(NULL) {
/*
if (Test())
{
@ -97,7 +97,7 @@ EMM::~EMM(void) {
}
bool EMM::Test(void) {
bool EMM::test() {
/*
static char e[] = "EMMXXXX0";
@ -130,7 +130,7 @@ bool EMM::Test(void) {
}
EMS *EMM::Alloc(uint16 siz) {
EMS *EMM::alloc(uint16 siz) {
/*
long size = SIZ(siz),
top = Top;
@ -167,22 +167,22 @@ EMS *EMM::Alloc(uint16 siz) {
}
fail: return NULL;
*/
warning("STUB: EMM::Alloc");
warning("STUB: EMM::alloc");
return NULL;
}
void EMM::Release(void) {
while (List) {
EMS *e = List;
List = e->Nxt;
void EMM::release() {
while (_list) {
EMS *e = _list;
_list = e->_next;
delete e;
}
Top = 0;
_top = 0;
}
EMS::EMS(void) : Ptr(0), Siz(0), Nxt(NULL) {
EMS::EMS(void) : _ptr(0), _size(0), _next(NULL) {
}
@ -193,7 +193,7 @@ void *EMS::operator & () const {
cnt = (uint16) ((Ptr + SIZ(Siz) + PAGE_MASK) >> 14) - pgn,
cmd = MAP_PAGE << 8;
_DX = Emm->Han; // take EMM handle
_DX = Emm->_han; // take EMM handle
asm dec cnt // prapare for deferred checking
asm or dx,dx // see if valid
asm jns more // negative handle = unavailable
@ -218,8 +218,8 @@ void *EMS::operator & () const {
}
uint16 EMS::Size(void) {
return Siz;
uint16 EMS::size() {
return _size;
}
} // End of namespace CGE

View File

@ -31,20 +31,20 @@
namespace CGE {
uint8 *Glass(DAC *pal, uint8 r, uint8 g, uint8 b) {
uint8 *glass(Dac *pal, uint8 r, uint8 g, uint8 b) {
uint8 *x = new uint8[256];
if (x) {
uint16 i;
for (i = 0; i < 256; i++) {
x[i] = Closest(pal, MkDAC(((uint16)(pal[i].R) * r) / 255,
((uint16)(pal[i].G) * g) / 255,
((uint16)(pal[i].B) * b) / 255));
x[i] = Closest(pal, MkDAC(((uint16)(pal[i]._r) * r) / 255,
((uint16)(pal[i]._g) * g) / 255,
((uint16)(pal[i]._b) * b) / 255));
}
}
return x;
}
/* Useless?
uint8 *Mark(DAC *pal) {
#define f(c) (c ^ 63)
uint8 *x = new uint8[256];
@ -59,33 +59,33 @@ uint8 *Mark(DAC *pal) {
return x;
#undef f
}
*/
int Fly::_l = 20,
Fly::_t = 40,
Fly::_r = 110,
Fly::_b = 100;
int FLY::L = 20,
FLY::T = 40,
FLY::R = 110,
FLY::B = 100;
FLY::FLY(CGEEngine *vm, Bitmap **shpl)
: Sprite(vm, shpl), Tx(0), Ty(0), _vm(vm) {
Fly::Fly(CGEEngine *vm, Bitmap **shpl)
: Sprite(vm, shpl), _tx(0), _ty(0), _vm(vm) {
Step(new_random(2));
Goto(L + new_random(R - L - _w), T + new_random(B - T - _h));
Goto(_l + new_random(_r - _l - _w), _t + new_random(_b - _t - _h));
}
void FLY::Tick(void) {
void Fly::tick() {
Step();
if (!_flags._kept) {
if (new_random(10) < 1) {
Tx = new_random(3) - 1;
Ty = new_random(3) - 1;
_tx = new_random(3) - 1;
_ty = new_random(3) - 1;
}
if (_x + Tx < L || _x + Tx + _w > R)
Tx = -Tx;
if (_y + Ty < T || _y + Ty + _h > B)
Ty = -Ty;
Goto(_x + Tx, _y + Ty);
if (_x + _tx < _l || _x + _tx + _w > _r)
_tx = -_tx;
if (_y + _ty < _t || _y + _ty + _h > _b)
_ty = -_ty;
Goto(_x + _tx, _y + _ty);
}
}

View File

@ -34,22 +34,25 @@
namespace CGE {
#define PAN_HIG 40
#define LBound(s) (s->X <= 0)
#define RBound(s) (s->X+s->W >= SCR_WID)
#define TBound(s) (s->Y <= 0)
#define BBound(s) (s->Y+s->H >= SCR_HIG - PAN_HIG)
//#define PAN_HIG 40
//#define LBound(s) (s->X <= 0)
//#define RBound(s) (s->X+s->W >= SCR_WID)
//#define TBound(s) (s->Y <= 0)
//#define BBound(s) (s->Y+s->H >= SCR_HIG - PAN_HIG)
int Sinus(long x);
uint8 *Glass(DAC *pal, uint8 r, uint8 g, uint8 b);
uint8 *Mark(DAC *pal);
//int sinus(long x);
uint8 *glass(Dac *pal, uint8 r, uint8 g, uint8 b);
//uint8 *mark(DAC *pal);
class FLY : public Sprite {
static int L, T, R, B;
class Fly : public Sprite {
static int _l;
static int _t;
static int _r;
static int _b;
public:
int Tx, Ty;
FLY(CGEEngine *vm, Bitmap **shpl);
void Tick(void);
int _tx, _ty;
Fly(CGEEngine *vm, Bitmap **shpl);
void tick();
private:
CGEEngine *_vm;
};

View File

@ -32,7 +32,7 @@
namespace CGE {
DAC StdPal[] = {// R G B
Dac _stdPal[] = {// R G B
{ 0, 60, 0}, // 198
{ 0, 104, 0}, // 199
{ 20, 172, 0}, // 200
@ -212,12 +212,12 @@ char *dwtom(uint32 val, char *str, int radix, int len) {
}
IoHand::IoHand(IOMODE mode, CRYPT *crpt)
: XFILE(mode), _crypt(crpt), _seed(SEED) {
: XFile(mode), _crypt(crpt), _seed(SEED) {
_file = new Common::File();
}
IoHand::IoHand(const char *name, IOMODE mode, CRYPT *crpt)
: XFILE(mode), _crypt(crpt), _seed(SEED) {
: XFile(mode), _crypt(crpt), _seed(SEED) {
// TODO: Check if WRI and/or UPD modes are needed, and map to a save file
assert(mode == REA);
@ -231,7 +231,7 @@ IoHand::~IoHand(void) {
}
uint16 IoHand::read(void *buf, uint16 len) {
if (Mode == WRI || !_file->isOpen())
if (_mode == WRI || !_file->isOpen())
return 0;
uint16 bytesRead = _file->read(buf, len);
@ -327,7 +327,7 @@ EC void SNDMIDIStop() {
// FIXME: STUB: SNDMIDIStop
}
DATACK *LoadWave(XFILE *file, EMM *emm) {
DATACK *LoadWave(XFile *file, EMM *emm) {
warning("STUB: LoadWave");
return NULL;
}
@ -377,10 +377,9 @@ int new_random(int range) {
}
#define TIMER_INT 0x08
//void interrupt (* ENGINE::OldTimer) (...) = NULL;
//void interrupt (* Engine_::oldTimer) (...) = NULL;
ENGINE::ENGINE (uint16 tdiv)
{
Engine_::Engine_(uint16 tdiv) {
/*
// steal timer interrupt
OldTimer = getvect(TIMER_INT);
@ -394,11 +393,10 @@ ENGINE::ENGINE (uint16 tdiv)
asm mov al,ah
asm out 0x40,al
*/
warning("STUB: ENGINE::ENGINE");
warning("STUB: Engine_::Engine_");
}
ENGINE::~ENGINE (void)
{
Engine_::~Engine_() {
/*
// reset timer
asm mov al,0x36
@ -409,12 +407,12 @@ ENGINE::~ENGINE (void)
// bring back timer interrupt
setvect(TIMER_INT, OldTimer);
*/
warning("STUB: ENGINE::~ENGINE");
warning("STUB: Engine_::~Engine_");
}
DATACK::~DATACK (void)
{
if (!e && Buf) free(Buf);
DATACK::~DATACK () {
if (!e && Buf)
free(Buf);
}
} // End of namespace CGE

View File

@ -54,59 +54,59 @@ enum MEM_TYPE { BAD_MEM, EMS_MEM, NEAR_MEM, FAR_MEM };
enum ALLOC_MODE { FIRST_FIT, BEST_FIT, LAST_FIT };
enum IOMODE { REA, WRI, UPD };
typedef struct {
uint8 R, G, B;
} DAC;
struct Dac {
uint8 _r, _g, _b;
};
typedef uint16 CRYPT(void *buf, uint16 siz, uint16 seed);
class COUPLE {
class Couple {
protected:
signed char A;
signed char B;
signed char _a;
signed char _b;
public:
COUPLE(void) { }
COUPLE(const signed char a, const signed char b) : A(a), B(b) { }
COUPLE operator + (COUPLE c) {
return COUPLE(A + c.A, B + c.B);
Couple() { }
Couple(const signed char a, const signed char b) : _a(a), _b(b) { }
Couple operator + (Couple c) {
return Couple(_a + c._a, _b + c._b);
}
void operator += (COUPLE c) {
A += c.A;
B += c.B;
void operator += (Couple c) {
_a += c._a;
_b += c._b;
}
COUPLE operator - (COUPLE c) {
return COUPLE(A - c.A, B - c.B);
Couple operator - (Couple c) {
return Couple(_a - c._a, _b - c._b);
}
void operator -= (COUPLE c) {
A -= c.A;
B -= c.B;
void operator -= (Couple c) {
_a -= c._a;
_b -= c._b;
}
bool operator == (COUPLE c) {
return ((A - c.A) | (B - c.B)) == 0;
bool operator == (Couple c) {
return ((_a - c._a) | (_b - c._b)) == 0;
}
bool operator != (COUPLE c) {
bool operator != (Couple c) {
return !(operator == (c));
}
void Split(signed char &a, signed char &b) {
a = A;
b = B;
void split(signed char &a, signed char &b) {
a = _a;
b = _b;
}
};
class ENGINE {
class Engine_ {
protected:
static void (* OldTimer)(...);
static void NewTimer(...);
static void (* oldTimer)(...);
static void newTimer(...);
public:
ENGINE(uint16 tdiv);
~ENGINE(void);
Engine_(uint16 tdiv);
~Engine_(void);
};
@ -115,29 +115,31 @@ class EMS;
class EMM {
friend class EMS;
bool Test(void);
long Top, Lim;
EMS *List;
int Han;
static void *Frame;
bool test();
long _top;
long _lim;
EMS *_list;
int _han;
static void *_frame;
public:
EMM(long size = 0);
~EMM(void);
EMS *Alloc(uint16 siz);
void Release(void);
~EMM();
EMS *alloc(uint16 siz);
void release();
};
class EMS {
friend class EMM;
EMM *Emm;
long Ptr;
uint16 Siz;
EMS *Nxt;
EMM *_emm;
long _ptr;
uint16 _size;
EMS *_next;
public:
EMS(void);
EMS();
void *operator & () const;
uint16 Size(void);
uint16 size(void);
};
@ -162,28 +164,29 @@ T min(T A, T B) {
#endif
class XFILE {
class XFile {
public:
IOMODE Mode;
uint16 Error;
XFILE(void) : Mode(REA), Error(0) { }
XFILE(IOMODE mode) : Mode(mode), Error(0) { }
IOMODE _mode;
uint16 _error;
XFile() : _mode(REA), _error(0) { }
XFile(IOMODE mode) : _mode(mode), _error(0) { }
virtual ~XFile() { }
virtual uint16 read(void *buf, uint16 len) = 0;
virtual uint16 write(void *buf, uint16 len) = 0;
virtual long mark(void) = 0;
virtual long size(void) = 0;
virtual long mark() = 0;
virtual long size() = 0;
virtual long seek(long pos) = 0;
virtual ~XFILE() { }
};
template <class T>
inline uint16 XRead(XFILE *xf, T *t) {
inline uint16 XRead(XFile *xf, T *t) {
return xf->read((uint8 *) t, sizeof(*t));
}
class IoHand : public XFILE {
class IoHand : public XFile {
protected:
Common::File *_file;
uint16 _seed;

View File

@ -311,7 +311,7 @@ void SelectPocket(int n) {
void PocFul(void) {
Hero->Park();
Hero->park();
SNPOST(SNWAIT, -1, -1, Hero);
SNPOST(SNSEQ, -1, POC_FUL, Hero);
SNPOST(SNSOUND, -1, 2, Hero);
@ -544,7 +544,7 @@ static void SNRmTake(Sprite *spr) {
void SNSeq(Sprite *spr, int val) {
if (spr) {
if (spr == Hero && val == 0)
Hero->Park();
Hero->park();
else
spr->Step(val);
}
@ -846,17 +846,17 @@ static void SNSetRef(Sprite *spr, int nr) {
void SNFlash(bool on) {
if (on) {
DAC *pal = farnew(DAC, PAL_CNT);
Dac *pal = farnew(Dac, PAL_CNT);
if (pal) {
memcpy(pal, VGA::SysPal, PAL_SIZ);
for (int i = 0; i < PAL_CNT; i++) {
register int c;
c = pal[i].R << 1;
pal[i].R = (c < 64) ? c : 63;
c = pal[i].G << 1;
pal[i].G = (c < 64) ? c : 63;
c = pal[i].B << 1;
pal[i].B = (c < 64) ? c : 63;
c = pal[i]._r << 1;
pal[i]._r = (c < 64) ? c : 63;
c = pal[i]._g << 1;
pal[i]._g = (c < 64) ? c : 63;
c = pal[i]._b << 1;
pal[i]._b = (c < 64) ? c : 63;
}
Vga->SetColors(pal, 64);
}
@ -883,16 +883,16 @@ static void SNBarrier(int cav, int bar, bool horz) {
static void SNWalk(Sprite *spr, int x, int y) {
if (Hero) {
if (spr && y < 0)
Hero->FindWay(spr);
Hero->findWay(spr);
else
Hero->FindWay(XZ(x, y));
Hero->findWay(XZ(x, y));
}
}
static void SNReach(Sprite *spr, int mode) {
if (Hero)
Hero->Reach(spr, mode);
Hero->reach(spr, mode);
}
@ -937,7 +937,7 @@ void SNAIL::RunCom(void) {
case SNWAIT :
if (sprel) {
if (sprel->SeqTest(snc->Val) &&
(snc->Val >= 0 || sprel != Hero || Hero->TracePtr < 0)) {
(snc->Val >= 0 || sprel != Hero || Hero->_tracePtr < 0)) {
_heart->setXTimer(&Pause, sprel->_time);
} else
goto xit;
@ -959,7 +959,7 @@ void SNAIL::RunCom(void) {
break;
case SNINF :
if (TalkEnable) {
_vm->Inf(Text->getText(snc->Val));
_vm->inf(Text->getText(snc->Val));
Sys->FunDel = HEROFUN0;
}
break;

View File

@ -104,7 +104,7 @@ void FX::Clear(void) {
p->Wav = NULL;
}
}
Emm.Release();
Emm.release();
Current = NULL;
}
@ -190,12 +190,12 @@ void LoadMIDI(int ref) {
if (INI_FILE::exist(fn)) {
KillMIDI();
INI_FILE mid = fn;
if (mid.Error == 0) {
if (mid._error == 0) {
uint16 siz = (uint16) mid.size();
midi = new uint8[siz];
if (midi) {
mid.read(midi, siz);
if (mid.Error)
if (mid._error)
KillMIDI();
else
SNDMIDIStart(midi);
@ -211,12 +211,12 @@ EC void *Patch(int pat) {
wtom(pat, fn + 5, 10, 3);
INI_FILE snd = fn;
if (! snd.Error) {
if (!snd._error) {
uint16 siz = (uint16) snd.size();
p = (uint8 *) malloc(siz);
if (p) {
snd.read(p, siz);
if (snd.Error) {
if (snd._error) {
free(p);
p = NULL;
}

View File

@ -62,9 +62,9 @@ FONT::~FONT() {
void FONT::Load() {
INI_FILE f(Path);
if (! f.Error) {
if (!f._error) {
f.read(Wid, WID_SIZ);
if (! f.Error) {
if (!f._error) {
uint16 i, p = 0;
for (i = 0; i < POS_SIZ; i++) {
Pos[i] = p;

View File

@ -88,7 +88,7 @@ int TEXT::Find(int ref) {
void TEXT::Preload(int from, int upto) {
INI_FILE tf = FileName;
if (! tf.Error) {
if (!tf._error) {
HAN *CacheLim = Cache + Size;
char line[LINE_MAX + 1];
int n;
@ -130,7 +130,7 @@ void TEXT::Preload(int from, int upto) {
char *TEXT::Load(int idx, int ref) {
INI_FILE tf = FileName;
if (! tf.Error) {
if (!tf._error) {
HAN *p = &Cache[idx];
char line[LINE_MAX + 1];
int n;
@ -221,7 +221,7 @@ void TEXT::Say(const char *txt, Sprite *spr) {
}
}
void CGEEngine::Inf(const char *txt) {
void CGEEngine::inf(const char *txt) {
KillText();
Talk = new TALK(this, txt, RECT);
if (Talk) {

View File

@ -189,20 +189,20 @@ void RestoreScreen(uint16 * &sav) {
}
DAC MkDAC(uint8 r, uint8 g, uint8 b) {
static DAC x;
x.R = r;
x.G = g;
x.B = b;
Dac MkDAC(uint8 r, uint8 g, uint8 b) {
static Dac x;
x._r = r;
x._g = g;
x._b = b;
return x;
}
Rgb MkRGB(uint8 r, uint8 g, uint8 b) {
static TRGB x;
x.dac.R = r;
x.dac.G = g;
x.dac.B = b;
x.dac._r = r;
x.dac._g = g;
x.dac._b = b;
return x.rgb;
}
@ -214,7 +214,7 @@ Sprite *Locate(int ref) {
Heart::Heart(void)
: ENGINE(TMR_DIV) {
: Engine_(TMR_DIV) {
_enable = false;
_xTimer = NULL;
}
@ -265,7 +265,7 @@ extern "C" void TimerProc() {
*/
void ENGINE::NewTimer(...) {
void Engine_::newTimer(...) {
/*
static SPRITE *spr;
static uint8 run = 0, cntr1 = TMR_RATE1, cntr2 = TMR_RATE2;
@ -338,7 +338,7 @@ void ENGINE::NewTimer(...) {
}
*/
warning("STUB: ENGINE::NewTimer");
warning("STUB: Engine_::NewTimer");
}
@ -505,7 +505,7 @@ Sprite *Sprite::Expand(void) {
MergeExt(fname, File, SPR_EXT);
if (INI_FILE::exist(fname)) { // sprite description file exist
INI_FILE sprf(fname);
if (! (sprf.Error==0))
if (!(sprf._error==0))
error("Bad SPR [%s]", fname);
int len = 0, lcnt = 0;
while ((len = sprf.read((uint8 *)line)) != 0) {
@ -910,7 +910,7 @@ Sprite *QUEUE::Locate(int ref) {
//extern const char Copr[];
Graphics::Surface *VGA::Page[4];
DAC *VGA::SysPal;
Dac *VGA::SysPal;
void VGA::init() {
for (int idx = 0; idx < 4; ++idx) {
@ -918,7 +918,7 @@ void VGA::init() {
Page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
}
SysPal = new DAC[PAL_CNT];
SysPal = new Dac[PAL_CNT];
}
void VGA::deinit() {
@ -953,8 +953,8 @@ VGA::VGA(int mode)
if (StatAdr != VGAST1_)
++Mono;
if (IsVga()) {
OldColors = farnew(DAC, 256);
NewColors = farnew(DAC, 256);
OldColors = farnew(Dac, 256);
NewColors = farnew(Dac, 256);
OldScreen = SaveScreen();
GetColors(OldColors);
Sunset();
@ -1061,45 +1061,45 @@ int VGA::SetMode(int mode) {
}
void VGA::GetColors(DAC *tab) {
void VGA::GetColors(Dac *tab) {
byte palData[PAL_SIZ];
g_system->getPaletteManager()->grabPalette(palData, 0, PAL_CNT);
pal2DAC(palData, tab);
}
void VGA::pal2DAC(const byte *palData, DAC *tab) {
void VGA::pal2DAC(const byte *palData, Dac *tab) {
const byte *colP = palData;
for (int idx = 0; idx < PAL_CNT; ++idx, colP += 3) {
tab[idx].R = *colP;
tab[idx].G = *(colP + 1);
tab[idx].B = *(colP + 2);
tab[idx]._r = *colP;
tab[idx]._g = *(colP + 1);
tab[idx]._b = *(colP + 2);
}
}
void VGA::DAC2pal(const DAC *tab, byte *palData) {
void VGA::DAC2pal(const Dac *tab, byte *palData) {
for (int idx = 0; idx < PAL_CNT; ++idx, palData += 3) {
*palData = tab[idx].R << 2;
*(palData + 1) = tab[idx].G << 2;
*(palData + 2) = tab[idx].B << 2;
*palData = tab[idx]._r << 2;
*(palData + 1) = tab[idx]._g << 2;
*(palData + 2) = tab[idx]._b << 2;
}
}
void VGA::SetColors(DAC *tab, int lum) {
DAC *palP = tab;
void VGA::SetColors(Dac *tab, int lum) {
Dac *palP = tab;
for (int idx = 0; idx < PAL_CNT; ++idx, ++palP) {
palP->R = (palP->R * lum) >> 6;
palP->G = (palP->G * lum) >> 6;
palP->B = (palP->B * lum) >> 6;
palP->_r = (palP->_r * lum) >> 6;
palP->_g = (palP->_g * lum) >> 6;
palP->_b = (palP->_b * lum) >> 6;
}
if (Mono) {
palP = tab;
for (int idx = 0; idx < PAL_CNT; ++idx, ++palP) {
// Form a greyscalce colour from 30% R, 59% G, 11% B
uint8 intensity = (palP->R * 77) + (palP->G * 151) + (palP->B * 28);
palP->R = intensity;
palP->G = intensity;
palP->B = intensity;
uint8 intensity = (palP->_r * 77) + (palP->_g * 151) + (palP->_b * 28);
palP->_r = intensity;
palP->_g = intensity;
palP->_b = intensity;
}
}
@ -1113,7 +1113,7 @@ void VGA::SetColors(void) {
}
void VGA::Sunrise(DAC *tab) {
void VGA::Sunrise(Dac *tab) {
for (int i = 0; i <= 64; i += FADE_STEP) {
SetColors(tab, i);
WaitVR(true);
@ -1123,7 +1123,7 @@ void VGA::Sunrise(DAC *tab) {
void VGA::Sunset(void) {
DAC tab[256];
Dac tab[256];
GetColors(tab);
for (int i = 64; i >= 0; i -= FADE_STEP) {
SetColors(tab, i);

View File

@ -91,7 +91,7 @@ struct Rgb {
};
typedef union {
DAC dac;
Dac dac;
Rgb rgb;
} TRGB;
@ -133,8 +133,8 @@ extern Seq _seq2[];
#define VGAST1 (VGAST1_ & 0xFF)
class Heart : public ENGINE {
friend class ENGINE;
class Heart : public Engine_ {
friend class Engine_;
public:
Heart();
@ -263,7 +263,8 @@ class VGA {
uint16 *OldScreen;
uint16 StatAdr;
bool SetPal;
DAC *OldColors, *NewColors;
Dac *OldColors;
Dac *NewColors;
const char *Msg;
const char *Nam;
@ -277,7 +278,7 @@ public:
QUEUE *ShowQ, *SpareQ;
int Mono;
static Graphics::Surface *Page[4];
static DAC *SysPal;
static Dac *SysPal;
VGA(int mode);
~VGA(void);
@ -285,21 +286,21 @@ public:
static void deinit();
void Setup(VgaRegBlk *vrb);
void GetColors(DAC *tab);
void SetColors(DAC *tab, int lum);
void GetColors(Dac *tab);
void SetColors(Dac *tab, int lum);
void Clear(uint8 color);
void CopyPage(uint16 d, uint16 s);
void Sunrise(DAC *tab);
void Sunrise(Dac *tab);
void Sunset(void);
void Show(void);
void Update(void);
static void pal2DAC(const byte *palData, DAC *tab);
static void DAC2pal(const DAC *tab, byte *palData);
static void pal2DAC(const byte *palData, Dac *tab);
static void DAC2pal(const Dac *tab, byte *palData);
};
DAC MkDAC(uint8 r, uint8 g, uint8 b);
Dac MkDAC(uint8 r, uint8 g, uint8 b);
Rgb MkRGB(uint8 r, uint8 g, uint8 b);
@ -307,15 +308,15 @@ template <class CBLK>
uint8 Closest(CBLK *pal, CBLK x) {
#define f(col, lum) ((((uint16)(col)) << 8) / lum)
uint16 i, dif = 0xFFFF, found = 0;
uint16 L = x.R + x.G + x.B;
uint16 L = x._r + x._g + x._b;
if (!L)
++L;
uint16 R = f(x.R, L), G = f(x.G, L), B = f(x.B, L);
uint16 R = f(x._r, L), G = f(x._g, L), B = f(x._b, L);
for (i = 0; i < 256; i++) {
uint16 l = pal[i].R + pal[i].G + pal[i].B;
uint16 l = pal[i]._r + pal[i]._g + pal[i]._b;
if (! l)
++l;
int r = f(pal[i].R, l), g = f(pal[i].G, l), b = f(pal[i].B, l);
int r = f(pal[i]._r, l), g = f(pal[i]._g, l), b = f(pal[i]._b, l);
uint16 D = ((r > R) ? (r - R) : (R - r)) +
((g > G) ? (g - G) : (G - g)) +
((b > B) ? (b - B) : (B - b)) +

View File

@ -70,11 +70,11 @@ void VFILE::deinit() {
VFILE::VFILE(const char *name, IOMODE mode)
: IoBuf(mode) {
if (mode == REA) {
if (_dat->_File.Error || _cat->Error)
if (_dat->_File._error || _cat->_error)
error("Bad volume data");
BtKeypack *kp = _cat->find(name);
if (scumm_stricmp(kp->_key, name) != 0)
Error = 1;
_error = 1;
_endMark = (_bufMark = _begMark = kp->_mark) + kp->_size;
}
#ifdef VOL_UPD

View File

@ -49,7 +49,7 @@ class CKID { // Chunk type identifier
uint32 Id;
};
protected:
static XFILE *ckFile;
static XFile *ckFile;
public:
CKID(FOURCC t) {
memcpy(Tx, t, sizeof(Tx));
@ -57,7 +57,7 @@ public:
CKID(uint32 d) {
Id = d;
}
CKID(XFILE *xf) {
CKID(XFile *xf) {
(ckFile = xf)->read(Tx, sizeof(Tx));
}
bool operator !=(CKID &X) {
@ -74,7 +74,7 @@ class CKHEA : public CKID {
protected:
CKSIZE ckSize; // Chunk size field (size of ckData)
public:
CKHEA(XFILE *xf) : CKID(xf) {
CKHEA(XFile *xf) : CKID(xf) {
XRead(xf, &ckSize);
}
CKHEA(char id[]) : CKID(id), ckSize(0) { }
@ -145,7 +145,7 @@ extern CKID FMT;
extern CKID DATA;
DATACK *LoadWave(XFILE *file, EMM *emm = NULL);
DATACK *LoadWave(XFile *file, EMM *emm = NULL);
} // End of namespace CGE