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

Function TelComSingleShipSelect

Descent3/TelCom.cpp:3473–3632  ·  view source on GitHub ↗

This is the function called by TelCom to choose a ship

Source from the content-addressed store, hash-verified

3471
3472// This is the function called by TelCom to choose a ship
3473void TelComSingleShipSelect(tTelComInfo *tcs) {
3474 int found_ships = TCSSCollectInfo();
3475 if (found_ships < 2 || found_ships > 3) {
3476 // not supported
3477 mprintf(0, "Skipping Single Player Ship Selecting, %d ships found\n", found_ships);
3478
3479 int ship_index_to_use = 0;
3480 int bit = 0x01;
3481 bool found = true;
3482
3483 for (ship_index_to_use = 0; ship_index_to_use < MAX_SHIPS; ship_index_to_use++) {
3484 if (Players[Player_num].ship_permissions & bit) {
3485 found = true;
3486 break;
3487 }
3488 bit = bit << 1;
3489 }
3490
3491 if (!found) {
3492 bit = 0x01;
3493 for (ship_index_to_use = 0; ship_index_to_use < MAX_SHIPS; ship_index_to_use++) {
3494 if (Default_ship_permission & bit) {
3495 found = true;
3496 break;
3497 }
3498 bit = bit << 1;
3499 }
3500 }
3501
3502 Players[Player_num].ship_index = ship_index_to_use;
3503 return;
3504 }
3505
3506 bool done = false;
3507
3508 TCShipSelect.CurrentSelectID = -1;
3509 TCShipSelect.ship_model = -1;
3510 vm_MakeIdentity(&TCShipSelect.orient);
3511
3512 TelcomStartScreen(0);
3513
3514 // setup general background, plain color
3515 TCBKGDESC backg;
3516 backg.color = BACKGROUND_COLOR;
3517 backg.caps = TCBGD_COLOR;
3518 backg.type = TC_BACK_STATIC;
3519
3520 TCBMPDESC bmpdesc;
3521 bmpdesc.type = TC_BMP_STATIC;
3522 bmpdesc.flags = 0;
3523 bmpdesc.caps = TCBD_XY;
3524 bmpdesc.x = 0;
3525 bmpdesc.y = 0;
3526 strcpy(bmpdesc.filename, "SS Background.ogf");
3527 /*
3528 $$TABLE_GAMEFILE "SS Background.ogf"
3529 */
3530

Callers 1

TelComMainFunction · 0.85

Calls 15

TCSSCollectInfoFunction · 0.85
TelcomStartScreenFunction · 0.85
CreateBitmapEffectFunction · 0.85
CreateTextEffectFunction · 0.85
TCSSPutButtonsOnScreenFunction · 0.85
CreateBackgroundEffectFunction · 0.85
TelcomEndScreenFunction · 0.85
TelcomRenderSetScreenFunction · 0.85
TelcomRenderSetCallbackFunction · 0.85
TCSSButtonCallbackFunction · 0.85
TelComSetFocusOnEffectFunction · 0.85

Tested by

no test coverage detected