added halo effects for mage unit

This commit is contained in:
Dave White 2004-05-26 23:09:40 +00:00
parent 695bc5346c
commit 5d1979542e
23 changed files with 129 additions and 23 deletions

View file

@ -43,16 +43,72 @@ get_hit_sound=groan.wav
[/sound]
[frame]
begin=-450
end=-400
image=mage-attack1.png
halo=halo/mage-halo1.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-400
end=-350
image=mage-attack1.png
halo=halo/mage-halo2.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-350
end=-300
image=mage-attack1.png
halo=halo/mage-halo3.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-300
end=-250
image=mage-attack2.png
halo=halo/mage-halo4.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-250
end=-200
image=mage-attack2.png
halo=halo/mage-halo5.png
halo_x,halo_y=10,-10
[/frame]
#exactly the same as the last frame, but now the missile
#has been launched, and so we don't have a halo
[frame]
begin=-200
end=-150
image=mage-attack2.png
halo=halo/mage-halo6.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-150
end=-100
image=mage-attack3.png
halo=halo/mage-halo7.png
halo_x,halo_y=10,-14
[/frame]
[frame]
begin=-100
end=-50
image=mage-attack3.png
halo=halo/mage-halo8.png
halo_x,halo_y=10,-14
[/frame]
[frame]
begin=-50
end=0
image=mage-attack3.png
halo=halo/mage-halo9.png
halo_x,halo_y=10,-14
[/frame]
[frame]
begin=0
end=50
image=mage-attack3.png
[/frame]
@ -61,6 +117,8 @@ get_hit_sound=groan.wav
end=0
image=magicmissile-n.png
image_diagonal=magicmissile-ne.png
halo=halo/mage-halo9.png
halo_x,halo_y=10,-14
[/missile_frame]
[/attack]
[/unit]

BIN
images/halo/mage-halo1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

BIN
images/halo/mage-halo2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
images/halo/mage-halo3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
images/halo/mage-halo4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
images/halo/mage-halo5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
images/halo/mage-halo6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
images/halo/mage-halo7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
images/halo/mage-halo8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/halo/mage-halo9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -85,6 +85,8 @@ bool ai::recruit_usage(const std::string& usage)
return recruit(options[option]);
}
std::cerr << "no available units to recruit that come under the price\n";
return false;
}

View file

@ -689,9 +689,9 @@ int play_game(int argc, char** argv)
std::cerr << "showing title screen...\n";
std::cerr << (SDL_GetTicks() - start_ticks) << "\n";
gui::TITLE_RESULT res = gui::CONTINUE;
gui::TITLE_RESULT res = gui::TITLE_CONTINUE;
while(res == gui::CONTINUE) {
while(res == gui::TITLE_CONTINUE) {
res = gui::show_title(disp);
}

View file

@ -1111,7 +1111,7 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
const bool bonus = cfg["bonus"] == "yes";
throw end_level_exception(VICTORY,bonus);
} else if(result == "continue") {
throw end_level_exception(CONTINUE);
throw end_level_exception(LEVEL_CONTINUE);
} else {
std::cerr << "throwing event defeat...\n";
throw end_level_exception(DEFEAT);

View file

@ -468,7 +468,7 @@ void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
for(config::child_list::const_iterator side = sides_list.begin(); side != sides_list.end(); ++side) {
if(team_num-1 == side - sides_list.begin()) {
(**side)["controller"] = preferences::client_type();
} else {
} else if((**side)["controller"] != "null") {
(**side)["controller"] = "network";
}
}

View file

@ -630,7 +630,7 @@ redo_turn:
string_table["defeat_message"],
gui::OK_ONLY);
return DEFEAT;
} else if(end_level.result == VICTORY || end_level.result == CONTINUE) {
} else if(end_level.result == VICTORY || end_level.result == LEVEL_CONTINUE) {
try {
game_events::fire("victory");
} catch(end_level_exception&) {
@ -647,7 +647,7 @@ redo_turn:
//'continue' is like a victory, except it doesn't announce victory,
//and the player returns 100% of gold.
if(end_level.result == CONTINUE) {
if(end_level.result == LEVEL_CONTINUE) {
state_of_game.gold = teams[0].gold();
return VICTORY;
}

View file

@ -34,7 +34,7 @@
#include <sstream>
#include <string>
enum LEVEL_RESULT { VICTORY, DEFEAT, QUIT, CONTINUE };
enum LEVEL_RESULT { VICTORY, DEFEAT, QUIT, LEVEL_CONTINUE };
struct end_level_exception {
end_level_exception(LEVEL_RESULT res, bool bonus=true)

View file

@ -1590,6 +1590,10 @@ void turn_info::status_table()
//shown to demonstrate lack of information about the other sides
bool fog = false;
for(size_t n = 0; n != teams_.size(); ++n) {
if(teams_[n].is_empty()) {
continue;
}
const bool known = viewing_team.knows_about_team(n);
const bool enemy = viewing_team.is_enemy(n+1);
if(!known) {

View file

@ -171,6 +171,12 @@ report generate_report(TYPE type, const gamemap& map, const unit_map& units,
report res;
std::stringstream tooltip;
const size_t team_index = u->second.side()-1;
if(team_index >= teams.size()) {
std::cerr << "illegal team index in reporting: " << team_index << "\n";
return res;
}
const std::vector<attack_type>& attacks = u->second.attacks();
for(std::vector<attack_type>::const_iterator at_it = attacks.begin();
at_it != attacks.end(); ++at_it) {
@ -187,7 +193,7 @@ report generate_report(TYPE type, const gamemap& map, const unit_map& units,
std::set<const unit_type*> seen_units;
std::map<int,std::vector<std::string> > resistances;
for(unit_map::const_iterator u_it = units.begin(); u_it != units.end(); ++u_it) {
if(current_team.is_enemy(u_it->second.side()) && !current_team.fogged(u_it->first.x,u_it->first.y) &&
if(teams[team_index].is_enemy(u_it->second.side()) && !current_team.fogged(u_it->first.x,u_it->first.y) &&
seen_units.count(&u_it->second.type()) == 0) {
seen_units.insert(&u_it->second.type());
const int resistance = u_it->second.type().movement_type().resistance_against(*at_it) - 100;

View file

@ -173,7 +173,7 @@ TITLE_RESULT show_title(display& screen)
//if the resolution has changed due to the user resizing the screen,
//or from changing between windowed and fullscreen
if(disp_change_detector.changed()) {
return CONTINUE;
return TITLE_CONTINUE;
}
SDL_Delay(20);

View file

@ -6,7 +6,7 @@
namespace gui {
enum TITLE_RESULT { TUTORIAL = 0, NEW_CAMPAIGN, MULTIPLAYER, LOAD_GAME,
CHANGE_LANGUAGE, EDIT_PREFERENCES, SHOW_ABOUT, QUIT_GAME, CONTINUE };
CHANGE_LANGUAGE, EDIT_PREFERENCES, SHOW_ABOUT, QUIT_GAME, TITLE_CONTINUE };
TITLE_RESULT show_title(display& screen);

View file

@ -279,7 +279,19 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
played_hit_sound = true;
}
const std::string* unit_image = attack.get_frame(i);
util::scoped_resource<int,halo::remover> unit_halo_effect(0);
const std::string* unit_halo = NULL;
int halo_x = 0, halo_y = 0;
const std::string* unit_image = attack.get_frame(i,NULL,attack_type::UNIT_FRAME,attack_type::VERTICAL,&unit_halo,&halo_x,&halo_y);
if(unit_halo != NULL) {
if(att->second.facing_left() == false) {
halo_x *= -1;
}
unit_halo_effect.assign(halo::add(disp.get_location_x(a)+disp.hex_width()/2 + halo_x*disp.zoom(),disp.get_location_y(a)+disp.hex_size()/2 + halo_y*disp.zoom(),*unit_halo));
}
if(unit_image == NULL) {
unit_image = &att->second.type().image_fighting(attack_type::LONG_RANGE);
@ -331,8 +343,16 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
const int missile_frame = i + first_missile;
const std::string* halo_image = NULL;
int halo_x = 0, halo_y = 0;
const std::string* missile_image = attack.get_frame(missile_frame,NULL,
attack_type::MISSILE_FRAME,dir,&halo_image);
attack_type::MISSILE_FRAME,dir,&halo_image,&halo_x,&halo_y);
if(att->second.facing_left() == false) {
halo_x *= -1;
}
halo_x *= disp.zoom();
halo_y *= disp.zoom();
static const std::string default_missile(game_config::missile_n_image);
static const std::string default_diag_missile(game_config::missile_ne_image);
@ -354,8 +374,8 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
pos = 0.0;
}
const int xpos = int(xsrc*pos + xdst*(1.0-pos));
const int ypos = int(ysrc*pos + ydst*(1.0-pos));
const int xpos = int((xsrc+halo_x)*pos + xdst*(1.0-pos));
const int ypos = int((ysrc+halo_y)*pos + ydst*(1.0-pos));
if(img != NULL) {
disp.draw_unit(xpos,ypos,img,vflip);

View file

@ -57,7 +57,9 @@ attack_type::attack_type(const config& cfg)
const int xoff = atoi((**range.first)["xoffset"].c_str());
const std::string& img = (**range.first)["image"];
const std::string& halo = (**range.first)["halo"];
frames_[UNIT_FRAME].push_back(frame(beg,end,img,halo,xoff));
const int halo_x = atoi((**range.first)["halo_x"].c_str());
const int halo_y = atoi((**range.first)["halo_y"].c_str());
frames_[UNIT_FRAME].push_back(frame(beg,end,img,halo,xoff,halo_x,halo_y));
}
range = cfg.child_range("missile_frame");
@ -69,10 +71,13 @@ attack_type::attack_type(const config& cfg)
const std::string& img = (**range.first)["image"];
const std::string& img_diag = (**range.first)["image_diagonal"];
const std::string& halo = (**range.first)["halo"];
const int halo_x = atoi((**range.first)["halo_x"].c_str());
const int halo_y = atoi((**range.first)["halo_y"].c_str());
if(img_diag.empty())
frames_[MISSILE_FRAME].push_back(frame(beg,end,img,halo,xoff));
frames_[MISSILE_FRAME].push_back(frame(beg,end,img,halo,xoff,halo_x,halo_y));
else
frames_[MISSILE_FRAME].push_back(frame(beg,end,img,img_diag,halo,xoff));
frames_[MISSILE_FRAME].push_back(frame(beg,end,img,img_diag,halo,xoff,halo_x,halo_y));
}
@ -165,7 +170,8 @@ int attack_type::get_last_frame(attack_type::FRAME_TYPE type) const
const std::string* attack_type::get_frame(int milliseconds, int* xoff,
attack_type::FRAME_TYPE type,
attack_type::FRAME_DIRECTION dir, const std::string** halo) const
attack_type::FRAME_DIRECTION dir,
const std::string** halo, int* halo_x, int* halo_y) const
{
for(std::vector<frame>::const_iterator i = frames_[type].begin();
i != frames_[type].end(); ++i) {
@ -183,6 +189,14 @@ const std::string* attack_type::get_frame(int milliseconds, int* xoff,
} else {
*halo = &i->halo;
}
if(halo_x != NULL) {
*halo_x = i->halo_x;
}
if(halo_y != NULL) {
*halo_y = i->halo_y;
}
}
if(dir == DIAGONAL && i->image_diagonal != "") {

View file

@ -54,7 +54,8 @@ public:
const std::string* get_frame(int milliseconds, int* xoffset=NULL,
FRAME_TYPE type=UNIT_FRAME,
FRAME_DIRECTION direction=VERTICAL,
const std::string** halo=NULL) const;
const std::string** halo=NULL,
int* halo_x=NULL, int* halo_y=NULL) const;
struct sfx {
int time;
@ -82,14 +83,14 @@ private:
bool backstab_;
struct frame {
frame(int i1, int i2, const std::string& img, const std::string& halo, int offset)
: start(i1), end(i2), xoffset(offset), image(img), halo(halo)
frame(int i1, int i2, const std::string& img, const std::string& halo, int offset, int halo_x, int halo_y)
: start(i1), end(i2), xoffset(offset), image(img), halo(halo), halo_x(halo_x), halo_y(halo_y)
{}
frame(int i1, int i2, const std::string& img, const std::string& diag,
const std::string& halo, int offset)
const std::string& halo, int offset, int halo_x, int halo_y)
: start(i1), end(i2), xoffset(offset),
image(img), image_diagonal(diag), halo(halo)
image(img), image_diagonal(diag), halo(halo), halo_x(halo_x), halo_y(halo_y)
{}
int start, end;
@ -97,6 +98,7 @@ private:
std::string image;
std::string image_diagonal;
std::string halo;
int halo_x, halo_y;
};
std::vector<frame> frames_[2];