Skip to content

Commit

Permalink
various fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
php42 committed Aug 9, 2020
1 parent 6d1cafd commit bbc0517
Show file tree
Hide file tree
Showing 13 changed files with 1,114 additions and 440 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ if(BUILD_DIFFGEN)
add_subdirectory(diffgen)
endif()

if(MSVC)
if(MSVC AND BUILD_DIFFGEN)
# Suppress open-vcdiff compiler warnings and set config definitions
set_property(DIRECTORY deps/open-vcdiff APPEND PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS _WIN32_WINNT=0x0601 WINVER=0x0601 NTDDI_VERSION=0x06010000 UNICODE _UNICODE)
if(BUILD_DIFFGEN)
Expand Down
2 changes: 1 addition & 1 deletion common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

#pragma once

#define VERSION_STRING "v1.3.1"
#define VERSION_STRING "v1.3.2"
20 changes: 20 additions & 0 deletions diffgen/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ int wmain(int argc, wchar_t *argv[])
return EXIT_ERROR;
}

// check for jank installs
for(int i = 1; i < 7; ++i)
{
auto arc_name = (L"gn_dat" + std::to_wstring(i));
auto arc_path = Path(input_path) / L"dat" / (arc_name + L".arc");
auto folder_path = Path(input_path) / L"dat" / arc_name;

if(std::filesystem::exists(arc_path) && std::filesystem::is_regular_file(arc_path)) // this is what we expect
continue;

if(std::filesystem::exists(folder_path) && std::filesystem::is_directory(folder_path)) // if this exists and the above doesn't, it's borked
{
std::wcerr << L"You seem to have an old pirated copy of the game with broken dat files." << std::endl;
std::wcerr << L"gn_dat1-6.arc must exist in in your dat folder (and NOT as folders)." << std::endl;
std::wcerr << L"Please get a better copy of the game." << std::endl;
std::wcerr << L"Operation aborted." << std::endl;
return EXIT_ERROR;
}
}

auto begin = std::chrono::high_resolution_clock::now();
if(opts.count("extract"))
success = extract(input_path, output_path, threads);
Expand Down
3 changes: 3 additions & 0 deletions editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ set(editor_sources
"PatchDialog.cs"
"PatchDialog.Designer.cs"
"PatchDialog.resx"
"SkillEditDialog.cs"
"SkillEditDialog.Designer.cs"
"SkillEditDialog.resx"
"EventWindow.cs"
"Bitmap.cs"
"MapPanel.cs"
Expand Down
206 changes: 36 additions & 170 deletions editor/MainWindow.Designer.cs

Large diffs are not rendered by default.

27 changes: 15 additions & 12 deletions editor/MainWindow.resx
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@
<metadata name="label23.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label21.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label22.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label79.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand All @@ -186,12 +180,6 @@
<metadata name="label74.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label20.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label19.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label18.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down Expand Up @@ -441,6 +429,15 @@
<metadata name="label106.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label108.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label107.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label106.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label58.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down Expand Up @@ -468,6 +465,12 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>451, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>451, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>451, 17</value>
</metadata>
<data name="MapWeightSpinCtrl.ToolTip" xml:space="preserve">
<value>Encounter rate relative to other puppets in the same encounter type.
Percentage calculated by weight divided by sum of weights (within the same encounter type).
Expand Down
164 changes: 61 additions & 103 deletions editor/PuppetWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,6 @@ private void LoadPuppets()
Item4CB.Items.Add(new Tuple<string, uint>(name, id));
}

// Skills
BaseSkillLvlCB.SelectedIndex = -1;
BaseSkillCB.SelectedIndex = -1;
BaseSkillCB.Items.Clear();
BaseSkillCB.DisplayMember = "Item1";
BaseSkillCB.ValueMember = "Item2";
StyleSkillLvlCB.SelectedIndex = -1;
StyleSkillCB.SelectedIndex = -1;
StyleSkillCB.Items.Clear();
StyleSkillCB.DisplayMember = "Item1";
StyleSkillCB.ValueMember = "Item2";
BaseSkillCB.Items.Add(new Tuple<string, uint>("None", 0));
StyleSkillCB.Items.Add(new Tuple<string, uint>("None", 0));
foreach(var it in skill_names_)
{
var id = it.Key;
var name = it.Value;
BaseSkillCB.Items.Add(new Tuple<string, uint>(name, id));
StyleSkillCB.Items.Add(new Tuple<string, uint>(name, id));
}

// Skillcards
SkillCardLB.Items.Clear();
SkillCardLB.DisplayMember = "Item1";
Expand Down Expand Up @@ -133,10 +112,6 @@ private void PuppetLB_SelectedIndexChanged(object sender, EventArgs e)
PuppetAbility2CB.SelectedIndex = -1;
PuppetElement1CB.SelectedIndex = -1;
PuppetElement2CB.SelectedIndex = -1;
BaseSkillLvlCB.SelectedIndex = -1;
BaseSkillCB.SelectedIndex = -1;
StyleSkillLvlCB.SelectedIndex = -1;
StyleSkillCB.SelectedIndex = -1;
for(var i = 0; i < 128; ++i)
SkillCardLB.SetItemChecked(i, false);
StatHPSC.Value = 0;
Expand Down Expand Up @@ -182,9 +157,6 @@ private void PuppetStyleCB_SelectedIndexChanged(object sender, EventArgs e)
var puppet = puppets_[puppetid];
var style = puppet.styles[index];

StyleSkillLvlCB.SelectedIndex = -1;
StyleSkillCB.SelectedIndex = -1;

PuppetStyleTypeCB.SelectedIndex = PuppetStyleTypeCB.FindStringExact(style.type);
PuppetElement1CB.SelectedIndex = PuppetElement1CB.FindStringExact(style.element1);
PuppetElement2CB.SelectedIndex = PuppetElement2CB.FindStringExact(style.element2);
Expand Down Expand Up @@ -233,81 +205,6 @@ private void PuppetdexIndexSC_ValueChanged(object sender, EventArgs e)
puppets_[id].puppetdex_index = (uint)PuppetdexIndexSC.Value;
}

private void BaseSkillLvlCB_SelectedIndexChanged(object sender, EventArgs e)
{
var index = BaseSkillLvlCB.SelectedIndex;
var puppetindex = PuppetLB.SelectedIndex;
if(index < 0 || puppetindex < 0)
return;

var id = ((Tuple<string, uint>)PuppetLB.SelectedItem).Item2;
var puppet = puppets_[id];
var skillid = puppet.base_skills[index];

if(skill_names_.ContainsKey(skillid))
BaseSkillCB.SelectedIndex = BaseSkillCB.FindStringExact(skill_names_[skillid]);
else
BaseSkillCB.SelectedIndex = 0;
}

private void StyleSkillLvlCB_SelectedIndexChanged(object sender, EventArgs e)
{
var index = StyleSkillLvlCB.SelectedIndex;
var puppetindex = PuppetLB.SelectedIndex;
var styleindex = PuppetStyleCB.SelectedIndex;
if(index < 0 || puppetindex < 0 || styleindex < 0)
return;

var id = ((Tuple<string, uint>)PuppetLB.SelectedItem).Item2;
var style = puppets_[id].styles[styleindex];
uint skillid;

if(index < 11)
skillid = style.style_skills[index];
else if(index < 19)
skillid = style.lvl70_skills[index - 11];
else
skillid = style.lvl100_skill;

if(skill_names_.ContainsKey(skillid))
StyleSkillCB.SelectedIndex = StyleSkillCB.FindStringExact(skill_names_[skillid]);
else
StyleSkillCB.SelectedIndex = 0;
}

private void BaseSkillCB_SelectedIndexChanged(object sender, EventArgs e)
{
var index = BaseSkillCB.SelectedIndex;
var lvlindex = BaseSkillLvlCB.SelectedIndex;
var puppetindex = PuppetLB.SelectedIndex;
if(index < 0 || puppetindex < 0 || lvlindex < 0)
return;

var id = ((Tuple<string, uint>)PuppetLB.SelectedItem).Item2;
var skillid = ((Tuple<string, uint>)BaseSkillCB.SelectedItem).Item2;
puppets_[id].base_skills[lvlindex] = skillid;
}

