MCPcopy Create free account
hub / github.com/TurningWheel/Barony / stationOpenSound

Function stationOpenSound

src/interface/interface.cpp:7832–7880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7830}
7831
7832void stationOpenSound(int player, int type)
7833{
7834 int sfx = -1;
7835 int vol = 0;
7836 if ( type == GUI_TYPE_ALCHEMY )
7837 {
7838 vol = 64;
7839 sfx = 774 + local_rng.rand() % 2;
7840 //sfx = 401;
7841 }
7842 else if ( type == GUI_TYPE_TINKERING )
7843 {
7844 vol = 64;
7845 sfx = 421 + (local_rng.rand() % 2) * 3;
7846 }
7847
7848 if ( sfx > 0 )
7849 {
7850 playSoundEntityLocal(players[player]->entity, sfx, vol);
7851 if ( multiplayer == CLIENT )
7852 {
7853 strcpy((char*)net_packet->data, "EMOT");
7854 net_packet->data[4] = player;
7855 SDLNet_Write16(sfx, &net_packet->data[5]);
7856 net_packet->data[7] = vol;
7857 net_packet->address.host = net_server.host;
7858 net_packet->address.port = net_server.port;
7859 net_packet->len = 8;
7860 sendPacketSafe(net_sock, -1, net_packet, 0);
7861 }
7862 else if ( multiplayer != CLIENT )
7863 {
7864 for ( int c = 1; c < MAXPLAYERS; ++c )
7865 {
7866 if ( !client_disconnected[c] && !players[c]->isLocalPlayer() )
7867 {
7868 strcpy((char*)net_packet->data, "SNEL");
7869 SDLNet_Write16(sfx, &net_packet->data[4]);
7870 SDLNet_Write32((Uint32)players[player]->entity->getUID(), &net_packet->data[6]);
7871 SDLNet_Write16(vol, &net_packet->data[10]);
7872 net_packet->address.host = net_clients[c - 1].host;
7873 net_packet->address.port = net_clients[c - 1].port;
7874 net_packet->len = 12;
7875 sendPacketSafe(net_sock, -1, net_packet, c - 1);
7876 }
7877 }
7878 }
7879 }
7880}
7881
7882void GenericGUIMenu::openGUI(int type, Entity* shrine)
7883{

Callers 1

openGUIMethod · 0.85

Calls 5

playSoundEntityLocalFunction · 0.85
sendPacketSafeFunction · 0.85
randMethod · 0.80
isLocalPlayerMethod · 0.80
getUIDMethod · 0.80

Tested by

no test coverage detected