# TODO ChangePage has to have a working dup method. class ChangePage def mcGet_eventBits(index) event_bits = 0 # important: only change event bit if corresponding event flag is set # TODO receive answer from Holger what the comment above means (index*32).upto(index*32+31) do |i| event_bits |= (1 << ((i) % 32)) if @has_event[i] end event_bits end def mcSet_eventBits(value, index) # important: only change event flag if corresponding event bit is set (index*32).upto(index*32+31) do |i| @has_event[i] = true if value & (1 << ((i) % 32)) end end def resetEventFlags @has_event = Array.new(NUM_CHANGE_EVENTS, false) end # # This emulates an array of target contents. See also comment at # Element#mcGet_content() for detailed explanation. # def mcGet_targetContent(index) return @targetContent if index return [@targetContent] end def mcSet_targetContent(val,index) @targetContent = val if index @targetContent = val[0] if index end def initialize mcSetToDefaults($ruleset_CUSX_change) resetEventFlags @direct_action = 0 @other_action = 0 end attr_bool :can_change # use or ignore this change info # TODO :has_event is bool[NUM_CHANGE_EVENTS] attr_accessor :has_event # change events attr_accessor :trigger_player # player triggering change attr_accessor :trigger_side # side triggering change attr_accessor :trigger_page # page triggering change attr_accessor :target_element # target element after change attr_accessor :delay_fixed # added frame delay before changed (fixed) attr_accessor :delay_random # added frame delay before changed (random) attr_accessor :delay_frames # either 1 (frames) or 50 (seconds 50 fps) attr_accessor :trigger_element # element triggering change # TODO :target_content is struct Content attr_accessor :target_content # elements for extended change target attr_bool :use_target_content # use extended change target attr_bool :only_if_complete # only use complete target content attr_bool :use_random_replace # use random value for replacing elements attr_accessor :random_percentage # random value for replacing elements attr_accessor :replace_when # type of elements that can be replaced attr_bool :explode # explode instead of change attr_bool :has_action # execute action on specified condition attr_accessor :action_type # type of action attr_accessor :action_mode # mode of action attr_accessor :action_arg # parameter of action # ---------- internal values used in level editor ---------- attr_accessor :direct_action # change triggered by actions on element attr_accessor :other_action # change triggered by other element actions end