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
commit e129f4864f
36 changed files with 1916 additions and 4769 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,30 +3,9 @@
.section .rodata
gUnknown_085CDC38:: @ 85CDC38
.2byte 12, 28, 44
.align 1
gUnknown_085CDC3E:: @ 85CDC3E
.byte 0x00, 0x01, 0x02, 0x03
gUnknown_085CDC42:: @ 85CDC42
.2byte 0x0004, 0x0004, 0x0004, 0x0010, 0x0000
gUnknown_085CDC4C:: @ 85CDC4C
.4byte sub_8154C7C
.4byte sub_8154CA0
gUnknown_085CDC54:: @ 85CDC54
.4byte sub_815547C
.4byte sub_81554AC
.4byte sub_815550C
gUnknown_085CDC60:: @ 85CDC60
.byte 0, 0, 1, 2, 3, 0, 0, 1, 1
.byte 0
gUnknown_085CDC6A:: @ 85CDC6A
.2byte 3, 7
gUnknown_085CDC6E:: @ 85CDC6E
@the following might be unref, not sure
.byte 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00

View File

@ -1,6 +0,0 @@
#ifndef GUARD_BLEND_PALETTE_H
#define GUARD_BLEND_PALETTE_H
void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor);
#endif // GUARD_BLEND_PALETTE_H

View File

@ -80,6 +80,7 @@ struct LockedAnimEventObjects
};
extern const struct SpriteFrameImage gEventObjectPicTable_PechaBerryTree[];
extern const u8 gReflectionEffectPaletteMap[];
void sub_808D438(void);
u8 GetMoveDirectionAnimNum(u8);
@ -189,6 +190,10 @@ u8 GetMoveDirectionFasterAnimNum(u8);
u8 GetMoveDirectionFastestAnimNum(u8);
u8 GetLedgeJumpDirection(s16, s16, u8);
void CameraObjectSetFollowedObjectId(u8 objectId);
u16 GetObjectPaletteTag(u8 palSlot);
void UpdateEventObjectSpriteVisibility(struct Sprite *sprite, bool8 invisible);
s16 sub_809773C(s16 a1);
s16 sub_8097728(s16 a1);
void MovementType_None(struct Sprite *);
void MovementType_LookAround(struct Sprite *);
@ -249,6 +254,7 @@ u8 GetSlideMovementAction(u32);
u8 GetJumpInPlaceMovementAction(u32);
u8 GetJumpMovementAction(u32);
u8 GetJump2MovementAction(u32);
u8 CreateCopySpriteAt(struct Sprite *sprite, s16 x, s16 y, u8 subpriority);
u8 MovementType_WanderAround_Step0(struct EventObject *, struct Sprite *);
u8 MovementType_WanderAround_Step1(struct EventObject *, struct Sprite *);

View File

@ -155,7 +155,7 @@ void sub_80AEDBC(void);
void SetSav1WeatherFromCurrMapHeader(void);
// ...
void DoCurrentWeather(void);
void sub_8080750();
void sub_8080750(void);
bool8 IsWeatherNotFadingIn(void);
bool8 IsWeatherChangeComplete(void);

View File

@ -61,8 +61,6 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
#define HEAP_SIZE 0x1C000
extern u8 gStringVar1[];
extern u8 gStringVar2[];
extern u8 gStringVar3[];

View File

@ -13,6 +13,7 @@
}
extern u8 gHeap[];
void *Alloc(u32 size);
void *AllocZeroed(u32 size);
void Free(void *pointer);

View File

@ -55,7 +55,7 @@ bool8 unref_sub_8073D3C(u32, u8, u8, u8, u16);
void unref_sub_8073D84(u8, u32 *);
void ResetPaletteStructByUid(u16);
void ResetPaletteStruct(u8);
void ResetPaletteFadeControl();
void ResetPaletteFadeControl(void);
void unref_sub_8074168(u16);
void unref_sub_8074194(u16);
void InvertPlttBuffer(u32);

View File

@ -50,8 +50,8 @@ void sub_81B1370(u8 taskId);
void display_pokemon_menu_message(u8 windowId);
void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func);
void sub_81B1B5C(void *a, u8 b);
u8 sub_81B1BD4();
void sub_81B8448();
u8 sub_81B1BD4(void);
void sub_81B8448(void);
void sub_81B8518(u8 unused);
u8 sub_81B1360(void);
void sub_81B8904(u8 arg0, void (*callback)(void));

View File

@ -2,7 +2,7 @@
#define GUARD_ROTATING_GATE_H
void RotatingGatePuzzleCameraUpdate(s16, s16);
void RotatingGate_InitPuzzleAndGraphics();
void RotatingGate_InitPuzzleAndGraphics(void);
u32 CheckForRotatingGatePuzzleCollision(u8, s16, s16);
bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8, s16, s16);

View File

@ -24,7 +24,7 @@ u8 *ConvertUIntToDecimalStringN(u8 *dest, u32 value, enum StringConvertMode mode
u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8 n);
u8 *StringExpandPlaceholders(u8 *dest, const u8 *src);
u8 *StringBraille(u8 *dest, const u8 *src);
u8 *GetExpandedPlaceholder(u32 id);
const u8 *GetExpandedPlaceholder(u32 id);
u8 *StringFill(u8 *dest, u8 c, u16 n);
u8 *StringCopyPadded(u8 *dest, const u8 *src, u8 c, u16 n);
u8 *StringFillWithTerminator(u8 *dest, u16 n);

View File

@ -76,6 +76,7 @@
#define CHAR_y 0xED
#define CHAR_z 0xEE
#define CHAR_SPECIAL_F7 0xF7
#define CHAR_SPECIAL_F8 0xF8
#define CHAR_SPECIAL_F9 0xF9
#define CHAR_COLON 0xF0
#define CHAR_PROMPT_SCROLL 0xFA // waits for button press and scrolls dialog

View File

@ -13,5 +13,6 @@ int CountTrailingZeroBits(u32 value);
u16 CalcCRC16(u8 *data, s32 length);
u16 CalcCRC16WithTable(u8 *data, u32 length);
u32 CalcByteArraySum(const u8* data, u32 length);
void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor);
#endif // GUARD_UTIL_H

View File

@ -76,7 +76,6 @@ SECTIONS {
src/trig.o(.text);
src/random.o(.text);
src/util.o(.text);
src/blend_palette.o(.text);
src/daycare.o(.text);
src/egg_hatch.o(.text);
src/battle_interface.o(.text);
@ -201,7 +200,7 @@ SECTIONS {
src/rom_81520A8.o(.text);
src/save.o(.text);
src/mystery_event_script.o(.text);
asm/field_effect_helpers.o(.text);
src/field_effect_helpers.o(.text);
src/contest_ai.o(.text);
src/battle_anim_sound_tasks.o(.text);
src/battle_controller_safari.o(.text);
@ -491,6 +490,7 @@ SECTIONS {
src/battle_message.o(.rodata);
data/cable_car.o(.rodata);
src/save.o(.rodata);
src/field_effect_helpers.o(.rodata);
data/field_effect_helpers.o(.rodata);
src/contest_ai.o(.rodata);
src/battle_controller_safari.o(.rodata);

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);
}
}