CGE: Misc cleanup (provided by Digitall)

This commit is contained in:
Strangerke 2011-06-29 09:57:16 +02:00
parent e1b6bc0427
commit 91dc5f424a
11 changed files with 41 additions and 73 deletions

View File

@ -140,6 +140,8 @@ BITMAP::~BITMAP(void) {
case FAR_MEM : case FAR_MEM :
free(V); free(V);
default: default:
warning("Unhandled MemType in Bitmap destructor");
break;
break; break;
} }
} }
@ -193,6 +195,9 @@ BMP_PTR BITMAP::Code(void) {
case FAR_MEM : case FAR_MEM :
free(V); free(V);
break; break;
default:
warning("Unhandled MemType in Bitmap::Code()");
break;
} }
V = NULL; V = NULL;
} }

View File

@ -262,7 +262,7 @@ void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
file.Read((uint8 *) &i, sizeof(i)); file.Read((uint8 *) &i, sizeof(i));
if (i != SVGCHKSUM) if (i != SVGCHKSUM)
error(Text->getText(BADSVG_TEXT)); error("%s", Text->getText(BADSVG_TEXT));
if (STARTUP::Core < CORE_HIG) if (STARTUP::Core < CORE_HIG)
Music = false; Music = false;
@ -357,6 +357,7 @@ static void TooFar(void) {
} }
// Used in stubbed function, do not remove!
static void NoWay(void) { static void NoWay(void) {
Trouble(NO_WAY, NO_WAY_TEXT); Trouble(NO_WAY, NO_WAY_TEXT);
} }
@ -582,15 +583,12 @@ void CGEEngine::SetMapBrick(int x, int z) {
} }
} }
//static void SwitchMapping(void);
static void SwitchColorMode(void); static void SwitchColorMode(void);
//static void StartCountDown(void);
static void SwitchDebug(void); static void SwitchDebug(void);
static void SwitchMusic(void); static void SwitchMusic(void);
static void KillSprite(void); static void KillSprite(void);
static void PushSprite(void); static void PushSprite(void);
static void PullSprite(void); static void PullSprite(void);
static void BackPaint(void);
static void NextStep(void); static void NextStep(void);
static void SaveMapping(void); static void SaveMapping(void);
@ -631,7 +629,7 @@ static void AltCtrlDel(void) {
SNPOST_(SNSAY, -1, A_C_D_TEXT, Hero); SNPOST_(SNSAY, -1, A_C_D_TEXT, Hero);
} }
// Used in stubbed function, do not remove!
static void MiniStep(int stp) { static void MiniStep(int stp) {
if (stp < 0) if (stp < 0)
_miniCave->Flags.Hide = true; _miniCave->Flags.Hide = true;
@ -1357,7 +1355,7 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
continue; continue;
if ((i = TakeEnum(Comd, strtok(line, " =\t"))) < 0) if ((i = TakeEnum(Comd, strtok(line, " =\t"))) < 0)
error("%s [%s]", NumStr("Bad line ######", lcnt), fname); error("%s [%s]", NumStr("Bad line ######", lcnt), (const char *)fname);
switch (i) { switch (i) {
@ -1365,7 +1363,7 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
break; break;
case 1 : // Type case 1 : // Type
if ((type = TakeEnum(Type, strtok(NULL, " \t,;/"))) < 0) if ((type = TakeEnum(Type, strtok(NULL, " \t,;/"))) < 0)
error("%s [%s]", NumStr("Bad line ######", lcnt), fname); error("%s [%s]", NumStr("Bad line ######", lcnt), (const char *)fname);
break; break;
case 2 : // Phase case 2 : // Phase
++ shpcnt; ++ shpcnt;
@ -1541,7 +1539,7 @@ void CGEEngine::MainLoop() {
SayDebug(); SayDebug();
if (_isDemo) { if (_isDemo) {
static uint32 tc = 0; // static uint32 tc = 0;
if (/* FIXME: TimerCount - tc >= ((182L * 6L) * 5L) && */ Talk == NULL && Snail->Idle()) { if (/* FIXME: TimerCount - tc >= ((182L * 6L) * 5L) && */ Talk == NULL && Snail->Idle()) {
if (Text->getText(DemoText)) { if (Text->getText(DemoText)) {
SNPOST(SNSOUND, -1, 4, NULL); // drumla SNPOST(SNSOUND, -1, 4, NULL); // drumla

View File

@ -59,19 +59,6 @@ namespace CGE {
#define DETECT 0xFFFF #define DETECT 0xFFFF
static void NONE(void);
static void SB(void);
static void SBM(void);
static void GUS(void);
static void GUSM(void);
static void MIDI(void);
static void AUTO(void);
static void SetPortD(void);
static void SetPortM(void);
static void SetIRQ(void);
static void SetDMA(void);
static int DevName[] = { static int DevName[] = {
NONE_TEXT, SB_TEXT, SBM_TEXT, GUS_TEXT, GUSM_TEXT, NONE_TEXT, SB_TEXT, SBM_TEXT, GUS_TEXT, GUSM_TEXT,
MIDI_TEXT, AUTO_TEXT MIDI_TEXT, AUTO_TEXT

View File

@ -85,34 +85,15 @@ static const ADFileBasedFallback fileBasedFallback[] = {
} // End of namespace CGE } // End of namespace CGE
static const ADParams detectionParams = {
// Pointer to ADGameDescription or its superset structure
(const byte *)CGE::gameDescriptions,
// Size of that superset structure
sizeof(ADGameDescription),
// Number of bytes to compute MD5 sum for
5000,
// List of all engine targets
CGEGames,
// Structure for autoupgrading obsolete targets
0,
// Name of single gameid (optional)
"Soltys",
// List of files for file-based fallback detection (optional)
CGE::fileBasedFallback,
// Flags
0,
// Additional GUI options (for every game}
Common::GUIO_NONE,
// Maximum directory depth
0,
// List of directory globs
NULL
};
class CGEMetaEngine : public AdvancedMetaEngine { class CGEMetaEngine : public AdvancedMetaEngine {
public: public:
CGEMetaEngine() : AdvancedMetaEngine(detectionParams) {} CGEMetaEngine() : AdvancedMetaEngine(CGE::gameDescriptions, sizeof(ADGameDescription), CGEGames) {
_singleid = "Soltys";
}
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
return detectGameFilebased(allFiles, CGE::fileBasedFallback);
}
virtual const char *getName() const { virtual const char *getName() const {
return "CGE"; return "CGE";

View File

@ -83,7 +83,7 @@ EMM::EMM(long size): Han(-1), Top(0), Lim(0), List(NULL) {
EMM::~EMM(void) { EMM::~EMM(void) {
/* /* FIXME
Release(); Release();
if (Han >= 0) if (Han >= 0)
{ {
@ -94,7 +94,6 @@ EMM::~EMM(void) {
asm int EMS_INT asm int EMS_INT
} }
*/ */
warning("STUB: EMM::~EMM");
} }

View File

@ -304,7 +304,7 @@ EC void SNDInit() {
} }
EC void SNDDone() { EC void SNDDone() {
warning("STUB: SNDDone"); // FIXME: STUB: SNDDone
} }
EC void SNDSetVolume() { EC void SNDSetVolume() {
@ -324,7 +324,7 @@ EC void SNDMIDIStart(uint8 *MIDFile) {
} }
EC void SNDMIDIStop() { EC void SNDMIDIStop() {
warning("STUB: SNDMIDIStop"); // FIXME: STUB: SNDMIDIStop
} }
DATACK *LoadWave(XFILE *file, EMM *emm) { DATACK *LoadWave(XFILE *file, EMM *emm) {

View File

@ -74,7 +74,7 @@ KEYBOARD::~KEYBOARD(void) {
/* TODO replace totally by scummvm handling /* TODO replace totally by scummvm handling
setvect(KEYBD_INT, OldKeyboard); setvect(KEYBD_INT, OldKeyboard);
*/ */
warning("STUB: KEYBOARD::~KEYBOARD"); // FIXME: STUB: KEYBOARD::~KEYBOARD
} }

View File

@ -819,7 +819,6 @@ static void SNLevel(Sprite *spr, int lev) {
static int maxcav[] = { 1, 8, 16, 23, 24 }; static int maxcav[] = { 1, 8, 16, 23, 24 };
#endif #endif
while (Lev < lev) { while (Lev < lev) {
Sprite *spr;
++Lev; ++Lev;
spr = Vga->SpareQ->Locate(100 + Lev); spr = Vga->SpareQ->Locate(100 + Lev);
if (spr) { if (spr) {
@ -1114,6 +1113,9 @@ void SNAIL::RunCom(void) {
case SNGHOST : case SNGHOST :
SNGhost((BITMAP *) snc->Ptr); SNGhost((BITMAP *) snc->Ptr);
break; break;
default :
warning("Unhandled snc->Com in SNMouse(bool)");
break;
} }
++Tail; ++Tail;
if (!Turbo) if (!Turbo)

View File

@ -167,14 +167,14 @@ void TALK::Update(const char *tx) {
int cw = _Font->Wid[*tx], i; int cw = _Font->Wid[*tx], i;
uint8 *f = _Font->Map + _Font->Pos[*tx]; uint8 *f = _Font->Map + _Font->Pos[*tx];
for (i = 0; i < cw; i++) { for (i = 0; i < cw; i++) {
uint8 *p = m; uint8 *pp = m;
uint16 n; uint16 n;
register uint16 b = *(f++); register uint16 b = *(f++);
for (n = 0; n < FONT_HIG; n++) { for (n = 0; n < FONT_HIG; n++) {
if (b & 1) if (b & 1)
*p = TEXT_FG; *pp = TEXT_FG;
b >>= 1; b >>= 1;
p += mw; pp += mw;
} }
++m; ++m;
} }

View File

@ -41,12 +41,8 @@
namespace CGE { namespace CGE {
#define FADE_STEP 2 #define FADE_STEP 2
#define TMR_DIV ((0x8000/TMR_RATE)*2) #define TMR_DIV ((0x8000/TMR_RATE)*2)
//--------------------------------------------------------------------------
static char Report[] = "NearHeap=..... FarHeap=......\n";
#define NREP 9 #define NREP 9
#define FREP 24 #define FREP 24
@ -64,10 +60,9 @@ static VgaRegBlk VideoMode[] = {
// { 0x12, VGACRT, 0xFF, 0x6E }, // vert display end // { 0x12, VGACRT, 0xFF, 0x6E }, // vert display end
// { 0x15, VGACRT, 0xFF, 0x7F }, // start vb // { 0x15, VGACRT, 0xFF, 0x7F }, // start vb
// { 0x10, VGACRT, 0xFF, 0x94 }, // start vr // { 0x10, VGACRT, 0xFF, 0x94 }, // start vr
{ 0x00 } { 0x00, 0x00, 0x00, 0x00 }
}; };
bool SpeedTest = false; bool SpeedTest = false;
Seq _seq1[] = { { 0, 0, 0, 0, 0 } }; Seq _seq1[] = { { 0, 0, 0, 0, 0 } };
Seq _seq2[] = { { 0, 1, 0, 0, 0 }, { 1, 0, 0, 0, 0 } }; Seq _seq2[] = { { 0, 1, 0, 0, 0 }, { 1, 0, 0, 0, 0 } };
@ -82,8 +77,8 @@ char *NumStr(char *str, int num) {
} }
static void Video() {
/* /*
static void Video() {
static uint16 SP_S; static uint16 SP_S;
asm push bx asm push bx
@ -100,9 +95,8 @@ static void Video() {
asm pop si asm pop si
asm pop bp asm pop bp
asm pop bx asm pop bx
*/
warning("STUB: Video");
} }
*/
uint16 *SaveScreen(void) { uint16 *SaveScreen(void) {
@ -562,7 +556,7 @@ Sprite *Sprite::Expand(void) {
else { else {
SNAIL::COM *c = &nea[neacnt++]; SNAIL::COM *c = &nea[neacnt++];
if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0) if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0)
error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), fname); error("%s [%s]", (const char*)NumStr("Bad NEAR in ######", lcnt), (const char*)fname);
c->Ref = atoi(strtok(NULL, " \t,;/")); c->Ref = atoi(strtok(NULL, " \t,;/"));
c->Val = atoi(strtok(NULL, " \t,;/")); c->Val = atoi(strtok(NULL, " \t,;/"));
c->Ptr = NULL; c->Ptr = NULL;
@ -578,7 +572,7 @@ Sprite *Sprite::Expand(void) {
else { else {
SNAIL::COM *c = &tak[takcnt++]; SNAIL::COM *c = &tak[takcnt++];
if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0) if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0)
error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), fname); error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), (const char *)fname);
c->Ref = atoi(strtok(NULL, " \t,;/")); c->Ref = atoi(strtok(NULL, " \t,;/"));
c->Val = atoi(strtok(NULL, " \t,;/")); c->Val = atoi(strtok(NULL, " \t,;/"));
c->Ptr = NULL; c->Ptr = NULL;
@ -701,6 +695,9 @@ void Sprite::KillXlat(void) {
case FAR_MEM : case FAR_MEM :
free(m); free(m);
break; break;
default:
warning("Unhandled MemType in Sprite::KillXlat()");
break;
} }
for (b = _ext->_shpList; *b; b++) for (b = _ext->_shpList; *b; b++)
(*b)->M = NULL; (*b)->M = NULL;
@ -942,8 +939,7 @@ VGA::VGA(int mode)
for (i = 10; i < 20; i++) { for (i = 10; i < 20; i++) {
char *txt = Text->getText(i); char *txt = Text->getText(i);
if (txt) { if (txt) {
// puts(txt); warning("%s", txt);
warning(txt);
std = false; std = false;
} }
} }
@ -986,7 +982,7 @@ VGA::~VGA(void) {
if (Nam) if (Nam)
buffer = buffer + " [" + Nam + "]"; buffer = buffer + " [" + Nam + "]";
warning(buffer.c_str()); warning("%s", buffer.c_str());
} }
} }

View File

@ -344,6 +344,6 @@ Sprite *Locate(int ref);
extern bool SpeedTest; extern bool SpeedTest;
} // End if namespace CGE } // End of namespace CGE
#endif #endif