1+ #pragma once
2+
3+ #include < Spore\Simulator\cGameData.h>
4+ #include < Spore\Simulator\cCommEvent.h>
5+ #include < Spore\Simulator\cSpeciesProfile.h>
6+ #include < Spore\Simulator\cPlanet.h>
7+ #include < Spore\Simulator\cEmpire.h>
8+ #include < Spore\App\IMessageListener.h>
9+ #include < Spore\MathUtils.h>
10+ #include < Spore\LocalizedString.h>
11+
12+ #define cMissionPtr eastl::intrusive_ptr<Simulator::cMission>
13+
14+ namespace Simulator
15+ {
16+ enum MissionFlags
17+ {
18+ kMissionFlagIsEvent = 1 ,
19+ kMissionFlagHideStarName = 2 ,
20+ kMissionFlagHidePlanetName = 4 ,
21+ kMissionFlagIsTutorial = 8 ,
22+ kMissionFlagCannotAbort = 0x10 ,
23+ kMissionFlagTimerStartsOnFirstEntry = 0x20 ,
24+ kMissionFlagIsAdventure = 0x80 ,
25+ };
26+
27+ enum class MissionState
28+ {
29+ // / When the mission hasn't been accepted yet, and player is in the initial conversation
30+ Unaccepted = 0 ,
31+ // / The mission has been finished (not necessarily completed). After this, the mission is destroyed.
32+ Finished = 1 ,
33+ // / The player just accepted the mission, but it hasn't started yet.
34+ // / It immediately transitions to MissionState::Active
35+ Accepted = 2 ,
36+ // / The mission is currently active. While the mission is in this state, it receives calls to Update()
37+ Active = 3 ,
38+ // / The player has successfully completed the mission. It immediately transitions to MissionState::Finished,
39+ // / or to MissionState::StepCompleted if this is a sub-mission of a bigger mission.
40+ Completed = 5 ,
41+ // / The player has failed the mission. It immediately transitions to MissionState::Finished
42+ Failed = 6 ,
43+ // / The mission has been aborted. It immediately transitions to MissionState::Finished
44+ Aborted = 7 ,
45+ // / The mission has been aborted. It immediately transitions to MissionState::Finished
46+ Rejected = 8 ,
47+ // / When this mission is only a step of a bigger mission, and the step gets completed
48+ StepCompleted = 9
49+ };
50+
51+ class cMission
52+ : public cGameData
53+ , public App::IMessageListener
54+ {
55+ public:
56+ static const uint32_t TYPE = 0x2AA5ADA ;
57+
58+ // TODO GetOwnerEmpire, GetTargetEmpire C44930
59+ // TODO SetState
60+
61+ /* 60h */ virtual int GetState ();
62+ /* 64h */ virtual bool func64h (); // field_38.IsRunning()
63+ /* 68h */ virtual bool func68h (); // field_58.IsRunning()
64+ /* 6Ch */ virtual void func6Ch (); // TODO start?
65+ /* 70h */ virtual void func70h (); // field_58.Start()
66+ /* 74h */ virtual uint32_t GetCardWindowControlID (); // returns a window controlID
67+ /* 78h */ virtual void Initialize (); // related with parsing prop, called when mission is created
68+ // / Only called when state is 3, called every frame.
69+ /* 7Ch */ virtual MissionState Update (int deltaTime);
70+ // / Loads prop file
71+ /* 80h */ virtual void Load ();
72+ /* 84h */ virtual void func84h ();
73+
74+ // / Called when the player accepts the mission.
75+ /* 88h */ virtual void OnMissionAccept ();
76+
77+ // / Called when the mission is rejected.
78+ /* 8Ch */ virtual void OnMissionReject ();
79+
80+ // / Called when the mission is aborted.
81+ /* 90h */ virtual void OnMissionAbort ();
82+
83+ // / Called when the mission is completed.
84+ /* 94h */ virtual void OnMissionCompleted ();
85+
86+ // / Called when the mission is failed.
87+ /* 98h */ virtual void OnMissionFailed ();
88+
89+ // / Causes this mission to fail.
90+ /* 9Ch */ virtual void FailMission ();
91+
92+ // / Returns a description for this mission, usually the `description` property in the prop list.
93+ // / @param dst The string where the description will be stored
94+ /* A0h */ virtual string16* GetDescription (string16* dst);
95+
96+ // / Returns the ID of a `.cnv` conversation file used for the mission.
97+ // / If the mission has a parent, it will return the conversation of the parent.
98+ /* A4h */ virtual uint32_t GetConversationID ();
99+
100+ // / Returns how much time the mission can last, in milliseconds. 0 if there is no time limit.
101+ /* A8h */ virtual int GetDuration ();
102+
103+ // / For missions with a time limit, returns how much time is left (duration - elapsedTime). Otherwise, returns 0.
104+ /* ACh */ virtual int GetRemainingTime ();
105+
106+ /* B0h */ virtual cSpeciesProfile* GetTargetAnimalSpecies ();
107+
108+ /* E4h */ virtual uint32_t GetStarMapEffectGroup ();
109+ /* E8h */ virtual uint32_t GetStarMapEffect ();
110+ // / Returns how much money it costs to travel from the source planet to the target planet and back.
111+ /* ECh */ virtual int GetTravelCost ();
112+ // / Returns how much distance to travel from the source planet to the target planet and back.
113+ /* F0h */ virtual float GetTravelDistance ();
114+ // / Returns true if the given planet is the target planet of the mission, or false otherwise.
115+ /* F4h */ virtual bool IsTargetPlanet (cPlanetRecord* pPlanetRecord);
116+ /* F8h */ virtual bool funcF8h (); // returns false
117+ /* FCh */ virtual bool funcFCh (); // returns false
118+ /* 100h */ virtual bool func100h (); // returns false
119+ /* 104h */ virtual bool func104h ();
120+ /* 108h */ virtual int func108h ();
121+ /* 10Ch */ virtual uint32_t func10Ch ();
122+ /* 110h */ virtual uint32_t func110h (int , int );
123+ /* 114h */ virtual void func114h (); // nothing
124+
125+ // / Called by the space token translator, used to replace special tokens in localized texts.
126+ // / For example, it is used to provide the target planet name, target species, etc
127+ // / @param tokenID id of the token (the token is a text, this is the FNV hash)
128+ // / @param dst Where the token text must be written.
129+ // / @returns True if the token was processed, false otherwise.
130+ /* 118h */ virtual bool TranslateToken (uint32_t tokenID, string16& dst);
131+ // / By default, `event_log_return_for_rewards`
132+ /* 11Ch */ virtual uint32_t GetCompletedEventLogID ();
133+ /* 120h */ virtual bool func120h (); // returns false
134+ /* 124h */ virtual void func120h (int ); // nothing
135+ /* 128h */ virtual bool func128h ();
136+
137+ public:
138+ /* 38h */ cGonzagoTimer field_38;
139+ /* 58h */ cGonzagoTimer field_58;
140+ /* 78h */ uint32_t mMissionID ;
141+ /* 7Ch */ unsigned int mElapsedTimeMS ;
142+ /* 80h */ int mDuration ;
143+ /* 84h */ int mState ;
144+ /* 88h */ bool mSystemsShutdown ;
145+ /* 8Ch */ uint32_t mOwnerEmpireID ; // -1
146+ // / Owner empire. Use GetOwnerEmpire
147+ /* 90h */ cEmpirePtr mpOwnerEmpire;
148+ /* 94h */ uint32_t mTargetEmpireID ; // -1
149+ // / Owner empire. Use GetTargetEmpire
150+ /* 98h */ cEmpirePtr mpTargetEmpire;
151+ /* 9Ch */ cPlanetPtr mpSourcePlanet;
152+ /* A0h */ float mRewardMoney ;
153+ /* A4h */ ResourceKey mRewardToolID ;
154+ /* B0h */ LocalizedString field_B0;
155+ /* C4h */ int mStarClue ; // -1 //TODO cStarClue
156+ /* C8h */ int field_C4;
157+ /* CCh */ vector<int > field_CC;
158+ /* E0h */ vector<ObjectPtr> field_E0;
159+ /* F4h */ int mPlanetClue ; // TODO cPlanetClue
160+ /* F8h */ int field_F8;
161+ /* FCh */ int field_FC;
162+ /* 100h */ uint32_t mStarMapIconEffectID ;
163+ /* 104h */ int field_104;
164+ /* 108h */ vector<int > field_108;
165+ /* 11Ch */ vector<ResourceKey> mUnlockToolIDList ;
166+ /* 130h */ int mFlags ;
167+ /* 134h */ vector<int > field_134;
168+ /* 148h */ uint32_t mProgressEventID ; // -1
169+ /* 14Ch */ string16 mTitle ;
170+ /* 15Ch */ string16 field_15C;
171+ /* 16Ch */ cSpeciesProfile* mTargetAnimalSpecies ;
172+ /* 170h */ ResourceKey mTargetAnimalSpeciesKey ;
173+ /* 17Ch */ cMissionPtr mpParentMission;
174+ /* 180h */ PropertyListPtr mpPropList;
175+ /* 184h */ int mAcceptCost ;
176+ /* 188h */ int mToolCost ;
177+ /* 18Ch */ bool field_18C;
178+ /* 190h */ int mGiveOnAcceptMoney ;
179+ /* 194h */ vector<ResourceKey> mGiveOnAcceptToolIDs ;
180+ /* 1A8h */ vector<ResourceKey> mGiveOnAcceptAnimalIDs ;
181+ /* 1BCh */ vector<ResourceKey> mGiveOnAcceptPlantIDs ;
182+ /* 1D0h */ vector<int > field_1D0;
183+ /* 1E4h */ cCommEventPtr mpGalaxyCommEvent;
184+ /* 1E8h */ cPlanetPtr mpTargetPlanet;
185+ };
186+ ASSERT_SIZE (cMission, 0x1F0 );
187+ }
0 commit comments