Skip to content

Commit

Permalink
Added v 0.7.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jones-HM committed Feb 5, 2023
1 parent 0432bdb commit c325a30
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 22 deletions.
46 changes: 44 additions & 2 deletions IGIEditor/IGIEditorUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 110 additions & 18 deletions IGIEditor/IGIEditorUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,25 @@ public IGIEditorUI()
}
else
{
QMemory.StartLevel(gameLevel, true);
QUtils.gameFound = true;
Thread.Sleep(3000);

if (autoResetCb.Checked)
{
QUtils.RestoreLevel(gameLevel);
QUtils.ResetScriptFile(gameLevel);
}
// Game is not running here | SECTION.
QUtils.gameFound = false;
}

var inputQscPath = QUtils.cfgQscPath + gameLevel + "\\" + QUtils.objectsQsc;
QUtils.graphsPath = QUtils.cfgGamePath + gameLevel + "\\" + "graphs";

if (!File.Exists(QUtils.objectsQsc) && File.Exists(inputQscPath))
// Copy file data if game found.
if (QUtils.gameFound)
{
QUtils.FileIOCopy(inputQscPath, QUtils.objectsQsc);
string inputQscPath = QUtils.cfgQscPath + gameLevel + "\\" + QUtils.objectsQsc;
QUtils.graphsPath = QUtils.cfgGamePath + gameLevel + "\\" + "graphs";

if (!File.Exists(QUtils.objectsQsc) && File.Exists(inputQscPath))
{
QUtils.FileIOCopy(inputQscPath, QUtils.objectsQsc);
}
else if (!File.Exists(inputQscPath))
{
throw new Exception("File 'objects.qsc' is missing from path '" + QUtils.cfgQscPath + gameLevel + "\\'");
}
}
else if (!File.Exists(inputQscPath)) throw new Exception("File 'objects.qsc' is missing from path '" + QUtils.cfgQscPath + gameLevel + "\\'");

if (!File.Exists(QUtils.weaponConfigQSC) && File.Exists(QUtils.weaponsCfgQscPath))
{
Expand Down Expand Up @@ -474,10 +474,13 @@ private void LevelRunnerTimer(object sender, EventArgs e)
{
int currLevel = QMemory.GetRunningLevel();
if (currLevel != gameLevel)
{
refreshGame_Click(sender, e);

}
else
{
InitEditorPaths(currLevel);
}
}

//Start Game if not found.
Expand All @@ -486,7 +489,6 @@ private void LevelRunnerTimer(object sender, EventArgs e)
SetStatusText("Game not running... starting");
startGameBtn_Click(sender, e);
}

}

private void InternalsAttachedTimer(object sender, EventArgs e)
Expand Down Expand Up @@ -2483,7 +2485,7 @@ private void disableWarningsCb_CheckedChanged(object sender, EventArgs e)
{
QMemory.DisableGameWarnings();
}
QUtils.gameDisableWarns = ((CheckBox)sender).Checked;
QUtils.gameDisableWarns = disableWarningsCb.Checked;
}

private void addNodesBtn_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -4576,6 +4578,96 @@ private void quitToolStripMenuItem_Click(object sender, EventArgs e)
Application.Exit();
}


private void saveWeaponProps_Click(object sender, EventArgs e)
{
string weaponNameTxtValue = weaponNameTxt.Text;
string weaponDescriptionTxtValue = weaponDescriptionTxt.Text;
string weaponSightTypeDDValue = weaponSightTypeDD.Text;
string weaponDisplayTypeDDValue = weaponDisplayTypeDD.Text;
string weaponSfx1DDValue = weaponSfx1DD.Text;
string weaponSfx2DDValue = weaponSfx2DD.Text;
string weaponDamageTxtValue = weaponDamageTxt.Text;
string weaponPowerTxtValue = weaponPowerTxt.Text;
string weaponRangeTxtValue = weaponRangeTxt.Text;
string weaponBulletsTxtValue = weaponBulletsTxt.Text;
string weaponRoundPerMinuteTxtValue = weaponRoundPerMinuteTxt.Text;
string weaponRoundPerClipTxtValue = weaponRoundPerClipTxt.Text;

Dictionary<string, string> weaponProperties = new Dictionary<string, string>
{
{ "weaponNameTxt", weaponNameTxtValue },
{ "weaponDescriptionTxt", weaponDescriptionTxtValue },
{ "weaponSightTypeDD", weaponSightTypeDDValue },
{ "weaponDisplayTypeDD", weaponDisplayTypeDDValue },
{ "weaponSfx1DD", weaponSfx1DDValue },
{ "weaponSfx2DD", weaponSfx2DDValue },
{ "weaponDamageTxt", weaponDamageTxtValue },
{ "weaponPowerTxt", weaponPowerTxtValue },
{ "weaponRangeTxt", weaponRangeTxtValue },
{ "weaponBulletsTxt", weaponBulletsTxtValue },
{ "weaponRoundPerMinuteTxt", weaponRoundPerMinuteTxtValue },
{ "weaponRoundPerClipTxt", weaponRoundPerClipTxtValue }
};

string weaponPropertiesJson = JsonConvert.SerializeObject(weaponProperties, Formatting.Indented);
var dialogMsgResult = DialogMsgBox.ShowBox("Save Weapon File", "Enter file name", MsgBoxButtons.YesNo, showInput: true, inputHidden: false);
if (dialogMsgResult == DialogResult.Yes)
{
string fileName = DialogMsgBox.GetInputBoxData();
if (!string.IsNullOrEmpty(fileName))
{
string directoryPath = QUtils.qWeaponsModPath;
if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
}
string filePath = Path.Combine(directoryPath, fileName + ".json");
QUtils.SaveFile(filePath, weaponPropertiesJson);
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, "Weapon properties saved to file: " + fileName);
}
}
}

