Skip to content

Commit

Permalink
Prep for 2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkite committed Oct 11, 2013
1 parent 7999168 commit b1e7005
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 42 deletions.
79 changes: 51 additions & 28 deletions Terrafirma/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class NPC
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : Window, IDisposable
{
const int MapVersion = 71;
const int MaxTile = 250;
Expand All @@ -456,9 +456,9 @@ public partial class MainWindow : Window
Int32 groundLevel, rockLevel;
string[] worlds;
string currentWorld;
Int32 worldID=0;
string[] players;
string player;
Int32 worldID = 0;
string[] players;
string player;
List<Chest> chests = new List<Chest>();
List<Sign> signs = new List<Sign>();
List<NPC> npcs = new List<NPC>();
Expand Down Expand Up @@ -579,10 +579,10 @@ public MainWindow()
int id = Convert.ToInt32(wallList[i].Attributes["num"].Value);
wallInfo[id].name = wallList[i].Attributes["name"].Value;
wallInfo[id].color = parseColor(wallList[i].Attributes["color"].Value);
if (wallList[i].Attributes["blend"] != null)
wallInfo[id].blend = Convert.ToInt16(wallList[i].Attributes["blend"].Value);
else
wallInfo[id].blend = (Int16)id;
if (wallList[i].Attributes["blend"] != null)
wallInfo[id].blend = Convert.ToInt16(wallList[i].Attributes["blend"].Value);
else
wallInfo[id].blend = (Int16)id;
}
XmlNodeList globalList = xml.GetElementsByTagName("global");
for (int i = 0; i < globalList.Count; i++)
Expand Down Expand Up @@ -698,7 +698,7 @@ private void addVariants(ArrayList quickItems, TileInfo info)
if (v.name != info.name)
{
v.isHilighting = true;
quickItems.Add(new HTile(v.name,v));
quickItems.Add(new HTile(v.name, v));
}
addVariants(quickItems, v);
}
Expand Down Expand Up @@ -1756,13 +1756,13 @@ private void SelectPlayer(object sender, ExecutedRoutedEventArgs e)
RenderMap();
}));

};
new Thread(loader).Start();
}
private void SelectPlayer_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = !busy;
}
};
new Thread(loader).Start();
}
private void SelectPlayer_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = !busy;
}
private void FogOfWar_Toggle(object sender, ExecutedRoutedEventArgs e)
{
if (FogOfWar.IsChecked)
Expand Down Expand Up @@ -1842,6 +1842,7 @@ private void ConnectToServer_Executed(object sender, ExecutedRoutedEventArgs e)
}

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_disposed = false;
System.Net.IPAddress[] ips;
try
{
Expand Down Expand Up @@ -2066,7 +2067,7 @@ private void HandleMessage(int start, int len)
killedBoss3 = (flags & 8) == 8;
hardMode = (flags & 16) == 16;
killedClown = (flags & 32) == 32;
killedPlantBoss = (flags & 128) == 128;
killedPlantBoss = (flags & 128) == 128;
killedMechBoss1 = (flags2 & 1) == 1;
killedMechBoss2 = (flags2 & 2) == 2;
killedMechBoss3 = (flags2 & 4) == 4;
Expand Down Expand Up @@ -2270,14 +2271,14 @@ private void HandleMessage(int start, int len)
int slot = BitConverter.ToInt16(messages, payload); payload += 2;
float posx = BitConverter.ToSingle(messages, payload); payload += 4;
float posy = BitConverter.ToSingle(messages, payload); payload += 4;
payload += 9; //skip velocity and target
byte flags=messages[payload++];
payload+=4; //skip life
//skip any applicable AI
if ((flags&32)==32) payload+=4;
if ((flags&16)==16) payload+=4;
if ((flags&8)==8) payload+=4;
if ((flags&4)==4) payload+=4;
payload += 9; //skip velocity and target
byte flags = messages[payload++];
payload += 4; //skip life
//skip any applicable AI
if ((flags & 32) == 32) payload += 4;
if ((flags & 16) == 16) payload += 4;
if ((flags & 8) == 8) payload += 4;
if ((flags & 4) == 4) payload += 4;
int id = BitConverter.ToInt16(messages, payload);
bool found = false;
for (int i = 0; i < npcs.Count; i++)
Expand Down Expand Up @@ -2382,7 +2383,7 @@ private void HandleMessage(int start, int len)
Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
{
serverText.Text = "";
render.SetWorld(tilesWide, tilesHigh, groundLevel, rockLevel, styles, treeX, treeStyle, caveBackX,caveBackStyle,jungleBackStyle,hellBackStyle, npcs);
render.SetWorld(tilesWide, tilesHigh, groundLevel, rockLevel, styles, treeX, treeStyle, caveBackX, caveBackStyle, jungleBackStyle, hellBackStyle, npcs);
loaded = true;
curX = spawnX;
curY = spawnY;
Expand Down Expand Up @@ -3011,15 +3012,15 @@ private void QuickHilite_SelectionChanged(object sender, SelectionChangedEventAr
{
foreach (object obj in QuickHilite.Items)
{
HTile info=(HTile)obj;
HTile info = (HTile)obj;
info.Info.isHilighting = false;
}
HTile tile = (HTile)QuickHilite.SelectedItem;
tile.Info.isHilighting = true;
if (loaded)
RenderMap();
}

private void Lighting_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (Lighting.SelectedIndex)
Expand All @@ -3044,5 +3045,27 @@ private void Lighting_SelectionChanged(object sender, SelectionChangedEventArgs
if (loaded)
RenderMap();
}
public void Dispose()
{
Dispose(true);

// Use SupressFinalize in case a subclass
// of this type implements a finalizer.
GC.SuppressFinalize(this);
}
private bool _disposed;
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
if (socket != null)
socket.Dispose();
}
socket = null;
_disposed = true;
}
}
}
}
2 changes: 1 addition & 1 deletion Terrafirma/Terrafirma.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -27,7 +28,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down
3 changes: 1 addition & 2 deletions makeinstaller.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"c:\Program Files (x86)\Windows Installer XML v3.5\bin\candle.exe" MyInstallDirDlg.wxs
"c:\Program Files (x86)\Windows Installer XML v3.5\bin\candle.exe" MyWixUI_InstallDir.wxs
"c:\Program Files (x86)\Windows Installer XML v3.5\bin\candle.exe" terrafirma.wxs
"c:\Program Files (x86)\Windows Installer XML v3.5\bin\light.exe" -ext WixUIExtension -o terrafirma.msi terrafirma.wixobj MyInstallDirDlg.wixobj MyWixUI_InstallDir.wixobj
"c:\Program Files (x86)\Windows Installer XML v3.5\bin\light.exe" -ext WixUIExtension -o terrafirma.msi terrafirma.wixobj MyWixUI_InstallDir.wixobj
@pause
18 changes: 7 additions & 11 deletions terrafirma.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!-- Increase product version each release.. and that's the only change -->
<?define ProductVersion="1.9.8"?>
<?define ProductVersion="2.0.0.0"?>
<?define ProductUpgradeCode="77851f13-31d3-473a-8654-5b6325fc53ab"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Terrafirma" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Sean Kasun" UpgradeCode="$(var.ProductUpgradeCode)">
Expand Down Expand Up @@ -31,15 +31,12 @@

