FastAreaVisGump.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2005  The Pentagram Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #include "pent_include.h"
00020 #include "FastAreaVisGump.h"
00021 #include "GUIApp.h"
00022 #include "World.h"
00023 #include "CurrentMap.h"
00024 #include "RenderSurface.h"
00025 
00026 DEFINE_RUNTIME_CLASSTYPE_CODE(FastAreaVisGump,Gump);
00027 
00028 FastAreaVisGump::FastAreaVisGump(void) : Gump(0,0,MAP_NUM_CHUNKS+2,MAP_NUM_CHUNKS+2,0,FLAG_DRAGGABLE|FLAG_DONT_SAVE,LAYER_NORMAL)
00029 {
00030 }
00031 
00032 FastAreaVisGump::~FastAreaVisGump(void)
00033 {
00034 }
00035 
00036 void FastAreaVisGump::PaintThis(RenderSurface* surf, sint32 lerp_factor, bool scaled)
00037 {
00038         World *world = World::get_instance();
00039         CurrentMap *currentmap = world->getCurrentMap();
00040 
00041         surf->Fill32(0xFF0000,0,0,MAP_NUM_CHUNKS+2,MAP_NUM_CHUNKS+2);
00042         surf->Fill32(0,1,1,MAP_NUM_CHUNKS,MAP_NUM_CHUNKS);
00043 
00044 
00045         for (int y = 0; y < MAP_NUM_CHUNKS; y++)
00046                 for (int x = 0; x < MAP_NUM_CHUNKS; x++)
00047                         if (currentmap->isChunkFast(x,y)) surf->Fill32(0xFFFFFFFF,x+1,y+1,1,1);
00048 }
00049 
00050 void FastAreaVisGump::ConCmd_toggle(const Console::ArgvType &argv)
00051 {
00052         GUIApp *app = GUIApp::get_instance();
00053         Gump *desktop = app->getDesktopGump();
00054         Gump *favg = desktop->FindGump(FastAreaVisGump::ClassType);
00055 
00056         if (!favg) {
00057                 favg = new FastAreaVisGump;
00058                 favg->InitGump(0);
00059                 favg->setRelativePosition(TOP_RIGHT, -4, 4);
00060         }
00061         else {
00062                 favg->Close();
00063         }
00064 }
00065 
00066 uint16 FastAreaVisGump::TraceObjId(int mx, int my)
00067 {
00068         uint16 objid = Gump::TraceObjId(mx,my);
00069 
00070         if (!objid || objid == 65535)
00071                 if (PointOnGump(mx,my))
00072                         objid = getObjId();
00073 
00074         return objid;
00075 }

Generated on Fri Jul 27 22:27:14 2007 for pentagram by  doxygen 1.4.7