wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth data/game.cfg data/campaigns/Eastern_In...


From: Cedric Duval
Subject: [Wesnoth-cvs-commits] wesnoth data/game.cfg data/campaigns/Eastern_In...
Date: Tue, 21 Sep 2004 20:12:24 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Cedric Duval <address@hidden>   04/09/22 00:05:33

Modified files:
        data           : game.cfg 
        data/campaigns : Eastern_Invasion.cfg Heir_To_The_Throne.cfg 
                         Son_Of_The_Black_Eye.cfg 
        src            : dialogs.cpp dialogs.hpp game.cpp 
                         game_config.cpp game_config.hpp 

Log message:
        Campaigns description support.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/game.cfg.diff?tr1=1.116&tr2=1.117&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/campaigns/Eastern_Invasion.cfg.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/campaigns/Heir_To_The_Throne.cfg.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/campaigns/Son_Of_The_Black_Eye.cfg.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.hpp.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.138&tr2=1.139&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.cpp.diff?tr1=1.89&tr2=1.90&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.hpp.diff?tr1=1.24&tr2=1.25&r1=text&r2=text

Patches:
Index: wesnoth/data/campaigns/Eastern_Invasion.cfg
diff -u wesnoth/data/campaigns/Eastern_Invasion.cfg:1.4 
wesnoth/data/campaigns/Eastern_Invasion.cfg:1.5
--- wesnoth/data/campaigns/Eastern_Invasion.cfg:1.4     Sun Sep 12 16:47:18 2004
+++ wesnoth/data/campaigns/Eastern_Invasion.cfg Wed Sep 22 00:05:33 2004
@@ -8,6 +8,7 @@
        difficulties=EASY,NORMAL,HARD
        difficulty_descriptions= _ 
"&human-spearman.png,Spearman,(easiest);*&human-swordman.png,Swordsman;&human-royalguard.png,Royal
 Guard,(hardest)"
        icon=human-general.png
+       image=portraits/Eastern_Invasion/dacyn.png
 [/campaign]
 
 #ifdef CAMPAIGN_EASTERN_INVASION
Index: wesnoth/data/campaigns/Heir_To_The_Throne.cfg
diff -u wesnoth/data/campaigns/Heir_To_The_Throne.cfg:1.3 
wesnoth/data/campaigns/Heir_To_The_Throne.cfg:1.4
--- wesnoth/data/campaigns/Heir_To_The_Throne.cfg:1.3   Sun Sep 12 14:44:21 2004
+++ wesnoth/data/campaigns/Heir_To_The_Throne.cfg       Wed Sep 22 00:05:33 2004
@@ -8,6 +8,8 @@
        first_scenario=The_Elves_Besieged
        difficulties=EASY,NORMAL,HARD
        difficulty_descriptions= _ 
"&elvish-fighter.png,Fighter,(easiest);*&elvish-hero.png,Hero;&elvish-champion.png,Champion,(hardest)"
+       description= _ "Fight to gain back the throne of Wesnoth, of which you 
are the legitimate heir."
+       image=portraits/Heir_To_The_Throne/konrad.png
 [/campaign]
 
 #ifdef CAMPAIGN_HEIR_TO_THE_THRONE
Index: wesnoth/data/campaigns/Son_Of_The_Black_Eye.cfg
diff -u wesnoth/data/campaigns/Son_Of_The_Black_Eye.cfg:1.3 
wesnoth/data/campaigns/Son_Of_The_Black_Eye.cfg:1.4
--- wesnoth/data/campaigns/Son_Of_The_Black_Eye.cfg:1.3 Sun Sep 12 14:44:21 2004
+++ wesnoth/data/campaigns/Son_Of_The_Black_Eye.cfg     Wed Sep 22 00:05:33 2004
@@ -8,6 +8,7 @@
        difficulties=EASY,NORMAL,HARD
        difficulty_descriptions= _ 
"&orcish-grunt.png,Grunt,(easiest);*&orcish-warrior.png,Warrior;&orcish-warlord.png,Warlord,(hardest)"
        icon=orcish-ruler.png
+       image=items/orcish-flag.png
 [/campaign]
 
 #ifdef CAMPAIGN_SON_OF_THE_BLACK_EYE
Index: wesnoth/data/game.cfg
diff -u wesnoth/data/game.cfg:1.116 wesnoth/data/game.cfg:1.117
--- wesnoth/data/game.cfg:1.116 Fri Sep 17 17:19:22 2004
+++ wesnoth/data/game.cfg       Wed Sep 22 00:05:33 2004
@@ -79,6 +79,8 @@
        terrain_mask_image=terrain/alphamask.png
 
        observer_image=misc/eye.png
