diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 40 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/g_cmds.c | 24 | ||||
-rw-r--r-- | src/game/g_weapon.c | 12 |
4 files changed, 70 insertions, 9 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index a7f4d440..d9dedb63 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2039,6 +2039,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2060,6 +2061,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2081,6 +2083,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2102,6 +2105,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2123,6 +2127,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2144,6 +2149,7 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2165,6 +2171,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2186,6 +2193,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2207,6 +2215,7 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 10000, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2228,6 +2237,7 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; + 5000, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2249,6 +2259,7 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 10000, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2270,6 +2281,7 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 5000, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2291,6 +2303,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2312,6 +2325,7 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasAltMode; qtrue, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2333,6 +2347,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2354,6 +2369,7 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2375,6 +2391,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2396,6 +2413,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { @@ -2417,6 +2435,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { @@ -2438,6 +2457,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; + 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; } }; @@ -2770,6 +2790,26 @@ qboolean BG_FindPurchasableForWeapon( int weapon ) /* ============== +BG_FindBuildDelayForWeapon +============== +*/ +int BG_FindBuildDelayForWeapon( int weapon ) +{ + int i; + + for( i = 0; i < bg_numWeapons; i++ ) + { + if( bg_weapons[ i ].weaponNum == weapon ) + { + return bg_weapons[ i ].buildDelay; + } + } + + return 0; +} + +/* +============== BG_FindTeamForWeapon ============== */ diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 3d9be4b9..c4517a57 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -965,6 +965,8 @@ typedef struct qboolean synced; qboolean purchasable; + + int buildDelay; WUTeam_t team; } weaponAttributes_t; @@ -1073,6 +1075,7 @@ int BG_FindReloadTimeForWeapon( int weapon ); qboolean BG_WeaponHasAltMode( int weapon ); qboolean BG_WeaponModesAreSynced( int weapon ); qboolean BG_FindPurchasableForWeapon( int weapon ); +int BG_FindBuildDelayForWeapon( int weapon ); WUTeam_t BG_FindTeamForWeapon( int weapon ); int BG_FindPriceForUpgrade( int upgrade ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index a58b57ca..090762bc 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1729,7 +1729,7 @@ void Cmd_Class_f( gentity_t *ent ) Cmd_Destroy_f ================= */ -void Cmd_Destroy_f( gentity_t *ent ) +void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct ) { vec3_t forward, end; trace_t tr; @@ -1751,7 +1751,20 @@ void Cmd_Destroy_f( gentity_t *ent ) ( traceEnt->biteam == ent->client->pers.pteam ) && ( ( ent->client->ps.weapon >= WP_ABUILD ) && ( ent->client->ps.weapon <= WP_HBUILD ) ) ) - G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10000, 0, MOD_SUICIDE ); + { + if( ent->client->ps.stats[ STAT_MISC ] > 0 ) + { + G_AddPredictableEvent( ent, EV_BUILD_DELAY, 0 ); + return; + } + + if( !deconstruct ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10000, 0, MOD_SUICIDE ); + else + G_FreeEntity( traceEnt ); + + ent->client->ps.stats[ STAT_MISC ] += BG_FindBuildDelayForWeapon( ent->s.weapon ) >> 1; + } } } @@ -1933,6 +1946,9 @@ void Cmd_Buy_f( gentity_t *ent ) BG_packAmmoArray( weapon, ent->client->ps.ammo, ent->client->ps.powerups, quan, clips, maxClips ); ent->client->ps.weapon = weapon; + + //set build delay/pounce etc to 0 + ent->client->ps.stats[ STAT_MISC ] = 0; //subtract from funds ent->client->ps.persistant[ PERS_CREDIT ] -= BG_FindPriceForWeapon( weapon ); @@ -2541,7 +2557,9 @@ void ClientCommand( int clientNum ) { else if (Q_stricmp (cmd, "itemtoggle") == 0) Cmd_ToggleItem_f( ent ); else if (Q_stricmp (cmd, "destroy") == 0) - Cmd_Destroy_f( ent ); + Cmd_Destroy_f( ent, qfalse ); + else if (Q_stricmp (cmd, "deconstruct") == 0) + Cmd_Destroy_f( ent, qtrue ); else if (Q_stricmp (cmd, "echo") == 0) Cmd_Echo_f( ent ); else if (Q_stricmp (cmd, "boost") == 0) diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 3b65ddb6..6174a3b4 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -411,7 +411,7 @@ void cancelBuildFire( gentity_t *ent ) ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; } -void buildFire( gentity_t *ent, dynMenu_t menu, int delay ) +void buildFire( gentity_t *ent, dynMenu_t menu ) { if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE ) { @@ -423,7 +423,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu, int delay ) G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ); ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; - ent->client->ps.stats[ STAT_MISC ] += delay; + ent->client->ps.stats[ STAT_MISC ] += BG_FindBuildDelayForWeapon( ent->s.weapon ); return; } @@ -993,16 +993,16 @@ void FireWeapon( gentity_t *ent ) painSawFire( ent ); break; case WP_ABUILD: - buildFire( ent, MN_A_BUILD, 10000 ); + buildFire( ent, MN_A_BUILD ); break; case WP_ABUILD2: - buildFire( ent, MN_A_BUILD, 5000 ); + buildFire( ent, MN_A_BUILD ); break; case WP_HBUILD: - buildFire( ent, MN_H_BUILD, 10000 ); + buildFire( ent, MN_H_BUILD ); break; case WP_HBUILD2: - buildFire( ent, MN_H_BUILD, 5000 ); + buildFire( ent, MN_H_BUILD ); break; default: // FIXME G_Error( "Bad ent->s.weapon" ); |