05-26-2006, 01:00 PM
Guedez's Mouse Use System
Version 1.1
Thx to:Cadafalso, Near Fantastica, and some guys from asylum!
May 26 2006
Features:
- You can use the mouse for menus and default battle system
- You can use the mouse click to select and cancel options
- You can use events and move in the map using the mouse
- You can use Near's pathfind system (optional)
Problems:
- Its a big laggy
- Its VERY laggy on non-fullscreen mode(it wont work without Near's mouse input on non-fullscreen mode)
- Its not sdk copilant, and also, requires sdk Game_Player, so it is semi-disabled
- I am still working on mansage option box, it cant detect the options as it do to the others windows
Know Bugs:
- the arrow(enemy selection) still select dead enemys
- you cant select any options on mensage boxes
Instructions
- Add the script above main
Here goes the script:
Version 1.1
Thx to:Cadafalso, Near Fantastica, and some guys from asylum!
May 26 2006
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Features:
- You can use the mouse for menus and default battle system
- You can use the mouse click to select and cancel options
- You can use events and move in the map using the mouse
- You can use Near's pathfind system (optional)
Problems:
- Its a big laggy
- Its VERY laggy on non-fullscreen mode(it wont work without Near's mouse input on non-fullscreen mode)
- Its not sdk copilant, and also, requires sdk Game_Player, so it is semi-disabled
- I am still working on mansage option box, it cant detect the options as it do to the others windows
Know Bugs:
- the arrow(enemy selection) still select dead enemys
- you cant select any options on mensage boxes
Instructions
- Add the script above main
Here goes the script:
Code:
#==================================================================
# GMUS Guedez Mouse Use System
# Version: 1.1
# Released: 26/5/2006 Last Update: 27/11/2006
# Thx to: Cadafalso, Near Fantastica, and some guys from asylum!
#==================================================================
$pathfind = false #set to true if you want to use the near's
#pathfind system
#================================================================
class Mouse_PositionCheck
def initialize
end
def main
get_pos
end
def get_window_index(window)
window.get_rect_positions
return -1 if window.index == -1
return -2 if window.index == -2
for i in 0...window.get_rect.size
if window.get_rect[i][0] < $bg.x and
window.get_rect[i][1] < $bg.y and
window.get_rect[i][2] > $bg.x and
window.get_rect[i][3] > $bg.y
return i
end
end
return -999999
end
def set_pos(x,y)
$setCursorPos.Call(x,y)
end
#==============================Thx to: Cadafalso===================
def get_pos
lpPoint = " " * 8 # store two LONGs
$getCursorPos.Call(lpPoint)
$bg.x, $bg.y = lpPoint.unpack("LL") # get the actual values
end
#==================================================================
end
class Window_Selectable < Window_Base
alias g_initialize initialize
def initialize(x, y, width, height)
@rect_position = []
g_initialize(x, y, width, height)
end
def get_rect_positions
index = self.index
if @rect_position == []
for i in 0...(self.row_max * @column_max)
self.index = i
update_cursor_rect
p = self.cursor_rect.to_s
p.gsub!("($1,$2,$3,$4):rect","");p.gsub!("(", ""); p.gsub!(")", "")
p = p.split(/,\s*/)
@rect_position[i] = [p[0].to_i + self.x + 16,
p[1].to_i - self.oy + self.y + 16,
p[0].to_i + p[2].to_i + self.x + 16,
p[1].to_i + p[3].to_i - self.oy + self.y + 16]
end
self.index = index
end
end
def refresh_rect_positions
@rect_position = []
get_rect_positions
end
def get_rect
return @rect_position
end
alias guedez_update update
def update
get_rect_positions
if self.active == true
old_index = self.index
new_index = $mouse.get_window_index(self)
$game_system.se_play($data_system.cursor_se) if
old_index != new_index and not new_index == -999999
@index = new_index if old_index != -1
self.cursor_rect.empty if new_index == -999999
self.index = new_index
end
guedez_update
end
end
#===================== NEAR FANTASTICA SCRIPTS ==================
#notice the Hawk-McKain changes on 'def run_path'
#==============================================================================
# ** Path Finding
#==============================================================================
# Near Fantastica
# Version 1
# 29.11.05
# Edit: Hawk-McKain
#==============================================================================
# Lets the Player or Event draw a path from an desonation to the source. This
# method is very fast and because the palthfinding is imbeded into the Game
# Character the pathfinding can be inturputed or redrawn at any time.
#==============================================================================
# Player :: $game_player.find_path(x,y)
# Event Script Call :: self.event.find_path(x,y)
# Event Movement Script Call :: self.find_path(x,y)
#==============================================================================
#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
#SDK.log("Path Finding", "Near Fantastica", 1, "29.11.05")
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
#if SDK.state("Path Finding") == true
class Game_Character
#--------------------------------------------------------------------------
alias nf_pf_game_character_initialize initialize
alias nf_pf_game_character_update update
#--------------------------------------------------------------------------
attr_accessor :map
attr_accessor :runpath
#--------------------------------------------------------------------------
def initialize
nf_pf_game_character_initialize
@map = nil
@runpath = false
end
#--------------------------------------------------------------------------
def update
run_path if @runpath == true
nf_pf_game_character_update
end
#--------------------------------------------------------------------------
def run_path
#------------------------------------------------------------------------------
# Begin Mouse Control Edit
#------------------------------------------------------------------------------
if moving? and
($game_player.check_event_trigger_here([1,2]) or
$game_player.check_event_trigger_there([1,2]))
clear_path
return
end
#------------------------------------------------------------------------------
# End Mouse Control Edit
#------------------------------------------------------------------------------
return if moving?
step = @map[@x,@y]
if step == 1
#------------------------------------------------------------------------------
# Begin Mouse Control Edit
#------------------------------------------------------------------------------
$game_player.check_event_trigger_here([0])
$game_player.check_event_trigger_there([0])
clear_path
#------------------------------------------------------------------------------
# Begin Mouse Control Edit
#------------------------------------------------------------------------------
return
end
dir = rand(2)
case dir
when 0
move_right if @map[@x+1,@y] == step - 1 and step != 0
move_down if @map[@x,@y+1] == step - 1 and step != 0
move_left if @map[@x-1,@y] == step -1 and step != 0
move_up if @map[@x,@y-1] == step - 1 and step != 0
when 1
move_up if @map[@x,@y-1] == step - 1 and step != 0
move_left if @map[@x-1,@y] == step -1 and step != 0
move_down if @map[@x,@y+1] == step - 1 and step != 0
move_right if @map[@x+1,@y] == step - 1 and step != 0
end
end
#--------------------------------------------------------------------------
def find_path(x, y, max_depth = 100)
sx, sy = @x, @y
result = setup_map(sx, sy, x, y, max_depth)
@runpath = result[0]
@map = result[1]
@map[sx,sy] = result[2] if result[2] != nil
end
#--------------------------------------------------------------------------
def clear_path
@map = nil
@runpath = false
end
#--------------------------------------------------------------------------
def setup_map(sx, sy, ex, ey, max_depth = 100)
map = Table.new($game_map.width, $game_map.height)
map[ex,ey] = 1
old_positions = []
new_positions = []
old_positions.push([ex, ey])
depth = 2
#Pass a 3rd parameter to find_path to limit the max depth
#The limit is 100 steps.
depth.upto([max_depth,100].min){|step|
loop do
break if old_positions[0] == nil
x,y = old_positions.shift
return [true, map, step] if x == sx and y+1 == sy
if $game_player.passable?(x, y, 2) and map[x,y + 1] == 0
map[x,y + 1] = step
new_positions.push([x,y + 1])
end
return [true, map, step] if x-1 == sx and y == sy
if $game_player.passable?(x, y, 4) and map[x - 1,y] == 0
map[x - 1,y] = step
new_positions.push([x - 1,y])
end
return [true, map, step] if x+1 == sx and y == sy
if $game_player.passable?(x, y, 6) and map[x + 1,y] == 0
map[x + 1,y] = step
new_positions.push([x + 1,y])
end
return [true, map, step] if x == sx and y-1 == sy
if $game_player.passable?(x, y, 8) and map[x,y - 1] == 0
map[x,y - 1] = step
new_positions.push([x,y - 1])
end
end
old_positions = new_positions
new_positions = []
}
return [false, nil, nil]
end
end
class Game_Map
#--------------------------------------------------------------------------
alias pf_game_map_setup setup
#--------------------------------------------------------------------------
def setup(map_id)
pf_game_map_setup(map_id)
$game_player.clear_path
end
end
class Game_Player
#--------------------------------------------------------------------------
alias pf_game_player_update_player_movement update_player_movement
#--------------------------------------------------------------------------
def update_player_movement
$game_player.clear_path if Input.dir4 != 0
pf_game_player_update_player_movement
end
end
class Interpreter
#--------------------------------------------------------------------------
def event
return $game_map.events[@event_id]
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
#end
# Actualy my script only need the mouse stuff, but i dont think
# the rest will bring any trouble :D, so i let the full script
#==============================================================================
# ** Keyboard Input Module
#==============================================================================
# Near Fantastica
# Version 5
# 29.11.05
#==============================================================================
# The Keyboard Input Module is designed to function as the default Input module
# dose. It is better then other methods keyboard input because as a key is
# tested it is not removed form the list. so you can test the same key multiple
# times the same loop.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
#SDK.log("Keyboard Input", "Near Fantastica", 5, "29.11.05")
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
#if SDK.state("Keyboard Input") == true
module Keyboard
#--------------------------------------------------------------------------
@keys = []
@pressed = []
Mouse_Left = 1
Mouse_Right = 2
Back= 8
Tab = 9
Enter = 13
Shift = 16
Ctrl = 17
Alt = 18
Esc = 27
Space = 32
Numberkeys = {}
Numberkeys[0] = 48
Numberkeys[1] = 49
Numberkeys[2] = 50
Numberkeys[3] = 51
Numberkeys[4] = 52
Numberkeys[5] = 53
Numberkeys[6] = 54
Numberkeys[7] = 55
Numberkeys[8] = 56
Numberkeys[9] = 57
Numberpad = {}
Numberpad[0] = 45
Numberpad[1] = 35
Numberpad[2] = 40
Numberpad[3] = 34
Numberpad[4] = 37
Numberpad[5] = 12
Numberpad[6] = 39
Numberpad[7] = 36
Numberpad[8] = 38
Numberpad[9] = 33
Letters = {}
Letters["A"] = 65
Letters["B"] = 66
Letters["C"] = 67
Letters["D"] = 68
Letters["E"] = 69
Letters["F"] = 70
Letters["G"] = 71
Letters["H"] = 72
Letters["I"] = 73
Letters["J"] = 74
Letters["K"] = 75
Letters["L"] = 76
Letters["M"] = 77
Letters["N"] = 78
Letters["O"] = 79
Letters["P"] = 80
Letters["Q"] = 81
Letters["R"] = 82
Letters["S"] = 83
Letters["T"] = 84
Letters["U"] = 85
Letters["V"] = 86
Letters["W"] = 87
Letters["X"] = 88
Letters["Y"] = 89
Letters["Z"] = 90
Fkeys = {}
Fkeys[1] = 112
Fkeys[2] = 113
Fkeys[3] = 114
Fkeys[4] = 115
Fkeys[5] = 116
Fkeys[6] = 117
Fkeys[7] = 118
Fkeys[8] = 119
Fkeys[9] = 120
Fkeys[10] = 121
Fkeys[11] = 122
Fkeys[12] = 123
Collon = 186
Equal = 187
Comma = 188
Underscore = 189
Dot = 190
Backslash = 191
Lb = 219
Rb = 221
Quote = 222
State = Win32API.new("user32","GetKeyState",['i'],'i')
Key = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
#--------------------------------------------------------------------------
def Keyboard.getstate(key)
return true unless State.call(key).between?(0, 1)
return false
end
#--------------------------------------------------------------------------
def Keyboard.testkey(key)
Key.call(key) & 0x01 == 1
end
#--------------------------------------------------------------------------
def Keyboard.update
@keys = []
@keys.push(Keyboard::Mouse_Left) if Keyboard.testkey(Keyboard::Mouse_Left)
@keys.push(Keyboard::Mouse_Right) if Keyboard.testkey(Keyboard::Mouse_Right)
@keys.push(Keyboard::Back) if Keyboard.testkey(Keyboard::Back)
@keys.push(Keyboard::Tab) if Keyboard.testkey(Keyboard::Tab)
@keys.push(Keyboard::Enter) if Keyboard.testkey(Keyboard::Enter)
@keys.push(Keyboard::Shift) if Keyboard.testkey(Keyboard::Shift)
@keys.push(Keyboard::Ctrl) if Keyboard.testkey(Keyboard::Ctrl)
@keys.push(Keyboard::Alt) if Keyboard.testkey(Keyboard::Alt)
@keys.push(Keyboard::Esc) if Keyboard.testkey(Keyboard::Esc)
@keys.push(Keyboard::Space) if Keyboard.testkey(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Numberpad.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Letters.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Fkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
@keys.push(Keyboard::Collon) if Keyboard.testkey(Keyboard::Collon)
@keys.push(Keyboard::Equal) if Keyboard.testkey(Keyboard::Equal)
@keys.push(Keyboard::Comma) if Keyboard.testkey(Keyboard::Comma)
@keys.push(Keyboard::Underscore) if Keyboard.testkey(Keyboard::Underscore)
@keys.push(Keyboard::Dot) if Keyboard.testkey(Keyboard::Dot)
@keys.push(Keyboard::Backslash) if Keyboard.testkey(Keyboard::Backslash)
@keys.push(Keyboard::Lb) if Keyboard.testkey(Keyboard::Lb)
@keys.push(Keyboard::Rb) if Keyboard.testkey(Keyboard::Rb)
@keys.push(Keyboard::Quote) if Keyboard.testkey(Keyboard::Quote)
@pressed = []
@pressed.push(Keyboard::Mouse_Left) if Keyboard.getstate(Keyboard::Mouse_Left)
@pressed.push(Keyboard::Mouse_Right) if Keyboard.getstate(Keyboard::Mouse_Right)
@pressed.push(Keyboard::Back) if Keyboard.getstate(Keyboard::Back)
@pressed.push(Keyboard::Tab) if Keyboard.getstate(Keyboard::Tab)
@pressed.push(Keyboard::Enter) if Keyboard.getstate(Keyboard::Enter)
@pressed.push(Keyboard::Shift) if Keyboard.getstate(Keyboard::Shift)
@pressed.push(Keyboard::Ctrl) if Keyboard.getstate(Keyboard::Ctrl)
@pressed.push(Keyboard::Alt) if Keyboard.getstate(Keyboard::Alt)
@pressed.push(Keyboard::Esc) if Keyboard.getstate(Keyboard::Esc)
@pressed.push(Keyboard::Space) if Keyboard.getstate(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Numberpad.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Letters.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Fkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
@pressed.push(Keyboard::Collon) if Keyboard.getstate(Keyboard::Collon)
@pressed.push(Keyboard::Equal) if Keyboard.getstate(Keyboard::Equal)
@pressed.push(Keyboard::Comma) if Keyboard.getstate(Keyboard::Comma)
@pressed.push(Keyboard::Underscore) if Keyboard.getstate(Keyboard::Underscore)
@pressed.push(Keyboard::Dot) if Keyboard.getstate(Keyboard::Dot)
@pressed.push(Keyboard::Backslash) if Keyboard.getstate(Keyboard::Backslash)
@pressed.push(Keyboard::Lb) if Keyboard.getstate(Keyboard::Lb)
@pressed.push(Keyboard::Rb) if Keyboard.getstate(Keyboard::Rb)
@pressed.push(Keyboard::Quote) if Keyboard.getstate(Keyboard::Quote)
end
#--------------------------------------------------------------------------
def Keyboard.trigger?(key)
return true if @keys.include?(key)
return false
end
#--------------------------------------------------------------------------
def Keyboard.pressed?(key)
return true if @pressed.include?(key)
return false
end
#end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
#=================== END OF NEAR FANTASTICA SCRIPTS =============
#=========================Game_Fixes=============================
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(18,0,0,0)
$showm.call(13,0,0,0)
$showm.call(13,0,2,0)
$showm.call(18,0,2,0)
$mouse = Mouse_PositionCheck.new
$getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')
$setCursorPos = Win32API.new("user32", "SetCursorPos", ['I','I'], 'V')
$bg = Sprite.new
$bg.bitmap = RPG::Cache.icon('001-Weapon01')
$bg.z = 999999
$bg.y = 0
$bg.x = 0
module Input
if @self_update == nil
@self_update = method('update')
@self_press = method('press?')
@self_rep = method('repeat?')
end
def self.update
@self_update.call
$mouse.main
Keyboard.update
end
def self.trigger?(key_code)
if @self_press.call(key_code)
return true
end
if key_code == C
return Keyboard.trigger?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.trigger?(Keyboard::Mouse_Right)
else
return @self_press.call(key_code)
end
end
def self.repeat?(key_code)
if @self_rep.call(key_code)
return true
end
if key_code == C
return Keyboard.pressed?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.pressed?(Keyboard::Mouse_Right)
else
return @self_rep.call(key_code)
end
end
end
class Arrow_Enemy < Arrow_Base
def update
super
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
#size = 0
#for i in 0...$game_troop.enemies.size
# size += 1 if $game_troop.enemies[i].hp > 0
#end
size = $game_troop.enemies.size if size == nil
@index = ((size / 640.0) * $bg.x.to_f).to_i
if self.enemy != nil
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y
end
end
end
class Arrow_Actor < Arrow_Base
def update
super
@index = 0 if $bg.x > 0 and $bg.x <= 160 and 0 <= ($game_party.actors.size - 1)
@index = 1 if $bg.x > 160 and $bg.x <= 320 and 1 <= ($game_party.actors.size - 1)
@index = 2 if $bg.x > 320 and $bg.x <= 480 and 2 <= ($game_party.actors.size - 1)
@index = 3 if $bg.x > 480 and $bg.x <= 640 and 3 <= ($game_party.actors.size - 1)
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end
class Window_Target < Window_Selectable
alias gupdate update
def update
@defaultx = 0 if @defaultx == nil
if @defaultx != self.x
@defaultx = self.x
self.refresh_rect_positions
return
else
gupdate
end
end
def update_cursor_rect
if @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
class Scene_Battle
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.x = @actor_index * 160
@actor_command_window.refresh_rect_positions
@actor_command_window.index = 0
end
end
class Scene_Equip
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
@actor = $game_party.actors[@actor_index]
end
alias gmain main
def main
@dummy = Window_EquipItem.new(@actor, 99)
gmain
@dummy.dispose
end
alias gupdate_right update_right
def update_right
if @right_window.index == -999999
if Input.trigger?(Input::C)
$game_system.se_play($data_system.buzzer_se)
end
else
gupdate_right
end
end
def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
@dummy.visible = (@right_window.index == -999999)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
when -999999
return
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
end
class Scene_Skill
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index == -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index <= -3
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Scene_File
def update
@help_window.update
for i in @savefile_windows
i.update
end
if Input.trigger?(Input::C)
if @file_index == -1
$game_system.se_play($data_system.buzzer_se)
else
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
end
if Input.trigger?(Input::B)
on_cancel
return
end
if $bg.y > 64 and $bg.y < 168
if @savefile_windows[0].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = true
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 0
elsif $bg.y > 168 and $bg.y < 272
if @savefile_windows[1].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = true
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 1
elsif $bg.y > 272 and $bg.y < 376
if @savefile_windows[2].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = true
@savefile_windows[3].selected = false
@file_index = 2
elsif $bg.y > 376 and $bg.y < 480
if @savefile_windows[3].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = true
@file_index = 3
else
@file_index = -1
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
end
end
end
class Scene_Menu
def update_status
if Input.trigger?(Input::B)# or Keyboard.trigger?(Keyboard::Mouse_Right)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)# or Keyboard.trigger?(Keyboard::Mouse_Left)
unless @status_window.index < 0
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
class Game_Player
def update
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_curor_field
if (@field_x == self.x + 1 and @field_y == self.y and
self.direction == 6) or (@field_x == self.x - 1 and
@field_y == self.y and self.direction == 4) or
(@field_x == self.x and @field_y == self.y + 1 and
self.direction == 2) or (@field_x == self.x and
@field_y == self.y - 1 and self.direction == 8)
check_event_trigger_there([0,1,2])
end
end
if Input.repeat?(Input::C)
check_curor_field
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move and not (@field_x == self.x and @field_y == self.y)
move_by_mouse
end
check_event_trigger_here([0])
end
end
end
def check_curor_field
dummyx = $game_map.display_x > 0 ? $bg.x + 16 : $bg.x
@field_x = dummyx / 32 + $game_map.display_x / 128
@field_y = $bg.y / 32 + $game_map.display_y / 128
end
def move_by_mouse
dy = @field_x - self.x
dx = self.y - @field_y
if $pathfind
$game_player.find_path(@field_x,@field_y)
else
if dx > 0 and dy > 0 #quarter 1
if dx > dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
elsif dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_up
end
return
elsif dx == dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
end
elsif dx > 0 and dy < 0 #quarter 2
if dx > -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
elsif dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_up
end
return
elsif dx == -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
end
elsif dx < 0 and dy < 0 #quarter 2
if -dx > -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
elsif -dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_down
end
return
elsif -dx == -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
end
elsif dx < 0 and dy > 0 #quarter 4
if -dx > dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
elsif -dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_down
end
return
elsif -dx == dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
end
elsif dx == 0 and dy < 0
move_left
elsif dx == 0 and dy > 0
move_right
elsif dx < 0 and dy == 0
move_down
elsif dx > 0 and dy == 0
move_up
end
end
end
end
class Window_Message < Window_Selectable
def update
get_rect_positions
old_index = self.index
new_index = $mouse.get_window_index(self)
$game_system.se_play($data_system.cursor_se) if
old_index != new_index and not new_index == -999999
@index = new_index if old_index != -1
self.cursor_rect.empty if new_index == -999999
self.index = new_index
super
# Se Fade_in
if @fade_in
self.contents_opacity += 24
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
end
# Se for entrada num�rica
if @input_number_window != nil
@input_number_window.update
# Confirmar
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[$game_temp.num_input_variable_id] =
@input_number_window.number
$game_map.need_refresh = true
# Exibir a janela de entrada num�rica
@input_number_window.dispose
@input_number_window = nil
terminate_message
end
return
end
# Se a mensagem estiver sendo exibida
if @contents_showing
# Se a escolha n�o estiver sendo exibida pausar
if $game_temp.choice_max == 0
self.pause = true
end
# Cancelar
if Input.trigger?(Input::B)
if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
$game_system.se_play($data_system.cancel_se)
$game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
terminate_message
end
end
# Confirmar
if Input.trigger?(Input::C)
if $game_temp.choice_max > 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
end
terminate_message
end
return
end
# Se houver mensagem em espera ou estiver em escolha
if @fade_out == false and $game_temp.message_text != nil
@contents_showing = true
$game_temp.message_window_showing = true
reset_window
refresh
Graphics.frame_reset
self.visible = true
self.contents_opacity = 0
if @input_number_window != nil
@input_number_window.contents_opacity = 0
end
@fade_in = true
return
end
# Se a mensagem n�o estiver sendo exibida
if self.visible
@fade_out = true
self.opacity -= 48
if self.opacity == 0
self.visible = false
@fade_out = false
$game_temp.message_window_showing = false
end
return
end
end
end