From: <dv...@us...> - 2008-05-01 21:19:27
|
Revision: 235 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=235&view=rev Author: dvalin Date: 2008-05-01 14:19:22 -0700 (Thu, 01 May 2008) Log Message: ----------- make it possible to set fps for cut scenes.. Modified Paths: -------------- branches/dunks/include/DataCache.h branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/DataCache.cpp branches/dunks/src/pakfile/Wsafile.cpp Modified: branches/dunks/include/DataCache.h =================================================================== --- branches/dunks/include/DataCache.h 2008-05-01 20:35:05 UTC (rev 234) +++ branches/dunks/include/DataCache.h 2008-05-01 21:19:22 UTC (rev 235) @@ -337,6 +337,7 @@ Sound_RocketSmall, Intro_3Houses, Intro_AndNow, + Intro_HasArrived, Intro_Battle, Intro_Begins, Intro_Blaster, @@ -358,7 +359,7 @@ Intro_TheHouse, Intro_TheMostSpice, Intro_TheEmpire, - Intro_ThereAreNoSetTerritories, + Intro_ThereAreNoSet, Intro_ThatProduces, Intro_RulesOfEngagement, Intro_Territories, Modified: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h 2008-05-01 20:35:05 UTC (rev 234) +++ branches/dunks/include/pakfile/Wsafile.h 2008-05-01 21:19:22 UTC (rev 235) @@ -16,7 +16,7 @@ { public: Wsafile(unsigned char * bufFiledata, int bufsize, - SDL_Surface* lastframe = NULL); + SDL_Surface* lastframe = NULL, float setFps = 0 ); ~Wsafile(); Image * getPicture(Uint32 FrameNumber, SDL_Palette *palette); Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-05-01 20:35:05 UTC (rev 234) +++ branches/dunks/src/DataCache.cpp 2008-05-01 21:19:22 UTC (rev 235) @@ -369,7 +369,8 @@ addSoundChunk(Intro_3Houses, getChunkFromFile("INTROVOC:3HOUSES.VOC")); addSoundChunk(Intro_AndNow, getChunkFromFile("INTROVOC:ANDNOW.VOC")); - addSoundChunk(Intro_Battle, getChunkFromFile("INTROVOC:ARRIVED.VOC")); + addSoundChunk(Intro_HasArrived, getChunkFromFile("INTROVOC:ARRIVED.VOC")); + addSoundChunk(Intro_Battle, getChunkFromFile("INTROVOC:BATTLE.VOC")); addSoundChunk(Intro_Begins, getChunkFromFile("INTROVOC:BEGINS.VOC")); addSoundChunk(Intro_Blaster, getChunkFromFile("INTROVOC:BLASTER.VOC")); addSoundChunk(Intro_TheBuilding, getChunkFromFile("INTROVOC:BLDING.VOC")); @@ -390,7 +391,7 @@ addSoundChunk(Intro_TheHouse, getChunkFromFile("INTROVOC:EHOUSE.VOC")); addSoundChunk(Intro_TheMostSpice, getChunkFromFile("INTROVOC:EMOST.VOC")); addSoundChunk(Intro_TheEmpire, getChunkFromFile("INTROVOC:EMPIRE.VOC")); - addSoundChunk(Intro_ThereAreNoSetTerritories, getChunkFromFile("INTROVOC:ENOSET.VOC")); + addSoundChunk(Intro_ThereAreNoSet, getChunkFromFile("INTROVOC:ENOSET.VOC")); addSoundChunk(Intro_ThatProduces, getChunkFromFile("INTROVOC:EPRODUCE.VOC")); addSoundChunk(Intro_RulesOfEngagement, getChunkFromFile("INTROVOC:ERULES.VOC")); addSoundChunk(Intro_Territories, getChunkFromFile("INTROVOC:ETERRIT.VOC")); Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2008-05-01 20:35:05 UTC (rev 234) +++ branches/dunks/src/pakfile/Wsafile.cpp 2008-05-01 21:19:22 UTC (rev 235) @@ -5,7 +5,7 @@ #include <string.h> Wsafile::Wsafile(unsigned char * bufFiledata, int bufsize, - SDL_Surface* lastframe ) : Decode() + SDL_Surface* lastframe, float setFps ) : Decode() { Filedata = bufFiledata; WsaFilesize = bufsize; @@ -35,7 +35,10 @@ } // surely /1000.0f not 100?! - fps = (FramesPer1024ms / 1024.0f) / 100.0f; + if(setFps) + fps = setFps; + else + fps = (FramesPer1024ms / 1024.0f) / 100.0f; printf("FramesPer1024ms = %d\n", FramesPer1024ms); printf("FPS = %.3f\n", fps); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-02 15:04:55
|
Revision: 240 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=240&view=rev Author: dvalin Date: 2008-05-02 08:04:41 -0700 (Fri, 02 May 2008) Log Message: ----------- rename sound name from Intro_Battle to Intro_BattleForDune Modified Paths: -------------- branches/dunks/include/DataCache.h branches/dunks/src/DataCache.cpp Modified: branches/dunks/include/DataCache.h =================================================================== --- branches/dunks/include/DataCache.h 2008-05-02 01:38:04 UTC (rev 239) +++ branches/dunks/include/DataCache.h 2008-05-02 15:04:41 UTC (rev 240) @@ -338,7 +338,7 @@ Intro_3Houses, Intro_AndNow, Intro_HasArrived, - Intro_Battle, + Intro_BattleForDune, Intro_Begins, Intro_Blaster, Intro_TheBuilding, Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-05-02 01:38:04 UTC (rev 239) +++ branches/dunks/src/DataCache.cpp 2008-05-02 15:04:41 UTC (rev 240) @@ -370,7 +370,7 @@ addSoundChunk(Intro_3Houses, getChunkFromFile("INTROVOC:3HOUSES.VOC")); addSoundChunk(Intro_AndNow, getChunkFromFile("INTROVOC:ANDNOW.VOC")); addSoundChunk(Intro_HasArrived, getChunkFromFile("INTROVOC:ARRIVED.VOC")); - addSoundChunk(Intro_Battle, getChunkFromFile("INTROVOC:BATTLE.VOC")); + addSoundChunk(Intro_BattleForDune, getChunkFromFile("INTROVOC:BATTLE.VOC")); addSoundChunk(Intro_Begins, getChunkFromFile("INTROVOC:BEGINS.VOC")); addSoundChunk(Intro_Blaster, getChunkFromFile("INTROVOC:BLASTER.VOC")); addSoundChunk(Intro_TheBuilding, getChunkFromFile("INTROVOC:BLDING.VOC")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-02 15:32:22
|
Revision: 242 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=242&view=rev Author: dvalin Date: 2008-05-02 08:32:19 -0700 (Fri, 02 May 2008) Log Message: ----------- make it possible to create a video from text strings and cps images Modified Paths: -------------- branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/pakfile/Wsafile.cpp Modified: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h 2008-05-02 15:06:29 UTC (rev 241) +++ branches/dunks/include/pakfile/Wsafile.h 2008-05-02 15:32:19 UTC (rev 242) @@ -5,18 +5,24 @@ #include "pakfile/Decode.h" #include "pakfile/Animation.h" #include "SDL.h" +#include <string> #include <boost/shared_ptr.hpp> class Wsafile; - typedef boost::shared_ptr<Wsafile> WsafilePtr; +class Cpsfile; + class Wsafile : public Decode { public: - Wsafile(unsigned char * bufFiledata, int bufsize, + Wsafile(uint8_t * bufFiledata, int bufsize, SDL_Surface* lastframe = NULL, float setFps = 0 ); + Wsafile(std::string text); + Wsafile(Cpsfile* cpsFile); +// wsafil + ~Wsafile(); Image * getPicture(Uint32 FrameNumber, SDL_Palette *palette); @@ -29,6 +35,9 @@ private: void decodeFrames(); + ImagePtr m_fakeWsa; + std::string m_text; + Cpsfile* m_cpsFile; unsigned char *decodedFrames; Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 15:06:29 UTC (rev 241) +++ branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 15:32:19 UTC (rev 242) @@ -1,8 +1,10 @@ #include "Gfx.h" #include "pakfile/Wsafile.h" +#include "pakfile/Cpsfile.h" #include <SDL_endian.h> #include <stdlib.h> -#include <string.h> +#include <string> +#include "Font.h" Wsafile::Wsafile(unsigned char * bufFiledata, int bufsize, SDL_Surface* lastframe, float setFps ) : Decode() @@ -66,6 +68,37 @@ decodeFrames(); } +Wsafile::Wsafile(std::string text) : Decode() +{ + WsaFilesize = -1; + + printf("loading fake wsa...\n"); + + NumFrames = 1; + fps = 0.1; + + printf("FramesPer1024ms = %d\n", FramesPer1024ms); + printf("FPS = %.3f\n", fps); + decodedFrames = NULL; + m_text = text; + m_fakeWsa = ImagePtr(new Image(UPoint(100,100))); +} + +Wsafile::Wsafile(Cpsfile* cpsFile) : Decode() +{ + WsaFilesize = -2; + + printf("loading cps file as wsa...\n"); + + NumFrames = 1; + fps = 0.1; + + printf("FramesPer1024ms = %d\n", FramesPer1024ms); + printf("FPS = %.3f\n", fps); + decodedFrames = NULL; + m_cpsFile = cpsFile; +} + Wsafile::~Wsafile() { free(decodedFrames); @@ -73,12 +106,39 @@ Image * Wsafile::getPicture(Uint32 FrameNumber, SDL_Palette *palette) { + if(WsaFilesize == -1){ +// ImagePtr m_surface = m_fakeWsa; //ImagePtr(new Image(UPoint(10,10))); + Image* m_surface = new Image(UPoint(320,240)); + + std::string m_caption = m_text; + Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); + + Uint16 textw, texth; + + font->extents(m_caption.c_str(), textw, texth); + + /*If surface width was not %4 == 0 then you'd get a text in italics */ +// m_surface.reset(new Image(UPoint(textw + 4-(textw%4) , texth))); + + m_surface->fillRect(0); + + font->render(m_caption.c_str(), m_surface->getSurface(), + m_surface->getSurface()->w/2 - textw/2, + m_surface->getSurface()->h/2 - texth/2, 49); + + return m_surface; +// return m_fakeWsa->getCopy().get(); + } + if(WsaFilesize == -2){ + return m_cpsFile->getPicture(); + } + if(FrameNumber >= NumFrames) { return NULL; } SDL_Surface * pic; - unsigned char * Frame = decodedFrames + (FrameNumber * SizeX * SizeY); + uint8_t * Frame = decodedFrames + (FrameNumber * SizeX * SizeY); // create new picture surface if((pic = SDL_CreateRGBSurface(SDL_SWSURFACE,SizeX,SizeY,8,0,0,0,0))== NULL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-02 15:35:53
|
Revision: 243 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=243&view=rev Author: dvalin Date: 2008-05-02 08:33:16 -0700 (Fri, 02 May 2008) Log Message: ----------- add text only scenes and virgin logo scene Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-02 15:32:19 UTC (rev 242) +++ branches/dunks/include/IntroState.h 2008-05-02 15:33:16 UTC (rev 243) @@ -16,6 +16,7 @@ typedef std::pair <uint16_t, std::string> introText; typedef std::pair <uint16_t, Sound_enum> introSound; typedef std::pair <uint16_t, Mix_Chunk*> soundChunk; +typedef std::pair <uint8_t, uint8_t> videoLoop; class StringFile; class Button; @@ -42,7 +43,7 @@ }; Frame(std::string filename, Transition in, Transition out, - bool cont, uint16_t endWait = 0); + bool cont, uint8_t endWait = 0); ~Frame(); bool Execute(float ft); @@ -52,6 +53,9 @@ void concatSound(uint16_t playAt, Sound_enum sound); void setPalette(Palette_enum palette); void setSong(uint8_t song); + void setFps(float fps); + void setLoop(uint8_t loopAt, uint8_t rewindTo, uint8_t numLoops, uint8_t wait); + void setTextColor(uint8_t textColor); private: std::string m_filename; @@ -65,12 +69,15 @@ bool mb_finished; WsafilePtr m_wsa; - int m_currentFrame; + uint8_t m_currentFrame, m_framesPlayed; + float m_frametime; int8_t m_song; - uint16_t m_endWait; + uint8_t m_endWait; + uint8_t m_textColor; + float m_fps; + videoLoop m_loop, m_loopTime; - ImagePtr m_animSurface, m_scaledSurface; SDL_Color* m_transitionPalette; Label* m_subText; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-02 15:32:19 UTC (rev 242) +++ branches/dunks/src/IntroState.cpp 2008-05-02 15:33:16 UTC (rev 243) @@ -119,20 +119,33 @@ void IntroState::Frame::Load(Frame* lastframe) { printf("intro loading %s\n", m_filename.c_str()); - - int len; - uint8_t * data = ResMan::Instance()->readFile(m_filename, &len); - assert(data != NULL); + std::string::size_type wsaSuffix = m_filename.rfind(".WSA", m_filename.size() - 1); + std::string::size_type cpsSuffix = m_filename.rfind(".CPS", m_filename.size() - 1); + bool isWsa = m_filename.size() > 3 && wsaSuffix == m_filename.size() - 4; + bool isCps = m_filename.size() > 3 && cpsSuffix == m_filename.size() - 4; - if (m_continuation) - { - m_wsa.reset(new Wsafile(data, len, lastframe->m_animSurface->getSurface(), m_fps)); - } - else - { - m_wsa.reset(new Wsafile(data, len, NULL, m_fps)); - } + if(isWsa || isCps){ + int len; + uint8_t * data = ResMan::Instance()->readFile(m_filename, &len); + + assert(data != NULL); + + if(isWsa){ + if (m_continuation) + { + m_wsa.reset(new Wsafile(data, len, lastframe->m_animSurface->getSurface(), m_fps)); + } + else + { + m_wsa.reset(new Wsafile(data, len, NULL, m_fps)); + } + }else if(isCps){ + m_wsa.reset(new Wsafile(new Cpsfile(data, len, m_palette))); + } + } + else + m_wsa.reset(new Wsafile(m_filename)); m_frametime = 0; m_currentFrame = 0; @@ -143,7 +156,6 @@ m_scaledSurface = m_animSurface->getResized(2.0); if(m_endWait && !m_loop.first) setLoop(m_wsa->getNumFrames(), m_wsa->getNumFrames(), 1, m_endWait); - } bool IntroState::Frame::Execute(float dt) @@ -315,7 +327,7 @@ // m_introStrings.push_back(introText(0, "")); // credits.eng isn't properly decoded yet.. // DataCache::Instance()->getCreditsString(20))); - frame = new Frame("INTRO:WESTWOOD.WSA", + frame = new Frame("INTRO:WESTWOOD.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, false, 30); @@ -323,6 +335,26 @@ frame->setPalette(WESTWOOD_PAL); enque(frame); + frame = new Frame("and", + Frame::NO_TRANSITION, + Frame::FADE_OUT, + false, 30); + enque(frame); + + // VIRGIN.CPS has it's own palette, handling of this needs to be implemented.. + frame = new Frame("INTRO:VIRGIN.CPS", + Frame::NO_TRANSITION, + Frame::FADE_OUT, + false, 30); + enque(frame); + + frame = new Frame(DataCache::Instance()->getIntroString(1), + Frame::NO_TRANSITION, + Frame::FADE_OUT, + false, 20); + enque(frame); + + frame = new Frame("INTRO:INTRO1.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, @@ -419,16 +451,17 @@ frame->concatSound(25, Intro_OfDune); enque(frame); -/* frame = new Frame(DataCache::Instance()->getIntroString(13) , + frame = new Frame(DataCache::Instance()->getIntroString(13), Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 20); + false, 50); frame->concatSound(0, Intro_AndNow); frame->concatSound(0, Intro_3Houses); frame->concatSound(0, Intro_ForControl); frame->concatSound(0, Intro_OfDune); enque(frame); -*/ + + frame = new Frame("INTRO:INTRO6.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, @@ -502,23 +535,23 @@ frame->concatSound(0, Intro_WillPrevail); enque(frame); -/* frame = new Frame("Your battle for Dune begins", + + frame = new Frame(DataCache::Instance()->getIntroString(18), Frame::NO_TRANSITION, Frame::FADE_OUT, - false); + false, 20); frame->concatSound(0, Intro_Your); - frame->concatSound(0, Intro_Battle); - frame->concatSound(0, Intro_ForDune); - frame->concatSound(0, Intro_Begins); + frame->concatSound(0, Intro_BattleForDune); + frame->concatSound(0, Intro_Begins); enque(frame); - frame = new Frame("Now", + frame = new Frame(DataCache::Instance()->getIntroString(19), Frame::NO_TRANSITION, Frame::FADE_OUT, - false); + false, 15); frame->addSound(0, Intro_Now); - enque(frame);*/ + enque(frame); // seems nice to play this again ;) /* frame = new Frame("INTRO:INTRO1.WSA", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-02 17:14:50
|
Revision: 244 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=244&view=rev Author: dvalin Date: 2008-05-02 10:14:48 -0700 (Fri, 02 May 2008) Log Message: ----------- convert to use C++ string in stead of C const char * Modified Paths: -------------- branches/dunks/include/Font.h branches/dunks/src/Font.cpp Modified: branches/dunks/include/Font.h =================================================================== --- branches/dunks/include/Font.h 2008-05-02 15:33:16 UTC (rev 243) +++ branches/dunks/include/Font.h 2008-05-02 17:14:48 UTC (rev 244) @@ -46,9 +46,11 @@ Font(FNTCharacter* characters, FNTHeader* header); ~Font(); - void extents(const char* text, Uint16& w, Uint16& h); - void render(const char* text, ImagePtr image, int x, int y, Uint8 paloff); + void extents(std::string text, Uint16& w, Uint16& h); + void render(std::string text, ImagePtr image, int x, int y, Uint8 paloff); + void render(std::string text, SDL_Surface* image, int x, int y, Uint8 paloff); + private: FNTHeader* m_header; FNTCharacter* m_characters; @@ -60,19 +62,19 @@ { friend class Singleton<FontManager>; - typedef std::map<const char*, Font*> FontList; + typedef std::map<std::string, Font*> FontList; protected: FontManager(); ~FontManager(); public: - Font* getFont(const char* fn); + Font* getFont(std::string fn); private: FontList m_fonts; - Font* loadFont(const char* fn); + Font* loadFont(std::string fn); }; class TTFFontManager : public Singleton<TTFFontManager> Modified: branches/dunks/src/Font.cpp =================================================================== --- branches/dunks/src/Font.cpp 2008-05-02 15:33:16 UTC (rev 243) +++ branches/dunks/src/Font.cpp 2008-05-02 17:14:48 UTC (rev 244) @@ -5,6 +5,7 @@ #include <assert.h> #include <stdlib.h> #include <stdio.h> +#include <iostream> Font::Font(FNTCharacter* characters, FNTHeader* header) { @@ -18,21 +19,21 @@ delete m_header; } -void Font::extents(const char* text, Uint16& w, Uint16& h) +void Font::extents(std::string text, Uint16& w, Uint16& h) { FNTCharacter* ch; w = 0; h = m_header->height; - for (unsigned int c=0; c!=strlen(text); c++) + for (unsigned int c=0; c!=text.length(); c++) { ch = &m_characters[text[c]]; w += (2 * ch->width) + 1; }; } -void Font::render(const char* text, ImagePtr image, int offx, int offy, Uint8 paloff) +void Font::render(std::string text, ImagePtr image, int offx, int offy, Uint8 paloff) { FNTCharacter* ch; byte* bitmap; @@ -41,7 +42,7 @@ Uint8* pixels = (Uint8*)surface->pixels; - for (unsigned int c=0; c!=strlen(text); c++) + for (unsigned int c=0; c!=text.length(); c++) { ch = &m_characters[text[c]]; bitmap = ch->bitmap; @@ -70,6 +71,45 @@ } +void Font::render(std::string text, SDL_Surface* image, int offx, int offy, Uint8 paloff) +{ + std::string test = text; + FNTCharacter* ch; + byte* bitmap; + + SDL_Surface * surface = image; + + Uint8* pixels = (Uint8*)surface->pixels; + + for (unsigned int c=0; c!=text.length(); c++) + { + ch = &m_characters[text[c]]; + bitmap = ch->bitmap; + + for (byte y=0; y!=ch->height; y++) + { + for (byte x=0; x!=ch->width*2; x+=2) + { + byte lobyte = bitmap[(x/2) + (y*ch->width)] >> 4; + byte hibyte = bitmap[(x/2) + (y*ch->width)] & 0x0F; + + if (hibyte!=0) + { + pixels[(offx + x) + ((ch->y_offset + y + offy) * surface->w)] = paloff + Uint8(hibyte); + }; + + if (lobyte!=0) //(2 < ch->width) lobyte!=0) + { + pixels[(offx + x + 1) + ((ch->y_offset + y + offy) * surface->w)] = paloff + Uint8(lobyte); + }; + }; + + }; + offx += (2*ch->width) + 1; + }; + +} + FontManager::FontManager() { @@ -80,21 +120,21 @@ } -Font* FontManager::getFont(const char* fn) +Font* FontManager::getFont(std::string fn) { FontList::iterator it = m_fonts.find(fn); if (it == m_fonts.end()) { - printf("loading %s\n", fn); + std::cout << "loading" << fn << std::endl; m_fonts[fn] = loadFont(fn); }; return m_fonts[fn]; } -Font* FontManager::loadFont(const char* fn) +Font* FontManager::loadFont(std::string fn) { - printf("loadFont %s\n", fn); + std::cout << "loadFont " << fn << std::endl; //FILE* file = fopen(fn, "rb"); FileLike* file = ResMan::Instance()->readFile(fn); @@ -118,7 +158,7 @@ file->seek(header->wpos); file->read(wchar, sizeof(byte) * (header->nchars+1)); - if (wchar[0] != 8) printf("bad!!\n"); + if (wchar[0] != 8) printf("%d: bad!!\n", wchar[0]); word* hchar = new word[header->nchars+1]; @@ -133,7 +173,7 @@ { byte offset = hchar[i] & 0xFF; byte height = hchar[i] >> 8; - byte width =( wchar[i] + 1) / 2; + byte width =( wchar[i] + 1)/ 2; characters[i].width = width; characters[i].height = height; @@ -168,18 +208,18 @@ fprintf(stdout, "loading fonts...\n"); - const char *fn = "data/font.ttf"; + std::string fn = "data/font.ttf"; for (int i=MIN_FONT_SIZE; i < MAX_FONT_SIZE; i++) { - if ( (m_fonts[i - MIN_FONT_SIZE] = TTF_OpenFont(fn, i)) = NULL ) + if ( (m_fonts[i - MIN_FONT_SIZE] = TTF_OpenFont(fn.c_str(), i)) = NULL ) { - fprintf(stderr, "ERROR: unable to load %s size %d\n", fn, i); + std::cerr << "ERROR: unable to load " << fn << " size " << i << std::endl; Application::Instance()->Die(); } else { - fprintf(stdout, "loaded font %s %d\n", fn, i); + std::cout << "loaded font " << fn << " " << i << std::endl; }; }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-02 18:08:43
|
Revision: 245 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=245&view=rev Author: dvalin Date: 2008-05-02 11:08:39 -0700 (Fri, 02 May 2008) Log Message: ----------- fix handling of newlines in text Modified Paths: -------------- branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/pakfile/Wsafile.cpp Modified: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h 2008-05-02 17:14:48 UTC (rev 244) +++ branches/dunks/include/pakfile/Wsafile.h 2008-05-02 18:08:39 UTC (rev 245) @@ -19,9 +19,8 @@ public: Wsafile(uint8_t * bufFiledata, int bufsize, SDL_Surface* lastframe = NULL, float setFps = 0 ); - Wsafile(std::string text); + Wsafile(std::string text, uint8_t textColor); Wsafile(Cpsfile* cpsFile); -// wsafil ~Wsafile(); @@ -39,9 +38,11 @@ std::string m_text; Cpsfile* m_cpsFile; - unsigned char *decodedFrames; + uint8_t* decodedFrames; - unsigned char* Filedata; + uint8_t* Filedata; + uint8_t m_textColor; + Uint32* Index; int WsaFilesize; Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 17:14:48 UTC (rev 244) +++ branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 18:08:39 UTC (rev 245) @@ -6,7 +6,7 @@ #include <string> #include "Font.h" -Wsafile::Wsafile(unsigned char * bufFiledata, int bufsize, +Wsafile::Wsafile(uint8_t * bufFiledata, int bufsize, SDL_Surface* lastframe, float setFps ) : Decode() { Filedata = bufFiledata; @@ -68,7 +68,7 @@ decodeFrames(); } -Wsafile::Wsafile(std::string text) : Decode() +Wsafile::Wsafile(std::string text, uint8_t textColor) : Decode() { WsaFilesize = -1; @@ -81,7 +81,7 @@ printf("FPS = %.3f\n", fps); decodedFrames = NULL; m_text = text; - m_fakeWsa = ImagePtr(new Image(UPoint(100,100))); + m_textColor = textColor; } Wsafile::Wsafile(Cpsfile* cpsFile) : Decode() @@ -107,28 +107,34 @@ Image * Wsafile::getPicture(Uint32 FrameNumber, SDL_Palette *palette) { if(WsaFilesize == -1){ -// ImagePtr m_surface = m_fakeWsa; //ImagePtr(new Image(UPoint(10,10))); - Image* m_surface = new Image(UPoint(320,240)); + Image* img = new Image(UPoint(320,240)); + + std::string text = m_text; + Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); + + Uint16 textw, texth; + + img->fillRect(0); + + uint8_t numLines = 0; + int linebreak = text.find("\n",0)+ 1; + std::string thisLine; + while(text.substr(0, linebreak-1).length() > 0){ + thisLine = text.substr(0, linebreak-1); + + font->extents(thisLine, textw, texth); + + font->render(thisLine, img->getSurface(), + img->getSurface()->w/2 - textw/2, + img->getSurface()->h/2+(numLines++*20) - texth/2, m_textColor); + if(linebreak == -1) + break; + text = text.substr(linebreak, text.length()-linebreak); + linebreak = text.find("\n",0); + } + return img; + } - std::string m_caption = m_text; - Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); - - Uint16 textw, texth; - - font->extents(m_caption.c_str(), textw, texth); - - /*If surface width was not %4 == 0 then you'd get a text in italics */ -// m_surface.reset(new Image(UPoint(textw + 4-(textw%4) , texth))); - - m_surface->fillRect(0); - - font->render(m_caption.c_str(), m_surface->getSurface(), - m_surface->getSurface()->w/2 - textw/2, - m_surface->getSurface()->h/2 - texth/2, 49); - - return m_surface; -// return m_fakeWsa->getCopy().get(); - } if(WsaFilesize == -2){ return m_cpsFile->getPicture(); } @@ -162,7 +168,7 @@ //Now we can copy line by line for(int y = 0; y < SizeY;y++) { - memcpy( ((unsigned char*) (pic->pixels)) + y * pic->pitch , Frame + y * SizeX, SizeX); + memcpy( ((uint8_t*) (pic->pixels)) + y * pic->pitch , Frame + y * SizeX, SizeX); } SDL_UnlockSurface(pic); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-02 23:41:36
|
Revision: 248 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=248&view=rev Author: dvalin Date: 2008-05-02 16:41:31 -0700 (Fri, 02 May 2008) Log Message: ----------- don't draw text in wsa object, just return a tiny 1x1 image in stead and do the drawing in IntroState class Modified Paths: -------------- branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/pakfile/Wsafile.cpp Modified: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h 2008-05-02 18:22:29 UTC (rev 247) +++ branches/dunks/include/pakfile/Wsafile.h 2008-05-02 23:41:31 UTC (rev 248) @@ -19,8 +19,8 @@ public: Wsafile(uint8_t * bufFiledata, int bufsize, SDL_Surface* lastframe = NULL, float setFps = 0 ); - Wsafile(std::string text, uint8_t textColor); Wsafile(Cpsfile* cpsFile); + Wsafile(); ~Wsafile(); Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 18:22:29 UTC (rev 247) +++ branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 23:41:31 UTC (rev 248) @@ -68,11 +68,11 @@ decodeFrames(); } -Wsafile::Wsafile(std::string text, uint8_t textColor) : Decode() +Wsafile::Wsafile(Cpsfile* cpsFile) : Decode() { - WsaFilesize = -1; + WsaFilesize = -2; - printf("loading fake wsa...\n"); + printf("loading cps file as wsa...\n"); NumFrames = 1; fps = 0.1; @@ -80,15 +80,14 @@ printf("FramesPer1024ms = %d\n", FramesPer1024ms); printf("FPS = %.3f\n", fps); decodedFrames = NULL; - m_text = text; - m_textColor = textColor; + m_cpsFile = cpsFile; } -Wsafile::Wsafile(Cpsfile* cpsFile) : Decode() +Wsafile::Wsafile() : Decode() { - WsaFilesize = -2; + WsaFilesize = -1; - printf("loading cps file as wsa...\n"); + printf("loading empty image as wsa...\n"); NumFrames = 1; fps = 0.1; @@ -96,7 +95,6 @@ printf("FramesPer1024ms = %d\n", FramesPer1024ms); printf("FPS = %.3f\n", fps); decodedFrames = NULL; - m_cpsFile = cpsFile; } Wsafile::~Wsafile() @@ -106,33 +104,9 @@ Image * Wsafile::getPicture(Uint32 FrameNumber, SDL_Palette *palette) { + Image* img; if(WsaFilesize == -1){ - Image* img = new Image(UPoint(320,240)); - - std::string text = m_text; - Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); - - Uint16 textw, texth; - - img->fillRect(0); - - uint8_t numLines = 0; - int linebreak = text.find("\n",0)+ 1; - std::string thisLine; - // This is a bit hairy and needs to be cleaned up a bit.. - while(text.substr(0, linebreak-1).length() > 0){ - thisLine = text.substr(0, linebreak-1); - - font->extents(thisLine, textw, texth); - - font->render(thisLine, img->getSurface(), - img->getSurface()->w/2 - textw/2, - img->getSurface()->h/2+(numLines++*20) - texth/2, m_textColor); - if(linebreak == -1 || text == text.substr(linebreak, text.length()-linebreak)) - break; - text = text.substr(linebreak, text.length()-linebreak); - linebreak = text.find("\n",0); - } + img = new Image(UPoint(1,1)); return img; } @@ -174,7 +148,7 @@ SDL_UnlockSurface(pic); - Image * img = new Image(pic); + img = new Image(pic); return img; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-02 23:54:02
|
Revision: 249 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=249&view=rev Author: dvalin Date: 2008-05-02 16:54:01 -0700 (Fri, 02 May 2008) Log Message: ----------- draw text in Frame class rather than Wsafile class Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-02 23:41:31 UTC (rev 248) +++ branches/dunks/include/IntroState.h 2008-05-02 23:54:01 UTC (rev 249) @@ -18,6 +18,7 @@ typedef std::pair <uint16_t, Mix_Chunk*> soundChunk; typedef std::pair <uint8_t, uint8_t> videoLoop; +class Font; class StringFile; class Button; class Label; @@ -78,10 +79,9 @@ float m_fps; videoLoop m_loop, m_loopTime; - ImagePtr m_animSurface, m_scaledSurface; + ImagePtr m_animSurface, m_scaledSurface, m_textSurface; SDL_Color* m_transitionPalette; - Label* m_subText; - Container* m_container; + Font* font; std::vector<introText> m_introStrings; std::vector<introSound> m_introSounds; std::vector<soundChunk> m_soundChunks; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-02 23:41:31 UTC (rev 248) +++ branches/dunks/src/IntroState.cpp 2008-05-02 23:54:01 UTC (rev 249) @@ -6,9 +6,8 @@ #include "Settings.h" #include "pakfile/Palette.h" #include "boost/bind.hpp" -#include "gui2/Label.h" -#include "gui2/Container.h" #include <iostream> +#include "Font.h" // ------------------------------------------------------------------ // IntroState::Frame @@ -24,10 +23,6 @@ m_state = TRANSITION_IN; m_hold = 0.0f; m_transitionPalette = NULL; - m_container = new Container(); - m_container->setSize(UPoint(Settings::Instance()->GetWidth(), - Settings::Instance()->GetHeight())); - m_subText = NULL; m_palette = DataCache::Instance()->getPalette(INTRO_PAL); m_song = -1; @@ -36,9 +31,9 @@ m_loop = videoLoop(0,0); m_loopTime = videoLoop(0,0); m_textColor = 49; + m_textSurface.reset(new Image(UPoint(320,40))); + font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); - Application::Instance()->RootWidget()->addChild(m_container); - } void IntroState::Frame::addText(uint16_t playAt, std::string text) @@ -145,7 +140,7 @@ } } else - m_wsa.reset(new Wsafile(m_filename, m_textColor)); + m_wsa.reset(new Wsafile()); m_frametime = 0; m_currentFrame = 0; @@ -188,13 +183,36 @@ void IntroState::Frame::doPlaying(float dt) { + Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); + if(m_introStrings.size() > 0){ if(m_framesPlayed == m_introStrings[0].first){ - if(m_subText != NULL) m_container->deleteChild(m_subText); - m_subText = new Label(m_introStrings[0].second, m_textColor, 0); + ImagePtr tmp(new Image(UPoint(320,40))); + std::string text = m_introStrings[0].second; + + uint8_t numLines = 0; + int linebreak = text.find("\n",0)+ 1; + std::string thisLine; + // This is a bit hairy and needs to be cleaned up a bit.. + + Uint16 textw, texth; + + while(text.substr(0, linebreak-1).length() > 0){ + thisLine = text.substr(0, linebreak-1); + if(linebreak != -1) + thisLine += " "; + + font->extents(thisLine, textw, texth); + + font->render(thisLine, tmp->getSurface(), tmp->getSurface()->w/2 - textw/2, 10+(numLines++*20) - texth/2, m_textColor); + if(linebreak == -1 || text == text.substr(linebreak, text.length()-linebreak)) + break; + text = text.substr(linebreak, text.length()-linebreak); + linebreak = text.find("\n",0); + } + m_textSurface = tmp->getResized(2); + m_introStrings.erase(m_introStrings.begin()); - m_container->setPosition(UPoint(50, 420)); - m_container->addChild(m_subText); } } @@ -238,7 +256,11 @@ m_animSurface.reset(m_wsa->getPicture(m_currentFrame, m_palette)); m_scaledSurface = m_animSurface->getResized(2.0); }; + }; + m_textSurface->blitToScreen(SPoint(0,Application::Instance()->Screen()->getSurface()->h/2 + m_scaledSurface->getSurface()->h/2 + 20)); + + } void IntroState::Frame::setupTransitionIn() @@ -312,7 +334,6 @@ void IntroState::Frame::doHolding(float dt) { m_state = TRANSITION_OUT; - if(m_subText != NULL) m_container->deleteChild(m_subText); } IntroState::Frame::~Frame() @@ -335,10 +356,11 @@ frame->setPalette(WESTWOOD_PAL); enque(frame); - frame = new Frame("and", + frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, false, 30); + frame->addText(0, "and"); enque(frame); // VIRGIN.CPS has it's own palette, handling of this needs to be implemented.. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-03 00:14:54
|
Revision: 251 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=251&view=rev Author: dvalin Date: 2008-05-02 17:14:52 -0700 (Fri, 02 May 2008) Log Message: ----------- make it possible to override default location of text Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-03 00:00:49 UTC (rev 250) +++ branches/dunks/include/IntroState.h 2008-05-03 00:14:52 UTC (rev 251) @@ -57,6 +57,7 @@ void setFps(float fps); void setLoop(uint8_t loopAt, uint8_t rewindTo, uint8_t numLoops, uint8_t wait); void setTextColor(uint8_t textColor); + void setTextLocation(SPoint textLocation); private: std::string m_filename; @@ -74,8 +75,9 @@ float m_frametime; int8_t m_song; - uint8_t m_endWait; - uint8_t m_textColor; + uint8_t m_endWait, m_textColor; + SPoint m_textLocation; + float m_fps; videoLoop m_loop, m_loopTime; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-03 00:00:49 UTC (rev 250) +++ branches/dunks/src/IntroState.cpp 2008-05-03 00:14:52 UTC (rev 251) @@ -32,6 +32,7 @@ m_loopTime = videoLoop(0,0); m_textColor = 49; m_textSurface.reset(new Image(UPoint(320,40))); + m_textLocation = SPoint(0,0); font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); } @@ -111,6 +112,11 @@ m_textColor = textColor; } +void IntroState::Frame::setTextLocation(SPoint textLocation) +{ + m_textLocation = textLocation; +} + void IntroState::Frame::Load(Frame* lastframe) { printf("intro loading %s\n", m_filename.c_str()); @@ -258,7 +264,7 @@ }; }; - m_textSurface->blitToScreen(SPoint(0,Application::Instance()->Screen()->getSurface()->h/2 + m_scaledSurface->getSurface()->h/2 + 20)); + m_textSurface->blitToScreen(SPoint(0 + m_textLocation.x,Application::Instance()->Screen()->getSurface()->h/2 + m_scaledSurface->getSurface()->h/2 + 20 + m_textLocation.y)); } @@ -348,7 +354,7 @@ // m_introStrings.push_back(introText(0, "")); // credits.eng isn't properly decoded yet.. // DataCache::Instance()->getCreditsString(20))); - frame = new Frame("INTRO:WESTWOOD.WSA", + /*frame = new Frame("INTRO:WESTWOOD.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, false, 30); @@ -374,9 +380,9 @@ Frame::NO_TRANSITION, Frame::FADE_OUT, false, 20); - DataCache::Instance()->getIntroString(1), + frame->addText(0,DataCache::Instance()->getIntroString(1)); enque(frame); - +*/ frame = new Frame("INTRO:INTRO1.WSA", Frame::NO_TRANSITION, @@ -388,6 +394,7 @@ frame->concatSound(66, Intro_TheBuilding); frame->concatSound(66, Intro_OfADynasty); frame->addText(66, DataCache::Instance()->getIntroString(2)); + frame->setTextLocation(SPoint(0,-20)); enque(frame); frame = new Frame("INTRO:INTRO2.WSA", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-03 01:28:16
|
Revision: 253 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=253&view=rev Author: dvalin Date: 2008-05-02 18:28:14 -0700 (Fri, 02 May 2008) Log Message: ----------- * fix proper size and drawing of text * more timing fixes Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-03 00:16:51 UTC (rev 252) +++ branches/dunks/include/IntroState.h 2008-05-03 01:28:14 UTC (rev 253) @@ -49,15 +49,16 @@ bool Execute(float ft); void Load(Frame* lastframe); - void addText(uint16_t playAt, std::string introText); void addSound(uint16_t playAt, Sound_enum sound); void concatSound(uint16_t playAt, Sound_enum sound); + void setSong(uint8_t song); void setPalette(Palette_enum palette); - void setSong(uint8_t song); void setFps(float fps); void setLoop(uint8_t loopAt, uint8_t rewindTo, uint8_t numLoops, uint8_t wait); + void addText(uint16_t playAt, std::string introText); void setTextColor(uint8_t textColor); void setTextLocation(SPoint textLocation); + void setTextSize(float setTextSize); private: std::string m_filename; @@ -73,7 +74,7 @@ WsafilePtr m_wsa; uint8_t m_currentFrame, m_framesPlayed; - float m_frametime; + float m_frametime, m_textSize; int8_t m_song; uint8_t m_endWait, m_textColor; SPoint m_textLocation; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-03 00:16:51 UTC (rev 252) +++ branches/dunks/src/IntroState.cpp 2008-05-03 01:28:14 UTC (rev 253) @@ -32,7 +32,8 @@ m_loopTime = videoLoop(0,0); m_textColor = 49; m_textSurface.reset(new Image(UPoint(320,40))); - m_textLocation = SPoint(0,0); + m_textSize = 1.7; + m_textLocation = SPoint(20,20); font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); } @@ -117,6 +118,10 @@ m_textLocation = textLocation; } +void IntroState::Frame::setTextSize(float textSize) +{ + m_textSize = textSize; +} void IntroState::Frame::Load(Frame* lastframe) { printf("intro loading %s\n", m_filename.c_str()); @@ -182,6 +187,7 @@ }; m_scaledSurface->blitToScreenCentered(); + m_textSurface->blitToScreen(SPoint(0 + m_textLocation.x,Application::Instance()->Screen()->getSurface()->h/2 + m_scaledSurface->getSurface()->h/2 + m_textLocation.y)); return mb_finished; } @@ -193,7 +199,7 @@ if(m_introStrings.size() > 0){ if(m_framesPlayed == m_introStrings[0].first){ - ImagePtr tmp(new Image(UPoint(320,40))); + ImagePtr tmp(new Image(UPoint(360,50))); std::string text = m_introStrings[0].second; uint8_t numLines = 0; @@ -216,7 +222,7 @@ text = text.substr(linebreak, text.length()-linebreak); linebreak = text.find("\n",0); } - m_textSurface = tmp->getResized(2); + m_textSurface = tmp->getResized(m_textSize); m_introStrings.erase(m_introStrings.begin()); } @@ -264,9 +270,6 @@ }; }; - m_textSurface->blitToScreen(SPoint(0 + m_textLocation.x,Application::Instance()->Screen()->getSurface()->h/2 + m_scaledSurface->getSurface()->h/2 + 20 + m_textLocation.y)); - - } void IntroState::Frame::setupTransitionIn() @@ -312,6 +315,7 @@ bool done = true; SDL_Surface* screen = m_scaledSurface->getSurface(); + SDL_Surface* text = m_textSurface->getSurface(); SDL_Color* col = m_transitionPalette; const int fadeAmt = 3; @@ -329,6 +333,7 @@ }; SDL_SetPalette(screen, SDL_LOGPAL, m_transitionPalette, 0, 256); + SDL_SetPalette(text, SDL_LOGPAL, m_transitionPalette, 0, 256); if (done) { @@ -354,47 +359,52 @@ // m_introStrings.push_back(introText(0, "")); // credits.eng isn't properly decoded yet.. // DataCache::Instance()->getCreditsString(20))); - /*frame = new Frame("INTRO:WESTWOOD.WSA", + frame = new Frame("INTRO:WESTWOOD.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 30); + false, 20); frame->setSong(0); + frame->setFps(0.15); frame->setPalette(WESTWOOD_PAL); enque(frame); frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 30); + false, 3); frame->addText(0, "and"); + frame->setTextSize(2.0); + frame->setTextLocation(SPoint(-25,0)); enque(frame); // VIRGIN.CPS has it's own palette, handling of this needs to be implemented.. frame = new Frame("INTRO:VIRGIN.CPS", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 30); + false, 12); enque(frame); frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 20); + false, 1); frame->addText(0,DataCache::Instance()->getIntroString(1)); + frame->setTextLocation(SPoint(-25,0)); + frame->setTextSize(2.0); enque(frame); -*/ - + frame = new Frame("INTRO:INTRO1.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, false, 50); frame->setFps(0.05); frame->setSong(1); - frame->concatSound(66, Intro_Dune); + frame->addSound(46, Intro_Dune); frame->concatSound(66, Intro_TheBuilding); frame->concatSound(66, Intro_OfADynasty); frame->addText(66, DataCache::Instance()->getIntroString(2)); - frame->setTextLocation(SPoint(25,-20)); + frame->setTextLocation(SPoint(-13,-35)); + frame->setTextSize(2.0); enque(frame); frame = new Frame("INTRO:INTRO2.WSA", @@ -409,7 +419,7 @@ frame = new Frame("INTRO:INTRO3.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 30); + false, 25); frame->addSound(0, Intro_LandOfSand); frame->addText(0, DataCache::Instance()->getIntroString(4)); frame->concatSound(33, Intro_Home); @@ -422,7 +432,7 @@ Frame::NO_TRANSITION, Frame::FADE_OUT, false, 2); - frame->setFps(0.18); + frame->setFps(0.16); frame->addText(0, DataCache::Instance()->getIntroString(6)); frame->concatSound(0, Intro_TheSpice); frame->concatSound(0, Intro_Controls); @@ -438,7 +448,7 @@ frame = new Frame("INTRO:INTRO10.WSA", Frame::NO_TRANSITION, - Frame::FADE_OUT, + Frame::NO_TRANSITION, false, 25); frame->addText(0, DataCache::Instance()->getIntroString(8)); frame->concatSound(0, Intro_TheEmperor); @@ -457,7 +467,7 @@ frame->concatSound(0, Intro_ThatProduces); frame->concatSound(0, Intro_TheMostSpice); frame->concatSound(0, Intro_WillControlDune); - frame->setLoop(45, 0, 1, 15); + frame->setLoop(45, 0, 1, 14); frame->concatSound(61, Intro_ThereAreNoSet); frame->concatSound(61, Intro_Territories); frame->concatSound(61, Intro_AndNo); @@ -470,16 +480,19 @@ frame = new Frame("INTRO:INTRO4.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 5); + false); frame->addText(11, DataCache::Instance()->getIntroString(12)); frame->concatSound(11, Intro_VastArmies); frame->concatSound(11, Intro_HasArrived); enque(frame); - frame = new Frame(DataCache::Instance()->getIntroString(13), + frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 50); + false, 23); + frame->addText(0,DataCache::Instance()->getIntroString(13)); + frame->setTextLocation(SPoint(-25,0)); + frame->setTextSize(2.0); frame->concatSound(0, Intro_AndNow); frame->concatSound(0, Intro_3Houses); frame->concatSound(0, Intro_ForControl); @@ -491,7 +504,7 @@ Frame::NO_TRANSITION, Frame::FADE_OUT, false); - frame->setFps(0.1); + frame->setFps(0.08); frame->addText(0, DataCache::Instance()->getIntroString(14)); frame->addSound(0, Intro_TheNobleAtreides); frame->addSound(31, Intro_Glass); @@ -553,7 +566,7 @@ Frame::FADE_OUT, false); frame->setFps(0.2); - frame->setLoop(3, 0, 10, 0); + frame->setLoop(3, 0, 5, 0); frame->addText(0, DataCache::Instance()->getIntroString(17)); frame->concatSound(0, Intro_OnlyOneHouse); frame->concatSound(0, Intro_WillPrevail); @@ -563,8 +576,10 @@ frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 20); + false, 19); frame->addText(0, DataCache::Instance()->getIntroString(18)); + frame->setTextLocation(SPoint(-20,0)); + frame->setTextSize(2.0); frame->concatSound(0, Intro_Your); frame->concatSound(0, Intro_BattleForDune); frame->concatSound(0, Intro_Begins); @@ -576,6 +591,8 @@ Frame::FADE_OUT, false, 15); frame->addText(0, DataCache::Instance()->getIntroString(19)); + frame->setTextLocation(SPoint(-20,0)); + frame->setTextSize(2.0); frame->addSound(0, Intro_Now); enque(frame); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-03 06:13:47
|
Revision: 256 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=256&view=rev Author: dvalin Date: 2008-05-02 23:13:45 -0700 (Fri, 02 May 2008) Log Message: ----------- * make it possible to add multiple loops per scene * more timing fixes.. Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-03 01:45:51 UTC (rev 255) +++ branches/dunks/include/IntroState.h 2008-05-03 06:13:45 UTC (rev 256) @@ -54,7 +54,7 @@ void setSong(uint8_t song); void setPalette(Palette_enum palette); void setFps(float fps); - void setLoop(uint8_t loopAt, uint8_t rewindTo, uint8_t numLoops, uint8_t wait); + void addLoop(uint8_t loopAt, uint8_t rewindTo, uint8_t numLoops, uint8_t wait); void addText(uint16_t playAt, std::string introText); void setTextColor(uint8_t textColor); void setTextLocation(SPoint textLocation); @@ -84,7 +84,8 @@ ImagePtr m_animSurface, m_scaledSurface, m_textSurface; SDL_Color* m_transitionPalette; - Font* font; + Font* font; + std::vector<videoLoop> m_loops; std::vector<introText> m_introStrings; std::vector<introSound> m_introSounds; std::vector<soundChunk> m_soundChunks; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-03 01:45:51 UTC (rev 255) +++ branches/dunks/src/IntroState.cpp 2008-05-03 06:13:45 UTC (rev 256) @@ -28,8 +28,6 @@ m_song = -1; m_fps = 0; m_endWait = endWait; - m_loop = videoLoop(0,0); - m_loopTime = videoLoop(0,0); m_textColor = 49; m_textSurface.reset(new Image(UPoint(320,40))); m_textSize = 1.7; @@ -102,10 +100,10 @@ m_fps = fps; } -void IntroState::Frame::setLoop(uint8_t loopAt, uint8_t rewindTo, uint8_t numLoops, uint8_t wait) +void IntroState::Frame::addLoop(uint8_t loopAt, uint8_t rewindTo, uint8_t numLoops, uint8_t wait) { - m_loop = videoLoop(loopAt, rewindTo); - m_loopTime = videoLoop(numLoops, wait); + m_loops.push_back(videoLoop(loopAt, rewindTo)); + m_loops.push_back(videoLoop(numLoops, wait)); } void IntroState::Frame::setTextColor(uint8_t textColor) @@ -160,8 +158,8 @@ m_animSurface.reset(m_wsa->getPicture(m_currentFrame, m_palette)); m_scaledSurface = m_animSurface->getResized(2.0); - if(m_endWait && !m_loop.first) - setLoop(m_wsa->getNumFrames(), m_wsa->getNumFrames(), 1, m_endWait); + if(m_endWait) + addLoop(m_wsa->getNumFrames(), m_wsa->getNumFrames(), 1, m_endWait); } bool IntroState::Frame::Execute(float dt) @@ -196,8 +194,6 @@ void IntroState::Frame::doPlaying(float dt) { - Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); - if(m_introStrings.size() > 0){ if(m_framesPlayed == m_introStrings[0].first){ ImagePtr tmp(new Image(UPoint(360,50))); @@ -249,16 +245,25 @@ if (m_frametime > m_wsa->getFPS()) { - if(!(m_currentFrame == m_loop.first - 1 && m_framesPlayed < m_loop.first + m_loopTime.second)) + if(m_loops.size() > 0) + { + if(!(m_currentFrame == m_loops[0].first - 1 && m_framesPlayed < m_loops[0].first + m_loops[1].second)) + m_currentFrame++; + if(m_loops[1].first != 0 && m_currentFrame == m_loops[0].first) + { + m_currentFrame = m_loops[0].second; + m_loops[1].first--; + } + if(m_loops[1].first == 0){ + m_loops.erase(m_loops.begin()); + m_loops.erase(m_loops.begin()); + } + }else m_currentFrame++; - if(m_loopTime.first != 0 && m_currentFrame == m_loop.first) - { - m_currentFrame = m_loop.second; - m_loopTime.first--; - } m_framesPlayed++; + m_frametime = 0.0f; if (m_currentFrame >= m_wsa->getNumFrames()) { @@ -397,13 +402,14 @@ frame = new Frame("INTRO:INTRO1.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 50); - frame->setFps(0.05); + false, 65); + frame->setFps(0.07); + frame->addLoop(1,1,0,20); frame->setSong(1); - frame->addSound(46, Intro_Dune); - frame->concatSound(66, Intro_TheBuilding); - frame->concatSound(66, Intro_OfADynasty); - frame->addText(66, DataCache::Instance()->getIntroString(2)); + frame->addSound(30, Intro_Dune); + frame->concatSound(70, Intro_TheBuilding); + frame->concatSound(70, Intro_OfADynasty); + frame->addText(70, DataCache::Instance()->getIntroString(2)); frame->setTextLocation(SPoint(-13,-35)); frame->setTextSize(2.0); enque(frame); @@ -412,8 +418,8 @@ Frame::NO_TRANSITION, Frame::FADE_OUT, false, 5); - frame->concatSound(5, Intro_ThePlanetArrakis); - frame->concatSound(5, Intro_KnownAsDune); + frame->concatSound(10, Intro_ThePlanetArrakis); + frame->concatSound(10, Intro_KnownAsDune); frame->addText(5, DataCache::Instance()->getIntroString(3)); enque(frame); @@ -468,7 +474,7 @@ frame->concatSound(0, Intro_ThatProduces); frame->concatSound(0, Intro_TheMostSpice); frame->concatSound(0, Intro_WillControlDune); - frame->setLoop(45, 0, 1, 14); + frame->addLoop(45, 0, 1, 14); frame->concatSound(61, Intro_ThereAreNoSet); frame->concatSound(61, Intro_Territories); frame->concatSound(61, Intro_AndNo); @@ -490,7 +496,7 @@ frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 23); + false, 28); frame->addText(0,DataCache::Instance()->getIntroString(13)); frame->setTextLocation(SPoint(-25,0)); frame->setTextSize(2.0); @@ -567,7 +573,7 @@ Frame::FADE_OUT, false); frame->setFps(0.2); - frame->setLoop(3, 0, 5, 0); + frame->addLoop(3, 0, 10, 0); frame->addText(0, DataCache::Instance()->getIntroString(17)); frame->concatSound(0, Intro_OnlyOneHouse); frame->concatSound(0, Intro_WillPrevail); @@ -577,7 +583,7 @@ frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 19); + false, 22); frame->addText(0, DataCache::Instance()->getIntroString(18)); frame->setTextLocation(SPoint(-20,0)); frame->setTextSize(2.0); @@ -590,7 +596,7 @@ frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 15); + false, 20); frame->addText(0, DataCache::Instance()->getIntroString(19)); frame->setTextLocation(SPoint(-20,0)); frame->setTextSize(2.0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-03 20:50:07
|
Revision: 257 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=257&view=rev Author: dvalin Date: 2008-05-03 13:50:04 -0700 (Sat, 03 May 2008) Log Message: ----------- add fading of text Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-03 06:13:45 UTC (rev 256) +++ branches/dunks/include/IntroState.h 2008-05-03 20:50:04 UTC (rev 257) @@ -76,7 +76,8 @@ float m_frametime, m_textSize; int8_t m_song; - uint8_t m_endWait, m_textColor; + uint8_t m_endWait, m_textColor, m_textTransition; + uint16_t m_totalFrames; SPoint m_textLocation; float m_fps; @@ -100,6 +101,7 @@ void doTransitionIn(float dt); void doTransitionOut(float dt); + void doTransitionOut(ImagePtr img, bool done = false, bool forceTransition = false, const int fadeAmt = 4); void doPlaying(float dt); void doHolding(float dt); }; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-03 06:13:45 UTC (rev 256) +++ branches/dunks/src/IntroState.cpp 2008-05-03 20:50:04 UTC (rev 257) @@ -32,6 +32,7 @@ m_textSurface.reset(new Image(UPoint(320,40))); m_textSize = 1.7; m_textLocation = SPoint(20,20); + m_textTransition = 0; font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); } @@ -155,6 +156,12 @@ m_currentFrame = 0; m_framesPlayed = 0; mb_finished = false; + uint8_t loopFrames = 0; + for(uint8_t i = 0; i < m_loops.size(); i = i+2) + { + loopFrames += (m_loops[i].first - m_loops[i].second) * m_loops[i+1].first + m_loops[i+1].second; + } + m_totalFrames = m_wsa->getNumFrames() + m_endWait + loopFrames; m_animSurface.reset(m_wsa->getPicture(m_currentFrame, m_palette)); m_scaledSurface = m_animSurface->getResized(2.0); @@ -198,7 +205,9 @@ if(m_framesPlayed == m_introStrings[0].first){ ImagePtr tmp(new Image(UPoint(360,50))); std::string text = m_introStrings[0].second; - + // Here we try to figure out how long the text should be displayed + // relative to it's length. Room for improval.. + m_textTransition = m_framesPlayed + (text.length()/m_wsa->getFPS()/100*9); uint8_t numLines = 0; int linebreak = text.find("\n",0)+ 1; std::string thisLine; @@ -220,10 +229,18 @@ linebreak = text.find("\n",0); } m_textSurface = tmp->getResized(m_textSize); - m_introStrings.erase(m_introStrings.begin()); + // Something wrong happens here that prevents the fading and only removes the text + if(m_introStrings.size() > 0) + if(m_textTransition > m_introStrings[0].first - 4) + m_textTransition = m_introStrings[0].first - 4; + else if(m_textTransition > m_totalFrames - 2) + m_textTransition = m_totalFrames - 2; } } + if(m_framesPlayed >= m_textTransition){ + doTransitionOut(m_textSurface, false, true, 6); + } if(m_introSounds.size() > 0){ if(m_framesPlayed == m_introSounds[0].first){ @@ -232,6 +249,7 @@ m_introSounds.erase(m_introSounds.begin()); } } + if(m_soundChunks.size() > 0){ if(m_framesPlayed == m_soundChunks[0].first){ Mix_Chunk* sound = m_soundChunks[0].second; @@ -308,10 +326,15 @@ delete m_transitionPalette; } -void IntroState::Frame::doTransitionOut(float dt) +void IntroState::Frame::doTransitionOut(float dt) { + doTransitionOut(m_scaledSurface, true); + doTransitionOut(m_textSurface, true, true); +} - if (m_transition_out == NO_TRANSITION) +void IntroState::Frame::doTransitionOut(ImagePtr img, bool done, bool forceTransition, const int fadeAmt) +{ + if (m_transition_out == NO_TRANSITION && !forceTransition) { mb_finished = true; return; @@ -319,12 +342,9 @@ if (m_transitionPalette == NULL) setupTransitionOut(); - bool done = true; - SDL_Surface* screen = m_scaledSurface->getSurface(); - SDL_Surface* text = m_textSurface->getSurface(); + SDL_Surface* screen = img->getSurface(); SDL_Color* col = m_transitionPalette; - const int fadeAmt = 4; for (int i=0; i!=256; i++, col++) { @@ -339,7 +359,6 @@ }; SDL_SetPalette(screen, SDL_LOGPAL, m_transitionPalette, 0, 256); - SDL_SetPalette(text, SDL_LOGPAL, m_transitionPalette, 0, 256); if (done) { @@ -377,7 +396,7 @@ frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 3); + false, 4); frame->addText(0, "and"); frame->setTextSize(2.0); frame->setTextLocation(SPoint(-25,0)); @@ -393,7 +412,7 @@ frame = new Frame("", Frame::NO_TRANSITION, Frame::FADE_OUT, - false, 2); + false, 4); frame->addText(0,DataCache::Instance()->getIntroString(1)); frame->setTextLocation(SPoint(-25,0)); frame->setTextSize(2.0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-03 23:00:40
|
Revision: 258 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=258&view=rev Author: dvalin Date: 2008-05-03 16:00:38 -0700 (Sat, 03 May 2008) Log Message: ----------- make it possible to define channel for sound to playmake it possible to define channel for sound to playmake it possible to define channel for sound to playmake it possible to define channel for sound to playmake it possible to define channel for sound to playmake it possible to define channel for sound to playmake it possible to define channel for sound to playmake it possible to define channel for sound to playmake it possible to define channel for sound to play Modified Paths: -------------- branches/dunks/include/SoundPlayerClass.h branches/dunks/src/SoundPlayerClass.cpp Modified: branches/dunks/include/SoundPlayerClass.h =================================================================== --- branches/dunks/include/SoundPlayerClass.h 2008-05-03 20:50:04 UTC (rev 257) +++ branches/dunks/include/SoundPlayerClass.h 2008-05-03 23:00:38 UTC (rev 258) @@ -8,6 +8,7 @@ #include "dMath.h" #include "SDL_mixer.h" +#if 0 //! \enum MUSICTYPE /*! Types of music available in the game*/ typedef enum { MUSIC_ATTACK, /*!<Played when at least one of player's units was hit. */ @@ -17,7 +18,7 @@ MUSIC_WIN, /*!<Victory screen background music.. */ MUSIC_RANDOM /*!<Player used key combination to change current music. */ } MUSICTYPE; - +#endif /*! Class that handles sounds and music. */ @@ -61,7 +62,7 @@ void playVoice(Sound_enum id, HOUSETYPE house); void playSound(Sound_enum soundID); - void playSound(Mix_Chunk* sound); + void playSound(Mix_Chunk* sound, int channel = 0); inline int GetSfxVolume() { return sfxVolume; }; void SetSfxVolume(int newVolume) { Modified: branches/dunks/src/SoundPlayerClass.cpp =================================================================== --- branches/dunks/src/SoundPlayerClass.cpp 2008-05-03 20:50:04 UTC (rev 257) +++ branches/dunks/src/SoundPlayerClass.cpp 2008-05-03 23:00:38 UTC (rev 258) @@ -304,10 +304,10 @@ } } -void SoundPlayerClass::playSound(Mix_Chunk* sound) { +void SoundPlayerClass::playSound(Mix_Chunk* sound, int channel) { if (soundOn) { - Mix_PlayChannel(-1, sound, 0); + Mix_PlayChannel(channel, sound, 0); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-04 03:44:08
|
Revision: 264 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=264&view=rev Author: dvalin Date: 2008-05-03 20:44:05 -0700 (Sat, 03 May 2008) Log Message: ----------- drop creation of wsa based on cps picture (1x1 wsa should be removed eventually as well) Modified Paths: -------------- branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/pakfile/Wsafile.cpp Modified: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h 2008-05-04 03:17:23 UTC (rev 263) +++ branches/dunks/include/pakfile/Wsafile.h 2008-05-04 03:44:05 UTC (rev 264) @@ -19,7 +19,6 @@ public: Wsafile(uint8_t * bufFiledata, int bufsize, SDL_Surface* lastframe = NULL, float setFps = 0 ); - Wsafile(Cpsfile* cpsFile); Wsafile(); ~Wsafile(); Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2008-05-04 03:17:23 UTC (rev 263) +++ branches/dunks/src/pakfile/Wsafile.cpp 2008-05-04 03:44:05 UTC (rev 264) @@ -68,21 +68,6 @@ decodeFrames(); } -Wsafile::Wsafile(Cpsfile* cpsFile) : Decode() -{ - WsaFilesize = -2; - - printf("loading cps file as wsa...\n"); - - NumFrames = 1; - fps = 0.1; - - printf("FramesPer1024ms = %d\n", FramesPer1024ms); - printf("FPS = %.3f\n", fps); - decodedFrames = NULL; - m_cpsFile = cpsFile; -} - Wsafile::Wsafile() : Decode() { WsaFilesize = -1; @@ -110,10 +95,6 @@ return img; } - if(WsaFilesize == -2){ - return m_cpsFile->getPicture(); - } - if(FrameNumber >= NumFrames) { return NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-04 04:20:21
|
Revision: 265 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=265&view=rev Author: dvalin Date: 2008-05-03 21:20:19 -0700 (Sat, 03 May 2008) Log Message: ----------- draw VIRGIN.CPS in Frame class in stead.. Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-04 03:44:05 UTC (rev 264) +++ branches/dunks/include/IntroState.h 2008-05-04 04:20:19 UTC (rev 265) @@ -96,7 +96,7 @@ void setupTransitionIn(); - void setupTransitionOut(); + void setupTransitionOut(ImagePtr img); void cleanupTransitionIn(); void cleanupTransitionOut(); Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-04 03:44:05 UTC (rev 264) +++ branches/dunks/src/IntroState.cpp 2008-05-04 04:20:19 UTC (rev 265) @@ -137,6 +137,7 @@ bool isWsa = m_filename.size() > 3 && wsaSuffix == m_filename.size() - 4; bool isCps = m_filename.size() > 3 && cpsSuffix == m_filename.size() - 4; + CpsfilePtr tmp; if(isWsa || isCps){ int len; uint8_t * data = ResMan::Instance()->readFile(m_filename, &len); @@ -152,12 +153,15 @@ { m_wsa.reset(new Wsafile(data, len, NULL, m_fps)); } - }else if(isCps){ - m_wsa.reset(new Wsafile(new Cpsfile(data, len, m_palette))); + }else{ + if(isCps){ + tmp.reset(new Cpsfile(data, len)); + m_wsa.reset(new Wsafile()); + } } - } - else + }else m_wsa.reset(new Wsafile()); + m_frametime = 0; m_currentFrame = 0; @@ -169,8 +173,14 @@ loopFrames += (m_loops[i].first - m_loops[i].second) * m_loops[i+1].first + m_loops[i+1].second; } m_totalFrames = m_wsa->getNumFrames() + m_endWait + loopFrames; - - m_animSurface.reset(m_wsa->getPicture(m_currentFrame, m_palette)); + if(isCps){ + // A bit retarded, needs to be cleaned up later.. + m_animSurface.reset(tmp->getPicture()); + m_palette = m_animSurface->getSurface()->format->palette; + m_textSurface = m_animSurface->getResized(2); + setTextLocation(SPoint(0,-200)); + } + m_animSurface.reset(m_wsa->getPicture(m_currentFrame, m_palette)); m_scaledSurface = m_animSurface->getResized(2.0); if(m_endWait) addLoop(m_wsa->getNumFrames(), m_wsa->getNumFrames(), 1, m_endWait); @@ -310,17 +320,16 @@ { if(m_song != -1){ Application::Instance()->playSound(DataCache::Instance()->getMusic(MUSIC_INTRO, m_song)); - std::cout << "play!" << std::endl; } if (m_transition_in == NO_TRANSITION) m_state = PLAYING; } -void IntroState::Frame::setupTransitionOut() +void IntroState::Frame::setupTransitionOut(ImagePtr img) { m_transitionPalette = new SDL_Color[256]; memcpy((unsigned char*)m_transitionPalette, - m_palette->colors, + img->getSurface()->format->palette->colors, sizeof(SDL_Color) * 256); } @@ -343,7 +352,7 @@ return; } - if (m_transitionPalette == NULL) setupTransitionOut(); + if (m_transitionPalette == NULL) setupTransitionOut(img); SDL_Surface* screen = img->getSurface(); SDL_Color* col = m_transitionPalette; @@ -405,7 +414,6 @@ frame->setTextLocation(SPoint(-25,0)); enque(frame); - // VIRGIN.CPS has it's own palette, handling of this needs to be implemented.. frame = new Frame("INTRO:VIRGIN.CPS", Frame::NO_TRANSITION, Frame::FADE_OUT, @@ -428,7 +436,7 @@ frame->setFps(0.07); frame->addLoop(1,1,0,20); frame->setSong(1); - frame->concatSound(30, Intro_Dune); + frame->addSound(30, Intro_Dune); frame->concatSound(70, Intro_TheBuilding); frame->concatSound(70, Intro_OfADynasty); frame->addText(70, DataCache::Instance()->getIntroString(2)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-27 21:00:50
|
Revision: 276 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=276&view=rev Author: dvalin Date: 2008-05-27 14:00:17 -0700 (Tue, 27 May 2008) Log Message: ----------- don't bundle libsamplerate, link against external library in stead Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/src/SConscript branches/dunks/src/pakfile/sound/Vocfile.cpp branches/dunks/src/pakfile/sound/adl/adl.cpp Removed Paths: ------------- branches/dunks/include/pakfile/sound/IntegratedLibSampleRate/ branches/dunks/src/pakfile/sound/IntegratedLibSampleRate/ Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2008-05-27 16:34:45 UTC (rev 275) +++ branches/dunks/SConstruct 2008-05-27 21:00:17 UTC (rev 276) @@ -23,7 +23,7 @@ env.Append(CPPPATH="#include") if sys.platform != "win32": - env.ParseConfig('sdl-config --cflags --libs') + env.ParseConfig('pkg-config --cflags sdl samplerate') env.Append(CCFLAGS=["-Wall", "-pedantic", "-O0"]) #, "-Werror"]) #env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) #env.Append(LINKFLAGS = ["-ffast-math"]) @@ -39,6 +39,7 @@ "SDL_mixer", "SDL_net", "SDL_ttf", + "samplerate", ]) Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2008-05-27 16:34:45 UTC (rev 275) +++ branches/dunks/src/SConscript 2008-05-27 21:00:17 UTC (rev 276) @@ -39,10 +39,6 @@ "pakfile/Animation.cpp", "pakfile/Stringfile.cpp", "pakfile/sound/Vocfile.cpp", - "pakfile/sound/IntegratedLibSampleRate/samplerate.c", - "pakfile/sound/IntegratedLibSampleRate/src_linear.c", - "pakfile/sound/IntegratedLibSampleRate/src_sinc.c", - "pakfile/sound/IntegratedLibSampleRate/src_zoh.c", "pakfile/sound/adl/adl.cpp", "pakfile/sound/adl/emuopl.cpp", "pakfile/sound/adl/fmopl.cpp" @@ -79,11 +75,7 @@ "State.cpp", "TopLevelState.cpp", "SoundPlayerClass.cpp", - "pakfile/Vocfile.cpp", - "pakfile/IntegratedLibSampleRate/samplerate.c", - "pakfile/IntegratedLibSampleRate/src_linear.c", - "pakfile/IntegratedLibSampleRate/src_sinc.c", - "pakfile/IntegratedLibSampleRate/src_zoh.c" + "pakfile/Vocfile.cpp" ] #gamelib = env.StaticLibrary("dune_game", all_sources) Modified: branches/dunks/src/pakfile/sound/Vocfile.cpp =================================================================== --- branches/dunks/src/pakfile/sound/Vocfile.cpp 2008-05-27 16:34:45 UTC (rev 275) +++ branches/dunks/src/pakfile/sound/Vocfile.cpp 2008-05-27 21:00:17 UTC (rev 276) @@ -19,7 +19,7 @@ */ #include "pakfile/sound/Vocfile.h" -#include "pakfile/sound/IntegratedLibSampleRate/samplerate.h" +#include <samplerate.h> #include <string> #include <SDL_mixer.h> #include <math.h> Modified: branches/dunks/src/pakfile/sound/adl/adl.cpp =================================================================== --- branches/dunks/src/pakfile/sound/adl/adl.cpp 2008-05-27 16:34:45 UTC (rev 275) +++ branches/dunks/src/pakfile/sound/adl/adl.cpp 2008-05-27 21:00:17 UTC (rev 276) @@ -57,7 +57,7 @@ #include "pakfile/sound/adl/adl.h" #include "pakfile/sound/adl/emuopl.h" -#include "pakfile/sound/IntegratedLibSampleRate/samplerate.h" +#include <samplerate.h> #define BUFSIZE 65536 // Sound buffer size in samples #define NUM_SAMPLES_OF_SILENCE 10 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |