diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index bbe40afac..ba4044d59 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -1705,7 +1705,8 @@ DoCommunication (PENCOUNTER_STATE pES) { temp = curr->tag.data; // fprintf (stderr, "%s\n", temp); - while (wstrlen (temp) > (unsigned int) SUMMARY_CHARS) + while (wstrlen (temp) > (unsigned int) SUMMARY_CHARS + && !(GLOBAL (CurrentActivity) & CHECK_ABORT)) { int space_index; // find last space before it goes over the max chars per line @@ -1742,11 +1743,8 @@ DoCommunication (PENCOUNTER_STATE pES) t.baseline.x = SAFE_X + 2; t.align = ALIGN_LEFT; t.baseline.y = SAFE_Y + DELTA_Y_SUMMARY; - while (AnyButtonPress (TRUE)) - TaskSwitch (); - - while (!AnyButtonPress (TRUE)) - TaskSwitch (); + + WaitAnyButtonOrQuit (TRUE); SetSemaphore (GraphicsSem); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x05, 0x00), 0x6E)); @@ -1755,6 +1753,9 @@ DoCommunication (PENCOUNTER_STATE pES) SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x10, 0x00), 0x6B)); } } + + if (GLOBAL (CurrentActivity) & CHECK_ABORT) + break; t.pStr = temp; SetSemaphore (GraphicsSem); @@ -1776,11 +1777,8 @@ DoCommunication (PENCOUNTER_STATE pES) t.baseline.x = SAFE_X + 2; t.align = ALIGN_LEFT; t.baseline.y = SAFE_Y + DELTA_Y_SUMMARY; - while (AnyButtonPress (TRUE)) - TaskSwitch (); - - while (!AnyButtonPress (TRUE)) - TaskSwitch (); + + WaitAnyButtonOrQuit (TRUE); SetSemaphore (GraphicsSem); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x05, 0x00), 0x6E)); @@ -1790,11 +1788,7 @@ DoCommunication (PENCOUNTER_STATE pES) } } - while (AnyButtonPress (TRUE)) - TaskSwitch (); - - while (!AnyButtonPress (TRUE)) - TaskSwitch (); + WaitAnyButtonOrQuit (TRUE); SetSemaphore (GraphicsSem); SetContextFont (fLast); diff --git a/sc2/src/sc2code/credits.c b/sc2/src/sc2code/credits.c index a095dc675..bf4847680 100644 --- a/sc2/src/sc2code/credits.c +++ b/sc2/src/sc2code/credits.c @@ -22,22 +22,6 @@ #include "oscill.h" #include "options.h" -//Added by Chris - -void FreeSC2Data (void); - -void FreeLanderData (void); - -void FreeIPData (void); - -void FreeMasterShipList (void); - -void UninitSpace (void); - -void FreeHyperData (void); - -//End Added by Chris - void Credits (void) { @@ -52,11 +36,10 @@ Credits (void) DWORD TimeIn; MUSIC_REF hMusic; BYTE fade_buf[1]; + + if (GLOBAL (CurrentActivity) & CHECK_ABORT) + return; -FreeSC2Data (); -FreeLanderData (); -FreeIPData (); -FreeHyperData (); rt = GET_TYPE (CREDIT00_ANIM); ri = GET_INSTANCE (CREDIT00_ANIM); rp = GET_PACKAGE (CREDIT00_ANIM); @@ -85,7 +68,8 @@ FreeHyperData (); SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2)); TimeIn = GetTimeCounter (); - for (i = 1; i < NUM_CREDITS; ++i) + for (i = 1; (i < NUM_CREDITS) && + !(GLOBAL (CurrentActivity) & CHECK_ABORT); ++i) { SetTransitionSource (&r); BatchGraphics (); @@ -97,15 +81,21 @@ FreeHyperData (); UnbatchGraphics (); DestroyDrawable (ReleaseDrawable (f[i])); - SleepThreadUntil (TimeIn + ONE_SECOND * 5); + ClearSemaphore (GraphicsSem); + while ((GetTimeCounter () - TimeIn < ONE_SECOND * 5) && + !(GLOBAL (CurrentActivity) & CHECK_ABORT)) + { + UpdateInputState (); + SleepThreadUntil (ONE_SECOND / 20); + } + SetSemaphore (GraphicsSem); TimeIn = GetTimeCounter (); } DestroyDrawable (ReleaseDrawable (f[0])); ClearSemaphore (GraphicsSem); - while (!AnyButtonPress (FALSE)); - while (AnyButtonPress (FALSE)); + WaitAnyButtonOrQuit (FALSE); fade_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2)); @@ -121,40 +111,57 @@ FreeHyperData (); void OutTakes (void) { +#define NUM_OUTTAKES 15 + static long outtake_list[NUM_OUTTAKES] = + { + ZOQFOTPIK_CONVERSATION, + TALKING_PET_CONVERSATION, + ORZ_CONVERSATION, + UTWIG_CONVERSATION, + THRADD_CONVERSATION, + SUPOX_CONVERSATION, + SYREEN_CONVERSATION, + SHOFIXTI_CONVERSATION, + PKUNK_CONVERSATION, + YEHAT_CONVERSATION, + DRUUGE_CONVERSATION, + URQUAN_CONVERSATION, + VUX_CONVERSATION, + BLACKURQ_CONVERSATION, + ARILOU_CONVERSATION + }; + RECT r; - float oldvolume = speechVolumeScale; BOOLEAN oldsubtitles = optSubtitles; + int i = 0; + BYTE fade_buf[1]; - speechVolumeScale = 0.0f; optSubtitles = TRUE; sliderDisabled = TRUE; SetSemaphore (GraphicsSem); SetContext (ScreenContext); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x0, 0x0, 0x0), 0x00)); + fade_buf[0] = FadeAllToColor; + XFormColorMap ((COLORMAPPTR)fade_buf, 0); + r.corner.x = r.corner.y = 0; r.extent.width = SCREEN_WIDTH; r.extent.height = SCREEN_HEIGHT; DrawFilledRectangle (&r); ClearSemaphore (GraphicsSem); - InitCommunication (ZOQFOTPIK_CONVERSATION); - InitCommunication (TALKING_PET_CONVERSATION); - InitCommunication (ORZ_CONVERSATION); - InitCommunication (UTWIG_CONVERSATION); - InitCommunication (THRADD_CONVERSATION); - InitCommunication (SUPOX_CONVERSATION); - InitCommunication (SYREEN_CONVERSATION); - InitCommunication (SHOFIXTI_CONVERSATION); - InitCommunication (PKUNK_CONVERSATION); - InitCommunication (YEHAT_CONVERSATION); - InitCommunication (DRUUGE_CONVERSATION); - InitCommunication (URQUAN_CONVERSATION); - InitCommunication (VUX_CONVERSATION); - InitCommunication (BLACKURQ_CONVERSATION); - InitCommunication (ARILOU_CONVERSATION); + for (i = 0; (i < NUM_OUTTAKES) && + !(GLOBAL (CurrentActivity) & CHECK_ABORT); i++) + { + InitCommunication (outtake_list[i]); + } + + SetContext (ScreenContext); + fade_buf[0] = FadeAllToBlack; + SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2)); + FlushColorXForms (); - speechVolumeScale = oldvolume; optSubtitles = oldsubtitles; sliderDisabled = FALSE; } diff --git a/sc2/src/sc2code/credits.h b/sc2/src/sc2code/credits.h index 3632cacda..1d3f6b9e8 100644 --- a/sc2/src/sc2code/credits.h +++ b/sc2/src/sc2code/credits.h @@ -15,3 +15,5 @@ */ void OutTakes (void); +void Victory (void); +void Credits (void); diff --git a/sc2/src/sc2code/fmv.c b/sc2/src/sc2code/fmv.c index 044e862dc..171c9a928 100644 --- a/sc2/src/sc2code/fmv.c +++ b/sc2/src/sc2code/fmv.c @@ -87,11 +87,10 @@ Introduction (void) DestroyDrawable (ReleaseDrawable (s.frame)); ClearSemaphore (GraphicsSem); - FlushInput (); - xform_buf[0] = FadeAllToColor; TimeOut = XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2); LoadMasterShipList (); + FlushInput (); InitGameKernel (); while ((GetTimeCounter () <= TimeOut) && !(GLOBAL (CurrentActivity) & CHECK_ABORT)) @@ -152,8 +151,6 @@ Victory (void) xform_buf[0] = FadeAllToBlack; XFormColorMap ((COLORMAPPTR)xform_buf, 0); - - InitGameKernel (); } void diff --git a/sc2/src/sc2code/restart.c b/sc2/src/sc2code/restart.c index 58dc490be..ff009257f 100644 --- a/sc2/src/sc2code/restart.c +++ b/sc2/src/sc2code/restart.c @@ -19,15 +19,12 @@ #include "starcon.h" #include "uqmversion.h" #include "controls.h" +#include "credits.h" //Added by Chris void Melee (void); -void Victory (void); - -void Credits (void); - void FreeHyperData (void); void FreeIPData (void); @@ -36,6 +33,8 @@ void FreeSC2Data (void); void FreeLanderData (void); +BOOLEAN InitGameKernel (void); + //End Added by Chris enum @@ -246,9 +245,19 @@ LastActivity = WON_LAST_BATTLE; #endif /* NOTYET */ if (LOBYTE (LastActivity) == WON_LAST_BATTLE) { + GLOBAL (CurrentActivity) = WON_LAST_BATTLE; Victory (); + InitGameKernel (); + OutTakes (); Credits (); + + FreeSC2Data (); + FreeLanderData (); + FreeIPData (); + FreeHyperData (); + TimeOut = ONE_SECOND / 2; + GLOBAL (CurrentActivity) = CHECK_ABORT; } } diff --git a/sc2/src/sc2code/starcon.c b/sc2/src/sc2code/starcon.c index 84c9ec5ad..e9d4e4081 100644 --- a/sc2/src/sc2code/starcon.c +++ b/sc2/src/sc2code/starcon.c @@ -994,8 +994,6 @@ sc = _simple_count; if (GET_GAME_STATE (KOHR_AH_KILLED_ALL)) InitCommunication (BLACKURQ_CONVERSATION); //surrendered to Ur-Quan - else if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE) - OutTakes (); else if (GLOBAL (CurrentActivity) & CHECK_RESTART) GLOBAL (CurrentActivity) &= ~CHECK_RESTART; break;