/* various miscellaneous location functions */ void l_water(void) { if (! gamestatusp(MOUNTED)) { if ((Player.possessions[O_ARMOR] != NULL)) { print1("Your heavy armor drags you under the water!"); morewait(); p_drown(); print2("You reach the surface again."); } else if (Player.itemweight > ((int) (Player.maxweight / 2))) { print1("The weight of your burden drags you under water!"); morewait(); p_drown(); print2("You reach the surface again."); } else switch(random_range(32)) { case 0:print1("Splish. Splash!"); break; case 1:print1("I want my ducky!"); break; case 2:print1("So finally you take a bath!"); break; case 3:print1("You must be very thirsty!"); break; } } else switch(random_range(32)) { case 0:print1("Your horse frolics playfully in the water."); break; case 1:print1("Your horse quenches its thirst."); break; case 2:print1("Your steed begins to swim...."); break; case 3:print1("Your mount thrashes about in the water."); break; } }
void l_vault(void) { print1("You come to a thick vault door with a complex time lock."); if ((hour()==23)) { print2("The door is open."); Level->site[12][56].locchar = FLOOR; } else { print2("The door is closed."); Level->site[12][56].locchar = WALL; morewait(); clearmsg(); if (cinema_confirm("You're about to try to crack the safe.")=='y') { if (random_range(100) < Player.rank[THIEVES]*Player.rank[THIEVES]) { print2("The lock clicks open!!!"); gain_experience(5000); Level->site[12][56].locchar = FLOOR; } else { print2("Uh, oh, set off the alarm.... The castle guard arrives...."); morewait(); if (Player.rank[NOBILITY] == DUKE) { clearmsg(); print1("\"Ah, just testing us, your Grace? I hope we're up to scratch.\""); morewait(); } else send_to_jail(); } } else print2("Good move."); } }
void Binary::print2(node*temp,int x,int y) { if(temp) { if(y==1) { print2(temp->left,25,y+1); gotoxy(x,(y*2)+5); cout<<temp->data; print2(temp->right,55,y+1); } else { print2(temp->left,x-(10-(1.7*y)),y+1); gotoxy(x,(y*2)+5); cout<<temp->data; print2(temp->right,x+(10-(1.7*y)),y+1); } } }
void l_charity(void) { long donation; print2("'Greetings, friend. Do you wish to make a donation?' [yn] "); if (ynq2()!='y') print3("'Pinchpurse!'"); else { clearmsg(); // print1("How much can you give? "); donation = parsenum("How much can you give?"); if (donation < 1) print2("'Go stick your head in a pig.'"); else if (donation > Player.cash) print2("'I'm afraid you're charity is bigger than your purse!'"); else if (donation < max(100,Player.level*Player.level*100)) { print2("'Oh, can't you do better than that?'"); print3("'Well, I guess we'll take it....'"); if (Player.alignment < 10) Player.alignment++; Player.cash -= donation; } else { print2("'Oh thank you kindly, friend, and bless you!'"); Player.cash -= donation; Player.alignment += 5; } } dataprint(); }
int gymtrain(int *maxstat, int *stat) { int trained = 0; if (Gymcredit + Player.cash < 2000) print2("You can't afford our training!"); else { trained = 1; if (Gymcredit > 2000) Gymcredit -= 2000; else { Player.cash -= (2000-Gymcredit); Gymcredit = 0; } print2("Sweat. Sweat. "); if ((*maxstat < 30) && ((*maxstat < random_range(30)) || (random_range(3)==1))) { nprint2("The training pays off!"); (*maxstat)++; (*stat)++; } else { nprint2("You feel the healthy glow of a good workout."); if (*stat < *maxstat) { (*stat)++; print3("A feeling of rehabilitation washes through you."); } } } dataprint(); return trained; }
void drawPanel(uchar* a) { drawRect(a, 30, ROWS_CNT + 4); memset(a + (VIDEO_BPL * (2 + ROWS_CNT) + 1), 0x1C, 29); // hLine vLine(a + (VIDEO_BPL + 15), ROWS_CNT+1, 0x1B); print2(a + (VIDEO_BPL + 6 ), "imq"); print2(a + (VIDEO_BPL + 21), "imq"); }
void stationcheck(void) { int stationsleft=FALSE; int i,j; morewait(); clearmsg(); print1("You feel regenerated."); Player.hp = Player.maxhp; dataprint(); for(j=0;j<Level->level_length;j++) for(i=0;i<Level->level_width;i++) if ((Level->site[i][j].locchar == WATER) || (Level->site[i][j].locchar == HEDGE) || (Level->site[i][j].locchar == WHIRLWIND) || (Level->site[i][j].locchar == FIRE)) stationsleft=TRUE; if (! stationsleft) { print1("There is a noise like a wild horse's neigh."); print2("You spin around, and don't see anyone around at all"); print3("except for a spurred black cloaked figure carrying a scythe."); morewait();clearmsg(); print1("Death coughs apologetically. He seems a little embarrassed."); print2("A voice peals out:"); print3("'An Adept must be able to conquer Death himself...."); make_site_monster(32,4,DEATH); } }
void Thermoelasticity2Dp::printX(tInteger p) { for(tInteger i=0; i<nx; i++) std::cout<<std::endl<<p*nx+i<<"\t"<<print2(nodes[p*nx+i].x)<<"\t"<<print2(nodes[p*nx+i].y)<<"\t"<<print(U[p*nx+i])<<"\t"<<print(V[p*nx+i])<<"\t"<<print(T[p*nx+i]); }
int main() { std::vector<int> v = {1,23,6,4,5,7,4}; std::list<std::string> l = {"ss","sszz","saaas","s333s","ss2","sss"}; print2(v, std::cout); print2(l, std::cout); return 0; }
void drawFilesCountInt(ulong* total, uint filesCnt) { uchar v; uchar* a; a = charAddr(2+activePanel, 4+ROWS_CNT); i2s32((char*)a, total, 10, ' '); print2(a+11, "bajt w "); if(filesCnt < 1000) i2s((char*)a+18, filesCnt, 3, ' '); v = filesCnt % 100; print2(a+22, (!(v >= 10 && v < 20) && v % 10 == 1) ? "fajle " : "fajlah "); }
const std::string Statistics::print() const { return std::string( print2(antCnt_, "ants")+ print2(foodCnt_, "foods")+ print2(obstacleCnt_, "obstacles")+ "ants carring smth = " + std::to_string(antsCarring_) + "\n"+ "step number = " + std::to_string(stepNumber_)+"\n" ); }
void l_void_station(void) { int i,something=FALSE; if (cinema_confirm("You're about to Peter Pan into an endless void.")=='y') { if (Level->mlist == NULL) { print2("You fall forever. Eventually you die of starvation."); morewait(); while(Player.hp>0) { Time+=60; hourly_check(); usleep(250000); } } else { print1("You enter the void."); print2("You feel a sudden surge of power from five directions."); morewait(); something = (Player.packptr > 0); if (! something) for(i=0;((i<MAXITEMS)&&(!something));i++) if (Player.possessions[i] != NULL) something = TRUE; if (something) { print1("The flow of power is disrupted by something!"); print2("The power is unbalanced! You lose control!"); morewait(); print1("Each of your cells explodes with a little scream of pain."); print2("Your disrupted essence merges with the megaflow."); p_death("the Power of the Void"); } else if (! gamestatusp(PREPARED_VOID)){ print1("The hungry void swallows you whole!"); print2("Your being dissipates with a pathetic little sigh...."); p_death("the Emptyness of the Void"); } else { print1("The flow of power rages through your body,"); print2("but you manage to master the surge!"); print3("You feel adept...."); morewait();clearmsg(); print1("With a thought, you soar up through the void to the"); print2("place from whence you came."); print3("As the platform of the Challenge dwindles beneath you"); morewait(); clearmsg(); print1("You see Death raise his scythe to you in a salute."); Player.rank[ADEPT] = 1; setgamestatus(COMPLETED_CHALLENGE); FixedPoints = calc_points(); /* set so change_environment puts player in correct temple! */ Player.x = 49; Player.y = 59; print2("You find yourself back in the Temple of Destiny."); morewait(); change_environment(E_TEMPLE); } } } else print2("You back away from the edge...."); }
void cureforpay(void) { if (Player.cash < 250) print2("You can't afford to be cured!"); else { Player.cash -= 250; Player.status[DISEASED] = 0; print2("Quarantine lifted...."); showflags(); } }
void identify(int blessing) { int index; clearmsg(); if (blessing == 0) { index = getitem_prompt("Identify: ", NULL_ITEM); if (index == CASHVALUE) print3("Your money is really money."); else if (index == ABORT) State.setSkipMonsters(); else { if (Player.possessions[index]->objchar == FOOD) Player.possessions[index]->known = 1; else { Player.possessions[index]->known = 2; Objects[Player.possessions[index]->id].known = 1; } print1("Identified: "); mprint(itemid(Player.possessions[index])); } } else if (blessing < 0) { print2("You feel forgetful."); for (index=0; index<MAXITEMS; index++) if (Player.possessions[index] != NULL) { Player.possessions[index]->known = 0; Objects[Player.possessions[index]->id].known = 0; } } else { print2("You feel encyclopaedic."); for (index=0; index<MAXITEMS; index++) if (Player.possessions[index] != NULL) { if (Player.possessions[index]->objchar == FOOD) Player.possessions[index]->known = 1; else { Player.possessions[index]->known = 2; Objects[Player.possessions[index]->id].known = 1; } } for (index=0; index<Player.packptr; index++) if (Player.pack[index] != NULL) { if (Player.pack[index]->objchar == FOOD) Player.pack[index]->known = 1; else { Player.pack[index]->known = 2; Objects[Player.pack[index]->id].known = 1; } } } calc_melee(); }
void make_hp(pob o) { print1("A full-scale heavenly choir chants \'Hallelujah\' all around you!"); print2("You notice a change in the symbol you carry..."); switch(Player.patron) { case ODIN: *o = Objects[ARTIFACTID + 14]; break; case SET: *o = Objects[ARTIFACTID + 17]; break; case ATHENA: *o = Objects[ARTIFACTID + 16]; break; case HECATE: *o = Objects[ARTIFACTID + 15]; break; case DRUID: *o = Objects[ARTIFACTID + 18]; break; case DESTINY: *o = Objects[ARTIFACTID + 19]; break; } o->known = 2; /* Random hack to convey bit that symbol is functional */ o->charge = 17; morewait(); if(Player.patron == DRUID) { print1("Your deity raises you to the post of Archdruid!"); } else { print1("You deity raises you to the post of High Priest!"); } print2("You feel holy."); strcpy(Priest[Player.patron], Player.name); Priestlevel[Player.patron] = Player.level; Player.rank[PRIESTHOOD] = HIGHPRIEST; morewait(); learnclericalspells(Player.patron, HIGHPRIEST); }
void l_escalator(void) { print1("You have found an extremely long stairway going straight up."); print2("The stairs are grilled steel and the bannister is rubber."); morewait(); print1("Take the stairway? [yn] "); if (ynq1()=='y') { print1("The stairs suddenly start moving with a grind of gears!"); print2("You are wafted to the surface...."); change_environment(E_COUNTRYSIDE); } }
void l_rubble(void) { int screwup = random_range(100) - (Player.agi + Player.level); print1("You climb over the unstable pile of rubble...."); if (screwup < 0) print2("No problem!"); else { print2("You tumble and fall in a small avalanche of debris!"); print3("You're trapped in the pile!"); Player.status[IMMOBILE]+=2; p_damage(screwup/5,UNSTOPPABLE,"rubble and debris"); morewait(); } }
void sprint_decl1 (char *s, size_t *len, IDENT *i, BOOLEAN print_semicolon) { CTYPE *ctype = i->ctype; #ifndef NDEBUG assert_ctype_valid(ctype); #endif /* We don't want to print anything if i is a forward reference, since a forward reference (although creating an entry in the symbol table) is not a declaration. */ #ifndef NDEBUG if (i->forward) assertion_failed("tried to print forward reference %s", i->name); if (ctype == NULL) assertion_failed("identifier has null ctype"); #endif /* Only print something if there is anything worth printing. */ if (!i->defaulted || i->sclass != UND || ctype->uclass != ERR || i->initializer != NULL) { char *t; /* Print sclass (ie storage class, eg register). */ t = sclass_string1(i->sclass); if (strcmp(t, "") != 0) { print1(s, len, t); print2(s, len, " ", 1); } /* Print uclass (ie signed/unsigned). */ t = uclass_string(ctype->uclass); if (strcmp(t, "") != 0) { print1(s, len, t); print2(s, len, " ", 1); } /* Print rest of declaration. */ sprint_decl2(s, len, i); if (print_semicolon) print2(s, len, ";", 1); } }
/* Increase in level at appropriate experience gain */ void gain_level(void) { int gained=FALSE; int hp_gain; /* FIXED! 12/30/98 */ if (gamestatusp(SUPPRESS_PRINTING)) return; while (expval(Player.level+1) <= Player.xp) { if (!gained) morewait(); gained = TRUE; Player.level++; print1("You have attained a new experience level!"); print2("You are now "); nprint2(getarticle(levelname(Player.level))); nprint2(levelname(Player.level)); hp_gain = random_range(Player.con)+1; /* start fix 12/30/98 */ if (Player.hp < Player.maxhp ) Player.hp += hp_gain*Player.hp/Player.maxhp; else if (Player.hp < Player.maxhp + hp_gain) Player.hp = Player.maxhp + hp_gain; /* else leave current hp alone */ Player.maxhp += hp_gain; Player.maxmana = calcmana(); /* If the character was given a bonus, let him keep it. Otherwise * recharge him. */ Player.mana = max(Player.mana, Player.maxmana); /* end fix 12/30/98 */ morewait(); } if (gained) clearmsg(); calc_melee(); }
void omegan_character_stats(void) { int share1,share2,i=0; print1("To reroll hit ESCAPE; hit any other key to accept these stats."); do { i++; #if REROLLS == -1 sprintf(Str1, "Generated character # %d", i ); #else sprintf(Str1, "You have only %d chance%s to reroll... ", REROLLS - i, (i == (REROLLS-1) ) ? "":"s"); #endif print2(Str1); Player.iq = Player.maxiq = 4 + random_range(5)+ (share1 = random_range(6)) + (share2 = random_range(6)); Player.pow = Player.maxpow = 4 + random_range(5) + share1 +share2; Player.dex = Player.maxdex = 4 + random_range(5)+ (share1 = random_range(6)) + (share2 = random_range(6)); Player.agi = Player.maxagi = 4 + random_range(5) + share1 +share2; Player.str = Player.maxstr = 4 + random_range(5)+ (share1 = random_range(6)) + (share2 = random_range(6)); Player.con = Player.maxcon = 4 + random_range(5) + share1 +share2; Player.cash = random_range(100)+random_range(100)+ random_range(100)+random_range(100)+random_range(100); Player.hp=Player.maxhp=Player.con; Player.mana=Player.maxmana = calcmana(); calc_melee(); dataprint(); #if REROLLS == -1 } while (mgetc() == ESCAPE); #else }
int initstats(void) { char response; char savedg[80]; print1("Do you want to run a character [c], load a game [l], or "); print2("play yourself [p]?"); /* RM 04-19-2000 loading patch */ do response = (char) mcigetc(); while ((response!='c')&&(response != 'p')&&(response !='l')); if (response == 'c') omegan_character_stats(); else if (response == 'l') { /* RM 04-19-2000: loading patch - a blatant hack */ clearmsg(); print1("Enter saved game name: "); strcpy(savedg,msgscanstring()); game_restore(savedg); return true; } else { clearmsg(); /* RM 04-19-2000 loading patch - fix the display */ user_character_stats(); user_intro(); print1("Do you want to save this set-up to .omegarc in your home directory? [yn] "); if (ynq1()=='y') save_omegarc(); } xredraw(); return false; }
int main() { char s[10]; struct node *t; int m; int a; scanf("%d", &m); t=(struct node*)malloc(sizeof(struct node)*m); int count=0; for(int i=0; i<m; i++){ scanf("%s", &s); if(s[0]=='i'){ scanf("%d", &a); insert(t, count, a); count++; } if(s[0]=='p'){ if(count>0) print1(t, 0); printf("\n"); if(count>0) print2(t, 0); printf("\n"); } } return 0; }
int main() { print1(1, 2, 3); print2(1, 2, 3); auto pack = make_argpack<C>(1, 2); std::cout << type_name<decltype(pack)>() << std::endl; auto arg = pack.get<G, float>(); std::cout << type_name<decltype(arg)>() << std::endl; pack.call<G, float>(print3); auto f = [] {}; std::cout << type_name<decltype(f)>() << std::endl; auto &_pack = pack; std::cout << type_name<decltype(_pack)>() << std::endl; std::cout << type_name<decltype(std::move(_pack))>() << std::endl; std::cout << type_name<decltype(make_argpack<C>())>() << std::endl; std::cout << type_name<decltype(make_argpack<C>(std::declval<int>(), std::declval<int&>(), std::declval<int&&>()))>() << std::endl; int i = 0; int &ia = i; int &&iaa = std::move(i); make_argpack<C>(std::move(iaa), ia, i, ([] {return 0;})()); }
void healforpay(void) { if (Player.cash < 50) print2("You can't afford to be healed!"); else { Player.cash -= 50; if (Player.hp < Player.maxhp ) { Player.hp += 20+random_range(20); if (Player.hp > Player.maxhp) Player.hp = Player.maxhp; } print2("Another medical marvel...."); } dataprint(); }
int main(int argc, char **argv) { print1(); print2(); return 0; }
void __init() { __name__ = new str("__main__"); a = (new set<__ss_int>((new list<__ss_int>(2,1,2)))); a->add(3); print2(NULL,0,1, a); }
void l_voidstone(void) { int i; print1("This is a grey and uninteresting stone."); print2("A feeling of nihility emanates from it."); morewait(); clearmsg(); if (cinema_confirm("You're about to touch it.")=='y') { print1("You feel negated."); morewait(); Player.mana = 0; toggle_item_use(TRUE); for(i=0;i<NUMSTATI;i++) Player.status[i] = 0; for(i=0;i<MAXITEMS;i++) if (Player.possessions[i] != NULL) { Player.possessions[i]->blessing = 0; Player.possessions[i]->plus = 0; Player.possessions[i]->usef = I_NOTHING; } toggle_item_use(FALSE); calc_melee(); } else print1("You back away from the strange rock."); }
void l_enter_circle(void) { print1("You see a translucent stairway before you, leading down."); print2("Take it? [yn] "); if (ynq()=='y') change_environment(E_CIRCLE); }
void l_whirlwind(void) { print1("Buffeting winds swirl you up!"); p_damage(random_range(difficulty()*10),NORMAL_DAMAGE,"a magic whirlwind"); if (random_range(2)) { print2("You are jolted by lightning!"); p_damage(random_range(difficulty()*10),ELECTRICITY,"a magic whirlwind"); } morewait(); if (random_range(2)) { print1("The whirlwind carries you off...."); if (random_range(20)==17) print2("'I don't think we're in Kansas anymore, toto.'"); p_teleport(0); } }
void l_void(void) { clearmsg(); print1("Geronimo!"); morewait(); clearmsg(); print1("You leap into the void."); if (Level->mlist) { print2("Death peers over the edge and gazes quizzically at you...."); morewait(); print3("'Bye-bye,' he says... 'We'll meet again.'"); } morewait(); while(Player.hp>0) { Time+=60; hourly_check(); /* WDT: GCC doesn't like usleep being included from unistd.h when it's * checking for ANSI compliance. That's the stupidest thing I've seen, * but I wasn't offered a choice -- the man pages don't document any other * options. * Fortunately, this is a bad use of usleep, so commenting it out won't * hurt the game, and might even help it. */ /* usleep(250000);*/ } }