ifmapper 0.9 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.txt +132 -5
- data/IFMapper.gemspec +2 -2
- data/TODO.txt +0 -5
- data/lib/IFMapper/AStar.rb +15 -8
- data/lib/IFMapper/Connection.rb +137 -25
- data/lib/IFMapper/FXConnection.rb +54 -40
- data/lib/IFMapper/FXConnectionDialogBox.rb +12 -4
- data/lib/IFMapper/FXMap.rb +161 -60
- data/lib/IFMapper/FXMapperWindow.rb +205 -70
- data/lib/IFMapper/FXRoom.rb +7 -2
- data/lib/IFMapper/FXRoomDialogBox.rb +2 -1
- data/lib/IFMapper/FXRoomList.rb +95 -0
- data/lib/IFMapper/PDFMapExporter.rb +10 -1
- data/lib/IFMapper/Room.rb +22 -0
- data/lib/IFMapper/TranscriptDialogBox.rb +117 -0
- data/lib/IFMapper/TranscriptReader.rb +320 -96
- data/maps/AllRoads.map +0 -0
- data/maps/Bureaucracy.map +0 -0
- data/maps/CityOfSecrets.map +0 -0
- data/maps/DDIV.map +0 -0
- data/maps/Heroine.map +0 -0
- data/maps/SavoirFare.map +0 -0
- data/maps/Tangle.map +0 -0
- data/maps/anchor.map +0 -0
- data/maps/ballerina.map +0 -0
- data/maps/bluechairs.map +0 -0
- data/maps/break_in.map +0 -0
- data/maps/christminster.map +0 -0
- data/maps/deadline.map +0 -0
- data/maps/delusions.map +0 -0
- data/maps/dreamhold.map +0 -0
- data/maps/eas.map +0 -0
- data/maps/eas2.map +0 -0
- data/maps/eas3.map +0 -0
- data/maps/inhumane.map +0 -0
- data/maps/lurkinghorror.map +0 -0
- data/maps/metamorphoses.map +0 -0
- data/maps/moonmist.map +0 -0
- data/maps/muldoon_legacy.map +0 -0
- data/maps/pawn.map +0 -0
- data/maps/pytho.map +0 -0
- data/maps/risorgimento.map +0 -0
- data/maps/sherbet.map +0 -0
- data/maps/slouch.map +0 -0
- data/maps/spring.map +0 -0
- data/maps/trinity.map +0 -0
- data/maps/worlds.map +0 -0
- data/maps/zdungeon.map +0 -0
- metadata +42 -8
data/HISTORY.txt
CHANGED
@@ -1,7 +1,134 @@
|
|
1
|
+
v0.9.5 What's new:
|
2
|
+
|
3
|
+
- IFMapper now looks for Fox1.4 and 1.2, in that order. Note that
|
4
|
+
I still recommend Fox1.2, as it is more stable.
|
5
|
+
|
6
|
+
- Automapper now supports selecting how locations are identified
|
7
|
+
(either by comparing the room descriptions or just the short name)
|
8
|
+
as well as adds support for some unusual location short name
|
9
|
+
formats used in some Infocom games (Moonmist, Witness).
|
10
|
+
|
11
|
+
- Automapper should now be able to automatically detect the name of
|
12
|
+
the game from the transcript (at least with WinFrotz and
|
13
|
+
Glux transcripts).
|
14
|
+
|
15
|
+
- Automapper was idiotically skipping the first command typed in
|
16
|
+
transcript. Fixed.
|
17
|
+
|
18
|
+
- Room descriptions now remove starting/trailing spaces or newlines.
|
19
|
+
|
20
|
+
- If possible, when getting an object, if the automapper sees an
|
21
|
+
answer like "You now have the ...", it will take the object name
|
22
|
+
from that line instead of from the name the user typed in his
|
23
|
+
command.
|
24
|
+
|
25
|
+
- Removed some debugging put statements from automapper that had been
|
26
|
+
left by mistake in v0.9.
|
27
|
+
|
28
|
+
- Added the name of the room to the statusbar when mouse is over
|
29
|
+
a room.
|
30
|
+
|
31
|
+
- You can now save an .ifm, .t, or .inf file directly from the
|
32
|
+
save as requester, if you type in a filename with such an
|
33
|
+
extension.
|
34
|
+
|
35
|
+
- The automapper now also looks for transcripts with extensions
|
36
|
+
.scr (Magnetic Scrolls/Glux) and .txt (Hugo) by default.
|
37
|
+
Note that Hugo, Glux and Magnetic Scrolls transcripts do
|
38
|
+
not append text to transcripts after each move, instead keeping a
|
39
|
+
buffer that gets spit out when filled. Thus, automapping while
|
40
|
+
playing a game with these interpreters game is not as interactive
|
41
|
+
as with winfrotz and similar. This method can also lead to some
|
42
|
+
rooms to be missed or some connections be mistaken, as sometimes
|
43
|
+
room descriptions will be written out only partially.
|
44
|
+
Finally, TADS interpreter is the worst, in that it will actually
|
45
|
+
lock the transcript file, not allowing any other program to read it.
|
46
|
+
|
47
|
+
- Cut/Copying was not allowing you to copy stub connections. Fixed.
|
48
|
+
|
49
|
+
- Pasting was not pasting the path properties (special, door, etc)
|
50
|
+
|
51
|
+
- I changed a tad how connections are stored internally to using
|
52
|
+
arrays for the two rooms and the two exit texts. I then added
|
53
|
+
code for some common operations.
|
54
|
+
|
55
|
+
- I removed the idea of BtoA connections. Now, whenever a BtoA
|
56
|
+
connection is needed, the elements in the connection are reversed.
|
57
|
+
This helps immensely to simplify operations and comparisons
|
58
|
+
on connections (and I should have done this much earlier).
|
59
|
+
In the GUI, if you want to flip a connection from A->B to B->A,
|
60
|
+
you no longer do so with clicking twice on the connection but
|
61
|
+
can do so now from the right mouse menu.
|
62
|
+
|
63
|
+
- Stub connections are now drawn a tad shorter. This helps to
|
64
|
+
avoid the problem of two nearby stub connections looking as
|
65
|
+
if it was a single connection.
|
66
|
+
|
67
|
+
- Connection window now correctly disables buttons when selecting
|
68
|
+
looping connections.
|
69
|
+
|
70
|
+
- Looping connections are no longer drawn as curves, as they look
|
71
|
+
more clear as straight lines.
|
72
|
+
|
73
|
+
- Fixed a minor display bug that would draw room index numbers
|
74
|
+
with the wrong font, while editing the room.
|
75
|
+
|
76
|
+
- Help->About will now also display the FXRuby version being
|
77
|
+
used.
|
78
|
+
|
79
|
+
- When adding multiple objects with 'get all' during an automapping
|
80
|
+
of a transcript, you would get additional newlines. Fixed.
|
81
|
+
|
82
|
+
- Sped up a tad path finding and most operations involving path map.
|
83
|
+
|
84
|
+
- Added a check to automapper when transcripts cannot be opened.
|
85
|
+
This helps, for example, with TADS transcripts, which are locked
|
86
|
+
and cannot be opened while you are still on script mode (this
|
87
|
+
absolutely blows in TADS!).
|
88
|
+
Previously, opening a TADS transcript in progress would just
|
89
|
+
crash IFMapper.
|
90
|
+
|
91
|
+
- Fixed yet another problem with links among rooms in different
|
92
|
+
sections that could still result in crashes while automapping.
|
93
|
+
|
94
|
+
- File->Save As will now warn you if you are about to overwrite a
|
95
|
+
file.
|
96
|
+
|
97
|
+
- Deleting rooms will now correctly recalculate the path map.
|
98
|
+
|
99
|
+
- IFMapper gem was not including the demo maps with extension
|
100
|
+
.map. Fixed.
|
101
|
+
|
102
|
+
- Fixed a thread racing condition which would modify the map's
|
103
|
+
sizes as it was being drawn. This could sometimes result in crashes
|
104
|
+
during transcript automapping. Now we use a mutex to avoid the
|
105
|
+
problem.
|
106
|
+
|
107
|
+
- I added a work-around for a bug in Fox that would sometimes
|
108
|
+
not re-initialize the canvas properly and would lead to a crash,
|
109
|
+
usually after 1+ hour of use of the automapper. This problem is not
|
110
|
+
yet fixed (it is a Fox issue), but the work-around will try at
|
111
|
+
least twice to make it work.
|
112
|
+
|
113
|
+
- Switching from one map to another now immediately updates the
|
114
|
+
section # in the toolbar.
|
115
|
+
|
116
|
+
- There's now a new option called Map->Room List which will
|
117
|
+
list all the rooms in your map, allowing you to also select
|
118
|
+
and sort rooms from that list.
|
119
|
+
|
120
|
+
- Added new full maps for Risorgimiento Represo, Christminster, a full
|
121
|
+
Anchorhead, the three Earth & Sky games, City of Secrets, Moonmist,
|
122
|
+
All Roads, Trinity.
|
123
|
+
Partial maps for Dreamhold, Savoir Fare, Heroine's Mantle, World's
|
124
|
+
Apart, Metamorphoses, Pytho's Mask.
|
125
|
+
All of these were created with the automapper, as I played those
|
126
|
+
games.
|
127
|
+
|
1
128
|
v0.9 - What's new:
|
2
129
|
|
3
|
-
- Fixed a very idiotic bug in Cut algorithm. It was basically
|
4
|
-
all cut connections right after they were cut.
|
130
|
+
- Fixed a very idiotic bug in Cut algorithm. It was basically
|
131
|
+
destroying all cut connections right after they were cut.
|
5
132
|
|
6
133
|
- Editing rooms' names or objects now results in a much, much
|
7
134
|
faster redraw of the map, even if map is very complex.
|
@@ -10,7 +137,7 @@ v0.9 - What's new:
|
|
10
137
|
description is often used by the the automapper during transcript
|
11
138
|
mapping to determine the uniqueness of a room, albeit the main
|
12
139
|
use of editing a room description is to allow creation of
|
13
|
-
new games (currently, Inform).
|
140
|
+
new games (currently, Inform/TADS3).
|
14
141
|
|
15
142
|
- You can now optionally avoid displaying the task or description
|
16
143
|
section on rooms.
|
@@ -212,8 +339,8 @@ v0.7 - Fix the issue of users trying to fire up the application from another
|
|
212
339
|
|
213
340
|
Added IFM export.
|
214
341
|
Note that albeit you can load and save out an IFM map file, if you load
|
215
|
-
and then save an ifm file, the integrity of the ifm file created by
|
216
|
-
will not be kept.
|
342
|
+
and then save an ifm file, the integrity of the ifm file created by
|
343
|
+
hand will not be kept.
|
217
344
|
Things such as ifm variables, task and object dependencies will be
|
218
345
|
lost if you do that. It is unlikely I will add full walkthru
|
219
346
|
functionality to IFMapper.
|
data/IFMapper.gemspec
CHANGED
@@ -2,13 +2,13 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |spec|
|
4
4
|
spec.name = "ifmapper"
|
5
|
-
spec.version = '0.9'
|
5
|
+
spec.version = '0.9.5'
|
6
6
|
spec.author = "Gonzalo Garramuno"
|
7
7
|
spec.email = 'ggarram@advance.dsl.com.ar'
|
8
8
|
spec.homepage = 'http://www.rubyforge.org/projects/ifmapper/'
|
9
9
|
spec.summary = 'Interactive Fiction Mapping Tool.'
|
10
10
|
spec.require_path = "lib"
|
11
|
-
spec.files = ['IFMapper.rbw'] + Dir.glob("lib/IFMapper/*.rb") + Dir.glob("maps/*.ifm") + Dir.glob("icons/*")
|
11
|
+
spec.files = ['IFMapper.rbw'] + Dir.glob("lib/IFMapper/*.rb") + Dir.glob("maps/*.ifm") + Dir.glob("maps/*.map") + Dir.glob("icons/*")
|
12
12
|
spec.description = <<-EOF
|
13
13
|
Interactive Fiction Mapping Tool.
|
14
14
|
EOF
|
data/TODO.txt
CHANGED
data/lib/IFMapper/AStar.rb
CHANGED
@@ -105,7 +105,7 @@ class AStar
|
|
105
105
|
else
|
106
106
|
# Not goal, get successors
|
107
107
|
n.info.successors( self, n.parent )
|
108
|
-
@successors.each
|
108
|
+
@successors.each do |s|
|
109
109
|
newg = n.g + n.info.cost( s.info )
|
110
110
|
|
111
111
|
# Now, we need to find out if this node is on the open or close lists
|
@@ -128,12 +128,19 @@ class AStar
|
|
128
128
|
|
129
129
|
# Remove succesor from closed list if it was on it
|
130
130
|
@closed_list.delete(closed) if closed
|
131
|
-
#
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
131
|
+
# Change succesor from open list if it was on it
|
132
|
+
if open
|
133
|
+
open.parent = s.parent
|
134
|
+
open.g = s.g
|
135
|
+
open.h = s.h
|
136
|
+
open.f = s.f
|
137
|
+
else
|
138
|
+
@open_list.push(s)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
# Make sure open list stays sorted based on f
|
142
|
+
@open_list.sort!
|
143
|
+
|
137
144
|
@closed_list.push(n)
|
138
145
|
@successors.clear
|
139
146
|
end
|
@@ -200,7 +207,7 @@ class MapNode
|
|
200
207
|
if x < 0 or y < 0 or x >= @@pmap.size or y >= @@pmap[0].size
|
201
208
|
return MAX_SCALE
|
202
209
|
else
|
203
|
-
t = @@pmap
|
210
|
+
t = @@pmap.at(x).at(y)
|
204
211
|
return MAX_SCALE if t.kind_of?(Room)
|
205
212
|
return MAX_SCALE-1 if t.kind_of?(Connection)
|
206
213
|
return 1
|
data/lib/IFMapper/Connection.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
#
|
6
6
|
class Connection
|
7
7
|
attr_accessor :type
|
8
|
-
|
9
|
-
attr_accessor :
|
10
|
-
attr_accessor :
|
8
|
+
attr_reader :dir
|
9
|
+
attr_accessor :room
|
10
|
+
attr_accessor :exitText
|
11
11
|
|
12
12
|
# Type constants
|
13
13
|
FREE = 0
|
@@ -18,7 +18,7 @@ class Connection
|
|
18
18
|
# Direction constants
|
19
19
|
BOTH = 0
|
20
20
|
AtoB = 1
|
21
|
-
BtoA = 2
|
21
|
+
BtoA = 2 # NO LONGER USED.
|
22
22
|
|
23
23
|
# Text near connection (to indicate other dir)
|
24
24
|
EXIT_TEXT = [
|
@@ -29,52 +29,164 @@ class Connection
|
|
29
29
|
'O'
|
30
30
|
]
|
31
31
|
|
32
|
+
def dir=(x)
|
33
|
+
if x == BtoA
|
34
|
+
@dir = AtoB
|
35
|
+
flip
|
36
|
+
else
|
37
|
+
@dir = x
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def roomA=(x)
|
42
|
+
@room[0] = x
|
43
|
+
end
|
44
|
+
|
45
|
+
def roomB=(x)
|
46
|
+
@room[1] = x
|
47
|
+
end
|
48
|
+
|
49
|
+
def roomA
|
50
|
+
return @room[0]
|
51
|
+
end
|
52
|
+
|
53
|
+
def roomB
|
54
|
+
return @room[1]
|
55
|
+
end
|
56
|
+
|
57
|
+
def exitAtext=(x)
|
58
|
+
@exitText[0] = x
|
59
|
+
end
|
60
|
+
|
61
|
+
def exitBtext=(x)
|
62
|
+
@exitText[1] = x
|
63
|
+
end
|
64
|
+
|
65
|
+
def exitAtext
|
66
|
+
return @exitText[0]
|
67
|
+
end
|
68
|
+
|
69
|
+
def exitBtext
|
70
|
+
return @exitText[1]
|
71
|
+
end
|
32
72
|
|
33
73
|
def marshal_load(vars)
|
34
|
-
|
35
|
-
@
|
74
|
+
if vars[2].kind_of?(Array)
|
75
|
+
@type, @dir, @room, @exitText = vars
|
76
|
+
else
|
77
|
+
@type = vars[0]
|
78
|
+
@dir = vars[1]
|
79
|
+
@room = [vars[2], vars[3]]
|
80
|
+
@exitText = [vars[4], vars[5]]
|
81
|
+
if @dir == BtoA
|
82
|
+
@dir = AtoB
|
83
|
+
flip
|
84
|
+
end
|
85
|
+
end
|
36
86
|
end
|
37
87
|
|
38
88
|
def marshal_dump
|
39
|
-
[ @type, @dir, @
|
89
|
+
[ @type, @dir, @room, @exitText ]
|
40
90
|
end
|
41
91
|
|
42
92
|
def initialize( roomA, roomB, dir = BOTH, type = FREE )
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@
|
48
|
-
@
|
93
|
+
@room = []
|
94
|
+
@room[0] = roomA
|
95
|
+
@room[1] = roomB
|
96
|
+
@dir = dir
|
97
|
+
@type = type
|
98
|
+
@exitText = [0, 0]
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# Given a room, return the index of that room in the room[] array
|
103
|
+
# If room is not present in connection, return nil.
|
104
|
+
#
|
105
|
+
def index(room)
|
106
|
+
@room.each_with_index { |r, idx| return idx if r == room }
|
107
|
+
return nil
|
49
108
|
end
|
50
109
|
|
110
|
+
#
|
111
|
+
# Flip A and B rooms. This is mainly used to make a oneway AtoB
|
112
|
+
# connection become a BtoA connection.
|
113
|
+
#
|
114
|
+
def flip
|
115
|
+
return unless @room[1]
|
116
|
+
@room.reverse!
|
117
|
+
@exitText.reverse!
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# Return the connected direction index for each room
|
122
|
+
#
|
123
|
+
def dirs
|
124
|
+
dirA = @room[0].exits.index(self)
|
125
|
+
if @room[1]
|
126
|
+
dirB = @room[1].exits.rindex(self)
|
127
|
+
else
|
128
|
+
dirB = nil
|
129
|
+
end
|
130
|
+
return [dirA, dirB]
|
131
|
+
end
|
51
132
|
|
133
|
+
#
|
134
|
+
# Return true if connection is a stub exit (ie. an exit leading nowhere)
|
135
|
+
#
|
52
136
|
def stub?
|
53
|
-
return true unless @
|
137
|
+
return true unless @room[1]
|
54
138
|
return false
|
55
139
|
end
|
56
140
|
|
141
|
+
#
|
142
|
+
# Return true if connection is a self-looping connection
|
143
|
+
#
|
144
|
+
def loop?
|
145
|
+
return false if @room[0] != @room[1]
|
146
|
+
dirA, dirB = dirs
|
147
|
+
return true if dirA == dirB
|
148
|
+
return false
|
149
|
+
end
|
150
|
+
|
151
|
+
#
|
152
|
+
# Return true if connection is a door
|
153
|
+
#
|
154
|
+
def door?
|
155
|
+
return true if @type == CLOSED_DOOR or @type == LOCKED_DOOR
|
156
|
+
return false
|
157
|
+
end
|
158
|
+
|
159
|
+
#
|
160
|
+
# For debugging purposes, print ourselves nicely
|
161
|
+
#
|
57
162
|
def to_s
|
58
163
|
dirA = dirB = ''
|
59
|
-
a = @
|
60
|
-
b = @
|
61
|
-
if
|
62
|
-
dirA = EXIT_TEXT[
|
164
|
+
a = @room[0]? @room[0].name : 'nil'
|
165
|
+
b = @room[1]? @room[1].name : 'nil'
|
166
|
+
if @exitText[0] > 0
|
167
|
+
dirA = EXIT_TEXT[@exitText[0]]
|
63
168
|
else
|
64
|
-
if @
|
65
|
-
idx = @
|
169
|
+
if @room[0]
|
170
|
+
idx = @room[0].exits.index(self)
|
66
171
|
dirA = Room::DIRECTIONS[idx] if idx
|
172
|
+
dirA = dirA.upcase
|
67
173
|
end
|
68
174
|
end
|
69
|
-
if
|
70
|
-
dirB = EXIT_TEXT[
|
175
|
+
if @exitText[1] > 0
|
176
|
+
dirB = EXIT_TEXT[@exitText[1]]
|
71
177
|
else
|
72
|
-
if @
|
73
|
-
idx = @
|
178
|
+
if @room[1]
|
179
|
+
idx = @room[1].exits.rindex(self)
|
74
180
|
dirB = Room::DIRECTIONS[idx] if idx
|
181
|
+
dirB = dirB.upcase
|
75
182
|
end
|
76
183
|
end
|
77
|
-
|
184
|
+
if @dir == AtoB
|
185
|
+
sym = ' --> '
|
186
|
+
else
|
187
|
+
sym = ' <-> '
|
188
|
+
end
|
189
|
+
"#{a} #{dirA}#{sym}#{b} #{dirB}"
|
78
190
|
end
|
79
191
|
end
|
80
192
|
|
@@ -38,6 +38,10 @@ class FXConnection < Connection
|
|
38
38
|
|
39
39
|
@@win = nil
|
40
40
|
|
41
|
+
def self.no_maps
|
42
|
+
@@win.hide if @@win
|
43
|
+
end
|
44
|
+
|
41
45
|
def initialize( roomA, roomB, dir = Connection::BOTH,
|
42
46
|
type = Connection::FREE )
|
43
47
|
super( roomA, roomB, dir, type )
|
@@ -55,6 +59,13 @@ class FXConnection < Connection
|
|
55
59
|
[ @selected ] + super
|
56
60
|
end
|
57
61
|
|
62
|
+
def flip
|
63
|
+
super
|
64
|
+
pts.reverse!
|
65
|
+
gpts.reverse!
|
66
|
+
@@win.copy_from(self) if @@win
|
67
|
+
end
|
68
|
+
|
58
69
|
#
|
59
70
|
# Change selection state of connection. If Connection Properties
|
60
71
|
# window is open, copy the connection data to it.
|
@@ -69,12 +80,10 @@ class FXConnection < Connection
|
|
69
80
|
#
|
70
81
|
def toggle_direction
|
71
82
|
# If a self-loop, we cannot change dir
|
72
|
-
return if @
|
73
|
-
@
|
74
|
-
|
75
|
-
@dir += 1
|
76
|
-
@dir = BOTH if @dir > BtoA
|
83
|
+
return if @room[0] == @room[1] and
|
84
|
+
@room[0].exits.index(self) == @room[0].exits.rindex(self)
|
77
85
|
|
86
|
+
@dir ^= 1
|
78
87
|
@@win.copy_from(self) if @@win
|
79
88
|
end
|
80
89
|
|
@@ -83,21 +92,21 @@ class FXConnection < Connection
|
|
83
92
|
# contiguous
|
84
93
|
#
|
85
94
|
def complex?()
|
86
|
-
return false if not @
|
87
|
-
return true if @
|
88
|
-
return true unless @
|
95
|
+
return false if not @room[1]
|
96
|
+
return true if @room[1] == @room[0]
|
97
|
+
return true unless @room[0].next_to?(@room[1])
|
89
98
|
|
90
99
|
# Even if rooms are next to each other, we need to
|
91
100
|
# verify that following the exits does indeed take us to next room.
|
92
|
-
exitA = @
|
101
|
+
exitA = @room[0].exits.index(self)
|
93
102
|
dir = Room::DIR_TO_VECTOR[exitA]
|
94
103
|
|
95
|
-
if @
|
96
|
-
@
|
97
|
-
exitB = @
|
104
|
+
if @room[0].x + dir[0] == @room[1].x and
|
105
|
+
@room[0].y + dir[1] == @room[1].y
|
106
|
+
exitB = @room[1].exits.rindex(self)
|
98
107
|
dir = Room::DIR_TO_VECTOR[exitB]
|
99
|
-
if @
|
100
|
-
@
|
108
|
+
if @room[1].x + dir[0] == @room[0].x and
|
109
|
+
@room[1].y + dir[1] == @room[0].y
|
101
110
|
return false
|
102
111
|
else
|
103
112
|
return true
|
@@ -155,16 +164,16 @@ class FXConnection < Connection
|
|
155
164
|
|
156
165
|
def _arrow_info( x1, y1, x2, y2, zoom = 1.0 )
|
157
166
|
pt1 = []
|
158
|
-
dir
|
159
|
-
|
160
|
-
|
161
|
-
|
167
|
+
dir = 0
|
168
|
+
dir = @room[1].exits.rindex(self)
|
169
|
+
pt1 = [ x2, y2 ]
|
170
|
+
x, y = Room::DIR_TO_VECTOR[dir]
|
171
|
+
if @room[0] == @room[1]
|
172
|
+
size = 15.0
|
162
173
|
else
|
163
|
-
|
164
|
-
pt1 = [ x1, y1 ]
|
174
|
+
size = 20.0
|
165
175
|
end
|
166
|
-
x
|
167
|
-
arrow_len = 20.0 / Math.sqrt(x * x + y * y)
|
176
|
+
arrow_len = size / Math.sqrt(x * x + y * y)
|
168
177
|
x *= arrow_len * zoom
|
169
178
|
y *= arrow_len * -zoom
|
170
179
|
|
@@ -241,7 +250,16 @@ class FXConnection < Connection
|
|
241
250
|
#
|
242
251
|
def draw_complex(dc, zoom, opt)
|
243
252
|
if opt['Paths as Curves']
|
244
|
-
|
253
|
+
if @room[0] == @room[1]
|
254
|
+
dirA, dirB = dirs
|
255
|
+
if dirA == dirB
|
256
|
+
p = draw_complex_as_lines(dc, zoom)
|
257
|
+
else
|
258
|
+
p = draw_complex_as_bspline(dc, zoom)
|
259
|
+
end
|
260
|
+
else
|
261
|
+
p = draw_complex_as_bspline(dc, zoom)
|
262
|
+
end
|
245
263
|
else
|
246
264
|
p = draw_complex_as_lines(dc, zoom)
|
247
265
|
end
|
@@ -263,10 +281,10 @@ class FXConnection < Connection
|
|
263
281
|
# line connections or 'stub' connections.
|
264
282
|
#
|
265
283
|
def draw_simple(dc, zoom)
|
266
|
-
dir = @
|
267
|
-
x1, y1 = @
|
268
|
-
if @
|
269
|
-
x2, y2 = @
|
284
|
+
dir = @room[0].exits.index(self)
|
285
|
+
x1, y1 = @room[0].corner(self, zoom, dir)
|
286
|
+
if @room[1]
|
287
|
+
x2, y2 = @room[1].corner(self, zoom)
|
270
288
|
dc.drawLine( x1, y1, x2, y2 )
|
271
289
|
draw_arrow(dc, zoom, x1, y1, x2, y2)
|
272
290
|
if @type == LOCKED_DOOR or @type == CLOSED_DOOR
|
@@ -275,11 +293,7 @@ class FXConnection < Connection
|
|
275
293
|
else
|
276
294
|
# Complex connection in progress or "stub" exit
|
277
295
|
v = FXRoom::DIR_TO_VECTOR[dir]
|
278
|
-
x2, y2 = [
|
279
|
-
x2 *= WW * zoom
|
280
|
-
y2 *= HH * zoom
|
281
|
-
x2 += WW / 2 * zoom
|
282
|
-
y2 += HH / 2 * zoom
|
296
|
+
x2, y2 = [ x1 + v[0] * WS * zoom * 0.4, y1 + v[1] * HS * zoom * 0.4 ]
|
283
297
|
dc.drawLine( x1, y1, x2, y2 )
|
284
298
|
end
|
285
299
|
end
|
@@ -331,17 +345,17 @@ class FXConnection < Connection
|
|
331
345
|
# Draw any exit text if available (exit text is 'U', 'D', 'I', 'O', etc)
|
332
346
|
#
|
333
347
|
def draw_exit_text(dc, zoom)
|
334
|
-
if @
|
335
|
-
dir = @
|
336
|
-
x, y = @
|
348
|
+
if @exitText[0] != 0
|
349
|
+
dir = @room[0].exits.index(self)
|
350
|
+
x, y = @room[0].corner(self, zoom, dir)
|
337
351
|
draw_text( dc, zoom, x, y, dir,
|
338
|
-
EXIT_TEXT[@
|
352
|
+
EXIT_TEXT[@exitText[0]], nil )
|
339
353
|
end
|
340
|
-
if @
|
341
|
-
dir = @
|
342
|
-
x, y = @
|
354
|
+
if @exitText[1] != 0
|
355
|
+
dir = @room[1].exits.rindex(self)
|
356
|
+
x, y = @room[1].corner(self, zoom, dir)
|
343
357
|
draw_text( dc, zoom, x, y, dir,
|
344
|
-
EXIT_TEXT[@
|
358
|
+
EXIT_TEXT[@exitText[1]], @dir == AtoB)
|
345
359
|
end
|
346
360
|
end
|
347
361
|
|