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
| #==========================================================================
# ** MSX - XP Characters on VX/VXAce
#==========================================================================
# Autore: Melosx
# Versione: 1.0
# Compatibile con VX e VXAce
#
#==========================================================================
# * Descrizione
# -----------------------------------------------------------------------------
# Lo script permette di usare i chara xp nel vx semplicemente inserendo il tag
# $xp
# prima del nome del file.
# Potete quindi usare i normali VX/VXAce insieme a quelli dell'XP.
#
#==========================================================================
# * Istruzioni
# -----------------------------------------------------------------------------
# Inserire lo script sotto Materials e sopra Main. Aggiungere ai chara dell'XP
# il tag $xp prima del nome.
#
#==========================================================================
#==========================================================================
# ** Sprite_Character
#==========================================================================
class Sprite_Character < Sprite_Base
def update_bitmap
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_index != @character.character_index
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_index = @character.character_index
if @tile_id > 0
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[!$]./]
if sign != nil and sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
if @character_name != nil and @character_name.include?('$xp')
@cw = bitmap.width / 4
@ch = bitmap.height / 4
end
self.ox = @cw / 2
self.oy = @ch
end
end
end
def update_src_rect
if @character_name != nil and @character_name.include?('$xp')
if @tile_id == 0
pattern = @character.pattern > 0 ? @character.pattern - 1 : 3
sx = pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
else
if @tile_id == 0
index = @character.character_index
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
end
#==========================================================================
# ** Window_Base
#==========================================================================
class Window_Base < Window
def draw_character(character_name, character_index, x, y)
return if character_name == nil
bitmap = Cache.character(character_name)
sign = character_name[/^[!$]./]
if character_name != nil and character_name.include?('$xp')
cw = bitmap.width / 4
ch = bitmap.height / 4
n = character_index
src_rect = Rect.new(0, 0, cw, ch)
else
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
end
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end |