Skip to content

Commit

Permalink
Separate automap scroll / zoom speed
Browse files Browse the repository at this point in the history
- swap "scroll / zoom" speeds based on autorun status
  • Loading branch information
andrikpowell committed Aug 10, 2024
1 parent 8387621 commit a8ddcdc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
24 changes: 14 additions & 10 deletions prboom2/src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ static int map_blinking_locks;
static int map_secret_after;
static int map_grid_size;
static int map_scroll_speed;
static int map_zoom_speed;
static int map_wheel_zoom;
int map_textured;
int map_use_multisampling;
Expand All @@ -273,13 +274,15 @@ static map_things_appearance_t map_things_appearance;
#define INITSCALEMTOF (.2*FRACUNIT)
// how much the automap moves window per tic in frame-buffer coordinates
// moves 140 pixels in 1 second
#define F_PANINC (dsda_InputActive(dsda_input_speed) ? map_scroll_speed * 2 : map_scroll_speed)
#define F_SPEED (dsda_InputActive(dsda_input_speed) ? !dsda_AutoRun() : dsda_AutoRun())
#define F_PANINC (F_SPEED ? map_scroll_speed * 2 : map_scroll_speed)
#define F_ZOOMINC (F_SPEED ? map_zoom_speed * 2 : map_zoom_speed)
// how much zoom-in per tic
// goes to 2x in 1 second
#define M_ZOOMIN ((int) ((float)FRACUNIT * (1.00f + F_PANINC / 200.0f)))
#define M_ZOOMIN ((int) ((float)FRACUNIT * (1.00f + F_ZOOMINC / 200.0f)))
// how much zoom-out per tic
// pulls out to 0.5x in 1 second
#define M_ZOOMOUT ((int) ((float)FRACUNIT / (1.00f + F_PANINC / 200.0f)))
#define M_ZOOMOUT ((int) ((float)FRACUNIT / (1.00f + F_ZOOMINC / 200.0f)))

#define PLAYERRADIUS (16*(1<<MAPBITS)) // e6y

Expand Down Expand Up @@ -802,6 +805,7 @@ void AM_InitParams(void)
map_blinking_locks = dsda_IntConfig(dsda_config_map_blinking_locks);
map_secret_after = dsda_IntConfig(dsda_config_map_secret_after);
map_scroll_speed = dsda_IntConfig(dsda_config_map_scroll_speed);
map_zoom_speed = dsda_IntConfig(dsda_config_map_zoom_speed);
map_grid_size = dsda_IntConfig(dsda_config_map_grid_size);
map_wheel_zoom = dsda_IntConfig(dsda_config_map_wheel_zoom);
map_things_appearance = dsda_IntConfig(dsda_config_map_things_appearance);
Expand Down Expand Up @@ -1162,21 +1166,21 @@ static void AM_changeWindowScale(void)
{
if (movement_smooth)
{
float f_paninc = (float)F_PANINC / (float)FRACUNIT * (float)tic_vars.frac;
float f_zoominc = (float)F_ZOOMINC / (float)FRACUNIT * (float)tic_vars.frac;

if (f_paninc < 0.01f)
f_paninc = 0.01f;
if (f_zoominc < 0.01f)
f_zoominc = 0.01f;

scale_mtof = prev_scale_mtof;
if (curr_mtof_zoommul == M_ZOOMIN)
{
mtof_zoommul = ((int) ((float)FRACUNIT * (1.00f + f_paninc / 200.0f)));
ftom_zoommul = ((int) ((float)FRACUNIT / (1.00f + f_paninc / 200.0f)));
mtof_zoommul = ((int) ((float)FRACUNIT * (1.00f + f_zoominc / 200.0f)));
ftom_zoommul = ((int) ((float)FRACUNIT / (1.00f + f_zoominc / 200.0f)));
}
if (curr_mtof_zoommul == M_ZOOMOUT)
{
mtof_zoommul = ((int) ((float)FRACUNIT / (1.00f + f_paninc / 200.0f)));
ftom_zoommul = ((int) ((float)FRACUNIT * (1.00f + f_paninc / 200.0f)));
mtof_zoommul = ((int) ((float)FRACUNIT / (1.00f + f_zoominc / 200.0f)));
ftom_zoommul = ((int) ((float)FRACUNIT * (1.00f + f_zoominc / 200.0f)));
}
}

Expand Down
4 changes: 4 additions & 0 deletions prboom2/src/dsda/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,10 @@ dsda_config_t dsda_config[dsda_config_count] = {
"map_scroll_speed", dsda_config_map_scroll_speed,
dsda_config_int, 1, 32, { 32 }, NULL, NOT_STRICT, AM_InitParams
},
[dsda_config_map_zoom_speed] = {
"map_zoom_speed", dsda_config_map_zoom_speed,
dsda_config_int, 1, 32, { 16 }, NULL, NOT_STRICT, AM_InitParams
},
[dsda_config_map_wheel_zoom] = {
"map_wheel_zoom", dsda_config_map_wheel_zoom,
CONF_BOOL(1), NULL, NOT_STRICT, AM_InitParams
Expand Down
1 change: 1 addition & 0 deletions prboom2/src/dsda/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ typedef enum {
dsda_config_automap_grid,
dsda_config_map_grid_size,
dsda_config_map_scroll_speed,
dsda_config_map_zoom_speed,
dsda_config_map_wheel_zoom,
dsda_config_map_use_multisamling,
dsda_config_map_textured,
Expand Down
3 changes: 2 additions & 1 deletion prboom2/src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2741,7 +2741,8 @@ setup_menu_t auto_settings1[] = // 1st AutoMap Settings screen
{ "Locked doors blink", S_YESNO, m_conf, AU_X, dsda_config_map_blinking_locks },
{ "Show Secrets only after entering", S_YESNO, m_conf, AU_X, dsda_config_map_secret_after },
{ "Grid cell size 8..256, -1 for autosize", S_NUM, m_conf, AU_X, dsda_config_map_grid_size },
{ "Scroll / Zoom speed (1..32)", S_NUM, m_conf, AU_X, dsda_config_map_scroll_speed },
{ "Scroll speed (1..32)", S_NUM, m_conf, AU_X, dsda_config_map_scroll_speed },
{ "Zoom speed (1..32)", S_NUM, m_conf, AU_X, dsda_config_map_zoom_speed },
{ "Use mouse wheel for zooming", S_YESNO, m_conf, AU_X, dsda_config_map_wheel_zoom },
{ "Enable textured display", S_YESNO, m_conf, AU_X, dsda_config_map_textured },
{ "Things appearance", S_CHOICE, m_conf, AU_X, dsda_config_map_things_appearance, 0, map_things_appearance_list },
Expand Down
1 change: 1 addition & 0 deletions prboom2/src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ cfg_def_t cfg_defs[] =
MIGRATED_SETTING(dsda_config_automap_grid),
MIGRATED_SETTING(dsda_config_map_grid_size),
MIGRATED_SETTING(dsda_config_map_scroll_speed),
MIGRATED_SETTING(dsda_config_map_zoom_speed),
MIGRATED_SETTING(dsda_config_map_wheel_zoom),
MIGRATED_SETTING(dsda_config_map_use_multisamling),
MIGRATED_SETTING(dsda_config_map_textured),
Expand Down

0 comments on commit a8ddcdc

Please sign in to comment.