[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs starfield_background.cxx,1
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs starfield_background.cxx,1.5,1.6 starfield_background_stars.cxx,1.7,1.8 starfield_background_stars.hxx,1.5,1.6 |
Date: |
17 Jun 2003 14:09:22 -0000 |
Update of /var/lib/cvs/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv5583/worldobjs
Modified Files:
starfield_background.cxx starfield_background_stars.cxx
starfield_background_stars.hxx
Log Message:
a bunch of very small code cleanups
Index: starfield_background.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/worldobjs/starfield_background.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- starfield_background.cxx 19 Apr 2003 10:23:19 -0000 1.5
+++ starfield_background.cxx 17 Jun 2003 14:09:20 -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 <iostream>
#include "../worldobjsdata/starfield_background_data.hxx"
#include "starfield_background.hxx"
#include "starfield_background_stars.hxx"
@@ -26,7 +27,6 @@
StarfieldBackground::StarfieldBackground (const
WorldObjsData::StarfieldBackgroundData& data_)
: data(new WorldObjsData::StarfieldBackgroundData(data_))
{
-
int i;
for (i=0; i < data->small_stars_count; ++i)
Index: starfield_background_stars.cxx
===================================================================
RCS file:
/var/lib/cvs/Games/Pingus/src/worldobjs/starfield_background_stars.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- starfield_background_stars.cxx 19 Apr 2003 10:23:19 -0000 1.7
+++ starfield_background_stars.cxx 17 Jun 2003 14:09:20 -0000 1.8
@@ -24,57 +24,38 @@
namespace WorldObjs {
-CL_Surface StarfieldBackgroundStars::small_star;
-CL_Surface StarfieldBackgroundStars::middle_star;
-CL_Surface StarfieldBackgroundStars::large_star;
-bool StarfieldBackgroundStars::is_init(false);
-
StarfieldBackgroundStars::StarfieldBackgroundStars (Type type)
{
- init ();
-
switch (type)
{
case SMALL_STAR:
- sur = small_star;
+ sur = PingusResource::load_surface("Stars/small_star" , "game");
break;
case MIDDLE_STAR:
- sur = middle_star;
+ sur = PingusResource::load_surface("Stars/middle_star", "game");
break;
case LARGE_STAR:
- sur = large_star;
+ sur = PingusResource::load_surface("Stars/large_star" , "game");
break;
}
- x_pos = rand() % world->get_width();
- y_pos = rand() % world->get_height();
+ x_pos = rand() % WorldObj::get_world()->get_width();
+ y_pos = rand() % WorldObj::get_world()->get_height();
x_add = rand() % 5 + 1.0f;
y_add = 0.0f;
}
void
-StarfieldBackgroundStars::init ()
-{
- if (!is_init)
- {
- small_star = PingusResource::load_surface("Stars/small_star" , "game");
- middle_star = PingusResource::load_surface("Stars/middle_star", "game");
- large_star = PingusResource::load_surface("Stars/large_star" , "game");
- is_init = true;
- }
-}
-
-void
StarfieldBackgroundStars::update ()
{
x_pos += x_add;
y_pos += y_add;
- if (x_pos > world->get_width())
+ if (x_pos > WorldObj::get_world()->get_width())
{
x_pos = -32;
- y_pos = rand() % world->get_height();
+ y_pos = rand() % WorldObj::get_world()->get_height();
}
}
Index: starfield_background_stars.hxx
===================================================================
RCS file:
/var/lib/cvs/Games/Pingus/src/worldobjs/starfield_background_stars.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- starfield_background_stars.hxx 19 Apr 2003 10:23:19 -0000 1.5
+++ starfield_background_stars.hxx 17 Jun 2003 14:09:20 -0000 1.6
@@ -25,14 +25,9 @@
namespace WorldObjs {
-class StarfieldBackgroundStars : public WorldObj
+class StarfieldBackgroundStars
{
private:
- static CL_Surface small_star;
- static CL_Surface middle_star;
- static CL_Surface large_star;
- static bool is_init;
-
CL_Surface sur;
float x_pos;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjs starfield_background.cxx,1.5,1.6 starfield_background_stars.cxx,1.7,1.8 starfield_background_stars.hxx,1.5,1.6,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.58,1.59 editor_view.cxx,1.8,1.9
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata starfield_background_data.cxx,1.10,1.11
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.58,1.59 editor_view.cxx,1.8,1.9
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata starfield_background_data.cxx,1.10,1.11
- Index(es):