mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- P_ProcessWeapon transitioned.
This commit is contained in:
parent
244826cfa0
commit
4ecee598af
6 changed files with 175 additions and 1731 deletions
|
@ -103,6 +103,8 @@ int doincrements_d(struct player_struct* p);
|
|||
int doincrements_r(struct player_struct* p);
|
||||
void checkweapons_d(struct player_struct* p);
|
||||
void checkweapons_r(struct player_struct* p);
|
||||
void processinput_d(int snum);
|
||||
void processinput_r(int snum);
|
||||
|
||||
|
||||
|
||||
|
@ -151,6 +153,7 @@ void SetDispatcher()
|
|||
selectweapon_d,
|
||||
doincrements_d,
|
||||
checkweapons_d,
|
||||
processinput_d,
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -194,6 +197,7 @@ void SetDispatcher()
|
|||
selectweapon_r,
|
||||
doincrements_r,
|
||||
checkweapons_r,
|
||||
processinput_r
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -531,8 +531,7 @@ struct Dispatcher
|
|||
void (*selectweapon)(int snum, int j);
|
||||
int (*doincrements)(struct player_struct* p);
|
||||
void (*checkweapons)(struct player_struct* p);
|
||||
|
||||
|
||||
void (*processinput)(int snum);
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -2498,6 +2498,87 @@ static void operateweapon(int snum, int sb_snum, int psect)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this function exists because gotos suck. :P
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void processweapon(int snum, int sb_snum, int psect)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
int pi = p->i;
|
||||
auto s = &sprite[pi];
|
||||
int shrunk = (s->yrepeat < 32);
|
||||
|
||||
if (isNamWW2GI() && (sb_snum & SKB_HOLSTER)) // 'Holster Weapon
|
||||
{
|
||||
if (isWW2GI())
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, pi, snum);
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, pi, snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], pi, snum);
|
||||
OnEvent(EVENT_HOLSTER, pi, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pi, snum) == 0)
|
||||
{
|
||||
|
||||
// now it uses the game definitions...
|
||||
if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_HOLSTER_CLEARS_CLIP)
|
||||
{
|
||||
if (p->ammo_amount[p->curr_weapon] > aplWeaponClip[p->curr_weapon][snum]
|
||||
&& (p->ammo_amount[p->curr_weapon] % aplWeaponClip[p->curr_weapon][snum]) != 0)
|
||||
{
|
||||
// throw away the remaining clip
|
||||
p->ammo_amount[p->curr_weapon] -=
|
||||
p->ammo_amount[p->curr_weapon] % aplWeaponClip[p->curr_weapon][snum];
|
||||
// p->kickback_pic = aplWeaponFireDelay[p->curr_weapon][snum]+1; // animate, but don't shoot...
|
||||
p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum] + 1; // animate, but don't shoot...
|
||||
sb_snum &= ~SKB_FIRE; // not firing...
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p->curr_weapon == PISTOL_WEAPON)
|
||||
{
|
||||
if (p->ammo_amount[PISTOL_WEAPON] > 20)
|
||||
{
|
||||
// throw away the remaining clip
|
||||
p->ammo_amount[PISTOL_WEAPON] -= p->ammo_amount[PISTOL_WEAPON] % 20;
|
||||
p->kickback_pic = 3; // animate, but don't shoot...
|
||||
sb_snum &= ~SKB_FIRE; // not firing...
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isWW2GI() && (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_GLOWS))
|
||||
p->random_club_frame += 64; // Glowing
|
||||
|
||||
if (!isWW2GI() && (p->curr_weapon == SHRINKER_WEAPON || p->curr_weapon == GROW_WEAPON))
|
||||
p->random_club_frame += 64; // Glowing
|
||||
|
||||
if (p->rapid_fire_hold == 1)
|
||||
{
|
||||
if (sb_snum & SKB_FIRE) return;
|
||||
p->rapid_fire_hold = 0;
|
||||
}
|
||||
|
||||
if (shrunk || p->tipincs || p->access_incs)
|
||||
sb_snum &= ~SKB_FIRE;
|
||||
else if (shrunk == 0 && (sb_snum & SKB_FIRE) && p->kickback_pic == 0 && p->fist_incs == 0 &&
|
||||
p->last_weapon == -1 && (p->weapon_pos == 0 || p->holster_weapon == 1))
|
||||
{
|
||||
if (!isWW2GI()) fireweapon(snum);
|
||||
else fireweapon_ww(snum);
|
||||
}
|
||||
else if (p->kickback_pic)
|
||||
{
|
||||
if (!isWW2GI()) operateweapon(snum, sb_snum, psect);
|
||||
else operateweapon_ww(snum, sb_snum, psect);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -2670,8 +2751,8 @@ void processinput_d(int snum)
|
|||
|
||||
fi.doincrements(p);
|
||||
|
||||
if (isWW2GI() && aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) goto SHOOTINCODE;
|
||||
if (!isWW2GI() && p->curr_weapon == HANDREMOTE_WEAPON) goto SHOOTINCODE;
|
||||
if (isWW2GI() && aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) processweapon(snum, sb_snum, psect);
|
||||
if (!isWW2GI() && p->curr_weapon == HANDREMOTE_WEAPON) processweapon(snum, sb_snum, psect);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3082,80 +3163,12 @@ HORIZONLY:
|
|||
}
|
||||
|
||||
// HACKS
|
||||
|
||||
SHOOTINCODE:
|
||||
//g_kb = p->kickback_pic;
|
||||
//g_currentweapon = p->curr_weapon;
|
||||
//#define WEAPON2_CLIP 20
|
||||
// reload clip
|
||||
if (isNamWW2GI() && (sb_snum & SKB_HOLSTER)) // 'Holster Weapon
|
||||
{
|
||||
if (isWW2GI())
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, pi, snum);
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, pi, snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], pi, snum);
|
||||
OnEvent(EVENT_HOLSTER, pi, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pi, snum) == 0)
|
||||
{
|
||||
|
||||
// now it uses the game definitions...
|
||||
if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_HOLSTER_CLEARS_CLIP)
|
||||
{
|
||||
if (p->ammo_amount[p->curr_weapon] > aplWeaponClip[p->curr_weapon][snum]
|
||||
&& (p->ammo_amount[p->curr_weapon] % aplWeaponClip[p->curr_weapon][snum]) != 0)
|
||||
{
|
||||
// throw away the remaining clip
|
||||
p->ammo_amount[p->curr_weapon] -=
|
||||
p->ammo_amount[p->curr_weapon] % aplWeaponClip[p->curr_weapon][snum];
|
||||
// p->kickback_pic = aplWeaponFireDelay[p->curr_weapon][snum]+1; // animate, but don't shoot...
|
||||
p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum] + 1; // animate, but don't shoot...
|
||||
sb_snum &= ~SKB_FIRE; // not firing...
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p->curr_weapon == PISTOL_WEAPON)
|
||||
{
|
||||
if (p->ammo_amount[PISTOL_WEAPON] > 20)
|
||||
{
|
||||
// throw away the remaining clip
|
||||
p->ammo_amount[PISTOL_WEAPON] -= p->ammo_amount[PISTOL_WEAPON] % 20;
|
||||
p->kickback_pic = 3; // animate, but don't shoot...
|
||||
sb_snum &= ~SKB_FIRE; // not firing...
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isWW2GI() && (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_GLOWS))
|
||||
p->random_club_frame += 64; // Glowing
|
||||
|
||||
if (!isWW2GI() && (p->curr_weapon == SHRINKER_WEAPON || p->curr_weapon == GROW_WEAPON))
|
||||
p->random_club_frame += 64; // Glowing
|
||||
|
||||
if (p->rapid_fire_hold == 1)
|
||||
{
|
||||
if (sb_snum & SKB_FIRE) return;
|
||||
p->rapid_fire_hold = 0;
|
||||
}
|
||||
|
||||
if (shrunk || p->tipincs || p->access_incs)
|
||||
sb_snum &= ~SKB_FIRE;
|
||||
else if (shrunk == 0 && (sb_snum & SKB_FIRE) && p->kickback_pic == 0 && p->fist_incs == 0 &&
|
||||
p->last_weapon == -1 && (p->weapon_pos == 0 || p->holster_weapon == 1))
|
||||
{
|
||||
if (!isWW2GI()) fireweapon(snum);
|
||||
else fireweapon_ww(snum);
|
||||
}
|
||||
else if (p->kickback_pic)
|
||||
{
|
||||
if (!isWW2GI()) operateweapon(snum, sb_snum, psect);
|
||||
else operateweapon_ww(snum, sb_snum, psect);
|
||||
}
|
||||
processweapon(snum, sb_snum, psect);
|
||||
}
|
||||
|
||||
void processweapon_d(int s, int ss, int p)
|
||||
{
|
||||
processweapon(s, ss, p);
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -1620,29 +1620,29 @@ static void onMotorcycle(int snum, int &sb_snum)
|
|||
if (!A_CheckSoundPlaying(pi, 189) && !A_CheckSoundPlaying(pi, 187))
|
||||
A_PlaySound(187, pi);
|
||||
}
|
||||
if (sb_snum & SK_AIM_UP)
|
||||
if (sb_snum & SKB_AIM_UP)
|
||||
{
|
||||
var6c = 1;
|
||||
sb_snum &= ~SK_AIM_UP;
|
||||
sb_snum &= ~SKB_AIM_UP;
|
||||
}
|
||||
else
|
||||
var6c = 0;
|
||||
if (sb_snum & SK_AIM_DOWN)
|
||||
if (sb_snum & SKB_AIM_DOWN)
|
||||
{
|
||||
var70 = 1;
|
||||
var74 = 1;
|
||||
sb_snum &= ~SK_AIM_DOWN;
|
||||
sb_snum &= ~SKB_AIM_DOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
var70 = 0;
|
||||
var74 = 0;
|
||||
}
|
||||
if (sb_snum & SK_LOOK_LEFT)
|
||||
if (sb_snum & SKB_LOOK_LEFT)
|
||||
{
|
||||
var78 = 1;
|
||||
var7c = 1;
|
||||
sb_snum &= ~SK_LOOK_LEFT;
|
||||
sb_snum &= ~SKB_LOOK_LEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3118,7 +3118,7 @@ static void operateweapon(int snum, int sb_snum, int psect)
|
|||
|
||||
if (p->kickback_pic == 1)
|
||||
{
|
||||
p->ammo_amount[SHRINKER_WEAPON]--;
|
||||
p->ammo_amount[THROWSAW_WEAPON]--;
|
||||
fi.shoot(pi, SHRINKSPARK);
|
||||
checkavailweapon(p);
|
||||
}
|
||||
|
@ -3361,6 +3361,67 @@ static void operateweapon(int snum, int sb_snum, int psect)
|
|||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this function exists because gotos suck. :P
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void processweapon(int snum, int sb_snum, int psect)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
int pi = p->i;
|
||||
auto s = &sprite[pi];
|
||||
int shrunk = (s->yrepeat < 8);
|
||||
|
||||
if (sb_snum & SKB_FIRE)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
if (p->detonate_count > 0)
|
||||
{
|
||||
if (ud.god)
|
||||
{
|
||||
p->detonate_time = 45;
|
||||
p->detonate_count = 0;
|
||||
}
|
||||
else if (p->detonate_time <= 0 && p->kickback_pic < 5)
|
||||
{
|
||||
sound(14);
|
||||
quickkill(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isRRRA() && (p->curr_weapon == KNEE_WEAPON || p->curr_weapon == SLINGBLADE_WEAPON))
|
||||
p->random_club_frame += 64;
|
||||
|
||||
if (p->curr_weapon == THROWSAW_WEAPON || p->curr_weapon == BUZZSAW_WEAPON)
|
||||
p->random_club_frame += 64; // Glowing
|
||||
|
||||
if (p->curr_weapon == TRIPBOMB_WEAPON || p->curr_weapon == BOWLING_WEAPON)
|
||||
p->random_club_frame += 64;
|
||||
|
||||
if (p->rapid_fire_hold == 1)
|
||||
{
|
||||
if (sb_snum & SKB_FIRE) return;
|
||||
p->rapid_fire_hold = 0;
|
||||
}
|
||||
|
||||
if (shrunk || p->tipincs || p->access_incs)
|
||||
sb_snum &= ~SKB_FIRE;
|
||||
else if (shrunk == 0 && (sb_snum & SKB_FIRE) && p->kickback_pic == 0 && p->fist_incs == 0 &&
|
||||
p->last_weapon == -1 && (p->weapon_pos == 0 || p->holster_weapon == 1))
|
||||
{
|
||||
fireweapon(snum);
|
||||
}
|
||||
else if (p->kickback_pic)
|
||||
{
|
||||
operateweapon(snum, sb_snum, psect);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -3375,7 +3436,6 @@ void processinput_r(int snum)
|
|||
short psect, psectlotag, tempsect, pi;
|
||||
struct player_struct* p;
|
||||
spritetype* s;
|
||||
short unk1, unk2;
|
||||
|
||||
p = &ps[snum];
|
||||
pi = p->i;
|
||||
|
@ -3632,8 +3692,7 @@ void processinput_r(int snum)
|
|||
|
||||
fi.doincrements(p);
|
||||
|
||||
if (p->curr_weapon == HANDREMOTE_WEAPON) goto SHOOTINCODE;
|
||||
|
||||
if (p->curr_weapon == HANDREMOTE_WEAPON) processweapon(snum, sb_snum, psect);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4200,53 +4259,13 @@ HORIZONLY:
|
|||
else p->weapon_pos--;
|
||||
}
|
||||
|
||||
// HACKS
|
||||
processweapon(snum, sb_snum, psect);
|
||||
|
||||
SHOOTINCODE:
|
||||
}
|
||||
|
||||
if (p->at57e > 0)
|
||||
{
|
||||
if (ud.god)
|
||||
{
|
||||
p->at57c = 45;
|
||||
p->at57e = 0;
|
||||
}
|
||||
else if (p->at57c <= 0 && p->kickback_pic < 5)
|
||||
{
|
||||
sound(14);
|
||||
quickkill(p);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RRRA
|
||||
|
||||
if (p->curr_weapon == KNEE_WEAPON || p->curr_weapon == SLINGBLADE_WEAPON)
|
||||
p->random_club_frame += 64;
|
||||
#endif
|
||||
|
||||
if (p->curr_weapon == SHRINKER_WEAPON || p->curr_weapon == GROW_WEAPON)
|
||||
p->random_club_frame += 64; // Glowing
|
||||
|
||||
if (p->curr_weapon == TRIPBOMB_WEAPON || p->curr_weapon == BOWLING_WEAPON)
|
||||
p->random_club_frame += 64;
|
||||
|
||||
if (p->rapid_fire_hold == 1)
|
||||
{
|
||||
if (sb_snum & SKB_FIRE) return;
|
||||
p->rapid_fire_hold = 0;
|
||||
}
|
||||
|
||||
if (shrunk || p->tipincs || p->access_incs)
|
||||
sb_snum &= ~SKB_FIRE;
|
||||
else if (shrunk == 0 && (sb_snum & SKB_FIRE) && p->kickback_pic == 0 && p->fist_incs == 0 &&
|
||||
p->last_weapon == -1 && (p->weapon_pos == 0 || p->holster_weapon == 1))
|
||||
{
|
||||
fireweapon(snum);
|
||||
}
|
||||
else if (p->kickback_pic)
|
||||
{
|
||||
operateweapon(snum, sb_snum, psect);
|
||||
}
|
||||
void processweapon_r(int s, int ss, int p)
|
||||
{
|
||||
processweapon(s, ss, p);
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -4364,6 +4364,7 @@ int G_DoMoveThings(void)
|
|||
if (ud.pause_on == 0)
|
||||
{
|
||||
P_ProcessInput(i);
|
||||
//fi.processinput(i);
|
||||
fi.checksectors(i);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue