//void buildAlg(int evID=4062, int trID=0) // for cosm: data -> LHC15c_000218623_cosmics_15000218623020_10 //void buildAlg(int evID=6594, int trID=0) // for cosm: data -> LHC15c_000218623_cosmics_15000218623020_10 void buildAlg(int evID=-4, int trID=2) // for beam: data -> LHC10b_000117220_vpass1_pass4_10000117220022_30 { LoadESD(); LoadEvent(evID>=0 ? evID : 0); // int nEv = esdTree->GetEntries(); // algSTEER = new AliAlgSteer("alignConf.C"); // // ConfigAlign(algSTEER); algSTEER->SetMPOutType(AliAlgSteer::kContR); // algSTEER->SetESDTree(esdTree); int evFirst=0,evLast = esdTree->GetEntries()-1; if (evID>0) { evFirst = evID; evLast = evID; } for (int iev=evFirst;iev<=evLast;iev++) { LoadEvent(iev); algSTEER->ProcessEvent(esdEv); } // algSTEER->Terminate(); // }
/* * Trigger an event */ int TriggerEventByID(char *id) { LogDebug(VB_EVENT, "TriggerEventByID(%s)\n", id); if (getFPPmode() == MASTER_MODE) SendEventPacket(id); FPPevent *event = LoadEvent(id); if (!event) { LogWarn(VB_EVENT, "Unable to load event %s\n", id); return 0; } if (event->effect) StartEffect(event->effect, event->startChannel); if (event->script) RunEventScript(event); FreeEvent(event); return 1; }
BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *SummPtr) { uio_Stream *in_fp; char file[PATH_MAX]; char buf[256]; SUMMARY_DESC loc_sd; GAME_STATE_FILE *fp; DECODE_REF fh; COUNT num_links; STAR_DESC SD; ACTIVITY Activity; sprintf (file, "starcon2.%02u", which_game); in_fp = res_OpenResFile (saveDir, file, "rb"); if (!in_fp) return FALSE; if (!LoadSummary (&loc_sd, in_fp)) { log_add (log_Error, "Warning: Savegame is corrupt"); res_CloseResFile (in_fp); return FALSE; } if (!SummPtr) { SummPtr = &loc_sd; } else { // only need summary for displaying to user memcpy (SummPtr, &loc_sd, sizeof (*SummPtr)); res_CloseResFile (in_fp); return TRUE; } // Crude check for big-endian/little-endian incompatibilities. // year_index is suitable as it's a multi-byte value within // a specific recognisable range. if (SummPtr->year_index < START_YEAR || SummPtr->year_index >= START_YEAR + YEARS_TO_KOHRAH_VICTORY + 1 /* Utwig intervention */ + 1 /* time to destroy all races, plenty */ + 25 /* for cheaters */) { log_add (log_Error, "Warning: Savegame corrupt or from " "an incompatible platform."); res_CloseResFile (in_fp); return FALSE; } GlobData.SIS_state = SummPtr->SS; if ((fh = copen (in_fp, FILE_STREAM, STREAM_READ)) == 0) { res_CloseResFile (in_fp); return FALSE; } ReinitQueue (&GLOBAL (GameClock.event_q)); ReinitQueue (&GLOBAL (encounter_q)); ReinitQueue (&GLOBAL (ip_group_q)); ReinitQueue (&GLOBAL (npc_built_ship_q)); ReinitQueue (&GLOBAL (built_ship_q)); memset (&GLOBAL (GameState[0]), 0, sizeof (GLOBAL (GameState))); Activity = GLOBAL (CurrentActivity); LoadGameState (&GlobData.Game_state, fh); NextActivity = GLOBAL (CurrentActivity); GLOBAL (CurrentActivity) = Activity; LoadRaceQueue (fh, &GLOBAL (avail_race_q)); // START_INTERPLANETARY is only set when saving from Homeworld // encounter screen. When the game is loaded, the // GenerateOrbitalFunction for the current star system will // create the encounter anew and populate the npc queue. if (!(NextActivity & START_INTERPLANETARY)) { if (NextActivity & START_ENCOUNTER) LoadShipQueue (fh, &GLOBAL (npc_built_ship_q)); else if (LOBYTE (NextActivity) == IN_INTERPLANETARY) // XXX: Technically, this queue does not need to be // saved/loaded at all. IP groups will be reloaded // from group state files. But the original code did, // and so will we until we can prove we do not need to. LoadGroupQueue (fh, &GLOBAL (ip_group_q)); else // XXX: The empty queue read is only needed to maintain // the savegame compatibility LoadEmptyQueue (fh); } LoadShipQueue (fh, &GLOBAL (built_ship_q)); // Load the game events (compressed) cread_16 (fh, &num_links); { #ifdef DEBUG_LOAD log_add (log_Debug, "EVENTS:"); #endif /* DEBUG_LOAD */ while (num_links--) { HEVENT hEvent; EVENT *EventPtr; hEvent = AllocEvent (); LockEvent (hEvent, &EventPtr); LoadEvent (EventPtr, fh); #ifdef DEBUG_LOAD log_add (log_Debug, "\t%u/%u/%u -- %u", EventPtr->month_index, EventPtr->day_index, EventPtr->year_index, EventPtr->func_index); #endif /* DEBUG_LOAD */ UnlockEvent (hEvent); PutEvent (hEvent); } } // Load the encounters (black globes in HS/QS (compressed)) cread_16 (fh, &num_links); { while (num_links--) { HENCOUNTER hEncounter; ENCOUNTER *EncounterPtr; hEncounter = AllocEncounter (); LockEncounter (hEncounter, &EncounterPtr); LoadEncounter (EncounterPtr, fh); UnlockEncounter (hEncounter); PutEncounter (hEncounter); } } // Copy the star info file from the compressed stream fp = OpenStateFile (STARINFO_FILE, "wb"); if (fp) { DWORD flen; cread_32 (fh, &flen); while (flen) { COUNT num_bytes; num_bytes = flen >= sizeof (buf) ? sizeof (buf) : (COUNT)flen; cread (buf, num_bytes, 1, fh); WriteStateFile (buf, num_bytes, 1, fp); flen -= num_bytes; } CloseStateFile (fp); } // Copy the defined groupinfo file from the compressed stream fp = OpenStateFile (DEFGRPINFO_FILE, "wb"); if (fp) { DWORD flen; cread_32 (fh, &flen); while (flen) { COUNT num_bytes; num_bytes = flen >= sizeof (buf) ? sizeof (buf) : (COUNT)flen; cread (buf, num_bytes, 1, fh); WriteStateFile (buf, num_bytes, 1, fp); flen -= num_bytes; } CloseStateFile (fp); } // Copy the random groupinfo file from the compressed stream fp = OpenStateFile (RANDGRPINFO_FILE, "wb"); if (fp) { DWORD flen; cread_32 (fh, &flen); while (flen) { COUNT num_bytes; num_bytes = flen >= sizeof (buf) ? sizeof (buf) : (COUNT)flen; cread (buf, num_bytes, 1, fh); WriteStateFile (buf, num_bytes, 1, fp); flen -= num_bytes; } CloseStateFile (fp); } LoadStarDesc (&SD, fh); cclose (fh); res_CloseResFile (in_fp); EncounterGroup = 0; EncounterRace = -1; ReinitQueue (&race_q[0]); ReinitQueue (&race_q[1]); CurStarDescPtr = FindStar (NULL, &SD.star_pt, 0, 0); if (!(NextActivity & START_ENCOUNTER) && LOBYTE (NextActivity) == IN_INTERPLANETARY) NextActivity |= START_INTERPLANETARY; return TRUE; }