mirror of
https://github.com/pret/pokepinballrs.git
synced 2026-04-26 08:49:23 -05:00
Some checks are pending
CI / build (push) Waiting to run
* Add tooling support for graphics with 2^n chunking * update to OAM handling, from 2n sizing * Update assembly to use the hex, rather than music name, for ease of uese in decompme/m2C * additional tools/examples * graphics build, not currently compare matching. * remove sprites.png * working conversion in make file! * stage/main folder done * stage/misc folder done * stage/ruby complete * stage/sapphire updated * base for remaining kinda-graphics; file name casing * more name casing * extract catch sprites * remove special 6x4 handling from oam slicer; switched hed the 2 images to using non-oam 2x2 chunks. (net same, but allows the 6x4 to process normally when things like the whalmer are found) * Palette info for the catch sprites, thanks to cyphgirl * obliterate the old hatch-sprite code * refactor segments to not have the base file name dependancy * catch mon 1-9, horizontal layout * rename the f param in the json for graphics * casing cleanup? * . * possible fix for the out of date segment piece * Replace graphic_cnvt_attrs.txt strategy with individually-generated makefile rules * Don't specify tileCount --------- Co-authored-by: Marcus Huderle <huderlem@gmail.com>
73 lines
1.8 KiB
C
Executable File
73 lines
1.8 KiB
C
Executable File
// Copyright (c) 2015 YamaArashi
|
|
|
|
#ifndef GFX_H
|
|
#define GFX_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
struct Color {
|
|
unsigned char red;
|
|
unsigned char green;
|
|
unsigned char blue;
|
|
};
|
|
|
|
struct Palette {
|
|
struct Color colors[256];
|
|
int numColors;
|
|
};
|
|
|
|
struct NonAffineTile {
|
|
unsigned short index:10;
|
|
unsigned short hflip:1;
|
|
unsigned short vflip:1;
|
|
unsigned short palno:4;
|
|
} __attribute__((packed));
|
|
|
|
struct Tilemap {
|
|
union {
|
|
struct NonAffineTile *non_affine;
|
|
unsigned char *affine;
|
|
} data;
|
|
int size;
|
|
};
|
|
|
|
struct Image {
|
|
int width;
|
|
int height;
|
|
int bitDepth;
|
|
unsigned char *pixels;
|
|
bool hasPalette;
|
|
struct Palette palette;
|
|
int paletteMapSize;
|
|
unsigned char *paletteMap;
|
|
bool hasTransparency;
|
|
struct Tilemap tilemap;
|
|
bool isAffine;
|
|
};
|
|
|
|
enum NumTilesMode {
|
|
NUM_TILES_IGNORE,
|
|
NUM_TILES_WARN,
|
|
NUM_TILES_ERROR,
|
|
};
|
|
|
|
typedef struct {
|
|
int x;
|
|
int y;
|
|
} TileCoord;
|
|
|
|
#define MAX_OAM_TILE_SIDE_LENGTH 32
|
|
#define MAX_OAM_TILE_SIDE_LENGTH_SQUARED MAX_OAM_TILE_SIDE_LENGTH * MAX_OAM_TILE_SIDE_LENGTH
|
|
|
|
void ReadTileImage(char *path, int tilesWidth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool optomized_2n_map);
|
|
void WriteTileImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool optomized_2n_map);
|
|
void ReadPlainImage(char *path, int dataWidth, struct Image *image, bool invertColors);
|
|
void WritePlainImage(char *path, int dataWidth, struct Image *image, bool invertColors);
|
|
void FreeImage(struct Image *image);
|
|
void ReadGbaPalette(char *path, struct Palette *palette);
|
|
void WriteGbaPalette(char *path, struct Palette *palette);
|
|
void Convert4BppImageWithPaletteMap(struct Image *image);
|
|
|
|
#endif // GFX_H
|