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 +7 -0
- data/IFMapper.gemspec +1 -1
- data/IFMapper.rbw +1 -1
- data/lib/IFMapper/FXMap.rb +9 -6
- data/lib/IFMapper/FXMapperWindow.rb +3 -3
- data/lib/IFMapper/IFMWriter.rb +10 -5
- data/lib/IFMapper/Inform7Writer.rb +1 -1
- data/lib/IFMapper/InformWriter.rb +1 -1
- data/lib/IFMapper/TADSWriter.rb +1 -1
- data/lib/IFMapper/TrizbortReader.rb +35 -32
- data/lib/IFMapper/TrizbortWriter.rb +24 -7
- data/lib/IFMapper/locales/en/Messages.rb +10 -0
- data/lib/IFMapper/locales/es/Messages.rb +21 -11
- data/maps/Aotearoa.map +0 -0
- data/maps/Asgard.map +0 -0
- data/maps/Bronze.map +0 -0
- data/maps/Plundered_Hearts.map +0 -0
- metadata +8 -9
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.
|
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
data/lib/IFMapper/FXMap.rb
CHANGED
@@ -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
|
-
#
|
921
|
-
|
922
|
-
|
923
|
-
#puts "
|
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.
|
51
|
-
AUTHOR = "Gonzalo
|
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
|
-
'
|
62
|
+
'Español' => 'es',
|
63
63
|
# todo1
|
64
64
|
'Deutsch' => 'de',
|
65
65
|
'Italiano' => 'it',
|
data/lib/IFMapper/IFMWriter.rb
CHANGED
@@ -39,7 +39,7 @@ class IFMWriter
|
|
39
39
|
# simple connection
|
40
40
|
idx = a.next_to?(b)
|
41
41
|
end
|
42
|
-
dir = ' ' + Room::
|
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::
|
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::
|
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
|
-
|
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::
|
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"
|
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"'
|
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
|
data/lib/IFMapper/TADSWriter.rb
CHANGED
@@ -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"'
|
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 =~
|
169
|
+
if startText =~ /^up?/i
|
167
170
|
startText = 1
|
168
|
-
elsif startText =~
|
171
|
+
elsif startText =~ /^d(?:own)?/i
|
169
172
|
startText = 2
|
170
|
-
elsif startText =~
|
173
|
+
elsif startText =~ /^in?/i
|
171
174
|
startText = 3
|
172
|
-
elsif startText =~
|
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 =~
|
181
|
+
if endText =~ /^up?/i
|
179
182
|
endText = 1
|
180
|
-
elsif endText =~
|
183
|
+
elsif endText =~ /^d(?:own)?/i
|
181
184
|
endText = 2
|
182
|
-
elsif endText =~
|
185
|
+
elsif endText =~ /^in?/i
|
183
186
|
endText = 3
|
184
|
-
elsif endText =~
|
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 /=
|
218
|
-
r.y /=
|
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
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
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 =
|
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
|
-
'
|
24
|
-
'
|
25
|
-
'
|
26
|
-
'
|
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!( /&/, '&' )
|
45
|
+
desc.gsub!( /\n/, "
" )
|
46
|
+
desc.gsub!( /"/, '"' )
|
47
|
+
desc.gsub!( /'/, ''' )
|
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
|
-
|
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.
|
62
|
+
@f.print " isDark=\"yes\""
|
53
63
|
end
|
54
64
|
if r.desc
|
55
|
-
|
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
|
@@ -167,18 +167,18 @@ filas de casilleros alineados a los lados de la habitación.
|
|
167
167
|
",
|
168
168
|
"
|
169
169
|
> mira
|
170
|
-
(
|
171
|
-
(
|
172
|
-
|
173
|
-
|
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
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
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
|
-
(
|
205
|
+
(Estás en la entrada de coches.)
|
206
206
|
",
|
207
207
|
"
|
208
|
-
(
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
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-
|
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.
|
353
|
+
rubygems_version: 1.8.5
|
355
354
|
signing_key:
|
356
355
|
specification_version: 3
|
357
356
|
summary: Interactive Fiction Mapping Tool.
|