Skip to content

Conversation

CnCRAZER
Copy link
Contributor

Introduces new DataWriteMode of SPAWN_SPAWNMAP
This new DataWriteModewill keep backwards compatability by not interfering with other DataWriteMode functionality.

Allows dropdowns in GameLobbyDropDown.cs to have:

  • SpawnIniOption to write 'xyz' key to spawn.ini
  • SpawnIniValues supporting multiple values / indexes to write 'xyz123' value to the key 'xyz' to spawn.ini
  • ItemLabels to exist for explanation in clients UI(crates being enabled / disabled / extra crates / extreme crates)
  • Items to have ini files declared which append spawnmap.ini according to the index selected.

Example below is now possible:

[cmbCratesModifier]
ToolTip=Adjust the number of crates.
OptionName=Crate Settings
ItemLabels=Disabled,Enabled - Default,Enabled - Extra,Enabled - Extreme
Items=INI\Game Options\Crates\Disabled.ini,INI\Game Options\Crates\Enabled.ini,INI\Game Options\Crates\Increased.ini,INI\Game Options\Crates\Super Increased.ini
DefaultIndex=0
SpawnIniOption=Crates
SpawnIniValues=false,true,true,true
DataWriteMode=SPAWN_SPAWNMAP

CnCRAZER added 15 commits July 22, 2025 19:08
Previously, dropdown selections could only append to spawnmap.ini and if a spawnini setting was to be written, it was whatever value there was set.

Now, there is support for this:
[Example]
OptionName=Crates                        ; ← this is what your dropdown will display
SpawnIniOption=Crates                    ; ← the key under [Settings] in spawnmap.ini
SpawnIniOptionValues=False,True,True,True
ItemLabels=Disabled,Enabled - Default,Enabled - Extra,Enabled - Extreme
DefaultIndex=0
DataWriteMode=STRING
Items=INI\Game Options\Crates\Disabled.ini,INI\Game Options\Crates\Enabled.ini,INI\Game Options\Crates\Increased.ini,INI\Game Options\Crates\Super Increased.ini

Picking Disabled, or the first selection, will write Crates=False to spawn.ini while also appending spawnmap.ini respective to the ini file in the ItemsLabel list.

Picking Enabled - Default, or any of the others, will write Crates=True to spawn.ini while also appending spawnmap.ini respective to the ini file in the ItemsLabel list.
@CnCRAZER CnCRAZER requested a review from Starkku July 27, 2025 08:48
Copy link

github-actions bot commented Jul 27, 2025

Nightly build for this pull request:

  • artifacts.zip
    This comment is automatic and is meant to allow guests to get latest automatic builds without registering. It is updated on every successful build.

@CnCRAZER CnCRAZER requested a review from SadPencil July 27, 2025 09:06
@CnCRAZER CnCRAZER requested a review from ZivDero August 4, 2025 22:41
public void ApplySpawnIniCode(IniFile spawnIni)
{
if (dataWriteMode == DropDownDataWriteMode.MAPCODE || SelectedIndex < 0 || SelectedIndex >= Items.Count)
if (SelectedIndex < 0 || SelectedIndex >= Items.Count)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure to remove this check, instead of checking dataWriteMode == DropDownDataWriteMode.MAPCODE || dataWriteMode == DropDownDataWriteMode.SPAWN_SPAWNMAP? I haven't looked into details so no matter either choice is selected, could you provide some explanations on this line?

@@ -124,12 +138,20 @@ public void ApplySpawnIniCode(IniFile spawnIni)
case DropDownDataWriteMode.INDEX:
spawnIni.SetIntValue("Settings", spawnIniOption, SelectedIndex);
break;
default:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your PR seems to break the default case. Move your SPAWN_SPAWNMAP right after the INDEX case and before the default case. Keep the default and STRING cases untouched

string customIniPath;
customIniPath = Items[SelectedIndex].Tag.ToString();
if ((dataWriteMode != DropDownDataWriteMode.MAPCODE &&
dataWriteMode != DropDownDataWriteMode.SPAWN_SPAWNMAP) ||
Copy link
Member

@SadPencil SadPencil Aug 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if adding dataWriteMode != DropDownDataWriteMode.SPAWN_SPAWNMAP) works as intended.

Needs an answer to the following question: on the condition dataWriteMode == DropDownDataWriteMode.SPAWN_SPAWNMAP, should MapCodeHelper.ApplyMapCode be called or not?

        /// The dropdown value is filename of a mapcode INI file, which will be applied to the map. 
        /// Nothing is written to spawn INI.
        /// </summary>
        MAPCODE,

        /// <summary>
        /// The dropdown will support spawninioption values and spawninivalues being set based on their index.
        /// Also writes ini file content to spawnmap.ini based on the index selected.
        /// </summary>
        SPAWN_SPAWNMAP,

From the XML comment here it seems to indicate only in the MAPCODE case we need to call MapCodeHelper.ApplyMapCode(). Not very sure on this one.

@CnCRAZER
Copy link
Contributor Author

CnCRAZER commented Sep 6, 2025

Honestly I've kind of forgotten about this. Closing for now.

@CnCRAZER CnCRAZER closed this Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants