Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Surface property editing functions #702

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
botder merged 12 commits into multitheftauto:master from CrosRoad95:Surface-Editing-Properties
Feb 14, 2019
Merged

Surface property editing functions #702

botder merged 12 commits into multitheftauto:master from CrosRoad95:Surface-Editing-Properties
Feb 14, 2019

Conversation

@CrosRoad95
Copy link

@CrosRoad95 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.

theSarrum, Citizen01, and MegaThorx reacted with thumbs up emoji
Copy link
Collaborator

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.

Copy link
Collaborator

Tested and everything works good.

@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
Copy link
Member

botder commented Jan 7, 2019

short sSize = sizeof(SurfaceInfo_c) * EColSurfaceValue::SIZE;

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

Choose a reason for hiding this comment

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

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


DWORD dwOriginalSurfaceInfo = (DWORD)(&m_pOriginalSurfaceInfo);

short sOffset = offsetof(CSurfaceType, CSurfaceType::surfType);
Copy link
Member

Choose a reason for hiding this comment

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

Use size_t instead of short

DWORD dwOriginalSurfaceInfo = (DWORD)(&m_pOriginalSurfaceInfo);

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

Choose a reason for hiding this comment

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

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);
Copy link
Member

Choose a reason for hiding this comment

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

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;
Copy link
Member

Choose a reason for hiding this comment

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

Use size_t instead of short

static bool SetFPSLimit(int iLimit);
static bool GetFPSLimit(int& iLimit);

static bool ResetAllSurfaceInfo(void);
Copy link
Member

Choose a reason for hiding this comment

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

Replace (void) with ()

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

Choose a reason for hiding this comment

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

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;
Copy link
Member

Choose a reason for hiding this comment

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

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);
Copy link
Member

Choose a reason for hiding this comment

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

if (argStream.HasErrors())
{
 m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
 lua_pushnil(luaVM);
}
else
 lua_pushboolean(luaVM, false);

}
if (argStream.HasErrors())
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
lua_pushboolean(luaVM, false);
Copy link
Member

Choose a reason for hiding this comment

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

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

Reviewers

@botder botder botder requested changes

+1 more reviewer

@qaisjp qaisjp qaisjp left review comments

Reviewers whose approvals may not affect merge requirements

Labels

enhancement New feature or request

Projects

None yet

Milestone

1.5.7

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /