bool CPlayGameVorticon::init() { CVorticonMapLoaderWithPlayer MapLoader( mMap, m_Player, mSpriteObjectContainer ); MapLoader.m_checkpointset = m_checkpointset; // load level map if( !MapLoader.load( m_Episode, m_Level, m_Gamepath ) ) return false; gpSaveGameController->setLevel(m_Level); //// If those worked fine, continue the initialization // draw level map mMap->drawAll(); // Now Scroll to the position of the player and center him mMap->gotoPos( 32, 64 ); // Assure that the edges are never seen setupPlayers(); // Well, all players are living because they were newly spawn. g_pTimer->ResetSecondsTimer(); g_pInput->flushAll(); // Initialize the AI mpObjectAI.reset( new CVorticonSpriteObjectAI(mMap.get(), mSpriteObjectContainer, m_Player, m_NumPlayers, m_Episode, m_Level, mMap->m_Dark) ); // Check if Player meets the conditions to show a cutscene. This also happens, when finale of episode has reached verifyFinales(); // When Level starts it's never dark! g_pGfxEngine->Palette.setdark(false); if(m_level_command == GOTO_FINALE) createFinale(); else if(m_showKeensLeft) g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW); // In the case that we are in Episode 3 last Level, show Mortimer Messages if( m_Episode == 3 && m_Level == 16 ) { std::unique_ptr<CMessageBoxVort> msg1(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true)); std::unique_ptr<CMessageBoxVort> msg2(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true)); std::unique_ptr<CMessageBoxVort> msg3(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true)); std::unique_ptr<CMessageBoxVort> msg4(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true)); std::unique_ptr<CMessageBoxVort> msg5(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true)); std::unique_ptr<CMessageBoxVort> msg6(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true)); mMessageBoxes.push_back(move(msg1)); mMessageBoxes.push_back(move(msg2)); mMessageBoxes.push_back(move(msg3)); mMessageBoxes.push_back(move(msg4)); mMessageBoxes.push_back(move(msg5)); mMessageBoxes.push_back(move(msg6)); g_pSound->playSound(SOUND_MORTIMER); } return true; }
void warn_connection3(const struct connections_entry* c, const char* s, uint64 u1, uint64 u2) { char num1[FMT_ULONG_LEN]; char num2[FMT_ULONG_LEN]; num1[fmt_ulldec(num1, u1)] = 0; num2[fmt_ulldec(num2, u2)] = 0; msg6(format_connection(c), "Warning: ", s, num1, " ", num2); }
TEST(Serialization, WriteBitsEasy) { QByteArray msg(1, 'a'); QBitArray bits(1, false); Serialization::WriteBitArray(bits, msg, 0); EXPECT_EQ((char)0x00, (char)msg[0]); QByteArray msg1(1, 'a'); QBitArray bits1(0, false); Serialization::WriteBitArray(bits1, msg1, 0); EXPECT_EQ((char)0x00, (char)msg1[0]); QByteArray msg2(1, 'a'); QBitArray bits2(1, true); Serialization::WriteBitArray(bits2, msg2, 0); EXPECT_EQ((char)0x01, (char)msg2[0]); QByteArray msg3(2, 'a'); QBitArray bits3(8, true); Serialization::WriteBitArray(bits3, msg3, 0); EXPECT_EQ((char)0xFF, (char)msg3[0]); EXPECT_EQ((char)'a', (char)msg3[1]); QByteArray msg4(2, 'a'); QBitArray bits4(8, true); Serialization::WriteBitArray(bits4, msg4, 1); EXPECT_EQ((char)'a', (char)msg4[0]); EXPECT_EQ((char)0xFF, (char)msg4[1]); QByteArray msg5(2, 'a'); QBitArray bits5(9, true); Serialization::WriteBitArray(bits5, msg5, 0); EXPECT_EQ((char)0xFF, (char)msg5[0]); EXPECT_EQ((char)0x01, (char)msg5[1]); QByteArray msg6(2, 'a'); QBitArray bits6(10, true); Serialization::WriteBitArray(bits6, msg6, 0); EXPECT_EQ((char)0xFF, (char)msg6[0]); EXPECT_EQ((char)0x03, (char)msg6[1]); }
bool CPlayGameVorticon::init() { const GsRect<Uint16> gameRect = gVideoDriver.getVidConfig().m_GameRect; gVideoDriver.setNativeResolution(gameRect); // Create the special merge effect (Fadeout) CColorMerge *pColorMergeFX = new CColorMerge(8); gEffectController.setupEffect(pColorMergeFX); CVorticonMapLoaderWithPlayer MapLoader( mMap, m_Player, mSpriteObjectContainer ); MapLoader.m_checkpointset = m_checkpointset; const int numPlayers = g_pBehaviorEngine->mPlayers; // load level map if( !MapLoader.load( m_Episode, m_Level, m_Gamepath ) ) return false; gpSaveGameController->setLevel(m_Level); mMap->setLevel(m_Level); //// If those worked fine, continue the initialization // draw level map mMap->drawAll(); // Now Scroll to the position of the player and center him mMap->gotoPos( 32, 64 ); // Ensure that the edges are never seen setupPlayers(); // Well, all players are living because they were newly spawn. gTimer.ResetSecondsTimer(); gInput.flushAll(); // Initialize the AI mpObjectAI.reset( new CVorticonSpriteObjectAI(mMap.get(), mSpriteObjectContainer, m_Player, numPlayers, m_Episode, m_Level, mMap->m_Dark) ); // Check if Player meets the conditions to show a cutscene. This also happens, when finale of episode is reached verifyFinales(); // When Level starts it's never dark! gGraphics.Palette.setdark(false); const std::string finaleStr = gArgs.getValue("finale"); if(finaleStr == "on") { createFinale(); gArgs.removeTag("finale"); } if(m_showKeensLeft) g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW); // In the case that we are in Episode 3 last Level, show Mortimer Messages if( m_Episode == 3 && m_Level == 16 ) { std::unique_ptr<CMessageBoxVort> msg1(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true)); std::unique_ptr<CMessageBoxVort> msg2(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true)); std::unique_ptr<CMessageBoxVort> msg3(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true)); std::unique_ptr<CMessageBoxVort> msg4(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true)); std::unique_ptr<CMessageBoxVort> msg5(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true)); std::unique_ptr<CMessageBoxVort> msg6(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true)); mMessageBoxes.push_back(move(msg1)); mMessageBoxes.push_back(move(msg2)); mMessageBoxes.push_back(move(msg3)); mMessageBoxes.push_back(move(msg4)); mMessageBoxes.push_back(move(msg5)); mMessageBoxes.push_back(move(msg6)); g_pSound->playSound(SOUND_MORTIMER); } return true; }