Use ditty-specific functions for playing and testing for (PLRPlaying() is not enough); fixes bug #1003
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3546 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.7:
|
Changes towards version 0.7:
|
||||||
|
- Game no longer locks up after quickly escaping melee (bug #1003) - Alex
|
||||||
- Reset input delay upon leaving Supermelee (bug #1022) - Alex
|
- Reset input delay upon leaving Supermelee (bug #1022) - Alex
|
||||||
- Properly account for simultaneous destruction of last ships
|
- Properly account for simultaneous destruction of last ships
|
||||||
in each fleet in Supermelee (bug #437) - Alex
|
in each fleet in Supermelee (bug #437) - Alex
|
||||||
|
|||||||
@@ -510,6 +510,7 @@ AbortBattle:
|
|||||||
setBattleStateConnections (NULL);
|
setBattleStateConnections (NULL);
|
||||||
#endif /* NETPLAY */
|
#endif /* NETPLAY */
|
||||||
|
|
||||||
|
StopDitty ();
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
StopSound ();
|
StopSound ();
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-15
@@ -43,6 +43,9 @@
|
|||||||
#include "libs/mathlib.h"
|
#include "libs/mathlib.h"
|
||||||
|
|
||||||
|
|
||||||
|
static BOOLEAN dittyIsPlaying;
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
OpponentAlive (STARSHIP *TestStarShipPtr)
|
OpponentAlive (STARSHIP *TestStarShipPtr)
|
||||||
{
|
{
|
||||||
@@ -66,6 +69,31 @@ OpponentAlive (STARSHIP *TestStarShipPtr)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PlayDitty (STARSHIP *ship)
|
||||||
|
{
|
||||||
|
PlayMusic (ship->RaceDescPtr->ship_data.victory_ditty, FALSE, 3);
|
||||||
|
dittyIsPlaying = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StopDitty (void)
|
||||||
|
{
|
||||||
|
if (dittyIsPlaying)
|
||||||
|
StopMusic ();
|
||||||
|
dittyIsPlaying = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOLEAN
|
||||||
|
DittyPlaying (void)
|
||||||
|
{
|
||||||
|
if (!dittyIsPlaying)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
dittyIsPlaying = PLRPlaying ((MUSIC_REF)~0);
|
||||||
|
return dittyIsPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
static void
|
static void
|
||||||
readyToEnd2Callback (NetConnection *conn, void *arg)
|
readyToEnd2Callback (NetConnection *conn, void *arg)
|
||||||
@@ -223,12 +251,12 @@ readyForBattleEnd (COUNT side)
|
|||||||
return true;
|
return true;
|
||||||
#else /* !DEMO_MODE */
|
#else /* !DEMO_MODE */
|
||||||
(void) side;
|
(void) side;
|
||||||
return !PLRPlaying ((MUSIC_REF)~0);
|
return !DittyPlaying ();
|
||||||
#endif /* !DEMO_MODE */
|
#endif /* !DEMO_MODE */
|
||||||
#else /* defined (NETPLAY) */
|
#else /* defined (NETPLAY) */
|
||||||
int playerI;
|
int playerI;
|
||||||
|
|
||||||
if (PLRPlaying ((MUSIC_REF)~0))
|
if (DittyPlaying ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// We can only handle one dead ship at a time. So 'deadSide' is set
|
// We can only handle one dead ship at a time. So 'deadSide' is set
|
||||||
@@ -272,23 +300,14 @@ new_ship (ELEMENT *DeadShipPtr)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Ship explosion has finished, or ship has just warped out
|
||||||
|
// if DeadStarShipPtr->crew_level != 0
|
||||||
BOOLEAN MusicStarted;
|
BOOLEAN MusicStarted;
|
||||||
HELEMENT hElement, hSuccElement;
|
HELEMENT hElement, hSuccElement;
|
||||||
|
|
||||||
/* Record crew left after the battle */
|
/* Record crew left after the battle */
|
||||||
DeadStarShipPtr->crew_level =
|
DeadStarShipPtr->crew_level =
|
||||||
DeadStarShipPtr->RaceDescPtr->ship_info.crew_level;
|
DeadStarShipPtr->RaceDescPtr->ship_info.crew_level;
|
||||||
if (DeadStarShipPtr->crew_level)
|
|
||||||
{
|
|
||||||
// We've just warped out. new_ship() will still be called
|
|
||||||
// a few times, as for any "dead" ship.
|
|
||||||
StopMusic ();
|
|
||||||
|
|
||||||
// Even after much investigation, I could find no purpose for
|
|
||||||
// the next line, but with the crew management changes I need
|
|
||||||
// it not to be here. - SvdB
|
|
||||||
// DeadStarShipPtr->RaceDescPtr->ship_info.crew_level = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
MusicStarted = FALSE;
|
MusicStarted = FALSE;
|
||||||
// XXX: Set to 0 to be vaguely checksum-compatible with previous
|
// XXX: Set to 0 to be vaguely checksum-compatible with previous
|
||||||
@@ -333,8 +352,7 @@ new_ship (ELEMENT *DeadShipPtr)
|
|||||||
{
|
{
|
||||||
// StarShipPtr points to the remaining ship.
|
// StarShipPtr points to the remaining ship.
|
||||||
MusicStarted = TRUE;
|
MusicStarted = TRUE;
|
||||||
PlayMusic (StarShipPtr->RaceDescPtr->
|
PlayDitty (StarShipPtr);
|
||||||
ship_data.victory_ditty, FALSE, 3);
|
|
||||||
StarShipPtr->cur_status_flags &= ~PLAY_VICTORY_DITTY;
|
StarShipPtr->cur_status_flags &= ~PLAY_VICTORY_DITTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,6 +379,7 @@ new_ship (ELEMENT *DeadShipPtr)
|
|||||||
{
|
{
|
||||||
BOOLEAN RestartMusic;
|
BOOLEAN RestartMusic;
|
||||||
|
|
||||||
|
StopDitty ();
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
StopSound ();
|
StopSound ();
|
||||||
|
|
||||||
@@ -520,6 +539,7 @@ ship_death (ELEMENT *ShipPtr)
|
|||||||
HELEMENT hElement, hNextElement;
|
HELEMENT hElement, hNextElement;
|
||||||
ELEMENT *ElementPtr;
|
ELEMENT *ElementPtr;
|
||||||
|
|
||||||
|
StopDitty ();
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
|
|
||||||
GetElementStarShip (ShipPtr, &StarShipPtr);
|
GetElementStarShip (ShipPtr, &StarShipPtr);
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ extern void ship_death (ELEMENT *ShipPtr);
|
|||||||
extern void spawn_ion_trail (ELEMENT *ElementPtr);
|
extern void spawn_ion_trail (ELEMENT *ElementPtr);
|
||||||
extern void flee_preprocess (ELEMENT *ElementPtr);
|
extern void flee_preprocess (ELEMENT *ElementPtr);
|
||||||
|
|
||||||
|
extern void StopDitty (void);
|
||||||
|
|
||||||
#endif /* _TACTRANS_H */
|
#endif /* _TACTRANS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user