GameMapGump.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2003-2004  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 #ifndef GAMEMAPGUMP_H_INCLUDED
00020 #define GAMEMAPGUMP_H_INCLUDED
00021 
00022 #include "Gump.h"
00023 #include <vector>
00024 
00025 class ItemSorter;
00026 class CameraProcess;
00027 
00028 class GameMapGump : public Gump
00029 {
00030 protected:
00031         ItemSorter              *display_list;
00032 
00033 public:
00034         ENABLE_RUNTIME_CLASSTYPE();
00035 
00036         GameMapGump();
00037         GameMapGump(int x, int y, int w, int h);
00038         virtual ~GameMapGump();
00039 
00040         virtual bool            Run(const uint32 framenum);
00041 
00042         virtual void            PaintThis(RenderSurface *surf, sint32 lerp_factor, bool scaled);
00043 
00044         void                            GetCameraLocation(sint32& x, sint32& y, sint32& z,
00045                                                                                   int lerp_factor=256);
00046 
00047         // Trace a click, and return ObjId (parent coord space)
00048         virtual uint16          TraceObjId(int mx, int my);
00049 
00050         // Trace a click, return ObjId, and the coordinates of the mouse click (gump coord space)
00051         virtual uint16          TraceCoordinates(int mx, int my, sint32 coords[3],
00052                                                                                  int offsetx = 0, int offsety = 0,
00053                                                                                  Item* item = 0);
00054 
00055         // Get the location of an item in the gump (coords relative to this).
00056         // Returns false on failure
00057         virtual bool            GetLocationOfItem(uint16 itemid, int &gx, int &gy,
00058                                                                                   sint32 lerp_factor = 256);
00059 
00060         virtual bool            StartDraggingItem(Item* item, int mx, int my);
00061         virtual bool            DraggingItem(Item* item, int mx, int my);
00062         virtual void            DraggingItemLeftGump(Item* item);
00063         virtual void            StopDraggingItem(Item* item, bool moved);
00064         virtual void            DropItem(Item* item, int mx, int my);
00065 
00066         virtual Gump *          OnMouseDown(int button, int mx, int my);
00067         virtual void            OnMouseUp(int button, int mx, int my);
00068         virtual void            OnMouseClick(int button, int mx, int my);
00069         virtual void            OnMouseDouble(int button, int mx, int my);
00070 
00071         void IncSortOrder(int count);
00072 
00073         bool loadData(IDataSource* ids, uint32 version);
00074 
00075         static void                     SetHighlightItems(bool highlight) { highlightItems = highlight; }
00076         static bool                     isHighlightItems() { return highlightItems; }
00077 
00078         static void ConCmd_toggleHighlightItems(const Console::ArgvType &argv);
00079         static void ConCmd_dumpMap(const Console::ArgvType &argv);
00080 
00081         virtual void            RenderSurfaceChanged();
00082 
00083 protected:
00084         virtual void saveData(ODataSource* ods);
00085 
00086         bool display_dragging;
00087         uint32 dragging_shape;
00088         uint32 dragging_frame;
00089         uint32 dragging_flags;
00090         sint32 dragging_pos[3];
00091 
00092         static bool highlightItems;
00093 
00094 };
00095 
00096 #endif //GameMapGUMP_H_INCLUDED
00097 

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