Skip to content

Commit

Permalink
Implement "centeredweapon" setting in doomretro.cfg
Browse files Browse the repository at this point in the history
If true, centers the player's weapon when its fired, which is the
default (and the behavior of DOOM RETRO since v1.5). If false, uses
Vanilla DOOM behavior, and fires weapon at whatever horizontal position
it is in when bobbing. By request.
  • Loading branch information
bradharding committed Oct 26, 2014
1 parent 84e4ca0 commit 961cdf2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions msvc/Release/doomretro.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
alwaysrun false
bloodsplats unlimited
brightmaps true
centeredweapon true
corpses mirror|slide|smearblood|moreblood
dclick_use false
episode "Knee-Deep in the Dead"
Expand Down
5 changes: 5 additions & 0 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
extern boolean alwaysrun;
extern int bloodsplats;
extern int brightmaps;
extern boolean centeredweapon;
extern int corpses;
extern boolean dclick_use;
extern boolean footclip;
Expand Down Expand Up @@ -192,6 +193,7 @@ static default_t doom_defaults_list[] =
CONFIG_VARIABLE_INT (alwaysrun, alwaysrun, 1),
CONFIG_VARIABLE_INT (bloodsplats, bloodsplats, 7),
CONFIG_VARIABLE_INT (brightmaps, brightmaps, 1),
CONFIG_VARIABLE_INT (centeredweapon, centeredweapon, 1),
CONFIG_VARIABLE_INT (corpses, corpses, 11),
CONFIG_VARIABLE_INT (dclick_use, dclick_use, 1),
CONFIG_VARIABLE_INT (episode, selectedepisode, 8),
Expand Down Expand Up @@ -725,6 +727,9 @@ static void M_CheckDefaults(void)
if (brightmaps != false && brightmaps != true)
brightmaps = BRIGHTMAPS_DEFAULT;

if (centeredweapon != false && centeredweapon != true)
centeredweapon = CENTEREDWEAPON_DEFAULT;

if (corpses < CORPSES_MIN || corpses > CORPSES_MAX || (corpses & (corpses - 1)))
corpses = CORPSES_DEFAULT;

Expand Down
2 changes: 2 additions & 0 deletions src/m_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

#define BRIGHTMAPS_DEFAULT true

#define CENTEREDWEAPON_DEFAULT true

#define CORPSES_MIN 0
#define CORPSES_DEFAULT (MIRROR | SLIDE | SMEARBLOOD | MOREBLOOD)
#define CORPSES_MAX CORPSES_DEFAULT
Expand Down
15 changes: 9 additions & 6 deletions src/p_pspr.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#define CHAINSAWIDLEMOTORSPEED 15000
#define MAXMOTORSPEED 65535

boolean centeredweapon = CENTEREDWEAPON_DEFAULT;

//
// P_SetPsprite
//
Expand Down Expand Up @@ -165,7 +167,6 @@ boolean P_CheckAmmo(player_t *player)
//
void P_FireWeapon(player_t *player)
{
statenum_t newstate;
weapontype_t readyweapon;

if (!P_CheckAmmo(player) || (automapactive && !followplayer))
Expand All @@ -174,8 +175,7 @@ void P_FireWeapon(player_t *player)
readyweapon = player->readyweapon;

P_SetMobjState(player->mo, S_PLAY_ATK1);
newstate = weaponinfo[readyweapon].atkstate;
P_SetPsprite(player, ps_weapon, newstate);
P_SetPsprite(player, ps_weapon, weaponinfo[readyweapon].atkstate);

if (readyweapon == wp_fist && !linetarget)
return;
Expand All @@ -184,7 +184,7 @@ void P_FireWeapon(player_t *player)

if (gamepadvibrate && vibrate)
{
int motorspeed = weaponinfo[readyweapon].motorspeed;
int motorspeed = weaponinfo[readyweapon].motorspeed;

if ((readyweapon == wp_fist && player->powers[pw_strength])
|| (readyweapon == wp_chainsaw && linetarget))
Expand All @@ -193,8 +193,11 @@ void P_FireWeapon(player_t *player)
weaponvibrationtics = weaponinfo[readyweapon].tics;
}

player->psprites[ps_weapon].sx = 0;
player->psprites[ps_weapon].sy = WEAPONTOP;
if (centeredweapon)
{
player->psprites[ps_weapon].sx = 0;
player->psprites[ps_weapon].sy = WEAPONTOP;
}
}

//
Expand Down

0 comments on commit 961cdf2

Please sign in to comment.