CleanUp
This commit is contained in:
parent
1505616e28
commit
87bfbcf25e
10 changed files with 190 additions and 190 deletions
|
@ -181,7 +181,7 @@ void RevealMap(void)
|
|||
** @param x X map tile position.
|
||||
** @param y Y map tile position.
|
||||
** @param offsetx X offset in tile.
|
||||
** @param offsety Y offset in tile.
|
||||
** @param offsety Y offset in tile.
|
||||
*/
|
||||
void ViewportSetViewpoint(Viewport* vp, int x, int y, int offsetx, int offsety)
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ void ViewportSetViewpoint(Viewport* vp, int x, int y, int offsetx, int offsety)
|
|||
** @param x X map tile position.
|
||||
** @param y Y map tile position.
|
||||
** @param offsetx X offset in tile.
|
||||
** @param offsety Y offset in tile.
|
||||
** @param offsety Y offset in tile.
|
||||
*/
|
||||
void ViewportCenterViewpoint(Viewport* vp, int x, int y, int offsetx, int offsety)
|
||||
{
|
||||
|
|
|
@ -247,23 +247,23 @@ int AnyMapAreaVisibleInViewport(const Viewport* vp, int sx, int sy,
|
|||
**
|
||||
** StephanR: variables explained below for screen:<PRE>
|
||||
** *---------------------------------------*
|
||||
** | |
|
||||
** | *-----------------------* |<-TheUi.MapY,dy (in pixels)
|
||||
** | | | | | | | | | |
|
||||
** | | | | | | | | | |
|
||||
** | |---+---+---+---+---+---| | |
|
||||
** | | | | | | | | | |MapHeight (in tiles)
|
||||
** | | | | | | | | | |
|
||||
** | |---+---+---+---+---+---| | |
|
||||
** | | | | | | | | | |
|
||||
** | | | | | | | | | |
|
||||
** | *-----------------------* |<-ey,TheUI.MapEndY (in pixels)
|
||||
** | |
|
||||
** | |
|
||||
** | |
|
||||
** | *-----------------------* |<-TheUi.MapY,dy (in pixels)
|
||||
** | | | | | | | | | |
|
||||
** | | | | | | | | | |
|
||||
** | |---+---+---+---+---+---| | |
|
||||
** | | | | | | | | | |MapHeight (in tiles)
|
||||
** | | | | | | | | | |
|
||||
** | |---+---+---+---+---+---| | |
|
||||
** | | | | | | | | | |
|
||||
** | | | | | | | | | |
|
||||
** | *-----------------------* |<-ey,TheUI.MapEndY (in pixels)
|
||||
** | |
|
||||
** | |
|
||||
** *---------------------------------------*
|
||||
** ^ ^
|
||||
** dx|-----------------------|ex,TheUI.MapEndX (in pixels)
|
||||
** TheUI.MapX MapWidth (in tiles)
|
||||
** ^ ^
|
||||
** dx|-----------------------|ex,TheUI.MapEndX (in pixels)
|
||||
** TheUI.MapX MapWidth (in tiles)
|
||||
** (in pixels)
|
||||
** </PRE>
|
||||
*/
|
||||
|
|
|
@ -277,11 +277,11 @@ void MapUnmarkTileSight(const Player* player, int x, int y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Mark a tile for cloak detection.
|
||||
** Mark a tile for cloak detection.
|
||||
**
|
||||
** @param player Player to mark sight.
|
||||
** @param x X tile to mark.
|
||||
** @param y Y tile to mark.
|
||||
** @param player Player to mark sight.
|
||||
** @param x X tile to mark.
|
||||
** @param y Y tile to mark.
|
||||
*/
|
||||
void MapMarkTileDetectCloak(const Player* player, int x, int y)
|
||||
{
|
||||
|
@ -297,11 +297,11 @@ void MapMarkTileDetectCloak(const Player* player, int x, int y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Unmark a tile for cloak detection.
|
||||
** Unmark a tile for cloak detection.
|
||||
**
|
||||
** @param player Player to mark sight.
|
||||
** @param x X tile to mark.
|
||||
** @param y Y tile to mark.
|
||||
** @param player Player to mark sight.
|
||||
** @param x X tile to mark.
|
||||
** @param y Y tile to mark.
|
||||
*/
|
||||
void MapUnmarkTileDetectCloak(const Player* player, int x, int y)
|
||||
{
|
||||
|
@ -936,7 +936,7 @@ void InitMapFogOfWar(void)
|
|||
SDL_Surface* s;
|
||||
|
||||
//
|
||||
// Generate Only Fog surface.
|
||||
// Generate Only Fog surface.
|
||||
//
|
||||
s = SDL_CreateRGBSurface(SDL_SWSURFACE, TileSizeX, TileSizeY,
|
||||
32, RMASK, GMASK, BMASK, AMASK);
|
||||
|
@ -951,7 +951,7 @@ void InitMapFogOfWar(void)
|
|||
SDL_FreeSurface(s);
|
||||
|
||||
//
|
||||
// Generate Alpha Fog surface.
|
||||
// Generate Alpha Fog surface.
|
||||
//
|
||||
if (TheMap.TileGraphic->Surface->format->BytesPerPixel == 1) {
|
||||
AlphaFogSurface = SDL_DisplayFormat(TheMap.TileGraphic->Surface);
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
/**@name map_rock.c - The map rock handling. */
|
||||
/**@name map_rock.c - The map rock handling. */
|
||||
//
|
||||
// (c) Copyright 1999-2002 by Vladi Shabanski and Lutz Sammer
|
||||
// (c) Copyright 1999-2002 by Vladi Shabanski and Lutz Sammer
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,7 +26,7 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
// $Id$
|
||||
// $Id$
|
||||
|
||||
//@{
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
/**@name map_save.c - Saving the map. */
|
||||
/**@name map_save.c - Saving the map. */
|
||||
//
|
||||
// (c) Copyright 2001-2004 by Lutz Sammer and Jimmy Salmon
|
||||
//
|
||||
|
@ -31,7 +31,7 @@
|
|||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -49,17 +49,17 @@
|
|||
#include "script.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Functions
|
||||
-- Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
** Save the complete map.
|
||||
** Save the complete map.
|
||||
**
|
||||
** @param file Output file.
|
||||
** @param file Output file.
|
||||
*/
|
||||
void SaveMap(CLFile* file)
|
||||
{
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
/**@name map_wall.c - The map wall handling. */
|
||||
/**@name map_wall.c - The map wall handling. */
|
||||
//
|
||||
// (c) Copyright 1999-2002 by Vladi Shabanski
|
||||
// (c) Copyright 1999-2002 by Vladi Shabanski
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,12 +26,12 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
// $Id$
|
||||
// $Id$
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -45,19 +45,19 @@
|
|||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Declarations
|
||||
-- Declarations
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Functions
|
||||
-- Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Fix walls (connections)
|
||||
-- Fix walls (connections)
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
|
@ -71,11 +71,11 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
** Check if the seen tile-type is wall.
|
||||
** Check if the seen tile-type is wall.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param walltype Walltype to check. (-1 any kind)
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param walltype Walltype to check. (-1 any kind)
|
||||
*/
|
||||
int MapIsSeenTileWall(int x, int y, int walltype)
|
||||
{
|
||||
|
@ -90,10 +90,10 @@ int MapIsSeenTileWall(int x, int y, int walltype)
|
|||
}
|
||||
|
||||
/**
|
||||
** Correct the seen wall field, depending on the surrounding.
|
||||
** Correct the seen wall field, depending on the surrounding.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
void MapFixSeenWallTile(int x, int y)
|
||||
{
|
||||
|
@ -131,35 +131,35 @@ void MapFixSeenWallTile(int x, int y)
|
|||
if (t == TileTypeHumanWall) {
|
||||
tile = TheMap.Tileset->HumanWallTable[tile];
|
||||
if (UnitTypeHumanWall && mf->Value <= UnitTypeHumanWall->_HitPoints / 2) {
|
||||
while (TheMap.Tileset->Table[tile]){ // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]){ // Skip good tiles
|
||||
++tile;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tile = TheMap.Tileset->OrcWallTable[tile];
|
||||
if (UnitTypeOrcWall && mf->Value <= UnitTypeOrcWall->_HitPoints / 2) {
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
++tile;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mf->Value == 0) {
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
++tile;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
}
|
||||
}
|
||||
tile = TheMap.Tileset->Table[tile];
|
||||
|
||||
if (mf->SeenTile != tile) { // Already there!
|
||||
if (mf->SeenTile != tile) { // Already there!
|
||||
mf->SeenTile = tile;
|
||||
|
||||
// FIXME: can this only happen if seen?
|
||||
|
@ -171,24 +171,24 @@ void MapFixSeenWallTile(int x, int y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Correct the surrounding seen wall fields.
|
||||
** Correct the surrounding seen wall fields.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
void MapFixSeenWallNeighbors(int x, int y)
|
||||
{
|
||||
MapFixSeenWallTile(x + 1, y); // side neighbors
|
||||
MapFixSeenWallTile(x + 1, y); // side neighbors
|
||||
MapFixSeenWallTile(x - 1, y);
|
||||
MapFixSeenWallTile(x, y + 1);
|
||||
MapFixSeenWallTile(x, y - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
** Correct the real wall field, depending on the surrounding.
|
||||
** Correct the real wall field, depending on the surrounding.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
void MapFixWallTile(int x, int y)
|
||||
{
|
||||
|
@ -230,29 +230,29 @@ void MapFixWallTile(int x, int y)
|
|||
if (t & MapFieldHuman) {
|
||||
tile = TheMap.Tileset->HumanWallTable[tile];
|
||||
if (UnitTypeHumanWall && mf->Value <= UnitTypeHumanWall->_HitPoints / 2) {
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
++tile;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tile = TheMap.Tileset->OrcWallTable[tile];
|
||||
if (UnitTypeOrcWall && mf->Value <= UnitTypeOrcWall->_HitPoints / 2) {
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
++tile;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mf->Value == 0) {
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
++tile;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
}
|
||||
}
|
||||
|
@ -271,24 +271,24 @@ void MapFixWallTile(int x, int y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Correct the surrounding real wall fields.
|
||||
** Correct the surrounding real wall fields.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
static void MapFixWallNeighbors(int x, int y)
|
||||
{
|
||||
MapFixWallTile(x + 1, y); // side neighbors
|
||||
MapFixWallTile(x + 1, y); // side neighbors
|
||||
MapFixWallTile(x - 1, y);
|
||||
MapFixWallTile(x, y + 1);
|
||||
MapFixWallTile(x, y - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
** Remove wall from the map.
|
||||
** Remove wall from the map.
|
||||
**
|
||||
** @param x Map X position.
|
||||
** @param y Map Y position.
|
||||
** @param x Map X position.
|
||||
** @param y Map Y position.
|
||||
*/
|
||||
void MapRemoveWall(unsigned x, unsigned y)
|
||||
{
|
||||
|
@ -313,13 +313,13 @@ void MapRemoveWall(unsigned x, unsigned y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Set wall onto the map.
|
||||
** Set wall onto the map.
|
||||
**
|
||||
** @param x Map X position.
|
||||
** @param y Map Y position.
|
||||
** @param humanwall Flag, if true set a human wall.
|
||||
** @param x Map X position.
|
||||
** @param y Map Y position.
|
||||
** @param humanwall Flag, if true set a human wall.
|
||||
**
|
||||
** @todo FIXME: support for more races.
|
||||
** @todo FIXME: support for more races.
|
||||
*/
|
||||
void MapSetWall(unsigned x, unsigned y, int humanwall)
|
||||
{
|
||||
|
@ -355,11 +355,11 @@ void MapSetWall(unsigned x, unsigned y, int humanwall)
|
|||
}
|
||||
|
||||
/**
|
||||
** Wall is hit with damage.
|
||||
** Wall is hit with damage.
|
||||
**
|
||||
** @param x Map X tile-position of wall.
|
||||
** @param y Map Y tile-position of wall.
|
||||
** @param damage Damage done to wall.
|
||||
** @param x Map X tile-position of wall.
|
||||
** @param y Map Y tile-position of wall.
|
||||
** @param damage Damage done to wall.
|
||||
*/
|
||||
void HitWall(unsigned x, unsigned y, unsigned damage)
|
||||
{
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
/**@name map_wood.c - The map wood handling. */
|
||||
/**@name map_wood.c - The map wood handling. */
|
||||
//
|
||||
// (c) Copyright 1999-2002 by Vladi Shabanski and Lutz Sammer
|
||||
// (c) Copyright 1999-2002 by Vladi Shabanski and Lutz Sammer
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,18 +26,18 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
// $Id$
|
||||
// $Id$
|
||||
|
||||
//@{
|
||||
|
||||
/*
|
||||
** Note:
|
||||
** This functions are doubled. One for the real map tile and one
|
||||
** for the tile that the player sees.
|
||||
** Note:
|
||||
** This functions are doubled. One for the real map tile and one
|
||||
** for the tile that the player sees.
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -52,20 +52,20 @@
|
|||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
int ForestRegeneration; /// Forest regeneration
|
||||
int ForestRegeneration; /// Forest regeneration
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Functions
|
||||
-- Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
** Check if the seen tile-type is wood.
|
||||
** Check if the seen tile-type is wood.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
int MapIsSeenTileWood(int x, int y)
|
||||
{
|
||||
|
@ -74,10 +74,10 @@ int MapIsSeenTileWood(int x, int y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Correct the seen wood field, depending on the surrounding.
|
||||
** Correct the seen wood field, depending on the surrounding.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
void MapFixSeenWoodTile(int x, int y)
|
||||
{
|
||||
|
@ -163,11 +163,11 @@ void MapFixSeenWoodTile(int x, int y)
|
|||
|
||||
//Update seen tile.
|
||||
mf = TheMap.Fields + x + y * TheMap.Width;
|
||||
if (tile == -1) { // No valid wood remove it.
|
||||
if (tile == -1) { // No valid wood remove it.
|
||||
mf->SeenTile = TheMap.Tileset->RemovedTree;
|
||||
MapFixSeenWoodNeighbors(x, y);
|
||||
} else if (TheMap.Tileset->MixedLookupTable[mf->SeenTile] ==
|
||||
TheMap.Tileset->MixedLookupTable[tile]) { //Same Type
|
||||
TheMap.Tileset->MixedLookupTable[tile]) { //Same Type
|
||||
return;
|
||||
} else {
|
||||
mf->SeenTile = tile;
|
||||
|
@ -181,46 +181,46 @@ void MapFixSeenWoodTile(int x, int y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Correct the surrounding seen wood fields.
|
||||
** Correct the surrounding seen wood fields.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
void MapFixSeenWoodNeighbors(int x, int y)
|
||||
{
|
||||
MapFixSeenWoodTile(x + 1, y); // side neighbors
|
||||
MapFixSeenWoodTile(x + 1, y); // side neighbors
|
||||
MapFixSeenWoodTile(x - 1, y);
|
||||
MapFixSeenWoodTile(x, y + 1);
|
||||
MapFixSeenWoodTile(x, y - 1);
|
||||
MapFixSeenWoodTile(x + 1, y - 1); // side neighbors
|
||||
MapFixSeenWoodTile(x + 1, y - 1); // side neighbors
|
||||
MapFixSeenWoodTile(x - 1, y - 1);
|
||||
MapFixSeenWoodTile(x - 1, y + 1);
|
||||
MapFixSeenWoodTile(x + 1, y + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
** Correct the surrounding real wood fields.
|
||||
** Correct the surrounding real wood fields.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
static void MapFixWoodNeighbors(int x, int y)
|
||||
{
|
||||
MapFixWoodTile(x + 1, y); // side neighbors
|
||||
MapFixWoodTile(x + 1, y); // side neighbors
|
||||
MapFixWoodTile(x - 1, y);
|
||||
MapFixWoodTile(x, y + 1);
|
||||
MapFixWoodTile(x, y - 1);
|
||||
MapFixWoodTile(x + 1, y - 1); // side neighbors
|
||||
MapFixWoodTile(x + 1, y - 1); // side neighbors
|
||||
MapFixWoodTile(x - 1, y - 1);
|
||||
MapFixWoodTile(x - 1, y + 1);
|
||||
MapFixWoodTile(x + 1, y + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
** Correct the real wood field, depending on the surrounding.
|
||||
** Correct the real wood field, depending on the surrounding.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
void MapFixWoodTile(int x, int y)
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ void MapFixWoodTile(int x, int y)
|
|||
tile = TheMap.Tileset->WoodTable[tile];
|
||||
}
|
||||
|
||||
if (tile == -1) { // No valid wood remove it.
|
||||
if (tile == -1) { // No valid wood remove it.
|
||||
MapRemoveWood(x, y);
|
||||
} else if (TheMap.Tileset->MixedLookupTable[mf->Tile] !=
|
||||
TheMap.Tileset->MixedLookupTable[tile]) {
|
||||
|
@ -319,10 +319,10 @@ void MapFixWoodTile(int x, int y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Remove wood from the map.
|
||||
** Remove wood from the map.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
void MapRemoveWood(unsigned x, unsigned y)
|
||||
{
|
||||
|
@ -349,7 +349,7 @@ void MapRemoveWood(unsigned x, unsigned y)
|
|||
}
|
||||
|
||||
/**
|
||||
** Regenerate forest.
|
||||
** Regenerate forest.
|
||||
*/
|
||||
void RegenerateForest(void)
|
||||
{
|
||||
|
|
|
@ -60,25 +60,25 @@ static unsigned char* MinimapTerrainSurface;
|
|||
static int MinimapTextureWidth;
|
||||
static int MinimapTextureHeight;
|
||||
#else
|
||||
static SDL_Surface* MinimapSurface; /// generated minimap
|
||||
static SDL_Surface* MinimapTerrainSurface; /// generated minimap terrain
|
||||
static SDL_Surface* MinimapSurface; /// generated minimap
|
||||
static SDL_Surface* MinimapTerrainSurface; /// generated minimap terrain
|
||||
#endif
|
||||
static int* Minimap2MapX; /// fast conversion table
|
||||
static int* Minimap2MapY; /// fast conversion table
|
||||
static int Map2MinimapX[MaxMapWidth]; /// fast conversion table
|
||||
static int Map2MinimapY[MaxMapHeight]; /// fast conversion table
|
||||
static int* Minimap2MapX; /// fast conversion table
|
||||
static int* Minimap2MapY; /// fast conversion table
|
||||
static int Map2MinimapX[MaxMapWidth]; /// fast conversion table
|
||||
static int Map2MinimapY[MaxMapHeight]; /// fast conversion table
|
||||
|
||||
// MinimapScale:
|
||||
// 32x32 64x64 96x96 128x128 256x256 512x512 ...
|
||||
// *4 *2 *4/3 *1 *1/2 *1/4
|
||||
static int MinimapScaleX; /// Minimap scale to fit into window
|
||||
static int MinimapScaleY; /// Minimap scale to fit into window
|
||||
int MinimapX; /// Minimap drawing position x offset
|
||||
int MinimapY; /// Minimap drawing position y offset
|
||||
// MinimapScale:
|
||||
// 32x32 64x64 96x96 128x128 256x256 512x512 ...
|
||||
// *4 *2 *4/3 *1 *1/2 *1/4
|
||||
static int MinimapScaleX; /// Minimap scale to fit into window
|
||||
static int MinimapScaleY; /// Minimap scale to fit into window
|
||||
int MinimapX; /// Minimap drawing position x offset
|
||||
int MinimapY; /// Minimap drawing position y offset
|
||||
|
||||
int MinimapWithTerrain = 1; /// display minimap with terrain
|
||||
int MinimapFriendly = 1; /// switch colors of friendly units
|
||||
int MinimapShowSelected = 1; /// highlight selected units
|
||||
int MinimapWithTerrain = 1; /// display minimap with terrain
|
||||
int MinimapFriendly = 1; /// switch colors of friendly units
|
||||
int MinimapShowSelected = 1; /// highlight selected units
|
||||
|
||||
/**
|
||||
** Create a mini-map from the tiles of the map.
|
||||
|
@ -93,7 +93,7 @@ void CreateMinimap(void)
|
|||
SDL_PixelFormat* f;
|
||||
#endif
|
||||
|
||||
if (TheMap.Width > TheMap.Height) { // Scale to biggest value.
|
||||
if (TheMap.Width > TheMap.Height) { // Scale to biggest value.
|
||||
n = TheMap.Width;
|
||||
} else {
|
||||
n = TheMap.Height;
|
||||
|
@ -112,7 +112,7 @@ void CreateMinimap(void)
|
|||
MinimapX _C_ MinimapY);
|
||||
|
||||
//
|
||||
// Calculate minimap fast lookup tables.
|
||||
// Calculate minimap fast lookup tables.
|
||||
//
|
||||
// FIXME: this needs to be recalculated during map load - the map size
|
||||
// might have changed!
|
||||
|
@ -156,7 +156,7 @@ void CreateMinimap(void)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
memset(MinimapSurface, 0, MinimapTextureWidth * MinimapTextureHeight * 4);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, MinimapTextureWidth,
|
||||
MinimapTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
MinimapTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
MinimapSurface);
|
||||
#endif
|
||||
|
||||
|
@ -303,7 +303,7 @@ void UpdateMinimapTerrain(void)
|
|||
c = *(Uint32*)&((Uint8*)TheMap.TileGraphic->Surface->pixels)[
|
||||
(xofs + 7 + (mx % scalex) * 8) * bpp + (yofs + 6 + (my % scaley) * 8) *
|
||||
TheMap.TileGraphic->Surface->pitch];
|
||||
c = VideoMapRGB(0,
|
||||
c = VideoMapRGB(0,
|
||||
((c & f->Rmask) >> f->Rshift),
|
||||
((c & f->Gmask) >> f->Gshift),
|
||||
((c & f->Bmask) >> f->Bshift));
|
||||
|
@ -419,7 +419,7 @@ void UpdateMinimapXY(int tx, int ty)
|
|||
c = *(Uint32*)&((Uint8*)TheMap.TileGraphic->Surface->pixels)[
|
||||
(xofs + 7 + (mx % scalex) * 8) * 4 + (yofs + 6 + (my % scaley) * 8) *
|
||||
TheMap.TileGraphic->Surface->pitch];
|
||||
c = VideoMapRGB(0,
|
||||
c = VideoMapRGB(0,
|
||||
((c & f->Rmask) >> f->Rshift),
|
||||
((c & f->Gmask) >> f->Gshift),
|
||||
((c & f->Bmask) >> f->Bshift));
|
||||
|
@ -436,7 +436,7 @@ void UpdateMinimapXY(int tx, int ty)
|
|||
}
|
||||
|
||||
/**
|
||||
** Draw an unit on the minimap.
|
||||
** Draw an unit on the minimap.
|
||||
*/
|
||||
static void DrawUnitOnMinimap(Unit* unit, int red_phase)
|
||||
{
|
||||
|
@ -484,11 +484,11 @@ static void DrawUnitOnMinimap(Unit* unit, int red_phase)
|
|||
mx = 1 + MinimapX + Map2MinimapX[unit->X];
|
||||
my = 1 + MinimapY + Map2MinimapY[unit->Y];
|
||||
w = Map2MinimapX[type->TileWidth];
|
||||
if (mx + w >= TheUI.MinimapW) { // clip right side
|
||||
if (mx + w >= TheUI.MinimapW) { // clip right side
|
||||
w = TheUI.MinimapW - mx;
|
||||
}
|
||||
h0 = Map2MinimapY[type->TileHeight];
|
||||
if (my + h0 >= TheUI.MinimapH) { // clip bottom side
|
||||
if (my + h0 >= TheUI.MinimapH) { // clip bottom side
|
||||
h0 = TheUI.MinimapH - my;
|
||||
}
|
||||
#ifndef USE_OPENGL
|
||||
|
@ -540,7 +540,7 @@ void UpdateMinimap(void)
|
|||
bpp = MinimapSurface->format->BytesPerPixel;
|
||||
#endif
|
||||
//
|
||||
// Draw the terrain
|
||||
// Draw the terrain
|
||||
//
|
||||
for (my = 0; my < TheUI.MinimapH; ++my) {
|
||||
for (mx = 0; mx < TheUI.MinimapW; ++mx) {
|
||||
|
@ -584,8 +584,8 @@ void UpdateMinimap(void)
|
|||
#endif
|
||||
|
||||
//
|
||||
// Draw units on map
|
||||
// FIXME: We should rewrite this completely
|
||||
// Draw units on map
|
||||
// FIXME: We should rewrite this completely
|
||||
//
|
||||
n = UnitCacheSelect(0, 0, TheMap.Height, TheMap.Width, table);
|
||||
while (n--) {
|
||||
|
|
|
@ -352,7 +352,7 @@ static int DefineTilesetParseSolid(lua_State* l, Tileset* tileset, int index)
|
|||
for (i = 0; i < len; ++i) {
|
||||
lua_rawgeti(l, -1, i + 1);
|
||||
tileset->Table[index + i] = LuaToNumber(l, -1);
|
||||
// tt->SolidTiles[i] = tileset->Table[index + i] = LuaToNumber(l, -1);
|
||||
// tt->SolidTiles[i] = tileset->Table[index + i] = LuaToNumber(l, -1);
|
||||
lua_pop(l, 1);
|
||||
tileset->FlagsTable[index + i] = f;
|
||||
tileset->Tiles[index + i].BaseTerrain = basic_name;
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
/**@name tileset.c - The tileset. */
|
||||
/**@name tileset.c - The tileset. */
|
||||
//
|
||||
// (c) Copyright 1998-2003 by Lutz Sammer and Jimmy Salmon
|
||||
// (c) Copyright 1998-2003 by Lutz Sammer and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,12 +26,12 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
// $Id$
|
||||
// $Id$
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -45,46 +45,46 @@
|
|||
#include "iolib.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
** Mapping of wc numbers to our internal tileset symbols.
|
||||
** The numbers are used in puds.
|
||||
** 0=summer, 1=winter, 2=wasteland, 3=swamp.
|
||||
** Mapping of wc numbers to our internal tileset symbols.
|
||||
** The numbers are used in puds.
|
||||
** 0 = summer, 1 = winter, 2 = wasteland, 3 = swamp.
|
||||
*/
|
||||
char** TilesetWcNames;
|
||||
|
||||
/**
|
||||
** Number of available Tilesets.
|
||||
** Number of available Tilesets.
|
||||
*/
|
||||
int NumTilesets;
|
||||
|
||||
/**
|
||||
** Tileset information.
|
||||
** Tileset information.
|
||||
**
|
||||
** @see TilesetMax, @see NumTilesets
|
||||
** @see TilesetMax, @see NumTilesets
|
||||
*/
|
||||
Tileset** Tilesets;
|
||||
|
||||
/**
|
||||
** Size of a tile in X
|
||||
** Size of a tile in X
|
||||
*/
|
||||
int TileSizeX = 32;
|
||||
|
||||
/**
|
||||
** Size of a tile in Y
|
||||
** Size of a tile in Y
|
||||
*/
|
||||
int TileSizeY = 32;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Functions
|
||||
-- Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
** Load tileset and setup ::TheMap for this tileset.
|
||||
** Load tileset and setup ::TheMap for this tileset.
|
||||
**
|
||||
** @see TheMap @see Tilesets.
|
||||
** @see TheMap @see Tilesets.
|
||||
*/
|
||||
void LoadTileset(void)
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ void LoadTileset(void)
|
|||
i += 256;
|
||||
} else {
|
||||
if (TheMap.Tileset->Tiles[i].BaseTerrain != 0 &&
|
||||
TheMap.Tileset->Tiles[i].MixTerrain == 0) {
|
||||
TheMap.Tileset->Tiles[i].MixTerrain == 0) {
|
||||
if (TheMap.Tileset->FlagsTable[i] & MapFieldForest) {
|
||||
solid = i;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ void LoadTileset(void)
|
|||
break;
|
||||
case 10:
|
||||
TheMap.Tileset->MixedLookupTable[table[i]] = 8 + 4 + 2;
|
||||
break;
|
||||
break;
|
||||
case 11:
|
||||
TheMap.Tileset->MixedLookupTable[table[i]] = 2 + 1;
|
||||
break;
|
||||
|
@ -384,7 +384,7 @@ void LoadTileset(void)
|
|||
break;
|
||||
case 10:
|
||||
TheMap.Tileset->MixedLookupTable[table[i]] = 8 + 4 + 2;
|
||||
break;
|
||||
break;
|
||||
case 11:
|
||||
TheMap.Tileset->MixedLookupTable[table[i]] = 2 + 1;
|
||||
break;
|
||||
|
@ -425,7 +425,7 @@ void LoadTileset(void)
|
|||
TheMap.Tileset->RockTable[18] = TheMap.Tileset->TopOneRock;
|
||||
TheMap.Tileset->RockTable[19] = TheMap.Tileset->MidOneRock;
|
||||
//
|
||||
// FIXME: Build wall replacement tables
|
||||
// FIXME: Build wall replacement tables
|
||||
//
|
||||
TheMap.Tileset->HumanWallTable[ 0] = 0x090;
|
||||
TheMap.Tileset->HumanWallTable[ 1] = 0x830;
|
||||
|
@ -465,19 +465,19 @@ void LoadTileset(void)
|
|||
for (i = 0; i < 16; ++i) {
|
||||
n = 0;
|
||||
tile = TheMap.Tileset->HumanWallTable[i];
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
++tile;
|
||||
++n;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
++n;
|
||||
}
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
while (TheMap.Tileset->Table[tile]) { // Skip good tiles
|
||||
++tile;
|
||||
++n;
|
||||
}
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
while (!TheMap.Tileset->Table[tile]) { // Skip separator
|
||||
++tile;
|
||||
++n;
|
||||
}
|
||||
|
@ -491,9 +491,9 @@ void LoadTileset(void)
|
|||
}
|
||||
|
||||
/**
|
||||
** Cleanup the tileset module.
|
||||
** Cleanup the tileset module.
|
||||
**
|
||||
** @note this didn't frees the configuration memory.
|
||||
** @note this didn't frees the configuration memory.
|
||||
*/
|
||||
void CleanTilesets(void)
|
||||
{
|
||||
|
@ -502,7 +502,7 @@ void CleanTilesets(void)
|
|||
char** ptr;
|
||||
|
||||
//
|
||||
// Free the tilesets
|
||||
// Free the tilesets
|
||||
//
|
||||
for (i = 0; i < NumTilesets; ++i) {
|
||||
free(Tilesets[i]->Ident);
|
||||
|
@ -527,15 +527,15 @@ void CleanTilesets(void)
|
|||
NumTilesets = 0;
|
||||
|
||||
//
|
||||
// Should this be done by the map?
|
||||
// Should this be done by the map?
|
||||
//
|
||||
VideoSafeFree(TheMap.TileGraphic);
|
||||
TheMap.TileGraphic = NULL;
|
||||
|
||||
//
|
||||
// Mapping the original tileset numbers in puds to our internal strings
|
||||
// Mapping the original tileset numbers in puds to our internal strings
|
||||
//
|
||||
if ((ptr = TilesetWcNames)) { // Free all old names
|
||||
if ((ptr = TilesetWcNames)) { // Free all old names
|
||||
while (*ptr) {
|
||||
free(*ptr++);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue