From e296f257b242a74cc2449cd0785f8e769cc06866 Mon Sep 17 00:00:00 2001 From: Scott Brooks Date: Thu, 31 Jan 2002 02:52:49 +0000 Subject: [PATCH] some basic work on the trains/elevators --- reaction/game/g_cmds.c | 25 +++++++++++----------- reaction/game/g_mover.c | 47 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 13 deletions(-) diff --git a/reaction/game/g_cmds.c b/reaction/game/g_cmds.c index 7b8d4d7a..d48a58a6 100644 --- a/reaction/game/g_cmds.c +++ b/reaction/game/g_cmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // Adding limchasecam. // @@ -2525,22 +2528,20 @@ PlayerStats void Cmd_PlayerStats_f( gentity_t *ent ) { //char textbuf[1024]; - -/* + 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 \"| 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 \"| 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 \"| 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 \"| 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 \"| 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 \"| 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 \"| 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 \"| 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 \"| 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 \"| 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 | %.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 | %.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 | %.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 | %.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 | %.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 | %.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 | %.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\"")); -*/ } diff --git a/reaction/game/g_mover.c b/reaction/game/g_mover.c index e58e0355..ff084a67 100644 --- a/reaction/game/g_mover.c +++ b/reaction/game/g_mover.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // 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 ) { int total; 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 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 "color" constantLight color "light" constantLight radius +"pathtarget" stores the target for a train */ void SP_func_button( gentity_t *ent ) { vec3_t abs_movedir; float distance; vec3_t size; float lip; - + char *s; ent->sound1to2 = G_SoundIndex("sound/movers/switches/butn2.wav"); if ( !ent->speed ) { @@ -1853,6 +1876,10 @@ void SP_func_button( gentity_t *ent ) { // calculate second position trap_SetBrushModel( ent, ent->model ); + if ( G_SpawnString( "pathtarget","", &s) ) { + strcpy(ent->pathtarget, s); + } + G_SpawnFloat( "lip", "4", &lip ); G_SetMovedir( ent->s.angles, ent->movedir ); @@ -1923,6 +1950,11 @@ void Reached_Train( gentity_t *ent ) { // set the new trajectory 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->nextTrain->s.origin, ent->pos2 ); @@ -1955,6 +1987,13 @@ void Reached_Train( gentity_t *ent ) { ent->think = Think_BeginMoving; 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 */ 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 ) { G_Printf ("path_corner with no targetname at %s\n", vtos(self->s.origin)); G_FreeEntity( self );