> > |
%META:TOPICINFO{author="ElminI" date="1085344800" format="1.0" version="1.1"}%
%META:TOPICPARENT{name="WebHome"}%
Map data in Zippy is still stored in parallel arrays for the moment. Here are some tips on this confusing structure:
Fans and tiles are the same; the terms may be used interchangeably to describe individual squares on the map; however, the array meshtile[] refers to the portion of the texture graphic used to render a particular tile. Don't get the term "fan" confused with OpenGL's triangle fan construction -- in Egoboo source it just means "tile".
"basicdat/fans.txt" defines 26 tile types. These types tell the engine the following things about tiles of each type:
- How many vertices the tile has
- What the texture coordinates of each vertex are
- The "ref" of each vertex (what does this mean?)
- How many commands are needed to draw the tile, and
- Which vertices are in each command.
The first four vertices of every tile correspond to the four corners of the tile, as follows:
| Index | Location |
| 0 | (0, 0) (Top Left) |
| 1 | (1, 0) (Top Right) |
| 2 | (1, 1) (Bottom Right) |
| 3 | (0, 1) (Bottom Left) |
Each tile command makes an OpenGL triangle strip.
Wherever possible, the accessor methods in map.h should be used. For example, instead of computing the tile index with meshfanstart[y>>7]+x>>7, use get_tile(x, y). Instead of meshfx[fan]&MESHFXWATER, use tile_has_water(fan). This will make it easier to tranition to better storage methods.
-- ElminI - 23 May 2004 |