diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 36 | ||||
-rw-r--r-- | src/game/bg_public.h | 12 | ||||
-rw-r--r-- | src/game/g_buildable.c | 69 |
3 files changed, 79 insertions, 38 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index fdc371e0..03472b08 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1241,6 +1241,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_D_SPAWN, //int buildNum; "bioegg", //char *buildName; "team_droid_spawn", //char *entityName; + { "models/buildables/bioegg/bioegg.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1268,6 +1269,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_D_BARRICADE, //int buildNum; "barricade", //char *buildName; "team_droid_barricade",//char *entityName; + { "models/buildables/barricade/barricade.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1295,6 +1297,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_D_BOOSTER, //int buildNum; "booster", //char *buildName; "team_droid_booster", //char *entityName; + { "models/buildables/booster/booster.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1322,6 +1325,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_D_ACIDTUBE, //int buildNum; "acid_tube", //char *buildName; "team_droid_acid_tube",//char *entityName; + { "models/buildables/acid_tube/acid_tube.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1349,6 +1353,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_D_TRAPPER, //int buildNum; "trapper", //char *buildName; "team_droid_trapper", //char *entityName; + { "models/buildables/trapper/trapper.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1376,6 +1381,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_D_HIVEMIND, //int buildNum; "hivemind", //char *buildName; "team_droid_hivemind", //char *entityName; + { "models/buildables/hivemind/hivemind.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1403,6 +1409,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_SPAWN, //int buildNum; "replicator", //char *buildName; "team_human_spawn", //char *entityName; + { "models/buildables/replicator/replicator.md3", 0, 0, 0 }, { -40, -40, -4 }, //vec3_t mins; { 40, 40, 4 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1430,6 +1437,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_MEDISTAT, //int buildNum; "medistat", //char *buildName; "team_human_medistat", //char *entityName; + { "models/buildables/medistat/medistat.md3", 0, 0, 0 }, { -40, -40, -4 }, //vec3_t mins; { 40, 40, 4 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1457,6 +1465,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_DEF1, //int buildNum; "plasmaturret", //char *buildName; "team_human_def1", //char *entityName; + { "models/buildables/plasmaturret/pturret_base.md3", "models/buildables/plasmaturret/pturret_top.md3", 0, 0 }, { -24, -24, -11 }, //vec3_t mins; { 24, 24, 11 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1484,6 +1493,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_DEF2, //int buildNum; "mgturret", //char *buildName; "team_human_def2", //char *entityName; + { "models/buildables/plasmaturret/pturret_base.md3", "models/weapons2/machinegun/machinegun.md3", 0, 0 }, { -24, -24, -11 }, //vec3_t mins; { 24, 24, 11 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1511,6 +1521,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_DEF3, //int buildNum; "tesla", //char *buildName; "team_human_tesla", //char *entityName; + { "models/buildables/tesla/tesla.md3", 0, 0, 0 }, { -22, -22, -40 }, //vec3_t mins; { 22, 22, 40 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1538,6 +1549,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_DCC, //int buildNum; "dcc", //char *buildName; "team_human_dcc", //char *entityName; + { "models/buildables/dcc/dcc.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1565,6 +1577,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_BANK, //int buildNum; "bank", //char *buildName; "team_human_bank", //char *entityName; + { "models/buildables/bank/bank.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1592,6 +1605,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_MCU, //int buildNum; "mcu", //char *buildName; "team_human_mcu", //char *entityName; + { "models/buildables/mcu/mcu.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1619,6 +1633,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_REACTOR, //int buildNum; "reactor", //char *buildName; "team_human_reactor", //char *entityName; + { "models/buildables/reactor/reactor.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1646,6 +1661,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_REPEATER, //int buildNum; "repeater", //char *buildName; "team_human_repeater", //char *entityName; + { "models/buildables/repeater/repeater.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; @@ -1673,6 +1689,7 @@ buildableAttributes_t bg_buildableList[ ] = BA_H_FLOATMINE, //int buildNum; "floatmine", //char *buildName; "team_human_floatmine",//char *entityName; + { "models/buildables/floatmine/floatmine.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; { 15, 15, 15 }, //vec3_t maxs; TR_BUOYANCY, //trType_t traj; @@ -1778,6 +1795,25 @@ char *BG_FindEntityNameForBuildable( int bclass ) /* ============== +BG_FindModelsForBuildNum +============== +*/ +char *BG_FindModelsForBuildable( int bclass, int modelNum ) +{ + int i; + + for( i = 0; i < bg_numBuildables; i++ ) + { + if( bg_buildableList[ i ].buildNum == bclass ) + return bg_buildableList[ i ].models[ modelNum ]; + } + + //wimp out + return ""; +} + +/* +============== BG_FindBBoxForBuildable ============== */ diff --git a/src/game/bg_public.h b/src/game/bg_public.h index c96ef9e2..2aa4e737 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -234,7 +234,8 @@ typedef enum { STAT_STAMINA, //TA: stamina (human only) STAT_STATE, //TA: client states e.g. wall climbing STAT_CREDIT, //TA: human credit - STAT_MISC //TA: for uh...misc stuff + STAT_MISC, //TA: for uh...misc stuff + STAT_BUILDABLE //TA: which ghost model to display for building } statIndex_t; #define SCA_WALLCLIMBER 1 @@ -253,6 +254,8 @@ typedef enum { #define SS_BLOBLOCKED 128 #define SS_POISONED 256 +#define SB_VALID_TOGGLEBIT 8192 +#define SB_ACTIVE_TOGGLEBIT 16384 // player_state->persistant[] indexes // these fields are the only part of player_state that isn't @@ -856,6 +859,8 @@ typedef struct char *buildName; char *entityName; + + char *models[ MAX_ITEM_MODELS ]; vec3_t mins; vec3_t maxs; @@ -942,6 +947,7 @@ int BG_FindBuildNumForName( char *name ); int BG_FindBuildNumForEntityName( char *name ); char *BG_FindNameForBuildable( int bclass ); char *BG_FindEntityNameForBuildable( int bclass ); +char *BG_FindModelsForBuildable( int bclass, int modelNum ); void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs ); int BG_FindHealthForBuildable( int bclass ); trType_t BG_FindTrajectoryForBuildable( int bclass ); @@ -1026,8 +1032,8 @@ typedef enum { ET_PLAYER, ET_ITEM, - ET_BUILDABLE, //TA: buildable type - ET_CREEP, //TA: creep type + ET_BUILDABLE, //TA: buildable type + ET_CREEP, //TA: creep type ET_MISSILE, ET_MOVER, diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 7ee5e570..cec65380 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -86,11 +86,11 @@ qboolean findPower( gentity_t *self ) continue; //if entity is a power item calculate the distance to it - if( ent->s.clientNum == BA_H_REACTOR || ent->s.clientNum == BA_H_REPEATER ) + if( ent->s.modelindex == BA_H_REACTOR || ent->s.modelindex == BA_H_REPEATER ) { VectorSubtract( self->s.origin, ent->s.origin, temp_v ); distance = VectorLength( temp_v ); - if( distance < minDistance && ( ent->active || self->s.clientNum == BA_H_SPAWN ) ) + if( distance < minDistance && ( ent->active || self->s.modelindex == BA_H_SPAWN ) ) { closestPower = ent; minDistance = distance; @@ -104,10 +104,10 @@ qboolean findPower( gentity_t *self ) return qfalse; //bleh - if( ( closestPower->s.clientNum == BA_H_REACTOR && ( minDistance <= REACTOR_BASESIZE ) ) || - ( closestPower->s.clientNum == BA_H_REPEATER && self->s.clientNum == BA_H_SPAWN && + if( ( closestPower->s.modelindex == BA_H_REACTOR && ( minDistance <= REACTOR_BASESIZE ) ) || + ( closestPower->s.modelindex == BA_H_REPEATER && self->s.modelindex == BA_H_SPAWN && ( minDistance <= REPEATER_BASESIZE ) && closestPower->powered ) || - ( closestPower->s.clientNum == BA_H_REPEATER && ( minDistance <= REPEATER_BASESIZE ) && + ( closestPower->s.modelindex == BA_H_REPEATER && ( minDistance <= REPEATER_BASESIZE ) && closestPower->active && closestPower->powered ) ) { @@ -150,7 +150,7 @@ qboolean findDCC( gentity_t *self ) continue; //if entity is a power item calculate the distance to it - if( ent->s.clientNum == BA_H_DCC ) + if( ent->s.modelindex == BA_H_DCC ) { VectorSubtract( self->s.origin, ent->s.origin, temp_v ); distance = VectorLength( temp_v ); @@ -200,7 +200,7 @@ qboolean findCreep( gentity_t *self ) if( !ent->classname || ent->s.eType != ET_BUILDABLE ) continue; - if( ent->s.clientNum == BA_D_SPAWN || ent->s.clientNum == BA_D_HIVEMIND ) + if( ent->s.modelindex == BA_D_SPAWN || ent->s.modelindex == BA_D_HIVEMIND ) { /*VectorSubtract( self->s.origin, ent->s.origin, temp_v );*/ VectorSubtract( self->s.origin, ent->s.origin, temp_v ); @@ -402,7 +402,7 @@ void DSpawn_Think( gentity_t *self ) G_FreeEntity( ent ); //quietly remove } - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } /* @@ -503,7 +503,7 @@ void DBarricade_Think( gentity_t *self ) return; } - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -543,7 +543,7 @@ void DAcidTube_Damage( gentity_t *self ) G_SelectiveRadiusDamage( self->s.pos.trBase, self->parent, self->splashDamage, self->splashRadius, self, self->splashMethodOfDeath, PTE_DROIDS ); - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } /* @@ -586,7 +586,7 @@ void DAcidTube_Think( gentity_t *self ) } } - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -629,7 +629,7 @@ void ddef_fireonenemy( gentity_t *self, int firespeed ) vec3_t dirToTarget; vec3_t target; vec3_t halfAcceleration, thirdJerk; - float distanceToTarget = BG_FindRangeForBuildable( self->s.clientNum ); + float distanceToTarget = BG_FindRangeForBuildable( self->s.modelindex ); int i; VectorScale( self->enemy->acceleration, 1.0f / 2.0f, halfAcceleration ); @@ -740,10 +740,10 @@ think function for Droid Defense */ void DTrapper_Think( gentity_t *self ) { - int range = BG_FindRangeForBuildable( self->s.clientNum ); - int firespeed = BG_FindFireSpeedForBuildable( self->s.clientNum ); + int range = BG_FindRangeForBuildable( self->s.modelindex ); + int firespeed = BG_FindFireSpeedForBuildable( self->s.modelindex ); - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); //if there is no creep nearby die if( !findCreep( self ) ) @@ -791,10 +791,10 @@ void HRpt_Think( gentity_t *self ) if( !ent->classname || ent->s.eType != ET_BUILDABLE ) continue; - if( ent->s.clientNum == BA_H_SPAWN && ent->parentNode == self ) + if( ent->s.modelindex == BA_H_SPAWN && ent->parentNode == self ) count++; - if( ent->s.clientNum == BA_H_REACTOR ) + if( ent->s.modelindex == BA_H_REACTOR ) reactor = qtrue; } @@ -958,7 +958,7 @@ void HMedistat_Think( gentity_t *self ) } } - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -1062,7 +1062,7 @@ qboolean hdef1_trackenemy( gentity_t *self ) { vec3_t dirToTarget, angleToTarget, angularDiff; float temp; - float distanceToTarget = BG_FindRangeForBuildable( self->s.clientNum ); + float distanceToTarget = BG_FindRangeForBuildable( self->s.modelindex ); float timeTilImpact; vec3_t halfAcceleration; vec3_t thirdJerk; @@ -1317,10 +1317,10 @@ think function for Human Defense */ void HDef_Think( gentity_t *self ) { - int range = BG_FindRangeForBuildable( self->s.clientNum ); - int firespeed = BG_FindFireSpeedForBuildable( self->s.clientNum ); + int range = BG_FindRangeForBuildable( self->s.modelindex ); + int firespeed = BG_FindFireSpeedForBuildable( self->s.modelindex ); - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); //find power for self self->powered = findPower( self ); @@ -1351,7 +1351,7 @@ void HDef_Think( gentity_t *self ) self->enemy->targeted = self; //if we are pointing at our target and we can fire shoot it - switch( self->s.clientNum ) + switch( self->s.modelindex ) { case BA_H_DEF1: if( hdef1_trackenemy( self ) && ( self->count < level.time ) ) @@ -1471,7 +1471,7 @@ void HSpawn_Think( gentity_t *self ) G_FreeEntity( ent ); //quietly remove } - self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.clientNum ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -1540,7 +1540,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance if( !tempent->classname || tempent->s.eType != ET_BUILDABLE ) continue; - if( tempent->s.clientNum == BA_D_SPAWN || tempent->s.clientNum == BA_D_HIVEMIND ) + if( tempent->s.modelindex == BA_D_SPAWN || tempent->s.modelindex == BA_D_HIVEMIND ) { VectorSubtract( entity_origin, tempent->s.origin, temp_v ); if( VectorLength( temp_v ) <= ( CREEP_BASESIZE * 3 ) ) @@ -1557,7 +1557,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance { if( !tempent->classname || tempent->s.eType != ET_BUILDABLE ) continue; - if( tempent->s.clientNum == BA_D_HIVEMIND ) + if( tempent->s.modelindex == BA_D_HIVEMIND ) break; } @@ -1578,7 +1578,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance if( !tempent->classname || tempent->s.eType != ET_BUILDABLE ) continue; - if( tempent->s.clientNum == BA_D_HIVEMIND ) + if( tempent->s.modelindex == BA_D_HIVEMIND ) { reason = IBE_HIVEMIND; break; @@ -1601,7 +1601,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance if( !tempent->classname || tempent->s.eType != ET_BUILDABLE ) continue; - if( tempent->s.clientNum == BA_H_REACTOR || tempent->s.clientNum == BA_H_REPEATER ) + if( tempent->s.modelindex == BA_H_REACTOR || tempent->s.modelindex == BA_H_REPEATER ) { VectorSubtract( entity_origin, tempent->s.origin, temp_v ); templength = VectorLength( temp_v ); @@ -1615,9 +1615,9 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance //if this power entity satisfies expression if( !( - ( closestPower->s.clientNum == BA_H_REACTOR && minDistance <= REACTOR_BASESIZE ) || + ( closestPower->s.modelindex == BA_H_REACTOR && minDistance <= REACTOR_BASESIZE ) || ( - closestPower->s.clientNum == BA_H_REPEATER && minDistance <= REPEATER_BASESIZE && + closestPower->s.modelindex == BA_H_REPEATER && minDistance <= REPEATER_BASESIZE && ( ( buildable == BA_H_SPAWN && closestPower->powered ) || ( closestPower->powered && closestPower->active ) @@ -1643,7 +1643,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance if( !tempent->classname || tempent->s.eType != ET_BUILDABLE ) continue; - if( tempent->s.clientNum == BA_H_REACTOR ) + if( tempent->s.modelindex == BA_H_REACTOR ) break; } @@ -1659,7 +1659,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance if( !tempent->classname || tempent->s.eType != ET_BUILDABLE ) continue; - if( tempent->s.clientNum == BA_H_REACTOR ) + if( tempent->s.modelindex == BA_H_REACTOR ) { reason = IBE_REACTOR; break; @@ -1694,11 +1694,10 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin built->classname = BG_FindEntityNameForBuildable( buildable ); built->item = BG_FindItemForBuildable( buildable ); - built->s.modelindex = built->item - bg_itemlist; // store item number in modelindex - built->s.clientNum = buildable; //so we can tell what this is on the client side + built->s.modelindex = buildable; //so we can tell what this is on the client side + built->biteam = built->s.modelindex2 = BG_FindTeamForBuildable( buildable ); BG_FindBBoxForBuildable( buildable, built->r.mins, built->r.maxs ); - built->biteam = built->s.modelindex2 = BG_FindTeamForBuildable( buildable ); built->health = BG_FindHealthForBuildable( buildable ); built->damage = BG_FindDamageForBuildable( buildable ); |