[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src col_map.cxx,1.4,1.5 col_map.hxx,1.3,1
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src col_map.cxx,1.4,1.5 col_map.hxx,1.3,1.4 groundpiece_data.hxx,1.6,1.7 pingu.cxx,1.11,1.12 pingu.hxx,1.4,1.5 pingu_action.cxx,1.3,1.4 smallmap.cxx,1.4,1.5 smallmap_image.cxx,1.2,1.3 spot_map.cxx,1.4,1.5 |
Date: |
25 Jun 2002 18:15:20 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv1377
Modified Files:
col_map.cxx col_map.hxx groundpiece_data.hxx pingu.cxx
pingu.hxx pingu_action.cxx smallmap.cxx smallmap_image.cxx
spot_map.cxx
Log Message:
- final merge of PixelStatus and GroundpieceData::GPType, might need some more
testing
Index: col_map.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/col_map.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- col_map.cxx 25 Jun 2002 17:05:25 -0000 1.4
+++ col_map.cxx 25 Jun 2002 18:15:18 -0000 1.5
@@ -96,7 +96,7 @@
if (x >= 0 && x < width && y >= 0 && y < height) {
return colmap[x+y*width];
} else {
- return OUTOFSCREEN;
+ return GroundpieceData::GP_OUTOFSCREEN;
}
}
@@ -148,8 +148,8 @@
{
if (buffer[(i + (swidth*line)) * 4] != 0)
{
- if (!(colmap[i + (width*(line+y) + x)] & SOLID))
- colmap[i + (width*(line+y) + x)] = NOTHING;
+ if (colmap[i + (width*(line+y) + x)] !=
GroundpieceData::GP_SOLID)
+ colmap[i + (width*(line+y) + x)] =
GroundpieceData::GP_NOTHING;
}
}
}
@@ -175,8 +175,8 @@
{
if (buffer[i + (swidth*line)])
{
- if (!(colmap[i + (width*(line+y) + x)] & SOLID))
- colmap[i + (width*(line+y) + x)] = NOTHING;
+ if (colmap[i + (width*(line+y) + x)] !=
GroundpieceData::GP_SOLID)
+ colmap[i + (width*(line+y) + x)] =
GroundpieceData::GP_NOTHING;
}
}
}
@@ -190,10 +190,10 @@
}
void
-ColMap::put(int x, int y, PixelStatus p)
+ColMap::put(int x, int y, GroundpieceData::GPType p)
{
- if ( x > 0 && x < width
- && y > 0 && y < height)
+ if (x > 0 && x < width
+ && y > 0 && y < height)
{
colmap[x+y*width] = p;
}
@@ -227,7 +227,7 @@
if (gtype == GroundpieceData::GP_BRIDGE)
{
int pixel = getpixel (x, y);
- return pixel == NOTHING;
+ return pixel == GroundpieceData::GP_NOTHING;
}
else
{
@@ -243,26 +243,12 @@
// Puts a surface on the colmap
void
-ColMap::put(CL_SurfaceProvider* provider, int sur_x, int sur_y,
GroundpieceData::GPType gptype)
+ColMap::put(CL_SurfaceProvider* provider, int sur_x, int sur_y,
GroundpieceData::GPType pixel)
{
- if (gptype == GroundpieceData::GP_TRANSPARENT)
+ // transparent groundpieces are only drawn on the gfx map, not on the colmap
+ if (pixel == GroundpieceData::GP_TRANSPARENT)
return;
- PixelStatus pixel;
- switch (gptype)
- {
- case GroundpieceData::GP_GROUND: pixel = WALL; break;
- case GroundpieceData::GP_SOLID: pixel = (PixelStatus)(SOLID); break;
- case GroundpieceData::GP_BRIDGE: pixel = (PixelStatus)(BRIDGE); break;
- case GroundpieceData::GP_WATER: pixel = (PixelStatus)(WATER); break;
- case GroundpieceData::GP_LAVA: pixel = (PixelStatus)(LAVA); break;
- case GroundpieceData::GP_NOTHING: pixel = (PixelStatus)0; break;
- default:
- std::cout << "Colmap::put() Indefinite type" << std::endl;
- pixel = (PixelStatus)0;
- break;
- }
-
if ((sur_x > width) || (sur_y > height))
{
if (verbose > 3)
@@ -285,8 +271,8 @@
provider->get_pixel(x, y, &r, &g, &b, &a);
if (a > 0.1) // Alpha threshold
{
- if (blit_allowed (x + sur_x, y + sur_y, gptype))
- put(x + sur_x, y + sur_y, (PixelStatus) pixel);
+ if (blit_allowed (x + sur_x, y + sur_y, pixel))
+ put(x + sur_x, y + sur_y, pixel);
}
}
}
@@ -311,7 +297,7 @@
{
if (buffer[i + (swidth*line)] != colorkey)
{
- if (blit_allowed (i + sur_x, line + sur_y, gptype))
+ if (blit_allowed (i + sur_x, line + sur_y, pixel))
colmap[i + (width*(line+sur_y) + sur_x)] = pixel;
}
}
@@ -321,7 +307,7 @@
for(int line = y_offset; line < sheight && (line + sur_y) < height;
++line)
for (int i = x_offset; i < swidth && (i+sur_x) < width; ++i)
{
- if (blit_allowed (i + sur_x, line + sur_y, gptype))
+ if (blit_allowed (i + sur_x, line + sur_y, pixel))
colmap[i + (width*(line+sur_y) + sur_x)] = pixel;
}
}
@@ -348,21 +334,21 @@
{
switch(colmap[i])
{
- case ColMap::NOTHING:
+ case GroundpieceData::GP_NOTHING:
buffer[i * 4 + 0] = 0;
buffer[i * 4 + 1] = 0;
buffer[i * 4 + 2] = 0;
buffer[i * 4 + 3] = 0;
break;
- case ColMap::SOLID:
+ case GroundpieceData::GP_SOLID:
buffer[i * 4 + 0] = 255;
buffer[i * 4 + 1] = 100;
buffer[i * 4 + 2] = 100;
buffer[i * 4 + 3] = 100;
break;
- case ColMap::BRIDGE:
+ case GroundpieceData::GP_BRIDGE:
buffer[i * 4 + 0] = 255;
buffer[i * 4 + 1] = 0;
buffer[i * 4 + 2] = 0;
Index: col_map.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/col_map.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- col_map.hxx 25 Jun 2002 17:05:25 -0000 1.3
+++ col_map.hxx 25 Jun 2002 18:15:18 -0000 1.4
@@ -47,23 +47,6 @@
bool init;
public:
- /** Each pixel contains of bit vector...
- (FIXME: difference between PixelStatus and GroundpieceData::GPType?!)
-
- Answer: a GroundpieceData::GPType defines how a pingu behaves
- when hitting the ground type, aposed to that the PixelStatus
- mainly handles how the blitting is handled.
- */
- enum PixelStatus {
- NOTHING = 0,
- WALL = 1<<0,
- OUTOFSCREEN = 1<<1,
- BRIDGE = 1<<2,
- SOLID = 1<<3,
- WATER = 1<<4,
- LAVA = 1<<5
- };
-
/// Default constructor, it does nothing
ColMap();
@@ -94,7 +77,7 @@
/** Return true if the given GroundType i*/
bool blit_allowed (int x, int y, GroundpieceData::GPType);
- void put(int x, int y, PixelStatus p = WALL);
+ void put(int x, int y, GroundpieceData::GPType p =
GroundpieceData::GP_GROUND);
void put(const CL_Surface&, int x, int y, GroundpieceData::GPType);
void put(CL_SurfaceProvider*, int x, int y, GroundpieceData::GPType);
Index: groundpiece_data.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/groundpiece_data.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- groundpiece_data.hxx 25 Jun 2002 12:20:31 -0000 1.6
+++ groundpiece_data.hxx 25 Jun 2002 18:15:18 -0000 1.7
@@ -41,14 +41,17 @@
ResDescriptor desc;
CL_Vector pos;
- enum GPType { GP_SOLID,
- GP_TRANSPARENT,
- GP_GROUND,
- GP_BRIDGE,
- GP_WATER,
- GP_LAVA,
- GP_REMOVE,
- GP_NOTHING } gptype;
+ typedef enum { GP_SOLID,
+ GP_TRANSPARENT,
+ GP_GROUND,
+ GP_BRIDGE,
+ GP_WATER,
+ GP_LAVA,
+ GP_REMOVE,
+ GP_NOTHING,
+ GP_OUTOFSCREEN
+ } GPType;
+ GPType gptype;
/********************/
/* Static Functions */
Index: pingu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pingu.cxx 25 Jun 2002 17:05:25 -0000 1.11
+++ pingu.cxx 25 Jun 2002 18:15:18 -0000 1.12
@@ -41,9 +41,9 @@
countdown_action (0),
id (++id_counter),
font (PingusResource::load_font("Fonts/numbers", "fonts")),
+ owner_id (owner),
environment (ENV_LAND),
status (PS_ALIVE),
- owner_id (owner),
pos (arg_pos)
{
action_time = -1;
@@ -248,7 +248,8 @@
Pingu::update_persistent(float /*delta*/)
{
// set floater action if required
- if (environment == ENV_AIR && action->get_type() != (ActionType)FALL &&
rel_getpixel(0, -1) == ColMap::NOTHING)
+ if (environment == ENV_AIR
+ && action->get_type() != (ActionType)FALL && rel_getpixel(0, -1) ==
GroundpieceData::GP_NOTHING)
{
for (unsigned int i=0; i < persist.size(); ++i)
{
@@ -273,7 +274,7 @@
// FIXME: Out of screen check is ugly
/** The Pingu has hit the edge of the screen, a good time to let him
die. */
- if (rel_getpixel(0, -1) == ColMap::OUTOFSCREEN)
+ if (rel_getpixel(0, -1) == GroundpieceData::GP_OUTOFSCREEN)
{
PingusSound::play_sound("sounds/die.wav");
status = PS_DEAD;
@@ -303,7 +304,7 @@
Pingu::update_action(float /*delta*/)
{
pout(PINGUS_DEBUG_ACTIONS) << "Pingu: No action set, setting action." <<
std::endl;
- if (rel_getpixel(0,-1) == ColMap::NOTHING)
+ if (rel_getpixel(0,-1) == GroundpieceData::GP_NOTHING)
set_action("faller");
else
set_action("walker");
Index: pingu.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pingu.hxx 24 Jun 2002 22:52:55 -0000 1.4
+++ pingu.hxx 25 Jun 2002 18:15:18 -0000 1.5
@@ -76,8 +76,8 @@
// The stat of the pingu, these can be modified by PinguActions
- PinguStatus status;
PinguEnvironment environment;
+ PinguStatus status;
/// The postion of the pingu (CL_Vector::z is always zero)
CL_Vector pos;
Direction direction;
Index: pingu_action.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pingu_action.cxx 21 Jun 2002 07:45:35 -0000 1.3
+++ pingu_action.cxx 25 Jun 2002 18:15:18 -0000 1.4
@@ -78,7 +78,7 @@
{
int pixel = rel_getpixel(x, y + pingu_height);
- if (pixel != ColMap::NOTHING && !(pixel & ColMap::BRIDGE))
+ if (pixel != GroundpieceData::GP_NOTHING && !(pixel &
GroundpieceData::GP_BRIDGE))
return true;
return false;
Index: smallmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- smallmap.cxx 20 Jun 2002 16:48:11 -0000 1.4
+++ smallmap.cxx 25 Jun 2002 18:15:18 -0000 1.5
@@ -77,28 +77,28 @@
current_pixel = buffer[tx + (ty * colmap->get_width())];
- if (current_pixel == ColMap::NOTHING)
+ if (current_pixel == GroundpieceData::GP_NOTHING)
{
cbuffer[4 * ((y * width) + x) + 0] = 150;
cbuffer[4 * ((y * width) + x) + 1] = 0;
cbuffer[4 * ((y * width) + x) + 2] = 0;
cbuffer[4 * ((y * width) + x) + 3] = 0;
}
- else if (current_pixel & ColMap::BRIDGE)
+ else if (current_pixel == GroundpieceData::GP_BRIDGE)
{
cbuffer[4 * ((y * width) + x) + 0] = 255;
cbuffer[4 * ((y * width) + x) + 1] = 100;
cbuffer[4 * ((y * width) + x) + 2] = 255;
cbuffer[4 * ((y * width) + x) + 3] = 0;
}
- else if (current_pixel & ColMap::LAVA)
+ else if (current_pixel == GroundpieceData::GP_LAVA)
{
cbuffer[4 * ((y * width) + x) + 0] = 255;
cbuffer[4 * ((y * width) + x) + 1] = 100;
cbuffer[4 * ((y * width) + x) + 2] = 100;
cbuffer[4 * ((y * width) + x) + 3] = 255;
}
- else if (current_pixel & ColMap::SOLID)
+ else if (current_pixel == GroundpieceData::GP_SOLID)
{
cbuffer[4 * ((y * width) + x) + 0] = 255;
cbuffer[4 * ((y * width) + x) + 1] = 100;
Index: smallmap_image.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap_image.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- smallmap_image.cxx 13 Jun 2002 14:25:12 -0000 1.2
+++ smallmap_image.cxx 25 Jun 2002 18:15:18 -0000 1.3
@@ -80,28 +80,28 @@
current_pixel = buffer[tx + (ty * colmap->get_width())];
- if (current_pixel == ColMap::NOTHING)
+ if (current_pixel == GroundpieceData::GP_NOTHING)
{
cbuffer[4 * ((y * width) + x) + 0] = 150;
cbuffer[4 * ((y * width) + x) + 1] = 0;
cbuffer[4 * ((y * width) + x) + 2] = 0;
cbuffer[4 * ((y * width) + x) + 3] = 0;
}
- else if (current_pixel & ColMap::BRIDGE)
+ else if (current_pixel == GroundpieceData::GP_BRIDGE)
{
cbuffer[4 * ((y * width) + x) + 0] = 255;
cbuffer[4 * ((y * width) + x) + 1] = 100;
cbuffer[4 * ((y * width) + x) + 2] = 255;
cbuffer[4 * ((y * width) + x) + 3] = 0;
}
- else if (current_pixel & ColMap::LAVA)
+ else if (current_pixel == GroundpieceData::GP_LAVA)
{
cbuffer[4 * ((y * width) + x) + 0] = 255;
cbuffer[4 * ((y * width) + x) + 1] = 100;
cbuffer[4 * ((y * width) + x) + 2] = 100;
cbuffer[4 * ((y * width) + x) + 3] = 255;
}
- else if (current_pixel & ColMap::SOLID)
+ else if (current_pixel == GroundpieceData::GP_SOLID)
{
cbuffer[4 * ((y * width) + x) + 0] = 255;
cbuffer[4 * ((y * width) + x) + 1] = 100;
Index: spot_map.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/spot_map.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- spot_map.cxx 20 Jun 2002 16:48:11 -0000 1.4
+++ spot_map.cxx 25 Jun 2002 18:15:18 -0000 1.5
@@ -402,7 +402,7 @@
{
if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
{
- if (!(colmap->getpixel(real_x, real_y) & ColMap::SOLID))
+ if (!(colmap->getpixel(real_x, real_y) ==
GroundpieceData::GP_SOLID))
{
tbuffer[i + 0] = 255;
tbuffer[i + 1] = 255;
@@ -419,7 +419,7 @@
}
else
{
- if (!(colmap->getpixel(real_x, real_y) & ColMap::SOLID))
+ if (!(colmap->getpixel(real_x, real_y) ==
GroundpieceData::GP_SOLID))
{
tbuffer[i + 0] = 0;
}
@@ -512,7 +512,7 @@
}
for(int i=0; i < width * height; ++i)
{
- buffer[i] = 0;
+ buffer[i] = GroundpieceData::GP_NOTHING;
}
if (verbose) std::cout << "done " << timer.stop() << std::endl;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src col_map.cxx,1.4,1.5 col_map.hxx,1.3,1.4 groundpiece_data.hxx,1.6,1.7 pingu.cxx,1.11,1.12 pingu.hxx,1.4,1.5 pingu_action.cxx,1.3,1.4 smallmap.cxx,1.4,1.5 smallmap_image.cxx,1.2,1.3 spot_map.cxx,1.4,1.5,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/actions basher.cxx,1.5,1.6 blocker.cxx,1.1,1.2 bridger.cxx,1.3,1.4 climber.cxx,1.3,1.4 digger.cxx,1.3,1.4 faller.cxx,1.7,1.8 miner.cxx,1.3,1.4 slider.cxx,1.1,1.2 walker.cxx,1.6,1.7
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.9,1.10 editor_event.hxx,1.3,1.4 editor_groundpiece_obj.cxx,1.3,1.4 editor_groundpiece_obj.hxx,1.3,1.4 editorobj.hxx,1.3,1.4
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/actions basher.cxx,1.5,1.6 blocker.cxx,1.1,1.2 bridger.cxx,1.3,1.4 climber.cxx,1.3,1.4 digger.cxx,1.3,1.4 faller.cxx,1.7,1.8 miner.cxx,1.3,1.4 slider.cxx,1.1,1.2 walker.cxx,1.6,1.7
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.9,1.10 editor_event.hxx,1.3,1.4 editor_groundpiece_obj.cxx,1.3,1.4 editor_groundpiece_obj.hxx,1.3,1.4 editorobj.hxx,1.3,1.4
- Index(es):