[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.125,1.126 sprite.cxx,1
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.125,1.126 sprite.cxx,1.11,1.12 world.cxx,1.33,1.34 world.hxx,1.19,1.20 |
Date: |
28 Dec 2002 16:10:20 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv31100
Modified Files:
Makefile.am sprite.cxx world.cxx world.hxx
Log Message:
rewrite of particle system
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- Makefile.am 20 Dec 2002 18:45:41 -0000 1.125
+++ Makefile.am 28 Dec 2002 16:10:17 -0000 1.126
@@ -61,8 +61,8 @@
worldobjs/entrances/libpingus_worldobjs_entrances.a \
editorobjs/libpingus_editorobjs.a \
actions/libpingu_actions.a \
- particles/libpingus_particle.a \
editor/libpingus_editor.a \
+ particles/libpingus_particle.a \
worldmap/libpingus_worldmap.a \
gui/libpingus_gui.a \
input/libpingus_input.a \
Index: sprite.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sprite.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- sprite.cxx 26 Nov 2002 21:30:37 -0000 1.11
+++ sprite.cxx 28 Dec 2002 16:10:17 -0000 1.12
@@ -135,12 +135,14 @@
}
}
+
void
Sprite::put_screen (const Vector& pos)
{
put_screen (int(pos.x), int(pos.y));
}
+
void
Sprite::set_align (int arg_x, int arg_y)
{
@@ -162,6 +164,7 @@
y_align = -int(sur.get_height ());
}
+
void
Sprite::next_frame ()
{
@@ -171,6 +174,8 @@
frame = 0;
}
+
+
void
Sprite::previous_frame ()
{
@@ -180,6 +185,7 @@
frame = sur.get_num_frames () - 1;
}
+
int
Sprite::get_frame ()
{
@@ -290,5 +296,3 @@
}
/* EOF */
-
-
Index: world.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/world.cxx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- world.cxx 3 Nov 2002 14:37:20 -0000 1.33
+++ world.cxx 28 Dec 2002 16:10:17 -0000 1.34
@@ -26,7 +26,10 @@
#include "spot_map.hxx"
#include "view.hxx"
#include "world.hxx"
-#include "particles/particle_holder.hxx"
+#include "particles/pingu_particle_holder.hxx"
+#include "particles/rain_particle_holder.hxx"
+#include "particles/smoke_particle_holder.hxx"
+#include "particles/snow_particle_holder.hxx"
#include "pingu.hxx"
#include "game_time.hxx"
@@ -51,21 +54,25 @@
#endif
World::World(PLF* plf)
- : game_time (new GameTime (game_speed)),
- particle_holder (new ParticleHolder()),
- pingus (new PinguHolder(plf)),
- view (0)
+ : gfx_map(new PingusSpotMap(plf)),
+ game_time(new GameTime (game_speed)),
+ do_armageddon(false),
+ pingu_particle_holder(new PinguParticleHolder()),
+ rain_particle_holder(new RainParticleHolder()),
+ smoke_particle_holder(new SmokeParticleHolder()),
+ snow_particle_holder(new SnowParticleHolder()),
+ pingus(new PinguHolder(plf)),
+ colmap(gfx_map->get_colmap()),
+ view(0)
{
// Not perfect, but works
WorldObj::set_world(this);
- do_armageddon = false;
-
- // Create the groundmap
- gfx_map = new PingusSpotMap(plf);
- colmap = gfx_map->get_colmap();
- world_obj.push_back (gfx_map);
-
+ world_obj.push_back(gfx_map);
+ world_obj.push_back(pingu_particle_holder);
+ world_obj.push_back (rain_particle_holder);
+ world_obj.push_back(smoke_particle_holder);
+ world_obj.push_back (snow_particle_holder);
init_worldobjs(plf);
}
@@ -102,8 +109,6 @@
World::~World()
{
- delete particle_holder;
-
for (WorldObjIter it = world_obj.begin(); it != world_obj.end(); ++it) {
delete *it;
}
@@ -134,9 +139,6 @@
{
(*obj)->draw (gc);
}
-
- // FIXME: Shouldn't the particle_holder be a worldobj in the above list?
- particle_holder->draw (gc);
}
void
@@ -183,9 +185,6 @@
// needs to catch pingus.
(*obj)->update();
}
-
- // FIXME: Why is the particle holder still a seperate object?
- particle_holder->update();
}
PinguHolder*
@@ -240,32 +239,26 @@
return action_holder;
}*/
-ParticleHolder*
-World::get_particle_holder()
-{
- return particle_holder;
-}
-
void
World::play_wav (std::string name, const Vector& pos, float volume)
{
if (view)
{
- Vector center = view->get_center ();
+ Vector center = view->get_center();
float panning = pos.x - center.x;
- panning /= view->get_width ()/2;
+ panning /= view->get_width()/2;
if (panning > 1.0f)
- panning = 1.0f;
+ panning = 1.0f;
if (panning < -1.0f)
- panning = -1.0f;
+ panning = -1.0f;
- PingusSound::play_sound (name, volume, panning);
+ PingusSound::play_sound(name, volume, panning);
}
else // No view available, so no stereo enabled
{
- PingusSound::play_sound (name, volume);
+ PingusSound::play_sound(name, volume);
}
}
@@ -284,11 +277,11 @@
for (PinguIter i = pingus->begin (); i != pingus->end (); ++i) {
if ((*i)->is_over(int(pos.x), int(pos.y)))
{
- if (distance == -1.0f || distance >= (*i)->dist((int) pos.x,
(int)pos.y))
- {
- current_pingu = (*i);
- distance = (*i)->dist((int)pos.x, (int)pos.y);
- }
+ if (distance == -1.0f || distance >= (*i)->dist((int) pos.x,
(int)pos.y))
+ {
+ current_pingu = (*i);
+ distance = (*i)->dist((int)pos.x, (int)pos.y);
+ }
}
}
@@ -302,4 +295,3 @@
}
/* EOF */
-
Index: world.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/world.hxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- world.hxx 10 Oct 2002 12:25:53 -0000 1.19
+++ world.hxx 28 Dec 2002 16:10:17 -0000 1.20
@@ -33,7 +33,10 @@
class Hotspot;
class Liquid;
class PLF;
-class ParticleHolder;
+class PinguParticleHolder;
+class RainParticleHolder;
+class SmokeParticleHolder;
+class SnowParticleHolder;
class PinguHolder;
class PinguMap;
class Pingu;
@@ -72,8 +75,11 @@
typedef std::vector<WorldObj*>::iterator WorldObjIter;
// These pointers hold objects and must be deleted
- ParticleHolder* particle_holder;
- PinguHolder* pingus;
+ PinguParticleHolder* pingu_particle_holder;
+ RainParticleHolder* rain_particle_holder;
+ SmokeParticleHolder* smoke_particle_holder;
+ SnowParticleHolder* snow_particle_holder;
+ PinguHolder* pingus;
// Pointers which are references to objects from other classes
ActionHolder* action_holder;
@@ -117,10 +123,19 @@
/** @return A pointer to the gfx map of this world */
PinguMap* get_gfx_map();
- /** @return A pointer to the worlds particle holder */
- ParticleHolder* get_particle_holder();
+ /** @return A pointer to the worlds pingu particle holder */
+ PinguParticleHolder* get_pingu_particle_holder () { return
pingu_particle_holder; }
- /** @return true if the world is currently doing an armageddon */
+ /** @return A pointer to the worlds rain particle holder */
+ RainParticleHolder* get_rain_particle_holder () { return
rain_particle_holder; }
+
+ /** @return A pointer to the worlds smoke particle holder */
+ SmokeParticleHolder* get_smoke_particle_holder () { return
smoke_particle_holder; }
+
+ /** @return A pointer to the worlds snow particle holder */
+ SnowParticleHolder* get_snow_particle_holder () { return
snow_particle_holder; }
+
+ /** @return true if the world is currently doing an armageddon */
bool check_armageddon() { return do_armageddon; }
/** Play a sound as if it would have been generated at the given
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.125,1.126 sprite.cxx,1.11,1.12 world.cxx,1.33,1.34 world.hxx,1.19,1.20,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs/entrances woodthing.cxx,1.3,1.4
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs rain_generator.cxx,1.6,1.7 smasher.cxx,1.14,1.15 snow_generator.cxx,1.4,1.5
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs/entrances woodthing.cxx,1.3,1.4
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs rain_generator.cxx,1.6,1.7 smasher.cxx,1.14,1.15 snow_generator.cxx,1.4,1.5
- Index(es):