Hangar power lines animation task retired; some cleanups
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3295 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -347,7 +347,8 @@ DoInstallModule (MENU_STATE *pMS)
|
|||||||
DisplayLanders (pMS);
|
DisplayLanders (pMS);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawShipPiece (pMS, new_slot_piece, pMS->delta_item, FALSE);
|
DrawShipPiece (pMS->ModuleFrame, new_slot_piece,
|
||||||
|
pMS->delta_item, FALSE);
|
||||||
|
|
||||||
if (new_slot_piece > TURNING_JETS
|
if (new_slot_piece > TURNING_JETS
|
||||||
&& old_slot_piece > TURNING_JETS)
|
&& old_slot_piece > TURNING_JETS)
|
||||||
@@ -651,7 +652,8 @@ DoOutfit (MENU_STATE *pMS)
|
|||||||
|
|
||||||
which_piece = GLOBAL_SIS (DriveSlots[num_frames]);
|
which_piece = GLOBAL_SIS (DriveSlots[num_frames]);
|
||||||
if (which_piece < EMPTY_SLOT)
|
if (which_piece < EMPTY_SLOT)
|
||||||
DrawShipPiece (pMS, which_piece, num_frames, FALSE);
|
DrawShipPiece (pMS->ModuleFrame, which_piece,
|
||||||
|
num_frames, FALSE);
|
||||||
}
|
}
|
||||||
for (num_frames = 0; num_frames < NUM_JET_SLOTS; ++num_frames)
|
for (num_frames = 0; num_frames < NUM_JET_SLOTS; ++num_frames)
|
||||||
{
|
{
|
||||||
@@ -659,7 +661,8 @@ DoOutfit (MENU_STATE *pMS)
|
|||||||
|
|
||||||
which_piece = GLOBAL_SIS (JetSlots[num_frames]);
|
which_piece = GLOBAL_SIS (JetSlots[num_frames]);
|
||||||
if (which_piece < EMPTY_SLOT)
|
if (which_piece < EMPTY_SLOT)
|
||||||
DrawShipPiece (pMS, which_piece, num_frames, FALSE);
|
DrawShipPiece (pMS->ModuleFrame, which_piece,
|
||||||
|
num_frames, FALSE);
|
||||||
}
|
}
|
||||||
for (num_frames = 0; num_frames < NUM_MODULE_SLOTS; ++num_frames)
|
for (num_frames = 0; num_frames < NUM_MODULE_SLOTS; ++num_frames)
|
||||||
{
|
{
|
||||||
@@ -667,7 +670,8 @@ DoOutfit (MENU_STATE *pMS)
|
|||||||
|
|
||||||
which_piece = GLOBAL_SIS (ModuleSlots[num_frames]);
|
which_piece = GLOBAL_SIS (ModuleSlots[num_frames]);
|
||||||
if (which_piece < EMPTY_SLOT)
|
if (which_piece < EMPTY_SLOT)
|
||||||
DrawShipPiece (pMS, which_piece, num_frames, FALSE);
|
DrawShipPiece (pMS->ModuleFrame, which_piece,
|
||||||
|
num_frames, FALSE);
|
||||||
}
|
}
|
||||||
RedistributeFuel ();
|
RedistributeFuel ();
|
||||||
DisplayLanders (pMS);
|
DisplayLanders (pMS);
|
||||||
|
|||||||
+75
-137
@@ -37,8 +37,6 @@
|
|||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/inplib.h"
|
#include "libs/inplib.h"
|
||||||
|
|
||||||
static void BeginHangarAnim (MENU_STATE *pMS);
|
|
||||||
static void EndHangarAnim (MENU_STATE *pMS);
|
|
||||||
|
|
||||||
#ifdef USE_3DO_HANGAR
|
#ifdef USE_3DO_HANGAR
|
||||||
// 3DO 4x3 hangar layout
|
// 3DO 4x3 hangar layout
|
||||||
@@ -61,8 +59,6 @@ static const COORD hangar_x_coords[HANGAR_SHIPS_ROW] =
|
|||||||
{
|
{
|
||||||
0, 38, 76, 131, 169, 207
|
0, 38, 76, 131, 169, 207
|
||||||
};
|
};
|
||||||
|
|
||||||
# define WANT_HANGAR_ANIMATION
|
|
||||||
#endif // USE_3DO_HANGAR
|
#endif // USE_3DO_HANGAR
|
||||||
|
|
||||||
#define HANGAR_SHIPS 12
|
#define HANGAR_SHIPS 12
|
||||||
@@ -76,50 +72,31 @@ enum
|
|||||||
SHIPYARD_EXIT
|
SHIPYARD_EXIT
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static void
|
||||||
hangar_anim_func (void *data)
|
animatePowerLines (MENU_STATE *pMS)
|
||||||
{
|
{
|
||||||
DWORD TimeIn;
|
static STAMP s;
|
||||||
STAMP s;
|
static COLORMAP ColorMap;
|
||||||
Task task = (Task) data;
|
static TimeCount NextTime = 0;
|
||||||
COLORMAP ColorMap;
|
TimeCount Now = GetTimeCounter ();
|
||||||
RECT ClipRect;
|
|
||||||
|
|
||||||
if (!pMenuState->CurString)
|
if (pMS)
|
||||||
{
|
{ // Init animation
|
||||||
FinishTask (task);
|
s.origin.x = 0;
|
||||||
return -1;
|
s.origin.y = 0;
|
||||||
|
s.frame = SetAbsFrameIndex (pMS->ModuleFrame, 24);
|
||||||
|
ColorMap = SetAbsColorMapIndex (pMS->CurString, 0);
|
||||||
}
|
}
|
||||||
s.origin.x = s.origin.y = 0;
|
|
||||||
s.frame = SetAbsFrameIndex (pMenuState->CurFrame, 24);
|
|
||||||
ClipRect = pMenuState->flash_rect1;
|
|
||||||
ColorMap = SetAbsColorMapIndex (pMenuState->CurString, 0);
|
|
||||||
|
|
||||||
TimeIn = GetTimeCounter ();
|
if (Now >= NextTime || pMS)
|
||||||
while (!Task_ReadState (task, TASK_EXIT))
|
|
||||||
{
|
{
|
||||||
CONTEXT OldContext;
|
NextTime = Now + (ONE_SECOND / HANGAR_ANIM_RATE);
|
||||||
RECT OldClipRect;
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (ScreenContext);
|
|
||||||
GetContextClipRect (&OldClipRect);
|
|
||||||
SetContextClipRect (&ClipRect);
|
|
||||||
|
|
||||||
ColorMap = SetRelColorMapIndex (ColorMap, 1);
|
|
||||||
SetColorMap (GetColorMapAddress (ColorMap));
|
SetColorMap (GetColorMapAddress (ColorMap));
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
|
// Advance colomap cycle
|
||||||
SetContextClipRect (&OldClipRect);
|
ColorMap = SetRelColorMapIndex (ColorMap, 1);
|
||||||
SetContext (OldContext);
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (TimeIn + ONE_SECOND / HANGAR_ANIM_RATE);
|
|
||||||
TimeIn = GetTimeCounter ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FinishTask (task);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_SHIP_SPINS
|
#ifdef WANT_SHIP_SPINS
|
||||||
@@ -329,8 +306,8 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENT *YankedStarShipPtr)
|
|||||||
|
|
||||||
pship_win_info->lfdoor_s.origin.x = -(SHIP_WIN_WIDTH >> 1);
|
pship_win_info->lfdoor_s.origin.x = -(SHIP_WIN_WIDTH >> 1);
|
||||||
pship_win_info->rtdoor_s.origin.x = (SHIP_WIN_WIDTH >> 1);
|
pship_win_info->rtdoor_s.origin.x = (SHIP_WIN_WIDTH >> 1);
|
||||||
pship_win_info->lfdoor_s.origin.y =
|
pship_win_info->lfdoor_s.origin.y = 0;
|
||||||
pship_win_info->rtdoor_s.origin.y = 0;
|
pship_win_info->rtdoor_s.origin.y = 0;
|
||||||
pship_win_info->lfdoor_s.frame =
|
pship_win_info->lfdoor_s.frame =
|
||||||
IncFrameIndex (pMenuState->ModuleFrame);
|
IncFrameIndex (pMenuState->ModuleFrame);
|
||||||
pship_win_info->rtdoor_s.frame =
|
pship_win_info->rtdoor_s.frame =
|
||||||
@@ -390,8 +367,8 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENT *YankedStarShipPtr)
|
|||||||
|
|
||||||
pship_win_info->lfdoor_s.origin.x = -1;
|
pship_win_info->lfdoor_s.origin.x = -1;
|
||||||
pship_win_info->rtdoor_s.origin.x = 1;
|
pship_win_info->rtdoor_s.origin.x = 1;
|
||||||
pship_win_info->lfdoor_s.origin.y =
|
pship_win_info->lfdoor_s.origin.y = 0;
|
||||||
pship_win_info->rtdoor_s.origin.y = 0;
|
pship_win_info->rtdoor_s.origin.y = 0;
|
||||||
pship_win_info->lfdoor_s.frame =
|
pship_win_info->lfdoor_s.frame =
|
||||||
IncFrameIndex (pMenuState->ModuleFrame);
|
IncFrameIndex (pMenuState->ModuleFrame);
|
||||||
pship_win_info->rtdoor_s.frame =
|
pship_win_info->rtdoor_s.frame =
|
||||||
@@ -419,9 +396,9 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENT *YankedStarShipPtr)
|
|||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
RECT r;
|
RECT r;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
RECT OldClipRect;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
|
||||||
AllDoorsFinished = FALSE;
|
AllDoorsFinished = FALSE;
|
||||||
r.corner.x = r.corner.y = 0;
|
r.corner.x = r.corner.y = 0;
|
||||||
r.extent.width = SHIP_WIN_WIDTH;
|
r.extent.width = SHIP_WIN_WIDTH;
|
||||||
@@ -436,22 +413,22 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENT *YankedStarShipPtr)
|
|||||||
if (AnyButtonPress (FALSE))
|
if (AnyButtonPress (FALSE))
|
||||||
{
|
{
|
||||||
if (YankedStarShipPtr != 0)
|
if (YankedStarShipPtr != 0)
|
||||||
{
|
{ // Fully close the doors
|
||||||
ship_win_info[0].lfdoor_s.origin.x = 0;
|
ship_win_info[0].lfdoor_s.origin.x = 0;
|
||||||
ship_win_info[0].rtdoor_s.origin.x = 0;
|
ship_win_info[0].rtdoor_s.origin.x = 0;
|
||||||
}
|
}
|
||||||
AllDoorsFinished = TRUE;
|
AllDoorsFinished = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
OldContext = SetContext (OffScreenContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
SetContextFGFrame (Screen);
|
GetContextClipRect (&OldClipRect);
|
||||||
SetContextBackGroundColor (BLACK_COLOR);
|
SetContextBackGroundColor (BLACK_COLOR);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
pship_win_info = &ship_win_info[0];
|
pship_win_info = &ship_win_info[0];
|
||||||
for (i = 0; i < num_ships; ++i)
|
for (i = 0; i < num_ships; ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
RECT ClipRect;
|
RECT ClipRect;
|
||||||
|
|
||||||
@@ -471,12 +448,12 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENT *YankedStarShipPtr)
|
|||||||
DrawStamp (&pship_win_info->lfdoor_s);
|
DrawStamp (&pship_win_info->lfdoor_s);
|
||||||
DrawStamp (&pship_win_info->rtdoor_s);
|
DrawStamp (&pship_win_info->rtdoor_s);
|
||||||
if (YankedStarShipPtr)
|
if (YankedStarShipPtr)
|
||||||
{
|
{ // Close the doors
|
||||||
++pship_win_info->lfdoor_s.origin.x;
|
++pship_win_info->lfdoor_s.origin.x;
|
||||||
--pship_win_info->rtdoor_s.origin.x;
|
--pship_win_info->rtdoor_s.origin.x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // Open the doors
|
||||||
--pship_win_info->lfdoor_s.origin.x;
|
--pship_win_info->lfdoor_s.origin.x;
|
||||||
++pship_win_info->rtdoor_s.origin.x;
|
++pship_win_info->rtdoor_s.origin.x;
|
||||||
}
|
}
|
||||||
@@ -485,8 +462,11 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENT *YankedStarShipPtr)
|
|||||||
++pship_win_info;
|
++pship_win_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetContextClipRect (&OldClipRect);
|
||||||
|
#ifndef USE_3DO_HANGAR
|
||||||
|
animatePowerLines (NULL);
|
||||||
|
#endif
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
SetContextClipRect (NULL);
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
@@ -553,9 +533,6 @@ static BOOLEAN
|
|||||||
DoModifyShips (MENU_STATE *pMS)
|
DoModifyShips (MENU_STATE *pMS)
|
||||||
{
|
{
|
||||||
#define MODIFY_CREW_FLAG (1 << 8)
|
#define MODIFY_CREW_FLAG (1 << 8)
|
||||||
RECT r;
|
|
||||||
HSHIPFRAG hStarShip, hNextShip;
|
|
||||||
SHIP_FRAGMENT *StarShipPtr;
|
|
||||||
BOOLEAN select, cancel;
|
BOOLEAN select, cancel;
|
||||||
#ifdef WANT_SHIP_SPINS
|
#ifdef WANT_SHIP_SPINS
|
||||||
BOOLEAN special;
|
BOOLEAN special;
|
||||||
@@ -638,6 +615,10 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
|| NewState != pMS->CurState
|
|| NewState != pMS->CurState
|
||||||
|| ((pMS->delta_item & MODIFY_CREW_FLAG) && (dx || dy)))
|
|| ((pMS->delta_item & MODIFY_CREW_FLAG) && (dx || dy)))
|
||||||
{
|
{
|
||||||
|
HSHIPFRAG hStarShip, hNextShip;
|
||||||
|
SHIP_FRAGMENT *StarShipPtr;
|
||||||
|
RECT r;
|
||||||
|
|
||||||
for (hStarShip = GetHeadLink (&GLOBAL (built_ship_q));
|
for (hStarShip = GetHeadLink (&GLOBAL (built_ship_q));
|
||||||
hStarShip; hStarShip = hNextShip)
|
hStarShip; hStarShip = hNextShip)
|
||||||
{
|
{
|
||||||
@@ -682,7 +663,6 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
{
|
{
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
RECT OldClipRect;
|
RECT OldClipRect;
|
||||||
RECT flash_r;
|
|
||||||
|
|
||||||
if (!hSpinShip)
|
if (!hSpinShip)
|
||||||
{ /* Get fleet info from selected escort */
|
{ /* Get fleet info from selected escort */
|
||||||
@@ -694,10 +674,6 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
// Do not call EndHangarAnim() with GraphicsLock held!
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
EndHangarAnim (pMS);
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
OldContext = SetContext (ScreenContext);
|
OldContext = SetContext (ScreenContext);
|
||||||
GetContextClipRect (&OldClipRect);
|
GetContextClipRect (&OldClipRect);
|
||||||
@@ -707,19 +683,10 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
SetContextClipRect (&OldClipRect);
|
SetContextClipRect (&OldClipRect);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
|
|
||||||
BeginHangarAnim (pMS);
|
|
||||||
SetContext (SpaceContext);
|
|
||||||
|
|
||||||
if (hStarShip)
|
if (hStarShip)
|
||||||
goto ChangeFlashRect;
|
goto ChangeFlashRect;
|
||||||
|
|
||||||
GetContextClipRect (&flash_r);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
GetContextClipRect (&flash_r);
|
|
||||||
flash_r.corner.x = RADAR_X - flash_r.corner.x;
|
|
||||||
flash_r.corner.y = RADAR_Y - flash_r.corner.y;
|
|
||||||
flash_r.extent.width = RADAR_WIDTH;
|
|
||||||
flash_r.extent.height = RADAR_HEIGHT;
|
|
||||||
SetFlashRect (&flash_r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -763,8 +730,7 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
&& CloneShipFragment (Index,
|
&& CloneShipFragment (Index,
|
||||||
&GLOBAL (built_ship_q), 1))
|
&GLOBAL (built_ship_q), 1))
|
||||||
{
|
{
|
||||||
ShowCombatShip ((COUNT)pMS->CurState,
|
ShowCombatShip (pMS->CurState, NULL);
|
||||||
(SHIP_FRAGMENT*)0);
|
|
||||||
//Reset flash rectangle
|
//Reset flash rectangle
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
@@ -829,8 +795,7 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
{
|
{
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
ShowCombatShip ((COUNT)pMS->CurState,
|
ShowCombatShip (pMS->CurState, StarShipPtr);
|
||||||
StarShipPtr);
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
UnlockShipFrag (&GLOBAL (built_ship_q),
|
UnlockShipFrag (&GLOBAL (built_ship_q),
|
||||||
hStarShip);
|
hStarShip);
|
||||||
@@ -1062,6 +1027,13 @@ ChangeFlashRect:
|
|||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef USE_3DO_HANGAR
|
||||||
|
LockMutex (GraphicsLock);
|
||||||
|
SetContext (SpaceContext);
|
||||||
|
animatePowerLines (NULL);
|
||||||
|
UnlockMutex (GraphicsLock);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SleepThread (ONE_SECOND / 30);
|
SleepThread (ONE_SECOND / 30);
|
||||||
@@ -1074,30 +1046,25 @@ DrawBluePrint (MENU_STATE *pMS)
|
|||||||
{
|
{
|
||||||
COUNT num_frames;
|
COUNT num_frames;
|
||||||
STAMP s;
|
STAMP s;
|
||||||
|
FRAME ModuleFrame;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
ModuleFrame = CaptureDrawable (LoadGraphic (SISBLU_MASK_ANIM));
|
||||||
SetContext (SpaceContext);
|
|
||||||
|
|
||||||
pMS->ModuleFrame = CaptureDrawable (
|
s.origin.x = 0;
|
||||||
LoadGraphic (SISBLU_MASK_ANIM)
|
s.origin.y = 0;
|
||||||
);
|
s.frame = DecFrameIndex (ModuleFrame);
|
||||||
|
|
||||||
BatchGraphics ();
|
|
||||||
|
|
||||||
s.origin.x = s.origin.y = 0;
|
|
||||||
s.frame = DecFrameIndex (pMS->ModuleFrame);
|
|
||||||
SetContextForeGroundColor (
|
SetContextForeGroundColor (
|
||||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x16), 0x01));
|
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x16), 0x01));
|
||||||
DrawFilledStamp (&s);
|
DrawFilledStamp (&s);
|
||||||
|
|
||||||
for (num_frames = 0; num_frames < NUM_DRIVE_SLOTS; ++num_frames)
|
for (num_frames = 0; num_frames < NUM_DRIVE_SLOTS; ++num_frames)
|
||||||
{
|
{
|
||||||
DrawShipPiece (pMS, GLOBAL_SIS (DriveSlots[num_frames]),
|
DrawShipPiece (ModuleFrame, GLOBAL_SIS (DriveSlots[num_frames]),
|
||||||
num_frames, TRUE);
|
num_frames, TRUE);
|
||||||
}
|
}
|
||||||
for (num_frames = 0; num_frames < NUM_JET_SLOTS; ++num_frames)
|
for (num_frames = 0; num_frames < NUM_JET_SLOTS; ++num_frames)
|
||||||
{
|
{
|
||||||
DrawShipPiece (pMS, GLOBAL_SIS (JetSlots[num_frames]),
|
DrawShipPiece (ModuleFrame, GLOBAL_SIS (JetSlots[num_frames]),
|
||||||
num_frames, TRUE);
|
num_frames, TRUE);
|
||||||
}
|
}
|
||||||
for (num_frames = 0; num_frames < NUM_MODULE_SLOTS; ++num_frames)
|
for (num_frames = 0; num_frames < NUM_MODULE_SLOTS; ++num_frames)
|
||||||
@@ -1107,7 +1074,7 @@ DrawBluePrint (MENU_STATE *pMS)
|
|||||||
which_piece = GLOBAL_SIS (ModuleSlots[num_frames]);
|
which_piece = GLOBAL_SIS (ModuleSlots[num_frames]);
|
||||||
|
|
||||||
if (!(pMS->CurState == SHIPYARD && which_piece == CREW_POD))
|
if (!(pMS->CurState == SHIPYARD && which_piece == CREW_POD))
|
||||||
DrawShipPiece (pMS, which_piece, num_frames, TRUE);
|
DrawShipPiece (ModuleFrame, which_piece, num_frames, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetContextForeGroundColor (
|
SetContextForeGroundColor (
|
||||||
@@ -1118,7 +1085,7 @@ DrawBluePrint (MENU_STATE *pMS)
|
|||||||
|
|
||||||
which_piece = GLOBAL_SIS (ModuleSlots[num_frames]);
|
which_piece = GLOBAL_SIS (ModuleSlots[num_frames]);
|
||||||
if (pMS->CurState == SHIPYARD && which_piece == CREW_POD)
|
if (pMS->CurState == SHIPYARD && which_piece == CREW_POD)
|
||||||
DrawShipPiece (pMS, which_piece, num_frames, TRUE);
|
DrawShipPiece (ModuleFrame, which_piece, num_frames, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1184,44 +1151,7 @@ DrawBluePrint (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnbatchGraphics ();
|
DestroyDrawable (ReleaseDrawable (ModuleFrame));
|
||||||
|
|
||||||
DestroyDrawable (ReleaseDrawable (pMS->ModuleFrame));
|
|
||||||
pMS->ModuleFrame = 0;
|
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
BeginHangarAnim (MENU_STATE *pMS)
|
|
||||||
{
|
|
||||||
#ifdef WANT_HANGAR_ANIMATION
|
|
||||||
CONTEXT OldContext;
|
|
||||||
RECT ClipRect;
|
|
||||||
|
|
||||||
OldContext = SetContext (SpaceContext);
|
|
||||||
GetContextClipRect (&ClipRect);
|
|
||||||
|
|
||||||
// start hangar power-lines animation
|
|
||||||
GetContextClipRect (&ClipRect);
|
|
||||||
pMS->flash_rect1 = ClipRect;
|
|
||||||
pMS->CurFrame = pMS->ModuleFrame;
|
|
||||||
pMS->flash_task = AssignTask (hangar_anim_func, 4096,
|
|
||||||
"hangar pal-rot animation");
|
|
||||||
|
|
||||||
SetContext (OldContext);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pre: GraphicsLock is NOT held (or risk a deadlock)
|
|
||||||
static void
|
|
||||||
EndHangarAnim (MENU_STATE *pMS)
|
|
||||||
{
|
|
||||||
if (pMS->flash_task)
|
|
||||||
{
|
|
||||||
ConcludeTask (pMS->flash_task);
|
|
||||||
pMS->flash_task = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -1243,7 +1173,8 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
STAMP s;
|
STAMP s;
|
||||||
RECT r, old_r;
|
RECT r, old_r;
|
||||||
|
|
||||||
s.frame = CaptureDrawable (LoadGraphic (SHIPYARD_PMAP_ANIM));
|
pMS->ModuleFrame = CaptureDrawable (
|
||||||
|
LoadGraphic (SHIPYARD_PMAP_ANIM));
|
||||||
|
|
||||||
pMS->CurString = CaptureColorMap (
|
pMS->CurString = CaptureColorMap (
|
||||||
LoadColorMap (HANGAR_COLOR_TAB));
|
LoadColorMap (HANGAR_COLOR_TAB));
|
||||||
@@ -1256,15 +1187,18 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
DrawSISFrame ();
|
DrawSISFrame ();
|
||||||
DrawSISMessage (GAME_STRING (STARBASE_STRING_BASE + 3));
|
DrawSISMessage (GAME_STRING (STARBASE_STRING_BASE + 3));
|
||||||
DrawSISTitle (GAME_STRING (STARBASE_STRING_BASE));
|
DrawSISTitle (GAME_STRING (STARBASE_STRING_BASE));
|
||||||
UnlockMutex (GraphicsLock);
|
SetContext (SpaceContext);
|
||||||
DrawBluePrint (pMS);
|
DrawBluePrint (pMS);
|
||||||
pMS->ModuleFrame = s.frame;
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_CREW, pMS->CurState = SHIPYARD_CREW);
|
pMS->CurState = SHIPYARD_CREW;
|
||||||
|
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
s.origin.x = s.origin.y = 0;
|
s.origin.x = 0;
|
||||||
|
s.origin.y = 0;
|
||||||
|
s.frame = SetAbsFrameIndex (pMS->ModuleFrame, 0);
|
||||||
#ifdef USE_3DO_HANGAR
|
#ifdef USE_3DO_HANGAR
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
#else // PC hangar
|
#else // PC hangar
|
||||||
@@ -1278,6 +1212,7 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
SetContextClipRect (&r);
|
SetContextClipRect (&r);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
SetContextClipRect (&old_r);
|
SetContextClipRect (&old_r);
|
||||||
|
animatePowerLines (pMS);
|
||||||
#endif // USE_3DO_HANGAR
|
#endif // USE_3DO_HANGAR
|
||||||
|
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
@@ -1291,12 +1226,12 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
r.extent.height = SCREEN_HEIGHT;
|
r.extent.height = SCREEN_HEIGHT;
|
||||||
ScreenTransition (3, &r);
|
ScreenTransition (3, &r);
|
||||||
}
|
}
|
||||||
PlayMusic (pMS->hMusic, TRUE, 1);
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
BeginHangarAnim (pMS);
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
ShowCombatShip ((COUNT)~0, (SHIP_FRAGMENT*)0);
|
PlayMusic (pMS->hMusic, TRUE, 1);
|
||||||
|
|
||||||
|
ShowCombatShip ((COUNT)~0, NULL);
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
@@ -1307,11 +1242,9 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
else if (cancel || (select && pMS->CurState == SHIPYARD_EXIT))
|
else if (cancel || (select && pMS->CurState == SHIPYARD_EXIT))
|
||||||
{
|
{
|
||||||
ExitShipyard:
|
ExitShipyard:
|
||||||
EndHangarAnim (pMS);
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
DestroyDrawable (ReleaseDrawable (pMS->ModuleFrame));
|
DestroyDrawable (ReleaseDrawable (pMS->ModuleFrame));
|
||||||
pMS->ModuleFrame = 0;
|
pMS->ModuleFrame = 0;
|
||||||
pMS->CurFrame = 0;
|
|
||||||
DestroyColorMap (ReleaseColorMap (pMS->CurString));
|
DestroyColorMap (ReleaseColorMap (pMS->CurString));
|
||||||
pMS->CurString = 0;
|
pMS->CurString = 0;
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
@@ -1327,18 +1260,23 @@ ExitShipyard:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EndHangarAnim (pMS);
|
|
||||||
if (GameOptions () == 0)
|
if (GameOptions () == 0)
|
||||||
goto ExitShipyard;
|
goto ExitShipyard;
|
||||||
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
BeginHangarAnim (pMS);
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
LockMutex (GraphicsLock);
|
||||||
|
SetContext (SpaceContext);
|
||||||
|
animatePowerLines (NULL);
|
||||||
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
DoMenuChooser (pMS, PM_CREW);
|
DoMenuChooser (pMS, PM_CREW);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ DrawBaseStateStrings (STARBASE_STATE OldState, STARBASE_STATE NewState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawShipPiece (MENU_STATE *pMS, COUNT which_piece, COUNT which_slot,
|
DrawShipPiece (FRAME ModuleFrame, COUNT which_piece, COUNT which_slot,
|
||||||
BOOLEAN DrawBluePrint)
|
BOOLEAN DrawBluePrint)
|
||||||
{
|
{
|
||||||
COLOR OldColor = 0; // Initialisation is to keep the compiler silent.
|
COLOR OldColor = 0; // Initialisation is to keep the compiler silent.
|
||||||
@@ -138,7 +138,7 @@ DrawShipPiece (MENU_STATE *pMS, COUNT which_piece, COUNT which_slot,
|
|||||||
Side.origin.x += which_slot * SHIP_PIECE_OFFSET;
|
Side.origin.x += which_slot * SHIP_PIECE_OFFSET;
|
||||||
if (RepairSlot < 0)
|
if (RepairSlot < 0)
|
||||||
{
|
{
|
||||||
Side.frame = SetAbsFrameIndex (pMS->ModuleFrame,
|
Side.frame = SetAbsFrameIndex (ModuleFrame,
|
||||||
((NUM_MODULES - 1) + (6 - 2)) + (NUM_MODULES + 6)
|
((NUM_MODULES - 1) + (6 - 2)) + (NUM_MODULES + 6)
|
||||||
- (RepairSlot + 1));
|
- (RepairSlot + 1));
|
||||||
DrawStamp (&Side);
|
DrawStamp (&Side);
|
||||||
@@ -176,7 +176,7 @@ DrawShipPiece (MENU_STATE *pMS, COUNT which_piece, COUNT which_slot,
|
|||||||
{
|
{
|
||||||
if (RepairSlot)
|
if (RepairSlot)
|
||||||
SetContextForeGroundColor (OldColor);
|
SetContextForeGroundColor (OldColor);
|
||||||
Side.frame = SetAbsFrameIndex (pMS->ModuleFrame, which_piece - 1);
|
Side.frame = SetAbsFrameIndex (ModuleFrame, which_piece - 1);
|
||||||
DrawFilledStamp (&Side);
|
DrawFilledStamp (&Side);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -216,7 +216,7 @@ DrawShipPiece (MENU_STATE *pMS, COUNT which_piece, COUNT which_slot,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Top.frame = SetAbsFrameIndex (pMS->ModuleFrame, which_piece);
|
Top.frame = SetAbsFrameIndex (ModuleFrame, which_piece);
|
||||||
DrawStamp (&Top);
|
DrawStamp (&Top);
|
||||||
|
|
||||||
Side.frame = SetRelFrameIndex (Top.frame, (NUM_MODULES - 1) + 6);
|
Side.frame = SetRelFrameIndex (Top.frame, (NUM_MODULES - 1) + 6);
|
||||||
@@ -228,7 +228,7 @@ DrawShipPiece (MENU_STATE *pMS, COUNT which_piece, COUNT which_slot,
|
|||||||
|
|
||||||
s.origin = Top.origin;
|
s.origin = Top.origin;
|
||||||
s.origin.x -= SHIP_PIECE_OFFSET;
|
s.origin.x -= SHIP_PIECE_OFFSET;
|
||||||
s.frame = SetAbsFrameIndex (pMS->ModuleFrame, NUM_MODULES + 5);
|
s.frame = SetAbsFrameIndex (ModuleFrame, NUM_MODULES + 5);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
s.origin = Side.origin;
|
s.origin = Side.origin;
|
||||||
s.origin.x -= SHIP_PIECE_OFFSET;
|
s.origin.x -= SHIP_PIECE_OFFSET;
|
||||||
@@ -245,7 +245,7 @@ DrawShipPiece (MENU_STATE *pMS, COUNT which_piece, COUNT which_slot,
|
|||||||
&& which_slot >= NUM_MODULE_SLOTS - 3)
|
&& which_slot >= NUM_MODULE_SLOTS - 3)
|
||||||
++which_piece;
|
++which_piece;
|
||||||
|
|
||||||
Top.frame = SetAbsFrameIndex (pMS->ModuleFrame, which_piece);
|
Top.frame = SetAbsFrameIndex (ModuleFrame, which_piece);
|
||||||
DrawStamp (&Top);
|
DrawStamp (&Top);
|
||||||
|
|
||||||
Side.frame = SetRelFrameIndex (Top.frame, (NUM_MODULES - 1) + 6);
|
Side.frame = SetRelFrameIndex (Top.frame, (NUM_MODULES - 1) + 6);
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ extern void VisitStarBase (void);
|
|||||||
extern BOOLEAN DoStarBase (MENU_STATE *pMS);
|
extern BOOLEAN DoStarBase (MENU_STATE *pMS);
|
||||||
extern BOOLEAN DoOutfit (MENU_STATE *pMS);
|
extern BOOLEAN DoOutfit (MENU_STATE *pMS);
|
||||||
extern BOOLEAN DoShipyard (MENU_STATE *pMS);
|
extern BOOLEAN DoShipyard (MENU_STATE *pMS);
|
||||||
extern void DrawShipPiece (MENU_STATE *pMS, COUNT which_piece, COUNT
|
|
||||||
|
extern void DrawShipPiece (FRAME ModuleFrame, COUNT which_piece, COUNT
|
||||||
which_slot, BOOLEAN DrawBluePrint);
|
which_slot, BOOLEAN DrawBluePrint);
|
||||||
|
|
||||||
extern COUNT WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE
|
extern COUNT WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE
|
||||||
|
|||||||
Reference in New Issue
Block a user