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

fack.cc File Reference

#include "fack.hpp"
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <SDL/SDL_gfxPrimitives.h>
#include <stdio.h>
#include <algorithm>
#include <assert.h>

Go to the source code of this file.

Namespaces

namespace  path_finding
namespace  text

Functions

string string_of_int (int i)
void raise_exception (string s)
bool point_in_rect (int_pair p, SDL_Rect r)
Uint32 get_raw_pixel_32bitpp (SDL_Surface *s, int x, int y)
 Lock the surface before calling.
void put_raw_pixel_32bitpp (SDL_Surface *s, int x, int y, Uint32 pixel)
int pow (int base, int exp)
 return x elevated to p
template<class S>
set< typename S::key_type > subset (S s, vector< bool > must_be_included)
vector< bool > boolean_representation (int integer)
string string_of_boolRepr (vector< bool > v)
float scaling_of_char (float char_y, const room_scaling_data &d)
bool surf_must_be_printed_before (const pt< anim_frame_and_pos > c1, const pt< anim_frame_and_pos > c2)
bool player_is_closer_to_the_screen (const pt< PC > c1, const pt< PC > c2)
variant< no_item, pt< obj_or_concept > > item_in_room_at_position (int_pair pos, list< pt< PC > > players, const pt< PC > act_pl, const map< pt< PC >, pt< anim_frame > > &cur_frame_of_player)
bool printable_must_be_printed_before (const pt< printable > p1, const pt< printable > p2)
void render_layers_and_chars_in_correct_order (list< pt< printable > > &layers_and_chars_except_bg, cfsurf &bg_surf, SDL_Surface *screen, const room_scaling_data &d, SDL_Rect visible_rect_in_src_surf, set< pt< light > > active_lights)
Uint32 choose_some_video_flags ()
pt< vector2< bool > > walking_map_from_sdl_surface (SDL_Surface *s)
bool is_walkable (const vector2< bool > &walking_map, int x, int y)
list< int_pair_and_cost > neighbours (int_pair node)
float distance (int_pair p1, int_pair p2)
bool compare_frontier_nodes (const frontier_node &f1, const frontier_node &f2)
bool int_pair__equal (int_pair p1, int_pair p2)
string string_of_int_pair (int_pair p)
variant< no_route_found, pt<
list< int_pair > > > 
best_route (int_pair from, int_pair to, const vector2< bool > &walkable)
pt< list< int_pair > > compute_feet_positions (int_pair start_position, const list< int_pair > &route, const room_scaling_data &scaling_data, float walk_step_horiz, float walk_step_vert)
direction compute_dir (int_pair p1, int_pair p2, float walk_step_horiz)
variant< walking_finished,
pair< int_pair, direction > > 
update_walking_animation (float frame_change_interval, pt< AI_substate_walk > state_walk, int_pair player_pos, float walk_step_horiz, float dt, direction cur_dir)
list< SDL_Event > get_sdl_events ()
bool is_alnum (char c)
list< string > tokenize (string t)
int text_wt_in_pixels (string s, const surf_of_letter_t &surf_of_letter)
void print_letter (SDL_Surface *l, SDL_Surface *screen, int_pair dest_pos, rgb col)
int print_line_of_text (string t, int x, int y, const surf_of_letter_t &surf_of_letter, SDL_Surface *screen, bool calc_wt_only, rgb col)
 Returns the width of the text.
void print_x_centered_line_of_text (string t, int x_min, int x_max, int y, const surf_of_letter_t &surf_of_letter, SDL_Surface *screen, rgb col)
int draw_text_multiline_variable_ht (string text, SDL_Surface *surf, int x_left, int y_top, int x_right, const surf_of_letter_t &surf_of_letter, bool calc_ht_only, rgb col)
void draw_verb_dialog (pt< phys_obj > item1, pt< phys_obj > item2, const surf_of_letter_t &surf_of_letter, SDL_Surface *screen, bool calc_rect_only, int_pair mouse, SDL_Rect &cancel_rect, list< pt< dialog_choice > > &choices)
pt< anim_frameupdate_still_anim (pt< PS_still_and_parsing > st, float dt)
void decide_position_for_text (string text, int_pair player_head, int &x_left, int &y_top, int &x_right, const surf_of_letter_t &surf_of_letter, SDL_Surface *screen)
variant< speech_finished,
sentence_with_location
update_speech (AI_substate_speaking_while_standing &state, float dt, const surf_of_letter_t &surf_of_letter, SDL_Surface *screen, pt< anim_frame > &new_frame, rgb text_color, bool time_frozen, const pt< PC > player, const room_scaling_data &scaling_data, int_pair top_left_of_screen_in_bg)
variant< speech_finished,
sentence_with_location
update_speech (AI_substate_speaking_while_sitting &state, float dt, const surf_of_letter_t &surf_of_letter, SDL_Surface *screen, const pt< anim_frame > const_frame, rgb text_color, bool time_frozen, const pt< PC > player, const room_scaling_data &scaling_data, int_pair top_left_of_screen_in_bg)
template<class T>
void list_remove_one (T &l, typename T::value_type el)
result_exec_next_scr_cmd end_commands (pt< PC > pl, int cur_cmd_it, bool must_set_player_left_or_right)
pt< result_is_there_only_one_optionis_there_only_one_option_overall (pt< phys_obj > o1, pt< phys_obj > o2)
void write_string (ostream &o, string s)
string read_string (istream &i)
SDL_Rect create_rect (int x1, int y1, int x2, int y2)


