mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Minor stylistic tweaks of code related to weapon switching.
git-svn-id: https://svn.eduke32.com/eduke32@4215 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
030f72d551
commit
c45ca57eb0
7 changed files with 40 additions and 37 deletions
|
@ -690,12 +690,13 @@ int32_t CONFIG_ReadSetup(void)
|
|||
|
||||
// weapon choices are defaulted in G_CheckCommandLine, which may override them
|
||||
if (!g_forceWeaponChoice)
|
||||
for (i=0; i<10; i++)
|
||||
for (i=0; i<=FREEZE_WEAPON; i++)
|
||||
{
|
||||
Bsprintf(buf,"WeaponChoice%d",i);
|
||||
dummy = -1;
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy);
|
||||
if (dummy >= 0 && dummy<10) g_player[0].wchoice[i] = dummy;
|
||||
if (dummy >= 0 && dummy <= FREEZE_WEAPON)
|
||||
g_player[0].wchoice[i] = dummy;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -10886,6 +10886,15 @@ static void G_Startup(void)
|
|||
Bfflush(NULL);
|
||||
}
|
||||
|
||||
static void P_SetupMiscInputSettings(void)
|
||||
{
|
||||
DukePlayer_t *ps = g_player[myconnectindex].ps;
|
||||
|
||||
ps->aim_mode = ud.mouseaiming;
|
||||
ps->auto_aim = ud.config.AutoAim;
|
||||
ps->weaponswitch = ud.weaponswitch;
|
||||
}
|
||||
|
||||
void G_UpdatePlayerFromMenu(void)
|
||||
{
|
||||
if (ud.recstat != 0)
|
||||
|
@ -10901,10 +10910,7 @@ void G_UpdatePlayerFromMenu(void)
|
|||
{
|
||||
/*int32_t j = g_player[myconnectindex].ps->team;*/
|
||||
|
||||
// CODEDUP_UD_TO_GPLAYER
|
||||
g_player[myconnectindex].ps->aim_mode = ud.mouseaiming;
|
||||
g_player[myconnectindex].ps->auto_aim = ud.config.AutoAim;
|
||||
g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch;
|
||||
P_SetupMiscInputSettings();
|
||||
g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = ud.color;
|
||||
|
||||
g_player[myconnectindex].pteam = ud.team;
|
||||
|
@ -11786,10 +11792,7 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
// ud.auto_run = ud.config.RunMode;
|
||||
ud.showweapons = ud.config.ShowOpponentWeapons;
|
||||
// CODEDUP_UD_TO_GPLAYER
|
||||
g_player[myconnectindex].ps->aim_mode = ud.mouseaiming;
|
||||
g_player[myconnectindex].ps->auto_aim = ud.config.AutoAim;
|
||||
g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch;
|
||||
P_SetupMiscInputSettings();
|
||||
g_player[myconnectindex].pteam = ud.team;
|
||||
|
||||
if (GametypeFlags[ud.coop] & GAMETYPE_TDM)
|
||||
|
|
|
@ -1102,7 +1102,7 @@ const memberlabel_t UserdefsLabels[]=
|
|||
{ "screen_size", USERDEFS_SCREEN_SIZE, 0, 0 },
|
||||
{ "lockout", USERDEFS_LOCKOUT, 0, 0 },
|
||||
{ "crosshair", USERDEFS_CROSSHAIR, 0, 0 },
|
||||
{ "wchoice[MAXPLAYERS][MAX_WEAPONS]", USERDEFS_WCHOICE, 0, 0 },
|
||||
// { "wchoice[MAXPLAYERS][MAX_WEAPONS]", USERDEFS_WCHOICE, 0, 0 },
|
||||
{ "playerai", USERDEFS_PLAYERAI, 0, 0 },
|
||||
{ "respawn_monsters", USERDEFS_RESPAWN_MONSTERS, 0, 0 },
|
||||
{ "respawn_items", USERDEFS_RESPAWN_ITEMS, 0, 0 },
|
||||
|
|
|
@ -805,13 +805,14 @@ static void P_AddWeaponMaybeSwitch(DukePlayer_t *ps, int32_t weap)
|
|||
if ((ps->weaponswitch & 1) && (ps->weaponswitch & 4))
|
||||
{
|
||||
int32_t snum = sprite[ps->i].yvel;
|
||||
int32_t i, w, new_wchoice = -1, curr_wchoice = -1;
|
||||
int32_t i, new_wchoice = -1, curr_wchoice = -1;
|
||||
|
||||
for (i=0; i<10 && (new_wchoice < 0 || curr_wchoice < 0); i++)
|
||||
for (i=0; i<=FREEZE_WEAPON && (new_wchoice < 0 || curr_wchoice < 0); i++)
|
||||
{
|
||||
w = g_player[snum].wchoice[i];
|
||||
int32_t w = g_player[snum].wchoice[i];
|
||||
|
||||
if (w == 0) w = 9;
|
||||
if (w == KNEE_WEAPON)
|
||||
w = FREEZE_WEAPON;
|
||||
else w--;
|
||||
|
||||
if (w == ps->curr_weapon)
|
||||
|
|
|
@ -446,15 +446,6 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t
|
|||
Gv_SetVarX(lVar2, ud.crosshair);
|
||||
return;
|
||||
|
||||
// case USERDEFS_WCHOICE:
|
||||
// if(iSet)
|
||||
// {
|
||||
// ud.wchoice = lValue;
|
||||
// return;
|
||||
// }
|
||||
// Gv_SetVarX(lVar2, ud.wchoice);
|
||||
// return;
|
||||
|
||||
case USERDEFS_PLAYERAI:
|
||||
if (iSet)
|
||||
{
|
||||
|
|
|
@ -3202,10 +3202,10 @@ void P_AddWeaponNoSwitch(DukePlayer_t *p, int32_t weapon)
|
|||
A_PlaySound(PWEAPON(snum, weapon, SelectSound),p->i);
|
||||
}
|
||||
|
||||
void P_ChangeWeapon(DukePlayer_t *p,int32_t weapon)
|
||||
void P_ChangeWeapon(DukePlayer_t *p, int32_t weapon)
|
||||
{
|
||||
int32_t i = 0, snum = sprite[p->i].yvel;
|
||||
int8_t curr_weapon = p->curr_weapon;
|
||||
const int8_t curr_weapon = p->curr_weapon;
|
||||
|
||||
if (p->reloading) return;
|
||||
|
||||
|
@ -3214,7 +3214,8 @@ void P_ChangeWeapon(DukePlayer_t *p,int32_t weapon)
|
|||
|
||||
if (i == -1)
|
||||
return;
|
||||
else if (i != -2)
|
||||
|
||||
if (i != -2)
|
||||
p->curr_weapon = weapon;
|
||||
|
||||
p->last_weapon = curr_weapon;
|
||||
|
@ -3237,7 +3238,7 @@ void P_ChangeWeapon(DukePlayer_t *p,int32_t weapon)
|
|||
P_SetWeaponGamevars(snum, p);
|
||||
}
|
||||
|
||||
void P_AddWeapon(DukePlayer_t *p,int32_t weapon)
|
||||
void P_AddWeapon(DukePlayer_t *p, int32_t weapon)
|
||||
{
|
||||
P_AddWeaponNoSwitch(p, weapon);
|
||||
P_ChangeWeapon(p, weapon);
|
||||
|
@ -3266,14 +3267,17 @@ void P_CheckWeapon(DukePlayer_t *p)
|
|||
{
|
||||
int32_t i, snum, weapon;
|
||||
|
||||
if (p->reloading) return;
|
||||
if (p->reloading)
|
||||
return;
|
||||
|
||||
if (p->wantweaponfire >= 0)
|
||||
{
|
||||
weapon = p->wantweaponfire;
|
||||
p->wantweaponfire = -1;
|
||||
|
||||
if (weapon == p->curr_weapon) return;
|
||||
if (weapon == p->curr_weapon)
|
||||
return;
|
||||
|
||||
if ((p->gotweapon & (1<<weapon)) && p->ammo_amount[weapon] > 0)
|
||||
{
|
||||
P_AddWeapon(p,weapon);
|
||||
|
@ -3288,19 +3292,22 @@ void P_CheckWeapon(DukePlayer_t *p)
|
|||
|
||||
snum = sprite[p->i].yvel;
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
for (i=0; i<=FREEZE_WEAPON; i++)
|
||||
{
|
||||
weapon = g_player[snum].wchoice[i];
|
||||
if (VOLUMEONE && weapon > 6) continue;
|
||||
if (VOLUMEONE && weapon > SHRINKER_WEAPON)
|
||||
continue;
|
||||
|
||||
if (weapon == 0) weapon = 9;
|
||||
if (weapon == KNEE_WEAPON)
|
||||
weapon = FREEZE_WEAPON;
|
||||
else weapon--;
|
||||
|
||||
if (weapon == 0 || ((p->gotweapon & (1<<weapon)) && p->ammo_amount[weapon] > 0))
|
||||
if (weapon == KNEE_WEAPON || ((p->gotweapon & (1<<weapon)) && p->ammo_amount[weapon] > 0))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 10) weapon = 0;
|
||||
if (i == HANDREMOTE_WEAPON)
|
||||
weapon = KNEE_WEAPON;
|
||||
|
||||
// Found the weapon
|
||||
|
||||
|
@ -3956,8 +3963,7 @@ static void P_ProcessWeapon(int32_t snum)
|
|||
if ((*kb) >= PWEAPON(snum, p->curr_weapon, TotalTime))
|
||||
{
|
||||
(*kb) = 0;
|
||||
if ((p->ammo_amount[HANDBOMB_WEAPON] > 0) &&
|
||||
PIPEBOMB_CONTROL(snum) == PIPEBOMB_REMOTE)
|
||||
if ((p->ammo_amount[HANDBOMB_WEAPON] > 0) && PIPEBOMB_CONTROL(snum) == PIPEBOMB_REMOTE)
|
||||
P_AddWeapon(p,HANDBOMB_WEAPON);
|
||||
else P_CheckWeapon(p);
|
||||
}
|
||||
|
|
|
@ -251,6 +251,7 @@ typedef struct {
|
|||
int32_t netsynctime;
|
||||
int16_t ping, filler;
|
||||
int32_t pcolor, pteam;
|
||||
// NOTE: wchoice[HANDREMOTE_WEAPON .. MAX_WEAPONS-1] unused
|
||||
uint8_t frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
|
||||
|
||||
char vote, gotvote, pingcnt, playerquitflag, ready;
|
||||
|
|
Loading…
Reference in a new issue