void CCredits::AdvanceCredit(int nState) { m_iCredit++; if(m_iCredit >= m_cCredits) { m_iCredit = 0; if (IsIntro()) m_bDone = DTRUE; } CCredit* pCredit = GetCredit(m_iCredit); if (pCredit) pCredit->SetState(nState); }
void CCredits::HandleInput(int vkey) { // Handle various keys... switch (vkey) { case VK_UP: { if (IsIntro()) break; IncSpeed(); break; } case VK_DOWN: { if (IsIntro()) break; DecSpeed(); break; } case VK_HOME: { if (IsIntro()) break; s_fSpeed = 1.0; break; } case VK_RETURN: case VK_SPACE: case VK_NEXT: { if (IsIntro() || IsDemoIntro()) { CCredit* pCredit = GetCredit(m_iCredit); if (pCredit) { if (pCredit->GetState() == CS_HOLDIN) { pCredit->SetState(CS_FADEOUT); } } } else { AdvanceCredit(CS_HOLDIN); } break; } case VK_PRIOR: { if (IsIntro() || IsDemoIntro()) break; BackupCredit(CS_HOLDIN); break; } case VK_PAUSE: { if (IsIntro() || IsDemoIntro()) break; s_bPause ^= 1; break; } case VK_ESCAPE: { // ExitToMainMenu(); break; } } }
void CCredits::AddCredits() { // Sanity checks... if (!m_pClientDE) return; // Set the static info... if (!CCredit::SetStaticInfo(m_pClientDE, GetMode(), IsClearingScreen())) { return; } // Get the credits text buffer... char* sName = NULL; #ifdef _ADDON if (IsIntro()) sName = "INTRO_AO"; else sName = "CREDITS_AO"; #else if (IsIntro()) sName = "INTRO"; else sName = "CREDITS"; #endif void* hModule = NULL; m_pClientDE->GetEngineHook("cres_hinstance", &hModule); char* sBuf = CreditsWin_GetTextBuffer(sName, hModule); if (!sBuf) return; char sCredit[1024]; int i = 0; while (*sBuf) { if (*sBuf == '#' && *((char*)_mbsinc((const unsigned char*)sBuf)) == '#') { sCredit[i] = '\0'; if (_mbsnbcmp((const unsigned char*)sCredit, (const unsigned char*)">END", 4) == 0) // end? { return; } AddCredit(sCredit); i = 0; sBuf = (char*)_mbsinc((const unsigned char*)sBuf); sBuf = (char*)_mbsinc((const unsigned char*)sBuf); while (*sBuf != '\0' && ((*sBuf == '\n') || (*sBuf == '\r'))) sBuf++; } else { int nCount = _mbsnbcnt((const unsigned char*)sBuf,1); memcpy(&sCredit[i], sBuf, nCount); i += nCount; sBuf = (char*)_mbsinc((const unsigned char*)sBuf); } } }