XP 스크립트

http://www.rpg-palace.com/forums/showthread.php?p=202565
링크된 쓰레드를 보시기 바랍니다. 수퍼패미컴용으로 나온 RPG들을 생각하시면 이해가 쉬울 겁니다(정말?). 사용법은 스크립트의 주석을 참조하세요.


=begin

Mode07 on the Map!
Includes:
Mode07
Overworld Sprite Resize
Written by mewsterus

Special Thanks:
Fanha Giang (for a reverse engineered Tilemap class)

To install, replace all of Spriteset_Map with this.

To activate Mode07, add [#XX] to the map's name, replacing XX with the
percentage of Mode07 to apply. Greater numbers will result in a more slanted
world.
To activate overworld sprite resize, add [OV] to the map's name. This will make
sprites smaller on that map.

For the purposes of location script-xs, these identifiers will not appear.
--------------------------------------------------------------------------------
* Draw_Tilemap v1.72-0.6
Fanha Giang, 02/12/2006 (mm/dd/yyyy)
Edited for Mode07 by mewsterus 08/08/2006 (mm/dd/yyyy)
=end
#===============================================================================
$width = 640 # Screen width (will not change resolution,
$height = 480 # Screen height here for compatibility)
$ov_zoom = 0.3 # Overworld zoom multiplier
$data_map = load_data("Data/MapInfos.rxdata")
#===============================================================================
class RPG::MapInfo
def name
return @name.gsub(/[.*]/) {""}
end
#-----------------------------------------------------------------------------
def original_name
return @name
end
#-----------------------------------------------------------------------------
def overworld?
return @name.scan(/[OV]/).size > 0
end
#-----------------------------------------------------------------------------
def pitch
@name =~ /[#[ ]*([00-99]+)]/i
return $1.to_f
end
end
#===============================================================================
class Draw_Tilemap
attr_accessor :tileset
attr_accessor :map_data
attr_accessor :priorities
attr_accessor :autotiles
attr_accessor :bitmaps
attr_accessor :pitch
attr_accessor :ox
attr_accessor :oy
attr_accessor :plus_y
INDEX = # autotile definitions
[
26, 27, 32, 33, 4, 27, 32, 33, 26, 5, 32, 33, 4, 5, 32, 33,
26, 27, 32, 11, 4, 27, 32, 11, 26, 5, 32, 11, 4, 5, 32, 11,
26, 27, 10, 33, 4, 27, 10, 33, 26, 5, 10, 33, 4, 5, 10, 33,
26, 27, 10, 11, 4, 27, 10, 11, 26, 5, 10, 11, 4, 5, 10, 11,
24, 25, 30, 31, 24, 5, 30, 31, 24, 25, 30, 11, 24, 5, 30, 11,
14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,
28, 29, 34, 35, 28, 29, 10, 35, 4, 29, 34, 35, 4, 29, 10, 35,
38, 39, 44, 45, 4, 39, 44, 45, 38, 5, 44, 45, 4, 5, 44, 45,
24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,
16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4, 41, 46, 47,
36, 37, 42, 43, 36, 5, 42, 43, 12, 17, 18, 23, 12, 13, 42, 43,
36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0, 1, 6, 7
]
X = [0, 1, 0, 1]
Y = [0, 0, 1, 1]
#-----------------------------------------------------------------------------
def initialize
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@map_data = $game_map.data
@priorities = $game_map.priorities
@autotiles = []
@bitmaps = [Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8)]
@pitch = $data_map[$game_map.map_id].pitch
@ox = 0
@oy = 0
@plus_y = $game_map.plus_y
@anim = 0
@anim_top = 0
for i in 0..6
@autotiles.push(RPG::Cache.autotile($game_map.autotile_names[i]))
@anim_top = [@autotiles[i].width / 96 - 1, @anim_top].max
end
@sprites = [[], [], []]
for i in 0..2
for j in 0..$game_map.height * 4 - 1
@sprites[i].push(Sprite.new)
@sprites[i][j].bitmap = Bitmap.new($game_map.width * 32, 16)
@sprites[i][j].x = 0
@sprites[i][j].y = -16
@sprites[i][j].z = -5 + (i * 10)
end
end
@disposed = false
draw
end
#-----------------------------------------------------------------------------
def update
@plus_y = $game_map.plus_y
for i in 0..2
for j in [0, (($height / 2) - (($height * 30) /
@pitch) + @oy) / 8].max.to_i..[@sprites[i].size - 1, (@oy +
$height) / 8].min.to_i
@sprites[i][j].x = $width / 2
@sprites[i][j].y = j * 8 - @oy
unless @pitch == 0
@sprites[i][j].zoom_x =
@sprites[i][j].zoom_y = (@sprites[i][j].y - $height / 2) *
(@pitch / ($height * 50)) + 1
@sprites[i][j].y += 8 * (1 - @sprites[i][j].zoom_y) *
((1 - @sprites[i][j].zoom_y) /
(2 * ((@pitch / 200) / ($height / 16.0))) + 0.5)
end
@sprites[i][j].y += @plus_y * 32
@sprites[i][j].ox = @ox + $width / 2
end
end
end
#-----------------------------------------------------------------------------
def dispose
for i in 0..2
for j in @sprites[i]
j.bitmap.dispose
j.dispose
end
end
for i in @bitmaps
i.dispose
end
@tileset.dispose
for i in 0..6
@autotiles[i].dispose
end
@disposed = true
end
#-----------------------------------------------------------------------------
def disposed?
return @disposed
end
#-----------------------------------------------------------------------------
def draw
for x in 0...@map_data.xsize
for y in 0...@map_data.ysize
draw_position(x, y)
end
end
for i in [5, 4, 3]
@bitmaps[i-1].blt(0, 0, @bitmaps[i],
Rect.new(0, 0, @bitmaps[i].width, @bitmaps[i].height))
end
for i in 0..2
@bitmaps[i].blt(0, $game_map.height * 32, @bitmaps[i],
Rect.new(0, 0, @bitmaps[i].width, 8))
end
k = 0
for i in 0..2
for j in 0..@sprites[i].size - 1
@sprites[i][j].bitmap.blt(0, 0, @bitmaps[i],
Rect.new(0, j * 8, $game_map.width * 32, 16))
end
end
end
#-----------------------------------------------------------------------------
def draw_position(x, y)
for layer in 0..2
pos = @map_data[x, y, layer]
if pos >= 384 #if it is a tile
src_rect = Rect.new(((pos-384)%8)*32, ((pos-384)/8)*32, 32, 32)
@bitmaps[@priorities[pos]].blt(x * 32, y * 32, @tileset, src_rect)
next layer
end
if pos >= 48 and pos < 384 #if it is an autotile
id = pos / 48 - 1
plus_x = ((@anim / 4) % (@autotiles[id].width / 96)) * 96
for corner in 0..3
h = 4 * (pos % 48) + corner
src_rect = Rect.new((INDEX[h]%6)*16+plus_x, (INDEX[h]/6)*16, 16, 16)
@bitmaps[@priorities[pos]].blt(x*32+X[corner]*16, y*32+Y[corner]*16,
@autotiles[id], src_rect)
end
end
end
end
end
#===============================================================================
class Game_Map
attr_accessor :plus_y
#-----------------------------------------------------------------------------
def name
return $data_map[@map_id].name
end
end
#===============================================================================
class Sprite_Character < RPG::Sprite
attr_accessor :character
#-----------------------------------------------------------------------------
def initialize(character = nil)
super()
@character = character
update
end
#-----------------------------------------------------------------------------
def update
super
@pitch = $data_map[$game_map.map_id].pitch.to_f
self.zoom_x =
self.zoom_y = (@character.screen_y - $height / 2) *
(@pitch / ($height * 50)) + 1
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
if $data_map[$game_map.map_id].overworld? and
@character.is_a?(Game_Player)
self.zoom_x *= $ov_zoom
self.zoom_y *= $ov_zoom
end
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = ($width / 2) + ((@character.screen_x - ($width / 2)) * self.zoom_x)
self.y = @character.screen_y
self.y += (8 * (1 - self.zoom_y) * ((1 - self.zoom_y) /
(2 * ((@pitch / 200) / ($height / 16.0))) + 0.5)) if @pitch != 0
self.y += $game_map.plus_y * 32 unless @character.is_a?(Game_Player)
self.z = @character.screen_z(@ch) - (self.zoom_y < 0.5 ? 1000 : 0)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
#===============================================================================
class Spriteset_Map
def initialize
$game_map.plus_y = 0
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 2000
@viewport3.z = 5000
@tilemap = Draw_Tilemap.new
@panorama = Plane.new
@panorama.z = -1000
@fog = Plane.new
@fog.z = 3000
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new($game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new($game_player))
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
#-----------------------------------------------------------------------------
def dispose
@tilemap.dispose
@panorama.dispose
@fog.dispose
for sprite in @character_sprites
sprite.dispose
end
@weather.dispose
for sprite in @picture_sprites
sprite.dispose
end
@timer_sprite.dispose
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
#-----------------------------------------------------------------------------
def update
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
for sprite in @character_sprites
sprite.update
end
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport3.color = $game_screen.flash_color
@viewport1.update
@viewport3.update
end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '3'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6202
1021 아이템 흠..몬스터도감말고 아이템도감~ 9 백호 2009.02.21 2028
1020 전투 흠.. 아직도 이 스크립트가 없군요 ㅋㅋ(제가올림..) 1 file 백호 2009.02.21 3337
1019 전투 횡스크롤형식의 스크립트 7 백호 2009.02.21 2980
1018 기타 횡스크롤 스크립트 한국말 번역. 15 file 백호 2009.02.21 3315
1017 기타 회복으로 데미지를 받는 좀비 스크립트 7 백호 2009.02.22 2010
1016 메뉴 화살표 모양 셀렉트 커서 사용 2 백호 2009.02.22 2118
1015 그래픽 화면을 부드럽게 해주는스크립트[ 아주 유용] 56 file - 하늘 - 2009.08.05 6566
1014 미니맵 화면에 축소된 미니맵을 표시하는 스크립트 - 한글 번역 - 6 file 백호 2009.02.21 2560
1013 화면에 축소된 맵을 표시하는 스크립트 7 file 백호 2009.02.21 2394
1012 기타 홈페이지 띄우기 (VX 상관없음.) 6 KNAVE 2009.08.25 2139
1011 메뉴 혹시있나해서-_-.. 대화창에 테두리치기 스크립트 7 백호 2009.02.22 2596
1010 기타 현재시간표시 33 file 코아 코스튬 2010.10.09 2529
1009 기타 현재 맵BGM을 그대로 전투 BGM으로 연결 from phylomortis.com 백호 2009.02.22 1180
1008 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 507
1007 메시지 한글자씩 뜨는 스크립트 6 백호 2009.02.21 3004
1006 키입력 한글입력스크립트 16 file 아방스 2007.11.09 11828
1005 키입력 한글입력기(자음, 모음 분리. 아마 중복일 듯...) 11 캉쿤 2011.09.13 3225
1004 키입력 한글입력기 6 백호 2009.02.22 4305
1003 이름입력 한글이름 입력기 스크립트 14 백호 2009.02.22 4211
1002 메시지 한글 채팅 스크립트 32 file こなた 2009.01.22 4947
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52