Add a few defined constants for commonly used weapon_pos values

git-svn-id: https://svn.eduke32.com/eduke32@3903 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2013-06-27 23:04:57 +00:00
parent 214baa9475
commit e9a773a588
4 changed files with 23 additions and 19 deletions

View file

@ -2996,7 +2996,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
case GAMETICSPERSEC*218: case GAMETICSPERSEC*218:
{ {
p->holster_weapon = 0; p->holster_weapon = 0;
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
} }
break; break;
} }
@ -3109,7 +3109,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->access_incs > 20) if (p->access_incs > 20)
{ {
p->access_incs = 0; p->access_incs = 0;
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
p->kickback_pic = 0; p->kickback_pic = 0;
} }
} }
@ -3240,11 +3240,11 @@ void P_ChangeWeapon(DukePlayer_t *p,int32_t weapon)
if (p->weapon_pos == 0) if (p->weapon_pos == 0)
p->weapon_pos = -1; p->weapon_pos = -1;
else p->weapon_pos = -9; else p->weapon_pos = WEAPON_POS_LOWER;
if (p->holster_weapon) if (p->holster_weapon)
{ {
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
p->holster_weapon = 0; p->holster_weapon = 0;
p->last_weapon = -1; p->last_weapon = -1;
} }
@ -3621,11 +3621,11 @@ static void P_ProcessWeapon(int32_t snum)
case -9: case -9:
if (p->last_weapon >= 0) if (p->last_weapon >= 0)
{ {
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
p->last_weapon = -1; p->last_weapon = -1;
} }
else if (p->holster_weapon == 0) else if (p->holster_weapon == 0)
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
break; break;
case 0: case 0:
break; break;
@ -3656,10 +3656,10 @@ static void P_ProcessWeapon(int32_t snum)
p->weapon_pos = -1; p->weapon_pos = -1;
P_DoQuote(QUOTE_WEAPON_LOWERED,p); P_DoQuote(QUOTE_WEAPON_LOWERED,p);
} }
else if (p->holster_weapon == 1 && p->weapon_pos == -9) else if (p->holster_weapon == 1 && p->weapon_pos == WEAPON_POS_LOWER)
{ {
p->holster_weapon = 0; p->holster_weapon = 0;
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
P_DoQuote(QUOTE_WEAPON_RAISED,p); P_DoQuote(QUOTE_WEAPON_RAISED,p);
} }
} }
@ -3736,10 +3736,10 @@ static void P_ProcessWeapon(int32_t snum)
if (p->holster_weapon == 1) if (p->holster_weapon == 1)
{ {
if (p->last_pissed_time <= (GAMETICSPERSEC*218) && p->weapon_pos == -9) if (p->last_pissed_time <= (GAMETICSPERSEC*218) && p->weapon_pos == WEAPON_POS_LOWER)
{ {
p->holster_weapon = 0; p->holster_weapon = 0;
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
P_DoQuote(QUOTE_WEAPON_RAISED,p); P_DoQuote(QUOTE_WEAPON_RAISED,p);
} }
} }
@ -3940,7 +3940,7 @@ static void P_ProcessWeapon(int32_t snum)
else if ((*kb) > PWEAPON(snum, p->curr_weapon, TotalTime)) else if ((*kb) > PWEAPON(snum, p->curr_weapon, TotalTime))
{ {
(*kb) = 0; (*kb) = 0;
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
if (PIPEBOMB_CONTROL(snum) == PIPEBOMB_REMOTE) if (PIPEBOMB_CONTROL(snum) == PIPEBOMB_REMOTE)
{ {
p->curr_weapon = HANDREMOTE_WEAPON; p->curr_weapon = HANDREMOTE_WEAPON;
@ -3991,7 +3991,7 @@ static void P_ProcessWeapon(int32_t snum)
{ {
(*kb) = 0; (*kb) = 0;
P_CheckWeapon(p); P_CheckWeapon(p);
p->weapon_pos = -9; p->weapon_pos = WEAPON_POS_LOWER;
} }
} }
else if (*kb >= PWEAPON(snum, p->curr_weapon, Reload)) else if (*kb >= PWEAPON(snum, p->curr_weapon, Reload))

View file

@ -39,6 +39,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PIPEBOMB_REMOTE 0x00000001 #define PIPEBOMB_REMOTE 0x00000001
#define PIPEBOMB_TIMER 0x00000002 #define PIPEBOMB_TIMER 0x00000002
#define WEAPON_POS_LOWER -9
#define WEAPON_POS_RAISE 10
#define WEAPON_POS_START 6
enum dukeinv_t { enum dukeinv_t {
GET_STEROIDS, // 0 GET_STEROIDS, // 0
GET_SHIELD, GET_SHIELD,

View file

@ -842,7 +842,7 @@ void P_ResetStatus(int32_t snum)
p->kickback_pic = PWEAPON(snum, p->curr_weapon, TotalTime); p->kickback_pic = PWEAPON(snum, p->curr_weapon, TotalTime);
else p->kickback_pic = 0; else p->kickback_pic = 0;
p->weapon_pos = 6; p->weapon_pos = WEAPON_POS_START;
p->walking_snd_toggle= 0; p->walking_snd_toggle= 0;
p->weapon_ang = 0; p->weapon_ang = 0;
@ -868,7 +868,7 @@ void P_ResetWeapons(int32_t snum)
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
p->ammo_amount[weapon] = 0; p->ammo_amount[weapon] = 0;
p->weapon_pos = 6; p->weapon_pos = WEAPON_POS_START;
p->curr_weapon = PISTOL_WEAPON; p->curr_weapon = PISTOL_WEAPON;
p->kickback_pic = PWEAPON(snum, p->curr_weapon, TotalTime); p->kickback_pic = PWEAPON(snum, p->curr_weapon, TotalTime);
p->gotweapon = ((1<<PISTOL_WEAPON) | (1<<KNEE_WEAPON) | (1<<HANDREMOTE_WEAPON)); p->gotweapon = ((1<<PISTOL_WEAPON) | (1<<KNEE_WEAPON) | (1<<HANDREMOTE_WEAPON));
@ -911,8 +911,8 @@ static void resetprestat(int32_t snum,int32_t g)
p->max_secret_rooms = 0; p->max_secret_rooms = 0;
p->actors_killed = 0; p->actors_killed = 0;
p->max_actors_killed = 0; p->max_actors_killed = 0;
p->lastrandomspot = 0; p->lastrandomspot = 0;
p->weapon_pos = 6; p->weapon_pos = WEAPON_POS_START;
P_ResetTintFade(p); P_ResetTintFade(p);

View file

@ -2699,7 +2699,7 @@ CHECKINV1:
if ((int32_t)j != -1 && p->last_pissed_time <= (GAMETICSPERSEC*218) && p->show_empty_weapon == 0 /*&& p->kickback_pic == 0*/ && if ((int32_t)j != -1 && p->last_pissed_time <= (GAMETICSPERSEC*218) && p->show_empty_weapon == 0 /*&& p->kickback_pic == 0*/ &&
p->quick_kick == 0 && sprite[p->i].xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0) p->quick_kick == 0 && sprite[p->i].xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0)
{ {
// if( ( p->weapon_pos == 0 || ( p->holster_weapon && p->weapon_pos == -9 ) )) // if( ( p->weapon_pos == 0 || ( p->holster_weapon && p->weapon_pos == WEAPON_POS_LOWER ) ))
{ {
if (j == 10 || j == 11) if (j == 10 || j == 11)
{ {
@ -2811,7 +2811,7 @@ CHECKINV1:
if (p->holster_weapon) if (p->holster_weapon)
{ {
sb_snum |= BIT(SK_HOLSTER); sb_snum |= BIT(SK_HOLSTER);
p->weapon_pos = -9; p->weapon_pos = WEAPON_POS_LOWER;
} }
else if ((int32_t)j >= 0 && (p->gotweapon & (1<<j)) && (uint32_t)p->curr_weapon != j) else if ((int32_t)j >= 0 && (p->gotweapon & (1<<j)) && (uint32_t)p->curr_weapon != j)
switch (j) switch (j)
@ -2837,7 +2837,7 @@ CHECKINV1:
{ {
p->curr_weapon = j; p->curr_weapon = j;
p->last_weapon = -1; p->last_weapon = -1;
p->weapon_pos = 10; p->weapon_pos = WEAPON_POS_RAISE;
} }
break; break;
case HANDBOMB_WEAPON: case HANDBOMB_WEAPON: