mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Use SDL_Point
instead of rolling our own point
struct
The `point` struct was a relic of ActionScript and was added because of the Flash 'point' object. However, it seems like Simon Roth didn't realize that SDL has its own point struct. With this, `Maths.h` can be un-included from a couple headers, which exposes the fact that `preloader.cpp` was relying on `Maths.h` being transitively included from `Graphics.h`.
This commit is contained in:
parent
c7098f84e5
commit
fbc9b3ddd7
9 changed files with 17 additions and 21 deletions
|
@ -610,7 +610,7 @@ void editorrender(void)
|
|||
// Draw entities backward to remain accurate with ingame
|
||||
for (int i = customentities.size() - 1; i >= 0; i--)
|
||||
{
|
||||
point tpoint;
|
||||
SDL_Point tpoint;
|
||||
SDL_Rect drawRect;
|
||||
|
||||
//if() on screen
|
||||
|
@ -928,7 +928,7 @@ void editorrender(void)
|
|||
if (i <= ed.currentghosts) { // We don't want all of them to show up at once :)
|
||||
if (ed.ghosts[i].rx != ed.levx || ed.ghosts[i].ry != ed.levy)
|
||||
continue;
|
||||
point tpoint;
|
||||
SDL_Point tpoint;
|
||||
tpoint.x = ed.ghosts[i].x;
|
||||
tpoint.y = ed.ghosts[i].y;
|
||||
SDL_Color ct = ed.ghosts[i].realcol;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "Graphics.h"
|
||||
#include "Localization.h"
|
||||
#include "Map.h"
|
||||
#include "Maths.h"
|
||||
#include "Music.h"
|
||||
#include "Script.h"
|
||||
#include "UtilityClass.h"
|
||||
|
@ -4777,10 +4778,10 @@ void entityclass::collisioncheck(int i, int j, bool scm /*= false*/)
|
|||
if (entities[i].size == 0 && (entities[j].size == 0 || entities[j].size == 12))
|
||||
{
|
||||
//They're both sprites, so do a per pixel collision
|
||||
point colpoint1;
|
||||
SDL_Point colpoint1;
|
||||
colpoint1.x = entities[i].xp;
|
||||
colpoint1.y = entities[i].yp;
|
||||
point colpoint2;
|
||||
SDL_Point colpoint2;
|
||||
colpoint2.x = entities[j].xp;
|
||||
colpoint2.y = entities[j].yp;
|
||||
int drawframe1 = entities[i].collisiondrawframe;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "GraphicsUtil.h"
|
||||
#include "Localization.h"
|
||||
#include "Map.h"
|
||||
#include "Maths.h"
|
||||
#include "Music.h"
|
||||
#include "RoomnameTranslator.h"
|
||||
#include "Screen.h"
|
||||
|
@ -2006,7 +2007,7 @@ void Graphics::drawcoloredtile(
|
|||
}
|
||||
|
||||
|
||||
bool Graphics::Hitest(SDL_Surface* surface1, point p1, SDL_Surface* surface2, point p2)
|
||||
bool Graphics::Hitest(SDL_Surface* surface1, SDL_Point p1, SDL_Surface* surface2, SDL_Point p2)
|
||||
{
|
||||
|
||||
//find rectangle where they intersect:
|
||||
|
@ -2255,7 +2256,7 @@ void Graphics::drawentity(const int i, const int yoff)
|
|||
return;
|
||||
}
|
||||
|
||||
point tpoint;
|
||||
SDL_Point tpoint;
|
||||
|
||||
SDL_Rect drawRect;
|
||||
|
||||
|
@ -2290,7 +2291,7 @@ void Graphics::drawentity(const int i, const int yoff)
|
|||
draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct);
|
||||
|
||||
//screenwrapping!
|
||||
point wrappedPoint;
|
||||
SDL_Point wrappedPoint;
|
||||
bool wrapX = false;
|
||||
bool wrapY = false;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "Game.h"
|
||||
#include "GraphicsResources.h"
|
||||
#include "Maths.h"
|
||||
#include "Textbox.h"
|
||||
#include "TowerBG.h"
|
||||
|
||||
|
@ -246,7 +245,7 @@ public:
|
|||
void renderfixedpre(void);
|
||||
void renderfixedpost(void);
|
||||
|
||||
bool Hitest(SDL_Surface* surface1, point p1, SDL_Surface* surface2, point p2);
|
||||
bool Hitest(SDL_Surface* surface1, SDL_Point p1, SDL_Surface* surface2, SDL_Point p2);
|
||||
|
||||
void drawentities(void);
|
||||
|
||||
|
|
|
@ -3195,7 +3195,7 @@ void teleporterinput(void)
|
|||
{
|
||||
for (size_t i = 0; i < map.teleporters.size(); i++)
|
||||
{
|
||||
point& tele = map.teleporters[i];
|
||||
SDL_Point& tele = map.teleporters[i];
|
||||
|
||||
if (map.isexplored(tele.x, tele.y))
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Graphics.h"
|
||||
#include "Localization.h"
|
||||
#include "MakeAndPlay.h"
|
||||
#include "Maths.h"
|
||||
#include "Music.h"
|
||||
#include "Script.h"
|
||||
#include "UtilityClass.h"
|
||||
|
@ -156,7 +157,7 @@ void mapclass::setteleporter(int x, int y)
|
|||
return;
|
||||
}
|
||||
|
||||
point temp;
|
||||
SDL_Point temp;
|
||||
temp.x = x;
|
||||
temp.y = y;
|
||||
teleporters.push_back(temp);
|
||||
|
@ -169,7 +170,7 @@ void mapclass::settrinket(int x, int y)
|
|||
return;
|
||||
}
|
||||
|
||||
point temp;
|
||||
SDL_Point temp;
|
||||
temp.x = x;
|
||||
temp.y = y;
|
||||
shinytrinkets.push_back(temp);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "Finalclass.h"
|
||||
#include "Labclass.h"
|
||||
#include "Maths.h"
|
||||
#include "Otherlevel.h"
|
||||
#include "Spacestation2.h"
|
||||
#include "Tower.h"
|
||||
|
@ -154,8 +153,8 @@ public:
|
|||
int final_colorframe, final_colorframedelay;
|
||||
|
||||
//Teleporters and Trinkets on the map
|
||||
std::vector<point> teleporters;
|
||||
std::vector<point> shinytrinkets;
|
||||
std::vector<SDL_Point> teleporters;
|
||||
std::vector<SDL_Point> shinytrinkets;
|
||||
|
||||
bool showteleporters, showtargets, showtrinkets;
|
||||
|
||||
|
|
|
@ -13,10 +13,4 @@ float inline fRandom(void)
|
|||
return ( float(rand()) / float(RAND_MAX)) ;
|
||||
}
|
||||
|
||||
struct point
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
#endif /* MATHGAME_H */
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "GraphicsUtil.h"
|
||||
#include "KeyPoll.h"
|
||||
#include "Localization.h"
|
||||
#include "Maths.h"
|
||||
#include "UtilityClass.h"
|
||||
#include "VFormat.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue