============ Player_CacheFromPrevLevel Description : just need to grab the weapon items we're going to have when we spawn so they'll be cached Return type : void Argument : void ============ */
| 634 | ============ |
| 635 | */ |
| 636 | void Player_CacheFromPrevLevel(void) |
| 637 | { |
| 638 | char s[MAX_STRING_CHARS]; |
| 639 | int i; |
| 640 | |
| 641 | gi.Cvar_VariableStringBuffer( sCVARNAME_PLAYERSAVE, s, sizeof(s) ); |
| 642 | |
| 643 | if (s[0]) // actually this would be safe anyway because of the way sscanf() works, but this is clearer |
| 644 | { |
| 645 | int iDummy, bits, ibits; |
| 646 | |
| 647 | sscanf( s, "%i %i %i %i", |
| 648 | &iDummy,//client->ps.stats[STAT_HEALTH], |
| 649 | &iDummy,//client->ps.stats[STAT_ARMOR], |
| 650 | &bits, //client->ps.stats[STAT_WEAPONS] |
| 651 | &ibits //client->ps.stats[STAT_ITEMS] |
| 652 | ); |
| 653 | |
| 654 | for ( i = 1 ; i < 16 ; i++ ) |
| 655 | { |
| 656 | if ( bits & ( 1 << i ) ) |
| 657 | { |
| 658 | RegisterItem( FindItemForWeapon( (weapon_t)i ) ); |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | extern gitem_t *FindItemForInventory( int inv ); |
| 663 | |
| 664 | for ( i = 0 ; i < 16 ; i++ ) |
| 665 | { |
| 666 | if ( ibits & ( 1 << i ) ) |
| 667 | { |
| 668 | RegisterItem( FindItemForInventory( i )); |
| 669 | } |
| 670 | } |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | /* |
| 675 | ============ |
no test coverage detected