mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-15 23:21:46 +00:00
bc63b70d88
Conflicts: src/actor.h src/fragglescript/t_func.cpp src/g_doom/a_bossbrain.cpp src/g_doom/a_revenant.cpp src/g_heretic/a_hereticartifacts.cpp src/g_heretic/a_hereticweaps.cpp src/g_heretic/a_knight.cpp src/g_hexen/a_bishop.cpp src/g_hexen/a_clericholy.cpp src/g_hexen/a_dragon.cpp src/g_hexen/a_firedemon.cpp src/g_hexen/a_flechette.cpp src/g_hexen/a_heresiarch.cpp src/g_hexen/a_hexenspecialdecs.cpp src/g_hexen/a_iceguy.cpp src/g_hexen/a_korax.cpp src/g_hexen/a_magelightning.cpp src/g_hexen/a_serpent.cpp src/g_hexen/a_spike.cpp src/g_hexen/a_wraith.cpp src/g_raven/a_minotaur.cpp src/g_shared/a_bridge.cpp src/g_shared/a_pickups.cpp src/g_shared/a_randomspawner.cpp src/g_strife/a_alienspectres.cpp src/g_strife/a_crusader.cpp src/g_strife/a_entityboss.cpp src/g_strife/a_inquisitor.cpp src/g_strife/a_loremaster.cpp src/g_strife/a_programmer.cpp src/g_strife/a_sentinel.cpp src/g_strife/a_spectral.cpp src/g_strife/a_strifestuff.cpp src/g_strife/a_strifeweapons.cpp src/g_strife/a_thingstoblowup.cpp src/p_local.h src/r_utility.cpp
109 lines
2.5 KiB
C++
109 lines
2.5 KiB
C++
/*
|
|
#include "actor.h"
|
|
#include "gi.h"
|
|
#include "m_random.h"
|
|
#include "s_sound.h"
|
|
#include "d_player.h"
|
|
#include "a_action.h"
|
|
#include "a_pickups.h"
|
|
#include "p_local.h"
|
|
#include "a_sharedglobal.h"
|
|
#include "p_enemy.h"
|
|
#include "d_event.h"
|
|
#include "gstrings.h"
|
|
#include "thingdef/thingdef.h"
|
|
*/
|
|
|
|
static FRandom pr_snoutattack ("SnoutAttack");
|
|
static FRandom pr_pigattack ("PigAttack");
|
|
static FRandom pr_pigplayerthink ("PigPlayerThink");
|
|
|
|
extern void AdjustPlayerAngle (AActor *, AActor *);
|
|
|
|
// Pig player ---------------------------------------------------------------
|
|
|
|
class APigPlayer : public APlayerPawn
|
|
{
|
|
DECLARE_CLASS (APigPlayer, APlayerPawn)
|
|
public:
|
|
void MorphPlayerThink ();
|
|
};
|
|
|
|
IMPLEMENT_CLASS (APigPlayer)
|
|
|
|
void APigPlayer::MorphPlayerThink ()
|
|
{
|
|
if (player->morphTics & 15)
|
|
{
|
|
return;
|
|
}
|
|
if(!(velx | vely) && pr_pigplayerthink() < 64)
|
|
{ // Snout sniff
|
|
if (player->ReadyWeapon != NULL)
|
|
{
|
|
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState("Grunt"));
|
|
}
|
|
S_Sound (this, CHAN_VOICE, "PigActive1", 1, ATTN_NORM); // snort
|
|
return;
|
|
}
|
|
if (pr_pigplayerthink() < 48)
|
|
{
|
|
S_Sound (this, CHAN_VOICE, "PigActive", 1, ATTN_NORM);
|
|
}
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_SnoutAttack
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack)
|
|
{
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
angle_t angle;
|
|
int damage;
|
|
int slope;
|
|
player_t *player;
|
|
AActor *puff;
|
|
AActor *linetarget;
|
|
|
|
if (NULL == (player = self->player))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
damage = 3+(pr_snoutattack()&3);
|
|
angle = player->mo->angle;
|
|
slope = P_AimLineAttack(player->mo, angle, MELEERANGE, &linetarget);
|
|
puff = P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "SnoutPuff", true, &linetarget);
|
|
S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM);
|
|
if(linetarget)
|
|
{
|
|
AdjustPlayerAngle(player->mo, linetarget);
|
|
if(puff != NULL)
|
|
{ // Bit something
|
|
S_Sound(player->mo, CHAN_VOICE, "PigAttack", 1, ATTN_NORM);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_PigPain
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_PigPain)
|
|
{
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
CALL_ACTION(A_Pain, self);
|
|
if (self->Z() <= self->floorz)
|
|
{
|
|
self->velz = FRACUNIT*7/2;
|
|
}
|
|
return 0;
|
|
}
|