PhracturedBlue's planet stuff fixes, details in ChangeLog
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@390 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1150,6 +1150,7 @@ PickGame (PMENU_STATE
|
||||
if (pSolarSysState)
|
||||
{
|
||||
++pSolarSysState->MenuState.Initialized;
|
||||
pSolarSysState->PauseRotate = 1;
|
||||
TaskSwitch ();
|
||||
}
|
||||
|
||||
@@ -1197,6 +1198,8 @@ if (CommData.ConversationPhrases
|
||||
if (pSolarSysState)
|
||||
{
|
||||
--pSolarSysState->MenuState.Initialized;
|
||||
pSolarSysState->PauseRotate = 0;
|
||||
|
||||
if (CommData.ConversationPhrases == 0 && !PLRPlaying ((MUSIC_REF)~0))
|
||||
{
|
||||
if (pSolarSysState->MenuState.Initialized < 3)
|
||||
|
||||
@@ -133,31 +133,37 @@ process_font (FRAMEPTR FramePtr, SDL_Surface *img[], int cel_ct)
|
||||
//stretch_frame
|
||||
// create a new frame of size neww x newh, and blit a scaled version FramePtr into it
|
||||
// destroy the old frame if 'destroy' is 1
|
||||
FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh,int destroy)
|
||||
FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh, int destroy)
|
||||
{
|
||||
FRAMEPTR NewFrame;
|
||||
UBYTE type;
|
||||
SDL_Surface *src,*dst;
|
||||
TFB_Image *tfbImg;
|
||||
SDL_Surface *src, *dst;
|
||||
type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr)
|
||||
->FlagsAndIndex) >> FTYPE_SHIFT;
|
||||
NewFrame = CaptureDrawable (
|
||||
CreateDrawable (type, (SIZE)neww, (SIZE)newh, 1)
|
||||
);
|
||||
src = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
||||
LockMutex (tfbImg->mutex);
|
||||
src = tfbImg->NormalImg;
|
||||
dst = ((TFB_Image *)((BYTE *)(NewFrame) + NewFrame->DataOffs))->NormalImg;
|
||||
SDL_LockSurface (src);
|
||||
SDL_LockSurface (dst);
|
||||
|
||||
zoomSurfaceRGBA(src, dst, 0);
|
||||
SDL_UnlockSurface (dst);
|
||||
SDL_UnlockSurface (src);
|
||||
if(destroy) {
|
||||
UnlockMutex (tfbImg->mutex);
|
||||
if (destroy)
|
||||
DestroyDrawable (ReleaseDrawable (FramePtr));
|
||||
}
|
||||
return(NewFrame);
|
||||
return (NewFrame);
|
||||
}
|
||||
|
||||
void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 *rgba, int maxx, int maxy)
|
||||
{
|
||||
int x, y;
|
||||
TFB_Image *tfbImg;
|
||||
SDL_Surface *img;
|
||||
PutPixelFn putpix;
|
||||
|
||||
@@ -166,30 +172,34 @@ void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 *rgba, int maxx, int maxy)
|
||||
|
||||
|
||||
// convert 32-bit png font to indexed
|
||||
img = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
||||
LockMutex (tfbImg->mutex);
|
||||
img = tfbImg->NormalImg;
|
||||
SDL_LockSurface (img);
|
||||
|
||||
putpix = putpixel_for (img);
|
||||
|
||||
for (y = 0; y < maxy; ++y)
|
||||
{
|
||||
for (x = 0; x < maxx; ++x)
|
||||
{
|
||||
putpix (img, x, y, *rgba++);
|
||||
}
|
||||
}
|
||||
SDL_UnlockSurface (img);
|
||||
UnlockMutex (tfbImg->mutex);
|
||||
}
|
||||
|
||||
void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, int x, int y)
|
||||
{
|
||||
SDL_Surface *img;
|
||||
TFB_Image *tfbImg;
|
||||
SDL_Rect rect;
|
||||
img = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||
|
||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
||||
LockMutex (tfbImg->mutex);
|
||||
img = tfbImg->NormalImg;
|
||||
SDL_LockSurface (img);
|
||||
if (x0 == 0 && y0 == 0 && x == 0 && y == 0) {
|
||||
if (x0 == 0 && y0 == 0 && x == 0 && y == 0)
|
||||
SDL_FillRect(img, NULL, color);
|
||||
} else {
|
||||
else
|
||||
{
|
||||
rect.x = x0;
|
||||
rect.y = y0;
|
||||
rect.w = x - x0;
|
||||
@@ -197,40 +207,88 @@ void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, int x, int
|
||||
SDL_FillRect(img, &rect, color);
|
||||
}
|
||||
SDL_UnlockSurface (img);
|
||||
UnlockMutex (tfbImg->mutex);
|
||||
}
|
||||
void add_sub_frame (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int add_sub)
|
||||
{
|
||||
int add = 0, sub = 0;
|
||||
TFB_Image *srcImg, *dstImg;
|
||||
SDL_Surface *src, *dst;
|
||||
SDL_Rect srcRect, dstRect, *srp = NULL, *drp = NULL;
|
||||
srcImg = (TFB_Image *)((BYTE *)(srcFrame) + srcFrame->DataOffs);
|
||||
dstImg = (TFB_Image *)((BYTE *)(dstFrame) + dstFrame->DataOffs);
|
||||
LockMutex (srcImg->mutex);
|
||||
LockMutex (dstImg->mutex);
|
||||
src = srcImg->NormalImg;
|
||||
dst = dstImg->NormalImg;
|
||||
if (rsrc)
|
||||
{
|
||||
srcRect.x = rsrc->corner.x;
|
||||
srcRect.y = rsrc->corner.y;
|
||||
srcRect.w = rsrc->extent.width;
|
||||
srcRect.h = rsrc->extent.height;
|
||||
srp = &srcRect;
|
||||
}
|
||||
if (rdst)
|
||||
{
|
||||
dstRect.x = rdst->corner.x;
|
||||
dstRect.y = rdst->corner.y;
|
||||
dstRect.w = rdst->extent.width;
|
||||
dstRect.h = rdst->extent.height;
|
||||
drp = &dstRect;
|
||||
}
|
||||
if (add_sub > 0)
|
||||
{
|
||||
add = -1;
|
||||
sub = 1;
|
||||
}
|
||||
else if (add_sub < 0)
|
||||
{
|
||||
add = 1;
|
||||
sub = -1;
|
||||
}
|
||||
TFB_BlitSurface (src, srp, dst, drp, sub, add);
|
||||
UnlockMutex (srcImg->mutex);
|
||||
UnlockMutex (dstImg->mutex);
|
||||
}
|
||||
|
||||
// Generate an array of all pixels in FramePtr
|
||||
// Generate an array of all pixels in FramePtr
|
||||
// The pixel format is :
|
||||
// bits 25-32 : red
|
||||
// bits 17-24 : green
|
||||
// bits 9-16 : blue
|
||||
// bits 1-8 : alpha
|
||||
Uint32 **getpixelarray(FRAMEPTR FramePtr,int width, int height)
|
||||
Uint32 **getpixelarray(FRAMEPTR FramePtr, int width, int height)
|
||||
{
|
||||
Uint8 r,g,b,a;
|
||||
Uint32 p, **map;
|
||||
TFB_Image *tfbImg;
|
||||
SDL_Surface *img;
|
||||
GetPixelFn getpix;
|
||||
int x,y;
|
||||
|
||||
img = ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
||||
LockMutex (tfbImg->mutex);
|
||||
img = tfbImg->NormalImg;
|
||||
SDL_LockSurface (img);
|
||||
getpix = getpixel_for (img);
|
||||
map=(Uint32 **)HMalloc(sizeof(Uint32 *)*(height+1));
|
||||
for (y=0;y<height;y++) {
|
||||
map[y]=(Uint32 *)HCalloc(width*sizeof(Uint32));
|
||||
if(y>=img->h) {
|
||||
map=(Uint32 **)HMalloc (sizeof(Uint32 *) * (height + 1));
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
map[y]=(Uint32 *)HCalloc (width * sizeof(Uint32));
|
||||
if(y >= img->h)
|
||||
continue;
|
||||
}
|
||||
for(x=0;x<img->w;x++) {
|
||||
p=getpix(img,x,y);
|
||||
SDL_GetRGBA(p,img->format,&r,&g,&b,&a);
|
||||
map[y][x]=r<<24 | g<<16 | b<<8 | a;
|
||||
for(x = 0; x < img->w; x++)
|
||||
{
|
||||
p = getpix (img, x, y);
|
||||
SDL_GetRGBA (p,img->format, &r, &g, &b, &a);
|
||||
map[y][x] = r << 24 | g << 16 | b << 8 | a;
|
||||
}
|
||||
}
|
||||
SDL_UnlockSurface (img);
|
||||
map[y]=NULL;
|
||||
return(map);
|
||||
UnlockMutex (tfbImg->mutex);
|
||||
map[y] = NULL;
|
||||
return (map);
|
||||
|
||||
}
|
||||
// Generate a pixel (in the correct format to be applied to FramePtr) from the
|
||||
@@ -238,7 +296,7 @@ Uint32 **getpixelarray(FRAMEPTR FramePtr,int width, int height)
|
||||
Uint32 frame_mapRGBA (FRAMEPTR FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
SDL_Surface *img= ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
||||
return(SDL_MapRGBA(img->format,r,g,b,a));
|
||||
return (SDL_MapRGBA (img->format, r, g, b, a));
|
||||
}
|
||||
|
||||
MEM_HANDLE
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#include "lifeform.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//define SPIN_ON_LAUNCH tolet the planet spin while
|
||||
// the lander animation is playing
|
||||
#undef SPIN_ON_LAUNCH
|
||||
|
||||
//Added by Chris
|
||||
|
||||
void InsertPrim (PRIM_LINKS *pLinks, COUNT primIndex, COUNT iPI);
|
||||
@@ -1445,6 +1449,9 @@ InitPlanetSide (void)
|
||||
DrawStamp (&s);
|
||||
ClearSemaphore (GraphicsSem);
|
||||
}
|
||||
#ifndef SPIN_ON_LAUNCH
|
||||
pSolarSysState->PauseRotate = 1;
|
||||
#endif
|
||||
SleepThreadUntil (Time + (ONE_SECOND / 15));
|
||||
|
||||
SetSemaphore (GraphicsSem);
|
||||
@@ -1452,7 +1459,12 @@ InitPlanetSide (void)
|
||||
GAME_SOUND_PRIORITY + 1);
|
||||
SetContext (SpaceContext);
|
||||
AnimateLaunch (LanderFrame[5], FALSE);
|
||||
|
||||
#ifdef SPIN_ON_LAUNCH
|
||||
pSolarSysState->PauseRotate = 1;
|
||||
ClearSemaphore (GraphicsSem);
|
||||
SleepThread (1);
|
||||
SetSemaphore (GraphicsSem);
|
||||
#endif
|
||||
// Adjust pSolarSysState->MenuState.first_item by a random jitter.
|
||||
#define RANDOM_MISS 64
|
||||
pt = pSolarSysState->MenuState.first_item;
|
||||
@@ -1853,7 +1865,7 @@ ReturnToOrbit (PRECT pRect)
|
||||
SetContext (OldContext);
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
SetPlanetTilt (0);
|
||||
// SetPlanetTilt (0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1997,13 +2009,17 @@ PlanetSide (PMENU_STATE pMS)
|
||||
}
|
||||
|
||||
ReturnToOrbit (&r);
|
||||
|
||||
pSolarSysState->MenuState.Initialized -= 4;
|
||||
#ifdef SPIN_ON_LAUNCH
|
||||
// If PauseRotate is set to 2 the plaet will be displayed, but won't rotate
|
||||
// Until the lander animation is complete
|
||||
pSolarSysState->PauseRotate = 0;
|
||||
// Give The RotatePlanet thread a slice to draw the planet
|
||||
SleepThread (1);
|
||||
pSolarSysState->MenuState.Initialized += 4;
|
||||
#endif
|
||||
|
||||
SetSemaphore (GraphicsSem);
|
||||
SetContext (SpaceContext);
|
||||
|
||||
AnimateLaunch (LanderFrame[6], TRUE);
|
||||
DeltaSISGauges (crew_left, 0, 0);
|
||||
|
||||
@@ -2054,6 +2070,7 @@ PlanetSide (PMENU_STATE pMS)
|
||||
MenuSounds = PSD.OldMenuSounds;
|
||||
|
||||
pSolarSysState->MenuState.Initialized -= 4;
|
||||
pSolarSysState->PauseRotate = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -20,15 +20,27 @@
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/graphics/drawable.h"
|
||||
|
||||
// define USE_ADDITIVE_SCAN_BLIT to use additive blittting
|
||||
// instead of transparency for the planet scans.
|
||||
// It still doesn't look right though (it is too bright)
|
||||
#define USE_ADDITIVE_SCAN_BLIT
|
||||
|
||||
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 fill_frame_rgb (FRAMEPTR FramePtr, DWORD color, int x0, int y0, int x, int y);
|
||||
|
||||
void add_sub_frame (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int add_sub);
|
||||
|
||||
extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
|
||||
extern void RenderLevelMasks (int, int);
|
||||
|
||||
extern void RenderLevelMasks (int);
|
||||
|
||||
void RepairBackRect (PRECT pRect);
|
||||
|
||||
// RotatePlanet
|
||||
// This will take care of zooming into a planet on orbit, generating the planet frames
|
||||
// And applying the shield.
|
||||
@@ -45,10 +57,13 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
|
||||
FRAME pFrame[2];
|
||||
COUNT i, num_frames;
|
||||
static COUNT scale_amt = PLANET_INIT_ZOOM_SIZE;
|
||||
RECT r, *rp = NULL;
|
||||
CONTEXT OldContext;
|
||||
|
||||
|
||||
// If thiis frame hasn' been generted, generate it
|
||||
if (! pSolarSysState->isPFADefined[x]) {
|
||||
RenderLevelMasks (x, da);
|
||||
RenderLevelMasks (x);
|
||||
pSolarSysState->isPFADefined[x] = 1;
|
||||
}
|
||||
num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2;
|
||||
@@ -57,7 +72,13 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
|
||||
pFrame[1] = pSolarSysState->ShieldFrame;
|
||||
if (zoom)
|
||||
{
|
||||
// we're zooming in, take care of scalinng the frames
|
||||
r.corner.x = 0;
|
||||
r.corner.y = 0;
|
||||
r.extent.width = SIS_SCREEN_WIDTH;
|
||||
r.extent.height = SIS_SCREEN_HEIGHT - MAP_HEIGHT;
|
||||
rp = &r;
|
||||
|
||||
// we're zooming in, take care of scaling the frames
|
||||
for (i=0; i < num_frames; i++)
|
||||
{
|
||||
COUNT frameh, this_scale;
|
||||
@@ -91,6 +112,11 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
|
||||
zoom = 0;
|
||||
}
|
||||
}
|
||||
SetSemaphore (GraphicsSem);
|
||||
OldContext = SetContext (SpaceContext);
|
||||
BatchGraphics ();
|
||||
if (rp)
|
||||
RepairBackRect (rp);
|
||||
s.origin.x = dx;
|
||||
s.origin.y = dy;
|
||||
for (i = 0; i < num_frames; i++)
|
||||
@@ -98,6 +124,9 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
|
||||
s.frame = pFrame[i];
|
||||
DrawStamp (&s);
|
||||
}
|
||||
UnbatchGraphics ();
|
||||
SetContext (OldContext);
|
||||
ClearSemaphore (GraphicsSem);
|
||||
return (zoom);
|
||||
}
|
||||
|
||||
@@ -109,35 +138,50 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
|
||||
s.origin.x = x;
|
||||
s.origin.y = y;
|
||||
s.frame = pSolarSysState->TopoFrame;
|
||||
DrawStamp (&s);
|
||||
if (pSolarSysState->ShieldFrame != 0)
|
||||
{
|
||||
rgb = 0x1f << 10;
|
||||
dy = GetFrameHeight (s.frame);
|
||||
a = 200;
|
||||
}
|
||||
if (rgb)
|
||||
BatchGraphics ();
|
||||
if (! rgb)
|
||||
DrawStamp (&s);
|
||||
else
|
||||
{
|
||||
UBYTE r, g, b;
|
||||
DWORD p;
|
||||
COUNT framew;
|
||||
FRAME tintFrame=pSolarSysState->TintFrame;
|
||||
|
||||
RECT drect;
|
||||
FRAME tintFrame = pSolarSysState->TintFrame[0];
|
||||
FRAME tintLine = pSolarSysState->TintFrame[1];
|
||||
if (rgb != pSolarSysState->Tint_rgb)
|
||||
{
|
||||
DWORD clear;
|
||||
pSolarSysState->Tint_rgb=rgb;
|
||||
clear = frame_mapRGBA (tintFrame, 0, 0, 0, 0);
|
||||
fill_frame_rgb (tintFrame, clear, 0, 0, 0, 0);
|
||||
// Buffer the topoMap to the tintFrame;
|
||||
add_sub_frame (s.frame, NULL, tintFrame, NULL, 0);
|
||||
r = (rgb & (0x1f << 10)) >> 8;
|
||||
g = (rgb & (0x1f << 5)) >> 3;
|
||||
b = (rgb & 0x1f) << 2;
|
||||
#ifdef USE_ADDITIVE_SCAN_BLIT
|
||||
a = 255;
|
||||
#endif
|
||||
p = frame_mapRGBA (tintFrame, r, g, b, a);
|
||||
fill_frame_rgb (tintLine, p, 0, 0, 0, 0);
|
||||
}
|
||||
framew = GetFrameWidth (tintFrame);
|
||||
r = (rgb & (0x1f << 10)) >> 8;
|
||||
g = (rgb & (0x1f << 5)) >> 3;
|
||||
b = (rgb & 0x1f) << 2;
|
||||
p = frame_mapRGBA (tintFrame, r, g, b, a);
|
||||
fill_frame_rgb (tintFrame, p, 0, 0, framew, dy);
|
||||
drect.corner.x = 0;
|
||||
drect.corner.y = dy;
|
||||
drect.extent.width = framew;
|
||||
drect.extent.height = 1;
|
||||
#ifdef USE_ADDITIVE_SCAN_BLIT
|
||||
add_sub_frame (tintLine, NULL, tintFrame, &drect, 1);
|
||||
#else
|
||||
add_sub_frame (tintLine, NULL, tintFrame, &drect, 0);
|
||||
#endif
|
||||
s.frame = tintFrame;
|
||||
DrawStamp (&s);
|
||||
}
|
||||
UnbatchGraphics ();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ void
|
||||
LoadPlanet (BOOLEAN IsDefined)
|
||||
{
|
||||
STAMP s;
|
||||
|
||||
SetSemaphore (GraphicsSem);
|
||||
|
||||
BatchGraphics ();
|
||||
@@ -114,16 +113,11 @@ LoadPlanet (BOOLEAN IsDefined)
|
||||
}
|
||||
DrawSISMessage (NULL_PTR);
|
||||
DrawSISTitle (GLOBAL_SIS (PlanetName));
|
||||
|
||||
DrawStarBackGround (TRUE);
|
||||
}
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
BatchGraphics ();
|
||||
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
|
||||
UnbatchGraphics ();
|
||||
|
||||
s.frame = pSolarSysState->PlanetSideFrame[2];
|
||||
if (s.frame)
|
||||
@@ -137,6 +131,10 @@ LoadPlanet (BOOLEAN IsDefined)
|
||||
{
|
||||
RECT r;
|
||||
|
||||
BatchGraphics ();
|
||||
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
|
||||
UnbatchGraphics ();
|
||||
|
||||
r.corner.x = SIS_ORG_X;
|
||||
r.corner.y = SIS_ORG_Y;
|
||||
r.extent.width = SIS_SCREEN_WIDTH;
|
||||
@@ -167,12 +165,19 @@ LoadPlanet (BOOLEAN IsDefined)
|
||||
if (LastActivity & CHECK_LOAD)
|
||||
{
|
||||
RECT r;
|
||||
CONTEXT oldContext;
|
||||
|
||||
r.corner.x = SIS_ORG_X;
|
||||
r.corner.y = SIS_ORG_Y;
|
||||
r.extent.width = SIS_SCREEN_WIDTH;
|
||||
r.extent.height = SIS_SCREEN_HEIGHT;
|
||||
SetSemaphore (GraphicsSem);
|
||||
oldContext = SetContext (SpaceContext);
|
||||
DrawStarBackGround (TRUE);
|
||||
SetContext (oldContext);
|
||||
BatchGraphics();
|
||||
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
|
||||
UnbatchGraphics();
|
||||
ScreenTransition (3, &r);
|
||||
UnbatchGraphics ();
|
||||
LoadIntoExtraScreen (&r);
|
||||
@@ -220,22 +225,24 @@ FreePlanet (void)
|
||||
HFree (pSolarSysState->isPFADefined);
|
||||
pSolarSysState->isPFADefined = 0;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (pSolarSysState->ScaleFrame[i])
|
||||
{
|
||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->ScaleFrame[i]));
|
||||
pSolarSysState->ScaleFrame[i]=0;
|
||||
}
|
||||
if (pSolarSysState->TintFrame[i])
|
||||
{
|
||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame[i]));
|
||||
pSolarSysState->TintFrame[i] = 0;
|
||||
}
|
||||
}
|
||||
pSolarSysState->Tint_rgb = 0;
|
||||
if(pSolarSysState->ShieldFrame != 0)
|
||||
{
|
||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->ShieldFrame));
|
||||
pSolarSysState->ShieldFrame = 0;
|
||||
}
|
||||
if (pSolarSysState->TintFrame != 0)
|
||||
{
|
||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame));
|
||||
pSolarSysState->TintFrame = 0;
|
||||
}
|
||||
pSolarSysState->Tint_rgb = 0;
|
||||
if (pSolarSysState->lpTopoMap!=0)
|
||||
{
|
||||
for (i=0; pSolarSysState->lpTopoMap[i] != NULL; i++)
|
||||
|
||||
@@ -169,9 +169,10 @@ typedef struct solarsys_state
|
||||
BYTE *isPFADefined;
|
||||
FRAME ScaleFrame[2];
|
||||
FRAME ShieldFrame;
|
||||
FRAME TintFrame;
|
||||
FRAME TintFrame[2];
|
||||
UWORD Tint_rgb;
|
||||
DWORD **lpTopoMap;
|
||||
UBYTE PauseRotate;
|
||||
} SOLARSYS_STATE;
|
||||
typedef SOLARSYS_STATE *PSOLARSYS_STATE;
|
||||
|
||||
|
||||
@@ -1087,9 +1087,12 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
|
||||
|
||||
OldContext = SetContext (TaskContext);
|
||||
pSolarSysState->isPFADefined = (BYTE *)HCalloc (sizeof(BYTE) * 255);
|
||||
pSolarSysState->TintFrame = CaptureDrawable (
|
||||
pSolarSysState->TintFrame[0] = CaptureDrawable (
|
||||
CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)MAP_HEIGHT, 1)
|
||||
);
|
||||
pSolarSysState->TintFrame[1] = CaptureDrawable (
|
||||
CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)1, 1)
|
||||
);
|
||||
|
||||
pSolarSysState->PlanetFrameArray = CaptureDrawable (
|
||||
CreateDrawable (WANT_PIXMAP, DIAMETER, DIAMETER, (COUNT)MAP_WIDTH)
|
||||
@@ -1276,30 +1279,18 @@ rotate_planet_task (void *data)
|
||||
view_index = MAP_WIDTH;
|
||||
do
|
||||
{
|
||||
CONTEXT OldContext;
|
||||
|
||||
SetSemaphore (GraphicsSem);
|
||||
if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3
|
||||
if (((PSOLARSYS_STATE volatile)pSS)->PauseRotate !=1
|
||||
// if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3
|
||||
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
||||
{
|
||||
OldContext = SetContext (SpaceContext);
|
||||
BatchGraphics ();
|
||||
if (repair)
|
||||
{
|
||||
RECT r;
|
||||
//PauseRotate == 2 is a single-step
|
||||
if (((PSOLARSYS_STATE volatile)pSS)->PauseRotate == 2)
|
||||
pSS->PauseRotate = 1;
|
||||
|
||||
r.corner.x = 0;
|
||||
r.corner.y = 0;
|
||||
r.extent.width = SIS_SCREEN_WIDTH;
|
||||
r.extent.height = SIS_SCREEN_HEIGHT - MAP_HEIGHT;
|
||||
RepairBackRect (&r);
|
||||
}
|
||||
repair = RotatePlanet (x, angle, SIS_SCREEN_WIDTH >> 1,
|
||||
(148 - SIS_ORG_Y) >> 1, zooming
|
||||
);
|
||||
|
||||
UnbatchGraphics ();
|
||||
SetContext (OldContext);
|
||||
if (!repair && zooming)
|
||||
{
|
||||
zooming = FALSE;
|
||||
@@ -1307,7 +1298,6 @@ rotate_planet_task (void *data)
|
||||
}
|
||||
x += i;
|
||||
}
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
SleepThreadUntil (TimeIn + (ONE_SECOND * ROTATION_TIME) / (MAP_WIDTH));
|
||||
// SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / (MAP_WIDTH-32)));
|
||||
|
||||
@@ -29,6 +29,10 @@ void WaitForNoInput (SIZE Duration);
|
||||
|
||||
//End Added by Chris
|
||||
|
||||
// define SPIN_ON_SCAN to allow the planet to spin
|
||||
// while scaning is going on
|
||||
#undef SPIN_ON_SCAN
|
||||
|
||||
#define FLASH_INDEX 105
|
||||
#define FLASH_WIDTH 9
|
||||
#define FLASH_HEIGHT 9
|
||||
@@ -761,8 +765,10 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
|
||||
return (PickPlanetSide (InputState, pMS));
|
||||
}
|
||||
|
||||
pSolarSysState->MenuState.Initialized += 4;
|
||||
|
||||
pSolarSysState->MenuState.Initialized += 4;
|
||||
#ifndef SPIN_ON_SCAN
|
||||
pSolarSysState->PauseRotate = 1;
|
||||
#endif
|
||||
if ((min_scan = pMS->CurState) != AUTO_SCAN)
|
||||
max_scan = min_scan;
|
||||
else
|
||||
@@ -857,7 +863,7 @@ pSolarSysState->MenuState.Initialized += 4;
|
||||
DrawScannedStuff (i, min_scan);
|
||||
UnbatchGraphics ();
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
// FlushGraphics ();
|
||||
SleepThread (2);
|
||||
}
|
||||
}
|
||||
@@ -884,7 +890,8 @@ pSolarSysState->MenuState.Initialized += 4;
|
||||
else
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
pSolarSysState->MenuState.Initialized -= 4;
|
||||
pSolarSysState->MenuState.Initialized -= 4;
|
||||
pSolarSysState->PauseRotate = 0;
|
||||
WaitForNoInput (ONE_SECOND / 2);
|
||||
}
|
||||
else if (!(pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
|
||||
|
||||
Reference in New Issue
Block a user