MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / keyProcess

Method keyProcess

Source/Fodder.cpp:3062–3173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3060}
3061
3062void cFodder::keyProcess(uint8 pKeyCode, bool pPressed) {
3063 if (pPressed)
3064 mKeyCode = pKeyCode;
3065 else
3066 mKeyCode = 0;
3067
3068 // Switch between platforms
3069 if (!mVersionPlatformSwitchDisabled) {
3070 mVersionPlatformSwitchDisabled = true;
3071 if ((mVersionDefault && mVersionDefault->isRetail()) || (mVersionCurrent && mVersionCurrent->isRetail())) {
3072
3073 if (pKeyCode == SDL_SCANCODE_F1 && pPressed) {
3074 mVersionDefault = mVersions->GetForCampaign(mVersionCurrent->mName, ePlatform::Amiga);
3075 mParams->mDefaultPlatform = ePlatform::Amiga;
3076 VersionSwitch(mVersionDefault);
3077 }
3078 if (pKeyCode == SDL_SCANCODE_F2 && pPressed) {
3079 mVersionDefault = mVersions->GetForCampaign(mVersionCurrent->mName, ePlatform::PC);
3080 mParams->mDefaultPlatform = ePlatform::PC;
3081 VersionSwitch(mVersionDefault);
3082 }
3083 }
3084 mVersionPlatformSwitchDisabled = false;
3085 }
3086
3087 if (pKeyCode == SDL_SCANCODE_F3 && pPressed) {
3088 if (mParams->mDemoRecord) {
3089 mStartParams->mDemoRecordResumeCycle = mGame_Data.mDemoRecorded.mTick - 200;
3090 mGame_Data.mGamePhase_Data.mIsComplete = true;
3091 mPhase_TryAgain = true;
3092 }
3093 }
3094
3095 if ((pKeyCode == SDL_SCANCODE_EQUALS && pPressed) || (pKeyCode == SDL_SCANCODE_KP_PLUS && pPressed))
3096 mWindow->WindowIncrease();
3097
3098 if ((pKeyCode == SDL_SCANCODE_MINUS && pPressed) || (pKeyCode == SDL_SCANCODE_KP_MINUS && pPressed))
3099 mWindow->WindowDecrease();
3100
3101 if (pKeyCode == SDL_SCANCODE_F11 && pPressed)
3102 mWindow->ToggleFullscreen();
3103
3104 if (pKeyCode == SDL_SCANCODE_F12 && pPressed) {
3105 mParams->mMouseLocked = !mParams->mMouseLocked;
3106
3107 if (mStartParams->mMouseAlternative)
3108 mWindow->SetRelativeMouseMode(mParams->mMouseLocked);
3109 }
3110
3111 if (pKeyCode == SDL_SCANCODE_ESCAPE && pPressed && mPhase_Aborted)
3112 mPhase_Aborted2 = true;
3113
3114 if (pKeyCode == SDL_SCANCODE_ESCAPE && pPressed) {
3115 mPhase_Aborted = true;
3116 mPhase_EscapeKeyAbort = true;
3117 }
3118 // In Mission and not on map overview
3119 if (mPhase_In_Progress && !mPhase_ShowMapOverview) {

Callers

nothing calls this directly

Calls 6

isRetailMethod · 0.80
GetForCampaignMethod · 0.80
WindowIncreaseMethod · 0.80
WindowDecreaseMethod · 0.80
ToggleFullscreenMethod · 0.80
SetRelativeMouseModeMethod · 0.80

Tested by

no test coverage detected