Wrote seperate function for weapon autocycling that also cycles through non-autoselect weapons; Added option to not autoselect weapon when firing; On the way, smoothed the menu text in misc menu a bit
This commit is contained in:
parent
d52f07bcf0
commit
9de6618ba0
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
|||
20120510
|
||||
--------
|
||||
main/multi.h, main/state.c: Reuse pre-defined player objects when loading coop savestate to revent messup when player amount or orders change in a certain way
|
||||
main/menu.c, main/playsave.c, main/playsave.h, main/weapon.c: Wrote seperate function for weapon autocycling that also cycles through non-autoselect weapons; Added option to not autoselect weapon when firing; On the way, smoothed the menu text in misc menu a bit
|
||||
|
||||
20120509
|
||||
--------
|
||||
|
|
22
main/menu.c
22
main/menu.c
|
@ -1856,27 +1856,29 @@ void do_sound_menu()
|
|||
|
||||
void do_misc_menu()
|
||||
{
|
||||
newmenu_item m[7];
|
||||
newmenu_item m[8];
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
ADD_CHECK(0, "Ship auto-leveling", PlayerCfg.AutoLeveling);
|
||||
ADD_CHECK(1, "Persistent Debris",PlayerCfg.PersistentDebris);
|
||||
ADD_CHECK(2, "Screenshots w/o HUD",PlayerCfg.PRShot);
|
||||
ADD_CHECK(3, "Disable redundant pickup messages",PlayerCfg.NoRedundancy);
|
||||
ADD_CHECK(4, "Only show Player msgs in Multipl.",PlayerCfg.MultiMessages);
|
||||
ADD_CHECK(3, "No redundant pickup messages",PlayerCfg.NoRedundancy);
|
||||
ADD_CHECK(4, "Show Player chat only (Multi)",PlayerCfg.MultiMessages);
|
||||
ADD_CHECK(5, "Show D2-style Prox. Bomb Gauge",PlayerCfg.BombGauge);
|
||||
ADD_CHECK(6, "Free Flight controls in Automap",PlayerCfg.AutomapFreeFlight);
|
||||
ADD_CHECK(7, "No Weapon Autoselect when firing",PlayerCfg.NoFireAutoselect);
|
||||
|
||||
i = newmenu_do1( NULL, "Misc Options", sizeof(m)/sizeof(*m), m, NULL, NULL, i );
|
||||
|
||||
PlayerCfg.AutoLeveling = m[0].value;
|
||||
PlayerCfg.PersistentDebris = m[1].value;
|
||||
PlayerCfg.PRShot = m[2].value;
|
||||
PlayerCfg.NoRedundancy = m[3].value;
|
||||
PlayerCfg.MultiMessages = m[4].value;
|
||||
PlayerCfg.BombGauge = m[5].value;
|
||||
PlayerCfg.AutomapFreeFlight = m[6].value;
|
||||
PlayerCfg.AutoLeveling = m[0].value;
|
||||
PlayerCfg.PersistentDebris = m[1].value;
|
||||
PlayerCfg.PRShot = m[2].value;
|
||||
PlayerCfg.NoRedundancy = m[3].value;
|
||||
PlayerCfg.MultiMessages = m[4].value;
|
||||
PlayerCfg.BombGauge = m[5].value;
|
||||
PlayerCfg.AutomapFreeFlight = m[6].value;
|
||||
PlayerCfg.NoFireAutoselect = m[7].value;
|
||||
|
||||
} while( i>-1 );
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ int new_player_config()
|
|||
PlayerCfg.MultiMessages = 0;
|
||||
PlayerCfg.BombGauge = 1;
|
||||
PlayerCfg.AutomapFreeFlight = 0;
|
||||
PlayerCfg.NoFireAutoselect = 0;
|
||||
PlayerCfg.AlphaEffects = 0;
|
||||
PlayerCfg.DynLightColor = 0;
|
||||
|
||||
|
@ -295,6 +296,8 @@ int read_player_d1x(char *filename)
|
|||
PlayerCfg.BombGauge = atoi(line);
|
||||
if(!strcmp(word,"AUTOMAPFREEFLIGHT"))
|
||||
PlayerCfg.AutomapFreeFlight = atoi(line);
|
||||
if(!strcmp(word,"NOFIREAUTOSELECT"))
|
||||
PlayerCfg.NoFireAutoselect = atoi(line);
|
||||
d_free(word);
|
||||
PHYSFSX_fgets(line,50,f);
|
||||
word=splitword(line,'=');
|
||||
|
@ -618,6 +621,7 @@ int write_player_d1x(char *filename)
|
|||
PHYSFSX_printf(fout,"multimessages=%i\n",PlayerCfg.MultiMessages);
|
||||
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,"[end]\n");
|
||||
PHYSFSX_printf(fout,"[graphics]\n");
|
||||
PHYSFSX_printf(fout,"alphaeffects=%i\n",PlayerCfg.AlphaEffects);
|
||||
|
|
|
@ -79,6 +79,7 @@ typedef struct player_config
|
|||
ubyte MultiMessages;
|
||||
ubyte BombGauge;
|
||||
ubyte AutomapFreeFlight;
|
||||
ubyte NoFireAutoselect;
|
||||
int AlphaEffects;
|
||||
int DynLightColor;
|
||||
} __pack__ player_config;
|
||||
|
|
|
@ -47,7 +47,6 @@ int SOrderList (int num);
|
|||
ubyte DefaultPrimaryOrder[] = { 4, 3, 2, 1, 0, 255 };
|
||||
ubyte DefaultSecondaryOrder[] = { 4, 3, 1, 0, 255, 2 };
|
||||
extern ubyte MenuReordering;
|
||||
ubyte Cycling=0;
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
// Return:
|
||||
|
@ -147,16 +146,46 @@ void InitWeaponOrdering ()
|
|||
|
||||
void CyclePrimary ()
|
||||
{
|
||||
Cycling=1;
|
||||
auto_select_weapon (0);
|
||||
Cycling=0;
|
||||
int cur_order_slot = POrderList(Primary_weapon), desired_weapon = Primary_weapon, loop=0;
|
||||
|
||||
while (loop<(MAX_PRIMARY_WEAPONS+1))
|
||||
{
|
||||
loop++;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
select_weapon(desired_weapon, 0, 1, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CycleSecondary ()
|
||||
{
|
||||
Cycling=1;
|
||||
auto_select_weapon (1);
|
||||
Cycling=0;
|
||||
int cur_order_slot = SOrderList(Secondary_weapon), desired_weapon = Secondary_weapon, loop=0;
|
||||
|
||||
while (loop<(MAX_SECONDARY_WEAPONS+1))
|
||||
{
|
||||
loop++;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
select_weapon(desired_weapon, 1, 1, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
@ -279,7 +308,7 @@ void auto_select_weapon(int weapon_type)
|
|||
|
||||
if (weapon_type==0) {
|
||||
r = player_has_weapon(Primary_weapon, 0);
|
||||
if (r != HAS_ALL || Cycling) {
|
||||
if (r != HAS_ALL) {
|
||||
int cur_weapon;
|
||||
int try_again = 1;
|
||||
|
||||
|
@ -293,14 +322,8 @@ void auto_select_weapon(int weapon_type)
|
|||
{
|
||||
if (looped)
|
||||
{
|
||||
if (!Cycling)
|
||||
{
|
||||
HUD_init_message(HM_DEFAULT, TXT_NO_PRIMARY);
|
||||
select_weapon(0, 0, 0, 1);
|
||||
}
|
||||
else
|
||||
select_weapon (Primary_weapon,0,0,1);
|
||||
|
||||
HUD_init_message(HM_DEFAULT, TXT_NO_PRIMARY);
|
||||
select_weapon(0, 0, 0, 1);
|
||||
try_again = 0;
|
||||
continue;
|
||||
}
|
||||
|
@ -318,15 +341,8 @@ void auto_select_weapon(int weapon_type)
|
|||
// continue;
|
||||
|
||||
if (PlayerCfg.PrimaryOrder[cur_weapon] == Primary_weapon) {
|
||||
if (!Cycling)
|
||||
{
|
||||
HUD_init_message(HM_DEFAULT, TXT_NO_PRIMARY);
|
||||
// if (POrderList(0)<POrderList(255))
|
||||
select_weapon(0, 0, 0, 1);
|
||||
}
|
||||
else
|
||||
select_weapon (Primary_weapon,0,0,1);
|
||||
|
||||
HUD_init_message(HM_DEFAULT, TXT_NO_PRIMARY);
|
||||
select_weapon(0, 0, 0, 1);
|
||||
try_again = 0; // Tried all weapons!
|
||||
|
||||
} else if (PlayerCfg.PrimaryOrder[cur_weapon]!=255 && player_has_weapon(PlayerCfg.PrimaryOrder[cur_weapon], 0) == HAS_ALL) {
|
||||
|
@ -340,7 +356,7 @@ void auto_select_weapon(int weapon_type)
|
|||
|
||||
Assert(weapon_type==1);
|
||||
r = player_has_weapon(Secondary_weapon, 1);
|
||||
if (r != HAS_ALL || Cycling) {
|
||||
if (r != HAS_ALL) {
|
||||
int cur_weapon;
|
||||
int try_again = 1;
|
||||
|
||||
|
@ -355,10 +371,7 @@ void auto_select_weapon(int weapon_type)
|
|||
{
|
||||
if (looped)
|
||||
{
|
||||
if (!Cycling)
|
||||
HUD_init_message(HM_DEFAULT, "No secondary weapons selected!");
|
||||
else
|
||||
select_weapon (Secondary_weapon,1,0,1);
|
||||
HUD_init_message(HM_DEFAULT, "No secondary weapons selected!");
|
||||
try_again = 0;
|
||||
continue;
|
||||
}
|
||||
|
@ -370,11 +383,7 @@ void auto_select_weapon(int weapon_type)
|
|||
cur_weapon = 0;
|
||||
|
||||
if (PlayerCfg.SecondaryOrder[cur_weapon] == Secondary_weapon) {
|
||||
if (!Cycling)
|
||||
HUD_init_message(HM_DEFAULT, "No secondary weapons available!");
|
||||
else
|
||||
select_weapon (Secondary_weapon,1,0,1);
|
||||
|
||||
HUD_init_message(HM_DEFAULT, "No secondary weapons available!");
|
||||
try_again = 0; // Tried all weapons!
|
||||
} else if (player_has_weapon(PlayerCfg.SecondaryOrder[cur_weapon], 1) == HAS_ALL) {
|
||||
select_weapon(PlayerCfg.SecondaryOrder[cur_weapon], 1, 1, 1 );
|
||||
|
@ -411,7 +420,7 @@ int pick_up_secondary(int weapon_index,int count)
|
|||
if (Players[Player_num].secondary_ammo[weapon_index] == count) // only autoselect if player didn't have any
|
||||
{
|
||||
cutpoint=SOrderList (255);
|
||||
if (SOrderList (weapon_index)<cutpoint && ((SOrderList (weapon_index) < SOrderList(Secondary_weapon)) || (Players[Player_num].secondary_ammo[Secondary_weapon] == 0)) )
|
||||
if (((Controls.fire_secondary_state && PlayerCfg.NoFireAutoselect)?0:1) && SOrderList (weapon_index)<cutpoint && ((SOrderList (weapon_index) < SOrderList(Secondary_weapon)) || (Players[Player_num].secondary_ammo[Secondary_weapon] == 0)) )
|
||||
select_weapon(weapon_index,1, 0, 1);
|
||||
}
|
||||
|
||||
|
@ -505,7 +514,7 @@ int pick_up_primary(int weapon_index)
|
|||
|
||||
cutpoint=POrderList (255);
|
||||
|
||||
if (POrderList(weapon_index)<cutpoint && POrderList(weapon_index)<POrderList(Primary_weapon))
|
||||
if (((Controls.fire_primary_state && PlayerCfg.NoFireAutoselect)?0:1) && POrderList(weapon_index)<cutpoint && POrderList(weapon_index)<POrderList(Primary_weapon))
|
||||
select_weapon(weapon_index,0,0,1);
|
||||
|
||||
PALETTE_FLASH_ADD(7,14,21);
|
||||
|
@ -538,7 +547,7 @@ int pick_up_ammo(int class_flag,int weapon_index,int ammo_count)
|
|||
}
|
||||
cutpoint=POrderList (255);
|
||||
|
||||
if (Players[Player_num].primary_weapon_flags&(1<<weapon_index) && weapon_index>Primary_weapon && old_ammo==0 &&
|
||||
if (((Controls.fire_primary_state && PlayerCfg.NoFireAutoselect)?0:1) && Players[Player_num].primary_weapon_flags&(1<<weapon_index) && weapon_index>Primary_weapon && old_ammo==0 &&
|
||||
POrderList(weapon_index)<cutpoint && POrderList(weapon_index)<POrderList(Primary_weapon))
|
||||
select_weapon(weapon_index,0,0,1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue