header improvements

also fix a weird bug that can happen when pasting characters at the end of a text stream that needs to be repointed
This commit is contained in:
haven1433 2022-10-19 20:36:58 -05:00
parent a371b65a15
commit d80680270a
5 changed files with 282 additions and 8 deletions

View File

@ -19,6 +19,247 @@ Offset = 0x000004
Address = 0x03DC9C
Offset = 0x000004
[[List]]
Name = '''songnames'''
0 = [
'''mus_dummy''',
'''se_use_item''',
'''se_pc_login''',
'''se_pc_off''',
'''se_pc_on''',
'''se_select''',
'''se_win_open''',
'''se_wall_hit''',
'''se_door''',
'''se_exit''',
'''se_ledge''',
'''se_bike_bell''',
'''se_not_effective''',
'''se_effective''',
'''se_super_effective''',
'''se_ball_open''',
'''se_faint''',
'''se_flee''',
'''se_sliding_door''',
'''se_ship''',
'''se_bang''',
'''se_pin''',
'''se_boo''',
'''se_ball''',
'''se_contest_place''',
'''se_a''',
'''se_i''',
'''se_u''',
'''se_e''',
'''se_o''',
'''se_n''',
'''se_success''',
'''se_failure''',
'''se_exp''',
'''se_bike_hop''',
'''se_switch''',
'''se_click''',
'''se_fu_zaku''',
'''se_contest_condition_lose''',
'''se_lavaridge_fall_warp''',
'''se_ice_stairs''',
'''se_ice_break''',
'''se_ice_crack''',
'''se_fall''',
'''se_unlock''',
'''se_warp_in''',
'''se_warp_out''',
'''se_repel''',
'''se_rotating_gate''',
'''se_truck_move''',
'''se_truck_stop''',
'''se_truck_unload''',
'''se_truck_door''',
'''se_berry_blender''',
'''se_card''',
'''se_save''',
'''se_ball_bounce_1''',
'''se_ball_bounce_2''',
'''se_ball_bounce_3''',
'''se_ball_bounce_4''',
'''se_ball_trade''',
'''se_ball_throw''',
'''se_note_c''',
'''se_note_d''',
'''se_note_e''',
'''se_note_f''',
'''se_note_g''',
'''se_note_a''',
'''se_note_b''',
'''se_note_c_high''',
'''se_puddle''',
'''se_bridge_walk''',
'''se_itemfinder''',
'''se_ding_dong''',
'''se_balloon_red''',
'''se_balloon_blue''',
'''se_balloon_yellow''',
'''se_breakable_door''',
'''se_mud_ball''',
'''se_field_poison''',
'''se_escalator''',
'''se_thunderstorm''',
'''se_thunderstorm_stop''',
'''se_downpour''',
'''se_downpour_stop''',
'''se_rain''',
'''se_rain_stop''',
'''se_thunder''',
'''se_thunder2''',
'''se_elevator''',
'''se_low_health''',
'''se_exp_max''',
'''se_roulette_ball''',
'''se_roulette_ball2''',
'''se_taillow_wing_flap''',
'''se_shop''',
'''se_contest_heart''',
'''se_contest_curtain_rise''',
'''se_contest_curtain_fall''',
'''se_contest_icon_change''',
'''se_contest_icon_clear''',
'''se_contest_mons_turn''',
'''se_shiny''',
'''se_intro_blast''',
'''se_mugshot''',
'''se_applause''',
'''se_vend''',
'''se_orb''',
'''se_dex_scroll''',
'''se_dex_page''',
'''se_pokenav_on''',
'''se_pokenav_off''',
'''se_dex_search''',
'''se_egg_hatch''',
'''se_ball_tray_enter''',
'''se_ball_tray_ball''',
'''se_ball_tray_exit''',
'''se_glass_flute''',
'''mus_stop''',
'''mus_littleroot_test''',
'''mus_gsc_route38''',
'''mus_caught''',
'''mus_victory_wild''',
'''mus_victory_gym_leader''',
'''mus_victory_league''',
'''mus_c_comm_center''',
'''mus_gsc_pewter''',
'''mus_c_vs_legend_beast''',
'''mus_route101''',
'''mus_route110''',
'''mus_route120''',
'''mus_petalburg''',
'''mus_oldale''',
'''mus_gym''',
'''mus_surf''',
'''mus_petalburg_woods''',
'''mus_level_up''',
'''mus_heal''',
'''mus_obtain_badge''',
'''mus_obtain_item''',
'''mus_evolved''',
'''mus_obtain_tmhm''',
'''mus_lilycove_museum''',
'''mus_route122''',
'''mus_oceanic_museum''',
'''mus_evolution_intro''',
'''mus_evolution''',
'''mus_move_deleted''',
'''mus_encounter_girl''',
'''mus_encounter_male''',
'''mus_abandoned_ship''',
'''mus_fortree''',
'''mus_birch_lab''',
'''mus_b_tower''',
'''mus_encounter_swimmer''',
'''mus_cave_of_origin''',
'''mus_obtain_berry''',
'''mus_awaken_legend''',
'''mus_slots_jackpot''',
'''mus_slots_win''',
'''mus_too_bad''',
'''mus_roulette''',
'''mus_link_contest_p1''',
'''mus_link_contest_p2''',
'''mus_link_contest_p3''',
'''mus_link_contest_p4''',
'''mus_encounter_rich''',
'''mus_verdanturf''',
'''mus_rustboro''',
'''mus_poke_center''',
'''mus_route104''',
'''mus_route119''',
'''mus_cycling''',
'''mus_poke_mart''',
'''mus_littleroot''',
'''mus_mt_chimney''',
'''mus_encounter_female''',
'''mus_lilycove''',
'''mus_route111''',
'''mus_help''',
'''mus_underwater''',
'''mus_victory_trainer''',
'''mus_title''',
'''mus_intro''',
'''mus_encounter_may''',
'''mus_encounter_intense''',
'''mus_encounter_cool''',
'''mus_route113''',
'''mus_encounter_aqua''',
'''mus_follow_me''',
'''mus_encounter_brendan''',
'''mus_ever_grande''',
'''mus_encounter_suspicious''',
'''mus_victory_aqua_magma''',
'''mus_cable_car''',
'''mus_game_corner''',
'''mus_dewford''',
'''mus_safari_zone''',
'''mus_victory_road''',
'''mus_aqua_magma_hideout''',
'''mus_sailing''',
'''mus_mt_pyre''',
'''mus_slateport''',
'''mus_mt_pyre_exterior''',
'''mus_school''',
'''mus_hall_of_fame''',
'''mus_fallarbor''',
'''mus_sealed_chamber''',
'''mus_contest_winner''',
'''mus_contest''',
'''mus_encounter_magma''',
'''mus_intro_battle''',
'''mus_weather_kyogre''',
'''mus_weather_groudon''',
'''mus_sootopolis''',
'''mus_contest_results''',
'''mus_hall_of_fame_room''',
'''mus_trick_house''',
'''mus_encounter_twins''',
'''mus_encounter_elite_four''',
'''mus_encounter_hiker''',
'''mus_contest_lobby''',
'''mus_encounter_interviewer''',
'''mus_encounter_champion''',
'''mus_credits''',
'''mus_end''',
'''mus_vs_wild''',
'''mus_vs_aqua_magma''',
'''mus_vs_trainer''',
'''mus_vs_gym_leader''',
'''mus_vs_champion''',
'''mus_vs_regi''',
'''mus_vs_kyogre_groudon''',
'''mus_vs_rival''',
'''mus_vs_elite_four''',
'''mus_vs_aqua_magma_leader''',
]
[[GotoShortcut]]
Name = '''Pokemon'''
Image = '''graphics.pokemon.sprites.front/350/sprite/'''

