A_GiveWeapon is an action that gives the target player one or more weapon panels and plays the actor's SeeSound
. Var1 determines the weapon flag number according to the list below. The flag values can be combined to give the player multiple weapon panels at once. Note that this action only gives the ability to use the weapons; it does not supply the ammo for them.
Code – A_GiveWeapon
|
|
// Function: A_GiveWeapon
//
// Description: Gives the player the specified weapon panels.
//
// var1 = Weapon index #
// var2 = unused
//
void A_GiveWeapon(mobj_t *actor)
{
player_t *player;
INT32 locvar1 = var1;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_GiveWeapon", actor))
return;
#endif
if (!actor->target || !actor->target->player)
{
CONS_Debug(DBG_GAMELOGIC, "Powerup has no target.\n");
return;
}
if (locvar1 >= 1<<(NUM_WEAPONS-1))
{
CONS_Debug(DBG_GAMELOGIC, "Weapon #%d out of range!\n", locvar1);
return;
}
player = actor->target->player;
player->ringweapons |= locvar1;
if (actor->info->seesound)
S_StartSound(player->mo, actor->info->seesound);
}
|
|