$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "stratagus.h"
#include "editor.h"
#include "map.h"
#include "tileset.h"
#include "ui.h"
#include "player.h"
#include "unit.h"
#include "unittype.h"
edmap.cpp - Editor map functions. | |
#define | TH_QUAD_M 0xFFFF0000 |
#define | BH_QUAD_M 0x0000FFFF |
#define | LH_QUAD_M 0xFF00FF00 |
#define | RH_QUAD_M 0x00FF00FF |
#define | DIR_UP 8 |
#define | DIR_DOWN 4 |
#define | DIR_LEFT 2 |
#define | DIR_RIGHT 1 |
#define | WATER_TILE 0x10 |
#define | COAST_TILE 0x30 |
#define | GRASS_TILE 0x50 |
#define | WOOD_TILE 0x70 |
#define | ROCK_TILE 0x80 |
static void | EditorTileChanged2 (const Vec2i &pos, int d) |
Callback for changed tile (with direction mask). | |
static unsigned | QuadFromTile (const Vec2i &pos) |
static int | FindTilePath (int base, int goal, int length, char *marks, int *tile) |
static int | TileFromQuad (unsigned fixed, unsigned quad) |
void | ChangeTile (const Vec2i &pos, int tile) |
static void | EditorChangeTile (const Vec2i &pos, int tile, int d) |
void | EditorTileChanged (const Vec2i &pos) |
static void | TileFill (const Vec2i &pos, int tile, int size) |
static void | EditorRandomizeTile (int tile, int count, int max_size) |
static void | EditorRandomizeUnit (const char *unit_type, int count, int value) |
static void | EditorDestroyAllUnits () |
#define BH_QUAD_M 0x0000FFFF |
#define COAST_TILE 0x30 |
#define DIR_DOWN 4 |
#define DIR_LEFT 2 |
#define DIR_RIGHT 1 |
#define DIR_UP 8 |
#define GRASS_TILE 0x50 |
#define LH_QUAD_M 0xFF00FF00 |
#define RH_QUAD_M 0x00FF00FF |
#define ROCK_TILE 0x80 |
#define TH_QUAD_M 0xFFFF0000 |
#define WATER_TILE 0x10 |
#define WOOD_TILE 0x70 |
void ChangeTile | ( | const Vec2i & | pos, | |
int | tile | |||
) |
Change tile from abstract tile-type.
pos | map tile coordinate. | |
tile | Abstract tile type to edit. |
static void EditorChangeTile | ( | const Vec2i & | pos, | |
int | tile, | |||
int | d | |||
) | [static] |
Editor change tile.
pos | map tile coordinate. | |
tile | Tile type to edit. | |
d | Fix direction flag 8 up, 4 down, 2 left, 1 right. |
static void EditorDestroyAllUnits | ( | ) | [static] |
Destroy all units
static void EditorRandomizeTile | ( | int | tile, | |
int | count, | |||
int | max_size | |||
) | [static] |
Randomize tiles and fill in map
tile | tile number to use | |
count | number of times to apply randomization | |
max_size | maximum size of the fill rectangle |
static void EditorRandomizeUnit | ( | const char * | unit_type, | |
int | count, | |||
int | value | |||
) | [static] |
Add a unit to random locations on the map, unit will be neutral
unit_type | unit type to add to map as a character string | |
count | the number of times to add the unit | |
value | resources to be stored in that unit |
void EditorTileChanged | ( | const Vec2i & | pos | ) |
Update surroundings for tile changes.
pos | Map tile position of change. |
static void EditorTileChanged2 | ( | const Vec2i & | pos, | |
int | d | |||
) | [static] |
Callback for changed tile (with direction mask).
Update surroundings for tile changes.
pos | Map X tile position of change. | |
y | Map Y tile position of change. | |
d | Fix direction flag 8 up, 4 down, 2 left, 1 right. |
static int FindTilePath | ( | int | base, | |
int | goal, | |||
int | length, | |||
char * | marks, | |||
int * | tile | |||
) | [static] |
Find a tile path.
base | Start tile type. | |
goal | Goal tile type. | |
length | Best found path length. | |
marks | Already visited tile types. | |
tile | Tile pointer. |
static unsigned QuadFromTile | ( | const Vec2i & | pos | ) | [static] |
Get quad from tile.
A quad is a 32 bit value defining the content of the tile.
A tile is split into 4 parts, the basic tile type of this part is stored as 8bit value in the quad.
ab cd -> abcd
If the tile is 100% light grass the value is 0x5555. If the tile is 3/4 light grass and dark grass in upper left corner the value is 0x6555.
pos | map tile position |
static void TileFill | ( | const Vec2i & | pos, | |
int | tile, | |||
int | size | |||
) | [static] |
Make random map FIXME: vladi: we should have parameters control here... TileFill
pos | map tile coordinate for area center. | |
y | Y map tile coordinate for area center. | |
tile | Tile type to edit. | |
size | Size of surrounding rectangle. |
static int TileFromQuad | ( | unsigned | fixed, | |
unsigned | quad | |||
) | [static] |
Get tile from quad.
fixed | Part can't be changed. | |
quad | Quad of the tile type. |