ice Warning (trunk only)

This commit is contained in:
nethack.allison
2003-10-13 23:54:41 +00:00
parent bf98bc9fe8
commit 84f667c5a4
4 changed files with 44 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ provide core support for saving of messsage history in save file
the following actions can now be continued after save/restore: digging,
eating, studying, removing armor
hero-created and monster-created ice will eventually melt away
extend Warning to include ice danger
Platform- and/or Interface-Specific New Features

View File

@@ -1983,6 +1983,8 @@ E void FDECL(obj_move_timers, (struct obj *, struct obj *));
E void FDECL(obj_split_timers, (struct obj *, struct obj *));
E void FDECL(obj_stop_timers, (struct obj *));
E void FDECL(spot_stop_timers, (XCHAR_P,XCHAR_P,SHORT_P));
E long FDECL(spot_time_expires, (XCHAR_P,XCHAR_P,SHORT_P));
E long FDECL(spot_time_left, (XCHAR_P,XCHAR_P,SHORT_P));
E boolean FDECL(obj_is_local, (struct obj *));
E void FDECL(save_timers, (int,int,int));
E void FDECL(restore_timers, (int,int,BOOLEAN_P,long));

View File

@@ -1485,6 +1485,19 @@ stillinwater:;
if (trap && !pit)
dotrap(trap, 0); /* fall into arrow trap, etc. */
}
/* Warning alerts you to ice danger */
if (Warning && is_ice(u.ux,u.uy)) {
static const char * const icewarnings[] = {
"The ice seems very soft and slushy.",
"You feel the ice shift beneath you!",
"The ice, is gonna BREAK!", /* The Dead Zone */
};
long time_left = spot_time_left(u.ux, u.uy, MELT_ICE_AWAY);
if (time_left && time_left < 15L)
pline("%s",
(time_left < 5L) ? icewarnings[2] :
(time_left < 10L) ? icewarnings[1] : icewarnings[0]);
}
if((mtmp = m_at(u.ux, u.uy)) && !u.uswallow) {
mtmp->mundetected = mtmp->msleeping = 0;
switch(mtmp->data->mlet) {

View File

@@ -1585,6 +1585,34 @@ short func_index;
}
}
/*
* When is the spot timer of type func_index going to expire?
* Returns 0L if no such timer.
*/
long
spot_time_expires(x,y,func_index)
xchar x,y;
short func_index;
{
timer_element *curr;
long where = (((long)x << 16) | ((long)y));
for (curr = timer_base; curr; curr = curr->next) {
if (curr->kind == TIMER_LEVEL &&
curr->func_index == func_index && curr->arg == (genericptr_t)where)
return curr->timeout;
}
return 0L;
}
long
spot_time_left(x,y,func_index)
xchar x,y;
short func_index;
{
long expires = spot_time_expires(x,y,func_index);
return (expires > 0L) ? expires - monstermoves : 0L;
}
/* Insert timer into the global queue */
STATIC_OVL void