| 39028 | } |
| 39029 | |
| 39030 | void GenericGUIMenu::MailboxGui_t::updateMailMenu() |
| 39031 | { |
| 39032 | const int playernum = parentGUI.getPlayer(); |
| 39033 | auto player = players[playernum]; |
| 39034 | |
| 39035 | if ( !player->isLocalPlayer() ) |
| 39036 | { |
| 39037 | closeMailMenu(); |
| 39038 | return; |
| 39039 | } |
| 39040 | |
| 39041 | Entity* mailboxStation = nullptr; |
| 39042 | if ( bOpen ) |
| 39043 | { |
| 39044 | if ( parentGUI.mailboxEntityUid != 0 ) |
| 39045 | { |
| 39046 | mailboxStation = uidToEntity(parentGUI.mailboxEntityUid); |
| 39047 | if ( !mailboxStation ) |
| 39048 | { |
| 39049 | parentGUI.closeGUI(); |
| 39050 | return; |
| 39051 | } |
| 39052 | } |
| 39053 | |
| 39054 | if ( mailboxStation ) |
| 39055 | { |
| 39056 | if ( player->entity && (entityDist(player->entity, mailboxStation) > TOUCHRANGE) ) |
| 39057 | { |
| 39058 | parentGUI.closeGUI(); |
| 39059 | return; |
| 39060 | } |
| 39061 | } |
| 39062 | } |
| 39063 | |
| 39064 | if ( !mailFrame ) |
| 39065 | { |
| 39066 | return; |
| 39067 | } |
| 39068 | |
| 39069 | mailFrame->setSize(SDL_Rect{ players[playernum]->camera_virtualx1(), |
| 39070 | players[playernum]->camera_virtualy1(), |
| 39071 | mailBaseWidth, |
| 39072 | players[playernum]->camera_virtualHeight() }); |
| 39073 | |
| 39074 | if ( !mailFrame->isDisabled() && bOpen ) |
| 39075 | { |
| 39076 | if ( !mailGUIHasBeenCreated() ) |
| 39077 | { |
| 39078 | createMailMenu(); |
| 39079 | } |
| 39080 | |
| 39081 | const real_t fpsScale = getFPSScale(50.0); // ported from 50Hz |
| 39082 | real_t setpointDiffX = fpsScale * std::max(.01, (1.0 - animx)) / 2.0; |
| 39083 | animx += setpointDiffX; |
| 39084 | animx = std::min(1.0, animx); |
| 39085 | if ( animx >= .9999 ) |
| 39086 | { |
| 39087 | if ( !bFirstTimeSnapCursor ) |
no test coverage detected