mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +00:00
- moved LocalKeys to controls.cpp
to consolidate input code in one file.
This commit is contained in:
parent
7493d4e334
commit
3c8da8c421
2 changed files with 61 additions and 58 deletions
|
@ -62,6 +62,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
void LocalKeys(void);
|
||||
|
||||
char bAddUserMap = false;
|
||||
bool bNoDemo = false;
|
||||
|
@ -538,64 +539,6 @@ void StartLevel(GAMEOPTIONS *gameOptions)
|
|||
}
|
||||
|
||||
|
||||
void LocalKeys(void)
|
||||
{
|
||||
bool alt = inputState.AltPressed();
|
||||
bool ctrl = inputState.CtrlPressed();
|
||||
bool shift = inputState.ShiftPressed();
|
||||
if (buttonMap.ButtonDown(gamefunc_Third_Person_View) && !alt && !shift)
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||
if (gViewPos > VIEWPOS_0)
|
||||
gViewPos = VIEWPOS_0;
|
||||
else
|
||||
gViewPos = VIEWPOS_1;
|
||||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_See_Coop_View))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_See_Coop_View);
|
||||
if (gGameOptions.nGameType == 1)
|
||||
{
|
||||
gViewIndex = connectpoint2[gViewIndex];
|
||||
if (gViewIndex == -1)
|
||||
gViewIndex = connecthead;
|
||||
gView = &gPlayer[gViewIndex];
|
||||
}
|
||||
else if (gGameOptions.nGameType == 3)
|
||||
{
|
||||
int oldViewIndex = gViewIndex;
|
||||
do
|
||||
{
|
||||
gViewIndex = connectpoint2[gViewIndex];
|
||||
if (gViewIndex == -1)
|
||||
gViewIndex = connecthead;
|
||||
if (oldViewIndex == gViewIndex || gMe->teamId == gPlayer[gViewIndex].teamId)
|
||||
break;
|
||||
} while (oldViewIndex != gViewIndex);
|
||||
gView = &gPlayer[gViewIndex];
|
||||
}
|
||||
}
|
||||
char key;
|
||||
if ((key = inputState.keyGetScan()) != 0)
|
||||
{
|
||||
if ((alt || shift) && gGameOptions.nGameType > 0 && key >= sc_F1 && key <= sc_F10)
|
||||
{
|
||||
char fk = key - sc_F1;
|
||||
if (alt)
|
||||
{
|
||||
netBroadcastTaunt(myconnectindex, fk);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPlayerMsg.Set(*CombatMacros[fk]);
|
||||
gPlayerMsg.Send();
|
||||
}
|
||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool gRestartGame = false;
|
||||
|
||||
void ProcessFrame(void)
|
||||
|
|
|
@ -74,6 +74,66 @@ float gViewAngleAdjust;
|
|||
float gViewLookAdjust;
|
||||
int gViewLookRecenter;
|
||||
|
||||
void LocalKeys(void)
|
||||
{
|
||||
bool alt = inputState.AltPressed();
|
||||
bool ctrl = inputState.CtrlPressed();
|
||||
bool shift = inputState.ShiftPressed();
|
||||
if (buttonMap.ButtonDown(gamefunc_Third_Person_View) && !alt && !shift)
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||
if (gViewPos > VIEWPOS_0)
|
||||
gViewPos = VIEWPOS_0;
|
||||
else
|
||||
gViewPos = VIEWPOS_1;
|
||||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_See_Coop_View))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_See_Coop_View);
|
||||
if (gGameOptions.nGameType == 1)
|
||||
{
|
||||
gViewIndex = connectpoint2[gViewIndex];
|
||||
if (gViewIndex == -1)
|
||||
gViewIndex = connecthead;
|
||||
gView = &gPlayer[gViewIndex];
|
||||
}
|
||||
else if (gGameOptions.nGameType == 3)
|
||||
{
|
||||
int oldViewIndex = gViewIndex;
|
||||
do
|
||||
{
|
||||
gViewIndex = connectpoint2[gViewIndex];
|
||||
if (gViewIndex == -1)
|
||||
gViewIndex = connecthead;
|
||||
if (oldViewIndex == gViewIndex || gMe->teamId == gPlayer[gViewIndex].teamId)
|
||||
break;
|
||||
} while (oldViewIndex != gViewIndex);
|
||||
gView = &gPlayer[gViewIndex];
|
||||
}
|
||||
}
|
||||
char key;
|
||||
if ((key = inputState.keyGetScan()) != 0)
|
||||
{
|
||||
if ((alt || shift) && gGameOptions.nGameType > 0 && key >= sc_F1 && key <= sc_F10)
|
||||
{
|
||||
char fk = key - sc_F1;
|
||||
if (alt)
|
||||
{
|
||||
netBroadcastTaunt(myconnectindex, fk);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPlayerMsg.Set(*CombatMacros[fk]);
|
||||
gPlayerMsg.Send();
|
||||
}
|
||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctrlGetInput(void)
|
||||
{
|
||||
int prevPauseState = paused;
|
||||
|
|
Loading…
Reference in a new issue