mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-22 07:13:07 +01:00
Use IPlatformEnvironment for loading g1.dat
This commit is contained in:
@@ -264,7 +264,7 @@ namespace OpenRCT2
|
||||
private:
|
||||
bool LoadBaseGraphics()
|
||||
{
|
||||
if (!gfx_load_g1())
|
||||
if (!gfx_load_g1(_env))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16
|
||||
void gfx_filter_rect(rct_drawpixelinfo *dpi, sint32 left, sint32 top, sint32 right, sint32 bottom, FILTER_PALETTE_ID palette);
|
||||
|
||||
// sprite
|
||||
bool gfx_load_g1();
|
||||
bool gfx_load_g1(void * platformEnvironment);
|
||||
bool gfx_load_g2();
|
||||
bool gfx_load_csg();
|
||||
void gfx_unload_g1();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "../core/Path.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../PlatformEnvironment.h"
|
||||
#include "../sprites.h"
|
||||
#include "../ui/UiContext.h"
|
||||
|
||||
@@ -88,12 +89,15 @@ extern "C"
|
||||
*
|
||||
* rct2: 0x00678998
|
||||
*/
|
||||
bool gfx_load_g1()
|
||||
bool gfx_load_g1(void * platformEnvironment)
|
||||
{
|
||||
log_verbose("gfx_load_g1()");
|
||||
auto env = (IPlatformEnvironment *)platformEnvironment;
|
||||
|
||||
log_verbose("gfx_load_g1(...)");
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(get_file_path(PATH_ID_G1), FILE_MODE_OPEN);
|
||||
auto path = Path::Combine(env->GetDirectoryPath(DIRBASE::RCT2, DIRID::DATA), "g1.dat");
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
rct_g1_header header = fs.ReadValue<rct_g1_header>();
|
||||
|
||||
/* number of elements is stored in g1.dat, but because the entry
|
||||
|
||||
Reference in New Issue
Block a user