+
+       download_campaign_image=""
        
 [/game_config]
 
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.55 wesnoth/src/dialogs.cpp:1.56
--- wesnoth/src/dialogs.cpp:1.55        Sun Sep 19 15:36:24 2004
+++ wesnoth/src/dialogs.cpp     Wed Sep 22 00:05:33 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.55 2004/09/19 15:36:24 ettin Exp $ */
+/* $Id: dialogs.cpp,v 1.56 2004/09/22 00:05:33 cedricd Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -738,4 +738,83 @@
        help::show_help(disp,"unit_" + u.type().id());
 }
 
+
+namespace {
+       static const SDL_Rect campaign_preview_size = {-350,-400,350,400};
+       static const int campaign_preview_border = 10;
+}
+
+campaign_preview_pane::campaign_preview_pane(display& 
disp,std::vector<std::pair<std::string,std::string> >* desc) : 
gui::preview_pane(disp),descriptions_(desc),index_(0)
+{
+       set_location(campaign_preview_size);
+}
+
+bool campaign_preview_pane::show_above() const { return false; }
+bool campaign_preview_pane::left_side() const { return false; }
+
+void campaign_preview_pane::set_selection(int index)
+{
+       index = minimum<int>(descriptions_->size()-1,index);
+       if(index != index_ && index >= 0) {
+               index_ = index;
+               set_dirty();
+       }
+}
+
+void campaign_preview_pane::draw()
+{
+       if(!dirty()) {
+               return;
+       }
+
+       bg_restore();
+
+       if(index_ < 0 || index_ >= descriptions_->size()) {
+               return;
+       }
+
+       set_dirty(false);
+
+       const SDL_Rect area = {
+               location().x+campaign_preview_border,
+               location().y+campaign_preview_border*5,
+               location().w-campaign_preview_border*2,
+               location().h-campaign_preview_border*6 };
+
+       /* background frame */
+       static const std::string default_style("mainmenu");
+       const std::string* style = &default_style;
+       gui::draw_dialog_frame(area.x,area.y,area.w,area.h,disp(),style);
+
+       /* description text */
+       const std::string& desc_text = 
font::word_wrap_text((*descriptions_)[index_].first,12,area.w-2*campaign_preview_border);
+       const std::vector<std::string> lines = config::split(desc_text,'\n');
+       SDL_Rect txt_area = { area.x+campaign_preview_border,area.y,0,0 };
+
+       for(std::vector<std::string>::const_iterator line = lines.begin(); line 
!= lines.end(); ++line) {
+               txt_area = 
font::draw_text(&disp(),location(),12,font::NORMAL_COLOUR,*line,txt_area.x,txt_area.y);
+               txt_area.y += txt_area.h;
+       }
+
+       /* description image */
+       surface img(NULL);
+       const std::string desc_img_name = (*descriptions_)[index_].second;
+       if(!desc_img_name.empty()) {
+               img.assign(image::get_image(desc_img_name,image::UNSCALED));
+       }
+       if (!img.null()) {
+               SDL_Rect src_rect,dst_rect;
+               int max_height = area.h-(txt_area.h+txt_area.y-area.y);
+
+               src_rect.x = src_rect.y = 0;
+               src_rect.w = minimum((int)area.w,img->w);
+               src_rect.h = minimum(max_height,img->h);
+               dst_rect.x = area.x+(area.w-src_rect.w)/2;
+               dst_rect.y = txt_area.y+(max_height-src_rect.h)/2;
+
+               
SDL_BlitSurface(img,&src_rect,disp().video().getSurface(),&dst_rect);
+
+       }
+}
+
 } //end namespace dialogs
Index: wesnoth/src/dialogs.hpp
diff -u wesnoth/src/dialogs.hpp:1.23 wesnoth/src/dialogs.hpp:1.24
--- wesnoth/src/dialogs.hpp:1.23        Wed Aug 18 02:51:23 2004
+++ wesnoth/src/dialogs.hpp     Wed Sep 22 00:05:33 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.hpp,v 1.23 2004/08/18 02:51:23 Sirp Exp $ */
+/* $Id: dialogs.hpp,v 1.24 2004/09/22 00:05:33 cedricd Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -88,6 +88,23 @@
 
 void show_unit_description(display& disp, const gamemap& map, const unit& u);
 
-}
+
+class campaign_preview_pane : public gui::preview_pane
+{
+public:
+       campaign_preview_pane(display& 
disp,std::vector<std::pair<std::string,std::string> >* descriptions);
+
+       bool show_above() const;
+       bool left_side() const;
+       void set_selection(int index);
+
+private:
+       void draw();
+
+       const std::vector<std::pair<std::string,std::string> >* descriptions_;
+       int index_;
+};
+
+} //end namespace dialogs
 
 #endif
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.138 wesnoth/src/game.cpp:1.139
--- wesnoth/src/game.cpp:1.138  Tue Sep 21 20:35:48 2004
+++ wesnoth/src/game.cpp        Wed Sep 22 00:05:33 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.138 2004/09/21 20:35:48 gruikya Exp $ */
+/* $Id: game.cpp,v 1.139 2004/09/22 00:05:33 cedricd Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -892,10 +892,13 @@
        std::sort(campaigns.begin(),campaigns.end(),less_campaigns_rank);
 
        std::vector<std::string> campaign_names;
+       std::vector<std::pair<std::string,std::string> > campaign_desc;
 
        for(config::child_list::const_iterator i = campaigns.begin(); i != 
campaigns.end(); ++i) {
                std::stringstream str;
                const std::string& icon = (**i)["icon"];
+               const std::string desc = (**i)["description"];
+               const std::string image = (**i)["image"];
                if(icon == "") {
                        str << " ,";
                } else {
@@ -905,16 +908,22 @@
                str << (**i)["name"];
 
                campaign_names.push_back(str.str());
+               
campaign_desc.push_back(std::pair<std::string,std::string>(desc,image));
        }
 
        campaign_names.push_back(_(" ,Get More Campaigns..."));
+       campaign_desc.push_back(std::pair<std::string,std::string>(_("Download 
more campaigns from a server on 
Internet."),game_config::download_campaign_image));
 
        int res = 0;
 
+       dialogs::campaign_preview_pane campaign_preview(disp(),&campaign_desc);
+       std::vector<gui::preview_pane*> preview_panes;
+       preview_panes.push_back(&campaign_preview);
+
        if(campaign_names.size() > 1) {
                res = gui::show_dialog(disp(),NULL,_("Campaign"),
-                                                _("Choose the campaign you 
want to play:"),
-                                                                               
 gui::OK_CANCEL,&campaign_names);
+                               _("Choose the campaign you want to play:"),
+                               gui::OK_CANCEL,&campaign_names,&preview_panes);
 
                if(res == -1) {
                        return false;
Index: wesnoth/src/game_config.cpp
diff -u wesnoth/src/game_config.cpp:1.89 wesnoth/src/game_config.cpp:1.90
--- wesnoth/src/game_config.cpp:1.89    Sun Aug 22 20:10:12 2004
+++ wesnoth/src/game_config.cpp Wed Sep 22 00:05:33 2004
@@ -1,4 +1,4 @@
-/* $Id: game_config.cpp,v 1.89 2004/08/22 20:10:12 ydirson Exp $ */
+/* $Id: game_config.cpp,v 1.90 2004/09/22 00:05:33 cedricd Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -59,6 +59,8 @@
        std::string unchecked_menu_image = "buttons/checkbox.png";
        std::string checked_menu_image = "buttons/checkbox-pressed.png";
 
+       std::string download_campaign_image;
+
        namespace sounds {
                const std::string turn_bell = "bell.wav",
                                  receive_message = "receive.wav",
@@ -131,5 +133,7 @@
                terrain_mask_image = v["terrain_mask_image"];
                
                observer_image = v["observer_image"];
+
+               download_campaign_image = v["download_campaign_image"];
        }
 }
Index: wesnoth/src/game_config.hpp
diff -u wesnoth/src/game_config.hpp:1.24 wesnoth/src/game_config.hpp:1.25
--- wesnoth/src/game_config.hpp:1.24    Sun Jul 25 21:26:28 2004
+++ wesnoth/src/game_config.hpp Wed Sep 22 00:05:33 2004
@@ -1,4 +1,4 @@
-/* $Id: game_config.hpp,v 1.24 2004/07/25 21:26:28 gruikya Exp $ */
+/* $Id: game_config.hpp,v 1.25 2004/09/22 00:05:33 cedricd Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -41,7 +41,7 @@
                                           
enemy_energy_image,ally_energy_image,flag_image,
                                           dot_image,cross_image,
                                           
foot_left_nw,foot_left_n,foot_right_nw,foot_right_n,
-                                          
missile_n_image,missile_ne_image,terrain_mask_image,observer_image,
+                                          
missile_n_image,missile_ne_image,terrain_mask_image,observer_image,download_campaign_image,
                                           
checked_menu_image,unchecked_menu_image;
 
        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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]