Main Page | Modules | Related Pages

Map Functions

Description. More...

Functions


Detailed Description

Description.

HEL's map-system implementation supports large maps. The map-drawer only updates dirty regions, instead of always redrawing the whole map!

The map-drawer is faster than the original HAM map functions. It uses LookUpTables whereever possible to gain maximum speed.

It can be combined with HEL's Tile Functions to dynamically reload tiles which gives you the possibility to create more extended levels.

It supports parallax scrolling using fixed point math.

It supports Virtual Maps. A Virtual Map in HEL's sense is an invisble datalayer, which can be used as a collision or event map. There is no limit in creating Virtual Map's!


Function Documentation

u32 hel_MapBatchScrollBy TMapScrollInfo *  pMapInfos,
s32  DeltaX,
s32  DeltaY,
int  Count
 

Scroll multiply layers at the same time.

Parameters:
pMapInfos Pointer to an array of initialized TMapScrollInfo structures
DeltaX Amount in pixel to scroll on x axis
DeltaY Amount in pixel to scroll on y axis
Count The amount of TMapScrollInfo elements in pMapInfo
Returns:
FALSE when unable to scroll any layers. Otherwise it returns a flag list with these values:
  • 1st BG in MapInfos Array Result:
    • BIT0 - Scrolled at least one pixel on X axis.
    • BIT1 - Scrolled at least one pixel on Y axis.
  • 2nd BG in MapInfos Array Result:
    • BIT2 - Scrolled at least one pixel on X axis.
    • BIT3 - Scrolled at least one pixel on Y axis.
  • 3rd BG in MapInfos Array Result:
    • BIT4 - Scrolled at least one pixel on X axis.
    • BIT5 - Scrolled at least one pixel on Y axis.
  • 4th BG in MapInfos Array Result:
    • BIT6 - Scrolled at least one pixel on X axis.
    • BIT7 - Scrolled at least one pixel on Y axis.
    // Flags is our flag list result, BgNo is the Background you want to check
    // and Axis is either 0 for X, or 1 for Y.
    // This assumes you are storing the MapInfos in numerical order in the MapInfos array (0-3)
    // If you are not just store the result and AND it against the proper bit as shown above.
    // Example:  ScrollResult & BIT4 <-- X Axis of 3rd BG stored in MapInfos array.
    #define CheckBGScroll(_Flags, _BgNo, _Axis)(_Flags) & (1 << (((_BgNO) << 1) + (_Axis)))
 
    TMapScrollInfo MapInfos[2];
 
    MapInfos[0] = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
    MapInfos[1] = hel_MapInit(1, 4096, 32, FALSE, Layer1_Map);
    
    
    while(GameLoopActive)
    {
       if(NewFrame)
       {
          if(UserPressedRight)
          {
             // Scroll one pixel to the right
             u32 ScrollResult = hel_MapBatchScrollBy(&MapInfos, 1, 0, 2);
             
            // Check to see if background 0 X axis scrolled
            if(CheckBGScroll(ScrollResult, 0, 0))
            {
              HEL_DEBUG_MSG("BG0 scrolled on X.");
            }
         
            // Check to see if background 1 X axis scrolled
            if(CheckBGScroll(ScrollResult, 1, 0))
            {
              HEL_DEBUG_MSG("BG1 scrolled on X.");
            }
         
            // Check to see if BG0 OR BG1 Y axis scrolled
            if(CheckBGScroll(ScrollResult, 0, 1) || CheckBGScroll(ScrollResult, 1, 1))
            {
              HEL_DEBUG_MSG("BG0 or BG1 scrolled on Y.");
            }
          }
       }
    }

See also:
hel_MapScrollBy

u8 hel_MapBatchScrollByEx TMapScrollInfo *  pMapInfos,
s32  DeltaX,
s32  DeltaY,
int  Count,
u32  PrimaryLayer
 

Scroll multiply layers at the same time.

Parameters:
pMapInfos Pointer to an array of initialized TMapScrollInfo structures
DeltaX Amount in pixel to scroll on x axis
DeltaY Amount in pixel to scroll on y axis
Count The count of TMapScrollInfo elements, passed by pMapInfo
PrimaryLayer : PrimaryLayer represents the layer-index, in pMapInfos, where you want to get the return value from. The return value is the same as in hel_MapScrollBy.
Please read hel_MapScrollBy.

See also:
hel_MapBatchScrollBy, hel_MapScrollBy

