Merge lp:~luke-jr/armagetronad/armagetronad-map-zone-visuals into lp:~armagetronad-dev/armagetronad/trunk-armagetronad-work

Proposed by Luke-Jr
Status: Work in progress
Proposed branch: lp:~luke-jr/armagetronad/armagetronad-map-zone-visuals
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-map-zone-visuals
Reviewer Review Type Date Requested Status
Manuel Moos Needs Fixing
Review via email: mp+4037@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Manuel Moos (z-man) wrote :

Nice. However, I don't think time dependant segment count is a good thing to have. The transitions just look wrong. Can we get rid of that and just have it a constant integer?

review: Needs Fixing
Revision history for this message
Luke-Jr (luke-jr) wrote :

How does it hurt? If it's just compatibility, the safest route would be to block it in the DTD if possible.

Revision history for this message
Manuel Moos (z-man) wrote :

It's just ugly, both visually and technically :) Visuals should not jump around like that, it takes the player's focus away from actually important things. And on the technical side, the number of segments IS an integer.

And yeah, I should have complained about that in the previous merge where the network sync for that was introduced already. My bad. Luckily, at this point, with no release containing the code, it's perfectly fine to switch the network type to an integer.

Unmerged revisions

874. By Luke-Jr

flyingzones test/demo map

873. By Luke-Jr

fix a few issues

872. By Luke-Jr

allow maps to set bottom, height, segments, and seglength attributes on shapes

871. By Luke-Jr

copied from map-0.3.1-c.dtd

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'resource/proto/AATeam/map-0.3.2-prealpha1.dtd'
2--- resource/proto/AATeam/map-0.3.2-prealpha1.dtd 1970-01-01 00:00:00 +0000
3+++ resource/proto/AATeam/map-0.3.2-prealpha1.dtd 2009-02-28 18:38:10 +0000
4@@ -0,0 +1,179 @@
5+<!-- version="0.3.2-prealpha1" -->
6+<!ELEMENT Resource (Map)>
7+
8+<!ATTLIST Resource
9+ type (aamap) "aamap"
10+ name CDATA #REQUIRED
11+ version CDATA "1.0"
12+ author CDATA "Anonymous"
13+ category CDATA "unsorted"
14+ comissioner CDATA #IMPLIED
15+>
16+
17+<!ELEMENT Map (Settings?, World)>
18+
19+<!ELEMENT Settings (Setting*)>
20+<!ELEMENT Setting EMPTY>
21+<!ATTLIST Setting name CDATA #REQUIRED>
22+<!ATTLIST Setting value CDATA #REQUIRED>
23+
24+<!-- ATM, a map contain only one Field -->
25+<!ELEMENT World (Field)>
26+<!-- a field
27+ - may have an axes declared
28+ - need at least one spawn
29+ - need at least one wall -->
30+<!ELEMENT Field (Axes?, Ownership?, (Spawn | Wall | Monitor | Zone | Zone_v1 )*)>
31+
32+<!ELEMENT Axes (Axis*)>
33+<!ELEMENT Ownership (TeamOwnership*)>
34+<!ELEMENT Spawn EMPTY>
35+<!ELEMENT Wall (Point+) >
36+<!ELEMENT Point EMPTY>
37+<!ELEMENT Axis EMPTY>
38+<!ELEMENT Zone ((ShapeCircle | ShapePolygon), (Enter | Inside | Leave | Outside)+ ) >
39+
40+<!ATTLIST Map version CDATA #REQUIRED>
41+
42+<!ATTLIST Field logicalBox (true | false) "true">
43+
44+<!ATTLIST Axes number CDATA "4">
45+<!ATTLIST Axes normalize (true | false) "true">
46+
47+<!ATTLIST Spawn x CDATA #REQUIRED>
48+<!ATTLIST Spawn y CDATA #REQUIRED>
49+<!ATTLIST Spawn xdir CDATA #IMPLIED>
50+<!ATTLIST Spawn ydir CDATA #IMPLIED>
51+<!ATTLIST Spawn angle CDATA #IMPLIED>
52+<!ATTLIST Spawn length CDATA "1.0">
53+
54+<!ATTLIST Wall height CDATA #IMPLIED>
55+
56+<!ATTLIST Point x CDATA #REQUIRED>
57+<!ATTLIST Point y CDATA #REQUIRED>
58+
59+<!ATTLIST Axis xdir CDATA #IMPLIED>
60+<!ATTLIST Axis ydir CDATA #IMPLIED>
61+<!ATTLIST Axis angle CDATA #IMPLIED>
62+<!ATTLIST Axis length CDATA "1.0">
63+
64+
65+<!ATTLIST Zone name CDATA "">
66+
67+<!ELEMENT Monitor (OnOver | OnUnder | InRange | OutsideRange)+ >
68+<!ATTLIST Monitor name CDATA #REQUIRED>
69+<!ATTLIST Monitor init CDATA "0.0">
70+<!ATTLIST Monitor drift CDATA "0.0">
71+<!ATTLIST Monitor low CDATA "0.0">
72+<!ATTLIST Monitor high CDATA "1.0">
73+
74+<!ELEMENT OnOver (EffectGroup | ZoneInfluence | MonitorInfluence)+ >
75+<!ATTLIST OnOver value CDATA #REQUIRED>
76+
77+<!ELEMENT OnUnder (EffectGroup | ZoneInfluence | MonitorInfluence)+ >
78+<!ATTLIST OnUnder value CDATA #REQUIRED>
79+
80+<!ELEMENT InRange (EffectGroup | ZoneInfluence | MonitorInfluence)+ >
81+<!ATTLIST InRange low CDATA #REQUIRED>
82+<!ATTLIST InRange high CDATA #REQUIRED>
83+
84+<!ELEMENT OutsideRange (EffectGroup | ZoneInfluence | MonitorInfluence)+ >
85+<!ATTLIST OutsideRange low CDATA #REQUIRED>
86+<!ATTLIST OutsideRange high CDATA #REQUIRED>
87+
88+
89+<!ELEMENT ShapeCircle (Point, Color?)>
90+<!ATTLIST ShapeCircle bottom CDATA "0.0">
91+<!ATTLIST ShapeCircle scale CDATA "1.0">
92+<!ATTLIST ShapeCircle height CDATA "5.0">
93+<!ATTLIST ShapeCircle growth CDATA #IMPLIED>
94+<!ATTLIST ShapeCircle rotation CDATA "0.0">
95+<!ATTLIST ShapeCircle segments CDATA #IMPLIED>
96+<!ATTLIST ShapeCircle seglength CDATA #IMPLIED>
97+<!ATTLIST ShapeCircle radius CDATA "1.0">
98+
99+<!ELEMENT ShapePolygon (Point, Color, Point+)>
100+<!ATTLIST ShapePolygon bottom CDATA "0.0">
101+<!ATTLIST ShapePolygon scale CDATA "1.0">
102+<!ATTLIST ShapePolygon height CDATA "5.0">
103+<!ATTLIST ShapePolygon growth CDATA #IMPLIED>
104+<!ATTLIST ShapePolygon rotation CDATA "0.0">
105+
106+<!ELEMENT Color EMPTY>
107+<!ATTLIST Color red CDATA "1.0">
108+<!ATTLIST Color green CDATA "0.0">
109+<!ATTLIST Color blue CDATA "0.0">
110+<!ATTLIST Color alpha CDATA "0.7">
111+<!ATTLIST Color hexCode CDATA #IMPLIED>
112+<!ATTLIST Color name CDATA #IMPLIED>
113+
114+
115+<!ELEMENT Enter (EffectGroup+) >
116+<!ELEMENT Inside (EffectGroup+) >
117+<!ELEMENT Leave (EffectGroup+) >
118+<!ELEMENT Outside (EffectGroup+) >
119+
120+<!ELEMENT EffectGroup (User)>
121+<!ATTLIST EffectGroup owners CDATA #IMPLIED>
122+<!ATTLIST EffectGroup teamOwners CDATA #IMPLIED>
123+
124+<!ELEMENT User (Target | MonitorInfluence | ZoneInfluence)+ >
125+<!ATTLIST User user (all | owner | ownerTeam | allButOwner | allButTeamOwner | anotherTeammate) "all" >
126+<!ATTLIST User positive (true | false | ignore) "ignore" >
127+<!ATTLIST User marked (true | false | ignore) "ignore" >
128+
129+
130+<!ELEMENT Target (Effect)+ >
131+<!ATTLIST Target target (self | teammate | team | all | allButSelf |
132+ another |
133+owner | ownerTeam | ownerTeamTeammate | anyDead |
134+allDead | anotherTeammateDead | anotherNotTeammateDead |
135+singleDeadOwner
136+) "self" >
137+<!--
138+<!ATTLIST Target target (self | teammate | team | all | allButSelf |
139+allButTeam | another | anotherTeam | anotherTeammate |
140+anotherNotTeammate | owner | ownerTeam | ownerTeamTeammate | anyDead |
141+allDead | AnotherTeammateDead | anotherNotTeammateDead) "self" >
142+-->
143+<!ATTLIST Target count CDATA "-1">
144+
145+
146+<!ELEMENT Effect EMPTY>
147+<!ATTLIST Effect effect (win | death | point | brakerecharge |
148+rubberrecharge | acceleration | spawnplayer | setting ) "death" >
149+<!ATTLIST Effect count CDATA "-1">
150+<!ATTLIST Effect description CDATA #IMPLIED>
151+<!ATTLIST Effect score CDATA "1"> <!-- only for point -->
152+<!ATTLIST Effect settingName CDATA #IMPLIED> <!-- only for setting -->
153+<!ATTLIST Effect settingValue CDATA #IMPLIED><!-- only for setting -->
154+<!ATTLIST Effect value CDATA "0"> <!-- only for acceleration atm, but should be for nearly all -->
155+
156+<!ELEMENT MonitorInfluence EMPTY>
157+<!ATTLIST MonitorInfluence name CDATA #IMPLIED>
158+<!ATTLIST MonitorInfluence marked (true | false | ignore) "ignore">
159+<!ATTLIST MonitorInfluence influence CDATA #IMPLIED>
160+<!ATTLIST MonitorInfluence influenceSlide CDATA "0.0"> <!-- deprecated as of rev 8042 -->
161+<!ATTLIST MonitorInfluence influenceAdd CDATA "0.0"> <!-- deprecated as of rev 8042 -->
162+<!ATTLIST MonitorInfluence influenceSet CDATA "0.0"> <!-- deprecated as of rev 8042 -->
163+
164+<!ELEMENT ZoneInfluence (Rotation | Scale | Point | Color)+ >
165+<!ATTLIST ZoneInfluence name CDATA #IMPLIED>
166+
167+<!ELEMENT Rotation EMPTY>
168+<!ATTLIST Rotation rotation CDATA #IMPLIED>
169+<!ATTLIST Rotation rotationAngle CDATA "0.0"> <!-- deprecated as of rev 8042 -->
170+<!ATTLIST Rotation rotationSpeed CDATA "0.0"> <!-- deprecated as of rev 8042 -->
171+
172+<!ELEMENT Scale EMPTY>
173+<!ATTLIST Scale scale CDATA "1.0">
174+
175+<!ELEMENT TeamOwnership EMPTY>
176+<!ATTLIST TeamOwnership teamId CDATA #REQUIRED>
177+<!ATTLIST TeamOwnership playerId CDATA #IMPLIED>
178+
179+<!ELEMENT Zone_v1 (ShapeCircle) >
180+<!ATTLIST Zone_v1 effect (win | death | fortress ) "death" >
181+
182+
183+
184
185=== added file 'resource/proto/flyingzones.aamap.xml'
186--- resource/proto/flyingzones.aamap.xml 1970-01-01 00:00:00 +0000
187+++ resource/proto/flyingzones.aamap.xml 2009-02-28 18:38:43 +0000
188@@ -0,0 +1,48 @@
189+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
190+<!DOCTYPE Resource SYSTEM "AATeam/map-0.3.2-prealpha1.dtd">
191+<Resource type="aamap" name="flyingzones" version="0.0.1" author="Luke-Jr" category="_TEST">
192+ <Map version="2">
193+ <World>
194+ <Field>
195+ <Spawn x="255" y="50" xdir="0" ydir="1" />
196+ <Spawn x="245" y="450" xdir="0" ydir="-1" />
197+ <Spawn x="50" y="245" xdir="1" ydir="0" />
198+ <Spawn x="450" y="255" xdir="-1" ydir="0" />
199+
200+ <Spawn x="305" y="100" xdir="0" ydir="1" />
201+ <Spawn x="195" y="400" xdir="0" ydir="-1" />
202+ <Spawn x="100" y="195" xdir="1" ydir="0" />
203+ <Spawn x="400" y="305" xdir="-1" ydir="0" />
204+
205+ <Spawn x="205" y="100" xdir="0" ydir="1" />
206+ <Spawn x="295" y="400" xdir="0" ydir="-1" />
207+ <Spawn x="100" y="295" xdir="1" ydir="0" />
208+ <Spawn x="400" y="205" xdir="-1" ydir="0" />
209+
210+ <Wall>
211+ <Point x="0" y="0" />
212+ <Point x="0" y="500" />
213+ <Point x="500" y="500" />
214+ <Point x="500" y="0" />
215+ <Point x="0" y="0" />
216+ </Wall>
217+
218+ <Zone>
219+ <ShapeCircle radius="100;-1" bottom="-1;0;0.01" height="-0.05;.1;.05" segments="3;0.3" seglength="1.1;-0.01">
220+ <Point x="250" y="250"/>
221+ <Color red="1" green="0" blue="0"/>
222+ </ShapeCircle>
223+ <Enter>
224+ <EffectGroup>
225+ <User>
226+ <Target>
227+ <Effect count="0" effect="win"/>
228+ </Target>
229+ </User>
230+ </EffectGroup>
231+ </Enter>
232+ </Zone>
233+ </Field>
234+ </World>
235+ </Map>
236+</Resource>
237
238=== modified file 'src/tron/gParser.cpp'
239--- src/tron/gParser.cpp 2009-02-26 22:15:59 +0000
240+++ src/tron/gParser.cpp 2009-02-28 07:48:33 +0000
241@@ -740,6 +740,34 @@
242 shape->setRotation2( tpRotation );
243 }
244
245+ if (myxmlHasProp(cur, "segments")) {
246+ string str = string(myxmlGetProp(cur, "segments"));
247+ tPolynomial tpSegments;
248+ tpSegments.parse(str);
249+ shape->setSegments( tpSegments );
250+ }
251+
252+ if (myxmlHasProp(cur, "seglength")) {
253+ string str = string(myxmlGetProp(cur, "seglength"));
254+ tPolynomial tpSegLength;
255+ tpSegLength.parse(str);
256+ shape->setSegLength( tpSegLength );
257+ }
258+
259+ if (myxmlHasProp(cur, "bottom")) {
260+ string str = string(myxmlGetProp(cur, "bottom"));
261+ tPolynomial tpBottom;
262+ tpBottom.parse(str);
263+ shape->setBottom( tpBottom );
264+ }
265+
266+ if (myxmlHasProp(cur, "height")) {
267+ string str = string(myxmlGetProp(cur, "height"));
268+ tPolynomial tpHeight;
269+ tpHeight.parse(str);
270+ shape->setHeight( tpHeight );
271+ }
272+
273 cur = cur->xmlChildrenNode;
274 while ( cur != NULL) {
275 if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
276
277=== modified file 'src/tron/zone/zShape.cpp'
278--- src/tron/zone/zShape.cpp 2009-02-27 20:57:31 +0000
279+++ src/tron/zone/zShape.cpp 2009-02-28 18:38:10 +0000
280@@ -163,8 +163,16 @@
281 setColor(state.get<rColor>("color"));
282 if (state.isset("rotation"))
283 setRotation2( state.get<tPolynomial>("rotation") );
284+ if (state.isset("segments"))
285+ setSegments( state.get<tPolynomial>("segments") );
286+ if (state.isset("seglength"))
287+ setSegLength( state.get<tPolynomial>("seglength") );
288 if (state.isset("scale"))
289 setScale( state.get<tFunction>("scale") );
290+ if (state.isset("bottom"))
291+ setBottom( state.get<tPolynomial>("bottom") );
292+ if (state.isset("height"))
293+ setHeight( state.get<tPolynomial>("height") );
294 }
295
296 REAL zShape::calcDistanceNear(tCoord & p) {
297@@ -204,10 +212,42 @@
298 }
299 }
300
301+void zShape::setSegments(const tPolynomial & s) {
302+ if(segments_ == s)
303+ return;
304+ segments_ = s;
305+ if (sn_GetNetState() != nCLIENT)
306+ RequestSync();
307+}
308+
309+void zShape::setSegLength(const tPolynomial & s) {
310+ if(seglength_ == s)
311+ return;
312+ seglength_ = s;
313+ if (sn_GetNetState() != nCLIENT)
314+ RequestSync();
315+}
316+
317 void zShape::setScale(const tFunction & s){
318 scale_ = s;
319 }
320
321+void zShape::setBottom(const tPolynomial & p) {
322+ if(bottom_ == p)
323+ return;
324+ bottom_ = p;
325+ if (sn_GetNetState() != nCLIENT)
326+ RequestSync();
327+}
328+
329+void zShape::setHeight(const tPolynomial & p) {
330+ if(height_ == p)
331+ return;
332+ height_ = p;
333+ if (sn_GetNetState() != nCLIENT)
334+ RequestSync();
335+}
336+
337 void zShape::setGrowth(REAL growth) {
338 REAL s = scale_(lasttime_ - referencetime_);
339 scale_.SetSlope(growth);
340@@ -280,7 +320,7 @@
341
342 REAL zShape::GetEffectiveSegmentLength() const {
343 if (seglength_.Len())
344- return int( seglength_.evaluate(lastTime) );
345+ return seglength_.evaluate(lastTime);
346 return sz_zoneSegLength;
347 }
348
349
350=== modified file 'src/tron/zone/zShape.h'
351--- src/tron/zone/zShape.h 2009-02-27 20:50:40 +0000
352+++ src/tron/zone/zShape.h 2009-02-28 07:48:33 +0000
353@@ -57,9 +57,13 @@
354 void setPosY(const tFunction &y);
355 virtual
356 void setRotation2(const tPolynomial & r);
357+ virtual void setSegments(const tPolynomial &);
358+ virtual void setSegLength(const tPolynomial &);
359
360 virtual
361 void setScale(const tFunction &s);
362+ virtual void setBottom(const tPolynomial &);
363+ virtual void setHeight(const tPolynomial &);
364 void setColor(const rColor &c);
365
366 void setColorNow(const rColor &c);
367@@ -68,7 +72,11 @@
368 tFunction getPosX() {return posx_;};
369 tFunction getPosY() {return posy_;};
370 tPolynomial getRotation2() { return rotation2; };
371+ tPolynomial getSegments() { return segments_; };
372+ tPolynomial getSegLength() { return seglength_; };
373 tFunction getScale() {return scale_;};
374+ tPolynomial getBottom() { return bottom_; };
375+ tPolynomial getHeight() { return height_; };
376 rColor getColor() {return color_;};
377
378 REAL GetEffectiveBottom() const;

Subscribers

People subscribed via source and target branches

to status/vote changes: