114 if (RAND_MAX == 0x7fff) {
117 random32 = (rand() << 16) | rand();
119 random32 |= ((rand() & 1) << 15);
129 static int cf_timestamp = -1;
130 static void (*cf_callback)(
int count) = NULL;
131 static int cf_in_callback = 0;
132 static int cb_counter = 0;
133 static int cb_last_counter = 0;
134 static int cb_delta_step = -1;
158 cb_delta_step = delta_step;
160 cf_callback = callback;
175 if ( cf_in_callback != 0 )
return;
176 if ( cf_timestamp < 0 )
return;
177 if ( !cf_callback )
return;
184 if (filename != NULL)
190 if ( (t1 > cf_timestamp) || ((cb_counter > cb_last_counter+155) && (cb_delta_step > 0)) ) {
191 cb_last_counter = cb_counter;
193 (*cf_callback)(cb_counter);
195 cf_timestamp = t1 + (1000/10);
203 #define MAX_VARIABLE_MONITORS 64
205 static int Num_monitors = 0;
217 for (i=0; i<Num_monitors; i++ ) {
223 }
else if ( ret > 0 ) {
226 }
else if ( ret < 0 ) {
231 if ( i < Num_monitors ) {
234 for (j=Num_monitors; j>
i; j-- ) {
235 Monitor[j] = Monitor[j-1];
240 Monitor[Num_monitors] =
this;
258 dc_printf(
"Usage: monitor [filename]\n");
259 dc_printf(
"Outputs monitoring info to [filename]. No filename turns it off\n" );
264 if ( Monitor_inited ) {
269 strcpy_s(Monitor_filename, filename.c_str());
273 for (i=0; i<Num_monitors; i++ ) {
281 FILE *
fp = fopen( Monitor_filename,
"wt" );
283 for (i=0; i<Num_monitors; i++ ) {
287 fprintf( fp,
"%s", Monitor[i]->
name );
293 dc_printf(
"Monitor outputting to file '%s'\n", Monitor_filename );
294 monitor_last_time = -1;
299 if ( Monitor_inited ) {
318 dc_printf(
"Monitor to file '%s' turned off\n", Monitor_filename );
336 if ( monitor_last_time != -1 ) {
342 if ( frametime > 0 ) {
349 if ( !Monitor_inited ) {
353 if ( frametime != 0 ) {
354 fp = fopen( Monitor_filename,
"at" );
357 for (i=0; i<Num_monitors; i++ ) {
358 if (i>0) fprintf( fp,
"\t" );
359 fprintf( fp,
"%d", Monitor[i]->
value );
365 for (i=0; i<Num_monitors; i++ ) {
370 if ( (Monitor[i]->cnt < 1) || (Monitor[i]->
value < Monitor[i]->min )) {
374 if ( (Monitor[i]->cnt < 1) || (Monitor[i]->
value > Monitor[i]->max )) {
384 for (i=0; i<Num_monitors; i++ ) {
396 #if MAX_DETAIL_LEVEL != 4
397 #error MAX_DETAIL_LEVEL is assumed to be 4 in SystemVars.cpp
400 #if NUM_DEFAULT_DETAIL_LEVELS != 4
401 #error NUM_DEFAULT_DETAIL_LEVELS is assumed to be 4 in SystemVars.cpp
493 Detail = Detail_defaults[
level];
506 if ( memcmp( &Detail, &Detail_defaults[i],
sizeof(
detail_levels) )==0 ) {
514 DCF(detail_level,
"Change the detail level")
522 dc_printf(
"\tnegative values are lower, and\n");
523 dc_printf(
"\tpositive values are higher.\n\n");
525 dc_printf(
"No parameter resets it to default.\n");
544 DCF(detail,
"Turns on/off parts of the game for speed testing" )
550 dc_printf(
"[n] is detail bit to toggle:\n" );
553 dc_printf(
" 4: draw the motion debris\n" );
555 dc_printf(
" 16: draw models not as blobs\n" );
556 dc_printf(
" 32: draw lasers not as pixels\n" );
557 dc_printf(
" 64: clear screen background after each frame\n" );
560 dc_printf(
" 512: do collision detection\n\n" );
562 dc_printf(
"No argument will toggle between highest/lowest detail settings\n");
587 dc_printf(
"Detail flags set lowest (except has screen clear)\n" );
590 dc_printf(
"Detail flags set highest\n" );
599 void insertion_sort(
void *array_base,
size_t array_size,
size_t element_size,
int (*fncompare)(
const void *,
const void *))
603 char *array_byte_base;
606 array_byte_base = (
char *) array_base;
609 current = malloc(element_size);
617 for (i = 1; (unsigned) i < array_size; i++)
620 memcpy(current, array_byte_base + (i * element_size), element_size);
623 for (j = i - 1; (j >= 0) && (fncompare(array_byte_base + (j * element_size), current) > 0); j--)
625 memcpy(array_byte_base + ((j + 1) * element_size), array_byte_base + (j * element_size), element_size);
629 memcpy(array_byte_base + ((j + 1) * element_size), current, element_size);
char Monitor_filename[MAX_PATH_LEN]
float Cutscene_bars_progress
GLsizei const GLfloat * value
bool dc_maybe_stuff_int(int *i)
Tries to stuff an int from the Command_string.
detail_levels Detail_defaults[NUM_DEFAULT_DETAIL_LEVELS]
#define MAX_VARIABLE_MONITORS
char Processing_filename[MAX_PATH_LEN]
angles Viewer_slew_angles
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
bool PostProcessing_override
float Noise[NOISE_NUM_FRAMES]
int current_detail_level()
void detail_level_set(int level)
int game_busy_callback(void(*callback)(int count), int delta_step)
void game_busy(const char *filename)
DCF(monitor,"Monitors game performace by saving to file")
#define NUM_DEFAULT_DETAIL_LEVELS
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
#define MONITOR(function_name)
void insertion_sort(void *array_base, size_t array_size, size_t element_size, int(*fncompare)(const void *, const void *))
#define DETAIL_FLAG_CLEAR
bool Glowpoint_use_depth_buffer
#define MONITOR_INC(function_name, inc)
float Cutscene_delta_time
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
GLuint const GLchar * name
fix timer_get_fixed_seconds()
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
void neb2_set_detail_level(int level)
int timer_get_milliseconds()
bool dc_maybe_stuff_string_white(char *str, size_t len)
Tries to stuff a whitespace delimited string to out_str from the command line, stopping at the end of...