Team building ship selection box is generated from actual ship icons; fixes #692
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1604 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.8 KiB |
+71
-57
@@ -134,6 +134,7 @@ enum
|
|||||||
|
|
||||||
FRAME PickMeleeFrame;
|
FRAME PickMeleeFrame;
|
||||||
static FRAME MeleeFrame;
|
static FRAME MeleeFrame;
|
||||||
|
static FRAME BuildPickFrame;
|
||||||
extern QUEUE master_q;
|
extern QUEUE master_q;
|
||||||
extern DWORD InTime;
|
extern DWORD InTime;
|
||||||
PMELEE_STATE volatile pMeleeState;
|
PMELEE_STATE volatile pMeleeState;
|
||||||
@@ -243,15 +244,15 @@ DrawControls (COUNT which_side, BOOLEAN HiLite)
|
|||||||
static void
|
static void
|
||||||
DrawPickFrame (PMELEE_STATE pMS)
|
DrawPickFrame (PMELEE_STATE pMS)
|
||||||
{
|
{
|
||||||
FRAME F;
|
|
||||||
RECT r, r0, r1, ship_r;
|
RECT r, r0, r1, ship_r;
|
||||||
|
STAMP s;
|
||||||
|
|
||||||
GetShipBox (&r0, 0, 0, 0),
|
GetShipBox (&r0, 0, 0, 0),
|
||||||
GetShipBox (&r1, 1, NUM_MELEE_ROWS - 1, NUM_MELEE_COLUMNS - 1),
|
GetShipBox (&r1, 1, NUM_MELEE_ROWS - 1, NUM_MELEE_COLUMNS - 1),
|
||||||
BoxUnion (&r0, &r1, &ship_r);
|
BoxUnion (&r0, &r1, &ship_r);
|
||||||
|
|
||||||
F = SetAbsFrameIndex (MeleeFrame, 27);
|
s.frame = SetAbsFrameIndex (BuildPickFrame, 0);
|
||||||
GetFrameRect (F, &r);
|
GetFrameRect (s.frame, &r);
|
||||||
r.corner.x = -(ship_r.corner.x
|
r.corner.x = -(ship_r.corner.x
|
||||||
+ ((ship_r.extent.width - r.extent.width) >> 1));
|
+ ((ship_r.extent.width - r.extent.width) >> 1));
|
||||||
if (pMS->side)
|
if (pMS->side)
|
||||||
@@ -259,8 +260,10 @@ DrawPickFrame (PMELEE_STATE pMS)
|
|||||||
else
|
else
|
||||||
r.corner.y = -(ship_r.corner.y
|
r.corner.y = -(ship_r.corner.y
|
||||||
+ (ship_r.extent.height - r.extent.height));
|
+ (ship_r.extent.height - r.extent.height));
|
||||||
SetFrameHot (F, MAKE_HOT_SPOT (r.corner.x, r.corner.y));
|
SetFrameHot (s.frame, MAKE_HOT_SPOT (r.corner.x, r.corner.y));
|
||||||
DrawMeleeIcon (27);
|
s.origin.x = s.origin.y = 0;
|
||||||
|
DrawStamp (&s);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
DrawMeleeShipStrings (pMS, (BYTE)pMS->CurIndex);
|
DrawMeleeShipStrings (pMS, (BYTE)pMS->CurIndex);
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
@@ -415,6 +418,36 @@ DrawTeamString (PMELEE_STATE pMS, COUNT HiLiteState)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DrawPickIcon (COUNT iship, BYTE DrawErase)
|
||||||
|
{
|
||||||
|
STAMP s;
|
||||||
|
HSTARSHIP hStarShip;
|
||||||
|
STARSHIPPTR StarShipPtr;
|
||||||
|
RECT r;
|
||||||
|
|
||||||
|
GetFrameRect (BuildPickFrame, &r);
|
||||||
|
|
||||||
|
hStarShip = GetStarShipFromIndex (&master_q, iship);
|
||||||
|
StarShipPtr = LockStarShip (&master_q, hStarShip);
|
||||||
|
s.origin.x = r.corner.x + 20 + (iship % NUM_PICK_COLS) * 18;
|
||||||
|
s.origin.y = r.corner.y + 5 + (iship / NUM_PICK_COLS) * 18;
|
||||||
|
s.frame = StarShipPtr->RaceDescPtr->ship_info.icons;
|
||||||
|
if (DrawErase)
|
||||||
|
{ // draw icon
|
||||||
|
DrawStamp (&s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // erase icon
|
||||||
|
COLOR OldColor;
|
||||||
|
|
||||||
|
OldColor = SetContextForeGroundColor (BLACK_COLOR);
|
||||||
|
DrawFilledStamp (&s);
|
||||||
|
SetContextForeGroundColor (OldColor);
|
||||||
|
}
|
||||||
|
UnlockStarShip (&master_q, hStarShip);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Deselect (BYTE opt)
|
Deselect (BYTE opt)
|
||||||
{
|
{
|
||||||
@@ -455,23 +488,7 @@ Deselect (BYTE opt)
|
|||||||
}
|
}
|
||||||
else if (pMeleeState->InputFunc == DoPickShip)
|
else if (pMeleeState->InputFunc == DoPickShip)
|
||||||
{
|
{
|
||||||
STAMP s;
|
DrawPickIcon (pMeleeState->CurIndex, 1);
|
||||||
HSTARSHIP hStarShip;
|
|
||||||
STARSHIPPTR StarShipPtr;
|
|
||||||
RECT r;
|
|
||||||
|
|
||||||
GetFrameRect (SetAbsFrameIndex (MeleeFrame, 27), &r);
|
|
||||||
|
|
||||||
hStarShip = GetStarShipFromIndex (&master_q,
|
|
||||||
pMeleeState->CurIndex);
|
|
||||||
StarShipPtr = LockStarShip (&master_q, hStarShip);
|
|
||||||
s.origin.x = r.corner.x + 20
|
|
||||||
+ (pMeleeState->CurIndex % NUM_PICK_COLS) * 18;
|
|
||||||
s.origin.y = r.corner.y + 5
|
|
||||||
+ (pMeleeState->CurIndex / NUM_PICK_COLS) * 18;
|
|
||||||
s.frame = StarShipPtr->RaceDescPtr->ship_info.icons;
|
|
||||||
DrawStamp (&s);
|
|
||||||
UnlockStarShip (&master_q, hStarShip);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -517,25 +534,7 @@ Select (BYTE opt)
|
|||||||
}
|
}
|
||||||
else if (pMeleeState->InputFunc == DoPickShip)
|
else if (pMeleeState->InputFunc == DoPickShip)
|
||||||
{
|
{
|
||||||
COLOR OldColor;
|
DrawPickIcon (pMeleeState->CurIndex, 0);
|
||||||
STAMP s;
|
|
||||||
HSTARSHIP hStarShip;
|
|
||||||
STARSHIPPTR StarShipPtr;
|
|
||||||
RECT r;
|
|
||||||
|
|
||||||
GetFrameRect (SetAbsFrameIndex (MeleeFrame, 27), &r);
|
|
||||||
|
|
||||||
hStarShip = GetStarShipFromIndex (&master_q, pMeleeState->CurIndex);
|
|
||||||
StarShipPtr = LockStarShip (&master_q, hStarShip);
|
|
||||||
s.origin.x = r.corner.x + 20
|
|
||||||
+ (pMeleeState->CurIndex % NUM_PICK_COLS) * 18;
|
|
||||||
s.origin.y = r.corner.y + 5
|
|
||||||
+ (pMeleeState->CurIndex / NUM_PICK_COLS) * 18;
|
|
||||||
s.frame = StarShipPtr->RaceDescPtr->ship_info.icons;
|
|
||||||
OldColor = SetContextForeGroundColor (BLACK_COLOR);
|
|
||||||
DrawFilledStamp (&s);
|
|
||||||
SetContextForeGroundColor (OldColor);
|
|
||||||
UnlockStarShip (&master_q, hStarShip);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1417,7 +1416,7 @@ DoPickShip (PMELEE_STATE pMS)
|
|||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
GetFrameRect (SetAbsFrameIndex (MeleeFrame, 27), &r);
|
GetFrameRect (BuildPickFrame, &r);
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
RepairMeleeFrame (&r);
|
RepairMeleeFrame (&r);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
@@ -1484,29 +1483,42 @@ DoPickShip (PMELEE_STATE pMS)
|
|||||||
static void
|
static void
|
||||||
LoadMeleeInfo (PMELEE_STATE pMS)
|
LoadMeleeInfo (PMELEE_STATE pMS)
|
||||||
{
|
{
|
||||||
STAMP s;
|
STAMP s;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
RECT r;
|
||||||
|
COUNT i;
|
||||||
|
|
||||||
// reverting to original behavior
|
// reverting to original behavior
|
||||||
OldContext = SetContext (OffScreenContext);
|
OldContext = SetContext (OffScreenContext);
|
||||||
|
|
||||||
if (PickMeleeFrame)
|
if (PickMeleeFrame)
|
||||||
DestroyDrawable (ReleaseDrawable (PickMeleeFrame));
|
DestroyDrawable (ReleaseDrawable (PickMeleeFrame));
|
||||||
PickMeleeFrame = CaptureDrawable (CreateDrawable (
|
PickMeleeFrame = CaptureDrawable (CreateDrawable (
|
||||||
WANT_PIXMAP, MELEE_WIDTH, MELEE_HEIGHT, 2));
|
WANT_PIXMAP, MELEE_WIDTH, MELEE_HEIGHT, 2));
|
||||||
s.origin.x = s.origin.y = 0;
|
s.origin.x = s.origin.y = 0;
|
||||||
s.frame = CaptureDrawable (LoadGraphic (MELEE_PICK_MASK_PMAP_ANIM));
|
s.frame = CaptureDrawable (LoadGraphic (MELEE_PICK_MASK_PMAP_ANIM));
|
||||||
SetContextFGFrame (PickMeleeFrame);
|
SetContextFGFrame (PickMeleeFrame);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
|
|
||||||
s.frame = IncFrameIndex (s.frame);
|
s.frame = IncFrameIndex (s.frame);
|
||||||
SetContextFGFrame (IncFrameIndex (PickMeleeFrame));
|
SetContextFGFrame (IncFrameIndex (PickMeleeFrame));
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
|
|
||||||
MeleeFrame = CaptureDrawable (LoadGraphic (MELEE_SCREEN_PMAP_ANIM));
|
MeleeFrame = CaptureDrawable (LoadGraphic (MELEE_SCREEN_PMAP_ANIM));
|
||||||
|
|
||||||
SetContext (OldContext);
|
// create team building ship selection box
|
||||||
|
s.frame = SetAbsFrameIndex (MeleeFrame, 27);
|
||||||
|
GetFrameRect (s.frame, &r);
|
||||||
|
BuildPickFrame = CaptureDrawable (CreateDrawable (
|
||||||
|
WANT_PIXMAP, r.extent.width, r.extent.height, 1));
|
||||||
|
SetContextFGFrame (BuildPickFrame);
|
||||||
|
SetFrameHot (s.frame, MAKE_HOT_SPOT (0, 0));
|
||||||
|
DrawStamp (&s);
|
||||||
|
for (i = 0; i < NUM_PICK_COLS * NUM_PICK_ROWS; ++i)
|
||||||
|
DrawPickIcon (i, 1);
|
||||||
|
|
||||||
|
SetContext (OldContext);
|
||||||
|
|
||||||
InitSpace ();
|
InitSpace ();
|
||||||
|
|
||||||
@@ -1528,6 +1540,8 @@ FreeMeleeInfo (PMELEE_STATE pMS)
|
|||||||
|
|
||||||
DestroyDrawable (ReleaseDrawable (MeleeFrame));
|
DestroyDrawable (ReleaseDrawable (MeleeFrame));
|
||||||
MeleeFrame = 0;
|
MeleeFrame = 0;
|
||||||
|
DestroyDrawable (ReleaseDrawable (BuildPickFrame));
|
||||||
|
BuildPickFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user