Replaced GetGraphicScaleIdentity() with a define; moved melee scale step
reducing to process.c instead git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@872 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -48,12 +48,13 @@ void TFB_ProcessEvents (void);
|
||||
|
||||
// 3DO Graphics Stuff
|
||||
|
||||
#define GSCALE_IDENTITY 256
|
||||
|
||||
void LoadIntoExtraScreen (PRECT r);
|
||||
void DrawFromExtraScreen (PRECT r);
|
||||
void SetGraphicGrabOther (int grab_other);
|
||||
void SetGraphicScale (int scale);
|
||||
int GetGraphicScale (void);
|
||||
int GetGraphicScaleIdentity (void);
|
||||
void SetGraphicUseOtherExtra (int other);
|
||||
void ScreenTransition (int transition, PRECT pRect);
|
||||
|
||||
|
||||
@@ -21,17 +21,12 @@
|
||||
#include "sdl_common.h"
|
||||
#include "graphics/tfb_draw.h"
|
||||
|
||||
#define GSCALE_SHIFT 2 // controls the number of scale steps
|
||||
#define GSCALE_IDENTITY (256 >> GSCALE_SHIFT) // 'identity scale'
|
||||
|
||||
static int gscale = GSCALE_IDENTITY;
|
||||
|
||||
void
|
||||
SetGraphicScale (int scale)
|
||||
{
|
||||
gscale = scale >> GSCALE_SHIFT;
|
||||
if (gscale == 0)
|
||||
gscale = GSCALE_IDENTITY;
|
||||
gscale = (scale ? scale : GSCALE_IDENTITY);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -40,12 +35,6 @@ GetGraphicScale ()
|
||||
return gscale;
|
||||
}
|
||||
|
||||
int
|
||||
GetGraphicScaleIdentity (void)
|
||||
{
|
||||
return GSCALE_IDENTITY;
|
||||
}
|
||||
|
||||
static void
|
||||
read_screen (PRECT lpRect, FRAMEPTR DstFramePtr)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *pale
|
||||
targetRect.x = x;
|
||||
targetRect.y = y;
|
||||
|
||||
if (scale != 0 && scale != GetGraphicScaleIdentity ())
|
||||
if (scale != 0 && scale != GSCALE_IDENTITY)
|
||||
{
|
||||
TFB_DrawImage_FixScaling (img, scale);
|
||||
surf = img->ScaledImg;
|
||||
@@ -99,7 +99,7 @@ TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int
|
||||
targetRect.x = x;
|
||||
targetRect.y = y;
|
||||
|
||||
if (scale != 0 && scale != GetGraphicScaleIdentity ())
|
||||
if (scale != 0 && scale != GSCALE_IDENTITY)
|
||||
{
|
||||
TFB_DrawImage_FixScaling (img, scale);
|
||||
surf = img->ScaledImg;
|
||||
@@ -273,8 +273,8 @@ void
|
||||
TFB_DrawCanvas_GetScaledExtent (TFB_Canvas src_canvas, int scale, PEXTENT size)
|
||||
{
|
||||
SDL_Surface *src = (SDL_Surface *)src_canvas;
|
||||
size->width = (int) (src->w * scale / (float)GetGraphicScaleIdentity ());
|
||||
size->height = (int) (src->h * scale / (float)GetGraphicScaleIdentity ());
|
||||
size->width = (int) (src->w * scale / (float)GSCALE_IDENTITY);
|
||||
size->height = (int) (src->h * scale / (float)GSCALE_IDENTITY);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -84,7 +84,7 @@ TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *pale
|
||||
DC.data.image.image = img;
|
||||
DC.data.image.x = x;
|
||||
DC.data.image.y = y;
|
||||
DC.data.image.scale = (scale == GetGraphicScaleIdentity ()) ? 0 : scale;
|
||||
DC.data.image.scale = (scale == GSCALE_IDENTITY) ? 0 : scale;
|
||||
|
||||
|
||||
if (palette != NULL)
|
||||
@@ -130,7 +130,7 @@ TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int
|
||||
DC.data.filledimage.image = img;
|
||||
DC.data.filledimage.x = x;
|
||||
DC.data.filledimage.y = y;
|
||||
DC.data.filledimage.scale = (scale == GetGraphicScaleIdentity ()) ? 0 : scale;
|
||||
DC.data.filledimage.scale = (scale == GSCALE_IDENTITY) ? 0 : scale;
|
||||
DC.data.filledimage.r = r;
|
||||
DC.data.filledimage.g = g;
|
||||
DC.data.filledimage.b = b;
|
||||
|
||||
@@ -46,9 +46,8 @@ void
|
||||
TFB_Prim_Rect (PRECT r, TFB_Palette *color)
|
||||
{
|
||||
RECT arm;
|
||||
int gscale, gscale_identity;
|
||||
int gscale;
|
||||
gscale = GetGraphicScale ();
|
||||
gscale_identity = GetGraphicScaleIdentity ();
|
||||
arm = *r;
|
||||
arm.extent.width = r->extent.width;
|
||||
arm.extent.height = 1;
|
||||
@@ -56,10 +55,10 @@ TFB_Prim_Rect (PRECT r, TFB_Palette *color)
|
||||
arm.extent.height = r->extent.height;
|
||||
arm.extent.width = 1;
|
||||
TFB_Prim_FillRect (&arm, color);
|
||||
arm.corner.x += ((r->extent.width * gscale) / gscale_identity) - 1;
|
||||
arm.corner.x += ((r->extent.width * gscale) / GSCALE_IDENTITY) - 1;
|
||||
TFB_Prim_FillRect (&arm, color);
|
||||
arm.corner.x = r->corner.x;
|
||||
arm.corner.y += ((r->extent.height * gscale) / gscale_identity) - 1;
|
||||
arm.corner.y += ((r->extent.height * gscale) / GSCALE_IDENTITY) - 1;
|
||||
arm.extent.width = r->extent.width;
|
||||
arm.extent.height = 1;
|
||||
TFB_Prim_FillRect (&arm, color);
|
||||
@@ -69,7 +68,7 @@ void
|
||||
TFB_Prim_FillRect (PRECT r, TFB_Palette *color)
|
||||
{
|
||||
RECT rect;
|
||||
int gscale, gscale_identity;
|
||||
int gscale;
|
||||
|
||||
rect.corner.x = r->corner.x - _CurFramePtr->HotSpot.x;
|
||||
rect.corner.y = r->corner.y - _CurFramePtr->HotSpot.y;
|
||||
@@ -77,11 +76,10 @@ TFB_Prim_FillRect (PRECT r, TFB_Palette *color)
|
||||
rect.extent.height = r->extent.height;
|
||||
|
||||
gscale = GetGraphicScale ();
|
||||
gscale_identity = GetGraphicScaleIdentity ();
|
||||
if (gscale != gscale_identity)
|
||||
if (gscale != GSCALE_IDENTITY)
|
||||
{
|
||||
rect.extent.width = (rect.extent.width * gscale) / gscale_identity;
|
||||
rect.extent.height = (rect.extent.height * gscale) / gscale_identity;
|
||||
rect.extent.width = (rect.extent.width * gscale) / GSCALE_IDENTITY;
|
||||
rect.extent.height = (rect.extent.height * gscale) / GSCALE_IDENTITY;
|
||||
rect.corner.x += (r->extent.width -
|
||||
rect.extent.width) >> 1;
|
||||
rect.corner.y += (r->extent.height -
|
||||
@@ -118,7 +116,7 @@ TFB_Prim_Stamp (PSTAMP stmp)
|
||||
TFB_Image *img;
|
||||
BOOLEAN paletted;
|
||||
TFB_Palette palette[256];
|
||||
int gscale, gscale_identity;
|
||||
int gscale;
|
||||
|
||||
SrcFramePtr = (PFRAME_DESC)stmp->frame;
|
||||
if (!SrcFramePtr)
|
||||
@@ -128,7 +126,6 @@ TFB_Prim_Stamp (PSTAMP stmp)
|
||||
}
|
||||
img = SrcFramePtr->image;
|
||||
gscale = GetGraphicScale ();
|
||||
gscale_identity = GetGraphicScaleIdentity ();
|
||||
|
||||
if (!img)
|
||||
{
|
||||
@@ -142,12 +139,12 @@ TFB_Prim_Stamp (PSTAMP stmp)
|
||||
y = stmp->origin.y - _CurFramePtr->HotSpot.y - SrcFramePtr->HotSpot.y;
|
||||
paletted = FALSE;
|
||||
|
||||
if (gscale != GetGraphicScaleIdentity ())
|
||||
if (gscale != GSCALE_IDENTITY)
|
||||
{
|
||||
x += (SrcFramePtr->HotSpot.x *
|
||||
(gscale_identity - gscale)) / gscale_identity;
|
||||
(GSCALE_IDENTITY - gscale)) / GSCALE_IDENTITY;
|
||||
y += (SrcFramePtr->HotSpot.y *
|
||||
(gscale_identity - gscale)) / gscale_identity;
|
||||
(GSCALE_IDENTITY - gscale)) / GSCALE_IDENTITY;
|
||||
}
|
||||
|
||||
if (TFB_DrawCanvas_IsPaletted(img->NormalImg) && img->colormap_index != -1)
|
||||
@@ -177,7 +174,7 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
|
||||
PFRAME_DESC SrcFramePtr;
|
||||
TFB_Image *img;
|
||||
int r, g, b;
|
||||
int gscale, gscale_identity;
|
||||
int gscale;
|
||||
|
||||
SrcFramePtr = (PFRAME_DESC)stmp->frame;
|
||||
if (!SrcFramePtr)
|
||||
@@ -187,7 +184,6 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
|
||||
}
|
||||
img = SrcFramePtr->image;
|
||||
gscale = GetGraphicScale ();
|
||||
gscale_identity = GetGraphicScaleIdentity ();
|
||||
|
||||
if (!img)
|
||||
{
|
||||
@@ -203,12 +199,12 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
|
||||
g = color->g;
|
||||
b = color->b;
|
||||
|
||||
if (gscale != gscale_identity)
|
||||
if (gscale != GSCALE_IDENTITY)
|
||||
{
|
||||
x += (SrcFramePtr->HotSpot.x *
|
||||
(gscale_identity - gscale)) / gscale_identity;
|
||||
(GSCALE_IDENTITY - gscale)) / GSCALE_IDENTITY;
|
||||
y += (SrcFramePtr->HotSpot.y *
|
||||
(gscale_identity - gscale)) / gscale_identity;
|
||||
(GSCALE_IDENTITY - gscale)) / GSCALE_IDENTITY;
|
||||
}
|
||||
|
||||
UnlockMutex (img->mutex);
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "starcon.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
#define GSCALE_SHIFT 2 // controls the number of discrete scaling steps
|
||||
|
||||
COUNT DisplayFreeList;
|
||||
PRIMITIVE DisplayArray[MAX_DISPLAY_PRIMS];
|
||||
extern POINT SpaceOrg;
|
||||
@@ -1104,7 +1106,7 @@ if (clear)
|
||||
COUNT index, scale;
|
||||
|
||||
CALC_ZOOM_STUFF (&index, &scale);
|
||||
SetGraphicScale (scale);
|
||||
SetGraphicScale ((scale >> GSCALE_SHIFT) << GSCALE_SHIFT);
|
||||
}
|
||||
DrawBatch (DisplayArray, DisplayLinks, 0);//BATCH_BUILD_PAGE);
|
||||
SetGraphicScale (0);
|
||||
|
||||
Reference in New Issue
Block a user