/* soapstone.c : Random orange soapstone message generator. (C)2016 Marisa the Magician, UnSX Team. Released under the MIT license. Dark Souls is (C)2011-2016 From Software. */ #include #include #include #include #include "soapstone_ds1.h" #include "soapstone_ds2.h" #include "soapstone_ds3.h" #include "soapstone_er.h" void print_soapstone_ds1( void ) { int template = rand()%13; int word = rand()%173; char mesg[256]; if ( template < 8 ) sprintf(mesg,templates1[template],words1[word]); else strcpy(mesg,templates1[template]); printf("%s\n",mesg); } void print_soapstone_ds2( void ) { int template = rand()%DS2_TEMPLATES; int word = rand()%(((template>5)&&(template<10))?DS2_WORDS:DS2_WORDS2); char mesg[256]; sprintf(mesg,templates2[template],words2[word]); if ( rand()&1 ) { char mesg2[256]; int template2 = rand()%DS2_TEMPLATES; int word2 = rand()%(((template2>5)&&(template2<10))?DS2_WORDS:DS2_WORDS2); int conj = rand()%DS2_CONJUNCTIONS; sprintf(mesg2,templates2[template2],words2[word2]); printf("%s%s%s\n",mesg,conjunctions2[conj],mesg2); } else printf("%s\n",mesg); } void print_soapstone_ds3( void ) { if ( rand()&1 ) printf("[%s] ",gestures3[rand()%DS3_GESTURES]); int template = rand()%DS3_TEMPLATES; int word = rand()%DS3_WORDS; char mesg[256]; sprintf(mesg,templates3[template],words3[word]); if ( rand()&1 ) { char mesg2[256]; int template2 = rand()%DS3_TEMPLATES; int word2 = rand()%DS3_WORDS2; int conj = rand()%DS3_CONJUNCTIONS; sprintf(mesg2,templates3[template2],words3[word2]); printf("%s%s%s\n",mesg,conjunctions3[conj],mesg2); } else printf("%s\n",mesg); } int main( int argc, char **argv ) { int rsd = 0; #ifndef WINDOWS FILE *r; if ( (r = fopen("/dev/random","r")) ) { fread(&rsd,sizeof(int),1,r); fclose(r); } else #endif rsd = time(0); srand(rsd); if ( argc < 2 ) { fprintf(stderr,"usage: %s [lines]\n",argv[0]); return 1; } int times = 1; if ( argc > 2 ) sscanf(argv[2],"%d",×); switch( *argv[1] ) { case '1': for ( int i=0; i