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