added female Mage and Red Mage images and implementation

This commit is contained in:
Dave White 2004-08-01 00:14:13 +00:00
parent 9065286dbd
commit 5bd639bf41
17 changed files with 244 additions and 45 deletions

2
configure vendored
View file

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 1.65 .
# From configure.ac Revision: 1.66 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for Battle for Wesnoth 0.8.1-CVS.
#

View file

@ -1,12 +1,13 @@
[unit]
name=Mage
race=human
gender=male,female
image=mage.png
image_defensive=mage-defend.png
hitpoints=24
movement_type=smallfoot
movement=5
experience=60
experience=1
level=1
alignment=lawful
advanceto=White Mage,Red Mage
@ -62,4 +63,71 @@ get_hit_sound=groan.wav
halo_x,halo_y=10,-14
[/missile_frame]
[/attack]
[female]
name=Mage
race=human
gender=female
image=female-mage.png
image_defensive=female-mage-defend.png
hitpoints=24
movement_type=smallfoot
movement=5
experience=1
level=1
alignment=lawful
advanceto=White Mage,Red Mage
cost=21
usage=mixed fighter
unit_description="Mages are both weak and powerful. Moving slowly, and with poor defensive skills, Mages attack with magical missiles that always have a high chance of hitting their target. For this reason, Mages are an excellent choice for flushing out enemies hiding in difficult terrain."
get_hit_sound=female-hit.wav
[attack]
name=dagger
type=blade
range=short
damage=5
number=1
[frame]
begin=-100
end=100
image=female-mage-attack.png
[/frame]
[sound]
time=-100
sound=dagger-swish.wav
[/sound]
[/attack]
[attack]
name=missile
type=fire
range=long
special=magical
damage=7
number=3
[sound]
time=-200
sound=magicmissile.wav
[/sound]
[frame]
begin=-450
end=0
image=female-mage-attack1.png
halo=halo/mage-halo1.png,halo/mage-halo2.png,halo/mage-halo3.png,halo/mage-halo4.png,halo/mage-halo5.png,halo/mage-halo6.png,halo/mage-halo7.png,halo/mage-halo8.png,halo/mage-halo9.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=0
end=50
image=female-mage-attack1.png
[/frame]
[missile_frame]
begin=-200
end=0
image=projectiles/magicmissile-n.png
image_diagonal=projectiles/magicmissile-ne.png
halo=halo/mage-halo9.png,halo/mage-halo10.png,halo/mage-halo11.png,halo/mage-halo12.png,halo/mage-halo13.png,
halo_x,halo_y=10,-14
[/missile_frame]
[/attack]
[/female]
[/unit]

View file

@ -3,6 +3,7 @@ name=Red Mage
race=human
image=red-mage.png
image_defensive=red-mage-defend.png
gender=male,female
hitpoints=42
movement_type=smallfoot
[resistance]
@ -64,4 +65,73 @@ get_hit_sound=groan.wav
halo_x,halo_y=14,-14
[/missile_frame]
[/attack]
[female]
name=Red Mage
race=human
image=female-red-mage.png
image_defensive=female-red-mage-defend.png
gender=female
hitpoints=42
movement_type=smallfoot
[resistance]
fire=90
[/resistance]
movement=5
experience=100
level=2
alignment=neutral
advanceto=Arch Mage,Silver Mage
cost=60
usage=mixed fighter
unit_description="Red Mages attack with powerful magic fireballs that are guaranteed a good chance of hitting. Deft of foot, and skilled fighters both day and night, Red Mages are therefore valuable in almost all situations."
get_hit_sound=female-hit.wav
[attack]
name=dagger
type=blade
range=short
damage=6
number=2
[frame]
begin=-100
end=100
image=female-red-mage-attack.png
[/frame]
[sound]
time=-100
sound=dagger-swish.wav
[/sound]
[/attack]
[attack]
name=fireball
type=fire
range=long
special=magical
damage=8
number=4
[frame]
begin=-300
end=0
image=female-red-mage-attack1.png
halo=halo/fireball1.png,halo/fireball2.png,halo/fireball3.png,halo/fireball4.png,halo/fireball5.png,halo/fireball6.png
halo_x,halo_y=14,-14
[/frame]
[frame]
begin=0
end=100
image=female-red-mage-attack1.png
[/frame]
[sound]
time=-200
sound=fire.wav
[/sound]
[missile_frame]
begin=-100
end=0
image=projectiles/fireball.png
halo=halo/fireball7.png
halo_x,halo_y=14,-14
[/missile_frame]
[/attack]
[/female]
[/unit]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
images/female-mage.png Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
images/female-red-mage.png Normal file

Binary file not shown.

View file

@ -56,34 +56,40 @@ unit::unit(const game_data& data, const config& cfg) : state_(STATE_NORMAL),
read(data,cfg);
}
unit_race::GENDER unit::generate_gender(const unit_type& type, bool gen)
{
const std::vector<unit_race::GENDER>& genders = type.genders();
if(genders.empty() == false) {
return gen ? genders[get_random()%genders.size()] : genders.front();
} else {
return unit_race::MALE;
}
}
//constructor for creating a new unit
unit::unit(const unit_type* t, int side, bool use_traits, bool dummy_unit) :
type_(t), state_(STATE_NORMAL),
hitpoints_(t->hitpoints()),
maxHitpoints_(t->hitpoints()),
backupMaxHitpoints_(t->hitpoints()), experience_(0),
maxExperience_(t->experience_needed()),
backupMaxExperience_(t->experience_needed()),
side_(side), gender_(unit_race::MALE), moves_(0),
gender_(generate_gender(*t,use_traits)),
type_(t->get_gender_unit_type(gender_)), state_(STATE_NORMAL),
hitpoints_(type_->hitpoints()),
maxHitpoints_(type_->hitpoints()),
backupMaxHitpoints_(type_->hitpoints()), experience_(0),
maxExperience_(type_->experience_needed()),
backupMaxExperience_(type_->experience_needed()),
side_(side), moves_(0),
user_end_turn_(false), facingLeft_(side != 1),
maxMovement_(t->movement()),
backupMaxMovement_(t->movement()),
recruit_(false), attacks_(t->attacks()),
backupAttacks_(t->attacks()),
maxMovement_(type_->movement()),
backupMaxMovement_(type_->movement()),
recruit_(false), attacks_(type_->attacks()),
backupAttacks_(type_->attacks()),
guardian_(false), upkeep_(UPKEEP_FULL_PRICE)
{
//dummy units used by the 'move_unit_fake' command don't need to have a side.
if(dummy_unit == false) validate_side(side_);
const std::vector<unit_race::GENDER>& genders = t->genders();
if(genders.empty() == false) {
gender_ = use_traits ? genders[get_random()%genders.size()] : genders.front();
}
if(use_traits) {
//units that don't have traits generated are just generic
//units, so they shouldn't get a description either.
description_ = t->generate_description();
description_ = type_->generate_description();
generate_traits();
}
@ -91,21 +97,22 @@ unit::unit(const unit_type* t, int side, bool use_traits, bool dummy_unit) :
//constructor for advancing a unit from a lower level
unit::unit(const unit_type* t, const unit& u) :
type_(t), state_(STATE_NORMAL),
hitpoints_(t->hitpoints()),
maxHitpoints_(t->hitpoints()),
backupMaxHitpoints_(t->hitpoints()),
gender_(u.gender_), type_(t->get_gender_unit_type(u.gender_)),
state_(STATE_NORMAL),
hitpoints_(type_->hitpoints()),
maxHitpoints_(type_->hitpoints()),
backupMaxHitpoints_(type_->hitpoints()),
experience_(0),
maxExperience_(t->experience_needed()),
backupMaxExperience_(t->experience_needed()),
side_(u.side()), gender_(u.gender_), moves_(u.moves_),
maxExperience_(type_->experience_needed()),
backupMaxExperience_(type_->experience_needed()),
side_(u.side()), moves_(u.moves_),
user_end_turn_(false), facingLeft_(u.facingLeft_),
maxMovement_(t->movement()),
backupMaxMovement_(t->movement()),
maxMovement_(type_->movement()),
backupMaxMovement_(type_->movement()),
underlying_description_(u.underlying_description_),
description_(u.description_), recruit_(u.recruit_),
role_(u.role_), statusFlags_(u.statusFlags_),
attacks_(t->attacks()), backupAttacks_(t->attacks()),
attacks_(type_->attacks()), backupAttacks_(type_->attacks()),
modifications_(u.modifications_),
traitsDescription_(u.traitsDescription_),
guardian_(false), upkeep_(u.upkeep_),
@ -586,20 +593,6 @@ void unit::read(const game_data& data, const config& cfg)
assert(type_ != NULL);
attacks_ = type_->attacks();
backupAttacks_ = attacks_;
maxHitpoints_ = type_->hitpoints();
backupMaxHitpoints_ = type_->hitpoints();
maxMovement_ = type_->movement();
backupMaxMovement_ = type_->movement();
maxExperience_ = type_->experience_needed();
backupMaxExperience_ = type_->experience_needed();
side_ = atoi(cfg["side"].c_str());
if(side_ <= 0) {
side_ = 1;
}
const std::string& gender = cfg["gender"];
if(gender == "male") {
gender_ = unit_race::MALE;
@ -614,6 +607,22 @@ void unit::read(const game_data& data, const config& cfg)
}
}
type_ = type_->get_gender_unit_type(gender_);
attacks_ = type_->attacks();
backupAttacks_ = attacks_;
maxHitpoints_ = type_->hitpoints();
backupMaxHitpoints_ = type_->hitpoints();
maxMovement_ = type_->movement();
backupMaxMovement_ = type_->movement();
maxExperience_ = type_->experience_needed();
backupMaxExperience_ = type_->experience_needed();
side_ = atoi(cfg["side"].c_str());
if(side_ <= 0) {
side_ = 1;
}
validate_side(side_);
description_ = cfg["user_description"];

