Line data Source code
1 : /* Copyright (C) 2026 Wildfire Games. 2 : * This file is part of 0 A.D. 3 : * 4 : * 0 A.D. is free software: you can redistribute it and/or modify 5 : * it under the terms of the GNU General Public License as published by 6 : * the Free Software Foundation, either version 2 of the License, or 7 : * (at your option) any later version. 8 : * 9 : * 0 A.D. is distributed in the hope that it will be useful, 10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 : * GNU General Public License for more details. 13 : * 14 : * You should have received a copy of the GNU General Public License 15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. 16 : */ 17 : 18 : #ifndef INCLUDED_ICMPCINEMAMANAGER 19 : #define INCLUDED_ICMPCINEMAMANAGER 20 : 21 : 22 : #include "simulation2/system/Component.h" 23 : #include "simulation2/system/Interface.h" 24 : 25 : #include <js/Value.h> 26 : #include <list> 27 : #include <map> 28 : 29 : class CCamera; 30 : class CCinemaPath; 31 : class CStrW; 32 : 33 : /** 34 : * Manages a dynamic list of cinema paths (predefined camera movements/cutscenes) as well as a queue of paths that 35 : * is played one by one on command to all players. Simulation messages are sent each time a path ends and also when 36 : * the queue finishes as a whole. 37 : */ 38 9 : class ICmpCinemaManager : public IComponent 39 : { 40 : public: 41 : /** 42 : * Register a new path. 43 : * @param path path data 44 : */ 45 : virtual void AddPath(const CCinemaPath& path) = 0; 46 : 47 : /** 48 : * Remove a path and its data entirely. 49 : * @param name path name 50 : */ 51 : virtual void DeletePath(const CStrW& name) = 0; 52 : 53 : /** 54 : * Check whether a path exists (is registered under the given name).. 55 : * @param name path name 56 : */ 57 : virtual bool HasPath(const CStrW& name) const = 0; 58 : 59 : /** 60 : * Get all registered paths, keyed by their names. 61 : */ 62 : virtual const std::map<CStrW, CCinemaPath>& GetPaths() const = 0; 63 : 64 : /** 65 : * Override the entire list of existing paths. 66 : * @param newPaths new list of paths 67 : */ 68 : virtual void SetPaths(const std::map<CStrW, CCinemaPath>& newPaths) = 0; 69 : 70 : /** 71 : * Push a path to the back of the queue. 72 : * @param name path name 73 : */ 74 : virtual void PushPathToQueue(const CStrW& name) = 0; 75 : 76 : /** 77 : * Clear all paths from the queue. 78 : */ 79 : virtual void ClearQueue() = 0; 80 : 81 : /** 82 : * Start playing the paths in the queue one by one. 83 : */ 84 : virtual void StartPlayingQueue() = 0; 85 : 86 : /** 87 : * Stop playing the active path and the queue altogether. 88 : */ 89 : virtual void StopPlayingQueue() = 0; 90 : 91 : /** 92 : * Whether the first path of the queue is being played at the moment. 93 : */ 94 : virtual bool IsPlayingQueue() const = 0; 95 : 96 : /** 97 : * Send an update to the path currently playing for it to determine the new camera position. 98 : * Called every frame. 99 : */ 100 : virtual void UpdateActivePath(const float deltaRealTime, CCamera& camera) = 0; 101 : 102 : /** 103 : * Get the name of the path currently playing, if any. 104 : */ 105 : virtual CStrW GetActivePath() const = 0; 106 : 107 : /** 108 : * Get the time elapsed since the currently active path started playing. 109 : */ 110 : virtual fixed GetActivePathElapsedTime() const = 0; 111 : 112 6 : DECLARE_INTERFACE_TYPE(CinemaManager) 113 : }; 114 : 115 : #endif // INCLUDED_ICMPCINEMAMANAGER