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 6153
641 메뉴 Ring menu edit (Non-SDK ver.) Alkaid 2010.09.08 1538
640 이동 및 탈것 점프 높이를 자유자제로 조절하는 스크립트!! 8 file 백호 2009.02.21 1539
639 이동 및 탈것 Maplinks - 맵연결을 쉽게 하기 1 백호 2009.02.22 1541
638 메시지 UCoder's Message System by Mr.Mo file Alkaid 2010.10.05 1542
637 넷플2.0(펌) 1 오동훈 2008.02.25 1543
636 스크립트 호출 명령어 통합버전 / Version 2.21 / 8 WMN 2008.04.06 1543
635 기타 디버그 윈도우 강화! 3 file 백호 2009.02.21 1550
634 기타 Trailing Characters ver.1 by SephirothSpawn 6 file 백호 2009.02.22 1551
633 기타 RM2kXP file 습작 2014.03.17 1551
632 전투 버틀러 색조 변경 5 file 백호 2009.02.21 1552
631 저장 Advanced Save System Edit (현재 맵을 보여주지 않음) file 백호 2009.02.22 1557
630 저장 Chaos Project Save Layout 1.4 by Fantasist, Blizzard file Alkaid 2010.10.08 1558
629 기타 데미지 출력 스크립트 예제 9 file 백호 2009.02.22 1559
628 기타 Advanced Gold Display by Dubealex (돈 액수를 세자리씩 끊어 표기) 2 Alkaid 2010.11.18 1559
627 그래픽 Composite Window Skins by PK8 (XP/VX/VXA) Alkaid 2012.08.26 1559
626 이동 및 탈것 텔레포트 마나소비량 수정하기 3 지존!! 2010.07.22 1563
625 메뉴 1-Scene CMS 1.16 by LegACy (SDK호환) 3 file 백호 2009.02.22 1564
624 메뉴 Star Ocean 3 형식으로 스테이터스 화면 변경 1 file 백호 2009.02.21 1571
623 메뉴 스테이터스 화면 from Harts Horn 2 백호 2009.02.22 1571
622 그래픽 Weather Script(버전 불명) by ccoa 1 file Alkaid 2010.09.08 1571
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