diff options
-rw-r--r-- | engines/cge/bitmaps.cpp | 2 | ||||
-rw-r--r-- | engines/cge/bitmaps.h | 3 | ||||
-rw-r--r-- | engines/cge/btfile.cpp | 16 | ||||
-rw-r--r-- | engines/cge/btfile.h | 2 | ||||
-rw-r--r-- | engines/cge/cge_main.cpp | 137 | ||||
-rw-r--r-- | engines/cge/ems.cpp | 2 | ||||
-rw-r--r-- | engines/cge/general.h | 8 | ||||
-rw-r--r-- | engines/cge/jbw.h | 22 | ||||
-rw-r--r-- | engines/cge/mouse.cpp | 14 | ||||
-rw-r--r-- | engines/cge/snail.cpp | 7 | ||||
-rw-r--r-- | engines/cge/startup.cpp | 11 | ||||
-rw-r--r-- | engines/cge/vga13h.cpp | 21 | ||||
-rw-r--r-- | engines/cge/vga13h.h | 2 |
13 files changed, 52 insertions, 195 deletions
diff --git a/engines/cge/bitmaps.cpp b/engines/cge/bitmaps.cpp index 77012c0488..cabe04b784 100644 --- a/engines/cge/bitmaps.cpp +++ b/engines/cge/bitmaps.cpp @@ -224,7 +224,6 @@ static uint8 MEDesign[][9] = { { R R R R R R R R R }, // 0 namespace CGE { -#ifdef DEBUG BMP_PTR MB[] = { new BITMAP("BRICK"), NULL @@ -234,7 +233,6 @@ BMP_PTR HL[] = { new BITMAP("HLINE"), NULL }; -#endif BMP_PTR MC[] = { new BITMAP("MOUSE"), diff --git a/engines/cge/bitmaps.h b/engines/cge/bitmaps.h index 5023c2e657..5ac878de3c 100644 --- a/engines/cge/bitmaps.h +++ b/engines/cge/bitmaps.h @@ -32,11 +32,8 @@ namespace CGE { -#ifdef DEBUG extern BITMAP *MB[]; extern BITMAP *HL[]; -#endif - extern BITMAP *MC[]; extern BITMAP *PR[]; extern BITMAP *SP[]; diff --git a/engines/cge/btfile.cpp b/engines/cge/btfile.cpp index b5e59e0988..7bb835f704 100644 --- a/engines/cge/btfile.cpp +++ b/engines/cge/btfile.cpp @@ -46,7 +46,7 @@ BTFILE::BTFILE(const char *name, IOMODE mode, CRYPT *crpt) Buff[i].Page = new BT_PAGE; Buff[i].PgNo = BT_NONE; Buff[i].Indx = -1; - Buff[i].Updt = FALSE; + Buff[i].Updt = false; if (Buff[i].Page == NULL) error("No core"); } @@ -65,7 +65,7 @@ void BTFILE::PutPage(int lev, bool hard) { if (hard || Buff[lev].Updt) { Seek(Buff[lev].PgNo * sizeof(BT_PAGE)); Write((uint8 *) Buff[lev].Page, sizeof(BT_PAGE)); - Buff[lev].Updt = FALSE; + Buff[lev].Updt = false; } } @@ -78,12 +78,12 @@ BT_PAGE *BTFILE::GetPage(int lev, uint16 pgn) { if (Size() > pos) { Seek((uint32) pgn * sizeof(BT_PAGE)); Read((uint8 *) Buff[lev].Page, sizeof(BT_PAGE)); - Buff[lev].Updt = FALSE; + Buff[lev].Updt = false; } else { Buff[lev].Page->Hea.Count = 0; Buff[lev].Page->Hea.Down = BT_NONE; memset(Buff[lev].Page->Data, '\0', sizeof(Buff[lev].Page->Data)); - Buff[lev].Updt = TRUE; + Buff[lev].Updt = true; } Buff[lev].Indx = -1; } @@ -132,17 +132,17 @@ void BTFILE::Make(BT_KEYPACK *keypack, uint16 count) { BT_PAGE *Root = GetPage(0, n++), *Leaf = GetPage(1, n); Root->Hea.Down = n; - PutPage(0, TRUE); + PutPage(0, true); while (count --) { if (Leaf->Hea.Count >= ArrayCount(Leaf->Lea)) { - PutPage(1, TRUE); // save filled page + PutPage(1, true); // save filled page Leaf = GetPage(1, ++n); // take empty page memcpy(Root->Inn[Root->Hea.Count].Key, keypack->Key, BT_KEYLEN); Root->Inn[Root->Hea.Count ++].Down = n; - Buff[0].Updt = TRUE; + Buff[0].Updt = true; } Leaf->Lea[Leaf->Hea.Count ++] = * (keypack ++); - Buff[1].Updt = TRUE; + Buff[1].Updt = true; } } diff --git a/engines/cge/btfile.h b/engines/cge/btfile.h index c55891cae4..3ab4880585 100644 --- a/engines/cge/btfile.h +++ b/engines/cge/btfile.h @@ -73,7 +73,7 @@ class BTFILE : public IOHAND { int Indx; bool Updt; } Buff[BT_LEVELS]; - void PutPage(int lev, bool hard = FALSE); + void PutPage(int lev, bool hard = false); BT_PAGE *GetPage(int lev, uint16 pgn); public: BTFILE(const char *name, IOMODE mode = REA, CRYPT *crpt = NULL); diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 64a20293bd..22168fe44c 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -59,21 +59,8 @@ namespace CGE { #define STACK_SIZ (K(2)) #define SVGCHKSUM (1956+Now+OldLev+Game+Music+DemoText) -#ifdef DEMO -#ifdef DEBUG #define SVG0NAME ("{{INIT}}" SVG_EXT) -#else -#define SVG0NAME (ProgName(SVG_EXT)) -#endif -#else -#define SVG0NAME ("{{INIT}}" SVG_EXT) -#endif - -#ifdef DEBUG #define SVG0FILE CFILE -#else -#define SVG0FILE INI_FILE -#endif extern uint16 _stklen = (STACK_SIZ * 2); @@ -152,9 +139,7 @@ extern int FindPocket(SPRITE *); extern DAC StdPal[58]; -#ifdef DEBUG static SPRITE HorzLine = HL; -#endif void FeedSnail(SPRITE *spr, SNLIST snq); // defined in SNAIL uint8 CLUSTER::Map[MAP_ZCNT][MAP_XCNT]; @@ -204,7 +189,7 @@ bool CLUSTER::Protected(void) { */ warning("STUB: CLUSTER::Protected()"); - return TRUE; + return true; } @@ -548,8 +533,6 @@ void WALK::Reach(SPRITE *spr, int mode) { } -#ifdef DEBUG - class SQUARE : public SPRITE { public: SQUARE(void); @@ -586,14 +569,11 @@ static void SetMapBrick(int x, int z) { } } -#endif - - void dummy(void) {} static void SwitchMapping(void); static void SwitchColorMode(void); static void StartCountDown(void); -Debug(static void SwitchDebug(void);) +static void SwitchDebug(void); static void SwitchMusic(void); static void KillSprite(void); static void PushSprite(void); @@ -642,13 +622,6 @@ static void Quit(void) { static void AltCtrlDel(void) { -#if 0 - //def DEBUG - if (KEYBOARD::Key[LSHIFT] || KEYBOARD::Key[RSHIFT]) { - PostFlag = 0x1234; - POST(); - } else -#endif SNPOST_(SNSAY, -1, A_C_D_TEXT, Hero); } @@ -774,18 +747,18 @@ static void CaveUp(void) { static void CaveDown(void) { SPRITE *spr; - Debug(if (! HorzLine.Flags.Hide) SwitchMapping();) + if (! HorzLine.Flags.Hide) + SwitchMapping(); - for (spr = VGA::ShowQ.First(); spr;) { - SPRITE *n = spr->Next; - if (spr->Ref >= 1000 /*&& spr->Cave*/) { - if (spr->Ref % 1000 == 999) - FeedSnail(spr, TAKE); - - VGA::SpareQ.Append(VGA::ShowQ.Remove(spr)); - } - spr = n; + for (spr = VGA::ShowQ.First(); spr;) { + SPRITE *n = spr->Next; + if (spr->Ref >= 1000 /*&& spr->Cave*/) { + if (spr->Ref % 1000 == 999) + FeedSnail(spr, TAKE); + VGA::SpareQ.Append(VGA::ShowQ.Remove(spr)); } + spr = n; + } Text.Clear(1000); } @@ -857,10 +830,11 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { pp0 = pp; switch (x) { case Del: - if (KEYBOARD::Key[ALT] && - KEYBOARD::Key[CTRL]) AltCtrlDel(); - Debug(else KillSprite();) - break; + if (KEYBOARD::Key[ALT] && KEYBOARD::Key[CTRL]) + AltCtrlDel(); + else + KillSprite(); + break; case 'F': if (KEYBOARD::Key[ALT]) { SPRITE *m = VGA::ShowQ.Locate(17001); @@ -870,8 +844,6 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { } } break; - -#ifdef DEBUG case PgUp: PushSprite(); break; @@ -932,19 +904,6 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { if (Sprite) Sprite->Step(x - '0'); break; -#else - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - SelectPocket(x - '1'); - break; -#endif - case F10 : if (Snail.Idle() && ! Hero->Flags.Hide) StartCountDown(); @@ -994,7 +953,6 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { if (cav && Snail.Idle() && Hero->TracePtr < 0) SwitchCave(cav); -#ifdef DEBUG if (!HorzLine.Flags.Hide) { if (y >= MAP_TOP && y < MAP_TOP + MAP_HIG) { int8 x1, z1; @@ -1003,7 +961,6 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { SetMapBrick(x1, z1); } } else -#endif { if (! Talk && Snail.Idle() && Hero && y >= MAP_TOP && y < MAP_TOP + MAP_HIG && ! Game) { @@ -1119,7 +1076,6 @@ static void TakeName(void) { #endif -#ifdef DEBUG static void SwitchMapping(void) { if (HorzLine.Flags.Hide) { int i; @@ -1200,10 +1156,6 @@ static void SaveMapping(void) { } } -#endif - - -#ifdef DEBUG // 1111111111222222222233333333 334444444444555555555566666666667777777777 // 01234567890123456789012345678901234567 890123456789012345678901234567890123456789 static char DebugText[] = " N=00000 F=000000 X=000 Y=000 FPS=0000\0S=00:00 000:000:000 000:000 00 "; @@ -1272,8 +1224,6 @@ static void SwitchDebug(void) { DebugLine.Flags.Hide = ! DebugLine.Flags.Hide; } -#endif - static void OptionTouch(int opt, uint16 mask) { switch (opt) { @@ -1304,7 +1254,7 @@ void SPRITE::Touch(uint16 mask, int x, int y) { if ((mask & ATTN) == 0) { InfoLine.Update(Name()); if (mask & (R_DN | L_DN)) - Sprite = this; // DEBUG mode only? + Sprite = this; if (Ref / 10 == 12) { OptionTouch(Ref % 10, mask); return; @@ -1582,50 +1532,20 @@ static void LoadScript(const char *fname) { static void MainLoop(void) { -#if 0 -//def DEBUG - static VgaRegBlk Mode[] = { - - { 0x04, VGASEQ, 0x08, 0x04 }, // memory mode - - { 0x03, VGAGRA, 0xFF, 0x00 }, // data rotate = 0 - { 0x05, VGAGRA, 0x03, 0x00 }, // R/W mode = 0 - { 0x06, VGAGRA, 0x02, 0x00 }, // misc - - { 0x14, VGACRT, 0x40, 0x00 }, // underline - { 0x13, VGACRT, 0xFF, 0x28 }, // screen width - { 0x17, VGACRT, 0xFF, 0xC3 }, // mode control - - { 0x11, VGACRT, 0x80, 0x00 }, // vert retrace end - { 0x09, VGACRT, 0xEF, 0x01 }, // max scan line - - { 0x30, VGAATR, 0x00, 0x20 }, // 256 color mode - -// { 0x12, VGACRT, 0xFF, 0x6E }, // vert display end -// { 0x15, VGACRT, 0xFF, 0x7F }, // start vb -// { 0x10, VGACRT, 0xFF, 0x94 }, // start vr - - { 0x00 } - }; - - Vga.Setup(Mode); -#endif - - Debug(SayDebug();) + SayDebug(); #ifdef DEMO -#define TIM ((182L*6L) * 5L) static uint32 tc = 0; - if (TimerCount - tc >= TIM && Talk == NULL && Snail.Idle()) { + if (/* FIXME: TimerCount - tc >= ((182L*6L) * 5L) && */ Talk == NULL && Snail.Idle()) { if (Text[DemoText]) { SNPOST(SNSOUND, -1, 4, NULL); // drumla SNPOST(SNINF, -1, DemoText, NULL); SNPOST(SNLABEL, -1, -1, NULL); - if (Text[++ DemoText] == NULL) DemoText = DEMO_TEXT + 1; + if (Text[++ DemoText] == NULL) + DemoText = DEMO_TEXT + 1; } - tc = TimerCount; + //FIXME: tc = TimerCount; } -#undef TIM #endif Vga.Show(); @@ -1727,14 +1647,12 @@ static void RunGame(void) { InfoLine.Update(NULL); VGA::ShowQ.Insert(&InfoLine); -#ifdef DEBUG DebugLine.Z = 126; VGA::ShowQ.Insert(&DebugLine); HorzLine.Y = MAP_TOP - (MAP_TOP > 0); HorzLine.Z = 126; VGA::ShowQ.Insert(&HorzLine); -#endif Mouse.Busy = VGA::SpareQ.Locate(BUSY_REF); if (Mouse.Busy) @@ -1897,13 +1815,10 @@ bool ShowTitle(const char *name) { /* -#ifdef DEBUG -void StkDump (void) -{ +void StkDump (void) { CFILE f("!STACK.DMP", BFW); f.Write((uint8 *) (intStackPtr-STACK_SIZ/2), STACK_SIZ*2); } -#endif */ @@ -1920,8 +1835,8 @@ void cge_main(void) { if (! SVG0FILE::Exist(SVG0NAME)) STARTUP::Mode = 2; - Debug(DebugLine.Flags.Hide = true;) - Debug(HorzLine.Flags.Hide = true;) + DebugLine.Flags.Hide = true; + HorzLine.Flags.Hide = true; //srand((uint16) Timer()); Sys = new SYSTEM; diff --git a/engines/cge/ems.cpp b/engines/cge/ems.cpp index 7b0697cd8a..c21bc356dc 100644 --- a/engines/cge/ems.cpp +++ b/engines/cge/ems.cpp @@ -127,7 +127,7 @@ bool EMM::Test(void) { return FALSE; */ warning("EMM::Test"); - return FALSE; + return false; } diff --git a/engines/cge/general.h b/engines/cge/general.h index 1fc8bd0b0b..c1c417c237 100644 --- a/engines/cge/general.h +++ b/engines/cge/general.h @@ -146,19 +146,19 @@ void Swap(T &A, T &B) { T a = A; A = B; B = a; -}; +} #ifdef __cplusplus template <class T> T max(T A, T B) { return (A > B) ? A : B; -}; +} template <class T> T min(T A, T B) { return (A < B) ? A : B; -}; +} #endif @@ -179,7 +179,7 @@ public: template <class T> inline uint16 XRead(XFILE *xf, T *t) { return xf->Read((uint8 *) t, sizeof(*t)); -}; +} class IOHAND : public XFILE { diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index 73131d71e3..4a341fbbb7 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -33,8 +33,8 @@ namespace CGE { // Defines found in cge.mak -#define DEBUG #define VOL +//#define DEMO #define INI_FILE VFILE // Or is it CFILE? #define PIC_FILE VFILE #define BMP_MODE 0 @@ -46,15 +46,8 @@ namespace CGE { #define LF 10 #define FF 12 #define CR 13 - -#define TRUE 1 -#define FALSE 0 - #define MAXFILE 128 - -#define NULL 0 -#define OFF false -#define ON true +#define NULL 0 #define IsWhite(c) ((c) == ' ' || (c) == '\t' || (c) == '\n') #define IsUpper(c) ((c) >= 'A' && (c) <= 'Z') @@ -148,17 +141,6 @@ struct KeyStatStruct { #define BreakFlag (* ((volatile uint8 *) ((void _seg *) 0x40 + (void *) 0x71))) #define PostFlag (* ((volatile uint16 *) ((void _seg *) 0x40 + (void *) 0x72))) #define POST ((void (*)(void)) ((void _seg *) 0xF000 + (void *) 0xFFF0)) -#define SLIF if (KeyStat.ScrollLock) - -#define FOR(i,n) for(i = 0; i < (n); i++) - -#define TRAP(x) { warning("STUB: TRAP"); /*if (x) asm { int 3 } */ } - -#ifdef DEBUG -#define Debug(x) x -#else -#define Debug(x) -#endif #ifdef DEMO #define Demo(x) x diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp index 9bb9626deb..601d02999f 100644 --- a/engines/cge/mouse.cpp +++ b/engines/cge/mouse.cpp @@ -167,13 +167,8 @@ void MOUSE::Tick(void) { Hold = e.Ptr; if (Hold) { Hold->Flags.Hold = true; -#ifndef DEBUG - if (Hold->Flags.Drag) -#endif - { - hx = e.X - Hold->X; - hy = e.Y - Hold->Y; - } + hx = e.X - Hold->X; + hy = e.Y - Hold->Y; } } @@ -192,10 +187,7 @@ void MOUSE::Tick(void) { EvtTail = (EvtTail + 1) % EVT_MAX; } if (Hold) -#ifndef DEBUG - if (Hold->Flags.Drag) -#endif - Hold->Goto(X - hx, Y - hy); + Hold->Goto(X - hx, Y - hy); } } // End of namespace CGE diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index b2f4648e10..382b6dbc62 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -90,8 +90,7 @@ static void SNGame(SPRITE *spr, int num) { ++ Stage; if (hand && Stage > DRESSED) ++hand; - if (Debug(i >= 0 ||) - dup[i] == spr && new_random(3) == 0) { + if (i >= 0 || dup[i] == spr && new_random(3) == 0) { SNPOST(SNSEQ, -1, 3, dup[0]); // yes SNPOST(SNSEQ, -1, 3, dup[1]); // yes SNPOST(SNSEQ, -1, 3, dup[2]); // yes @@ -629,7 +628,7 @@ void SNCover(SPRITE *spr, int xref) { xspr->Cave = spr->Cave; xspr->Goto(spr->X, spr->Y); ExpandSprite(xspr); - if ((xspr->Flags.Shad = spr->Flags.Shad) == TRUE) { + if ((xspr->Flags.Shad = spr->Flags.Shad) == 1) { VGA::ShowQ.Insert(VGA::ShowQ.Remove(spr->Prev), xspr); spr->Flags.Shad = false; } @@ -643,7 +642,7 @@ void SNUncover(SPRITE *spr, SPRITE *xspr) { spr->Flags.Hide = false; spr->Cave = xspr->Cave; spr->Goto(xspr->X, xspr->Y); - if ((spr->Flags.Shad = xspr->Flags.Shad) == TRUE) { + if ((spr->Flags.Shad = xspr->Flags.Shad) == 1) { VGA::ShowQ.Insert(VGA::ShowQ.Remove(xspr->Prev), spr); xspr->Flags.Shad = false; } diff --git a/engines/cge/startup.cpp b/engines/cge/startup.cpp index 24aaf3e042..10967afbc4 100644 --- a/engines/cge/startup.cpp +++ b/engines/cge/startup.cpp @@ -35,10 +35,7 @@ #include <process.h> #include <dos.h> #include <string.h> - -#ifdef DEBUG #include <stdlib.h> -#endif namespace CGE { @@ -124,14 +121,6 @@ STARTUP::STARTUP(void) { if (Cpu() < _80286) quit_now(BAD_CHIP_TEXT); if (100 * _osmajor + _osminor < 330) quit_now(BAD_DOS_TEXT); - #ifndef DEBUG - if (Core < CORE_LOW) quit_now(NO_CORE_TEXT); - if (Core < CORE_HIG) - { - SNDDrvInfo.MDEV = DEV_QUIET; - Music = false; - } - #endif if (! get_parms()) quit_now(BAD_ARG_TEXT); //--- load sound configuration const char * fn = UsrPath(ProgName(CFG_EXT)); diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 72831e83cf..c1587fa45a 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -40,25 +40,14 @@ namespace CGE { -#ifdef DEBUG -#define REPORT -#endif - -#define OK(f) ((f).Error==0) #define FADE_STEP 2 - #define TMR_DIV ((0x8000/TMR_RATE)*2) - //-------------------------------------------------------------------------- -#ifdef REPORT static char Report[] = "NearHeap=..... FarHeap=......\n"; #define NREP 9 #define FREP 24 -#endif - - static VgaRegBlk VideoMode[] = { @@ -377,7 +366,6 @@ BMP_PTR SPRITE::Shp(void) { if (e) if (e->Seq) { int i = e->Seq[SeqPtr].Now; -#ifdef DEBUG if (i >= ShpCnt) { //char s[256]; //sprintf(s, "Seq=%p ShpCnt=%d SeqPtr=%d Now=%d Next=%d", @@ -385,7 +373,6 @@ BMP_PTR SPRITE::Shp(void) { //VGA::Exit(s, File); error("Invalid PHASE in SPRITE::Shp() %s", File); } -#endif return e->ShpList[i]; } return NULL; @@ -509,7 +496,7 @@ SPRITE *SPRITE::Expand(void) { MergeExt(fname, File, SPR_EXT); if (INI_FILE::Exist(fname)) { // sprite description file exist INI_FILE sprf(fname); - if (! OK(sprf)) + if (! (sprf.Error==0)) error("Bad SPR [%s]", fname); int len = 0, lcnt = 0; while ((len = sprf.Read((uint8 *)line)) != 0) { @@ -936,14 +923,12 @@ VGA::VGA(int mode) if (txt) { // puts(txt); warning(txt); -#ifndef DEBUG std = false; -#endif } } -// if (std) + if (std) // warning(Copr); - warning("TODO: Fix Copr"); + warning("TODO: Fix Copr"); SetStatAdr(); if (StatAdr != VGAST1_) diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index b762268956..2660274c23 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -309,7 +309,7 @@ uint8 Closest(CBLK *pal, CBLK x) { } return found; #undef f -}; +} |