From 5b6289ef53d06d005e94b20b3d45f7726588de99 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 7 Sep 2013 20:16:57 +0200 Subject: 0.1.1 and asset cleanup --- src/game/bg_misc.c | 83 ++++++++++++++++++++++++++------------------------ src/game/g_buildable.c | 22 +++++++------ src/game/g_weapon.c | 12 +++++--- src/game/tremulous.h | 4 ++- 4 files changed, 67 insertions(+), 54 deletions(-) (limited to 'src/game') diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 5940a57..58152f4 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -816,40 +816,45 @@ const buildableAttributes_t *BG_Buildable( buildable_t buildable, const vec3_t c float volume; vec3_t sorted; - if(buildable>BA_NONE&&buildable BA_NONE && buildable < BA_NUM_BUILDABLES ) + attr = &bg_buildableList[ buildable - 1 ]; else return &nullBuildable; - if(attr->cuboid) + if( attr->cuboid ) { - volume=cuboidSize[0]*cuboidSize[1]*cuboidSize[2]*5.5306341e-5; // NOTE: cubic quake units -> cubic meters ( 1qu = 0.0381m ) - memcpy(&cuboidAttr,attr,sizeof(buildableAttributes_t)); - cuboid=BG_CuboidAttributes(buildable); + volume = cuboidSize[ 0 ] * cuboidSize[ 1 ] * cuboidSize[ 2 ] * 5.5306341e-5; // NOTE: cubic quake units -> cubic meters ( 1qu = 0.0381m ) + memcpy( &cuboidAttr, attr, sizeof( buildableAttributes_t ) ); + cuboid = BG_CuboidAttributes( buildable ); - switch(cuboid->hpt) + switch( cuboid->hpt ) { - case CBHPT_PLAIN: - cuboidAttr.health=ceil(volume*cuboid->hppv); - break; - case CBHPT_CUBES: - BG_CuboidSortSize(cuboidSize,sorted); - cuboidAttr.health=sqrt(sorted[2]*sorted[0])*sqrt(sorted[1]*sorted[0])*(float)sorted[0]*5.5306341e-5*cuboid->hppv; - break; - case CBHPT_PANES: - BG_CuboidSortSize(cuboidSize,sorted); - cuboidAttr.health=(float)sorted[2]*(float)sorted[1]*((float)sorted[0]+(float)sorted[2])/2.0f*5.5306341e-5*cuboid->hppv; - break; + case CBHPT_PLAIN: + cuboidAttr.health = ceil( volume * cuboid->hppv ); + break; + case CBHPT_CUBES: + break; + case CBHPT_PANES: + { + float v2; + + BG_CuboidSortSize( cuboidSize, sorted ); + + v2 = sorted[ 1 ] * sorted [ 1 ] * sorted [ 2 ] * 5.5306341e-5; + + cuboidAttr.health = ceil( sqrt( volume * v2 ) * cuboid->hppv ) ; + } + break; } - if(cuboidAttr.health<1) - cuboidAttr.health=1; - cuboidAttr.splashDamage=0; - cuboidAttr.splashRadius=0; - if(cuboid->regen) - cuboidAttr.regenRate=cuboid->regenrate; - cuboidAttr.buildTime=MAX((float)cuboidAttr.health/(float)cuboid->buildrate*1e3,(float)cuboid->minbt); - cuboidAttr.buildPoints=MAX(ceil((float)cuboidAttr.health/cuboid->hppv*cuboid->bppv),1); + if(cuboidAttr.health < 1) + cuboidAttr.health = 1; + cuboidAttr.splashDamage = 0; + cuboidAttr.splashRadius = 0; + if( cuboid->regen ) + cuboidAttr.regenRate = cuboid->regenrate; + cuboidAttr.buildTime = MAX( (float)cuboidAttr.health / (float)cuboid->buildrate * 1e3, (float)cuboid->minbt ); + cuboidAttr.buildPoints = MAX( ceil( (float)cuboidAttr.health / cuboid->hppv * cuboid->bppv ), 1 ); return &cuboidAttr; } return attr; @@ -4270,11 +4275,11 @@ const cuboidAttributes_t BG_CuboidTypes [] = 1, // int numsounds {0} // float volumes[6] }, // } - 180, // float hppv - CBHPT_CUBES, // int hpt + 80, // float hppv + CBHPT_PLAIN, // int hpt 3.0, // float bppv - 40, // int buildrate - 1500, // int minbt + 20, // int buildrate + 5000, // int minbt qfalse, // qboolean regen; 0, // int regenspeed qfalse, // qboolean zappable @@ -4297,8 +4302,8 @@ const cuboidAttributes_t BG_CuboidTypes [] = 52, // float hppv CBHPT_PANES, // int hpt 1.5, // float bppv - 55, // int buildrate - 1200, // int minbt + 15, // int buildrate + 6500, // int minbt qfalse, // qboolean regen; 0, // int regenspeed qfalse, // qboolean zappable @@ -4321,8 +4326,8 @@ const cuboidAttributes_t BG_CuboidTypes [] = 50, // float hppv CBHPT_PLAIN, // int hpt 4.0, // float bppv - 26, // int buildrate - 1800, // int minbt + 10, // int buildrate + 8000, // int minbt qfalse, // qboolean regen; 0, // int regenspeed qfalse, // qboolean zappable @@ -4342,11 +4347,11 @@ const cuboidAttributes_t BG_CuboidTypes [] = 3, // int numsounds {0,2.0,4.5} // float volumes[6] }, // } - 50, // float hppv + 20, // float hppv CBHPT_PLAIN, // int hpt 1.2, // float bppv - 83, // int buildrate - 750, // int minbt + 35, // int buildrate + 3750, // int minbt qtrue, // qboolean regen; 45, // int regenspeed qfalse, // qboolean zappable @@ -4369,8 +4374,8 @@ const cuboidAttributes_t BG_CuboidTypes [] = 20, // float hppv CBHPT_PLAIN, // int hpt 1.5, // float bppv - 45, // int buildrate - 1300, // int minbt + 25, // int buildrate + 5500, // int minbt qtrue, // qboolean regen; 90, // int regenspeed qfalse, // qboolean zappable diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index ae3a97d..beb7e37 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -480,7 +480,7 @@ int G_FindDCC( gentity_t *self ) return 0; //iterate through entities - for( i = MAX_CLIENTS, ent = g_entities + i; i < level.num_entities; i++, ent++ ) + for( i = MAX_CLIENTS, ent = g_entities + i; i < level.num_entities && foundDCC < MAX_DCS_PER_BUILDABLE; i++, ent++ ) { if( ent->s.eType != ET_BUILDABLE ) continue; @@ -2789,7 +2789,9 @@ void G_BuildableThink( gentity_t *ent, int msec ) ent->health += regenRate; } else if( ent->buildableTeam == TEAM_HUMANS && ent->dcc && - ( ent->lastDamageTime + HUMAN_REGEN_DAMAGE_TIME ) < level.time ) + ( ent->lastDamageTime + HUMAN_REGEN_DAMAGE_TIME ) < level.time && + ( !BG_Buildable( ent->s.modelindex, NULL )->cuboid || + BG_CuboidAttributes( ent->s.modelindex )->repairable ) ) { ent->health += DC_HEALRATE * ent->dcc; } @@ -2813,10 +2815,10 @@ void G_BuildableThink( gentity_t *ent, int msec ) ent->dcc = ( ent->buildableTeam != TEAM_HUMANS ) ? 0 : G_FindDCC( ent ); // Set health - ent->s.generic1 = MIN(MAX(ent->health,0),999); + ent->s.generic1 = MIN( MAX( ent->health, 0 ), 999 ); - // Set health for cuboids (BG_CuboidPackHealthSafe does nothing if not a cuboid) !@#CUBOID - BG_CuboidPackHealthSafe(ent->s.modelindex,&ent->s,ent->health); + // Set health for cuboids (BG_CuboidPackHealthSafe does nothing if not a cuboid) + BG_CuboidPackHealthSafe( ent->s.modelindex, &ent->s, ent->health ); // Set flags ent->s.eFlags &= ~( EF_B_POWERED | EF_B_SPAWNED | EF_B_MARKED ); @@ -3805,14 +3807,14 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, break; } - if(buildable>=CUBOID_FIRST && buildable<=CUBOID_LAST) + if( buildable >= CUBOID_FIRST && buildable <= CUBOID_LAST ) { - built->think=Cuboid_Think; - built->die=Cuboid_Die; + built->think = Cuboid_Think; + built->die = Cuboid_Die; } built->clipmask = MASK_PLAYERSOLID; - built->r.contents=CONTENTS_BODY; + built->r.contents = CONTENTS_BODY; built->s.number = built - g_entities; built->enemy = NULL; built->s.weapon = BG_Buildable( buildable, NULL )->turretProjType; @@ -3824,7 +3826,7 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, G_SetOrigin( built, localOrigin ); - // roughly nudge the buildable onto the surface D:< !@#CUBOID + // roughly nudge the buildable onto the surface D:< VectorScale( normal, -512.0f, built->s.pos.trDelta ); if(BG_Buildable(buildable, NULL)->cuboid) diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 63e80be..11d4892 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -1136,7 +1136,9 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target ) if( target->health > 0 ) { G_Damage( target, creator, creator, forward, - target->s.origin, LEVEL2_AREAZAP_DMG, + target->s.origin, LEVEL2_AREAZAP_DMG * + ( ( target->s.eType == ET_BUILDABLE ) + ? LEVEL2_AREAZAP_DMG_MOD : 1.0f ), DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, MOD_LEVEL2_ZAP ); @@ -1145,8 +1147,9 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target ) for( i = 1; i < zap->numTargets; i++ ) { G_Damage( zap->targets[ i ], target, zap->creator, forward, target->s.origin, - LEVEL2_AREAZAP_DMG * ( 1 - pow( (zap->distances[ i ] / - LEVEL2_AREAZAP_CHAIN_RANGE ), LEVEL2_AREAZAP_CHAIN_FALLOFF ) ) + 1, + ( LEVEL2_AREAZAP_DMG * ( 1 - pow( (zap->distances[ i ] / + LEVEL2_AREAZAP_CHAIN_RANGE ) , LEVEL2_AREAZAP_CHAIN_FALLOFF ) ) + 1 ) + * ( ( zap->targets[ i ]->s.eType == ET_BUILDABLE ) ? LEVEL2_AREAZAP_DMG_MOD : 1.0f ), DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, MOD_LEVEL2_ZAP ); } @@ -1254,7 +1257,8 @@ void areaZapFire( gentity_t *ent ) if( ( traceEnt->client && traceEnt->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) || ( traceEnt->s.eType == ET_BUILDABLE && BG_Buildable( traceEnt->s.modelindex, NULL )->team == TEAM_HUMANS ) && - (!BG_Buildable(traceEnt->s.modelindex,NULL)->cuboid||BG_CuboidAttributes(traceEnt->s.modelindex)->zappable)) + ( !BG_Buildable( traceEnt->s.modelindex, NULL )->cuboid || + BG_CuboidAttributes( traceEnt->s.modelindex )->zappable ) ) { G_CreateNewZap( ent, traceEnt ); } diff --git a/src/game/tremulous.h b/src/game/tremulous.h index df936bc..c18e58f 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -90,6 +90,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define LEVEL2_AREAZAP_REPEAT 100 //1500 #define LEVEL2_AREAZAP_TIME 100 //1000 #define LEVEL2_AREAZAP_MAX_TARGETS 5 +#define LEVEL2_AREAZAP_DMG_MOD 0.66f //versus buildings #define LEVEL2_WALLJUMP_MAXSPEED 1000.0f #define LEVEL3_CLAW_DMG ADM(80) @@ -603,6 +604,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define DC_HEALRATE 4 #define DC_RANGE 1000 #define DC_VALUE HBVM(DC_BP) +#define MAX_DCS_PER_BUILDABLE 2 #define ARMOURY_BP 10 #define ARMOURY_BT 15000 @@ -645,7 +647,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define STAMINA_WALK_RESTORE 15 #define STAMINA_MEDISTAT_RESTORE 30 // stacked on STOP or WALK #define STAMINA_SPRINT_TAKE 6 -#define STAMINA_JUMP_TAKE 250 +#define STAMINA_JUMP_TAKE 150 //250 #define STAMINA_DODGE_TAKE 250 #define STAMINA_MAX 1000 #define STAMINA_BREATHING_LEVEL 0 -- cgit