From dab702aba94286fe20b97a6b6ed35e3006df6243 Mon Sep 17 00:00:00 2001 From: zico Date: Mon, 8 Apr 2013 15:04:19 +0200 Subject: [PATCH] Added option to ignore cycling weapons that are not on autoselect list --- CHANGELOG.txt | 1 + main/menu.c | 4 +++- main/playsave.c | 4 ++++ main/playsave.h | 1 + main/weapon.c | 26 ++++++++++++++++++++++---- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1f0728bdc..e6f2a8e08 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/main/menu.c b/main/menu.c index 7e86bdba4..c5643a6e7 100644 --- a/main/menu.c +++ b/main/menu.c @@ -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 ); diff --git a/main/playsave.c b/main/playsave.c index b00a95286..d72361eb9 100644 --- a/main/playsave.c +++ b/main/playsave.c @@ -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); diff --git a/main/playsave.h b/main/playsave.h index 47e1920a7..e3022ddd3 100644 --- a/main/playsave.h +++ b/main/playsave.h @@ -82,6 +82,7 @@ typedef struct player_config ubyte BombGauge; ubyte AutomapFreeFlight; ubyte NoFireAutoselect; + ubyte CycleAutoselectOnly; int AlphaEffects; int DynLightColor; } __pack__ player_config; diff --git a/main/weapon.c b/main/weapon.c index d69dd2403..515672784 100644 --- a/main/weapon.c +++ b/main/weapon.c @@ -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)