mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-02 09:12:54 +00:00
Merge branch 'control-selector' into tutorial-time
This commit is contained in:
commit
6be583eac6
5 changed files with 38 additions and 17 deletions
|
@ -717,9 +717,9 @@ void D_StartTitle(void)
|
|||
if (tutorialmode)
|
||||
{
|
||||
// check if retained controls are custom
|
||||
tutorialpostprompt = (G_GetControlScheme(gamecontroldefault[gcs_custom], gcmovement, num_gcmovement) == gcs_custom
|
||||
&& G_GetControlScheme(gamecontrol, gcmovement, num_gcmovement) != gcs_custom);
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gcmovement, num_gcmovement); // using gcs_custom as temp storage
|
||||
tutorialpostprompt = (G_GetControlScheme(gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial) == gcs_custom
|
||||
&& G_GetControlScheme(gamecontrol, gclist_tutorial, num_gclist_tutorial) != gcs_custom);
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial); // using gcs_custom as temp storage
|
||||
}
|
||||
tutorialmode = false;
|
||||
|
||||
|
|
|
@ -1809,7 +1809,7 @@ static void Command_Map_f(void)
|
|||
fromlevelselect = ((netgame || multiplayer) && ((gametype == newgametype) && (newgametype == GT_COOP)));
|
||||
|
||||
if (tutorialmode)
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gcmovement, num_gcmovement); // using gcs_custom as temp storage
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial); // using gcs_custom as temp storage
|
||||
tutorialmode = false; // warping takes us out of tutorial mode
|
||||
|
||||
D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect);
|
||||
|
|
|
@ -48,13 +48,25 @@ 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] = {
|
||||
const INT32 gclist_tutorial[num_gclist_tutorial] = {
|
||||
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
|
||||
gc_lookup, gc_lookdown, gc_turnleft, gc_turnright//, gc_centerview,
|
||||
//gc_jump, gc_use,
|
||||
//gc_fire, gc_firenormal
|
||||
};
|
||||
|
||||
const INT32 gclist_movement[num_gclist_movement] = {
|
||||
gc_forward, gc_backward, gc_strafeleft, gc_straferight
|
||||
};
|
||||
|
||||
const INT32 gclist_camera[num_gclist_camera] = {
|
||||
gc_lookup, gc_lookdown, gc_turnleft, gc_turnright
|
||||
};
|
||||
|
||||
const INT32 gclist_jump[num_gclist_jump] = { gc_jump };
|
||||
|
||||
const INT32 gclist_use[num_gclist_use] = { gc_use };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 time;
|
||||
|
@ -681,7 +693,7 @@ void G_DefineDefaultControls(void)
|
|||
}
|
||||
}
|
||||
|
||||
INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], INT32 gclist[], INT32 gclen)
|
||||
INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen)
|
||||
{
|
||||
INT32 i, j, gc;
|
||||
boolean skipscheme;
|
||||
|
@ -708,7 +720,7 @@ INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], INT32 gclist[], INT32 gclen)
|
|||
return gcs_custom;
|
||||
}
|
||||
|
||||
void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], INT32 gclist[], INT32 gclen)
|
||||
void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen)
|
||||
{
|
||||
INT32 i, gc;
|
||||
|
||||
|
|
|
@ -128,8 +128,17 @@ 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];
|
||||
#define num_gclist_tutorial 8 // 13
|
||||
#define num_gclist_movement 4
|
||||
#define num_gclist_camera 4
|
||||
#define num_gclist_jump 1
|
||||
#define num_gclist_use 1
|
||||
|
||||
extern const INT32 gclist_tutorial[num_gclist_tutorial];
|
||||
extern const INT32 gclist_movement[num_gclist_movement];
|
||||
extern const INT32 gclist_camera[num_gclist_camera];
|
||||
extern const INT32 gclist_jump[num_gclist_jump];
|
||||
extern const INT32 gclist_use[num_gclist_use];
|
||||
|
||||
// peace to my little coder fingers!
|
||||
// check a gamecontrol being active or not
|
||||
|
@ -146,8 +155,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], INT32 gclist[], INT32 gclen);
|
||||
void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], INT32 gclist[], INT32 gclen);
|
||||
INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen);
|
||||
void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen);
|
||||
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2]);
|
||||
void G_CheckDoubleUsage(INT32 keynum);
|
||||
|
||||
|
|
|
@ -6138,7 +6138,7 @@ void M_TutorialSaveControlResponse(INT32 ch)
|
|||
{
|
||||
if (ch == 'y' || ch == KEY_ENTER)
|
||||
{
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps], gcmovement, num_gcmovement);
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps], gclist_tutorial, num_gclist_tutorial);
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
}
|
||||
else
|
||||
|
@ -6150,7 +6150,7 @@ static void M_TutorialControlResponse(INT32 ch)
|
|||
if (ch == 'y' || ch == KEY_ENTER)
|
||||
{
|
||||
G_CopyControls(gamecontroldefault[gcs_custom], gamecontrol, NULL, 0);
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps], gcmovement, num_gcmovement);
|
||||
G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps], gclist_tutorial, num_gclist_tutorial);
|
||||
}
|
||||
M_StartTutorial(INT32_MAX);
|
||||
}
|
||||
|
@ -6161,7 +6161,7 @@ static void M_StartTutorial(INT32 choice)
|
|||
if (!tutorialmap)
|
||||
return; // no map to go to, don't bother
|
||||
|
||||
if (choice != INT32_MAX && G_GetControlScheme(gamecontrol, gcmovement, num_gcmovement) == gcs_custom)
|
||||
if (choice != INT32_MAX && G_GetControlScheme(gamecontrol, gclist_tutorial, num_gclist_tutorial) == gcs_custom)
|
||||
{
|
||||
M_StartMessage("Do you want to try the \202recommended \202controls\x80?\n\nWe will set them just for this tutorial.\n\n(Press 'Y' to confirm,\nor any key to keep \nyour current controls.)\n",M_TutorialControlResponse,MM_YESNO);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue