Commit 5a60ec98 authored by anotherguest's avatar anotherguest

File functions with don't seek flag (don't reset position after reading). To support scenes better

parent 82603dd7
...@@ -187,7 +187,7 @@ unsigned char * File::loadBlock (int length) { ...@@ -187,7 +187,7 @@ unsigned char * File::loadBlock (int length) {
} }
unsigned char * File::loadRLE (int length) { unsigned char * File::loadRLE (int length, bool dontseek) {
unsigned char *buffer; unsigned char *buffer;
int rle, pos, byte, count, next; int rle, pos, byte, count, next;
...@@ -229,7 +229,9 @@ unsigned char * File::loadRLE (int length) { ...@@ -229,7 +229,9 @@ unsigned char * File::loadRLE (int length) {
} }
if(!dontseek) {
fseek(f, next, SEEK_SET); fseek(f, next, SEEK_SET);
}
return buffer; return buffer;
...@@ -293,9 +295,9 @@ char * File::loadString () { ...@@ -293,9 +295,9 @@ char * File::loadString () {
} }
SDL_Surface * File::loadSurface (int width, int height) { SDL_Surface * File::loadSurface (int width, int height, bool dontseek) {
return createSurface(loadRLE(width * height), width, height); return createSurface(loadRLE(width * height, dontseek), width, height);
} }
......
...@@ -52,10 +52,10 @@ class File { ...@@ -52,10 +52,10 @@ class File {
signed long int loadInt (); signed long int loadInt ();
void storeInt (signed long int val); void storeInt (signed long int val);
unsigned char * loadBlock (int length); unsigned char * loadBlock (int length);
unsigned char * loadRLE (int length); unsigned char * loadRLE (int length, bool dontseek = false);
void skipRLE (); void skipRLE ();
char * loadString (); char * loadString ();
SDL_Surface * loadSurface (int width, int height); SDL_Surface * loadSurface (int width, int height, bool dontseek = false);
void loadPalette (SDL_Color *palette); void loadPalette (SDL_Color *palette);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment