Better instant-move (for debugging).
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2203 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.5:
|
Changes towards version 0.5:
|
||||||
|
- Better instant-move (for debugging) - SvdB
|
||||||
- Fixed version checking in unix build scripts. SDL 1.2.10 is
|
- Fixed version checking in unix build scripts. SDL 1.2.10 is
|
||||||
now recognised as newer than 1.2.9. - SvdB
|
now recognised as newer than 1.2.9. - SvdB
|
||||||
- Some small improvements to the portability of the build system,
|
- Some small improvements to the portability of the build system,
|
||||||
|
|||||||
@@ -1237,9 +1237,8 @@ DoMoveCursor (PMENU_STATE pMS)
|
|||||||
{
|
{
|
||||||
GLOBAL (autopilot) = pMS->first_item;
|
GLOBAL (autopilot) = pMS->first_item;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (instantMove) {
|
if (instantMove)
|
||||||
GLOBAL_SIS (log_x) = UNIVERSE_TO_LOGX(pMS->first_item.x);
|
{
|
||||||
GLOBAL_SIS (log_y) = UNIVERSE_TO_LOGY(pMS->first_item.y);
|
|
||||||
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3), 0,
|
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3), 0,
|
||||||
NotPositional (), NULL, GAME_SOUND_PRIORITY);
|
NotPositional (), NULL, GAME_SOUND_PRIORITY);
|
||||||
if (pMS->flash_task)
|
if (pMS->flash_task)
|
||||||
@@ -1247,6 +1246,21 @@ DoMoveCursor (PMENU_STATE pMS)
|
|||||||
ConcludeTask (pMS->flash_task);
|
ConcludeTask (pMS->flash_task);
|
||||||
pMS->flash_task = 0;
|
pMS->flash_task = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
|
||||||
|
{
|
||||||
|
// Move to the new location immediately.
|
||||||
|
doInstantMove ();
|
||||||
|
}
|
||||||
|
else if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY)
|
||||||
|
{
|
||||||
|
// We're in a solar system; exit it.
|
||||||
|
GLOBAL (CurrentActivity) |= END_INTERPLANETARY;
|
||||||
|
|
||||||
|
// Set a hook to move to the new location:
|
||||||
|
debugHook = doInstantMove;
|
||||||
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -325,6 +325,70 @@ equipShip (void)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Not needed anymore, but could be useful in the future.
|
||||||
|
|
||||||
|
// Find the HELEMENT belonging to the Flagship.
|
||||||
|
static HELEMENT
|
||||||
|
findFlagshipElement (void)
|
||||||
|
{
|
||||||
|
HELEMENT hElement, hNextElement;
|
||||||
|
ELEMENTPTR ElementPtr;
|
||||||
|
|
||||||
|
// Find the ship element.
|
||||||
|
for (hElement = GetTailElement (); hElement != 0;
|
||||||
|
hElement = hNextElement)
|
||||||
|
{
|
||||||
|
LockElement (hElement, &ElementPtr);
|
||||||
|
|
||||||
|
if ((ElementPtr->state_flags & PLAYER_SHIP) != 0)
|
||||||
|
{
|
||||||
|
UnlockElement (hElement);
|
||||||
|
return hElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
hNextElement = GetPredElement (ElementPtr);
|
||||||
|
UnlockElement (hElement);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Move the Flagship to the destination of the autopilot.
|
||||||
|
// Should only be called from HyperSpace/QuasiSpace.
|
||||||
|
// It can be called from debugHook directly after entering HS/QS though.
|
||||||
|
void
|
||||||
|
doInstantMove (void)
|
||||||
|
{
|
||||||
|
// Move to the new location:
|
||||||
|
GLOBAL_SIS (log_x) = UNIVERSE_TO_LOGX((GLOBAL (autopilot)).x);
|
||||||
|
GLOBAL_SIS (log_y) = UNIVERSE_TO_LOGY((GLOBAL (autopilot)).y);
|
||||||
|
|
||||||
|
// Check for a solar systems at the destination.
|
||||||
|
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
|
||||||
|
{
|
||||||
|
// If there's a solar system at the destination, enter it.
|
||||||
|
CurStarDescPtr = FindStar (0, &(GLOBAL (autopilot)), 0, 0);
|
||||||
|
if (CurStarDescPtr)
|
||||||
|
{
|
||||||
|
// Leave HyperSpace/QuasiSpace if we're there:
|
||||||
|
SET_GAME_STATE (USED_BROADCASTER, 0);
|
||||||
|
GLOBAL (CurrentActivity) &= ~IN_BATTLE;
|
||||||
|
|
||||||
|
// Enter IP:
|
||||||
|
GLOBAL (ShipStamp.frame) = 0;
|
||||||
|
// This causes the ship position in IP to be reset.
|
||||||
|
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn off the autopilot:
|
||||||
|
(GLOBAL (autopilot)).x = ~0;
|
||||||
|
(GLOBAL (autopilot)).y = ~0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void
|
void
|
||||||
showSpheres (void)
|
showSpheres (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ void showSpheres (void);
|
|||||||
// Make the ships of all races available for building at the shipyard.
|
// Make the ships of all races available for building at the shipyard.
|
||||||
void activateAllShips (void);
|
void activateAllShips (void);
|
||||||
|
|
||||||
|
// Move the Flagship to the destination of the autopilot.
|
||||||
|
// Should only be called from HS/QS.
|
||||||
|
// It can be called from debugHook directly after entering HS/QS though.
|
||||||
|
void doInstantMove (void);
|
||||||
|
|
||||||
|
|
||||||
// Call a function for all stars.
|
// Call a function for all stars.
|
||||||
void forAllStars (void (*callback) (STAR_DESC *, void *), void *arg);
|
void forAllStars (void (*callback) (STAR_DESC *, void *), void *arg);
|
||||||
// Call a function for all planets in a star system.
|
// Call a function for all planets in a star system.
|
||||||
|
|||||||
Reference in New Issue
Block a user