From 6a728a46d837384074228959d6330ba29e03aee0 Mon Sep 17 00:00:00 2001
From: Clyne Sullivan <tullivan99@gmail.com>
Date: Mon, 2 May 2016 08:49:17 -0400
Subject: arena/page fixes

---
 include/common.hpp  | 11 ++++++++++-
 include/mob.hpp     |  1 +
 include/texture.hpp |  2 --
 include/ui.hpp      |  2 +-
 include/world.hpp   |  7 ++++---
 5 files changed, 16 insertions(+), 7 deletions(-)

(limited to 'include')

diff --git a/include/common.hpp b/include/common.hpp
index e607c12..b9e0e71 100644
--- a/include/common.hpp
+++ b/include/common.hpp
@@ -154,7 +154,6 @@ void safeSetColor(int r,int g,int b);
  */
 void safeSetColorA(int r,int g,int b,int a);
 
-
 // use our own millis function if we can, windows doesn't like <chrono> at the moment...
 #ifdef __WIN32__
 #define millis() SDL_GetTicks()
@@ -174,4 +173,14 @@ const char *readFile(const char *path);
 // aborts the program, printing the given error
 void UserError(std::string reason);
 
+namespace std {
+	template<class T>
+	constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
+		if (v < hi)
+			return (v > lo) ? v : lo;
+		else
+			return (v < hi) ? v : hi;
+	}
+}
+
 #endif // COMMON_H
diff --git a/include/mob.hpp b/include/mob.hpp
index 48be456..adaecb4 100644
--- a/include/mob.hpp
+++ b/include/mob.hpp
@@ -40,6 +40,7 @@ constexpr Mob *Mobp(Entity *e) {
 class Page : public Mob {
 private:
     std::string pageTexPath;
+    GLuint pageTexture;
 public:
     Page(void);
 
diff --git a/include/texture.hpp b/include/texture.hpp
index 59358f2..22a2459 100644
--- a/include/texture.hpp
+++ b/include/texture.hpp
@@ -13,13 +13,11 @@
  * When defined, DEBUG allows extra messages to be printed to the terminal for
  * debugging purposes.
  */
-
 #define DEBUG
 
 /**
  * Texture functions are given a namespace for better organization.
  */
-
 namespace Texture {
 
 	/**
diff --git a/include/ui.hpp b/include/ui.hpp
index 7cee885..4c5f2c2 100644
--- a/include/ui.hpp
+++ b/include/ui.hpp
@@ -136,7 +136,7 @@ namespace ui {
 	void waitForDialog(void);
 
 	bool pageExists(void);
-	void drawPage(std::string path);
+	void drawPage(const GLuint& tex);
 
 	void dontTypeOut(void);
 	/*
diff --git a/include/world.hpp b/include/world.hpp
index 0aea879..200b065 100644
--- a/include/world.hpp
+++ b/include/world.hpp
@@ -180,6 +180,9 @@ public:
 	// gets the world's width in TODO
 	int getTheWidth(void) const;
 
+	// gets the starting x coordinate of the world
+	float getWorldStart(void) const;
+
 	// gets a pointer to the most recently added light
 	Light *getLastLight(void);
 
@@ -305,6 +308,7 @@ public:
  * transported to a temporary world with the player, and the Mob will be
  * killed upon exiting the arena.
  */
+
 class Arena : public World {
 private:
 
@@ -323,21 +327,18 @@ public:
 	WorldSwitchInfo exitArena(Player *p);
 };
 
-
 std::string getWorldWeatherStr(WorldWeather ww);
 
 /**
  * Loads the player into the world created by the given XML file. If a world is
  * already loaded it will be saved before the transition is made.
  */
-
 World *loadWorldFromXML(std::string path);
 
 /**
  * Loads the player into the XML-scripted world, but does not save data from the
  * previous world if one was loaded.
  */
-
 World *loadWorldFromXMLNoSave(std::string path);
 
 World *loadWorldFromPtr(World *ptr);
-- 
cgit v1.2.3