Merge lp:~luke-jr/armagetronad/armagetronad-zonesv2-cleanup into lp:~armagetronad-dev/armagetronad/trunk-armagetronad-work
- armagetronad-zonesv2-cleanup
- Merge into trunk-armagetronad-work
Proposed by
Luke-Jr
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~luke-jr/armagetronad/armagetronad-zonesv2-cleanup |
Merge into: | lp:~armagetronad-dev/armagetronad/trunk-armagetronad-work |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~luke-jr/armagetronad/armagetronad-zonesv2-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Manuel Moos | Approve | ||
Review via email: mp+4020@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Manuel Moos (z-man) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/engine/eGameObject.cpp' | |||
2 | --- src/engine/eGameObject.cpp 2008-04-25 18:00:53 +0000 | |||
3 | +++ src/engine/eGameObject.cpp 2009-02-27 08:05:29 +0000 | |||
4 | @@ -638,6 +638,14 @@ | |||
5 | 638 | 638 | ||
6 | 639 | void eGameObject::OnRoundBegin(){} | 639 | void eGameObject::OnRoundBegin(){} |
7 | 640 | void eGameObject::OnRoundEnd(){} | 640 | void eGameObject::OnRoundEnd(){} |
8 | 641 | void eGameObject::OnBirth(){} | ||
9 | 642 | |||
10 | 643 | void eGameObject::EnsureBorn() { | ||
11 | 644 | if (_born) | ||
12 | 645 | return; | ||
13 | 646 | _born = true; | ||
14 | 647 | OnBirth(); | ||
15 | 648 | } | ||
16 | 641 | 649 | ||
17 | 642 | void eGameObject::Kill(){} | 650 | void eGameObject::Kill(){} |
18 | 643 | 651 | ||
19 | @@ -703,6 +711,8 @@ | |||
20 | 703 | 711 | ||
21 | 704 | tJUST_CONTROLLED_PTR< eGameObject > keep( c ); // keep object alive | 712 | tJUST_CONTROLLED_PTR< eGameObject > keep( c ); // keep object alive |
22 | 705 | 713 | ||
23 | 714 | c->EnsureBorn(); | ||
24 | 715 | |||
25 | 706 | REAL maxstep=.2; | 716 | REAL maxstep=.2; |
26 | 707 | 717 | ||
27 | 708 | // don't do a thing if the timestep is too small | 718 | // don't do a thing if the timestep is too small |
28 | 709 | 719 | ||
29 | === modified file 'src/engine/eGameObject.h' | |||
30 | --- src/engine/eGameObject.h 2008-03-08 16:55:06 +0000 | |||
31 | +++ src/engine/eGameObject.h 2009-02-27 08:05:29 +0000 | |||
32 | @@ -57,6 +57,9 @@ | |||
33 | 57 | // small wrapper of TimestepThis doing preparation and cleanup work | 57 | // small wrapper of TimestepThis doing preparation and cleanup work |
34 | 58 | static void TimestepThisWrapper(eGrid * grid, REAL currentTime, eGameObject *t, REAL minTimestep); | 58 | static void TimestepThisWrapper(eGrid * grid, REAL currentTime, eGameObject *t, REAL minTimestep); |
35 | 59 | 59 | ||
36 | 60 | //! called immediately after the object is created, either right after round beginning or mid-game creation | ||
37 | 61 | virtual void OnBirth(); | ||
38 | 62 | |||
39 | 60 | protected: | 63 | protected: |
40 | 61 | // does a timestep and all interactions for this gameobject, | 64 | // does a timestep and all interactions for this gameobject, |
41 | 62 | // divided in many small steps | 65 | // divided in many small steps |
42 | @@ -89,6 +92,8 @@ | |||
43 | 89 | tJUST_CONTROLLED_PTR<eFace> currentFace; // the eFace pos it is currently | 92 | tJUST_CONTROLLED_PTR<eFace> currentFace; // the eFace pos it is currently |
44 | 90 | tCHECKED_PTR(eGrid) grid; // the game grid we are on | 93 | tCHECKED_PTR(eGrid) grid; // the game grid we are on |
45 | 91 | 94 | ||
46 | 95 | bool _born; | ||
47 | 96 | |||
48 | 92 | // entry and deletion in the list of all eGameObjects | 97 | // entry and deletion in the list of all eGameObjects |
49 | 93 | public: | 98 | public: |
50 | 94 | //! tells game objects what the maximum lag caused by lazy simulation of timesteps is | 99 | //! tells game objects what the maximum lag caused by lazy simulation of timesteps is |
51 | @@ -164,6 +169,9 @@ | |||
52 | 164 | //! called when the round ends | 169 | //! called when the round ends |
53 | 165 | virtual void OnRoundEnd(); | 170 | virtual void OnRoundEnd(); |
54 | 166 | 171 | ||
55 | 172 | //! call to ensure the object is "born" | ||
56 | 173 | void EnsureBorn(); | ||
57 | 174 | |||
58 | 167 | //! destroys the gameobject (in the game) | 175 | //! destroys the gameobject (in the game) |
59 | 168 | virtual void Kill(); | 176 | virtual void Kill(); |
60 | 169 | 177 | ||
61 | 170 | 178 | ||
62 | === modified file 'src/tools/tPolynomial.cpp' | |||
63 | --- src/tools/tPolynomial.cpp 2009-02-22 23:34:35 +0000 | |||
64 | +++ src/tools/tPolynomial.cpp 2009-02-27 09:07:52 +0000 | |||
65 | @@ -74,6 +74,14 @@ | |||
66 | 74 | // Empty | 74 | // Empty |
67 | 75 | } | 75 | } |
68 | 76 | 76 | ||
69 | 77 | tPolynomial::tPolynomial(const tFunction &tf, REAL refValue) //!< constructor | ||
70 | 78 | : referenceVarValue(refValue), | ||
71 | 79 | coefs(2) | ||
72 | 80 | { | ||
73 | 81 | coefs[0] = tf.offset_; | ||
74 | 82 | coefs[1] = tf.slope_; | ||
75 | 83 | } | ||
76 | 84 | |||
77 | 77 | tPolynomial::tPolynomial(const tFunction &tf) //!< constructor | 85 | tPolynomial::tPolynomial(const tFunction &tf) //!< constructor |
78 | 78 | : referenceVarValue(0.0), | 86 | : referenceVarValue(0.0), |
79 | 79 | coefs(2) | 87 | coefs(2) |
80 | 80 | 88 | ||
81 | === modified file 'src/tools/tPolynomial.h' | |||
82 | --- src/tools/tPolynomial.h 2009-02-22 23:34:35 +0000 | |||
83 | +++ src/tools/tPolynomial.h 2009-02-27 09:07:52 +0000 | |||
84 | @@ -54,6 +54,7 @@ | |||
85 | 54 | tPolynomial(REAL value); //!< constructor for constant polynomial | 54 | tPolynomial(REAL value); //!< constructor for constant polynomial |
86 | 55 | tPolynomial(tArray<REAL> const & newCoefs); //!< constructor | 55 | tPolynomial(tArray<REAL> const & newCoefs); //!< constructor |
87 | 56 | tPolynomial(const tPolynomial &tf); //!< constructor | 56 | tPolynomial(const tPolynomial &tf); //!< constructor |
88 | 57 | tPolynomial(const tFunction &tf, REAL refValue); //!< constructor | ||
89 | 57 | tPolynomial(const tFunction &tf); //!< constructor | 58 | tPolynomial(const tFunction &tf); //!< constructor |
90 | 58 | tPolynomial(std::string str); //!< constructor | 59 | tPolynomial(std::string str); //!< constructor |
91 | 59 | 60 | ||
92 | 60 | 61 | ||
93 | === modified file 'src/tron/gGame.cpp' | |||
94 | --- src/tron/gGame.cpp 2009-02-26 19:57:28 +0000 | |||
95 | +++ src/tron/gGame.cpp 2009-02-27 08:05:29 +0000 | |||
96 | @@ -2728,6 +2728,7 @@ | |||
97 | 2728 | if ( e ) | 2728 | if ( e ) |
98 | 2729 | { | 2729 | { |
99 | 2730 | e->OnRoundBegin(); | 2730 | e->OnRoundBegin(); |
100 | 2731 | e->EnsureBorn(); | ||
101 | 2731 | } | 2732 | } |
102 | 2732 | } | 2733 | } |
103 | 2733 | } | 2734 | } |
104 | 2734 | 2735 | ||
105 | === modified file 'src/tron/gParser.cpp' | |||
106 | --- src/tron/gParser.cpp 2009-02-26 22:15:59 +0000 | |||
107 | +++ src/tron/gParser.cpp 2009-02-27 18:21:24 +0000 | |||
108 | @@ -933,7 +933,9 @@ | |||
109 | 933 | // Get the label of the effector to be used | 933 | // Get the label of the effector to be used |
110 | 934 | string effectorAttribute( myxmlGetProp(cur, "effect")); | 934 | string effectorAttribute( myxmlGetProp(cur, "effect")); |
111 | 935 | 935 | ||
113 | 936 | effector = zEffectorPtr(zEffectorManager::Create(effectorAttribute, tXmlParser::node(cur))); | 936 | effector = zEffectorPtr(zEffectorManager::Create(effectorAttribute)); |
114 | 937 | effector->applyContext(state); | ||
115 | 938 | effector->readXML(tXmlParser::node(cur)); | ||
116 | 937 | 939 | ||
117 | 938 | return effector; | 940 | return effector; |
118 | 939 | } | 941 | } |
119 | @@ -2013,20 +2015,35 @@ | |||
120 | 2013 | 2015 | ||
121 | 2014 | bool | 2016 | bool |
122 | 2015 | gParser::State_t::exists(std::string const & var) | 2017 | gParser::State_t::exists(std::string const & var) |
123 | 2018 | const | ||
124 | 2016 | { | 2019 | { |
125 | 2017 | return _varstack.front().find(var) != _varstack.front().end(); | 2020 | return _varstack.front().find(var) != _varstack.front().end(); |
126 | 2018 | } | 2021 | } |
127 | 2019 | 2022 | ||
128 | 2020 | bool | 2023 | bool |
129 | 2021 | gParser::State_t::isset(std::string const & var) | 2024 | gParser::State_t::isset(std::string const & var) |
130 | 2025 | const | ||
131 | 2022 | { | 2026 | { |
133 | 2023 | return exists(var) && !_varstack.front()[var]->empty(); | 2027 | if (!exists(var)) |
134 | 2028 | return false; | ||
135 | 2029 | my_map_t vars = _varstack.front(); | ||
136 | 2030 | my_map_t::const_iterator i; | ||
137 | 2031 | if ((i = vars.find(var)) == vars.end()) | ||
138 | 2032 | return false; | ||
139 | 2033 | if (i->second->empty()) | ||
140 | 2034 | return false; | ||
141 | 2035 | return true; | ||
142 | 2024 | } | 2036 | } |
143 | 2025 | 2037 | ||
144 | 2026 | boost::any | 2038 | boost::any |
145 | 2027 | gParser::State_t::getAny(std::string const & var) | 2039 | gParser::State_t::getAny(std::string const & var) |
146 | 2040 | const | ||
147 | 2028 | { | 2041 | { |
149 | 2029 | return *(_varstack.front()[var]); | 2042 | my_map_t vars = _varstack.front(); |
150 | 2043 | my_map_t::const_iterator i; | ||
151 | 2044 | if ((i = vars.find(var)) == vars.end()) | ||
152 | 2045 | return boost::any(); | ||
153 | 2046 | return *(i->second); | ||
154 | 2030 | } | 2047 | } |
155 | 2031 | 2048 | ||
156 | 2032 | void | 2049 | void |
157 | 2033 | 2050 | ||
158 | === modified file 'src/tron/gParser.h' | |||
159 | --- src/tron/gParser.h 2009-02-26 21:28:08 +0000 | |||
160 | +++ src/tron/gParser.h 2009-02-27 18:21:24 +0000 | |||
161 | @@ -32,13 +32,13 @@ | |||
162 | 32 | public: | 32 | public: |
163 | 33 | gParserState(); | 33 | gParserState(); |
164 | 34 | 34 | ||
168 | 35 | bool exists(std::string const & var); | 35 | bool exists(std::string const & var) const; |
169 | 36 | bool isset(std::string const & var); | 36 | bool isset(std::string const & var) const; |
170 | 37 | template<typename T> bool istype(std::string const & var) { | 37 | template<typename T> bool istype(std::string const & var) const { |
171 | 38 | if (!isset(var)) | 38 | if (!isset(var)) |
172 | 39 | return false; | 39 | return false; |
173 | 40 | try { | 40 | try { |
175 | 41 | boost::any_cast<T>(*(_varstack.front()[var])); | 41 | boost::any_cast<T>(getAny(var)); |
176 | 42 | return true; | 42 | return true; |
177 | 43 | } | 43 | } |
178 | 44 | catch (const boost::bad_any_cast &) | 44 | catch (const boost::bad_any_cast &) |
179 | @@ -46,8 +46,8 @@ | |||
180 | 46 | return false; | 46 | return false; |
181 | 47 | } | 47 | } |
182 | 48 | } | 48 | } |
185 | 49 | boost::any getAny(std::string const & var); | 49 | boost::any getAny(std::string const & var) const; |
186 | 50 | template<typename T> T get(std::string const & var) { | 50 | template<typename T> T get(std::string const & var) const { |
187 | 51 | return boost::any_cast<T>(getAny(var)); | 51 | return boost::any_cast<T>(getAny(var)); |
188 | 52 | } | 52 | } |
189 | 53 | void setAny(std::string const & var, boost::any val); | 53 | void setAny(std::string const & var, boost::any val); |
190 | 54 | 54 | ||
191 | === removed file 'src/tron/zone/shapeCircle.h' | |||
192 | --- src/tron/zone/shapeCircle.h 2006-08-02 20:19:33 +0000 | |||
193 | +++ src/tron/zone/shapeCircle.h 1970-01-01 00:00:00 +0000 | |||
194 | @@ -1,34 +0,0 @@ | |||
195 | 1 | typedef boost::shared_ptr<shape> ShapePtr; | ||
196 | 2 | |||
197 | 3 | class shape { | ||
198 | 4 | virtual ~shape(); | ||
199 | 5 | }; | ||
200 | 6 | |||
201 | 7 | class shapeCircle : public shape { | ||
202 | 8 | tValue::Base() x; | ||
203 | 9 | tValue::Base() y; | ||
204 | 10 | tValue::Base() radius; | ||
205 | 11 | |||
206 | 12 | public : | ||
207 | 13 | shapeCircle(tValue::Base() _x, tValue::Base() _y, tValue::Base() _radius): x(_x), y(_y), radius(_radius) { }; | ||
208 | 14 | |||
209 | 15 | }; | ||
210 | 16 | |||
211 | 17 | class shapeTriangle : public shape { | ||
212 | 18 | tValue::Base() x1; | ||
213 | 19 | tValue::Base() y1; | ||
214 | 20 | tValue::Base() x2; | ||
215 | 21 | tValue::Base() y2; | ||
216 | 22 | tValue::Base() x3; | ||
217 | 23 | tValue::Base() y3; | ||
218 | 24 | |||
219 | 25 | public: | ||
220 | 26 | shapeSquare(tValue::Base() _x1, tValue::Base() _y1, | ||
221 | 27 | tValue::Base() _x2, tValue::Base() _y2, | ||
222 | 28 | tValue::Base() _x3, tValue::Base() _y3, | ||
223 | 29 | ): | ||
224 | 30 | x1(_x1), y1(_y1), | ||
225 | 31 | x2(_x2), y2(_y2), | ||
226 | 32 | x3(_x3), y3(_y3) | ||
227 | 33 | {}; | ||
228 | 34 | }; | ||
229 | 35 | 0 | ||
230 | === modified file 'src/tron/zone/zEffectGroup.cpp' | |||
231 | --- src/tron/zone/zEffectGroup.cpp 2009-02-03 08:50:43 +0000 | |||
232 | +++ src/tron/zone/zEffectGroup.cpp 2009-02-27 16:25:51 +0000 | |||
233 | @@ -29,8 +29,6 @@ | |||
234 | 29 | 29 | ||
235 | 30 | zEffectGroup::zEffectGroup(gVectorExtra< nNetObjectID > const owners, gVectorExtra< nNetObjectID > const teamOwners): | 30 | zEffectGroup::zEffectGroup(gVectorExtra< nNetObjectID > const owners, gVectorExtra< nNetObjectID > const teamOwners): |
236 | 31 | validators(), | 31 | validators(), |
237 | 32 | // monitorInfluences(), | ||
238 | 33 | // zoneInfluences(), | ||
239 | 34 | d_owners(owners), | 32 | d_owners(owners), |
240 | 35 | d_teamOwners(teamOwners), | 33 | d_teamOwners(teamOwners), |
241 | 36 | d_calculatedTargets() | 34 | d_calculatedTargets() |
242 | @@ -38,8 +36,6 @@ | |||
243 | 38 | 36 | ||
244 | 39 | zEffectGroup::zEffectGroup(zEffectGroup const &other) : | 37 | zEffectGroup::zEffectGroup(zEffectGroup const &other) : |
245 | 40 | validators(other.validators), | 38 | validators(other.validators), |
246 | 41 | // monitorInfluences(other.monitorInfluences), | ||
247 | 42 | // zoneInfluences(other.zoneInfluences), | ||
248 | 43 | d_owners(other.d_owners), | 39 | d_owners(other.d_owners), |
249 | 44 | d_teamOwners(other.d_teamOwners), | 40 | d_teamOwners(other.d_teamOwners), |
250 | 45 | d_calculatedTargets(other.d_calculatedTargets) | 41 | d_calculatedTargets(other.d_calculatedTargets) |
251 | 46 | 42 | ||
252 | === modified file 'src/tron/zone/zEffector.cpp' | |||
253 | --- src/tron/zone/zEffector.cpp 2009-02-26 19:57:28 +0000 | |||
254 | +++ src/tron/zone/zEffector.cpp 2009-02-27 18:21:24 +0000 | |||
255 | @@ -86,6 +86,9 @@ | |||
256 | 86 | */ | 86 | */ |
257 | 87 | } | 87 | } |
258 | 88 | 88 | ||
259 | 89 | void zEffector::applyContext(gParserState const &) { | ||
260 | 90 | } | ||
261 | 91 | |||
262 | 89 | void | 92 | void |
263 | 90 | zEffector::readXML(tXmlParser::node const & node) | 93 | zEffector::readXML(tXmlParser::node const & node) |
264 | 91 | { | 94 | { |
265 | @@ -291,17 +294,9 @@ | |||
266 | 291 | 294 | ||
267 | 292 | static zEffectorRegistration regSpawnPlayer("spawnplayer", "", zEffectorSpawnPlayer::create); | 295 | static zEffectorRegistration regSpawnPlayer("spawnplayer", "", zEffectorSpawnPlayer::create); |
268 | 293 | 296 | ||
280 | 294 | void | 297 | void zEffectorSpawnPlayer::applyContext(gParserState const & state) { |
281 | 295 | zEffectorSpawnPlayer::readXML(tXmlParser::node const & node) | 298 | setGrid( state.get<eGrid*>("grid") ); |
282 | 296 | { | 299 | setArena( state.get<gArena*>("arena") ); |
272 | 297 | // FIXME: Unique issue, we just care about context, not the node itself | ||
273 | 298 | // FIXME: Someday, this will need to be checked for the right arena/grid | ||
274 | 299 | |||
275 | 300 | gParser*parser = dynamic_cast<gParser*>(node.ownerDocument()); | ||
276 | 301 | assert(parser); | ||
277 | 302 | |||
278 | 303 | setGrid(parser->contextGrid(node)); | ||
279 | 304 | setArena(parser->contextArena(node)); | ||
283 | 305 | } | 300 | } |
284 | 306 | 301 | ||
285 | 307 | void zEffectorSpawnPlayer::effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets) | 302 | void zEffectorSpawnPlayer::effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets) |
286 | 308 | 303 | ||
287 | === modified file 'src/tron/zone/zEffector.h' | |||
288 | --- src/tron/zone/zEffector.h 2009-02-26 19:57:28 +0000 | |||
289 | +++ src/tron/zone/zEffector.h 2009-02-27 18:21:24 +0000 | |||
290 | @@ -41,6 +41,8 @@ | |||
291 | 41 | #include "tFunction.h" | 41 | #include "tFunction.h" |
292 | 42 | #include "tXmlParser.h" | 42 | #include "tXmlParser.h" |
293 | 43 | 43 | ||
294 | 44 | class gParserState; | ||
295 | 45 | |||
296 | 44 | class zEffector | 46 | class zEffector |
297 | 45 | { | 47 | { |
298 | 46 | public: | 48 | public: |
299 | @@ -54,6 +56,7 @@ | |||
300 | 54 | void apply(gVectorExtra<ePlayerNetID *> &d_calculatedTargets); | 56 | void apply(gVectorExtra<ePlayerNetID *> &d_calculatedTargets); |
301 | 55 | virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets) { }; | 57 | virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets) { }; |
302 | 56 | 58 | ||
303 | 59 | virtual void applyContext(gParserState const &); | ||
304 | 57 | virtual void readXML(tXmlParser::node const &); | 60 | virtual void readXML(tXmlParser::node const &); |
305 | 58 | 61 | ||
306 | 59 | void setCount(int _count) {count = _count;}; | 62 | void setCount(int _count) {count = _count;}; |
307 | @@ -245,7 +248,7 @@ | |||
308 | 245 | virtual zEffectorSpawnPlayer *copy(void) const { return new zEffectorSpawnPlayer(*this); }; | 248 | virtual zEffectorSpawnPlayer *copy(void) const { return new zEffectorSpawnPlayer(*this); }; |
309 | 246 | virtual ~zEffectorSpawnPlayer() {}; | 249 | virtual ~zEffectorSpawnPlayer() {}; |
310 | 247 | 250 | ||
312 | 248 | void readXML(tXmlParser::node const &); | 251 | void applyContext(gParserState const &); |
313 | 249 | 252 | ||
314 | 250 | void setGrid(eGrid *_grid) {grid = _grid;}; | 253 | void setGrid(eGrid *_grid) {grid = _grid;}; |
315 | 251 | void setArena(gArena *_arena) {arena = _arena;}; | 254 | void setArena(gArena *_arena) {arena = _arena;}; |
316 | 252 | 255 | ||
317 | === modified file 'src/tron/zone/zFortress.cpp' | |||
318 | --- src/tron/zone/zFortress.cpp 2009-02-27 03:35:38 +0000 | |||
319 | +++ src/tron/zone/zFortress.cpp 2009-02-27 08:58:49 +0000 | |||
320 | @@ -341,7 +341,10 @@ | |||
321 | 341 | { | 341 | { |
322 | 342 | int kills = int( sg_onConquestKillRatio * team->NumPlayers() ); | 342 | int kills = int( sg_onConquestKillRatio * team->NumPlayers() ); |
323 | 343 | kills = kills > sg_onConquestKillMin ? kills : sg_onConquestKillMin; | 343 | kills = kills > sg_onConquestKillMin ? kills : sg_onConquestKillMin; |
325 | 344 | eCoord pos = GetPosition(); | 344 | tCoord pos; |
326 | 345 | if (shape) | ||
327 | 346 | pos = shape->Position(); | ||
328 | 347 | // FIXME: What should we use for origin if there is no shape? | ||
329 | 345 | 348 | ||
330 | 346 | while ( kills > 0 ) | 349 | while ( kills > 0 ) |
331 | 347 | { | 350 | { |
332 | @@ -395,7 +398,14 @@ | |||
333 | 395 | { | 398 | { |
334 | 396 | if ( team ) | 399 | if ( team ) |
335 | 397 | { | 400 | { |
337 | 398 | sg_basezoneConqueredWriter << ePlayerNetID::FilterName(team->Name()) << GetPosition().x << GetPosition().y; | 401 | if (shape) |
338 | 402 | { | ||
339 | 403 | tCoord p = shape->Position(); | ||
340 | 404 | |||
341 | 405 | sg_basezoneConqueredWriter << ePlayerNetID::FilterName(team->Name()) << p.x << p.y; | ||
342 | 406 | } | ||
343 | 407 | else | ||
344 | 408 | sg_basezoneConqueredWriter << ePlayerNetID::FilterName(team->Name()); | ||
345 | 399 | sg_basezoneConqueredWriter.write(); | 409 | sg_basezoneConqueredWriter.write(); |
346 | 400 | } | 410 | } |
347 | 401 | if (shape) | 411 | if (shape) |
348 | @@ -553,7 +563,10 @@ | |||
349 | 553 | const tList<eGameObject>& gameObjects = Grid()->GameObjects(); | 563 | const tList<eGameObject>& gameObjects = Grid()->GameObjects(); |
350 | 554 | gCycle * closest = NULL; | 564 | gCycle * closest = NULL; |
351 | 555 | REAL closestDistance = 0; | 565 | REAL closestDistance = 0; |
353 | 556 | eCoord pos = GetPosition(); | 566 | tCoord pos; |
354 | 567 | if (shape) | ||
355 | 568 | pos = shape->Position(); | ||
356 | 569 | // FIXME: What should we use for origin if there is no shape? | ||
357 | 557 | for (int i=gameObjects.Len()-1;i>=0;i--) | 570 | for (int i=gameObjects.Len()-1;i>=0;i--) |
358 | 558 | { | 571 | { |
359 | 559 | gCycle *other=dynamic_cast<gCycle *>(gameObjects(i)); | 572 | gCycle *other=dynamic_cast<gCycle *>(gameObjects(i)); |
360 | 560 | 573 | ||
361 | === modified file 'src/tron/zone/zMisc.h' | |||
362 | --- src/tron/zone/zMisc.h 2007-06-08 21:17:35 +0000 | |||
363 | +++ src/tron/zone/zMisc.h 2009-02-27 18:30:44 +0000 | |||
364 | @@ -33,13 +33,4 @@ | |||
365 | 33 | return false; | 33 | return false; |
366 | 34 | } | 34 | } |
367 | 35 | 35 | ||
368 | 36 | /* | ||
369 | 37 | * HACK | ||
370 | 38 | * This is a very bad solution that hopefully will find a better design | ||
371 | 39 | * | ||
372 | 40 | * Basis for the "other" data that might be passed to an effect group | ||
373 | 41 | * ATM: only the value from the monitor is passed | ||
374 | 42 | * We use an auto_ptr so we can control if there is a value or not | ||
375 | 43 | */ | ||
376 | 44 | typedef boost::shared_ptr<REAL> miscDataPtr; | ||
377 | 45 | #endif | 36 | #endif |
378 | 46 | 37 | ||
379 | === modified file 'src/tron/zone/zSelector.cpp' | |||
380 | --- src/tron/zone/zSelector.cpp 2008-01-04 21:38:34 +0000 | |||
381 | +++ src/tron/zone/zSelector.cpp 2009-02-27 18:36:17 +0000 | |||
382 | @@ -839,29 +839,6 @@ | |||
383 | 839 | } | 839 | } |
384 | 840 | 840 | ||
385 | 841 | 841 | ||
386 | 842 | |||
387 | 843 | |||
388 | 844 | |||
389 | 845 | |||
390 | 846 | |||
391 | 847 | |||
392 | 848 | |||
393 | 849 | |||
394 | 850 | |||
395 | 851 | |||
396 | 852 | |||
397 | 853 | |||
398 | 854 | |||
399 | 855 | |||
400 | 856 | |||
401 | 857 | |||
402 | 858 | |||
403 | 859 | |||
404 | 860 | |||
405 | 861 | |||
406 | 862 | |||
407 | 863 | |||
408 | 864 | |||
409 | 865 | // | 842 | // |
410 | 866 | // Count the number of other alive players in the same team as thePlayer, ie: excluding thePlayer | 843 | // Count the number of other alive players in the same team as thePlayer, ie: excluding thePlayer |
411 | 867 | // | 844 | // |
412 | 868 | 845 | ||
413 | === modified file 'src/tron/zone/zShape.cpp' | |||
414 | --- src/tron/zone/zShape.cpp 2009-02-27 06:14:39 +0000 | |||
415 | +++ src/tron/zone/zShape.cpp 2009-02-27 09:12:12 +0000 | |||
416 | @@ -1,3 +1,4 @@ | |||
417 | 1 | #include "eSoundMixer.h" | ||
418 | 1 | #include "rScreen.h" | 2 | #include "rScreen.h" |
419 | 2 | #include "zShape.hpp" | 3 | #include "zShape.hpp" |
420 | 3 | #include "gCycle.h" | 4 | #include "gCycle.h" |
421 | @@ -143,6 +144,13 @@ | |||
422 | 143 | setScale( state.get<tFunction>("scale") ); | 144 | setScale( state.get<tFunction>("scale") ); |
423 | 144 | } | 145 | } |
424 | 145 | 146 | ||
425 | 147 | void | ||
426 | 148 | zShape::OnBirth() { | ||
427 | 149 | eSoundMixer* mixer = eSoundMixer::GetMixer(); | ||
428 | 150 | mixer->PushButton(ZONE_SPAWN, Position()); | ||
429 | 151 | } | ||
430 | 152 | |||
431 | 153 | |||
432 | 146 | REAL zShape::calcDistanceNear(tCoord & p) { | 154 | REAL zShape::calcDistanceNear(tCoord & p) { |
433 | 147 | return (findPointNear(p) - p).Norm(); | 155 | return (findPointNear(p) - p).Norm(); |
434 | 148 | } | 156 | } |
435 | @@ -216,6 +224,10 @@ | |||
436 | 216 | ); | 224 | ); |
437 | 217 | } | 225 | } |
438 | 218 | 226 | ||
439 | 227 | REAL zShape::GetCurrentScale() const { | ||
440 | 228 | return scale_.Evaluate(lasttime_ - referencetime_); | ||
441 | 229 | } | ||
442 | 230 | |||
443 | 219 | REAL zShape::GetEffectiveBottom() const { | 231 | REAL zShape::GetEffectiveBottom() const { |
444 | 220 | if (bottom_.Len()) | 232 | if (bottom_.Len()) |
445 | 221 | return bottom_.evaluate(lastTime); | 233 | return bottom_.evaluate(lastTime); |
446 | @@ -228,6 +240,12 @@ | |||
447 | 228 | return sz_zoneHeight; | 240 | return sz_zoneHeight; |
448 | 229 | } | 241 | } |
449 | 230 | 242 | ||
450 | 243 | tCoord zShape::GetRotation() const { | ||
451 | 244 | REAL currAngle = rotation2.evaluate(lasttime_); | ||
452 | 245 | tCoord rot( cos(currAngle), sin(currAngle) ); | ||
453 | 246 | return rot; | ||
454 | 247 | } | ||
455 | 248 | |||
456 | 231 | REAL zShape::GetRotationSpeed() { | 249 | REAL zShape::GetRotationSpeed() { |
457 | 232 | return getRotation2().evaluateRate(1, lasttime_); | 250 | return getRotation2().evaluateRate(1, lasttime_); |
458 | 233 | } | 251 | } |
459 | @@ -357,8 +375,7 @@ | |||
460 | 357 | if ( color_.a_ <= 0 ) | 375 | if ( color_.a_ <= 0 ) |
461 | 358 | return; | 376 | return; |
462 | 359 | 377 | ||
465 | 360 | REAL currAngle = rotation2.evaluate(lasttime_); | 378 | tCoord rot = GetRotation(); |
464 | 361 | eCoord rot( cos(currAngle), sin(currAngle) ); | ||
466 | 362 | 379 | ||
467 | 363 | GLfloat m[4][4]={{rot.x,rot.y,0,0}, | 380 | GLfloat m[4][4]={{rot.x,rot.y,0,0}, |
468 | 364 | {-rot.y,rot.x,0,0}, | 381 | {-rot.y,rot.x,0,0}, |
469 | @@ -444,8 +461,7 @@ | |||
470 | 444 | if ( color_.a_ <= 0 ) | 461 | if ( color_.a_ <= 0 ) |
471 | 445 | return; | 462 | return; |
472 | 446 | 463 | ||
475 | 447 | REAL currAngle = rotation2.evaluate(lasttime_); | 464 | tCoord rot = GetRotation(); |
474 | 448 | eCoord rot( cos(currAngle), sin(currAngle) ); | ||
476 | 449 | 465 | ||
477 | 450 | GLfloat m[4][4]={{rot.x,rot.y,0,0}, | 466 | GLfloat m[4][4]={{rot.x,rot.y,0,0}, |
478 | 451 | {-rot.y,rot.x,0,0}, | 467 | {-rot.y,rot.x,0,0}, |
479 | @@ -586,8 +602,7 @@ | |||
480 | 586 | REAL x_ = (*iter).first.Evaluate(lasttime_ - referencetime_); | 602 | REAL x_ = (*iter).first.Evaluate(lasttime_ - referencetime_); |
481 | 587 | REAL y_ = (*iter).second.Evaluate(lasttime_ - referencetime_); | 603 | REAL y_ = (*iter).second.Evaluate(lasttime_ - referencetime_); |
482 | 588 | tCoord centerPos = tCoord(posx_.Evaluate(lasttime_ - referencetime_), posy_.Evaluate(lasttime_ - referencetime_)); | 604 | tCoord centerPos = tCoord(posx_.Evaluate(lasttime_ - referencetime_), posy_.Evaluate(lasttime_ - referencetime_)); |
485 | 589 | // tCoord rotation = tCoord( cosf(rotation_.Evaluate(lasttime_ - referencetime_)), sinf(rotation_.Evaluate(lasttime_ - referencetime_)) ); | 605 | tCoord rotation = GetRotation(); |
484 | 590 | tCoord rotation = tCoord( cosf(rotation2.evaluate(lasttime_)), sinf(rotation2.evaluate(lasttime_)) ); | ||
486 | 591 | currentScale = scale_.Evaluate(lasttime_ - referencetime_); | 606 | currentScale = scale_.Evaluate(lasttime_ - referencetime_); |
487 | 592 | tCoord previous = tCoord(x_, y_).Turn( rotation )*currentScale + centerPos; | 607 | tCoord previous = tCoord(x_, y_).Turn( rotation )*currentScale + centerPos; |
488 | 593 | 608 | ||
489 | 594 | 609 | ||
490 | === modified file 'src/tron/zone/zShape.hpp' | |||
491 | --- src/tron/zone/zShape.hpp 2009-02-27 06:14:39 +0000 | |||
492 | +++ src/tron/zone/zShape.hpp 2009-02-27 09:12:12 +0000 | |||
493 | @@ -67,6 +67,7 @@ | |||
494 | 67 | tFunction getPosX() {return posx_;}; | 67 | tFunction getPosX() {return posx_;}; |
495 | 68 | tFunction getPosY() {return posy_;}; | 68 | tFunction getPosY() {return posy_;}; |
496 | 69 | tPolynomial getRotation2() { return rotation2; }; | 69 | tPolynomial getRotation2() { return rotation2; }; |
497 | 70 | REAL GetCurrentScale() const; | ||
498 | 70 | tFunction getScale() {return scale_;}; | 71 | tFunction getScale() {return scale_;}; |
499 | 71 | rColor getColor() {return color_;}; | 72 | rColor getColor() {return color_;}; |
500 | 72 | 73 | ||
501 | @@ -74,6 +75,7 @@ | |||
502 | 74 | REAL GetEffectiveHeight() const; | 75 | REAL GetEffectiveHeight() const; |
503 | 75 | 76 | ||
504 | 76 | //! shortcut rotation functions | 77 | //! shortcut rotation functions |
505 | 78 | tCoord GetRotation() const; | ||
506 | 77 | REAL GetRotationSpeed(); | 79 | REAL GetRotationSpeed(); |
507 | 78 | void SetRotationSpeed(REAL r); | 80 | void SetRotationSpeed(REAL r); |
508 | 79 | REAL GetRotationAcceleration(); | 81 | REAL GetRotationAcceleration(); |
509 | @@ -87,6 +89,10 @@ | |||
510 | 87 | virtual void setGrowth(REAL growth); //!< similar to old zones v1 setExpansionSpeed, but generic | 89 | virtual void setGrowth(REAL growth); //!< similar to old zones v1 setExpansionSpeed, but generic |
511 | 88 | virtual void collapse(REAL speed); //!< set growth such that collapse happens in a timeframe | 90 | virtual void collapse(REAL speed); //!< set growth such that collapse happens in a timeframe |
512 | 89 | 91 | ||
513 | 92 | private: | ||
514 | 93 | //! called immediately after the object is created, either right after round beginning or mid-game creation | ||
515 | 94 | virtual void OnBirth(); | ||
516 | 95 | |||
517 | 90 | public: // DEPRECATED -- DO NOT USE | 96 | public: // DEPRECATED -- DO NOT USE |
518 | 91 | void __deprecated render(const eCamera*cam) { Render(cam); } | 97 | void __deprecated render(const eCamera*cam) { Render(cam); } |
519 | 92 | void __deprecated render2d(tCoord&scale) { Render2D(scale); } | 98 | void __deprecated render2d(tCoord&scale) { Render2D(scale); } |
520 | @@ -103,8 +109,6 @@ | |||
521 | 103 | tPolynomial seglength_; //!< Length of each segment making up the zone | 109 | tPolynomial seglength_; //!< Length of each segment making up the zone |
522 | 104 | rColor color_; | 110 | rColor color_; |
523 | 105 | 111 | ||
524 | 106 | eCoord Position() { return eCoord(posx_(lastTime - referencetime_), posy_(lastTime - referencetime_) ); }; | ||
525 | 107 | |||
526 | 108 | void setCreatedTime(REAL time); | 112 | void setCreatedTime(REAL time); |
527 | 109 | 113 | ||
528 | 110 | REAL createdtime_; // The in-game time when this shape was first instantiated | 114 | REAL createdtime_; // The in-game time when this shape was first instantiated |
529 | 111 | 115 | ||
530 | === modified file 'src/tron/zone/zTimedZone.cpp' | |||
531 | --- src/tron/zone/zTimedZone.cpp 2009-02-26 22:20:40 +0000 | |||
532 | +++ src/tron/zone/zTimedZone.cpp 2009-02-27 18:38:14 +0000 | |||
533 | @@ -70,14 +70,5 @@ | |||
534 | 70 | 70 | ||
535 | 71 | zone->setShape( shape ); | 71 | zone->setShape( shape ); |
536 | 72 | 72 | ||
537 | 73 | /* TODO FIXME | ||
538 | 74 | // initialize radius and expansion speed | ||
539 | 75 | static_cast<eGameObject*>(ret)->Timestep( se_GameTime() ); | ||
540 | 76 | ret->SetReferenceTime(); | ||
541 | 77 | ret->SetRadius( sg_initialSize ); | ||
542 | 78 | ret->SetExpansionSpeed( sg_expansionSpeed ); | ||
543 | 79 | ret->SetRotationSpeed( .3f ); | ||
544 | 80 | */ | ||
545 | 81 | |||
546 | 82 | return zone; | 73 | return zone; |
547 | 83 | } | 74 | } |
548 | 84 | 75 | ||
549 | === modified file 'src/tron/zone/zZone.cpp' | |||
550 | --- src/tron/zone/zZone.cpp 2009-02-27 03:53:07 +0000 | |||
551 | +++ src/tron/zone/zZone.cpp 2009-02-27 09:12:12 +0000 | |||
552 | @@ -39,7 +39,6 @@ | |||
553 | 39 | #include "nConfig.h" | 39 | #include "nConfig.h" |
554 | 40 | #include "tString.h" | 40 | #include "tString.h" |
555 | 41 | #include "rScreen.h" | 41 | #include "rScreen.h" |
556 | 42 | #include "eSoundMixer.h" | ||
557 | 43 | #include "tPolynomial.h" | 42 | #include "tPolynomial.h" |
558 | 44 | 43 | ||
559 | 45 | 44 | ||
560 | @@ -61,9 +60,6 @@ | |||
561 | 61 | 60 | ||
562 | 62 | std::deque<zZone *> sz_Zones; | 61 | std::deque<zZone *> sz_Zones; |
563 | 63 | 62 | ||
564 | 64 | // number of segments to render a zone with | ||
565 | 65 | static const int sg_segments = 11; | ||
566 | 66 | |||
567 | 67 | // ******************************************************************************* | 63 | // ******************************************************************************* |
568 | 68 | // * | 64 | // * |
569 | 69 | // * EvaluateFunctionNow | 65 | // * EvaluateFunctionNow |
570 | @@ -115,7 +111,6 @@ | |||
571 | 115 | effectGroupOutside(), | 111 | effectGroupOutside(), |
572 | 116 | playersInside(), | 112 | playersInside(), |
573 | 117 | playersOutside(), | 113 | playersOutside(), |
574 | 118 | oldFortressAutomaticAssignmentBehavior_(false), | ||
575 | 119 | name_() | 114 | name_() |
576 | 120 | { | 115 | { |
577 | 121 | // store creation time | 116 | // store creation time |
578 | @@ -125,11 +120,6 @@ | |||
579 | 125 | this->AddToList(); | 120 | this->AddToList(); |
580 | 126 | 121 | ||
581 | 127 | sz_Zones.push_back(this); | 122 | sz_Zones.push_back(this); |
582 | 128 | |||
583 | 129 | // initialize position functions | ||
584 | 130 | // SetPosition( pos ); | ||
585 | 131 | eSoundMixer* mixer = eSoundMixer::GetMixer(); | ||
586 | 132 | mixer->PushButton(ZONE_SPAWN, pos); | ||
587 | 133 | } | 123 | } |
588 | 134 | 124 | ||
589 | 135 | static nVersionFeature sz_ShapedZones(20); | 125 | static nVersionFeature sz_ShapedZones(20); |
590 | @@ -149,25 +139,16 @@ | |||
591 | 149 | //rotation_(1,0), | 139 | //rotation_(1,0), |
592 | 150 | playersInside(), | 140 | playersInside(), |
593 | 151 | playersOutside(), | 141 | playersOutside(), |
594 | 152 | oldFortressAutomaticAssignmentBehavior_(false), | ||
595 | 153 | name_() | 142 | name_() |
596 | 154 | { | 143 | { |
597 | 155 | // read creation time | 144 | // read creation time |
598 | 156 | createTime_ = sync.create_time(); | 145 | createTime_ = sync.create_time(); |
599 | 157 | referenceTime_ = lastTime = createTime_; | 146 | referenceTime_ = lastTime = createTime_; |
600 | 158 | 147 | ||
601 | 159 | // initialize color to white, ReadSync will fill in the true value if available | ||
602 | 160 | // color_.r_ = color_.g_ = color_.b_ = 1.0f; | ||
603 | 161 | |||
604 | 162 | // add to game grid | 148 | // add to game grid |
605 | 163 | this->AddToList(); | 149 | this->AddToList(); |
606 | 164 | 150 | ||
607 | 165 | sz_Zones.push_back(this); | 151 | sz_Zones.push_back(this); |
608 | 166 | |||
609 | 167 | // initialize position functions | ||
610 | 168 | // SetPosition( pos ); | ||
611 | 169 | eSoundMixer* mixer = eSoundMixer::GetMixer(); | ||
612 | 170 | mixer->PushButton(ZONE_SPAWN, pos); | ||
613 | 171 | } | 152 | } |
614 | 172 | 153 | ||
615 | 173 | // ******************************************************************************* | 154 | // ******************************************************************************* |
616 | @@ -319,31 +300,6 @@ | |||
617 | 319 | 300 | ||
618 | 320 | bool zZone::Timestep( REAL time ) | 301 | bool zZone::Timestep( REAL time ) |
619 | 321 | { | 302 | { |
620 | 322 | /* | ||
621 | 323 | if(!emulateOldZoneShape) { | ||
622 | 324 | shape->TimeStep( time ); | ||
623 | 325 | } | ||
624 | 326 | else { // Old representation of zone | ||
625 | 327 | // rotate | ||
626 | 328 | REAL speed = GetRotationSpeed(); | ||
627 | 329 | REAL angle = ( time - lastTime ) * speed; | ||
628 | 330 | // angle /= ( 1 + 2 * 3.14159 * angle/sg_segments ); | ||
629 | 331 | rotation_ = rotation_.Turn( cos( angle ), sin( angle ) ); | ||
630 | 332 | |||
631 | 333 | // move to new position | ||
632 | 334 | REAL dt = time - referenceTime_; | ||
633 | 335 | Move( eCoord( posx_( dt ), posy_( dt ) ), lastTime, time ); | ||
634 | 336 | |||
635 | 337 | |||
636 | 338 | // kill this zone if it shrunk down to zero scale | ||
637 | 339 | if ( GetExpansionSpeed() < 0 && GetScale() <= 0 ) | ||
638 | 340 | { | ||
639 | 341 | OnVanish(); | ||
640 | 342 | return true; | ||
641 | 343 | } | ||
642 | 344 | } | ||
643 | 345 | // update time | ||
644 | 346 | */ | ||
645 | 347 | lastTime = time; | 303 | lastTime = time; |
646 | 348 | 304 | ||
647 | 349 | return false; | 305 | return false; |
648 | @@ -519,24 +475,6 @@ | |||
649 | 519 | return zone_init; | 475 | return zone_init; |
650 | 520 | } | 476 | } |
651 | 521 | 477 | ||
652 | 522 | /* | ||
653 | 523 | // ******************************************************************************* | ||
654 | 524 | // * | ||
655 | 525 | // * Scale | ||
656 | 526 | // * | ||
657 | 527 | // ******************************************************************************* | ||
658 | 528 | //! | ||
659 | 529 | //! @return | ||
660 | 530 | //! | ||
661 | 531 | // ******************************************************************************* | ||
662 | 532 | |||
663 | 533 | REAL zZone::Scale( void ) const | ||
664 | 534 | { | ||
665 | 535 | // return GetScale(); | ||
666 | 536 | return shape->getScale(); | ||
667 | 537 | } | ||
668 | 538 | */ | ||
669 | 539 | |||
670 | 540 | 478 | ||
671 | 541 | // ******************************************************************************* | 479 | // ******************************************************************************* |
672 | 542 | // * | 480 | // * |
673 | @@ -571,8 +509,7 @@ | |||
674 | 571 | zZone const & zZone::GetPosition( eCoord & position ) const | 509 | zZone const & zZone::GetPosition( eCoord & position ) const |
675 | 572 | { | 510 | { |
676 | 573 | if(0 != shape) { | 511 | if(0 != shape) { |
679 | 574 | position.x = EvaluateFunctionNow( shape->getPosX() ); | 512 | position = shape->Position(); |
678 | 575 | position.y = EvaluateFunctionNow( shape->getPosY() ); | ||
680 | 576 | } | 513 | } |
681 | 577 | return *this; | 514 | return *this; |
682 | 578 | } | 515 | } |
683 | @@ -589,15 +526,11 @@ | |||
684 | 589 | 526 | ||
685 | 590 | REAL zZone::GetScale( void ) const | 527 | REAL zZone::GetScale( void ) const |
686 | 591 | { | 528 | { |
687 | 592 | // REAL ret = EvaluateFunctionNow( this->scale_ ); | ||
688 | 593 | // ret = ret > 0 ? ret : 0; | ||
689 | 594 | |||
690 | 595 | |||
691 | 596 | // HACK, to be implemented later and differently | 529 | // HACK, to be implemented later and differently |
692 | 597 | // Should get this info from the shape, not the zone | 530 | // Should get this info from the shape, not the zone |
693 | 598 | REAL scale = 0.0; | 531 | REAL scale = 0.0; |
694 | 599 | if(0 != shape) { | 532 | if(0 != shape) { |
696 | 600 | scale = EvaluateFunctionNow( shape->getScale() ) ; | 533 | scale = shape->GetCurrentScale(); |
697 | 601 | } | 534 | } |
698 | 602 | return scale; | 535 | return scale; |
699 | 603 | } | 536 | } |
700 | @@ -613,14 +546,6 @@ | |||
701 | 613 | 546 | ||
702 | 614 | void zZone::SetReferenceTime( void ) | 547 | void zZone::SetReferenceTime( void ) |
703 | 615 | { | 548 | { |
704 | 616 | // set offsets to current values | ||
705 | 617 | /* | ||
706 | 618 | this->posx_.SetOffset( EvaluateFunctionNow( this->posx_ ) ); | ||
707 | 619 | this->posy_.SetOffset( EvaluateFunctionNow( this->posy_ ) ); | ||
708 | 620 | this->scale_.SetOffset( EvaluateFunctionNow( this->scale_ ) ); | ||
709 | 621 | this->rotationSpeed_.SetOffset( EvaluateFunctionNow( this->rotationSpeed_ ) ); | ||
710 | 622 | */ | ||
711 | 623 | |||
712 | 624 | // FIXME: zZone didn't originally do this, but it is added for compat w/ | 549 | // FIXME: zZone didn't originally do this, but it is added for compat w/ |
713 | 625 | // Zones v1 porting; nothing in zones v2 seems to actually use this | 550 | // Zones v1 porting; nothing in zones v2 seems to actually use this |
714 | 626 | // function | 551 | // function |
715 | @@ -645,7 +570,9 @@ | |||
716 | 645 | { | 570 | { |
717 | 646 | // HACK, to be implemented later and differently | 571 | // HACK, to be implemented later and differently |
718 | 647 | // Should get this info from the shape, not the zone | 572 | // Should get this info from the shape, not the zone |
719 | 573 | if (!shape) | ||
720 | 648 | return tCoord(0.0, 0.0); | 574 | return tCoord(0.0, 0.0); |
721 | 575 | return shape->GetRotation(); | ||
722 | 649 | } | 576 | } |
723 | 650 | 577 | ||
724 | 651 | // ******************************************************************************* | 578 | // ******************************************************************************* |
725 | 652 | 579 | ||
726 | === modified file 'src/tron/zone/zZone.h' | |||
727 | --- src/tron/zone/zZone.h 2009-02-26 19:57:28 +0000 | |||
728 | +++ src/tron/zone/zZone.h 2009-02-27 09:02:54 +0000 | |||
729 | @@ -44,34 +44,9 @@ | |||
730 | 44 | 44 | ||
731 | 45 | class gParserState; | 45 | class gParserState; |
732 | 46 | 46 | ||
761 | 47 | /* | 47 | class zZone: public eNetGameObject |
762 | 48 | class zZone: public eNetGameObject | 48 | { |
763 | 49 | { | 49 | private: |
736 | 50 | zZone(eGrid *grid); //!< local constructor | ||
737 | 51 | zZone(nMessage &m); //!< network constructor | ||
738 | 52 | ~zZone(); //!< destructor | ||
739 | 53 | |||
740 | 54 | void SetReferenceTime(); //!< sets the reference time to the current time | ||
741 | 55 | |||
742 | 56 | protected: | ||
743 | 57 | virtual bool Timestep(REAL currentTime); //!< simulates behaviour up to currentTime | ||
744 | 58 | virtual void OnVanish(); //!< called when the zone vanishes | ||
745 | 59 | private: | ||
746 | 60 | virtual void WriteCreate(nMessage &m); //!< writes data for network constructor | ||
747 | 61 | virtual void WriteSync(nMessage &m); //!< writes sync data | ||
748 | 62 | virtual void ReadSync(nMessage &m); //!< reads sync data | ||
749 | 63 | |||
750 | 64 | virtual void InteractWith( eGameObject *target,REAL time,int recursion=1 ); //!< looks for objects inzide the zone and reacts on them | ||
751 | 65 | virtual nDescriptor& CreatorDescriptor() const; //!< returns the descriptor to recreate this object over the network | ||
752 | 66 | |||
753 | 67 | virtual void Render(const eCamera *cam); //!< renders the zone | ||
754 | 68 | } | ||
755 | 69 | */ | ||
756 | 70 | |||
757 | 71 | class zZone: public eNetGameObject | ||
758 | 72 | { | ||
759 | 73 | private: | ||
760 | 74 | // TODO FIXME \ | ||
764 | 75 | void*pos; //!< pos is not valid for zones | 50 | void*pos; //!< pos is not valid for zones |
765 | 76 | public: // DEPRECATED methods: please do NOT use in new code, and REPLACE in old code | 51 | public: // DEPRECATED methods: please do NOT use in new code, and REPLACE in old code |
766 | 77 | REAL __deprecated GetRotationSpeed(); | 52 | REAL __deprecated GetRotationSpeed(); |
767 | @@ -100,32 +75,11 @@ | |||
768 | 100 | virtual void setupVisuals(gParserState &); | 75 | virtual void setupVisuals(gParserState &); |
769 | 101 | virtual void readXML(tXmlParser::node const &); | 76 | virtual void readXML(tXmlParser::node const &); |
770 | 102 | 77 | ||
797 | 103 | eCoord GetPosition ( void ) const; //!< Gets the current position | 78 | eCoord __deprecated GetPosition ( void ) const; //!< Gets the current position |
798 | 104 | zZone const & GetPosition ( eCoord & position ) const; //!< Gets the current position | 79 | zZone const & __deprecated GetPosition ( eCoord & position ) const; //!< Gets the current position |
799 | 105 | tCoord const GetRotation ( void ) const; //!< Gets the current rotation state | 80 | tCoord const __deprecated GetRotation ( void ) const; //!< Gets the current rotation state |
800 | 106 | REAL GetScale ( void ) const; //!< Gets the current scale | 81 | REAL __deprecated GetScale ( void ) const; //!< Gets the current scale |
801 | 107 | rColor const GetColor( void ) const; //!< Gets the current color | 82 | rColor const __deprecated GetColor( void ) const; //!< Gets the current color |
776 | 108 | /* | ||
777 | 109 | zZone & SetPosition ( eCoord const & position ); //!< Sets the current position | ||
778 | 110 | zZone & SetVelocity ( eCoord const & velocity ); //!< Sets the current velocity | ||
779 | 111 | eCoord GetVelocity ( void ) const; //!< Gets the current velocity | ||
780 | 112 | zZone const & GetVelocity ( eCoord & velocity ) const; //!< Gets the current velocity | ||
781 | 113 | zZone & SetScale ( REAL scale ); //!< Sets the current scale | ||
782 | 114 | REAL GetScale ( void ) const; //!< Gets the current scale | ||
783 | 115 | zZone const & GetScale ( REAL & scale ) const; //!< Gets the current scale | ||
784 | 116 | zZone & SetExpansionSpeed ( REAL expansionSpeed ); //!< Sets the current expansion speed | ||
785 | 117 | REAL GetExpansionSpeed ( void ) const; //!< Gets the current expansion speed | ||
786 | 118 | zZone const & GetExpansionSpeed ( REAL & expansionSpeed ) const;//!< Gets the current expansion speed | ||
787 | 119 | zZone & SetRotationSpeed ( REAL rotationSpeed ); //!< Sets the current rotation speed | ||
788 | 120 | REAL GetRotationSpeed ( void ) const; //!< Gets the current rotation speed | ||
789 | 121 | tCoord const & GetRotation ( void ) const; //!< Gets the current rotation state | ||
790 | 122 | zZone const & GetRotationSpeed ( REAL & rotationSpeed ) const; //!< Gets the current rotation speed | ||
791 | 123 | zZone & SetRotationAcceleration( REAL rotationAcceleration ); //!< Sets the current acceleration of the rotation | ||
792 | 124 | REAL GetRotationAcceleration( void ) const; //!< Gets the current acceleration of the rotation | ||
793 | 125 | zZone const & GetRotationAcceleration( REAL & rotationAcceleration ) const; //!< Gets the current acceleration of the rotation | ||
794 | 126 | rColor const & GetColor( void ) const; //!< Gets the current color | ||
795 | 127 | void SetColor( rColor const & color ); //!< Sets the current color | ||
796 | 128 | */ | ||
802 | 129 | 83 | ||
803 | 130 | void addEffectGroupEnter (zEffectGroupPtr anEffectGroup) {effectGroupEnter.push_back (anEffectGroup);}; | 84 | void addEffectGroupEnter (zEffectGroupPtr anEffectGroup) {effectGroupEnter.push_back (anEffectGroup);}; |
804 | 131 | void addEffectGroupInside (zEffectGroupPtr anEffectGroup) {effectGroupInside.push_back (anEffectGroup);}; | 85 | void addEffectGroupInside (zEffectGroupPtr anEffectGroup) {effectGroupInside.push_back (anEffectGroup);}; |
805 | @@ -135,30 +89,14 @@ | |||
806 | 135 | void setShape (zShapePtr aShape) { shape = aShape; }; | 89 | void setShape (zShapePtr aShape) { shape = aShape; }; |
807 | 136 | zShapePtr getShape() { return shape; }; | 90 | zShapePtr getShape() { return shape; }; |
808 | 137 | 91 | ||
809 | 138 | // HACK | ||
810 | 139 | // Enables fortress described in maps from format 1 to be assigned to a team according to the old behavior | ||
811 | 140 | void setOldFortressAutomaticAssignmentBehavior(bool oldFortressAutomaticAssignmentBehavior) | ||
812 | 141 | { | ||
813 | 142 | oldFortressAutomaticAssignmentBehavior_ = oldFortressAutomaticAssignmentBehavior; | ||
814 | 143 | }; | ||
815 | 144 | bool getOldFortressAutomaticAssignmentBehavior() { return oldFortressAutomaticAssignmentBehavior_; }; | ||
816 | 145 | |||
817 | 146 | void setName(string name) {name_ = name;}; | 92 | void setName(string name) {name_ = name;}; |
818 | 147 | string getName() { return name_; }; | 93 | string getName() { return name_; }; |
819 | 148 | 94 | ||
820 | 149 | protected: | 95 | protected: |
821 | 150 | // rColor color_; //!< the zone's color | ||
822 | 151 | REAL createTime_; //!< the time the zone was created at | 96 | REAL createTime_; //!< the time the zone was created at |
823 | 152 | zShapePtr shape; //!< the shape(s) of this zone | 97 | zShapePtr shape; //!< the shape(s) of this zone |
824 | 153 | 98 | ||
825 | 154 | REAL referenceTime_; //!< reference time for function evaluations | 99 | REAL referenceTime_; //!< reference time for function evaluations |
826 | 155 | /* | ||
827 | 156 | tFunction posx_; //!< time dependence of x component of position | ||
828 | 157 | tFunction posy_; //!< time dependence of y component of position | ||
829 | 158 | tFunction scale_; //!< time dependence of scale | ||
830 | 159 | tFunction rotationSpeed_; //!< the zone's rotation speed | ||
831 | 160 | eCoord rotation_; //!< the current rotation state | ||
832 | 161 | */ | ||
833 | 162 | 100 | ||
834 | 163 | virtual bool Timestep(REAL currentTime); //!< simulates behaviour up to currentTime | 101 | virtual bool Timestep(REAL currentTime); //!< simulates behaviour up to currentTime |
835 | 164 | virtual void OnVanish(); //!< called when the zone vanishes | 102 | virtual void OnVanish(); //!< called when the zone vanishes |
836 | @@ -183,15 +121,11 @@ | |||
837 | 183 | //! returns the descriptor responsible for this class | 121 | //! returns the descriptor responsible for this class |
838 | 184 | virtual nNetObjectDescriptorBase const & DoGetDescriptor() const; | 122 | virtual nNetObjectDescriptorBase const & DoGetDescriptor() const; |
839 | 185 | 123 | ||
844 | 186 | // REAL Scale() const; //!< returns the current scale | 124 | inline REAL __deprecated EvaluateFunctionNow( tFunction const & f ) const; //!< evaluates the given function with lastTime - referenceTime_ as argument |
845 | 187 | 125 | inline void __deprecated SetFunctionNow( tFunction & f, REAL value ) const; //!< makes sure EvaluateFunctionNow() returns the given value | |
842 | 188 | inline REAL EvaluateFunctionNow( tFunction const & f ) const; //!< evaluates the given function with lastTime - referenceTime_ as argument | ||
843 | 189 | inline void SetFunctionNow( tFunction & f, REAL value ) const; //!< makes sure EvaluateFunctionNow() returns the given value | ||
846 | 190 | 126 | ||
847 | 191 | void RemoveFromZoneList(void); //!< Removes the zone from the sg_Zones list if it's there | 127 | void RemoveFromZoneList(void); //!< Removes the zone from the sg_Zones list if it's there |
848 | 192 | 128 | ||
849 | 193 | bool oldFortressAutomaticAssignmentBehavior_; | ||
850 | 194 | |||
851 | 195 | string name_; | 129 | string name_; |
852 | 196 | 130 | ||
853 | 197 | }; | 131 | }; |