Added option to ignore cycling weapons that are not on autoselect list

This commit is contained in:
zico 2013-04-08 15:04:28 +02:00
parent c361a6ef91
commit 0ceaaaf237
5 changed files with 31 additions and 5 deletions

View file

@ -3,6 +3,7 @@ D2X-Rebirth Changelog
20130408
--------
main/gamecntl.c, main/gamerend.c, main/gauges.c, main/gauges.h: Added 4th alternative HUD mode for no HUD rendering, aka Immersion mode
main/menu.c, main/playsave.c, main/playsave.h, main/weapons.c: Added option to ignore cycling weapons that are not on autoselect list
20130407
--------

View file

@ -1895,7 +1895,7 @@ void do_sound_menu()
void do_misc_menu()
{
newmenu_item m[13];
newmenu_item m[14];
int i = 0;
do {
@ -1912,6 +1912,7 @@ void do_misc_menu()
ADD_CHECK(10, "No Rankings (Multi)",PlayerCfg.NoRankings);
ADD_CHECK(11, "Free Flight controls in Automap",PlayerCfg.AutomapFreeFlight);
ADD_CHECK(12, "No Weapon Autoselect when firing",PlayerCfg.NoFireAutoselect);
ADD_CHECK(13, "Only Cycle Autoselect Weapons",PlayerCfg.CycleAutoselectOnly);
i = newmenu_do1( NULL, "Misc Options", sizeof(m)/sizeof(*m), m, NULL, NULL, i );
@ -1928,6 +1929,7 @@ void do_misc_menu()
PlayerCfg.NoRankings = m[10].value;
PlayerCfg.AutomapFreeFlight = m[11].value;
PlayerCfg.NoFireAutoselect = m[12].value;
PlayerCfg.CycleAutoselectOnly = m[13].value;
} while( i>-1 );

View file

@ -120,6 +120,7 @@ int new_player_config()
PlayerCfg.NoRankings = 0;
PlayerCfg.AutomapFreeFlight = 0;
PlayerCfg.NoFireAutoselect = 0;
PlayerCfg.CycleAutoselectOnly = 0;
PlayerCfg.AlphaEffects = 0;
PlayerCfg.DynLightColor = 0;
@ -321,6 +322,8 @@ int read_player_d2x(char *filename)
PlayerCfg.AutomapFreeFlight = atoi(line);
if(!strcmp(word,"NOFIREAUTOSELECT"))
PlayerCfg.NoFireAutoselect = atoi(line);
if(!strcmp(word,"CYCLEAUTOSELECTONLY"))
PlayerCfg.CycleAutoselectOnly = atoi(line);
d_free(word);
PHYSFSX_fgets(line,50,f);
word=splitword(line,'=');
@ -473,6 +476,7 @@ int write_player_d2x(char *filename)
PHYSFSX_printf(fout,"norankings=%i\n",PlayerCfg.NoRankings);
PHYSFSX_printf(fout,"automapfreeflight=%i\n",PlayerCfg.AutomapFreeFlight);
PHYSFSX_printf(fout,"nofireautoselect=%i\n",PlayerCfg.NoFireAutoselect);
PHYSFSX_printf(fout,"cycleautoselectonly=%i\n",PlayerCfg.CycleAutoselectOnly);
PHYSFSX_printf(fout,"[end]\n");
PHYSFSX_printf(fout,"[graphics]\n");
PHYSFSX_printf(fout,"alphaeffects=%i\n",PlayerCfg.AlphaEffects);

View file

@ -75,6 +75,7 @@ typedef struct player_config
ubyte NoRankings;
ubyte AutomapFreeFlight;
ubyte NoFireAutoselect;
ubyte CycleAutoselectOnly;
int AlphaEffects;
int DynLightColor;
} __pack__ player_config;

View file

@ -233,8 +233,17 @@ void CyclePrimary ()
cur_order_slot++; // next slot
if (cur_order_slot >= MAX_PRIMARY_WEAPONS+1) // loop if necessary
cur_order_slot = 0;
if (cur_order_slot == POrderList(255)) // ignore "do not autoselect"
continue;
if (cur_order_slot == SOrderList(255)) // what to to with non-autoselect weapons?
{
if (PlayerCfg.CycleAutoselectOnly)
{
cur_order_slot = 0; // loop over or ...
}
else
{
continue; // continue?
}
}
desired_weapon = PlayerCfg.PrimaryOrder[cur_order_slot]; // now that is the weapon next to our current one
// some remapping for SUPER LASER which is not an actual weapon type at all
if (desired_weapon == LASER_INDEX && Players[Player_num].laser_level > MAX_LASER_LEVEL)
@ -265,8 +274,17 @@ void CycleSecondary ()
cur_order_slot++; // next slot
if (cur_order_slot >= MAX_SECONDARY_WEAPONS+1) // loop if necessary
cur_order_slot = 0;
if (cur_order_slot == SOrderList(255)) // ignore "do not autoselect"
continue;
if (cur_order_slot == SOrderList(255)) // what to to with non-autoselect weapons?
{
if (PlayerCfg.CycleAutoselectOnly)
{
cur_order_slot = 0; // loop over or ...
}
else
{
continue; // continue?
}
}
desired_weapon = PlayerCfg.SecondaryOrder[cur_order_slot]; // now that is the weapon next to our current one
// select the weapon if we have it
if (player_has_weapon(desired_weapon, 1) == HAS_ALL)