Author: grumbel Date: 2007-08-14 17:59:18 +0200 (Tue, 14 Aug 2007) New Revision: 2900
Modified: branches/pingus_sdl/TODO branches/pingus_sdl/contrib/levelconvert.sh branches/pingus_sdl/contrib/pingusv1tov2.xsl branches/pingus_sdl/xml2sexpr.rb Log: - some more stuff for the TODO - implemented teleporter conversion - added a few traps to the conversion Modified: branches/pingus_sdl/TODO =================================================================== --- branches/pingus_sdl/TODO 2007-08-14 14:59:58 UTC (rev 2899) +++ branches/pingus_sdl/TODO 2007-08-14 15:59:18 UTC (rev 2900) @@ -60,10 +60,26 @@ - src/components/pingus_counter.hpp font should be fixed-width/monospace +- teleporter code should be done differently (target and teleporters + are two objects with id/name, instead of one), fileformat is + already new, see: + branches/pingus_sdl/data/levels/playable/future3-jgoebbert.scm + Nice to Have: ============= -- convert all levels and check all classic levels for issues: +- scaling code could be a bit cleaned up, i.e. no load sprite, + get_surface, Blitter::scale, set_surface, make it something simplyer + +- convert all levels and check all classic levels for issues (run + branches/pingus_sdl/contribl/levelconvert.sh from SVN toplevel dir) + +- liquid's old-width-handling isn't handled by sexpr, but is needed + for some levels, conversion script should convert + +- Liquids/water is 32, others are 64, this is causing trouble with the + collision map + - add drag&drop scrolling - nuke button is unclean, other buttons not so great either -> repaint @@ -75,18 +91,8 @@ - fix all those Windstille file headers and replace them with Pingus - hurry-up should be removed and replaced by something less heavy + (isn't used in tutorial island, since those levels don't have time) -Convert script (issues: space in description is wrong, some levels fail): - - see: http://pingus.seul.org/~grumbel/tmp/pingusconversion.log - [EMAIL PROTECTED]:~/projects/pingus/svn/pingus_0_6/data/levels]$ find -name "*.pingus" -print0 | while read -d $'\0' -r file; do echo "$file: ";xalan -indent 0 -xsl ../../../pingus_sdl/contrib/pingusv1tov2.xsl -in "$file" -out "../../../pingus_sdl/data/levels/$file"; ../../../pingus_sdl/xml2sexpr.rb "../../../pingus_sdl/data/levels/$file" > "../../../pingus_sdl/data/levels/${file%%.pingus}.scm"; done - -- levels seem to have lost something (names, maybe more) when going - from Pingus0.6 over PingusClanlib to PingusSDL - -- liquid's old-width-handling isn't handled by sexpr, but might be needed for some levels - - remove unneeded/outdated fonts - "core/misc/404sprite" isn't returned for missing graphics Modified: branches/pingus_sdl/contrib/levelconvert.sh =================================================================== --- branches/pingus_sdl/contrib/levelconvert.sh 2007-08-14 14:59:58 UTC (rev 2899) +++ branches/pingus_sdl/contrib/levelconvert.sh 2007-08-14 15:59:18 UTC (rev 2900) @@ -34,6 +34,7 @@ -out "$TMP" branches/pingus_sdl/xml2sexpr.rb "$TMP" "$IN" > "${OUT}" fi + rm "$TMP" echo "Conversion ok" echo "" done Modified: branches/pingus_sdl/contrib/pingusv1tov2.xsl =================================================================== --- branches/pingus_sdl/contrib/pingusv1tov2.xsl 2007-08-14 14:59:58 UTC (rev 2899) +++ branches/pingus_sdl/contrib/pingusv1tov2.xsl 2007-08-14 15:59:18 UTC (rev 2900) @@ -91,8 +91,35 @@ </xsl:element> </xsl:template> + <xsl:template match="liquid/width"> + <xsl:choose> + <xsl:when test="../@use-old-width-handling = '0'"> + <repeat><xsl:apply-templates /></repeat> + </xsl:when> + + <xsl:otherwise> <!-- fixme: These must depend on the resources --> + <xsl:variable name="resourcename" + select="concat(../surface/resource/resource-datafile/text(),':',../surface/resource/resource-ident/text())" /> + + <xsl:choose> + <xsl:when test="$resourcename = 'global:Liquid/water'"> + <repeat><xsl:value-of select="floor(number(text()) div 32)" /></repeat> + </xsl:when> + + <xsl:when test="$resourcename = 'liquids:Liquid/water'"> + <repeat><xsl:value-of select="floor(number(text()) div 32)" /></repeat> + </xsl:when> + + <xsl:otherwise> + <repeat><xsl:value-of select="floor(number(text()) div 64)" /></repeat> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="liquid"> - <liquid><xsl:apply-templates select="*"/></liquid> + <liquid><xsl:apply-templates /></liquid> </xsl:template> <xsl:template match="action-list/*"> @@ -122,6 +149,21 @@ </actions> </xsl:template> + <xsl:template match="[EMAIL PROTECTED]'teleporter']"> + <teleporter> + <id><xsl:value-of select="generate-id(.)" /></id> + <xsl:apply-templates select="position" /> + </teleporter> + <teleporter-target> + <id><xsl:value-of select="generate-id(.)" /></id> + <position> + <x><xsl:value-of select="target/position/x-pos"/></x> + <y><xsl:value-of select="target/position/y-pos"/></y> + <z><xsl:value-of select="position/z-pos"/></z> + </position> + </teleporter-target> + </xsl:template> + <xsl:template match="group"> <xsl:apply-templates select="*"/> </xsl:template> @@ -208,6 +250,18 @@ <z><xsl:value-of select="number(z-pos)" /></z> </xsl:when> + <xsl:when test="$resourcename = 'exits:Exits/sweetexit'"> + <x><xsl:value-of select="floor(number(x-pos) + 180 div 2)" /></x> + <y><xsl:value-of select="number(y-pos) + 121" /></y> + <z><xsl:value-of select="number(z-pos)" /></z> + </xsl:when> + + <xsl:when test="$resourcename = 'exits:Exits/crystal'"> + <x><xsl:value-of select="floor(number(x-pos) + 154 div 2)" /></x> + <y><xsl:value-of select="number(y-pos) + 105" /></y> + <z><xsl:value-of select="number(z-pos)" /></z> + </xsl:when> + <xsl:otherwise> <xsl:message terminate="yes"> Critical error: resourcename: ((<xsl:value-of select="$resourcename" />)) Modified: branches/pingus_sdl/xml2sexpr.rb =================================================================== --- branches/pingus_sdl/xml2sexpr.rb 2007-08-14 14:59:58 UTC (rev 2899) +++ branches/pingus_sdl/xml2sexpr.rb 2007-08-14 15:59:18 UTC (rev 2900) @@ -1,5 +1,7 @@ #!/usr/bin/ruby -w +# Usage: xml2sexpr.rb XMLFILENAME ORIGINALFILENAME + require "rexml/document" # Script to convert Pingus 0.6 level files to new sexpr format @@ -90,6 +92,17 @@ [/^\/pingus-level\/objects\/entrance\/release-rate$/, :integer], [/^\/pingus-level\/objects\/entrance\/owner-id$/, :integer], + [/^\/pingus-level\/objects\/fake_exit$/, :section], + [/^\/pingus-level\/objects\/fake_exit\/position$/, :vector], + + [/^\/pingus-level\/objects\/bumper$/, :section], + [/^\/pingus-level\/objects\/bumper\/position$/, :vector], + + [/^\/pingus-level\/objects\/starfield-background$/, :section], + [/^\/pingus-level\/objects\/starfield-background\/small-stars$/, :integer], + [/^\/pingus-level\/objects\/starfield-background\/middle-stars$/, :integer], + [/^\/pingus-level\/objects\/starfield-background\/large-stars$/, :integer], + [/^\/pingus-level\/objects\/exit$/, :section], [/^\/pingus-level\/objects\/exit\/owner-id$/, :integer], @@ -113,6 +126,7 @@ [/^\/pingus-level\/objects\/liquid$/, :section], [/^\/pingus-level\/objects\/liquid\/width$/, :integer], + [/^\/pingus-level\/objects\/liquid\/repeat$/, :integer], [/^\/pingus-level\/objects\/liquid\/speed$/, :integer], [/^\/pingus-level\/objects\/rain-generator$/, :section], @@ -127,10 +141,13 @@ [/^\/pingus-level\/objects\/switchdoor\/door\/height$/, :integer], [/^\/pingus-level\/objects\/teleporter$/, :section], - [/^\/pingus-level\/objects\/teleporter\/target$/, :section], + [/^\/pingus-level\/objects\/teleporter\/id$/, :string], + [/^\/pingus-level\/objects\/teleporter\/position$/, :vector], + [/^\/pingus-level\/objects\/teleporter-target$/, :section], + [/^\/pingus-level\/objects\/teleporter-target\/id$/, :string], + [/^\/pingus-level\/objects\/teleporter-target\/position$/, :vector], + ] -] - $typespec_generic = [ [/color$/, :color], @@ -191,7 +208,7 @@ print el.value.to_i else if section != "" - puts "unknown: section: #{section} #{el.value}" + $stderr.puts "Error: unknown: section: #{section} #{el.value}" puts el.inspect exit 1 end @@ -212,7 +229,7 @@ when :string print "#{indent}(#{el.name} " el.children.each{|child| - line_breaker(child.value).each_with_index{|line,idx| + line_breaker(child.value.gsub(/\s+/, " ").lstrip).each_with_index{|line,idx| if idx == 0 then print "\"#{line}\"" else @@ -277,15 +294,14 @@ end end -ARGV.each{|arg| - i = 0 - dir = File.dirname(arg) - doc = REXML::Document.new(File.new(arg)) - puts ";; generated by xml2sexpr.rb convert script from '#{arg}'" - doc.children.each{ |el| - xml2array("", "", el) - } - puts "\n;; EOF ;;" +i = 0 +dir = File.dirname(ARGV[0]) +doc = REXML::Document.new(File.new(ARGV[0])) +puts ";; generated by xml2sexpr.rb from file '#{ARGV[1]}'" +doc.children.each{ |el| + xml2array("", "", el) } +puts "\n;; EOF ;;" +exit 0 # EOF # _______________________________________________ pingus-cvs mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/pingus-cvs
