| 3688 | //==================================== |
| 3689 | |
| 3690 | void TCSSButtonCallback(int efxnum) { |
| 3691 | if (!TCEffects[efxnum].has_focus) { |
| 3692 | // make sure we have focus...be careful, because by setting focus |
| 3693 | // the call is going to come back into this function |
| 3694 | TelComSetFocusOnEffect(efxnum); |
| 3695 | return; |
| 3696 | } |
| 3697 | |
| 3698 | int selected_id = -1; |
| 3699 | |
| 3700 | // which ship id are we talking about? |
| 3701 | for (int i = 0; i < MAX_NUM_SHIPS; i++) { |
| 3702 | if (SSShips[i].found && SSShips[i].efxnum == efxnum) { |
| 3703 | // this is the id; |
| 3704 | selected_id = i; |
| 3705 | break; |
| 3706 | } |
| 3707 | } |
| 3708 | |
| 3709 | if (selected_id == -1) { |
| 3710 | mprintf(0, "Invalid selected id for efxnum %d\n", efxnum); |
| 3711 | return; |
| 3712 | } |
| 3713 | |
| 3714 | bool first_click = false; |
| 3715 | |
| 3716 | if (TCShipSelect.CurrentSelectID == -1) |
| 3717 | first_click = true; |
| 3718 | |
| 3719 | if (TCShipSelect.CurrentSelectID == selected_id) { |
| 3720 | // not a change |
| 3721 | return; |
| 3722 | } |
| 3723 | |
| 3724 | TCShipSelect.CurrentSelectID = selected_id; |
| 3725 | |
| 3726 | // PUT CODE TO HANDLE NEW SHIP BEING SELECTED HERE |
| 3727 | float size; |
| 3728 | TCShipSelect.ship_model = Ships[SSShips[selected_id].ship_index].model_handle; |
| 3729 | if (TCShipSelect.ship_model == -1) { |
| 3730 | mprintf(0, "ship_model is -1\n"); |
| 3731 | Int3(); |
| 3732 | } |
| 3733 | |
| 3734 | PageInPolymodel(TCShipSelect.ship_model, OBJ_PLAYER, &size); |
| 3735 | poly_model *pm = GetPolymodelPointer(TCShipSelect.ship_model); |
| 3736 | TCShipSelect.cam_dist = pm->anim_size / Render_zoom + 6; |
| 3737 | |
| 3738 | TelcomStopSound(TCSND_CLICK); |
| 3739 | if (!first_click) |
| 3740 | TelcomStartSound(TCSND_CLICK); |
| 3741 | } |
| 3742 | |
| 3743 | void TCSSSCallback(void) { |
| 3744 | if (TCShipSelect.ship_model == -1) { |
no test coverage detected