Skip to content

Commit

Permalink
WeaponAutoSwitch now works in co-op. Common key array names.
Browse files Browse the repository at this point in the history
  • Loading branch information
danij committed May 29, 2005
1 parent a75bf5f commit 85d2ff1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
43 changes: 25 additions & 18 deletions doomsday/Src/jDoom/p_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// for more details.
//
// $Log$
// Revision 1.13 2005/05/29 12:54:36 danij
// WeaponAutoSwitch now works in co-op. Common key array names.
//
// Revision 1.12 2005/01/01 22:58:52 skyjake
// Resolved a bunch of compiler warnings
//
Expand Down Expand Up @@ -225,8 +228,12 @@ boolean P_GiveWeapon(player_t *player, weapontype_t weapon, boolean dropped)
P_GiveAmmo(player, weaponinfo[weapon].ammo, 5);
else
P_GiveAmmo(player, weaponinfo[weapon].ammo, 2);
player->pendingweapon = weapon;
player->update |= PSF_PENDING_WEAPON | PSF_READY_WEAPON;

if( cfg.weaponAutoSwitch || deathmatch == 1 )
{
player->pendingweapon = weapon;
player->update |= PSF_PENDING_WEAPON | PSF_READY_WEAPON;
}

/*if (player == &players[consoleplayer])
{ */
Expand Down Expand Up @@ -254,7 +261,7 @@ boolean P_GiveWeapon(player_t *player, weapontype_t weapon, boolean dropped)
gaveweapon = true;
player->weaponowned[weapon] = true;
player->update |= PSF_OWNED_WEAPONS;
if( /*!INCOMPAT_OK || */ cfg.weaponAutoSwitch)
if( cfg.weaponAutoSwitch )
{
player->pendingweapon = weapon;
player->update |= PSF_PENDING_WEAPON | PSF_READY_WEAPON;
Expand Down Expand Up @@ -311,13 +318,13 @@ boolean P_GiveArmor(player_t *player, int armortype)
//
// P_GiveCard
//
void P_GiveCard(player_t *player, card_t card)
void P_GiveKey(player_t *player, card_t card)
{
if(player->cards[card])
if(player->keys[card])
return;

player->bonuscount = BONUSADD;
player->cards[card] = 1;
player->keys[card] = 1;
player->update |= PSF_KEYS;
}

Expand Down Expand Up @@ -471,49 +478,49 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher)
// cards
// leave cards for everyone
case SPR_BKEY:
if(!player->cards[it_bluecard])
if(!player->keys[it_bluecard])
P_SetMessage(player, GOTBLUECARD);
P_GiveCard(player, it_bluecard);
P_GiveKey(player, it_bluecard);
if(!IS_NETGAME)
break;
return;

case SPR_YKEY:
if(!player->cards[it_yellowcard])
if(!player->keys[it_yellowcard])
P_SetMessage(player, GOTYELWCARD);
P_GiveCard(player, it_yellowcard);
P_GiveKey(player, it_yellowcard);
if(!IS_NETGAME)
break;
return;

case SPR_RKEY:
if(!player->cards[it_redcard])
if(!player->keys[it_redcard])
P_SetMessage(player, GOTREDCARD);
P_GiveCard(player, it_redcard);
P_GiveKey(player, it_redcard);
if(!IS_NETGAME)
break;
return;

case SPR_BSKU:
if(!player->cards[it_blueskull])
if(!player->keys[it_blueskull])
P_SetMessage(player, GOTBLUESKUL);
P_GiveCard(player, it_blueskull);
P_GiveKey(player, it_blueskull);
if(!IS_NETGAME)
break;
return;

case SPR_YSKU:
if(!player->cards[it_yellowskull])
if(!player->keys[it_yellowskull])
P_SetMessage(player, GOTYELWSKUL);
P_GiveCard(player, it_yellowskull);
P_GiveKey(player, it_yellowskull);
if(!IS_NETGAME)
break;
return;

case SPR_RSKU:
if(!player->cards[it_redskull])
if(!player->keys[it_redskull])
P_SetMessage(player, GOTREDSKULL);
P_GiveCard(player, it_redskull);
P_GiveKey(player, it_redskull);
if(!IS_NETGAME)
break;
return;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/Src/jDoom/p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,8 @@ void P_SpawnPlayer(mapthing_t * mthing, int pnum)

// give all cards in death match mode
if(deathmatch)
for(i = 0; i < NUMCARDS; i++)
p->cards[i] = true;
for(i = 0; i < NUMKEYS; i++)
p->keys[i] = true;

if(pnum == consoleplayer)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/Src/jDoom/p_oldsvg.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static void SV_ReadPlayer(player_t *pl)
pl->armortype = SV_ReadLong();

SV_Read(pl->powers, NUMPOWERS * 4);
SV_Read(pl->cards, NUMCARDS * 4);
SV_Read(pl->keys, NUMKEYS * 4);
pl->backpack = SV_ReadLong();

SV_Read(pl->frags, 4 * 4);
Expand Down

0 comments on commit 85d2ff1

Please sign in to comment.