From 29065d302a9bf8bcaa18c4225e27b218bde67242 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 10 Jun 2011 22:57:09 +0200 Subject: CGE: Add namespaces --- engines/cge/bitmap.cpp | 6 ++---- engines/cge/bitmap.h | 6 ++++-- engines/cge/bitmaps.cpp | 4 ++++ engines/cge/bitmaps.h | 4 +++- engines/cge/boot.h | 5 ++++- engines/cge/cfile.cpp | 10 +++++++--- engines/cge/cfile.h | 2 ++ engines/cge/cge_main.cpp | 4 ++++ engines/cge/cge_main.h | 3 ++- engines/cge/game.cpp | 2 ++ engines/cge/game.h | 5 +++-- engines/cge/general.h | 5 +++++ engines/cge/gettext.cpp | 6 +++--- engines/cge/gettext.h | 8 ++------ engines/cge/ident.h | 2 ++ engines/cge/jbw.h | 3 +++ engines/cge/keybd.cpp | 3 +++ engines/cge/keybd.h | 2 ++ engines/cge/mixer.cpp | 5 +++-- engines/cge/mixer.h | 4 +++- engines/cge/mouse.cpp | 7 ++----- engines/cge/mouse.h | 5 +++-- engines/cge/snail.cpp | 5 ++++- engines/cge/snail.h | 12 ++++-------- engines/cge/snddrv.h | 4 ++++ engines/cge/sound.cpp | 8 +++++++- engines/cge/sound.h | 2 ++ engines/cge/startup.cpp | 7 +++---- engines/cge/startup.h | 3 +++ engines/cge/talk.cpp | 4 ++++ engines/cge/talk.h | 4 ++-- engines/cge/text.cpp | 8 ++------ engines/cge/text.h | 5 ++--- engines/cge/vga13h.cpp | 13 +++---------- engines/cge/vga13h.h | 3 ++- engines/cge/vmenu.cpp | 6 +++--- engines/cge/vmenu.h | 14 +++----------- engines/cge/vol.cpp | 7 ++++++- engines/cge/vol.h | 4 +++- engines/cge/wav.h | 4 ++++ 40 files changed, 129 insertions(+), 85 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 9845c4a2da..e9a9bbe220 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -36,12 +36,12 @@ #include "cge/drop.h" #endif - #include #include #include #include +namespace CGE { //-------------------------------------------------------------------------- @@ -455,6 +455,4 @@ bool BITMAP::VBMLoad (XFILE * f) } - - - +} // End of namespace CGE diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index 2ce849cc2b..90f94b1b32 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -30,6 +30,8 @@ #include "cge/general.h" +namespace CGE { + #define EOI 0x0000 #define SKP 0x4000 #define REP 0x8000 @@ -82,6 +84,6 @@ public: typedef BITMAP * BMP_PTR; +} // End of namespace CGE - -#endif \ No newline at end of file +#endif diff --git a/engines/cge/bitmaps.cpp b/engines/cge/bitmaps.cpp index 0cdae18cab..1eba1b55ea 100644 --- a/engines/cge/bitmaps.cpp +++ b/engines/cge/bitmaps.cpp @@ -222,6 +222,8 @@ static uint8 MEDesign[][9] = { { R R R R R R R R R }, // 0 #undef G */ +namespace CGE { + #ifdef DEBUG BMP_PTR MB[] = { new BITMAP("BRICK"), NULL }; BMP_PTR HL[] = { new BITMAP("HLINE"), NULL }; @@ -239,3 +241,5 @@ static uint8 MEDesign[][9] = { { R R R R R R R R R }, // 0 new BITMAP("LITE2"), new BITMAP("LITE3"), NULL }; + +} // End of namespace CGE diff --git a/engines/cge/bitmaps.h b/engines/cge/bitmaps.h index 65f586a355..3ca2bababd 100644 --- a/engines/cge/bitmaps.h +++ b/engines/cge/bitmaps.h @@ -30,6 +30,8 @@ #include "cge/vga13h.h" +namespace CGE { + #ifdef DEBUG extern BITMAP * MB[]; extern BITMAP * HL[]; @@ -40,6 +42,6 @@ extern BITMAP * PR[]; extern BITMAP * SP[]; extern BITMAP * LI[]; +} // End of namespace CGE #endif - \ No newline at end of file diff --git a/engines/cge/boot.h b/engines/cge/boot.h index 3a22e89661..d09afb6d1b 100644 --- a/engines/cge/boot.h +++ b/engines/cge/boot.h @@ -30,6 +30,8 @@ #include "cge/jbw.h" +namespace CGE { + #define BOOTSECT_SIZ 512 #define BOOTHEAD_SIZ 62 #define BOOTCODE_SIZ BOOTSECT_SIZ-BOOTHEAD_SIZ @@ -72,5 +74,6 @@ EC Boot * ReadBoot (int drive); EC uint8 CheckBoot (Boot * boot); EC bool WriteBoot (int drive, Boot * boot); +// End of namespace CGE -#endif \ No newline at end of file +#endif diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp index efc922b232..499a7033ac 100644 --- a/engines/cge/cfile.cpp +++ b/engines/cge/cfile.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon */ -#include +#include "cge/cfile.h" #include #include #include @@ -36,11 +36,13 @@ #else #include #include - #define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); } #endif +namespace CGE { - +#ifndef DROP_H + #define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); } +#endif IOBUF::IOBUF (IOMODE mode, CRYPT * crpt) : IOHAND(mode, crpt), @@ -357,3 +359,5 @@ void CFILE::Append (CFILE& f) } } } + +} // End of namespace CGE diff --git a/engines/cge/cfile.h b/engines/cge/cfile.h index bbb45a9e85..b08dc833b0 100644 --- a/engines/cge/cfile.h +++ b/engines/cge/cfile.h @@ -31,6 +31,7 @@ #include "cge/general.h" #include +namespace CGE { #define LINE_MAX 512 @@ -79,5 +80,6 @@ public: void Append (CFILE& f); }; +} // End of namespace CGE #endif diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index d8829247a4..36053d926c 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -55,6 +55,8 @@ #include #include +namespace CGE { + #define STACK_SIZ (K(2)) #define SVGCHKSUM (1956+Now+OldLev+Game+Music+DemoText) @@ -2257,3 +2259,5 @@ void cge_main (void) else Vga.Sunset(); VGA::Exit(EXIT_OK_TEXT+FINIS); } + +} // End of namespace CGE diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index c1155eb650..8605d17c55 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -204,5 +204,6 @@ extern WALK * Hero; void ContractSprite (SPRITE * spr); void cge_main(void); -} // End of CGE +} // End of namespace CGE + #endif diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp index cc80a8f7fa..d9bcf916bb 100644 --- a/engines/cge/game.cpp +++ b/engines/cge/game.cpp @@ -31,6 +31,7 @@ #include +namespace CGE { @@ -116,3 +117,4 @@ void FLY::Tick (void) //-------------------------------------------------------------------------- +} // End of namespace CGE diff --git a/engines/cge/game.h b/engines/cge/game.h index cda24512e3..1f45667b6b 100644 --- a/engines/cge/game.h +++ b/engines/cge/game.h @@ -31,6 +31,7 @@ #include "cge/vga13h.h" #include "cge/bitmaps.h" +namespace CGE { #define PAN_HIG 40 @@ -62,6 +63,6 @@ public: +} // End of namespace CGE - -#endif \ No newline at end of file +#endif diff --git a/engines/cge/general.h b/engines/cge/general.h index 75f754d0a3..ac45f4b4ad 100644 --- a/engines/cge/general.h +++ b/engines/cge/general.h @@ -28,9 +28,13 @@ #ifndef __GENERAL__ #define __GENERAL__ +#include "common/system.h" + #include "cge\jbw.h" #include +namespace CGE { + #define SEED 0xA5 #define SCR_WID_ 320 @@ -264,5 +268,6 @@ EC void _fqsort (void *base, uint16 nelem, uint16 width, int (*fcmp)(const void*, const void*)); +} // End of namespace CGE #endif diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp index 623374fe7d..f8de84f5fc 100644 --- a/engines/cge/gettext.cpp +++ b/engines/cge/gettext.cpp @@ -30,9 +30,7 @@ #include "cge/mouse.h" #include - - - +namespace CGE { GET_TEXT * GET_TEXT::Ptr = NULL; @@ -135,3 +133,5 @@ void GET_TEXT::Touch (uint16 mask, int x, int y) } else SPRITE::Touch(mask, x, y); } + +} // End of namespace CGE diff --git a/engines/cge/gettext.h b/engines/cge/gettext.h index d08e09a5bb..02dbabe9c6 100644 --- a/engines/cge/gettext.h +++ b/engines/cge/gettext.h @@ -31,17 +31,13 @@ #include "cge/general.h" #include "cge/talk.h" +namespace CGE { #define GTMAX 24 #define GTBLINK 6 #define GTTIME 6 - - - - - class GET_TEXT : public TALK { char Buff[GTMAX+2], * Text; @@ -57,6 +53,6 @@ public: void Tick (void); }; - +} // End of namespace CGE #endif diff --git a/engines/cge/ident.h b/engines/cge/ident.h index fa3011b49c..96e04f4e20 100644 --- a/engines/cge/ident.h +++ b/engines/cge/ident.h @@ -28,6 +28,7 @@ #ifndef __IDENT__ #define __IDENT__ +namespace CGE { struct IDENT { @@ -37,5 +38,6 @@ struct IDENT unsigned char cork; }; +} // End of namespace CGE #endif diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index 8776004273..236a2e6ddb 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -28,6 +28,8 @@ #ifndef __JBW__ #define __JBW__ +namespace CGE { + #define BEL 7 #define BS 8 #define HT 9 @@ -162,5 +164,6 @@ struct KeyStatStruct extern uint16 _stklen; extern uint16 _heaplen; +} // End of namespace CGE #endif diff --git a/engines/cge/keybd.cpp b/engines/cge/keybd.cpp index c644473c53..dbbc06bcb2 100644 --- a/engines/cge/keybd.cpp +++ b/engines/cge/keybd.cpp @@ -29,6 +29,7 @@ #include "cge/mouse.h" #include +namespace CGE { SPRITE * KEYBOARD::Client = NULL; uint8 KEYBOARD::Key[0x60] = { 0 }; @@ -139,3 +140,5 @@ void interrupt KEYBOARD::NewKeyboard (...) asm mov al,20h // send End-Of-Interrupt asm out 20h,al // to the 8259 IC } + +} // End of namespace CGE diff --git a/engines/cge/keybd.h b/engines/cge/keybd.h index dfbd439805..b38481f7d3 100644 --- a/engines/cge/keybd.h +++ b/engines/cge/keybd.h @@ -31,6 +31,7 @@ #include "cge/jbw.h" #include "cge/vga13h.h" +namespace CGE { #define KEYBD_INT 9 #define LSHIFT 42 @@ -54,5 +55,6 @@ public: ~KEYBOARD (void); }; +} // End of namespace CGE #endif diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index 25d6eed32a..2ebede93be 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -33,8 +33,7 @@ #include #include -//-------------------------------------------------------------------------- - +namespace CGE { extern MOUSE Mouse; @@ -154,3 +153,5 @@ void MIXER::Update (void) Led[1]->Step(SNDDrvInfo.VOL4.DL); SNPOST_(SNEXEC, -1, 0, SNDSetVolume); } + +} // End of namespace CGE diff --git a/engines/cge/mixer.h b/engines/cge/mixer.h index c770f0a794..30beaf2f5d 100644 --- a/engines/cge/mixer.h +++ b/engines/cge/mixer.h @@ -30,6 +30,8 @@ #include "cge/vga13h.h" +namespace CGE { + #define MIX_MAX 16 // count of Leds #define MIX_Z 64 // mixer Z position #define MIX_DELAY 12 // 6/s @@ -53,6 +55,6 @@ public: void Tick (void); }; - +} // End of namespace CGE #endif diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp index 3c17e3632c..94f7cbf0ac 100644 --- a/engines/cge/mouse.cpp +++ b/engines/cge/mouse.cpp @@ -29,7 +29,7 @@ #include "cge/text.h" #include - +namespace CGE { EVENT Evt[EVT_MAX]; @@ -228,7 +228,4 @@ void MOUSE::Tick (void) Hold->Goto(X-hx, Y-hy); } - - -//-------------------------------------------------------------------------- - +} // End of namespace CGE diff --git a/engines/cge/mouse.h b/engines/cge/mouse.h index 42a6bf6c21..20015b058f 100644 --- a/engines/cge/mouse.h +++ b/engines/cge/mouse.h @@ -31,8 +31,9 @@ #include "cge/game.h" #include "cge/talk.h" -#define EVT_MAX 256 +namespace CGE { +#define EVT_MAX 256 #define ROLL 0x01 #define L_DN 0x02 #define L_UP 0x04 @@ -80,6 +81,6 @@ public: }; - +} // End of namespace CGE #endif diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 4c15dc6a0c..67a16a8563 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -38,9 +38,10 @@ #include #include #include - #include "cge/keybd.h" +namespace CGE { + int MaxCave = 0; SCB Scb = { NULL, 0, NULL }; @@ -1305,3 +1306,5 @@ bool SNAIL::Idle (void) { return (Head == Tail); } + +} // End of namespace CGE diff --git a/engines/cge/snail.h b/engines/cge/snail.h index b3268341d8..bf47fa13d4 100644 --- a/engines/cge/snail.h +++ b/engines/cge/snail.h @@ -30,6 +30,8 @@ #include "cge/jbw.h" +namespace CGE { + #define POCKET_X 174 #define POCKET_Y 176 #define POCKET_DX 18 @@ -97,18 +99,10 @@ public: }; - - - void SelectPocket (int n); void PocFul (void); - - - - - extern SCB Scb; extern bool Flag[4]; extern bool Game; @@ -122,4 +116,6 @@ extern int PocPtr; extern BAR Barriers[]; extern struct HXY { int X; int Y; } HeroXY[]; +} // End of namespace CGE + #endif diff --git a/engines/cge/snddrv.h b/engines/cge/snddrv.h index 809f73c3a7..662d480778 100644 --- a/engines/cge/snddrv.h +++ b/engines/cge/snddrv.h @@ -37,6 +37,8 @@ #ifndef __SNDDRV__ #define __SNDDRV__ +namespace CGE { + // ****************************************************** // * Constants * // ****************************************************** @@ -128,4 +130,6 @@ EC void SNDMIDIStop (void); // WARNING: Uses ALL registers! EC void SNDMIDIPlay (void); +// End of namespace CGE + #endif diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index 03ba231fec..81dd457603 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -34,7 +34,6 @@ #else #include #include - #define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); } #endif #include "cge/text.h" @@ -43,6 +42,12 @@ #include +namespace CGE { + +#ifndef DROP_H + #define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); } +#endif + bool Music = true; FX Fx = 16; // must precede SOUND!! SOUND Sound; @@ -318,3 +323,4 @@ EC void * Patch (int pat) return p; } +} // End of namespace CGE diff --git a/engines/cge/sound.h b/engines/cge/sound.h index 993bd05fca..79c9bf563d 100644 --- a/engines/cge/sound.h +++ b/engines/cge/sound.h @@ -31,6 +31,7 @@ #include "cge/wav.h" #include "cge/snddrv.h" +namespace CGE { #define BAD_SND_TEXT 97 #define BAD_MIDI_TEXT 98 @@ -83,6 +84,7 @@ extern FX Fx; void LoadMIDI (int ref); void KillMIDI (void); +} // End of namespace CGE #endif diff --git a/engines/cge/startup.cpp b/engines/cge/startup.cpp index 18fd06d1ec..0e45e65b73 100644 --- a/engines/cge/startup.cpp +++ b/engines/cge/startup.cpp @@ -41,6 +41,8 @@ #include #endif +namespace CGE { + extern char Copr[]; #define id (*(IDENT*)Copr) @@ -189,7 +191,4 @@ const char *UsrPath (const char *nam) return buf; } - - - - +} // End of namespace CGE diff --git a/engines/cge/startup.h b/engines/cge/startup.h index 1c946508b5..2f1b5faa0b 100644 --- a/engines/cge/startup.h +++ b/engines/cge/startup.h @@ -31,6 +31,8 @@ #include "cge/general.h" +namespace CGE { + #define GAME_ID 45 #define CDINI_FNAME 46 @@ -75,5 +77,6 @@ extern EMM MiniEmm; const char *UsrPath (const char *nam); +} // End of namespace CGE #endif diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp index 822bc18de3..9c15ac1b65 100644 --- a/engines/cge/talk.cpp +++ b/engines/cge/talk.cpp @@ -34,6 +34,8 @@ #include #include +namespace CGE { + #define WID_SIZ 256 #define POS_SIZ 256 #define MAP_SIZ (256*8) @@ -401,3 +403,5 @@ void INFO_LINE::Update (const char * tx) OldTxt = tx; } } + +} // End of namespace CGE diff --git a/engines/cge/talk.h b/engines/cge/talk.h index dff61eaf4b..fb1d450f2d 100644 --- a/engines/cge/talk.h +++ b/engines/cge/talk.h @@ -31,7 +31,7 @@ #include "cge/vga13h.h" #include - +namespace CGE { #define TEXT_FG DARK // foreground color #define TEXT_BG GRAY // background color @@ -103,6 +103,6 @@ public: }; - +} // End of namespace CGE #endif \ No newline at end of file diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index bb4757e541..df8ca4cfe5 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -37,7 +37,7 @@ #include #include - +namespace CGE { TEXT Text = ProgName(); TALK * Talk = NULL; @@ -311,8 +311,4 @@ void KillText (void) } } - - - - -//------------------------------------------------------------------------- +} // End of namespace CGE diff --git a/engines/cge/text.h b/engines/cge/text.h index c6e6a1491e..7394e04b3f 100644 --- a/engines/cge/text.h +++ b/engines/cge/text.h @@ -32,8 +32,7 @@ #include "cge/jbw.h" #include - - +namespace CGE { #ifndef SYSTXT_MAX #define SYSTXT_MAX 1000 @@ -82,6 +81,6 @@ void SayTime (SPRITE * spr); void Inf (const char * txt); void KillText (void); - +} // End of namespace CGE #endif \ No newline at end of file diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index e2588b74f5..415bff7225 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -41,6 +41,8 @@ #include #include +namespace CGE { + #ifdef DEBUG #define REPORT #endif @@ -1790,13 +1792,4 @@ void BITMAP::Hide (int x, int y) // asm pop bx } - - - - - - -//-------------------------------------------------------------------------- - - - +} // End of namespace CGE diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index b3b411096e..d8e2273557 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -34,6 +34,7 @@ #include "cge/bitmap.h" #include "cge/snail.h" +namespace CGE { #define TMR_RATE1 16 #define TMR_RATE2 4 @@ -332,6 +333,6 @@ uint8 Closest (CBLK * pal, CBLK x) extern bool SpeedTest; +} // End if namespace CGE #endif - \ No newline at end of file diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index 1459314ba0..8178868578 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -30,8 +30,9 @@ #include #include -//-------------------------------------------------------------------------- +namespace CGE { +//-------------------------------------------------------------------------- #define RELIEF 1 #if RELIEF @@ -172,5 +173,4 @@ void VMENU::Touch (uint16 mask, int x, int y) #undef h } - - +} // End of namespace CGE diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h index d2b70145df..cdbabf9966 100644 --- a/engines/cge/vmenu.h +++ b/engines/cge/vmenu.h @@ -30,18 +30,15 @@ #include "cge/talk.h" +namespace CGE { + #define MB_VM 1 #define MB_HM 3 - typedef struct { char * Text; void (* Proc)(void); } CHOICE; - - - - class MENU_BAR : public TALK { public: @@ -49,11 +46,6 @@ public: }; - - - - - class VMENU : public TALK { uint16 Items; @@ -67,6 +59,6 @@ public: void Touch (uint16 mask, int x, int y); }; - +} // End of namespace CGE #endif diff --git a/engines/cge/vol.cpp b/engines/cge/vol.cpp index b0cf1c068c..8a94dbe8af 100644 --- a/engines/cge/vol.cpp +++ b/engines/cge/vol.cpp @@ -35,10 +35,13 @@ #include "cge/drop.h" #else #include - #define DROP(m,n) { printf("%s [%s]\n", (m), (n)); _exit(1); } #endif +namespace CGE { +#ifndef DROP_H + #define DROP(m,n) { printf("%s [%s]\n", (m), (n)); _exit(1); } +#endif #ifdef VOL_UPD @@ -104,3 +107,5 @@ void VFILE::ReadBuff (void) Lim = Dat.File.Read(Buff, (uint16) n); Ptr = 0; } + +} // End of namespace CGE diff --git a/engines/cge/vol.h b/engines/cge/vol.h index 99284fddd5..a98dbbeee2 100644 --- a/engines/cge/vol.h +++ b/engines/cge/vol.h @@ -33,6 +33,8 @@ #include "cge/btfile.h" #include "cge/cfile.h" +namespace CGE { + #define CAT_NAME "VOL.CAT" #define DAT_NAME "VOL.DAT" @@ -86,6 +88,6 @@ public: }; - +} // End of namespace CGE #endif diff --git a/engines/cge/wav.h b/engines/cge/wav.h index 0fc2ab4d0d..0d1408ccf6 100644 --- a/engines/cge/wav.h +++ b/engines/cge/wav.h @@ -31,6 +31,8 @@ #include "cge/general.h" #include +namespace CGE { + #define WAVE_FORMAT_PCM 0x0001 #define IBM_FORMAT_MULAW 0x0101 #define IBM_FORMAT_ALAW 0x0102 @@ -133,4 +135,6 @@ extern CKID DATA; DATACK * LoadWave (XFILE * file, EMM * emm = NULL); +// End of namespace CGE + #endif -- cgit v1.2.3