Advertisement
Guest User

Untitled

a guest
Oct 8th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*cl_demo.cpp*/
  2.  
  3. // [IBM] The map that's going to be skipped | 0 = there's nothing to be skipped, else there's a map to be skipped
  4. static BYTE *g_SkipToMap = 0;
  5.  
  6.  
  7.  
  8.  
  9. //*****************************************************************************
  10. //  CONSOLE COMMANDS
  11. CCMD(demo_skiptomap)
  12. {
  13.     // This command shouldn't do anything if a demo isn't playing.
  14.     if (CLIENTDEMO_IsPlaying() == false){
  15.         if (argv.argc() == 1)
  16.         {
  17.             Printf("Usage: demo_skiptomap <map name>");
  18.         }
  19.         else if (argv.argc() > 2)
  20.         {
  21.             Printf("Too many arguments.");
  22.         }
  23.         else {
  24.             g_SkipToMap = argv.args[1];
  25.         }
  26.     }
  27.  
  28. }
  29.  
  30. //*****************************************************************************
  31. //
  32. bool CLIENTDEMO_IsSkippingToMap(BYTE *ActualMap) {
  33.     if (g_SkipToMap) {
  34.         int i = 0;
  35.         while (g_SkipToMap[i] != '\0' && ActualMap[i] != '\0' && g_SkipToMap[i] == ActualMap[i])
  36.         {
  37.             i++;
  38.         }
  39.         if (g_SkipToMap[i] == '\0' && ActualMap[i] == '\0') {//They are equal, so we stop here
  40.             free(g_SkipToMap);
  41.             g_SkipToMap = NULL;
  42.             return true;
  43.         }
  44.     }
  45.     return false;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement