Process a time event and update all sub-processes
| 139 | |
| 140 | // Process a time event and update all sub-processes |
| 141 | void processTimeEvent(S32 elapsedTime) |
| 142 | { |
| 143 | PROFILE_START(ProcessTimeEvent); |
| 144 | |
| 145 | // If recording a video and not playinb back a journal, override the elapsedTime |
| 146 | if (VIDCAP->isRecording() && !Journal::IsPlaying()) |
| 147 | elapsedTime = VIDCAP->getMsPerFrame(); |
| 148 | |
| 149 | // cap the elapsed time to one second |
| 150 | // if it's more than that we're probably in a bad catch-up situation |
| 151 | if(elapsedTime > 1024) |
| 152 | elapsedTime = 1024; |
| 153 | |
| 154 | U32 timeDelta; |
| 155 | if(ATTS(gTimeAdvance)) |
| 156 | timeDelta = ATTS(gTimeAdvance); |
| 157 | else |
| 158 | timeDelta = (U32) (elapsedTime * ATTS(gTimeScale)); |
| 159 | |
| 160 | Platform::advanceTime(elapsedTime); |
| 161 | |
| 162 | // Don't build up more time than a single tick... this makes the sim |
| 163 | // frame rate dependent but is a useful hack for singleplayer. |
| 164 | if ( ATTS(gFrameSkip) ) |
| 165 | if ( timeDelta > TickMs ) |
| 166 | timeDelta = TickMs; |
| 167 | |
| 168 | bool tickPass; |
| 169 | |
| 170 | PROFILE_START(ServerProcess); |
| 171 | tickPass = serverProcess(timeDelta); |
| 172 | PROFILE_END(); |
| 173 | |
| 174 | PROFILE_START(ServerNetProcess); |
| 175 | // only send packets if a tick happened |
| 176 | if(tickPass) |
| 177 | GNet->processServer(); |
| 178 | // Used to indicate if server was just ticked. |
| 179 | Con::setBoolVariable( "$pref::hasServerTicked", tickPass ); |
| 180 | PROFILE_END(); |
| 181 | |
| 182 | |
| 183 | PROFILE_START(SimAdvanceTime); |
| 184 | Sim::advanceTime(timeDelta); |
| 185 | PROFILE_END(); |
| 186 | |
| 187 | PROFILE_START(ClientProcess); |
| 188 | tickPass = clientProcess(timeDelta); |
| 189 | // Used to indicate if client was just ticked. |
| 190 | Con::setBoolVariable( "$pref::hasClientTicked", tickPass ); |
| 191 | PROFILE_END_NAMED(ClientProcess); |
| 192 | |
| 193 | PROFILE_START(ClientNetProcess); |
| 194 | if(tickPass) |
| 195 | GNet->processClient(); |
| 196 | PROFILE_END(); |
| 197 | |
| 198 | GNet->checkTimeouts(); |
nothing calls this directly
no test coverage detected