bool C4MainMenu::ActivateObserver() { // Safety: Viewport lost? if (!::Viewports.GetViewport(NO_OWNER)) return false; // Menu symbol/init InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_View), LoadResStr("IDS_TEXT_VIEW"), NO_OWNER, C4MN_Extra_None, 0, C4MN_Observer, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); // Players added in Refill Refill(); // Go back to main menu on close SetCloseCommand("ActivateMenu:Main"); return true; }
bool C4MainMenu::ActivateHostility(int32_t iPlayer) { // Init menu C4FacetSurface fctSymbol; fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctMenu.GetPhase(7).Draw(fctSymbol); Init(fctSymbol, LoadResStr("IDS_MENU_CPATTACK"), iPlayer, C4MN_Extra_None, 0, C4MN_Hostility); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); Refill(); // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); return true; }
/*---------------------------------------------------------------------- | AP4_BufferedInputStream::ReadPartial +---------------------------------------------------------------------*/ AP4_Result AP4_BufferedInputStream::ReadPartial(void* buffer, AP4_Size bytes_to_read, AP4_Size& bytes_read) { // check for shortcut if (bytes_to_read == 0) { bytes_read = 0; return AP4_SUCCESS; } // compute how much data is available in the buffer assert(m_BufferPosition <= m_Buffer.GetDataSize()); AP4_Size available = m_Buffer.GetDataSize()-m_BufferPosition; // refill the buffer if it is empty if (available == 0) { AP4_Result result = Refill(); if (AP4_FAILED(result)) { bytes_read = 0; return result; } assert(m_BufferPosition == 0); assert(m_Buffer.GetDataSize() != 0); available = m_Buffer.GetDataSize()-m_BufferPosition; } // clamp the number of bytes to read to what's available if (bytes_to_read > available) bytes_to_read = available; bytes_read = bytes_to_read; // copy the buffered data AP4_CopyMemory(buffer, m_Buffer.GetData()+m_BufferPosition, bytes_to_read); m_BufferPosition += bytes_to_read; assert(m_BufferPosition <= m_Buffer.GetDataSize()); return AP4_SUCCESS; }
void C4ObjectMenu::SetRefillObject(C4Object *pObj) { RefillObject=pObj; NeedRefill=true; Refill(); }