diff options
Diffstat (limited to 'src/game/bg_misc.c')
-rw-r--r-- | src/game/bg_misc.c | 134 |
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 ]; + } + } +} |