View file

@ -150,6 +150,9 @@ public:
const gamemap::location& get_interrupted_move() const;
void set_interrupted_move(const gamemap::location& interrupted_move);
private:
unit_race::GENDER generate_gender(const unit_type& type, bool use_genders);
unit_race::GENDER gender_;
const unit_type* type_;
enum STATE { STATE_NORMAL, STATE_ATTACKING,
@ -166,8 +169,6 @@ private:
int side_;
unit_race::GENDER gender_;
//is set to the number of moves left, ATTACKED if attacked,
// MOVED if moved and then pressed "end turn"
// NOT_MOVED if not moved and pressed "end turn"

View file

@ -496,10 +496,36 @@ void unit_movement_type::set_parent(const unit_movement_type* parent)
parent_ = parent;
}
unit_type::unit_type(const unit_type& o)
: cfg_(o.cfg_), race_(o.race_), alpha_(o.alpha_), abilities_(o.abilities_),
max_heals_(o.max_heals_), heals_(o.heals_), regenerates_(o.regenerates_),
leadership_(o.leadership_), illuminates_(o.illuminates_),
skirmish_(o.skirmish_), teleport_(o.teleport_),
nightvision_(o.nightvision_), can_advance_(o.can_advance_),
movementType_(o.movementType_), possibleTraits_(o.possibleTraits_),
genders_(o.genders_), defensive_animations_(o.defensive_animations_)
{
gender_types_[0] = o.gender_types_[0] != NULL ? new unit_type(*o.gender_types_[0]) : NULL;
gender_types_[1] = o.gender_types_[1] != NULL ? new unit_type(*o.gender_types_[1]) : NULL;
}
unit_type::unit_type(const config& cfg, const movement_type_map& mv_types,
const race_map& races, const std::vector<config*>& traits)
: cfg_(cfg), alpha_(1.0), possibleTraits_(traits), movementType_(cfg)
{
gender_types_[0] = NULL;
gender_types_[1] = NULL;
const config* const male_cfg = cfg.child("male");
if(male_cfg != NULL) {
gender_types_[unit_race::MALE] = new unit_type(*male_cfg,mv_types,races,traits);
}
const config* const female_cfg = cfg.child("female");
if(female_cfg != NULL) {
gender_types_[unit_race::FEMALE] = new unit_type(*female_cfg,mv_types,races,traits);
}
const std::vector<std::string> genders = config::split(cfg["gender"]);
for(std::vector<std::string>::const_iterator i = genders.begin();
i != genders.end(); ++i) {
@ -568,6 +594,22 @@ unit_type::unit_type(const config& cfg, const movement_type_map& mv_types,
}
}
unit_type::~unit_type()
{
delete gender_types_[unit_race::MALE];
delete gender_types_[unit_race::FEMALE];
}
const unit_type* unit_type::get_gender_unit_type(unit_race::GENDER gender) const
{
const size_t i = gender;
if(i < sizeof(gender_types_)/sizeof(*gender_types_) && gender_types_[i] != NULL) {
return gender_types_[i];
}
return this;
}
int unit_type::num_traits() const { return race_->num_traits(); }
std::string unit_type::generate_description() const

View file

@ -153,6 +153,11 @@ public:
//for at least as long as the class instance
unit_type(const config& cfg, const movement_type_map& movement_types,
const race_map& races, const std::vector<config*>& traits);
unit_type(const unit_type& o);
~unit_type();
const unit_type* get_gender_unit_type(unit_race::GENDER gender) const;
int num_traits() const;
@ -230,6 +235,10 @@ public:
const unit_animation* defend_animation(bool hits, attack_type::RANGE range) const;
private:
void operator=(const unit_type& o);
unit_type* gender_types_[2];
const config& cfg_;
const unit_race* race_;