debug a bit

This commit is contained in:
Tim Felgentreff 2020-04-13 23:33:16 +02:00
parent b8ded8a695
commit fa05f65bac
3 changed files with 2 additions and 43 deletions

View file

@ -90,6 +90,7 @@ void MissileType::LoadMissileSprite()
}
// Correct the number of frames in graphic
DebugPrint("%s - %d>=%d\n" _C_ this->G->File.c_str() _C_ this->G->NumFrames _C_ this->SpriteFrames);
Assert(this->G->NumFrames >= this->SpriteFrames);
this->G->NumFrames = this->SpriteFrames;
// FIXME: Don't use NumFrames as number of frames.

View file

@ -452,7 +452,6 @@ int UnitTypeIdByIdent(const std::string &ident)
return type->Slot;
}
DebugPrint(" fix this %s\n" _C_ ident.c_str());
Assert(0);
return -1;
}

View file

@ -539,6 +539,7 @@ CGraphic *CGraphic::New(const std::string &filename, int w, int h)
g->Height = h;
} else {
++g->Refs;
DebugPrint("f:%s,w%d,W%d,H%d,h%d\n" _C_ filename.c_str() _C_ w _C_ g->Width _C_ g->Height _C_ h);
Assert((w == 0 || g->Width == w) && (g->Height == h || h == 0));
}
@ -795,20 +796,6 @@ void CGraphic::Load(bool grayscale)
Assert(Width <= GraphicWidth && Height <= GraphicHeight);
#if 1
if (File=="graphics/human/units/elven_archer.png" && Surface->format->BytesPerPixel == 1)
{
//FILE *file = fopen("archer-test.data", "w+");
FILE *file = fopen("archer-palete-orig.data", "w+");
if (file) {
//fwrite(s->pixels, 1, s->pitch*s->h, file);
//fwrite(s->format->palette->colors, 1, 3 * s->format->palette->ncolors, file);
for (int i = 0; i < Surface->format->palette->ncolors; i++)
fwrite(&Surface->format->palette->colors[i], 1, 3, file);
fclose(file);
}
}
#endif
if ((GraphicWidth / Width) * Width != GraphicWidth ||
(GraphicHeight / Height) * Height != GraphicHeight) {
fprintf(stderr, "Invalid graphic (width, height) %s\n", File.c_str());
@ -1072,34 +1059,6 @@ void CGraphic::Flip()
}
break;
}
#if 1
if (File=="graphics/human/units/elven_archer.png" && Surface->format->BytesPerPixel == 1)
{
//FILE *file = fopen("archer-test.data", "w+");
FILE *file = fopen("archer-palete.data", "w+");
if (file) {
//fwrite(s->pixels, 1, s->pitch*s->h, file);
//fwrite(s->format->palette->colors, 1, 3 * s->format->palette->ncolors, file);
for (int i = 0; i < Surface->format->palette->ncolors; i++)
fwrite(&Surface->format->palette->colors[i], 1, 3, file);
fclose(file);
}
}
#endif
#if 1
if (File=="graphics/human/units/elven_archer.png" && s->format->BytesPerPixel == 1)
{
//FILE *file = fopen("archer-test.data", "w+");
FILE *file = fopen("archer-palete-flip.data", "w+");
if (file) {
//fwrite(s->pixels, 1, s->pitch*s->h, file);
//fwrite(s->format->palette->colors, 1, 3 * s->format->palette->ncolors, file);
for (int i = 0; i < s->format->palette->ncolors; i++)
fwrite(&s->format->palette->colors[i], 1, 3, file);
fclose(file);
}
}
#endif
SDL_UnlockSurface(Surface);
SDL_UnlockSurface(s);