Skip to content

New effect function fxAddShadow #1003

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

Closed
wants to merge 791 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
791 commits
Select commit Hold shift + click to select a range
5313536
New translations client.pot (Vietnamese)
MTABot Aug 6, 2023
c798d45
New translations client.pot (Portuguese, Brazilian)
MTABot Aug 6, 2023
9a7b2f2
New translations client.pot (Indonesian)
MTABot Aug 6, 2023
4058276
New translations client.pot (Persian)
MTABot Aug 6, 2023
2c81822
New translations client.pot (Croatian)
MTABot Aug 6, 2023
ba0542a
New translations client.pot (Estonian)
MTABot Aug 6, 2023
084488e
New translations client.pot (Latvian)
MTABot Aug 6, 2023
923255f
New translations client.pot (Azerbaijani)
MTABot Aug 6, 2023
8971f0a
New translations client.pot (Hindi)
MTABot Aug 6, 2023
c9a0495
New translations client.pot (Filipino)
MTABot Aug 6, 2023
6826fbe
New translations client.pot (Bosnian)
MTABot Aug 6, 2023
121aa54
New translations client.pot (Norwegian Bokmal)
MTABot Aug 6, 2023
aa33965
New translations client.pot (Serbian)
MTABot Aug 6, 2023
2f5110a
New translations client.pot (Arabic)
MTABot Aug 8, 2023
9138d6d
New translations client.pot (Hungarian)
MTABot Aug 12, 2023
c0c626a
New translations client.pot (Italian)
MTABot Aug 13, 2023
8f2a2a4
New translations client.pot (Romanian)
MTABot Aug 13, 2023
9762836
New translations client.pot (French)
MTABot Aug 13, 2023
e6d1575
New translations client.pot (Spanish)
MTABot Aug 13, 2023
667b6b0
New translations client.pot (Arabic)
MTABot Aug 13, 2023
2a1619e
New translations client.pot (Bulgarian)
MTABot Aug 13, 2023
22188ce
New translations client.pot (Czech)
MTABot Aug 13, 2023
04c4be7
New translations client.pot (Danish)
MTABot Aug 13, 2023
10fb58c
New translations client.pot (German)
MTABot Aug 13, 2023
8ec0363
New translations client.pot (Greek)
MTABot Aug 13, 2023
e8e1631
New translations client.pot (Finnish)
MTABot Aug 13, 2023
bf851ad
New translations client.pot (Hebrew)
MTABot Aug 13, 2023
42aa7b3
New translations client.pot (Hungarian)
MTABot Aug 13, 2023
c4fd702
New translations client.pot (Japanese)
MTABot Aug 13, 2023
acc8498
New translations client.pot (Georgian)
MTABot Aug 13, 2023
fc51420
New translations client.pot (Korean)
MTABot Aug 13, 2023
4688806
New translations client.pot (Lithuanian)
MTABot Aug 13, 2023
ea77602
New translations client.pot (Macedonian)
MTABot Aug 13, 2023
50062d7
New translations client.pot (Dutch)
MTABot Aug 13, 2023
1c3cdcd
New translations client.pot (Polish)
MTABot Aug 13, 2023
a4014e9
New translations client.pot (Portuguese)
MTABot Aug 13, 2023
5d6fe82
New translations client.pot (Russian)
MTABot Aug 13, 2023
3783c48
New translations client.pot (Slovak)
MTABot Aug 13, 2023
b529e8b
New translations client.pot (Slovenian)
MTABot Aug 13, 2023
0dfe15c
New translations client.pot (Swedish)
MTABot Aug 13, 2023
61df2c9
New translations client.pot (Turkish)
MTABot Aug 13, 2023
7385ce3
New translations client.pot (Ukrainian)
MTABot Aug 13, 2023
ffecf47
New translations client.pot (Chinese Simplified)
MTABot Aug 13, 2023
3077958
New translations client.pot (Chinese Traditional)
MTABot Aug 13, 2023
e814185
New translations client.pot (Vietnamese)
MTABot Aug 13, 2023
2dc5295
New translations client.pot (Portuguese, Brazilian)
MTABot Aug 13, 2023
ab4f82f
New translations client.pot (Indonesian)
MTABot Aug 13, 2023
3efc1a3
New translations client.pot (Persian)
MTABot Aug 13, 2023
3c892be
New translations client.pot (Croatian)
MTABot Aug 13, 2023
ead6e6a
New translations client.pot (Estonian)
MTABot Aug 13, 2023
f08c9f1
New translations client.pot (Latvian)
MTABot Aug 13, 2023
d5d82c7
New translations client.pot (Azerbaijani)
MTABot Aug 13, 2023
d3968e5
New translations client.pot (Hindi)
MTABot Aug 13, 2023
7e42576
New translations client.pot (Filipino)
MTABot Aug 13, 2023
2f91ac1
New translations client.pot (Bosnian)
MTABot Aug 13, 2023
534db03
New translations client.pot (Norwegian Bokmal)
MTABot Aug 13, 2023
48fb538
New translations client.pot (Serbian)
MTABot Aug 13, 2023
0de5c1a
New translations client.pot (Korean)
MTABot Aug 16, 2023
49c94ba
New translations client.pot (Korean)
MTABot Aug 16, 2023
68d73f5
New translations client.pot (Korean)
MTABot Aug 16, 2023
5be8c42
New translations main_menu.pot (Korean)
MTABot Aug 16, 2023
8860584
New translations client.pot (Korean)
MTABot Aug 16, 2023
8cfa96e
New translations client.pot (Korean)
MTABot Aug 16, 2023
09064c5
New translations client.pot (Korean)
MTABot Aug 16, 2023
2b69c26
New translations client.pot (Korean)
MTABot Aug 16, 2023
d287f95
New translations client.pot (Korean)
MTABot Aug 16, 2023
03a22ad
New translations en_US.pot (Korean)
MTABot Aug 16, 2023
e1e24d3
New translations main_menu.pot (Korean)
MTABot Aug 16, 2023
99d600e
New translations client.pot (Korean)
MTABot Aug 17, 2023
25a1bf8
New translations client.pot (Korean)
MTABot Aug 17, 2023
caf0754
New translations client.pot (Italian)
MTABot Aug 23, 2023
6cde054
New translations client.pot (Romanian)
MTABot Aug 23, 2023
44d7812
New translations client.pot (French)
MTABot Aug 23, 2023
ec3500d
New translations client.pot (Spanish)
MTABot Aug 23, 2023
f426035
New translations client.pot (Arabic)
MTABot Aug 23, 2023
f27e77b
New translations client.pot (Bulgarian)
MTABot Aug 23, 2023
ea83791
New translations client.pot (Czech)
MTABot Aug 23, 2023
8528a7e
New translations client.pot (Danish)
MTABot Aug 23, 2023
5af4cd9
New translations client.pot (German)
MTABot Aug 23, 2023
24275ca
New translations client.pot (Greek)
MTABot Aug 23, 2023
266a6ef
New translations client.pot (Finnish)
MTABot Aug 23, 2023
03161ef
New translations client.pot (Hebrew)
MTABot Aug 23, 2023
9c685fe
New translations client.pot (Hungarian)
MTABot Aug 23, 2023
3365ee6
New translations client.pot (Japanese)
MTABot Aug 23, 2023
732a9f2
New translations client.pot (Georgian)
MTABot Aug 23, 2023
a966d25
New translations client.pot (Korean)
MTABot Aug 23, 2023
f0b158d
New translations client.pot (Lithuanian)
MTABot Aug 23, 2023
160e501
New translations client.pot (Macedonian)
MTABot Aug 23, 2023
fdd25ab
New translations client.pot (Dutch)
MTABot Aug 23, 2023
489f434
New translations client.pot (Polish)
MTABot Aug 23, 2023
fa64129
New translations client.pot (Portuguese)
MTABot Aug 23, 2023
0806b7c
New translations client.pot (Russian)
MTABot Aug 23, 2023
9b7a383
New translations client.pot (Slovak)
MTABot Aug 23, 2023
1f295c1
New translations client.pot (Slovenian)
MTABot Aug 23, 2023
f102331
New translations client.pot (Swedish)
MTABot Aug 23, 2023
3b2bfbc
New translations client.pot (Turkish)
MTABot Aug 23, 2023
921bf58
New translations client.pot (Ukrainian)
MTABot Aug 23, 2023
c97c3ec
New translations client.pot (Chinese Simplified)
MTABot Aug 23, 2023
4af327d
New translations client.pot (Chinese Traditional)
MTABot Aug 23, 2023
0cab0fd
New translations client.pot (Vietnamese)
MTABot Aug 23, 2023
d5aa26a
New translations client.pot (Portuguese, Brazilian)
MTABot Aug 23, 2023
676a4f2
New translations client.pot (Indonesian)
MTABot Aug 23, 2023
83481f4
New translations client.pot (Persian)
MTABot Aug 23, 2023
5932b3d
New translations client.pot (Croatian)
MTABot Aug 23, 2023
459c8df
New translations client.pot (Estonian)
MTABot Aug 23, 2023
8d1d5ac
New translations client.pot (Latvian)
MTABot Aug 23, 2023
a9f7db9
New translations client.pot (Azerbaijani)
MTABot Aug 23, 2023
05fed56
New translations client.pot (Hindi)
MTABot Aug 23, 2023
438e0b5
New translations client.pot (Filipino)
MTABot Aug 23, 2023
ef2bdb9
New translations client.pot (Bosnian)
MTABot Aug 23, 2023
05b74bd
New translations client.pot (Norwegian Bokmal)
MTABot Aug 23, 2023
a15f3d5
New translations client.pot (Serbian)
MTABot Aug 23, 2023
8aa9d7e
New translations client.pot (Russian)
MTABot Sep 2, 2023
880ad9a
New translations client.pot (Russian)
MTABot Sep 8, 2023
c484bf0
New translations client.pot (Romanian)
MTABot Sep 8, 2023
1e1cea3
New translations client.pot (French)
MTABot Sep 8, 2023
62079b7
New translations client.pot (Spanish)
MTABot Sep 8, 2023
9757ada
New translations client.pot (Arabic)
MTABot Sep 8, 2023
49f2b15
New translations client.pot (Bulgarian)
MTABot Sep 8, 2023
282e82d
New translations client.pot (Czech)
MTABot Sep 8, 2023
00c4300
New translations client.pot (Danish)
MTABot Sep 8, 2023
24dcc37
New translations client.pot (German)
MTABot Sep 8, 2023
b6e88a0
New translations client.pot (Greek)
MTABot Sep 8, 2023
c184ab7
New translations client.pot (Finnish)
MTABot Sep 8, 2023
665208c
New translations client.pot (Hebrew)
MTABot Sep 8, 2023
024e55e
New translations client.pot (Hungarian)
MTABot Sep 8, 2023
5bdd4da
New translations client.pot (Italian)
MTABot Sep 8, 2023
2f8e43f
New translations client.pot (Japanese)
MTABot Sep 8, 2023
79f5c41
New translations client.pot (Georgian)
MTABot Sep 8, 2023
24e9f11
New translations client.pot (Korean)
MTABot Sep 8, 2023
a0d722b
New translations client.pot (Lithuanian)
MTABot Sep 8, 2023
09bf000
New translations client.pot (Macedonian)
MTABot Sep 8, 2023
9e11154
New translations client.pot (Dutch)
MTABot Sep 8, 2023
aea793b
New translations client.pot (Polish)
MTABot Sep 8, 2023
7d8c208
New translations client.pot (Portuguese)
MTABot Sep 8, 2023
aa48921
New translations client.pot (Slovak)
MTABot Sep 8, 2023
9109a51
New translations client.pot (Slovenian)
MTABot Sep 8, 2023
a5e1901
New translations client.pot (Swedish)
MTABot Sep 8, 2023
340c7c6
New translations client.pot (Turkish)
MTABot Sep 8, 2023
dea68a3
New translations client.pot (Ukrainian)
MTABot Sep 8, 2023
2330675
New translations client.pot (Chinese Simplified)
MTABot Sep 8, 2023
aed39dd
New translations client.pot (Chinese Traditional)
MTABot Sep 8, 2023
6839f18
New translations client.pot (Vietnamese)
MTABot Sep 8, 2023
c813661
New translations client.pot (Portuguese, Brazilian)
MTABot Sep 8, 2023
81b3569
New translations client.pot (Indonesian)
MTABot Sep 8, 2023
f5c3c0c
New translations client.pot (Persian)
MTABot Sep 8, 2023
0d4e7c1
New translations client.pot (Croatian)
MTABot Sep 8, 2023
5a3d1ad
New translations client.pot (Estonian)
MTABot Sep 8, 2023
de2d975
New translations client.pot (Latvian)
MTABot Sep 8, 2023
b2a28b8
New translations client.pot (Azerbaijani)
MTABot Sep 8, 2023
2fcb62e
New translations client.pot (Hindi)
MTABot Sep 8, 2023
a7d04c9
New translations client.pot (Filipino)
MTABot Sep 8, 2023
38e17f9
New translations client.pot (Bosnian)
MTABot Sep 8, 2023
1387741
New translations client.pot (Norwegian Bokmal)
MTABot Sep 8, 2023
051cd34
New translations client.pot (Serbian)
MTABot Sep 8, 2023
9b3c06a
New translations client.pot (Romanian)
MTABot Sep 11, 2023
8dad030
New translations en_US.pot (Romanian)
MTABot Sep 11, 2023
3855f92
New translations client.pot (Russian)
MTABot Sep 15, 2023
fe79ab9
New translations client.pot (Romanian)
MTABot Sep 15, 2023
ce54272
New translations client.pot (French)
MTABot Sep 15, 2023
0fd2f3f
New translations client.pot (Spanish)
MTABot Sep 15, 2023
843e5f4
New translations client.pot (Arabic)
MTABot Sep 15, 2023
12fad30
New translations client.pot (Bulgarian)
MTABot Sep 15, 2023
17f9768
New translations client.pot (Czech)
MTABot Sep 15, 2023
065d377
New translations client.pot (Danish)
MTABot Sep 15, 2023
8ccffe9
New translations client.pot (German)
MTABot Sep 15, 2023
b318ec5
New translations client.pot (Greek)
MTABot Sep 15, 2023
10e2e36
New translations client.pot (Finnish)
MTABot Sep 15, 2023
8938461
New translations client.pot (Hebrew)
MTABot Sep 15, 2023
0db35e3
New translations client.pot (Hungarian)
MTABot Sep 15, 2023
f7bae83
New translations client.pot (Italian)
MTABot Sep 15, 2023
0093ab8
New translations client.pot (Japanese)
MTABot Sep 15, 2023
316ba7e
New translations client.pot (Georgian)
MTABot Sep 15, 2023
0274671
New translations client.pot (Korean)
MTABot Sep 15, 2023
8e37621
New translations client.pot (Lithuanian)
MTABot Sep 15, 2023
e6b91a3
New translations client.pot (Macedonian)
MTABot Sep 15, 2023
35540b2
New translations client.pot (Dutch)
MTABot Sep 15, 2023
9e55170
New translations client.pot (Polish)
MTABot Sep 15, 2023
14b8184
New translations client.pot (Portuguese)
MTABot Sep 15, 2023
064fc1e
New translations client.pot (Slovak)
MTABot Sep 15, 2023
e9f9186
New translations client.pot (Slovenian)
MTABot Sep 15, 2023
f85955a
New translations client.pot (Swedish)
MTABot Sep 15, 2023
55c76bd
New translations client.pot (Turkish)
MTABot Sep 15, 2023
c0b46ca
New translations client.pot (Ukrainian)
MTABot Sep 15, 2023
1e9c248
New translations client.pot (Chinese Simplified)
MTABot Sep 15, 2023
8be3cc5
New translations client.pot (Chinese Traditional)
MTABot Sep 15, 2023
d3cdb9c
New translations client.pot (Vietnamese)
MTABot Sep 15, 2023
c7f5579
New translations client.pot (Portuguese, Brazilian)
MTABot Sep 15, 2023
e80672b
New translations client.pot (Indonesian)
MTABot Sep 15, 2023
ed574d9
New translations client.pot (Persian)
MTABot Sep 15, 2023
e9ccc77
New translations client.pot (Croatian)
MTABot Sep 15, 2023
a9cba9f
New translations client.pot (Estonian)
MTABot Sep 15, 2023
22ad159
New translations client.pot (Latvian)
MTABot Sep 15, 2023
d20f2c6
New translations client.pot (Azerbaijani)
MTABot Sep 15, 2023
90c186f
New translations client.pot (Hindi)
MTABot Sep 15, 2023
52c273f
New translations client.pot (Filipino)
MTABot Sep 15, 2023
57bcae1
New translations client.pot (Bosnian)
MTABot Sep 15, 2023
6c14c9c
New translations client.pot (Norwegian Bokmal)
MTABot Sep 15, 2023
789095a
New translations client.pot (Serbian)
MTABot Sep 15, 2023
e78f70d
New translations client.pot (Russian)
MTABot Sep 17, 2023
7b85b3f
New translations client.pot (Romanian)
MTABot Sep 17, 2023
9100e64
New translations client.pot (French)
MTABot Sep 17, 2023
ce85a35
New translations client.pot (Spanish)
MTABot Sep 17, 2023
c23cc5b
New translations client.pot (Arabic)
MTABot Sep 17, 2023
ec7d161
New translations client.pot (Bulgarian)
MTABot Sep 17, 2023
55c0f5a
New translations client.pot (Czech)
MTABot Sep 17, 2023
94221a3
New translations client.pot (Danish)
MTABot Sep 17, 2023
99823dd
New translations client.pot (German)
MTABot Sep 17, 2023
5fbce5f
New translations client.pot (Greek)
MTABot Sep 17, 2023
7e270b6
New translations client.pot (Finnish)
MTABot Sep 17, 2023
392a5ba
New translations client.pot (Hebrew)
MTABot Sep 17, 2023
e37e96c
New translations client.pot (Hungarian)
MTABot Sep 17, 2023
393d8d5
New translations client.pot (Italian)
MTABot Sep 17, 2023
9ff4d5c
New translations client.pot (Japanese)
MTABot Sep 17, 2023
e9aa571
New translations client.pot (Georgian)
MTABot Sep 17, 2023
1d36d09
New translations client.pot (Korean)
MTABot Sep 17, 2023
afd2e6d
New translations client.pot (Lithuanian)
MTABot Sep 17, 2023
bd1949a
New translations client.pot (Macedonian)
MTABot Sep 17, 2023
7ac5f9d
New translations client.pot (Dutch)
MTABot Sep 17, 2023
fb202a2
New translations client.pot (Polish)
MTABot Sep 17, 2023
2c2fa7b
New translations client.pot (Portuguese)
MTABot Sep 17, 2023
f12b8b0
New translations client.pot (Slovak)
MTABot Sep 17, 2023
6fc2e63
New translations client.pot (Slovenian)
MTABot Sep 17, 2023
50c8bc7
New translations client.pot (Swedish)
MTABot Sep 17, 2023
2a0ffa1
New translations client.pot (Turkish)
MTABot Sep 17, 2023
4c00271
New translations client.pot (Ukrainian)
MTABot Sep 17, 2023
2443887
New translations client.pot (Chinese Simplified)
MTABot Sep 17, 2023
7d8ac8b
New translations client.pot (Chinese Traditional)
MTABot Sep 17, 2023
110b7e6
New translations client.pot (Vietnamese)
MTABot Sep 17, 2023
8003195
New translations client.pot (Portuguese, Brazilian)
MTABot Sep 17, 2023
632ee4d
New translations client.pot (Indonesian)
MTABot Sep 17, 2023
04f0e76
New translations client.pot (Persian)
MTABot Sep 17, 2023
c036715
New translations client.pot (Croatian)
MTABot Sep 17, 2023
4005b21
New translations client.pot (Estonian)
MTABot Sep 17, 2023
c2c2310
New translations client.pot (Latvian)
MTABot Sep 17, 2023
6a23fc0
New translations client.pot (Azerbaijani)
MTABot Sep 17, 2023
9f96756
New translations client.pot (Hindi)
MTABot Sep 17, 2023
ff64dc8
New translations client.pot (Filipino)
MTABot Sep 17, 2023
530e237
New translations client.pot (Bosnian)
MTABot Sep 17, 2023
3ed4879
New translations client.pot (Norwegian Bokmal)
MTABot Sep 17, 2023
bd27bf5
New translations client.pot (Serbian)
MTABot Sep 17, 2023
3c7db57
Merge remote-tracking branch 'origin/l10n/master' into fxAddShadow
CrosRoad95 Sep 17, 2023
48ad95d
final commit?
CrosRoad95 Sep 17, 2023
c52abbc
Merge branch 'master' into fxAddShadow
CrosRoad95 Sep 17, 2023
baa03b8
Merge branch 'master' into fxAddShadow
CrosRoad95 Sep 20, 2023
beec405
remove pots
CrosRoad95 Sep 20, 2023
3c31724
update
CrosRoad95 Sep 20, 2023
2dbe5a8
addendum
CrosRoad95 Sep 20, 2023
eb31546
dont use magic numbers
CrosRoad95 Sep 21, 2023
badb5d6
Merge branch 'master' into fxAddShadow
CrosRoad95 Oct 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Client/game_sa/CFxSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
*****************************************************************************/

#include "StdInc.h"
#include "game/Common.h"
#include "game/RenderWare.h"
#include "CVector2D.h"
#include "CFxSA.h"
#include "CEntitySA.h"
;
using StoreShadowToBeRendered_t = int(__cdecl*)(eShadowType, struct RwTexture*, const CVector*, float, float, float, float, short, unsigned char,
unsigned char, unsigned char, float, bool, float, class CRealTimeShadow*, bool);
auto StoreShadowToBeRendered = reinterpret_cast<StoreShadowToBeRendered_t>(0x707390);
unsigned short& CShadows_ShadowsStoredToBeRendered = *(unsigned short*)0xC403DC;

void CFxSA::AddBlood(CVector& vecPosition, CVector& vecDirection, int iCount, float fBrightness)
{
Expand Down Expand Up @@ -239,3 +247,22 @@ void CFxSA::TriggerFootSplash(CVector& vecPosition)
call dwFunc
}
}

bool CFxSA::IsShadowsLimitReached()
{
constexpr int shadowsLimit = 48;
return CShadows_ShadowsStoredToBeRendered >= shadowsLimit;
}

bool CFxSA::AddShadow(eShadowTextureType shadowTextureType, const CVector& vecPosition, const CVector2D& vecOffset1, const CVector2D& vecOffset2, SColor color, eShadowType shadowType, float fZDistance,
bool bDrawOnWater, bool bDrawOnBuildings)
{
if (IsShadowsLimitReached())
return false;

void* textureAddress = *(void**)(SHADOW_BASE_TEXTURE_OFFSET + (int)shadowTextureType * 4);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what will happen if you try eShadowTextureType::PLANE = -1. Also, you could probably just use pointer arithmetic on RwTexture** and avoid this funky pointer madness.

RwTexture* pRwTexture = reinterpret_cast<RwTexture*>(textureAddress);


return StoreShadowToBeRendered(shadowType, pRwTexture, &vecPosition, vecOffset1.fX, vecOffset1.fY, vecOffset2.fX, vecOffset2.fY, color.A, color.R, color.G, color.B, fZDistance, bDrawOnWater, 1, 0, bDrawOnBuildings);
}
4 changes: 4 additions & 0 deletions Client/game_sa/CFxSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct RwColor;
#define FUNC_CFx_TriggerWaterSplash 0x4a1070
#define FUNC_CFx_TriggerBulletSplash 0x4a10e0
#define FUNC_CFx_TriggerFootSplash 0x4a1150
constexpr auto SHADOW_BASE_TEXTURE_OFFSET = 0xC403E0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This points to struct RwTexture * gpShadowCarTex, but the other shadow textures are fortunately linearly right after this one.


class CFxSAInterface
{
Expand All @@ -49,13 +50,16 @@ class CFxSA : public CFx
void AddPunchImpact(CVector& vecPosition, CVector& vecDirection, int);
void AddDebris(CVector& vecPosition, RwColor& rwColor, float fScale, int iCount);
void AddGlass(CVector& vecPosition, RwColor& rwColor, float fScale, int iCount);
bool AddShadow(eShadowTextureType shadowTextureType, const CVector& vecPosition, const CVector2D& vecOffset1, const CVector2D& vecOffset2, SColor color,
eShadowType shadowType, float fZDistance, bool bDrawOnWater, bool bDrawOnBuildings);
void TriggerWaterHydrant(CVector& vecPosition);
void TriggerGunshot(CEntity* pEntity, CVector& vecPosition, CVector& vecDirection, bool bIncludeSparks);
void TriggerTankFire(CVector& vecPosition, CVector& vecDirection);
void TriggerWaterSplash(CVector& vecPosition);
void TriggerBulletSplash(CVector& vecPosition);
void TriggerFootSplash(CVector& vecPosition);

static bool IsShadowsLimitReached();
private:
CFxSAInterface* m_pInterface;
};
7 changes: 7 additions & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7867,6 +7867,13 @@ bool CStaticFunctionDefinitions::FxAddFootSplash(CVector& vecPosition)
return true;
}

bool CStaticFunctionDefinitions::FxAddShadow(eShadowTextureType shadowTextureType, const CVector& vecPosition, const CVector2D& vecOffset1,
const CVector2D& vecOffset2, SColor color, eShadowType shadowType, float fZDistance, bool bDrawOnWater,
bool bDrawOnBuildings)
{
return g_pGame->GetFx()->AddShadow(shadowTextureType, vecPosition, vecOffset1, vecOffset2, color, shadowType, fZDistance, bDrawOnWater, bDrawOnBuildings);
}

CClientEffect* CStaticFunctionDefinitions::CreateEffect(CResource& Resource, const SString& strFxName, const CVector& vecPosition, bool bSoundEnable)
{
CClientEffect* pFx = m_pManager->GetEffectManager()->Create(strFxName, vecPosition, INVALID_ELEMENT_ID, bSoundEnable);
Expand Down
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@ class CStaticFunctionDefinitions
static bool FxAddWaterSplash(CVector& vecPosition);
static bool FxAddBulletSplash(CVector& vecPosition);
static bool FxAddFootSplash(CVector& vecPosition);
static bool FxAddShadow(eShadowTextureType shadowTextureType, const CVector& vecPosition, const CVector2D& vecOffset1, const CVector2D& vecOffset2,
SColor color, eShadowType shadowType, float fZDistance, bool bDrawOnWater, bool bDrawOnBuildings);
static CClientEffect* CreateEffect(CResource& Resource, const SString& strFxName, const CVector& vecPosition, bool bSoundEnable);

// Sound funcs
Expand Down
21 changes: 21 additions & 0 deletions Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,27 @@ ADD_ENUM(_D3DFORMAT::D3DFMT_G32R32F, "g32r32f")
ADD_ENUM(_D3DFORMAT::D3DFMT_A32B32G32R32F, "a32b32g32r32f")
IMPLEMENT_ENUM_CLASS_END("surface-format")

IMPLEMENT_ENUM_CLASS_BEGIN(eShadowTextureType)
ADD_ENUM(eShadowTextureType::PLANE, "plane")
ADD_ENUM(eShadowTextureType::CAR, "car")
ADD_ENUM(eShadowTextureType::PED, "ped")
ADD_ENUM(eShadowTextureType::HELI, "heli")
ADD_ENUM(eShadowTextureType::BIKE, "bike")
ADD_ENUM(eShadowTextureType::RCBARON, "rcbaron")
ADD_ENUM(eShadowTextureType::EXPLOSION, "explosion")
ADD_ENUM(eShadowTextureType::HEADLIGHT1, "headlight1")
ADD_ENUM(eShadowTextureType::HEADLIGHT2, "headlight2")
ADD_ENUM(eShadowTextureType::BLOOD, "blood")
ADD_ENUM(eShadowTextureType::HANDMAN, "handman")
ADD_ENUM(eShadowTextureType::WINCRACK, "wincrack")
ADD_ENUM(eShadowTextureType::LAMP, "lamp")
IMPLEMENT_ENUM_CLASS_END("shadow-texture-type")

IMPLEMENT_ENUM_CLASS_BEGIN(eShadowType)
ADD_ENUM(eShadowType::DEFAULT, "default")
ADD_ENUM(eShadowType::ADDITIVE, "additive")
ADD_ENUM(eShadowType::INVCOLOR, "invcolor")
IMPLEMENT_ENUM_CLASS_END("shadow-type")
//
// CResource from userdata
//
Expand Down
10 changes: 10 additions & 0 deletions Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ DECLARE_ENUM_CLASS(eSoundEffectParams::ParamEq);
DECLARE_ENUM_CLASS(eSoundEffectParams::Reverb);
DECLARE_ENUM_CLASS(eModelIdeFlag);
DECLARE_ENUM_CLASS(_D3DFORMAT);
DECLARE_ENUM_CLASS(eShadowTextureType);
DECLARE_ENUM_CLASS(eShadowType);

class CRemoteCall;

Expand Down Expand Up @@ -490,6 +492,14 @@ inline SString GetClassTypeName(eSoundEffectParams::Reverb*)
{
return "soundeffect-params-reverb";
}
inline SString GetClassTypeName(eShadowTextureType*)
{
return "shadow-texture-type";
}
inline SString GetClassTypeName(eShadowType*)
{
return "shadow-type";
}

inline SString GetClassTypeName(CClientVectorGraphic*)
{
Expand Down
22 changes: 22 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaEffectDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@
*****************************************************************************/

#include "StdInc.h"
#include "lua/CLuaFunctionParser.h"

bool FxAddShadow(eShadowTextureType shadowTextureType, CVector vecPosition, CVector2D vecOffset1, CVector2D vecOffset2, SColor color, eShadowType shadowType, float zDistance,
bool bDrawOnWater, bool bDrawOnBuildings)
{
if (vecOffset1.Length() > 32)
{
throw std::invalid_argument("First offset can not be longer than 32 units");
}
else if (vecOffset2.Length() > 32) // bigger and close to limit shadows size can be partially invisible
{
throw std::invalid_argument("Second offset can not be longer than 32 units");
}
else if (zDistance < 0 || zDistance > 3000) // negative distance not working
{
throw std::invalid_argument("Z Distance must be between 0.0 and 3000.0");
}
return CStaticFunctionDefinitions::FxAddShadow(shadowTextureType, vecPosition, vecOffset1, vecOffset2, color, shadowType, zDistance, bDrawOnWater,
bDrawOnBuildings);

}

void CLuaEffectDefs::LoadFunctions()
{
Expand All @@ -28,6 +49,7 @@ void CLuaEffectDefs::LoadFunctions()
{"fxAddWaterSplash", fxAddWaterSplash},
{"fxAddBulletSplash", fxAddBulletSplash},
{"fxAddFootSplash", fxAddFootSplash},
{"fxAddShadow", ArgumentParser<FxAddShadow>},
{"createEffect", CreateEffect},
{"setEffectSpeed", SetEffectSpeed},
{"getEffectSpeed", GetEffectSpeed},
Expand Down
2 changes: 2 additions & 0 deletions Client/sdk/game/CFx.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class CFx
virtual void AddPunchImpact(CVector& vecPosition, CVector& vecDirection, int i) = 0;
virtual void AddDebris(CVector& vecPosition, RwColor& rwColor, float fScale, int iCount) = 0;
virtual void AddGlass(CVector& vecPosition, RwColor& rwColor, float fScale, int iCount) = 0;
virtual bool AddShadow(eShadowTextureType shadowTextureType, const CVector& vecPosition, const CVector2D& vecOffset1, const CVector2D& vecOffset2, SColor color, eShadowType shadowType,
float fZDistance, bool bDrawOnWater, bool bDrawOnBuildings) = 0;
virtual void TriggerWaterHydrant(CVector& vecPosition) = 0;
virtual void TriggerGunshot(CEntity* pEntity, CVector& vecPosition, CVector& vecDirection, bool bIncludeSparks) = 0;
virtual void TriggerTankFire(CVector& vecPosition, CVector& vecDirection) = 0;
Expand Down
26 changes: 26 additions & 0 deletions Client/sdk/game/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,32 @@ enum eObjectProperty
OBJECT_PROPERTY_MAX,
};

enum class eShadowTextureType
{
// use only color instead of texture
PLANE = -1,
CAR,
PED,
HELI,
BIKE,
RCBARON,
EXPLOSION,
HEADLIGHT1,
HEADLIGHT2,
BLOOD,
HANDMAN,
WINCRACK,
LAMP,
};

enum class eShadowType
{
NONE,
DEFAULT,
ADDITIVE,
INVCOLOR,
};

namespace eObjectGroup
{
enum Modifiable
Expand Down