- renamed a few things.

This commit is contained in:
Christoph Oelckers 2020-10-21 18:42:47 +02:00
parent b1f2475230
commit b8b79b6fa9

View file

@ -85,12 +85,12 @@ void deletesprite(int num)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void addammo(int weapon, struct player_struct* p, int amount) void addammo(int weapon, struct player_struct* player, int amount)
{ {
p->ammo_amount[weapon] += amount; player->ammo_amount[weapon] += amount;
if (p->ammo_amount[weapon] > max_ammo_amount[weapon]) if (player->ammo_amount[weapon] > max_ammo_amount[weapon])
p->ammo_amount[weapon] = max_ammo_amount[weapon]; player->ammo_amount[weapon] = max_ammo_amount[weapon];
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -99,24 +99,24 @@ void addammo(int weapon, struct player_struct* p, int amount)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void checkavailinven(struct player_struct* p) void checkavailinven(struct player_struct* player)
{ {
if (p->firstaid_amount > 0) if (player->firstaid_amount > 0)
p->inven_icon = ICON_FIRSTAID; player->inven_icon = ICON_FIRSTAID;
else if (p->steroids_amount > 0) else if (player->steroids_amount > 0)
p->inven_icon = ICON_STEROIDS; player->inven_icon = ICON_STEROIDS;
else if (p->holoduke_amount > 0) else if (player->holoduke_amount > 0)
p->inven_icon = ICON_HOLODUKE; player->inven_icon = ICON_HOLODUKE;
else if (p->jetpack_amount > 0) else if (player->jetpack_amount > 0)
p->inven_icon = ICON_JETPACK; player->inven_icon = ICON_JETPACK;
else if (p->heat_amount > 0) else if (player->heat_amount > 0)
p->inven_icon = ICON_HEATS; player->inven_icon = ICON_HEATS;
else if (p->scuba_amount > 0) else if (player->scuba_amount > 0)
p->inven_icon = ICON_SCUBA; player->inven_icon = ICON_SCUBA;
else if (p->boot_amount > 0) else if (player->boot_amount > 0)
p->inven_icon = ICON_BOOTS; player->inven_icon = ICON_BOOTS;
else p->inven_icon = ICON_NONE; else player->inven_icon = ICON_NONE;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -125,29 +125,29 @@ void checkavailinven(struct player_struct* p)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void checkavailweapon(struct player_struct* p) void checkavailweapon(struct player_struct* player)
{ {
short i, snum; short i, snum;
int weap; int weap;
if (p->wantweaponfire >= 0) if (player->wantweaponfire >= 0)
{ {
weap = p->wantweaponfire; weap = player->wantweaponfire;
p->wantweaponfire = -1; player->wantweaponfire = -1;
if (weap == p->curr_weapon) return; if (weap == player->curr_weapon) return;
else if (p->gotweapon[weap] && p->ammo_amount[weap] > 0) else if (player->gotweapon[weap] && player->ammo_amount[weap] > 0)
{ {
fi.addweapon(p, weap); fi.addweapon(player, weap);
return; return;
} }
} }
weap = p->curr_weapon; weap = player->curr_weapon;
if (p->gotweapon[weap] && p->ammo_amount[weap] > 0) if (player->gotweapon[weap] && player->ammo_amount[weap] > 0)
return; return;
snum = sprite[p->i].yvel; snum = player->GetPlayerNum();
int max = MAX_WEAPON; int max = MAX_WEAPON;
for (i = 0; i <= max; i++) for (i = 0; i <= max; i++)
@ -158,7 +158,7 @@ void checkavailweapon(struct player_struct* p)
if (weap == 0) weap = max; if (weap == 0) weap = max;
else weap--; else weap--;
if (weap == MIN_WEAPON || (p->gotweapon[weap] && p->ammo_amount[weap] > 0)) if (weap == MIN_WEAPON || (player->gotweapon[weap] && player->ammo_amount[weap] > 0))
break; break;
} }
@ -166,30 +166,30 @@ void checkavailweapon(struct player_struct* p)
// Found the weapon // Found the weapon
p->last_weapon = p->curr_weapon; player->last_weapon = player->curr_weapon;
p->random_club_frame = 0; player->random_club_frame = 0;
p->curr_weapon = weap; player->curr_weapon = weap;
if (isWW2GI()) if (isWW2GI())
{ {
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->i, snum); // snum is playerindex! SetGameVarID(g_iWeaponVarID, player->curr_weapon, player->GetActor(), snum); // snum is playerindex!
if (p->curr_weapon >= 0) if (player->curr_weapon >= 0)
{ {
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum); SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[player->curr_weapon][snum], player->GetActor(), snum);
} }
else else
{ {
SetGameVarID(g_iWorksLikeVarID, -1, p->i, snum); SetGameVarID(g_iWorksLikeVarID, -1, player->GetActor(), snum);
} }
OnEvent(EVENT_CHANGEWEAPON, snum, p->i, -1); OnEvent(EVENT_CHANGEWEAPON, snum, player->i, -1);
} }
p->okickback_pic = p->kickback_pic = 0; player->okickback_pic = player->kickback_pic = 0;
if (p->holster_weapon == 1) if (player->holster_weapon == 1)
{ {
p->holster_weapon = 0; player->holster_weapon = 0;
p->weapon_pos = 10; player->weapon_pos = 10;
} }
else p->weapon_pos = -1; else player->weapon_pos = -1;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------