From 827d8f54f8b8c9d7420584efffa90da3fc80d8c0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 13 Mar 2019 07:31:47 -1100 Subject: [PATCH] turn_see is a daemon! --- src/cc/rogue/command.c | 6 ++--- src/cc/rogue/daemons.c | 45 ++++++++++++++++++++++++++++++++++++++ src/cc/rogue/misc.c | 18 +++++++-------- src/cc/rogue/new_level.c | 2 +- src/cc/rogue/potions.c | 47 +++------------------------------------- src/cc/rogue/rogue.h | 2 +- src/cc/rogue_rpc.cpp | 4 ++-- 7 files changed, 64 insertions(+), 60 deletions(-) diff --git a/src/cc/rogue/command.c b/src/cc/rogue/command.c index d9fc266c2..c57c0615f 100644 --- a/src/cc/rogue/command.c +++ b/src/cc/rogue/command.c @@ -345,7 +345,7 @@ over: if (wizard) { wizard = FALSE; - turn_see(TRUE); + turn_see(rs,TRUE); msg(rs,"not wizard any more"); } else @@ -354,7 +354,7 @@ over: if (wizard) { noscore = TRUE; - turn_see(FALSE); + turn_see(rs,FALSE); msg(rs,"you are suddenly as smart as Ken Arnold in dungeon #%d", dnum); } else @@ -404,7 +404,7 @@ over: when CTRL('T'): teleport(); when CTRL('E'): msg(rs,"food left: %d", food_left); when CTRL('C'): add_pass(); - when CTRL('X'): turn_see(on(player, SEEMONST)); + when CTRL('X'): turn_see(rs,on(player, SEEMONST)); when CTRL('~'): { THING *item; diff --git a/src/cc/rogue/daemons.c b/src/cc/rogue/daemons.c index 71a3789a9..c9c16448d 100644 --- a/src/cc/rogue/daemons.c +++ b/src/cc/rogue/daemons.c @@ -314,3 +314,48 @@ land(struct rogue_state *rs,int arg) msg(rs,choose_str("bummer! You've hit the ground", "you float gently to the ground")); } + +/* + * turn_see: + * Put on or off seeing monsters on this level + */ +bool +turn_see(struct rogue_state *rs,bool turn_off) +{ + THING *mp; + bool can_see, add_new; + if ( rs->logfp != 0 ) + fprintf(rs->logfp,"turn_see\n"); + + add_new = FALSE; + for (mp = mlist; mp != NULL; mp = next(mp)) + { + move(mp->t_pos.y, mp->t_pos.x); + can_see = see_monst(mp); + if (turn_off) + { + if (!can_see) + addch(mp->t_oldch); + } + else + { + if (!can_see) + standout(); + if (!on(player, ISHALU)) + addch(mp->t_type); + else + addch(rnd(26) + 'A'); + if (!can_see) + { + standend(); + add_new ^= 1;//add_new++; + } + } + } + if (turn_off) + player.t_flags &= ~SEEMONST; + else + player.t_flags |= SEEMONST; + return add_new; +} + diff --git a/src/cc/rogue/misc.c b/src/cc/rogue/misc.c index 8a4d1df94..5f9a89dcc 100644 --- a/src/cc/rogue/misc.c +++ b/src/cc/rogue/misc.c @@ -404,18 +404,18 @@ add_haste(struct rogue_state *rs,bool potion) { if (on(player, ISHASTE)) { - no_command += rnd(8); - player.t_flags &= ~(ISRUN|ISHASTE); - extinguish(nohaste); - msg(rs,"you faint from exhaustion"); - return FALSE; + no_command += rnd(8); + player.t_flags &= ~(ISRUN|ISHASTE); + extinguish(nohaste); + msg(rs,"you faint from exhaustion"); + return FALSE; } else { - player.t_flags |= ISHASTE; - if (potion) - fuse(nohaste, 0, rnd(4)+4, AFTER); - return TRUE; + player.t_flags |= ISHASTE; + if (potion) + fuse(nohaste, 0, rnd(4)+4, AFTER); + return TRUE; } } diff --git a/src/cc/rogue/new_level.c b/src/cc/rogue/new_level.c index ca0e5efb3..c7f08ff28 100644 --- a/src/cc/rogue/new_level.c +++ b/src/cc/rogue/new_level.c @@ -105,7 +105,7 @@ new_level(struct rogue_state *rs) enter_room(rs,&hero); mvaddch(hero.y, hero.x, PLAYER); if (on(player, SEEMONST)) - turn_see(FALSE); + turn_see(rs,FALSE); if (on(player, ISHALU)) visuals(rs,0); } diff --git a/src/cc/rogue/potions.c b/src/cc/rogue/potions.c index 4e818f0ec..56261118b 100644 --- a/src/cc/rogue/potions.c +++ b/src/cc/rogue/potions.c @@ -125,8 +125,8 @@ quaff(struct rogue_state *rs) msg(rs,"you feel stronger, now. What bulging muscles!"); when P_MFIND: player.t_flags |= SEEMONST; - fuse((void(*)(struct rogue_state *rs,int))turn_see, TRUE, HUHDURATION, AFTER); - if (!turn_see(FALSE)) + fuse(turn_see, TRUE, HUHDURATION, AFTER); + if (!turn_see(rs,FALSE)) msg(rs,"you have a %s feeling for a moment, then it passes", choose_str("normal", "strange")); when P_TFIND: @@ -172,7 +172,7 @@ quaff(struct rogue_state *rs) if (!trip) { if (on(player, SEEMONST)) - turn_see(FALSE); + turn_see(rs,FALSE); start_daemon(visuals, 0, BEFORE); seenstairs = seen_stairs(); } @@ -282,47 +282,6 @@ invis_on() mvaddch(mp->t_pos.y, mp->t_pos.x, mp->t_disguise); } -/* - * turn_see: - * Put on or off seeing monsters on this level - */ -bool -turn_see(bool turn_off) -{ - THING *mp; - bool can_see, add_new; - - add_new = FALSE; - for (mp = mlist; mp != NULL; mp = next(mp)) - { - move(mp->t_pos.y, mp->t_pos.x); - can_see = see_monst(mp); - if (turn_off) - { - if (!can_see) - addch(mp->t_oldch); - } - else - { - if (!can_see) - standout(); - if (!on(player, ISHALU)) - addch(mp->t_type); - else - addch(rnd(26) + 'A'); - if (!can_see) - { - standend(); - add_new ^= 1;//add_new++; - } - } - } - if (turn_off) - player.t_flags &= ~SEEMONST; - else - player.t_flags |= SEEMONST; - return add_new; -} /* * seen_stairs: diff --git a/src/cc/rogue/rogue.h b/src/cc/rogue/rogue.h index dac2b63a3..2a5b39bf9 100644 --- a/src/cc/rogue/rogue.h +++ b/src/cc/rogue/rogue.h @@ -771,7 +771,7 @@ bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl); bool see_monst(THING *mp); bool seen_stairs(void); bool turn_ok(int y, int x); -bool turn_see(bool turn_off); +bool turn_see(struct rogue_state *rs,bool turn_off); bool is_current(struct rogue_state *rs,THING *obj); int passwd(void); diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index c10e03757..196bc645a 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -1263,8 +1263,8 @@ UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *param if ( P.amulet != 0 ) mult *= 5; dungeonlevel = P.dungeonlevel; - if ( P.amulet != 0 && dungeonlevel < 21 ) - dungeonlevel = 21; + if ( P.amulet != 0 && dungeonlevel < 26 ) + dungeonlevel = 26; cashout = (uint64_t)P.gold * P.gold * mult * dungeonlevel; fprintf(stderr,"\nextracted $$$gold.%d -> %.8f ROGUE hp.%d strength.%d/%d level.%d exp.%d dl.%d n.%d amulet.%d\n",P.gold,(double)cashout/COIN,P.hitpoints,P.strength&0xffff,P.strength>>16,P.level,P.experience,P.dungeonlevel,n,P.amulet); if ( funcid == 'H' && maxplayers > 1 )