Auteur: Yukihiro matsumoto
#============================================
# ¡ Interpreter (•ªŠ„’è‹` 3)
#----------------------------------------------
# @ƒCƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ðŽÀs‚·‚éƒCƒ“ƒ^ƒvƒŠƒ^‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_System ƒNƒ‰
# ƒX‚â Game_Event ƒNƒ‰ƒX‚Ì“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
#============================================
class Interpreter
#------------------------------------------
# œ •¶Í‚Ì•Ž¦
#------------------------------------------
def command_101
# ‚Ù‚©‚Ì•¶Í‚ª message_text ‚ÉÝ’èς݂Ìê‡
if $game_temp.message_text != nil
# I—¹
return false
end
# ƒƒbƒZ[ƒWI—¹‘Ò‹@’†ƒtƒ‰ƒO‚¨‚æ‚уR[ƒ‹ƒoƒbƒN‚ðÝ’è
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# message_text ‚É 1 s–Ú‚ðÝ’è
$game_temp.message_text = @list[@index].parameters[0] + "n"
line_count = 1
# ƒ‹[ƒv
loop do
# ŽŸ‚̃Cƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ª•¶Í 2 s–ÚˆÈ~‚Ìê‡
if @list[@index+1].code == 401
# message_text ‚É 2 s–ÚˆÈ~‚ð’ljÁ
$game_temp.message_text += @list[@index+1].parameters[0] + "n"
line_count += 1
# ƒCƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ª•¶Í 2 s–ÚˆÈ~‚ł͂Ȃ¢ê‡
else
# ŽŸ‚̃Cƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ª‘I‘ðŽˆ‚Ì•Ž¦‚Ìê‡
if @list[@index+1].code == 102
# ‘I‘ðŽˆ‚ª‰æ–ʂɎû‚Ü‚éê‡
if @list[@index+1].parameters[0].size <= 4 - line_count
# ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
@index += 1
# ‘I‘ðŽˆ‚ÌƒZƒbƒgƒAƒbƒv
$game_temp.choice_start = line_count
setup_choices(@list[@index].parameters)
end
# ŽŸ‚̃Cƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ª”’l“ü—͂̈—‚Ìê‡
elsif @list[@index+1].code == 103
# ”’l“ü—̓EƒBƒ“ƒhƒE‚ª‰æ–ʂɎû‚Ü‚éê‡
if line_count < 4
# ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
@index += 1
# ”’l“ü—͂̃ZƒbƒgƒAƒbƒv
$game_temp.num_input_start = line_count
$game_temp.num_input_variable_id = @list[@index].parameters[0]
$game_temp.num_input_digits_max = @list[@index].parameters[1]
end
end
# Œp‘±
return true
end
# ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
@index += 1
end
end
#------------------------------------------
# œ ‘I‘ðŽˆ‚Ì•Ž¦
#------------------------------------------
def command_102
# •¶Í‚ª message_text ‚ÉÝ’èς݂Ìê‡
if $game_temp.message_text != nil
# I—¹
return false
end
# ƒƒbƒZ[ƒWI—¹‘Ò‹@’†ƒtƒ‰ƒO‚¨‚æ‚уR[ƒ‹ƒoƒbƒN‚ðÝ’è
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# ‘I‘ðŽˆ‚ÌƒZƒbƒgƒAƒbƒv
$game_temp.message_text = ""
$game_temp.choice_start = 0
setup_choices(@parameters)
# Œp‘±
return true
end
#------------------------------------------
# œ [**] ‚Ìê‡
#------------------------------------------
def command_402
# ŠY“–‚·‚é‘I‘ðŽˆ‚ª‘I‘ð‚³‚ê‚Ä‚¢‚éê‡
if @branch[@list[@index].indent] == @parameters[0]
# •ªŠòƒf[ƒ^‚ðíœ
@branch.delete(@list[@index].indent)
# Œp‘±
return true
end
# ðŒ‚ÉŠY“–‚µ‚È‚¢ê‡ : ƒRƒ}ƒ“ƒhƒXƒLƒbƒv
return command_skip
end
#------------------------------------------
# œ ƒLƒƒƒ“ƒZƒ‹‚Ìê‡
#------------------------------------------
def command_403
# ‘I‘ðŽˆ‚ªƒLƒƒƒ“ƒZƒ‹‚³‚ê‚Ä‚¢‚éê‡
if @branch[@list[@index].indent] == 4
# •ªŠòƒf[ƒ^‚ðíœ
@branch.delete(@list[@index].indent)
# Œp‘±
return true
end
# ðŒ‚ÉŠY“–‚µ‚È‚¢ê‡ : ƒRƒ}ƒ“ƒhƒXƒLƒbƒv
return command_skip
end
#------------------------------------------
# œ ”’l“ü—͂̈—
#------------------------------------------
def command_103
# •¶Í‚ª message_text ‚ÉÝ’èς݂Ìê‡
if $game_temp.message_text != nil
# I—¹
return false
end
# ƒƒbƒZ[ƒWI—¹‘Ò‹@’†ƒtƒ‰ƒO‚¨‚æ‚уR[ƒ‹ƒoƒbƒN‚ðÝ’è
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# ”’l“ü—͂̃ZƒbƒgƒAƒbƒv
$game_temp.message_text = ""
$game_temp.num_input_start = 0
$game_temp.num_input_variable_id = @parameters[0]
$game_temp.num_input_digits_max = @parameters[1]
# Œp‘±
return true
end
#------------------------------------------
# œ •¶ÍƒIƒvƒVƒ‡ƒ“•ÏX
#------------------------------------------
def command_104
# ƒƒbƒZ[ƒW•ަ’†‚Ìê‡
if $game_temp.message_window_showing
# I—¹
return false
end
# ŠeƒIƒvƒVƒ‡ƒ“‚ð•ÏX
$game_system.message_position = @parameters[0]
$game_system.message_frame = @parameters[1]
# Œp‘±
return true
end
#------------------------------------------
# œ ƒ{ƒ^ƒ““ü—͂̈—
#------------------------------------------
def command_105
# ƒ{ƒ^ƒ““ü—Í—p‚̕ϔ ID ‚ðÝ’è
@button_input_variable_id = @parameters[0]
# ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
@index += 1
# I—¹
return false
end
#------------------------------------------
# œ ƒEƒFƒCƒg
#------------------------------------------
def command_106
# ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðÝ’è
@wait_count = @parameters[0] * 2
# Œp‘±
return true
end
#------------------------------------------
# œ ðŒ•ªŠò
#------------------------------------------
def command_111
# ƒ[ƒJƒ‹•Ï” result ‚ð‰Šú‰»
result = false
# ðŒ”»’è
case @parameters[0]
when 0 # ƒXƒCƒbƒ`
result = ($game_switches[@parameters[1]] == (@parameters[2] == 0))
when 1 # •Ï”
value1 = $game_variables[@parameters[1]]
if @parameters[2] == 0
value2 = @parameters[3]
else
value2 = $game_variables[@parameters[3]]
end
case @parameters[4]
when 0 # ‚Æ“¯’l
result = (value1 == value2)
when 1 # ˆÈã
result = (value1 >= value2)
when 2 # ˆÈ‰º
result = (value1 <= value2)
when 3 # ’´
result = (value1 > value2)
when 4 # –¢–ž
result = (value1 < value2)
when 5 # ˆÈŠO
result = (value1 != value2)
end
when 2 # ƒZƒ‹ƒtƒXƒCƒbƒ`
if @event_id > 0
key = [$game_map.map_id, @event_id, @parameters[1]]
if @parameters[2] == 0
result = ($game_self_switches[key] == true)
else
result = ($game_self_switches[key] != true)
end
end
when 3 # ƒ^ƒCƒ}[
if $game_system.timer_working
sec = $game_system.timer / Graphics.frame_rate
if @parameters[2] == 0
result = (sec >= @parameters[1])
else
result = (sec <= @parameters[1])
end
end
when 4 # ƒAƒNƒ^[
actor = $game_actors[@parameters[1]]
if actor != nil
case @parameters[2]
when 0 # ƒp[ƒeƒB‚É‚¢‚é
result = ($game_party.actors.include?(actor))
when 1 # –¼‘O
result = (actor.name == @parameters[3])
when 2 # ƒXƒLƒ‹
result = (actor.skill_learn?(@parameters[3]))
when 3 # •Ší
result = (actor.weapon_id == @parameters[3])
when 4 # –h‹ï
result = (actor.armor1_id == @parameters[3] or
actor.armor2_id == @parameters[3] or
actor.armor3_id == @parameters[3])
when 5 # ƒXƒe[ƒg
result = (actor.state?(@parameters[3]))
end
end
when 5 # ƒGƒlƒ~[
enemy = $game_troop.enemies[@parameters[1]]
if enemy != nil
case @parameters[2]
when 0 # oŒ»‚µ‚Ä‚¢‚é
result = (enemy.exist?)
when 1 # ƒXƒe[ƒg
result = (enemy.state?(@parameters[3]))
end
end
when 6 # ƒLƒƒƒ‰ƒNƒ^[
character = get_character(@parameters[1])
if character != nil
result = (character.direction == @parameters[2])
end
when 7 # ƒS[ƒ‹ƒh
if @parameters[2] == 0
result = ($game_party.gold >= @parameters[1])
else
result = ($game_party.gold <= @parameters[1])
end
when 8 # ƒAƒCƒeƒ€
result = ($game_party.item_number(@parameters[1]) > 0)
when 9 # •Ší
result = ($game_party.weapon_number(@parameters[1]) > 0)
when 10 # –h‹ï
result = ($game_party.armor_number(@parameters[1]) > 0)
when 11 # ƒ{ƒ^ƒ“
result = (Input.press?(@parameters[1]))
when 12 # ƒXƒNƒŠƒvƒg
result = eval(@parameters[1])
end
# ”»’茋‰Ê‚ðƒnƒbƒVƒ…‚ÉŠi”[
@branch[@list[@index].indent] = result
# ”»’茋‰Ê‚ª^‚¾‚Á‚½ê‡
if @branch[@list[@index].indent] == true
# •ªŠòƒf[ƒ^‚ðíœ
@branch.delete(@list[@index].indent)
# Œp‘±
return true
end
# ðŒ‚ÉŠY“–‚µ‚È‚¢ê‡ : ƒRƒ}ƒ“ƒhƒXƒLƒbƒv
return command_skip
end
#------------------------------------------
# œ ‚»‚êˆÈŠO‚Ìê‡
#------------------------------------------
def command_411
# ”»’茋‰Ê‚ª‹U‚¾‚Á‚½ê‡
if @branch[@list[@index].indent] == false
# •ªŠòƒf[ƒ^‚ðíœ
@branch.delete(@list[@index].indent)
# Œp‘±
return true
end
# ðŒ‚ÉŠY“–‚µ‚È‚¢ê‡ : ƒRƒ}ƒ“ƒhƒXƒLƒbƒv
return command_skip
end
#------------------------------------------
# œ ƒ‹[ƒv
#------------------------------------------
def command_112
# Œp‘±
return true
end
#------------------------------------------
# œ ˆÈãŒJ‚è•Ô‚µ
#------------------------------------------
def command_413
# ƒCƒ“ƒfƒ“ƒg‚ðŽæ“¾
indent = @list[@index].indent
# ƒ‹[ƒv
loop do
# ƒCƒ“ƒfƒbƒNƒX‚ð–ß‚·
@index -= 1
# ‚±‚̃Cƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ª“¯ƒŒƒxƒ‹‚̃Cƒ“ƒfƒ“ƒg‚Ìê‡
if @list[@index].indent == indent
# Œp‘±
return true
end
end
end
#------------------------------------------
# œ ƒ‹[ƒv‚Ì’†’f
#------------------------------------------
def command_113
# ƒCƒ“ƒfƒ“ƒg‚ðŽæ“¾
indent = @list[@index].indent
# ƒCƒ“ƒfƒbƒNƒX‚ðˆêŽž•Ï”‚ɃRƒs[
temp_index = @index
# ƒ‹[ƒv
loop do
# ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
temp_index += 1
# ŠY“–‚·‚郋[ƒv‚ªŒ©‚‚©‚ç‚È‚©‚Á‚½ê‡
if temp_index >= @list.size-1
# Œp‘±
return true
end
# ‚±‚̃Cƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ª [ˆÈãŒJ‚è•Ô‚µ] ‚©‚ƒCƒ“ƒfƒ“ƒg‚ªó‚¢ê‡
if @list[temp_index].code == 413 and @list[temp_index].indent < indent
# ƒCƒ“ƒfƒbƒNƒX‚ðXV‚·‚é
@index = temp_index
# Œp‘±
return true
end
end
end
#------------------------------------------
# œ ƒCƒxƒ“ƒgˆ—‚Ì’†’f
#------------------------------------------
def command_115
# ƒCƒxƒ“ƒg‚ÌI—¹
command_end
# Œp‘±
return true
end
#------------------------------------------
# œ ƒCƒxƒ“ƒg‚̈ꎞÁ‹Ž
#------------------------------------------
def command_116
# ƒCƒxƒ“ƒg ID ‚ª—LŒø‚Ìê‡
if @event_id > 0
# ƒCƒxƒ“ƒg‚ðÁ‹Ž
$game_map.events[@event_id].erase
end
# ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
@index += 1
# I—¹
return false
end
#------------------------------------------
# œ ƒRƒ‚ƒ“ƒCƒxƒ“ƒg
#------------------------------------------
def command_117
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒg‚ðŽæ“¾
common_event = $data_common_events[@parameters[0]]
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒg‚ª—LŒø‚Ìê‡
if common_event != nil
# ŽqƒCƒ“ƒ^ƒvƒŠƒ^‚ðì¬
@child_interpreter = Interpreter.new(@depth + 1)
@child_interpreter.setup(common_event.list, @event_id)
end
# Œp‘±
return true
end
#------------------------------------------
# œ ƒ‰ƒxƒ‹
#------------------------------------------
def command_118
# Œp‘±
return true
end
#------------------------------------------
# œ ƒ‰ƒxƒ‹ƒWƒƒƒ“ƒv
#------------------------------------------
def command_119
# ƒ‰ƒxƒ‹–¼‚ðŽæ“¾
label_name = @parameters[0]
# ˆêŽž•Ï”‚ð‰Šú‰»
temp_index = 0
# ƒ‹[ƒv
loop do
# ŠY“–‚·‚郉ƒxƒ‹‚ªŒ©‚‚©‚ç‚È‚©‚Á‚½ê‡
if temp_index >= @list.size-1
# Œp‘±
return true
end
# ‚±‚̃Cƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ªŽw’肳‚ꂽ–¼‘O‚̃‰ƒxƒ‹‚Ìê‡
if @list[temp_index].code == 118 and
@list[temp_index].parameters[0] == label_name
# ƒCƒ“ƒfƒbƒNƒX‚ðXV‚·‚é
@index = temp_index
# Œp‘±
return true
end
# ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
temp_index += 1
end
end
end |
|