3D planet now zooms in from any corner, from PhracturedBlue

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@396 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
gewlitys
2002-12-10 19:09:25 +00:00
parent 685c94bd99
commit 3a494a7be3
+6 -3
View File
@@ -57,6 +57,7 @@ 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;
static UBYTE zoom_from = 0;
RECT r, *rp = NULL; RECT r, *rp = NULL;
CONTEXT OldContext; CONTEXT OldContext;
@@ -77,7 +78,8 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
r.extent.width = SIS_SCREEN_WIDTH; r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT - MAP_HEIGHT; r.extent.height = SIS_SCREEN_HEIGHT - MAP_HEIGHT;
rp = &r; rp = &r;
if (scale_amt == PLANET_INIT_ZOOM_SIZE)
zoom_from |= Random () & 0x03;
// 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++)
{ {
@@ -104,12 +106,13 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
//Translate the planet so it comes from the bottom right corner //Translate the planet so it comes from the bottom right corner
if (scale_amt > MAP_HEIGHT) if (scale_amt > MAP_HEIGHT)
scale_amt=MAP_HEIGHT; scale_amt=MAP_HEIGHT;
dx += dx * (MAP_HEIGHT - scale_amt) / MAP_HEIGHT; dx += ((zoom_from & 0x01) ? 1 : -1) * dx * (MAP_HEIGHT - scale_amt) / MAP_HEIGHT;
dy += dy * (MAP_HEIGHT - scale_amt) / MAP_HEIGHT; dy += ((zoom_from & 0x02) ? 1 : -1) * dy * (MAP_HEIGHT - scale_amt) / MAP_HEIGHT;
if (scale_amt == MAP_HEIGHT) if (scale_amt == MAP_HEIGHT)
{ {
scale_amt = PLANET_INIT_ZOOM_SIZE; scale_amt = PLANET_INIT_ZOOM_SIZE;
zoom = 0; zoom = 0;
zoom_from = 0;
} }
} }
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);