MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / PlayerChangeShip

Function PlayerChangeShip

Descent3/Player.cpp:3444–3486  ·  view source on GitHub ↗

Changes the ship a particular player is flying

Source from the content-addressed store, hash-verified

3442
3443// Changes the ship a particular player is flying
3444void PlayerChangeShip(int slot, int ship_index) {
3445 ship *ship;
3446
3447 if (Players[slot].start_roomnum == -1)
3448 return; // this player doesn't exist
3449
3450 object *objp = &Objects[Players[slot].objnum];
3451
3452 ship = &Ships[ship_index];
3453
3454 if (!ship->used) { // this ship doesn't exist
3455 Int3();
3456 ship_index = GetNextShip(0);
3457 ASSERT(ship_index != -1);
3458 ship = &Ships[ship_index];
3459 }
3460
3461 // Set size & shields
3462 objp->size = ship->size;
3463 objp->mtype.phys_info = ship->phys_info;
3464
3465 // Set up render info, but save render type first
3466 int save_rt = objp->render_type;
3467 ObjSetRenderPolyobj(objp, ship->model_handle, ship->dying_model_handle);
3468 objp->render_type = save_rt;
3469
3470 objp->rtype.pobj_info.model_num = ship->model_handle;
3471 objp->rtype.pobj_info.dying_model_num = ship->dying_model_handle;
3472 PageInPolymodel(ship->model_handle);
3473 if (ship->dying_model_handle != -1)
3474 PageInPolymodel(ship->dying_model_handle);
3475
3476 if (ship->lo_render_handle >= 0)
3477 PageInPolymodel(ship->lo_render_handle);
3478 if (ship->med_render_handle >= 0)
3479 PageInPolymodel(ship->med_render_handle);
3480
3481 ComputeDefaultSize(OBJ_PLAYER, objp->rtype.pobj_info.model_num, &objp->size);
3482
3483 WBClearInfo(objp);
3484
3485 Players[slot].ship_index = ship_index;
3486}
3487
3488// Sets the FOV range at which the hud names will come on
3489void PlayerSetHUDNameFOV(int fov) {

Callers 7

StartLevelFunction · 0.85
MultiDoMyInfoFunction · 0.85
MultiDoPlayerFunction · 0.85
MultiDoPlayerEnteredGameFunction · 0.85
MultiDoBashPlayerShipFunction · 0.85
ChangePlayerShipIndexFunction · 0.85
MultiDoReadyForLevelFunction · 0.85

Calls 5

GetNextShipFunction · 0.85
ObjSetRenderPolyobjFunction · 0.85
PageInPolymodelFunction · 0.85
ComputeDefaultSizeFunction · 0.85
WBClearInfoFunction · 0.70

Tested by

no test coverage detected