Skip to content

Conversation

StrixG
Copy link
Contributor

@StrixG StrixG commented Jan 18, 2020

  • Radius (circle, sphere, tube)
float getColShapeRadius(colshape colShape)
bool setColShapeRadius(colshape colShape, float radius)
  • Size

Tube (height)

float getColShapeSize(colshape colShape)
bool setColShapeSize(colshape colShape, float size)

Rectangle (width, height)

float, float getColShapeSize(colshape colShape)
bool setColShapeSize(colshape colShape, Vector2 size)
bool setColShapeSize(colshape colShape, float width, float height)

Cuboid (width, depth, height)

float, float, flaot getColShapeSize(colshape colShape)
bool setColShapeSize(colshape colShape, Vector3 size)
bool setColShapeSize(colshape colShape, float width, float depth, float height)
  • Polygon points
table getColPolygonPoints(colshape colPolygon)
Vector2 getColPolygonPointPosition(colshape colPolygon, int pointIndex)
bool setColPolygonPointPosition(colshape colPolygon, int pointIndex, Vector2 position)
bool addColPolygonPoint(colshape colPolygon, Vector2 position[, int pointIndex])
bool removeColPolygonPoint(colshape colPolygon, int pointIndex)

@CrosRoad95
Copy link

you should also add heigth for polygons, #226

@StrixG
Copy link
Contributor Author

StrixG commented Jan 20, 2020

Should I leave one setColShapeSize function or make three different functions to change parameters separately (setColShapeWidth, setColShapeHeight, setColShapeDepth)?

@PlatinMTA
Copy link
Contributor

Should I leave one setColShapeSize function or make three different functions to change parameters separately (setColShapeWidth, setColShapeHeight, setColShapeDepth)?

I think setColShapeSize is alright, having to many functions just to change the size of the colshape would be confusing/annoying tbh. If the function adapts to the type of colshape it's changing that's all we need i think

@StrixG StrixG force-pushed the colshapes-functions branch from 614eec4 to 1dcac37 Compare January 20, 2020 11:10
@StrixG StrixG force-pushed the colshapes-functions branch from 1dcac37 to 3dbdd65 Compare January 20, 2020 12:46
@StrixG StrixG marked this pull request as ready for review January 22, 2020 09:35
@StrixG
Copy link
Contributor Author

StrixG commented Jan 22, 2020

I'm not sure if I should use the sync time context here or not.

@StrixG StrixG requested a review from qaisjp January 22, 2020 17:38
@qaisjp
Copy link
Contributor

qaisjp commented Jan 22, 2020

The code looks good to me.

I'm not sure if I should use the sync time context here or not.

I'm not sure either. Let's figure it out together.

I found this (introduced in initial commit):

// This is used for realtime synced elements. Whenever a position/rotation change is
// forced from the server either in form of spawn or setElementPosition/rotation a new
// value is assigned to this from the server. This value also comes with the sync packets.
// If this value doesn't match the value from the sync packet, the packet should be
// ignored. Note that if this value is 0, all sync packets should be accepted. This is
// so we don't need this byte when the element is created first.

Markers don't use a sync time context, so I'd guess that colshapes wouldn't need them either. What do you think?

@StrixG StrixG requested a review from qaisjp January 28, 2020 15:18
@qaisjp
Copy link
Contributor

qaisjp commented Jan 29, 2020

have you tested the latest version?

Copy link
Contributor

@qaisjp qaisjp left a comment

Choose a reason for hiding this comment

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

I'm overall happy with this and can merge once comments have been addressed.

I don't have time to test, but I'm confident in your work, so I'll merge once you've confirmed you've tested the latest version

@StrixG StrixG force-pushed the colshapes-functions branch from 6c8f89d to a8349a9 Compare January 30, 2020 16:33
This reverts commit a8349a9.

Annoying and it looks disgusting, yes, but it's unfortunately what
clang-format wants :/
@StrixG
Copy link
Contributor Author

StrixG commented Jan 30, 2020

These functions also allow you to edit colshapes of markers and pickups. Should I leave this opportunity?

Everything tested. Works good.

@qaisjp
Copy link
Contributor

qaisjp commented Jan 30, 2020

These functions also allow you to edit colshapes of markers and pickups.

That's funky. Let's leave it in!

@qaisjp qaisjp merged commit 19eb2e6 into multitheftauto:master Jan 30, 2020
@qaisjp qaisjp added this to the 1.6 milestone Jan 30, 2020
@StrixG StrixG deleted the colshapes-functions branch January 30, 2020 22:38
@Dutchman101
Copy link
Member

Dutchman101 commented Feb 28, 2020

Warning C4018 '>=': signed/unsigned mismatch \mtasa-blue\Client\mods\deathmatch\logic\CClientColPolygon.cpp:80
Warning C4018 '>=': signed/unsigned mismatch\ mtasa-blue\Server\mods\deathmatch\logic\CColPolygon.cpp:96

@StrixG the point index should be unsigned int.. why would you use int? This adds new warnings to our list

@StrixG
Copy link
Contributor Author

StrixG commented Feb 28, 2020

I use -1 as default value to add a point to the end of the list. I should have used static_cast on line 80.

StrixG added a commit to StrixG/mtasa-blue that referenced this pull request Mar 10, 2020
ghost pushed a commit that referenced this pull request Mar 12, 2020
* Fix warnings introduced in #1215

* Change to else if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants