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

This commit is contained in:
zico 2013-04-08 15:04:19 +02:00
parent bf52256c8d
commit dab702aba9
5 changed files with 31 additions and 5 deletions

View file

@ -3,6 +3,7 @@ D1X-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
20130406
--------

View file

@ -1865,7 +1865,7 @@ void do_sound_menu()
void do_misc_menu()
{
newmenu_item m[9];
newmenu_item m[10];
int i = 0;
do {
@ -1878,6 +1878,7 @@ void do_misc_menu()
ADD_CHECK(6, "Show D2-style Prox. Bomb Gauge",PlayerCfg.BombGauge);
ADD_CHECK(7, "Free Flight controls in Automap",PlayerCfg.AutomapFreeFlight);
ADD_CHECK(8, "No Weapon Autoselect when firing",PlayerCfg.NoFireAutoselect);
ADD_CHECK(9, "Only Cycle Autoselect Weapons",PlayerCfg.CycleAutoselectOnly);
i = newmenu_do1( NULL, "Misc Options", sizeof(m)/sizeof(*m), m, NULL, NULL, i );
@ -1890,6 +1891,7 @@ void do_misc_menu()
PlayerCfg.BombGauge = m[6].value;
PlayerCfg.AutomapFreeFlight = m[7].value;
PlayerCfg.NoFireAutoselect = m[8].value;
PlayerCfg.CycleAutoselectOnly = m[9].value;
} while( i>-1 );

View file

@ -98,6 +98,7 @@ int new_player_config()
PlayerCfg.BombGauge = 1;
PlayerCfg.AutomapFreeFlight = 0;
PlayerCfg.NoFireAutoselect = 0;
PlayerCfg.CycleAutoselectOnly = 0;
PlayerCfg.AlphaEffects = 0;
PlayerCfg.DynLightColor = 0;
@ -328,6 +329,8 @@ int read_player_d1x(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,'=');
@ -660,6 +663,7 @@ int write_player_d1x(char *filename)
PHYSFSX_printf(fout,"bombgauge=%i\n",PlayerCfg.BombGauge);
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

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

View file

@ -154,8 +154,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 == POrderList(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
// select the weapon if we have it
if (player_has_weapon(desired_weapon, 0) == HAS_ALL)
@ -176,8 +185,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)