private void StyleSkillCB_SelectedIndexChanged(object sender, EventArgs e)
{
var index = StyleSkillCB.SelectedIndex;
var lvlindex = StyleSkillLvlCB.SelectedIndex;
var puppetindex = PuppetLB.SelectedIndex;
var styleindex = PuppetStyleCB.SelectedIndex;
if(index < 0 || puppetindex < 0 || styleindex < 0 || lvlindex < 0)
return;

var id = ((Tuple<string, uint>)PuppetLB.SelectedItem).Item2;
var skillid = ((Tuple<string, uint>)StyleSkillCB.SelectedItem).Item2;

if(lvlindex < 11)
puppets_[id].styles[styleindex].style_skills[lvlindex] = skillid;
else if(lvlindex < 19)
puppets_[id].styles[styleindex].lvl70_skills[lvlindex - 11] = skillid;
else
puppets_[id].styles[styleindex].lvl100_skill = skillid;
}

private void PuppetElement1CB_SelectedIndexChanged(object sender, EventArgs e)
{
var index = PuppetElement1CB.SelectedIndex;
Expand Down Expand Up @@ -394,6 +291,9 @@ private void StatSC_ValueChanged(object sender, EventArgs e)

var id = ((Tuple<string, uint>)PuppetLB.SelectedItem).Item2;
puppets_[id].styles[styleindex].base_stats[statindex] = (uint)val;

var bst = StatHPSC.Value + StatFASC.Value + StatFDSC.Value + StatSASC.Value + StatSDSC.Value + StatSPDSC.Value;
PuppetBSTLabel.Text = "BST: " + bst.ToString();
}

private void ItemCB_SelectedIndexChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -538,10 +438,13 @@ private void DumpPuppets()
typestring += ")";

output += style.type + " " + puppet_names_[id] + " " + typestring + " " + costs[puppet.cost] + " Cost\r\n";
uint bst = 0;
for(uint j = 0; j < 6; ++j)
{
output += stats[j] + style.base_stats[j].ToString() + "\r\n";
bst += style.base_stats[j];
}
output += "\tBST: " + bst.ToString() + "\r\n";

output += "\r\n\tAbilities:\r\n";
foreach(var ability in style.abilities)
Expand Down Expand Up @@ -632,5 +535,60 @@ private void ExportPuppetButton_Click(object sender, EventArgs e)
ErrMsg("Error exporting puppet stats: " + ex.Message);
}
}

private void PuppetMovesetBT_Click(object sender, EventArgs e)
{
var puppetindex = PuppetLB.SelectedIndex;
var styleindex = PuppetStyleCB.SelectedIndex;

if(puppetindex < 0)
{
ErrMsg("No puppet selected.");
return;
}

var base_skills = new List<uint>();
var style_skills = new List<uint>();

var id = ((Tuple<string, uint>)PuppetLB.SelectedItem).Item2;
var puppet = puppets_[id];

base_skills.AddRange(puppet.base_skills);

if(styleindex >= 0)
{
style_skills.AddRange(puppet.styles[styleindex].style_skills);
style_skills.AddRange(puppet.styles[styleindex].lvl70_skills);
style_skills.Add(puppet.styles[styleindex].lvl100_skill);
}
else
{
for(var i = 0; i < 20; ++i)
style_skills.Add(0);
}

using(var dlg = new SkillEditDialog(skill_names_, style_skills, base_skills))
{
dlg.ShowDialog(this);

for(var i = 0; i < dlg.BaseSkills.Count; ++i)
{
puppets_[id].base_skills[i] = dlg.BaseSkills[i];
}

if(styleindex >= 0)
{
for(var i = 0; i < dlg.StyleSkills.Count; ++i)
{
if(i < 11)
puppets_[id].styles[styleindex].style_skills[i] = dlg.StyleSkills[i];
else if(i < 19)
puppets_[id].styles[styleindex].lvl70_skills[i - 11] = dlg.StyleSkills[i];
else
puppets_[id].styles[styleindex].lvl100_skill = dlg.StyleSkills[i];
}
}
}
}
}
}
Loading

0 comments on commit bbc0517

Please sign in to comment.