| 1112 | } |
| 1113 | |
| 1114 | void zNPCTiki::FindParents(zScene* zsc) |
| 1115 | { |
| 1116 | xCollis c = { 0b100000000, |
| 1117 | 0, |
| 1118 | NULL, |
| 1119 | NULL, |
| 1120 | 0.0f, |
| 1121 | { 0.0f, 0.0f, 0.0f }, |
| 1122 | { 0.0f, 0.0f, 0.0f }, |
| 1123 | { 0.0f, 0.0f, 0.0f }, |
| 1124 | { 0.0f, 0.0f, 0.0f }, |
| 1125 | { 0.0f, 0.0f, 0.0f } }; |
| 1126 | xRay3 ray; |
| 1127 | xVec3Copy(&ray.origin, (xVec3*)&this->model->Mat->pos); |
| 1128 | ray.origin.y = this->bound.box.box.upper.y; |
| 1129 | |
| 1130 | ray.dir.x = 0.0f; |
| 1131 | ray.dir.y = -1.0f; |
| 1132 | ray.dir.z = 0.0f; |
| 1133 | ray.max_t = 300.0f; |
| 1134 | ray.min_t = 0.0f; |
| 1135 | ray.flags = 0xc00; |
| 1136 | |
| 1137 | this->tikiFlag &= ~0x2; |
| 1138 | xRayHitsTikiLandableScene(globals.sceneCur, &ray, &c); |
| 1139 | |
| 1140 | if ((c.flags & 1) != 0) |
| 1141 | { |
| 1142 | if (c.optr != NULL) |
| 1143 | { |
| 1144 | this->nonTikiParent = (xEnt*)c.optr; |
| 1145 | xVec3 temp; |
| 1146 | xVec3Sub(&temp, &ray.origin, (xVec3*)&((xEnt*)c.optr)->model->Mat->pos); |
| 1147 | temp.y -= c.dist; |
| 1148 | |
| 1149 | if (zGooIs(this->nonTikiParent)) |
| 1150 | this->tikiFlag |= 2; |
| 1151 | |
| 1152 | xSurface* surf = zSurfaceGetSurface(&c); |
| 1153 | if (surf != NULL && surf->state == 0 && surf->moprops != NULL) |
| 1154 | { |
| 1155 | zSurfaceProps* prop = ((zSurfaceProps**)surf->moprops)[0]; |
| 1156 | if (prop != NULL && *(U8*)&prop->texanim[0].mode != 0) |
| 1157 | { |
| 1158 | this->tikiFlag |= 2; |
| 1159 | } |
| 1160 | } |
| 1161 | |
| 1162 | this->nonTikiParentDisp.x = |
| 1163 | xVec3Dot(&temp, (xVec3*)&this->nonTikiParent->model->Mat->right); |
| 1164 | this->nonTikiParentDisp.y = |
| 1165 | xVec3Dot(&temp, (xVec3*)&this->nonTikiParent->model->Mat->up); |
| 1166 | this->nonTikiParentDisp.z = |
| 1167 | xVec3Dot(&temp, (xVec3*)&this->nonTikiParent->model->Mat->at); |
| 1168 | |
| 1169 | F32 mag2 = xVec3Length2((xVec3*)&this->nonTikiParent->model->Mat->right); |
| 1170 | if (mag2 > 0.00001f) |
| 1171 | { |
no test coverage detected