Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
systimer.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** Confidential - Westwood Studios ***
21 ***********************************************************************************************
22 * *
23 * Project Name : Commando *
24 * *
25 * $Archive:: /Commando/Code/wwlib/systimer.cpp $*
26 * *
27 * $Author:: Steve_t $*
28 * *
29 * $Modtime:: 12/09/01 6:11p $*
30 * *
31 * $Revision:: 1 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#include "systimer.h"
38
40
41
42/***********************************************************************************************
43 * SysTimeClass::SysTimeClass -- default constructor, sets resolution *
44 * *
45 * *
46 * *
47 * INPUT: Nothing *
48 * *
49 * OUTPUT: Nothing *
50 * *
51 * WARNINGS: None *
52 * *
53 * HISTORY: *
54 * 01/04/2003 : Created by Mark Wilczynski (EAP) *
55 *=============================================================================================*/
57{
58 //tell windows we need single ms precision.
59 timeBeginPeriod(1);
60}
61
62/***********************************************************************************************
63 * SysTimeClass::~SysTimeClass -- default destructor, resets resolution *
64 * *
65 * *
66 * *
67 * INPUT: Nothing *
68 * *
69 * OUTPUT: Nothing *
70 * *
71 * WARNINGS: None *
72 * *
73 * HISTORY: *
74 * 01/04/2003 : Created by Mark Wilczynski (EAP) *
75 *=============================================================================================*/
77{
78 //tell windows we need single ms precision.
79 timeEndPeriod(1);
80}
81
82/***********************************************************************************************
83 * SysTimeClass::Reset -- Reset class to good state *
84 * *
85 * *
86 * *
87 * INPUT: Nothing *
88 * *
89 * OUTPUT: Nothing *
90 * *
91 * WARNINGS: None *
92 * *
93 * HISTORY: *
94 * 12/9/2001 5:51PM ST : Created *
95 *=============================================================================================*/
97{
98 StartTime = timeGetTime();
99 WrapAdd = 0 - StartTime;
100}
101
102
103
104/***********************************************************************************************
105 * SysTimeClass::Is_Getting_Late -- Are we running out of timer time? *
106 * *
107 * *
108 * *
109 * INPUT: Nothing *
110 * *
111 * OUTPUT: Nothing *
112 * *
113 * WARNINGS: None *
114 * *
115 * HISTORY: *
116 * 12/9/2001 6:04PM ST : Created *
117 *=============================================================================================*/
119{
120 /*
121 ** Even though the timers are all unsigned so we have a max time of 0xffffffff the game casts it to int in various places
122 ** so it's safer to assume a signed max value.
123 */
124 if (Get() > 0x6fffffff) {
125 return(true);
126 }
127 return(false);
128}
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
bool Is_Getting_Late(void)
Definition systimer.cpp:118
SysTimeClass(void)
Definition systimer.cpp:56
void Reset(void)
Definition systimer.cpp:96
WWINLINE unsigned long Get(void)
Definition systimer.h:108
SysTimeClass SystemTime
Definition systimer.cpp:39