ifmapper 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.txt CHANGED
@@ -1,3 +1,10 @@
1
+ v1.1.4 Bug fixes:
2
+ - Fixed bug with use of &,",' and line endings in descriptions in
3
+ trizbort format.
4
+ - Fixed potential crashes in Trizbort Reader.
5
+ - Fixed up/down/in/out exits in Trizbort Reader and Writer.
6
+ - Fixed use of & in tags.
7
+
1
8
  v1.1.3 Bug fixes:
2
9
  - Fixed bug in transcript reader which could lead to a crash.
3
10
  - Fixed bug in Trizbort Writer which could leave map in half.
data/IFMapper.gemspec CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
2
2
 
3
3
  spec = Gem::Specification.new do |spec|
4
4
  spec.name = "ifmapper"
5
- spec.version = '1.1.3'
5
+ spec.version = '1.1.4'
6
6
  spec.author = "Gonzalo Garramuno"
7
7
  spec.email = 'ggarra13@gmail.com'
8
8
  spec.homepage = 'http://www.rubyforge.org/projects/ifmapper/'
data/IFMapper.rbw CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
 
4
4
  # cd to install path, so modules are found locally
@@ -565,7 +565,7 @@ class FXMap < Map
565
565
  # Update the map window's title
566
566
  #
567
567
  def update_title
568
- title = @name.dup
568
+ title = @name.to_s.dup
569
569
  if @navigation
570
570
  title << " #{TITLE_READ_ONLY}"
571
571
  end
@@ -916,11 +916,14 @@ class FXMap < Map
916
916
  zoom_out
917
917
  # @scrollwindow.setPosition( -x, -y )
918
918
  when 120 # Hmm, there does not seem to be constants for these
919
- pos = @scrollwindow.position
920
- #puts "pos: #{pos[0]} #{pos[1]}"
921
- x = event.last_x
922
- y = event.last_y
923
- #puts "event: #{x} #{y}"
919
+ # pos = @scrollwindow.position
920
+ # w = @scrollwindow.maxChildWidth
921
+ # h = @scrollwindow.maxChildHeight
922
+ #p @scrollwindow.range
923
+ # puts "pos: #{pos[0]} #{pos[1]}"
924
+ # x = event.last_x
925
+ # y = event.last_y
926
+ # puts "event: #{x} #{y}"
924
927
  zoom_in
925
928
  # @scrollwindow.setPosition( -x, -y )
926
929
  end
@@ -47,8 +47,8 @@ require 'IFMapper/FXWarningBox'
47
47
  class FXMapperWindow < FXMainWindow
48
48
 
49
49
  PROGRAM_NAME = "Interactive Fiction Mapper"
50
- VERSION = '1.1.3'
51
- AUTHOR = "Gonzalo Garramuno"
50
+ VERSION = '1.1.4'
51
+ AUTHOR = "Gonzalo Garramuño"
52
52
 
53
53
  @@copy_buffer = nil
54
54
  @@default_options = FXMapperSettings.new
@@ -59,7 +59,7 @@ class FXMapperWindow < FXMainWindow
59
59
 
60
60
  LANGUAGES = {
61
61
  'English' => 'en',
62
- 'Espanol' => 'es',
62
+ 'Español' => 'es',
63
63
  # todo1
64
64
  'Deutsch' => 'de',
65
65
  'Italiano' => 'it',
@@ -39,7 +39,7 @@ class IFMWriter
39
39
  # simple connection
40
40
  idx = a.next_to?(b)
41
41
  end
42
- dir = ' ' + Room::DIRECTIONS[idx]
42
+ dir = ' ' + Room::DIRECTIONS_ENGLISH[idx]
43
43
  else
44
44
  # complex path
45
45
  dir = ''
@@ -53,13 +53,13 @@ class IFMWriter
53
53
  pts.each { |p|
54
54
  dx, dy = [ p[0] - x, p[1] - y ]
55
55
  idx = Room::vector_to_dir(dx, dy)
56
- dir += " #{Room::DIRECTIONS[idx]}"
56
+ dir += " #{Room::DIRECTIONS_ENGLISH[idx]}"
57
57
  x = p[0]
58
58
  y = p[1]
59
59
  }
60
60
  dx, dy = [ b.x - x, b.y - y ]
61
61
  idx = Room::vector_to_dir(dx, dy)
62
- dir += " #{Room::DIRECTIONS[idx]}"
62
+ dir += " #{Room::DIRECTIONS_ENGLISH[idx]}"
63
63
  end
64
64
  @f.print " dir#{dir}"
65
65
 
@@ -69,7 +69,12 @@ class IFMWriter
69
69
  return @elem[e] if @elem.has_key?(e)
70
70
 
71
71
  tag = t.dup
72
- tag.gsub!(/[\-\(\s,\.'"#$@\/\\\-\)]+/, '_')
72
+ utf = Iconv.new( 'iso-8859-1', 'utf-8' )
73
+ tag = utf.iconv( tag )
74
+
75
+ tag.gsub!(/[\-\(\s,\.!'&"#$@\/\\\-\)]+/, '_')
76
+ tag.gsub!(/__/, '') # remove reduntant __ repetitions
77
+ tag.sub!(/^([\d]+)_?(.*)/, '\2\1') # No numbers allowed at start of tag
73
78
  tagname = tag
74
79
  idx = 2
75
80
  while @tags.include?(tagname) or tagname.empty? or tagname.size == 1
@@ -92,7 +97,7 @@ class IFMWriter
92
97
  exit = idx
93
98
  break
94
99
  }
95
- dir = Room::DIRECTIONS[exit]
100
+ dir = Room::DIRECTIONS_ENGLISH[exit]
96
101
  dx, dy = Room::DIR_TO_VECTOR[exit]
97
102
  x += dx
98
103
  y += dy
@@ -219,7 +219,7 @@ class Inform7Writer
219
219
  tag.sub!(/\s$/, '')
220
220
 
221
221
  # Invalid tag characters, replaced with _
222
- tag.gsub!(/[\s"\\\#\,\.:;!\?\n\(\)]+/,'_')
222
+ tag.gsub!(/[\s"\\\#\&,\.:;!\?\n\(\)]+/,'_')
223
223
  tag.sub!(/^([\d]+)_?(.*)/, '\2\1') # No numbers allowed at start of tag
224
224
 
225
225
  tag.gsub!(/__/, '_')
@@ -39,7 +39,7 @@ class InformWriter
39
39
  tag = utf.iconv( tag )
40
40
 
41
41
  # Invalid tag characters, replaced with _
42
- tag.gsub!(/[\s"'\/\\\-#\,.:;!\?\n\(\)]/,'_')
42
+ tag.gsub!(/[\s"'\/\\\-&#\,.:;!\?\n\(\)]/,'_')
43
43
 
44
44
  tag.gsub!(/__/, '') # remove reduntant __ repetitions
45
45
  tag.sub!(/^([\d]+)_?(.*)/, '\2\1') # No numbers allowed at start of tag
@@ -42,7 +42,7 @@ class TADSWriter
42
42
  tag = utf.iconv( tag )
43
43
 
44
44
  # Invalid tag characters, replaced with _
45
- tag.gsub!(/[\s"'\/\\\-#\,.:;!\?\n\(\)]/,'_')
45
+ tag.gsub!(/[\s"'\/\\\-&#\,.:;!\?\n\(\)]/,'_')
46
46
 
47
47
  tag.gsub!(/__/, '') # remove reduntant __ repetitions
48
48
  tag.sub!(/^([\d]+)_?(.*)/, '\2\1') # No numbers allowed at start of tag
@@ -14,7 +14,9 @@ class TrizbortReader
14
14
 
15
15
  class ParseError < StandardError; end
16
16
  class MapError < StandardError; end
17
-
17
+
18
+ W = 128
19
+ H = 64
18
20
 
19
21
 
20
22
  DIRS = {
@@ -74,10 +76,10 @@ class TrizbortReader
74
76
 
75
77
  @doc.elements.each('trizbort/map/room') { |e|
76
78
  id = e.attributes['id'].to_i
77
- name = e.attributes['name']
79
+ name = e.attributes['name'].to_s
78
80
  x = e.attributes['x'].to_i
79
- y = e.attributes['y'].to_i
80
- w = e.attributes['w'].to_i
81
+ y = e.attributes['y'].to_i
82
+ w = e.attributes['w'].to_i
81
83
  h = e.attributes['h'].to_i
82
84
  r = @map.new_room(x, y)
83
85
  r.name = name
@@ -86,7 +88,8 @@ class TrizbortReader
86
88
  r.darkness = true
87
89
  end
88
90
  desc = e.attributes['description']
89
- r.desc = desc
91
+ r.desc = desc.to_s
92
+ r.desc.gsub!("\r\n", "\n")
90
93
  rooms[id] = r
91
94
  e.elements.each('objects') { |o|
92
95
  r.objects = o.text.to_s.gsub('|',"\n")
@@ -163,25 +166,25 @@ class TrizbortReader
163
166
  debug "Connect: #{roomA} ->#{roomB} "
164
167
  debug "dirA: #{dirA} dirB: #{dirB}"
165
168
 
166
- if startText =~ /up?/i
169
+ if startText =~ /^up?/i
167
170
  startText = 1
168
- elsif startText =~ /d(?:own)?/i
171
+ elsif startText =~ /^d(?:own)?/i
169
172
  startText = 2
170
- elsif startText =~ /in?/i
173
+ elsif startText =~ /^in?/i
171
174
  startText = 3
172
- elsif startText =~ /o(?:ut)?/i
175
+ elsif startText =~ /^o(?:ut)?/i
173
176
  startText = 4
174
177
  else
175
178
  startText = 0
176
179
  end
177
180
 
178
- if endText =~ /up?/i
181
+ if endText =~ /^up?/i
179
182
  endText = 1
180
- elsif endText =~ /d(?:own)?/i
183
+ elsif endText =~ /^d(?:own)?/i
181
184
  endText = 2
182
- elsif endText =~ /in?/i
185
+ elsif endText =~ /^in?/i
183
186
  endText = 3
184
- elsif endText =~ /o(?:ut)?/i
187
+ elsif endText =~ /^o(?:ut)?/i
185
188
  endText = 4
186
189
  else
187
190
  endText = 0
@@ -214,29 +217,29 @@ class TrizbortReader
214
217
  sect.rooms.each do |r|
215
218
  r.x -= minXY[0]
216
219
  r.y -= minXY[1]
217
- r.x /= 128.0
218
- r.y /= 64.0
220
+ r.x /= (W+32)
221
+ r.y /= (H+32)
219
222
  end
220
223
  end
221
224
 
222
225
  @map.sections.each do |sect|
223
226
  sect.rooms.each_with_index do |r, idx|
224
- x = r.x
225
- y = r.y
226
- xf = x.floor
227
- yf = y.floor
228
- if x != xf or y != yf
229
- sect.rooms.each do |r2|
230
- next if r == r2
231
- if xf == r2.x.floor and yf == r2.y.floor
232
- dx = (x - xf).ceil
233
- dy = (y - yf).ceil
234
- sect.shift(x, y, dx, dy)
235
- break
236
- end
237
- end
238
- end
239
- r.x = r.x.floor.to_i
227
+ x = r.x
228
+ y = r.y
229
+ xf = x.floor
230
+ yf = y.floor
231
+ if x != xf or y != yf
232
+ sect.rooms.each do |r2|
233
+ next if r == r2
234
+ if xf == r2.x.floor and yf == r2.y.floor
235
+ dx = (x - xf).ceil
236
+ dy = (y - yf).ceil
237
+ sect.shift(x, y, dx, dy)
238
+ break
239
+ end
240
+ end
241
+ end
242
+ r.x = r.x.floor.to_i
240
243
  r.y = r.y.floor.to_i
241
244
  end
242
245
  end
@@ -257,7 +260,7 @@ class TrizbortReader
257
260
 
258
261
  if @map.kind_of?(FXMap)
259
262
  @map.filename = file.sub(/\.trizbort$/i, '.map')
260
- @map.navigation = true
263
+ @map.navigation = false
261
264
  @map.window.show
262
265
  end
263
266
  end
@@ -20,10 +20,10 @@ class TrizbortWriter
20
20
 
21
21
  OTHERDIRS = [
22
22
  '',
23
- 'u',
24
- 'd',
25
- 'in',
26
- 'out',
23
+ 'Up',
24
+ 'Down',
25
+ 'In',
26
+ 'Out',
27
27
  ]
28
28
 
29
29
  def write_objects( room )
@@ -39,6 +39,15 @@ class TrizbortWriter
39
39
  end
40
40
  end
41
41
 
42
+ def to_xml desc
43
+ desc = desc.dup
44
+ desc.gsub!( /&/, '&amp;' )
45
+ desc.gsub!( /\n/, "&#xD;&#xA;" )
46
+ desc.gsub!( /"/, '&quot;' )
47
+ desc.gsub!( /'/, '&apos;' )
48
+ return desc
49
+ end
50
+
42
51
  def write_map
43
52
  @f.puts "\t<map>"
44
53
  hash = {}
@@ -47,12 +56,14 @@ class TrizbortWriter
47
56
  @map.sections.each { |s|
48
57
  maxX = 0
49
58
  s.rooms.each { |r|
50
- @f.puts "\t\t<room id=\"#{id}\" name=\"#{r.name}\" x=\"#{x + r.x*(W+32)}\" y=\"#{r.y*(H+32)}\" w=\"#{W}\" h=\"#{H}\""
59
+ name = to_xml( r.name )
60
+ @f.print "\t\t<room id=\"#{id}\" name=\"#{r.name}\" x=\"#{x + r.x*(W+32)}\" y=\"#{r.y*(H+32)}\" w=\"#{W}\" h=\"#{H}\""
51
61
  if r.darkness
52
- @f.puts " isDark=\"yes\""
62
+ @f.print " isDark=\"yes\""
53
63
  end
54
64
  if r.desc
55
- @f.puts " description=\"#{r.desc}\""
65
+ desc = to_xml( r.desc )
66
+ @f.print " description=\"#{desc}\""
56
67
  end
57
68
  @f.puts ">"
58
69
  write_objects r
@@ -70,6 +81,12 @@ class TrizbortWriter
70
81
  if c.dir == Connection::AtoB
71
82
  @f.print " flow=\"oneWay\""
72
83
  end
84
+ if c.exitAtext.to_i > 0
85
+ @f.print " startText=\"#{OTHERDIRS[c.exitAtext]}\""
86
+ end
87
+ if c.exitBtext.to_i > 0
88
+ @f.print " endText=\"#{OTHERDIRS[c.exitBtext]}\""
89
+ end
73
90
  @f.puts ">"
74
91
  dirA, dirB = c.dirs
75
92
  id += 1
@@ -471,6 +471,16 @@ class Room
471
471
  'w',
472
472
  'nw',
473
473
  ]
474
+ DIRECTIONS_ENGLISH = [
475
+ 'n',
476
+ 'ne',
477
+ 'e',
478
+ 'se',
479
+ 's',
480
+ 'sw',
481
+ 'w',
482
+ 'nw',
483
+ ]
474
484
  end
475
485
 
476
486
  AUTOMAP_IS_WAITING_FOR_MORE_TEXT = "Automap is waiting for more text."
@@ -167,18 +167,18 @@ filas de casilleros alineados a los lados de la habitación.
167
167
  ",
168
168
  "
169
169
  > mira
170
- (You are now in the driveway.)
171
- (You're sitting in the sports car.)
172
- You are by the front gate of the Tresyllian Castle. You can hear the ocean
173
- beating urgently against the rocks far below.
170
+ (Estás ahora en la entrada de coches.)
171
+ (Estás sentado en tu auto sport.)
172
+ Estas frente al portón del Castillo Tresyllian. Puedes oir el océano
173
+ golpeando urgentemente contra las rocas en la distancia.
174
174
  ",
175
175
  "
176
176
  > mira
177
- You are now in the driveway entrance.
178
- You are standing at the foot of the driveway, the entrance to the
179
- Linder property. The entire lot is screened from the street and the
180
- neighbors by a wooden fence, except on the east side, which fronts on
181
- dense bamboo woods.
177
+ Estás ahora en la entrada de coches.
178
+ Estás de pie ante la entrada de coches, entrada de la propiedad de Linder.
179
+ La propiedad entera es monitoreada desde la calle y los vecinos por una
180
+ cerca de madera, excepto en el lado este, que se enfrenta a un denso
181
+ bosque de bamboos.
182
182
  ",
183
183
  "
184
184
  mira
@@ -202,10 +202,10 @@ Oeste de la Casa
202
202
  Vestidor de mujeres
203
203
  ",
204
204
  "
205
- (You are in the driveway.)
205
+ (Estás en la entrada de coches.)
206
206
  ",
207
207
  "
208
- (driveway entrance)
208
+ (entrada de coches)
209
209
  ",
210
210
  "
211
211
  Entrada del Shopping
@@ -471,6 +471,16 @@ class Room
471
471
  'o',
472
472
  'no',
473
473
  ]
474
+ DIRECTIONS_ENGLISH = [
475
+ 'n',
476
+ 'ne',
477
+ 'e',
478
+ 'se',
479
+ 's',
480
+ 'sw',
481
+ 'w',
482
+ 'nw',
483
+ ]
474
484
  end
475
485
 
476
486
  AUTOMAP_IS_WAITING_FOR_MORE_TEXT = "Automap espera por más texto."
data/maps/Aotearoa.map CHANGED
Binary file
data/maps/Asgard.map CHANGED
Binary file
data/maps/Bronze.map CHANGED
Binary file
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifmapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 3
10
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gonzalo Garramuno
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-13 00:00:00 -03:00
19
- default_executable:
18
+ date: 2011-06-24 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rake-compiler
@@ -91,7 +90,6 @@ files:
91
90
  - IFMapper.rbw
92
91
  - bin/IFMapper
93
92
  - IFMapper.gemspec
94
- - lib/IFMapper/FXMapperWindow.rb
95
93
  - lib/IFMapper/AStar.rb
96
94
  - lib/IFMapper/Connection.rb
97
95
  - lib/IFMapper/FXAboutDialogBox.rb
@@ -105,6 +103,7 @@ files:
105
103
  - lib/IFMapper/FXMapDialogBox.rb
106
104
  - lib/IFMapper/FXMapFileDialog.rb
107
105
  - lib/IFMapper/FXMapperSettings.rb
106
+ - lib/IFMapper/FXMapperWindow.rb
108
107
  - lib/IFMapper/Map.rb
109
108
  - lib/IFMapper/MapPrinting.rb
110
109
  - lib/IFMapper/MapReader.rb
@@ -237,6 +236,7 @@ files:
237
236
  - maps/photograph.map
238
237
  - maps/pkgirl.map
239
238
  - maps/Planetfall.map
239
+ - maps/Plundered_Hearts.map
240
240
  - maps/pytho.map
241
241
  - maps/QuietEvening.map
242
242
  - maps/Reliques_of_Tolti_Alph.map
@@ -319,7 +319,6 @@ files:
319
319
  - docs/images/IFMapper_main.gif
320
320
  - docs/images/room_description.gif
321
321
  - docs/images/room_small.gif
322
- has_rdoc: true
323
322
  homepage: http://www.rubyforge.org/projects/ifmapper/
324
323
  licenses: []
325
324
 
@@ -351,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
351
350
  requirements: []
352
351
 
353
352
  rubyforge_project: ifmapper
354
- rubygems_version: 1.3.7
353
+ rubygems_version: 1.8.5
355
354
  signing_key:
356
355
  specification_version: 3
357
356
  summary: Interactive Fiction Mapping Tool.