Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SteelT
SRB2
Commits
2cfeaa63
Commit
2cfeaa63
authored
5 years ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Fix movement to accomodate to window scale changes
parent
8f3855d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/am_map.c
+61
-6
61 additions, 6 deletions
src/am_map.c
with
61 additions
and
6 deletions
src/am_map.c
+
61
−
6
View file @
2cfeaa63
...
@@ -160,6 +160,7 @@ static boolean am_stopped = true;
...
@@ -160,6 +160,7 @@ static boolean am_stopped = true;
static
INT32
f_x
,
f_y
;
// location of window on screen (always zero for both)
static
INT32
f_x
,
f_y
;
// location of window on screen (always zero for both)
static
INT32
f_w
,
f_h
;
// size of window on screen (always the screen width and height respectively)
static
INT32
f_w
,
f_h
;
// size of window on screen (always the screen width and height respectively)
static
boolean
m_keydown
[
4
];
// which window panning keys are being pressed down?
static
mpoint_t
m_paninc
;
// how far the window pans each tic (map coords)
static
mpoint_t
m_paninc
;
// how far the window pans each tic (map coords)
static
fixed_t
mtof_zoommul
;
// how far the window zooms in each tic (map coords)
static
fixed_t
mtof_zoommul
;
// how far the window zooms in each tic (map coords)
static
fixed_t
ftom_zoommul
;
// how far the window zooms in each tic (fb coords)
static
fixed_t
ftom_zoommul
;
// how far the window zooms in each tic (fb coords)
...
@@ -422,6 +423,28 @@ static void AM_maxOutWindowScale(void)
...
@@ -422,6 +423,28 @@ static void AM_maxOutWindowScale(void)
AM_activateNewScale
();
AM_activateNewScale
();
}
}
//
// set window panning
//
static
void
AM_setWindowPanning
(
void
)
{
// up and down
if
(
m_keydown
[
2
])
// pan up
m_paninc
.
y
=
FTOM
(
F_PANINC
);
else
if
(
m_keydown
[
3
])
// pan down
m_paninc
.
y
=
-
FTOM
(
F_PANINC
);
else
m_paninc
.
y
=
0
;
// left and right
if
(
m_keydown
[
0
])
// pan right
m_paninc
.
x
=
FTOM
(
F_PANINC
);
else
if
(
m_keydown
[
1
])
// pan left
m_paninc
.
x
=
-
FTOM
(
F_PANINC
);
else
m_paninc
.
x
=
0
;
}
/** Responds to user inputs in automap mode.
/** Responds to user inputs in automap mode.
*
*
* \param ev Event to possibly respond to.
* \param ev Event to possibly respond to.
...
@@ -454,35 +477,49 @@ boolean AM_Responder(event_t *ev)
...
@@ -454,35 +477,49 @@ boolean AM_Responder(event_t *ev)
{
{
case
AM_PANRIGHTKEY
:
// pan right
case
AM_PANRIGHTKEY
:
// pan right
if
(
!
followplayer
)
if
(
!
followplayer
)
m_paninc
.
x
=
FTOM
(
F_PANINC
);
{
m_keydown
[
0
]
=
true
;
AM_setWindowPanning
();
}
else
else
rc
=
false
;
rc
=
false
;
break
;
break
;
case
AM_PANLEFTKEY
:
// pan left
case
AM_PANLEFTKEY
:
// pan left
if
(
!
followplayer
)
if
(
!
followplayer
)
m_paninc
.
x
=
-
FTOM
(
F_PANINC
);
{
m_keydown
[
1
]
=
true
;
AM_setWindowPanning
();
}
else
else
rc
=
false
;
rc
=
false
;
break
;
break
;
case
AM_PANUPKEY
:
// pan up
case
AM_PANUPKEY
:
// pan up
if
(
!
followplayer
)
if
(
!
followplayer
)
m_paninc
.
y
=
FTOM
(
F_PANINC
);
{
m_keydown
[
2
]
=
true
;
AM_setWindowPanning
();
}
else
else
rc
=
false
;
rc
=
false
;
break
;
break
;
case
AM_PANDOWNKEY
:
// pan down
case
AM_PANDOWNKEY
:
// pan down
if
(
!
followplayer
)
if
(
!
followplayer
)
m_paninc
.
y
=
-
FTOM
(
F_PANINC
);
{
m_keydown
[
3
]
=
true
;
AM_setWindowPanning
();
}
else
else
rc
=
false
;
rc
=
false
;
break
;
break
;
case
AM_ZOOMOUTKEY
:
// zoom out
case
AM_ZOOMOUTKEY
:
// zoom out
mtof_zoommul
=
M_ZOOMOUT
;
mtof_zoommul
=
M_ZOOMOUT
;
ftom_zoommul
=
M_ZOOMIN
;
ftom_zoommul
=
M_ZOOMIN
;
AM_setWindowPanning
();
break
;
break
;
case
AM_ZOOMINKEY
:
// zoom in
case
AM_ZOOMINKEY
:
// zoom in
mtof_zoommul
=
M_ZOOMIN
;
mtof_zoommul
=
M_ZOOMIN
;
ftom_zoommul
=
M_ZOOMOUT
;
ftom_zoommul
=
M_ZOOMOUT
;
AM_setWindowPanning
();
break
;
break
;
case
AM_TOGGLEKEY
:
case
AM_TOGGLEKEY
:
AM_Stop
();
AM_Stop
();
...
@@ -515,14 +552,32 @@ boolean AM_Responder(event_t *ev)
...
@@ -515,14 +552,32 @@ boolean AM_Responder(event_t *ev)
switch
(
ev
->
data1
)
switch
(
ev
->
data1
)
{
{
case
AM_PANRIGHTKEY
:
case
AM_PANRIGHTKEY
:
if
(
!
followplayer
)
{
m_keydown
[
0
]
=
false
;
AM_setWindowPanning
();
}
break
;
case
AM_PANLEFTKEY
:
case
AM_PANLEFTKEY
:
if
(
!
followplayer
)
if
(
!
followplayer
)
m_paninc
.
x
=
0
;
{
m_keydown
[
1
]
=
false
;
AM_setWindowPanning
();
}
break
;
break
;
case
AM_PANUPKEY
:
case
AM_PANUPKEY
:
if
(
!
followplayer
)
{
m_keydown
[
2
]
=
false
;
AM_setWindowPanning
();
}
break
;
case
AM_PANDOWNKEY
:
case
AM_PANDOWNKEY
:
if
(
!
followplayer
)
if
(
!
followplayer
)
m_paninc
.
y
=
0
;
{
m_keydown
[
3
]
=
false
;
AM_setWindowPanning
();
}
break
;
break
;
case
AM_ZOOMOUTKEY
:
case
AM_ZOOMOUTKEY
:
case
AM_ZOOMINKEY
:
case
AM_ZOOMINKEY
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment