Compare commits

...

182 commits

Author SHA1 Message Date
RGreenlees
be1aead879 Potential crash fix
* Hopefully fixed rare crash in the Detour library
* Improved bot retreat thought process
* Fixed potential bot stuck when trying to evolve
* Aliens will now also see and track enemies marked by OC / scent of fear
* Updated some nav meshes
2024-07-03 14:33:49 -04:00
RGreenlees
cea65c1fdc Further bot improvements
* Fixed nav meshes for lost and machina which could get bots stuck
* Improved ladder usage, fixed edge cases where bots could get stuck
* At match start, aliens will attempt to spread chambers out if the first chamber is MC or SC, rather than clustering them all at the starting hive
* Eliminated potential freeze issues with nav mesh refreshes
2024-07-03 14:33:49 -04:00
RGreenlees
b1bcdd2f70 Update editor docs and crouch fix
* Bots now properly crouch in crouch areas rather than relying on their stuck detection to do it
* Updated Nav Editor docs to reflect recent changes
2024-07-03 14:33:49 -04:00
RGreenlees
290ad067eb General improvements
* AI Commander will now attempt to place turret factories close to any existing turrets to prevent inactive turrets being left behind
* Aliens will not try to pursue enemies who have teleported away (unless they teleported close by)
* Fixed a bug where bots would not target the nearest sentry/OC to engage
* Improved how marines attack OCs, particularly how they take cover to reload
2024-07-03 14:33:49 -04:00
RGreenlees
a01d8a6708 Nav mesh and editor improvements
* Off-mesh connections in the nav editor are now colour-coded to make it easier to see what they do
* Improved nav meshes for a few maps to fix stuck issues
2024-07-03 14:33:49 -04:00
RGreenlees
0a15148352 Remove Debug Code 2024-07-03 14:33:49 -04:00
RGreenlees
4102dabe05 Further bot improvements
* Player-requested structures are properly integrated into the base system to prevent duplicates and better anticipate player desires
* Improved bot path finding for moving targets, hopefully they get caught less often on railings and stuff when pursuing a moving target
* When bots teleport (e.g. phase gate, but any kind of teleport), they clear their stored unstuck locations so they don't try and backtrack when attempting to get unstuck
2024-07-03 14:33:49 -04:00
RGreenlees
11512d9d28 Update DetourTileCache.cpp 2024-07-03 14:33:49 -04:00
RGreenlees
733ad6eb04 Fixed base bugs
* Fixed issue where commander would build siege turrets too far from the siege target
* Improved commander response to requests for turrets
* Nav reachabilities and paths are now regenerated after all nav mesh modifications are updated
2024-07-03 14:33:49 -04:00
RGreenlees
2842aba0bb Bot reload improvements and nav mesh updates 2024-07-03 14:33:49 -04:00
RGreenlees
65155fb3f0 Finish base system 2024-07-03 14:33:49 -04:00
RGreenlees
9ee01c0d64 Base system Enhancements
* Nearly finished base system
* Bots attacking structures no longer confused by "super chambers"
2024-07-03 14:33:49 -04:00
RGreenlees
6f263d400b New base building setup
* Improved base strategy and planning
* Bot is better at taking over from a human - less likely to sell up stuff unnecessarily
2024-07-03 14:33:49 -04:00
RGreenlees
0897cf15a0 Started base system
* Commanders now think in terms of establishing and building bases rather than placing individual structures. Should help reduce duplication of structures, selling structures unnecessarily etc.
* Incomplete implementation: not currently used but will be once finished
2024-07-03 14:33:49 -04:00
RGreenlees
73ff332b68 Removed debug code 2024-06-03 23:53:08 -04:00
RGreenlees
5b83a4c886 Fix crash on marine victory in combat
* Fixed a bug where bots could crash when marines successfully destroy the alien hive in CO
2024-06-03 23:53:08 -04:00
RGreenlees
2b27b90f25 Stuck fixes
* Hopefully fixed issue that caused bots to get stuck in the tubes in Ragnarok
2024-06-03 23:53:08 -04:00
RGreenlees
f427a9c052 Stability and randomness improvements
* Fixed potential crashing when obtaining references to dropped items
* Fixed issues with random number generation
2024-06-03 23:53:08 -04:00
RGreenlees
ef7e7a9178 Fixed randomness
* Fixed mistake that caused random values to follow a constant pattern
2024-06-03 23:53:08 -04:00
RGreenlees
36318cd1d4 Ladder fix + relocation fixes
* Improved ladder climbing, especially for skulks
* Fixed issues with bots getting confused when switching commanders during a relocation
2024-06-03 23:53:08 -04:00
RGreenlees
9a4a6b3660 Commander Placements Tweaks
* Commander won't get stuck trying to build base structures if using nav hints that are placed in bad spots (i.e. can't deploy structures where the nav hint is)
* Commander can now deploy prototype labs, arms labs and infantry portals on request
2024-06-03 23:53:08 -04:00
RGreenlees
9452b8a0c3 Team fill logic adjusted
* The auto-fill system for bots now takes mp_limitteams into account, and will continue to add bots to one side if the team size config specifies it to
2024-06-03 23:53:08 -04:00
RGreenlees
8fef7241a0 Updated nav meshes for relocation
* All nav meshes now have hints to help the commander relocate in good spots and build their base inside a hive appropriately
* Updated the nav editor to hide "illusionary" surfaces from other tools where they get in the way
2024-06-03 23:53:08 -04:00
RGreenlees
e17fba76ea Bot Relocation
* Marine bots can now relocate their base to a nearby hive
* If the chance to relocate is above 0 (configurable in nsbots.ini) then the bots will relocate at the start of a match based on the percentage set, or if the current base is overrun and about to be lost
* The bot will recycle the old comm chair
* The bot will abandon the relocation attempt if unsuccessful 90 seconds into a match
2024-06-03 23:53:08 -04:00
RGreenlees
91231ac069 Marine Relocation
* The AI Commander can now relocate to a nearby empty hive at the start of a match, or if the current base is almost lost
2024-06-03 23:53:08 -04:00
RGreenlees
c2e41c2011 Bot movement improvements
* Commander no longer sends reminders once an order is issued
* Fixed an issue where marines would loiter and refuse to move on once securing a hive
* Improved wall climbing: bots handle varied wall angles better
2024-06-03 23:53:08 -04:00
RGreenlees
5beb313546 Alien coordinated base attacks
* Aliens will now gang up to attack the marine base
* Aliens will spread out more when attacking in a group, rather than all going for the same buildings
2024-06-03 23:53:08 -04:00
RGreenlees
c0bef7cb05 Improved evasive behaviour
* Bots only zig-zag when approaching a ranged enemy if that enemy is aiming at them
* Bots will not zig-zag off edges, or up against walls
2024-06-03 23:53:08 -04:00
RGreenlees
6ffc3d3258 Improved hive building
* Bots no longer squabble over who's building the hive
2024-06-03 23:53:08 -04:00
RGreenlees
d17cb601eb Task priority and path merging
* Potentially fixed issue causing invalid paths
* Fixed issue where gorges wouldn't heal anyone while focused on capping res node or building defensive structures
2024-06-03 23:53:08 -04:00
RGreenlees
ff3b4afb1c Bot stuck checks
* Bots will now suicide if falling for more than 15 seconds, handle stuck situations
* Bots will hopefully not get stuck in walk nodes as much
2024-06-03 23:53:08 -04:00
RGreenlees
fcddb5b6c3 Resource capping tweak and comm reminders
* Marines will now get close initially to a resource node they want to cap, before guarding it. This fixes the issue in Hera where bots would wait for the RT in cargo to drop but never actually open the door so the commander could drop it
* Disabled AI commander reissuing orders to players as a reminder. It was annoying for humans, and pointless for bots since they should always obey it right away anyway
2024-06-03 23:53:08 -04:00
pierow
4736cdcc53 remove debug line 2024-05-10 16:39:11 -04:00
pierow
37a310a568 update special reload bit size 2024-05-10 16:39:11 -04:00
pierow
c626c27df4 remove debug line left in 2024-05-10 16:39:11 -04:00
pierow
38d8031ab1 reduced jetpack research cost 2024-05-10 16:24:44 -04:00
pierow
27d5db3b03 update options with new cvars 2024-05-10 16:24:44 -04:00
pierow
8220ae1738 fix small gaps in skulk, gorge, and onos hitboxes 2024-05-10 16:24:44 -04:00
pierow
a6c6f8c8e9 add todo for health/ammo ultrawide inset 2024-05-10 16:24:44 -04:00
pierow
6fd6cb8b8b fix todo comments for task list 2024-05-10 16:24:44 -04:00
pierow
2f6ddf68bb add 4 digit health and armor support
- fix armor number spacing
2024-05-10 16:24:44 -04:00
pierow
92db73eb89 Fix side mouse buttons registering as left click when using the cursor.
- also allow mouse3/4/5 binds to be accessible as commander.
2024-05-10 16:24:44 -04:00
RGreenlees
1363f48d96 Final fixes for next release
* Fixed some nav meshes so Onos can navigate better, and avoid bad structure placement
* Improved bot movement when not using the nav mesh (i.e. direct movement)
* Fixed player-built structures being duplicated if a commander takes over (i.e. AI commander ignoring player-placed structures and acting like they don't exist)
* Fixed marines just loitering in enemy hives doing nothing
* Fixed gorges sometimes not fully building structures and just leaving them to slowly grow
2024-05-10 16:21:30 -04:00
RGreenlees
802174ddcd Improve evolve behaviour
* Bots are less likely to get perma-stuck trying to find a good evolve location
2024-05-10 16:21:30 -04:00
RGreenlees
0f578e359f Update navmesh docs 2024-05-10 16:21:30 -04:00
RGreenlees
6ed297c68f Update nav meshes and editor
* Bring in line with new nav features and fix issues with maps
2024-05-10 16:21:30 -04:00
RGreenlees
eb15f8e1d5 Improved lerk movement, debug stuff in preprocessor 2024-05-08 14:43:14 -04:00
RGreenlees
f5e5b9b41a Lerk flight improvements
* Fixing lerks to get stuck less often when navigating normally
2024-05-08 14:43:14 -04:00
RGreenlees
6021daabab Wave attacking implementation 2024-05-08 14:43:14 -04:00
pierow
8835eb0a60 add cl_teamcfgs
- can change auto execution of team configs to be  0 =off, 1 = if playing only, 2 = also in spectate
2024-05-04 05:56:52 -04:00
pierow
710518f55a optimization to first person spec viewmodel loading 2024-05-04 05:56:52 -04:00
pierow
b5177e8e47 Additional spectator fixes
- fixed issues with piemenu cursor code being enabled when spectating
- the cursor is now enabled when in an observer mode that locks the view.
- fixed bugs/exploits where dead players could first person spectate the enemy team or travel around in freelook if all spectatable players on the team are dead.
2024-05-04 05:56:52 -04:00
pierow
e24041c64a Add spec crosshair
- Fix readyroom crosshairs not applying after leaving a team
2024-05-04 05:56:52 -04:00
RGreenlees
4f32271532 Fix broken roaming spectator mode
* Added server cvar (mp_freespectatormode) which controls when a player can enter a free spectator mode (orbit cam, or free roaming). 0 = never, 1 = only when spectator, 2 = Always
* Free roaming will now be part of the cycle when pressing the jump key
* The overlay is now toggled with the crouch button
* Strafing in free roaming no longer snaps to different players
* Fixed bug that would break spectating completely if returning to the ready room while in free roam
* You can no longer enter free roaming using the "specmode" and "spec_mode" console commands if it's disabled by the server
2024-05-04 05:56:52 -04:00
pierow
019045c5c7 fix unsafe type error 2024-05-04 05:55:53 -04:00
pierow
e08554b34f add new bot files to linux makefile 2024-05-04 05:55:53 -04:00
pierow
b53db7408f remove debug code that was left in 2024-05-04 05:55:53 -04:00
pierow
aa3ddd6017 revise hud waypoint command names and usage
-now hud_waypoint_draw and hud_waypoint_blink
2024-04-29 20:14:01 -04:00
pierow
1b8460c74a add waypoint blinking to presets 2024-04-29 20:14:01 -04:00
pierow
0f1365b785 alien sound changes
- fps independant idle and primal scream sounds
- slightly reduced the max volume of alien movement sounds
2024-04-29 20:14:01 -04:00
pierow
1f3940091a add minimap visuals for unbuilt and recycling structures 2024-04-29 20:14:01 -04:00
pierow
d2dc2fd7cf fix linux compile issue 2024-04-29 20:14:01 -04:00
pierow
c800522dcc fix typos and register cl_placebo to prevent error messages
- thanks @lameos for sending me the typos
2024-04-29 20:14:01 -04:00
pierow
af04d9a078 waypoints update
- hud_drawwaypoints was fixed in an earlier commit so waypoints don't show again when respawning
- add additional hud_waypointblinking code
2024-04-29 20:14:01 -04:00
pierow
23dc6c3a9c crosshair updates
- changed shotgun and healspray slightly
- added cl_cross_dot_round to cfgs
2024-04-29 20:14:01 -04:00
pierow
c5153c4ab1 health and ammo HUD scaling
- Scale HUD with a modified version of @Toodles2You 's triapi HUD scaling
- Add commands for position, scale, and minimum alpha of heath and ammo
- Fixes sprite blurring
- Fixed nearby pixels bleeding in to the drawn sprites
- Fixed the health cross art being cut off at the edges
2024-04-29 20:14:01 -04:00
pierow
f39297efcb Fix gamma ramp and add hud_waypointblinking
- fix gamma ramp not working correctly on maps with no env_gamma entity
- add hud_waypointblinking
2024-04-29 20:14:01 -04:00
pierow
3b8049d226 fix crosshair circle rendering issues and added round dot option 2024-04-29 20:14:01 -04:00
pierow
fb214971d5 Mine attack animation fix
- also added commented code for using the placement animation, but it doesn't look good and is buggy.
2024-04-29 20:14:01 -04:00
pierow
f191b913d3 change version beta9 2024-04-29 20:14:01 -04:00
pierow
44f1f12a4f fix bullet spark effects happening far above some marine structures 2024-04-29 20:14:01 -04:00
RGreenlees
fbab99da9e Removed debug code 2024-04-26 11:53:17 -04:00
RGreenlees
d209fe5184 Fixed defending issues
* Fixed bug where aliens wouldn't properly defend their hive if the marines weren't sieging it
* Fixed some stuck issues with skulks
* Added a proper debug printout for bots on-screen
2024-04-26 11:53:17 -04:00
RGreenlees
e8a85852e8 More bug fixes
* Fixed bots getting stuck on top of railings sometimes. Also hopefully fixed issues with bots aborting wall climbs for no reason.
* Fixed issue with duplicate base structures being dropped
* Fixed an issue where marines would become listless if the aliens had 3 hives up and they didn't have phase tech researched. They should continue to attack regardless
* Fixed issue where gorges would go nuts when trying to build defensive structures in an empty hive
* Aliens should be much more focused on evolving into fade/onos, including ignoring a hive under attack to first evolve so they can defend more effectively
2024-04-26 11:53:17 -04:00
RGreenlees
f6796ad025 Improve bot combat
* Reworked how bot hearing and sight combine
* Reworked target prioritisation
* Reworked when a bot should ignore a nearby enemy and engage
* Overall result is bots should have a better balance of engaging enemies and getting on with their tasks
2024-04-26 11:53:17 -04:00
RGreenlees
cfc65e1f5a Improved lerk flight
* Better lerk flight
* Fixed bots switching weapons rapidly
2024-04-26 11:53:17 -04:00
RGreenlees
540194cc6e Bots combine silence and cloak
* Bots will prefer to combine the silence and cloak upgrades if both are available and they have one of them already
2024-04-26 11:53:17 -04:00
pierow
c710fa347a
Merge pull request #177 from RGreenlees/BotHearing
Bot hearing
2024-04-22 03:26:18 -04:00
RGreenlees
7f75f80a6e Finish bot hearing 2024-04-20 19:52:59 +01:00
RGreenlees
2224c32a73 Include AvHAISoundQueue in project
* Bot hearing relies on the new AvHAISoundQueue files, so these must be added to the project
2024-04-19 16:15:29 +01:00
RGreenlees
f24261e416 Fixed bug with lift detection
* Bots no longer get perma-stuck when standing on the drill in Ragnarok (or similar situations in other maps)
* Fixed fades getting glued to the ceiling when trying to blink into a vent
* Fixed bots getting stuck on top of railings sometimes
* Fixed bots sometimes deciding to evolve in the ready room on certain maps
* Updated nav mesh for eclipse
2024-04-19 15:25:24 +01:00
RGreenlees
33b5fcbe82 Improved marine combat
* Improved hearing logic
* Improved marine combat decision making (they don't all cluster around the CC for no reason anymore)
* Bots can now hear regen sounds
2024-04-18 23:44:05 +01:00
RGreenlees
188b1dac32 Merge branch 'BotHearing' of https://github.com/RGreenlees/NS into BotHearing 2024-04-18 08:27:50 +01:00
RGreenlees
3073f7f60b Bot hearing started 2024-04-18 08:24:16 +01:00
pierow
efbbeacc48
Merge pull request #176 from ENSL/b9-animation-fixes
Weapon animation fixes
2024-04-17 22:45:37 -04:00
pierow
68b7278072 weapon animation fixes
- Fixed animation issues with pistol binary trigger and moved the binary triggering to client code
- Fixed reload animation not always playing
- Fixed numerous incorrect or broken alien weapon animations on every class
- Added transitional animation out of gorge building
2024-04-17 22:41:10 -04:00
pierow
d1da0553e8
Merge pull request #175 from RGreenlees/BotTweaks3
Bot tweaks3
2024-04-16 17:09:10 -04:00
pierow
ccebaff4ad
Merge branch 'develop' into BotTweaks3 2024-04-16 17:08:27 -04:00
RGreenlees
b1f1c6a660 Removed debug code 2024-04-16 19:57:26 +01:00
RGreenlees
3e36057948 Lift improvements
* Fixed bots getting into a clusterfuck when multiple try to use a lift at the same time.
* Improved nav meshes for various maps
* Added new console commands for debugging to force bots to evolve
* If there is no CC, infantry portal or hives in NS mode, bots will revert to deathmatch behaviour to finish the game
* Fixed bots flying off target when leaping/blinking sometimes
* If there is no armoury to retreat to, marines won't back off and will attack (stops clustering around the CC for no reason).
2024-04-16 17:39:23 +01:00
RGreenlees
9484517a15 Improved guard behaviour and randomisation
* Improved the bot guard behaviour
* Improved randomisation of bot names and chamber sequences
* Fixed bug where bots would drop hives within range of siege bases
* Fixed bug where requesting turret factories and sentry turrets from the AI commander would place a phase gate instead
2024-04-16 02:11:43 -04:00
RGreenlees
7d659fb8c2 Add cloak behaviour
Bots will no longer see cloaked players, and have a chance based on cloak level, movement and size of the players. Bots will also sneak when approaching enemies while cloaked.
2024-04-16 02:11:43 -04:00
RGreenlees
261ff5cef1 Improved guard behaviour and randomisation
* Improved the bot guard behaviour
* Improved randomisation of bot names and chamber sequences
* Fixed bug where bots would drop hives within range of siege bases
* Fixed bug where requesting turret factories and sentry turrets from the AI commander would place a phase gate instead
2024-04-14 20:50:26 +01:00
RGreenlees
7adeda4113 Add cloak behaviour
Bots will no longer see cloaked players, and have a chance based on cloak level, movement and size of the players. Bots will also sneak when approaching enemies while cloaked.
2024-04-12 16:40:50 +01:00
RGreenlees
0cb450605d Fix for CO end-game crash on marine victory
Fixed potential crash upon marine victory in combat mode, caused by trying to respawn aliens without an active hive.
2024-04-08 10:07:14 -04:00
RGreenlees
ddc8839d9a Fixed mistake in scan requests
Commander was dropping phase gates instead of scans. Oops!
2024-04-08 10:01:46 -04:00
RGreenlees
d886d9b2e3 bot ini and navmesh updates
* Added max match time to nsbots.ini
* Tweaked nav meshes for several maps
2024-04-08 10:01:46 -04:00
RGreenlees
27ed51035c Lerk improvements and bot names
* Improved lerk movement when it is not flying (i.e. being cautious)
* Users can now optionally add botnames.txt to the NS folder to define custom bot names
2024-04-08 10:01:46 -04:00
RGreenlees
e322e52619 Update AvHAIWeaponHelper.cpp 2024-04-08 10:01:46 -04:00
RGreenlees
dfcd4463ac Update AvHAIWeaponHelper.cpp 2024-04-08 10:01:46 -04:00
RGreenlees
d87bb3d600 Further bot enhancements
* Improved jump and blink movement
* Hopefully fixed bug with bots trying to walk between phase gates
* Fixed issue with bots constantly switching weapons when trying to reload
* Added a max AI time for a match, with bots throwing the game if there are no humans and it goes on too long (configurable in nsbots.ini, default is 90 minutes)
2024-04-08 10:01:46 -04:00
RGreenlees
eba41379e3 Improve bot vision, bug fixes
* Re-added the view frustum for bots
* Hopefully stopped bots getting permanently stuck trying to evolve an upgrade in an invalid place
* Bots will now leave the game after 2 hours if no humans playing (ignores human spectators)
2024-04-08 10:01:46 -04:00
RGreenlees
75469430ad Bot fixes
* Fixed bots targeting mines to attack
* Fixed crash on enabling bots after previously disabling them
* Fixed bots not handling doors correctly when enabling them after match start
2024-04-08 10:01:46 -04:00
RGreenlees
349cf7240f Added more commander requests
Armouries, Heavy armour and jetpacks can be requested
2024-04-08 10:01:46 -04:00
RGreenlees
44a1072fb3 Fix phantom electrical discharge
Fixed the bug causes electricity to arc across the map for clients out of replication range of the electrocuted player
2024-04-08 09:58:14 -04:00
pierow
56f992b6fe
Update README.md 2024-03-30 16:10:17 -04:00
pierow
91f2e4c0c0
Update README.md 2024-03-29 21:17:41 -04:00
pierow
4871012a51 Revert "hltv config update"
This reverts commit 1ee5881cf2.
2024-03-29 19:39:21 -04:00
pierow
a5239c575b update configs and readme 2024-03-29 19:37:15 -04:00
pierow
6506119264 add env_gamma 1.7 to ns_ragnarok 2024-03-29 19:37:15 -04:00
RGreenlees
9381cf6438 Updated Machina nav mesh
* Fixed nav mesh issue where bots could get stuck in one of the hives trying to drop down from a height if the hive was present
2024-03-28 18:34:33 -04:00
RGreenlees
936ef5d609 Fixed potential hang in path finding
* Fixed potential infinite loop in path finding
* Fixed bots sometimes getting stuck on doors permanently
2024-03-28 18:34:33 -04:00
RGreenlees
4efd22b709 Removed exception handling from bot config
* Removed all try/catch clauses due to build issues
2024-03-27 04:57:43 -04:00
pierow
09a9b4870f fix not healing at the armory after getting getting into the command chair with low health 2024-03-26 19:22:41 -04:00
pierow
09c48fa653 config updates 2024-03-26 19:22:41 -04:00
pierow
71e5051752 add cl_cmcancellast 2024-03-26 19:22:41 -04:00
RGreenlees
ddeb934179 Update bot ini and navmeshes 2024-03-26 19:16:46 -04:00
RGreenlees
c7efc37227 Rever accidental change to Linux fix 2024-03-26 19:16:46 -04:00
RGreenlees
4470feb4c5 Fixed bot crash with empty chat message
* Bot no longer causes a crash if a player submits an empty chat message
2024-03-26 19:16:46 -04:00
RGreenlees
b139fbf9b8 Better bot config handling and logging
* Bot config is no longer case-sensitive
* Listen server hosts now get console notifications on bot status, errors etc.
* Added safeguards around parsing the file to prevent bad values crashing
* Made mp_botautomode default to 1 and mp_botcommandermode default to 1
2024-03-26 19:16:46 -04:00
RGreenlees
67903b598e Weld tweak 2024-03-26 19:16:46 -04:00
RGreenlees
c6344df589 Weld and guard behaviour fix 2024-03-26 19:16:46 -04:00
RGreenlees
1cd837b372 Fixed bug with detecting door triggers 2024-03-26 19:16:46 -04:00
RGreenlees
f391176841 Door and movement improvements
* Fixed buttons having overly long wait times with bots
* Fixed issue with climbing walls in certain situations
2024-03-26 19:16:46 -04:00
pierow
3daa2f32e4 linux client update and config update 2024-03-23 16:54:55 -04:00
pierow
c4629d6113 update configs
- default zoom sensitivity ratio lowered to be closer to matching vertical monitor distance instead of 4/3 horizontal distance
2024-03-23 16:54:55 -04:00
pierow
b8f5f818bc update mapcycle, remove old cfg file 2024-03-23 16:54:55 -04:00
pierow
3cc9648ea7 add alternative env_gamma to ns_hera and ns_lost 2024-03-23 16:54:55 -04:00
pierow
58358d0927
Bot integration for v3.3b8 (#156)
* Initial bot commit

* Added server commands and cvars for adding AI players to the game.
* Added auto modes for automating the adding and removal of bots
* Bots connect to the server and join teams correctly

* Added round restart and new map detection for AI system

Push before new project added for detour

* Initial bot integration

* Integrated all basic bot code for navigation and task performing
* Added support for multi_managers to better understand how buttons and triggers affect doors

* Improved bot understanding of door triggers and weldables

* Reworked nav profiles

Nav profiles for bots are now dynamically updated to take into account changing capabilities, such as picking up a welder

* Improved bot door usage

* Added weldable obstacles back into navigation

Bots now understand how to get around weldable barriers

* Replaced fixed arrays with vectors

* Resource node and hive lists are now vectors.
* Further improved bot weld behaviour

* Added dynamic reachability calculations

When barriers and doors are open/closed, new reachability calculations are done for structures and items so bots understand when items/structures become reachable or unreachable as the match progresses.

* Added team-based reachability calculations

Reachabilities for structures and items are now based on the team, so bots understand when they can't reach a structure from their spawn point.

* Implemented long-range off-mesh connections and dynamic off-mesh connections

* Implemented fully dynamic off-mesh connections

Phase gates now use connections rather than custom path finding. Much more performant.

* Replaced arrays with vectors for simpler code

* Started Bot Swimming

* Bots understand trigger_changetarget

Bots can now navigate doors operated with a trigger_changetarget so they understand the sequence in which triggers must be activated to make it work

* Push before trying to fix long-range connections

* Implement new off-mesh connection system

* Redid population of door triggers

* Fixed trigger types and links to doors

* Added lift and moving platform support

* Lift improvements

* Bots avoid getting crushed under a lift when summoning it
* Bots are better at judging which stop a platform needs to be at

* Tweak lift and welder usage

* Fixed bug with multiple off-mesh connections close together

* Finish lift movement

* Fixed dodgy path finding

* Improved skulk ladder usage and lerk lift usage

* Fix crash with path finding

* Re-implement commander AI

* Commander improvements

* Improve commander sieging

* Commander scanning tweak

* Reimplemented regular marine AI

* Start reimplementing alien AI

* Implement gorge building behaviours

* Start alien tactical decisioning

* Continuing alien building and other non-combat logic

* More alien role work

* Adjusted base node definitions

* Iterate Capper Logic

* Alien assault AI

* Alien Combat

* Fix grenade throwing, better combat

* Marine combat AI improvements

* Commander improvements

* Commander + nav improvements

* Drop mines

* Improved bot stuck detection

* Commander supply improvements

* Bot fill timing config

* Added nsbots.cfg to configure internal bots

* Changed bot config file to "nsbots.cfg"

* Bug fixing with navigation

* Fix skulk movement on ladders

* Improved commander placement and tactical refresh

* Fixed bug with ladder climbing

* Doors block off-mesh connections

* Finished doors blocking connections

* Marine and alien tactical bug fixes

* Add commander beacon back in

* Start combat mode stuff

* First pass at combat mode

* Bots attack turrets

* Fix ladder and wall climbing

* Commander chat request

* Improved skulk ladders

* Added nav meshes for new bot code

* Added bot configuration to listen server menu

* Added bot config file

* Added default bot config to listenserver.cfg

* Added default bot settings to server.cfg

* Include VS filter for bot files

* Crash fixes

* Bot improvements

* Bot stability and mine placement improvements

* Fixed crash on new map start with bots

* Reverted Svencoop fix

* Fixed crash, added more cvars

* Performance improvement

* Commander building improvements

* Stop bot spasming when waiting to take command

* Fixed doors not blocking connections

* Added bot disabled guard to round start

* Commander improvements, movement improvements

* Tweaked level load sequence

* Performance improvements

* Bot load spread

* Fixed commander update

* Refactor bot frame handling

* Bug fixes + Pierow's dynamic load spread

* Minor bug fixes

* Fix door detection, prep for test

* Fixed commander siege spam

* linux compile test

* fix hardcoded inlcudes

* O1 compile flag for detour
- fix linux server crash

* Revert detour compile flags to original for windows

* linux build update

* remove x64 build configs

* update bot nav meshes and configs

* fix bot physics at high server fps, update navmeshes. from @RGreenlees

---------

Co-authored-by: RGreenlees <RGreenlees@users.noreply.github.com>
Co-authored-by: RichardGreenlees <richard.greenlees@forecast.global>
2024-03-21 14:17:18 -04:00
pierow
acc1056ec8
Merge pull request #155 from ENSL/v33b8
Version 3.3b8
2024-03-21 14:12:46 -04:00
pierow
1ee5881cf2 hltv config update 2024-03-21 14:10:29 -04:00
pierow
b615902e94 configs update 2024-03-21 12:57:44 -04:00
pierow
34a62c747b remove pistol script references from team configs 2024-03-21 01:50:36 -04:00
pierow
48addfdd2f revert titlescreen music rename 2024-03-21 00:54:47 -04:00
pierow
a411958a1e Remove ResetGamma.exe 2024-03-21 00:33:48 -04:00
pierow
1677f6d7c8 remove title track from in-game music programatically 2024-03-21 00:33:13 -04:00
pierow
adb875bc40 server cvars update 2024-03-16 16:49:18 -04:00
pierow
1e7fa6f61e update hivesight labels 2024-03-15 21:07:59 -04:00
pierow
3b4c2d98dd blockcsripts default 0 2024-03-15 12:41:54 -04:00
pierow
202889488b fix linux server crash 2024-03-13 18:42:07 -04:00
pierow
417892f507 presets and 33b8 update
- adjust hivesight labels to be less visibile if they're not being attacked
- add crosshair scaling when above 1080p
- fix music not playing after the first map
- config updates
2024-03-13 09:10:50 -04:00
pierow
de3ae12236 increase listen server default player size 2024-03-12 08:05:13 -04:00
pierow
42346aee87 fix crash after getting kicked from a server 2024-03-12 08:04:52 -04:00
pierow
0e53e0ee3d revise new maxunlag value
-300ms because some intercontinental players spike over 250ms
2024-03-11 07:16:13 -04:00
pierow
90ebbdda23 presets update
- add network rate presets
- add cl_intensityalt for alternative gamma ramp in env_gamma map entities
- separate welder flickering dynamic light setting
- crosshair updates
2024-03-10 16:58:37 -04:00
pierow
833eb0a792 merge in HL25 fixes 2024-03-04 23:29:53 -05:00
pierow
1dc828e071 force sv_allow_shaders 0 2024-03-04 23:15:08 -05:00
pierow
856e71f05a healspray +movement and cl_weaponcfgs improvements 2024-03-04 23:10:56 -05:00
pierow
3220c418ed fix func_nobuilds underneath the map preventing commanders from dropping structures 2024-03-04 22:15:18 -05:00
pierow
3e404baff8 ns presets update
- add new default crosshairs, enabled with cl_weaponcfgs 2
- crosshair bugfixes
- add box crosshair and sub-pixel outline control
- cl_musicdelay -1 plays a track once at start of round
- removed title track from gameplay (main menu only)
- cl_bob cvars archived
- remove HL-style tilting weapon bob in spectate
- sv_randomrfk default off
- more gamma ramp removal
- remove valve shader hash check
- archive showspeed cvar
- update debug and playtest solutions for GLEW
- add HL25 wav file for button select (button rollover sound was removed in HL25)
2024-03-04 22:13:32 -05:00
pierow
0bdc52796f presets and postprocessing update 2024-02-29 01:33:35 -05:00
pierow
dcb4de963d merge in postprocessing 2024-02-28 22:46:22 -05:00
pierow
8ab1a69972 add postprocessing
- add GLSL postprocessing shader to world view and have it replicate the old gamma ramp
- clear framebuffer between frames to fix visual bugs outside map
- remove old gamma ramp code (was disabled) and remove gamma adjustments to hud elements as they're now unaffected by the shader
- additional visual preset config updates
2024-02-28 22:36:49 -05:00
pierow
c5c338ba3d preset switcher update WIP 2024-02-07 00:51:12 -05:00
pierow
0688b2ef65 fix pistol firing when closing game menu or tabbing in 2024-02-07 00:48:35 -05:00
pierow
5636d7a103 NS preset switcher update WIP 2024-02-04 04:08:01 -05:00
pierow
ceb814f4f6 weapons update
- add pistol binary trigger aka pistol script and attack queueing
- add gorge heal spray +movement
- lerk flap +movement update
- fix for onos attack release bugs with +movement
2024-02-04 04:05:28 -05:00
pierow
a024343cb0 consistency check shader files 2024-01-30 01:02:54 -05:00
pierow
8fde5dc37c NS preset switcher WIP
- needs sv_allow_shaders and hl25 at the moment and it piggybacks off the hl25 overbright shader using the average gamma ramp setting for ns maps.
2024-01-30 01:02:16 -05:00
pierow
4b1ec43d81
Update README.md 2024-01-21 18:20:56 -05:00
pierow
61c7fc5d9c reduce sticking to diagonal walls. Credit to @AltimorTASDK 2024-01-14 17:41:48 -05:00
pierow
e59ea9b87f readd line deleted in error 2024-01-14 17:36:59 -05:00
pierow
ae447029c0 add cl_bobview 2024-01-14 16:57:25 -05:00
pierow
abef5c5cca fix view spin when disabling the cursor
-revisit this when HL25 SDK is released
2024-01-13 21:22:04 -05:00
pierow
48da9f7260 add lerk flap to +movement 2024-01-08 13:22:32 -05:00
pierow
2c339fb9fd
Update README.md 2024-01-07 10:24:40 -05:00
pierow
56512a8f45 additional removal of old widescreen 2023-12-06 05:46:16 -05:00
pierow
0e88d368b9 HL25 fixes
-Add new widescreen method and exploit prevention
-disable old widescreen method and exploit prevention
-force sv_rollangle 0
-add sv_widescreenclamp to limit fov expansion to 16:9
2023-11-27 16:01:49 -05:00
pierow
bf34643be3 revise mouse paramater comments 2023-11-25 13:46:15 -05:00
pierow
deffcba07c sv_rollangle 0 2023-11-25 13:44:53 -05:00
pierow
44ffcf24fd version number to v33b8 2023-11-21 03:48:12 -05:00
pierow
e435bdad29 version number to v33b8 2023-11-21 03:46:47 -05:00
pierow
5fc8493b9a Fix crash in debug mode when spectating aliens. Credit to Neoptolemus. 2023-11-21 03:43:56 -05:00
pierow
5b68b5a778
Update README.md 2023-11-17 14:08:33 -05:00
pierow
9f324e47b0 Fix crash when player completes a commander order. Credit to @RGreenlees
- The crash possibly only occured in debug mode?
2023-10-22 23:24:42 -04:00
pierow
1748d39d7e fix for typing another key in chat before releasing enter key causing it to send the message 2023-10-04 18:11:40 -04:00
pierow
a04cc4fd40 add check for recent saying counter not resetting 2023-10-04 18:10:53 -04:00
pierow
61f3c7be61 fix mouse centering not working correctly with non-native fullscreen resolutions 2023-10-01 17:48:57 -04:00
pierow
dfd82fcec5 add cl_weaponswap 2 to default config.cfg
-fixes server assuming cvar is 0 for clients that boot the game for the first time
2023-09-30 14:34:39 -04:00
RGreenlees
bf37abf714 Gorge web fixes for collision detection
* Webs placed on the floor now correctly connect with marines walking over them
* Allies and structures no longer block the web's effect if they're between the enemy and the web origin point
2023-09-26 14:37:11 -04:00
pierow
bebb696e50 fix health rings showing on the gorge being spectated while dead 2023-09-26 08:36:11 -04:00
pierow
c2df0b2715
Update README.md 2023-09-16 14:19:25 -04:00
308 changed files with 130135 additions and 1458 deletions

View file

@ -1,6 +1,6 @@
# Natural Selection v3.3 # Natural Selection v3.3
An updated build of the game [Natural Selection] for Windows and Linux focused on quality-of-life improvements and bug fixes. For a new custom-built bot for NS, go check out [Evobot]. An updated build of the game [Natural Selection] for Windows and Linux focused on quality-of-life improvements and bug fixes.
## Downloads ## Downloads
@ -8,13 +8,14 @@ The **[Natural Selection Launcher](https://github.com/ENSL/NaturalLauncher/relea
**[Manual installation](https://github.com/ENSL/NS/releases)** (Windows / Linux) **[Manual installation](https://github.com/ENSL/NS/releases)** (Windows / Linux)
As the game is a Half-Life mod, Steam and Half-Life installations are required to play the game. As the game is a Half-Life mod, Steam and Half-Life installations are required to play the game. After installing, restart steam.
A fresh install of NS comes with updated config files containing everything you need to get playing on the standard settings most players prefer. Customization options are built into the advanced options menu, like the Nine Legends competitive UI option. For further customization, team and weapon specific config files are also now available. A fresh install of NS comes with updated config files containing everything you need to get playing on the standard settings most players prefer. Customization options are built into the advanced options menu, like the Nine Legends competitive UI option. For further customization, team and weapon specific config files are also now available.
## Game not working? Troubleshooting tips ## Game not working? Troubleshooting tips
If the game doesn't load, check the following: If the game doesn't load, check the following:
1. Restart steam after installation to be able to play the game.
1. If you recieve a "could not load library" error for the client.dll, please install the **[latest Microsoft Visual C++ Redistributable package](https://aka.ms/vs/17/release/vc_redist.x86.exe)**. 1. If you recieve a "could not load library" error for the client.dll, please install the **[latest Microsoft Visual C++ Redistributable package](https://aka.ms/vs/17/release/vc_redist.x86.exe)**.
1. Make sure you have verified Half-Life's integrity. Click [here](https://support.steampowered.com/kb_article.php?ref=2037-QEUH-3335) for detailed instructions. 1. Make sure you have verified Half-Life's integrity. Click [here](https://support.steampowered.com/kb_article.php?ref=2037-QEUH-3335) for detailed instructions.
1. Check if Half-Life works for you. 1. Check if Half-Life works for you.
@ -28,18 +29,22 @@ For Linux:
## Changes ## Changes
Updates include: Update highlights:
- Widescreen support (now expands FOV up to 16:9 aspect instead of cropping the image) - Many new audio and visual options, including the "gamma ramp" restored as a post-processing shader
- AI upscaled model textures can be turned on with the "Use High Definition models" video option - Integrated bot players
- Many FPS dependent bugs fixed, including jetpack acceleration, so the game can now be fairly played at 200+ FPS - Widescreen support
- Quake style queued jumping to make bunnyhopping more accessible (server adjustable via sv_jumpmode) - AI upscaled model textures can be turned on with the "Use High Definition models" HL video option
- Shotgun and grenade launcher have been reworked to fix reload bugs and animate better - Many FPS-dependent bugs fixed, including jetpack acceleration, so the game can now be fairly played at 200+ FPS
- Quake-style queued jumping to make bunnyhopping more accessible (server adjustable via sv_jumpmode)
- The shotgun and grenade launcher have been reworked to fix reload bugs and animate better
- The "pistol script" is now a standard feature as a toggleable binary trigger
- Weapon reloads are now predicted on the client - Weapon reloads are now predicted on the client
- New minimal HUD and the Nine Legends HUD can be selected through advanced options or hud_style and hud_mapstyle - Player names are now shown on the minimap
- New crosshair system that can be adjusted through the advanced options and cl_cross commands (Thanks [OpenAG](https://github.com/YaLTeR/OpenAG))
- Ambient sounds can be changed in advanced options or via cl_ambientsound
- The marine HUD now tracks research progress and the alien HUD tracks hive growth - The marine HUD now tracks research progress and the alien HUD tracks hive growth
- Teammate health or armor status rings are now shown to players that can heal or repair them
- New minimal and Nine Legends HUDs are available
- A New crosshair system (Modified from [OpenAG](https://github.com/YaLTeR/OpenAG))
- Raw input and sensitivity scaling options are now available and non-accelerated mouse input is now default - Raw input and sensitivity scaling options are now available and non-accelerated mouse input is now default
- The many other improvements, customization options, and bug fixes can be found in the [release notes](https://github.com/ENSL/NS/releases) - The many other improvements, customization options, and bug fixes can be found in the [release notes](https://github.com/ENSL/NS/releases)
@ -48,15 +53,21 @@ Updates include:
How to set up a dedicated [Natural Selection] server with [HLDS]: How to set up a dedicated [Natural Selection] server with [HLDS]:
1. Follow these steps to get steamCMD installed and HLDS updated in it: https://developer.valvesoftware.com/wiki/SteamCMD 1. Follow these steps to get steamCMD installed and HLDS updated in it: https://developer.valvesoftware.com/wiki/SteamCMD
2. You'll want to run `app_update 90 validate` multiple times in steamCMD to install HLDS and fully update it, as it won't completely do it the first time. 1. Set the HLDS install directory after opening steamcmd and before logging in. The following steps assume a directory named `hlds` from doing `force_install_dir ./hlds/`
3. Copy the `ns` directory into the `hlds` directory after installing HLDS from steamcmd 1. You'll want to run `app_update 90 validate` multiple times in steamCMD to install HLDS and fully update it, as it won't completely do it the first time.
4. For Linux servers: 1. Copy the `ns` directory into the `hlds` directory after installing HLDS from steamcmd
1. For Linux servers:
- Remove or rename the `libstdc++so.6` in the `hlds` directory so the linux distro's can be used instead. The one steam provides is outdated. You may need to rename the `libgcc.so.1` file in the same directory as well. - Remove or rename the `libstdc++so.6` in the `hlds` directory so the linux distro's can be used instead. The one steam provides is outdated. You may need to rename the `libgcc.so.1` file in the same directory as well.
- 32 bit C libraries might need to be installed. Try `apt-get install libc6-i386` if on debian or ubuntu. The libm.so.6 from it may need to be placed in your HLDS folder if you cannot install that package. - 32 bit C libraries might need to be installed. Try `apt-get install libc6-i386` if on debian or ubuntu. The libm.so.6 from it may need to be placed in your HLDS folder if you cannot install that package.
5. Run the game : 1. Run the game:
```sh - Linux:
./hlds_run -game ns +map ns_eclipse + sv_secure 1 + port 27015 +hostname "Natural Selection" +maxplayers 32 ```sh
``` ./hlds_run -game ns +map ns_eclipse +sv_secure 1 +port 27015 +hostname "Natural Selection" +maxplayers 32
```
- Windows:
```cmd
hlds.exe -console -game ns +map ns_eclipse +sv_secure 1 +port 27015 +hostname "Natural Selection" +maxplayers 32
```
If you are behind a NAT(Router) make sure to open at least those ports: If you are behind a NAT(Router) make sure to open at least those ports:
- 27015 UDP (game transmission, pings) - 27015 UDP (game transmission, pings)
@ -69,10 +80,40 @@ In order to check if your server is connected to the steam servers copy the foll
There is an updated version of metamod called [metamod-p](https://github.com/APGRoboCop/metamod-p/). There is an updated version of metamod called [metamod-p](https://github.com/APGRoboCop/metamod-p/).
There are a few different bots for Natural Selection, with Evobot being the newest and most comprehensive: To run NS plugins, please use the [updated build of AMX](https://github.com/pierow/amxmodx-ns/releases) that supports this version of NS.
* [Evobot]
## Bots
Evobot is integrated in NS 3.3 and can be configured in the listen server creation UI or via the following commands in the `server.cfg` for dedicated servers:
```
mp_botsenabled (0/1) Bots are enabled Y/N
mp_botautomode (0-2) (0 = manually add/remove bots, 1 = Maintain min player counts, 2 = Keep teams balanced only)
mp_botskill (0-3) Bot skill (0 = Easiest, 3 = Hardest)
mp_botcommandermode (0-2) (0 = Bot never commands, 1 = Bot commands after mp_botcommanderwait seconds if nobody else does, 2 = Bot only commands if no humans are on the team)
mp_botcommanderwait (0..) How long the bot should wait before taking command (if allowed to)
mp_botusemapdefaults (0/1) Use the map min player counts defined in nsbots.ini Y/N
mp_botminplayers (0-32) If not using map defaults, maintain this player population for all maps
mp_botallowlerk (0/1) Bot is allowed to evolve lerk Y/N
mp_botallowfade (0/1) Bot is allowed to evolve fade Y/N
mp_botallowonos (0/1) Bot is allowed to evolve onos Y/N
mp_botlerkcooldown (0..) After a lerk is killed, how long in seconds should the bot wait to evolve again (default 60s)
mp_botmaxstucktime (0..) If a bot is stuck longer than this time (in seconds) it will suicide (default 15s)
mp_botdebugmode (0-2) (0 = Disabled, 1 = Drone Mode, 2 = Test Nav Mode). Use test nav mode to validate your nav files.
sv_botadd <Team> If mp_botautomode is 0, this will manually add a bot to team 1 or 2. If Team is 0, it will assign randomly
sv_botremove <Team> If mp_botautomode is 0, this will manually remove a bot from team 1 or 2. If Team is 0, it will remove randomly
sv_botregenini If your copy of nsbots.ini is lost or corrupted, this will generate a fresh one
bot_cometome If mp_botdebugmode is 1, this will force the bot to come to you. Helps test your nav file.
bot_drawoffmeshconns Will draw the off-mesh connections present in the loaded navigation file, color-coded based on connection type
bot_drawtempobstacles Will draw nearby temporary obstacles affecting the nav mesh
```
The bot system uses a modified version of the Detour library from [recastnavigation](https://github.com/recastnavigation/recastnavigation).
Other bot plugins:
* [RCbot](http://rcbot.bots-united.com/) * [RCbot](http://rcbot.bots-united.com/)
* [Whichbot](https://whichbot.sourceforge.net/) * [Whichbot](https://whichbot.sourceforge.net/)
* [Commander AI](https://github.com/jac95501/-NS-Commander-AI)
## Compiling ## Compiling

Binary file not shown.

View file

@ -1,5 +1,4 @@
//Alien cfg that is part of a default installation on the NS Launcher. //Alien cfg that is part of a default installation on the NS Launcher.
//Activated by joining or spawning on aliens. //Activated by joining or spawning on aliens.
//bind "mouse2" "+movement" //bind "mouse2" "+movement"
//psoff

View file

@ -59,14 +59,13 @@ bind "MWHEELUP" "invprev"
bind "MOUSE1" "+attack" bind "MOUSE1" "+attack"
bind "MOUSE2" "+movement" bind "MOUSE2" "+movement"
bind "MOUSE3" "+popupmenu" bind "MOUSE3" "+popupmenu"
bind "MOUSE4" "lastinv"
bind "PAUSE" "pause" bind "PAUSE" "pause"
_snd_mixahead "0.1" _snd_mixahead "0.1"
ati_npatch "0" ati_npatch "0"
ati_subdiv "0" ati_subdiv "0"
bgmvolume "1.000000" bgmvolume "1.000000"
bottomcolor "144.889999" bottomcolor "144.889999"
brightness "5" brightness "0"
cl_allowdownload "1" cl_allowdownload "1"
cl_allowupload "1" cl_allowupload "1"
cl_autohelp "1.0" cl_autohelp "1.0"
@ -80,9 +79,9 @@ cl_dlmax "128"
cl_download_ingame "1" cl_download_ingame "1"
cl_dynamiclights "0" cl_dynamiclights "0"
cl_forcedefaultfov "0" cl_forcedefaultfov "0"
cl_gammaramp "0"
cl_highdetail "1" cl_highdetail "1"
cl_himodels "0" cl_himodels "0"
cl_hudmapzoom "2"
cl_iconb "221" cl_iconb "221"
cl_icong "149" cl_icong "149"
cl_iconr "0" cl_iconr "0"
@ -90,14 +89,17 @@ cl_idealpitchscale "0.8"
cl_labelhivesight "1" cl_labelhivesight "1"
cl_labelmaps "1" cl_labelmaps "1"
cl_lc "1" cl_lc "1"
cl_intensity "0.55"
cl_intensityalt "1"
cl_logocolor "#Valve_Orange" cl_logocolor "#Valve_Orange"
cl_logofile "lambda" cl_logofile "lambda"
cl_lw "1" cl_lw "1"
cl_musicdelay "90" cl_musicdelay "-1"
cl_musicdirectory "" cl_musicdirectory ""
cl_musicvolume "155" cl_musicvolume "0.6"
cl_musicenabled "0" cl_musicenabled "1"
cl_particleinfo "0" cl_particleinfo "0"
cl_postprocessing "1"
cl_quickselecttime ".15" cl_quickselecttime ".15"
cl_timeout "60" cl_timeout "60"
cl_updaterate "100" cl_updaterate "100"
@ -108,15 +110,16 @@ crosshair "0"
fps_max "250" fps_max "250"
fps_override "1" fps_override "1"
fps_modem "0.0" fps_modem "0.0"
gamma "3" gamma "2.95"
gl_vsync "0"
gl_dither "1" gl_dither "1"
gl_flipmatrix "0" gl_flipmatrix "0"
gl_fog "1" gl_fog "1"
gl_monolights "0" gl_monolights "0"
gl_overbright "1" gl_overbright "0"
gl_polyoffset "0.1" gl_polyoffset "0.1"
gl_texturemode "GL_LINEAR_MIPMAP_LINEAR" gl_texturemode "GL_LINEAR_MIPMAP_LINEAR"
gl_use_shaders "0"
gl_vsync "0"
hisound "1" hisound "1"
hpk_maxsize "4" hpk_maxsize "4"
hud_capturemouse "1" hud_capturemouse "1"
@ -135,12 +138,13 @@ m_side "0.8"
m_yaw "0.022" m_yaw "0.022"
model "barney" model "barney"
MP3FadeTime "2.0" MP3FadeTime "2.0"
MP3Volume "0" MP3Volume "0.4"
mp_decals "300" mp_decals "300"
name "NSPlayer" name "NSPlayer"
net_graph "0" net_graph "0"
net_graphpos "1" net_graphpos "1"
net_scale "5" net_scale "5"
rate "100000"
r_bmodelhighfrac "5.0" r_bmodelhighfrac "5.0"
r_detailtextures "0" r_detailtextures "0"
s_a3d "0.0" s_a3d "0.0"
@ -172,14 +176,18 @@ voice_enable "1"
voice_forcemicrecord "1" voice_forcemicrecord "1"
voice_modenable "1" voice_modenable "1"
voice_scale "1" voice_scale "1"
volume "0.500000" volume "0.400000"
m_rawinput "1" m_rawinput "1"
zoom_sensitivity_ratio "1" zoom_sensitivity_ratio "0.97"
lightgamma "2" lightgamma "1.81"
ex_interp "0.05" ex_interp "0.05"
cl_cross "1" cl_cross "1"
rate "30000" cl_bob "0.005"
cl_bob "0" cl_bobcycle "0.8"
cl_bobup "0.5"
cl_weaponswap "2"
cl_pistoltrigger "1"
cl_weaponcfgs "2"
+mlook +mlook
exec userconfig.cfg exec userconfig.cfg

8
main/defaultvideo.cfg Normal file
View file

@ -0,0 +1,8 @@
// NS 3.3 video settings to be executed after patching to b8.
brightness "0"
gamma "2.95"
lightgamma "1.81"
cl_dynamiclights "0"
cl_postprocess "1"
cl_intensity "0.55"
cl_intensityalt "1"

View file

@ -237,14 +237,16 @@ weapon_data_t none
DEFINE_DELTA( m_flNextSecondaryAttack, DT_FLOAT | DT_SIGNED, 22, 1000.0 ), DEFINE_DELTA( m_flNextSecondaryAttack, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
DEFINE_DELTA( m_iClip, DT_SIGNED | DT_INTEGER, 10, 1.0 ), DEFINE_DELTA( m_iClip, DT_SIGNED | DT_INTEGER, 10, 1.0 ),
// DEFINE_DELTA( m_flPumpTime, DT_FLOAT | DT_SIGNED, 22, 1000.0 ), // DEFINE_DELTA( m_flPumpTime, DT_FLOAT | DT_SIGNED, 22, 1000.0 ),
DEFINE_DELTA( m_fInSpecialReload, DT_INTEGER, 3, 1.0 ), DEFINE_DELTA( m_fInSpecialReload, DT_INTEGER, 2, 1.0 ),
DEFINE_DELTA( m_fReloadTime, DT_FLOAT, 16, 100.0 ), DEFINE_DELTA( m_fReloadTime, DT_FLOAT, 16, 100.0 ),
DEFINE_DELTA( m_fInReload, DT_INTEGER, 1, 1.0 ), DEFINE_DELTA( m_fInReload, DT_INTEGER, 1, 1.0 ),
// DEFINE_DELTA( m_fAimedDamage, DT_FLOAT, 6, 0.1 ), // DEFINE_DELTA( m_fAimedDamage, DT_FLOAT, 6, 0.1 ),
// DEFINE_DELTA( m_fInZoom, DT_INTEGER, 1, 1.0 ), // DEFINE_DELTA( m_fInZoom, DT_INTEGER, 1, 1.0 ),
// DEFINE_DELTA( m_iWeaponState, DT_INTEGER, 2, 1.0 ), // DEFINE_DELTA( m_iWeaponState, DT_INTEGER, 2, 1.0 ),
DEFINE_DELTA( m_iId, DT_INTEGER, 8, 1.0 ), DEFINE_DELTA( m_iId, DT_INTEGER, 8, 1.0 ),
DEFINE_DELTA( iuser2, DT_INTEGER, 1, 1.0 ), // m_fInAttack
DEFINE_DELTA( iuser3, DT_INTEGER, 3, 1.0 ), DEFINE_DELTA( iuser3, DT_INTEGER, 3, 1.0 ),
DEFINE_DELTA( iuser4, DT_INTEGER, 1, 1.0 ), // m_bAttackQueued
DEFINE_DELTA( fuser2, DT_SIGNED | DT_FLOAT, 22, 128.0 ), DEFINE_DELTA( fuser2, DT_SIGNED | DT_FLOAT, 22, 128.0 ),
DEFINE_DELTA( fuser3, DT_SIGNED | DT_FLOAT, 22, 128.0 ) DEFINE_DELTA( fuser3, DT_SIGNED | DT_FLOAT, 22, 128.0 )
} }

0
main/events/Mine.sc Normal file
View file

View file

@ -56,6 +56,13 @@ mp_killdelay 3
mp_flashlight 1 mp_flashlight 1
mp_footsteps 1 mp_footsteps 1
// AI Player Settings
mp_botusemapdefaults 1
mp_botminplayers 0
mp_botallowlerk 1
mp_botallowfade 1
mp_botallowonos 1
// disable autoaim and mad gibs // disable autoaim and mad gibs
sv_aim 0 sv_aim 0
violence_hgibs 0 violence_hgibs 0
@ -67,7 +74,8 @@ sv_clienttrace 3.5
/////////////////////////////// ///////////////////////////////
// Dedicated server specific // // Dedicated server specific //
/////////////////////////////// ///////////////////////////////
sv_lan 0 // Let GUI determine lan for listen servers.
//sv_lan 0
// Forces a limit on structures on the server // Forces a limit on structures on the server
sv_structurelimit 300 sv_structurelimit 300
@ -83,3 +91,14 @@ mp_uplink 0
// Needed so this file is executed on map change, like pre-NS v2.1 // Needed so this file is executed on map change, like pre-NS v2.1
mapchangecfgfile listenserver.cfg mapchangecfgfile listenserver.cfg
//Post HL 25th Aniversary update
sv_rollangle 0
sv_allow_shaders 0
// Set rate limits, otherwise they initialize to bad values
sv_maxupdaterate 102
sv_maxunlag 0.3
sv_maxrate 0
sv_minrate 20000
sv_minupdaterate 30

View file

@ -33,6 +33,7 @@ ns_lost "\minplayers\16\maxplayers\32\"
ns_machina "\minplayers\16\maxplayers\24\" ns_machina "\minplayers\16\maxplayers\24\"
ns_nothing "\minplayers\16\maxplayers\32\" ns_nothing "\minplayers\16\maxplayers\32\"
co_niveus "\minplayers\4\maxplayers\20\" co_niveus "\minplayers\4\maxplayers\20\"
ns_ragnarok "\minplayers\16\maxplayers\32\"
co_faceoff "\minplayers\0\maxplayers\18\" co_faceoff "\minplayers\0\maxplayers\18\"
co_daimos "\minplayers\8\maxplayers\20\" co_daimos "\minplayers\8\maxplayers\20\"
ns_bast "\minplayers\14\maxplayers\28\" ns_bast "\minplayers\14\maxplayers\28\"
@ -44,6 +45,7 @@ co_umbra "\minplayers\8\maxplayers\20\"
ns_nancy "\minplayers\14\maxplayers\32\" ns_nancy "\minplayers\14\maxplayers\32\"
ns_veil "\minplayers\16\maxplayers\32\" ns_veil "\minplayers\16\maxplayers\32\"
co_core "\minplayers\0\maxplayers\20\" co_core "\minplayers\0\maxplayers\20\"
ns_askr_b6 "\minplayers\16\maxplayers\32\"
co_ulysses "\minplayers\4\maxplayers\20\" co_ulysses "\minplayers\4\maxplayers\20\"
ns_eclipse "\minplayers\14\maxplayers\32\" ns_eclipse "\minplayers\14\maxplayers\32\"
co_pulse "\minplayers\0\maxplayers\20\" co_pulse "\minplayers\0\maxplayers\20\"

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,4 @@
//Marine cfg that is part of a default installation on the NS Launcher. //Marine cfg that is part of a default installation on the NS Launcher.
//Activated by pressing joining or spawning on marines. //Activated by pressing joining or spawning on marines.
//bind "mouse2" "impulse 10"
//bind "mouse2" "impulse 10"
//pson

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/co_angst.nav Normal file

Binary file not shown.

BIN
main/navmeshes/co_core.nav Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/co_pulse.nav Normal file

Binary file not shown.

BIN
main/navmeshes/co_sava.nav Normal file

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/co_umbra.nav Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/ns_ayumi.nav Normal file

Binary file not shown.

BIN
main/navmeshes/ns_bast.nav Normal file

Binary file not shown.

BIN
main/navmeshes/ns_caged.nav Normal file

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/ns_eon.nav Normal file

Binary file not shown.

BIN
main/navmeshes/ns_hera.nav Normal file

Binary file not shown.

BIN
main/navmeshes/ns_lost.nav Normal file

Binary file not shown.

BIN
main/navmeshes/ns_lucid.nav Normal file

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/ns_metal.nav Normal file

Binary file not shown.

BIN
main/navmeshes/ns_nancy.nav Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/ns_shiva.nav Normal file

Binary file not shown.

Binary file not shown.

BIN
main/navmeshes/ns_veil.nav Normal file

Binary file not shown.

96
main/nsbots.ini Normal file
View file

@ -0,0 +1,96 @@
### General bot settings ###
# What prefix to put in front of a bot's name (can leave blank)
Prefix=[BOT]
# After this many minutes into a match, the bots will leave the game if there are no humans playing
# Helps prevent stalemates and bugs that happen after extremely long matches
# Default = 90 minutes
MaxAIMatchTime=90
# When should the server start adding bots? Note: bots will always be added after round start regardless
# 0 = On map load (after 5 second grace period)
# 1 = When all humans have joined a team (i.e. no more humans left in ready room)
# 2 = When the round has started (after countdown)
BotFillTiming=1
# Chance the AI commander will try to relocate to an empty hive at match start
# Value is a decimal between 0.0 and 1.0, with 0 being never and 1 being always
# Note that setting relocation chance to 0.0 will also disable ANY relocation at any time
RelocationChance=0.2
### Skill Settings ###
# Bot skill settings. There are 4 settings from 0 - 3 for easiest - hardest
# Use BotSkillName=<index> to start defining a skill level, then the following:
# ReactionTime = How quickly in seconds the bot will react to sighting enemies
# AimSkill = How accurately the bot can lock sights on you after seeing you (0.0 - 1.0)
# MovementTracking = How accurately the bot can follow a moving target (0.0 - 1.0)
# ViewSpeed = How fast the bot can swivel its view (0.1 - 2.0)
# Set the difficulty using the 'mp_botskill' cvar (0 - 3)
BotSkillLevel=0
MarineReactionTime=0.4
MarineAimSkill=0.1
MarineMovementTracking=0.1
MarineViewSpeed=0.5
AlienReactionTime=0.5
AlienAimSkill=0.2
AlienMovementTracking=0.2
AlienViewSpeed=0.75
BotSkillLevel=1
MarineReactionTime=0.2
MarineAimSkill=0.5
MarineMovementTracking=0.4
MarineViewSpeed=1.0
AlienReactionTime=0.2
AlienAimSkill=0.5
AlienMovementTracking=0.5
AlienViewSpeed=1.3
BotSkillLevel=2
MarineReactionTime=0.2
MarineAimSkill=0.6
MarineMovementTracking=0.6
MarineViewSpeed=1.5
AlienReactionTime=0.2
AlienAimSkill=0.8
AlienMovementTracking=0.8
AlienViewSpeed=1.5
BotSkillLevel=3
MarineReactionTime=0.1
MarineAimSkill=1.0
MarineMovementTracking=1.0
MarineViewSpeed=2.0
AlienReactionTime=0.1
AlienAimSkill=1.0
AlienMovementTracking=1.0
AlienViewSpeed=2.0
# Desired team sizes. Only used if bot fill mode is 'fillteams'
# Format is TeamSize=mapname:nummarines/numaliens
# 'default' will be used if playing a map not listed below
TeamSize=default:7/7
TeamSize=ns_machina:8/8
TeamSize=ns_ragnarok:8/8
TeamSize=ns_askr_b5:8/8
TeamSize=ns_askr_b6:8/8
TeamSize=co_faceoff:4/4
TeamSize=co_core:4/4
TeamSize=co_pulse:6/6
TeamSize=co_ulysses:6/6
TeamSize=co_niveus:5/5
TeamSize=co_kestrel:5/5
### Alien Settings ###
# Preferred chamber sequence. Valid entries are 'defense', 'movement' and 'sensory'. Separate sequence with forward slash
# You can also use ? for random, so if you want movement always first but then defense and sensory at random, use
# ChamberSequence:movement/?/?
# Or if you want sensory always last, but movement and defence random, use
# ChamberSequence=?/?/sensory
ChamberSequence=?/?/?

View file

@ -0,0 +1,44 @@
// Bright Lighting
brightness "2"
gamma "3"
lightgamma "2"
cl_dynamiclights "0"
cl_postprocess "0"
cl_intensity "0"
cl_intensityalt "1"
// High detail particles
//cl_high_detail "0"
// No bobbing
cl_bob "0"
//cl_bobcycle "0.8"
//cl_bobup "0.5"
cl_bobview "0"
// Audio
cl_ambientsound "0"
cl_musicenabled "0"
//cl_musicvolume "0.6"
//cl_musicdelay "-1"
// HUD
hud_style "2"
hud_mapstyle "3"
//hud_mapnames "5"
cl_hudmapzoom "2"
// New crosshairs
crosshair "0"
cl_cross "1"
cl_cross_scaling "0"
cl_weaponcfgs "2"
echo " "
echo "----------------------------------------------------------------------"
echo "Competitive NS preset applied:"
echo "----------------------------------------------------------------------"
echo "- Bright lighting settings with overbright shader disabled"
echo "- Nine Legends competitive HUD and new crosshair system"
echo "- No weapon or view bobbing"
echo "- Ambient sound and music tracks disabled"

View file

@ -0,0 +1,47 @@
// Lighting
brightness "0"
gamma "2.95"
lightgamma "1.81"
cl_dynamiclights "0"
cl_postprocess "1"
cl_intensity "0.55"
cl_intensityalt "1"
// High detail particles
cl_high_detail "1"
// Bobbing
cl_bob "0.005"
cl_bobcycle "0.8"
cl_bobup "0.5"
cl_bobview "0"
// Reduced ambient and music volume
cl_ambientsound "0.6"
cl_musicenabled "1"
cl_musicvolume "0.6"
cl_musicdelay "-1"
// HUD
hud_style "1"
hud_mapstyle "3"
//hud_mapnames "5"
cl_hudmapzoom "2"
// New crosshairs
crosshair "0"
cl_cross "1"
cl_cross_scaling "1"
cl_weaponcfgs "2"
echo " "
echo "----------------------------------------------------------------------"
echo "NS 3.3 graphics and audio preset applied"
echo "----------------------------------------------------------------------"
echo "- Brighter maps with less shadows. Reduced overbrightening effects. Flashing dynamic lights disabled."
echo "- Minimal marine HUD and new crosshair system."
echo "- Reduced weapon bobbing and no view bobbing."
echo "- Reduced ambient and music track volumes. Music tracks play only once at the start of the round."
echo " "

View file

@ -0,0 +1,44 @@
// Lighting
brightness "1"
gamma "2.5"
lightgamma "2.5"
cl_dynamiclights "1"
cl_postprocess "1"
cl_intensity "1"
cl_intensityalt "0"
// High detail particles
cl_high_detail "1"
// Bobbing
cl_bob "0.01"
cl_bobcycle "0.8"
cl_bobup "0.5"
cl_bobview "1"
// Audio
cl_ambientsound "1.25" // 1 is the old ambient default volume, but the old master volume was 0.8 before ambient sound volume scaled with the volume command
cl_musicenabled "1"
cl_musicvolume "1.25" // 1 is the old music default volume, but the old master volume was 0.8 before music volume scaled with the volume command
cl_musicdelay "90"
// HUD
hud_style "0"
hud_mapstyle "1"
//hud_mapnames "0"
cl_hudmapzoom "3"
// Legacy sprite crosshairs
crosshair "1"
cl_cross "0"
echo " "
echo "----------------------------------------------------------------------"
echo "Classic NS graphics and audio preset applied:"
echo "----------------------------------------------------------------------"
echo "- Original lighting."
echo "- Original HUD and crosshairs."
echo "- Original weapon and view bob."
echo "- Original mix volumes for ambient sound and music."
echo " "

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.01"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.02"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.033333"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.05"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "60"
cl_cmdbackup "2"
ex_interp "0.05"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "60"
cl_updaterate "60"
cl_cmdbackup "2"
ex_interp "0.05"

View file

@ -0,0 +1,5 @@
rate "30000"
cl_cmdrate "60"
cl_updaterate "60"
cl_cmdbackup "2"
ex_interp "0.1"

View file

@ -0,0 +1,5 @@
rate "30000"
cl_cmdrate "60"
cl_updaterate "30"
cl_cmdbackup "2"
ex_interp "0.1"

View file

@ -0,0 +1,5 @@
rate "20000"
cl_cmdrate "60"
cl_updaterate "30"
cl_cmdbackup "2"
ex_interp "0.1"

View file

@ -1,18 +1,43 @@
"GameMenu" "GameMenu"
{ {
"1" "1"
{
"label" "Apply classic NS preset"
"command" "engine nspreset 1"
}
"2"
{
"label" "Apply NS 3.3 preset"
"command" "engine nspreset 2"
}
"3"
{
"label" "Apply competitive preset"
"command" "engine nspreset 3"
}
"4"
{
"label" ""
"command" ""
}
"5"
{
"label" ""
"command" ""
}
"6"
{ {
"label" "#GameUI_GameMenu_ResumeGame" "label" "#GameUI_GameMenu_ResumeGame"
"command" "ResumeGame" "command" "ResumeGame"
"OnlyInGame" "1" "OnlyInGame" "1"
} }
"2" "7"
{ {
"label" "#Menu_ReadyRoom" "label" "#Menu_ReadyRoom"
"command" "engine menureadyroom" "command" "engine menureadyroom"
"OnlyInGame" "1" "OnlyInGame" "1"
} }
"3" "8"
{ {
"label" "#GameUI_GameMenu_Disconnect" "label" "#GameUI_GameMenu_Disconnect"
"command" "Disconnect" "command" "Disconnect"
@ -37,25 +62,25 @@
// "notmulti" "1" // "notmulti" "1"
// "OnlyInGame" "1" // "OnlyInGame" "1"
// } // }
"7" "9"
{ {
"label" "" "label" ""
"command" "" "command" ""
"notmulti" "1" "notmulti" "1"
} }
"8" "10"
{ {
"label" "#GameUI_GameMenu_PlayerList" "label" "#GameUI_GameMenu_PlayerList"
"command" "OpenPlayerListDialog" "command" "OpenPlayerListDialog"
"OnlyInGame" "1" "OnlyInGame" "1"
"notmulti" "0" "notmulti" "0"
} }
"9" "11"
{ {
"label" "#GameUI_GameMenu_CreateServer" "label" "#GameUI_GameMenu_CreateServer"
"command" "OpenCreateMultiplayerGameDialog" "command" "OpenCreateMultiplayerGameDialog"
} }
"10" "12"
{ {
"label" "#GameUI_GameMenu_FindServers" "label" "#GameUI_GameMenu_FindServers"
"command" "OpenServerBrowser" "command" "OpenServerBrowser"
@ -66,23 +91,23 @@
//"label" "#GameUI_GameMenu_PlayDemo" //"label" "#GameUI_GameMenu_PlayDemo"
//"command" "OpenLoadDemoDialog" //"command" "OpenLoadDemoDialog"
//} //}
"11" "13"
{ {
"label" "" "label" ""
"command" "" "command" ""
} }
"12" "14"
{ {
"label" "#GameUI_GameMenu_ChangeGame" "label" "#GameUI_GameMenu_ChangeGame"
"command" "OpenChangeGameDialog" "command" "OpenChangeGameDialog"
"notsteam" "1" "notsteam" "1"
} }
"13" "15"
{ {
"label" "#GameUI_GameMenu_Options" "label" "#GameUI_GameMenu_Options"
"command" "OpenOptionsDialog" "command" "OpenOptionsDialog"
} }
"14" "16"
{ {
"label" "#GameUI_GameMenu_Quit" "label" "#GameUI_GameMenu_Quit"
"command" "Quit" "command" "Quit"

View file

@ -0,0 +1,80 @@
"Resource\MultiplayerAdvancedDialog.res"
{
"MultiplayerAdvancedDialog"
{
"ControlName" "CTaskFrame"
"fieldName" "MultiplayerAdvancedDialog"
"xpos" "250"
"ypos" "25"
"wide" "700"
"tall" "600"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
"settitlebarvisible" "1"
"title" "#GameUI_MultiplayerAdvanced"
}
"Cancel"
{
"ControlName" "Button"
"fieldName" "Cancel"
"xpos" "616"
"ypos" "562"
"wide" "72"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "2"
"paintbackground" "1"
"labelText" "#GameUI_Cancel"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Command" "Close"
"Default" "0"
}
"Ok"
{
"ControlName" "Button"
"fieldName" "OK"
"xpos" "536"
"ypos" "562"
"wide" "72"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "1"
"paintbackground" "1"
"labelText" "#GameUI_OK"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Command" "Ok"
"Default" "0"
}
"PanelListPanel"
{
"ControlName" "CPanelListPanel"
"fieldName" "PanelListPanel"
"xpos" "16"
"ypos" "56"
"wide" "670"
"tall" "502"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
}
}

View file

@ -0,0 +1,31 @@
"Resource\MultiplayerAdvancedDia"
{
"MultiplayerAdvancedDialog"
{
"ControlName" "PropertyDialog"
"fieldName" "MultiplayerAdvancedDialog"
"xpos" "0"
"ypos" "0"
"wide" "728"
"tall" "536"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
}
"PanelListPanel"
{
"ControlName" "CPanelListPanel"
"fieldName" "PanelListPanel"
"xpos" "10"
"ypos" "10"
"wide" "713"
"tall" "516"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
}
}

View file

@ -0,0 +1,312 @@
"Resource/OptionsSubMultiplayer.res"
{
"Advanced"
{
"ControlName" "Button"
"fieldName" "Advanced"
"xpos" "32"
"ypos" "22"
"tooltiptext" ""
"wide" "440"
"tall" "80"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "1"
"paintbackground" "1"
"labelText" "#GameUI_AdvancedEllipsis"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Command" "Advanced"
"Default" "0"
}
"NameLabel"
{
"ControlName" "Label"
"fieldName" "NameLabel"
"xpos" "230"
"ypos" "144"
"wide" "144"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_PlayerName"
"textAlignment" "west"
"associate" "NameEntry"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
}
"NameEntry"
{
"ControlName" "CCvarTextEntry"
"fieldName" "NameEntry"
"xpos" "230"
"ypos" "174"
"wide" "240"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "2"
"paintbackground" "1"
"textHidden" "0"
"editable" "1"
"maxchars" "63"
"NumericInputOnly" "0"
"unicode" "1"
}
"Primary Color Slider"
{
"ControlName" "CCvarSlider"
"fieldName" "Primary Color Slider"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"leftText" "0.00"
"rightText" "255.00"
}
"Secondary Color Slider"
{
"ControlName" "CCvarSlider"
"fieldName" "Secondary Color Slider"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"leftText" "0.00"
"rightText" "255.00"
}
"High Quality Models"
{
"ControlName" "CCvarToggleCheckButton"
"fieldName" "High Quality Models"
"xpos" "162"
"ypos" "280"
"wide" "204"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "0"
"labelText" "#GameUI_HighModels"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Player model"
{
"ControlName" "CLabeledCommandComboBox"
"fieldName" "Player model"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"textHidden" "0"
"editable" "0"
"maxchars" "-1"
"NumericInputOnly" "0"
"unicode" "0"
}
"Label2"
{
"ControlName" "Label"
"fieldName" "Label2"
"xpos" "230"
"ypos" "216"
"wide" "140"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_SpraypaintImage"
"textAlignment" "west"
"associate" "SpraypaintList"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
}
"SpraypaintList"
{
"ControlName" "CLabeledCommandComboBox"
"fieldName" "SpraypaintList"
"xpos" "230"
"ypos" "244"
"wide" "240"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "3"
"paintbackground" "1"
"textHidden" "0"
"editable" "0"
"maxchars" "-1"
"NumericInputOnly" "0"
"unicode" "0"
}
"SpraypaintColor"
{
"ControlName" "CLabeledCommandComboBox"
"fieldName" "SpraypaintColor"
"xpos" "230"
"ypos" "274"
"wide" "240"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "4"
"paintbackground" "1"
"textHidden" "0"
"editable" "0"
"maxchars" "-1"
"NumericInputOnly" "0"
"unicode" "0"
}
"ModelImage"
{
"ControlName" "Panel"
"fieldName" "ModelImage"
"xpos" "0"
"ypos" "0"
"wide" "66"
"tall" "66"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
}
"LogoImage"
{
"ControlName" "Panel"
"fieldName" "LogoImage"
"xpos" "132"
"ypos" "234"
"wide" "64"
"tall" "64"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
}
"Ok"
{
"ControlName" "Button"
"fieldName" "OK"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_OK"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Apply"
{
"ControlName" "Button"
"fieldName" "Apply"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_Apply"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Cancel"
{
"ControlName" "Button"
"fieldName" "Cancel"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_Cancel"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Divider1"
{
"ControlName" "Divider"
"fieldName" "Divider1"
"xpos" "32"
"ypos" "126"
"wide" "440"
"tall" "1"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
}
}

View file

@ -174,7 +174,7 @@ Scheme
"ArmedMenuColor" "255 255 255 255" "ArmedMenuColor" "255 255 255 255"
"DepressedMenuColor" "192 186 80 255" "DepressedMenuColor" "192 186 80 255"
"WidescreenBarColor" "0 0 0 0" "WidescreenBarColor" "0 0 0 0"
"MenuItemVisibilityRate" "0.03" // time it takes for one menu item to appear "MenuItemVisibilityRate" "0.01" // time it takes for one menu item to appear
"MenuItemHeight" "28" "MenuItemHeight" "28"
"GameMenuInset" "32" "GameMenuInset" "32"
} }

Binary file not shown.

View file

@ -58,6 +58,14 @@ mp_killdelay 3
mp_flashlight 1 mp_flashlight 1
mp_footsteps 1 mp_footsteps 1
// AI Player Settings
mp_botsenabled 0
mp_botminplayers 0
mp_botusemapdefaults 1
mp_botskill 1
mp_botautomode 1
mp_botcommandermode 1
// disable autoaim and mad gibs // disable autoaim and mad gibs
sv_aim 0 sv_aim 0
violence_hgibs 0 violence_hgibs 0
@ -100,3 +108,14 @@ mp_uplink 1
// Needed so this file is executed on map change, like pre-NS v2.1 // Needed so this file is executed on map change, like pre-NS v2.1
mapchangecfgfile server.cfg mapchangecfgfile server.cfg
// Post HL 25th Aniversary update
sv_rollangle 0
sv_allow_shaders 0
// Set rate limits, otherwise they initialize to bad values
sv_maxupdaterate 102
sv_maxunlag 0.3
sv_maxrate 0
sv_minrate 20000
sv_minupdaterate 30

View file

@ -32,7 +32,7 @@
// Half-Life Server Configuration Layout Script (stores last settings chosen, too) // Half-Life Server Configuration Layout Script (stores last settings chosen, too)
// File generated: Sun May 07 10:30:06 AM // File generated: Thu Mar 14 10:53:31 AM
// //
// //
// Cvar - Setting // Cvar - Setting
@ -45,7 +45,7 @@ DESCRIPTION SERVER_OPTIONS
{ {
"LAN Game" "LAN Game"
{ BOOL } { BOOL }
{ "0" } { "1" }
} }
"hostname" "hostname"
@ -59,7 +59,7 @@ DESCRIPTION SERVER_OPTIONS
{ {
"#Valve_Max_Players" "#Valve_Max_Players"
{ NUMBER 2.000000 32.000000 } { NUMBER 2.000000 32.000000 }
{ "2.000000" } { "24.000000" }
} }
"sv_password" "sv_password"
@ -158,4 +158,46 @@ DESCRIPTION SERVER_OPTIONS
{ "0.510000" } { "0.510000" }
} }
"mp_botsenabled"
{
"Enable Bots"
{ BOOL }
{ "0" }
}
"mp_botskill"
{
"Bot Difficulty"
{
LIST
"Easy" "0"
"Medium" "1"
"Hard" "2"
"Godlike" "3"
}
{ "1.000000" }
}
"mp_botautomode"
{
"Bot Mode"
{
LIST
"Manual" "0"
"Automatic" "1"
}
{ "1.000000" }
}
"mp_botcommandermode"
{
"Allow AI Commander"
{
LIST
"Disabled" "0"
"Enabled" "1"
}
{ "1.000000" }
}
} }

14
main/shaders/fs.shaders Normal file
View file

@ -0,0 +1,14 @@
#version 330 core
in vec2 texCoord;
out vec4 fragColor;
uniform sampler2D textureSampler;
uniform float colorMultiplier; // Uniform float to multiply color by
void main() {
// Sample the texture
vec4 texColor = texture(textureSampler, texCoord);
// Multiply the color
fragColor = vec4(texColor.rgb * colorMultiplier, 1.0f);
}

10
main/shaders/vs.shaders Normal file
View file

@ -0,0 +1,10 @@
#version 330 core
layout(location = 0) in vec2 vertexPosition;
out vec2 texCoord;
void main() {
// Pass the vertex position to the fragment shader
texCoord = (vertexPosition + 1.0) * 0.5; // Convert vertex position to texture coordinates
gl_Position = vec4(vertexPosition, 0.0, 1.0);
}

View file

Binary file not shown.

View file

@ -8,9 +8,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cl_dll.dll", "cl_dll\cl_dll
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ns.dll", "dlls\hl.vcxproj", "{BC87A180-F17B-83FC-5D7D-470FAD003ABC}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ns.dll", "dlls\hl.vcxproj", "{BC87A180-F17B-83FC-5D7D-470FAD003ABC}"
ProjectSection(ProjectDependencies) = postProject
{36E392B2-EA9F-43FE-9700-82DFE548C75D} = {36E392B2-EA9F-43FE-9700-82DFE548C75D}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "particles", "particles\particles.vcxproj", "{5AADD469-7488-4B34-A9FD-01CFAC5972FD}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "particles", "particles\particles.vcxproj", "{5AADD469-7488-4B34-A9FD-01CFAC5972FD}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "detour", "detour\detour.vcxproj", "{36E392B2-EA9F-43FE-9700-82DFE548C75D}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
@ -36,6 +41,12 @@ Global
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Playtest|Win32.Build.0 = Particles - Release|Win32 {5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Playtest|Win32.Build.0 = Particles - Release|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Release|Win32.ActiveCfg = Particles - Release|Win32 {5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Release|Win32.ActiveCfg = Particles - Release|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Release|Win32.Build.0 = Particles - Release|Win32 {5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Release|Win32.Build.0 = Particles - Release|Win32
{36E392B2-EA9F-43FE-9700-82DFE548C75D}.Debug|Win32.ActiveCfg = Detour - Debug|Win32
{36E392B2-EA9F-43FE-9700-82DFE548C75D}.Debug|Win32.Build.0 = Detour - Debug|Win32
{36E392B2-EA9F-43FE-9700-82DFE548C75D}.Playtest|Win32.ActiveCfg = Detour - Release|Win32
{36E392B2-EA9F-43FE-9700-82DFE548C75D}.Playtest|Win32.Build.0 = Detour - Release|Win32
{36E392B2-EA9F-43FE-9700-82DFE548C75D}.Release|Win32.ActiveCfg = Detour - Release|Win32
{36E392B2-EA9F-43FE-9700-82DFE548C75D}.Release|Win32.Build.0 = Detour - Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -43,6 +43,7 @@ WeaponsResource gWR;
int g_weaponselect = 0; int g_weaponselect = 0;
extern bool gCanMove; extern bool gCanMove;
extern cvar_t* cl_weaponcfgs;
void IN_AttackDownForced(void); void IN_AttackDownForced(void);
void IN_AttackUpForced(void); void IN_AttackUpForced(void);
@ -87,6 +88,9 @@ void WeaponsResource::Reset( void )
iOldWeaponBits = 0; iOldWeaponBits = 0;
memset( rgSlots, 0, sizeof(WEAPON*)*MAX_WEAPON_SLOTS*MAX_WEAPON_POSITIONS ); memset( rgSlots, 0, sizeof(WEAPON*)*MAX_WEAPON_SLOTS*MAX_WEAPON_POSITIONS );
memset( riAmmo, 0, sizeof(int)*MAX_AMMO_TYPES ); memset( riAmmo, 0, sizeof(int)*MAX_AMMO_TYPES );
crossLastWeapId = 0;
lastSpecXhair = 0;
lastPlayMode = 0;
} }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -380,13 +384,18 @@ void WeaponsResource::UserCmd_MovementOn()
// Find out which weapon we want to trigger // Find out which weapon we want to trigger
AvHUser3 theUser3 = gHUD.GetHUDUser3(); AvHUser3 theUser3 = gHUD.GetHUDUser3();
int wID = -1; int wID = -1;
bool lerkFlap = false;
switch(theUser3) switch(theUser3)
{ {
case AVH_USER3_ALIEN_PLAYER1: case AVH_USER3_ALIEN_PLAYER1:
wID = AVH_ABILITY_LEAP; wID = AVH_ABILITY_LEAP;
break; break;
//TODO: Make healspray work with attack2
case AVH_USER3_ALIEN_PLAYER2:
wID = AVH_WEAPON_HEALINGSPRAY;
break;
case AVH_USER3_ALIEN_PLAYER3: case AVH_USER3_ALIEN_PLAYER3:
// TODO: Add flap lerkFlap = true;
break; break;
case AVH_USER3_ALIEN_PLAYER4: case AVH_USER3_ALIEN_PLAYER4:
wID = AVH_WEAPON_BLINK; wID = AVH_WEAPON_BLINK;
@ -399,7 +408,24 @@ void WeaponsResource::UserCmd_MovementOn()
return; return;
} }
if (wID > -1) if (wID == AVH_WEAPON_HEALINGSPRAY)
{
WEAPON* healWeapon = this->GetWeapon(AVH_WEAPON_HEALINGSPRAY);
WEAPON* currentWeapon = this->GetWeapon(gHUD.GetCurrentWeaponID());
if (healWeapon != NULL && currentWeapon != NULL)
{
//if (healWeapon != currentWeapon)
//{
healSprayLastWeapon = currentWeapon;
healSprayAttack2Active = true;
SetCurrentWeapon(healWeapon);
//}
IN_Attack2Down();
}
}
else if (wID > -1)
{ {
// Fetch the needed movement weapon // Fetch the needed movement weapon
WEAPON *p = this->GetWeapon(wID); WEAPON *p = this->GetWeapon(wID);
@ -409,6 +435,10 @@ void WeaponsResource::UserCmd_MovementOn()
IN_Attack2Down(); IN_Attack2Down();
} }
} }
else if (lerkFlap)
{
IN_Attack2Down();
}
} }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -418,6 +448,24 @@ void WeaponsResource::UserCmd_MovementOff()
// Ensure that we're not activating any weapons when selected // Ensure that we're not activating any weapons when selected
IN_Attack2Up(); IN_Attack2Up();
IN_ReloadUp(); IN_ReloadUp();
// Check if we're in game.
if (gEngfuncs.pfnGetLevelName()[0] != 0)
{
if (gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2)
{
WEAPON* healWeapon = this->GetWeapon(AVH_WEAPON_HEALINGSPRAY);
if (healWeapon != NULL && healSprayLastWeapon != NULL)
{
//if (healSprayLastWeapon != healWeapon)
//{
SetCurrentWeapon(healSprayLastWeapon);
//}
healSprayAttack2Active = false;
}
}
}
} }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -461,7 +509,15 @@ void WeaponsResource::SetCurrentWeapon(WEAPON* newWeapon)
if( newWeapon != NULL ) if( newWeapon != NULL )
{ {
if( newWeapon != currentWeapon ) if( newWeapon != currentWeapon )
{ lastWeapon = currentWeapon; } {
lastWeapon = currentWeapon;
if (gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2 && !healSprayAttack2Active)
{
healSprayLastWeapon = newWeapon;
}
}
ServerCmd(newWeapon->szName); ServerCmd(newWeapon->szName);
g_weaponselect = newWeapon->iId; g_weaponselect = newWeapon->iId;
} }
@ -536,7 +592,67 @@ void WeaponsResource :: SelectSlot( int iSlot, int fAdvance, int iDirection )
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void WeaponsResource::SetWeaponConfig (WEAPON* weapon, int specXhair)
{
int newPlayMode = gHUD.GetPlayMode();
if (gHUD.GetCurrentWeaponID() != crossLastWeapId || (newPlayMode == PLAYMODE_READYROOM && newPlayMode != lastPlayMode) || (specXhair != lastSpecXhair && !weapon))
{
crossLastWeapId = gHUD.GetCurrentWeaponID();
lastPlayMode = newPlayMode;
lastSpecXhair = specXhair;
char weapCfg[128];
if (cl_weaponcfgs->value == 1.0f)
{
ClientCmd("exec weaponcfgs/default.cfg");
if (!weapon || newPlayMode == PLAYMODE_READYROOM)
{
if (specXhair == 1)
{
ClientCmd("exec weaponcfgs/spectate.cfg");
}
else
{
ClientCmd("exec weaponcfgs/noweapon.cfg");
}
}
else
{
snprintf(weapCfg, 128, "exec weaponcfgs/%s.cfg", weapon->szName);
ClientCmd(weapCfg);
}
}
else if (cl_weaponcfgs->value == 2.0f)
{
if (!weapon || newPlayMode == PLAYMODE_READYROOM)
{
if (specXhair == 1)
{
ClientCmd("exec weaponcfgs/nsdefaults/spectate.cfg");
}
else
{
ClientCmd("exec weaponcfgs/nsdefaults/noweapon.cfg");
}
}
else
{
snprintf(weapCfg, 128, "exec weaponcfgs/nsdefaults/%s.cfg", weapon->szName);
ClientCmd(weapCfg);
}
}
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int giBucketHeight, giBucketWidth, giABHeight, giABWidth; // Ammo Bar width and height int giBucketHeight, giBucketWidth, giABHeight, giABWidth; // Ammo Bar width and height
cvar_t* hud_ammo_x;
cvar_t* hud_ammo_y;
cvar_t* hud_ammo_scale;
cvar_t* hud_ammo_alphamin;
AVHHSPRITE ghsprBuckets; // Sprite for top row of weapons menu AVHHSPRITE ghsprBuckets; // Sprite for top row of weapons menu
@ -599,6 +715,11 @@ int CHudAmmo::Init(void)
CVAR_CREATE( "hud_drawhistory_time", HISTORY_DRAW_TIME, 0 ); CVAR_CREATE( "hud_drawhistory_time", HISTORY_DRAW_TIME, 0 );
CVAR_CREATE( "hud_fastswitch", "0", FCVAR_ARCHIVE ); // controls whether or not weapons can be selected in one keypress CVAR_CREATE( "hud_fastswitch", "0", FCVAR_ARCHIVE ); // controls whether or not weapons can be selected in one keypress
hud_ammo_x = CVAR_CREATE("hud_ammo_x", "0", FCVAR_ARCHIVE);
hud_ammo_y = CVAR_CREATE("hud_ammo_y", "0", FCVAR_ARCHIVE);
hud_ammo_scale = CVAR_CREATE("hud_ammo_scale", "1", FCVAR_ARCHIVE);
hud_ammo_alphamin = CVAR_CREATE("hud_ammo_alphamin", "128", FCVAR_ARCHIVE);
m_iFlags |= HUD_ACTIVE; //!!! m_iFlags |= HUD_ACTIVE; //!!!
gWR.Init(); gWR.Init();
@ -694,41 +815,18 @@ void CHudAmmo::Think(void)
} }
if (gHUD.GetCurrentWeaponID() != gWR.lastWeaponId) WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
{
gWR.lastWeaponId = gHUD.GetCurrentWeaponID();
float wCfgCvar = CVAR_GET_FLOAT("cl_weaponcfgs");
if (wCfgCvar == 1)
{
ClientCmd("exec weaponcfgs/default.cfg");
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
char weapcfg[128];
sprintf(weapcfg, "exec weaponcfgs/%s.cfg", currentWeapon->szName);
ClientCmd(weapcfg);
}
//else if (wCfgCvar == 2.0f)
//{
// ClientCmd("exec weaponcfgs/nsdefaults/default.cfg");
// WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
// char weapcfg[128];
// sprintf(weapcfg, "exec weaponcfgs/nsdefaults/%s.cfg", currentWeapon->szName);
// ClientCmd(weapcfg);
//}
}
if(gHUD.GetIsAlien()) //check for hive death causing loss of current weapon if(gHUD.GetIsAlien()) //check for hive death causing loss of current weapon
{ {
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
if(!gWR.IsSelectable(currentWeapon)) //current weapon isn't valid if(!gWR.IsSelectable(currentWeapon)) //current weapon isn't valid
{ {
gWR.SetValidWeapon(); //get best option gWR.SetValidWeapon(); //get best option
} }
} }
gWR.SetWeaponConfig(currentWeapon, false);
if (!gpActiveSel) if (!gpActiveSel)
return; return;
@ -1101,6 +1199,125 @@ void CHudAmmo::SetCurrentClip(int inClip)
} }
} }
//// Old HUD drawing
//int CHudAmmo::Draw(float flTime)
//{
// int a, x, y, r, g, b;
// int AmmoWidth;
//
// if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
// return 1;
//
// if (/*!gHUD.GetIsAlive() ||*/ (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
// return 1;
//
// // Draw Weapon Menu
// DrawWList(flTime);
//
// // Draw ammo pickup history
// gHR.DrawAmmoHistory( flTime );
//
// if (!(m_iFlags & HUD_ACTIVE))
// return 0;
//
// if (!m_pWeapon)
// return 0;
//
// WEAPON *pw = m_pWeapon; // shorthand
//
// // SPR_Draw Ammo
// if ((pw->iAmmoType < 0) && (pw->iAmmo2Type < 0))
// return 0;
//
//
// int iFlags = DHN_DRAWZERO; // draw 0 values
//
// AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
//
// a = (int) max( MIN_ALPHA, m_fFade );
//
// if (m_fFade > 0)
// m_fFade -= (gHUD.m_flTimeDelta * 20);
//
// gHUD.GetPrimaryHudColor(r, g, b);
//
// ScaleColors(r, g, b, a );
//
// int theViewport[4];
// gHUD.GetViewport(theViewport);
//
// // Does this weapon have a clip?
// y = theViewport[1] + theViewport[3] - gHUD.m_iFontHeight - gHUD.m_iFontHeight/2;
//
// // Does weapon have any ammo at all?
// if (m_pWeapon->iAmmoType > 0)
// {
// int iIconWidth = m_pWeapon->rcAmmo.right - m_pWeapon->rcAmmo.left;
//
// if (pw->iClip >= 0)
// {
// // room for the number and the '|' and the current ammo
//
// x = theViewport[0] + theViewport[2] - (8 * AmmoWidth) - iIconWidth;
// x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b);
//
// wrect_t rc;
// rc.top = 0;
// rc.left = 0;
// rc.right = AmmoWidth;
// rc.bottom = 100;
//
// int iBarWidth = AmmoWidth/10;
//
// x += AmmoWidth/2;
//
// gHUD.GetPrimaryHudColor(r, g, b);
//
// // draw the | bar
// FillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a);
//
// x += iBarWidth + AmmoWidth/2;;
//
// // GL Seems to need this
// ScaleColors(r, g, b, a );
// x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b);
//
//
// }
// else
// {
// // SPR_Draw a bullets only line
// x = theViewport[0] + theViewport[2] - 4 * AmmoWidth - iIconWidth;
// x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b);
// }
//
// // Draw the ammo Icon
// int iOffset = (m_pWeapon->rcAmmo.bottom - m_pWeapon->rcAmmo.top)/8;
// SPR_Set(m_pWeapon->hAmmo, r, g, b);
// SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo);
// }
//
// // Does weapon have seconday ammo?
// if (pw->iAmmo2Type > 0)
// {
// int iIconWidth = m_pWeapon->rcAmmo2.right - m_pWeapon->rcAmmo2.left;
//
// // Do we have secondary ammo?
// if ((pw->iAmmo2Type != 0) && (gWR.CountAmmo(pw->iAmmo2Type) > 0))
// {
// y -= gHUD.m_iFontHeight + gHUD.m_iFontHeight/4;
// x = theViewport[0] + theViewport[2] - 4 * AmmoWidth - iIconWidth;
// x = gHUD.DrawHudNumber(x, y, iFlags|DHN_3DIGITS, gWR.CountAmmo(pw->iAmmo2Type), r, g, b);
//
// // Draw the ammo Icon
// SPR_Set(m_pWeapon->hAmmo2, r, g, b);
// int iOffset = (m_pWeapon->rcAmmo2.bottom - m_pWeapon->rcAmmo2.top)/8;
// SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2);
// }
// }
// return 1;
//}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Drawing code // Drawing code
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -1137,9 +1354,21 @@ int CHudAmmo::Draw(float flTime)
int iFlags = DHN_DRAWZERO; // draw 0 values int iFlags = DHN_DRAWZERO; // draw 0 values
AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left; float ammoScale = 1.0f;
if (hud_ammo_scale)
{
ammoScale = min(max(0.01f, hud_ammo_scale->value), 5.0f);
}
a = (int) max( MIN_ALPHA, m_fFade ); AmmoWidth = (gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left) * ammoScale;
int minAlpha;
if (hud_ammo_alphamin)
minAlpha = max(0, min(hud_ammo_alphamin->value, 255));
else
minAlpha = MIN_ALPHA;
a = (int)max(minAlpha, m_fFade);
if (m_fFade > 0) if (m_fFade > 0)
m_fFade -= (gHUD.m_flTimeDelta * 20); m_fFade -= (gHUD.m_flTimeDelta * 20);
@ -1148,58 +1377,63 @@ int CHudAmmo::Draw(float flTime)
ScaleColors(r, g, b, a ); ScaleColors(r, g, b, a );
int theViewport[4];
gHUD.GetViewport(theViewport);
// Does this weapon have a clip? // Does this weapon have a clip?
y = theViewport[1] + theViewport[3] - gHUD.m_iFontHeight - gHUD.m_iFontHeight/2; int initialY = gHUD.GetHeight();
if (hud_ammo_y && hud_ammo_y->value != 0.0f)
{
initialY *= min(max(0.0f, hud_ammo_y->value), 1.0f);
}
y = initialY - gHUD.m_iFontHeight / 2;
// Does weapon have any ammo at all? // Does weapon have any ammo at all?
if (m_pWeapon->iAmmoType > 0) if (m_pWeapon->iAmmoType > 0)
{ {
int iIconWidth = m_pWeapon->rcAmmo.right - m_pWeapon->rcAmmo.left; int iIconWidth = (m_pWeapon->rcAmmo.right - m_pWeapon->rcAmmo.left) * ammoScale;
if (pw->iClip >= 0) if (pw->iClip >= 0)
{ {
// room for the number and the '|' and the current ammo // room for the number and the '|' and the current ammo
x = theViewport[0] + theViewport[2] - (8 * AmmoWidth) - iIconWidth; int initialX = gHUD.GetWidth();
x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b); if (hud_ammo_x && hud_ammo_x->value != 0.0f)
{
//TODO: Inset position for ultrawide monitors.
//if (gHUD.GetWidth() > (gHUD.GetHeight() * 1.78f)){}
wrect_t rc; initialX *= min(max(0.0f, hud_ammo_x->value), 1.0f);
rc.top = 0; }
rc.left = 0;
rc.right = AmmoWidth; x = initialX - (8 * AmmoWidth) - iIconWidth;
rc.bottom = 100;
x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b, 255, ammoScale, CHud::a_southwest);
int iBarWidth = AmmoWidth/10; int iBarWidth = AmmoWidth/10;
int iBarHeight = gHUD.m_iFontHeight * -1;
x += AmmoWidth/2; x += AmmoWidth/2;
gHUD.GetPrimaryHudColor(r, g, b); gHUD.GetPrimaryHudColor(r, g, b);
// draw the | bar // draw the | bar
FillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a); gHUD.DrawHudFill(x, y, iBarWidth, iBarHeight, r, g, b, a, ammoScale);
x += iBarWidth + AmmoWidth/2;; x += iBarWidth + AmmoWidth/2;
// GL Seems to need this // GL Seems to need this
ScaleColors(r, g, b, a ); ScaleColors(r, g, b, a );
x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b); x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b, 255, ammoScale, CHud::a_southwest);
} }
else else
{ {
// SPR_Draw a bullets only line // SPR_Draw a bullets only line
x = theViewport[0] + theViewport[2] - 4 * AmmoWidth - iIconWidth; x = gHUD.GetWidth() - 4 * AmmoWidth - iIconWidth;
x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b); x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b, 255, ammoScale, CHud::a_southwest);
} }
// Draw the ammo Icon // Draw the ammo Icon
int iOffset = (m_pWeapon->rcAmmo.bottom - m_pWeapon->rcAmmo.top)/8; gHUD.DrawHudSprite(m_pWeapon->hAmmo, 0, &m_pWeapon->rcAmmo, x, y, r, g, b, 255, ammoScale, CHud::a_southwest);
SPR_Set(m_pWeapon->hAmmo, r, g, b);
SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo);
} }
// Does weapon have seconday ammo? // Does weapon have seconday ammo?
@ -1211,13 +1445,11 @@ int CHudAmmo::Draw(float flTime)
if ((pw->iAmmo2Type != 0) && (gWR.CountAmmo(pw->iAmmo2Type) > 0)) if ((pw->iAmmo2Type != 0) && (gWR.CountAmmo(pw->iAmmo2Type) > 0))
{ {
y -= gHUD.m_iFontHeight + gHUD.m_iFontHeight/4; y -= gHUD.m_iFontHeight + gHUD.m_iFontHeight/4;
x = theViewport[0] + theViewport[2] - 4 * AmmoWidth - iIconWidth; x = gHUD.GetWidth() - 4 * AmmoWidth - iIconWidth;
x = gHUD.DrawHudNumber(x, y, iFlags|DHN_3DIGITS, gWR.CountAmmo(pw->iAmmo2Type), r, g, b); x = gHUD.DrawHudNumber(x, y, iFlags|DHN_3DIGITS, gWR.CountAmmo(pw->iAmmo2Type), r, g, b, 255, ammoScale, CHud::a_southwest);
// Draw the ammo Icon // Draw the ammo Icon
SPR_Set(m_pWeapon->hAmmo2, r, g, b); gHUD.DrawHudSprite(m_pWeapon->hAmmo2, 0, &m_pWeapon->rcAmmo2, x, y, r, b, g, 255, ammoScale, CHud::a_southwest);
int iOffset = (m_pWeapon->rcAmmo2.bottom - m_pWeapon->rcAmmo2.top)/8;
SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2);
} }
} }
return 1; return 1;

View file

@ -70,8 +70,9 @@ int CHudAmmoSecondary :: Draw(float flTime)
x -= (gHUD.GetSpriteRect(m_HUD_ammoicon).right - gHUD.GetSpriteRect(m_HUD_ammoicon).left); x -= (gHUD.GetSpriteRect(m_HUD_ammoicon).right - gHUD.GetSpriteRect(m_HUD_ammoicon).left);
y -= (gHUD.GetSpriteRect(m_HUD_ammoicon).top - gHUD.GetSpriteRect(m_HUD_ammoicon).bottom); y -= (gHUD.GetSpriteRect(m_HUD_ammoicon).top - gHUD.GetSpriteRect(m_HUD_ammoicon).bottom);
SPR_Set( gHUD.GetSprite(m_HUD_ammoicon), r, g, b ); //SPR_Set( gHUD.GetSprite(m_HUD_ammoicon), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_ammoicon) ); //SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_ammoicon) );
gHUD.DrawHudSpriteIndex(m_HUD_ammoicon, x, y, r , g, b);
} }
else else
{ // move the cursor by the '0' char instead, since we don't have an icon to work with { // move the cursor by the '0' char instead, since we don't have an icon to work with
@ -96,7 +97,8 @@ int CHudAmmoSecondary :: Draw(float flTime)
{ {
// draw the divider bar // draw the divider bar
x -= (AmmoWidth / 2); x -= (AmmoWidth / 2);
FillRGBA(x, y, (AmmoWidth/10), gHUD.m_iFontHeight, r, g, b, a); //FillRGBA(x, y, (AmmoWidth/10), gHUD.m_iFontHeight, r, g, b, a);
gHUD.DrawHudFill(x, y, (AmmoWidth / 10), gHUD.m_iFontHeight, r, g ,b , MIN_ALPHA);
} }
} }

View file

@ -67,16 +67,21 @@ public:
void SetValidWeapon( void ); void SetValidWeapon( void );
void SetCurrentWeapon( WEAPON* wp ); void SetCurrentWeapon( WEAPON* wp );
void SelectSlot( int iSlot, int fAdvance, int iDirection ); void SelectSlot( int iSlot, int fAdvance, int iDirection );
void SetWeaponConfig(WEAPON* weapon, int specXhair = 0);
friend CHudAmmo; //for iOldWeaponBits access friend CHudAmmo; //for iOldWeaponBits access
private: private:
WEAPON rgWeapons[MAX_WEAPONS]; // current weapon state WEAPON rgWeapons[MAX_WEAPONS]; // current weapon state
WEAPON* rgSlots[MAX_WEAPON_SLOTS][MAX_WEAPON_POSITIONS]; // current weapon slot map WEAPON* rgSlots[MAX_WEAPON_SLOTS][MAX_WEAPON_POSITIONS]; // current weapon slot map
WEAPON* lastWeapon; // client-side lastinv WEAPON* lastWeapon; // client-side lastinv
WEAPON* healSprayLastWeapon;
bool healSprayAttack2Active;
int riAmmo[MAX_AMMO_TYPES]; // current ammo counts int riAmmo[MAX_AMMO_TYPES]; // current ammo counts
int iOldWeaponBits; int iOldWeaponBits;
int lastWeaponId; int crossLastWeapId;
int lastSpecXhair;
int lastPlayMode;
}; };
extern WeaponsResource gWR; extern WeaponsResource gWR;

View file

@ -95,7 +95,7 @@ int CHudBattery::Draw(float flTime)
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) )) if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1; return 1;
// Has health changed? Flash the health # // Has health changed? Flash the health #
if (m_fFade) if (m_fFade)
{ {
@ -105,23 +105,23 @@ int CHudBattery::Draw(float flTime)
m_fFade -= (gHUD.m_flTimeDelta * 20); m_fFade -= (gHUD.m_flTimeDelta * 20);
if (m_fFade <= 0) if (m_fFade <= 0)
{ {
a = 128; //a = 128;
m_fFade = 0; m_fFade = 0;
} }
// Fade the health number back to dim // Fade the health number back to dim
a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128; a = gHUD.m_Health.m_iMinAlpha + (m_fFade/FADE_TIME) * 128;
} }
else else
a = MIN_ALPHA; a = gHUD.m_Health.m_iMinAlpha;
ScaleColors(r, g, b, a ); ScaleColors(r, g, b, a );
int iOffset = (m_prc1->bottom - m_prc1->top)/6; //int iOffset = (m_prc1->bottom - m_prc1->top)/6;
int theInset = 0; //int theInset = 0;
//if(gHUD.GetIsAlien()) //if(gHUD.GetIsAlien())
//{ //{
// theInset = ScreenWidth()*kResourceEnergyBarWidth; // theInset = ScreenWidth()*kResourceEnergyBarWidth;
@ -130,8 +130,11 @@ int CHudBattery::Draw(float flTime)
int theViewport[4]; int theViewport[4];
gHUD.GetViewport(theViewport); gHUD.GetViewport(theViewport);
y = theViewport[1] + theViewport[3] - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2; //y = theViewport[1] + theViewport[3] - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = theViewport[0] + theInset + kArmorLeftInset*ScreenWidth(); //x = theViewport[0] + theInset + kArmorLeftInset*ScreenWidth();
//y = m_iAnchorY - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
y = m_iAnchorY - gHUD.m_iFontHeight / 2;
x = m_iAnchorX;
// make sure we have the right sprite handles // make sure we have the right sprite handles
if ( !m_hSprite1 ) if ( !m_hSprite1 )
@ -139,18 +142,102 @@ int CHudBattery::Draw(float flTime)
if ( !m_hSprite2 ) if ( !m_hSprite2 )
m_hSprite2 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_full" ) ); m_hSprite2 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_full" ) );
SPR_Set(m_hSprite1, r, g, b ); //SPR_Set(m_hSprite1, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset, m_prc1); //SPR_DrawAdditive( 0, x, y - iOffset, m_prc1);
gHUD.DrawHudSprite(m_hSprite1, 0, m_prc1, x, y, r, g, b, a, gHUD.m_Health.m_fHealthScale, CHud::a_southwest);
if (rc.bottom > rc.top) if (rc.bottom > rc.top)
{ {
SPR_Set(m_hSprite2, r, g, b ); //SPR_Set(m_hSprite2, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset + (rc.top - m_prc2->top), &rc); //SPR_DrawAdditive( 0, x, y - iOffset + (rc.top - m_prc2->top), &rc);
gHUD.DrawHudSprite(m_hSprite2, 0, &rc, x, y, r, g, b, a, gHUD.m_Health.m_fHealthScale, CHud::a_southwest);
} }
x += (m_prc1->right - m_prc1->left); x += (m_prc1->right - m_prc1->left) * gHUD.m_Health.m_fHealthScale;
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b); x += ((gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left) / 2) * gHUD.m_Health.m_fHealthScale;
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b, 255, gHUD.m_Health.m_fHealthScale, CHud::a_southwest);
return 1; return 1;
} }
//// Old HUD drawing.
//int CHudBattery::Draw(float flTime)
//{
//
// if (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH)
// return 1;
//
// int r, g, b, x, y, a;
// wrect_t rc;
//
// rc = *m_prc2;
//
// int theMaxArmor = gHUD.GetHUDMaxArmor();
// float theScalar = 1.0f / theMaxArmor;
//
// rc.top += m_iHeight * ((float)(theMaxArmor - (min(theMaxArmor, m_iBat))) * theScalar); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
//
// gHUD.GetPrimaryHudColor(r, g, b);
//
// if (!(gHUD.m_iWeaponBits & (1 << (WEAPON_SUIT))))
// return 1;
//
// // Has health changed? Flash the health #
// if (m_fFade)
// {
// if (m_fFade > FADE_TIME)
// m_fFade = FADE_TIME;
//
// m_fFade -= (gHUD.m_flTimeDelta * 20);
// if (m_fFade <= 0)
// {
// a = 128;
// m_fFade = 0;
// }
//
// // Fade the health number back to dim
//
// a = MIN_ALPHA + (m_fFade / FADE_TIME) * 128;
//
// }
// else
// a = MIN_ALPHA;
//
// ScaleColors(r, g, b, a);
//
// int iOffset = (m_prc1->bottom - m_prc1->top) / 6;
//
// int theInset = 0;
// //if(gHUD.GetIsAlien())
// //{
// // theInset = ScreenWidth()*kResourceEnergyBarWidth;
// //}
//
// int theViewport[4];
// gHUD.GetViewport(theViewport);
//
// y = theViewport[1] + theViewport[3] - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
// x = theViewport[0] + theInset + kArmorLeftInset * ScreenWidth();
//
// // make sure we have the right sprite handles
// if (!m_hSprite1)
// m_hSprite1 = gHUD.GetSprite(gHUD.GetSpriteIndex("suit_empty"));
// if (!m_hSprite2)
// m_hSprite2 = gHUD.GetSprite(gHUD.GetSpriteIndex("suit_full"));
//
// SPR_Set(m_hSprite1, r, g, b);
// SPR_DrawAdditive(0, x, y - iOffset, m_prc1);
//
// if (rc.bottom > rc.top)
// {
// SPR_Set(m_hSprite2, r, g, b);
// SPR_DrawAdditive(0, x, y - iOffset + (rc.top - m_prc2->top), &rc);
// }
//
// x += (m_prc1->right - m_prc1->left);
// x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b);
//
// return 1;
//
//}

