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:
gewlitys
2002-12-10 17:45:13 +00:00
parent 735e636f97
commit 69afc0541c
8 changed files with 215 additions and 88 deletions
+3
View File
@@ -1150,6 +1150,7 @@ PickGame (PMENU_STATE
if (pSolarSysState) if (pSolarSysState)
{ {
++pSolarSysState->MenuState.Initialized; ++pSolarSysState->MenuState.Initialized;
pSolarSysState->PauseRotate = 1;
TaskSwitch (); TaskSwitch ();
} }
@@ -1197,6 +1198,8 @@ if (CommData.ConversationPhrases
if (pSolarSysState) if (pSolarSysState)
{ {
--pSolarSysState->MenuState.Initialized; --pSolarSysState->MenuState.Initialized;
pSolarSysState->PauseRotate = 0;
if (CommData.ConversationPhrases == 0 && !PLRPlaying ((MUSIC_REF)~0)) if (CommData.ConversationPhrases == 0 && !PLRPlaying ((MUSIC_REF)~0))
{ {
if (pSolarSysState->MenuState.Initialized < 3) if (pSolarSysState->MenuState.Initialized < 3)
+87 -29
View File
@@ -133,31 +133,37 @@ process_font (FRAMEPTR FramePtr, SDL_Surface *img[], int cel_ct)
//stretch_frame //stretch_frame
// create a new frame of size neww x newh, and blit a scaled version FramePtr into it // 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 // 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; FRAMEPTR NewFrame;
UBYTE type; UBYTE type;
SDL_Surface *src,*dst; TFB_Image *tfbImg;
SDL_Surface *src, *dst;
type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr) type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr)
->FlagsAndIndex) >> FTYPE_SHIFT; ->FlagsAndIndex) >> FTYPE_SHIFT;
NewFrame = CaptureDrawable ( NewFrame = CaptureDrawable (
CreateDrawable (type, (SIZE)neww, (SIZE)newh, 1) 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; dst = ((TFB_Image *)((BYTE *)(NewFrame) + NewFrame->DataOffs))->NormalImg;
SDL_LockSurface (src); SDL_LockSurface (src);
SDL_LockSurface (dst);
zoomSurfaceRGBA(src, dst, 0); zoomSurfaceRGBA(src, dst, 0);
SDL_UnlockSurface (dst);
SDL_UnlockSurface (src); SDL_UnlockSurface (src);
if(destroy) { UnlockMutex (tfbImg->mutex);
if (destroy)
DestroyDrawable (ReleaseDrawable (FramePtr)); DestroyDrawable (ReleaseDrawable (FramePtr));
} 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 x, y; int x, y;
TFB_Image *tfbImg;
SDL_Surface *img; SDL_Surface *img;
PutPixelFn putpix; 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 // 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); SDL_LockSurface (img);
putpix = putpixel_for (img); putpix = putpixel_for (img);
for (y = 0; y < maxy; ++y) for (y = 0; y < maxy; ++y)
{
for (x = 0; x < maxx; ++x) for (x = 0; x < maxx; ++x)
{
putpix (img, x, y, *rgba++); putpix (img, x, y, *rgba++);
}
}
SDL_UnlockSurface (img); SDL_UnlockSurface (img);
UnlockMutex (tfbImg->mutex);
} }
void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, int x, int y) void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, int x, int y)
{ {
SDL_Surface *img; SDL_Surface *img;
TFB_Image *tfbImg;
SDL_Rect rect; 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); 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); SDL_FillRect(img, NULL, color);
} else { else
{
rect.x = x0; rect.x = x0;
rect.y = y0; rect.y = y0;
rect.w = x - x0; 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_FillRect(img, &rect, color);
} }
SDL_UnlockSurface (img); 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 : // The pixel format is :
// bits 25-32 : red // bits 25-32 : red
// bits 17-24 : green // bits 17-24 : green
// bits 9-16 : blue // bits 9-16 : blue
// bits 1-8 : alpha // 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; Uint8 r,g,b,a;
Uint32 p, **map; Uint32 p, **map;
TFB_Image *tfbImg;
SDL_Surface *img; SDL_Surface *img;
GetPixelFn getpix; GetPixelFn getpix;
int x,y; 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); SDL_LockSurface (img);
getpix = getpixel_for (img); getpix = getpixel_for (img);
map=(Uint32 **)HMalloc(sizeof(Uint32 *)*(height+1)); map=(Uint32 **)HMalloc (sizeof(Uint32 *) * (height + 1));
for (y=0;y<height;y++) { for (y = 0; y < height; y++)
map[y]=(Uint32 *)HCalloc(width*sizeof(Uint32)); {
if(y>=img->h) { map[y]=(Uint32 *)HCalloc (width * sizeof(Uint32));
if(y >= img->h)
continue; continue;
} for(x = 0; x < img->w; x++)
for(x=0;x<img->w;x++) { {
p=getpix(img,x,y); p = getpix (img, x, y);
SDL_GetRGBA(p,img->format,&r,&g,&b,&a); SDL_GetRGBA (p,img->format, &r, &g, &b, &a);
map[y][x]=r<<24 | g<<16 | b<<8 | a; map[y][x] = r << 24 | g << 16 | b << 8 | a;
} }
} }
SDL_UnlockSurface (img); SDL_UnlockSurface (img);
map[y]=NULL; UnlockMutex (tfbImg->mutex);
return(map); map[y] = NULL;
return (map);
} }
// Generate a pixel (in the correct format to be applied to FramePtr) from the // 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) Uint32 frame_mapRGBA (FRAMEPTR FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{ {
SDL_Surface *img= ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg; 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 MEM_HANDLE
+22 -5
View File
@@ -21,6 +21,10 @@
#include "lifeform.h" #include "lifeform.h"
#include "libs/graphics/gfx_common.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 //Added by Chris
void InsertPrim (PRIM_LINKS *pLinks, COUNT primIndex, COUNT iPI); void InsertPrim (PRIM_LINKS *pLinks, COUNT primIndex, COUNT iPI);
@@ -1445,6 +1449,9 @@ InitPlanetSide (void)
DrawStamp (&s); DrawStamp (&s);
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
} }
#ifndef SPIN_ON_LAUNCH
pSolarSysState->PauseRotate = 1;
#endif
SleepThreadUntil (Time + (ONE_SECOND / 15)); SleepThreadUntil (Time + (ONE_SECOND / 15));
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
@@ -1452,7 +1459,12 @@ InitPlanetSide (void)
GAME_SOUND_PRIORITY + 1); GAME_SOUND_PRIORITY + 1);
SetContext (SpaceContext); SetContext (SpaceContext);
AnimateLaunch (LanderFrame[5], FALSE); 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. // Adjust pSolarSysState->MenuState.first_item by a random jitter.
#define RANDOM_MISS 64 #define RANDOM_MISS 64
pt = pSolarSysState->MenuState.first_item; pt = pSolarSysState->MenuState.first_item;
@@ -1853,7 +1865,7 @@ ReturnToOrbit (PRECT pRect)
SetContext (OldContext); SetContext (OldContext);
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
SetPlanetTilt (0); // SetPlanetTilt (0);
} }
void void
@@ -1997,13 +2009,17 @@ PlanetSide (PMENU_STATE pMS)
} }
ReturnToOrbit (&r); ReturnToOrbit (&r);
#ifdef SPIN_ON_LAUNCH
pSolarSysState->MenuState.Initialized -= 4; // 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); SleepThread (1);
pSolarSysState->MenuState.Initialized += 4; #endif
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
SetContext (SpaceContext); SetContext (SpaceContext);
AnimateLaunch (LanderFrame[6], TRUE); AnimateLaunch (LanderFrame[6], TRUE);
DeltaSISGauges (crew_left, 0, 0); DeltaSISGauges (crew_left, 0, 0);
@@ -2054,6 +2070,7 @@ PlanetSide (PMENU_STATE pMS)
MenuSounds = PSD.OldMenuSounds; MenuSounds = PSD.OldMenuSounds;
pSolarSysState->MenuState.Initialized -= 4; pSolarSysState->MenuState.Initialized -= 4;
pSolarSysState->PauseRotate = 0;
} }
void void
+59 -15
View File
@@ -20,15 +20,27 @@
#include "libs/graphics/gfx_common.h" #include "libs/graphics/gfx_common.h"
#include "libs/graphics/drawable.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);
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);
void fill_frame_rgb (FRAMEPTR FramePtr, DWORD color, int x0, int y0, int x, int y); 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 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 // 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.
@@ -45,10 +57,13 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
FRAME pFrame[2]; FRAME pFrame[2];
COUNT i, num_frames; COUNT i, num_frames;
static COUNT scale_amt = PLANET_INIT_ZOOM_SIZE; static COUNT scale_amt = PLANET_INIT_ZOOM_SIZE;
RECT r, *rp = NULL;
CONTEXT OldContext;
// If thiis frame hasn' been generted, generate it // If thiis frame hasn' been generted, generate it
if (! pSolarSysState->isPFADefined[x]) { if (! pSolarSysState->isPFADefined[x]) {
RenderLevelMasks (x, da); RenderLevelMasks (x);
pSolarSysState->isPFADefined[x] = 1; pSolarSysState->isPFADefined[x] = 1;
} }
num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2; 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; pFrame[1] = pSolarSysState->ShieldFrame;
if (zoom) 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++) for (i=0; i < num_frames; i++)
{ {
COUNT frameh, this_scale; COUNT frameh, this_scale;
@@ -91,6 +112,11 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
zoom = 0; zoom = 0;
} }
} }
SetSemaphore (GraphicsSem);
OldContext = SetContext (SpaceContext);
BatchGraphics ();
if (rp)
RepairBackRect (rp);
s.origin.x = dx; s.origin.x = dx;
s.origin.y = dy; s.origin.y = dy;
for (i = 0; i < num_frames; i++) 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]; s.frame = pFrame[i];
DrawStamp (&s); DrawStamp (&s);
} }
UnbatchGraphics ();
SetContext (OldContext);
ClearSemaphore (GraphicsSem);
return (zoom); return (zoom);
} }
@@ -109,35 +138,50 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
s.origin.x = x; s.origin.x = x;
s.origin.y = y; s.origin.y = y;
s.frame = pSolarSysState->TopoFrame; s.frame = pSolarSysState->TopoFrame;
DrawStamp (&s);
if (pSolarSysState->ShieldFrame != 0) if (pSolarSysState->ShieldFrame != 0)
{ {
rgb = 0x1f << 10; rgb = 0x1f << 10;
dy = GetFrameHeight (s.frame); dy = GetFrameHeight (s.frame);
a = 200; a = 200;
} }
if (rgb) BatchGraphics ();
if (! rgb)
DrawStamp (&s);
else
{ {
UBYTE r, g, b; UBYTE r, g, b;
DWORD p; DWORD p;
COUNT framew; COUNT framew;
FRAME tintFrame=pSolarSysState->TintFrame; RECT drect;
FRAME tintFrame = pSolarSysState->TintFrame[0];
FRAME tintLine = pSolarSysState->TintFrame[1];
if (rgb != pSolarSysState->Tint_rgb) if (rgb != pSolarSysState->Tint_rgb)
{ {
DWORD clear;
pSolarSysState->Tint_rgb=rgb; pSolarSysState->Tint_rgb=rgb;
clear = frame_mapRGBA (tintFrame, 0, 0, 0, 0); // Buffer the topoMap to the tintFrame;
fill_frame_rgb (tintFrame, clear, 0, 0, 0, 0); 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); framew = GetFrameWidth (tintFrame);
r = (rgb & (0x1f << 10)) >> 8; drect.corner.x = 0;
g = (rgb & (0x1f << 5)) >> 3; drect.corner.y = dy;
b = (rgb & 0x1f) << 2; drect.extent.width = framew;
p = frame_mapRGBA (tintFrame, r, g, b, a); drect.extent.height = 1;
fill_frame_rgb (tintFrame, p, 0, 0, framew, dy); #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; s.frame = tintFrame;
DrawStamp (&s); DrawStamp (&s);
} }
UnbatchGraphics ();
} }
+19 -12
View File
@@ -61,7 +61,6 @@ void
LoadPlanet (BOOLEAN IsDefined) LoadPlanet (BOOLEAN IsDefined)
{ {
STAMP s; STAMP s;
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
BatchGraphics (); BatchGraphics ();
@@ -114,16 +113,11 @@ LoadPlanet (BOOLEAN IsDefined)
} }
DrawSISMessage (NULL_PTR); DrawSISMessage (NULL_PTR);
DrawSISTitle (GLOBAL_SIS (PlanetName)); DrawSISTitle (GLOBAL_SIS (PlanetName));
DrawStarBackGround (TRUE);
} }
SetContext (SpaceContext); SetContext (SpaceContext);
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE); 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]; s.frame = pSolarSysState->PlanetSideFrame[2];
if (s.frame) if (s.frame)
@@ -137,6 +131,10 @@ LoadPlanet (BOOLEAN IsDefined)
{ {
RECT r; 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.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y; r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH; r.extent.width = SIS_SCREEN_WIDTH;
@@ -167,12 +165,19 @@ LoadPlanet (BOOLEAN IsDefined)
if (LastActivity & CHECK_LOAD) if (LastActivity & CHECK_LOAD)
{ {
RECT r; RECT r;
CONTEXT oldContext;
r.corner.x = SIS_ORG_X; r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y; r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH; r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT; r.extent.height = SIS_SCREEN_HEIGHT;
SetSemaphore (GraphicsSem); 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); ScreenTransition (3, &r);
UnbatchGraphics (); UnbatchGraphics ();
LoadIntoExtraScreen (&r); LoadIntoExtraScreen (&r);
@@ -220,22 +225,24 @@ FreePlanet (void)
HFree (pSolarSysState->isPFADefined); HFree (pSolarSysState->isPFADefined);
pSolarSysState->isPFADefined = 0; pSolarSysState->isPFADefined = 0;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{
if (pSolarSysState->ScaleFrame[i]) if (pSolarSysState->ScaleFrame[i])
{ {
DestroyDrawable (ReleaseDrawable (pSolarSysState->ScaleFrame[i])); DestroyDrawable (ReleaseDrawable (pSolarSysState->ScaleFrame[i]));
pSolarSysState->ScaleFrame[i]=0; 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) if(pSolarSysState->ShieldFrame != 0)
{ {
DestroyDrawable (ReleaseDrawable (pSolarSysState->ShieldFrame)); DestroyDrawable (ReleaseDrawable (pSolarSysState->ShieldFrame));
pSolarSysState->ShieldFrame = 0; pSolarSysState->ShieldFrame = 0;
} }
if (pSolarSysState->TintFrame != 0)
{
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame));
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++)
+2 -1
View File
@@ -169,9 +169,10 @@ typedef struct solarsys_state
BYTE *isPFADefined; BYTE *isPFADefined;
FRAME ScaleFrame[2]; FRAME ScaleFrame[2];
FRAME ShieldFrame; FRAME ShieldFrame;
FRAME TintFrame; FRAME TintFrame[2];
UWORD Tint_rgb; UWORD Tint_rgb;
DWORD **lpTopoMap; DWORD **lpTopoMap;
UBYTE PauseRotate;
} SOLARSYS_STATE; } SOLARSYS_STATE;
typedef SOLARSYS_STATE *PSOLARSYS_STATE; typedef SOLARSYS_STATE *PSOLARSYS_STATE;
+9 -19
View File
@@ -1087,9 +1087,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->TintFrame = CaptureDrawable ( pSolarSysState->TintFrame[0] = CaptureDrawable (
CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)MAP_HEIGHT, 1) 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 ( pSolarSysState->PlanetFrameArray = CaptureDrawable (
CreateDrawable (WANT_PIXMAP, DIAMETER, DIAMETER, (COUNT)MAP_WIDTH) CreateDrawable (WANT_PIXMAP, DIAMETER, DIAMETER, (COUNT)MAP_WIDTH)
@@ -1276,30 +1279,18 @@ rotate_planet_task (void *data)
view_index = MAP_WIDTH; view_index = MAP_WIDTH;
do do
{ {
CONTEXT OldContext; if (((PSOLARSYS_STATE volatile)pSS)->PauseRotate !=1
// if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3
SetSemaphore (GraphicsSem);
if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT)) && !(GLOBAL (CurrentActivity) & CHECK_ABORT))
{ {
OldContext = SetContext (SpaceContext); //PauseRotate == 2 is a single-step
BatchGraphics (); if (((PSOLARSYS_STATE volatile)pSS)->PauseRotate == 2)
if (repair) pSS->PauseRotate = 1;
{
RECT r;
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, repair = RotatePlanet (x, angle, SIS_SCREEN_WIDTH >> 1,
(148 - SIS_ORG_Y) >> 1, zooming (148 - SIS_ORG_Y) >> 1, zooming
); );
UnbatchGraphics ();
SetContext (OldContext);
if (!repair && zooming) if (!repair && zooming)
{ {
zooming = FALSE; zooming = FALSE;
@@ -1307,7 +1298,6 @@ rotate_planet_task (void *data)
} }
x += i; x += i;
} }
ClearSemaphore (GraphicsSem);
SleepThreadUntil (TimeIn + (ONE_SECOND * ROTATION_TIME) / (MAP_WIDTH)); SleepThreadUntil (TimeIn + (ONE_SECOND * ROTATION_TIME) / (MAP_WIDTH));
// SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / (MAP_WIDTH-32))); // SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / (MAP_WIDTH-32)));
+11 -4
View File
@@ -29,6 +29,10 @@ void WaitForNoInput (SIZE Duration);
//End Added by Chris //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_INDEX 105
#define FLASH_WIDTH 9 #define FLASH_WIDTH 9
#define FLASH_HEIGHT 9 #define FLASH_HEIGHT 9
@@ -761,8 +765,10 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
return (PickPlanetSide (InputState, pMS)); 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) if ((min_scan = pMS->CurState) != AUTO_SCAN)
max_scan = min_scan; max_scan = min_scan;
else else
@@ -857,7 +863,7 @@ pSolarSysState->MenuState.Initialized += 4;
DrawScannedStuff (i, min_scan); DrawScannedStuff (i, min_scan);
UnbatchGraphics (); UnbatchGraphics ();
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
// FlushGraphics ();
SleepThread (2); SleepThread (2);
} }
} }
@@ -884,7 +890,8 @@ pSolarSysState->MenuState.Initialized += 4;
else else
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
pSolarSysState->MenuState.Initialized -= 4; pSolarSysState->MenuState.Initialized -= 4;
pSolarSysState->PauseRotate = 0;
WaitForNoInput (ONE_SECOND / 2); WaitForNoInput (ONE_SECOND / 2);
} }
else if (!(pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED) else if (!(pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)