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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
9f1c40f8
Commit
9f1c40f8
authored
Nov 11, 2018
by
Marco Z
Browse files
Options
Downloads
Patches
Plain Diff
G_CopyControls and G_GetControlScheme adjustment (take input list of gc's to check)
parent
775b34e3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/g_input.c
+22
-16
22 additions, 16 deletions
src/g_input.c
src/g_input.h
+5
-2
5 additions, 2 deletions
src/g_input.h
src/m_misc.c
+8
-2
8 additions, 2 deletions
src/m_misc.c
with
35 additions
and
20 deletions
src/g_input.c
+
22
−
16
View file @
9f1c40f8
...
...
@@ -47,6 +47,14 @@ INT32 gamecontrol[num_gamecontrols][2];
INT32
gamecontrolbis
[
num_gamecontrols
][
2
];
// secondary splitscreen player
INT32
gamecontroldefault
[
num_gamecontrolschemes
][
num_gamecontrols
][
2
];
// default control storage, use 0 (gcs_custom) for memory retention
// lists of GC codes for selective operation
INT32
gcmovement
[
num_gcmovement
]
=
{
gc_forward
,
gc_backward
,
gc_strafeleft
,
gc_straferight
,
gc_lookup
,
gc_lookdown
,
gc_turnleft
,
gc_turnright
,
gc_centerview
,
gc_jump
,
gc_use
// , gc_fire, gc_firenormal
};
typedef
struct
{
UINT8
time
;
...
...
@@ -673,25 +681,21 @@ void G_DefineDefaultControls(void)
}
}
INT32
G_GetControlScheme
(
INT32
(
*
fromcontrols
)[
2
],
boolean
movementonly
)
INT32
G_GetControlScheme
(
INT32
(
*
fromcontrols
)[
2
],
INT32
gclist
[],
INT32
gclen
)
{
INT32
i
,
j
,
gc
;
boolean
skipscheme
;
gamecontrols_e
movement
[]
=
{
gc_forward
,
gc_backward
,
gc_strafeleft
,
gc_straferight
,
gc_lookup
,
gc_lookdown
,
gc_turnleft
,
gc_turnright
,
gc_centerview
,
gc_jump
,
gc_use
// , gc_fire, gc_firenormal
};
for
(
i
=
1
;
i
<
num_gamecontrolschemes
;
i
++
)
// skip gcs_custom (0)
{
skipscheme
=
false
;
for
(
j
=
0
;
j
<
(
movementonly
?
sizeof
(
movement
)
:
num_gamecontrols
);
j
++
)
for
(
j
=
0
;
j
<
(
gclist
&&
gclen
?
gclen
:
num_gamecontrols
);
j
++
)
{
gc
=
(
movementonly
)
?
movement
[
j
]
:
j
;
if
(
fromcontrols
[
gc
][
0
]
!=
gamecontroldefault
[
i
][
gc
][
0
]
&&
fromcontrols
[
gc
][
1
]
!=
gamecontroldefault
[
i
][
gc
][
1
])
gc
=
(
gclist
&&
gclen
)
?
gclist
[
j
]
:
j
;
if
(((
fromcontrols
[
gc
][
0
]
&&
gamecontroldefault
[
i
][
gc
][
0
])
?
fromcontrols
[
gc
][
0
]
!=
gamecontroldefault
[
i
][
gc
][
0
]
:
true
)
&&
((
fromcontrols
[
gc
][
0
]
&&
gamecontroldefault
[
i
][
gc
][
1
])
?
fromcontrols
[
gc
][
0
]
!=
gamecontroldefault
[
i
][
gc
][
1
]
:
true
)
&&
((
fromcontrols
[
gc
][
1
]
&&
gamecontroldefault
[
i
][
gc
][
0
])
?
fromcontrols
[
gc
][
1
]
!=
gamecontroldefault
[
i
][
gc
][
0
]
:
true
)
&&
((
fromcontrols
[
gc
][
1
]
&&
gamecontroldefault
[
i
][
gc
][
1
])
?
fromcontrols
[
gc
][
1
]
!=
gamecontroldefault
[
i
][
gc
][
1
]
:
true
))
{
skipscheme
=
true
;
break
;
...
...
@@ -704,13 +708,15 @@ INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], boolean movementonly)
return
gcs_custom
;
}
void
G_CopyControls
(
INT32
(
*
setupcontrols
)[
2
],
INT32
(
*
fromcontrols
)[
2
])
void
G_CopyControls
(
INT32
(
*
setupcontrols
)[
2
],
INT32
(
*
fromcontrols
)[
2
]
,
INT32
gclist
[],
INT32
gclen
)
{
INT32
i
;
for
(
i
=
0
;
i
<
num_gamecontrols
;
i
++
)
INT32
i
,
gc
;
for
(
i
=
0
;
i
<
(
gclist
&&
gclen
?
gclen
:
num_gamecontrols
);
i
++
)
{
setupcontrols
[
i
][
0
]
=
fromcontrols
[
i
][
0
];
setupcontrols
[
i
][
1
]
=
fromcontrols
[
i
][
1
];
gc
=
(
gclist
&&
gclen
)
?
gclist
[
i
]
:
i
;
setupcontrols
[
gc
][
0
]
=
fromcontrols
[
gc
][
0
];
setupcontrols
[
gc
][
1
]
=
fromcontrols
[
gc
][
1
];
}
}
...
...
This diff is collapsed.
Click to expand it.
src/g_input.h
+
5
−
2
View file @
9f1c40f8
...
...
@@ -128,6 +128,9 @@ extern INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; //
#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]])
#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]])
#define num_gcmovement 11 // 13
extern
INT32
gcmovement
[
num_gcmovement
];
// peace to my little coder fingers!
// check a gamecontrol being active or not
...
...
@@ -143,8 +146,8 @@ void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control);
void
Command_Setcontrol_f
(
void
);
void
Command_Setcontrol2_f
(
void
);
void
G_DefineDefaultControls
(
void
);
INT32
G_GetControlScheme
(
INT32
(
*
fromcontrols
)[
2
],
boolean
movementonly
);
void
G_CopyControls
(
INT32
(
*
setupcontrols
)[
2
],
INT32
(
*
fromcontrols
)[
2
]);
INT32
G_GetControlScheme
(
INT32
(
*
fromcontrols
)[
2
],
INT32
gclist
[],
INT32
gclen
);
void
G_CopyControls
(
INT32
(
*
setupcontrols
)[
2
],
INT32
(
*
fromcontrols
)[
2
]
,
INT32
gclist
[],
INT32
gclen
);
void
G_SaveKeySetting
(
FILE
*
f
,
INT32
(
*
fromcontrols
)[
2
],
INT32
(
*
fromcontrolsbis
)[
2
]);
void
G_CheckDoubleUsage
(
INT32
keynum
);
...
...
This diff is collapsed.
Click to expand it.
src/m_misc.c
+
8
−
2
View file @
9f1c40f8
...
...
@@ -476,7 +476,7 @@ void M_FirstLoadConfig(void)
// load default control
G_DefineDefaultControls
();
G_CopyControls
(
gamecontrol
,
gamecontroldefault
[
gcs_fps
]);
G_CopyControls
(
gamecontrol
,
gamecontroldefault
[
gcs_fps
]
,
NULL
,
0
);
// load config, make sure those commands doesnt require the screen...
COM_BufInsertText
(
va
(
"exec
\"
%s
\"\n
"
,
configfile
));
...
...
@@ -540,7 +540,13 @@ void M_SaveConfig(const char *filename)
// FIXME: save key aliases if ever implemented..
CV_SaveVariables
(
f
);
if
(
!
dedicated
)
G_SaveKeySetting
(
f
,
gamecontrol
,
gamecontrolbis
);
if
(
!
dedicated
)
{
if
(
tutorialmode
)
G_SaveKeySetting
(
f
,
gamecontroldefault
[
gcs_custom
],
gamecontrolbis
);
// using gcs_custom as temp storage
else
G_SaveKeySetting
(
f
,
gamecontrol
,
gamecontrolbis
);
}
fclose
(
f
);
}
...
...
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