static bool GenerateIlwrath_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if (matchWorld (solarSys, world, solarSys->SunDesc[0].PlanetByte, MATCH_PLANET)) { if (StartSphereTracking (ILWRATH_SHIP)) { NotifyOthers (ILWRATH_SHIP, IPNL_ALL_CLEAR); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); CloneShipFragment (ILWRATH_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); InitCommunication (ILWRATH_CONVERSATION); if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) { GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); } return true; } else { LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->PlanetSideFrame[1] = CaptureDrawable ( LoadGraphic (RUINS_MASK_PMAP_ANIM)); solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable (LoadStringTable (RUINS_STRTAB)); } } GenerateDefault_generateOrbital (solarSys, world); if (matchWorld (solarSys, world, solarSys->SunDesc[0].PlanetByte, MATCH_PLANET) && PrimeSeed) { solarSys->SysInfo.PlanetInfo.Weather = 2; solarSys->SysInfo.PlanetInfo.Tectonics = 3; } return true; }
static bool GenerateSupox_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if (matchWorld (solarSys, world, 0, MATCH_PLANET)) { if (StartSphereTracking (SUPOX_SHIP)) { NotifyOthers (SUPOX_SHIP, IPNL_ALL_CLEAR); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); CloneShipFragment (SUPOX_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); InitCommunication (SUPOX_CONVERSATION); if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) { GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); } return true; } else { LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->PlanetSideFrame[1] = CaptureDrawable (LoadGraphic (RUINS_MASK_PMAP_ANIM)); solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable (LoadStringTable (SUPOX_RUINS_STRTAB)); if (GET_GAME_STATE (ULTRON_CONDITION)) { // Already picked up the Ultron, skip the report solarSys->SysInfo.PlanetInfo.DiscoveryString = SetAbsStringTableIndex ( solarSys->SysInfo.PlanetInfo.DiscoveryString, 1); } } } GenerateDefault_generateOrbital (solarSys, world); return true; }
// Returns TRUE if the broadcaster has been successfully activated, // and FALSE otherwise. static BOOLEAN UseCaster (void) { if (inHQSpace ()) { if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1) { SET_GAME_STATE (USED_BROADCASTER, 1); return TRUE; } return FALSE; } if (LOBYTE (GLOBAL (CurrentActivity)) != IN_INTERPLANETARY || !playerInSolarSystem ()) return FALSE; if (playerInPlanetOrbit () && matchWorld (pSolarSysState, pSolarSysState->pOrbitalDesc, 1, MATCH_PLANET) && CurStarDescPtr->Index == CHMMR_DEFINED && !GET_GAME_STATE (CHMMR_UNLEASHED)) { // In orbit around the Chenjesu/Mmrnmhrm home planet. NextActivity |= CHECK_LOAD; /* fake a load game */ GLOBAL (CurrentActivity) |= START_ENCOUNTER; EncounterGroup = 0; PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); SaveSolarSysLocation (); return TRUE; } { BOOLEAN FoundIlwrath; HIPGROUP hGroup; FoundIlwrath = (CurStarDescPtr->Index == ILWRATH_DEFINED) && StartSphereTracking (ILWRATH_SHIP); // In the Ilwrath home system and they are alive? if (!FoundIlwrath && (hGroup = GetHeadLink (&GLOBAL (ip_group_q)))) { // Is an Ilwrath ship in the system? IP_GROUP *GroupPtr; GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup); FoundIlwrath = (GroupPtr->race_id == ILWRATH_SHIP); UnlockIpGroup (&GLOBAL (ip_group_q), hGroup); } if (FoundIlwrath) { NextActivity |= CHECK_LOAD; /* fake a load game */ GLOBAL (CurrentActivity) |= START_ENCOUNTER; EncounterGroup = 0; PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); if (CurStarDescPtr->Index == ILWRATH_DEFINED) { // Ilwrath home system. SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 4); } else { // Ilwrath ship. SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 5); } if (playerInPlanetOrbit ()) SaveSolarSysLocation (); return TRUE; } } return FALSE; }
static void NeutralUtwig (RESPONSE_REF R) { BYTE i, LastStack; RESPONSE_REF pStr[4]; LastStack = 0; pStr[0] = pStr[1] = pStr[2] = pStr[3] = 0; if (PLAYER_SAID (R, we_are_vindicator0)) { NPCPhrase (WOULD_BE_HAPPY_BUT); SET_GAME_STATE (UTWIG_STACK1, 1); } else if (PLAYER_SAID (R, why_sad)) { NPCPhrase (ULTRON_BROKE); SET_GAME_STATE (UTWIG_STACK1, 2); } else if (PLAYER_SAID (R, what_ultron)) { NPCPhrase (GLORIOUS_ULTRON); SET_GAME_STATE (UTWIG_STACK1, 3); } else if (PLAYER_SAID (R, dont_be_babies)) { NPCPhrase (MOCK_OUR_PAIN); setSegue (Segue_hostile); SET_GAME_STATE (UTWIG_STACK1, 4); SET_GAME_STATE (UTWIG_HOSTILE, 1); SET_GAME_STATE (UTWIG_INFO, 0); SET_GAME_STATE (UTWIG_HOME_VISITS, 0); SET_GAME_STATE (UTWIG_VISITS, 0); SET_GAME_STATE (BOMB_VISITS, 0); return; } else if (PLAYER_SAID (R, real_sorry_about_ultron)) { NPCPhrase (APPRECIATE_SYMPATHY); SET_GAME_STATE (UTWIG_STACK1, 4); return; } else if (PLAYER_SAID (R, what_about_you_1)) { NPCPhrase (ABOUT_US_1); LastStack = 2; SET_GAME_STATE (UTWIG_WAR_NEWS, 1); } else if (PLAYER_SAID (R, what_about_you_2)) { NPCPhrase (ABOUT_US_2); LastStack = 2; StartSphereTracking (SUPOX_SHIP); SET_GAME_STATE (UTWIG_WAR_NEWS, 2); } else if (PLAYER_SAID (R, what_about_you_3)) { NPCPhrase (ABOUT_US_3); SET_GAME_STATE (UTWIG_WAR_NEWS, 3); } else if (PLAYER_SAID (R, what_about_urquan_1)) { NPCPhrase (ABOUT_URQUAN_1); LastStack = 3; SET_GAME_STATE (UTWIG_STACK2, 1); } else if (PLAYER_SAID (R, what_about_urquan_2)) { NPCPhrase (ABOUT_URQUAN_2); SET_GAME_STATE (UTWIG_STACK2, 2); } switch (GET_GAME_STATE (UTWIG_STACK1)) { case 0: { UNICODE buf[ALLIANCE_NAME_BUFSIZE]; GetAllianceName (buf, name_1); construct_response ( shared_phrase_buf, we_are_vindicator0, GLOBAL_SIS (CommanderName), we_are_vindicator1, buf, we_are_vindicator2, (UNICODE*)NULL); } pStr[0] = we_are_vindicator0; break; case 1: pStr[0] = why_sad; break; case 2: pStr[0] = what_ultron; break; case 3: pStr[0] = dont_be_babies; pStr[1] = real_sorry_about_ultron; break; } switch (GET_GAME_STATE (UTWIG_WAR_NEWS)) { case 0: pStr[2] = what_about_you_1; break; case 1: pStr[2] = what_about_you_2; break; case 2: pStr[2] = what_about_you_3; break; } switch (GET_GAME_STATE (UTWIG_STACK2)) { case 0: pStr[2] = what_about_urquan_1; break; case 1: pStr[2] = what_about_urquan_2; break; } if (pStr[LastStack]) { if (pStr[LastStack] != we_are_vindicator0) Response (pStr[LastStack], NeutralUtwig); else DoResponsePhrase (pStr[LastStack], NeutralUtwig, shared_phrase_buf); } for (i = 0; i < 4; ++i) { if (i != LastStack && pStr[i]) { if (pStr[i] != we_are_vindicator0) Response (pStr[i], NeutralUtwig); else DoResponsePhrase (pStr[i], NeutralUtwig, shared_phrase_buf); } } if (GET_GAME_STATE (ULTRON_CONDITION)) Response (got_ultron, ExitConversation); Response (bye_neutral, ExitConversation); }
static bool GenerateSpathi_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { DWORD rand_val; if (matchWorld (solarSys, world, 0, 0)) { /* Spathiwa's moon */ if (!GET_GAME_STATE (SPATHI_SHIELDED_SELVES) && StartSphereTracking (SPATHI_SHIP)) { NotifyOthers (SPATHI_SHIP, IPNL_ALL_CLEAR); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); CloneShipFragment (SPATHI_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; InitCommunication (SPATHI_CONVERSATION); if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) { GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); } return true; } DoPlanetaryAnalysis (&solarSys->SysInfo, world); rand_val = RandomContext_GetSeed (SysGenRNG); solarSys->SysInfo.PlanetInfo.ScanSeed[BIOLOGICAL_SCAN] = rand_val; GenerateLifeForms (&solarSys->SysInfo, GENERATE_ALL, NULL); rand_val = RandomContext_GetSeed (SysGenRNG); solarSys->SysInfo.PlanetInfo.ScanSeed[MINERAL_SCAN] = rand_val; GenerateMineralDeposits (&solarSys->SysInfo, GENERATE_ALL, NULL); solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN] = rand_val; solarSys->SysInfo.PlanetInfo.Weather = 0; solarSys->SysInfo.PlanetInfo.Tectonics = 0; solarSys->SysInfo.PlanetInfo.SurfaceTemperature = 28; if (!GET_GAME_STATE (UMGAH_BROADCASTERS)) { LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->PlanetSideFrame[1] = CaptureDrawable (LoadGraphic (UMGAH_BCS_MASK_PMAP_ANIM)); solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable (LoadStringTable (UMGAH_BCS_STRTAB)); if (!GET_GAME_STATE (SPATHI_SHIELDED_SELVES)) { // The first report talks extensively about Spathi // slave-shielding selves. If they never did so, the report // makes no sense, so use an alternate. solarSys->SysInfo.PlanetInfo.DiscoveryString = SetAbsStringTableIndex ( solarSys->SysInfo.PlanetInfo.DiscoveryString, 1); } } LoadPlanet (NULL); return true; } else if (matchWorld (solarSys, world, 0, MATCH_PLANET)) { /* visiting Spathiwa */ DoPlanetaryAnalysis (&solarSys->SysInfo, world); rand_val = RandomContext_GetSeed (SysGenRNG); solarSys->SysInfo.PlanetInfo.ScanSeed[MINERAL_SCAN] = rand_val; GenerateMineralDeposits (&solarSys->SysInfo, GENERATE_ALL, NULL); rand_val = RandomContext_GetSeed (SysGenRNG); solarSys->SysInfo.PlanetInfo.ScanSeed[BIOLOGICAL_SCAN] = rand_val; solarSys->SysInfo.PlanetInfo.PlanetRadius = 120; solarSys->SysInfo.PlanetInfo.SurfaceGravity = CalcGravity (&solarSys->SysInfo.PlanetInfo); solarSys->SysInfo.PlanetInfo.Weather = 0; solarSys->SysInfo.PlanetInfo.Tectonics = 0; solarSys->SysInfo.PlanetInfo.SurfaceTemperature = 31; LoadPlanet (NULL); return true; } GenerateDefault_generateOrbital (solarSys, world); return true; }
static void NeutralSupox (RESPONSE_REF R) { BYTE i, LastStack, NumVisits; RESPONSE_REF pStr[3]; LastStack = 0; pStr[0] = pStr[1] = pStr[2] = 0; if (PLAYER_SAID (R, i_am)) { NPCPhrase (WE_ARE_SUPOX); SET_GAME_STATE (SUPOX_STACK1, 1); DISABLE_PHRASE (i_am); } else if (PLAYER_SAID (R, my_ship)) { NPCPhrase (OUR_SHIP); SET_GAME_STATE (SUPOX_STACK1, 2); DISABLE_PHRASE (my_ship); } else if (PLAYER_SAID (R, from_alliance)) { NPCPhrase (FROM_SUPOX); SET_GAME_STATE (SUPOX_STACK1, 3); DISABLE_PHRASE (from_alliance); } else if (PLAYER_SAID (R, are_you_copying)) { NPCPhrase (YEAH_SORRY); SET_GAME_STATE (SUPOX_STACK1, 4); } else if (PLAYER_SAID (R, why_copy)) { NPCPhrase (SYMBIOTS); SET_GAME_STATE (SUPOX_STACK1, 5); } else if (PLAYER_SAID (R, tell_us_of_your_species)) { NPCPhrase (OUR_SPECIES); LastStack = 1; SET_GAME_STATE (SUPOX_STACK2, 1); } else if (PLAYER_SAID (R, plants_arent_intelligent)) { NPCPhrase (PROVES_WERE_SPECIAL); SET_GAME_STATE (SUPOX_STACK2, 2); } else if (PLAYER_SAID (R, anyone_around_here)) { NPCPhrase (UTWIG_NEARBY); LastStack = 2; SET_GAME_STATE (SUPOX_WAR_NEWS, 1); StartSphereTracking (UTWIG_SHIP); } else if (PLAYER_SAID (R, what_relation_to_utwig)) { NPCPhrase (UTWIG_ALLIES); LastStack = 2; SET_GAME_STATE (SUPOX_WAR_NEWS, 1); } else if (PLAYER_SAID (R, whats_wrong_with_utwig)) { NPCPhrase (BROKE_ULTRON); LastStack = 2; SET_GAME_STATE (SUPOX_WAR_NEWS, 2); } else if (PLAYER_SAID (R, whats_ultron)) { NPCPhrase (TAKE_ULTRON); SET_GAME_STATE (SUPOX_WAR_NEWS, 0); SET_GAME_STATE (ULTRON_CONDITION, 1); Response (what_do_i_do_now, ExitConversation); Response (thanks_now_we_eat_you, ExitConversation); return; } else if (PLAYER_SAID (R, got_fixed_ultron)) { NPCPhrase (GOOD_GIVE_TO_UTWIG); SET_GAME_STATE (SUPOX_ULTRON_HELP, 1); } else if (PLAYER_SAID (R, look_i_repaired_lots)) { NPCPhrase (ALMOST_THERE); SET_GAME_STATE (SUPOX_ULTRON_HELP, 1); } else if (PLAYER_SAID (R, look_i_slightly_repaired)) { NPCPhrase (GREAT_DO_MORE); SET_GAME_STATE (SUPOX_ULTRON_HELP, 1); } else if (PLAYER_SAID (R, where_get_repairs)) { NPCPhrase (ANCIENT_RHYME); SET_GAME_STATE (SUPOX_ULTRON_HELP, 1); } switch (GET_GAME_STATE (SUPOX_STACK2)) { case 0: pStr[1] = tell_us_of_your_species; break; case 1: pStr[1] = plants_arent_intelligent; break; } switch (GET_GAME_STATE (SUPOX_STACK1)) { case 0: pStr[0] = i_am; pStr[1] = 0; break; case 1: pStr[0] = my_ship; pStr[1] = 0; break; case 2: pStr[0] = from_alliance; pStr[1] = 0; break; case 3: pStr[0] = are_you_copying; pStr[1] = 0; break; case 4: pStr[0] = why_copy; pStr[1] = 0; break; } NumVisits = GET_GAME_STATE (ULTRON_CONDITION); if (NumVisits == 0) { switch (GET_GAME_STATE (SUPOX_WAR_NEWS)) { case 0: if (GET_GAME_STATE (UTWIG_VISITS) || GET_GAME_STATE (UTWIG_HOME_VISITS) || GET_GAME_STATE (BOMB_VISITS)) pStr[2] = what_relation_to_utwig; else pStr[2] = anyone_around_here; break; case 1: pStr[2] = whats_wrong_with_utwig; break; case 2: pStr[2] = whats_ultron; break; } } if (pStr[LastStack]) Response (pStr[LastStack], NeutralSupox); for (i = 0; i < 3; ++i) { if (i != LastStack && pStr[i]) Response (pStr[i], NeutralSupox); } if (!GET_GAME_STATE (SUPOX_ULTRON_HELP)) { switch (NumVisits) { case 1: Response (where_get_repairs, NeutralSupox); break; case 2: Response (look_i_slightly_repaired, NeutralSupox); break; case 3: Response (look_i_repaired_lots, NeutralSupox); break; case 4: Response (got_fixed_ultron, NeutralSupox); break; } } Response (bye_neutral, ExitConversation); }
static bool GenerateSaMatra_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { /* Samatra */ if (matchWorld (solarSys, world, 4, 0)) { PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); if (!GET_GAME_STATE (URQUAN_MESSED_UP)) { CloneShipFragment (!GET_GAME_STATE (KOHR_AH_FRENZY) ? URQUAN_SHIP : BLACK_URQUAN_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); } else { #define URQUAN_REMNANTS 3 BYTE i; for (i = 0; i < URQUAN_REMNANTS; ++i) { CloneShipFragment (URQUAN_SHIP, &GLOBAL (npc_built_ship_q), 0); CloneShipFragment (BLACK_URQUAN_SHIP, &GLOBAL (npc_built_ship_q), 0); } } GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); SET_GAME_STATE (URQUAN_PROTECTING_SAMATRA, 1); InitCommunication (URQUAN_CONVERSATION); if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) { BOOLEAN UrquanSurvivors; UrquanSurvivors = GetHeadLink (&GLOBAL (npc_built_ship_q)) != 0; GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); if (UrquanSurvivors) { SET_GAME_STATE (URQUAN_PROTECTING_SAMATRA, 0); } else { EncounterGroup = 0; EncounterRace = -1; GLOBAL (CurrentActivity) = IN_LAST_BATTLE | START_ENCOUNTER; if (GET_GAME_STATE (YEHAT_CIVIL_WAR) && StartSphereTracking (YEHAT_SHIP) && EscortFeasibilityStudy (YEHAT_REBEL_SHIP)) InitCommunication (YEHAT_REBEL_CONVERSATION); } } return true; } GenerateDefault_generateOrbital (solarSys, world); return true; }