Function Documentation

variant<no_route_found, pt<list<int_pair> > > best_route int_pair  from,
int_pair  to,
const vector2< bool > &  walkable
 

uses the A* algorithm. The returned route never contains the "from" point, and is empty if "from" == "to".

Definition at line 1158 of file fack.cc.

References path_finding::compare_frontier_nodes(), path_finding::frontier_node::cost_g, path_finding::distance(), vector2< T >::fill_with(), foreach, vector2< T >::get(), path_finding::int_pair__equal(), path_finding::neighbours(), NEW, path_finding::frontier_node::position, vector2< T >::set(), setof, setof_, int_pair::x, and int_pair::y.

Referenced by FACK::exec_next_scr_cmd().

vector<bool> boolean_representation int  integer  ) 
 

Definition at line 309 of file fack.cc.

Uint32 choose_some_video_flags  ) 
 

Definition at line 986 of file fack.cc.

References raise_exception().

Referenced by FACK::FACK().

bool compare_frontier_nodes const frontier_node &  f1,
const frontier_node &  f2
 

Definition at line 1135 of file fack.cc.

Referenced by path_finding::best_route().

direction compute_dir int_pair  p1,
int_pair  p2,
float  walk_step_horiz
 

Definition at line 1374 of file fack.cc.

References d_down, d_left, d_right, d_up, int_pair::x, and int_pair::y.

Referenced by FACK::exec_next_scr_cmd(), and update_walking_animation().

pt<list<int_pair> > compute_feet_positions int_pair  start_position,
const list< int_pair > &  route,
const room_scaling_data scaling_data,
float  walk_step_horiz,
float  walk_step_vert
 

Definition at line 1312 of file fack.cc.

References NEW, scaling_of_char(), int_pair::x, and int_pair::y.

Referenced by FACK::exec_next_scr_cmd().

SDL_Rect create_rect int  x1,
int  y1,
int  x2,
int  y2
 

Definition at line 5113 of file fack.cc.

References int_pair::x, and int_pair::y.

Referenced by draw_verb_dialog(), FACK::find_scrolling_rect(), zoomable::item_at_screen_pos(), my_game::my_game(), and FACK::start().

void decide_position_for_text string  text,
int_pair  player_head,
int &  x_left,
int &  y_top,
int &  x_right,
const surf_of_letter_t surf_of_letter,
SDL_Surface *  screen
 

Definition at line 2205 of file fack.cc.

References text::draw_text_multiline_variable_ht(), max(), int_pair::x, and int_pair::y.

Referenced by update_speech().

float distance int_pair  p1,
int_pair  p2
 

Definition at line 1123 of file fack.cc.

References int_pair::x, and int_pair::y.

Referenced by path_finding::best_route().

int draw_text_multiline_variable_ht string  text,
SDL_Surface *  surf,
int  x_left,
int  y_top,
int  x_right,
const surf_of_letter_t surf_of_letter,
bool  calc_ht_only,
rgb  col
 

Definition at line 1660 of file fack.cc.

References foreach, map_get(), text::print_x_centered_line_of_text(), text::text_wt_in_pixels(), and text::tokenize().

Referenced by decide_position_for_text(), draw_verb_dialog(), and FACK::start().

void draw_verb_dialog pt< phys_obj item1,
pt< phys_obj item2,
const surf_of_letter_t surf_of_letter,
SDL_Surface *  screen,
bool  calc_rect_only,
int_pair  mouse,
SDL_Rect &  cancel_rect,
list< pt< dialog_choice > > &  choices
 

