• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Adding controls to the configure controls screen.

I dunno why I didn't think of this earlier, it's _so_ simple. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/oops3.gif" style="vertical-align:middle" emoid=":eek:ops2" border="0" alt="oops3.gif" />

When I added the console key, I wondered what the bool at the end of the line meant.

Turns out it means, "is this control reconfigureable."

But the big hurdle is, you have to assign a control _group_ to your control to get it to show up in options.

To get a key to show up there, you need to do three things.
First, when adding it, assign a group and set the bool to true.
instead of
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->CI_CreateAndSetControls( "", "NK_LogsToggle", CI_GetKeyCode("KEY_L"), 0, false );<!--c2--></div><!--ec2-->

you write
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->CI_CreateAndSetControls( "PrimaryLand", "NK_LogsToggle", CI_GetKeyCode("KEY_L"), 0, true );<!--c2--></div><!--ec2-->
I picked primaryland arbitrarily as the key should be for all modes.

Then, you need to copy it to all other groups where it's useable (or at least so it'll show up in those other groups; I don't know if you need to do this for it just to be _usuable_ when in those other _modes_)
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    MapControlToGroup("NK_LogsToggle", "FightModeControls");

    MapControlToGroup("NK_LogsToggle", "BattleInterfaceControls");

    MapControlToGroup("NK_LogsToggle", "Sailing1Pers");

    MapControlToGroup("NK_LogsToggle", "Sailing3Pers");

    MapControlToGroup("NK_LogsToggle", "WorldMapControls");<!--c2--></div><!--ec2-->

Don't include the lines it's not useful for; if this were AlwaysRun, no need to copy it to Sailing*Pers, BIControls, or Worldmap.

Lastly, you need to add an entry to ResourceinitextsEnglishControlsNames.txt like so:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->NK_LogsToggle

{

Toggle extra log info



}<!--c2--></div><!--ec2-->

That's it; your control now shows up in the control options page!
 
That's great! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
...but what's it mean, Cat? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
I'm not Cat, but I'll answer. It means you'd be able to change the `key-mapping` of things like reinit ('I') through the game's options interface, rather than manually editing the code. Good stuff, if you ask me. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
Aye, thankee thar, matey! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/cool.gif" style="vertical-align:middle" emoid="8)" border="0" alt="cool.gif" />
 
Even though I won't be needing to use it. I say Good Job. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
<b>Fred Bob: </b><img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" /> What he (iamthejarha) said... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" />
 
very cool!

<!--`QuoteBegin-NathanKell`+--><div class='quotetop'>QUOTE(NathanKell)</div><div class='quotemain'><!--QuoteEBegin-->I picked primaryland arbitrarily as the key should be for all modes.[/quote]

it would be nice to have them in a 'general' group though. i bet it's not hard <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" />
 
Outstanding, mates! That's it; I'm dusting off me C skills and diving into this monster to see what havoc I can wreak! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/william.gif" style="vertical-align:middle" emoid=":will" border="0" alt="william.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
We oughta make a new group on the options screen for worldmap controls so you can change them too; a General group as well would be good too.
And for you, oh Kieron, I'm sure it wouldn't. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
But there's a reason I do all my interfacing via dialog. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

Mad_Jack: The more the merrier, I look forward to whate'er you create. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
`o-k`, to add two new groups to the options screen:

first we need to add two new buttons.
open resourceiniinterfacesoption_screen.ini and find:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->item    = TEXTBUTTON,B_SAILING1ST

item    = TEXTBUTTON,B_PRIMARY_LAND

item    = TEXTBUTTON,B_SAILING3RD

item    = TEXTBUTTON,B_FIGHTMODE<!--c2--></div><!--ec2-->

replace with:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->item    = TEXTBUTTON,B_SAILING1ST

item    = TEXTBUTTON,B_PRIMARY_LAND

item    = TEXTBUTTON,B_SAILING3RD

item    = TEXTBUTTON,B_FIGHTMODE

item    = TEXTBUTTON,B_GENERALCONTROLS

item    = TEXTBUTTON,B_WORLDMAPCONTROLS<!--c2--></div><!--ec2-->

then we need to give the details of our new buttons, so find:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[B_SAILING1ST]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_FIGHTMODE

command  = downstep,select:B_PRIMARY_LAND

command  = click

command  = activate

position    = 128,206,512,238

string  = Sailing 1St Person



[B_PRIMARY_LAND]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_SAILING1ST

