Skip to content

Commit

Permalink
Merge pull request #55 from OverlordZorn/music-sahara-phone-music
Browse files Browse the repository at this point in the history
Music - New Music and Function Rework
  • Loading branch information
OverlordZorn authored Sep 27, 2024
2 parents bc59452 + b47f7d7 commit e9209c3
Show file tree
Hide file tree
Showing 23 changed files with 2,003 additions and 376 deletions.
1,402 changes: 1,402 additions & 0 deletions .hemtt/missions/~stratis.stratis/mission.sqm

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion addons/intel/XEH_preInit.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Extended_PreInit_EventHandlers {
class CVO_Music_CBA_Settings_XHE_PreInit {
class CVO_Intel_CBA_Settings_XHE_PreInit {
init = "call compile preprocessFileLineNumbers 'z\cvo\addons\intel\XEH_preInit.sqf'";
};
};
4 changes: 2 additions & 2 deletions addons/main/script_macros_zrn.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define _STORM_DEBUG_ // TODO Comment out before big release
#define _CVO_DEBUG_ // TODO Comment out before big release



Expand Down Expand Up @@ -64,7 +64,7 @@

#define ZRN_LOG_MSG(MSG) diag_log (DEBUG_HEADER + " " + QUOTE(MSG))

#ifdef _STORM_DEBUG_
#ifdef _CVO_DEBUG_
#define ZRN_SCRIPTNAME(var1) private _fnc_scriptName = Q(var1)

#define ZRN_LOG_MSG_1(MSG,A) diag_log (DEBUG_HEADER + (format [' %1 - A: %2',QUOTE(MSG),RETNIL(A)]))
Expand Down
13 changes: 10 additions & 3 deletions addons/music/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ class CfgFunctions
class COMPONENT // Category
{
file = PATH_TO_FUNC;
class playlist { postInit = 1; };
class play { };
class fadeStop { };

class add_playlist {};

class define_playlists { preInit = 1; };
class postInit { postInit = 1; };

class songFromPlaylist {};
class play {};

class fadeStop {};
};
};
};
53 changes: 52 additions & 1 deletion addons/music/CfgMusic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,55 @@ class CfgMusic
musicClass = "Others";
duration = 95;
};
};

// Saharan Cellphone Music
class Amanar_Alghafiat
{
name = "Amanar - Alghafiat";
sound[] = { PATH_TO_ADDON_3(data,saharan_cellphones,Amanar - Alghafiat.ogg), "db + 0" , 1.0 };
musicClass = "SaharanCellphones";
duration = 397;
};
class EtrandeLAir_Erkazamane
{
name = "Etran de LAir - Erkazamane";
sound[] = { PATH_TO_ADDON_3(data,saharan_cellphones,Etran de LAir - Erkazamane.ogg), "db + 0" , 1.0 };
musicClass = "SaharanCellphones";
duration = 253;
};
class EtrandeLAir_TouboukIneChihoussay
{
name = "Etran de LAir - Toubouk Ine Chihoussay";
sound[] = { PATH_TO_ADDON_3(data,saharan_cellphones,Etran de LAir - Toubouk Ine Chihoussay.ogg), "db + 0" , 1.0 };
musicClass = "SaharanCellphones";
duration = 257;
};
class Tinariwen_GroupAnmataff
{
name = "Tinariwen - Group Anmataff";
sound[] = { PATH_TO_ADDON_3(data,saharan_cellphones,Tinariwen - Group Anmataff.ogg), "db + 0" , 1.0 };
musicClass = "SaharanCellphones";
duration = 376;
};
class Tinariwen_Nannuflay
{
name = "Tinariwen - Nannuflay";
sound[] = { PATH_TO_ADDON_3(data,saharan_cellphones,Tinariwen - Nannuflay.ogg), "db + 0" , 1.0 };
musicClass = "SaharanCellphones";
duration = 251;
};
class Tinariwen_Sastanaqqam
{
name = "Tinariwen - Sastanaqqam";
sound[] = { PATH_TO_ADDON_3(data,saharan_cellphones,Tinariwen - Sastanaqqam.ogg), "db + 0" , 1.0 };
musicClass = "SaharanCellphones";
duration = 202;
};
class Tinariwen_TenereTaqqal
{
name = "Tinariwen - Tenere Taqqal";
sound[] = { PATH_TO_ADDON_3(data,saharan_cellphones,Tinariwen - Tenere Taqqal.ogg), "db + 0" , 1.0 };
musicClass = "SaharanCellphones";
duration = 271;
};
};
5 changes: 4 additions & 1 deletion addons/music/CfgMusicClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class CfgMusicClasses
{
displayName = "Others";
};

