Turned some macros into static inline functions.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1460 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+33
-26
@@ -65,35 +65,42 @@
|
|||||||
#define UNIT_SCREEN_WIDTH 63
|
#define UNIT_SCREEN_WIDTH 63
|
||||||
#define UNIT_SCREEN_HEIGHT 50
|
#define UNIT_SCREEN_HEIGHT 50
|
||||||
|
|
||||||
|
static inline COORD
|
||||||
|
logxToUniverse (long lx)
|
||||||
|
{
|
||||||
|
return (lx * ((MAX_X_UNIVERSE + 1) >> 4)) * 10
|
||||||
|
/ ((long) ((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH);
|
||||||
|
}
|
||||||
#define LOGX_TO_UNIVERSE(lx) \
|
#define LOGX_TO_UNIVERSE(lx) \
|
||||||
(COORD)( \
|
logxToUniverse (lx)
|
||||||
((long)(lx) \
|
static inline COORD
|
||||||
* ((MAX_X_UNIVERSE + 1) >> 4)) \
|
logyToUniverse (long ly)
|
||||||
* 10 \
|
{
|
||||||
/ ((long)((LOG_SPACE_WIDTH) >> 4) \
|
return MAX_Y_UNIVERSE -
|
||||||
* SECTOR_WIDTH) \
|
(COORD)(((long) (ly) * ((MAX_Y_UNIVERSE + 1) >> 4))
|
||||||
)
|
/ ((long) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT));
|
||||||
#define LOGY_TO_UNIVERSE(ly) \
|
}
|
||||||
(COORD)( \
|
#define LOGY_TO_UNIVERSE(ly) \
|
||||||
MAX_Y_UNIVERSE - (COORD)(((long)(ly) \
|
logyToUniverse (ly)
|
||||||
* ((MAX_Y_UNIVERSE + 1) >> 4)) \
|
static inline long
|
||||||
/ ((long)((LOG_SPACE_HEIGHT) >> 4) \
|
universeToLogx (COORD ux)
|
||||||
* SECTOR_HEIGHT)) \
|
{
|
||||||
)
|
return ((long) ux * ((long) ((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH)
|
||||||
|
+ ((((MAX_X_UNIVERSE + 1) >> 4) * 10) >> 1))
|
||||||
|
/ (((MAX_X_UNIVERSE + 1) >> 4) * 10);
|
||||||
|
}
|
||||||
#define UNIVERSE_TO_LOGX(ux) \
|
#define UNIVERSE_TO_LOGX(ux) \
|
||||||
( \
|
universeToLogx (ux)
|
||||||
((long)(ux) \
|
static inline long
|
||||||
* ((long)((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH) \
|
universeToLogy (COORD uy)
|
||||||
+ ((((MAX_X_UNIVERSE + 1) >> 4) * 10) >> 1)) \
|
{
|
||||||
/ (((MAX_X_UNIVERSE + 1) >> 4) * 10) \
|
return ((long) (MAX_Y_UNIVERSE - uy)
|
||||||
)
|
* ((long) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT)
|
||||||
|
+ (((MAX_Y_UNIVERSE + 1) >> 4) >> 1))
|
||||||
|
/ ((MAX_Y_UNIVERSE + 1) >> 4);
|
||||||
|
}
|
||||||
#define UNIVERSE_TO_LOGY(uy) \
|
#define UNIVERSE_TO_LOGY(uy) \
|
||||||
( \
|
universeToLogy (uy)
|
||||||
((long)(MAX_Y_UNIVERSE - (uy)) \
|
|
||||||
* ((long)((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT) \
|
|
||||||
+ (((MAX_Y_UNIVERSE + 1) >> 4) >> 1)) \
|
|
||||||
/ ((MAX_Y_UNIVERSE + 1) >> 4) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define CIRCLE_SHIFT 6
|
#define CIRCLE_SHIFT 6
|
||||||
#define FULL_CIRCLE (1 << CIRCLE_SHIFT)
|
#define FULL_CIRCLE (1 << CIRCLE_SHIFT)
|
||||||
|
|||||||
Reference in New Issue
Block a user