void hel_MapDeInit TMapScrollInfo *  pMapInfo  ) 
 

De-Initialize a map.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
This function deinitializes a TMapScrollInfo structure as well as the mapset in VRAM.

   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map); 

   // Lots of stuff here ...
   
   hel_MapDeInit(&MapInfo);

See also:
hel_MapInit

void* hel_MapGetCustomData TMapScrollInfo *  pMapInfo  ) 
 

Get custom data.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Returns:
Returns the custom data what you previously assigned to the structure specified by pMapInfo
See also:
hel_MapSetCustomData

TPoint32 hel_MapGetPosition TMapScrollInfo *  pMapInfo  ) 
 

Get the current map position in tiles.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Returns:
Returns the X/Y Coordinates in tiles, as TPoint32 structure
   TMapScrollInfo MapInfo;
   TPoint32 Pt={0,0};
   
   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
   hel_MapSetPosition(&MapInfo, 512, 0);
   
   Pt = hel_MapGetPosition(&MapInfo);
   HEL_DEBUG_MSG("Position in tiles X: %d \n", Pt.X);
   HEL_DEBUG_MSG("Position in tiles Y: %d \n", Pt.Y);

See also:
hel_MapGetPositionInPixel

TPoint32 hel_MapGetPositionInPixel TMapScrollInfo *  pMapInfo  ) 
 

Get the current map position in pixel.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Returns:
Returns the X/Y Coordinates in pixels, as TPoint32 structure
   TMapScrollInfo MapInfo;
   TPoint32 Pt={0,0};

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
   hel_MapSetPosition(&MapInfo, 512, 0);

   Pt = hel_MapGetPositionInPixel(&MapInfo);
   HEL_DEBUG_MSG("Position in pixels X: %d \n", Pt.X);
   HEL_DEBUG_MSG("Position in pixels Y: %d \n", Pt.Y);

See also:
hel_MapGetPosition

TPoint32 hel_MapGetPositionInPixelFrom TMapScrollInfo *  pMapInfo,
u32  TileX,
u32  TileY
 

Get position of a tile.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
TileX The horizontal index of the tile you want to get the position from
TileY The vertical index of the tile you want to get the position from
Returns:
Returns the position in pixels of the tile in question.
Note:
Imagine the following scenario. You have a layer whose (top/left) position is xy=0,0. Now you want to get the position of the tile at xy=2,3. The result value will be xy=16,24 (2*8,3*8). Now lets say you scroll the layer by 2 pixels on x and 6 pixels on y. The result value in this case is xy=14,18 (2*8-2,3*8-6). This only works with tiles whose tilesize is 8*8 pixels.
   TPoint32 Pt = hel_MapGetPositionInPixelFrom(&g_MapInfo, 2, 3);

See also:
hel_MapGetPosition, hel_MapGetPositionInPixel

u8 hel_MapGetScrollFlags TMapScrollInfo *  pMapInfo  ) 
 

Get Scrollflags.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Returns:
Returns the scrollflags used by the mapsystem specified by pMapInfo. Please see hel_MapSetScrollFlags for a listing of existing flags.
See also:
hel_MapSetScrollFlags

u16 hel_MapGetTileAt TMapScrollInfo *  pMapInfo,
u32  ScreenX,
u32  ScreenY
 

Get a maptile.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
ScreenX The horizontal screen-coordinate in pixels from where you want the tile from
ScreenY The vertical screen-coordinate in pixels from where you want the tile from
Returns:
Returns the maptile requested.
Note:
This function does not support VirtualMaps, use hel_MapGetTilePtrAt for VirtualMaps!
   u16 Index = hel_MapGetTileAt(&g_MapInfo, 98, 56);

See also:
hel_MapGetTilePtrAt

void* hel_MapGetTilePtrAt TMapScrollInfo *  pMapInfo,
u32  ScreenX,
u32  ScreenY
 

Get a pointer to a maptile.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
ScreenX The horizontal screen-coordinate in pixels from where you want the tile from
ScreenY The vertical screen-coordinate in pixels from where you want the tile from
Returns:
Returns a pointer to the requested maptile.
Note:
You have to cast the pointer to the correct type. For normal maps it is usually an u16, while rotation maps use u8 instead. If you specified a VirtualMap, cast it to the type your VirtualMap items use.
   u16 Index = *(u16*)hel_MapGetTilePtrAt(&g_MapInfo, 98, 56);

See also:
hel_MapGetTileAt

TMapScrollInfo hel_MapInit u8  BgNo,
u16  TilesX,
u16  TilesY,
u8  Rotation,
void *  pMapData
 

Initialize a map.

Parameters:
BgNo Background you want to initialize the map for
TilesX Map-width in tiles
TilesY Map-height in tiles
Rotation Indicates the map as a rotation map. Can be TRUE or FALSE
pMapData Pointer to map data
Returns:
A TMapScrollInfo structure. This structure is used by almost every hel_*Map* function.
This function returns an initialized TMapScrollInfo structure, what is used by most of the HEL map functions. The hardware map-size is set to 32x32 tiles.

   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0,            // BgNo
                         4096,         // Map-width in tiles
                         32,           // Map-height in tiles
                         FALSE,        // Is it a rotation map?
                         Layer0_Map);  // Pointer to map-data

See also:
hel_MapInitEx, hel_MapDeInit

TMapScrollInfo hel_MapInitEx u8  BgNo,
u16  TilesX,
u16  TilesY,
u8  Rotation,
u8  MapSize,
void *  pMapData
 

Initialize a map.

Parameters:
BgNo Background you want to initialize the map for
TilesX Map-width in tiles
TilesY Map-height in tiles
Rotation Indicates the map as a rotation map. Can be TRUE or FALSE
MapSize Specifies the hardware map size. See below for a list with available values.
pMapData Pointer to map data
Returns:
A TMapScrollInfo structure. This structure is used by all hel_Map* functions.
This function returns an initialized TMapScrollInfo structure, which is used by most of the hel map functions. The hardware map is set to 32x32 tiles.

The MapSize parameter can be one of the following constants, depending on whether it is a rotation map or not:

For a normal map use one of these:

  • MAP_SIZE_32X32
  • MAP_SIZE_64X32
  • MAP_SIZE_32X64
  • MAP_SIZE_64X64

For a rotation map use one of these:

  • MAP_SIZE_ROT_16X16
  • MAP_SIZE_ROT_32X32
  • MAP_SIZE_ROT_64X64
  • MAP_SIZE_ROT_128X128

   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInitEx(0,                   // BgNo
                           4096,                // Map-width in tiles
                           512,                 // Map-height in tiles
                           TRUE,                // Is it a rotation map?
                           MAP_SIZE_ROT_64X64,  // hardware map size
                           Layer0_Map);         // Pointer to map-data

See also:
hel_MapDeInit, hel_MapInit

TMapScrollInfo hel_MapInitVirtual u16  TilesX,
u16  TilesY,
u8  DataTypeSize,
void *  pMapData
 

Initialize a VirtualMap.

Parameters:
TilesX Map-width in tiles
TilesY Map-height in tiles
DataTypeSize The size of one element in bytes, from the map specified by pMapData
pMapData Pointer to mapdata
Returns:
A TMapScrollInfo structure. This structure is used by almost every hel_Map* function.
Note:
A VirtualMap in HEL can be any kind of mapdata, but it cannot be displayed! VirtualMap's can be used for collision or event layers for example and must also have a 'tilesize' of 8x8 pixels!
   TMapScrollInfo MapInfo;
   
   MapInfo = hel_MapInitVirtual(128, 32, sizeof(u16), (void*)sample_Collision);

See also:
hel_MapInit, hel_MapInitEx, hel_MapGetTilePtrAt

u8 hel_MapIsBoundsCheckEnabled TMapScrollInfo *  pMapInfo  ) 
 

Check if a map uses boundschecking.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Returns:
Returns TRUE when boundschecking is enabled, otherwise FALSE.
   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
   if (hel_MapIsBoundsCheckEnabled(&MapInfo))
      HEL_DEBUG_MSG("Boundscheck enabled\n");
   else
      HEL_DEBUG_MSG("Boundscheck disabled\n");

See also:
hel_MapSetBoundsCheck

u8 hel_MapIsParallaxEnabled TMapScrollInfo *  pMapInfo  ) 
 

Check if parallax is enabled.

Parameters:
pMapInfo Pointer to an array of initialized TMapScrollInfo structures
Returns:
Returns true when parallax support is enabled in pMapInfo, otherwise false.
See also:
hel_MapSetParallax

void hel_MapJumpTo TMapScrollInfo *  pMapInfo,
u32  JumpToFlag
 

Jump to a border of the map.

