Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
committerRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
commitaf7dac72f4063dd8d4dac71973ea51c25896089a (patch)
tree35558695aea94d48fd9e77d164d63fd8b7c76e90 /plugins/sr
parent40b28b03c150b453e00c6bc4f8d6957caea59c51 (diff)
FORMAT: Run clang-format 10 on all C/CXX source-files
Diffstat (limited to 'plugins/sr')
-rw-r--r--plugins/sr/sr.cpp94
1 files changed, 40 insertions, 54 deletions
diff --git a/plugins/sr/sr.cpp b/plugins/sr/sr.cpp
index a5f9a14d4..16dab96c4 100644
--- a/plugins/sr/sr.cpp
+++ b/plugins/sr/sr.cpp
@@ -13,13 +13,13 @@
are met:
- Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
- Neither the name of the Mumble Developers nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -32,77 +32,76 @@
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
+
+*/
#include "../mumble_plugin_main.h"
-static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &/*context*/, std::wstring &/*identity*/) {
- for (int i=0;i<3;i++)
- avatar_pos[i]=avatar_front[i]=avatar_top[i]=0.0f;
-
+static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front,
+ float *camera_top, std::string & /*context*/, std::wstring & /*identity*/) {
+ for (int i = 0; i < 3; i++)
+ avatar_pos[i] = avatar_front[i] = avatar_top[i] = 0.0f;
+
char state;
bool ok;
// Create containers to stuff our raw data into, so we can convert it to Mumble's coordinate system
float pos_corrector[3];
float front_corrector[3];
float top_corrector[3];
-
+
/*
value is < >
*/
ok = peekProc(0xB378564, &state, 1); // Magical state value
- if (! ok)
+ if (!ok)
return false;
-
+
if (state == 1)
return true; // This results in all vectors beeing zero which tells Mumble to ignore them.
-
+
// Peekproc and assign game addresses to our containers, so we can retrieve positional data
- ok = peekProc(0x1243BE84, &pos_corrector, 12) &&
- peekProc(0x1243BEA8, &front_corrector, 12) &&
- peekProc(0x1243BE9C, &top_corrector, 12);
-
- if (! ok)
+ ok = peekProc(0x1243BE84, &pos_corrector, 12) && peekProc(0x1243BEA8, &front_corrector, 12)
+ && peekProc(0x1243BE9C, &top_corrector, 12);
+
+ if (!ok)
return false;
-
+
// Convert to left-handed coordinate system
-
+
avatar_pos[0] = pos_corrector[0];
avatar_pos[1] = pos_corrector[1];
avatar_pos[2] = -pos_corrector[2];
-
- for (int i=0;i<3;i++)
+
+ for (int i = 0; i < 3; i++)
avatar_pos[i] /= 15; // Scale to meters
-
+
avatar_front[0] = -front_corrector[0];
avatar_front[1] = -front_corrector[1];
avatar_front[2] = front_corrector[2];
-
+
avatar_top[0] = top_corrector[0];
avatar_top[1] = top_corrector[1];
avatar_top[2] = -top_corrector[2];
-
- for (int i=0;i<3;i++) {
- camera_pos[i] = avatar_pos[i];
+
+ for (int i = 0; i < 3; i++) {
+ camera_pos[i] = avatar_pos[i];
camera_front[i] = avatar_front[i];
- camera_top[i] = avatar_top[i];
+ camera_top[i] = avatar_top[i];
}
-
+
return true;
}
-static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
-
- if (! initialize(pids, L"subrosa.exe"))
+static int trylock(const std::multimap< std::wstring, unsigned long long int > &pids) {
+ if (!initialize(pids, L"subrosa.exe"))
return false;
-
+
// Check if we can get meaningful data from it
float apos[3], afront[3], atop[3];
float cpos[3], cfront[3], ctop[3];
std::wstring sidentity;
std::string scontext;
-
+
if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
return true;
} else {
@@ -119,26 +118,13 @@ static std::wstring description(L"Sub Rosa v0.07b");
static std::wstring shortname(L"Sub Rosa");
static int trylock1() {
- return trylock(std::multimap<std::wstring, unsigned long long int>());
+ return trylock(std::multimap< std::wstring, unsigned long long int >());
}
-static MumblePlugin subrosaplug = {
- MUMBLE_PLUGIN_MAGIC,
- description,
- shortname,
- nullptr,
- nullptr,
- trylock1,
- generic_unlock,
- longdesc,
- fetch
-};
-
-static MumblePlugin2 subrosaplug2 = {
- MUMBLE_PLUGIN_MAGIC_2,
- MUMBLE_PLUGIN_VERSION,
- trylock
-};
+static MumblePlugin subrosaplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, nullptr, nullptr, trylock1,
+ generic_unlock, longdesc, fetch };
+
+static MumblePlugin2 subrosaplug2 = { MUMBLE_PLUGIN_MAGIC_2, MUMBLE_PLUGIN_VERSION, trylock };
extern "C" MUMBLE_PLUGIN_EXPORT MumblePlugin *getMumblePlugin() {
return &subrosaplug;