/// <summary> /// Disperses all settings from the rim string passed. /// </summary> /// <param name="rim">Rim string to be dispersed.</param> /// <param name="brand">Brand of the rim.</param> /// <param name="style">Style of the rim brand.</param> /// <param name="size">Size of the rim brand.</param> /// <param name="max">Max outer size of the rim brand.</param> private void DisperseRimSettings(string rim) { bool potentialspi = false; if (rim.EndsWith("_SPI")) { potentialspi = true; rim = rim.Substring(0, rim.Length - 4); } this._rim_brand = FormatX.GetString(rim, "{X}_STYLE##_##_##"); if (!FormatX.GetByte(rim, this._rim_brand + "_STYLE{X}_##_##", out byte thisstyle)) { thisstyle = 1; } if (!FormatX.GetByte(rim, this._rim_brand + "_STYLE##_{X}_##", out byte thissize)) { thissize = 18; } if (!FormatX.GetByte(rim, this._rim_brand + "_STYLE##_##_{X}", out byte thismax)) { thismax = 24; } this._rim_style = thisstyle; this._rim_size = thissize; this._rim_outer_max = thismax; this._is_spinning_rim = potentialspi ? eBoolean.True : eBoolean.False; }
public unsafe void Assemble(byte *byteptr_t) { FormatX.GetByte(this._collection_name, "STAGE_{X}", out byte stage); *byteptr_t = stage; *(byteptr_t + 0x01) = this.NumberOfSponsorsToChoose; *(short *)(byteptr_t + 0x02) = this.OutrunCashValue; *(short *)(byteptr_t + 0x04) = this.Unknown0x04; *(short *)(byteptr_t + 0x06) = this.Unknown0x06; *(uint *)(byteptr_t + 0x08) = Bin.SmartHash(this._stage_sponsor1); *(uint *)(byteptr_t + 0x0C) = Bin.SmartHash(this._stage_sponsor2); *(uint *)(byteptr_t + 0x10) = Bin.SmartHash(this._stage_sponsor3); *(uint *)(byteptr_t + 0x14) = Bin.SmartHash(this._stage_sponsor4); *(uint *)(byteptr_t + 0x18) = Bin.SmartHash(this._stage_sponsor5); *(short *)(byteptr_t + 0x1C) = this.AttribSponsor1; *(short *)(byteptr_t + 0x1E) = this.AttribSponsor2; *(short *)(byteptr_t + 0x20) = this.AttribSponsor3; *(short *)(byteptr_t + 0x22) = this.AttribSponsor4; *(short *)(byteptr_t + 0x24) = this.AttribSponsor5; *(short *)(byteptr_t + 0x26) = this.Unknown0x26; *(uint *)(byteptr_t + 0x28) = Bin.SmartHash(this._last_stage_event); *(byteptr_t + 0x2C) = this.Unknown0x2C; *(byteptr_t + 0x2D) = this.Unknown0x2D; *(byteptr_t + 0x2E) = this.Unknown0x2E; *(byteptr_t + 0x2F) = this.Unknown0x2F; *(byteptr_t + 0x30) = this.MaxCircuitsShownOnMap; *(byteptr_t + 0x31) = this.MaxDragsShownOnMap; *(byteptr_t + 0x32) = this.MaxStreetXShownOnMap; *(byteptr_t + 0x33) = this.MaxDriftsShownOnMap; *(byteptr_t + 0x34) = this.MaxSprintsShownOnMap; *(byteptr_t + 0x35) = this.Unknown0x35; *(byteptr_t + 0x36) = this.Unknown0x36; *(byteptr_t + 0x37) = this.Unknown0x37; *(byteptr_t + 0x38) = this.Unknown0x38; *(byteptr_t + 0x39) = this.Unknown0x39; *(byteptr_t + 0x3A) = this.Unknown0x3A; *(byteptr_t + 0x3B) = this.Unknown0x3B; *(byteptr_t + 0x3C) = this.Unknown0x3C; *(byteptr_t + 0x3D) = this.Unknown0x3D; *(byteptr_t + 0x3E) = this.Unknown0x3E; *(byteptr_t + 0x3F) = this.Unknown0x3F; *(byteptr_t + 0x40) = this.MaxOutrunEvents; *(byteptr_t + 0x41) = this.Unknown0x41; *(byteptr_t + 0x42) = this.Unknown0x42; *(byteptr_t + 0x43) = this.Unknown0x43; *(float *)(byteptr_t + 0x44) = this.Unknown0x44; *(float *)(byteptr_t + 0x48) = this.Unknown0x48; *(float *)(byteptr_t + 0x4C) = this.Unknown0x4C; }
/// <summary> /// Sets first valid rim outer max radius based on current brand and style. /// </summary> private void SetValidRimSize() { string rim = $"{this._rim_brand}_STYLE{this._rim_style:00}"; foreach (var str in Map.RimBrands) { if (str.StartsWith(rim)) { if (FormatX.GetByte(str, rim + "_{X}_##", out byte radius)) { this._rim_size = radius; } } } }
/// <summary> /// Sets first valid rim outer max radius based on current brand, style and size. /// </summary> private void SetValidRimOuterMax() { string rim = $"{this._rim_brand}_STYLE{this._rim_style:00}_{this._rim_size}_"; foreach (var str in Map.RimBrands) { if (str.StartsWith(rim)) { if (FormatX.GetByte(str, rim + "{X}", out byte radius)) { this._rim_outer_max = radius; return; } } } }
/// <summary> /// Checks if a value passed is a valid rim size in terms of current /// brand and style. /// </summary> /// <param name="value">Rim size value to check.</param> /// <returns>True if value passed is valid, false otherwise.</returns> private bool IsValidRimSize(byte value) { string rim = $"{this._rim_brand}_STYLE{this._rim_style:00}_"; foreach (var str in Map.RimBrands) { if (str.StartsWith(rim)) { if (!FormatX.GetByte(str, rim + "{X}_##", out byte radius)) { continue; } if (value == radius) { return(true); } } } return(false); }