Planet code fixes, from PhracturedBlue
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@365 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -136,11 +136,12 @@ process_font (FRAMEPTR FramePtr, SDL_Surface *img[], int cel_ct)
|
|||||||
FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh,int destroy)
|
FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh,int destroy)
|
||||||
{
|
{
|
||||||
FRAMEPTR NewFrame;
|
FRAMEPTR NewFrame;
|
||||||
DWORD type;
|
UBYTE type;
|
||||||
SDL_Surface *src,*dst;
|
SDL_Surface *src,*dst;
|
||||||
type=TYPE_GET (FramePtr->TypeIndexAndFlags);
|
type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr)
|
||||||
|
->FlagsAndIndex) >> FTYPE_SHIFT;
|
||||||
NewFrame = CaptureDrawable (
|
NewFrame = CaptureDrawable (
|
||||||
CreateDrawable (/*WANT_PIXMAP*/type, (SIZE)neww, (SIZE)newh, 1)
|
CreateDrawable (type, (SIZE)neww, (SIZE)newh, 1)
|
||||||
);
|
);
|
||||||
src = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
src = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||||
dst = ((TFB_Image *)((BYTE *)(NewFrame) + NewFrame->DataOffs))->NormalImg;
|
dst = ((TFB_Image *)((BYTE *)(NewFrame) + NewFrame->DataOffs))->NormalImg;
|
||||||
@@ -154,9 +155,8 @@ FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh,int destroy)
|
|||||||
return(NewFrame);
|
return(NewFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 **rgba, int maxx, int maxy)
|
void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 *rgba, int maxx, int maxy)
|
||||||
{
|
{
|
||||||
int hx, hy;
|
|
||||||
int x, y;
|
int x, y;
|
||||||
SDL_Surface *img;
|
SDL_Surface *img;
|
||||||
PutPixelFn putpix;
|
PutPixelFn putpix;
|
||||||
@@ -164,7 +164,6 @@ void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 **rgba, int maxx, int maxy)
|
|||||||
// TYPE_SET (FramePtr->TypeIndexAndFlags, WANT_PIXMAP << FTYPE_SHIFT);
|
// TYPE_SET (FramePtr->TypeIndexAndFlags, WANT_PIXMAP << FTYPE_SHIFT);
|
||||||
// INDEX_SET (FramePtr->TypeIndexAndFlags, 1);
|
// INDEX_SET (FramePtr->TypeIndexAndFlags, 1);
|
||||||
|
|
||||||
hx = hy = 0;
|
|
||||||
|
|
||||||
// convert 32-bit png font to indexed
|
// convert 32-bit png font to indexed
|
||||||
img = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
img = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||||
@@ -176,11 +175,30 @@ void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 **rgba, int maxx, int maxy)
|
|||||||
{
|
{
|
||||||
for (x = 0; x < maxx; ++x)
|
for (x = 0; x < maxx; ++x)
|
||||||
{
|
{
|
||||||
putpix (img, x, y, rgba[y][x]);
|
putpix (img, x, y, *rgba++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface (img);
|
SDL_UnlockSurface (img);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, int x, int y)
|
||||||
|
{
|
||||||
|
SDL_Surface *img;
|
||||||
|
SDL_Rect rect;
|
||||||
|
img = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||||
|
SDL_LockSurface (img);
|
||||||
|
if (x0 == 0 && y0 == 0 && x == 0 && y == 0) {
|
||||||
|
SDL_FillRect(img, NULL, color);
|
||||||
|
} else {
|
||||||
|
rect.x = x0;
|
||||||
|
rect.y = y0;
|
||||||
|
rect.w = x - x0;
|
||||||
|
rect.h = y - y0;
|
||||||
|
SDL_FillRect(img, &rect, color);
|
||||||
|
}
|
||||||
|
SDL_UnlockSurface (img);
|
||||||
|
}
|
||||||
|
|
||||||
// Generate an array of all pixels in FramePtr
|
// Generate an array of all pixels in FramePtr
|
||||||
// The pixel format is :
|
// The pixel format is :
|
||||||
// bits 25-32 : red
|
// bits 25-32 : red
|
||||||
@@ -297,7 +315,7 @@ _GetCelData (FILE *fp, DWORD length)
|
|||||||
while (cel_ct--)
|
while (cel_ct--)
|
||||||
SDL_FreeSurface (img[cel_ct]);
|
SDL_FreeSurface (img[cel_ct]);
|
||||||
|
|
||||||
mem_release (Drawable);
|
mem_release ((MEM_HANDLE)Drawable);
|
||||||
Drawable = 0;
|
Drawable = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -336,7 +354,7 @@ _ReleaseCelData (MEM_HANDLE handle)
|
|||||||
cel_ct = INDEX_GET (DrawablePtr->FlagsAndIndex)+1;
|
cel_ct = INDEX_GET (DrawablePtr->FlagsAndIndex)+1;
|
||||||
|
|
||||||
FramePtr = &DrawablePtr->Frame[cel_ct];
|
FramePtr = &DrawablePtr->Frame[cel_ct];
|
||||||
if (TYPE_GET ((FramePtr-1)->TypeIndexAndFlags) != SCREEN_DRAWABLE)
|
if (!(TYPE_GET ((FramePtr-1)->TypeIndexAndFlags) & SCREEN_DRAWABLE))
|
||||||
{
|
{
|
||||||
while (--FramePtr, cel_ct--)
|
while (--FramePtr, cel_ct--)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,10 +22,13 @@
|
|||||||
|
|
||||||
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
|
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
|
||||||
|
|
||||||
void process_rgb_bmp (FRAME FramePtr, DWORD **rgba, int maxx, int maxy);
|
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
|
||||||
|
|
||||||
|
void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy);
|
||||||
|
void fill_frame_rgb (FRAMEPTR FramePtr, DWORD color, int x0, int y0, int x, int y);
|
||||||
|
|
||||||
extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
|
extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
|
||||||
extern void RenderLevelMasks (int, int);
|
extern void RenderLevelMasks (int, int);
|
||||||
|
|
||||||
// RotatePlanet
|
// RotatePlanet
|
||||||
// This will take care of zooming into a planet on orbit, generating the planet frames
|
// This will take care of zooming into a planet on orbit, generating the planet frames
|
||||||
// And applying the shield.
|
// And applying the shield.
|
||||||
@@ -49,7 +52,7 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
|
|||||||
pSolarSysState->isPFADefined[x] = 1;
|
pSolarSysState->isPFADefined[x] = 1;
|
||||||
}
|
}
|
||||||
num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2;
|
num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2;
|
||||||
pFrame[0] = pSolarSysState->PlanetFrameArray[x];
|
pFrame[0] = SetAbsFrameIndex (pSolarSysState->PlanetFrameArray, (COUNT)(x + 1));
|
||||||
if (num_frames == 2)
|
if (num_frames == 2)
|
||||||
pFrame[1] = pSolarSysState->ShieldFrame;
|
pFrame[1] = pSolarSysState->ShieldFrame;
|
||||||
if (zoom)
|
if (zoom)
|
||||||
@@ -116,35 +119,23 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
|
|||||||
if (rgb)
|
if (rgb)
|
||||||
{
|
{
|
||||||
UBYTE r, g, b;
|
UBYTE r, g, b;
|
||||||
DWORD **rgba, p;
|
DWORD p;
|
||||||
COUNT i, j, framew;
|
COUNT framew;
|
||||||
FRAME tintFrame;
|
FRAME tintFrame=pSolarSysState->TintFrame;
|
||||||
if (pSolarSysState->TintFrame != 0)
|
|
||||||
|
if (rgb != pSolarSysState->Tint_rgb)
|
||||||
{
|
{
|
||||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame));
|
DWORD clear;
|
||||||
pSolarSysState->TintFrame = 0;
|
pSolarSysState->Tint_rgb=rgb;
|
||||||
|
clear = frame_mapRGBA (tintFrame, 0, 0, 0, 0);
|
||||||
|
fill_frame_rgb (tintFrame, clear, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
framew = GetFrameWidth (s.frame);
|
framew = GetFrameWidth (tintFrame);
|
||||||
tintFrame = CaptureDrawable (
|
|
||||||
CreateDrawable (WANT_PIXMAP, framew, (UWORD)dy, 1)
|
|
||||||
);
|
|
||||||
pSolarSysState->TintFrame = tintFrame;
|
|
||||||
rgba = (DWORD **)HMalloc (sizeof(DWORD *) * dy);
|
|
||||||
r = (rgb & (0x1f << 10)) >> 8;
|
r = (rgb & (0x1f << 10)) >> 8;
|
||||||
g = (rgb & (0x1f << 5)) >> 3;
|
g = (rgb & (0x1f << 5)) >> 3;
|
||||||
b = (rgb & 0x1f) << 2;
|
b = (rgb & 0x1f) << 2;
|
||||||
p = frame_mapRGBA (tintFrame, r, g, b, a);
|
p = frame_mapRGBA (tintFrame, r, g, b, a);
|
||||||
for (i = 0; i < dy; i++)
|
fill_frame_rgb (tintFrame, p, 0, 0, framew, dy);
|
||||||
{
|
|
||||||
rgba[i] = (DWORD *)HMalloc (sizeof(DWORD)*framew);
|
|
||||||
for(j=0; j<framew; j++)
|
|
||||||
rgba[i][j] = p;
|
|
||||||
}
|
|
||||||
process_rgb_bmp (tintFrame, rgba, framew, dy);
|
|
||||||
SetFrameHot (tintFrame, MAKE_HOT_SPOT (0, 0));
|
|
||||||
for (i = 0;i < dy; i++)
|
|
||||||
HFree (rgba[i]);
|
|
||||||
HFree (rgba);
|
|
||||||
s.frame = tintFrame;
|
s.frame = tintFrame;
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,15 +185,15 @@ FreePlanet (void)
|
|||||||
{
|
{
|
||||||
COUNT i;
|
COUNT i;
|
||||||
|
|
||||||
SetSemaphore (GraphicsSem);
|
|
||||||
|
|
||||||
if (pSolarSysState->MenuState.flash_task)
|
if (pSolarSysState->MenuState.flash_task)
|
||||||
{
|
{
|
||||||
Task_SetState (pSolarSysState->MenuState.flash_task, TASK_EXIT);
|
ConcludeTask (pSolarSysState->MenuState.flash_task);
|
||||||
|
// Task_SetState (pSolarSysState->MenuState.flash_task, TASK_EXIT);
|
||||||
pSolarSysState->MenuState.flash_task = 0;
|
pSolarSysState->MenuState.flash_task = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
|
||||||
for (i = 0; i < sizeof (pSolarSysState->PlanetSideFrame)
|
for (i = 0; i < sizeof (pSolarSysState->PlanetSideFrame)
|
||||||
/ sizeof (pSolarSysState->PlanetSideFrame[0]); ++i)
|
/ sizeof (pSolarSysState->PlanetSideFrame[0]); ++i)
|
||||||
@@ -213,11 +213,10 @@ FreePlanet (void)
|
|||||||
pSolarSysState->TopoFrame = 0;
|
pSolarSysState->TopoFrame = 0;
|
||||||
DestroyColorMap (ReleaseColorMap (pSolarSysState->OrbitalCMap));
|
DestroyColorMap (ReleaseColorMap (pSolarSysState->OrbitalCMap));
|
||||||
pSolarSysState->OrbitalCMap = 0;
|
pSolarSysState->OrbitalCMap = 0;
|
||||||
for (i=0; i<255; i++)
|
DestroyDrawable (ReleaseDrawable (pSolarSysState->PlanetFrameArray));
|
||||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->PlanetFrameArray[i]));
|
|
||||||
HFree (pSolarSysState->PlanetFrameArray);
|
|
||||||
pSolarSysState->PlanetFrameArray = 0;
|
pSolarSysState->PlanetFrameArray = 0;
|
||||||
|
|
||||||
|
|
||||||
HFree (pSolarSysState->isPFADefined);
|
HFree (pSolarSysState->isPFADefined);
|
||||||
pSolarSysState->isPFADefined = 0;
|
pSolarSysState->isPFADefined = 0;
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
@@ -236,6 +235,7 @@ FreePlanet (void)
|
|||||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame));
|
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame));
|
||||||
pSolarSysState->TintFrame = 0;
|
pSolarSysState->TintFrame = 0;
|
||||||
}
|
}
|
||||||
|
pSolarSysState->Tint_rgb = 0;
|
||||||
if (pSolarSysState->lpTopoMap!=0)
|
if (pSolarSysState->lpTopoMap!=0)
|
||||||
{
|
{
|
||||||
for (i=0; pSolarSysState->lpTopoMap[i] != NULL; i++)
|
for (i=0; pSolarSysState->lpTopoMap[i] != NULL; i++)
|
||||||
|
|||||||
@@ -165,11 +165,12 @@ typedef struct solarsys_state
|
|||||||
PLAN_GEN_FUNC GenFunc;
|
PLAN_GEN_FUNC GenFunc;
|
||||||
|
|
||||||
FRAME PlanetSideFrame[6];
|
FRAME PlanetSideFrame[6];
|
||||||
FRAME *PlanetFrameArray;
|
FRAME PlanetFrameArray;
|
||||||
|
BYTE *isPFADefined;
|
||||||
FRAME ScaleFrame[2];
|
FRAME ScaleFrame[2];
|
||||||
FRAME ShieldFrame;
|
FRAME ShieldFrame;
|
||||||
FRAME TintFrame;
|
FRAME TintFrame;
|
||||||
BYTE *isPFADefined;
|
UWORD Tint_rgb;
|
||||||
DWORD **lpTopoMap;
|
DWORD **lpTopoMap;
|
||||||
} SOLARSYS_STATE;
|
} SOLARSYS_STATE;
|
||||||
typedef SOLARSYS_STATE *PSOLARSYS_STATE;
|
typedef SOLARSYS_STATE *PSOLARSYS_STATE;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int RotatePlanet (int x, int angle, int dx, int dy,int zoom);
|
|||||||
|
|
||||||
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
|
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
|
||||||
|
|
||||||
void process_rgb_bmp (FRAME FramePtr, DWORD **rgba, int maxx, int maxy);
|
void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy);
|
||||||
|
|
||||||
FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
|
FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
|
||||||
|
|
||||||
@@ -405,7 +405,8 @@ SetPlanetTilt (int angle)
|
|||||||
#define SHIELD_RADIUS_2 (SHIELD_RADIUS * SHIELD_RADIUS)
|
#define SHIELD_RADIUS_2 (SHIELD_RADIUS * SHIELD_RADIUS)
|
||||||
static void CreateShieldMask ()
|
static void CreateShieldMask ()
|
||||||
{
|
{
|
||||||
DWORD rad2, clear, **rgba, p;
|
|
||||||
|
DWORD rad2, clear, *rgba, *p_rgba, p;
|
||||||
UBYTE red_nt;
|
UBYTE red_nt;
|
||||||
int x, y;
|
int x, y;
|
||||||
FRAME ShieldFrame;
|
FRAME ShieldFrame;
|
||||||
@@ -414,7 +415,8 @@ static void CreateShieldMask ()
|
|||||||
ShieldFrame = CaptureDrawable (
|
ShieldFrame = CaptureDrawable (
|
||||||
CreateDrawable (WANT_PIXMAP, SHIELD_DIAM, SHIELD_DIAM, 1)
|
CreateDrawable (WANT_PIXMAP, SHIELD_DIAM, SHIELD_DIAM, 1)
|
||||||
);
|
);
|
||||||
rgba = (DWORD **)HMalloc (sizeof (DWORD *) * (SHIELD_DIAM));
|
rgba = (DWORD *)HMalloc (sizeof (DWORD *) * (SHIELD_DIAM) * (SHIELD_DIAM));
|
||||||
|
p_rgba = rgba;
|
||||||
// This is a non-transparent red for the halo
|
// This is a non-transparent red for the halo
|
||||||
red_nt = 180;
|
red_nt = 180;
|
||||||
// This is 100% transparent.
|
// This is 100% transparent.
|
||||||
@@ -423,7 +425,6 @@ static void CreateShieldMask ()
|
|||||||
aa_delta2 = (RADIUS + 3) * (RADIUS + 3) - (RADIUS + 2)*(RADIUS + 2);
|
aa_delta2 = (RADIUS + 3) * (RADIUS + 3) - (RADIUS + 2)*(RADIUS + 2);
|
||||||
for (y = -SHIELD_RADIUS; y <= SHIELD_RADIUS; y++)
|
for (y = -SHIELD_RADIUS; y <= SHIELD_RADIUS; y++)
|
||||||
{
|
{
|
||||||
rgba[y+SHIELD_RADIUS] = (DWORD *)HCalloc (sizeof (DWORD) * (SHIELD_DIAM));
|
|
||||||
for (x = -SHIELD_RADIUS; x <= SHIELD_RADIUS; x++)
|
for (x = -SHIELD_RADIUS; x <= SHIELD_RADIUS; x++)
|
||||||
{
|
{
|
||||||
rad2 = x * x + y * y;
|
rad2 = x * x + y * y;
|
||||||
@@ -459,15 +460,11 @@ static void CreateShieldMask ()
|
|||||||
else
|
else
|
||||||
p = clear;
|
p = clear;
|
||||||
|
|
||||||
rgba[y + SHIELD_RADIUS][x + SHIELD_RADIUS] = p;
|
*p_rgba++ = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
process_rgb_bmp (ShieldFrame, rgba, SHIELD_DIAM, SHIELD_DIAM);
|
process_rgb_bmp (ShieldFrame, rgba, SHIELD_DIAM, SHIELD_DIAM);
|
||||||
SetFrameHot (ShieldFrame, MAKE_HOT_SPOT (SHIELD_RADIUS + 1,SHIELD_RADIUS + 1));
|
SetFrameHot (ShieldFrame, MAKE_HOT_SPOT (SHIELD_RADIUS + 1,SHIELD_RADIUS + 1));
|
||||||
for (y=-SHIELD_RADIUS; y <= SHIELD_RADIUS; ++y)
|
|
||||||
{
|
|
||||||
HFree (rgba[y + SHIELD_RADIUS]);
|
|
||||||
}
|
|
||||||
HFree(rgba);
|
HFree(rgba);
|
||||||
pSolarSysState->ShieldFrame = ShieldFrame;
|
pSolarSysState->ShieldFrame = ShieldFrame;
|
||||||
}
|
}
|
||||||
@@ -479,7 +476,7 @@ void
|
|||||||
RenderLevelMasks (int offset)
|
RenderLevelMasks (int offset)
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt;
|
||||||
DWORD **rgba;
|
DWORD *rgba, *p_rgba;
|
||||||
int x, y;
|
int x, y;
|
||||||
DWORD p, **pixels;
|
DWORD p, **pixels;
|
||||||
FRAME MaskFrame;
|
FRAME MaskFrame;
|
||||||
@@ -491,13 +488,13 @@ RenderLevelMasks (int offset)
|
|||||||
t1 = clock ();
|
t1 = clock ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rgba = HMalloc (sizeof (DWORD *) * (DIAMETER));
|
rgba = (DWORD *)HMalloc (sizeof (DWORD *) * (DIAMETER) * (DIAMETER));
|
||||||
|
p_rgba = rgba;
|
||||||
// Choose the correct Frame to wrte to
|
// Choose the correct Frame to wrte to
|
||||||
MaskFrame = pSolarSysState->PlanetFrameArray[offset];
|
MaskFrame = SetAbsFrameIndex (pSolarSysState->PlanetFrameArray, (COUNT)(offset + 1));
|
||||||
pixels = pSolarSysState->lpTopoMap;
|
pixels = pSolarSysState->lpTopoMap;
|
||||||
for (pt.y = 0, y = -RADIUS; pt.y <= TWORADIUS; ++pt.y, ++y)
|
for (pt.y = 0, y = -RADIUS; pt.y <= TWORADIUS; ++pt.y, ++y)
|
||||||
{
|
{
|
||||||
rgba[pt.y] = HCalloc (sizeof (DWORD) * (DIAMETER));
|
|
||||||
for (pt.x = 0, x = -RADIUS; pt.x <= TWORADIUS; ++pt.x, ++x)
|
for (pt.x = 0, x = -RADIUS; pt.x <= TWORADIUS; ++pt.x, ++x)
|
||||||
{
|
{
|
||||||
UBYTE c[3];
|
UBYTE c[3];
|
||||||
@@ -535,18 +532,16 @@ RenderLevelMasks (int offset)
|
|||||||
c[1] = GET_PHONG (c[1], ph);
|
c[1] = GET_PHONG (c[1], ph);
|
||||||
c[0] = GET_PHONG (c[0], ph);
|
c[0] = GET_PHONG (c[0], ph);
|
||||||
}
|
}
|
||||||
rgba[pt.y][pt.x] = frame_mapRGBA (
|
*p_rgba++ = frame_mapRGBA (
|
||||||
MaskFrame, c[2], c[1], c[0], (UBYTE)255);
|
MaskFrame, c[2], c[1], c[0], (UBYTE)255);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rgba[pt.y][pt.x] = frame_mapRGBA (MaskFrame, 0, 0, 0, 0);
|
*p_rgba++ = frame_mapRGBA (MaskFrame, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Map the rgb bitmap onto the SDL_Surface
|
// Map the rgb bitmap onto the SDL_Surface
|
||||||
process_rgb_bmp (pSolarSysState->PlanetFrameArray[offset], rgba, DIAMETER, DIAMETER);
|
process_rgb_bmp (MaskFrame, rgba, DIAMETER, DIAMETER);
|
||||||
SetFrameHot (MaskFrame, MAKE_HOT_SPOT (RADIUS + 1, RADIUS + 1));
|
SetFrameHot (MaskFrame, MAKE_HOT_SPOT (RADIUS + 1, RADIUS + 1));
|
||||||
for (pt.y = 0; pt.y <= TWORADIUS; ++pt.y)
|
|
||||||
HFree (rgba[pt.y]);
|
|
||||||
HFree(rgba);
|
HFree(rgba);
|
||||||
#if PROFILE
|
#if PROFILE
|
||||||
t += clock() - t1;
|
t += clock() - t1;
|
||||||
@@ -1091,10 +1086,12 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
|
|||||||
|
|
||||||
OldContext = SetContext (TaskContext);
|
OldContext = SetContext (TaskContext);
|
||||||
pSolarSysState->isPFADefined = (BYTE *)HCalloc (sizeof(BYTE) * 255);
|
pSolarSysState->isPFADefined = (BYTE *)HCalloc (sizeof(BYTE) * 255);
|
||||||
pSolarSysState->PlanetFrameArray = HMalloc (sizeof(FRAME) * 255);
|
pSolarSysState->TintFrame = CaptureDrawable (
|
||||||
for (i = 0; i < 255; i++)
|
CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)MAP_HEIGHT, 1)
|
||||||
pSolarSysState->PlanetFrameArray[i] = CaptureDrawable (
|
);
|
||||||
CreateDrawable (WANT_PIXMAP, DIAMETER, DIAMETER, 1)
|
|
||||||
|
pSolarSysState->PlanetFrameArray = CaptureDrawable (
|
||||||
|
CreateDrawable (WANT_PIXMAP, DIAMETER, DIAMETER, (COUNT)MAP_WIDTH)
|
||||||
);
|
);
|
||||||
if (IsEarth)
|
if (IsEarth)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user