… | |
… | |
273 | update_object (op, UP_OBJ_FACE); |
273 | update_object (op, UP_OBJ_FACE); |
274 | push_button (op); /* Make all other buttons the same */ |
274 | push_button (op); /* Make all other buttons the same */ |
275 | } |
275 | } |
276 | } |
276 | } |
277 | |
277 | |
278 | /* |
|
|
279 | * Updates every button on the map (by calling update_button() for them). |
|
|
280 | */ |
|
|
281 | |
|
|
282 | void |
|
|
283 | update_buttons (maptile *m) |
|
|
284 | { |
|
|
285 | objectlink *ol; |
|
|
286 | oblinkpt *obp; |
|
|
287 | |
|
|
288 | for (obp = m->buttons; obp; obp = obp->next) |
|
|
289 | for (ol = obp->link; ol; ol = ol->next) |
|
|
290 | { |
|
|
291 | if (!ol->ob) |
|
|
292 | { |
|
|
293 | LOG (llevError, "Internal error in update_button (%s (%dx%d), connected %ld).\n", |
|
|
294 | ol->ob ? (const char *) ol->ob->name : "null", ol->ob ? ol->ob->x : -1, ol->ob ? ol->ob->y : -1, obp->value); |
|
|
295 | continue; |
|
|
296 | } |
|
|
297 | |
|
|
298 | if (ol->ob->type == BUTTON || ol->ob->type == PEDESTAL) |
|
|
299 | { |
|
|
300 | update_button (ol->ob); |
|
|
301 | break; |
|
|
302 | } |
|
|
303 | } |
|
|
304 | } |
|
|
305 | |
|
|
306 | void |
278 | void |
307 | use_trigger (object *op) |
279 | use_trigger (object *op) |
308 | { |
280 | { |
309 | |
|
|
310 | /* Toggle value */ |
281 | /* Toggle value */ |
311 | op->value = !op->value; |
282 | op->value = !op->value; |
312 | push_button (op); |
283 | push_button (op); |
313 | } |
284 | } |
314 | |
285 | |
315 | /* |
286 | /* |
316 | * Note: animate_object should be used instead of this, |
287 | * Note: animate_object should be used instead of this, |
317 | * but it can't handle animations in the 8 directions |
288 | * but it can't handle animations in the 8 directions |
318 | */ |
289 | */ |
319 | |
|
|
320 | void |
290 | void |
321 | animate_turning (object *op) /* only one part objects */ |
291 | animate_turning (object *op) /* only one part objects */ |
322 | { |
292 | { |
323 | if (++op->state >= NUM_ANIMATIONS (op) / 8) |
293 | if (++op->state >= NUM_ANIMATIONS (op) / 8) |
324 | op->state = 0; |
294 | op->state = 0; |