protected override void CreateManagers() { base.CreateManagers(); GameStateManager.CreateFromPrefab(_gameStateManagerPrefab, ManagersContainer); CinematicsManager.CreateFromPrefab(_cinematicsManagerPrefab, ManagersContainer); DialogueManager.CreateFromPrefab(_dialogManagerPrefab, ManagersContainer); HighScoreManager.Create(ManagersContainer); }
public void Init() { cinematicsManager = MapLoader.Loader.cinematicsManager; Array.Resize(ref cinematicNames, cinematicsManager.cinematics.Count + 1); Array.Copy(cinematicsManager.cinematics.Select(c => (c == null ? "Null" : c.name)).ToArray(), 0, cinematicNames, 1, cinematicsManager.cinematics.Count); if (currentCinematic == -1) { currentCinematic = 0; } cinematicIndex = currentCinematic; loaded = true; }
// Use this for initialization void Start() { originalCameraController = FindObjectOfType <CameraController>(); cinematicsManager = FindObjectOfType <CinematicsManager>(); foreach (Transform child in transform) { CinematicStep cinematicStep = child.GetComponent <CinematicStep>(); if (cinematicStep != null) { cinematicSteps.Add(cinematicStep); } } }
public void Init() { controller = MapLoader.Loader.controller; if (MapLoader.Loader is R2PS1Loader) { R2PS1Loader l = MapLoader.Loader as R2PS1Loader; ps1Streams = l.streams; string[] cinematicNames = CinematicNames; Array.Resize(ref cinematicNames, ps1Streams.Length + 1); CinematicNames = cinematicNames; for (int i = 0; i < ps1Streams.Length; i++) { CinematicNames[i + 1] = "Stream " + i; PS1GameInfo game = PS1GameInfo.Games[Settings.s.mode]; if (game != null && game.cines != null && game.cines.ContainsKey(l.lvlName)) { if (game.cines[l.lvlName].Length > i) { CinematicNames[i + 1] += ": " + game.cines[l.lvlName][i]; } } if (l.levelHeader.initialStreamID == i) { CinematicNames[i + 1] += " (intro)"; } } } else { cinematicsManager = MapLoader.Loader.cinematicsManager; string[] cinematicNames = CinematicNames; Array.Resize(ref cinematicNames, cinematicsManager.cinematics.Count + 1); CinematicNames = cinematicNames; Array.Copy(cinematicsManager.cinematics.Select(c => (c == null ? "Null" : c.name)).ToArray(), 0, CinematicNames, 1, cinematicsManager.cinematics.Count); } if (currentCinematic == -1) { currentCinematic = 0; } CinematicIndex = currentCinematic; loaded = true; }
void Awake() { scener = FindObjectOfType <AdvanceScene>(); cineManager = FindObjectOfType <CinematicsManager>(); if (textBack) { animateTextback = textBack.GetComponent <AnimateDialogue>(); } wmManager = FindObjectOfType <WorldMonologueManager>(); camManager = FindObjectOfType <CameraManager>(); if (monoReader == null) { monoReader = GetComponentInChildren <MonologueReader>(); } if (monoReader.hostObj == null) { monoReader.hostObj = gameObject; } monoReader.monoManager = this; }
// Use this for initialization void Start() { cinematicsManager = FindObjectOfType <CinematicsManager>(); }
async Task LoadLVL() { loadingState = "Loading level memory"; await WaitIfNecessary(); files_array[Mem.Lvl].GotoHeader(); Reader reader = files_array[Mem.Lvl].reader; long totalSize = reader.BaseStream.Length; //reader.ReadUInt32(); if (Settings.s.game == Settings.Game.R3 && (Settings.s.platform == Settings.Platform.PC || Settings.s.platform == Settings.Platform.Xbox || Settings.s.platform == Settings.Platform.Xbox360 || Settings.s.platform == Settings.Platform.PS3)) { reader.ReadUInt32(); // fix checksum? } reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); if (Settings.s.platform == Settings.Platform.PC || Settings.s.platform == Settings.Platform.Xbox || Settings.s.platform == Settings.Platform.Xbox360 || Settings.s.platform == Settings.Platform.PS3) { if (Settings.s.game == Settings.Game.R3) { string timeStamp = reader.ReadString(0x18); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); } else if (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.Dinosaur) { reader.ReadUInt32(); reader.ReadUInt32(); } } reader.ReadBytes(0x104); // vignette if (Settings.s.game != Settings.Game.Dinosaur) { reader.ReadUInt32(); } loadingState = "Loading level textures"; await ReadTexturesLvl(reader, Pointer.Current(reader)); if ((Settings.s.platform == Settings.Platform.PC || Settings.s.platform == Settings.Platform.Xbox || Settings.s.platform == Settings.Platform.Xbox360 || Settings.s.platform == Settings.Platform.PS3) && !hasTransit && Settings.s.game != Settings.Game.Dinosaur) { Pointer off_lightMapTexture = Pointer.Read(reader); // g_p_stLMTexture Pointer.DoAt(ref reader, off_lightMapTexture, () => { lightmapTexture = TextureInfo.Read(reader, off_lightMapTexture); }); if (Settings.s.game == Settings.Game.R3) { Pointer off_overlightTexture = Pointer.Read(reader); // *(_DWORD *)(GLI_BIG_GLOBALS + 370068) Pointer.DoAt(ref reader, off_overlightTexture, () => { overlightTexture = TextureInfo.Read(reader, off_overlightTexture); }); } } Pointer off_animBankLvl = null; if (Settings.s.game == Settings.Game.Dinosaur) { // animation bank is read right here. off_animBankLvl = Pointer.Current(reader); // Note: only one 0x104 bank in fix. print("Lvl animation bank address: " + off_animBankLvl); animationBanks = new AnimationBank[5]; AnimationBank[] banks = AnimationBank.Read(reader, off_animBankLvl, 0, 1, files_array[Mem.LvlKeyFrames]); animationBanks[0] = banks[0]; } loadingState = "Loading globals"; await WaitIfNecessary(); globals.off_transitDynamicWorld = null; globals.off_actualWorld = Pointer.Read(reader); globals.off_dynamicWorld = Pointer.Read(reader); if (Settings.s.game == Settings.Game.R3 && (Settings.s.platform == Settings.Platform.PC || Settings.s.platform == Settings.Platform.Xbox || Settings.s.platform == Settings.Platform.Xbox360 || Settings.s.platform == Settings.Platform.PS3)) { reader.ReadUInt32(); // ??? } globals.off_inactiveDynamicWorld = Pointer.Read(reader); globals.off_fatherSector = Pointer.Read(reader); // It is I, Father Sector. globals.off_firstSubMapPosition = Pointer.Read(reader); globals.num_always = reader.ReadUInt32(); globals.spawnablePersos = LinkedList <Perso> .ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); globals.off_always_reusableSO = Pointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. globals.off_always_reusableUnknown1 = Pointer.Read(reader); // (num_always) * 0x2c blocks globals.off_always_reusableUnknown2 = Pointer.Read(reader); // (num_always) * 0x4 blocks // Read object types objectTypes = new ObjectType[3][]; for (uint i = 0; i < 3; i++) { Pointer off_names_header = Pointer.Current(reader); Pointer off_names_first = Pointer.Read(reader); Pointer off_names_last = Pointer.Read(reader); uint num_names = reader.ReadUInt32(); ReadObjectNamesTable(reader, off_names_first, num_names, i); } Pointer off_light = Pointer.Read(reader); // the offset of a light. It's just an ordinary light. Pointer off_characterLaunchingSoundEvents = Pointer.Read(reader); Pointer off_collisionGeoObj = Pointer.Read(reader); Pointer off_staticCollisionGeoObj = Pointer.Read(reader); if (!hasTransit) { reader.ReadUInt32(); // viewport related <--- cameras in here } Pointer off_unknown_first = Pointer.Read(reader); Pointer off_unknown_last = Pointer.Read(reader); uint num_unknown = reader.ReadUInt32(); families = LinkedList <Family> .ReadHeader(reader, Pointer.Current(reader), type : LinkedList.Type.Double); Pointer off_alwaysActiveCharacters_first = Pointer.Read(reader); Pointer off_alwaysActiveCharacters_last = Pointer.Read(reader); uint num_alwaysActiveChars = reader.ReadUInt32(); if (!hasTransit) { Pointer off_mainCharacters_first = Pointer.Read(reader); Pointer off_mainCharacters_last = Pointer.Read(reader); uint num_mainCharacters_entries = reader.ReadUInt32(); } reader.ReadUInt32(); // only used if there was no transit in the previous lvl. Always 00165214 in R3GC? reader.ReadUInt32(); // related to "SOL". What is this? Good question. reader.ReadUInt32(); // same if (Settings.s.game != Settings.Game.Dinosaur) { reader.ReadUInt32(); // same } Pointer off_cineManager = Pointer.Read(reader); byte unk = reader.ReadByte(); byte IPO_numRLItables = reader.ReadByte(); reader.ReadUInt16(); Pointer off_COL_taggedFacesTable = Pointer.Read(reader); uint num_COL_maxTaggedFaces = reader.ReadUInt32(); off_collisionGeoObj = Pointer.Read(reader); off_staticCollisionGeoObj = Pointer.Read(reader); // The ptrsTable seems to be related to sound events. Perhaps cuuids. reader.ReadUInt32(); if (Settings.s.game == Settings.Game.Dinosaur) { for (int i = 0; i < 50; i++) { reader.ReadUInt32(); } // Actually, the previous uint is an amount for this array of uints, but it's padded to always be 50 long } uint num_ptrsTable = reader.ReadUInt32(); if (Settings.s.game == Settings.Game.R3) { uint bool_ptrsTable = reader.ReadUInt32(); } Pointer off_ptrsTable = Pointer.Read(reader); uint num_internalStructure = num_ptrsTable; if (Settings.s.mode == Settings.Mode.Rayman3GC) { reader.ReadUInt32(); } Pointer off_internalStructure_first = Pointer.Read(reader); Pointer off_internalStructure_last = Pointer.Read(reader); if (!hasTransit && Settings.s.game == Settings.Game.R3) { uint num_geometric = reader.ReadUInt32(); Pointer off_array_geometric = Pointer.Read(reader); Pointer off_array_geometric_RLI = Pointer.Read(reader); Pointer off_array_transition_flags = Pointer.Read(reader); } else if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.Dinosaur || Settings.s.game == Settings.Game.DDPK) { uint num_unk = reader.ReadUInt32(); Pointer unk_first = Pointer.Read(reader); if (Settings.s.game != Settings.Game.Dinosaur) { Pointer unk_last = Pointer.Read(reader); } } uint num_visual_materials = reader.ReadUInt32(); Pointer off_array_visual_materials = Pointer.Read(reader); if (Settings.s.mode != Settings.Mode.RaymanArenaGC && Settings.s.mode != Settings.Mode.RaymanArenaGCDemo && Settings.s.mode != Settings.Mode.DonaldDuckPKGC) { Pointer off_dynamic_so_list = Pointer.Read(reader); // Parse SO list Pointer.DoAt(ref reader, off_dynamic_so_list, () => { LinkedList <SuperObject> .ReadHeader(reader, off_dynamic_so_list); /*Pointer off_so_list_first = Pointer.Read(reader); * Pointer off_so_list_last = Pointer.Read(reader); * Pointer off_so_list_current = off_so_list_first; * uint num_so_list = reader.ReadUInt32();*/ /*if (experimentalObjectLoading) { * for (uint i = 0; i < num_so_list; i++) { * R3Pointer.Goto(ref reader, off_so_list_current); * R3Pointer off_so_list_next = R3Pointer.Read(reader); * R3Pointer off_so_list_prev = R3Pointer.Read(reader); * R3Pointer off_so_list_start = R3Pointer.Read(reader); * R3Pointer off_so = R3Pointer.Read(reader); * R3Pointer.Goto(ref reader, off_so); * ParseSuperObject(reader, off_so, true, true); * off_so_list_current = off_so_list_next; * } * }*/ }); } // Parse materials list loadingState = "Loading visual materials"; await WaitIfNecessary(); Pointer.DoAt(ref reader, off_array_visual_materials, () => { for (uint i = 0; i < num_visual_materials; i++) { Pointer off_material = Pointer.Read(reader); Pointer.DoAt(ref reader, off_material, () => { //print(Pointer.Current(reader)); visualMaterials.Add(VisualMaterial.Read(reader, off_material)); }); } }); if (hasTransit) { loadingState = "Loading transit memory"; await WaitIfNecessary(); Pointer off_transit = new Pointer(16, files_array[Mem.Transit]); // It's located at offset 20 in transit Pointer.DoAt(ref reader, off_transit, () => { if (Settings.s.platform == Settings.Platform.PC || Settings.s.platform == Settings.Platform.Xbox || Settings.s.platform == Settings.Platform.Xbox360 || Settings.s.platform == Settings.Platform.PS3) { Pointer off_lightMapTexture = Pointer.Read(reader); // g_p_stLMTexture Pointer.DoAt(ref reader, off_lightMapTexture, () => { lightmapTexture = TextureInfo.Read(reader, off_lightMapTexture); }); if (Settings.s.game == Settings.Game.R3) { Pointer off_overlightTexture = Pointer.Read(reader); // *(_DWORD *)(GLI_BIG_GLOBALS + 370068) Pointer.DoAt(ref reader, off_overlightTexture, () => { overlightTexture = TextureInfo.Read(reader, off_overlightTexture); }); } } globals.off_transitDynamicWorld = Pointer.Read(reader); globals.off_actualWorld = Pointer.Read(reader); globals.off_dynamicWorld = Pointer.Read(reader); globals.off_inactiveDynamicWorld = Pointer.Read(reader); }); } // Parse actual world & always structure loadingState = "Loading families"; await WaitIfNecessary(); ReadFamilies(reader); loadingState = "Loading superobject hierarchy"; await WaitIfNecessary(); ReadSuperObjects(reader); loadingState = "Loading always structure"; await WaitIfNecessary(); ReadAlways(reader); Pointer.DoAt(ref reader, off_cineManager, () => { cinematicsManager = CinematicsManager.Read(reader, off_cineManager); }); // off_current should be after the dynamic SO list positions. // Parse transformation matrices and other settings(state? :o) for fix characters loadingState = "Loading settings for persos in fix"; await WaitIfNecessary(); uint num_perso_with_settings_in_fix = (uint)persoInFix.Length; if (Settings.s.game == Settings.Game.R3) { num_perso_with_settings_in_fix = reader.ReadUInt32(); } for (int i = 0; i < num_perso_with_settings_in_fix; i++) { Pointer off_perso_so_with_settings_in_fix = null, off_matrix = null; SuperObject so = null; Matrix mat = null; if (Settings.s.game == Settings.Game.R3) { off_perso_so_with_settings_in_fix = Pointer.Read(reader); off_matrix = Pointer.Current(reader); mat = Matrix.Read(reader, off_matrix); reader.ReadUInt32(); // is one of these the state? doesn't appear to change tho reader.ReadUInt32(); so = SuperObject.FromOffset(off_perso_so_with_settings_in_fix); } else if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.Dinosaur) { off_matrix = Pointer.Current(reader); mat = Matrix.Read(reader, off_matrix); so = superObjects.FirstOrDefault(s => s.off_data == persoInFix[i]); } if (so != null) { so.off_matrix = off_matrix; so.matrix = mat; if (so.Gao != null) { so.Gao.transform.localPosition = mat.GetPosition(convertAxes: true); so.Gao.transform.localRotation = mat.GetRotation(convertAxes: true); so.Gao.transform.localScale = mat.GetScale(convertAxes: true); } } } if (Settings.s.platform == Settings.Platform.GC) { reader.ReadBytes(0x800); // floats } loadingState = "Loading animation banks"; await WaitIfNecessary(); if (Settings.s.game != Settings.Game.Dinosaur) { off_animBankLvl = Pointer.Read(reader); // Note: 4 0x104 banks in lvl. print("Lvl animation bank address: " + off_animBankLvl); animationBanks = new AnimationBank[5]; if (off_animBankFix != off_animBankLvl) { Pointer.DoAt(ref reader, off_animBankFix, () => { animationBanks[0] = AnimationBank.Read(reader, off_animBankFix, 0, 1, files_array[Mem.FixKeyFrames])[0]; }); } Pointer.DoAt(ref reader, off_animBankLvl, () => { AnimationBank[] banks = AnimationBank.Read(reader, off_animBankLvl, 1, 4, files_array[Mem.LvlKeyFrames]); for (int i = 0; i < 4; i++) { animationBanks[1 + i] = banks[i]; } }); if (off_animBankFix == off_animBankLvl) { animationBanks[0] = animationBanks[1]; } } // Load additional animation banks string extraAnimFolder = "Anim/"; if (Settings.s.mode == Settings.Mode.RaymanArenaGCDemo) { extraAnimFolder = lvlName + "/"; } for (int i = 0; i < families.Count; i++) { if (families[i] != null && families[i].animBank > 4 && objectTypes[0][families[i].family_index].id != 0xFF) { int animBank = families[i].animBank; loadingState = "Loading additional animation bank " + animBank; await WaitIfNecessary(); int animFileID = objectTypes[0][families[i].family_index].id; if (Settings.s.mode == Settings.Mode.RaymanArenaGCDemo) { animFileID = animBank - 5; } string animName = extraAnimFolder + "ani" + animFileID.ToString(); string kfName = extraAnimFolder + "key" + animFileID.ToString() + "kf"; //print(animBank + " - " + objectTypes[0][families[i].family_index].id); int fileID = animBank + 102; int kfFileID = animBank + 2; // Anim bank will start at 5, so this will start at 7 if (Settings.s.game == Settings.Game.RM) { fileID = animBank; } // Prepare files for WebGL await PrepareFile(gameDataBinFolder + animName + ".lvl"); if (FileSystem.FileExists(gameDataBinFolder + animName + ".lvl")) { await PrepareFile(gameDataBinFolder + animName + ".ptr"); } await PrepareFile(gameDataBinFolder + kfName + ".lvl"); if (FileSystem.FileExists(gameDataBinFolder + kfName + ".lvl")) { await PrepareFile(gameDataBinFolder + kfName + ".ptr"); } FileWithPointers animFile = InitExtraLVL(animName, fileID); FileWithPointers kfFile = InitExtraLVL(kfName, fileID); if (animFile != null) { if (animBank >= animationBanks.Length) { Array.Resize(ref animationBanks, animBank + 1); } Pointer off_animBankExtra = new Pointer(0, animFile); Pointer.DoAt(ref reader, off_animBankExtra, () => { int alignBytes = reader.ReadInt32(); if (alignBytes > 0) { reader.Align(4, alignBytes); } off_animBankExtra = Pointer.Current(reader); animationBanks[animBank] = AnimationBank.Read(reader, off_animBankExtra, (uint)animBank, 1, kfFile)[0]; }); } } } loadingState = "Filling in cross-references"; await WaitIfNecessary(); ReadCrossReferences(reader); }
private void Awake() { instance = this; }
private void Awake() { _cinematics = GetComponentInChildren <CinematicsManager>(); }