View file

@ -69,6 +69,8 @@ TeamFortressViewport *gViewPort = NULL;
HINTERFACEMODULE g_hTrackerModule = NULL; HINTERFACEMODULE g_hTrackerModule = NULL;
//ITrackerUser *g_pTrackerUser = NULL; //ITrackerUser *g_pTrackerUser = NULL;
CPostProcessShader g_PostProcessShader;
void InitInput (void); void InitInput (void);
void EV_HookEvents( void ); void EV_HookEvents( void );
void IN_Commands( void ); void IN_Commands( void );
@ -216,6 +218,8 @@ void CL_DLLEXPORT HUD_Init( void )
InitInput(); InitInput();
gHUD.Init(); gHUD.Init();
Scheme_Init(); Scheme_Init();
g_PostProcessShader.Init();
//gEngfuncs.Con_Printf("waterrenderer init %d", success);
} }
/* /*
@ -261,6 +265,8 @@ HUD_Redraw
int CL_DLLEXPORT HUD_Redraw( float time, int intermission ) int CL_DLLEXPORT HUD_Redraw( float time, int intermission )
{ {
g_PostProcessShader.DrawShader();
// RecClHudRedraw(time, intermission); // RecClHudRedraw(time, intermission);
gHUD.Redraw( time, intermission ); gHUD.Redraw( time, intermission );

View file

@ -19,12 +19,20 @@ private:
float m_flMouseSensitivity; float m_flMouseSensitivity;
bool wstoggle; bool wstoggle;
float m_flScaleX;
float m_flScaleY;
unsigned int m_iConWidth;
unsigned int m_iConHeight;
float m_flOffsetX;
float m_flOffsetY;
bool m_bIsWidescreen;
public: public:
AVHHSPRITE m_hsprCursor; AVHHSPRITE m_hsprCursor;
float m_flTime; // the current client time float m_flTime; // the current client time
float m_fOldTime; // the time at which the HUD was last redrawn float m_fOldTime; // the time at which the HUD was last redrawn
float m_wsFOV; //fov recalc corrected for widescreen //float m_wsFOV; //fov recalc corrected for widescreen
double m_flTimeDelta; // the difference between flTime and fOldTime double m_flTimeDelta; // the difference between flTime and fOldTime
Vector m_vecOrigin; Vector m_vecOrigin;
Vector m_vecAngles; Vector m_vecAngles;
@ -34,17 +42,89 @@ public:
int m_iRes; int m_iRes;
cvar_t *m_pCvarStealMouse; cvar_t *m_pCvarStealMouse;
cvar_t *m_pCvarDraw; cvar_t *m_pCvarDraw;
bool m_bWindowed;
cvar_t* m_pCvarWidescreen;
int m_iFontHeight; int m_iFontHeight;
int DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b ); //int DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b );
int DrawHudStringCentered(int x, int y, int iMaxX, const char *szString, int r, int g, int b ); int DrawHudStringCentered(int x, int y, int iMaxX, const char *szString, int r, int g, int b );
int DrawHudString(int x, int y, int iMaxX, const char *szString, int r, int g, int b ); int DrawHudString(int x, int y, int iMaxX, const char *szString, int r, int g, int b );
int GetHudStringHeight(); int GetHudStringHeight();
int GetHudStringWidth(const char* szIt); int GetHudStringWidth(const char* szIt);
int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ); int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b );
int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ); //int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b );
int GetNumWidth(int iNumber, int iFlags); int GetNumWidth(int iNumber, int iFlags);
// New stuff
typedef enum {
COLOR_DEFAULT = 0,
COLOR_PRIMARY,
COLOR_SECONDARY,
COLOR_WARNING,
COLOR_COUNT
} hudcolor_e;
typedef enum {
a_northwest = 0,
a_north,
a_northeast,
a_west,
a_center,
a_east,
a_southwest,
a_south,
a_southeast,
} hudalign_e;
void DrawHudSprite(AVHHSPRITE pic, int frame, wrect_t* rect, int x, int y, int r, int g, int b, int a = 255, float scale = 1.0f, hudalign_e alignment = a_northwest);
//void DrawHudSprite(AVHHSPRITE pic, int frame, wrect_t* rect, int x, int y, hudcolor_e color, int a = 255, hudalign_e alignment = a_northwest);
//void DrawHudSpriteIndex(int index, int x, int y, hudcolor_e color, int a = 255, hudalign_e alignment = a_northwest);
void DrawHudSpriteIndex(int index, int x, int y, int r, int g, int b, int a = 255, float scale = 1.0f, hudalign_e alignment = a_northwest);
void DrawHudFill(int x, int y, int w, int h, int r, int g, int b, int a, float scale = 1.0f);
//void DrawHudFill(int x, int y, int w, int h, hudcolor_e color, int a);
int DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b, int a = 255, float scale = 1.0f, hudalign_e alignment = a_northwest);
//int DrawHudNumber(int x, int y, int iFlags, int iNumber, hudcolor_e color, int a = 255, hudalign_e alignment = a_northwest);
//int DrawHudStringReverse(int xpos, int ypos, int iMinX, const char* szString, int r, int g, int b);
int DrawHudNumberString(int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b);
int GetHudNumberWidth(int number, int width, int flags, float scale = 1.0f);
int DrawHudNumberReverse(int x, int y, int number, int flags, int r, int g, int b, int a = 255, float scale = 1.0f, hudalign_e alignment = a_northwest);
//int DrawHudNumberReverse(int x, int y, int number, int flags, hudcolor_e color, int a = 255, hudalign_e alignment = a_northwest);
//int DrawHudString(const char* string, int x, int y);
//void GetHudStringSize(const char* string, int& width, int& height);
//int HudStringLen(const char* string);
//void GetChatInputPosition(int& x, int& y);
inline unsigned int GetWidth() const
{
return m_iConWidth;
}
inline unsigned int GetHeight() const
{
return m_iConHeight;
}
inline float GetScaleX() const
{
return m_flScaleX;
}
inline float GetScaleY() const
{
return m_flScaleY;
}
//inline void GetColor(int& r, int& g, int& b, hudcolor_e color) const
//{
// r = m_cColors[color].r;
// g = m_cColors[color].g;
// b = m_cColors[color].b;
//}
private: private:
// the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded. // the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded.
// freed in ~CHud() // freed in ~CHud()

View file

@ -23,7 +23,8 @@
#define DHN_DRAWZERO 1 #define DHN_DRAWZERO 1
#define DHN_2DIGITS 2 #define DHN_2DIGITS 2
#define DHN_3DIGITS 4 #define DHN_3DIGITS 4
#define MIN_ALPHA 100 //#define MIN_ALPHA 100
#define MIN_ALPHA 128
#define HUDELEM_ACTIVE 1 #define HUDELEM_ACTIVE 1
@ -341,7 +342,10 @@ public:
int VidInit( void ); int VidInit( void );
int Draw(float flTime); int Draw(float flTime);
int MsgFunc_Battery(const char *pszName, int iSize, void *pbuf ); int MsgFunc_Battery(const char *pszName, int iSize, void *pbuf );
int m_iAnchorX; // our x position, set by the health hud
int m_iAnchorY; // our y position, set by the health hud
private: private:
AVHHSPRITE m_hSprite1; AVHHSPRITE m_hSprite1;
AVHHSPRITE m_hSprite2; AVHHSPRITE m_hSprite2;

View file

@ -95,8 +95,8 @@
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions> <IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\glew;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD;GLEW_STATIC</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader> <PrecompiledHeader>
@ -158,8 +158,8 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\glew;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;GLEW_STATIC</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader> <PrecompiledHeader>
@ -221,8 +221,8 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion> <InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions> <IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\glew;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ITERATOR_DEBUG_LEVEL=2;_DEBUG;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ITERATOR_DEBUG_LEVEL=2;_DEBUG;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD;GLEW_STATIC</PreprocessorDefinitions>
<StringPooling> <StringPooling>
</StringPooling> </StringPooling>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
@ -281,6 +281,22 @@
</ResourceCompile> </ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\includes\glew\GL\glew.c">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="..\util\ShaderUtil.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="ammo.cpp"> <ClCompile Include="ammo.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
@ -564,6 +580,14 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<ClCompile Include="shader.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="status_icons.cpp"> <ClCompile Include="status_icons.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
@ -1615,7 +1639,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\util\Balance.cpp" /> <ClCompile Include="..\util\Balance.cpp" />
<ClCompile Include="..\util\Checksum.cpp" /> <ClCompile Include="..\util\Checksum.cpp" />
<ClCompile Include="..\util\GammaTable.cpp" />
<ClCompile Include="..\util\LinuxSupport.cpp" /> <ClCompile Include="..\util\LinuxSupport.cpp" />
<ClCompile Include="..\util\Mat3.cpp" /> <ClCompile Include="..\util\Mat3.cpp" />
<ClCompile Include="..\util\MathUtil.cpp" /> <ClCompile Include="..\util\MathUtil.cpp" />
@ -1627,6 +1650,10 @@
<ClCompile Include="..\textrep\TRFactory.cpp" /> <ClCompile Include="..\textrep\TRFactory.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\includes\glew\GL\eglew.h" />
<ClInclude Include="..\includes\glew\GL\glew.h" />
<ClInclude Include="..\includes\glew\GL\glxew.h" />
<ClInclude Include="..\includes\glew\GL\wglew.h" />
<ClInclude Include="..\mod\AvHAlienAbilities.h" /> <ClInclude Include="..\mod\AvHAlienAbilities.h" />
<ClInclude Include="..\mod\AvHAlienWeaponConstants.h" /> <ClInclude Include="..\mod\AvHAlienWeaponConstants.h" />
<ClInclude Include="..\mod\AvHAlienWeapons.h" /> <ClInclude Include="..\mod\AvHAlienWeapons.h" />
@ -1634,6 +1661,7 @@
<ClInclude Include="..\mod\AvHMarineWeapon.h" /> <ClInclude Include="..\mod\AvHMarineWeapon.h" />
<ClInclude Include="..\mod\AvHMarineWeaponConstants.h" /> <ClInclude Include="..\mod\AvHMarineWeaponConstants.h" />
<ClInclude Include="..\mod\AvHMarineWeapons.h" /> <ClInclude Include="..\mod\AvHMarineWeapons.h" />
<ClInclude Include="..\util\ShaderUtil.h" />
<ClInclude Include="ammo.h" /> <ClInclude Include="ammo.h" />
<ClInclude Include="ammohistory.h" /> <ClInclude Include="ammohistory.h" />
<ClInclude Include="..\game_shared\bitvec.h" /> <ClInclude Include="..\game_shared\bitvec.h" />
@ -1763,7 +1791,6 @@
<ClInclude Include="..\util\Balance.h" /> <ClInclude Include="..\util\Balance.h" />
<ClInclude Include="..\util\Checksum.h" /> <ClInclude Include="..\util\Checksum.h" />
<ClInclude Include="..\util\CString.h" /> <ClInclude Include="..\util\CString.h" />
<ClInclude Include="..\util\GammaTable.h" />
<ClInclude Include="..\util\LinuxSupport.h" /> <ClInclude Include="..\util\LinuxSupport.h" />
<ClInclude Include="..\util\Mat3.h" /> <ClInclude Include="..\util\Mat3.h" />
<ClInclude Include="..\util\MathUtil.h" /> <ClInclude Include="..\util\MathUtil.h" />

View file

@ -31,6 +31,9 @@
<Filter Include="textrep"> <Filter Include="textrep">
<UniqueIdentifier>{ad5bbb2c-1092-4ba3-ab5b-fdfa0a33f1f5}</UniqueIdentifier> <UniqueIdentifier>{ad5bbb2c-1092-4ba3-ab5b-fdfa0a33f1f5}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\glew">
<UniqueIdentifier>{57cad65d-80b8-4d06-abb5-8ff8dc1d60cc}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ammo.cpp"> <ClCompile Include="ammo.cpp">
@ -552,9 +555,6 @@
<ClCompile Include="..\util\Checksum.cpp"> <ClCompile Include="..\util\Checksum.cpp">
<Filter>util</Filter> <Filter>util</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\util\GammaTable.cpp">
<Filter>util</Filter>
</ClCompile>
<ClCompile Include="..\util\LinuxSupport.cpp"> <ClCompile Include="..\util\LinuxSupport.cpp">
<Filter>util</Filter> <Filter>util</Filter>
</ClCompile> </ClCompile>
@ -600,6 +600,15 @@
<ClCompile Include="hudgl.cpp"> <ClCompile Include="hudgl.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="shader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\util\ShaderUtil.cpp">
<Filter>util</Filter>
</ClCompile>
<ClCompile Include="..\includes\glew\GL\glew.c">
<Filter>Source Files\glew</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\mod\AvHAlienAbilities.h"> <ClInclude Include="..\mod\AvHAlienAbilities.h">
@ -1004,9 +1013,6 @@
<ClInclude Include="..\util\CString.h"> <ClInclude Include="..\util\CString.h">
<Filter>util</Filter> <Filter>util</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\util\GammaTable.h">
<Filter>util</Filter>
</ClInclude>
<ClInclude Include="..\util\LinuxSupport.h"> <ClInclude Include="..\util\LinuxSupport.h">
<Filter>util</Filter> <Filter>util</Filter>
</ClInclude> </ClInclude>
@ -1052,6 +1058,21 @@
<ClInclude Include="hudgl.h"> <ClInclude Include="hudgl.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\util\ShaderUtil.h">
<Filter>util</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\glxew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\wglew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\eglew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\glew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Library Include="..\lib\public\game_controls.lib" /> <Library Include="..\lib\public\game_controls.lib" />

View file

@ -87,11 +87,12 @@ void HUD_SendWeaponAnim( int iAnim, int body, int force )
// Don't actually change it. // Don't actually change it.
if ( !g_runfuncs && !force ) if ( !g_runfuncs && !force )
return; return;
g_currentanim = iAnim; g_currentanim = iAnim;
// Tell animation system new info // Tell animation system new info
gEngfuncs.pfnWeaponAnim( iAnim, body ); gEngfuncs.pfnWeaponAnim( iAnim, body );
//gEngfuncs.Con_Printf("forcing animation g_currentanim:%d new anim:%d\n", g_currentanim, iAnim);
} }
} }
@ -107,6 +108,11 @@ int HUD_GetWeaponAnim( void )
return g_currentanim; return g_currentanim;
} }
void HUD_SetWeaponAnim(int anim)
{
g_currentanim = anim;
}
/* /*
===================== =====================
HUD_PlaySound HUD_PlaySound

View file

@ -28,6 +28,7 @@ float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
int UTIL_SharedRandomLong( unsigned int seed, int low, int high ); int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
int HUD_GetWeaponAnim( void ); int HUD_GetWeaponAnim( void );
void HUD_SetWeaponAnim(int anim);
void HUD_SendWeaponAnim( int iAnim, int body, int force ); void HUD_SendWeaponAnim( int iAnim, int body, int force );
void HUD_PlaySound( char *sound, float volume ); void HUD_PlaySound( char *sound, float volume );
void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );

View file

@ -28,6 +28,7 @@
#include "mod/AvHHudConstants.h" #include "mod/AvHHudConstants.h"
#include "mod/AvHPlayerUpgrade.h" #include "mod/AvHPlayerUpgrade.h"
#include "mod/AvHNetworkMessages.h" #include "mod/AvHNetworkMessages.h"
#include "chudmisc.h"
DECLARE_MESSAGE(m_Health, Health ) DECLARE_MESSAGE(m_Health, Health )
DECLARE_MESSAGE(m_Health, Damage ) DECLARE_MESSAGE(m_Health, Damage )
@ -66,9 +67,14 @@ int CHudHealth::Init(void)
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0; m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
giDmgHeight = 0; giDmgHeight = 0;
giDmgWidth = 0; giDmgWidth = 0;
m_fHealthScale = 1.0f;
memset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES); memset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES);
hud_health_x = CVAR_CREATE("hud_health_x", "0", FCVAR_ARCHIVE);
hud_health_y = CVAR_CREATE("hud_health_y", "0", FCVAR_ARCHIVE);
hud_health_scale = CVAR_CREATE("hud_health_scale", "1", FCVAR_ARCHIVE);
hud_health_alphamin = CVAR_CREATE("hud_health_alphamin", "128", FCVAR_ARCHIVE);
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
return 1; return 1;
@ -160,6 +166,91 @@ void CHudHealth::GetPainColor( int &r, int &g, int &b )
} }
} }
//// Old HUD drawing.
//int CHudHealth::Draw(float flTime)
//{
// int r, g, b;
// int a = 0, x, y;
// int HealthWidth;
//
// if ( /*!gHUD.GetIsAlive() ||*/ (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) /*|| gEngfuncs.IsSpectateOnly()*/)
// return 1;
//
// if (!m_hSprite)
// m_hSprite = LoadSprite(PAIN_NAME);
//
// // Has health changed? Flash the health #
// if (m_fFade)
// {
// m_fFade -= (gHUD.m_flTimeDelta * 20);
// if (m_fFade <= 0)
// {
// a = MIN_ALPHA;
// m_fFade = 0;
// }
//
// // Fade the health number back to dim
//
// a = MIN_ALPHA + (m_fFade / FADE_TIME) * 128;
//
// }
// else
// a = MIN_ALPHA;
//
// // Potentially se upgrades and health of spectator target
// int theUpgrades = gHUD.GetHUDUpgrades();
//
// // If health is getting low, make it bright red
// int theMaxHealth = gHUD.GetHUDMaxHealth();
// if (m_iHealth <= theMaxHealth / 10)
// {
// a = 255;
// }
//
// GetPainColor(r, g, b);
// ScaleColors(r, g, b, a);
//
// int theViewport[4];
// gHUD.GetViewport(theViewport);
//
// // Only draw health if we have the suit.
// if (gHUD.m_iWeaponBits & (1 << (WEAPON_SUIT)))
// {
// HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
// int CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left;
//
// y = theViewport[1] + theViewport[3] - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
//
// x = theViewport[0] + CrossWidth / 2;
//
// int theInset = 0;
// //if(gHUD.GetIsAlien() && !gHUD.GetIsCombatMode())
// //{
// // theInset = ScreenWidth()*kResourceEnergyBarWidth;
// //}
// x += theInset;// + kHealthLeftInset*ScreenWidth;
//
// SPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b);
// SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross));
//
// x += CrossWidth + HealthWidth / 2;
//
// x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b);
//
// x += HealthWidth / 2;
//
// gHUD.GetPrimaryHudColor(r, g, b);
//
// int iHeight = gHUD.m_iFontHeight;
// int iWidth = HealthWidth / 10;
// FillRGBA(x, y, iWidth, iHeight, r, g, b, a);
// }
//
// DrawDamage(flTime);
// return DrawPain(flTime);
//}
int CHudHealth::Draw(float flTime) int CHudHealth::Draw(float flTime)
{ {
int r, g, b; int r, g, b;
@ -172,23 +263,24 @@ int CHudHealth::Draw(float flTime)
if ( !m_hSprite ) if ( !m_hSprite )
m_hSprite = LoadSprite(PAIN_NAME); m_hSprite = LoadSprite(PAIN_NAME);
if (hud_health_alphamin)
m_iMinAlpha = max(0, min(hud_health_alphamin->value, 255));
else
m_iMinAlpha = MIN_ALPHA;
// Has health changed? Flash the health # // Has health changed? Flash the health #
if (m_fFade) if (m_fFade)
{ {
m_fFade -= (gHUD.m_flTimeDelta * 20); m_fFade -= (gHUD.m_flTimeDelta * 20);
if (m_fFade <= 0) if (m_fFade <= 0)
{ {
a = MIN_ALPHA;
m_fFade = 0; m_fFade = 0;
} }
// Fade the health number back to dim // Fade the health number back to dim
a = m_iMinAlpha + (m_fFade/FADE_TIME) * 128;
a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128;
} }
else else
a = MIN_ALPHA; a = m_iMinAlpha;
// Potentially se upgrades and health of spectator target // Potentially se upgrades and health of spectator target
int theUpgrades = gHUD.GetHUDUpgrades(); int theUpgrades = gHUD.GetHUDUpgrades();
@ -203,40 +295,56 @@ int CHudHealth::Draw(float flTime)
GetPainColor( r, g, b ); GetPainColor( r, g, b );
ScaleColors(r, g, b, a ); ScaleColors(r, g, b, a );
int theViewport[4];
gHUD.GetViewport(theViewport);
// Only draw health if we have the suit. // Only draw health if we have the suit.
if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT))) if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)))
{ {
HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left; if (hud_health_scale)
int CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left; {
m_fHealthScale = min(max(0.01f, hud_health_scale->value), 5.0f);
}
y = theViewport[1] + theViewport[3] - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2; HealthWidth = (gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left) * m_fHealthScale;
int CrossWidth = (gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left) * m_fHealthScale;
x = theViewport[0] + CrossWidth /2;
int theInset = 0; if (hud_health_x && hud_health_x->value != 0.0f)
//if(gHUD.GetIsAlien() && !gHUD.GetIsCombatMode()) {
//{ x = min(max(0.0f, hud_health_x->value), 1.0f) * gHUD.GetWidth();
// theInset = ScreenWidth()*kResourceEnergyBarWidth; }
//} else
x += theInset;// + kHealthLeftInset*ScreenWidth; {
//TODO: Inset position for ultrawide monitors.
SPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b); //if (gHUD.GetWidth() > (gHUD.GetHeight() * 1.78f)){}
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross));
x = CrossWidth / 2;
}
int initialY = gHUD.GetHeight();
if (hud_health_y && hud_health_y->value != 0.0f)
{
initialY *= min(max(0.0f, hud_health_y->value), 1.0f);
}
y = initialY - gHUD.m_iFontHeight / 2;
gHUD.DrawHudSpriteIndex(m_HUD_cross, x, y, r, g, b, 255, m_fHealthScale, CHud::a_southwest);
x += CrossWidth + HealthWidth / 2; x += CrossWidth + HealthWidth / 2;
//Reserve space for 3 digits by default, but allow it to expand
x += gHUD.GetHudNumberWidth(m_iHealth, 3, DHN_DRAWZERO, m_fHealthScale);
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b); gHUD.DrawHudNumberReverse(x, y, m_iHealth, DHN_DRAWZERO, r, g, b, 255, m_fHealthScale, CHud::a_southwest);
x += HealthWidth/2; x += HealthWidth /2;
gHUD.GetPrimaryHudColor(r, g, b); gHUD.GetPrimaryHudColor(r, g, b);
int iHeight = gHUD.m_iFontHeight; int iHeight = gHUD.m_iFontHeight * -1;
int iWidth = HealthWidth/10; int iWidth = max(1, HealthWidth /10);
FillRGBA(x, y, iWidth, iHeight, r, g, b, a);
gHUD.DrawHudFill(x, y, iWidth, iHeight, r ,g , b, a, m_fHealthScale);
gHUD.m_Battery.m_iAnchorX = x + iWidth + HealthWidth / 2;
gHUD.m_Battery.m_iAnchorY = initialY;
} }
DrawDamage(flTime); DrawDamage(flTime);

