forked from rosebudai/OpenRCT2-Web
refactor RCT1 import code
This commit is contained in:
1 parent
072a1d8d22
commit
c9ea1b6979
7 files changed
+1101
-1098
No files matched your search
@@ -62,6 +62,7 @@
|
||||
<ClCompile Include="..\src\platform\unix.c" />
|
||||
<ClCompile Include="..\src\platform\osx.c" />
|
||||
<ClCompile Include="..\src\platform\windows.c" />
|
||||
<ClCompile Include="..\src\rct1.c" />
|
||||
<ClCompile Include="..\src\rct2.c" />
|
||||
<ClCompile Include="..\src\ride\ride.c" />
|
||||
<ClCompile Include="..\src\ride\ride_data.c" />
|
||||
|
||||
@@ -363,7 +363,6 @@
|
||||
<ClCompile Include="..\src\interface\viewport_interaction.c">
|
||||
<Filter>Source\Interface</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||
<ClCompile Include="..\src\world\footpath.c">
|
||||
<Filter>Source\World</Filter>
|
||||
</ClCompile>
|
||||
@@ -429,6 +428,9 @@
|
||||
<ClCompile Include="..\src\world\scenery.c">
|
||||
<Filter>Source\World</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\rct1.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\management\award.h">
|
||||
|
||||
+52
-1097
File diff suppressed because it is too large.
Load diff
+1013
File diff suppressed because it is too large.
Load diff
@@ -343,5 +343,10 @@ typedef struct{
|
||||
uint16 start_track_data_AA_CF; // 0xC4
|
||||
}rct_track_td4; // Information based off RCTTechDepot
|
||||
|
||||
bool rct1_read_sc4(const char *path, rct1_s4 *s4);
|
||||
bool rct1_read_sv4(const char *path, rct1_s4 *s4);
|
||||
void rct1_import_s4(rct1_s4 *src);
|
||||
void rct1_fix_landscape();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,6 +81,32 @@ long fsize(FILE *fp)
|
||||
return size;
|
||||
}
|
||||
|
||||
bool readentirefile(const char *path, void **outBuffer, long *outLength)
|
||||
{
|
||||
FILE *fp;
|
||||
long fpLength;
|
||||
void *fpBuffer;
|
||||
|
||||
// Open file
|
||||
fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return 0;
|
||||
|
||||
// Get length
|
||||
fseek(fp, 0, SEEK_END);
|
||||
fpLength = ftell(fp);
|
||||
rewind(fp);
|
||||
|
||||
// Read whole file into a buffer
|
||||
fpBuffer = malloc(fpLength);
|
||||
fread(fpBuffer, fpLength, 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
*outBuffer = fpBuffer;
|
||||
*outLength = fpLength;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bitscanforward(int source)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -30,6 +30,7 @@ int mph_to_kmph(int mph);
|
||||
const char *path_get_filename(const char *path);
|
||||
void path_set_extension(char *path, const char *extension);
|
||||
long fsize(FILE *fp);
|
||||
bool readentirefile(const char *path, void **outBuffer, long *outLength);
|
||||
|
||||
int bitscanforward(int source);
|
||||
bool strequals(const char *a, const char *b, int length, bool caseInsensitive);
|
||||
|
||||
Reference in new issue
Block a user