<DirectoryRef Id="INSTALLDIR">
<Component Id="terrafirma.exe" Guid="9fcfa381-6ed4-4a7e-aebb-a27e10b0a022">
<File Id="terrafirma.exe" Source="Terrafirma\bin\Release\Terrafirma.exe" KeyPath="yes" Checksum="yes" />
</Component>
</DirectoryRef>

<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="1ca398d1-d9bc-42a1-8d2a-50931f6441ca">
<Shortcut Id="ApplicaitonStartMenuShortcut" Name="Terrafirma" Description="Terraria Map Viewer" Target="[#terrafirma.exe]" WorkingDirectory="INSTALLDIR" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Sean Kasun\Terrafirma" Name="installed" Type="integer" Value="1" KeyPath="yes" />
<File Id="terrafirma.exe" Source="Terrafirma\bin\Release\Terrafirma.exe" KeyPath="yes" Checksum="yes">
<Shortcut Id="ApplicationShortcut" Directory="ApplicationProgramsFolder" Advertise="yes" Name="Terrafirma" WorkingDirectory="INSTALLDIR" Icon="icon.exe">
<Icon Id="icon.exe" SourceFile="Terrafirma\bin\Release\Terrafirma.exe" />
</Shortcut>
</File>
<RemoveFolder Id="DeleteShortcutFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
</Component>
</DirectoryRef>

Expand All @@ -49,7 +46,6 @@

<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="terrafirma.exe" />
<ComponentRef Id="ApplicationShortcut" />
</Feature>

<Property Id="WIXUI_INSTALLDIR">INSTALLDIR</Property>
Expand Down

0 comments on commit b1e7005

Please sign in to comment.