The hel_MapJumpTo jumps to a border of the map. It can jump to the left or right as well as to the top or bottom. You can combine the JumpToFlag's in order to move the map in more than one direction with only a single call to hel_MapJumpTo.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
JumpToFlag Flag(s) what specify the destination map position. The JumpToFlag can be a combination or the following predefined constants:
  • MAP_JUMPTO_LEFT - Jumps to the very left of the map
  • MAP_JUMPTO_RIGHT - Jumps to the very right of the map, the last column of the screen (column 30) will display the last column of the map.
  • MAP_JUMPTO_TOP - Jumps to the very top of the map
  • MAP_JUMPTO_BOTTOM - Jumps to the very bottom of the map, the last row of the screen (column 20) will display the last row of the map.
Pass zero if you don't want to jump to anything.
Remarks:
You cannot jump to the left and right or to the top and bottom simultaneously. Therefore has MAP_JUMPTO_LEFT higher priority than MAP_JUMPTO_RIGHT and MAP_JUMPTO_TOP has higher priority than MAP_JUMPTO_BOTTOM. When you pass MAP_JUMPTO_LEFT and MAP_JUMPTO_RIGHT, only MAP_JUMPTO_LEFT will be executed.
  // Jumps to the very right bottom position
  hel_MapJumpTo(&MapInfo, MAP_JUMPTO_RIGHT | MAP_JUMPTO_BOTTOM);

See also:
hel_MapSetPosition

void hel_MapRedraw TMapScrollInfo *  pMapInfo  ) 
 

Redraw the map.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
It's not necessary to call this function directly, though. It's internally used when you set the position using hel_MapSetPosition and hel_MapSetPositionInPixel. However, it could be handy sometimes, so here it is.

Note:
This function is (extremely) slower than hel_MapScrollBy
   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);

   hel_MapRedraw(&MapInfo);

See also:
hel_MapScrollBy

u8 hel_MapScrollBy TMapScrollInfo *  pMapInfo,
s32  DeltaX,
s32  DeltaY
 

Scroll the map.

The hel_MapScrollBy function scrolls the map and redraws only the dirty map cells (tiles), instead of redrawing the entire screen.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
DeltaX Amount in pixel to scroll on X axis. Positive numbers scroll to the right, negative to the left.
DeltaY Amount in pixel to scroll on Y axis. Positive numbers scroll to the bottom, negative to the top.
Returns:
Returns FALSE when it was not able to scroll, otherwise it is a combination these values:
  • BIT0 - Scrolled at least one pixels on X axis
  • BIT1 - Scrolled at least one pixels on Y axis
The return value is always TRUE if the the map does not use bounds-checking (hel_MapSetBoundsCheck)!
Note:
When parallax-support is enabled, the Delta parameters become multiplied by the parallax ratios!
   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
   
   while(GameLoopActive)
   {
      if(NewFrame)
      {
         if(UserPressedRight)
         {
            // Scroll one pixel to the right
            u8 ScrollResult = hel_MapScrollBy(&MapInfo, 1, 0);
            
            // check if it was able to scroll on x-axis
            if(ScrollResult & BIT1)
            {
               HEL_DEBUG_MSG("Scrolled on X");
            }
            
            // check if it was able to scroll on y-axis
            if(ScrollResult & BIT2)
            {
               HEL_DEBUG_MSG("Scrolled on Y");
            }
         }
      }
   }
   
   hel_MapDeInit(&MapInfo);

See also:
hel_MapSetCallbacks, hel_MapSetBoundsCheck, hel_MapIsBoundsCheckEnabled, hel_MapSetParallaxRatio, hel_MapSetParallax

u8 hel_MapScrollTo TMapScrollInfo *  pMapInfo,
TMapCamScrollInfo *  pMapCamInfo,
u32  SpeedX,
u32  SpeedY
 

Scroll map to a specific position automatically.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
pMapCamInfo Pointer to a TMapCamScrollInfo structure.
SpeedX Scroll speed on horizontal axis
SpeedY Scroll speed on vertical axis
Returns:
  • MAP_CAM_NEXTKEYPOINT
    Changed to the next keypoint.
  • MAP_CAM_LASTKEYREACHED
    Scrolling is done. The map has reached the position specified by the very last keypoint in pMapCamInfo