private void loadWeaponProps_Click(object sender, EventArgs e)
{
try
{
// Get the file weapon file name.
var fopenIO = QUtils.ShowOpenFileDlg("Select Weapon File", ".json", "JSON File|*.json|Text file|*.txt", true, QUtils.qWeaponsModPath);
string fileName = fopenIO.FileName;

if (File.Exists(fileName))
{
string weaponPropertiesJson = QUtils.LoadFile(fileName);
Dictionary<string, string> weaponProperties = JsonConvert.DeserializeObject<Dictionary<string, string>>(weaponPropertiesJson);

weaponNameTxt.Text = weaponProperties["weaponNameTxt"];
weaponDescriptionTxt.Text = weaponProperties["weaponDescriptionTxt"];
weaponSightTypeDD.Text = weaponProperties["weaponSightTypeDD"];
weaponDisplayTypeDD.Text = weaponProperties["weaponDisplayTypeDD"];
weaponSfx1DD.Text = weaponProperties["weaponSfx1DD"];
weaponSfx2DD.Text = weaponProperties["weaponSfx2DD"];
weaponDamageTxt.Text = weaponProperties["weaponDamageTxt"];
weaponPowerTxt.Text = weaponProperties["weaponPowerTxt"];
weaponRangeTxt.Text = weaponProperties["weaponRangeTxt"];
weaponBulletsTxt.Text = weaponProperties["weaponBulletsTxt"];
weaponRoundPerMinuteTxt.Text = weaponProperties["weaponRoundPerMinuteTxt"];
weaponRoundPerClipTxt.Text = weaponProperties["weaponRoundPerClipTxt"];

QUtils.AddLog(MethodBase.GetCurrentMethod().Name, "Weapon properties loaded from file: " + fileName);
}
else
{
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, "Weapon properties file not found: " + fileName);
}
}
catch (Exception ex)
{
QUtils.ShowLogException(MethodBase.GetCurrentMethod().Name, ex);
}
}

private void graphsMarkCb_CheckedChanged(object sender, EventArgs e)
{
if (((CheckBox)sender).Checked) graphsAllCb.Checked = false;
Expand Down
6 changes: 4 additions & 2 deletions IGIEditor/QUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ internal class WeaponGroup
internal static int ekkTeamTaskId = -1;
internal static int aiScriptId = 0;
internal static int gGameLevel = 1;
internal static int GAME_MAX_LEVEL = 3;
internal static int GAME_MAX_LEVEL = 14;
internal static int currGameLevel = 1;
internal static int updateTimeInterval = 10;
internal static int gameFPS = 30;
Expand Down Expand Up @@ -146,7 +146,7 @@ internal class WeaponGroup

#region App Version
internal static string versionFileName = "VERSION";
internal static string appEditorSubVersion = "0.7.2.0";
internal static string appEditorSubVersion = "0.7.3.0";
internal static float viewPortDelta = 10000.0f;
#endregion

Expand Down Expand Up @@ -175,6 +175,7 @@ internal class WeaponGroup
internal static string qGraphsPath;
internal static string qWeaponsPath;
internal static string qWeaponsGroupPath;
internal static string qWeaponsModPath;
internal static string qQVMPath;
internal static string qQSCPath;
internal static string cfgWeaponsPath;
Expand Down Expand Up @@ -467,6 +468,7 @@ internal static bool InitEditorAppData()
qGraphsPath = igiEditorQEdPath + @"\QGraphs";
qWeaponsPath = igiEditorQEdPath + @"\QWeapons";
qWeaponsGroupPath = qWeaponsPath + "\\" + "Group";
qWeaponsModPath = qWeaponsPath + "\\" + "Mod";
weaponsGamePath = gameAbsPath + @"\weapons";
humanplayerGamePath = gameAbsPath + @"\humanplayer";
menusystemGamePath = gameAbsPath + @"\menusystem";
Expand Down

0 comments on commit c325a30

Please sign in to comment.