Difference between revisions of "317:Construct map region"

From RuneWiki
Jump to navigationJump to search
 
(4 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
=== Description ===
 
=== Description ===
  
Jewish
+
The construct map region packet sends a dynamic map region that is constructed by using groups of 8*8 tiles. It is generally used for instanced areas, such as fight caves, and in later revisions, player owned houses.
 +
 
 +
=== Packet Structure ===
 +
 
 +
{| border=2
 +
! Data type
 +
! Description
 +
|-
 +
| [[Data_Types#Standard_data_types|Short]] [[Data_Types#Non_Standard_Data_Types|Special A]]
 +
| The region Y coordinate (absolute Y coordinate / 8), plus 6.
 +
|-
 +
| [[#Bit block|Bit block]]
 +
| See below.
 +
|-
 +
| [[Data_Types#Standard_data_types|Short]]
 +
| The region X coordinate (absolute X coordinate / 8), plus 6.
 +
|}
 +
 
 +
==== Bit block ====
 +
 
 +
The bit block actually contains the 'palette' of map regions to make up the new region.
 +
 
 +
There is a loop, like this, used to construct it:
 +
 
 +
for(int z = 0; z < 4; z++) {
 +
  for(int x = 0; x < 13; x++) {
 +
  for(int y = 0; y < 13; y++) {
 +
    // data for this region
 +
  }
 +
  }
 +
}
 +
 
 +
The individual format in each iteration of the loop is:
 +
 
 +
* '''1 bit''' - set to 0 to indicate to display nothing, 1 to display a region
 +
* '''26 bits''' - if the flag above is set to 1 - region x << 14 | region y << 3

Latest revision as of 19:23, 11 October 2009

Construct map region
Constructs a new map region from a palette of 8x8 tiles.
Opcode 241
Type Variable Short
Length N/A

Construct Map Region

Description

The construct map region packet sends a dynamic map region that is constructed by using groups of 8*8 tiles. It is generally used for instanced areas, such as fight caves, and in later revisions, player owned houses.

Packet Structure

Data type Description
Short Special A The region Y coordinate (absolute Y coordinate / 8), plus 6.
Bit block See below.
Short The region X coordinate (absolute X coordinate / 8), plus 6.

Bit block

The bit block actually contains the 'palette' of map regions to make up the new region.

There is a loop, like this, used to construct it:

for(int z = 0; z < 4; z++) {
 for(int x = 0; x < 13; x++) {
  for(int y = 0; y < 13; y++) {
   // data for this region
  }
 }
}

The individual format in each iteration of the loop is:

  • 1 bit - set to 0 to indicate to display nothing, 1 to display a region
  • 26 bits - if the flag above is set to 1 - region x << 14 | region y << 3