turn_see is a daemon!

This commit is contained in:
jl777
2019-03-13 07:31:47 -11:00
parent 8f18bbbed5
commit 827d8f54f8
7 changed files with 64 additions and 60 deletions

View File

@@ -345,7 +345,7 @@ over:
if (wizard) if (wizard)
{ {
wizard = FALSE; wizard = FALSE;
turn_see(TRUE); turn_see(rs,TRUE);
msg(rs,"not wizard any more"); msg(rs,"not wizard any more");
} }
else else
@@ -354,7 +354,7 @@ over:
if (wizard) if (wizard)
{ {
noscore = TRUE; noscore = TRUE;
turn_see(FALSE); turn_see(rs,FALSE);
msg(rs,"you are suddenly as smart as Ken Arnold in dungeon #%d", dnum); msg(rs,"you are suddenly as smart as Ken Arnold in dungeon #%d", dnum);
} }
else else
@@ -404,7 +404,7 @@ over:
when CTRL('T'): teleport(); when CTRL('T'): teleport();
when CTRL('E'): msg(rs,"food left: %d", food_left); when CTRL('E'): msg(rs,"food left: %d", food_left);
when CTRL('C'): add_pass(); when CTRL('C'): add_pass();
when CTRL('X'): turn_see(on(player, SEEMONST)); when CTRL('X'): turn_see(rs,on(player, SEEMONST));
when CTRL('~'): when CTRL('~'):
{ {
THING *item; THING *item;

View File

@@ -314,3 +314,48 @@ land(struct rogue_state *rs,int arg)
msg(rs,choose_str("bummer! You've hit the ground", msg(rs,choose_str("bummer! You've hit the ground",
"you float gently to 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;
}

View File

@@ -404,18 +404,18 @@ add_haste(struct rogue_state *rs,bool potion)
{ {
if (on(player, ISHASTE)) if (on(player, ISHASTE))
{ {
no_command += rnd(8); no_command += rnd(8);
player.t_flags &= ~(ISRUN|ISHASTE); player.t_flags &= ~(ISRUN|ISHASTE);
extinguish(nohaste); extinguish(nohaste);
msg(rs,"you faint from exhaustion"); msg(rs,"you faint from exhaustion");
return FALSE; return FALSE;
} }
else else
{ {
player.t_flags |= ISHASTE; player.t_flags |= ISHASTE;
if (potion) if (potion)
fuse(nohaste, 0, rnd(4)+4, AFTER); fuse(nohaste, 0, rnd(4)+4, AFTER);
return TRUE; return TRUE;
} }
} }

View File

@@ -105,7 +105,7 @@ new_level(struct rogue_state *rs)
enter_room(rs,&hero); enter_room(rs,&hero);
mvaddch(hero.y, hero.x, PLAYER); mvaddch(hero.y, hero.x, PLAYER);
if (on(player, SEEMONST)) if (on(player, SEEMONST))
turn_see(FALSE); turn_see(rs,FALSE);
if (on(player, ISHALU)) if (on(player, ISHALU))
visuals(rs,0); visuals(rs,0);
} }

View File

@@ -125,8 +125,8 @@ quaff(struct rogue_state *rs)
msg(rs,"you feel stronger, now. What bulging muscles!"); msg(rs,"you feel stronger, now. What bulging muscles!");
when P_MFIND: when P_MFIND:
player.t_flags |= SEEMONST; player.t_flags |= SEEMONST;
fuse((void(*)(struct rogue_state *rs,int))turn_see, TRUE, HUHDURATION, AFTER); fuse(turn_see, TRUE, HUHDURATION, AFTER);
if (!turn_see(FALSE)) if (!turn_see(rs,FALSE))
msg(rs,"you have a %s feeling for a moment, then it passes", msg(rs,"you have a %s feeling for a moment, then it passes",
choose_str("normal", "strange")); choose_str("normal", "strange"));
when P_TFIND: when P_TFIND:
@@ -172,7 +172,7 @@ quaff(struct rogue_state *rs)
if (!trip) if (!trip)
{ {
if (on(player, SEEMONST)) if (on(player, SEEMONST))
turn_see(FALSE); turn_see(rs,FALSE);
start_daemon(visuals, 0, BEFORE); start_daemon(visuals, 0, BEFORE);
seenstairs = seen_stairs(); seenstairs = seen_stairs();
} }
@@ -282,47 +282,6 @@ invis_on()
mvaddch(mp->t_pos.y, mp->t_pos.x, mp->t_disguise); 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: * seen_stairs:

View File

@@ -771,7 +771,7 @@ bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl);
bool see_monst(THING *mp); bool see_monst(THING *mp);
bool seen_stairs(void); bool seen_stairs(void);
bool turn_ok(int y, int x); 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); bool is_current(struct rogue_state *rs,THING *obj);
int passwd(void); int passwd(void);

View File

@@ -1263,8 +1263,8 @@ UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
if ( P.amulet != 0 ) if ( P.amulet != 0 )
mult *= 5; mult *= 5;
dungeonlevel = P.dungeonlevel; dungeonlevel = P.dungeonlevel;
if ( P.amulet != 0 && dungeonlevel < 21 ) if ( P.amulet != 0 && dungeonlevel < 26 )
dungeonlevel = 21; dungeonlevel = 26;
cashout = (uint64_t)P.gold * P.gold * mult * dungeonlevel; 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); 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 ) if ( funcid == 'H' && maxplayers > 1 )