FRAME_DESC.HotSpot is now a POINT instead of a DWORD.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@850 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2003-03-04 01:35:50 +00:00
parent 8ddfacdc0a
commit 46989c4c68
10 changed files with 79 additions and 68 deletions
+5 -2
View File
@@ -30,8 +30,8 @@ void InsertPrim (PRIM_LINKS *pLinks, COUNT primIndex, COUNT iPI);
#define MED_STAR_COUNT 60
#define SML_STAR_COUNT 90
#define NUM_STARS (BIG_STAR_COUNT \
+ MED_STAR_COUNT \
+ SML_STAR_COUNT)
+ MED_STAR_COUNT \
+ SML_STAR_COUNT)
POINT SpaceOrg;
static POINT log_star_array[NUM_STARS];
@@ -51,14 +51,17 @@ STAR_BLOCK StarBlock[NUM_STAR_PLANES] =
{
0, BIG_STAR_COUNT,
&log_star_array[0],
NULL, NULL,
},
{
0, MED_STAR_COUNT,
&log_star_array[BIG_STAR_COUNT],
NULL, NULL,
},
{
0, SML_STAR_COUNT,
&log_star_array[BIG_STAR_COUNT + MED_STAR_COUNT],
NULL, NULL,
},
};
+3 -4
View File
@@ -207,10 +207,9 @@ typedef BYTE INTERSECT_CODE;
INTERSECT_RIGHT | \
INTERSECT_BOTTOM)
typedef DWORD HOT_SPOT;
#define MAKE_HOT_SPOT MAKE_DWORD
#define GET_HOT_X(h) ((short)LOWORD(h))
#define GET_HOT_Y(h) ((short)HIWORD(h))
typedef POINT HOT_SPOT;
extern HOT_SPOT MAKE_HOT_SPOT (COORD, COORD);
extern INTERSECT_CODE BoxIntersect (PRECT pr1, PRECT pr2, PRECT
printer);
+6 -6
View File
@@ -184,8 +184,8 @@ GetFrameRect (FRAMEPTR FramePtr, PRECT pRect)
{
if (FramePtr)
{
pRect->corner.x = -GetFrameHotX (FramePtr);
pRect->corner.y = -GetFrameHotY (FramePtr);
pRect->corner.x = -FramePtr->HotSpot.x;
pRect->corner.y = -FramePtr->HotSpot.y;
pRect->extent.width = GetFrameWidth (FramePtr);
pRect->extent.height = GetFrameHeight (FramePtr);
@@ -202,10 +202,10 @@ SetFrameHot (FRAMEPTR FramePtr, HOT_SPOT HotSpot)
{
HOT_SPOT OldHot;
OldHot = GetFrameHotSpot (FramePtr);
SetFrameHotSpot (FramePtr, HotSpot);
OldHot = FramePtr->HotSpot;
FramePtr->HotSpot = HotSpot;
return (OldHot);
return (OldHot);
}
return (MAKE_HOT_SPOT (0, 0));
@@ -216,7 +216,7 @@ GetFrameHot (FRAMEPTR FramePtr)
{
if (FramePtr)
{
return (GetFrameHotSpot (FramePtr));
return FramePtr->HotSpot;
}
return (MAKE_HOT_SPOT (0, 0));
-4
View File
@@ -81,10 +81,6 @@ typedef struct
} DRAWABLE_DESC;
typedef DRAWABLE_DESC *PDRAWABLE_DESC;
#define GetFrameHotX(f) GET_HOT_X(((FRAMEPTR)(f))->HotSpot)
#define GetFrameHotY(f) GET_HOT_Y(((FRAMEPTR)(f))->HotSpot)
#define GetFrameHotSpot(f) (((FRAMEPTR)(f))->HotSpot)
#define SetFrameHotSpot(f,h) (((FRAMEPTR)(f))->HotSpot=(h))
#define GetFrameWidth(f) LOWORD (((FRAMEPTR)(f))->Bounds)
#define GetFrameHeight(f) HIWORD (((FRAMEPTR)(f))->Bounds)
#define SetFrameBounds(f,w,h) (((FRAMEPTR)(f))->Bounds=MAKE_DWORD(w,h))
+3 -3
View File
@@ -160,7 +160,7 @@ TextRect (PTEXT lpText, register PRECT pRect, PBYTE pdelta)
{
register COORD y;
y = -GetFrameHotY (&FontPtr->CharDesc[ch]);
y = -((FRAME_DESC)FontPtr->CharDesc[ch]).HotSpot.y;
if (y < top_y)
top_y = y;
y += GetFrameHeight (&FontPtr->CharDesc[ch]);
@@ -257,9 +257,9 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
RECT r;
r.corner.x = locPrim.Object.Stamp.origin.x
- GetFrameHotX (locPrim.Object.Stamp.frame);
- ((FRAMEPTR)locPrim.Object.Stamp.frame)->HotSpot.x;
r.corner.y = locPrim.Object.Stamp.origin.y
- GetFrameHotY (locPrim.Object.Stamp.frame);
- ((FRAMEPTR)locPrim.Object.Stamp.frame)->HotSpot.y;
r.extent.width = GetFrameWidth (locPrim.Object.Stamp.frame);
r.extent.height = GetFrameHeight (locPrim.Object.Stamp.frame);
_save_stamp.origin = r.corner;
+21 -12
View File
@@ -22,6 +22,15 @@
#include "tfb_draw.h"
#include "tfb_prim.h"
HOT_SPOT
MAKE_HOT_SPOT (COORD x, COORD y)
{
HOT_SPOT hs;
hs.x = x;
hs.y = y;
return hs;
}
typedef union
{
POINT Point;
@@ -50,9 +59,9 @@ GetFrameValidRect (PRECT pValidRect, HOT_SPOT *pOldHot)
COORD hx, hy;
HOT_SPOT OldHot;
OldHot = GetFrameHotSpot (_CurFramePtr);
hx = GET_HOT_X (OldHot);
hy = GET_HOT_Y (OldHot);
OldHot = _CurFramePtr->HotSpot;
hx = OldHot.x;
hy = OldHot.y;
pValidRect->corner.x = hx;
pValidRect->corner.y = hy;
pValidRect->extent.width = GetFrameWidth (_CurFramePtr);
@@ -67,7 +76,7 @@ GetFrameValidRect (PRECT pValidRect, HOT_SPOT *pOldHot)
hy -= _pCurContext->ClipRect.corner.y;
pValidRect->corner.x += hx;
pValidRect->corner.y += hy;
SetFrameHotSpot (_CurFramePtr, MAKE_HOT_SPOT (hx, hy));
_CurFramePtr->HotSpot = MAKE_HOT_SPOT (hx, hy);
}
*pOldHot = OldHot;
@@ -199,7 +208,7 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_LINKS PrimLinks, register
UnbatchGraphics ();
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
if (BatchFlags & BATCH_SINGLE)
SetPrimLinks (lpBasePrim,
@@ -221,7 +230,7 @@ ClearDrawable (void)
ClearBackGround (&ValidRect);
UnbatchGraphics ();
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
}
}
@@ -242,7 +251,7 @@ DrawPoint (PPOINT lpPoint)
color.b = (c32k << (8 - 5)) & 0xF8;
TFB_Prim_Point (lpPoint, &color);
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
}
}
@@ -263,7 +272,7 @@ DrawRectangle (PRECT lpRect)
color.b = (c32k << (8 - 5)) & 0xF8;
TFB_Prim_Rect (lpRect, &color);
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
}
}
@@ -284,7 +293,7 @@ DrawFilledRectangle (PRECT lpRect)
color.b = (c32k << (8 - 5)) & 0xF8;
TFB_Prim_FillRect (lpRect, &color);
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
}
}
@@ -305,7 +314,7 @@ DrawLine (PLINE lpLine)
color.b = (c32k << (8 - 5)) & 0xF8;
TFB_Prim_Line (lpLine, &color);
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
}
}
@@ -318,7 +327,7 @@ DrawStamp (PSTAMP stmp)
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
{
TFB_Prim_Stamp (stmp);
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
}
}
@@ -338,6 +347,6 @@ DrawFilledStamp (PSTAMP stmp)
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
color.b = (c32k << (8 - 5)) & 0xF8;
TFB_Prim_StampFill (stmp, &color);
SetFrameHotSpot (_CurFramePtr, OldHot);
_CurFramePtr->HotSpot = OldHot;
}
}
+8 -8
View File
@@ -252,14 +252,14 @@ DrawablesIntersect (PINTERSECT_CONTROL pControl0,
FramePtr0 = (FRAMEPTR)pControl0->IntersectStamp.frame;
if (FramePtr0 == 0)
return(0);
r0.corner.x -= GetFrameHotX (FramePtr0);
r0.corner.y -= GetFrameHotY (FramePtr0);
r0.corner.x -= FramePtr0->HotSpot.x;
r0.corner.y -= FramePtr0->HotSpot.y;
FramePtr1 = (FRAMEPTR)pControl1->IntersectStamp.frame;
if (FramePtr1 == 0)
return(0);
r1.corner.x -= GetFrameHotX (FramePtr1);
r1.corner.y -= GetFrameHotY (FramePtr1);
r1.corner.x -= FramePtr1->HotSpot.x;
r1.corner.y -= FramePtr1->HotSpot.y;
dy = r1.corner.y - r0.corner.y;
time_y_0 = dy - GetFrameHeight (FramePtr0) + 1;
@@ -388,11 +388,11 @@ DrawablesIntersect (PINTERSECT_CONTROL pControl0,
(TIME_VALUE)time_y_0, (TIME_VALUE)time_y_1)))
{
FramePtr0 = (FRAMEPTR)pControl0->IntersectStamp.frame;
pControl0->EndPoint.x = r0.corner.x + GetFrameHotX (FramePtr0);
pControl0->EndPoint.y = r0.corner.y + GetFrameHotY (FramePtr0);
pControl0->EndPoint.x = r0.corner.x + FramePtr0->HotSpot.x;
pControl0->EndPoint.y = r0.corner.y + FramePtr0->HotSpot.y;
FramePtr1 = (FRAMEPTR)pControl1->IntersectStamp.frame;
pControl1->EndPoint.x = r1.corner.x + GetFrameHotX (FramePtr1);
pControl1->EndPoint.y = r1.corner.y + GetFrameHotY (FramePtr1);
pControl1->EndPoint.x = r1.corner.x + FramePtr1->HotSpot.x;
pControl1->EndPoint.y = r1.corner.y + FramePtr1->HotSpot.y;
return (intersect_time);
}
@@ -62,7 +62,7 @@ process_image (FRAMEPTR FramePtr, SDL_Surface *img[], AniData *ani, int cel_ct)
tfbimg->colormap_index = ani[cel_ct].colormap_index;
img[cel_ct] = (SDL_Surface *)tfbimg->NormalImg;
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (hx, hy));
FramePtr->HotSpot = MAKE_HOT_SPOT (hx, hy);
SetFrameBounds (FramePtr, img[cel_ct]->w, img[cel_ct]->h);
}
@@ -126,7 +126,7 @@ process_font (FRAMEPTR FramePtr, SDL_Surface *img[], int cel_ct)
FramePtr->image = TFB_DrawImage_New (img[cel_ct]);
img[cel_ct] = FramePtr->image->NormalImg;
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (hx, hy));
FramePtr->HotSpot = MAKE_HOT_SPOT (hx, hy);
SetFrameBounds (FramePtr, img[cel_ct]->w, img[cel_ct]->h);
}
@@ -237,17 +237,17 @@ void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *r
srcRect.h = rsrc->extent.height;
srp = &srcRect;
}
else if (GetFrameHotX (srcFrame) || GetFrameHotY (srcFrame))
else if (srcFrame->HotSpot.x || srcFrame->HotSpot.y)
{
if (rdst)
{
dstRect.x -= GetFrameHotX (srcFrame);
dstRect.y -= GetFrameHotY (srcFrame);
dstRect.x -= srcFrame->HotSpot.x;
dstRect.y -= srcFrame->HotSpot.y;
}
else
{
dstRect.x = -GetFrameHotX (srcFrame);
dstRect.y = -GetFrameHotY (srcFrame);
dstRect.x = -srcFrame->HotSpot.x;
dstRect.y = -srcFrame->HotSpot.y;
dstRect.w = GetFrameWidth (srcFrame);
dstRect.h = GetFrameHeight (srcFrame);
drp =&dstRect;
@@ -392,7 +392,7 @@ FRAMEPTR Build_Font_Effect (FRAMEPTR FramePtr, Uint32 from, Uint32 to, BYTE type
putpix (img, x, y, clear);
SDL_UnlockSurface (img);
SDL_UnlockSurface (OrigImg);
SetFrameHotSpot (NewFrame, GetFrameHotSpot (FramePtr));
NewFrame->HotSpot = FramePtr->HotSpot;
return (NewFrame);
}
@@ -624,7 +624,7 @@ _GetFontData (FILE *fp, DWORD length)
else if (img[0]->h > 9)
tune_amount = -3;
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (0, img[0]->h + tune_amount));
FramePtr->HotSpot = MAKE_HOT_SPOT (0, img[0]->h + tune_amount);
}
if (GetFrameHeight (FramePtr) > FontPtr->Leading)
+16 -16
View File
@@ -32,8 +32,8 @@ TFB_Prim_Point (PPOINT p, TFB_Palette *color)
{
RECT r;
r.corner.x = p->x - GetFrameHotX (_CurFramePtr);
r.corner.y = p->y - GetFrameHotY (_CurFramePtr);
r.corner.x = p->x - _CurFramePtr->HotSpot.x;
r.corner.y = p->y - _CurFramePtr->HotSpot.y;
r.extent.width = r.extent.height = 1;
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
@@ -72,8 +72,8 @@ TFB_Prim_FillRect (PRECT r, TFB_Palette *color)
RECT rect;
int gscale;
rect.corner.x = r->corner.x - GetFrameHotX (_CurFramePtr);
rect.corner.y = r->corner.y - GetFrameHotY (_CurFramePtr);
rect.corner.x = r->corner.x - _CurFramePtr->HotSpot.x;
rect.corner.y = r->corner.y - _CurFramePtr->HotSpot.y;
rect.extent.width = r->extent.width;
rect.extent.height = r->extent.height;
@@ -99,10 +99,10 @@ TFB_Prim_Line (PLINE line, TFB_Palette *color)
{
int x1, y1, x2, y2;
x1=line->first.x - GetFrameHotX (_CurFramePtr);
y1=line->first.y - GetFrameHotY (_CurFramePtr);
x2=line->second.x - GetFrameHotX (_CurFramePtr);
y2=line->second.y - GetFrameHotY (_CurFramePtr);
x1=line->first.x - _CurFramePtr->HotSpot.x;
y1=line->first.y - _CurFramePtr->HotSpot.y;
x2=line->second.x - _CurFramePtr->HotSpot.x;
y2=line->second.y - _CurFramePtr->HotSpot.y;
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
TFB_DrawScreen_Line (x1, y1, x2, y2, color->r, color->g, color->b, TFB_SCREEN_MAIN);
@@ -137,16 +137,16 @@ TFB_Prim_Stamp (PSTAMP stmp)
LockMutex (img->mutex);
x = stmp->origin.x - GetFrameHotX (_CurFramePtr) - GetFrameHotX (SrcFramePtr);
y = stmp->origin.y - GetFrameHotY (_CurFramePtr) - GetFrameHotY (SrcFramePtr);
x = stmp->origin.x - _CurFramePtr->HotSpot.x - SrcFramePtr->HotSpot.x;
y = stmp->origin.y - _CurFramePtr->HotSpot.y - SrcFramePtr->HotSpot.y;
paletted = FALSE;
if (gscale != 0 && gscale != 256)
{
TFB_DrawImage_FixScaling (img, gscale);
x += (GetFrameHotX (SrcFramePtr) *
x += (SrcFramePtr->HotSpot.x *
((1 << 8) - gscale)) >> 8;
y += (GetFrameHotY (SrcFramePtr) *
y += (SrcFramePtr->HotSpot.y *
((1 << 8) - gscale)) >> 8;
}
@@ -196,8 +196,8 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
LockMutex (img->mutex);
x = stmp->origin.x - GetFrameHotX (_CurFramePtr) - GetFrameHotX (SrcFramePtr);
y = stmp->origin.y - GetFrameHotY (_CurFramePtr) - GetFrameHotY (SrcFramePtr);
x = stmp->origin.x - _CurFramePtr->HotSpot.x - SrcFramePtr->HotSpot.x;
y = stmp->origin.y - _CurFramePtr->HotSpot.y - SrcFramePtr->HotSpot.y;
r = color->r;
g = color->g;
b = color->b;
@@ -205,9 +205,9 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
if (gscale != 0 && gscale != 256)
{
TFB_DrawImage_FixScaling (img, gscale);
x += (GetFrameHotX (SrcFramePtr) *
x += (SrcFramePtr->HotSpot.x *
((1 << 8) - gscale)) >> 8;
y += (GetFrameHotY (SrcFramePtr) *
y += (SrcFramePtr->HotSpot.y *
((1 << 8) - gscale)) >> 8;
}
+8 -4
View File
@@ -22,9 +22,11 @@
//Added by Chris
void DoShipSpin (COUNT index, MUSIC_REF hMusic);
#ifdef WANT_SHIP_SPINS
void DoShipSpin (COUNT index, MUSIC_REF hMusic); // Defined in fmv.c
#endif
void GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect);
void GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect); // Defined in sis.c
//End added by Chris
@@ -34,7 +36,7 @@ void GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect);
# define HANGAR_Y 64
# define HANGAR_DY 44
const static COORD hangar_x_coords[HANGAR_SHIPS_ROW] =
static const COORD hangar_x_coords[HANGAR_SHIPS_ROW] =
{
19, 60, 116, 157
};
@@ -45,7 +47,7 @@ const static COORD hangar_x_coords[HANGAR_SHIPS_ROW] =
# define HANGAR_Y 88
# define HANGAR_DY 84
const static COORD hangar_x_coords[HANGAR_SHIPS_ROW] =
static const COORD hangar_x_coords[HANGAR_SHIPS_ROW] =
{
0, 38, 76, 131, 169, 207
};
@@ -109,6 +111,7 @@ int hangar_anim_func (void* data)
return(0);
}
#ifdef WANT_SHIP_SPINS
static void
SpinStarShip (HSTARSHIP hStarShip)
{
@@ -136,6 +139,7 @@ SpinStarShip (HSTARSHIP hStarShip)
if (Index < NUM_MELEE_SHIPS)
DoShipSpin (Index, pMenuState->hMusic);
}
#endif
static COUNT
GetAvailableRaceCount (void)