Furthermore it returns the value from hel_MapScrollBy(), when it was able to scroll. (when none of the above apply)
See also:
hel_MapScrollBy
Note:
This function scrolls the map automatically to the specified key-points specified in pMapCamInfo. The function should be called once per frame.
   TMapScrollInfo g_MapInfo;

   // X/Y Tile-Position (Camera Key-Points)
   const TPoint16 CamKeyPoints[5]=
   {
    //  X, Y Tile Positions
      {10, 5},
      {28, 5},
      {15, 5},
      {15,25},
      { 0, 0}
   };

   // Map Cinema Scrolling Information
   TMapCamScrollInfo g_MapCamInfo =
   {
      &CamKeyPoints,  // Pointer to keypoints
      5,              // Count of keypoints
      0               // Start keypoint
   };

   // Init map
   g_MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);

   u8 CamScrollWorking=1;

   while(1)
   {
      if(NewFrame)
      {

         if(CamScrollWorking)
         {
            CamScrollWorking = hel_MapScrollTo(&g_MapInfo, &g_MapCamInfo, 1, 1);
         }
         NewFrame=FALSE;
      }
   }

void hel_MapSetBoundsCheck TMapScrollInfo *  pMapInfo,
u8  Value
 

Setup map bounds checking.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Value Boundschecking on/off. Must be 1 or 0
This function enables or disables boundschecking for the structure specified by pMapInfo. This means, you cannot scroll out of the map. It stops scrolling when it hits the "edges" of the map. It's turned on by default when you use hel_MapInit.

Disabling this feature means you can scroll out of the map and this could end up in tile-curruption when you do not code an own "is current position still in map" routine.

   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
   // Turn off boundscheck
   hel_MapIsBoundsCheckEnabled(&MapInfo, FALSE);

See also:
hel_MapInit

void hel_MapSetCallbacks TMapScrollInfo *  pMapInfo,
PMapNotifyFunc  pOnTopRowChanged,
PMapNotifyFunc  pOnLeftColumnChanged
 

Setup map notify-callbacks.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
pOnTopRowChanged Pointer to function. It will be triggered when a new row has been drawn.
pOnLeftColumnChanged Pointer to function. It will be triggered when a new column has been drawn.
Note:
Hold the callbacks as small and fast as possible! Otherwise it can happen that the map is updated very weirdly. Think about just setting flags in a callback-function and progress the flags in mainloop, or similar.
   TMapScrollInfo MapInfo;

   // Is called whenever a new row has been drawn
   void MapOnTopRowChanged(TMapScrollInfo *pMapInfo, u32 X, u32 Y) 
   {                                                             
      HEL_DEBUG_MSG("MapOnTopRowChanged\n");            
      HEL_DEBUG_MSG("X: %d\n", X);                       
      HEL_DEBUG_MSG("Y: %d\n", Y);                     
   }                                                           

   // Init map
   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);

   // Set callback function(s)
   hel_MapSetCallbacks(&MapInfo, (PMapNotifyFunc)MapOnTopRowChanged, NULL);
   
   // Scroll the map by 32 pixels in X and Y
   hel_MapScrollBy(&MapInfo, 32, 32);

See also:
hel_MapScrollBy

void hel_MapSetCustomData TMapScrollInfo *  pMapInfo,
void *  pCustomData
 

Set custom data.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
pCustomData Pointer to the data you want to have assigned to this structure
Note:
With this function you can assign a pointer, to a custom structure of your game engine for example, to the map-structure specified by pMapInfo. This is handy when you work with the HEL map-callback function and need to access additional information.
See also:
hel_MapGetCustomData, hel_MapSetCallbacks

void hel_MapSetDynamicTileReloading TMapScrollInfo *  pMapInfo,
u32  Enable
 

Enable/Disable dynamic tile reloading.

The hel_MapSetDynamicTileReloading function can be used to force the mapsystem to dynamically reload tiles. Before enabling dynamic-tile-reloading, you must init a tile-system (hel_TileInit)!

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Enable Set it to TRUE to enable or FALSE to disable
  // Init the tile-system first
  hel_TileInit(0, world_Tiles, 451, BufferA, 224, BufferB, 1, 0);

  // Init map
  g_MapInfo = hel_MapInit(0, MAP_WORLD_WIDTH, MAP_WORLD_HEIGHT, FALSE, (void*)world_Map);   
  
  // Use dynamic tile reloading
  hel_MapSetDynamicTileReloading(&g_MapInfo, TRUE);

See also:
hel_TileInit

void hel_MapSetParallax TMapScrollInfo *  pMapInfo,
u8  Value
 

Enable or disable Parallax support.

Parameters:
pMapInfo Pointer to an array of initialized TMapScrollInfo structures
Value Parallax support
Use this function to enable or disable parallax for the TMapScrollInfo structure specified by pMapInfo. Specify TRUE to enable, or FALSE to disable.

