From 1bfd69fc1cb9424dcba7d4ee1df1c8bcece07a4a Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 17 Jan 2009 16:06:59 +0000 Subject: [PATCH] Try to reduce header dependencies a bit --- src/Asteroid.cpp | 2 ++ src/Asteroid.hpp | 9 ++++----- src/GraphicsFwd.hpp | 2 ++ src/LandingPad.cpp | 3 +++ src/LandingPad.hpp | 6 ++++-- src/Missile.cpp | 4 ++-- src/Surface.cpp | 1 + src/Surface.hpp | 6 ++---- src/Viewport.cpp | 2 ++ src/Viewport.hpp | 3 +-- 10 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/Asteroid.cpp b/src/Asteroid.cpp index 231cb02..bd06146 100644 --- a/src/Asteroid.cpp +++ b/src/Asteroid.cpp @@ -1,3 +1,4 @@ +// // Asteroid.cpp -- Randomly generated asteroid. // Copyright (C) 2008 Nick Gasson // @@ -18,6 +19,7 @@ #include "Asteroid.hpp" #include "OpenGL.hpp" #include "LoadOnce.hpp" +#include "Ship.hpp" Texture* Asteroid::surfTexture[Surface::NUM_SURF_TEX]; diff --git a/src/Asteroid.hpp b/src/Asteroid.hpp index 9201929..b460499 100644 --- a/src/Asteroid.hpp +++ b/src/Asteroid.hpp @@ -1,3 +1,4 @@ +// // Asteroid.hpp -- Randomly generated asteroid. // Copyright (C) 2008 Nick Gasson // @@ -18,12 +19,10 @@ #ifndef INC_ASTEROID_HPP #define INC_ASTEROID_HPP -#include "Platform.hpp" -#include "ObjectGrid.hpp" -#include "OpenGL.hpp" -#include "Texture.hpp" -#include "Ship.hpp" +#include "GameObjFwd.hpp" +#include "GraphicsFwd.hpp" #include "Surface.hpp" +#include "ObjectGrid.hpp" class Asteroid : public StaticObject { public: diff --git a/src/GraphicsFwd.hpp b/src/GraphicsFwd.hpp index 1a007df..9592691 100644 --- a/src/GraphicsFwd.hpp +++ b/src/GraphicsFwd.hpp @@ -20,5 +20,7 @@ #define INC_GRAPHICSFWD_HPP class Image; +class TextureQuad; +class Texture; #endif diff --git a/src/LandingPad.cpp b/src/LandingPad.cpp index 4de6238..f76ec02 100644 --- a/src/LandingPad.cpp +++ b/src/LandingPad.cpp @@ -18,6 +18,9 @@ #include "LandingPad.hpp" #include "Surface.hpp" #include "LoadOnce.hpp" +#include "OpenGL.hpp" +#include "Texture.hpp" +#include "Viewport.hpp" Texture* LandingPad::landTexture = NULL; Texture* LandingPad::noLandTexture = NULL; diff --git a/src/LandingPad.hpp b/src/LandingPad.hpp index fa478d0..b5819c7 100644 --- a/src/LandingPad.hpp +++ b/src/LandingPad.hpp @@ -1,3 +1,4 @@ +// // LandingPad.hpp -- Where the player can land. // Copyright (C) 2008 Nick Gasson // @@ -18,8 +19,9 @@ #ifndef INC_LANDINGPAD_HPP #define INC_LANDINGPAD_HPP -#include "Viewport.hpp" -#include "Texture.hpp" +#include "GameObjFwd.hpp" +#include "GraphicsFwd.hpp" + #include "OpenGL.hpp" class LandingPad diff --git a/src/Missile.cpp b/src/Missile.cpp index 11bc022..f43d64e 100644 --- a/src/Missile.cpp +++ b/src/Missile.cpp @@ -51,7 +51,8 @@ Missile::Missile(ObjectGrid* o, Viewport* v, Side s) void Missile::Draw() const { if (viewport->PointInScreen(dx, dy, ObjectGrid::OBJ_GRID_SIZE, - ObjectGrid::OBJ_GRID_SIZE)) + ObjectGrid::OBJ_GRID_SIZE) + && state != DESTROYED) image->Draw(dx - viewport->GetXAdjust(), dy - viewport->GetYAdjust(), angle); } @@ -76,7 +77,6 @@ void Missile::Move(const Ship& ship) void Missile::MoveFixed(const Ship& ship) { - // Hmm... add some fancy logic here to decided when to fire if (ship.GetY() > dy) state = FLYING; } diff --git a/src/Surface.cpp b/src/Surface.cpp index c90738f..b2afd35 100644 --- a/src/Surface.cpp +++ b/src/Surface.cpp @@ -17,6 +17,7 @@ #include "Surface.hpp" #include "LoadOnce.hpp" +#include "Ship.hpp" const int Surface::VARIANCE(65); // Bumpyness of landscape const int Surface::MAX_SURFACE_HEIGHT(300); diff --git a/src/Surface.hpp b/src/Surface.hpp index dea36d8..1b82ee7 100644 --- a/src/Surface.hpp +++ b/src/Surface.hpp @@ -18,11 +18,9 @@ #ifndef INC_SURFACE_HPP #define INC_SURFACE_HPP -#include "Texture.hpp" -#include "Viewport.hpp" +#include "GraphicsFwd.hpp" +#include "GameObjFwd.hpp" #include "LandingPad.hpp" -#include "OpenGL.hpp" -#include "Ship.hpp" class Surface { public: diff --git a/src/Viewport.cpp b/src/Viewport.cpp index f665daa..811f741 100644 --- a/src/Viewport.cpp +++ b/src/Viewport.cpp @@ -1,3 +1,4 @@ +// // Viewport.cpp -- The area of the screen the player can see. // Copyright (C) 2008 Nick Gasson // @@ -15,6 +16,7 @@ // along with this program. If not, see . // +#include "Platform.hpp" #include "Viewport.hpp" #include "OpenGL.hpp" #include "ObjectGrid.hpp" diff --git a/src/Viewport.hpp b/src/Viewport.hpp index bd5da00..211864e 100644 --- a/src/Viewport.hpp +++ b/src/Viewport.hpp @@ -1,3 +1,4 @@ +// // Viewport.hpp -- The area of the screen the player can see. // Copyright (C) 2008 Nick Gasson // @@ -18,8 +19,6 @@ #ifndef INC_VIEWPORT_HPP #define INC_VIEWPORT_HPP -#include "Platform.hpp" - class Viewport { public: Viewport(); -- 2.39.2