HRESULT XZPManager::XZPOpenBinary(string opath, string filename, string xmlname) { m_basePath = SETTINGS::getInstance().getDataPath(); string loadfilename = "file://" + opath + filename; loadfilename = str_replaceall(loadfilename, "\\", "/"); Path = strtowchar(loadfilename); DebugMsg("XZPManager", "PATH: %s, loading package", wstrtostr(Path).c_str()); HRESULT hr = XuiResourceOpenPackage(Path,&phPackage,false); if (hr != S_OK) { DebugMsg("XZPManager", "Error HRESULT: %08x", hr); return hr; } else { szLocator = strtowchar(loadfilename + "#" + xmlname); byte * buf; UINT size; hr = XuiResourceLoadAllNoLoc(szLocator, &buf, &size); if (hr != S_OK) { DebugMsg("XZPManager", "HRESULT : %08x, Loading resource"); XuiResourceReleasePackage(phPackage); return hr; } else { DebugMsg("XZPManager", "Resource is in memory Size is %d", size); string outpath = sprintfaA("%sSkins\\%s\\%s", m_basePath.c_str(), filename.c_str(), xmlname.c_str()); DebugMsg("XZPManager", "Saving file to %s", outpath.c_str()); // Write Item To File FILE * fHandle; fopen_s(&fHandle, outpath.c_str(), "wb"); fwrite(buf, size, 1, fHandle); fclose(fHandle); XuiFree((void*)buf); } } XuiResourceReleasePackage(phPackage); return S_OK; }
void creditsText () { static char strIni [256]; sprintf(strIni, "%s\\credits.ini", _chr(work_dir)); // start music and lyrics { snd_stop(g_fhCreditsSong); g_fhCreditsSong = snd_play(g_musicCredits, 100, 0); lyricsStart(NULL, g_txtCreditsLyrics, g_fhCreditsSong); } int pos = 0; int count = ini_read_int(strIni, "Credits", "max", "0"); var duration = ini_read_int(strIni, "Credits", "duration", "15"); var itemDuration = duration / (var)count; creditsHead1.flags |= SHOW; creditsBody1.flags |= SHOW; creditsHead2.flags |= SHOW; creditsBody2.flags |= SHOW; creditsHead2.pos_y = screen_size.y - g_lyricsBarHeight - 150; creditsBody2.pos_y = screen_size.y - g_lyricsBarHeight - 100; int size1 = 300; int size2 = 600; var x = 0; var len = 0; while (snd_playing(g_fhCreditsSong) != 0 && !g_bCreditsAllExplode) { static char section [256]; sprintf(section, "Credit%d", pos + 1); ini_read(creditsText1Head, strIni, section, "Head1", " "); ini_read(creditsText1Body, strIni, section, "Body1", " "); ini_read(creditsText2Head, strIni, section, "Head2", " "); ini_read(creditsText2Body, strIni, section, "Body2", " "); str_replaceall(creditsText1Body, "##", "\n"); str_replaceall(creditsText2Body, "##", "\n"); creditsHead1.pos_x = -size1; creditsBody1.pos_x = -size1; creditsHead2.pos_x = screen_size.x + size2; creditsBody2.pos_x = screen_size.x + size2; var fadetime = 0.22 * itemDuration; var fade = 0; var fadespeed = 16 / fadetime; for (fade = 0; fade < 100; fade += fadespeed * time_step) { creditsHead1.pos_x = -size1 + 1.5 * size1 * (1 - pow(1 - 0.01 * fade, 2)); creditsBody1.pos_x = -size1 + 1.7 * size1 * (1 - pow(1 - 0.01 * fade, 2)); if (g_bCreditsAllExplode) break; wait(1); } for (fade = 0; fade < 100; fade += fadespeed * time_step) { creditsHead2.pos_x = screen_size.x + size2 - 1.2 * size2 * (1 - pow(1 - 0.01 * fade, 2)); creditsBody2.pos_x = screen_size.x + size2 - 1.3 * size2 * (1 - pow(1 - 0.01 * fade, 2)); if (g_bCreditsAllExplode) break; wait(1); } var t_id = 0.6 * itemDuration * 16; while (t_id > 0 && !g_bCreditsAllExplode) { t_id -= time_step; wait(1); } var scrollspeed = 100; for (fade = 0; fade < 100; fade += fadespeed * time_step) { creditsHead1.pos_x += scrollspeed * time_step; if (fade > 20) creditsBody1.pos_x += scrollspeed * time_step; if (g_bCreditsAllExplode) break; wait(1); } for (fade = 0; fade < 100; fade += fadespeed * time_step) { creditsHead2.pos_x -= scrollspeed * time_step; if (fade > 20) creditsBody2.pos_x -= scrollspeed * time_step; if (g_bCreditsAllExplode) break; wait(1); } pos += 1; wait(1); } snd_stopall(4); creditsHead1.flags &= ~SHOW; creditsBody1.flags &= ~SHOW; creditsHead2.flags &= ~SHOW; creditsBody2.flags &= ~SHOW; g_bCreditsAllExplode = true; creditsFinished = true; var et = 5 * 16; while (et > 0) { camera->tilt += time_step * 0.2; camera->arc += time_step * 0.2; et -= time_step; wait(1); } // show space text { set(g_txtCreditsSpace, SHOW); g_txtCreditsSpace->pos_x = screen_size.x / 2; g_txtCreditsSpace->pos_y = screen_size.y * 0.8; on_space = creditsSpace; } }