[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.7,1.8 angel.hxx,1
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.7,1.8 angel.hxx,1.7,1.8 basher.cxx,1.11,1.12 basher.hxx,1.7,1.8 blocker.cxx,1.5,1.6 boarder.cxx,1.5,1.6 bomber.cxx,1.9,1.10 bridger.cxx,1.11,1.12 climber.cxx,1.7,1.8 digger.cxx,1.9,1.10 drown.cxx,1.4,1.5 exiter.cxx,1.4,1.5 faller.cxx,1.16,1.17 floater.cxx,1.11,1.12 jumper.cxx,1.7,1.8 miner.cxx,1.7,1.8 rocket_launcher.cxx,1.5,1.6 slider.cxx,1.5,1.6 smashed.cxx,1.3,1.4 splashed.cxx,1.4,1.5 superman.cxx,1.3,1.4 waiter.cxx,1.4,1.5 walker.cxx,1.17,1.18 |
Date: |
4 Sep 2002 14:55:14 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv11465/actions
Modified Files:
angel.cxx angel.hxx basher.cxx basher.hxx blocker.cxx
boarder.cxx bomber.cxx bridger.cxx climber.cxx digger.cxx
drown.cxx exiter.cxx faller.cxx floater.cxx jumper.cxx
miner.cxx rocket_launcher.cxx slider.cxx smashed.cxx
splashed.cxx superman.cxx waiter.cxx walker.cxx
Log Message:
- removed traps
- various cleanup
Index: angel.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/angel.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- angel.cxx 25 Aug 2002 09:08:49 -0000 1.7
+++ angel.cxx 4 Sep 2002 14:55:12 -0000 1.8
@@ -30,9 +30,9 @@
}
void
- Angel::init()
+ Angel::init ()
{
- x_pos = pingu->pos.x;
+ x_pos = pingu->get_x();
counter = 0.0;
sprite = Sprite (PingusResource::load_surface
("Pingus/angel" + to_string(pingu->get_owner ()),
@@ -41,23 +41,23 @@
}
void
- Angel::update(float delta)
+ Angel::update (float delta)
{
sprite.update (delta);
counter += delta;
- pingu->pos.x = x_pos + 20 * sin (counter * 3.0);
- pingu->pos.y -= 50.0f * delta;
+ pingu->set_pos(x_pos + 20 * sin (counter * 3.0), pingu->get_y() - 50.0f *
delta);
// Out of screen, let the pingu die
- if (pingu->pos.y < -32)
+ if (pingu->get_y() < -32)
pingu->set_status (PS_DEAD);
}
void
- Angel::draw_offset(int x_of, int y_of, float /*s*/)
+ Angel::draw_offset (int x_of, int y_of, float s)
{
- sprite.put_screen (pingu->get_x () + x_of,
- pingu->get_y () + y_of);
+ sprite.put_screen (static_cast<int>(pingu->get_x () + x_of),
+ static_cast<int>(pingu->get_y () + y_of));
+ UNUSED_ARG(s);
}
}
Index: angel.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/angel.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- angel.hxx 25 Aug 2002 09:08:49 -0000 1.7
+++ angel.hxx 4 Sep 2002 14:55:12 -0000 1.8
@@ -32,13 +32,15 @@
double counter;
double x_pos;
Sprite sprite;
+
public:
Angel ();
- void init();
- std::string get_name() const { return "Angel"; }
- ActionName get_type() const { return Actions::Angel; }
- void update(float delta);
- void draw_offset(int, int, float s);
+ void init ();
+ std::string get_name () const { return "Angel"; }
+ ActionName get_type () const { return Actions::Angel; }
+
+ void update (float delta);
+ void draw_offset (int, int, float s);
private:
Angel (const Angel&);
Index: basher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- basher.cxx 25 Aug 2002 09:08:49 -0000 1.11
+++ basher.cxx 4 Sep 2002 14:55:12 -0000 1.12
@@ -29,14 +29,13 @@
namespace Actions {
- Basher::Basher() : basher_c(0), first_bash(true)
+ Basher::Basher () : basher_c(0), first_bash(true)
{
}
void
- Basher::init(void)
+ Basher::init (void)
{
- first_bash = true;
bash_radius = PingusResource::load_surface ("Other/bash_radius", "pingus");
bash_radius_gfx = PingusResource::load_surface ("Other/bash_radius_gfx",
"pingus");
sprite = Sprite (PingusResource::load_surface ("Pingus/basher0",
"pingus"));
@@ -48,20 +47,20 @@
}
void
- Basher::draw_offset(int x, int y, float s)
+ Basher::draw_offset (int x, int y, float s)
{
- if (pingu->direction.is_left ())
+ if (pingu->direction.is_left())
sprite.set_direction (Sprite::LEFT);
else
sprite.set_direction (Sprite::RIGHT);
- sprite.put_screen (pingu->get_pos () + CL_Vector(x, y));
+ sprite.put_screen(pingu->get_pos() + CL_Vector(x, y));
UNUSED_ARG(s);
}
void
- Basher::update(float delta)
+ Basher::update (float delta)
{
sprite.update (delta);
@@ -87,12 +86,12 @@
void
Basher::bash()
{
- pingu->get_world()->get_colmap()->remove(bash_radius,
- pingu->get_x () -
(bash_radius.get_width()/2),
- pingu->get_y () - 31);
- pingu->get_world()->get_gfx_map()->remove(bash_radius_gfx,
- pingu->get_x () -
(bash_radius_gfx.get_width()/2),
- pingu->get_y () - 31);
+ WorldObj::get_world()->get_colmap()->remove(bash_radius,
+ static_cast<int>(pingu->get_x () -
(bash_radius.get_width()/2)),
+ static_cast<int>(pingu->get_y () -
31));
+ WorldObj::get_world()->get_gfx_map()->remove(bash_radius_gfx,
+ static_cast<int>(pingu->get_x ()
- (bash_radius_gfx.get_width()/2)),
+ static_cast<int>(pingu->get_y ()
- 31));
}
void
@@ -103,7 +102,7 @@
pingu->set_action(Actions::Faller);
} else {
// On ground, walk forward...
- pingu->pos.x += pingu->direction;
+ pingu->set_x(pingu->get_x() + static_cast<int>(pingu->direction));
}
}
Index: basher.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- basher.hxx 25 Aug 2002 09:08:49 -0000 1.7
+++ basher.hxx 4 Sep 2002 14:55:12 -0000 1.8
@@ -33,21 +33,23 @@
CL_Surface bash_radius_gfx;
int basher_c;
bool first_bash;
+
+ /// Defines "wall" height needed so as to determine whether it should be
bashed.
+ enum { bash_height = 4 };
+
public:
- Basher();
- virtual ~Basher() {}
-
+ Basher ();
void init (void);
+
std::string get_name () const { return "Basher"; }
- ActionName get_type() const { return Actions::Basher; }
- void draw_offset(int x, int y, float s);
- void update(float delta);
- bool have_something_to_dig();
- void walk_forward();
- void bash();
-
- /// Defines "wall" height needed so as to determine whether it should be
bashed.
- enum { bash_height = 4 };
+ ActionName get_type () const { return Actions::Basher; }
+
+ void draw_offset (int x, int y, float s);
+ void update (float delta);
+
+ bool have_something_to_dig ();
+ void walk_forward ();
+ void bash ();
private:
Basher (const Basher&);
Index: blocker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/blocker.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- blocker.cxx 25 Aug 2002 09:08:49 -0000 1.5
+++ blocker.cxx 4 Sep 2002 14:55:12 -0000 1.6
@@ -43,14 +43,13 @@
if (rel_getpixel(0,-1) == GroundpieceData::GP_NOTHING
&& rel_getpixel(0, -2) == GroundpieceData::GP_GROUND)
{
- ++pingu->pos.x;
+ pingu->set_x(pingu->get_x() + 1);
}
else if (rel_getpixel(0,-1) == GroundpieceData::GP_NOTHING
&& rel_getpixel(0, -2) == GroundpieceData::GP_NOTHING
&& rel_getpixel(0,-3) == GroundpieceData::GP_GROUND)
{
- ++pingu->pos.y;
- ++pingu->pos.y;
+ pingu->set_y(pingu->get_y() + 2);
}
}
@@ -68,7 +67,7 @@
void
Blocker::draw_offset(int x, int y, float s)
{
- sprite.put_screen (pingu->pos + CL_Vector(x, y));
+ sprite.put_screen(pingu->get_pos() + CL_Vector(x, y));
UNUSED_ARG(s);
}
Index: boarder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/boarder.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- boarder.cxx 25 Aug 2002 09:08:49 -0000 1.5
+++ boarder.cxx 4 Sep 2002 14:55:12 -0000 1.6
@@ -17,6 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Core/Math/cl_vector.h>
#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "../string_converter.hxx"
@@ -31,7 +32,7 @@
void
Boarder::init()
{
- x_pos = pingu->pos.x;
+ x_pos = pingu->get_x();
speed = 0.0;
sprite = Sprite (PingusResource::load_surface
("Pingus/boarder" + to_string(pingu->get_owner ()),
@@ -57,16 +58,16 @@
}
// Incremental update so that we don't skip pixels
- double new_x_pos = pingu->pos.x + pingu->direction * speed;
- while (int(new_x_pos) != int(pingu->pos.x))
+ double new_x_pos = pingu->get_pos().x + pingu->direction * speed;
+ while (new_x_pos != pingu->get_x())
{
- double old_pos = pingu->pos.x;
- pingu->pos.x += (int(pingu->pos.x) < int(new_x_pos)) ? 1 : -1;
+ double old_pos = pingu->get_pos().x;
+ pingu->set_x(old_pos + (pingu->get_x() < new_x_pos) ? 1 : -1);
if (pingu->rel_getpixel (1, 0))
{
// Hit a wall
- pingu->pos.x = old_pos;// + (pingu->direction * 10);
+ pingu->set_x(old_pos); // + (pingu->direction * 10);
////pingu->pos.y = 10;
pingu->apply_force (CL_Vector(speed * pingu->direction * 0.5,
@@ -86,8 +87,8 @@
void
Boarder::draw_offset(int x_of, int y_of, float s)
{
- sprite.put_screen (pingu->get_x () + x_of,
- pingu->get_y () + y_of);
+ sprite.put_screen (static_cast<int>(pingu->get_x () + x_of),
+ static_cast<int>(pingu->get_y () + y_of));
UNUSED_ARG(s);
}
Index: bomber.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bomber.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- bomber.cxx 25 Aug 2002 09:08:49 -0000 1.9
+++ bomber.cxx 4 Sep 2002 14:55:12 -0000 1.10
@@ -46,11 +46,11 @@
void
Bomber::on_successfull_apply (Pingu* pingu)
{
- pingu->get_world ()->play_wav("sounds/ohno.wav", pingu->get_pos ());
+ WorldObj::get_world()->play_wav("sounds/ohno.wav", pingu->get_pos ());
}
void
- Bomber::init()
+ Bomber::init ()
{
// Only load the surface again if no static_surface is available
if (!static_surface_loaded)
@@ -69,24 +69,27 @@
}
void
- Bomber::draw_offset(int x, int y, float /*s*/)
+ Bomber::draw_offset (int x, int y, float s)
{
if (sprite.get_frame () >= 13 && !gfx_exploded)
{
- explo_surf.put_screen(pingu->get_x () - 32 + x, pingu->get_y () - 48 +
y);
+ explo_surf.put_screen(static_cast<int>(pingu->get_x () - 32 + x),
+ static_cast<int>(pingu->get_y () - 48 + y));
gfx_exploded = true;
}
- sprite.put_screen(pingu->get_x () + x, pingu->get_y () + y);
+ sprite.put_screen(static_cast<int>(pingu->get_x () + x, pingu->get_y () +
y));
+
+ UNUSED_ARG(s);
}
void
- Bomber::update(float delta)
+ Bomber::update (float delta)
{
sprite.update (delta);
if (sprite.get_frame () > 9 && !sound_played) {
- pingu->get_world ()->play_wav("sounds/plop.wav", pingu->get_pos ());
+ WorldObj::get_world()->play_wav("sounds/plop.wav", pingu->get_pos ());
sound_played = true;
}
@@ -94,7 +97,8 @@
if (sprite.get_frame () > 12 && !particle_thrown)
{
particle_thrown = true;
-
pingu->get_world()->get_particle_holder()->add_pingu_explo(pingu->get_x (),
pingu->get_y () - 5);
+
WorldObj::get_world()->get_particle_holder()->add_pingu_explo(static_cast<int>(pingu->get_x()),
+
static_cast<int>(pingu->get_y()) - 5);
}
@@ -102,12 +106,12 @@
{
colmap_exploded = true;
- pingu->get_world()->get_colmap()->remove(bomber_radius,
- pingu->get_x () -
(bomber_radius.get_width()/2),
- pingu->get_y () - 16 -
(bomber_radius.get_width()/2));
- pingu->get_world()->get_gfx_map()->remove(bomber_radius_gfx,
- pingu->get_x () -
(bomber_radius.get_width()/2),
- pingu->get_y () - 16 -
(bomber_radius.get_width()/2));
+ WorldObj::get_world()->get_colmap()->remove(bomber_radius,
+ static_cast<int>(pingu->get_x
() - (bomber_radius.get_width()/2)),
+ static_cast<int>(pingu->get_y
() - 16 - (bomber_radius.get_width()/2)));
+ WorldObj::get_world()->get_gfx_map()->remove(bomber_radius_gfx,
+ static_cast<int>(pingu->get_x
() - (bomber_radius.get_width()/2)),
+ static_cast<int>(pingu->get_y
() - 16 - (bomber_radius.get_width()/2)));
// Add an explosion to the forces list
ForcesHolder::add_force(ExplosionForce(5,30,CL_Vector(pingu->get_x (),
@@ -126,11 +130,10 @@
Bomber::update_position(float delta)
{
// Apply all forces
- pingu->velocity = ForcesHolder::apply_forces(pingu->pos, pingu->velocity);
- // FIXME:
- pingu->pos += pingu->velocity;
+ pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(),
pingu->get_velocity()));
+ pingu->set_pos(pingu->get_pos() + pingu->get_velocity());
- if(delta);
+ UNUSED_ARG(delta);
}
}
Index: bridger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bridger.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- bridger.cxx 25 Aug 2002 09:08:49 -0000 1.11
+++ bridger.cxx 4 Sep 2002 14:55:12 -0000 1.12
@@ -37,16 +37,16 @@
CL_Surface Bridger::brick_r;
CL_Surface Bridger::static_surface;
- Bridger::Bridger() : mode(B_BUILDING),
- bricks(MAX_BRICKS),
- block_build(false),
- name("Bridger (" + to_string(bricks) + ")")
+ Bridger::Bridger () : mode(B_BUILDING),
+ bricks(MAX_BRICKS),
+ block_build(false),
+ name("Bridger (" + to_string(bricks) + ")")
{
}
void
- Bridger::init(void)
+ Bridger::init (void)
{
if (!static_surfaces_loaded)
{
@@ -62,11 +62,11 @@
build_sprite.set_align_center_bottom ();
walk_sprite.set_align_center_bottom ();
- last_pos = pingu->pos;
+ last_pos = pingu->get_pos();
}
void
- Bridger::draw_offset(int x, int y, float s)
+ Bridger::draw_offset (int x, int y, float s)
{
int x_offset(6), y_offset(4);
@@ -91,8 +91,8 @@
else
build_sprite.set_direction (Sprite::RIGHT);
- build_sprite.put_screen(pingu->get_x () + x - (x_offset *
pingu->direction),
- pingu->get_y () + y + y_offset);
+ build_sprite.put_screen(static_cast<int>(pingu->get_x () + x -
(x_offset * pingu->direction)),
+ static_cast<int>(pingu->get_y () + y +
y_offset));
break;
case B_WALKING:
@@ -101,8 +101,8 @@
else
walk_sprite.set_direction (Sprite::RIGHT);
- walk_sprite.put_screen(pingu->get_x () + x - (x_offset *
pingu->direction),
- pingu->get_y () + y + y_offset);
+ walk_sprite.put_screen(static_cast<int>(pingu->get_x () + x -
(x_offset * pingu->direction)),
+ static_cast<int>(pingu->get_y () + y +
y_offset));
break;
}
@@ -123,7 +123,7 @@
break;
}
- last_pos = pingu->pos;
+ last_pos = pingu->get_pos();
}
void
@@ -142,7 +142,7 @@
{
pingu->direction.change ();
pingu->set_action (Actions::Walker);
- pingu->pos = last_pos;
+ pingu->set_pos(last_pos);
return;
}
}
@@ -197,30 +197,30 @@
if (pingu->direction.is_right())
{
- pingu->get_world()->get_colmap()->put(brick_r,
- pingu->get_x () + 10 -
brick_r.get_width(),
- pingu->get_y (),
+ WorldObj::get_world()->get_colmap()->put(brick_r,
+ static_cast<int>(pingu->get_x() +
10 - brick_r.get_width()),
+ static_cast<int>(pingu->get_y()),
GroundpieceData::GP_BRIDGE);
- pingu->get_world()->get_gfx_map()->put(brick_r,
- (int) pingu->get_x () + 10 -
brick_r.get_width(),
- pingu->get_y ());
+ WorldObj::get_world()->get_gfx_map()->put(brick_r,
+ static_cast<int>(pingu->get_x()
+ 10 - brick_r.get_width()),
+
static_cast<int>(pingu->get_y()));
}
else
{
- pingu->get_world()->get_colmap()->put(brick_r, pingu->get_x () - 10,
- pingu->get_y (),
- GroundpieceData::GP_BRIDGE);
- pingu->get_world()->get_gfx_map()->put(brick_l,
- pingu->get_x () - 10,
- pingu->get_y ());
+ WorldObj::get_world()->get_colmap()->put(brick_r,
+
static_cast<int>(pingu->get_x() - 10),
+
static_cast<int>(pingu->get_y()),
+ GroundpieceData::GP_BRIDGE);
+ WorldObj::get_world()->get_gfx_map()->put(brick_l,
+
static_cast<int>(pingu->get_x() - 10),
+
static_cast<int>(pingu->get_y()));
}
}
void
Bridger::walk_one_step_up()
{
- pingu->pos.x += 4.0 * pingu->direction;
- pingu->pos.y -= 2.0;
+ pingu->set_pos(pingu->get_x() + 4.0 * pingu->direction, pingu->get_y() -
2);
counter = 0;
}
Index: climber.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/climber.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- climber.cxx 25 Aug 2002 09:08:49 -0000 1.7
+++ climber.cxx 4 Sep 2002 14:55:12 -0000 1.8
@@ -65,7 +65,7 @@
// and there is still ground to walk on
if (rel_getpixel(1, 1) != GroundpieceData::GP_NOTHING)
{
- --pingu->pos.y;
+ pingu->set_pos(pingu->get_y() - 1);
return;
}
else if (rel_getpixel(1, 1) == GroundpieceData::GP_NOTHING)
@@ -76,8 +76,7 @@
if (!head_collision_on_walk(pingu->direction, 1))
{
// Get ready to walk
- --pingu->pos.y;
- pingu->pos.x += pingu->direction;
+ pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y()
- 1);
}
else
{
@@ -100,7 +99,7 @@
void
Climber::draw_offset(int x, int y, float s)
{
- sprite.put_screen (pingu->get_pos () + CL_Vector (x, y));
+ sprite.put_screen (pingu->get_pos() + CL_Vector (x, y));
UNUSED_ARG(s);
}
Index: digger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/digger.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- digger.cxx 25 Aug 2002 09:08:49 -0000 1.9
+++ digger.cxx 4 Sep 2002 14:55:12 -0000 1.10
@@ -30,12 +30,12 @@
namespace Actions {
- Digger::Digger() : digger_c(0)
+ Digger::Digger () : digger_c(0)
{
}
void
- Digger::init(void)
+ Digger::init (void)
{
digger_radius = PingusResource::load_surface ("Other/digger_radius",
"pingus");
digger_radius_gfx = PingusResource::load_surface
("Other/digger_radius_gfx", "pingus");
@@ -50,7 +50,7 @@
}
void
- Digger::update(float delta)
+ Digger::update (float delta)
{
sprite.update (delta);
@@ -68,7 +68,7 @@
}
bool
- Digger::have_something_to_dig()
+ Digger::have_something_to_dig ()
{
if (rel_getpixel(0, -1) != GroundpieceData::GP_NOTHING)
{
@@ -87,19 +87,23 @@
}
void
- Digger::dig()
+ Digger::dig ()
{
- pingu->get_world()->get_colmap()->remove(digger_radius, pingu->get_x () -
16, pingu->get_y() - 14);
- pingu->get_world()->get_gfx_map()->remove(digger_radius_gfx, pingu->get_x
() - 16, pingu->get_y() - 14);
+ WorldObj::get_world()->get_colmap()->remove(digger_radius,
+ static_cast<int>(pingu->get_x
() - 16),
+ static_cast<int>(pingu->get_y()
- 14));
+ WorldObj::get_world()->get_gfx_map()->remove(digger_radius_gfx,
+ static_cast<int>(pingu->get_x
() - 16),
+
static_cast<int>(pingu->get_y() - 14));
- ++pingu->pos.y;
+ pingu->set_y(pingu->get_y() + 1);
}
void
- Digger::draw_offset(int x, int y, float /*s*/)
+ Digger::draw_offset (int x, int y, float s)
{
- //std::cout << "DRawing digger" << std::endl;
- sprite.put_screen (int(pingu->pos.x + x), int(pingu->pos.y + y));
+ sprite.put_screen (static_cast<int>(pingu->get_x() + x),
static_cast<int>(pingu->get_y() + y));
+ UNUSED_ARG(s);
}
}
Index: drown.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/drown.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- drown.cxx 25 Aug 2002 09:08:49 -0000 1.4
+++ drown.cxx 4 Sep 2002 14:55:12 -0000 1.5
@@ -17,41 +17,43 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Core/Math/cl_vector.h>
#include "../pingu.hxx"
#include "drown.hxx"
namespace Actions {
void
- Drown::init()
+ Drown::init ()
{
//if (pingu->environment == ENV_AIR)
- sprite = Sprite ("Pingus/drownfall0", "pingus", 60.0f,
- Sprite::NONE, Sprite::ONCE);
+ sprite = Sprite("Pingus/drownfall0", "pingus", 60.0f,
+ Sprite::NONE, Sprite::ONCE);
//else
//sprite = Sprite ("Pingus/drownwalk0", "pingus", 30.0f,
// Sprite::NONE, Sprite::ONCE);
- sprite.set_align_center_bottom ();
+ sprite.set_align_center_bottom();
}
void
- Drown::draw_offset(int x, int y, float /*s*/)
+ Drown::draw_offset (int x, int y, float s)
{
// FIXME: Direction handling is ugly
- if (pingu->direction.is_left ())
- sprite.set_direction (Sprite::LEFT);
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
else
- sprite.set_direction (Sprite::RIGHT);
+ sprite.set_direction(Sprite::RIGHT);
- sprite.put_screen (pingu->pos + CL_Vector(x, y));
+ sprite.put_screen(pingu->get_pos() + CL_Vector(x, y));
+ UNUSED_ARG(s);
}
void
- Drown::update(float delta)
+ Drown::update (float delta)
{
- sprite.update (delta);
- if (sprite.finished ())
+ sprite.update(delta);
+ if (sprite.finished())
{
pingu->set_status(PS_DEAD);
}
Index: exiter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/exiter.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- exiter.cxx 25 Aug 2002 09:08:49 -0000 1.4
+++ exiter.cxx 4 Sep 2002 14:55:12 -0000 1.5
@@ -17,6 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Core/Math/cl_vector.h>
#include "../pingu.hxx"
#include "../sound.hxx"
#include "exiter.hxx"
@@ -24,18 +25,18 @@
namespace Actions {
void
- Exiter::init(void)
+ Exiter::init (void)
{
- sprite = Sprite ("Pingus/exit0", "pingus", 10.0f, Sprite::NONE,
Sprite::ONCE);
- sprite.set_align_center_bottom ();
+ sprite = Sprite("Pingus/exit0", "pingus", 10.0f, Sprite::NONE,
Sprite::ONCE);
+ sprite.set_align_center_bottom();
}
void
- Exiter::update(float delta)
+ Exiter::update (float delta)
{
- sprite.update (delta);
+ sprite.update(delta);
- if (sprite.finished ())
+ if (sprite.finished())
{
if (pingu->get_status() != PS_EXITED)
{
@@ -46,14 +47,16 @@
}
void
- Exiter::draw_offset(int x, int y, float /*s*/)
+ Exiter::draw_offset(int x, int y, float s)
{
- if (pingu->direction.is_left ())
- sprite.set_direction (Sprite::LEFT);
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
else
- sprite.set_direction (Sprite::RIGHT);
-
- sprite.put_screen (pingu->pos + CL_Vector (x, y));
+ sprite.set_direction(Sprite::RIGHT);
+
+ sprite.put_screen(pingu->get_pos() + CL_Vector (x, y));
+
+ UNUSED_ARG(s);
}
}
Index: faller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- faller.cxx 25 Aug 2002 09:08:49 -0000 1.16
+++ faller.cxx 4 Sep 2002 14:55:12 -0000 1.17
@@ -62,13 +62,13 @@
// FIXME: This should be triggered at a later point, when close to
// FIXME: deadly_velocity or something like that
- if (pingu->velocity.y > 5.0 && pingu->request_fall_action())
+ if (pingu->get_velocity().y > 5.0 && pingu->request_fall_action())
return;
// Apply all forces
- pingu->velocity = ForcesHolder::apply_forces(pingu->pos, pingu->velocity);
+ pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(),
pingu->get_velocity()));
- CL_Vector newp = pingu->velocity;
+ CL_Vector newp = pingu->get_velocity();
CL_Vector last_pos;
// Update x and y by moving the penguin to it's target *slowly*
@@ -76,7 +76,7 @@
while(rel_getpixel(0, 0) == GroundpieceData::GP_NOTHING
&& (fabs(newp.x) >= 1 || fabs(newp.y) >= 1))
{
- last_pos = pingu->pos;
+ last_pos = pingu->get_pos();
if (fabs(newp.x) >= 1)
{
@@ -84,12 +84,12 @@
// fraction stop when we are within 1 unit of the target
if (newp.x > 0)
{
- pingu->pos.x++;
+ pingu->set_x(pingu->get_x() + 1);
newp.x--;
}
else
{
- pingu->pos.x--;
+ pingu->set_x(pingu->get_x() - 1);
newp.x++;
}
}
@@ -98,12 +98,12 @@
{
if (newp.y > 0)
{
- pingu->pos.y++;
+ pingu->set_x(pingu->get_y() + 1);
newp.y--;
}
else
{
- pingu->pos.y--;
+ pingu->set_x(pingu->get_y() - 1);
newp.y++;
}
}
@@ -127,21 +127,19 @@
else
{
// Did we stop too fast?
- if (fabs(pingu->velocity.y) > deadly_velocity)
+ if (fabs(pingu->get_velocity().y) > deadly_velocity)
{
pingu->set_action(Actions::Splashed);
return;
}
- else if (fabs(pingu->velocity.x) > deadly_velocity)
+ else if (fabs(pingu->get_velocity().x) > deadly_velocity)
{
pout(PINGUS_DEBUG_ACTIONS) << "Pingu: x Smashed on ground,
jumping" << std::endl;
}
}
// Reset the velocity
- pingu->velocity.x = -(pingu->velocity.x/3);
- pingu->velocity.y = 0;
-
- pingu->pos = last_pos;
+ pingu->set_velocity(CL_Vector(-(pingu->get_velocity().x/3), 0));
+ pingu->set_pos(last_pos);
// FIXME: UGLY!
//pingu->set_action (Walker);
@@ -149,21 +147,23 @@
}
void
- Faller::draw_offset(int x, int y, float /*s*/)
+ Faller::draw_offset (int x, int y, float s)
{
- if (is_tumbling ()) {
- tumbler.put_screen (int(pingu->pos.x + x), int(pingu->pos.y + y));
+ if (is_tumbling()) {
+ tumbler.put_screen(static_cast<int>(pingu->get_x() + x),
static_cast<int>(pingu->get_y() + y));
} else {
- faller.put_screen (int(pingu->pos.x + x), int(pingu->pos.y + y));
+ faller.put_screen (static_cast<int>(pingu->get_x() + x),
static_cast<int>(pingu->get_y() + y));
}
+
+ UNUSED_ARG(s);
}
bool
Faller::is_tumbling () const
{
// If we are going fast enough to get smashed, start tumbling
- if (fabs(pingu->velocity.x) > deadly_velocity
- || fabs(pingu->velocity.y) > deadly_velocity)
+ if ( fabs(pingu->get_velocity().x) > deadly_velocity
+ || fabs(pingu->get_velocity().y) > deadly_velocity)
{
return true;
}
Index: floater.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/floater.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- floater.cxx 25 Aug 2002 09:08:49 -0000 1.11
+++ floater.cxx 4 Sep 2002 14:55:12 -0000 1.12
@@ -41,11 +41,11 @@
{
sprite.update (delta);
- pingu->velocity = CL_Vector(0.0, 0.0);
+ pingu->set_velocity(CL_Vector(0.0, 0.0));
if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING) {
++step;
if (step > 0) {
- ++(pingu->pos.y);
+ pingu->set_y(pingu->get_y() + 1);
step = 0;
}
} else {
@@ -56,7 +56,7 @@
void
Floater::draw_offset (int x, int y, float s)
{
- sprite.put_screen (pingu->pos + CL_Vector (x, y));
+ sprite.put_screen(pingu->get_pos() + CL_Vector (x, y));
UNUSED_ARG(s);
}
Index: jumper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/jumper.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- jumper.cxx 25 Aug 2002 09:08:49 -0000 1.7
+++ jumper.cxx 4 Sep 2002 14:55:12 -0000 1.8
@@ -17,26 +17,27 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Core/Math/cl_vector.h>
#include "../pingu.hxx"
#include "../string_converter.hxx"
#include "jumper.hxx"
namespace Actions {
- Jumper::Jumper()
+ Jumper::Jumper ()
{
// do nothing
}
void
- Jumper::init(void)
+ Jumper::init ()
{
sprite = Sprite("Pingus/jumper" + to_string(pingu->get_owner ()),
"pingus");
}
void
- Jumper::draw_offset(int x, int y, float s)
+ Jumper::draw_offset (int x, int y, float s)
{
// FIXME: Huh! Does this work?!
sprite.put_screen (x, y);
@@ -44,16 +45,19 @@
}
void
- Jumper::update(float delta)
+ Jumper::update (float delta)
{
+ //FIXME CL_Vector
+ CL_Vector temp(pingu->get_velocity());
+
if (pingu->direction.is_right()) {
- pingu->velocity += CL_Vector(10.0, -10.0);
+ pingu->set_velocity(temp + CL_Vector(10.0, -10.0));
} else {
- pingu->velocity += CL_Vector(-10.0, -10.0);
+ pingu->set_velocity(temp + CL_Vector(-10.0, -10.0));
}
// Move the pingu in the air, so that it can start 'falling'
- pingu->pos.y -= 1;
+ pingu->set_y(pingu->get_y() - 1);
pingu->set_action (Actions::Faller);
UNUSED_ARG(delta);
Index: miner.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/miner.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- miner.cxx 25 Aug 2002 09:08:49 -0000 1.7
+++ miner.cxx 4 Sep 2002 14:55:12 -0000 1.8
@@ -57,43 +57,44 @@
{
if (slow_count % 3 == 0)
{
-
pingu->get_world()->get_colmap()->remove(miner_radius.get_provider(),
- pingu->get_x () - 16 +
pingu->direction,
- pingu->get_y () - 31);
-
pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx.get_provider(),
- pingu->get_x () - 16 +
pingu->direction,
- pingu->get_y () - 31);
+
WorldObj::get_world()->get_colmap()->remove(miner_radius.get_provider(),
+
static_cast<int>(pingu->get_x() - 16 + pingu->direction),
+
static_cast<int>(pingu->get_y() - 31));
+
WorldObj::get_world()->get_gfx_map()->remove(miner_radius_gfx.get_provider(),
+
static_cast<int>(pingu->get_x() - 16 + pingu->direction),
+
static_cast<int>(pingu->get_y() - 31));
}
- pingu->pos.x += pingu->direction;
- pingu->pos.y += 1;
+ pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() + 1);
}
if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING)
{
- pingu->get_world()->get_colmap()->remove(miner_radius,
- pingu->get_x () - 16 +
pingu->direction,
- pingu->get_y () - 29);
- pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx,
- pingu->get_x () - 16 +
pingu->direction,
- pingu->get_y () - 29);
+ WorldObj::get_world()->get_colmap()->remove(miner_radius,
+
static_cast<int>(pingu->get_x() - 16 + pingu->direction),
+
static_cast<int>(pingu->get_y () - 29));
+ WorldObj::get_world()->get_gfx_map()->remove(miner_radius_gfx,
+
static_cast<int>(pingu->get_x() - 16 + pingu->direction),
+
static_cast<int>(pingu->get_y() - 29));
pingu->set_action(Actions::Walker);
}
else if (rel_getpixel(0, -1) == GroundpieceData::GP_SOLID)
{
PingusSound::play_sound("sounds/chink.wav");
- pingu->get_world()->get_colmap()->remove(miner_radius, pingu->get_x ()
- 16 + pingu->direction,
- pingu->get_y () - 31);
- pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx,
pingu->get_x () - 16 + pingu->direction,
- pingu->get_y () - 31);
+ WorldObj::get_world()->get_colmap ()->remove(miner_radius,
+
static_cast<int>(pingu->get_x() - 16 + pingu->direction),
+
static_cast<int>(pingu->get_y() - 31));
+ WorldObj::get_world()->get_gfx_map()->remove(miner_radius_gfx,
+
static_cast<int>(pingu->get_x() - 16 + pingu->direction),
+
static_cast<int>(pingu->get_y() - 31));
pingu->set_action(Actions::Walker);
}
}
void
- Miner::draw_offset(int x, int y, float s)
+ Miner::draw_offset (int x, int y, float s)
{
- sprite.put_screen (pingu->get_pos () + CL_Vector(x, y));
+ sprite.put_screen(pingu->get_pos() + CL_Vector(x, y));
UNUSED_ARG(s);
}
Index: rocket_launcher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/rocket_launcher.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- rocket_launcher.cxx 25 Aug 2002 09:08:49 -0000 1.5
+++ rocket_launcher.cxx 4 Sep 2002 14:55:12 -0000 1.6
@@ -23,44 +23,47 @@
#include "../string_converter.hxx"
#include "../pingus_resource.hxx"
#include "../pingu.hxx"
+#include "../worldobj.hxx"
#include "rocket_launcher.hxx"
namespace Actions {
void
- RocketLauncher::init()
+ RocketLauncher::init ()
{
sprite = Sprite (PingusResource::load_surface
("Pingus/rocketlauncher" + to_string(pingu->get_owner ()),
"pingus"), 10.0f, Sprite::NONE, Sprite::ONCE);
- sprite.set_align_center_bottom ();
+ sprite.set_align_center_bottom();
launched = false;
- pingu->get_world ()->get_particle_holder()->add_particle
- (new ExplosiveParticle ((int) pingu->pos.x, (int)pingu->pos.y - 12,
+ WorldObj::get_world()->get_particle_holder()->add_particle
+ (new ExplosiveParticle (static_cast<int>(pingu->get_x()),
+ static_cast<int>(pingu->get_y()) - 12,
pingu->direction.is_left() ? -400.0f : 400.0f,
0.0f));
}
void
- RocketLauncher::update(float delta)
+ RocketLauncher::update (float delta)
{
- if (sprite.finished ())
+ if (sprite.finished())
{
pingu->set_action(Actions::Walker);
}
- sprite.update (delta);
+ sprite.update(delta);
}
void
- RocketLauncher::draw_offset(int x, int y, float s)
+ RocketLauncher::draw_offset (int x, int y, float s)
{
- if (pingu->direction.is_left ())
- sprite.set_direction (Sprite::LEFT);
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
else
- sprite.set_direction (Sprite::RIGHT);
- sprite.put_screen (pingu->pos + CL_Vector (x, y));
+ sprite.set_direction(Sprite::RIGHT);
+
+ sprite.put_screen(pingu->get_pos() + CL_Vector(x, y));
UNUSED_ARG(s);
}
Index: slider.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/slider.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- slider.cxx 25 Aug 2002 09:08:49 -0000 1.5
+++ slider.cxx 4 Sep 2002 14:55:12 -0000 1.6
@@ -29,7 +29,7 @@
}
void
- Slider::init(void)
+ Slider::init (void)
{
sprite = Sprite("Pingus/slider" + to_string(pingu->get_owner ()),
"pingus");
@@ -38,27 +38,29 @@
}
void
- Slider::update(float delta)
+ Slider::update (float delta)
{
- if (pingu->direction.is_left ())
- sprite.set_direction (Sprite::LEFT);
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
else
- sprite.set_direction (Sprite::RIGHT);
+ sprite.set_direction(Sprite::RIGHT);
sprite.update (delta);
for (int i = 0; i < speed; ++i)
{
- pingu->pos.x += pingu->direction;
+ pingu->set_x(pingu->get_x() + pingu->direction);
if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING)
{
- speed = (speed > 5 ? 5 : speed);
+ speed = (speed > 5) ? 5 : speed;
+ //FIXME CL_Vector
+ CL_Vector temp(pingu->get_velocity());
if (pingu->direction.is_right()) {
- pingu->velocity += CL_Vector(speed, 0.0);
+ pingu->set_velocity(temp + CL_Vector(speed, 0.0));
} else {
- pingu->velocity += CL_Vector(-speed, 0.0);
+ pingu->set_velocity(temp + CL_Vector(-speed, 0.0));
}
pingu->set_action(Actions::Walker);
@@ -71,9 +73,9 @@
}
void
- Slider::draw_offset(int x, int y, float s)
+ Slider::draw_offset (int x, int y, float s)
{
- sprite.put_screen (pingu->pos + CL_Vector(x, y - 2));
+ sprite.put_screen(pingu->get_pos() + CL_Vector(x, y - 2));
UNUSED_ARG(s);
}
Index: smashed.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/smashed.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- smashed.cxx 25 Aug 2002 09:08:49 -0000 1.3
+++ smashed.cxx 4 Sep 2002 14:55:12 -0000 1.4
@@ -23,14 +23,14 @@
namespace Actions {
void
- Smashed::init(void)
+ Smashed::init (void)
{
sprite = Sprite ("Pingus/bomber0", "pingus");
sound_played = false;
}
void
- Smashed::draw_offset(int x, int y, float /*s*/)
+ Smashed::draw_offset (int x, int y, float /*s*/)
{
sprite.put_screen (x, y);
}
Index: splashed.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/splashed.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- splashed.cxx 25 Aug 2002 09:08:49 -0000 1.4
+++ splashed.cxx 4 Sep 2002 14:55:12 -0000 1.5
@@ -17,50 +17,53 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Core/Math/cl_vector.h>
#include "../world.hxx"
#include "../pingu.hxx"
#include "../sound.hxx"
+#include "../worldobj.hxx"
#include "splashed.hxx"
namespace Actions {
- Splashed::Splashed(void)
+ Splashed::Splashed (void)
{
}
void
- Splashed::init(void)
+ Splashed::init (void)
{
- sprite = Sprite ("Pingus/splat0", "pingus", 30.0f,
- Sprite::NONE, Sprite::ONCE);
- sprite.set_align_center_bottom ();
+ sprite = Sprite("Pingus/splat0", "pingus", 30.0f,
+ Sprite::NONE, Sprite::ONCE);
+ sprite.set_align_center_bottom();
- sound_played = false;
+ sound_played = false;
particle_thrown = false;
}
void
- Splashed::update(float delta)
+ Splashed::update (float delta)
{
sprite.update (delta);
if (!particle_thrown)
{
particle_thrown = true;
- pingu->get_world ()->play_wav("sounds/splash.wav", pingu->get_pos ());
+ WorldObj::get_world()->play_wav("sounds/splash.wav", pingu->get_pos());
}
- if (sprite.finished ())
+ if (sprite.finished())
{
pingu->set_status(PS_DEAD);
}
}
void
- Splashed::draw_offset(int x_of, int y_of, float /*s*/)
+ Splashed::draw_offset (int x_of, int y_of, float s)
{
- sprite.put_screen (pingu->get_x () + x_of,
- pingu->get_y () + y_of);
+ sprite.put_screen (static_cast<int>(pingu->get_x() + x_of),
+ static_cast<int>(pingu->get_y() + y_of));
+ UNUSED_ARG(s);
}
}
Index: superman.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/superman.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- superman.cxx 25 Aug 2002 09:08:49 -0000 1.3
+++ superman.cxx 4 Sep 2002 14:55:12 -0000 1.4
@@ -29,35 +29,33 @@
}
void
- Superman::init()
+ Superman::init ()
{
- x_pos = pingu->pos.x;
+ x_pos = pingu->get_x();
counter = 0.0;
sprite = Sprite (PingusResource::load_surface
("Pingus/superman" + to_string(pingu->get_owner ()),
"pingus"));
- sprite.set_align_center_bottom ();
+ sprite.set_align_center_bottom();
}
void
- Superman::update(float delta)
+ Superman::update (float delta)
{
- sprite.update (delta);
+ sprite.update(delta);
counter += delta;
- pingu->pos.x += 40.0f * delta;
- pingu->pos.y -= 200.0f * delta;
+ pingu->set_pos(pingu->get_x() + 40.0f * delta, pingu->get_y() - 200.0f *
delta);
- if (pingu->pos.y < -32)
- {
- pingu->set_status (PS_DEAD);
- }
+ if (pingu->get_y() < -32)
+ pingu->set_status(PS_DEAD);
}
void
- Superman::draw_offset(int x_of, int y_of, float /*s*/)
+ Superman::draw_offset (int x_of, int y_of, float s)
{
- sprite.put_screen (pingu->get_x () + x_of,
- pingu->get_y () + y_of);
+ sprite.put_screen (static_cast<int>(pingu->get_x () + x_of),
+ static_cast<int>(pingu->get_y () + y_of));
+ UNUSED_ARG(s);
}
}
Index: waiter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/waiter.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- waiter.cxx 25 Aug 2002 09:08:49 -0000 1.4
+++ waiter.cxx 4 Sep 2002 14:55:12 -0000 1.5
@@ -17,20 +17,21 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Core/Math/cl_vector.h>
#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "waiter.hxx"
namespace Actions {
- Waiter::Waiter()
+ Waiter::Waiter ()
{
}
void
- Waiter::update(float delta)
+ Waiter::update (float delta)
{
- sprite.update (delta);
+ sprite.update(delta);
if (countdown < 0)
pingu->set_action(Actions::Walker);
@@ -39,17 +40,17 @@
}
void
- Waiter::init()
+ Waiter::init ()
{
- sprite = PingusResource::load_surface ("Pingus/blocker0", "pingus");
- sprite.set_align_center_bottom ();
+ sprite = PingusResource::load_surface("Pingus/blocker0", "pingus");
+ sprite.set_align_center_bottom();
countdown = 2.0;
}
void
- Waiter::draw_offset(int x, int y, float s)
+ Waiter::draw_offset (int x, int y, float s)
{
- sprite.put_screen (pingu->get_pos () + CL_Vector(x, y));
+ sprite.put_screen(pingu->get_pos() + CL_Vector(x, y));
UNUSED_ARG(s);
}
Index: walker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/walker.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- walker.cxx 25 Aug 2002 09:08:49 -0000 1.17
+++ walker.cxx 4 Sep 2002 14:55:12 -0000 1.18
@@ -27,22 +27,22 @@
namespace Actions {
void
- Walker::init(void)
+ Walker::init (void)
{
- walker = Sprite ("Pingus/walker" + to_string(pingu->get_owner ()),
"pingus");
- walker.set_align_center_bottom ();
+ walker = Sprite("Pingus/walker" + to_string(pingu->get_owner ()),
"pingus");
+ walker.set_align_center_bottom();
// Reset the velocity
- pingu->velocity = CL_Vector ();
+ pingu->set_velocity(CL_Vector());
}
void
- Walker::update(float delta)
+ Walker::update (float delta)
{
// update the sprite
- walker.update (delta);
+ walker.update(delta);
- CL_Vector last_pos = pingu->pos;
+ CL_Vector last_pos = pingu->get_pos();
/* How should this code work?
@@ -62,7 +62,7 @@
if (rel_getpixel(0, -1) == GroundpieceData::GP_WATER)
{
- pingu->set_action (Actions::Drown);
+ pingu->set_action(Actions::Drown);
return;
}
@@ -85,11 +85,11 @@
if (found_ground)
{
- pingu->pos.y -= i;
+ pingu->set_y(pingu->get_y() - i);
}
else
{
- pingu->set_action (Actions::Faller);
+ pingu->set_action(Actions::Faller);
return;
}
}
@@ -101,8 +101,7 @@
{
// simple, stupid, but working bridge code
// FIXME: We don't check if we 'drift' into a solid ground block
- pingu->pos.x += pingu->direction;
- pingu->pos.y -= 1; // pingus 'float' through bridges
+ pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() - 1);
// pingus 'float' through bridges
}
else
{
@@ -120,11 +119,11 @@
int y_inc = 0;
int possible_y_step = 0;
bool found_next_step = false;
- for(y_inc=-max_steps; y_inc <= max_steps; y_inc++)
+ for (y_inc = -max_steps; y_inc <= max_steps; ++y_inc)
{// up/down-hill scan
- if ((rel_getpixel(1, y_inc) == GroundpieceData::GP_NOTHING
- || rel_getpixel(1, y_inc) == GroundpieceData::GP_BRIDGE) //
FIXME: This causes a rather huge step
- && rel_getpixel(1, y_inc - 1) != GroundpieceData::GP_NOTHING)
+ if (( rel_getpixel(1, y_inc) == GroundpieceData::GP_NOTHING
+ || rel_getpixel(1, y_inc) == GroundpieceData::GP_BRIDGE)
// FIXME: This causes a rather huge step
+ && rel_getpixel(1, y_inc - 1) != GroundpieceData::GP_NOTHING)
{ // FIXME:
found_next_step = true;
possible_y_step = y_inc;
@@ -135,8 +134,8 @@
if (found_next_step)
{
- pingu->pos.x += pingu->direction;
- pingu->pos.y -= possible_y_step; // pos.y has a reversed co-system
to rel_getpixel()?
+ // pos.y has a reversed co-system to rel_getpixel()?
+ pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() -
possible_y_step);
}
else
{
@@ -156,9 +155,9 @@
else
{
// We take the step, so that we are in the air
- pingu->pos.x += pingu->direction;
+ pingu->set_x(pingu->get_x() + pingu->direction);
// We reached a cliff
- pingu->set_action (Actions::Faller);
+ pingu->set_action(Actions::Faller);
return;
}
}
@@ -175,7 +174,7 @@
//if the new position causes a head collision, we are already
//stuck in a wall, so lets go back to the old position
pingu->direction.change();
- pingu->pos = last_pos;
+ pingu->set_pos(last_pos);
return;
}
@@ -197,14 +196,16 @@
}
void
- Walker::draw_offset(int x, int y, float /*s*/)
+ Walker::draw_offset (int x, int y, float s)
{
- if (pingu->direction.is_left ())
- walker.set_direction (Sprite::LEFT);
+ if (pingu->direction.is_left())
+ walker.set_direction(Sprite::LEFT);
else
- walker.set_direction (Sprite::RIGHT);
+ walker.set_direction(Sprite::RIGHT);
- walker.put_screen (pingu->pos + CL_Vector (x, y));
+ walker.put_screen(pingu->get_pos() + CL_Vector (x, y));
+
+ UNUSED_ARG(s);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.7,1.8 angel.hxx,1.7,1.8 basher.cxx,1.11,1.12 basher.hxx,1.7,1.8 blocker.cxx,1.5,1.6 boarder.cxx,1.5,1.6 bomber.cxx,1.9,1.10 bridger.cxx,1.11,1.12 climber.cxx,1.7,1.8 digger.cxx,1.9,1.10 drown.cxx,1.4,1.5 exiter.cxx,1.4,1.5 faller.cxx,1.16,1.17 floater.cxx,1.11,1.12 jumper.cxx,1.7,1.8 miner.cxx,1.7,1.8 rocket_launcher.cxx,1.5,1.6 slider.cxx,1.5,1.6 smashed.cxx,1.3,1.4 splashed.cxx,1.4,1.5 superman.cxx,1.3,1.4 waiter.cxx,1.4,1.5 walker.cxx,1.17,1.18,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,NONE,1.1 bumper_data.hxx,NONE,1.1 fake_exit_data.cxx,NONE,1.1 fake_exit_data.hxx,NONE,1.1 guillotine_data.cxx,NONE,1.1 guillotine_data.hxx,NONE,1.1 hammer_data.cxx,NONE,1.1 hammer_data.hxx,NONE,1.1 laser_exit_data.cxx,NONE,1.1 laser_exit_data.hxx,NONE,1.1 smasher_data.cxx,NONE,1.1 smasher_data.hxx,NONE,1.1 spike_data.cxx,NONE,1.1 spike_data.hxx,NONE,1.1
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,NONE,1.1 bumper.hxx,NONE,1.1 fake_exit.cxx,NONE,1.1 fake_exit.hxx,NONE,1.1 guillotine.cxx,NONE,1.1 guillotine.hxx,NONE,1.1 hammer.cxx,NONE,1.1 hammer.hxx,NONE,1.1 laser_exit.cxx,NONE,1.1 laser_exit.hxx,NONE,1.1 smasher.cxx,NONE,1.1 smasher.hxx,NONE,1.1 spike.cxx,NONE,1.1 spike.hxx,NONE,1.1 Makefile.am,1.6,1.7 conveyor_belt.cxx,1.7,1.8 ice_block.cxx,1.8,1.9 switch_door.cxx,1.7,1.8 teleporter.cxx,1.5,1.6
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,NONE,1.1 bumper_data.hxx,NONE,1.1 fake_exit_data.cxx,NONE,1.1 fake_exit_data.hxx,NONE,1.1 guillotine_data.cxx,NONE,1.1 guillotine_data.hxx,NONE,1.1 hammer_data.cxx,NONE,1.1 hammer_data.hxx,NONE,1.1 laser_exit_data.cxx,NONE,1.1 laser_exit_data.hxx,NONE,1.1 smasher_data.cxx,NONE,1.1 smasher_data.hxx,NONE,1.1 spike_data.cxx,NONE,1.1 spike_data.hxx,NONE,1.1
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,NONE,1.1 bumper.hxx,NONE,1.1 fake_exit.cxx,NONE,1.1 fake_exit.hxx,NONE,1.1 guillotine.cxx,NONE,1.1 guillotine.hxx,NONE,1.1 hammer.cxx,NONE,1.1 hammer.hxx,NONE,1.1 laser_exit.cxx,NONE,1.1 laser_exit.hxx,NONE,1.1 smasher.cxx,NONE,1.1 smasher.hxx,NONE,1.1 spike.cxx,NONE,1.1 spike.hxx,NONE,1.1 Makefile.am,1.6,1.7 conveyor_belt.cxx,1.7,1.8 ice_block.cxx,1.8,1.9 switch_door.cxx,1.7,1.8 teleporter.cxx,1.5,1.6
- Index(es):