bg_pmove.c :
two ways: after animation is played
under
if( pm->ps->weaponstate == WEAPON_RAISING ) {
pm->ps->weaponstate = WEAPON_READY;
or when animation is played
under
if( pm->ps->weaponstate == WEAPON_DROPPING_TORELOAD ) {
pm->ps->weaponstate = WEAPON_RAISING_TORELOAD;
} else {
pm->ps->weaponstate = WEAPON_RAISING;
}
add
PM_AddEvent( EV_SWITCHWEAPON );
now declare EV_SWITCHWEAPON ( add it in lists in bg_public.h and bg_misc.c )
you can now add under ( cg_event.c )
case EV_EMPTYCLIP:
DEBUGNAME("EV_EMPTYCLIP");
break;
case EV_SWITCHWEAPON :
DEBUGNAME("EV_SWITCHWEAPON ");
trap_S_StartSound (NULL, es->number, CHAN_WEAPON, cg_weapons[es->weapon].raiseSound );
break;
add sfxHandle_t raiseSound; to weaponInfo_t ( cg_local.h
and in cg_weapons.c rewrite this
/*} else if( !Q_stricmp( token.string, "ammoIcon" ) ) {
if( !PC_String_ParseNoAlloc( handle, filename, sizeof(filename) ) ) {
return CG_RW_ParseError( handle, "expected ammoIcon filename" );
} else {
weaponInfo->ammoIcon = trap_R_RegisterShader( filename );
}*/
to this
} else if( !Q_stricmp( token.string, "raiseSound" ) ) {
if( !PC_String_ParseNoAlloc( handle, filename, sizeof(filename) ) ) {
return CG_RW_ParseError( handle, "raise sound filename" );
} else {
weaponInfo->raiseSound= trap_S_RegisterSound( filename, qfalse );
}
havent tried so dont yell if there are errors