Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
LoadPartyImage.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3
4#ifndef PARTY_IMAGE
5#error "Define PARTY_IMAGE to the asset name to use LoadPartyImage."
6#endif
7
8#define PARTY_IMAGE_PALETTE_SIZE 256
9#define PARTY_IMAGE_WIDTH 150
10#define PARTY_IMAGE_HEIGHT 105
11
17
18API_CALLABLE(N(LoadPartyImage)) {
19 #ifdef SHIFT
20 static PartyImage img;
21 #else
22 static PAL_BIN palette[PARTY_IMAGE_PALETTE_SIZE];
24 static u8 padding[10];
25 #endif
26 static MessageImageData image;
27
28 u32 decompressedSize;
29 void* compressed = load_asset_by_name(PARTY_IMAGE, &decompressedSize);
30
31 #ifdef SHIFT
32 decode_yay0(compressed, &img);
33 #else
34 decode_yay0(compressed, palette);
35 #endif
36
37 general_heap_free(compressed);
38
39 #ifdef SHIFT
40 image.raster = img.raster;
41 image.palette = img.palette;
42 #else
43 image.raster = raster;
44 image.palette = palette;
45 #endif
46
49 image.format = G_IM_FMT_CI;
50 image.bitDepth = G_IM_SIZ_8b;
51 set_message_images(&image);
52 return ApiStatus_DONE2;
53}
54
55#undef PARTY_IMAGE
#define PARTY_IMAGE_PALETTE_SIZE
PAL_BIN palette[256]
#define PARTY_IMAGE_HEIGHT
IMG_BIN raster[150 *105]
#define PARTY_IMAGE_WIDTH
#define IMG_BIN
#define PAL_BIN
#define ApiStatus_DONE2
Definition evt.h:118
void * load_asset_by_name(const char *assetName, u32 *decompressedSize)
Definition world.c:251
s32 general_heap_free(void *data)
Definition heap.c:18
void decode_yay0(void *src, void *dst)
void set_message_images(MessageImageData *images)
Definition msg.c:1516