Bug:
calc_rect_only is ignored?

Todo:
hardcoded "other" word.

Bug:
calc_rect_only is ignored?
Parameters:
cancel_rect  out
choices  out

Definition at line 1898 of file fack.cc.

References create_rect(), text::draw_text_multiline_variable_ht(), foreach, map_get(), NEW, point_in_rect(), text::print_x_centered_line_of_text(), pt_cast(), ulist(), vector_of(), int_pair::x, and int_pair::y.

Referenced by FACK::start(), and FACK::the_obj_was_clicked().

result_exec_next_scr_cmd end_commands pt< PC pl,
int  cur_cmd_it,
bool  must_set_player_left_or_right
 

Definition at line 2503 of file fack.cc.

References d_left, d_right, map_get(), NEW, and pt_cast().

Referenced by FACK::exec_next_scr_cmd().

Uint32 get_raw_pixel_32bitpp SDL_Surface *  s,
int  x,
int  y
 

Lock the surface before calling.

Definition at line 72 of file fack.cc.

References raise_exception().

list<SDL_Event> get_sdl_events  ) 
 

Definition at line 1473 of file fack.cc.

Referenced by FACK::start().

bool int_pair__equal int_pair  p1,
int_pair  p2
 

Definition at line 1142 of file fack.cc.

References int_pair::x, and int_pair::y.

Referenced by path_finding::best_route().

bool is_alnum char  c  ) 
 

Definition at line 1496 of file fack.cc.

Referenced by text::tokenize().

pt<result_is_there_only_one_option> is_there_only_one_option_overall pt< phys_obj o1,
pt< phys_obj o2
 

Definition at line 3280 of file fack.cc.

References NEW, pt_cast(), ulist(), and vector_of().

Referenced by FACK::the_obj_was_clicked().

bool is_walkable const vector2< bool > &  walking_map,
int  x,
int  y
 

Definition at line 1049 of file fack.cc.

Referenced by FACK::start().

variant<no_item, pt<obj_or_concept> > item_in_room_at_position int_pair  pos,
list< pt< PC > >  players,
const pt< PC act_pl,
const map< pt< PC >, pt< anim_frame > > &  cur_frame_of_player
 

Definition at line 876 of file fack.cc.

References foreach, map_get(), player_is_closer_to_the_screen(), pt_cast(), and scaling_of_char().

Referenced by FACK::render_command_bar(), and FACK::start().

template<class T>
void list_remove_one T &  l,
typename T::value_type  el
 

Definition at line 2482 of file fack.cc.

Referenced by FACK::start(), and FACK::the_obj_was_clicked().

list<int_pair_and_cost> neighbours int_pair  node  ) 
 

Definition at line 1105 of file fack.cc.

References int_pair::x, and int_pair::y.

Referenced by path_finding::best_route().

bool player_is_closer_to_the_screen const pt< PC c1,
const pt< PC c2
 

Definition at line 608 of file fack.cc.

Referenced by item_in_room_at_position().

bool point_in_rect int_pair  p,
SDL_Rect  r
 

Definition at line 63 of file fack.cc.

References int_pair::x, and int_pair::y.

Referenced by draw_verb_dialog(), FACK::drop_item(), zoomable::item_at_screen_pos(), container::item_at_screen_pos(), zoomable_zone::point_in_zone(), FACK::special_button_at_pos(), and FACK::start().

int pow int  base,
int  exp
 

return x elevated to p

Definition at line 273 of file fack.cc.

Referenced by sum_each_pixel().

void print_letter SDL_Surface *  l,
SDL_Surface *  screen,
int_pair  dest_pos,
rgb  col
 

Definition at line 1554 of file fack.cc.

References rgb::b, rgb::g, rgb::r, int_pair::x, and int_pair::y.

Referenced by text::print_line_of_text().

int print_line_of_text string  t,
int  x,
int  y,
const surf_of_letter_t surf_of_letter,
SDL_Surface *  screen,
bool  calc_wt_only,
rgb  col
 

Returns the width of the text.

Definition at line 1603 of file fack.cc.

References map_get(), text::print_letter(), int_pair::x, and int_pair::y.

Referenced by text::print_x_centered_line_of_text().

void print_x_centered_line_of_text string  t,
int  x_min,
int  x_max,
int  y,
const surf_of_letter_t surf_of_letter,
SDL_Surface *  screen,
rgb  col
 

Definition at line 1643 of file fack.cc.

References text::print_line_of_text().

Referenced by text::draw_text_multiline_variable_ht(), draw_verb_dialog(), FACK::render_command_bar(), and FACK::start().