See also:
hel_MapScrollBy, hel_MapIsParallaxEnabled

void hel_MapSetParallaxRatio TMapScrollInfo *  pMapInfo,
FIXED  RatioX,
FIXED  RatioY
 

Set parallax X/Y ratio.

Parameters:
pMapInfo Pointer to an array of initialized TMapScrollInfo structures
RatioX The parallax-ratio on x-axis
RatioY The parallax-ratio on y-axis
Use this function to set the parallax ratio for the structure specified by pMapInfo. This function automatically enables parallax-support for the specified structure.

   hel_MapSetParallaxRatio(&MapInfo,
                           PARALLAX_FLOAT_TO_RATIO(0.7),  // Ratio on X
                           PARALLAX_FLOAT_TO_RATIO(0.8)); // Ratio on Y

See also:
hel_MapScrollBy, hel_MapIsParallaxEnabled

void hel_MapSetPosition TMapScrollInfo *  pMapInfo,
u32  X,
u32  Y
 

Set map position in tiles.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
X X map-position in tiles
Y Y map-position in tiles
This sets the map to the specified position. X and Y must be specified in tiles.

Note:
This function sets the left/top position of a map. For example, if you call hel_MapSetPosition(&MapInfo, 2, 5), then is the first column on screen the 2nd column from map and the first row on screen is the 5th row from map.
   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
   hel_MapSetPosition(&MapInfo, 512, 0);

See also:
hel_MapSetPositionInPixel

void hel_MapSetPositionInPixel TMapScrollInfo *  pMapInfo,
u32  X,
u32  Y
 

Set map position in pixels.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
X X map-position in pixels
Y Y map-position in pixels
This sets the map to the specified position. X and Y must be specified in pixels.

   TMapScrollInfo MapInfo;

   MapInfo = hel_MapInit(0, 4096, 32, FALSE, Layer0_Map);
   hel_MapSetPositionInPixel(&MapInfo, 512, 0);

See also:
hel_MapSetPosition

void hel_MapSetScrollFlags TMapScrollInfo *  pMapInfo,
u32  Flags
 

Set Scrollflags.

The hel_MapSetScrollFlags function can be used to prevent the mapsystem to scroll into specific direction and to automatically update the map-position in VRAM.

For example: you disable scrolling for the left direction. When you call hel_MapScrollBy with DeltaX lesser than 0 (which indicates you want to scroll to the left), the system will handle the DeltaX parameter as 0 (zero) and therefore will not scroll to the left.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
Flags Use these flags to specify in what direction the mapsystem specified by pMapInfo can scroll. This can be a combination of these constants:
  • MAP_SCROLLFLAGS_LEFT - Allows the system to scroll to the left
  • MAP_SCROLLFLAGS_RIGHT - Allows the system to scroll to the right
  • MAP_SCROLLFLAGS_UP - Allows the system to scroll upwards
  • MAP_SCROLLFLAGS_DOWN - Allows the system to scroll downwards
  • MAP_SCROLLFLAGS_TRANSMITPOSITION - Allows the system to automatically transmit the map position to vram
  • MAP_SCROLLFLAGS_DEFAULT - Default flags, used when initializing a new map
Example:
  // allow the system to scroll to the left and right as well as 
  // automatically updating the map position in vram
  hel_MapSetScrollFlags(&MapInfo, MAP_SCROLLFLAGS_LEFT | MAP_SCROLLFLAGS_RIGHT | MAP_SCROLLFLAGS_TRANSMITPOSITION);
See also:
hel_MapGetScrollFlags, hel_MapScrollBy, hel_MapTransmitPosition

void hel_MapTransmitPosition TMapScrollInfo *  pMapInfo  ) 
 

Transmit position to hardware.

The hel_MapTransmitPosition function transmits the position of the map specified by pMapInfo to the hardware. Usually it is not necessary to call hel_MapTransmitPosition, because it is done automatically when you call hel_MapScrollBy and the ScrollFlags include MAP_SCROLLFLAGS_TRANSMITPOSITION. However, if you changed the ScrollFlags and MAP_SCROLLFLAGS_TRANSMITPOSITION is not set, you have to transmit the map position with hel_MapTransmitPosition.

Parameters:
pMapInfo Pointer to an initialized TMapScrollInfo structure
See also:
hel_MapSetScrollFlags


Generated on Sun Oct 9 20:21:01 2005 by DoxyGen 1.4.4