RandomizeCharacterHolyBlood.h
void RandomHolyBlood(unsigned char *entrybufferblood, int mode, FILE *log)
{
  int done = 0;
  
  while(!done)
  {
    switch(rand() % 13)
    {
      case 0: /* Baldr, Set 1, 0000 0010 */
        if(entrybufferblood[0] & 3) /* If either minor or major is tripped, this will give true, and break the switch before it can reach "done" */
        {
          break;
        }
        entrybufferblood[0] += 2/mode;
        fprintf(log, "Baldr");
        done = 1;
        break;
      case 1: /* Naga, Set 1, 0000 1000 */
        if(entrybufferblood[0] & 12)
        {
          break;
        }
        entrybufferblood[0] += 8/mode;
        fprintf(log, "Naga");
        done = 1;
        break;
      case 2: /* Dain, Set 1, 0010 0000 */
        if(entrybufferblood[0] & 48)
        {
          break;
        }
        entrybufferblood[0] += 32/mode;
        fprintf(log, "Dain");
        done = 1;
        break;
      case 3: /* Noba, Set 1, 1000 0000 */
        if(entrybufferblood[0] & 192)
        {
          break;
        }
        entrybufferblood[0] += 128/mode;
        fprintf(log, "Nova");
        done = 1;
        break;
      case 4: /* Od, Set 2, 0000 0010 */
        if(entrybufferblood[1] & 3)
        {
          break;
        }
        entrybufferblood[1] += 2/mode;
        fprintf(log, "Od");
        done = 1;
        break;
      case 5: /* Ulir, Set 2, 0000 1000 */
        if(entrybufferblood[1] & 12)
        {
          break;
        }
        entrybufferblood[1] += 8/mode;
        fprintf(log, "Ulir");
        done = 1;
        break;
      case 6: /* Neir, Set 2, 0010 0000 */
        if(entrybufferblood[1] & 48)
        {
          break;
        }
        entrybufferblood[1] += 32/mode;
        fprintf(log, "Neir");
        done = 1;
        break;
      case 7: /* Fjalar, Set 2, 1000 0000 */
        if(entrybufferblood[1] & 192)
        {
          break;
        }
        entrybufferblood[1] += 128/mode;
        fprintf(log, "Fjalar");
        done = 1;
        break;
      case 8: /* Thrud, Set 3, 0000 0010 */
        if(entrybufferblood[2] & 3)
        {
          break;
        }
        entrybufferblood[2] += 2/mode;
        fprintf(log, "Thrud");
        done = 1;
        break;
      case 9: /* Forseti, Set 3, 0000 1000 */
        if(entrybufferblood[2] & 12)
        {
          break;
        }
        entrybufferblood[2] += 8/mode;
        fprintf(log, "Forseti");
        done = 1;
        break;
      case 10: /* Blagi, Set 3, 0010 0000 */
        if(entrybufferblood[2] & 48)
        {
          break;
        }
        entrybufferblood[2] += 32/mode;
        fprintf(log, "Blagi");
        done = 1;
        break;
      case 11: /* Hezul, Set 3, 1000 0000 */
        if(entrybufferblood[2] & 192)
        {
          break;
        }
        entrybufferblood[2] += 128/mode;
        fprintf(log, "Hezul");
        done = 1;
        break;
      case 12: /* Loptyr, Set 4, 0000 0010 */
        if(entrybufferblood[3] & 3)
        {
          break;
        }
        entrybufferblood[3] += 2/mode;
        fprintf(log, "Loptyr");
        done = 1;
        break;
    }
  }
  
  return;
}
/* Function for handing out a random holy blood. */
/* Loops until it has given one. Won't pick an already given one. */
/* Call in mode 1 for Major blood, mode 2 for Minor */
Function for handing out a random holy blood.
Loops until it has given one. Won't pick an already given one.
Call in mode 1 for Major blood, mode 2 for Minor
Function for handing out a random holy blood . Loops until it has given one . Won ' t pick an already given one . Call in mode 1 for Major blood mode 2 for Minor
void RandomHolyBlood(unsigned char *entrybufferblood, int mode, FILE *log)
{
  int done = 0;
  while(!done)
  {
    switch(rand() % 13)
    {
      case 0: 
        if(entrybufferblood[0] & 3) 
        {
          break;
        }
        entrybufferblood[0] += 2/mode;
        fprintf(log, "Baldr");
        done = 1;
        break;
      case 1: 
        if(entrybufferblood[0] & 12)
        {
          break;
        }
        entrybufferblood[0] += 8/mode;
        fprintf(log, "Naga");
        done = 1;
        break;
      case 2: 
        if(entrybufferblood[0] & 48)
        {
          break;
        }
        entrybufferblood[0] += 32/mode;
        fprintf(log, "Dain");
        done = 1;
        break;
      case 3: 
        if(entrybufferblood[0] & 192)
        {
          break;
        }
        entrybufferblood[0] += 128/mode;
        fprintf(log, "Nova");
        done = 1;
        break;
      case 4: 
        if(entrybufferblood[1] & 3)
        {
          break;
        }
        entrybufferblood[1] += 2/mode;
        fprintf(log, "Od");
        done = 1;
        break;
      case 5: 
        if(entrybufferblood[1] & 12)
        {
          break;
        }
        entrybufferblood[1] += 8/mode;
        fprintf(log, "Ulir");
        done = 1;
        break;
      case 6: 
        if(entrybufferblood[1] & 48)
        {
          break;
        }
        entrybufferblood[1] += 32/mode;
        fprintf(log, "Neir");
        done = 1;
        break;
      case 7: 
        if(entrybufferblood[1] & 192)
        {
          break;
        }
        entrybufferblood[1] += 128/mode;
        fprintf(log, "Fjalar");
        done = 1;
        break;
      case 8: 
        if(entrybufferblood[2] & 3)
        {
          break;
        }
        entrybufferblood[2] += 2/mode;
        fprintf(log, "Thrud");
        done = 1;
        break;
      case 9: 
        if(entrybufferblood[2] & 12)
        {
          break;
        }
        entrybufferblood[2] += 8/mode;
        fprintf(log, "Forseti");
        done = 1;
        break;
      case 10: 
        if(entrybufferblood[2] & 48)
        {
          break;
        }
        entrybufferblood[2] += 32/mode;
        fprintf(log, "Blagi");
        done = 1;
        break;
      case 11: 
        if(entrybufferblood[2] & 192)
        {
          break;
        }
        entrybufferblood[2] += 128/mode;
        fprintf(log, "Hezul");
        done = 1;
        break;
      case 12: 
        if(entrybufferblood[3] & 3)
        {
          break;
        }
        entrybufferblood[3] += 2/mode;
        fprintf(log, "Loptyr");
        done = 1;
        break;
    }
  }
  return;
}
void RandomHolyBlood ( unsigned char * entrybufferblood , int mode , FILE * log ) { int done = 0 ; while ( ! done ) { switch ( rand ( ) % 13 ) { case 0 : if ( entrybufferblood [ 0 ] & 3 ) { break ; } entrybufferblood [ 0 ] += 2 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 1 : if ( entrybufferblood [ 0 ] & 12 ) { break ; } entrybufferblood [ 0 ] += 8 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 2 : if ( entrybufferblood [ 0 ] & 48 ) { break ; } entrybufferblood [ 0 ] += 32 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 3 : if ( entrybufferblood [ 0 ] & 192 ) { break ; } entrybufferblood [ 0 ] += 128 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 4 : if ( entrybufferblood [ 1 ] & 3 ) { break ; } entrybufferblood [ 1 ] += 2 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 5 : if ( entrybufferblood [ 1 ] & 12 ) { break ; } entrybufferblood [ 1 ] += 8 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 6 : if ( entrybufferblood [ 1 ] & 48 ) { break ; } entrybufferblood [ 1 ] += 32 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 7 : if ( entrybufferblood [ 1 ] & 192 ) { break ; } entrybufferblood [ 1 ] += 128 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 8 : if ( entrybufferblood [ 2 ] & 3 ) { break ; } entrybufferblood [ 2 ] += 2 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 9 : if ( entrybufferblood [ 2 ] & 12 ) { break ; } entrybufferblood [ 2 ] += 8 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 10 : if ( entrybufferblood [ 2 ] & 48 ) { break ; } entrybufferblood [ 2 ] += 32 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 11 : if ( entrybufferblood [ 2 ] & 192 ) { break ; } entrybufferblood [ 2 ] += 128 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; case 12 : if ( entrybufferblood [ 3 ] & 3 ) { break ; } entrybufferblood [ 3 ] += 2 / mode ; fprintf ( log , " " ) ; done = 1 ; break ; } } return ; }
Function for handing out a random holy blood.
Function for handing out a random holy blood .
/* Baldr, Set 1, 0000 0010 */ /* If either minor or major is tripped, this will give true, and break the switch before it can reach "done" */ /* Naga, Set 1, 0000 1000 */ /* Dain, Set 1, 0010 0000 */ /* Noba, Set 1, 1000 0000 */ /* Od, Set 2, 0000 0010 */ /* Ulir, Set 2, 0000 1000 */ /* Neir, Set 2, 0010 0000 */ /* Fjalar, Set 2, 1000 0000 */ /* Thrud, Set 3, 0000 0010 */ /* Forseti, Set 3, 0000 1000 */ /* Blagi, Set 3, 0010 0000 */ /* Hezul, Set 3, 1000 0000 */ /* Loptyr, Set 4, 0000 0010 */