command  = downstep,select:B_SAILING3RD

command  = click

command  = activate

position    = 128,262,512,294

string  = Primary Land



[B_SAILING3RD]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_PRIMARY_LAND

command  = downstep,select:B_FIGHTMODE

command  = click

command  = activate

position    = 128,318,512,350

string  = Sailing 3rd Person



[B_FIGHTMODE]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_SAILING3RD

command  = downstep,select:B_SAILING1ST

command  = click

command  = activate

position    = 128,374,512,406

string  = Fight Mode<!--c2--></div><!--ec2-->

replace with:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[B_GENERALCONTROLS]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_WORLDMAPCONTROLS

command  = downstep,select:B_PRIMARY_LAND

command  = click

command  = activate

position    = 128,200,512,230

string  = KAMGeneralControls



[B_PRIMARY_LAND]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_GENERALCONTROLS

command  = downstep,select:B_FIGHTMODE

command  = click

command  = activate

position    = 128,240,512,270

string  = Primary Land



[B_FIGHTMODE]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_PRIMARY_LAND

command  = downstep,select:B_SAILING3RD

command  = click

command  = activate

position    = 128,280,512,310

string  = Fight Mode



[B_SAILING3RD]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_FIGHTMODE

command  = downstep,select:B_SAILING1ST

command  = click

command  = activate

position    = 128,320,512,350

string  = Sailing 3rd Person



[B_SAILING1ST]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_SAILING3RD

command  = downstep,select:B_WORLDMAPCONTROLS

command  = click

command  = activate

position    = 128,360,512,390

string  = Sailing 1St Person



[B_WORLDMAPCONTROLS]

bNotUse  = 1

command  = deactivate

command  = upstep,select:B_SAILING1ST

command  = downstep,select:B_GENERALCONTROLS

command  = click

command  = activate

position    = 128,400,512,430

string  = KAMWorldmapControls<!--c2--></div><!--ec2-->

notice i changed the order and positions of the buttons, i thought they were in a funny order the original way heh. these buttons won't show up at first because they have bNotUse set to 1.
to make them show up at the appropriate time, open programoption_screen.c and find:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    case OPAGE_CONTROLS_2:

 SetNodeUsing("SUBTITLE",true);

 SetNodeUsing("STRINGS_CONTROLS",true);

 SetNodeUsing("B_SAILING1ST",true);

 SetNodeUsing("B_PRIMARY_LAND",true);

 SetNodeUsing("B_SAILING3RD",true);

 SetNodeUsing("B_FIGHTMODE",true);

 SetCurrentNode("B_SAILING1ST");

    break;<!--c2--></div><!--ec2-->

replace with:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    case OPAGE_CONTROLS_2:

 SetNodeUsing("SUBTITLE",true);

 SetNodeUsing("STRINGS_CONTROLS",true);

 SetNodeUsing("B_SAILING1ST",true);

 SetNodeUsing("B_PRIMARY_LAND",true);

 SetNodeUsing("B_SAILING3RD",true);

 SetNodeUsing("B_FIGHTMODE",true);

 SetNodeUsing("B_GENERALCONTROLS",true);  // added after build 11 by KAM

 SetNodeUsing("B_WORLDMAPCONTROLS",true);    // added after build 11 by KAM

 SetCurrentNode("B_GENERALCONTROLS");  // changed after build 11 by KAM

    break;<!--c2--></div><!--ec2-->

in which i have added the two new buttons, and set the 'starting' button to general. we also have to tell them to hide at the appropriate time, so in the same file, find:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    case OPAGE_CONTROLS_2:

 SetNodeUsing("SUBTITLE",false);

 SetNodeUsing("STRINGS_CONTROLS",false);

 SetNodeUsing("B_SAILING1ST",false);

 SetNodeUsing("B_PRIMARY_LAND",false);

 SetNodeUsing("B_SAILING3RD",false);

 SetNodeUsing("B_FIGHTMODE",false);

    break;<!--c2--></div><!--ec2-->

and replace with:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    case OPAGE_CONTROLS_2:

 SetNodeUsing("SUBTITLE",false);

 SetNodeUsing("STRINGS_CONTROLS",false);

 SetNodeUsing("B_SAILING1ST",false);

 SetNodeUsing("B_PRIMARY_LAND",false);

 SetNodeUsing("B_SAILING3RD",false);

 SetNodeUsing("B_FIGHTMODE",false);

 SetNodeUsing("B_GENERALCONTROLS",false);    // added after build 11 by KAM

 SetNodeUsing("B_WORLDMAPCONTROLS",false);    // added after build 11 by KAM

    break;<!--c2--></div><!--ec2-->

