--- deliantra/server/common/los.C 2010/05/04 22:26:49 1.70 +++ deliantra/server/common/los.C 2018/12/05 19:03:26 1.78 @@ -1,22 +1,23 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. - * - * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * + * + * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * * 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 * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the Affero GNU General Public License * and the GNU General Public License along with this program. If not, see * . - * + * * The authors can be reached via e-mail to */ @@ -53,7 +54,7 @@ // one los_info for each lightable map space static los_info los[MAP_CLIENT_X][MAP_CLIENT_Y]; -struct point +struct point8 { sint8 x, y; }; @@ -62,7 +63,7 @@ #define QUEUE_LENGTH ((MAP_CLIENT_X + MAP_CLIENT_Y) * 2) // a queue of spaces to calculate -static point queue [QUEUE_LENGTH]; +static point8 queue [QUEUE_LENGTH]; static int q1, q2; // queue start, end /* @@ -87,7 +88,7 @@ l.flags |= flags; - if (expect_false (l.flags & FLG_QUEUED)) + if (ecb_expect_false (l.flags & FLG_QUEUED)) return; l.flags |= FLG_QUEUED; @@ -160,13 +161,13 @@ los_info &l = los[x][y]; - if (expect_true (l.flags & (FLG_XI | FLG_YI))) + if (ecb_expect_true (l.flags & (FLG_XI | FLG_YI))) { l.culled = 1; l.xo = l.yo = l.xe = l.ye = 0; // check contributing spaces, first horizontal - if (expect_true (l.flags & FLG_XI)) + if (ecb_expect_true (l.flags & FLG_XI)) { los_info *xi = &los[x - sign (dx)][y]; @@ -174,9 +175,9 @@ l.culled &= !xi->visible; /* merge input space */ - if (expect_false (xi->xo || xi->yo)) + if (ecb_expect_false (xi->xo || xi->yo)) { - // The X input can provide two main pieces of information: + // The X input can provide two main pieces of information: // 1. Progressive X obscurity. // 2. Recessive Y obscurity. @@ -201,7 +202,7 @@ } // check contributing spaces, last vertical, identical structure - if (expect_true (l.flags & FLG_YI)) + if (ecb_expect_true (l.flags & FLG_YI)) { los_info *yi = &los[x][y - sign (dy)]; @@ -209,9 +210,9 @@ l.culled &= !yi->visible; /* merge input space */ - if (expect_false (yi->yo || yi->xo)) + if (ecb_expect_false (yi->yo || yi->xo)) { - // The Y input can provide two main pieces of information: + // The Y input can provide two main pieces of information: // 1. Progressive Y obscurity. // 2. Recessive X obscurity. @@ -262,7 +263,7 @@ } // Expands by the unit length in each component's current direction. - // If a component has no direction, then it is expanded in both of its + // If a component has no direction, then it is expanded in both of its // positive and negative directions. if (!l.culled) { @@ -353,7 +354,7 @@ change_it (pl->los[ax][ay], atten_table [idistance (ax - dx, ay - dy)]); } -/* add light, by finding all (non-null) nearby light sources, then +/* add light, by finding all (non-null) nearby light sources, then * mark those squares specially. */ static void @@ -400,7 +401,7 @@ ms.update (); sint8 light = ms.light; - if (expect_false (light)) + if (ecb_expect_false (light)) if (light < 0) pass2 = 1; else @@ -442,7 +443,7 @@ ms.update (); sint8 light = ms.light; - if (expect_false (light < 0)) + if (ecb_expect_false (light < 0)) { light = clamp (light - bonus, 0, MAX_DARKNESS); apply_light (pl, dx - pl->viewpoint->x, dy - pl->viewpoint->y, -light, light_atten [light + MAX_LIGHT_RADIUS]); @@ -450,7 +451,7 @@ } } -/* blinded_sight() - sets all viewable squares to blocked except +/* blinded_sight() - sets all viewable squares to blocked except * for the one the central one that the player occupies. A little * odd that you can see yourself (and what your standing on), but * really need for any reasonable game play.