summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_embryo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/edje/edje_embryo.c')
-rw-r--r--src/lib/edje/edje_embryo.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c
index a246499..f7eeab6 100644
--- a/src/lib/edje/edje_embryo.c
+++ b/src/lib/edje/edje_embryo.c
@@ -4197,32 +4197,36 @@ _edje_embryo_fn_physics_components_get(Embryo_Program *ep, Embryo_Cell *params,
4197static Embryo_Cell 4197static Embryo_Cell
4198_edje_embryo_fn_physics_impulse(Embryo_Program *ep, Embryo_Cell *params) 4198_edje_embryo_fn_physics_impulse(Embryo_Program *ep, Embryo_Cell *params)
4199{ 4199{
4200 if (!EPH_LOAD()) return 0;
4200 return _edje_embryo_fn_physics_components_set( 4201 return _edje_embryo_fn_physics_components_set(
4201 ep, params, ephysics_body_central_impulse_apply); 4202 ep, params, EPH_CALL(ephysics_body_central_impulse_apply));
4202} 4203}
4203 4204
4204/* physics_torque_impulse(part_id, Float:x, Float:y, Float:z) */ 4205/* physics_torque_impulse(part_id, Float:x, Float:y, Float:z) */
4205static Embryo_Cell 4206static Embryo_Cell
4206_edje_embryo_fn_physics_torque_impulse(Embryo_Program *ep, Embryo_Cell *params) 4207_edje_embryo_fn_physics_torque_impulse(Embryo_Program *ep, Embryo_Cell *params)
4207{ 4208{
4209 if (!EPH_LOAD()) return 0;
4208 return _edje_embryo_fn_physics_components_set( 4210 return _edje_embryo_fn_physics_components_set(
4209 ep, params, ephysics_body_torque_impulse_apply); 4211 ep, params, EPH_CALL(ephysics_body_torque_impulse_apply));
4210} 4212}
4211 4213
4212/* physics_force(part_id, Float:x, Float:y, Float:z) */ 4214/* physics_force(part_id, Float:x, Float:y, Float:z) */
4213static Embryo_Cell 4215static Embryo_Cell
4214_edje_embryo_fn_physics_force(Embryo_Program *ep, Embryo_Cell *params) 4216_edje_embryo_fn_physics_force(Embryo_Program *ep, Embryo_Cell *params)
4215{ 4217{
4218 if (!EPH_LOAD()) return 0;
4216 return _edje_embryo_fn_physics_components_set( 4219 return _edje_embryo_fn_physics_components_set(
4217 ep, params, ephysics_body_central_force_apply); 4220 ep, params, EPH_CALL(ephysics_body_central_force_apply));
4218} 4221}
4219 4222
4220/* physics_torque(part_id, Float:x, Float:y, Float:z) */ 4223/* physics_torque(part_id, Float:x, Float:y, Float:z) */
4221static Embryo_Cell 4224static Embryo_Cell
4222_edje_embryo_fn_physics_torque(Embryo_Program *ep, Embryo_Cell *params) 4225_edje_embryo_fn_physics_torque(Embryo_Program *ep, Embryo_Cell *params)
4223{ 4226{
4227 if (!EPH_LOAD()) return 0;
4224 return _edje_embryo_fn_physics_components_set( 4228 return _edje_embryo_fn_physics_components_set(
4225 ep, params, ephysics_body_torque_apply); 4229 ep, params, EPH_CALL(ephysics_body_torque_apply));
4226} 4230}
4227 4231
4228/* physics_clear_forces(part_id) */ 4232/* physics_clear_forces(part_id) */
@@ -4235,13 +4239,14 @@ _edje_embryo_fn_physics_clear_forces(Embryo_Program *ep, Embryo_Cell *params)
4235 4239
4236 CHKPARAM(1); 4240 CHKPARAM(1);
4237 4241
4242 if (!EPH_LOAD()) return 0;
4238 ed = embryo_program_data_get(ep); 4243 ed = embryo_program_data_get(ep);
4239 part_id = params[1]; 4244 part_id = params[1];
4240 if (part_id < 0) return 0; 4245 if (part_id < 0) return 0;
4241 4246
4242 rp = ed->table_parts[part_id % ed->table_parts_size]; 4247 rp = ed->table_parts[part_id % ed->table_parts_size];
4243 if ((rp) && (rp->body)) 4248 if ((rp) && (rp->body))
4244 ephysics_body_forces_clear(rp->body); 4249 EPH_CALL(ephysics_body_forces_clear)(rp->body);
4245 4250
4246 return 0; 4251 return 0;
4247} 4252}
@@ -4250,48 +4255,54 @@ _edje_embryo_fn_physics_clear_forces(Embryo_Program *ep, Embryo_Cell *params)
4250static Embryo_Cell 4255static Embryo_Cell
4251_edje_embryo_fn_physics_get_forces(Embryo_Program *ep, Embryo_Cell *params) 4256_edje_embryo_fn_physics_get_forces(Embryo_Program *ep, Embryo_Cell *params)
4252{ 4257{
4258 if (!EPH_LOAD()) return 0;
4253 return _edje_embryo_fn_physics_components_get( 4259 return _edje_embryo_fn_physics_components_get(
4254 ep, params, ephysics_body_forces_get); 4260 ep, params, EPH_CALL(ephysics_body_forces_get));
4255} 4261}
4256 4262
4257/* physics_get_torques(part_id, &Float:x, &Float:y, &Float:z) */ 4263/* physics_get_torques(part_id, &Float:x, &Float:y, &Float:z) */
4258static Embryo_Cell 4264static Embryo_Cell
4259_edje_embryo_fn_physics_get_torques(Embryo_Program *ep, Embryo_Cell *params) 4265_edje_embryo_fn_physics_get_torques(Embryo_Program *ep, Embryo_Cell *params)
4260{ 4266{
4267 if (!EPH_LOAD()) return 0;
4261 return _edje_embryo_fn_physics_components_get( 4268 return _edje_embryo_fn_physics_components_get(
4262 ep, params, ephysics_body_torques_get); 4269 ep, params, EPH_CALL(ephysics_body_torques_get));
4263} 4270}
4264 4271
4265/* physics_set_velocity(part_id, Float:x, Float:y, Float:z) */ 4272/* physics_set_velocity(part_id, Float:x, Float:y, Float:z) */
4266static Embryo_Cell 4273static Embryo_Cell
4267_edje_embryo_fn_physics_set_velocity(Embryo_Program *ep, Embryo_Cell *params) 4274_edje_embryo_fn_physics_set_velocity(Embryo_Program *ep, Embryo_Cell *params)
4268{ 4275{
4276 if (!EPH_LOAD()) return 0;
4269 return _edje_embryo_fn_physics_components_set( 4277 return _edje_embryo_fn_physics_components_set(
4270 ep, params, ephysics_body_linear_velocity_set); 4278 ep, params, EPH_CALL(ephysics_body_linear_velocity_set));
4271} 4279}
4272 4280
4273/* physics_get_velocity(part_id, &Float:x, &Float:y, &Float:z) */ 4281/* physics_get_velocity(part_id, &Float:x, &Float:y, &Float:z) */
4274static Embryo_Cell 4282static Embryo_Cell
4275_edje_embryo_fn_physics_get_velocity(Embryo_Program *ep, Embryo_Cell *params) 4283_edje_embryo_fn_physics_get_velocity(Embryo_Program *ep, Embryo_Cell *params)
4276{ 4284{
4285 if (!EPH_LOAD()) return 0;
4277 return _edje_embryo_fn_physics_components_get( 4286 return _edje_embryo_fn_physics_components_get(
4278 ep, params, ephysics_body_linear_velocity_get); 4287 ep, params, EPH_CALL(ephysics_body_linear_velocity_get));
4279} 4288}
4280 4289
4281/* physics_set_ang_velocity(part_id, Float:x, Float:y, Float:z) */ 4290/* physics_set_ang_velocity(part_id, Float:x, Float:y, Float:z) */
4282static Embryo_Cell 4291static Embryo_Cell
4283_edje_embryo_fn_physics_set_ang_velocity(Embryo_Program *ep, Embryo_Cell *params) 4292_edje_embryo_fn_physics_set_ang_velocity(Embryo_Program *ep, Embryo_Cell *params)
4284{ 4293{
4294 if (!EPH_LOAD()) return 0;
4285 return _edje_embryo_fn_physics_components_set( 4295 return _edje_embryo_fn_physics_components_set(
4286 ep, params, ephysics_body_angular_velocity_set); 4296 ep, params, EPH_CALL(ephysics_body_angular_velocity_set));
4287} 4297}
4288 4298
4289/* physics_get_ang_velocity(part_id, &Float:x, &Float:y, &Float:z) */ 4299/* physics_get_ang_velocity(part_id, &Float:x, &Float:y, &Float:z) */
4290static Embryo_Cell 4300static Embryo_Cell
4291_edje_embryo_fn_physics_get_ang_velocity(Embryo_Program *ep, Embryo_Cell *params) 4301_edje_embryo_fn_physics_get_ang_velocity(Embryo_Program *ep, Embryo_Cell *params)
4292{ 4302{
4303 if (!EPH_LOAD()) return 0;
4293 return _edje_embryo_fn_physics_components_get( 4304 return _edje_embryo_fn_physics_components_get(
4294 ep, params, ephysics_body_angular_velocity_get); 4305 ep, params, EPH_CALL(ephysics_body_angular_velocity_get));
4295} 4306}
4296 4307
4297/* physics_stop(part_id) */ 4308/* physics_stop(part_id) */
@@ -4304,13 +4315,14 @@ _edje_embryo_fn_physics_stop(Embryo_Program *ep, Embryo_Cell *params)
4304 4315
4305 CHKPARAM(1); 4316 CHKPARAM(1);
4306 4317
4318 if (!EPH_LOAD()) return 0;
4307 ed = embryo_program_data_get(ep); 4319 ed = embryo_program_data_get(ep);
4308 part_id = params[1]; 4320 part_id = params[1];
4309 if (part_id < 0) return 0; 4321 if (part_id < 0) return 0;
4310 4322
4311 rp = ed->table_parts[part_id % ed->table_parts_size]; 4323 rp = ed->table_parts[part_id % ed->table_parts_size];
4312 if ((rp) && (rp->body)) 4324 if ((rp) && (rp->body))
4313 ephysics_body_stop(rp->body); 4325 EPH_CALL(ephysics_body_stop)(rp->body);
4314 4326
4315 return 0; 4327 return 0;
4316} 4328}
@@ -4325,6 +4337,7 @@ _edje_embryo_fn_physics_set_rotation(Embryo_Program *ep, Embryo_Cell *params)
4325 4337
4326 CHKPARAM(5); 4338 CHKPARAM(5);
4327 4339
4340 if (!EPH_LOAD()) return 0;
4328 ed = embryo_program_data_get(ep); 4341 ed = embryo_program_data_get(ep);
4329 part_id = params[1]; 4342 part_id = params[1];
4330 if (part_id < 0) return 0; 4343 if (part_id < 0) return 0;
@@ -4340,9 +4353,9 @@ _edje_embryo_fn_physics_set_rotation(Embryo_Program *ep, Embryo_Cell *params)
4340 y = (double)EMBRYO_CELL_TO_FLOAT(params[4]); 4353 y = (double)EMBRYO_CELL_TO_FLOAT(params[4]);
4341 z = (double)EMBRYO_CELL_TO_FLOAT(params[5]); 4354 z = (double)EMBRYO_CELL_TO_FLOAT(params[5]);
4342 4355
4343 ephysics_quaternion_set(&quat, x, y, z, w); 4356 EPH_CALL(ephysics_quaternion_set)(&quat, x, y, z, w);
4344 ephysics_quaternion_normalize(&quat); 4357 EPH_CALL(ephysics_quaternion_normalize)(&quat);
4345 ephysics_body_rotation_set(rp->body, &quat); 4358 EPH_CALL(ephysics_body_rotation_set)(rp->body, &quat);
4346 } 4359 }
4347 4360
4348 return 0; 4361 return 0;
@@ -4358,6 +4371,7 @@ _edje_embryo_fn_physics_get_rotation(Embryo_Program *ep, Embryo_Cell *params)
4358 4371
4359 CHKPARAM(5); 4372 CHKPARAM(5);
4360 4373
4374 if (!EPH_LOAD()) return 0;
4361 ed = embryo_program_data_get(ep); 4375 ed = embryo_program_data_get(ep);
4362 part_id = params[1]; 4376 part_id = params[1];
4363 if (part_id < 0) return 0; 4377 if (part_id < 0) return 0;
@@ -4368,8 +4382,8 @@ _edje_embryo_fn_physics_get_rotation(Embryo_Program *ep, Embryo_Cell *params)
4368 EPhysics_Quaternion quat; 4382 EPhysics_Quaternion quat;
4369 double w, x, y, z; 4383 double w, x, y, z;
4370 4384
4371 ephysics_body_rotation_get(rp->body, &quat); 4385 EPH_CALL(ephysics_body_rotation_get)(rp->body, &quat);
4372 ephysics_quaternion_get(&quat, &x, &y, &z, &w); 4386 EPH_CALL(ephysics_quaternion_get)(&quat, &x, &y, &z, &w);
4373 4387
4374 SETFLOAT(w, params[2]); 4388 SETFLOAT(w, params[2]);
4375 SETFLOAT(x, params[3]); 4389 SETFLOAT(x, params[3]);