Ticket #47: instantWeaponSwitch.patch
File instantWeaponSwitch.patch, 2.3 KB (added by , 11 years ago) |
---|
-
code/cgame/cg_consolecmds.c
diff --git a/code/cgame/cg_consolecmds.c b/code/cgame/cg_consolecmds.c index 039acfb..d84bc02 100644
a b static consoleCommand_t commands[] = { 833 833 { "node_savefile", CG_SaveFileAiNode_f}, 834 834 { "node_openfile", CG_OpenFileAiNode_f}, 835 835 { "wq_buy", CG_BuyMenu }, 836 { "instaswap", CG_InstaSwap }, 836 837 #endif 837 838 { "startOrbit", CG_StartOrbit_f }, 838 839 //{ "camera", CG_Camera_f }, -
code/cgame/cg_local.h
diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index a252e0e..c4a8817 100644
a b void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent 2116 2116 void CG_DrawWeaponSelect( void ); 2117 2117 2118 2118 void CG_OutOfAmmoChange( void ); // should this be in pmove? 2119 void CG_InstaSwap ( void ); 2119 2120 2120 2121 // 2121 2122 // cg_marks.c -
code/cgame/cg_weapons.c
diff --git a/code/cgame/cg_weapons.c b/code/cgame/cg_weapons.c index 6e9d199..35315c3 100644
a b void CG_BulletTracer( vec3_t start, vec3_t end, int number, int entityNum ) { 4374 4374 VectorCopy(start, re->origin); 4375 4375 re->origin[2] += 2 ; 4376 4376 } 4377 4378 void CG_InstaSwap(){ 4379 playerState_t *ps = &cg.predictedPlayerState; 4380 char weapon[MAX_STRING_TOKENS]; 4381 trap_Argv( 1, weapon , sizeof( weapon ) ); 4382 4383 if (!Q_stricmp(weapon,"knife")){ 4384 cg.weaponSelect=WP_KNIFE; 4385 } else if (!Q_stricmp(weapon,"pistol1")){ 4386 int pistol; 4387 if (pistol=BG_SearchTypeWeapon(WPS_PISTOL,ps->stats[STAT_WEAPONS],0)){ 4388 cg.weaponSelect=pistol; 4389 4390 } 4391 } else if (!Q_stricmp(weapon,"pistol2")){ 4392 int pistol; 4393 if (pistol=BG_SearchTypeWeapon(WPS_PISTOL,ps->stats[STAT_WEAPONS],BG_SearchTypeWeapon(WPS_PISTOL,ps->stats[STAT_WEAPONS],0))){ 4394 //Something tells me there should be a better way to do this. 4395 cg.weaponSelect=pistol; 4396 4397 } 4398 } else if (!Q_stricmp(weapon,"akimbo")){ 4399 cg.weaponSelect=WP_AKIMBO; 4400 } else if (!Q_stricmp(weapon,"longgun")){ 4401 int longgun; 4402 if (longgun=BG_SearchTypeWeapon(WPS_GUN,ps->stats[STAT_WEAPONS],0)){ 4403 cg.weaponSelect=longgun; 4404 } 4405 } else if (!Q_stricmp(weapon,"dynamite")){ 4406 cg.weaponSelect=WP_DYNAMITE; 4407 } else if (!Q_stricmp(weapon,"molotov")){ 4408 cg.weaponSelect=WP_MOLOTOV; 4409 } else { 4410 CG_Printf("Unrecognized weapon: %s",weapon); 4411 } 4412 } 4413 4377 4414 #endif