Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

game.cc

Go to the documentation of this file.
00001 // Copyright 2004, 2005 Maurizio Colucci.
00002 //
00003 // This file is part of FACK. 
00004 // 
00005 // FACK is free software; you can redistribute it and/or modify it
00006 // under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // FACK is distributed in the hope that it will be useful, but WITHOUT
00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00012 // or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
00013 // License for more details. 
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Foobar; if not, write to the Free Software Foundation,
00017 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00018 
00019 
00020 
00021 
00022 
00023 
00024 // This file is an example of a game written with FACK.
00025 
00026 #include "fack.hpp"
00027 
00028 class my_game : public FACK
00029 {
00030     public:
00031         my_game(int argc, char ** argv);
00032 
00033     protected:
00034         
00035         void
00036         execute_action_verb_object(
00037             const pt<verb> v, 
00038             const pt<obj_or_concept>,
00039             const pt<obj_or_concept>);
00040         
00041         void
00042         execute_action_double_none_of_the_above(
00043             const pt<phys_obj> o1, 
00044             const pt<phys_obj> o2);
00045         
00046         void
00047         execute_action_object_object(
00048             const pt<obj_or_concept> o1, 
00049             const pt<obj_or_concept> o2);
00050 
00051         void
00052         save(
00053             ofstream& file) const;
00054 
00055         void
00056         load(
00057             ifstream& file);
00058 
00059 
00060         void 
00061         active_player_changed(
00062             pt<PC> new_active_player);
00063 
00064 
00065         
00066 
00067     private:
00068         pt<phys_obj> book,  pencil, 
00069             left_armchair, right_armchair, glass,  table, lamp, moose_head, blue_guyb_item, red_guybr_item,
00070             shed_door, exit_lounge, shed_entrance, 
00071 
00072             fire, fire_tools, fireplace, pile_of_wood, right_painting, 
00073             left_painting, carpet, floor, lamp_cord, shed_handle, treasure, spot_in_ground,
00074             dagger, sheet, lighter,
00075 
00076             cork, label, whole_bottle, cabinet, cab_drawer, torch_unlit, torch_lit;
00077 
00078 
00079         pt<concept> treasure_heard;
00080 
00081         pt<verb> pick_up, push, hit_hand, rotate, talk, 
00082             eat, breathe, walk, hit_foot,
00083             enter, sit,climb, jump, kiss, read_aloud, 
00084             person_give, look;
00085 
00086         // verbs that do not work
00087         pt<verb> open, turn_on, throw_at, give_to_someone;
00088 
00089         pt<container > table_drawer;
00090 
00091         pt<light_fixed_in_loc> fire_light, lamp_light, shed_sun_light, shed_moon_light;
00092         pt<light_across_loc> torch_l;
00093 
00094         pt<PC> blue_guybr, red_guybr;
00095 
00096         pt<location> lounge, shed;
00097 
00098         pt<layer_unlit_before_anim> bottle_layer, bott_shad_layer, glass_layer, glass_shad_layer, shed_open_door_layer;
00099         
00100         pt<bg_hot_zone> bottle_zone, glass_zone, shed_entrance_zone, shed_closed_door_zone, shed_open_door_zone,
00101             shed_handle_zone, treasure_zone;
00102 
00103 
00104         pt<mood_t> mood_normal, mood_puzzled_scratch_head;
00105 
00106 
00107         pt<animation>  guy_blue_pick_up_right_normal, guy_red_pick_up_right_normal;
00108 
00109         int_pair point_for_sitting_on_left_armch;
00110         int_pair point_for_sitting_on_right_armch;
00111 
00112         pt<zoomable> bottle;
00113 
00114 
00115 
00116         // BEGIN game variables
00117         bool first_time_you_turn_on_lamp;
00118         // END
00119 
00120 
00121 };
00122 
00123 
00124 void
00125 my_game::active_player_changed(pt<PC> new_act_pl)
00126 {
00127     quick_msg = NEW(quick_message("Controlling " + new_act_pl->obj->readable_name + "."));
00128 }
00129 
00130 
00131 my_game::my_game(int argc, char ** argv) : FACK(argc, argv)
00132 {
00133     // BEGIN decl
00134     SDL_Rect backpack_sensitive_area;
00135     SDL_Surface* backpack_picture;
00136     pt<container> blue_guybr_inv, red_guybr_inv;
00137     pt<container> blue_guybr_cache, red_guybr_cache;
00138     pt<container> blue_guybr_discourse_topics, red_guybr_discourse_topics;
00139     SDL_Rect rect_of_table_drawer;
00140     anim_of_mood_t anim_of_mood_red_guybr, anim_of_mood_blue_guybr;
00141     int i;
00142     pt<cfsurf> glass_cfsurf, moose_cfsurf, bottle_cfsurf, table_cfsurf;
00143     map<walk_frame_id, pt<anim_frame> >  guy_walk_frame_when;
00144     map<walk_frame_id, pt<anim_frame> >  guy_red_walk_frame_when;
00145     seq_list<pt<bg_hot_zone> > lounge_sorted_hot_zones;
00146     seq_list<pt<layer_unlit_before_anim> >  lounge_unl_lay;
00147     room_scaling_data lounge_scaling_data;    
00148     seq_list<pt<bg_hot_zone> > shed_sorted_hot_zones;
00149     seq_list<pt<layer_unlit_before_anim> >  shed_unl_lay;
00150     room_scaling_data shed_scal_dat;    
00151     list<surf_with_name> first_fire_frame, second_fire_frame;
00152     pt<anim_frame> blue_scratch_right_frame_1, blue_scratch_right_frame_2;
00153     pt<anim_frame> red_scratch_right_frame_1, red_scratch_right_frame_2;
00154 
00155     pt<anim_frame> blue_scratch_left_frame_1, blue_scratch_left_frame_2;
00156     pt<anim_frame> red_scratch_left_frame_1, red_scratch_left_frame_2;
00157   
00158     pt<animation>  guy_blue_scratch_right, guy_red_scratch_right, 
00159         normal_sp_gest_blue_right, normal_sp_gest_red_right;
00160 
00161     pt<animation>  guy_blue_scratch_left, guy_red_scratch_left, 
00162         normal_sp_gest_blue_left, normal_sp_gest_red_left;
00163     map<direction, pt<animation> > guy_red_norm_still_anim, guy_blue_norm_still_anim;
00164     map<string, pt<animation> > guy_red_sitting_still_anim, guy_blue_sitting_still_anim;
00165     SDL_Surface* drawer_standard_bg;
00166     pt<cfsurf> cabinet_lit_fire_surf;
00167     rgb color_of_verb_that_works(210,210,210);
00168     rgb color_of_verb_that_does_not_work(80,50,50);
00169     // END
00170 
00171     // In the constructor, we have to initialize some protected member
00172     // variables.
00173 
00174     this->point_for_sitting_on_right_armch = int_pair(195, 176);
00175     this->point_for_sitting_on_left_armch = int_pair(78, 176);
00176 
00177     this->mood_puzzled_scratch_head = NEW(mood_t());
00178     this->mood_normal = NEW(mood_t());
00179 
00180     this->first_time_you_turn_on_lamp = true;
00181 
00182     // hand:
00183 
00184     this->pick_up  = NEW(verb(
00185                              seq_list<pt<token_of_verb_text> >() <<
00186                              NEW(TOVT_string("Pick up ")) << 
00187                              NEW(TOVT_name_of_second_obj()) << 
00188                              NEW(TOVT_string(" with ")) <<
00189                              NEW(TOVT_name_of_first_obj()),
00190                              color_of_verb_that_works));
00191 
00192     this->push  = NEW(verb(
00193                              seq_list<pt<token_of_verb_text> >() <<
00194                              NEW(TOVT_string("Push/pull ")) << 
00195                              NEW(TOVT_name_of_second_obj()) << 
00196                              NEW(TOVT_string(" with ")) <<
00197                              NEW(TOVT_name_of_first_obj()),
00198                              color_of_verb_that_works));
00199 
00200     this->hit_hand  = NEW(verb(
00201                              seq_list<pt<token_of_verb_text> >() <<
00202                              NEW(TOVT_string("Hit/break ")) << 
00203                              NEW(TOVT_name_of_second_obj()) << 
00204                              NEW(TOVT_string(" with ")) <<
00205                              NEW(TOVT_name_of_first_obj()),
00206                              color_of_verb_that_works));
00207 
00208 
00209     this->rotate  = NEW(verb(
00210                              seq_list<pt<token_of_verb_text> >() <<
00211                              NEW(TOVT_string("Rotate ")) << 
00212                              NEW(TOVT_name_of_second_obj()) << 
00213                              NEW(TOVT_string(" with ")) <<
00214                              NEW(TOVT_name_of_first_obj()),
00215                              color_of_verb_that_works));
00216 
00217     this->open  = NEW(verb(
00218                              seq_list<pt<token_of_verb_text> >() <<
00219                              NEW(TOVT_string("Open/close ")) << 
00220                              NEW(TOVT_name_of_second_obj()) << 
00221                              NEW(TOVT_string(" with ")) <<
00222                              NEW(TOVT_name_of_first_obj()),
00223                              color_of_verb_that_does_not_work));
00224 
00225     this->turn_on = NEW(verb(
00226                              seq_list<pt<token_of_verb_text> >() <<
00227                              NEW(TOVT_string("Turn ")) << 
00228                              NEW(TOVT_name_of_second_obj()) << 
00229                              NEW(TOVT_string(" on/off with ")) <<
00230                              NEW(TOVT_name_of_first_obj()),
00231                              color_of_verb_that_does_not_work));
00232 
00233     this->throw_at = NEW(verb(
00234                              seq_list<pt<token_of_verb_text> >() <<
00235                              NEW(TOVT_string("Throw ")) << 
00236                              NEW(TOVT_name_of_second_obj()) << 
00237                              NEW(TOVT_string(" at something")),
00238                              color_of_verb_that_does_not_work));
00239 
00240     this->give_to_someone = NEW(verb(
00241                                     seq_list<pt<token_of_verb_text> >() <<
00242                                     NEW(TOVT_string("Give ")) << 
00243                                     NEW(TOVT_name_of_second_obj()) << 
00244                                     NEW(TOVT_string(" to someone")),
00245                                     color_of_verb_that_does_not_work));
00246 
00247 
00248     // mouth:
00249 
00250     this->talk = NEW(verb(
00251                              seq_list<pt<token_of_verb_text> >() <<
00252                              NEW(TOVT_string("Talk to ")) << 
00253                              NEW(TOVT_name_of_second_obj()),
00254                              color_of_verb_that_does_not_work));
00255 
00256     this->eat = NEW(verb(
00257                              seq_list<pt<token_of_verb_text> >() <<
00258                              NEW(TOVT_string("Eat/drink ")) << 
00259                              NEW(TOVT_name_of_second_obj()),
00260                              color_of_verb_that_works));
00261 
00262     this->breathe = NEW(verb(
00263                              seq_list<pt<token_of_verb_text> >() <<
00264                              NEW(TOVT_string("Breathe in ")) << 
00265                              NEW(TOVT_name_of_second_obj()),
00266                              color_of_verb_that_works));
00267 
00268     this->kiss = NEW(verb(
00269                              seq_list<pt<token_of_verb_text> >() <<
00270                              NEW(TOVT_string("Kiss ")) << 
00271                              NEW(TOVT_name_of_second_obj()),
00272                              color_of_verb_that_works));
00273 
00274 
00275     this->read_aloud = NEW(verb(
00276                              seq_list<pt<token_of_verb_text> >() <<
00277                              NEW(TOVT_string("Read ")) << 
00278                              NEW(TOVT_name_of_second_obj()) <<
00279                              NEW(TOVT_string(" aloud")),
00280                              color_of_verb_that_works));
00281 
00282 
00283 
00284 
00285     // foot:
00286 
00287     this->walk = NEW(verb(
00288                              seq_list<pt<token_of_verb_text> >() <<
00289                              NEW(TOVT_string("Walk to ")) << 
00290                              NEW(TOVT_name_of_second_obj()),
00291                              color_of_verb_that_works));
00292 
00293     this->hit_foot = NEW(verb(
00294                              seq_list<pt<token_of_verb_text> >() <<
00295                              NEW(TOVT_string("Hit/break ")) << 
00296                              NEW(TOVT_name_of_second_obj())<<
00297                              NEW(TOVT_string(" with ")) <<
00298                              NEW(TOVT_name_of_first_obj()),
00299                              color_of_verb_that_works));
00300 
00301 
00302 
00303 
00304     // body:
00305 
00306     this->enter = NEW(verb(
00307                              seq_list<pt<token_of_verb_text> >() <<
00308                              NEW(TOVT_string("Enter ")) << 
00309                              NEW(TOVT_name_of_second_obj()),
00310                              color_of_verb_that_works));
00311 
00312     this->sit = NEW(verb(
00313                              seq_list<pt<token_of_verb_text> >() <<
00314                              NEW(TOVT_string("Sit/lie on ")) << 
00315                              NEW(TOVT_name_of_second_obj()),
00316                              color_of_verb_that_works));
00317 
00318     // eye:
00319 
00320     this->look = NEW(verb(
00321                          seq_list<pt<token_of_verb_text> >() <<
00322                          NEW(TOVT_string("Look at ")) << 
00323                          NEW(TOVT_name_of_second_obj()),
00324                          color_of_verb_that_works));
00325 
00326 
00327 
00328     // common:
00329 
00330     this->climb = NEW(verb(
00331                              seq_list<pt<token_of_verb_text> >() <<
00332                              NEW(TOVT_string("Climb ")) << 
00333                              NEW(TOVT_name_of_second_obj()),
00334                              color_of_verb_that_works));
00335 
00336     this->jump = NEW(verb(
00337                              seq_list<pt<token_of_verb_text> >() <<
00338                              NEW(TOVT_string("Jump on/to ")) << 
00339                              NEW(TOVT_name_of_second_obj()),
00340                              color_of_verb_that_works));
00341 
00342 
00343 
00344     // persons:
00345 
00346     this->person_give = NEW(verb(
00347                                 seq_list<pt<token_of_verb_text> >() <<
00348                                 NEW(TOVT_string("Give/show ")) << 
00349                                 NEW(TOVT_name_of_second_obj())<<
00350                                 NEW(TOVT_string(" to ")) << 
00351                                 NEW(TOVT_name_of_first_obj()),
00352                                 color_of_verb_that_works));
00353 
00354 
00355 
00356 //     speech_gestures = *set_of( seq_list<string>() <<no_anim << 
00357 //      "SG_HANDS_OPEN_NARROW_SHOULDERS__I_DON_T_UNDERSTAND" <<
00358 //      "SG_AGITATE_FIST___ANGRY_MENACING" <<
00359 //      "SG_SCRATCH_HEAD__PUZZLED" <<
00360 //      "SG_ARMS_CROSSED__UPSET_OR_WAITING" <<
00361 //      "SG_WIDE_ARMS_AND_OPEN_HANDS__IMPORTANT_CONCEPT" <<
00362 //      "SG_HANDS_ON_HIPS__IMPATIENT_OR_UPSET" <<
00363 //      "SG_HAND_ON_CHIN__ABSORBED_IN_THOUGHT" <<
00364 //      "SG_ONE_HAND_IN_POCKET_OTHER_OPEN__NONCHALANT_EMPHASIS" <<
00365 //      "SG_WAVE_HANDS_OPEN_NEAR_EARS__WOODY_ALLEN_UPSET_EMPHASYS");
00366 
00367 
00368     table_cfsurf = cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/table.png"));
00369  
00370     glass_cfsurf = cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/glass.png"));
00371 
00372     bottle_cfsurf = cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/bottle.png"));
00373 
00374     moose_cfsurf = cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/moose head.png"));
00375  
00376         
00377 
00378 
00379 
00380     this->fire_light = NEW(light_fixed_in_loc( 40.0f, 0.015f /* speed*/, 0.05f /*amplitude*/, 
00381                                                NEW(player_illumination_constant(0.7f))));
00382     this->lamp_light = NEW(light_fixed_in_loc( 20.0f, 0.0012f /* speed*/, 0.14f /*amplitude*/, 
00383                                                NEW(player_illumination_constant(0.9f))));
00384 
00385     this->shed_sun_light = NEW(light_fixed_in_loc( 
00386                                    16.0f /* intensity. Tuned so as to
00387                                           * make other lights, such as
00388                                           * the torch and the
00389                                           * moonlight, irrelevant */,
00390                                    0.0012f /* speed*/, 
00391                                    0.14f /*amplitude*/, 
00392                                    NEW(player_illumination_constant(0.9f))));
00393     this->shed_moon_light = NEW(light_fixed_in_loc(
00394                                     1.0f /* intensity, relative to other lights in same loc */,
00395                                     0.0011f /* speed*/, 0.38f /*amplitude*/, 
00396                                     NEW(player_illumination_constant(0.1f))));
00397     this->torch_lit = NEW(phys_obj( 
00398                           "lit torch",
00399                           NEW( can_appear_closed_in_inv_yes(IMG_Load("data/torch-lit.png"),
00400                                                             true /* can be moved across containers */)  ) ));
00401     this->torch_unlit = NEW(phys_obj( 
00402                           "torch",
00403                           NEW( can_appear_closed_in_inv_yes(IMG_Load("data/torch.png"),
00404                                                             true /* can be moved across containers */)  ) ));
00405 
00406 
00407     this->torch_l = NEW(light_across_loc( 0.7f /* intensity relative to other lights */, 
00408                                           0.015f /* speed*/, 0.05f /*amplitude*/, 
00409                                           NEW(player_illumination_constant(1.0f)),
00410                                           torch_lit,
00411                                           80 /* radius */));
00412 
00413 
00414 
00415 
00416     lounge_scaling_data.y1 = 5.0f;
00417     lounge_scaling_data.scaling_at_y1 = 0.6f;
00418     lounge_scaling_data.y2 = 200.0f;
00419     lounge_scaling_data.scaling_at_y2 = 1.1f;
00420 
00421 
00422 
00423 
00424     const float k_speed = 0.012f;
00425 
00426 
00427     guy_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_right)] = 
00428         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/right/g6.png"), int_pair(5,45), 
00429             10.0f * k_speed);
00430     guy_walk_frame_when[walk_frame_id(hd_right, PASSING, d_right)] = 
00431         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/right/g5.png"), int_pair(8, 46),
00432             10.0f * k_speed);
00433     guy_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_right)] = 
00434         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/right/g4.png"), int_pair(5, 46),
00435             10.0f * k_speed);
00436 
00437     guy_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_right)] = 
00438         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/right/g3.png"), int_pair(6,44),
00439             10.0f * k_speed);
00440     guy_walk_frame_when[walk_frame_id(hd_left, PASSING, d_right)] = 
00441         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/right/g2.png"), int_pair(6,46),
00442             10.0f * k_speed);
00443     guy_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_right)] =
00444         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/right/g1.png"), int_pair(8, 45),
00445             10.0f * k_speed);
00446 
00447     guy_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_left)] = 
00448         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/left/g6.png"), int_pair(26,45), 
00449             10.0f * k_speed);
00450     guy_walk_frame_when[walk_frame_id(hd_left, PASSING, d_left)] = 
00451         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/left/g5.png"), int_pair(12, 46),
00452             10.0f * k_speed);
00453     guy_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_left)] = 
00454         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/left/g4.png"), int_pair(13, 46),
00455             10.0f * k_speed);
00456 
00457     guy_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_left)] = 
00458         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/left/g3.png"), int_pair(26,44),
00459             10.0f * k_speed);
00460     guy_walk_frame_when[walk_frame_id(hd_right, PASSING, d_left)] = 
00461         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/left/g2.png"), int_pair(13,46),
00462             10.0f * k_speed);
00463     guy_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_left)] =
00464         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/left/g1.png"), int_pair(12, 45),
00465             10.0f * k_speed);
00466 
00467     guy_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_up)] = 
00468         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/up/up-4.png"), int_pair(5,45), 
00469             9.6f * k_speed);
00470     guy_walk_frame_when[walk_frame_id(hd_right, PASSING, d_up)] = 
00471         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/up/up-3.png"), int_pair(12, 46),
00472             9.6f * k_speed);
00473     guy_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_up)] = 
00474         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/up/up-2.png"), int_pair(13, 46),
00475             9.6f * k_speed);
00476 
00477     guy_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_up)] = 
00478         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/up/up-1.png"), int_pair(12,45),
00479             9.6f * k_speed);
00480     guy_walk_frame_when[walk_frame_id(hd_left, PASSING, d_up)] = 
00481         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/up/up-6.png"), int_pair(12,46),
00482             9.6f * k_speed);
00483     guy_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_up)] =
00484         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/up/up-5.png"), int_pair(12, 46),
00485             9.6f * k_speed);
00486 
00487     guy_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_down)] = 
00488         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/down/down-4.png"), int_pair(5,45), 
00489             9.6f * k_speed);
00490     guy_walk_frame_when[walk_frame_id(hd_right, PASSING, d_down)] = 
00491         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/down/down-3.png"), int_pair(12, 46),
00492             9.6f * k_speed);
00493     guy_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_down)] = 
00494         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/down/down-2.png"), int_pair(13, 46),
00495             9.6f * k_speed);
00496 
00497     guy_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_down)] = 
00498         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/down/down-1.png"), int_pair(12,45),
00499             9.6f * k_speed);
00500     guy_walk_frame_when[walk_frame_id(hd_left, PASSING, d_down)] = 
00501         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/down/down-6.png"), int_pair(12,46),
00502             9.6f * k_speed);
00503     guy_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_down)] =
00504         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/walk/down/down-5.png"), int_pair(12, 46),
00505             9.6f * k_speed);
00506   
00507 
00508 
00509 
00510 
00511     guy_red_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_right)] = 
00512         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/right/g6.png"), int_pair(5,45), 
00513             10.0f * k_speed);
00514     guy_red_walk_frame_when[walk_frame_id(hd_right, PASSING, d_right)] = 
00515         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/right/g5.png"), int_pair(8, 46),
00516             10.0f * k_speed);
00517     guy_red_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_right)] = 
00518         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/right/g4.png"), int_pair(5, 46),
00519             10.0f * k_speed);
00520 
00521     guy_red_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_right)] = 
00522         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/right/g3.png"), int_pair(6,44),
00523             10.0f * k_speed);
00524     guy_red_walk_frame_when[walk_frame_id(hd_left, PASSING, d_right)] = 
00525         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/right/g2.png"), int_pair(6,46),
00526             10.0f * k_speed);
00527     guy_red_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_right)] =
00528         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/right/g1.png"), int_pair(8, 45),
00529             10.0f * k_speed);
00530 
00531     guy_red_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_left)] = 
00532         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/left/g6.png"), int_pair(26,45), 
00533             10.0f * k_speed);
00534     guy_red_walk_frame_when[walk_frame_id(hd_left, PASSING, d_left)] = 
00535         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/left/g5.png"), int_pair(12, 46),
00536             10.0f * k_speed);
00537     guy_red_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_left)] = 
00538         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/left/g4.png"), int_pair(13, 46),
00539             10.0f * k_speed);
00540 
00541     guy_red_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_left)] = 
00542         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/left/g3.png"), int_pair(26,44),
00543             10.0f * k_speed);
00544     guy_red_walk_frame_when[walk_frame_id(hd_right, PASSING, d_left)] = 
00545         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/left/g2.png"), int_pair(13,46),
00546             10.0f * k_speed);
00547     guy_red_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_left)] =
00548         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/left/g1.png"), int_pair(12, 45),
00549             10.0f * k_speed);
00550 
00551     guy_red_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_up)] = 
00552         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/up/up-4.png"), int_pair(5,45), 
00553             9.6f * k_speed);
00554     guy_red_walk_frame_when[walk_frame_id(hd_right, PASSING, d_up)] = 
00555         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/up/up-3.png"), int_pair(12, 46),
00556             9.6f * k_speed);
00557     guy_red_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_up)] = 
00558         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/up/up-2.png"), int_pair(13, 46),
00559             9.6f * k_speed);
00560 
00561     guy_red_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_up)] = 
00562         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/up/up-1.png"), int_pair(12,45),
00563             9.6f * k_speed);
00564     guy_red_walk_frame_when[walk_frame_id(hd_left, PASSING, d_up)] = 
00565         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/up/up-6.png"), int_pair(12,46),
00566             9.6f * k_speed);
00567     guy_red_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_up)] =
00568         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/up/up-5.png"), int_pair(12, 46),
00569             9.6f * k_speed);
00570 
00571     guy_red_walk_frame_when[walk_frame_id(hd_right, CONTACT, d_down)] = 
00572         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/down/down-4.png"), int_pair(5,45), 
00573             9.6f * k_speed);
00574     guy_red_walk_frame_when[walk_frame_id(hd_right, PASSING, d_down)] = 
00575         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/down/down-3.png"), int_pair(12, 46),
00576             9.6f * k_speed);
00577     guy_red_walk_frame_when[walk_frame_id(hd_right, RECOIL, d_down)] = 
00578         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/down/down-2.png"), int_pair(13, 46),
00579             9.6f * k_speed);
00580 
00581     guy_red_walk_frame_when[walk_frame_id(hd_left, CONTACT, d_down)] = 
00582         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/down/down-1.png"), int_pair(12,45),
00583             9.6f * k_speed);
00584     guy_red_walk_frame_when[walk_frame_id(hd_left, PASSING, d_down)] = 
00585         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/down/down-6.png"), int_pair(12,46),
00586             9.6f * k_speed);
00587     guy_red_walk_frame_when[walk_frame_id(hd_left, RECOIL, d_down)] =
00588         anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/walk/down/down-5.png"), int_pair(12, 46),
00589             9.6f * k_speed);
00590   
00591 
00592 
00593 
00594     // BEGIN decl
00595     SDL_Surface * hand_picture;
00596     // END
00597 
00598     hand_picture = IMG_Load("data/hand.png");
00599 
00600     this->hand = NEW(   phys_obj_with_verbs(
00601                             *vector_of( ulist(pick_up) << push << hit_hand << climb << rotate << 
00602                                         open  << turn_on << throw_at << give_to_someone),
00603                             true,
00604                             "your hand", NEW( can_appear_closed_in_inv_yes(
00605                                                   hand_picture,
00606                                                   false /* cannot be moved across containers */) )));
00607 
00608 
00609     this->body = NEW(phys_obj_with_verbs( 
00610                    *vector_of( ulist(enter) << sit << climb << jump ),
00611                    true,
00612                    "your body",
00613                    NEW( can_appear_closed_in_inv_yes(IMG_Load("data/body.png"),
00614                                                      false /* cannot be moved across containers */)  ) ));
00615     this->eye = NEW(phys_obj_with_verbs( 
00616                    *vector_of( ulist(look) ),
00617                    false /* sic! the eye has no "none_of_the_above" option */,
00618                    "your eyes",
00619                    NEW( can_appear_closed_in_inv_yes(IMG_Load("data/eye.png"),
00620                                                      false /* cannot be moved across containers */)  ) ));
00621 
00622 
00623     this->foot = NEW(phys_obj_with_verbs(
00624                    *vector_of(ulist(walk) << hit_foot << climb << jump ),
00625                    true,
00626                    "your foot",
00627                    NEW( can_appear_closed_in_inv_yes(IMG_Load("data/foot.png"),
00628                                                      false /* cannot be moved across containers */))));
00629 
00630 
00631     this->mouth = NEW( phys_obj_with_verbs(
00632                            *vector_of(ulist(talk) << eat << breathe << kiss << read_aloud ),
00633                            true,
00634                            "your mouth",  
00635                            NEW( can_appear_closed_in_inv_yes(IMG_Load("data/mouth.png"),
00636                                                              false /* cannot be moved across containers */))));
00637 
00638   
00639 
00640     
00641     this->blue_guyb_item = NEW( phys_obj_with_verbs(
00642                                     *vector_of(ulist(person_give) ),
00643                                     true,
00644                                     "Guybrush",  NEW( can_appear_closed_in_inv_no())));
00645 
00646     this->red_guybr_item = NEW( phys_obj_with_verbs(
00647                                     *vector_of(ulist(person_give) ),
00648                                     true,
00649                                     "Red Guybrush",  NEW( can_appear_closed_in_inv_no())));
00650 
00651     this->shed_door = NEW( phys_obj( "door",  NEW( can_appear_closed_in_inv_no())));
00652 
00653     this->shed_entrance = NEW( phys_obj( "entrance",  NEW( can_appear_closed_in_inv_no())));
00654 
00655     this->cork = NEW(phys_obj("cork", NEW(can_appear_closed_in_inv_no())));
00656 
00657     this->label = NEW(phys_obj("label", NEW(can_appear_closed_in_inv_no())));
00658 
00659     this->whole_bottle = NEW(phys_obj("the whole bottle", NEW(can_appear_closed_in_inv_no())));
00660 
00661 
00662 
00663     // BEGIN  decl
00664     seq_list<pt<zoomable_zone> > bottle_zones;
00665     // END
00666 
00667     bottle_zones = (ulist( NEW(zoomable_zone(
00668                                    create_rect(17, 3, 79, 117),
00669                                    true,
00670                                    whole_bottle))) <<
00671                     NEW(zoomable_zone(
00672                             create_rect(32, 0, 83, 24),
00673                             true,
00674                             cork)) <<
00675                     NEW(zoomable_zone(
00676                             create_rect(34, 50 , 65, 99),
00677                             true,
00678                             label)));
00679 
00680     this->bottle = NEW(zoomable(
00681                            bottle_zones,
00682                            "bottle",
00683                            create_rect(0,52,17,80) /* closing rect*/,
00684                            IMG_Load("data/bottle-zoomed.png"),
00685                            int_pair(10, 10),
00686                            NEW(can_appear_closed_in_inv_yes(IMG_Load("data/bottle.png")))));
00687 
00688 
00689 
00690 
00691 
00692 
00693 
00694     // BEGIN define animations
00695     guy_blue_pick_up_right_normal = NEW(
00696         animation(ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/pick-up/right-normal.png"), 
00697                                                      int_pair( 12, 45 ), 1.0f ))));
00698     guy_red_pick_up_right_normal = NEW(
00699         animation(ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/pick-up/right-normal.png"), 
00700                                                      int_pair(12, 45 ), 1.0f ))));
00701 
00702 
00703     // BEGIN right
00704     normal_sp_gest_blue_right = NEW(animation
00705         (ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/still/right/0.png"), 
00706                    int_pair( 12, 46 ), 1.0f ))));
00707 
00708     normal_sp_gest_red_right = NEW(animation
00709         (ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/still/right/0.png"), 
00710                    int_pair( 12, 46 ), 1.0f ))));
00711 
00712 
00713 
00714     blue_scratch_right_frame_1 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/scratch/right/0.png"), 
00715         int_pair(11, 45 ), 0.2f );
00716     blue_scratch_right_frame_2 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/scratch/right/1.png"), 
00717         int_pair( 11, 45 ), 0.2f );
00718 
00719 
00720     guy_blue_scratch_right = NEW(animation( 
00721                                      ( ulist(blue_scratch_right_frame_1) << 
00722                                        blue_scratch_right_frame_2 << blue_scratch_right_frame_1 << blue_scratch_right_frame_2 <<
00723                                        blue_scratch_right_frame_1 << blue_scratch_right_frame_2 << blue_scratch_right_frame_1 << 
00724                                        blue_scratch_right_frame_2)));
00725 
00726     
00727     red_scratch_right_frame_1 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/scratch/right/0.png"), 
00728         int_pair(11, 45 ), 0.2f );
00729     red_scratch_right_frame_2 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/scratch/right/1.png"), 
00730          int_pair(11, 45 ), 0.2f );
00731 
00732 
00733     guy_red_scratch_right = NEW(animation( 
00734                                     ( ulist(red_scratch_right_frame_1) << 
00735                                       red_scratch_right_frame_2 << red_scratch_right_frame_1 << red_scratch_right_frame_2 <<
00736                                       red_scratch_right_frame_1 << red_scratch_right_frame_2 << red_scratch_right_frame_1 << 
00737                                       red_scratch_right_frame_2)));
00738 
00739     // END
00740 
00741     // BEGIN left
00742     normal_sp_gest_blue_left = 
00743         NEW(animation(
00744                 ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/still/left/0.png"), 
00745                                                    int_pair(12, 46 ), 1.0f ))));
00746 
00747     normal_sp_gest_red_left = NEW(
00748         animation(ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/still/left/0.png"), 
00749                                                      int_pair(12, 46 ), 1.0f ))));
00750 
00751 
00752 
00753     blue_scratch_left_frame_1 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/scratch/left/0.png"), 
00754         int_pair(11, 45 ), 0.2f );
00755     blue_scratch_left_frame_2 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush/scratch/left/1.png"), 
00756         int_pair( 11, 45 ), 0.2f );
00757 
00758 
00759     guy_blue_scratch_left = 
00760         NEW(animation( 
00761                 ( ulist(blue_scratch_left_frame_1) << 
00762                   blue_scratch_left_frame_2 << blue_scratch_left_frame_1 << blue_scratch_left_frame_2 <<
00763                   blue_scratch_left_frame_1 << blue_scratch_left_frame_2 << blue_scratch_left_frame_1 << 
00764                   blue_scratch_left_frame_2)));
00765 
00766     
00767     red_scratch_left_frame_1 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/scratch/left/0.png"), 
00768         int_pair(11, 45 ) , 0.2f );
00769     red_scratch_left_frame_2 = anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/scratch/left/1.png"), 
00770         int_pair( 11, 45 ), 0.2f );
00771 
00772 
00773     guy_red_scratch_left = 
00774         NEW(animation(
00775                 ( ulist(red_scratch_left_frame_1) << 
00776                   red_scratch_left_frame_2 << red_scratch_left_frame_1 << red_scratch_left_frame_2 <<
00777                   red_scratch_left_frame_1 << red_scratch_left_frame_2 << red_scratch_left_frame_1 << 
00778                   red_scratch_left_frame_2) ));
00779 
00780     // END
00781 
00782     // END
00783 
00784 
00785 
00786     this->ear = NEW( phys_obj("your ear",  
00787                    NEW( can_appear_closed_in_inv_yes(IMG_Load("data/ear.png"),
00788                                               false /* cannot be moved across containers */))));
00789 
00790 
00791     this->book = NEW( phys_obj("book",  
00792                     NEW( can_appear_closed_in_inv_yes(IMG_Load("data/book.png")))));
00793 
00794     this->dagger = NEW( phys_obj("dagger",  
00795                     NEW( can_appear_closed_in_inv_yes(IMG_Load("data/dagger.png")))));
00796 
00797     this->lighter = NEW( phys_obj("lighter",  
00798                     NEW( can_appear_closed_in_inv_yes(IMG_Load("data/lighter.png")))));
00799 
00800     this->sheet = NEW( phys_obj("sheet",  
00801                     NEW( can_appear_closed_in_inv_yes(IMG_Load("data/sheet.png")))));
00802 
00803     this->glass = NEW( phys_obj("glass",
00804                      NEW( can_appear_closed_in_inv_yes(  IMG_Load("data/glass.png")))));
00805 
00806 //     this->bottle = NEW(phys_obj("bottle",  
00807 //                      NEW( can_appear_closed_in_inv_yes(  IMG_Load("data/bottle.png")))));
00808 
00809     this->table = NEW(phys_obj("table",  NEW( can_appear_closed_in_inv_no())));
00810 
00811     this->pencil = NEW( phys_obj("pencil",  
00812                       NEW( can_appear_closed_in_inv_yes(IMG_Load("data/pencil.png")))));
00813 
00814     this->moose_head = NEW(phys_obj("moose head", NEW( can_appear_closed_in_inv_no())));
00815 
00816     this->left_armchair = NEW(phys_obj("armchair", NEW( can_appear_closed_in_inv_no())));
00817 
00818     this->right_armchair = NEW(phys_obj("armchair", NEW( can_appear_closed_in_inv_no())));
00819 
00820     this->exit_lounge = NEW(phys_obj("exit", NEW( can_appear_closed_in_inv_no())));
00821 
00822 
00823     this->lamp = NEW(phys_obj("lamp", NEW( can_appear_closed_in_inv_no())));
00824 
00825     this->cabinet = NEW(phys_obj("cabinet", NEW( can_appear_closed_in_inv_no())));
00826     this->cab_drawer = NEW(phys_obj("drawer", NEW( can_appear_closed_in_inv_no())));
00827 
00828 
00829     this->fire = NEW(phys_obj("fire", NEW( can_appear_closed_in_inv_no())));
00830     this->fireplace = NEW(phys_obj("fireplace", NEW( can_appear_closed_in_inv_no())));
00831     this->fire_tools = NEW(phys_obj("tools", NEW( can_appear_closed_in_inv_no())));
00832     this->pile_of_wood = NEW(phys_obj("wood pile", NEW( can_appear_closed_in_inv_no())));
00833     this->right_painting = NEW(phys_obj("painting", NEW( can_appear_closed_in_inv_no())));
00834     this->left_painting = NEW(phys_obj("painting", NEW( can_appear_closed_in_inv_no())));
00835     this->carpet = NEW(phys_obj("carpet", NEW( can_appear_closed_in_inv_no())));
00836     this->floor = NEW(phys_obj("floor", NEW( can_appear_closed_in_inv_no())));
00837     this->lamp_cord = NEW(phys_obj("small cord", NEW( can_appear_closed_in_inv_no())));
00838     this->shed_handle = NEW(phys_obj("handle", NEW( can_appear_closed_in_inv_no())));
00839 
00840     this->treasure = NEW(phys_obj("treasure", NEW( can_appear_closed_in_inv_yes(IMG_Load("data/treasure.png")))));
00841 
00842     this->spot_in_ground = NEW(phys_obj("earth", NEW( can_appear_closed_in_inv_no())));
00843     
00844     this->treasure_heard = NEW(concept( "topic \"treasure\"", IMG_Load("data/treasure.png")));
00845     this->topic_hello = NEW(concept( "Hello", IMG_Load("data/handshake-scaled.png")));
00846     this->topic_yes = NEW(concept( "Yes", IMG_Load("data/yes.png")));
00847     this->topic_no = NEW(concept( "No", IMG_Load("data/no.png")));
00848 
00849 
00850 
00851     cabinet_lit_fire_surf = cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/cabinet.png"));
00852 
00853 
00854     glass_shad_layer = 
00855         NEW(layer_unlit_not_anim(
00856                 ( ulist( surf_with_name(fire_light, cfsurf::from_sdl_surface(
00857                                             IMG_Load("locations/lounge/lit/fire/glass - shadow.png")))) << 
00858                     surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/glass - shadow.png")))  ), 
00859                 178 /* y_walkbehind */, true/*visible*/));
00860 
00861     bott_shad_layer =   
00862         NEW(layer_unlit_not_anim(
00863                 ( ulist( surf_with_name(fire_light, cfsurf::from_sdl_surface(
00864                                             IMG_Load("locations/lounge/lit/fire/bottle - shadow.png"))) ) <<
00865                     surf_with_name(lamp_light, cfsurf::from_sdl_surface(
00866                                        IMG_Load("locations/lounge/lit/lamp/bottle - shadow.png"))) ), 
00867                 178 /* y_walkbehind */, true/*visible*/));
00868 
00869 
00870     bottle_layer = NEW(
00871         layer_unlit_not_anim(
00872             ( ulist( surf_with_name(fire_light, bottle_cfsurf)) <<
00873                 surf_with_name(lamp_light, cfsurf::from_sdl_surface(
00874                                    IMG_Load("locations/lounge/lit/lamp/bottle.png")))) ,
00875             178 /* y_walkbehind */, true/*visible*/));
00876 
00877     glass_layer = NEW(
00878         layer_unlit_not_anim(
00879             ( ulist(surf_with_name(fire_light, glass_cfsurf)) <<
00880                 surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/glass.png")))) ,
00881             178 /* y_walkbehind */, true/*visible*/));
00882 
00883 
00884     first_fire_frame = ulist( 
00885         surf_with_name(fire_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/fire.png")))) <<
00886         surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/fire.png")));
00887     second_fire_frame = ulist( 
00888         surf_with_name(fire_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/fire-2.png")))) <<
00889         surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/fire-2.png")));
00890 
00891 
00892     lounge_unl_lay << 
00893 
00894         NEW(layer_unlit_not_anim( 
00895                 ( ulist( surf_with_name(fire_light, 
00896                                         cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/background.png")))) <<
00897                   surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/background.png"))) ) ,
00898                 INT_MIN /* you can't walk behind the background */, true/*visible*/)) << 
00899 
00900         NEW(layer_unlit_not_anim( 
00901                 ( ulist( surf_with_name(fire_light, cabinet_lit_fire_surf)) <<
00902                   surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/cabinet.png"))) ) ,
00903                 INT_MIN /* you can't walk behind the cabinet */, true/*visible*/)) << 
00904 
00905         NEW(layer_unlit_anim(
00906                 ulist( first_fire_frame) << second_fire_frame,
00907                 110, 
00908                 true, 1 /*second*/)) <<
00909 
00910         NEW(layer_unlit_not_anim(
00911                 ( ulist( surf_with_name(fire_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/armchairs.png"))) ) <<
00912                     surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/armchairs.png")))) ,
00913                 174 /* y_walkbehind */, true/*visible*/)) <<
00914         
00915         NEW(layer_unlit_not_anim(
00916                 ( ulist(surf_with_name(fire_light, table_cfsurf )) <<
00917                     surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/table.png"))) ) ,
00918                 174 /* y_walkbehind */, true/*visible*/)) <<
00919 
00920         glass_shad_layer << 
00921 
00922         bott_shad_layer <<
00923 
00924         bottle_layer <<
00925 
00926         glass_layer <<
00927 
00928         NEW(layer_unlit_not_anim(
00929                 ( ulist(  surf_with_name(fire_light, moose_cfsurf)  ) <<
00930                     surf_with_name(lamp_light, cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/moose head.png"))) ),
00931                 INT_MIN /* cannot walk behind */, true/*visible*/)) <<
00932 
00933         NEW( layer_unlit_not_anim( 
00934             ( ulist( surf_with_name(fire_light, 
00935                          cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/fire/moose head - shadow.png")))) << 
00936                 surf_with_name(lamp_light, 
00937                     cfsurf::from_sdl_surface(IMG_Load("locations/lounge/lit/lamp/moose head - shadow.png"))) ) ,
00938             INT_MIN /* cannot walk behind */, true/*visible*/));
00939 
00940 
00941     
00942 
00943 
00944     // BEGIN load letters
00945     for (i = 65; i <=90; i++){
00946         surf_of_letter[i] = IMG_Load(string("letters/" + string_of_int(i) + ".png").c_str());}
00947     for (i = 97; i <=122; i++){
00948         surf_of_letter[i] = IMG_Load(string("letters/" + string_of_int(i) + ".png").c_str());}
00949     surf_of_letter[32] = IMG_Load("letters/32.png");
00950     surf_of_letter['.'] = IMG_Load("letters/dot.png");
00951     surf_of_letter[','] = IMG_Load("letters/comma.png");
00952     surf_of_letter['\"'] = IMG_Load("letters/double-quotes.png");
00953     surf_of_letter['\''] = IMG_Load("letters/single-quotes.png");
00954     surf_of_letter['/'] = IMG_Load("letters/47.png");
00955     surf_of_letter['?'] = IMG_Load("letters/question-mark.png");
00956     surf_of_letter['+'] = IMG_Load("letters/plus.png");
00957     // END
00958 
00959     this->glass_zone =  NEW( hot_zone_pixel_perfect(glass_cfsurf, glass, true, 178));
00960     this->bottle_zone = NEW( hot_zone_pixel_perfect(bottle_cfsurf, bottle, true, 178));
00961     this->shed_handle_zone = NEW( hot_zone_square( 136, 115, 150, 121  , shed_handle, true, 139));
00962     this->treasure_zone = NEW( hot_zone_square( 85, 170, 120, 179  , spot_in_ground, false, 173));
00963 
00964     lounge_sorted_hot_zones <<
00965         glass_zone <<
00966         bottle_zone <<
00967         NEW( hot_zone_square(248, 90, 256, 110, lamp_cord, true, 127)) <<
00968         NEW( hot_zone_square(245, 58, 273, 129, lamp, true, 127)) <<
00969         NEW( hot_zone_pixel_perfect(table_cfsurf, table, true, 178)) <<
00970         NEW( hot_zone_pixel_perfect(moose_cfsurf, moose_head, true, INT_MIN)) <<
00971         NEW( hot_zone_square(276, 0, 320, 200, exit_lounge, true, INT_MIN)) <<
00972         NEW( hot_zone_pixel_perfect(
00973                  cfsurf::from_sdl_surface(
00974                      IMG_Load("locations/lounge/outlines/left-armchair.png")),
00975                  left_armchair, true, 174)) <<
00976         NEW( hot_zone_pixel_perfect(
00977                  cfsurf::from_sdl_surface(
00978                      IMG_Load("locations/lounge/outlines/right-armchair.png")),
00979                  right_armchair, true, 174))<<
00980         NEW( hot_zone_square(16, 152, 284, 184, carpet, true, INT_MIN)) <<
00981         NEW( hot_zone_square(119, 80, 165, 111, fire, true, INT_MIN)) <<
00982         NEW( hot_zone_square(90, 37, 184, 122, fireplace, true, INT_MIN)) <<
00983         NEW( hot_zone_square(185, 97, 200, 122, fire_tools, true, INT_MIN)) <<
00984         NEW( hot_zone_square(52, 108, 79, 121, pile_of_wood, true, INT_MIN)) <<
00985 
00986         NEW( hot_zone_square(10, 98, 47, 110 , cab_drawer, true, INT_MIN)) <<
00987         NEW( hot_zone_pixel_perfect( cabinet_lit_fire_surf, cabinet, true, INT_MIN)) <<
00988         NEW( hot_zone_square(0, 117, 320, 195, floor, true, INT_MIN)) <<
00989         NEW( hot_zone_square(40, 28, 73, 73, left_painting, true, INT_MIN)) <<
00990         NEW( hot_zone_square(203, 26, 237, 73, right_painting, true, INT_MIN));
00991 
00992 
00993 
00994     this->lounge = NEW(location(lounge_sorted_hot_zones, lounge_unl_lay, 
00995                            walking_map_from_sdl_surface(
00996                                IMG_Load("locations/lounge/walking-map.png")),
00997                            lounge_scaling_data,
00998                            /*active lights */ *set_of( ulist(fire_light))));
00999 
01000 
01001 
01002 
01003     this->shed_closed_door_zone = NEW(hot_zone_square(126, 91, 149,141 ,  shed_door, true, INT_MIN));
01004     this->shed_entrance_zone = NEW(hot_zone_square(126, 91, 149,141 ,shed_entrance, true, INT_MIN));
01005     this->shed_open_door_zone = NEW(hot_zone_square( 121, 93, 125, 146, shed_door,  true, INT_MIN));
01006 
01007     shed_sorted_hot_zones << treasure_zone << shed_handle_zone << shed_closed_door_zone << 
01008         shed_open_door_zone << shed_entrance_zone;
01009 
01010 
01011     this->shed_open_door_layer = 
01012         NEW(   layer_unlit_not_anim( 
01013                    ( ulist( surf_with_name(shed_sun_light, 
01014                                            cfsurf::from_sdl_surface(IMG_Load("locations/shed/lit/sun/open-door.png")))) <<
01015                      surf_with_name(shed_moon_light,
01016                                     cfsurf::from_sdl_surface(IMG_Load("locations/shed/lit/moon/open-door.png"))) <<
01017                      surf_with_name(torch_l,
01018                                     cfsurf::from_sdl_surface(IMG_Load("locations/shed/lit/sun/open-door.png")))),
01019                    INT_MIN /*you can't walk behind it */,
01020                    false /*not visible*/));
01021 
01022     shed_unl_lay << 
01023         NEW(layer_unlit_not_anim( 
01024                 ( ulist( surf_with_name(shed_sun_light, 
01025                                         cfsurf::from_sdl_surface(IMG_Load("locations/shed/lit/sun/bg.png")))) <<
01026                   surf_with_name(torch_l,
01027                                  cfsurf::from_sdl_surface(IMG_Load("locations/shed/lit/sun/bg.png" ))) <<
01028                   surf_with_name(shed_moon_light,
01029                                  cfsurf::from_sdl_surface(IMG_Load("locations/shed/lit/moon/bg.png")))),
01030 
01031                 INT_MIN,
01032                 true /* visible*/))<<
01033 
01034         shed_open_door_layer;
01035 
01036 
01037     shed_scal_dat.y1 = 144.0f;
01038     shed_scal_dat.scaling_at_y1 = 0.7f;
01039     shed_scal_dat.y2 = 178.0f;
01040     shed_scal_dat.scaling_at_y2 = 1.0f;
01041 
01042 
01043 
01044     this->shed = NEW(location(shed_sorted_hot_zones, 
01045                               shed_unl_lay, 
01046                               walking_map_from_sdl_surface(IMG_Load("locations/shed/walking-map.png")),
01047                               shed_scal_dat, 
01048                               *set_of(ulist(shed_sun_light))/* active lights fixed in loc*/));
01049 
01050 
01051 
01052     guy_blue_norm_still_anim[ d_right] = 
01053         NEW(animation(ulist(anim_frame::from_sdl_surface
01054                             ( IMG_Load("characters/guybrush/still/right/0.png"), int_pair(12, 46), 1.0f ))));
01055 
01056     guy_blue_norm_still_anim[d_left] = 
01057         NEW(animation(ulist(anim_frame::from_sdl_surface
01058                             (IMG_Load("characters/guybrush/still/left/0.png"), int_pair(12, 46), 1.0f ))));
01059 
01060     guy_blue_norm_still_anim[ d_up] = 
01061         NEW(animation(ulist(anim_frame::from_sdl_surface
01062                             (IMG_Load("characters/guybrush/still/up/0.png"), int_pair(12, 46), 1.0f /* duration */))));
01063 
01064     guy_blue_norm_still_anim[ d_down] = 
01065         NEW(animation( ulist (anim_frame::from_sdl_surface(
01066                                   IMG_Load("characters/guybrush/still/down/0.png"), int_pair(12, 46), 
01067                                   1.0f /* duration  */))));
01068 
01069     guy_red_norm_still_anim[d_right] =  
01070         NEW(animation
01071             (ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/still/right/0.png"), int_pair(12, 46), 
01072                                                 1.0f /* duration */))));
01073 
01074     guy_red_norm_still_anim[ d_left] = 
01075         NEW(animation
01076             (ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/still/left/0.png"), int_pair(12, 
01077                                                 46), 1.0f /* duration  */))));
01078 
01079     guy_red_norm_still_anim[ d_up] = NEW(animation
01080         (ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/still/up/0.png"), int_pair(12, 
01081                    46), 1.0f /* duration */))));
01082 
01083     guy_red_norm_still_anim[ d_down] = NEW(animation
01084         (ulist(anim_frame::from_sdl_surface(IMG_Load("characters/guybrush-red/still/down/0.png"), int_pair(12, 
01085                    46), 1.0f /* duration  */))));
01086 
01087     guy_blue_sitting_still_anim[ "sat_on_right_chair"] = 
01088         NEW(animation(
01089                 ulist(anim_frame::from_sdl_surface(
01090                           IMG_Load("characters/guybrush/sat-on-armchair/right.png"),
01091                           point_for_sitting_on_right_armch - int_pair(201, 129) /* top left of frame in room*/,
01092                           1.0f /* durat*/))));
01093     guy_blue_sitting_still_anim[ "sat_on_left_chair"] = 
01094         NEW(animation(
01095                 ulist(anim_frame::from_sdl_surface(
01096                           IMG_Load("characters/guybrush/sat-on-armchair/left.png"),
01097                           point_for_sitting_on_left_armch - int_pair(36, 131),
01098                           1.0f /* durat*/))));
01099     guy_red_sitting_still_anim[ "sat_on_right_chair"] = 
01100         NEW(animation(
01101                 ulist(anim_frame::from_sdl_surface(
01102                           IMG_Load("characters/guybrush-red/sat-on-armchair/right.png"),
01103                           point_for_sitting_on_right_armch - int_pair( 201, 129  ) /*top left of frame in room*/,
01104                           1.0f /* durat*/))));
01105     guy_red_sitting_still_anim[ "sat_on_left_chair"] = 
01106         NEW(animation(
01107                 ulist(anim_frame::from_sdl_surface(
01108                           IMG_Load("characters/guybrush-red/sat-on-armchair/left.png"),
01109                           point_for_sitting_on_left_armch - int_pair(36,131),
01110                           1.0f /* durat*/))));
01111 
01112     // BEGIN associate moods with animations
01113     anim_of_mood_blue_guybr[ mood_puzzled_scratch_head] = 
01114         anim_right_left(guy_blue_scratch_right, guy_blue_scratch_left);
01115     anim_of_mood_blue_guybr[ mood_normal] = 
01116         anim_right_left(normal_sp_gest_blue_right, normal_sp_gest_blue_left);
01117 
01118     anim_of_mood_red_guybr[ mood_puzzled_scratch_head] = 
01119         anim_right_left(guy_red_scratch_right, guy_red_scratch_left);
01120     anim_of_mood_red_guybr[ mood_normal] = 
01121         anim_right_left(normal_sp_gest_red_right, normal_sp_gest_red_left);
01122 
01123 
01124     // END
01125 
01126 
01127     // BEGIN decl
01128     SDL_Surface * bag_open_surf;
01129     SDL_Surface * bag_closed_surf;
01130     pt<container> bag, bag2;
01131     SDL_Rect bag_drop_in_rect;
01132     SDL_Rect bag_closing_rect;
01133     // END
01134 
01135     bag_open_surf = IMG_Load("data/bag-open.png");
01136     bag_closed_surf = IMG_Load("data/bag-closed.png");
01137     
01138     bag_drop_in_rect.x = 31;
01139     bag_drop_in_rect.y = 18;
01140     bag_drop_in_rect.w = 70;
01141     bag_drop_in_rect.h = 44;
01142 
01143     bag_closing_rect.x = 0;
01144     bag_closing_rect.y = 12;
01145     bag_closing_rect.w = 19;
01146     bag_closing_rect.h = 29;
01147 
01148     bag = NEW(container(
01149                   "bag",
01150                   NEW(can_appear_closed_in_inv_yes(bag_closed_surf)),
01151                   bag_drop_in_rect,
01152                   bag_open_surf,
01153                   list<pos_and<pt<obj_or_concept> > >(),
01154                   int_pair(40,30),
01155                   bag_closing_rect,
01156                   PHYS_OBJECTS,
01157                   true /* can be dragged */));
01158 
01159     bag2 = NEW(container(
01160                    "bag",
01161                    NEW(can_appear_closed_in_inv_yes(bag_closed_surf)),
01162                    bag_drop_in_rect,
01163                    bag_open_surf,
01164                    list<pos_and<pt<obj_or_concept> > >(),
01165                    int_pair(40,30),
01166                    bag_closing_rect,
01167                    PHYS_OBJECTS,
01168                    true /* can be dragged */));
01169 
01170 
01171     // BEGIN decl
01172     SDL_Rect backpack_closing_rect;
01173     // END
01174 
01175     backpack_sensitive_area.x = 28; 
01176     backpack_sensitive_area.y = 33;
01177     backpack_sensitive_area.w = 81; 
01178     backpack_sensitive_area.h = 47;
01179 
01180     backpack_closing_rect.x = 0;
01181     backpack_closing_rect.y = 52;
01182     backpack_closing_rect.w = 22;
01183     backpack_closing_rect.h = 29;
01184 
01185     backpack_picture = IMG_Load("data/backpack-open.png");
01186 
01187 
01188     // BEGIN decl
01189     SDL_Surface * closed_backpack_icon;
01190     // END
01191 
01192     closed_backpack_icon = IMG_Load("data/inv-icon-scaled.png");
01193 
01194 
01195     blue_guybr_inv = NEW(container(
01196                              "your backpack",
01197                              NEW(can_appear_closed_in_inv_yes(closed_backpack_icon,
01198                                                        false /* cannot be moved across containers */)),
01199                              backpack_sensitive_area,
01200                              backpack_picture,
01201                              ( ulist( pos_and<pt<obj_or_concept> >( book, int_pair(40,40))) <<
01202                                pos_and<pt<obj_or_concept> >(pencil, int_pair(41, 40)) <<
01203                                pos_and<pt<obj_or_concept> >(dagger, int_pair(41, 40)) <<
01204                                pos_and<pt<obj_or_concept> >(lighter, int_pair(46, 40)) <<
01205                                pos_and<pt<obj_or_concept> > (bag, int_pair(43, 54)) <<
01206                                pos_and<pt<obj_or_concept> > (bag2, int_pair(43, 68)) 
01207                                  ),
01208                              int_pair(100,40),
01209                              backpack_closing_rect,
01210                              PHYS_OBJECTS,
01211                              true /* can be dragged */));
01212 
01213 
01214 
01215     // BEGIN decl
01216     SDL_Rect discourse_topics_sensitive_area, discourse_topics_closing_rect;
01217     SDL_Surface * discourse_topics_open_surf, * discourse_topics_closed_surf;
01218     // END
01219 
01220     discourse_topics_sensitive_area.x = 26;
01221     discourse_topics_sensitive_area.y = 5;
01222     discourse_topics_sensitive_area.w = 78;
01223     discourse_topics_sensitive_area.h = 85;
01224 
01225     discourse_topics_closing_rect.x = 0;
01226     discourse_topics_closing_rect.y = 17;
01227     discourse_topics_closing_rect.w = 21;
01228     discourse_topics_closing_rect.h = 29;
01229 
01230     discourse_topics_open_surf = IMG_Load("data/ideas-container-open.png");
01231     discourse_topics_closed_surf = IMG_Load("data/discourse-topics-closed.png");
01232 
01233     blue_guybr_discourse_topics = NEW(container(
01234                               "discourse topics",
01235                               NEW(can_appear_closed_in_inv_yes(discourse_topics_closed_surf)),
01236                               discourse_topics_sensitive_area,
01237                               discourse_topics_open_surf,
01238                               seq_list<pos_and<pt<obj_or_concept> > > (),
01239                               int_pair(10,10),
01240                               discourse_topics_closing_rect,
01241                               CONCEPTS,
01242                               true /* can be dragged */));
01243 
01244 
01245     // BEGIN decl
01246     vector<pt<container> > folders;
01247     SDL_Surface* folder_closed_surf;
01248     // END
01249 
01250     folder_closed_surf = IMG_Load("data/folder.png");
01251 
01252     for (int i = 0; i < 10; i++)
01253     {
01254         folders.push_back( NEW(container(
01255                                    "folder",
01256                                    NEW(can_appear_closed_in_inv_yes(folder_closed_surf)),
01257                                    discourse_topics_sensitive_area,
01258                                    discourse_topics_open_surf,
01259                                    seq_list<pos_and<pt<obj_or_concept> > > (),
01260                                    int_pair(10 + 9 * i, 10 + 3 * i),
01261                                    discourse_topics_closing_rect,
01262                                    CONCEPTS,
01263                                    true /* can be dragged */)));
01264     }
01265 
01266 
01267 
01268 
01269 
01270 
01271 
01272     blue_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01273                                                      topic_yes,
01274                                                      int_pair(75, 31)));
01275     blue_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01276                                                      topic_no,
01277                                                      int_pair( 41, 62)));
01278     blue_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01279                                                      topic_hello,
01280                                                      int_pair(36,18 )));
01281 
01282     blue_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01283                                                      folders[0],
01284                                                      int_pair(79,56 )));
01285     blue_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01286                                                      folders[1],
01287                                                      int_pair(28,59 )));
01288 
01289  
01290 
01291 
01292     red_guybr_inv = NEW(container(   
01293                             "your backpack",
01294                             NEW(can_appear_closed_in_inv_yes(closed_backpack_icon,
01295                                                       false /* cannot be moved across containers */)),
01296                             backpack_sensitive_area,
01297                             backpack_picture,
01298                             seq_list<pos_and<pt<obj_or_concept> > >(),
01299                             int_pair(10,10),
01300                             backpack_closing_rect,
01301                             PHYS_OBJECTS,
01302                             true /* can be dragged */));
01303 
01304     red_guybr_discourse_topics = NEW(container(
01305                               "discourse topics",
01306                               NEW(can_appear_closed_in_inv_yes(discourse_topics_closed_surf)),
01307                               discourse_topics_sensitive_area,
01308                               discourse_topics_open_surf,
01309                               seq_list<pos_and<pt<obj_or_concept> > >(),
01310                               int_pair(10,10),
01311                               discourse_topics_closing_rect,
01312                               CONCEPTS,
01313                               true /* can be dragged */));
01314 
01315 
01316     red_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01317                                                     topic_yes,
01318                                                     int_pair(75, 31)));
01319     red_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01320                                                      topic_no,
01321                                                      int_pair( 41, 62)));
01322     red_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01323                                                      topic_hello,
01324                                                      int_pair(36,18 )));
01325 
01326     red_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01327                                                      folders[2],
01328                                                      int_pair(79,56 )));
01329     red_guybr_discourse_topics->add_item_in_pos(pos_and<pt<obj_or_concept> > (
01330                                                      folders[3],
01331                                                      int_pair(28,59 )));
01332 
01333 
01334 
01335 
01336     // BEGIN decl
01337     SDL_Rect cache_inner_area;
01338     SDL_Surface * cache_picture;
01339     // END
01340 
01341 
01342 
01343     cache_picture = IMG_Load("data/cache-bg.png");
01344 
01345     cache_inner_area.x = 0;
01346     cache_inner_area.y = 0;
01347     cache_inner_area.w = cache_picture->w;
01348     cache_inner_area.h = cache_picture->h+1;
01349 
01350 
01351 
01352 
01353 
01354 
01355 
01356 
01357 
01358     blue_guybr_cache = NEW(container(
01359                                "--name invisible--",
01360                                NEW(can_appear_closed_in_inv_no()),
01361                                cache_inner_area,
01362                                cache_picture,
01363                                seq_list<pos_and<pt<obj_or_concept> > > (),
01364                                int_pair(0, screen->h - cache_picture->h),
01365                                cannot_be_closed(),
01366                                CAN_CONTAIN_ANYTHING,
01367                                false /* cannot be dragged */));
01368 
01369     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >( hand, 
01370                                                                     int_pair(0,  15)));
01371     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01372                                           eye, 
01373                                           int_pair(36, 22)));
01374     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01375                                           ear, 
01376                                           int_pair(67, 22)));
01377     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01378                                           foot, 
01379                                           int_pair(96, 22)));
01380     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01381                                           body, 
01382                                           int_pair(121, 22)));
01383     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01384                                           mouth, 
01385                                           int_pair(56, 8)));
01386     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01387                                           blue_guybr_inv, 
01388                                           int_pair(144, 15)));
01389     blue_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01390                                           blue_guybr_discourse_topics, 
01391                                           int_pair(191, 19)));
01392 
01393     red_guybr_cache = NEW(container(
01394                                "--name invisible--",
01395                                NEW(can_appear_closed_in_inv_no()),
01396                                cache_inner_area,
01397                                cache_picture,
01398                                seq_list<pos_and<pt<obj_or_concept> > > (),
01399                                int_pair(0, screen->h - cache_picture->h),
01400                                cannot_be_closed(),
01401                                CAN_CONTAIN_ANYTHING,
01402                                false /* cannot be dragged */));
01403 
01404     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >( 
01405                                          hand,
01406                                          int_pair(0,  15)));
01407     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01408                                           eye, 
01409                                           int_pair(36, 22)));
01410     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01411                                           ear, 
01412                                           int_pair(67, 22)));
01413     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01414                                           foot, 
01415                                           int_pair(96, 22)));
01416     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01417                                           body, 
01418                                           int_pair(121, 22)));
01419     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01420                                           mouth, 
01421                                           int_pair(56, 8)));
01422     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01423                                           red_guybr_inv, 
01424                                           int_pair(144, 15)));
01425     red_guybr_cache->add_item_in_pos(pos_and<pt<obj_or_concept> >(
01426                                           red_guybr_discourse_topics, 
01427                                           int_pair(191, 19)));
01428 
01429 
01430 
01431 
01432 
01433 
01434 
01435 
01436 
01437                          
01438     this->blue_guybr = NEW( PC( guy_walk_frame_when, 
01439                                 NEW(PS_missing_two_items(
01440                                         map_get(guy_blue_norm_still_anim, 
01441                                                 d_left),
01442                                         0, 0)) /* @@ */, 
01443                                 guy_blue_norm_still_anim,
01444                                 guy_blue_sitting_still_anim,
01445                                 int_pair(240, 156),
01446                                 16.0f /*step_horiz */,
01447                                 8.0f /*step_vert */ ,
01448                                 blue_guybr_cache,
01449                                 shed, blue_guyb_item, d_left, rgb(190,190,255),
01450                                 anim_of_mood_blue_guybr,
01451                                 NEW(still_situation_normal())));
01452 
01453     this->red_guybr = NEW( PC( guy_red_walk_frame_when, 
01454                                NEW(PS_missing_two_items(
01455                                         map_get(guy_red_norm_still_anim, 
01456                                                 d_right),
01457                                         0, 0)) /* @@ */, 
01458                                guy_red_norm_still_anim,
01459                                guy_red_sitting_still_anim,
01460                                int_pair(47, 145),
01461                                /*player_step_horiz = */16.0f,
01462                                /*player_step_vert = */  8.0f,
01463                                red_guybr_cache,
01464                                lounge, red_guybr_item, d_right, rgb(250, 190, 190),
01465                                anim_of_mood_red_guybr,
01466                                NEW(still_situation_normal())));
01467 
01468 
01469 
01470     this->act_pl = blue_guybr;
01471 
01472     this->players << blue_guybr << red_guybr;
01473 
01474     this->lights_across_loc = *set_of(ulist(torch_l));
01475 
01476 
01477     this->locations = *set_of(ulist(shed) << lounge);
01478 
01479     // BEGIN decl
01480     SDL_Rect drawer_closing_rect;
01481     // END
01482 
01483     drawer_closing_rect.x = 0;
01484     drawer_closing_rect.y = 17;
01485     drawer_closing_rect.w = 21;
01486     drawer_closing_rect.h = 29;
01487 
01488     drawer_standard_bg = IMG_Load("data/drawer-open.png");
01489 
01490     rect_of_table_drawer.x = 34; 
01491     rect_of_table_drawer.y = 15; 
01492     rect_of_table_drawer.w = 70; 
01493     rect_of_table_drawer.h = 35;
01494 
01495     table_drawer = NEW(container(
01496                            "drawer",
01497                            NEW(can_appear_closed_in_inv_no()),
01498                            rect_of_table_drawer, 
01499                            drawer_standard_bg,
01500                            ( ulist(pos_and<pt<obj_or_concept> >(torch_unlit, int_pair(49,25))) <<
01501                              pos_and<pt<obj_or_concept> >(sheet, int_pair(48, 25))),
01502                            int_pair(15,15),
01503                            drawer_closing_rect,
01504                            PHYS_OBJECTS,
01505                            true /* can be dragged */));
01506 
01507 
01508     // BEGIN decl
01509     int top_of_special_buttons_zone;
01510     // END
01511                   
01512     
01513     this->special_buttons_icon = IMG_Load("data/special-buttons.png");
01514 
01515     top_of_special_buttons_zone = screen->h - special_buttons_icon->h;
01516 
01517     this->special_buttons_icon_pos = int_pair(277, top_of_special_buttons_zone);
01518 
01519     this->zone_save_load_game  = create_rect(277, top_of_special_buttons_zone , 300, top_of_special_buttons_zone + 17);
01520 
01521     this->zone_cycle_active_player = create_rect(300, top_of_special_buttons_zone, screen->w, screen->h );
01522 
01523     this->zone_toggle_stay_follow = create_rect(277, top_of_special_buttons_zone + 18, 
01524                                                 300, screen->h);
01525 }
01526 
01527 
01528 
01529 void
01530 my_game::execute_action_verb_object(
01531     const pt<verb> v, 
01532     const pt<obj_or_concept> passive_obj,
01533     const pt<obj_or_concept> obj_which_had_that_verb)
01534 {
01535     // BEGIN decl
01536     speech_t speech;
01537     script_cmds_t steps;
01538     script_cmds_t steps_other;
01539     seq_list<speech_t> list_of_speeches;
01540     dialog_t dialog;
01541     pt<obj_or_concept> o;
01542     pt<container> real_co;
01543     int_pair pos;
01544     // END
01545 
01546     // BEGIN declare frequently used positions
01547     int_pair lamp_turn_on_pos(232, 131);
01548     int_pair enter_exit_lounge_pos(281, 141);
01549     int_pair enter_exit_shed_pos(145, 146);
01550     int_pair glass_and_bottle_pick_up_pos(102, 183);
01551     string i_already_have_it = "I already have it.";
01552     // END
01553 
01554     o = passive_obj;
01555 
01556     if (v == person_give)
01557     {
01558         if(obj_which_had_that_verb == blue_guyb_item || obj_which_had_that_verb == red_guybr_item)
01559         {
01560             // We don't need to check for backpack and concepts:
01561             // containers can't be given: when you click them, they
01562             // are opened. Also, we don't need to check for concepts
01563             // that are not containers: if you click them and a
01564             // person, execute_action_object_object is called.
01565                 
01566             if (o == foot || o == mouth || o == eye || o == hand || o == body || 
01567                 o == ear ) 
01568             {
01569                 speech << mood_and_string(mood_puzzled_scratch_head,
01570                                           "Very funny.");
01571                 steps << NEW(scr_cmd_speak( speech, do_not_close_containers));  
01572             }
01573             else
01574             {
01575 
01576                 speech << mood_and_string(mood_normal, "Here, take this.");
01577                 steps << NEW(scr_cmd_speak( speech, close_any_open_container));  
01578 
01579                 if(obj_which_had_that_verb == red_guybr_item)
01580                 {
01581                     steps << NEW(scr_cmd_add_to_container( red_guybr->cache, o));
01582                 }
01583                 else
01584                 {
01585                     steps << NEW(scr_cmd_add_to_container(blue_guybr->cache, o));
01586                 }
01587 
01588                 steps << NEW(scr_cmd_remove_from_container(act_pl->cache, o));
01589             }
01590         }
01591         else
01592         {
01593             speech << mood_and_string(mood_normal, "I don't want to give it to him.");
01594             steps << NEW(scr_cmd_speak( speech, do_not_close_containers));  
01595         }
01596     }
01597     else
01598     {
01599         // from now on, we group by target object
01600 
01601         //cout << "here" << endl;
01602 
01603         if (o == ear && v == look)
01604         {
01605             speech << mood_and_string(mood_normal, "These are my ears.");
01606             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01607         }
01608 
01609 
01610         else if (o == cab_drawer && v == look)
01611         {
01612             speech << mood_and_string(mood_normal, "Try to open the drawer.");
01613             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01614         }
01615 
01616         else if (o == cabinet && v == look)
01617         {
01618             speech << mood_and_string(mood_normal, "It has a drawer which I can open and browse into.");
01619             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01620         }
01621 
01622         else if (o ==  spot_in_ground && v == look)
01623         {
01624             speech << mood_and_string(mood_puzzled_scratch_head,
01625                                       "It's earth that seems to have been recently dug...");
01626             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01627             
01628         }
01629 
01630         else if ( o == shed_handle && v == look)
01631         {
01632             speech << mood_and_string(mood_puzzled_scratch_head,
01633                                       "I can turn the handle to open the door.");
01634             steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01635 
01636         }
01637         else if ( o == treasure_heard && v == look)
01638         {
01639             speech << mood_and_string(mood_puzzled_scratch_head,
01640                                       "It is the treasure that Red Guybrush talked about.") <<
01641                 mood_and_string(mood_normal,
01642                                 "I still don't have it, however it appears in my inventory so I can talk to people about it.");
01643             steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01644         }
01645         else if (o == shed_entrance && v == look)
01646         {
01647             speech << mood_and_string(mood_normal, "I can see inside the house. There is a lit fireplace. Try to ENTER.");
01648             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01649         
01650         }
01651         else if ( o ==shed_door && v == look)
01652         {
01653             speech << mood_and_string(mood_normal, "It is a door that leads inside the house. You can open it. Try to use the hand on the door.");
01654             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01655             
01656         }
01657         else if (o == lamp && v == look)
01658         {
01659             speech << mood_and_string(mood_normal, "This is a lamp. Try to turn it on and off.") ;
01660             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01661         
01662         }
01663         else if (o == lamp_cord && v == look)
01664         {
01665             speech << mood_and_string(mood_normal, "There is a small cord pending from the lamp. It is probably the lamp switch.") ;
01666             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01667         
01668         }
01669         else if ( o == red_guybr_item && v == look)
01670         {
01671             speech << mood_and_string(mood_normal, "This is another player, Red Guybrush. ");
01672             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01673         
01674         }
01675         else if ( o == bottle && v == look)
01676         {
01677             speech << mood_and_string(mood_normal, "This is a bottle.");
01678             steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01679         
01680         }
01681         else if ( o == table && v == look)
01682         {
01683             speech << mood_and_string(mood_normal, "You can't do anything with the table, sorry.");
01684             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01685         }
01686         else if ( o == left_armchair && v == look)
01687         {
01688             speech << mood_and_string(mood_normal, "It is an armchair. You can sit on it. Try.");
01689             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01690         }
01691         else if ( o == right_armchair && v == look)
01692         {
01693             speech << mood_and_string(mood_normal, "It is an armchair. You can sit on it. Try.");
01694             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01695         }
01696 
01697 
01698         // BEGIN glass
01699         else if ( o == glass && v == look)
01700         {
01701             speech << mood_and_string(mood_normal, "This is a glass. It is empty.");
01702             steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01703         }
01704         else if (v == pick_up && o == glass )
01705         {
01706             if(! contains_recursively(act_pl->cache, 
01707                                       o,
01708                                       real_co /*out*/, 
01709                                       pos /*out*/))
01710             {
01711                 steps << NEW(scr_cmd_walk( glass_and_bottle_pick_up_pos));
01712                 if(act_pl == blue_guybr)
01713                 {
01714                     steps << NEW(scr_cmd_passive_anim(guy_blue_pick_up_right_normal));
01715                 }
01716                 else
01717                 {
01718                     steps << NEW(scr_cmd_passive_anim(guy_red_pick_up_right_normal));
01719                 }
01720                 steps << NEW(scr_cmd_modify_layer(HIDE, glass_layer));
01721                 steps << NEW(scr_cmd_modify_layer(HIDE, glass_shad_layer));
01722                 steps << NEW(scr_cmd_modify_zone(HIDE, glass_zone));
01723                 steps << NEW(scr_cmd_add_to_container(act_pl->cache, o));
01724 
01725             }
01726             else
01727             {
01728                 speech << mood_and_string(mood_normal, i_already_have_it);
01729                 steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01730             }
01731         
01732         }
01733         // END
01734 
01735         // BEGIN sheet
01736         else if ( o == sheet && v == pick_up)
01737         {
01738             if( ! contains_recursively(act_pl->cache, 
01739                                        sheet,
01740                                        real_co /*out*/,
01741                                        pos /*out*/))
01742             {
01743                 steps << NEW(scr_cmd_add_to_container(act_pl->cache, sheet));
01744                 steps << NEW(scr_cmd_remove_from_container(table_drawer, sheet));
01745             }
01746             else
01747             {
01748                 speech << mood_and_string(mood_normal, "I already have it.");
01749                 steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01750             }
01751         }
01752         // END
01753 
01754         // BEGIN sheet
01755         else if ( o == dagger && v == pick_up)
01756         {
01757             if( ! contains_recursively(act_pl->cache, 
01758                                        dagger,
01759                                        real_co /*out*/,
01760                                        pos /*out*/))
01761             {
01762                 steps << NEW(scr_cmd_add_to_container(act_pl->cache, dagger));
01763                 steps << NEW(scr_cmd_remove_from_container(table_drawer, dagger));
01764             }
01765             else
01766             {
01767                 speech << mood_and_string(mood_normal, "I already have it.");
01768                 steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01769             }
01770         }
01771         // END
01772 
01773         else if ( o == blue_guyb_item && v == look)
01774         {
01775             speech << mood_and_string(mood_normal, "This is another player, Blue Guybrush. ");
01776             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01777         
01778         }
01779         else if ( o ==  exit_lounge && v == look)
01780         {
01781             speech << mood_and_string(mood_normal, "This is an exit that leads outside. Try to enter it or walk to it.");
01782             steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01783 
01784             
01785         }
01786         
01787         else if (o == lamp_cord && v == push)
01788         {
01789 
01790             if (in(lamp_light, act_pl->loc->active_lights))
01791             {
01792                 speech << mood_and_string(mood_normal, "I'll pull the small cord.");
01793                 
01794                 steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01795                 steps << NEW(scr_cmd_walk( lamp_turn_on_pos));
01796                 if(act_pl == red_guybr)
01797                 {
01798                     steps << NEW(scr_cmd_passive_anim(guy_red_pick_up_right_normal));
01799                 }
01800                 else
01801                 {
01802                     steps << NEW(scr_cmd_passive_anim(guy_blue_pick_up_right_normal));
01803                 }
01804                 steps << NEW(scr_cmd_change_light(false, lamp_light, lounge)); 
01805             }
01806             else
01807             {
01808                 speech << mood_and_string(mood_normal, "I'll pull the small cord.");
01809 
01810                 steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01811                 steps << NEW(scr_cmd_walk( lamp_turn_on_pos));
01812                 if(act_pl == red_guybr)
01813                 {
01814                     steps << NEW(scr_cmd_passive_anim(guy_red_pick_up_right_normal));
01815                 }
01816                 else
01817                 {
01818                     steps << NEW(scr_cmd_passive_anim(guy_blue_pick_up_right_normal));
01819                 }
01820                 steps << NEW(scr_cmd_change_light(true, lamp_light, lounge)); 
01821                 
01822                 if (first_time_you_turn_on_lamp)
01823                 {
01824                     first_time_you_turn_on_lamp = false;
01825                     speech.clear();
01826                     speech << mood_and_string(mood_normal, "Notice the illumination has changed. Now both the lamp and the fireplace are illuminating the room.") <<
01827                         mood_and_string(mood_normal, "Also notice the lights are trembling. The shadows of the armchairs reflect the active lights.")<<
01828                         mood_and_string(mood_normal, "You can switch the lamp back off if you like.");
01829                     steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01830                 }
01831             
01832             }
01833         }
01834         else if (v == pick_up && o == whole_bottle )
01835         {
01836             if(! contains_recursively(act_pl->cache, bottle, real_co /*out*/, pos /*out*/))
01837             {
01838                 steps << NEW(scr_cmd_walk( glass_and_bottle_pick_up_pos));
01839                 if(act_pl == blue_guybr)
01840                 {
01841                     steps << NEW(scr_cmd_passive_anim(guy_blue_pick_up_right_normal));
01842                 }
01843                 else
01844                 {
01845                     steps << NEW(scr_cmd_passive_anim(guy_red_pick_up_right_normal));
01846                 }
01847                 steps << NEW(scr_cmd_modify_layer(HIDE, bottle_layer));
01848                 steps << NEW(scr_cmd_modify_layer(HIDE, bott_shad_layer));
01849                 steps << NEW(scr_cmd_modify_zone(HIDE, bottle_zone));
01850                 steps << NEW(scr_cmd_add_to_container(act_pl->cache, bottle));
01851                 
01852             }
01853             else
01854             {
01855                 speech << mood_and_string(mood_normal, i_already_have_it);
01856                 steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01857             }
01858             
01859         }
01860         else if (v == sit && o == right_armchair)
01861         {
01862             steps << NEW(scr_cmd_walk( point_for_sitting_on_right_armch));
01863             steps << NEW(scr_cmd_look_at_fixed_direction( d_left));
01864             steps << NEW(scr_cmd_set_sitting_state("sat_on_right_chair", "right_armchair"));
01865             
01866         }
01867         else if (v == sit && o == left_armchair)
01868         {
01869             steps << NEW(scr_cmd_walk( point_for_sitting_on_left_armch));
01870             steps << NEW(scr_cmd_look_at_fixed_direction( d_right));
01871             steps << NEW(scr_cmd_set_sitting_state("sat_on_left_chair", "left_armchair"));
01872         
01873         }
01874         else if ( (v == enter || v == walk) && o == exit_lounge)
01875         {
01876             steps << NEW(scr_cmd_walk( enter_exit_lounge_pos));
01877             steps << NEW(scr_cmd_change_loc(shed, enter_exit_shed_pos));
01878         }
01879         else if ( (v == enter || v == walk) && o == shed_entrance)
01880         {
01881             if (contains_not_recursively(act_pl->cache, torch_lit, pos /* out*/))
01882             {
01883                 speech << mood_and_string(mood_normal, "I'll switch off the torch first.");
01884                 steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01885 
01886                 steps << NEW(scr_cmd_remove_from_container( act_pl->cache, torch_lit));
01887                 steps << NEW(scr_cmd_add_to_container_in_pos( act_pl->cache, torch_unlit, pos));
01888                 
01889 
01890             }
01891             steps << NEW(scr_cmd_walk( enter_exit_shed_pos));
01892             steps << NEW(scr_cmd_change_loc(lounge , enter_exit_lounge_pos));
01893             steps << NEW(scr_cmd_look_at_fixed_direction(d_left));
01894         }
01895         else if (v == push && o == cab_drawer ) 
01896         {
01897             steps << NEW(scr_cmd_walk( int_pair(29, 136)));
01898             steps << NEW(scr_cmd_look_at_fixed_direction(d_up));
01899             steps << NEW(scr_cmd_open_popup(table_drawer));
01900         }
01901         else if ((v == push || v == rotate) && (o == shed_door || o == shed_handle) ) 
01902         {
01903             if (shed_open_door_layer->visible)
01904             {
01905                 steps << NEW(scr_cmd_walk( enter_exit_shed_pos));
01906                 steps << NEW(scr_cmd_modify_zone(SHOW, shed_closed_door_zone));
01907                 steps << NEW(scr_cmd_modify_zone(SHOW, shed_handle_zone));
01908             
01909                 steps << NEW(scr_cmd_modify_zone(HIDE, shed_open_door_zone));
01910                 steps << NEW(scr_cmd_modify_zone(HIDE, shed_entrance_zone));
01911             
01912                 steps << NEW(scr_cmd_modify_layer(HIDE, shed_open_door_layer));
01913                 steps << NEW(scr_cmd_look_at_fixed_direction(d_left));
01914             
01915             }
01916             else
01917             {
01918                 steps << NEW(scr_cmd_walk( enter_exit_shed_pos));
01919                 steps << NEW(scr_cmd_modify_zone(HIDE, shed_closed_door_zone));
01920                 steps << NEW(scr_cmd_modify_zone(HIDE, shed_handle_zone));
01921                 
01922                 steps << NEW(scr_cmd_modify_zone(SHOW, shed_open_door_zone));
01923                 steps << NEW(scr_cmd_modify_zone(SHOW, shed_entrance_zone));
01924                 
01925                 steps << NEW(scr_cmd_modify_layer(SHOW, shed_open_door_layer));
01926                 
01927                 steps << NEW(scr_cmd_look_at_fixed_direction(d_left));
01928                 
01929             }
01930         }
01931         else
01932         {
01933             if(v == open)
01934             {
01935                 // "open" never works in this game, but we can't remove it
01936                 // because it would converge into "none of the above". So
01937                 // we give an error message always.
01938                 speech << mood_and_string(mood_normal, "\"Open\" never works in this game, because it is too abstract. Please specify exactly how you want to open, or close, something. For example, \"open door\" becomes \"pull handle\". \"Open safe\" becomes \"safe + explosive\".");
01939             }
01940             else if(v == talk)
01941             {
01942                 speech << mood_and_string(mood_normal, "\"Talk to\" never works in this game. You have to click a discourse topic and then the person you wish to talk to.");
01943             }
01944             else if(v == look)
01945             {
01946                 speech << mood_and_string(mood_normal, "I see nothing special about it.");
01947             }
01948             else if(v == give_to_someone)
01949             {
01950                 speech << mood_and_string(mood_normal, "To give an object to a person, just click the object and the person.");
01951             }
01952             else if(v == throw_at)
01953             {
01954                 speech << mood_and_string(mood_normal, "To throw an object at another object, just click the first object and the second object.");
01955             }
01956             else if(v == turn_on)
01957             {
01958                 // "turn_on" never works in this game, but we can't remove
01959                 // it because it would converge into "none of the
01960                 // above". So we give an error message always.
01961                 speech << mood_and_string(mood_normal, "\"Turn on\" never works in this game, because it is too abstract. Please specify exactly how you want to turn something on, or off. For example, \"turn on lamp\" becomes \"push lamp switch\".");
01962             }
01963             else if(v == walk)
01964             {
01965                 speech << mood_and_string(mood_normal, "Currently, \"walk\" only works on an exit or entrance. It does not work with doors or other physical objects. Also, to move to a precise spot, you can use the right mouse button.");
01966             }
01967             else
01968             {
01969                 speech << mood_and_string(mood_puzzled_scratch_head,
01970                                           "There is something more logical to do at this time.");
01971             }
01972             steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
01973         }
01974     }
01975     execute_commands(act_pl, steps);
01976 
01977 }
01978 
01979 void
01980 my_game::execute_action_double_none_of_the_above(
01981     const pt<phys_obj> o1, 
01982     const pt<phys_obj> o2)
01983 {
01984     // BEGIN decl
01985     speech_t speech;
01986     script_cmds_t steps;
01987     script_cmds_t steps_other;
01988     dialog_t dialog;
01989     // END
01990     speech << mood_and_string(mood_normal, "At this time, I don't see what else I could do with them.");
01991     steps << NEW(scr_cmd_speak( speech, close_any_open_container));
01992     execute_commands(act_pl, steps);
01993 }
01994 
01995 void
01996 my_game::execute_action_object_object(
01997     const pt<obj_or_concept> o1, 
01998     const pt<obj_or_concept> o2)
01999 {
02000     // BEGIN decl
02001     speech_t speech;
02002     script_cmds_t steps;
02003     script_cmds_t steps_other;
02004     dialog_t dialog;
02005     pt<container> real_co;
02006     int_pair pos;
02007     // END
02008 
02009     if (MATCH_IN_ANY_ORDER(o1, topic_hello, o2, red_guybr_item))
02010     {
02011         dialog << 
02012             ulist( mood_and_string(mood_normal, "Hello, Red.")) <<
02013             ulist( mood_and_string(mood_normal, "Hello, Blue. How are you?")) <<
02014             ulist( mood_and_string(mood_normal, "Fine, thanks Red. Have you heard something new lately?")) <<
02015             ulist(mood_and_string(mood_normal, "Actually, yes. I've heard a treasure was hidden somewhere outside."))<<
02016             ulist(mood_and_string(mood_normal, "That's interesting."));
02017 
02018         define_dialog_aux(dialog, blue_guybr, red_guybr, steps/*mod*/, steps_other /*mod*/);
02019         steps << NEW(scr_cmd_add_to_container(blue_guybr->cache, treasure_heard));
02020 
02021         execute_commands(red_guybr, steps_other);
02022     }
02023 
02024     else if (MATCH_IN_ANY_ORDER(o1, topic_hello, o2, eye))
02025     {
02026         steps << NEW(scr_cmd_quick_message( "Use this topic to greet people."));
02027     }
02028     else if (MATCH_IN_ANY_ORDER(o1, lighter, o2, torch_unlit))
02029     {
02030         if(contains_recursively(act_pl->cache, torch_unlit, real_co/*out*/, pos/*out*/))
02031         {
02032             if (act_pl->loc == shed)
02033             {
02034                 steps << NEW(scr_cmd_remove_from_container(real_co, torch_unlit));
02035                 steps << NEW(scr_cmd_add_to_container_in_pos(real_co, torch_lit, pos));
02036             }
02037             else
02038             {
02039                 speech << mood_and_string(mood_normal, "I don't want to do that inside.");
02040                 steps << NEW(scr_cmd_speak(speech, do_not_close_containers));
02041             }
02042         }
02043         else
02044         {
02045             speech << mood_and_string(mood_normal, "Better to pick up the torch first.");
02046             steps << NEW(scr_cmd_speak(speech, do_not_close_containers));
02047         }
02048     }
02049     else if (MATCH_IN_ANY_ORDER(o1, topic_yes, o2, eye))
02050     {
02051         steps << NEW(scr_cmd_quick_message( "Use this topic to answer \"yes\" to a question."));
02052     }
02053     else if (MATCH_IN_ANY_ORDER(o1, topic_no, o2, eye))
02054     {
02055         steps << NEW(scr_cmd_quick_message( "Use this topic to answer \"no\" to a question."));
02056     }
02057 
02058     else if (MATCH_IN_ANY_ORDER(o1, treasure_heard, o2, red_guybr_item))
02059     {
02060         dialog << 
02061             ulist( mood_and_string(mood_normal, "And... would you care to tell me where this treasure is hidden, you idiot?")) <<
02062             ulist( mood_and_string(mood_normal, "Of course. It is outside, buried in the ground near the big rock.")) <<
02063             ulist( mood_and_string(mood_normal, "I'll go get it. Thanks."));
02064 
02065         define_dialog_aux(dialog, blue_guybr, red_guybr, steps/*mod*/, steps_other /*mod*/);
02066         steps << NEW(scr_cmd_modify_zone(SHOW, treasure_zone));
02067 
02068         steps << NEW(scr_cmd_change_light(true, shed_moon_light, shed)); 
02069         steps << NEW(scr_cmd_light_transition(
02070                          20.0f /* seconds */,
02071                          shed_sun_light,
02072                          shed_moon_light->weight * 3.0f /* start intensity */,
02073                          0.1f /* dest intensity */,
02074                          true /* turn off light at the end */));
02075 
02076         speech << mood_and_string(mood_normal, "I'd better hurry. It's getting dark outside.");
02077         steps << NEW(scr_cmd_speak(speech, do_not_close_containers));
02078 
02079 
02080         execute_commands(red_guybr, steps_other);
02081     }
02082     else
02083     {
02084         speech << mood_and_string(mood_puzzled_scratch_head,
02085                                   "There is something more logical to do at this time.");
02086 
02087         steps << NEW(scr_cmd_speak( speech, do_not_close_containers));
02088         
02089     }
02090     execute_commands(act_pl, steps);
02091 }
02092 
02093 
02094 void
02095 my_game::save(
02096     ofstream & file) const
02097 {
02098     file << first_time_you_turn_on_lamp; 
02099 
02100 }
02101 
02102 void
02103 my_game::load(
02104      ifstream & file)
02105 {
02106     file >> first_time_you_turn_on_lamp;
02107 
02108 }
02109 
02110 
02111 int main(int argc, char ** argv)
02112 {
02113     my_game game(argc, argv);
02114     game.start();
02115 }

Generated on Wed May 25 15:36:07 2005 for FACK by  doxygen 1.4.0