mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-09 20:18:17 +03:00
Fixed mismatched anim methods up to Actor::EventSetSayAnim
This commit is contained in:
parent
ea0c4b5060
commit
ce59e5e6a7
1 changed files with 764 additions and 741 deletions
|
@ -2541,7 +2541,7 @@ CLASS_DECLARATION(SimpleActor, Actor, "Actor") {
|
||||||
{&EV_Actor_GetVisibilityThreshold, &Actor::EventGetVisibilityThreshold },
|
{&EV_Actor_GetVisibilityThreshold, &Actor::EventGetVisibilityThreshold },
|
||||||
{&EV_Actor_SetVisibilityThreshold, &Actor::EventSetVisibilityThreshold },
|
{&EV_Actor_SetVisibilityThreshold, &Actor::EventSetVisibilityThreshold },
|
||||||
{&EV_Actor_SetVisibilityThreshold2, &Actor::EventSetVisibilityThreshold },
|
{&EV_Actor_SetVisibilityThreshold2, &Actor::EventSetVisibilityThreshold },
|
||||||
{&EV_Actor_SetDefaultVisibilityThreshold, &Actor::EventSetDefaultVisibilityThreshold },
|
{&EV_Actor_SetDefaultVisibilityThreshold, &Actor::EventSetDefaultVisibilityThreshold},
|
||||||
{&EV_Actor_GetSuppressChance, &Actor::EventGetSuppressChance },
|
{&EV_Actor_GetSuppressChance, &Actor::EventGetSuppressChance },
|
||||||
{&EV_Actor_SetSuppressChance, &Actor::EventSetSuppressChance },
|
{&EV_Actor_SetSuppressChance, &Actor::EventSetSuppressChance },
|
||||||
{&EV_Actor_SetSuppressChance2, &Actor::EventSetSuppressChance },
|
{&EV_Actor_SetSuppressChance2, &Actor::EventSetSuppressChance },
|
||||||
|
@ -3142,7 +3142,7 @@ void Actor::GetMoveInfo(mmove_t *mm)
|
||||||
PLAYER_BASE_MIN,
|
PLAYER_BASE_MIN,
|
||||||
PLAYER_BASE_MAX,
|
PLAYER_BASE_MAX,
|
||||||
m_Dest - Vector(0, 0, 16384),
|
m_Dest - Vector(0, 0, 16384),
|
||||||
(Entity*)NULL,
|
(Entity *)NULL,
|
||||||
MASK_MOVEINFO,
|
MASK_MOVEINFO,
|
||||||
qfalse,
|
qfalse,
|
||||||
"Actor::GetMoveInfo"
|
"Actor::GetMoveInfo"
|
||||||
|
@ -3150,9 +3150,9 @@ void Actor::GetMoveInfo(mmove_t *mm)
|
||||||
|
|
||||||
DoFailSafeMove(trace.endpos);
|
DoFailSafeMove(trace.endpos);
|
||||||
} else if (mm->hit_temp_obstacle & 1) {
|
} else if (mm->hit_temp_obstacle & 1) {
|
||||||
Player* p;
|
Player *p;
|
||||||
|
|
||||||
p = static_cast<Player*>(G_GetEntity(0));
|
p = static_cast<Player *>(G_GetEntity(0));
|
||||||
|
|
||||||
if (!IsTeamMate(p)) {
|
if (!IsTeamMate(p)) {
|
||||||
if (!m_bEnableEnemy) {
|
if (!m_bEnableEnemy) {
|
||||||
|
@ -3169,10 +3169,10 @@ void Actor::GetMoveInfo(mmove_t *mm)
|
||||||
case ANIM_MODE_PATH_GOAL:
|
case ANIM_MODE_PATH_GOAL:
|
||||||
if (mm->hit_temp_obstacle) {
|
if (mm->hit_temp_obstacle) {
|
||||||
if (mm->hit_temp_obstacle & 1) {
|
if (mm->hit_temp_obstacle & 1) {
|
||||||
Player* p;
|
Player *p;
|
||||||
|
|
||||||
m_Path.Clear();
|
m_Path.Clear();
|
||||||
p = static_cast<Player*>(G_GetEntity(0));
|
p = static_cast<Player *>(G_GetEntity(0));
|
||||||
|
|
||||||
if (!IsTeamMate(p)) {
|
if (!IsTeamMate(p)) {
|
||||||
if (!m_bEnableEnemy) {
|
if (!m_bEnableEnemy) {
|
||||||
|
@ -3190,9 +3190,11 @@ void Actor::GetMoveInfo(mmove_t *mm)
|
||||||
if (level.inttime >= m_Path.Time() + 1000) {
|
if (level.inttime >= m_Path.Time() + 1000) {
|
||||||
m_Path.ReFindPath(origin, this);
|
m_Path.ReFindPath(origin, this);
|
||||||
} else {
|
} else {
|
||||||
PathInfo* node = m_Path.NextNode();
|
PathInfo *node = m_Path.NextNode();
|
||||||
|
|
||||||
if (!node || !m_Path.IsAccurate() && (node == m_Path.LastNode() && m_Path.CurrentNode() != m_Path.StartNode())) {
|
if (!node
|
||||||
|
|| !m_Path.IsAccurate()
|
||||||
|
&& (node == m_Path.LastNode() && m_Path.CurrentNode() != m_Path.StartNode())) {
|
||||||
m_Path.Clear();
|
m_Path.Clear();
|
||||||
VectorClear(velocity);
|
VectorClear(velocity);
|
||||||
return;
|
return;
|
||||||
|
@ -3318,8 +3320,7 @@ void Actor::UpdateBoneControllers(void)
|
||||||
orientation_t tag_or;
|
orientation_t tag_or;
|
||||||
Vector vError;
|
Vector vError;
|
||||||
|
|
||||||
if (g_showlookat->integer == entnum || g_showlookat->integer == -1)
|
if (g_showlookat->integer == entnum || g_showlookat->integer == -1) {
|
||||||
{
|
|
||||||
tagnum = gi.Tag_NumForName(edict->tiki, "eyes bone");
|
tagnum = gi.Tag_NumForName(edict->tiki, "eyes bone");
|
||||||
tag_or = G_TIKI_Orientation(edict, tagnum & TAG_MASK);
|
tag_or = G_TIKI_Orientation(edict, tagnum & TAG_MASK);
|
||||||
AnglesToAxis(angles, myAxis);
|
AnglesToAxis(angles, myAxis);
|
||||||
|
@ -3336,7 +3337,7 @@ void Actor::UpdateBoneControllers(void)
|
||||||
vEndPoint = m_vDesiredLookDest;
|
vEndPoint = m_vDesiredLookDest;
|
||||||
} else if (m_pLookEntity) {
|
} else if (m_pLookEntity) {
|
||||||
if (m_pLookEntity->IsSubclassOfSentient()) {
|
if (m_pLookEntity->IsSubclassOfSentient()) {
|
||||||
Sentient* sent = static_cast<Sentient*>(m_pLookEntity.Pointer());
|
Sentient *sent = static_cast<Sentient *>(m_pLookEntity.Pointer());
|
||||||
vEndPoint = sent->EyePosition();
|
vEndPoint = sent->EyePosition();
|
||||||
} else {
|
} else {
|
||||||
vEndPoint = m_pLookEntity->centroid;
|
vEndPoint = m_pLookEntity->centroid;
|
||||||
|
@ -3461,7 +3462,9 @@ void Actor::UpdateBoneControllers(void)
|
||||||
min_accel_change = m_fTorsoCurrentTurnSpeed - level.frametime * 15;
|
min_accel_change = m_fTorsoCurrentTurnSpeed - level.frametime * 15;
|
||||||
|
|
||||||
max_change = Q_clamp_float(max_change, min_accel_change, max_accel_change);
|
max_change = Q_clamp_float(max_change, min_accel_change, max_accel_change);
|
||||||
max_change = Q_clamp_float(max_change, level.frametime * -m_fTorsoCurrentTurnSpeed, level.frametime * m_fTorsoCurrentTurnSpeed);
|
max_change = Q_clamp_float(
|
||||||
|
max_change, level.frametime * -m_fTorsoCurrentTurnSpeed, level.frametime * m_fTorsoCurrentTurnSpeed
|
||||||
|
);
|
||||||
|
|
||||||
torsoAngles[1] += max_change;
|
torsoAngles[1] += max_change;
|
||||||
|
|
||||||
|
@ -3497,7 +3500,8 @@ void Actor::UpdateBoneControllers(void)
|
||||||
max_change = Q_clamp_float(max_change, yawError, -headAngles[1]);
|
max_change = Q_clamp_float(max_change, yawError, -headAngles[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
max_change = Q_clamp_float(max_change, level.frametime * -m_fHeadMaxTurnSpeed, level.frametime * m_fHeadMaxTurnSpeed);
|
max_change =
|
||||||
|
Q_clamp_float(max_change, level.frametime * -m_fHeadMaxTurnSpeed, level.frametime * m_fHeadMaxTurnSpeed);
|
||||||
|
|
||||||
headAngles[1] += max_change;
|
headAngles[1] += max_change;
|
||||||
// clamp head yaw to 60 degrees
|
// clamp head yaw to 60 degrees
|
||||||
|
@ -3517,7 +3521,8 @@ void Actor::UpdateBoneControllers(void)
|
||||||
max_change = 0;
|
max_change = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_change = Q_clamp_float(max_change, level.frametime * -m_fHeadMaxTurnSpeed, level.frametime * m_fHeadMaxTurnSpeed);
|
max_change =
|
||||||
|
Q_clamp_float(max_change, level.frametime * -m_fHeadMaxTurnSpeed, level.frametime * m_fHeadMaxTurnSpeed);
|
||||||
headAngles[0] += max_change;
|
headAngles[0] += max_change;
|
||||||
// clamp head pitch to 35 degrees
|
// clamp head pitch to 35 degrees
|
||||||
headAngles[0] = Q_clamp_float(headAngles[0], -35, 35);
|
headAngles[0] = Q_clamp_float(headAngles[0], -35, 35);
|
||||||
|
@ -3544,7 +3549,8 @@ void Actor::UpdateBoneControllers(void)
|
||||||
max_change += 360;
|
max_change += 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_change = Q_clamp_float(max_change, level.frametime * -m_fLUpperArmTurnSpeed, level.frametime * m_fLUpperArmTurnSpeed);
|
max_change =
|
||||||
|
Q_clamp_float(max_change, level.frametime * -m_fLUpperArmTurnSpeed, level.frametime * m_fLUpperArmTurnSpeed);
|
||||||
// set the new arms angles
|
// set the new arms angles
|
||||||
new_angles[0] = m_vLUpperArmDesiredAngles[0];
|
new_angles[0] = m_vLUpperArmDesiredAngles[0];
|
||||||
new_angles[1] = tmp_angles[1] + max_change;
|
new_angles[1] = tmp_angles[1] + max_change;
|
||||||
|
@ -3629,7 +3635,8 @@ void Actor::DoMove(void)
|
||||||
mmove_t mm;
|
mmove_t mm;
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
|
||||||
if (m_eAnimMode != ANIM_MODE_ATTACHED && (!m_bDoPhysics || m_iOriginTime == level.inttime || m_pGlueMaster || bindmaster)) {
|
if (m_eAnimMode != ANIM_MODE_ATTACHED
|
||||||
|
&& (!m_bDoPhysics || m_iOriginTime == level.inttime || m_pGlueMaster || bindmaster)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3871,7 +3878,7 @@ bool Actor::CanShoot(Entity *ent)
|
||||||
if (FriendlyInLineOfFire(ent)) {
|
if (FriendlyInLineOfFire(ent)) {
|
||||||
bCanShoot = false;
|
bCanShoot = false;
|
||||||
} else if (ent->IsSubclassOfSentient()) {
|
} else if (ent->IsSubclassOfSentient()) {
|
||||||
Sentient* sen = static_cast<Sentient*>(ent);
|
Sentient *sen = static_cast<Sentient *>(ent);
|
||||||
|
|
||||||
vGunPos = GunPosition();
|
vGunPos = GunPosition();
|
||||||
bCanShoot = false;
|
bCanShoot = false;
|
||||||
|
@ -4001,7 +4008,7 @@ bool Actor::FriendlyInLineOfFire(Entity *other)
|
||||||
delta = other->origin - origin;
|
delta = other->origin - origin;
|
||||||
inverseDot = 1.0 / (delta * delta);
|
inverseDot = 1.0 / (delta * delta);
|
||||||
|
|
||||||
for (Sentient* pSquad = m_pNextSquadMate; pSquad != this; pSquad = pSquad->m_pNextSquadMate) {
|
for (Sentient *pSquad = m_pNextSquadMate; pSquad != this; pSquad = pSquad->m_pNextSquadMate) {
|
||||||
Vector squadDelta;
|
Vector squadDelta;
|
||||||
float squadDot;
|
float squadDot;
|
||||||
|
|
||||||
|
@ -4391,7 +4398,7 @@ void Actor::LookAtLookEntity(void)
|
||||||
Vector dir;
|
Vector dir;
|
||||||
|
|
||||||
if (m_pLookEntity->IsSubclassOfSentient()) {
|
if (m_pLookEntity->IsSubclassOfSentient()) {
|
||||||
Sentient* sen = static_cast<Sentient*>(m_pLookEntity.Pointer());
|
Sentient *sen = static_cast<Sentient *>(m_pLookEntity.Pointer());
|
||||||
dir = sen->EyePosition() - EyePosition();
|
dir = sen->EyePosition() - EyePosition();
|
||||||
} else {
|
} else {
|
||||||
dir = m_pLookEntity->centroid - EyePosition();
|
dir = m_pLookEntity->centroid - EyePosition();
|
||||||
|
@ -4503,19 +4510,19 @@ void Actor::LookAt(Listener *l)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l != this) {
|
if (l != this) {
|
||||||
l = (SimpleEntity*)l;
|
l = (SimpleEntity *)l;
|
||||||
if (g_showlookat->integer == entnum || g_showlookat->integer == -1) {
|
if (g_showlookat->integer == entnum || g_showlookat->integer == -1) {
|
||||||
Com_Printf(
|
Com_Printf(
|
||||||
"Script lookat: %i %i %s looking at point %.0f %.0f %.0f\n",
|
"Script lookat: %i %i %s looking at point %.0f %.0f %.0f\n",
|
||||||
entnum,
|
entnum,
|
||||||
radnum,
|
radnum,
|
||||||
targetname.c_str(),
|
targetname.c_str(),
|
||||||
((SimpleEntity*)l)->origin.x,
|
((SimpleEntity *)l)->origin.x,
|
||||||
((SimpleEntity*)l)->origin.y,
|
((SimpleEntity *)l)->origin.y,
|
||||||
((SimpleEntity*)l)->origin.z
|
((SimpleEntity *)l)->origin.z
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
m_pLookEntity = (SimpleEntity*)l;
|
m_pLookEntity = (SimpleEntity *)l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4648,7 +4655,7 @@ void Actor::PointAt(Listener *l)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l != this) {
|
if (l != this) {
|
||||||
m_pPointEntity = static_cast<SimpleEntity*>(l);
|
m_pPointEntity = static_cast<SimpleEntity *>(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4773,7 +4780,7 @@ void Actor::TurnTo(Listener *l)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pTurnEntity = (SimpleEntity*)l;
|
m_pTurnEntity = (SimpleEntity *)l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4911,14 +4918,14 @@ void Actor::HandlePain(Event *ev)
|
||||||
int i;
|
int i;
|
||||||
Event event(EV_Listener_ExecuteScript);
|
Event event(EV_Listener_ExecuteScript);
|
||||||
int num;
|
int num;
|
||||||
Entity* attacker;
|
Entity *attacker;
|
||||||
|
|
||||||
if (!m_bEnablePain) {
|
if (!m_bEnablePain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
attacker = ev->GetEntity(1);
|
attacker = ev->GetEntity(1);
|
||||||
if (attacker && attacker->IsSubclassOfSentient() && IsTeamMate(static_cast<Sentient*>(attacker))) {
|
if (attacker && attacker->IsSubclassOfSentient() && IsTeamMate(static_cast<Sentient *>(attacker))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4938,7 +4945,7 @@ void Actor::HandlePain(Event *ev)
|
||||||
|
|
||||||
m_PainTime = level.inttime;
|
m_PainTime = level.inttime;
|
||||||
|
|
||||||
if (attacker && attacker->IsSubclassOfSentient() && !IsTeamMate(static_cast<Sentient*>(attacker))) {
|
if (attacker && attacker->IsSubclassOfSentient() && !IsTeamMate(static_cast<Sentient *>(attacker))) {
|
||||||
m_pLastAttacker = attacker;
|
m_pLastAttacker = attacker;
|
||||||
|
|
||||||
m_iCuriousLevel = 9;
|
m_iCuriousLevel = 9;
|
||||||
|
@ -5053,27 +5060,27 @@ Killed event.
|
||||||
*/
|
*/
|
||||||
void Actor::EventKilled(Event *ev)
|
void Actor::EventKilled(Event *ev)
|
||||||
{
|
{
|
||||||
Entity* attacker;
|
Entity *attacker;
|
||||||
Sentient* pBuddy;
|
Sentient *pBuddy;
|
||||||
Sentient* sent;
|
Sentient *sent;
|
||||||
Player* player;
|
Player *player;
|
||||||
|
|
||||||
DispatchEventKilled(ev, true);
|
DispatchEventKilled(ev, true);
|
||||||
|
|
||||||
attacker = ev->GetEntity(1);
|
attacker = ev->GetEntity(1);
|
||||||
if (attacker && attacker->IsSubclassOfPlayer()) {
|
if (attacker && attacker->IsSubclassOfPlayer()) {
|
||||||
player = static_cast<Player*>(attacker);
|
player = static_cast<Player *>(attacker);
|
||||||
if (player->m_Team != m_Team) {
|
if (player->m_Team != m_Team) {
|
||||||
player->m_iNumEnemiesKilled++;
|
player->m_iNumEnemiesKilled++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker && attacker->IsSubclassOfSentient()) {
|
if (attacker && attacker->IsSubclassOfSentient()) {
|
||||||
sent = static_cast<Sentient*>(attacker);
|
sent = static_cast<Sentient *>(attacker);
|
||||||
|
|
||||||
for (pBuddy = level.m_HeadSentient[m_Team]; pBuddy; pBuddy = pBuddy->m_NextSentient) {
|
for (pBuddy = level.m_HeadSentient[m_Team]; pBuddy; pBuddy = pBuddy->m_NextSentient) {
|
||||||
if (pBuddy != this && pBuddy->IsSubclassOfActor()) {
|
if (pBuddy != this && pBuddy->IsSubclassOfActor()) {
|
||||||
Actor* actor = static_cast<Actor*>(pBuddy);
|
Actor *actor = static_cast<Actor *>(pBuddy);
|
||||||
actor->NotifySquadmateKilled(this, sent);
|
actor->NotifySquadmateKilled(this, sent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5244,7 +5251,7 @@ Move on path.
|
||||||
void Actor::MovePath(float fMoveSpeed)
|
void Actor::MovePath(float fMoveSpeed)
|
||||||
{
|
{
|
||||||
mmove_t mm;
|
mmove_t mm;
|
||||||
const float* dir;
|
const float *dir;
|
||||||
vec2_t delta;
|
vec2_t delta;
|
||||||
|
|
||||||
SetMoveInfo(&mm);
|
SetMoveInfo(&mm);
|
||||||
|
@ -5258,7 +5265,7 @@ void Actor::MovePath(float fMoveSpeed)
|
||||||
|
|
||||||
if (ai_debugpath->integer) {
|
if (ai_debugpath->integer) {
|
||||||
Vector pos, dest;
|
Vector pos, dest;
|
||||||
PathInfo* current_path;
|
PathInfo *current_path;
|
||||||
|
|
||||||
pos = origin;
|
pos = origin;
|
||||||
pos.z += 32;
|
pos.z += 32;
|
||||||
|
@ -5312,8 +5319,7 @@ void Actor::MovePath(float fMoveSpeed)
|
||||||
m_WallDir = -1;
|
m_WallDir = -1;
|
||||||
mm.desired_dir[0] = -mm.obstacle_normal[1];
|
mm.desired_dir[0] = -mm.obstacle_normal[1];
|
||||||
mm.desired_dir[1] = mm.obstacle_normal[0];
|
mm.desired_dir[1] = mm.obstacle_normal[0];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mm.desired_dir[0] = mm.obstacle_normal[1];
|
mm.desired_dir[0] = mm.obstacle_normal[1];
|
||||||
mm.desired_dir[1] = -mm.obstacle_normal[0];
|
mm.desired_dir[1] = -mm.obstacle_normal[0];
|
||||||
}
|
}
|
||||||
|
@ -5381,8 +5387,7 @@ void Actor::MovePath(float fMoveSpeed)
|
||||||
m_WallDir = 1;
|
m_WallDir = 1;
|
||||||
mm.desired_dir[0] = mm.obstacle_normal[1];
|
mm.desired_dir[0] = mm.obstacle_normal[1];
|
||||||
mm.desired_dir[1] = -mm.obstacle_normal[0];
|
mm.desired_dir[1] = -mm.obstacle_normal[0];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
m_WallDir = -1;
|
m_WallDir = -1;
|
||||||
mm.desired_dir[0] = -mm.obstacle_normal[1];
|
mm.desired_dir[0] = -mm.obstacle_normal[1];
|
||||||
mm.desired_dir[1] = mm.obstacle_normal[0];
|
mm.desired_dir[1] = mm.obstacle_normal[0];
|
||||||
|
@ -5527,7 +5532,8 @@ Set current mood.
|
||||||
void Actor::EventSetMood(Event *ev)
|
void Actor::EventSetMood(Event *ev)
|
||||||
{
|
{
|
||||||
m_csMood = ev->GetConstString(1);
|
m_csMood = ev->GetConstString(1);
|
||||||
if (m_csMood != STRING_BORED && m_csMood != STRING_NERVOUS && m_csMood != STRING_CURIOUS && m_csMood != STRING_ALERT) {
|
if (m_csMood != STRING_BORED && m_csMood != STRING_NERVOUS && m_csMood != STRING_CURIOUS
|
||||||
|
&& m_csMood != STRING_ALERT) {
|
||||||
m_csMood = STRING_BORED;
|
m_csMood = STRING_BORED;
|
||||||
ScriptError("invalid mood - setting to bored");
|
ScriptError("invalid mood - setting to bored");
|
||||||
}
|
}
|
||||||
|
@ -5594,8 +5600,8 @@ Set current weapon's aim tagret.
|
||||||
*/
|
*/
|
||||||
void Actor::EventSetAimTarget(Event *ev)
|
void Actor::EventSetAimTarget(Event *ev)
|
||||||
{
|
{
|
||||||
Entity* ent;
|
Entity *ent;
|
||||||
Weapon* weap;
|
Weapon *weap;
|
||||||
|
|
||||||
ent = ev->GetEntity(1);
|
ent = ev->GetEntity(1);
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
|
@ -5611,7 +5617,7 @@ void Actor::EventSetAimTarget(Event *ev)
|
||||||
// Added in 2.0
|
// Added in 2.0
|
||||||
// Make the ent an enemy
|
// Make the ent an enemy
|
||||||
if (ev->NumArgs() > 1 && ev->GetInteger(2) == 1 && ent->IsSubclassOfSentient()) {
|
if (ev->NumArgs() > 1 && ev->GetInteger(2) == 1 && ent->IsSubclassOfSentient()) {
|
||||||
SetEnemy(static_cast<Sentient*>(ent), false);
|
SetEnemy(static_cast<Sentient *>(ent), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5785,7 +5791,7 @@ void Actor::SetPatrolCurrentNode(Listener *l)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_patrolCurrentNode = static_cast<SimpleEntity*>(l);
|
m_patrolCurrentNode = static_cast<SimpleEntity *>(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5877,9 +5883,9 @@ Move on path with squad.
|
||||||
*/
|
*/
|
||||||
bool Actor::MoveOnPathWithSquad(void)
|
bool Actor::MoveOnPathWithSquad(void)
|
||||||
{
|
{
|
||||||
const float* pvMyDir, *pvHisDir;
|
const float *pvMyDir, *pvHisDir;
|
||||||
vec2_t vDelta;
|
vec2_t vDelta;
|
||||||
Sentient* pSquadMate;
|
Sentient *pSquadMate;
|
||||||
float fIntervalSquared;
|
float fIntervalSquared;
|
||||||
vec2_t vMyNormalDir;
|
vec2_t vMyNormalDir;
|
||||||
float fDistSquared;
|
float fDistSquared;
|
||||||
|
@ -5898,7 +5904,7 @@ bool Actor::MoveOnPathWithSquad(void)
|
||||||
fIntervalSquared *= 2;
|
fIntervalSquared *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSquadMate = static_cast<Sentient*>(G_GetEntity(0));
|
pSquadMate = static_cast<Sentient *>(G_GetEntity(0));
|
||||||
|
|
||||||
if (IsTeamMate(pSquadMate)) {
|
if (IsTeamMate(pSquadMate)) {
|
||||||
VectorSub2D(pSquadMate->origin, origin, vDelta);
|
VectorSub2D(pSquadMate->origin, origin, vDelta);
|
||||||
|
@ -5920,7 +5926,7 @@ bool Actor::MoveOnPathWithSquad(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor* pActorSquadMate = static_cast<Actor*>(pSquadMate);
|
Actor *pActorSquadMate = static_cast<Actor *>(pSquadMate);
|
||||||
|
|
||||||
VectorSub2D(pActorSquadMate->origin, origin, vDelta);
|
VectorSub2D(pActorSquadMate->origin, origin, vDelta);
|
||||||
fDistSquared = VectorLength2DSquared(vDelta);
|
fDistSquared = VectorLength2DSquared(vDelta);
|
||||||
|
@ -5964,7 +5970,7 @@ bool Actor::MoveToWaypointWithPlayer(void)
|
||||||
float fIntervalSquared;
|
float fIntervalSquared;
|
||||||
vec2_t vMyNormalDir;
|
vec2_t vMyNormalDir;
|
||||||
float fDistSquared;
|
float fDistSquared;
|
||||||
Sentient* pSquadMate;
|
Sentient *pSquadMate;
|
||||||
|
|
||||||
if (level.inttime < m_iSquadStandTime + 500) {
|
if (level.inttime < m_iSquadStandTime + 500) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -5975,13 +5981,12 @@ bool Actor::MoveToWaypointWithPlayer(void)
|
||||||
fIntervalSquared += fIntervalSquared;
|
fIntervalSquared += fIntervalSquared;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSquadMate = static_cast<Sentient*>(G_GetEntity(0));
|
pSquadMate = static_cast<Sentient *>(G_GetEntity(0));
|
||||||
if (!IsTeamMate(pSquadMate)) {
|
if (!IsTeamMate(pSquadMate)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
vDelta[0] = pSquadMate->origin[0] - origin[0];
|
VectorSub2D(pSquadMate->origin, origin, vDelta);
|
||||||
vDelta[1] = pSquadMate->origin[1] - origin[1];
|
|
||||||
fDistSquared = VectorLength2DSquared(vDelta);
|
fDistSquared = VectorLength2DSquared(vDelta);
|
||||||
|
|
||||||
if (fDistSquared >= fIntervalSquared) {
|
if (fDistSquared >= fIntervalSquared) {
|
||||||
|
@ -6091,8 +6096,7 @@ bool Actor::MoveToPatrolCurrentNode(void)
|
||||||
vec2_t delta;
|
vec2_t delta;
|
||||||
VectorSub2D(m_patrolCurrentNode->origin, origin, delta);
|
VectorSub2D(m_patrolCurrentNode->origin, origin, delta);
|
||||||
return VectorLength2DSquared(delta) <= m_fMoveDoneRadiusSquared;
|
return VectorLength2DSquared(delta) <= m_fMoveDoneRadiusSquared;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
SetPath(m_patrolCurrentNode->origin, "Actor::MoveToPatrolCurrentNode", 0, NULL, 0);
|
SetPath(m_patrolCurrentNode->origin, "Actor::MoveToPatrolCurrentNode", 0, NULL, 0);
|
||||||
|
|
||||||
if (!PathExists()) {
|
if (!PathExists()) {
|
||||||
|
@ -6422,7 +6426,7 @@ Actor::DetectSmokeGrenades
|
||||||
*/
|
*/
|
||||||
void Actor::DetectSmokeGrenades(void)
|
void Actor::DetectSmokeGrenades(void)
|
||||||
{
|
{
|
||||||
SmokeSprite* sprite;
|
SmokeSprite *sprite;
|
||||||
|
|
||||||
if (m_Enemy) {
|
if (m_Enemy) {
|
||||||
return;
|
return;
|
||||||
|
@ -6436,7 +6440,17 @@ void Actor::DetectSmokeGrenades(void)
|
||||||
eyePos = VirtualEyePosition();
|
eyePos = VirtualEyePosition();
|
||||||
fDistSquared = (sprite->origin - eyePos).lengthSquared();
|
fDistSquared = (sprite->origin - eyePos).lengthSquared();
|
||||||
if (fDistSquared > 65536 || InFOV(sprite->origin) == true) {
|
if (fDistSquared > 65536 || InFOV(sprite->origin) == true) {
|
||||||
if (G_SightTrace(eyePos, vec_zero, vec_zero, sprite->origin, this, NULL, MASK_CANSEE, qfalse, "Actor::DetectSmokeGrenades")) {
|
if (G_SightTrace(
|
||||||
|
eyePos,
|
||||||
|
vec_zero,
|
||||||
|
vec_zero,
|
||||||
|
sprite->origin,
|
||||||
|
this,
|
||||||
|
NULL,
|
||||||
|
MASK_CANSEE,
|
||||||
|
qfalse,
|
||||||
|
"Actor::DetectSmokeGrenades"
|
||||||
|
)) {
|
||||||
m_PotentialEnemies.ConfirmEnemy(this, sprite->owner);
|
m_PotentialEnemies.ConfirmEnemy(this, sprite->owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6523,78 +6537,54 @@ Set animation event.
|
||||||
*/
|
*/
|
||||||
void Actor::EventSetAnim(Event *ev)
|
void Actor::EventSetAnim(Event *ev)
|
||||||
{
|
{
|
||||||
//"anim slot weight flagged"
|
const_str name = 0;
|
||||||
int numArgs = ev->NumArgs(), slot = 0, animnum;
|
|
||||||
float weight = 1;
|
float weight = 1;
|
||||||
const_str anim, flagVal;
|
int slot = 0;
|
||||||
qboolean flagged = qfalse;
|
int anim;
|
||||||
|
const_str flagVal;
|
||||||
|
qboolean flagged;
|
||||||
|
|
||||||
//FIXME: better notation, but this works for now.
|
switch (ev->NumArgs()) {
|
||||||
if (numArgs < 1 || numArgs > 4) {
|
case 4:
|
||||||
ScriptError("bad number of arguments");
|
|
||||||
} else if (numArgs == 1) {
|
|
||||||
anim = ev->GetConstString(1);
|
|
||||||
animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(anim).c_str());
|
|
||||||
if (animnum == -1) {
|
|
||||||
UnknownAnim(Director.GetString(anim).c_str(), edict->tiki);
|
|
||||||
}
|
|
||||||
} else if (numArgs == 2) {
|
|
||||||
anim = ev->GetConstString(1);
|
|
||||||
animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(anim).c_str());
|
|
||||||
if (animnum == -1) {
|
|
||||||
UnknownAnim(Director.GetString(anim).c_str(), edict->tiki);
|
|
||||||
}
|
|
||||||
slot = ev->GetInteger(2);
|
|
||||||
if (slot > 2) {
|
|
||||||
ScriptError("Bad animation slot, only 0 and 1 supported");
|
|
||||||
}
|
|
||||||
} else if (numArgs == 3) {
|
|
||||||
weight = ev->GetFloat(3);
|
|
||||||
if (weight < 0) {
|
|
||||||
ScriptError("Negative anim weight not allowed");
|
|
||||||
}
|
|
||||||
if (weight != 0) {
|
|
||||||
slot = ev->GetInteger(2);
|
|
||||||
if (slot > 2) {
|
|
||||||
ScriptError("Bad animation slot, only 0 and 1 supported");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anim = ev->GetConstString(1);
|
|
||||||
animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(anim).c_str());
|
|
||||||
if (animnum == -1) {
|
|
||||||
UnknownAnim(Director.GetString(anim).c_str(), edict->tiki);
|
|
||||||
}
|
|
||||||
} else if (numArgs == 4) {
|
|
||||||
flagVal = ev->GetConstString(4);
|
flagVal = ev->GetConstString(4);
|
||||||
flagged = qtrue;
|
flagged = qtrue;
|
||||||
if (flagVal != STRING_FLAGGED) {
|
if (flagVal != STRING_FLAGGED) {
|
||||||
ScriptError("unknown keyword '%s', expected 'flagged'", Director.GetString(flagVal).c_str());
|
ScriptError("unknown keyword '%s', expected 'flagged'", Director.GetString(flagVal).c_str());
|
||||||
}
|
}
|
||||||
|
case 3:
|
||||||
weight = ev->GetFloat(3);
|
weight = ev->GetFloat(3);
|
||||||
if (weight < 0) {
|
if (weight < 0) {
|
||||||
ScriptError("Negative anim weight not allowed");
|
ScriptError("Negative anim weight not allowed");
|
||||||
}
|
}
|
||||||
if (weight != 0) {
|
|
||||||
|
if (!weight) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
slot = ev->GetInteger(2);
|
slot = ev->GetInteger(2);
|
||||||
if (slot > 2) {
|
if (slot > 2) {
|
||||||
ScriptError("Bad animation slot, only 0 and 1 supported");
|
ScriptError("Bad animation slot, only 0 and 1 supported");
|
||||||
}
|
}
|
||||||
|
case 1:
|
||||||
|
name = ev->GetConstString(1);
|
||||||
|
anim = gi.Anim_NumForName(edict->tiki, Director.GetString(name).c_str());
|
||||||
|
if (anim == -1) {
|
||||||
|
UnknownAnim(Director.GetString(name).c_str(), edict->tiki);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
anim = ev->GetConstString(1);
|
default:
|
||||||
animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(anim).c_str());
|
ScriptError("bad number of arguments");
|
||||||
if (animnum == -1) {
|
break;
|
||||||
UnknownAnim(Director.GetString(anim).c_str(), edict->tiki);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!slot) {
|
if (!slot) {
|
||||||
flagged = qtrue;
|
flagged = qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flagged) {
|
if (flagged) {
|
||||||
parm.motionfail = qtrue;
|
parm.motionfail = qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_bLevelMotionAnim) {
|
if (!m_bLevelMotionAnim) {
|
||||||
if (slot) {
|
if (slot) {
|
||||||
m_weightType[GetMotionSlot(slot)] = 0;
|
m_weightType[GetMotionSlot(slot)] = 0;
|
||||||
|
@ -6602,7 +6592,8 @@ void Actor::EventSetAnim(Event *ev)
|
||||||
ChangeMotionAnim();
|
ChangeMotionAnim();
|
||||||
m_bMotionAnimSet = true;
|
m_bMotionAnimSet = true;
|
||||||
}
|
}
|
||||||
StartMotionAnimSlot(slot, animnum, weight);
|
|
||||||
|
StartMotionAnimSlot(slot, anim, weight);
|
||||||
if (flagged) {
|
if (flagged) {
|
||||||
m_iMotionSlot = GetMotionSlot(slot);
|
m_iMotionSlot = GetMotionSlot(slot);
|
||||||
parm.motionfail = qfalse;
|
parm.motionfail = qfalse;
|
||||||
|
@ -6635,26 +6626,31 @@ Set motion animation.
|
||||||
*/
|
*/
|
||||||
void Actor::EventSetMotionAnim(Event *ev)
|
void Actor::EventSetMotionAnim(Event *ev)
|
||||||
{
|
{
|
||||||
gi.DPrintf("Actor::EventSetMotionAnim\n");
|
int anim;
|
||||||
|
const_str name;
|
||||||
|
|
||||||
if (ev->NumArgs() != 1) {
|
if (ev->NumArgs() != 1) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
const_str anim = ev->GetConstString(1);
|
|
||||||
str animstr = Director.GetString(anim);
|
name = ev->GetConstString(1);
|
||||||
int animnum = gi.Anim_NumForName(edict->tiki, animstr.c_str());
|
anim = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
if (animnum == -1) {
|
|
||||||
UnknownAnim(animstr.c_str(), edict->tiki);
|
if (anim == -1) {
|
||||||
|
UnknownAnim(Director.GetString(name), edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
gi.DPrintf("Actor::EventSetMotionAnim %s %d\n", animstr.c_str(), animnum);
|
|
||||||
parm.motionfail = qtrue;
|
parm.motionfail = qtrue;
|
||||||
|
|
||||||
if (!m_bLevelMotionAnim) {
|
if (!m_bLevelMotionAnim) {
|
||||||
ChangeMotionAnim();
|
ChangeMotionAnim();
|
||||||
|
|
||||||
|
// start the animation
|
||||||
m_bMotionAnimSet = true;
|
m_bMotionAnimSet = true;
|
||||||
StartMotionAnimSlot(0, animnum, 1.0);
|
StartMotionAnimSlot(0, anim, 1.0);
|
||||||
|
// set the slot
|
||||||
m_iMotionSlot = GetMotionSlot(0);
|
m_iMotionSlot = GetMotionSlot(0);
|
||||||
|
|
||||||
parm.motionfail = qfalse;
|
parm.motionfail = qfalse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6668,41 +6664,43 @@ Set aim motion animation.
|
||||||
*/
|
*/
|
||||||
void Actor::EventSetAimMotionAnim(Event *ev)
|
void Actor::EventSetAimMotionAnim(Event *ev)
|
||||||
{
|
{
|
||||||
int anim_crouch, anim_stand, anim_high;
|
|
||||||
const_str name;
|
const_str name;
|
||||||
|
int anim_crouch, anim_stand, anim_high;
|
||||||
|
|
||||||
if (ev->NumArgs() != 3) {
|
if (ev->NumArgs() != 3) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: maybe inline func ?
|
|
||||||
|
|
||||||
name = ev->GetConstString(1);
|
name = ev->GetConstString(1);
|
||||||
anim_crouch = gi.Anim_NumForName(edict->tiki, Director.GetString(name).c_str());
|
anim_crouch = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
if (anim_crouch == -1) {
|
if (anim_crouch == -1) {
|
||||||
UnknownAnim(Director.GetString(name).c_str(), edict->tiki);
|
UnknownAnim(Director.GetString(name), edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = ev->GetConstString(2);
|
name = ev->GetConstString(2);
|
||||||
anim_stand = gi.Anim_NumForName(edict->tiki, Director.GetString(name).c_str());
|
anim_stand = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
if (anim_stand == -1) {
|
if (anim_stand == -1) {
|
||||||
UnknownAnim(Director.GetString(name).c_str(), edict->tiki);
|
UnknownAnim(Director.GetString(name), edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = ev->GetConstString(3);
|
name = ev->GetConstString(3);
|
||||||
anim_high = gi.Anim_NumForName(edict->tiki, Director.GetString(name).c_str());
|
anim_high = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
if (anim_high == -1) {
|
if (anim_high == -1) {
|
||||||
UnknownAnim(Director.GetString(name).c_str(), edict->tiki);
|
UnknownAnim(Director.GetString(name), edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
parm.motionfail = qtrue;
|
parm.motionfail = qtrue;
|
||||||
|
|
||||||
if (!m_bLevelMotionAnim) {
|
if (!m_bLevelMotionAnim) {
|
||||||
ChangeMotionAnim();
|
ChangeMotionAnim();
|
||||||
|
|
||||||
m_bMotionAnimSet = true;
|
m_bMotionAnimSet = true;
|
||||||
UpdateAimMotion();
|
UpdateAimMotion();
|
||||||
|
|
||||||
StartAimMotionAnimSlot(0, anim_crouch);
|
StartAimMotionAnimSlot(0, anim_crouch);
|
||||||
StartAimMotionAnimSlot(1, anim_stand);
|
StartAimMotionAnimSlot(1, anim_stand);
|
||||||
StartAimMotionAnimSlot(2, anim_high);
|
StartAimMotionAnimSlot(2, anim_high);
|
||||||
|
|
||||||
m_iMotionSlot = GetMotionSlot(1);
|
m_iMotionSlot = GetMotionSlot(1);
|
||||||
parm.motionfail = qfalse;
|
parm.motionfail = qfalse;
|
||||||
}
|
}
|
||||||
|
@ -6717,12 +6715,17 @@ Set action animation.
|
||||||
*/
|
*/
|
||||||
void Actor::EventSetActionAnim(Event *ev)
|
void Actor::EventSetActionAnim(Event *ev)
|
||||||
{
|
{
|
||||||
|
const_str name;
|
||||||
|
int anim_forward, anim_up, anim_down;
|
||||||
|
str derivedName;
|
||||||
|
|
||||||
if (ev->NumArgs() != 3) {
|
if (ev->NumArgs() != 3) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name = ev->GetConstString(1);
|
||||||
m_fAimLimit_down = ev->GetFloat(2);
|
m_fAimLimit_down = ev->GetFloat(2);
|
||||||
if (m_fAimLimit_down > 0) {
|
if (m_fAimLimit_down >= 0) {
|
||||||
m_fAimLimit_down = -0.001f;
|
m_fAimLimit_down = -0.001f;
|
||||||
ScriptError("Positive lower_limit not allowed");
|
ScriptError("Positive lower_limit not allowed");
|
||||||
}
|
}
|
||||||
|
@ -6733,22 +6736,21 @@ void Actor::EventSetActionAnim(Event *ev)
|
||||||
ScriptError("Negative upper_limit not allowed");
|
ScriptError("Negative upper_limit not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
const_str anim = ev->GetConstString(1);
|
anim_forward = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
int animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(anim).c_str());
|
if (anim_forward == -1) {
|
||||||
if (animnum == -1) {
|
UnknownAnim(Director.GetString(name), edict->tiki);
|
||||||
UnknownAnim(Director.GetString(anim).c_str(), edict->tiki);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_str anim2 = ev->GetConstString(2);
|
derivedName = Director.GetString(name) + "_up";
|
||||||
int animnum2 = gi.Anim_NumForName(edict->tiki, Director.GetString(anim2));
|
anim_up = gi.Anim_NumForName(edict->tiki, derivedName);
|
||||||
if (animnum2 == -1) {
|
if (anim_up == -1) {
|
||||||
UnknownAnim(Director.GetString(anim2).c_str(), edict->tiki);
|
UnknownAnim(derivedName, edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
const_str anim3 = ev->GetConstString(3);
|
derivedName = Director.GetString(name) + "_down";
|
||||||
int animnum3 = gi.Anim_NumForName(edict->tiki, Director.GetString(anim3));
|
anim_down = gi.Anim_NumForName(edict->tiki, derivedName);
|
||||||
if (animnum3 == -1) {
|
if (anim_down == -1) {
|
||||||
UnknownAnim(Director.GetString(anim3).c_str(), edict->tiki);
|
UnknownAnim(derivedName, edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
parm.upperfail = qtrue;
|
parm.upperfail = qtrue;
|
||||||
|
@ -6758,9 +6760,9 @@ void Actor::EventSetActionAnim(Event *ev)
|
||||||
m_bActionAnimSet = true;
|
m_bActionAnimSet = true;
|
||||||
UpdateAim();
|
UpdateAim();
|
||||||
|
|
||||||
StartAimAnimSlot(0, animnum);
|
StartAimAnimSlot(0, anim_up);
|
||||||
StartAimAnimSlot(1, anim2);
|
StartAimAnimSlot(1, anim_forward);
|
||||||
StartAimAnimSlot(2, anim3);
|
StartAimAnimSlot(2, anim_down);
|
||||||
m_iActionSlot = GetActionSlot(0);
|
m_iActionSlot = GetActionSlot(0);
|
||||||
parm.upperfail = qfalse;
|
parm.upperfail = qfalse;
|
||||||
}
|
}
|
||||||
|
@ -6775,17 +6777,21 @@ Set upper body.
|
||||||
*/
|
*/
|
||||||
void Actor::EventUpperAnim(Event *ev)
|
void Actor::EventUpperAnim(Event *ev)
|
||||||
{
|
{
|
||||||
|
int anim;
|
||||||
|
const_str name;
|
||||||
|
|
||||||
if (ev->NumArgs()) {
|
if (ev->NumArgs()) {
|
||||||
if (ev->NumArgs() != 1) {
|
if (ev->NumArgs() != 1) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
const_str anim = ev->GetConstString(1);
|
|
||||||
int animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(anim).c_str());
|
name = ev->GetConstString(1);
|
||||||
if (animnum == -1) {
|
anim = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
UnknownAnim(Director.GetString(anim).c_str(), edict->tiki);
|
if (anim == -1) {
|
||||||
|
UnknownAnim(Director.GetString(name), edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_csUpperAnim = anim;
|
m_csUpperAnim = name;
|
||||||
} else if (m_bLevelActionAnim) {
|
} else if (m_bLevelActionAnim) {
|
||||||
AnimFinished(m_iActionSlot, true);
|
AnimFinished(m_iActionSlot, true);
|
||||||
}
|
}
|
||||||
|
@ -6800,21 +6806,24 @@ Set upper body animation.
|
||||||
*/
|
*/
|
||||||
void Actor::EventSetUpperAnim(Event *ev)
|
void Actor::EventSetUpperAnim(Event *ev)
|
||||||
{
|
{
|
||||||
|
int anim;
|
||||||
|
const_str name;
|
||||||
|
|
||||||
if (ev->NumArgs() != 1) {
|
if (ev->NumArgs() != 1) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
const_str anim = ev->GetConstString(1);
|
name = ev->GetConstString(1);
|
||||||
int animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(anim).c_str());
|
anim = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
if (animnum == -1) {
|
if (anim == -1) {
|
||||||
UnknownAnim(Director.GetString(anim).c_str(), edict->tiki);
|
UnknownAnim(Director.GetString(name), edict->tiki);
|
||||||
}
|
}
|
||||||
|
|
||||||
parm.upperfail = qtrue;
|
parm.upperfail = qtrue;
|
||||||
if (!m_bLevelActionAnim) {
|
if (!m_bLevelActionAnim) {
|
||||||
ChangeActionAnim();
|
ChangeActionAnim();
|
||||||
m_bActionAnimSet = true;
|
m_bActionAnimSet = true;
|
||||||
StartActionAnimSlot(animnum);
|
StartActionAnimSlot(anim);
|
||||||
m_iActionSlot = SimpleActor::GetActionSlot(0);
|
m_iActionSlot = SimpleActor::GetActionSlot(0);
|
||||||
parm.upperfail = qfalse;
|
parm.upperfail = qfalse;
|
||||||
}
|
}
|
||||||
|
@ -6829,12 +6838,14 @@ Returns true if animation not found.
|
||||||
*/
|
*/
|
||||||
bool Actor::SoundSayAnim(const_str name, byte bLevelSayAnim)
|
bool Actor::SoundSayAnim(const_str name, byte bLevelSayAnim)
|
||||||
{
|
{
|
||||||
int animnum = gi.Anim_NumForName(edict->tiki, Director.GetString(name).c_str());
|
if (gi.Anim_NumForName(edict->tiki, Director.GetString(name).c_str()) != -1) {
|
||||||
if (animnum == -1) {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ChangeSayAnim();
|
ChangeSayAnim();
|
||||||
m_bSayAnimSet = true;
|
m_bSayAnimSet = true;
|
||||||
m_iSaySlot = -2;
|
|
||||||
m_bLevelSayAnim = bLevelSayAnim;
|
m_bLevelSayAnim = bLevelSayAnim;
|
||||||
|
m_iSaySlot = -2;
|
||||||
|
|
||||||
Com_Printf(
|
Com_Printf(
|
||||||
"Couldn't find animation '%s' in '%s' - trying sound alias instead.\n",
|
"Couldn't find animation '%s' in '%s' - trying sound alias instead.\n",
|
||||||
|
@ -6845,8 +6856,6 @@ bool Actor::SoundSayAnim(const_str name, byte bLevelSayAnim)
|
||||||
Sound(Director.GetString(name), 0, 0, 0, NULL, 0, 1, 1, -1);
|
Sound(Director.GetString(name), 0, 0, 0, NULL, 0, 1, 1, -1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6859,26 +6868,22 @@ Play idle say dialogue.
|
||||||
void Actor::EventIdleSayAnim(Event *ev)
|
void Actor::EventIdleSayAnim(Event *ev)
|
||||||
{
|
{
|
||||||
const_str name;
|
const_str name;
|
||||||
if (ev->NumArgs()) {
|
|
||||||
|
if (!ev->NumArgs() && m_bLevelSayAnim == 1) {
|
||||||
|
AnimFinished(m_iSaySlot, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ev->NumArgs() != 1) {
|
if (ev->NumArgs() != 1) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
name = ev->GetConstString(1);
|
name = ev->GetConstString(1);
|
||||||
|
|
||||||
if (m_ThinkState <= THINKSTATE_ATTACK || IsGrenadeState(m_ThinkState)) {
|
if (m_ThinkState == THINKSTATE_KILLED || m_ThinkState == THINKSTATE_PAIN || m_ThinkState == THINKSTATE_ATTACK
|
||||||
|
|| m_ThinkState == THINKSTATE_BADPLACE || !SoundSayAnim(name, 1)) {
|
||||||
m_csSayAnim = name;
|
m_csSayAnim = name;
|
||||||
//FIXME: macro
|
|
||||||
m_bNextLevelSayAnim = 1;
|
m_bNextLevelSayAnim = 1;
|
||||||
} else {
|
|
||||||
if (!SoundSayAnim(name, 1)) {
|
|
||||||
m_csSayAnim = name;
|
|
||||||
//FIXME: macro
|
|
||||||
m_bNextLevelSayAnim = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (m_bLevelSayAnim == 1) {
|
|
||||||
AnimFinished(m_iSaySlot, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6892,25 +6897,22 @@ Play idle dialogue.
|
||||||
void Actor::EventSayAnim(Event *ev)
|
void Actor::EventSayAnim(Event *ev)
|
||||||
{
|
{
|
||||||
const_str name;
|
const_str name;
|
||||||
if (ev->NumArgs()) {
|
|
||||||
|
if (!ev->NumArgs() && m_bLevelSayAnim) {
|
||||||
|
AnimFinished(m_iSaySlot, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ev->NumArgs() != 1) {
|
if (ev->NumArgs() != 1) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
name = ev->GetConstString(1);
|
name = ev->GetConstString(1);
|
||||||
|
|
||||||
if (m_ThinkState <= THINKSTATE_KILLED || !SoundSayAnim(name, 2)) {
|
if (m_ThinkState == THINKSTATE_KILLED || m_ThinkState == THINKSTATE_PAIN || !SoundSayAnim(name, 2)) {
|
||||||
m_csSayAnim = name;
|
m_csSayAnim = name;
|
||||||
//FIXME: macro
|
|
||||||
m_bNextLevelSayAnim = 2;
|
m_bNextLevelSayAnim = 2;
|
||||||
gi.DPrintf("Actor::EventSayAnim: 1 %s\n", targetname.c_str());
|
|
||||||
}
|
}
|
||||||
gi.DPrintf("Actor::EventSayAnim: 2 %s\n", targetname.c_str());
|
|
||||||
} else if (m_bLevelSayAnim == 1) {
|
|
||||||
AnimFinished(m_iSaySlot, true);
|
|
||||||
gi.DPrintf("Actor::EventSayAnim: 3 %s\n", targetname.c_str());
|
|
||||||
}
|
|
||||||
gi.DPrintf("Actor::EventSayAnim: 4 %s\n", targetname.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6922,29 +6924,45 @@ Set say animation.
|
||||||
*/
|
*/
|
||||||
void Actor::EventSetSayAnim(Event *ev)
|
void Actor::EventSetSayAnim(Event *ev)
|
||||||
{
|
{
|
||||||
|
int anim;
|
||||||
|
int animflags;
|
||||||
const_str name;
|
const_str name;
|
||||||
str sName;
|
|
||||||
if (ev->NumArgs() != 1) {
|
if (ev->NumArgs() != 1) {
|
||||||
ScriptError("bad number of arguments");
|
ScriptError("bad number of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bLevelSayAnim == 0) {
|
if (m_bLevelSayAnim) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
name = ev->GetConstString(1);
|
name = ev->GetConstString(1);
|
||||||
|
|
||||||
parm.sayfail = qtrue;
|
parm.sayfail = qtrue;
|
||||||
sName = Director.GetString(name);
|
anim = gi.Anim_NumForName(edict->tiki, Director.GetString(name));
|
||||||
int animnum = gi.Anim_NumForName(edict->tiki, sName.c_str());
|
|
||||||
|
|
||||||
Com_Printf("EventSetSayAnim sName: %s, animnum: %d, mVoiceType: %d\n", sName.c_str(), animnum, mVoiceType);
|
if (anim == -1) {
|
||||||
if (!SoundSayAnim(name, m_bLevelSayAnim)) {
|
ChangeSayAnim();
|
||||||
int flags = gi.Anim_FlagsSkel(edict->tiki, animnum);
|
m_bSayAnimSet = true;
|
||||||
if (flags & TAF_HASUPPER) {
|
m_iSaySlot = -2;
|
||||||
|
|
||||||
|
Com_Printf(
|
||||||
|
"Couldn't find animation '%s' in '%s' - trying sound alias instead.\n",
|
||||||
|
Director.GetString(name),
|
||||||
|
edict->tiki->a->name
|
||||||
|
);
|
||||||
|
Sound(Director.GetString(name), CHAN_AUTO, 0, 0, NULL, 0, 0, true, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
animflags = gi.Anim_FlagsSkel(edict->tiki, anim);
|
||||||
|
if (animflags & TAF_HASUPPER) {
|
||||||
if (m_bLevelActionAnim) {
|
if (m_bLevelActionAnim) {
|
||||||
if (!m_bSayAnimSet) {
|
if (!m_bSayAnimSet) {
|
||||||
m_iSaySlot = m_iActionSlot;
|
m_iSaySlot = m_iActionSlot;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TAF_HASDELTA) {
|
if (flags & TAF_HASDELTA) {
|
||||||
if (m_bLevelMotionAnim) {
|
if (m_bLevelMotionAnim) {
|
||||||
if (!m_bSayAnimSet) {
|
if (!m_bSayAnimSet) {
|
||||||
|
@ -6952,29 +6970,30 @@ void Actor::EventSetSayAnim(Event *ev)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeActionAnim();
|
ChangeActionAnim();
|
||||||
ChangeMotionAnim();
|
ChangeMotionAnim();
|
||||||
StartMotionAnimSlot(0, animnum, 1.0);
|
StartMotionAnimSlot(0, anim, 1.0);
|
||||||
|
|
||||||
m_iMotionSlot = m_iActionSlot = GetMotionSlot(0);
|
m_iMotionSlot = m_iActionSlot = GetMotionSlot(0);
|
||||||
} else {
|
} else {
|
||||||
ChangeActionAnim();
|
ChangeActionAnim();
|
||||||
m_bActionAnimSet = true;
|
m_bActionAnimSet = true;
|
||||||
StartActionAnimSlot(animnum);
|
StartActionAnimSlot(anim);
|
||||||
m_iActionSlot = GetActionSlot(0);
|
m_iActionSlot = GetActionSlot(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeSayAnim();
|
ChangeSayAnim();
|
||||||
m_bSayAnimSet = true;
|
m_bSayAnimSet = true;
|
||||||
m_iSaySlot = m_iActionSlot;
|
m_iSaySlot = m_iActionSlot;
|
||||||
} else {
|
} else {
|
||||||
ChangeSayAnim();
|
ChangeSayAnim();
|
||||||
m_bSayAnimSet = true;
|
m_bSayAnimSet = true;
|
||||||
StartSayAnimSlot(animnum);
|
StartSayAnimSlot(anim);
|
||||||
m_iSaySlot = GetSaySlot();
|
m_iSaySlot = GetSaySlot();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
parm.sayfail = qfalse;
|
parm.sayfail = qfalse;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6987,7 +7006,7 @@ Change current animation.
|
||||||
|
|
||||||
void Actor::ChangeAnim(void)
|
void Actor::ChangeAnim(void)
|
||||||
{
|
{
|
||||||
bool v3; // zf
|
bool v3;
|
||||||
|
|
||||||
if (m_pAnimThread) {
|
if (m_pAnimThread) {
|
||||||
if (g_scripttrace->integer) {
|
if (g_scripttrace->integer) {
|
||||||
|
@ -8727,12 +8746,9 @@ void Actor::DefaultReceiveAIEvent(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (originator
|
if (originator && !originator->IsDead() && originator->IsSubclassOfSentient()
|
||||||
&& !originator->IsDead()
|
&& ((Sentient *)originator)->m_Team == m_Team && !IsSquadMate((Sentient *)originator)) {
|
||||||
&& originator->IsSubclassOfSentient()
|
MergeWithSquad((Sentient *)originator);
|
||||||
&& ((Sentient*)originator)->m_Team == m_Team
|
|
||||||
&& !IsSquadMate((Sentient*)originator)) {
|
|
||||||
MergeWithSquad((Sentient*)originator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (iType) {
|
switch (iType) {
|
||||||
|
@ -8770,7 +8786,7 @@ void Actor::DefaultReceiveAIEvent(
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
char assertStr[16317] = { 0 };
|
char assertStr[16317] = {0};
|
||||||
strcpy(assertStr, "\"unknown ai_event type\"\n\tMessage: ");
|
strcpy(assertStr, "\"unknown ai_event type\"\n\tMessage: ");
|
||||||
Q_strcat(assertStr, sizeof(assertStr), DumpCallTrace("iType = %i", iType));
|
Q_strcat(assertStr, sizeof(assertStr), DumpCallTrace("iType = %i", iType));
|
||||||
assert(false && assertStr);
|
assert(false && assertStr);
|
||||||
|
@ -8869,8 +8885,7 @@ void Actor::CuriousSound(int iType, vec3_t sound_origin, float fDistSquared, flo
|
||||||
float v7, v8, fRangeFactor = 1.0;
|
float v7, v8, fRangeFactor = 1.0;
|
||||||
int iPriority;
|
int iPriority;
|
||||||
if (m_bEnableEnemy) {
|
if (m_bEnableEnemy) {
|
||||||
if (m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_IDLE
|
if (m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_IDLE || m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_CURIOUS) {
|
||||||
|| m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_CURIOUS) {
|
|
||||||
//FIXME: name variables.
|
//FIXME: name variables.
|
||||||
if (fMaxDistSquared != 0.0) {
|
if (fMaxDistSquared != 0.0) {
|
||||||
v7 = 1 * (1.0 / 3) - fDistSquared * (1 * (1.0 / 3)) / fMaxDistSquared;
|
v7 = 1 * (1.0 / 3) - fDistSquared * (1 * (1.0 / 3)) / fMaxDistSquared;
|
||||||
|
@ -9007,8 +9022,7 @@ Handles footstep sound.
|
||||||
void Actor::FootstepSound(vec3_t sound_origin, float fDistSquared, float fMaxDistSquared, Entity *originator)
|
void Actor::FootstepSound(vec3_t sound_origin, float fDistSquared, float fMaxDistSquared, Entity *originator)
|
||||||
{
|
{
|
||||||
if (originator->IsSubclassOfSentient()) {
|
if (originator->IsSubclassOfSentient()) {
|
||||||
if ((m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_IDLE
|
if ((m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_IDLE || m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_CURIOUS)
|
||||||
|| m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_CURIOUS)
|
|
||||||
&& m_bEnableEnemy) {
|
&& m_bEnableEnemy) {
|
||||||
if (NoticeFootstep((Sentient *)originator)) {
|
if (NoticeFootstep((Sentient *)originator)) {
|
||||||
CuriousSound(AI_EVENT_FOOTSTEP, sound_origin, fDistSquared, fMaxDistSquared);
|
CuriousSound(AI_EVENT_FOOTSTEP, sound_origin, fDistSquared, fMaxDistSquared);
|
||||||
|
@ -11696,7 +11710,13 @@ void Actor::SetNationality(Event *ev)
|
||||||
str name;
|
str name;
|
||||||
|
|
||||||
if (ev->NumArgs() != 1) {
|
if (ev->NumArgs() != 1) {
|
||||||
ScriptError("Bad bad nationality specified for '%s' at (%f %f %f)\n", TargetName().c_str(), origin[0], origin[1], origin[2]);
|
ScriptError(
|
||||||
|
"Bad bad nationality specified for '%s' at (%f %f %f)\n",
|
||||||
|
TargetName().c_str(),
|
||||||
|
origin[0],
|
||||||
|
origin[1],
|
||||||
|
origin[2]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = ev->GetString(1);
|
name = ev->GetString(1);
|
||||||
|
@ -11714,7 +11734,10 @@ void Actor::SetNationality(Event *ev)
|
||||||
} else if (!str::icmpn(name, "ussr", 5)) {
|
} else if (!str::icmpn(name, "ussr", 5)) {
|
||||||
m_iNationality = ACTOR_NATIONALITY_RUSSIAN;
|
m_iNationality = ACTOR_NATIONALITY_RUSSIAN;
|
||||||
} else {
|
} else {
|
||||||
ScriptError("Bad bad nationality specified for '%s', must be one of: ger, it, usa, uk, ussr or default\n", TargetName().c_str());
|
ScriptError(
|
||||||
|
"Bad bad nationality specified for '%s', must be one of: ger, it, usa, uk, ussr or default\n",
|
||||||
|
TargetName().c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue