~ubuntu-branches/ubuntu/natty/plee-the-bear/natty

« back to all changes in this revision

Viewing changes to bear-engine/core/src/universe/code/physical_item_state.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge, Julien Jorge
  • Date: 2010-11-17 20:13:34 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101117201334-o4dp7uq437to7oxb
Tags: 0.5.1-1
[ Julien Jorge ]
* New upstream release (Closes: #565062, #546514).
* Add armhf architecture (Closes: #604689).
* Remove patches integrated upstream: rpath-editors.diff, rpath-game.diff,
  editors-menu-section.diff.
* Bump the Standard-Version, no changes.
* Update my email address.
* Set build dependency of libclaw to 1.6.0.
* Add the missing ${misc:Depends} in debian/control.
* List gettext translations in bear-factory.install and plee-the-bear.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
  Bear Engine
3
3
 
4
 
  Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
 
4
  Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
5
5
 
6
6
  This program is free software; you can redistribute it and/or modify it
7
7
  under the terms of the GNU General Public License as published by the
52
52
bear::universe::physical_item_state::physical_item_state
53
53
( const physical_item_state& that )
54
54
  : physical_item_attributes(that), m_fixed(false), m_x_fixed(that.m_x_fixed),
55
 
    m_y_fixed(that.m_y_fixed), m_global(false)
 
55
    m_y_fixed(that.m_y_fixed), m_global(that.m_global)
56
56
{
57
57
 
58
58
} // physical_item_state::physical_item_state()
97
97
 
98
98
/*----------------------------------------------------------------------------*/
99
99
/**
 
100
 * \brief Set the bouding box of this item.
 
101
 * \param r the new bounding box of the item.
 
102
 */
 
103
void bear::universe::physical_item_state::set_bounding_box
 
104
( const bear::universe::rectangle_type& r )
 
105
{
 
106
  set_bottom_left(r.bottom_left());
 
107
  set_size( r.size() );
 
108
} // physical_item_state::set_bounding_box()
 
109
 
 
110
/*----------------------------------------------------------------------------*/
 
111
/**
100
112
 * \brief Get the bouding box of this item.
101
113
 */
102
114
bear::universe::rectangle_type
280
292
 
281
293
/*----------------------------------------------------------------------------*/
282
294
/**
 
295
 * \brief Get the current angular speed of the item.
 
296
 */
 
297
double bear::universe::physical_item_state::get_angular_speed() const
 
298
{
 
299
  return m_angular_speed;
 
300
} // physical_item_state::get_angular_speed()
 
301
 
 
302
/*----------------------------------------------------------------------------*/
 
303
/**
 
304
 * \brief Set the current angular speed of the item.
 
305
 */
 
306
void bear::universe::physical_item_state::set_angular_speed( double speed )
 
307
{
 
308
  m_angular_speed = speed;
 
309
} // physical_item_state::set_angular_speed()
 
310
 
 
311
/*----------------------------------------------------------------------------*/
 
312
/**
283
313
 * \brief Get the friction applied to this item.
284
314
 */
285
315
double bear::universe::physical_item_state::get_friction() const
696
726
/*----------------------------------------------------------------------------*/
697
727
/**
698
728
 * \brief Set (force) the position of the center of the item.
 
729
 * \param pos The new center of mass.
699
730
 */
700
731
void bear::universe::physical_item_state::set_center_of_mass
701
732
( const position_type& pos )
705
736
 
706
737
/*----------------------------------------------------------------------------*/
707
738
/**
 
739
 * \brief Set (force) the position of the center of the item.
 
740
 * \param x The new x_coordinate of the center of mass.
 
741
 * \param y The new y-coordinate of the center of mass.
 
742
 */
 
743
void bear::universe::physical_item_state::set_center_of_mass
 
744
( const coordinate_type& x, const coordinate_type& y )
 
745
{
 
746
  set_center_of_mass( position_type(x,y) );
 
747
} // physical_item_state::set_center_of_mass()
 
748
 
 
749
/*----------------------------------------------------------------------------*/
 
750
/**
708
751
 * \brief Tell if the item is fixed.
709
752
 */
710
753
bool bear::universe::physical_item_state::is_fixed() const
897
940
/*----------------------------------------------------------------------------*/
898
941
/**
899
942
 * \brief Tell that the item has a contact on its left.
 
943
 * \param contact The new contact status.
900
944
 */
901
 
void bear::universe::physical_item_state::set_left_contact()
 
945
void bear::universe::physical_item_state::set_left_contact(bool contact)
902
946
{
903
 
  m_left_contact = true;
 
947
  m_left_contact = contact;
904
948
} // physical_item_state::set_left_contact()
905
949
 
906
950
/*----------------------------------------------------------------------------*/
907
951
/**
908
952
 * \brief Tell that the item has a contact on its right.
 
953
 * \param contact The new contact status.
909
954
 */
910
 
void bear::universe::physical_item_state::set_right_contact()
 
955
void bear::universe::physical_item_state::set_right_contact(bool contact)
911
956
{
912
 
  m_right_contact = true;
 
957
  m_right_contact = contact;
913
958
} // physical_item_state::set_right_contact()
914
959
 
915
960
/*----------------------------------------------------------------------------*/
916
961
/**
917
962
 * \brief Tell that the item has a contact on its top.
 
963
 * \param contact The new contact status.
918
964
 */
919
 
void bear::universe::physical_item_state::set_top_contact()
 
965
void bear::universe::physical_item_state::set_top_contact(bool contact)
920
966
{
921
 
  m_top_contact = true;
 
967
  m_top_contact = contact;
922
968
} // physical_item_state::set_top_contact()
923
969
 
924
970
/*----------------------------------------------------------------------------*/
925
971
/**
926
972
 * \brief Tell that the item has a contact on its bottom.
 
973
 * \param contact The new contact status.
927
974
 */
928
 
void bear::universe::physical_item_state::set_bottom_contact()
 
975
void bear::universe::physical_item_state::set_bottom_contact(bool contact)
929
976
{
930
 
  m_bottom_contact = true;
 
977
  m_bottom_contact = contact;
931
978
} // physical_item_state::set_bottom_contact()
932
979
 
933
980
/*----------------------------------------------------------------------------*/
934
981
/**
935
982
 * \brief Tell that the item has a contact in middle zone.
 
983
 * \param contact The new contact status.
936
984
 */
937
 
void bear::universe::physical_item_state::set_middle_contact()
 
985
void bear::universe::physical_item_state::set_middle_contact(bool contact)
938
986
{
939
 
  m_middle_contact = true;
 
987
  m_middle_contact = contact;
940
988
} // physical_item_state::set_middle_contact()
941
989
 
942
990
/*----------------------------------------------------------------------------*/
991
1039
 
992
1040
/*----------------------------------------------------------------------------*/
993
1041
/**
 
1042
 * \brief Indicate if the item is considered for weak or strong collisions.
 
1043
 * \param w The new status.
 
1044
 */
 
1045
void bear::universe::physical_item_state::set_weak_collisions( bool w )
 
1046
{
 
1047
  m_weak_collisions = w;
 
1048
} // physical_item_state::set_weak_collisions()
 
1049
 
 
1050
/*----------------------------------------------------------------------------*/
 
1051
/**
 
1052
 * \brief Tell if the item has to be considered as weak collisions.
 
1053
 * \param w The new status.
 
1054
 */
 
1055
bool bear::universe::physical_item_state::has_weak_collisions() const
 
1056
{
 
1057
  return m_weak_collisions;
 
1058
} // physical_item_state::has_weak_collisions()
 
1059
 
 
1060
/*----------------------------------------------------------------------------*/
 
1061
/**
994
1062
 * \brief Set the size of the object.
995
1063
 * \param size The new size.
996
1064
 */
1018
1086
 */
1019
1087
void bear::universe::physical_item_state::set_width( size_type width )
1020
1088
{
1021
 
  m_size.x = width;
 
1089
  if (!m_fixed && (m_x_fixed == 0))
 
1090
    m_size.x = width;
1022
1091
} // physical_item_state::set_width()
1023
1092
 
1024
1093
/*----------------------------------------------------------------------------*/
1028
1097
 */
1029
1098
void bear::universe::physical_item_state::set_height( size_type height )
1030
1099
{
1031
 
  m_size.y = height;
 
1100
  if (!m_fixed && (m_y_fixed == 0))
 
1101
    m_size.y = height;
1032
1102
} // physical_item_state::set_height()
1033
1103
 
1034
1104
/*----------------------------------------------------------------------------*/
1073
1143
  oss << "\ndensity: " << m_density;
1074
1144
  oss << "\nangle: " << m_system_angle;
1075
1145
  oss << "\nfixed: " << m_fixed << ' ' << m_x_fixed << ' ' << m_y_fixed;
1076
 
  oss << "\ncan move items: " << m_can_move_items;
 
1146
  oss << "\nphantom/c.m.i./art.: " << m_is_phantom << ' ' << m_can_move_items
 
1147
      << ' ' << m_is_artificial;
1077
1148
  oss << "\ncontact after collision: " << m_contact_after_collision;
1078
1149
  oss << "\ncontact: { ";
1079
1150