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 6310
641 아이템 아이템 단축키로 구입 스크립트 3 백호 2009.02.22 1243
640 기타 KGC - 입수 경험치&금 증가 스크립트 백호 2009.02.22 1308
639 기타 무기 회피율, 방어구 공격력 지정 스크립트 6 백호 2009.02.22 1251
638 기타 양손무기, 전신갑옷 스크립트 2 백호 2009.02.22 1718
637 기타 Realistic Shop by MeisMe@rmxp.org 3 file 백호 2009.02.22 1295
» 맵/타일 Mode07 0.5 by mewsterus 3 백호 2009.02.22 1157
635 기타 필드에서 마력을 출력합니다. 백호 2009.02.22 989
634 기타 필드에서 체력을 출력합니다. 4 백호 2009.02.22 1741
633 기타 경험치 퍼센트 수정 백호 2009.02.22 1212
632 기타 레벨을 표시해주는 스크립트 5 백호 2009.02.22 2406
631 기타 Shift Puzzles v2 by SephirothSpawn (SDK호환) 3 file 백호 2009.02.22 1177
630 기타 Sized Events 0.1 by Toby@rmxp.org file 백호 2009.02.22 848
629 타이틀/게임오버 타이틀음악 백호 2009.02.22 1410
628 기타 레벨업포인트 3 백호 2009.02.22 1693
627 이름입력 한글이름 입력기 스크립트 14 백호 2009.02.22 4215
626 스킬 Advanced Mission Skills/Shop/Manager by trickster 3 file 백호 2009.02.22 1607
625 기타 Character Creator by Leon@Creation Asylum 2 file 백호 2009.02.22 1512
624 기타 비밀소년님의 경험치 표시 스크립트 백호 2009.02.22 1419
623 메뉴 비밀소년님의 필드에서 경치 % 로 나오는거 윈도우 없이 8 백호 2009.02.22 1793
622 이동 및 탈것 밑에 KIN 님의 MP 없어지는 대쉬, 제가 손좀 봤음 1 백호 2009.02.22 1247
Board Pagination Prev 1 ... 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 52 Next
/ 52