summaryrefslogtreecommitdiff
path: root/src/game/bg_misc.c
diff options
context:
space:
mode:
authorPaweł Redman <pawel@redman.xyz>2017-04-13 11:30:00 +0000
committer/dev/humancontroller <devhc@example.com>2017-04-15 12:06:43 +0200
commit5ad9e26c3be1f2ebc6cdb340b685aef30ae16db7 (patch)
tree5ee97c52196122bd8356ad8e09403332e7712fcd /src/game/bg_misc.c
parent45973dc48641365b31475733bce7af9c3b8603a6 (diff)
import the cQVM game module
replacing the existing one
Diffstat (limited to 'src/game/bg_misc.c')
-rw-r--r--src/game/bg_misc.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 79a8e2a..1a55ed0 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -32,6 +32,8 @@ void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ); // fsOrigin_t
+modExtremeType_t modEntry[ MOD_BG_COUNT ];
+
buildableAttributes_t bg_buildableList[ ] =
{
{
@@ -5730,4 +5732,136 @@ void BG_ClientListParse( clientList_t *list, const char *s )
sscanf( s, "%x%x", &list->hi, &list->lo );
}
+void BG_MOD_set( modExtremeType_t entry, int value )
+{
+ if( entry >= 0 && entry < MOD_BG_COUNT )
+ {
+ if( value < 0 )
+ value = 0;
+
+ modEntry[ entry ] = value;
+ }
+}
+
+int BG_MOD_get( modExtremeType_t entry)
+{
+ if( entry >= 0 && entry < MOD_BG_COUNT )
+ return modEntry[ entry ];
+
+ return 0;
+}
+
+void BG_MOD_update( void )
+{
+ static qboolean updated = qfalse;
+ int i;
+
+ if( updated ) return;
+ updated = qtrue;
+
+ for( i = 0; i < bg_numBuildables; i++ )
+ {
+ if( modEntry[ MOD_BG_BUILDABLE_HEALTH ] )
+ {
+ bg_buildableList[ i ].health =
+ bg_buildableList[ i ].health * modEntry[ MOD_BG_BUILDABLE_HEALTH ] / 100;
+ }
+
+ if( modEntry[ MOD_BG_BUILDABLE_SPEED ] )
+ {
+ bg_buildableList[ i ].turretFireSpeed =
+ bg_buildableList[ i ].turretFireSpeed * 100 / modEntry[ MOD_BG_BUILDABLE_SPEED ];
+ }
+
+ if( modEntry[ MOD_BG_TURRET_ANGLE ] &&
+ ( bg_buildableList[ i ].buildNum == BA_H_MGTURRET ||
+ bg_buildableList[ i ].buildNum == BA_H_TESLAGEN ) )
+ {
+ bg_buildableList[ i ].minNormal = 0.0f;
+ }
+ }
+
+ for( i = 0; i < bg_numPclasses; i++ )
+ {
+ if( bg_classList[ i ].classNum == PCL_HUMAN ||
+ bg_classList[ i ].classNum == PCL_HUMAN_BSUIT )
+ {
+ if( modEntry[ MOD_BG_HUMAN_HEALTH ] )
+ {
+ bg_classList[ i ].health =
+ bg_classList[ i ].health * modEntry[ MOD_BG_HUMAN_HEALTH ] / 100;
+ }
+ }
+ else
+ {
+ if( modEntry[ MOD_BG_ALIEN_HEALTH ] )
+ bg_classList[ i ].health =
+ bg_classList[ i ].health * modEntry[ MOD_BG_ALIEN_HEALTH ] / 100;
+ }
+ }
+
+ for( i = 0; i < bg_numWeapons; i++ )
+ {
+ if( modEntry[ MOD_BG_WEAPON_AMMO ] &&
+ bg_weapons[ i ].weaponNum != WP_ALEVEL3_UPG )
+ {
+ bg_weapons[ i ].maxAmmo =
+ bg_weapons[ i ].maxAmmo * modEntry[ MOD_BG_WEAPON_AMMO ] / 100;
+ }
+
+ if( modEntry[ MOD_BG_ALIEN_RATE ] &&
+ bg_weapons[ i ].weaponNum >= WP_ALEVEL0 &&
+ bg_weapons[ i ].weaponNum <= WP_ALEVEL4 )
+ {
+ bg_weapons[ i ].repeatRate1 =
+ bg_weapons[ i ].repeatRate1 * 100 / modEntry[ MOD_BG_ALIEN_RATE ];
+ bg_weapons[ i ].repeatRate2 =
+ bg_weapons[ i ].repeatRate2 * 100 / modEntry[ MOD_BG_ALIEN_RATE ];
+ bg_weapons[ i ].repeatRate3 =
+ bg_weapons[ i ].repeatRate3 * 100 / modEntry[ MOD_BG_ALIEN_RATE ];
+ }
+
+ if( modEntry[ MOD_BG_HUMAN_RATE ] &&
+ bg_weapons[ i ].weaponNum >= WP_BLASTER &&
+ bg_weapons[ i ].weaponNum <= WP_LUCIFER_CANNON )
+ {
+ bg_weapons[ i ].repeatRate1 =
+ bg_weapons[ i ].repeatRate1 * 100 / modEntry[ MOD_BG_HUMAN_RATE ];
+ bg_weapons[ i ].repeatRate2 =
+ bg_weapons[ i ].repeatRate2 * 100 / modEntry[ MOD_BG_HUMAN_RATE ];
+ bg_weapons[ i ].repeatRate3 =
+ bg_weapons[ i ].repeatRate3 * 100 / modEntry[ MOD_BG_HUMAN_RATE ];
+ }
+
+ if( modEntry[ MOD_BG_BUILDABLE_HEALTH ] &&
+ modEntry[ MOD_BG_HUMAN_RATE ] &&
+ ( bg_weapons[ i ].weaponNum == WP_ABUILD || bg_weapons[ i ].weaponNum == WP_ABUILD2 ) )
+ {
+ int avg;
+
+ avg = ( modEntry[ MOD_BG_BUILDABLE_HEALTH ] + MOD_BG_HUMAN_RATE ) / 2;
+ bg_weapons[ i ].repeatRate1 = bg_weapons[ i ].repeatRate1 * 100 / avg;
+ bg_weapons[ i ].repeatRate2 = bg_weapons[ i ].repeatRate2 * 100 / avg;
+ bg_weapons[ i ].repeatRate3 = bg_weapons[ i ].repeatRate3 * 100 / avg;
+ }
+
+ if( modEntry[ MOD_BG_BUILDABLE_HEALTH ] &&
+ modEntry[ MOD_BG_ALIEN_RATE ] &&
+ ( bg_weapons[ i ].weaponNum == WP_HBUILD || bg_weapons[ i ].weaponNum == WP_HBUILD2 ) )
+ {
+ int avg;
+
+ avg = ( modEntry[ MOD_BG_BUILDABLE_HEALTH ] + MOD_BG_ALIEN_RATE ) / 2;
+ bg_weapons[ i ].repeatRate1 = bg_weapons[ i ].repeatRate1 * 100 / avg;
+ bg_weapons[ i ].repeatRate2 = bg_weapons[ i ].repeatRate2 * 100 / avg;
+ bg_weapons[ i ].repeatRate3 = bg_weapons[ i ].repeatRate3 * 100 / avg;
+ }
+
+ if( modEntry[ MOD_BG_WEAPON_RELOAD ] )
+ {
+ bg_weapons[ i ].reloadTime =
+ bg_weapons[ i ].reloadTime * 100 / modEntry[ MOD_BG_WEAPON_RELOAD ];
+ }
+ }
+}