-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Black Ops 1 Support, Static Models for Ghosts, AW, and MWR
- Loading branch information
Scobalula
committed
Nov 18, 2018
1 parent
fd67938
commit cb421ae
Showing
11 changed files
with
995 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
namespace Husky | ||
{ | ||
/// <summary> | ||
/// A class to hold IWMap Info and Logic | ||
/// </summary> | ||
public class IWMap | ||
{ | ||
/// <summary> | ||
/// A class to hold a .MAP Entity | ||
/// </summary> | ||
public class Entity | ||
{ | ||
/// <summary> | ||
/// Entity KVPs | ||
/// </summary> | ||
public Dictionary<string, string> KeyValuePairs = new Dictionary<string, string>(); | ||
|
||
/// <summary> | ||
/// Initializes an entity with a Classname | ||
/// </summary> | ||
public Entity(string className) | ||
{ | ||
KeyValuePairs["classname"] = className; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a Misc/Prop Model | ||
/// </summary> | ||
/// <param name="modelName">Name of the Model Asset</param> | ||
/// <param name="origin">XYZ Origin</param> | ||
/// <param name="angles">XYZ Angles</param> | ||
/// <param name="modelScale">Model Scale</param> | ||
/// <returns>Resulting entity</returns> | ||
public static Entity CreateMiscModel(string modelName, Vector3 origin, Vector3 angles, float modelScale) | ||
{ | ||
// Create new entity | ||
var result = new Entity("misc_model"); | ||
// Add properties | ||
result.KeyValuePairs["model"] = modelName; | ||
result.KeyValuePairs["origin"] = String.Format("{0} {1} {2}", origin.X, origin.Y, origin.Z); | ||
result.KeyValuePairs["angles"] = String.Format("{1} {2} {0}", angles.X, angles.Y, angles.Z); | ||
result.KeyValuePairs["modelscale"] = modelScale.ToString(); | ||
// Ship her back | ||
return result; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Map entities | ||
/// </summary> | ||
public List<Entity> Entities = new List<Entity>(); | ||
|
||
/// <summary> | ||
/// Initializes an IW Map with a Basic Worldspawn Entity | ||
/// </summary> | ||
public IWMap() | ||
{ | ||
// Create Worldspawn Entity | ||
var worldspawn = new Entity("worldspawn"); | ||
// Set properties | ||
worldspawn.KeyValuePairs["fsi"] = "default"; | ||
worldspawn.KeyValuePairs["gravity"] = "800"; | ||
worldspawn.KeyValuePairs["lodbias"] = "default"; | ||
worldspawn.KeyValuePairs["lutmaterial"] = "luts_t7_default"; | ||
worldspawn.KeyValuePairs["numOmniShadowSlices"] = "24"; | ||
worldspawn.KeyValuePairs["numSpotShadowSlices"] = "64"; | ||
worldspawn.KeyValuePairs["sky_intensity_factor0"] = "1"; | ||
worldspawn.KeyValuePairs["sky_intensity_factor1"] = "1"; | ||
worldspawn.KeyValuePairs["state_alias_1"] = "State 1"; | ||
worldspawn.KeyValuePairs["state_alias_2"] = "State 2"; | ||
worldspawn.KeyValuePairs["state_alias_3"] = "State 3"; | ||
worldspawn.KeyValuePairs["state_alias_4"] = "State 4"; | ||
// Add it | ||
Entities.Add(worldspawn); | ||
} | ||
|
||
/// <summary> | ||
/// Dumps whatever we can to a .MAP file | ||
/// </summary> | ||
/// <param name="fileName">File Name</param> | ||
public void DumpToMap(string fileName) | ||
{ | ||
// Create output stream | ||
using (var writer = new StreamWriter(fileName)) | ||
{ | ||
// Write basic header | ||
writer.WriteLine("iwmap 4"); | ||
writer.WriteLine("\"script_startingnumber\" 0"); | ||
writer.WriteLine("\"000_Global\" flags active"); | ||
writer.WriteLine("\"The Map\" flags expanded "); | ||
|
||
// Write entitys | ||
for (int i = 0; i < Entities.Count; i++) | ||
{ | ||
// Write Index Comment | ||
writer.WriteLine("// entity {0}", i); | ||
// Write initial bracket | ||
writer.WriteLine("{"); | ||
// Write KVPs | ||
foreach (var kvp in Entities[i].KeyValuePairs) | ||
writer.WriteLine("\"{0}\" \"{1}\"", kvp.Key, kvp.Value); | ||
// Write end bvracket | ||
writer.WriteLine("}"); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.