|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | #============================================================================== |
3 | | -# ** RME v1.4.0 |
| 3 | +# ** RME v1.4.1 |
4 | 4 | #------------------------------------------------------------------------------ |
5 | 5 | # With : |
6 | 6 | # xvw |
@@ -72,7 +72,7 @@ class << self |
72 | 72 | # * Version |
73 | 73 | # * With RMEPackage, it's seems useless ? |
74 | 74 | #-------------------------------------------------------------------------- |
75 | | - def version; define_version(1,4,0); end |
| 75 | + def version; define_version(1,4,1); end |
76 | 76 | #-------------------------------------------------------------------------- |
77 | 77 | # * define Version |
78 | 78 | #-------------------------------------------------------------------------- |
@@ -7168,6 +7168,13 @@ def release?(key = :mouse_left, pr = false) |
7168 | 7168 | return false unless k_sprite |
7169 | 7169 | k_sprite.release?(key, pr) |
7170 | 7170 | end |
| 7171 | + #-------------------------------------------------------------------------- |
| 7172 | + # * Is pixel in sprite ? |
| 7173 | + #-------------------------------------------------------------------------- |
| 7174 | + def pixel_in?(x, y, precise = false) |
| 7175 | + return false unless k_sprite |
| 7176 | + precise ? k_sprite.precise_in?(x, y) : k_sprite.in?(x, y) |
| 7177 | + end |
7171 | 7178 | end |
7172 | 7179 | #============================================================================== |
7173 | 7180 | # ** API |
@@ -7538,10 +7545,12 @@ class << self |
7538 | 7545 | attr_accessor :light_emitter |
7539 | 7546 | attr_accessor :tone |
7540 | 7547 | attr_accessor :allow_overlap |
| 7548 | + attr_accessor :changing_graphics |
7541 | 7549 | attr_reader :id |
7542 | 7550 |
|
7543 | 7551 | alias_method :allow_overlap?, :allow_overlap |
7544 | 7552 | alias_method :rme_collide_with_characters?, :collide_with_characters? |
| 7553 | + alias_method :rme_set_graphic, :set_graphic |
7545 | 7554 | #-------------------------------------------------------------------------- |
7546 | 7555 | # * Initialisation du Buzzer |
7547 | 7556 | #-------------------------------------------------------------------------- |
@@ -7570,6 +7579,7 @@ def initialize |
7570 | 7579 | @rect = Rect.new(0,0,0,0) |
7571 | 7580 | @sprite_index |
7572 | 7581 | init_tone |
| 7582 | + @changing_graphics = false |
7573 | 7583 | end |
7574 | 7584 |
|
7575 | 7585 | #-------------------------------------------------------------------------- |
@@ -7764,6 +7774,13 @@ def collide_with_characters?(x, y) |
7764 | 7774 | return false if allow_overlap? |
7765 | 7775 | rme_collide_with_characters?(x, y) |
7766 | 7776 | end |
| 7777 | + #-------------------------------------------------------------------------- |
| 7778 | + # * Change Graphics |
| 7779 | + #-------------------------------------------------------------------------- |
| 7780 | + def set_graphic(character_name, character_index) |
| 7781 | + rme_set_graphic(character_name, character_index) |
| 7782 | + @changing_graphics = true |
| 7783 | + end |
7767 | 7784 |
|
7768 | 7785 | end |
7769 | 7786 |
|
@@ -7997,8 +8014,14 @@ def initialize(viewport, character = nil) |
7997 | 8014 | #-------------------------------------------------------------------------- |
7998 | 8015 | def set_character_bitmap |
7999 | 8016 | rm_extender_set_character_bitmap |
8000 | | - character.ox = self.ox |
8001 | | - character.oy = self.oy |
| 8017 | + if character.changing_graphics || (character.ox.nil? && character.oy.nil?) |
| 8018 | + character.ox = self.ox |
| 8019 | + character.oy = self.oy |
| 8020 | + else |
| 8021 | + self.ox = character.ox |
| 8022 | + self.oy = character.oy |
| 8023 | + end |
| 8024 | + character.changing_graphics = false |
8002 | 8025 | @old_buzz = 0 |
8003 | 8026 | @origin_len_x = self.zoom_x |
8004 | 8027 | end |
@@ -8843,6 +8866,12 @@ def refresh_message |
8843 | 8866 | @message_window.dispose |
8844 | 8867 | @message_window = Window_Message.new |
8845 | 8868 | end |
| 8869 | + #-------------------------------------------------------------------------- |
| 8870 | + # * Add Event sprite into spriteset |
| 8871 | + #-------------------------------------------------------------------------- |
| 8872 | + def add_event_sprite(event) |
| 8873 | + @spriteset.add_event_sprite(event) |
| 8874 | + end |
8846 | 8875 |
|
8847 | 8876 | #-------------------------------------------------------------------------- |
8848 | 8877 | # * Update All Windows |
@@ -9164,14 +9193,15 @@ def add_event(map_id, event_id, new_id,x=nil,y=nil) |
9164 | 9193 | return unless event |
9165 | 9194 | event.id = new_id |
9166 | 9195 | clone_events = @events.clone |
9167 | | - clone_events.store(new_id, Game_Event.new(@map_id, event)) |
| 9196 | + new_event = Game_Event.new(@map_id, event) |
| 9197 | + clone_events.store(new_id, new_event) |
9168 | 9198 | x ||= event.x |
9169 | 9199 | y ||= event.y |
9170 | 9200 | @events = clone_events |
9171 | 9201 | @events[new_id].moveto(x, y) |
9172 | 9202 | @need_refresh = true |
9173 | 9203 | @max_event_id = [@max_event_id, new_id].max |
9174 | | - SceneManager.scene.refresh_spriteset |
| 9204 | + SceneManager.scene.add_event_sprite(new_event) |
9175 | 9205 | end |
9176 | 9206 | #-------------------------------------------------------------------------- |
9177 | 9207 | # * Clear parallaxes |
@@ -9954,6 +9984,14 @@ def show(name, rows, columns, index, origin, x, y, zoom_x, zoom_y, opacity, blen |
9954 | 9984 | self.current = index |
9955 | 9985 | @dirty = true |
9956 | 9986 | end |
| 9987 | + #-------------------------------------------------------------------------- |
| 9988 | + # * Erase Picture |
| 9989 | + #-------------------------------------------------------------------------- |
| 9990 | + def erase |
| 9991 | + super |
| 9992 | + @dirty = true |
| 9993 | + end |
| 9994 | + |
9957 | 9995 | end |
9958 | 9996 |
|
9959 | 9997 | #============================================================================== |
@@ -10204,6 +10242,13 @@ def update_parallax |
10204 | 10242 | end |
10205 | 10243 | rm_extender_update_parallax |
10206 | 10244 | end |
| 10245 | + #-------------------------------------------------------------------------- |
| 10246 | + # * Add Event Sprite to Characters |
| 10247 | + #-------------------------------------------------------------------------- |
| 10248 | + def add_event_sprite(event) |
| 10249 | + sp = Sprite_Character.new(@viewport1, event) |
| 10250 | + @character_sprites.push(sp) |
| 10251 | + end |
10207 | 10252 | end |
10208 | 10253 |
|
10209 | 10254 | #============================================================================== |
@@ -11580,7 +11625,7 @@ def get_tileset_id |
11580 | 11625 | end |
11581 | 11626 |
|
11582 | 11627 | def switch_tileset(tileset_id) |
11583 | | - $game_map.tileset_id = tileset_id |
| 11628 | + $game_map.change_tileset(tileset_id) |
11584 | 11629 | end |
11585 | 11630 |
|
11586 | 11631 | def set_tile(value, x, y, layer) |
@@ -12850,7 +12895,7 @@ def fresh_event_id(erased = false) |
12850 | 12895 | #-------------------------------------------------------------------------- |
12851 | 12896 | def page_runnable?(map_id, ev_id, page, context=false) |
12852 | 12897 | return unless self.class == Game_Interpreter |
12853 | | - page = Game_Interpreter.get_page(map_id, ev_id, p_id) if page.is_a?(Fixnum) |
| 12898 | + page = Game_Interpreter.get_page(map_id, ev_id, page) if page.is_a?(Fixnum) |
12854 | 12899 | return unless page |
12855 | 12900 | return Game_Interpreter.conditions_met?(map_id, ev_id, page) if context |
12856 | 12901 | c_map_id = Game_Interpreter.current_map_id |
@@ -13461,13 +13506,13 @@ def event_look_towards?(source, x, y, scope) |
13461 | 13506 | ex, ey = event_x(source), event_y(source) |
13462 | 13507 | case event_direction(source) |
13463 | 13508 | when Direction::UP |
13464 | | - distance = ey - y |
13465 | | - x_axis = (ex >= x - distance) && (ex <= x + distance) |
13466 | | - y_axis = ey > y |
13467 | | - when Direction::DOWN |
13468 | 13509 | distance = y - ey |
13469 | 13510 | x_axis = (ex >= x - distance) && (ex <= x + distance) |
13470 | 13511 | y_axis = ey < y |
| 13512 | + when Direction::DOWN |
| 13513 | + distance = ey - y |
| 13514 | + x_axis = (ex >= x - distance) && (ex <= x + distance) |
| 13515 | + y_axis = ey > y |
13471 | 13516 | when Direction::LEFT |
13472 | 13517 | distance = ex - x |
13473 | 13518 | x_axis = ex > x |
@@ -13828,7 +13873,9 @@ def player_opacity(value = nil) |
13828 | 13873 |
|
13829 | 13874 | def event_move_with(id, *code) |
13830 | 13875 | route = RPG::MoveRoute.new |
| 13876 | + route.repeat = false |
13831 | 13877 | route.list = code.map {|i| RPG::MoveCommand.new(i)} |
| 13878 | + route.list << RPG::MoveCommand.new(0) |
13832 | 13879 | event(id).force_move_route(route) |
13833 | 13880 | end |
13834 | 13881 |
|
|
0 commit comments