Browse Source

turn_see is a daemon!

jl777
jl777 5 years ago
parent
commit
827d8f54f8
  1. 6
      src/cc/rogue/command.c
  2. 45
      src/cc/rogue/daemons.c
  3. 18
      src/cc/rogue/misc.c
  4. 2
      src/cc/rogue/new_level.c
  5. 47
      src/cc/rogue/potions.c
  6. 2
      src/cc/rogue/rogue.h
  7. 4
      src/cc/rogue_rpc.cpp

6
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;

45
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;
}

18
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;
}
}

2
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);
}

47
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:

2
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);

4
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 )

Loading…
Cancel
Save