ordinfo.h

Go to the documentation of this file.
00001 
00007 /*
00008 Copyright (C) 2000 The Exult Team
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 */
00024 
00025 #ifndef INCL_ORDINFO
00026 #define INCL_ORDINFO  1
00027 
00028 /*
00029  *  Information about an object used during render-order comparison (lt()):
00030  */
00031 class Ordering_info
00032   {
00033 public:
00034   Rectangle area;     // Area (pixels) rel. to screen.
00035   Shape_info& info;   // Info. about shape.
00036   int tx, ty, tz;     // Absolute tile coords.
00037   int xs, ys, zs;     // Tile dimensions.
00038 #if 1 /* For experimental compare(). */
00039   int xleft, xright, ynear, yfar, zbot, ztop;
00040 #endif
00041 private:
00042   void init(const Game_object *obj)
00043     {
00044     Tile_coord t = obj->get_tile();
00045     tx = t.tx; ty = t.ty; tz = t.tz;
00046     int frnum = obj->get_framenum();
00047     xs = info.get_3d_xtiles(frnum);
00048     ys = info.get_3d_ytiles(frnum);
00049     zs = info.get_3d_height();
00050 #if 1 /* For experimental compare(). */
00051     xleft = tx - xs + 1;
00052     xright = tx;
00053     yfar = ty - ys + 1;
00054     ynear = ty;
00055     ztop = tz + zs - 1;
00056     zbot = tz;
00057     if (!zs)    // Flat?
00058       zbot--;
00059 #endif
00060     }
00061 public:
00062   friend class Game_object;
00063   friend class Map_chunk;
00064           // Create from scratch.
00065   Ordering_info(Game_window *gwin, Game_object *obj)
00066     : area(gwin->get_shape_rect(obj)),
00067       info(obj->get_info())
00068     { init(obj); }
00069   Ordering_info(Game_window *gwin, Game_object *obj, Rectangle& a)
00070     : area(a),
00071       info(obj->get_info())
00072     { init(obj); }
00073   };
00074 
00075 #endif

Generated on Mon Jul 9 14:42:49 2007 for ExultEngine by  doxygen 1.5.1