1
/* Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions
9
- Redistributions of source code must retain the above copyright notice,
10
this list of conditions and the following disclaimer.
11
- Redistributions in binary form must reproduce the above copyright notice,
12
this list of conditions and the following disclaimer in the documentation
13
and/or other materials provided with the distribution.
14
- Neither the name of the Mumble Developers nor the names of its
15
contributors may be used to endorse or promote products derived from this
16
software without specific prior written permission.
18
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
22
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3
33
#include <windows.h>
63
94
static void about(HWND h) {
64
::MessageBox(h, L"Reads audio position information from Left 4 Dead (Build 3922)", L"Mumble L4D Plugin", MB_OK);
95
::MessageBox(h, L"Reads audio position information from Left 4 Dead (Build 4023).", L"Mumble L4D Plugin", MB_OK);
67
98
static bool calcout(float *pos, float *rot, float *opos, float *front, float *top) {
141
173
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) {
142
174
float ipos[3], rot[3];
144
178
ok = peekProc(posptr, ipos, 12) &&
145
peekProc(rotptr, rot, 12);
179
peekProc(rotptr, rot, 12) &&
180
peekProc(stateptr, &state, 1);
183
return true; // This results in all vectors beeing zero which tells Mumble to ignore them.
148
186
int res = calcout(ipos, rot, avatar_pos, avatar_front, avatar_top);
166
204
static const std::wstring longdesc() {
167
return std::wstring(L"Supports L4D version 3986 only. Supports no fancy stuff.");
205
return std::wstring(L"Supports L4D version 4023 only. Supports no fancy stuff.");
170
static std::wstring description(L"Left 4 Dead (Build 3986)");
208
static std::wstring description(L"Left 4 Dead (Build 4023)");
171
209
static std::wstring shortname(L"Left 4 Dead");
173
211
static MumblePlugin l4dplug = {