- First commit
This commit is contained in:
75
compress.cpp
Normal file
75
compress.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
struct actor_t
|
||||
{
|
||||
uint8_t x, y, z, t;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *f;
|
||||
f = fopen("data/Cuina.map", "rb");
|
||||
for (int i=0; i<256; ++i) {
|
||||
bool ignore = false;
|
||||
char buffer[33]; int size;
|
||||
|
||||
fread(buffer, 33, 1, f); size = buffer[0]; for (int j=0; j<size; ++j) buffer[j] = buffer[j+1]; buffer[size]=0;
|
||||
if (strcmp(buffer, "sense_nom")==0) ignore = true;
|
||||
if (!ignore) printf("Nom: %s", buffer);
|
||||
|
||||
int zona = fgetc(f);
|
||||
|
||||
uint8_t mapa[12][12][10]; fread(mapa, 12*12*10, 1, f);
|
||||
if (!ignore) {
|
||||
int zeros=0; for (int z=0;z<10;++z) for (int y=0;y<12;++y) for (int x=0;x<12;++x) if (mapa[x][y][z]!=0) zeros++;
|
||||
printf(" Size: %i\n", zeros+180);
|
||||
}
|
||||
|
||||
/*bool on_zeros = false;
|
||||
int zero_count = 0;
|
||||
int total_size = 0;
|
||||
if (!ignore) {
|
||||
for (int z=0;z<10;++z) for (int y=0;y<12;++y) for (int x=0;x<12;++x) {
|
||||
if (mapa[x][y][z]==0) {
|
||||
if (on_zeros) {
|
||||
zero_count++;
|
||||
if (zero_count==255) {
|
||||
on_zeros=false;
|
||||
total_size++;
|
||||
}
|
||||
} else {
|
||||
on_zeros=true;
|
||||
zero_count=0;
|
||||
total_size++;
|
||||
}
|
||||
} else {
|
||||
if (on_zeros) {
|
||||
on_zeros=false;
|
||||
total_size+=2;
|
||||
} else {
|
||||
total_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(" Size: %i\n", total_size);
|
||||
}*/
|
||||
|
||||
uint8_t flags[12][12][10]; fread(flags, 12*12*10, 1, f);
|
||||
/*if (!ignore) {
|
||||
int zeros=0; for (int z=0;z<10;++z) for (int y=0;y<12;++y) for (int x=0;x<12;++x) if (flags[x][y][z]!=0) zeros++;
|
||||
printf("Zeros: %i\n", zeros);
|
||||
}*/
|
||||
|
||||
fread(buffer, 33, 1, f); size = buffer[0]; for (int j=0; j<size; ++j) buffer[j] = buffer[j+1]; buffer[size]=0;
|
||||
|
||||
uint8_t portes[6];
|
||||
fread(portes, 6, 1, f);
|
||||
actor_t actors[15];
|
||||
fread(actors, sizeof(actor_t)*15, 1, f);
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user