Turned trainer intro MEs into BGMs

This commit is contained in:
Maruno17
2022-04-20 22:11:04 +01:00
parent 144ad91bc1
commit d3b61a64ef
9 changed files with 25 additions and 18 deletions

View File

@@ -438,7 +438,7 @@ class Interpreter
return true if $DEBUG && !GameData::TrainerType.exists?(symbol)
tr_type = GameData::TrainerType.get(symbol).id
pbGlobalLock
pbPlayTrainerIntroME(tr_type)
pbPlayTrainerIntroBGM(tr_type)
return true
end

View File

@@ -42,6 +42,8 @@ class Game_Temp
attr_accessor :begun_new_game # new game flag (true fron new game until saving)
attr_accessor :menu_beep # menu: play sound effect flag
attr_accessor :menu_last_choice # pause menu: index of last selection
attr_accessor :memorized_bgm # set when trainer intro BGM is played
attr_accessor :memorized_bgm_position # set when trainer intro BGM is played
attr_accessor :darkness_sprite # DarknessSprite or nil
attr_accessor :mart_prices
@@ -80,6 +82,8 @@ class Game_Temp
# Other
@begun_new_game = false
@menu_beep = false
@memorized_bgm = nil
@memorized_bgm_position = 0
@menu_last_choice = 0
@mart_prices = {}
end

View File

@@ -6,7 +6,7 @@ module GameData
attr_reader :base_money
attr_reader :skill_level
attr_reader :flags
attr_reader :intro_ME
attr_reader :intro_BGM
attr_reader :battle_BGM
attr_reader :victory_ME
@@ -22,7 +22,7 @@ module GameData
"BaseMoney" => [:base_money, "u"],
"SkillLevel" => [:skill_level, "u"],
"Flags" => [:flags, "*s"],
"IntroME" => [:intro_ME, "s"],
"IntroBGM" => [:intro_BGM, "s"],
"BattleBGM" => [:battle_BGM, "s"],
"VictoryME" => [:victory_ME, "s"]
}
@@ -86,7 +86,7 @@ module GameData
@base_money = hash[:base_money] || 30
@skill_level = hash[:skill_level] || @base_money
@flags = hash[:flags] || []
@intro_ME = hash[:intro_ME]
@intro_BGM = hash[:intro_BGM]
@battle_BGM = hash[:battle_BGM]
@victory_ME = hash[:victory_ME]
end

View File

@@ -453,8 +453,6 @@ def pbTrainerBattleCore(*args)
# Set various other properties in the battle class
pbPrepareBattle(battle)
$game_temp.clear_battle_rules
# End the trainer intro music
Audio.me_stop
# Perform the battle itself
decision = 0
pbBattleAnimation(pbGetTrainerBattleBGM(foeTrainers), (battle.singleBattle?) ? 1 : 3, foeTrainers) {

View File

@@ -68,10 +68,11 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
playingBGM = $game_system.getPlayingBGM
$game_system.bgm_pause
$game_system.bgs_pause
if $game_temp.memorized_bgm
playingBGM = $game_temp.memorized_bgm
$game_system.bgm_position = $game_temp.memorized_bgm_position
end
end
pbMEFade(0.25)
pbWait(Graphics.frame_rate / 4)
pbMEStop
# Play battle music
bgm = pbGetWildBattleBGM([]) if !bgm
pbBGMPlay(bgm)
@@ -129,6 +130,8 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
$game_system.bgm_resume(playingBGM)
$game_system.bgs_resume(playingBGS)
end
$game_temp.memorized_bgm = nil
$game_temp.memorized_bgm_position = 0
$PokemonGlobal.nextBattleBGM = nil
$PokemonGlobal.nextBattleME = nil
$PokemonGlobal.nextBattleCaptureME = nil

View File

@@ -63,11 +63,13 @@ end
#===============================================================================
# Load/play various trainer battle music
#===============================================================================
def pbPlayTrainerIntroME(trainer_type)
def pbPlayTrainerIntroBGM(trainer_type)
trainer_type_data = GameData::TrainerType.get(trainer_type)
return if nil_or_empty?(trainer_type_data.intro_ME)
bgm = pbStringToAudioFile(trainer_type_data.intro_ME)
pbMEPlay(bgm)
return if nil_or_empty?(trainer_type_data.intro_BGM)
bgm = pbStringToAudioFile(trainer_type_data.intro_BGM)
$game_temp.memorized_bgm = $game_system.getPlayingBGM
$game_temp.memorized_bgm_position = (Audio.bgm_pos rescue 0)
pbBGMPlay(bgm)
end
def pbGetTrainerBattleBGM(trainer) # can be a Player, NPCTrainer or an array of them

View File

@@ -353,7 +353,7 @@ def pbTrainerTypeEditor
[_INTL("BaseMoney"), LimitProperty.new(9999), _INTL("Player earns this much money times the highest level among the trainer's Pokémon.")],
[_INTL("SkillLevel"), LimitProperty.new(9999), _INTL("Skill level of this Trainer Type.")],
[_INTL("Flags"), StringListProperty, _INTL("Words/phrases that can be used to make trainers of this type behave differently to others.")],
[_INTL("IntroME"), MEProperty, _INTL("ME played before battles against trainers of this type.")],
[_INTL("IntroBGM"), BGMProperty, _INTL("BGM played before battles against trainers of this type.")],
[_INTL("BattleBGM"), BGMProperty, _INTL("BGM played in battles against trainers of this type.")],
[_INTL("VictoryME"), MEProperty, _INTL("ME played when player wins battles against trainers of this type.")]
]
@@ -377,7 +377,7 @@ def pbTrainerTypeEditor
t_data.base_money,
t_data.skill_level,
t_data.flags,
t_data.intro_ME,
t_data.intro_BGM,
t_data.battle_BGM,
t_data.victory_ME
]
@@ -390,7 +390,7 @@ def pbTrainerTypeEditor
:base_money => data[3],
:skill_level => data[4],
:flags => data[5],
:intro_ME => data[6],
:intro_BGM => data[6],
:battle_BGM => data[7],
:victory_ME => data[8]
}

View File

@@ -1399,7 +1399,7 @@ module Compiler
:base_money => line[3],
:battle_BGM => line[4],
:victory_ME => line[5],
:intro_ME => line[6],
:intro_BGM => line[6],
:gender => line[7],
:skill_level => line[8],
:flags => line[9]

View File

@@ -634,7 +634,7 @@ module Compiler
f.write(sprintf("BaseMoney = %d\r\n", t.base_money))
f.write(sprintf("SkillLevel = %d\r\n", t.skill_level)) if t.skill_level != t.base_money
f.write(sprintf("Flags = %s\r\n", t.flags.join(","))) if t.flags.length > 0
f.write(sprintf("IntroME = %s\r\n", t.intro_ME)) if !nil_or_empty?(t.intro_ME)
f.write(sprintf("IntroBGM = %s\r\n", t.intro_BGM)) if !nil_or_empty?(t.intro_BGM)
f.write(sprintf("BattleBGM = %s\r\n", t.battle_BGM)) if !nil_or_empty?(t.battle_BGM)
f.write(sprintf("VictoryME = %s\r\n", t.victory_ME)) if !nil_or_empty?(t.victory_ME)
end