--- deliantra/server/common/button.C 2009/10/12 14:00:57 1.56 +++ deliantra/server/common/button.C 2010/04/11 00:34:05 1.66 @@ -1,9 +1,9 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -54,16 +54,16 @@ * re-loaded. As such, just exit this function if that is the case. */ - if (QUERY_FLAG (ol->ob, FLAG_FREED)) + if (ol->ob->flag [FLAG_FREED]) return; object *tmp = ol->ob; /* if the criteria isn't appropriate, don't do anything */ - if (state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_PUSH)) + if (state && !tmp->flag [FLAG_ACTIVATE_ON_PUSH]) continue; - if (!state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_RELEASE)) + if (!state && !tmp->flag [FLAG_ACTIVATE_ON_RELEASE]) continue; switch (tmp->type) @@ -78,7 +78,7 @@ tmp->set_speed (0.5); break; - case CF_HANDLE: + case T_HANDLE: SET_ANIMATION (tmp, (tmp->value = tmp->stats.maxsp ? !state : state)); update_object (tmp, UP_OBJ_FACE); break; @@ -86,8 +86,13 @@ case SIGN: if (!tmp->stats.food || tmp->last_eat < tmp->stats.food) { - tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_sign")); - new_info_map (NDI_UNIQUE | NDI_NAVY, tmp->map, tmp->msg); + tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("msg_voice")); + + if (originator && originator->contr) + originator->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &tmp->name, &tmp->msg)); + + new_info_map_except (NDI_UNIQUE | NDI_NAVY, tmp->map, originator, tmp->msg); + if (tmp->stats.food) tmp->last_eat++; } @@ -134,7 +139,7 @@ case DIRECTOR: case FIREWALL: - if (!QUERY_FLAG (tmp, FLAG_ANIMATE) && tmp->type == FIREWALL) + if (!tmp->flag [FLAG_ANIMATE] && tmp->type == FIREWALL) move_firewall (tmp); else { @@ -273,6 +278,25 @@ any_down = any_down || tmp->value; } + else if (tmp->type == T_MATCH) + { + tmp->value = 0; + + for (object *ab = tmp->above; ab; ab = ab->above) + { + object *head = ab->head_ (); + + /* Same note regarding move_type for buttons above apply here. */ + if (((ab->move_type & tmp->move_on) || ab->move_type == 0)) + if (match (tmp->slaying, head, tmp, originator)) + { + tmp->value = 1; + break; + } + } + + any_down = any_down || tmp->value; + } } if (any_down) /* If any other buttons were down, force this to remain down */ @@ -324,7 +348,6 @@ * sacrificed. This fixes a bug of trying to put multiple altars/related * objects on the same space that take the same sacrifice. */ - int check_altar_sacrifice (object *altar, object *sacrifice, object *originator) { @@ -334,8 +357,8 @@ if (is_match_expr (ARCH_SACRIFICE (altar))) return match (ARCH_SACRIFICE (altar), altar, originator); - if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) - && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) + if (!sacrifice->flag [FLAG_ALIVE] + && !sacrifice->flag [FLAG_IS_LINKED] && sacrifice->type != PLAYER) { if (ARCH_SACRIFICE (altar) == shstr_money @@ -402,7 +425,7 @@ return 1; } -void +static void trigger_move (object *op, int state, object *originator) /* 1 down and 0 up */ { op->stats.wc = state; @@ -438,7 +461,7 @@ { object *tmp; int push = 0, tot = 0; - int in_movement = op->stats.wc || op->speed; + int in_movement = op->stats.wc || op->has_active_speed (); switch (op->type) { @@ -739,7 +762,7 @@ object *tmp; for (tmp = ms.top; tmp; tmp = tmp->below) - if (QUERY_FLAG (tmp, FLAG_MONSTER)) + if (tmp->flag [FLAG_MONSTER]) break; /* doesn't effect players, and if there is a player on this space, won't also @@ -752,10 +775,10 @@ switch (op->last_sp) { case 0: /* furious--make all monsters mad */ - if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE)) - CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE); + if (tmp->flag [FLAG_UNAGGRESSIVE]) + tmp->clr_flag (FLAG_UNAGGRESSIVE); - if (QUERY_FLAG (tmp, FLAG_FRIENDLY)) + if (tmp->flag [FLAG_FRIENDLY]) { tmp->attack_movement = 0; /* lots of checks here, but want to make sure we don't @@ -774,16 +797,16 @@ break; case 1: /* angry -- get neutral monsters mad */ - if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE) && !QUERY_FLAG (tmp, FLAG_FRIENDLY)) - CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE); + if (tmp->flag [FLAG_UNAGGRESSIVE] && !tmp->flag [FLAG_FRIENDLY]) + tmp->clr_flag (FLAG_UNAGGRESSIVE); break; case 2: /* calm -- pacify unfriendly monsters */ - SET_FLAG (tmp, FLAG_UNAGGRESSIVE); + tmp->set_flag (FLAG_UNAGGRESSIVE); break; case 3: /* make all monsters fall asleep */ - SET_FLAG (tmp, FLAG_SLEEP); + tmp->set_flag (FLAG_SLEEP); break; case 4: /* charm all monsters */ @@ -793,7 +816,7 @@ if (object *pl = source->ms ().player ()) { tmp->set_owner (pl); - SET_FLAG (tmp, FLAG_MONSTER); + tmp->set_flag (FLAG_MONSTER); tmp->stats.exp = 0; @@ -803,7 +826,7 @@ break; case 6: // kill monsters - if (!QUERY_FLAG (tmp, FLAG_FRIENDLY)) + if (!tmp->flag [FLAG_FRIENDLY]) break; // FALL THROUGH