ifmapper 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.txt CHANGED
@@ -1,3 +1,9 @@
1
+ v1.0.7 - Bug fixed cutting and pasting of rooms,
2
+ which could overlap previous rooms in map and
3
+ leave rooms without new connections.
4
+ - Added localization to link switching with RMB.
5
+ - Fixed drag selection of rooms.
6
+
1
7
  v1.0.6 - Added new item list window.
2
8
 
3
9
  v1.0.5 - Improved PDF output in Letter box mode.
data/IFMapper.gemspec CHANGED
@@ -2,8 +2,8 @@ require "rubygems"
2
2
 
3
3
  spec = Gem::Specification.new do |spec|
4
4
  spec.name = "ifmapper"
5
- spec.version = '1.0.6'
6
- spec.author = "Gonzalxo Garramuno"
5
+ spec.version = '1.0.7'
6
+ spec.author = "Gonzalo Garramuno"
7
7
  spec.email = 'ggarra13@gmail.com'
8
8
  spec.homepage = 'http://www.rubyforge.org/projects/ifmapper/'
9
9
  spec.summary = 'Interactive Fiction Mapping Tool.'
@@ -10,7 +10,7 @@ require 'IFMapper/FXConnectionDialogBox'
10
10
  # | W |
11
11
  # | +-------------+ |
12
12
  # HH | | |WS2|
13
- # | H | |---|
13
+ # | HS | |---|
14
14
  # | +-------------+ |
15
15
  # | |HS2 |
16
16
  # +---------------------+
@@ -52,6 +52,7 @@ class FXConnection < Connection
52
52
  def marshal_load(vars)
53
53
  @pts = @gpts = []
54
54
  @selected = vars.shift
55
+ @failed = false
55
56
  super(vars)
56
57
  end
57
58
 
@@ -30,6 +30,7 @@ class FXMap < Map
30
30
  attr_reader :complexConnection
31
31
  attr_reader :mouseButton
32
32
 
33
+
33
34
  # pmap is a path map (a matrix or grid used for path finding).
34
35
  # Rooms and paths are recorded there. Path finding is needed
35
36
  # to draw complex connections (ie. those that are farther than one square)
@@ -155,7 +156,7 @@ class FXMap < Map
155
156
  #
156
157
  def _free_area?(x, y, w, h)
157
158
  x.upto(x+w) { |xx|
158
- y.upto(x+h) { |yy|
159
+ y.upto(y+h) { |yy|
159
160
  return false if @pmap.at(xx).at(yy).kind_of?(Room)
160
161
  }
161
162
  }
@@ -781,6 +782,8 @@ class FXMap < Map
781
782
  #
782
783
  def double_click_cb(selection, event)
783
784
  return unless selection
785
+ # If in navigation mode, we don't allow user to modify map.
786
+ return navigation_warning if @navigation
784
787
  if selection.kind_of?(FXRoom) or selection.kind_of?(FXConnection)
785
788
  selection.properties( self, event )
786
789
  end
@@ -919,8 +922,8 @@ class FXMap < Map
919
922
  w = x2 - x1
920
923
  h = y2 - y1
921
924
 
922
- x1 = ((x1 - WS_2) / WW).floor
923
- y1 = ((y1 - HS_2) / HH).floor
925
+ x1 = ((x1 + WS_2) / WW).floor
926
+ y1 = ((y1 + HS_2) / HH).floor
924
927
  x2 = ((x2 - WS_2) / WW).ceil
925
928
  y2 = ((y2 - HS_2) / HH).ceil
926
929
 
@@ -1061,7 +1064,7 @@ class FXMap < Map
1061
1064
  dir = Room::DIRECTIONS[idx]
1062
1065
  dir = dir.upcase
1063
1066
  if room[idx]
1064
- cmd = FXMenuCommand.new(submenu, "Switch with link in #{dir} Exit")
1067
+ cmd = FXMenuCommand.new(submenu, "#{MENU_SWITCH_WITH_LINK} #{dir}")
1065
1068
  cmd.connect(SEL_COMMAND) {
1066
1069
  c2 = room[idx]
1067
1070
  room[old_idx] = c2
@@ -1070,7 +1073,7 @@ class FXMap < Map
1070
1073
  draw
1071
1074
  }
1072
1075
  else
1073
- cmd = FXMenuCommand.new(submenu, "Move link to #{dir} Exit")
1076
+ cmd = FXMenuCommand.new(submenu, "#{MENU_MOVE_LINK} #{dir}")
1074
1077
  cmd.connect(SEL_COMMAND) {
1075
1078
  room[old_idx] = nil
1076
1079
  room[idx] = c
@@ -1093,7 +1096,7 @@ class FXMap < Map
1093
1096
  b = c.roomB
1094
1097
  menu = FXMenuPane.new(@window)
1095
1098
  if c.dir == Connection::AtoB
1096
- cmd = FXMenuCommand.new(menu, "Flip Direction")
1099
+ cmd = FXMenuCommand.new(menu, MENU_FLIP_DIRECTION)
1097
1100
  cmd.connect(SEL_COMMAND) { c.flip; draw }
1098
1101
  FXMenuSeparator.new(menu)
1099
1102
  end
@@ -1390,8 +1393,7 @@ class FXMap < Map
1390
1393
  # Handle 'cutting' any selected rooms and/or connections
1391
1394
  #
1392
1395
  def _cut_selected
1393
- rooms = @sections[@section].rooms.find_all { |r| r.selected }
1394
- conns = @sections[@section].connections.find_all { |c| c.selected }
1396
+ rooms, conns = get_selection
1395
1397
  ############################
1396
1398
  # First, handle rooms...
1397
1399
  ############################
@@ -1399,11 +1401,13 @@ class FXMap < Map
1399
1401
  rooms.each { |r| @pmap[r.x][r.y] = nil }
1400
1402
  # Remove rooms from current section in map
1401
1403
  @sections[@section].rooms -= rooms
1402
- # Add any connections pointing to removed rooms as connection to remove
1404
+ # Add any connections pointing to removed rooms as
1405
+ # connection to remove
1403
1406
  rooms.each { |r|
1404
1407
  conns += r.exits.find_all { |e| e != nil }
1405
1408
  }
1406
1409
 
1410
+
1407
1411
  #########################
1408
1412
  # Now, handle connections
1409
1413
  #########################
@@ -1411,15 +1415,32 @@ class FXMap < Map
1411
1415
 
1412
1416
  # Remove connections from path map
1413
1417
  conns.each { |c| clean_path(c) }
1418
+
1414
1419
  # Remove connections from current section in map
1415
1420
  @sections[@section].connections -= conns
1416
1421
 
1417
- return conns
1422
+
1423
+ return rooms, conns
1418
1424
  end
1419
1425
 
1420
1426
  def cut_selected
1421
- _cut_selected
1427
+ rooms, conns = _cut_selected
1428
+
1429
+ # Remove room exits pointing to any removed connection
1430
+ conns.each { |c|
1431
+ a = c.roomA
1432
+ b = c.roomB
1433
+ if not rooms.member?(a)
1434
+ a[a.exits.index(c)] = nil
1435
+ end
1436
+ if not rooms.member?(b)
1437
+ idx = b.exits.rindex(c)
1438
+ b[idx] = nil if idx
1439
+ end
1440
+ }
1441
+
1422
1442
  modified = true
1443
+ create_pathmap
1423
1444
  draw
1424
1445
  end
1425
1446
 
@@ -1427,7 +1448,8 @@ class FXMap < Map
1427
1448
  # Handle deleting selected rooms and/or connections
1428
1449
  #
1429
1450
  def delete_selected
1430
- conns = _cut_selected
1451
+ return navigation_warning if @navigation
1452
+ rooms, conns = _cut_selected
1431
1453
 
1432
1454
  # Remove room exits pointing to any removed connection
1433
1455
  conns.each { |c|
@@ -1511,6 +1533,7 @@ class FXMap < Map
1511
1533
 
1512
1534
  def self.no_maps
1513
1535
  @@roomlist.hide if @@roomlist
1536
+ @@itemlist.hide if @@itemlist
1514
1537
  @@win.hide if @@win
1515
1538
  FXRoom::no_maps
1516
1539
  FXConnection::no_maps
@@ -1524,6 +1547,10 @@ class FXMap < Map
1524
1547
  @@win.copy_from(self) if @@win
1525
1548
  end
1526
1549
 
1550
+ def update_itemlist
1551
+ @@itemlist.copy_from(self) if @@itemlist
1552
+ end
1553
+
1527
1554
  #
1528
1555
  # Find and update all paths in path map for a room
1529
1556
  #
@@ -1655,6 +1682,12 @@ class FXMap < Map
1655
1682
  @modified = true
1656
1683
  draw
1657
1684
  end
1685
+ # when KEY_u
1686
+ # if event.state & CONTROLMASK != 0
1687
+ # FXMapperWindow::undo(self)
1688
+ # @modified = true
1689
+ # draw
1690
+ # end
1658
1691
  when KEY_x
1659
1692
  return navigation_warning if @navigation
1660
1693
  if event.state & CONTROLMASK != 0
@@ -46,7 +46,7 @@ require 'IFMapper/FXWarningBox'
46
46
  class FXMapperWindow < FXMainWindow
47
47
 
48
48
  PROGRAM_NAME = "Interactive Fiction Mapper"
49
- VERSION = '1.0.6'
49
+ VERSION = '1.0.7'
50
50
  AUTHOR = "Gonzalo Garramuño"
51
51
 
52
52
  @@copy_buffer = nil
@@ -546,6 +546,7 @@ class FXMapperWindow < FXMainWindow
546
546
  # Cut selected elements
547
547
  #
548
548
  def self.cut_selected(map)
549
+ return map.navigation_warning if map.navigation
549
550
  FXMapperWindow::copy_selected(map)
550
551
  map.cut_selected
551
552
  end
@@ -641,6 +642,7 @@ class FXMapperWindow < FXMainWindow
641
642
  end
642
643
 
643
644
 
645
+
644
646
  #
645
647
  # Hilite matches after a search
646
648
  #
@@ -975,6 +977,8 @@ class FXMapperWindow < FXMainWindow
975
977
  cmd.connect(SEL_COMMAND, method(:cut_selected_cb))
976
978
  cmd = FXMenuCommand.new(editmenu, MENU_PASTE, nil)
977
979
  cmd.connect(SEL_COMMAND, method(:paste_selected_cb))
980
+ # cmd = FXMenuCommand.new(editmenu, MENU_UNDO, nil)
981
+ # cmd.connect(SEL_COMMAND, method(:undo_cb))
978
982
 
979
983
  # Select submenu
980
984
  FXMenuSeparator.new(editmenu)
@@ -11,6 +11,13 @@ class FXRoom < Room
11
11
 
12
12
  @@win = nil
13
13
 
14
+ def copy(b)
15
+ xx = b.xx
16
+ yy = b.yy
17
+ selected = b.selected
18
+ super b
19
+ end
20
+
14
21
  def self.no_maps
15
22
  @@win.hide if @@win
16
23
  end
data/lib/IFMapper/Room.rb CHANGED
@@ -150,4 +150,12 @@ class Room
150
150
  def to_s
151
151
  "\"#{@name}\""
152
152
  end
153
+
154
+ def inspect
155
+ puts to_s
156
+ puts "Exits:"
157
+ @exits.each { |c|
158
+ puts "\t#{c}" if c != nil
159
+ }
160
+ end
153
161
  end
@@ -51,20 +51,21 @@ class TranscriptReader
51
51
 
52
52
  # No exit replies
53
53
  NO_EXIT = [
54
- /\byou\scan't\sgo\sthat\sway\b/i,
55
- /\byou\scan't\sgo\sin\sthat\sdirection\b/i,
56
- /\bdoorways\slead\s/i,
57
- /\bthat's\sa\swall\b/i,
58
- /\bno\sexit\b/i,
59
- /\bthere's\s+nothing\sin\sthat\sdirection\b/i,
60
- /\bblock\sthe\sway/i,
61
- /\byou\scan\sonly\sgo\s/i,
62
- /\byou\scan\sgo\sonly\s/i,
63
- /\bimpenetrable\b/i,
64
- /\bbars\syour\sway/i,
65
- /\bthere's\s.*in\s(?:your|the)\sway/i
66
- ]
67
-
54
+ /\byou\scan't\sgo\sthat\sway\b/i,
55
+ /\byou\scan't\sgo\sin\sthat\sdirection\b/i,
56
+ /\bdoorways\slead\s/i,
57
+ /\bthat's\sa\swall\b/i,
58
+ /\bno\sexit\b/i,
59
+ /\bthere's\s+nowhere\s+to\s+go\s+in\sthat\s+direction\b/i,
60
+ /\bthere's\s+nothing\s+in\s+that\s+direction\b/i,
61
+ /\bblocks?\sthe\sway/i,
62
+ /\byou\scan\sonly\sgo\s/i,
63
+ /\byou\scan\sgo\sonly\s/i,
64
+ /\bimpenetrable\b/i,
65
+ /\bbars\syour\sway/i,
66
+ /\bthere's\s.*in\s(?:your|the)\sway/i
67
+ ]
68
+
68
69
  # Closed exit replies
69
70
  CLOSED_EXIT = [
70
71
  /door\s+is\s+closed/i,
@@ -14,7 +14,7 @@ EOF
14
14
  ERR_NO_FREE_ROOM = 'Sorry. No free room in map to paste the nodes.'
15
15
  ERR_NO_MATCHES = 'No matches for regex'
16
16
  ERR_CANNOT_AUTOMAP = 'Cannot automap.'
17
- ERR_READ_ONLY_MAP = "Map is in Read Only Mode. Go to Map Information to change this."
17
+ ERR_READ_ONLY_MAP = "Map is in Read Only Mode.\nGo to Map Information to change this."
18
18
  ERR_CANNOT_MOVE_SELECTION = 'Cannot move selection'
19
19
  ERR_CANNOT_OPEN_TRANSCRIPT = 'Cannot open transcript'
20
20
  ERR_PARSE_TRANSCRIPT = "Internal error parsing transcript\nPlease report as a bug"
@@ -48,7 +48,7 @@ FXRuby Version: #{Fox::fxrubyversion}
48
48
 
49
49
  A WYSIWYG mapping tool for interactive fiction.
50
50
 
51
- ggarra@advancedsl.com.ar
51
+ ggarra13@gmail.com
52
52
  EOF
53
53
 
54
54
  MSG_SAVE_MAP = 'Save Map'
@@ -260,6 +260,7 @@ MENU_EDIT = '&Edit'
260
260
  MENU_COPY = "&Copy\tCtl-C\tCopy Location Data"
261
261
  MENU_CUT = "Cu&t\tCtl-X\tCut Location"
262
262
  MENU_PASTE = "&Paste\tCtl-V\tPaste Location Data"
263
+ MENU_UNDO = "&Undo\tCtl-U\tUndo Last Deletion"
263
264
 
264
265
  MENU_MAP = '&Map'
265
266
  MENU_SELECT = 'Select'
@@ -294,6 +295,9 @@ MENU_ADD_SECTION = "Add Section\t\tAdd a New Section to Map."
294
295
  MENU_RENAME_SECTION = "Rename Section\t\tRename Current Section."
295
296
  MENU_DELETE_SECTION = "Delete Section\t\tDelete Current Section from Map."
296
297
 
298
+ MENU_FLIP_DIRECTION = "Flip Direction of Selection"
299
+ MENU_MOVE_LINK = 'Move link to Exit'
300
+ MENU_SWITCH_WITH_LINK = 'Switch with link'
297
301
 
298
302
  MENU_ZOOM_PERCENT = '#{v}%\t\tZoom page to #{v}%.'
299
303
  MENU_ZOOM = 'Zoom'
@@ -18,11 +18,11 @@ EOF
18
18
  ERR_NO_FREE_ROOM = 'Lo siento. No hay espacio en el mapa para pegar las localidades.'
19
19
  ERR_NO_MATCHES = 'No hay coincidencias para la expresión'
20
20
  ERR_CANNOT_AUTOMAP = 'No puedo mapear automáticamente.'
21
- ERR_READ_ONLY_MAP = "Mapa está en Modo de Lectura Solamente. Vaya a Datos del Mapa para cambiar esto."
21
+ ERR_READ_ONLY_MAP = "Mapa está en Modo de Lectura Solamente.\nVaya a Datos del Mapa para cambiar esto."
22
22
  ERR_CANNOT_MOVE_SELECTION = 'No puedo mover la selección hacia el '
23
23
  ERR_CANNOT_OPEN_TRANSCRIPT = 'No puedo abrir la transcripción'
24
24
  ERR_PARSE_TRANSCRIPT = "Error interno interpretando transcripción\nPor favor repórtelo como un fallo del software"
25
- ERR_COULD_NOT_OPEN_WEB_BROWSER = 'No pude abrir ningún web browser'
25
+ ERR_COULD_NOT_OPEN_WEB_BROWSER = 'No pude abrir ningúnbweb browser'
26
26
  ERR_PATH_FOR_CONNECTION = 'El camino de la conexión'
27
27
  ERR_IS_BLOCKED = 'está bloqueado'
28
28
 
@@ -52,7 +52,7 @@ Versión de FXRuby: #{Fox::fxrubyversion}
52
52
 
53
53
  Una herramienta de mapeado para ficción interactiva.
54
54
 
55
- ggarra@advancedsl.com.ar
55
+ ggarra13@gmail.com
56
56
  EOF
57
57
 
58
58
  MSG_SAVE_MAP = 'Grabar Mapa'
@@ -266,6 +266,7 @@ MENU_EDIT = '&Editar'
266
266
  MENU_COPY = "&Copiar\tCtl-C\tCopiar Localidad"
267
267
  MENU_CUT = "Cor&tar\tCtl-X\tCortar Localidad"
268
268
  MENU_PASTE = "&Pegar\tCtl-V\tPegar Localidad"
269
+ MENU_UNDO = "&Revertir\tCtl-R\tRevertir Ultima Borrada"
269
270
 
270
271
  MENU_MAP = '&Mapa'
271
272
  MENU_SELECT = 'Seleccionar'
@@ -300,6 +301,9 @@ MENU_ADD_SECTION = "Agregar Sección\t\tAgregar una Nueva Sección al Mapa."
300
301
  MENU_RENAME_SECTION = "Renombrar Sección\t\tRenombrar Sección Actual."
301
302
  MENU_DELETE_SECTION = "Borrar Sección\t\tBorrar Sección Actual del Mapa."
302
303
 
304
+ MENU_FLIP_DIRECTION = "Invertir Dirección Selecionada"
305
+ MENU_MOVE_LINK = 'Mover coneccion a salida'
306
+ MENU_SWITCH_WITH_LINK = 'Intercambiar con conección'
303
307
 
304
308
  MENU_ZOOM_PERCENT = '#{v}%\t\tAcercamiento de la página al #{v}%.'
305
309
  MENU_ZOOM = 'Acercamiento'
data/maps/Aotearoa.map CHANGED
Binary file
data/maps/Asgard.map ADDED
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,47 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifmapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 7
10
+ version: 1.0.7
5
11
  platform: ruby
6
12
  authors:
7
- - Gonzalxo Garramuno
13
+ - Gonzalo Garramuno
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-11-19 00:00:00 -03:00
18
+ date: 2010-12-09 00:00:00 -03:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rake-compiler
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 1
30
+ segments:
31
+ - 0
32
+ - 7
33
+ - 1
23
34
  version: 0.7.1
24
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: fxruby
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 1
48
+ - 6
49
+ - 0
33
50
  version: 1.6.0
34
- version:
51
+ type: :runtime
52
+ version_requirements: *id002
35
53
  - !ruby/object:Gem::Dependency
36
54
  name: pdf-writer
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
40
58
  requirements:
41
59
  - - ">="
42
60
  - !ruby/object:Gem::Version
61
+ hash: 17
62
+ segments:
63
+ - 1
64
+ - 1
65
+ - 1
43
66
  version: 1.1.1
44
- version:
67
+ type: :runtime
68
+ version_requirements: *id003
45
69
  description: "\tInteractive Fiction Mapping Tool.\n"
46
70
  email: ggarra13@gmail.com
47
71
  executables: []
@@ -161,6 +185,7 @@ files:
161
185
  - maps/AMFV.map
162
186
  - maps/anchor.map
163
187
  - maps/Aotearoa.map
188
+ - maps/Asgard.map
164
189
  - maps/balances.map
165
190
  - maps/ballerina.map
166
191
  - maps/bear.map
@@ -170,12 +195,14 @@ files:
170
195
  - maps/building.map
171
196
  - maps/Bureaucracy.map
172
197
  - maps/christminster.map
198
+ - maps/Chronicler.map
173
199
  - maps/CityOfSecrets.map
174
200
  - maps/DDIV.map
175
201
  - maps/deadline.map
176
202
  - maps/delusions.map
177
203
  - maps/devours.map
178
204
  - maps/distress.map
205
+ - maps/Divis_Mortis.map
179
206
  - maps/djinni.map
180
207
  - maps/dreamhold.map
181
208
  - maps/drift3.map
@@ -195,12 +222,12 @@ files:
195
222
  - maps/spring.map
196
223
  - maps/squarecircle.map
197
224
  - maps/Tangle.map
225
+ - maps/The_Blind_House.map
198
226
  - maps/The_Lost_Sheep.map
199
227
  - maps/trinity.map
200
228
  - maps/Unforgotten.map
201
229
  - maps/vespers.map
202
230
  - maps/Warbler's Nest.map
203
- - maps/Warbler's_Nest.map
204
231
  - maps/wasp.map
205
232
  - maps/Westminster_Abbey.map
206
233
  - maps/WinterWonderland.map
@@ -292,21 +319,29 @@ rdoc_options: []
292
319
  require_paths:
293
320
  - lib
294
321
  required_ruby_version: !ruby/object:Gem::Requirement
322
+ none: false
295
323
  requirements:
296
324
  - - ">="
297
325
  - !ruby/object:Gem::Version
326
+ hash: 55
327
+ segments:
328
+ - 1
329
+ - 8
330
+ - 0
298
331
  version: 1.8.0
299
- version:
300
332
  required_rubygems_version: !ruby/object:Gem::Requirement
333
+ none: false
301
334
  requirements:
302
335
  - - ">="
303
336
  - !ruby/object:Gem::Version
337
+ hash: 3
338
+ segments:
339
+ - 0
304
340
  version: "0"
305
- version:
306
341
  requirements: []
307
342
 
308
343
  rubyforge_project: ifmapper
309
- rubygems_version: 1.3.5
344
+ rubygems_version: 1.3.7
310
345
  signing_key:
311
346
  specification_version: 3
312
347
  summary: Interactive Fiction Mapping Tool.
Binary file