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
+39 -19
View File
@@ -148,38 +148,58 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
{ {
UBYTE r, g, b; UBYTE r, g, b;
DWORD p; DWORD p;
COUNT framew; COUNT framew, frameh;
RECT drect; RECT srect, drect, *psrect = NULL, *pdrect = NULL;
FRAME tintFrame = pSolarSysState->TintFrame[0]; FRAME tintFrame[2];
FRAME tintLine = pSolarSysState->TintFrame[1]; 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) if (rgb != pSolarSysState->Tint_rgb)
{ {
pSolarSysState->Tint_rgb=rgb; pSolarSysState->Tint_rgb=rgb;
// Buffer the topoMap to the tintFrame; // 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; r = (rgb & (0x1f << 10)) >> 8;
g = (rgb & (0x1f << 5)) >> 3; g = (rgb & (0x1f << 5)) >> 3;
b = (rgb & 0x1f) << 2; b = (rgb & 0x1f) << 2;
#ifdef USE_ADDITIVE_SCAN_BLIT #ifdef USE_ADDITIVE_SCAN_BLIT
a = 255; a = 255;
#endif #endif
p = frame_mapRGBA (tintFrame, r, g, b, a); p = frame_mapRGBA (tintFrame[1], r, g, b, a);
fill_frame_rgb (tintLine, p, 0, 0, 0, 0); fill_frame_rgb (tintFrame[1], p, 0, 0, 0, 0);
} }
framew = GetFrameWidth (tintFrame);
drect.corner.x = 0; drect.corner.x = 0;
drect.corner.y = dy;
drect.extent.width = framew; drect.extent.width = framew;
drect.extent.height = 1; srect.corner.x = 0;
#ifdef USE_ADDITIVE_SCAN_BLIT srect.corner.y = 0;
add_sub_frame (tintLine, NULL, tintFrame, &drect, 1); srect.extent.width = framew;
#else if (dy >= 0 && dy <= frameh) {
add_sub_frame (tintLine, NULL, tintFrame, &drect, 0); drect.corner.y = dy;
#endif drect.extent.height = 1;
if (GetFrameHeight (tintFrame) == dy) pdrect = &drect;
pSolarSysState->Tint_rgb = 0; 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); DrawStamp (&s);
} }
UnbatchGraphics (); UnbatchGraphics ();
+3 -5
View File
@@ -231,12 +231,10 @@ FreePlanet (void)
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;
}
} }
if (pSolarSysState->TintFrame)
DestroyDrawable (ReleaseDrawable (pSolarSysState->TintFrame));
pSolarSysState->TintFrame = 0;
pSolarSysState->Tint_rgb = 0; pSolarSysState->Tint_rgb = 0;
if(pSolarSysState->ShieldFrame != 0) if(pSolarSysState->ShieldFrame != 0)
{ {
+1 -1
View File
@@ -169,7 +169,7 @@ typedef struct solarsys_state
BYTE *isPFADefined; BYTE *isPFADefined;
FRAME ScaleFrame[2]; FRAME ScaleFrame[2];
FRAME ShieldFrame; FRAME ShieldFrame;
FRAME TintFrame[2]; FRAME TintFrame;
UWORD Tint_rgb; UWORD Tint_rgb;
DWORD **lpTopoMap; DWORD **lpTopoMap;
UBYTE PauseRotate; UBYTE PauseRotate;
+3 -6
View File
@@ -479,7 +479,7 @@ static void CreateShieldMask ()
{ {
// Applythe shield to the topo data // Applythe shield to the topo data
UBYTE a, blit_type; UBYTE a, blit_type;
FRAME tintFrame = pSolarSysState->TintFrame[0]; FRAME tintFrame = pSolarSysState->TintFrame;
#ifdef USE_ALPHA_SHIELD #ifdef USE_ALPHA_SHIELD
a = 200; a = 200;
blit_type = 0; blit_type = 0;
@@ -1111,11 +1111,8 @@ 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[0] = CaptureDrawable ( pSolarSysState->TintFrame = CaptureDrawable (
CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)MAP_HEIGHT, 1) CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)MAP_HEIGHT, 2)
);
pSolarSysState->TintFrame[1] = CaptureDrawable (
CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)1, 1)
); );
pSolarSysState->PlanetFrameArray = CaptureDrawable ( pSolarSysState->PlanetFrameArray = CaptureDrawable (
+6 -2
View File
@@ -777,7 +777,7 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
do do
{ {
TEXT t; TEXT t;
COUNT i; SWORD i;
t.baseline.x = SIS_SCREEN_WIDTH >> 1; t.baseline.x = SIS_SCREEN_WIDTH >> 1;
t.baseline.y = SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7; t.baseline.y = SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7;
@@ -855,10 +855,12 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
ButtonState = 0; ButtonState = 0;
} }
if (ButtonState) if (ButtonState)
i = MAP_HEIGHT + NUM_FLASH_COLORS; i = -i;
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
BatchGraphics (); BatchGraphics ();
DrawPlanet (0, 0, i, rgb); DrawPlanet (0, 0, i, rgb);
if (i < 0)
i = MAP_HEIGHT + NUM_FLASH_COLORS;
if (pMS->delta_item) if (pMS->delta_item)
DrawScannedStuff (i, min_scan); DrawScannedStuff (i, min_scan);
UnbatchGraphics (); UnbatchGraphics ();
@@ -866,6 +868,8 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
// FlushGraphics (); // FlushGraphics ();
SleepThread (2); SleepThread (2);
} }
pSolarSysState->Tint_rgb = 0;
} }
} while (++min_scan <= max_scan); } while (++min_scan <= max_scan);