You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(44) |
Aug
(36) |
Sep
(5) |
Oct
|
Nov
(6) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
|
Apr
(87) |
May
(54) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dv...@us...> - 2008-04-28 18:01:26
|
Revision: 176 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=176&view=rev Author: dvalin Date: 2008-04-28 11:00:53 -0700 (Mon, 28 Apr 2008) Log Message: ----------- add support for animations (merged from richies branch) Modified Paths: -------------- branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/pakfile/Wsafile.cpp Added Paths: ----------- branches/dunks/include/pakfile/Animation.h branches/dunks/src/pakfile/Animation.cpp Added: branches/dunks/include/pakfile/Animation.h =================================================================== --- branches/dunks/include/pakfile/Animation.h (rev 0) +++ branches/dunks/include/pakfile/Animation.h 2008-04-28 18:00:53 UTC (rev 176) @@ -0,0 +1,33 @@ +#ifndef ANIMATION_H_INCLUDED +#define ANIMATION_H_INCLUDED + +#include <SDL.h> +#include "Gfx.h" + +class Animation +{ +public: + Animation(); + ~Animation(); + + Image * getFrame(); + void setFrameRate(double FrameRate) { + if(FrameRate == 0.0) { + FrameDurationTime = 1; + } else { + FrameDurationTime = (int) (1000.0/FrameRate); + } + } + + void addFrame(Image * newFrame, bool SetColorKey = false); + +private: + Uint32 CurFrameStartTime; + Uint32 FrameDurationTime; + int curFrame; + int NumFrames; + Image ** Frame; +}; + +#endif // ANIMATION_H_INCLUDED + Property changes on: branches/dunks/include/pakfile/Animation.h ___________________________________________________________________ Name: svn:eol-style + native Modified: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h 2008-04-28 00:38:26 UTC (rev 175) +++ branches/dunks/include/pakfile/Wsafile.h 2008-04-28 18:00:53 UTC (rev 176) @@ -3,6 +3,7 @@ #include "Gfx.h" #include "pakfile/Decode.h" +#include "pakfile/Animation.h" #include "SDL.h" #include <boost/shared_ptr.hpp> @@ -20,6 +21,8 @@ Image * getPicture(Uint32 FrameNumber, SDL_Palette *palette); + Animation* getAnimation(unsigned int startindex, unsigned int endindex, SDL_Palette *palette, bool SetColorKey=true); + inline int getNumFrames() { return (int) NumFrames; }; inline Uint32 getFramesPer1024ms() { return FramesPer1024ms; }; inline float getFPS() { return fps; } Added: branches/dunks/src/pakfile/Animation.cpp =================================================================== --- branches/dunks/src/pakfile/Animation.cpp (rev 0) +++ branches/dunks/src/pakfile/Animation.cpp 2008-04-28 18:00:53 UTC (rev 176) @@ -0,0 +1,49 @@ +#include "pakfile/Animation.h" +#include <stdio.h> +#include <stdlib.h> +Animation::Animation() { + CurFrameStartTime = SDL_GetTicks(); + FrameDurationTime = 1; + NumFrames = 0; + curFrame = 0; + Frame = NULL; +} + +Animation::~Animation() { + if(Frame != NULL) { + for(int i=0; i < NumFrames; i++) { + SDL_FreeSurface(Frame[i]->getSurface()); +// Frame[i] = NULL; + } + free(Frame); + } +} + +Image * Animation::getFrame() { + if(Frame == NULL) { + return NULL; + } + + if((SDL_GetTicks() - CurFrameStartTime) > FrameDurationTime) { + CurFrameStartTime = SDL_GetTicks(); + curFrame++; + if(curFrame >= NumFrames) { + curFrame = 0; + } + } + return Frame[curFrame]; +} + +void Animation::addFrame(Image * newFrame, bool SetColorKey) { + if((Frame = (Image **) realloc(Frame,sizeof(Image *) * (NumFrames+1))) == NULL) { + perror("Animation::addFrame()"); + exit(EXIT_FAILURE); + } + + Frame[NumFrames] = newFrame; + + if(SetColorKey == true) { + SDL_SetColorKey((Frame[NumFrames])->getSurface(), SDL_SRCCOLORKEY | SDL_RLEACCEL, 0); + } + NumFrames++; +} Property changes on: branches/dunks/src/pakfile/Animation.cpp ___________________________________________________________________ Name: svn:eol-style + native Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2008-04-28 00:38:26 UTC (rev 175) +++ branches/dunks/src/pakfile/Wsafile.cpp 2008-04-28 18:00:53 UTC (rev 176) @@ -110,6 +110,36 @@ } +/// Returns an animation +/** + This method returns a new animation object with all pictures from startindex to endindex + in it. The returned pointer should be freed with delete if no longer needed. If an error + occured, NULL is returned. + \param startindex index of the first picture + \param endindex index of the last picture + \param DoublePic if true, the picture is scaled up by a factor of 2 + \param SetColorKey if true, black is set as transparency + \return a new animation object or NULL on error +*/ +Animation* Wsafile::getAnimation(unsigned int startindex, unsigned int endindex, SDL_Palette *palette, bool SetColorKey) +{ + Animation* tmpAnimation; + Image* tmp; + + if((tmpAnimation = new Animation()) == NULL) { + return NULL; + } + + for(unsigned int i = startindex; i <= endindex; i++) { + if((tmp = getPicture(i, palette)) == NULL) { + delete tmpAnimation; + return NULL; + } + tmpAnimation->addFrame(tmp,SetColorKey); + } + return tmpAnimation; +} + void Wsafile::decodeFrames() { unsigned char *dec80; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-28 00:38:31
|
Revision: 175 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=175&view=rev Author: dvalin Date: 2008-04-27 17:38:26 -0700 (Sun, 27 Apr 2008) Log Message: ----------- remove these in favour of new house choice menus.. Removed Paths: ------------- branches/dunks/include/CampaignMenu.h branches/dunks/src/CampaignMenu.cpp Deleted: branches/dunks/include/CampaignMenu.h =================================================================== --- branches/dunks/include/CampaignMenu.h 2008-04-28 00:37:49 UTC (rev 174) +++ branches/dunks/include/CampaignMenu.h 2008-04-28 00:38:26 UTC (rev 175) @@ -1,30 +0,0 @@ -#ifndef DUNE_CAMPAIGNMENU_H -#define DUNE_CAMPAIGNMENU_H - -#include "MenuBase.h" -#include "gui2/Button.h" -#include "gui2/VBox.h" - -#include "SDL.h" - - -class CampaignMenuState : public MenuBaseState -{ - public: - CampaignMenuState(); - ~CampaignMenuState(); - - void doCancel(); - - int Execute(float dt); - virtual const char* GetName() { return "CampaignMenuState"; } - - private: - VBox* m_vbox; - - BoringButton* m_butCancel; - ImagePtr m_surf; - -}; - -#endif // DUNE_CAMPAIGNMENU_H Deleted: branches/dunks/src/CampaignMenu.cpp =================================================================== --- branches/dunks/src/CampaignMenu.cpp 2008-04-28 00:37:49 UTC (rev 174) +++ branches/dunks/src/CampaignMenu.cpp 2008-04-28 00:38:26 UTC (rev 175) @@ -1,39 +0,0 @@ -#include "CampaignMenu.h" - -#include "Application.h" -#include "Settings.h" -#include "DataCache.h" -#include "pakfile/Cpsfile.h" -#include "boost/bind.hpp" - - -CampaignMenuState::CampaignMenuState() -{ - int len; - unsigned char * data = ResMan::Instance()->readFile("ENGLISH:HERALD.ENG", &len); - - CpsfilePtr m_cps (new Cpsfile(data, len)); - - m_surf.reset(m_cps->getPicture()); - m_surf = m_surf->getResized(2); - -} - -CampaignMenuState::~CampaignMenuState() -{ -} - -void CampaignMenuState::doCancel() -{ - assert(mp_parent != NULL); - PopState(); -} - -int CampaignMenuState::Execute(float dt) -{ - m_surf.get()->blitToScreen(SPoint(Settings::Instance()->GetWidth() / 2 - m_surf->getSurface()->w/2, - Settings::Instance()->GetHeight() / 8)); - - return 0; -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-28 00:37:51
|
Revision: 174 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=174&view=rev Author: dvalin Date: 2008-04-27 17:37:49 -0700 (Sun, 27 Apr 2008) Log Message: ----------- start on adding the menus for house selection Modified Paths: -------------- branches/dunks/src/SingleMenu.cpp Added Paths: ----------- branches/dunks/include/HouseChoiceInfoMenu.h branches/dunks/include/HouseChoiceMenu.h branches/dunks/include/MentatMenu.h branches/dunks/src/HouseChoiceInfoMenu.cpp branches/dunks/src/HouseChoiceMenu.cpp branches/dunks/src/MentatMenu.cpp Added: branches/dunks/include/HouseChoiceInfoMenu.h =================================================================== --- branches/dunks/include/HouseChoiceInfoMenu.h (rev 0) +++ branches/dunks/include/HouseChoiceInfoMenu.h 2008-04-28 00:37:49 UTC (rev 174) @@ -0,0 +1,18 @@ +#ifndef HOUSECHOICEINFOMENU_H_INCLUDED +#define HOUSECHOICEINFOMENU_H_INCLUDED + +#include "MentatMenu.h" +class HouseChoiceInfoMenuState : public MentatMenuState { + public: + HouseChoiceInfoMenuState(HOUSETYPE newHouse); + ~HouseChoiceInfoMenuState(); + + virtual const char* GetName() { return "HouseChoiceInfoMenuState"; } + + private: + GraphicButton* m_butYes; + GraphicButton* m_butNo; +}; + +#endif // HOUSECHOICEINFOMENU_H_INCLUDED + Property changes on: branches/dunks/include/HouseChoiceInfoMenu.h ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/include/HouseChoiceMenu.h =================================================================== --- branches/dunks/include/HouseChoiceMenu.h (rev 0) +++ branches/dunks/include/HouseChoiceMenu.h 2008-04-28 00:37:49 UTC (rev 174) @@ -0,0 +1,29 @@ +#ifndef HOUSECHOICEMENU_H_INCLUDED +#define HOUSECHOICEMENU_H_INCLUDED + +#include "MenuBase.h" + +class TranspButton; +class VBox; + +class HouseChoiceMenuState : public MenuBaseState { +public: + HouseChoiceMenuState(); + ~HouseChoiceMenuState(); + + int Execute(float dt); + virtual const char* GetName() { return "HouseChoiceMenuState"; } + + +private: + void doAtreides(); + void doOrdos(); + void doHarkonnen(); + VBox* m_vbox; + + TranspButton* m_butAtreides; + TranspButton* m_butOrdos; + TranspButton* m_butHarkonnen; +}; + +#endif // HOUSECHOICEMENU_H_INCLUDED Property changes on: branches/dunks/include/HouseChoiceMenu.h ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/include/MentatMenu.h =================================================================== --- branches/dunks/include/MentatMenu.h (rev 0) +++ branches/dunks/include/MentatMenu.h 2008-04-28 00:37:49 UTC (rev 174) @@ -0,0 +1,43 @@ +#ifndef MENTATMENU_H_INCLUDED +#define MENTATMENU_H_INCLUDED + +#include "MenuBase.h" +#include "houses.h" +#include "gui2/Button.h" +#include "gui2/VBox.h" + +#include "SDL.h" + +class MentatMenuState : public MenuBaseState +{ + public: + MentatMenuState(HOUSETYPE newHouse); + ~MentatMenuState(); + +/* void DrawSpecificStuff(); + + void setText(std::string text) { + TextLabel.SetText(text.c_str()); + TextLabel.SetVisible(true); + TextLabel.Resize(620,120); + }*/ + int Execute(float dt); + virtual const char* GetName() { return "MentatMenuState"; } + + protected: + HOUSETYPE house; + ImagePtr m_surf; + VBox* m_vbox; +// void initMenuState(HOUSETYPE newHouse); + +/* StaticContainer WindowWidget; + AnimationLabel eyesAnim; + AnimationLabel mouthAnim; + AnimationLabel specialAnim; + AnimationLabel shoulderAnim; + Label TextLabel; +*/ +}; + +#endif // MENTATMENU_H_INCLUDED + Property changes on: branches/dunks/include/MentatMenu.h ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/src/HouseChoiceInfoMenu.cpp =================================================================== --- branches/dunks/src/HouseChoiceInfoMenu.cpp (rev 0) +++ branches/dunks/src/HouseChoiceInfoMenu.cpp 2008-04-28 00:37:49 UTC (rev 174) @@ -0,0 +1,35 @@ +#include "HouseChoiceInfoMenu.h" + +#include "Application.h" +#include "Settings.h" +#include "DataCache.h" +#include "pakfile/Cpsfile.h" +#include "boost/bind.hpp" + +HouseChoiceInfoMenuState::HouseChoiceInfoMenuState(HOUSETYPE newHouse) : MentatMenuState(HOUSE_SARDAUKAR) +{ + + m_butYes = new GraphicButton(DataCache::Instance()->getGuiPic(UI_MentatYes)->getResized(2), DataCache::Instance()->getGuiPic(UI_MentatYes_Pressed)->getResized(2)); + m_vbox->addChild(m_butYes); + + m_vbox->fit(2); + m_vbox->setPosition(UPoint(336,366)); + m_vbox->reshape(); + + m_container->addChild(m_vbox); + + m_vbox = new VBox(); + + m_butNo = new GraphicButton(DataCache::Instance()->getGuiPic(UI_MentatNo)->getResized(2), DataCache::Instance()->getGuiPic(UI_MentatNo_Pressed)->getResized(2)); + m_vbox->addChild(m_butNo); + + m_vbox->fit(2); + m_vbox->setPosition(UPoint(480,366)); + m_vbox->reshape(); + + m_container->addChild(m_vbox); +} + +HouseChoiceInfoMenuState::~HouseChoiceInfoMenuState() +{ +} Property changes on: branches/dunks/src/HouseChoiceInfoMenu.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/src/HouseChoiceMenu.cpp =================================================================== --- branches/dunks/src/HouseChoiceMenu.cpp (rev 0) +++ branches/dunks/src/HouseChoiceMenu.cpp 2008-04-28 00:37:49 UTC (rev 174) @@ -0,0 +1,120 @@ +#include "HouseChoiceMenu.h" +#include "HouseChoiceInfoMenu.h" + +#include "DataCache.h" +#include "Application.h" +#include "DataCache.h" +#include "boost/bind.hpp" +#include <iostream> +#include "gui2/Button.h" +#include "gui2/VBox.h" +HouseChoiceMenuState::HouseChoiceMenuState() : MenuBaseState() +{ + m_menuBackground.reset(DataCache::Instance()->getGuiPic(UI_HouseChoiceBackground).get()); + m_menuBackground = m_menuBackground->getResized(2); + + m_vbox = new VBox(); + + m_butAtreides = new TranspButton(163,182); + m_butAtreides->onClick.connect( + boost::bind(&HouseChoiceMenuState::doAtreides, this) ); + + m_vbox->addChild(m_butAtreides); + + m_vbox->fit(2); + m_vbox->setPosition(UPoint(40,135)); + m_vbox->reshape(); + + m_container->addChild(m_vbox); + + m_vbox = new VBox(); + + m_butOrdos = new TranspButton(163,182); + m_butOrdos->onClick.connect( + boost::bind(&HouseChoiceMenuState::doOrdos, this) ); + + m_vbox->addChild(m_butOrdos); + + m_vbox->fit(2); + m_vbox->setPosition(UPoint(235,135)); + m_vbox->reshape(); + + m_container->addChild(m_vbox); + + m_vbox = new VBox(); + + m_butHarkonnen = new TranspButton(163,182); + m_butHarkonnen->onClick.connect( + boost::bind(&HouseChoiceMenuState::doHarkonnen, this) ); + + m_vbox->addChild(m_butHarkonnen); + + m_vbox->fit(2); + m_vbox->setPosition(UPoint(430,135)); + m_vbox->reshape(); + + m_container->addChild(m_vbox); + +} + +HouseChoiceMenuState::~HouseChoiceMenuState() { +} + +int HouseChoiceMenuState::Execute(float dt) +{ + m_menuBackground.get()->blitToScreen(SPoint(Settings::Instance()->GetWidth() / 2 - m_menuBackground->getSurface()->w/2, + Settings::Instance()->GetHeight() / 16)); + + return 0; +} + +void HouseChoiceMenuState::doAtreides() { + std::cout << "ATREIDES!!" << std::endl; + mp_parent->PushState( new HouseChoiceInfoMenuState(HOUSE_ATREIDES) ); +/* HouseChoiceInfoMenu* myHouseChoiceInfoMenu = new HouseChoiceInfoMenu(HOUSE_ATREIDES); + if(myHouseChoiceInfoMenu == NULL) { + perror("HouseChoiceMenu::OnAtreides()"); + exit(EXIT_FAILURE); + } + if(myHouseChoiceInfoMenu->showMenu() == -1) { + quit(-1); + } else { + quit(HOUSE_ATREIDES); + } + delete myHouseChoiceInfoMenu;*/ +} + +void HouseChoiceMenuState::doOrdos() { + std::cout << "ORDOS!!" << std::endl; + + mp_parent->PushState( new HouseChoiceInfoMenuState(HOUSE_ORDOS) ); +/* HouseChoiceInfoMenu* myHouseChoiceInfoMenu = new HouseChoiceInfoMenu(HOUSE_ORDOS); + if(myHouseChoiceInfoMenu == NULL) { + perror("HouseChoiceMenu::OnOrdos()"); + exit(EXIT_FAILURE); + } + if(myHouseChoiceInfoMenu->showMenu() == -1) { + quit(-1); + } else { + quit(HOUSE_ORDOS); + } + delete myHouseChoiceInfoMenu;*/ +} + +void HouseChoiceMenuState::doHarkonnen() { + std::cout << "HARKONNEN!!" << std::endl; + + mp_parent->PushState( new HouseChoiceInfoMenuState(HOUSE_HARKONNEN) ); +/* HouseChoiceInfoMenu* myHouseChoiceInfoMenu = new HouseChoiceInfoMenu(HOUSE_HARKONNEN); + if(myHouseChoiceInfoMenu == NULL) { + perror("HouseChoiceMenu::OnHarkonnen()"); + exit(EXIT_FAILURE); + } + if(myHouseChoiceInfoMenu->showMenu() == -1) { + quit(-1); + } else { + quit(HOUSE_HARKONNEN); + } + delete myHouseChoiceInfoMenu;*/ +} + Property changes on: branches/dunks/src/HouseChoiceMenu.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/src/MentatMenu.cpp =================================================================== --- branches/dunks/src/MentatMenu.cpp (rev 0) +++ branches/dunks/src/MentatMenu.cpp 2008-04-28 00:37:49 UTC (rev 174) @@ -0,0 +1,139 @@ +#include "MentatMenu.h" + +#include "Application.h" +#include "Settings.h" +#include "DataCache.h" +#include "pakfile/Cpsfile.h" +#include "boost/bind.hpp" + +MentatMenuState::MentatMenuState(HOUSETYPE newHouse) +{ + house = newHouse; + Image * mentat = DataCache::Instance()->getGuiPic(UI_MentatBackground, newHouse).get(); + m_surf.reset(mentat); + m_surf = m_surf->getResized(2); + + m_vbox = new VBox(); +/* m_butYes = new GraphicButton(DataCache::Instance()->getGuiPic(UI_MentatYes)->getResized(2), DataCache::Instance()->getGuiPic(UI_MentatYes_Pressed)->getResized(2)); + m_vbox->addChild(m_butYes); + + m_vbox->fit(2); + m_vbox->setPosition(UPoint(336,366)); + m_vbox->reshape(); + + m_container->addChild(m_vbox); + + m_vbox = new VBox(); + m_butNo = new GraphicButton(DataCache::Instance()->getGuiPic(UI_MentatNo)->getResized(2), DataCache::Instance()->getGuiPic(UI_MentatNo_Pressed)->getResized(2)); + m_vbox->addChild(m_butNo); + + m_vbox->fit(2); + m_vbox->setPosition(UPoint(480,366)); + m_vbox->reshape(); + + m_container->addChild(m_vbox);*/ + +/* + // set up window + SDL_Surface *surf; + surf = pDataManager->getUIGraphic(UI_MentatBackground,house); + + SetBackground(surf,false); + + int xpos = std::max(0,(screen->w - surf->w)/2); + int ypos = std::max(0,(screen->h - surf->h)/2); + + SetCurrentPosition(xpos,ypos,surf->w,surf->h); + + SetWindowWidget(&WindowWidget); + + switch(house) { + case HOUSE_ATREIDES: + case HOUSE_FREMEN: + anim = pDataManager->getAnimation(Anim_AtreidesEyes); + eyesAnim.SetAnimation(anim); + WindowWidget.AddWidget(&eyesAnim,Point(80,160),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_AtreidesMouth); + mouthAnim.SetAnimation(anim); + WindowWidget.AddWidget(&mouthAnim,Point(80,192),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_AtreidesBook); + specialAnim.SetAnimation(anim); + WindowWidget.AddWidget(&specialAnim,Point(145,305),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_AtreidesShoulder); + shoulderAnim.SetAnimation(anim); + // don't add shoulderAnim, draw it in DrawSpecificStuff + break; + case HOUSE_ORDOS: + case HOUSE_MERCENARY: + anim = pDataManager->getAnimation(Anim_OrdosEyes); + eyesAnim.SetAnimation(anim); + WindowWidget.AddWidget(&eyesAnim,Point(32,160),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_OrdosMouth); + mouthAnim.SetAnimation(anim); + WindowWidget.AddWidget(&mouthAnim,Point(32,192),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_OrdosRing); + specialAnim.SetAnimation(anim); + WindowWidget.AddWidget(&specialAnim,Point(178,289),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_OrdosShoulder); + shoulderAnim.SetAnimation(anim); + // don't add shoulderAnim, draw it in DrawSpecificStuff + break; + case HOUSE_HARKONNEN: + case HOUSE_SARDAUKAR: + default: + anim = pDataManager->getAnimation(Anim_HarkonnenEyes); + eyesAnim.SetAnimation(anim); + WindowWidget.AddWidget(&eyesAnim,Point(64,176),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_HarkonnenMouth); + mouthAnim.SetAnimation(anim); + WindowWidget.AddWidget(&mouthAnim,Point(64,208),Point(anim->getFrame()->w,anim->getFrame()->h)); + + anim = pDataManager->getAnimation(Anim_HarkonnenShoulder); + shoulderAnim.SetAnimation(anim); + // don't add shoulderAnim, draw it in DrawSpecificStuff + break; + } + + TextLabel.SetTextColor(255); + TextLabel.SetVisible(false);*/ +} + +MentatMenuState::~MentatMenuState() { +} + +int MentatMenuState::Execute(float dt) +{ + m_surf.get()->blitToScreen(SPoint(Settings::Instance()->GetWidth() / 2 - m_surf->getSurface()->w/2, + Settings::Instance()->GetHeight() / 16)); + + return 0; +} + +/*void MentatMenu::DrawSpecificStuff() { + Point shoulderPos; + switch(house) { + case HOUSE_ATREIDES: + case HOUSE_FREMEN: { + shoulderPos = Point(256,257) + GetPosition(); + } break; + case HOUSE_ORDOS: + case HOUSE_MERCENARY: { + shoulderPos = Point(256,257) + GetPosition(); + } break; + case HOUSE_HARKONNEN: + case HOUSE_SARDAUKAR: + default: { + shoulderPos = Point(256,209) + GetPosition(); + } break; + } + + shoulderAnim.Draw(screen,shoulderPos); + TextLabel.Draw(screen,Point(10,5) + GetPosition()); +}*/ Property changes on: branches/dunks/src/MentatMenu.cpp ___________________________________________________________________ Name: svn:eol-style + native Modified: branches/dunks/src/SingleMenu.cpp =================================================================== --- branches/dunks/src/SingleMenu.cpp 2008-04-27 23:47:23 UTC (rev 173) +++ branches/dunks/src/SingleMenu.cpp 2008-04-28 00:37:49 UTC (rev 174) @@ -1,8 +1,10 @@ #include "SingleMenu.h" #include "Application.h" +#include "houses.h" //#include "DataFile.h" #include "Settings.h" +#include "HouseChoiceMenu.h" #include "boost/bind.hpp" @@ -17,7 +19,7 @@ m_butCampaign = new BoringButton("Campaign"); m_butCampaign->setSize(SPoint(bw, bh)); m_butCampaign->onClick.connect( - boost::bind(&SingleMenuState::doSkirmish, this) ); + boost::bind(&SingleMenuState::doCampaign, this) ); m_vbox->addChild(m_butCampaign); @@ -69,6 +71,12 @@ delete m_vbox; } +void SingleMenuState::doCampaign() +{ + printf("Campaign\n"); + mp_parent->PushState( new HouseChoiceMenuState() ); + +} void SingleMenuState::doSkirmish() { printf("Skirmish\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 23:47:41
|
Revision: 173 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=173&view=rev Author: dvalin Date: 2008-04-27 16:47:23 -0700 (Sun, 27 Apr 2008) Log Message: ----------- forgot to include appropriate boost header.. Modified Paths: -------------- branches/dunks/include/pakfile/Shpfile.h Modified: branches/dunks/include/pakfile/Shpfile.h =================================================================== --- branches/dunks/include/pakfile/Shpfile.h 2008-04-27 23:41:52 UTC (rev 172) +++ branches/dunks/include/pakfile/Shpfile.h 2008-04-27 23:47:23 UTC (rev 173) @@ -3,6 +3,7 @@ #include "SDL.h" #include "pakfile/Decode.h" +#include <boost/shared_ptr.hpp> #define TILE_NORMAL 0x00010000 #define TILE_FLIPH 0x00100000 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 23:42:00
|
Revision: 172 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=172&view=rev Author: dvalin Date: 2008-04-27 16:41:52 -0700 (Sun, 27 Apr 2008) Log Message: ----------- add ShpfilePtr Modified Paths: -------------- branches/dunks/include/pakfile/Shpfile.h Modified: branches/dunks/include/pakfile/Shpfile.h =================================================================== --- branches/dunks/include/pakfile/Shpfile.h 2008-04-27 22:16:55 UTC (rev 171) +++ branches/dunks/include/pakfile/Shpfile.h 2008-04-27 23:41:52 UTC (rev 172) @@ -18,6 +18,10 @@ Uint32 EndOffset; }; + +class Shpfile; +typedef boost::shared_ptr<Shpfile> ShpfilePtr; + class Shpfile : public Decode { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 22:17:03
|
Revision: 171 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=171&view=rev Author: dvalin Date: 2008-04-27 15:16:55 -0700 (Sun, 27 Apr 2008) Log Message: ----------- fix breakage with ImagePtr copies.. Modified Paths: -------------- branches/dunks/src/gui2/Button.cpp Modified: branches/dunks/src/gui2/Button.cpp =================================================================== --- branches/dunks/src/gui2/Button.cpp 2008-04-27 20:23:58 UTC (rev 170) +++ branches/dunks/src/gui2/Button.cpp 2008-04-27 22:16:55 UTC (rev 171) @@ -31,8 +31,8 @@ assert(pressed != NULL && ((normal->getSurface()->w == pressed->getSurface()->w) && (normal->getSurface()->h == pressed->getSurface()->h))); - m_surfNormal.reset(normal.get()); - m_surfPressed.reset(pressed.get()); + m_surfNormal = normal; + m_surfPressed = pressed; setSize(normal->getSize()); //w = normal->getSurfacew; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 20:25:19
|
Revision: 170 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=170&view=rev Author: dvalin Date: 2008-04-27 13:23:58 -0700 (Sun, 27 Apr 2008) Log Message: ----------- * fix m_guiImg * actually fetch the correct palette for bene gesserit mentat Modified Paths: -------------- branches/dunks/src/DataCache.cpp Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-04-27 20:11:48 UTC (rev 169) +++ branches/dunks/src/DataCache.cpp 2008-04-27 20:23:58 UTC (rev 170) @@ -5,6 +5,7 @@ for (int i=0; i< NUM_HOUSES; i++) { m_objImg.push_back(new images()); + m_guiImg.push_back(new images()); } int len; @@ -112,14 +113,15 @@ //addGuiPic(UI_HouseChoiceBackground, herald->getPicture()); - /*addGuiPic(UI_MentatYes, mentat->getPicture(0)); + addGuiPic(UI_MentatYes, mentat->getPicture(0)); addGuiPic(UI_MentatYes_Pressed, mentat->getPicture(1)); addGuiPic(UI_MentatNo, mentat->getPicture(2)); - addGuiPic(UI_MentatNo_Pressed, mentat->getPicture(3));*/ + addGuiPic(UI_MentatNo_Pressed, mentat->getPicture(3)); -/* Palettefile tmp (data, len); + data = ResMan::Instance()->readFile("DUNE:BENE.PAL", &len); + Palettefile tmp (data, len); SDL_Palette * pal = tmp.getPalette(); - addGuiPic(UI_Mentat_BeneGesserit, mentatm->getPicture(pal)); */ + addGuiPic(UI_Mentat_BeneGesserit, mentatm->getPicture(pal)); addSoundChunk(YesSir, getChunkFromFile("VOC:ZREPORT1.VOC")); addSoundChunk(Reporting, getChunkFromFile("VOC:ZREPORT2.VOC")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 20:11:58
|
Revision: 169 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=169&view=rev Author: dvalin Date: 2008-04-27 13:11:48 -0700 (Sun, 27 Apr 2008) Log Message: ----------- actually make use of house parameter.. Modified Paths: -------------- branches/dunks/src/DataCache.cpp Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-04-27 20:07:24 UTC (rev 168) +++ branches/dunks/src/DataCache.cpp 2008-04-27 20:11:48 UTC (rev 169) @@ -217,13 +217,13 @@ void DataCache::addObjPic(ObjPic_enum ID, Image * tmp, HOUSETYPE house) { - m_objImg[HOUSE_HARKONNEN]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, + m_objImg[house]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, ImagePtr(tmp))); } void DataCache::addGuiPic(GuiPic_enum ID, Image * tmp, HOUSETYPE house) { - m_guiImg[HOUSE_HARKONNEN]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, + m_guiImg[house]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, ImagePtr(tmp))); } @@ -236,9 +236,9 @@ } else { - ImagePtr source = m_objImg[HOUSE_HARKONNEN]->find(ID)->second; + ImagePtr source = m_objImg[house]->find(ID)->second; ImagePtr copy = source->getRecoloredByHouse(house); - m_objImg[HOUSE_HARKONNEN]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, copy)); + m_objImg[house]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, copy)); return copy; } @@ -253,9 +253,9 @@ } else { - ImagePtr source = m_guiImg[HOUSE_HARKONNEN]->find(ID)->second; + ImagePtr source = m_guiImg[house]->find(ID)->second; ImagePtr copy = source->getRecoloredByHouse(house); - m_guiImg[HOUSE_HARKONNEN]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, copy)); + m_guiImg[house]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, copy)); return copy; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 20:07:47
|
Revision: 168 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=168&view=rev Author: dvalin Date: 2008-04-27 13:07:24 -0700 (Sun, 27 Apr 2008) Log Message: ----------- consistently use Image in stead of SDL_Surface Modified Paths: -------------- branches/dunks/include/DataCache.h branches/dunks/include/pakfile/Icnfile.h branches/dunks/include/pakfile/Shpfile.h branches/dunks/src/Application.cpp branches/dunks/src/DataCache.cpp branches/dunks/src/pakfile/Icnfile.cpp branches/dunks/src/pakfile/Shpfile.cpp branches/dunks/src/pakfile/Wsafile.cpp Modified: branches/dunks/include/DataCache.h =================================================================== --- branches/dunks/include/DataCache.h 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/include/DataCache.h 2008-04-27 20:07:24 UTC (rev 168) @@ -191,6 +191,7 @@ UI_MentatProcced_Pressed, UI_MentatRepeat, UI_MentatRepeat_Pressed, + UI_Mentat_BeneGesserit, UI_PlanetBackground, UI_MenuButtonBorder, UI_DuneLegacy, @@ -383,8 +384,8 @@ ~DataCache(); public: - void addObjPic(ObjPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); - void addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); + void addObjPic(ObjPic_enum ID, Image * tmp, HOUSETYPE house = HOUSE_HARKONNEN); + void addGuiPic(GuiPic_enum ID, Image * tmp, HOUSETYPE house = HOUSE_HARKONNEN); void addSoundChunk(Sound_enum ID, Mix_Chunk* tmp); ImagePtr getObjPic(ObjPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); ImagePtr getGuiPic(GuiPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); Modified: branches/dunks/include/pakfile/Icnfile.h =================================================================== --- branches/dunks/include/pakfile/Icnfile.h 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/include/pakfile/Icnfile.h 2008-04-27 20:07:24 UTC (rev 168) @@ -25,7 +25,7 @@ ~Icnfile(); - SDL_Surface * getPicture(Uint32 IndexOfFile); + Image * getPicture(Uint32 IndexOfFile); /// Returns an array of pictures in the icn-File /*! @@ -54,7 +54,7 @@ @param tilesN how many tilesX*tilesY blocks in a row @return the result surface with tilesX*tilesY*tilesN tiles */ - SDL_Surface * getPictureArray(Uint32 MapfileIndex, int tilesX = 0, int tilesY = 0, int tilesN = 0); + Image * getPictureArray(Uint32 MapfileIndex, int tilesX = 0, int tilesY = 0, int tilesN = 0); /*! This method returns a SDL_Surface containing multiple tiles/pictures. The returned surface contains all @@ -64,7 +64,7 @@ @param EndIndex The last tile to use @return the result surface with (EndIndex-StartIndex+1) tiles. NULL on errors. */ - SDL_Surface * getPictureRow(Uint32 StartIndex, Uint32 EndIndex); + Image * getPictureRow(Uint32 StartIndex, Uint32 EndIndex); /// Returns the number of tiles /*! Modified: branches/dunks/include/pakfile/Shpfile.h =================================================================== --- branches/dunks/include/pakfile/Shpfile.h 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/include/pakfile/Shpfile.h 2008-04-27 20:07:24 UTC (rev 168) @@ -30,7 +30,7 @@ @param IndexOfFile specifies which picture to return (zero based) @return nth picture in this shp-File */ - SDL_Surface* getPicture(Uint32 IndexOfFile); + Image * getPicture(Uint32 IndexOfFile); /*! This method returns a SDL_Surface containing an array of pictures from this shp-File. @@ -54,7 +54,7 @@ @param tilesY how many pictures in one column @return picture in this shp-File containing all specified pictures */ - SDL_Surface* getPictureArray(unsigned int tilesX, unsigned int tilesY, ...); + Image * getPictureArray(unsigned int tilesX, unsigned int tilesY, ...); inline int getNumFiles() {return (int) NumFiles;}; Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/src/Application.cpp 2008-04-27 20:07:24 UTC (rev 168) @@ -8,7 +8,7 @@ #include <stdio.h> #include <stdlib.h> #include <assert.h> - +#include <iostream> //#include "globals.h" //#include "houses.h" //#include "MentatClass.h" @@ -297,12 +297,12 @@ Shpfile mouse (data, len); - m_cursor.reset(new Image(mouse.getPicture(0))); + m_cursor.reset(mouse.getPicture(0)); - - fprintf(stdout, "starting sound...\n"); SoundPlayerClass* soundPlayer = new SoundPlayerClass(); +// Mix_Chunk* sound = DataCache::Instance()->concat2Chunks(Intro_TheBuilding, Intro_OfADynasty); +// soundPlayer->playSound(sound); } void Application::Die() Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/src/DataCache.cpp 2008-04-27 20:07:24 UTC (rev 168) @@ -14,8 +14,12 @@ Shpfile* units; Shpfile* units1; Shpfile* units2; - Cpsfile* herald; + Cpsfile* herald; + Shpfile* mentat; +// CpsfilePtr mentatm; + + //LOADING FILES data = ResMan::Instance()->readFile("DUNE:UNITS.SHP", &len); units = new Shpfile(data, len); @@ -28,7 +32,16 @@ data = ResMan::Instance()->readFile("ENGLISH:HERALD.ENG", &len); herald = new Cpsfile(data, len); + + data = ResMan::Instance()->readFile("ENGLISH:MENTAT.ENG", &len); + mentat = new Shpfile(data, len); + + data = ResMan::Instance()->readFile("DUNE:BENE.PAL", &len); + data = ResMan::Instance()->readFile("DUNE:MENTATM.CPS", &len); + + CpsfilePtr mentatm (new Cpsfile(data, len)); + int maplen; unsigned char * mapdata; @@ -99,11 +112,14 @@ //addGuiPic(UI_HouseChoiceBackground, herald->getPicture()); -/* UIGraphic[UI_MentatYes][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(0)); - UIGraphic[UI_MentatYes_Pressed][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(1)); - UIGraphic[UI_MentatNo][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(2)); - UIGraphic[UI_MentatNo_Pressed][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(3));*/ + /*addGuiPic(UI_MentatYes, mentat->getPicture(0)); + addGuiPic(UI_MentatYes_Pressed, mentat->getPicture(1)); + addGuiPic(UI_MentatNo, mentat->getPicture(2)); + addGuiPic(UI_MentatNo_Pressed, mentat->getPicture(3));*/ +/* Palettefile tmp (data, len); + SDL_Palette * pal = tmp.getPalette(); + addGuiPic(UI_Mentat_BeneGesserit, mentatm->getPicture(pal)); */ addSoundChunk(YesSir, getChunkFromFile("VOC:ZREPORT1.VOC")); addSoundChunk(Reporting, getChunkFromFile("VOC:ZREPORT2.VOC")); @@ -197,33 +213,18 @@ addSoundChunk(Intro_WhoEver, getChunkFromFile("INTROVOC:WHOEVER.VOC")); addSoundChunk(Intro_Wind_2bp, getChunkFromFile("INTROVOC:WIND2BP.VOC")); addSoundChunk(Intro_Your, getChunkFromFile("INTROVOC:YOUR.VOC")); -#if 0 - SDL_RWops* text_lng[1]; - data = ResMan::Instance()->readFile("ENGLISH:INTRO.ENG", &len); - text_lng[0] = SDL_RWFromMem(data, len); -/* data = ResMan::Instance()->readFile("ENGLISH:TEXTO.ENG", &len); - text_lng[1] = SDL_RWFromMem(data, len); - data = ResMan::Instance()->readFile("ENGLISH:TEXTH.ENG", &len); - text_lng[2] = SDL_RWFromMem(data, len);*/ - - int i = 0; - for(i = 0; i < 1; i++){ - BriefingStrings[i] = new BriefingText(text_lng[i]); - SDL_RWclose(text_lng[i]); - } -#endif } -void DataCache::addObjPic(ObjPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { +void DataCache::addObjPic(ObjPic_enum ID, Image * tmp, HOUSETYPE house) { m_objImg[HOUSE_HARKONNEN]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, - ImagePtr(new Image(tmp)))); + ImagePtr(tmp))); } -void DataCache::addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { +void DataCache::addGuiPic(GuiPic_enum ID, Image * tmp, HOUSETYPE house) { m_guiImg[HOUSE_HARKONNEN]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, - ImagePtr(new Image(tmp)))); + ImagePtr(tmp))); } ImagePtr DataCache::getObjPic(ObjPic_enum ID, HOUSETYPE house) { Modified: branches/dunks/src/pakfile/Icnfile.cpp =================================================================== --- branches/dunks/src/pakfile/Icnfile.cpp 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/src/pakfile/Icnfile.cpp 2008-04-27 20:07:24 UTC (rev 168) @@ -152,7 +152,7 @@ ; } -SDL_Surface* Icnfile::getPicture(Uint32 IndexOfFile) { +Image * Icnfile::getPicture(Uint32 IndexOfFile) { SDL_Palette* palette = Application::Instance()->Screen()->getSurface()->format->palette; SDL_Surface * pic; @@ -196,11 +196,13 @@ SDL_UnlockSurface(pic); printf("File Nr.: %d (Size: %dx%d)\n",IndexOfFile,SIZE_X,SIZE_Y); + + Image * img = new Image(pic); - return pic; + return img; } -SDL_Surface* Icnfile::getPictureArray(Uint32 MapfileIndex, int tilesX, int tilesY, int tilesN) { +Image * Icnfile::getPictureArray(Uint32 MapfileIndex, int tilesX, int tilesY, int tilesN) { SDL_Palette* palette = Application::Instance()->Screen()->getSurface()->format->palette; SDL_Surface * pic; @@ -311,11 +313,13 @@ } SDL_UnlockSurface(pic); + + Image * img = new Image(pic); - return pic; + return img; } -SDL_Surface* Icnfile::getPictureRow(Uint32 StartIndex, Uint32 EndIndex) { +Image * Icnfile::getPictureRow(Uint32 StartIndex, Uint32 EndIndex) { SDL_Palette* palette = Application::Instance()->Screen()->getSurface()->format->palette; SDL_Surface * pic; @@ -363,7 +367,9 @@ } SDL_UnlockSurface(pic); - return pic; + Image * img = new Image(pic); + + return img; } int Icnfile::getNumFiles() Modified: branches/dunks/src/pakfile/Shpfile.cpp =================================================================== --- branches/dunks/src/pakfile/Shpfile.cpp 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/src/pakfile/Shpfile.cpp 2008-04-27 20:07:24 UTC (rev 168) @@ -22,7 +22,7 @@ } } -SDL_Surface *Shpfile::getPicture(Uint32 IndexOfFile) +Image * Shpfile::getPicture(Uint32 IndexOfFile) { SDL_Palette *palette = Application::Instance()->Screen()->getSurface()->format->palette; SDL_Surface *pic = NULL; @@ -131,10 +131,12 @@ if(ImageOut != NULL) { free(ImageOut); } - return pic; + Image * img = new Image(pic); + + return img; } -SDL_Surface* Shpfile::getPictureArray(unsigned int tilesX, unsigned int tilesY, ...) { +Image * Shpfile::getPictureArray(unsigned int tilesX, unsigned int tilesY, ...) { SDL_Palette *palette = Application::Instance()->Screen()->getSurface()->format->palette; SDL_Surface *pic = NULL; unsigned char *DecodeDestination = NULL; @@ -310,7 +312,10 @@ free(tiles); SDL_UnlockSurface(pic); - return pic; + Image * img = new Image(pic); + + return img; + } void Shpfile::readIndex() Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2008-04-27 20:04:24 UTC (rev 167) +++ branches/dunks/src/pakfile/Wsafile.cpp 2008-04-27 20:07:24 UTC (rev 168) @@ -105,7 +105,7 @@ SDL_UnlockSurface(pic); Image * 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-04-27 20:04:41
|
Revision: 167 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=167&view=rev Author: dvalin Date: 2008-04-27 13:04:24 -0700 (Sun, 27 Apr 2008) Log Message: ----------- use std::string in stead of char Modified Paths: -------------- branches/dunks/include/pakfile/StringFile.h branches/dunks/src/pakfile/StringFile.cpp Modified: branches/dunks/include/pakfile/StringFile.h =================================================================== --- branches/dunks/include/pakfile/StringFile.h 2008-04-27 20:02:00 UTC (rev 166) +++ branches/dunks/include/pakfile/StringFile.h 2008-04-27 20:04:24 UTC (rev 167) @@ -17,7 +17,7 @@ class StringFile { public: - StringFile(unsigned char * bufFiledata, int bufsize); + StringFile(std::string stringFileName); ~StringFile(); /// This method returns the briefing/debriefing text. Modified: branches/dunks/src/pakfile/StringFile.cpp =================================================================== --- branches/dunks/src/pakfile/StringFile.cpp 2008-04-27 20:02:00 UTC (rev 166) +++ branches/dunks/src/pakfile/StringFile.cpp 2008-04-27 20:04:24 UTC (rev 167) @@ -1,11 +1,14 @@ #include "pakfile/StringFile.h" +#include "ResMan.h" #include <SDL_endian.h> #include <SDL.h> #include <SDL_rwops.h> #include <iostream> #include <string> -StringFile::StringFile(unsigned char * bufFiledata, int bufsize){ +StringFile::StringFile(std::string stringFileName) { + int bufsize; + unsigned char* bufFiledata = ResMan::Instance()->readFile(stringFileName.c_str(), &bufsize); Uint16* index; SDL_RWops* RWop = SDL_RWFromMem(bufFiledata, bufsize); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 20:03:05
|
Revision: 166 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=166&view=rev Author: dvalin Date: 2008-04-27 13:02:00 -0700 (Sun, 27 Apr 2008) Log Message: ----------- grf, forgot to commit this one earlier.. Added Paths: ----------- branches/dunks/include/pakfile/Vocfile.h Added: branches/dunks/include/pakfile/Vocfile.h =================================================================== --- branches/dunks/include/pakfile/Vocfile.h (rev 0) +++ branches/dunks/include/pakfile/Vocfile.h 2008-04-27 20:02:00 UTC (rev 166) @@ -0,0 +1,19 @@ +#ifndef VOCFILE_H_INCLUDED +#define VOCFILE_H_INCLUDED + +#include <SDL.h> +#include <SDL_rwops.h> +#include <SDL_mixer.h> + +/** + Try to load a VOC from the RWop. Returns a pointer to Mix_Chunk. + It is the callers responsibility to deallocate that data again later on + with Mix_FreeChunk()! + \param rwop The source SDL_RWops as a pointer. The sample is loaded from this VOC-File. + \param freesrc A non-zero value mean it will automatically close/free the src for you. + \return a pointer to the sample as a Mix_Chunk. NULL is returned on errors. + */ +extern Mix_Chunk* LoadVOC_RW(SDL_RWops* rwop, int freesrc); + +#endif // VOCFILE_H_INCLUDED + Property changes on: branches/dunks/include/pakfile/Vocfile.h ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 17:44:25
|
Revision: 165 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=165&view=rev Author: dvalin Date: 2008-04-27 10:42:52 -0700 (Sun, 27 Apr 2008) Log Message: ----------- add function for adding and getting gui pictures Modified Paths: -------------- branches/dunks/include/DataCache.h branches/dunks/src/DataCache.cpp Modified: branches/dunks/include/DataCache.h =================================================================== --- branches/dunks/include/DataCache.h 2008-04-27 17:36:11 UTC (rev 164) +++ branches/dunks/include/DataCache.h 2008-04-27 17:42:52 UTC (rev 165) @@ -371,7 +371,7 @@ NUM_SOUNDCHUNK } Sound_enum; -typedef std::map <ObjPic_enum, ImagePtr> images; +typedef std::map <unsigned, ImagePtr> images; typedef std::vector <images*> remapped_images; //One for each house class DataCache : public Singleton<DataCache> @@ -384,7 +384,7 @@ public: void addObjPic(ObjPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); -// void addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); + void addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); void addSoundChunk(Sound_enum ID, Mix_Chunk* tmp); ImagePtr getObjPic(ObjPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); ImagePtr getGuiPic(GuiPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); @@ -396,7 +396,6 @@ private: - bool addObjPic(ObjPic_enum ID) { return false;}; remapped_images m_objImg; remapped_images m_guiImg; Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-04-27 17:36:11 UTC (rev 164) +++ branches/dunks/src/DataCache.cpp 2008-04-27 17:42:52 UTC (rev 165) @@ -220,13 +220,12 @@ ImagePtr(new Image(tmp)))); } -/*void DataCache::addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { +void DataCache::addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { m_guiImg[HOUSE_HARKONNEN]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, ImagePtr(new Image(tmp)))); -}*/ +} - ImagePtr DataCache::getObjPic(ObjPic_enum ID, HOUSETYPE house) { images::iterator iter = m_objImg[house]->find(ID); @@ -244,7 +243,7 @@ } -/*ImagePtr DataCache::getGuiPic(GuiPic_enum ID, HOUSETYPE house) { +ImagePtr DataCache::getGuiPic(GuiPic_enum ID, HOUSETYPE house) { images::iterator iter = m_guiImg[house]->find(ID); if (iter != m_guiImg[house]->end()) @@ -259,7 +258,7 @@ return copy; } -}*/ +} void DataCache::addSoundChunk(Sound_enum ID, Mix_Chunk* tmp){ soundChunk[ID] = tmp; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 17:36:40
|
Revision: 164 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=164&view=rev Author: dvalin Date: 2008-04-27 10:36:11 -0700 (Sun, 27 Apr 2008) Log Message: ----------- don't use namespace std Modified Paths: -------------- branches/dunks/include/SoundPlayerClass.h Modified: branches/dunks/include/SoundPlayerClass.h =================================================================== --- branches/dunks/include/SoundPlayerClass.h 2008-04-27 17:32:34 UTC (rev 163) +++ branches/dunks/include/SoundPlayerClass.h 2008-04-27 17:36:11 UTC (rev 164) @@ -85,13 +85,13 @@ @param volume sound will be played with this volume */ void playSound(Sound_enum soundID, int volume); - vector<std::string> getMusicFileNames(std::string dir); + std::vector<std::string> getMusicFileNames(std::string dir); - vector<std::string> AttackMusic; - vector<std::string> IntroMusic; - vector<std::string> LoseMusic; - vector<std::string> PeaceMusic; - vector<std::string> WinMusic; + std::vector<std::string> AttackMusic; + std::vector<std::string> IntroMusic; + std::vector<std::string> LoseMusic; + std::vector<std::string> PeaceMusic; + std::vector<std::string> WinMusic; //! whether sound should be played bool soundOn; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 17:34:07
|
Revision: 163 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=163&view=rev Author: dvalin Date: 2008-04-27 10:32:34 -0700 (Sun, 27 Apr 2008) Log Message: ----------- use enum data types Modified Paths: -------------- branches/dunks/include/DataCache.h branches/dunks/include/SoundPlayerClass.h branches/dunks/src/DataCache.cpp branches/dunks/src/SoundPlayerClass.cpp Modified: branches/dunks/include/DataCache.h =================================================================== --- branches/dunks/include/DataCache.h 2008-04-26 17:38:55 UTC (rev 162) +++ branches/dunks/include/DataCache.h 2008-04-27 17:32:34 UTC (rev 163) @@ -13,7 +13,7 @@ #include "pakfile/Palette.h" #include "pakfile/Shpfile.h" #include "pakfile/Wsafile.h" - +//#include "pakfile/BriefingText.h" #include "houses.h" #include <map> @@ -135,7 +135,7 @@ Picture_WindTrap, Picture_WOR, NUM_SMALLDETAILPICS -} SmallDetailPics_Enum; +} SmallDetailPics_enum; // UI Graphics typedef enum { @@ -199,7 +199,7 @@ UI_MapChoiceMap, UI_MapChoiceClickMap, NUM_UIGRAPHICS -} UIGraphics_Enum; +} GuiPic_enum; //Animation typedef enum { @@ -371,7 +371,7 @@ NUM_SOUNDCHUNK } Sound_enum; -typedef std::map <unsigned, ImagePtr> images; +typedef std::map <ObjPic_enum, ImagePtr> images; typedef std::vector <images*> remapped_images; //One for each house class DataCache : public Singleton<DataCache> @@ -383,13 +383,20 @@ ~DataCache(); public: - void addObjPic(unsigned ID, SDL_Surface * tmp); - void addSoundChunk(unsigned ID, Mix_Chunk* tmp); - ImagePtr getObjPic(unsigned ID, unsigned house = HOUSE_HARKONNEN); - Mix_Chunk* getSoundChunk(unsigned ID); + void addObjPic(ObjPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); +// void addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); + void addSoundChunk(Sound_enum ID, Mix_Chunk* tmp); + ImagePtr getObjPic(ObjPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); + ImagePtr getGuiPic(GuiPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); + Mix_Chunk* getSoundChunk(Sound_enum ID); + Mix_Chunk* concat2Chunks(Sound_enum ID1, Sound_enum ID2); +// std::string getBriefingText(ObjPic_enum mission, ObjPic_enum texttype, ObjPic_enum house); +// std::string getBriefingText(ObjPic_enum i); + + private: - bool addObjPic(unsigned ID) { return false;}; + bool addObjPic(ObjPic_enum ID) { return false;}; remapped_images m_objImg; remapped_images m_guiImg; @@ -398,6 +405,7 @@ Mix_Chunk* concat3Chunks(Mix_Chunk* sound1, Mix_Chunk* sound2, Mix_Chunk* sound3); Mix_Chunk* createEmptyChunk(); +// BriefingText* BriefingStrings[1]; Mix_Chunk* soundChunk[NUM_SOUNDCHUNK]; }; Modified: branches/dunks/include/SoundPlayerClass.h =================================================================== --- branches/dunks/include/SoundPlayerClass.h 2008-04-26 17:38:55 UTC (rev 162) +++ branches/dunks/include/SoundPlayerClass.h 2008-04-27 17:32:34 UTC (rev 163) @@ -4,9 +4,9 @@ #include <string> #include <vector> #include "ResMan.h" +#include "DataCache.h" #include "dMath.h" #include "SDL_mixer.h" -using namespace std; //! \enum MUSICTYPE /*! Types of music available in the game*/ @@ -50,7 +50,7 @@ @param soundID id of the sound to be played @param location coordinates where the sound is to be played */ - void playSoundAt(int soundID, COORDTYPE* location); + void playSoundAt(Sound_enum soundID, COORDTYPE* location); /*! turns music playing on or off @@ -59,8 +59,9 @@ void setMusic(bool value); void toggleSound(); - void playVoice(int id, int house); - void playSound(int soundID); + void playVoice(Sound_enum id, HOUSETYPE house); + void playSound(Sound_enum soundID); + void playSound(Mix_Chunk* sound); inline int GetSfxVolume() { return sfxVolume; }; void SetSfxVolume(int newVolume) { @@ -83,14 +84,14 @@ @param soundID id of a sound to be played @param volume sound will be played with this volume */ - void playSound(int soundID, int volume); - vector<string> getMusicFileNames(string dir); + void playSound(Sound_enum soundID, int volume); + vector<std::string> getMusicFileNames(std::string dir); - vector<string> AttackMusic; - vector<string> IntroMusic; - vector<string> LoseMusic; - vector<string> PeaceMusic; - vector<string> WinMusic; + vector<std::string> AttackMusic; + vector<std::string> IntroMusic; + vector<std::string> LoseMusic; + vector<std::string> PeaceMusic; + vector<std::string> WinMusic; //! whether sound should be played bool soundOn; Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-04-26 17:38:55 UTC (rev 162) +++ branches/dunks/src/DataCache.cpp 2008-04-27 17:32:34 UTC (rev 163) @@ -14,6 +14,7 @@ Shpfile* units; Shpfile* units1; Shpfile* units2; + Cpsfile* herald; //LOADING FILES data = ResMan::Instance()->readFile("DUNE:UNITS.SHP", &len); @@ -24,8 +25,10 @@ data = ResMan::Instance()->readFile("DUNE:UNITS2.SHP", &len); units2 = new Shpfile(data, len); + + data = ResMan::Instance()->readFile("ENGLISH:HERALD.ENG", &len); + herald = new Cpsfile(data, len); - int maplen; unsigned char * mapdata; @@ -94,6 +97,14 @@ addObjPic(ObjPic_SandDamage, units1->getPictureArray(3,1,5|TILE_NORMAL,6|TILE_NORMAL,7|TILE_NORMAL)); addObjPic(ObjPic_Terrain_Hidden, icon->getPictureRow(108,123)); + //addGuiPic(UI_HouseChoiceBackground, herald->getPicture()); + +/* UIGraphic[UI_MentatYes][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(0)); + UIGraphic[UI_MentatYes_Pressed][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(1)); + UIGraphic[UI_MentatNo][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(2)); + UIGraphic[UI_MentatNo_Pressed][HOUSE_HARKONNEN] = DoublePicture(mentat->getPicture(3));*/ + + addSoundChunk(YesSir, getChunkFromFile("VOC:ZREPORT1.VOC")); addSoundChunk(Reporting, getChunkFromFile("VOC:ZREPORT2.VOC")); addSoundChunk(Acknowledged, getChunkFromFile("VOC:ZREPORT3.VOC")); @@ -186,17 +197,38 @@ addSoundChunk(Intro_WhoEver, getChunkFromFile("INTROVOC:WHOEVER.VOC")); addSoundChunk(Intro_Wind_2bp, getChunkFromFile("INTROVOC:WIND2BP.VOC")); addSoundChunk(Intro_Your, getChunkFromFile("INTROVOC:YOUR.VOC")); +#if 0 + SDL_RWops* text_lng[1]; + data = ResMan::Instance()->readFile("ENGLISH:INTRO.ENG", &len); + text_lng[0] = SDL_RWFromMem(data, len); +/* data = ResMan::Instance()->readFile("ENGLISH:TEXTO.ENG", &len); + text_lng[1] = SDL_RWFromMem(data, len); + data = ResMan::Instance()->readFile("ENGLISH:TEXTH.ENG", &len); + text_lng[2] = SDL_RWFromMem(data, len);*/ + int i = 0; + for(i = 0; i < 1; i++){ + BriefingStrings[i] = new BriefingText(text_lng[i]); + SDL_RWclose(text_lng[i]); + } +#endif } -void DataCache::addObjPic(unsigned ID, SDL_Surface * tmp) { +void DataCache::addObjPic(ObjPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { - m_objImg[HOUSE_HARKONNEN]->insert(std::pair<unsigned, ImagePtr>(ID, + m_objImg[HOUSE_HARKONNEN]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, ImagePtr(new Image(tmp)))); } -ImagePtr DataCache::getObjPic(unsigned ID, unsigned house) { +/*void DataCache::addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { + m_guiImg[HOUSE_HARKONNEN]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, + ImagePtr(new Image(tmp)))); +}*/ + + +ImagePtr DataCache::getObjPic(ObjPic_enum ID, HOUSETYPE house) { + images::iterator iter = m_objImg[house]->find(ID); if (iter != m_objImg[house]->end()) { @@ -206,17 +238,34 @@ { ImagePtr source = m_objImg[HOUSE_HARKONNEN]->find(ID)->second; ImagePtr copy = source->getRecoloredByHouse(house); - m_objImg[HOUSE_HARKONNEN]->insert(std::pair<unsigned, ImagePtr>(ID, copy)); + m_objImg[HOUSE_HARKONNEN]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, copy)); return copy; } } -void DataCache::addSoundChunk(unsigned ID, Mix_Chunk* tmp){ +/*ImagePtr DataCache::getGuiPic(GuiPic_enum ID, HOUSETYPE house) { + + images::iterator iter = m_guiImg[house]->find(ID); + if (iter != m_guiImg[house]->end()) + { + return m_guiImg[house]->find(ID)->second; + } + else + { + ImagePtr source = m_guiImg[HOUSE_HARKONNEN]->find(ID)->second; + ImagePtr copy = source->getRecoloredByHouse(house); + m_guiImg[HOUSE_HARKONNEN]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, copy)); + return copy; + } + +}*/ + +void DataCache::addSoundChunk(Sound_enum ID, Mix_Chunk* tmp){ soundChunk[ID] = tmp; } -Mix_Chunk* DataCache::getSoundChunk(unsigned ID){ +Mix_Chunk* DataCache::getSoundChunk(Sound_enum ID){ return soundChunk[ID]; } Mix_Chunk* DataCache::getChunkFromFile(std::string fileName) { @@ -240,6 +289,41 @@ return returnChunk; } +Mix_Chunk* DataCache::concat2Chunks(Mix_Chunk* sound1, Mix_Chunk* sound2) +{ + Mix_Chunk* returnChunk; + if((returnChunk = (Mix_Chunk*) malloc(sizeof(Mix_Chunk))) == NULL) { + return NULL; + } + + returnChunk->allocated = 1; + returnChunk->volume = sound1->volume; + returnChunk->alen = sound1->alen + sound2->alen; + + if((returnChunk->abuf = (Uint8 *)malloc(returnChunk->alen)) == NULL) { + free(returnChunk); + return NULL; + } + + memcpy(returnChunk->abuf, sound1->abuf, sound1->alen); + memcpy(returnChunk->abuf + sound1->alen, sound2->abuf, sound2->alen); + + return returnChunk; +} +/* +std::string DataCache::getBriefingText(ObjPic_enum mission, ObjPic_enum texttype, int house) { + return BriefingStrings[0]->getString(0,0); +} + +std::string DataCache::getBriefingText(int i){ + return BriefingStrings[0]->getString(i); +} +*/ +Mix_Chunk* DataCache::concat2Chunks(Sound_enum ID1, Sound_enum ID2) +{ + return concat2Chunks(soundChunk[ID1], soundChunk[ID2]); +} + DataCache::~DataCache() { } Modified: branches/dunks/src/SoundPlayerClass.cpp =================================================================== --- branches/dunks/src/SoundPlayerClass.cpp 2008-04-26 17:38:55 UTC (rev 162) +++ branches/dunks/src/SoundPlayerClass.cpp 2008-04-27 17:32:34 UTC (rev 163) @@ -257,7 +257,7 @@ } } -void SoundPlayerClass::playSound(int soundID, int volume) +void SoundPlayerClass::playSound(Sound_enum soundID, int volume) { if (soundOn) { @@ -290,7 +290,7 @@ } #endif -void SoundPlayerClass::playSound(int soundID) { +void SoundPlayerClass::playSound(Sound_enum soundID) { if (soundOn) { Mix_Chunk* tmp; @@ -303,6 +303,14 @@ Mix_PlayChannel(-1, tmp, 0); } } + +void SoundPlayerClass::playSound(Mix_Chunk* sound) { + if (soundOn) + { + Mix_PlayChannel(-1, sound, 0); + } +} + #if 0 vector<string> SoundPlayerClass::getMusicFileNames(string dir) { vector<string> Files; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-26 17:39:20
|
Revision: 162 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=162&view=rev Author: dvalin Date: 2008-04-26 10:38:55 -0700 (Sat, 26 Apr 2008) Log Message: ----------- make it possible to specify palette used (ie. bene gesserit mentat graphics requires custom palette) Modified Paths: -------------- branches/dunks/include/pakfile/Cpsfile.h branches/dunks/src/pakfile/Cpsfile.cpp Modified: branches/dunks/include/pakfile/Cpsfile.h =================================================================== --- branches/dunks/include/pakfile/Cpsfile.h 2008-04-26 00:53:46 UTC (rev 161) +++ branches/dunks/include/pakfile/Cpsfile.h 2008-04-26 17:38:55 UTC (rev 162) @@ -4,6 +4,7 @@ #include "Gfx.h" #include "pakfile/Decode.h" #include "SDL.h" +#include "Application.h" #include <boost/shared_ptr.hpp> @@ -16,8 +17,9 @@ Cpsfile(unsigned char * bufFiledata, int bufsize); ~Cpsfile(); + Image * getPicture(SDL_Palette* palette = Application::Instance()->Screen()->getSurface()->format->palette); + Image * getSubPicture(unsigned int left, unsigned int top, unsigned int width, unsigned int height); - Image * getPicture(); private: unsigned char* Filedata; Modified: branches/dunks/src/pakfile/Cpsfile.cpp =================================================================== --- branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-26 00:53:46 UTC (rev 161) +++ branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-26 17:38:55 UTC (rev 162) @@ -1,5 +1,4 @@ #include "pakfile/Cpsfile.h" -#include "Application.h" #include <SDL_endian.h> #include <stdlib.h> #include <string.h> @@ -7,8 +6,6 @@ #define SIZE_X 320 #define SIZE_Y 240 -//extern SDL_Palette* palette; - Cpsfile::Cpsfile(unsigned char * bufFiledata, int bufsize) : Decode() { Filedata = bufFiledata; @@ -20,7 +17,7 @@ ; } -Image * Cpsfile::getPicture() +Image * Cpsfile::getPicture(SDL_Palette* palette) { unsigned char * ImageOut; SDL_Surface *pic = NULL; @@ -50,7 +47,6 @@ } - SDL_Palette* palette = Application::Instance()->Screen()->getSurface()->format->palette; SDL_SetColors(pic, palette->colors, 0, palette->ncolors); SDL_LockSurface(pic); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-26 00:53:50
|
Revision: 161 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=161&view=rev Author: dvalin Date: 2008-04-25 17:53:46 -0700 (Fri, 25 Apr 2008) Log Message: ----------- drop getDoublePicture, Image class already provides getResized.. (I suck) Modified Paths: -------------- branches/dunks/include/pakfile/Cpsfile.h branches/dunks/src/pakfile/Cpsfile.cpp Modified: branches/dunks/include/pakfile/Cpsfile.h =================================================================== --- branches/dunks/include/pakfile/Cpsfile.h 2008-04-26 00:48:39 UTC (rev 160) +++ branches/dunks/include/pakfile/Cpsfile.h 2008-04-26 00:53:46 UTC (rev 161) @@ -18,10 +18,7 @@ Image * getPicture(); - Image * getDoublePicture(); - Image * getSubPicture(unsigned int left, unsigned int top, unsigned int width, unsigned int height); - private: unsigned char* Filedata; Uint32 CpsFilesize; Modified: branches/dunks/src/pakfile/Cpsfile.cpp =================================================================== --- branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-26 00:48:39 UTC (rev 160) +++ branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-26 00:53:46 UTC (rev 161) @@ -69,40 +69,6 @@ return img; } -Image * Cpsfile::getDoublePicture() { - SDL_Surface *inputPic = getPicture()->getSurface(); - SDL_Surface *returnPic; - - // create new picture surface - if((returnPic = SDL_CreateRGBSurface(SDL_HWSURFACE,inputPic->w * 2,inputPic->h * 2,8,0,0,0,0))== NULL) { - fprintf(stderr,"DoublePicture: Cannot create new Picture!\n"); - exit(EXIT_FAILURE); - } - - SDL_SetColors(returnPic, inputPic->format->palette->colors, 0, inputPic->format->palette->ncolors); - SDL_LockSurface(returnPic); - SDL_LockSurface(inputPic); - - //Now we can copy pixel by pixel - for(int y = 0; y < inputPic->h;y++) { - for(int x = 0; x < inputPic->w; x++) { - char val = *( ((char*) (inputPic->pixels)) + y*inputPic->pitch + x); - *( ((char*) (returnPic->pixels)) + 2*y*returnPic->pitch + 2*x) = val; - *( ((char*) (returnPic->pixels)) + 2*y*returnPic->pitch + 2*x+1) = val; - *( ((char*) (returnPic->pixels)) + (2*y+1)*returnPic->pitch + 2*x) = val; - *( ((char*) (returnPic->pixels)) + (2*y+1)*returnPic->pitch + 2*x+1) = val; - } - } - - SDL_UnlockSurface(inputPic); - SDL_UnlockSurface(returnPic); - - SDL_FreeSurface(inputPic); - Image * img = new Image(returnPic); - - return img; -} - Image * Cpsfile::getSubPicture(unsigned int left, unsigned int top, unsigned int width, unsigned int height) { SDL_Surface *Pic = getPicture()->getSurface(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-26 00:48:43
|
Revision: 160 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=160&view=rev Author: dvalin Date: 2008-04-25 17:48:39 -0700 (Fri, 25 Apr 2008) Log Message: ----------- start on adding campaign menu stuff.. Modified Paths: -------------- branches/dunks/src/SConscript Added Paths: ----------- branches/dunks/include/CampaignMenu.h branches/dunks/src/CampaignMenu.cpp Added: branches/dunks/include/CampaignMenu.h =================================================================== --- branches/dunks/include/CampaignMenu.h (rev 0) +++ branches/dunks/include/CampaignMenu.h 2008-04-26 00:48:39 UTC (rev 160) @@ -0,0 +1,30 @@ +#ifndef DUNE_CAMPAIGNMENU_H +#define DUNE_CAMPAIGNMENU_H + +#include "MenuBase.h" +#include "gui2/Button.h" +#include "gui2/VBox.h" + +#include "SDL.h" + + +class CampaignMenuState : public MenuBaseState +{ + public: + CampaignMenuState(); + ~CampaignMenuState(); + + void doCancel(); + + int Execute(float dt); + virtual const char* GetName() { return "CampaignMenuState"; } + + private: + VBox* m_vbox; + + BoringButton* m_butCancel; + ImagePtr m_surf; + +}; + +#endif // DUNE_CAMPAIGNMENU_H Property changes on: branches/dunks/include/CampaignMenu.h ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/src/CampaignMenu.cpp =================================================================== --- branches/dunks/src/CampaignMenu.cpp (rev 0) +++ branches/dunks/src/CampaignMenu.cpp 2008-04-26 00:48:39 UTC (rev 160) @@ -0,0 +1,39 @@ +#include "CampaignMenu.h" + +#include "Application.h" +#include "Settings.h" +#include "DataCache.h" +#include "pakfile/Cpsfile.h" +#include "boost/bind.hpp" + + +CampaignMenuState::CampaignMenuState() +{ + int len; + unsigned char * data = ResMan::Instance()->readFile("ENGLISH:HERALD.ENG", &len); + + CpsfilePtr m_cps (new Cpsfile(data, len)); + + m_surf.reset(m_cps->getPicture()); + m_surf = m_surf->getResized(2); + +} + +CampaignMenuState::~CampaignMenuState() +{ +} + +void CampaignMenuState::doCancel() +{ + assert(mp_parent != NULL); + PopState(); +} + +int CampaignMenuState::Execute(float dt) +{ + m_surf.get()->blitToScreen(SPoint(Settings::Instance()->GetWidth() / 2 - m_surf->getSurface()->w/2, + Settings::Instance()->GetHeight() / 8)); + + return 0; +} + Property changes on: branches/dunks/src/CampaignMenu.cpp ___________________________________________________________________ Name: svn:eol-style + native Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2008-04-25 23:18:46 UTC (rev 159) +++ branches/dunks/src/SConscript 2008-04-26 00:48:39 UTC (rev 160) @@ -24,6 +24,7 @@ "MainMenu.cpp", "IntroState.cpp", "SingleMenu.cpp", + "CampaignMenu.cpp", "OptionsMenu.cpp", "Gfx.cpp", "houses.cpp", # just for colors, hope there will be a better place for these (otpetrik) @@ -46,6 +47,7 @@ "gui2/Button.cpp", "gui2/VBox.cpp", "gui2/Label.cpp", + "gui2/Window.cpp" ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-25 23:18:48
|
Revision: 159 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=159&view=rev Author: dvalin Date: 2008-04-25 16:18:46 -0700 (Fri, 25 Apr 2008) Log Message: ----------- add getDoublePicture & getSubPicture (merged from richies branch) Modified Paths: -------------- branches/dunks/include/pakfile/Cpsfile.h branches/dunks/src/pakfile/Cpsfile.cpp Modified: branches/dunks/include/pakfile/Cpsfile.h =================================================================== --- branches/dunks/include/pakfile/Cpsfile.h 2008-04-25 22:20:03 UTC (rev 158) +++ branches/dunks/include/pakfile/Cpsfile.h 2008-04-25 23:18:46 UTC (rev 159) @@ -18,7 +18,10 @@ Image * getPicture(); + Image * getDoublePicture(); + Image * getSubPicture(unsigned int left, unsigned int top, unsigned int width, unsigned int height); + private: unsigned char* Filedata; Uint32 CpsFilesize; Modified: branches/dunks/src/pakfile/Cpsfile.cpp =================================================================== --- branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-25 22:20:03 UTC (rev 158) +++ branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-25 23:18:46 UTC (rev 159) @@ -68,3 +68,66 @@ return img; } + +Image * Cpsfile::getDoublePicture() { + SDL_Surface *inputPic = getPicture()->getSurface(); + SDL_Surface *returnPic; + + // create new picture surface + if((returnPic = SDL_CreateRGBSurface(SDL_HWSURFACE,inputPic->w * 2,inputPic->h * 2,8,0,0,0,0))== NULL) { + fprintf(stderr,"DoublePicture: Cannot create new Picture!\n"); + exit(EXIT_FAILURE); + } + + SDL_SetColors(returnPic, inputPic->format->palette->colors, 0, inputPic->format->palette->ncolors); + SDL_LockSurface(returnPic); + SDL_LockSurface(inputPic); + + //Now we can copy pixel by pixel + for(int y = 0; y < inputPic->h;y++) { + for(int x = 0; x < inputPic->w; x++) { + char val = *( ((char*) (inputPic->pixels)) + y*inputPic->pitch + x); + *( ((char*) (returnPic->pixels)) + 2*y*returnPic->pitch + 2*x) = val; + *( ((char*) (returnPic->pixels)) + 2*y*returnPic->pitch + 2*x+1) = val; + *( ((char*) (returnPic->pixels)) + (2*y+1)*returnPic->pitch + 2*x) = val; + *( ((char*) (returnPic->pixels)) + (2*y+1)*returnPic->pitch + 2*x+1) = val; + } + } + + SDL_UnlockSurface(inputPic); + SDL_UnlockSurface(returnPic); + + SDL_FreeSurface(inputPic); + Image * img = new Image(returnPic); + + return img; +} + +Image * Cpsfile::getSubPicture(unsigned int left, unsigned int top, unsigned int width, unsigned int height) +{ + SDL_Surface *Pic = getPicture()->getSurface(); + if(Pic == NULL) { + return NULL; + } + + if(((int) (left+width) > Pic->w) || ((int) (top+height) > Pic->h)) { + return NULL; + } + + SDL_Surface *returnPic; + + // create new picture surface + if((returnPic = SDL_CreateRGBSurface(SDL_HWSURFACE,width,height,8,0,0,0,0))== NULL) { + fprintf(stderr,"GetSubPicture: Cannot create new Picture!\n"); + exit(EXIT_FAILURE); + } + + SDL_SetColors(returnPic, Pic->format->palette->colors, 0, Pic->format->palette->ncolors); + + SDL_Rect srcRect = {left,top,width,height}; + SDL_BlitSurface(Pic,&srcRect,returnPic,NULL); + + Image * img = new Image(returnPic); + + return img; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-25 22:20:21
|
Revision: 158 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=158&view=rev Author: dvalin Date: 2008-04-25 15:20:03 -0700 (Fri, 25 Apr 2008) Log Message: ----------- grf, be sure to free ImageOut (previously commented out and commited by accident) Modified Paths: -------------- branches/dunks/src/pakfile/Cpsfile.cpp Modified: branches/dunks/src/pakfile/Cpsfile.cpp =================================================================== --- branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-25 22:18:04 UTC (rev 157) +++ branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-25 22:20:03 UTC (rev 158) @@ -62,9 +62,9 @@ SDL_UnlockSurface(pic); + free(ImageOut); + Image * img = new Image(pic); - -// free(ImageOut); return img; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-25 22:18:26
|
Revision: 157 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=157&view=rev Author: dvalin Date: 2008-04-25 15:18:04 -0700 (Fri, 25 Apr 2008) Log Message: ----------- use shared ptr Modified Paths: -------------- branches/dunks/include/pakfile/Cpsfile.h branches/dunks/src/pakfile/Cpsfile.cpp Modified: branches/dunks/include/pakfile/Cpsfile.h =================================================================== --- branches/dunks/include/pakfile/Cpsfile.h 2008-04-24 22:22:22 UTC (rev 156) +++ branches/dunks/include/pakfile/Cpsfile.h 2008-04-25 22:18:04 UTC (rev 157) @@ -1,9 +1,15 @@ #ifndef CPSFILE_H_INCLUDED #define CPSFILE_H_INCLUDED +#include "Gfx.h" #include "pakfile/Decode.h" #include "SDL.h" +#include <boost/shared_ptr.hpp> + +class Cpsfile; +typedef boost::shared_ptr<Cpsfile> CpsfilePtr; + class Cpsfile : public Decode { public: @@ -11,7 +17,7 @@ ~Cpsfile(); - SDL_Surface * getPicture(); + Image * getPicture(); private: unsigned char* Filedata; Modified: branches/dunks/src/pakfile/Cpsfile.cpp =================================================================== --- branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-24 22:22:22 UTC (rev 156) +++ branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-25 22:18:04 UTC (rev 157) @@ -20,7 +20,7 @@ ; } -SDL_Surface* Cpsfile::getPicture() +Image * Cpsfile::getPicture() { unsigned char * ImageOut; SDL_Surface *pic = NULL; @@ -61,8 +61,10 @@ } SDL_UnlockSurface(pic); + + Image * img = new Image(pic); + +// free(ImageOut); - free(ImageOut); - - return 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-04-24 22:22:35
|
Revision: 156 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=156&view=rev Author: dvalin Date: 2008-04-24 15:22:22 -0700 (Thu, 24 Apr 2008) Log Message: ----------- merge string reading code from richie's branch Modified Paths: -------------- branches/dunks/src/SConscript Added Paths: ----------- branches/dunks/include/pakfile/StringFile.h branches/dunks/src/pakfile/StringFile.cpp Added: branches/dunks/include/pakfile/StringFile.h =================================================================== --- branches/dunks/include/pakfile/StringFile.h (rev 0) +++ branches/dunks/include/pakfile/StringFile.h 2008-04-24 22:22:22 UTC (rev 156) @@ -0,0 +1,50 @@ +#ifndef STRINGFILE_H_INCLUDED +#define STRINGFILE_H_INCLUDED + +#include <string> + + +#define MISSION_DESCRIPTION 0 +#define MISSION_WIN 1 +#define MISSION_LOSE 2 +#define MISSION_ADVICE 3 + + +/// A class for loading a encoded textfiles. +/** + This class can read encoded textfiles and return their content in decoded ANSI Code. +*/ +class StringFile +{ +public: + StringFile(unsigned char * bufFiledata, int bufsize); + ~StringFile(); + + /// This method returns the briefing/debriefing text. + /** + This method returns the briefing/debriefing text for the mission specified by the parameter mission. The second + parameter specifies the kind of briefing/debriefing. + \param mission the mission number (0=House description; 1,2,...,9 = mission description). + \param texttype one of MISSION_DESCRIPTION, MISSION_WIN, MISSION_LOSE, MISSION_ADVICE + \return the text for this mission and of this type. + */ + std::string getString(unsigned int mission, unsigned int texttype) { + int index = mission*4+texttype; + + if(index < numStrings) { + return stringArray[index]; + } else { + return "StringFile::getString(): mission number or text type is invalid!\n"; + } + } + std::string getString(int i){ + return stringArray[i]; + } + +private: + std::string decodeString(std::string text); + std::string *stringArray; + int numStrings; +}; + +#endif // STRINGFILE_H_INCLUDED Property changes on: branches/dunks/include/pakfile/StringFile.h ___________________________________________________________________ Name: svn:eol-style + native Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2008-04-24 18:52:12 UTC (rev 155) +++ branches/dunks/src/SConscript 2008-04-24 22:22:22 UTC (rev 156) @@ -30,9 +30,9 @@ "Strings.cpp", "Log.cpp", "ConfigFile.cpp", - "ResMan.cpp", "SoundPlayerClass.cpp", + "pakfile/StringFile.cpp", "pakfile/Vocfile.cpp", "pakfile/IntegratedLibSampleRate/samplerate.c", "pakfile/IntegratedLibSampleRate/src_linear.c", @@ -86,5 +86,5 @@ pakview = env.Program("../test", ["pakview.cpp"] + pakview_sources + gui_sources + pak_sources ) Default(dunelegacy) -Default(pakview) +#Default(pakview) Added: branches/dunks/src/pakfile/StringFile.cpp =================================================================== --- branches/dunks/src/pakfile/StringFile.cpp (rev 0) +++ branches/dunks/src/pakfile/StringFile.cpp 2008-04-24 22:22:22 UTC (rev 156) @@ -0,0 +1,258 @@ +#include "pakfile/StringFile.h" +#include <SDL_endian.h> +#include <SDL.h> +#include <SDL_rwops.h> +#include <iostream> +#include <string> + +StringFile::StringFile(unsigned char * bufFiledata, int bufsize){ + Uint16* index; + SDL_RWops* RWop = SDL_RWFromMem(bufFiledata, bufsize); + + if(RWop == NULL) { + fprintf(stderr, "StringFile: RWop == NULL!\n"); + exit(EXIT_FAILURE); + } + + if(bufsize <= 0) { + fprintf(stderr,"StringFile: Cannot determine size!\n"); + exit(EXIT_FAILURE); + } + + if(bufsize < 2) { + fprintf(stderr, "StringFile: Invalid string file: File too small!\n"); + exit(EXIT_FAILURE); + } + + if(SDL_RWseek(RWop,0,SEEK_SET) != 0) { + fprintf(stderr,"StringFile: Seeking string file failed!\n"); + exit(EXIT_FAILURE); + } + + if( (bufFiledata = (unsigned char*) malloc(bufsize)) == NULL) { + fprintf(stderr,"StringFile: Allocating memory failed!\n"); + exit(EXIT_FAILURE); + } + + if(SDL_RWread(RWop, bufFiledata, bufsize, 1) != 1) { + fprintf(stderr,"StringFile: Reading string file failed!\n"); + exit(EXIT_FAILURE); + } + + numStrings = ((int)SDL_SwapLE16(((Uint16*) bufFiledata)[0]))/2 - 1; + index = (Uint16*) bufFiledata; + for(int i=0; i <= numStrings; i++) { + index[i] = SDL_SwapLE16(index[i]); + } + + stringArray = new std::string[numStrings]; + + for(int i=0; i < numStrings;i++) { + std::string tmp = (const char*) (bufFiledata+index[i]); + stringArray[i] = decodeString(tmp); + } + + free(bufFiledata); + SDL_RWclose(RWop); +} + +StringFile::~StringFile() { + delete [] stringArray; +} + +/// This methode decodes a string to ANSI Code +/** + The parameter text is decoded to ANSI Code and returned + \param text Text to decode + \return The decoded text +*/ +std::string StringFile::decodeString(std::string text) { + std::string out = ""; + unsigned char databyte; + + for(unsigned int i = 0; i < text.length(); i++) { + databyte = text[i]; + + switch(databyte) { + case 0x00: break; + case 0x0C: out += "\n"; break; + case 0x0D: out += "\n"; break; + + case 0x80: out += " t"; break; + case 0x81: out += " a"; break; + case 0x82: out += " s"; break; + case 0x83: out += " i"; break; + case 0x84: out += " o"; break; + case 0x85: out += " "; break; // maybe something else + case 0x86: out += " w"; break; + case 0x87: out += " b"; break; + case 0x88: out += "e "; break; + case 0x89: out += "er"; break; + case 0x8A: out += "en"; break; + case 0x8B: out += "es"; break; + case 0x8C: out += "ed"; break; + case 0x8D: out += "ea"; break; + case 0x8E: out += "el"; break; + case 0x8F: out += "em"; break; + + case 0x90: out += "th"; break; + case 0x91: out += "t "; break; + case 0x92: out += "ti"; break; + case 0x93: out += "te"; break; + case 0x94: out += "to"; break; + case 0x95: out += "tr"; break; + case 0x96: out += "ta"; break; + case 0x97: out += "ts"; break; + case 0x98: out += "an"; break; + case 0x99: out += "ar"; break; + case 0x9A: out += "at"; break; + case 0x9B: out += "al"; break; + case 0x9C: out += "ac"; break; + case 0x9D: out += "a "; break; + case 0x9E: out += "as"; break; + case 0x9F: out += "ay"; break; + + case 0xA0: out += "in"; break; + case 0xA1: out += "is"; break; + case 0xA2: out += "it"; break; + case 0xA3: out += "ic"; break; + case 0xA4: out += "il"; break; + case 0xA5: out += "io"; break; + case 0xA6: out += "ie"; break; + case 0xA7: out += "ir"; break; + case 0xA8: out += "n "; break; + case 0xA9: out += "nd"; break; + case 0xAA: out += "nt"; break; + case 0xAB: out += "ng"; break; + case 0xAC: out += "ne"; break; + case 0xAD: out += "ns"; break; + case 0xAE: out += "ni"; break; + case 0xAF: out += "no"; break; + + case 0xB0: out += "on"; break; + case 0xB1: out += "or"; break; + case 0xB2: out += "o "; break; + case 0xB3: out += "ou"; break; + case 0xB4: out += "of"; break; + case 0xB5: out += "om"; break; + case 0xB6: out += "os"; break; + case 0xB7: out += "ow"; break; + case 0xB8: out += "s "; break; + case 0xB9: out += "st"; break; + case 0xBA: out += "se"; break; + case 0xBB: out += "sp"; break; + case 0xBC: out += "s."; break; + case 0xBD: out += "si"; break; + case 0xBE: out += "sc"; break; + case 0xBF: out += "sa"; break; + + case 0xC0: out += "re"; break; + case 0xC1: out += "r "; break; + case 0xC2: out += "ro"; break; + case 0xC3: out += "ri"; break; + case 0xC4: out += "ra"; break; + case 0xC5: out += "rd"; break; + case 0xC6: out += "ru"; break; + case 0xC7: out += "rr"; break; + case 0xC8: out += "l "; break; + case 0xC9: out += "ll"; break; + case 0xCA: out += "la"; break; + case 0xCB: out += "le"; break; + case 0xCC: out += "li"; break; + case 0xCD: out += "le"; break; + case 0xCE: out += "lo"; break; + case 0xCF: out += "ld"; break; + + case 0xD0: out += "he"; break; + case 0xD1: out += "hi"; break; + case 0xD2: out += "ha"; break; + case 0xD3: out += "h "; break; + case 0xD4: out += "ho"; break; + case 0xD5: out += "ht"; break; + case 0xD6: out += "hr"; break; + case 0xD7: out += "hu"; break; + case 0xD8: out += "ce"; break; + case 0xD9: out += "ct"; break; + case 0xDA: out += "co"; break; + case 0xDB: out += "ca"; break; + case 0xDC: out += "ck"; break; + case 0xDD: out += "ch"; break; + case 0xDE: out += "cl"; break; + case 0xDF: out += "cr"; break; + + case 0xE0: out += "d "; break; + case 0xE1: out += "de"; break; + case 0xE2: out += "di"; break; + case 0xE3: out += "du"; break; + case 0xE4: out += "d,"; break; + case 0xE5: out += "d."; break; + case 0xE6: out += "do"; break; + case 0xE7: out += "da"; break; + case 0xE8: out += "un"; break; + case 0xE9: out += "us"; break; + case 0xEA: out += "ur"; break; + case 0xEB: out += "uc"; break; + case 0xEC: out += "ut"; break; + case 0xED: out += "ul"; break; + case 0xEE: out += "ua"; break; + case 0xEF: out += "ui"; break; + + case 0xF0: out += "pl"; break; + case 0xF1: out += "pe"; break; + case 0xF2: out += "po"; break; + case 0xF3: out += "pi"; break; + case 0xF4: out += "pr"; break; + case 0xF5: out += "pa"; break; + case 0xF6: out += "pt"; break; + case 0xF7: out += "pp"; break; + case 0xF8: out += "me"; break; + case 0xF9: out += "ma"; break; + case 0xFA: out += "mo"; break; + case 0xFB: out += "mi"; break; + case 0xFC: out += "mp"; break; + case 0xFD: out += "m "; break; + case 0xFE: out += "mb"; break; + case 0xFF: out += "mm"; break; + + case 0x1B: { + // special character + i++; + if(i == text.length()) { + fprintf(stderr,"StringFile:decodeString: Special character escape sequence at end of string!\n"); + exit(EXIT_FAILURE); + } + + unsigned char special = text[i]; + switch(special) { + // e.g. german "umlaute" + case 0x02: out += (unsigned char) 252 /*"ue"*/; break; + case 0x05: out += (unsigned char) 228 /*"ae"*/; break; + case 0x0F: out += (unsigned char) 197 /*"Ae"*/; break; + case 0x15: out += (unsigned char) 246 /*"oe"*/; break; + case 0x1B: out += (unsigned char) 220 /*"Ue"*/; break; + case 0x62: out += (unsigned char) 223 /*"ss"*/; break; + default: { + char tmp[20]; + sprintf(tmp,"---Unknown char:%X---",special); + out += tmp; + } break; + }; + + } break; + + case 0x1F: out += "."; break; + + default: { + if((databyte & 0x80) == 0x80) { + char tmp[20]; + sprintf(tmp,"---Unknown char:%X---",databyte); + out += tmp; + } else { + out += databyte; + } + } break; + } + } + + return out; +} Property changes on: branches/dunks/src/pakfile/StringFile.cpp ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-24 18:52:54
|
Revision: 155 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=155&view=rev Author: dvalin Date: 2008-04-24 11:52:12 -0700 (Thu, 24 Apr 2008) Log Message: ----------- don't link against libzzip Modified Paths: -------------- branches/dunks/SConstruct Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2008-04-24 16:46:49 UTC (rev 154) +++ branches/dunks/SConstruct 2008-04-24 18:52:12 UTC (rev 155) @@ -24,7 +24,6 @@ if sys.platform != "win32": env.ParseConfig('sdl-config --cflags --libs') - env.ParseConfig('pkg-config --cflags --libs zziplib') env.Append(CCFLAGS=["-Wall", "-pedantic", "-O0"]) #, "-Werror"]) #env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) #env.Append(LINKFLAGS = ["-ffast-math"]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-24 16:47:00
|
Revision: 154 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=154&view=rev Author: dvalin Date: 2008-04-24 09:46:49 -0700 (Thu, 24 Apr 2008) Log Message: ----------- add docs describing some of the data formats.. Added Paths: ----------- branches/dunks/src/pakfile/cnc_specs.txt branches/dunks/src/pakfile/duneii_shp_specs.txt branches/dunks/src/pakfile/duneii_specs.txt Added: branches/dunks/src/pakfile/cnc_specs.txt =================================================================== --- branches/dunks/src/pakfile/cnc_specs.txt (rev 0) +++ branches/dunks/src/pakfile/cnc_specs.txt 2008-04-24 16:46:49 UTC (rev 154) @@ -0,0 +1,623 @@ + + COMMAND & CONQUER FILE FORMATS + +Revision 4 + +by Vladan Bato (ba...@ge...) + +This document explains the file formats used by Command & Conquer. + +Command & Conquer is a tradmark of Westwood Studios, Inc. +Command & Conquer is Copyright (C)1995 Westwood Studios, Inc. + +The information provided here is meant for programmers that want to make +editor and utilites for Command & Conquer. My explanation might not be +the best one, but it should be enough. + +I can't guarantee that the information in here is correct. If you find any +errors, please report them to me. + +In this document I'll use Pascal notation, and any code samples will be in +Pascal.... +I wanted to rewrite them in C, but I don't have the time to test the code. +So, to avoid any risks, I'll use the code from Mix Manager. + +In case you don't know, the information contained here has been used to +make the program Mix Manager, which contains a lot of conversion utilities +for the various formats. For more info, check my homepage (see the end of the +document). + +=================== + 1. THE .MIX FILES +=================== + +You probably already know the format of these files, but I will add a +description here for completeness. + +The MIX file consists of two parts : +-A header including the index of all the files contained within +-A body containing all the files + +It's format is : + + Header : record + NumFiles : word; {Number of files in MIX} + DataSize : longint; {Size of body} + Index : array [1..NumFiles] of + record + ID : longint; {File ID} + Start : longint; {Offset of file from the start of the body} + Size : longint; {file size} + end; + end; + +The ID field is computed from the original filename, which is not stored in +the MIX. +The records are always sorted by the ID field (the numbers are signed +longints). +Note that the offsets are relative to the start of the body so to find the +actual offset in the MIX you have to add the size of the header which is +NumFiles*12+6 + +=================== + 2. THE .PAL FILES +=================== + +The most easiest files.... +These files contain the palette in the same format used by VGA cards. + + Palette : array [0..255] of record + red,green,blue:byte; + end; + +Note that only the first 6 bits of each number are used, giving a total of +262144 possible colors (as opposed to the 8 bits used by .PCX files for +example). + +================================= + 3. THE TEMPLATE AND .BIN FILES +================================= + +The Template files contain the map graphics, and can be found in the +theater specific MIX files (TEMPERAT.MIX, WINTER.MIX, DESERT.MIX). +The .BIN files contain the maps for the missions and are used in conjunction +with the .INI files. + +I won't explain them here. They are explained with great detail in the +document titled "Command & Conquer maps" I wrote some time ago. +The said document can be found on my homepage. + +=================== + 5. THE .SHP FILES +=================== + +The .SHP files contain almost all the graphics : units, structures, trees,... +The header has the following structure : + + Header : record + NumImages : word; {Number of images} + A,B : word; {Unknown} + Width, + Height : word; {Width and Height of the images} + C : longint; {Unknown} + end; + +If you know something about those unknown fields, please e-mail me. +Following that there's an array of records, one for each image : + + Offsets : array [0..NumImages+1] of + record + Offset : longint; {Offset and format of image in file} + RefOffs : longint; {Offset and format of image on + which it is based} + end; + +The most significant byte (last) of the Offset and RefOffs fields +contains the format, while the lower three are used for the offset. +The format byte can have one of the three values : 80h, 40h, 20h. +I will call the three image formats Format80, Format40 and Format20. + +The Format80 images are compressed with a compression method I'll explain +later. + +The Format40 images must be xor-ed with a Format80 image. That's what the +RefOffs field is used for. It tells which Format80 image they are +based upon. The Format40 will be explained in detail later. + +The Format20 images use the same format as the Format40, the difference is +that they are xor-ed with the image that precedes them in the file. That can +be either in Format20 or in Format40. +The offset part of the RefOffs field contains the number of the first +Format40 image in the chain, and the format field is always 48h. + +Here's an example : + +0) Off0(three bytes) 80h 000000h 00h +1) Off1(three bytes) 80h 000000h 00h +2) Off2(three bytes) 40h Off1 80h +3) Off3(three bytes) 80h 000000h 00h +4) Off4(three bytes) 40h Off1 80h +5) Off5(three bytes) 20h 000400h 48h +6) Off6(three bytes) 20h 000400h 48h +7) Off7(three bytes) 40h Off3 80h + +For example to draw image 7, you have to draw the image 3 first (whose offset +and format are given) and then xor image 7 over it. + +To draw image 6, you have to xor it over the previous image, i.e. 5, which +is format20 again, that means that it has to be xor-ed over image 4, which +is in format40, i.e. it must be xor-ed over the image in format80 it has a +reference to. In this case it's image 1. Thus the chain is 1,4,5,6. +This is one way to see it, the other could be : +Image 6 is in Format20, the RefOffs field contains the number of the first +Format40 image in the chain, in this case image 4. To draw Image 4, the +Image 1 has to be drawn first, next is image 4, and then all the images +from the 4th to the 6th have to be xor-ed over the previous. + +I made some experiments and found out that you don't have to use the +Format40 and Format20 images. I tried converting all of them into Format80 +and it worked. + +Also, when changing graphics, note that all the unit and structure graphics +should be drawn using the GDI colors, which will be automatically converted +for the other sides. +The palette you should use is one of those found in DESERT.MIX, WINTER.MIX +and TEMPERAT.MIX. The GDI colors are colors 0B0h-0BFh. The other colors +won't be converted and will remain the same for all the sides (be sure to +use only the colors that are the same all three palettes). + +The above applies only to the graphics that appear in all three theaters +(the .SHP file found in CONQUER.MIX). The graphics for the structures and +overlays that appear in a single theater (found inside the theater specific +MIX) can use the palette entries that are unique for that theater (and will +be shown with garbled colors in the others). + +Also a special color is used for shadows. It's color 04h. In the palettes +it's bright green, but C&C puts a shadow instead of it. I don't know how +the shadows are calculated however. + +You should've noticed that the array has NumImages+2 elements when only +NumImages elements are needed. The last one contains zeros, and the one before +that points to the end of the file. These two can be used to identify the file +as a .SHP. + +Here's the description of the compression formats : Format80 and Format40. + +---------- + Format80 +---------- + +There are several different commands, with different sizes : form 1 to 5 +bytes. +The positions mentioned below always refer to the destination buffer (i.e. +the uncompressed image). The relative positions are relative to the current +position in the destination buffer, which is one byte beyond the last written +byte. + +I will give some sample code at the end. + +QKniGhT: struct foo_t { long offset; /* Offset and format of image in file */ long ref_offs; /* Offset and format of image on which it is based */ } Offsets[NumImages+2]; + +(1) 1 byte + +---+---+---+---+---+---+---+---+ + | 1 | 0 | | | | | | | + +---+---+---+---+---+---+---+---+ + \_______________________/ + | + Count + + This one means : copy next Count bytes as is from Source to Dest. + +(2) 2 bytes + +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+ + | 0 | | | | | | | | | | | | | | | | | + +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+ + \___________/\__________________________________________________/ + | | + Count-3 Relative Pos. + + This means copy Count bytes from Dest at Current Pos.-Rel. Pos. to + Current position. + Note that you have to add 3 to the number you find in the bits 4-6 of the + first byte +o obtain the Count. + Note that if the Rel. Pos. is 1, that means repeat Count times the previous + byte. + +(3) 3 bytes + +---+---+---+---+---+---+---+---+ +---------------+---------------+ + | 1 | 1 | | | | | | | | | | + +---+---+---+---+---+---+---+---+ +---------------+---------------+ + \_______________________/ Pos + | + Count-3 + + Copy Count bytes from Pos, where Pos is absolute from the start of the + destination buffer. (Pos is a word, that means that the images can't be + larger than 64K) + +(4) 4 bytes + +---+---+---+---+---+---+---+---+ +-------+-------+ +-------+ + | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | | | | | | + +---+---+---+---+---+---+---+---+ +-------+-------+ +-------+ + Count Color + + Write Color Count times. + (Count is a word, color is a byte) + +(5) 5 bytes + +---+---+---+---+---+---+---+---+ +-------+-------+ +-------+-------+ + | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | | | | | | | + +---+---+---+---+---+---+---+---+ +-------+-------+ +-------+-------+ + Count Pos + + Copy Count bytes from Dest. starting at Pos. Pos is absolute from the start + of the Destination buffer. + Both Count and Pos are words. + +These are all the commands I found out. Maybe there are other ones, but I +haven't seen them yet. + +All the images end with a 80h command. + +To make things more clearer here's a piece of code that will uncompress the +image. + + DP = destination pointer + SP = source pointer + Source and Dest are the two buffers + + + SP:=0; + DP:=0; + repeat + Com:=Source[SP]; + inc(SP); + b7:=Com shr 7; {b7 is bit 7 of Com} +#in c b7= com >> 7; /* b7 is bit 7 of Com */ + case b7 of + 0 : begin {copy command (2)} + {Count is bits 4-6 + 3} + Count:=(Com and $7F) shr 4 + 3; +#in c count = (com && ???) >> 4 + 3; + {Position is bits 0-3, with bits 0-7 of next byte} + Posit:=(Com and $0F) shl 8+Source[SP]; + Inc(SP); + {Starting pos=Cur pos. - calculated value} + Posit:=DP-Posit; + for i:=Posit to Posit+Count-1 do + begin + Dest[DP]:=Dest[i]; + Inc(DP); + end; + end; + 1 : begin + {Check bit 6 of Com} + b6:=(Com and $40) shr 6; + case b6 of + 0 : begin {Copy as is command (1)} + Count:=Com and $3F; {mask 2 topmost bits} + if Count=0 then break; {EOF marker} + for i:=1 to Count do + begin + Dest[DP]:=Source[SP]; + Inc(DP); + Inc(SP); + end; + end; + 1 : begin {large copy, very large copy and fill commands} + {Count = (bits 0-5 of Com) +3} + {if Com=FEh then fill, if Com=FFh then very large copy} + Count:=Com and $3F; + if Count<$3E then {large copy (3)} + begin + Inc(Count,3); + {Next word = pos. from start of image} + Posit:=Word(Source[SP]); + Inc(SP,2); + for i:=Posit to Posit+Count-1 do + begin + Dest[DP]:=Dest[i]; + Inc(DP); + end; + end + else if Count=$3F then {very large copy (5)} + begin + {next 2 words are Count and Pos} + Count:=Word(Source[SP]); + Posit:=Word(Source[SP+2]); + Inc(SP,4); + for i:=Posit to Posit+Count-1 do + begin + Dest[DP]:=Dest[i]; + Inc(DP); + end; + end else + begin {Count=$3E, fill (4)} + {Next word is count, the byte after is color} + Count:=Word(Source[SP]); + Inc(SP,2); + b:=Source[SP]; + Inc(SP); + for i:=0 to Count-1 do + begin + Dest[DP]:=b; + inc(DP); + end; + end; + end; + end; + end; + end; + until false; + +Note that you won't be able to compile this code, because the typecasting +won't work. (But I'm sure you'll be able to fix it). + + +---------- + Format40 +---------- + +As I said before the images in Format40 must be xor-ed over a previous image, +or against a black screen (as in the .WSA format). +It is used when there are only minor changes between an image and a following +one. + +Here I'll assume that the old image is in Dest, and that the Dest pointer is +set to the beginning of that buffer. + +As for the Format80, there are many commands : + + +(1) 1 byte + byte + +---+---+---+---+---+---+---+---+ + | 1 | | | | | | | | + +---+---+---+---+---+---+---+---+ + \___________________________/ + | + Count + + Skip count bytes in Dest (move the pointer forward). + +(2) 3 bytes + byte word + +---+---+---+---+---+---+---+---+ +---+-----+-------+ + | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | 0 | ... | | + +---+---+---+---+---+---+---+---+ +---+-----+-------+ + \_____________/ + | + Count + + Skip count bytes. + +(3) 3 bytes + byte word + +---+---+---+---+---+---+---+---+ +---+---+-----+-------+ + | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | 1 | 0 | ... | | + +---+---+---+---+---+---+---+---+ +---+---+-----+-------+ + \_____________/ + | + Count + + Xor next count bytes. That means xor count bytes from Source with bytes + in Dest. + +(4) 4 bytes + byte word byte + +---+---+---+---+---+---+---+---+ +---+---+-----+-------+ +-------+ + | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | 1 | 1 | ... | | | | + +---+---+---+---+---+---+---+---+ +---+---+-----+-------+ +-------+ + \_____________/ value + | + Count + + Xor next count bytes in Dest with value. + +5) 1 byte + byte + +---+---+---+---+---+---+---+---+ + | 0 | | | | | | | | + +---+---+---+---+---+---+---+---+ + \___________________________/ + | + Count + + Xor next count bytes from source with dest. + +6) 3 bytes + byte byte byte + +---+---+---+---+---+---+---+---+ +-------+ +-------+ + | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | | | | + +---+---+---+---+---+---+---+---+ +-------+ +-------+ + Count Value + + Xor next count bytes with value. + + +All images end with a 80h 00h 00h command. + +I think these are all the commands, but there might be some other. +If you find anything new, please e-mail me. + +As before here's some code : + + DP = destination pointer + SP = source pointer + Source is buffer containing the Format40 data + Dest is the buffer containing the image over which the second has + to be xor-ed + + + SP:=0; + DP:=0; + repeat + Com:=Source[SP]; + Inc(SP); + + if (Com and $80)<>0 then {if bit 7 set} + begin + if Com<>$80 then {small skip command (1)} + begin + Count:=Com and $7F; + Inc(DP,Count); + end + else {Big commands} + begin + Count:=Word(Source[SP]); + if Count=0 then break; + Inc(SP,2); + + Tc:=(Count and $C000) shr 14; {Tc=two topmost bits of count} + + case Tc of + 0,1 : begin {Big skip (2)} + Inc(DP,Count); + end; + 2 : begin {big xor (3)} + Count:=Count and $3FFF; + for i:=1 to Count do + begin + Dest[DP]:=Dest[DP] xor Source[SP]; + Inc(DP); + Inc(SP); + end; + end; + 3 : begin {big repeated xor (4)} + Count:=Count and $3FFF; + b:=Source[SP]; + Inc(SP); + for i:=1 to Count do + begin + Dest[DP]:=Dest[DP] xor b; + Inc(DP); + end; + end; + end; + end; + end else {xor command} + begin + Count:=Com; + if Count=0 then + begin {repeated xor (6)} + Count:=Source[SP]; + Inc(SP); + b:=Source[SP]; + Inc(SP); + for i:=1 to Count do + begin + Dest[DP]:=Dest[DP] xor b; + Inc(DP); + end; + end else {copy xor (5)} + for i:=1 to Count do + begin + Dest[DP]:=Dest[DP] xor Source[SP]; + Inc(DP); + Inc(SP); + end; + end; + until false; + + + +=================== + 6. THE .CPS FILES +=================== + +The .CPS files contain 320x200x256 images. The images are compressed with the +Format80 compression method. They may or may not contain a palette. + +The header has the following structure : + + Header : record + Size : word; {File size - 2} + Unknown : word; {Always 0004h} + ImSize : word; {Size of uncompressed image (always FA00h)} + Palette : longint; {Is there a palette ?} + end; + +If Palette is 03000000h then there's a palette after the header, otherwise +the image follows. +CPS file without palette can be found in the SETUP.MIX file, and they all use +the Palette that can be found inside the same .MIX. + +The image that follows the palette (or the Header) is in Format80 which is +explained above. + +=================== + 7. THE .WSA FILES +=================== + + +WSA files contain short animations and can be found in the GENERAL.MIX files. +They are basically a series of Format40 images, that are then compressed with +Format80. + +The header is : + + Header : record + NumFrames : word; {Number of frames} + X,Y : word; {Position on screen of the upper left corner} + W,H : word; {Width and height of the images} + Delta : longint; {Frames/Sec = Delta/(2^10)} + end; + +Following that there's an array of offsets : + + Offsets : array [0..NumFrames+1] of longint; + +The obtain the actual offset, you have to add 300h. That is the size of the +palette that follows the Offsets array. +As for .SHP files the two last offsets have a special meaning. +If the last offset is 0 then the one before it points to the end of file +(after you added 300h of course). +If the last one is <>0 then it points to the end of the file, and the +one before it points to a special frame that gives you the difference between +the last and the first frame. This is used when you have to loop the +animation. + +As I said before, the images are in Format40 but are then compressed with +Format80. That means that you first have to uncompress the Format80 and then +decode the Format40 image you obtain. +The first frame should be xor-ed over a black image (filled with zeros), all +the other are xor-ed over the previous one. + +There is a variant of the file without the palette that can be found in +SETUP.MIX but I wasn't able to decode it (maybe there are some commands I +don't know about)... + +===================== + 8. ADDITIONAL NOTES +===================== + +The VQA files (that contain movies) have been decoded by Aaron Glover +(ar...@ib...), and are explained in a document he wrote up. +You can find the document on my homepage (or ask him directly). + +What is still missing are the .AUD files. +It seems that the AUD files use some kind of lossy sound compression, +which means that it is almost impossible to decode them. +However if someone manages to work them out, I'd really appreciate some +info. + +I know my explanations are not very good, but you'll have to bear them, +unless someone else wants to rewrite this. + +============ + 9. CREDITS +============ + +I wish to thank the following people : + +-Andrew Griffin (bu...@ad...) for starting it all. +-Aaron Glover (ar...@ib...) and + Denis Moeller (d.m...@re...) for their work on .SHP files. +-Aaron Glover for decoding the VQA files. +-Carl Kenner (and...@un...) for the info on .CPS files. + + +Vladan Bato (ba...@ge...) +http://www.geocities.com/SiliconValley/8682 + Property changes on: branches/dunks/src/pakfile/cnc_specs.txt ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/src/pakfile/duneii_shp_specs.txt =================================================================== --- branches/dunks/src/pakfile/duneii_shp_specs.txt (rev 0) +++ branches/dunks/src/pakfile/duneii_shp_specs.txt 2008-04-24 16:46:49 UTC (rev 154) @@ -0,0 +1,143 @@ + SHP file specifications for DUNE2 game (c) by WESTWOOD and VIRIN + ================================================================== + (c) by Joachim Schiele <js...@du...> +REVISION 1 + +What are SHP files btw? +======================= +SHP is a method of saving multible graphics in one file and also be able +to have some kind of compression. In this case "DUNE II" it's format80 +compression mode. The "DUNE II" code is a little bit different from the one +of "Command and Conqueror" hacked by Vladan Bato. Major parts of this +informations are from him and only needed some little modifications to be +compatible with the ones of "DUNE II". But in case you want to work with +this format i think it's better if it's function is documented. +Explanations and example codes are in "c", see sandtools how to code a +extractor/converter for shpfiles. + +============ + HEAD +============ + +*** File: ../data/pak/dune/arrow.shp (hextype output) +00000000 : 09 00 28 00 00 00 34 00-00 00 B3 00 00 00 36 01 : ................ +00000001 : 00 00 A7 01 00 00 17 02-00 00 A0 02 00 00 21 03 : ................ +00000002 : 00 00 B3 03 00 00 0A 04-00 00 02 00 01 01 00 01 : ................ +00000003 : 0C 00 02 00 00 01 00 00-10 10 00 10 7F 00 B8 00 : ................ + exampe 1 + +(symbolized diagram) +00000000 : XX XX YY YY YY YY YY YY-YY YY YY YY YY YY YY YY : ................ +00000001 : YY YY YY YY YY YY YY YY-YY YY YY YY YY YY YY YY : ................ +00000002 : YY YY YY YY YY YY EE EE-QQ QQ QQ QQ QQ QQ QQ QQ : ................ +00000003 : QQ QQ QQ QQ QQ QQ QQ QQ-QQ QQ QQ QQ QQ QQ QQ QQ : ................ + +The XXXX(short) field has the "number of images" in it, afterwards an array +of "image offsets" is following. The "number of images" field has 2byte. The +offsels after the "number of images" field take 4byte each. There are +"number of images" + one EOF (2byte) field. In example 1. the XXXX contains +0x0900(hex). So you have (9x 4byte + 2byte EOF) of offsetfields. +(Symboliced with 36x YY fields, and 2x EE EOF fileds) + +EXCEPTION: +---------- +There are shpfiles which don't follow this stricktly rule. If the "number of +images" field has exactly 1 image in it, it may be that there is no 4byte long +offsetfield aftwerwards, it's only 2byte (not 4byte!). If this is the case +there is only a 2byte Offsetfield and a 2byte EOF field afterwards. +But it depends, sometimes files with 1 image inside don't have this exception. +You have to check this or you get in trouble. (see example 2.) + +*** File: ../data/pak/finale/credit43.shp +00000000 : 01 00 08 00 00 00 E8 1B-00 00 00 00 6E B6 00 6E : ................ +00000001 : E0 1B 80 4D 83 9A 9A 99-C9 01 00 81 99 20 04 EA : ................ + exampe 2 + +00000000 : XX XX YY YY EE EE QQ QQ-QQ QQ QQ QQ QQ QQ QQ QQ : ................ +00000001 : QQ QQ QQ QQ QQ QQ QQ QQ-QQ QQ QQ QQ QQ QQ QQ QQ : ................ + +In this example there is only 1 image inside (2byte "XX XX") for the +"number of images" field and followed by a (2byte "YY YY") offsetfield. +And the (2byte "EE EE") EndOfFile field. +Afterwards the QQ fields (imagedata) follows. + +============ + BODY +============ + +How to find the real start of a internal image in a shpfile? + +The body of a shpfile starts at the first "image offset" symbolized with +"YY YY YY YY" (see ex. 1) in this case it would be at byte "28" and ends +at byte "34-1". The END- and START-offsets of a image stored in a shpfile is +calculated with the [StartOffset of the following image] - 1(byte). +The "EE EE" (EndOfFile) field has the END-offset of the last image in the +shpfile. +But becareful with this start- and endoffsets because a image inside the +shpfile doesn't start at the startoffset nor does it end at a endoffset. +The images starts at [startoffset+2byte] and it ends at [endoffset + 2]. +As you can see both offsets need to be moved 2byte on. + +Let's have a deeper look into this BODY: + +*** File: deathhand.shp +00000000 : 07 00 20 00 00 00 85 00-00 00 DB 00 00 00 1F 01 : ................ +00000001 : 00 00 77 01 00 00 B9 01-00 00 0D 02 00 00 57 02 : ................ +00000002 : 00 00 00 00 10 10 00 10-65 00 6E 00 8E 0C 00 0F : ................ +00000003 : 0C 0C 00 0E 0C EA 0C 00-0D 0C B8 00 06 83 0C 0C : ................ +00000004 : E8 10 07 81 0B 00 07 10-08 81 0A 10 08 10 09 81 : ................ +00000005 : 09 20 09 10 0A 81 08 30-0A 10 0B 87 07 0C 0C 0C : ................ +00000006 : EC E8 E8 00 06 8F 00 07-00 03 0C E9 E8 EC 00 09 : ................ +00000007 : 00 04 EC E8 E9 00 26 82-00 04 00 28 30 08 10 20 : ................ +00000008 : 85 08 00 10 00 10 80 00-00 10 10 00 10 56 00 6B : ................ + exampe 3 + +As you can see this shpfile stores 7 graphics. And the first image is at 0x20. + +00000002 : 00 00 00 00 10 10 00 10-65 00 6E 00 8E 0C 00 0F : ................ +00000002 : RR RR TT NN Y_ X_ NN Y_ SS SS CK CK QQ QQ QQ QQ : ................ + +RR : belongs always to the last image's end. in this case it's the first image + in the shpfile so there can't be a EOF of a previous image. + +NN : simply nothing, or maybe i don't know but dune2 doesn't make use of it. +TT : it's a type field, there are 4 different types: + 0000: Start with format80 command || Always end with 0x80 command + 0001: Always start with "0" || Always end with 0x80 command + 0002: ?? || ?? + 0003: can start with 0,1,2,3,4,6 || Always end with "0" +Y_ : it's the y dimension of the image [hight] + as you can see this field is there twice but i didn't find a reason why? + both fields always match, i tested it with all shpimages from DUNE II +X_ : it's the x dimension of the image [width] +SS : (read as unsigned short) + it's the size of the first image of this shp file + 10 so if you want to + have the real size of the image it's "0x0065-a" in hex or + "101-10=91" in dec. +CK : (read as unsigned short) + it's the ckecksum of the image, if you add all counts while decode80 + together you get this value. +QQ : again, it's the imagedata + +00000008 : 85 08 00 10 00 10 80 00-00 10 10 00 10 56 00 6B : ................ +00000008 : QQ QQ QQ QQ QQ QQ QQ NN NN NN NN NN NN NN NN NN : ................ + +QQ : imagedata +NN : noting -> next image + +So here we can see that this image usually ends with 0x80, that's because it's +format80 and 0x80 means command 1 with count=0 so EOF is reached ;-) +But see format80 specification for further informations. + +============ + CREDITS +============ + +I wish to thank especially Valadan Bato because of his work on CNC +-Vladan Bato (ba...@ge...) + +And also thanks to the following people : + +-Andrew Griffin (bu...@ad...) +-Aaron Glover (ar...@ib...) + Denis Moeller (d.m...@re...) for their work on .SHP files. Property changes on: branches/dunks/src/pakfile/duneii_shp_specs.txt ___________________________________________________________________ Name: svn:eol-style + native Added: branches/dunks/src/pakfile/duneii_specs.txt =================================================================== --- branches/dunks/src/pakfile/duneii_specs.txt (rev 0) +++ branches/dunks/src/pakfile/duneii_specs.txt 2008-04-24 16:46:49 UTC (rev 154) @@ -0,0 +1,117 @@ +================================= + DUNEII FILE SPECIFICATIONS +================================= + +Started: +14.01.2001 22:37:32 + +by Joachim Schiele <js...@du...> + +This docu explains the file formats used by "dune2 - the battle for arrakis" + +"dune is a trademark of dino de laurentiis corp. & licensed by MCA UNIVERSAL +MARCHANDISING, INC. +"dune2 - the battle for arrakis" is Copyright (C)1992 Westwood Studios, Inc. +All rights reserved. + +The information provided here is meant for programmers that want to make +editor and utilites for "dune2 - the battle for arrakis". + +A lot of work had already be done by Vladano Bato (ba...@ge...) +with his document "COMMAND AND CONQUEROR FILE FORMATS" so i want to thank +him very much. + +I put some example c-code in. And everything mentioned about coding is c. + +So here a list of what can be found here: +------------------------------------------ + + 1. pak files + 2. cps files + 3. shp files + 4. pal files + 6. emc files + 7. fnt files + 8. tbl files + 9. voc files + 10. code 80/40/20 + +========================== + 1. The pak-files +========================== + +The PAK-files are devided up into a HEAD and a BODY. +The HEAD could be like this: + +aa 02 00 00 34 23 34 34 24 34 34 23 34 34 23 12 | ................ +00 aa 02 10 00 34 23 34 34 24 34 34 23 34 34 23 | ................ +52 4d 59 2e 56 4f 43 00 d9 c9 05 00 41 43 41 50 | ................ +54 55 52 45 2e 56 4f 43 00 fb e9 05 00 41 4e 45 | ................ +58 54 2e 56 4f 43 00 dd 03 06 00 41 4e 45 58 54 | ................ +32 2e 56 4f 43 00 00 00 00 00 43 72 65 61 74 69 | ................ +76 65 20 56 6f 69 63 65 20 46 69 6c 65 1a 1a 00 | ................ +0a 01 29 11 01 c3 4b 00 ab 00 83 83 83 83 83 83 | ................ +83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 | ................ +83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 | ................ +83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 | ................ + +StartOffsets: +You can see the "aa 02 00 00" -> read it with "unsigned long" then you +will get "00 00 02 aa" as hexaddress in the file - now set your fd +to this offset you can read out the contence of the IDEFIXII.VOC. After +the filename there is always a seperator "00" so you know how +to seperate the names and the offsets. Then you can read the next offset +of the file ASTERIX.VOC it is "00 10 02 aa" so you get the startoffset of +it. + +EndOffsets: +The endoffsets of a file "IDEFIXII.VOC" would be just one byte before the +startoffset of "ASTERIX.VOC". +So the offsets of "IDEFIXII.VOC" would be: + StartOffset: "00 00 02 aa" + EndOffset : "00 10 02 aa" - 1 so "00 10 02 A9" +But the last file in the pak doesn't have these method to generate it's +endoffset because there isn't any file afterwards the get the startoffset form. +So the last file in the HEADER has it's endoffset at the fileend of the +pakfile. + +The head is seperated from the body with 5x00 you can see this in my +example "00 00 00 00 00 43 72 65 .. .. .." this is like the "00" after +a filename to seperate it from the next and then there would be the next +offset of the next filename .... and so on. + +see /src/pakextract.c for more informations on this. i have put some +comments in the code so you are not on you own :) + +========================== + 2. The cps-files +========================== +These files are very much like those from CNC. +Format80 compression is used + +========================== + 3. The shp-files +========================== +========================== + 4. pal files +========================== +========================== + 6. emc files +========================== +========================== + 7. fnt files +========================== +========================== + 8. tbl files +========================== +========================== + 9. voc files +========================== +voc files are compressed audio files for duneii usually in mono format +and with a very low encoding rate +linux: there is a tool called sox which is able to convert this format to wav + +========================== + 10. code 80/40/20 +========================== + Property changes on: branches/dunks/src/pakfile/duneii_specs.txt ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-20 22:56:42
|
Revision: 152 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=152&view=rev Author: dvalin Date: 2008-04-20 15:56:39 -0700 (Sun, 20 Apr 2008) Log Message: ----------- build with -pedantic Modified Paths: -------------- branches/dunks/SConstruct Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2008-04-20 22:56:12 UTC (rev 151) +++ branches/dunks/SConstruct 2008-04-20 22:56:39 UTC (rev 152) @@ -25,7 +25,7 @@ if sys.platform != "win32": env.ParseConfig('sdl-config --cflags --libs') env.ParseConfig('pkg-config --cflags --libs zziplib') - env.Append(CCFLAGS=["-Wall", "-O0"]) #, "-Werror"]) + env.Append(CCFLAGS=["-Wall", "-pedantic", "-O0"]) #, "-Werror"]) #env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) #env.Append(LINKFLAGS = ["-ffast-math"]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-20 22:56:18
|
Revision: 151 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=151&view=rev Author: dvalin Date: 2008-04-20 15:56:12 -0700 (Sun, 20 Apr 2008) Log Message: ----------- remove extra ';' Modified Paths: -------------- branches/dunks/src/DataCache.cpp branches/dunks/src/gui2/Label.cpp branches/dunks/src/pakview.cpp Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-04-20 22:08:19 UTC (rev 150) +++ branches/dunks/src/DataCache.cpp 2008-04-20 22:56:12 UTC (rev 151) @@ -187,7 +187,7 @@ addSoundChunk(Intro_Wind_2bp, getChunkFromFile("INTROVOC:WIND2BP.VOC")); addSoundChunk(Intro_Your, getChunkFromFile("INTROVOC:YOUR.VOC")); -}; +} void DataCache::addObjPic(unsigned ID, SDL_Surface * tmp) { Modified: branches/dunks/src/gui2/Label.cpp =================================================================== --- branches/dunks/src/gui2/Label.cpp 2008-04-20 22:08:19 UTC (rev 150) +++ branches/dunks/src/gui2/Label.cpp 2008-04-20 22:56:12 UTC (rev 151) @@ -25,12 +25,12 @@ // Is it needed in case of label. It's not clickable or anything. // Widget::setSize(SPoint(textw, texth)); -}; +} Label::~Label() { -}; +} void Label::draw(Image * dest, SPoint off) { Modified: branches/dunks/src/pakview.cpp =================================================================== --- branches/dunks/src/pakview.cpp 2008-04-20 22:08:19 UTC (rev 150) +++ branches/dunks/src/pakview.cpp 2008-04-20 22:56:12 UTC (rev 151) @@ -17,7 +17,7 @@ void throw_exception(std::exception const & e) { - }; + } } @@ -107,4 +107,4 @@ Settings::Destroy(); return 0; -}; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |