diff --git a/doomsday/plugins/common/src/hu_menu.c b/doomsday/plugins/common/src/hu_menu.c index 7e8b17280b..4d31cf9cb0 100644 --- a/doomsday/plugins/common/src/hu_menu.c +++ b/doomsday/plugins/common/src/hu_menu.c @@ -866,47 +866,51 @@ static menuitem_t WeaponItems[] = { #if __JDOOM64__ {ITT_LRFUNC, 0, "10 :", M_WeaponOrder, 9 << NUM_WEAPON_TYPES }, #endif - {ITT_EFUNC, 0, "Use with Next/Previous :", M_ToggleVar, 0, NULL, "player-weapon-nextmode"}, {ITT_EMPTY, 0, NULL, NULL, 0}, - {ITT_EMPTY, 0, "AUTOSWITCH", NULL, 0}, - {ITT_LRFUNC, 0, "PICKUP WEAPON :", M_WeaponAutoSwitch, 0}, - {ITT_EFUNC, 0, " IF NOT FIRING :", M_ToggleVar, 0, NULL, "player-autoswitch-notfiring"}, - {ITT_LRFUNC, 0, "PICKUP AMMO :", M_AmmoAutoSwitch, 0}, + {ITT_EMPTY, 0, "Cycling", NULL, 0 }, + {ITT_EFUNC, 0, "Use Priority Order :", M_ToggleVar, 0, NULL, "player-weapon-nextmode"}, + {ITT_LRFUNC, 0, "Sequential :", M_ToggleVar, 0, NULL, "player-weapon-cycle-sequential"}, + {ITT_EMPTY, 0, NULL, NULL, 0}, + {ITT_EMPTY, 0, "Autoswitch", NULL, 0}, + {ITT_LRFUNC, 0, "Pickup Weapon :", M_WeaponAutoSwitch, 0}, + {ITT_EFUNC, 0, " If Not Firing :", M_ToggleVar, 0, NULL, "player-autoswitch-notfiring"}, + {ITT_LRFUNC, 0, "Pickup Ammo :", M_AmmoAutoSwitch, 0}, #if __JDOOM__ || __JDOOM64__ - {ITT_EFUNC, 0, "PICKUP BERSERK :", M_ToggleVar, 0, NULL, "player-autoswitch-berserk"} + {ITT_EFUNC, 0, "Pickup Beserk :", M_ToggleVar, 0, NULL, "player-autoswitch-berserk"} #endif }; static menu_t WeaponDef = { MNF_NOHOTKEYS, #if __JDOOM__ || __JDOOM64__ - 68, 34, -#else - 78, 28, + 78, 40, +#elif __JHERETIC__ + 78, 26, +#else // __JHEXEN__ + 78, 38, #endif M_DrawWeaponMenu, #if __JDOOM64__ - 18, WeaponItems, + 21, #elif __JDOOM__ - 17, WeaponItems, + 20, #elif __JHERETIC__ - 15, WeaponItems, + 18, #elif __JHEXEN__ - 11, WeaponItems, + 14, #endif - 0, MENU_OPTIONS, + WeaponItems, + 1, MENU_OPTIONS, GF_FONTA, cfg.menuColor2, LINEHEIGHT_A, -#if __JDOOM64__ - 0, 21 -#elif __JDOOM__ - 0, 20 +#if __JDOOM__ || __JDOOM64__ + 0, 17, { 17, 40 } #elif __JHERETIC__ - 0, 18 -#elif __JHEXEN__ + 0, 15, { 15, 26 } +#else // __JHEXEN__ 0, 14 -#endif +#endif }; static menuitem_t GameplayItems[] = { @@ -1517,7 +1521,7 @@ void Hu_MenuTicker(timespan_t ticLength) void Hu_MenuPageString(char* page, const menu_t* menu) { sprintf(page, "PAGE %i/%i", (menu->firstItem + menu->numVisItems/2) / menu->numVisItems + 1, - (menu->itemCount + menu->numVisItems/2) / menu->numVisItems); + (int)ceil((float)menu->itemCount/menu->numVisItems)); } static void M_UpdateMenuVisibleItems(void) @@ -2810,18 +2814,33 @@ void M_DrawGameplay(void) void M_DrawWeaponMenu(void) { - menu_t *menu = &WeaponDef; - int i = 0; - char *autoswitch[] = { "NEVER", "IF BETTER", "ALWAYS" }; + menu_t* menu = &WeaponDef; + int i = 0; + char* autoswitch[] = { "NEVER", "IF BETTER", "ALWAYS" }; #if __JHEXEN__ - char *weaponids[] = { "First", "Second", "Third", "Fourth"}; + char* weaponids[] = { "First", "Second", "Third", "Fourth"}; #endif - #if __JDOOM__ || __JDOOM64__ - byte berserkAutoSwitch = cfg.berserkAutoSwitch; + char buf[1024]; +#endif +#if __JHERETIC__ + patchid_t token; #endif MN_DrawTitle("WEAPONS", menu->y - 26); +#if __JDOOM__ || __JDOOM64__ + Hu_MenuPageString(buf, menu); + DGL_Color4f(1, .7f, .3f, Hu_MenuAlpha()); + M_DrawTextFragment3(buf, SCREENWIDTH/2, menu->y - 12, GF_FONTA, DTF_ALIGN_TOP); +#elif __JHERETIC__ + DGL_Color4f(1, 1, 1, Hu_MenuAlpha()); + + // Draw the page arrows. + token = dpInvPageLeft[!menu->firstItem || (menuTime & 8)]; + M_DrawPatch(token, menu->x, menu->y - 22); + token = dpInvPageRight[menu->firstItem + menu->numVisItems >= menu->itemCount || (menuTime & 8)]; + M_DrawPatch(token, 312 - menu->x, menu->y - 22); +#endif /** * \kludge Inform the user how to change the order. @@ -2829,8 +2848,12 @@ void M_DrawWeaponMenu(void) if(itemOn - 1 >= 0 && itemOn - 1 < NUM_WEAPON_TYPES) { const char* str = "Use left/right to move weapon up/down"; +#if __JDOOM__ + DGL_Color4f(1, .7f, .3f, menuAlpha); +#else DGL_Color4f(cfg.menuColor2[0], cfg.menuColor2[1], cfg.menuColor2[2], menuAlpha); - M_DrawTextFragment3(str, SCREENWIDTH/2, SCREENHEIGHT-2, GF_FONTA, DTF_ALIGN_BOTTOM); +#endif + M_DrawTextFragment3(str, SCREENWIDTH/2, SCREENHEIGHT/2 + (95/cfg.menuScale), GF_FONTA, DTF_ALIGN_BOTTOM); } for(i = 0; i < NUM_WEAPON_TYPES; ++i) @@ -2855,27 +2878,31 @@ void M_DrawWeaponMenu(void) } #if __JHEXEN__ - M_WriteMenuText(menu, 5, yesno[cfg.weaponNextMode]); - M_WriteMenuText(menu, 8, autoswitch[cfg.weaponAutoSwitch]); - M_WriteMenuText(menu, 9, yesno[cfg.noWeaponAutoSwitchIfFiring]); - M_WriteMenuText(menu, 10, autoswitch[cfg.ammoAutoSwitch]); + M_WriteMenuText(menu, 7, yesno[cfg.weaponNextMode]); + M_WriteMenuText(menu, 8, yesno[cfg.weaponCycleSequential]); + M_WriteMenuText(menu, 11, autoswitch[cfg.weaponAutoSwitch]); + M_WriteMenuText(menu, 12, yesno[cfg.noWeaponAutoSwitchIfFiring]); + M_WriteMenuText(menu, 13, autoswitch[cfg.ammoAutoSwitch]); #elif __JHERETIC__ - M_WriteMenuText(menu, 9, yesno[cfg.weaponNextMode]); - M_WriteMenuText(menu, 12, autoswitch[cfg.weaponAutoSwitch]); - M_WriteMenuText(menu, 13, yesno[cfg.noWeaponAutoSwitchIfFiring]); - M_WriteMenuText(menu, 14, autoswitch[cfg.ammoAutoSwitch]); -#elif __JDOOM64__ M_WriteMenuText(menu, 11, yesno[cfg.weaponNextMode]); - M_WriteMenuText(menu, 14, autoswitch[cfg.weaponAutoSwitch]); - M_WriteMenuText(menu, 15, yesno[cfg.noWeaponAutoSwitchIfFiring]); - M_WriteMenuText(menu, 16, autoswitch[cfg.ammoAutoSwitch]); - M_WriteMenuText(menu, 17, yesno[berserkAutoSwitch != 0]); + M_WriteMenuText(menu, 12, yesno[cfg.weaponCycleSequential]); + M_WriteMenuText(menu, 15, autoswitch[cfg.weaponAutoSwitch]); + M_WriteMenuText(menu, 16, yesno[cfg.noWeaponAutoSwitchIfFiring]); + M_WriteMenuText(menu, 17, autoswitch[cfg.ammoAutoSwitch]); +#elif __JDOOM64__ + M_WriteMenuText(menu, 12, yesno[cfg.weaponNextMode]); + M_WriteMenuText(menu, 13, yesno[cfg.weaponCycleSequential]); + M_WriteMenuText(menu, 16, autoswitch[cfg.weaponAutoSwitch]); + M_WriteMenuText(menu, 17, yesno[cfg.noWeaponAutoSwitchIfFiring]); + M_WriteMenuText(menu, 18, autoswitch[cfg.ammoAutoSwitch]); + M_WriteMenuText(menu, 19, yesno[cfg.berserkAutoSwitch != 0]); #elif __JDOOM__ - M_WriteMenuText(menu, 10, yesno[cfg.weaponNextMode]); - M_WriteMenuText(menu, 13, autoswitch[cfg.weaponAutoSwitch]); - M_WriteMenuText(menu, 14, yesno[cfg.noWeaponAutoSwitchIfFiring]); - M_WriteMenuText(menu, 15, autoswitch[cfg.ammoAutoSwitch]); - M_WriteMenuText(menu, 16, yesno[berserkAutoSwitch != 0]); + M_WriteMenuText(menu, 12, yesno[cfg.weaponNextMode]); + M_WriteMenuText(menu, 13, yesno[cfg.weaponCycleSequential]); + M_WriteMenuText(menu, 16, autoswitch[cfg.weaponAutoSwitch]); + M_WriteMenuText(menu, 17, yesno[cfg.noWeaponAutoSwitchIfFiring]); + M_WriteMenuText(menu, 18, autoswitch[cfg.ammoAutoSwitch]); + M_WriteMenuText(menu, 19, yesno[cfg.berserkAutoSwitch != 0]); #endif } diff --git a/doomsday/plugins/common/src/p_player.c b/doomsday/plugins/common/src/p_player.c index e9dc66fa0b..a7c74b6962 100644 --- a/doomsday/plugins/common/src/p_player.c +++ b/doomsday/plugins/common/src/p_player.c @@ -609,7 +609,7 @@ boolean P_CheckAmmo(player_t* plr) */ weapontype_t P_PlayerFindWeapon(player_t* player, boolean prev) { - weapontype_t* list, w = 0; + weapontype_t* list, w = 0, initial; int lvl, i; #if __JDOOM__ static weapontype_t wp_list[] = { @@ -653,11 +653,17 @@ weapontype_t P_PlayerFindWeapon(player_t* player, boolean prev) for(i = 0; i < NUM_WEAPON_TYPES; ++i) { w = list[i]; - if(w == player->readyWeapon) + if(!cfg.weaponCycleSequential || player->pendingWeapon == WT_NOCHANGE) + { + if(w == player->readyWeapon) + break; + } + else if(w == player->pendingWeapon) break; } // Locate the next or previous weapon owned by the player. + initial = w; for(;;) { // Move the iterator. @@ -674,7 +680,7 @@ weapontype_t P_PlayerFindWeapon(player_t* player, boolean prev) w = list[i]; // Have we circled around? - if(w == player->readyWeapon) + if(w == initial) break; // Available in this game mode? And a valid weapon? diff --git a/doomsday/plugins/jdoom/data/conhelp.txt b/doomsday/plugins/jdoom/data/conhelp.txt index 8e74866851..ddd3e484d0 100644 --- a/doomsday/plugins/jdoom/data/conhelp.txt +++ b/doomsday/plugins/jdoom/data/conhelp.txt @@ -853,6 +853,9 @@ desc = Weapon change order, slot 7. [player-weapon-order8] desc = Weapon change order, slot 8. +[player-weapon-cycle-sequential] +desc = 1=Allow sequential weapon cycling whilst lowering. + [player-weapon-nextmode] desc = 1=Use custom weapon order with Next/Previous weapon. diff --git a/doomsday/plugins/jdoom/include/d_config.h b/doomsday/plugins/jdoom/include/d_config.h index 4cf9d305c5..bbbda40abe 100644 --- a/doomsday/plugins/jdoom/include/d_config.h +++ b/doomsday/plugins/jdoom/include/d_config.h @@ -113,6 +113,7 @@ typedef struct jdoom_config_s { byte berserkAutoSwitch; int weaponOrder[NUM_WEAPON_TYPES]; byte weaponNextMode; // if true use the weaponOrder for next/previous. + byte weaponCycleSequential; // if true multiple next/prev weapon impulses can be chained to allow the user to "count-click-switch". byte secretMsg; float filterStrength; int plrViewHeight; diff --git a/doomsday/plugins/jdoom/src/d_console.c b/doomsday/plugins/jdoom/src/d_console.c index cb355a3f83..ec91151498 100644 --- a/doomsday/plugins/jdoom/src/d_console.c +++ b/doomsday/plugins/jdoom/src/d_console.c @@ -168,6 +168,7 @@ cvar_t gameCVars[] = { {"player-weapon-order8", 0, CVT_INT, &cfg.weaponOrder[8], 0, NUM_WEAPON_TYPES}, {"player-weapon-nextmode", 0, CVT_BYTE, &cfg.weaponNextMode, 0, 1}, + {"player-weapon-cycle-sequential", 0, CVT_BYTE, &cfg.weaponCycleSequential, 0, 1}, // Misc {"player-camera-noclip", 0, CVT_INT, &cfg.cameraNoClip, 0, 1}, diff --git a/doomsday/plugins/jdoom/src/d_main.c b/doomsday/plugins/jdoom/src/d_main.c index 479d63ea4c..6f100eda7c 100644 --- a/doomsday/plugins/jdoom/src/d_main.c +++ b/doomsday/plugins/jdoom/src/d_main.c @@ -519,6 +519,7 @@ void G_PreInit(void) cfg.weaponOrder[7] = WT_SEVENTH; cfg.weaponOrder[8] = WT_FIRST; + cfg.weaponCycleSequential = true; cfg.berserkAutoSwitch = true; // Use the DOOM transition by default. diff --git a/doomsday/plugins/jdoom64/data/conhelp.txt b/doomsday/plugins/jdoom64/data/conhelp.txt index 8b0c142d8b..d2f623f8ba 100644 --- a/doomsday/plugins/jdoom64/data/conhelp.txt +++ b/doomsday/plugins/jdoom64/data/conhelp.txt @@ -846,6 +846,9 @@ desc = Weapon change order, slot 7. [player-weapon-order8] desc = Weapon change order, slot 8. +[player-weapon-cycle-sequential] +desc = 1=Allow sequential weapon cycling whilst lowering. + [player-weapon-nextmode] desc = 1=Use custom weapon order with Next/Previous weapon. diff --git a/doomsday/plugins/jdoom64/include/d_config.h b/doomsday/plugins/jdoom64/include/d_config.h index 1eeb69d346..4188296861 100644 --- a/doomsday/plugins/jdoom64/include/d_config.h +++ b/doomsday/plugins/jdoom64/include/d_config.h @@ -110,10 +110,11 @@ typedef struct jdoom64_config_s { byte moveCheckZ; // If true, mobjs can move over/under each other. byte weaponAutoSwitch; byte noWeaponAutoSwitchIfFiring; + byte weaponCycleSequential; // if true multiple next/prev weapon impulses can be chained to allow the user to "count-click-switch". + byte weaponNextMode; // if true use the weaponOrder for next/previous. byte ammoAutoSwitch; byte berserkAutoSwitch; int weaponOrder[NUM_WEAPON_TYPES]; - byte weaponNextMode; // if true use the weaponOrder for next/previous. byte weaponRecoil; // jd64 byte secretMsg; float filterStrength; diff --git a/doomsday/plugins/jdoom64/src/d_console.c b/doomsday/plugins/jdoom64/src/d_console.c index 9e6a7c2f44..4be11269ae 100644 --- a/doomsday/plugins/jdoom64/src/d_console.c +++ b/doomsday/plugins/jdoom64/src/d_console.c @@ -169,6 +169,7 @@ cvar_t gameCVars[] = { {"player-weapon-order9", 0, CVT_INT, &cfg.weaponOrder[9], 0, NUM_WEAPON_TYPES}, {"player-weapon-nextmode", 0, CVT_BYTE, &cfg.weaponNextMode, 0, 1}, + {"player-weapon-cycle-sequential", 0, CVT_BYTE, &cfg.weaponCycleSequential, 0, 1}, // Misc {"player-camera-noclip", 0, CVT_INT, &cfg.cameraNoClip, 0, 1}, diff --git a/doomsday/plugins/jdoom64/src/d_main.c b/doomsday/plugins/jdoom64/src/d_main.c index 4eca535943..a02d60d7df 100644 --- a/doomsday/plugins/jdoom64/src/d_main.c +++ b/doomsday/plugins/jdoom64/src/d_main.c @@ -396,6 +396,7 @@ void G_PreInit(void) cfg.weaponOrder[9] = WT_FIRST; cfg.weaponRecoil = true; + cfg.weaponCycleSequential = true; cfg.berserkAutoSwitch = true; // Do the common pre init routine. diff --git a/doomsday/plugins/jheretic/data/conhelp.txt b/doomsday/plugins/jheretic/data/conhelp.txt index 0218515392..8ea56c88a2 100644 --- a/doomsday/plugins/jheretic/data/conhelp.txt +++ b/doomsday/plugins/jheretic/data/conhelp.txt @@ -790,6 +790,9 @@ desc = Weapon change order, slot 7. [player-weapon-order8] desc = Weapon change order, slot 8. +[player-weapon-cycle-sequential] +desc = 1=Allow sequential weapon cycling whilst lowering. + [player-weapon-nextmode] desc = 1= Use custom weapon order with Next/Previous weapon. diff --git a/doomsday/plugins/jheretic/include/h_config.h b/doomsday/plugins/jheretic/include/h_config.h index d6d2435625..ca047de2c6 100644 --- a/doomsday/plugins/jheretic/include/h_config.h +++ b/doomsday/plugins/jheretic/include/h_config.h @@ -110,6 +110,7 @@ typedef struct jheretic_config_s { byte weaponAutoSwitch; byte noWeaponAutoSwitchIfFiring; byte ammoAutoSwitch; + byte weaponCycleSequential; // if true multiple next/prev weapon impulses can be chained to allow the user to "count-click-switch". int weaponOrder[NUM_WEAPON_TYPES]; byte weaponNextMode; // if true use the weaponOrder for next/previous. byte secretMsg; diff --git a/doomsday/plugins/jheretic/src/h_console.c b/doomsday/plugins/jheretic/src/h_console.c index 78e0a7e80d..d0faf47f21 100644 --- a/doomsday/plugins/jheretic/src/h_console.c +++ b/doomsday/plugins/jheretic/src/h_console.c @@ -158,8 +158,8 @@ cvar_t gameCVars[] = { {"player-weapon-order7", 0, CVT_INT, &cfg.weaponOrder[7], 0, NUM_WEAPON_TYPES}, {"player-weapon-order8", 0, CVT_INT, &cfg.weaponOrder[8], 0, NUM_WEAPON_TYPES}, - {"player-weapon-nextmode", 0, CVT_BYTE, - &cfg.weaponNextMode, 0, 1}, + {"player-weapon-nextmode", 0, CVT_BYTE, &cfg.weaponNextMode, 0, 1}, + {"player-weapon-cycle-sequential", 0, CVT_BYTE, &cfg.weaponCycleSequential, 0, 1}, // Misc {"player-camera-noclip", 0, CVT_INT, &cfg.cameraNoClip, 0, 1}, diff --git a/doomsday/plugins/jheretic/src/h_main.c b/doomsday/plugins/jheretic/src/h_main.c index d03162fd94..725d0970ff 100644 --- a/doomsday/plugins/jheretic/src/h_main.c +++ b/doomsday/plugins/jheretic/src/h_main.c @@ -413,6 +413,8 @@ void G_PreInit(void) cfg.weaponOrder[6] = WT_EIGHTH; // gauntlets \ beak cfg.weaponOrder[7] = WT_FIRST; // staff \ beak + cfg.weaponCycleSequential = true; + cfg.menuEffects = 0; cfg.hudFog = 5; diff --git a/doomsday/plugins/jhexen/data/conhelp.txt b/doomsday/plugins/jhexen/data/conhelp.txt index af151b4177..7f62431e8a 100644 --- a/doomsday/plugins/jhexen/data/conhelp.txt +++ b/doomsday/plugins/jhexen/data/conhelp.txt @@ -835,6 +835,9 @@ desc = Weapon change order, slot 2. [player-weapon-order3] desc = Weapon change order, slot 3. +[player-weapon-cycle-sequential] +desc = 1=Allow sequential weapon cycling whilst lowering. + [player-weapon-nextmode] desc = 1= Use custom weapon order with Next/Previous weapon. diff --git a/doomsday/plugins/jhexen/include/x_config.h b/doomsday/plugins/jhexen/include/x_config.h index 6a36d6a562..0627e6ad25 100644 --- a/doomsday/plugins/jhexen/include/x_config.h +++ b/doomsday/plugins/jhexen/include/x_config.h @@ -112,6 +112,7 @@ typedef struct { byte weaponAutoSwitch; byte noWeaponAutoSwitchIfFiring; byte ammoAutoSwitch; + byte weaponCycleSequential; // if true multiple next/prev weapon impulses can be chained to allow the user to "count-click-switch". int weaponOrder[NUM_WEAPON_TYPES]; byte weaponNextMode; // if true use the weaponOrder for next/previous. float filterStrength; diff --git a/doomsday/plugins/jhexen/src/h2_main.c b/doomsday/plugins/jhexen/src/h2_main.c index 912dfc9db8..bc2791b609 100644 --- a/doomsday/plugins/jhexen/src/h2_main.c +++ b/doomsday/plugins/jhexen/src/h2_main.c @@ -370,9 +370,7 @@ void G_PreInit(void) cfg.weaponOrder[2] = WT_SECOND; cfg.weaponOrder[3] = WT_FIRST; - // Hexen has a nifty "Ethereal Travel" screen, so don't show the - // console during map setup. - Con_SetInteger("con-show-during-setup", 0, true); + cfg.weaponCycleSequential = true; // Do the common pre init routine. G_CommonPreInit(); diff --git a/doomsday/plugins/jhexen/src/hconsole.c b/doomsday/plugins/jhexen/src/hconsole.c index 3b9d41d27e..b4ca8bf955 100644 --- a/doomsday/plugins/jhexen/src/hconsole.c +++ b/doomsday/plugins/jhexen/src/hconsole.c @@ -153,6 +153,7 @@ cvar_t gameCVars[] = { {"player-weapon-order3", 0, CVT_INT, &cfg.weaponOrder[3], 0, NUM_WEAPON_TYPES}, {"player-weapon-nextmode", 0, CVT_BYTE, &cfg.weaponNextMode, 0, 1}, + {"player-weapon-cycle-sequential", 0, CVT_BYTE, &cfg.weaponCycleSequential, 0, 1}, // Misc {"player-camera-noclip", 0, CVT_INT, &cfg.cameraNoClip, 0, 1},