From 10e9899d3fb4f136e24193d08c55d0b11cef8c37 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 29 Mar 2020 15:03:13 +0200 Subject: Mess everything up --- src/game/bg_misc.c | 77 +++++++++++++++++++++++++++-------------------------- src/game/g_active.c | 4 +-- src/game/g_cmds.c | 52 +++++++++++++++++++++++++----------- src/game/g_local.h | 4 +-- src/game/g_weapon.c | 19 +++++++++++++ src/ui/ui_main.c | 48 ++++++++++++++++++++------------- 6 files changed, 129 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index cb41601..146a91d 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1989,7 +1989,7 @@ classAttributes_t bg_classList[ ] = 100.0f, //float stopSpeed; 220.0f, //float jumpMagnitude; 1.0f, //float knockbackScale; - { PCL_NONE, PCL_NONE, PCL_NONE }, //int children[ 3 ]; + { PCL_ALIEN_LEVEL0, PCL_NONE, PCL_NONE }, //int children[ 3 ]; 0, //int cost; 0 //int value; }, @@ -2028,7 +2028,7 @@ classAttributes_t bg_classList[ ] = 100.0f, //float stopSpeed; 270.0f, //float jumpMagnitude; 1.0f, //float knockbackScale; - { PCL_NONE, PCL_NONE, PCL_NONE }, //int children[ 3 ]; + { PCL_HUMAN, PCL_ALIEN_LEVEL3_UPG, PCL_ALIEN_LEVEL4 }, //int children[ 3 ]; 0, //int cost; 0 //int value; }, @@ -2756,7 +2756,8 @@ int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int num ) if( bg_classList[ i ].classNum == fclass ) { for( j = 0; j < 3; j++ ) - if( bg_classList[ i ].children[ j ] == tclass ) + if( tclass == PCL_HUMAN || tclass == PCL_HUMAN_BSUIT + || bg_classList[ i ].children[ j ] == tclass ) return num + cost; for( j = 0; j < 3; j++ ) @@ -3449,7 +3450,7 @@ weaponAttributes_t bg_weapons[ ] = }, { WP_ALEVEL0, //int weaponNum; - 0, //int price; + 0, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level0", //char *weaponName; @@ -3467,14 +3468,14 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_ALEVEL1, //int weaponNum; - 0, //int price; + 500, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level1", //char *weaponName; @@ -3492,14 +3493,14 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_ALEVEL1_UPG, //int weaponNum; - 0, //int price; + 600, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level1upg", //char *weaponName; @@ -3517,14 +3518,14 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qtrue, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_ALEVEL2, //int weaponNum; - 0, //int price; + 700, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level2", //char *weaponName; @@ -3542,14 +3543,14 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_ALEVEL2_UPG, //int weaponNum; - 0, //int price; + 1000, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level2upg", //char *weaponName; @@ -3567,14 +3568,14 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_ALEVEL3, //int weaponNum; - 0, //int price; + 1200, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level3", //char *weaponName; @@ -3592,14 +3593,14 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_ALEVEL3_UPG, //int weaponNum; - 0, //int price; + 1500, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level3upg", //char *weaponName; @@ -3617,14 +3618,14 @@ weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qtrue, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_ALEVEL4, //int weaponNum; - 0, //int price; + 2000, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "level4", //char *weaponName; @@ -3642,21 +3643,21 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_LOCKBLOB_LAUNCHER, //int weaponNum; - 0, //int price; + 900, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "lockblob", //char *weaponName; "Lock Blob", //char *weaponHumanName; - 0, //int maxAmmo; - 0, //int maxClips; - qtrue, //int infiniteAmmo; + 3, //int maxAmmo; + 2, //int maxClips; + qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; 500, //int repeatRate1; 500, //int repeatRate2; @@ -3667,21 +3668,21 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_HIVE, //int weaponNum; - 0, //int price; + 666, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "hive", //char *weaponName; "Hive", //char *weaponHumanName; - 0, //int maxAmmo; + 12, //int maxAmmo; 0, //int maxClips; - qtrue, //int infiniteAmmo; + qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; 500, //int repeatRate1; 500, //int repeatRate2; @@ -3692,23 +3693,23 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_ALIENS //WUTeam_t team; }, { WP_MGTURRET, //int weaponNum; - 0, //int price; + 500, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "mgturret", //char *weaponName; "Machinegun Turret", //char *weaponHumanName; - 0, //int maxAmmo; - 0, //int maxClips; - qtrue, //int infiniteAmmo; + 50, //int maxAmmo; + 5, //int maxClips; + qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; - 0, //int repeatRate1; + 200, //int repeatRate1; 0, //int repeatRate2; 0, //int repeatRate3; 0, //int reloadTime; @@ -3717,21 +3718,21 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, { WP_TESLAGEN, //int weaponNum; - 0, //int price; + 1000, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; "teslagen", //char *weaponName; "Tesla Generator", //char *weaponHumanName; - 0, //int maxAmmo; + 90, //int maxAmmo; 0, //int maxClips; - qtrue, //int infiniteAmmo; + qfalse, //int infiniteAmmo; qtrue, //int usesEnergy; 500, //int repeatRate1; 500, //int repeatRate2; @@ -3742,7 +3743,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qfalse, //qboolean purchasable; + qtrue, //qboolean purchasable; qfalse, //qboolean longRanged; 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; diff --git a/src/game/g_active.c b/src/game/g_active.c index bc4a5b6..1a67020 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1851,7 +1851,7 @@ void ClientThink_real( gentity_t *ent ) traceEnt = &g_entities[ trace.entityNum ]; - if( traceEnt && traceEnt->biteam == client->ps.stats[ STAT_PTEAM ] && traceEnt->use ) + if( traceEnt && /*traceEnt->biteam == client->ps.stats[ STAT_PTEAM ] &&*/ traceEnt->use ) traceEnt->use( traceEnt, ent, ent ); //other and activator are the same in this context else { @@ -1872,7 +1872,7 @@ void ClientThink_real( gentity_t *ent ) } } - if( i == num && client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + if( i == num /*&& client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS */ ) { if( BG_UpgradeClassAvailable( &client->ps ) ) { diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index a9e7daa..91a1383 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2770,7 +2770,8 @@ void Cmd_Class_f( gentity_t *ent ) if( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) G_StopFollowing( ent ); - if( ent->client->pers.teamSelection == PTE_ALIENS ) + //if( ent->client->pers.teamSelection == PTE_ALIENS ) + if( qtrue ) { if( !g_practise.integer ) { @@ -2778,6 +2779,7 @@ void Cmd_Class_f( gentity_t *ent ) newClass != PCL_ALIEN_BUILDER0_UPG && newClass != PCL_ALIEN_LEVEL0 ) { + goto must_be_human; trap_SendServerCommand( ent-g_entities, va( "print \"You cannot spawn with class %s\n\"", s ) ); return; @@ -2814,6 +2816,7 @@ void Cmd_Class_f( gentity_t *ent ) } else if( ent->client->pers.teamSelection == PTE_HUMANS ) { +must_be_human: //set the item to spawn with if( !Q_stricmp( s, BG_FindNameForWeapon( WP_MACHINEGUN ) ) && BG_WeaponIsAllowed( WP_MACHINEGUN ) ) @@ -2851,8 +2854,7 @@ void Cmd_Class_f( gentity_t *ent ) if( ent->health <= 0 ) return; - if( ent->client->pers.teamSelection == PTE_ALIENS && - !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) && + if( !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) && !( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) ) { if( newClass == PCL_NONE ) @@ -2881,8 +2883,10 @@ void Cmd_Class_f( gentity_t *ent ) { other = &g_entities[ entityList[ i ] ]; - if( ( other->client && other->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) || - ( other->s.eType == ET_BUILDABLE && other->biteam == BIT_HUMANS ) ) + if( other == ent ) + continue; + + if( other->client && other->client->man_bad ) { humanNear = qtrue; } @@ -2978,7 +2982,8 @@ void Cmd_Class_f( gentity_t *ent ) else if( ent->client->pers.teamSelection == PTE_HUMANS ) { //humans cannot use this command whilst alive - if( ent->client->pers.classSelection != PCL_NONE ) + //if( ent->client->pers.classSelection != PCL_NONE ) + if( qfalse ) { trap_SendServerCommand( ent-g_entities, va( "print \"You must be dead to use the class command\n\"" ) ); return; @@ -3425,7 +3430,7 @@ void Cmd_Buy_f( gentity_t *ent ) char s[ MAX_TOKEN_CHARS ]; int i; int weapon, upgrade, numItems = 0; - int maxAmmo, maxClips; + int maxAmmo, maxClips, price; qboolean buyingEnergyAmmo = qfalse; qboolean hasEnergyWeapon = qfalse; @@ -3495,8 +3500,12 @@ void Cmd_Buy_f( gentity_t *ent ) return; } + price = BG_FindPriceForWeapon( weapon ); + if( ent->client->pers.teamSelection == PTE_ALIENS ) + price /= 175; + //can afford this? - if( BG_FindPriceForWeapon( weapon ) > (short)ent->client->ps.persistant[ PERS_CREDIT ] ) + if( price > (short)ent->client->ps.persistant[ PERS_CREDIT ] ) { G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS ); return; @@ -3509,7 +3518,8 @@ void Cmd_Buy_f( gentity_t *ent ) return; } - if( BG_FindTeamForWeapon( weapon ) != WUT_HUMANS ) + //if( BG_FindTeamForWeapon( weapon ) != WUT_HUMANS ) + if( qfalse ) { //shouldn't need a fancy dialog trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy alien items\n\"" ) ); @@ -3547,7 +3557,7 @@ void Cmd_Buy_f( gentity_t *ent ) ent->client->ps.stats[ STAT_MISC ] = 0; //subtract from funds - G_AddCreditToClient( ent->client, -(short)BG_FindPriceForWeapon( weapon ), qfalse ); + G_AddCreditToClient( ent->client, -(short)price, qfalse ); } else if( upgrade != UP_NONE ) { @@ -3566,8 +3576,12 @@ void Cmd_Buy_f( gentity_t *ent ) return; } + price = BG_FindPriceForUpgrade( upgrade ); + if( ent->client->pers.teamSelection == PTE_ALIENS ) + price /= 175; + //can afford this? - if( BG_FindPriceForUpgrade( upgrade ) > (short)ent->client->ps.persistant[ PERS_CREDIT ] ) + if( price > (short)ent->client->ps.persistant[ PERS_CREDIT ] ) { G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS ); return; @@ -3620,7 +3634,7 @@ void Cmd_Buy_f( gentity_t *ent ) G_GiveClientMaxAmmo( ent, qtrue ); //subtract from funds - G_AddCreditToClient( ent->client, -(short)BG_FindPriceForUpgrade( upgrade ), qfalse ); + G_AddCreditToClient( ent->client, -(short)price, qfalse ); } else { @@ -3656,7 +3670,7 @@ void Cmd_Sell_f( gentity_t *ent ) { char s[ MAX_TOKEN_CHARS ]; int i; - int weapon, upgrade; + int weapon, upgrade, price; trap_Argv( 1, s, sizeof( s ) ); @@ -3692,8 +3706,12 @@ void Cmd_Sell_f( gentity_t *ent ) BG_RemoveWeaponFromInventory( weapon, ent->client->ps.stats ); + price = BG_FindPriceForWeapon( weapon ); + if( ent->client->pers.teamSelection == PTE_ALIENS ) + price /= 175; + //add to funds - G_AddCreditToClient( ent->client, (short)BG_FindPriceForWeapon( weapon ), qfalse ); + G_AddCreditToClient( ent->client, (short)price, qfalse ); } //if we have this weapon selected, force a new selection @@ -3774,8 +3792,12 @@ void Cmd_Sell_f( gentity_t *ent ) } } + price = BG_FindPriceForUpgrade( upgrade ); + if( ent->client->pers.teamSelection == PTE_ALIENS ) + price /= 175; + //add to funds - G_AddCreditToClient( ent->client, (short)BG_FindPriceForUpgrade( i ), qfalse ); + G_AddCreditToClient( ent->client, (short)price, qfalse ); } } } diff --git a/src/game/g_local.h b/src/game/g_local.h index 43c2c1a..1720c4c 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -830,8 +830,8 @@ typedef struct #define CMD_MESSAGE 0x02 // sends message to others (skip when muted) #define CMD_TEAM 0x04 // must be on a team #define CMD_NOTEAM 0x08 // must not be on a team -#define CMD_ALIEN 0x10 -#define CMD_HUMAN 0x20 +#define CMD_ALIEN 0x0 +#define CMD_HUMAN 0x0 #define CMD_LIVING 0x40 #define CMD_INTERMISSION 0x80 // valid during intermission diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index e50594a..90e474e 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -464,6 +464,25 @@ HIVE void hiveFire( gentity_t *ent ) { + trace_t tr; + vec3_t end; + gentity_t *traceEnt; + + if( !ent->target_ent ) + { + VectorMA( muzzle, 8192 * 16, forward, end ); + + G_UnlaggedOn( ent, muzzle, 8192 * 16 ); + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + G_UnlaggedOff( ); + + traceEnt = g_entities + tr.entityNum; + if( !traceEnt->takedamage ) + return; + + ent->target_ent = traceEnt; + } + fire_hive( ent, muzzle, forward ); } diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index d74dd9d..38ba6ba 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -3206,6 +3206,23 @@ static void UI_AddClass( pClass_t class ) uiInfo.tremAlienClassCount++; } +/* +=============== +UI_AddItem +=============== +*/ +static void UI_AddItem( weapon_t weapon ) +{ + uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].text = + String_Alloc( BG_FindHumanNameForWeapon( weapon ) ); + uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].cmd = + String_Alloc( va( "cmd class %s\n", BG_FindNameForWeapon( weapon ) ) ); + uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].infopane = + UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( weapon ) ) ); + + uiInfo.tremHumanItemCount++; +} + /* =============== UI_LoadTremAlienClasses @@ -3223,23 +3240,9 @@ static void UI_LoadTremAlienClasses( void ) UI_AddClass( PCL_ALIEN_BUILDER0_UPG ); else if( BG_ClassIsAllowed( PCL_ALIEN_BUILDER0 ) ) UI_AddClass( PCL_ALIEN_BUILDER0 ); -} - -/* -=============== -UI_AddItem -=============== -*/ -static void UI_AddItem( weapon_t weapon ) -{ - uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].text = - String_Alloc( BG_FindHumanNameForWeapon( weapon ) ); - uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].cmd = - String_Alloc( va( "cmd class %s\n", BG_FindNameForWeapon( weapon ) ) ); - uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].infopane = - UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( weapon ) ) ); - uiInfo.tremHumanItemCount++; + if( BG_WeaponIsAllowed( WP_MACHINEGUN ) ) + UI_AddItem( PCL_HUMAN ); } /* @@ -3259,6 +3262,15 @@ static void UI_LoadTremHumanItems( void ) UI_AddItem( WP_HBUILD2 ); else if( BG_WeaponIsAllowed( WP_HBUILD ) ) UI_AddItem( WP_HBUILD ); + + if( BG_WeaponIsAllowed( WP_ALEVEL0 ) ) + UI_AddItem( WP_ALEVEL0 ); + + if( BG_WeaponIsAllowed( WP_ABUILD2 ) && + BG_FindStagesForClass( PCL_ALIEN_BUILDER0_UPG, UI_GetCurrentAlienStage( ) ) ) + UI_AddItem( WP_ABUILD2 ); + else + UI_AddItem( WP_ABUILD ); } /* @@ -3351,7 +3363,7 @@ static void UI_LoadTremHumanArmouryBuys( void ) for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( BG_FindTeamForWeapon( i ) == WUT_HUMANS && + if( /*BG_FindTeamForWeapon( i ) == WUT_HUMANS &&*/ BG_FindPurchasableForWeapon( i ) && BG_FindStagesForWeapon( i, stage ) && BG_WeaponIsAllowed( i ) && @@ -3373,7 +3385,7 @@ static void UI_LoadTremHumanArmouryBuys( void ) for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( BG_FindTeamForUpgrade( i ) == WUT_HUMANS && + if( /*BG_FindTeamForUpgrade( i ) == WUT_HUMANS &&*/ BG_FindPurchasableForUpgrade( i ) && BG_FindStagesForUpgrade( i, stage ) && BG_UpgradeIsAllowed( i ) && -- cgit