bool printable_must_be_printed_before const pt< printable p1,
const pt< printable p2
 

Definition at line 954 of file fack.cc.

References int_pair::y.

Referenced by render_layers_and_chars_in_correct_order().

void put_raw_pixel_32bitpp SDL_Surface *  s,
int  x,
int  y,
Uint32  pixel
 

Definition at line 97 of file fack.cc.

References raise_exception().

void raise_exception string  s  ) 
 

Definition at line 56 of file fack.cc.

Referenced by choose_some_video_flags(), FACK::exec_next_scr_cmd(), FACK::FACK(), get_raw_pixel_32bitpp(), and put_raw_pixel_32bitpp().

string read_string istream &  i  ) 
 

Definition at line 4612 of file fack.cc.

void render_layers_and_chars_in_correct_order list< pt< printable > > &  layers_and_chars_except_bg,
cfsurf bg_surf,
SDL_Surface *  screen,
const room_scaling_data d,
SDL_Rect  visible_rect_in_src_surf,
set< pt< light > >  active_lights
 

Definition at line 963 of file fack.cc.

References foreach, and printable_must_be_printed_before().

Referenced by FACK::start().

float scaling_of_char float  char_y,
const room_scaling_data d
 

Definition at line 344 of file fack.cc.

Referenced by compute_feet_positions(), item_in_room_at_position(), anim_frame_and_pos::print_with_transparency(), and update_speech().

string string_of_boolRepr vector< bool >  v  ) 
 

Definition at line 326 of file fack.cc.

string string_of_int int  i  ) 
 

Definition at line 48 of file fack.cc.

Referenced by my_game::my_game(), and path_finding::string_of_int_pair().

string string_of_int_pair int_pair  p  ) 
 

Definition at line 1146 of file fack.cc.

References string_of_int(), int_pair::x, and int_pair::y.

template<class S>
set<typename S::key_type> subset s,
vector< bool >  must_be_included
 

Definition at line 288 of file fack.cc.

bool surf_must_be_printed_before const pt< anim_frame_and_pos c1,
const pt< anim_frame_and_pos c2
 

Definition at line 359 of file fack.cc.

int text_wt_in_pixels string  s,
const surf_of_letter_t surf_of_letter
 

Definition at line 1539 of file fack.cc.

References map_get().

Referenced by text::draw_text_multiline_variable_ht().

list<string> tokenize string  t  ) 
 

Definition at line 1504 of file fack.cc.

References text::is_alnum().

Referenced by text::draw_text_multiline_variable_ht().

variant<speech_finished, sentence_with_location> update_speech AI_substate_speaking_while_sitting state,
float  dt,
const surf_of_letter_t surf_of_letter,
SDL_Surface *  screen,
const pt< anim_frame const_frame,
rgb  text_color,
bool  time_frozen,
const pt< PC player,
const room_scaling_data scaling_data,
int_pair  top_left_of_screen_in_bg
 

Definition at line 2404 of file fack.cc.

References decide_position_for_text(), int_pair::x, and int_pair::y.

variant<speech_finished, sentence_with_location> update_speech AI_substate_speaking_while_standing state,
float  dt,
const surf_of_letter_t surf_of_letter,
SDL_Surface *  screen,
pt< anim_frame > &  new_frame,
rgb  text_color,
bool  time_frozen,
const pt< PC player,
const room_scaling_data scaling_data,
int_pair  top_left_of_screen_in_bg
 

Definition at line 2267 of file fack.cc.

References decide_position_for_text(), scaling_of_char(), int_pair::x, and int_pair::y.

Referenced by FACK::update_AI_state().

pt<anim_frame> update_still_anim pt< PS_still_and_parsing st,
float  dt
 

Definition at line 2117 of file fack.cc.

Referenced by FACK::start().

variant<walking_finished, pair<int_pair, direction> > update_walking_animation float  frame_change_interval,
pt< AI_substate_walk state_walk,
int_pair  player_pos,
float  walk_step_horiz,
float  dt,
direction  cur_dir
 

Definition at line 1405 of file fack.cc.

References compute_dir(), CONTACT, hd_left, hd_right, PASSING, and RECOIL.

Referenced by FACK::update_AI_state().

pt<vector2<bool> > walking_map_from_sdl_surface SDL_Surface *  s  ) 
 

Definition at line 1021 of file fack.cc.

References NEW.

Referenced by my_game::my_game().

void write_string ostream &  o,
string  s
 

Definition at line 4603 of file fack.cc.


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