diff options
| author | oy <Tom_Adams@web.de> | 2010-10-06 23:07:35 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-10-06 23:07:35 +0200 |
| commit | 3a98f7a048c044ce0d870320fc0b1def0db4f7fb (patch) | |
| tree | 7dfa1826e537355b37d00e77558ca623a915bac2 /src/engine/client | |
| parent | a62a7413d1ff25c8e07657b96a485f001004619a (diff) | |
| download | zcatch-3a98f7a048c044ce0d870320fc0b1def0db4f7fb.tar.gz zcatch-3a98f7a048c044ce0d870320fc0b1def0db4f7fb.zip | |
added mod system. Closes #34
Diffstat (limited to 'src/engine/client')
| -rw-r--r-- | src/engine/client/client.cpp | 17 | ||||
| -rw-r--r-- | src/engine/client/client.h | 4 | ||||
| -rw-r--r-- | src/engine/client/graphics.cpp | 12 | ||||
| -rw-r--r-- | src/engine/client/graphics.h | 4 | ||||
| -rw-r--r-- | src/engine/client/sound.cpp | 2 | ||||
| -rw-r--r-- | src/engine/client/text.cpp | 2 |
6 files changed, 16 insertions, 25 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 4952446f..7c0c632e 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -585,7 +585,7 @@ void CClient::ServerInfoRequest() int CClient::LoadData() { - m_DebugFont = Graphics()->LoadTexture("debug_font.png", CImageInfo::FORMAT_AUTO, IGraphics::TEXLOAD_NORESAMPLE); + m_DebugFont = Graphics()->LoadTexture("debug_font.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, IGraphics::TEXLOAD_NORESAMPLE); return 1; } @@ -990,7 +990,7 @@ void CClient::ProcessPacket(CNetChunk *pPacket) m_MapdownloadChunk = 0; str_copy(m_aMapdownloadName, pMap, sizeof(m_aMapdownloadName)); - m_MapdownloadFile = Storage()->OpenFile(m_aMapdownloadFilename, IOFLAG_WRITE); + m_MapdownloadFile = Storage()->OpenFile(m_aMapdownloadFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE); m_MapdownloadCrc = MapCrc; m_MapdownloadTotalsize = -1; m_MapdownloadAmount = 0; @@ -1537,13 +1537,6 @@ void CClient::Update() m_ServerBrowser.Update(); } -const char *CClient::UserDirectory() -{ - static char saPath[1024] = {0}; - fs_storage_path("Teeworlds", saPath, sizeof(saPath)); - return saPath; -} - void CClient::VersionUpdate() { if(m_VersionInfo.m_State == 0) @@ -1871,7 +1864,7 @@ void CClient::Con_AddFavorite(IConsole::IResult *pResult, void *pUserData) pSelf->m_ServerBrowser.AddFavorite(Addr); } -const char *CClient::DemoPlayer_Play(const char *pFilename) +const char *CClient::DemoPlayer_Play(const char *pFilename, int StorageType) { int Crc; const char *pError; @@ -1881,7 +1874,7 @@ const char *CClient::DemoPlayer_Play(const char *pFilename) // try to start playback m_DemoPlayer.SetListner(this); - if(m_DemoPlayer.Load(Storage(), m_pConsole, pFilename)) + if(m_DemoPlayer.Load(Storage(), m_pConsole, pFilename, StorageType)) return "error loading demo"; // load map @@ -1926,7 +1919,7 @@ const char *CClient::DemoPlayer_Play(const char *pFilename) void CClient::Con_Play(IConsole::IResult *pResult, void *pUserData) { CClient *pSelf = (CClient *)pUserData; - pSelf->DemoPlayer_Play(pResult->GetString(0)); + pSelf->DemoPlayer_Play(pResult->GetString(0), IStorage::TYPE_ALL); } void CClient::DemoRecorder_Start(const char *pFilename) diff --git a/src/engine/client/client.h b/src/engine/client/client.h index aa381467..d9199b94 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -259,8 +259,6 @@ public: void Update(); - virtual const char *UserDirectory(); - void InitEngine(const char *pAppname); void RegisterInterfaces(); void InitInterfaces(); @@ -283,7 +281,7 @@ public: void RegisterCommands(); - const char *DemoPlayer_Play(const char *pFilename); + const char *DemoPlayer_Play(const char *pFilename, int StorageType); void DemoRecorder_Start(const char *pFilename); virtual class CEngine *Engine() { return &m_Engine; } diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp index 14a88394..665f9ce7 100644 --- a/src/engine/client/graphics.cpp +++ b/src/engine/client/graphics.cpp @@ -354,7 +354,7 @@ int CGraphics_OpenGL::LoadTextureRaw(int Width, int Height, int Format, const vo } // simple uncompressed RGBA loaders -int CGraphics_OpenGL::LoadTexture(const char *pFilename, int StoreFormat, int Flags) +int CGraphics_OpenGL::LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags) { int l = str_length(pFilename); int Id; @@ -362,7 +362,7 @@ int CGraphics_OpenGL::LoadTexture(const char *pFilename, int StoreFormat, int Fl if(l < 3) return -1; - if(LoadPNG(&Img, pFilename)) + if(LoadPNG(&Img, pFilename, StorageType)) { if (StoreFormat == CImageInfo::FORMAT_AUTO) StoreFormat = Img.m_Format; @@ -375,7 +375,7 @@ int CGraphics_OpenGL::LoadTexture(const char *pFilename, int StoreFormat, int Fl return m_InvalidTexture; } -int CGraphics_OpenGL::LoadPNG(CImageInfo *pImg, const char *pFilename) +int CGraphics_OpenGL::LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType) { char aCompleteFilename[512]; unsigned char *pBuffer; @@ -384,7 +384,7 @@ int CGraphics_OpenGL::LoadPNG(CImageInfo *pImg, const char *pFilename) // open file for reading png_init(0,0); // ignore_convention - IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, aCompleteFilename, sizeof(aCompleteFilename)); + IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, StorageType, aCompleteFilename, sizeof(aCompleteFilename)); if(File) io_close(File); else @@ -450,7 +450,7 @@ void CGraphics_OpenGL::ScreenshotDirect(const char *pFilename) char aWholePath[1024]; png_t Png; // ignore_convention - IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_WRITE, aWholePath, sizeof(aWholePath)); + IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE, aWholePath, sizeof(aWholePath)); if(File) io_close(File); @@ -898,7 +898,7 @@ void CGraphics_SDL::Swap() { IOHANDLE io; str_format(aFilename, sizeof(aFilename), "screenshots/screenshot%s-%05d.png", aDate, Index); - io = m_pStorage->OpenFile(aFilename, IOFLAG_READ); + io = m_pStorage->OpenFile(aFilename, IOFLAG_READ, IStorage::TYPE_SAVE); if(io) io_close(io); else diff --git a/src/engine/client/graphics.h b/src/engine/client/graphics.h index fa360a22..ef6360e8 100644 --- a/src/engine/client/graphics.h +++ b/src/engine/client/graphics.h @@ -87,8 +87,8 @@ public: virtual int LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags); // simple uncompressed RGBA loaders - virtual int LoadTexture(const char *pFilename, int StoreFormat, int Flags); - virtual int LoadPNG(CImageInfo *pImg, const char *pFilename); + virtual int LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags); + virtual int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType); void ScreenshotDirect(const char *pFilename); diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index b829686c..69fd7462 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -325,7 +325,7 @@ int CSound::LoadWV(const char *pFilename) if(!m_pStorage) return -1; - ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ); // TODO: use system.h stuff for this + ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL); if(!ms_File) { dbg_msg("sound/wv", "failed to open %s", pFilename); diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index bdf71dbb..0fb6b043 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -70,7 +70,7 @@ struct CFontSizeData class CFont { public: - char m_aFilename[128]; + char m_aFilename[512]; FT_Face m_FtFace; CFontSizeData m_aSizes[NUM_FONT_SIZES]; }; |