public override void LoadData(BZNReader reader) { IBZNToken tok; if (reader.N64 || reader.Version > 1030) { tok = reader.ReadToken(); if (!tok.Validate("dropMat", BinaryFieldType.DATA_MAT3DOLD)) throw new Exception("Failed to parse dropMat/MAT3DOLD"); dropMat = tok.GetMatrix(); } if (reader.N64) { tok = reader.ReadToken(); UInt16 dropClassItemID = tok.GetUInt16(); if (!BZNFile.BZn64IdMap.ContainsKey(dropClassItemID)) throw new InvalidCastException(string.Format("Cannot convert n64 dropClass enumeration 0x(0:X2} to string dropClass", dropClassItemID)); dropClass = BZNFile.BZn64IdMap[dropClassItemID]; } else if (reader.Version > 1030) { tok = reader.ReadToken(); if (!tok.Validate("dropClass", BinaryFieldType.DATA_ID)) throw new Exception("Failed to parse dropClass/ID"); dropClass = tok.GetString(); } base.LoadData(reader); }
public override void LoadData(BZNReader reader) { IBZNToken tok = reader.ReadToken(); if (!tok.Validate("undefptr", BinaryFieldType.DATA_PTR)) throw new Exception("Failed to parse undefptr/PTR"); undefptr = tok.GetUInt32H(); base.LoadData(reader); }
public override void LoadData(BZNReader reader) { IBZNToken tok; if(reader.N64 || reader.Version > 1022) { tok = reader.ReadToken(); if (!tok.Validate("abandoned", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse abandoned/LONG"); abandoned = tok.GetUInt32(); } else { tok = reader.ReadToken();//setAltitude [1] = //1 tok = reader.ReadToken();//accelDragStop [1] = //3.5 tok = reader.ReadToken();//accelDragFull [1] = //1 tok = reader.ReadToken();//alphaTrack [1] = //20 tok = reader.ReadToken();//alphaDamp [1] = //5 tok = reader.ReadToken();//pitchPitch [1] = //0.25 tok = reader.ReadToken();//pitchThrust [1] = //0.1 tok = reader.ReadToken();//rollStrafe [1] = //0.1 tok = reader.ReadToken();//rollSteer [1] = //0.1 tok = reader.ReadToken();//velocForward [1] = //20 tok = reader.ReadToken();//velocReverse [1] = //15 tok = reader.ReadToken();//velocStrafe [1] = //20 tok = reader.ReadToken();//accelThrust [1] = //20 tok = reader.ReadToken();//accelBrake [1] = //75 tok = reader.ReadToken();//omegaSpin [1] = //4 tok = reader.ReadToken();//omegaTurn [1] = //1.5 tok = reader.ReadToken();//alphaSteer [1] = //5 tok = reader.ReadToken();//accelJump [1] = //20 tok = reader.ReadToken();//thrustRatio [1] = //1 tok = reader.ReadToken();//throttle [1] = //0 tok = reader.ReadToken();//airBorne [1] = //5.96046e-008 } base.LoadData(reader); }
public override void LoadData(BZNReader reader) { IBZNToken tok; tok = reader.ReadToken(); if (!tok.Validate("nextScream", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse nextScream/FLOAT"); nextScream = tok.GetSingle(); base.LoadData(reader); }
public override void LoadData(BZNReader reader) { if (!reader.N64) { if (reader.Version > 1034) { IBZNToken tok = reader.ReadToken(); if (!tok.Validate("scrapHeld", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse scrapHeld/LONG"); scrapHeld = tok.GetUInt32(); } } base.LoadData(reader); }
public override void LoadData(BZNReader reader) { IBZNToken tok; tok = reader.ReadToken(); if (!tok.Validate("soldierCount", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse soldierCount/LONG"); soldierCount = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("state", BinaryFieldType.DATA_VOID)) throw new Exception("Failed to parse state/VOID"); state = tok.GetRaw(0, 4); base.LoadData(reader); }
public virtual void LoadData(BZNReader reader) { IBZNToken tok; tok = reader.ReadToken(); if (!tok.Validate("illumination", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse illumination/FLOAT"); illumination = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("pos", BinaryFieldType.DATA_VEC3D)) throw new Exception("Failed to parse pos/VEC3D"); pos = tok.GetVector3D(); if (reader.BinaryMode) { tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse euler's FLOAT"); float euler_mass = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse euler's FLOAT"); float euler_mass_inv = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse euler's FLOAT"); float euler_v_mag = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse euler's FLOAT"); float euler_v_mag_inv = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse euler's FLOAT"); float euler_I = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse euler's FLOAT"); float euler_k_i = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_VEC3D)) throw new Exception("Failed to parse euler's VEC3D"); Vector3D euler_v = tok.GetVector3D(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_VEC3D)) throw new Exception("Failed to parse euler's VEC3D"); Vector3D euler_omega = tok.GetVector3D(); tok = reader.ReadToken(); if (!tok.Validate(null, BinaryFieldType.DATA_VEC3D)) throw new Exception("Failed to parse euler's VEC3D"); Vector3D euler_Accel = tok.GetVector3D(); euler = new Euler() { mass = euler_mass, mass_inv = euler_mass_inv, v_mag = euler_v_mag, v_mag_inv = euler_v_mag_inv, I = euler_I, k_i = euler_k_i, v = euler_v, omega = euler_omega, Accel = euler_Accel }; } else { tok = reader.ReadToken(); if (!tok.Validate("euler", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse euler"); euler = tok.GetEuler(); } tok = reader.ReadToken(); if (!tok.Validate("seqNo", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse seqNo/SHORT"); //seqNo = tok.GetUInt16(); seqNo = tok.GetUInt32(); if (reader.N64) { tok = reader.ReadToken(); if (!tok.Validate("name", BinaryFieldType.DATA_CHAR)) throw new Exception("Failed to parse name/CHAR"); name = tok.GetString(); } else { if (reader.Version > 1030) { tok = reader.ReadToken(); if (!tok.Validate("name", BinaryFieldType.DATA_CHAR)) throw new Exception("Failed to parse name/CHAR"); name = tok.GetString(); } } tok = reader.ReadToken(); if (!tok.Validate("isObjective", BinaryFieldType.DATA_BOOL)) throw new Exception("Failed to parse isObjective/BOOL"); isObjective = tok.GetBoolean(); tok = reader.ReadToken(); if (!tok.Validate("isSelected", BinaryFieldType.DATA_BOOL)) throw new Exception("Failed to parse isSelected/BOOL"); isSelected = tok.GetBoolean(); tok = reader.ReadToken(); if (!tok.Validate("isVisible", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse isVisible/LONG"); isVisible = tok.GetUInt32H(); tok = reader.ReadToken(); if (!tok.Validate("seen", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse seen/LONG"); seen = tok.GetUInt32(); if (reader.N64) { } else { //[10:03:38 PM] Kenneth Miller: I think I may have figured out what that stuff is, maybe //[10:03:50 PM] Kenneth Miller: They're timestamps //[10:04:04 PM] Kenneth Miller: playerShot, playerCollide, friendShot, friendCollide, enemyShot, groundCollide //[10:04:13 PM] Kenneth Miller: the default value is -HUGE_NUMBER (-1e30) //[10:04:26 PM] Kenneth Miller: And due to the nature of the game, groundCollide is the most likely to get set first //[10:05:02 PM] Kenneth Miller: Old versions of the mission format used to contain those values but later versions only include them in the savegame //[10:05:05 PM] Kenneth Miller: (not the mission) //[10:05:31 PM] Kenneth Miller: (version 1033 was where they were removed from the mission) if (reader.Version < 1033) { tok = reader.ReadToken(); // float (-HUGE_NUMBER) tok = reader.ReadToken(); // float (-HUGE_NUMBER) tok = reader.ReadToken(); // float (-HUGE_NUMBER) tok = reader.ReadToken(); // float (-HUGE_NUMBER) tok = reader.ReadToken(); // float (-HUGE_NUMBER) tok = reader.ReadToken(); // float } } tok = reader.ReadToken(); if (!tok.Validate("healthRatio", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse healthRatio/FLOAT"); healthRatio = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("curHealth", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse curHealth/LONG"); curHealth = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("maxHealth", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse maxHealth/LONG"); maxHealth = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("ammoRatio", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse ammoRatio/FLOAT"); ammoRatio = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("curAmmo", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse curAmmo/LONG"); curAmmo = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("maxAmmo", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse maxAmmo/LONG"); maxAmmo = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("priority", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse priority/LONG"); priority = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("what", BinaryFieldType.DATA_VOID)) throw new Exception("Failed to parse what/VOID"); what = tok.GetUInt32H(); tok = reader.ReadToken(); if (!tok.Validate("who", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse who/LONG"); who = tok.GetInt32(); tok = reader.ReadToken(); if (!tok.Validate("where", BinaryFieldType.DATA_PTR)) throw new Exception("Failed to parse where/PTR"); where = tok.GetUInt32H(); tok = reader.ReadToken(); if (!tok.Validate("param", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse param/LONG"); param = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("aiProcess", BinaryFieldType.DATA_BOOL)) throw new Exception("Failed to parse aiProcess/BOOL"); aiProcess = tok.GetBoolean(); tok = reader.ReadToken(); if (!tok.Validate("isCargo", BinaryFieldType.DATA_BOOL)) throw new Exception("Failed to parse isCargo/BOOL"); isCargo = tok.GetBoolean(); tok = reader.ReadToken(); if (!tok.Validate("independence", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse independence/LONG"); independence = tok.GetUInt32(); if (reader.N64) { tok = reader.ReadToken(); UInt16 curPilotID = tok.GetUInt16(); if (!BZNFile.BZn64IdMap.ContainsKey(curPilotID)) throw new InvalidCastException(string.Format("Cannot convert n64 curPilotID enumeration 0x(0:X2} to string curPilotID", curPilotID)); curPilot = BZNFile.BZn64IdMap[curPilotID]; } else { if (reader.Version > 1022) { tok = reader.ReadToken(); if (!tok.Validate("curPilot", BinaryFieldType.DATA_ID)) throw new Exception("Failed to parse curPilot/ID"); curPilot = tok.GetString(); } else { tok = reader.ReadToken(); if (!tok.Validate("hasPilot", BinaryFieldType.DATA_BOOL)) throw new Exception("Failed to parse hasPilot/BOOL"); bool hasPilot = tok.GetBoolean(); curPilot = hasPilot ? isUser ? PrjID[0] + "suser" : PrjID[0] + "spilo" : string.Empty; } } if (reader.N64) { tok = reader.ReadToken(); if (!tok.Validate("perceivedTeam", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse perceivedTeam/LONG"); perceivedTeam = tok.GetInt32(); } else { if (reader.Version > 1030) { tok = reader.ReadToken(); if (!tok.Validate("perceivedTeam", BinaryFieldType.DATA_LONG)) throw new Exception("Failed to parse perceivedTeam/LONG"); perceivedTeam = tok.GetInt32(); } else { perceivedTeam = -1; } } }
public override void LoadData(BZNReader reader) { base.LoadData(reader); }
public override void LoadData(BZNReader reader) { IBZNToken tok; tok = reader.ReadToken(); if (!tok.Validate("undeffloat", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse undeffloat/FLOAT"); undeffloat1 = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("undeffloat", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse undeffloat/FLOAT"); undeffloat2 = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("undeffloat", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse undeffloat/FLOAT"); undeffloat3 = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("undeffloat", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse undeffloat/FLOAT"); undeffloat4 = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("undefraw", BinaryFieldType.DATA_VOID)) throw new Exception("Failed to parse undefraw/VOID"); undefraw = tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("undeffloat", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse undeffloat/FLOAT"); undeffloat5 = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("undefbool", BinaryFieldType.DATA_BOOL)) throw new Exception("Failed to parse undefbool/BOOL"); undefbool = tok.GetBoolean(); base.LoadData(reader); }
public override void LoadData(BZNReader reader) { IBZNToken tok; tok = reader.ReadToken(); if (!tok.Validate("timeDeploy", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse timeDeploy/FLOAT"); timeDeploy = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("timeUndeploy", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse timeUndeploy/FLOAT"); timeUndeploy = tok.GetSingle(); tok = reader.ReadToken(); if (!tok.Validate("undefptr", BinaryFieldType.DATA_PTR)) throw new Exception("Failed to parse undefptr/PTR"); undefptr2 = tok.GetUInt32H(); tok = reader.ReadToken(); if (!tok.Validate("state", BinaryFieldType.DATA_VOID)) throw new Exception("Failed to parse state/VOID"); state = tok.GetRaw(0, 4); tok = reader.ReadToken(); if (!tok.Validate("delayTimer", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse delayTimer/FLOAT"); delayTimer = tok.GetSingle();//tok.GetUInt32(); tok = reader.ReadToken(); if (!tok.Validate("nextRepair", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse nextRepair/FLOAT"); nextRepair = tok.GetSingle(); if (reader.N64) { tok = reader.ReadToken(); UInt16 buildClassItemID = tok.GetUInt16(); if (!BZNFile.BZn64IdMap.ContainsKey(buildClassItemID)) throw new InvalidCastException(string.Format("Cannot convert n64 buildClass enumeration 0x(0:X2} to string buildClass", buildClassItemID)); buildClass = BZNFile.BZn64IdMap[buildClassItemID]; } else { tok = reader.ReadToken(); if (!tok.Validate("buildClass", BinaryFieldType.DATA_ID)) throw new Exception("Failed to parse buildClass/ID"); buildClass = tok.GetString(); } tok = reader.ReadToken(); if (!tok.Validate("buildDoneTime", BinaryFieldType.DATA_FLOAT)) throw new Exception("Failed to parse buildDoneTime/FLOAT"); buildDoneTime = tok.GetSingle(); if (reader.N64 || reader.Version > 1022) { } else { tok = reader.ReadToken();//buildCost [1] = //-842150451 tok = reader.ReadToken();//buildUpdateTime [1] = //-4.31602e+008 tok = reader.ReadToken();//buildDt [1] = //-4.31602e+008 tok = reader.ReadToken();//buildDc [1] = //-842150451 } base.LoadData(reader); }