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

Surface property editing functions #702

Open
wants to merge 12 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@CrosRoad95
Copy link
Collaborator

CrosRoad95 commented Nov 12, 2018

This pr introducing functions that allow to manipulate surface properties.

Properties are resetting after connect/reconnect to ther server.
There are 2 disabled properties createobjects and createplants for future, or i can just remove this code.

Functions

bool engineSetSurfaceProperties( surfaceID, property, value )
mixed engineGetSurfaceProperties( surfaceID, property )
bool engineResetSurfaceProperties( [ surfaceID ] ) -- by default reset all properties

Properties and values

Property name Accepted values Effect Picture
glass boolean unknown, i think should be true for all glass surfaces -
stairs boolean unknown, i think should be true for all stairs surfaces -
pavement boolean unknown, i think should be true for all pavement surfaces -
stepwatersplash boolean water effect while step image
softlanding boolean propably make landing cause less damage -
steepslope boolean make you can't climb up / go up -
footeffect boolean create prints of boots on ground image
canclimb boolean make ped can or not jump on obstacle. -
seethrough boolean connected with processLineOfSight function. -
shootthrough boolean combined with seethrough allow to shot through surfaces, objects. Some fences has this ability -
audio "concrete", "grass", "sand", "gravel", "wood", "water", "metal" change noise while walking -
bulleteffect "metal", "concrete", "sand", "wood", "disabled" change effect when weapon hit image
tyregrip integer 0 - 255 change tyre grip -
wetgrip integer 0 - 255 change tyre grip while rain -
adhesiongroup "rubber", "hard", "road", "loose", "sand", "wet" change tyre grip between various surfaces. If both surfaces ( vehicle tyre and ground ) are set to "rubber", make vehicle rarely create skid marks and vehicle don't slip -
roughness integer 0 - 3 unknown -
fractioneffect integer 0 - 7 unknown, probable make wheels vibrating on rail track -
wheeleffect "grass", "gravel", "mud", "sand", "dust", "disabled" particles appearing while driving image
skidmarktype "asphalt", "dirt", "dust", "disabled" change mark while after sudden braking image

Test resource

Download

Gui

At left are valid values, at right current value.
image

Usage

Arrows up and down navigate over menu.
Press z to show/hide cursor, click over surface to select them.
Command /set value set value of selected property
Type /reset to reset selected surface values to default.

@ArranTuna

This comment has been minimized.

Copy link
Collaborator

ArranTuna commented Nov 12, 2018

Just some possibly useful info: I was running around with that skin that has rollerblades and on a grass object I was running slower, so I guess that is one of the effects one of those surface properties has, maybe it's what the unknown roughness effects.

@CrosRoad95 CrosRoad95 requested a review from botder Nov 12, 2018

@ArranTuna

This comment has been minimized.

Copy link
Collaborator

ArranTuna commented Dec 7, 2018

Tested and everything works good.

@ArranTuna ArranTuna added the tested label Dec 7, 2018

@qaisjp qaisjp removed the tested label Dec 8, 2018

@patrikjuvonen patrikjuvonen changed the title Feature: editing surface properties. Feature: editing surface properties Dec 8, 2018

@qaisjp qaisjp changed the title Feature: editing surface properties Surface property editing functions Dec 24, 2018

@botder botder self-assigned this Dec 26, 2018

qaisjp and others added some commits Jan 2, 2019

@botder

This comment has been minimized.

Copy link
Member

botder commented Jan 7, 2019

CrosRoad95 added some commits Jan 9, 2019

Show resolved Hide resolved Client/game_sa/CWorldSA.cpp Outdated
Show resolved Hide resolved Client/game_sa/CWorldSA.h Outdated
short sSize = sizeof(SurfaceInfo_c) * EColSurfaceValue::SIZE;

memcpy((void*)(dwSurfaceInfo + sOffset), (void*)(dwOriginalSurfaceInfo + sOffset), sSize);
return true;

This comment has been minimized.

@botder

botder Jan 12, 2019

Member

This function only returns true. Please change the function to return void.


DWORD dwOriginalSurfaceInfo = (DWORD)(&m_pOriginalSurfaceInfo);

short sOffset = offsetof(CSurfaceType, CSurfaceType::surfType);

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

Use size_t instead of short

DWORD dwOriginalSurfaceInfo = (DWORD)(&m_pOriginalSurfaceInfo);

short sOffset = offsetof(CSurfaceType, CSurfaceType::surfType);
short sSize = sizeof(SurfaceInfo_c) * EColSurfaceValue::SIZE;

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

Use size_t instead of short

DWORD dwOriginalSurfaceInfo = (DWORD)(&m_pOriginalSurfaceInfo);

short sOffset = offsetof(CSurfaceType, CSurfaceType::surfType) + sizeof(SurfaceInfo_c) * sSurfaceID;
short sSize = sizeof(SurfaceInfo_c);

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

Use size_t instead of short

DWORD dwSurfaceInfo = (DWORD)pSurfaceInfo;
DWORD dwOriginalSurfaceInfo = (DWORD)(&m_pOriginalSurfaceInfo);

short sOffset = offsetof(CSurfaceType, CSurfaceType::surfType) + sizeof(SurfaceInfo_c) * sSurfaceID;

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

Use size_t instead of short

@@ -629,6 +629,9 @@ class CStaticFunctionDefinitions
static bool SetFPSLimit(int iLimit);
static bool GetFPSLimit(int& iLimit);

static bool ResetAllSurfaceInfo(void);

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

Replace (void) with ()

}
lua_pushstring(luaVM, "disabled");
return 1;
break;

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

break; not required after return 1;. Remove it for the other case X:s too!

if (pSurface->m_bulletFx == 0)
{
lua_pushstring(luaVM, "disabled");
return 1;

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

Not required because you have a return 1; after the if-else.

if (argStream.HasErrors())
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());

lua_pushboolean(luaVM, true);

This comment has been minimized.

@botder

botder Jan 14, 2019

Member
if (argStream.HasErrors())
{
    m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
    lua_pushnil(luaVM);
}
else
    lua_pushboolean(luaVM, false);
Show resolved Hide resolved Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp
}
if (argStream.HasErrors())
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
lua_pushboolean(luaVM, false);

This comment has been minimized.

@botder

botder Jan 14, 2019

Member

Use lua_pushnil(luaVM); because the code above can only fail due to invalid input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment