Skip to content

Commit

Permalink
Define CommandMenuOptions as enum, display as combobox with description
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikux3 committed May 6, 2020
1 parent e6d0ff8 commit 2e062db
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 5 deletions.
33 changes: 32 additions & 1 deletion OpenKh.Kh2/Objentry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,37 @@ public enum Type : byte
[Description("Puzzle Piece")]
JIGSAW = 0x18,
}

public enum CommandMenuOptions : byte
{
[Description("Sora / Roxas")]
SoraRoxasDefault = 0x0,
[Description("Valor Form")]
ValorForm = 0x1,
[Description("Wisdom Form")]
WisdomForm = 0x2,
[Description("Limit Form")]
LimitForm = 0x3,
[Description("Master Form")]
MasterForm = 0x4,
[Description("Final Form")]
FinalForm = 0x5,
[Description("Anti Form")]
AntiForm = 0x6,
[Description("Lion King Sora")]
LionKingSora = 0x7,
[Description("Magic, Drive, Party and Limit commands are greyed out")]
Unk08 = 0x8,
[Description("Drive, Party and Limit commands are greyed out (not used ingame)")]
Unk09 = 0x9,
[Description("Roxas Dual-Wield")]
RoxasDualWield = 0xA,
[Description("Only Attack and Summon commands are available, default")]
Default = 0xB,
[Description("Sora in Cube / Card Form (Luxord battle, not used ingame)")]
CubeCardForm = 0xC,
}

[Data] public ushort ObjectId { get; set; }
[Data] public ushort Unknown02 { get; set; } // has something to do with if the obj is rendered or not, NO: ObjectId is actually an uint, but it's bitshifted afterwards?! see z_un_003216b8
[Data] public Type ObjectType { get; set; }
Expand All @@ -78,7 +109,7 @@ public enum Type : byte
[Data] public byte SpawnLimiter { get; set; }
[Data] public byte Unknown55 { get; set; } // padding?
[Data] public byte Unknown56{ get; set; }
[Data] public byte CommandMenuOptions { get; set; }
[Data] public CommandMenuOptions CommandMenuOption { get; set; }
[Data] public ushort SpawnObject1 { get; set; }
[Data] public ushort SpawnObject2 { get; set; }
[Data] public ushort SpawnObject3 { get; set; }
Expand Down
12 changes: 11 additions & 1 deletion OpenKh.Tools.ObjentryEditor/ViewModels/ObjentryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ public Objentry.Type ObjectType
public byte SpawnLimiter { get => Objentry.SpawnLimiter; set => Objentry.SpawnLimiter = value; }
public byte Unknown55 { get => Objentry.Unknown55; set => Objentry.Unknown55 = value; }
public byte Unknown56 { get => Objentry.Unknown56; set => Objentry.Unknown56 = value; }
public byte CommandMenuOptions { get => Objentry.CommandMenuOptions; set => Objentry.CommandMenuOptions = value; }
public Objentry.CommandMenuOptions CommandMenuOption
{
get => Objentry.CommandMenuOption;
set
{
Objentry.CommandMenuOption = value;
OnPropertyChanged(nameof(CommandMenuOption));
}
}
public ushort SpawnObject1 { get => Objentry.SpawnObject1; set => Objentry.SpawnObject1 = value; }
public ushort SpawnObject2 { get => Objentry.SpawnObject2; set => Objentry.SpawnObject2 = value; }
public ushort SpawnObject3 { get => Objentry.SpawnObject3; set => Objentry.SpawnObject3 = value; }
Expand All @@ -70,6 +78,7 @@ public Objentry.Type ObjectType
private string _searchTerm;

public EnumModel<Objentry.Type> ObjEntryTypes { get; }
public EnumModel<Objentry.CommandMenuOptions> CommandMenuOptions { get; }

public ObjentryViewModel(BaseTable<Objentry> objentry) :
this(objentry.Id, objentry.Items)
Expand All @@ -80,6 +89,7 @@ public ObjentryViewModel(int type, IEnumerable<Objentry> items) :
{
_type = type;
ObjEntryTypes = new EnumModel<Objentry.Type>();
CommandMenuOptions = new EnumModel<Objentry.CommandMenuOptions>();
AddAndSelectCommand = new RelayCommand(x =>
{
AddCommand.Execute(null);
Expand Down
2 changes: 1 addition & 1 deletion OpenKh.Tools.ObjentryEditor/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OpenKh.Tools.ObjentryEditor.Views"
mc:Ignorable="d"
Title="{Binding Title}" Height="550" Width="800">
Title="{Binding Title}" Height="570" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
Expand Down
11 changes: 9 additions & 2 deletions OpenKh.Tools.ObjentryEditor/Views/ObjentryView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,16 @@

<TextBlock Text="Unknown56" Margin="{StaticResource LabelMargin}"/>
<TextBox Text="{Binding SelectedItem.Unknown56, UpdateSourceTrigger=PropertyChanged}"/>

<TextBlock Text="Command Menu" Margin="{StaticResource LabelMargin}"/>
<TextBox Text="{Binding SelectedItem.CommandMenuOptions, UpdateSourceTrigger=PropertyChanged}"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" ItemsSource="{Binding CommandMenuOptions}" SelectedValue="{Binding SelectedItem.CommandMenuOption}" DisplayMemberPath="Name" SelectedValuePath="Value" Margin="{StaticResource LabelMargin}"/>
<TextBox Grid.Column="1" IsEnabled="False" Text="{Binding Path=SelectedItem.CommandMenuOption, Converter={StaticResource EnumDescConverter}, UpdateSourceTrigger=PropertyChanged}" TextWrapping="WrapWithOverflow"/>
</Grid>

<TextBlock Text="Spawn Object 1" Margin="{StaticResource LabelMargin}"/>
<ComboBox ItemsSource="{Binding UnfilteredItems}" SelectedValue="{Binding SelectedItem.SpawnObject1, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Expand Down

0 comments on commit 2e062db

Please sign in to comment.