From 119865e6e1a88b9e8efbc18d05c7298926e3072d Mon Sep 17 00:00:00 2001 From: johns <> Date: Sun, 23 Apr 2000 22:03:46 +0000 Subject: [PATCH] struct Palette > typedef Palette --- src/include/new_video.h | 49 ++++++++++++++++++++--------------------- src/include/video.h | 23 +++++++++---------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/include/new_video.h b/src/include/new_video.h index 0e15d96c2..5c64f8e1d 100644 --- a/src/include/new_video.h +++ b/src/include/new_video.h @@ -20,7 +20,7 @@ //@{ -// Little note: this should become the new video headerfile +// Little NOTE: this should become the new video headerfile /*---------------------------------------------------------------------------- -- Includes @@ -37,9 +37,10 @@ Note: This new graphic object should generalize all the different objects (8bit,16bit,...) #endif +// FIXME: not quite correct for new multiple palette version /// System-Wide used colors. enum _sys_colors_ { - ColorBlack = 0, /// usr for black + ColorBlack = 0, /// use for black ColorDarkGreen = 149, ColorBlue = 206, ColorWhite = 246, @@ -51,37 +52,35 @@ enum _sys_colors_ { ColorBlinkRed = 252, ColorViolett = 253, - ColorWaterCycleStart = 38, - ColorWaterCycleEnd = 47, - ColorIconCycleStart = 240, - ColorIconCycleEnd = 244 +// FIXME: this should some where made configurable + ColorWaterCycleStart = 38, /// color # start for color cycling + ColorWaterCycleEnd = 47, /// color # end for color cycling + ColorIconCycleStart = 240, /// color # start for color cycling + ColorIconCycleEnd = 244 /// color # end for color cycling +}; + +typedef enum _sys_colors_ SysColors; /// System-Wide used colors. + +typedef struct _palette_ Palette; /// palette typedef + +/// Palette structure. +struct _palette_ { + unsigned char r; /// RED COMPONENT + unsigned char g; /// GREEN COMPONENT + unsigned char b; /// BLUE COMPONENT }; typedef unsigned char GraphicData; /// generic graphic data type -/// Palette structure. -struct Palette { - /// RED COMPONENT - unsigned char r; - /// GREEN COMPONENT - unsigned char g; - /// BLUE COMPONENT - unsigned char b; -}; - -typedef struct Palette Palette; - -typedef enum _sys_colors_ SysColors; /// System-Wide used colors. - /** ** General graphic object typedef. (forward) */ -typedef struct __graphic__ Graphic; +typedef struct _graphic_ Graphic; /** ** General graphic object type. */ -typedef struct __graphic_type__ { +typedef struct _graphic_type_ { /** ** Draw the object unclipped. ** @@ -148,10 +147,10 @@ typedef struct __graphic_type__ { /** ** General graphic object */ -struct __graphic__ { +struct _graphic_ { GraphicType* Type; /// Object type dependend Palette* Palette; /// Loaded Palette - GraphicData* Pixels; + GraphicData* Pixels; /// Pointer to local or global palette unsigned Width; /// Width of the object unsigned Height; /// Height of the object unsigned NumFrames; /// Number of frames @@ -257,7 +256,7 @@ extern void (*VideoDrawHLineClip)(SysColors color,int x,int y /// Free a graphic object. #define VideoFree(o) ((o)->Type->Free)((o)) - /// Save free a graphic object. + /// Save (NULL) free a graphic object. #define VideoSaveFree(o) \ do { if( (o) ) ((o)->Type->Free)((o)); } while( 0 ) diff --git a/src/include/video.h b/src/include/video.h index 7bf8178c0..cb90304f0 100644 --- a/src/include/video.h +++ b/src/include/video.h @@ -37,6 +37,8 @@ typedef unsigned char VMemType8; /// 8 bpp modes pointer /// MACRO defines speed of colorcycling #define COLOR_CYCLE_SPEED (FRAMES_PER_SECOND/4) +#ifndef NEW_VIDEO // { Should be removed with new video final version + /**@name RleSprite */ //@{ @@ -52,7 +54,7 @@ typedef unsigned char VMemType8; /// 8 bpp modes pointer struct RleSprite { unsigned Width; /// width of a frame unsigned Height; /// height of a frame - GraphicData* Pixels; /// palette FUTURE extension + GraphicData* Pixels; /// pointer to local or global palette int NumFrames; /// number of frames IfDebug( int ByteSize; ) /** @@ -110,11 +112,8 @@ extern void DrawRleSpriteClippedX(RleSprite* sprite,unsigned frame,int x,int y); extern void FreeRleSprite(RleSprite *sprite); //@} -/**@name Vector graphics primitives */ +#endif // } !NEW_VIDEO -// now in linedraw and vectored - -//@{ /** Set clipping for nearly all vector primitives. Functions which support clipping will be marked CLIPPED. Set system-wide clipping rectangle. @param left left x coordinate @@ -142,7 +141,7 @@ extern void* VideoMemory; */ extern int VideoDepth; /// Sub depth 555, 565 -extern int VideoSubDepth; +//extern int VideoSubDepth; /// 32 bpp modes video memory address #define VideoMemory32 ((VMemType32*)VideoMemory) @@ -156,8 +155,8 @@ extern int VideoSubDepth; VideoCreatePalette. @see VideoCreatePalette */ -extern VMemType8 * Pixels8; /// 8 bpp -extern VMemType16 * Pixels16; /// 16 bpp default +extern VMemType8 * Pixels8; /// 8 bpp +extern VMemType16 * Pixels16; /// 16 bpp extern VMemType32 * Pixels32; /// 32 bpp /** Set videomode. Tries to set choosen videomode. Only 640x480, 800x600 @@ -167,14 +166,14 @@ extern VMemType32 * Pixels32; /// 32 bpp extern int SetVideoMode(int width); /** Loaded system palette. 256-entries long, active system palette. */ -extern struct Palette GlobalPalette[256]; +extern Palette GlobalPalette[256]; /** Load palette from resource. Just loads palette, to set it use VideoCreatePalette, which sets system palette. @param pal buffer to store palette (256-entries long) @param name resource file name */ -extern void LoadRGB(struct Palette *pal, const char *name); +extern void LoadRGB(Palette *pal, const char *name); /// Initialize Pixels[] for all players (bring Players[] in sync with Pixels[]) extern void SetPlayersPalette(void); @@ -192,14 +191,14 @@ extern void CheckVideoInterrupts(void); extern void ColorCycle(void); /** Creates a palette from a Palette struct */ -extern GraphicData * VideoCreateNewPalette(const struct Palette *palette); +extern GraphicData * VideoCreateNewPalette(const Palette *palette); /** Initializes system palette. Also calls SetPlayersPalette to set palette for all players. @param palette Palette structure @see SetPlayersPalette */ -extern void VideoCreatePalette(const struct Palette *palette); +extern void VideoCreatePalette(const Palette *palette); /// Process all system events. This function also keeps synchronization of game. extern void WaitEventsAndKeepSync(void);