Skip to content

Commit

Permalink
HaCreator for 64 bit clients
Browse files Browse the repository at this point in the history
I made an option to switch between 32 bit client and 64 bit client, maybe its not optimal way and could just make the thing detect if it contains a Data folder, but anyways here is my take feel free to make it better, there is couple of issues like map simulator and some tile display issue not working, but i think the rest should be fine
  • Loading branch information
SoulGirlJP committed Mar 16, 2022
1 parent f55a794 commit e704a3f
Show file tree
Hide file tree
Showing 44 changed files with 3,498 additions and 3,946 deletions.
36 changes: 2 additions & 34 deletions HaCreator/Collections/BoardItemsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
using HaCreator.MapEditor;
using HaCreator.MapEditor.Info;
using MapleLib.WzLib.WzStructure;
using HaSharedLibrary.Render.DX;
using System.Runtime.CompilerServices;

namespace HaCreator.Collections
{
Expand All @@ -41,34 +39,8 @@ public class BoardItemsManager
public MapleList<BoardItem> MiscItems = new MapleList<BoardItem>(ItemTypes.Misc, true);
public MapleList<MapleDot> SpecialDots = new MapleList<MapleDot>(ItemTypes.Misc, true);

public MapleList<MirrorFieldData> MirrorFieldDatas = new MapleList<MirrorFieldData>(ItemTypes.MirrorFieldData, true);
/// <summary>
/// Checks if a BaseDXDrawableItem is within any of the MirrorFieldData in the field.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="filter_objectForOverlay"></param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public MirrorFieldData CheckObjectWithinMirrorFieldDataBoundary(int x, int y, MirrorFieldDataType filter_objectForOverlay)
{
if (MirrorFieldDatas.Count == 0)
return null;

Microsoft.Xna.Framework.Point pos = new Microsoft.Xna.Framework.Point(x, y - 60);
MirrorFieldData reflectionBoundaryWithin = MirrorFieldDatas.FirstOrDefault(
mirror =>
{
return mirror.Rectangle.Contains(pos) && mirror.MirrorFieldDataType == filter_objectForOverlay;
});

if (reflectionBoundaryWithin != null)
return reflectionBoundaryWithin;
return null;
}

/// <summary>
/// Map info
/// Map info/
/// </summary>
public MapInfo MapInfo { get { return board.MapInfo; } }

Expand All @@ -81,11 +53,7 @@ public MirrorFieldData CheckObjectWithinMirrorFieldDataBoundary(int x, int y, Mi

public BoardItemsManager(Board board)
{
AllItemLists = new IMapleList[]
{
BackBackgrounds, TileObjs, Mobs, NPCs, Reactors, Portals, FrontBackgrounds, FootholdLines, RopeLines, FHAnchors,
RopeAnchors, Chairs, CharacterToolTips, ToolTips, ToolTipDots, MiscItems, SpecialDots, MirrorFieldDatas
};
AllItemLists = new IMapleList[] { BackBackgrounds, TileObjs, Mobs, NPCs, Reactors, Portals, FrontBackgrounds, FootholdLines, RopeLines, FHAnchors, RopeAnchors, Chairs, CharacterToolTips, ToolTips, ToolTipDots, MiscItems, SpecialDots };
this.board = board;
Items = new BoardItemsCollection(this, true);
Lines = new MapleLinesCollection(this, false);
Expand Down
5 changes: 5 additions & 0 deletions HaCreator/Collections/IMapleList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

using MapleLib.WzLib.WzStructure.Data;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HaCreator.Collections
{
Expand Down
32 changes: 23 additions & 9 deletions HaCreator/CustomControls/MapBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
using HaCreator.GUI;

namespace HaCreator.CustomControls
{
public partial class MapBrowser : UserControl
{
private bool loadMapAvailable = false;
private bool load = false;
private readonly List<string> maps = new List<string>();

public MapBrowser()
Expand All @@ -33,7 +34,7 @@ public bool LoadAvailable
{
get
{
return loadMapAvailable;
return load;
}
}

Expand Down Expand Up @@ -67,8 +68,17 @@ public void InitializeMaps(bool special)
List<string> mapLogins = new List<string>();
for (int i = 0; i < 20; i++) // Not exceeding 20 logins yet.
{

string imageName = "MapLogin" + (i == 0 ? "" : i.ToString()) + ".img";
WzObject mapLogin = Program.WzManager["ui"][imageName];
WzObject mapLogin;
if (Initialization.isClient64())
{
mapLogin = Program.WzManager["ui_000"][imageName];
}
else
{
mapLogin = Program.WzManager["ui"][imageName];
}
if (mapLogin == null)
break;
mapLogins.Add(imageName);
Expand Down Expand Up @@ -187,20 +197,24 @@ private void mapNamesBox_SelectedIndexChanged(object sender, EventArgs e)
linkLabel.Visible = false;
mapNotExist.Visible = false;
minimapBox.Image = new Bitmap(1, 1);
loadMapAvailable = mapNamesBox.SelectedItem != null;
load = mapNamesBox.SelectedItem != null;
}
else
{
string mapid = (selectedName).Substring(0, 9);
string mapcat = "Map" + mapid.Substring(0, 1);
string mapcat;
if (Initialization.isClient64())
mapcat = mapid.Substring(0, 1);
else
mapcat = "Map" + mapid.Substring(0, 1);

WzImage mapImage = Program.WzManager.FindMapImage(mapid, mapcat);
if (mapImage == null)
{
linkLabel.Visible = false;
mapNotExist.Visible = true;
minimapBox.Image = (Image)new Bitmap(1, 1);
loadMapAvailable = false;
load = false;
}
else
{
Expand All @@ -211,13 +225,13 @@ private void mapNamesBox_SelectedIndexChanged(object sender, EventArgs e)
linkLabel.Visible = true;
mapNotExist.Visible = false;
minimapBox.Image = new Bitmap(1, 1);
loadMapAvailable = false;
load = false;
}
else
{
linkLabel.Visible = false;
mapNotExist.Visible = false;
loadMapAvailable = true;
load = true;
WzCanvasProperty minimap = (WzCanvasProperty)mapImage.GetFromPath("miniMap/canvas");
if (minimap != null)
{
Expand All @@ -227,7 +241,7 @@ private void mapNamesBox_SelectedIndexChanged(object sender, EventArgs e)
{
minimapBox.Image = new Bitmap(1, 1);
}
loadMapAvailable = true;
load = true;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions HaCreator/CustomControls/ThumbnailFlowLayoutPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public ImageViewer Add(Bitmap bitmap, String name, bool Text)

imageViewer.Image = fallbackBmp; // fallback in case its null
imageViewer.Width = fallbackBmp.Width + 8;
imageViewer.Height = fallbackBmp.Height + 8 + ((Text) ? 16 : 0);
imageViewer.Height = fallbackBmp.Height + 8 + ((Text) ? 12 : 0);
}
else
{
imageViewer.Image = new Bitmap(bitmap); // Copying the bitmap for thread safety
imageViewer.Width = bitmap.Width + 8;
imageViewer.Height = bitmap.Height + 8 + ((Text) ? 16 : 0);
imageViewer.Height = bitmap.Height + 8 + ((Text) ? 12 : 0);
}
imageViewer.IsText = Text;
imageViewer.Name = name;
Expand Down
64 changes: 29 additions & 35 deletions HaCreator/GUI/HaRibbon.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,43 +76,37 @@
<RibbonGroup x:Name="MapObj" Header="Map Objects">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="70" />
<ColumnDefinition Width="70" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="110" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="0">
<CheckBox x:Name="tilesCheck" Content="Tiles" Grid.Row="0" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="objsCheck" Content="Objects" Grid.Row="1" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="npcsCheck" Content="NPCs" Grid.Row="2" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="mobsCheck" Content="Mobs" Grid.Row="3" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
</StackPanel>

<StackPanel Grid.Column="1">
<CheckBox x:Name="reactCheck" Content="Reactors" Grid.Row="0" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="portalCheck" Content="Portals" Grid.Row="1" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="fhCheck" Content="Footholds" Grid.Row="2" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="ropeCheck" Content="Ropes" Grid.Row="3" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
</StackPanel>

<StackPanel Grid.Column="2" >
<CheckBox x:Name="chairCheck" Content="Chairs" Grid.Row="0" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="tooltipCheck" Content="Tooltips" Grid.Row="1" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="bgCheck" Content="Backgrounds" Grid.Row="2" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="miscCheck" Content="Other" Grid.Row="3" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
</StackPanel>

<StackPanel Grid.Column="3">
<CheckBox x:Name="mirrorFieldDataCheck" Content="Mirror field" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
</StackPanel>

<StackPanel Grid.Column="4">
<cc:CheckboxButton x:Name="allFullCheck" Content="All Objects" Grid.Row="0" IsThreeState="True" IsChecked="True" Clicked="allFullCheck_Click" Focusable="False"/>
<cc:CheckboxButton x:Name="allHalfCheck" Content="All Objects" Grid.Row="1" IsThreeState="True" IsChecked="{x:Null}" Clicked="allHalfCheck_Click" Focusable="False"/>
<cc:CheckboxButton x:Name="allClearCheck" Content="All Objects" Grid.Row="2" IsThreeState="True" IsChecked="False" Clicked="allClearCheck_Click" Focusable="False"/>
</StackPanel>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="20" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>

<CheckBox x:Name="tilesCheck" Content="Tiles" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="objsCheck" Content="Objects" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="npcsCheck" Content="NPCs" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>

<CheckBox x:Name="mobsCheck" Content="Mobs" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="reactCheck" Content="Reactors" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="portalCheck" Content="Portals" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>

<CheckBox x:Name="fhCheck" Content="Footholds" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="ropeCheck" Content="Ropes" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="chairCheck" Content="Chairs" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>

<CheckBox x:Name="tooltipCheck" Content="Tooltips" Grid.Column="3" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="bgCheck" Content="Backgrounds" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>
<CheckBox x:Name="miscCheck" Content="Other" Grid.Column="3" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" Command="ns:HaRibbon.ViewBoxes" Focusable="False"/>

<cc:CheckboxButton x:Name="allFullCheck" Content="All Objects" Grid.Column="4" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" IsChecked="True" Clicked="allFullCheck_Click" Focusable="False"/>
<cc:CheckboxButton x:Name="allHalfCheck" Content="All Objects" Grid.Column="4" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" IsChecked="{x:Null}" Clicked="allHalfCheck_Click" Focusable="False"/>
<cc:CheckboxButton x:Name="allClearCheck" Content="All Objects" Grid.Column="4" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" IsChecked="False" Clicked="allClearCheck_Click" Focusable="False"/>
</Grid>
</RibbonGroup>

Expand Down
9 changes: 4 additions & 5 deletions HaCreator/GUI/HaRibbon.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void Exit_Executed(object sender, ExecutedRoutedEventArgs e)
private void ViewBoxes_Executed(object sender, ExecutedRoutedEventArgs e)
{
if (ViewToggled != null)
ViewToggled.Invoke(tilesCheck.IsChecked, objsCheck.IsChecked, npcsCheck.IsChecked, mobsCheck.IsChecked, reactCheck.IsChecked, portalCheck.IsChecked, fhCheck.IsChecked, ropeCheck.IsChecked, chairCheck.IsChecked, tooltipCheck.IsChecked, bgCheck.IsChecked, miscCheck.IsChecked, mirrorFieldDataCheck.IsChecked);
ViewToggled.Invoke(tilesCheck.IsChecked, objsCheck.IsChecked, npcsCheck.IsChecked, mobsCheck.IsChecked, reactCheck.IsChecked, portalCheck.IsChecked, fhCheck.IsChecked, ropeCheck.IsChecked, chairCheck.IsChecked, tooltipCheck.IsChecked, bgCheck.IsChecked, miscCheck.IsChecked);
}

private void Minimap_Executed(object sender, ExecutedRoutedEventArgs e)
Expand Down Expand Up @@ -494,7 +494,7 @@ public void SetLayer(Layer layer)
#endregion

public delegate void EmptyEvent();
public delegate void ViewToggleEvent(bool? tiles, bool? objs, bool? npcs, bool? mobs, bool? reactors, bool? portals, bool? footholds, bool? ropes, bool? chairs, bool? tooltips, bool? backgrounds, bool? misc, bool? mirrorField);
public delegate void ViewToggleEvent(bool? tiles, bool? objs, bool? npcs, bool? mobs, bool? reactors, bool? portals, bool? footholds, bool? ropes, bool? chairs, bool? tooltips, bool? backgrounds, bool? misc);
public delegate void ToggleEvent(bool pressed);
public delegate void LayerViewChangedEvent(int layer, int platform, bool allLayers, bool allPlats);

Expand Down Expand Up @@ -524,7 +524,7 @@ public void SetLayer(Layer layer)
public event EmptyEvent ShowMapPropertiesClicked;
public event EventHandler<System.Windows.Forms.KeyEventArgs> RibbonKeyDown;

public void SetVisibilityCheckboxes(bool? tiles, bool? objs, bool? npcs, bool? mobs, bool? reactors, bool? portals, bool? footholds, bool? ropes, bool? chairs, bool? tooltips, bool? backgrounds, bool? misc, bool? mirrorField)
public void SetVisibilityCheckboxes(bool? tiles, bool? objs, bool? npcs, bool? mobs, bool? reactors, bool? portals, bool? footholds, bool? ropes, bool? chairs, bool? tooltips, bool? backgrounds, bool? misc)
{
tilesCheck.IsChecked = tiles;
objsCheck.IsChecked = objs;
Expand All @@ -538,7 +538,6 @@ public void SetVisibilityCheckboxes(bool? tiles, bool? objs, bool? npcs, bool? m
tooltipCheck.IsChecked = tooltips;
bgCheck.IsChecked = backgrounds;
miscCheck.IsChecked = misc;
mirrorFieldDataCheck.IsChecked = mirrorField;
}

public void SetEnabled(bool enabled)
Expand Down Expand Up @@ -567,7 +566,7 @@ public void SetHasMinimap(bool hasMinimap)

private void ChangeAllCheckboxes(bool? state)
{
foreach (CheckBox cb in new CheckBox[] { tilesCheck, objsCheck, npcsCheck, mobsCheck, reactCheck, portalCheck, fhCheck, ropeCheck, chairCheck, tooltipCheck, bgCheck, miscCheck, mirrorFieldDataCheck })
foreach (CheckBox cb in new CheckBox[] { tilesCheck, objsCheck, npcsCheck, mobsCheck, reactCheck, portalCheck, fhCheck, ropeCheck, chairCheck, tooltipCheck, bgCheck, miscCheck })
{
cb.IsChecked = state;
}
Expand Down
Loading

0 comments on commit e704a3f

Please sign in to comment.