- Replaced all occurrences of FillCRect with the new tileImage, to get away from 'ppat' resources. - Fixed a minor error in the character editor where part of a text string was off the window. - With the prefix header gone, libticpp.dylib has been removed; TinyXML++ is now compiled right into the program. - The scenario editor splash screen is now loaded from a file. - The pc editor title has its transparency problem fixed. - Added an overload of tileImage that takes a RgnHandle instead of a Rect in order to replace the single occurrence of FillCRgn. - Removed an unused function in boe.graphics.cpp - Changed loading of patterns. Instead of loading each pattern individually from a resource, a single file containing all of them is loading. The arrays that formerly contained the actual patterns now contain the source rects of the patterns. - Fixed the cursor hotspots (the coordinates were reversed) - Removed the useless flip_pict that was written when I didn't know what I was doing. - Fixed error in tileImage in which vrep and hrep were switched. - Added code to tileImage to ensure that the pattern will line up with anything already onscreen, regardless of the rect to fill. - Two images were altered: pcedtitle.png to fix the transparenct problem, and pixpats.png to add one pattern that had been missed (and also rearrange the smaller patterns a little) git-svn-id: http://openexile.googlecode.com/svn/trunk@91 4ebdad44-0ea0-11de-aab3-ff745001d230
71 lines
1.5 KiB
C++
71 lines
1.5 KiB
C++
/*
|
|
* location.cpp
|
|
* BoE
|
|
*
|
|
* Created by Celtic Minstrel on 20/04/09.
|
|
*
|
|
*/
|
|
|
|
#include "location.h"
|
|
#include "mathutil.h"
|
|
|
|
bool operator == (location p1,location p2){
|
|
if ((p1.x == p2.x) & (p1.y == p2.y))
|
|
return true;
|
|
else return false;
|
|
}
|
|
|
|
bool operator != (location p1,location p2){
|
|
return ! (p1 == p2);
|
|
}
|
|
|
|
short dist(location p1,location p2){
|
|
return s_sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
|
|
}
|
|
|
|
short vdist(location p1,location p2) {
|
|
short i,j;
|
|
i = abs((long double)p1.x - p2.x);
|
|
j = abs((long double)p1.y - p2.y);
|
|
return max(i,j);
|
|
}
|
|
|
|
location::location() : x(0), y(0) {}
|
|
location::location(char a,char b) : x(a), y(b) {}
|
|
|
|
location loc(char a, char b){
|
|
return location(a,b);
|
|
}
|
|
|
|
location loc(){
|
|
return location();
|
|
}
|
|
|
|
bool location::in(rectangle r){
|
|
if(y >= r.top && y <= r.bottom && x >= r.left && x <= r.right)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
rectangle::rectangle() : top(0), left(0), right(0), bottom(0) {}
|
|
rectangle::rectangle(location tl, location br) : top(tl.y), left(tl.x), right(br.x), bottom(br.y) {}
|
|
rectangle::rectangle(char t, char l, char b, char r) : top(t), left(l), right(r), bottom(b) {}
|
|
|
|
bool rectangle::contains(location p){
|
|
if(p.y >= top && p.y <= bottom && p.x >= left && p.x <= right)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
rectangle rect(){
|
|
return rectangle();
|
|
}
|
|
|
|
rectangle rect(location tl, location br){
|
|
return rectangle(tl,br);
|
|
}
|
|
|
|
rectangle rect(char top, char left, char bottom, char right){
|
|
return rectangle(top, left, bottom, right);
|
|
}
|