Raised This Month: $51 Target: $400
 12% 

Solved [TF2] Increasing the size of player sprays


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sappykun
Member
Join Date: Nov 2019
Old 04-13-2020 , 15:16   [TF2] Increasing the size of player sprays
Reply With Quote #1

See https://forums.alliedmods.net/showthread.php?p=2746552 for a plugin that accomplishes this.

As for the original glitch I encountered, here's what happened:

The playerdecal material sizes are cached based on the previous VTF used as the player's spray. Normally, the size is clamped to 64x64 hammer units, and the VTF file referenced in the playerlogo01.vmt file is a 64x64 blood texture.
This clamping does not occur when the VTF in question is below 128x128 pixels - and the map before, I just happened to use a spray that was 125x125 pixels in size. When the new map was loaded, my client (and the clients of the other players at the time) re-cached the material using the dimensions of the 125x125 VTF from the previous map, resulting in a blown-up spray.


Original post:

Spoiler

Last edited by Sappykun; 11-04-2021 at 15:41.
Sappykun is offline
Sappykun
Member
Join Date: Nov 2019
Old 05-20-2020 , 23:51   Re: [TF2] Increasing the size of player sprays
Reply With Quote #2

I've been doing some research into how other plugins handle sprays, and how the Source engine handles sprays itself.

Most plugins use this block of code to spray a player's spray (taken from here):

Code:
TE_Start("Player Decal");
TE_WriteVector("m_vecOrigin", fClientEyeViewPoint);
TE_WriteNum("m_nPlayer", iClient);
TE_SendToAll();
where fClientEyeViewPoint is the origin point and iClient is the client index. However, I don't see a way to manipulate how the spray is displayed from here.

In the Source 2013 multiplayer code, when a player uses impulse 201, the engine does the following steps:
  1. Find who's placing a spray
  2. See if they have a spray set up
  3. Generate a hashed filename (some sort of hex value) based on the filename and player
  4. Get the logo based on this hashed filename (either in materials/temp or download/user_custom)
  5. Apply a VMT material to it (materials/decals/playerlogoXX.vmt)
  6. Display it in the world

However, VMT files don't determine how large a decal is; based on the info_overlay entity in Hammer, each overlay has four vectors (uv0, uv1, uv2, uv3) that determine how the spray is projected onto the brush/displacement based on its origin point.

The C_TEPlayerDecal class only seems to expose 3 values: the player ID, the spray's origin point, and the entity ID, m_nEntity.

With this information, I can see two ways of achieving my goals:
  1. Use m_nEntity to manipulate the uv points of the spray before it's placed, increasing its size. This would probably be the best solution, but how would I get the entity ID of the spray before it's placed? Is it even possible to change the decal's properties given its entity index?
  2. Use a generic BSP decal with the player's spray based on the hashed filename. I can check the client's value of cl_logofile, get the filename, generate the hash myself, then use that to display the logo in the world. Is this a feasible approach? Is it possible?

Am I on to something, or am I misunderstanding how Source handles player sprays? Any advice would be appreciated.

Last edited by Sappykun; 05-20-2020 at 23:53.
Sappykun is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode