summaryrefslogtreecommitdiffhomepage
path: root/Stars45/MapView.h
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/MapView.h')
-rw-r--r--Stars45/MapView.h470
1 files changed, 247 insertions, 223 deletions
diff --git a/Stars45/MapView.h b/Stars45/MapView.h
index f2afdd0..0c49bd8 100644
--- a/Stars45/MapView.h
+++ b/Stars45/MapView.h
@@ -1,223 +1,247 @@
-/* Project Starshatter 4.5
- Destroyer Studios LLC
- Copyright © 1997-2004. All Rights Reserved.
-
- SUBSYSTEM: Stars.exe
- FILE: MapView.h
- AUTHOR: John DiCamillo
-
-
- OVERVIEW
- ========
- Star Map class
-*/
-
-#ifndef MapView_h
-#define MapView_h
-
-#include "Types.h"
-#include "SimObject.h"
-#include "View.h"
-#include "EventTarget.h"
-#include "Bitmap.h"
-#include "List.h"
-#include "Text.h"
-
-// +--------------------------------------------------------------------+
-
-class ActiveWindow;
-class StarSystem;
-class Orbital;
-class OrbitalRegion;
-class Ship;
-class Instruction;
-class Mission;
-class MissionElement;
-class Campaign;
-class Combatant;
-class CombatGroup;
-class Menu;
-class MenuItem;
-class MenuView;
-class Font;
-
-const int EID_MAP_CLICK = 1000;
-
-// +--------------------------------------------------------------------+
-
-class MapView : public View,
-public EventTarget,
-public SimObserver
-{
-public:
- MapView(Window* win);
- virtual ~MapView();
-
- // Operations:
- virtual void Refresh();
- virtual void OnWindowMove();
- virtual void OnShow();
- virtual void OnHide();
-
- virtual void DrawTitle();
- virtual void DrawGalaxy();
- virtual void DrawSystem();
- virtual void DrawRegion();
-
- virtual void DrawGrid();
- virtual void DrawOrbital(Orbital& orbital, int index);
- virtual void DrawShip(Ship& ship, bool current=false, int rep=3);
- virtual void DrawElem(MissionElement& elem, bool current=false, int rep=3);
- virtual void DrawNavRoute(OrbitalRegion* rgn,
- List<Instruction>& route,
- Color smarker,
- Ship* ship=0,
- MissionElement* elem=0);
-
- virtual void DrawCombatantSystem(Combatant* c, Orbital* rgn, int x, int y, int r);
- virtual void DrawCombatGroupSystem(CombatGroup* g, Orbital* rgn, int x1, int x2, int& y, int a);
- virtual void DrawCombatGroup(CombatGroup* g, int rep=3);
-
- virtual int GetViewMode() const { return view_mode; }
- virtual void SetViewMode(int mode);
- virtual void SetSelectionMode(int mode);
- virtual int GetSelectionMode() const { return seln_mode; }
- virtual void SetSelection(int index);
- virtual void SetSelectedShip(Ship* ship);
- virtual void SetSelectedElem(MissionElement* elem);
- virtual void SetRegion(OrbitalRegion* rgn);
- virtual void SetRegionByName(const char* rgn_name);
- virtual void SelectAt(int x, int y);
- virtual Orbital* GetSelection();
- virtual Ship* GetSelectedShip();
- virtual MissionElement* GetSelectedElem();
- virtual int GetSelectionIndex();
- virtual void SetShipFilter(DWORD f) { ship_filter = f; }
-
- // Event Target Interface:
- virtual int OnMouseMove(int x, int y);
- virtual int OnLButtonDown(int x, int y);
- virtual int OnLButtonUp(int x, int y);
- virtual int OnClick();
- virtual int OnRButtonDown(int x, int y);
- virtual int OnRButtonUp(int x, int y);
-
- virtual bool IsEnabled() const;
- virtual bool IsVisible() const;
- virtual bool IsFormActive() const;
- virtual Rect TargetRect() const;
-
- void ZoomIn();
- void ZoomOut();
-
- void SetGalaxy(List<StarSystem>& systems);
- void SetSystem(StarSystem* s);
- void SetMission(Mission* m);
- void SetShip(Ship* s);
- void SetCampaign(Campaign* c);
-
- bool IsVisible(const Point& loc);
-
- // accessors:
- virtual void GetClickLoc(double& x, double& y) { x = click_x; y = click_y; }
- List<StarSystem>& GetGalaxy() { return system_list; }
- StarSystem* GetSystem() const { return system; }
- OrbitalRegion* GetRegion() const;
-
- virtual bool Update(SimObject* obj);
- virtual const char* GetObserverName() const { return "MapWin"; }
-
- bool GetEditorMode() const { return editor; }
- void SetEditorMode(bool b) { editor = b; }
-
-protected:
- virtual void BuildMenu();
- virtual void ClearMenu();
- virtual void ProcessMenuItem(int action);
- virtual bool SetCapture();
- virtual bool ReleaseCapture();
-
- virtual void DrawTabbedText(Font* font, const char* text);
-
- bool IsClutter(Ship& s);
- bool IsCrowded(Ship& s);
- bool IsCrowded(MissionElement& elem);
- void GetShipLoc(Ship& s, POINT& loc);
- void GetElemLoc(MissionElement& s, POINT& loc);
- void SelectShip(Ship* selship);
- void SelectElem(MissionElement* selelem);
- void SelectNavpt(Instruction* navpt);
- void FindShips(bool friendly, bool station, bool starship, bool dropship,
- List<Text>& result);
- void SetupScroll(Orbital* s);
-
- double GetMinRadius(int type);
-
- Text title;
- Rect rect;
- Campaign* campaign;
- Mission* mission;
- List<StarSystem> system_list;
- StarSystem* system;
- List<Orbital> stars;
- List<Orbital> planets;
- List<Orbital> regions;
- Ship* ship;
- Bitmap galaxy_image;
- bool editor;
-
- int current_star;
- int current_planet;
- int current_region;
- Ship* current_ship;
- MissionElement* current_elem;
- Instruction* current_navpt;
- int current_status;
-
- int view_mode;
- int seln_mode;
- bool captured;
- bool dragging;
- bool adding_navpt;
- bool moving_navpt;
- bool moving_elem;
- int scrolling;
- int mouse_x;
- int mouse_y;
- DWORD ship_filter;
-
- double zoom;
- double view_zoom[3];
- double offset_x;
- double offset_y;
- double view_offset_x[3];
- double view_offset_y[3];
- double c, r;
- double scroll_x;
- double scroll_y;
- double click_x;
- double click_y;
-
- Font* font;
- Font* title_font;
-
- ActiveWindow* active_window;
- Menu* active_menu;
-
- Menu* map_menu;
- Menu* map_system_menu;
- Menu* map_sector_menu;
- Menu* ship_menu;
- Menu* nav_menu;
- Menu* action_menu;
- Menu* objective_menu;
- Menu* formation_menu;
- Menu* speed_menu;
- Menu* hold_menu;
- Menu* farcast_menu;
-
- MenuView* menu_view;
-};
-
-#endif MapView_h
-
+/* Starshatter OpenSource Distribution
+ Copyright (c) 1997-2004, Destroyer Studios LLC.
+ All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name "Destroyer Studios" nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ SUBSYSTEM: Stars.exe
+ FILE: MapView.h
+ AUTHOR: John DiCamillo
+
+
+ OVERVIEW
+ ========
+ Star Map class
+*/
+
+#ifndef MapView_h
+#define MapView_h
+
+#include "Types.h"
+#include "SimObject.h"
+#include "View.h"
+#include "EventTarget.h"
+#include "Bitmap.h"
+#include "List.h"
+#include "Text.h"
+
+// +--------------------------------------------------------------------+
+
+class ActiveWindow;
+class StarSystem;
+class Orbital;
+class OrbitalRegion;
+class Ship;
+class Instruction;
+class Mission;
+class MissionElement;
+class Campaign;
+class Combatant;
+class CombatGroup;
+class Menu;
+class MenuItem;
+class MenuView;
+class Font;
+
+const int EID_MAP_CLICK = 1000;
+
+// +--------------------------------------------------------------------+
+
+class MapView : public View,
+public EventTarget,
+public SimObserver
+{
+public:
+ MapView(Window* win);
+ virtual ~MapView();
+
+ // Operations:
+ virtual void Refresh();
+ virtual void OnWindowMove();
+ virtual void OnShow();
+ virtual void OnHide();
+
+ virtual void DrawTitle();
+ virtual void DrawGalaxy();
+ virtual void DrawSystem();
+ virtual void DrawRegion();
+
+ virtual void DrawGrid();
+ virtual void DrawOrbital(Orbital& orbital, int index);
+ virtual void DrawShip(Ship& ship, bool current=false, int rep=3);
+ virtual void DrawElem(MissionElement& elem, bool current=false, int rep=3);
+ virtual void DrawNavRoute(OrbitalRegion* rgn,
+ List<Instruction>& route,
+ Color smarker,
+ Ship* ship=0,
+ MissionElement* elem=0);
+
+ virtual void DrawCombatantSystem(Combatant* c, Orbital* rgn, int x, int y, int r);
+ virtual void DrawCombatGroupSystem(CombatGroup* g, Orbital* rgn, int x1, int x2, int& y, int a);
+ virtual void DrawCombatGroup(CombatGroup* g, int rep=3);
+
+ virtual int GetViewMode() const { return view_mode; }
+ virtual void SetViewMode(int mode);
+ virtual void SetSelectionMode(int mode);
+ virtual int GetSelectionMode() const { return seln_mode; }
+ virtual void SetSelection(int index);
+ virtual void SetSelectedShip(Ship* ship);
+ virtual void SetSelectedElem(MissionElement* elem);
+ virtual void SetRegion(OrbitalRegion* rgn);
+ virtual void SetRegionByName(const char* rgn_name);
+ virtual void SelectAt(int x, int y);
+ virtual Orbital* GetSelection();
+ virtual Ship* GetSelectedShip();
+ virtual MissionElement* GetSelectedElem();
+ virtual int GetSelectionIndex();
+ virtual void SetShipFilter(DWORD f) { ship_filter = f; }
+
+ // Event Target Interface:
+ virtual int OnMouseMove(int x, int y);
+ virtual int OnLButtonDown(int x, int y);
+ virtual int OnLButtonUp(int x, int y);
+ virtual int OnClick();
+ virtual int OnRButtonDown(int x, int y);
+ virtual int OnRButtonUp(int x, int y);
+
+ virtual bool IsEnabled() const;
+ virtual bool IsVisible() const;
+ virtual bool IsFormActive() const;
+ virtual Rect TargetRect() const;
+
+ void ZoomIn();
+ void ZoomOut();
+
+ void SetGalaxy(List<StarSystem>& systems);
+ void SetSystem(StarSystem* s);
+ void SetMission(Mission* m);
+ void SetShip(Ship* s);
+ void SetCampaign(Campaign* c);
+
+ bool IsVisible(const Point& loc);
+
+ // accessors:
+ virtual void GetClickLoc(double& x, double& y) { x = click_x; y = click_y; }
+ List<StarSystem>& GetGalaxy() { return system_list; }
+ StarSystem* GetSystem() const { return system; }
+ OrbitalRegion* GetRegion() const;
+
+ virtual bool Update(SimObject* obj);
+ virtual const char* GetObserverName() const { return "MapWin"; }
+
+ bool GetEditorMode() const { return editor; }
+ void SetEditorMode(bool b) { editor = b; }
+
+protected:
+ virtual void BuildMenu();
+ virtual void ClearMenu();
+ virtual void ProcessMenuItem(int action);
+ virtual bool SetCapture();
+ virtual bool ReleaseCapture();
+
+ virtual void DrawTabbedText(Font* font, const char* text);
+
+ bool IsClutter(Ship& s);
+ bool IsCrowded(Ship& s);
+ bool IsCrowded(MissionElement& elem);
+ void GetShipLoc(Ship& s, POINT& loc);
+ void GetElemLoc(MissionElement& s, POINT& loc);
+ void SelectShip(Ship* selship);
+ void SelectElem(MissionElement* selelem);
+ void SelectNavpt(Instruction* navpt);
+ void FindShips(bool friendly, bool station, bool starship, bool dropship,
+ List<Text>& result);
+ void SetupScroll(Orbital* s);
+
+ double GetMinRadius(int type);
+
+ Text title;
+ Rect rect;
+ Campaign* campaign;
+ Mission* mission;
+ List<StarSystem> system_list;
+ StarSystem* system;
+ List<Orbital> stars;
+ List<Orbital> planets;
+ List<Orbital> regions;
+ Ship* ship;
+ Bitmap galaxy_image;
+ bool editor;
+
+ int current_star;
+ int current_planet;
+ int current_region;
+ Ship* current_ship;
+ MissionElement* current_elem;
+ Instruction* current_navpt;
+ int current_status;
+
+ int view_mode;
+ int seln_mode;
+ bool captured;
+ bool dragging;
+ bool adding_navpt;
+ bool moving_navpt;
+ bool moving_elem;
+ int scrolling;
+ int mouse_x;
+ int mouse_y;
+ DWORD ship_filter;
+
+ double zoom;
+ double view_zoom[3];
+ double offset_x;
+ double offset_y;
+ double view_offset_x[3];
+ double view_offset_y[3];
+ double c, r;
+ double scroll_x;
+ double scroll_y;
+ double click_x;
+ double click_y;
+
+ Font* font;
+ Font* title_font;
+
+ ActiveWindow* active_window;
+ Menu* active_menu;
+
+ Menu* map_menu;
+ Menu* map_system_menu;
+ Menu* map_sector_menu;
+ Menu* ship_menu;
+ Menu* nav_menu;
+ Menu* action_menu;
+ Menu* objective_menu;
+ Menu* formation_menu;
+ Menu* speed_menu;
+ Menu* hold_menu;
+ Menu* farcast_menu;
+
+ MenuView* menu_view;
+};
+
+#endif MapView_h
+