mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
**********************************************************
** Big Maps Projects code (incl. Multiplayer v1.5 ** ********************************************************** - Merged Big Maps Project code from BMP+MP trunk (Revision: 3340) o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP - Before THIS merge, I made a branch of the existing 1.13 source o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src - Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago - I will add VS 2010 projects and solution file in the next few days git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -9,11 +9,16 @@
|
||||
#define GRIDSIZE (MAXCOL * MAXROW)
|
||||
#define RIGHTMOSTGRID (MAXCOL - 1)
|
||||
#define LASTROWSTART (GRIDSIZE - MAXCOL)
|
||||
#define NOWHERE (GRIDSIZE + 1)
|
||||
//#define NO_MAP_POS NOWHERE
|
||||
#define MAPWIDTH (WORLD_COLS)
|
||||
#define MAPHEIGHT (WORLD_ROWS)
|
||||
#define MAPLENGTH (MAPHEIGHT*MAPWIDTH)
|
||||
//SB: NOWHERE must be constant
|
||||
//#define NOWHERE (GRIDSIZE + 1) //Lalien: old definition, replaced with -1
|
||||
//#define NOWHERE MAXLONG
|
||||
#define NOWHERE -1
|
||||
//#define NO_MAP_POS NOWHERE //Lalien: replaced with NOWHERE
|
||||
#define MAX_MAP_POS (GRIDSIZE) //MAX_MAP_POS will be used only to track the changes made for the big map project, should be replaced with GRIDSIZE later
|
||||
|
||||
//#define MAPWIDTH (WORLD_COLS) //Lalien: replaced with WORLD_COLS
|
||||
//#define MAPHEIGHT (WORLD_ROWS) //Lalien: replaced with WORLD_ROWS
|
||||
//#define MAPLENGTH (MAPHEIGHT*MAPWIDTH) //Lalien: replaced with WORLD_MAX
|
||||
|
||||
|
||||
#define ADJUST_Y_FOR_HEIGHT( pos, y ) ( y -= gpWorldLevelData[ pos ].sHeight )
|
||||
@@ -31,26 +36,27 @@ extern UINT8 gPurpendicularDirection[ NUM_WORLD_DIRECTIONS ][ NUM_WORLD_DIRECTIO
|
||||
|
||||
|
||||
// |Check for map bounds------------------------------------------| |Invalid-| |Valid-------------------|
|
||||
#define MAPROWCOLTOPOS( r, c ) ( ( (r < 0) || (r >= WORLD_ROWS) || (c < 0) || (c >= WORLD_COLS) ) ? ( 0xffff ) : ( (r) * WORLD_COLS + (c) ) )
|
||||
#define MAPROWCOLTOPOS( r, c ) ( ( (r < 0) || (r >= WORLD_ROWS) || (c < 0) || (c >= WORLD_COLS) ) ? ( 0xFFFFFFFF ) : ( (INT32)(r) * WORLD_COLS + (c) ) )
|
||||
|
||||
#define GETWORLDINDEXFROMWORLDCOORDS( y, x ) ( (INT16) ( x / CELL_X_SIZE ) ) + WORLD_COLS * ( (INT16) ( y / CELL_Y_SIZE ) )
|
||||
#define GETWORLDINDEXFROMWORLDCOORDS( y, x ) ( (INT32) ( x / CELL_X_SIZE ) ) + WORLD_COLS * ( (INT32) ( y / CELL_Y_SIZE ) )
|
||||
|
||||
void ConvertGridNoToXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToCenterCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToCenterCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
|
||||
|
||||
// GRID NO MANIPULATION FUNCTIONS
|
||||
INT16 NewGridNo(INT16 sGridno, INT16 sDirInc);
|
||||
INT32 NewGridNo(INT32 sGridNo, INT16 sDirInc);
|
||||
INT16 DirectionInc(UINT8 ubDirection);
|
||||
INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno);
|
||||
INT32 OutOfBounds(INT32 sGridNo, INT32 sProposedGridNo);
|
||||
BOOLEAN TileIsOutOfBounds(INT32 sGridNo);
|
||||
|
||||
|
||||
// Functions
|
||||
BOOLEAN GetMouseCell( INT32 *piMouseMapPos );
|
||||
BOOLEAN GetMouseXY( INT16 *psMouseX, INT16 *psMouseY );
|
||||
BOOLEAN GetMouseWorldCoords( INT16 *psMouseX, INT16 *psMouseY );
|
||||
BOOLEAN GetMouseMapPos( INT16 *psMapPos );
|
||||
BOOLEAN GetMouseMapPos( INT32 *psMapPos );
|
||||
BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY );
|
||||
BOOLEAN GetMouseXYWithRemainder( INT16 *psMouseX, INT16 *psMouseY, INT16 *psCellX, INT16 *psCellY );
|
||||
|
||||
@@ -58,7 +64,7 @@ BOOLEAN GetMouseXYWithRemainder( INT16 *psMouseX, INT16 *psMouseY, INT16 *psCell
|
||||
|
||||
void GetScreenXYWorldCoords( INT16 sScreenX, INT16 sScreenY, INT16 *pWorldX, INT16 *psWorldY );
|
||||
void GetScreenXYWorldCell( INT16 sScreenX, INT16 sScreenY, INT16 *psWorldCellX, INT16 *psWorldCellY );
|
||||
void GetScreenXYGridNo( INT16 sScreenX, INT16 sScreenY, INT16 *psMapPos );
|
||||
void GetScreenXYGridNo( INT16 sScreenX, INT16 sScreenY, INT32 *psMapPos );
|
||||
void GetWorldXYAbsoluteScreenXY( INT32 sWorldCellX, INT32 sWorldCellY, INT16 *psWorldScreenX, INT16 *psWorldScreenY );
|
||||
void GetFromAbsoluteScreenXYWorldXY( INT32 *psWorldCellX, INT32* psWorldCellY, INT16 sWorldScreenX, INT16 sWorldScreenY );
|
||||
|
||||
@@ -70,44 +76,44 @@ void FromScreenToCellCoordinates( INT16 sScreenX, INT16 sScreenY, INT16 *psCellX
|
||||
void FloatFromCellToScreenCoordinates( FLOAT dCellX, FLOAT dCellY, FLOAT *pdScreenX, FLOAT *pdScreenY );
|
||||
void FloatFromScreenToCellCoordinates( FLOAT dScreenX, FLOAT dScreenY, FLOAT *pdCellX, FLOAT *pdCellY );
|
||||
|
||||
BOOLEAN GridNoOnVisibleWorldTile( INT16 sGridNo );
|
||||
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT16 sGridNo );
|
||||
BOOLEAN GridNoOnEdgeOfMap( INT16 sGridNo, INT8 * pbDirection );
|
||||
BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo );
|
||||
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT32 sGridNo );
|
||||
BOOLEAN GridNoOnEdgeOfMap( INT32 sGridNo, INT8 * pbDirection );
|
||||
|
||||
BOOLEAN ConvertMapPosToWorldTileCenter( INT16 sMapPos, INT16 *psXPos, INT16 *psYPos );
|
||||
BOOLEAN ConvertMapPosToWorldTileCenter( INT32 usMapPos, INT16 *psXPos, INT16 *psYPos );
|
||||
|
||||
BOOLEAN CellXYToScreenXY(INT16 sCellX, INT16 sCellY, INT16 *sScreenX, INT16 *sScreenY);
|
||||
|
||||
INT32 GetRangeFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 );
|
||||
INT32 GetRangeInCellCoordsFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 );
|
||||
INT32 GetRangeFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 );
|
||||
INT32 GetRangeInCellCoordsFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 );
|
||||
|
||||
BOOLEAN IsPointInScreenRect( INT16 sXPos, INT16 sYPos, SGPRect *pRect );
|
||||
BOOLEAN IsPointInScreenRectWithRelative( INT16 sXPos, INT16 sYPos, SGPRect *pRect, INT16 *sXRel, INT16 *sRelY );
|
||||
|
||||
|
||||
INT16 PythSpacesAway(INT16 sOrigin, INT16 sDest);
|
||||
INT16 SpacesAway(INT16 sOrigin, INT16 sDest);
|
||||
INT16 CardinalSpacesAway(INT16 sOrigin, INT16 sDest);
|
||||
INT16 PythSpacesAway(INT32 sOrigin, INT32 sDest);
|
||||
INT16 SpacesAway(INT32 sOrigin, INT32 sDest);
|
||||
INT16 CardinalSpacesAway(INT32 sOrigin, INT32 sDest);
|
||||
INT8 FindNumTurnsBetweenDirs( INT8 sDir1, INT8 sDir2 );
|
||||
BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
|
||||
BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
|
||||
BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
|
||||
BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
|
||||
|
||||
INT16 QuickestDirection(INT16 origin, INT16 dest);
|
||||
INT16 ExtQuickestDirection(INT16 origin, INT16 dest);
|
||||
|
||||
|
||||
// Returns the (center ) cell coordinates in X
|
||||
INT16 CenterX( INT16 sGridno );
|
||||
INT16 CenterX( INT32 sGridNo );
|
||||
|
||||
// Returns the (center ) cell coordinates in Y
|
||||
INT16 CenterY( INT16 sGridno );
|
||||
INT16 CenterY( INT32 sGridNo );
|
||||
|
||||
INT16 MapX( INT16 sGridNo );
|
||||
INT16 MapY( INT16 sGridNo );
|
||||
BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
|
||||
INT16 MapX( INT32 sGridNo );
|
||||
INT16 MapY( INT32 sGridNo );
|
||||
BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
|
||||
|
||||
//Simply chooses a random gridno within valid boundaries (for dropping things in unloaded sectors)
|
||||
INT16 RandomGridNo();
|
||||
INT32 RandomGridNo();
|
||||
|
||||
extern UINT32 guiForceRefreshMousePositionCalculation;
|
||||
|
||||
@@ -123,13 +129,15 @@ extern UINT32 guiForceRefreshMousePositionCalculation;
|
||||
class GridNode
|
||||
{
|
||||
public:
|
||||
typedef GridNode MapXY_t[WORLD_MAX];
|
||||
// WANNE - BMP: DONE!
|
||||
//typedef GridNode MapXY_t[WORLD_MAX];
|
||||
typedef GridNode MapXY_t[MAX_ALLOWED_WORLD_MAX];
|
||||
static MapXY_t MapXY;
|
||||
|
||||
INT16 x;
|
||||
INT16 y;
|
||||
|
||||
static MapXY_t *initGridNodes() { for (INT16 i=0; i<WORLD_MAX; i++){ConvertGridNoToXY(i, &MapXY[i].x, &MapXY[i].y); } return &MapXY; };
|
||||
static MapXY_t *initGridNodes() { for (INT32 i=0; i<WORLD_MAX; i++){ConvertGridNoToXY(i, &MapXY[i].x, &MapXY[i].y); } return &MapXY; };
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user