From 27a16fb1fa69d458fb10e6437eb07b85496b46b8 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 9 Sep 2013 00:42:43 +0200 Subject: 0.1.2 and code cleanup --- src/game/bg_misc.c | 13 +++++++++++-- src/game/bg_public.h | 3 ++- src/game/g_active.c | 7 ++++--- src/game/g_cmds.c | 11 +++++++++++ src/game/g_combat.c | 48 ++++++++++++++++++++++++++++-------------------- 5 files changed, 56 insertions(+), 26 deletions(-) (limited to 'src/game') diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 58152f4..3b667a9 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2997,6 +2997,7 @@ char *eventnames[ ] = "EV_FALLING", "EV_JUMP", + "EV_JETJUMP", "EV_WATER_TOUCH", // foot touches "EV_WATER_LEAVE", // foot leaves "EV_WATER_UNDER", // head touches @@ -3048,6 +3049,7 @@ char *eventnames[ ] = "EV_BUILD_REPAIRED", // buildable has full health "EV_HUMAN_BUILDABLE_EXPLOSION", "EV_ALIEN_BUILDABLE_EXPLOSION", + "EV_CUBOID_EXPLOSION", "EV_ALIEN_ACIDTUBE", "EV_MEDKIT_USED", @@ -3066,9 +3068,16 @@ char *eventnames[ ] = "EV_DCC_ATTACK", // dcc under attack "EV_MGTURRET_SPINUP", // trigger a sound - + "EV_MGTURRET_KILL", + "EV_RPTUSE_SOUND", // trigger a sound - "EV_LEV2_ZAP" + "EV_LEV2_ZAP", + + "EV_ALIEN_HATCH", + "EV_ALIEN_HATCH_FAILURE", + + "EV_JETPACK_DEACTIVATE", + "EV_JETPACK_REFUEL" }; /* diff --git a/src/game/bg_public.h b/src/game/bg_public.h index d24f105..4411940 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -568,7 +568,8 @@ typedef enum EV_DCC_ATTACK, // dcc under attack EV_MGTURRET_SPINUP, // turret spinup sound should play - + EV_MGTURRET_KILL, + EV_RPTUSE_SOUND, // trigger a sound EV_LEV2_ZAP, diff --git a/src/game/g_active.c b/src/game/g_active.c index a65d9f2..42e8199 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -747,12 +747,13 @@ void ClientTimerActions( gentity_t *ent, int msec ) ent->health < ent->client->ps.stats[ STAT_MAX_HEALTH ] ) { float hp, dmod; - - dmod = MIN( level.time - ent->lastDamageTime, 3000 ) / 3000.0f; + + dmod = MAX( MIN( level.time - ent->lastDamageTime - 2000, 3000 ) / 3000.0f, 0 ); + hp = (float)ent->health / ent->client->ps.stats[ STAT_MAX_HEALTH ]; ent->client->bioresHealTimer += (BIORES_EQUATION) * 10 * dmod; } - + if( ent->client->bioresHealTimer >= 100 ) { int delta; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 3406f4e..aebb975 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -3269,6 +3269,16 @@ void Cmd_Damage_f( gentity_t *ent ) ( nonloc ? DAMAGE_NO_LOCDAMAGE : 0 ), MOD_TARGET_LASER ); } +/* +================= +Cmd_Debug1_f +================= +*/ +void Cmd_Debug1_f( gentity_t *ent ) +{ + AddScore( ent, random() * 15000.0f ); +} + /* ================== G_FloodLimited @@ -3314,6 +3324,7 @@ commands_t cmds[ ] = { { "cb", 0, Cmd_Cb_f }, //NOTE: it's a command used only by cgame { "class", CMD_TEAM, Cmd_Class_f }, { "damage", CMD_CHEAT|CMD_LIVING, Cmd_Damage_f }, + { "debug1", CMD_CHEAT, Cmd_Debug1_f }, { "deconstruct", CMD_TEAM|CMD_LIVING, Cmd_Destroy_f }, { "destroy", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Destroy_f }, { "follow", CMD_SPEC, Cmd_Follow_f }, diff --git a/src/game/g_combat.c b/src/game/g_combat.c index c381f91..b5963ab 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -313,31 +313,39 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int self->enemy = attacker; self->client->ps.persistant[ PERS_KILLED ]++; - if( attacker && attacker->client ) + if( attacker ) { - attacker->client->lastkilled_client = self->s.number; - - if( ( attacker == self || OnSameTeam( self, attacker ) ) && meansOfDeath != MOD_HSPAWN ) + if ( attacker->client ) { - //punish team kills and suicides - if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) - { - G_AddCreditToClient( attacker->client, -ALIEN_TK_SUICIDE_PENALTY, qtrue ); - AddScore( attacker, -ALIEN_TK_SUICIDE_PENALTY ); - } - else if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + attacker->client->lastkilled_client = self->s.number; + + if( ( attacker == self || OnSameTeam( self, attacker ) ) && meansOfDeath != MOD_HSPAWN ) { - G_AddCreditToClient( attacker->client, -HUMAN_TK_SUICIDE_PENALTY, qtrue ); - AddScore( attacker, -HUMAN_TK_SUICIDE_PENALTY ); + //punish team kills and suicides + if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + { + G_AddCreditToClient( attacker->client, -ALIEN_TK_SUICIDE_PENALTY, qtrue ); + AddScore( attacker, -ALIEN_TK_SUICIDE_PENALTY ); + } + else if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + { + G_AddCreditToClient( attacker->client, -HUMAN_TK_SUICIDE_PENALTY, qtrue ); + AddScore( attacker, -HUMAN_TK_SUICIDE_PENALTY ); + } } } - } - else if( attacker->s.eType != ET_BUILDABLE ) - { - if( self->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) - AddScore( self, -ALIEN_TK_SUICIDE_PENALTY ); - else if( self->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) - AddScore( self, -HUMAN_TK_SUICIDE_PENALTY ); + else if( attacker->s.eType == ET_BUILDABLE ) + { + if( attacker->s.modelindex == BA_H_MGTURRET ) + G_TempEntity( attacker->s.origin, EV_MGTURRET_KILL ); //FIXME: G_AddEvent doesn't work + } + else + { + if( self->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + AddScore( self, -ALIEN_TK_SUICIDE_PENALTY ); + else if( self->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + AddScore( self, -HUMAN_TK_SUICIDE_PENALTY ); + } } // give credits for killing this player -- cgit