PhracturedBlue's scan fixes

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@404 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
gewlitys
2002-12-11 02:13:19 +00:00
parent 163641baaf
commit c7aa14badb
5 changed files with 52 additions and 33 deletions
+37 -17
View File
@@ -148,38 +148,58 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
{
UBYTE r, g, b;
DWORD p;
COUNT framew;
RECT drect;
FRAME tintFrame = pSolarSysState->TintFrame[0];
FRAME tintLine = pSolarSysState->TintFrame[1];
COUNT framew, frameh;
RECT srect, drect, *psrect = NULL, *pdrect = NULL;
FRAME tintFrame[2];
tintFrame[0] = SetAbsFrameIndex (pSolarSysState->TintFrame, (COUNT)(1));
tintFrame[1] = SetAbsFrameIndex (pSolarSysState->TintFrame, (COUNT)(2));
framew = GetFrameWidth (tintFrame[0]);
frameh = GetFrameHeight (tintFrame[0]);
if (rgb != pSolarSysState->Tint_rgb)
{
pSolarSysState->Tint_rgb=rgb;
// Buffer the topoMap to the tintFrame;
add_sub_frame (s.frame, NULL, tintFrame, NULL, 0);
add_sub_frame (s.frame, NULL, tintFrame[0], 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);
p = frame_mapRGBA (tintFrame[1], r, g, b, a);
fill_frame_rgb (tintFrame[1], p, 0, 0, 0, 0);
}
framew = GetFrameWidth (tintFrame);
drect.corner.x = 0;
drect.corner.y = dy;
drect.extent.width = framew;
srect.corner.x = 0;
srect.corner.y = 0;
srect.extent.width = framew;
if (dy >= 0 && dy <= frameh) {
drect.corner.y = dy;
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
if (GetFrameHeight (tintFrame) == dy)
pSolarSysState->Tint_rgb = 0;
pdrect = &drect;
srect.extent.height = 1;
psrect = &srect;
}
if (dy < 0) {
drect.corner.y = -dy;
drect.extent.height = frameh + dy;
pdrect = &drect;
srect.extent.height = frameh + dy;
psrect = &srect;
}
s.frame = tintFrame;
if (dy <= frameh) {
#ifdef USE_ADDITIVE_SCAN_BLIT
add_sub_frame (tintFrame[1], psrect, tintFrame[0], pdrect, 1);
#else
add_sub_frame (tintFrame[1], psrect, tintFrame[0], pdrect, 0);
#endif
}
s.frame = tintFrame[0];
DrawStamp (&s);
}
UnbatchGraphics ();
+3 -5
View File
@@ -231,12 +231,10 @@ FreePlanet (void)
DestroyDrawable (ReleaseDrawable (pSolarSysState->ScaleFrame[i]));
pSolarSysState->ScaleFrame[i]=0;
}
if (pSolarSysState->TintFrame[i])
{
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame[i]));
pSolarSysState->TintFrame[i] = 0;
}
}
if (pSolarSysState->TintFrame)
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame));
pSolarSysState->TintFrame = 0;
pSolarSysState->Tint_rgb = 0;
if(pSolarSysState->ShieldFrame != 0)
{
+1 -1
View File
@@ -169,7 +169,7 @@ typedef struct solarsys_state
BYTE *isPFADefined;
FRAME ScaleFrame[2];
FRAME ShieldFrame;
FRAME TintFrame[2];
FRAME TintFrame;
UWORD Tint_rgb;
DWORD **lpTopoMap;
UBYTE PauseRotate;
+3 -6
View File
@@ -479,7 +479,7 @@ static void CreateShieldMask ()
{
// Applythe shield to the topo data
UBYTE a, blit_type;
FRAME tintFrame = pSolarSysState->TintFrame[0];
FRAME tintFrame = pSolarSysState->TintFrame;
#ifdef USE_ALPHA_SHIELD
a = 200;
blit_type = 0;
@@ -1111,11 +1111,8 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
OldContext = SetContext (TaskContext);
pSolarSysState->isPFADefined = (BYTE *)HCalloc (sizeof(BYTE) * 255);
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->TintFrame = CaptureDrawable (
CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)MAP_HEIGHT, 2)
);
pSolarSysState->PlanetFrameArray = CaptureDrawable (
+6 -2
View File
@@ -777,7 +777,7 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
do
{
TEXT t;
COUNT i;
SWORD i;
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
t.baseline.y = SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7;
@@ -855,10 +855,12 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
ButtonState = 0;
}
if (ButtonState)
i = MAP_HEIGHT + NUM_FLASH_COLORS;
i = -i;
SetSemaphore (GraphicsSem);
BatchGraphics ();
DrawPlanet (0, 0, i, rgb);
if (i < 0)
i = MAP_HEIGHT + NUM_FLASH_COLORS;
if (pMS->delta_item)
DrawScannedStuff (i, min_scan);
UnbatchGraphics ();
@@ -866,6 +868,8 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
// FlushGraphics ();
SleepThread (2);
}
pSolarSysState->Tint_rgb = 0;
}
} while (++min_scan <= max_scan);