Mercurial > fife-parpg
changeset 239:3804348fe3fb
Removed some weird stubs.
Correctly set resource location.
Note that the resource location on the ResourceClass seems to be of questionable utility anyway.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 24 Mar 2009 16:32:08 +0000 |
parents | d76169461729 |
children | 09f40db3f10c |
files | engine/core/audio/soundclip.cpp engine/core/audio/soundclip.h engine/core/loaders/native/audio_loaders/ogg_loader.cpp engine/core/loaders/native/video_loaders/image_loader.cpp engine/core/loaders/native/video_loaders/subimage_loader.cpp engine/core/video/animation.cpp engine/core/video/animation.h engine/core/video/image.cpp engine/core/video/image.h |
diffstat | 9 files changed, 6 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/audio/soundclip.cpp Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/audio/soundclip.cpp Tue Mar 24 16:32:08 2009 +0000 @@ -37,7 +37,7 @@ namespace FIFE { static Logger _log(LM_AUDIO); - SoundClip::SoundClip(SoundDecoder* decptr, bool deletedecoder) : m_location(ResourceLocation("")), m_isstream(decptr->needsStreaming()), m_decoder(decptr), m_deletedecoder(deletedecoder) { + SoundClip::SoundClip(SoundDecoder* decptr, bool deletedecoder) : m_isstream(decptr->needsStreaming()), m_decoder(decptr), m_deletedecoder(deletedecoder) { if (!m_isstream) { // only for non-streaming buffers
--- a/engine/core/audio/soundclip.h Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/audio/soundclip.h Tue Mar 24 16:32:08 2009 +0000 @@ -61,12 +61,6 @@ SoundClip(SoundDecoder* decptr, bool deletedecoder = true); ~SoundClip(); - - // TODO: fill in these stubs! Note: m_location is _not_ properly initialized. - virtual const ResourceLocation& getResourceLocation() { return m_location; } - - virtual void setResourceLocation(const ResourceLocation& location) { } - virtual void setResourceFile(const std::string& filename) { } /** Does this SoundClip require a streaming mechanism? * @@ -140,7 +134,6 @@ } private: - ResourceLocation m_location; //unsigned int m_refcount; // Reference count of that soundclip bool m_isstream; // is stream? SoundDecoder* m_decoder; // attached decoder
--- a/engine/core/loaders/native/audio_loaders/ogg_loader.cpp Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/loaders/native/audio_loaders/ogg_loader.cpp Tue Mar 24 16:32:08 2009 +0000 @@ -47,7 +47,7 @@ if(filename.find(".ogg", filename.size() - 4) != std::string::npos) { RawData* rdptr = m_vfs->open(location.getFilename()); ptr = new SoundClip(new SoundDecoderOgg(rdptr)); - + ptr->setResourceLocation(location); } else { FL_WARN(_log, LMsg() << "No audio-decoder available for file \"" << filename << "\"!"); throw InvalidFormat("Error: Ogg loader can't load files without ogg extension");
--- a/engine/core/loaders/native/video_loaders/image_loader.cpp Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/loaders/native/video_loaders/image_loader.cpp Tue Mar 24 16:32:08 2009 +0000 @@ -58,6 +58,7 @@ } Image* res = RenderBackend::instance()->createImage(surface); + res->setResourceLocation(location); if (loc) { res->setXShift(loc->getXShift()); res->setYShift(loc->getYShift());
--- a/engine/core/loaders/native/video_loaders/subimage_loader.cpp Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/loaders/native/video_loaders/subimage_loader.cpp Tue Mar 24 16:32:08 2009 +0000 @@ -74,7 +74,9 @@ SDL_SetAlpha(src,0,SDL_ALPHA_OPAQUE); SDL_BlitSurface(src,&src_rect,result,0); - return RenderBackend::instance()->createImage(result); + Image* image = RenderBackend::instance()->createImage(result); + image->setResourceLocation(location); + return image; }; }
--- a/engine/core/video/animation.cpp Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/video/animation.cpp Tue Mar 24 16:32:08 2009 +0000 @@ -39,7 +39,6 @@ namespace FIFE { Animation::Animation(): - m_location(""), m_action_frame(-1), m_animation_endtime(-1), m_direction(0) {
--- a/engine/core/video/animation.h Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/video/animation.h Tue Mar 24 16:32:08 2009 +0000 @@ -61,12 +61,6 @@ */ ~Animation(); - //TODO: fill in these stubs! Note, m_location is not properly initialized. - virtual const ResourceLocation& getResourceLocation() { return m_location; } - - virtual void setResourceLocation(const ResourceLocation& location) { } - virtual void setResourceFile(const std::string& filename) { } - /** Adds new frame into animation * Frames must be added starting from first frame. Increases the reference * count of the given image. @@ -141,8 +135,6 @@ ResourcePtr image; }; - ResourceLocation m_location; - /** Checks for animation frame index overflows */ bool isValidIndex(int index);
--- a/engine/core/video/image.cpp Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/video/image.cpp Tue Mar 24 16:32:08 2009 +0000 @@ -35,13 +35,11 @@ namespace FIFE { Image::Image(SDL_Surface* surface): - m_location(ResourceLocation("")), m_surface(NULL) { reset(surface); } Image::Image(const uint8_t* data, unsigned int width, unsigned int height): - m_location(ResourceLocation("")), m_surface(NULL) { SDL_Surface* surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, width,height, 32, RMASK, GMASK, BMASK ,AMASK);
--- a/engine/core/video/image.h Tue Mar 24 16:06:02 2009 +0000 +++ b/engine/core/video/image.h Tue Mar 24 16:32:08 2009 +0000 @@ -131,12 +131,6 @@ */ Image(const uint8_t* data, unsigned int width, unsigned int height); - //TODO: fill in these stub! Note that m_location is not properly initialized. - virtual const ResourceLocation& getResourceLocation() { return m_location; } - - virtual void setResourceLocation(const ResourceLocation& location) { } - virtual void setResourceFile(const std::string& filename) { } - /** Renders itself to the Destination surface at the rectangle rect. * * @param rect The position and clipping where to draw this image to. @@ -188,8 +182,6 @@ * @see pushClipArea */ virtual void clearClipArea(); - - ResourceLocation m_location; // The SDL Surface used. SDL_Surface* m_surface;