| 1276 | } |
| 1277 | |
| 1278 | void zSceneSwitch(_zPortal* p, S32 forceSameScene) |
| 1279 | { |
| 1280 | globals.sceneCur->pendingPortal = p; |
| 1281 | |
| 1282 | xPortalAsset* passet = globals.sceneCur->pendingPortal->passet; |
| 1283 | |
| 1284 | gLevelChanged = (zSceneLeavingLevel() != 0); |
| 1285 | |
| 1286 | if (((char*)&passet->sceneID)[3] < '0' || ((char*)&passet->sceneID)[3] > '9') |
| 1287 | { |
| 1288 | char* id = (char*)&passet->sceneID; |
| 1289 | HackSwapIt(id, 4); |
| 1290 | } |
| 1291 | |
| 1292 | U32 nextSceneID = (((char*)&passet->sceneID)[0] << 24) | (((char*)&passet->sceneID)[1] << 16) | |
| 1293 | (((char*)&passet->sceneID)[2] << 8) | ((char*)&passet->sceneID)[3]; |
| 1294 | |
| 1295 | if (!forceSameScene && nextSceneID == globals.sceneCur->sceneID) |
| 1296 | { |
| 1297 | U32 PlayerMarkerStartID = passet->assetMarkerID; |
| 1298 | U32 PlayerMarkerStartCamID = passet->assetCameraID; |
| 1299 | F32 PlayerStartAngle = passet->ang; |
| 1300 | |
| 1301 | if (zSceneFindObject(PlayerMarkerStartCamID)) |
| 1302 | { |
| 1303 | globals.player.cp.initCamID = PlayerMarkerStartCamID; |
| 1304 | } |
| 1305 | |
| 1306 | if (PlayerStartAngle >= 1000.0f) |
| 1307 | { |
| 1308 | xMarkerAsset* marker = (xMarkerAsset*)xSTFindAsset(PlayerMarkerStartID, NULL); |
| 1309 | |
| 1310 | if (marker) |
| 1311 | { |
| 1312 | xEnt& player = globals.player.ent; |
| 1313 | xVec3& loc = (xVec3&)player.model->Mat->pos; |
| 1314 | |
| 1315 | xVec3 offset = marker->pos - loc; |
| 1316 | |
| 1317 | loc = player.frame->mat.pos = marker->pos; |
| 1318 | |
| 1319 | xCameraMove(&globals.camera, globals.camera.mat.pos + offset); |
| 1320 | } |
| 1321 | } |
| 1322 | else |
| 1323 | { |
| 1324 | U32 size; |
| 1325 | xMarkerAsset* m = (xMarkerAsset*)xSTFindAsset(PlayerMarkerStartID, &size); |
| 1326 | |
| 1327 | if (m) |
| 1328 | { |
| 1329 | xVec3Copy(&globals.player.ent.frame->mat.pos, &m->pos); |
| 1330 | xVec3Copy((xVec3*)&globals.player.ent.model->Mat->pos, &m->pos); |
| 1331 | |
| 1332 | xCameraSetTargetMatrix(&globals.camera, xEntGetFrame(&globals.player.ent)); |
| 1333 | } |
| 1334 | |
| 1335 | xEntFrame* frame = globals.player.ent.frame; |
no test coverage detected