some basic work on the trains/elevators

This commit is contained in:
Scott Brooks 2002-01-31 02:52:49 +00:00
parent 04eaf92504
commit e296f257b2
2 changed files with 59 additions and 13 deletions

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.41 2002/01/31 02:52:49 blaze
// some basic work on the trains/elevators
//
// Revision 1.40 2002/01/31 02:25:31 jbravo // Revision 1.40 2002/01/31 02:25:31 jbravo
// Adding limchasecam. // Adding limchasecam.
// //
@ -2525,22 +2528,20 @@ PlayerStats
void Cmd_PlayerStats_f( gentity_t *ent ) void Cmd_PlayerStats_f( gentity_t *ent )
{ {
//char textbuf[1024]; //char textbuf[1024];
/*
trap_SendServerCommand( ent-g_entities, va("print \"%s:\n\"",ent->client->pers.netname )); trap_SendServerCommand( ent-g_entities, va("print \"%s:\n\"",ent->client->pers.netname ));
trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\"")); trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\""));
trap_SendServerCommand( ent-g_entities, va("print \"| Weapon | Accuracy | Hits/Shots |\n\"")); trap_SendServerCommand( ent-g_entities, va("print \"| Weapon | Accuracy | Hits/Shots |\n\""));
trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\"")); trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\""));
trap_SendServerCommand( ent-g_entities, va("print \"| Knife | %.1f | %d/%d |\n\"", (float)(ent->client->knifeHits / (ent->client->knifeShots ? ent->client->knifeShots : 1)), ent->client->knifeHits, ent->client->knifeShots)); trap_SendServerCommand( ent-g_entities, va("print \"| Knife(T)| %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_KNIFETHROWHITS] / (ent->client->pers.records[REC_KNIFETHROWSHOTS] ? ent->client->pers.records[REC_KNIFETHROWSHOTS] : 1)), (float)ent->client->pers.records[REC_KNIFETHROWHITS], (float)ent->client->pers.records[REC_KNIFETHROWSHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"| MK23 | %.1f | %d/%d |\n\"", (float)(ent->client->mk23Hits / (ent->client->mk23Shots ? ent->client->mk23Shots : 1)), ent->client->mk23Hits, ent->client->mk23Shots)); trap_SendServerCommand( ent-g_entities, va("print \"| MK23 | %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_MK23HITS] / (ent->client->pers.records[REC_MK23SHOTS] ? ent->client->pers.records[REC_MK23SHOTS] : 1)), (float)ent->client->pers.records[REC_MK23HITS], (float)ent->client->pers.records[REC_MK23SHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"| Akimbo | %.1f | %d/%d |\n\"", (float)(ent->client->akimboHits / (ent->client->akimboShots ? ent->client->akimboShots : 1)), ent->client->akimboHits, ent->client->akimboShots)); trap_SendServerCommand( ent-g_entities, va("print \"| Akimbo | %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_AKIMBOHITS] / (ent->client->pers.records[REC_AKIMBOSHOTS] ? ent->client->pers.records[REC_AKIMBOSHOTS] : 1)), (float)ent->client->pers.records[REC_AKIMBOHITS], (float)ent->client->pers.records[REC_AKIMBOSHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"| M4 | %.1f | %d/%d |\n\"", (float)(ent->client->m4Hits / (ent->client->m4Shots ? ent->client->m4Shots : 1)), ent->client->m4Hits, ent->client->m4Shots)); trap_SendServerCommand( ent-g_entities, va("print \"| M4 | %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_M4HITS] / (ent->client->pers.records[REC_M4SHOTS] ? ent->client->pers.records[REC_M4SHOTS] : 1)), (float)ent->client->pers.records[REC_M4HITS], (float)ent->client->pers.records[REC_M4SHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"| MP5 | %.1f | %d/%d |\n\"", (float)(ent->client->mp5Hits / (ent->client->mp5Shots ? ent->client->mp5Shots : 1)), ent->client->mp5Hits, ent->client->mp5Shots)); trap_SendServerCommand( ent-g_entities, va("print \"| MP5 | %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_MP5HITS] / (ent->client->pers.records[REC_MP5SHOTS] ? ent->client->pers.records[REC_MP5SHOTS] : 1)), (float)ent->client->pers.records[REC_MP5HITS], (float)ent->client->pers.records[REC_MP5SHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"| M3 | %.1f | %d/%d |\n\"", (float)(ent->client->m3Hits / (ent->client->m3Shots ? ent->client->m3Shots : 1)), ent->client->m3Hits, ent->client->m3Shots)); trap_SendServerCommand( ent-g_entities, va("print \"| M3 | %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_M3HITS] / (ent->client->pers.records[REC_M3SHOTS] ? ent->client->pers.records[REC_M3SHOTS] : 1)), (float)ent->client->pers.records[REC_M3HITS], (float)ent->client->pers.records[REC_M3SHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"| HC | %.1f | %d/%d |\n\"", (float)(ent->client->hcHits / (ent->client->hcShots ? ent->client->hcShots : 1)), ent->client->hcHits, ent->client->hcShots)); trap_SendServerCommand( ent-g_entities, va("print \"| HC | %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_HANDCANNONHITS] / (ent->client->pers.records[REC_HANDCANNONSHOTS] ? ent->client->pers.records[REC_HANDCANNONSHOTS] : 1)), (float)ent->client->pers.records[REC_HANDCANNONHITS], (float)ent->client->pers.records[REC_HANDCANNONSHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"| SSG | %.1f | %d/%d |\n\"", (float)(ent->client->ssgHits / (ent->client->ssgShots ? ent->client->ssgShots : 1)), ent->client->ssgHits, ent->client->ssgShots)); trap_SendServerCommand( ent-g_entities, va("print \"| SSG | %.0f | %.0f/%.0f \n\"", (100*(float)ent->client->pers.records[REC_SSG3000HITS] / (ent->client->pers.records[REC_SSG3000SHOTS] ? ent->client->pers.records[REC_SSG3000SHOTS] : 1)), (float)ent->client->pers.records[REC_SSG3000HITS], (float)ent->client->pers.records[REC_SSG3000SHOTS]));
trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\"")); trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\""));
*/
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.21 2002/01/31 02:50:18 blaze
// some basic work on the trains/elevators
//
// Revision 1.20 2002/01/24 14:20:53 jbravo // Revision 1.20 2002/01/24 14:20:53 jbravo
// Adding func_explosive and a few new surfaceparms // Adding func_explosive and a few new surfaceparms
// //
@ -784,6 +787,25 @@ Use_BinaryMover
void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) { void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
int total; int total;
int partial; int partial;
//Blaze: Holds the train entity
gentity_t *temp;
if ( ent->pathtarget != NULL )
{
G_Printf("The pathtarget is %s\n",ent->pathtarget);
temp = NULL;
temp = G_Find(temp,FOFS(targetname),ent->target);
if ( !temp )
{
G_Printf("Could not find the train %s that button points to\n", ent->target);
}
else
{
temp->nextTrain = G_Find(NULL, FOFS(targetname),ent->pathtarget);
//Blaze
//G_Printf("^2pathtarget: %s target: %s targetname: %s\n",ent->pathtarget, ent->target, ent->targetname);
//G_Printf("^2%s\n", ent->nextTrain->targetname);
}
}
// only the master should be used // only the master should be used
if ( ent->flags & FL_TEAMSLAVE ) { if ( ent->flags & FL_TEAMSLAVE ) {
@ -1829,13 +1851,14 @@ When a button is touched, it moves some distance in the direction of it's angle,
"health" if set, the button must be killed instead of touched "health" if set, the button must be killed instead of touched
"color" constantLight color "color" constantLight color
"light" constantLight radius "light" constantLight radius
"pathtarget" stores the target for a train
*/ */
void SP_func_button( gentity_t *ent ) { void SP_func_button( gentity_t *ent ) {
vec3_t abs_movedir; vec3_t abs_movedir;
float distance; float distance;
vec3_t size; vec3_t size;
float lip; float lip;
char *s;
ent->sound1to2 = G_SoundIndex("sound/movers/switches/butn2.wav"); ent->sound1to2 = G_SoundIndex("sound/movers/switches/butn2.wav");
if ( !ent->speed ) { if ( !ent->speed ) {
@ -1853,6 +1876,10 @@ void SP_func_button( gentity_t *ent ) {
// calculate second position // calculate second position
trap_SetBrushModel( ent, ent->model ); trap_SetBrushModel( ent, ent->model );
if ( G_SpawnString( "pathtarget","", &s) ) {
strcpy(ent->pathtarget, s);
}
G_SpawnFloat( "lip", "4", &lip ); G_SpawnFloat( "lip", "4", &lip );
G_SetMovedir( ent->s.angles, ent->movedir ); G_SetMovedir( ent->s.angles, ent->movedir );
@ -1923,6 +1950,11 @@ void Reached_Train( gentity_t *ent ) {
// set the new trajectory // set the new trajectory
ent->nextTrain = next->nextTrain; ent->nextTrain = next->nextTrain;
//Blaze: Spam out some info about where the train is
//G_Printf("^1Reached Reached_Train %s %s\n", next->targetname, next->target);
//G_Printf("^3Train is at (%f %f %f) or (%f %f %f)\n",ent->s.origin[0],ent->s.origin[1],ent->s.origin[2], ent->pos1[0], ent->pos1[1], ent->pos1[2]);
//G_Printf("^2NextTrain Origin(%f, %f, %f) Next Origin (%f, %f, %f)\n", next->nextTrain->s.origin[0], next->nextTrain->s.origin[1], next->nextTrain->s.origin[2], next->s.origin[0], next->s.origin[1], next->s.origin[2]);
VectorCopy( next->s.origin, ent->pos1 ); VectorCopy( next->s.origin, ent->pos1 );
VectorCopy( next->nextTrain->s.origin, ent->pos2 ); VectorCopy( next->nextTrain->s.origin, ent->pos2 );
@ -1955,6 +1987,13 @@ void Reached_Train( gentity_t *ent ) {
ent->think = Think_BeginMoving; ent->think = Think_BeginMoving;
ent->s.pos.trType = TR_STATIONARY; ent->s.pos.trType = TR_STATIONARY;
} }
//Blaze: If the wait is less then 0, dont nextthing
if (next->wait < 0)
{
ent->nextthink = 0;
ent->think = Think_BeginMoving;
ent->s.pos.trType = TR_STATIONARY;
}
} }
@ -2016,6 +2055,12 @@ Target: next path corner and other targets to fire
"wait" seconds to wait before behining move to next corner "wait" seconds to wait before behining move to next corner
*/ */
void SP_path_corner( gentity_t *self ) { void SP_path_corner( gentity_t *self ) {
//Blaze Print out some info for the path corners
//G_Printf("^1Ent Wait = %f %s %s\n", self->wait, self->targetname, self->target);
//G_Printf("^2path_corner Origin(%f, %f, %f)", self->s.origin[0], self->s.origin[1], self->s.origin[2]);
if ( !self->targetname ) { if ( !self->targetname ) {
G_Printf ("path_corner with no targetname at %s\n", vtos(self->s.origin)); G_Printf ("path_corner with no targetname at %s\n", vtos(self->s.origin));
G_FreeEntity( self ); G_FreeEntity( self );