void GameState::Init(void) { if (user->GetTeam()==2) enemyCastle.SetLocation(TEAM_1_CASTLE_POSITION, 0.0f, 0.0f); else enemyCastle.SetLocation(TEAM_2_CASTLE_POSITION, 0.0f, 0.0f); enemyCastle.LookAt(D3DXVECTOR3(0.0f, 0.0f, 0.0f)); // Set the camera position depending on your team if (user->GetTeam()==2) { user->SetCamera(D3DXVECTOR3(-(GROUND_WIDTH/2),175.0f,0), D3DXVECTOR3(0, 100.0f, 0.0f)); } else { user->SetCamera(D3DXVECTOR3(GROUND_WIDTH/2,175.0f,0), D3DXVECTOR3(0, 100.0f, 0.0f)); } if (rakServer->IsActive() || rakClient->IsConnected()) { char str[300]; assert(user->userName.GetUserInput()); strcpy(str, user->userName.GetUserInput()); strcat(str, ">"); userChatMessageInput.Init(); userChatMessageInput.SetPrefixText(str); userChatMessageInput.StartTextInput(); } lightedSphere.Init(); DoRestart(); }
void GameState::RestartGame(void) { // Delete all the fireballs and demons ClearNetworkObjects(); // Reset the variables that change when the game restarts DoRestart(); }
void PauseMenu::Confirmed() { switch (state) { case PAUSE: case GAME_OVER: switch (currentSelection) { case 1: //返回标题菜单 ReturnToTitle(); break; case 2: //保存录像 break; case 3: //重新开始 DoRestart(); break; } } }
bool PauseMenu::OnKeyDown(Ptr<EngineObject> sender, int key) { bool ret = Menu::OnKeyDown(sender, key); switch (key) { case VK_ESCAPE: if (state != GAME_OVER) { DoResume(); return true; } break; case 'R': if (state != REPLAY_OVER) { DoRestart(); return true; } break; } return ret; }
void ParticleEmitter::Restart(bool isDeleteAllParticles) { DoRestart(isDeleteAllParticles); Pause(false); }
void ParticleEmitter::Stop() { DoRestart(true); Pause(true); }
void ParticleEmitter::Play() { Pause(false); DoRestart(false); }
TArray<uint16_t> MIDISource::PrecacheData() { uint32_t Events[2][MAX_MIDI_EVENTS*3]; uint8_t found_instruments[256] = { 0, }; uint8_t found_banks[256] = { 0, }; bool multiple_banks = false; LoopLimit = 1; DoRestart(); found_banks[0] = true; // Bank 0 is always used. found_banks[128] = true; // Simulate playback to pick out used instruments. while (!CheckDone()) { uint32_t *event_end = MakeEvents(Events[0], &Events[0][MAX_MIDI_EVENTS*3], 1000000*600); for (uint32_t *event = Events[0]; event < event_end; ) { if (MEVENT_EVENTTYPE(event[2]) == 0) { int command = (event[2] & 0x70); int channel = (event[2] & 0x0f); int data1 = (event[2] >> 8) & 0x7f; int data2 = (event[2] >> 16) & 0x7f; if (channel != 9 && command == (MIDI_PRGMCHANGE & 0x70)) { found_instruments[data1] = true; } else if (channel == 9 && command == (MIDI_PRGMCHANGE & 0x70) && data1 != 0) { // On a percussion channel, program change also serves as bank select. multiple_banks = true; found_banks[data1 | 128] = true; } else if (channel == 9 && command == (MIDI_NOTEON & 0x70) && data2 != 0) { found_instruments[data1 | 128] = true; } else if (command == (MIDI_CTRLCHANGE & 0x70) && data1 == 0 && data2 != 0) { multiple_banks = true; if (channel == 9) { found_banks[data2 | 128] = true; } else { found_banks[data2] = true; } } } // Advance to next event if (event[2] < 0x80000000) { // short message event += 3; } else { // long message event += 3 + ((MEVENT_EVENTPARM(event[2]) + 3) >> 2); } } }