void iphoneMainMenu() { if ( !btnResumeGame.texture ) { // initial setup #ifdef IPAD SetButtonPics( &btnResumeGame, "iphone/resume_game.tga", "Resume Game", 216, 338 ); SetButtonPics( &btnNewGame, "iphone/new_game.tga", "New Game", 446, 338 ); SetButtonPics( &btnWWW, "iphone/website.tga", "Website", 676, 338 ); SetButtonPics( &btnMultiplayer, "iphone/multiplay.tga", "Multiplayer", 347-17, 568 ); SetButtonPics( &btnControls, "iphone/controls.tga", "Options", 545+17, 568 ); SetButtonPics( &btnLabel1, "iphone/label1.tga", "", 0, 20 ); SetButtonPics( &btnLabel2, "iphone/label2.tga", "", 256, 20 ); SetButtonPics( &btnLabel3, "iphone/label3.tga", "", 512, 20 ); SetButtonPics( &btnLabel4, "iphone/label4.tga", "", 768, 20 ); btnLabel1.buttonFlags = BF_INACTIVE; btnLabel2.buttonFlags = BF_INACTIVE; btnLabel3.buttonFlags = BF_INACTIVE; btnLabel4.buttonFlags = BF_INACTIVE; #else SetButtonPics( &btnResumeGame, "iphone/resume_game.tga", "Resume Game", 16, 4 ); SetButtonPics( &btnNewGame, "iphone/new_game.tga", "New Game", 176, 4 ); SetButtonPics( &btnDemo, "iphone/demo.tga", "Demos", 336, 4 ); SetButtonPics( &btnMultiplayer, "iphone/multiplay.tga", "Multiplayer", 16, 168 ); SetButtonPics( &btnWWW, "iphone/website.tga", "Website", 176, 168 ); SetButtonPics( &btnControls, "iphone/controls.tga", "Options", 336, 168 ); #endif } #ifdef IPAD HandleButton(&btnLabel1); HandleButton(&btnLabel2); HandleButton(&btnLabel3); HandleButton(&btnLabel4); #endif if ( netgame ) { // disable buttons if we are already in a netgame btnNewGame.buttonFlags = BF_INACTIVE | BF_TRANSPARENT; btnMultiplayer.buttonFlags = BF_INACTIVE | BF_TRANSPARENT; btnWWW.buttonFlags = BF_INACTIVE | BF_TRANSPARENT; #ifndef IPAD btnDemo.buttonFlags = BF_INACTIVE | BF_TRANSPARENT; #endif } if ( HandleButton( &btnResumeGame ) ) { ResumeGame(); } if ( HandleButton( &btnNewGame ) ) { menuState = IPM_MAPS; } if ( HandleButton( &btnControls ) ) { menuState = IPM_CONTROLS; } if ( !NetworkAvailable() ) { // disable multiplayer if we don't have a good device //btnMultiplayer.buttonFlags = BF_INACTIVE | BF_TRANSPARENT; btnMultiplayer.buttonFlags = BF_TRANSPARENT; } else if ( netgame ) { // disable multiplayer if we are already in a netgame btnMultiplayer.buttonFlags = BF_INACTIVE | BF_TRANSPARENT; } else if ( NetworkServerAvailable() ) { // blink the multiplayer button if a local server is available btnMultiplayer.buttonFlags = BF_GLOW; } else { btnMultiplayer.buttonFlags = 0; } if ( HandleButton( &btnMultiplayer )) { if (NetworkAvailable()) { // get the address for the local service, which may // start up a bluetooth personal area network boolean serverResolved = ResolveNetworkServer( &netServer.address ); // open our socket now that the network interfaces have been configured // Explicitly open on interface 1, which is en0. If bluetooth ever starts // working better, we can handle multiple interfaces. if ( gameSocket <= 0 ) { gameSocket = UDPSocket( "en0", DOOM_PORT ); } // get the address for the local service if ( !serverResolved ) { // nobody else is acting as a server, so start one here RegisterGameService(); SetupEmptyNetGame(); } menuState = IPM_MULTIPLAYER; } else { SysShowAlert("Attention:", "Multiplayer requires a WiFi connection that doesn't block UDP port 14666"); } } // draw the available interfaces over the blinking net button if ( NetworkServerAvailable() ) { iphoneCenterText( btnMultiplayer.x + btnMultiplayer.drawWidth / 2, btnMultiplayer.y + btnMultiplayer.drawHeight/2, 0.75, NetworkServerTransport() ); } if ( HandleButton( &btnWWW ) ) { // menuState = IPM_PACKET_TEST; // !@# debug SysIPhoneOpenURL( "http://doomsday.generalarcade.com/" ); } #ifndef IPAD if ( HandleButton( &btnDemo ) ) { StartDemoGame( btnDemo.twoFingerPress ); } if ( btnDemo.twoFingerPress ) { strcpy( timeDemoResultString, "TIMEDEMO" ); } // draw the timedemo results on top of the button if ( timeDemoResultString[0] ) { iphoneCenterText( btnDemo.x + btnDemo.drawWidth / 2, btnDemo.y + btnDemo.drawHeight/2, 0.75, timeDemoResultString ); } #endif }
/************************************************************************** * * FUNCTION NAME: HandleCommand * * DESCRIPTION: * * * INPUT PARAMETERS: * None. * * OUTPUT PARAMETERS: * None. * **************************************************************************/ MRESULT EXPENTRY HandleCommand (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { HWND hwndDlg; MCI_GENERIC_PARMS mciGenericParms; switch (SHORT1FROMMP (mp1)) { /* ** Game menu items... */ case MENU_START_ID : eDemoMode = DEMO_NONE; if (gAction != PAUSED) { gAction = START; } break; case MENU_STOP_ID : eDemoMode = DEMO_NONE; gAction = STOP; break; case MENU_EXIT_ID : gAction = EXIT; break; case MENU_PAUSE_ID : /* Toggle the pause action */ if ((gAction = (gAction == PAUSED) ? NONE : PAUSED) == PAUSED) { PauseGame (); } else { ResumeGame (); } break; case MENU_DEMO_PLAY_ID : eDemoMode = DEMO_PLAY; if (gAction != PAUSED) { gAction = START; } break; case MENU_DEMO_RECORD_ID : /* Display a message box to verify they really want to do this */ if (!gfDemoLoaded || WinMessageBox (HWND_DESKTOP, HWND_DESKTOP, CHECK_RECORD, "Demo Record", 0, MB_YESNO | MB_WARNING | MB_MOVEABLE) == MBID_YES) { eDemoMode = DEMO_RECORD; if (gAction != PAUSED) { gAction = START; } } WinSetFocus (HWND_DESKTOP, hwndDefClient); break; /* ** Options menu items... */ case MENU_KEY_ID : hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndDefClient, (PFNWP) ProcessKeyDialog, 0L, KEY_DLG_ID, NULL); /* Process the dialog and then destroy it */ WinProcessDlg (hwndDlg); WinDestroyWindow (hwndDlg); break; case MENU_SPEED_ID : hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndDefClient, (PFNWP) ProcessSpeedDialog, 0L, SPEED_DLG_ID, NULL); /* Process the dialog and then destroy it */ WinProcessDlg (hwndDlg); WinDestroyWindow (hwndDlg); break; case MENU_OBJECT_SIZE_ID : hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndDefClient, (PFNWP) ProcessSizeDialog, 0L, SIZE_DLG_ID, NULL); /* Process the dialog and then destroy it */ WinProcessDlg (hwndDlg); WinDestroyWindow (hwndDlg); break; case MENU_HISCORE_ID : hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndDefClient, (PFNWP) ProcessHiScoreDialog, 0L, HISCORE_DLG_ID, NULL); /* Process the dialog and then destroy it */ WinProcessDlg (hwndDlg); WinDestroyWindow (hwndDlg); break; case MENU_REGISTER_ID : hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndDefClient, (PFNWP) ProcessRegisterDialog, 0L, REG_DLG_ID, NULL); /* Process the dialog and then destroy it */ WinProcessDlg (hwndDlg); WinDestroyWindow (hwndDlg); break; case MENU_BULLET_ID : /* Toggle the bullet menu item */ gfBullets = gfBullets ? FALSE : TRUE; WinCheckMenuItem (hwndMenu, MENU_BULLET_ID, gfBullets); break; case MENU_BUBBLES_ID : /* Toggle the bubbles menu item */ gfBubbles = gfBubbles ? FALSE : TRUE; WinCheckMenuItem (hwndMenu, MENU_BUBBLES_ID, gfBubbles); break; case MENU_SOUND_ID : /* Toggle the sound menu item */ if (gfSoundEnabled) { gfSoundOn = gfSoundOn ? FALSE : TRUE; WinCheckMenuItem (hwndMenu, MENU_SOUND_ID, gfSoundOn); if (gfSoundOn) { mciGenericParms.hwndCallback = hwnd; (*stMMPMFn[MCI_SENDCOMMAND_FN].pFn) (gusWaveDeviceID, MCI_ACQUIREDEVICE, (ULONG) MCI_NOTIFY, (PVOID) &mciGenericParms, (USHORT) 0); } } break; case MENU_MUSIC_ID : /* Toggle the menu menu item */ gfMusicEnabled = gfMusicEnabled ? FALSE : TRUE; WinCheckMenuItem (hwndMenu, MENU_MUSIC_ID, gfMusicEnabled); if (gfMusicEnabled) { (*stMMPMFn[MCI_SENDCOMMAND_FN].pFn) (gusMidiDeviceID, MCI_ACQUIREDEVICE, (ULONG) MCI_NOTIFY, (PVOID) &mciGenericParms, (USHORT) 0); } if (gsGameOn) { /* Play or stop the music */ gsMusicAction = gfMusicEnabled ? START : STOP; DosPostEventSem (hSoundEventSem); } break; case MENU_MOUSE_ID : /* Toggle the mouse menu item */ gfMouseEnabled = gfMouseEnabled ? FALSE : TRUE; WinCheckMenuItem (hwndMenu, MENU_MOUSE_ID, gfMouseEnabled); EnableMouse (gfMouseEnabled); break; case MENU_3SHIPS_ID : gsStartShips = 3; WinCheckMenuItem (hwndMenu, MENU_3SHIPS_ID, TRUE); WinCheckMenuItem (hwndMenu, MENU_4SHIPS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_5SHIPS_ID, FALSE); break; case MENU_4SHIPS_ID : gsStartShips = 4; WinCheckMenuItem (hwndMenu, MENU_3SHIPS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_4SHIPS_ID, TRUE); WinCheckMenuItem (hwndMenu, MENU_5SHIPS_ID, FALSE); break; case MENU_5SHIPS_ID : gsStartShips = 5; WinCheckMenuItem (hwndMenu, MENU_3SHIPS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_4SHIPS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_5SHIPS_ID, TRUE); break; case MENU_3SMARTS_ID : gsStartSmarts = 3; WinCheckMenuItem (hwndMenu, MENU_3SMARTS_ID, TRUE); WinCheckMenuItem (hwndMenu, MENU_5SMARTS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_7SMARTS_ID, FALSE); break; case MENU_5SMARTS_ID : gsStartSmarts = 5; WinCheckMenuItem (hwndMenu, MENU_3SMARTS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_5SMARTS_ID, TRUE); WinCheckMenuItem (hwndMenu, MENU_7SMARTS_ID, FALSE); break; case MENU_7SMARTS_ID : gsStartSmarts = 7; WinCheckMenuItem (hwndMenu, MENU_3SMARTS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_5SMARTS_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_7SMARTS_ID, TRUE); break; case MENU_SONAR_FADE_ID : stScanner.sMode = SCANNER_SWEEP; WinCheckMenuItem (hwndMenu, MENU_SONAR_FADE_ID, TRUE); WinCheckMenuItem (hwndMenu, MENU_SONAR_PERSIST_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_SONAR_NO_ID, FALSE); break; case MENU_SONAR_PERSIST_ID : stScanner.sMode = SCANNER_ON; WinCheckMenuItem (hwndMenu, MENU_SONAR_FADE_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_SONAR_PERSIST_ID, TRUE); WinCheckMenuItem (hwndMenu, MENU_SONAR_NO_ID, FALSE); break; case MENU_SONAR_NO_ID : stScanner.sMode = SCANNER_OFF; WinCheckMenuItem (hwndMenu, MENU_SONAR_FADE_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_SONAR_PERSIST_ID, FALSE); WinCheckMenuItem (hwndMenu, MENU_SONAR_NO_ID, TRUE); break; case MENU_FRAME_CONTROLS_ID : if (gfShowFrame) { HideFrameControls (); } else { ShowFrameControls (); } gfShowFrame = gfShowFrame ? FALSE : TRUE; WinCheckMenuItem (hwndMenu, MENU_FRAME_CONTROLS_ID, gfShowFrame); break; /* ** Help menu items... */ case MENU_HELPINDEX_ID : WinSendMsg (hwndHelpInstance, HM_HELP_INDEX, NULL, NULL); break; case MENU_HELPEXTENDED_ID : WinSendMsg(hwndHelpInstance, HM_EXT_HELP, NULL, NULL); break; case MENU_HELPHELPFORHELP_ID : WinSendMsg (hwndHelpInstance, HM_DISPLAY_HELP, NULL, NULL); break; case MENU_HELPKEYSHELP_ID : WinSendMsg (hwndHelpInstance, HM_KEYS_HELP, NULL, NULL); break; case MENU_HELPABOUT_ID : hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndDefClient, (PFNWP) ProcessProdInfoDialog, 0L, PROD_INFO_DLG_ID, NULL); /* Process the dialog and then destroy it */ WinProcessDlg (hwndDlg); WinDestroyWindow (hwndDlg); break; default : return (WinDefWindowProc (hwnd, msg, mp1, mp2)); } }
//Process selected keys until game unpaused. returns key that left pause (p or esc) int DoGamePause (void) { int key = 0; int bScreenChanged; char msg [1000]; char totalTime [9], xLevelTime [9]; if (gameData.app.bGamePaused) { //unpause! gameData.app.bGamePaused = 0; gameStates.app.bEnterGame = 1; #if defined (TACTILE) if (TactileStick) EnableForces(); #endif return KEY_PAUSE; } if (gameData.app.nGameMode & GM_NETWORK) { DoShowNetgameHelp(); return (KEY_PAUSE); } else if (gameData.app.nGameMode & GM_MULTI) { HUDInitMessage (TXT_MODEM_PAUSE); return (KEY_PAUSE); } PauseGame (); SetPopupScreenMode (); paletteManager.LoadEffect (); formatTime (totalTime, X2I (LOCALPLAYER.timeTotal) + LOCALPLAYER.hoursTotal * 3600); formatTime (xLevelTime, X2I (LOCALPLAYER.timeLevel) + LOCALPLAYER.hoursLevel * 3600); if (gameData.demo.nState!=ND_STATE_PLAYBACK) sprintf (msg, TXT_PAUSE_MSG1, GAMETEXT (332 + gameStates.app.nDifficultyLevel), LOCALPLAYER.hostages.nOnBoard, xLevelTime, totalTime); else sprintf (msg, TXT_PAUSE_MSG2, GAMETEXT (332 + gameStates.app.nDifficultyLevel), LOCALPLAYER.hostages.nOnBoard); if (!gameOpts->menus.nStyle) { gameStates.menus.nInMenu++; GameRenderFrame (); gameStates.menus.nInMenu--; } messageBox.Show (pszPauseMsg = msg, false); GrabMouse (0, 0); while (gameData.app.bGamePaused) { if (!(gameOpts->menus.nStyle && gameStates.app.bGameRunning)) key = KeyGetChar(); else { gameStates.menus.nInMenu++; while (!(key = KeyInKey ())) { GameRenderFrame (); paletteManager.LoadEffect (NULL); messageBox.Render (); G3_SLEEP (1); } gameStates.menus.nInMenu--; } #if DBG HandleTestKey(key); #endif bScreenChanged = HandleSystemKey (key); HandleVRKey (key); if (bScreenChanged) { GameRenderFrame (); messageBox.Render (); #if 0 show_extraViews (); if ((gameStates.render.cockpit.nType == CM_FULL_COCKPIT) || (gameStates.render.cockpit.nType == CM_STATUS_BAR)) RenderGauges(); #endif } } GrabMouse (1, 0); messageBox.Clear (); ResumeGame (); return key; }
void iphoneStartup() { int start = SysIphoneMilliseconds(); // microseconds will be plenty random for playerID and localGameID playerID = localGameID = SysIphoneMicroseconds(); InitImmediateModeGL(); // init OpenAL before pak file, so the pak file can // make all the al static buffers Sound_Init(); char buffer[1028]; sprintf( buffer, "%s/base.iPack", SysIphoneGetAppDir() ); // get our new-style pak file PK_Init( buffer ); // register console commands Cmd_AddCommand( "listcvars", Cvar_List_f ); Cmd_AddCommand( "resetcvars", Cvar_Reset_f ); Cmd_AddCommand( "resetmaps", ResetMaps_f ); Cmd_AddCommand( "listcmds", Cmd_ListCommands_f ); Cmd_AddCommand( "give", Give_f ); Cmd_AddCommand( "god", God_f ); Cmd_AddCommand( "mail", EmailConsole ); //gsh, mails the console to id // register console variables Cvar_Get( "version", va( "%3.1f %s %s", DOOM_IPHONE_VERSION, __DATE__, __TIME__ ), 0 ); freeLevelOfWeek = Cvar_Get("freeLevelOfWeek", "0", 0 ); skill = Cvar_Get( "skill", "1", CVAR_ARCHIVE ); episode = Cvar_Get( "episode", "0", CVAR_ARCHIVE ); controlScheme = Cvar_Get( "controlScheme", "0", CVAR_ARCHIVE ); stickTurn = Cvar_Get( "stickTurn", "128", CVAR_ARCHIVE ); stickMove = Cvar_Get( "stickMove", "128", CVAR_ARCHIVE ); stickDeadBand = Cvar_Get( "stickDeadBand", "0.05", CVAR_ARCHIVE ); rotorTurn = Cvar_Get( "rotorTurn", "50000", CVAR_ARCHIVE ); tiltTurn = Cvar_Get( "tiltTurn", "0", CVAR_ARCHIVE ); tiltMove = Cvar_Get( "tiltMove", "0", CVAR_ARCHIVE ); tiltDeadBand = Cvar_Get( "tiltDeadBand", "0.08", CVAR_ARCHIVE ); tiltAverages = Cvar_Get( "tiltAverages", "3", CVAR_ARCHIVE ); centerSticks = Cvar_Get( "centerSticks", "1", CVAR_ARCHIVE ); rampTurn = Cvar_Get( "rampTurn", "1", CVAR_ARCHIVE ); music = Cvar_Get( "music", "1", CVAR_ARCHIVE ); cropSprites = Cvar_Get( "cropSprites", "1", 0 ); mapScale = Cvar_Get( "mapScale", "10", CVAR_ARCHIVE ); drawControls = Cvar_Get( "drawControls", "1", CVAR_ARCHIVE ); autoUse = Cvar_Get( "autoUse", "1", CVAR_ARCHIVE ); statusBar = Cvar_Get( "statusBar", "1", CVAR_ARCHIVE ); touchClick = Cvar_Get( "touchClick", "1", CVAR_ARCHIVE ); messages = Cvar_Get( "messages", "1", CVAR_ARCHIVE ); mapSelectY = Cvar_Get( "mapSelectY", "0", CVAR_ARCHIVE ); miniNet = Cvar_Get( "miniNet", "1", CVAR_ARCHIVE ); // multiplayer setup timeLimit = Cvar_Get( "timeLimit", "0", CVAR_ARCHIVE ); fragLimit = Cvar_Get( "fragLimit", "5", CVAR_ARCHIVE ); mpDeathmatch = Cvar_Get( "mpDeathmatch", "0", CVAR_ARCHIVE ); mpDataset = Cvar_Get( "mpDataset", "0", CVAR_ARCHIVE ); mpEpisode = Cvar_Get( "mpEpisode", "1", CVAR_ARCHIVE ); mpSkill = Cvar_Get( "mpSkill", "1", CVAR_ARCHIVE ); mpMap = Cvar_Get( "mpMap", "1", CVAR_ARCHIVE ); mpExpansion = Cvar_Get( "mpExpansion", "0", CVAR_ARCHIVE | CVAR_NOSET ); // debug tools showTilt = Cvar_Get( "showTilt", "-1", 0 ); showTime = Cvar_Get( "showTime", "0", 0 ); showNet = Cvar_Get( "showNet", "0", 0 ); showSound = Cvar_Get( "showSound", "0", 0 ); noBlend = Cvar_Get( "noBlend", "0", 0 ); // disable the damae blends for screenshots glfinish = Cvar_Get( "glfinish", "0", 0 ); throttle = Cvar_Get( "throttle", "0", 0 ); // network packet throttle enable // Was origiinally 4. Trying different values to help internet play. netBuffer = Cvar_Get( "netBuffer", "12", 0 ); // max tics to buffer ahead // load the archived cvars Cmd_ExecuteFile( va( "%s/config.cfg", SysIphoneGetDocDir() ) ); // start the intro music if it wasn't disabled with the music cvar iphonePlayMusic( "intro" ); // iphonePlayMusic( "e1m1" ); // these should get overwritten by the config loading memset( &playState, 0, sizeof( playState ) ); playState.map.skill = 1; playState.map.episode = 1; playState.map.map = 1; HudSetForScheme( 0 ); // load the binary config file FILE *f = fopen( va( "%s/binaryConfig.bin", SysIphoneGetDocDir() ), "rb" ); if ( f ) { int version; version = 0; fread( &version, 1, sizeof( version ), f ); if ( version != VERSION_BCONFIG ) { Com_Printf( "Binary config file bad version.\n" ); } else { fread( &playState, 1, sizeof( playState ), f ); fread( &huds, 1, sizeof( huds ), f ); version = 0; fread( &version, 1, sizeof( version ), f ); if ( version != VERSION_BCONFIG ) { Com_Error( "Binary config file bad trailing version.\n" ); } } fclose( f ); } Com_Printf( "startup time: %i msec\n", SysIphoneMilliseconds() - start ); start = SysIphoneMilliseconds(); // the texnums might have been different in the savegame HudSetTexnums(); arialFontTexture = PK_FindTexture( "iphone/arialImageLAL.tga" ); Com_Printf( "preloadBeforePlay(): %i msec\n", SysIphoneMilliseconds() - start ); // prBoom seems to draw the static pic screens without setting up 2D, causing // a bad first frame iphoneSet2D(); menuState = IPM_MAIN; lastState = IPM_MAIN; #if 0 // jump right to the save spot for debugging ResumeGame(); #endif }
//************************************************************************ void OptionsSceneCommand( HWND hWnd, int id, HWND hControl, UINT codeNotify ) //************************************************************************ { UINT loWord = (UINT)hControl; UINT hiWord = codeNotify; LPSCENE lpScene = NULL; LPOFFSCREEN lpOffScreen = NULL; switch (id) { case IDC_OPTION1: case IDC_OPTION2: case IDC_OPTION3: case IDC_OPTION4: case IDC_OPTION5: { int i = id - (int)IDC_OPTION1; BOOL bState = !(1 & (int)SendDlgItemMessage(hWnd, id, SM_GETSTATE, 1, 0L)); SendDlgItemMessage(hWnd, IDC_OPTSTATE1+i, SM_SETSTATE, bState, 0L); SendDlgItemMessage(hWnd, id, SM_SETSTATE, bState, 0L); LPSOUND pSound = new CSound(); if (pSound) { pSound->StartResourceID( IDC_OPTSWITCH, NO/*bLoop*/, -1/*iChannel*/, GetApp()->GetInstance(), TRUE ); delete(pSound); } break; } case IDC_EXIT: case IDC_RETURN: { for (int i=0; i<MAX_OPTIONS; i++) bOption[i] = (BOOL)SendDlgItemMessage(hWnd, IDC_OPTION1+(i*2), SM_GETSTATE, 1, 0L); // Assign the options to the values being controlled App.bOptionTransitions = bOption[0]; App.bOptionAutoTarget = bOption[1]; App.bOptionFireBack = bOption[2]; App.bOptionMusic = bOption[3]; App.bOptionBarricades = bOption[4]; //App.bOptionTaunts = bOption[]; if ( App.bOptionsfromGame ) ResumeGame( hWnd, 0 ); else GetApp()->GotoScene (hWnd, 2); // Return to main screen break; } case IDC_VOLUME0: { //iVolumeState = SendDlgItemMessage( hWnd, IDC_VOLUME0, SM_GETSTATE, 0, 0L ); if (iVolumeState == 4) { iVolumeState = 0; SendDlgItemMessage( hWnd, IDC_VOLUME0, SM_SETSTATE, iVolumeState, 0L ); } else { iVolumeState++; SendDlgItemMessage( hWnd, IDC_VOLUME0, SM_SETSTATE, iVolumeState, 0L); } break; } case IDC_SLIDER_MIDIVOL: { // Start and stop the looping sound StartMidi( !loWord ); // loWord is 1, on slider up WORD wVolume = (WORD)(( 32767L * (DWORD)hiWord ) / 100L); MCISetVolume ((LPSTR)MCI_DEVTYPE_SEQUENCER, wVolume | 0x8000, wVolume | 0x8000); break; } case IDC_SLIDER_WAVVOL: { // Start and stop the looping sound StartWave( !loWord ); // loWord is 1, on slider up WORD wVolume = (WORD)(( 32767L * (DWORD)hiWord ) / 100L); MCISetVolume ((LPSTR)MCI_DEVTYPE_WAVEFORM_AUDIO, wVolume | 0x8000, wVolume | 0x8000); break; } default: break; } }
//実行 int CSystem::Run() { switch(state) { case SYSTEM_NORMAL://通常 count++; if( GetInputPause() && (g_pBoss==NULL||g_pBoss->pTalk==NULL) ) { sndPause.Play(0); state = SYSTEM_PAUSE; g_pGame->Stop(); } if( fullpower_count > 0 ) fullpower_count--; if( spellbonus_count > 0 ) spellbonus_count--; //リプレイ動作 SunReplay.Run(); break; case SYSTEM_PAUSE://ポーズ中 { int old = pause_select; int maxpause = ( g_pTitle->title_select == 3 ) ? 2 : 3; pause_select += GetInputUD(); pause_select = mod(pause_select,maxpause); if( pause_select != old ) g_pTitle->sndSelect.Play(0); if(GetInputDecide()) { g_pTitle->sndDecide.Play(0); switch(pause_select) { case 0://ゲームを再開する ResumeGame(); break; case 1://タイトルに戻る ReturnTitle(); return 0; case 2://はじめからやり直す Restart(); break; } } } if( GetInputPause() ) { ResumeGame(); } break; case SYSTEM_GAMEOVER://ゲームオーバー { int old = gameover_select; gameover_select += GetInputUD(); gameover_select = mod(gameover_select,2); if( gameover_select != old ) g_pTitle->sndSelect.Play(0); if(GetInputDecide()) { g_pTitle->sndDecide.Play(0); switch(gameover_select) { case 0://コインいっこいれる life = 2; bomb = 3; continue_dirty = 1; continue_rest--; score = 0; graze = 0; //ゲーム再開 this->ResumeGame(); //弾をすべてアイテムに TamaToItem(); //エフェクト g_lEffect2.Add( new CEffectDamage( g_pPlayer->GetX(),g_pPlayer->GetY() )); //位置初期化 g_pPlayer->ResetPosition(); break; case 1://人生をあきらめる if( g_pGame->mode == 0 || g_pGame->mode == 2 ) { g_pSystem->SaveReplay(); } else { g_pTitle->Resume(); return 0; } break; } } } break; case SYSTEM_REPLAY://リプレイ保存 if( continue_dirty == 0 ) { int old = replay_select; replay_select += GetInputUD(); replay_select = mod(replay_select,2); if( replay_select != old ) g_pTitle->sndSelect.Play(0); if(GetInputDecide()) { g_pTitle->sndDecide.Play(0); switch(replay_select) { case 0://もちろん! SunReplay.Save(); break; case 1://抹消 break; } SunReplay.Exit(); ReturnTitle(); return 0; } } else if(GetInputDecide()) { g_pTitle->sndDecide.Play(0); SunReplay.Exit(); ReturnTitle(); } break; case SYSTEM_RESULT://ステージリザルト count++; switch( result_mode ) { case 0: result_count ++; //リプレイ動作 SunReplay.Run(); if( result_count == RESULT_COUNT ) { result_count = 0; result_mode ++; g_pGame->Stop(); } break; case 1: result_count ++; if( GetInputDecide() || (g_pGame->mode == 3 && result_count > 180)) { result_count = 0; result_mode ++; g_pTitle->sndDecide.Play(0); g_lShot.DeleteAll(); g_lLaser.DeleteAll(); g_lTama.DeleteAll(); g_lItem.DeleteAll(); g_lEnemy.DeleteAll(); g_lEffect.DeleteAll(); g_lEffect2.DeleteAll(); g_lEffect3.DeleteAll(); SAFE_DELETE( g_pStage ); g_pPlayer->ResetState(); g_pGame->stop = 0; AddScore( (1+life*4+bomb)*g_pGame->stage*(1+GetDifficult())*10000 ); if( (g_pGame->mode == 0 || (g_pGame->mode == 3&&SunReplay.m_header.mode==0)) && g_pGame->stage <= STAGE_NUM ) { g_pGame->CreateStage(); } else if( g_pGame->mode == 2 || (g_pGame->mode==0&&g_pGame->stage > STAGE_NUM) ) { SaveReplay(); } else{ g_pTitle->Resume(); return 0; } } break; case 2: result_count ++; //リプレイ動作 SunReplay.Run(); if( result_count == RESULT_COUNT ) { result_count = 0; result_mode = 0; state = SYSTEM_NORMAL; g_pGame->Resume(); } break; } break; case SYSTEM_RESUME: //ゲームに復帰中 resume_count--; if( resume_count == 0 ) { g_pGame->Resume(); } break; } return 1; }
void GameManager::CheckKey() { if (GameStart() && !GamePause() && !GameOver() ) { if (GetKey('w') || GetKey('W') || GetKey(VK_UP)) { MovePlane(Up); } if (GetKey('s') || GetKey('S') || GetKey(VK_DOWN)) { MovePlane(Down); } if (GetKey('a') || GetKey('A') || GetKey(VK_LEFT)) { MovePlane(Left); } if (GetKey('d') || GetKey('D') || GetKey(VK_RIGHT)) { MovePlane(Right); } if (!(GetKey('a') || GetKey('A') || GetKey(VK_LEFT)) && !(GetKey('d') || GetKey('D') || GetKey(VK_RIGHT)) ) { MovePlane(Stay); } //功能检测 if (GetKey('G') || GetKey('g')) { OnGod(); } if (GetKey('F') || GetKey('f')) { OffGod(); } if (GameManager::GetKey(VK_SPACE))//!GetPlayer()->Kill() { Player* p = GetPlayer(); if (p->FireStatus()) { Play(_T("Player_Shot")); Produce(_T("Weapon"), Point(p->X() + p->Width() / 2 - 3, p->Y() - 4), p->WeaponID()); } } if (GetKey('Q') || GetKey('q')) { Player* p = GetPlayer(); if (p->FireStatus()) { Produce(_T("Weapon"), Point(p->X() + p->Width() / 2 - 3, p->Y() - 4),11, GetList(Index_Enemy)); } } if (GetKey('Z') || GetKey('z')) { CList<GameObject*, GameObject*> *now = GetList(Index_Angela); POSITION pos = now->GetHeadPosition(); while (pos != NULL) { Angela* angela_ = static_cast<Angela*>(now->GetNext(pos)); if (angela_->Op() == 1) { angela_->SetX(GetPlayer()->X() - 80); angela_->SetY(GetPlayer()->Y()); angela_->Op(3, angela_->Position(), GetPlayer()->Position(), GetPlayer()->SpeedX(), GetPlayer()->SpeedY()); } else if (angela_->Op() == 2) { angela_->SetX(GetPlayer()->X() + 80); angela_->SetY(GetPlayer()->Y()); angela_->Op(3, angela_->Position(), GetPlayer()->Position(), GetPlayer()->SpeedX(), GetPlayer()->SpeedY()); } } } if (GetKey('X') || GetKey('x')) { CList<GameObject*, GameObject*> *now = GetList(Index_Angela); POSITION pos = now->GetHeadPosition(); while (pos != NULL) { Angela* angela_ = static_cast<Angela*>(now->GetNext(pos)); if (angela_->Op() == 1) { angela_->Op(1, angela_->Position(), GetPlayer()->Position(), 0,0); } else if (angela_->Op() == 2) { angela_->Op(2, angela_->Position(), GetPlayer()->Position(), 0,0); } } } if (GameManager::GetKey(VK_ESCAPE)) { PauseGame(); } } if (GameManager::GetKey(VK_RETURN)) { if (GameStart() && GamePause() ) { ResumeGame(); } else if(!GameStart()) { StartGame(); Play(_T("Mission_Begin")); } } }