in which i have also added the two new buttons.

finally, in resourceinitextsenglishcommon.ini, add the following at the bottom of the file, to set the text on the new buttons:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->; KAM - new control groups on options screen

string = KAMGeneralControls,"General"

string = KAMWorldmpControls,"World Map"<!--c2--></div><!--ec2-->

you can now test the interface `in-game`. the buttons don't do anything yet, though. to give them a function, find in option_screen.c:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    case "B_SAILING1ST":

 if(comName=="deactivate")

 {

     if( g_bDisableControlChange ) {

   ShowOptionsPage(OPAGE_MAIN);

   SetCurrentNode("MB_CONTROLS");

     } else {

   ShowOptionsPage(OPAGE_CONTROLS_1);

   SetCurrentNode("CONTROLS_B_CHANGE");

     }

 }

 if(comName=="activate" || comName=="click")

 {

     ShowOptionsPage(OPAGE_CONTROLS_3);

     SetShowGroup("Sailing1Pers");

 }

    break;<!--c2--></div><!--ec2-->

replace with:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    case "B_SAILING1ST":

 if(comName=="deactivate")

 {

     if( g_bDisableControlChange ) {

   ShowOptionsPage(OPAGE_MAIN);

   SetCurrentNode("MB_CONTROLS");

     } else {

   ShowOptionsPage(OPAGE_CONTROLS_1);

   SetCurrentNode("CONTROLS_B_CHANGE");

     }

 }

 if(comName=="activate" || comName=="click")

 {

     ShowOptionsPage(OPAGE_CONTROLS_3);

     SetShowGroup("Sailing1Pers");

 }

    break;

// added by KAM after build 11 -->

    case "B_GENERALCONTROLS":

 if(comName=="deactivate")

 {

     if( g_bDisableControlChange ) {

   ShowOptionsPage(OPAGE_MAIN);

   SetCurrentNode("MB_CONTROLS");

     } else {

   ShowOptionsPage(OPAGE_CONTROLS_1);

   SetCurrentNode("CONTROLS_B_CHANGE");

     }

 }

 if(comName=="activate" || comName=="click")

 {

     ShowOptionsPage(OPAGE_CONTROLS_3);

     SetShowGroup("General");

 }

    break;

    case "B_WORLDMAPCONTROLS":

 if(comName=="deactivate")

 {

     if( g_bDisableControlChange ) {

   ShowOptionsPage(OPAGE_MAIN);

   SetCurrentNode("MB_CONTROLS");

     } else {

   ShowOptionsPage(OPAGE_CONTROLS_1);

   SetCurrentNode("CONTROLS_B_CHANGE");

     }

 }

 if(comName=="activate" || comName=="click")

 {

     ShowOptionsPage(OPAGE_CONTROLS_3);

     SetShowGroup("WorldMap");

 }

    break;

// <-- added by KAM after build 11<!--c2--></div><!--ec2-->

as you can see, all i've done is copy the chunk of code out, changing only the button names and the argument of 'setshowgroup.'

finally, we need to add our new groups to this `hard-coded` list of titles. find:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    switch(groupName)

    {

    case "Sailing1Pers":

 GameInterface.strings.GroupName = XI_ConvertString("Sailing 1St Person");

    break;<!--c2--></div><!--ec2-->

and replace with:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    switch(groupName)

    {

    case "Sailing1Pers":

 GameInterface.strings.GroupName = XI_ConvertString("Sailing 1St Person");

    break;

// added by KAM after build 11 -->

    case "General":

 GameInterface.strings.GroupName = XI_ConvertString("KAMGeneralControls");

    break;

    case "WorldMap":

 GameInterface.strings.GroupName = XI_ConvertString("KAMWorldmapControls");

    break;

// <-- added by KAM after build 11<!--c2--></div><!--ec2-->

(that <b>XI_ConvertString</b> function is the one that looks up strings in common.ini.)

now, we're in luck, because it looks as though <b>SetShowGroup</b> will do the work from then on. it should automatically populate the controls list with only the controls of the group "General" or "WorldMap". it looks like you have to put the names of the controls in resourceinitextsenglishcontrolsnames.txt.

would you like to test it, nathan, since you know how to make the controls?

hope this works <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
Back
Top