View File

@ -110,6 +110,21 @@ Name = '''Intro'''
'''graphics.battle.background.sprites|1'''
]
[[List]]
Name = '''maptypes'''
0 = [
'''none''',
'''town''',
'''city''',
'''route''',
'''underground''',
'''underwater''',
'''ocean_route''',
'''unknown''',
'''indoor''',
'''secret_base''',
]
[[List]]
Name = '''egggroups'''
0 = [

View File

@ -1563,7 +1563,15 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Map {
private readonly Func<ModelDelta> tokenFactory;
// music: layoutID: regionSectionID. cave. weather. mapType. allowBiking. flags.|t|allowEscaping.|allowRunning.|showMapName::: floorNum. battleType.
public MapHeaderViewModel(ModelArrayElement element, Func<ModelDelta> tokens) => (map, tokenFactory) = (element, tokens);
public MapHeaderViewModel(ModelArrayElement element, Func<ModelDelta> tokens) {
(map, tokenFactory) = (element, tokens);
if (element.Model.TryGetList("songnames", out var songnames)) {
foreach (var name in songnames) MusicOptions.Add(name);
}
if (element.Model.TryGetList("maptypes", out var mapTypes)) {
foreach (var name in mapTypes) MapTypeOptions.Add(name);
}
}
public int Music { get => GetValue(); set => SetValue(value); }
public int LayoutID { get => GetValue(); set => SetValue(value); }
@ -1575,6 +1583,12 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Map {
public int FloorNum { get => GetValue(); set => SetValue(value); }
public int BattleType { get => GetValue(); set => SetValue(value); }
public bool HasMusicOptions => MusicOptions.Count > 0;
public ObservableCollection<string> MusicOptions { get; } = new();
public bool HasMapTypeOptions => MapTypeOptions.Count > 0;
public ObservableCollection<string> MapTypeOptions { get; } = new();
#region Flags
public int Flags {

View File

@ -539,18 +539,20 @@
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="local:AngleBorder" BasedOn="{StaticResource {x:Type local:AngleBorder}}">
<Setter Property="Direction" Value="Left" />
<Setter Property="Direction" Value="Out" />
<Setter Property="Margin" Value="1,2,0,2" />
</Style>
<Style TargetType="local:AngleTextBox" BasedOn="{StaticResource {x:Type local:AngleTextBox}}">
<Setter Property="Direction" Value="Out" />
<Setter Property="Direction" Value="Right" />
<Setter Property="Grid.Column" Value="1" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Margin" Value="0,2,4,2" />
</Style>
</Grid.Resources>
<local:AngleBorder Grid.Row="0" Content="Music:" />
<local:AngleTextBox Grid.Row="0" TextBinding="{Binding Music, UpdateSourceTrigger=PropertyChanged}" />
<local:AngleBorder Grid.Row="0" Content="Music:" Direction="Left" />
<local:AngleComboBox Grid.Row="0" Grid.Column="1" Direction="Out" Margin="0,2,4,2"
ItemsSource="{Binding MusicOptions}" SelectedIndex="{Binding Music}"
Visibility="{Binding HasMusicOptions, Converter={StaticResource BoolToVisibility}}" />
<local:AngleBorder Grid.Row="1" Content="Region Section ID:" />
<local:AngleTextBox Grid.Row="1" TextBinding="{Binding RegionSectionID, UpdateSourceTrigger=PropertyChanged}" />
@ -561,8 +563,10 @@
<local:AngleBorder Grid.Row="3" Content="Weather:" />
<local:AngleTextBox Grid.Row="3" TextBinding="{Binding Weather, UpdateSourceTrigger=PropertyChanged}" />
<local:AngleBorder Grid.Row="4" Content="MapType:" />
<local:AngleTextBox Grid.Row="4" TextBinding="{Binding MapType, UpdateSourceTrigger=PropertyChanged}" />
<local:AngleBorder Grid.Row="4" Content="MapType:" Direction="Left" />
<local:AngleComboBox Grid.Row="4" Grid.Column="1" Direction="Out" Margin="0,2,4,2"
ItemsSource="{Binding MapTypeOptions}" SelectedIndex="{Binding MapType}"
Visibility="{Binding HasMapTypeOptions, Converter={StaticResource BoolToVisibility}}" />
<local:AngleBorder Grid.Row="5" Content="AllowBiking:" />
<local:AngleTextBox Grid.Row="5" TextBinding="{Binding AllowBiking, UpdateSourceTrigger=PropertyChanged}" />

View File

@ -145,7 +145,7 @@ namespace HavenSoft.HexManiac.WPF.Controls {
if (tools == null || tools.StringTool == null) return;
var tool = tools.StringTool;
var linesBeforeSelection = StringToolTextBox.Text.Substring(0, StringToolTextBox.SelectionStart).Split(Environment.NewLine).Length - 1;
var linesBeforeSelection = StringToolTextBox.Text.Substring(0, Math.Min(StringToolTextBox.Text.Length, StringToolTextBox.SelectionStart)).Split(Environment.NewLine).Length - 1;
var totalLines = StringToolTextBox.Text.Split(Environment.NewLine).Length;
var verticalOffset = StringToolTextBox.VerticalOffset;
var lineHeight = StringToolTextBox.ExtentHeight / totalLines;