Example #1
0
        /// <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);
        }
Example #2
0
        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>
            /// 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);
            }