Really need some insight on this people.
Whats all this about then?
Im investigating the z-buffer problem and ran into this
float z_mult = 30000.0f;
DCF(zmult, "")
{
dc_get_arg(ARG_FLOAT);
[b]z_mult = Dc_arg_float[/b];
}
z_mult is the variable that determines the depth of each vertex.
#define DCF(function_name,help_text) \
void dcf_##function_name(); \
debug_command dc_##function_name(#function_name,help_text,dcf_##function_name); \
void dcf_##function_name()
And what the hell is all this about?
void dc_get_arg(uint type)
{
scanner_get_token();
Dc_command_line = scanner_bufferp;
Dc_arg_org = scanner_token_string;
Dc_arg = scanner_word_string;
if (Dc_debug_on) {
dc_printf( "next arg is '%s', was originally '%s'\n", Dc_arg, Dc_arg_org );
dc_printf( "Rest of the command line is '%s'\n", Dc_command_line );
}
if ( scanner_token == NO_TOKEN ) {
Dc_arg_type = ARG_NONE;
} else if ( scanner_token == IDENTIFIER ) {
Dc_arg_type = ARG_STRING;
} else if ( scanner_token == STRING ) {
Dc_arg_type = ARG_QUOTE;
} else {
Dc_arg_type = ARG_STRING;
}
if ( Dc_arg_type & ARG_STRING ) {
int i, num_digits, len;
len = strlen(Dc_arg);
num_digits = 0;
for (i=0; i if ( scanner_char_table[Dc_arg[i]] == DIGIT ) num_digits++;
if ( num_digits==len ) {
Dc_arg_type |= ARG_FLOAT;
[b]Dc_arg_float = (float)atof(Dc_arg);[/b]
if ( !strchr( Dc_arg, '.' )) {
Dc_arg_type |= ARG_INT;
Dc_arg_int = atoi(Dc_arg);
}
} else {
if ( (Dc_arg[0] == '0') && (Dc_arg[1] == 'x') ) {
char *p;
int n;
n = strtol(Dc_arg,&p,0);
if ( *p == 0 ) {
Dc_arg_type |= ARG_INT|ARG_HEX;
Dc_arg_int = n;
}
}
}
if (Dc_debug_on) {
if ( Dc_arg_type & ARG_FLOAT )
dc_printf( "Found float number! %f\n", Dc_arg_float );
if ( Dc_arg_type & ARG_INT )
dc_printf( "Found int number! %d\n", Dc_arg_int );
if ( Dc_arg_type & ARG_HEX )
dc_printf( "Found hex number! 0x%x\n", Dc_arg_int );
}
if ( !stricmp( Dc_arg, "on" ))
Dc_arg_type |= ARG_TRUE;
if ( !stricmp( Dc_arg, "true" ))
Dc_arg_type |= ARG_TRUE;
if ( !stricmp( Dc_arg, "off" ))
Dc_arg_type |= ARG_FALSE;
if ( !stricmp( Dc_arg, "false" ))
Dc_arg_type |= ARG_FALSE;
if ( !stricmp( Dc_arg, "+" ))
Dc_arg_type |= ARG_PLUS;
if ( !stricmp( Dc_arg, "-" ))
Dc_arg_type |= ARG_MINUS;
if ( !stricmp( Dc_arg, "," ))
Dc_arg_type |= ARG_COMMA;
}
if ( Dc_arg_type & ARG_INT) {
if ( Dc_arg_int )
Dc_arg_type |= ARG_TRUE;
else
Dc_arg_type |= ARG_FALSE;
}
if ( !(Dc_arg_type&type) ) {
if ( (Dc_arg_type & ARG_NONE) && !(type & ARG_NONE))
dc_printf( "Error: Not enough parameters.\n" );
else
dc_printf( "Error: '%s' invalid type\n", Dc_arg );
longjmp(dc_bad_arg,1);
}
}