class WolfRpg::Map::Event::Page
Constants
- COMMANDS_TERMINATOR
Attributes
collision_height[RW]
collision_width[RW]
commands[RW]
conditions[RW]
flags[RW]
graphic_direction[RW]
graphic_frame[RW]
graphic_name[RW]
graphic_opacity[RW]
graphic_render_mode[RW]
id[RW]
movement[RW]
route[RW]
route_flags[RW]
shadow_graphic_num[RW]
unknown1[RW]
Public Class Methods
new(coder, id)
click to toggle source
# File lib/wolfrpg/map.rb, line 165 def initialize(coder, id) @id = id #TODO ??? @unknown1 = coder.read_int #TODO further abstract graphics options @graphic_name = coder.read_string @graphic_direction = coder.read_byte @graphic_frame = coder.read_byte @graphic_opacity = coder.read_byte @graphic_render_mode = coder.read_byte #TODO parse conditions later @conditions = coder.read(1 + 4 + 4*4 + 4*4) #TODO parse movement options later @movement = coder.read(4) #TODO further abstract flags @flags = coder.read_byte #TODO further abstract flags @route_flags = coder.read_byte # Parse move route @route = Array.new(coder.read_int) @route.each_index do |i| @route[i] = RouteCommand.create(coder) end # Parse commands @commands = Array.new(coder.read_int) @commands.each_index do |i| @commands[i] = Command.create(coder) end coder.verify(COMMANDS_TERMINATOR) #TODO abstract these options later @shadow_graphic_num = coder.read_byte @collision_width = coder.read_byte @collision_height = coder.read_byte if (terminator = coder.read_byte) != 0x7A raise "page terminator not 7A (found #{terminator.to_s(16)})" end end
Public Instance Methods
dump(coder)
click to toggle source
# File lib/wolfrpg/map.rb, line 212 def dump(coder) coder.write_int(@unknown1) coder.write_string(@graphic_name) coder.write_byte(@graphic_direction) coder.write_byte(@graphic_frame) coder.write_byte(@graphic_opacity) coder.write_byte(@graphic_render_mode) coder.write(@conditions) coder.write(@movement) coder.write_byte(@flags) coder.write_byte(@route_flags) coder.write_int(@route.size) @route.each do |cmd| cmd.dump(coder) end coder.write_int(@commands.size) @commands.each do |cmd| cmd.dump(coder) end coder.write(COMMANDS_TERMINATOR) coder.write_byte(@shadow_graphic_num) coder.write_byte(@collision_width) coder.write_byte(@collision_height) coder.write_byte(0x7A) end
each_filename() { |gsub('\\', '/')| ... }
click to toggle source
# File lib/wolfrpg/map.rb, line 238 def each_filename yield @graphic_name.gsub('\\', '/') unless @graphic_name.empty? @commands.each do |command| command.each_filename do |fn| yield fn end end end