[iortcw] 30/89: All: Don't warn when weapon cfg is missing altswitch animations
Simon McVittie
smcv at debian.org
Fri Sep 8 10:44:20 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to tag 1.51b
in repository iortcw.
commit a868a26377904dc4f0fe94a62d87206115e16f9d
Author: Zack Middleton <zack at cloemail.com>
Date: Wed Jun 21 22:10:17 2017 -0500
All: Don't warn when weapon cfg is missing altswitch animations
The parser was recently fixed to detect missing tokens. This caused
an error message for some of the default MP weapon cfgs that do not
include altswitch animations. None of the weapons actually use the
altswitch animation so disable the warning for them.
Previously the missing animations would be loaded with 0 for all
params. I just copy idle1 to them instead. Shouldn't be used in
any case.
---
MP/code/cgame/cg_weapons.c | 10 ++++++++--
SP/code/cgame/cg_weapons.c | 10 ++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/MP/code/cgame/cg_weapons.c b/MP/code/cgame/cg_weapons.c
index 5a2cae6..79a1f82 100644
--- a/MP/code/cgame/cg_weapons.c
+++ b/MP/code/cgame/cg_weapons.c
@@ -916,7 +916,7 @@ CG_ParseWeaponConfig
read information for weapon animations (first/length/fps)
======================
*/
-static qboolean CG_ParseWeaponConfig( const char *filename, weaponInfo_t *wi ) {
+static qboolean CG_ParseWeaponConfig( const char *filename, weaponInfo_t *wi, int weaponNum ) {
char *text_p, *prev;
int len;
int i;
@@ -977,6 +977,12 @@ static qboolean CG_ParseWeaponConfig( const char *filename, weaponInfo_t *wi ) {
token = COM_Parse( &text_p ); // first frame
if ( !token[0] ) {
+ // don't show warning for weapon cfg without altswitch that does not require it.
+ if ( i == WEAP_ALTSWITCHFROM && weapAlts[weaponNum] == WP_NONE ) {
+ for ( ; i < MAX_WP_ANIMATIONS ; i++ ) {
+ Com_Memcpy( &wi->weapAnimations[i], &wi->weapAnimations[WEAP_IDLE1], sizeof( wi->weapAnimations[0] ) );
+ }
+ }
break;
}
wi->weapAnimations[i].firstFrame = atoi( token );
@@ -1122,7 +1128,7 @@ void CG_RegisterWeapon( int weaponNum ) {
//----(SA) modified. use first person model for finding weapon config name, not third
if ( item->world_model[W_FP_MODEL] ) {
COM_StripFilename( item->world_model[W_FP_MODEL], path );
- if ( !CG_ParseWeaponConfig( va( "%sweapon.cfg", path ), weaponInfo ) ) {
+ if ( !CG_ParseWeaponConfig( va( "%sweapon.cfg", path ), weaponInfo, weaponNum ) ) {
// CG_Error( "Couldn't register weapon %i (%s) (failed to parse weapon.cfg)", weaponNum, path );
}
}
diff --git a/SP/code/cgame/cg_weapons.c b/SP/code/cgame/cg_weapons.c
index a8742ca..0e10f0b 100644
--- a/SP/code/cgame/cg_weapons.c
+++ b/SP/code/cgame/cg_weapons.c
@@ -859,7 +859,7 @@ CG_ParseWeaponConfig
read information for weapon animations (first/length/fps)
======================
*/
-static qboolean CG_ParseWeaponConfig( const char *filename, weaponInfo_t *wi ) {
+static qboolean CG_ParseWeaponConfig( const char *filename, weaponInfo_t *wi, int weaponNum ) {
char *text_p, *prev;
int len;
int i;
@@ -920,6 +920,12 @@ static qboolean CG_ParseWeaponConfig( const char *filename, weaponInfo_t *wi ) {
token = COM_Parse( &text_p ); // first frame
if ( !token[0] ) {
+ // don't show warning for weapon cfg without altswitch that does not require it.
+ if ( i == WEAP_ALTSWITCHFROM && weapAlts[weaponNum] == WP_NONE ) {
+ for ( ; i < MAX_WP_ANIMATIONS ; i++ ) {
+ Com_Memcpy( &wi->weapAnimations[i], &wi->weapAnimations[WEAP_IDLE1], sizeof( wi->weapAnimations[0] ) );
+ }
+ }
break;
}
wi->weapAnimations[i].firstFrame = atoi( token );
@@ -1075,7 +1081,7 @@ void CG_RegisterWeapon( int weaponNum ) {
//----(SA) modified. use first person model for finding weapon config name, not third
if ( item->world_model[W_FP_MODEL] ) {
COM_StripFilename( item->world_model[W_FP_MODEL], path );
- if ( !CG_ParseWeaponConfig( va( "%sweapon.cfg", path ), weaponInfo ) ) {
+ if ( !CG_ParseWeaponConfig( va( "%sweapon.cfg", path ), weaponInfo, weaponNum ) ) {
CG_Error( "Couldn't register weapon %i (%s) (failed to parse weapon.cfg)", weaponNum, path );
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list