only update portion of screen that has changed on entering orbit.

This is about the smoothest I know how to make it.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@868 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
ghaushe
2003-03-08 01:36:35 +00:00
parent c884eb7528
commit b638ff774e
3 changed files with 18 additions and 15 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.3: Changes towards version 0.3:
- Decelerate when entering orbit to give a smoother effect -PhracturedBlue
- fix subtitle text overlap issues (bug 232) - fix subtitle text overlap issues (bug 232)
- 'Esc' now leaves planet surface (bug233) -PhracturedBlue - 'Esc' now leaves planet surface (bug233) -PhracturedBlue
- Fix race on exiting starbase (bug 230) -PracturedBlue - Fix race on exiting starbase (bug 230) -PracturedBlue
+12 -11
View File
@@ -54,7 +54,6 @@ PlanetZoomOrbit (int x, COUNT zoom_amt, UBYTE zoom_from)
{ {
FRAME pFrame[2]; FRAME pFrame[2];
COUNT i, num_frames; COUNT i, num_frames;
COUNT scale_amt;
num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2; num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2;
pFrame[0] = SetAbsFrameIndex (pSolarSysState->PlanetFrameArray, (COUNT)(x + 1)); pFrame[0] = SetAbsFrameIndex (pSolarSysState->PlanetFrameArray, (COUNT)(x + 1));
@@ -84,13 +83,13 @@ PlanetZoomOrbit (int x, COUNT zoom_amt, UBYTE zoom_from)
} }
} }
int PRECT
RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from) RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from, PRECT zoomr)
{ {
STAMP s; STAMP s;
FRAME pFrame[2]; FRAME pFrame[2];
COUNT i, num_frames; COUNT i, num_frames;
RECT r, *rp = NULL; RECT *rp = NULL;
CONTEXT OldContext; CONTEXT OldContext;
num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2; num_frames = (pSolarSysState->ShieldFrame == 0) ? 1 : 2;
@@ -99,11 +98,8 @@ RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from)
pFrame[1] = pSolarSysState->ShieldFrame; pFrame[1] = pSolarSysState->ShieldFrame;
if (scale_amt) if (scale_amt)
{ {
r.corner.x = 0; if(zoomr->extent.width)
r.corner.y = 0; rp = zoomr;
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 // we're zooming in, take care of scaling the frames
for (i=0; i < num_frames; i++) for (i=0; i < num_frames; i++)
pFrame[i] = pSolarSysState->ScaleFrame[i]; pFrame[i] = pSolarSysState->ScaleFrame[i];
@@ -140,8 +136,13 @@ RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from)
} }
//ClearSemaphore (GraphicsSem); //ClearSemaphore (GraphicsSem);
if (scale_amt && scale_amt != MAP_HEIGHT) if (scale_amt && scale_amt != MAP_HEIGHT)
return 1; {
return 0; GetFrameRect (pFrame[num_frames - 1], zoomr);
zoomr->corner.x += dx;
zoomr->corner.y += dy;
return zoomr;
}
return NULL;
} }
void void
+5 -4
View File
@@ -40,7 +40,7 @@ void SetPlanetTilt (int da);
void RepairBackRect (PRECT pRect); void RepairBackRect (PRECT pRect);
int RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from); PRECT RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from, PRECT r);
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);
@@ -1368,7 +1368,8 @@ rotate_planet_task (void *data)
COORD init_x; COORD init_x;
DWORD TimeIn; DWORD TimeIn;
PSOLARSYS_STATE pSS; PSOLARSYS_STATE pSS;
BOOLEAN repair, zooming; BOOLEAN zooming;
RECT r, *repair = &r;
UBYTE zoom_from; UBYTE zoom_from;
COUNT zoom_arr[50]; COUNT zoom_arr[50];
COUNT zoom_amt, frame_num = 0, zoom_frames; COUNT zoom_amt, frame_num = 0, zoom_frames;
@@ -1376,7 +1377,7 @@ rotate_planet_task (void *data)
Task task = (Task) data; Task task = (Task) data;
repair = FALSE; r.extent.width = 0;
zooming = TRUE; zooming = TRUE;
pSS = pSolarSysState; pSS = pSolarSysState;
@@ -1425,7 +1426,7 @@ rotate_planet_task (void *data)
pSS->PauseRotate = 1; pSS->PauseRotate = 1;
repair = RotatePlanet (x, SIS_SCREEN_WIDTH >> 1, repair = RotatePlanet (x, SIS_SCREEN_WIDTH >> 1,
(148 - SIS_ORG_Y) >> 1, zoom_amt, zoom_from (148 - SIS_ORG_Y) >> 1, zoom_amt, zoom_from, repair
); );
if (!repair && zooming) if (!repair && zooming)