Commit 2b983990 authored by anotherguest's avatar anotherguest

Code cleanup

parent 877b517e
...@@ -82,7 +82,7 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width, ...@@ -82,7 +82,7 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width,
int pixels = 0; int pixels = 0;
unsigned char* endpixdata = pixdata+width*height; unsigned char* endpixdata = pixdata+width*height;
unsigned char* fillstart = NULL; unsigned char* fillstart = NULL;
while (size>0) { while (size > 0) {
unsigned char header = f->loadChar(); unsigned char header = f->loadChar();
switch (header) { switch (header) {
...@@ -121,7 +121,9 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width, ...@@ -121,7 +121,9 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width,
unsigned char fillColor = f->loadChar(); unsigned char fillColor = f->loadChar();
unsigned char fillWidth = ((header-0x40)+1); unsigned char fillWidth = ((header-0x40)+1);
memset(pixdata, fillColor, fillWidth); memset(pixdata, fillColor, fillWidth);
fillstart = pixdata; fillstart = pixdata;
while(fillstart+fillWidth < endpixdata) { while(fillstart+fillWidth < endpixdata) {
memset(fillstart, fillColor, fillWidth); memset(fillstart, fillColor, fillWidth);
fillstart+=width; fillstart+=width;
...@@ -132,13 +134,15 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width, ...@@ -132,13 +134,15 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width,
size--; size--;
} }
else { else {
int copyWidth = (header&0x3f)+1; int copyWidth = (header & 0x3f)+1;
unsigned char color; unsigned char color;
for(int col = 0;col<copyWidth;col++) { for(int col = 0;col < copyWidth;col++) {
color= f->loadChar(); color= f->loadChar();
fillstart = pixdata; fillstart = pixdata;
while(fillstart<endpixdata) {
while(fillstart < endpixdata) {
*fillstart = color; *fillstart = color;
fillstart+=width; fillstart+=width;
} }
...@@ -152,7 +156,6 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width, ...@@ -152,7 +156,6 @@ void Scene::LoadCompacted(int& size, File* f, unsigned char* pixdata, int width,
} }
size--; size--;
} }
LOG("PL Compacts pixels", pixels); LOG("PL Compacts pixels", pixels);
...@@ -245,11 +248,8 @@ void Scene::loadAni (File *f, int dataIndex) { ...@@ -245,11 +248,8 @@ void Scene::loadAni (File *f, int dataIndex) {
break; break;
case E1LAniHeader: case E1LAniHeader: {
{
LOG("PL 1L Background Type", 1); LOG("PL 1L Background Type", 1);
SDL_Surface* surface;
unsigned char* pixels; unsigned char* pixels;
pixels = new unsigned char[SW* SH]; pixels = new unsigned char[SW* SH];
memset(pixels, 0, SW*SH); memset(pixels, 0, SW*SH);
...@@ -258,9 +258,7 @@ void Scene::loadAni (File *f, int dataIndex) { ...@@ -258,9 +258,7 @@ void Scene::loadAni (File *f, int dataIndex) {
delete[] pixels; delete[] pixels;
// Use the most recently loaded palette // Use the most recently loaded palette
video.setPalette(palettes->palette); video.setPalette(palettes->palette);
} }
break; break;
case EFFAniHeader: case EFFAniHeader:
...@@ -293,14 +291,12 @@ void Scene::loadAni (File *f, int dataIndex) { ...@@ -293,14 +291,12 @@ void Scene::loadAni (File *f, int dataIndex) {
case ESTAniHeader: // Sound item case ESTAniHeader: // Sound item
{ {
unsigned char soundIndex = f->loadChar(); unsigned char soundIndex = f->loadChar();
unsigned char soundNote = f->loadChar(); unsigned char soundNote = f->loadChar();
unsigned char soundOffset = f->loadChar(); unsigned char soundOffset = f->loadChar();
LOG("PL Audio tag with index", soundIndex); LOG("PL Audio tag with index", soundIndex);
LOG("PL Audio tag play at ", soundNote); LOG("PL Audio tag play at ", soundNote);
LOG("PL Audio tag play offset ", soundOffset); LOG("PL Audio tag play offset ", soundOffset);
} }
break; break;
......
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