// // Silver Ice Hirsipuu v1.0 (c) 1998 LegeNda / Silver Ice // // You can change those define what ever you like. // TEXT is text what is printed to line 3 in game. // HAKE should directory where words.hrs is stored. // // You can edit words.hrs (word-file) as much as you like. // // Comments and ideas: plaine@icenet.fi or to Perttu Laine is 2:222/160. // #define TEXT "\e[1;36mCurrently all words are somehow computer related.\e[0m" #define HAKE "d:/bbbs/scripts/" char words, word; int max, next_rand_seed=1; int srand(int seed) { next_rand_seed=seed; } int randomize() { srand(time()); } int rand() { return(((next_rand_seed=next_rand_seed*69069+5) >> 16) & 0x7fff); } int readwords() { if((int fh=fopen(sprintf("%swords.hrs",HAKE),"rt"))==-1) return(0); int i=1; words[i]=fgets(fh); words[i]=fgets(fh); do { words[i]=fgets(fh); i++; } while (!feof(fh)); max=i; fclose(fh); return(1); } char chooseword() { int i; i=rand()%max; i++; return(words[i]); } int hirsi() { char foo, wrongs="\e[0;36mWrongs: \e[0;32m", k="", tmp; int w=0, r=0; printf("\e[0m\e[2J\e[1;1H"); printf("\e[1;37;44m %-76s \e[0;37;0m","Silver Ice Hirsipuu v1.0 (c) LegeNda / SilverIce"); printf("\e[3;1H%s",TEXT); printf("\e[7;1H%s",wrongs); printf("\e[5;1H\e[0;36mWord: \e[0;32m"); int i=strlen(word); do { printf("_"); i--; } while (i>0); printf("\e[0m\e[9;1H"); printf("\e[1;36mPress some letter.\n"); printf("(or quit with *)\n\n\n"); printf("\e[0;36mIf you press 6 times wrong you're dead!\e[0;32m"); do { foo=stlocase(getch()); if (pos(foo,"abcdefghijklmnopqrstuvwxyz†„”*")) { if (foo=="*") return(1); if (!pos(foo,k)) { k=sprintf("%s%s",k,foo); if (!pos(foo,word)) { wrongs=sprintf("%s%s",wrongs,stupcase(foo)); printf("\e[7;1H%s",wrongs); printf("\e[1;32m"); if (!w) printf("\e[12;37H.--+--."); if (w==1) { for (int bar=1;bar<8;bar++) printf("\e[%u;40H|",bar+4); } if (w==2) { printf("\e[7;41H/\e[6;42H/"); printf("\e[5;40H+-----+"); } if (w==3) printf("\e[6;46H:\e[7;46H:"); if (w==4) printf("\e[8;46HO"); if (w==5) { printf("\e[9;45H-+-"); printf("\e[10;45H | "); printf("\e[11;45H/ \\"); } printf("\e[0;32m"); w++; } if (w>=6) return(1); if (pos(foo,word)) { do { printf("\e[5;%uH%s",pos(foo,word)+6,stupcase(foo)); tmp[1]=copy(word,1,pos(foo,word)-1); tmp[2]=delete(word,1,pos(foo,word)); word=sprintf("%sõ%s",tmp[1],tmp[2]); r++; } while (pos(foo,word)); } if (r>=strlen(word)) return(2); } } } while (bv_carrier); return(1); } int createwords() { if((int fh=fopen(sprintf("%swords.hrs",HAKE),"wt"))==-1) { printf("\e[1;33mAuha, auha! \e[0mCannot create %swords.hrs!\n",HAKE); exit(0); } printf("\e[0m\e[2J\e[1;1HThis seems to be first you hirsipuu in this BBS, because\n"); printf("%swords.hrs was not found! Creating default. -",HAKE); fprintf(fh,"; Only aplhabetical letters are allowed! No numbers or anything else!\n"); fprintf(fh,"; You can add as much lines as you want.\n"); fprintf(fh,"computer\n"); _delay(50); printf("\b/"); fprintf(fh,"monitor\n"); _delay(50); printf("\b|"); fprintf(fh,"mouse\n"); _delay(50); printf("\b\\"); fprintf(fh,"keyboard\n"); _delay(50); printf("\b-"); fprintf(fh,"diskette\n"); _delay(50); printf("\b/"); fprintf(fh,"harddisk\n"); _delay(50); printf("\b|"); fprintf(fh,"internet\n"); _delay(50); printf("\b\\"); fprintf(fh,"fidonet\n"); _delay(50); printf("\b-"); fprintf(fh,"network\n"); _delay(50); printf("\b/"); fprintf(fh,"modem\n"); _delay(50); printf("\b|"); fprintf(fh,"microsoft\n"); _delay(50); printf("\b\\"); fprintf(fh,"windows\n"); _delay(50); printf("\b-\nDone!\n\n"); fclose(fh); printf("Now default words.hrs created to %s directory.\n\n",HAKE); printf("You can edit it if you like...\n\nPress any key to continue.\n"); getch(); } int main() { randomize(); if((int i=readwords())!=1) createwords(); readwords(); do { word=chooseword(); } while (!strlen(word)); int tulo=hirsi(); if (tulo==1) { printf("\e[20;1H\e[1;33mYou"); delay(3); printf("'re dead!!!!\n\n\e[1;37mSilver Ice productions.\e[0m\n"); } if (tulo==2) { printf("\e[20;1H\e[1;33mYou"); delay(3); printf(" made it!!!!\n\n\e[1;37mSilver Ice prodcutions.\e[0m\n"); } }