From: <av...@us...> - 2009-11-18 05:39:48
|
Revision: 3318 http://sc2.svn.sourceforge.net/sc2/?rev=3318&view=rev Author: avolkov Date: 2009-11-18 05:39:40 +0000 (Wed, 18 Nov 2009) Log Message: ----------- Removed references to pMenuState from comm (required parameter carried forward); some header file cleanups; comments and minor cleanup of Starbase Modified Paths: -------------- trunk/sc2/src/uqm/comm/chmmr/chmmrc.c trunk/sc2/src/uqm/comm/commall.h trunk/sc2/src/uqm/comm/melnorm/melnorm.c trunk/sc2/src/uqm/comm/urquan/urquanc.c trunk/sc2/src/uqm/comm.c trunk/sc2/src/uqm/comm.h trunk/sc2/src/uqm/commglue.h trunk/sc2/src/uqm/credits.c trunk/sc2/src/uqm/encount.h trunk/sc2/src/uqm/gameev.c trunk/sc2/src/uqm/gameopt.c trunk/sc2/src/uqm/grpinfo.c trunk/sc2/src/uqm/ipdisp.c trunk/sc2/src/uqm/menu.c trunk/sc2/src/uqm/plandata.c trunk/sc2/src/uqm/planets/lander.c trunk/sc2/src/uqm/planets/orbits.c trunk/sc2/src/uqm/planets/pstarmap.c trunk/sc2/src/uqm/planets/scan.c trunk/sc2/src/uqm/restart.c trunk/sc2/src/uqm/sis.c trunk/sc2/src/uqm/starbase.c trunk/sc2/src/uqm/starcon.c Modified: trunk/sc2/src/uqm/comm/chmmr/chmmrc.c =================================================================== --- trunk/sc2/src/uqm/comm/chmmr/chmmrc.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/comm/chmmr/chmmrc.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -577,6 +577,7 @@ } else { + SetCommIntroMode (CIM_FADE_IN_SCREEN, ONE_SECOND * 2); NPCPhrase (WE_ARE_FREE); if (NumVisits) Modified: trunk/sc2/src/uqm/comm/commall.h =================================================================== --- trunk/sc2/src/uqm/comm/commall.h 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/comm/commall.h 2009-11-18 05:39:40 UTC (rev 3318) @@ -20,7 +20,6 @@ #include "uqm/colors.h" #include "uqm/comm.h" #include "uqm/commglue.h" -#include "uqm/encount.h" #include "libs/reslib.h" #endif /* _COMMALL_H */ Modified: trunk/sc2/src/uqm/comm/melnorm/melnorm.c =================================================================== --- trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -26,7 +26,10 @@ #include "libs/inplib.h" #include "libs/mathlib.h" +// XXX: temporary, for SOL_X/SOL_Y +#include "uqm/races.h" + #define NUM_HISTORY_ITEMS 9 #define NUM_EVENT_ITEMS 8 #define NUM_ALIEN_RACE_ITEMS 16 Modified: trunk/sc2/src/uqm/comm/urquan/urquanc.c =================================================================== --- trunk/sc2/src/uqm/comm/urquan/urquanc.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/comm/urquan/urquanc.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -429,6 +429,7 @@ } else if (GET_GAME_STATE (PLAYER_HYPNOTIZED)) { + SetCommIntroMode (CIM_FADE_IN_SCREEN, ONE_SECOND * 5); UrquanHypno ((RESPONSE_REF)0); } else Modified: trunk/sc2/src/uqm/comm.c =================================================================== --- trunk/sc2/src/uqm/comm.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/comm.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -50,10 +50,11 @@ LOCDATA CommData; -int cur_comm; UNICODE shared_phrase_buf[2048]; static BOOLEAN TalkingFinished; +static CommIntroMode curIntroMode = CIM_DEFAULT; +static TimeCount fadeTime; typedef struct response_entry { @@ -686,6 +687,47 @@ TalkingFinished = TRUE; } +static void +CommIntroTransition (void) +{ + if (curIntroMode == CIM_CROSSFADE_SCREEN) + { + ScreenTransition (3, NULL); + UnbatchGraphics (); + } + else if (curIntroMode == CIM_CROSSFADE_SPACE) + { + RECT r; + r.corner.x = SIS_ORG_X; + r.corner.y = SIS_ORG_Y; + r.extent.width = SIS_SCREEN_WIDTH; + r.extent.height = SIS_SCREEN_HEIGHT; + ScreenTransition (3, &r); + UnbatchGraphics (); + } + else if (curIntroMode == CIM_CROSSFADE_WINDOW) + { + ScreenTransition (3, &CommWndRect); + UnbatchGraphics (); + } + else if (curIntroMode == CIM_FADE_IN_SCREEN) + { + BYTE clut_buf[] = {FadeAllToColor}; + UnbatchGraphics (); + XFormColorMap ((COLORMAPPTR)clut_buf, fadeTime); + } + else + { // Uknown transition + // Have to unbatch anyway or no more graphics, ever + UnbatchGraphics (); + assert (0 && "Unknown comm intro transition"); + } + + // Reset the mode for next time. Everything that needs a + // different one will let us know. + curIntroMode = CIM_DEFAULT; +} + void AlienTalkSegue (COUNT wait_track) { @@ -703,43 +745,7 @@ DrawAlienFrame (NULL, 0, TRUE); UpdateSpeechGraphics (TRUE); - if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE - || (!GET_GAME_STATE (PLAYER_HYPNOTIZED) - && !GET_GAME_STATE (CHMMR_EMERGING) - && GET_GAME_STATE (CHMMR_BOMB_STATE) != 2 - && (pMenuState == 0 || !GET_GAME_STATE (MOONBASE_ON_SHIP) - || GET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER)))) - { - RECT r; - - if (pMenuState == 0 && - LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE) - { - r.corner.x = SIS_ORG_X; - r.corner.y = SIS_ORG_Y; - r.extent.width = SIS_SCREEN_WIDTH; - r.extent.height = SIS_SCREEN_HEIGHT; - ScreenTransition (3, &r); - } - else - { - ScreenTransition (3, &CommWndRect); - } - UnbatchGraphics (); - } - else - { - BYTE clut_buf[] = {FadeAllToColor}; - - UnbatchGraphics (); - if (GET_GAME_STATE (MOONBASE_ON_SHIP) - || GET_GAME_STATE (CHMMR_BOMB_STATE) == 2) - XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND * 2); - else if (GET_GAME_STATE (CHMMR_EMERGING)) - XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND * 2); - else - XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND * 5); - } + CommIntroTransition (); pCurInputState->Initialized = TRUE; PlayMusic (CommData.AlienSong, TRUE, 1); @@ -1238,28 +1244,21 @@ SetContextClipRect (&r); CommWndRect.corner = r.corner; - if (pMenuState == 0) - { - RepairSISBorder (); - UnlockMutex (GraphicsLock); - DrawMenuStateStrings ((BYTE)~0, 1); - LockMutex (GraphicsLock); + DrawSISFrame (); + // TODO: find a better way to do this, perhaps set the titles + // forward from callers. + if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == (BYTE)~0 + && GET_GAME_STATE (STARBASE_AVAILABLE)) + { // Talking to allied Starbase + DrawSISMessage (GAME_STRING (STARBASE_STRING_BASE + 1)); + // "Starbase Commander" + DrawSISTitle (GAME_STRING (STARBASE_STRING_BASE + 0)); + // "Starbase" } - else /* in starbase */ - { - DrawSISFrame (); - if (GET_GAME_STATE (STARBASE_AVAILABLE)) - { - DrawSISMessage (GAME_STRING (STARBASE_STRING_BASE + 1)); - // "Starbase Commander" - DrawSISTitle (GAME_STRING (STARBASE_STRING_BASE + 0)); - // "Starbase" - } - else - { - DrawSISMessage (NULL); - DrawSISTitle (GLOBAL_SIS (PlanetName)); - } + else + { // Default titles: star name + planet name + DrawSISMessage (NULL); + DrawSISTitle (GLOBAL_SIS (PlanetName)); } } @@ -1297,6 +1296,13 @@ pCurInputState = 0; } +void +SetCommIntroMode (CommIntroMode newMode, TimeCount howLong) +{ + curIntroMode = newMode; + fadeTime = howLong; +} + COUNT InitCommunication (CONVERSATION which_comm) { @@ -1400,9 +1406,7 @@ if (status == HAIL) { - cur_comm = which_comm; HailAlien (); - cur_comm = 0; } else if (LocDataPtr) { // only when comm initied successfully @@ -1417,10 +1421,14 @@ status = 0; if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) { + // The Sa-Matra battle is skipped when Cyborg is enabled. + // Most likely because the Cyborg is too dumb to know what + // to do in this battle. if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE && (GLOBAL (glob_flags) & CYBORG_ENABLED)) ReinitQueue (&GLOBAL (npc_built_ship_q)); + // Clear the location flags SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 0); status = (GET_GAME_STATE (BATTLE_SEGUE) && GetHeadLink (&GLOBAL (npc_built_ship_q))); Modified: trunk/sc2/src/uqm/comm.h =================================================================== --- trunk/sc2/src/uqm/comm.h 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/comm.h 2009-11-18 05:39:40 UTC (rev 3318) @@ -20,6 +20,8 @@ #include "globdata.h" #include "libs/compiler.h" #include "libs/gfxlib.h" +#include "commglue.h" + // for CONVERSATION #ifdef COMM_INTERNAL @@ -98,8 +100,16 @@ #endif +#define TEXT_X_OFFS 1 +#define TEXT_Y_OFFS 1 +#define SIS_TEXT_WIDTH (SIS_SCREEN_WIDTH - (TEXT_X_OFFS << 1)) + extern void init_communication (void); extern void uninit_communication (void); + +extern COUNT InitCommunication (CONVERSATION which_comm); +extern void RaceCommunication (void); + extern void AlienTalkSegue (COUNT wait_track); BOOLEAN getLineWithinWidth(TEXT *pText, const unsigned char **startNext, SIZE maxWidth, COUNT maxChars); @@ -108,6 +118,17 @@ extern RECT CommWndRect; /* comm window rect */ +typedef enum +{ + CIM_CROSSFADE_SPACE, + CIM_CROSSFADE_WINDOW, + CIM_CROSSFADE_SCREEN, + CIM_FADE_IN_SCREEN, + + CIM_DEFAULT = CIM_CROSSFADE_SPACE, +} CommIntroMode; +extern void SetCommIntroMode (CommIntroMode, TimeCount howLong); + extern void EnableTalkingAnim (BOOLEAN enable); #endif /* _COMM_H */ Modified: trunk/sc2/src/uqm/commglue.h =================================================================== --- trunk/sc2/src/uqm/commglue.h 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/commglue.h 2009-11-18 05:39:40 UTC (rev 3318) @@ -54,7 +54,6 @@ } CONVERSATION; extern LOCDATA CommData; -extern int cur_comm; extern UNICODE shared_phrase_buf[2048]; #define PLAYER_SAID(r,i) ((r)==(i)) Modified: trunk/sc2/src/uqm/credits.c =================================================================== --- trunk/sc2/src/uqm/credits.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/credits.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -19,11 +19,9 @@ #include "credits.h" #include "controls.h" -#include "encount.h" #include "options.h" #include "oscill.h" #include "comm.h" -#include "commglue.h" #include "resinst.h" #include "nameref.h" #include "settings.h" @@ -617,6 +615,7 @@ for (i = 0; (i < NUM_OUTTAKES) && !(GLOBAL (CurrentActivity) & CHECK_ABORT); i++) { + SetCommIntroMode (CIM_CROSSFADE_WINDOW, 0); InitCommunication (outtake_list[i]); } Modified: trunk/sc2/src/uqm/encount.h =================================================================== --- trunk/sc2/src/uqm/encount.h 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/encount.h 2009-11-18 05:39:40 UTC (rev 3318) @@ -19,11 +19,12 @@ #ifndef _ENCOUNT_H #define _ENCOUNT_H +// XXX: temporary, for CONVERSATION #include "commglue.h" #include "displist.h" #include "libs/gfxlib.h" #include "planets/planets.h" -#include "races.h" +#include "element.h" typedef HLINK HENCOUNTER; @@ -124,10 +125,7 @@ #define UMGAH_DEFINED TALKING_PET_DEFINED -#define TEXT_X_OFFS 1 -#define TEXT_Y_OFFS 1 -#define SIS_TEXT_WIDTH (SIS_SCREEN_WIDTH - (TEXT_X_OFFS << 1)) - +// XXX: The stuff till EOC does not belong here extern STAR_DESC *CurStarDescPtr; extern STAR_DESC *star_array; @@ -137,6 +135,7 @@ SIZE xbounds, SIZE ybounds); extern void GetClusterName (const STAR_DESC *pSD, UNICODE buf[]); +// <<< EOC enum { @@ -149,8 +148,9 @@ extern void BuildBattle (COUNT which_player); extern COUNT InitEncounter (void); extern COUNT UninitEncounter (void); + +// XXX: in comm.h, temporary, until solsys generation code is redone extern COUNT InitCommunication (CONVERSATION which_comm); -extern void RaceCommunication (void); extern void GenerateSOL (BYTE control); extern void GenerateShofixti (BYTE control); Modified: trunk/sc2/src/uqm/gameev.c =================================================================== --- trunk/sc2/src/uqm/gameev.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/gameev.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -19,6 +19,7 @@ #include "build.h" #include "clock.h" +// XXX: for CurStarDescPtr and XXX_DEFINED constants #include "encount.h" #include "globdata.h" #include "hyper.h" Modified: trunk/sc2/src/uqm/gameopt.c =================================================================== --- trunk/sc2/src/uqm/gameopt.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/gameopt.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -21,7 +21,9 @@ #include "build.h" #include "colors.h" #include "commglue.h" + // for CommData #include "controls.h" +// XXX: for FindStart(), GetClusterName() #include "encount.h" #include "planets/lander.h" #include "gamestr.h" Modified: trunk/sc2/src/uqm/grpinfo.c =================================================================== --- trunk/sc2/src/uqm/grpinfo.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/grpinfo.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -17,6 +17,7 @@ */ #include "build.h" +// XXX: for CurStarDescPtr and XXX_DEFINED constants #include "encount.h" #include "libs/file.h" #include "globdata.h" Modified: trunk/sc2/src/uqm/ipdisp.c =================================================================== --- trunk/sc2/src/uqm/ipdisp.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/ipdisp.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -25,6 +25,7 @@ #include "process.h" #include "grpinfo.h" #include "encount.h" + // for EncounterGroup, EncounterRace #include "libs/mathlib.h" Modified: trunk/sc2/src/uqm/menu.c =================================================================== --- trunk/sc2/src/uqm/menu.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/menu.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -17,7 +17,6 @@ */ #include "colors.h" -#include "commglue.h" #include "controls.h" #include "options.h" #include "setup.h" Modified: trunk/sc2/src/uqm/plandata.c =================================================================== --- trunk/sc2/src/uqm/plandata.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/plandata.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -16,8 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +// XXX: for XXX_DEFINED constants #include "encount.h" #include "resinst.h" +#include "planets/planets.h" #include "planets/elemdata.h" Modified: trunk/sc2/src/uqm/planets/lander.c =================================================================== --- trunk/sc2/src/uqm/planets/lander.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/planets/lander.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -23,6 +23,7 @@ #include "../cons_res.h" #include "../controls.h" #include "../colors.h" +// XXX: for CurStarDescPtr and XXX_DEFINED #include "../encount.h" #include "../process.h" #include "../gamestr.h" Modified: trunk/sc2/src/uqm/planets/orbits.c =================================================================== --- trunk/sc2/src/uqm/planets/orbits.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/planets/orbits.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -17,6 +17,7 @@ */ #include "planets.h" +// XXX: for CurStarDescPtr #include "../encount.h" #include "libs/compiler.h" #include "libs/mathlib.h" Modified: trunk/sc2/src/uqm/planets/pstarmap.c =================================================================== --- trunk/sc2/src/uqm/planets/pstarmap.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/planets/pstarmap.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -19,6 +19,7 @@ #include "scan.h" #include "../colors.h" #include "../controls.h" +// XXX: for stuff that does not belong there #include "../encount.h" #include "../gameopt.h" #include "../gamestr.h" Modified: trunk/sc2/src/uqm/planets/scan.c =================================================================== --- trunk/sc2/src/uqm/planets/scan.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/planets/scan.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -22,6 +22,7 @@ #include "../cons_res.h" #include "../controls.h" #include "../encount.h" + // for EncounterGroup #include "../gamestr.h" #include "../nameref.h" #include "../resinst.h" Modified: trunk/sc2/src/uqm/restart.c =================================================================== --- trunk/sc2/src/uqm/restart.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/restart.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -21,6 +21,7 @@ #include "colors.h" #include "controls.h" #include "credits.h" +// XXX: for star_array[] #include "encount.h" #include "fmv.h" #include "gamestr.h" Modified: trunk/sc2/src/uqm/sis.c =================================================================== --- trunk/sc2/src/uqm/sis.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/sis.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -17,7 +17,8 @@ */ #include "colors.h" -#include "commglue.h" +#include "races.h" +// XXX: including encount.h for stuff that does not belong there #include "encount.h" #include "gamestr.h" #include "options.h" Modified: trunk/sc2/src/uqm/starbase.c =================================================================== --- trunk/sc2/src/uqm/starbase.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/starbase.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -19,7 +19,9 @@ #include "build.h" #include "colors.h" #include "controls.h" +// XXX: for CurStarDescPtr #include "encount.h" +#include "comm.h" #include "gamestr.h" #include "load.h" #include "starbase.h" @@ -34,6 +36,8 @@ MENU_STATE *pMenuState; +static void CleanupAfterStarBase (void); + static void DrawBaseStateStrings (STARBASE_STATE OldState, STARBASE_STATE NewState) { @@ -289,6 +293,8 @@ BOOLEAN DoStarBase (MENU_STATE *pMS) { + // XXX: This function is full of hacks and otherwise strange code + if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) { pMS->CurState = DEPART_BASE; @@ -344,9 +350,7 @@ UnbatchGraphics (); UnlockMutex (GraphicsLock); } - else if (PulsedInputState.menu[KEY_MENU_SELECT] - || GET_GAME_STATE (MOONBASE_ON_SHIP) - || GET_GAME_STATE (CHMMR_BOMB_STATE) == 2) + else if (PulsedInputState.menu[KEY_MENU_SELECT]) { ExitStarBase: DestroyDrawable (ReleaseDrawable (pMS->CurFrame)); @@ -372,6 +376,8 @@ { FlushInput (); InitCommunication (COMMANDER_CONVERSATION); + // XXX: InitCommunication() clears these flags, and we need them + // This marks that we are in Starbase. SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, (BYTE)~0); } else @@ -453,22 +459,31 @@ CONTEXT OldContext; StatMsgMode prevMsgMode = SMM_UNDEFINED; + // XXX: This should probably be moved out to Starcon2Main() if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2) - { - CurStarDescPtr = 0; - goto TimePassage; + { // We were just transported by Chmmr to the Starbase + // Force a reload of the SolarSys + CurStarDescPtr = NULL; + // This marks that we are in Starbase. + SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, (BYTE)~0); } - else if (!GET_GAME_STATE (STARBASE_AVAILABLE)) + + if (!GET_GAME_STATE (STARBASE_AVAILABLE)) { HSHIPFRAG hStarShip; SHIP_FRAGMENT *FragPtr; pMenuState = 0; + // Unallied Starbase conversation + SetCommIntroMode (CIM_CROSSFADE_SCREEN, 0); InitCommunication (COMMANDER_CONVERSATION); if (!GET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER) || (GLOBAL (CurrentActivity) & CHECK_ABORT)) - goto ExitStarBase; + { + CleanupAfterStarBase (); + return; + } /* Create an Ilwrath ship responding to the Ur-Quan * probe's broadcast */ @@ -483,18 +498,18 @@ InitCommunication (ILWRATH_CONVERSATION); if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0 || (GLOBAL (CurrentActivity) & CHECK_ABORT)) - return; - SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, (BYTE)~0); - + return; // Killed by Ilwrath + + // After Ilwrath battle, about-to-ally Starbase conversation { pMenuState = &MenuState; + SetCommIntroMode (CIM_CROSSFADE_SCREEN, 0); InitCommunication (COMMANDER_CONVERSATION); - -TimePassage: + if (GLOBAL (CurrentActivity) & CHECK_ABORT) + return; + // XXX: InitCommunication() clears these flags, and we need them + // This marks that we are in Starbase. SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, (BYTE)~0); - DoTimePassage (); - if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0) - return; // You are now dead! Thank you! } } @@ -504,11 +519,23 @@ memset (&MenuState, 0, sizeof (MenuState)); MenuState.InputFunc = DoStarBase; + if (GET_GAME_STATE (MOONBASE_ON_SHIP) || GET_GAME_STATE (CHMMR_BOMB_STATE) == 2) - { - MenuState.Initialized = TRUE; - MenuState.CurState = TALK_COMMANDER; + { // Go immediately into a conversation with the Commander when the + // Starbase becomes available for the first time, or after Chmmr + // install the bomb. + DoTimePassage (); + if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0) + return; // You are now dead! Thank you! (killed by Kohr-Ah) + + SetCommIntroMode (CIM_FADE_IN_SCREEN, ONE_SECOND * 2); + InitCommunication (COMMANDER_CONVERSATION); + if (GLOBAL (CurrentActivity) & CHECK_ABORT) + return; + // XXX: InitCommunication() clears these flags, and we need them + // This marks that we are in Starbase. + SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, (BYTE)~0); } OldContext = SetContext (ScreenContext); @@ -518,10 +545,17 @@ pMenuState = 0; SetStatusMessageMode (prevMsgMode); -ExitStarBase: + CleanupAfterStarBase (); +} + +static void +CleanupAfterStarBase (void) +{ if (!(GLOBAL (CurrentActivity) & (CHECK_LOAD | CHECK_ABORT))) { + // Mark as not in Starbase anymore SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 0); + // Fake a load so Starcon2Main takes us to IP GLOBAL (CurrentActivity) = CHECK_LOAD; NextActivity = MAKE_WORD (IN_INTERPLANETARY, 0) | START_INTERPLANETARY; Modified: trunk/sc2/src/uqm/starcon.c =================================================================== --- trunk/sc2/src/uqm/starcon.c 2009-11-18 01:59:57 UTC (rev 3317) +++ trunk/sc2/src/uqm/starcon.c 2009-11-18 05:39:40 UTC (rev 3318) @@ -18,7 +18,7 @@ #include <stdlib.h> -#include "encount.h" +#include "comm.h" #include "battle.h" #include "fmv.h" #include "gameev.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |