uPeppe / physics.inc

physics.inc - SA-MP library to simulate 2D and 3D physics (realistic movements, collisions, and more)
30 stars 19 forks source link

Adding streamer support #1

Closed souf92i closed 5 years ago

souf92i commented 9 years ago

Well, I browsed through the thread, and I saw some persons asked for a streamer support.

It uses a trick Y_Less told : each time a file is included, a macro is defined following this scheme : "inc_includename" (includename is obviously replaced by the name of the include). I checked this each time a function from a_objects is used (#if defined _inc_streamer) and I adapted the code whether the streamer was included AND the object is dynamic, the streamer was included but the object is NOT dynamic, or the streamer simply wasn't included.

It adds several callbacks :

OnD_ObjectCollideWithD_Object(object1, object2); // Due to max symbol name, I was forced to...well, you've seen it. Feel free to rename the callback, its name is very ugly. Fired each time a dynamic object collides with another dynamic object

OnDynamicObjectCollideWithObject(object1, object2); // Fired each time a dynamic object collides with a static object

OnObjectCollideWithDynamicObject(object1, object2); // Fired each time an object collides with a dynamic object 

PHY_OnDynamicObjectCollideWithWall(objectid, wallid); // Fired each time a dynamic object collides with a wall

PHY_OnDynamicObjectCollideWithCyl(objectid, cylinderid); // Fired each time a dynamic object collides with a cylinder

PHY_OnDynamicObjectCollideWithPlayer(objectid, playerid); // Fired each time a dynamic object collides with a player

PHY_OnDynamicObjectUpdate(objectid); // Fired each time the core timer loop have looped on a dynamic object contained in the iterator.

In order to make my small system working, the streamer must be included BEFORE physics.