View file

@ -101,6 +101,8 @@ public:
float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight; float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight;
void GetPainColor( int &r, int &g, int &b ); void GetPainColor( int &r, int &g, int &b );
float m_fFade; float m_fFade;
float m_fHealthScale;
int m_iMinAlpha;
private: private:
AVHHSPRITE m_hSprite; AVHHSPRITE m_hSprite;
@ -112,6 +114,11 @@ private:
int DrawDamage(float fTime); int DrawDamage(float fTime);
void CalcDamageDirection(vec3_t vecFrom); void CalcDamageDirection(vec3_t vecFrom);
void UpdateTiles(float fTime, long bits); void UpdateTiles(float fTime, long bits);
cvar_t* hud_health_x;
cvar_t* hud_health_y;
cvar_t* hud_health_scale;
cvar_t* hud_health_alphamin;
}; };
#endif #endif

View file

@ -151,6 +151,8 @@ int gSiegeViewHitEventID;
int gCommanderPointsAwardedEventID; int gCommanderPointsAwardedEventID;
int gBlinkEffectSuccessEventID; int gBlinkEffectSuccessEventID;
static float prevUseTime = 0;
//bool gPlayingJetpack = false; //bool gPlayingJetpack = false;
//CGlock g_Glock; //CGlock g_Glock;
//CCrowbar g_Crowbar; //CCrowbar g_Crowbar;
@ -502,6 +504,21 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fInReload = FALSE; m_fInReload = FALSE;
} }
if (m_pPlayer->pev->button & IN_USE)
{
prevUseTime = gpGlobals->time;
}
else if (gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2 && m_pPlayer->m_afButtonReleased & IN_USE && m_pPlayer->pev->weaponanim == 4)
{
switch (gHUD.GetCurrentWeaponID())
{
case AVH_WEAPON_SPIT:
case AVH_WEAPON_BILEBOMB:
this->SendWeaponAnim(7);
break;
}
}
// Properly propagate the end animation // Properly propagate the end animation
if (this->PrevAttack2Status == true && !(m_pPlayer->pev->button & IN_ATTACK2)) if (this->PrevAttack2Status == true && !(m_pPlayer->pev->button & IN_ATTACK2))
{ {
@ -511,77 +528,95 @@ void CBasePlayerWeapon::ItemPostFrame( void )
this->SendWeaponAnim(12); this->SendWeaponAnim(12);
break; break;
case AVH_WEAPON_ACIDROCKET: case AVH_WEAPON_ACIDROCKET:
this->SendWeaponAnim(8); this->SendWeaponAnim(13);
break; break;
case AVH_WEAPON_CLAWS: case AVH_WEAPON_CLAWS:
this->SendWeaponAnim(9); this->SendWeaponAnim(9);
break; break;
case AVH_WEAPON_STOMP: case AVH_WEAPON_STOMP:
this->SendWeaponAnim(8); this->SendWeaponAnim(11);
break; break;
case AVH_WEAPON_DEVOUR: case AVH_WEAPON_DEVOUR:
this->SendWeaponAnim(11); this->SendWeaponAnim(12);
break; break;
} }
} }
if ( (m_pPlayer->pev->button & IN_ATTACK) && !(m_pPlayer->pev->button & IN_ATTACK2)) if ((m_pPlayer->pev->button & IN_ATTACK || (this->m_bAttackQueued && m_flNextPrimaryAttack <= 0.0)) && (!(m_pPlayer->pev->button & IN_ATTACK2) || gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER3))
{ {
if ((m_fInSpecialReload == 1 || m_fInSpecialReload == 2) && m_iClip != 0) if (GetCanUseWeapon())
{
m_fInSpecialReload = 3;
Reload();
}
else if (GetCanUseWeapon() && (m_flNextPrimaryAttack <= 0.0))
{ {
if ( (m_iClip == 0 && ii.pszAmmo1) || if ((m_fInSpecialReload == 1 || m_fInSpecialReload == 2) && m_iClip != 0)
(ii.iMaxClip == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{
m_fFireOnEmpty = TRUE;
}
if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1)
&& (gHUD.GetCurrentWeaponID() == AVH_ABILITY_LEAP)
&& (this->m_flLastAnimationPlayed + (float)BALANCE_VAR(kLeapROF) <= gpGlobals->time))
{ {
// : 0001151 predict energy too m_fInSpecialReload = 3;
AvHAlienWeapon* theWeapon = dynamic_cast<AvHAlienWeapon *>(g_pWpns[AVH_ABILITY_LEAP]); Reload();
if ( theWeapon && theWeapon->IsUseable() ) { }
float theVolumeScalar = 1.0f; else if (m_flNextPrimaryAttack <= 0.0)
cl_entity_t *player = gEngfuncs.GetLocalPlayer(); {
int theSilenceLevel = AvHGetAlienUpgradeLevel(player->curstate.iuser4, MASK_UPGRADE_6); if ( (m_iClip == 0 && ii.pszAmmo1) ||
switch(theSilenceLevel) (ii.iMaxClip == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{ {
case 1: m_fFireOnEmpty = TRUE;
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel1Volume); }
break;
case 2:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel2Volume); if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1)
break; && (gHUD.GetCurrentWeaponID() == AVH_ABILITY_LEAP)
case 3: && (this->m_flLastAnimationPlayed + (float)BALANCE_VAR(kLeapROF) <= gpGlobals->time))
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel3Volume); {
break; // : 0001151 predict energy too
} AvHAlienWeapon* theWeapon = dynamic_cast<AvHAlienWeapon *>(g_pWpns[AVH_ABILITY_LEAP]);
HUD_PlaySound( kLeapSound, theVolumeScalar); if ( theWeapon && theWeapon->IsUseable() ) {
AvHMUDeductAlienEnergy(m_pPlayer->pev->fuser3, theWeapon->GetEnergyForAttack() ); float theVolumeScalar = 1.0f;
gEngfuncs.pEventAPI->EV_WeaponAnimation(3, 2); cl_entity_t *player = gEngfuncs.GetLocalPlayer();
this->m_flLastAnimationPlayed = gpGlobals->time; int theSilenceLevel = AvHGetAlienUpgradeLevel(player->curstate.iuser4, MASK_UPGRADE_6);
} switch(theSilenceLevel)
{
case 1:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel1Volume);
break;
case 2:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel2Volume);
break;
case 3:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel3Volume);
break;
}
HUD_PlaySound( kLeapSound, theVolumeScalar);
AvHMUDeductAlienEnergy(m_pPlayer->pev->fuser3, theWeapon->GetEnergyForAttack() );
gEngfuncs.pEventAPI->EV_WeaponAnimation(3, 2);
this->m_flLastAnimationPlayed = gpGlobals->time;
}
}
PrimaryAttack();
//return;
}
else
{
if (m_pPlayer->m_afButtonPressed & IN_ATTACK)
{
QueueAttack();
}
} }
//#ifdef AVH_CLIENT
//if((m_iClip == 0) && ?
//#endif
PrimaryAttack();
//return;
} }
} }
// +movement: Rewritten to allow us to use +attack2 for movement abilities // +movement: Rewritten to allow us to use +attack2 for movement abilities
else if ((m_pPlayer->pev->button & IN_ATTACK2) && (gHUD.GetIsAlien())) else if ((m_pPlayer->pev->button & IN_ATTACK2) && (gHUD.GetIsAlien()))
{ {
AvHUser3 theUser3 = gHUD.GetHUDUser3();
//m_flNextSecondaryAttack //m_flNextSecondaryAttack
// Find out what kind of special movement we are using, and execute the animation for it // Find out what kind of special movement we are using, and execute the animation for it
if (this->PrevAttack2Status == false)
if (theUser3 == AVH_USER3_ALIEN_PLAYER2)
{
if (GetCanUseWeapon() && m_flNextPrimaryAttack <= 0.0)
{
SecondaryAttack();
}
}
else if (this->PrevAttack2Status == false)
{ {
bool enabled=false; bool enabled=false;
// : 0001151 predict energy too // : 0001151 predict energy too
@ -589,7 +624,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
if ( theWeapon ) if ( theWeapon )
enabled=theWeapon->IsUseable(); enabled=theWeapon->IsUseable();
switch (gHUD.GetHUDUser3()) switch (theUser3)
{ {
case AVH_USER3_ALIEN_PLAYER1: case AVH_USER3_ALIEN_PLAYER1:
@ -634,22 +669,23 @@ void CBasePlayerWeapon::ItemPostFrame( void )
this->SendWeaponAnim(5); this->SendWeaponAnim(5);
break; break;
case AVH_WEAPON_DEVOUR: case AVH_WEAPON_DEVOUR:
this->SendWeaponAnim(18); this->SendWeaponAnim(19);
break; break;
case AVH_WEAPON_STOMP: case AVH_WEAPON_STOMP:
this->SendWeaponAnim(15); this->SendWeaponAnim(16);
break; break;
} }
break; break;
} }
} }
if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1) if ((theUser3 == AVH_USER3_ALIEN_PLAYER1) && (this->m_flLastAnimationPlayed + BALANCE_VAR(kLeapROF) < gpGlobals->time))
&& (this->m_flLastAnimationPlayed + BALANCE_VAR(kLeapROF) < gpGlobals->time))
this->PrevAttack2Status = false; this->PrevAttack2Status = false;
else else
this->PrevAttack2Status = true; this->PrevAttack2Status = true;
this->PrevAttack2Time = gpGlobals->time;
return; return;
// if (GetCanUseWeapon()) // if (GetCanUseWeapon())
// { // {
@ -674,7 +710,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
// no fire buttons down // no fire buttons down
m_fFireOnEmpty = FALSE; m_fFireOnEmpty = FALSE;
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing // weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
if (m_iClip == 0 && !(ii.iFlags & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < 0.0) if (m_iClip == 0 && !(ii.iFlags & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < 0.0)
{ {
@ -1210,7 +1246,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
} }
pfrom = &from->weapondata[ i ]; pfrom = &from->weapondata[ i ];
pCurrent->m_fInReload = pfrom->m_fInReload; pCurrent->m_fInReload = pfrom->m_fInReload;
pCurrent->m_fInSpecialReload = pfrom->m_fInSpecialReload; pCurrent->m_fInSpecialReload = pfrom->m_fInSpecialReload;
// pCurrent->m_flPumpTime = pfrom->m_flPumpTime; // pCurrent->m_flPumpTime = pfrom->m_flPumpTime;
@ -1218,6 +1254,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
pCurrent->m_flNextPrimaryAttack = pfrom->m_flNextPrimaryAttack; pCurrent->m_flNextPrimaryAttack = pfrom->m_flNextPrimaryAttack;
pCurrent->m_flNextSecondaryAttack = pfrom->m_flNextSecondaryAttack; pCurrent->m_flNextSecondaryAttack = pfrom->m_flNextSecondaryAttack;
pCurrent->m_flTimeWeaponIdle = pfrom->m_flTimeWeaponIdle; pCurrent->m_flTimeWeaponIdle = pfrom->m_flTimeWeaponIdle;
if(pWeapon && (pWeapon->m_iId == pfrom->m_iId)) if(pWeapon && (pWeapon->m_iId == pfrom->m_iId))
{ {
// Predict clip // Predict clip
@ -1242,8 +1279,9 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
pCurrent->m_flStartThrow = pfrom->fuser2; pCurrent->m_flStartThrow = pfrom->fuser2;
pCurrent->m_flReleaseThrow = pfrom->fuser3; pCurrent->m_flReleaseThrow = pfrom->fuser3;
// pCurrent->m_chargeReady = pfrom->iuser1; // pCurrent->m_chargeReady = pfrom->iuser1;
// pCurrent->m_fInAttack = pfrom->iuser2; pCurrent->m_fInAttack = pfrom->iuser2;
pCurrent->pev->iuser3 = pfrom->iuser3; pCurrent->pev->iuser3 = pfrom->iuser3;
pCurrent->m_bAttackQueued = pfrom->iuser4;
// pCurrent->m_iSecondaryAmmoType = (int)from->client.vuser3[2]; // pCurrent->m_iSecondaryAmmoType = (int)from->client.vuser3[2];
// pCurrent->m_iPrimaryAmmoType = (int)from->client.vuser4[0]; // pCurrent->m_iPrimaryAmmoType = (int)from->client.vuser4[0];
@ -1390,18 +1428,50 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
// Make sure that weapon animation matches what the game .dll is telling us // Make sure that weapon animation matches what the game .dll is telling us
// over the wire ( fixes some animation glitches ) // over the wire ( fixes some animation glitches )
// Ensure that the fade and onos won't get these, to play the blink and charge animations correctly if (g_runfuncs && HUD_GetWeaponAnim() != to->client.weaponanim)
bool noRun = (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER4) || (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER5);
if (g_runfuncs && ( HUD_GetWeaponAnim() != to->client.weaponanim ) && !(CheckInAttack2()) && !noRun)
{ {
int body = 2; int body = 2;
bool processTheAnim = true;
//gEngfuncs.Con_Printf("trying to force animation on client currentanim:%d serveranim:%d nextattack:%f time:%f\n", HUD_GetWeaponAnim(), to->client.weaponanim, to->client.m_flNextAttack, gpGlobals->time);
//// 2024 - Don't correct with +movement transitional animations since +movement animations are hacked in on the client and it bugs out. Remove most of this if alien weapons get refactored to shared code.
if (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER5)
{
if ((gpGlobals->time - pWeapon->PrevAttack2Time < 1.0f) || (to->client.weaponanim > 4 && to->client.weaponanim < 21))
//(to->client.weaponanim == 27 && gpGlobals->time - pWeapon->PrevAttack2Time < 10.0f) ||
{
processTheAnim = false;
}
}
else if (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER4)
{
if ((gpGlobals->time - pWeapon->PrevAttack2Time < 1.0f) || (to->client.weaponanim > 7 && to->client.weaponanim < 14))
//(to->client.weaponanim == 5 && gpGlobals->time - pWeapon->PrevAttack2Time < 10.0f) ||
{
processTheAnim = false;
}
}
//else if (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER3 && to->client.weaponanim > 6 && to->client.weaponanim < 13)
else if (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER1)
{
if (gpGlobals->time - pWeapon->PrevAttack2Time < 1.0f)
processTheAnim = false;
}
// Gorge building animation fixes since it's server side and the new transition out of it is client side.
else if (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER2)
{
if (player.pev->button & IN_USE ||
(to->client.weaponanim == 4 && gpGlobals->time - prevUseTime < 10.0f) ||
(to->client.weaponanim < 2 && gpGlobals->time - prevUseTime < 1.0f) ||
(HUD_GetWeaponAnim() == 4 && to->client.weaponanim == 5))
{
processTheAnim = false;
}
}
//Pop the model to body 0.
//if ( pWeapon == &g_Tripmine )
// body = 0;
// Force a fixed anim down to viewmodel // Force a fixed anim down to viewmodel
HUD_SendWeaponAnim( to->client.weaponanim, body, 1 ); if (processTheAnim)
HUD_SendWeaponAnim(to->client.weaponanim, body, 1);
} }
for ( i = 0; i < 32; i++ ) for ( i = 0; i < 32; i++ )
@ -1427,8 +1497,9 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
// pto->fuser2 = pCurrent->m_flStartThrow; // pto->fuser2 = pCurrent->m_flStartThrow;
// pto->fuser3 = pCurrent->m_flReleaseThrow; // pto->fuser3 = pCurrent->m_flReleaseThrow;
// pto->iuser1 = pCurrent->m_chargeReady; // pto->iuser1 = pCurrent->m_chargeReady;
// pto->iuser2 = pCurrent->m_fInAttack; pto->iuser2 = pCurrent->m_fInAttack;
pto->iuser3 = pCurrent->pev->iuser3; pto->iuser3 = pCurrent->pev->iuser3;
pto->iuser4 = pCurrent->m_bAttackQueued;
// Decrement weapon counters, server does this at same time ( during post think, after doing everything else ) // Decrement weapon counters, server does this at same time ( during post think, after doing everything else )
pto->m_flNextReload -= cmd->msec / 1000.0; pto->m_flNextReload -= cmd->msec / 1000.0;

View file

@ -209,9 +209,9 @@ void CHud :: Init( void )
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE ); m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" ); cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
CVAR_CREATE( "cl_showspeed", "0", 0); CVAR_CREATE( "cl_showspeed", "0", FCVAR_ARCHIVE);
CVAR_CREATE( kvLabelMaps, "3", FCVAR_ARCHIVE); CVAR_CREATE( kvLabelMaps, "3", FCVAR_ARCHIVE);
CVAR_CREATE( kvGammaRamp, "0", FCVAR_ARCHIVE); //CVAR_CREATE( kvGammaRamp, "0", FCVAR_ARCHIVE);
CVAR_CREATE( kvCustomCrosshair, "1", FCVAR_ARCHIVE); CVAR_CREATE( kvCustomCrosshair, "1", FCVAR_ARCHIVE);
CVAR_CREATE( kvHudMapZoom, "3", FCVAR_ARCHIVE); CVAR_CREATE( kvHudMapZoom, "3", FCVAR_ARCHIVE);
CVAR_CREATE( kvLabelHivesight, "1", FCVAR_ARCHIVE); CVAR_CREATE( kvLabelHivesight, "1", FCVAR_ARCHIVE);
@ -219,6 +219,7 @@ void CHud :: Init( void )
CVAR_CREATE( "cl_icong", "149", FCVAR_ARCHIVE); CVAR_CREATE( "cl_icong", "149", FCVAR_ARCHIVE);
CVAR_CREATE( "cl_iconb", "221", FCVAR_ARCHIVE); CVAR_CREATE( "cl_iconb", "221", FCVAR_ARCHIVE);
CVAR_CREATE("hud_style", "1", FCVAR_ARCHIVE);
CVAR_CREATE("cl_weaponswap", "2", FCVAR_ARCHIVE | FCVAR_USERINFO); CVAR_CREATE("cl_weaponswap", "2", FCVAR_ARCHIVE | FCVAR_USERINFO);
CVAR_CREATE("hud_teamhealthalert", "95", FCVAR_ARCHIVE); CVAR_CREATE("hud_teamhealthalert", "95", FCVAR_ARCHIVE);
CVAR_CREATE("hud_mapnames", "5", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnames", "5", FCVAR_ARCHIVE);
@ -227,7 +228,9 @@ void CHud :: Init( void )
CVAR_CREATE("hud_mapnamesGreen", "255", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnamesGreen", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_mapnamesBlue", "255", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnamesBlue", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE); CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE);
CVAR_CREATE("hud_drawwaypoints", "2", FCVAR_ARCHIVE); CVAR_CREATE("hud_waypoint_draw", "2", FCVAR_ARCHIVE);
CVAR_CREATE("hud_waypoint_blink", "2", FCVAR_ARCHIVE);
m_pCvarWidescreen = gEngfuncs.pfnGetCvarPointer("gl_widescreen_yfov");
m_pSpriteList = NULL; m_pSpriteList = NULL;
@ -326,7 +329,22 @@ void CHud :: VidInit( void )
gHUD.SetViewport(theViewPort); gHUD.SetViewport(theViewPort);
if (CVAR_GET_FLOAT("hud_style") == 2.0f) //Determine if we're playing in windowed mode so we can do mouse centering correctly later.
for (Uint32 id = 0; id < UINT32_MAX; ++id)
{
SDL_Window* theWindow = SDL_GetWindowFromID(id);
if (theWindow)
{
if (!(SDL_GetWindowFlags(theWindow) & SDL_WINDOW_FULLSCREEN))
{
m_bWindowed = true;
}
break;
}
}
if (CVAR_GET_FLOAT("hud_style") >= 2.0f)
{ {
mFont.Load("sprites/nl/font_arial"); mFont.Load("sprites/nl/font_arial");
mSmallFont.Load("sprites/nl/font_arialsmall"); mSmallFont.Load("sprites/nl/font_arialsmall");
@ -350,14 +368,25 @@ void CHud :: VidInit( void )
else else
m_iRes = 640; m_iRes = 640;
// HUD scaling
//m_iConHeight = m_iRes * 0.75F;
m_iConHeight = 600; // Replicate 800x600 scale since NS seems to have been designed for that.
m_flScaleY = ScreenHeight() / (float)m_iConHeight;
m_flScaleX = m_flScaleY;
m_flOffsetY = 0.0F;
m_bIsWidescreen = m_pCvarWidescreen->value == 0.0F;
// Only load this once // Only load this once
if ( !m_pSpriteList ) if ( !m_pSpriteList || gHUD.GetReInitHUD())
{ {
// we need to load the hud.txt, and all sprites within // we need to load the hud.txt, and all sprites within
if (CVAR_GET_FLOAT("hud_style") == 2.0f) if (CVAR_GET_FLOAT("hud_style") == 3.0f)
m_pSpriteList = SPR_GetList("sprites/hudnl.txt", &m_iSpriteCountAllRes); m_pSpriteList = SPR_GetList("sprites/hudnl.txt", &m_iSpriteCountAllRes);
else else
m_pSpriteList = SPR_GetList("sprites/hud.txt", &m_iSpriteCountAllRes); m_pSpriteList = SPR_GetList("sprites/hud.txt", &m_iSpriteCountAllRes);
if (m_pSpriteList) if (m_pSpriteList)
{ {

View file

@ -30,6 +30,7 @@ class TeamFortressViewport;
class AvHHud; class AvHHud;
#include "AvHHud.h" #include "AvHHud.h"
extern AvHHud gHUD; extern AvHHud gHUD;
extern CPostProcessShader g_PostProcessShader;
#include "wrect.h" #include "wrect.h"
#include "cl_dll.h" #include "cl_dll.h"

View file

@ -10,13 +10,13 @@ int CHudCrosshairs::Init()
{ {
m_iFlags = HUD_ACTIVE; m_iFlags = HUD_ACTIVE;
cl_cross = CVAR_CREATE("cl_cross", "0", FCVAR_ARCHIVE); cl_cross = CVAR_CREATE("cl_cross", "1", FCVAR_ARCHIVE);
cl_cross_color = CVAR_CREATE("cl_cross_color", "255 255 255", FCVAR_ARCHIVE); cl_cross_color = CVAR_CREATE("cl_cross_color", "255 255 255", FCVAR_ARCHIVE);
cl_cross_alpha = CVAR_CREATE("cl_cross_alpha", "255", FCVAR_ARCHIVE); cl_cross_alpha = CVAR_CREATE("cl_cross_alpha", "255", FCVAR_ARCHIVE);
cl_cross_thickness = CVAR_CREATE("cl_cross_thickness", "2", FCVAR_ARCHIVE); cl_cross_thickness = CVAR_CREATE("cl_cross_thickness", "2", FCVAR_ARCHIVE);
cl_cross_size = CVAR_CREATE("cl_cross_size", "6", FCVAR_ARCHIVE); cl_cross_size = CVAR_CREATE("cl_cross_size", "6", FCVAR_ARCHIVE);
cl_cross_gap = CVAR_CREATE("cl_cross_gap", "3", FCVAR_ARCHIVE); cl_cross_gap = CVAR_CREATE("cl_cross_gap", "3", FCVAR_ARCHIVE);
cl_cross_outline = CVAR_CREATE("cl_cross_outline", "2", FCVAR_ARCHIVE); cl_cross_outline = CVAR_CREATE("cl_cross_outline", "1", FCVAR_ARCHIVE);
cl_cross_outline_alpha = CVAR_CREATE("cl_cross_outline_alpha", "", FCVAR_ARCHIVE); cl_cross_outline_alpha = CVAR_CREATE("cl_cross_outline_alpha", "", FCVAR_ARCHIVE);
cl_cross_outline_inner = CVAR_CREATE("cl_cross_outline_inner", "0", FCVAR_ARCHIVE); cl_cross_outline_inner = CVAR_CREATE("cl_cross_outline_inner", "0", FCVAR_ARCHIVE);
cl_cross_circle_radius = CVAR_CREATE("cl_cross_circle_radius", "0", FCVAR_ARCHIVE); cl_cross_circle_radius = CVAR_CREATE("cl_cross_circle_radius", "0", FCVAR_ARCHIVE);
@ -31,10 +31,12 @@ int CHudCrosshairs::Init()
cl_cross_dot_alpha = CVAR_CREATE("cl_cross_dot_alpha", "", FCVAR_ARCHIVE); cl_cross_dot_alpha = CVAR_CREATE("cl_cross_dot_alpha", "", FCVAR_ARCHIVE);
cl_cross_dot_outline = CVAR_CREATE("cl_cross_dot_outline", "0", FCVAR_ARCHIVE); cl_cross_dot_outline = CVAR_CREATE("cl_cross_dot_outline", "0", FCVAR_ARCHIVE);
cl_cross_dot_outline_alpha = CVAR_CREATE("cl_cross_dot_outline_alpha", "", FCVAR_ARCHIVE); cl_cross_dot_outline_alpha = CVAR_CREATE("cl_cross_dot_outline_alpha", "", FCVAR_ARCHIVE);
cl_cross_dot_round = CVAR_CREATE("cl_cross_dot_round", "0", FCVAR_ARCHIVE);
cl_cross_line_top = CVAR_CREATE("cl_cross_line_top", "1", FCVAR_ARCHIVE); cl_cross_line_top = CVAR_CREATE("cl_cross_line_top", "1", FCVAR_ARCHIVE);
cl_cross_line_bottom = CVAR_CREATE("cl_cross_line_bottom", "1", FCVAR_ARCHIVE); cl_cross_line_bottom = CVAR_CREATE("cl_cross_line_bottom", "1", FCVAR_ARCHIVE);
cl_cross_line_left = CVAR_CREATE("cl_cross_line_left", "1", FCVAR_ARCHIVE); cl_cross_line_left = CVAR_CREATE("cl_cross_line_left", "1", FCVAR_ARCHIVE);
cl_cross_line_right = CVAR_CREATE("cl_cross_line_right", "1", FCVAR_ARCHIVE); cl_cross_line_right = CVAR_CREATE("cl_cross_line_right", "1", FCVAR_ARCHIVE);
cl_cross_scaling = CVAR_CREATE("cl_cross_scaling", "1", FCVAR_ARCHIVE);
gHUD.AddHudElem(this); gHUD.AddHudElem(this);
return 0; return 0;
@ -62,9 +64,33 @@ int CHudCrosshairs::Draw(float time)
unsigned char r, g, b; unsigned char r, g, b;
if (sscanf(cl_cross_color->string, "%hhu %hhu %hhu", &r, &g, &b) != 3) { if (sscanf(cl_cross_color->string, "%hhu %hhu %hhu", &r, &g, &b) != 3) {
r = 0; r = 255;
g = 255; g = 255;
b = 0; b = 255;
}
unsigned char outalpha;
if (sscanf(cl_cross_outline_alpha->string, "%hhu", &outalpha) != 1)
outalpha = alpha;
float scalar = 1.0f;
if (cl_cross_scaling->value != 0)
{
// Scale from 1080 Y res, as it's what the default crosshairs are designed for, but don't scale when resolution is close to 1080, as it looks bad.
const float screenscale = ScreenHeight() / 1080; //ScreenHeight() * 0.000926f
// Lowering scale looks like junk, don't bother.
//if (screenscale < 0.75f)
//{
// scalar = 1.0f / round(1080.0f / ScreenHeight());
// //scalar = 0.5f;
//}
if (screenscale > 1.0f)
{
scalar = screenscale;
}
// Additional scaling with the cvar value if desired.
scalar *= cl_cross_scaling->value;
} }
@ -73,38 +99,35 @@ int CHudCrosshairs::Draw(float time)
HudGL gl; HudGL gl;
// Draw the outline. // Draw the outline.
// TODO: this contains a terrible amount of repeating complex code. // TODO: Swap out lines for rectangles to fix the line thickness limit of 10.
// // The lines can also be changed to one rectangle with the one downside being in cases where the cross alpha is <255, the center of each line will be slightly darker.
// Possible solution: can be changed to this with the one downside being in rare cases where cl_cross_thickness is high AND its alpha is <255, the center of each line will be slightly darker. // Example below is for bottom line. It would also cause certain crosshairs that have outlines on invisible cross lines to not look right.
// Example below is for bottom line. Would also cause certain crosshairs that have outlines on invisible cross lines to not look right. // gl.rectangle(Vector2D(center.x + offset, center.y + gap /*- outline_width*/), Vector2D(center.x - offset, center.y + gap + size + outline_width));
// gl.rectangle(Vector2D(center.x + offset, center.y + gap - half_width), Vector2D(center.x - offset, center.y + gap + size + half_width)); if (cl_cross_outline->value > 0.0f && cl_cross_thickness->value > 0.0f && cl_cross_size->value > 0.0f) {
if (cl_cross_outline->value > 0.0f) {
unsigned char outalpha;
if (sscanf(cl_cross_outline_alpha->string, "%hhu", &outalpha) != 1) float size = cl_cross_size->value * scalar;
outalpha = alpha; float gap = cl_cross_gap->value * scalar;
float half_thickness = min(cl_cross_thickness->value * scalar, ScreenHeight() * 0.3f) * 0.5f;
float outline_width = cl_cross_outline->value * scalar;
float offset = half_thickness + outline_width;
gl.color(0, 0, 0, outalpha); gl.color(0, 0, 0, outalpha);
gl.line_width(cl_cross_outline->value); gl.line_width(outline_width * 2.0f);
float size = cl_cross_size->value;
float gap = cl_cross_gap->value;
float half_thickness = cl_cross_thickness->value / 2.0f;
float half_width = cl_cross_outline->value / 2.0f;
float offset = half_thickness + half_width;
// Top line // Top line
if (cl_cross_line_top->value) { if (cl_cross_line_top->value) {
gl.line(Vector2D(center.x - offset, center.y - gap - size), Vector2D(center.x + offset, center.y - gap - size)); gl.line(Vector2D(center.x - offset, center.y - gap - size), Vector2D(center.x + offset, center.y - gap - size));
if (cl_cross_outline_inner->value == 0.0f) if (cl_cross_outline_inner->value == 0.0f)
{ {
gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + half_width), Vector2D(center.x + half_thickness, center.y - gap)); gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + outline_width), Vector2D(center.x + half_thickness, center.y - gap));
gl.line(Vector2D(center.x - half_thickness, center.y - gap), Vector2D(center.x - half_thickness, center.y - gap - size + half_width)); gl.line(Vector2D(center.x - half_thickness, center.y - gap), Vector2D(center.x - half_thickness, center.y - gap - size + outline_width));
} }
else else
{ {
gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + half_width), Vector2D(center.x + half_thickness, center.y - gap - half_width)); gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + outline_width), Vector2D(center.x + half_thickness, center.y - gap - outline_width));
gl.line(Vector2D(center.x + offset, center.y - gap), Vector2D(center.x - offset, center.y - gap)); gl.line(Vector2D(center.x + offset, center.y - gap), Vector2D(center.x - offset, center.y - gap));
gl.line(Vector2D(center.x - half_thickness, center.y - gap - half_width), Vector2D(center.x - half_thickness, center.y - gap - size + half_width)); gl.line(Vector2D(center.x - half_thickness, center.y - gap - outline_width), Vector2D(center.x - half_thickness, center.y - gap - size + outline_width));
} }
} }
@ -113,14 +136,14 @@ int CHudCrosshairs::Draw(float time)
gl.line(Vector2D(center.x - offset, center.y + gap + size), Vector2D(center.x + offset, center.y + gap + size)); gl.line(Vector2D(center.x - offset, center.y + gap + size), Vector2D(center.x + offset, center.y + gap + size));
if (cl_cross_outline_inner->value == 0.0f) if (cl_cross_outline_inner->value == 0.0f)
{ {
gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - half_width), Vector2D(center.x + half_thickness, center.y + gap)); gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - outline_width), Vector2D(center.x + half_thickness, center.y + gap));
gl.line(Vector2D(center.x - half_thickness, center.y + gap), Vector2D(center.x - half_thickness, center.y + gap + size - half_width)); gl.line(Vector2D(center.x - half_thickness, center.y + gap), Vector2D(center.x - half_thickness, center.y + gap + size - outline_width));
} }
else else
{ {
gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - half_width), Vector2D(center.x + half_thickness, center.y + gap + half_width)); gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - outline_width), Vector2D(center.x + half_thickness, center.y + gap + outline_width));
gl.line(Vector2D(center.x + offset, center.y + gap), Vector2D(center.x - offset, center.y + gap)); gl.line(Vector2D(center.x + offset, center.y + gap), Vector2D(center.x - offset, center.y + gap));
gl.line(Vector2D(center.x - half_thickness, center.y + gap + half_width), Vector2D(center.x - half_thickness, center.y + gap + size - half_width)); gl.line(Vector2D(center.x - half_thickness, center.y + gap + outline_width), Vector2D(center.x - half_thickness, center.y + gap + size - outline_width));
} }
} }
@ -129,14 +152,14 @@ int CHudCrosshairs::Draw(float time)
gl.line(Vector2D(center.x - gap - size, center.y - offset), Vector2D(center.x - gap - size, center.y + offset)); gl.line(Vector2D(center.x - gap - size, center.y - offset), Vector2D(center.x - gap - size, center.y + offset));
if (cl_cross_outline_inner->value == 0.0f) if (cl_cross_outline_inner->value == 0.0f)
{ {
gl.line(Vector2D(center.x - gap - size + half_width, center.y + half_thickness), Vector2D(center.x - gap, center.y + half_thickness)); gl.line(Vector2D(center.x - gap - size + outline_width, center.y + half_thickness), Vector2D(center.x - gap, center.y + half_thickness));
gl.line(Vector2D(center.x - gap, center.y - half_thickness), Vector2D(center.x - gap - size + half_width, center.y - half_thickness)); gl.line(Vector2D(center.x - gap, center.y - half_thickness), Vector2D(center.x - gap - size + outline_width, center.y - half_thickness));
} }
else else
{ {
gl.line(Vector2D(center.x - gap - size + half_width, center.y + half_thickness), Vector2D(center.x - gap - half_width, center.y + half_thickness)); gl.line(Vector2D(center.x - gap - size + outline_width, center.y + half_thickness), Vector2D(center.x - gap - outline_width, center.y + half_thickness));
gl.line(Vector2D(center.x - gap, center.y + offset), Vector2D(center.x - gap, center.y - offset)); gl.line(Vector2D(center.x - gap, center.y + offset), Vector2D(center.x - gap, center.y - offset));
gl.line(Vector2D(center.x - gap - half_width, center.y - half_thickness), Vector2D(center.x - gap - size + half_width, center.y - half_thickness)); gl.line(Vector2D(center.x - gap - outline_width, center.y - half_thickness), Vector2D(center.x - gap - size + outline_width, center.y - half_thickness));
} }
} }
@ -145,93 +168,141 @@ int CHudCrosshairs::Draw(float time)
gl.line(Vector2D(center.x + gap + size, center.y - offset), Vector2D(center.x + gap + size, center.y + offset)); gl.line(Vector2D(center.x + gap + size, center.y - offset), Vector2D(center.x + gap + size, center.y + offset));
if (cl_cross_outline_inner->value == 0.0f) if (cl_cross_outline_inner->value == 0.0f)
{ {
gl.line(Vector2D(center.x + gap + size - half_width, center.y + half_thickness), Vector2D(center.x + gap, center.y + half_thickness)); gl.line(Vector2D(center.x + gap + size - outline_width, center.y + half_thickness), Vector2D(center.x + gap, center.y + half_thickness));
gl.line(Vector2D(center.x + gap, center.y - half_thickness), Vector2D(center.x + gap + size - half_width, center.y - half_thickness)); gl.line(Vector2D(center.x + gap, center.y - half_thickness), Vector2D(center.x + gap + size - outline_width, center.y - half_thickness));
} }
else else
{ {
gl.line(Vector2D(center.x + gap + size - half_width, center.y + half_thickness), Vector2D(center.x + gap + half_width, center.y + half_thickness)); gl.line(Vector2D(center.x + gap + size - outline_width, center.y + half_thickness), Vector2D(center.x + gap + outline_width, center.y + half_thickness));
gl.line(Vector2D(center.x + gap, center.y + offset), Vector2D(center.x + gap, center.y - offset)); gl.line(Vector2D(center.x + gap, center.y + offset), Vector2D(center.x + gap, center.y - offset));
gl.line(Vector2D(center.x + gap + half_width, center.y - half_thickness), Vector2D(center.x + gap + size - half_width, center.y - half_thickness)); gl.line(Vector2D(center.x + gap + outline_width, center.y - half_thickness), Vector2D(center.x + gap + size - outline_width, center.y - half_thickness));
} }
} }
} }
unsigned char dotout; float dotout;
if (sscanf(cl_cross_dot_outline->string, "%hhu", &dotout) != 1)
dotout = cl_cross_outline->value; if (cl_cross_dot_outline->string[0] == 0)
{
dotout = cl_cross_outline->value * scalar;
}
else
{
dotout = cl_cross_dot_outline->value * scalar;
}
// Dot outline // Dot outline
if (cl_cross_dot_size->value > 0.0f && dotout > 0.0f) { if (cl_cross_dot_size->value > 0.0f && dotout > 0.0f) {
unsigned char dotoutalpha; unsigned char dotoutalpha;
if (sscanf(cl_cross_circle_outline_alpha->string, "%hhu", &dotoutalpha) != 1) if (sscanf(cl_cross_dot_outline_alpha->string, "%hhu", &dotoutalpha) != 1)
dotoutalpha = alpha; dotoutalpha = outalpha;
gl.color(0, 0, 0, dotoutalpha); gl.color(0, 0, 0, dotoutalpha);
float size = cl_cross_dot_size->value; float size = min(cl_cross_dot_size->value * scalar, ScreenHeight() * 0.2f);
Vector2D offset = Vector2D(size / 2.0f, size / 2.0f);
float dot_half_width = dotout / 2.0f; if (cl_cross_dot_round->value)
{
size *= 0.5f;
if (old_round_dot_outline_radius != size || old_round_dot_outline_thickness != dotout) {
// Recompute the circle points.
round_dot_outline_points = HudGL::compute_circle(size + (dotout * 0.5f), dotout);
old_round_dot_outline_radius = size;
old_round_dot_outline_thickness = dotout;
}
gl.line(Vector2D(center.x - offset.x - dot_half_width, center.y - offset.y), Vector2D(center.x + offset.x + dot_half_width, center.y - offset.y)); gl.circle(center, round_dot_outline_points);
gl.line(Vector2D(center.x + offset.x, center.y - offset.y + dot_half_width), Vector2D(center.x + offset.x, center.y + offset.y - dot_half_width)); }
gl.line(Vector2D(center.x - offset.x, center.y - offset.y + dot_half_width), Vector2D(center.x - offset.x, center.y + offset.y - dot_half_width)); else
gl.line(Vector2D(center.x - offset.x - dot_half_width, center.y + offset.y), Vector2D(center.x + offset.x + dot_half_width, center.y + offset.y)); {
//TOFIX - Not a true outline, will be seen behind transparent dots
size += dotout * 2.0f;
Vector2D offset = Vector2D(size / 2.0f, size / 2.0f);
gl.rectangle(center - offset, center + offset);
}
} }
unsigned char circleout; float circleout;
if (sscanf(cl_cross_circle_outline->string, "%hhu", &circleout) != 1) if (cl_cross_circle_outline->string[0] == 0)
circleout = cl_cross_outline->value; {
circleout = cl_cross_outline->value * scalar;
}
else
{
circleout = cl_cross_circle_outline->value * scalar;
}
// Circle outline // Circle outline
if (cl_cross_circle_radius->value > 0.0f && cl_cross_circle_thickness->value > 0.0f && circleout > 0.0f) { if (cl_cross_circle_radius->value > 0.0f && cl_cross_circle_thickness->value > 0.0f && circleout > 0.0f) {
unsigned char circleoutalpha; unsigned char circleoutalpha;
if (sscanf(cl_cross_circle_outline_alpha->string, "%hhu", &circleoutalpha) != 1) if (sscanf(cl_cross_circle_outline_alpha->string, "%hhu", &circleoutalpha) != 1)
circleoutalpha = alpha; circleoutalpha = outalpha;
unsigned char circleoutinner;
if (sscanf(cl_cross_circle_outline_inner->string, "%hhu", &circleoutinner) != 1) bool circleoutinner = cl_cross_outline_inner->value;
circleoutinner = cl_cross_outline_inner->value;
gl.color(0, 0, 0, circleoutalpha); gl.color(0, 0, 0, circleoutalpha);
auto radius = cl_cross_circle_radius->value; auto radius = cl_cross_circle_radius->value * scalar;
if (circleoutinner == 0.0f) float thickness;
if (!circleoutinner)
{ {
radius += (cl_cross_circle_thickness->value * 0.5f) + (circleout * 0.5f); radius += cl_cross_circle_thickness->value * scalar * 0.5f;
gl.line_width(circleout); thickness = circleout;
} }
else else
{ {
gl.line_width(cl_cross_circle_thickness->value + circleout); //TOFIX - Not a true outline, will be seen behind transparent circles
thickness = cl_cross_circle_thickness->value * scalar + (circleout * 2.0f);
} }
if (old_circle_radius != radius) { if (old_circle_outline_radius != radius || old_circle_outline_thickness != thickness) {
// Recompute the circle points. // Recompute the circle points.
circle_points = HudGL::compute_circle(radius); circle_outline_points = HudGL::compute_circle(radius, thickness);
old_circle_radius = radius; old_circle_outline_radius = radius;
old_circle_outline_thickness = thickness;
} }
gl.circle(center, circle_points); gl.circle(center, circle_outline_points);
} }
gl.color(r, g, b, alpha); gl.color(r, g, b, alpha);
// Draw the crosshairs. // Draw the crosshairs.
if (cl_cross_thickness->value > 0.0f) { if (cl_cross_thickness->value > 0.0f && cl_cross_size->value > 0.0f) {
//gl.line_width(cl_cross_thickness->value);
//clamp dot size to prevent using it as a full screen transparent mask for highlighting eneimies like with the /nvg night vision server plugin. float size;
gl.line_width(min(cl_cross_thickness->value, ScreenHeight() * 0.3f)); float gap = cl_cross_gap->value * scalar;
float size = cl_cross_size->value; // Box crosshair. This is needed since line thickness seems to cap out at 10 on my system.
float gap = cl_cross_gap->value; if (cl_cross_thickness->value > cl_cross_size->value) {
gl.line_width(cl_cross_size->value * scalar);
float half_size = cl_cross_size->value * scalar * 0.5f;
float half_thickness = cl_cross_thickness->value * scalar * 0.5f;
if (cl_cross_line_top->value)
gl.line(Vector2D(center.x - half_thickness, center.y - gap - half_size), Vector2D(center.x + half_thickness, center.y - gap - half_size));
if (cl_cross_line_bottom->value)
gl.line(Vector2D(center.x - half_thickness, center.y + gap + half_size), Vector2D(center.x + half_thickness, center.y + gap + half_size));
if (cl_cross_line_left->value)
gl.line(Vector2D(center.x - gap - half_size, center.y + half_thickness), Vector2D(center.x - gap - half_size, center.y - half_thickness));
if (cl_cross_line_right->value)
gl.line(Vector2D(center.x + gap + half_size, center.y + half_thickness), Vector2D(center.x + gap + half_size, center.y - half_thickness));
}
// Normal cross.
else {
gl.line_width(cl_cross_thickness->value * scalar);
size = cl_cross_size->value * scalar;
if (cl_cross_line_top->value)
gl.line(Vector2D(center.x, center.y - gap - size), Vector2D(center.x, center.y - gap));
if (cl_cross_line_bottom->value)
gl.line(Vector2D(center.x, center.y + gap + size), Vector2D(center.x, center.y + gap));
if (cl_cross_line_left->value)
gl.line(Vector2D(center.x - gap - size, center.y), Vector2D(center.x - gap, center.y));
if (cl_cross_line_right->value)
gl.line(Vector2D(center.x + gap + size, center.y), Vector2D(center.x + gap, center.y));
}
if (cl_cross_line_top->value)
gl.line(Vector2D(center.x, center.y - gap - size), Vector2D(center.x, center.y - gap));
if (cl_cross_line_bottom->value)
gl.line(Vector2D(center.x, center.y + gap + size), Vector2D(center.x, center.y + gap));
if (cl_cross_line_left->value)
gl.line(Vector2D(center.x - gap - size, center.y), Vector2D(center.x - gap, center.y));
if (cl_cross_line_right->value)
gl.line(Vector2D(center.x + gap + size, center.y), Vector2D(center.x + gap, center.y));
} }
// Draw the circle. // Draw the circle.
@ -249,14 +320,14 @@ int CHudCrosshairs::Draw(float time)
{ {
gl.color(r, g, b, circlealpha); gl.color(r, g, b, circlealpha);
} }
gl.line_width(cl_cross_circle_thickness->value);
float radius = cl_cross_circle_radius->value; float radius = cl_cross_circle_radius->value * scalar;
if (old_circle_radius != radius) { float thickness = cl_cross_circle_thickness->value * scalar;
if (old_circle_radius != radius || old_circle_thickness != thickness) {
// Recompute the circle points. // Recompute the circle points.
circle_points = HudGL::compute_circle(radius); circle_points = HudGL::compute_circle(radius, thickness);
old_circle_radius = radius; old_circle_radius = radius;
old_circle_thickness = thickness;
} }
gl.circle(center, circle_points); gl.circle(center, circle_points);
@ -278,12 +349,26 @@ int CHudCrosshairs::Draw(float time)
gl.color(r, g, b, dotalpha); gl.color(r, g, b, dotalpha);
} }
//float size = cl_cross_dot_size->value; //float size = cl_cross_dot_size->value * scalar;
//clamp dot size to prevent using it as a full screen transparent mask for highlighting eneimies like with the /nvg night vision server plugin. //clamp dot size to prevent using it as a full screen transparent mask for highlighting eneimies like with the /nvg night vision server plugin.
float size = min(cl_cross_dot_size->value, ScreenHeight() * 0.2f); float size = min(cl_cross_dot_size->value * scalar, ScreenHeight() * 0.2f);
Vector2D offset = Vector2D(size / 2.0f, size / 2.0f); Vector2D offset = Vector2D(size / 2.0f, size / 2.0f);
gl.rectangle(center - offset, center + offset); if (cl_cross_dot_round->value)
{
size *= 0.5f;
if (old_round_dot_radius != size) {
// Recompute the circle points.
round_dot_points = HudGL::compute_circle(size);
old_round_dot_radius = size;
}
gl.round_dot(center, round_dot_points);
}
else
{
gl.rectangle(center - offset, center + offset);
}
} }
return 0; return 0;

View file

@ -27,13 +27,24 @@ class CHudCrosshairs : public CHudBase
cvar_t* cl_cross_dot_alpha; cvar_t* cl_cross_dot_alpha;
cvar_t* cl_cross_dot_outline; cvar_t* cl_cross_dot_outline;
cvar_t* cl_cross_dot_outline_alpha; cvar_t* cl_cross_dot_outline_alpha;
cvar_t* cl_cross_dot_round;
cvar_t* cl_cross_line_top; cvar_t* cl_cross_line_top;
cvar_t* cl_cross_line_bottom; cvar_t* cl_cross_line_bottom;
cvar_t* cl_cross_line_left; cvar_t* cl_cross_line_left;
cvar_t* cl_cross_line_right; cvar_t* cl_cross_line_right;
cvar_t* cl_cross_scaling;
float old_circle_radius; float old_circle_radius;
float old_circle_thickness;
std::vector<Vector2D> circle_points; std::vector<Vector2D> circle_points;
float old_circle_outline_radius;
float old_circle_outline_thickness;
std::vector<Vector2D> circle_outline_points;
float old_round_dot_radius;
std::vector<Vector2D> round_dot_points;
float old_round_dot_outline_radius;
float old_round_dot_outline_thickness;
std::vector<Vector2D> round_dot_outline_points;
public: public:
virtual int Init(); virtual int Init();

View file

@ -21,9 +21,13 @@
#include "mod/AvHFont.h" #include "mod/AvHFont.h"
#include "vgui_TeamFortressViewport.h" #include "vgui_TeamFortressViewport.h"
#include "common/com_model.h"
//#include "r_studioint.h"
#define MAX_LOGO_FRAMES 56 #define MAX_LOGO_FRAMES 56
//extern engine_studio_api_t IEngineStudio;
int grgLogoFrame[MAX_LOGO_FRAMES] = int grgLogoFrame[MAX_LOGO_FRAMES] =
{ {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 12, 11, 10, 9, 8, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 12, 11, 10, 9, 8, 14, 15,
@ -106,6 +110,22 @@ int CHud :: Redraw( float flTime, int intermission )
if ( m_flTimeDelta < 0 ) if ( m_flTimeDelta < 0 )
m_flTimeDelta = 0; m_flTimeDelta = 0;
bool bWantWidescreen = m_pCvarWidescreen->value != 0.0F;
if (bWantWidescreen != m_bIsWidescreen)
{
if (bWantWidescreen)
{
m_iConWidth = m_iConHeight * (ScreenWidth() / (float)ScreenHeight());
}
else
{
m_iConWidth = m_iRes;
}
m_flOffsetX = (ScreenWidth() - m_iConWidth * m_flScaleX) / 2.0F;
m_bIsWidescreen = bWantWidescreen;
}
// Bring up the scoreboard during intermission // Bring up the scoreboard during intermission
if (gViewPort) if (gViewPort)
{ {
@ -318,22 +338,261 @@ int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString,
} }
int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b) //// Old metod before scaling.
//int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b)
//{
// int iWidth = GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left;
// int k;
//
// if (iNumber > 0)
// {
// // SPR_Draw 100's
// if (iNumber >= 100)
// {
// k = iNumber/100;
// SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
// SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
// x += iWidth;
// }
// else if (iFlags & (DHN_3DIGITS))
// {
// //SPR_DrawAdditive( 0, x, y, &rc );
// x += iWidth;
// }
//
// // SPR_Draw 10's
// if (iNumber >= 10)
// {
// k = (iNumber % 100)/10;
// SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
// SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
// x += iWidth;
// }
// else if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
// {
// //SPR_DrawAdditive( 0, x, y, &rc );
// x += iWidth;
// }
//
// // SPR_Draw ones
// k = iNumber % 10;
// SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
// SPR_DrawAdditive(0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
// x += iWidth;
// }
// else if (iFlags & DHN_DRAWZERO)
// {
// SPR_Set(GetSprite(m_HUD_number_0), r, g, b );
//
// // SPR_Draw 100's
// if (iFlags & (DHN_3DIGITS))
// {
// //SPR_DrawAdditive( 0, x, y, &rc );
// x += iWidth;
// }
//
// if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
// {
// //SPR_DrawAdditive( 0, x, y, &rc );
// x += iWidth;
// }
//
// // SPR_Draw ones
//
// SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0));
// x += iWidth;
// }
//
// return x;
//}
// Toodles' sprite scaling with additional scaling option added.
void CHud::DrawHudSprite(AVHHSPRITE pic, int frame, wrect_t * rect, int x, int y, int r, int g, int b, int a, float scale, hudalign_e alignment)
{ {
int iWidth = GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left; auto sprw = gEngfuncs.pfnSPR_Width(pic, frame);
auto sprh = gEngfuncs.pfnSPR_Height(pic, frame);
if (!rect)
{
static wrect_t rc;
rc.left = 0;
rc.right = sprw;
rc.top = 0;
rc.bottom = sprh;
rect = &rc;
}
float xf = x;
float yf = y;
auto width = (rect->right - rect->left) * scale;
auto height = (rect->bottom - rect->top) * scale;
switch (alignment)
{
case a_north:
case a_center:
case a_south:
xf -= width / 2.0F - 0.5F;
break;
case a_northeast:
case a_east:
case a_southeast:
xf -= width;
break;
}
switch (alignment)
{
case a_west:
case a_center:
case a_east:
yf -= height / 2.0F - 0.5F;
break;
case a_southwest:
case a_south:
case a_southeast:
yf -= height;
break;
}
//// No software mode in NS.
//if (!IEngineStudio.IsHardware())
//{
// x += m_flOffsetX;
// y += m_flOffsetY;
// ScaleColors(r, g, b, a);
// gEngfuncs.pfnSPR_Set(pic, r, g, b);
// // Toodles FIXME: Hack for the crosshair.
// if (alignment == a_center)
// {
// gEngfuncs.pfnSPR_DrawHoles(frame, x, y, rect);
// }
// else
// {
// gEngfuncs.pfnSPR_DrawAdditive(frame, x, y, rect);
// }
// return;
//}
auto pSprite = const_cast<model_t*>(gEngfuncs.GetSpritePointer(pic));
auto x1 = roundf(m_flOffsetX + xf * m_flScaleX);
auto y1 = roundf(m_flOffsetY + yf * m_flScaleY);
auto x2 = roundf(m_flOffsetX + (xf + width) * m_flScaleX);
auto y2 = roundf(m_flOffsetY + (yf + height) * m_flScaleY);
auto left = rect->left / (float)sprw;
auto right = rect->right / (float)sprw;
auto top = rect->top / (float)sprh;
auto bottom = rect->bottom / (float)sprh;
gEngfuncs.pTriAPI->SpriteTexture(pSprite, frame);
auto rendermode = kRenderTransAdd;
// Toodles FIXME: Hack for the crosshair.
if (alignment == a_center)
{
rendermode = kRenderTransAlpha;
}
gEngfuncs.pTriAPI->Color4fRendermode(r / 255.0F, g / 255.0F, b / 255.0F, a / 255.0F, rendermode);
gEngfuncs.pTriAPI->RenderMode(rendermode);
gEngfuncs.pTriAPI->Begin(TRI_QUADS);
gEngfuncs.pTriAPI->TexCoord2f(left, top);
gEngfuncs.pTriAPI->Vertex3f(x1, y1, 0);
gEngfuncs.pTriAPI->TexCoord2f(right, top);
gEngfuncs.pTriAPI->Vertex3f(x2, y1, 0);
gEngfuncs.pTriAPI->TexCoord2f(right, bottom);
gEngfuncs.pTriAPI->Vertex3f(x2, y2, 0);
gEngfuncs.pTriAPI->TexCoord2f(left, bottom);
gEngfuncs.pTriAPI->Vertex3f(x1, y2, 0);
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode(kRenderNormal);
}
//void CHud::DrawHudSprite(AVHHSPRITE pic, int frame, wrect_t* rect, int x, int y, hudcolor_e color, int a, hudalign_e alignment)
//{
// int r, g, b;
// GetColor(r, g, b, color);
// DrawHudSprite(pic, frame, rect, x, y, r, g, b, a, alignment);
//}
void CHud::DrawHudSpriteIndex(int index, int x, int y, int r, int g, int b, int a, float scale, hudalign_e alignment)
{
DrawHudSprite(GetSprite(index), 0, &GetSpriteRect(index), x, y, r, g, b, a, scale, alignment);
}
//void CHud::DrawHudSpriteIndex(int index, int x, int y, hudcolor_e color, int a, hudalign_e alignment)
//{
// int r, g, b;
// GetColor(r, g, b, color);
// DrawHudSprite(GetSprite(index), 0, &GetSpriteRect(index), x, y, r, g, b, a, alignment);
//}
void CHud::DrawHudFill(int x, int y, int w, int h, int r, int g, int b, int a, float scale)
{
x = roundf(m_flOffsetX + x * m_flScaleX);
y = roundf(m_flOffsetY + y * m_flScaleY);
w = roundf(w * m_flScaleX * scale);
h = roundf(h * m_flScaleY * scale);
gEngfuncs.pfnFillRGBA(x, y, w, h, r, g, b, a);
}
//void CHud::DrawHudFill(int x, int y, int w, int h, hudcolor_e color, int a)
//{
// int r, g, b;
// GetColor(r, g, b, color);
// DrawHudFill(x, y, w, h, r, g, b, a);
//}
//int CHud::DrawHudString(int xpos, int ypos, int iMaxX, const char* szIt, int r, int g, int b)
//{
// auto x1 = roundf(m_flOffsetX + xpos * m_flScaleX);
// auto y1 = roundf(m_flOffsetY + ypos * m_flScaleY);
// return (gEngfuncs.pfnDrawString(x1, y1, szIt, r, g, b) - m_flOffsetX) / m_flScaleX;
//}
//// draws a string from right to left (right-aligned)
//int CHud::DrawHudStringReverse(int xpos, int ypos, int iMinX, const char* szString, int r, int g, int b)
//{
// auto x1 = roundf(m_flOffsetX + xpos * m_flScaleX);
// auto y1 = roundf(m_flOffsetY + ypos * m_flScaleY);
// return (gEngfuncs.pfnDrawStringReverse(x1, y1, szString, r, g, b) - m_flOffsetX) / m_flScaleX;
//}
int CHud::DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b, int a, float scale, hudalign_e alignment)
{
int iWidth = (GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left) * scale;
int k; int k;
if (iNumber > 0) if (iNumber > 0)
{ {
// Draw 1000's
if (iNumber >= 1000)
{
k = iNumber / 1000;
DrawHudSpriteIndex(m_HUD_number_0 + k, x, y, r, g, b, a, scale, alignment);
x += iWidth;
}
// SPR_Draw 100's // SPR_Draw 100's
if (iNumber >= 100) if (iNumber >= 100)
{ {
k = iNumber/100; k = (iNumber % 1000) / 100;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b ); DrawHudSpriteIndex(m_HUD_number_0 + k, x, y, r, g, b, a, scale, alignment);
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
x += iWidth; x += iWidth;
} }
else if (iFlags & (DHN_3DIGITS)) else if ((iFlags & DHN_3DIGITS) != 0)
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
@ -342,12 +601,11 @@ int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g,
// SPR_Draw 10's // SPR_Draw 10's
if (iNumber >= 10) if (iNumber >= 10)
{ {
k = (iNumber % 100)/10; k = (iNumber % 100) / 10;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b ); DrawHudSpriteIndex(m_HUD_number_0 + k, x, y, r, g, b, a, scale, alignment);
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
x += iWidth; x += iWidth;
} }
else if (iFlags & (DHN_3DIGITS | DHN_2DIGITS)) else if ((iFlags & (DHN_3DIGITS | DHN_2DIGITS)) != 0)
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
@ -355,36 +613,39 @@ int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g,
// SPR_Draw ones // SPR_Draw ones
k = iNumber % 10; k = iNumber % 10;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b ); DrawHudSpriteIndex(m_HUD_number_0 + k, x, y, r, g, b, a, scale, alignment);
SPR_DrawAdditive(0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
x += iWidth; x += iWidth;
} }
else if (iFlags & DHN_DRAWZERO) else if ((iFlags & DHN_DRAWZERO) != 0)
{ {
SPR_Set(GetSprite(m_HUD_number_0), r, g, b );
// SPR_Draw 100's // SPR_Draw 100's
if (iFlags & (DHN_3DIGITS)) if ((iFlags & DHN_3DIGITS) != 0)
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
} }
if (iFlags & (DHN_3DIGITS | DHN_2DIGITS)) if ((iFlags & (DHN_3DIGITS | DHN_2DIGITS)) != 0)
{ {
//SPR_DrawAdditive( 0, x, y, &rc ); //SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth; x += iWidth;
} }
// SPR_Draw ones // SPR_Draw ones
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0)); DrawHudSpriteIndex(m_HUD_number_0, x, y, r, g, b, a, scale, alignment);
x += iWidth; x += iWidth;
} }
return x; return x;
} }
//int CHud::DrawHudNumber(int x, int y, int iFlags, int iNumber, hudcolor_e color, int a, hudalign_e alignment)
//{
// int r, g, b;
// GetColor(r, g, b, color);
// return DrawHudNumber(x, y, iFlags, iNumber, r, g, b, a, alignment);
//}
int CHud::GetNumWidth( int iNumber, int iFlags ) int CHud::GetNumWidth( int iNumber, int iFlags )
{ {
@ -412,4 +673,81 @@ int CHud::GetNumWidth( int iNumber, int iFlags )
} }
int CHud::GetHudNumberWidth(int number, int width, int flags, float scale)
{
const int digitWidth = (GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left) * scale;
int totalDigits = 0;
if (number > 0)
{
totalDigits = static_cast<int>(log10(number)) + 1;
}
else if ((flags & DHN_DRAWZERO) != 0)
{
totalDigits = 1;
}
totalDigits = max(totalDigits, width);
return totalDigits * digitWidth;
}
int CHud::DrawHudNumberReverse(int x, int y, int number, int flags, int r, int g, int b, int a, float scale, hudalign_e alignment)
{
if (number > 0 || (flags & DHN_DRAWZERO) != 0)
{
const int digitWidth = (GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left) * scale;
int remainder = number;
do
{
const int digit = remainder % 10;
const int digitSpriteIndex = m_HUD_number_0 + digit;
//This has to happen *before* drawing because we're drawing in reverse
x -= digitWidth;
DrawHudSpriteIndex(digitSpriteIndex, x, y, r, g, b, a, scale, alignment);
remainder /= 10;
} while (remainder > 0);
}
return x;
}
//int CHud::DrawHudNumberReverse(int x, int y, int number, int flags, hudcolor_e color, int a, hudalign_e alignment)
//{
// int r, g, b;
// GetColor(r, g, b, color);
// return DrawHudNumberReverse(x, y, number, flags, r, g, b, a, alignment);
//}
//int CHud::DrawHudString(const char* string, int x, int y)
//{
// auto x1 = roundf (m_flOffsetX + x * m_flScaleX);
// auto y1 = roundf (m_flOffsetY + y * m_flScaleY);
// return (gEngfuncs.pfnDrawConsoleString(x1, y1, (char*)string) - m_flOffsetX) / m_flScaleX;
//}
//
//void CHud::GetHudStringSize(const char* string, int& width, int& height)
//{
// gEngfuncs.pfnDrawConsoleStringLen(string, &width, &height);
// width /= m_flScaleX;
// height /= m_flScaleY;
//}
//
//int CHud::HudStringLen(const char* string)
//{
// int width, height;
// GetHudStringSize(string, width, height);
// return width;
//}
//
//void CHud::GetChatInputPosition(int& x, int& y)
//{
// x = roundf (m_flOffsetX + m_SayText.m_iBaseX * m_flScaleX);
// y = roundf (m_flOffsetY + (m_SayText.m_iBaseY + m_SayText.m_iLineHeight) * m_flScaleY);
//}

View file

@ -12,6 +12,8 @@
#include "vgui_TeamFortressViewport.h" #include "vgui_TeamFortressViewport.h"
#include "vgui_SpectatorPanel.h" #include "vgui_SpectatorPanel.h"
#include "common/hltv.h" #include "common/hltv.h"
#include "AvHServerVariables.h"
#include "ammohistory.h"
#include "pm_shared/pm_shared.h" #include "pm_shared/pm_shared.h"
#include "pm_shared/pm_defs.h" #include "pm_shared/pm_defs.h"
@ -492,7 +494,7 @@ int CHudSpectator::Draw(float flTime)
bool CHudSpectator::IsInOverviewMode() const bool CHudSpectator::IsInOverviewMode() const
{ {
return g_iUser1 && m_overviewMode && gHUD.GetIsNSMode(); return g_iUser1 && m_overviewMode && gHUD.GetIsNSMode() /*&& g_iUser1 != OBS_ROAMING*/;
} }
void CHudSpectator::SetOverviewMode(bool overviewMode) void CHudSpectator::SetOverviewMode(bool overviewMode)
@ -561,7 +563,7 @@ void CHudSpectator::DrawOverviewMap()
gEngfuncs.pTriAPI->CullFace(TRI_NONE); gEngfuncs.pTriAPI->CullFace(TRI_NONE);
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0); gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0);
float gammaScale = 1.0f / gHUD.GetGammaSlope(); float gammaScale = 1.0f/* / gHUD.GetGammaSlope()*/;
// Draw the background. // Draw the background.
@ -853,58 +855,41 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
int theNewMainMode = g_iUser1; int theNewMainMode = g_iUser1;
// Jump changes main window modes // Crouch toggles the overview mode
if (gHUD.GetIsNSMode() && ButtonPressed & IN_DUCK)
{
bool theInOverviewMode = gHUD.m_Spectator.IsInOverviewMode();
gHUD.m_Spectator.SetOverviewMode(!theInOverviewMode);
}
// Jump changes spectator modes
if ( ButtonPressed & IN_JUMP ) if ( ButtonPressed & IN_JUMP )
{ {
bool theFirstPerson = (g_iUser1 == OBS_IN_EYE); theNewMainMode++;
bool theInOverviewMode = gHUD.m_Spectator.IsInOverviewMode();
// NS AvHPlayMode CurrPlayMode = gHUD.GetPlayMode();
if(gHUD.GetIsNSMode())
{ float FreeSpecMode = gHUD.GetServerVariableFloat(kvFreeSpectatorMode);
// First-person full -> chase camera full -> firstperson with overview -> chase camera with overview if (FreeSpecMode == 0 || (FreeSpecMode == 1 && gHUD.GetPlayMode() != PLAYMODE_OBSERVER))
if(theFirstPerson && !theInOverviewMode) {
{ while (theNewMainMode == OBS_CHASE_FREE || theNewMainMode == OBS_ROAMING)
gHUD.m_Spectator.SetMode(OBS_CHASE_LOCKED); {
//gHUD.m_Spectator.SetOverviewMode(false); theNewMainMode++;
} }
else if(!theFirstPerson && !theInOverviewMode) }
{
gHUD.m_Spectator.SetMode(OBS_IN_EYE); if (theNewMainMode > OBS_IN_EYE)
gHUD.m_Spectator.SetOverviewMode(true); {
} theNewMainMode = OBS_CHASE_LOCKED;
else if(theFirstPerson && theInOverviewMode) }
{
gHUD.m_Spectator.SetMode(OBS_CHASE_LOCKED); gHUD.m_Spectator.SetMode(theNewMainMode);
//gHUD.m_Spectator.SetOverviewMode(true);
}
else if(!theFirstPerson && theInOverviewMode)
{
gHUD.m_Spectator.SetMode(OBS_IN_EYE);
gHUD.m_Spectator.SetOverviewMode(false);
}
}
// Combat
else
{
// First-person full -> chase camera full
if(theFirstPerson)
{
gHUD.m_Spectator.SetMode(OBS_CHASE_LOCKED);
gHUD.m_Spectator.SetOverviewMode(false);
}
else
{
gHUD.m_Spectator.SetMode(OBS_IN_EYE);
gHUD.m_Spectator.SetOverviewMode(false);
}
}
} }
//g_iUser1 = theNewMainMode; //g_iUser1 = theNewMainMode;
// Attack moves to the next player // Attack moves to the next player
if ( ButtonPressed & (IN_MOVELEFT | IN_MOVERIGHT) ) if (g_iUser1 != OBS_ROAMING && ButtonPressed & (IN_MOVELEFT | IN_MOVERIGHT) )
{ {
FindNextPlayer( (ButtonPressed & IN_MOVELEFT) ? true:false ); FindNextPlayer( (ButtonPressed & IN_MOVELEFT) ? true:false );
@ -1037,25 +1022,43 @@ void CHudSpectator::HandleButtonsUp( int ButtonPressed )
void CHudSpectator::SetMode(int iNewMainMode) void CHudSpectator::SetMode(int iNewMainMode)
{ {
int NewMode = iNewMainMode;
if (NewMode == OBS_CHASE_FREE || NewMode == OBS_ROAMING)
{
float FreeSpecMode = gHUD.GetServerVariableFloat(kvFreeSpectatorMode);
if ((FreeSpecMode == 0 || (FreeSpecMode == 1.0f && gHUD.GetPlayMode() != PLAYMODE_OBSERVER)) && !gEngfuncs.IsSpectateOnly())
{
if (g_iUser1 != OBS_CHASE_FREE && g_iUser1 != OBS_ROAMING)
{
NewMode = g_iUser1;
}
else
{
NewMode = OBS_IN_EYE;
}
}
}
// if value == -1 keep old value // if value == -1 keep old value
if ( iNewMainMode == -1 ) if (NewMode == -1 )
iNewMainMode = g_iUser1; NewMode = g_iUser1;
// main modes ettings will override inset window settings // main modes ettings will override inset window settings
if ( iNewMainMode != g_iUser1 ) if (NewMode != g_iUser1 )
{ {
// if we are NOT in HLTV mode, main spectator mode is set on server // if we are NOT in HLTV mode, main spectator mode is set on server
if ( !gEngfuncs.IsSpectateOnly() ) if ( !gEngfuncs.IsSpectateOnly() )
{ {
char cmdstring[32]; char cmdstring[32];
// forward command to server // forward command to server
sprintf(cmdstring,"specmode %i",iNewMainMode ); sprintf(cmdstring,"specmode %i", NewMode);
gEngfuncs.pfnServerCmd(cmdstring); gEngfuncs.pfnServerCmd(cmdstring);
return; return;
} }
else else
{ {
if ( !g_iUser2 && (iNewMainMode !=OBS_ROAMING ) ) // make sure we have a target if ( !g_iUser2 && (NewMode != OBS_ROAMING ) ) // make sure we have a target
{ {
// choose last Director object if still available // choose last Director object if still available
if ( IsActivePlayer( gEngfuncs.GetEntityByIndex( m_lastPrimaryObject ) ) ) if ( IsActivePlayer( gEngfuncs.GetEntityByIndex( m_lastPrimaryObject ) ) )
@ -1069,7 +1072,7 @@ void CHudSpectator::SetMode(int iNewMainMode)
} }
} }
switch ( iNewMainMode ) switch (NewMode)
{ {
case OBS_CHASE_LOCKED: case OBS_CHASE_LOCKED:
g_iUser1 = OBS_CHASE_LOCKED; g_iUser1 = OBS_CHASE_LOCKED;
@ -1116,11 +1119,15 @@ void CHudSpectator::SetMode(int iNewMainMode)
m_crosshairRect.bottom = 24; m_crosshairRect.bottom = 24;
gHUD.SetCurrentCrosshair( m_hCrosshair, m_crosshairRect, 255, 255, 255 ); gHUD.SetCurrentCrosshair( m_hCrosshair, m_crosshairRect, 255, 255, 255 );
gWR.SetWeaponConfig(nullptr, 1);
} }
else else
{ {
memset( &m_crosshairRect,0,sizeof(m_crosshairRect) ); memset( &m_crosshairRect,0,sizeof(m_crosshairRect) );
gHUD.SetCurrentCrosshair( 0, m_crosshairRect, 0, 0, 0 ); gHUD.SetCurrentCrosshair( 0, m_crosshairRect, 0, 0, 0 );
gWR.SetWeaponConfig(nullptr, -1);
} }
//char string[128]; //char string[128];
@ -1884,12 +1891,16 @@ void CHudSpectator::CheckSettings()
m_crosshairRect.bottom = 24; m_crosshairRect.bottom = 24;
gHUD.SetCurrentCrosshair( m_hCrosshair, m_crosshairRect, 255, 255, 255 ); gHUD.SetCurrentCrosshair( m_hCrosshair, m_crosshairRect, 255, 255, 255 );
gWR.SetWeaponConfig(nullptr, 1);
} }
else else
{ {
memset( &m_crosshairRect,0,sizeof(m_crosshairRect) ); memset( &m_crosshairRect,0,sizeof(m_crosshairRect) );
gHUD.SetCurrentCrosshair( 0, m_crosshairRect, 0, 0, 0 ); gHUD.SetCurrentCrosshair( 0, m_crosshairRect, 0, 0, 0 );
}
gWR.SetWeaponConfig(nullptr, -1);
}
// Removed by mmcguire. // Removed by mmcguire.
/* /*

View file

@ -41,47 +41,46 @@ int CHud::UpdateClientData(client_data_t *cdata, float time)
Think(); Think();
//cdata->fov = m_iFOV; cdata->fov = m_iFOV;
float width = ScreenWidth(); //// Horizontal+ widescreen view correction - Removed after HL25 update
float height = ScreenHeight(); //float width = ScreenWidth();
//float height = ScreenHeight();
// Horizontal+ widescreen view correction - engine uses vertical- cropping //// Cvar to let players use old widescreen. Only allow it to change when not alive so it can't be used as a zoom toggle.
//if (!gHUD.GetIsAlive(false))
//{
// wstoggle = CVAR_GET_FLOAT("cl_widescreen") != 0;
//}
// Cvar to let players use old widescreen. Only allow it to change when not alive so it can't be used as a zoom toggle. //if (wstoggle)
if (!gHUD.GetIsAlive(false)) //{
{ // m_wsFOV = atanf(tan(m_iFOV * M_PI / 360) * 0.75 * width / height) * 360 / M_PI;
wstoggle = CVAR_GET_FLOAT("cl_widescreen") != 0;
}
if (wstoggle) // //clamp for game balance
{ // if (m_iFOV == 105 && m_wsFOV > 121)
m_wsFOV = atanf(tan(m_iFOV * M_PI / 360) * 0.75 * width / height) * 360 / M_PI; // {
// m_wsFOV = 120;
// }
// else if (m_iFOV == 100 && m_wsFOV > 117)
// {
// m_wsFOV = 116;
// }
// else if (m_iFOV == 90 && m_wsFOV > 107)
// {
// m_wsFOV = 106;
// }
// else if (m_wsFOV < 90)
// {
// m_wsFOV = 90;
// }
//}
//else
//{
// m_wsFOV = m_iFOV;
//}
//clamp for game balance //cdata->fov = m_wsFOV;
if (m_iFOV == 105 && m_wsFOV > 121)
{
m_wsFOV = 120;
}
else if (m_iFOV == 100 && m_wsFOV > 117)
{
m_wsFOV = 116;
}
else if (m_iFOV == 90 && m_wsFOV > 107)
{
m_wsFOV = 106;
}
else if (m_wsFOV < 90)
{
m_wsFOV = 90;
}
}
else
{
m_wsFOV = m_iFOV;
}
cdata->fov = m_wsFOV;
CL_ResetButtonBits( m_iKeyBits ); CL_ResetButtonBits( m_iKeyBits );

View file

@ -52,11 +52,21 @@ void HudGL::line(const Vector2D& start, const Vector2D& end) const {
glEnd(); glEnd();
} }
//#ifdef __APPLE__
////Remove when OSX builds with c++11
//#else
void HudGL::circle(const Vector2D& center, const std::vector<Vector2D>& points) const { void HudGL::circle(const Vector2D& center, const std::vector<Vector2D>& points) const {
glBegin(GL_LINE_STRIP); glBegin(GL_TRIANGLE_STRIP);
for (const Vector2D& point : points)
glVertex2f(center.x + point.x, center.y + point.y);
glVertex2f(center.x + points[0].x, center.y + points[0].y);
glVertex2f(center.x + points[1].x, center.y + points[1].y);
glEnd();
}
void HudGL::round_dot(const Vector2D& center, const std::vector<Vector2D>& points) const {
glBegin(GL_TRIANGLE_FAN);
glVertex2f(center.x, center.y);
for (const Vector2D& point : points) for (const Vector2D& point : points)
glVertex2f(center.x + point.x, center.y + point.y); glVertex2f(center.x + point.x, center.y + point.y);
@ -64,7 +74,6 @@ void HudGL::circle(const Vector2D& center, const std::vector<Vector2D>& points)
glVertex2f(center.x + points[0].x, center.y + points[0].y); glVertex2f(center.x + points[0].x, center.y + points[0].y);
glEnd(); glEnd();
} }
//#endif
void HudGL::rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const { void HudGL::rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const {
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -75,9 +84,6 @@ void HudGL::rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const
glEnd(); glEnd();
} }
//#ifdef __APPLE__
////Remove when OSX builds with c++11
//#else
std::vector<Vector2D> HudGL::compute_circle(float radius) { std::vector<Vector2D> HudGL::compute_circle(float radius) {
// Maximum allowed distance between the circle and the rendered line segment. // Maximum allowed distance between the circle and the rendered line segment.
const float MAX_ERROR = 0.1f; const float MAX_ERROR = 0.1f;
@ -94,4 +100,23 @@ std::vector<Vector2D> HudGL::compute_circle(float radius) {
return points; return points;
} }
//#endif
std::vector<Vector2D> HudGL::compute_circle(float radius, float thickness) {
// Maximum allowed distance between the circle and the rendered line segment.
const float MAX_ERROR = 0.1f;
const unsigned segment_count =
static_cast<unsigned>(std::ceil(M_PI / std::acos((radius - MAX_ERROR) / radius)));
const unsigned point_count = segment_count * 2;
float half_thickness = thickness * 0.5f;
std::vector<Vector2D> points;
points.reserve(point_count);
for (unsigned i = 0; i < segment_count; ++i) {
float angle = static_cast<float>(M_PI * 2 * i / segment_count);
points.emplace_back((radius + half_thickness) * std::cos(angle), (radius + half_thickness) * std::sin(angle));
points.emplace_back((radius - half_thickness) * std::cos(angle), (radius - half_thickness) * std::sin(angle));
}
return points;
}

View file

@ -9,16 +9,10 @@ public:
void color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) const; void color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) const;
void line_width(float width) const; void line_width(float width) const;
void line(const Vector2D& start, const Vector2D& end) const; void line(const Vector2D& start, const Vector2D& end) const;
//#ifdef __APPLE__
// //Remove when OSX builds with c++11
//#else
void circle(const Vector2D& center, const std::vector<Vector2D>& points) const; void circle(const Vector2D& center, const std::vector<Vector2D>& points) const;
//#endif void round_dot(const Vector2D& center, const std::vector<Vector2D>& points) const;
void rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const; void rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const;
//#ifdef __APPLE__
// //Remove when OSX builds with c++11
//#else
static std::vector<Vector2D> compute_circle(float radius); static std::vector<Vector2D> compute_circle(float radius);
//#endif static std::vector<Vector2D> compute_circle(float radius, float thickness);
}; };

View file

@ -61,6 +61,7 @@ extern "C"
#include "mod/AvHScrollHandler.h" #include "mod/AvHScrollHandler.h"
#include "mod/AvHCommanderModeHandler.h" #include "mod/AvHCommanderModeHandler.h"
#include "util/Mat3.h" #include "util/Mat3.h"
#include "mod/AvHBasePlayerWeaponConstants.h"
#include "engine/APIProxy.h" #include "engine/APIProxy.h"
#include "Exports.h" #include "Exports.h"
@ -106,6 +107,11 @@ extern cvar_t *in_joystick;
int in_impulse = 0; int in_impulse = 0;
int in_cancel = 0; int in_cancel = 0;
bool pistolHandlerDown = false;
extern int g_iVisibleMouse;
int g_iVguiSideMouse;
cvar_t *m_pitch; cvar_t *m_pitch;
cvar_t *m_yaw; cvar_t *m_yaw;
cvar_t *m_forward; cvar_t *m_forward;
@ -135,16 +141,17 @@ cvar_t *cl_highdetail;
cvar_t *cl_cmhotkeys; cvar_t *cl_cmhotkeys;
//cvar_t *cl_forcedefaultfov; //cvar_t *cl_forcedefaultfov;
cvar_t *cl_dynamiclights; cvar_t *cl_dynamiclights;
cvar_t *r_dynamic;
cvar_t *cl_buildmessages; cvar_t *cl_buildmessages;
cvar_t *cl_particleinfo; cvar_t *cl_particleinfo;
cvar_t *cl_widescreen; //cvar_t *cl_widescreen;
cvar_t *cl_ambientsound; cvar_t *cl_ambientsound;
cvar_t *senslock; cvar_t *senslock;
cvar_t *hud_style;
cvar_t *cl_chatbeep; cvar_t *cl_chatbeep;
cvar_t *cl_mutemenu; cvar_t *cl_mutemenu;
cvar_t *cl_weaponcfgs; cvar_t *cl_weaponcfgs;
cvar_t *cl_pistoltrigger;
cvar_t *cl_cmcancellast;
cvar_t *cl_teamcfgs;
/* /*
=============================================================================== ===============================================================================
@ -563,14 +570,44 @@ Return 1 to allow engine to process the key, otherwise, act on it as needed
int CL_DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBinding ) int CL_DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBinding )
{ {
// RecClKeyEvent(down, keynum, pszCurrentBinding); // RecClKeyEvent(down, keynum, pszCurrentBinding);
// 2024 - Check mouse button presses when the cursor is visible to fix issues with VGUI registering mouse4/5 as left click. Previously these were blocked in inputw32.
// Also note that g_iVguiSideMouseRelease is set in inputw32, because for some reason side mouse button releases in VGUI mode don't get sent here.
if (g_iVisibleMouse && (keynum >= K_MOUSE1 && keynum <= K_MOUSE5))
{
switch (keynum)
{
case K_MOUSE1:
case K_MOUSE2:
g_iVguiSideMouse = 0;
return 0;
case K_MOUSE3:
g_iVguiSideMouse = 0;
// Allow mouse3 binds while commanding since commander VGUI currently doesn't use it.
if (!gHUD.GetInTopDownMode())
{
return 0;
}
break;
case K_MOUSE4:
case K_MOUSE5:
g_iVguiSideMouse = keynum;
if (!gHUD.GetInTopDownMode())
{
return 0;
}
break;
}
}
// Check to see if the event has any outlawed commands in it.
float theBlockScripts = gHUD.GetServerVariableFloat(kvBlockScripts);
// Check to see if the event has any outlawed commands in it.
float theBlockScripts = gHUD.GetServerVariableFloat(kvBlockScripts);
if (theBlockScripts && AvHContainsBlockedCommands(pszCurrentBinding)) if (theBlockScripts && AvHContainsBlockedCommands(pszCurrentBinding))
{ {
if(down)//: only show when going down. if(down)//: only show when going down.
gEngfuncs.pfnCenterPrint("Scripting is not allowed on this server.\n"); gEngfuncs.pfnCenterPrint("Scripting is not allowed on this server.\n");
return 0; return 0;
} }
@ -584,15 +621,15 @@ int CL_DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBind
int theProcessKeyBinding = 1; int theProcessKeyBinding = 1;
// char theKeyBinding[256] = "none"; // char theKeyBinding[256] = "none";
// if(pszCurrentBinding) // if(pszCurrentBinding)
// { // {
// sprintf(theKeyBinding, pszCurrentBinding); // sprintf(theKeyBinding, pszCurrentBinding);
// } // }
// //
// char theMessage[512]; // char theMessage[512];
// sprintf(theMessage, "%s (down: %d, keynum %d)", theKeyBinding, down, keynum); // sprintf(theMessage, "%s (down: %d, keynum %d)", theKeyBinding, down, keynum);
// CenterPrint(theMessage); // CenterPrint(theMessage);
if(gViewPort /*&& gViewPort->IsOptionsMenuVisible()*/) if(gViewPort /*&& gViewPort->IsOptionsMenuVisible()*/)
{ {
@ -808,7 +845,7 @@ void IN_AttackUp(void)
in_cancel = 0; in_cancel = 0;
// Attack2up only for onos so it can end +attack onos charges. Attack2up for all causes blink and leap to cancel if you release attack while blinking or leaping. // Attack2up only for onos so it can end +attack onos charges. Attack2up for all causes blink and leap to cancel if you release attack while blinking or leaping.
if (g_iUser3 == AVH_USER3_ALIEN_PLAYER5) if (gHUD.GetCurrentWeaponID() == AVH_ABILITY_CHARGE)
{ {
IN_Attack2Up(); IN_Attack2Up();
} }
@ -824,6 +861,35 @@ void IN_AttackUpForced(void)
KeyUpForced( &in_attack ); KeyUpForced( &in_attack );
} }
void IN_AttackHandlerDown(void)
{
if (gHUD.GetCurrentWeaponID() == AVH_WEAPON_PISTOL && cl_pistoltrigger && cl_pistoltrigger->value)
{
IN_AttackDown();
IN_AttackUp();
pistolHandlerDown = true;
}
else
{
IN_AttackDown();
}
}
void IN_AttackHandlerUp(void)
{
// Pistol binary trigger. Check if attack was down, otherwise the engine will fire the pistol when closing the console or tabbing in as it calls every -command.
if (gHUD.GetCurrentWeaponID() == AVH_WEAPON_PISTOL && cl_pistoltrigger && cl_pistoltrigger->value && pistolHandlerDown)
{
IN_AttackDown();
IN_AttackUp();
pistolHandlerDown = false;
}
else
{
IN_AttackUp();
}
}
// Special handling // Special handling
void IN_Cancel(void) void IN_Cancel(void)
{ {
@ -1161,6 +1227,11 @@ void CL_DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int ac
theProcessedMove = true; theProcessedMove = true;
theIsSendingSpecialEvent = true; theIsSendingSpecialEvent = true;
} }
else
{
// Clear the impulse so it doesn't execute once leaving the chair.
in_impulse = 0;
}
} }
if(!theProcessedMove && gHUD.GetAndClearSelectionEvent(theMouseNormPos, theTechEvent)) if(!theProcessedMove && gHUD.GetAndClearSelectionEvent(theMouseNormPos, theTechEvent))
@ -1530,6 +1601,86 @@ void EchoDev(void)
gEngfuncs.Con_Printf("%s\n", gEngfuncs.Cmd_Argv(1)); gEngfuncs.Con_Printf("%s\n", gEngfuncs.Cmd_Argv(1));
} }
void NsPreset(void)
{
int presetChoice = atoi(gEngfuncs.Cmd_Argv(1));
bool printToChat = gViewPort;
char execText[1024];
//char localizedText[1024];
switch (presetChoice)
{
case 1:
ClientCmd("exec presetcfgs/AV/ns32.cfg");
if (printToChat)
{
// Localize later.
//sprintf(localizedText, CHudTextMessage::BufferedLocaliseTextString("#Preset1"));
snprintf(execText, 1024, "%c** %s\n", HUD_PRINTTALK, "Classic NS audio/visual presets applied. Left click once to fix bug. See console for details.");
gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, (int)strlen(execText) + 1, execText);
ClientCmd("echo \"NOTE: You must left click once after applying these settings, or your next left click won't register. It's an HL engine bug.\""); // Use echo or it's out of order.
}
else
{
ClientCmd("toggleconsole");
}
break;
case 2:
ClientCmd("exec presetcfgs/AV/newdefault.cfg");
if (printToChat)
{
// Localize later.
//sprintf(localizedText, CHudTextMessage::BufferedLocaliseTextString("#Preset2"));
snprintf(execText, 1024, "%c** %s\n", HUD_PRINTTALK, "NS 3.3 audio/visual presets applied. Left click once to fix bug. See console for details. ");
gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, (int)strlen(execText) + 1, execText);
ClientCmd("echo \"NOTE: You must left click once after applying these settings, or your next left click won't register. It's an HL engine bug.\""); // Use echo or it's out of order.
}
else
{
ClientCmd("toggleconsole");
}
break;
case 3:
ClientCmd("exec presetcfgs/AV/competitive.cfg");
if (printToChat)
{
// Localize later.
//sprintf(localizedText, CHudTextMessage::BufferedLocaliseTextString("#Preset3"));
snprintf(execText, 1024, "%c** %s\n", HUD_PRINTTALK, "Competitive audio/visual presets applied. Left click once to fix bug. See console for details.");
gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, (int)strlen(execText) + 1, execText);
ClientCmd("echo \"NOTE: You must left click once after applying these settings, or your next left click won't register. It's an HL engine bug.\""); // Use echo or it's out of order.
}
else
{
ClientCmd("toggleconsole");
}
break;
default:
gEngfuncs.Con_Printf("NS configuration preset selector. Usage:\n1: apply NS 3.2 settings\n2: apply NS 3.3 settings\n3: apply competitive settings\n");
}
}
void NsRates(void)
{
int ratesChoice = atoi(gEngfuncs.Cmd_Argv(1));
char execText[30];
if (ratesChoice >= 1 && ratesChoice <= 20)
{
snprintf(execText, 30, "exec presetcfgs/rates/%d.cfg", ratesChoice);
ClientCmd(execText);
}
// Don't show this if 0 is entered as an arg, as it's the normal behavior for the blank default setting in options.
else if (gEngfuncs.Cmd_Argc() <= 1 || ratesChoice != 0)
{
gEngfuncs.Con_Printf("nsrates selects from preset network rate commands. Start from \"nsrates 1\" and increase the number until your connection feels stable.\n");
}
}
/* /*
============ ============
InitInput InitInput
@ -1561,8 +1712,8 @@ void InitInput (void)
gEngfuncs.pfnAddCommand ("-moveright", IN_MoverightUp); gEngfuncs.pfnAddCommand ("-moveright", IN_MoverightUp);
gEngfuncs.pfnAddCommand ("+speed", IN_SpeedDown); gEngfuncs.pfnAddCommand ("+speed", IN_SpeedDown);
gEngfuncs.pfnAddCommand ("-speed", IN_SpeedUp); gEngfuncs.pfnAddCommand ("-speed", IN_SpeedUp);
gEngfuncs.pfnAddCommand ("+attack", IN_AttackDown); gEngfuncs.pfnAddCommand ("+attack", IN_AttackHandlerDown);
gEngfuncs.pfnAddCommand ("-attack", IN_AttackUp); gEngfuncs.pfnAddCommand ("-attack", IN_AttackHandlerUp);
//gEngfuncs.pfnAddCommand ("+movement", IN_Attack2Down); //gEngfuncs.pfnAddCommand ("+movement", IN_Attack2Down);
//gEngfuncs.pfnAddCommand ("-movement", IN_Attack2Up); //gEngfuncs.pfnAddCommand ("-movement", IN_Attack2Up);
gEngfuncs.pfnAddCommand ("+use", IN_UseDown); gEngfuncs.pfnAddCommand ("+use", IN_UseDown);
@ -1604,6 +1755,8 @@ void InitInput (void)
gEngfuncs.pfnAddCommand("nsversion", NsVersion); gEngfuncs.pfnAddCommand("nsversion", NsVersion);
gEngfuncs.pfnAddCommand("echodev", EchoDev); gEngfuncs.pfnAddCommand("echodev", EchoDev);
gEngfuncs.pfnAddCommand("nspreset", NsPreset);
gEngfuncs.pfnAddCommand("nsrates", NsRates);
lookstrafe = gEngfuncs.pfnRegisterVariable ( "lookstrafe", "0", FCVAR_ARCHIVE ); lookstrafe = gEngfuncs.pfnRegisterVariable ( "lookstrafe", "0", FCVAR_ARCHIVE );
lookspring = gEngfuncs.pfnRegisterVariable ( "lookspring", "0", FCVAR_ARCHIVE ); lookspring = gEngfuncs.pfnRegisterVariable ( "lookspring", "0", FCVAR_ARCHIVE );
@ -1627,8 +1780,8 @@ void InitInput (void)
cl_autohelp = gEngfuncs.pfnRegisterVariable ( kvAutoHelp, "1.0", FCVAR_ARCHIVE ); cl_autohelp = gEngfuncs.pfnRegisterVariable ( kvAutoHelp, "1.0", FCVAR_ARCHIVE );
cl_centerentityid = gEngfuncs.pfnRegisterVariable ( kvCenterEntityID, "0.0", FCVAR_ARCHIVE ); cl_centerentityid = gEngfuncs.pfnRegisterVariable ( kvCenterEntityID, "0.0", FCVAR_ARCHIVE );
cl_musicenabled = gEngfuncs.pfnRegisterVariable ( kvMusicEnabled, "0", FCVAR_ARCHIVE ); cl_musicenabled = gEngfuncs.pfnRegisterVariable ( kvMusicEnabled, "1", FCVAR_ARCHIVE );
cl_musicvolume = gEngfuncs.pfnRegisterVariable ( kvMusicVolume, "1", FCVAR_ARCHIVE ); cl_musicvolume = gEngfuncs.pfnRegisterVariable ( kvMusicVolume, "0.6", FCVAR_ARCHIVE );
cl_musicdir = gEngfuncs.pfnRegisterVariable ( kvMusicDirectory, "", FCVAR_ARCHIVE); cl_musicdir = gEngfuncs.pfnRegisterVariable ( kvMusicDirectory, "", FCVAR_ARCHIVE);
cl_musicdelay = gEngfuncs.pfnRegisterVariable ( kvMusicDelay, "90", FCVAR_ARCHIVE); cl_musicdelay = gEngfuncs.pfnRegisterVariable ( kvMusicDelay, "90", FCVAR_ARCHIVE);
cl_dynamiclights = gEngfuncs.pfnRegisterVariable ( kvDynamicLights, "1", FCVAR_ARCHIVE ); cl_dynamiclights = gEngfuncs.pfnRegisterVariable ( kvDynamicLights, "1", FCVAR_ARCHIVE );
@ -1638,13 +1791,17 @@ void InitInput (void)
cl_cmhotkeys = gEngfuncs.pfnRegisterVariable ( kvCMHotkeys, "qwerasdfzxcv", FCVAR_ARCHIVE ); cl_cmhotkeys = gEngfuncs.pfnRegisterVariable ( kvCMHotkeys, "qwerasdfzxcv", FCVAR_ARCHIVE );
//cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", FCVAR_ARCHIVE ); //cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", FCVAR_ARCHIVE );
cl_particleinfo = gEngfuncs.pfnRegisterVariable ( kvParticleInfo, "0", FCVAR_ARCHIVE ); cl_particleinfo = gEngfuncs.pfnRegisterVariable ( kvParticleInfo, "0", FCVAR_ARCHIVE );
cl_widescreen = gEngfuncs.pfnRegisterVariable ( kvWidescreen, "1", FCVAR_ARCHIVE ); //cl_widescreen = gEngfuncs.pfnRegisterVariable ( kvWidescreen, "1", FCVAR_ARCHIVE );
cl_ambientsound = gEngfuncs.pfnRegisterVariable ( kvAmbientSound, "0", FCVAR_ARCHIVE); cl_ambientsound = gEngfuncs.pfnRegisterVariable ( kvAmbientSound, "0.6", FCVAR_ARCHIVE);
senslock = gEngfuncs.pfnRegisterVariable ("senslock", "0", FCVAR_ARCHIVE); senslock = gEngfuncs.pfnRegisterVariable ("senslock", "0", FCVAR_ARCHIVE);
hud_style = gEngfuncs.pfnRegisterVariable ("hud_style", "1", FCVAR_ARCHIVE);
cl_chatbeep = gEngfuncs.pfnRegisterVariable ("cl_chatbeep", "1", FCVAR_ARCHIVE); cl_chatbeep = gEngfuncs.pfnRegisterVariable ("cl_chatbeep", "1", FCVAR_ARCHIVE);
cl_mutemenu = gEngfuncs.pfnRegisterVariable ("cl_mutemenu", "3", FCVAR_ARCHIVE); cl_mutemenu = gEngfuncs.pfnRegisterVariable ("cl_mutemenu", "3", FCVAR_ARCHIVE);
cl_weaponcfgs = gEngfuncs.pfnRegisterVariable ("cl_weaponcfgs", "1", FCVAR_ARCHIVE); cl_weaponcfgs = gEngfuncs.pfnRegisterVariable ("cl_weaponcfgs", "1", FCVAR_ARCHIVE);
cl_pistoltrigger = gEngfuncs.pfnRegisterVariable ("cl_pistoltrigger", "1", FCVAR_ARCHIVE);
cl_cmcancellast = gEngfuncs.pfnRegisterVariable("cl_cmcancellast", "0", FCVAR_ARCHIVE);
cl_teamcfgs = gEngfuncs.pfnRegisterVariable("cl_teamcfgs", "1", FCVAR_ARCHIVE);
gEngfuncs.pfnRegisterVariable("cl_placebo", "0", 0); // Junk command for options menu dividers.
// Initialize third person camera controls. // Initialize third person camera controls.
CAM_Init(); CAM_Init();

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