Give rotating planet and lander views their own CONTEXT
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3497 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -141,10 +141,9 @@ extern PRIM_LINKS DisplayLinks;
|
|||||||
|
|
||||||
#define DEATH_EXPLOSION 0
|
#define DEATH_EXPLOSION 0
|
||||||
|
|
||||||
#define SURFACE_X SIS_ORG_X
|
// TODO: redefine these in terms of CONTEXT width/height
|
||||||
#define SURFACE_Y SIS_ORG_Y
|
|
||||||
#define SURFACE_WIDTH SIS_SCREEN_WIDTH
|
#define SURFACE_WIDTH SIS_SCREEN_WIDTH
|
||||||
#define SURFACE_HEIGHT (SIS_SCREEN_HEIGHT - MAP_HEIGHT - 5)
|
#define SURFACE_HEIGHT (SIS_SCREEN_HEIGHT - MAP_HEIGHT - MAP_BORDER_HEIGHT)
|
||||||
|
|
||||||
#define REPAIR_LANDER (1 << 7)
|
#define REPAIR_LANDER (1 << 7)
|
||||||
#define REPAIR_TRANSITION (1 << 6)
|
#define REPAIR_TRANSITION (1 << 6)
|
||||||
@@ -1198,7 +1197,7 @@ ScrollPlanetSide (SIZE dx, SIZE dy, int landingOffset)
|
|||||||
curLanderLoc = new_pt;
|
curLanderLoc = new_pt;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (PlanetContext);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|
||||||
@@ -1335,7 +1334,7 @@ AnimateLaunch (FRAME farray)
|
|||||||
TimeCount NextTime;
|
TimeCount NextTime;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
r.corner.x = 0;
|
r.corner.x = 0;
|
||||||
r.corner.y = 0;
|
r.corner.y = 0;
|
||||||
@@ -1474,17 +1473,13 @@ InitPlanetSide (POINT pt)
|
|||||||
curLanderLoc = pt;
|
curLanderLoc = pt;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
|
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
r.corner.x = SURFACE_X;
|
GetContextClipRect (&r);
|
||||||
r.corner.y = SURFACE_Y;
|
|
||||||
r.extent.width = SURFACE_WIDTH;
|
|
||||||
r.extent.height = SURFACE_HEIGHT;
|
|
||||||
SetContextClipRect (&r);
|
|
||||||
|
|
||||||
SetTransitionSource (&r);
|
SetTransitionSource (&r);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -1802,20 +1797,21 @@ SetPlanetMusic (BYTE planet_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ReturnToOrbit (RECT *pRect)
|
ReturnToOrbit (void)
|
||||||
{
|
{
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
RECT r;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (SpaceContext);
|
|
||||||
SetContextClipRect (pRect);
|
|
||||||
|
|
||||||
SetTransitionSource (pRect);
|
LockMutex (GraphicsLock);
|
||||||
|
OldContext = SetContext (PlanetContext);
|
||||||
|
GetContextClipRect (&r);
|
||||||
|
|
||||||
|
SetTransitionSource (&r);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawStarBackGround ();
|
DrawStarBackGround ();
|
||||||
DrawPlanetSurfaceBorder ();
|
DrawPlanetSurfaceBorder ();
|
||||||
RedrawSurfaceScan (NULL);
|
RedrawSurfaceScan (NULL);
|
||||||
ScreenTransition (3, pRect);
|
ScreenTransition (3, &r);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
@@ -1983,13 +1979,6 @@ PlanetSide (POINT planetLoc)
|
|||||||
|
|
||||||
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
||||||
{
|
{
|
||||||
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;
|
|
||||||
if (crew_left == 0)
|
if (crew_left == 0)
|
||||||
{
|
{
|
||||||
--GLOBAL_SIS (NumLanders);
|
--GLOBAL_SIS (NumLanders);
|
||||||
@@ -1997,7 +1986,7 @@ PlanetSide (POINT planetLoc)
|
|||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
ReturnToOrbit (&r);
|
ReturnToOrbit ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2006,7 +1995,7 @@ PlanetSide (POINT planetLoc)
|
|||||||
NotPositional (), NULL, GAME_SOUND_PRIORITY + 1);
|
NotPositional (), NULL, GAME_SOUND_PRIORITY + 1);
|
||||||
|
|
||||||
LandingTakeoffSequence (&landerInputState, FALSE);
|
LandingTakeoffSequence (&landerInputState, FALSE);
|
||||||
ReturnToOrbit (&r);
|
ReturnToOrbit ();
|
||||||
AnimateLaunch (LanderFrame[6]);
|
AnimateLaunch (LanderFrame[6]);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ DrawDefaultPlanetSphere (void)
|
|||||||
{
|
{
|
||||||
CONTEXT oldContext;
|
CONTEXT oldContext;
|
||||||
|
|
||||||
oldContext = SetContext (SpaceContext);
|
oldContext = SetContext (PlanetContext);
|
||||||
DrawPlanetSphere (SIS_SCREEN_WIDTH / 2, PLANET_ORG_Y);
|
DrawPlanetSphere (SIS_SCREEN_WIDTH / 2, PLANET_ORG_Y);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ ZoomInPlanetSphere (void)
|
|||||||
* (SCAN_SCREEN_HEIGHT * 6 / 10) + 0.5);
|
* (SCAN_SCREEN_HEIGHT * 6 / 10) + 0.5);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
|
|||||||
@@ -48,6 +48,42 @@ enum PlanetMenuItems
|
|||||||
NAVIGATION,
|
NAVIGATION,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CONTEXT PlanetContext;
|
||||||
|
// Context for rotating planet view and lander surface view
|
||||||
|
|
||||||
|
static void
|
||||||
|
CreatePlanetContext (void)
|
||||||
|
{
|
||||||
|
CONTEXT oldContext;
|
||||||
|
RECT r;
|
||||||
|
|
||||||
|
assert (PlanetContext == NULL);
|
||||||
|
|
||||||
|
LockMutex (GraphicsLock);
|
||||||
|
|
||||||
|
// PlanetContext rect is relative to SpaceContext
|
||||||
|
oldContext = SetContext (SpaceContext);
|
||||||
|
GetContextClipRect (&r);
|
||||||
|
|
||||||
|
PlanetContext = CreateContext ("PlanetContext");
|
||||||
|
SetContext (PlanetContext);
|
||||||
|
SetContextFGFrame (Screen);
|
||||||
|
r.extent.height -= MAP_HEIGHT + MAP_BORDER_HEIGHT;
|
||||||
|
SetContextClipRect (&r);
|
||||||
|
|
||||||
|
SetContext (oldContext);
|
||||||
|
UnlockMutex (GraphicsLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DestroyPlanetContext (void)
|
||||||
|
{
|
||||||
|
if (PlanetContext)
|
||||||
|
{
|
||||||
|
DestroyContext (PlanetContext);
|
||||||
|
PlanetContext = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawScannedObjects (BOOLEAN Reversed)
|
DrawScannedObjects (BOOLEAN Reversed)
|
||||||
@@ -223,6 +259,8 @@ LoadPlanet (FRAME SurfDefFrame)
|
|||||||
|
|
||||||
assert (pSolarSysState->InOrbit && !pSolarSysState->TopoFrame);
|
assert (pSolarSysState->InOrbit && !pSolarSysState->TopoFrame);
|
||||||
|
|
||||||
|
CreatePlanetContext ();
|
||||||
|
|
||||||
if (WaitMode)
|
if (WaitMode)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
@@ -309,6 +347,12 @@ FreePlanet (void)
|
|||||||
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = 0;
|
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = 0;
|
||||||
FreeLanderFont (&pSolarSysState->SysInfo.PlanetInfo);
|
FreeLanderFont (&pSolarSysState->SysInfo.PlanetInfo);
|
||||||
|
|
||||||
|
// Need to make sure our own CONTEXTs are not active because
|
||||||
|
// we will destroy them now
|
||||||
|
SetContext (SpaceContext);
|
||||||
|
DestroyPlanetContext ();
|
||||||
|
DestroyScanContext ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,10 +503,6 @@ PlanetOrbitMenu (void)
|
|||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
// Need to make sure ScanContext is not active because we will destroy it
|
|
||||||
SetContext (SpaceContext);
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
DrawMenuStateStrings (PM_STARMAP, -NAVIGATION);
|
DrawMenuStateStrings (PM_STARMAP, -NAVIGATION);
|
||||||
|
|
||||||
DestroyScanContext ();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ struct solarsys_state
|
|||||||
|
|
||||||
extern SOLARSYS_STATE *pSolarSysState;
|
extern SOLARSYS_STATE *pSolarSysState;
|
||||||
extern MUSIC_REF SpaceMusic;
|
extern MUSIC_REF SpaceMusic;
|
||||||
|
extern CONTEXT PlanetContext;
|
||||||
|
|
||||||
bool playerInSolarSystem (void);
|
bool playerInSolarSystem (void);
|
||||||
bool playerInPlanetOrbit (void);
|
bool playerInPlanetOrbit (void);
|
||||||
|
|||||||
+16
-24
@@ -85,23 +85,14 @@ RepairBackRect (RECT *pRect)
|
|||||||
static void
|
static void
|
||||||
EraseCoarseScan (void)
|
EraseCoarseScan (void)
|
||||||
{
|
{
|
||||||
RECT oldClipRect;
|
|
||||||
RECT clipRect;
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
// TODO: Give coarse scan an own context
|
|
||||||
GetContextClipRect (&oldClipRect);
|
|
||||||
clipRect = oldClipRect;
|
|
||||||
clipRect.extent.height = SCAN_SCREEN_HEIGHT;
|
|
||||||
SetContextClipRect (&clipRect);
|
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawStarBackGround ();
|
DrawStarBackGround ();
|
||||||
DrawDefaultPlanetSphere ();
|
DrawDefaultPlanetSphere ();
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
SetContextClipRect (&oldClipRect);
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +161,7 @@ PrintCoarseScanPC (void)
|
|||||||
GetPlanetTitle (buf, sizeof (buf));
|
GetPlanetTitle (buf, sizeof (buf));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
t.align = ALIGN_CENTER;
|
t.align = ALIGN_CENTER;
|
||||||
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
|
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
|
||||||
@@ -355,7 +346,7 @@ PrintCoarseScan3DO (void)
|
|||||||
GetPlanetTitle (buf, sizeof (buf));
|
GetPlanetTitle (buf, sizeof (buf));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
t.align = ALIGN_CENTER;
|
t.align = ALIGN_CENTER;
|
||||||
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
|
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
|
||||||
@@ -1019,11 +1010,13 @@ ScanPlanet (COUNT scanType)
|
|||||||
t.pStr = GAME_STRING (SCAN_STRING_BASE + scan);
|
t.pStr = GAME_STRING (SCAN_STRING_BASE + scan);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
r.corner.x = 0;
|
r.corner.x = 0;
|
||||||
r.corner.y = t.baseline.y - 10;
|
r.corner.y = t.baseline.y - 10;
|
||||||
r.extent.width = SIS_SCREEN_WIDTH;
|
r.extent.width = SIS_SCREEN_WIDTH;
|
||||||
r.extent.height = t.baseline.y - r.corner.y + 1;
|
r.extent.height = t.baseline.y - r.corner.y + 1;
|
||||||
|
// XXX: I do not know why we are repairing it here, as there
|
||||||
|
// should not be anything drawn over the stars at the moment
|
||||||
RepairBackRect (&r);
|
RepairBackRect (&r);
|
||||||
|
|
||||||
SetContextFont (MicroFont);
|
SetContextFont (MicroFont);
|
||||||
@@ -1073,12 +1066,7 @@ ScanPlanet (COUNT scanType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (PlanetContext);
|
||||||
r.corner.x = 0;
|
|
||||||
r.corner.y = (SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7) - 10;
|
|
||||||
r.extent.width = SIS_SCREEN_WIDTH;
|
|
||||||
r.extent.height = (SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7)
|
|
||||||
- r.corner.y + 1;
|
|
||||||
RepairBackRect (&r);
|
RepairBackRect (&r);
|
||||||
|
|
||||||
SetContext (ScanContext);
|
SetContext (ScanContext);
|
||||||
@@ -1177,12 +1165,15 @@ CreateScanContext (void)
|
|||||||
CONTEXT context;
|
CONTEXT context;
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
|
// ScanContext rect is relative to SpaceContext
|
||||||
|
oldContext = SetContext (SpaceContext);
|
||||||
|
GetContextClipRect (&r);
|
||||||
|
|
||||||
context = CreateContext ("ScanContext");
|
context = CreateContext ("ScanContext");
|
||||||
oldContext = SetContext (context);
|
SetContext (context);
|
||||||
|
|
||||||
SetContextFGFrame (Screen);
|
SetContextFGFrame (Screen);
|
||||||
r.corner.x = (SIS_ORG_X + SIS_SCREEN_WIDTH) - MAP_WIDTH;
|
r.corner.x += r.extent.width - MAP_WIDTH;
|
||||||
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT;
|
r.corner.y += r.extent.height - MAP_HEIGHT;
|
||||||
r.extent.width = MAP_WIDTH;
|
r.extent.width = MAP_WIDTH;
|
||||||
r.extent.height = MAP_HEIGHT;
|
r.extent.height = MAP_HEIGHT;
|
||||||
SetContextClipRect (&r);
|
SetContextClipRect (&r);
|
||||||
@@ -1227,7 +1218,9 @@ ScanSystem (void)
|
|||||||
|
|
||||||
memset (&MenuState, 0, sizeof MenuState);
|
memset (&MenuState, 0, sizeof MenuState);
|
||||||
|
|
||||||
|
LockMutex (GraphicsLock);
|
||||||
GetScanContext (NULL);
|
GetScanContext (NULL);
|
||||||
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
if (optWhichMenu == OPT_3DO &&
|
if (optWhichMenu == OPT_3DO &&
|
||||||
((pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
|
((pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
|
||||||
@@ -1273,7 +1266,6 @@ ScanSystem (void)
|
|||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
SetContext (ScanContext);
|
SetContext (ScanContext);
|
||||||
DrawPlanet (0, BLACK_COLOR);
|
DrawPlanet (0, BLACK_COLOR);
|
||||||
SetContext (SpaceContext);
|
|
||||||
EraseCoarseScan ();
|
EraseCoarseScan ();
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|||||||
Reference in New Issue
Block a user