Migrate planet map shield tint to new drawing modes

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3476 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2009-12-27 06:50:52 +00:00
parent ec5a400052
commit 24513c7b07
2 changed files with 20 additions and 23 deletions
+1
View File
@@ -317,6 +317,7 @@ typedef struct
} DrawMode; } DrawMode;
#define DRAW_REPLACE_MODE MAKE_DRAW_MODE (DRAW_REPLACE, 0) #define DRAW_REPLACE_MODE MAKE_DRAW_MODE (DRAW_REPLACE, 0)
#define DRAW_FACTOR_1 0xff
static inline DrawMode static inline DrawMode
MAKE_DRAW_MODE (DrawKind kind, SWORD factor) MAKE_DRAW_MODE (DrawKind kind, SWORD factor)
+19 -23
View File
@@ -37,16 +37,6 @@
// an additive overlay for the shield effect // an additive overlay for the shield effect
#undef USE_ALPHA_SHIELD #undef USE_ALPHA_SHIELD
// XXX: these are currently defined in libs/graphics/sdl/3do_getbody.c
// they should be sorted out and cleaned up at some point
extern DWORD frame_mapRGBA (FRAME FramePtr, UBYTE r, UBYTE g,
UBYTE b, UBYTE a);
extern void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0,
int x, int y);
extern void arith_frame_blit (FRAME srcFrame, const RECT *rsrc,
FRAME dstFrame, const RECT *rdst, int num, int denom);
#define SHIELD_GLOW_COMP 120 #define SHIELD_GLOW_COMP 120
#define SHIELD_REFLECT_COMP 100 #define SHIELD_REFLECT_COMP 100
@@ -651,23 +641,27 @@ SetShieldThrobEffect (FRAME ShieldFrame, int offset, FRAME ThrobFrame)
static void static void
ApplyShieldTint (void) ApplyShieldTint (void)
{ {
UBYTE a; DrawMode mode, oldMode;
int blit_type; FRAME oldFrame;
FRAME tintFrame = pSolarSysState->Orbit.TintFrame; Color tint;
DWORD p; RECT r;
// TopoFrame will be permanently changed
oldFrame = SetContextFGFrame (pSolarSysState->TopoFrame);
SetContextClipRect (NULL);
GetContextClipRect (&r);
tint = BUILD_COLOR_RGBA (0xff, 0x00, 0x00, 0xff);
#ifdef USE_ALPHA_SHIELD #ifdef USE_ALPHA_SHIELD
a = 200; mode = MAKE_DRAW_MODE (DRAW_ALPHA, 150);
blit_type = 0;
#else #else
//additive_blit mode = MAKE_DRAW_MODE (DRAW_ADDITIVE, DRAW_FACTOR_1);
a = 255;
blit_type = -1;
#endif #endif
p = frame_mapRGBA (tintFrame, 255, 0, 0, a); oldMode = SetContextDrawMode (mode);
fill_frame_rgb (tintFrame, p, 0, 0, 0, 0); SetContextForeGroundColor (tint);
arith_frame_blit (tintFrame, NULL, pSolarSysState->TopoFrame, NULL, DrawFilledRectangle (&r);
0, blit_type); SetContextDrawMode (oldMode);
SetContextFGFrame (oldFrame);
} }
static inline UBYTE static inline UBYTE
@@ -1739,6 +1733,7 @@ GeneratePlanetSurface (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame)
old_seed = TFB_SeedRandom (pPlanetDesc->rand_seed); old_seed = TFB_SeedRandom (pPlanetDesc->rand_seed);
TopoContext = CreateContext ("Plangen.TopoContext"); TopoContext = CreateContext ("Plangen.TopoContext");
LockMutex (GraphicsLock);
OldContext = SetContext (TopoContext); OldContext = SetContext (TopoContext);
planet_orbit_init (); planet_orbit_init ();
@@ -1953,6 +1948,7 @@ GeneratePlanetSurface (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame)
} }
SetContext (OldContext); SetContext (OldContext);
UnlockMutex (GraphicsLock);
DestroyContext (TopoContext); DestroyContext (TopoContext);
TFB_SeedRandom (old_seed); TFB_SeedRandom (old_seed);