From ff5127bd6362af909223fb530f1392e7741d3ad9 Mon Sep 17 00:00:00 2001 From: Tom White Date: Thu, 14 Aug 2008 23:09:39 +0100 Subject: Fix references to 'primitives' which should be 'coll_primitives', etc --- src/physics.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/physics.c b/src/physics.c index 38f41b6..af1e9a6 100644 --- a/src/physics.c +++ b/src/physics.c @@ -133,22 +133,22 @@ static int physics_check_collide_all_faces(ModelInstance *obj, ModelInstance *ot int found = 0; - switch ( other->model->primitives[a]->type ) { + switch ( other->model->coll_primitives[a]->type ) { case PRIMITIVE_QUADS : { /* Faces are quads */ int f; - - for ( f=0; fmodel->primitives[a]->num_vertices/4; f++ ) { + + for ( f=0; fmodel->coll_primitives[a]->num_vertices/4; f++ ) { double face[3*4]; int q; double ttc; - const double nx = other->model->primitives[a]->normals[3*(4*f)+0]; - const double ny = other->model->primitives[a]->normals[3*(4*f)+1]; - const double nz = other->model->primitives[a]->normals[3*(4*f)+2]; + const double nx = other->model->coll_primitives[a]->normals[3*(4*f)+0]; + const double ny = other->model->coll_primitives[a]->normals[3*(4*f)+1]; + const double nz = other->model->coll_primitives[a]->normals[3*(4*f)+2]; /* Skip if moving from the back to the front of this quad */ if ( nx*obj->vx + ny*obj->vy + nz*obj->vz > 0.0 ) continue; @@ -157,9 +157,9 @@ static int physics_check_collide_all_faces(ModelInstance *obj, ModelInstance *ot const double ox = other->x; const double oy = other->y; const double oz = other->z; - face[3*q + 0] = ox + other->model->primitives[a]->vertices[3*((4*f)+q) + 0]; - face[3*q + 1] = oy + other->model->primitives[a]->vertices[3*((4*f)+q) + 1]; - face[3*q + 2] = oz + other->model->primitives[a]->vertices[3*((4*f)+q) + 2]; + face[3*q + 0] = ox + other->model->coll_primitives[a]->vertices[3*((4*f)+q) +0]; + face[3*q + 1] = oy + other->model->coll_primitives[a]->vertices[3*((4*f)+q) +1]; + face[3*q + 2] = oz + other->model->coll_primitives[a]->vertices[3*((4*f)+q) +2]; face[3*q + 0] += 10.0*(room->rx - game->cur_room_x); face[3*q + 1] += 10.0*(room->ry - game->cur_room_y); face[3*q + 2] += 10.0*(room->rz - game->cur_room_z); @@ -218,7 +218,7 @@ static int physics_check_collide(ModelInstance *obj, ModelInstance *other, doubl const double sz = obj->model->coll_primitives[i]->vertices[3*j+2]; /* ...against all primitives in the static object */ - for ( a=0; amodel->num_primitives; a++ ) { + for ( a=0; amodel->num_coll_primitives; a++ ) { if ( physics_check_collide_all_faces(obj, other, dt, a, sx, sy, sz, coll, room, game) ) { found = 1; @@ -471,6 +471,5 @@ void physics_step(Game *game, int dt) { game->time_physics = us + sec*1e6; - } -- cgit v1.2.3