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:
@@ -317,6 +317,7 @@ typedef struct
|
||||
} DrawMode;
|
||||
|
||||
#define DRAW_REPLACE_MODE MAKE_DRAW_MODE (DRAW_REPLACE, 0)
|
||||
#define DRAW_FACTOR_1 0xff
|
||||
|
||||
static inline DrawMode
|
||||
MAKE_DRAW_MODE (DrawKind kind, SWORD factor)
|
||||
|
||||
@@ -37,16 +37,6 @@
|
||||
// an additive overlay for the shield effect
|
||||
#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_REFLECT_COMP 100
|
||||
|
||||
@@ -651,23 +641,27 @@ SetShieldThrobEffect (FRAME ShieldFrame, int offset, FRAME ThrobFrame)
|
||||
static void
|
||||
ApplyShieldTint (void)
|
||||
{
|
||||
UBYTE a;
|
||||
int blit_type;
|
||||
FRAME tintFrame = pSolarSysState->Orbit.TintFrame;
|
||||
DWORD p;
|
||||
DrawMode mode, oldMode;
|
||||
FRAME oldFrame;
|
||||
Color tint;
|
||||
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
|
||||
a = 200;
|
||||
blit_type = 0;
|
||||
mode = MAKE_DRAW_MODE (DRAW_ALPHA, 150);
|
||||
#else
|
||||
//additive_blit
|
||||
a = 255;
|
||||
blit_type = -1;
|
||||
mode = MAKE_DRAW_MODE (DRAW_ADDITIVE, DRAW_FACTOR_1);
|
||||
#endif
|
||||
p = frame_mapRGBA (tintFrame, 255, 0, 0, a);
|
||||
fill_frame_rgb (tintFrame, p, 0, 0, 0, 0);
|
||||
arith_frame_blit (tintFrame, NULL, pSolarSysState->TopoFrame, NULL,
|
||||
0, blit_type);
|
||||
oldMode = SetContextDrawMode (mode);
|
||||
SetContextForeGroundColor (tint);
|
||||
DrawFilledRectangle (&r);
|
||||
SetContextDrawMode (oldMode);
|
||||
SetContextFGFrame (oldFrame);
|
||||
}
|
||||
|
||||
static inline UBYTE
|
||||
@@ -1739,6 +1733,7 @@ GeneratePlanetSurface (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame)
|
||||
old_seed = TFB_SeedRandom (pPlanetDesc->rand_seed);
|
||||
|
||||
TopoContext = CreateContext ("Plangen.TopoContext");
|
||||
LockMutex (GraphicsLock);
|
||||
OldContext = SetContext (TopoContext);
|
||||
planet_orbit_init ();
|
||||
|
||||
@@ -1953,6 +1948,7 @@ GeneratePlanetSurface (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame)
|
||||
}
|
||||
|
||||
SetContext (OldContext);
|
||||
UnlockMutex (GraphicsLock);
|
||||
DestroyContext (TopoContext);
|
||||
|
||||
TFB_SeedRandom (old_seed);
|
||||
|
||||
Reference in New Issue
Block a user