2015-08-27 14:28:25 +00:00
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_BACKGROUND_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_BACKGROUND_H
|
2022-06-17 17:26:59 +00:00
|
|
|
|
2020-09-18 16:45:42 +00:00
|
|
|
#include <engine/shared/map.h>
|
2022-06-17 17:26:59 +00:00
|
|
|
|
2017-09-12 18:13:53 +00:00
|
|
|
#include <game/client/components/maplayers.h>
|
2015-08-27 14:28:25 +00:00
|
|
|
|
2022-06-17 17:26:59 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
class CLayers;
|
|
|
|
class CMapImages;
|
|
|
|
|
2016-05-02 19:35:32 +00:00
|
|
|
// Special value to use background of current map
|
2020-10-02 14:21:18 +00:00
|
|
|
#define CURRENT_MAP "%current%"
|
2015-08-27 14:32:45 +00:00
|
|
|
|
2020-09-18 16:45:42 +00:00
|
|
|
class CBackgroundEngineMap : public CMap
|
|
|
|
{
|
|
|
|
MACRO_INTERFACE("background_enginemap", 0)
|
|
|
|
};
|
|
|
|
|
2017-09-12 18:13:53 +00:00
|
|
|
class CBackground : public CMapLayers
|
2015-08-27 14:28:25 +00:00
|
|
|
{
|
2020-09-18 16:45:42 +00:00
|
|
|
protected:
|
2015-08-27 14:28:25 +00:00
|
|
|
IEngineMap *m_pMap;
|
|
|
|
bool m_Loaded;
|
2020-06-18 16:29:27 +00:00
|
|
|
char m_aMapName[MAX_MAP_LENGTH];
|
2015-08-27 14:28:25 +00:00
|
|
|
|
|
|
|
//to avoid spam when in menu
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t m_LastLoad;
|
2015-08-27 14:28:25 +00:00
|
|
|
|
|
|
|
//to avoid memory leak when switching to %current%
|
2020-09-18 16:45:42 +00:00
|
|
|
CBackgroundEngineMap *m_pBackgroundMap;
|
2015-08-27 14:28:25 +00:00
|
|
|
CLayers *m_pBackgroundLayers;
|
|
|
|
CMapImages *m_pBackgroundImages;
|
|
|
|
|
2020-09-18 16:45:42 +00:00
|
|
|
virtual CBackgroundEngineMap *CreateBGMap();
|
|
|
|
|
2015-08-27 14:28:25 +00:00
|
|
|
public:
|
2020-09-18 16:45:42 +00:00
|
|
|
CBackground(int MapType = CMapLayers::TYPE_BACKGROUND_FORCE, bool OnlineOnly = true);
|
|
|
|
virtual ~CBackground();
|
2022-01-31 02:11:47 +00:00
|
|
|
virtual int Sizeof() const override { return sizeof(*this); }
|
2015-08-27 14:28:25 +00:00
|
|
|
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnInit() override;
|
|
|
|
virtual void OnMapLoad() override;
|
|
|
|
virtual void OnRender() override;
|
2015-08-27 14:28:25 +00:00
|
|
|
|
|
|
|
void LoadBackground();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|