diff options
author | Tim Angus <tim@ngus.net> | 2001-01-15 04:06:42 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-01-15 04:06:42 +0000 |
commit | 64806bda9892ce84e0b5e11ce5e5f9052c1183b3 (patch) | |
tree | b3e6b5c05c901b13031710c4d28cf21baae71b3b | |
parent | dfa6ae440ddddaaf22e4b32dbc6d31b13e162d4d (diff) |
Half-done revamping defmenus; bug fixes;MCU
-rw-r--r-- | src/cgame/cg_draw.c | 77 | ||||
-rw-r--r-- | src/cgame/cg_event.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 24 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 24 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 8 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/g_active.c | 31 | ||||
-rw-r--r-- | src/game/g_client.c | 12 | ||||
-rw-r--r-- | src/game/g_cmds.c | 39 | ||||
-rw-r--r-- | src/game/g_local.h | 3 |
10 files changed, 136 insertions, 89 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 02457071..e92e8652 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -337,63 +337,49 @@ CG_DrawLighting static void CG_DrawLighting( void ) { centity_t *cent; - byte lum; - static byte lastLum; + int currentLum; + static int lum; vec3_t point, direction; cent = &cg_entities[cg.snap->ps.clientNum]; VectorCopy( cent->lerpOrigin, point ); - //TA: when wall climbing the viewheight is not straight up - if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING ) - VectorMA( point, 32, cg.predictedPlayerState.grapplePoint, point ); - else - point[ 2 ] += 32; AngleVectors( cg.predictedPlayerState.viewangles, direction, NULL, NULL ); - lum = CG_LightFromDirection( point, direction ); + currentLum = CG_LightFromDirection( point, direction ); //CG_Printf( "%d\n", lum ); - if( abs( lastLum - lum ) > 4 ) - lastLum = lum; - - if( BG_activated( UP_NVG, cg.snap->ps.stats ) ) - CG_DrawPic( 0, 0, 640, 480, cgs.media.humanNV ); + if( abs( lum - currentLum ) > 4 ) + lum = currentLum; switch( cg.snap->ps.stats[ STAT_PCLASS ] ) { case PCL_D_BASE: case PCL_D_BUILDER: - if( lastLum < 10 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav80 ); - else if( lastLum >= 10 && lastLum < 16 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav75 ); - else if( lastLum >= 16 && lastLum < 22 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav70 ); - else if( lastLum >= 22 && lastLum < 28 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav65 ); - else if( lastLum >= 28 && lastLum < 34 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav60 ); - else if( lastLum >= 34 && lastLum < 40 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav55 ); - else if( lastLum >= 40 && lastLum < 46 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav50 ); - else if( lastLum >= 46 && lastLum < 53 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav45 ); - else if( lastLum >= 53 && lastLum < 61 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav40 ); - else if( lastLum >= 61 && lastLum < 70 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav35 ); - else if( lastLum >= 70 && lastLum < 80 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav30 ); - else if( lastLum >= 80 && lastLum < 100 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav25 ); - else if( lastLum >= 100 && lastLum < 130 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav20 ); - else if( lastLum >= 130 && lastLum < 180 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav15 ); - else if( lastLum >= 180 ) - CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav10 ); + if( lum < 10 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav9 ); + else if( lum >= 10 && lum < 16 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav8 ); + else if( lum >= 16 && lum < 22 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav7 ); + else if( lum >= 22 && lum < 28 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav6 ); + else if( lum >= 28 && lum < 34 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav5 ); + else if( lum >= 34 && lum < 40 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav4 ); + else if( lum >= 40 && lum < 46 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav3 ); + else if( lum >= 46 && lum < 53 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav2 ); + else if( lum >= 53 ) + CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav1 ); + + break; + + case PCL_H_BASE: + if( BG_activated( UP_NVG, cg.snap->ps.stats ) ) + CG_DrawPic( 0, 0, 640, 480, cgs.media.humanNV ); break; } @@ -424,8 +410,6 @@ static void CG_DrawStatusBar( void ) { vec4_t hcolor; vec3_t angles; vec3_t origin; - byte lum; - static byte lastLum; static float colors[4][4] = { // { 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} }; { 0.3f, 0.4f, 0.3f, 1.0f } , // normal @@ -1284,7 +1268,7 @@ static void CG_DrawLowerRight( void ) { } //y = CG_DrawScores( y ); - y = CG_DrawPoints( y ); + //y = CG_DrawPoints( y ); y = CG_DrawPowerups( y ); } @@ -2243,6 +2227,7 @@ static void CG_Draw2D( void ) { CG_DrawSpectator(); CG_DrawCrosshair(); CG_DrawCrosshairNames(); + CG_DrawLighting(); } else { // don't draw any status if dead or the scoreboard is being explicitly shown if ( !cg.showScores && cg.snap->ps.stats[STAT_HEALTH] > 0 ) { diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 231972ee..b33c742e 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -443,6 +443,10 @@ void CG_Menu( centity_t *cent, int eventParm ) trap_SendConsoleCommand( "menu hbuildmenu\n" ); break; + case MN_MCU: + trap_SendConsoleCommand( "menu hmcumenu\n" ); + break; + default: Com_Printf( "cgame: debug: no such menu no %d\n", eventParm ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 9e342591..4874d0cf 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -737,21 +737,15 @@ typedef struct { qhandle_t explosionTrailShader; qhandle_t humanNV; - qhandle_t droidNav10; - qhandle_t droidNav15; - qhandle_t droidNav20; - qhandle_t droidNav25; - qhandle_t droidNav30; - qhandle_t droidNav35; - qhandle_t droidNav40; - qhandle_t droidNav45; - qhandle_t droidNav50; - qhandle_t droidNav55; - qhandle_t droidNav60; - qhandle_t droidNav65; - qhandle_t droidNav70; - qhandle_t droidNav75; - qhandle_t droidNav80; + qhandle_t droidNav9; + qhandle_t droidNav8; + qhandle_t droidNav7; + qhandle_t droidNav6; + qhandle_t droidNav5; + qhandle_t droidNav4; + qhandle_t droidNav3; + qhandle_t droidNav2; + qhandle_t droidNav1; qhandle_t droidHealth; qhandle_t flameShader; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 4d86b0c1..7583d402 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -793,21 +793,15 @@ static void CG_RegisterGraphics( void ) { //TA: screenfades cgs.media.humanNV = trap_R_RegisterShader( "humanNV" ); - cgs.media.droidNav10 = trap_R_RegisterShader( "droidNav10" ); - cgs.media.droidNav15 = trap_R_RegisterShader( "droidNav15" ); - cgs.media.droidNav20 = trap_R_RegisterShader( "droidNav20" ); - cgs.media.droidNav25 = trap_R_RegisterShader( "droidNav25" ); - cgs.media.droidNav30 = trap_R_RegisterShader( "droidNav30" ); - cgs.media.droidNav35 = trap_R_RegisterShader( "droidNav35" ); - cgs.media.droidNav40 = trap_R_RegisterShader( "droidNav40" ); - cgs.media.droidNav45 = trap_R_RegisterShader( "droidNav45" ); - cgs.media.droidNav50 = trap_R_RegisterShader( "droidNav50" ); - cgs.media.droidNav55 = trap_R_RegisterShader( "droidNav55" ); - cgs.media.droidNav60 = trap_R_RegisterShader( "droidNav60" ); - cgs.media.droidNav65 = trap_R_RegisterShader( "droidNav65" ); - cgs.media.droidNav70 = trap_R_RegisterShader( "droidNav70" ); - cgs.media.droidNav75 = trap_R_RegisterShader( "droidNav75" ); - cgs.media.droidNav80 = trap_R_RegisterShader( "droidNav80" ); + cgs.media.droidNav9 = trap_R_RegisterShader( "droidNav9" ); + cgs.media.droidNav8 = trap_R_RegisterShader( "droidNav8" ); + cgs.media.droidNav7 = trap_R_RegisterShader( "droidNav7" ); + cgs.media.droidNav6 = trap_R_RegisterShader( "droidNav6" ); + cgs.media.droidNav5 = trap_R_RegisterShader( "droidNav5" ); + cgs.media.droidNav4 = trap_R_RegisterShader( "droidNav4" ); + cgs.media.droidNav3 = trap_R_RegisterShader( "droidNav3" ); + cgs.media.droidNav2 = trap_R_RegisterShader( "droidNav2" ); + cgs.media.droidNav1 = trap_R_RegisterShader( "droidNav1" ); cgs.media.droidHealth = trap_R_RegisterShader( "gfx/2d/droidhealth.tga" ); cgs.media.armorModel = trap_R_RegisterModel( "models/powerups/armor/armor_yel.md3" ); diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index bffc47fc..6787e250 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -422,7 +422,7 @@ static float PM_CmdScale( usercmd_t *cmd ) { aForward = abs( cmd->forwardmove ); aRight = abs( cmd->rightmove ); - if( ( aForward <= 64 && aForward > 5 ) && ( aRight <= 64 && aRight > 5 ) ) + if( ( aForward <= 64 && aForward > 5 ) || ( aRight <= 64 && aRight > 5 ) ) { //restore stamina pm->ps->stats[ STAT_STAMINA ] += (dTime/5); @@ -1550,6 +1550,9 @@ static void PM_GroundClimbTrace( void ) if( abc[ 2 ] == 0 ) correction = 0; + if( correction > 32768 ) + correction -= 32768; + //phew! - correct the angle pm->ps->delta_angles[ YAW ] -= correction; } @@ -2229,7 +2232,6 @@ static void PM_Weapon( void ) { pm->ps->pm_flags &= ~PMF_USE_ITEM_HELD; }*/ - // make weapon function if ( pm->ps->weaponTime > 0 ) { pm->ps->weaponTime -= pml.msec; @@ -2397,7 +2399,7 @@ static void PM_Weapon( void ) { addTime = 800; break; case WP_FLAMER: - addTime = 80; + addTime = 150; break; case WP_RAILGUN: addTime = 1500; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ad113b31..a4e6ea46 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -506,7 +506,8 @@ typedef enum MN_DROID, MN_HUMAN, MN_ABUILD, - MN_HBUILD + MN_HBUILD, + MN_MCU } dynMenu_t; // animations diff --git a/src/game/g_active.c b/src/game/g_active.c index b6c7d41b..e4a1ffbf 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -356,7 +356,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) { client->oldbuttons = client->buttons; client->buttons = ucmd->buttons; - if ( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) ) + if( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) ) { if( client->pers.pteam == PTE_NONE ) { @@ -371,13 +371,13 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) { G_AddPredictableEvent( ent, EV_MENU, MN_HUMAN ); } } - + // attack button cycles through spectators //TA: messes with the menus - /*if ( ( client->buttons & BUTTON_ATTACK ) && + if ( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) && - ( client->sess.spectatorState != SPECTATOR_LOCKED ) ) - Cmd_FollowCycle_f( ent, 1 );*/ + ( client->sess.spectatorState == SPECTATOR_FREE ) ) + Cmd_FollowCycle_f( ent, 1 ); } @@ -882,6 +882,27 @@ void ClientThink_real( gentity_t *ent ) { client->buttons = ucmd->buttons; client->latched_buttons |= client->buttons & ~client->oldbuttons; + //TA: look for MCU infront of player + if( ( client->buttons & BUTTON_GETFLAG ) && !( client->oldbuttons & BUTTON_GETFLAG ) ) + { + if( client->pers.pteam == PTE_HUMANS ) + { + trace_t mcu; + vec3_t view, point; + gentity_t *mcuEntity; + + AngleVectors( client->ps.viewangles, view, NULL, NULL ); + VectorMA( client->ps.origin, 200, view, point ); + trap_Trace( &mcu, client->ps.origin, NULL, NULL, point, ent->s.number, MASK_SHOT ); + + mcuEntity = &g_entities[ mcu.entityNum ]; + + //bring up a menu if its there + if( !Q_stricmp( mcuEntity->classname, "team_human_mcu" ) ) + G_AddPredictableEvent( ent, EV_MENU, MN_MCU ); + } + } + // check for respawning if ( client->ps.stats[STAT_HEALTH] <= 0 ) { // wait for the attack button to be pressed diff --git a/src/game/g_client.c b/src/game/g_client.c index 422ebc84..49868661 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1356,8 +1356,16 @@ void ClientSpawn(gentity_t *ent) { client->ps.clientNum = index; - /*BG_packWeapon( WP_MACHINEGUN, client->ps.stats ); - BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, CS_MG, 4, 4 );*/ + if( client->pers.pitem == WP_MACHINEGUN ) + { + BG_packWeapon( WP_MACHINEGUN, client->ps.stats ); + BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, CS_MG, 4, 4 ); + } + else if( client->pers.pitem == WP_HBUILD ) + { + BG_packWeapon( WP_HBUILD, client->ps.stats ); + BG_packAmmoArray( WP_HBUILD, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + } client->ps.stats[ STAT_ABILITIES ] |= SCA_TAKESFALLDAMAGE; client->ps.stats[ STAT_ABILITIES ] |= SCA_CANJUMP; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 104ec02b..09884232 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1556,6 +1556,12 @@ void Cmd_Class_f( gentity_t *ent ) if( ent->client->pers.pteam == PTE_DROIDS ) { + if( ent->client->pers.pclass != 0 ) + { + trap_SendServerCommand( ent-g_entities, va("print \"You must be dead to use the class command\n\"" ) ); + return; + } + if( !Q_stricmp(s, "0") ) ent->client->pers.pclass = PCL_D_BUILDER; else if( !Q_stricmp(s, "1") ) @@ -1594,8 +1600,19 @@ void Cmd_Class_f( gentity_t *ent ) } else if( ent->client->pers.pteam == PTE_HUMANS ) { + if( ent->client->pers.pclass != 0 ) + { + trap_SendServerCommand( ent-g_entities, va("print \"You must be dead to use the class command\n\"" ) ); + return; + } + ent->client->pers.pclass = PCL_H_BASE; + if( !Q_stricmp( s, "0" ) ) + ent->client->pers.pitem = WP_MACHINEGUN; + else if( !Q_stricmp( s, "1" ) ) + ent->client->pers.pitem = WP_HBUILD; + if( ent->client->torch != NULL ) Cmd_TorchOff_f( ent ); @@ -1758,10 +1775,30 @@ Cmd_Buy_f */ void Cmd_Buy_f( gentity_t *ent ) { - char s[ MAX_TOKEN_CHARS ]; + char s[ MAX_TOKEN_CHARS ]; + vec3_t distance; + int i; + gentity_t *mcuEntity; + qboolean nearMCU = qfalse; trap_Argv( 1, s, sizeof( s ) ); + for ( i = 1, mcuEntity = g_entities + i; i < level.num_entities; i++, mcuEntity++ ) + { + if( !Q_stricmp( mcuEntity->classname, "team_human_mcu" ) ) + { + VectorSubtract( ent->s.pos.trBase, mcuEntity->s.origin, distance ); + if( VectorLength( distance ) <= 100 ) + nearMCU = qtrue; + } + } + + if( !nearMCU ) + { + trap_SendServerCommand( ent-g_entities, va("print \"You must be near an MCU\n\"" ) ); + return; + } + if( ent->client->pers.pteam != PTE_HUMANS ) return; diff --git a/src/game/g_local.h b/src/game/g_local.h index 81ed6966..54d73c90 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -258,7 +258,8 @@ typedef struct { int pclass; //TA: player class (copied to ent->client->ps.stats[ STAT_PCLASS ] once spawned) //not really persistant.. this is just a nice place to stick it :) - int pteam; //TA: player team (team deathmatch is too complex to alter) (copied to ps.stats[ STAT_PTEAM ]) + int pitem; //TA: humans have a starting item + int pteam; //TA: player team (copied to ps.stats[ STAT_PTEAM ]) } clientPersistant_t; // this structure is cleared on each ClientSpawn(), |