// // Process commands // Returns TRUE upon success // void CON_ProcessUserCommand( void ) { SHORT i=0; BYTE temp_message[256],command_str[256]; strcpy(temp_message,MessageInputString); sscanf(Bstrlwr(temp_message),"%s", command_str); // Get the base command type for (i = 0; i < numcommands; i++) { // Don't even try if they aren't the same length if(strlen(command_str) != strlen(commandlist[i].command)) continue; // See if it's in there if(CON_CommandCmp(command_str, commandlist[i].command, strlen(command_str))) { if (commandlist[i].function) { (*commandlist[i].function)(); CON_AddHistory(MessageInputString); // Keep history only of valid input return; } } } if(ConPanel) CON_ConMessage("Syntax Error or Command not enabled!"); }
void CON_Tweak( void ) { char base[80], command[80]; long op1=0; // Format: tweak [weapon] [number] if (sscanf(MessageInputString,"%s %s %ld",base,command,&op1) < 3) { strcpy(MessageInputString,"help tweak"); CON_GetHelp(); return; } Bstrlwr(command); // Make sure operator is all lower case if(!strcmp(command,"adjust")) { extern short ADJUST; ADJUST = op1; CON_ConMessage("Zvelocity ADJUST set to %d.",op1); } else if(!strcmp(command,"adjustv")) { extern long ADJUSTV; ADJUSTV = op1; CON_ConMessage("Zvelocity ADJUSTV set to %d.",op1); } }
// // Stores user arguments passed in on the command line for later inspection // void CON_StoreArg(BYTEp userarg) { if(con_argnum < MAX_USER_ARGS) { strcpy(&user_args[con_argnum][0],userarg); Bstrlwr(&user_args[con_argnum][0]); con_argnum++; } }
// Get help on a console command void CON_GetHelp( void ) { char base[80], command[80]; short i; if (sscanf(MessageInputString,"%s %s",base,command) < 2) { CON_ConMessage("Usage: help [keyword]"); return; } Bstrlwr(command); // Make sure operator is all lower case if(!strcmp(command, "xrepeat")) { CON_ConMessage("Usage: xrepeat [repeat value 0-255],"); CON_ConMessage(" [User ID (-1 for all ID's)], [SpriteNum (-1 for all of type ID)]"); return; }else if(!strcmp(command, "yrepeat")) { CON_ConMessage("Usage: yrepeat [repeat value 0-255],"); CON_ConMessage(" [User ID (-1 for all ID's)], [SpriteNum (-1 for all of type ID)]"); return; }else if(!strcmp(command, "translucent")) { CON_ConMessage("Usage: translucent [OFF/ON 0-1],"); CON_ConMessage(" [User ID (-1 for all ID's)], [SpriteNum (-1 for all of type ID)]"); return; }else { CON_ConMessage("No help was located on that subject."); } }
// !JIM! My simplified version of CheatInput which simply processes MessageInputString void CheatInput ( void ) { static BOOL cur_show; int ret; BOOL match = FALSE; unsigned int i; //if (CommEnabled) // return; strcpy ( CheatInputString, MessageInputString ); // make sure string is lower cased Bstrlwr ( CheatInputString ); // check for at least one single match for ( i = 0; i < SIZ ( ci ); i++ ) { // compare without the NULL if ( cheatcmp ( CheatInputString, ci[i].CheatInputCode, strlen ( CheatInputString ) ) == 0 ) { // if they are equal in length then its a complet match if ( strlen ( CheatInputString ) == strlen ( ci[i].CheatInputCode ) ) { match = TRUE; CheatInputMode = FALSE; if ( TEST ( ci[i].flags, CF_NOTSW ) && SW_SHAREWARE ) { return; } if ( !TEST ( ci[i].flags, CF_ALL ) ) { if ( CommEnabled ) { return; } if ( Skill >= 3 ) { PutStringInfo ( Player, "You're too skillful to cheat\n" ); return; } } if ( ci[i].CheatInputFunc ) { ( *ci[i].CheatInputFunc ) ( Player, CheatInputString ); } return; } else { match = TRUE; break; } } } if ( !match ) { ////DSPRINTF(ds,"Lost A Match %s", CheatInputString); //MONO_PRINT(ds); CheatInputMode = FALSE; } }