❤ 0 Auteur : Blizzard
Logiciel : RPG Maker XP
Nombre de scripts : 1
Source : https://forum.chaos-project.com/index.php/topic,5161.0.html?PHPSESSID=233c6892832487b39d18d772cea48c60
Fonctionnalités
- Ce script permet de relier toutes les maps comme s'il s'agissait d'une seule grande carte
- Facilement configurable
Conditions d'utilisation de la 1.5
Ce script est sous licence BSD License 2.0 :
- Vous pouvez utiliser ce script dans vos projets commerciaux
- Vous devez créditez l'auteur en ces termes :
Citation: CLRS plugin for Blizz-ABS licensed under BSD License 2.0
Copyright (c) Boris "Blizzard" Mikić |
ou
Citation: CLRS plugin for Blizz-ABS licensed under BSD License 2.0
Copyright (c) Boris "Blizzard" Mikic |
- La redistribution du script doit conserver le bandereau de licence, la liste des conditions et son disclaimer.
- La même chose s'applique pour la redistribution en binaire.
- Le nom du propriétaire et de ses contributeurs ne peuvent être utilisés à des fins de promotion du produit dérivé sans autorisation préalable.
Installation
A placer au-dessus de Main.
Utilisation
Pour relier les maps entre elles, il faut aller après l'encart de description du texte :
1
2
3
4
5
6
7
8
9
10
11
12
13
| #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# define all neighbor maps here
MAP_DATA = [
# [MAP_ID1, MAP_ID2, X_OFFSET, Y_OFFSET]
[1, 2, 17, 0], # connected map 1 and 2 where 2 has an X, Y offset of 25, 0
[2, 3, 17, 0],
[3, 4, 0, 13]
]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
MAP_ID1 et MAP_ID2 sont les deux maps adjacentes à relier.
X_OFFSET et Y_OFFSET sont les coordonnées X et Y qui sont prises en compte lors de la téléportation (et donc de la transition de carte). Ces valeurs peuvent être la valeur du bord x ou y de la map, ou vous pouvez choisir une valeur un peu inférieure.
Notes :
- Il peut y avoir des ralentissements au moment du transfert entre les maps.
- Privilégiez les petites cartes. En cas de grande map, le temps de chargement augmente, ainsi que le lag.
- Connectez bien toutes les maps adjacentes sous peine de rencontrer des bugs.
- Sur VX, il existe un bug au niveau du centrage de l'écran ; si vous vous téléportez sur une carte plus grande ou large que la précédenge, cela crée un glitch d'affichage.
Compatibilité
- Compatible à 95% avec avec le SDK 1.0. 80% compatible avec le SDK 2.0
- Anciennes sauvegardes inutilisables
- Compatible avec le Blizz-ABS
- Incompatible avec Intelligent Passability de Blizz-ABS (désactivé)
- Incompatible avec Blizz-ABS Caterpillar
- Compatible avec le Caterpillar de Tons of Addons
Version 1.5 (recommandée)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
| #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Continuous Maps by Blizzard
# Version: 1.5
# Type: Custom Map System
# Date: 14.12.2009
# Date v1.2: 11.9.2010
# Date v1.3: 17.11.2012
# Date v1.4: 8.1.2013
# Date v1.41: 14.5.2013
# Date v1.5: 23.3.2019
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is licensed under BSD License 2.0:
#
# #----------------------------------------------------------------------------
# #
# # Copyright (c) Boris "Blizzard" Mikić
# # All rights reserved.
# #
# # Redistribution and use in source and binary forms, with or without
# # modification, are permitted provided that the following conditions are met:
# #
# # 1. Redistributions of source code must retain the above copyright notice,
# # this list of conditions and the following disclaimer.
# #
# # 2. Redistributions in binary form must reproduce the above copyright
# # notice, this list of conditions and the following disclaimer in the
# # documentation and/or other materials provided with the distribution.
# #
# # 3. Neither the name of the copyright holder nor the names of its
# # contributors may be used to endorse or promote products derived from
# # this software without specific prior written permission.
# #
# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# # POSSIBILITY OF SUCH DAMAGE.
# #
# #----------------------------------------------------------------------------
#
# You may use this script for both non-commercial and commercial products
# without limitations as long as you fulfill the conditions presented by the
# above license. The "complete" way to give credit is to include the license
# somewhere in your product (e.g. in the credits screen), but a "simple" way
# is also acceptable. The "simple" way to give credit is as follows:
#
# CLRS plugin for Blizz-ABS licensed under BSD License 2.0
# Copyright (c) Boris "Blizzard" Mikić
#
# Alternatively, if your font doesn't support diacritic characters, you may
# use this variant:
#
# CLRS plugin for Blizz-ABS licensed under BSD License 2.0
# Copyright (c) Boris "Blizzard" Mikic
#
# In general other similar variants are allowed as long as it is clear who
# the creator is (e.g. "CLRS plugin for Blizz-ABS created by Blizzard" is
# acceptable). But if possible, prefer to use one of the two variants listed
# above.
#
# If you fail to give credit and/or claim that this work was created by you,
# this may result in legal action and/or payment of damages even though this
# work is free of charge to use normally.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# 95% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt old
# savegames. Compatible with Blizz-ABS. Compatible with Tons of Add-ons'
# catepillar. Not compatible with Intelligent Passability from Blizz-ABS,
# it's being turned off. Not compatible with Blizz-ABS's caterpillar.
#
#
# Features:
#
# - virtually creates one continuous map from any number of map fragments
# - easy to configure
#
# new in v1.2:
# - fixed bug where transferring into a non-configured map would crash the
# game
# - fixed bug when teleporting into another set of maps would mess up
# everything
#
# new in v1.3:
# - added compatibility with Tons of Add-ons' Catepillar
#
# new in v1.4:
# - fixed crash caused by compatibility fix with Tons of Add-ons' Catepillar
# - added code for proper fog handling
#
# new in v1.41:
# - fixed bug with Blizz-ABS enemy positions
#
# new in v1.5:
# - added new license
# - added usage and crediting instructions
#
#
# Instructions:
#
# - Explanation:
#
# This Script will allow you to make the game simulate a continuous map using
# smaller maps. The system displays the current map and the neighbor maps.
# Walking over a map border will cause the new map to be loaded as main map
# and the neighbor maps will be changed.
#
#
# Notes:
#
# - You may notice lag when walking over a map border.
# - Do not use too big maps as it increases loading time and the short moment
# of lag will become more and more visible. Due to the fact that map
# loading times in Blizz-ABS are increased, those moments will be longer if
# Blizz-ABS is being used.
# - Remember to connect ALL neighbor maps or you might experience bugs.
# - Does not work with Blizz-ABS caterpillar because switching the party
# leader would technically have to change the map and that causes a lot of
# problems, including several party members being in several different maps
# at the same time which might be disabled/removed from the current
# display.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module CTMAPS
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# define all neighbor maps here
MAP_DATA = [
# [MAP_ID1, MAP_ID2, X_OFFSET, Y_OFFSET]
[1, 2, 25, 0], # connected map 1 and 2 where 2 has an X, Y offset of 25, 0
[3, 1, 0, -15], # connected map 3 and 1 where 1 has an X, Y offset of 0, -15
[3, 2, 25, -15],
[3, 4, 0, 15],
[3, 5, 25, 15],
[4, 5, 25, 0],
[6, 7, 25, 0],
[8, 6, 0, -15],
[8, 7, 25, -15],
[8, 9, 0, 15],
[8, 10, 25, 15],
[9, 10, 25, 0],
]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
MAP_DATA.compact!
MAPS = {}
MAP_DATA.each {|data|
MAPS[data[0]] = [] if MAPS[data[0]] == nil
MAPS[data[0]] |= [data[1, 3]]
MAPS[data[1]] = [] if MAPS[data[1]] == nil
MAPS[data[1]] |= [[data[0], -data[2], -data[3]]]}
MAP_DATA = nil
E_IDS = 100000
$ctmaps = 1.5
end
#==============================================================================
# Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :player_no_straighten
attr_accessor :player_caterpillar_fix
end
#==============================================================================
# Game_Character
#==============================================================================
class Game_Character
attr_accessor :x
attr_accessor :y
attr_accessor :real_x
attr_accessor :real_y
alias straighten_ctmaps_later straighten
def straighten
if $game_temp.player_no_straighten
$game_temp.player_no_straighten = nil
return
end
straighten_ctmaps_later
end
alias moveto_ctmaps_later moveto
def moveto(x, y)
ox, oy = $game_map.upper_left
moveto_ctmaps_later(x - ox, y - oy)
end
end
if $BlizzABS
#==============================================================================
# module BlizzABS
#==============================================================================
module BlizzABS
#============================================================================
# BlizzABS::Controller
#============================================================================
class Controller
alias center_ctmaps_later center
def center(x, y, flag = false)
ox, oy = $game_map.upper_left
center_ctmaps_later(x - ox, y - oy, flag)
end
end
#============================================================================
# BlizzABS::Utility
#============================================================================
class Utility
alias setup_passability_ctmaps_later setup_passability
def setup_passability(map, override = false)
setup_passability_ctmaps_later(map) if override
end
end
end
$BlizzABS = BlizzABS::Processor.new
#==============================================================================
# Map_Battler
#==============================================================================
class Map_Battler
attr_writer :id
attr_writer :SELF
alias moveto_ctmaps_later moveto
def moveto(x, y)
ox, oy = $game_map.upper_left
moveto_ctmaps_later(x - ox, y - oy)
end
end
else
#==============================================================================
# Game_Player
#==============================================================================
class Game_Player
alias center_ctmaps_later center
def center(x, y)
ox, oy = $game_map.upper_left
center_ctmaps_later(x - ox, y - oy)
end
alias moveto_ctmaps_later2 moveto
def moveto(x, y)
fix = $game_temp.player_caterpillar_fix
$game_temp.player_caterpillar_fix = false
if $tons_version == nil || $tons_version < 7.62 ||
!$game_system.CATERPILLAR || !fix
moveto_ctmaps_later2(x, y)
return
end
px = self.x
py = self.y
moveto_caterpillar(x, y)
@members.each {|member| member.moveto(x + member.x - px, y + member.y - py)}
end
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
attr_reader :upper_left
attr_reader :lower_right
attr_reader :maps
alias init_ctmaps_later initialize
def initialize
@maps = {}
@events = {}
init_ctmaps_later
end
alias setup_ctmaps_later setup
def setup(map_id)
last_maps = @maps
last_map_id = @map_id
@upper_left = [0, 0]
@lower_right = [0, 0]
events = @events
fog_ox = @fog_ox
fog_oy = @fog_oy
fog_tone = @fog_tone
fog_tone_target = @fog_tone_target
fog_tone_duration = @fog_tone_duration
fog_opacity_duration = @fog_opacity_duration
fog_opacity_target = @fog_opacity_target
setup_ctmaps_later(map_id)
@maps = get_neighbor_maps
if !@maps.has_key?(last_map_id)
@events = {}
last_maps = {}
last_map_id = 0
else
@events = events
@fog_ox = fog_ox
@fog_oy = fog_oy
@fog_tone = fog_tone
@fog_tone_target = fog_tone_target
@fog_tone_duration = fog_tone_duration
@fog_opacity_duration = fog_opacity_duration
@fog_opacity_target = fog_opacity_target
end
setup_continuous_map
setup_continuous_events(last_maps, last_map_id)
if $BlizzABS
@virtual_passability = $BlizzABS.util.setup_passability(@map, true)
end
end
def get_neighbor_maps
maps = {}
maps[@map_id] = [@map, 0, 0]
@upper_left = [0, 0]
@lower_right = [@map.width, @map.height]
if CTMAPS::MAPS.has_key?(@map_id)
CTMAPS::MAPS[@map_id].each {|data|
id, x, y = data
if @maps[id] != nil
map = @maps[id][0]
else
map = load_data(sprintf('Data/Map%03d.rxdata', id))
end
maps[id] = [map, x, y]
@upper_left[0] = x if @upper_left[0] > x
@upper_left[1] = y if @upper_left[1] > y
width, height = x + map.width, y + map.height
@lower_right[0] = width if @lower_right[0] < width
@lower_right[1] = height if @lower_right[1] < height}
maps.each_value {|data|
data[1] -= @upper_left[0]
data[2] -= @upper_left[1]}
end
return maps
end
def setup_continuous_map
width = @lower_right[0] - @upper_left[0]
height = @lower_right[1] - @upper_left[1]
data = Table.new(width, height, 3)
@map = @map.clone
@map.events = {}
@maps.each_key {|id|
map, ox, oy = @maps[id]
if id == @map_id
map.events.each_key {|i| @map.events[i] = map.events[i]}
else
map.events.each_key {|i| @map.events[id * CTMAPS::E_IDS + i] = map.events[i]}
end
(0...map.width).each {|x| (0...map.height).each {|y| (0...3).each {|z|
data[x + ox, y + oy, z] = map.data[x, y, z]}}}}
@map.width = width
@map.height = height
@map.data = data
end
def setup_continuous_events(last_maps, last_map_id)
if last_maps[@map_id] != nil
correct_event_positions(last_maps)
correct_fog_position(last_maps)
end
delete_removed_events(last_maps, last_map_id)
shift_events_from_last_map(last_maps, last_map_id) if last_map_id != 0
shift_events_for_new_map
add_new_events(last_maps)
end
def delete_removed_events(last_maps, last_map_id)
keys = []
@maps.each_key {|id|
keys += @events.keys.find_all {|key|
@events[key].real_x < 0 || @events[key].real_y < 0 ||
@events[key].real_x >= (@lower_right[0] - @upper_left[0]) * 128 ||
@events[key].real_y >= (@lower_right[1] - @upper_left[1]) * 128}}
(keys | keys).each {|key| @events.delete(key)}
end
def shift_events_from_last_map(last_maps, last_map_id)
@events.each_key {|key|
if key < CTMAPS::E_IDS
@events[last_map_id * CTMAPS::E_IDS + key] = @events[key]
if $BlizzABS && @events[key].is_a?(Map_Battler)
@events[key].SELF = @events[key].id = last_map_id * CTMAPS::E_IDS + key
end
@events.delete(key)
end}
end
def shift_events_for_new_map
@events.each_key {|key|
if key >= @map_id * CTMAPS::E_IDS && key < (@map_id + 1) * CTMAPS::E_IDS
@events[key % CTMAPS::E_IDS] = @events[key]
if $BlizzABS && @events[key].is_a?(Map_Battler)
@events[key].SELF = @events[key].id = key % CTMAPS::E_IDS
end
@events.delete(key)
end}
end
def correct_event_positions(last_maps)
pix = $BlizzABS.pixel if $BlizzABS
sx = @maps[@map_id][1] - last_maps[@map_id][1]
sy = @maps[@map_id][2] - last_maps[@map_id][2]
@events.each_value {|event|
if $BlizzABS && event.is_a?(Map_Battler)
x, y = sx * pix, sy * pix
else
x, y = sx, sy
end
event.x += x
event.y += y
event.real_x += sx * 128
event.real_y += sy * 128}
end
def correct_fog_position(last_maps)
@fog_ox -= (@maps[@map_id][1] - last_maps[@map_id][1]) * 32
@fog_oy -= (@maps[@map_id][2] - last_maps[@map_id][2]) * 32
end
def add_new_events(last_maps = {})
if last_maps[@map_id] == nil
@maps[@map_id][0].events.each_key {|i|
if @events[i] == nil
@events[i] = Game_Event.new(@map_id, @maps[@map_id][0].events[i])
$BlizzABS.check_event_name(i) if $BlizzABS
end}
end
pix = $BlizzABS.pixel if $BlizzABS
(@maps.keys - last_maps.keys - [@map_id]).each {|id|
map, sx, sy = @maps[id]
sx -= @maps[@map_id][1]
sy -= @maps[@map_id][2]
map.events.each_key {|i|
if @events[id * CTMAPS::E_IDS + i] == nil
@events[id * CTMAPS::E_IDS + i] = event = Game_Event.new(id, map.events[i])
if $BlizzABS
$BlizzABS.check_event_name(id * CTMAPS::E_IDS + i)
event = @events[id * CTMAPS::E_IDS + i]
if event.is_a?(Map_Battler)
x, y = sx * pix, sy * pix
else
x, y = sx, sy
end
else
x, y = sx, sy
end
event.x += x
event.y += y
event.real_x += sx * 128
event.real_y += sy * 128
end}}
end
alias update_ctmaps_later update
def update
update_ctmaps_later
return if $game_player.moving? || @maps.size <= 1
map, x, y = @maps[@map_id]
if $game_player.real_x < x * 128 || $game_player.real_y < y * 128 ||
$game_player.real_x >= x * 128 + map.width * 128 ||
$game_player.real_y >= y * 128 + map.height * 128
(@maps.keys - [@map_id]).each {|id|
map, x, y = @maps[id]
if $game_player.real_x >= x * 128 && $game_player.real_y >= y * 128 &&
$game_player.real_x < x * 128 + map.width * 128 &&
$game_player.real_y < y * 128 + map.height * 128
$game_temp.player_transferring = true
$game_temp.player_no_straighten = true
$game_temp.player_caterpillar_fix = true
$game_temp.player_new_x = $game_player.real_x / 128 - x
$game_temp.player_new_y = $game_player.real_y / 128 - y
$game_temp.player_new_map_id = id
$game_temp.player_new_direction = 0
break
end}
end
end
end |
Version 1.2 (archive)
Spoiler (cliquez pour afficher)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
| #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Continuous Maps by Blizzard
# Version: 1.2
# Type: Custom Map System
# Date: 14.12.2009
# Date v1.2: 11.9.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # (http://creativecommons.org/licenses/by-nc-sa/3.0/)
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# - possible incompatibility in this script will lie in scripts that modify
# map transfers.
#
# Features:
#
# - virtually creates one continuous map from any number of map fragments
# - easy to configure
#
# Instructions:
#
# - Explanation:
#
# This Script will allow you to make the game simulate a continuous map using
# smaller maps. The system displays the current map and the neighbor maps.
# Walking over a map border will cause the new map to be loaded as main map
# and the neighbor maps will be changed.
#
#
# Notes:
#
# - You may notice lag when walking over a map border.
# - Do not use too big maps as it increases loading time and the short moment
# of lag will become more and more visible.
# - Remember to connect ALL neighbor maps or you might experience bugs.
# - For Vx, the most noticable bug is the centering of the screen; if you
# - Move from a map onto a map that is connected to a map that is taller or
# wider, the screen will 'jerk' to the player to center around them. This
#
# If you find any bugs, please report them at rpgmakervx.net's Continuous Map
# topic.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module CTMAPS
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# define all neighbor maps here
MAP_DATA = [
# [MAP_ID1, MAP_ID2, X_OFFSET, Y_OFFSET]
[1, 2, 17, 0], # connected map 1 and 2 where 2 has an X, Y offset of 25, 0
[2, 3, 17, 0],
[3, 4, 0, 13]
]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
MAP_DATA.compact!
MAPS = {}
MAP_DATA.each {|data|
MAPS[data[0]] = [] if MAPS[data[0]] == nil
MAPS[data[0]] |= [data[1, 3]]
MAPS[data[1]] = [] if MAPS[data[1]] == nil
MAPS[data[1]] |= [[data[0], -data[2], -data[3]]]}
MAP_DATA = nil
$ctmaps = 1.2
end
#==============================================================================
# Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :player_no_straighten
attr_accessor :normal_transfer
attr_accessor :display_scroll_limit
alias cont_maps_init initialize unless $@
def initialize
cont_maps_init
@player_no_straighten = true
@normal_transfer = false
@display_scroll_limit = false
end
end
#==============================================================================
# Game_Character
#==============================================================================
class Game_Character
attr_accessor :x
attr_accessor :y
attr_accessor :real_x
attr_accessor :real_y
alias straighten_ctmaps_later straighten
def straighten
if $game_temp.player_no_straighten
$game_temp.player_no_straighten = nil
return
end
straighten_ctmaps_later
end
alias moveto_ctmaps_later moveto
def moveto(x, y)
ox, oy = $game_map.upper_left;
moveto_ctmaps_later(x - ox, y - oy)
end
end
#==============================================================================
# Game_Player
#==============================================================================
class Game_Player < Game_Character
alias center_ctmaps_later center
def center(x, y)
ox, oy = $game_map.upper_left
center_ctmaps_later(x - ox, y - oy)
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
attr_reader :upper_left
attr_reader :lower_right
attr_reader :maps
alias init_ctmaps_later initialize
def initialize
@maps = {}
@events = {}
init_ctmaps_later
end
alias setup_ctmaps_later setup
def setup(map_id)
last_maps = @maps
last_map_id = @map_id
@upper_left = [0, 0]
@lower_right = [0, 0]
events = @events
setup_ctmaps_later(map_id)
@maps = get_neighbor_maps
if !@maps.has_key?(last_map_id)
@events = {}
last_maps = {}
last_map_id = 0
else
@events = events
end
setup_continuous_map
setup_continuous_events(last_maps, last_map_id)
end
def get_neighbor_maps
maps = {}
maps[@map_id] = [@map, 0, 0]
@upper_left = [0, 0]
@lower_right = [@map.width, @map.height]
if CTMAPS::MAPS.has_key?(@map_id)
CTMAPS::MAPS[@map_id].each {|data|
id, x, y = data
if @maps[id] != nil
map = @maps[id][0]
else
map = load_data(sprintf('Data/Map%03d.rvdata', id))
end
maps[id] = [map, x, y]
@upper_left[0] = x if @upper_left[0] > x
@upper_left[1] = y if @upper_left[1] > y
width, height = x + map.width, y + map.height
@lower_right[0] = width if @lower_right[0] < width
@lower_right[1] = height if @lower_right[1] < height}
maps.each_value {|data|
data[1] -= @upper_left[0]
data[2] -= @upper_left[1]}
end
return maps
end
def setup_continuous_map
width = @lower_right[0] - @upper_left[0]
height = @lower_right[1] - @upper_left[1]
data = Table.new(width, height, 3)
@map = @map.clone
@map.events = {}
@maps.each_key {|id|
map, ox, oy = @maps[id]
if id == @map_id
map.events.each_key {|i| @map.events[i] = map.events[i]}
else
map.events.each_key {|i| @map.events[id * 1000 + i] = map.events[i]}
end
(0...map.width).each {|x| (0...map.height).each {|y| (0...3).each {|z|
data[x + ox, y + oy, z] = map.data[x, y, z]}}}}
@map.width = width
@map.height = height
@map.data = data
end
def setup_continuous_events(last_maps, last_map_id)
correct_event_positions(last_maps) if last_maps[@map_id] != nil
delete_removed_events(last_maps, last_map_id)
shift_events_from_last_map(last_maps, last_map_id) if last_map_id != 0
shift_events_for_new_map
add_new_events(last_maps)
end
def delete_removed_events(last_maps, last_map_id)
keys = []
@maps.each_key {|id|
keys += @events.keys.find_all {|key|
@events[key].real_x < 0 || @events[key].real_y < 0 ||
@events[key].real_x >= (@lower_right[0] - @upper_left[0]) * 256 ||
@events[key].real_y >= (@lower_right[1] - @upper_left[1]) * 256}}
(keys | keys).each {|key| @events.delete(key)}
end
def shift_events_from_last_map(last_maps, last_map_id)
@events.each_key {|key|
if key < 1000
@events[last_map_id * 1000 + key] = @events[key]
@events.delete(key)
end}
end
def shift_events_for_new_map
@events.each_key {|key|
if key >= @map_id * 1000 && key < (@map_id + 1) * 1000
@events[key % 1000] = @events[key]
@events.delete(key)
end}
end
def correct_event_positions(last_maps)
sx = @maps[@map_id][1] - last_maps[@map_id][1]
sy = @maps[@map_id][2] - last_maps[@map_id][2]
@events.each_value {|event|
x, y = sx, sy
event.x += x
event.y += y
event.real_x += sx * 256
event.real_y += sy * 256}
end
def add_new_events(last_maps = {})
if last_maps[@map_id] == nil
@maps[@map_id][0].events.each_key {|i|
if @events[i] == nil
@events[i] = Game_Event.new(@map_id, @maps[@map_id][0].events[i])
end}
end
(@maps.keys - last_maps.keys - [@map_id]).each {|id|
map, sx, sy = @maps[id]
sx -= @maps[@map_id][1]
sy -= @maps[@map_id][2]
map.events.each_key {|i|
if @events[id * 1000 + i] == nil
@events[id * 1000 + i] = event = Game_Event.new(id, map.events[i])
x, y = sx, sy
event.x += x
event.y += y
event.real_x += sx * 256
event.real_y += sy * 256
end}}
end
alias update_ctmaps_later update
def update
update_ctmaps_later
return if $game_player.moving? || @maps.size <= 1
map, x, y = @maps[@map_id]
if $game_player.real_x < x * 256 || $game_player.real_y < y * 256 ||
$game_player.real_x >= x * 256 + map.width * 256 ||
$game_player.real_y >= y * 256 + map.height * 256
(@maps.keys - [@map_id]).each {|id|
map, x, y = @maps[id]
if $game_player.real_x >= x * 256 && $game_player.real_y >= y * 256 &&
$game_player.real_x < x * 256 + map.width * 256 &&
$game_player.real_y < y * 256 + map.height * 256
$game_temp.player_no_straighten = true
nx = $game_player.real_x / 256 - x
ny = $game_player.real_y / 256 - y
p "map_id = #{map_id}, new_map_id = #{id}, ox,oy = #{$game_player.x},#{$game_player.y}, nx,ny = #{nx},#{ny}" if Input.press?(Input::F5)
$game_player.reserve_transfer(id, nx, ny, 0)
break
end}
end
end
end
class Scene_Map < Scene_Base
alias cont_map_updt_transfer update_transfer_player unless $@
def update_transfer_player
if !$game_temp.normal_transfer
do_new_transfer
$game_temp.normal_transfer = false
else
cont_map_updt_transfer
end
end
def do_new_transfer
return unless $game_player.transfer?
@spriteset.dispose # Dispose of sprite set
$game_player.perform_transfer # Execute player transfer
$game_map.autoplay # Automatically switch BGM and BGS
$game_map.update
Graphics.wait(0)
@spriteset = Spriteset_Map.new # Recreate sprite set
Input.update
end
end
class Game_Interpreter
def normal_transfer(boolean)
$game_temp.normal_transfer = boolean
end
end |
Démo : Télécharger (Archive Chaos Project)
Mis à jour le 6 novembre 2020.
|