[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src blitter.cxx,1.7,1.8 path_manager.cxx,
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src blitter.cxx,1.7,1.8 path_manager.cxx,1.1,1.2 pingu.cxx,1.7,1.8 pingus_resource.cxx,1.7,1.8 sound_dummy.cxx,1.2,1.3 sound_real.cxx,1.2,1.3 wav_provider.cxx,1.1,1.2 |
Date: |
23 Jun 2002 19:16:44 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv15884
Modified Files:
blitter.cxx path_manager.cxx pingu.cxx pingus_resource.cxx
sound_dummy.cxx sound_real.cxx wav_provider.cxx
Log Message:
changed debug statements to use Pingus debug streams
Index: blitter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/blitter.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- blitter.cxx 23 Jun 2002 14:15:47 -0000 1.7
+++ blitter.cxx 23 Jun 2002 19:16:41 -0000 1.8
@@ -27,6 +27,7 @@
#include "globals.hxx"
#include "math.hxx"
#include "blitter.hxx"
+#include "debug.hxx"
/* Headers needed for i18n / gettext */
#include <clocale>
@@ -178,16 +179,11 @@
assert (canvas);
assert (provider);
- if (pingus_debug_flags & PINGUS_DEBUG_BLITTER)
- {
- std::cout << "Blitting: SurfaceProvider:" << provider->get_width () <<
"x" << provider->get_height ()
- << ":" << provider
- << " Canvas:" << canvas->get_width () << "x"
- << canvas->get_height () << ":" << canvas << std::endl;
- }
+ pout(PINGUS_DEBUG_BLITTER) << "Blitting: SurfaceProvider:" <<
provider->get_width ()
+ << "x" << provider->get_height () << ":" <<
provider
+ << " Canvas:" << canvas->get_width () << "x"
+ << canvas->get_height () << ":" << canvas <<
std::endl;
- //std::cout << "Blitter::put_surface_32bit() --- not implemented" <<
std::endl;
- //return;
float red, green, blue, alpha;
float tred, tgreen, tblue, talpha;
Index: path_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/path_manager.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- path_manager.cxx 12 Jun 2002 19:06:12 -0000 1.1
+++ path_manager.cxx 23 Jun 2002 19:16:41 -0000 1.2
@@ -21,6 +21,7 @@
#include "globals.hxx"
#include "system.hxx"
#include "path_manager.hxx"
+#include "debug.hxx"
PathManager path_manager;
@@ -43,8 +44,7 @@
PathManager::complete (std::string relative_path)
{
std::string comp_path = base_path + "/" + relative_path;
- if (pingus_debug_flags & PINGUS_DEBUG_LOADING)
- std::cout << "PathManager: " << relative_path << " -> " << comp_path <<
std::endl;
+ pout(PINGUS_DEBUG_LOADING) << "PathManager: " << relative_path << " -> " <<
comp_path << std::endl;
return comp_path;
}
@@ -65,15 +65,13 @@
path_found = true;
base_path = *i;
- if (pingus_debug_flags & PINGUS_DEBUG_LOADING)
- std::cout << "PathManager: Using base_path: " << base_path <<
std::endl;
+ pout(PINGUS_DEBUG_LOADING) << "PathManager: Using base_path: " <<
base_path << std::endl;
return true;
}
}
- if (pingus_debug_flags & PINGUS_DEBUG_LOADING)
- std::cout << "PathManager: No base path found" << std::endl;
+ pout(PINGUS_DEBUG_LOADING) << "PathManager: No base path found" << std::endl;
return false;
}
@@ -89,15 +87,13 @@
path_found = true;
base_path = *i;
- if (pingus_debug_flags & PINGUS_DEBUG_LOADING)
- std::cout << "PathManager: Using base_path: " << base_path <<
std::endl;
+ pout(PINGUS_DEBUG_LOADING) << "PathManager: Using base_path: " <<
base_path << std::endl;
return true;
}
}
- if (pingus_debug_flags & PINGUS_DEBUG_LOADING)
- std::cout << "PathManager: No base path found" << std::endl;
+ pout(PINGUS_DEBUG_LOADING) << "PathManager: No base path found" << std::endl;
return false;
}
Index: pingu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pingu.cxx 21 Jun 2002 16:50:20 -0000 1.7
+++ pingu.cxx 23 Jun 2002 19:16:41 -0000 1.8
@@ -30,13 +30,15 @@
#include "pingu_action.hxx"
#include "pingu_action_factory.hxx"
#include "my_gettext.hxx"
+#include "debug.hxx"
const float deadly_velocity = 20.0;
int Pingu::id_counter = 0;
// Init a pingu at the given position while falling
Pingu::Pingu(const CL_Vector& arg_pos, int owner)
- : countdown_action (0),
+ : action(0),
+ countdown_action (0),
id (++id_counter),
font (PingusResource::load_font("Fonts/numbers", "fonts")),
status (PS_ALIVE),
@@ -109,8 +111,7 @@
if (status == PS_DEAD)
{
- if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
- std::cout << _("Setting action to a dead pingu") << std::endl;
+ pout(PINGUS_DEBUG_ACTIONS) << _("Setting action to a dead pingu") <<
std::endl;
return false;
}
@@ -119,21 +120,15 @@
// check for persistent actions
if (act->get_type() != (ActionType)ONCE)
{
- if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
- {
- std::cout << "Pingu: Found some persistant action" << std::endl;
- std::cout << "Pingu: Action is FALL: "
- << int(act->get_type() & (ActionType)FALL) << std::endl;
- std::cout << "Pingu: Action is WALL: "
- << int(act->get_type() & (ActionType)WALL) << std::endl;
- }
+ pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Found some persistant action" <<
std::endl
+ << "Pingu: Action is "
+ << (act->get_type() == FALL) ? "FALL" : "WALL";
for(std::vector<PinguAction*>::iterator i = persist.begin(); i !=
persist.end(); i++)
{
if ((*i)->get_name() == act->get_name())
{
- if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
- std::cout << "Not using action, we have allready" << std::endl;
+ pout(PINGUS_DEBUG_ACTIONS) << "Not using action, we have already"
<< std::endl;
return false;
}
}
@@ -159,8 +154,7 @@
{ // Immediately activate the action
if (action && (action->get_name() == act->get_name()))
{
- if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
- std::cout << "Pingu: Already have action" << std::endl;
+ pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Already have action" <<
std::endl;
return false;
}
action = act;
@@ -300,7 +294,7 @@
void
Pingu::update_action(float /*delta*/)
{
- std::cout << "Pingu: No action set, setting action." << std::endl;
+ pout(PINGUS_DEBUG_ACTIONS) << "Pingu: No action set, setting action." <<
std::endl;
if (rel_getpixel(0,-1) == ColMap::NOTHING)
set_action("faller");
else
Index: pingus_resource.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_resource.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pingus_resource.cxx 23 Jun 2002 11:54:10 -0000 1.7
+++ pingus_resource.cxx 23 Jun 2002 19:16:41 -0000 1.8
@@ -30,6 +30,7 @@
#include "path_manager.hxx"
#include "globals.hxx"
#include "pingus_resource.hxx"
+#include "debug.hxx"
std::map<std::string, CL_ResourceManager*> PingusResource::resource_map;
std::map<ResDescriptor, CL_Surface> PingusResource::surface_map;
@@ -117,8 +118,7 @@
CL_Surface
PingusResource::load_surface(const ResDescriptor& res_desc)
{
- if (pingus_debug_flags & PINGUS_DEBUG_LOADING)
- std::cout << "PingusResource: Loading surface: " << res_desc << std::endl;
+ pout(PINGUS_DEBUG_LOADING) << "PingusResource: Loading surface: " <<
res_desc << std::endl;
CL_Surface surf(surface_map[res_desc]);
@@ -139,12 +139,12 @@
// CL_Surface::load(res_desc.res_name.c_str(),
// get(suffix_fixer(res_desc.datafile)));
} catch (CL_Error err) {
- std::cout << "PingusResource:" << res_desc
- << ":-404-:" << err.message << std::endl;
+ pout << "PingusResource:" << res_desc
+ << ":-404-:" << err.message << std::endl;
try {
surf = CL_Surface ("misc/404", get(suffix_fixer("core")));
} catch (CL_Error err2) {
- std::cout << "PingusResource: Fatal error, important gfx files
(404.pcx) couldn't be loaded!" << std::endl;
+ pout << "PingusResource: Fatal error, important gfx files
(404.pcx) couldn't be loaded!" << std::endl;
throw err;
}
}
@@ -155,21 +155,20 @@
{
std::string filename = System::get_statdir() + "images/" +
res_desc.res_name;
// FIXME: Memory leak?
- std::cout << "PingusResource::load_surface(" << res_desc.res_name
<< ")" << std::endl;
+ pout << "PingusResource::load_surface(" << res_desc.res_name << ")"
<< std::endl;
// FIXME: Add pcx, jpeg, tga support here
- surf = CL_Surface(new CL_PNGProvider(filename,
- NULL), false);
- std::cout << "DONE" << std::endl;
+ surf = CL_Surface(new CL_PNGProvider(filename, NULL), false);
+ pout << "DONE" << std::endl;
surface_map[res_desc] = surf;
return surf;
}
case ResDescriptor::RD_AUTO:
- std::cerr << "PingusResource: ResDescriptor::AUTO not implemented" <<
std::endl;
+ perr << "PingusResource: ResDescriptor::AUTO not implemented" <<
std::endl;
assert (false);
default:
- std::cerr << "PingusResource: Unknown ResDescriptor::type: " <<
res_desc.type << std::endl;
+ perr << "PingusResource: Unknown ResDescriptor::type: " <<
res_desc.type << std::endl;
assert (false);
return CL_Surface();
}
@@ -187,8 +186,7 @@
CL_Font*
PingusResource::load_font(const ResDescriptor& res_desc)
{
- if (pingus_debug_flags & PINGUS_DEBUG_LOADING)
- std::cout << "PingusResource: Loading font: " << res_desc << std::endl;
+ pout(PINGUS_DEBUG_LOADING) << "PingusResource: Loading font: " << res_desc
<< std::endl;
CL_Font* font = font_map[res_desc];
@@ -205,23 +203,23 @@
font = CL_Font::load(res_desc.res_name.c_str(),
get(suffix_fixer(res_desc.datafile)));
} catch (CL_Error err) {
- std::cout << "PingusResource: " << err.message << std::endl;
- std::cout << "PingusResource: Couldn't load font: " << res_desc <<
std::endl;
+ pout << "PingusResource: " << err.message << std::endl
+ << "PingusResource: Couldn't load font: " << res_desc <<
std::endl;
assert (!"PingusResource: Fatal error can't continue!");
}
font_map[res_desc] = font;
return font;
case ResDescriptor::RD_FILE:
- std::cout << "PingusResource: ResDescriptor::FILE not implemented" <<
std::endl;
+ pout << "PingusResource: ResDescriptor::FILE not implemented" <<
std::endl;
return 0;
case ResDescriptor::RD_AUTO:
- std::cout << "PingusResource: ResDescriptor::AUTO not implemented" <<
std::endl;
+ pout << "PingusResource: ResDescriptor::AUTO not implemented" <<
std::endl;
return 0;
default:
- std::cout << "PingusResource: Unknown ResDescriptor::type: " <<
res_desc.type << std::endl;
+ pout << "PingusResource: Unknown ResDescriptor::type: " <<
res_desc.type << std::endl;
return 0;
}
}
@@ -230,7 +228,7 @@
void
PingusResource::cleanup ()
{
- std::cout << "XXXX PingusResource::cleanup ()" << std::endl;
+ pout << "XXXX PingusResource::cleanup ()" << std::endl;
for (std::map<ResDescriptor, CL_Surface>::iterator i = surface_map.begin ();
i != surface_map.end (); ++i)
@@ -238,15 +236,15 @@
if (i->first.type == ResDescriptor::RD_FILE
&& i->second.get_reference_count () == 1)
{
- std::cout << "XXX Releasing File: " << i->first
- << " => " << i->second.get_reference_count () << std::endl;
+ pout << "XXX Releasing File: " << i->first
+ << " => " << i->second.get_reference_count () << std::endl;
surface_map.erase(i);
}
else if (i->first.type == ResDescriptor::RD_RESOURCE
&& i->second.get_reference_count () == 2)
{
- std::cout << "XXX Releasing Resource : " << i->first
- << " => " << i->second.get_reference_count () << std::endl;
+ pout << "XXX Releasing Resource : " << i->first
+ << " => " << i->second.get_reference_count () << std::endl;
surface_map.erase(i);
}
}
Index: sound_dummy.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sound_dummy.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sound_dummy.cxx 13 Jun 2002 14:25:12 -0000 1.2
+++ sound_dummy.cxx 23 Jun 2002 19:16:41 -0000 1.3
@@ -19,24 +19,20 @@
#include "globals.hxx"
#include "sound_dummy.hxx"
-#include <iostream>
+#include "debug.hxx"
void
-PingusSoundDummy::real_play_sound(const std::string & filename, float volume,
float panning)
+PingusSoundDummy::real_play_sound(const std::string & filename, float
/*volume*/, float /*panning*/)
{
- if (filename.size()); if(volume); if(panning); // prevent warning -
optimizer will remove those
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "PingusSoundDummy::real_play_sound: " << filename <<
std::endl;
+ pout(PINGUS_DEBUG_SOUND) << "PingusSoundDummy::real_play_sound: " <<
filename << std::endl;
}
void
-PingusSoundDummy::real_play_music(const std::string & filename, float volume)
+PingusSoundDummy::real_play_music(const std::string & filename, float
/*volume*/)
{
- if (filename.size()); if(volume); // prevent warning - optimizer will remove
those
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "PingusSoundDummy::real_play_music: " << filename <<
std::endl;
+ pout(PINGUS_DEBUG_SOUND) << "PingusSoundDummy::real_play_music: " <<
filename << std::endl;
}
Index: sound_real.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sound_real.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sound_real.cxx 13 Jun 2002 14:25:12 -0000 1.2
+++ sound_real.cxx 23 Jun 2002 19:16:41 -0000 1.3
@@ -23,6 +23,7 @@
#include "globals.hxx"
#include "sound_real.hxx"
+#include "debug.hxx"
#ifdef HAVE_LIBCLANVORBIS
@@ -71,13 +72,11 @@
is_init = true;
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "Initializing ClanLib-Sound" << std::endl;
+ pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-Sound" << std::endl;
CL_SetupSound::init();
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "Initializing ClanLib-MikMod" << std::endl;
+ pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-MikMod" << std::endl;
#ifdef HAVE_LIBCLANMIKMOD
CL_SetupMikMod::init();
@@ -88,8 +87,7 @@
PingusSoundReal::real_play_sound(const std::string & filename, float volume,
float panning)
{
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "PingusSoundReal: Playing sound: " << filename <<
"Buffer-Size: " << sound_holder.size() << std::endl;
+ pout(PINGUS_DEBUG_SOUND) << "PingusSoundReal: Playing sound: " << filename
<< "Buffer-Size: " << sound_holder.size() << std::endl;
if (!sound_enabled)
return;
@@ -113,8 +111,7 @@
buffer = new CL_SoundBuffer (new CL_Sample(filename.c_str(), NULL), true);
sess = new CL_SoundBuffer_Session(buffer -> prepare());
} catch (const CL_Error & e) {
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "Can't open file " << filename << " -- skipping\n";
+ pout(PINGUS_DEBUG_SOUND) << "Can't open file " << filename << " --
skipping\n";
return;
}
@@ -137,8 +134,7 @@
if (!music_enabled)
return;
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "PingusSoundReal: Playing music: " << filename << std::endl;
+ pout(PINGUS_DEBUG_SOUND) << "PingusSoundReal: Playing music: " << filename
<< std::endl;
if (music) {
if (music -> is_playing())
@@ -182,6 +178,4 @@
/* EOF */
-
-
Index: wav_provider.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/wav_provider.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- wav_provider.cxx 12 Jun 2002 19:09:38 -0000 1.1
+++ wav_provider.cxx 23 Jun 2002 19:16:41 -0000 1.2
@@ -22,6 +22,7 @@
#include "globals.hxx"
#include "pingus_error.hxx"
#include "wav_provider.hxx"
+#include "debug.hxx"
std::map<std::string, Mix_Chunk*> PingusWavProvider::wave;
@@ -33,8 +34,7 @@
wav_data = wave[str];
- if (pingus_debug_flags & PINGUS_DEBUG_SOUND)
- std::cout << "Loading: " << str << " data: " << wav_data << std::endl;
+ pout(PINGUS_DEBUG_SOUND) << "Loading: " << str << " data: " << wav_data <<
std::endl;
if (wav_data)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src blitter.cxx,1.7,1.8 path_manager.cxx,1.1,1.2 pingu.cxx,1.7,1.8 pingus_resource.cxx,1.7,1.8 sound_dummy.cxx,1.2,1.3 sound_real.cxx,1.2,1.3 wav_provider.cxx,1.1,1.2,
torangan <=