|
Atrinik Server 2.5
|
00001 /************************************************************************ 00002 * Atrinik, a Multiplayer Online Role Playing Game * 00003 * * 00004 * Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team * 00005 * * 00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game) * 00007 * and Crossfire (Multiplayer game for X-windows). * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 * The author can be reached at admin@atrinik.org * 00024 ************************************************************************/ 00025 00030 #include <global.h> 00031 00036 void move_pit(object *op) 00037 { 00038 object *next,*tmp; 00039 00040 /* We're opening */ 00041 if (op->value) 00042 { 00043 /* Opened, let's stop */ 00044 if (--op->stats.wc <= 0) 00045 { 00046 op->stats.wc = 0; 00047 op->speed = 0; 00048 update_ob_speed(op); 00049 SET_FLAG(op, FLAG_WALK_ON); 00050 00051 for (tmp = op->above; tmp != NULL; tmp = next) 00052 { 00053 next = tmp->above; 00054 move_apply(op, tmp, tmp, 0); 00055 } 00056 } 00057 00058 op->state = (uint8) op->stats.wc; 00059 SET_ANIMATION(op, (NUM_ANIMATIONS(op) / NUM_FACINGS(op)) * op->direction + op->state); 00060 update_object(op, UP_OBJ_FACE); 00061 return; 00062 } 00063 00064 /* We're closing */ 00065 CLEAR_FLAG(op, FLAG_WALK_ON); 00066 op->stats.wc++; 00067 00068 if ((int) op->stats.wc >= NUM_ANIMATIONS(op) / NUM_FACINGS(op)) 00069 { 00070 op->stats.wc = NUM_ANIMATIONS(op) / NUM_FACINGS(op) - 1; 00071 } 00072 00073 op->state = (uint8) op->stats.wc; 00074 SET_ANIMATION(op, (NUM_ANIMATIONS(op) / NUM_FACINGS(op)) * op->direction + op->state); 00075 update_object(op, UP_OBJ_FACE); 00076 00077 if ((unsigned char) op->stats.wc == (NUM_ANIMATIONS(op) / NUM_FACINGS(op) - 1)) 00078 { 00079 op->speed = 0; 00080 00081 /* Closed, let's stop */ 00082 update_ob_speed(op); 00083 return; 00084 } 00085 }
1.7.4