Merge branch 'master' of https://github.com/pret/pokeemerald into LabelOWsProperly

This commit is contained in:
Deokishisu
2018-10-14 14:16:07 -04:00
36 changed files with 1916 additions and 4769 deletions

View File

@@ -3,7 +3,6 @@
#include "constants/species.h"
#include "battle.h"
#include "battle_anim.h"
#include "blend_palette.h"
#include "contest.h"
#include "data2.h"
#include "decompress.h"
@@ -861,7 +860,7 @@ bool8 IsBattlerSpritePresent(u8 battlerId)
return FALSE;
}
bool8 IsDoubleBattle()
bool8 IsDoubleBattle(void)
{
return IS_DOUBLE_BATTLE();
}

View File

@@ -3,7 +3,7 @@
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "constants/rgb.h"
#include "blend_palette.h"
#include "util.h"
#include "decompress.h"
#include "palette.h"
#include "sprite.h"

View File

@@ -20,7 +20,7 @@
#include "pokemon_summary_screen.h"
#include "sound.h"
#include "pokedex.h"
#include "blend_palette.h"
#include "util.h"
#include "trainer_pokemon_sprites.h"
#include "constants/battle_frontier.h"
#include "constants/songs.h"

View File

@@ -19,7 +19,6 @@
#include "decompress.h"
#include "data2.h"
#include "palette.h"
#include "blend_palette.h"
#include "contest.h"
#include "constants/songs.h"
#include "constants/rgb.h"

View File

@@ -19,7 +19,7 @@
#include "gpu_regs.h"
#include "decompress.h"
#include "bg.h"
#include "blend_palette.h"
#include "util.h"
struct TransitionData
{

View File

@@ -1,19 +0,0 @@
#include "global.h"
#include "palette.h"
void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor)
{
u16 i;
for (i = 0; i < numEntries; i++)
{
u16 index = i + palOffset;
struct PlttData *data1 = (struct PlttData *)&gPlttBufferUnfaded[index];
s8 r = data1->r;
s8 g = data1->g;
s8 b = data1->b;
struct PlttData *data2 = (struct PlttData *)&blendColor;
gPlttBufferFaded[index] = ((r + (((data2->r - r) * coeff) >> 4)) << 0)
| ((g + (((data2->g - g) * coeff) >> 4)) << 5)
| ((b + (((data2->b - b) * coeff) >> 4)) << 10);
}
}

View File

@@ -10,7 +10,6 @@
#include "constants/flags.h"
#include "battle.h"
#include "battle_anim.h"
#include "blend_palette.h"
#include "contest.h"
#include "data2.h"
#include "decompress.h"

View File

@@ -25,7 +25,7 @@
#include "gpu_regs.h"
#include "bg.h"
#include "link.h"
#include "blend_palette.h"
#include "util.h"
#include "trig.h"
struct EvoInfo

1774
src/field_effect_helpers.c Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -285,7 +285,7 @@ void MovementType_Player(struct Sprite *sprite)
UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2);
}
static u8 EventObjectCB2_NoMovement2()
static u8 EventObjectCB2_NoMovement2(void)
{
return 0;
}
@@ -375,7 +375,7 @@ static void PlayerAllowForcedMovementIfMovingSameDirection(void)
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5;
}
static bool8 TryDoMetatileBehaviorForcedMovement()
static bool8 TryDoMetatileBehaviorForcedMovement(void)
{
return gUnknown_08497444[GetForcedMovementByMetatileBehavior()]();
}

View File

@@ -35,7 +35,7 @@ void hm2_sweet_scent(void)
gFieldEffectArguments[0] = GetCursorSelectionMonId();
}
bool8 FldEff_SweetScent()
bool8 FldEff_SweetScent(void)
{
u8 taskId;

View File

@@ -17,7 +17,7 @@
#include "bg.h"
#include "constants/species.h"
#include "constants/game_stat.h"
#include "blend_palette.h"
#include "util.h"
#include "string_util.h"
#include "m4a.h"
#include "international_string_util.h"

View File

@@ -22,7 +22,7 @@
#include "graphics.h"
#include "sound.h"
#include "constants/species.h"
#include "blend_palette.h"
#include "util.h"
#include "title_screen.h"
#include "constants/rgb.h"
#include "constants/battle_anim.h"

View File

@@ -203,7 +203,7 @@ u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId)
return 0;
}
void sub_80FD254()
void sub_80FD254(void)
{
struct MailStruct mail;
mail.itemId = gSpecialVar_ItemId;
@@ -249,7 +249,7 @@ void ItemUseOnFieldCB_Bike(u8 taskId)
DestroyTask(taskId);
}
bool32 CanFish()
bool32 CanFish(void)
{
s16 x, y;
u16 tileBehavior;

View File

@@ -1,6 +1,6 @@
#include "global.h"
#include "blend_palette.h"
#include "palette.h"
#include "util.h"
#include "decompress.h"
#include "gpu_regs.h"
#include "task.h"

View File

@@ -6,7 +6,7 @@
#include "menu.h"
#include "malloc.h"
#include "pokemon.h"
#include "blend_palette.h"
#include "util.h"
#include "main.h"
#include "menu_helpers.h"
#include "bg.h"

View File

@@ -4,7 +4,7 @@
#include "pokemon_animation.h"
#include "trig.h"
#include "task.h"
#include "blend_palette.h"
#include "util.h"
#include "constants/rgb.h"
struct UnkAnimStruct

View File

@@ -20,20 +20,20 @@ static const s32 sPowersOfTen[] =
1000000000,
};
extern u8 gExpandedPlaceholder_Empty[];
extern u8 gExpandedPlaceholder_Kun[];
extern u8 gExpandedPlaceholder_Chan[];
extern u8 gExpandedPlaceholder_Sapphire[];
extern u8 gExpandedPlaceholder_Ruby[];
extern u8 gExpandedPlaceholder_Emerald[];
extern u8 gExpandedPlaceholder_Aqua[];
extern u8 gExpandedPlaceholder_Magma[];
extern u8 gExpandedPlaceholder_Archie[];
extern u8 gExpandedPlaceholder_Maxie[];
extern u8 gExpandedPlaceholder_Kyogre[];
extern u8 gExpandedPlaceholder_Groudon[];
extern u8 gExpandedPlaceholder_Brendan[];
extern u8 gExpandedPlaceholder_May[];
extern const u8 gExpandedPlaceholder_Empty[];
extern const u8 gExpandedPlaceholder_Kun[];
extern const u8 gExpandedPlaceholder_Chan[];
extern const u8 gExpandedPlaceholder_Sapphire[];
extern const u8 gExpandedPlaceholder_Ruby[];
extern const u8 gExpandedPlaceholder_Emerald[];
extern const u8 gExpandedPlaceholder_Aqua[];
extern const u8 gExpandedPlaceholder_Magma[];
extern const u8 gExpandedPlaceholder_Archie[];
extern const u8 gExpandedPlaceholder_Maxie[];
extern const u8 gExpandedPlaceholder_Kyogre[];
extern const u8 gExpandedPlaceholder_Groudon[];
extern const u8 gExpandedPlaceholder_Brendan[];
extern const u8 gExpandedPlaceholder_May[];
u8 *StringCopy10(u8 *dest, const u8 *src)
{
@@ -348,7 +348,7 @@ u8 *StringExpandPlaceholders(u8 *dest, const u8 *src)
{
u8 c = *src++;
u8 placeholderId;
u8 *expandedString;
const u8 *expandedString;
switch (c)
{
@@ -383,9 +383,9 @@ u8 *StringExpandPlaceholders(u8 *dest, const u8 *src)
case EOS:
*dest = EOS;
return dest;
case 0xFA:
case 0xFB:
case 0xFE:
case CHAR_PROMPT_SCROLL:
case CHAR_PROMPT_CLEAR:
case CHAR_NEWLINE:
default:
*dest++ = c;
}
@@ -394,8 +394,8 @@ u8 *StringExpandPlaceholders(u8 *dest, const u8 *src)
u8 *StringBraille(u8 *dest, const u8 *src)
{
u8 setBrailleFont[] = { 0xFC, 0x06, 0x06, 0xFF };
u8 gotoLine2[] = { 0xFE, 0xFC, 0x0E, 0x02, 0xFF };
u8 setBrailleFont[] = { EXT_CTRL_CODE_BEGIN, 0x06, 0x06, EOS };
u8 gotoLine2[] = { CHAR_NEWLINE, EXT_CTRL_CODE_BEGIN, 0x0E, 0x02, EOS };
dest = StringCopy(dest, setBrailleFont);
@@ -408,7 +408,7 @@ u8 *StringBraille(u8 *dest, const u8 *src)
case EOS:
*dest = c;
return dest;
case 0xFE:
case CHAR_NEWLINE:
dest = StringCopy(dest, gotoLine2);
break;
default:
@@ -419,32 +419,32 @@ u8 *StringBraille(u8 *dest, const u8 *src)
}
}
static u8 *ExpandPlaceholder_UnknownStringVar(void)
static const u8 *ExpandPlaceholder_UnknownStringVar(void)
{
return gUnknownStringVar;
}
static u8 *ExpandPlaceholder_PlayerName(void)
static const u8 *ExpandPlaceholder_PlayerName(void)
{
return gSaveBlock2Ptr->playerName;
}
static u8 *ExpandPlaceholder_StringVar1(void)
static const u8 *ExpandPlaceholder_StringVar1(void)
{
return gStringVar1;
}
static u8 *ExpandPlaceholder_StringVar2(void)
static const u8 *ExpandPlaceholder_StringVar2(void)
{
return gStringVar2;
}
static u8 *ExpandPlaceholder_StringVar3(void)
static const u8 *ExpandPlaceholder_StringVar3(void)
{
return gStringVar3;
}
static u8 *ExpandPlaceholder_KunChan(void)
static const u8 *ExpandPlaceholder_KunChan(void)
{
if (gSaveBlock2Ptr->playerGender == MALE)
return gExpandedPlaceholder_Kun;
@@ -452,7 +452,7 @@ static u8 *ExpandPlaceholder_KunChan(void)
return gExpandedPlaceholder_Chan;
}
static u8 *ExpandPlaceholder_RivalName(void)
static const u8 *ExpandPlaceholder_RivalName(void)
{
if (gSaveBlock2Ptr->playerGender == MALE)
return gExpandedPlaceholder_May;
@@ -460,44 +460,44 @@ static u8 *ExpandPlaceholder_RivalName(void)
return gExpandedPlaceholder_Brendan;
}
static u8 *ExpandPlaceholder_Version(void)
static const u8 *ExpandPlaceholder_Version(void)
{
return gExpandedPlaceholder_Emerald;
}
static u8 *ExpandPlaceholder_Aqua(void)
static const u8 *ExpandPlaceholder_Aqua(void)
{
return gExpandedPlaceholder_Aqua;
}
static u8 *ExpandPlaceholder_Magma(void)
static const u8 *ExpandPlaceholder_Magma(void)
{
return gExpandedPlaceholder_Magma;
}
static u8 *ExpandPlaceholder_Archie(void)
static const u8 *ExpandPlaceholder_Archie(void)
{
return gExpandedPlaceholder_Archie;
}
static u8 *ExpandPlaceholder_Maxie(void)
static const u8 *ExpandPlaceholder_Maxie(void)
{
return gExpandedPlaceholder_Maxie;
}
static u8 *ExpandPlaceholder_Kyogre(void)
static const u8 *ExpandPlaceholder_Kyogre(void)
{
return gExpandedPlaceholder_Kyogre;
}
static u8 *ExpandPlaceholder_Groudon(void)
static const u8 *ExpandPlaceholder_Groudon(void)
{
return gExpandedPlaceholder_Groudon;
}
u8 *GetExpandedPlaceholder(u32 id)
const u8 *GetExpandedPlaceholder(u32 id)
{
typedef u8 *(*ExpandPlaceholderFunc)(void);
typedef const u8 *(*ExpandPlaceholderFunc)(void);
static const ExpandPlaceholderFunc funcs[] =
{
@@ -574,7 +574,7 @@ u8 *StringCopyN_Multibyte(u8 *dest, u8 *src, u32 n)
else
{
*dest++ = *src++;
if (*(src - 1) == 0xF9)
if (*(src - 1) == CHAR_SPECIAL_F9)
*dest++ = *src++;
}
}
@@ -589,7 +589,7 @@ u32 StringLength_Multibyte(u8 *str)
while (*str != EOS)
{
if (*str == 0xF9)
if (*str == CHAR_SPECIAL_F9)
str++;
str++;
length++;
@@ -600,7 +600,7 @@ u32 StringLength_Multibyte(u8 *str)
u8 *WriteColorChangeControlCode(u8 *dest, u32 colorType, u8 color)
{
*dest = 0xFC;
*dest = EXT_CTRL_CODE_BEGIN;
dest++;
switch (colorType)
@@ -630,7 +630,7 @@ bool32 IsStringJapanese(u8 *str)
while (*str != EOS)
{
if (*str <= 0xA0)
if (*str != 0)
if (*str != CHAR_SPACE)
return TRUE;
str++;
}
@@ -645,7 +645,7 @@ bool32 sub_800924C(u8 *str, s32 n)
for (i = 0; *str != EOS && i < n; i++)
{
if (*str <= 0xA0)
if (*str != 0)
if (*str != CHAR_SPACE)
return TRUE;
str++;
}
@@ -692,7 +692,7 @@ u8 GetExtCtrlCodeLength(u8 code)
static const u8 *SkipExtCtrlCode(const u8 *s)
{
while (*s == 0xFC)
while (*s == EXT_CTRL_CODE_BEGIN)
{
s++;
s += GetExtCtrlCodeLength(*s);
@@ -716,11 +716,11 @@ s32 StringCompareWithoutExtCtrlCodes(const u8 *str1, const u8 *str2)
if (*str1 < *str2)
{
retVal = -1;
if (*str2 == 0xFF)
if (*str2 == EOS)
retVal = 1;
}
if (*str1 == 0xFF)
if (*str1 == EOS)
return retVal;
str1++;
@@ -729,7 +729,7 @@ s32 StringCompareWithoutExtCtrlCodes(const u8 *str1, const u8 *str2)
retVal = 1;
if (*str1 == 0xFF)
if (*str1 == EOS)
retVal = -1;
return retVal;
@@ -743,9 +743,9 @@ void ConvertInternationalString(u8 *s, u8 language)
StripExtCtrlCodes(s);
i = StringLength(s);
s[i++] = 0xFC;
s[i++] = EXT_CTRL_CODE_BEGIN;
s[i++] = 22;
s[i++] = 0xFF;
s[i++] = EOS;
i--;
@@ -755,7 +755,7 @@ void ConvertInternationalString(u8 *s, u8 language)
i--;
}
s[0] = 0xFC;
s[0] = EXT_CTRL_CODE_BEGIN;
s[1] = 21;
}
}
@@ -764,9 +764,9 @@ void StripExtCtrlCodes(u8 *str)
{
u16 srcIndex = 0;
u16 destIndex = 0;
while (str[srcIndex] != 0xFF)
while (str[srcIndex] != EOS)
{
if (str[srcIndex] == 0xFC)
if (str[srcIndex] == EXT_CTRL_CODE_BEGIN)
{
srcIndex++;
srcIndex += GetExtCtrlCodeLength(str[srcIndex]);
@@ -776,5 +776,5 @@ void StripExtCtrlCodes(u8 *str)
str[destIndex++] = str[srcIndex++];
}
}
str[destIndex] = 0xFF;
str[destIndex] = EOS;
}

View File

@@ -7,7 +7,7 @@
struct Task gTasks[NUM_TASKS];
static void InsertTask(u8 newTaskId);
static u8 FindFirstActiveTask();
static u8 FindFirstActiveTask(void);
void ResetTasks(void)
{
@@ -124,7 +124,7 @@ void RunTasks(void)
}
}
static u8 FindFirstActiveTask()
static u8 FindFirstActiveTask(void)
{
u8 taskId;

View File

@@ -3095,13 +3095,13 @@ u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
temp = strLocal[strPos++];
switch (temp)
{
case 0xFE:
case 0xFF:
case CHAR_NEWLINE:
case EOS:
lineWidths[line] = width;
width = 0;
line++;
break;
case 0xFC:
case EXT_CTRL_CODE_BEGIN:
temp2 = strLocal[strPos++];
switch (temp2)
{
@@ -3135,21 +3135,21 @@ u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
break;
}
break;
case 0xF7:
case 0xFD:
case CHAR_SPECIAL_F7:
case PLACEHOLDER_BEGIN:
++strPos;
break;
case 0xFA:
case 0xFB:
case CHAR_PROMPT_SCROLL:
case CHAR_PROMPT_CLEAR:
break;
case 0xF8:
case 0xF9:
case CHAR_SPECIAL_F8:
case CHAR_SPECIAL_F9:
++strPos;
default:
++width;
break;
}
} while (temp != 0xFF);
} while (temp != EOS);
for (width = 0, strPos = 0; strPos < 8; ++strPos)
{
@@ -3201,16 +3201,16 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
lineWidth = 0;
bufferPointer = 0;
while (*str != 0xFF)
while (*str != EOS)
{
switch (*str)
{
case 0xFE:
case CHAR_NEWLINE:
if (lineWidth > width)
width = lineWidth;
lineWidth = 0;
break;
case 0xFD:
case PLACEHOLDER_BEGIN:
switch (*++str)
{
case 0x2:
@@ -3225,10 +3225,10 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
default:
return 0;
}
case 0xF7:
case CHAR_SPECIAL_F7:
if (bufferPointer == NULL)
bufferPointer = DynamicPlaceholderTextUtil_GetPlaceholderPtr(*++str);
while (*bufferPointer != 0xFF)
while (*bufferPointer != EOS)
{
glyphWidth = func(*bufferPointer++, isJapanese);
if (minGlyphWidth > 0)
@@ -3240,13 +3240,13 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
else
{
lineWidth += glyphWidth;
if (isJapanese && str[1] != 0xFF)
if (isJapanese && str[1] != EOS)
lineWidth += localLetterSpacing;
}
}
bufferPointer = 0;
break;
case 0xFC:
case EXT_CTRL_CODE_BEGIN:
switch (*++str)
{
case 0x4:
@@ -3299,9 +3299,9 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
break;
}
break;
case 0xF8:
case 0xF9:
if (*str == 0xF9)
case CHAR_SPECIAL_F8:
case CHAR_SPECIAL_F9:
if (*str == CHAR_SPECIAL_F9)
glyphWidth = func(*++str | 0x100, isJapanese);
else
glyphWidth = GetKeypadIconWidth(*++str);
@@ -3315,12 +3315,12 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
else
{
lineWidth += glyphWidth;
if (isJapanese && str[1] != 0xFF)
if (isJapanese && str[1] != EOS)
lineWidth += localLetterSpacing;
}
break;
case 0xFA:
case 0xFB:
case CHAR_PROMPT_SCROLL:
case CHAR_PROMPT_CLEAR:
break;
default:
glyphWidth = func(*str, isJapanese);
@@ -3333,7 +3333,7 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
else
{
lineWidth += glyphWidth;
if (isJapanese && str[1] != 0xFF)
if (isJapanese && str[1] != EOS)
lineWidth += localLetterSpacing;
}
break;
@@ -3372,7 +3372,7 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)
temp = strLocal[strPos++];
switch (temp)
{
case 0xFC:
case EXT_CTRL_CODE_BEGIN:
temp2 = strLocal[strPos++];
switch (temp2)
{
@@ -3421,16 +3421,16 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)
continue;
}
break;
case 0xF7:
case 0xF8:
case 0xF9:
case 0xFD:
case CHAR_SPECIAL_F7:
case CHAR_SPECIAL_F8:
case CHAR_SPECIAL_F9:
case PLACEHOLDER_BEGIN:
++strPos;
break;
case 0xFA:
case 0xFB:
case 0xFE:
case 0xFF:
case CHAR_PROMPT_SCROLL:
case CHAR_PROMPT_CLEAR:
case CHAR_NEWLINE:
case EOS:
break;
default:
switch (fontId)
@@ -3450,7 +3450,7 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)
break;
}
}
while (temp != 0xFF);
while (temp != EOS);
RestoreTextColors(&colorBackup[0], &colorBackup[1], &colorBackup[2]);
return 1;

View File

@@ -1,7 +1,7 @@
// Includes
#include "global.h"
#include "palette.h"
#include "blend_palette.h"
#include "util.h"
#include "battle_transition.h"
#include "task.h"
#include "battle_transition.h"

View File

@@ -1,6 +1,7 @@
#include "global.h"
#include "util.h"
#include "sprite.h"
#include "palette.h"
const u32 gBitTable[] =
{
@@ -258,3 +259,20 @@ u32 CalcByteArraySum(const u8* data, u32 length)
sum += data[i];
return sum;
}
void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor)
{
u16 i;
for (i = 0; i < numEntries; i++)
{
u16 index = i + palOffset;
struct PlttData *data1 = (struct PlttData *)&gPlttBufferUnfaded[index];
s8 r = data1->r;
s8 g = data1->g;
s8 b = data1->b;
struct PlttData *data2 = (struct PlttData *)&blendColor;
gPlttBufferFaded[index] = ((r + (((data2->r - r) * coeff) >> 4)) << 0)
| ((g + (((data2->g - g) * coeff) >> 4)) << 5)
| ((b + (((data2->b - b) * coeff) >> 4)) << 10);
}
}