diff options
author | Simon Howard | 2011-09-25 00:36:30 +0000 |
---|---|---|
committer | Simon Howard | 2011-09-25 00:36:30 +0000 |
commit | 45b03b36c7b64f5dc884b53e44d899cf18ad5bec (patch) | |
tree | bd2241d5c780326db976017686c5b1f2e7b01e39 /src/strife | |
parent | f44bd7da56922c48b42561d39ddf5bd2d81b421e (diff) | |
download | chocolate-doom-45b03b36c7b64f5dc884b53e44d899cf18ad5bec.tar.gz chocolate-doom-45b03b36c7b64f5dc884b53e44d899cf18ad5bec.tar.bz2 chocolate-doom-45b03b36c7b64f5dc884b53e44d899cf18ad5bec.zip |
Fix Strife weapon-cycling rules.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2402
Diffstat (limited to 'src/strife')
-rw-r--r-- | src/strife/g_game.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/strife/g_game.c b/src/strife/g_game.c index d6d8d0fb..16e9c263 100644 --- a/src/strife/g_game.c +++ b/src/strife/g_game.c @@ -191,15 +191,15 @@ static const struct weapontype_t weapon_num; } weapon_order_table[] = { { wp_fist, wp_fist }, - { wp_elecbow, wp_elecbow }, { wp_poisonbow, wp_elecbow }, + { wp_elecbow, wp_elecbow }, { wp_rifle, wp_rifle }, { wp_missile, wp_missile }, - { wp_hegrenade, wp_hegrenade }, { wp_wpgrenade, wp_hegrenade }, + { wp_hegrenade, wp_hegrenade }, { wp_flame, wp_flame }, - { wp_mauler, wp_mauler }, { wp_torpedo, wp_mauler }, + { wp_mauler, wp_mauler }, { wp_sigil, wp_sigil }, }; @@ -258,14 +258,37 @@ int G_CmdChecksum (ticcmd_t* cmd) static boolean WeaponSelectable(weapontype_t weapon) { + player_t *player; + + player = &players[consoleplayer]; + // Can't select a weapon if we don't own it. - if (!players[consoleplayer].weaponowned[weapon]) + if (!player->weaponowned[weapon]) { return false; } - // STRIFE-TODO: Special weapon cycling rules? + // Can't use registered-only weapons in demo mode: + + if (isdemoversion && !weaponinfo[weapon].availabledemo) + { + return false; + } + + // Special rules for switching to alternate versions of weapons. + // These must match the weapon-switching rules in P_PlayerThink() + + if (weapon == wp_torpedo + && player->ammo[weaponinfo[am_cell].ammo] < 30) + { + return false; + } + + if (player->ammo[weaponinfo[weapon].ammo] == 0) + { + return false; + } return true; } |