| 5919 | // |
| 5920 | |
| 5921 | static void playingLoop() { |
| 5922 | // start timing |
| 5923 | BzTime::setTick(); |
| 5924 | updateDaylight(epochOffset); |
| 5925 | |
| 5926 | worldDownLoader = new WorldDownLoader; |
| 5927 | |
| 5928 | // main loop |
| 5929 | while (!CommandsStandard::isQuit()) { |
| 5930 | BZDBCache::update(); |
| 5931 | canSpawn = true; |
| 5932 | |
| 5933 | // set this step game time |
| 5934 | GameTime::setStepTime(); |
| 5935 | |
| 5936 | // get delta time |
| 5937 | BzTime prevTime = BzTime::getTick(); |
| 5938 | BzTime::setTick(); |
| 5939 | const float dt = float(BzTime::getTick() - prevTime); |
| 5940 | |
| 5941 | mainWindow->getWindow()->yieldCurrent(); |
| 5942 | |
| 5943 | doMessages(); // handle incoming packets |
| 5944 | |
| 5945 | updateHubLink(); |
| 5946 | |
| 5947 | if (world) { // update the world collision grid if required |
| 5948 | world->checkCollisionManager(); |
| 5949 | } |
| 5950 | |
| 5951 | mainWindow->getWindow()->yieldCurrent(); |
| 5952 | |
| 5953 | handlePendingJoins(); |
| 5954 | |
| 5955 | struct in_addr inAddress; |
| 5956 | if (dnsLookupDone(inAddress)) { |
| 5957 | joinInternetGame(&inAddress); |
| 5958 | scoreboard->huntReset(); |
| 5959 | } |
| 5960 | |
| 5961 | mainWindow->getWindow()->yieldCurrent(); |
| 5962 | |
| 5963 | // handle pending events for some small fraction of time |
| 5964 | clockAdjust = 0.0f; |
| 5965 | processInputEvents(0.1f); |
| 5966 | |
| 5967 | handleJoyStick(); |
| 5968 | |
| 5969 | mainWindow->getWindow()->yieldCurrent(); |
| 5970 | |
| 5971 | callPlayingCallbacks(); // invoke callbacks |
| 5972 | |
| 5973 | mainWindow->getWindow()->yieldCurrent(); |
| 5974 | |
| 5975 | if (CommandsStandard::isQuit()) { |
| 5976 | break; // quick out |
| 5977 | } |
| 5978 |
no test coverage detected