class SaharanCellphones
{
displayName = "Sarahan Cellphones";
};

};
13 changes: 8 additions & 5 deletions addons/music/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "script_component.hpp"

[
"CVO_CBA_musicDisplay", // _setting - Unique setting name. Matches resulting variable name <STRING>

QSET(displayMusic), // _setting - Unique setting name. Matches resulting variable name <STRING>
"CHECKBOX", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING>
["Display Music Title","This enables the message of the currently played music title by the CVO Music System"],
// _title - Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
Expand All @@ -11,7 +14,7 @@
] call CBA_fnc_addSetting;

[
"CVO_CBA_musicDisplayString", // _setting - Unique setting name. Matches resulting variable name <STRING>
QSET(displayMusic_Type), // _setting - Unique setting name. Matches resulting variable name <STRING>
"LIST", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING>
["Title or Classname?","Should the message show the Title of the track or its classname?"],
// _title - Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
Expand All @@ -24,7 +27,7 @@
] call CBA_fnc_addSetting;

[
"CVO_CBA_musicDisplayLow", // _setting - Unique setting name. Matches resulting variable name <STRING>
QSET(displayMusic_LowVolume), // _setting - Unique setting name. Matches resulting variable name <STRING>
"CHECKBOX", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING>
["Notify when MusicVolume is very low","This enables a notification when music is played and the clients musicvolume is below 5%"],
// _title - Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
Expand All @@ -36,7 +39,7 @@
] call CBA_fnc_addSetting;

[
"CVO_CBA_musicDelayMin", // _setting - Unique setting name. Matches resulting variable name <STRING>
QSET(delay_min), // _setting - Unique setting name. Matches resulting variable name <STRING>
"SLIDER", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING>
["Minimum Delay","The minimum delay in secounds that has to pass before the next title in the Music Queue will be played"],
// _title - Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
Expand All @@ -48,7 +51,7 @@
] call CBA_fnc_addSetting;

[
"CVO_CBA_musicDelayRandom", // _setting - Unique setting name. Matches resulting variable name <STRING>
QSET(delay_random), // _setting - Unique setting name. Matches resulting variable name <STRING>
"SLIDER", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING>
["Randomized Delay","This number will be added to the Minimum Delay, combined they will result in the maximum delay in secounds that has to pass before the next title in the Music Queue will be played."],
// _title - Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
Expand Down
2 changes: 1 addition & 1 deletion addons/music/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CfgPatches
url = "http://chronivoron.net";

// Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game.
requiredVersion = 2.0;
requiredVersion = 2.02;

// Required addons, used for setting load order.
// When any of the addons is missing, pop-up warning will appear when launching the game.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
55 changes: 55 additions & 0 deletions addons/music/functions/fn_add_playlist.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "../script_component.hpp"

/*
* Author: Zorn
* Function to Add a Playlist to the Music System.
* If the Playlist already exists
*
* Arguments:
*
* Return Value:
* None
*
* Example:
* ['something', player] call cvo_fnc_sth
*
* Public: Yes
*/

params [
["_playlistName", "", [""] ],
["_addEntries", [], [[]] ],
["_removeEntries", [], [[]] ]
];

if (_playlistName == "") exitWith {false};

// create the Hashmap if it doesnt exist
private _map = missionNamespace getVariable [QGVAR(Playlist_HM), "404"];
if (_map isEqualTo "404") then {_map = createHashMap};

//generates the list of CfgMusic Entries and stores it in the HashMap
private _allSongs = _map getOrDefault ["allSongs", "404"];

if (_allSongs isEqualTo "404") then {
_allSongs = ("true" configClasses (configFile >> "CfgMusic") apply {configName _x});
_map set ["allSongs", _allSongs];
};

_addEntries = _addEntries select { _x in _allSongs};
_removeEntries = _removeEntries select { _x in _allSongs};



// retrieve existing hashmap if it exists already, if not, create an empty array
private _playlist = _map getOrDefault [_playlistName, []];
_playlist = _playlist + _addEntries - _removeEntries;

// Filter out duplicates
_playlist = _playlist arrayIntersect _playlist;

_map set [_playlistName, _playlist];

missionNamespace setVariable [QGVAR(Playlist_HM), _map];

[_playlistName, _playlist]
Loading

0 comments on commit e9209c3

Please sign in to comment.