void SplashScreen (void (* DoProcessing)(DWORD TimeOut)) { BYTE xform_buf[1]; STAMP s; DWORD TimeOut; BOOLEAN InputState; xform_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ( (COLORMAPPTR) xform_buf, ONE_SECOND / 120)); LockMutex (GraphicsLock); SetContext (ScreenContext); s.origin.x = s.origin.y = 0; s.frame = CaptureDrawable (LoadGraphic (TITLE_ANIM)); DrawStamp (&s); DestroyDrawable (ReleaseDrawable (s.frame)); UnlockMutex (GraphicsLock); xform_buf[0] = FadeAllToColor; TimeOut = XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2); if (DoProcessing) DoProcessing (TimeOut); if (GLOBAL (CurrentActivity) & CHECK_ABORT) { return; } /* There was a forcible setting of CHECK_ABORT here. I cannot * find any purpose for this that DoRestart doesn't handle * better (forcing all other threads but this one to quit out, * I believe), and have thus removed it. It was interfering * with the proper operation of the quit operation. * --Michael */ TimeOut += ONE_SECOND * 3; while (!(InputState = AnyButtonPress (FALSE)) && (GetTimeCounter () <= TimeOut) && !(GLOBAL (CurrentActivity) & CHECK_ABORT)) { TaskSwitch (); } if (GLOBAL (CurrentActivity) & CHECK_ABORT) { return; } GLOBAL (CurrentActivity) &= ~CHECK_ABORT; /* You can't try to quit during a fade to black, because if * you try, the confirmation window will fade to black too. * Fixing this will require a rewrite of our whole rendering * engine. -- Michael */ xform_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2)); }
static void DoMelnormeHate (RESPONSE_REF R) { BYTE hate_count; (void) R; // ignored hate_count = GET_GAME_STATE (MELNORME_HATE_COUNT); switch (hate_count++) { case 0: NPCPhrase (HELLO_HATE_YOU_1); break; case 1: NPCPhrase (HELLO_HATE_YOU_2); break; default: --hate_count; NPCPhrase (HELLO_HATE_YOU_3); break; } SET_GAME_STATE (MELNORME_HATE_COUNT, hate_count); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 2) ), ONE_SECOND / 2); Response (well_if_thats_the_way_you_feel, ExitConversation); Response (you_hate_us_so_we_go_away, ExitConversation); }
static void GiveRadios (RESPONSE_REF R) { if (PLAYER_SAID (R, we_will_transfer_now)) { SET_GAME_STATE (RADIOACTIVES_PROVIDED, 1); NPCPhrase (FUEL_UP0); NPCPhrase (FUEL_UP1); AlienTalkSegue (1); LockMutex (GraphicsLock); //CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED; // JMS UnlockMutex (GraphicsLock); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 0) ), ONE_SECOND / 2); AlienTalkSegue ((COUNT)~0); RevealSelf (0); } else { if (PLAYER_SAID (R, what_will_you_give_us)) NPCPhrase (MESSAGE_GARBLED_1); else if (PLAYER_SAID (R, before_radios_we_need_info)) NPCPhrase (MESSAGE_GARBLED_2); Response (we_will_transfer_now, GiveRadios); Response (what_will_you_give_us, GiveRadios); Response (before_radios_we_need_info, GiveRadios); } }
static BOOLEAN TryStartGame (void) { MENU_STATE MenuState; LastActivity = GLOBAL (CurrentActivity); GLOBAL (CurrentActivity) = 0; memset (&MenuState, 0, sizeof (MenuState)); MenuState.InputFunc = DoRestart; while (!RestartMenu (&MenuState)) { // spin until a game is started or loaded if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE && !(GLOBAL (CurrentActivity) & CHECK_ABORT)) { FreeGameData (); Melee (); MenuState.Initialized = FALSE; } else if (GLOBAL (CurrentActivity) == (ACTIVITY)~0) { // timed out BYTE black_buf[] = {FadeAllToBlack}; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, ONE_SECOND / 2)); return (FALSE); } else if (GLOBAL (CurrentActivity) & CHECK_ABORT) { // quit return (FALSE); } } return TRUE; }
void Victory (void) { BYTE xform_buf[1]; xform_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2)); /* by default we do 3DO cinematics; or PC slides when 3DO files are * not present */ if (optWhichIntro == OPT_PC || !DoFMV ("slides/ending/victory.duk", NULL, TRUE)) ShowPresentation ( CaptureStringTable ( LoadStringTable (FINALPRES_STRTAB))); xform_buf[0] = FadeAllToBlack; XFormColorMap ((COLORMAPPTR)xform_buf, 0); }
static void DoMelnormePissed (RESPONSE_REF R) { if (R == 0) { BYTE pissed_count; pissed_count = GET_GAME_STATE (MELNORME_PISSED_COUNT); switch (pissed_count++) { case 0: NPCPhrase (HELLO_PISSED_OFF_1); break; case 1: NPCPhrase (HELLO_PISSED_OFF_2); break; default: --pissed_count; NPCPhrase (HELLO_PISSED_OFF_3); break; } SET_GAME_STATE (MELNORME_PISSED_COUNT, pissed_count); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 2) ), ONE_SECOND / 2); } else if (PLAYER_SAID (R, beg_forgiveness)) { SET_GAME_STATE (MELNORME_YACK_STACK4, 1); NPCPhrase (LOTS_TO_MAKE_UP_FOR); } else if (PLAYER_SAID (R, you_are_so_right)) { SET_GAME_STATE (MELNORME_YACK_STACK4, 2); NPCPhrase (ONE_LAST_CHANCE); } switch (GET_GAME_STATE (MELNORME_YACK_STACK4)) { case 0: Response (beg_forgiveness, DoMelnormePissed); break; case 1: Response (you_are_so_right, DoMelnormePissed); break; case 2: Response (ok_strip_me, ExitConversation); break; } Response (fight_some_more, ExitConversation); Response (bye_melnorme_pissed_off, ExitConversation); }
void DoShipSpin (COUNT index, MUSIC_REF hMusic) { #ifdef WANT_SHIP_SPINS char buf[30]; BYTE clut_buf[1]; RECT old_r, r; SetGraphicUseOtherExtra (1); LoadIntoExtraScreen (0); clut_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4)); FlushColorXForms (); if (hMusic) StopMusic (); FreeHyperData (); sprintf (buf, "ship%02d", index); DoFMV (buf, "spin", FALSE); GetContextClipRect (&old_r); r.corner.x = r.corner.y = 0; r.extent.width = SCREEN_WIDTH; r.extent.height = SCREEN_HEIGHT; SetContextClipRect (&r); DrawFromExtraScreen (0); SetGraphicUseOtherExtra (0); SetContextClipRect (&old_r); if (hMusic) PlayMusic (hMusic, TRUE, 1); clut_buf[0] = FadeAllToColor; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4)); FlushColorXForms (); #else (void) index; /* Satisfy compiler */ (void) hMusic; /* Satisfy compiler */ #endif /* WANT_SHIP_SPINS */ }
static void GiveRadios (RESPONSE_REF R) { if (PLAYER_SAID (R, we_will_transfer_now)) { SET_GAME_STATE (RADIOACTIVES_PROVIDED, 1); NPCPhrase (FUEL_UP0); NPCPhrase (FUEL_UP1); AlienTalkSegue (1); // JMS_GFX: Disable noisy static animation in hi-res. if (RESOLUTION_FACTOR > 0) { CommData.AlienTalkDesc.AnimFlags &= ~PAUSE_TALKING; CommData.AlienAmbientArray[0].AnimFlags &= ~ANIM_DISABLED; CommData.AlienAmbientArray[1].AnimFlags &= ~ANIM_DISABLED; CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED; } // End color transform anim in lo-res. else CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED; XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 0) ), ONE_SECOND / 2); AlienTalkSegue ((COUNT)~0); RevealSelf (0); } else { if (PLAYER_SAID (R, what_will_you_give_us)) NPCPhrase (MESSAGE_GARBLED_1); else if (PLAYER_SAID (R, before_radios_we_need_info)) NPCPhrase (MESSAGE_GARBLED_2); Response (we_will_transfer_now, GiveRadios); Response (what_will_you_give_us, GiveRadios); Response (before_radios_we_need_info, GiveRadios); } }
static void Foreplay (RESPONSE_REF R) { if (PLAYER_SAID (R, whats_my_reward) || PLAYER_SAID (R, what_about_us)) { if (PLAYER_SAID (R, whats_my_reward)) NPCPhrase (HERES_REWARD); else NPCPhrase (ABOUT_US); NPCPhrase (MORE_COMFORTABLE); AlienTalkSegue (1); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 1) ), ONE_SECOND); AlienTalkSegue ((COUNT)~0); SET_GAME_STATE (PLAYER_HAVING_SEX, 1); } else if (PLAYER_SAID (R, why_lights_off)) { NPCPhrase (LIGHTS_OFF_BECAUSE); DISABLE_PHRASE (why_lights_off); } else if (PLAYER_SAID (R, evil_monster)) { NPCPhrase (NOT_EVIL_MONSTER); DISABLE_PHRASE (evil_monster); } if (PHRASE_ENABLED (why_lights_off)) Response (why_lights_off, Foreplay); else if (PHRASE_ENABLED (evil_monster)) Response (evil_monster, Foreplay); else Response (disease, Sex); Response (in_the_spirit, Sex); Response (what_in_mind, Sex); Response (hands_off, FriendlyExit); }
static void ProcessColormapAnims (SEQUENCE *pSeq, COUNT Num) { COUNT i; for (i = 0; i < Num; ++i, ++pSeq) { ANIMATION_DESC *ADPtr = pSeq->ADPtr; if ((ADPtr->AnimFlags & ANIM_DISABLED) || pSeq->AnimType != COLOR_ANIM || !pSeq->Change) continue; XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, ADPtr->StartIndex + pSeq->CurIndex)), pSeq->Alarm - 1); pSeq->Change = FALSE; } }
static void FriendlyExit (RESPONSE_REF R) { SET_GAME_STATE (BATTLE_SEGUE, 0); if (PLAYER_SAID (R, bye)) NPCPhrase (GOODBYE); else if (PLAYER_SAID (R, im_on_my_way) || PLAYER_SAID (R, doing_this_for_you) || PLAYER_SAID (R, if_i_die)) NPCPhrase (GOOD_LUCK); else if (PLAYER_SAID (R, bye_before_vault)) NPCPhrase (GOODBYE_BEFORE_VAULT); else if (PLAYER_SAID (R, bye_after_vault)) NPCPhrase (GOODBYE_AFTER_VAULT); else if (PLAYER_SAID (R, bye_before_ambush)) NPCPhrase (GOODBYE_BEFORE_AMBUSH); else if (PLAYER_SAID (R, bye_after_ambush)) NPCPhrase (GOODBYE_AFTER_AMBUSH); else { if (PLAYER_SAID (R, hands_off)) NPCPhrase (OK_WONT_USE_HANDS); else if (PLAYER_SAID (R, not_much_more_to_say)) NPCPhrase (THEN_STOP_TALKING); NPCPhrase (LATER); NPCPhrase (SEX_GOODBYE); AlienTalkSegue (2); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 0) ), ONE_SECOND / 2); AlienTalkSegue ((COUNT)~0); SET_GAME_STATE (PLAYER_HAD_SEX, 1); SET_GAME_STATE (PLAYER_HAVING_SEX, 0); } }
static void SpathiCouncil (RESPONSE_REF R) { if (R == 0) NPCPhrase (HELLO_AGAIN); else if (PLAYER_SAID (R, good_password)) { NPCPhrase (YES_GOOD_PASSWORD); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 1) ), ONE_SECOND / 4); SET_GAME_STATE (KNOW_SPATHI_PASSWORD, 1); SET_GAME_STATE (SPATHI_HOME_VISITS, 0); } else if (PLAYER_SAID (R, we_come_in_peace)) { NPCPhrase (KILLED_SPATHI); DISABLE_PHRASE (we_come_in_peace); } else if (PLAYER_SAID (R, spathi_on_pluto)) { NPCPhrase (WHERE_SPATHI); DISABLE_PHRASE (spathi_on_pluto); } else if (PLAYER_SAID (R, hostage)) { NPCPhrase (GUN_TO_HEAD); SET_GAME_STATE (FOUND_PLUTO_SPATHI, 3); DISABLE_PHRASE (hostage); } else if (PLAYER_SAID (R, killed_fwiffo)) { NPCPhrase (POOR_FWIFFO); SET_GAME_STATE (FOUND_PLUTO_SPATHI, 3); DISABLE_PHRASE (killed_fwiffo); } else if (PLAYER_SAID (R, fwiffo_fine)) { NPCPhrase (NOT_LIKELY); R = killed_fwiffo; DISABLE_PHRASE (fwiffo_fine); } else if (PLAYER_SAID (R, surrender)) { NPCPhrase (NO_SURRENDER); DISABLE_PHRASE (surrender); } if (GET_GAME_STATE (SPATHI_MANNER) == 0) { Response (we_come_in_peace, AllianceOffer); } else if (PHRASE_ENABLED (we_come_in_peace)) { Response (we_come_in_peace, SpathiCouncil); } else { Response (misunderstanding, AllianceOffer); } if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) && GET_GAME_STATE (FOUND_PLUTO_SPATHI) < 3) { if (PHRASE_ENABLED (spathi_on_pluto)) Response (spathi_on_pluto, SpathiCouncil); else if (ActivateStarShip (SPATHI_SHIP, ESCORTING_FLAGSHIP)) { if (PHRASE_ENABLED (hostage)) Response (hostage, SpathiCouncil); } else if (PHRASE_ENABLED (killed_fwiffo)) { Response (killed_fwiffo, SpathiCouncil); if (PHRASE_ENABLED (fwiffo_fine)) Response (fwiffo_fine, SpathiCouncil); } } if (PHRASE_ENABLED (surrender)) Response (surrender, SpathiCouncil); else { Response (surrender_or_die, ExitConversation); } Response (bye_no_ally_offer, ExitConversation); }
static void ExitConversation (RESPONSE_REF R) { setSegue (Segue_peace); if (PLAYER_SAID (R, bye_ally)) NPCPhrase (GOODBYE_ALLY); else if (PLAYER_SAID (R, bye_neutral)) NPCPhrase (GOODBYE_NEUTRAL); else if (PLAYER_SAID (R, bye_angry)) NPCPhrase (GOODBYE_ANGRY); else if (PLAYER_SAID (R, bye_taalo)) { if (GET_GAME_STATE (ORZ_MANNER) == 1) NPCPhrase (ANGRY_TAALO_GOODBYE); else NPCPhrase (FRIENDLY_TAALO_GOODBYE); } else if (PLAYER_SAID (R, hostile_2)) { NPCPhrase (HOSTILITY_IS_BAD_2); setSegue (Segue_hostile); } else if (PLAYER_SAID (R, may_we_land)) { NPCPhrase (SURE_LAND); SET_GAME_STATE (TAALO_UNPROTECTED, 1); } else if (PLAYER_SAID (R, yes_alliance) || PLAYER_SAID (R, were_sorry)) { if (PLAYER_SAID (R, yes_alliance)) NPCPhrase (GREAT); else NPCPhrase (APOLOGY_ACCEPTED); SET_GAME_STATE (ORZ_ANDRO_STATE, 0); SET_GAME_STATE (ORZ_GENERAL_INFO, 0); SET_GAME_STATE (ORZ_PERSONAL_INFO, 0); SET_GAME_STATE (ORZ_MANNER, 3); SetRaceAllied (ORZ_SHIP, TRUE); } else if (PLAYER_SAID (R, demand_to_land)) { NPCPhrase (NO_DEMAND); setSegue (Segue_hostile); } else if (PLAYER_SAID (R, about_andro_3) || PLAYER_SAID (R, must_know_about_androsyn)) { if (PLAYER_SAID (R, about_andro_3)) NPCPhrase (BLEW_IT); else NPCPhrase (KNOW_TOO_MUCH); SET_GAME_STATE (ORZ_VISITS, 0); SET_GAME_STATE (ORZ_MANNER, 2); setSegue (Segue_hostile); if (PLAYER_SAID (R, about_andro_3)) { SetRaceAllied (ORZ_SHIP, FALSE); RemoveEscortShips (ORZ_SHIP); } XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 1) ), ONE_SECOND / 2); } else /* insults */ { BYTE NumVisits; NumVisits = GET_GAME_STATE (ORZ_PERSONAL_INFO); switch (NumVisits++) { case 0: NPCPhrase (INSULTED_1); break; case 1: NPCPhrase (INSULTED_2); break; case 2: NPCPhrase (INSULTED_3); setSegue (Segue_hostile); break; case 7: --NumVisits; default: NPCPhrase (INSULTED_4); setSegue (Segue_hostile); break; } SET_GAME_STATE (ORZ_PERSONAL_INFO, NumVisits); } }
static void DoMelnormeMiffed (RESPONSE_REF R) { if (R == 0) { BYTE miffed_count; miffed_count = GET_GAME_STATE (MELNORME_MIFFED_COUNT); switch (miffed_count++) { case 0: NPCPhrase (HELLO_SLIGHTLY_ANGRY_1); break; case 1: NPCPhrase (HELLO_SLIGHTLY_ANGRY_2); break; default: --miffed_count; NPCPhrase (HELLO_SLIGHTLY_ANGRY_3); break; } SET_GAME_STATE (MELNORME_MIFFED_COUNT, miffed_count); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 2) ), ONE_SECOND / 2); } else if (PLAYER_SAID (R, explore_relationship)) { SET_GAME_STATE (MELNORME_YACK_STACK3, 1); NPCPhrase (EXAMPLE_OF_RELATIONSHIP); } else if (PLAYER_SAID (R, excuse_1)) { SET_GAME_STATE (MELNORME_YACK_STACK3, 2); NPCPhrase (NO_EXCUSE_1); } else if (PLAYER_SAID (R, excuse_2)) { SET_GAME_STATE (MELNORME_YACK_STACK3, 3); NPCPhrase (NO_EXCUSE_2); } else if (PLAYER_SAID (R, excuse_3)) { SET_GAME_STATE (MELNORME_YACK_STACK3, 4); NPCPhrase (NO_EXCUSE_3); } switch (GET_GAME_STATE (MELNORME_YACK_STACK3)) { case 0: Response (explore_relationship, DoMelnormeMiffed); break; case 1: Response (excuse_1, DoMelnormeMiffed); break; case 2: Response (excuse_2, DoMelnormeMiffed); break; case 3: Response (excuse_3, DoMelnormeMiffed); break; } Response (we_apologize, DoFirstMeeting); Response (so_we_can_attack, ExitConversation); Response (bye_melnorme_slightly_angry, ExitConversation); }
static void DoFirstMeeting (RESPONSE_REF R) { BYTE last_stack = 0; PVOIDFUNC temp_func, stack_func[] = { yack0_respond, yack1_respond, yack2_respond, }; if (R == 0) { BYTE business_count; business_count = GET_GAME_STATE (MELNORME_BUSINESS_COUNT); switch (business_count++) { case 0: NPCPhrase (HELLO_NOW_DOWN_TO_BUSINESS_1); break; case 1: NPCPhrase (HELLO_NOW_DOWN_TO_BUSINESS_2); break; case 2: NPCPhrase (HELLO_NOW_DOWN_TO_BUSINESS_3); --business_count; break; } SET_GAME_STATE (MELNORME_BUSINESS_COUNT, business_count); } else if (PLAYER_SAID (R, we_are_from_alliance0)) { SET_GAME_STATE (MELNORME_YACK_STACK0, 1); NPCPhrase (KNOW_OF_YOU); } else if (PLAYER_SAID (R, how_know)) { SET_GAME_STATE (MELNORME_YACK_STACK0, 2); NPCPhrase (KNOW_BECAUSE); } else if (PLAYER_SAID (R, what_about_yourselves)) { last_stack = 1; SET_GAME_STATE (MELNORME_YACK_STACK1, 1); NPCPhrase (NO_TALK_ABOUT_OURSELVES); } else if (PLAYER_SAID (R, what_factors)) { last_stack = 1; SET_GAME_STATE (MELNORME_YACK_STACK1, 2); NPCPhrase (FACTORS_ARE); } else if (PLAYER_SAID (R, what_about_universe)) { last_stack = 2; SET_GAME_STATE (MELNORME_YACK_STACK2, 1); NPCPhrase (NO_FREE_LUNCH); } else if (PLAYER_SAID (R, giving_is_good_1)) { last_stack = 2; SET_GAME_STATE (MELNORME_YACK_STACK2, 2); NPCPhrase (GIVING_IS_BAD_1); } else if (PLAYER_SAID (R, giving_is_good_2)) { last_stack = 2; SET_GAME_STATE (MELNORME_YACK_STACK2, 3); NPCPhrase (GIVING_IS_BAD_2); } else if (PLAYER_SAID (R, yes_really_testing)) { XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 0) ), ONE_SECOND / 2); NPCPhrase (TEST_RESULTS); } else if (PLAYER_SAID (R, we_apologize)) { SET_GAME_STATE (MELNORME_ANGER, 0); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 0) ), ONE_SECOND / 2); NPCPhrase (APOLOGY_ACCEPTED); } temp_func = stack_func[0]; stack_func[0] = stack_func[last_stack]; stack_func[last_stack] = temp_func; (*stack_func[0]) (); (*stack_func[1]) (); (*stack_func[2]) (); Response (no_trade_now, ExitConversation); }
static void DoBluster (RESPONSE_REF R) { if (PLAYER_SAID (R, trade_is_for_the_weak)) { XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 2) ), ONE_SECOND / 2); SET_GAME_STATE (MELNORME_YACK_STACK2, 4); NPCPhrase (WERE_NOT_AFRAID); } else if (PLAYER_SAID (R, why_blue_light)) { SET_GAME_STATE (WHY_MELNORME_BLUE, 1); NPCPhrase (BLUE_IS_MAD); } else if (PLAYER_SAID (R, we_strong_1)) { local_stack0 = 1; NPCPhrase (YOU_NOT_STRONG_1); } else if (PLAYER_SAID (R, we_strong_2)) { local_stack0 = 2; NPCPhrase (YOU_NOT_STRONG_2); } else if (PLAYER_SAID (R, we_strong_3)) { local_stack0 = 3; NPCPhrase (YOU_NOT_STRONG_3); } else if (PLAYER_SAID (R, just_testing)) { local_stack1 = 1; NPCPhrase (REALLY_TESTING); } if (!GET_GAME_STATE (WHY_MELNORME_BLUE)) Response (why_blue_light, DoBluster); switch (local_stack0) { case 0: Response (we_strong_1, DoBluster); break; case 1: Response (we_strong_2, DoBluster); break; case 2: Response (we_strong_3, DoBluster); break; } switch (local_stack1) { case 0: Response (just_testing, DoBluster); break; case 1: { Response (yes_really_testing, DoFirstMeeting); break; } } Response (youre_on, ExitConversation); }
static void NatureOfConversation (RESPONSE_REF R) { BYTE num_new_rainbows; UWORD rainbow_mask; COUNT Credit; if (PLAYER_SAID (R, get_on_with_business)) { SET_GAME_STATE (MELNORME_YACK_STACK2, 5); R = 0; } Credit = DeltaCredit (0); if (R == 0) { BYTE stack; stack = (BYTE)(GET_GAME_STATE (MELNORME_YACK_STACK2) - 5); switch (stack++) { case 0: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_1); break; case 1: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_2); break; case 2: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_3); break; case 3: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_4); break; case 4: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_5); break; case 5: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_6); break; case 6: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_7); break; case 7: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_8); break; case 8: NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_9); break; default: --stack; NPCPhrase (HELLO_AND_DOWN_TO_BUSINESS_10); break; } SET_GAME_STATE (MELNORME_YACK_STACK2, stack + 5); } rainbow_mask = MAKE_WORD ( GET_GAME_STATE (RAINBOW_WORLD0), GET_GAME_STATE (RAINBOW_WORLD1) ); num_new_rainbows = (BYTE)(-GET_GAME_STATE (MELNORME_RAINBOW_COUNT)); while (rainbow_mask) { if (rainbow_mask & 1) ++num_new_rainbows; rainbow_mask >>= 1; } if (GLOBAL_SIS (FuelOnBoard) > 0 || GLOBAL_SIS (TotalBioMass) || Credit || num_new_rainbows) { if (!GET_GAME_STATE (TRADED_WITH_MELNORME)) { SET_GAME_STATE (TRADED_WITH_MELNORME, 1); NPCPhrase (TRADING_INFO); } if (R == 0) { /* Melnorme reports any news and turns purple */ NPCPhrase (BUY_OR_SELL); AlienTalkSegue(1); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 1) ), ONE_SECOND / 2); AlienTalkSegue((COUNT)~0); } else if (PLAYER_SAID (R, why_turned_purple)) { SET_GAME_STATE (WHY_MELNORME_PURPLE, 1); NPCPhrase (TURNED_PURPLE_BECAUSE); } else if (PLAYER_SAID (R, done_selling)) { NPCPhrase (OK_DONE_SELLING); } else if (PLAYER_SAID (R, done_buying)) { NPCPhrase (OK_DONE_BUYING); } if (!GET_GAME_STATE (WHY_MELNORME_PURPLE)) { Response (why_turned_purple, NatureOfConversation); } if (!AskedToBuy) Response (buy, DoBuy); if (PHRASE_ENABLED (sell)) Response (sell, DoSell); Response (goodbye, ExitConversation); } else /* needs to be rescued */ { if (GET_GAME_STATE (MELNORME_RESCUE_REFUSED)) { NPCPhrase (CHANGED_MIND); Response (yes_changed_mind, DoRescue); Response (no_changed_mind, ExitConversation); } else { BYTE num_rescues; num_rescues = GET_GAME_STATE (MELNORME_RESCUE_COUNT); switch (num_rescues) { case 0: NPCPhrase (RESCUE_EXPLANATION); break; case 1: NPCPhrase (RESCUE_AGAIN_1); break; case 2: NPCPhrase (RESCUE_AGAIN_2); break; case 3: NPCPhrase (RESCUE_AGAIN_3); break; case 4: NPCPhrase (RESCUE_AGAIN_4); break; case 5: NPCPhrase (RESCUE_AGAIN_5); break; } if (num_rescues < 5) { ++num_rescues; SET_GAME_STATE (MELNORME_RESCUE_COUNT, num_rescues); } NPCPhrase (SHOULD_WE_HELP_YOU); Response (yes_help, DoRescue); Response (no_help, ExitConversation); } } }
static void AllianceOffer (RESPONSE_REF R) { if (PLAYER_SAID (R, misunderstanding)) { NPCPhrase (JUST_MISUNDERSTANDING); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 1) ), ONE_SECOND / 4); SET_GAME_STATE (SPATHI_MANNER, 3); SET_GAME_STATE (SPATHI_VISITS, 0); } else if (PLAYER_SAID (R, we_come_in_peace)) NPCPhrase (OF_COURSE); else if (PLAYER_SAID (R, hand_in_friendship)) { NPCPhrase (TOO_AFRAID); DISABLE_PHRASE (hand_in_friendship); } else if (PLAYER_SAID (R, stronger)) { NPCPhrase (YOURE_NOT); DISABLE_PHRASE (stronger); } else if (PLAYER_SAID (R, yes_we_are)) { NPCPhrase (NO_YOURE_NOT); DISABLE_PHRASE (yes_we_are); } else if (PLAYER_SAID (R, share_info)) { NPCPhrase (NO_INFO); DISABLE_PHRASE (share_info); } else if (PLAYER_SAID (R, give_us_resources)) { NPCPhrase (NO_RESOURCES); DISABLE_PHRASE (give_us_resources); } if (PHRASE_ENABLED (hand_in_friendship)) Response (hand_in_friendship, AllianceOffer); else if (PHRASE_ENABLED (stronger)) Response (stronger, AllianceOffer); else if (PHRASE_ENABLED (yes_we_are)) Response (yes_we_are, AllianceOffer); else { Response (how_prove, LearnQuest); } if (PHRASE_ENABLED (share_info)) Response (share_info, AllianceOffer); if (PHRASE_ENABLED (give_us_resources)) Response (give_us_resources, AllianceOffer); }
static BOOLEAN DoRestart (PMENU_STATE pMS) { static DWORD InTime; static DWORD InactTimeOut; /* Cancel any presses of the Pause key. */ GamePaused = FALSE; if (!pMS->Initialized) { if (pMS->hMusic) { StopMusic (); DestroyMusic (pMS->hMusic); pMS->hMusic = 0; } pMS->hMusic = LoadMusic (MAINMENU_MUSIC); InactTimeOut = (pMS->hMusic ? 120 : 20) * ONE_SECOND; PlayMusic (pMS->hMusic, TRUE, 1); DrawRestartMenu ((BYTE)~0, pMS->CurState, pMS->CurFrame); pMS->Initialized = TRUE; { BYTE clut_buf[] = {FadeAllToColor}; DWORD TimeOut = XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2); while ((GetTimeCounter () <= TimeOut) && !(GLOBAL (CurrentActivity) & CHECK_ABORT)) { UpdateInputState (); TaskSwitch (); } } } #ifdef TESTING else if (InputState & DEVICE_EXIT) return (FALSE); #endif /* TESTING */ else if (GLOBAL (CurrentActivity) & CHECK_ABORT) { return (FALSE); } else if (!(PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_DOWN] || PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT] || PulsedInputState.menu[KEY_MENU_SELECT] || MouseButtonDown)) { if (GetTimeCounter () - InTime < InactTimeOut) return (TRUE); SleepThreadUntil (FadeMusic (0, ONE_SECOND)); StopMusic (); FadeMusic (NORMAL_VOLUME, 0); GLOBAL (CurrentActivity) = (ACTIVITY)~0; return (FALSE); } else if (PulsedInputState.menu[KEY_MENU_SELECT]) { BYTE fade_buf[1]; switch (pMS->CurState) { case LOAD_SAVED_GAME: LastActivity = CHECK_LOAD; GLOBAL (CurrentActivity) = IN_INTERPLANETARY; break; case START_NEW_GAME: LastActivity = CHECK_LOAD | CHECK_RESTART; GLOBAL (CurrentActivity) = IN_INTERPLANETARY; break; case PLAY_SUPER_MELEE: GLOBAL (CurrentActivity) = SUPER_MELEE; break; case SETUP_GAME: LockMutex (GraphicsLock); SetFlashRect (NULL_PTR, (FRAME)0); UnlockMutex (GraphicsLock); SetupMenu (); SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); InTime = GetTimeCounter (); SetTransitionSource (NULL); BatchGraphics (); DrawRestartMenuGraphic (pMS); DrawRestartMenu ((BYTE)~0, pMS->CurState, pMS->CurFrame); ScreenTransition (3, NULL); UnbatchGraphics (); return TRUE; case QUIT_GAME: fade_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2)); GLOBAL (CurrentActivity) = CHECK_ABORT; break; } LockMutex (GraphicsLock); SetFlashRect (NULL_PTR, (FRAME)0); UnlockMutex (GraphicsLock); return (FALSE); } else { BYTE NewState; NewState = pMS->CurState; if (PulsedInputState.menu[KEY_MENU_UP]) { if (NewState-- == START_NEW_GAME) NewState = QUIT_GAME; } else if (PulsedInputState.menu[KEY_MENU_DOWN]) { if (NewState++ == QUIT_GAME) NewState = START_NEW_GAME; } if (NewState != pMS->CurState) { BatchGraphics (); DrawRestartMenu (pMS->CurState, NewState, pMS->CurFrame); UnbatchGraphics (); pMS->CurState = NewState; } } // if (MouseButtonDown) // { // LockMutex (GraphicsLock); // SetFlashRect (NULL_PTR, (FRAME)0); // UnlockMutex (GraphicsLock); // MouseError (); // SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); // SetTransitionSource (NULL); // BatchGraphics (); // DrawRestartMenuGraphic (pMS); // DrawRestartMenu ((BYTE)~0, pMS->CurState, pMS->CurFrame); // ScreenTransition (3, NULL); // UnbatchGraphics (); // } if (MouseButtonDown) { // TODO WTF FIX GAME CONTROLS } InTime = GetTimeCounter (); return (TRUE); }
static BOOLEAN RestartMenu (PMENU_STATE pMS) { DWORD TimeOut; BYTE black_buf[1]; ReinitQueue (&race_q[0]); ReinitQueue (&race_q[1]); black_buf[0] = FadeAllToBlack; SetContext (ScreenContext); GLOBAL (CurrentActivity) |= CHECK_ABORT; if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0 && GET_GAME_STATE (UTWIG_BOMB_ON_SHIP) && !GET_GAME_STATE (UTWIG_BOMB)) { // player blew himself up with Utwig bomb BYTE white_buf[] = {FadeAllToWhite}; SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0); SleepThreadUntil (XFormColorMap ((COLORMAPPTR)white_buf, ONE_SECOND / 8) + ONE_SECOND / 60); SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)); ClearDrawable (); FlushColorXForms (); TimeOut = ONE_SECOND / 8; } else { TimeOut = ONE_SECOND / 2; if (LOBYTE (LastActivity) == WON_LAST_BATTLE) { GLOBAL (CurrentActivity) = WON_LAST_BATTLE; Victory (); Credits (TRUE); FreeGameData (); TimeOut = ONE_SECOND / 2; GLOBAL (CurrentActivity) = CHECK_ABORT; } } LastActivity = NextActivity = 0; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, TimeOut)); if (TimeOut == ONE_SECOND / 8) SleepThread (ONE_SECOND * 3); DrawRestartMenuGraphic (pMS); FlushInput (); GLOBAL (CurrentActivity) &= ~CHECK_ABORT; SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); DoInput (pMS, TRUE); StopMusic (); if (pMS->hMusic) { DestroyMusic (pMS->hMusic); pMS->hMusic = 0; } LockMutex (GraphicsLock); SetFlashRect (NULL_PTR, (FRAME)0); UnlockMutex (GraphicsLock); DestroyDrawable (ReleaseDrawable (pMS->CurFrame)); if (GLOBAL (CurrentActivity) == (ACTIVITY)~0) return (FALSE); // timed out if (GLOBAL (CurrentActivity) & CHECK_ABORT) return (FALSE); // quit TimeOut = XFormColorMap ((COLORMAPPTR)black_buf, ONE_SECOND / 2); SleepThreadUntil (TimeOut); FlushColorXForms (); SeedRandomNumbers (); return (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE); }
static void NatureOfConversation (RESPONSE_REF R) { BYTE num_new_rainbows; UWORD rainbow_mask; COUNT Credit; if (PLAYER_SAID (R, get_on_with_business)) { SET_GAME_STATE (MELNORME_YACK_STACK2, 5); R = 0; } // Draw credits display DeltaCredit (0); Credit = GetAvailableCredits (); if (R == 0) { BYTE stack = GET_GAME_STATE (MELNORME_YACK_STACK2) - 5; NPCPhrase (GetLineSafe (hello_and_down_to_business_lines, stack)); if (stack < (NUM_HELLO_LINES - 1)) ++stack; SET_GAME_STATE (MELNORME_YACK_STACK2, stack + 5); } rainbow_mask = MAKE_WORD ( GET_GAME_STATE (RAINBOW_WORLD0), GET_GAME_STATE (RAINBOW_WORLD1) ); num_new_rainbows = (BYTE)(-GET_GAME_STATE (MELNORME_RAINBOW_COUNT)); while (rainbow_mask) { if (rainbow_mask & 1) ++num_new_rainbows; rainbow_mask >>= 1; } if (GLOBAL_SIS (FuelOnBoard) > 0 || GLOBAL_SIS (TotalBioMass) || Credit || num_new_rainbows) { if (!GET_GAME_STATE (TRADED_WITH_MELNORME)) { SET_GAME_STATE (TRADED_WITH_MELNORME, 1); NPCPhrase (TRADING_INFO); } if (R == 0) { /* Melnorme reports any news and turns purple */ NPCPhrase (BUY_OR_SELL); AlienTalkSegue (1); XFormColorMap (GetColorMapAddress ( SetAbsColorMapIndex (CommData.AlienColorMap, 1) ), ONE_SECOND / 2); AlienTalkSegue ((COUNT)~0); } else if (PLAYER_SAID (R, why_turned_purple)) { SET_GAME_STATE (WHY_MELNORME_PURPLE, 1); NPCPhrase (TURNED_PURPLE_BECAUSE); } else if (PLAYER_SAID (R, done_selling)) { NPCPhrase (OK_DONE_SELLING); } else if (PLAYER_SAID (R, done_buying)) { NPCPhrase (OK_DONE_BUYING); } if (!GET_GAME_STATE (WHY_MELNORME_PURPLE)) { Response (why_turned_purple, NatureOfConversation); } if (!AskedToBuy) Response (buy, DoBuy); if (PHRASE_ENABLED (sell)) Response (sell, DoSell); Response (goodbye, ExitConversation); } else /* needs to be rescued */ { if (GET_GAME_STATE (MELNORME_RESCUE_REFUSED)) { NPCPhrase (CHANGED_MIND); Response (yes_changed_mind, DoRescue); Response (no_changed_mind, ExitConversation); } else { BYTE num_rescues = GET_GAME_STATE (MELNORME_RESCUE_COUNT); NPCPhrase (GetLineSafe (rescue_lines, num_rescues)); if (num_rescues < NUM_RESCUE_LINES - 1) { ++num_rescues; SET_GAME_STATE (MELNORME_RESCUE_COUNT, num_rescues); } NPCPhrase (SHOULD_WE_HELP_YOU); Response (yes_help, DoRescue); Response (no_help, ExitConversation); } } }