|
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 00037 void put_decor(mapstruct *map, char **layout, RMParms *RP) 00038 { 00039 mapstruct *decor_map; 00040 char style_name[256]; 00041 int i, j; 00042 object *new_decor_object; 00043 00044 if (RP->decorstyle[0] == '\0' || !strcmp(RP->decorstyle, "none")) 00045 { 00046 return; 00047 } 00048 00049 snprintf(style_name, sizeof(style_name), "/styles/decorstyles"); 00050 decor_map = find_style(style_name, RP->decorstyle, -1); 00051 00052 if (decor_map == NULL) 00053 { 00054 return; 00055 } 00056 00057 for (i = 0; i < RP->Xsize - 1; i++) 00058 { 00059 for (j = 0; j < RP->Ysize - 1; j++) 00060 { 00061 if (RP->decorchance > 0 && RANDOM() % RP->decorchance) 00062 { 00063 continue; 00064 } 00065 00066 new_decor_object = pick_random_object(decor_map); 00067 00068 if (layout[i][j] == (new_decor_object->type == WALL && QUERY_FLAG(new_decor_object, FLAG_IS_TURNABLE) ? '#' : '\0')) 00069 { 00070 object *this_object = get_object(); 00071 00072 copy_object(new_decor_object, this_object, 0); 00073 this_object->x = i; 00074 this_object->y = j; 00075 00076 if (new_decor_object->type == WALL && QUERY_FLAG(new_decor_object, FLAG_IS_TURNABLE) && surround_flag2(layout, i, j, RP) & (4 | 8)) 00077 { 00078 this_object->direction = 7; 00079 SET_ANIMATION(this_object, (NUM_ANIMATIONS(this_object) / NUM_FACINGS(this_object)) * this_object->direction); 00080 } 00081 00082 insert_ob_in_map(this_object, map, NULL, INS_NO_MERGE | INS_NO_WALK_ON); 00083 } 00084 } 00085 } 00086 }
1.7.4