mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
commit
c0987169dd
@ -4661,8 +4661,10 @@ static void Cmd_jumpifcantswitch(void)
|
||||
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||
return;
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
{
|
||||
#ifndef NONMATCHING
|
||||
asm("":::"r5");
|
||||
|
@ -146,38 +146,49 @@ struct BerryCrushGame
|
||||
{
|
||||
MainCallback unk0;
|
||||
u32 (* unk4)(struct BerryCrushGame *, u8 *);
|
||||
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
|
||||
u8 unkE;
|
||||
u8 unkF;
|
||||
|
||||
u16 unk10;
|
||||
u16 unk12;
|
||||
u16 unk14;
|
||||
|
||||
u16 unk16;
|
||||
s16 unk18;
|
||||
s16 unk1A;
|
||||
int unk1C;
|
||||
s32 unk1C;
|
||||
s32 unk20;
|
||||
u8 unk24;
|
||||
|
||||
u8 unk25_0:1;
|
||||
u8 unk25_1:1;
|
||||
u8 unk25_2:1;
|
||||
u8 unk25_3:1;
|
||||
u8 unk25_4:1;
|
||||
u8 unk25_5:3;
|
||||
|
||||
u16 unk26;
|
||||
|
||||
u16 unk28;
|
||||
s16 unk2A;
|
||||
s16 unk2C;
|
||||
|
||||
s16 unk2E;
|
||||
s16 unk30;
|
||||
s16 unk32;
|
||||
s16 unk34;
|
||||
|
||||
u8 unk36[0xA];
|
||||
|
||||
struct BerryCrushGame_40 unk40;
|
||||
struct BerryCrushGame_5C unk5C;
|
||||
union BerryCrushGame_68 unk68;
|
||||
@ -204,7 +215,7 @@ void sub_8022524(struct BerryCrushGame_138 *, u16);
|
||||
void sub_8022B28(struct Sprite *);
|
||||
void sub_8022554(struct BerryCrushGame_138 *r0);
|
||||
void sub_8024578(struct BerryCrushGame *);
|
||||
void sub_8024644(u8 *, u32, u32, u32, u32);
|
||||
void sub_8024644(u8 *, u8, u8, u16, u8);
|
||||
static void sub_8022A20(struct Sprite *sprite);
|
||||
static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *r6, u8 *r1);
|
||||
static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5);
|
||||
@ -1986,29 +1997,29 @@ static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *game,
|
||||
// byte 9: if TRUE, communicate on fade complete
|
||||
|
||||
u16 color;
|
||||
u32 selectedPals;
|
||||
selectedPals = ({
|
||||
#ifndef NONMATCHING
|
||||
register u32 value asm("r2");
|
||||
register u32 b asm("r3");
|
||||
#else
|
||||
u32 value;
|
||||
u32 b;
|
||||
#endif //NONMATCHING
|
||||
value = params[0] << 0;
|
||||
value |= (b = params[1] << 8);
|
||||
value |= (b = params[2] << 16);
|
||||
value |= (b = params[3] << 24);
|
||||
value;
|
||||
});
|
||||
u32 selectedPals[2];
|
||||
|
||||
selectedPals[0] = (u32)params[0];
|
||||
selectedPals[1] = (u32)params[1];
|
||||
selectedPals[1] <<= 8;
|
||||
|
||||
selectedPals[0] |= selectedPals[1];
|
||||
selectedPals[1] = (u32)params[2];
|
||||
selectedPals[1] <<= 16;
|
||||
|
||||
selectedPals[0] |= selectedPals[1];
|
||||
selectedPals[1] = (u32)params[3];
|
||||
selectedPals[1] <<= 24;
|
||||
|
||||
selectedPals[0] |= selectedPals[1];
|
||||
params[0] = params[9];
|
||||
|
||||
color = params[8] << 8;
|
||||
color |= params[7] << 0;
|
||||
color = params[8];
|
||||
color <<= 8;
|
||||
color |= params[7];
|
||||
|
||||
gPaletteFade.bufferTransferDisabled = FALSE;
|
||||
BeginNormalPaletteFade(selectedPals, params[4], params[5], params[6], color);
|
||||
BeginNormalPaletteFade(selectedPals[0], params[4], params[5], params[6], color);
|
||||
UpdatePaletteFade();
|
||||
game->unkE = 2;
|
||||
return 0;
|
||||
@ -2390,7 +2401,7 @@ void sub_802339C(struct BerryCrushGame *r4)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r8 > 1)
|
||||
if (r8 >= 2)
|
||||
{
|
||||
for (r7 = 0; r7 < r4->unk9; ++r7)
|
||||
{
|
||||
@ -2580,6 +2591,7 @@ void sub_802385C(struct BerryCrushGame *r5)
|
||||
for (r4 = 0; r4 < r5->unk9; ++r4)
|
||||
r5->unk68.as_four_players.others[r4].unk4.as_2d_bytes[1][5] = 0;
|
||||
#endif
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET
|
||||
|| gRecvCmds[0][1] != 2)
|
||||
{
|
||||
@ -3269,14 +3281,11 @@ static void BerryCrush_SetPaletteFadeParams(u8 *params, bool8 communicateAfter,
|
||||
params[9] = communicateAfter;
|
||||
}
|
||||
|
||||
void sub_8024644(u8 *r0, u32 r1, u32 r2, u32 r3, u32 r5)
|
||||
void sub_8024644(u8 *r0, u8 r1, u8 r2, u16 r3, u8 r5)
|
||||
{
|
||||
u8 sp[2];
|
||||
|
||||
0[(u16 *)sp] = r3;
|
||||
r0[0] = r1;
|
||||
r0[1] = r2;
|
||||
r0[2] = sp[0];
|
||||
r0[3] = sp[1];
|
||||
r0[2] = ((u8 *)&r3)[0];
|
||||
r0[3] = ((u8 *)&r3)[1];
|
||||
r0[4] = r5;
|
||||
}
|
||||
|
@ -501,20 +501,20 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1)
|
||||
|
||||
static void InitPaintingMonOamData(u8 contestWinnerId)
|
||||
{
|
||||
//Some hacks just to get the asm to match
|
||||
#ifndef NONMATCHING
|
||||
asm(""::"r"(contestWinnerId));
|
||||
#endif
|
||||
|
||||
gMain.oamBuffer[0] = sContestPaintingMonOamData;
|
||||
gMain.oamBuffer[0].tileNum = 0;
|
||||
|
||||
#ifndef NONMATCHING
|
||||
if (contestWinnerId) contestWinnerId = gMain.oamBuffer[0].tileNum;
|
||||
#endif
|
||||
|
||||
gMain.oamBuffer[0].x = 88;
|
||||
gMain.oamBuffer[0].y = 24;
|
||||
if (contestWinnerId > 1)
|
||||
{
|
||||
gMain.oamBuffer[0].x = 88;
|
||||
gMain.oamBuffer[0].y = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
gMain.oamBuffer[0].x = 88; // Duplicated Code
|
||||
gMain.oamBuffer[0].y = 24;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 GetImageEffectForContestWinner(u8 contestWinnerId)
|
||||
|
@ -219,18 +219,22 @@ void BufferTrendyPhraseString(void)
|
||||
ConvertEasyChatWordsToString(gStringVar1, s->words, 2, 1);
|
||||
}
|
||||
|
||||
|
||||
void TrendyPhraseIsOld(void)
|
||||
{
|
||||
u16 result = 0;
|
||||
u8 result = 0;
|
||||
|
||||
if (gSaveBlock1Ptr->easyChatPairs[0].unk0_0 - gSaveBlock1Ptr->easyChatPairs[1].unk0_0 < 2)
|
||||
do
|
||||
{
|
||||
#ifndef NONMATCHING
|
||||
asm("":::"r2"); //Force the compiler to store address of gSaveBlock1 in r3 instead of r2
|
||||
#endif
|
||||
if (!gSaveBlock1Ptr->easyChatPairs[0].unk1_6 && gSaveBlock1Ptr->easyChatPairs[1].unk1_6)
|
||||
result = 1;
|
||||
}
|
||||
if (gSaveBlock1Ptr->easyChatPairs[0].unk0_0 - gSaveBlock1Ptr->easyChatPairs[1].unk0_0 > 1)
|
||||
break;
|
||||
if (gSaveBlock1Ptr->easyChatPairs[0].unk1_6)
|
||||
break;
|
||||
if (!gSaveBlock1Ptr->easyChatPairs[1].unk1_6)
|
||||
break;
|
||||
result = 1;
|
||||
} while (0);
|
||||
|
||||
gSpecialVar_Result = result;
|
||||
}
|
||||
|
||||
|
@ -1173,75 +1173,47 @@ static void sub_80C5F58(bool8 arg0, bool8 arg1)
|
||||
|
||||
static void sub_80C6104(u8 cursorArea, u8 previousCursorArea)
|
||||
{
|
||||
bool32 var;
|
||||
|
||||
switch (previousCursorArea)
|
||||
{
|
||||
case CURSOR_AREA_MAP:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24, 16, 3, 12, 7, 17);
|
||||
var = TRUE;
|
||||
break;
|
||||
case CURSOR_AREA_CARD:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 336, 16, 10, 12, 7, 17);
|
||||
var = TRUE;
|
||||
break;
|
||||
case CURSOR_AREA_RECORD:
|
||||
if (!sPassData->hasBattleRecord)
|
||||
{
|
||||
var = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sPassData->hasBattleRecord)
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28, 2, 10, 12, 3, 17);
|
||||
var = TRUE;
|
||||
}
|
||||
else if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL)
|
||||
return;
|
||||
break;
|
||||
case CURSOR_AREA_CANCEL:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3350, 21, 0, 9, 2, 17);
|
||||
var = TRUE;
|
||||
break;
|
||||
default:
|
||||
var = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!var)
|
||||
{
|
||||
if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL)
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cursorArea)
|
||||
{
|
||||
case CURSOR_AREA_MAP:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 168, 16, 3, 12, 7, 17);
|
||||
var = TRUE;
|
||||
break;
|
||||
case CURSOR_AREA_CARD:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 504, 16, 10, 12, 7, 17);
|
||||
var = TRUE;
|
||||
break;
|
||||
case CURSOR_AREA_RECORD:
|
||||
if (!sPassData->hasBattleRecord)
|
||||
if (sPassData->hasBattleRecord)
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17);
|
||||
else
|
||||
return;
|
||||
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17);
|
||||
var = TRUE;
|
||||
break;
|
||||
break; // needed
|
||||
case CURSOR_AREA_CANCEL:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3374, 21, 0, 9, 2, 17);
|
||||
var = TRUE;
|
||||
break;
|
||||
default:
|
||||
var = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!var)
|
||||
{
|
||||
#ifndef NONMATCHING
|
||||
asm("":::"r4");
|
||||
#endif
|
||||
if (previousCursorArea == CURSOR_AREA_NOTHING || previousCursorArea > CURSOR_AREA_CANCEL)
|
||||
return;
|
||||
}
|
||||
|
@ -4167,21 +4167,18 @@ static void PrintMonHeight(u16 height, u8 left, u8 top)
|
||||
|
||||
static void PrintMonWeight(u16 weight, u8 left, u8 top)
|
||||
{
|
||||
#ifndef NONMATCHING
|
||||
asm("":::"r9");
|
||||
{
|
||||
#endif
|
||||
u8 buffer[16];
|
||||
u8 i;
|
||||
bool8 output;
|
||||
u8 i = 0;
|
||||
u32 lbs = (weight * 100000) / 4536;
|
||||
|
||||
if (lbs % 10u >= 5)
|
||||
lbs += 10;
|
||||
|
||||
i = 0;
|
||||
output = FALSE;
|
||||
|
||||
buffer[i] = (lbs / 100000) + CHAR_0;
|
||||
if (buffer[i] == CHAR_0)
|
||||
if ((buffer[i] = (lbs / 100000) + CHAR_0) == CHAR_0 && !output)
|
||||
{
|
||||
buffer[i++] = 0x77;
|
||||
}
|
||||
@ -4192,8 +4189,7 @@ static void PrintMonWeight(u16 weight, u8 left, u8 top)
|
||||
}
|
||||
|
||||
lbs %= 100000;
|
||||
buffer[i] = (lbs / 10000) + CHAR_0;
|
||||
if (buffer[i] == CHAR_0 && !output)
|
||||
if ((buffer[i] = (lbs / 10000) + CHAR_0) == CHAR_0 && !output)
|
||||
{
|
||||
buffer[i++] = 0x77;
|
||||
}
|
||||
@ -4204,13 +4200,13 @@ static void PrintMonWeight(u16 weight, u8 left, u8 top)
|
||||
}
|
||||
|
||||
lbs %= 10000;
|
||||
buffer[i] = (lbs / 1000) + CHAR_0;
|
||||
if (buffer[i] == CHAR_0 && !output)
|
||||
if ((buffer[i] = (lbs / 1000) + CHAR_0) == CHAR_0 && !output)
|
||||
{
|
||||
buffer[i++] = 0x77;
|
||||
}
|
||||
else
|
||||
{
|
||||
output = TRUE;
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -4226,9 +4222,6 @@ static void PrintMonWeight(u16 weight, u8 left, u8 top)
|
||||
buffer[i++] = CHAR_PERIOD;
|
||||
buffer[i++] = EOS;
|
||||
PrintInfoScreenText(buffer, left, top);
|
||||
#ifndef NONMATCHING
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const u8 *GetPokedexCategoryName(u16 dexNum) // unused
|
||||
@ -4236,13 +4229,19 @@ const u8 *GetPokedexCategoryName(u16 dexNum) // unused
|
||||
return gPokedexEntries[dexNum].categoryName;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
HEIGHT,
|
||||
WEIGHT,
|
||||
};
|
||||
|
||||
u16 GetPokedexHeightWeight(u16 dexNum, u8 data)
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case 0: // height
|
||||
case HEIGHT:
|
||||
return gPokedexEntries[dexNum].height;
|
||||
case 1: // weight
|
||||
case WEIGHT:
|
||||
return gPokedexEntries[dexNum].weight;
|
||||
default:
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user