diff --git a/etmain/animations/human/base/body.aninc b/etmain/animations/human/base/body.aninc index 97a4ade2d..0f7b65130 100644 --- a/etmain/animations/human/base/body.aninc +++ b/etmain/animations/human/base/body.aninc @@ -6,9 +6,9 @@ death_rifle_head_2 33 52 0 20 0 0 0 dead_rifle_head_2 84 1 1 20 0 0 0 death_machinegun_2 85 38 0 20 0 0 0 - dead_machinegun_2 122 1 1 20 0 0 0 + dead_machinegun_2 122 1 1 20 0 0 0 // same as dead_machinegun_1 death_gut 130 41 0 20 0 0 0 - dead_gut 170 1 1 20 0 0 0 + dead_gut 170 1 1 20 0 0 0 // same as dead_machinegun_1 wounded_idle_1 173 144 144 20 0 0 0 diff --git a/etmain/animations/scripts/human_base.script b/etmain/animations/scripts/human_base.script index 5fc763c05..456b8e70a 100644 --- a/etmain/animations/scripts/human_base.script +++ b/etmain/animations/scripts/human_base.script @@ -94,6 +94,11 @@ STATE COMBAT { dead { + suicide + { + both dead_rifle_head_2 + } + default { both dead_machinegun_1 @@ -3041,6 +3046,11 @@ climbdismount DEATH { + suicide + { + both death_rifle_head_2 + } + enemy_weapon knives, enemy_position behind { both death_machinegun_1 diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 895cdf619..5cfccf31b 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -2472,6 +2472,8 @@ void CG_AnimPlayerConditions(bg_character_t *character, centity_t *cent) } BG_UpdateConditionValue(es->clientNum, ANIM_COND_IMPACT_POINT, IMPACTPOINT_UNUSED, qtrue); + BG_UpdateConditionValue(es->clientNum, ANIM_COND_STUNNED, 0, qtrue); + BG_UpdateConditionValue(es->clientNum, ANIM_COND_SUICIDE, 0, qtrue); } /** diff --git a/src/game/bg_animation.c b/src/game/bg_animation.c index bd6c0b748..dcf482355 100644 --- a/src/game/bg_animation.c +++ b/src/game/bg_animation.c @@ -256,7 +256,7 @@ typedef struct animStringItem_t *values; } animConditionTable_t; -static animStringItem_t animConditionsStr[] = +static animStringItem_t animConditionsStr[NUM_ANIM_CONDITIONS + 1] = { { "WEAPONS", -1 }, { "ENEMY_POSITION", -1 }, @@ -279,6 +279,7 @@ static animStringItem_t animConditionsStr[] = { "FLAILING_TYPE", -1 }, { "GEN_BITFLAG", -1 }, { "AISTATE", -1 }, + { "SUICIDE", -1 }, { NULL, -1 }, }; @@ -306,6 +307,7 @@ static animConditionTable_t animConditionsTable[NUM_ANIM_CONDITIONS] = { ANIM_CONDTYPE_VALUE, animFlailTypeStr }, { ANIM_CONDTYPE_BITFLAGS, animGenBitFlagStr }, { ANIM_CONDTYPE_VALUE, animAIStateStr }, + { ANIM_CONDTYPE_VALUE, NULL }, }; //------------------------------------------------------------ @@ -1997,4 +1999,6 @@ void BG_AnimUpdatePlayerStateConditions(pmove_t *pmove) } BG_UpdateConditionValue(ps->clientNum, ANIM_COND_IMPACT_POINT, IMPACTPOINT_UNUSED, qtrue); + BG_UpdateConditionValue(ps->clientNum, ANIM_COND_STUNNED, 0, qtrue); + BG_UpdateConditionValue(ps->clientNum, ANIM_COND_SUICIDE, 0, qtrue); } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index a59ecffbd..b272fa144 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -619,7 +619,7 @@ typedef struct // callbacks to test the world // these will be different functions during game and cgame - void (*trace)(trace_t * results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask); + void (*trace)(trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask); int (*pointcontents)(const vec3_t point, int passEntityNum); /// used to determine if the player move is for prediction if it is, the movement should trigger no events @@ -628,7 +628,7 @@ typedef struct } pmove_t; // if a full pmove isn't done on the client, you can just update the angles -void PM_UpdateViewAngles(playerState_t *ps, pmoveExt_t *pmext, usercmd_t *cmd, void (trace) (trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int tracemask); +void PM_UpdateViewAngles(playerState_t *ps, pmoveExt_t *pmext, usercmd_t *cmd, void(trace) (trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int tracemask); int Pmove(pmove_t *pmove); void PmovePredict(pmove_t *pmove, float frametime); @@ -2186,6 +2186,7 @@ typedef enum ANIM_COND_FLAILING_TYPE, ANIM_COND_GEN_BITFLAG, ///< general bit flags (to save some space) ANIM_COND_AISTATE, ///< our current ai state (sometimes more convenient than creating a separate section) + ANIM_COND_SUICIDE, NUM_ANIM_CONDITIONS } scriptAnimConditions_t; @@ -2903,8 +2904,8 @@ typedef enum popupMessageBigType_e #define HITBOXBIT_LEGS 2048 #define HITBOXBIT_CLIENT 4096 -void PM_TraceLegs(trace_t *trace, float *legsOffset, vec3_t start, vec3_t end, trace_t *bodytrace, vec3_t viewangles, void (tracefunc)(trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int ignoreent, int tracemask); -void PM_TraceHead(trace_t *trace, vec3_t start, vec3_t end, trace_t *bodytrace, vec3_t viewangles, void (tracefunc)(trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int ignoreent, int tracemask); +void PM_TraceLegs(trace_t *trace, float *legsOffset, vec3_t start, vec3_t end, trace_t *bodytrace, vec3_t viewangles, void(tracefunc)(trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int ignoreent, int tracemask); +void PM_TraceHead(trace_t *trace, vec3_t start, vec3_t end, trace_t *bodytrace, vec3_t viewangles, void(tracefunc)(trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int ignoreent, int tracemask); void PM_TraceAllParts(trace_t *trace, float *legsOffset, vec3_t start, vec3_t end); void PM_TraceAll(trace_t *trace, vec3_t start, vec3_t end); diff --git a/src/game/g_combat.c b/src/game/g_combat.c index db9c0efee..6d34156b5 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -636,6 +636,9 @@ void player_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int // set enemy location BG_UpdateConditionValue(self->s.number, ANIM_COND_ENEMY_POSITION, 0, qfalse); + // play specific anim on suicide + BG_UpdateConditionValue(self->s.number, ANIM_COND_SUICIDE, meansOfDeath == MOD_SUICIDE, qtrue); + // FIXME: add POSITION_RIGHT, POSITION_LEFT if (infront(self, inflictor)) { @@ -1537,13 +1540,20 @@ void G_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t BG_UpdateConditionValue(targ->client->ps.clientNum, ANIM_COND_IMPACT_POINT, (rand() + 1) ? IMPACTPOINT_SHOULDER_RIGHT : IMPACTPOINT_SHOULDER_LEFT, qtrue); BG_AnimScriptEvent(&targ->client->ps, targ->client->pers.character->animModelInfo, ANIM_ET_PAIN, qfalse, qtrue); } - else if (targ->client && targ->health > 0 && GetMODTableData(mod)->isHeadshot) + else if (targ->client && targ->health > 0) { - G_LogRegionHit(attacker, HR_BODY); - hr = HR_BODY; - if (g_debugBullets.integer) + if (GetMODTableData(mod)->isHeadshot) + { + G_LogRegionHit(attacker, HR_BODY); + hr = HR_BODY; + if (g_debugBullets.integer) + { + trap_SendServerCommand(attacker - g_entities, "print \"Body Shot\n\""); + } + } + else if (GetMODTableData(mod)->isExplosive) { - trap_SendServerCommand(attacker - g_entities, "print \"Body Shot\n\""); + BG_UpdateConditionValue(targ->client->ps.clientNum, ANIM_COND_STUNNED, 1, qtrue); } BG_AnimScriptEvent(&targ->client->ps, targ->client->pers.character->animModelInfo, ANIM_ET_PAIN, qfalse, qtrue);