-
Notifications
You must be signed in to change notification settings - Fork 22
First Person Muzzle Flash & No Tracers #559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AdamTadeusz
merged 16 commits into
NeotokyoRebuild:master
from
AdamTadeusz:026_firstPersonMuzzleFlashesViewModelMuzzleFlash
Sep 18, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
93e4735
First person muzzle flashes
AdamTadeusz a0baf1a
terrible but works
AdamTadeusz 61390eb
groundwork for the different muzzle flash types
AdamTadeusz d9c0ef6
change muzzleflash model depending on gun used
AdamTadeusz 622c94f
using a viewmodel instead of a baseanimatingentity
AdamTadeusz a4bf9c0
Always remake the muzzle flash viewmodel if need be, tie muzzle flash…
AdamTadeusz db8ff92
added environment light for fp muzzle flash, synchronise muzzle flash…
AdamTadeusz d60a026
no tracers for any weapons
AdamTadeusz af1cb78
cleanup
AdamTadeusz f6b1128
adjusted muzzle flash properties for some weapons
AdamTadeusz 4f8b9d0
move custom muzzle world flash to neo_predicted_viewmodel
AdamTadeusz 8a91731
Merge branch 'master' into 026_firstPersonMuzzleFlashesViewModelMuzzl…
AdamTadeusz 93a9ee2
merge master, do not network most of the muzzleflash properties
AdamTadeusz 6445f71
review suggestions, use setscale once now that initial weapon selecti…
AdamTadeusz ff7b0ec
conflict with master
AdamTadeusz b317181
unused define, neowepbits const
AdamTadeusz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| "UnlitGeneric" | ||
| { | ||
| "$basetexture" "effects\fpmf\fpmf01" | ||
| "$nocull" 1 | ||
| "$additive" 1 | ||
| "$model" 1 | ||
| "$translucent" 1 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| "UnlitGeneric" | ||
| { | ||
| "$basetexture" "effects\fpmf\fpmf02" | ||
| "$nocull" 1 | ||
| "$additive" 1 | ||
| "$model" 1 | ||
| "$translucent" 1 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
mp/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| #include "cbase.h" | ||
| #include "model_types.h" | ||
|
|
||
| #ifdef GAME_DLL | ||
| #include "baseanimating.h" | ||
| #endif | ||
|
|
||
| #include "neo_predicted_viewmodel_muzzleflash.h" | ||
|
|
||
| // memdbgon must be the last include file in a .cpp file!!! | ||
| #include "tier0/memdbgon.h" | ||
|
|
||
| IMPLEMENT_NETWORKCLASS_ALIASED(NEOPredictedViewModelMuzzleFlash, DT_NEOPredictedViewModelMuzzleFlash) | ||
|
|
||
| BEGIN_NETWORK_TABLE(CNEOPredictedViewModelMuzzleFlash, DT_NEOPredictedViewModelMuzzleFlash) | ||
| #ifndef CLIENT_DLL | ||
| SendPropEHandle(SENDINFO_NAME(m_hMoveParent, moveparent)), | ||
| #else | ||
| RecvPropInt(RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent), | ||
| #endif | ||
| END_NETWORK_TABLE() | ||
|
|
||
| #ifdef CLIENT_DLL | ||
| BEGIN_PREDICTION_DATA(CNEOPredictedViewModelMuzzleFlash) | ||
| END_PREDICTION_DATA() | ||
| #endif | ||
|
|
||
| LINK_ENTITY_TO_CLASS(neo_predicted_viewmodel_muzzleflash, CNEOPredictedViewModelMuzzleFlash); | ||
|
|
||
| constexpr const char* MUZZLE_FLASH_ENTITY_MODEL = "models/effect/fpmf/fpmf01.mdl"; | ||
|
|
||
| //----------------------------------------------------------------------------- | ||
| // Purpose: Precache assets used by the entity | ||
| //----------------------------------------------------------------------------- | ||
| void CNEOPredictedViewModelMuzzleFlash::Precache(void) | ||
| { | ||
| PrecacheModel(MUZZLE_FLASH_ENTITY_MODEL); | ||
|
|
||
| BaseClass::Precache(); | ||
| } | ||
|
|
||
| //----------------------------------------------------------------------------- | ||
| // Purpose: Sets up the entity's initial state | ||
| //----------------------------------------------------------------------------- | ||
| void CNEOPredictedViewModelMuzzleFlash::Spawn(void) | ||
| { | ||
| Precache(); | ||
| SetModel(MUZZLE_FLASH_ENTITY_MODEL); | ||
| SetSolid(SOLID_NONE); | ||
| AddEffects(EF_NOSHADOW | EF_NORECEIVESHADOW); | ||
| RemoveEffects(EF_NODRAW | EF_BONEMERGE); | ||
| } | ||
|
|
||
| #ifdef CLIENT_DLL | ||
| int CNEOPredictedViewModelMuzzleFlash::DrawModel(int flags) | ||
| { | ||
| if (m_flTimeSwitchOffMuzzleFlash > gpGlobals->curtime && m_bActive) | ||
| { | ||
| CBasePlayer* pOwner = ToBasePlayer(GetOwner()); | ||
| if (pOwner == NULL) | ||
| return -1; | ||
| CBaseViewModel* vm = pOwner->GetViewModel(0, false); | ||
| if (vm == NULL) | ||
| return -1; | ||
|
|
||
| int iAttachment = vm->LookupAttachment("muzzle"); | ||
| if (iAttachment < 0) | ||
| return -1; | ||
|
|
||
| Vector localOrigin; | ||
| QAngle localAngle; | ||
| vm->GetAttachment(iAttachment, localOrigin, localAngle); | ||
| UncorrectViewModelAttachment(localOrigin); // Need position of muzzle without fov modifications & viewmodel offset | ||
| m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; // NEOTODO (Adam) ? Speed of rotation depends on how often DrawModel() is called. Should this be tied to global time? | ||
| localAngle.z = m_iAngleZ; | ||
| SetAbsOrigin(localOrigin); | ||
| SetAbsAngles(localAngle); | ||
|
|
||
| return BaseClass::DrawModel(flags); | ||
| } | ||
| return -1; | ||
| } | ||
| #endif |
50 changes: 50 additions & 0 deletions
50
mp/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #ifndef NEO_PREDICTED_VIEWMODEL_MUZZLEFLASH_H | ||
| #define NEO_PREDICTED_VIEWMODEL_MUZZLEFLASH_H | ||
| #ifdef _WIN32 | ||
| #pragma once | ||
| #endif | ||
|
|
||
| #include "predicted_viewmodel.h" | ||
|
|
||
| #ifdef CLIENT_DLL | ||
| #define CNEOPredictedViewModelMuzzleFlash C_NEOPredictedViewModelMuzzleFlash | ||
| #endif | ||
|
|
||
| #define MUZZLE_FLASH_VIEW_MODEL_INDEX 1 | ||
|
|
||
| class CNEOPredictedViewModelMuzzleFlash : public CPredictedViewModel | ||
| { | ||
| DECLARE_CLASS(CNEOPredictedViewModelMuzzleFlash, CPredictedViewModel); | ||
| public: | ||
| DECLARE_NETWORKCLASS(); | ||
| DECLARE_PREDICTABLE(); | ||
| CNEOPredictedViewModelMuzzleFlash() | ||
| { | ||
| m_bActive = true; | ||
| m_iAngleZ = 0; | ||
| m_iAngleZIncrement = -5; | ||
| m_flTimeSwitchOffMuzzleFlash = gpGlobals->curtime; | ||
| } | ||
|
|
||
| #ifdef CLIENT_DLL | ||
| virtual ShadowType_t ShadowCastType() final override { return SHADOWS_NONE; }; | ||
| virtual RenderGroup_t GetRenderGroup() final override { return RENDER_GROUP_VIEW_MODEL_TRANSLUCENT; }; | ||
| virtual int DrawModel(int flags) final override; | ||
| virtual void ProcessMuzzleFlashEvent() final override | ||
| { | ||
| if (!m_bActive) | ||
| return; | ||
| m_flTimeSwitchOffMuzzleFlash = gpGlobals->curtime + 0.01f; | ||
| BaseClass::ProcessMuzzleFlashEvent(); | ||
| } | ||
| #endif | ||
|
|
||
| virtual void Spawn(void) override; | ||
| virtual void Precache(void) override; | ||
| bool m_bActive; | ||
| int m_iAngleZ; | ||
| int m_iAngleZIncrement; | ||
| float m_flTimeSwitchOffMuzzleFlash; // If the server can fire a user's weapon (maybe some kind of server triggered weapon cook off or something), this will need to be networked too. | ||
| }; | ||
|
|
||
| #endif // NEO_PREDICTED_VIEWMODEL_MUZZLEFLASH_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.