added 'Show Haloing Effects' option. Tweaks to Valley of Death

This commit is contained in:
Dave White 2004-06-06 21:01:27 +00:00
parent 964691db38
commit 4479dfadcd
16 changed files with 173 additions and 74 deletions

View file

@ -32,11 +32,11 @@ gggggggggggvggggfffggdccgggfg
ggggggggggggggggggggdccdggggg
gggCCCggggggggggggggdcccvgcgg
gggC1Cgggggggggggdddccscdccgg
gggCCCgggggggggddccccsscccscg
gggggggggggggvdcdccccssccsssc
gghghgggggggdddccccsssssssssc
hhhhhhgggggdcccccssssssssssss
mhmhmhhcgcdcccccsssssssssssss
gggCCCgdgggggggddccccsscccscg
gggggggcddddgvdcdccccssccsssc
gghghggcccccdddccccsssssssssc
hhhhhhggcccccccccssssssssssss
mhmhmhhcccccccccsssssssssssss
mhmmmhccccccccgccssssssssssss
mmmmmmcvcdcddcdcssssssssscdcs
mmmmhccgggdggdccsssssssscdgdc

View file

@ -21,5 +21,5 @@ male_names="Althaas,Burin,Glomin,Glamcatus,Trithaithis,Gomdrol,Andurus,Pelaithol
#enddef
#define VILLAGE_NAMES
male_names="Ox,Hol,Il,Del,El,York,Corn,Hel,Sel,Sil,Sal,Bal,Water,Sen,Sed,Hex,Hox,Fox,Bal,Wet,Earl,Fren,Kin,Tal,Gel,Nam,Sam,Jam,Olf,Old,New,Ol,Nes,Jim,Cam"
male_names="Ox,Hol,Il,Del,El,York,Corn,Hel,Sel,Sil,Sal,Bal,Water,Sen,Sed,Hex,Hox,Fox,Bal,Wet,Earl,Fren,Kin,Tal,Gel,Nam,Sam,Olf,Old,New,Ol,Nes,Cam,Rook,Rock,Oul"
#enddef

View file

@ -46,6 +46,18 @@ Defeat:
{CROSS 250 264}
[/bigmap]
[label]
x,y=12,16
id=princess_bridge
text="Elmar's Crossing"
[/label]
[label]
x,y=13,17
id=princess_bridge_village
text="Elbridge"
[/label]
[side]
race=Elves
type=Commander
@ -63,7 +75,7 @@ Defeat:
canrecruit=1
facing=reverse
{GOLD 150 300 500}
{GOLD 100 200 350}
{INCOME 5 12 20}
#ifdef EASY

View file

@ -43,6 +43,10 @@ Defeat:
[ai]
grouping=no
simple_targetting=yes
recruitment_ignore_bad_combat=yes
recruitment_ignore_bad_movement=yes
aggression=1.0
caution=-5.0
[/ai]
#enddef
@ -110,6 +114,7 @@ Defeat:
aggression=1.0
village_value=0.0
leader_value=50.0
villages_per_scout=0.0
[/ai]
[/side]

View file

@ -302,6 +302,7 @@ turn_dialog_button="Turn Dialog"
turn_bell_button="Turn Bell"
show_side_colours="Show Team Colors"
show_colour_cursors="Show Color Cursors"
show_haloes="Show Haloing Effects"
lawful=Lawful
neutral=Neutral
@ -752,7 +753,7 @@ tip_of_day4="The terrain your units are on determines the chance your opponents
tip_of_day5="Poisoned units lose 8 hitpoints every turn, but they will not die from poison: poison will never reduce them below 1 hitpoint. Poisoned units can be cured by moving them to a village, or placing them next to a unit with the 'cure' ability."
tip_of_day6="You can use units from a previous scenario by selecting 'Recall' by the game menu. By recalling the asme units over and over, you can build up a powerful and experienced army."
tip_of_day7="All units have a Zone of Control in each of the hexes next to them. If a unit moves into an enemy's Zone of Control, it may not move any further that turn."
tip_of_day8="The chance to hit a unit usually depends on how well that unit can defend itself in the terrain it is standing in, however magical attacks always have a 70% chacne to hit, and marksman attacks have at least 60% chance to hit."
tip_of_day8="The chance to hit a unit usually depends on how well that unit can defend itself in the terrain it is standing in, however magical attacks always have a 70% chance to hit, and marksman attacks have at least 60% chance to hit."
tip_of_day9="Units stationed in villages heal 8 hitpoints at the beginning of their turn."
tip_of_day10="Units that do not move or attack during their turn rest, and will recover 2 hitpoints at the beginning of their next turn."
tip_of_day11="Most foot units defend better in villages and castles than in most other terrain, while most mounted units don't get any defensive advantage in villages and castles."
@ -778,4 +779,6 @@ tip_of_day30="Holy attacks are very powerful against undead."
tip_of_day31="Units are healed when they advance a level. Used wisely, this can turn a fight."
tip_of_day32="Charging units are best used against enemies they can kill with a single blow."
tome="-- The Tome of Wesnoth"
[/language]

View file

@ -29,12 +29,12 @@ get_hit_sound=female-hit.wav
[frame]
begin=-200
end=-100
image=elvish-shayde-ftouch-attack1.png
image=elvish-shyde-ftouch-attack1.png
[/frame]
[frame]
begin=-100
end=100
image=elvish-shayde-ftouch-attack2.png
image=elvish-shyde-ftouch-attack2.png
[/frame]
[/attack]

View file

@ -24,6 +24,7 @@
#include "pathfind.hpp"
#include "playlevel.hpp"
#include "playturn.hpp"
#include "preferences.hpp"
#include "replay.hpp"
#include "sound.hpp"
#include "statistics.hpp"
@ -120,11 +121,16 @@ std::string recruit_unit(const gamemap& map, int side,
new_unit.set_attacked();
}
const bool show = disp != NULL && !disp->turbo() &&
!disp->fogged(recruit_location.x,recruit_location.y);
if(show) {
disp->draw(true,true);
}
units.insert(std::pair<gamemap::location,unit>(
recruit_location,new_unit));
if(disp != NULL && !disp->turbo() &&
!disp->fogged(recruit_location.x,recruit_location.y)) {
if(show) {
for(double alpha = 0.0; alpha <= 1.0; alpha += 0.1) {
events::pump();
@ -1125,15 +1131,20 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
for(healer_itor i = healer_itors.first; i != healer_itors.second; ++i) {
assert(units.count(i->second));
unit& healer = units.find(i->second)->second;
healer.set_healing(true);
const std::string& halo_image = healer.type().image_halo_healing();
if(halo_image.empty() == false) {
halo::add(disp.get_location_x(i->second)+disp.hex_size()/2,disp.get_location_y(i->second)+disp.hex_size()/2,
halo_image,healer.facing_left() ? halo::NORMAL : halo::REVERSE,1);
}
disp.draw_tile(i->second.x,i->second.y);
//only show healing frames if haloing is enabled, or if there is no halo
if(halo_image.empty() || preferences::show_haloes()) {
healer.set_healing(true);
if(halo_image.empty() == false) {
halo::add(disp.get_location_x(i->second)+disp.hex_size()/2,disp.get_location_y(i->second)+disp.hex_size()/2,
halo_image,healer.facing_left() ? halo::NORMAL : halo::REVERSE,1);
}
disp.draw_tile(i->second.x,i->second.y);
}
}
disp.update_display();

View file

@ -522,10 +522,12 @@ void config::read(const std::string& data,
clear();
std::stack<std::string> element_names;
std::stack<int> element_locs;
std::stack<config*> elements;
std::stack<std::map<std::string,config*> > last_element; //allows [+element] syntax
elements.push(this);
element_names.push("");
element_locs.push(0);
last_element.push(std::map<std::string,config*>());
enum { ELEMENT_NAME, IN_ELEMENT, VARIABLE_NAME, VALUE }
@ -585,6 +587,7 @@ void config::read(const std::string& data,
elements.pop();
element_names.pop();
element_locs.pop();
last_element.pop();
if(elements.empty()) {
@ -618,6 +621,7 @@ void config::read(const std::string& data,
if(itor != last_element.top().end()) {
elements.push(itor->second);
element_names.push(value);
element_locs.push(line);
last_element.push(std::map<std::string,config*>());
state = IN_ELEMENT;
value = "";
@ -627,6 +631,7 @@ void config::read(const std::string& data,
elements.push(&elements.top()->add_child(value));
element_names.push(value);
element_locs.push(line);
last_element.push(std::map<std::string,config*>());
state = IN_ELEMENT;
@ -731,12 +736,10 @@ void config::read(const std::string& data,
}
}
assert(!element_names.empty());
const std::string top = element_names.top();
element_names.pop();
if(!element_names.empty()) {
throw error("Configuration not terminated: no closing tag to '" +
top + "'");
throw error("Configuration not terminated: no closing tag to '" + top + "' (line " + str_cast(element_locs.top()) + ")");
}
}

View file

@ -221,7 +221,7 @@ SDL_Surface* render_text(TTF_Font* font,const std::string& text, const SDL_Color
size_t width = 0, height = 0;
for(std::vector<std::string>::const_iterator ln = lines.begin(); ln != lines.end(); ++ln) {
if(*ln != "" && font != NULL) {
shared_sdl_surface res(render_text_internal(font,*ln,colour,0));
shared_sdl_surface res(render_text_internal(font,*ln,colour,style));
if(res != NULL) {
surfaces.push_back(res);

View file

@ -30,7 +30,8 @@ namespace game_config
bool debug = false, editor = false;
std::string game_icon = "wesnoth-icon.png", game_title, game_logo, title_music;
int title_logo_x = 0, title_logo_y = 0, title_buttons_x = 0, title_buttons_y = 0, title_buttons_padding = 0;
int title_logo_x = 0, title_logo_y = 0, title_buttons_x = 0, title_buttons_y = 0, title_buttons_padding = 0,
title_tip_x = 0, title_tip_y = 0, title_tip_width = 0, title_tip_padding = 0;
std::string missile_n_image, missile_ne_image;
@ -98,6 +99,10 @@ namespace game_config
title_buttons_x = atoi(v["buttons_x"].c_str());
title_buttons_y = atoi(v["buttons_y"].c_str());
title_buttons_padding = atoi(v["buttons_padding"].c_str());
title_tip_x = atoi(v["tip_x"].c_str());
title_tip_y = atoi(v["tip_y"].c_str());
title_tip_width = atoi(v["tip_width"].c_str());
title_tip_padding = atoi(v["tip_padding"].c_str());
map_image = v["map_image"];
rightside_image = v["sidebar_image"];

View file

@ -44,7 +44,7 @@ namespace game_config
missile_n_image,missile_ne_image,terrain_mask_image,observer_image,
checked_menu_image,unchecked_menu_image;
extern int title_logo_x, title_logo_y, title_buttons_x, title_buttons_y, title_buttons_padding;
extern int title_logo_x, title_logo_y, title_buttons_x, title_buttons_y, title_buttons_padding, title_tip_x, title_tip_y, title_tip_width, title_tip_padding;
namespace sounds {
extern const std::string turn_bell, receive_message, user_arrive, user_leave;

View file

@ -1,5 +1,6 @@
#include "halo.hpp"
#include "image.hpp"
#include "preferences.hpp"
#include "sdl_utils.hpp"
#include "util.hpp"
@ -253,7 +254,7 @@ void remove(int handle)
void render()
{
if(hide_halo) {
if(hide_halo || preferences::show_haloes() == false) {
return;
}
@ -269,7 +270,7 @@ void render()
void unrender()
{
if(hide_halo) {
if(hide_halo || preferences::show_haloes() == false) {
return;
}

View file

@ -168,13 +168,12 @@ void turn_info::turn_slice()
if(key_[SDLK_DOWN] || mousey > gui_.y()-scroll_threshold)
gui_.scroll(0,preferences::scroll_speed());
if(textbox_.active() == false) {
if(key_[SDLK_LEFT] || mousex < scroll_threshold)
gui_.scroll(-preferences::scroll_speed(),0);
const bool use_left_right = (textbox_.active() == false);
if(use_left_right && key_[SDLK_LEFT] || mousex < scroll_threshold)
gui_.scroll(-preferences::scroll_speed(),0);
if(key_[SDLK_RIGHT] || mousex > gui_.x()-scroll_threshold)
gui_.scroll(preferences::scroll_speed(),0);
}
if(use_left_right && key_[SDLK_RIGHT] || mousex > gui_.x()-scroll_threshold)
gui_.scroll(preferences::scroll_speed(),0);
}
bool turn_info::turn_over() const { return end_turn_; }
@ -1120,43 +1119,39 @@ void turn_info::end_turn()
if(browse_)
return;
bool unmoved_units = false, partmoved_units = false;
for(unit_map::const_iterator un = units_.begin(); un != units_.end(); ++un) {
if(un->second.side() == team_num_) {
if(unit_can_move(un->first,units_,map_,teams_)) {
if(un->second.movement_left() == un->second.total_movement()) {
unmoved_units = true;
}
partmoved_units = true;
}
}
}
//Ask for confirmation if the player hasn't made any moves (other than gotos).
if(preferences::confirm_no_moves()) {
if(preferences::confirm_no_moves() && unmoved_units) {
if (recorder.ncommands() == start_ncmd_) {
const int res = gui::show_dialog(gui_,NULL,"",string_table["end_turn_no_moves"], gui::YES_NO);
if (res != 0) return;
if(res != 0) {
return;
}
}
}
// Ask for confirmation if units still have movement left
if(preferences::yellow_confirm()) {
for(unit_map::const_iterator un = units_.begin(); un != units_.end(); ++un) {
if(un->second.side() == team_num_ &&
unit_can_move(un->first,units_,map_,teams_)) {
const int res = gui::show_dialog(gui_,NULL,"",
string_table["end_turn_message"],
gui::YES_NO);
if (res != 0) {
return;
} else {
break;
}
}
if(preferences::yellow_confirm() && partmoved_units) {
const int res = gui::show_dialog(gui_,NULL,"",string_table["end_turn_message"],gui::YES_NO);
if (res != 0) {
return;
}
} else if (preferences::green_confirm()) {
for(unit_map::const_iterator un = units_.begin(); un != units_.end(); ++un) {
if(un->second.side() == team_num_ &&
un->second.movement_left() == un->second.total_movement() &&
unit_can_move(un->first,units_,map_,teams_)) {
const int res = gui::show_dialog(gui_,NULL,"",
string_table["end_turn_message"],
gui::YES_NO);
if (res != 0) {
return;
} else {
break;
}
}
} else if (preferences::green_confirm() && unmoved_units) {
const int res = gui::show_dialog(gui_,NULL,"",string_table["end_turn_message"],gui::YES_NO);
if (res != 0) {
return;
}
}

View file

@ -41,6 +41,8 @@ bool colour_cursors = false;
bool message_private_on = true;
bool haloes = true;
}
namespace preferences {
@ -53,6 +55,7 @@ manager::manager()
set_sound_volume(sound_volume());
set_colour_cursors(prefs["colour_cursors"] == "yes");
set_show_haloes(prefs["show_haloes"] != "no");
}
manager::~manager()
@ -458,6 +461,17 @@ void set_show_tip_of_day(bool value)
prefs["tip_of_day"] = value ? "yes" : "no";
}
bool show_haloes()
{
return haloes;
}
void set_show_haloes(bool value)
{
haloes = value;
prefs["show_haloes"] = value ? "yes" : "no";
}
void show_preferences_dialog(display& disp)
{
const events::resize_lock prevent_resizing;
@ -467,7 +481,7 @@ void show_preferences_dialog(display& disp)
log_scope("show_preferences_dialog");
const int width = 600;
const int height = 400;
const int height = 450;
const int xpos = disp.x()/2 - width/2;
const int ypos = disp.y()/2 - height/2;
@ -555,36 +569,35 @@ void show_preferences_dialog(display& disp)
grid_button.set_location(slider_left,sound_pos + 80 + 100);
gui::button floating_labels_button(disp,string_table["floating_labels_button"],
gui::button::TYPE_CHECK);
gui::button floating_labels_button(disp,string_table["floating_labels_button"],gui::button::TYPE_CHECK);
floating_labels_button.set_check(show_floating_labels());
floating_labels_button.set_location(slider_left,sound_pos + 80 + 150);
gui::button resolution_button(disp,string_table["video_mode"]);
resolution_button.set_location(slider_left,sound_pos + 80 + 200);
resolution_button.set_location(slider_left,sound_pos + 80 + 250);
gui::button turn_dialog_button(disp,string_table["turn_dialog_button"],
gui::button::TYPE_CHECK);
gui::button turn_dialog_button(disp,string_table["turn_dialog_button"],gui::button::TYPE_CHECK);
turn_dialog_button.set_check(turn_dialog());
turn_dialog_button.set_location(slider_left+fullscreen_button.width()+100,sound_pos + 80);
gui::button turn_bell_button(disp,string_table["turn_bell_button"],
gui::button::TYPE_CHECK);
gui::button turn_bell_button(disp,string_table["turn_bell_button"],gui::button::TYPE_CHECK);
turn_bell_button.set_check(turn_bell());
turn_bell_button.set_location(slider_left+fullscreen_button.width()+100,sound_pos + 80 + 50);
gui::button side_colours_button(disp,string_table["show_side_colours"],
gui::button::TYPE_CHECK);
gui::button side_colours_button(disp,string_table["show_side_colours"],gui::button::TYPE_CHECK);
side_colours_button.set_check(show_side_colours());
side_colours_button.set_location(slider_left + fullscreen_button.width() + 100,sound_pos + 80 + 100);
gui::button colour_cursors_button(disp,string_table["show_colour_cursors"],
gui::button::TYPE_CHECK);
gui::button colour_cursors_button(disp,string_table["show_colour_cursors"],gui::button::TYPE_CHECK);
colour_cursors_button.set_check(use_colour_cursors());
colour_cursors_button.set_location(slider_left + fullscreen_button.width() + 100,sound_pos + 80 + 150);
gui::button haloes_button(disp,string_table["show_haloes"],gui::button::TYPE_CHECK);
haloes_button.set_check(show_haloes());
haloes_button.set_location(slider_left + fullscreen_button.width() + 100,sound_pos + 80 + 200);
gui::button hotkeys_button (disp,string_table["hotkeys_button"]);
hotkeys_button.set_location(slider_left + fullscreen_button.width() + 100,sound_pos + 80 + 200);
hotkeys_button.set_location(slider_left + fullscreen_button.width() + 100,sound_pos + 80 + 250);
bool redraw_all = true;
@ -619,6 +632,7 @@ void show_preferences_dialog(display& disp)
turn_bell_button.set_dirty();
side_colours_button.set_dirty();
colour_cursors_button.set_dirty();
haloes_button.set_dirty();
hotkeys_button.set_dirty();
sound_slider.set_dirty();
scroll_slider.set_dirty();
@ -681,6 +695,10 @@ void show_preferences_dialog(display& disp)
set_colour_cursors(colour_cursors_button.checked());
}
if(haloes_button.process(mousex,mousey,left_button)) {
set_show_haloes(haloes_button.checked());
}
events::pump();
events::raise_process_event();
events::raise_draw_event();

View file

@ -97,6 +97,9 @@ namespace preferences {
bool show_tip_of_day();
void set_show_tip_of_day(bool value);
bool show_haloes();
void set_show_haloes(bool value);
std::string client_type();
void set_theme(const std::string& theme);

View file

@ -13,6 +13,8 @@
#include "util.hpp"
#include "video.hpp"
#include "SDL_ttf.h"
namespace {
void fade_logo(display& screen, int xpos, int ypos)
@ -69,6 +71,26 @@ void fade_logo(display& screen, int xpos, int ypos)
faded_in = true;
}
const std::string& get_tip_of_day()
{
static const std::string empty_string;
if(preferences::show_tip_of_day() == false) {
return empty_string;
}
int ntips = 0;
while(ntips < 1000 && string_table["tip_of_day" + str_cast(ntips+1)] != "") {
++ntips;
}
if(ntips == 0) {
return empty_string;
}
const int tip = (rand()%ntips) + 1;
return string_table["tip_of_day" + str_cast(tip)];
}
}
namespace gui {
@ -135,6 +157,27 @@ TITLE_RESULT show_title(display& screen)
std::string style = "mainmenu";
draw_dialog_frame(menu_xbase-padding,menu_ybase-padding,max_width+padding*2,menu_yincr*(nbuttons-1)+buttons.back().height()+padding*2,screen,&style);
std::string tip_of_day = get_tip_of_day();
if(tip_of_day.empty() == false) {
tip_of_day = font::word_wrap_text(tip_of_day,14,(game_config::title_tip_width*screen.x())/1024);
const std::string& tome = font::word_wrap_text(string_table["tome"],14,(game_config::title_tip_width*screen.x())/1024);
SDL_Rect area = font::text_area(tip_of_day,14);
SDL_Rect tome_area = font::text_area(tome,14,TTF_STYLE_ITALIC);
area.w = maximum<size_t>(area.w,tome_area.w);
area.h += tome_area.h;
area.x = game_config::title_tip_x;
area.y = (game_config::title_tip_y*screen.y())/768;
const int pad = game_config::title_tip_padding;
draw_dialog_frame(area.x-pad,area.y-pad,area.w+pad*2,area.h+pad*2,screen,&style);
font::draw_text(&screen,area,14,font::NORMAL_COLOUR,tip_of_day,area.x,area.y);
font::draw_text(&screen,area,14,font::NORMAL_COLOUR,tome,area.x+area.w-tome_area.w,area.y+area.h-tome_area.h,NULL,false,font::NO_MARKUP,TTF_STYLE_ITALIC);
}
events::raise_draw_event();
std::cerr << "drew buttons dialog\n";