mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
View/weapon bobbing percentages (#1535)
* Move bobbing thermos to "Weapons" * Switch "Cosmetic"/"Preferences" pages in "Weapons" --------- Co-authored-by: Roman Fomin <rfomin@gmail.com>
This commit is contained in:
parent
d7b7ed9a68
commit
584f09ec62
@ -205,9 +205,6 @@ typedef struct player_s
|
||||
// [crispy] weapon recoil pitch
|
||||
fixed_t recoilpitch, oldrecoilpitch;
|
||||
|
||||
// [crispy] variable player view bob
|
||||
fixed_t bob2;
|
||||
|
||||
weapswitch_t switching;
|
||||
|
||||
// DSDA UV Max category requirements
|
||||
|
@ -120,7 +120,8 @@ boolean hide_weapon;
|
||||
// [FG] centered weapon sprite
|
||||
int center_weapon;
|
||||
|
||||
int cosmetic_bobbing;
|
||||
int view_bobbing_pct;
|
||||
int weapon_bobbing_pct;
|
||||
|
||||
char *MAPNAME(int e, int m)
|
||||
{
|
||||
|
@ -439,7 +439,8 @@ extern boolean hide_weapon;
|
||||
// [FG] centered weapon sprite
|
||||
extern int center_weapon;
|
||||
|
||||
extern int cosmetic_bobbing;
|
||||
extern int view_bobbing_pct;
|
||||
extern int weapon_bobbing_pct;
|
||||
|
||||
// Doom-style printf
|
||||
|
||||
|
62
src/m_menu.c
62
src/m_menu.c
@ -1996,7 +1996,6 @@ enum
|
||||
str_layout,
|
||||
str_curve,
|
||||
str_center_weapon,
|
||||
str_bobfactor,
|
||||
str_screensize,
|
||||
str_hudtype,
|
||||
str_hudmode,
|
||||
@ -2022,6 +2021,7 @@ enum
|
||||
str_death_use_action,
|
||||
str_menu_backdrop,
|
||||
str_widescreen,
|
||||
str_bobbing_pct,
|
||||
};
|
||||
|
||||
static const char **GetStrings(int id);
|
||||
@ -3087,8 +3087,8 @@ static setup_menu_t* weap_settings[] =
|
||||
|
||||
static setup_tab_t weap_tabs[] =
|
||||
{
|
||||
{ "preferences", weap_settings1 },
|
||||
{ "cosmetic", weap_settings2 },
|
||||
{ "cosmetic", weap_settings1 },
|
||||
{ "preferences", weap_settings2 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -3097,16 +3097,37 @@ static const char *center_weapon_strings[] = {
|
||||
"Off", "Centered", "Bobbing"
|
||||
};
|
||||
|
||||
static const char *bobfactor_strings[] = {
|
||||
"Off", "Full", "75%"
|
||||
};
|
||||
|
||||
static void M_UpdateCenteredWeaponItem(void)
|
||||
{
|
||||
DisableItem(!cosmetic_bobbing, weap_settings2, "center_weapon");
|
||||
DisableItem(!weapon_bobbing_pct, weap_settings1, "center_weapon");
|
||||
}
|
||||
|
||||
setup_menu_t weap_settings1[] = // Weapons Settings screen
|
||||
static const char *bobbing_pct_strings[] = {
|
||||
"0%", "25%", "50%", "75%", "100%"
|
||||
};
|
||||
|
||||
setup_menu_t weap_settings1[] =
|
||||
{
|
||||
{"View Bob", S_THERMO|S_THRM_SIZE4, m_null, M_X_THRM4, M_Y,
|
||||
{"view_bobbing_pct"}, 0, NULL, str_bobbing_pct},
|
||||
|
||||
{"Weapon Bob", S_THERMO|S_THRM_SIZE4, m_null, M_X_THRM4, M_THRM_SPC,
|
||||
{"weapon_bobbing_pct"}, 0, M_UpdateCenteredWeaponItem, str_bobbing_pct},
|
||||
|
||||
// [FG] centered or bobbing weapon sprite
|
||||
{"Weapon Alignment", S_CHOICE|S_STRICT, m_null, M_X, M_THRM_SPC,
|
||||
{"center_weapon"}, 0, NULL, str_center_weapon},
|
||||
|
||||
{"Hide Weapon", S_ONOFF|S_STRICT, m_null, M_X, M_SPC, {"hide_weapon"}},
|
||||
|
||||
{"Weapon Recoil", S_ONOFF, m_null, M_X, M_SPC, {"weapon_recoilpitch"}},
|
||||
|
||||
MI_RESET,
|
||||
|
||||
MI_END
|
||||
};
|
||||
|
||||
setup_menu_t weap_settings2[] = // Weapons Settings screen
|
||||
{
|
||||
{"1St Choice Weapon", S_WEAP|S_BOOM, m_null, M_X, M_Y, {"weapon_choice_1"}},
|
||||
{"2Nd Choice Weapon", S_WEAP|S_BOOM, m_null, M_X, M_SPC, {"weapon_choice_2"}},
|
||||
@ -3128,25 +3149,6 @@ setup_menu_t weap_settings1[] = // Weapons Settings screen
|
||||
{"Pre-Beta BFG", S_ONOFF, m_null, M_X, // killough 8/8/98
|
||||
M_SPC, {"classic_bfg"}},
|
||||
|
||||
// Button for resetting to defaults
|
||||
MI_RESET,
|
||||
|
||||
MI_END
|
||||
};
|
||||
|
||||
setup_menu_t weap_settings2[] =
|
||||
{
|
||||
{"View/Weapon Bobbing", S_CHOICE, m_null, M_X, M_Y,
|
||||
{"cosmetic_bobbing"}, 0, M_UpdateCenteredWeaponItem, str_bobfactor},
|
||||
|
||||
{"Hide Weapon", S_ONOFF|S_STRICT, m_null, M_X, M_SPC, {"hide_weapon"}},
|
||||
|
||||
// [FG] centered or bobbing weapon sprite
|
||||
{"Weapon Alignment", S_CHOICE|S_STRICT, m_null, M_X, M_SPC,
|
||||
{"center_weapon"}, 0, NULL, str_center_weapon},
|
||||
|
||||
{"Weapon Recoil", S_ONOFF, m_null, M_X, M_SPC, {"weapon_recoilpitch"}},
|
||||
|
||||
MI_END
|
||||
};
|
||||
|
||||
@ -4243,7 +4245,7 @@ setup_menu_t gen_settings6[] = {
|
||||
{"Organize save files", S_ONOFF|S_PRGWARN, m_null, M_X, M_THRM_SPC,
|
||||
{"organize_savefiles"}},
|
||||
|
||||
{"", S_SKIP, m_null, M_X, M_SPC},
|
||||
{"", S_SKIP, m_null, M_X, M_THRM_SPC},
|
||||
|
||||
{"Miscellaneous", S_SKIP|S_TITLE, m_null, M_X, M_SPC},
|
||||
|
||||
@ -6877,7 +6879,6 @@ static const char **selectstrings[] = {
|
||||
layout_strings,
|
||||
curve_strings,
|
||||
center_weapon_strings,
|
||||
bobfactor_strings,
|
||||
screensize_strings,
|
||||
hudtype_strings,
|
||||
NULL, // str_hudmode
|
||||
@ -6899,6 +6900,7 @@ static const char **selectstrings[] = {
|
||||
death_use_action_strings,
|
||||
menu_backdrop_strings,
|
||||
widescreen_strings,
|
||||
bobbing_pct_strings,
|
||||
};
|
||||
|
||||
static const char **GetStrings(int id)
|
||||
|
21
src/m_misc.c
21
src/m_misc.c
@ -709,13 +709,6 @@ default_t defaults[] = {
|
||||
"1 to enable player bobbing (view moving up/down slightly)"
|
||||
},
|
||||
|
||||
{
|
||||
"cosmetic_bobbing",
|
||||
(config_t *) &cosmetic_bobbing, NULL,
|
||||
{1}, {0,2}, number, ss_weap, wad_no,
|
||||
"Player View/Weapon Bobbing (0 = off, 1 = full, 2 = 75%)"
|
||||
},
|
||||
|
||||
{
|
||||
"hide_weapon",
|
||||
(config_t *) &hide_weapon, NULL,
|
||||
@ -723,6 +716,20 @@ default_t defaults[] = {
|
||||
"1 to hide weapon"
|
||||
},
|
||||
|
||||
{
|
||||
"view_bobbing_pct",
|
||||
(config_t *) &view_bobbing_pct, NULL,
|
||||
{4}, {0,4}, number, ss_weap, wad_no,
|
||||
"Player View Bobbing (0 - 0%, 1 - 25% ... 4 - 100%)"
|
||||
},
|
||||
|
||||
{
|
||||
"weapon_bobbing_pct",
|
||||
(config_t *) &weapon_bobbing_pct, NULL,
|
||||
{4}, {0,4}, number, ss_weap, wad_no,
|
||||
"Player Weapon Bobbing (0 - 0%, 1 - 25% ... 4 - 100%)"
|
||||
},
|
||||
|
||||
// [FG] centered or bobbing weapon sprite
|
||||
{
|
||||
"center_weapon",
|
||||
|
@ -1089,8 +1089,6 @@ void P_SetupPsprites(player_t *player)
|
||||
// Called every tic by player thinking routine.
|
||||
//
|
||||
|
||||
#define BOBBING_75 2
|
||||
|
||||
#define WEAPON_CENTERED 1
|
||||
#define WEAPON_BOBBING 2
|
||||
|
||||
@ -1118,7 +1116,7 @@ void P_MovePsprites(player_t *player)
|
||||
|
||||
if (psp->state)
|
||||
{
|
||||
if (!cosmetic_bobbing)
|
||||
if (!weapon_bobbing_pct)
|
||||
{
|
||||
static fixed_t last_sy = WEAPONTOP;
|
||||
|
||||
@ -1135,7 +1133,7 @@ void P_MovePsprites(player_t *player)
|
||||
psp->sy2 -= (last_sy - WEAPONTOP);
|
||||
}
|
||||
}
|
||||
else if (cosmetic_bobbing == BOBBING_75 || center_weapon_strict || uncapped)
|
||||
else if (center_weapon_strict || uncapped)
|
||||
{
|
||||
// [FG] don't center during lowering and raising states
|
||||
if (psp->state->misc1 || player->switching)
|
||||
@ -1144,7 +1142,8 @@ void P_MovePsprites(player_t *player)
|
||||
// [FG] not attacking means idle
|
||||
else if (!player->attackdown || center_weapon_strict == WEAPON_BOBBING)
|
||||
{
|
||||
P_ApplyBobbing(&psp->sx2, &psp->sy2, player->bob2);
|
||||
fixed_t bob = player->bob * weapon_bobbing_pct / 4;
|
||||
P_ApplyBobbing(&psp->sx2, &psp->sy2, bob);
|
||||
}
|
||||
// [FG] center the weapon sprite horizontally and push up vertically
|
||||
else if (center_weapon_strict == WEAPON_CENTERED)
|
||||
|
@ -826,7 +826,6 @@ static void saveg_read_player_t(player_t *str)
|
||||
|
||||
// fixed_t bob;
|
||||
str->bob = saveg_read32();
|
||||
str->bob2 = str->bob;
|
||||
|
||||
// fixed_t momx;
|
||||
str->momx = saveg_read32();
|
||||
|
10
src/p_user.c
10
src/p_user.c
@ -105,9 +105,6 @@ void P_Bob(player_t *player, angle_t angle, fixed_t move)
|
||||
// Calculate the walking / running height adjustment
|
||||
//
|
||||
|
||||
// [crispy] variable player view bob
|
||||
static const int bobfactors[3] = {0, 4, 3};
|
||||
|
||||
void P_CalcHeight (player_t* player)
|
||||
{
|
||||
int angle;
|
||||
@ -147,9 +144,6 @@ void P_CalcHeight (player_t* player)
|
||||
player->bob = MAXBOB;
|
||||
}
|
||||
|
||||
// [crispy] variable player view bob
|
||||
player->bob2 = bobfactors[cosmetic_bobbing] * player->bob / 4;
|
||||
|
||||
if (!onground || player->cheats & CF_NOMOMENTUM)
|
||||
{
|
||||
player->viewz = player->mo->z + VIEWHEIGHT;
|
||||
@ -168,7 +162,9 @@ void P_CalcHeight (player_t* player)
|
||||
}
|
||||
|
||||
angle = (FINEANGLES/20*leveltime)&FINEMASK;
|
||||
bob = FixedMul(player->bob2/2,finesine[angle]);
|
||||
|
||||
bob = player->bob * view_bobbing_pct / 4;
|
||||
bob = FixedMul(bob/2,finesine[angle]);
|
||||
|
||||
// move viewheight
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user