Compare commits

...

312 commits

Author SHA1 Message Date
smallmodel
cce81cabff
Implement multi-master queries and heartbeats (#717)
Some checks are pending
Build branch / build-all (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Implement multi-master server list query and multi-master heartbeats. The server list is fetched from multiple masters to improve redundancy, reliability and performance. This improves multiplayer availability by implementing support for using multiple masters.
- The server sends an heartbeat to all masters at once
- The client can query up to 4 masters in parallel depending on their rate
2025-04-27 22:14:08 +02:00
smallmodel
08a985d183
Format script grammar source files
Some checks failed
Build branch / build-all (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
2025-04-26 19:35:45 +02:00
smallmodel
816126b13a
Add ScriptVariable conditions from Ubertools into the script lexer
Those are Ubertools / F.A.K.K remnants that are valid in original mohaa script grammar
2025-04-26 19:10:08 +02:00
smallmodel
f2a6278daa
Fix stage being written past the limit (#716) 2025-04-26 16:39:25 +02:00
smallmodel
c1efc0e066
Set the minimum number to 30 for cl_maxpackets
Some checks failed
Build branch / build-all (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
20 is the bare minimum for players, any value below makes movements look jittery on a 20 fps server. 30 is the optimal value based on network variation and fps variations
2025-04-23 23:56:05 +02:00
smallmodel
236897cfcc
Set the server list socket as non-blocking
Some checks are pending
Build branch / build-all (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
This prevents the game from freezing when the connection is slow or if the master server is unreachable
2025-04-23 00:37:48 +02:00
smallmodel
73b4569c07
Add Com_InitGameSpy() for future use 2025-04-22 22:51:06 +02:00
smallmodel
25de66ed80
Fix wrong function name 2025-04-22 22:01:29 +02:00
smallmodel
a2bbf6cff8
Use functions that return master host information
This splits gamespy client-specific and server-specific code and add common gamespy code to provide more flexibility in the future
2025-04-22 21:40:34 +02:00
smallmodel
01367d0731
Use a more recent version of the gqueryreporting code
Some checks are pending
Build branch / build-all (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
2025-04-22 01:35:28 +02:00
smallmodel
fedc993e57
Initialize the player buffer list 2025-04-22 01:19:42 +02:00
smallmodel
b597240cfd
Link gcd_key to gcd_qr2
This is primarily used for clarity
2025-04-22 00:48:39 +02:00
smallmodel
127c9fe8f4
Uncomment WSACleanup()
The previous issue was because gqueryreporting was not calling SocketStartUp() as expected
2025-04-22 00:31:39 +02:00
smallmodel
ffc35fb5ab
Use the original gqueryreporting from GameSpy SDK
Potentially more stable and thoroughly tested
2025-04-22 00:27:00 +02:00
smallmodel
aa7639485e
Use __linux__ definition to check for linux 2025-04-22 00:25:29 +02:00
smallmodel
a4267d4f77
Initialize update list only for queries that are neither grouprooms or masterinfo 2025-04-21 22:31:41 +02:00
smallmodel
12880db557
Don't force HRTF if the speaker type is not "Headphones" 2025-04-21 21:26:33 +02:00
smallmodel
881d7f2f51
Don't refresh the server list if it's not ready
The server list UI refresh the server list for the first time when drawing. In mohaa (not Spearhead nor Breakthrough), refreshserverlist is also called by clicking "browse internet servers" which causes the list to be queried twice
2025-04-21 21:03:42 +02:00
smallmodel
93335978ea
Code formatting 2025-04-21 20:40:55 +02:00
smallmodel
64f62583ce
Set a more explicit version number
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 44s
Makes it easier to identify the currently running OPM version from the server list, useful for troubleshooting and checking if the server is up to date
2025-04-20 21:42:33 +02:00
smallmodel
5530d3051b
Fix missing spaces between product information in the logfile
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 1m16s
2025-04-19 21:36:58 +02:00
smallmodel
42326ec708
Fix timestamps printed twice on the same line (#714) 2025-04-19 21:35:53 +02:00
smallmodel
aa54e3c673
Use an epsilon value to check if float numbers are equal (#713) 2025-04-19 21:11:51 +02:00
smallmodel
5ce7f4faa5
Compile Windows ARM64 builds using Windows-11 ARM
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 44s
This allows to distribute the load across completely different hosts and also to make sure it compiles on ARM platforms
2025-04-19 14:16:54 +02:00
smallmodel
6d20a438db
Shorter paragraph
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 48s
2025-04-18 21:28:37 +02:00
smallmodel
7f662a93df
Update features.md 2025-04-18 21:20:02 +02:00
smallmodel
1758a0cd2e
Move whitelisted server commands to a dedicated source file 2025-04-18 18:49:12 +02:00
smallmodel
9b003b5428
Update OpenAL to version 1.24.3 2025-04-18 18:11:18 +02:00
smallmodel
db7fdd57e4
Add a section about other systems
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 1m18s
2025-04-17 23:34:49 +02:00
smallmodel
689da52ddf
Master server address update
This uplinks directly with 333networks instead of using a domain as an alias
2025-04-17 22:55:31 +02:00
smallmodel
2a1e2d7d6c
Check for valid scoreboard menu
Some checks failed
Build branch / build-all (push) Failing after 1m11s
CodeQL / Analyze (push) Has been cancelled
Under rare circumstances, the scoreboard menu can be NULL and would cause a crash. This was fixed in mohaab 2.30
2025-04-15 18:37:35 +02:00
smallmodel
cf8af91516
Remove macOS package cache due to permission errors
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 48s
2025-04-15 00:40:48 +02:00
smallmodel
c9ff941600
Implement Instant Action from Breakthrough (#712)
This adds a feature that makes it easy to join a populated low-ping server (matching criteria from configuration file). This feature has been available since MOHAA Breakthrough 2.30.
2025-04-15 00:31:34 +02:00
smallmodel
d389f89c49
Simplified the running documentation
Some checks failed
Build branch / build-all (push) Failing after 46s
CodeQL / Analyze (push) Has been cancelled
2025-04-12 22:49:15 +02:00
smallmodel
e05114806a
Add a simple install guide for Windows users 2025-04-12 22:35:05 +02:00
smallmodel
3074494131
Convert the game version to number once
Some checks failed
Build branch / build-all (push) Failing after 44s
CodeQL / Analyze (push) Has been cancelled
2025-04-04 22:53:06 +02:00
smallmodel
a9e161181c
Improve compiling documentation
Some checks failed
Build branch / build-all (push) Failing after 1m37s
CodeQL / Analyze (push) Has been cancelled
2025-04-01 22:43:58 +02:00
smallmodel
f9db0ab8f9
Fix an access violation that would occur when opening the logfile before com_version is created (#708) 2025-04-01 22:07:05 +02:00
smallmodel
94cc77b848
Set cmake version to 3.5 minimum for libmad 2025-04-01 21:33:16 +02:00
smallmodel
f16bec1e0a
Remove #pragma once from uimessage
Some checks failed
Build branch / build-all (push) Failing after 1m13s
CodeQL / Analyze (push) Has been cancelled
2025-03-24 22:16:53 +01:00
smallmodel
e2c24abf62
Move alext functions out of qal.h (#706)
qal.h should contain core/required functions. To get functions from extensions, alGetProcAddress should be used, so they can be optional
2025-03-24 22:16:43 +01:00
smallmodel
50e3aa1f61
Fix compilation errors with AL local headers (#705)
Some checks failed
Build branch / build-all (push) Failing after 48s
CodeQL / Analyze (push) Has been cancelled
* Remove alext inclusion as it's included by qal.h already

* Update local AL headers
2025-03-22 23:45:41 +01:00
Trung Lê
3c15588292
Update compiling.md (#704)
PowerPC64 LE run the game perfectly
2025-03-22 23:25:50 +01:00
Sébastien Noel
fdab158290
fix build on Debian mips64el (#700)
Some checks failed
Build branch / build-all (push) Failing after 59s
CodeQL / Analyze (push) Has been cancelled
Co-authored-by: smallmodel <15067410+smallmodel@users.noreply.github.com>
2025-03-19 15:26:26 +01:00
Sébastien Noel
921726e0b8
Fix a few typos (#699)
Co-authored-by: smallmodel <15067410+smallmodel@users.noreply.github.com>
2025-03-19 15:03:01 +01:00
Sébastien Noel
b5e49df180
fix build with shared jpeg library (#701) 2025-03-19 14:46:12 +01:00
smallmodel
49fd4acef8
Wrap WriteCallback around HAS_LIBCURL define
Some checks failed
Build branch / build-all (push) Failing after 48s
CodeQL / Analyze (push) Has been cancelled
2025-03-17 11:50:41 +01:00
smallmodel
73aa377264
Fix hit/kill notify being swapped (#698)
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 42s
2025-03-17 00:19:40 +01:00
smallmodel
74e909d17f
Add echo 2025-03-15 19:48:17 +01:00
smallmodel
4b3c150004
Add cg_cameraverticaldisplacement 2025-03-15 19:47:35 +01:00
smallmodel
5ee7948071
Add more sound-related commands 2025-03-15 19:43:23 +01:00
smallmodel
f653317e5b
Add the reason parameter to banaddr documentation
Some checks failed
Build branch / build-all (push) Failing after 57s
CodeQL / Analyze (push) Has been cancelled
2025-03-13 23:57:45 +01:00
smallmodel
de43299841
Add a note about updates 2025-03-13 23:57:08 +01:00
smallmodel
e6f5d76abe
Set the appropriate headers to use API versioning 2025-03-13 23:42:50 +01:00
smallmodel
fecd1eb505
Preallocate and set the maximum buffer size to receive the request 2025-03-13 23:37:20 +01:00
smallmodel
9536a8ec64
Specify a small timeout for each request 2025-03-13 22:41:01 +01:00
smallmodel
06a12246f5
Notify the request thread of shutdown only if it's waiting
This avoids a deadlock that would occur if notify_all() is called before the thread is waiting
2025-03-13 22:37:21 +01:00
smallmodel
456b660b2a
Improve the update checker so it can be opt-out (#696)
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 1m4s
* Add a cvar to enable/disable update checking

* Refactor update checker

This splits the thread part from the main part to clarify the code

* Move and update the configuration documentation, for a more general approach
2025-03-13 21:09:42 +01:00
smallmodel
5b81f6a977
Merge pull request #695 from smallmodel/update_fix
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 43s
Fix the update code
2025-03-13 00:13:38 +01:00
smallmodel
c854df8ffa
Don't start the update thread if it shouldn't be active or if the network doesn't work 2025-03-12 23:58:24 +01:00
smallmodel
22a34d8d68
Fix compile error when libcurl is not installed 2025-03-12 23:18:11 +01:00
smallmodel
0f8969e076
Merge pull request #693 from ysdragon/ban-kick-with-reason
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 44s
Kick/Ban with/no reason
2025-03-12 18:20:48 +01:00
ysdragon
f164e889cc
Add optional reason to kick/ban commands
And enhance `SV_IsBanned` to return ban reason and update `SV_DirectConnect` to display it
2025-03-12 07:30:40 +02:00
ysdragon
1e2a331518
Add reason field to serverBan structure with defined maximum length 2025-03-12 07:30:22 +02:00
smallmodel
158ff62aaa
Fix small typo
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 59s
2025-03-12 00:02:44 +01:00
smallmodel
79af8a46d1
Increase update thread sleep time
This prevents wasting time in scheduling the thread
2025-03-11 23:57:40 +01:00
smallmodel
200bf3229c
Merge pull request #692 from smallmodel/update_notification
Add a client-side update notification
2025-03-11 23:53:51 +01:00
smallmodel
e0b7d4cc60
Display a message box to the client when a new update is available 2025-03-11 23:37:51 +01:00
smallmodel
4fe11b5ea9
Always return false for CheckNewVersion() if libcurl is not used 2025-03-11 23:37:34 +01:00
smallmodel
0b590ab147
Add a way to create a message box 2025-03-11 23:32:22 +01:00
smallmodel
7a20bb4deb
Add a new method that return version numbers 2025-03-11 23:32:18 +01:00
smallmodel
c87c242098
Add a getter for m_font 2025-03-11 23:31:16 +01:00
smallmodel
eb92182230
Split OS builds between different workflow files
Some checks failed
Build branch / build-all (push) Failing after 43s
CodeQL / Analyze (push) Has been cancelled
2025-03-08 16:19:08 +01:00
smallmodel
5b9efaa2a0
Remove cpp-httplib
Some checks failed
Build branch / build-all (push) Failing after 23s
CodeQL / Analyze (push) Has been cancelled
2025-03-06 20:21:23 +01:00
smallmodel
58f7e6f1fe
Use cURL instead of cpp-httplib 2025-03-05 23:40:05 +01:00
smallmodel
9538dcb6e7
Print network name change
Some checks failed
Build branch / build-all (push) Failing after 26s
CodeQL / Analyze (push) Has been cancelled
2025-03-03 22:36:46 +01:00
smallmodel
0080f55ef8
Round to integer to avoid blurry text
Some checks failed
Build branch / build-all (push) Failing after 20s
CodeQL / Analyze (push) Has been cancelled
2025-03-02 14:12:54 +01:00
smallmodel
aac91e8763
Refactor and simplify Alias_ListSort 2025-03-02 13:55:44 +01:00
smallmodel
5c0adf9a28
Refactor Alias_FindRandomRange 2025-03-02 13:49:01 +01:00
smallmodel
9963a99868
Fix a stack overflow issue (#686)
The length check now include the null-terminated character
2025-03-02 13:40:36 +01:00
smallmodel
515a531abf
Use the length returned by Com_sprintf 2025-03-02 13:26:47 +01:00
smallmodel
d3d16ab7b6
Use the index of the entry in the player list, rather than the client number 2025-03-02 13:24:08 +01:00
smallmodel
d08027360f
Formatting 2025-03-01 23:34:24 +01:00
smallmodel
70f6ede7b8
Add GAMESPY_PORT environment variable
Some checks failed
Build branch / build-all (push) Failing after 17s
CodeQL / Analyze (push) Has been cancelled
2025-03-01 00:09:33 +01:00
smallmodel
c1c70a53be
Transition to idle after grouprooms or masterinfo requests are finished 2025-02-28 18:12:34 +01:00
smallmodel
f89bfba5dc
Replace tabs by spaces 2025-02-28 18:11:09 +01:00
smallmodel
c1a66bf9e7
Update README
Some checks failed
Build branch / build-all (push) Failing after 17s
CodeQL / Analyze (push) Has been cancelled
2025-02-24 23:08:13 +01:00
smallmodel
e98c725043
Fix player having no damage alpha in mohaas and mohaab (#678) 2025-02-24 22:11:41 +01:00
smallmodel
ad527a7033
Use ubuntu-22.04-arm OS for GitHub Actions to improve build time 2025-02-24 21:42:42 +01:00
smallmodel
59706d4698
Cache third-party packages to optimize the build time 2025-02-24 20:05:55 +01:00
smallmodel
7addef4f5f
Use Windows Server 2025 to compile Windows binaries
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 17s
2025-02-24 16:44:00 +01:00
smallmodel
08d0a378f8
Fix compilation fail when DEBUG_MEM is set (#677) 2025-02-24 13:38:33 +01:00
smallmodel
01381ed084
Add HTTP support and update checking
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
2025-02-24 02:20:31 +01:00
smallmodel
2c72908f76
Use the correct allocator when archiving a con_set object
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 17s
The default c++ allocator was be used to allocate an array of pointers, but then when destroying the array, Z_Free was called which would throw an error
2025-02-22 23:31:20 +01:00
smallmodel
32ba71693c
Remove some unnecessary endian swap 2025-02-22 22:56:57 +01:00
smallmodel
7fff3192a6
Fix server object mistakenly casted to int 2025-02-22 22:34:19 +01:00
smallmodel
83aa818c00
Don't add the same server twice 2025-02-22 22:24:19 +01:00
smallmodel
56d61bdef3
Implement support for parsing group rooms and master info 2025-02-22 22:13:23 +01:00
smallmodel
ebd86b32bd
Improve code clarity 2025-02-22 22:12:34 +01:00
smallmodel
08c718d232
Add support for server list encryption and tell the master server to return the server list encrypted 2025-02-22 20:39:10 +01:00
smallmodel
512831dea9
Properly unregister events from the level object
Some checks failed
Build branch / build-all (push) Failing after 18s
CodeQL / Analyze (push) Has been cancelled
Unregister() was mistakenly being called on the DM_Manager object when it should have been called on the level object, to unregister events like axiswin, allieswin, draw
2025-02-20 20:36:19 +01:00
smallmodel
a36bbb0cda
Remove useless qr fields
Some checks failed
Build branch / build-all (push) Failing after 39s
CodeQL / Analyze (push) Has been cancelled
2025-02-19 20:39:56 +01:00
smallmodel
8a9e0f0b01
Update master server address
It's now using master.openmohaa.org, which provides more flexibility for configuring the domain
2025-02-19 20:39:44 +01:00
smallmodel
076fd69131
Use the engine allocator to allocate/delete memory from the table of pointers 2025-02-19 20:11:07 +01:00
smallmodel
587f7f544e
Add REF_DLL for mem_blockalloc 2025-02-19 20:03:23 +01:00
smallmodel
178c486b83
Use NewEntry/DeleteEntry like con_set 2025-02-19 18:16:53 +01:00
smallmodel
ad1748b8be
Fix memory leaks (#668)
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
2025-02-18 23:27:43 +01:00
smallmodel
004f88dae9
Use a better method for storing class lists
This prevents allocating a ClassDef just to act as a root list. The classlist would never be freed (memory leak)
2025-02-18 22:39:52 +01:00
smallmodel
97fe824b80
Clear subtitles for all nodes when deleting the alias list 2025-02-18 22:35:48 +01:00
smallmodel
758176dd32
Delete the waitTillSet when destroying the class 2025-02-18 21:52:35 +01:00
smallmodel
854c1980cc
Make EventQueueNode part of LightClass 2025-02-18 21:46:34 +01:00
smallmodel
840002b63a
Save and restore bots when needed
When the map was changing, it allocated an array of saved bots which would never be used due to the game module being freed, it caused a memory leaka
2025-02-18 21:35:23 +01:00
smallmodel
47a447dbb0
Remove all state scripts that were created
This fixes a memory leak that also occurs in the original game
2025-02-18 21:08:44 +01:00
smallmodel
a1d47cf64a
Add placement new/placement delete 2025-02-18 20:54:24 +01:00
smallmodel
a5bb4c1874
Free up debug strings when deallocating game-data
This fixes a memory leak, which also occurs in the original game
2025-02-18 20:43:03 +01:00
smallmodel
22b593215f
Implement stop, threadmove and moveoffset
Some checks failed
Build branch / build-all (push) Failing after 24s
CodeQL / Analyze (push) Has been cancelled
2025-02-15 14:39:54 +01:00
smallmodel
68181acec7
Implement Stop() 2025-02-15 14:39:39 +01:00
smallmodel
3af35fa610
Correctly parse the function name in ScriptDeprecatedAlt
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
2025-02-15 00:51:19 +01:00
smallmodel
2c12d4f2de
Add a newline to ScriptDeprecatedAlt functions 2025-02-15 00:46:24 +01:00
smallmodel
bbac9c559c
Escape variable name 2025-02-14 23:54:15 +01:00
smallmodel
03eaa62902
Merge pull request #666 from ysdragon/fix-openbsd-compilation
Some checks failed
Build branch / build-all (push) Failing after 14s
CodeQL / Analyze (push) Has been cancelled
Fix compilation under OpenBSD
2025-02-08 23:33:58 +01:00
smallmodel
dcca5ed469
Merge branch 'ladder_getters' 2025-02-08 22:23:00 +01:00
smallmodel
2aa46f5a52
Add getters to get facing dir and angles for FuncLadder 2025-02-08 22:22:53 +01:00
smallmodel
ff3c27ab20
Fix assertion when the height is identical between vert0 and vert1 2025-02-08 20:28:46 +01:00
ysdragon
833408c663
Don't link against rt for musl and *BSD platforms 2025-02-08 04:03:24 +02:00
ysdragon
38d9f98221
Update gsPlatformThread.h to include pthread for OpenBSD 2025-02-08 03:49:24 +02:00
smallmodel
ac4b4266b4
Merge pull request #663 from richardradics/resolve-127-gamespy-deprecated-dialog
Some checks failed
Build branch / build-all (push) Failing after 14s
CodeQL / Analyze (push) Has been cancelled
feat: add GameSpy service unavailable dialog
2025-02-06 23:05:59 +01:00
smallmodel
b90bbd9dcf
Format document 2025-02-06 22:56:49 +01:00
smallmodel
e8f69e197c
Initialize variables from the class 2025-02-06 22:56:24 +01:00
smallmodel
9922a7095b
Activate the control and connect dialog's W_Deactivated after its creation
As the control is activated before, the connection should be done after the activation because ActivateControl() sends W_Activated to the UIFloatingWindow, which will cause ActivateControl() to be called again to activate the dialog's title bar button (and would deactivate the gamespy dialog)
2025-02-06 22:50:21 +01:00
smallmodel
3c836144e2
Move widget object creation from the constructor to FrameInitialized() 2025-02-06 22:41:50 +01:00
smallmodel
8c4a593fb0
Merge branch 'resolve-127-gamespy-deprecated-dialog' of https://github.com/richardradics/openmohaa into richardradics-resolve-127-gamespy-deprecated-dialog 2025-02-06 22:27:23 +01:00
smallmodel
0e282833e6
Merge pull request #665 from bulldozerecske/main
Updated FAQ
2025-02-06 22:19:26 +01:00
Bulldozer
54753caf94
Updated FAQ
Added 1 new FAQ and refined format.
2025-02-06 21:24:44 +01:00
Richard Radics
fcba3bed95 feat: add GameSpy service unavailable dialog
resolves #127
2025-02-05 23:12:05 +01:00
smallmodel
d348ac66de
Merge pull request #662 from richardradics/fix-545-loadgame-elapsed-logged
Some checks failed
Build branch / build-all (push) Failing after 14s
CodeQL / Analyze (push) Has been cancelled
fix: fix elapsed time and logged date in loadgame ui
2025-02-04 23:45:15 +01:00
Richard Radics
fd4f5e7d51 fix: fix elapsed time and logged date in loadgame ui
fixes #545
2025-02-04 22:14:52 +01:00
smallmodel
c77fcd2cbc
Clear the edict model when freeing the edict
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 15s
This fixes an issue where configstrings or game state chars would overflow when many models (such as actors with random headmodels/headskins) are spawned
2025-02-04 21:28:37 +01:00
smallmodel
ee385abfef
Update links to third-party libraries 2025-02-04 18:52:46 +01:00
smallmodel
49335ba8a8
Fix improper check of dir->path empty string
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 14s
2025-02-04 00:08:37 +01:00
smallmodel
8ac186ce17
Mark Archive() as override 2025-02-04 00:08:16 +01:00
smallmodel
ca2322a4da
Add recursive check in Com_Printf
This prevents recursive call to Com_Printf during localization and also remove localization errors
2025-02-04 00:03:30 +01:00
smallmodel
a1e7afac76
Prevent using a trick to spoof another name in 1.11 and below 2025-02-03 23:51:40 +01:00
smallmodel
2f75092d8b
Reserve console name for DMMessage 2025-02-03 23:42:38 +01:00
smallmodel
6f9e710ec9
Update events documentation
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 15s
2025-02-03 22:12:35 +01:00
smallmodel
0b12d160bb
Properly construct all objects that has been allocated with AddObjectAt() 2025-02-03 21:28:13 +01:00
smallmodel
330b45a1ed
Fix container object list not constructed when loading 2025-02-03 21:27:44 +01:00
smallmodel
5f0a0d0363
Update events documentation 2025-02-03 20:57:07 +01:00
smallmodel
ad01c2d966
Fix wrong flags getting checked for allowed weapons 2025-02-03 20:43:03 +01:00
smallmodel
fb5ed82401
Add events documentation 2025-02-03 20:24:35 +01:00
smallmodel
eaa7f10b36
Remove useless print 2025-02-03 20:24:26 +01:00
smallmodel
f2c8dbe57a
Merge pull request #661 from bulldozerecske/main
Updated FAQ
2025-02-03 20:05:24 +01:00
Bulldozer
447b0459aa
Merge branch 'openmoh:main' into main 2025-02-03 19:56:11 +01:00
Bulldozer
e31c64e42e
Updated FAQ
Added 2 additional issues and changed the layout.
2025-02-03 19:55:20 +01:00
smallmodel
32411b2a90
Rename player_damage to player_damaged.
The name was ambiguous. The delegate is triggered when the player gets hit (getting damaged), and not when the player damages someone else. The name properly matches the action.
2025-02-03 19:35:04 +01:00
smallmodel
32f850556e
Set the self object when triggering the delegate 2025-02-03 19:33:41 +01:00
smallmodel
fd94f53e25
Add a delegate for player text messages
self = the player who sent the message
first parameter = the text
second parameter = is team message?
2025-02-03 19:32:14 +01:00
smallmodel
4aa7e06a56
Make ev optional for Trigger() 2025-02-03 19:23:54 +01:00
smallmodel
033b76af14
Allow the self object to be specified 2025-02-03 19:22:29 +01:00
smallmodel
e37a5f4d06
Add "isBot" to check whether or not the player is a bot
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 14s
2025-02-02 21:02:06 +01:00
smallmodel
58e12e0141
Reset delegates on restart 2025-02-02 19:35:01 +01:00
smallmodel
147678b0f0
Merge pull request #660 from smallmodel/scriptdelegate
Implement and use delegates
2025-02-02 19:28:14 +01:00
smallmodel
e6cbd00871
Add script delegates matching common scripted events 2025-02-02 19:18:55 +01:00
smallmodel
1eb7458af9
Add event_subscribe and event_unsubscribe scripting commands 2025-02-02 19:14:07 +01:00
smallmodel
38cf5b82b2
Copy the list of registered delegates to execute them 2025-02-02 17:07:03 +01:00
smallmodel
a5c59c4b77
Use maxDataSize when copying Event 2025-02-02 16:50:07 +01:00
smallmodel
d190cc6e40
Use SafeAddFirst 2025-02-02 16:35:27 +01:00
smallmodel
8234ce1e5f
Add pragma once 2025-02-02 16:20:14 +01:00
smallmodel
e962e4e1f5
Use an int instead of a size_t 2025-02-02 16:03:40 +01:00
smallmodel
ee970a3fce
Remove PlayerBot class and use delegates instead 2025-02-02 16:02:56 +01:00
smallmodel
9242faaa49
Add delegate for stufftext 2025-02-02 16:02:22 +01:00
smallmodel
b813f7ee56
Add delegates related for kill/damage 2025-02-02 16:02:11 +01:00
smallmodel
7f64ef05d5
Mark Event getter methods as const 2025-02-02 16:01:41 +01:00
smallmodel
9cb593c9e4
Add support for event subscription (delegates) 2025-02-02 15:58:04 +01:00
smallmodel
cfb343d262
Add str move constructor/assignment
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 13s
2025-02-01 15:52:58 +01:00
smallmodel
9c811c2318
Mark getter methods as const for ScriptThreadLabel 2025-02-01 15:46:08 +01:00
smallmodel
7b97ad6e2f
Add move constructor for ContainerClass and refactor it
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 23s
2025-01-31 22:53:31 +01:00
smallmodel
fdea2a2e92
Free the object list when moving the container 2025-01-31 22:46:35 +01:00
smallmodel
aa0085b57d
Improve the Container class by using move constructor on reallocation when possible
This greatly optimize memory and speed by moving objects instead of copying objects
2025-01-31 22:38:00 +01:00
smallmodel
3fa489c0f9
Add move constructor for SafePtr 2025-01-31 22:22:00 +01:00
smallmodel
fbee409f47
Swap code with event pointer 2025-01-31 20:49:44 +01:00
smallmodel
7a8aa4eb84
Add placement new/delete for LightClass 2025-01-31 20:45:18 +01:00
smallmodel
d4bbaa41c3
Format safeptr source file 2025-01-31 20:45:11 +01:00
smallmodel
bb23fe159f
Fix copy constructor not using a const object 2025-01-31 20:27:37 +01:00
smallmodel
b1a02389f6
Define REF_DLL 2025-01-31 20:22:03 +01:00
smallmodel
f10ddcaa17
Update bot documentation 2025-01-31 20:21:56 +01:00
smallmodel
77f0ce0673
Merge pull request #658 from bulldozerecske/patch-2
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 17s
Create Frequently Asked Questions (FAQ)
2025-01-30 21:18:39 +01:00
smallmodel
7fc486757d
Merge branch 'main' into bulldozerecske-patch-2 2025-01-30 21:06:50 +01:00
smallmodel
dfc3fdb88b
Link to the FAQ 2025-01-30 21:05:02 +01:00
smallmodel
3769bd2a68
Translate instant messages when printing to console
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
2025-01-29 20:00:55 +01:00
Bulldozer
80d1b3b204
Create Frequently Asked Questions (FAQ)
This document will be suitable for answering issues that have user-related solutions.
2025-01-29 10:12:09 +01:00
smallmodel
e66fd28831
Fix incompatible functions in renderergl2
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 17s
2025-01-28 21:52:58 +01:00
smallmodel
1cabf5c31e
Merge pull request #657 from smallmodel/bulletholes_fix
Bulletholes fix
2025-01-28 20:26:43 +01:00
smallmodel
8341f8cb6a
Fix bullet hole sometimes not playing 2025-01-28 20:24:14 +01:00
smallmodel
1fc36fce9b
Fix multiple bullet hole effects unnecessarily spawning 2025-01-28 20:03:02 +01:00
smallmodel
33dbb07559
Export game name and shortversion as information clients/servers can see 2025-01-28 19:30:17 +01:00
smallmodel
e510c50a24
Set minimum and maximum for effect variables
Some checks failed
Build branch / build-all (push) Failing after 1m39s
CodeQL / Analyze (push) Has been cancelled
2025-01-27 00:44:17 +01:00
smallmodel
c345035e12
Add Cvar_CheckRange exports 2025-01-27 00:13:01 +01:00
smallmodel
9bb4789b32
Add terrain flags
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 18s
2025-01-25 16:40:41 +01:00
smallmodel
7e26814cfa
Use a signed integer to display the score
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 18s
2025-01-24 21:39:09 +01:00
smallmodel
33855cfbee
Implement add, subtract, scale, append and bitset
Some checks failed
Build branch / build-all (push) Failing after 17s
CodeQL / Analyze (push) Has been cancelled
2025-01-23 01:09:33 +01:00
smallmodel
98bb3e0366
Fix Com_SanitizeName infinite loop 2025-01-23 01:09:18 +01:00
smallmodel
52744fb784
Whitelist cg_3rd_person 2025-01-22 21:35:27 +01:00
smallmodel
08e5208835
Add "append" as allowed command 2025-01-22 21:35:09 +01:00
smallmodel
187079842f
Add cg_cheats to check if cheats are enabled 2025-01-22 21:26:29 +01:00
smallmodel
ef2c5d2df6
Check and verify that selected player models are valid
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
If the player model or the player german model is not valid, they will be reset to the default value. If the server doesn't have one or more of these models, force model feature will not work
2025-01-22 20:52:05 +01:00
smallmodel
92a0a9c197
Cache all models inside the models/player directory
Some player models are missing from precache scripts. This caches all models inside the player directory to avoid a short hitch when a player spawns with a non-cached model
2025-01-22 20:29:27 +01:00
smallmodel
90e46f535c
Add a random number next to the default name
Some checks failed
Build branch / build-all (push) Failing after 17s
CodeQL / Analyze (push) Has been cancelled
2025-01-21 23:26:21 +01:00
smallmodel
02fc573e31
Apply client and server config tweaks when loading the original config 2025-01-21 22:56:05 +01:00
smallmodel
b8c7223da7
Allow "name" to be changed by server
Players often get their name changed due to them having an empty or duplicate name
2025-01-21 22:55:00 +01:00
smallmodel
7b53e25dd5
Set the default rate to 25000 (xDSL) 2025-01-21 22:08:54 +01:00
smallmodel
f8f9d2f65c
Use MAX_PATHNODES rather than a constant number 2025-01-21 20:56:26 +01:00
smallmodel
19e12701f3
Fix HUD scaling for spectator text, and vote text on 4K 2025-01-21 20:15:43 +01:00
smallmodel
24c7311162
Also save the valid ground trace when stepping
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 45s
2025-01-20 22:33:14 +01:00
smallmodel
599914934c
Update documentation 2025-01-20 12:17:48 +01:00
smallmodel
8fdc66d138
Allow axis players to select kar98 sniper on 2.0 and above by choosing german panzer skins
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 18s
2025-01-19 19:16:28 +01:00
smallmodel
83caae7586
Fix terrain tessellation when there is insufficient tris in renderergl2 2025-01-19 17:32:14 +01:00
smallmodel
1f599e62c6
Clear numLightmaps in renderergl2 2025-01-19 17:31:50 +01:00
smallmodel
4e174fd5bf
Fix cheats mistakenly being disabled when loading a saved game, when developer mode is enabled
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 21s
2025-01-19 16:08:28 +01:00
smallmodel
edf3560dd5
Don't load lightmaps on on Permedia 2 2025-01-19 15:21:11 +01:00
smallmodel
7452bf39fb
Always initialize numLightmaps when loading lightmaps
This fixes an issue where the number of lightmaps is kept from the previous map if the new map has no lightmaps
2025-01-19 15:19:27 +01:00
smallmodel
c2bac6d1ef
Prevent lightmapIndex from going below LIGHTMAP_2D 2025-01-19 15:16:35 +01:00
smallmodel
47cd8ccfc8
Force vertex light when using permedia 2 2025-01-19 15:07:50 +01:00
smallmodel
ec6cab28a5
Don't apply kick fireback on older versions of the game
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 15s
2025-01-19 14:45:20 +01:00
smallmodel
45de1067bd
Fix localtime_r parameter
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 14s
2025-01-19 01:41:26 +01:00
smallmodel
7ab04b0bcb
Fix IsEntity() and SimpleEntity() improperly returning true when the listener is NULL
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 15s
2025-01-18 15:43:20 +01:00
smallmodel
1a71d44b43
Safely check if other is NULL when triggering
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 17s
2025-01-18 13:23:30 +01:00
smallmodel
1ea273fba0
Clear the top stack result when self is NULL 2025-01-18 13:02:05 +01:00
smallmodel
591be6c2fd
Create a new node if the load index is outside the node count
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
2025-01-17 21:49:17 +01:00
smallmodel
6b02457190
Properly correct the opcode in OP_LOAD_STORE_SELF_VAR when self is NULL 2025-01-17 16:49:38 +01:00
smallmodel
87e5b6d41e
Clear the top variable when the event is not valid too 2025-01-17 16:21:13 +01:00
smallmodel
7f0c506fea
Add a comment about the spawn behavior in OG
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 22s
2025-01-16 23:59:04 +01:00
smallmodel
539c2df378
Check for valid event on listener and print an error if the command cannot be executed 2025-01-16 23:25:26 +01:00
smallmodel
4399e2ab31
Merge pull request #634 from smallmodel/bot_player_association_rework
Bot player association rework
2025-01-16 22:29:05 +01:00
smallmodel
210eeff481
Remove controllers that don't have an associated entity
This prevents crashes when the entity was removed (potentially by a mod)
2025-01-16 22:28:37 +01:00
smallmodel
95e72dd339
Use the number of controllers to get the number of spawned bots 2025-01-16 22:27:51 +01:00
smallmodel
a6d9369204
Remove DM player in destructor rather than in a manual function call 2025-01-16 22:17:14 +01:00
smallmodel
ab80045329
Properly check if the number of tris is sufficient for tessellation
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 18s
2025-01-15 21:38:49 +01:00
smallmodel
94aaeac194
Check for the vehicle owner
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 19s
2025-01-15 20:16:58 +01:00
smallmodel
4bec5cef01
Reduce telefrag bounds 2025-01-15 18:42:34 +01:00
smallmodel
1500d213e7
Fix wrong pointer being deleted 2025-01-15 18:29:56 +01:00
smallmodel
2dbe61789d
Don't use the target list if the world is NULL 2025-01-15 18:29:35 +01:00
smallmodel
3f9bed938e
Fix NULL string checking 2025-01-15 18:03:37 +01:00
smallmodel
619d27da81
Add getentity 2025-01-15 18:00:04 +01:00
smallmodel
bfd0f6e744
Fix the platform dependant compile error
Some checks failed
Build branch / build-all (push) Failing after 18s
CodeQL / Analyze (push) Has been cancelled
2025-01-14 00:08:34 +01:00
smallmodel
6d71cabbda
Export FS_FOpenFile 2025-01-13 23:22:33 +01:00
smallmodel
317664f88c
Throw an error if the player is dead in EndLevel() 2025-01-13 20:51:28 +01:00
smallmodel
e7cddd47a5
Fix incorrect map name and spawnpoint when a spawnpoint ('$') is specified, causing crash 2025-01-13 20:45:53 +01:00
smallmodel
393dfae33e
Give starting ammo at the next frame 2025-01-13 20:27:07 +01:00
DraGoN
c69ea0e4d8
Fixed parameter order in localtime_rand gmtime_r for FreeBSD, OpenBSD, and NetBSD
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
2025-01-13 19:21:56 +01:00
smallmodel
59fdcf0ae9
Add debian 11 and 12
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 18s
2025-01-12 20:29:53 +01:00
smallmodel
f22ea9eb21
Link against rt
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 21s
2025-01-11 23:50:33 +01:00
smallmodel
752588ffcd
Update OpenAL to version 1.24.2 2025-01-11 16:35:02 +01:00
smallmodel
a0f6d7d361
Initialize met_comment to false 2025-01-11 15:20:41 +01:00
smallmodel
1b5232c2d0
Fix compile errors
Some checks failed
Build branch / build-all (push) Failing after 18s
CodeQL / Analyze (push) Has been cancelled
2025-01-09 23:17:39 +01:00
smallmodel
089e68e85e
Add a cvar to opt out for logfile timestamps 2025-01-09 23:08:15 +01:00
smallmodel
a9ec7cff4f
Write the time before each message printed in the logfile 2025-01-09 22:23:02 +01:00
smallmodel
63c2b3642c
Print the version when opening the logfile 2025-01-09 21:42:12 +01:00
smallmodel
5e04124211
Fix accuracy being 0.0 in the stats screen 2025-01-09 21:30:40 +01:00
smallmodel
bbfd4ac280
Bump version number 2025-01-09 20:38:18 +01:00
smallmodel
28fd0ba201
Use spline as the default source resampler for OpenAL
This makes sounds feel stronger, the spline resampler has slightly louder high frequencies
2025-01-09 20:36:15 +01:00
smallmodel
305c026f4e
Import alGetStringiSOFT 2025-01-09 20:29:30 +01:00
smallmodel
b836042a02
Merge pull request #614 from smallmodel/localization_fix
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 1m39s
Localization fix
2025-01-08 22:53:44 +01:00
smallmodel
ec95b6bfbe
Fix localization not working properly 2025-01-08 22:52:47 +01:00
smallmodel
6049ecfc6e
Localize dmbox and gmbox 2025-01-08 21:26:47 +01:00
smallmodel
6a31381c8e
Format localization source files 2025-01-08 21:26:41 +01:00
smallmodel
7f8bcf8075
Don't read localization.txt file twice 2025-01-08 21:07:13 +01:00
smallmodel
b84a47ad3f
Localization files should be sorted case-insensitive 2025-01-08 21:04:09 +01:00
smallmodel
f91d0c1693
Add missing EV_CanSeeNoEnts
The `canseenoents` was accidentally missing from the Entity's response list, some scripts rely on it
2025-01-08 20:52:24 +01:00
smallmodel
cd65424b00
Fix an infinite loop when setting up path for Vehicle 2025-01-08 20:32:34 +01:00
smallmodel
944e0f24ae
Merge pull request #606 from ysdragon/freebsd-support
FreeBSD support
2025-01-08 19:07:32 +01:00
smallmodel
d396a45e64
Annoying MSVC focus mistake 2025-01-08 18:55:54 +01:00
smallmodel
c0d5ebaaf3
Merge branch 'main' into freebsd-support 2025-01-08 18:55:50 +01:00
smallmodel
c3b42cc297
Merge branch 'main' into freebsd-support 2025-01-08 18:50:34 +01:00
smallmodel
4f32d436bb
Disable OpenAL limiter 2025-01-08 18:45:05 +01:00
smallmodel
4268a875fa
Revert commit b95241dcfe 2025-01-08 17:56:44 +01:00
ysdragon
2ec2ef8bbf
Update sys CMake configuration to link execinfo for BSD variants 2025-01-08 11:27:09 +02:00
ysdragon
7ba29029e1
Add support for additional BSD platforms in platform detection 2025-01-08 11:26:54 +02:00
smallmodel
bbdbe62930
Let SetOwner() assign the edict's ownerNum
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 15s
2025-01-07 21:41:49 +01:00
smallmodel
b95241dcfe
Rotate audio listener by +90 degrees forward
This fixes wrong spatialization of 3D sources with HRTF
2025-01-07 20:49:25 +01:00
smallmodel
8cc1cd6f2c
Install audio libraries for CodeQL
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 17s
2025-01-07 01:19:20 +01:00
smallmodel
f7947b3fe3
Add playerbot_strategy source files 2025-01-07 01:03:35 +01:00
smallmodel
4c06dd7107
Make UColor constant 2025-01-07 00:40:11 +01:00
smallmodel
d6db83805d
Make chat message colors brighter 2025-01-07 00:39:45 +01:00
smallmodel
25f4d0199d
Use const UColor pointer 2025-01-07 00:32:03 +01:00
smallmodel
3bcd5cf308
Add UColor copy constructor 2025-01-07 00:26:40 +01:00
smallmodel
ce38cf9040
Add missing newline for the health pickup message 2025-01-07 00:09:44 +01:00
smallmodel
adc2704da0
Improve code clarity 2025-01-07 00:09:28 +01:00
smallmodel
f999d87f68
Set the subtitle regardless of g_subtitle if the alias indicate it's forced
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 1m12s
2025-01-06 13:37:19 +01:00
smallmodel
7f8446ab82
If random alias name is NULL, use one from global aliases 2025-01-06 13:32:50 +01:00
smallmodel
4d2b61a766
Server-side subtitles must only work on single-player mode 2025-01-06 13:29:12 +01:00
smallmodel
1f3661238a
Check for valid player 0 before setting subtitle 2025-01-06 13:26:29 +01:00
smallmodel
5f236d4d42
Fix projectiles having an unassigned weapon owner
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 1m43s
This fixes weapons that shoot projectiles not being taken into account for being the preferred weapon
2025-01-05 23:57:08 +01:00
smallmodel
8fb3856ea6
Add a centerprint message when joining a team that is full 2025-01-05 20:19:52 +01:00
smallmodel
418985f90b
Fix animation not looping in the same state 2025-01-05 20:02:50 +01:00
smallmodel
2c738fa28e
Fix occasional errors related to SV_FindIndex
Some maps (and mods) declare many sounds, sounds with the same name would be present more than once because the case was taken into account
2025-01-05 19:54:32 +01:00
smallmodel
8a8ac2e3d1
Fix newline in win message 2025-01-05 18:36:45 +01:00
smallmodel
cf65fd890d
Fix incorrect number of wins in the scoreboard 2025-01-05 18:20:00 +01:00
smallmodel
6a86fc8067
Fix num voters when calling vote 2025-01-05 17:50:06 +01:00
smallmodel
528039f80b
Don't sanitize semicolon 2025-01-05 17:49:27 +01:00
smallmodel
b5875ae890
Allow the same torso animation to play again
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 15s
This allows replaying the same torso animation, like when activating a new weapon of the same weapon class
2025-01-05 02:29:02 +01:00
smallmodel
8801834804
Don't restart the legs animation from the beginning in the same state
This prevent walking silently by switching weapons indefinitely
2025-01-05 02:20:59 +01:00
smallmodel
a14a2c9684
Fix inconsistent torso animation cross-blending 2025-01-05 02:10:01 +01:00
smallmodel
269e73168e
Fix an issue where animations (legs) would not loop 2025-01-05 02:00:49 +01:00
smallmodel
19eec6305b
Use "idle" anim when in noclip mode 2025-01-04 21:15:32 +01:00
smallmodel
9930d50f99
Fix inconsistent player animation debug print 2025-01-04 20:37:15 +01:00
smallmodel
9427137dbd
Properly increment the packet number before sending the gamespy reply
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 32s
Some programs parse the packet number and stop working properly if the packet number is an incorrect value
2025-01-04 19:43:47 +01:00
smallmodel
c10fd17d19
Bump patch number 2025-01-04 18:01:52 +01:00
smallmodel
3c26b98b65
Generate checksum with noncompat protocol 2025-01-04 17:55:33 +01:00
smallmodel
6e357459e6
Fix fragments being sent too fast
This prevented players with low connection speed unable to connect due to UDP packets being lost. The rate of connecting clients will be properly taken into account
2025-01-04 17:55:11 +01:00
smallmodel
fe42511c54
Changed the color of UIListBox elements
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 16s
2025-01-03 22:08:59 +01:00
smallmodel
32f507ce15
Fix pulldown menu container using the wrong foreground color 2025-01-03 22:08:26 +01:00
211 changed files with 36088 additions and 5727 deletions

View file

@ -47,6 +47,12 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required packages
with:
packages: libopenal-dev libpulse-dev portaudio19-dev libasound2-dev libjack-dev libpipewire-0.3-dev qtbase5-dev libdbus-1-dev
version: "0.1"
# Setup SDL # Setup SDL
- name: Set up SDL - name: Set up SDL
id: sdl id: sdl

246
.github/workflows/shared-build-linux.yml vendored Normal file
View file

@ -0,0 +1,246 @@
##########################
#
# Linux
# Ubuntu 22.04
#
# Using this version instead of 24.04 to use a lower GLIBC version (2.34).
# ARM is used for more efficiency, and x64 is used for legacy architectures like PowerPC.
##########################
name: Linux build workflow
on:
workflow_call:
inputs:
environment:
required: true
type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs:
build:
strategy:
matrix:
architecture: [
{name: 'amd64', os: "ubuntu-22.04-arm", package: 'x86-64-linux-gnu', triple: 'x86_64-linux-gnu', arch_option: 'linux-x86_64'},
{name: 'i686', os: "ubuntu-22.04-arm", package: 'i686-linux-gnu', triple: 'i686-linux-gnu', arch_option: 'linux-x86'},
{name: 'arm64', os: "ubuntu-22.04-arm", package: 'aarch64-linux-gnu', triple: 'aarch64-linux-gnu', arch_option: 'linux-aarch64'},
{name: 'armhf', os: "ubuntu-22.04-arm", package: 'arm-linux-gnueabihf', triple: 'arm-linux-gnueabihf', arch_option: 'linux-armv4'},
{name: 'powerpc', os: "ubuntu-22.04", package: 'powerpc-linux-gnu', triple: 'powerpc-linux-gnu', arch_option: 'linux-ppc'},
{name: 'ppc64', os: "ubuntu-22.04", package: 'powerpc64-linux-gnu', triple: 'powerpc64-linux-gnu', arch_option: 'linux-ppc64'},
{name: 'ppc64el', os: "ubuntu-22.04-arm", package: 'powerpc64le-linux-gnu', triple: 'powerpc64le-linux-gnu', arch_option: 'linux-ppc64le'}
]
name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: ${{ matrix.architecture.os }}
environment: ${{ inputs.environment }}
env:
wolfssl-version: 'v5.7.6-stable'
curl-version: '8_12_1'
openal-soft-branch: '1.24.3'
steps:
###
# Packages
###
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required packages
with:
packages: flex bison ninja-build cmake clang libpulse-dev portaudio19-dev libasound2-dev libjack-dev libpipewire-0.3-dev qtbase5-dev libdbus-1-dev
version: "${{ runner.os }}-${{ runner.arch }}-v1"
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "HOST_TRIPLE=$(gcc -dumpmachine)" >> $GITHUB_ENV
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required cross-platform packages (${{ matrix.architecture.package }})
if: env.HOST_TRIPLE != matrix.architecture.triple
with:
packages: gcc-12-${{ matrix.architecture.package }} g++-12-${{ matrix.architecture.package }}
version: "${{ runner.os }}-${{ runner.arch }}-v1"
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "CFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
echo "CXXFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
# Workaround for when changing the runner OS version
cmake-arguments: "-DCACHE_OS_VERSION=Ubuntu_22.04"
###
# OpenAL
###
- name: Cache OpenAL
id: cache-openal-soft
uses: actions/cache@v4
with:
path: 'thirdparties/soft-oal/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-openal-soft-${{ env.openal-soft-branch }}-v1
# soft-oal setup
- name: Checkout soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '${{ env.openal-soft-branch }}'
- name: Configure and install soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DALSOFT_UTILS=OFF \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# WolfSSL
###
- name: Cache WolfSSL
id: cache-wolfssl
uses: actions/cache@v4
with:
path: 'thirdparties/wolfssl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-wolfssl-${{ env.wolfssl-version }}-v1
# WolfSSL setup
- name: Checkout WolfSSL
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'wolfssl/wolfssl'
path: 'thirdparties/wolfssl'
ref: '${{ env.wolfssl-version }}'
# WolfSSL build
- name: Configure and install wolfssl
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/wolfssl
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/wolfssl/install' \
-DCMAKE_C_FLAGS="$CFLAGS -fPIC" \
-DCMAKE_CXX_FLAGS="$CFLAGS -fPIC" \
-DBUILD_SHARED_LIBS=OFF -DWOLFSSL_OPENSSLEXTRA=ON -DWOLFSSL_ASM=OFF -DWOLFSSL_EXAMPLES=OFF -DWOLFSSL_CURL=ON
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# cURL
###
- name: Cache cURL
id: cache-curl
uses: actions/cache@v4
with:
path: 'thirdparties/curl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-curl-${{ env.curl-version }}-v1
# cURL setup
- name: Checkout cURL
if: steps.cache-curl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'curl/curl'
path: 'thirdparties/curl'
ref: 'curl-${{ env.curl-version }}'
# cURL build
- name: Configure and install curl
if: steps.cache-curl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/curl
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/curl/install' \
-DCURL_USE_LIBPSL=OFF \
-DCURL_USE_WOLFSSL=ON \
-DCURL_ZLIB="" \
-DCURL_BROTLI="" \
-DCURL_ZSTD="" \
-DCMAKE_SHARED_LINKER_FLAGS="-lm" \
-DWolfSSL_ROOT='${{github.workspace}}/thirdparties/wolfssl/install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include' \
-DCURL_ROOT='${{github.workspace}}/thirdparties/curl/install' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Copy libraries
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.so.0 '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.so.1 '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/curl/install/lib*/libcurl.so.4 '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-linux-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package

239
.github/workflows/shared-build-macos.yml vendored Normal file
View file

@ -0,0 +1,239 @@
##########################
#
# Apple macOS
# macOS 15
#
# This version is used as the OS, as it's faster than other versions.
##########################
name: MacOS build workflow
on:
workflow_call:
inputs:
environment:
required: true
type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs:
build:
strategy:
matrix:
architecture: [
#{name: 'x86_64', triple: 'x86_64-apple-macos10.8'},
#{name: 'arm64', triple: 'arm64-apple-macos11'}
#{name: 'x86_64', build_name: 'x86_64'},
#{name: 'arm64', build_name: 'arm64'},
# Compile into an universal binary
{name: 'multiarch(arm64-x86_64)', build_name: 'arm64;x86_64' }
]
name: "Building for platform macos-${{matrix.architecture.name}}"
runs-on: "macos-15"
env:
openal-soft-branch: '1.24.3'
wolfssl-version: 'v5.7.6-stable'
curl-version: '8_12_1'
steps:
###
# Packages
###
- name: Install required packages
run: |
brew install git flex bison ninja cmake llvm perl
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
cmake-arguments: "-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}'
-DCMAKE_VERBOSE_MAKEFILE=on"
###
# OpenAL
###
- name: Cache OpenAL
id: cache-openal-soft
uses: actions/cache@v4
with:
path: 'thirdparties/soft-oal/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-openal-soft-${{ env.openal-soft-branch }}-v1
# soft-oal setup
# Use GCC instead of Clang because of missing SSE intrinsics
# It also doesn't enable altivec support on PowerPC by default
- name: Checkout soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '${{ env.openal-soft-branch }}'
# soft-oal build
- name: Configure and install soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DCMAKE_VERBOSE_MAKEFILE=on
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# WolfSSL
###
# FIXME: Figure out how to compile WolfSSL cross-architecture
#
# - name: Cache WolfSSL
# id: cache-wolfssl
# uses: actions/cache@v4
# with:
# path: 'thirdparties/wolfssl_install'
# key: ${{ runner.os }}-${{ matrix.architecture.name }}-wolfssl-${{ env.wolfssl-version }}-v1
#
# # WolfSSL setup
# - name: Checkout WolfSSL
# if: steps.cache-wolfssl.outputs.cache-hit != 'true'
# uses: actions/checkout@v4
# with:
# repository: 'wolfssl/wolfssl'
# path: 'thirdparties/wolfssl'
# ref: '${{ env.wolfssl-version }}'
#
# # WolfSSL build
# - name: Configure and install wolfssl
# if: steps.cache-wolfssl.outputs.cache-hit != 'true'
# working-directory: ${{github.workspace}}/thirdparties/wolfssl
# run: |
# cmake -B ./build \
# -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/wolfssl_install' \
# -DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
# -DBUILD_SHARED_LIBS=OFF -DWOLFSSL_OPENSSLEXTRA=ON -DWOLFSSL_ASM=OFF -DWOLFSSL_EXAMPLES=OFF -DWOLFSSL_CURL=ON
# cmake --build ./build --config Release --parallel
# cmake --install ./build --config Release
###
# cURL
###
- name: Cache cURL
id: cache-curl
uses: actions/cache@v4
with:
path: 'thirdparties/curl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-curl-${{ env.curl-version }}-v1
# cURL setup
- name: Checkout cURL
if: steps.cache-curl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'curl/curl'
path: 'thirdparties/curl'
ref: 'curl-${{ env.curl-version }}'
# cURL build
- name: Configure and install curl
if: steps.cache-curl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/curl
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/curl/install' \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DCURL_USE_LIBPSL=OFF \
-DCURL_USE_WOLFSSL=OFF \
-DCURL_USE_LIBSSH2=OFF \
-DUSE_LIBIDN2=OFF \
-DUSE_NGHTTP2=OFF \
-DCURL_ENABLE_SSL=OFF \
-DCURL_ZLIB="" \
-DCURL_BROTLI="" \
-DCURL_ZSTD="" \
-DWolfSSL_ROOT='${{github.workspace}}/thirdparties/wolfssl_install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DCMAKE_VERBOSE_MAKEFILE=on \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal/install' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include/AL' \
-DCURL_ROOT='${{github.workspace}}/thirdparties/curl/install' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Create hard-link and copy symbolic links
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.0.dylib '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.1.dylib '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/curl/install/lib*/libcurl.4.dylib '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-macos-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package

View file

@ -0,0 +1,259 @@
##########################
#
# Microsoft Windows
# Windows Server 2025
#
##########################
name: Windows build workflow
on:
workflow_call:
inputs:
environment:
required: true
type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs:
build:
strategy:
matrix:
architecture: [
{name: 'x64', os: 'windows-2025', config: 'x64', toolset: 'x64', arch_option: 'VC-WIN64A' },
{name: 'x86', os: 'windows-2025', config: 'Win32', toolset: 'x64_x86', arch_option: 'VC-WIN32' },
{name: 'arm64', os: 'windows-11-arm', config: 'ARM64', toolset: 'x64_arm64', arch_option: 'VC-WIN64-ARM' }
]
name: "Building for platform windows-${{matrix.architecture.name}}"
runs-on: ${{ matrix.architecture.os }}
environment: ${{ inputs.environment }}
env:
flexbison-branch: 'v2.5.25'
wolfssl-version: 'v5.7.6-stable'
curl-version: '8_12_1'
openal-soft-branch: '1.24.3'
steps:
###
# Packages
###
- name: Cache Flex/Bison
id: cache-flexbison
uses: actions/cache@v4
with:
path: 'thirdparties/winflexbison-install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-flexbison-${{ env.flexbison-branch }}-v1
- name: Install Flex/Bison
if: steps.cache-flexbison.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}
run: |
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch ${{ env.flexbison-branch }} https://github.com/lexxmark/winflexbison.git
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
cmake --build winflexbison-build --config Release --parallel
cmake --install winflexbison-build --config Release
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $env:GITHUB_ENV
echo "CC=cl.exe" >> $env:GITHUB_ENV
echo "CXX=cl.exe" >> $env:GITHUB_ENV
pushd "$($env:PROGRAMFILES)\Microsoft Visual Studio\*\*\VC\Auxiliary\Build"
cmd /c "vcvarsall.bat ${{ matrix.architecture.toolset }} & set" | ForEach-Object {
if ($_ -match "=") {
# Split into key=value
$var = $_.split("=", 2);
echo "$($var[0])=$($var[1])" >> $env:GITHUB_ENV
}
}
popd
- name: Cache Required Packages
id: cache-required-packages
uses: actions/cache@v4
with:
path: 'C:\Packages'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-required-packages-v1
- name: Install required packages
if: steps.cache-required-packages.outputs.cache-hit != 'true'
run: |
$DownloadPath="$($env:USERPROFILE)\Downloads"
if ("${{ matrix.architecture.config }}" -ieq "ARM64") {
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-winarm64.zip" -OutFile "$DownloadPath\ninja-win.zip"
} else {
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip" -OutFile "$DownloadPath\ninja-win.zip"
}
Expand-Archive -Path "$DownloadPath\ninja-win.zip" -DestinationPath "C:\Packages\ninja"
Invoke-WebRequest "https://download.qt.io/official_releases/jom/jom.zip" -OutFile "$DownloadPath\jom.zip"
Expand-Archive -Path "$DownloadPath\jom.zip" -DestinationPath "C:\Packages\jom"
- name: Setup required packages path
run: |
$env:PATH += ";C:\Packages\ninja;C:\Packages\jom;"
echo "PATH=$($env:PATH)" >> $env:GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
cmake-arguments: ""
###
# OpenAL
###
- name: Cache OpenAL
id: cache-openal-soft
uses: actions/cache@v4
with:
path: 'thirdparties/soft-oal/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-openal-soft-${{ env.openal-soft-branch }}-v1
# soft-oal setup
- name: Checkout soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '${{ env.openal-soft-branch }}'
# soft-oal build
# Statically link the CRT runtime into OAL as a workaround to prevent crashes
- name: Configure and install soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' `
-DALSOFT_BUILD_ROUTER=OFF `
-DALSOFT_REQUIRE_WINMM=ON `
-DALSOFT_REQUIRE_DSOUND=ON `
-DALSOFT_REQUIRE_WASAPI=ON `
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_C_FLAGS_MINSIZEREL="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_MINSIZEREL="/MT /O1 /Ob1 /DNDEBUG" `
-DCMAKE_C_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG"
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
# Unfortunately soft-oal produces a binary called OpenAL32 even in 64-bit
if (("x64", "ARM64") -icontains "${{ matrix.architecture.config }}") { Rename-Item -Path '.\install\bin\OpenAL32.dll' -NewName 'OpenAL64.dll' }
###
# cURL
#
# Uses Schannel as SSL backend, native CAs are used
###
- name: Cache cURL
id: cache-curl
uses: actions/cache@v4
with:
path: 'thirdparties/curl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-curl-${{ env.curl-version }}-v1
# cURL setup
- name: Checkout cURL
if: steps.cache-curl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'curl/curl'
path: 'thirdparties/curl'
ref: 'curl-${{ env.curl-version }}'
# cURL build
- name: Configure and install curl
if: steps.cache-curl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/curl
run: |
cmake -B ./build `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/curl/install' `
-DCURL_USE_LIBPSL=OFF `
-DCURL_USE_SCHANNEL=ON
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM= `
--log-level=VERBOSE `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' `
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include' `
-DCURL_ROOT='${{github.workspace}}/thirdparties/curl/install' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
New-Item -ItemType Directory '${{github.workspace}}/package'
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/package'
Copy-Item '${{github.workspace}}/thirdparties/soft-oal/install/bin/*.dll' -Destination '${{github.workspace}}/package'
Copy-Item '${{github.workspace}}/thirdparties/curl/install/bin/*.dll' -Destination '${{github.workspace}}/package'
if (Test-Path ${{github.workspace}}/install/bin) { Copy-Item '${{github.workspace}}/install/bin/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
if (Test-Path ${{github.workspace}}/install/lib) { Copy-Item '${{github.workspace}}/install/lib/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
###
# Artifact
###
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}
if-no-files-found: error
path: |
${{github.workspace}}/package
!${{github.workspace}}/package/**/*.pdb
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}-pdb
if-no-files-found: error
path: |
${{github.workspace}}/package

View file

@ -7,468 +7,18 @@ on:
required: true required: true
type: string type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs: jobs:
##########################
#
# Linux
# Ubuntu 22.04
#
# Using this version instead of 24.04 to use a lower GLIBC version (2.34)
##########################
build-platform-linux: build-platform-linux:
strategy: uses: ./.github/workflows/shared-build-linux.yml
matrix: with:
architecture: [ environment: ${{inputs.environment}}
{name: 'amd64', triple: 'x86_64-linux-gnu'},
{name: 'i686', triple: 'i686-linux-gnu'},
{name: 'arm64', triple: 'aarch64-linux-gnu'},
{name: 'armhf', triple: 'arm-linux-gnueabihf'},
{name: 'powerpc', triple: 'powerpc-linux-gnu'},
{name: 'ppc64', triple: 'powerpc64-linux-gnu'},
{name: 'ppc64el', triple: 'powerpc64le-linux-gnu'}
]
name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: "ubuntu-22.04"
environment: ${{ inputs.environment }}
steps:
###
# Packages
###
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required packages
with:
packages: flex bison ninja-build cmake clang libpulse-dev portaudio19-dev libasound2-dev libjack-dev libpipewire-0.3-dev qtbase5-dev libdbus-1-dev
version: "0.1"
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required cross-platform packages (${{ matrix.architecture.triple }})
if: matrix.architecture.name != 'amd64'
with:
packages: gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
version: "0.1"
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "CFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
echo "CXXFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
# Workaround for when changing the runner OS version
cmake-arguments: "-DCACHE_OS_VERSION=Ubuntu_22.04"
###
# OpenAL
###
# soft-oal setup
- name: Checkout soft-oal
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '1.24.1'
- name: Configure and install soft-oal
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Copy libraries
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.so.0 '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.so.1 '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-linux-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package
##########################
#
# Microsoft Windows
# Windows Server 2022
#
##########################
build-platform-windows: build-platform-windows:
strategy: uses: ./.github/workflows/shared-build-windows.yml
matrix: with:
architecture: [ environment: ${{inputs.environment}}
{name: 'x64', config: 'x64', toolset: 'x64' },
{name: 'x86', config: 'Win32', toolset: 'x64_x86' },
{name: 'arm64', config: 'ARM64', toolset: 'x64_arm64' }
]
name: "Building for platform windows-${{matrix.architecture.name}}"
runs-on: "windows-2022"
environment: ${{ inputs.environment }}
steps:
###
# Packages
###
#
# Commented out for now, chocolatey servers started complaining about too many requests
#
#- name: Install required packages
# run: |
# choco install -y ninja
- name: Install required packages
run: |
$DownloadPath="$($env:USERPROFILE)\Downloads"
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip" -OutFile "$DownloadPath\ninja-win.zip"
Expand-Archive -Path "$DownloadPath\ninja-win.zip" -DestinationPath "$($env:PROGRAMFILES)\ninja"
echo "$($env:PROGRAMFILES)\ninja" >> $GITHUB_PATH
- name: Install Flex/Bison
working-directory: ${{github.workspace}}
run: |
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch v2.5.25 https://github.com/lexxmark/winflexbison.git
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
cmake --build winflexbison-build --config Release --parallel
cmake --install winflexbison-build --config Release
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $env:GITHUB_ENV
echo "CC=cl.exe" >> $env:GITHUB_ENV
echo "CXX=cl.exe" >> $env:GITHUB_ENV
pushd "$($env:PROGRAMFILES)\Microsoft Visual Studio\*\*\VC\Auxiliary\Build"
cmd /c "vcvarsall.bat ${{ matrix.architecture.toolset }} & set" | ForEach-Object {
if ($_ -match "=") {
# Split into key=value
$var = $_.split("=", 2);
echo "$($var[0])=$($var[1])" >> $env:GITHUB_ENV
}
}
popd
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
cmake-arguments: ""
###
# OpenAL
###
# soft-oal setup
- name: Checkout soft-oal
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '1.24.1'
# soft-oal build
# Statically link the CRT runtime into OAL as a workaround to prevent crashes
- name: Configure and install soft-oal
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' `
-DALSOFT_BUILD_ROUTER=OFF `
-DALSOFT_REQUIRE_WINMM=ON `
-DALSOFT_REQUIRE_DSOUND=ON `
-DALSOFT_REQUIRE_WASAPI=ON `
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_C_FLAGS_MINSIZEREL="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_MINSIZEREL="/MT /O1 /Ob1 /DNDEBUG" `
-DCMAKE_C_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG"
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
# Unfortunately soft-oal produces a binary called OpenAL32 even in 64-bit
if (("x64", "ARM64") -icontains "${{ matrix.architecture.config }}") { Rename-Item -Path '.\install\bin\OpenAL32.dll' -NewName 'OpenAL64.dll' }
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM= `
--log-level=VERBOSE `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' `
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
New-Item -ItemType Directory '${{github.workspace}}/package'
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/package'
Copy-Item '${{github.workspace}}/thirdparties/soft-oal/install/bin/*.dll' -Destination '${{github.workspace}}/package'
if (Test-Path ${{github.workspace}}/install/bin) { Copy-Item '${{github.workspace}}/install/bin/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
if (Test-Path ${{github.workspace}}/install/lib) { Copy-Item '${{github.workspace}}/install/lib/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
###
# Artifact
###
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}
if-no-files-found: error
path: |
${{github.workspace}}/package
!${{github.workspace}}/package/**/*.pdb
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}-pdb
if-no-files-found: error
path: |
${{github.workspace}}/package
##########################
#
# Apple macOS
# macOS 14
#
# This version is used as the OS, as older versions are slower.
##########################
build-platform-macos: build-platform-macos:
strategy: uses: ./.github/workflows/shared-build-macos.yml
matrix: with:
architecture: [ environment: ${{inputs.environment}}
#{name: 'x86_64', triple: 'x86_64-apple-macos10.8'},
#{name: 'arm64', triple: 'arm64-apple-macos11'}
#{name: 'x86_64', build_name: 'x86_64'},
#{name: 'arm64', build_name: 'arm64'},
# Compile into an universal binary
{name: 'multiarch(arm64-x86_64)', build_name: 'arm64;x86_64' }
]
name: "Building for platform macos-${{matrix.architecture.name}}"
runs-on: "macos-15"
environment: ${{inputs.environment}}
steps:
###
# Packages
###
# Install required packages
# Paths on x86_64 and ARM64 are different for homebrew
- name: Install required packages
run: |
brew update && brew install git flex bison ninja cmake llvm ninja
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
cmake-arguments: "-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}'
-DCMAKE_VERBOSE_MAKEFILE=on"
###
# OpenAL
###
# soft-oal setup
# Use GCC instead of Clang because of missing SSE intrinsics
# It also doesn't enable altivec support on PowerPC by default
- name: Checkout soft-oal
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '1.24.1'
- name: Configure and install soft-oal
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DCMAKE_VERBOSE_MAKEFILE=on
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DCMAKE_VERBOSE_MAKEFILE=on \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal/install' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include/AL' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Create hard-link and copy symbolic links
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.0.dylib '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.1.dylib '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-macos-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package

View file

@ -16,7 +16,9 @@ The main goal of OpenMoHAA is to ensure the future and continuity of **Medal of
- [Downloading and installing OpenMoHAA](docs/getting_started_installation.md) - [Downloading and installing OpenMoHAA](docs/getting_started_installation.md)
- [Running OpenMoHAA and using expansion assets](docs/getting_started_running.md) - [Running OpenMoHAA and using expansion assets](docs/getting_started_running.md)
- [Dedicated server configuration](docs/configuration/server.md) - [Game configuration](docs/configuration.md)
If you encounter any issues, please refer to the [FAQ](docs/faq.md) for possible solutions.
## Current state ## Current state
@ -35,7 +37,13 @@ One of the big multiplayer features are bots. They were introduced for testing a
## Features ## Features
- [List of new features](docs/features.md) - [List of new features](docs/features.md)
- [Scripting commands](https://htmlpreview.github.io/?https://github.com/openmoh/openmohaa/blob/main/docs/features_g_allclasses.html) - [Scripting](docs/scripting.md)
## Reporting issues
If you encounter a bug, report it by creating a new [issue](https://github.com/openmoh/openmohaa/issues). Make sure to select the `Bug report` template and fill in the appropriate fields.
If you need help or have a problem, you can head over to the [discussions](https://github.com/openmoh/openmohaa/discussions) or join the OpenMoHAA Discord server (the link is at the bottom of this README).
## Compiling ## Compiling

View file

@ -1,8 +1,40 @@
#ifndef AL_AL_H #ifndef AL_AL_H
#define AL_AL_H #define AL_AL_H
#if defined(__cplusplus) /* NOLINTBEGIN */
#ifdef __cplusplus
extern "C" { extern "C" {
#ifdef _MSVC_LANG
#define AL_CPLUSPLUS _MSVC_LANG
#else
#define AL_CPLUSPLUS __cplusplus
#endif
#ifndef AL_DISABLE_NOEXCEPT
#if AL_CPLUSPLUS >= 201103L
#define AL_API_NOEXCEPT noexcept
#else
#define AL_API_NOEXCEPT
#endif
#if AL_CPLUSPLUS >= 201703L
#define AL_API_NOEXCEPT17 noexcept
#else
#define AL_API_NOEXCEPT17
#endif
#else /* AL_DISABLE_NOEXCEPT */
#define AL_API_NOEXCEPT
#define AL_API_NOEXCEPT17
#endif
#undef AL_CPLUSPLUS
#else /* __cplusplus */
#define AL_API_NOEXCEPT
#define AL_API_NOEXCEPT17
#endif #endif
#ifndef AL_API #ifndef AL_API
@ -15,14 +47,14 @@ extern "C" {
#endif #endif
#endif #endif
#if defined(_WIN32) #ifdef _WIN32
#define AL_APIENTRY __cdecl #define AL_APIENTRY __cdecl
#else #else
#define AL_APIENTRY #define AL_APIENTRY
#endif #endif
/** Deprecated macro. */ /* Deprecated macros. */
#define OPENAL #define OPENAL
#define ALAPI AL_API #define ALAPI AL_API
#define ALAPIENTRY AL_APIENTRY #define ALAPIENTRY AL_APIENTRY
@ -30,7 +62,7 @@ extern "C" {
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM #define AL_ILLEGAL_ENUM AL_INVALID_ENUM
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION #define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
/** Supported AL version. */ /* Supported AL versions. */
#define AL_VERSION_1_0 #define AL_VERSION_1_0
#define AL_VERSION_1_1 #define AL_VERSION_1_1
@ -40,43 +72,43 @@ typedef char ALboolean;
/** character */ /** character */
typedef char ALchar; typedef char ALchar;
/** signed 8-bit 2's complement integer */ /** signed 8-bit integer */
typedef signed char ALbyte; typedef signed char ALbyte;
/** unsigned 8-bit integer */ /** unsigned 8-bit integer */
typedef unsigned char ALubyte; typedef unsigned char ALubyte;
/** signed 16-bit 2's complement integer */ /** signed 16-bit integer */
typedef short ALshort; typedef short ALshort;
/** unsigned 16-bit integer */ /** unsigned 16-bit integer */
typedef unsigned short ALushort; typedef unsigned short ALushort;
/** signed 32-bit 2's complement integer */ /** signed 32-bit integer */
typedef int ALint; typedef int ALint;
/** unsigned 32-bit integer */ /** unsigned 32-bit integer */
typedef unsigned int ALuint; typedef unsigned int ALuint;
/** non-negative 32-bit binary integer size */ /** non-negative 32-bit integer size */
typedef int ALsizei; typedef int ALsizei;
/** enumerated 32-bit value */ /** 32-bit enumeration value */
typedef int ALenum; typedef int ALenum;
/** 32-bit IEEE754 floating-point */ /** 32-bit IEEE-754 floating-point */
typedef float ALfloat; typedef float ALfloat;
/** 64-bit IEEE754 floating-point */ /** 64-bit IEEE-754 floating-point */
typedef double ALdouble; typedef double ALdouble;
/** void type (for opaque pointers only) */ /** void type (opaque pointers only) */
typedef void ALvoid; typedef void ALvoid;
/* Enumerant values begin at column 50. No tabs. */ /* Enumeration values begin at column 50. Do not use tabs. */
/** "no distance model" or "no buffer" */ /** No distance model or no buffer */
#define AL_NONE 0 #define AL_NONE 0
/** Boolean False. */ /** Boolean False. */
@ -89,10 +121,10 @@ typedef void ALvoid;
/** /**
* Relative source. * Relative source.
* Type: ALboolean * Type: ALboolean
* Range: [AL_TRUE, AL_FALSE] * Range: [AL_FALSE, AL_TRUE]
* Default: AL_FALSE * Default: AL_FALSE
* *
* Specifies if the Source has relative coordinates. * Specifies if the source uses relative coordinates.
*/ */
#define AL_SOURCE_RELATIVE 0x202 #define AL_SOURCE_RELATIVE 0x202
@ -103,7 +135,8 @@ typedef void ALvoid;
* Range: [0 - 360] * Range: [0 - 360]
* Default: 360 * Default: 360
* *
* The angle covered by the inner cone, where the source will not attenuate. * The angle covered by the inner cone, the area within which the source will
* not be attenuated by direction.
*/ */
#define AL_CONE_INNER_ANGLE 0x1001 #define AL_CONE_INNER_ANGLE 0x1001
@ -112,8 +145,8 @@ typedef void ALvoid;
* Range: [0 - 360] * Range: [0 - 360]
* Default: 360 * Default: 360
* *
* The angle covered by the outer cone, where the source will be fully * The angle covered by the outer cone, the area outside of which the source
* attenuated. * will be fully attenuated by direction.
*/ */
#define AL_CONE_OUTER_ANGLE 0x1002 #define AL_CONE_OUTER_ANGLE 0x1002
@ -123,7 +156,7 @@ typedef void ALvoid;
* Range: [0.5 - 2.0] * Range: [0.5 - 2.0]
* Default: 1.0 * Default: 1.0
* *
* A multiplier for the frequency (sample rate) of the source's buffer. * A multiplier for the sample rate of the source's buffer.
*/ */
#define AL_PITCH 0x1003 #define AL_PITCH 0x1003
@ -134,12 +167,12 @@ typedef void ALvoid;
* *
* The source or listener location in three dimensional space. * The source or listener location in three dimensional space.
* *
* OpenAL, like OpenGL, uses a right handed coordinate system, where in a * OpenAL uses a right handed coordinate system, like OpenGL, where with a
* frontal default view X (thumb) points right, Y points up (index finger), and * default view, X points right (thumb), Y points up (index finger), and Z
* Z points towards the viewer/camera (middle finger). * points towards the viewer/camera (middle finger).
* *
* To switch from a left handed coordinate system, flip the sign on the Z * To change from or to a left handed coordinate system, negate the Z
* coordinate. * component.
*/ */
#define AL_POSITION 0x1004 #define AL_POSITION 0x1004
@ -148,8 +181,11 @@ typedef void ALvoid;
* Type: ALfloat[3], ALint[3] * Type: ALfloat[3], ALint[3]
* Default: {0, 0, 0} * Default: {0, 0, 0}
* *
* Specifies the current direction in local space. * Specifies the current direction in local space. A zero-length vector
* A zero-length vector specifies an omni-directional source (cone is ignored). * specifies an omni-directional source (cone is ignored).
*
* To change from or to a left handed coordinate system, negate the Z
* component.
*/ */
#define AL_DIRECTION 0x1005 #define AL_DIRECTION 0x1005
@ -158,26 +194,30 @@ typedef void ALvoid;
* Type: ALfloat[3], ALint[3] * Type: ALfloat[3], ALint[3]
* Default: {0, 0, 0} * Default: {0, 0, 0}
* *
* Specifies the current velocity in local space. * Specifies the current velocity, relative to the position.
*
* To change from or to a left handed coordinate system, negate the Z
* component.
*/ */
#define AL_VELOCITY 0x1006 #define AL_VELOCITY 0x1006
/** /**
* Source looping. * Source looping.
* Type: ALboolean * Type: ALboolean
* Range: [AL_TRUE, AL_FALSE] * Range: [AL_FALSE, AL_TRUE]
* Default: AL_FALSE * Default: AL_FALSE
* *
* Specifies whether source is looping. * Specifies whether source playback loops.
*/ */
#define AL_LOOPING 0x1007 #define AL_LOOPING 0x1007
/** /**
* Source buffer. * Source buffer.
* Type: ALuint * Type: ALuint
* Range: any valid Buffer. * Range: any valid Buffer ID
* Default: AL_NONE
* *
* Specifies the buffer to provide sound samples. * Specifies the buffer to provide sound samples for a source.
*/ */
#define AL_BUFFER 0x1009 #define AL_BUFFER 0x1009
@ -186,12 +226,12 @@ typedef void ALvoid;
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - ] * Range: [0.0 - ]
* *
* A value of 1.0 means unattenuated. Each division by 2 equals an attenuation * For sources, an initial linear gain value (before attenuation is applied).
* of about -6dB. Each multiplicaton by 2 equals an amplification of about * For the listener, an output linear gain adjustment.
* +6dB.
* *
* A value of 0.0 is meaningless with respect to a logarithmic scale; it is * A value of 1.0 means unattenuated. Each division by 2 equals an attenuation
* silent. * of about -6dB. Each multiplication by 2 equals an amplification of about
* +6dB.
*/ */
#define AL_GAIN 0x100A #define AL_GAIN 0x100A
@ -200,8 +240,8 @@ typedef void ALvoid;
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - 1.0] * Range: [0.0 - 1.0]
* *
* The minimum gain allowed for a source, after distance and cone attenation is * The minimum gain allowed for a source, after distance and cone attenuation
* applied (if applicable). * are applied (if applicable).
*/ */
#define AL_MIN_GAIN 0x100D #define AL_MIN_GAIN 0x100D
@ -210,31 +250,33 @@ typedef void ALvoid;
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - 1.0] * Range: [0.0 - 1.0]
* *
* The maximum gain allowed for a source, after distance and cone attenation is * The maximum gain allowed for a source, after distance and cone attenuation
* applied (if applicable). * are applied (if applicable).
*/ */
#define AL_MAX_GAIN 0x100E #define AL_MAX_GAIN 0x100E
/** /**
* Listener orientation. * Listener orientation.
* Type: ALfloat[6] * Type: ALfloat[6]
* Default: {0.0, 0.0, -1.0, 0.0, 1.0, 0.0} * Default: {0.0, 0.0, -1.0, 0.0, 1.0, 0.0}
* *
* Effectively two three dimensional vectors. The first vector is the front (or * Effectively two three dimensional vectors. The first vector is the front (or
* "at") and the second is the top (or "up"). * "at") and the second is the top (or "up"). Both vectors are relative to the
* listener position.
* *
* Both vectors are in local space. * To change from or to a left handed coordinate system, negate the Z
* component of both vectors.
*/ */
#define AL_ORIENTATION 0x100F #define AL_ORIENTATION 0x100F
/** /**
* Source state (query only). * Source state (query only).
* Type: ALint * Type: ALenum
* Range: [AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED] * Range: [AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED]
*/ */
#define AL_SOURCE_STATE 0x1010 #define AL_SOURCE_STATE 0x1010
/** Source state value. */ /* Source state values. */
#define AL_INITIAL 0x1011 #define AL_INITIAL 0x1011
#define AL_PLAYING 0x1012 #define AL_PLAYING 0x1012
#define AL_PAUSED 0x1013 #define AL_PAUSED 0x1013
@ -267,9 +309,9 @@ typedef void ALvoid;
* Range: [0.0 - ] * Range: [0.0 - ]
* Default: 1.0 * Default: 1.0
* *
* The distance in units that no attenuation occurs. * The distance in units that no distance attenuation occurs.
* *
* At 0.0, no distance attenuation ever occurs on non-linear attenuation models. * At 0.0, no distance attenuation occurs with non-linear attenuation models.
*/ */
#define AL_REFERENCE_DISTANCE 0x1020 #define AL_REFERENCE_DISTANCE 0x1020
@ -292,7 +334,7 @@ typedef void ALvoid;
* Default: 0.0 * Default: 0.0
* *
* The gain attenuation applied when the listener is outside of the source's * The gain attenuation applied when the listener is outside of the source's
* outer cone. * outer cone angle.
*/ */
#define AL_CONE_OUTER_GAIN 0x1022 #define AL_CONE_OUTER_GAIN 0x1022
@ -300,7 +342,7 @@ typedef void ALvoid;
* Source maximum distance. * Source maximum distance.
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - ] * Range: [0.0 - ]
* Default: +inf * Default: FLT_MAX
* *
* The distance above which the source is not attenuated any further with a * The distance above which the source is not attenuated any further with a
* clamped distance model, or where attenuation reaches 0.0 gain for linear * clamped distance model, or where attenuation reaches 0.0 gain for linear
@ -308,16 +350,16 @@ typedef void ALvoid;
*/ */
#define AL_MAX_DISTANCE 0x1023 #define AL_MAX_DISTANCE 0x1023
/** Source buffer position, in seconds */ /** Source buffer offset, in seconds */
#define AL_SEC_OFFSET 0x1024 #define AL_SEC_OFFSET 0x1024
/** Source buffer position, in sample frames */ /** Source buffer offset, in sample frames */
#define AL_SAMPLE_OFFSET 0x1025 #define AL_SAMPLE_OFFSET 0x1025
/** Source buffer position, in bytes */ /** Source buffer offset, in bytes */
#define AL_BYTE_OFFSET 0x1026 #define AL_BYTE_OFFSET 0x1026
/** /**
* Source type (query only). * Source type (query only).
* Type: ALint * Type: ALenum
* Range: [AL_STATIC, AL_STREAMING, AL_UNDETERMINED] * Range: [AL_STATIC, AL_STREAMING, AL_UNDETERMINED]
* *
* A Source is Static if a Buffer has been attached using AL_BUFFER. * A Source is Static if a Buffer has been attached using AL_BUFFER.
@ -330,31 +372,30 @@ typedef void ALvoid;
*/ */
#define AL_SOURCE_TYPE 0x1027 #define AL_SOURCE_TYPE 0x1027
/** Source type value. */ /* Source type values. */
#define AL_STATIC 0x1028 #define AL_STATIC 0x1028
#define AL_STREAMING 0x1029 #define AL_STREAMING 0x1029
#define AL_UNDETERMINED 0x1030 #define AL_UNDETERMINED 0x1030
/** Buffer format specifier. */ /** Unsigned 8-bit mono buffer format. */
#define AL_FORMAT_MONO8 0x1100 #define AL_FORMAT_MONO8 0x1100
/** Signed 16-bit mono buffer format. */
#define AL_FORMAT_MONO16 0x1101 #define AL_FORMAT_MONO16 0x1101
/** Unsigned 8-bit stereo buffer format. */
#define AL_FORMAT_STEREO8 0x1102 #define AL_FORMAT_STEREO8 0x1102
/** Signed 16-bit stereo buffer format. */
#define AL_FORMAT_STEREO16 0x1103 #define AL_FORMAT_STEREO16 0x1103
/** Buffer frequency (query only). */ /** Buffer frequency/sample rate (query only). */
#define AL_FREQUENCY 0x2001 #define AL_FREQUENCY 0x2001
/** Buffer bits per sample (query only). */ /** Buffer bits per sample (query only). */
#define AL_BITS 0x2002 #define AL_BITS 0x2002
/** Buffer channel count (query only). */ /** Buffer channel count (query only). */
#define AL_CHANNELS 0x2003 #define AL_CHANNELS 0x2003
/** Buffer data size (query only). */ /** Buffer data size in bytes (query only). */
#define AL_SIZE 0x2004 #define AL_SIZE 0x2004
/** /* Buffer state. Not for public use. */
* Buffer state.
*
* Not for public use.
*/
#define AL_UNUSED 0x2010 #define AL_UNUSED 0x2010
#define AL_PENDING 0x2011 #define AL_PENDING 0x2011
#define AL_PROCESSED 0x2012 #define AL_PROCESSED 0x2012
@ -363,32 +404,31 @@ typedef void ALvoid;
/** No error. */ /** No error. */
#define AL_NO_ERROR 0 #define AL_NO_ERROR 0
/** Invalid name paramater passed to AL call. */ /** Invalid name (ID) passed to an AL call. */
#define AL_INVALID_NAME 0xA001 #define AL_INVALID_NAME 0xA001
/** Invalid enum parameter passed to AL call. */ /** Invalid enumeration passed to AL call. */
#define AL_INVALID_ENUM 0xA002 #define AL_INVALID_ENUM 0xA002
/** Invalid value parameter passed to AL call. */ /** Invalid value passed to AL call. */
#define AL_INVALID_VALUE 0xA003 #define AL_INVALID_VALUE 0xA003
/** Illegal AL call. */ /** Illegal AL call. */
#define AL_INVALID_OPERATION 0xA004 #define AL_INVALID_OPERATION 0xA004
/** Not enough memory. */ /** Not enough memory to execute the AL call. */
#define AL_OUT_OF_MEMORY 0xA005 #define AL_OUT_OF_MEMORY 0xA005
/** Context string: Vendor ID. */ /** Context string: Vendor name. */
#define AL_VENDOR 0xB001 #define AL_VENDOR 0xB001
/** Context string: Version. */ /** Context string: Version. */
#define AL_VERSION 0xB002 #define AL_VERSION 0xB002
/** Context string: Renderer ID. */ /** Context string: Renderer name. */
#define AL_RENDERER 0xB003 #define AL_RENDERER 0xB003
/** Context string: Space-separated extension list. */ /** Context string: Space-separated extension list. */
#define AL_EXTENSIONS 0xB004 #define AL_EXTENSIONS 0xB004
/** /**
* Doppler scale. * Doppler scale.
* Type: ALfloat * Type: ALfloat
@ -398,7 +438,6 @@ typedef void ALvoid;
* Scale for source and listener velocities. * Scale for source and listener velocities.
*/ */
#define AL_DOPPLER_FACTOR 0xC000 #define AL_DOPPLER_FACTOR 0xC000
AL_API void AL_APIENTRY alDopplerFactor(ALfloat value);
/** /**
* Doppler velocity (deprecated). * Doppler velocity (deprecated).
@ -406,7 +445,6 @@ AL_API void AL_APIENTRY alDopplerFactor(ALfloat value);
* A multiplier applied to the Speed of Sound. * A multiplier applied to the Speed of Sound.
*/ */
#define AL_DOPPLER_VELOCITY 0xC001 #define AL_DOPPLER_VELOCITY 0xC001
AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value);
/** /**
* Speed of Sound, in units per second. * Speed of Sound, in units per second.
@ -415,14 +453,13 @@ AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value);
* Default: 343.3 * Default: 343.3
* *
* The speed at which sound waves are assumed to travel, when calculating the * The speed at which sound waves are assumed to travel, when calculating the
* doppler effect. * doppler effect from source and listener velocities.
*/ */
#define AL_SPEED_OF_SOUND 0xC003 #define AL_SPEED_OF_SOUND 0xC003
AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value);
/** /**
* Distance attenuation model. * Distance attenuation model.
* Type: ALint * Type: ALenum
* Range: [AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED, * Range: [AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED,
* AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED, * AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED,
* AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED] * AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED]
@ -439,9 +476,8 @@ AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value);
* distance calculated is clamped between the reference and max distances. * distance calculated is clamped between the reference and max distances.
*/ */
#define AL_DISTANCE_MODEL 0xD000 #define AL_DISTANCE_MODEL 0xD000
AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel);
/** Distance model value. */ /* Distance model values. */
#define AL_INVERSE_DISTANCE 0xD001 #define AL_INVERSE_DISTANCE 0xD001
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002 #define AL_INVERSE_DISTANCE_CLAMPED 0xD002
#define AL_LINEAR_DISTANCE 0xD003 #define AL_LINEAR_DISTANCE 0xD003
@ -449,208 +485,223 @@ AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel);
#define AL_EXPONENT_DISTANCE 0xD005 #define AL_EXPONENT_DISTANCE 0xD005
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006 #define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
/** Renderer State management. */ #ifndef AL_NO_PROTOTYPES
AL_API void AL_APIENTRY alEnable(ALenum capability); /* Renderer State management. */
AL_API void AL_APIENTRY alDisable(ALenum capability); AL_API void AL_APIENTRY alEnable(ALenum capability) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability); AL_API void AL_APIENTRY alDisable(ALenum capability) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) AL_API_NOEXCEPT;
/** State retrieval. */ /* Context state setting. */
AL_API const ALchar* AL_APIENTRY alGetString(ALenum param); AL_API void AL_APIENTRY alDopplerFactor(ALfloat value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBooleanv(ALenum param, ALboolean *values); AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetIntegerv(ALenum param, ALint *values); AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetFloatv(ALenum param, ALfloat *values); AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetDoublev(ALenum param, ALdouble *values);
AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum param); /* Context state retrieval. */
AL_API ALint AL_APIENTRY alGetInteger(ALenum param); AL_API const ALchar* AL_APIENTRY alGetString(ALenum param) AL_API_NOEXCEPT;
AL_API ALfloat AL_APIENTRY alGetFloat(ALenum param); AL_API void AL_APIENTRY alGetBooleanv(ALenum param, ALboolean *values) AL_API_NOEXCEPT;
AL_API ALdouble AL_APIENTRY alGetDouble(ALenum param); AL_API void AL_APIENTRY alGetIntegerv(ALenum param, ALint *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetFloatv(ALenum param, ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetDoublev(ALenum param, ALdouble *values) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum param) AL_API_NOEXCEPT;
AL_API ALint AL_APIENTRY alGetInteger(ALenum param) AL_API_NOEXCEPT;
AL_API ALfloat AL_APIENTRY alGetFloat(ALenum param) AL_API_NOEXCEPT;
AL_API ALdouble AL_APIENTRY alGetDouble(ALenum param) AL_API_NOEXCEPT;
/** /**
* Error retrieval. * Obtain the first error generated in the AL context since the last call to
* * this function.
* Obtain the first error generated in the AL context since the last check.
*/ */
AL_API ALenum AL_APIENTRY alGetError(void); AL_API ALenum AL_APIENTRY alGetError(void) AL_API_NOEXCEPT;
/** Query for the presence of an extension on the AL context. */
AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname) AL_API_NOEXCEPT;
/** /**
* Extension support. * Retrieve the address of a function. The returned function may be context-
* * specific.
* Query for the presence of an extension, and obtain any appropriate function
* pointers and enum values.
*/ */
AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname); AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname) AL_API_NOEXCEPT;
AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname); /**
AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename); * Retrieve the value of an enum. The returned value may be context-specific.
*/
AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename) AL_API_NOEXCEPT;
/** Set Listener parameters */ /* Set listener parameters. */
AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value); AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3); AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values); AL_API void AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alListeneri(ALenum param, ALint value); AL_API void AL_APIENTRY alListeneri(ALenum param, ALint value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, ALint value3); AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values); AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values) AL_API_NOEXCEPT;
/** Get Listener parameters */ /* Get listener parameters. */
AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value); AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3); AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values); AL_API void AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetListeneri(ALenum param, ALint *value); AL_API void AL_APIENTRY alGetListeneri(ALenum param, ALint *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3); AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint *values); AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint *values) AL_API_NOEXCEPT;
/** Create Source objects. */ /** Create source objects. */
AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources); AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) AL_API_NOEXCEPT;
/** Delete Source objects. */ /** Delete source objects. */
AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources); AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
/** Verify a handle is a valid Source. */ /** Verify an ID is for a valid source. */
AL_API ALboolean AL_APIENTRY alIsSource(ALuint source); AL_API ALboolean AL_APIENTRY alIsSource(ALuint source) AL_API_NOEXCEPT;
/** Set Source parameters. */ /* Set source parameters. */
AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value); AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3); AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values); AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value); AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3); AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values); AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT;
/** Get Source parameters. */ /* Get source parameters. */
AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value); AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3); AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *values); AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value); AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3); AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values); AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT;
/** Play, replay, or resume (if paused) a list of Sources */ /** Play, restart, or resume a source, setting its state to AL_PLAYING. */
AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources); AL_API void AL_APIENTRY alSourcePlay(ALuint source) AL_API_NOEXCEPT;
/** Stop a list of Sources */ /** Stop a source, setting its state to AL_STOPPED if playing or paused. */
AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources); AL_API void AL_APIENTRY alSourceStop(ALuint source) AL_API_NOEXCEPT;
/** Rewind a list of Sources */ /** Rewind a source, setting its state to AL_INITIAL. */
AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources); AL_API void AL_APIENTRY alSourceRewind(ALuint source) AL_API_NOEXCEPT;
/** Pause a list of Sources */ /** Pause a source, setting its state to AL_PAUSED if playing. */
AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources); AL_API void AL_APIENTRY alSourcePause(ALuint source) AL_API_NOEXCEPT;
/** Play, replay, or resume a Source */ /** Play, restart, or resume a list of sources atomically. */
AL_API void AL_APIENTRY alSourcePlay(ALuint source); AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
/** Stop a Source */ /** Stop a list of sources atomically. */
AL_API void AL_APIENTRY alSourceStop(ALuint source); AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
/** Rewind a Source (set playback postiton to beginning) */ /** Rewind a list of sources atomically. */
AL_API void AL_APIENTRY alSourceRewind(ALuint source); AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
/** Pause a Source */ /** Pause a list of sources atomically. */
AL_API void AL_APIENTRY alSourcePause(ALuint source); AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
/** Queue buffers onto a source */ /** Queue buffers onto a source */
AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const ALuint *buffers); AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT;
/** Unqueue processed buffers from a source */ /** Unqueue processed buffers from a source */
AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers); AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT;
/** Create Buffer objects */ /** Create buffer objects */
AL_API void AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers); AL_API void AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) AL_API_NOEXCEPT;
/** Delete Buffer objects */ /** Delete buffer objects */
AL_API void AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers); AL_API void AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT;
/** Verify a handle is a valid Buffer */ /** Verify an ID is a valid buffer (including the NULL buffer) */
AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer); AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) AL_API_NOEXCEPT;
/** Specifies the data to be copied into a buffer */ /**
AL_API void AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq); * Copies data into the buffer, interpreting it using the specified format and
* samplerate.
*/
AL_API void AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT;
/** Set Buffer parameters, */ /* Set buffer parameters. */
AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat value); AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3); AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *values); AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value); AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3); AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *values); AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT;
/** Get Buffer parameters. */ /* Get buffer parameters. */
AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value); AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3); AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values); AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value); AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3); AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values); AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT;
#endif /* AL_NO_PROTOTYPES */
/** Pointer-to-function type, useful for dynamically getting AL entry points. */ /* Pointer-to-function types, useful for storing dynamically loaded AL entry
typedef void (AL_APIENTRY *LPALENABLE)(ALenum capability); * points.
typedef void (AL_APIENTRY *LPALDISABLE)(ALenum capability); */
typedef ALboolean (AL_APIENTRY *LPALISENABLED)(ALenum capability); typedef void (AL_APIENTRY *LPALENABLE)(ALenum capability) AL_API_NOEXCEPT17;
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)(ALenum param); typedef void (AL_APIENTRY *LPALDISABLE)(ALenum capability) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBOOLEANV)(ALenum param, ALboolean *values); typedef ALboolean (AL_APIENTRY *LPALISENABLED)(ALenum capability) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETINTEGERV)(ALenum param, ALint *values); typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)(ALenum param) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFLOATV)(ALenum param, ALfloat *values); typedef void (AL_APIENTRY *LPALGETBOOLEANV)(ALenum param, ALboolean *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETDOUBLEV)(ALenum param, ALdouble *values); typedef void (AL_APIENTRY *LPALGETINTEGERV)(ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)(ALenum param); typedef void (AL_APIENTRY *LPALGETFLOATV)(ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef ALint (AL_APIENTRY *LPALGETINTEGER)(ALenum param); typedef void (AL_APIENTRY *LPALGETDOUBLEV)(ALenum param, ALdouble *values) AL_API_NOEXCEPT17;
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)(ALenum param); typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)(ALenum param) AL_API_NOEXCEPT17;
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)(ALenum param); typedef ALint (AL_APIENTRY *LPALGETINTEGER)(ALenum param) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPALGETERROR)(void); typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)(ALenum param) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar *extname); typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)(ALenum param) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)(const ALchar *fname); typedef ALenum (AL_APIENTRY *LPALGETERROR)(void) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)(const ALchar *ename); typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar *extname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERF)(ALenum param, ALfloat value); typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)(const ALchar *fname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENER3F)(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3); typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)(const ALchar *ename) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERFV)(ALenum param, const ALfloat *values); typedef void (AL_APIENTRY *LPALLISTENERF)(ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERI)(ALenum param, ALint value); typedef void (AL_APIENTRY *LPALLISTENER3F)(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENER3I)(ALenum param, ALint value1, ALint value2, ALint value3); typedef void (AL_APIENTRY *LPALLISTENERFV)(ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERIV)(ALenum param, const ALint *values); typedef void (AL_APIENTRY *LPALLISTENERI)(ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERF)(ALenum param, ALfloat *value); typedef void (AL_APIENTRY *LPALLISTENER3I)(ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENER3F)(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3); typedef void (AL_APIENTRY *LPALLISTENERIV)(ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERFV)(ALenum param, ALfloat *values); typedef void (AL_APIENTRY *LPALGETLISTENERF)(ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERI)(ALenum param, ALint *value); typedef void (AL_APIENTRY *LPALGETLISTENER3F)(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENER3I)(ALenum param, ALint *value1, ALint *value2, ALint *value3); typedef void (AL_APIENTRY *LPALGETLISTENERFV)(ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERIV)(ALenum param, ALint *values); typedef void (AL_APIENTRY *LPALGETLISTENERI)(ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENSOURCES)(ALsizei n, ALuint *sources); typedef void (AL_APIENTRY *LPALGETLISTENER3I)(ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETESOURCES)(ALsizei n, const ALuint *sources); typedef void (AL_APIENTRY *LPALGETLISTENERIV)(ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)(ALuint source); typedef void (AL_APIENTRY *LPALGENSOURCES)(ALsizei n, ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEF)(ALuint source, ALenum param, ALfloat value); typedef void (AL_APIENTRY *LPALDELETESOURCES)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3F)(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3); typedef ALboolean (AL_APIENTRY *LPALISSOURCE)(ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEFV)(ALuint source, ALenum param, const ALfloat *values); typedef void (AL_APIENTRY *LPALSOURCEF)(ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEI)(ALuint source, ALenum param, ALint value); typedef void (AL_APIENTRY *LPALSOURCE3F)(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3); typedef void (AL_APIENTRY *LPALSOURCEFV)(ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEIV)(ALuint source, ALenum param, const ALint *values); typedef void (AL_APIENTRY *LPALSOURCEI)(ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEF)(ALuint source, ALenum param, ALfloat *value); typedef void (AL_APIENTRY *LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3F)(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3); typedef void (AL_APIENTRY *LPALSOURCEIV)(ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEFV)(ALuint source, ALenum param, ALfloat *values); typedef void (AL_APIENTRY *LPALGETSOURCEF)(ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEI)(ALuint source, ALenum param, ALint *value); typedef void (AL_APIENTRY *LPALGETSOURCE3F)(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3I)(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3); typedef void (AL_APIENTRY *LPALGETSOURCEFV)(ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEIV)(ALuint source, ALenum param, ALint *values); typedef void (AL_APIENTRY *LPALGETSOURCEI)(ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)(ALsizei n, const ALuint *sources); typedef void (AL_APIENTRY *LPALGETSOURCE3I)(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCESTOPV)(ALsizei n, const ALuint *sources); typedef void (AL_APIENTRY *LPALGETSOURCEIV)(ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)(ALsizei n, const ALuint *sources); typedef void (AL_APIENTRY *LPALSOURCEPLAYV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)(ALsizei n, const ALuint *sources); typedef void (AL_APIENTRY *LPALSOURCESTOPV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAY)(ALuint source); typedef void (AL_APIENTRY *LPALSOURCEREWINDV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCESTOP)(ALuint source); typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEREWIND)(ALuint source); typedef void (AL_APIENTRY *LPALSOURCEPLAY)(ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)(ALuint source); typedef void (AL_APIENTRY *LPALSOURCESTOP)(ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint source, ALsizei nb, const ALuint *buffers); typedef void (AL_APIENTRY *LPALSOURCEREWIND)(ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint source, ALsizei nb, ALuint *buffers); typedef void (AL_APIENTRY *LPALSOURCEPAUSE)(ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENBUFFERS)(ALsizei n, ALuint *buffers); typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)(ALsizei n, const ALuint *buffers); typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)(ALuint buffer); typedef void (AL_APIENTRY *LPALGENBUFFERS)(ALsizei n, ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERDATA)(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq); typedef void (AL_APIENTRY *LPALDELETEBUFFERS)(ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERF)(ALuint buffer, ALenum param, ALfloat value); typedef ALboolean (AL_APIENTRY *LPALISBUFFER)(ALuint buffer) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFER3F)(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3); typedef void (AL_APIENTRY *LPALBUFFERDATA)(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERFV)(ALuint buffer, ALenum param, const ALfloat *values); typedef void (AL_APIENTRY *LPALBUFFERF)(ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERI)(ALuint buffer, ALenum param, ALint value); typedef void (AL_APIENTRY *LPALBUFFER3F)(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFER3I)(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3); typedef void (AL_APIENTRY *LPALBUFFERFV)(ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERIV)(ALuint buffer, ALenum param, const ALint *values); typedef void (AL_APIENTRY *LPALBUFFERI)(ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERF)(ALuint buffer, ALenum param, ALfloat *value); typedef void (AL_APIENTRY *LPALBUFFER3I)(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3F)(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3); typedef void (AL_APIENTRY *LPALBUFFERIV)(ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERFV)(ALuint buffer, ALenum param, ALfloat *values); typedef void (AL_APIENTRY *LPALGETBUFFERF)(ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERI)(ALuint buffer, ALenum param, ALint *value); typedef void (AL_APIENTRY *LPALGETBUFFER3F)(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3I)(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3); typedef void (AL_APIENTRY *LPALGETBUFFERFV)(ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERIV)(ALuint buffer, ALenum param, ALint *values); typedef void (AL_APIENTRY *LPALGETBUFFERI)(ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)(ALfloat value); typedef void (AL_APIENTRY *LPALGETBUFFER3I)(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)(ALfloat value); typedef void (AL_APIENTRY *LPALGETBUFFERIV)(ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value); typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)(ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel); typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)(ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel) AL_API_NOEXCEPT17;
#if defined(__cplusplus) #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
/* NOLINTEND */
#endif /* AL_AL_H */ #endif /* AL_AL_H */

View file

@ -1,8 +1,40 @@
#ifndef AL_ALC_H #ifndef AL_ALC_H
#define AL_ALC_H #define AL_ALC_H
#if defined(__cplusplus) /* NOLINTBEGIN */
#ifdef __cplusplus
extern "C" { extern "C" {
#ifdef _MSVC_LANG
#define ALC_CPLUSPLUS _MSVC_LANG
#else
#define ALC_CPLUSPLUS __cplusplus
#endif
#ifndef AL_DISABLE_NOEXCEPT
#if ALC_CPLUSPLUS >= 201103L
#define ALC_API_NOEXCEPT noexcept
#else
#define ALC_API_NOEXCEPT
#endif
#if ALC_CPLUSPLUS >= 201703L
#define ALC_API_NOEXCEPT17 noexcept
#else
#define ALC_API_NOEXCEPT17
#endif
#else /* AL_DISABLE_NOEXCEPT */
#define ALC_API_NOEXCEPT
#define ALC_API_NOEXCEPT17
#endif
#undef ALC_CPLUSPLUS
#else /* __cplusplus */
#define ALC_API_NOEXCEPT
#define ALC_API_NOEXCEPT17
#endif #endif
#ifndef ALC_API #ifndef ALC_API
@ -15,14 +47,14 @@ extern "C" {
#endif #endif
#endif #endif
#if defined(_WIN32) #ifdef _WIN32
#define ALC_APIENTRY __cdecl #define ALC_APIENTRY __cdecl
#else #else
#define ALC_APIENTRY #define ALC_APIENTRY
#endif #endif
/** Deprecated macro. */ /* Deprecated macros. */
#define ALCAPI ALC_API #define ALCAPI ALC_API
#define ALCAPIENTRY ALC_APIENTRY #define ALCAPIENTRY ALC_APIENTRY
#define ALC_INVALID 0 #define ALC_INVALID 0
@ -31,9 +63,9 @@ extern "C" {
#define ALC_VERSION_0_1 1 #define ALC_VERSION_0_1 1
/** Opaque device handle */ /** Opaque device handle */
typedef struct ALCdevice_struct ALCdevice; typedef struct ALCdevice ALCdevice;
/** Opaque context handle */ /** Opaque context handle */
typedef struct ALCcontext_struct ALCcontext; typedef struct ALCcontext ALCcontext;
/** 8-bit boolean */ /** 8-bit boolean */
typedef char ALCboolean; typedef char ALCboolean;
@ -41,41 +73,41 @@ typedef char ALCboolean;
/** character */ /** character */
typedef char ALCchar; typedef char ALCchar;
/** signed 8-bit 2's complement integer */ /** signed 8-bit integer */
typedef signed char ALCbyte; typedef signed char ALCbyte;
/** unsigned 8-bit integer */ /** unsigned 8-bit integer */
typedef unsigned char ALCubyte; typedef unsigned char ALCubyte;
/** signed 16-bit 2's complement integer */ /** signed 16-bit integer */
typedef short ALCshort; typedef short ALCshort;
/** unsigned 16-bit integer */ /** unsigned 16-bit integer */
typedef unsigned short ALCushort; typedef unsigned short ALCushort;
/** signed 32-bit 2's complement integer */ /** signed 32-bit integer */
typedef int ALCint; typedef int ALCint;
/** unsigned 32-bit integer */ /** unsigned 32-bit integer */
typedef unsigned int ALCuint; typedef unsigned int ALCuint;
/** non-negative 32-bit binary integer size */ /** non-negative 32-bit integer size */
typedef int ALCsizei; typedef int ALCsizei;
/** enumerated 32-bit value */ /** 32-bit enumeration value */
typedef int ALCenum; typedef int ALCenum;
/** 32-bit IEEE754 floating-point */ /** 32-bit IEEE-754 floating-point */
typedef float ALCfloat; typedef float ALCfloat;
/** 64-bit IEEE754 floating-point */ /** 64-bit IEEE-754 floating-point */
typedef double ALCdouble; typedef double ALCdouble;
/** void type (for opaque pointers only) */ /** void type (for opaque pointers only) */
typedef void ALCvoid; typedef void ALCvoid;
/* Enumerant values begin at column 50. No tabs. */ /* Enumeration values begin at column 50. Do not use tabs. */
/** Boolean False. */ /** Boolean False. */
#define ALC_FALSE 0 #define ALC_FALSE 0
@ -89,7 +121,7 @@ typedef void ALCvoid;
/** Context attribute: <int> Hz. */ /** Context attribute: <int> Hz. */
#define ALC_REFRESH 0x1008 #define ALC_REFRESH 0x1008
/** Context attribute: AL_TRUE or AL_FALSE. */ /** Context attribute: AL_TRUE or AL_FALSE synchronous context? */
#define ALC_SYNC 0x1009 #define ALC_SYNC 0x1009
/** Context attribute: <int> requested Mono (3D) Sources. */ /** Context attribute: <int> requested Mono (3D) Sources. */
@ -107,30 +139,32 @@ typedef void ALCvoid;
/** Invalid context handle. */ /** Invalid context handle. */
#define ALC_INVALID_CONTEXT 0xA002 #define ALC_INVALID_CONTEXT 0xA002
/** Invalid enum parameter passed to an ALC call. */ /** Invalid enumeration passed to an ALC call. */
#define ALC_INVALID_ENUM 0xA003 #define ALC_INVALID_ENUM 0xA003
/** Invalid value parameter passed to an ALC call. */ /** Invalid value passed to an ALC call. */
#define ALC_INVALID_VALUE 0xA004 #define ALC_INVALID_VALUE 0xA004
/** Out of memory. */ /** Out of memory. */
#define ALC_OUT_OF_MEMORY 0xA005 #define ALC_OUT_OF_MEMORY 0xA005
/** Runtime ALC version. */ /** Runtime ALC major version. */
#define ALC_MAJOR_VERSION 0x1000 #define ALC_MAJOR_VERSION 0x1000
/** Runtime ALC minor version. */
#define ALC_MINOR_VERSION 0x1001 #define ALC_MINOR_VERSION 0x1001
/** Context attribute list properties. */ /** Context attribute list size. */
#define ALC_ATTRIBUTES_SIZE 0x1002 #define ALC_ATTRIBUTES_SIZE 0x1002
/** Context attribute list properties. */
#define ALC_ALL_ATTRIBUTES 0x1003 #define ALC_ALL_ATTRIBUTES 0x1003
/** String for the default device specifier. */ /** String for the default device specifier. */
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004 #define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
/** /**
* String for the given device's specifier. * Device specifier string.
* *
* If device handle is NULL, it is instead a null-char separated list of * If device handle is NULL, it is instead a null-character separated list of
* strings of known device specifiers (list ends with an empty string). * strings of known device specifiers (list ends with an empty string).
*/ */
#define ALC_DEVICE_SPECIFIER 0x1005 #define ALC_DEVICE_SPECIFIER 0x1005
@ -141,9 +175,9 @@ typedef void ALCvoid;
/** Capture extension */ /** Capture extension */
#define ALC_EXT_CAPTURE 1 #define ALC_EXT_CAPTURE 1
/** /**
* String for the given capture device's specifier. * Capture device specifier string.
* *
* If device handle is NULL, it is instead a null-char separated list of * If device handle is NULL, it is instead a null-character separated list of
* strings of known capture device specifiers (list ends with an empty string). * strings of known capture device specifiers (list ends with an empty string).
*/ */
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310 #define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
@ -158,80 +192,116 @@ typedef void ALCvoid;
/** String for the default extended device specifier. */ /** String for the default extended device specifier. */
#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012 #define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
/** /**
* String for the given extended device's specifier. * Device's extended specifier string.
* *
* If device handle is NULL, it is instead a null-char separated list of * If device handle is NULL, it is instead a null-character separated list of
* strings of known extended device specifiers (list ends with an empty string). * strings of known extended device specifiers (list ends with an empty string).
*/ */
#define ALC_ALL_DEVICES_SPECIFIER 0x1013 #define ALC_ALL_DEVICES_SPECIFIER 0x1013
/** Context management. */ #ifndef ALC_NO_PROTOTYPES
ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint* attrlist); /* Context management. */
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context);
ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context);
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context);
ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context);
ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void);
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context);
/** Device management. */ /** Create and attach a context to the given device. */
ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename); ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint *attrlist) ALC_API_NOEXCEPT;
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device); /**
* Makes the given context the active process-wide context. Passing NULL clears
* the active context.
*/
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context) ALC_API_NOEXCEPT;
/** Resumes processing updates for the given context. */
ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context) ALC_API_NOEXCEPT;
/** Suspends updates for the given context. */
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context) ALC_API_NOEXCEPT;
/** Remove a context from its device and destroys it. */
ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context) ALC_API_NOEXCEPT;
/** Returns the currently active context. */
ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void) ALC_API_NOEXCEPT;
/** Returns the device that a particular context is attached to. */
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context) ALC_API_NOEXCEPT;
/* Device management. */
/** Opens the named playback device. */
ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename) ALC_API_NOEXCEPT;
/** Closes the given playback device. */
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) ALC_API_NOEXCEPT;
/* Error support. */
/** Obtain the most recent Device error. */
ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device) ALC_API_NOEXCEPT;
/* Extension support. */
/** /**
* Error support. * Query for the presence of an extension on the device. Pass a NULL device to
* * query a device-inspecific extension.
* Obtain the most recent Device error.
*/ */
ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device); ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname) ALC_API_NOEXCEPT;
/**
* Retrieve the address of a function. Given a non-NULL device, the returned
* function may be device-specific.
*/
ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname) ALC_API_NOEXCEPT;
/**
* Retrieve the value of an enum. Given a non-NULL device, the returned value
* may be device-specific.
*/
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname) ALC_API_NOEXCEPT;
/* Query functions. */
/** Returns information about the device, and error strings. */
ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param) ALC_API_NOEXCEPT;
/** Returns information about the device and the version of OpenAL. */
ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) ALC_API_NOEXCEPT;
/* Capture functions. */
/** /**
* Extension support. * Opens the named capture device with the given frequency, format, and buffer
* * size.
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/ */
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname); ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize) ALC_API_NOEXCEPT;
ALC_API void* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname); /** Closes the given capture device. */
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname); ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device) ALC_API_NOEXCEPT;
/** Starts capturing samples into the device buffer. */
ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) ALC_API_NOEXCEPT;
/** Stops capturing samples. Samples in the device buffer remain available. */
ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device) ALC_API_NOEXCEPT;
/** Reads samples from the device buffer. */
ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT;
#endif /* ALC_NO_PROTOTYPES */
/** Query function. */ /* Pointer-to-function types, useful for storing dynamically loaded ALC entry
ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param); * points.
ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values); */
typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void) ALC_API_NOEXCEPT17;
typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname) ALC_API_NOEXCEPT17;
typedef ALCvoid* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname) ALC_API_NOEXCEPT17;
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname) ALC_API_NOEXCEPT17;
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) ALC_API_NOEXCEPT17;
typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT17;
/** Capture function. */ #ifdef __cplusplus
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize); } /* extern "C" */
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device);
ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device);
ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device);
ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
/** Pointer-to-function type, useful for dynamically getting ALC entry points. */
typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist);
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context);
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context);
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context);
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context);
typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void);
typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context);
typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename);
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device);
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device);
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname);
typedef void* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname);
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param);
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device);
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device);
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device);
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
#if defined(__cplusplus)
}
#endif #endif
/* NOLINTEND */
#endif /* AL_ALC_H */ #endif /* AL_ALC_H */

View file

@ -1,38 +1,22 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 2008 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#ifndef AL_ALEXT_H #ifndef AL_ALEXT_H
#define AL_ALEXT_H #define AL_ALEXT_H
/* NOLINTBEGIN */
#include <stddef.h> #include <stddef.h>
/* Define int64_t and uint64_t types */ /* Define int64 and uint64 types */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
#include <inttypes.h> (defined(__cplusplus) && __cplusplus >= 201103L)
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h> #include <stdint.h>
typedef int64_t _alsoft_int64_t;
typedef uint64_t _alsoft_uint64_t;
#elif defined(_WIN32) #elif defined(_WIN32)
typedef __int64 int64_t; typedef __int64 _alsoft_int64_t;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 _alsoft_uint64_t;
#else #else
/* Fallback if nothing above works */ /* Fallback if nothing above works */
#include <inttypes.h> #include <stdint.h>
typedef int64_t _alsoft_int64_t;
typedef uint64_t _alsoft_uint64_t;
#endif #endif
#include "alc.h" #include "alc.h"
@ -42,6 +26,8 @@ typedef unsigned __int64 uint64_t;
extern "C" { extern "C" {
#endif #endif
struct _GUID;
#ifndef AL_LOKI_IMA_ADPCM_format #ifndef AL_LOKI_IMA_ADPCM_format
#define AL_LOKI_IMA_ADPCM_format 1 #define AL_LOKI_IMA_ADPCM_format 1
#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000 #define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
@ -97,6 +83,31 @@ extern "C" {
#ifndef AL_EXT_MCFORMATS #ifndef AL_EXT_MCFORMATS
#define AL_EXT_MCFORMATS 1 #define AL_EXT_MCFORMATS 1
/* Provides support for surround sound buffer formats with 8, 16, and 32-bit
* samples.
*
* QUAD8: Unsigned 8-bit, Quadraphonic (Front Left, Front Right, Rear Left,
* Rear Right).
* QUAD16: Signed 16-bit, Quadraphonic.
* QUAD32: 32-bit float, Quadraphonic.
* REAR8: Unsigned 8-bit, Rear Stereo (Rear Left, Rear Right).
* REAR16: Signed 16-bit, Rear Stereo.
* REAR32: 32-bit float, Rear Stereo.
* 51CHN8: Unsigned 8-bit, 5.1 Surround (Front Left, Front Right, Front Center,
* LFE, Side Left, Side Right). Note that some audio systems may label
* 5.1's Side channels as Rear or Surround; they are equivalent for the
* purposes of this extension.
* 51CHN16: Signed 16-bit, 5.1 Surround.
* 51CHN32: 32-bit float, 5.1 Surround.
* 61CHN8: Unsigned 8-bit, 6.1 Surround (Front Left, Front Right, Front Center,
* LFE, Rear Center, Side Left, Side Right).
* 61CHN16: Signed 16-bit, 6.1 Surround.
* 61CHN32: 32-bit float, 6.1 Surround.
* 71CHN8: Unsigned 8-bit, 7.1 Surround (Front Left, Front Right, Front Center,
* LFE, Rear Left, Rear Right, Side Left, Side Right).
* 71CHN16: Signed 16-bit, 7.1 Surround.
* 71CHN32: 32-bit float, 7.1 Surround.
*/
#define AL_FORMAT_QUAD8 0x1204 #define AL_FORMAT_QUAD8 0x1204
#define AL_FORMAT_QUAD16 0x1205 #define AL_FORMAT_QUAD16 0x1205
#define AL_FORMAT_QUAD32 0x1206 #define AL_FORMAT_QUAD32 0x1206
@ -133,9 +144,9 @@ extern "C" {
#ifndef AL_EXT_STATIC_BUFFER #ifndef AL_EXT_STATIC_BUFFER
#define AL_EXT_STATIC_BUFFER 1 #define AL_EXT_STATIC_BUFFER 1
typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei); typedef void (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALuint,ALenum,ALvoid*,ALsizei,ALsizei) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq); void AL_APIENTRY alBufferDataStatic(const ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq) AL_API_NOEXCEPT;
#endif #endif
#endif #endif
@ -151,11 +162,11 @@ AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format,
#ifndef ALC_EXT_thread_local_context #ifndef ALC_EXT_thread_local_context
#define ALC_EXT_thread_local_context 1 #define ALC_EXT_thread_local_context 1
typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context); typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void); typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context); ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context) ALC_API_NOEXCEPT;
ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void); ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void) ALC_API_NOEXCEPT;
#endif #endif
#endif #endif
@ -168,9 +179,9 @@ ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
#define AL_SOFT_buffer_sub_data 1 #define AL_SOFT_buffer_sub_data 1
#define AL_BYTE_RW_OFFSETS_SOFT 0x1031 #define AL_BYTE_RW_OFFSETS_SOFT 0x1031
#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032 #define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei); typedef void (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length); AL_API void AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length) AL_API_NOEXCEPT;
#endif #endif
#endif #endif
@ -187,12 +198,12 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const
#define AL_FOLDBACK_EVENT_STOP 0x4113 #define AL_FOLDBACK_EVENT_STOP 0x4113
#define AL_FOLDBACK_MODE_MONO 0x4101 #define AL_FOLDBACK_MODE_MONO 0x4101
#define AL_FOLDBACK_MODE_STEREO 0x4102 #define AL_FOLDBACK_MODE_STEREO 0x4102
typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei); typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK); typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void); typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback); AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alRequestFoldbackStop(void); AL_API void AL_APIENTRY alRequestFoldbackStop(void) AL_API_NOEXCEPT;
#endif #endif
#endif #endif
@ -255,15 +266,15 @@ AL_API void AL_APIENTRY alRequestFoldbackStop(void);
#define AL_SAMPLE_LENGTH_SOFT 0x200A #define AL_SAMPLE_LENGTH_SOFT 0x200A
#define AL_SEC_LENGTH_SOFT 0x200B #define AL_SEC_LENGTH_SOFT 0x200B
typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*); typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*); typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*); typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum); typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data); AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data); AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data); AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format); AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format) AL_API_NOEXCEPT;
#endif #endif
#endif #endif
@ -294,13 +305,13 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
#define ALC_6POINT1_SOFT 0x1505 #define ALC_6POINT1_SOFT 0x1505
#define ALC_7POINT1_SOFT 0x1506 #define ALC_7POINT1_SOFT 0x1506
typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(const ALCchar*); typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(const ALCchar*) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice*,ALCsizei,ALCenum,ALCenum); typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice*,ALCsizei,ALCenum,ALCenum) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice*,ALCvoid*,ALCsizei); typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice*,ALCvoid*,ALCsizei) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceName); ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceName) AL_API_NOEXCEPT;
ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type); ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type) AL_API_NOEXCEPT;
ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples); ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) AL_API_NOEXCEPT;
#endif #endif
#endif #endif
@ -318,38 +329,764 @@ ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffe
#define AL_SOFT_source_latency 1 #define AL_SOFT_source_latency 1
#define AL_SAMPLE_OFFSET_LATENCY_SOFT 0x1200 #define AL_SAMPLE_OFFSET_LATENCY_SOFT 0x1200
#define AL_SEC_OFFSET_LATENCY_SOFT 0x1201 #define AL_SEC_OFFSET_LATENCY_SOFT 0x1201
typedef int64_t ALint64SOFT; typedef _alsoft_int64_t ALint64SOFT;
typedef uint64_t ALuint64SOFT; typedef _alsoft_uint64_t ALuint64SOFT;
typedef void (AL_APIENTRY*LPALSOURCEDSOFT)(ALuint,ALenum,ALdouble); typedef void (AL_APIENTRY*LPALSOURCEDSOFT)(ALuint,ALenum,ALdouble) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALSOURCE3DSOFT)(ALuint,ALenum,ALdouble,ALdouble,ALdouble); typedef void (AL_APIENTRY*LPALSOURCE3DSOFT)(ALuint,ALenum,ALdouble,ALdouble,ALdouble) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALSOURCEDVSOFT)(ALuint,ALenum,const ALdouble*); typedef void (AL_APIENTRY*LPALSOURCEDVSOFT)(ALuint,ALenum,const ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETSOURCEDSOFT)(ALuint,ALenum,ALdouble*); typedef void (AL_APIENTRY*LPALGETSOURCEDSOFT)(ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETSOURCE3DSOFT)(ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*); typedef void (AL_APIENTRY*LPALGETSOURCE3DSOFT)(ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETSOURCEDVSOFT)(ALuint,ALenum,ALdouble*); typedef void (AL_APIENTRY*LPALGETSOURCEDVSOFT)(ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT); typedef void (AL_APIENTRY*LPALSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT); typedef void (AL_APIENTRY*LPALSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALSOURCEI64VSOFT)(ALuint,ALenum,const ALint64SOFT*); typedef void (AL_APIENTRY*LPALSOURCEI64VSOFT)(ALuint,ALenum,const ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT*); typedef void (AL_APIENTRY*LPALGETSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*); typedef void (AL_APIENTRY*LPALGETSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETSOURCEI64VSOFT)(ALuint,ALenum,ALint64SOFT*); typedef void (AL_APIENTRY*LPALGETSOURCEI64VSOFT)(ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value); AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3); AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values); AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *value); AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3); AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble *values); AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value); AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3); AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values); AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT *value); AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT *value) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3); AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64SOFT *values); AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64SOFT *values) AL_API_NOEXCEPT;
#endif #endif
#endif #endif
#ifndef ALC_EXT_DEFAULT_FILTER_ORDER
#define ALC_EXT_DEFAULT_FILTER_ORDER 1
#define ALC_DEFAULT_FILTER_ORDER 0x1100
#endif
#ifndef AL_SOFT_deferred_updates
#define AL_SOFT_deferred_updates 1
#define AL_DEFERRED_UPDATES_SOFT 0xC002
typedef void (AL_APIENTRY*LPALDEFERUPDATESSOFT)(void) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPROCESSUPDATESSOFT)(void) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alDeferUpdatesSOFT(void) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alProcessUpdatesSOFT(void) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_block_alignment
#define AL_SOFT_block_alignment 1
#define AL_UNPACK_BLOCK_ALIGNMENT_SOFT 0x200C
#define AL_PACK_BLOCK_ALIGNMENT_SOFT 0x200D
#endif
#ifndef AL_SOFT_MSADPCM
#define AL_SOFT_MSADPCM 1
#define AL_FORMAT_MONO_MSADPCM_SOFT 0x1302
#define AL_FORMAT_STEREO_MSADPCM_SOFT 0x1303
#endif
#ifndef AL_SOFT_source_length
#define AL_SOFT_source_length 1
/*#define AL_BYTE_LENGTH_SOFT 0x2009*/
/*#define AL_SAMPLE_LENGTH_SOFT 0x200A*/
/*#define AL_SEC_LENGTH_SOFT 0x200B*/
#endif
#ifndef AL_SOFT_buffer_length_query
#define AL_SOFT_buffer_length_query 1
/*#define AL_BYTE_LENGTH_SOFT 0x2009*/
/*#define AL_SAMPLE_LENGTH_SOFT 0x200A*/
/*#define AL_SEC_LENGTH_SOFT 0x200B*/
#endif
#ifndef ALC_SOFT_pause_device
#define ALC_SOFT_pause_device 1
typedef void (ALC_APIENTRY*LPALCDEVICEPAUSESOFT)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY*LPALCDEVICERESUMESOFT)(ALCdevice *device) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALC_API void ALC_APIENTRY alcDevicePauseSOFT(ALCdevice *device) ALC_API_NOEXCEPT;
ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_EXT_BFORMAT
#define AL_EXT_BFORMAT 1
/* Provides support for B-Format ambisonic buffers (first-order, FuMa scaling
* and layout).
*
* BFORMAT2D_8: Unsigned 8-bit, 3-channel non-periphonic (WXY).
* BFORMAT2D_16: Signed 16-bit, 3-channel non-periphonic (WXY).
* BFORMAT2D_FLOAT32: 32-bit float, 3-channel non-periphonic (WXY).
* BFORMAT3D_8: Unsigned 8-bit, 4-channel periphonic (WXYZ).
* BFORMAT3D_16: Signed 16-bit, 4-channel periphonic (WXYZ).
* BFORMAT3D_FLOAT32: 32-bit float, 4-channel periphonic (WXYZ).
*/
#define AL_FORMAT_BFORMAT2D_8 0x20021
#define AL_FORMAT_BFORMAT2D_16 0x20022
#define AL_FORMAT_BFORMAT2D_FLOAT32 0x20023
#define AL_FORMAT_BFORMAT3D_8 0x20031
#define AL_FORMAT_BFORMAT3D_16 0x20032
#define AL_FORMAT_BFORMAT3D_FLOAT32 0x20033
#endif
#ifndef AL_EXT_MULAW_BFORMAT
#define AL_EXT_MULAW_BFORMAT 1
#define AL_FORMAT_BFORMAT2D_MULAW 0x10031
#define AL_FORMAT_BFORMAT3D_MULAW 0x10032
#endif
#ifndef ALC_SOFT_HRTF
#define ALC_SOFT_HRTF 1
#define ALC_HRTF_SOFT 0x1992
#define ALC_DONT_CARE_SOFT 0x0002
#define ALC_HRTF_STATUS_SOFT 0x1993
#define ALC_HRTF_DISABLED_SOFT 0x0000
#define ALC_HRTF_ENABLED_SOFT 0x0001
#define ALC_HRTF_DENIED_SOFT 0x0002
#define ALC_HRTF_REQUIRED_SOFT 0x0003
#define ALC_HRTF_HEADPHONES_DETECTED_SOFT 0x0004
#define ALC_HRTF_UNSUPPORTED_FORMAT_SOFT 0x0005
#define ALC_NUM_HRTF_SPECIFIERS_SOFT 0x1994
#define ALC_HRTF_SPECIFIER_SOFT 0x1995
#define ALC_HRTF_ID_SOFT 0x1996
typedef const ALCchar* (ALC_APIENTRY*LPALCGETSTRINGISOFT)(ALCdevice *device, ALCenum paramName, ALCsizei index) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY*LPALCRESETDEVICESOFT)(ALCdevice *device, const ALCint *attribs) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALC_API const ALCchar* ALC_APIENTRY alcGetStringiSOFT(ALCdevice *device, ALCenum paramName, ALCsizei index) ALC_API_NOEXCEPT;
ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCint *attribs) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_gain_clamp_ex
#define AL_SOFT_gain_clamp_ex 1
#define AL_GAIN_LIMIT_SOFT 0x200E
#endif
#ifndef AL_SOFT_source_resampler
#define AL_SOFT_source_resampler
#define AL_NUM_RESAMPLERS_SOFT 0x1210
#define AL_DEFAULT_RESAMPLER_SOFT 0x1211
#define AL_SOURCE_RESAMPLER_SOFT 0x1212
#define AL_RESAMPLER_NAME_SOFT 0x1213
typedef const ALchar* (AL_APIENTRY*LPALGETSTRINGISOFT)(ALenum pname, ALsizei index) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_source_spatialize
#define AL_SOFT_source_spatialize
#define AL_SOURCE_SPATIALIZE_SOFT 0x1214
#define AL_AUTO_SOFT 0x0002
#endif
#ifndef ALC_SOFT_output_limiter
#define ALC_SOFT_output_limiter
#define ALC_OUTPUT_LIMITER_SOFT 0x199A
#endif
#ifndef ALC_SOFT_device_clock
#define ALC_SOFT_device_clock 1
typedef _alsoft_int64_t ALCint64SOFT;
typedef _alsoft_uint64_t ALCuint64SOFT;
#define ALC_DEVICE_CLOCK_SOFT 0x1600
#define ALC_DEVICE_LATENCY_SOFT 0x1601
#define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602
#define AL_SAMPLE_OFFSET_CLOCK_SOFT 0x1202
#define AL_SEC_OFFSET_CLOCK_SOFT 0x1203
typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_direct_channels_remix
#define AL_SOFT_direct_channels_remix 1
#define AL_DROP_UNMATCHED_SOFT 0x0001
#define AL_REMIX_UNMATCHED_SOFT 0x0002
#endif
#ifndef AL_SOFT_bformat_ex
#define AL_SOFT_bformat_ex 1
#define AL_AMBISONIC_LAYOUT_SOFT 0x1997
#define AL_AMBISONIC_SCALING_SOFT 0x1998
/* Ambisonic layouts */
#define AL_FUMA_SOFT 0x0000
#define AL_ACN_SOFT 0x0001
/* Ambisonic scalings (normalization) */
/*#define AL_FUMA_SOFT*/
#define AL_SN3D_SOFT 0x0001
#define AL_N3D_SOFT 0x0002
#endif
#ifndef ALC_SOFT_loopback_bformat
#define ALC_SOFT_loopback_bformat 1
#define ALC_AMBISONIC_LAYOUT_SOFT 0x1997
#define ALC_AMBISONIC_SCALING_SOFT 0x1998
#define ALC_AMBISONIC_ORDER_SOFT 0x1999
#define ALC_MAX_AMBISONIC_ORDER_SOFT 0x199B
#define ALC_BFORMAT3D_SOFT 0x1507
/* Ambisonic layouts */
#define ALC_FUMA_SOFT 0x0000
#define ALC_ACN_SOFT 0x0001
/* Ambisonic scalings (normalization) */
/*#define ALC_FUMA_SOFT*/
#define ALC_SN3D_SOFT 0x0001
#define ALC_N3D_SOFT 0x0002
#endif
#ifndef AL_SOFT_effect_target
#define AL_SOFT_effect_target
#define AL_EFFECTSLOT_TARGET_SOFT 0x199C
#endif
#ifndef AL_SOFT_events
#define AL_SOFT_events 1
#define AL_EVENT_CALLBACK_FUNCTION_SOFT 0x19A2
#define AL_EVENT_CALLBACK_USER_PARAM_SOFT 0x19A3
#define AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT 0x19A4
#define AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT 0x19A5
#define AL_EVENT_TYPE_DISCONNECTED_SOFT 0x19A6
typedef void (AL_APIENTRY*ALEVENTPROCSOFT)(ALenum eventType, ALuint object, ALuint param,
ALsizei length, const ALchar *message, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALEVENTCONTROLSOFT)(ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALEVENTCALLBACKSOFT)(ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY*LPALGETPOINTERSOFT)(ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETPOINTERVSOFT)(ALenum pname, void **values) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT;
AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetPointervSOFT(ALenum pname, void **values) AL_API_NOEXCEPT;
#endif
#endif
#ifndef ALC_SOFT_reopen_device
#define ALC_SOFT_reopen_device
typedef ALCboolean (ALC_APIENTRY*LPALCREOPENDEVICESOFT)(ALCdevice *device,
const ALCchar *deviceName, const ALCint *attribs) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALCboolean ALC_APIENTRY alcReopenDeviceSOFT(ALCdevice *device, const ALCchar *deviceName,
const ALCint *attribs) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_callback_buffer
#define AL_SOFT_callback_buffer
#define AL_BUFFER_CALLBACK_FUNCTION_SOFT 0x19A0
#define AL_BUFFER_CALLBACK_USER_PARAM_SOFT 0x19A1
typedef ALsizei (AL_APIENTRY*ALBUFFERCALLBACKTYPESOFT)(ALvoid *userptr, ALvoid *sampledata, ALsizei numbytes) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALBUFFERCALLBACKSOFT)(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETBUFFERPTRSOFT)(ALuint buffer, ALenum param, ALvoid **value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETBUFFER3PTRSOFT)(ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETBUFFERPTRVSOFT)(ALuint buffer, ALenum param, ALvoid **values) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alBufferCallbackSOFT(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferPtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBuffer3PtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr0, ALvoid **ptr1, ALvoid **ptr2) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferPtrvSOFT(ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_UHJ
#define AL_SOFT_UHJ
#define AL_FORMAT_UHJ2CHN8_SOFT 0x19A2
#define AL_FORMAT_UHJ2CHN16_SOFT 0x19A3
#define AL_FORMAT_UHJ2CHN_FLOAT32_SOFT 0x19A4
#define AL_FORMAT_UHJ3CHN8_SOFT 0x19A5
#define AL_FORMAT_UHJ3CHN16_SOFT 0x19A6
#define AL_FORMAT_UHJ3CHN_FLOAT32_SOFT 0x19A7
#define AL_FORMAT_UHJ4CHN8_SOFT 0x19A8
#define AL_FORMAT_UHJ4CHN16_SOFT 0x19A9
#define AL_FORMAT_UHJ4CHN_FLOAT32_SOFT 0x19AA
#define AL_STEREO_MODE_SOFT 0x19B0
#define AL_NORMAL_SOFT 0x0000
#define AL_SUPER_STEREO_SOFT 0x0001
#define AL_SUPER_STEREO_WIDTH_SOFT 0x19B1
#endif
#ifndef AL_SOFT_UHJ_ex
#define AL_SOFT_UHJ_ex
#define AL_FORMAT_UHJ2CHN_MULAW_SOFT 0x19B3
#define AL_FORMAT_UHJ2CHN_ALAW_SOFT 0x19B4
#define AL_FORMAT_UHJ2CHN_IMA4_SOFT 0x19B5
#define AL_FORMAT_UHJ2CHN_MSADPCM_SOFT 0x19B6
#define AL_FORMAT_UHJ3CHN_MULAW_SOFT 0x19B7
#define AL_FORMAT_UHJ3CHN_ALAW_SOFT 0x19B8
#define AL_FORMAT_UHJ4CHN_MULAW_SOFT 0x19B9
#define AL_FORMAT_UHJ4CHN_ALAW_SOFT 0x19BA
#endif
#ifndef ALC_SOFT_output_mode
#define ALC_SOFT_output_mode
#define ALC_OUTPUT_MODE_SOFT 0x19AC
#define ALC_ANY_SOFT 0x19AD
/*#define ALC_MONO_SOFT 0x1500*/
/*#define ALC_STEREO_SOFT 0x1501*/
#define ALC_STEREO_BASIC_SOFT 0x19AE
#define ALC_STEREO_UHJ_SOFT 0x19AF
#define ALC_STEREO_HRTF_SOFT 0x19B2
/*#define ALC_QUAD_SOFT 0x1503*/
#define ALC_SURROUND_5_1_SOFT 0x1504
#define ALC_SURROUND_6_1_SOFT 0x1505
#define ALC_SURROUND_7_1_SOFT 0x1506
#endif
#ifndef AL_SOFT_source_start_delay
#define AL_SOFT_source_start_delay
typedef void (AL_APIENTRY*LPALSOURCEPLAYATTIMESOFT)(ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALSOURCEPLAYATTIMEVSOFT)(ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
void AL_APIENTRY alSourcePlayAtTimeSOFT(ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayAtTimevSOFT(ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT;
#endif
#endif
#ifndef ALC_EXT_debug
#define ALC_EXT_debug
#define ALC_CONTEXT_FLAGS_EXT 0x19CF
#define ALC_CONTEXT_DEBUG_BIT_EXT 0x0001
#endif
#ifndef AL_EXT_debug
#define AL_EXT_debug
#define AL_DONT_CARE_EXT 0x0002
#define AL_DEBUG_OUTPUT_EXT 0x19B2
#define AL_DEBUG_CALLBACK_FUNCTION_EXT 0x19B3
#define AL_DEBUG_CALLBACK_USER_PARAM_EXT 0x19B4
#define AL_DEBUG_SOURCE_API_EXT 0x19B5
#define AL_DEBUG_SOURCE_AUDIO_SYSTEM_EXT 0x19B6
#define AL_DEBUG_SOURCE_THIRD_PARTY_EXT 0x19B7
#define AL_DEBUG_SOURCE_APPLICATION_EXT 0x19B8
#define AL_DEBUG_SOURCE_OTHER_EXT 0x19B9
#define AL_DEBUG_TYPE_ERROR_EXT 0x19BA
#define AL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_EXT 0x19BB
#define AL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_EXT 0x19BC
#define AL_DEBUG_TYPE_PORTABILITY_EXT 0x19BD
#define AL_DEBUG_TYPE_PERFORMANCE_EXT 0x19BE
#define AL_DEBUG_TYPE_MARKER_EXT 0x19BF
#define AL_DEBUG_TYPE_PUSH_GROUP_EXT 0x19C0
#define AL_DEBUG_TYPE_POP_GROUP_EXT 0x19C1
#define AL_DEBUG_TYPE_OTHER_EXT 0x19C2
#define AL_DEBUG_SEVERITY_HIGH_EXT 0x19C3
#define AL_DEBUG_SEVERITY_MEDIUM_EXT 0x19C4
#define AL_DEBUG_SEVERITY_LOW_EXT 0x19C5
#define AL_DEBUG_SEVERITY_NOTIFICATION_EXT 0x19C6
#define AL_DEBUG_LOGGED_MESSAGES_EXT 0x19C7
#define AL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_EXT 0x19C8
#define AL_MAX_DEBUG_MESSAGE_LENGTH_EXT 0x19C9
#define AL_MAX_DEBUG_LOGGED_MESSAGES_EXT 0x19CA
#define AL_MAX_DEBUG_GROUP_STACK_DEPTH_EXT 0x19CB
#define AL_MAX_LABEL_LENGTH_EXT 0x19CC
#define AL_STACK_OVERFLOW_EXT 0x19CD
#define AL_STACK_UNDERFLOW_EXT 0x19CE
#define AL_CONTEXT_FLAGS_EXT 0x19CF
#define AL_BUFFER_EXT 0x1009 /* Same as AL_BUFFER */
#define AL_SOURCE_EXT 0x19D0
#define AL_FILTER_EXT 0x19D1
#define AL_EFFECT_EXT 0x19D2
#define AL_AUXILIARY_EFFECT_SLOT_EXT 0x19D3
typedef void (AL_APIENTRY*ALDEBUGPROCEXT)(ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECALLBACKEXT)(ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGEINSERTEXT)(ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECONTROLEXT)(ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPUSHDEBUGGROUPEXT)(ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPOPDEBUGGROUPEXT)(void) AL_API_NOEXCEPT17;
typedef ALuint (AL_APIENTRY*LPALGETDEBUGMESSAGELOGEXT)(ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALOBJECTLABELEXT)(ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETOBJECTLABELEXT)(ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY*LPALGETPOINTEREXT)(ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETPOINTERVEXT)(ALenum pname, void **values) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
void AL_APIENTRY alDebugMessageCallbackEXT(ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageInsertEXT(ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageControlEXT(ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT;
void AL_APIENTRY alPushDebugGroupEXT(ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alPopDebugGroupEXT(void) AL_API_NOEXCEPT;
ALuint AL_APIENTRY alGetDebugMessageLogEXT(ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT;
void AL_APIENTRY alObjectLabelEXT(ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT;
void AL_APIENTRY alGetObjectLabelEXT(ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetPointerEXT(ALenum pname) AL_API_NOEXCEPT;
void AL_APIENTRY alGetPointervEXT(ALenum pname, void **values) AL_API_NOEXCEPT;
#endif
#endif
#ifndef ALC_SOFT_system_events
#define ALC_SOFT_system_events
#define ALC_PLAYBACK_DEVICE_SOFT 0x19D4
#define ALC_CAPTURE_DEVICE_SOFT 0x19D5
#define ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT 0x19D6
#define ALC_EVENT_TYPE_DEVICE_ADDED_SOFT 0x19D7
#define ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT 0x19D8
#define ALC_EVENT_SUPPORTED_SOFT 0x19D9
#define ALC_EVENT_NOT_SUPPORTED_SOFT 0x19DA
typedef void (ALC_APIENTRY*ALCEVENTPROCTYPESOFT)(ALCenum eventType, ALCenum deviceType,
ALCdevice *device, ALCsizei length, const ALCchar *message, void *userParam) ALC_API_NOEXCEPT17;
typedef ALCenum (ALC_APIENTRY*LPALCEVENTISSUPPORTEDSOFT)(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY*LPALCEVENTCONTROLSOFT)(ALCsizei count, const ALCenum *events, ALCboolean enable) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY*LPALCEVENTCALLBACKSOFT)(ALCEVENTPROCTYPESOFT callback, void *userParam) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT;
ALCboolean ALC_APIENTRY alcEventControlSOFT(ALCsizei count, const ALCenum *events, ALCboolean enable) ALC_API_NOEXCEPT;
void ALC_APIENTRY alcEventCallbackSOFT(ALCEVENTPROCTYPESOFT callback, void *userParam) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_EXT_direct_context
#define AL_EXT_direct_context
typedef ALCvoid* (ALC_APIENTRY *LPALCGETPROCADDRESS2)(ALCdevice *device, const ALCchar *funcname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALENABLEDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISABLEDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISENABLEDDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDOPPLERFACTORDIRECT)(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSPEEDOFSOUNDDIRECT)(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISTANCEMODELDIRECT)(ALCcontext *context, ALenum distanceModel) AL_API_NOEXCEPT17;
typedef const ALchar* (AL_APIENTRY *LPALGETSTRINGDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBOOLEANVDIRECT)(ALCcontext *context, ALenum param, ALboolean *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETINTEGERVDIRECT)(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFLOATVDIRECT)(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETDOUBLEVDIRECT)(ALCcontext *context, ALenum param, ALdouble *values) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEANDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALint (AL_APIENTRY *LPALGETINTEGERDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALfloat (AL_APIENTRY *LPALGETFLOATDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLEDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPALGETERRORDIRECT)(ALCcontext *context) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENTDIRECT)(ALCcontext *context, const ALchar *extname) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY *LPALGETPROCADDRESSDIRECT)(ALCcontext *context, const ALchar *fname) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUEDIRECT)(ALCcontext *context, const ALchar *ename) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERFDIRECT)(ALCcontext *context, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENER3FDIRECT)(ALCcontext *context, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERFVDIRECT)(ALCcontext *context, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERIDIRECT)(ALCcontext *context, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENER3IDIRECT)(ALCcontext *context, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERIVDIRECT)(ALCcontext *context, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERFDIRECT)(ALCcontext *context, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENER3FDIRECT)(ALCcontext *context, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERFVDIRECT)(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERIDIRECT)(ALCcontext *context, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENER3IDIRECT)(ALCcontext *context, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERIVDIRECT)(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENSOURCESDIRECT)(ALCcontext *context, ALsizei n, ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETESOURCESDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISSOURCEDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEFDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3FDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEFVDIRECT)(ALCcontext *context, ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEIDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3IDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEIVDIRECT)(ALCcontext *context, ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEFDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3FDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEFVDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEIDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3IDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEIVDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAYDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCESTOPDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEREWINDDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPAUSEDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAYVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCESTOPVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEREWINDVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPAUSEVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERSDIRECT)(ALCcontext *context, ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERSDIRECT)(ALCcontext *context, ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENBUFFERSDIRECT)(ALCcontext *context, ALsizei n, ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEBUFFERSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISBUFFERDIRECT)(ALCcontext *context, ALuint buffer) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERDATADIRECT)(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERFDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFER3FDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERFVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERIDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFER3IDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERIVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERFDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3FDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERFVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERIDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3IDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERIVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT17;
/* ALC_EXT_EFX */
typedef void (AL_APIENTRY *LPALGENEFFECTSDIRECT)(ALCcontext *context, ALsizei n, ALuint *effects) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEEFFECTSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *effects) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISEFFECTDIRECT)(ALCcontext *context, ALuint effect) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTIDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTIVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTFDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTFVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTIDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTIVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTFDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTFVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENFILTERSDIRECT)(ALCcontext *context, ALsizei n, ALuint *filters) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEFILTERSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *filters) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISFILTERDIRECT)(ALCcontext *context, ALuint filter) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERIDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERIVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERFDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERFVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERIDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERIVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERFDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERFVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTSDIRECT)(ALCcontext *context, ALsizei n, ALuint *effectslots) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *effectslots) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOTDIRECT)(ALCcontext *context, ALuint effectslot) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
/* AL_EXT_BUFFER_DATA_STATIC */
typedef void (AL_APIENTRY *LPALBUFFERDATASTATICDIRECT)(ALCcontext *context, ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq) AL_API_NOEXCEPT17;
/* AL_EXT_debug */
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECALLBACKDIRECTEXT)(ALCcontext *context, ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGEINSERTDIRECTEXT)(ALCcontext *context, ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECONTROLDIRECTEXT)(ALCcontext *context, ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPUSHDEBUGGROUPDIRECTEXT)(ALCcontext *context, ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPOPDEBUGGROUPDIRECTEXT)(ALCcontext *context) AL_API_NOEXCEPT17;
typedef ALuint (AL_APIENTRY*LPALGETDEBUGMESSAGELOGDIRECTEXT)(ALCcontext *context, ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALOBJECTLABELDIRECTEXT)(ALCcontext *context, ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETOBJECTLABELDIRECTEXT)(ALCcontext *context, ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY*LPALGETPOINTERDIRECTEXT)(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETPOINTERVDIRECTEXT)(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT17;
/* AL_EXT_FOLDBACK */
typedef void (AL_APIENTRY *LPALREQUESTFOLDBACKSTARTDIRECT)(ALCcontext *context, ALenum mode, ALsizei count, ALsizei length, ALfloat *mem, LPALFOLDBACKCALLBACK callback) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALREQUESTFOLDBACKSTOPDIRECT)(ALCcontext *context) AL_API_NOEXCEPT17;
/* AL_SOFT_buffer_sub_data */
typedef void (AL_APIENTRY *LPALBUFFERSUBDATADIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei offset, ALsizei length) AL_API_NOEXCEPT17;
/* AL_SOFT_source_latency */
typedef void (AL_APIENTRY *LPALSOURCEDDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3DDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble,ALdouble,ALdouble) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEDVDIRECTSOFT)(ALCcontext*,ALuint,ALenum,const ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEDDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3DDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEDVDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEI64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3I64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEI64VDIRECTSOFT)(ALCcontext*,ALuint,ALenum,const ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEI64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3I64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEI64VDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17;
/* AL_SOFT_deferred_updates */
typedef void (AL_APIENTRY *LPALDEFERUPDATESDIRECTSOFT)(ALCcontext *context) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALPROCESSUPDATESDIRECTSOFT)(ALCcontext *context) AL_API_NOEXCEPT17;
/* AL_SOFT_source_resampler */
typedef const ALchar* (AL_APIENTRY *LPALGETSTRINGIDIRECTSOFT)(ALCcontext *context, ALenum pname, ALsizei index) AL_API_NOEXCEPT17;
/* AL_SOFT_events */
typedef void (AL_APIENTRY *LPALEVENTCONTROLDIRECTSOFT)(ALCcontext *context, ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEVENTCALLBACKDIRECTSOFT)(ALCcontext *context, ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY *LPALGETPOINTERDIRECTSOFT)(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETPOINTERVDIRECTSOFT)(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT17;
/* AL_SOFT_callback_buffer */
typedef void (AL_APIENTRY *LPALBUFFERCALLBACKDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERPTRDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3PTRDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERPTRVDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **values) AL_API_NOEXCEPT17;
/* AL_SOFT_source_start_delay */
typedef void (AL_APIENTRY *LPALSOURCEPLAYATTIMEDIRECTSOFT)(ALCcontext *context, ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAYATTIMEVDIRECTSOFT)(ALCcontext *context, ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT17;
/* EAX */
typedef ALenum (AL_APIENTRY *LPEAXSETDIRECT)(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPEAXGETDIRECT)(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPEAXSETBUFFERMODEDIRECT)(ALCcontext *context, ALsizei n, const ALuint *buffers, ALint value) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPEAXGETBUFFERMODEDIRECT)(ALCcontext *context, ALuint buffer, ALint *pReserved) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALCvoid* ALC_APIENTRY alcGetProcAddress2(ALCdevice *device, const ALCchar *funcName) AL_API_NOEXCEPT;
void AL_APIENTRY alEnableDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
void AL_APIENTRY alDisableDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsEnabledDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
void AL_APIENTRY alDopplerFactorDirect(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alSpeedOfSoundDirect(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alDistanceModelDirect(ALCcontext *context, ALenum distanceModel) AL_API_NOEXCEPT;
const ALchar* AL_APIENTRY alGetStringDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBooleanvDirect(ALCcontext *context, ALenum param, ALboolean *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetIntegervDirect(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFloatvDirect(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetDoublevDirect(ALCcontext *context, ALenum param, ALdouble *values) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alGetBooleanDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALint AL_APIENTRY alGetIntegerDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALfloat AL_APIENTRY alGetFloatDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALdouble AL_APIENTRY alGetDoubleDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALenum AL_APIENTRY alGetErrorDirect(ALCcontext *context) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsExtensionPresentDirect(ALCcontext *context, const ALchar *extname) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetProcAddressDirect(ALCcontext *context, const ALchar *fname) AL_API_NOEXCEPT;
ALenum AL_APIENTRY alGetEnumValueDirect(ALCcontext *context, const ALchar *ename) AL_API_NOEXCEPT;
void AL_APIENTRY alListenerfDirect(ALCcontext *context, ALenum param, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alListener3fDirect(ALCcontext *context, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
void AL_APIENTRY alListenerfvDirect(ALCcontext *context, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alListeneriDirect(ALCcontext *context, ALenum param, ALint value) AL_API_NOEXCEPT;
void AL_APIENTRY alListener3iDirect(ALCcontext *context, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
void AL_APIENTRY alListenerivDirect(ALCcontext *context, ALenum param, const ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListenerfDirect(ALCcontext *context, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListener3fDirect(ALCcontext *context, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListenerfvDirect(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListeneriDirect(ALCcontext *context, ALenum param, ALint *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListener3iDirect(ALCcontext *context, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListenerivDirect(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGenSourcesDirect(ALCcontext *context, ALsizei n, ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteSourcesDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsSourceDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcefDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3fDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcefvDirect(ALCcontext *context, ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceiDirect(ALCcontext *context, ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3iDirect(ALCcontext *context, ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceivDirect(ALCcontext *context, ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcefDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3fDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcefvDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourceiDirect(ALCcontext *context, ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3iDirect(ALCcontext *context, ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourceivDirect(ALCcontext *context, ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceStopDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceRewindDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePauseDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayvDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceStopvDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceRewindvDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePausevDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceQueueBuffersDirect(ALCcontext *context, ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceUnqueueBuffersDirect(ALCcontext *context, ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT;
void AL_APIENTRY alGenBuffersDirect(ALCcontext *context, ALsizei n, ALuint *buffers) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteBuffersDirect(ALCcontext *context, ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsBufferDirect(ALCcontext *context, ALuint buffer) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferDataDirect(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferfDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alBuffer3fDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferfvDirect(ALCcontext *context, ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferiDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT;
void AL_APIENTRY alBuffer3iDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferivDirect(ALCcontext *context, ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferfDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBuffer3fDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferfvDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferiDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBuffer3iDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferivDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGenEffectsDirect(ALCcontext *context, ALsizei n, ALuint *effects) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteEffectsDirect(ALCcontext *context, ALsizei n, const ALuint *effects) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsEffectDirect(ALCcontext *context, ALuint effect) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectiDirect(ALCcontext *context, ALuint effect, ALenum param, ALint iValue) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectivDirect(ALCcontext *context, ALuint effect, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectfDirect(ALCcontext *context, ALuint effect, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectfvDirect(ALCcontext *context, ALuint effect, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectiDirect(ALCcontext *context, ALuint effect, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectivDirect(ALCcontext *context, ALuint effect, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectfDirect(ALCcontext *context, ALuint effect, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectfvDirect(ALCcontext *context, ALuint effect, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGenFiltersDirect(ALCcontext *context, ALsizei n, ALuint *filters) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteFiltersDirect(ALCcontext *context, ALsizei n, const ALuint *filters) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsFilterDirect(ALCcontext *context, ALuint filter) AL_API_NOEXCEPT;
void AL_APIENTRY alFilteriDirect(ALCcontext *context, ALuint filter, ALenum param, ALint iValue) AL_API_NOEXCEPT;
void AL_APIENTRY alFilterivDirect(ALCcontext *context, ALuint filter, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alFilterfDirect(ALCcontext *context, ALuint filter, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
void AL_APIENTRY alFilterfvDirect(ALCcontext *context, ALuint filter, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilteriDirect(ALCcontext *context, ALuint filter, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilterivDirect(ALCcontext *context, ALuint filter, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilterfDirect(ALCcontext *context, ALuint filter, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilterfvDirect(ALCcontext *context, ALuint filter, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGenAuxiliaryEffectSlotsDirect(ALCcontext *context, ALsizei n, ALuint *effectslots) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteAuxiliaryEffectSlotsDirect(ALCcontext *context, ALsizei n, const ALuint *effectslots) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsAuxiliaryEffectSlotDirect(ALCcontext *context, ALuint effectslot) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotiDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALint iValue) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotivDirect(ALCcontext *context, ALuint effectslot, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotfDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotfvDirect(ALCcontext *context, ALuint effectslot, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotiDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotivDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotfDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotfvDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferDataStaticDirect(ALCcontext *context, ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageCallbackDirectEXT(ALCcontext *context, ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageInsertDirectEXT(ALCcontext *context, ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageControlDirectEXT(ALCcontext *context, ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT;
void AL_APIENTRY alPushDebugGroupDirectEXT(ALCcontext *context, ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alPopDebugGroupDirectEXT(ALCcontext *context) AL_API_NOEXCEPT;
ALuint AL_APIENTRY alGetDebugMessageLogDirectEXT(ALCcontext *context, ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT;
void AL_APIENTRY alObjectLabelDirectEXT(ALCcontext *context, ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT;
void AL_APIENTRY alGetObjectLabelDirectEXT(ALCcontext *context, ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetPointerDirectEXT(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT;
void AL_APIENTRY alGetPointervDirectEXT(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT;
void AL_APIENTRY alRequestFoldbackStartDirect(ALCcontext *context, ALenum mode, ALsizei count, ALsizei length, ALfloat *mem, LPALFOLDBACKCALLBACK callback) AL_API_NOEXCEPT;
void AL_APIENTRY alRequestFoldbackStopDirect(ALCcontext *context) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferSubDataDirectSOFT(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei offset, ALsizei length) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcedDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3dDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcedvDirectSOFT(ALCcontext *context, ALuint source, ALenum param, const ALdouble *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcedDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3dDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcedvDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble *values) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcei64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3i64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcei64vDirectSOFT(ALCcontext *context, ALuint source, ALenum param, const ALint64SOFT *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcei64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3i64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcei64vDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT *values) AL_API_NOEXCEPT;
void AL_APIENTRY alDeferUpdatesDirectSOFT(ALCcontext *context) AL_API_NOEXCEPT;
void AL_APIENTRY alProcessUpdatesDirectSOFT(ALCcontext *context) AL_API_NOEXCEPT;
const ALchar* AL_APIENTRY alGetStringiDirectSOFT(ALCcontext *context, ALenum pname, ALsizei index) AL_API_NOEXCEPT;
void AL_APIENTRY alEventControlDirectSOFT(ALCcontext *context, ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT;
void AL_APIENTRY alEventCallbackDirectSOFT(ALCcontext *context, ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetPointerDirectSOFT(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT;
void AL_APIENTRY alGetPointervDirectSOFT(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferCallbackDirectSOFT(ALCcontext *context, ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferPtrDirectSOFT(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBuffer3PtrDirectSOFT(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **ptr0, ALvoid **ptr1, ALvoid **ptr2) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferPtrvDirectSOFT(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayAtTimeDirectSOFT(ALCcontext *context, ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayAtTimevDirectSOFT(ALCcontext *context, ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT;
ALenum AL_APIENTRY EAXSetDirect(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT;
ALenum AL_APIENTRY EAXGetDirect(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY EAXSetBufferModeDirect(ALCcontext *context, ALsizei n, const ALuint *buffers, ALint value) AL_API_NOEXCEPT;
ALenum AL_APIENTRY EAXGetBufferModeDirect(ALCcontext *context, ALuint buffer, ALint *pReserved) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_bformat_hoa
#define AL_SOFT_bformat_hoa
#define AL_UNPACK_AMBISONIC_ORDER_SOFT 0x199D
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* NOLINTEND */
#endif #endif

View file

@ -2,6 +2,7 @@
#ifndef EFX_PRESETS_H #ifndef EFX_PRESETS_H
#define EFX_PRESETS_H #define EFX_PRESETS_H
/* NOLINTBEGIN */
#ifndef EFXEAXREVERBPROPERTIES_DEFINED #ifndef EFXEAXREVERBPROPERTIES_DEFINED
#define EFXEAXREVERBPROPERTIES_DEFINED #define EFXEAXREVERBPROPERTIES_DEFINED
@ -345,7 +346,7 @@ typedef struct {
/* Driving Presets */ /* Driving Presets */
#define EFX_REVERB_PRESET_DRIVING_COMMENTATOR \ #define EFX_REVERB_PRESET_DRIVING_COMMENTATOR \
{ 1.0000f, 0.0000f, 3.1623f, 0.5623f, 0.5012f, 2.4200f, 0.8800f, 0.6800f, 0.1995f, 0.0930f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x1 } { 1.0000f, 0.0000f, 0.3162f, 0.5623f, 0.5012f, 2.4200f, 0.8800f, 0.6800f, 0.1995f, 0.0930f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
#define EFX_REVERB_PRESET_DRIVING_PITGARAGE \ #define EFX_REVERB_PRESET_DRIVING_PITGARAGE \
{ 0.4287f, 0.5900f, 0.3162f, 0.7079f, 0.5623f, 1.7200f, 0.9300f, 0.8700f, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 } { 0.4287f, 0.5900f, 0.3162f, 0.7079f, 0.5623f, 1.7200f, 0.9300f, 0.8700f, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
@ -399,4 +400,5 @@ typedef struct {
#define EFX_REVERB_PRESET_SMALLWATERROOM \ #define EFX_REVERB_PRESET_SMALLWATERROOM \
{ 1.0000f, 0.7000f, 0.3162f, 0.4477f, 1.0000f, 1.5100f, 1.2500f, 1.1400f, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x0 } { 1.0000f, 0.7000f, 0.3162f, 0.4477f, 1.0000f, 1.5100f, 1.2500f, 1.1400f, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
/* NOLINTEND */
#endif /* EFX_PRESETS_H */ #endif /* EFX_PRESETS_H */

View file

@ -1,6 +1,8 @@
#ifndef AL_EFX_H #ifndef AL_EFX_H
#define AL_EFX_H #define AL_EFX_H
/* NOLINTBEGIN */
#include <float.h>
#include "alc.h" #include "alc.h"
#include "al.h" #include "al.h"
@ -203,80 +205,80 @@ extern "C" {
/* Effect object function types. */ /* Effect object function types. */
typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*); typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, const ALuint*); typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, const ALuint*) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint); typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint); typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, const ALint*); typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, const ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat); typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, const ALfloat*); typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, const ALfloat*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*); typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*); typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*); typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*); typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17;
/* Filter object function types. */ /* Filter object function types. */
typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*); typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, const ALuint*); typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, const ALuint*) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint); typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint); typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, const ALint*); typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, const ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat); typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, const ALfloat*); typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, const ALfloat*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*); typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*); typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*); typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*); typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17;
/* Auxiliary Effect Slot object function types. */ /* Auxiliary Effect Slot object function types. */
typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*); typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, const ALuint*); typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, const ALuint*) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint); typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint); typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, const ALint*); typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, const ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat); typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, const ALfloat*); typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, const ALfloat*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*); typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*); typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*); typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*); typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects); AL_API void AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects); AL_API void AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect); AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue); AL_API void AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues); AL_API void AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue); AL_API void AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues); AL_API void AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue); AL_API void AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues); AL_API void AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue); AL_API void AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues); AL_API void AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters); AL_API void AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters); AL_API void AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter); AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue); AL_API void AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues); AL_API void AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue); AL_API void AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues); AL_API void AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue); AL_API void AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues); AL_API void AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue); AL_API void AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues); AL_API void AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots); AL_API void AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots); AL_API void AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot); AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue); AL_API void AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues); AL_API void AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue); AL_API void AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues); AL_API void AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue); AL_API void AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues); AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue); AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues); AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
#endif #endif
/* Filter ranges and defaults. */ /* Filter ranges and defaults. */
@ -757,5 +759,6 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
/* NOLINTEND */
#endif /* AL_EFX_H */ #endif /* AL_EFX_H */

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -577,9 +577,9 @@ void CG_RefreshHudDrawElements()
void CG_HudDrawElements() void CG_HudDrawElements()
{ {
int i; int i;
float fX, fY; float fX, fY;
float fWidth, fHeight; float fWidth, fHeight;
vec2_t virtualScale; vec2_t virtualScale;
if (!cg_huddraw_force->integer && !cg_hud->integer) { if (!cg_huddraw_force->integer && !cg_hud->integer) {
@ -638,20 +638,13 @@ void CG_HudDrawElements()
cgi.R_SetColor(cgi.HudDrawElements[i].vColor); cgi.R_SetColor(cgi.HudDrawElements[i].vColor);
if (cgi.HudDrawElements[i].string[0]) { if (cgi.HudDrawElements[i].string[0]) {
fontheader_t* pFont = cgi.HudDrawElements[i].pFont; fontheader_t *pFont = cgi.HudDrawElements[i].pFont;
if (!pFont) { if (!pFont) {
pFont = cgs.media.hudDrawFont; pFont = cgs.media.hudDrawFont;
} }
if (cgi.HudDrawElements[i].bVirtualScreen) { if (cgi.HudDrawElements[i].bVirtualScreen) {
cgi.R_DrawString( cgi.R_DrawString(pFont, cgi.LV_ConvertString(cgi.HudDrawElements[i].string), fX, fY, -1, virtualScale);
pFont,
cgi.LV_ConvertString(cgi.HudDrawElements[i].string),
fX,
fY,
-1,
virtualScale
);
} else { } else {
cgi.R_DrawString( cgi.R_DrawString(
pFont, pFont,
@ -700,8 +693,8 @@ void CG_DrawObjectives()
int i; int i;
int iCurrentObjective; int iCurrentObjective;
float fTimeDelta; float fTimeDelta;
const char *pszLocalizedText; const char *pszLocalizedText;
const char *pszLine; const char *pszLine;
iTotalNumLines = 0; iTotalNumLines = 0;
for (i = CS_OBJECTIVES; i < CS_OBJECTIVES + MAX_OBJECTIVES; ++i) { for (i = CS_OBJECTIVES; i < CS_OBJECTIVES + MAX_OBJECTIVES; ++i) {
@ -732,9 +725,9 @@ void CG_DrawObjectives()
} }
iNumObjectives++; iNumObjectives++;
iNumLines[i] = 0; iNumLines[i] = 0;
pszLocalizedText = cgi.LV_ConvertString(cg.Objectives[i].text); pszLocalizedText = cgi.LV_ConvertString(cg.Objectives[i].text);
for (pszLine = strchr(pszLocalizedText, '\n'); pszLine; pszLine = strchr(pszLine + 1, '\n')) { for (pszLine = strchr(pszLocalizedText, '\n'); pszLine; pszLine = strchr(pszLine + 1, '\n')) {
iNumLines[i]++; iNumLines[i]++;
} }
@ -750,7 +743,17 @@ void CG_DrawObjectives()
vColor[0] = 0.2f; vColor[0] = 0.2f;
vColor[3] = cg.ObjectivesCurrentAlpha * 0.75; vColor[3] = cg.ObjectivesCurrentAlpha * 0.75;
cgi.R_SetColor(vColor); cgi.R_SetColor(vColor);
cgi.R_DrawStretchPic(fX, fY, 450.0 * cgs.uiHiResScale[0], fWidth * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, cgs.media.objectivesBackShader); cgi.R_DrawStretchPic(
fX,
fY,
450.0 * cgs.uiHiResScale[0],
fWidth * cgs.uiHiResScale[1],
0.0,
0.0,
1.0,
1.0,
cgs.media.objectivesBackShader
);
fX = 30.0; fX = 30.0;
fY = fObjectivesTop + 10; fY = fObjectivesTop + 10;
@ -759,15 +762,29 @@ void CG_DrawObjectives()
vColor[2] = 1.0; vColor[2] = 1.0;
vColor[3] = cg.ObjectivesCurrentAlpha; vColor[3] = cg.ObjectivesCurrentAlpha;
cgi.R_SetColor(vColor); cgi.R_SetColor(vColor);
cgi.R_DrawString(cgs.media.objectiveFont, cgi.LV_ConvertString("Mission Objectives:"), fX, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.objectiveFont,
cgi.LV_ConvertString("Mission Objectives:"),
fX,
fY / cgs.uiHiResScale[1],
-1,
cgs.uiHiResScale
);
fY = fY + 5.0; fY = fY + 5.0;
cgi.R_DrawString(cgs.media.objectiveFont, "_______________________________________________________", fX, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.objectiveFont,
"_______________________________________________________",
fX,
fY / cgs.uiHiResScale[1],
-1,
cgs.uiHiResScale
);
fHeight = fObjectivesTop + 35 * cgs.uiHiResScale[1]; fHeight = fObjectivesTop + 35 * cgs.uiHiResScale[1];
for (i = 0; i < MAX_OBJECTIVES; ++i) { for (i = 0; i < MAX_OBJECTIVES; ++i) {
qhandle_t hBoxShader; qhandle_t hBoxShader;
if ((cg.Objectives[i].flags == OBJ_FLAG_NONE) || (cg.Objectives[i].flags & OBJ_FLAG_HIDDEN)) { if ((cg.Objectives[i].flags == OBJ_FLAG_NONE) || (cg.Objectives[i].flags & OBJ_FLAG_HIDDEN)) {
continue; continue;
} }
@ -905,12 +922,28 @@ void CG_DrawPlayerEntInfo()
if (handle) { if (handle) {
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawStretchPic(fX, fY, 16.0 * cgs.uiHiResScale[0], 16.0 * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle); cgi.R_DrawStretchPic(
fX, fY, 16.0 * cgs.uiHiResScale[0], 16.0 * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle
);
} }
cgi.R_SetColor(color); cgi.R_SetColor(color);
cgi.R_DrawString(cgs.media.hudDrawFont, (char *)pszName, fX / cgs.uiHiResScale[0] + 24.0, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgi.R_DrawString(cgs.media.hudDrawFont, va("%i", cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]), fX / cgs.uiHiResScale[0] + 24.0, fY / cgs.uiHiResScale[1] + 20.0, -1, cgs.uiHiResScale); cgs.media.hudDrawFont,
(char *)pszName,
fX / cgs.uiHiResScale[0] + 24.0,
fY / cgs.uiHiResScale[1],
-1,
cgs.uiHiResScale
);
cgi.R_DrawString(
cgs.media.hudDrawFont,
va("%i", cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]),
fX / cgs.uiHiResScale[0] + 24.0,
fY / cgs.uiHiResScale[1] + 20.0,
-1,
cgs.uiHiResScale
);
} }
void CG_UpdateAttackerDisplay() void CG_UpdateAttackerDisplay()
@ -981,12 +1014,14 @@ void CG_UpdateAttackerDisplay()
} }
cgi.R_SetColor(color); cgi.R_SetColor(color);
cgi.R_DrawString(cgs.media.attackerFont, pszName, fX / cgs.uiHiResScale[0] + 32.0, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, pszName, fX / cgs.uiHiResScale[0] + 32.0, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
void CG_UpdateCountdown() void CG_UpdateCountdown()
{ {
const char* message = ""; const char *message = "";
if (!cg.snap) { if (!cg.snap) {
return; return;
@ -998,7 +1033,7 @@ void CG_UpdateCountdown()
iSecondsLeft = (cgs.matchEndTime - cg.time) / 1000; iSecondsLeft = (cgs.matchEndTime - cg.time) / 1000;
if (iSecondsLeft >= 0) { if (iSecondsLeft >= 0) {
iMinutesLeft = iSecondsLeft / 60; iMinutesLeft = iSecondsLeft / 60;
message = va("%s %2i:%02i", cgi.LV_ConvertString("Time Left:"), iMinutesLeft, iSecondsLeft % 60); message = va("%s %2i:%02i", cgi.LV_ConvertString("Time Left:"), iMinutesLeft, iSecondsLeft % 60);
} else if (!cgs.matchEndTime) { } else if (!cgs.matchEndTime) {
message = ""; message = "";
} }
@ -1012,7 +1047,8 @@ void CG_UpdateCountdown()
} }
} }
static void CG_RemoveStopwatch() { static void CG_RemoveStopwatch()
{
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_stopwatch\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_stopwatch\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse_wet\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse_wet\n");
@ -1095,7 +1131,9 @@ void CG_DrawInstantMessageMenu()
x = 8.0; x = 8.0;
y = ((float)cgs.glconfig.vidHeight - h) * 0.5; y = ((float)cgs.glconfig.vidHeight - h) * 0.5;
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawStretchPic(x * cgs.uiHiResScale[0], y, w * cgs.uiHiResScale[0], h * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle); cgi.R_DrawStretchPic(
x * cgs.uiHiResScale[0], y, w * cgs.uiHiResScale[0], h * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle
);
} }
void CG_DrawSpectatorView_ver_15() void CG_DrawSpectatorView_ver_15()
@ -1118,10 +1156,14 @@ void CG_DrawSpectatorView_ver_15()
if (!bOnTeam) { if (!bOnTeam) {
cgi.Key_GetKeysForCommand("+attackprimary", &iKey1, &iKey2); cgi.Key_GetKeysForCommand("+attackprimary", &iKey1, &iKey2);
pszString = cgi.LV_ConvertString(va("Press Fire(%s) to join the battle!", cgi.Key_KeynumToBindString(iKey1))); pszString = cgi.LV_ConvertString(va("Press Fire(%s) to join the battle!", cgi.Key_KeynumToBindString(iKey1)));
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5; fX = (float)(cgs.glconfig.vidWidth
fY = cgs.glconfig.vidHeight - 64.0; - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0])
* 0.5;
fY = cgs.glconfig.vidHeight - 64.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) { if (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) {
@ -1134,10 +1176,14 @@ void CG_DrawSpectatorView_ver_15()
cgi.Key_KeynumToBindString(iKey1b)) cgi.Key_KeynumToBindString(iKey1b))
); );
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5; fX = (float)(cgs.glconfig.vidWidth
fY = (float)cgs.glconfig.vidHeight - 40.0; - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0])
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 40.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) { if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
@ -1145,10 +1191,14 @@ void CG_DrawSpectatorView_ver_15()
pszString = pszString =
cgi.LV_ConvertString(va("Press Use(%s) to enter free spectate mode.", cgi.Key_KeynumToBindString(iKey1))); cgi.LV_ConvertString(va("Press Use(%s) to enter free spectate mode.", cgi.Key_KeynumToBindString(iKey1)));
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5; fX = (float)(cgs.glconfig.vidWidth
fY = (float)cgs.glconfig.vidHeight - 24.0; - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0])
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 24.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if (!(cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) { if (!(cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
@ -1158,20 +1208,27 @@ void CG_DrawSpectatorView_ver_15()
va("Press Use(%s) to enter player following spectate mode.", cgi.Key_KeynumToBindString(iKey1)) va("Press Use(%s) to enter player following spectate mode.", cgi.Key_KeynumToBindString(iKey1))
); );
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5; fX = (float)(cgs.glconfig.vidWidth
fY = (float)cgs.glconfig.vidHeight - 24.0; - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0])
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 24.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if ((cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) != 0 && cg.snap && cg.snap->ps.stats[STAT_INFOCLIENT] != -1) { if ((cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) != 0 && cg.snap
&& cg.snap->ps.stats[STAT_INFOCLIENT] != -1) {
int iClientNum; int iClientNum;
qhandle_t hShader; qhandle_t hShader;
vec4_t color; vec4_t color;
char buf[128]; char buf[128];
iClientNum = cg.snap->ps.stats[STAT_INFOCLIENT]; iClientNum = cg.snap->ps.stats[STAT_INFOCLIENT];
Com_sprintf(buf, sizeof(buf), "%s : %i", cg.clientinfo[iClientNum].name, cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]); Com_sprintf(
buf, sizeof(buf), "%s : %i", cg.clientinfo[iClientNum].name, cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]
);
hShader = 0; hShader = 0;
color[0] = 0.5; color[0] = 0.5;
@ -1179,10 +1236,14 @@ void CG_DrawSpectatorView_ver_15()
color[2] = 0.5; color[2] = 0.5;
color[3] = 1.0; color[3] = 1.0;
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) - 16) * 0.5; fX = (float)(cgs.glconfig.vidWidth
fY = (float)cgs.glconfig.vidHeight - 80.0; - (cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) - 16) * cgs.uiHiResScale[0])
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 80.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(color); cgi.R_SetColor(color);
cgi.R_DrawString(cgs.media.attackerFont, buf, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, buf, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
if (cg.clientinfo[iClientNum].team == TEAM_ALLIES) { if (cg.clientinfo[iClientNum].team == TEAM_ALLIES) {
hShader = cgi.R_RegisterShader("textures/hud/allies"); hShader = cgi.R_RegisterShader("textures/hud/allies");
@ -1234,10 +1295,14 @@ void CG_DrawSpectatorView_ver_6()
pszString = cgi.LV_ConvertString(va("Press Use(%s) to follow a player.", cgi.Key_KeynumToBindString(iKey1))); pszString = cgi.LV_ConvertString(va("Press Use(%s) to follow a player.", cgi.Key_KeynumToBindString(iKey1)));
} }
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5; fX = (float)(cgs.glconfig.vidWidth
fY = (float)cgs.glconfig.vidHeight - 40.0; - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0])
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 40.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) { if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
cgi.Key_GetKeysForCommand("+moveup", &iKey1, &iKey2); cgi.Key_GetKeysForCommand("+moveup", &iKey1, &iKey2);
@ -1248,10 +1313,14 @@ void CG_DrawSpectatorView_ver_6()
cgi.Key_KeynumToBindString(iKey1b)) cgi.Key_KeynumToBindString(iKey1b))
); );
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5; fX = (float)(cgs.glconfig.vidWidth
fY = (float)cgs.glconfig.vidHeight - 24.0; - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0])
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 24.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
} }
@ -1351,17 +1420,7 @@ void CG_DrawCrosshair()
y = (cgs.glconfig.vidHeight - height) * 0.5f; y = (cgs.glconfig.vidHeight - height) * 0.5f;
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(x, y, width * cgs.uiHiResScale[0], height * cgs.uiHiResScale[1], 0, 0, 1, 1, shader);
x,
y,
width * cgs.uiHiResScale[0],
height * cgs.uiHiResScale[1],
0,
0,
1,
1,
shader
);
} }
} }
@ -1392,15 +1451,17 @@ void CG_DrawVote()
percentNo = cgs.numVotesNo * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes); percentNo = cgs.numVotesNo * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes);
percentUndecided = cgs.numUndecidedVotes * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes); percentUndecided = cgs.numUndecidedVotes * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes);
x = 8; x = 8 * cgs.uiHiResScale[0];
y = (cgs.glconfig.vidHeight > 480) ? (cgs.glconfig.vidHeight * 0.725f) : (cgs.glconfig.vidHeight * 0.75f); y = ((cgs.glconfig.vidHeight > 480) ? (cgs.glconfig.vidHeight * 0.725f) : (cgs.glconfig.vidHeight * 0.75f));
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
text = va("%s: %s", cgi.LV_ConvertString("Vote Running"), cgs.voteString); text = va("%s: %s", cgi.LV_ConvertString("Vote Running"), cgs.voteString);
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
y += 12; y += 12 * cgs.uiHiResScale[1];
text = text =
va("%s: %isec %s: %i%% %s: %i%% %s: %i%%", va("%s: %isec %s: %i%% %s: %i%% %s: %i%%",
@ -1412,7 +1473,9 @@ void CG_DrawVote()
percentNo, percentNo,
cgi.LV_ConvertString("Undecided"), cgi.LV_ConvertString("Undecided"),
percentUndecided); percentUndecided);
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
if (cg.snap && !cg.snap->ps.voted) { if (cg.snap && !cg.snap->ps.voted) {
col[0] = 0.5; col[0] = 0.5;
@ -1421,15 +1484,19 @@ void CG_DrawVote()
col[3] = 1.0; col[3] = 1.0;
cgi.R_SetColor(col); cgi.R_SetColor(col);
y += 12; y += 12 * cgs.uiHiResScale[1];
text = cgi.LV_ConvertString("Vote now, it's your patriotic duty!"); text = cgi.LV_ConvertString("Vote now, it's your patriotic duty!");
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
y += 12; y += 12 * cgs.uiHiResScale[1];
text = cgi.LV_ConvertString("To vote Yes, press F1. To vote No, press F2."); text = cgi.LV_ConvertString("To vote Yes, press F1. To vote No, press F2.");
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale); cgi.R_DrawString(
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
} }
} }

View file

@ -270,6 +270,8 @@ extern "C" {
qhandle_t hAlliedPlayerModelHandle; qhandle_t hAlliedPlayerModelHandle;
dtiki_t *pAxisPlayerModel; dtiki_t *pAxisPlayerModel;
qhandle_t hAxisPlayerModelHandle; qhandle_t hAxisPlayerModelHandle;
qboolean serverAlliedModelValid;
qboolean serverAxisModelValid;
// view eyes // view eyes
vec3_t vOffsetViewAngles; vec3_t vOffsetViewAngles;
@ -510,6 +512,7 @@ extern "C" {
// Added in OPM // Added in OPM
// //
extern cvar_t *cg_fov; extern cvar_t *cg_fov;
extern cvar_t *cg_cheats;
// //
// cg_main.c // cg_main.c
@ -530,6 +533,9 @@ extern "C" {
// //
// cg_modelanim.cpp // cg_modelanim.cpp
// //
void CG_ProcessPlayerModel();
void CG_ServerModelLoaded(const char* name, qhandle_t handle);
void CG_ServerModelUnloaded(qhandle_t handle);
void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime); void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime);
void CG_AttachEntity( void CG_AttachEntity(
refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec3_t attach_offset refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec3_t attach_offset

View file

@ -116,6 +116,7 @@ cvar_t *ui_timemessage;
// Added in OPM // Added in OPM
// //
cvar_t *cg_fov; cvar_t *cg_fov;
cvar_t *cg_cheats;
/* /*
================= =================
@ -214,6 +215,7 @@ void CG_RegisterCvars(void)
// //
cg_fov = cgi.Cvar_Get("cg_fov", "80", CVAR_ARCHIVE); cg_fov = cgi.Cvar_Get("cg_fov", "80", CVAR_ARCHIVE);
cg_cheats = cgi.Cvar_Get("cheats", "0", CVAR_USERINFO | CVAR_SERVERINFO | CVAR_LATCH);
} }
/* /*
=============== ===============
@ -365,6 +367,8 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
if (tiki) { if (tiki) {
CG_ProcessCacheInitCommands(tiki); CG_ProcessCacheInitCommands(tiki);
} }
CG_ServerModelLoaded(str, hModel);
} else { } else {
// clear out the model // clear out the model
if (hOldModel && CG_IsHandleUnique(hOldModel)) { if (hOldModel && CG_IsHandleUnique(hOldModel)) {
@ -372,6 +376,10 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
cgi.R_UnregisterServerModel(hOldModel); cgi.R_UnregisterServerModel(hOldModel);
} }
cgs.model_draw[num - CS_MODELS] = 0; cgs.model_draw[num - CS_MODELS] = 0;
if (!str || !str[0]) {
CG_ServerModelUnloaded(hOldModel);
}
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -26,6 +26,33 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
#include "tiki.h" #include "tiki.h"
static qboolean cg_forceModelAllowed = qfalse;
/*
===============
CG_GetPlayerModelTiki
===============
*/
const char *CG_GetPlayerModelTiki(const char *modelName)
{
return va("models/player/%s.tik", modelName);
}
/*
===============
CG_GetPlayerLocalModelTiki
===============
*/
const char *CG_GetPlayerLocalModelTiki(const char *modelName)
{
return va("models/player/%s.tik", modelName);
}
/*
===============
CG_PlayerTeamIcon
===============
*/
void CG_PlayerTeamIcon(refEntity_t *pModel, entityState_t *pPlayerState) void CG_PlayerTeamIcon(refEntity_t *pModel, entityState_t *pPlayerState)
{ {
qboolean bInArtillery, bInTeam, bSpecialIcon; qboolean bInArtillery, bInTeam, bSpecialIcon;
@ -187,13 +214,13 @@ CG_InterpolateAnimParms
Interpolate between current and next entity Interpolate between current and next entity
=============== ===============
*/ */
void CG_InterpolateAnimParms(entityState_t* state, entityState_t* sNext, refEntity_t* model) void CG_InterpolateAnimParms(entityState_t *state, entityState_t *sNext, refEntity_t *model)
{ {
static cvar_t *vmEntity = NULL; static cvar_t *vmEntity = NULL;
int i; int i;
float t; float t;
float animLength; float animLength;
float t1, t2; float t1, t2;
if (!vmEntity) { if (!vmEntity) {
vmEntity = cgi.Cvar_Get("viewmodelanim", "1", 0); vmEntity = cgi.Cvar_Get("viewmodelanim", "1", 0);
@ -202,7 +229,7 @@ void CG_InterpolateAnimParms(entityState_t* state, entityState_t* sNext, refEnti
if (sNext && sNext->usageIndex == state->usageIndex) { if (sNext && sNext->usageIndex == state->usageIndex) {
t1 = cg.time - cg.snap->serverTime; t1 = cg.time - cg.snap->serverTime;
t2 = cg.nextSnap->serverTime - cg.snap->serverTime; t2 = cg.nextSnap->serverTime - cg.snap->serverTime;
t = t1 / t2; t = t1 / t2;
model->actionWeight = (sNext->actionWeight - state->actionWeight) * t + state->actionWeight; model->actionWeight = (sNext->actionWeight - state->actionWeight) * t + state->actionWeight;
@ -214,7 +241,8 @@ void CG_InterpolateAnimParms(entityState_t* state, entityState_t* sNext, refEnti
(sNext->frameInfo[i].weight - state->frameInfo[i].weight) * t + state->frameInfo[i].weight; (sNext->frameInfo[i].weight - state->frameInfo[i].weight) * t + state->frameInfo[i].weight;
if (sNext->frameInfo[i].time >= state->frameInfo[i].time) { if (sNext->frameInfo[i].time >= state->frameInfo[i].time) {
model->frameInfo[i].time = (sNext->frameInfo[i].time - state->frameInfo[i].time) * t + state->frameInfo[i].time; model->frameInfo[i].time =
(sNext->frameInfo[i].time - state->frameInfo[i].time) * t + state->frameInfo[i].time;
} else { } else {
animLength = cgi.Anim_Time(model->tiki, sNext->frameInfo[i].index); animLength = cgi.Anim_Time(model->tiki, sNext->frameInfo[i].index);
if (!animLength) { if (!animLength) {
@ -298,20 +326,20 @@ CG_CastFootShadow
Cast complex foot shadow using lights Cast complex foot shadow using lights
=============== ===============
*/ */
void CG_CastFootShadow(const vec_t* vLightPos, vec_t* vLightIntensity, int iTag, refEntity_t* model) void CG_CastFootShadow(const vec_t *vLightPos, vec_t *vLightIntensity, int iTag, refEntity_t *model)
{ {
int i; int i;
float fAlpha; float fAlpha;
float fLength; float fLength;
float fWidth; float fWidth;
float fAlphaOfs; float fAlphaOfs;
float fOfs; float fOfs;
float fPitchCos; float fPitchCos;
vec3_t vPos; vec3_t vPos;
vec3_t vEnd; vec3_t vEnd;
vec3_t vDelta; vec3_t vDelta;
vec3_t vLightAngles; vec3_t vLightAngles;
trace_t trace; trace_t trace;
orientation_t oFoot; orientation_t oFoot;
VectorCopy(model->origin, vPos); VectorCopy(model->origin, vPos);
@ -321,8 +349,7 @@ void CG_CastFootShadow(const vec_t* vLightPos, vec_t* vLightIntensity, int iTag,
VectorMA(vPos, vEnd[i], model->axis[i], vPos); VectorMA(vPos, vEnd[i], model->axis[i], vPos);
} }
if (cg_shadowdebug->integer) if (cg_shadowdebug->integer) {
{
vec3_t vDir; vec3_t vDir;
// //
@ -373,12 +400,11 @@ void CG_CastFootShadow(const vec_t* vLightPos, vec_t* vLightIntensity, int iTag,
} }
fLength = fPitchCos * fPitchCos * 32.0 + fPitchCos * 8.0 + 10.0; fLength = fPitchCos * fPitchCos * 32.0 + fPitchCos * 8.0 + 10.0;
fOfs = 0.5 - (-4.1 / tan(DEG2RAD(vLightAngles[0])) + 4.0 - fLength) / fLength * 0.5; fOfs = 0.5 - (-4.1 / tan(DEG2RAD(vLightAngles[0])) + 4.0 - fLength) / fLength * 0.5;
VectorMA(vPos, -96.0, vDelta, vEnd); VectorMA(vPos, -96.0, vDelta, vEnd);
CG_Trace(&trace, vPos, vec3_origin, vec3_origin, vEnd, 0, MASK_FOOTSHADOW, qfalse, qtrue, "CG_CastFootShadow"); CG_Trace(&trace, vPos, vec3_origin, vec3_origin, vEnd, 0, MASK_FOOTSHADOW, qfalse, qtrue, "CG_CastFootShadow");
if (cg_shadowdebug->integer) if (cg_shadowdebug->integer) {
{
cgi.R_DebugLine(vPos, vLightPos, 0.75, 0.75, 0.5, 1.0); cgi.R_DebugLine(vPos, vLightPos, 0.75, 0.75, 0.5, 1.0);
cgi.R_DebugLine(vPos, vEnd, 1.0, 1.0, 1.0, 1.0); cgi.R_DebugLine(vPos, vEnd, 1.0, 1.0, 1.0, 1.0);
} }
@ -392,7 +418,7 @@ void CG_CastFootShadow(const vec_t* vLightPos, vec_t* vLightIntensity, int iTag,
trace.fraction = 0; trace.fraction = 0;
} }
fWidth = 10.f - (1.f - trace.fraction) * 6.f; fWidth = 10.f - (1.f - trace.fraction) * 6.f;
fAlphaOfs = (1.f - trace.fraction) * fAlpha; fAlphaOfs = (1.f - trace.fraction) * fAlpha;
fAlpha = Q_max(vLightIntensity[0], Q_max(vLightIntensity[1], vLightIntensity[2])); fAlpha = Q_max(vLightIntensity[0], Q_max(vLightIntensity[1], vLightIntensity[2]));
@ -445,13 +471,21 @@ CG_CastSimpleFeetShadow
Cast basic feet shadow Cast basic feet shadow
=============== ===============
*/ */
void CG_CastSimpleFeetShadow(const trace_t* pTrace, float fWidth, float fAlpha, int iRightTag, int iLeftTag, const dtiki_t* tiki, refEntity_t* model) void CG_CastSimpleFeetShadow(
const trace_t *pTrace,
float fWidth,
float fAlpha,
int iRightTag,
int iLeftTag,
const dtiki_t *tiki,
refEntity_t *model
)
{ {
int i; int i;
float fShadowYaw; float fShadowYaw;
float fLength; float fLength;
vec3_t vPos, vRightPos, vLeftPos; vec3_t vPos, vRightPos, vLeftPos;
vec3_t vDelta; vec3_t vDelta;
orientation_t oFoot; orientation_t oFoot;
// //
@ -485,7 +519,7 @@ void CG_CastSimpleFeetShadow(const trace_t* pTrace, float fWidth, float fAlpha,
// get the facing yaw // get the facing yaw
fShadowYaw = vectoyaw(vDelta); fShadowYaw = vectoyaw(vDelta);
fLength = VectorNormalize(vDelta) * 0.5 + 12; fLength = VectorNormalize(vDelta) * 0.5 + 12;
if (fLength < fWidth * 0.7) { if (fLength < fWidth * 0.7) {
fLength = fWidth * 0.7; fLength = fWidth * 0.7;
} }
@ -550,15 +584,13 @@ qboolean CG_EntityShadow(centity_t *cent, refEntity_t *model)
} }
if (iTagR != -1) { if (iTagR != -1) {
int iNumLights, iCurrLight; int iNumLights, iCurrLight;
vec3_t avLightPos[16], avLightIntensity[16]; vec3_t avLightPos[16], avLightIntensity[16];
iNumLights = Q_clamp(cg_shadowscount->integer, 1, 8); iNumLights = Q_clamp(cg_shadowscount->integer, 1, 8);
iNumLights = cgi.R_GatherLightSources(model->origin, avLightPos, avLightIntensity, iNumLights); iNumLights = cgi.R_GatherLightSources(model->origin, avLightPos, avLightIntensity, iNumLights);
if (iNumLights) if (iNumLights) {
{ for (iCurrLight = 0; iCurrLight < iNumLights; iCurrLight++) {
for (iCurrLight = 0; iCurrLight < iNumLights; iCurrLight++)
{
CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagL, model); CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagL, model);
CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagR, model); CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagR, model);
} }
@ -725,6 +757,11 @@ void CG_AttachEntity(
VectorAdd(entity->origin, vOrigin, entity->lightingOrigin); VectorAdd(entity->origin, vOrigin, entity->lightingOrigin);
} }
/*
===============
CG_AttachEyeEntity
===============
*/
void CG_AttachEyeEntity( void CG_AttachEyeEntity(
refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec_t *attach_offset refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec_t *attach_offset
) )
@ -737,8 +774,7 @@ void CG_AttachEyeEntity(
AnglesToAxis(cg.refdefViewAngles, entity->axis); AnglesToAxis(cg.refdefViewAngles, entity->axis);
} }
if (attach_offset[0] || attach_offset[1] || attach_offset[2]) if (attach_offset[0] || attach_offset[1] || attach_offset[2]) {
{
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
VectorMA(entity->origin, attach_offset[i], entity->axis[i], entity->origin); VectorMA(entity->origin, attach_offset[i], entity->axis[i], entity->origin);
} }
@ -750,56 +786,219 @@ void CG_AttachEyeEntity(
VectorCopy(parent->lightingOrigin, entity->lightingOrigin); VectorCopy(parent->lightingOrigin, entity->lightingOrigin);
} }
/*
===============
CG_IsValidServerModel
===============
*/
qboolean CG_IsValidServerModel(const char *modelpath)
{
const char *str;
int i;
for (i = 1; i < MAX_MODELS; i++) {
str = CG_ConfigString(CS_MODELS + i);
if (!Q_stricmp(str, modelpath)) {
return qtrue;
}
}
return qfalse;
}
/*
===============
CG_CheckValidModels
This verifies the allied player model and the german player model:
- If they don't exist on the client, reset to the default allied player model
- If they don't exist on the server, don't allow forceModel so the client explicitly know the skin isn't supported
===============
*/
void CG_CheckValidModels()
{
const char *modelpath;
qboolean isDirty = qfalse;
if (dm_playermodel->modified) {
// Check for allied model
modelpath = va("models/player/%s.tik", dm_playermodel->string);
if (!cgi.R_RegisterModel(modelpath)) {
cgi.Printf(
"Allied model '%s' is invalid, resetting to '%s'\n", dm_playermodel->string, dm_playermodel->resetString
);
cgi.Cvar_Set("dm_playermodel", dm_playermodel->resetString);
modelpath = va("models/player/%s.tik", dm_playermodel->string);
}
cg.serverAlliedModelValid = CG_IsValidServerModel(modelpath);
}
if (dm_playergermanmodel->modified) {
// Check for axis model
modelpath = va("models/player/%s.tik", dm_playergermanmodel->string);
if (!cgi.R_RegisterModel(modelpath)) {
cgi.Printf(
"Allied model '%s' is invalid, resetting to '%s'\n",
dm_playergermanmodel->string,
dm_playergermanmodel->resetString
);
cgi.Cvar_Set("dm_playergermanmodel", dm_playergermanmodel->resetString);
modelpath = va("models/player/%s.tik", dm_playergermanmodel->string);
}
cg.serverAxisModelValid = CG_IsValidServerModel(modelpath);
}
if (dm_playermodel->modified || dm_playergermanmodel->modified) {
cg_forceModelAllowed = cg.serverAlliedModelValid && cg.serverAxisModelValid;
}
}
/*
===============
CG_ServerModelLoaded
===============
*/
void CG_ServerModelLoaded(const char *name, qhandle_t handle)
{
if (!Q_stricmpn(name, "models/player/", 14) && (!cg.serverAlliedModelValid || !cg.serverAxisModelValid)) {
char modelName[MAX_QPATH];
COM_StripExtension(name + 14, modelName, sizeof(modelName));
//
// The player model has been loaded on the server
// so try again parsing
//
if (!Q_stricmp(modelName, dm_playermodel->string)) {
dm_playermodel->modified = qtrue;
}
if (!Q_stricmp(modelName, dm_playergermanmodel->string)) {
dm_playergermanmodel->modified = qtrue;
}
}
}
/*
===============
CG_ServerModelUnloaded
===============
*/
void CG_ServerModelUnloaded(qhandle_t handle)
{
#if 0
if (cg.serverAlliedModelValid && handle == cg.hAlliedPlayerModelHandle) {
dm_playermodel->modified = qtrue;
}
if (cg.serverAxisModelValid && handle == cg.hAxisPlayerModelHandle) {
dm_playergermanmodel->modified = qtrue;
}
#endif
}
/*
===============
CG_UpdateForceModels
===============
*/
void CG_UpdateForceModels() void CG_UpdateForceModels()
{ {
qhandle_t hModel; qhandle_t hModel;
char* pszAlliesPartial; char *pszAlliesPartial;
char* pszAxisPartial; char *pszAxisPartial;
char szAlliesModel[256]; char szAlliesModel[256];
char szAxisModel[256]; char szAxisModel[256];
qboolean isDirty;
if (cg.pAlliedPlayerModel && cg.pAxisPlayerModel && !dm_playermodel->modified && !dm_playergermanmodel->modified) { isDirty = dm_playermodel->modified || dm_playergermanmodel->modified || cg_forceModel->modified;
if (!cg_forceModelAllowed) {
if (isDirty) {
cgi.Printf(
"One or more of the selected players model don't exist on the server or are not loaded, using the "
"default skin\n"
);
}
return;
}
if (cg.pAlliedPlayerModel && cg.pAxisPlayerModel && !isDirty) {
return; return;
} }
pszAlliesPartial = dm_playermodel->string; pszAlliesPartial = dm_playermodel->string;
pszAxisPartial = dm_playergermanmodel->string; pszAxisPartial = dm_playergermanmodel->string;
Com_sprintf(szAlliesModel, sizeof(szAlliesModel), "models/player/%s.tik", pszAlliesPartial); Com_sprintf(szAlliesModel, sizeof(szAlliesModel), "models/player/%s.tik", pszAlliesPartial);
Com_sprintf(szAxisModel, sizeof(szAxisModel), "models/player/%s.tik", pszAxisPartial); Com_sprintf(szAxisModel, sizeof(szAxisModel), "models/player/%s.tik", pszAxisPartial);
hModel = cgi.R_RegisterModel(szAlliesModel);
if (!hModel) hModel = cgi.R_RegisterModel("models/player/american_army.tik"); hModel = cg.serverAlliedModelValid ? cgi.R_RegisterModel(szAlliesModel) : 0;
if (!hModel) {
Com_sprintf(szAlliesModel, sizeof(szAlliesModel), "models/player/%s.tik", dm_playermodel->resetString);
hModel = cgi.R_RegisterModel(szAlliesModel);
}
if (hModel) { if (hModel) {
cg.hAlliedPlayerModelHandle = hModel; cg.hAlliedPlayerModelHandle = hModel;
cg.pAlliedPlayerModel = cgi.R_Model_GetHandle(hModel); cg.pAlliedPlayerModel = cgi.R_Model_GetHandle(hModel);
if (!cg.pAlliedPlayerModel) { if (!cg.pAlliedPlayerModel) {
cg.hAlliedPlayerModelHandle = 0; cg.hAlliedPlayerModelHandle = 0;
} }
} else { } else {
cg.hAlliedPlayerModelHandle = 0; cg.hAlliedPlayerModelHandle = 0;
cg.pAlliedPlayerModel = 0; cg.pAlliedPlayerModel = NULL;
} }
hModel = cgi.R_RegisterModel(szAxisModel); hModel = cg.serverAxisModelValid ? cgi.R_RegisterModel(szAxisModel) : 0;
if (!hModel) hModel = cgi.R_RegisterModel("models/player/german_wehrmacht_soldier.tik"); if (!hModel) {
Com_sprintf(szAxisModel, sizeof(szAxisModel), "models/player/%s.tik", dm_playergermanmodel->resetString);
hModel = cgi.R_RegisterModel(szAxisModel);
}
if (hModel) { if (hModel) {
cg.hAxisPlayerModelHandle = hModel; cg.hAxisPlayerModelHandle = hModel;
cg.pAxisPlayerModel = cgi.R_Model_GetHandle(hModel); cg.pAxisPlayerModel = cgi.R_Model_GetHandle(hModel);
if (!cg.pAxisPlayerModel) { if (!cg.pAxisPlayerModel) {
cg.hAxisPlayerModelHandle = 0; cg.hAxisPlayerModelHandle = 0;
} }
} else { } else {
cg.hAxisPlayerModelHandle = 0; cg.hAxisPlayerModelHandle = 0;
cg.pAxisPlayerModel = 0; cg.pAxisPlayerModel = 0;
} }
// Clear modified flag // Clear modified flag
dm_playermodel->modified = qfalse; //dm_playermodel->modified = qfalse;
dm_playergermanmodel->modified = qfalse; //dm_playergermanmodel->modified = qfalse;
} }
/*
===============
CG_ProcessPlayerModel
Checks player models, and update force models
===============
*/
void CG_ProcessPlayerModel()
{
CG_CheckValidModels();
if (cg_forceModel->integer) {
CG_UpdateForceModels();
}
// Clear modified flag
dm_playermodel->modified = qfalse;
dm_playergermanmodel->modified = qfalse;
cg_forceModel->modified = qfalse;
}
/*
===============
CG_ModelAnim
===============
*/
void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime) void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
{ {
entityState_t *s1; entityState_t *s1;
@ -940,8 +1139,8 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
model.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]); model.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]);
if (s1->number != cg.snap->ps.clientNum && (s1->eType == ET_PLAYER || (s1->eFlags & EF_DEAD))) { if (s1->number != cg.snap->ps.clientNum && (s1->eType == ET_PLAYER || (s1->eFlags & EF_DEAD))) {
if (cg_forceModel->integer) { if (cg_forceModel->integer && cg_forceModelAllowed) {
CG_UpdateForceModels(); //CG_UpdateForceModels();
if (s1->eFlags & EF_AXIS) { if (s1->eFlags & EF_AXIS) {
model.hModel = cg.hAxisPlayerModelHandle; model.hModel = cg.hAxisPlayerModelHandle;
@ -965,9 +1164,9 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
if (!model.hModel || !model.tiki) { if (!model.hModel || !model.tiki) {
// Use a model in case it still doesn't exist // Use a model in case it still doesn't exist
if (s1->eFlags & EF_AXIS) { if (s1->eFlags & EF_AXIS) {
model.hModel = cgi.R_RegisterModel("models/player/german_wehrmacht_soldier.tik"); model.hModel = cgi.R_RegisterModel(CG_GetPlayerModelTiki(dm_playergermanmodel->resetString));
} else { } else {
model.hModel = cgi.R_RegisterModel("models/player/american_army.tik"); model.hModel = cgi.R_RegisterModel(CG_GetPlayerModelTiki(dm_playermodel->resetString));
} }
model.tiki = cgi.R_Model_GetHandle(model.hModel); model.tiki = cgi.R_Model_GetHandle(model.hModel);
model.hOldModel = cgs.model_draw[s1->modelindex]; model.hOldModel = cgs.model_draw[s1->modelindex];
@ -1213,9 +1412,9 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
} }
} else { } else {
if (cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS) { if (cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS) {
hModel = cgi.R_RegisterModel("models/player/german_wehrmacht_soldier_fps.tik"); hModel = cgi.R_RegisterModel(CG_GetPlayerLocalModelTiki(dm_playergermanmodel->resetString));
} else { } else {
hModel = cgi.R_RegisterModel("models/player/american_army_fps.tik"); hModel = cgi.R_RegisterModel(CG_GetPlayerLocalModelTiki(dm_playermodel->resetString));
} }
if (hModel) { if (hModel) {
@ -1337,7 +1536,7 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
if (!((cent->animLastWeight >> i) & 1) || model.frameInfo[i].index != cent->animLast[i]) { if (!((cent->animLastWeight >> i) & 1) || model.frameInfo[i].index != cent->animLast[i]) {
CG_ProcessEntityCommands(TIKI_FRAME_ENTRY, model.frameInfo[i].index, s1->number, &model, cent); CG_ProcessEntityCommands(TIKI_FRAME_ENTRY, model.frameInfo[i].index, s1->number, &model, cent);
if (cent->animLastTimes[i] == -1) { if (cent->animLastTimes[i] == -1) {
cent->animLast[i] = model.frameInfo[i].index; cent->animLast[i] = model.frameInfo[i].index;
cent->animLastTimes[i] = model.frameInfo[i].time; cent->animLastTimes[i] = model.frameInfo[i].time;
} else { } else {
cent->animLastTimes[i] = 0; cent->animLastTimes[i] = 0;

View file

@ -85,7 +85,12 @@ void CG_MakeBulletHoleSound(const vec3_t i_vPos, const vec3_t i_vNorm, int iLarg
iSurfType = SURF_PUDDLE; iSurfType = SURF_PUDDLE;
} }
if (trace.fraction == 1.0f || trace.startsolid || (trace.surfaceFlags & SURF_SKY)) { if (trace.fraction == 1) {
// no reason to make a sound if it nothing was hit
return;
}
if ((trace.surfaceFlags & SURF_SKY) || !CG_CheckMakeMarkOnEntity(trace.entityNum)) {
return; return;
} }
@ -253,7 +258,12 @@ CG_MakeBulletHole(const vec3_t i_vPos, const vec3_t i_vNorm, int iLarge, trace_t
iSurfType = SURF_PUDDLE; iSurfType = SURF_PUDDLE;
} }
if (trace.fraction == 1.0f || trace.startsolid || (trace.surfaceFlags & SURF_SKY)) { if (trace.fraction == 1.0f || trace.startsolid) {
return;
}
if (trace.surfaceFlags & SURF_SKY) {
// ignore sky surfaces
return; return;
} }
@ -460,35 +470,36 @@ static void CG_MakeBulletTracerInternal(
float alpha float alpha
) )
{ {
vec3_t vPos; vec3_t vPos;
int iBullet; int iBullet;
int iContinueCount; int iContinueCount;
int iDist; int iDist;
int iHeadDist; int iHeadDist;
int iTravelDist; int iTravelDist;
float fLen, fDist; float fLen, fDist;
trace_t trace; trace_t trace;
qboolean bStartInWater, bInWater; qboolean bStartInWater, bInWater;
qboolean bBulletDone; qboolean bBulletDone;
qboolean bMadeTracer; qboolean bMadeTracer;
vec3_t vDir; vec3_t vDir;
vec3_t vTrailStart; vec3_t vTrailStart;
vec3_t vTraceStart; vec3_t vTraceStart;
vec3_t vTraceEnd; vec3_t vTraceEnd;
vec3_t vTmp; vec3_t vTmp;
int iNumImpacts; int iNumImpacts;
trace_t tImpacts[128]; trace_t tImpacts[128];
float fImpSndDistRA; float fImpSndDistRA;
static float fImpSndDistLA; float fImpSndDistLA;
float fImpSndDistRB; float fImpSndDistRB;
float fImpSndDistLB; float fImpSndDistLB;
int iImpSndIndexRA; int iImpSndIndexRA;
int iImpSndIndexRB; int iImpSndIndexLA;
int iImpSndIndexLB; int iImpSndIndexRB;
float fVolume; int iImpSndIndexLB;
float fPitch; float fVolume;
float fZingDistA, fZingDistB, fZingDistC; float fPitch;
vec3_t vZingPosA, vZingPosB, vZingPosC; float fZingDistA, fZingDistB, fZingDistC;
vec3_t vZingPosA, vZingPosB, vZingPosC;
fZingDistB = 9999.0; fZingDistB = 9999.0;
fZingDistA = 9999.0; fZingDistA = 9999.0;
@ -584,7 +595,8 @@ static void CG_MakeBulletTracerInternal(
|| (trace.contents & CONTENTS_WATER)) || (trace.contents & CONTENTS_WATER))
&& iContinueCount < 5) { && iContinueCount < 5) {
if (bInWater) { if (bInWater) {
VectorSubtract(trace.endpos, vDir, vTmp); VectorMA(trace.endpos, -1.0, vDir, vTmp);
if (!(trace.contents & CONTENTS_FLUID) && !(trace.surfaceFlags & SURF_PUDDLE) if (!(trace.contents & CONTENTS_FLUID) && !(trace.surfaceFlags & SURF_PUDDLE)
&& !(cgi.CM_PointContents(vTmp, 0) & CONTENTS_FLUID)) { && !(cgi.CM_PointContents(vTmp, 0) & CONTENTS_FLUID)) {
CG_MakeBubbleTrail(vTrailStart, trace.endpos, iLarge, alpha); CG_MakeBubbleTrail(vTrailStart, trace.endpos, iLarge, alpha);
@ -596,8 +608,7 @@ static void CG_MakeBulletTracerInternal(
bInWater = qtrue; bInWater = qtrue;
} }
VectorAdd(vDir, vDir, vTraceStart); VectorMA(trace.endpos, 2.0, vDir, vTraceStart);
VectorAdd(vTraceStart, vTraceStart, trace.endpos);
iContinueCount++; iContinueCount++;
} else { } else {
@ -659,46 +670,46 @@ static void CG_MakeBulletTracerInternal(
if (iNumImpacts > 2) { if (iNumImpacts > 2) {
fImpSndDistRA = 9999.0f; fImpSndDistRA = 9999.0f;
fImpSndDistRB = 9999.0f; fImpSndDistRB = 9999.0f;
iImpSndIndexRA = 0; fImpSndDistLA = 9999.0f;
iImpSndIndexRB = 0;
fImpSndDistLB = 9999.0f; fImpSndDistLB = 9999.0f;
iImpSndIndexRA = 0;
iImpSndIndexLA = 0;
iImpSndIndexRB = 0;
iImpSndIndexLB = 0; iImpSndIndexLB = 0;
for (iBullet = 0; iBullet < iNumImpacts; iBullet++) { for (iBullet = 0; iBullet < iNumImpacts; iBullet++) {
CG_MakeBulletHole( CG_MakeBulletHole(
tImpacts[iImpSndIndexLB].endpos, tImpacts[iBullet].endpos, tImpacts[iBullet].plane.normal, iLarge, &tImpacts[iBullet], qfalse
tImpacts[iImpSndIndexLB].plane.normal,
iLarge,
&tImpacts[iImpSndIndexLB],
qfalse
); );
VectorSubtract(tImpacts[iImpSndIndexLB].endpos, cg.SoundOrg, vTmp); VectorSubtract(tImpacts[iBullet].endpos, cg.SoundOrg, vTmp);
iHeadDist = VectorLength(vTmp); iHeadDist = VectorLength(vTmp);
if (DotProduct(vTmp, cg.SoundAxis[1]) <= 0.f) { if (DotProduct(vTmp, cg.SoundAxis[1]) <= 0.f) {
if (iHeadDist < 9999.0f || iHeadDist < fImpSndDistLB) { if (iHeadDist < fImpSndDistLA || iHeadDist < fImpSndDistLB) {
if (iHeadDist < 9999.0f) { if (iHeadDist < fImpSndDistLA) {
fImpSndDistRA = iHeadDist; iImpSndIndexLB = iImpSndIndexLA;
fImpSndDistLB = 9999.0; fImpSndDistLB = fImpSndDistLA;
iImpSndIndexRA = iBullet; iImpSndIndexRA = iBullet;
fImpSndDistRA = iHeadDist;
} else if (iHeadDist < fImpSndDistLB) { } else if (iHeadDist < fImpSndDistLB) {
fImpSndDistLB = iHeadDist; iImpSndIndexLB = iBullet;
fImpSndDistLB = iHeadDist;
} }
} }
} else { } else {
if (iHeadDist < fImpSndDistRA || iHeadDist < fImpSndDistRB) { if (iHeadDist < fImpSndDistRA || iHeadDist < fImpSndDistRB) {
if (iHeadDist < fImpSndDistRA) { if (iHeadDist < fImpSndDistRA) {
iImpSndIndexRB = iImpSndIndexRA; iImpSndIndexRB = iImpSndIndexRA;
fImpSndDistRB = fImpSndDistRA;
iImpSndIndexRA = iBullet; iImpSndIndexRA = iBullet;
fImpSndDistRA = iHeadDist;
} else if (iHeadDist < fImpSndDistRB) { } else if (iHeadDist < fImpSndDistRB) {
fImpSndDistRB = iHeadDist;
iImpSndIndexRB = iBullet; iImpSndIndexRB = iBullet;
fImpSndDistRB = iHeadDist;
} }
} }
} }
iImpSndIndexLB++;
} }
if (fImpSndDistRA < 9999.0f) { if (fImpSndDistRA < 9999.0f) {
@ -718,6 +729,24 @@ static void CG_MakeBulletTracerInternal(
); );
} }
} }
if (fImpSndDistLA < 9999.0f) {
CG_MakeBulletHoleSound(
tImpacts[iImpSndIndexLA].endpos,
tImpacts[iImpSndIndexLA].plane.normal,
iLarge,
&tImpacts[iImpSndIndexLA]
);
if (fImpSndDistLB < 9999.0f) {
CG_MakeBulletHoleSound(
tImpacts[iImpSndIndexLB].endpos,
tImpacts[iImpSndIndexLB].plane.normal,
iLarge,
&tImpacts[iImpSndIndexLB]
);
}
}
} else { } else {
for (iBullet = 0; iBullet < iNumImpacts; iBullet++) { for (iBullet = 0; iBullet < iNumImpacts; iBullet++) {
CG_MakeBulletHole( CG_MakeBulletHole(
@ -1638,8 +1667,8 @@ void CG_ParseCGMessage_ver_15()
CG_HudDrawFont(iInfo); CG_HudDrawFont(iInfo);
break; break;
case CGM_NOTIFY_KILL:
case CGM_NOTIFY_HIT: case CGM_NOTIFY_HIT:
case CGM_NOTIFY_KILL:
if (cg.snap) { if (cg.snap) {
const char *soundName; const char *soundName;
int iOldEnt; int iOldEnt;
@ -1647,12 +1676,11 @@ void CG_ParseCGMessage_ver_15()
iOldEnt = current_entity_number; iOldEnt = current_entity_number;
current_entity_number = cg.snap->ps.clientNum; current_entity_number = cg.snap->ps.clientNum;
if (iType == CGM_NOTIFY_HIT) { if (iType == CGM_NOTIFY_KILL) {
soundName = "dm_kill_notify"; commandManager.PlaySound("dm_kill_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1);
} else { } else {
soundName = "dm_hit_notify"; commandManager.PlaySound("dm_hit_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1);
} }
commandManager.PlaySound(soundName, NULL, CHAN_LOCAL, 2.0, -1, -1, 1);
current_entity_number = iOldEnt; current_entity_number = iOldEnt;
} }
@ -2029,15 +2057,15 @@ void CG_ParseCGMessage_ver_6()
CG_HudDrawFont(iInfo); CG_HudDrawFont(iInfo);
break; break;
case CGM6_NOTIFY_KILL:
case CGM6_NOTIFY_HIT: case CGM6_NOTIFY_HIT:
case CGM6_NOTIFY_KILL:
if (cg.snap) { if (cg.snap) {
int iOldEnt; int iOldEnt;
iOldEnt = current_entity_number; iOldEnt = current_entity_number;
current_entity_number = cg.snap->ps.clientNum; current_entity_number = cg.snap->ps.clientNum;
if (iType == CGM6_NOTIFY_HIT) { if (iType == CGM6_NOTIFY_KILL) {
commandManager.PlaySound("dm_kill_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1); commandManager.PlaySound("dm_kill_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1);
} else { } else {
commandManager.PlaySound("dm_hit_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1); commandManager.PlaySound("dm_hit_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1);

View file

@ -122,6 +122,7 @@ functions exported to the main executable
cvar_t *(*Cvar_Get)(const char *var_name, const char *value, int flags); cvar_t *(*Cvar_Get)(const char *var_name, const char *value, int flags);
cvar_t *(*Cvar_Find)(const char *var_name); cvar_t *(*Cvar_Find)(const char *var_name);
void (*Cvar_Set)(const char *var_name, const char *value); void (*Cvar_Set)(const char *var_name, const char *value);
void (*Cvar_CheckRange)(cvar_t* var, float min, float max, qboolean integral);
// ClientCommand and ConsoleCommand parameter access // ClientCommand and ConsoleCommand parameter access
int (*Argc)(void); int (*Argc)(void);

View file

@ -26,8 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
#include "../fgame/bg_voteoptions.h" #include "../fgame/bg_voteoptions.h"
#include "cg_servercmds_filter.h"
static qboolean CG_IsStatementFiltered(char *cmd);
/* /*
================ ================
@ -458,237 +457,3 @@ void CG_ExecuteNewServerCommands(int latestSequence, qboolean differentServer)
} }
} }
} }
//
// List of client variables allowed to be changed by the server
//
static const char *whiteListedVariables[] = {
"r_fastsky", // some mods set this variable to make the sky uniform
"ui_hud",
"subtitle0",
"subtitle1",
"subtitle2",
"subtitle3"
};
//
// List of client variables allowed to be changed by the server
//
static const char *whiteListedLocalServerVariables[] = {"ui_hidemouse", "ui_showmouse", "cg_marks_add"};
//
// List of commands allowed to be executed by the server
//
static const char *whiteListedCommands[] = {
"primarydmweapon",
"pushmenu",
"pushmenu_teamselect",
"pushmenu_weaponselect",
"popmenu",
"wait",
"globalwidgetcommand", // used for mods adding custom HUDs
"ui_addhud",
"ui_removehud",
"tmstart",
"tmstartloop",
"tmstop",
"tmvolume",
"`stufftext",
"+moveup", // workaround for mods that want to prevent inactivity when handling the spectate
"-moveup",
"screenshot",
"screenshotJPEG",
"levelshot"
};
//
// List of commands allowed to be executed by the server
//
static const char *whiteListedLocalServerCommands[] = {
"spmap", // Used by briefings
"map",
"disconnect",
"cinematic",
"showmenu",
"hidemenu"
};
/*
====================
CG_IsVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsVariableFiltered(const char *name)
{
cvar_t *var;
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedVariables); i++) {
if (!Q_stricmp(name, whiteListedVariables[i])) {
return qfalse;
}
}
if (cgs.localServer) {
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerVariables); i++) {
if (!Q_stricmp(name, whiteListedLocalServerVariables[i])) {
return qfalse;
}
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsSetVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsSetVariableFiltered(const char *name, char type)
{
cvar_t *var;
if (!CG_IsVariableFiltered(name)) {
return qfalse;
}
if (type != 'u' && type != 's') {
// Don't allow custom info variables to avoid flooding
// the client with many serverinfo and userinfo variables
var = cgi.Cvar_Find(name);
if (!var) {
// Allow as it doesn't exist
return qfalse;
}
if (var->flags & CVAR_USER_CREATED) {
// Allow, it's user-created, wouldn't cause issues
return qfalse;
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsCommandFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsCommandFiltered(const char *name)
{
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedCommands); i++) {
if (!Q_stricmp(name, whiteListedCommands[i])) {
return qfalse;
}
}
if (cgs.localServer) {
// Allow more commands when the client is hosting the server
// Mostly used on single-player mode, like when briefings switch to the next map
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerCommands); i++) {
if (!Q_stricmp(name, whiteListedLocalServerCommands[i])) {
return qfalse;
}
}
}
//
// Test variables
//
return CG_IsVariableFiltered(name);
}
/*
====================
RemoveEndToken
====================
*/
static qboolean RemoveEndToken(char* com_token) {
char* p;
for (p = com_token; p[0]; p++) {
if (*p == ';') {
*p = 0;
return qtrue;
}
}
return qfalse;
}
/*
====================
CG_IsStatementFiltered
Returns whether or not the statement is filtered
====================
*/
static qboolean CG_IsStatementFiltered(char *cmd)
{
char* parsed;
char* p;
char com_token[256];
qboolean bNextStatement = qfalse;
parsed = cmd;
for (Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token)); com_token[0]; Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token))) {
bNextStatement = RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (!Q_stricmp(com_token, "set") || !Q_stricmp(com_token, "setu") || !Q_stricmp(com_token, "seta")
|| !Q_stricmp(com_token, "sets")) {
char type = com_token[3];
//
// variable
//
Q_strncpyz(com_token, COM_ParseExt(&parsed, qfalse), sizeof(com_token));
bNextStatement |= RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (CG_IsSetVariableFiltered(com_token, type)) {
return qtrue;
}
} else {
//
// normal command
//
if (CG_IsCommandFiltered(com_token)) {
return qtrue;
}
}
if (!bNextStatement) {
// Skip up to the next statement
while (parsed && parsed[0]) {
char c = parsed[0];
parsed++;
if (c == '\n' || c == ';') {
break;
}
}
}
}
return qfalse;
}

View file

@ -0,0 +1,292 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// DESCRIPTION:
// cg_servercmds_filter.c -- filtered server commands
#include "cg_local.h"
#include "cg_servercmds_filter.h"
//
// List of variables allowed to be changed by the server
//
static const char *whiteListedVariables[] = {
// some mods set this variable to make the sky uniform
"r_fastsky",
"ui_hud",
"subtitle0",
"subtitle1",
"subtitle2",
"subtitle3",
"name",
// for 3rd person server
"cg_3rd_person",
"cg_cameraverticaldisplacement"
};
//
// List of variables allowed to be changed by the server
//
static const char *whiteListedLocalServerVariables[] = {"ui_hidemouse", "ui_showmouse", "cg_marks_add"};
//
// List of commands allowed to be executed by the server
//
static const char *whiteListedCommands[] = {
//
// HUD
//==========
"pushmenu",
"pushmenu_teamselect",
"pushmenu_weaponselect",
"popmenu",
"globalwidgetcommand", // used for mods adding custom HUDs
"ui_addhud",
"ui_removehud",
"echo", // to print stuff client-side
//
// Sounds
//==========
"tmstart",
"tmstartloop",
"tmstop",
"tmvolume",
"play",
"playmp3",
"stopmp3",
//
// Misc
//==========
"primarydmweapon",
"wait",
"+moveup", // workaround for mods that want to prevent inactivity when handling the spectate
"-moveup",
"screenshot",
"screenshotJPEG",
"levelshot",
"`stufftext" // Stufftext detection from Reborn, the player gets kicked without it
};
//
// List of commands allowed to be executed locally
// (when the client also runs the server)
//
static const char *whiteListedLocalServerCommands[] = {
// Used by briefings
"spmap",
"map",
"disconnect",
"cinematic",
"showmenu",
"hidemenu"
};
/*
====================
CG_IsVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsVariableFiltered(const char *name)
{
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedVariables); i++) {
if (!Q_stricmp(name, whiteListedVariables[i])) {
return qfalse;
}
}
if (cgs.localServer) {
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerVariables); i++) {
if (!Q_stricmp(name, whiteListedLocalServerVariables[i])) {
return qfalse;
}
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsSetVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsSetVariableFiltered(const char *name, char type)
{
cvar_t *var;
if (!CG_IsVariableFiltered(name)) {
return qfalse;
}
if (type != 'u' && type != 's') {
// Don't allow custom info variables to avoid flooding
// the client with many serverinfo and userinfo variables
var = cgi.Cvar_Find(name);
if (!var) {
// Allow as it doesn't exist
return qfalse;
}
if (var->flags & CVAR_USER_CREATED) {
// Allow, it's user-created, wouldn't cause issues
return qfalse;
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsCommandFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsCommandFiltered(const char *name)
{
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedCommands); i++) {
if (!Q_stricmp(name, whiteListedCommands[i])) {
return qfalse;
}
}
if (cgs.localServer) {
// Allow more commands when the client is hosting the server
// Mostly used on single-player mode, like when briefings switch to the next map
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerCommands); i++) {
if (!Q_stricmp(name, whiteListedLocalServerCommands[i])) {
return qfalse;
}
}
}
//
// Test variables
//
return CG_IsVariableFiltered(name);
}
/*
====================
RemoveEndToken
====================
*/
static qboolean RemoveEndToken(char* com_token) {
char* p;
for (p = com_token; p[0]; p++) {
if (*p == ';') {
*p = 0;
return qtrue;
}
}
return qfalse;
}
/*
====================
CG_IsStatementFiltered
Returns whether or not the statement is filtered
====================
*/
qboolean CG_IsStatementFiltered(char *cmd)
{
char* parsed;
char com_token[256];
qboolean bNextStatement = qfalse;
parsed = cmd;
for (Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token)); com_token[0]; Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token))) {
bNextStatement = RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (!Q_stricmp(com_token, "set") || !Q_stricmp(com_token, "setu") || !Q_stricmp(com_token, "seta")
|| !Q_stricmp(com_token, "sets") || !Q_stricmp(com_token, "append")) {
char type;
if (Q_stricmp(com_token, "append")) {
type = com_token[3];
} else {
type = 0;
}
//
// variable
//
Q_strncpyz(com_token, COM_ParseExt(&parsed, qfalse), sizeof(com_token));
bNextStatement |= RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (CG_IsSetVariableFiltered(com_token, type)) {
return qtrue;
}
} else {
//
// normal command
//
if (CG_IsCommandFiltered(com_token)) {
return qtrue;
}
}
if (!bNextStatement) {
// Skip up to the next statement
while (parsed && parsed[0]) {
char c = parsed[0];
parsed++;
if (c == '\n' || c == ';') {
break;
}
}
}
}
return qfalse;
}

View file

@ -0,0 +1,30 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// DESCRIPTION:
// cg_servercmds_filter.h -- filtered server commands
#pragma once
#include "cg_local.h"
qboolean CG_IsStatementFiltered(char *cmd);

View file

@ -131,10 +131,10 @@ void ClientGameCommandManager::FreeAllTempModels(void)
//=============== //===============
void ClientGameCommandManager::FreeSomeTempModels(void) void ClientGameCommandManager::FreeSomeTempModels(void)
{ {
ctempmodel_t* model; ctempmodel_t *model;
int count = 0; int count = 0;
unsigned int i; unsigned int i;
unsigned int numToFree; unsigned int numToFree;
if (!m_free_tempmodels) { if (!m_free_tempmodels) {
return; return;
@ -159,10 +159,10 @@ void ClientGameCommandManager::FreeSomeTempModels(void)
//=============== //===============
// FreeSpawnthing // FreeSpawnthing
//=============== //===============
void ClientGameCommandManager::FreeSpawnthing(spawnthing_t* sp) void ClientGameCommandManager::FreeSpawnthing(spawnthing_t *sp)
{ {
ctempmodel_t* model; ctempmodel_t *model;
ctempmodel_t* prev; ctempmodel_t *prev;
if (sp->numtempmodels) { if (sp->numtempmodels) {
for (model = m_active_tempmodels.prev; model != &m_active_tempmodels; model = prev) { for (model = m_active_tempmodels.prev; model != &m_active_tempmodels; model = prev) {
@ -199,7 +199,7 @@ void ClientGameCommandManager::ResetTempModels(void)
} }
static int lastTempModelFrameTime = 0; static int lastTempModelFrameTime = 0;
int next_tempmodel_warning = 0; int next_tempmodel_warning = 0;
void CG_ResetTempModels(void) void CG_ResetTempModels(void)
{ {
@ -228,11 +228,16 @@ void ClientGameCommandManager::InitializeTempModels(void)
void ClientGameCommandManager::InitializeTempModelCvars(void) void ClientGameCommandManager::InitializeTempModelCvars(void)
{ {
cg_showtempmodels = cgi.Cvar_Get("cg_showtempmodels", "0", 0); cg_showtempmodels = cgi.Cvar_Get("cg_showtempmodels", "0", 0);
cg_detail = cgi.Cvar_Get("detail", "1", CVAR_ARCHIVE); cg_detail = cgi.Cvar_Get("detail", "1", CVAR_ARCHIVE);
cg_effectdetail = cgi.Cvar_Get("cg_effectdetail", "0.2", CVAR_ARCHIVE);
cg_effectdetail = cgi.Cvar_Get("cg_effectdetail", "0.2", CVAR_ARCHIVE);
cgi.Cvar_CheckRange(cg_effectdetail, 0.2, 1.0, qfalse);
cg_effect_physicsrate = cgi.Cvar_Get("cg_effect_physicsrate", "10", CVAR_ARCHIVE); cg_effect_physicsrate = cgi.Cvar_Get("cg_effect_physicsrate", "10", CVAR_ARCHIVE);
cg_max_tempmodels = cgi.Cvar_Get("cg_max_tempmodels", "1100", CVAR_ARCHIVE); cg_max_tempmodels = cgi.Cvar_Get("cg_max_tempmodels", "1100", CVAR_ARCHIVE);
cgi.Cvar_CheckRange(cg_max_tempmodels, 200, MAX_TEMPMODELS, qtrue);
cg_reserve_tempmodels = cgi.Cvar_Get("cg_reserve_tempmodels", "200", CVAR_ARCHIVE); cg_reserve_tempmodels = cgi.Cvar_Get("cg_reserve_tempmodels", "200", CVAR_ARCHIVE);
if (cg_max_tempmodels->integer > MAX_TEMPMODELS) { if (cg_max_tempmodels->integer > MAX_TEMPMODELS) {
@ -253,9 +258,9 @@ void ClientGameCommandManager::InitializeTempModelCvars(void)
//=============== //===============
void ClientGameCommandManager::AnimateTempModel(ctempmodel_t *p, Vector origin, refEntity_t *newEnt) void ClientGameCommandManager::AnimateTempModel(ctempmodel_t *p, Vector origin, refEntity_t *newEnt)
{ {
int numframes; int numframes;
int deltatime; int deltatime;
int frametime; int frametime;
float prev; float prev;
// This code is for animating tempmodels that are spawned from the client // This code is for animating tempmodels that are spawned from the client
@ -491,16 +496,16 @@ void ClientGameCommandManager::OtherTempModelEffects(ctempmodel_t *p, Vector ori
if (p->number != -1) { if (p->number != -1) {
refEntity_t *old_entity; refEntity_t *old_entity;
dtiki_t *old_tiki; dtiki_t *old_tiki;
int oldnum; int oldnum;
float oldscale; float oldscale;
// Set the axis // Set the axis
AnglesToAxis(p->cgd.angles, axis); AnglesToAxis(p->cgd.angles, axis);
old_entity = current_entity; old_entity = current_entity;
old_tiki = current_tiki; old_tiki = current_tiki;
oldnum = current_entity_number; oldnum = current_entity_number;
oldscale = current_scale; oldscale = current_scale;
current_scale = newEnt->scale; current_scale = newEnt->scale;
current_entity = newEnt; current_entity = newEnt;
@ -525,7 +530,7 @@ void ClientGameCommandManager::OtherTempModelEffects(ctempmodel_t *p, Vector ori
if (p->cgd.flags2 & T2_ALIGNSTRETCH) { if (p->cgd.flags2 & T2_ALIGNSTRETCH) {
Vector vDelta; Vector vDelta;
float fScale; float fScale;
vDelta = p->cgd.origin - p->cgd.oldorigin; vDelta = p->cgd.origin - p->cgd.oldorigin;
fScale = vDelta.length() * p->cgd.scale2; fScale = vDelta.length() * p->cgd.scale2;
@ -562,8 +567,8 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
// If linked to the parent or hardlinked, get the parent's origin // If linked to the parent or hardlinked, get the parent's origin
if ((p->cgd.flags & (T_PARENTLINK | T_HARDLINK)) && (p->cgd.parent != ENTITYNUM_NONE)) { if ((p->cgd.flags & (T_PARENTLINK | T_HARDLINK)) && (p->cgd.parent != ENTITYNUM_NONE)) {
centity_t* pc; centity_t *pc;
refEntity_t* e; refEntity_t *e;
pc = &cg_entities[p->cgd.parent]; pc = &cg_entities[p->cgd.parent];
if (!pc->currentValid) { if (!pc->currentValid) {
@ -577,8 +582,7 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
parentOrigin = e->origin; parentOrigin = e->origin;
vectoangles(e->axis[0], parentAngles); vectoangles(e->axis[0], parentAngles);
} } else if (p->cgd.flags & T_SWARM) {
else if (p->cgd.flags & T_SWARM) {
p->cgd.parentOrigin = p->cgd.velocity + p->cgd.accel * ftime * scale; p->cgd.parentOrigin = p->cgd.velocity + p->cgd.accel * ftime * scale;
} }
@ -891,10 +895,11 @@ void ClientGameCommandManager::AddTempModels(void)
refEntity_t *old_ent; refEntity_t *old_ent;
// To counteract cg.time going backwards // To counteract cg.time going backwards
if (lastTempModelFrameTime && ((cg.time < lastTempModelFrameTime) || (cg.time - lastTempModelFrameTime > TOO_MUCH_TIME_PASSED))) { if (lastTempModelFrameTime
&& ((cg.time < lastTempModelFrameTime) || (cg.time - lastTempModelFrameTime > TOO_MUCH_TIME_PASSED))) {
p = m_active_tempmodels.prev; p = m_active_tempmodels.prev;
for (; p != &m_active_tempmodels; p = next) { for (; p != &m_active_tempmodels; p = next) {
next = p->prev; next = p->prev;
p->lastPhysicsTime = cg.time; p->lastPhysicsTime = cg.time;
} }
lastTempModelFrameTime = cg.time; lastTempModelFrameTime = cg.time;
@ -994,7 +999,7 @@ void ClientGameCommandManager::AddTempModels(void)
// Run physics if the lastEnt is not valid to get a valid lerp // Run physics if the lastEnt is not valid to get a valid lerp
if (!p->lastEntValid) { if (!p->lastEntValid) {
float t; float t;
t = physics_rate / 1000.0f; t = physics_rate / 1000.0f;
ret = TempModelPhysics(p, t, scale); ret = TempModelPhysics(p, t, scale);
if (!ret) { if (!ret) {
@ -1180,7 +1185,7 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
if (m_spawnthing->cgd.flags & T_WAVE) { if (m_spawnthing->cgd.flags & T_WAVE) {
p->m_spawnthing = m_spawnthing; p->m_spawnthing = m_spawnthing;
m_spawnthing->numtempmodels++; m_spawnthing->numtempmodels++;
start = Vector(0, 0, 0); start = Vector(0, 0, 0);
} else { } else {
p->m_spawnthing = NULL; p->m_spawnthing = NULL;
start = m_spawnthing->cgd.origin; start = m_spawnthing->cgd.origin;
@ -1205,7 +1210,7 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
Vector dst; Vector dst;
// Create a circular shaped burst around the up vector // Create a circular shaped burst around the up vector
float angle; float angle;
if (mcount == 1) { if (mcount == 1) {
angle = random() * 360; angle = random() * 360;
} else { } else {

View file

@ -963,6 +963,9 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
cg.bIntermissionDisplay = qfalse; cg.bIntermissionDisplay = qfalse;
} }
// Added in OPM
CG_ProcessPlayerModel();
// build the render lists // build the render lists
if (!cg.hyperspace) { if (!cg.hyperspace) {
CG_AddPacketEntities(); // after calcViewValues, so predicted player state is correct CG_AddPacketEntities(); // after calcViewValues, so predicted player state is correct

View file

@ -7,6 +7,11 @@ add_subdirectory("../cgame" "./cgame")
file(GLOB SOURCES_CLIENT "./*.c*") file(GLOB SOURCES_CLIENT "./*.c*")
file(GLOB_RECURSE SOURCES_UILIB "../uilib/*.c*") file(GLOB_RECURSE SOURCES_UILIB "../uilib/*.c*")
set(SOURCES_CLIENT ${SOURCES_CLIENT}
# Gamespy
"${CMAKE_SOURCE_DIR}/code/gamespy/cl_gamespy.c"
)
# Made as an interface and not static, as static only links used methods # Made as an interface and not static, as static only links used methods
add_library(omohclient INTERFACE) add_library(omohclient INTERFACE)
target_compile_definitions(omohclient INTERFACE APP_MODULE) target_compile_definitions(omohclient INTERFACE APP_MODULE)

View file

@ -629,6 +629,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->Cvar_Get = Cvar_Get; cgi->Cvar_Get = Cvar_Get;
cgi->Cvar_Find = Cvar_FindVar; cgi->Cvar_Find = Cvar_FindVar;
cgi->Cvar_Set = Cvar_Set; cgi->Cvar_Set = Cvar_Set;
cgi->Cvar_CheckRange = Cvar_CheckRange;
cgi->Argc = Cmd_Argc; cgi->Argc = Cmd_Argc;
cgi->Args = Cmd_Args; cgi->Args = Cmd_Args;

View file

@ -866,8 +866,8 @@ qboolean CL_ReadyToSendPacket( void ) {
} }
// check for exceeding cl_maxpackets // check for exceeding cl_maxpackets
if ( cl_maxpackets->integer < 15 ) { if ( cl_maxpackets->integer < 30 ) {
Cvar_Set( "cl_maxpackets", "15" ); Cvar_Set( "cl_maxpackets", "30" );
} else if ( cl_maxpackets->integer > 125 ) { } else if ( cl_maxpackets->integer > 125 ) {
Cvar_Set( "cl_maxpackets", "125" ); Cvar_Set( "cl_maxpackets", "125" );
} }

View file

@ -0,0 +1,640 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "cl_ui.h"
#include "cl_instantAction.h"
#include "cl_uiserverlist.h"
#include "../gamespy/sv_gamespy.h"
Event EV_UIInstantAction_AcceptServer
(
"acceptserver",
EV_DEFAULT,
NULL,
NULL,
"Connect to the current server"
);
Event EV_UIInstantAction_RejectServer
(
"rejectserver",
EV_DEFAULT,
NULL,
NULL,
"Reject the current server"
);
Event EV_UIInstantAction_Cancel
(
"ia_cancel",
EV_DEFAULT,
NULL,
NULL,
"cancel the server update"
);
Event EV_UIInstantAction_Refresh
(
"ia_refresh",
EV_DEFAULT,
NULL,
NULL,
"Refresh the server list"
);
CLASS_DECLARATION(UIWidget, UIInstantAction, NULL) {
{&EV_UIInstantAction_AcceptServer, &UIInstantAction::Connect },
{&EV_UIInstantAction_RejectServer, &UIInstantAction::Reject },
{&EV_UIInstantAction_Cancel, &UIInstantAction::CancelRefresh},
{&EV_UIInstantAction_Refresh, &UIInstantAction::Refresh },
{NULL, NULL }
};
struct ServerListInstance {
int iServerType;
UIInstantAction *pServerList;
};
ServerListInstance g_IAServerListInst[2];
UIInstantAction::UIInstantAction()
{
state = IA_INITIALIZE;
numFoundServers = 0;
numServers = 0;
minPlayers = 3;
startingMaxPing = 100;
endingMaxPing = 1500;
maxServers = -1;
servers = NULL;
doneList[0] = false;
doneList[1] = false;
serverList[0] = NULL;
serverList[1] = NULL;
ReadIniFile();
EnableServerInfo(false);
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_refresh_button", new Event(EV_Widget_Disable));
}
UIInstantAction::~UIInstantAction()
{
CleanUp();
}
void UIInstantAction::CleanUp()
{
if (serverList[0]) {
ServerListFree(serverList[0]);
serverList[0] = NULL;
}
if (serverList[1]) {
ServerListFree(serverList[1]);
serverList[1] = NULL;
}
if (servers) {
delete[] servers;
servers = NULL;
}
}
void UIInstantAction::Init()
{
const char *secret_key;
const char *game_name;
static const unsigned int iNumConcurrent = 10;
numFoundServers = 0;
numServers = 0;
doneList[0] = false;
doneList[1] = false;
EnableServerInfo(false);
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_refresh_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_noserverfound", new Event(EV_Widget_Disable));
Cvar_Set("ia_search_percentage", va("%d %%", 0));
if (com_target_game->integer < target_game_e::TG_MOHTT) {
g_IAServerListInst[0].iServerType = com_target_game->integer;
g_IAServerListInst[0].pServerList = this;
game_name = GS_GetGameName(com_target_game->integer);
secret_key = GS_GetGameKey(com_target_game->integer);
serverList[0] = ServerListNew(
game_name,
game_name,
secret_key,
iNumConcurrent,
(void *)&IAServerListCallBack,
1,
(void *)&g_IAServerListInst[0]
);
ServerListClear(serverList[0]);
} else {
g_IAServerListInst[0].iServerType = target_game_e::TG_MOHTT;
g_IAServerListInst[0].pServerList = this;
game_name = GS_GetGameName(target_game_e::TG_MOHTT);
secret_key = GS_GetGameKey(target_game_e::TG_MOHTT);
serverList[0] = ServerListNew(
game_name,
game_name,
secret_key,
iNumConcurrent,
(void *)&IAServerListCallBack,
1,
(void *)&g_IAServerListInst[0]
);
ServerListClear(serverList[0]);
g_IAServerListInst[1].iServerType = target_game_e::TG_MOHTA;
g_IAServerListInst[1].pServerList = this;
game_name = GS_GetGameName(target_game_e::TG_MOHTA);
secret_key = GS_GetGameKey(target_game_e::TG_MOHTA);
serverList[1] = ServerListNew(
game_name,
game_name,
secret_key,
iNumConcurrent,
(void *)&IAServerListCallBack,
1,
(void *)&g_IAServerListInst[1]
);
ServerListClear(serverList[1]);
}
state = IA_WAITING;
numFoundServers = 0;
ServerListUpdate(serverList[0], true);
if (serverList[1]) {
ServerListUpdate(serverList[1], true);
}
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("searchstatus", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("searchstatuslable", new Event(EV_Widget_Enable));
}
int UIInstantAction::GetServerIndex(int maxPing, int gameType)
{
int bestPing = 1500;
int bestServer = -1;
int i;
for (i = 0; i < numFoundServers; i++) {
const IAServer_t& IAServer = servers[i];
char *gameVer;
float fGameVer;
int ping;
int numPlayers;
if (IAServer.rejected) {
continue;
}
// Skip servers that don't match the provided game type
if (ServerGetIntValue(IAServer.server, "g_gametype_i", 1) != gameType) {
continue;
}
// Skip servers with high ping
ping = ServerGetPing(IAServer.server);
if (ping > maxPing) {
continue;
}
gameVer = ServerGetStringValue(IAServer.server, "gamever", "1.00");
if (com_target_demo->integer && *gameVer != 'd') {
// Skip retail servers on demo game
continue;
} else if (!com_target_demo->integer && *gameVer == 'd') {
// Skip demo servers on retail game
continue;
}
// Skip incompatible servers
fGameVer = atof(gameVer);
if (com_target_game->integer >= target_game_e::TG_MOHTT) {
if (IAServer.serverGame.serverType == target_game_e::TG_MOHTT) {
if (fabs(fGameVer) < 2.3f) {
continue;
}
} else {
if (fabs(fGameVer) < 2.1f) {
continue;
}
}
} else {
if (fabs(fGameVer - com_target_version->value) > 0.1f) {
continue;
}
}
// Skip servers with a password
if (ServerGetIntValue(IAServer.server, "password", 0)) {
continue;
}
// Skip servers that don't match the minimum number of players
numPlayers = ServerGetIntValue(IAServer.server, "numplayers", 0);
if (numPlayers < minPlayers) {
continue;
}
// Skip full servers
if (numPlayers == ServerGetIntValue(IAServer.server, "maxplayers", 0)) {
continue;
}
// Skip servers with an higher ping than the best one
if (ping >= bestPing) {
continue;
}
//
// Found a potential server
//
bestPing = ping;
bestServer = i;
}
return bestServer;
}
void UIInstantAction::ReadIniFile()
{
char *buffer;
const char *p;
const char *pVal;
int intValue;
char value[32];
if (!FS_ReadFileEx("iaction.ini", (void **)&buffer, qtrue)) {
return;
}
for (p = buffer; p; p = strstr(pVal, "\n")) {
if (sscanf(p, "%31s", value) != 1) {
break;
}
pVal = strstr(p, "=");
if (!pVal) {
break;
}
pVal++;
if (sscanf(pVal, "%d", &intValue) != 1) {
break;
}
if (!Q_stricmpn(value, "MinPlayers", 10)) {
minPlayers = intValue;
}
if (!Q_stricmpn(value, "StartingMaxPing", 15)) {
startingMaxPing = intValue;
}
if (!Q_stricmpn(value, "EndingMaxPing", 13)) {
endingMaxPing = intValue;
}
if (!Q_stricmpn(value, "MaxServers", 10)) {
maxServers = intValue;
}
}
}
void UIInstantAction::FindServer()
{
int ping;
int i;
currentServer = -1;
state = IA_NONE;
for (ping = startingMaxPing; ping < endingMaxPing; ping += 100) {
//
// Find the best server starting from FFA gametype first
//
for (i = 1; i < 7; i++) {
currentServer = GetServerIndex(ping, i);
if (currentServer >= 0) {
break;
}
}
if (currentServer >= 0) {
break;
}
}
menuManager.PassEventToWidget("ia_refresh_button", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("searchstatus", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("searchstatuslable", new Event(EV_Widget_Disable));
if (currentServer < 0) {
EnableServerInfo(false);
menuManager.PassEventToWidget("ia_noserverfound", new Event(EV_Widget_Enable));
return;
}
const IAServer_t& IAServer = servers[currentServer];
const char *hostname = ServerGetStringValue(IAServer.server, "hostname", "(NONE)");
const char *gametype = ServerGetStringValue(IAServer.server, "gametype", "(NONE)");
int numplayers = ServerGetIntValue(IAServer.server, "numplayers", 0);
int maxplayers = ServerGetIntValue(IAServer.server, "maxplayers", 0);
ping = ServerGetPing(IAServer.server);
Cvar_Set("ia_servername", va(" %s", hostname));
Cvar_Set("ia_ping", va("%d", ping));
Cvar_Set("ia_gametype", va("%s", gametype));
Cvar_Set("ia_players", va("%d", numplayers));
Cvar_Set("ia_maxplayers", va("%d", maxplayers));
EnableServerInfo(true);
}
void UIInstantAction::Connect(Event *ev)
{
char *gameVer;
float fGameVer;
bool bDiffVersion;
char command[256];
if (currentServer < 0 || currentServer < numServers) {
return;
}
const IAServer_t& IAServer = servers[currentServer];
gameVer = ServerGetStringValue(IAServer.server, "gamever", "1.00");
if (gameVer[0] == 'd') {
gameVer++;
}
// Skip incompatible servers
fGameVer = atof(gameVer);
bDiffVersion = false;
if (com_target_game->integer >= target_game_e::TG_MOHTT) {
if (IAServer.serverGame.serverType == target_game_e::TG_MOHTT) {
if (fabs(fGameVer) < 2.3f) {
bDiffVersion = true;
}
} else {
if (fabs(fGameVer) < 2.1f) {
bDiffVersion = true;
}
}
} else {
if (fabs(fGameVer - com_target_version->value) > 0.1f) {
bDiffVersion = true;
}
}
if (bDiffVersion) {
if (fGameVer - com_target_version->value > 0) {
// Older version
UI_SetReturnMenuToCurrent();
Cvar_Set("com_errormessage", va("Server is version %s, you are using %s", gameVer, "2.40"));
UI_PushMenu("wrongversion");
} else {
// Server version is newer
Cvar_Set("dm_serverstatus", va("Can not connect to v%s server, you are using v%s", gameVer, "2.40"));
}
}
UI_SetReturnMenuToCurrent();
Cvar_Set("g_servertype", va("%d", servers[currentServer].serverGame.serverType));
Com_sprintf(
command,
sizeof(command),
"connect %s:%i\n",
ServerGetAddress(IAServer.server),
ServerGetIntValue(IAServer.server, "hostport", PORT_SERVER)
);
Cbuf_AddText(command);
}
void UIInstantAction::Reject(Event *ev)
{
servers[currentServer].rejected = 1;
FindServer();
}
void UIInstantAction::Draw()
{
switch (state) {
case IA_INITIALIZE:
Init();
break;
case IA_UPDATE:
Update();
break;
case IA_FINISHED:
FindServer();
break;
default:
break;
}
if (serverList[0]) {
ServerListThink(serverList[0]);
}
if (serverList[1]) {
ServerListThink(serverList[1]);
}
}
void UIInstantAction::Update()
{
numFoundServers = 0;
// count the total number of servers from both server list
numServers = ServerListCount(serverList[0]);
if (serverList[1]) {
numServers += ServerListCount(serverList[1]);
}
state = IA_FINISHED;
servers = new IAServer_t[numServers];
ServerListHalt(serverList[0]);
if (serverList[1]) {
ServerListHalt(serverList[1]);
}
ServerListThink(serverList[0]);
if (serverList[1]) {
ServerListThink(serverList[1]);
}
state = IA_SEARCHING;
// Start updating the first list
doneList[0] = false;
ServerListClear(serverList[0]);
ServerListUpdate(serverList[0], true);
// Update the second optional list
if (serverList[1]) {
doneList[1] = false;
ServerListClear(serverList[1]);
ServerListUpdate(serverList[1], true);
}
}
int UIInstantAction::AddServer(GServer server, const ServerGame_t& serverGame)
{
servers[numFoundServers].server = server;
servers[numFoundServers].serverGame = serverGame;
servers[numFoundServers].rejected = false;
numFoundServers++;
return numFoundServers;
}
void UIInstantAction::CancelRefresh(Event *ev)
{
state = IA_FINISHED;
ServerListHalt(serverList[0]);
ServerListHalt(serverList[1]);
}
void UIInstantAction::Refresh(Event *ev)
{
state = IA_INITIALIZE;
}
void UIInstantAction::EnableServerInfo(bool enable)
{
if (enable) {
menuManager.PassEventToWidget("iaservername_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_servername_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_ping_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_ping_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_gametype_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_gametype_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_players_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_players_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_maxplayers_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_maxplayers_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("acceptserver", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("rejectserver", new Event(EV_Widget_Enable));
} else {
menuManager.PassEventToWidget("iaservername_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_servername_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_ping_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_ping_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_gametype_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_gametype_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_players_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_players_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_maxplayers_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_maxplayers_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("acceptserver", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("rejectserver", new Event(EV_Widget_Disable));
}
}
void UIInstantAction::IAServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2)
{
const ServerListInstance *pInstance = (const ServerListInstance *)instance;
UIInstantAction *pServerList = pInstance->pServerList;
if (msg == LIST_PROGRESS) {
if (pServerList->state == IA_WAITING) {
if (pInstance->iServerType == com_target_game->integer) {
pServerList->doneList[0] = true;
}
if (com_target_game->integer >= target_game_e::TG_MOHTT && pInstance->iServerType == target_game_e::TG_MOHTA) {
pServerList->doneList[1] = true;
}
if (pServerList->doneList[0] && (!pServerList->serverList[1] || pServerList->doneList[1])) {
pServerList->state = IA_UPDATE;
}
} else if (pServerList->state == IA_SEARCHING) {
ServerGame_t serverGame;
serverGame.serverType = pInstance->iServerType;
const int serverIndex = pServerList->AddServer((GServer)param1, serverGame);
Cvar_Set("ia_search_percentage", va("%d %%", 100 * serverIndex / pServerList->numServers));
if (pServerList->maxServers >= 0 && serverIndex >= pServerList->maxServers) {
// Reached the maximum number of servers, stop there
pServerList->doneList[0] = true;
ServerListHalt(pServerList->serverList[0]);
if (pServerList->serverList[1]) {
pServerList->doneList[1] = true;
ServerListHalt(pServerList->serverList[1]);
}
pServerList->state = IA_FINISHED;
}
}
} else if (msg == LIST_STATECHANGED && ServerListState(serverlist) == GServerListState::sl_idle) {
if (pInstance->iServerType == com_target_game->integer) {
pServerList->doneList[0] = true;
}
if (com_target_game->integer >= target_game_e::TG_MOHTT && pInstance->iServerType == target_game_e::TG_MOHTA) {
pServerList->doneList[1] = true;
}
if (pServerList->doneList[0] && (!pServerList->serverList[1] || pServerList->doneList[1])) {
if (pServerList->state == IA_WAITING) {
pServerList->state = IA_UPDATE;
}
if (pServerList->state == IA_SEARCHING) {
pServerList->state = IA_FINISHED;
}
}
}
}

View file

@ -0,0 +1,103 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// Added in 2.30
// Instantly find a server matching common criterias
#pragma once
#include "../gamespy/goaceng.h"
typedef struct {
int serverType;
} ServerGame_t;
typedef struct {
GServer server;
ServerGame_t serverGame;
bool rejected;
} IAServer_t;
enum IAState_e {
IA_NONE,
IA_INITIALIZE,
IA_WAITING,
IA_UPDATE,
IA_SEARCHING,
IA_FINISHED
};
class UIInstantAction : public UIWidget
{
public:
CLASS_PROTOTYPE(UIInstantAction);
public:
UIInstantAction();
~UIInstantAction() override;
void CleanUp();
void Init();
int GetServerIndex(int maxPing, int gameType);
void ReadIniFile();
void FindServer();
void Connect(Event *ev);
void Reject(Event *ev);
void Draw();
void Update();
int AddServer(GServer server, const ServerGame_t& serverGame);
void CancelRefresh(Event *ev);
void Refresh(Event *ev);
void EnableServerInfo(bool enable);
private:
static void IAServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2);
private:
//
// List
//
bool doneList[2];
GServerList serverList[2];
int maxServers;
//
// Current states
//
IAState_e state;
int numServers;
int numFoundServers;
//
// Filters
//
int minPlayers;
int startingMaxPing;
int endingMaxPing;
//
// Servers
//
IAServer_t *servers;
int currentServer;
};

View file

@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/localization.h" #include "../qcommon/localization.h"
#include "../qcommon/bg_compat.h" #include "../qcommon/bg_compat.h"
#include "../sys/sys_local.h" #include "../sys/sys_local.h"
#include "../sys/sys_update_checker.h"
#include "../uilib/uimessage.h"
extern "C" { extern "C" {
#include "../sys/sys_loadlib.h" #include "../sys/sys_loadlib.h"
@ -171,6 +173,7 @@ void CL_ServerStatus_f(void);
void CL_ServerStatusResponse( netadr_t from, msg_t *msg ); void CL_ServerStatusResponse( netadr_t from, msg_t *msg );
static qboolean cl_bCLSystemStarted = qfalse; static qboolean cl_bCLSystemStarted = qfalse;
static qboolean cl_updateNotified = qfalse;
/* /*
=============== ===============
@ -2597,6 +2600,36 @@ void CL_SetFrameNumber(int frameNumber) {
re.SetFrameNumber(frameNumber); re.SetFrameNumber(frameNumber);
} }
/*
==================
CL_VerifyUpdate
Check for a new version and display a message box
when a new version is available
==================
*/
void CL_VerifyUpdate() {
if (cl_updateNotified) {
return;
}
int lastMajor, lastMinor, lastPatch;
if (updateChecker.CheckNewVersion(lastMajor, lastMinor, lastPatch)) {
cl_updateNotified = true;
const char *updateText =
va("A new update is available!\n"
"The latest version is v%d.%d.%d (you are running v%s).\n"
"Check https://github.com/openmoh/openmohaa for more.",
lastMajor,
lastMinor,
lastPatch,
PRODUCT_VERSION_NUMBER_STRING);
UIMessageDialog::ShowMessageBox("Update available", updateText);
}
}
/* /*
================== ==================
CL_Frame CL_Frame
@ -2635,6 +2668,8 @@ void CL_Frame ( int msec ) {
S_TriggeredMusic_PlayIntroMusic(); S_TriggeredMusic_PlayIntroMusic();
UI_MenuEscape("main"); UI_MenuEscape("main");
} }
CL_VerifyUpdate();
} else if (clc.state == CA_CINEMATIC) { } else if (clc.state == CA_CINEMATIC) {
UI_ForceMenuOff(qtrue); UI_ForceMenuOff(qtrue);
} }
@ -3618,8 +3653,8 @@ void CL_Init( void ) {
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE ); cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE );
// userinfo // userinfo
name = Cvar_Get ("name", "UnnamedSoldier", CVAR_USERINFO | CVAR_ARCHIVE ); name = Cvar_Get ("name", va("UnnamedSoldier#%d", rand() % 100000), CVAR_USERINFO | CVAR_ARCHIVE);
cl_rate = Cvar_Get ("rate", "5000", CVAR_USERINFO | CVAR_ARCHIVE ); cl_rate = Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get ("snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("password", "", CVAR_USERINFO); Cvar_Get ("password", "", CVAR_USERINFO);
Cvar_Get ("dm_playermodel", "american_army", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get ("dm_playermodel", "american_army", CVAR_USERINFO | CVAR_ARCHIVE );
@ -3685,6 +3720,12 @@ void CL_Init( void ) {
end = Sys_Milliseconds(); end = Sys_Milliseconds();
if (com_gotOriginalConfig) {
// Added in OPM
// Apply config tweaks after loading the original config
CL_ApplyOriginalConfigTweaks();
}
Com_Printf( "----- Client Initialization Complete ----- %i ms\n", start - end ); Com_Printf( "----- Client Initialization Complete ----- %i ms\n", start - end );
} }
@ -4861,3 +4902,15 @@ void TIKI_CG_Command_ProcessFile(char* filename, qboolean quiet, dtiki_t* curTik
Com_Printf("NO CGE \n"); Com_Printf("NO CGE \n");
} }
void CL_ApplyOriginalConfigTweaks()
{
cvar_t* snaps = Cvar_Get("snaps", "", 0);
// Those variables are not editable via UI so reset them
// snaps/maxpackets can also have wrong values due to them being changed
// via stufftext
Cvar_Set("snaps", snaps->resetString);
Cvar_Set("cl_maxpackets", cl_maxpackets->resetString);
}

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/q_version.h" #include "../qcommon/q_version.h"
#include "cl_ui.h" #include "cl_ui.h"
#include "cl_uigamespy.h"
#include <ctime> #include <ctime>
@ -152,6 +153,10 @@ static str scoreboard_menuname;
static str ui_sCurrentLoadingMenu; static str ui_sCurrentLoadingMenu;
static Container<Menu *> hudList; static Container<Menu *> hudList;
const UColor UWhiteChatMessageColor(0.75, 0.75, 0.75);
const UColor URedChatMessageColor(1.0, 0.25, 0.25);
const UColor UGreenChatMessageColor(0.0, 1.0, 0.25, 1.0);
void UI_MultiplayerMenuWidgetsUpdate(void); void UI_MultiplayerMenuWidgetsUpdate(void);
void UI_MultiplayerMainMenuWidgetsUpdate(void); void UI_MultiplayerMainMenuWidgetsUpdate(void);
void UI_MainMenuWidgetsUpdate(void); void UI_MainMenuWidgetsUpdate(void);
@ -1303,11 +1308,11 @@ UI_PrintConsole
*/ */
void UI_PrintConsole(const char *msg) void UI_PrintConsole(const char *msg)
{ {
UColor *pColor = NULL; const UColor *pColor = NULL;
const char *pszString; const char *pszString;
char szString[1024]; char szString[1024];
char szBlah[1024]; char szBlah[1024];
qboolean bPrintedDMBox = qfalse; qboolean bPrintedDMBox = qfalse;
pszString = msg; pszString = msg;
strncpy(szString, msg, 1024); strncpy(szString, msg, 1024);
@ -1325,7 +1330,7 @@ void UI_PrintConsole(const char *msg)
break; break;
case MESSAGE_CHAT_WHITE: case MESSAGE_CHAT_WHITE:
bDMMessage = qtrue; bDMMessage = qtrue;
pColor = &UGrey; pColor = &UWhiteChatMessageColor;
break; break;
case MESSAGE_WHITE: case MESSAGE_WHITE:
bBold = qtrue; bBold = qtrue;
@ -1333,11 +1338,11 @@ void UI_PrintConsole(const char *msg)
break; break;
case MESSAGE_CHAT_RED: case MESSAGE_CHAT_RED:
bDeathMessage = MESSAGE_CHAT_RED; bDeathMessage = MESSAGE_CHAT_RED;
pColor = &ULightRed; pColor = &URedChatMessageColor;
break; break;
case MESSAGE_CHAT_GREEN: case MESSAGE_CHAT_GREEN:
bDeathMessage = MESSAGE_CHAT_GREEN; bDeathMessage = MESSAGE_CHAT_GREEN;
pColor = &UGreen; pColor = &UGreenChatMessageColor;
break; break;
} }
@ -4367,10 +4372,8 @@ UI_ShowScoreboard_f
void UI_ShowScoreboard_f(const char *pszMenuName) void UI_ShowScoreboard_f(const char *pszMenuName)
{ {
if (pszMenuName) { if (pszMenuName) {
if (scoreboard_menuname.length()) { if (scoreboard_menuname.length() && str::icmp(scoreboard_menuname, pszMenuName) && scoreboard_menu) {
if (str::icmp(scoreboard_menuname, pszMenuName)) { scoreboard_menu->ForceHide();
scoreboard_menu->ForceHide();
}
} }
scoreboard_menuname = pszMenuName; scoreboard_menuname = pszMenuName;
@ -4419,7 +4422,10 @@ void UI_HideScoreboard_f(void)
} }
if (scoreboard_menuname.length()) { if (scoreboard_menuname.length()) {
scoreboard_menu->ForceHide(); // Fixed in 2.30 (scoreboard_menu check)
if (scoreboard_menu) {
scoreboard_menu->ForceHide();
}
} }
} }
@ -5342,6 +5348,7 @@ void CL_InitializeUI(void)
Cmd_AddCommand("setreturnmenu", UI_SetReturnMenuToCurrent); Cmd_AddCommand("setreturnmenu", UI_SetReturnMenuToCurrent);
Cmd_AddCommand("gotoreturnmenu", UI_PushReturnMenu_f); Cmd_AddCommand("gotoreturnmenu", UI_PushReturnMenu_f);
Cmd_AddCommand("salesscreen", UI_SalesScreen_f); Cmd_AddCommand("salesscreen", UI_SalesScreen_f);
Cmd_AddCommand("launchgamespy", UI_LaunchGameSpy_f);
if (developer->integer) { if (developer->integer) {
UColor bgColor; UColor bgColor;

View file

@ -47,10 +47,13 @@ void CL_ShutdownUI(void);
// //
// general ui stuff // general ui stuff
// //
extern inventory_t client_inv; extern inventory_t client_inv;
extern bind_t client_bind; extern bind_t client_bind;
extern cvar_t *cl_greenfps; extern cvar_t *cl_greenfps;
extern qboolean server_loading; extern qboolean server_loading;
extern const UColor UWhiteChatMessageColor;
extern const UColor URedChatMessageColor;
extern const UColor UGreenChatMessageColor;
const char *CvarGetForUI(const char *name, const char *defval); const char *CvarGetForUI(const char *name, const char *defval);
void UI_ClearState(void); void UI_ClearState(void);

View file

@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "cl_ui.h" #include "cl_ui.h"
#include "../qcommon/localization.h"
Event EV_DMBox_Goin Event EV_DMBox_Goin
( (
@ -299,23 +300,19 @@ void UIDMBox::Print(const char *text)
m_items[m_numitems].flags = 0; m_items[m_numitems].flags = 0;
if (*text == MESSAGE_CHAT_WHITE) { if (*text == MESSAGE_CHAT_WHITE) {
m_items[m_numitems].color = UGrey; m_items[m_numitems].color = UWhiteChatMessageColor;
m_items[m_numitems].font = m_fontbold; m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_BOLD; m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_BOLD;
text1 = text + 1; text1 = text + 1;
} else if (*text == MESSAGE_CHAT_RED) { } else if (*text == MESSAGE_CHAT_RED) {
m_items[m_numitems].color = ULightRed; m_items[m_numitems].color = URedChatMessageColor;
m_items[m_numitems].font = m_fontbold; m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH; m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH;
text1 = text + 1; text1 = text + 1;
} else if (*text == MESSAGE_CHAT_GREEN) { } else if (*text == MESSAGE_CHAT_GREEN) {
if (com_target_game->integer >= TG_MOHTA) { m_items[m_numitems].color = UGreenChatMessageColor;
m_items[m_numitems].color = ULightGreen;
} else {
m_items[m_numitems].color = UGreen;
}
m_items[m_numitems].font = m_fontbold; m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH; m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH;
@ -325,7 +322,7 @@ void UIDMBox::Print(const char *text)
m_items[m_numitems].font = m_font; m_items[m_numitems].font = m_font;
} }
m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, text1, s_dmboxWidth); m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, Sys_LV_CL_ConvertString(text1), s_dmboxWidth);
m_numitems++; m_numitems++;
VerifyBoxOut(); VerifyBoxOut();

View file

@ -0,0 +1,118 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// cl_uigamespy.cpp
#include "cl_uigamespy.h"
CLASS_DECLARATION(UIFloatingWindow, GameSpyDialog, NULL) {
{&W_Deactivated, &UIFloatingWindow::ClosePressed},
{NULL, NULL }
};
GameSpyDialog::GameSpyDialog()
: overlay(NULL)
, label(NULL)
, closeButton(NULL)
{
AddFlag(WF_ALWAYS_TOP);
}
GameSpyDialog::~GameSpyDialog()
{
if (overlay) {
delete overlay;
overlay = NULL;
}
if (label) {
delete label;
label = NULL;
}
if (closeButton) {
delete closeButton;
closeButton = NULL;
}
}
void GameSpyDialog::FrameInitialized(void)
{
UIFloatingWindow::FrameInitialized();
label = new UILabel();
label->InitFrame(getChildSpace(), getChildSpace()->getClientFrame(), 0);
label->setTitle(
"GameSpy's multiplayer matchmaking\n"
"and server browsing services, which were\n"
"essential for online gaming in many classic\n"
"titles including Medal of Honor: Allied Assault,\n"
"were permanently shut down in 2014."
);
label->setForegroundColor(UHudColor);
closeButton = new UIButton();
closeButton->InitFrame(getChildSpace(), UIRect2D(100, 150, 100, 30), 0);
closeButton->setTitle("Close");
closeButton->AllowActivate(true);
closeButton->Connect(this, W_Button_Pressed, W_Deactivated);
overlay = new UIButton();
overlay->InitFrame(NULL, UIRect2D(0, 0, uid.vidWidth, uid.vidHeight), 0);
overlay->setBackgroundColor(UColor(0, 0, 0, 0.5f), true);
overlay->AllowActivate(true);
overlay->Connect(this, W_Button_Pressed, W_Deactivated);
}
void GameSpyDialog::Create(
UIWidget *parent, const UIRect2D& rect, const char *title, const UColor& bgColor, const UColor& fgColor
)
{
// First call parent's Create
UIFloatingWindow::Create(parent, rect, title, bgColor, fgColor);
// After creation, find minimize button by name and hide it
for (UIWidget *child = getFirstChild(); child; child = getNextChild(child)) {
if (strcmp(child->getName(), "minimizebutton") == 0) {
child->setShow(false);
break;
}
}
}
void UI_LaunchGameSpy_f(void)
{
GameSpyDialog *dialog = new GameSpyDialog();
dialog->Create(
NULL,
UIRect2D((uid.vidWidth - 300) / 2, (uid.vidHeight - 200) / 2, 300, 200),
"GameSpy",
UColor(0.15f, 0.195f, 0.278f),
UHudColor
);
uWinMan.ActivateControl(dialog);
dialog->Connect(dialog, W_Deactivated, W_Deactivated);
}

View file

@ -0,0 +1,50 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// cl_gamespy.h
#ifndef __CL_GAMESPY_H__
#define __CL_GAMESPY_H__
#include "cl_ui.h"
#include "keycodes.h"
class GameSpyDialog : public UIFloatingWindow
{
private:
UIButton *overlay;
UILabel *label;
UIButton *closeButton;
protected:
void FrameInitialized(void) override;
public:
GameSpyDialog();
~GameSpyDialog();
void
Create(UIWidget *parent, const UIRect2D& rect, const char *title, const UColor& bgColor, const UColor& fgColor);
CLASS_PROTOTYPE(GameSpyDialog);
};
void UI_LaunchGameSpy_f(void);
#endif

View file

@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "cl_ui.h" #include "cl_ui.h"
#include "../qcommon/localization.h"
Event EV_GMBox_Goin Event EV_GMBox_Goin
( (
@ -295,7 +296,7 @@ void UIGMBox::Print(const char *text)
m_items[m_numitems].flags = 0; m_items[m_numitems].flags = 0;
if (*text == 3) { if (*text == MESSAGE_WHITE) {
m_items[m_numitems].color = UWhite; m_items[m_numitems].color = UWhite;
m_items[m_numitems].font = m_fontbold; m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= GMBOX_ITEM_FLAG_BOLD; m_items[m_numitems].flags |= GMBOX_ITEM_FLAG_BOLD;
@ -306,7 +307,7 @@ void UIGMBox::Print(const char *text)
m_items[m_numitems].font = m_font; m_items[m_numitems].font = m_font;
} }
m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, text1, s_gmboxWidth); m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, Sys_LV_CL_ConvertString(text1), s_gmboxWidth);
m_numitems++; m_numitems++;
VerifyBoxOut(); VerifyBoxOut();

View file

@ -333,6 +333,7 @@ str FAKKLoadGameItem::getListItemString(int which) const
{ {
int numseconds; int numseconds;
int numseconds_hours; int numseconds_hours;
int seconds;
// hours // hours
numseconds = atol(strings[1]); numseconds = atol(strings[1]);
@ -341,17 +342,18 @@ str FAKKLoadGameItem::getListItemString(int which) const
// minutes // minutes
numseconds_hours = numseconds % 3600; numseconds_hours = numseconds % 3600;
if (numseconds_hours / 60 <= 9) { if (numseconds_hours / 60 < 10) {
itemstring += "0"; itemstring += "0";
} }
itemstring += (numseconds_hours / 60); itemstring += (numseconds_hours / 60);
itemstring += ":"; itemstring += ":";
// seconds // seconds
if (numseconds_hours / 60 <= 9) { seconds = numseconds_hours % 60;
if (seconds < 10) {
itemstring += "0"; itemstring += "0";
} }
itemstring += (numseconds_hours % 60); itemstring += seconds;
} }
break; break;
case 2: case 2:
@ -360,7 +362,7 @@ str FAKKLoadGameItem::getListItemString(int which) const
char buffer[2048]; char buffer[2048];
time = atol(strings[2]); time = atol(strings[2]);
strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", localtime(&time)); strftime(buffer, sizeof(buffer), "%a %b %d %Y %H:%M:%S", localtime(&time));
itemstring = buffer; itemstring = buffer;
} }
break; break;

File diff suppressed because it is too large Load diff

View file

@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#pragma once #pragma once
#include "../gamespy/goaceng.h"
class UIFAKKServerList : public UIListCtrl { class UIFAKKServerList : public UIListCtrl {
protected: protected:
// need a new struct instead of gamespy // need a new struct instead of gamespy
@ -47,6 +49,7 @@ protected:
void MakeLANListing( Event *ev ); void MakeLANListing( Event *ev );
void UpdateServer( Event *ev ); void UpdateServer( Event *ev );
static int ServerCompareFunction( const UIListCtrlItem *i1, const UIListCtrlItem *i2, int columnname ); static int ServerCompareFunction( const UIListCtrlItem *i1, const UIListCtrlItem *i2, int columnname );
static void UpdateServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2);
public: public:
UIFAKKServerList(); UIFAKKServerList();

View file

@ -561,6 +561,7 @@ qboolean CL_CheckPaused(void);
int CL_GetRefSequence(void); int CL_GetRefSequence(void);
qboolean CL_IsRendererLoaded(void); qboolean CL_IsRendererLoaded(void);
void CL_ApplyOriginalConfigTweaks();
// //
// cl_input // cl_input

View file

@ -36,15 +36,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef USE_LOCAL_HEADERS #ifdef USE_LOCAL_HEADERS
#include "../AL/al.h" #include "../AL/al.h"
#include "../AL/alc.h" #include "../AL/alc.h"
#include "../AL/alext.h"
#else #else
#if defined(_MSC_VER) || defined(__APPLE__) #if defined(_MSC_VER) || defined(__APPLE__)
// MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme. // MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme.
// OSX framework also needs this // OSX framework also needs this
#include <al.h> #include <al.h>
#include <alc.h> #include <alc.h>
#include <alext.h>
#else #else
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>
#include <AL/alext.h>
#endif #endif
#endif #endif

View file

@ -26,12 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../server/server.h" #include "../server/server.h"
#include "snd_codec.h" #include "snd_codec.h"
#if defined(_MSC_VER) || defined(__APPLE__)
# include <alext.h>
#else
# include <AL/alext.h>
#endif
typedef struct { typedef struct {
const char *funcname; const char *funcname;
void **funcptr; void **funcptr;
@ -69,15 +63,17 @@ static float reverb_table[] = {
1.0f, 0.097000003f, 0.208f, 0.65200001f, 1.0f, 0.875f, 0.139f, 0.486f, 1.0f, 0.097000003f, 0.208f, 0.65200001f, 1.0f, 0.875f, 0.139f, 0.486f,
}; };
static vec3_t vec_zero = {0, 0, 0}; static vec3_t vec_zero = {0, 0, 0};
int s_iNumMilesAudioProviders = 0; int s_iNumMilesAudioProviders = 0;
bool s_bProvidersEmunerated = false; bool s_bProvidersEmunerated = false;
static bool al_initialized = false; static bool al_initialized = false;
static bool al_use_reverb = false; static bool al_use_reverb = false;
static float al_current_volume = 0; static float al_current_volume = 0;
static unsigned int al_frequency = 22050; static unsigned int al_frequency = 22050;
static ALCcontext *al_context_id = NULL; static ALCcontext *al_context_id = NULL;
static ALCdevice *al_device = NULL; static ALCdevice *al_device = NULL;
static ALsizei al_default_resampler_index = 0;
static ALsizei al_resampler_index = 0;
static ALboolean (*_alutLoadMP3_LOKI)(unsigned int buffer, const byte *data, int length); static ALboolean (*_alutLoadMP3_LOKI)(unsigned int buffer, const byte *data, int length);
static void (*_alReverbScale_LOKI)(); static void (*_alReverbScale_LOKI)();
@ -132,6 +128,13 @@ static ALuint S_OPENAL_Format(float width, int channels);
# define ALDRIVER_DEFAULT "libopenal.so.1" # define ALDRIVER_DEFAULT "libopenal.so.1"
#endif #endif
//
// alext
//
#ifdef AL_SOFT_source_resampler
LPALGETSTRINGISOFT qalGetStringiSOFT;
#endif
/* /*
============== ==============
__alDieIfError __alDieIfError
@ -271,7 +274,7 @@ S_OPENAL_InitContext
static bool S_OPENAL_InitContext() static bool S_OPENAL_InitContext()
{ {
const char *dev; const char *dev;
int attrlist[8]; int attrlist[12];
Com_DPrintf("OpenAL: Context initialization\n"); Com_DPrintf("OpenAL: Context initialization\n");
@ -378,6 +381,11 @@ static bool S_OPENAL_InitContext()
#ifdef ALC_SOFT_output_mode #ifdef ALC_SOFT_output_mode
attrlist[4] = ALC_OUTPUT_MODE_SOFT; attrlist[4] = ALC_OUTPUT_MODE_SOFT;
// Disable HRTF by default
// For example, actual speakers that are recognized as headphones by the OS
// will not get forced HRTF
attrlist[6] = ALC_HRTF_SOFT;
attrlist[7] = ALC_FALSE;
switch (s_speaker_type->integer) { switch (s_speaker_type->integer) {
// Two speakers // Two speakers
@ -388,6 +396,8 @@ static bool S_OPENAL_InitContext()
// Headphones // Headphones
case 1: case 1:
attrlist[5] = ALC_STEREO_HRTF_SOFT; attrlist[5] = ALC_STEREO_HRTF_SOFT;
// Allow HRTF mixing (without forcing in case it's unsupported)
attrlist[7] = ALC_DONT_CARE_SOFT;
break; break;
// Surround // Surround
case 2: case 2:
@ -408,8 +418,13 @@ static bool S_OPENAL_InitContext()
attrlist[5] = 0; attrlist[5] = 0;
#endif #endif
attrlist[6] = 0; #ifdef ALC_SOFT_output_limiter
attrlist[7] = 0; // Disable limiter
attrlist[8] = ALC_OUTPUT_LIMITER_SOFT;
attrlist[9] = ALC_FALSE;
#endif
attrlist[10] = 0;
attrlist[11] = 0;
Com_Printf("OpenAL: Creating AL context...\n"); Com_Printf("OpenAL: Creating AL context...\n");
al_context_id = qalcCreateContext(al_device, attrlist); al_context_id = qalcCreateContext(al_device, attrlist);
@ -452,11 +467,7 @@ S_OPENAL_InitExtensions
*/ */
static bool S_OPENAL_InitExtensions() static bool S_OPENAL_InitExtensions()
{ {
ima4_ext = qalIsExtensionPresent("AL_EXT_IMA4"); /*
soft_block_align = qalIsExtensionPresent("AL_SOFT_block_alignment");
return true;
extensions_table_t extensions_table[4] = { extensions_table_t extensions_table[4] = {
"alutLoadMP3_LOKI", "alutLoadMP3_LOKI",
(void **)&_alutLoadMP3_LOKI, (void **)&_alutLoadMP3_LOKI,
@ -468,6 +479,17 @@ static bool S_OPENAL_InitExtensions()
(void **)&_alReverbDelay_LOKI, (void **)&_alReverbDelay_LOKI,
true true
}; };
*/
extensions_table_t extensions_table[] = {
#ifdef AL_SOFT_source_resampler
extensions_table_t {
"alGetStringiSOFT", (void **)&qalGetStringiSOFT,
false, },
#endif
extensions_table_t {NULL, NULL, NULL}
};
extensions_table_t *i; extensions_table_t *i;
for (i = extensions_table; i->funcname; ++i) { for (i = extensions_table; i->funcname; ++i) {
@ -490,6 +512,9 @@ static bool S_OPENAL_InitExtensions()
Com_Printf("...found.\n"); Com_Printf("...found.\n");
} }
ima4_ext = qalIsExtensionPresent("AL_EXT_IMA4");
soft_block_align = qalIsExtensionPresent("AL_SOFT_block_alignment");
qalGetError(); qalGetError();
return true; return true;
} }
@ -529,6 +554,11 @@ static bool S_OPENAL_InitChannel(int idx, openal_channel *chan)
qalSourcei(chan->source, AL_SOURCE_RELATIVE, true); qalSourcei(chan->source, AL_SOURCE_RELATIVE, true);
alDieIfError(); alDieIfError();
#ifdef AL_SOFT_source_resampler
qalSourcei(chan->source, AL_SOURCE_RESAMPLER_SOFT, al_resampler_index);
alDieIfError();
#endif
return true; return true;
} }
@ -605,6 +635,28 @@ qboolean S_OPENAL_Init()
qalListenerf(AL_GAIN, al_current_volume); qalListenerf(AL_GAIN, al_current_volume);
alDieIfError(); alDieIfError();
#ifdef AL_SOFT_source_resampler
if (qalGetStringiSOFT) {
size_t numResamplers;
size_t i;
al_default_resampler_index = qalGetInteger(AL_DEFAULT_RESAMPLER_SOFT);
alDieIfError();
al_resampler_index = al_default_resampler_index;
numResamplers = qalGetInteger(AL_NUM_RESAMPLERS_SOFT);
alDieIfError();
for (i = 0; i < numResamplers; i++) {
const ALchar *resamplerName = qalGetStringiSOFT(AL_RESAMPLER_NAME_SOFT, i);
if (Q_stristr(resamplerName, "spline")) {
Com_Printf("OpenAL: Using %s as the resampler.\n", resamplerName);
al_resampler_index = i;
break;
}
}
}
#endif
for (i = 0; i < MAX_SOUNDSYSTEM_CHANNELS_3D; i++) { for (i = 0; i < MAX_SOUNDSYSTEM_CHANNELS_3D; i++) {
if (!S_OPENAL_InitChannel(i, &openal.chan_3D[i])) { if (!S_OPENAL_InitChannel(i, &openal.chan_3D[i])) {
return false; return false;
@ -708,6 +760,8 @@ void S_OPENAL_Shutdown()
s_bProvidersEmunerated = false; s_bProvidersEmunerated = false;
al_initialized = false; al_initialized = false;
QAL_Shutdown();
} }
/* /*
@ -3069,10 +3123,12 @@ bool openal_channel::set_sfx(sfx_t *pSfx)
qalGenBuffers(1, &pSfx->buffer); qalGenBuffers(1, &pSfx->buffer);
alDieIfError(); alDieIfError();
#if AL_SOFT_block_alignment
if (pSfx->info.dataalign > 1) { if (pSfx->info.dataalign > 1) {
qalBufferi(pSfx->buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, pSfx->info.dataalign); qalBufferi(pSfx->buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, pSfx->info.dataalign);
alDieIfError(); alDieIfError();
} }
#endif
qalBufferData( qalBufferData(
pSfx->buffer, pSfx->buffer,
@ -4451,10 +4507,12 @@ bool openal_channel_two_d_stream::set_sfx(sfx_t *pSfx)
return true; return true;
} }
#if AL_SOFT_block_alignment
if (stream->info.dataalign > 1 && soft_block_align) { if (stream->info.dataalign > 1 && soft_block_align) {
qalBufferi(buffers[currentBuf], AL_UNPACK_BLOCK_ALIGNMENT_SOFT, stream->info.dataalign); qalBufferi(buffers[currentBuf], AL_UNPACK_BLOCK_ALIGNMENT_SOFT, stream->info.dataalign);
alDieIfError(); alDieIfError();
} }
#endif
qalBufferData(buffers[currentBuf], pSfx->info.format, rawData, bytesRead, stream->info.rate); qalBufferData(buffers[currentBuf], pSfx->info.format, rawData, bytesRead, stream->info.rate);
alDieIfError(); alDieIfError();
@ -4595,10 +4653,12 @@ void openal_channel_two_d_stream::update()
} }
} }
#if AL_SOFT_block_alignment
if (stream->info.dataalign > 1 && soft_block_align) { if (stream->info.dataalign > 1 && soft_block_align) {
qalBufferi(buffers[currentBuf], AL_UNPACK_BLOCK_ALIGNMENT_SOFT, stream->info.dataalign); qalBufferi(buffers[currentBuf], AL_UNPACK_BLOCK_ALIGNMENT_SOFT, stream->info.dataalign);
alDieIfError(); alDieIfError();
} }
#endif
qalBufferData(buffers[currentBuf], format, rawData, bytesRead, stream->info.rate); qalBufferData(buffers[currentBuf], format, rawData, bytesRead, stream->info.rate);
alDieIfError(); alDieIfError();

View file

@ -432,7 +432,7 @@ Event EV_Actor_SetAnimFinal
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Whether the animation was succesfully finished", "Whether the animation was successfully finished",
EV_SETTER EV_SETTER
); );
Event EV_Actor_GetWeaponType Event EV_Actor_GetWeaponType

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -153,7 +153,7 @@ public:
void ArchiveRaw(void *data, size_t size); void ArchiveRaw(void *data, size_t size);
void ArchiveObject(Class *obj); void ArchiveObject(Class *obj);
void ArchiveObject(SafePtrBase* obj); // Added in OPM void ArchiveObject(SafePtrBase *obj); // Added in OPM
qboolean ObjectPositionExists(void *obj); qboolean ObjectPositionExists(void *obj);
@ -167,23 +167,29 @@ public:
template<class Type> template<class Type>
inline void Container<Type>::Archive(Archiver& arc, void (*ArchiveFunc)(Archiver& arc, Type *obj)) inline void Container<Type>::Archive(Archiver& arc, void (*ArchiveFunc)(Archiver& arc, Type *obj))
{ {
int num; Type *obj;
int i; int num;
int i;
if (arc.Loading()) { if (arc.Loading()) {
arc.ArchiveInteger(&num); arc.ArchiveInteger(&num);
Resize(num); Resize(num);
} else {
num = numobjects;
arc.ArchiveInteger(&num);
}
for (i = 1; i <= num; i++) {
if (num > numobjects) { if (num > numobjects) {
numobjects = num; numobjects = num;
} }
ArchiveFunc(arc, &objlist[i - 1]); for (i = 0; i < num; i++) {
obj = new (objlist + i) Type();
ArchiveFunc(arc, obj);
}
} else {
num = numobjects;
arc.ArchiveInteger(&num);
for (i = 0; i < num; i++) {
ArchiveFunc(arc, &objlist[i]);
}
} }
} }
@ -287,7 +293,7 @@ void con_set<key, value>::Archive(Archiver& arc)
if (arc.Loading()) { if (arc.Loading()) {
if (tableLength != 1) { if (tableLength != 1) {
table = new Entry *[tableLength](); table = new (NewTable(tableLength)) Entry *[tableLength]();
memset(table, 0, tableLength * sizeof(Entry *)); memset(table, 0, tableLength * sizeof(Entry *));
} }
@ -303,7 +309,7 @@ void con_set<key, value>::Archive(Archiver& arc)
defaultEntry = e; defaultEntry = e;
} else { } else {
#ifndef NDEBUG # ifndef NDEBUG
int total; int total;
total = 0; total = 0;
@ -316,13 +322,13 @@ void con_set<key, value>::Archive(Archiver& arc)
} }
// it must match the number of elements // it must match the number of elements
assert(total == count); assert(total == count);
#else # else
for (i = 0; i < tableLength; i++) { for (i = 0; i < tableLength; i++) {
for (e = table[i]; e != NULL; e = e->next) { for (e = table[i]; e != NULL; e = e->next) {
e->Archive(arc); e->Archive(arc);
} }
} }
#endif # endif
} }
} }

View file

@ -770,8 +770,8 @@ movement on the server game.
CGM_HUDDRAW_ALPHA, CGM_HUDDRAW_ALPHA,
CGM_HUDDRAW_STRING, CGM_HUDDRAW_STRING,
CGM_HUDDRAW_FONT, CGM_HUDDRAW_FONT,
CGM_NOTIFY_KILL,
CGM_NOTIFY_HIT, CGM_NOTIFY_HIT,
CGM_NOTIFY_KILL,
CGM_VOICE_CHAT, CGM_VOICE_CHAT,
CGM_FENCEPOST, CGM_FENCEPOST,
}; };
@ -812,8 +812,8 @@ movement on the server game.
CGM6_HUDDRAW_ALPHA, CGM6_HUDDRAW_ALPHA,
CGM6_HUDDRAW_STRING, CGM6_HUDDRAW_STRING,
CGM6_HUDDRAW_FONT, CGM6_HUDDRAW_FONT,
CGM6_NOTIFY_KILL,
CGM6_NOTIFY_HIT, CGM6_NOTIFY_HIT,
CGM6_NOTIFY_KILL,
CGM6_VOICE_CHAT, CGM6_VOICE_CHAT,
}; };

View file

@ -77,7 +77,7 @@ Conditional::Conditional()
Expression::Expression() {} Expression::Expression() {}
Expression::Expression(Expression& exp) Expression::Expression(const Expression& exp)
{ {
int i; int i;

View file

@ -184,7 +184,7 @@ private:
public: public:
Expression(); Expression();
Expression(Expression& exp); Expression(const Expression& exp);
Expression(Script& script, State& state); Expression(Script& script, State& state);
void operator=(const Expression& exp); void operator=(const Expression& exp);

View file

@ -42,8 +42,8 @@ typedef struct spawnsort_s {
static qboolean SpotWouldTelefrag(float *origin) static qboolean SpotWouldTelefrag(float *origin)
{ {
static Vector mins = Vector(-16, -16, 1); static Vector mins = Vector(-15, -15, 1);
static Vector maxs = Vector(16, 16, 97); static Vector maxs = Vector(15, 15, 96);
trace_t trace; trace_t trace;
trace = G_Trace(Vector(origin), mins, maxs, Vector(origin), NULL, MASK_PLAYERSTART, qfalse, "SpotWouldTelefrag"); trace = G_Trace(Vector(origin), mins, maxs, Vector(origin), NULL, MASK_PLAYERSTART, qfalse, "SpotWouldTelefrag");
@ -58,15 +58,12 @@ static qboolean SpotWouldTelefrag(float *origin)
static int compare_spawnsort(const void *pe1, const void *pe2) static int compare_spawnsort(const void *pe1, const void *pe2)
{ {
float fDelta = ((spawnsort_t *)pe1)->fMetric - ((spawnsort_t *)pe2)->fMetric; float fDelta = ((spawnsort_t *)pe1)->fMetric - ((spawnsort_t *)pe2)->fMetric;
if (fDelta < -0.001) {
if (fDelta >= -0.001f) {
if (fDelta <= 0.001f) {
return 0;
} else {
return -1;
}
} else {
return 1; return 1;
} else if (fDelta > 0.001) {
return -1;
} else {
return 0;
} }
} }
@ -83,56 +80,56 @@ static PlayerStart *GetRandomSpawnpointFromList(spawnsort_t *pSpots, int nSpots)
qsort(pSpots, nSpots, sizeof(spawnsort_t), compare_spawnsort); qsort(pSpots, nSpots, sizeof(spawnsort_t), compare_spawnsort);
if (pSpots[0].fMetric > 0.0f) { if (pSpots[0].fMetric <= 0) {
if (nSpots > 5) {
nSpots = 5;
}
fMinPosMetric = pSpots[0].fMetric * nSpots;
fTotalMetric = fMinPosMetric;
if (nSpots <= 1) {
fChosen = fMinPosMetric;
} else {
i = 0;
fTotalMetric = 0.0f;
for (i = 0; i < nSpots; i++) {
if (pSpots[i].fMetric <= 0.0f) {
break;
}
fChosen = pSpots[i].fMetric * (nSpots - i);
fTotalMetric += fChosen;
i++;
}
if (i < nSpots) {
fChosen = fMinPosMetric;
}
fMinPosMetric = fTotalMetric;
}
fTotalMetric = (fMinPosMetric - i * fChosen * 0.90f) * G_Random();
for (i = 0; i < nSpots - 1; i++) {
fTotalMetric -= (nSpots - i) * pSpots[i].fMetric - (fChosen * 0.90f);
if (fTotalMetric <= 0.0f) {
break;
}
}
return pSpots[i].spawnpoint;
} else {
// return the spot anyway // return the spot anyway
return pSpots[0].spawnpoint; return pSpots[0].spawnpoint;
} }
if (nSpots > 5) {
nSpots = 5;
}
fMinPosMetric = pSpots[0].fMetric * nSpots;
fTotalMetric = fMinPosMetric;
if (nSpots > 1) {
i = 0;
fTotalMetric = 0.0f;
for (i = 0; i < nSpots; i++) {
if (pSpots[i].fMetric <= 0.0f) {
break;
}
fChosen = pSpots[i].fMetric * (nSpots - i);
fTotalMetric += fChosen;
i++;
}
if (i < nSpots) {
fChosen = fMinPosMetric;
}
fMinPosMetric = fTotalMetric;
} else {
fChosen = fMinPosMetric;
}
fTotalMetric = (fMinPosMetric - i * fChosen * 0.9) * G_Random();
for (i = 0; i < nSpots - 1; i++) {
fTotalMetric -= (nSpots - i) * pSpots[i].fMetric - (fChosen * 0.9);
if (fTotalMetric <= 0) {
break;
}
}
return pSpots[i].spawnpoint;
} }
float SpawnpointMetric_Ffa(const vec3_t origin, DM_Team *dmTeam, const Player *player) float SpawnpointMetric_Ffa(const vec3_t origin, DM_Team *dmTeam, const Player *player)
{ {
float fMinEnemyDistSquared = Square(23170); float fMinEnemyDistSquared = Square(23170.f);
int i; int i;
int nPlayers = dmManager.PlayerCount(); int nPlayers = dmManager.PlayerCount();
float fDist; float fDist;
@ -150,12 +147,12 @@ float SpawnpointMetric_Ffa(const vec3_t origin, DM_Team *dmTeam, const Player *p
} }
} }
return fMinEnemyDistSquared - (G_Random(0.25f) + 1.0f) * Square(1024); return fMinEnemyDistSquared - Square(1024) * (G_Random(0.25) + 1.0);
} }
float SpawnpointMetric_Team(const vec3_t origin, DM_Team *dmTeam, const Player *player) float SpawnpointMetric_Team(const vec3_t origin, DM_Team *dmTeam, const Player *player)
{ {
float fMinEnemyDistSquared = Square(23170); float fMinEnemyDistSquared = Square(23170.f);
float fSumFriendDistSquared = 0.0f; float fSumFriendDistSquared = 0.0f;
float fDistSquared; float fDistSquared;
float fMetric; float fMetric;
@ -179,10 +176,10 @@ float SpawnpointMetric_Team(const vec3_t origin, DM_Team *dmTeam, const Player *
} }
} }
fMetric = fMinEnemyDistSquared - (G_Random(0.25f) + 1.0f) * Square(1024); fMetric = fMinEnemyDistSquared - Square(1024) * (G_Random(0.25) + 1.0);
if (nFriends) { if (nFriends) {
fMetric += 0.25f * ((23170.0f * 23170.0f) - fSumFriendDistSquared / nFriends); fMetric += Square(23170) * 0.25 - fSumFriendDistSquared / nFriends;
} }
return fMetric; return fMetric;
@ -475,8 +472,8 @@ PlayerStart *DM_Team::GetRandomSpawnpointWithMetric(
spot = GetRandomSpawnpointFromList(points, numSpots); spot = GetRandomSpawnpointFromList(points, numSpots);
for (int i = 0; i < numSpots; i++) { for (int i = 0; i < numSpots; i++) {
// delete all created spawnpoint // delete all created spawnpoint
if (points[numSpots].spawnpoint != spot) { if (points[i].spawnpoint != spot) {
delete points[numSpots].spawnpoint; delete points[i].spawnpoint;
} }
} }
@ -1412,26 +1409,26 @@ void DM_Manager::EventDoRoundTransition(Event *ev)
} }
if (m_iTeamWin == TEAM_AXIS) { if (m_iTeamWin == TEAM_AXIS) {
G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Axis win!\n"))); G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Axis win!")));
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Axis win!\n"))); G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Axis win!")));
// Play the axis victory sound // Play the axis victory sound
world->Sound("den_victory_v"); world->Sound("den_victory_v");
Unregister(STRING_AXISWIN); level.Unregister(STRING_AXISWIN);
} else if (m_iTeamWin == TEAM_ALLIES) { } else if (m_iTeamWin == TEAM_ALLIES) {
G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Allies win!\n"))); G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Allies win!")));
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Allies win!\n"))); G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Allies win!")));
// Play the allies victory sound // Play the allies victory sound
world->Sound("dfr_victory_v"); world->Sound("dfr_victory_v");
Unregister(STRING_ALLIESWIN); level.Unregister(STRING_ALLIESWIN);
} else { } else {
G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("It's a draw!\n"))); G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("It's a draw!")));
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("It's a draw!\n"))); G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("It's a draw!")));
Unregister(STRING_DRAW); level.Unregister(STRING_DRAW);
} }
G_DisplayScoresToAllClients(); G_DisplayScoresToAllClients();
@ -1846,7 +1843,7 @@ void DM_Manager::BuildTeamInfo_ver6(DM_Team *dmTeam)
for (int i = iNumPlayers; i > 0; i--) { for (int i = iNumPlayers; i > 0; i--) {
pTeamPlayer = dmTeam->m_players.ObjectAt(i); pTeamPlayer = dmTeam->m_players.ObjectAt(i);
if (pTeamPlayer->IsSubclassOfBot()) { if (pTeamPlayer->edict->r.svFlags & SVF_BOT) {
continue; continue;
} }
@ -1891,7 +1888,7 @@ void DM_Manager::BuildTeamInfo_ver15(DM_Team *dmTeam)
for (int i = iNumPlayers; i > 0; i--) { for (int i = iNumPlayers; i > 0; i--) {
pTeamPlayer = dmTeam->m_players.ObjectAt(i); pTeamPlayer = dmTeam->m_players.ObjectAt(i);
if (pTeamPlayer->IsSubclassOfBot()) { if (pTeamPlayer->edict->r.svFlags & SVF_BOT) {
continue; continue;
} }
@ -1903,11 +1900,11 @@ void DM_Manager::BuildTeamInfo_ver15(DM_Team *dmTeam)
iPing /= iNumPlayers; iPing /= iNumPlayers;
} }
if (g_gametype->integer >= GT_TEAM_ROUNDS) { if (g_gametype->integer == GT_TEAM_ROUNDS || g_gametype->integer == GT_OBJECTIVE || g_gametype->integer == GT_TOW) {
iKills = dmTeam->m_wins_in_a_row; iKills = dmTeam->m_teamwins;
iDeaths = dmTeam->m_teamwins; iDeaths = dmTeam->m_wins_in_a_row;
} else { } else {
iKills = dmTeam->m_iKills; iKills = dmTeam->m_teamwins;
iDeaths = dmTeam->m_iDeaths; iDeaths = dmTeam->m_iDeaths;
} }
@ -1965,7 +1962,7 @@ void DM_Manager::BuildPlayerTeamInfo(DM_Team *dmTeam, int *iPlayerList, DM_Team
pTeamPlayer->GetNumKills(), pTeamPlayer->GetNumKills(),
pTeamPlayer->GetNumDeaths(), pTeamPlayer->GetNumDeaths(),
G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime), G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime),
pTeamPlayer->IsSubclassOfBot() ? "bot" : va("%d", pTeamPlayer->client->ps.ping) (pTeamPlayer->edict->r.svFlags & SVF_BOT) ? "bot" : va("%d", pTeamPlayer->client->ps.ping)
); );
} else { } else {
Com_sprintf( Com_sprintf(
@ -1976,7 +1973,7 @@ void DM_Manager::BuildPlayerTeamInfo(DM_Team *dmTeam, int *iPlayerList, DM_Team
pTeamPlayer->GetNumKills(), pTeamPlayer->GetNumKills(),
pTeamPlayer->GetNumDeaths(), pTeamPlayer->GetNumDeaths(),
G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime), G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime),
pTeamPlayer->IsSubclassOfBot() ? "bot" : va("%d", pTeamPlayer->client->ps.ping) (pTeamPlayer->edict->r.svFlags & SVF_BOT) ? "bot" : va("%d", pTeamPlayer->client->ps.ping)
); );
} }

View file

@ -1217,6 +1217,8 @@ Event EV_CanSee
"returns 1 if the entities can see eachother, 0 if not", "returns 1 if the entities can see eachother, 0 if not",
EV_RETURN EV_RETURN
); );
// Added in 2.0
Event EV_CanSeeNoEnts Event EV_CanSeeNoEnts
( (
"canseenoents", "canseenoents",
@ -1226,6 +1228,7 @@ Event EV_CanSeeNoEnts
"returns 1 if the entities can see eachother, 0 if not; ignores any entities between them", "returns 1 if the entities can see eachother, 0 if not; ignores any entities between them",
EV_RETURN EV_RETURN
); );
Event EV_Entity_InPVS Event EV_Entity_InPVS
( (
"inpvs", "inpvs",
@ -1628,6 +1631,7 @@ CLASS_DECLARATION(SimpleEntity, Entity, NULL) {
{&EV_IsTouching, &Entity::IsTouching }, {&EV_IsTouching, &Entity::IsTouching },
{&EV_IsInside, &Entity::IsInside }, {&EV_IsInside, &Entity::IsInside },
{&EV_CanSee, &Entity::CanSee }, {&EV_CanSee, &Entity::CanSee },
{&EV_CanSeeNoEnts, &Entity::CanSeeNoEnts }, // Added in 2.0
{&EV_Entity_InPVS, &Entity::EventInPVS }, {&EV_Entity_InPVS, &Entity::EventInPVS },
{&EV_SetShaderData, &Entity::SetShaderData }, {&EV_SetShaderData, &Entity::SetShaderData },
{&EV_GetVelocity, &Entity::GetVelocity }, {&EV_GetVelocity, &Entity::GetVelocity },
@ -2669,7 +2673,7 @@ void Entity::DamageEvent(Event *ev)
Vector momentum; Vector momentum;
Vector position, direction, normal; Vector position, direction, normal;
int knockback, damageflags, meansofdeath, location; int knockback, damageflags, meansofdeath, location;
Event *event; Event event;
float m; float m;
EntityPtr This; EntityPtr This;
@ -2755,67 +2759,79 @@ void Entity::DamageEvent(Event *ev)
if (health <= 0) { if (health <= 0) {
if (attacker) { if (attacker) {
event = new Event(EV_GotKill); const EntityPtr attackerPtr = attacker;
event->AddEntity(this);
event->AddInteger(damage);
event->AddEntity(inflictor);
event->AddInteger(meansofdeath);
event->AddInteger(0);
attacker->ProcessEvent(event); event = Event(EV_GotKill, 5);
event.AddEntity(this);
event.AddInteger(damage);
event.AddEntity(inflictor);
event.AddInteger(meansofdeath);
event.AddInteger(0);
attackerPtr->ProcessEvent(event);
if (attackerPtr) {
attackerPtr->delegate_gotKill.Execute(event);
}
} }
if (!This) { if (!This) {
return; return;
} }
event = new Event(EV_Killed); event = Event(EV_Killed, 10);
event->AddEntity(attacker); event.AddEntity(attacker);
event->AddFloat(damage); event.AddFloat(damage);
event->AddEntity(inflictor); event.AddEntity(inflictor);
event->AddVector(position); event.AddVector(position);
event->AddVector(direction); event.AddVector(direction);
event->AddVector(normal); event.AddVector(normal);
event->AddInteger(knockback); event.AddInteger(knockback);
event->AddInteger(damageflags); event.AddInteger(damageflags);
event->AddInteger(meansofdeath); event.AddInteger(meansofdeath);
event->AddInteger(location); event.AddInteger(location);
ProcessEvent(event); ProcessEvent(event);
if (!This) { if (!This) {
return; return;
} }
// Notify scripts // Notify scripts
Unregister(STRING_DAMAGE); Unregister(STRING_DAMAGE);
if (!This) {
return;
}
delegate_killed.Execute(event);
return; return;
} }
event = new Event(EV_Pain); event = Event(EV_Pain, 10);
event->AddEntity(attacker); event.AddEntity(attacker);
event->AddFloat(damage); event.AddFloat(damage);
event->AddEntity(inflictor); event.AddEntity(inflictor);
event->AddVector(position); event.AddVector(position);
event->AddVector(direction); event.AddVector(direction);
event->AddVector(normal); event.AddVector(normal);
event->AddInteger(knockback); event.AddInteger(knockback);
event->AddInteger(damageflags); event.AddInteger(damageflags);
event->AddInteger(meansofdeath); event.AddInteger(meansofdeath);
event->AddInteger(location); event.AddInteger(location);
ProcessEvent(event); ProcessEvent(event);
if (!This) { if (!This) {
return; return;
} }
// Notify scripts // Notify scripts
Unregister(STRING_DAMAGE); Unregister(STRING_DAMAGE);
if (!This) {
return;
}
delegate_damage.Execute(event);
} }
qboolean Entity::IsTouching(Entity *e1) qboolean Entity::IsTouching(Entity *e1)
{ {
if (e1->absmin.x > absmax.x) { if (e1->absmin.x > absmax.x) {
return false; return false;
@ -3609,106 +3625,104 @@ void Entity::Sound(
} }
if (!name) { if (!name) {
name = sound_name.c_str(); name = gi.GlobalAlias_FindRandom(sound_name.c_str(), &ret);
} }
// Play the sound // Play the sound
if (name != NULL) { if (name && ret) {
if (ret) { aliaschannel = ret->channel;
aliaschannel = ret->channel; aliasvolume = G_Random() * ret->volumeMod + ret->volume;
aliasvolume = G_Random() * ret->volumeMod + ret->volume; aliaspitch = G_Random() * ret->pitchMod + ret->pitch;
aliaspitch = G_Random() * ret->pitchMod + ret->pitch; aliasmin_dist = ret->dist;
aliasmin_dist = ret->dist; aliasmax_dist = ret->maxDist;
aliasmax_dist = ret->maxDist;
if (channel < 0) {
channel = ret->channel;
}
num = entnum;
if (sound_origin) {
VectorCopy(*sound_origin, org);
num = ENTITYNUM_NONE;
} else {
VectorCopy(edict->s.origin, org);
if (doCallback) {
num |= S_FLAG_DO_CALLBACK;
}
}
switch (argstype) {
case 0:
volume = aliasvolume;
pitch = aliaspitch;
min_dist = aliasmin_dist;
max_dist = aliasmax_dist;
channel = aliaschannel;
break;
case 1:
if (volume >= 0.0f) {
volume = volume * aliasvolume;
} else {
volume = aliasvolume;
}
if (pitch >= 0.0f) {
pitch = pitch * aliaspitch;
} else {
pitch = aliaspitch;
}
if (min_dist < 0.0f) {
min_dist = aliasmin_dist;
}
if (max_dist < 0.0f) {
max_dist = aliasmax_dist;
}
if (channel < 0) { if (channel < 0) {
channel = ret->channel;
}
num = entnum;
if (sound_origin) {
VectorCopy(*sound_origin, org);
num = ENTITYNUM_NONE;
} else {
VectorCopy(edict->s.origin, org);
if (doCallback) {
num |= S_FLAG_DO_CALLBACK;
}
}
switch (argstype) {
case 0:
volume = aliasvolume;
pitch = aliaspitch;
min_dist = aliasmin_dist;
max_dist = aliasmax_dist;
channel = aliaschannel; channel = aliaschannel;
break;
case 1:
if (volume >= 0.0f) {
volume = volume * aliasvolume;
} else {
volume = aliasvolume;
}
if (pitch >= 0.0f) {
pitch = pitch * aliaspitch;
} else {
pitch = aliaspitch;
}
if (min_dist < 0.0f) {
min_dist = aliasmin_dist;
}
if (max_dist < 0.0f) {
max_dist = aliasmax_dist;
}
if (channel < 0) {
channel = aliaschannel;
}
break;
default:
if (volume < 0.0) {
volume = aliasvolume;
}
if (pitch < 0.0) {
pitch = aliaspitch;
}
if (min_dist < 0.0) {
min_dist = aliasmin_dist;
}
if (max_dist < 0.0) {
max_dist = aliasmax_dist;
}
if (channel < 0) {
channel = aliaschannel;
}
break;
} }
break;
if ((!checkSubtitle || g_subtitle->integer) && ret->subtitle) { default:
Entity *p = G_GetEntity(0); if (volume < 0.0) {
volume = aliasvolume;
if (g_subtitle->integer == 2 || Square(max_dist) > DistanceSquared(org, p->edict->s.origin)) {
cvar_t *curSubtitle = gi.Cvar_Get("curSubtitle", "0", 0);
int curSub;
gi.cvar_set(va("subtitle%d", curSubtitle->integer), va("%s", ret->subtitle));
curSub = curSubtitle->integer + 1;
if (curSubtitle->integer + 1 < 0) {
curSub = curSubtitle->integer + MAX_SUBTITLES;
}
gi.cvar_set("curSubtitle", va("%d", (curSubtitle->integer + 1) - MAX_SUBTITLES * (curSub >> 2)));
}
} }
if (pitch < 0.0) {
gi.Sound(&org, num, channel, name, volume, min_dist, pitch, max_dist, ret->streamed); pitch = aliaspitch;
}
if (min_dist < 0.0) {
min_dist = aliasmin_dist;
}
if (max_dist < 0.0) {
max_dist = aliasmax_dist;
}
if (channel < 0) {
channel = aliaschannel;
}
break;
} }
if (g_gametype->integer == GT_SINGLE_PLAYER && (ret->forcesubtitle || !checkSubtitle || g_subtitle->integer) && ret->subtitle) {
Entity *p = G_GetEntity(0);
if (p && (g_subtitle->integer == 2 || Square(max_dist) > DistanceSquared(org, p->edict->s.origin))) {
cvar_t *curSubtitle = gi.Cvar_Get("curSubtitle", "0", 0);
int curSub;
gi.cvar_set(va("subtitle%d", curSubtitle->integer), va("%s", ret->subtitle));
curSub = curSubtitle->integer + 1;
if (curSubtitle->integer + 1 < 0) {
curSub = curSubtitle->integer + MAX_SUBTITLES;
}
gi.cvar_set("curSubtitle", va("%d", (curSubtitle->integer + 1) - MAX_SUBTITLES * (curSub >> 2)));
}
}
gi.Sound(&org, num, channel, name, volume, min_dist, pitch, max_dist, ret->streamed);
} else { } else {
gi.DPrintf( gi.DPrintf(
"ERROR: Entity::Sound: %s needs an alias in ubersound.scr or uberdialog.scr - Please fix.\n", "ERROR: Entity::Sound: %s needs an alias in ubersound.scr or uberdialog.scr - Please fix.\n",

View file

@ -51,6 +51,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "script.h" #include "script.h"
#include "listener.h" #include "listener.h"
#include "simpleentity.h" #include "simpleentity.h"
#include "../qcommon/delegate.h"
// modification flags // modification flags
#define FLAG_IGNORE 0 #define FLAG_IGNORE 0
@ -296,6 +297,12 @@ public:
//==== //====
#endif #endif
MulticastDelegate<void (const Event& ev)> delegate_damage;
MulticastDelegate<void (const Event& ev)> delegate_killed;
MulticastDelegate<void (const Event& ev)> delegate_gotKill;
public:
Entity(); Entity();
virtual ~Entity(); virtual ~Entity();

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -26,10 +26,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "playerbot.h" #include "playerbot.h"
#include "g_bot.h" #include "g_bot.h"
static saved_bot_t *saved_bots = NULL; static saved_bot_t *saved_bots = NULL;
static unsigned int num_saved_bots = 0; static unsigned int num_saved_bots = 0;
static unsigned int current_bot_count = 0; static unsigned int botId = 0;
static unsigned int botId = 0;
Container<str> alliedModelList; Container<str> alliedModelList;
Container<str> germanModelList; Container<str> germanModelList;
@ -158,16 +157,16 @@ Begin spawning a new bot entity
*/ */
void G_BotBegin(gentity_t *ent) void G_BotBegin(gentity_t *ent)
{ {
PlayerBot *player; Player *player;
BotController *controller; BotController *controller;
level.spawn_entnum = ent->s.number; level.spawn_entnum = ent->s.number;
player = new PlayerBot; player = new Player;
G_ClientBegin(ent, NULL); G_ClientBegin(ent, NULL);
controller = botManager.getControllerManager().createController(player); controller = botManager.getControllerManager().createController(player);
player->setController(controller); //player->setController(controller);
} }
/* /*
@ -272,7 +271,7 @@ void G_BotShift(int clientNum)
return; return;
} }
if (!ent->entity->IsSubclassOfBot()) { if (!botManager.getControllerManager().findController(ent->entity)) {
return; return;
} }
@ -356,7 +355,7 @@ bool G_IsBot(gentity_t *ent)
return false; return false;
} }
if (!ent->entity || !ent->entity->IsSubclassOfBot()) { if (!ent->entity || !botManager.getControllerManager().findController(ent->entity)) {
return false; return false;
} }
@ -376,7 +375,7 @@ bool G_IsPlayer(gentity_t *ent)
return false; return false;
} }
if (!ent->entity || ent->entity->IsSubclassOfBot()) { if (!ent->entity || botManager.getControllerManager().findController(ent->entity)) {
return false; return false;
} }
@ -388,7 +387,7 @@ bool G_IsPlayer(gentity_t *ent)
G_GetRandomAlliedPlayerModel G_GetRandomAlliedPlayerModel
============ ============
*/ */
const char* G_GetRandomAlliedPlayerModel() const char *G_GetRandomAlliedPlayerModel()
{ {
if (!alliedModelList.NumObjects()) { if (!alliedModelList.NumObjects()) {
return ""; return "";
@ -403,7 +402,7 @@ const char* G_GetRandomAlliedPlayerModel()
G_GetRandomGermanPlayerModel G_GetRandomGermanPlayerModel
============ ============
*/ */
const char* G_GetRandomGermanPlayerModel() const char *G_GetRandomGermanPlayerModel()
{ {
if (!germanModelList.NumObjects()) { if (!germanModelList.NumObjects()) {
return ""; return "";
@ -438,7 +437,6 @@ void G_AddBot(const saved_bot_t *saved)
clientNum = e - g_entities; clientNum = e - g_entities;
current_bot_count++;
// increase the unique ID // increase the unique ID
botId++; botId++;
@ -504,7 +502,6 @@ void G_RemoveBot(gentity_t *ent)
} }
G_ClientDisconnect(ent); G_ClientDisconnect(ent);
current_bot_count--;
} }
/* /*
@ -583,17 +580,18 @@ void G_SaveBots()
saved_bots = NULL; saved_bots = NULL;
} }
if (!current_bot_count) { const BotControllerManager& manager = botManager.getControllerManager();
unsigned int numSpawnedBots = manager.getControllers().NumObjects();
if (!numSpawnedBots) {
return; return;
} }
saved_bots = new saved_bot_t[current_bot_count]; saved_bots = new saved_bot_t[numSpawnedBots];
num_saved_bots = 0; num_saved_bots = 0;
const BotControllerManager& manager = botManager.getControllerManager();
count = manager.getControllers().NumObjects(); count = manager.getControllers().NumObjects();
assert(count <= current_bot_count); assert(count <= numSpawnedBots);
for (n = 1; n <= count; n++) { for (n = 1; n <= count; n++) {
const BotController *controller = manager.getControllers().ObjectAt(n); const BotController *controller = manager.getControllers().ObjectAt(n);
@ -687,6 +685,18 @@ int G_CountClients()
return count; return count;
} }
/*
===========
G_RestartBots
Save bots
============
*/
void G_RestartBots()
{
G_SaveBots();
}
/* /*
=========== ===========
G_ResetBots G_ResetBots
@ -696,12 +706,9 @@ Save and reset the bot count
*/ */
void G_ResetBots() void G_ResetBots()
{ {
G_SaveBots();
botManager.Cleanup(); botManager.Cleanup();
current_bot_count = 0; botId = 0;
botId = 0;
} }
/* /*
@ -754,6 +761,7 @@ void G_SpawnBots()
{ {
unsigned int numClients; unsigned int numClients;
unsigned int numBotsToSpawn; unsigned int numBotsToSpawn;
unsigned int numSpawnedBots;
// //
// Check the minimum bot count // Check the minimum bot count
@ -776,12 +784,14 @@ void G_SpawnBots()
numBotsToSpawn = Q_min(numBotsToSpawn, sv_maxbots->integer); numBotsToSpawn = Q_min(numBotsToSpawn, sv_maxbots->integer);
} }
numSpawnedBots = botManager.getControllerManager().getControllers().NumObjects();
// //
// Spawn bots // Spawn bots
// //
if (numBotsToSpawn > current_bot_count) { if (numBotsToSpawn > numSpawnedBots) {
G_AddBots(numBotsToSpawn - current_bot_count); G_AddBots(numBotsToSpawn - numSpawnedBots);
} else if (numBotsToSpawn < current_bot_count) { } else if (numBotsToSpawn < numSpawnedBots) {
G_RemoveBots(current_bot_count - numBotsToSpawn); G_RemoveBots(numSpawnedBots - numBotsToSpawn);
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -26,20 +26,21 @@ struct saved_bot_t {
char userinfo[MAX_INFO_STRING]; char userinfo[MAX_INFO_STRING];
}; };
void G_BotBegin(gentity_t *ent); void G_BotBegin(gentity_t *ent);
void G_BotThink(gentity_t *ent, int msec); void G_BotThink(gentity_t *ent, int msec);
void G_BotShift(int clientNum); void G_BotShift(int clientNum);
gentity_t *G_GetFirstBot(); gentity_t *G_GetFirstBot();
void G_AddBot(const saved_bot_t *saved = NULL); void G_AddBot(const saved_bot_t *saved = NULL);
void G_AddBots(unsigned int num); void G_AddBots(unsigned int num);
void G_RemoveBot(gentity_t *ent); void G_RemoveBot(gentity_t *ent);
void G_RemoveBots(unsigned int num); void G_RemoveBots(unsigned int num);
bool G_IsBot(gentity_t *ent); bool G_IsBot(gentity_t *ent);
bool G_IsPlayer(gentity_t *ent); bool G_IsPlayer(gentity_t *ent);
void G_ResetBots(); void G_ResetBots();
void G_BotInit(); void G_RestartBots();
void G_BotFrame(); void G_BotInit();
void G_BotPostInit(); void G_BotFrame();
void G_SpawnBots(); void G_BotPostInit();
const char* G_GetRandomAlliedPlayerModel(); void G_SpawnBots();
const char* G_GetRandomGermanPlayerModel(); const char *G_GetRandomAlliedPlayerModel();
const char *G_GetRandomGermanPlayerModel();

View file

@ -757,6 +757,7 @@ void G_ClientUserinfoChanged(gentity_t *ent, const char *u)
char *s; char *s;
gclient_t *client; gclient_t *client;
int clientnum; int clientnum;
char oldname[MAX_NAME_LENGTH];
if (!ent) { if (!ent) {
return; return;
@ -772,10 +773,19 @@ void G_ClientUserinfoChanged(gentity_t *ent, const char *u)
clientnum = ent - g_entities; clientnum = ent - g_entities;
Q_strncpyz(oldname, client->pers.netname, sizeof(oldname));
if (gi.SanitizeName(s, client->pers.netname, sizeof(client->pers.netname))) { if (gi.SanitizeName(s, client->pers.netname, sizeof(client->pers.netname))) {
gi.Printf("WARNING: had to sanitize the name for client %i\n", clientnum); gi.Printf("WARNING: had to sanitize the name for client %i\n", clientnum);
} }
if (strcmp(oldname, client->pers.netname)) {
//
// Added in OPM
// Print name changes
//
gi.Printf("Client %i changed name from '%s' to '%s'\n", clientnum, oldname, client->pers.netname);
}
s = Info_ValueForKey(u, "dm_playermodel"); s = Info_ValueForKey(u, "dm_playermodel");
if (!s) { if (!s) {
@ -827,6 +837,7 @@ void G_BotConnect(int clientNum, qboolean firstTime, const char *userinfo)
ent->client = game.clients + clientNum; ent->client = game.clients + clientNum;
ent->s.number = clientNum; ent->s.number = clientNum;
ent->r.svFlags |= SVF_BOT;
client = ent->client; client = ent->client;
@ -877,8 +888,6 @@ const char *G_ClientConnect(int clientNum, qboolean firstTime, qboolean differen
gentity_t *ent; gentity_t *ent;
char userinfo[MAX_INFO_STRING]; char userinfo[MAX_INFO_STRING];
gi.DPrintf("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT\n");
// Added in OPM // Added in OPM
G_BotShift(clientNum); G_BotShift(clientNum);

View file

@ -227,9 +227,13 @@ void G_AllocGameData(void)
void G_DeAllocGameData(void) void G_DeAllocGameData(void)
{ {
// Initialize debug lines // Free up debug lines
G_DeAllocDebugLines(); G_DeAllocDebugLines();
// Added in OPM
// Free up debug strings
G_DeAllocDebugStrings();
// free up the entities // free up the entities
if (g_entities) { if (g_entities) {
gi.Free(g_entities); gi.Free(g_entities);
@ -914,6 +918,9 @@ void G_Restart(void)
// Added in 2.0 // Added in 2.0
G_ResetSmokeSprites(); G_ResetSmokeSprites();
// Added in OPM
G_RestartBots();
} }
void G_SetFrameNumber(int framenum) void G_SetFrameNumber(int framenum)

View file

@ -365,6 +365,7 @@ void MM_StepSlideMove(void)
vec3_t start_hit_origin; vec3_t start_hit_origin;
vec3_t first_hit_origin; vec3_t first_hit_origin;
trace_t nostep_groundTrace; trace_t nostep_groundTrace;
qboolean nostep_validGroundTrace;
VectorCopy(mm->origin, start_o); VectorCopy(mm->origin, start_o);
VectorCopy(mm->velocity, start_v); VectorCopy(mm->velocity, start_v);
@ -410,6 +411,9 @@ void MM_StepSlideMove(void)
VectorCopy(mm->origin, nostep_o); VectorCopy(mm->origin, nostep_o);
VectorCopy(mm->velocity, nostep_v); VectorCopy(mm->velocity, nostep_v);
memcpy(&nostep_groundTrace, &mml.groundTrace, sizeof(trace_t)); memcpy(&nostep_groundTrace, &mml.groundTrace, sizeof(trace_t));
// Fixed in OPM
// Save the valid ground trace
nostep_validGroundTrace = mml.validGroundTrace;
VectorCopy(up, mm->origin); VectorCopy(up, mm->origin);
VectorCopy(start_v, mm->velocity); VectorCopy(start_v, mm->velocity);
@ -432,6 +436,10 @@ void MM_StepSlideMove(void)
VectorCopy(nostep_o, mm->origin); VectorCopy(nostep_o, mm->origin);
VectorCopy(nostep_v, mm->velocity); VectorCopy(nostep_v, mm->velocity);
memcpy(&mml.groundTrace, &nostep_groundTrace, sizeof(mml.groundTrace)); memcpy(&mml.groundTrace, &nostep_groundTrace, sizeof(mml.groundTrace));
// Fixed in OPM
// Do not use the ground trace as it's invalid and would have an invalid entity number
mml.validGroundTrace = nostep_validGroundTrace;
mm->hit_obstacle = first_hit_wall; mm->hit_obstacle = first_hit_wall;
VectorCopy(first_hit_origin, mm->hit_origin); VectorCopy(first_hit_origin, mm->hit_origin);
VectorCopy(first_wall_normal, mm->obstacle_normal); VectorCopy(first_wall_normal, mm->obstacle_normal);

View file

@ -248,6 +248,8 @@ typedef struct gameImport_s {
void (*cvar_set)(const char *varName, const char *varValue); void (*cvar_set)(const char *varName, const char *varValue);
cvar_t *(*cvar_set2)(const char *varName, const char *varValue, qboolean force); cvar_t *(*cvar_set2)(const char *varName, const char *varValue, qboolean force);
cvar_t *(*NextCvar)(cvar_t *var); cvar_t *(*NextCvar)(cvar_t *var);
void (*Cvar_CheckRange)(cvar_t* var, float min, float max, qboolean integral);
int (*Argc)(); int (*Argc)();
char *(*Argv)(int arg); char *(*Argv)(int arg);
char *(*Args)(); char *(*Args)();
@ -257,6 +259,7 @@ typedef struct gameImport_s {
int (*FS_WriteFile)(const char *qpath, const void *buffer, int size); int (*FS_WriteFile)(const char *qpath, const void *buffer, int size);
fileHandle_t (*FS_FOpenFileWrite)(const char *fileName); fileHandle_t (*FS_FOpenFileWrite)(const char *fileName);
fileHandle_t (*FS_FOpenFileAppend)(const char *fileName); fileHandle_t (*FS_FOpenFileAppend)(const char *fileName);
long (*FS_FOpenFile)(const char* qpath, fileHandle_t *file, qboolean uniqueFILE, qboolean quiet);
const char *(*FS_PrepFileWrite)(const char *fileName); const char *(*FS_PrepFileWrite)(const char *fileName);
size_t (*FS_Write)(const void *buffer, size_t size, fileHandle_t fileHandle); size_t (*FS_Write)(const void *buffer, size_t size, fileHandle_t fileHandle);
size_t (*FS_Read)(void *buffer, size_t len, fileHandle_t fileHandle); size_t (*FS_Read)(void *buffer, size_t len, fileHandle_t fileHandle);

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -686,10 +686,17 @@ void GameScript::ArchiveCodePos(Archiver& arc, unsigned char **codePos)
void GameScript::Close(void) void GameScript::Close(void)
{ {
// Free up catch blocks
for (int i = m_CatchBlocks.NumObjects(); i > 0; i--) { for (int i = m_CatchBlocks.NumObjects(); i > 0; i--) {
delete m_CatchBlocks.ObjectAt(i); delete m_CatchBlocks.ObjectAt(i);
} }
// Added in OPM
// Free up allocated state scripts
for (int i = m_StateScripts.NumObjects(); i > 0; i--) {
delete m_StateScripts.ObjectAt(i);
}
m_CatchBlocks.FreeObjectList(); m_CatchBlocks.FreeObjectList();
if (m_ProgToSource) { if (m_ProgToSource) {
@ -814,7 +821,11 @@ StateScript *GameScript::CreateCatchStateScript(unsigned char *try_begin_code_po
StateScript *GameScript::CreateSwitchStateScript(void) StateScript *GameScript::CreateSwitchStateScript(void)
{ {
return new StateScript; StateScript *stateScript = new StateScript;
m_StateScripts.AddObject(stateScript);
return stateScript;
} }
StateScript *GameScript::GetCatchStateScript(unsigned char *in, unsigned char *& out) StateScript *GameScript::GetCatchStateScript(unsigned char *in, unsigned char *& out)
@ -866,7 +877,7 @@ ScriptThreadLabel::ScriptThreadLabel()
m_Label = STRING_EMPTY; m_Label = STRING_EMPTY;
} }
ScriptThread *ScriptThreadLabel::Create(Listener *listener) ScriptThread *ScriptThreadLabel::Create(Listener *listener) const
{ {
ScriptClass *scriptClass; ScriptClass *scriptClass;
ScriptThread *thread; ScriptThread *thread;
@ -896,7 +907,7 @@ ScriptThread *ScriptThreadLabel::Create(Listener *listener)
return thread; return thread;
} }
void ScriptThreadLabel::Execute(Listener *listener) void ScriptThreadLabel::Execute(Listener *listener) const
{ {
if (!m_Script) { if (!m_Script) {
return; return;
@ -909,12 +920,7 @@ void ScriptThreadLabel::Execute(Listener *listener)
} }
} }
void ScriptThreadLabel::Execute(Listener *listener, Event& ev) void ScriptThreadLabel::Execute(Listener *listener, Event& ev) const
{
Execute(listener, &ev);
}
void ScriptThreadLabel::Execute(Listener *listener, Event *ev)
{ {
if (!m_Script) { if (!m_Script) {
return; return;
@ -927,7 +933,13 @@ void ScriptThreadLabel::Execute(Listener *listener, Event *ev)
} }
} }
void ScriptThreadLabel::Execute(Listener *listener, Event *ev) const
{
Execute(listener, *ev);
}
void ScriptThreadLabel::Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param) void ScriptThreadLabel::Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param)
const
{ {
if (!m_Script) { if (!m_Script) {
return; return;
@ -1214,7 +1226,7 @@ bool ScriptThreadLabel::TrySetScript(const_str label)
return true; return true;
} }
void ScriptThreadLabel::GetScriptValue(ScriptVariable *var) void ScriptThreadLabel::GetScriptValue(ScriptVariable *var) const
{ {
if (!m_Script) { if (!m_Script) {
var->Clear(); var->Clear();
@ -1228,12 +1240,12 @@ void ScriptThreadLabel::GetScriptValue(ScriptVariable *var)
var->setConstArrayValue(var_array, 2); var->setConstArrayValue(var_array, 2);
} }
bool ScriptThreadLabel::IsSet(void) bool ScriptThreadLabel::IsSet(void) const
{ {
return m_Script != NULL; return m_Script != NULL;
} }
bool ScriptThreadLabel::IsFile(const_str filename) bool ScriptThreadLabel::IsFile(const_str filename) const
{ {
return m_Script && m_Script->ConstFilename() == filename && m_Label == STRING_EMPTY; return m_Script && m_Script->ConstFilename() == filename && m_Label == STRING_EMPTY;
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -118,7 +118,8 @@ class GameScript : public AbstractScript
{ {
protected: protected:
// try/throw variable // try/throw variable
Container<CatchBlock *> m_CatchBlocks; Container<CatchBlock *> m_CatchBlocks;
Container<StateScript *> m_StateScripts;
public: public:
// program variables // program variables
@ -169,11 +170,11 @@ private:
public: public:
ScriptThreadLabel(); ScriptThreadLabel();
ScriptThread *Create(Listener *listener); ScriptThread *Create(Listener *listener) const;
void Execute(Listener *listener = NULL); void Execute(Listener *listener = NULL) const;
void Execute(Listener *listener, Event& ev); void Execute(Listener *listener, Event& ev) const;
void Execute(Listener *listener, Event *ev); void Execute(Listener *listener, Event *ev) const;
void Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param); void Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param) const;
void Clear(); void Clear();
void Set(const char *label); void Set(const char *label);
@ -188,10 +189,10 @@ public:
bool TrySetScript(const_str label); bool TrySetScript(const_str label);
bool TrySetScript(const char *label); bool TrySetScript(const char *label);
bool IsSet(void); bool IsSet(void) const;
bool IsFile(const_str filename); bool IsFile(const_str filename) const;
void GetScriptValue(ScriptVariable *var); void GetScriptValue(ScriptVariable *var) const;
void Archive(Archiver& arc); void Archive(Archiver& arc);

View file

@ -114,7 +114,7 @@ void Health::PickupHealth(Event *ev)
gi.SendServerCommand( gi.SendServerCommand(
player->edict - g_entities, player->edict - g_entities,
"print \"" HUD_MESSAGE_YELLOW "%s \"", "print \"" HUD_MESSAGE_YELLOW "%s\n\"",
gi.LV_ConvertString(va("Recovered %d Health", amount)) gi.LV_ConvertString(va("Recovered %d Health", amount))
); );
} }

View file

@ -1511,9 +1511,9 @@ void Level::ServerSpawned(void)
void Level::SetMap(const char *themapname) void Level::SetMap(const char *themapname)
{ {
char *spawnpos; const char *spawnpos;
int i; int i;
str text; str text;
Init(); Init();
@ -1522,8 +1522,8 @@ void Level::SetMap(const char *themapname)
// set a specific spawnpoint if the map was started with a $ // set a specific spawnpoint if the map was started with a $
spawnpos = strchr((char *)themapname, '$'); spawnpos = strchr((char *)themapname, '$');
if (spawnpos) { if (spawnpos) {
mapname = (const char *)(spawnpos - themapname); mapname = str(themapname, 0, spawnpos - themapname);
spawnpoint = mapname; spawnpoint = spawnpos + 1;
} else { } else {
mapname = themapname; mapname = themapname;
spawnpoint = ""; spawnpoint = "";
@ -1588,6 +1588,30 @@ void Level::Precache(void)
LoadAllScripts("global", ".scr"); LoadAllScripts("global", ".scr");
InitVoteOptions(); InitVoteOptions();
// Added in OPM
// Cache all player models in multi-player
// This avoids using precache scripts
if (g_gametype->integer != GT_SINGLE_PLAYER) {
char **fileList;
int numFiles;
int i;
fileList = gi.FS_ListFiles("models/player", ".tik", qfalse, &numFiles);
for (i = 0; i < numFiles; i++) {
const char *filename = fileList[i];
const size_t filelen = strlen(filename);
if (!Q_stricmpn(filename, "allied_", 7) || !Q_stricmpn(filename, "american_", 9)
|| !Q_stricmpn(filename, "german_", 7) || !Q_stricmpn(filename, "IT_", 3)
|| !Q_stricmpn(filename, "SC_", 3)) {
CacheResource(va("models/player/%s", filename));
}
}
gi.FS_FreeFileList(fileList);
}
} }
/* /*
@ -1730,6 +1754,10 @@ void Level::FreeEdict(gentity_t *ed)
{ {
gclient_t *client; gclient_t *client;
// clear the model so it decreases the user count
// and free memory if the model is not used anywhere
gi.clearmodel(ed);
// unlink from world // unlink from world
gi.unlinkentity(ed); gi.unlinkentity(ed);
@ -1916,6 +1944,8 @@ void Level::CheckVote(void)
level.m_voteNo++; level.m_voteNo++;
} }
} }
numVoters++;
} }
level.m_numVoters = numVoters; level.m_numVoters = numVoters;

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -146,8 +146,7 @@ If PROJECTILES is set, the trigger will respond to projectiles (rockets, grenade
Event EV_ExplodingWall_StopRotating Event EV_ExplodingWall_StopRotating
( (
"stoprotating", "stoprotating", EV_DEFAULT,
EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Stop rotating the wall.", "Stop rotating the wall.",
@ -155,17 +154,16 @@ Event EV_ExplodingWall_StopRotating
); );
Event EV_ExplodingWall_OnGround Event EV_ExplodingWall_OnGround
( (
"checkonground", "checkonground", EV_DEFAULT,
EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Check if exploding wall is on ground.", "Check if exploding wall is on ground.",
EV_NORMAL EV_NORMAL
); );
Event EV_ExplodingWall_AngleSpeed Event EV_ExplodingWall_AngleSpeed
( (
"anglespeed", "anglespeed", EV_DEFAULT,
EV_DEFAULT,
"f", "f",
"speed", "speed",
"Set the angle speed.", "Set the angle speed.",
@ -173,8 +171,7 @@ Event EV_ExplodingWall_AngleSpeed
); );
Event EV_ExplodingWall_LandRadius Event EV_ExplodingWall_LandRadius
( (
"land_radius", "land_radius", EV_DEFAULT,
EV_DEFAULT,
"f", "f",
"radius", "radius",
"Set the land radius.", "Set the land radius.",
@ -182,8 +179,7 @@ Event EV_ExplodingWall_LandRadius
); );
Event EV_ExplodingWall_LandAngles Event EV_ExplodingWall_LandAngles
( (
"land_angles", "land_angles", EV_DEFAULT,
EV_DEFAULT,
"v", "v",
"angles", "angles",
"Set the land angles.", "Set the land angles.",
@ -191,15 +187,13 @@ Event EV_ExplodingWall_LandAngles
); );
Event EV_ExplodingWall_BaseVelocity Event EV_ExplodingWall_BaseVelocity
( (
"base_velocity", "base_velocity", EV_DEFAULT,
EV_DEFAULT,
"v", "v",
"velocity", "velocity",
"Set the base velocity.", "Set the base velocity.",
EV_NORMAL EV_NORMAL
); );
Event EV_ExplodingWall_RandomVelocity Event EV_ExplodingWall_RandomVelocity(
(
"random_velocity", "random_velocity",
EV_DEFAULT, EV_DEFAULT,
"v", "v",
@ -209,8 +203,7 @@ Event EV_ExplodingWall_RandomVelocity
); );
Event EV_ExplodingWall_SetDmg Event EV_ExplodingWall_SetDmg
( (
"dmg", "dmg", EV_DEFAULT,
EV_DEFAULT,
"i", "i",
"dmg", "dmg",
"Set the damage from the exploding wall.", "Set the damage from the exploding wall.",
@ -218,17 +211,16 @@ Event EV_ExplodingWall_SetDmg
); );
Event EV_ExplodingWall_SetExplosions Event EV_ExplodingWall_SetExplosions
( (
"explosions", "explosions", EV_DEFAULT,
EV_DEFAULT,
"i", "i",
"explosions", "explosions",
"Set the number of explosions.", "Set the number of explosions.",
EV_NORMAL EV_NORMAL
); );
Event EV_ExplodingWall_Setup Event EV_ExplodingWall_Setup
( (
"setup", "setup", EV_CODEONLY,
EV_CODEONLY,
NULL, NULL,
NULL, NULL,
"Initializes the exploding wall.", "Initializes the exploding wall.",
@ -253,49 +245,41 @@ CLASS_DECLARATION(Trigger, ExplodingWall, "func_explodingwall") {
}; };
void ExplodingWall::AngleSpeed(Event *ev) void ExplodingWall::AngleSpeed(Event *ev)
{ {
angle_speed = ev->GetFloat(1); angle_speed = ev->GetFloat(1);
} }
void ExplodingWall::LandRadius(Event *ev) void ExplodingWall::LandRadius(Event *ev)
{ {
land_radius = ev->GetFloat(1); land_radius = ev->GetFloat(1);
} }
void ExplodingWall::LandAngles(Event *ev) void ExplodingWall::LandAngles(Event *ev)
{ {
land_angles = ev->GetVector(1); land_angles = ev->GetVector(1);
} }
void ExplodingWall::BaseVelocity(Event *ev) void ExplodingWall::BaseVelocity(Event *ev)
{ {
base_velocity = ev->GetVector(1); base_velocity = ev->GetVector(1);
} }
void ExplodingWall::RandomVelocity(Event *ev) void ExplodingWall::RandomVelocity(Event *ev)
{ {
random_velocity = ev->GetVector(1); random_velocity = ev->GetVector(1);
} }
void ExplodingWall::SetDmg(Event *ev) void ExplodingWall::SetDmg(Event *ev)
{ {
dmg = ev->GetInteger(1); dmg = ev->GetInteger(1);
} }
void ExplodingWall::SetExplosions(Event *ev) void ExplodingWall::SetExplosions(Event *ev)
{ {
explosions = ev->GetInteger(1); explosions = ev->GetInteger(1);
} }
void ExplodingWall::Explode(Event *ev) void ExplodingWall::Explode(Event *ev)
{ {
Entity *other; Entity *other;
Vector pos; Vector pos;
@ -390,7 +374,6 @@ void ExplodingWall::Explode(Event *ev)
} }
void ExplodingWall::DamageEvent(Event *ev) void ExplodingWall::DamageEvent(Event *ev)
{ {
Event *event; Event *event;
Entity *inflictor; Entity *inflictor;
@ -427,7 +410,6 @@ void ExplodingWall::DamageEvent(Event *ev)
} }
void ExplodingWall::GroundDamage(Event *ev) void ExplodingWall::GroundDamage(Event *ev)
{ {
Entity *inflictor; Entity *inflictor;
Entity *attacker; Entity *attacker;
@ -467,14 +449,12 @@ void ExplodingWall::GroundDamage(Event *ev)
} }
void ExplodingWall::SetupSecondStage(void) void ExplodingWall::SetupSecondStage(void)
{ {
health = max_health; health = max_health;
takedamage = DAMAGE_YES; takedamage = DAMAGE_YES;
} }
void ExplodingWall::StopRotating(Event *ev) void ExplodingWall::StopRotating(Event *ev)
{ {
avelocity = vec_zero; avelocity = vec_zero;
setAngles(land_angles); setAngles(land_angles);
@ -484,7 +464,6 @@ void ExplodingWall::StopRotating(Event *ev)
} }
void ExplodingWall::CheckOnGround(Event *ev) void ExplodingWall::CheckOnGround(Event *ev)
{ {
if ((velocity == vec_zero) && groundentity) { if ((velocity == vec_zero) && groundentity) {
Vector delta; Vector delta;
@ -532,7 +511,6 @@ void ExplodingWall::CheckOnGround(Event *ev)
} }
void ExplodingWall::TouchFunc(Event *ev) void ExplodingWall::TouchFunc(Event *ev)
{ {
Entity *other; Entity *other;
@ -568,7 +546,6 @@ void ExplodingWall::TouchFunc(Event *ev)
} }
void ExplodingWall::Setup(Event *ev) void ExplodingWall::Setup(Event *ev)
{ {
if (spawnflags & INVISIBLE) { if (spawnflags & INVISIBLE) {
if (Targeted()) { if (Targeted()) {
@ -650,6 +627,7 @@ Event EV_Teleporter_StopTeleport
"entity", "entity",
"Releases the entity at the end of the teleport.", "Releases the entity at the end of the teleport.",
EV_NORMAL EV_NORMAL
); );
Event EV_Teleporter_SetThread Event EV_Teleporter_SetThread
( (
@ -759,7 +737,6 @@ void Teleporter::StartTeleport(Event *ev)
} }
void Teleporter::Teleport(Event *ev) void Teleporter::Teleport(Event *ev)
{ {
Entity *dest; Entity *dest;
int i; int i;
@ -873,7 +850,6 @@ void Teleporter::Teleport(Event *ev)
} }
void Teleporter::StopTeleport(Event *ev) void Teleporter::StopTeleport(Event *ev)
{ {
Entity *other; Entity *other;
@ -974,6 +950,7 @@ Event EV_UseAnim_Reset
NULL, NULL,
"Reset's the Use Anim after it has no longer been touched.", "Reset's the Use Anim after it has no longer been touched.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_Thread Event EV_UseAnim_Thread
( (
@ -983,15 +960,16 @@ Event EV_UseAnim_Thread
"label", "label",
"Sets which thread to use when this UseAnim is triggered.", "Sets which thread to use when this UseAnim is triggered.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_Count Event EV_UseAnim_Count
( (
"count", "count", EV_DEFAULT,
EV_DEFAULT,
"i", "i",
"newCount", "newCount",
"Sets how many times the UseAnim can be triggered.", "Sets how many times the UseAnim can be triggered.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_TriggerTarget Event EV_UseAnim_TriggerTarget
( (
@ -1019,6 +997,7 @@ Event EV_UseAnim_SetKey
"keyName", "keyName",
"set the key needed to make this UseAnim function.", "set the key needed to make this UseAnim function.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_SetState Event EV_UseAnim_SetState
( (
@ -1029,8 +1008,7 @@ Event EV_UseAnim_SetState
"set the state to use for the player.", "set the state to use for the player.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_SetCamera Event EV_UseAnim_SetCamera(
(
"camera", "camera",
EV_DEFAULT, EV_DEFAULT,
"s", "s",
@ -1047,9 +1025,9 @@ Event EV_UseAnim_SetNumLoops
"loopCount", "loopCount",
"set the number of times to loop an animation per use.", "set the number of times to loop an animation per use.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_SetDelay Event EV_UseAnim_SetDelay(
(
"delay", "delay",
EV_DEFAULT, EV_DEFAULT,
"f", "f",
@ -1120,7 +1098,6 @@ UseAnim::UseAnim()
} }
void UseAnim::Touched(Event *ev) void UseAnim::Touched(Event *ev)
{ {
Entity *other; Entity *other;
@ -1142,7 +1119,6 @@ void UseAnim::Touched(Event *ev)
} }
bool UseAnim::canBeUsed(Entity *activator) bool UseAnim::canBeUsed(Entity *activator)
{ {
Entity *dest; Entity *dest;
@ -1210,7 +1186,6 @@ bool UseAnim::canBeUsed(Entity *activator)
bool UseAnim::GetInformation( bool UseAnim::GetInformation(
Entity *activator, Vector *org, Vector *angles, str *animation, int *loopcount, str *state, str *camera Entity *activator, Vector *org, Vector *angles, str *animation, int *loopcount, str *state, str *camera
) )
{ {
Entity *dest; Entity *dest;
UseAnimDestination *uadest; UseAnimDestination *uadest;
@ -1282,7 +1257,6 @@ bool UseAnim::GetInformation(
} }
void UseAnim::TriggerTargets(Entity *activator) void UseAnim::TriggerTargets(Entity *activator)
{ {
// //
// fire off our trigger target if appropriate // fire off our trigger target if appropriate
@ -1312,7 +1286,6 @@ void UseAnim::TriggerTargets(Entity *activator)
} }
void UseAnim::Reset(Event *ev) void UseAnim::Reset(Event *ev)
{ {
// //
// find out if our triggertarget is of type door and only reset if the door is closed // find out if our triggertarget is of type door and only reset if the door is closed
@ -1363,25 +1336,21 @@ void UseAnim::Reset(Event *ev)
} }
void UseAnim::SetThread(Event *ev) void UseAnim::SetThread(Event *ev)
{ {
thread.SetThread(ev->GetValue(1)); thread.SetThread(ev->GetValue(1));
} }
void UseAnim::SetDelay(Event *ev) void UseAnim::SetDelay(Event *ev)
{ {
delay = ev->GetFloat(1); delay = ev->GetFloat(1);
} }
void UseAnim::SetTriggerTarget(Event *ev) void UseAnim::SetTriggerTarget(Event *ev)
{ {
triggertarget = ev->GetString(1); triggertarget = ev->GetString(1);
} }
void UseAnim::SetCount(Event *ev) void UseAnim::SetCount(Event *ev)
{ {
count = ev->GetInteger(1); count = ev->GetInteger(1);
} }
@ -1518,6 +1487,7 @@ Event EV_UseObject_StopThread
"label", "label",
"Sets which stop thread to use when this UseObject is finished.", "Sets which stop thread to use when this UseObject is finished.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_ResetThread Event EV_UseObject_ResetThread
( (
@ -1527,6 +1497,7 @@ Event EV_UseObject_ResetThread
"label", "label",
"Sets which thread to call when resetting.", "Sets which thread to call when resetting.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_Count Event EV_UseObject_Count
( (
@ -1536,6 +1507,7 @@ Event EV_UseObject_Count
"newCount", "newCount",
"Sets how many times the UseObject can be triggered.", "Sets how many times the UseObject can be triggered.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_Cone Event EV_UseObject_Cone
( (
@ -1545,6 +1517,7 @@ Event EV_UseObject_Cone
"newCone", "newCone",
"Sets the cone in angles of where the Useobject can be used.", "Sets the cone in angles of where the Useobject can be used.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_Offset Event EV_UseObject_Offset
( (
@ -1554,6 +1527,7 @@ Event EV_UseObject_Offset
"newOffset", "newOffset",
"Sets the offset to use for this UseObject.", "Sets the offset to use for this UseObject.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_YawOffset Event EV_UseObject_YawOffset
( (
@ -1563,6 +1537,7 @@ Event EV_UseObject_YawOffset
"newYawOffset", "newYawOffset",
"Sets the yaw offset to use for this UseObject.", "Sets the yaw offset to use for this UseObject.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_State Event EV_UseObject_State
( (
@ -1581,6 +1556,7 @@ Event EV_UseObject_StateBackwards
"newState", "newState",
"Sets the backward state to use for this UseObject.", "Sets the backward state to use for this UseObject.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_TriggerTarget Event EV_UseObject_TriggerTarget
( (
@ -1626,6 +1602,7 @@ Event EV_UseObject_Resetting
NULL, NULL,
"Intermediate function for useobject reset.", "Intermediate function for useobject reset.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_DamageTriggered Event EV_UseObject_DamageTriggered
( (
@ -1662,6 +1639,7 @@ Event EV_UseObject_UseMaterial
"nameOfUseMaterial", "nameOfUseMaterial",
"the name of the material that glows when active.", "the name of the material that glows when active.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_SetActiveState Event EV_UseObject_SetActiveState
( (
@ -1671,6 +1649,7 @@ Event EV_UseObject_SetActiveState
NULL, NULL,
"event that sets up the proper skin for the useobject.", "event that sets up the proper skin for the useobject.",
EV_NORMAL EV_NORMAL
); );
#define MULTI_STATE (1 << 0) #define MULTI_STATE (1 << 0)
@ -1821,87 +1800,73 @@ void UseObject::SetActiveState(Event *ev)
} }
void UseObject::SetMoveThread(Event *ev) void UseObject::SetMoveThread(Event *ev)
{ {
move_thread.SetThread(ev->GetValue(1)); move_thread.SetThread(ev->GetValue(1));
} }
void UseObject::SetStopThread(Event *ev) void UseObject::SetStopThread(Event *ev)
{ {
stop_thread.SetThread(ev->GetValue(1)); stop_thread.SetThread(ev->GetValue(1));
} }
void UseObject::SetResetThread(Event *ev) void UseObject::SetResetThread(Event *ev)
{ {
reset_thread.SetThread(ev->GetValue(1)); reset_thread.SetThread(ev->GetValue(1));
} }
void UseObject::ActivateEvent(Event *ev) void UseObject::ActivateEvent(Event *ev)
{ {
active = qtrue; active = qtrue;
PostEvent(EV_UseObject_SetActiveState, 0); PostEvent(EV_UseObject_SetActiveState, 0);
} }
void UseObject::DeactivateEvent(Event *ev) void UseObject::DeactivateEvent(Event *ev)
{ {
active = qfalse; active = qfalse;
PostEvent(EV_UseObject_SetActiveState, 0); PostEvent(EV_UseObject_SetActiveState, 0);
} }
void UseObject::SetTriggerTarget(Event *ev) void UseObject::SetTriggerTarget(Event *ev)
{ {
triggertarget = ev->GetString(1); triggertarget = ev->GetString(1);
} }
void UseObject::SetOffset(Event *ev) void UseObject::SetOffset(Event *ev)
{ {
offset = ev->GetVector(1); offset = ev->GetVector(1);
} }
void UseObject::SetYawOffset(Event *ev) void UseObject::SetYawOffset(Event *ev)
{ {
yaw_offset = ev->GetFloat(1); yaw_offset = ev->GetFloat(1);
} }
void UseObject::SetCount(Event *ev) void UseObject::SetCount(Event *ev)
{ {
count = ev->GetInteger(1); count = ev->GetInteger(1);
} }
void UseObject::SetCone(Event *ev) void UseObject::SetCone(Event *ev)
{ {
cone = cos(DEG2RAD(ev->GetFloat(1))); cone = cos(DEG2RAD(ev->GetFloat(1)));
} }
void UseObject::SetState(Event *ev) void UseObject::SetState(Event *ev)
{ {
state = ev->GetString(1); state = ev->GetString(1);
} }
void UseObject::SetBackwardsState(Event *ev) void UseObject::SetBackwardsState(Event *ev)
{ {
state_backwards = ev->GetString(1); state_backwards = ev->GetString(1);
} }
void UseObject::UseMaterialEvent(Event *ev) void UseObject::UseMaterialEvent(Event *ev)
{ {
useMaterial = ev->GetString(1); useMaterial = ev->GetString(1);
} }
void UseObject::SetResetTime(Event *ev) void UseObject::SetResetTime(Event *ev)
{ {
reset_time = ev->GetFloat(1); reset_time = ev->GetFloat(1);
} }
@ -1912,7 +1877,6 @@ void UseObject::Reset(Event *ev)
} }
void UseObject::Resetting(Event *ev) void UseObject::Resetting(Event *ev)
{ {
SetActiveState(NULL); SetActiveState(NULL);
NewAnim("start"); NewAnim("start");
@ -1948,7 +1912,6 @@ void UseObject::Resetting(Event *ev)
} }
bool UseObject::canBeUsed(Vector org, Vector dir) bool UseObject::canBeUsed(Vector org, Vector dir)
{ {
float dot; float dot;
Vector forward; Vector forward;
@ -1992,7 +1955,6 @@ bool UseObject::canBeUsed(Vector org, Vector dir)
} }
void UseObject::DamageFunc(Event *ev) void UseObject::DamageFunc(Event *ev)
{ {
Event *e; Event *e;
Entity *attacker; Entity *attacker;
@ -2029,14 +1991,12 @@ void UseObject::DamageFunc(Event *ev)
} }
void UseObject::DamageTriggered(Event *ev) void UseObject::DamageTriggered(Event *ev)
{ {
// grab the attacker from our event // grab the attacker from our event
Stop(ev->GetEntity(1)); Stop(ev->GetEntity(1));
} }
void UseObject::Setup(Entity *activator, Vector *org, Vector *ang, str *newstate) void UseObject::Setup(Entity *activator, Vector *org, Vector *ang, str *newstate)
{ {
if ((spawnflags & MULTI_STATE) && objectState) { if ((spawnflags & MULTI_STATE) && objectState) {
*newstate = state_backwards; *newstate = state_backwards;
@ -2060,7 +2020,6 @@ void UseObject::Setup(Entity *activator, Vector *org, Vector *ang, str *newstate
} }
void UseObject::Start(Event *ev) void UseObject::Start(Event *ev)
{ {
// //
// fire off the move_thread // fire off the move_thread
@ -2079,7 +2038,6 @@ void UseObject::Start(Event *ev)
} }
bool UseObject::Loop(void) bool UseObject::Loop(void)
{ {
if (!count) { if (!count) {
return qfalse; return qfalse;
@ -2089,7 +2047,6 @@ bool UseObject::Loop(void)
} }
void UseObject::Stop(Entity *activator) void UseObject::Stop(Entity *activator)
{ {
if ((spawnflags & MULTI_STATE) && objectState) { if ((spawnflags & MULTI_STATE) && objectState) {
NewAnim("start"); NewAnim("start");
@ -2222,7 +2179,6 @@ MonkeyBars::MonkeyBars()
} }
void MonkeyBars::SetAngleEvent(Event *ev) void MonkeyBars::SetAngleEvent(Event *ev)
{ {
dir = ev->GetFloat(1); dir = ev->GetFloat(1);
} }
@ -2252,7 +2208,6 @@ HorizontalPipe::HorizontalPipe()
} }
void HorizontalPipe::SetAngleEvent(Event *ev) void HorizontalPipe::SetAngleEvent(Event *ev)
{ {
dir = ev->GetFloat(1); dir = ev->GetFloat(1);
} }
@ -2263,14 +2218,15 @@ void HorizontalPipe::SetAngleEvent(Event *ev)
Event EV_TossObject_SetBounceSound Event EV_TossObject_SetBounceSound
( (
"bouncesound", EV_DEFAULT, "bouncesound",
EV_DEFAULT,
"s", "s",
"sound", "sound",
"When bouncing, what sound to play on impact", "When bouncing, what sound to play on impact",
EV_NORMAL EV_NORMAL
); );
Event EV_TossObject_SetBounceSoundChance Event EV_TossObject_SetBounceSoundChance(
(
"bouncesoundchance", "bouncesoundchance",
EV_DEFAULT, EV_DEFAULT,
"f[0,1]", "f[0,1]",
@ -2309,31 +2265,26 @@ TossObject::TossObject(str model)
} }
void TossObject::SetBounceSound(str bounce) void TossObject::SetBounceSound(str bounce)
{ {
bouncesound = bounce; bouncesound = bounce;
} }
void TossObject::SetBounceSound(Event *ev) void TossObject::SetBounceSound(Event *ev)
{ {
bouncesound = ev->GetString(1); bouncesound = ev->GetString(1);
} }
void TossObject::SetBounceSoundChance(float chance) void TossObject::SetBounceSoundChance(float chance)
{ {
bouncesoundchance = chance; bouncesoundchance = chance;
} }
void TossObject::SetBounceSoundChance(Event *ev) void TossObject::SetBounceSoundChance(Event *ev)
{ {
bouncesoundchance = ev->GetFloat(1); bouncesoundchance = ev->GetFloat(1);
} }
void TossObject::Stop(Event *ev) void TossObject::Stop(Event *ev)
{ {
setMoveType(MOVETYPE_NONE); setMoveType(MOVETYPE_NONE);
setSolidType(SOLID_NOT); setSolidType(SOLID_NOT);
@ -2345,7 +2296,6 @@ void TossObject::Stop(Event *ev)
} }
void TossObject::Touch(Event *ev) void TossObject::Touch(Event *ev)
{ {
Entity *ent; Entity *ent;
@ -2368,7 +2318,6 @@ void TossObject::Touch(Event *ev)
} }
void TossObject::SetVelocity(float severity) void TossObject::SetVelocity(float severity)
{ {
setSolidType(SOLID_BBOX); setSolidType(SOLID_BBOX);
velocity[0] = 100.0 * crandom(); velocity[0] = 100.0 * crandom();
@ -2413,8 +2362,7 @@ Pushable object
Event EV_PushObject_Start Event EV_PushObject_Start
( (
"start", "start", EV_DEFAULT,
EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Sets up the pushobject.", "Sets up the pushobject.",
@ -2423,8 +2371,7 @@ Event EV_PushObject_Start
Event EV_PushObject_SetDamage Event EV_PushObject_SetDamage
( (
"dmg", "dmg", EV_DEFAULT,
EV_DEFAULT,
"i", "i",
"damage", "damage",
"Set the damage.", "Set the damage.",
@ -2433,8 +2380,7 @@ Event EV_PushObject_SetDamage
Event EV_PushObject_SetPushSound Event EV_PushObject_SetPushSound
( (
"pushsound", "pushsound", EV_DEFAULT,
EV_DEFAULT,
"s", "s",
"sound", "sound",
"Set the pushing sound", "Set the pushing sound",
@ -2464,13 +2410,11 @@ PushObject::PushObject()
} }
void PushObject::SetPushSound(Event *ev) void PushObject::SetPushSound(Event *ev)
{ {
pushsound = ev->GetString(1); pushsound = ev->GetString(1);
} }
void PushObject::Start(Event *ev) void PushObject::Start(Event *ev)
{ {
// make sure that this touches triggers // make sure that this touches triggers
flags |= FL_TOUCH_TRIGGERS; flags |= FL_TOUCH_TRIGGERS;
@ -2483,7 +2427,6 @@ void PushObject::Start(Event *ev)
} }
qboolean PushObject::canPush(Vector dir) qboolean PushObject::canPush(Vector dir)
{ {
trace_t trace; trace_t trace;
@ -2494,7 +2437,6 @@ qboolean PushObject::canPush(Vector dir)
} }
qboolean PushObject::Push(Entity *pusher, Vector move) qboolean PushObject::Push(Entity *pusher, Vector move)
{ {
trace_t trace; trace_t trace;
@ -2524,13 +2466,11 @@ qboolean PushObject::Push(Entity *pusher, Vector move)
} }
Entity *PushObject::getOwner(void) Entity *PushObject::getOwner(void)
{ {
return (Entity *)owner; return (Entity *)owner;
} }
void PushObject::BlockFunc(Event *ev) void PushObject::BlockFunc(Event *ev)
{ {
Entity *other; Entity *other;
@ -2544,7 +2484,6 @@ void PushObject::BlockFunc(Event *ev)
} }
void PushObject::SetDamage(Event *ev) void PushObject::SetDamage(Event *ev)
{ {
dmg = ev->GetInteger(1); dmg = ev->GetInteger(1);
} }
@ -2632,6 +2571,7 @@ Event EV_FallingRock_SetBounceSound
"sound", "sound",
"Set the sound to play when the rock bounces", "Set the sound to play when the rock bounces",
EV_NORMAL EV_NORMAL
); );
CLASS_DECLARATION(Entity, FallingRock, "func_fallingrock") { CLASS_DECLARATION(Entity, FallingRock, "func_fallingrock") {
@ -2666,7 +2606,6 @@ FallingRock::FallingRock()
} }
Entity *FallingRock::SetNextBounceDir(void) Entity *FallingRock::SetNextBounceDir(void)
{ {
Entity *ent; Entity *ent;
@ -2686,7 +2625,6 @@ Entity *FallingRock::SetNextBounceDir(void)
} }
void FallingRock::NextBounce(void) void FallingRock::NextBounce(void)
{ {
float time; float time;
float distance; float distance;
@ -2729,7 +2667,6 @@ void FallingRock::NextBounce(void)
} }
void FallingRock::Rotate(Event *ev) void FallingRock::Rotate(Event *ev)
{ {
float mat[3][3]; float mat[3][3];
float ang; float ang;
@ -2747,19 +2684,16 @@ void FallingRock::Rotate(Event *ev)
} }
void FallingRock::SetWait(Event *ev) void FallingRock::SetWait(Event *ev)
{ {
wait = ev->GetFloat(1); wait = ev->GetFloat(1);
} }
void FallingRock::SetSpeed(Event *ev) void FallingRock::SetSpeed(Event *ev)
{ {
speed = ev->GetFloat(1); speed = ev->GetFloat(1);
} }
void FallingRock::SetDmg(Event *ev) void FallingRock::SetDmg(Event *ev)
{ {
dmg = ev->GetInteger(1); dmg = ev->GetInteger(1);
} }
@ -2772,13 +2706,11 @@ void FallingRock::SetBounceSound(str sound)
} }
void FallingRock::SetBounceSound(Event *ev) void FallingRock::SetBounceSound(Event *ev)
{ {
SetBounceSound(ev->GetString(1)); SetBounceSound(ev->GetString(1));
} }
void FallingRock::Activate(Event *ev) void FallingRock::Activate(Event *ev)
{ {
if (active == 1) { if (active == 1) {
return; return;
@ -2802,7 +2734,6 @@ void FallingRock::Activate(Event *ev)
} }
void FallingRock::StartFalling(Event *ev) void FallingRock::StartFalling(Event *ev)
{ {
if (current) { if (current) {
return; return;
@ -2827,7 +2758,6 @@ void FallingRock::StartFalling(Event *ev)
} }
void FallingRock::Touch(Event *ev) void FallingRock::Touch(Event *ev)
{ {
Entity *other; Entity *other;
@ -2858,7 +2788,6 @@ void FallingRock::Touch(Event *ev)
} }
void FallingRock::Bounce(Event *ev) void FallingRock::Bounce(Event *ev)
{ {
Vector delta; Vector delta;
@ -3155,10 +3084,19 @@ void FuncLadder::EnsureForwardOffLadder(Entity *pUser)
pUser->setOrigin(trace.endpos); pUser->setOrigin(trace.endpos);
} }
const Vector& FuncLadder::getFacingAngles() const
{
return m_vFacingAngles;
}
const Vector& FuncLadder::getFacingDir() const
{
return m_vFacingDir;
}
Event EV_InfoLandmark_Name Event EV_InfoLandmark_Name
( (
"landmark_name", "landmark_name", EV_DEFAULT,
EV_DEFAULT,
"s", "s",
"name", "name",
"Set the name of this landmark", "Set the name of this landmark",
@ -3166,8 +3104,7 @@ Event EV_InfoLandmark_Name
); );
Event EV_InfoLandmark_SetOrigin Event EV_InfoLandmark_SetOrigin
( (
"origin", "origin", EV_DEFAULT,
EV_DEFAULT,
"v", "v",
"origin", "origin",
"Set the origin of the landmark.", "Set the origin of the landmark.",

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -565,6 +565,9 @@ public:
void EnsureOverLadder(Entity *pUser); void EnsureOverLadder(Entity *pUser);
void EnsureForwardOffLadder(Entity *pUser); void EnsureForwardOffLadder(Entity *pUser);
const Vector& getFacingAngles() const;
const Vector& getFacingDir() const;
void Archive(Archiver& arc) override; void Archive(Archiver& arc) override;
}; };

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -250,3 +250,24 @@ void Mover::LinearInterpolate(Vector tdest, Vector angdest, float time, Event& e
PostEvent(EV_MoveDone, time); PostEvent(EV_MoveDone, time);
} }
/*
=============
Stop
===============
*/
void Mover::Stop()
{
if (endevent) {
delete endevent;
endevent = NULL;
}
CancelEventsOfType(EV_MoveDone);
moveflags = 0;
avelocity = vec_zero;
velocity = vec_zero;
accel = vec_zero;
aaccel = vec_zero;
}

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -48,6 +48,7 @@ public:
void MoveDone(Event *ev); void MoveDone(Event *ev);
void MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event); void MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event);
void LinearInterpolate(Vector tdest, Vector angdest, float time, Event& event); void LinearInterpolate(Vector tdest, Vector angdest, float time, Event& event);
void Stop();
void Archive(Archiver& arc) override; void Archive(Archiver& arc) override;
}; };

View file

@ -1001,7 +1001,7 @@ PathNode *PathSearch::FindCornerNodeForWall(
PathNode *PathSearch::FindCornerNodeForExactPath(Entity *pSelf, Sentient *enemy, float fMaxPath) PathNode *PathSearch::FindCornerNodeForExactPath(Entity *pSelf, Sentient *enemy, float fMaxPath)
{ {
PathNode *pPathNode[4096]; PathNode *pPathNode[MAX_PATHNODES];
PathNode *pParentNode; PathNode *pParentNode;
size_t i, iDepth; size_t i, iDepth;
Vector vEnd; Vector vEnd;
@ -1554,7 +1554,7 @@ void DrawNode(int iNodeCount)
Vector aStart; Vector aStart;
Vector aEnd; Vector aEnd;
PathNode *node; PathNode *node;
PathNode *nodelist[4096]; PathNode *nodelist[MAX_PATHNODES];
Vector end; Vector end;
Vector start; Vector start;
Vector p; Vector p;
@ -1562,8 +1562,8 @@ void DrawNode(int iNodeCount)
playerorigin = g_entities[0].client->ps.origin; playerorigin = g_entities[0].client->ps.origin;
if (iNodeCount > 4096) { if (iNodeCount > MAX_PATHNODES) {
iNodeCount = 4096; iNodeCount = MAX_PATHNODES;
} }
if (ai_showallnode->integer) { if (ai_showallnode->integer) {
@ -2500,7 +2500,10 @@ PathNode *PathSearch::FindNearestSniperNode(Entity*pEnt, Vector& vPos, Entity *p
PathNode *PathSearch::GetSpawnNode(ClassDef *cls) PathNode *PathSearch::GetSpawnNode(ClassDef *cls)
{ {
if (m_bNodesloaded) { if (m_bNodesloaded
// Fixed in OPM
&& m_LoadIndex < nodecount
) {
return pathnodes[m_LoadIndex++]; return pathnodes[m_LoadIndex++];
} else { } else {
// Otherwise create a new node // Otherwise create a new node

View file

@ -252,7 +252,7 @@ private:
static int m_LoadIndex; static int m_LoadIndex;
public: public:
static PathNode *pathnodes[4096]; static PathNode *pathnodes[MAX_PATHNODES];
static int nodecount; static int nodecount;
static float total_dist; static float total_dist;
static const char *last_error; static const char *last_error;

View file

@ -58,6 +58,13 @@ const Vector power_color(0.0, 1.0, 0.0);
const Vector acolor(1.0, 1.0, 1.0); const Vector acolor(1.0, 1.0, 1.0);
const Vector bcolor(1.0, 0.0, 0.0); const Vector bcolor(1.0, 0.0, 0.0);
ScriptDelegate Player::scriptDelegate_connected("player_connected", "Sent once when the player connected");
ScriptDelegate Player::scriptDelegate_disconnecting("player_disconnecting", "The player is disconnecting");
ScriptDelegate Player::scriptDelegate_spawned("player_spawned", "The player has spawned");
ScriptDelegate Player::scriptDelegate_damage("player_damaged", "The player got hit");
ScriptDelegate Player::scriptDelegate_kill("player_killed", "The player got killed");
ScriptDelegate Player::scriptDelegate_textMessage("player_textMessage", "The player just sent a text message");
// //
// mohaas 2.0 and above // mohaas 2.0 and above
// //
@ -1904,7 +1911,6 @@ CLASS_DECLARATION(Sentient, Player, "player") {
{&EV_Player_AdminRights, &Player::AdminRights }, {&EV_Player_AdminRights, &Player::AdminRights },
{&EV_Player_BindWeap, &Player::BindWeap }, {&EV_Player_BindWeap, &Player::BindWeap },
{&EV_Player_Dive, &Player::Dive }, {&EV_Player_Dive, &Player::Dive },
{&EV_Player_DMMessage, &Player::EventDMMessage },
{&EV_Player_FreezeControls, &Player::FreezeControls }, {&EV_Player_FreezeControls, &Player::FreezeControls },
{&EV_Player_SetTeam, &Player::EventSetTeam }, {&EV_Player_SetTeam, &Player::EventSetTeam },
{&EV_Player_GetConnState, &Player::GetConnState }, {&EV_Player_GetConnState, &Player::GetConnState },
@ -2209,6 +2215,12 @@ Player::~Player()
// when the player is deleted // when the player is deleted
RemoveFromVehiclesAndTurrets(); RemoveFromVehiclesAndTurrets();
// Added in OPM
// Remove the player at destructor
if (g_gametype->integer != GT_SINGLE_PLAYER && dmManager.PlayerCount()) {
dmManager.RemovePlayer(this);
}
entflags &= ~ECF_PLAYER; entflags &= ~ECF_PLAYER;
} }
@ -2258,6 +2270,8 @@ void Player::Init(void)
Event *ev = new Event; Event *ev = new Event;
ev->AddEntity(this); ev->AddEntity(this);
scriptDelegate_connected.Trigger(this, *ev);
scriptedEvents[SE_CONNECTED].Trigger(ev); scriptedEvents[SE_CONNECTED].Trigger(ev);
} }
@ -2663,6 +2677,11 @@ void Player::ChooseSpawnPoint(void)
void Player::EndLevel(Event *ev) void Player::EndLevel(Event *ev)
{ {
if (IsDead()) {
ScriptError("cannot do player.endlevel if the player is dead");
return;
}
InitPowerups(); InitPowerups();
if (health > max_health) { if (health > max_health) {
health = max_health; health = max_health;
@ -3206,6 +3225,7 @@ void Player::Killed(Event *ev)
event->AddInteger(ev->GetInteger(10)); event->AddInteger(ev->GetInteger(10));
event->AddEntity(this); event->AddEntity(this);
scriptDelegate_kill.Trigger(this, *event);
scriptedEvents[SE_KILL].Trigger(event); scriptedEvents[SE_KILL].Trigger(event);
Unregister(STRING_DEATH); Unregister(STRING_DEATH);
@ -5420,6 +5440,13 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
StopPartAnimating(torso); StopPartAnimating(torso);
animdone_Torso = true; animdone_Torso = true;
} else if (torsoAnim != "") { } else if (torsoAnim != "") {
if (torsoAnim == partAnim[torso]) {
// Fixed in OPM
// Stop the part if it's the same animation
// so the new animation can play and make some action
// like activate the new weapon.
StopPartAnimating(torso);
}
SetPartAnim(torsoAnim.c_str(), torso); SetPartAnim(torsoAnim.c_str(), torso);
} }
} else { } else {
@ -5427,6 +5454,11 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
StopPartAnimating(torso); StopPartAnimating(torso);
animdone_Torso = true; animdone_Torso = true;
} else if (torsoAnim != "") { } else if (torsoAnim != "") {
if (torsoAnim == partAnim[torso]) {
// Fixed in OPM
// See above
StopPartAnimating(torso);
}
SetPartAnim(torsoAnim.c_str(), torso); SetPartAnim(torsoAnim.c_str(), torso);
} }
@ -5510,7 +5542,6 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
laststate_Legs = NULL; laststate_Legs = NULL;
} }
animdone_Legs = false;
if (currentState_Legs) { if (currentState_Legs) {
if (laststate_Legs) { if (laststate_Legs) {
// Process exit commands of the last state // Process exit commands of the last state
@ -5531,7 +5562,26 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
StopPartAnimating(legs); StopPartAnimating(legs);
animdone_Legs = true; animdone_Legs = true;
} else if (legsAnim != "") { } else if (legsAnim != "") {
SetPartAnim(legsAnim, legs); float oldTime;
if (currentState_Legs == laststate_Legs) {
//
// Added in OPM
// This allows different animations in the same state
// to be continued at the same moment.
// This is used to avoid "ghost walking" where the player
// would switch weapons indefinitely to avoid footstep sounds
//
oldTime = GetTime(m_iPartSlot[legs]);
SetPartAnim(legsAnim, legs);
if (animtimes[m_iPartSlot[legs]] > 0) {
SetTime(m_iPartSlot[legs], fmod(oldTime, animtimes[m_iPartSlot[legs]]));
}
} else {
SetPartAnim(legsAnim, legs);
}
} }
} else { } else {
currentState_Legs = laststate_Legs; currentState_Legs = laststate_Legs;
@ -5542,21 +5592,25 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
} }
if (g_showplayeranim->integer) { if (g_showplayeranim->integer) {
if (last_leg_anim_name != AnimName(legs)) { str sNewAnim;
gi.DPrintf("Legs change from %s to %s\n", last_leg_anim_name.c_str(), AnimName(legs));
last_leg_anim_name = AnimName(legs); sNewAnim = AnimName(m_iPartSlot[legs]);
if (last_leg_anim_name != sNewAnim) {
gi.DPrintf("Legs anim change from %s to %s\n", last_leg_anim_name.c_str(), sNewAnim.c_str());
last_leg_anim_name = sNewAnim;
} }
if (last_torso_anim_name != AnimName(torso)) { sNewAnim = AnimName(m_iPartSlot[torso]);
gi.DPrintf("Torso change from %s to %s\n", last_torso_anim_name.c_str(), AnimName(torso)); if (last_torso_anim_name != sNewAnim) {
last_torso_anim_name = AnimName(torso); gi.DPrintf("Torso anim change from %s to %s\n", last_torso_anim_name.c_str(), sNewAnim.c_str());
last_torso_anim_name = sNewAnim;
} }
} }
if (g_showplayerstate->integer) { if (g_showplayerstate->integer) {
if (startstate_Legs != currentState_Legs) { if (startstate_Legs != currentState_Legs) {
gi.DPrintf( gi.DPrintf(
"Legs change from %s to %s\n", "Legs state change from %s to %s\n",
startstate_Legs ? startstate_Legs->getName() : "NULL", startstate_Legs ? startstate_Legs->getName() : "NULL",
currentState_Legs ? currentState_Legs->getName() : "NULL" currentState_Legs ? currentState_Legs->getName() : "NULL"
); );
@ -5564,7 +5618,7 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
if (startstate_Torso != currentState_Torso) { if (startstate_Torso != currentState_Torso) {
gi.DPrintf( gi.DPrintf(
"Torso change from %s to %s\n", "Torso state change from %s to %s\n",
startstate_Torso ? startstate_Torso->getName() : "NULL", startstate_Torso ? startstate_Torso->getName() : "NULL",
currentState_Torso ? currentState_Torso->getName() : "NULL" currentState_Torso ? currentState_Torso->getName() : "NULL"
); );
@ -5631,7 +5685,7 @@ void Player::SelectPreviousWeapon(Event *ev)
// Fixed in OPM // Fixed in OPM
// Fixes the bug that cause infinite loop when the last weapon has no ammo // Fixes the bug that cause infinite loop when the last weapon has no ammo
// and the only weapon is an inventory item // and the only weapon is an inventory item
for (weapon = initialWeapon = PreviousWeapon(activeWeapon); weapon && weapon != activeWeapon; ) { for (weapon = initialWeapon = PreviousWeapon(activeWeapon); weapon && weapon != activeWeapon;) {
if (g_gametype->integer == GT_SINGLE_PLAYER || !weapon->IsSubclassOfInventoryItem()) { if (g_gametype->integer == GT_SINGLE_PLAYER || !weapon->IsSubclassOfInventoryItem()) {
break; break;
} }
@ -5680,7 +5734,7 @@ void Player::SelectNextWeapon(Event *ev)
// Fixed in OPM // Fixed in OPM
// Fixes the bug that cause infinite loop when the last weapon has no ammo // Fixes the bug that cause infinite loop when the last weapon has no ammo
// and the only weapon is an inventory item // and the only weapon is an inventory item
for (weapon = initialWeapon = NextWeapon(activeWeapon); weapon && weapon != activeWeapon; ) { for (weapon = initialWeapon = NextWeapon(activeWeapon); weapon && weapon != activeWeapon;) {
if (g_gametype->integer == GT_SINGLE_PLAYER || !weapon->IsSubclassOfInventoryItem()) { if (g_gametype->integer == GT_SINGLE_PLAYER || !weapon->IsSubclassOfInventoryItem()) {
break; break;
} }
@ -6462,18 +6516,15 @@ void Player::DamageFeedback(void)
// //
damage_blood = 0; damage_blood = 0;
if (g_target_game >= target_game_e::TG_MOHTA) { //
// // Added in 2.0
// Added in 2.0 // Don't show damage when in god mode
// No more damage angles since MOHTA //
// if (flags & FL_GODMODE) {
damage_count = 0;
if (IsSubclassOfPlayer()) { damage_blood = 0;
damage_count = 0; damage_alpha = 0;
damage_blood = 0; damage_angles = vec_zero;
damage_alpha = 0;
damage_angles = vec_zero;
}
} }
} }
@ -8791,25 +8842,25 @@ void Player::EnsurePlayerHasAllowedWeapons()
Q_strncpyz(client->pers.dm_primary, "smg", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "smg", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "smg")) { } else if (!Q_stricmp(client->pers.dm_primary, "smg")) {
if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) { if (!(dmflags->integer & DF_WEAPON_NO_SMG)) {
return; return;
} }
Q_strncpyz(client->pers.dm_primary, "mg", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "mg", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "mg")) { } else if (!Q_stricmp(client->pers.dm_primary, "mg")) {
if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) { if (!(dmflags->integer & DF_WEAPON_NO_MG)) {
return; return;
} }
Q_strncpyz(client->pers.dm_primary, "shotgun", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "shotgun", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "shotgun")) { } else if (!Q_stricmp(client->pers.dm_primary, "shotgun")) {
if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) { if (!(dmflags->integer & DF_WEAPON_NO_SHOTGUN)) {
return; return;
} }
Q_strncpyz(client->pers.dm_primary, "heavy", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "heavy", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "heavy")) { } else if (!Q_stricmp(client->pers.dm_primary, "heavy")) {
if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) { if (!(dmflags->integer & DF_WEAPON_NO_ROCKET)) {
return; return;
} }
@ -8878,7 +8929,12 @@ void Player::EquipWeapons()
} }
break; break;
case NA_GERMAN: case NA_GERMAN:
if (g_target_game < target_game_e::TG_MOHTA || dmflags->integer & DF_OLD_SNIPER) { if (g_target_game < target_game_e::TG_MOHTA
|| dmflags->integer & DF_OLD_SNIPER
// Added in OPM
// This was also a feature of Daven's fixes
// Use KAR98 for panzer skins
|| !Q_stricmpn(client->pers.dm_playergermanmodel, "german_panzer", 13)) {
// Old snipers are forced older versions of the game // Old snipers are forced older versions of the game
giveItem("weapons/kar98sniper.tik"); giveItem("weapons/kar98sniper.tik");
event->AddString("KAR98 - Sniper"); event->AddString("KAR98 - Sniper");
@ -9655,19 +9711,21 @@ void Player::ArmorDamage(Event *ev)
event->AddInteger(ev->GetInteger(10)); event->AddInteger(ev->GetInteger(10));
event->AddEntity(this); event->AddEntity(this);
scriptDelegate_damage.Trigger(this, *event);
scriptedEvents[SE_DAMAGE].Trigger(event); scriptedEvents[SE_DAMAGE].Trigger(event);
} }
void Player::Disconnect(void) void Player::Disconnect(void)
{ {
Event *ev = new Event; Event *ev = new Event;
ev->AddListener(this); ev->AddListener(this);
scriptDelegate_disconnecting.Trigger(this, *ev);
scriptedEvents[SE_DISCONNECTED].Trigger(ev); scriptedEvents[SE_DISCONNECTED].Trigger(ev);
if (g_gametype->integer != GT_SINGLE_PLAYER) { // if (g_gametype->integer != GT_SINGLE_PLAYER) {
dmManager.RemovePlayer(this); // dmManager.RemovePlayer(this);
} // }
} }
void Player::CallVote(Event *ev) void Player::CallVote(Event *ev)
@ -10326,7 +10384,7 @@ void Player::Stats(Event *ev)
m_iObjectivesCompleted, m_iObjectivesCompleted,
iNumShotsFired, iNumShotsFired,
iNumHits, iNumHits,
(iNumHits / iNumShotsFired * 100.f), ((float)iNumHits / (float)iNumShotsFired * 100.f),
szPreferredWeapon.c_str(), szPreferredWeapon.c_str(),
m_iNumHitsTaken, m_iNumHitsTaken,
m_iNumObjectsDestroyed, m_iNumObjectsDestroyed,
@ -10380,9 +10438,12 @@ void Player::EventStuffText(Event *ev)
Event *event = new Event(EV_Player_StuffText); Event *event = new Event(EV_Player_StuffText);
event->AddValue(ev->GetValue(1)); event->AddValue(ev->GetValue(1));
PostEvent(event, level.frametime, 0); PostEvent(event, level.frametime, 0);
} else { return;
gi.SendServerCommand(edict - g_entities, "stufftext \"%s\"", ev->GetString(1).c_str());
} }
gi.SendServerCommand(edict - g_entities, "stufftext \"%s\"", ev->GetString(1).c_str());
delegate_stufftext.Execute(ev->GetString(1));
} }
void Player::EventSetVoiceType(Event *ev) void Player::EventSetVoiceType(Event *ev)
@ -10569,6 +10630,17 @@ void Player::EventDMMessage(Event *ev)
return; return;
} }
if (!Q_stricmp(client->pers.netname, "console")) {
// Added in OPM
// Reserved name
gi.Printf(
"Client %d trying to send a message using a reserved name ('%s')\n",
edict - g_entities,
client->pers.netname
);
return;
}
sToken = ev->GetString(2); sToken = ev->GetString(2);
// Check for taunts // Check for taunts
@ -10743,11 +10815,18 @@ void Player::EventDMMessage(Event *ev)
Q_strcat(szPrintString, sizeof(szPrintString), ": "); Q_strcat(szPrintString, sizeof(szPrintString), ": ");
Q_strcat(szPrintString, sizeof(szPrintString), gi.LV_ConvertString(pTmpInstantMsg)); Q_strcat(szPrintString, sizeof(szPrintString), gi.LV_ConvertString(pTmpInstantMsg));
} else { } else {
bool met_comment; bool met_comment = false;
Q_strcat(szPrintString, sizeof(szPrintString), ":"); Q_strcat(szPrintString, sizeof(szPrintString), ":");
iStringLength = strlen(szPrintString); iStringLength = strlen(szPrintString);
// Added in OPM.
// Checks for comments in string (as COM_Parse will parse them)
// This was fixed in 2.0 but make the fix compatible with older versions
if (g_protocol < protocol_e::PROTOCOL_MOHTA_MIN && strstr(client->pers.netname, "/*")) {
met_comment = true;
}
for (i = 2; i <= ev->NumArgs(); i++) { for (i = 2; i <= ev->NumArgs(); i++) {
sToken = ev->GetString(i); sToken = ev->GetString(i);
// Added in 2.40 // Added in 2.40
@ -10759,13 +10838,7 @@ void Player::EventDMMessage(Event *ev)
break; break;
} }
// Added in OPM. if (met_comment && strstr(sToken, "*/")) {
// Checks for comments in string (as COM_Parse will parse them)
if (strstr(sToken, "/*")) {
met_comment = true;
}
if (strstr(sToken, "*/") && met_comment) {
// ignore messages containing comments // ignore messages containing comments
return; return;
} }
@ -10778,9 +10851,11 @@ void Player::EventDMMessage(Event *ev)
Q_strcat(szPrintString, sizeof(szPrintString), "\n"); Q_strcat(szPrintString, sizeof(szPrintString), "\n");
// ignore names containing comments // ignore names containing comments
if (strstr(client->pers.netname, "//") if (g_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|| (strstr(client->pers.netname, "/*") && strstr(client->pers.netname, "*/"))) { if (strstr(client->pers.netname, "//")
return; || (strstr(client->pers.netname, "/*") && strstr(client->pers.netname, "*/"))) {
return;
}
} }
// //
@ -10804,7 +10879,15 @@ void Player::EventDMMessage(Event *ev)
// //
// Added in OPM // Added in OPM
gi.Printf("%s (%zu) says to everyone: %s\n", client->pers.netname, edict - g_entities, sToken.c_str()); if (bInstaMessage) {
gi.Printf(
"%s (%zu) says (voice) to everyone: %s\n", client->pers.netname, edict - g_entities, pTmpInstantMsg
);
} else {
gi.Printf(
"%s (%zu) says (text) to everyone: %s\n", client->pers.netname, edict - g_entities, sToken.c_str()
);
}
if (!IsSpectator() || g_spectate_allow_full_chat->integer) { if (!IsSpectator() || g_spectate_allow_full_chat->integer) {
for (i = 0; i < game.maxclients; i++) { for (i = 0; i < game.maxclients; i++) {
@ -10846,13 +10929,26 @@ void Player::EventDMMessage(Event *ev)
gi.SendServerCommand(i, "%s", szPrintString); gi.SendServerCommand(i, "%s", szPrintString);
} }
} }
if (!bInstaMessage) {
Event event;
// sent to everyone (not a team)
event.AddString(sToken);
event.AddInteger(false);
scriptDelegate_textMessage.Trigger(this, event);
}
} else if (iMode < 0) { } else if (iMode < 0) {
// //
// team message // team message
// //
// Added in OPM // Added in OPM
gi.Printf("%s (%zu) says to team: %s\n", client->pers.netname, edict - g_entities, sToken.c_str()); if (bInstaMessage) {
gi.Printf("%s (%zu) says (voice) to team: %s\n", client->pers.netname, edict - g_entities, pTmpInstantMsg);
} else {
gi.Printf("%s (%zu) says (text) to team: %s\n", client->pers.netname, edict - g_entities, sToken.c_str());
}
if (IsSpectator()) { if (IsSpectator()) {
for (i = 0; i < game.maxclients; i++) { for (i = 0; i < game.maxclients; i++) {
@ -10878,7 +10974,7 @@ void Player::EventDMMessage(Event *ev)
continue; continue;
} }
bSameTeam = static_cast<Player*>(ent->entity)->GetTeam() == GetTeam(); bSameTeam = static_cast<Player *>(ent->entity)->GetTeam() == GetTeam();
if (bSameTeam) { if (bSameTeam) {
gi.SendServerCommand(i, "%s", szPrintString); gi.SendServerCommand(i, "%s", szPrintString);
} }
@ -10896,6 +10992,15 @@ void Player::EventDMMessage(Event *ev)
} }
} }
} }
if (!bInstaMessage) {
Event event;
// sent to team
event.AddString(sToken);
event.AddInteger(true);
scriptDelegate_textMessage.Trigger(this, event);
}
} else if (iMode <= game.maxclients) { } else if (iMode <= game.maxclients) {
ent = &g_entities[iMode - 1]; ent = &g_entities[iMode - 1];
@ -10914,7 +11019,23 @@ void Player::EventDMMessage(Event *ev)
} }
// Added in OPM // Added in OPM
gi.Printf("%s (%zu) says to client #%d: %s\n", client->pers.netname, edict - g_entities, iMode - 1, sToken.c_str()); if (bInstaMessage) {
gi.Printf(
"%s (%zu) says (voice) to client #%d: %s\n",
client->pers.netname,
edict - g_entities,
iMode - 1,
pTmpInstantMsg
);
} else {
gi.Printf(
"%s (%zu) says (text) to client #%d: %s\n",
client->pers.netname,
edict - g_entities,
iMode - 1,
sToken.c_str()
);
}
gi.SendServerCommand(iMode - 1, "%s", szPrintString); gi.SendServerCommand(iMode - 1, "%s", szPrintString);
@ -11227,17 +11348,21 @@ str Player::TranslateBattleLanguageTokens(const char *string)
void Player::EventIPrint(Event *ev) void Player::EventIPrint(Event *ev)
{ {
str sString = ev->GetString(1); str sString = ev->GetString(1);
qboolean iBold = qfalse; qboolean iBold = qfalse;
if (ev->NumArgs() > 1) { if (ev->NumArgs() > 1) {
iBold = ev->GetInteger(2); iBold = ev->GetInteger(2);
} }
if (iBold) { if (iBold) {
gi.SendServerCommand(edict - g_entities, "print \"" HUD_MESSAGE_WHITE "%s\n\"", gi.LV_ConvertString(sString.c_str())); gi.SendServerCommand(
edict - g_entities, "print \"" HUD_MESSAGE_WHITE "%s\n\"", gi.LV_ConvertString(sString.c_str())
);
} else { } else {
gi.SendServerCommand(edict - g_entities, "print \"" HUD_MESSAGE_YELLOW "%s\n\"", gi.LV_ConvertString(sString.c_str())); gi.SendServerCommand(
edict - g_entities, "print \"" HUD_MESSAGE_YELLOW "%s\n\"", gi.LV_ConvertString(sString.c_str())
);
} }
} }
@ -11531,13 +11656,15 @@ qboolean Player::CheckCanSwitchTeam(teamtype_t team)
} }
if (pNewTeam->m_players.NumObjects() > numTeamPlayers) { if (pNewTeam->m_players.NumObjects() > numTeamPlayers) {
gi.SendServerCommand( const char *message = gi.LV_ConvertString(
edict - g_entities, "That team has enough players. Choose the team that has the lowest number of players."
"print \"" HUD_MESSAGE_WHITE "%s\n\"",
gi.LV_ConvertString(
"That team has enough players. Choose the team that has the lowest number of players."
)
); );
gi.SendServerCommand(
edict - g_entities, "print \"" HUD_MESSAGE_WHITE "%s\n\"", gi.LV_ConvertString(message)
);
gi.centerprintf(edict, message);
return qfalse; return qfalse;
} }
} }
@ -12017,8 +12144,9 @@ bool Player::IsReady(void) const
void Player::Spawned(void) void Player::Spawned(void)
{ {
Event *ev = new Event; Event *ev = new Event;
ev->AddEntity(this); ev->AddEntity(this);
scriptDelegate_spawned.Trigger(this, *ev);
scriptedEvents[SE_SPAWN].Trigger(ev); scriptedEvents[SE_SPAWN].Trigger(ev);
} }

View file

@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "actor.h" #include "actor.h"
#include "vehicle.h" #include "vehicle.h"
#include "dm_manager.h" #include "dm_manager.h"
#include "scriptdelegate.h"
extern Event EV_Player_EndLevel; extern Event EV_Player_EndLevel;
extern Event EV_Player_GiveCheat; extern Event EV_Player_GiveCheat;
@ -310,6 +311,16 @@ private:
bool m_bShowingHint; bool m_bShowingHint;
#endif #endif
public:
MulticastDelegate<void(const str& text)> delegate_stufftext;
static ScriptDelegate scriptDelegate_connected;
static ScriptDelegate scriptDelegate_disconnecting;
static ScriptDelegate scriptDelegate_spawned;
static ScriptDelegate scriptDelegate_damage;
static ScriptDelegate scriptDelegate_kill;
static ScriptDelegate scriptDelegate_textMessage;
public: public:
int m_iNumObjectives; int m_iNumObjectives;
int m_iObjectivesCompleted; int m_iObjectivesCompleted;

View file

@ -61,13 +61,17 @@ void Player::SetPartAnim(const char *anim, bodypart_t slot)
{ {
int animnum; int animnum;
if (getMoveType() == MOVETYPE_NOCLIP && slot) { if (getMoveType() == MOVETYPE_NOCLIP) {
StopPartAnimating(torso); if (slot) {
return; StopPartAnimating(torso);
return;
}
anim = "idle";
} }
animnum = gi.Anim_NumForName(edict->tiki, anim); animnum = gi.Anim_NumForName(edict->tiki, anim);
if (animnum == CurrentAnim() && partAnim[slot] == anim) { if (animnum == CurrentAnim(m_iPartSlot[slot]) && partAnim[slot] == anim) {
return; return;
} }
@ -89,21 +93,19 @@ void Player::SetPartAnim(const char *anim, bodypart_t slot)
if (m_fPartBlends[slot] < 0.5f) { if (m_fPartBlends[slot] < 0.5f) {
SetAnimDoneEvent(NULL, m_iPartSlot[slot]); SetAnimDoneEvent(NULL, m_iPartSlot[slot]);
float m_fCrossTime = gi.Anim_CrossTime(edict->tiki, animnum); partBlendMult[slot] = gi.Anim_CrossTime(edict->tiki, animnum);
if (partBlendMult[slot] > 0.0f) {
partBlendMult[slot] = m_fCrossTime;
if (m_fCrossTime <= 0.0f) {
partOldAnim[slot] = "";
m_fPartBlends[slot] = 0.0f;
} else {
m_iPartSlot[slot] ^= 1; m_iPartSlot[slot] ^= 1;
partBlendMult[slot] = 1.0f / m_fCrossTime; partBlendMult[slot] = 1.0f / partBlendMult[slot];
partOldAnim[slot] = partAnim[slot]; partOldAnim[slot] = partAnim[slot];
m_fPartBlends[slot] = 1.0f; m_fPartBlends[slot] = 1.0f;
} else {
partOldAnim[slot] = "";
m_fPartBlends[slot] = 0.0f;
} }
} }
if (slot) { if (slot != legs) {
animdone_Torso = false; animdone_Torso = false;
} else { } else {
animdone_Legs = false; animdone_Legs = false;
@ -113,7 +115,7 @@ void Player::SetPartAnim(const char *anim, bodypart_t slot)
partAnim[slot] = anim; partAnim[slot] = anim;
if (slot) { if (slot != legs) {
NewAnim(animnum, EV_Player_AnimLoop_Torso, m_iPartSlot[slot]); NewAnim(animnum, EV_Player_AnimLoop_Torso, m_iPartSlot[slot]);
} else { } else {
NewAnim(animnum, EV_Player_AnimLoop_Legs, m_iPartSlot[legs]); NewAnim(animnum, EV_Player_AnimLoop_Legs, m_iPartSlot[legs]);
@ -143,7 +145,7 @@ void Player::StopPartAnimating(bodypart_t part)
StopAnimating(m_iPartSlot[part]); StopAnimating(m_iPartSlot[part]);
if (part) { if (part != legs) {
animdone_Torso = false; animdone_Torso = false;
} else { } else {
animdone_Legs = false; animdone_Legs = false;
@ -158,7 +160,7 @@ void Player::PausePartAnim(bodypart_t part)
int Player::CurrentPartAnim(bodypart_t part) const int Player::CurrentPartAnim(bodypart_t part) const
{ {
if (!*partAnim[part]) { if (partAnim[part] == "") {
return -1; return -1;
} }
@ -400,8 +402,8 @@ void Player::AdjustAnimBlends(void)
fWeightTotal += m_fPartBlends[torso]; fWeightTotal += m_fPartBlends[torso];
} }
if (partAnim[torso] != "") { if (partAnim[torso] != "") {
SetWeight(iPartSlot, m_fPartBlends[torso]); SetWeight(iPartSlot, 1.0 - m_fPartBlends[torso]);
fWeightTotal += 1.0f - m_fPartBlends[torso]; fWeightTotal += 1.0 - m_fPartBlends[torso];
} }
edict->s.actionWeight = fWeightTotal; edict->s.actionWeight = fWeightTotal;

View file

@ -76,6 +76,15 @@ BotController::BotController()
m_RunLabel.TrySetScript("global/bot_run.scr"); m_RunLabel.TrySetScript("global/bot_run.scr");
} }
BotController::~BotController()
{
if (controlledEnt) {
controlledEnt->delegate_gotKill.Remove(delegateHandle_gotKill);
controlledEnt->delegate_killed.Remove(delegateHandle_killed);
controlledEnt->delegate_stufftext.Remove(delegateHandle_stufftext);
}
}
BotMovement& BotController::GetMovement() BotMovement& BotController::GetMovement()
{ {
return movement; return movement;
@ -1051,7 +1060,7 @@ void BotController::Think()
G_ClientThink(controlledEnt->edict, &ucmd, &eyeinfo); G_ClientThink(controlledEnt->edict, &ucmd, &eyeinfo);
} }
void BotController::Killed(Event *ev) void BotController::Killed(const Event& ev)
{ {
Entity *attacker; Entity *attacker;
@ -1068,7 +1077,7 @@ void BotController::Killed(Event *ev)
m_botEyes.angles[0] = 0; m_botEyes.angles[0] = 0;
m_botEyes.angles[1] = 0; m_botEyes.angles[1] = 0;
attacker = ev->GetEntity(1); attacker = ev.GetEntity(1);
if (attacker && rand() % 5 == 0) { if (attacker && rand() % 5 == 0) {
// 1/5 chance to go back to the attacker position // 1/5 chance to go back to the attacker position
@ -1093,7 +1102,7 @@ void BotController::Killed(Event *ev)
G_ClientUserinfoChanged(controlledEnt->edict, controlledEnt->client->pers.userinfo); G_ClientUserinfoChanged(controlledEnt->edict, controlledEnt->client->pers.userinfo);
} }
void BotController::GotKill(Event *ev) void BotController::GotKill(const Event& ev)
{ {
ClearEnemy(); ClearEnemy();
m_iCuriousTime = 0; m_iCuriousTime = 0;
@ -1118,9 +1127,9 @@ void BotController::GotKill(Event *ev)
} }
} }
void BotController::EventStuffText(Event *ev) void BotController::EventStuffText(const str& text)
{ {
SendCommand(ev->GetString(1)); SendCommand(text);
} }
void BotController::setControlledEntity(Player *player) void BotController::setControlledEntity(Player *player)
@ -1128,6 +1137,10 @@ void BotController::setControlledEntity(Player *player)
controlledEnt = player; controlledEnt = player;
movement.SetControlledEntity(player); movement.SetControlledEntity(player);
rotation.SetControlledEntity(player); rotation.SetControlledEntity(player);
delegateHandle_gotKill = player->delegate_gotKill.Add(std::bind(&BotController::GotKill, this, std::placeholders::_1));
delegateHandle_killed = player->delegate_killed.Add(std::bind(&BotController::Killed, this, std::placeholders::_1));
delegateHandle_stufftext = player->delegate_stufftext.Add(std::bind(&BotController::EventStuffText, this, std::placeholders::_1));
} }
Player *BotController::getControlledEntity() const Player *BotController::getControlledEntity() const
@ -1198,47 +1211,21 @@ void BotControllerManager::ThinkControllers()
{ {
int i; int i;
// Delete controllers that don't have associated player entity
// This cannot happen unless some mods remove them
for (i = controllers.NumObjects(); i > 0; i--) {
BotController* controller = controllers.ObjectAt(i);
if (!controller->getControlledEntity()) {
gi.DPrintf("Bot %d has no associated player entity. This shouldn't happen unless the entity has been removed by a script. The controller will be removed, please fix.\n", i);
// Remove the controller, it will be recreated later to match `sv_numbots`
delete controller;
controllers.RemoveObjectAt(i);
}
}
for (i = 1; i <= controllers.NumObjects(); i++) { for (i = 1; i <= controllers.NumObjects(); i++) {
BotController *controller = controllers.ObjectAt(i); BotController *controller = controllers.ObjectAt(i);
controller->Think(); controller->Think();
} }
} }
CLASS_DECLARATION(Player, PlayerBot, NULL) {
{&EV_Killed, &PlayerBot::Killed },
{&EV_GotKill, &PlayerBot::GotKill },
{&EV_Player_StuffText, &PlayerBot::EventStuffText},
{NULL, NULL }
};
PlayerBot::PlayerBot()
{
entflags |= ECF_BOT;
controller = NULL;
}
void PlayerBot::setController(BotController *controlledBy)
{
controller = controlledBy;
}
void PlayerBot::Spawned(void)
{
controller->Spawned();
Player::Spawned();
}
void PlayerBot::Killed(Event *ev)
{
Player::Killed(ev);
controller->Killed(ev);
}
void PlayerBot::GotKill(Event *ev)
{
Player::GotKill(ev);
controller->GotKill(ev);
}

View file

@ -160,6 +160,11 @@ private:
// Taunts // Taunts
int m_iNextTauntTime; int m_iNextTauntTime;
private:
DelegateHandle delegateHandle_gotKill;
DelegateHandle delegateHandle_killed;
DelegateHandle delegateHandle_stufftext;
private: private:
Weapon* FindWeaponWithAmmo(void); Weapon* FindWeaponWithAmmo(void);
Weapon* FindMeleeWeapon(void); Weapon* FindMeleeWeapon(void);
@ -209,6 +214,7 @@ public:
CLASS_PROTOTYPE(BotController); CLASS_PROTOTYPE(BotController);
BotController(); BotController();
~BotController();
static void Init(void); static void Init(void);
@ -229,9 +235,9 @@ public:
void Spawned(void); void Spawned(void);
void Killed(Event *ev); void Killed(const Event& ev);
void GotKill(Event *ev); void GotKill(const Event& ev);
void EventStuffText(Event *ev); void EventStuffText(const str& text);
BotMovement& GetMovement(); BotMovement& GetMovement();
@ -282,22 +288,3 @@ private:
}; };
extern BotManager botManager; extern BotManager botManager;
class PlayerBot : public Player
{
public:
CLASS_PROTOTYPE(PlayerBot);
public:
PlayerBot();
void setController(BotController *controlledBy);
void Spawned(void) override;
void Killed(Event *ev) override;
void GotKill(Event *ev);
private:
BotController *controller;
};

View file

@ -0,0 +1,28 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "g_local.h"
#include "playerbot_strategy.h"
CLASS_DECLARATION(SimpleEntity, NavigationPoint, NULL) {
{NULL, NULL}
};

View file

@ -0,0 +1,37 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// playerbot_strategy.h: Bot strategy & navigation points
#pragma once
#include "simpleentity.h"
//
// Abstract class for navigation points
//
class NavigationPoint : public SimpleEntity
{
public:
CLASS_PROTOTYPE(NavigationPoint);
// TODO
};

View file

@ -0,0 +1,190 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "scriptdelegate.h"
#include "../script/scriptexception.h"
ScriptDelegate *ScriptDelegate::root = NULL;
ScriptRegisteredDelegate_Script::ScriptRegisteredDelegate_Script(const ScriptThreadLabel& inLabel)
: label(inLabel)
{}
void ScriptRegisteredDelegate_Script::Execute(Listener *object, const Event& ev)
{
Event newev = ev;
label.Execute(object, newev);
}
bool ScriptRegisteredDelegate_Script::operator==(const ScriptRegisteredDelegate_Script& registeredDelegate) const
{
return label == registeredDelegate.label;
}
ScriptRegisteredDelegate_CodeMember::ScriptRegisteredDelegate_CodeMember(
Class *inObject, DelegateClassResponse inResponse
)
: object(inObject)
, response(inResponse)
{}
void ScriptRegisteredDelegate_CodeMember::Execute(Listener *object, const Event& ev)
{
if (!object) {
return;
}
(object->*response)(object, ev);
}
bool ScriptRegisteredDelegate_CodeMember::operator==(const ScriptRegisteredDelegate_CodeMember& registeredDelegate
) const
{
return object == registeredDelegate.object && response == registeredDelegate.response;
}
ScriptRegisteredDelegate_Code::ScriptRegisteredDelegate_Code(DelegateResponse inResponse)
: response(inResponse)
{}
void ScriptRegisteredDelegate_Code::Execute(Listener *object, const Event& ev)
{
(*response)(object, ev);
}
bool ScriptRegisteredDelegate_Code::operator==(const ScriptRegisteredDelegate_Code& registeredDelegate) const
{
return response == registeredDelegate.response;
}
ScriptDelegate::ScriptDelegate(const char *inName, const char *inDescription)
: name(inName)
, description(inDescription)
{
LL_SafeAddFirst(root, this, next, prev);
}
ScriptDelegate::~ScriptDelegate()
{
LL_SafeRemoveRoot(root, this, next, prev);
}
const ScriptDelegate *ScriptDelegate::GetRoot()
{
return root;
}
const ScriptDelegate *ScriptDelegate::GetNext() const
{
return next;
}
void ScriptDelegate::Register(const ScriptThreadLabel& label)
{
if (!label.IsSet()) {
ScriptError("Invalid label specified for the script delegate");
}
list_script.AddUniqueObject(label);
}
void ScriptDelegate::Unregister(const ScriptThreadLabel& label)
{
list_script.RemoveObject(label);
}
void ScriptDelegate::Register(ScriptRegisteredDelegate_Code::DelegateResponse response)
{
list_code.AddUniqueObject(ScriptRegisteredDelegate_Code(response));
}
void ScriptDelegate::Unregister(ScriptRegisteredDelegate_Code::DelegateResponse response)
{
list_code.RemoveObject(response);
}
void ScriptDelegate::Register(Class *object, ScriptRegisteredDelegate_CodeMember::DelegateClassResponse response)
{
list_codeMember.AddUniqueObject(ScriptRegisteredDelegate_CodeMember(object, response));
}
void ScriptDelegate::Unregister(Class *object, ScriptRegisteredDelegate_CodeMember::DelegateClassResponse response)
{
list_codeMember.RemoveObject(ScriptRegisteredDelegate_CodeMember(object, response));
}
void ScriptDelegate::Trigger(const Event& ev) const
{
Trigger(NULL, ev);
}
void ScriptDelegate::Trigger(Listener *object, const Event& ev) const
{
size_t i;
{
const Container<ScriptRegisteredDelegate_Script> tmpList = list_script;
for (i = 1; i <= tmpList.NumObjects(); i++) {
tmpList.ObjectAt(i).Execute(object, ev);
}
}
{
const Container<ScriptRegisteredDelegate_Code> tmpList = list_code;
for (i = 1; i <= tmpList.NumObjects(); i++) {
tmpList.ObjectAt(i).Execute(object, ev);
}
}
{
const Container<ScriptRegisteredDelegate_CodeMember> tmpList = list_codeMember;
for (i = 1; i <= tmpList.NumObjects(); i++) {
tmpList.ObjectAt(i).Execute(object, ev);
}
}
}
ScriptDelegate *ScriptDelegate::GetScriptDelegate(const char *name)
{
for (ScriptDelegate *delegate = root; delegate; delegate = delegate->next) {
if (!Q_stricmp(delegate->name, name)) {
return delegate;
}
}
return NULL;
}
void ScriptDelegate::Reset()
{
list_script.FreeObjectList();
list_code.FreeObjectList();
list_codeMember.FreeObjectList();
}
void ScriptDelegate::ResetAllDelegates()
{
for (ScriptDelegate *delegate = root; delegate; delegate = delegate->next) {
delegate->Reset();
}
}

196
code/fgame/scriptdelegate.h Normal file
View file

@ -0,0 +1,196 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// scriptdelegate -- manages function delegate
#include "../qcommon/listener.h"
#include "../qcommon/delegate.h"
#include "gamescript.h"
class ScriptRegisteredDelegate
{
public:
void Execute(Listener *object, const Event& ev);
};
/**
* Registered delegate, for scripts.
* It contains a ScriptThreadLabel with the game script and the label to execute.
*/
class ScriptRegisteredDelegate_Script : public ScriptRegisteredDelegate
{
public:
ScriptRegisteredDelegate_Script(const ScriptThreadLabel& inLabel);
void Execute(Listener *object, const Event& ev);
bool operator==(const ScriptRegisteredDelegate_Script& registeredDelegate) const;
private:
ScriptThreadLabel label;
};
/**
* Registered delegate, for code use.
* It contains the function to execute.
*/
class ScriptRegisteredDelegate_Code : public ScriptRegisteredDelegate
{
public:
using DelegateResponse = void (*)(Listener *object, const Event& ev);
public:
ScriptRegisteredDelegate_Code(DelegateResponse inResponse);
void Execute(Listener *object, const Event& ev);
bool operator==(const ScriptRegisteredDelegate_Code& registeredDelegate) const;
private:
DelegateResponse response;
};
/**
* Registered delegate, for code use.
* It contains the object along the member function to execute.
* The function will not be executed if the object is NULL.
*/
class ScriptRegisteredDelegate_CodeMember : public ScriptRegisteredDelegate
{
public:
using DelegateClassResponse = void (Class::*)(Listener *object, const Event& ev);
public:
ScriptRegisteredDelegate_CodeMember(Class *inObject, DelegateClassResponse inResponse);
void Execute(Listener *object, const Event& ev);
bool operator==(const ScriptRegisteredDelegate_CodeMember& registeredDelegate) const;
private:
SafePtr<Class> object;
DelegateClassResponse response;
};
/**
* A script delegate provides a way for code to subscribe for events.
* Scripts and code can register for a delegate and have their function executed
* when the delegate gets triggered.
*/
class ScriptDelegate
{
public:
ScriptDelegate(const char *name, const char *description);
~ScriptDelegate();
static const ScriptDelegate *GetRoot();
const ScriptDelegate *GetNext() const;
/**
* Register a script label.
*
* @param label The label to be executed
*/
void Register(const ScriptThreadLabel& label);
/**
* Unregistered the label.
*
* @param label The label to unregister
*/
void Unregister(const ScriptThreadLabel& label);
/**
* Register a function.
*
* @param response The function to be executed
*/
void Register(ScriptRegisteredDelegate_Code::DelegateResponse response);
/**
* Unregistered the function.
*
* @param response the function to unregister
*/
void Unregister(ScriptRegisteredDelegate_Code::DelegateResponse response);
/**
* Register with an object and a member function.
*
* @param object The object to notify
* @param response The member function of the object to be executed
*/
void Register(Class *object, ScriptRegisteredDelegate_CodeMember::DelegateClassResponse response);
/**
* Unregistered the member function.
*
* @param object The object where the member function is
* @param response The member function to unregister
*/
void Unregister(Class *object, ScriptRegisteredDelegate_CodeMember::DelegateClassResponse response);
/**
* Executes all registered delegates with the specified event.
*
* @param ev Parameter list
*/
void Trigger(const Event& ev = Event()) const;
/**
* Executes all registered delegates with the specified event.
*
* @param ev Parameter list
*/
void Trigger(Listener *object, const Event& ev = Event()) const;
/**
* Reset the delegate, unregister callbacks.
*/
void Reset();
/**
* Search and return the specified script delegate by name.
*
* @param name The name to search for
*/
static ScriptDelegate *GetScriptDelegate(const char *name);
static void ResetAllDelegates();
// non-movable and non-copyable
ScriptDelegate(ScriptDelegate&& other) = delete;
ScriptDelegate& operator=(ScriptDelegate&& other) = delete;
ScriptDelegate(const ScriptDelegate& other) = delete;
ScriptDelegate& operator=(const ScriptDelegate& other) = delete;
private:
// Linked-list
ScriptDelegate *next;
ScriptDelegate *prev;
static ScriptDelegate *root;
const char *name;
const char *description;
Container<ScriptRegisteredDelegate_Script> list_script;
Container<ScriptRegisteredDelegate_Code> list_code;
Container<ScriptRegisteredDelegate_CodeMember> list_codeMember;
};

View file

@ -766,6 +766,8 @@ void ScriptMaster::Reset(qboolean samemap)
StringDict.clear(); StringDict.clear();
InitConstStrings(); InitConstStrings();
} }
ScriptDelegate::ResetAllDelegates();
} }
void ScriptMaster::ExecuteRunning(void) void ScriptMaster::ExecuteRunning(void)

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -69,6 +69,22 @@ Event EV_ScriptSlave_WaitMove
"Move the script slave and wait until finished.", "Move the script slave and wait until finished.",
EV_NORMAL EV_NORMAL
); );
Event EV_ScriptSlave_Stop
(
"stop",
EV_DEFAULT,
NULL,
NULL,
"Stop the script slave."
);
Event EV_ScriptSlave_ThreadMove
(
"threadmove",
EV_DEFAULT,
"s",
"label",
"Move the script slave and create thread which waits until finished."
);
Event EV_ScriptSlave_Angles Event EV_ScriptSlave_Angles
( (
"angles", "angles",
@ -222,6 +238,15 @@ Event EV_ScriptSlave_MoveRight
"Move the position right.", "Move the position right.",
EV_NORMAL EV_NORMAL
); );
Event EV_ScriptSlave_MoveOffset
(
"moveOffset",
EV_DEFAULT,
"v",
"dist",
"Move the position by the offset vector.",
EV_NORMAL
);
Event EV_ScriptSlave_RotateXDownTo Event EV_ScriptSlave_RotateXDownTo
( (
"rotateXdownto", "rotateXdownto",
@ -609,6 +634,8 @@ CLASS_DECLARATION(Mover, ScriptSlave, "script_object") {
{&EV_Unbind, &ScriptSlave::EventUnbind }, {&EV_Unbind, &ScriptSlave::EventUnbind },
{&EV_ScriptSlave_DoMove, &ScriptSlave::DoMove }, {&EV_ScriptSlave_DoMove, &ScriptSlave::DoMove },
{&EV_ScriptSlave_WaitMove, &ScriptSlave::WaitMove }, {&EV_ScriptSlave_WaitMove, &ScriptSlave::WaitMove },
{&EV_ScriptSlave_Stop, &ScriptSlave::Stop },
{&EV_ScriptSlave_ThreadMove, &ScriptSlave::ThreadMove },
{&EV_ScriptSlave_Angles, &ScriptSlave::SetAnglesEvent }, {&EV_ScriptSlave_Angles, &ScriptSlave::SetAnglesEvent },
{&EV_SetAngle, &ScriptSlave::SetAngleEvent }, {&EV_SetAngle, &ScriptSlave::SetAngleEvent },
{&EV_Model, &ScriptSlave::SetModelEvent }, {&EV_Model, &ScriptSlave::SetModelEvent },
@ -628,6 +655,7 @@ CLASS_DECLARATION(Mover, ScriptSlave, "script_object") {
{&EV_ScriptSlave_MoveBackward, &ScriptSlave::MoveBackward }, {&EV_ScriptSlave_MoveBackward, &ScriptSlave::MoveBackward },
{&EV_ScriptSlave_MoveLeft, &ScriptSlave::MoveLeft }, {&EV_ScriptSlave_MoveLeft, &ScriptSlave::MoveLeft },
{&EV_ScriptSlave_MoveRight, &ScriptSlave::MoveRight }, {&EV_ScriptSlave_MoveRight, &ScriptSlave::MoveRight },
{&EV_ScriptSlave_MoveOffset, &ScriptSlave::MoveOffset },
{&EV_ScriptSlave_RotateXDownTo, &ScriptSlave::RotateXdownto }, {&EV_ScriptSlave_RotateXDownTo, &ScriptSlave::RotateXdownto },
{&EV_ScriptSlave_RotateYDownTo, &ScriptSlave::RotateYdownto }, {&EV_ScriptSlave_RotateYDownTo, &ScriptSlave::RotateYdownto },
{&EV_ScriptSlave_RotateZDownTo, &ScriptSlave::RotateZdownto }, {&EV_ScriptSlave_RotateZDownTo, &ScriptSlave::RotateZdownto },
@ -818,6 +846,24 @@ void ScriptSlave::WaitMove(Event *ev)
Register(0, Director.CurrentScriptThread()); Register(0, Director.CurrentScriptThread());
} }
void ScriptSlave::Stop(Event *ev)
{
commandswaiting = false;
if (RegisterSize(0)) {
Event newev(EV_DelayThrow);
newev.AddConstString(STRING_FAIL);
BroadcastEvent(0, newev);
}
Mover::Stop();
}
void ScriptSlave::ThreadMove(Event *ev)
{
NewMove();
Register(0, CreateThreadInternal(ev->GetValue(1)));
}
void ScriptSlave::MoveEnd(Event *ev) void ScriptSlave::MoveEnd(Event *ev)
{ {
Unregister(0); Unregister(0);
@ -1082,6 +1128,12 @@ void ScriptSlave::MoveRight(Event *ev)
NewPos -= v * ev->GetFloat(1); NewPos -= v * ev->GetFloat(1);
} }
void ScriptSlave::MoveOffset(Event *ev)
{
CheckNewOrders();
NewPos += ev->GetVector(1);
}
// exact rotate commands // exact rotate commands
void ScriptSlave::RotateXdownto(Event *ev) void ScriptSlave::RotateXdownto(Event *ev)

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 the OpenMoHAA team Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -93,6 +93,8 @@ protected:
void EventUnbind(Event *ev); void EventUnbind(Event *ev);
void DoMove(Event *ev); void DoMove(Event *ev);
void WaitMove(Event *ev); void WaitMove(Event *ev);
void Stop(Event *ev);
void ThreadMove(Event *ev);
void MoveEnd(Event *ev); void MoveEnd(Event *ev);
void SetAnglesEvent(Event *ev); void SetAnglesEvent(Event *ev);
void SetAngleEvent(Event *ev); void SetAngleEvent(Event *ev);
@ -113,6 +115,7 @@ protected:
void MoveBackward(Event *ev); void MoveBackward(Event *ev);
void MoveLeft(Event *ev); void MoveLeft(Event *ev);
void MoveRight(Event *ev); void MoveRight(Event *ev);
void MoveOffset(Event *ev);
void RotateXdownto(Event *ev); void RotateXdownto(Event *ev);
void RotateYdownto(Event *ev); void RotateYdownto(Event *ev);
void RotateZdownto(Event *ev); void RotateZdownto(Event *ev);

View file

@ -1676,6 +1676,24 @@ Event EV_ScriptThread_UnregisterEv
"Unregisters script callback handler for specified event", "Unregisters script callback handler for specified event",
EV_RETURN EV_RETURN
); );
Event EV_ScriptThread_Event_Subscribe
(
"event_subscribe",
EV_DEFAULT,
"ss",
"eventname script",
"Subscribe to the specified event. The specified script will be executed when the event gets triggered.",
EV_NORMAL
);
Event EV_ScriptThread_Event_Unsubscribe
(
"event_unsubscribe",
EV_DEFAULT,
"ss",
"eventname script",
"Unsubscribe the script from the specified event.",
EV_NORMAL
);
Event EV_ScriptThread_Conprintf Event EV_ScriptThread_Conprintf
( (
"conprintf", "conprintf",
@ -1981,6 +1999,15 @@ Event EV_ScriptThread_Md5String
"generates MD5 hash of given text", "generates MD5 hash of given text",
EV_RETURN EV_RETURN
); );
Event EV_ScriptThread_GetEntity
(
"getentity",
EV_CHEAT,
"i",
"ent_num",
"Gets the specified entity",
EV_RETURN
);
Event EV_ScriptThread_SetTimer Event EV_ScriptThread_SetTimer
( (
"settimer", "settimer",
@ -2027,6 +2054,15 @@ Event EV_ScriptThread_VisionSetNaked
"empty string, it will be set to the current map's name.", "empty string, it will be set to the current map's name.",
EV_NORMAL EV_NORMAL
); );
Event EV_ScriptThread_IsBot
(
"isBot",
EV_DEFAULT,
"e",
"entity",
"Returns 1 if the client is a bot, 0 otherwise. Will return 0 if the entity is not a client.",
EV_RETURN
);
CLASS_DECLARATION(Listener, ScriptThread, NULL) { CLASS_DECLARATION(Listener, ScriptThread, NULL) {
{&EV_ScriptThread_GetCvar, &ScriptThread::Getcvar }, {&EV_ScriptThread_GetCvar, &ScriptThread::Getcvar },
@ -2180,9 +2216,12 @@ CLASS_DECLARATION(Listener, ScriptThread, NULL) {
{&EV_ScriptThread_GetTanH, &ScriptThread::EventTanH }, {&EV_ScriptThread_GetTanH, &ScriptThread::EventTanH },
{&EV_ScriptThread_strncpy, &ScriptThread::StringBytesCopy }, {&EV_ScriptThread_strncpy, &ScriptThread::StringBytesCopy },
{&EV_ScriptThread_Md5String, &ScriptThread::Md5String }, {&EV_ScriptThread_Md5String, &ScriptThread::Md5String },
{&EV_ScriptThread_GetEntity, &ScriptThread::GetEntByEntnum },
{&EV_ScriptThread_TypeOf, &ScriptThread::TypeOfVariable }, {&EV_ScriptThread_TypeOf, &ScriptThread::TypeOfVariable },
{&EV_ScriptThread_RegisterEv, &ScriptThread::RegisterEvent }, {&EV_ScriptThread_RegisterEv, &ScriptThread::RegisterEvent },
{&EV_ScriptThread_UnregisterEv, &ScriptThread::UnregisterEvent }, {&EV_ScriptThread_UnregisterEv, &ScriptThread::UnregisterEvent },
{&EV_ScriptThread_Event_Subscribe, &ScriptThread::SubscribeEvent },
{&EV_ScriptThread_Event_Unsubscribe, &ScriptThread::UnsubscribeEvent },
{&EV_ScriptThread_CancelWaiting, &ScriptThread::CancelWaiting }, {&EV_ScriptThread_CancelWaiting, &ScriptThread::CancelWaiting },
{&EV_ScriptThread_GetTime, &ScriptThread::GetTime }, {&EV_ScriptThread_GetTime, &ScriptThread::GetTime },
{&EV_ScriptThread_GetTimeZone, &ScriptThread::GetTimeZone }, {&EV_ScriptThread_GetTimeZone, &ScriptThread::GetTimeZone },
@ -2253,6 +2292,7 @@ CLASS_DECLARATION(Listener, ScriptThread, NULL) {
{&EV_ScriptThread_TraceDetails, &ScriptThread::TraceDetails }, {&EV_ScriptThread_TraceDetails, &ScriptThread::TraceDetails },
{&EV_ScriptThread_VisionGetNaked, &ScriptThread::VisionGetNaked }, {&EV_ScriptThread_VisionGetNaked, &ScriptThread::VisionGetNaked },
{&EV_ScriptThread_VisionSetNaked, &ScriptThread::VisionSetNaked }, {&EV_ScriptThread_VisionSetNaked, &ScriptThread::VisionSetNaked },
{&EV_ScriptThread_IsBot, &ScriptThread::IsPlayerBot },
{NULL, NULL } {NULL, NULL }
}; };
@ -3042,6 +3082,16 @@ Listener *ScriptThread::SpawnInternal(Event *ev)
throw ScriptException("Usage: spawn entityname [keyname] [value]..."); throw ScriptException("Usage: spawn entityname [keyname] [value]...");
} }
// Fixed in OPM
// The original game uses a raw char* pointer to get the classname rather than storing it in an str.
// This causes an issue when the argument is none (NIL), stringValue() will allocate and return a new str() with "NIL".
// As the returned str() is not stored anywhere, it gets destroyed immediately, meaning that the char* pointer gets empty.
// This has the effect of using empty class ID, which is "Explosion" in original game.
//
// For example, t2l2 has an incorrect "mg42_spawner_gunner" of class PathNode, but PathNode has no model variable.
// global/spawner.scr::spawner_activate:
// - In OG, it will successfully spawn an instance of "Explosion" due to the NIL argument behavior stated above.
// - In OPM, it will not spawn anything and will cause script errors, it's the expected behavior by design
classname = ev->GetString(1); classname = ev->GetString(1);
if (getClassForID(classname) || getClass(classname)) { if (getClassForID(classname) || getClass(classname)) {
@ -5725,7 +5775,7 @@ void ScriptThread::FileExists(Event *ev)
filename = ev->GetString(1); filename = ev->GetString(1);
if (filename == NULL) { if (!filename.length()) {
throw ScriptException("Empty file name passed to fexists!\n"); throw ScriptException("Empty file name passed to fexists!\n");
} }
@ -5804,7 +5854,7 @@ void ScriptThread::FileSaveAll(Event *ev)
text = ev->GetString(2); text = ev->GetString(2);
if (text == NULL) { if (text.length()) {
ev->AddInteger(-1); ev->AddInteger(-1);
throw ScriptException("Text to be written is NULL - fsaveall!\n"); throw ScriptException("Text to be written is NULL - fsaveall!\n");
} }
@ -5828,7 +5878,7 @@ void ScriptThread::FileRemove(Event *ev)
filename = ev->GetString(1); filename = ev->GetString(1);
if (filename == NULL) { if (!filename.length()) {
throw ScriptException("Empty file name passed to fremove!\n"); throw ScriptException("Empty file name passed to fremove!\n");
} }
@ -5938,7 +5988,7 @@ void ScriptThread::FileReadPak(Event *ev)
filename = ev->GetString(1); filename = ev->GetString(1);
if (filename == NULL) { if (!filename.length()) {
throw ScriptException("Filename is NULL - freadpak!\n"); throw ScriptException("Filename is NULL - freadpak!\n");
} }
@ -6013,7 +6063,7 @@ void ScriptThread::FileNewDirectory(Event *ev)
path = ev->GetString(1); path = ev->GetString(1);
if (path == NULL) { if (!path.length()) {
throw ScriptException("Path is NULL - fnewdir!\n"); throw ScriptException("Path is NULL - fnewdir!\n");
} }
@ -6041,7 +6091,7 @@ void ScriptThread::FileRemoveDirectory(Event *ev)
path = ev->GetString(1); path = ev->GetString(1);
if (path == NULL) { if (!path.length()) {
throw ScriptException("Path is NULL - fremovedir!\n"); throw ScriptException("Path is NULL - fremovedir!\n");
} }
@ -6835,6 +6885,8 @@ void ScriptThread::RegisterEvent(Event *ev)
char eventname_full[64]; char eventname_full[64];
scriptedEvType_t evType; scriptedEvType_t evType;
ScriptDeprecatedAltMethod("event_subscribe");
eventname = ev->GetString(1); eventname = ev->GetString(1);
evType = EventNameToType(eventname, eventname_full); evType = EventNameToType(eventname, eventname_full);
@ -6866,6 +6918,8 @@ void ScriptThread::UnregisterEvent(Event *ev)
int numArgs = 0; int numArgs = 0;
scriptedEvType_t evType; scriptedEvType_t evType;
ScriptDeprecatedAltMethod("event_unsubscribe");
eventname = ev->GetString(1); eventname = ev->GetString(1);
evType = EventNameToType(eventname, NULL); evType = EventNameToType(eventname, NULL);
@ -6899,6 +6953,42 @@ void ScriptThread::UnregisterEvent(Event *ev)
ev->AddInteger(0); ev->AddInteger(0);
} }
void ScriptThread::SubscribeEvent(Event *ev)
{
str eventName;
ScriptDelegate *delegate;
ScriptThreadLabel label;
eventName = ev->GetString(1);
delegate = ScriptDelegate::GetScriptDelegate(eventName);
if (!delegate) {
throw ScriptException("Invalid event '%s'", eventName.c_str());
}
label.SetThread(ev->GetValue(2));
delegate->Register(label);
}
void ScriptThread::UnsubscribeEvent(Event *ev)
{
str eventName;
ScriptDelegate *delegate;
ScriptThreadLabel label;
eventName = ev->GetString(1);
delegate = ScriptDelegate::GetScriptDelegate(eventName);
if (!delegate) {
throw ScriptException("Invalid event '%s'", eventName.c_str());
}
label.SetThread(ev->GetValue(2));
delegate->Unregister(label);
}
void ScriptThread::TypeOfVariable(Event *ev) void ScriptThread::TypeOfVariable(Event *ev)
{ {
int numArgs = 0; int numArgs = 0;
@ -7067,6 +7157,25 @@ void ScriptThread::TraceDetails(Event *ev)
ev->AddValue(array); ev->AddValue(array);
} }
void ScriptThread::IsPlayerBot(Event *ev)
{
Entity *e = ev->GetEntity(1);
if (!e || !e->client) {
// Invalid entity or not a client
ev->AddInteger(0);
return;
}
if (!(e->edict->r.svFlags & SVF_BOT)) {
ev->AddInteger(0);
return;
}
// has SVF_BOT server flag
ev->AddInteger(1);
}
CLASS_DECLARATION(Listener, OSFile, NULL) { CLASS_DECLARATION(Listener, OSFile, NULL) {
{NULL, NULL} {NULL, NULL}
}; };

View file

@ -345,6 +345,10 @@ public:
void UnregisterEvent(Event *ev); void UnregisterEvent(Event *ev);
void VisionGetNaked(Event *ev); void VisionGetNaked(Event *ev);
void VisionSetNaked(Event *ev); void VisionSetNaked(Event *ev);
void IsPlayerBot(Event *ev);
void SubscribeEvent(Event *ev);
void UnsubscribeEvent(Event *ev);
}; };
class OSFile : public Listener class OSFile : public Listener

View file

@ -1222,13 +1222,13 @@ Item *Sentient::giveItem(str itemname, int amount)
AddItem(item); AddItem(item);
if (item->isSubclassOf(Weapon)) { if (item->IsSubclassOfWeapon()) {
// Post an event to give the ammo to the sentient // Post an event to give the ammo to the sentient
Event *ev1; Event *ev1;
ev1 = new Event(EV_Weapon_GiveStartingAmmo); ev1 = new Event(EV_Weapon_GiveStartingAmmo);
ev1->AddEntity(this); ev1->AddEntity(this);
item->PostEvent(ev1, 0); item->PostEvent(ev1, level.frametime);
} }
return item; return item;
@ -1368,7 +1368,7 @@ void Sentient::ArmorDamage(Event *ev)
Vector position; Vector position;
Vector normal; Vector normal;
Vector direction; Vector direction;
Event *event; Event event;
int dflags; int dflags;
int meansofdeath; int meansofdeath;
int knockback; int knockback;
@ -1582,50 +1582,56 @@ void Sentient::ArmorDamage(Event *ev)
health = 0; health = 0;
if (attacker) { if (attacker) {
// Added in OPM const EntityPtr attackerPtr = attacker;
event = new Event(EV_GotKill);
event->AddEntity(this);
event->AddInteger(damage);
event->AddEntity(inflictor);
event->AddInteger(meansofdeath);
event->AddInteger(0);
attacker->ProcessEvent(event); // Added in OPM
event = Event(EV_GotKill);
event.AddEntity(this);
event.AddInteger(damage);
event.AddEntity(inflictor);
event.AddInteger(meansofdeath);
event.AddInteger(0);
attackerPtr->ProcessEvent(event);
if (attackerPtr) {
attackerPtr->delegate_gotKill.Execute(event);
}
} }
event = new Event(EV_Killed, 10); event = Event(EV_Killed, 10);
event->AddEntity(attacker); event.AddEntity(attacker);
event->AddFloat(damage); event.AddFloat(damage);
event->AddEntity(inflictor); event.AddEntity(inflictor);
event->AddVector(position); event.AddVector(position);
event->AddVector(direction); event.AddVector(direction);
event->AddVector(normal); event.AddVector(normal);
event->AddInteger(knockback); event.AddInteger(knockback);
event->AddInteger(dflags); event.AddInteger(dflags);
event->AddInteger(meansofdeath); event.AddInteger(meansofdeath);
event->AddInteger(location); event.AddInteger(location);
ProcessEvent(event); ProcessEvent(event);
delegate_killed.Execute(event);
} }
if (health > 0) { if (health > 0) {
// Send pain event // Send pain event
event = new Event(EV_Pain, 10); event = Event(EV_Pain, 10);
event->AddEntity(attacker); event.AddEntity(attacker);
event->AddFloat(damage); event.AddFloat(damage);
event->AddEntity(inflictor); event.AddEntity(inflictor);
event->AddVector(position); event.AddVector(position);
event->AddVector(direction); event.AddVector(direction);
event->AddVector(normal); event.AddVector(normal);
event->AddInteger(knockback); event.AddInteger(knockback);
event->AddInteger(dflags); event.AddInteger(dflags);
event->AddInteger(meansofdeath); event.AddInteger(meansofdeath);
event->AddInteger(location); event.AddInteger(location);
ProcessEvent(event); ProcessEvent(event);
} }
return; delegate_damage.Execute(*ev);
} }
qboolean Sentient::CanBlock(int meansofdeath, qboolean full_block) qboolean Sentient::CanBlock(int meansofdeath, qboolean full_block)

View file

@ -356,11 +356,6 @@ int SimpleEntity::IsSubclassOfCrateObject(void) const
return (entflags & ECF_CRATEOBJECT); return (entflags & ECF_CRATEOBJECT);
} }
int SimpleEntity::IsSubclassOfBot(void) const
{
return (entflags & ECF_BOT);
}
void SimpleEntity::SetTargetName(str targetname) void SimpleEntity::SetTargetName(str targetname)
{ {
if (!world) { if (!world) {

View file

@ -91,7 +91,6 @@ public:
int IsSubclassOfVehiclePoint(void) const; int IsSubclassOfVehiclePoint(void) const;
int IsSubclassOfSplinePath(void) const; int IsSubclassOfSplinePath(void) const;
int IsSubclassOfCrateObject(void) const; int IsSubclassOfCrateObject(void) const;
int IsSubclassOfBot(void) const;
void GetOrigin(Event *ev); void GetOrigin(Event *ev);
void SetOrigin(Event *ev); void SetOrigin(Event *ev);

View file

@ -48,7 +48,7 @@ public:
void Think() override; void Think() override;
void Archive(Archiver& arc); void Archive(Archiver& arc) override;
void setOwner(Sentient *other); void setOwner(Sentient *other);
Sentient *getOwner() const; Sentient *getOwner() const;

View file

@ -77,7 +77,7 @@ Event EV_Trigger_SetCount
EV_DEFAULT, EV_DEFAULT,
"i", "i",
"count", "count",
"Set the amount of times this trigger can be triggered", "Set the number of times this trigger can be triggered",
EV_NORMAL EV_NORMAL
); );
Event EV_Trigger_SetMessage Event EV_Trigger_SetMessage
@ -440,6 +440,12 @@ void Trigger::TriggerStuff(Event *ev)
ScriptError("trigger '%s' triggered by self", TargetName().c_str()); ScriptError("trigger '%s' triggered by self", TargetName().c_str());
} }
// Fixed in OPM
// Safety check
if (other == NULL) {
ScriptError("trigger '%s' triggered by NULL entity", TargetName().c_str());
}
// Always respond to activate messages from the world since they're probably from // Always respond to activate messages from the world since they're probably from
// the "trigger" command // the "trigger" command
if (!respondTo(other) && (other != world || *ev != EV_Activate) if (!respondTo(other) && (other != world || *ev != EV_Activate)
@ -894,6 +900,12 @@ void TriggerAll::TriggerStuff(Event *ev)
ScriptError("trigger '%s' triggered by self", TargetName().c_str()); ScriptError("trigger '%s' triggered by self", TargetName().c_str());
} }
// Fixed in OPM
// Safety check
if (other == NULL) {
ScriptError("trigger '%s' triggered by NULL entity", TargetName().c_str());
}
// Always respond to activate messages from the world since they're probably from // Always respond to activate messages from the world since they're probably from
// the "trigger" command // the "trigger" command
if (!respondTo(other) && !((other == world) && (*ev == EV_Activate)) if (!respondTo(other) && !((other == world) && (*ev == EV_Activate))

View file

@ -3465,27 +3465,26 @@ void Vehicle::SetupPath(cVehicleSpline *pPath, SimpleEntity *se)
vLastOrigin = se->origin; vLastOrigin = se->origin;
for (ent = se; ent != NULL; ent = ent->Next(), i++) { for (ent = se; ent; ent = ent->Next(), i++) {
Vector vDelta = vLastOrigin - ent->origin; Vector vDelta = vLastOrigin - ent->origin;
float vTmp[4]; float vTmp[4];
if (vDelta.length() == 0 && i > 1) { if (vDelta.length() == 0 && i > 1) {
Com_Printf("^~^~^Warning: Vehicle Driving with a Path that contains 2 equal points\n"); Com_Printf("^~^~^Warning: Vehicle Driving with a Path that contains 2 equal points\n");
continue;
}
fCurLength += vDelta.length();
vTmp[0] = fCurLength;
VectorCopy(ent->origin, vTmp + 1);
if (ent->IsSubclassOfVehiclePoint()) {
pPath->Add(vTmp, static_cast<VehiclePoint*>(ent)->spawnflags);
} else { } else {
pPath->Add(vTmp, 0); fCurLength += vDelta.length();
}
vLastOrigin = ent->origin; vTmp[0] = fCurLength;
VectorCopy(ent->origin, vTmp + 1);
if (ent->IsSubclassOfVehiclePoint()) {
pPath->Add(vTmp, static_cast<VehiclePoint*>(ent)->spawnflags);
} else {
pPath->Add(vTmp, 0);
}
vLastOrigin = ent->origin;
}
if (ent == se && i > 1) { if (ent == se && i > 1) {
break; break;

View file

@ -370,6 +370,11 @@ void VehicleTurretGun::P_UserAim(usercmd_t *ucmd)
return; return;
} }
if (!m_pVehicleOwner) {
// Added in OPM
return;
}
if (!m_pVehicleOwner->IsSubclassOfVehicle()) { if (!m_pVehicleOwner->IsSubclassOfVehicle()) {
return; return;
} }
@ -1152,6 +1157,14 @@ void VehicleTurretGun::ApplyFireKickback(const Vector& org, float kickback)
return; return;
} }
if (g_target_game <= target_game_e::TG_MOH) {
// Don't apply fire kickback in older version
// this could cause issues as models weren't made for this feature
return;
}
// Added in 2.0
pVehicle = static_cast<Vehicle *>(m_pVehicleOwner.Pointer()); pVehicle = static_cast<Vehicle *>(m_pVehicleOwner.Pointer());
pVehicle->m_fForwardForce += org.x * kickback; pVehicle->m_fForwardForce += org.x * kickback;
pVehicle->m_fLeftForce += org.y * kickback; pVehicle->m_fLeftForce += org.y * kickback;

View file

@ -1855,7 +1855,7 @@ void Weapon::Shoot(Event *ev)
switch (firetype[mode]) { switch (firetype[mode]) {
case FT_PROJECTILE: case FT_PROJECTILE:
ProjectileAttack(pos, forward, owner, projectileModel[mode], charge_fraction); ProjectileAttack(pos, forward, owner, projectileModel[mode], charge_fraction, 0, this);
break; break;
case FT_LANDMINE: case FT_LANDMINE:
PlaceLandmine(pos, owner, projectileModel[mode], this); PlaceLandmine(pos, owner, projectileModel[mode], this);

View file

@ -633,10 +633,11 @@ Projectile::Projectile()
takedamage = DAMAGE_NO; takedamage = DAMAGE_NO;
owner = ENTITYNUM_NONE; owner = ENTITYNUM_NONE;
edict->r.ownerNum = ENTITYNUM_NONE; edict->r.ownerNum = ENTITYNUM_NONE;
// Added in 2.0 // Added in 2.0
m_bArcToTarget = false; m_bArcToTarget = false;
// Added in 2.30 // Added in 2.30
m_bDieInWater = false; m_bDieInWater = false;
// make this shootable but non-solid on the client // make this shootable but non-solid on the client
setContents(CONTENTS_SHOOTONLY); setContents(CONTENTS_SHOOTONLY);
@ -646,7 +647,7 @@ Projectile::Projectile()
// //
flags |= FL_TOUCH_TRIGGERS; flags |= FL_TOUCH_TRIGGERS;
m_iTeam = 0; m_iTeam = 0;
// Added in OPM // Added in OPM
m_bHadPlayerOwner = false; m_bHadPlayerOwner = false;
@ -939,6 +940,13 @@ void Projectile::SetSmashThroughGlass(Event *ev)
} }
void Projectile::SmashThroughGlassThink(Event *ev) void Projectile::SmashThroughGlassThink(Event *ev)
{
SmashThroughGlassThink();
PostEvent(EV_Projectile_SmashThroughGlass, level.frametime);
}
void Projectile::SmashThroughGlassThink()
{ {
if (velocity.length() > m_iSmashThroughGlass) { if (velocity.length() > m_iSmashThroughGlass) {
Vector vEnd; Vector vEnd;
@ -960,8 +968,6 @@ void Projectile::SmashThroughGlassThink(Event *ev)
} }
} }
} }
PostEvent(EV_Projectile_SmashThroughGlass, level.frametime);
} }
void Projectile::BeamCommand(Event *ev) void Projectile::BeamCommand(Event *ev)
@ -1253,21 +1259,21 @@ void Projectile::Touch(Event *ev)
other->Damage( other->Damage(
this, owner, damage, origin, velocity, level.impact_trace.plane.normal, knockback, 0, meansofdeath this, owner, damage, origin, velocity, level.impact_trace.plane.normal, knockback, 0, meansofdeath
); );
}
if (g_gametype->integer == GT_SINGLE_PLAYER && weap) { if (g_gametype->integer == GT_SINGLE_PLAYER && weap) {
if (other->IsSubclassOfPlayer() || other->IsSubclassOfVehicle() || other->IsSubclassOfVehicleTank() if (other->IsSubclassOfSentient() || other->IsSubclassOfVehicle() || other->IsSubclassOfVehicleTank()
|| other->isSubclassOf(VehicleCollisionEntity)) { || other->isSubclassOf(VehicleCollisionEntity)) {
weap->m_iNumHits++; weap->m_iNumHits++;
weap->m_iNumTorsoShots++; weap->m_iNumTorsoShots++;
if (weap->IsSubclassOfVehicleTurretGun()) { if (weap->IsSubclassOfVehicleTurretGun()) {
VehicleTurretGun* t = (VehicleTurretGun*)weap.Pointer(); VehicleTurretGun *t = (VehicleTurretGun *)weap.Pointer();
Player* p = (Player*)t->GetRemoteOwner().Pointer(); Player *p = (Player *)t->GetRemoteOwner().Pointer();
if (p && p->IsSubclassOfPlayer()) { if (p && p->IsSubclassOfPlayer()) {
p->m_iNumHits++; p->m_iNumHits++;
p->m_iNumTorsoShots++; p->m_iNumTorsoShots++;
}
} }
} }
} }
@ -1291,7 +1297,7 @@ void Projectile::Touch(Event *ev)
PostEvent(EV_Remove, 0); PostEvent(EV_Remove, 0);
// Call the explosion event // Call the explosion event
Event* explEv; Event *explEv;
explEv = new Event(EV_Projectile_Explode); explEv = new Event(EV_Projectile_Explode);
explEv->AddEntity(other); explEv->AddEntity(other);
ProcessEvent(explEv); ProcessEvent(explEv);
@ -1301,21 +1307,21 @@ void Projectile::Touch(Event *ev)
// Check for projectile vulnerability // Check for projectile vulnerability
// //
Vehicle* pVehicle = NULL; Vehicle *pVehicle = NULL;
if (other->IsSubclassOfVehicle()) { if (other->IsSubclassOfVehicle()) {
pVehicle = static_cast<Vehicle*>(other); pVehicle = static_cast<Vehicle *>(other);
} else if (other->IsSubclassOfVehicleTurretGun()) { } else if (other->IsSubclassOfVehicleTurretGun()) {
VehicleTurretGun* pTurret = static_cast<VehicleTurretGun*>(other); VehicleTurretGun *pTurret = static_cast<VehicleTurretGun *>(other);
Entity* pEnt = pTurret->GetVehicle(); Entity *pEnt = pTurret->GetVehicle();
if (pEnt && pEnt->IsSubclassOfVehicle()) { if (pEnt && pEnt->IsSubclassOfVehicle()) {
pVehicle = static_cast<Vehicle*>(pEnt); pVehicle = static_cast<Vehicle *>(pEnt);
} }
} else if (other->isSubclassOf(VehicleCollisionEntity)) { } else if (other->isSubclassOf(VehicleCollisionEntity)) {
VehicleCollisionEntity* pCollision = static_cast<VehicleCollisionEntity*>(other); VehicleCollisionEntity *pCollision = static_cast<VehicleCollisionEntity *>(other);
if (pCollision && pCollision->GetOwner()->IsSubclassOfVehicle()) { if (pCollision && pCollision->GetOwner()->IsSubclassOfVehicle()) {
pVehicle = static_cast<Vehicle*>(pCollision->GetOwner()); pVehicle = static_cast<Vehicle *>(pCollision->GetOwner());
} }
} }
@ -1917,9 +1923,9 @@ Projectile *ProjectileAttack(
proj->setMoveType(MOVETYPE_BOUNCE); proj->setMoveType(MOVETYPE_BOUNCE);
proj->ProcessInitCommands(); proj->ProcessInitCommands();
proj->SetOwner(owner); proj->SetOwner(owner);
proj->edict->r.ownerNum = owner->entnum;
proj->angles = dir.toAngles(); proj->angles = dir.toAngles();
proj->charge_fraction = fraction; proj->charge_fraction = fraction;
proj->weap = weap;
if (!real_speed) { if (!real_speed) {
if (proj->projFlags & P_CHARGE_SPEED) { if (proj->projFlags & P_CHARGE_SPEED) {
@ -2270,7 +2276,7 @@ float BulletAttack(
if (g_showbullettrace->integer) { if (g_showbullettrace->integer) {
gi.Printf("%.2f\n", newdamage); gi.Printf("%.2f\n", newdamage);
} }
if (newdamage < 1.f) { if (newdamage < 1.f) {
vTmpEnd = vTraceStart + vDir * -4; vTmpEnd = vTraceStart + vDir * -4;
trace.fraction = 1.f; trace.fraction = 1.f;
@ -2391,10 +2397,12 @@ float BulletAttack(
if (trace.surfaceFlags & (SURF_FOLIAGE | SURF_GLASS | SURF_PUDDLE | SURF_PAPER) if (trace.surfaceFlags & (SURF_FOLIAGE | SURF_GLASS | SURF_PUDDLE | SURF_PAPER)
|| trace.contents & (CONTENTS_CLAYPIDGEON | CONTENTS_WATER) || trace.contents & (CONTENTS_CLAYPIDGEON | CONTENTS_WATER)
|| (g_protocol < protocol_e::PROTOCOL_MOHTA && trace.startsolid) || (g_protocol < protocol_e::PROTOCOL_MOHTA && trace.startsolid)
|| (bulletlarge && trace.ent && (g_protocol < protocol_e::PROTOCOL_MOHTA || (trace.ent->r.contents & CONTENTS_BBOX)) && !trace.ent->r.bmodel || (bulletlarge && trace.ent
&& trace.ent->entity->takedamage) && (g_protocol < protocol_e::PROTOCOL_MOHTA || (trace.ent->r.contents & CONTENTS_BBOX))
&& !trace.ent->r.bmodel && trace.ent->entity->takedamage)
|| ((trace.surfaceFlags & SURF_WOOD) && bulletthroughwood) || ((trace.surfaceFlags & SURF_WOOD) && bulletthroughwood)
|| ((trace.surfaceFlags & (SURF_GRILL | SURF_METAL)) && bulletthroughmetal && iContinueCount < 5)) { || ((trace.surfaceFlags & (SURF_GRILL | SURF_METAL)) && bulletthroughmetal && iContinueCount < 5
)) {
if (((trace.surfaceFlags & SURF_WOOD) && bulletthroughwood) if (((trace.surfaceFlags & SURF_WOOD) && bulletthroughwood)
|| ((trace.surfaceFlags & (SURF_GRILL | SURF_METAL)) && bulletthroughmetal)) { || ((trace.surfaceFlags & (SURF_GRILL | SURF_METAL)) && bulletthroughmetal)) {
if (trace.contents & CONTENTS_FENCE) { if (trace.contents & CONTENTS_FENCE) {

View file

@ -87,8 +87,12 @@ public:
bool m_bDieInWater; bool m_bDieInWater;
// Added in 2.0 // Added in 2.0
int m_iTeam; int m_iTeam;
//
// Added in OPM
//
bool m_bHadPlayerOwner; bool m_bHadPlayerOwner;
SafePtr<Entity> m_pOwnerPtr; SafePtr<Entity> m_pOwnerPtr;
Projectile(); Projectile();
void Archive( Archiver &arc ) override; void Archive( Archiver &arc ) override;
@ -127,6 +131,7 @@ public:
void HeatSeek( Event *ev ); void HeatSeek( Event *ev );
void Drunk( Event *ev ); void Drunk( Event *ev );
void SmashThroughGlassThink( Event *ev ); void SmashThroughGlassThink( Event *ev );
void SmashThroughGlassThink(); // Added in OPM
void AddOwnerVelocity( Event *ev ); void AddOwnerVelocity( Event *ev );
void Prethink( Event *ev ); void Prethink( Event *ev );
float ResolveMinimumDistance( Entity *potential_target, float currmin ); float ResolveMinimumDistance( Entity *potential_target, float currmin );
@ -146,7 +151,7 @@ public:
// //
// Added in OPM // Added in OPM
// //
bool CheckTeams( void ); bool CheckTeams(void);
}; };
inline void Projectile::SetMartyr(int entnum) inline void Projectile::SetMartyr(int entnum)

View file

@ -11,6 +11,7 @@ file(GLOB SRCS_common
"./hashtable.c" "./hashtable.c"
"./md5c.c" "./md5c.c"
"./gutil.c" "./gutil.c"
"./gcrypt.c"
) )
file(GLOB SRCS_gcdkey file(GLOB SRCS_gcdkey
@ -101,4 +102,5 @@ foreach(LIB ${DEPENDENT_LIBS})
target_link_libraries(${LIB} PUBLIC gcd_common) target_link_libraries(${LIB} PUBLIC gcd_common)
endforeach() endforeach()
target_link_libraries(gcd_key PRIVATE gcd_qr2)
target_link_libraries(gcd_qr2 PRIVATE gcd_natneg) target_link_libraries(gcd_qr2 PRIVATE gcd_natneg)

49
code/gamespy/cl_gamespy.c Normal file
View file

@ -0,0 +1,49 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#pragma once
#include "cl_gamespy.h"
#include "q_gamespy.h"
unsigned int ServerListGetNumMasters()
{
return Com_GetNumMasterEntries();
}
const char *ServerListGetHost(int index)
{
master_entry_t entry;
Com_GetMasterEntry(index, &entry);
return entry.host;
}
int ServerListGetMsPort(int index)
{
master_entry_t entry;
Com_GetMasterEntry(index, &entry);
return entry.queryport;
}
void CL_RestartGamespy_f() {}

27
code/gamespy/cl_gamespy.h Normal file
View file

@ -0,0 +1,27 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// cl_gamespy.h -- Game-specific client GameSpy code
#pragma once
void CL_RestartGamespy_f();

View file

@ -23,7 +23,9 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Set the platform define // Set the platform define
#ifdef __mips64 #if defined (__linux__) || defined(_LINUX) || defined(_MACOSX) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#define _UNIX
#elif __mips64
#ifndef _PS2 #ifndef _PS2
#define _PS2 #define _PS2
#endif #endif
@ -34,10 +36,6 @@
#endif #endif
#endif #endif
#if defined(_LINUX) || defined(_MACOSX) || defined(__APPLE__)
#define _UNIX
#endif
#if defined(_XBOX) || defined (_X360) #if defined(_XBOX) || defined (_X360)
#if _XBOX_VER >= 200 #if _XBOX_VER >= 200
#define _X360 #define _X360

View file

@ -89,7 +89,11 @@ extern "C" {
} GSICriticalSection; } GSICriticalSection;
typedef void (*GSThreadFunc)(void *arg); typedef void (*GSThreadFunc)(void *arg);
#elif defined(_UNIX) //_LINUX || _MACOSX #elif defined(_UNIX) // Linux, Mac OS X, openbsd, etc.
#if defined(__OpenBSD__)
#include <pthread.h>
#endif
typedef pthread_mutex_t GSICriticalSection; typedef pthread_mutex_t GSICriticalSection;
typedef struct typedef struct
{ {

View file

@ -439,7 +439,7 @@ void SocketStartUp()
void SocketShutDown() void SocketShutDown()
{ {
#if defined(_WIN32) #if defined(_WIN32)
// WSACleanup(); WSACleanup();
#if defined(_X360) #if defined(_X360)
XNetCleanup(); XNetCleanup();
#endif #endif

View file

@ -20,30 +20,30 @@
#define DEF_GROWBY 8 #define DEF_GROWBY 8
#ifdef _NO_NOPORT_H_ #ifdef _NO_NOPORT_H_
#define gsimalloc malloc #define gsimalloc malloc
#define gsifree free #define gsifree free
#define gsirealloc realloc #define gsirealloc realloc
#include "common/gsAssert.h" #include "common/gsAssert.h"
#else #else
#include "nonport.h" //for gsimalloc/realloc/free/GS_ASSERT #include "nonport.h" //for gsimalloc/realloc/free/GS_ASSERT
#endif #endif
// STRUCTURES // STRUCTURES
struct DArrayImplementation struct DArrayImplementation
{ {
int count, capacity; int count, capacity;
int elemsize; int elemsize;
int growby; int growby;
ArrayElementFreeFn elemfreefn; ArrayElementFreeFn elemfreefn;
void *list; //array of elements void *list; //array of elements
}; };
// PROTOTYPES // PROTOTYPES
static void *mylsearch(const void *key, void *base, int count, int size, static void *mylsearch(const void *key, void *base, int count, int size,
ArrayCompareFn comparator); ArrayCompareFn comparator);
static void *mybsearch(const void *elem, void *base, int num, int elemsize, static void *mybsearch(const void *elem, void *base, int num, int elemsize,
ArrayCompareFn comparator, int *found); ArrayCompareFn comparator, int *found);
// FUNCTIONS // FUNCTIONS
/* FreeElement /* FreeElement
@ -51,8 +51,8 @@ static void *mybsearch(const void *elem, void *base, int num, int elemsize,
*/ */
static void FreeElement(DArray array, int n) static void FreeElement(DArray array, int n)
{ {
if (array->elemfreefn != NULL) if (array->elemfreefn != NULL)
array->elemfreefn(ArrayNth(array,n)); array->elemfreefn(ArrayNth(array,n));
} }
/* ArrayGrow /* ArrayGrow
@ -60,10 +60,10 @@ static void FreeElement(DArray array, int n)
*/ */
static void ArrayGrow(DArray array) static void ArrayGrow(DArray array)
{ {
GS_ASSERT(array->elemsize) // sanity check -mj Oct 31st GS_ASSERT(array->elemsize) // sanity check -mj Oct 31st
array->capacity += array->growby; array->capacity += array->growby;
array->list = gsirealloc(array->list, (size_t) array->capacity * array->elemsize); array->list = gsirealloc(array->list, (size_t) array->capacity * array->elemsize);
GS_ASSERT(array->list); GS_ASSERT(array->list);
} }
/* SetElement /* SetElement
@ -71,94 +71,94 @@ static void ArrayGrow(DArray array)
*/ */
static void SetElement(DArray array, const void *elem, int pos) static void SetElement(DArray array, const void *elem, int pos)
{ {
GS_ASSERT(array) // safety check -mj Oct 31st GS_ASSERT(array) // safety check -mj Oct 31st
GS_ASSERT(elem) GS_ASSERT(elem)
GS_ASSERT(array->elemsize) GS_ASSERT(array->elemsize)
memcpy(ArrayNth(array,pos), elem, (size_t)array->elemsize); memcpy(ArrayNth(array,pos), elem, (size_t)array->elemsize);
} }
DArray ArrayNew(int elemSize, int numElemsToAllocate, DArray ArrayNew(int elemSize, int numElemsToAllocate,
ArrayElementFreeFn elemFreeFn) ArrayElementFreeFn elemFreeFn)
{ {
DArray array; DArray array;
array = (DArray) gsimalloc(sizeof(struct DArrayImplementation)); array = (DArray) gsimalloc(sizeof(struct DArrayImplementation));
GS_ASSERT(array); GS_ASSERT(array);
GS_ASSERT(elemSize); GS_ASSERT(elemSize);
if (numElemsToAllocate == 0) if (numElemsToAllocate == 0)
numElemsToAllocate = DEF_GROWBY; numElemsToAllocate = DEF_GROWBY;
array->count = 0; array->count = 0;
array->capacity = numElemsToAllocate;; array->capacity = numElemsToAllocate;;
array->elemsize = elemSize; array->elemsize = elemSize;
array->growby = numElemsToAllocate; array->growby = numElemsToAllocate;
array->elemfreefn = elemFreeFn; array->elemfreefn = elemFreeFn;
if (array->capacity != 0) if (array->capacity != 0)
{ {
array->list = gsimalloc((size_t)array->capacity * array->elemsize); array->list = gsimalloc((size_t)array->capacity * array->elemsize);
GS_ASSERT(array->list); GS_ASSERT(array->list);
} else } else
array->list = NULL; array->list = NULL;
return array; return array;
} }
void ArrayFree(DArray array) void ArrayFree(DArray array)
{ {
int i; int i;
GS_ASSERT(array); GS_ASSERT(array);
for (i = 0; i < array->count; i++) for (i = 0; i < array->count; i++)
{ {
FreeElement(array, i); FreeElement(array, i);
} }
// mj to do: move these asserts into gsi_free. maybe, depends on whether user overloads them // mj to do: move these asserts into gsi_free. maybe, depends on whether user overloads them
GS_ASSERT(array->list) GS_ASSERT(array->list)
GS_ASSERT(array) GS_ASSERT(array)
gsifree(array->list); gsifree(array->list);
gsifree(array); gsifree(array);
} }
void *ArrayGetDataPtr(DArray array) void *ArrayGetDataPtr(DArray array)
{ {
GS_ASSERT(array); GS_ASSERT(array);
return array->list; return array->list;
} }
void ArraySetDataPtr(DArray array, void *ptr, int count, int capacity) void ArraySetDataPtr(DArray array, void *ptr, int count, int capacity)
{ {
int i; int i;
GS_ASSERT(array); GS_ASSERT(array);
if (array->list != NULL) if (array->list != NULL)
{ {
for (i = 0; i < array->count; i++) for (i = 0; i < array->count; i++)
{ {
FreeElement(array, i); FreeElement(array, i);
} }
gsifree(array->list); gsifree(array->list);
} }
array->list = ptr; array->list = ptr;
array->count = count; array->count = count;
array->capacity = capacity; array->capacity = capacity;
} }
int ArrayLength(const DArray array) int ArrayLength(const DArray array)
{ {
GS_ASSERT(array) GS_ASSERT(array)
return array->count; return array->count;
} }
void *ArrayNth(DArray array, int n) void *ArrayNth(DArray array, int n)
{ {
// 2004.Nov.16.JED - modified GS_ASSERT to include "if" to add robustness // 2004.Nov.16.JED - modified GS_ASSERT to include "if" to add robustness
GS_ASSERT( (n >= 0) && (n < array->count)); GS_ASSERT( (n >= 0) && (n < array->count));
if( ! ((n >= 0) && (n < array->count)) ) if( ! ((n >= 0) && (n < array->count)) )
return NULL; return NULL;
return (char *)array->list + array->elemsize*n; return (char *)array->list + array->elemsize*n;
} }
/* ArrayAppend /* ArrayAppend
@ -166,166 +166,166 @@ void *ArrayNth(DArray array, int n)
*/ */
void ArrayAppend(DArray array, const void *newElem) void ArrayAppend(DArray array, const void *newElem)
{ {
GS_ASSERT(array); GS_ASSERT(array);
if(array) if(array)
ArrayInsertAt(array, newElem, array->count); ArrayInsertAt(array, newElem, array->count);
} }
void ArrayInsertAt(DArray array, const void *newElem, int n) void ArrayInsertAt(DArray array, const void *newElem, int n)
{ {
GS_ASSERT (array) GS_ASSERT (array)
GS_ASSERT ( (n >= 0) && (n <= array->count)); GS_ASSERT ( (n >= 0) && (n <= array->count));
if (array->count == array->capacity) if (array->count == array->capacity)
ArrayGrow(array); ArrayGrow(array);
array->count++; array->count++;
if (n < array->count - 1) //if we aren't appending if (n < array->count - 1) //if we aren't appending
memmove(ArrayNth(array, n+1), ArrayNth(array,n), memmove(ArrayNth(array, n+1), ArrayNth(array,n),
(size_t)(array->count - 1 - n) * array->elemsize); (size_t)(array->count - 1 - n) * array->elemsize);
SetElement(array, newElem, n); SetElement(array, newElem, n);
} }
void ArrayInsertSorted(DArray array, const void *newElem, ArrayCompareFn comparator) void ArrayInsertSorted(DArray array, const void *newElem, ArrayCompareFn comparator)
{ {
int n; int n;
void *res; void *res;
int found; int found;
GS_ASSERT (array) GS_ASSERT (array)
GS_ASSERT (comparator); GS_ASSERT (comparator);
res=mybsearch(newElem, array->list, array->count, array->elemsize, comparator, &found); res=mybsearch(newElem, array->list, array->count, array->elemsize, comparator, &found);
n = (((char *)res - (char *)array->list) / array->elemsize); n = (((char *)res - (char *)array->list) / array->elemsize);
ArrayInsertAt(array, newElem, n); ArrayInsertAt(array, newElem, n);
} }
void ArrayRemoveAt(DArray array, int n) void ArrayRemoveAt(DArray array, int n)
{ {
GS_ASSERT (array) GS_ASSERT (array)
GS_ASSERT( (n >= 0) && (n < array->count)); GS_ASSERT( (n >= 0) && (n < array->count));
if (n < array->count - 1) //if not last element if (n < array->count - 1) //if not last element
memmove(ArrayNth(array,n),ArrayNth(array,n+1), memmove(ArrayNth(array,n),ArrayNth(array,n+1),
(size_t)(array->count - 1 - n) * array->elemsize); (size_t)(array->count - 1 - n) * array->elemsize);
array->count--; array->count--;
} }
void ArrayDeleteAt(DArray array, int n) void ArrayDeleteAt(DArray array, int n)
{ {
GS_ASSERT (array) GS_ASSERT (array)
GS_ASSERT ( (n >= 0) && (n < array->count)); GS_ASSERT ( (n >= 0) && (n < array->count));
FreeElement(array,n); FreeElement(array,n);
ArrayRemoveAt(array, n); ArrayRemoveAt(array, n);
} }
void ArrayReplaceAt(DArray array, const void *newElem, int n) void ArrayReplaceAt(DArray array, const void *newElem, int n)
{ {
GS_ASSERT (array) GS_ASSERT (array)
GS_ASSERT ( (n >= 0) && (n < array->count)); GS_ASSERT ( (n >= 0) && (n < array->count));
FreeElement(array, n); FreeElement(array, n);
SetElement(array, newElem,n); SetElement(array, newElem,n);
} }
void ArraySort(DArray array, ArrayCompareFn comparator) void ArraySort(DArray array, ArrayCompareFn comparator)
{ {
GS_ASSERT (array) GS_ASSERT (array)
qsort(array->list, (size_t)array->count, (size_t)array->elemsize, comparator); qsort(array->list, (size_t)array->count, (size_t)array->elemsize, comparator);
} }
//GS_ASSERT will be raised by ArrayNth if fromindex out of range //GS_ASSERT will be raised by ArrayNth if fromindex out of range
int ArraySearch(DArray array, const void *key, ArrayCompareFn comparator, int ArraySearch(DArray array, const void *key, ArrayCompareFn comparator,
int fromIndex, int isSorted) int fromIndex, int isSorted)
{ {
void *res; void *res;
int found = 1; int found = 1;
if (!array || array->count == 0) if (!array || array->count == 0)
return NOT_FOUND; return NOT_FOUND;
if (isSorted) if (isSorted)
res=mybsearch(key, ArrayNth(array,fromIndex), res=mybsearch(key, ArrayNth(array,fromIndex),
array->count - fromIndex, array->elemsize, comparator, &found); array->count - fromIndex, array->elemsize, comparator, &found);
else else
res=mylsearch(key, ArrayNth(array, fromIndex), res=mylsearch(key, ArrayNth(array, fromIndex),
array->count - fromIndex, array->elemsize, comparator); array->count - fromIndex, array->elemsize, comparator);
if (res != NULL && found) if (res != NULL && found)
return (((char *)res - (char *)array->list) / array->elemsize); return (((char *)res - (char *)array->list) / array->elemsize);
else else
return NOT_FOUND; return NOT_FOUND;
} }
void ArrayMap(DArray array, ArrayMapFn fn, void *clientData) void ArrayMap(DArray array, ArrayMapFn fn, void *clientData)
{ {
int i; int i;
GS_ASSERT (array) GS_ASSERT (array)
GS_ASSERT(fn); GS_ASSERT(fn);
for (i = 0; i < array->count; i++) for (i = 0; i < array->count; i++)
fn(ArrayNth(array,i), clientData); fn(ArrayNth(array,i), clientData);
} }
void ArrayMapBackwards(DArray array, ArrayMapFn fn, void *clientData) void ArrayMapBackwards(DArray array, ArrayMapFn fn, void *clientData)
{ {
int i; int i;
GS_ASSERT(fn); GS_ASSERT(fn);
for (i = (array->count - 1) ; i >= 0 ; i--) for (i = (array->count - 1) ; i >= 0 ; i--)
fn(ArrayNth(array,i), clientData); fn(ArrayNth(array,i), clientData);
} }
void * ArrayMap2(DArray array, ArrayMapFn2 fn, void *clientData) void * ArrayMap2(DArray array, ArrayMapFn2 fn, void *clientData)
{ {
int i; int i;
void * pcurr; void * pcurr;
GS_ASSERT(fn); GS_ASSERT(fn);
GS_ASSERT(clientData); GS_ASSERT(clientData);
for (i = 0; i < array->count; i++) for (i = 0; i < array->count; i++)
{ {
pcurr = ArrayNth(array,i); pcurr = ArrayNth(array,i);
if(!fn(pcurr, clientData)) if(!fn(pcurr, clientData))
return pcurr; return pcurr;
} }
return NULL; return NULL;
} }
void * ArrayMapBackwards2(DArray array, ArrayMapFn2 fn, void *clientData) void * ArrayMapBackwards2(DArray array, ArrayMapFn2 fn, void *clientData)
{ {
int i; int i;
void * pcurr; void * pcurr;
GS_ASSERT(fn); GS_ASSERT(fn);
GS_ASSERT(clientData); GS_ASSERT(clientData);
for (i = (array->count - 1) ; i >= 0 ; i--) for (i = (array->count - 1) ; i >= 0 ; i--)
{ {
pcurr = ArrayNth(array,i); pcurr = ArrayNth(array,i);
if(!fn(pcurr, clientData)) if(!fn(pcurr, clientData))
return pcurr; return pcurr;
} }
return NULL; return NULL;
} }
void ArrayClear(DArray array) void ArrayClear(DArray array)
{ {
int i; int i;
// This could be more optimal! // This could be more optimal!
////////////////////////////// //////////////////////////////
for(i = (ArrayLength(array) - 1) ; i >= 0 ; i--) for(i = (ArrayLength(array) - 1) ; i >= 0 ; i--)
ArrayDeleteAt(array, i); ArrayDeleteAt(array, i);
} }
/* mylsearch /* mylsearch
@ -333,17 +333,17 @@ void ArrayClear(DArray array)
* couldn't use lfind * couldn't use lfind
*/ */
static void *mylsearch(const void *key, void *base, int count, int size, static void *mylsearch(const void *key, void *base, int count, int size,
ArrayCompareFn comparator) ArrayCompareFn comparator)
{ {
int i; int i;
GS_ASSERT(key); GS_ASSERT(key);
GS_ASSERT(base); GS_ASSERT(base);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (comparator(key, (char *)base + size*i) == 0) if (comparator(key, (char *)base + size*i) == 0)
return (char *)base + size*i; return (char *)base + size*i;
} }
return NULL; return NULL;
} }
/* mybsearch /* mybsearch
@ -351,27 +351,27 @@ static void *mylsearch(const void *key, void *base, int count, int size,
*/ */
static void *mybsearch(const void *elem, void *base, int num, int elemsize, ArrayCompareFn comparator, int *found) static void *mybsearch(const void *elem, void *base, int num, int elemsize, ArrayCompareFn comparator, int *found)
{ {
int L, H, I, C; int L, H, I, C;
GS_ASSERT(elem); GS_ASSERT(elem);
GS_ASSERT(base); GS_ASSERT(base);
GS_ASSERT(found); GS_ASSERT(found);
L = 0; L = 0;
H = num - 1; H = num - 1;
*found = 0; *found = 0;
while (L <= H) while (L <= H)
{ {
I = (L + H) >> 1; I = (L + H) >> 1;
C = comparator(((char *)base) + I * elemsize,elem); C = comparator(((char *)base) + I * elemsize,elem);
if (C == 0) if (C == 0)
*found = 1; *found = 1;
if (C < 0) if (C < 0)
L = I + 1; L = I + 1;
else else
{ {
H = I - 1; H = I - 1;
} }
} }
return ((char *)base) + L * elemsize; return ((char *)base) + L * elemsize;
} }

View file

@ -43,9 +43,9 @@ typedef struct DArrayImplementation *DArray;
* If the two elements are "equal", return 0. * If the two elements are "equal", return 0.
*/ */
#if defined(WIN32) #if defined(WIN32)
typedef int (__cdecl *ArrayCompareFn)(const void *elem1, const void *elem2); typedef int (__cdecl *ArrayCompareFn)(const void *elem1, const void *elem2);
#else #else
typedef int (*ArrayCompareFn)(const void *elem1, const void *elem2); typedef int (*ArrayCompareFn)(const void *elem1, const void *elem2);
#endif #endif

223
code/gamespy/gcrypt.c Normal file
View file

@ -0,0 +1,223 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "gcrypt.h"
#include "../qcommon/q_platform.h"
#include "../qcommon/q_shared.h"
static unsigned int rotl32(unsigned int value, unsigned int count)
{
return (value << count) | (value >> (-count & 31));
}
static unsigned int crypt_seek(GCryptInfo *info, unsigned int n1, unsigned int n2)
{
int part;
int i;
int keyIndex;
int xorKey;
int current;
current = 0x8000;
xorKey = n1;
keyIndex = 0;
i = 1;
info->offset = 0;
while (current > 0) {
xorKey += i;
keyIndex += xorKey;
xorKey += keyIndex;
if (n2 & current) {
part = rotl32(~xorKey, 24);
xorKey = rotl32(info->key[part & 0xff] ^ part, 24);
part = rotl32(info->key[keyIndex & 0xff] ^ keyIndex, 8);
xorKey ^= info->key[xorKey & 0xff];
keyIndex = rotl32(info->key[part & 0xff] ^ part, 8);
i += 1 + i;
} else {
info->msg[info->offset] = xorKey;
info->msg[info->offset + 16] = keyIndex;
info->msg[info->offset + 32] = i;
info->offset++;
part = rotl32(keyIndex, 24);
keyIndex = rotl32(info->key[part & 0xff] ^ part, 24);
part = rotl32(info->key[xorKey & 0xff] ^ xorKey, 8);
keyIndex ^= info->key[keyIndex & 0xff];
xorKey = rotl32(info->key[part & 0xff] ^ part, 8);
i *= 2;
}
current >>= 1;
}
info->xorKey = xorKey;
info->keyIndex = keyIndex;
info->i = i;
info->start = n1;
return keyIndex ^ xorKey;
}
static void crypt_encrypt(GCryptInfo *info, unsigned int *words, int len)
{
int part;
unsigned int i;
unsigned int w;
int keyIndex;
int xorKey;
int offset;
offset = info->offset;
xorKey = info->xorKey;
keyIndex = info->keyIndex;
i = info->i;
for (w = 0; w < len; w++) {
while (i < 0x10000) {
xorKey += i;
keyIndex += xorKey;
xorKey += keyIndex;
info->msg[offset] = xorKey;
info->msg[offset + 16] = keyIndex;
info->msg[offset + 32] = i;
offset++;
part = rotl32(keyIndex, 24);
keyIndex = rotl32(info->key[part & 0xff] ^ part, 24);
part = rotl32(info->key[xorKey & 0xff] ^ xorKey, 8);
keyIndex ^= info->key[keyIndex & 0xff];
xorKey = rotl32(info->key[part & 0xff] ^ part, 8);
i *= 2;
}
words[w] = LittleLong(keyIndex ^ xorKey);
offset--;
if (offset < 0) {
offset = 0;
}
part = rotl32(~info->msg[offset], 24);
xorKey = rotl32(info->key[part & 0xff] ^ part, 24);
part = rotl32(info->key[info->msg[offset + 16] & 0xff] ^ info->msg[offset + 16], 8);
xorKey ^= info->key[xorKey & 0xff];
keyIndex = rotl32(info->key[part & 0xff] ^ part, 8);
i = info->msg[offset + 32] + 1 + info->msg[offset + 32];
}
info->offset = offset;
info->xorKey = xorKey;
info->keyIndex = keyIndex;
info->i = i;
}
void init_crypt_key(unsigned char *src, unsigned int len, GCryptInfo *info)
{
int index;
int i, j, k;
int tmp;
info->wordPtr = NULL;
for (k = 0; k < 256; k++) {
info->key[k] = 0;
}
for (i = 0; i < 4; i++) {
for (k = 0; k < 256; k++) {
info->key[k] = (info->key[k] << 8) + k;
}
index = i;
for (j = 0; j < 2; j++) {
for (k = 0; k < 256; k++) {
index = ((info->key[k] & 0xff) + src[k % len] + index) & 0xff;
tmp = info->key[k];
info->key[k] = info->key[index];
info->key[index] = tmp;
}
}
}
for (k = 0; k < 256; k++) {
info->key[k] ^= k;
}
crypt_seek(info, 0, 0);
}
void crypt_docrypt(GCryptInfo *info, unsigned char *out, int len)
{
int i;
for (i = 0; i < len; i++) {
if (!info->wordPtr || ((char *)info->wordPtr - (char *)info->words) >= (sizeof(info->words) - 1)) {
info->wordPtr = (unsigned char *)info->words;
crypt_encrypt(info, info->words, ARRAY_LEN(info->words));
}
out[i] ^= *info->wordPtr;
info->wordPtr++;
}
}
int enctype2_encoder(unsigned char *secKey, unsigned char *data, int size)
{
GCryptInfo info = {0};
int i;
int header_size = 8;
// move the data and put it after the header
for (i = size - 1; i >= 0; i--) {
data[1 + header_size + i] = data[i];
}
// initialize the header
for (i = 0; i < header_size; i++) {
data[i + 1] = 0;
}
// initialize the crypt key
init_crypt_key(data + 1, header_size, &info);
for (i = 0; i < 6; i++) {
data[1 + header_size + size + i] = 0;
}
crypt_docrypt(&info, data + 1 + header_size, size + 6);
for (i = 0; secKey[i]; i++) {
data[i + 1] ^= secKey[i];
}
size += 1 + header_size + 6;
*data = header_size ^ 0xec;
return size;
}

40
code/gamespy/gcrypt.h Normal file
View file

@ -0,0 +1,40 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#pragma once
typedef struct {
int key[256];
int msg[48];
int offset;
int xorKey;
int keyIndex;
int i;
int start;
unsigned int words[16];
unsigned char *wordPtr;
} GCryptInfo;
void init_crypt_key(unsigned char *src, unsigned int len, GCryptInfo *info);
void crypt_docrypt(GCryptInfo *info, unsigned char *out, int len);

View file

@ -74,7 +74,9 @@ idle - no processing or querying underway, ready to being updates
listreq - a server list request has been or is being sent listreq - a server list request has been or is being sent
listxfer - we are transfering the server list listxfer - we are transfering the server list
lanlist - we are waiting for replies from servers on the LAN lanlist - we are waiting for replies from servers on the LAN
querying - the servers on the list are being queried */ querying - the servers on the list are being queried
connecting (added in OPM) - socket is currently connecting to the master server
*/
typedef enum {sl_idle, sl_listxfer, sl_lanlist, sl_querying} GServerListState; typedef enum {sl_idle, sl_listxfer, sl_lanlist, sl_querying} GServerListState;
/* Comparision types for the ServerListSort function /* Comparision types for the ServerListSort function
@ -85,7 +87,7 @@ stricase - assume the values are strings and do a case insensitive compare */
typedef enum {cm_int, cm_float, cm_strcase, cm_stricase} GCompareMode; typedef enum {cm_int, cm_float, cm_strcase, cm_stricase} GCompareMode;
typedef enum {qt_basic, qt_info, qt_rules, qt_players, qt_info_rules, qt_status} GQueryType; typedef enum {qt_basic, qt_info, qt_rules, qt_players, qt_info_rules, qt_status, qt_grouprooms, qt_masterinfo} GQueryType;
/* Messages that are passed to the ListCallBackFn */ /* Messages that are passed to the ListCallBackFn */
#define LIST_STATECHANGED 1 // ServerListState changed, no parameters #define LIST_STATECHANGED 1 // ServerListState changed, no parameters

View file

@ -13,17 +13,17 @@ Fax(714)549-0757
****** ******
Updated 10-15-99 (BGW) Updated 10-15-99 (BGW)
Modified ServerParseKeyVals to actually parse and store empty Modified ServerParseKeyVals to actually parse and store empty
values for keys (i.e. "\delete\\" adds key="delete" and value="") values for keys (i.e. "\delete\\" adds key="delete" and value="")
Updated 6-17-99 (DDW) Updated 6-17-99 (DDW)
Added new tokenize function to handle empty values for keys Added new tokenize function to handle empty values for keys
*******/ *******/
#if defined(applec) || defined(THINK_C) || defined(__MWERKS__) && !defined(__KATANA__) #if defined(applec) || defined(THINK_C) || defined(__MWERKS__) && !defined(__KATANA__)
#include "::nonport.h" #include "::nonport.h"
#else #else
#include "../nonport.h" #include "../nonport.h"
#endif #endif
#include "goaceng.h" #include "goaceng.h"
#include "gserver.h" #include "gserver.h"
@ -36,121 +36,177 @@ Updated 6-17-99 (DDW)
static int KeyValHashKeyP(const void *elem, int numbuckets); static int KeyValHashKeyP(const void *elem, int numbuckets);
static int KeyValCompareKeyP(const void *entry1, const void *entry2); static int KeyValCompareKeyP(const void *entry1, const void *entry2);
static char *mytok(char *instr, char delim);
static char *LookupKey(GServer server, char *k);
void ServerFree(void *elem) void ServerFree(void *elem)
{ {
//free a server! //free a server!
GServer server = *(GServer *)elem; GServer server = *(GServer *)elem;
TableFree(server->keyvals); TableFree(server->keyvals);
free(server); free(server);
}
static void ServerSetAddressFromString (GServer server, char *address)
{
char *cpos;
cpos = strchr(address, ':');
if (!cpos) {
return;
}
*cpos = 0;
server->ip = inet_addr(address);
server->port = atoi(cpos + 1);
}
GServer ServerNewData(char **fieldlist, int fieldcount, char *serverdata, GQueryType qtype, HashTable keylist)
{
GServer server;
char *k;
char *v;
int curfield;
GKeyValuePair kvpair;
curfield = 0;
server = (GServer)ServerNew(0, 0, qtype, keylist);
v = mytok(serverdata + 1, '\\');
while (curfield < fieldcount) {
k = fieldlist[curfield];
if (!v) {
v = "";
}
if (!strcmp(k, "ip")) {
ServerSetAddressFromString(server, v);
} else if (qtype == qt_grouprooms && !strcmp(k, "other")) {
for (char *p = v; *p; ++p) {
if (*p == 1) {
*p = '\\';
}
}
ServerParseKeyVals(server, v);
} else {
kvpair.key = (char *)LookupKey(server, k);
kvpair.value = (char *)LookupKey(server, v);
TableEnter(server->keyvals, &kvpair);
}
if (++curfield < fieldcount) {
v = mytok(0, '\\');
}
}
return server;
} }
GServer ServerNew(unsigned long ip, unsigned short port, GQueryType qtype, HashTable keylist) GServer ServerNew(unsigned long ip, unsigned short port, GQueryType qtype, HashTable keylist)
{ {
GServer server; GServer server;
int nBuckets, nChains; int nBuckets, nChains;
server = malloc(sizeof(struct GServerImplementation)); server = malloc(sizeof(struct GServerImplementation));
server->ip = ip; server->ip = ip;
server->port = port; server->port = port;
server->ping = 9999; server->ping = 9999;
server->querytype = qtype; server->querytype = qtype;
/* optimize the number of buckets / chains based on query type */ /* optimize the number of buckets / chains based on query type */
switch (qtype) switch (qtype)
{ {
case qt_basic: case qt_basic:
nBuckets = 4; nBuckets = 4;
nChains = 2; nChains = 2;
break; break;
case qt_info: case qt_info:
nBuckets = 6; nBuckets = 6;
nChains = 2; nChains = 2;
break; break;
case qt_players: case qt_players:
case qt_rules: case qt_rules:
nBuckets = 8; nBuckets = 8;
nChains = 2; nChains = 2;
break; break;
case qt_info_rules: case qt_info_rules:
case qt_status: case qt_status:
default: default:
nBuckets = 8; nBuckets = 8;
nChains= 4; nChains= 4;
break; break;
} }
server->keyvals = TableNew2(sizeof(GKeyValuePair),nBuckets,nChains, KeyValHashKeyP, KeyValCompareKeyP, NULL); server->keyvals = TableNew2(sizeof(GKeyValuePair),nBuckets,nChains, KeyValHashKeyP, KeyValCompareKeyP, NULL);
server->keylist = keylist; server->keylist = keylist;
return server; return server;
} }
static char *mytok(char *instr, char delim) static char *mytok(char *instr, char delim)
{ {
char *result; char *result;
static char *thestr; static char *thestr;
if (instr) if (instr)
thestr = instr; thestr = instr;
result=thestr; result=thestr;
while (*thestr && *thestr != delim) while (*thestr && *thestr != delim)
{ {
thestr++; thestr++;
} }
if (thestr == result) if (thestr == result)
result = NULL; result = NULL;
if (*thestr) //not the null term if (*thestr) //not the null term
*thestr++ = '\0'; *thestr++ = '\0';
return result; return result;
} }
static int CheckValidKey(char *key) static int CheckValidKey(char *key)
{ {
const char *InvalidKeys[]={"queryid","final"}; const char *InvalidKeys[]={"queryid","final"};
int i; int i;
for (i = 0; i < sizeof(InvalidKeys)/sizeof(InvalidKeys[0]); i++) for (i = 0; i < sizeof(InvalidKeys)/sizeof(InvalidKeys[0]); i++)
{ {
if (strcmp(key,InvalidKeys[i]) == 0) if (strcmp(key,InvalidKeys[i]) == 0)
return 0; return 0;
} }
return 1; return 1;
} }
static char *LookupKey(GServer server, char *k) static char *LookupKey(GServer server, char *k)
{ {
char **keyindex; char **keyindex;
keyindex = (char **)TableLookup(server->keylist,&k); keyindex = (char **)TableLookup(server->keylist,&k);
if (keyindex != NULL) if (keyindex != NULL)
return *keyindex; return *keyindex;
k = strdup(k); k = strdup(k);
TableEnter(server->keylist,&k); TableEnter(server->keylist,&k);
return k; return k;
} }
void ServerParseKeyVals(GServer server, char *keyvals) void ServerParseKeyVals(GServer server, char *keyvals)
{ {
char *k, *v; char *k, *v;
GKeyValuePair kvpair; GKeyValuePair kvpair;
k = mytok(++keyvals,'\\'); //skip over starting backslash k = mytok(++keyvals,'\\'); //skip over starting backslash
while (k != NULL) while (k != NULL)
{ {
v = mytok(NULL,'\\'); v = mytok(NULL,'\\');
if (v == NULL) if (v == NULL)
v = ""; v = "";
if (CheckValidKey(k)) if (CheckValidKey(k))
{ {
kvpair.key = LookupKey(server, k); kvpair.key = LookupKey(server, k);
kvpair.value = LookupKey(server, v); kvpair.value = LookupKey(server, v);
TableEnter(server->keyvals, &kvpair); TableEnter(server->keyvals, &kvpair);
} }
k = mytok(NULL,'\\'); k = mytok(NULL,'\\');
} }
} }
@ -159,7 +215,7 @@ void ServerParseKeyVals(GServer server, char *keyvals)
Returns the ping for the specified server. */ Returns the ping for the specified server. */
int ServerGetPing(GServer server) int ServerGetPing(GServer server)
{ {
return server->ping; return server->ping;
} }
/* ServerGetAddress /* ServerGetAddress
@ -167,7 +223,7 @@ int ServerGetPing(GServer server)
Returns the string, dotted IP address for the specified server */ Returns the string, dotted IP address for the specified server */
char *ServerGetAddress(GServer server) char *ServerGetAddress(GServer server)
{ {
return (char *)inet_ntoa(*(struct in_addr*)&server->ip); return (char *)inet_ntoa(*(struct in_addr*)&server->ip);
} }
/* ServerGetInetAddress /* ServerGetInetAddress
@ -175,7 +231,7 @@ char *ServerGetAddress(GServer server)
Returns the IP address for the specified server */ Returns the IP address for the specified server */
unsigned int ServerGetInetAddress(GServer server) unsigned int ServerGetInetAddress(GServer server)
{ {
return server->ip; return server->ip;
} }
@ -184,18 +240,18 @@ unsigned int ServerGetInetAddress(GServer server)
Returns the "query" port for the specified server. */ Returns the "query" port for the specified server. */
int ServerGetQueryPort(GServer server) int ServerGetQueryPort(GServer server)
{ {
return server->port; return server->port;
} }
static GKeyValuePair *ServerRuleLookup(GServer server, char *key) static GKeyValuePair *ServerRuleLookup(GServer server, char *key)
{ {
GKeyValuePair kvp; GKeyValuePair kvp;
char **keyindex; char **keyindex;
keyindex = (char **)TableLookup(server->keylist, &key); keyindex = (char **)TableLookup(server->keylist, &key);
if (keyindex == NULL) if (keyindex == NULL)
return NULL; //otherwise, the keyindex->keyindex is valid, so use it to lookup return NULL; //otherwise, the keyindex->keyindex is valid, so use it to lookup
kvp.key = *keyindex; kvp.key = *keyindex;
return (GKeyValuePair *)TableLookup(server->keyvals, &kvp); return (GKeyValuePair *)TableLookup(server->keyvals, &kvp);
} }
/* ServerGet[]Value /* ServerGet[]Value
@ -203,60 +259,60 @@ static GKeyValuePair *ServerRuleLookup(GServer server, char *key)
Returns the value for the specified key. */ Returns the value for the specified key. */
char *ServerGetStringValue(GServer server, char *key, char *sdefault) char *ServerGetStringValue(GServer server, char *key, char *sdefault)
{ {
GKeyValuePair *kv; GKeyValuePair *kv;
if (strcmp(key,"hostaddr") == 0) //ooh! they want the hostaddr! if (strcmp(key,"hostaddr") == 0) //ooh! they want the hostaddr!
return ServerGetAddress(server); return ServerGetAddress(server);
kv = ServerRuleLookup(server,key); kv = ServerRuleLookup(server,key);
if (!kv) if (!kv)
return sdefault; return sdefault;
return kv->value; return kv->value;
} }
int ServerGetIntValue(GServer server, char *key, int idefault) int ServerGetIntValue(GServer server, char *key, int idefault)
{ {
GKeyValuePair *kv; GKeyValuePair *kv;
if (strcmp(key,"ping") == 0) //ooh! they want the ping! if (strcmp(key,"ping") == 0) //ooh! they want the ping!
return ServerGetPing(server); return ServerGetPing(server);
kv = ServerRuleLookup(server,key); kv = ServerRuleLookup(server,key);
if (!kv) if (!kv)
return idefault; return idefault;
return atoi(kv->value); return atoi(kv->value);
} }
double ServerGetFloatValue(GServer server, char *key, double fdefault) double ServerGetFloatValue(GServer server, char *key, double fdefault)
{ {
GKeyValuePair *kv; GKeyValuePair *kv;
kv = ServerRuleLookup(server,key); kv = ServerRuleLookup(server,key);
if (!kv) if (!kv)
return fdefault; return fdefault;
return atof(kv->value); return atof(kv->value);
} }
char *ServerGetPlayerStringValue(GServer server, int playernum, char *key, char *sdefault) char *ServerGetPlayerStringValue(GServer server, int playernum, char *key, char *sdefault)
{ {
char newkey[32]; char newkey[32];
sprintf(newkey,"%s_%d",key,playernum); sprintf(newkey,"%s_%d",key,playernum);
return ServerGetStringValue(server, newkey, sdefault); return ServerGetStringValue(server, newkey, sdefault);
} }
int ServerGetPlayerIntValue(GServer server, int playernum, char *key, int idefault) int ServerGetPlayerIntValue(GServer server, int playernum, char *key, int idefault)
{ {
char newkey[32]; char newkey[32];
sprintf(newkey,"%s_%d",key,playernum); sprintf(newkey,"%s_%d",key,playernum);
return ServerGetIntValue(server, newkey, idefault); return ServerGetIntValue(server, newkey, idefault);
} }
double ServerGetPlayerFloatValue(GServer server, int playernum, char *key, double fdefault) double ServerGetPlayerFloatValue(GServer server, int playernum, char *key, double fdefault)
{ {
char newkey[32]; char newkey[32];
sprintf(newkey,"%s_%d",key,playernum); sprintf(newkey,"%s_%d",key,playernum);
return ServerGetFloatValue(server, newkey, fdefault); return ServerGetFloatValue(server, newkey, fdefault);
} }
@ -268,20 +324,20 @@ key/value. The user-defined instance data will be passed to the KeyFn callback *
static void KeyMapF(void *elem, void *clientData) static void KeyMapF(void *elem, void *clientData)
{ {
GKeyValuePair *kv = (GKeyValuePair *)elem; GKeyValuePair *kv = (GKeyValuePair *)elem;
GEnumData *ped = (GEnumData *)clientData; GEnumData *ped = (GEnumData *)clientData;
ped->EnumFn(kv->key, kv->value, ped->instance); ped->EnumFn(kv->key, kv->value, ped->instance);
} }
void ServerEnumKeys(GServer server, KeyEnumFn KeyFn, void *instance) void ServerEnumKeys(GServer server, KeyEnumFn KeyFn, void *instance)
{ {
GEnumData ed; GEnumData ed;
ed.EnumFn = KeyFn; ed.EnumFn = KeyFn;
ed.instance = instance; ed.instance = instance;
ed.keylist = server->keylist; ed.keylist = server->keylist;
TableMap(server->keyvals, KeyMapF, &ed); TableMap(server->keyvals, KeyMapF, &ed);
} }
@ -293,21 +349,21 @@ void ServerEnumKeys(GServer server, KeyEnumFn KeyFn, void *instance)
#define MULTIPLIER -1664117991 #define MULTIPLIER -1664117991
static int StringHash(char *s, int numbuckets) static int StringHash(char *s, int numbuckets)
{ {
unsigned long hashcode = 0; unsigned long hashcode = 0;
while (*s != 0) while (*s != 0)
hashcode = hashcode * MULTIPLIER + tolower(*s++); hashcode = hashcode * MULTIPLIER + tolower(*s++);
return (hashcode % numbuckets); return (hashcode % numbuckets);
} }
int GStringHash(const void *elem, int numbuckets) int GStringHash(const void *elem, int numbuckets)
{ {
return StringHash(*(char **)elem, numbuckets); return StringHash(*(char **)elem, numbuckets);
} }
static int KeyValHashKeyP(const void *elem, int numbuckets) static int KeyValHashKeyP(const void *elem, int numbuckets)
{ {
return StringHash(((GKeyValuePair *)elem)->key, numbuckets); return StringHash(((GKeyValuePair *)elem)->key, numbuckets);
} }
@ -328,12 +384,12 @@ int GCaseInsensitiveCompare(const void *entry1, const void *entry2)
*/ */
static int KeyValCompareKeyP(const void *entry1, const void *entry2) static int KeyValCompareKeyP(const void *entry1, const void *entry2)
{ {
return ((GKeyValuePair *)entry1)->key - ((GKeyValuePair *)entry2)->key; return ((GKeyValuePair *)entry1)->key - ((GKeyValuePair *)entry2)->key;
} }
void GStringFree(void *elem) void GStringFree(void *elem)
{ {
free(*(char **)elem); free(*(char **)elem);
} }
/* keyval /* keyval
@ -341,8 +397,8 @@ void GStringFree(void *elem)
* *
static int KeyValCompareKeyA(const void *entry1, const void *entry2) static int KeyValCompareKeyA(const void *entry1, const void *entry2)
{ {
return CaseInsensitiveCompare(&((GKeyValuePair *)entry1)->key, return CaseInsensitiveCompare(&((GKeyValuePair *)entry1)->key,
&((GKeyValuePair *)entry2)->key); &((GKeyValuePair *)entry2)->key);
} }
*/ */

Some files were not shown because too many files have changed in this diff Show more