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
| # ?ฅ?ฃ?ฅ XRXS_BP 8. ogobN?EFull-View?{?ฎJ? ver..05d ?ฅ?ฃ?ฅ
# Fait par FTB
#==============================================================================
# ?ก Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ? ???E?JCX^X??
#--------------------------------------------------------------------------
attr_accessor :x_pos # ogtB?[h?@ก?@?u(+ืE?@)
attr_accessor :y_pos # ogtB?[h ?ณ ?u(+ื???@)
attr_accessor :z_pos # ogtB?[h?sซ?u(+ื?O)
attr_accessor :zoom # ป???Y?[{ฆ
end
#==============================================================================
# ?ก Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? ???E?JCX^X??
#--------------------------------------------------------------------------
attr_reader :actor_in_battlefield # AN^?[?tB?[h?
#--------------------------------------------------------------------------
# ? ZbgAbv
#--------------------------------------------------------------------------
alias xrxs_bp8_setup setup
def setup(actor_id)
xrxs_bp8_setup(actor_id)
# @\"AN^?[?tB?[h?"
# true?D??ท?
@actor_in_battlefield = false if @actor_in_battlefield != true
end
end
#==============================================================================
# ?ก Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ? ???E?JCX^X??
#--------------------------------------------------------------------------
attr_reader :actor_in_battlefield # AN^?[?tB?[h?
#--------------------------------------------------------------------------
# ? IuWFNg??ป
#--------------------------------------------------------------------------
alias xrxs_bp8_initialize initialize
def initialize(troop_id, member_index)
@actor_in_battlefield = false
@x_pos = $data_troops[troop_id].members[member_index].x - 320
@y_pos = -($data_troops[troop_id].members[member_index].y - 304)
@field_x_offset = -192
@field_y_offset = -144
@z_pos = 0
@zoom = 1.00
xrxs_bp8_initialize(troop_id, member_index)
end
#--------------------------------------------------------------------------
# ? og?? X ??W??พ
#--------------------------------------------------------------------------
def screen_x
$xcam_x = 0 if $xcam_x == nil
return 320 - @field_x_offset + (@x_pos.to_i - $xcam_x) * @zoom
end
#--------------------------------------------------------------------------
# ? og?? Y ??W??พ
#--------------------------------------------------------------------------
def screen_y
$xcam_y = 0 if $xcam_y == nil
return 240 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y) * @zoom
end
end
#==============================================================================
# ?ก Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ? t?[?X?V
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# ??ป
@z_offset = 0
# ?ท
xrxs_bp8_update
# og?[ื nil ??????
return if @battler == nil
# G???J?ืeฟ?B
# ฉ??ogtB?[h?ข????ฑฑ? if ?Oท?B
if (@battler.is_a?(Game_Actor) and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
# Y?[ฆ
zoom = 1.00 * 185 / (($xcam_z != nil ? $xcam_z : 185) - @z_offset)
self.zoom_x = zoom
self.zoom_y = zoom
@battler.zoom = zoom
# XvCg???W????
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
end
#==============================================================================
# ?ก Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ? IuWFNg??ป
#--------------------------------------------------------------------------
alias xrxs_bp8_initialize initialize
def initialize
# ??ป
@now_bg_x = -1
@now_bg_y = -1
@now_bg_z = -1
# ??????s
xrxs_bp8_initialize
# r
?[|?[g????ฌ
@viewport1 = Viewport.new(-192, -144, 1024, 768)
# ogobNXvCg????ฌ
@battleback_sprite = Sprite.new(@viewport1)
@battleback_name = ""
# Gl~?[XvCg????ฌ
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# V?????ฌ
@weather = RPG::Weather.new(@viewport1)
# t?[?X?V
update
end
#--------------------------------------------------------------------------
# ? t?[?X?V
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# ogobN?t@Cผืป???????????
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
bg_bitmap = RPG::Cache.battleback(@battleback_name)
bg_bitmap_stretch = Bitmap.new(1024, 768)
bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 1024, 768), bg_bitmap, bg_bitmap.rect)
@battleback_sprite.bitmap = bg_bitmap_stretch
end
# J??uืฎขฝ???
if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
# Y?[ฆ
zoom = 1.00 * 185 / $xcam_z
@battleback_sprite.zoom_x = zoom
@battleback_sprite.zoom_y = zoom
# J?z????u??C?ณ
maximum = 192 * (296 - $xcam_z) / 111
$xcam_x = [[$xcam_x, -maximum].max, maximum].min
# wi?u?X?V
@battleback_sprite.x = -$xcam_x * zoom - 512 * (zoom - 1)
@battleback_sprite.y = $xcam_y * zoom - 384 * (zoom - 1)
# l?X?V
@now_bg_x = $xcam_x
@now_bg_y = $xcam_y
@now_bg_z = $xcam_z
end
# ?ท
xrxs_bp8_update
end
end
#==============================================================================
# ?ก Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ? ?C??
#--------------------------------------------------------------------------
alias xrxs_bp8_main main
def main
# J????u?
$xcam_x = 0
$xcam_y = 0
$xcam_z = 295
# J???????Il
@xcam_x_destination = 0
@xcam_y_destination = 0
@xcam_z_destination = 185
# ?ก?A??og?[?ณต?B
@xcam_watch_battler = nil
# ??ป
@wait_count_xcam = 0
# ?ท
xrxs_bp8_main
end
#--------------------------------------------------------------------------
# ? t?[?X?V
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# J??u??X?V?B
if @wait_count_xcam > 0
# EFCgJEg?ธ?ท
@wait_count_xcam -= 1
else
# J?: Z ??W
if $xcam_z != @xcam_z_destination
if $xcam_z < @xcam_z_destination
distance = [(@xcam_z_destination - $xcam_z)/8, 1].max
else
distance = [(@xcam_z_destination - $xcam_z)/8, -1].min
end
$xcam_z = [[$xcam_z + distance, 74].max, 296].min
end
# J?: X ??W
if @xcam_watch_battler != nil
if $xcam_x != @xcam_watch_battler.x_pos
if ($xcam_x - @xcam_watch_battler.x_pos).abs < 8
distance = @xcam_watch_battler.x_pos - $xcam_x
elsif $xcam_x < @xcam_watch_battler.x_pos
distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, 8].max
else
distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, -8].min
end
maximum = 192 * (296 - $xcam_z) / 111
$xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
end
elsif $xcam_x != @xcam_x_destination
if ($xcam_x - @xcam_x_destination).abs < 8
distance = @xcam_x_destination - $xcam_x
elsif $xcam_x < @xcam_x_destination
distance = [(@xcam_x_destination - $xcam_x)/8, 8].max
else
distance = [(@xcam_x_destination - $xcam_x)/8, -8].min
end
maximum = 192 * (296 - $xcam_z) / 111
$xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
end
# J?: Y ??W
if @xcam_watch_battler != nil
y = @xcam_watch_battler.y_pos/2
if $xcam_y != y
if ($xcam_y - y).abs < 8
distance = y - $xcam_y
elsif $xcam_y < y
distance = [(y - $xcam_y)/8, 8].max
else
distance = [(y - $xcam_y)/8, -8].min
end
maximum = 144 * (296 - $xcam_z) / 111
$xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
end
elsif $xcam_y != @xcam_y_destination
if $xcam_y < @xcam_y_destination
distance = [(@xcam_y_destination - $xcam_y)/8, 1].max
else
distance = [(@xcam_y_destination - $xcam_y)/8, -1].min
end
maximum = 164 * (296 - $xcam_z) / 111
$xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
end
end
# ?????s
xrxs_bp8_update
end
#--------------------------------------------------------------------------
# ? p?[eBR}htF?[YJn
#--------------------------------------------------------------------------
alias xrxs_bp8_start_phase2 start_phase2
def start_phase2
# J??FZ^O
@xcam_watch_battler = nil
@xcam_x_destination = 0
@xcam_z_destination = 185
# ?ท
xrxs_bp8_start_phase2
end
#--------------------------------------------------------------------------
# ? t?[?X?V (AN^?[R}htF?[Y)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase3 update_phase3
def update_phase3
# J??L?u?
if @active_battler != nil and @active_battler.actor_in_battlefield
@xcam_x_destination = @active_battler.x_pos
@xcam_z_destination = 175
end
xrxs_bp8_update_phase3
end
#--------------------------------------------------------------------------
# ? t?[?X?V (AN^?[R}htF?[Y : Gl~?[I?)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
def update_phase3_enemy_select
# J??FG^?[Qbg?Y?[Abv
@xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos * $game_troop.enemies[@enemy_arrow.index].zoom
@xcam_z_destination = 175
# ?ท
xrxs_bp8_update_phase3_enemy_select
end
#--------------------------------------------------------------------------
# ? Gl~?[I??Iน
#--------------------------------------------------------------------------
alias xrxs_bp8_end_enemy_select end_enemy_select
def end_enemy_select
# J??F?S?
@xcam_x_destination = 0
@xcam_z_destination = 185
# ?ท
xrxs_bp8_end_enemy_select
end
#--------------------------------------------------------------------------
# ? t?[?X?V (?CtF?[Y Xebv 2 : ANVJn)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# ?ท
xrxs_bp8_update_phase4_step2
# Xebv 3 ???sท????
if @phase4_step == 3
if @active_battler.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
# J??F?sฎog?[??Y?[Abv?\?
@xcam_x_destination = @active_battler.x_pos * @active_battler.zoom if @active_battler.x_pos != nil
@xcam_z_destination = 175
end
# ??? 20 t?[??
@wait_count = 20
end
end
#--------------------------------------------------------------------------
# ? t?[?X?V (?CtF?[Y Xebv 3 : ?sฎ?Aj??[V)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase4_step3 update_phase4_step3
def update_phase4_step3
# ?ท
xrxs_bp8_update_phase4_step3
if @target_battlers.size > 0 and
(@target_battlers[0].is_a?(Game_Enemy) or @target_battlers[0].actor_in_battlefield)
# J??F^?[Qbg??Y?[Abv?\?
@xcam_x_destination = @target_battlers[0].x_pos * @target_battlers[0].zoom if @target_battlers[0] != nil
@xcam_z_destination = 185
# ?ต???Aj?ื?u?u?F???v???????
if @animation2_id > 0 and $data_animations[@animation2_id].position == 3
# J??Z^O
@xcam_x_destination = 0
# Y?[AEg????ฟ??ฅwฅ
@xcam_z_destination = 222
end
end
# ??? 20 t?[??
@wait_count = 20
end
#--------------------------------------------------------------------------
# ? At^?[ogtF?[YJn
#--------------------------------------------------------------------------
alias xrxs_bp8_start_phase5 start_phase5
def start_phase5
@xcam_z_destination = 185
xrxs_bp8_start_phase5
end
end
#==============================================================================
# ? RPG::???`?u??ฌ?"??"Aj???u?C?ณ?v
#==============================================================================
module RPG
class Sprite < ::Sprite
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
if $scene.is_a?(Scene_Battle)
sprite.x = self.viewport.rect.width / 2
sprite.y = 304
else
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
end
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x - self.ox + self.src_rect.width / 2
sprite.y = self.y - self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end |