ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/button.C
(Generate patch)

Comparing deliantra/server/common/button.C (file contents):
Revision 1.36 by root, Sun Jul 1 05:00:17 2007 UTC vs.
Revision 1.40 by root, Thu Nov 8 19:43:23 2007 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or 10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * 20 *
21 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 22 */
23 23
24#include <global.h> 24#include <global.h>
25#include <funcpoint.h> 25#include <funcpoint.h>
26 26
59 object *tmp = ol->ob; 59 object *tmp = ol->ob;
60 60
61 /* if the criteria isn't appropriate, don't do anything */ 61 /* if the criteria isn't appropriate, don't do anything */
62 if (state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_PUSH)) 62 if (state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_PUSH))
63 continue; 63 continue;
64
64 if (!state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_RELEASE)) 65 if (!state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_RELEASE))
65 continue; 66 continue;
66 67
67 switch (tmp->type) 68 switch (tmp->type)
68 { 69 {
69 case GATE: 70 case GATE:
70 case HOLE: 71 case HOLE:
72 if (!tmp->active)
73 tmp->play_sound (tmp->sound
74 ? tmp->sound
75 : sound_find (tmp->type == GATE ? "trigger_gate" : "trigger_hole"));
71 tmp->value = tmp->stats.maxsp ? !state : state; 76 tmp->value = tmp->stats.maxsp ? !state : state;
72 tmp->set_speed (0.5); 77 tmp->set_speed (0.5);
73 break; 78 break;
74 79
75 case CF_HANDLE: 80 case CF_HANDLE:
78 break; 83 break;
79 84
80 case SIGN: 85 case SIGN:
81 if (!tmp->stats.food || tmp->last_eat < tmp->stats.food) 86 if (!tmp->stats.food || tmp->last_eat < tmp->stats.food)
82 { 87 {
88 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_sign"));
83 new_info_map (NDI_UNIQUE | NDI_NAVY, tmp->map, tmp->msg); 89 new_info_map (NDI_UNIQUE | NDI_NAVY, tmp->map, tmp->msg);
84 if (tmp->stats.food) 90 if (tmp->stats.food)
85 tmp->last_eat++; 91 tmp->last_eat++;
86 } 92 }
87 break; 93 break;
88 94
89 case ALTAR: 95 case ALTAR:
96 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_altar"));
90 tmp->value = 1; 97 tmp->value = 1;
91 SET_ANIMATION (tmp, tmp->value); 98 SET_ANIMATION (tmp, tmp->value);
92 update_object (tmp, UP_OBJ_FACE); 99 update_object (tmp, UP_OBJ_FACE);
93 break; 100 break;
94 101
95 case BUTTON: 102 case BUTTON:
96 case PEDESTAL: 103 case PEDESTAL:
104 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_button"));
97 tmp->value = state; 105 tmp->value = state;
98 SET_ANIMATION (tmp, tmp->value); 106 SET_ANIMATION (tmp, tmp->value);
99 update_object (tmp, UP_OBJ_FACE); 107 update_object (tmp, UP_OBJ_FACE);
100 break; 108 break;
101 109
102 case MOOD_FLOOR: 110 case MOOD_FLOOR:
103 do_mood_floor (tmp, source); 111 do_mood_floor (tmp, source);
104 break; 112 break;
105 113
106 case TIMED_GATE: 114 case TIMED_GATE:
115 if (!tmp->active)
116 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_gate"));
107 tmp->set_speed (tmp->arch->speed); 117 tmp->set_speed (tmp->arch->speed);
108 tmp->value = tmp->arch->value; 118 tmp->value = tmp->arch->value;
109 tmp->stats.sp = 1; 119 tmp->stats.sp = 1;
110 tmp->stats.hp = tmp->stats.maxhp; 120 tmp->stats.hp = tmp->stats.maxhp;
111 /* Handle multipart gates. We copy the value for the other parts 121 /* Handle multipart gates. We copy the value for the other parts
140 case CREATOR: 150 case CREATOR:
141 move_creator (tmp); 151 move_creator (tmp);
142 break; 152 break;
143 153
144 case TRIGGER_MARKER: 154 case TRIGGER_MARKER:
155 //tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_marker"));
145 move_marker (tmp); 156 move_marker (tmp);
146 break; 157 break;
147 158
148 case DUPLICATOR: 159 case DUPLICATOR:
149 move_duplicator (tmp); 160 move_duplicator (tmp);
313 */ 324 */
314 325
315int 326int
316check_altar_sacrifice (const object *altar, const object *sacrifice) 327check_altar_sacrifice (const object *altar, const object *sacrifice)
317{ 328{
318 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) && sacrifice->type != PLAYER) 329 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE)
330 && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED)
331 && sacrifice->type != PLAYER)
319 { 332 {
333 if (strcmp (ARCH_SACRIFICE (altar), "money") == 0
334 && sacrifice->type == MONEY
335 && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE (altar))
336 return 1;
337
320 if ((ARCH_SACRIFICE (altar) == sacrifice->arch->archname 338 if ((ARCH_SACRIFICE (altar) == sacrifice->arch->archname
321 || ARCH_SACRIFICE (altar) == sacrifice->name 339 || ARCH_SACRIFICE (altar) == sacrifice->name
322 || ARCH_SACRIFICE (altar) == sacrifice->slaying 340 || ARCH_SACRIFICE (altar) == sacrifice->slaying
323 || (!strcmp (ARCH_SACRIFICE (altar), query_base_name (sacrifice, 0)))) 341 || strstr (query_base_name (sacrifice, 0), ARCH_SACRIFICE (altar)))
324 && NROF_SACRIFICE (altar) <= (sacrifice->nrof ? sacrifice->nrof : 1)) 342 && NROF_SACRIFICE (altar) <= (sacrifice->nrof ? sacrifice->nrof : 1))
325 return 1;
326
327 if (strcmp (ARCH_SACRIFICE (altar), "money") == 0
328 && sacrifice->type == MONEY && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE (altar))
329 return 1; 343 return 1;
330 } 344 }
331 345
332 return 0; 346 return 0;
333} 347}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines