mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
Document contest painting image processing effects
This commit is contained in:
parent
6c863f6724
commit
1ed3af66eb
@ -1,4 +1,4 @@
|
|||||||
gUnknown_03006190
|
gContestMonPixels
|
||||||
gUnknown_030061A0
|
gContestPaintingContext
|
||||||
gUnknown_030061C0
|
gContestPaintingWinner
|
||||||
gContestPaintingMonPalette
|
gContestPaintingMonPalette
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
gUnknown_03006164
|
gCanvasColumnStart
|
||||||
gUnknown_03006168
|
gCanvasPixels
|
||||||
gUnknown_0300616C
|
gCanvasRowEnd
|
||||||
gUnknown_03006170
|
gCanvasHeight
|
||||||
gUnknown_03006174
|
gCanvasColumnEnd
|
||||||
gUnknown_03006178
|
gCanvasRowStart
|
||||||
gUnknown_0300617C
|
gCanvasMonPersonality
|
||||||
gUnknown_03006180
|
gCanvasWidth
|
||||||
gUnknown_03006184
|
gCanvasPalette
|
||||||
gUnknown_03006188
|
gCanvasPaletteStart
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
.section .rodata
|
.section .rodata
|
||||||
.align 2, 0
|
.align 2, 0
|
||||||
|
|
||||||
gUnknown_085A1F94:: @ 85A1F94
|
gPointillismPoints:: @ 85A1F94
|
||||||
.byte 0x00, 0x1d, 0x1c, 0x0e, 0x1e, 0x1b, 0x00, 0x01, 0x32, 0x2e, 0x1e, 0x37, 0x0a, 0x22, 0x1f, 0x05, 0x26, 0x2e, 0x12, 0x17, 0x1e, 0x1a, 0x03, 0x11, 0x05, 0x11, 0x18, 0x05, 0x27, 0x2f, 0x1a, 0x3f
|
.byte 0x00, 0x1d, 0x1c, 0x0e, 0x1e, 0x1b, 0x00, 0x01, 0x32, 0x2e, 0x1e, 0x37, 0x0a, 0x22, 0x1f, 0x05, 0x26, 0x2e, 0x12, 0x17, 0x1e, 0x1a, 0x03, 0x11, 0x05, 0x11, 0x18, 0x05, 0x27, 0x2f, 0x1a, 0x3f
|
||||||
.byte 0x12, 0x22, 0x3f, 0x16, 0x2b, 0x2f, 0x2e, 0x11, 0x02, 0x2d, 0x23, 0x0d, 0x28, 0x17, 0x0c, 0x19, 0x2f, 0x0e, 0x13, 0x30, 0x18, 0x20, 0x2d, 0x28, 0x22, 0x01, 0x03, 0x19, 0x0e, 0x2a, 0x2b, 0x22
|
.byte 0x12, 0x22, 0x3f, 0x16, 0x2b, 0x2f, 0x2e, 0x11, 0x02, 0x2d, 0x23, 0x0d, 0x28, 0x17, 0x0c, 0x19, 0x2f, 0x0e, 0x13, 0x30, 0x18, 0x20, 0x2d, 0x28, 0x22, 0x01, 0x03, 0x19, 0x0e, 0x2a, 0x2b, 0x22
|
||||||
.byte 0x15, 0x25, 0x22, 0x0a, 0x26, 0x39, 0x06, 0x23, 0x16, 0x07, 0x2f, 0x22, 0x3a, 0x1b, 0x3b, 0x36, 0x35, 0x0a, 0x2b, 0x24, 0x36, 0x09, 0x12, 0x1c, 0x2f, 0x23, 0x2e, 0x38, 0x2c, 0x05, 0x2a, 0x20
|
.byte 0x15, 0x25, 0x22, 0x0a, 0x26, 0x39, 0x06, 0x23, 0x16, 0x07, 0x2f, 0x22, 0x3a, 0x1b, 0x3b, 0x36, 0x35, 0x0a, 0x2b, 0x24, 0x36, 0x09, 0x12, 0x1c, 0x2f, 0x23, 0x2e, 0x38, 0x2c, 0x05, 0x2a, 0x20
|
||||||
|
@ -453,7 +453,7 @@ extern u8 gNumLinkContestPlayers;
|
|||||||
extern u8 gHighestRibbonRank;
|
extern u8 gHighestRibbonRank;
|
||||||
extern struct ContestResources *gContestResources;
|
extern struct ContestResources *gContestResources;
|
||||||
extern u8 sContestBgCopyFlags;
|
extern u8 sContestBgCopyFlags;
|
||||||
extern struct ContestWinner gUnknown_02039F3C;
|
extern struct ContestWinner gCurContestWinner;
|
||||||
extern u8 gUnknown_02039F5C;
|
extern u8 gUnknown_02039F5C;
|
||||||
extern u8 gUnknown_02039F5D;
|
extern u8 gUnknown_02039F5D;
|
||||||
|
|
||||||
|
@ -1,16 +1,7 @@
|
|||||||
#ifndef GUARD_CONTESTPAINTING_H
|
#ifndef GUARD_CONTESTPAINTING_H
|
||||||
#define GUARD_CONTESTPAINTING_H
|
#define GUARD_CONTESTPAINTING_H
|
||||||
|
|
||||||
enum
|
void SetContestWinnerForPainting(int);
|
||||||
{
|
|
||||||
CONTESTRESULT_COOL = 9,
|
|
||||||
CONTESTRESULT_BEAUTY = 13,
|
|
||||||
CONTESTRESULT_CUTE = 2,
|
|
||||||
CONTESTRESULT_SMART = 36,
|
|
||||||
CONTESTRESULT_TOUGH = 6,
|
|
||||||
};
|
|
||||||
|
|
||||||
void sub_812FDA8(int);
|
|
||||||
void CB2_ContestPainting(void);
|
void CB2_ContestPainting(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,28 +1,53 @@
|
|||||||
#ifndef GUARD_CONTEST_PAINTING_EFFECTS_H
|
#ifndef GUARD_CONTEST_PAINTING_EFFECTS_H
|
||||||
#define GUARD_CONTEST_PAINTING_EFFECTS_H
|
#define GUARD_CONTEST_PAINTING_EFFECTS_H
|
||||||
|
|
||||||
struct Unk030061A0
|
enum
|
||||||
{
|
{
|
||||||
u8 var_0;
|
IMAGE_EFFECT_POINTILLISM = 2,
|
||||||
u8 pad1[3];
|
IMAGE_EFFECT_GRAYSCALE_LIGHT = 6,
|
||||||
u16 (*var_4)[][32];
|
IMAGE_EFFECT_BLUR = 8,
|
||||||
u16 *var_8;
|
IMAGE_EFFECT_OUTLINE_COLORED = 9,
|
||||||
u8 pad0C[4];
|
IMAGE_EFFECT_INVERT_BLACK_WHITE = 10,
|
||||||
u32 var_10;
|
IMAGE_EFFECT_THICK_BLACK_WHITE = 11,
|
||||||
u16 var_14;
|
IMAGE_EFFECT_SHIMMER = 13,
|
||||||
u16 var_16;
|
IMAGE_EFFECT_OUTLINE = 30,
|
||||||
u8 var_18;
|
IMAGE_EFFECT_INVERT = 31,
|
||||||
u8 var_19;
|
IMAGE_EFFECT_BLUR_RIGHT = 32,
|
||||||
u8 var_1A;
|
IMAGE_EFFECT_BLUR_DOWN = 33,
|
||||||
u8 var_1B;
|
IMAGE_EFFECT_CHARCOAL = 36,
|
||||||
u8 var_1C;
|
|
||||||
u8 var_1D;
|
|
||||||
u8 var_1E;
|
|
||||||
u8 var_1F;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void sub_8124F2C(struct Unk030061A0 *);
|
enum
|
||||||
void sub_81261A4(struct Unk030061A0 *);
|
{
|
||||||
void sub_8126058(struct Unk030061A0 *);
|
QUANTIZE_EFFECT_STANDARD,
|
||||||
|
QUANTIZE_EFFECT_STANDARD_LIMITED_COLORS,
|
||||||
|
QUANTIZE_EFFECT_PRIMARY_COLORS,
|
||||||
|
QUANTIZE_EFFECT_GRAYSCALE,
|
||||||
|
QUANTIZE_EFFECT_GRAYSCALE_SMALL,
|
||||||
|
QUANTIZE_EFFECT_BLACK_WHITE,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ContestPaintingContext
|
||||||
|
{
|
||||||
|
u8 effect;
|
||||||
|
void *canvasPixels;
|
||||||
|
u16 *canvasPalette;
|
||||||
|
u8 fillerC[0x4];
|
||||||
|
u32 dest;
|
||||||
|
u16 quantizeEffect;
|
||||||
|
u16 var_16;
|
||||||
|
u8 paletteStart;
|
||||||
|
u8 columnStart;
|
||||||
|
u8 rowStart;
|
||||||
|
u8 columnEnd;
|
||||||
|
u8 rowEnd;
|
||||||
|
u8 canvasWidth;
|
||||||
|
u8 canvasHeight;
|
||||||
|
u8 personality;
|
||||||
|
};
|
||||||
|
|
||||||
|
void ApplyImageProcessingEffects(struct ContestPaintingContext *);
|
||||||
|
void ApplyImageProcessingQuantization(struct ContestPaintingContext *);
|
||||||
|
void ConvertImageProcessingToGBA(struct ContestPaintingContext *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -238,7 +238,7 @@ EWRAM_DATA u8 gNumLinkContestPlayers = 0;
|
|||||||
EWRAM_DATA u8 gHighestRibbonRank = 0;
|
EWRAM_DATA u8 gHighestRibbonRank = 0;
|
||||||
EWRAM_DATA struct ContestResources *gContestResources = NULL;
|
EWRAM_DATA struct ContestResources *gContestResources = NULL;
|
||||||
EWRAM_DATA u8 sContestBgCopyFlags = 0;
|
EWRAM_DATA u8 sContestBgCopyFlags = 0;
|
||||||
EWRAM_DATA struct ContestWinner gUnknown_02039F3C = {0};
|
EWRAM_DATA struct ContestWinner gCurContestWinner = {0};
|
||||||
EWRAM_DATA u8 gUnknown_02039F5C = 0;
|
EWRAM_DATA u8 gUnknown_02039F5C = 0;
|
||||||
EWRAM_DATA u8 gUnknown_02039F5D = 0;
|
EWRAM_DATA u8 gUnknown_02039F5D = 0;
|
||||||
|
|
||||||
@ -5353,12 +5353,12 @@ bool8 sub_80DEDA8(u8 a)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gUnknown_02039F3C.personality = gContestMons[i].personality;
|
gCurContestWinner.personality = gContestMons[i].personality;
|
||||||
gUnknown_02039F3C.trainerId = gContestMons[i].otId;
|
gCurContestWinner.trainerId = gContestMons[i].otId;
|
||||||
gUnknown_02039F3C.species = gContestMons[i].species;
|
gCurContestWinner.species = gContestMons[i].species;
|
||||||
StringCopy(gUnknown_02039F3C.monName, gContestMons[i].nickname);
|
StringCopy(gCurContestWinner.monName, gContestMons[i].nickname);
|
||||||
StringCopy(gUnknown_02039F3C.trainerName, gContestMons[i].trainerName);
|
StringCopy(gCurContestWinner.trainerName, gContestMons[i].trainerName);
|
||||||
gUnknown_02039F3C.contestCategory = r7;
|
gCurContestWinner.contestCategory = r7;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
#include "constants/rgb.h"
|
#include "constants/rgb.h"
|
||||||
|
|
||||||
// IWRAM common
|
// IWRAM common
|
||||||
u16 (*gUnknown_03006190)[][32];
|
u16 (*gContestMonPixels)[][32];
|
||||||
struct Unk030061A0 gUnknown_030061A0;
|
struct ContestPaintingContext gContestPaintingContext;
|
||||||
struct ContestWinner *gUnknown_030061C0;
|
struct ContestWinner *gContestPaintingWinner;
|
||||||
u16 *gContestPaintingMonPalette;
|
u16 *gContestPaintingMonPalette;
|
||||||
|
|
||||||
// IWRAM bss
|
// IWRAM bss
|
||||||
@ -39,10 +39,10 @@ static void HoldContestPainting(void);
|
|||||||
static void InitContestPaintingWindow(void);
|
static void InitContestPaintingWindow(void);
|
||||||
static void InitContestPaintingBg(void);
|
static void InitContestPaintingBg(void);
|
||||||
static void InitContestPaintingVars(bool8);
|
static void InitContestPaintingVars(bool8);
|
||||||
static void sub_8130884(u8, u8);
|
static void CreateContestPaintingPicture(u8, u8);
|
||||||
static void PrintContestPaintingCaption(u8, u8);
|
static void PrintContestPaintingCaption(u8, u8);
|
||||||
static void VBlankCB_ContestPainting(void);
|
static void VBlankCB_ContestPainting(void);
|
||||||
static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64]);
|
static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64]);
|
||||||
|
|
||||||
extern const u8 gUnknown_0827EA0C[];
|
extern const u8 gUnknown_0827EA0C[];
|
||||||
extern const u8 gContestCoolness[];
|
extern const u8 gContestCoolness[];
|
||||||
@ -85,7 +85,7 @@ const u8 gPictureFrameTilemap_3[] = INCBIN_U8("graphics/picture_frame/frame3_map
|
|||||||
const u8 gPictureFrameTilemap_4[] = INCBIN_U8("graphics/picture_frame/frame4_map.bin.rl");
|
const u8 gPictureFrameTilemap_4[] = INCBIN_U8("graphics/picture_frame/frame4_map.bin.rl");
|
||||||
const u8 gPictureFrameTilemap_5[] = INCBIN_U8("graphics/picture_frame/frame5_map.bin.rl");
|
const u8 gPictureFrameTilemap_5[] = INCBIN_U8("graphics/picture_frame/frame5_map.bin.rl");
|
||||||
|
|
||||||
const u8 *const gUnknown_085B07C0[] =
|
static const u8 *const sContestCategoryNames_Unused[] =
|
||||||
{
|
{
|
||||||
gContestCoolness,
|
gContestCoolness,
|
||||||
gContestBeauty,
|
gContestBeauty,
|
||||||
@ -94,7 +94,7 @@ const u8 *const gUnknown_085B07C0[] =
|
|||||||
gContestToughness,
|
gContestToughness,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 *const gContestRankTextPointers[] =
|
static const u8 *const sContestRankNames[] =
|
||||||
{
|
{
|
||||||
gContestRankNormal,
|
gContestRankNormal,
|
||||||
gContestRankSuper,
|
gContestRankSuper,
|
||||||
@ -103,7 +103,7 @@ const u8 *const gContestRankTextPointers[] =
|
|||||||
gContestLink,
|
gContestLink,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct BgTemplate gUnknown_085B07E8[] =
|
static const struct BgTemplate sContestPaintingBgTemplates[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
.bg = 1,
|
.bg = 1,
|
||||||
@ -116,7 +116,7 @@ const struct BgTemplate gUnknown_085B07E8[] =
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct WindowTemplate gUnknown_085B07EC =
|
static const struct WindowTemplate sContestPaintingWindowTemplate =
|
||||||
{
|
{
|
||||||
.bg = 1,
|
.bg = 1,
|
||||||
.tilemapLeft = 2,
|
.tilemapLeft = 2,
|
||||||
@ -127,7 +127,7 @@ const struct WindowTemplate gUnknown_085B07EC =
|
|||||||
.baseBlock = 1,
|
.baseBlock = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 *const gContestPaintingDescriptionPointers[] =
|
static const u8 *const sContestPaintingDescriptionPointers[] =
|
||||||
{
|
{
|
||||||
gContestPaintingCool1,
|
gContestPaintingCool1,
|
||||||
gContestPaintingCool2,
|
gContestPaintingCool2,
|
||||||
@ -146,7 +146,7 @@ const u8 *const gContestPaintingDescriptionPointers[] =
|
|||||||
gContestPaintingTough3,
|
gContestPaintingTough3,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct OamData gUnknown_085B0830 =
|
static const struct OamData sContestPaintingMonOamData =
|
||||||
{
|
{
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.affineMode = ST_OAM_AFFINE_OFF,
|
.affineMode = ST_OAM_AFFINE_OFF,
|
||||||
@ -163,13 +163,13 @@ const struct OamData gUnknown_085B0830 =
|
|||||||
|
|
||||||
const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)};
|
const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)};
|
||||||
|
|
||||||
void sub_812FDA8(int contestWinner)
|
void SetContestWinnerForPainting(int contestWinnerId)
|
||||||
{
|
{
|
||||||
// probably fakematching
|
// probably fakematching
|
||||||
u8 *ptr1 = &gUnknown_02039F5D;
|
u8 *ptr1 = &gUnknown_02039F5D;
|
||||||
u8 *ptr2 = &gUnknown_02039F5C;
|
u8 *ptr2 = &gUnknown_02039F5C;
|
||||||
gUnknown_02039F3C = gSaveBlock1Ptr->contestWinners[contestWinner - 1];
|
gCurContestWinner = gSaveBlock1Ptr->contestWinners[contestWinnerId - 1];
|
||||||
*ptr1 = contestWinner - 1;
|
*ptr1 = contestWinnerId - 1;
|
||||||
*ptr2 = 0;
|
*ptr2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ static void CB2_QuitContestPainting(void)
|
|||||||
{
|
{
|
||||||
SetMainCallback2(gMain.savedCallback);
|
SetMainCallback2(gMain.savedCallback);
|
||||||
FREE_AND_SET_NULL(gContestPaintingMonPalette);
|
FREE_AND_SET_NULL(gContestPaintingMonPalette);
|
||||||
FREE_AND_SET_NULL(gUnknown_03006190);
|
FREE_AND_SET_NULL(gContestMonPixels);
|
||||||
RemoveWindow(gContestPaintingWindowId);
|
RemoveWindow(gContestPaintingWindowId);
|
||||||
Free(GetBgTilemapBuffer(1));
|
Free(GetBgTilemapBuffer(1));
|
||||||
FreeMonSpritesGfx();
|
FreeMonSpritesGfx();
|
||||||
@ -203,7 +203,7 @@ static void ShowContestPainting(void)
|
|||||||
ScanlineEffect_Stop();
|
ScanlineEffect_Stop();
|
||||||
SetVBlankCallback(NULL);
|
SetVBlankCallback(NULL);
|
||||||
AllocateMonSpritesGfx();
|
AllocateMonSpritesGfx();
|
||||||
gUnknown_030061C0 = &gUnknown_02039F3C;
|
gContestPaintingWinner = &gCurContestWinner;
|
||||||
InitContestPaintingVars(1);
|
InitContestPaintingVars(1);
|
||||||
InitContestPaintingBg();
|
InitContestPaintingBg();
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
@ -221,7 +221,7 @@ static void ShowContestPainting(void)
|
|||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sub_8130884(gUnknown_02039F5D, gUnknown_02039F5C);
|
CreateContestPaintingPicture(gUnknown_02039F5D, gUnknown_02039F5C);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@ -269,11 +269,11 @@ static void HoldContestPainting(void)
|
|||||||
static void InitContestPaintingWindow(void)
|
static void InitContestPaintingWindow(void)
|
||||||
{
|
{
|
||||||
ResetBgsAndClearDma3BusyFlags(0);
|
ResetBgsAndClearDma3BusyFlags(0);
|
||||||
InitBgsFromTemplates(0, gUnknown_085B07E8, ARRAY_COUNT(gUnknown_085B07E8));
|
InitBgsFromTemplates(0, sContestPaintingBgTemplates, ARRAY_COUNT(sContestPaintingBgTemplates));
|
||||||
ChangeBgX(1, 0, 0);
|
ChangeBgX(1, 0, 0);
|
||||||
ChangeBgY(1, 0, 0);
|
ChangeBgY(1, 0, 0);
|
||||||
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
|
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
|
||||||
gContestPaintingWindowId = AddWindow(&gUnknown_085B07EC);
|
gContestPaintingWindowId = AddWindow(&sContestPaintingWindowTemplate);
|
||||||
DeactivateAllTextPrinters();
|
DeactivateAllTextPrinters();
|
||||||
FillWindowPixelBuffer(gContestPaintingWindowId, PIXEL_FILL(0));
|
FillWindowPixelBuffer(gContestPaintingWindowId, PIXEL_FILL(0));
|
||||||
PutWindowTilemap(gContestPaintingWindowId);
|
PutWindowTilemap(gContestPaintingWindowId);
|
||||||
@ -289,21 +289,21 @@ static void PrintContestPaintingCaption(u8 contestType, u8 arg1)
|
|||||||
if (arg1 == TRUE)
|
if (arg1 == TRUE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
category = gUnknown_030061C0->contestCategory;
|
category = gContestPaintingWinner->contestCategory;
|
||||||
if (contestType < 8)
|
if (contestType < 8)
|
||||||
{
|
{
|
||||||
BufferContestName(gStringVar1, category);
|
BufferContestName(gStringVar1, category);
|
||||||
StringAppend(gStringVar1, gText_Space);
|
StringAppend(gStringVar1, gText_Space);
|
||||||
StringAppend(gStringVar1, gContestRankTextPointers[gUnknown_030061C0->contestRank]);
|
StringAppend(gStringVar1, sContestRankNames[gContestPaintingWinner->contestRank]);
|
||||||
StringCopy(gStringVar2, gUnknown_030061C0->trainerName);
|
StringCopy(gStringVar2, gContestPaintingWinner->trainerName);
|
||||||
sub_81DB5AC(gStringVar2);
|
sub_81DB5AC(gStringVar2);
|
||||||
StringCopy(gStringVar3, gUnknown_030061C0->monName);
|
StringCopy(gStringVar3, gContestPaintingWinner->monName);
|
||||||
StringExpandPlaceholders(gStringVar4, gUnknown_0827EA0C);
|
StringExpandPlaceholders(gStringVar4, gUnknown_0827EA0C);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StringCopy(gStringVar1, gUnknown_030061C0->monName);
|
StringCopy(gStringVar1, gContestPaintingWinner->monName);
|
||||||
StringExpandPlaceholders(gStringVar4, gContestPaintingDescriptionPointers[category]);
|
StringExpandPlaceholders(gStringVar4, sContestPaintingDescriptionPointers[category]);
|
||||||
}
|
}
|
||||||
|
|
||||||
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
|
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
|
||||||
@ -360,18 +360,18 @@ static void VBlankCB_ContestPainting(void)
|
|||||||
TransferPlttBuffer();
|
TransferPlttBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81302E8(u16 species, u8 arg1)
|
static void InitContestMonPixels(u16 species, u8 whichSprite)
|
||||||
{
|
{
|
||||||
const void *pal = GetMonSpritePalFromSpeciesAndPersonality(species, gUnknown_030061C0->trainerId, gUnknown_030061C0->personality);
|
const void *pal = GetMonSpritePalFromSpeciesAndPersonality(species, gContestPaintingWinner->trainerId, gContestPaintingWinner->personality);
|
||||||
LZDecompressVram(pal, gContestPaintingMonPalette);
|
LZDecompressVram(pal, gContestPaintingMonPalette);
|
||||||
if (!arg1)
|
if (whichSprite == 0)
|
||||||
{
|
{
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(
|
HandleLoadSpecialPokePic_DontHandleDeoxys(
|
||||||
&gMonFrontPicTable[species],
|
&gMonFrontPicTable[species],
|
||||||
gMonSpritesGfxPtr->sprites[1],
|
gMonSpritesGfxPtr->sprites[1],
|
||||||
species,
|
species,
|
||||||
gUnknown_030061C0->personality);
|
gContestPaintingWinner->personality);
|
||||||
sub_8130380(gMonSpritesGfxPtr->sprites[1], gContestPaintingMonPalette, (void *)gUnknown_03006190);
|
_InitContestMonPixels(gMonSpritesGfxPtr->sprites[1], gContestPaintingMonPalette, (void *)gContestMonPixels);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -379,14 +379,14 @@ void sub_81302E8(u16 species, u8 arg1)
|
|||||||
&gMonBackPicTable[species],
|
&gMonBackPicTable[species],
|
||||||
gMonSpritesGfxPtr->sprites[0],
|
gMonSpritesGfxPtr->sprites[0],
|
||||||
species,
|
species,
|
||||||
gUnknown_030061C0->personality);
|
gContestPaintingWinner->personality);
|
||||||
sub_8130380(gMonSpritesGfxPtr->sprites[0], gContestPaintingMonPalette, (void *)gUnknown_03006190);
|
_InitContestMonPixels(gMonSpritesGfxPtr->sprites[0], gContestPaintingMonPalette, (void *)gContestMonPixels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NONMATCHING
|
#ifdef NONMATCHING
|
||||||
// functionally equivalent.
|
// functionally equivalent.
|
||||||
static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64])
|
static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64])
|
||||||
{
|
{
|
||||||
u16 tileY, tileX, pixelY, pixelX;
|
u16 tileY, tileX, pixelY, pixelX;
|
||||||
u8 colorIndex;
|
u8 colorIndex;
|
||||||
@ -400,16 +400,16 @@ static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[6
|
|||||||
for (pixelX = 0; pixelX < 8; pixelX++)
|
for (pixelX = 0; pixelX < 8; pixelX++)
|
||||||
{
|
{
|
||||||
int offset = 32 * (8 * tileY + tileX) + (pixelY * 4 + pixelX / 2);
|
int offset = 32 * (8 * tileY + tileX) + (pixelY * 4 + pixelX / 2);
|
||||||
colorIndex = spritePixels[offset];
|
colorIndex = spriteGfx[offset];
|
||||||
if (pixelX & 1)
|
if (pixelX & 1)
|
||||||
colorIndex >>= 4;
|
colorIndex >>= 4;
|
||||||
else
|
else
|
||||||
colorIndex &= 0xF;
|
colorIndex &= 0xF;
|
||||||
|
|
||||||
if (colorIndex == 0) // transparent pixel
|
if (colorIndex == 0) // transparent pixel
|
||||||
(*destColorBuffer)[8 * tileY + pixelY][tileX * 8 + pixelX] = 0x8000;
|
(*destPixels)[8 * tileY + pixelY][tileX * 8 + pixelX] = 0x8000;
|
||||||
else
|
else
|
||||||
(*destColorBuffer)[8 * tileY + pixelY][tileX * 8 + pixelX] = palette[colorIndex];
|
(*destPixels)[8 * tileY + pixelY][tileX * 8 + pixelX] = palette[colorIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[6
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
NAKED
|
NAKED
|
||||||
static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64])
|
static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64])
|
||||||
{
|
{
|
||||||
asm_unified("\n\
|
asm_unified("\n\
|
||||||
push {r4-r7,lr}\n\
|
push {r4-r7,lr}\n\
|
||||||
@ -519,34 +519,34 @@ _081303F8:\n\
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void sub_8130430(u8 arg0, u8 arg1)
|
static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
|
||||||
{
|
{
|
||||||
u8 x, y;
|
u8 x, y;
|
||||||
|
|
||||||
LoadPalette(gPictureFramePalettes, 0, 0x100);
|
LoadPalette(gPictureFramePalettes, 0, 0x100);
|
||||||
if (arg1 == 1)
|
if (arg1 == 1)
|
||||||
{
|
{
|
||||||
switch (gUnknown_030061C0->contestCategory / 3)
|
switch (gContestPaintingWinner->contestCategory / 3)
|
||||||
{
|
{
|
||||||
case CONTEST_CATEGORY_COOL:
|
case CONTEST_CATEGORY_COOL:
|
||||||
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
|
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
|
||||||
RLUnCompWram(gPictureFrameTilemap_0, gUnknown_03006190);
|
RLUnCompWram(gPictureFrameTilemap_0, gContestMonPixels);
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_BEAUTY:
|
case CONTEST_CATEGORY_BEAUTY:
|
||||||
RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM);
|
RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM);
|
||||||
RLUnCompWram(gPictureFrameTilemap_1, gUnknown_03006190);
|
RLUnCompWram(gPictureFrameTilemap_1, gContestMonPixels);
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_CUTE:
|
case CONTEST_CATEGORY_CUTE:
|
||||||
RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM);
|
RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM);
|
||||||
RLUnCompWram(gPictureFrameTilemap_2, gUnknown_03006190);
|
RLUnCompWram(gPictureFrameTilemap_2, gContestMonPixels);
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_SMART:
|
case CONTEST_CATEGORY_SMART:
|
||||||
RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM);
|
RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM);
|
||||||
RLUnCompWram(gPictureFrameTilemap_3, gUnknown_03006190);
|
RLUnCompWram(gPictureFrameTilemap_3, gContestMonPixels);
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_TOUGH:
|
case CONTEST_CATEGORY_TOUGH:
|
||||||
RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM);
|
RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM);
|
||||||
RLUnCompWram(gPictureFrameTilemap_4, gUnknown_03006190);
|
RLUnCompWram(gPictureFrameTilemap_4, gContestMonPixels);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,23 +563,23 @@ static void sub_8130430(u8 arg0, u8 arg1)
|
|||||||
for (y = 0; y < 10; y++)
|
for (y = 0; y < 10; y++)
|
||||||
{
|
{
|
||||||
for (x = 0; x < 18; x++)
|
for (x = 0; x < 18; x++)
|
||||||
VRAM_PICTURE_DATA(x + 6, y + 2) = (*gUnknown_03006190)[y + 2][x + 6];
|
VRAM_PICTURE_DATA(x + 6, y + 2) = (*gContestMonPixels)[y + 2][x + 6];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-set the entire top row to the first top frame part
|
// Re-set the entire top row to the first top frame part
|
||||||
for (x = 0; x < 16; x++)
|
for (x = 0; x < 16; x++)
|
||||||
VRAM_PICTURE_DATA(x + 7, 2) = (*gUnknown_03006190)[2][7];
|
VRAM_PICTURE_DATA(x + 7, 2) = (*gContestMonPixels)[2][7];
|
||||||
|
|
||||||
#undef VRAM_PICTURE_DATA
|
#undef VRAM_PICTURE_DATA
|
||||||
}
|
}
|
||||||
else if (arg0 < 8)
|
else if (contestWinnerId < 8)
|
||||||
{
|
{
|
||||||
RLUnCompVram(gPictureFrameTiles_5, (void *)VRAM);
|
RLUnCompVram(gPictureFrameTiles_5, (void *)VRAM);
|
||||||
RLUnCompVram(gPictureFrameTilemap_5, (void *)(BG_SCREEN_ADDR(12)));
|
RLUnCompVram(gPictureFrameTilemap_5, (void *)(BG_SCREEN_ADDR(12)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (gUnknown_030061C0->contestCategory / 3)
|
switch (gContestPaintingWinner->contestCategory / 3)
|
||||||
{
|
{
|
||||||
case CONTEST_CATEGORY_COOL:
|
case CONTEST_CATEGORY_COOL:
|
||||||
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
|
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
|
||||||
@ -605,100 +605,99 @@ static void sub_8130430(u8 arg0, u8 arg1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8130688(u8 arg0)
|
static void InitPaintingMonOamData(u8 contestWinnerId)
|
||||||
{
|
{
|
||||||
//Some hacks just to get the asm to match
|
//Some hacks just to get the asm to match
|
||||||
#ifndef NONMATCHING
|
#ifndef NONMATCHING
|
||||||
asm(""::"r"(arg0));
|
asm(""::"r"(contestWinnerId));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gMain.oamBuffer[0] = gUnknown_085B0830;
|
gMain.oamBuffer[0] = sContestPaintingMonOamData;
|
||||||
gMain.oamBuffer[0].tileNum = 0;
|
gMain.oamBuffer[0].tileNum = 0;
|
||||||
|
|
||||||
#ifndef NONMATCHING
|
#ifndef NONMATCHING
|
||||||
if (arg0) arg0 = gMain.oamBuffer[0].tileNum;
|
if (contestWinnerId) contestWinnerId = gMain.oamBuffer[0].tileNum;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gMain.oamBuffer[0].x = 88;
|
gMain.oamBuffer[0].x = 88;
|
||||||
gMain.oamBuffer[0].y = 24;
|
gMain.oamBuffer[0].y = 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_81306CC(u8 arg0)
|
static u8 GetImageEffectForContestWinner(u8 contestWinnerId)
|
||||||
{
|
{
|
||||||
u8 contestCategory;
|
u8 contestCategory;
|
||||||
|
|
||||||
if (arg0 < 8)
|
if (contestWinnerId < 8)
|
||||||
contestCategory = gUnknown_030061C0->contestCategory;
|
contestCategory = gContestPaintingWinner->contestCategory;
|
||||||
else
|
else
|
||||||
contestCategory = gUnknown_030061C0->contestCategory / 3;
|
contestCategory = gContestPaintingWinner->contestCategory / 3;
|
||||||
|
|
||||||
switch (contestCategory)
|
switch (contestCategory)
|
||||||
{
|
{
|
||||||
case CONTEST_CATEGORY_COOL:
|
case CONTEST_CATEGORY_COOL:
|
||||||
return CONTESTRESULT_COOL;
|
return IMAGE_EFFECT_OUTLINE_COLORED;
|
||||||
case CONTEST_CATEGORY_BEAUTY:
|
case CONTEST_CATEGORY_BEAUTY:
|
||||||
return CONTESTRESULT_BEAUTY;
|
return IMAGE_EFFECT_SHIMMER;
|
||||||
case CONTEST_CATEGORY_CUTE:
|
case CONTEST_CATEGORY_CUTE:
|
||||||
return CONTESTRESULT_CUTE;
|
return IMAGE_EFFECT_POINTILLISM;
|
||||||
case CONTEST_CATEGORY_SMART:
|
case CONTEST_CATEGORY_SMART:
|
||||||
return CONTESTRESULT_SMART;
|
return IMAGE_EFFECT_CHARCOAL;
|
||||||
case CONTEST_CATEGORY_TOUGH:
|
case CONTEST_CATEGORY_TOUGH:
|
||||||
return CONTESTRESULT_TOUGH;
|
return IMAGE_EFFECT_GRAYSCALE_LIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return contestCategory;
|
return contestCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8130738(void)
|
static void AllocPaintingResources(void)
|
||||||
{
|
{
|
||||||
gContestPaintingMonPalette = AllocZeroed(0x200);
|
gContestPaintingMonPalette = AllocZeroed(OBJ_PLTT_SIZE);
|
||||||
gUnknown_03006190 = AllocZeroed(0x2000);
|
gContestMonPixels = AllocZeroed(0x2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8130760(u8 contestResult)
|
static void DoContestPaintingImageProcessing(u8 imageEffect)
|
||||||
{
|
{
|
||||||
gUnknown_030061A0.var_4 = gUnknown_03006190;
|
gContestPaintingContext.canvasPixels = gContestMonPixels;
|
||||||
gUnknown_030061A0.var_8 = gContestPaintingMonPalette;
|
gContestPaintingContext.canvasPalette = gContestPaintingMonPalette;
|
||||||
gUnknown_030061A0.var_18 = 0;
|
gContestPaintingContext.paletteStart = 0;
|
||||||
gUnknown_030061A0.var_1F = gUnknown_030061C0->personality % 256;
|
gContestPaintingContext.personality = gContestPaintingWinner->personality % 256;
|
||||||
gUnknown_030061A0.var_19 = 0;
|
gContestPaintingContext.columnStart = 0;
|
||||||
gUnknown_030061A0.var_1A = 0;
|
gContestPaintingContext.rowStart = 0;
|
||||||
gUnknown_030061A0.var_1B = 64;
|
gContestPaintingContext.columnEnd = 64;
|
||||||
gUnknown_030061A0.var_1C = 64;
|
gContestPaintingContext.rowEnd = 64;
|
||||||
gUnknown_030061A0.var_1D = 64;
|
gContestPaintingContext.canvasWidth = 64;
|
||||||
gUnknown_030061A0.var_1E = 64;
|
gContestPaintingContext.canvasHeight = 64;
|
||||||
|
|
||||||
switch (contestResult)
|
switch (imageEffect)
|
||||||
{
|
{
|
||||||
case CONTESTRESULT_SMART:
|
case IMAGE_EFFECT_CHARCOAL:
|
||||||
case CONTESTRESULT_TOUGH:
|
case IMAGE_EFFECT_GRAYSCALE_LIGHT:
|
||||||
gUnknown_030061A0.var_14 = 3;
|
gContestPaintingContext.quantizeEffect = QUANTIZE_EFFECT_GRAYSCALE;
|
||||||
break;
|
break;
|
||||||
case CONTESTRESULT_COOL:
|
case IMAGE_EFFECT_OUTLINE_COLORED:
|
||||||
case CONTESTRESULT_BEAUTY:
|
case IMAGE_EFFECT_SHIMMER:
|
||||||
case CONTESTRESULT_CUTE:
|
case IMAGE_EFFECT_POINTILLISM:
|
||||||
default:
|
default:
|
||||||
gUnknown_030061A0.var_14 = 1;
|
gContestPaintingContext.quantizeEffect = QUANTIZE_EFFECT_STANDARD_LIMITED_COLORS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gUnknown_030061A0.var_16 = 2;
|
gContestPaintingContext.var_16 = 2;
|
||||||
gUnknown_030061A0.var_0 = contestResult;
|
gContestPaintingContext.effect = imageEffect;
|
||||||
gUnknown_030061A0.var_10 = OBJ_VRAM0;
|
gContestPaintingContext.dest = OBJ_VRAM0;
|
||||||
|
|
||||||
sub_8124F2C(&gUnknown_030061A0);
|
|
||||||
sub_81261A4(&gUnknown_030061A0);
|
|
||||||
sub_8126058(&gUnknown_030061A0);
|
|
||||||
|
|
||||||
|
ApplyImageProcessingEffects(&gContestPaintingContext);
|
||||||
|
ApplyImageProcessingQuantization(&gContestPaintingContext);
|
||||||
|
ConvertImageProcessingToGBA(&gContestPaintingContext);
|
||||||
LoadPalette(gContestPaintingMonPalette, 0x100, 0x200);
|
LoadPalette(gContestPaintingMonPalette, 0x100, 0x200);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8130884(u8 arg0, u8 arg1)
|
static void CreateContestPaintingPicture(u8 contestWinnerId, u8 arg1)
|
||||||
{
|
{
|
||||||
sub_8130738();
|
AllocPaintingResources();
|
||||||
sub_81302E8(gUnknown_030061C0->species, 0);
|
InitContestMonPixels(gContestPaintingWinner->species, 0);
|
||||||
sub_8130760(sub_81306CC(arg0));
|
DoContestPaintingImageProcessing(GetImageEffectForContestWinner(contestWinnerId));
|
||||||
sub_8130688(arg0);
|
InitPaintingMonOamData(contestWinnerId);
|
||||||
sub_8130430(arg0, arg1);
|
LoadContestPaintingFrame(contestWinnerId, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1467,10 +1467,10 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext *ctx)
|
|||||||
|
|
||||||
bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx)
|
bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 v1 = ScriptReadByte(ctx);
|
u8 contestWinnerId = ScriptReadByte(ctx);
|
||||||
|
if (contestWinnerId)
|
||||||
|
SetContestWinnerForPainting(contestWinnerId);
|
||||||
|
|
||||||
if (v1)
|
|
||||||
sub_812FDA8(v1);
|
|
||||||
ShowContestWinner();
|
ShowContestWinner();
|
||||||
ScriptContext1_Stop();
|
ScriptContext1_Stop();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user