Add in startup sounds (#1532)

* Add in startup sounds

meowhook represent
This commit is contained in:
braaaap master 2021-08-20 11:34:19 -05:00 committed by GitHub
parent 3a3a225471
commit 528c27f8ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 21 deletions

View File

@ -0,0 +1,9 @@
vo/heavy_mvm_get_upgrade03.mp3
vo/items/wheatley_sapper/wheatley_sapper_attached14.mp3
vo/sniper_laughevil02.mp3
vo/compmode/cm_engie_pregamefirst_rare_06.mp3
vo/compmode/cm_engie_pregamelostlast_07.mp3
vo/soldier_mvm_loot_godlike03.mp3
vo/soldier_robot15.mp3
vo/soldier_mvm_get_upgrade01.mp3
vo/medic_mvm_loot_godlike02.mp3

View File

@ -165,30 +165,36 @@ std::unique_ptr<font> esp{ nullptr };
std::unique_ptr<font> center_screen{ nullptr };
} // namespace fonts
static InitRoutine font_size([]() {
esp_font_size.installChangeCallback([](settings::VariableBase<int> &var, int after) {
if (after > 0 && after < 100)
{
static InitRoutine font_size(
[]()
{
esp_font_size.installChangeCallback(
[](settings::VariableBase<int> &var, int after)
{
if (after > 0 && after < 100)
{
#if ENABLE_GLEZ_DRAWING
fonts::esp->unload();
fonts::esp.reset(new fonts::font(paths::getDataPath("/menu/Verdana.ttf"), after));
fonts::esp->unload();
fonts::esp.reset(new fonts::font(paths::getDataPath("/menu/Verdana.ttf"), after));
#else
fonts::esp->changeSize(after);
fonts::esp->changeSize(after);
#endif
}
});
center_font_size.installChangeCallback([](settings::VariableBase<int> &var, int after) {
if (after > 0 && after < 100)
{
}
});
center_font_size.installChangeCallback(
[](settings::VariableBase<int> &var, int after)
{
if (after > 0 && after < 100)
{
#if ENABLE_GLEZ_DRAWING
fonts::center_screen->unload();
fonts::center_screen.reset(new fonts::font(paths::getDataPath("/menu/Verdana.ttf"), after));
fonts::center_screen->unload();
fonts::center_screen.reset(new fonts::font(paths::getDataPath("/menu/Verdana.ttf"), after));
#else
fonts::center_screen->changeSize(after);
fonts::center_screen->changeSize(after);
#endif
}
}
});
});
});
namespace draw
{
@ -421,7 +427,8 @@ void RectangleTextured(float x, float y, float w, float h, rgba_t color, Texture
float cx = x + float(w) / 2.0f;
float cy = y + float(h) / 2.0f;
auto f = [&](Vector2D &v) {
auto f = [&](Vector2D &v)
{
v.x = cx + cosf(angle) * (v.x - cx) - sinf(angle) * (v.y - cy);
v.y = cy + sinf(angle) * (v.x - cx) + cosf(angle) * (v.y - cy);
};
@ -475,10 +482,10 @@ VMatrix wts{};
void UpdateWTS()
{
CViewSetup gay;
CViewSetup view;
VMatrix _, __, ___;
g_IBaseClient->GetPlayerView(gay);
g_IVRenderView->GetMatricesForView(gay, &_, &__, &wts, &___);
g_IBaseClient->GetPlayerView(view);
g_IVRenderView->GetMatricesForView(view, &_, &__, &wts, &___);
}
bool WorldToScreen(const Vector &origin, Vector &screen)
@ -493,6 +500,23 @@ bool WorldToScreen(const Vector &origin, Vector &screen)
return true;
return false;
}
void StartupSound()
{
// 100% based unique meowhook only feature do not steal
std::string cur_line;
std::vector<std::string> line_count;
std::ifstream sfile(paths::getDataPath("/startup_sounds.txt"));
int total_lines = 0;
while (getline(sfile, cur_line))
{
total_lines++;
line_count.push_back(cur_line);
}
int random_number = rand() % total_lines;
g_ISurface->PlaySound(line_count[random_number].c_str());
}
#if ENABLE_ENGINE_DRAWING
bool Texture::load()
{
@ -583,6 +607,7 @@ void InitGL()
#if ENABLE_GUI
gui::init();
StartupSound();
#endif
}