static bool GenerateZoqFotPik_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if (matchWorld (solarSys, world, 0, MATCH_PLANET)) { if (ActivateStarShip (ZOQFOTPIK_SHIP, SPHERE_TRACKING)) { PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); if (GET_GAME_STATE (ZOQFOT_DISTRESS)) { CloneShipFragment (BLACK_URQUAN_SHIP, &GLOBAL (npc_built_ship_q), 0); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); InitCommunication (BLACKURQ_CONVERSATION); if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) return true; if (GetHeadLink (&GLOBAL (npc_built_ship_q))) { GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); return true; } } CloneShipFragment (ZOQFOTPIK_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); InitCommunication (ZOQFOTPIK_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; } 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); return true; }
void CUserAddDlg::UpdateAuthorityList(CString strGroup) { char szIndex[5]; int nIndex = 0; USER_GROUP_INFO *pGroup = GetGroupInfo(strGroup.GetBuffer(0)); if ( pGroup ) { for ( int i = 0; i < pGroup->rigthNum; i ++ ) { CString strRigths("Authority."); strRigths += pGroup->rights[i]; sprintf(szIndex, "%d", i + 1); m_listAuthority.InsertItem(i,szIndex ); m_listAuthority.SetItemText(i, 1, _CS(strRigths) ); m_listAuthority.SetItemData(i, long(pGroup->rights[i]) ); m_listAuthority.SetCheck(i, true); } // sprintf(szIndex, "%d", pGroup->rigthNum ); // LVCOLUMN count; // count.cx = 50; // count.pszText = szIndex; // m_listAuthority.SetColumn(0, &count); } }
static bool GenerateSaMatra_reinitNpcs (SOLARSYS_STATE *solarSys) { BOOLEAN GuardEngaged; HIPGROUP hGroup; HIPGROUP hNextGroup; GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); EncounterGroup = 0; EncounterRace = -1; // Do not want guards to chase the player GuardEngaged = FALSE; for (hGroup = GetHeadLink (&GLOBAL (ip_group_q)); hGroup; hGroup = hNextGroup) { IP_GROUP *GroupPtr; GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup); hNextGroup = _GetSuccLink (GroupPtr); if (GET_GAME_STATE (URQUAN_MESSED_UP)) { GroupPtr->task &= REFORM_GROUP; GroupPtr->task |= FLEE | IGNORE_FLAGSHIP; GroupPtr->dest_loc = 0; } else if (GroupPtr->task & REFORM_GROUP) { // REFORM_GROUP was set in ipdisp.c:ip_group_collision // during a collision with the flagship. GroupPtr->task &= ~REFORM_GROUP; GroupPtr->group_counter = 0; GuardEngaged = TRUE; } UnlockIpGroup (&GLOBAL (ip_group_q), hGroup); } if (GuardEngaged) { COUNT angle; POINT org; org = planetOuterLocation (4); angle = ARCTAN (GLOBAL (ip_location.x) - org.x, GLOBAL (ip_location.y) - org.y); GLOBAL (ip_location.x) = org.x + COSINE (angle, 3000); GLOBAL (ip_location.y) = org.y + SINE (angle, 3000); XFormIPLoc (&GLOBAL (ip_location), &GLOBAL (ShipStamp.origin), TRUE); } (void) solarSys; return true; }
// Vista SDK - ListView_GetGroupState / LVM_GETGROUPSTATE BOOL CFeedIcoItemListCtrl::HasGroupState(int nGroupId, DWORD dwState) { LVGROUP lg = {0}; lg.cbSize = sizeof(lg); lg.mask = LVGF_STATE; lg.stateMask = dwState; if ( GetGroupInfo(nGroupId, (PLVGROUP)&lg) == -1) return FALSE; return lg.state == dwState; }
//------------------------------------------------------------------------ //! Checks whether a group has a certain state //! //! @param nGroupId ID of the group //! @param dwState Specifies the state to check //! @return The group has the state (true / false) //------------------------------------------------------------------------ BOOL CGridListCtrlGroups::HasGroupState(int nGroupId, DWORD dwState) { // Vista SDK - ListView_GetGroupState / LVM_GETGROUPSTATE LVGROUP lg = {0}; lg.cbSize = sizeof(lg); lg.mask = LVGF_STATE; lg.stateMask = dwState; if ( GetGroupInfo(nGroupId, (PLVGROUP)&lg) == -1) return FALSE; return lg.state==dwState; }
static void init_probe (void) { BYTE b0, b1, b2, b3; HSTARSHIP hStarShip; b0 = GET_GAME_STATE (URQUAN_PROBE_GRPOFFS0); b1 = GET_GAME_STATE (URQUAN_PROBE_GRPOFFS1); b2 = GET_GAME_STATE (URQUAN_PROBE_GRPOFFS2); b3 = GET_GAME_STATE (URQUAN_PROBE_GRPOFFS3); GLOBAL (BattleGroupRef) = MAKE_DWORD ( MAKE_WORD (b0, b1), MAKE_WORD (b2, b3) ); if (GLOBAL (BattleGroupRef) == 0) { CloneShipFragment (URQUAN_PROBE_SHIP, &GLOBAL (npc_built_ship_q), 0); GLOBAL (BattleGroupRef) = PutGroupInfo (~0L, 1); b0 = LOBYTE (LOWORD (GLOBAL (BattleGroupRef))); b1 = HIBYTE (LOWORD (GLOBAL (BattleGroupRef))); b2 = LOBYTE (HIWORD (GLOBAL (BattleGroupRef))); b3 = HIBYTE (HIWORD (GLOBAL (BattleGroupRef))); SET_GAME_STATE (URQUAN_PROBE_GRPOFFS0, b0); SET_GAME_STATE (URQUAN_PROBE_GRPOFFS1, b1); SET_GAME_STATE (URQUAN_PROBE_GRPOFFS2, b2); SET_GAME_STATE (URQUAN_PROBE_GRPOFFS3, b3); } if (!GET_GAME_STATE (PROBE_MESSAGE_DELIVERED) && GetGroupInfo (GLOBAL (BattleGroupRef), (BYTE)~0) && (hStarShip = GetHeadLink ( &GLOBAL (npc_built_ship_q) ))) { SHIP_FRAGMENTPTR FragPtr; FragPtr = (SHIP_FRAGMENTPTR)LockStarShip ( &GLOBAL (npc_built_ship_q), hStarShip ); SET_GROUP_MISSION (FragPtr, IN_ORBIT); SET_GROUP_LOC (FragPtr, 2 + 1); /* orbitting earth */ SET_GROUP_DEST (FragPtr, 2 + 1); /* orbitting earth */ FragPtr->ShipInfo.loc.x = FragPtr->ShipInfo.loc.y = 0; FragPtr->ShipInfo.group_counter = 0; UnlockStarShip ( &GLOBAL (npc_built_ship_q), hStarShip ); } }
CString CFeedIcoItemListCtrl::GetGroupCaption(int nGroupId) { LVGROUP lg = {0}; lg.cbSize = sizeof(lg); lg.iGroupId = nGroupId; lg.mask = LVGF_HEADER | LVGF_GROUPID; VERIFY( GetGroupInfo(nGroupId, (PLVGROUP)&lg) != -1 ); #ifdef UNICODE return lg.pszHeader; #else CComBSTR header( lg.pszHeader ); return (LPCTSTR)COLE2T(header); #endif }
static bool GenerateIlwrath_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if (matchWorld (solarSys, world, 0, MATCH_PLANET)) { if (ActivateStarShip (ILWRATH_SHIP, SPHERE_TRACKING)) { 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, 0, MATCH_PLANET)) { 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; }
static bool GeneratePkunk_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if (matchWorld (solarSys, world, 0, MATCH_PLANET)) { // JMS: No ships orbit Pkunk homeworld anymore. //if (ActivateStarShip (PKUNK_SHIP, SPHERE_TRACKING)) if (0) { NotifyOthers (PKUNK_SHIP, IPNL_ALL_CLEAR); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); CloneShipFragment (PKUNK_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); InitCommunication (PKUNK_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 (PKUNK_RUINS_STRTAB)); // JMS: No more clear spindles! //if (GET_GAME_STATE (CLEAR_SPINDLE)) solarSys->SysInfo.PlanetInfo.DiscoveryString = SetAbsStringTableIndex ( solarSys->SysInfo.PlanetInfo.DiscoveryString, 1); } } GenerateDefault_generateOrbital (solarSys, world); return true; }
//------------------------------------------------------------------------ //! Retrieves the group header title of a group //! //! @param nGroupId ID of the group //! @return Group header title //------------------------------------------------------------------------ CString CGridListCtrlGroups::GetGroupHeader(int nGroupId) { LVGROUP lg = {0}; lg.cbSize = sizeof(lg); lg.iGroupId = nGroupId; lg.mask = LVGF_HEADER | LVGF_GROUPID; VERIFY( GetGroupInfo(nGroupId, (PLVGROUP)&lg) != -1 ); #ifdef UNICODE return lg.pszHeader; #elif _MSC_VER >= 1300 CComBSTR header( lg.pszHeader ); return (LPCTSTR)COLE2T(header); #else USES_CONVERSION; return W2A(lg.pszHeader); #endif }
static bool GenerateVux_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if ((matchWorld (solarSys, world, 0, MATCH_PLANET) && (CurStarDescPtr->Index == VUX_DEFINED || (CurStarDescPtr->Index == MAIDENS_DEFINED && !GET_GAME_STATE (ZEX_IS_DEAD)))) && ActivateStarShip (VUX_SHIP, SPHERE_TRACKING)) { NotifyOthers (VUX_SHIP, IPNL_ALL_CLEAR); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); CloneShipFragment (VUX_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); if (CurStarDescPtr->Index == VUX_DEFINED) { SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); } else { SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6); } GLOBAL (CurrentActivity) |= START_INTERPLANETARY; InitCommunication (VUX_CONVERSATION); if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) return true; { GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); if (CurStarDescPtr->Index == VUX_DEFINED || !GET_GAME_STATE (ZEX_IS_DEAD)) return true; LockMutex (GraphicsLock); RepairSISBorder (); UnlockMutex (GraphicsLock); } } if (matchWorld (solarSys, world, 0, MATCH_PLANET)) { if (CurStarDescPtr->Index == MAIDENS_DEFINED) { if (!GET_GAME_STATE (SHOFIXTI_MAIDENS)) { LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->PlanetSideFrame[1] = CaptureDrawable ( LoadGraphic (MAIDENS_MASK_PMAP_ANIM)); solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable ( LoadStringTable (MAIDENS_STRTAB)); } } else if (CurStarDescPtr->Index == VUX_BEAST_DEFINED) { if (!GET_GAME_STATE (VUX_BEAST)) { LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->PlanetSideFrame[1] = 0; solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable ( LoadStringTable (BEAST_STRTAB)); } } 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, 0, MATCH_PLANET)) { solarSys->SysInfo.PlanetInfo.Weather = 2; solarSys->SysInfo.PlanetInfo.Tectonics = 0; } return true; }
static bool GenerateChmmr_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if (matchWorld (solarSys, world, 1, MATCH_PLANET)) { if (GET_GAME_STATE (CHMMR_UNLEASHED)) { SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); InitCommunication (CHMMR_CONVERSATION); if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2) { GLOBAL (CurrentActivity) |= END_INTERPLANETARY; } return true; } else if (GET_GAME_STATE (SUN_DEVICE_ON_SHIP) && !GET_GAME_STATE (ILWRATH_DECEIVED) && ActivateStarShip (ILWRATH_SHIP, SPHERE_TRACKING)) { 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); SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; 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 if (matchWorld (solarSys, world, 1, 0)) { /* Starbase */ LockMutex (GraphicsLock); LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable (LoadStringTable (CHMMR_BASE_STRTAB)); DoDiscoveryReport (MenuSounds); DestroyStringTable (ReleaseStringTable ( solarSys->SysInfo.PlanetInfo.DiscoveryString)); solarSys->SysInfo.PlanetInfo.DiscoveryString = 0; FreeLanderFont (&solarSys->SysInfo.PlanetInfo); UnlockMutex (GraphicsLock); return true; } GenerateDefault_generateOrbital (solarSys, world); return true; }
static bool GenerateUtwig_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if ((CurStarDescPtr->Index == UTWIG_DEFINED && matchWorld (solarSys, world, 0, MATCH_PLANET)) || (CurStarDescPtr->Index == BOMB_DEFINED && matchWorld (solarSys, world, 5, 1) && !GET_GAME_STATE (UTWIG_BOMB))) { if ((CurStarDescPtr->Index == UTWIG_DEFINED || !GET_GAME_STATE (UTWIG_HAVE_ULTRON)) && ActivateStarShip (UTWIG_SHIP, SPHERE_TRACKING)) { NotifyOthers (UTWIG_SHIP, IPNL_ALL_CLEAR); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); CloneShipFragment (UTWIG_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); GLOBAL (CurrentActivity) |= START_INTERPLANETARY; if (CurStarDescPtr->Index == UTWIG_DEFINED) { SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); } else { SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6); } InitCommunication (UTWIG_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; } if (CurStarDescPtr->Index == BOMB_DEFINED && !GET_GAME_STATE (BOMB_UNPROTECTED) && ActivateStarShip (DRUUGE_SHIP, SPHERE_TRACKING)) { COUNT i; PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); for (i = 0; i < 5; ++i) { CloneShipFragment (DRUUGE_SHIP, &GLOBAL (npc_built_ship_q), 0); } GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6); InitCommunication (DRUUGE_CONVERSATION); if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) return true; { BOOLEAN DruugeSurvivors; DruugeSurvivors = GetHeadLink (&GLOBAL (npc_built_ship_q)) != 0; GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); if (DruugeSurvivors) return true; LockMutex (GraphicsLock); RepairSISBorder (); UnlockMutex (GraphicsLock); SET_GAME_STATE (BOMB_UNPROTECTED, 1); } } if (CurStarDescPtr->Index == BOMB_DEFINED) { LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->PlanetSideFrame[1] = CaptureDrawable (LoadGraphic (BOMB_MASK_PMAP_ANIM)); solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable (LoadStringTable (BOMB_STRTAB)); } 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 (CurStarDescPtr->Index == UTWIG_DEFINED && matchWorld (solarSys, world, 0, MATCH_PLANET)) { solarSys->SysInfo.PlanetInfo.Weather = 1; solarSys->SysInfo.PlanetInfo.Tectonics = 1; } return true; }
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) && ActivateStarShip (YEHAT_SHIP, SPHERE_TRACKING) && ActivateStarShip (YEHAT_REBEL_SHIP, FEASIBILITY_STUDY)) InitCommunication (YEHAT_REBEL_CONVERSATION); } } return true; } GenerateDefault_generateOrbital (solarSys, world); return true; }
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 BuildUrquanGuard (SOLARSYS_STATE *solarSys) { BYTE ship1, ship2; BYTE b0, b1; POINT org; HIPGROUP hGroup, hNextGroup; GLOBAL (BattleGroupRef) = GET_GAME_STATE_32 (SAMATRA_GRPOFFS0); if (!GET_GAME_STATE (KOHR_AH_FRENZY)) { ship1 = URQUAN_SHIP; ship2 = BLACK_URQUAN_SHIP; } else { ship1 = BLACK_URQUAN_SHIP; ship2 = URQUAN_SHIP; } assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); for (b0 = 0; b0 < MAX_SHIPS_PER_SIDE; ++b0) CloneShipFragment (ship1, &GLOBAL (npc_built_ship_q), 0); if (GLOBAL (BattleGroupRef) == 0) { GLOBAL (BattleGroupRef) = PutGroupInfo (GROUPS_ADD_NEW, 1); SET_GAME_STATE_32 (SAMATRA_GRPOFFS0, GLOBAL (BattleGroupRef)); } #define NUM_URQUAN_GUARDS0 12 for (b0 = 1; b0 <= NUM_URQUAN_GUARDS0; ++b0) PutGroupInfo (GLOBAL (BattleGroupRef), b0); ReinitQueue (&GLOBAL (npc_built_ship_q)); for (b0 = 0; b0 < MAX_SHIPS_PER_SIDE; ++b0) CloneShipFragment (ship2, &GLOBAL (npc_built_ship_q), 0); #define NUM_URQUAN_GUARDS1 4 for (b0 = 1; b0 <= NUM_URQUAN_GUARDS1; ++b0) PutGroupInfo (GLOBAL (BattleGroupRef), (BYTE)(NUM_URQUAN_GUARDS0 + b0)); ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GLOBAL (BattleGroupRef), GROUP_INIT_IP); org = planetOuterLocation (4); hGroup = GetHeadLink (&GLOBAL (ip_group_q)); for (b0 = 0, b1 = 0; b0 < NUM_URQUAN_GUARDS0; ++b0, b1 += FULL_CIRCLE / (NUM_URQUAN_GUARDS0 + NUM_URQUAN_GUARDS1)) { IP_GROUP *GroupPtr; if (b1 % (FULL_CIRCLE / NUM_URQUAN_GUARDS1) == 0) b1 += FULL_CIRCLE / (NUM_URQUAN_GUARDS0 + NUM_URQUAN_GUARDS1); GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup); hNextGroup = _GetSuccLink (GroupPtr); GroupPtr->task = ON_STATION | IGNORE_FLAGSHIP; GroupPtr->sys_loc = 0; GroupPtr->dest_loc = 4 + 1; GroupPtr->orbit_pos = NORMALIZE_FACING (ANGLE_TO_FACING (b1)); GroupPtr->group_counter = 0; GroupPtr->loc.x = org.x + COSINE (b1, STATION_RADIUS); GroupPtr->loc.y = org.y + SINE (b1, STATION_RADIUS); UnlockIpGroup (&GLOBAL (ip_group_q), hGroup); hGroup = hNextGroup; } for (b0 = 0, b1 = 0; b0 < NUM_URQUAN_GUARDS1; ++b0, b1 += FULL_CIRCLE / NUM_URQUAN_GUARDS1) { IP_GROUP *GroupPtr; GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup); hNextGroup = _GetSuccLink (GroupPtr); GroupPtr->task = ON_STATION | IGNORE_FLAGSHIP; GroupPtr->sys_loc = 0; GroupPtr->dest_loc = 4 + 1; GroupPtr->orbit_pos = NORMALIZE_FACING (ANGLE_TO_FACING (b1)); GroupPtr->group_counter = 0; GroupPtr->loc.x = org.x + COSINE (b1, STATION_RADIUS); GroupPtr->loc.y = org.y + SINE (b1, STATION_RADIUS); UnlockIpGroup (&GLOBAL (ip_group_q), hGroup); hGroup = hNextGroup; } (void) solarSys; }
void GeneratePkunk (BYTE control) { switch (control) { case GENERATE_ENERGY: if (pSolarSysState->pOrbitalDesc == &pSolarSysState->PlanetDesc[0]) { COUNT i, which_node; DWORD rand_val, old_rand; old_rand = TFB_SeedRandom ( pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN] ); which_node = i = 0; do { rand_val = TFB_Random (); pSolarSysState->SysInfo.PlanetInfo.CurPt.x = (LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8; pSolarSysState->SysInfo.PlanetInfo.CurPt.y = (HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8; if (!GET_GAME_STATE (CLEAR_SPINDLE)) pSolarSysState->SysInfo.PlanetInfo.CurType = 0; else pSolarSysState->SysInfo.PlanetInfo.CurType = 1; pSolarSysState->SysInfo.PlanetInfo.CurDensity = 0; if (pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] & (1L << i)) { pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] &= ~(1L << i); if (!GET_GAME_STATE (CLEAR_SPINDLE)) { ((PPLANETSIDE_DESC)pMenuState->ModuleFrame)->InTransit = TRUE; SET_GAME_STATE (CLEAR_SPINDLE, 1); SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1); } } if (which_node >= pSolarSysState->CurNode && !(pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] & (1L << i))) break; ++which_node; } while (++i < 16); pSolarSysState->CurNode = which_node; TFB_SeedRandom (old_rand); break; } pSolarSysState->CurNode = 0; break; case GENERATE_PLANETS: { COUNT angle; GenerateRandomIP (GENERATE_PLANETS); pSolarSysState->PlanetDesc[0].data_index = WATER_WORLD; pSolarSysState->PlanetDesc[0].NumPlanets = 1; pSolarSysState->PlanetDesc[0].radius = EARTH_RADIUS * 104L / 100; angle = ARCTAN ( pSolarSysState->PlanetDesc[0].location.x, pSolarSysState->PlanetDesc[0].location.y ); pSolarSysState->PlanetDesc[0].location.x = COSINE (angle, pSolarSysState->PlanetDesc[0].radius); pSolarSysState->PlanetDesc[0].location.y = SINE (angle, pSolarSysState->PlanetDesc[0].radius); break; } case GENERATE_ORBITAL: if (pSolarSysState->pOrbitalDesc == &pSolarSysState->PlanetDesc[0]) { if (ActivateStarShip (PKUNK_SHIP, SPHERE_TRACKING)) { NotifyOthers (PKUNK_SHIP, (BYTE)~0); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (npc_built_ship_q)); CloneShipFragment (PKUNK_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); pSolarSysState->MenuState.Initialized += 2; GLOBAL (CurrentActivity) |= START_INTERPLANETARY; SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); InitCommunication (PKUNK_CONVERSATION); pSolarSysState->MenuState.Initialized -= 2; if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) { GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); } break; } else { LoadStdLanderFont (&pSolarSysState->SysInfo.PlanetInfo); pSolarSysState->PlanetSideFrame[1] = CaptureDrawable ( LoadGraphic (RUINS_MASK_PMAP_ANIM) ); pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable ( LoadStringTable (PKUNK_RUINS_STRTAB) ); if (GET_GAME_STATE (CLEAR_SPINDLE)) pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = SetAbsStringTableIndex ( pSolarSysState->SysInfo.PlanetInfo.DiscoveryString, 1 ); } } default: GenerateRandomIP (control); break; } }
static bool GenerateOrz_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world) { if ((CurStarDescPtr->Index == ORZ_DEFINED && matchWorld (solarSys, world, 0, MATCH_PLANET)) || (CurStarDescPtr->Index == TAALO_PROTECTOR_DEFINED && matchWorld (solarSys, world, 1, 2) && !GET_GAME_STATE (TAALO_PROTECTOR))) { COUNT i; if ((CurStarDescPtr->Index == ORZ_DEFINED || !GET_GAME_STATE (TAALO_UNPROTECTED)) && ActivateStarShip (ORZ_SHIP, SPHERE_TRACKING)) { NotifyOthers (ORZ_SHIP, IPNL_ALL_CLEAR); PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP); ReinitQueue (&GLOBAL (ip_group_q)); assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0); if (CurStarDescPtr->Index == ORZ_DEFINED) { CloneShipFragment (ORZ_SHIP, &GLOBAL (npc_built_ship_q), INFINITE_FLEET); SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7); } else { for (i = 0; i < 14; ++i) { CloneShipFragment (ORZ_SHIP, &GLOBAL (npc_built_ship_q), 0); } SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6); } GLOBAL (CurrentActivity) |= START_INTERPLANETARY; InitCommunication (ORZ_CONVERSATION); if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)) return true; { BOOLEAN OrzSurvivors; OrzSurvivors = GetHeadLink (&GLOBAL (npc_built_ship_q)) && (CurStarDescPtr->Index == ORZ_DEFINED || !GET_GAME_STATE (TAALO_UNPROTECTED)); GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY; ReinitQueue (&GLOBAL (npc_built_ship_q)); GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP); if (OrzSurvivors) return true; LockMutex (GraphicsLock); RepairSISBorder (); UnlockMutex (GraphicsLock); } } SET_GAME_STATE (TAALO_UNPROTECTED, 1); if (CurStarDescPtr->Index == TAALO_PROTECTOR_DEFINED) { LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); solarSys->PlanetSideFrame[1] = CaptureDrawable ( LoadGraphic (TAALO_DEVICE_MASK_PMAP_ANIM)); solarSys->SysInfo.PlanetInfo.DiscoveryString = CaptureStringTable ( LoadStringTable (TAALO_DEVICE_STRTAB)); } 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); return true; }