added borders to cave tiles and script to generate borders

This commit is contained in:
Dave White 2004-04-02 00:18:11 +00:00
parent 30568d6ef2
commit 8c0662fd39
26 changed files with 101 additions and 30 deletions

View File

@ -164,14 +164,6 @@ adjacent_image=grassland
light=true
[/terrain]
[terrain]
image=flag-cave-neutral
name=underground village
char=D
aliasof=t
no_overlay=true
[/terrain]
[terrain]
image=snow,snow,snow2
name=tundra
@ -230,6 +222,33 @@ aliasof=f
char=F
[/terrain]
[terrain]
image=cavewall
name=cavewall
char=W
red=50
green=50
blue=20
light=true
[/terrain]
[terrain]
image=cave
name=cave
char=u
red=120
green=120
[/terrain]
[terrain]
image=flag-cave-neutral
name=underground village
char=D
aliasof=t
no_overlay=true
adjacent_image=cave
[/terrain]
[terrain]
image=castle
name=castle
@ -248,21 +267,3 @@ unit_height_adjust=8
aliasof=C
light=true
[/terrain]
[terrain]
image=cavewall
name=cavewall
char=W
red=50
green=50
blue=20
light=true
[/terrain]
[terrain]
image=cave
name=cave
char=u
red=120
green=120
[/terrain]

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
images/terrain/cave-n.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
images/terrain/cave-ne.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

BIN
images/terrain/cave-nw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
images/terrain/cave-s.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
images/terrain/cave-se.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
images/terrain/cave-sw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -758,9 +758,13 @@ void ai::do_recruitment()
const int neutral_towers = towers - taken_towers;
//the villages per scout parameter is assumed to be based on a 2-side battle.
//in a greater than 2 side battle, we want to recruit less scouts, since the villages
//are going to be taken more quickly, and we will need combat units faster.
const int villages_per_scout = (current_team().villages_per_scout()*2)/teams_.size();
//get scouts depending on how many neutral villages there are
int scouts_wanted = current_team().villages_per_scout() > 0 ?
neutral_towers/current_team().villages_per_scout() : 0;
int scouts_wanted = villages_per_scout > 0 ? neutral_towers/villages_per_scout : 0;
std::map<std::string,int> unit_types;
while(unit_types["scout"] < scouts_wanted) {

View File

@ -472,7 +472,8 @@ public:
floating_label(const std::string& text, int font_size, const SDL_Color& colour,
int xpos, int ypos, int xmove, int ymove, int lifetime, const SDL_Rect& clip_rect)
: surf_(NULL), buf_(NULL), text_(text), font_size_(font_size), colour_(colour), xpos_(xpos), ypos_(ypos),
xmove_(xmove), ymove_(ymove), lifetime_(lifetime), clip_rect_(clip_rect)
xmove_(xmove), ymove_(ymove), lifetime_(lifetime), clip_rect_(clip_rect),
alpha_change_(-255/lifetime)
{}
void move(int xmove, int ymove);
@ -490,6 +491,7 @@ private:
int xpos_, ypos_, xmove_, ymove_;
int lifetime_;
SDL_Rect clip_rect_;
int alpha_change_;
};
typedef std::map<int,floating_label> label_map;
@ -552,6 +554,9 @@ void floating_label::undraw(SDL_Surface* screen)
move(xmove_,ymove_);
if(lifetime_ > 0) {
--lifetime_;
if(surf_ != NULL && alpha_change_ != 0) {
surf_.assign(adjust_surface_alpha_add(surf_,alpha_change_));
}
}
}

View File

@ -384,6 +384,39 @@ SDL_Surface* adjust_surface_alpha(SDL_Surface* surface, double amount)
return clone_surface(surf);
}
SDL_Surface* adjust_surface_alpha_add(SDL_Surface* surface, int amount)
{
if(surface == NULL) {
return NULL;
}
scoped_sdl_surface surf(make_neutral_surface(surface));
if(surf == NULL) {
std::cerr << "could not make neutral surface...\n";
return NULL;
}
{
surface_lock lock(surf);
Uint32* beg = lock.pixels();
Uint32* end = beg + surf->w*surf->h;
while(beg != end) {
Uint8 red, green, blue, alpha;
SDL_GetRGBA(*beg,surf->format,&red,&green,&blue,&alpha);
alpha = Uint8(maximum<int>(0,minimum<int>(255,int(alpha) + amount)));
*beg = SDL_MapRGBA(surf->format,red,green,blue,alpha);
++beg;
}
}
return clone_surface(surf);
}
SDL_Surface* blend_surface(SDL_Surface* surface, double amount, Uint32 colour)
{
if(surface == NULL) {

View File

@ -54,6 +54,7 @@ SDL_Surface* greyscale_image(SDL_Surface* surface);
SDL_Surface* brighten_image(SDL_Surface* surface, double amount);
SDL_Surface* get_surface_portion(SDL_Surface* src, SDL_Rect& rect);
SDL_Surface* adjust_surface_alpha(SDL_Surface* surface, double amount);
SDL_Surface* adjust_surface_alpha_add(SDL_Surface* surface, int amount);
SDL_Surface* blend_surface(SDL_Surface* surface, double amount, Uint32 colour);
SDL_Surface* flip_surface(SDL_Surface* surface);
SDL_Surface* flop_surface(SDL_Surface* surface);

View File

@ -139,7 +139,7 @@ void process_config(const std::string& element_name, const config& cfg,
int main()
{
config cfg(preprocess_file("data/game.cfg"));
config cfg(preprocess_file("data/game.cfg") + "\n" + preprocess_file("data/translations/"));
map<string,string> table;
process_config("",cfg,table);

27
tools/mk-edges.pl Normal file
View File

@ -0,0 +1,27 @@
print "usage: $0 <input> <stem>" and exit 0 if $#ARGV != 1;
my ($input,$stem) = @ARGV;
sub process {
my $in=shift || die;
my $edge=shift || die;
my $out=shift || die;
system <<EOF;
pngtopnm -alpha $edge >/tmp/edge-alpha.pgm;
pngtopnm $edge >/tmp/edge.ppm;
ppmtopgm /tmp/edge.ppm >/tmp/edge.pgm;
pngtopnm $in >/tmp/bg.ppm;
pnmcomp -alpha=/tmp/edge.pgm /tmp/bg.ppm /tmp/edge.ppm | pnmtopng -alpha /tmp/edge-alpha.pgm >$out;
EOF
}
foreach (glob "${stem}-*.png") {
my $edge=$1 if /$stem-(.*).png/;
if($edge=~/^[news-]*$/) {
process("${input}.png","${stem}-${edge}.png","${input}-${edge}.png");
}
}