private string PrintFaroresWindRequirement(WrongWarp.Result wwr) { return(string.Format( " HOWEVER, without Farore's Wind {0}{1}{2}.", (!wwr.ValidRoom) ? String.Format("a crash will occur due to an invalid room id") : "", (!wwr.ValidRoom && !wwr.ValidEntranceId) ? ", and " : "", (!wwr.ValidEntranceId) ? "a softlock will occur due to a invalid starting position" : "" )); }
/// <summary> /// Sets the WrongWarp.Result's resultant entrance data /// </summary> /// <param name="wrongWarp">the WrongWarp.Result being generated</param> /// <param name="cutsceneOffset">the cutscene offset of the wrong warp</param> /// <returns></returns> private static void GetFinalEntrance(WrongWarp.Result wrongWarp, int cutsceneOffset) { OcarinaDataContext db = new OcarinaDataContext(); wrongWarp.FinalEntrance = db.Entrances.SingleOrDefault(ent => ent.SceneId == wrongWarp.FinalScene.ID && ent.Setup == ((wrongWarp.FinalScene.x18) ? cutsceneOffset + 4 : 0) && ent.EntranceNum == wrongWarp.End.Index.EntranceNum); }
/// <summary> /// Returns the calculation of a wrong warp as a WrongWarp.Result object /// </summary> /// <param name="wwp">The parameters for the wrong warp calculation</param> /// <param name="wrongWarp">The returned result</param> /// <returns>True if the operation can be performed, false otherwise</returns> public static bool GetResult(WrongWarp.Params wwp, out WrongWarp.Result wrongWarp) { bool result; result = GetResults(wwp, out wrongWarp); if (result) { wrongWarp.SetResult(); } return(result); }
private static bool GetResults(WrongWarp.Params wwp, out WrongWarp.Result wrongWarp) { int finalEntranceIndex; //the destination entrance index after calculation //initialize our WrongWarp.Result wrongWarp = new WrongWarp.Result(wwp); //Test to see if the baseEntranceIndex is a valid entrance, and collect information on it //if the cutscene offset is not between 0 and 15, or we can't retrieve an entrance index table record //report that the operation can't be performed if ((wwp.CutsceneIndex < 0 || wwp.CutsceneIndex > 16) || !Queries.TryGetEntranceByIndex(wwp.BaseEntranceIndex, out wrongWarp.Start)) { return(false); } //baseEntranceIndex exists, so calculate our finalEntranceIndex finalEntranceIndex = wrongWarp.Start.Index.BaseIndex + wwp.CutsceneIndex + 4; //if the final index is off the table, don't calculate the final entrance point. if (finalEntranceIndex > 0x613) { wrongWarp.ValidEntranceTableRecord = false; return(true); } //now retrieve the record at finalEntranceIndex if (Queries.TryGetEntranceByIndex(finalEntranceIndex, out wrongWarp.End)) { if (Scene.TryGetSingle(wrongWarp.End.Index.SceneId, out wrongWarp.FinalScene)) { //we've got our base and final entrance indexes //now to determine if the scene defines the final entrance correctly GetFinalEntrance(wrongWarp, wwp.CutsceneIndex); return(true); } } return(false); }
/// <summary> /// Death Hole Wrong Warping good scene result branch /// </summary> /// <param name="wwr"></param> /// <returns></returns> private string DhwwGoodSceneBranch(WrongWarp.Result wwr) { SceneCutscene cutsceneRecord; string result = ""; //Valid Setup? if (!wwr.ValidSetup) { //bad setup return(", but will crash due to a bad scene setup (4).");// break; } //cutscene type if (wwr.CutsceneType == WrongWarp.Result.Cutscene.Normal) { if (Queries.TryGetCutsceneRecord(wwr.FinalScene.ID, 0, out cutsceneRecord)) { result = String.Format(", with a black screen and the {0} scene setup loaded.", cutsceneRecord.Description); } else //still valid, just possible that the record wasn't pulled/missing cs { result = ", with a black screen and cutscene 0 loaded."; } } else { //cutscene pointer } //if room or entrance id aren't valid if (FaroresWindOnly) { result += PrintFaroresWindRequirement(wwr); } return(result); }
/// <summary> /// Standard 64 good scene wrong warp branch result /// </summary> /// <param name="wwp"></param> /// <param name="wwr"></param> /// <returns></returns> private string GoodSceneBranch(WrongWarp.Params wwp, WrongWarp.Result wwr) { SceneCutscene cutsceneRecord; string result = ""; //Valid Setup? if (!wwr.ValidSetup) //bad setup { return(String.Format(" but will crash due to a bad scene setup ({0}).", wwp.CutsceneIndex + 4)); } //cutscene type if (wwr.CutsceneType == WrongWarp.Result.Cutscene.Normal) { if (Queries.TryGetCutsceneRecord(wwr.FinalScene.ID, wwp.CutsceneIndex, out cutsceneRecord)) { result += String.Format(" and play the {0} cutscene.", cutsceneRecord.Description); } else { result += String.Format(" and play cutscene {0}.", wwp.CutsceneIndex); } } else //cutscene pointer { result += " but is affected by the cutscene pointer."; } //Crash without Farore's Wind? if (FaroresWindOnly) { result += PrintFaroresWindRequirement(wwr); } return(result); }