Merge remote-tracking branch '_pret/master' into _RHH/pr/master/pret_sync20240324
# Conflicts: # src/battle_anim_fight.c
This commit is contained in:
commit
3d181e5c70
15 changed files with 98 additions and 126 deletions
|
@ -205,8 +205,8 @@ gScriptCmdTable::
|
|||
.4byte ScrCmd_nop1 @ 0xca
|
||||
.4byte ScrCmd_nop1 @ 0xcb
|
||||
.4byte ScrCmd_nop1 @ 0xcc
|
||||
.4byte ScrCmd_setmonmodernfatefulencounter @ 0xcd
|
||||
.4byte ScrCmd_checkmonmodernfatefulencounter @ 0xce
|
||||
.4byte ScrCmd_setmodernfatefulencounter @ 0xcd
|
||||
.4byte ScrCmd_checkmodernfatefulencounter @ 0xce
|
||||
.4byte ScrCmd_trywondercardscript @ 0xcf
|
||||
.4byte ScrCmd_nop1 @ 0xd0
|
||||
.4byte ScrCmd_warpspinenter @ 0xd1
|
||||
|
|
|
@ -71,6 +71,12 @@ enum ReflectionTypes
|
|||
#define GROUND_EFFECT_FLAG_HOT_SPRINGS (1 << 18)
|
||||
#define GROUND_EFFECT_FLAG_SEAWEED (1 << 19)
|
||||
|
||||
// Sprite data for the CameraObject functions
|
||||
#define sCamera_FollowSpriteId data[0]
|
||||
#define sCamera_State data[1]
|
||||
#define sCamera_MoveX data[2]
|
||||
#define sCamera_MoveY data[3]
|
||||
|
||||
struct StepAnimTable
|
||||
{
|
||||
const union AnimCmd *const *anims;
|
||||
|
@ -122,7 +128,7 @@ u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup);
|
|||
u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation);
|
||||
u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *);
|
||||
void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY);
|
||||
void CameraObjectReset1(void);
|
||||
void CameraObjectReset(void);
|
||||
void ObjectEventSetGraphicsId(struct ObjectEvent *, u8 graphicsId);
|
||||
void ObjectEventTurn(struct ObjectEvent *, u8 direction);
|
||||
void ObjectEventTurnByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 direction);
|
||||
|
@ -210,7 +216,7 @@ u16 GetObjectPaletteTag(u8 palSlot);
|
|||
void UpdateObjectEventSpriteInvisibility(struct Sprite *sprite, bool8 invisible);
|
||||
s16 GetFigure8XOffset(s16 idx);
|
||||
s16 GetFigure8YOffset(s16 idx);
|
||||
void CameraObjectReset2(void);
|
||||
void CameraObjectFreeze(void);
|
||||
u8 GetObjectEventBerryTreeId(u8 objectEventId);
|
||||
void SetBerryTreeJustPicked(u8 mapId, u8 mapNumber, u8 mapGroup);
|
||||
bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup);
|
||||
|
|
|
@ -3734,7 +3734,6 @@ static void AnimTask_UproarDistortion_Step(u8 taskId)
|
|||
|
||||
static void AnimJaggedMusicNote(struct Sprite *sprite)
|
||||
{
|
||||
int var1;
|
||||
u8 battler = !gBattleAnimArgs[0] ? gBattleAnimAttacker : gBattleAnimTarget;
|
||||
|
||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||
|
@ -3745,16 +3744,8 @@ static void AnimJaggedMusicNote(struct Sprite *sprite)
|
|||
sprite->data[0] = 0;
|
||||
sprite->data[1] = (u16)sprite->x << 3;
|
||||
sprite->data[2] = (u16)sprite->y << 3;
|
||||
|
||||
var1 = gBattleAnimArgs[1] << 3;
|
||||
if (var1 < 0)
|
||||
var1 += 7;
|
||||
sprite->data[3] = var1 >> 3;
|
||||
|
||||
var1 = gBattleAnimArgs[2] << 3;
|
||||
if (var1 < 0)
|
||||
var1 += 7;
|
||||
sprite->data[4] = var1 >> 3;
|
||||
sprite->data[3] = (gBattleAnimArgs[1] << 3) / 8;
|
||||
sprite->data[4] = (gBattleAnimArgs[2] << 3) / 8;
|
||||
|
||||
sprite->oam.tileNum += gBattleAnimArgs[3] * 16;
|
||||
sprite->callback = AnimJaggedMusicNote_Step;
|
||||
|
|
|
@ -565,7 +565,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
|
|||
y *= -1;
|
||||
|
||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
y += 0xFFF0;
|
||||
y -= 16;
|
||||
|
||||
sprite->x += x;
|
||||
sprite->y += y;
|
||||
|
|
|
@ -648,7 +648,6 @@ void AnimTask_Rollout(u8 taskId)
|
|||
{
|
||||
u16 var0, var1, var2, var3;
|
||||
u8 rolloutCounter;
|
||||
int var5;
|
||||
s16 pan1, pan2;
|
||||
struct Task *task;
|
||||
|
||||
|
@ -672,13 +671,7 @@ void AnimTask_Rollout(u8 taskId)
|
|||
task->data[11] = 0;
|
||||
task->data[9] = 0;
|
||||
task->data[12] = 1;
|
||||
|
||||
var5 = task->data[8];
|
||||
if (var5 < 0)
|
||||
var5 += 7;
|
||||
|
||||
task->data[10] = (var5 >> 3) - 1;
|
||||
|
||||
task->data[10] = (task->data[8] / 8) - 1;
|
||||
task->data[2] = var0 * 8;
|
||||
task->data[3] = var1 * 8;
|
||||
task->data[4] = ((var2 - var0) * 8) / task->data[8];
|
||||
|
|
|
@ -194,12 +194,12 @@ static void BattleIntroSlide1(u8 taskId)
|
|||
{
|
||||
if (gTasks[taskId].tTerrain == BATTLE_TERRAIN_LONG_GRASS)
|
||||
{
|
||||
if (gBattle_BG1_Y != 0xFFB0)
|
||||
if (gBattle_BG1_Y != (u16)(-80))
|
||||
gBattle_BG1_Y -= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattle_BG1_Y != 0xFFC8)
|
||||
if (gBattle_BG1_Y != (u16)(-56))
|
||||
gBattle_BG1_Y -= 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1373,7 +1373,6 @@ static void CreateBerrySprites(struct BerryCrushGame *game, struct BerryCrushGam
|
|||
u8 spriteId;
|
||||
s16 distance, var1;
|
||||
s16 *data;
|
||||
s32 amplitude;
|
||||
s16 speed;
|
||||
u32 var2;
|
||||
|
||||
|
@ -1395,11 +1394,7 @@ static void CreateBerrySprites(struct BerryCrushGame *game, struct BerryCrushGam
|
|||
sYAccel = 32;
|
||||
sBitfield = 112; // Setting bits in MASK_TARGET_Y
|
||||
distance = gfx->playerCoords[i]->berryXDest - gfx->playerCoords[i]->berryXOffset;
|
||||
amplitude = distance;
|
||||
if (distance < 0)
|
||||
amplitude += 3;
|
||||
|
||||
sAmplitude = amplitude >> 2;
|
||||
sAmplitude = distance / 4;
|
||||
distance *= 128;
|
||||
var2 = speed + 32;
|
||||
var2 = var2 / 2;
|
||||
|
|
|
@ -145,9 +145,9 @@ static u8 FindObjectEventPaletteIndexByTag(u16);
|
|||
static void _PatchObjectPalette(u16, u8);
|
||||
static bool8 ObjectEventDoesElevationMatch(struct ObjectEvent *, u8);
|
||||
static void SpriteCB_CameraObject(struct Sprite *);
|
||||
static void CameraObject_0(struct Sprite *);
|
||||
static void CameraObject_1(struct Sprite *);
|
||||
static void CameraObject_2(struct Sprite *);
|
||||
static void CameraObject_Init(struct Sprite *);
|
||||
static void CameraObject_UpdateMove(struct Sprite *);
|
||||
static void CameraObject_UpdateFrozen(struct Sprite *);
|
||||
static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, const struct ObjectEventTemplate *, u8);
|
||||
static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *);
|
||||
static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8);
|
||||
|
@ -194,10 +194,16 @@ static const struct SpriteTemplate sCameraSpriteTemplate = {
|
|||
.callback = SpriteCB_CameraObject
|
||||
};
|
||||
|
||||
enum {
|
||||
CAMERA_STATE_INIT,
|
||||
CAMERA_STATE_MOVE,
|
||||
CAMERA_STATE_FROZEN,
|
||||
};
|
||||
|
||||
static void (*const sCameraObjectFuncs[])(struct Sprite *) = {
|
||||
CameraObject_0,
|
||||
CameraObject_1,
|
||||
CameraObject_2,
|
||||
[CAMERA_STATE_INIT] = CameraObject_Init,
|
||||
[CAMERA_STATE_MOVE] = CameraObject_UpdateMove,
|
||||
[CAMERA_STATE_FROZEN] = CameraObject_UpdateFrozen,
|
||||
};
|
||||
|
||||
#include "data/object_events/object_event_graphics.h"
|
||||
|
@ -1837,7 +1843,7 @@ void ObjectEventSetGraphicsId(struct ObjectEvent *objectEvent, u8 graphicsId)
|
|||
sprite->x += 8;
|
||||
sprite->y += 16 + sprite->centerToCornerVecY;
|
||||
if (objectEvent->trackedByCamera)
|
||||
CameraObjectReset1();
|
||||
CameraObjectReset();
|
||||
}
|
||||
|
||||
void ObjectEventSetGraphicsIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 graphicsId)
|
||||
|
@ -2129,7 +2135,7 @@ void MoveObjectEventToMapCoords(struct ObjectEvent *objectEvent, s16 x, s16 y)
|
|||
sprite->y += 16 + sprite->centerToCornerVecY;
|
||||
ResetObjectEventFldEffData(objectEvent);
|
||||
if (objectEvent->trackedByCamera)
|
||||
CameraObjectReset1();
|
||||
CameraObjectReset();
|
||||
}
|
||||
|
||||
void TryMoveObjectEventToMapCoords(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y)
|
||||
|
@ -2205,15 +2211,15 @@ void UpdateObjectEventsForCameraUpdate(s16 x, s16 y)
|
|||
RemoveObjectEventsOutsideView();
|
||||
}
|
||||
|
||||
#define sLinkedSpriteId data[0]
|
||||
#define sState data[1]
|
||||
|
||||
u8 AddCameraObject(u8 linkedSpriteId)
|
||||
// The "CameraObject" functions below are responsible for an invisible sprite
|
||||
// that follows the movements of a different sprite (normally the player's sprite)
|
||||
// and tracks x/y movement distances for the camera so it knows where to move.
|
||||
u8 AddCameraObject(u8 followSpriteId)
|
||||
{
|
||||
u8 spriteId = CreateSprite(&sCameraSpriteTemplate, 0, 0, 4);
|
||||
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
gSprites[spriteId].sLinkedSpriteId = linkedSpriteId;
|
||||
gSprites[spriteId].sCamera_FollowSpriteId = followSpriteId;
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
|
@ -2222,35 +2228,37 @@ static void SpriteCB_CameraObject(struct Sprite *sprite)
|
|||
void (*callbacks[ARRAY_COUNT(sCameraObjectFuncs)])(struct Sprite *);
|
||||
|
||||
memcpy(callbacks, sCameraObjectFuncs, sizeof sCameraObjectFuncs);
|
||||
callbacks[sprite->sState](sprite);
|
||||
callbacks[sprite->sCamera_State](sprite);
|
||||
}
|
||||
|
||||
static void CameraObject_0(struct Sprite *sprite)
|
||||
static void CameraObject_Init(struct Sprite *sprite)
|
||||
{
|
||||
sprite->x = gSprites[sprite->sLinkedSpriteId].x;
|
||||
sprite->y = gSprites[sprite->sLinkedSpriteId].y;
|
||||
sprite->x = gSprites[sprite->sCamera_FollowSpriteId].x;
|
||||
sprite->y = gSprites[sprite->sCamera_FollowSpriteId].y;
|
||||
sprite->invisible = TRUE;
|
||||
sprite->sState = 1;
|
||||
CameraObject_1(sprite);
|
||||
sprite->sCamera_State = CAMERA_STATE_MOVE;
|
||||
CameraObject_UpdateMove(sprite);
|
||||
}
|
||||
|
||||
static void CameraObject_1(struct Sprite *sprite)
|
||||
static void CameraObject_UpdateMove(struct Sprite *sprite)
|
||||
{
|
||||
s16 x = gSprites[sprite->sLinkedSpriteId].x;
|
||||
s16 y = gSprites[sprite->sLinkedSpriteId].y;
|
||||
s16 x = gSprites[sprite->sCamera_FollowSpriteId].x;
|
||||
s16 y = gSprites[sprite->sCamera_FollowSpriteId].y;
|
||||
|
||||
sprite->data[2] = x - sprite->x;
|
||||
sprite->data[3] = y - sprite->y;
|
||||
sprite->sCamera_MoveX = x - sprite->x;
|
||||
sprite->sCamera_MoveY = y - sprite->y;
|
||||
sprite->x = x;
|
||||
sprite->y = y;
|
||||
}
|
||||
|
||||
static void CameraObject_2(struct Sprite *sprite)
|
||||
// Invisible sprite will continue to follow the parent sprite,
|
||||
// but no corresponding camera movement will be shown.
|
||||
static void CameraObject_UpdateFrozen(struct Sprite *sprite)
|
||||
{
|
||||
sprite->x = gSprites[sprite->sLinkedSpriteId].x;
|
||||
sprite->y = gSprites[sprite->sLinkedSpriteId].y;
|
||||
sprite->data[2] = 0;
|
||||
sprite->data[3] = 0;
|
||||
sprite->x = gSprites[sprite->sCamera_FollowSpriteId].x;
|
||||
sprite->y = gSprites[sprite->sCamera_FollowSpriteId].y;
|
||||
sprite->sCamera_MoveX = 0;
|
||||
sprite->sCamera_MoveY = 0;
|
||||
}
|
||||
|
||||
static struct Sprite *FindCameraSprite(void)
|
||||
|
@ -2265,51 +2273,43 @@ static struct Sprite *FindCameraSprite(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void CameraObjectReset1(void)
|
||||
void CameraObjectReset(void)
|
||||
{
|
||||
struct Sprite *camera;
|
||||
|
||||
camera = FindCameraSprite();
|
||||
struct Sprite *camera = FindCameraSprite();
|
||||
if (camera != NULL)
|
||||
{
|
||||
camera->sState = 0;
|
||||
camera->sCamera_State = CAMERA_STATE_INIT;
|
||||
camera->callback(camera);
|
||||
}
|
||||
}
|
||||
|
||||
void CameraObjectSetFollowedSpriteId(u8 spriteId)
|
||||
{
|
||||
struct Sprite *camera;
|
||||
|
||||
camera = FindCameraSprite();
|
||||
struct Sprite *camera = FindCameraSprite();
|
||||
if (camera != NULL)
|
||||
{
|
||||
camera->sLinkedSpriteId = spriteId;
|
||||
CameraObjectReset1();
|
||||
camera->sCamera_FollowSpriteId = spriteId;
|
||||
CameraObjectReset();
|
||||
}
|
||||
}
|
||||
|
||||
static u8 UNUSED CameraObjectGetFollowedSpriteId(void)
|
||||
{
|
||||
struct Sprite *camera;
|
||||
|
||||
camera = FindCameraSprite();
|
||||
struct Sprite *camera = FindCameraSprite();
|
||||
if (camera == NULL)
|
||||
return MAX_SPRITES;
|
||||
|
||||
return camera->sLinkedSpriteId;
|
||||
return camera->sCamera_FollowSpriteId;
|
||||
}
|
||||
|
||||
void CameraObjectReset2(void)
|
||||
void CameraObjectFreeze(void)
|
||||
{
|
||||
// UB: Possible null dereference
|
||||
#ifdef UBFIX
|
||||
struct Sprite *camera = FindCameraSprite();
|
||||
if (camera)
|
||||
camera->sState = 2;
|
||||
#else
|
||||
FindCameraSprite()->sState = 2;
|
||||
#endif // UBFIX
|
||||
#ifdef UBFIX // Possible null dereference
|
||||
if (camera == NULL)
|
||||
return;
|
||||
#endif
|
||||
camera->sCamera_State = CAMERA_STATE_FROZEN;
|
||||
}
|
||||
|
||||
u8 CopySprite(struct Sprite *sprite, s16 x, s16 y, u8 subpriority)
|
||||
|
|
|
@ -331,8 +331,8 @@ static void CameraUpdateCallback(struct CameraObject *fieldCamera)
|
|||
{
|
||||
if (fieldCamera->spriteId != 0)
|
||||
{
|
||||
fieldCamera->movementSpeedX = gSprites[fieldCamera->spriteId].data[2];
|
||||
fieldCamera->movementSpeedY = gSprites[fieldCamera->spriteId].data[3];
|
||||
fieldCamera->movementSpeedX = gSprites[fieldCamera->spriteId].sCamera_MoveX;
|
||||
fieldCamera->movementSpeedY = gSprites[fieldCamera->spriteId].sCamera_MoveY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1448,7 +1448,7 @@ static bool8 FallWarpEffect_Init(struct Task *task)
|
|||
struct Sprite *playerSprite;
|
||||
playerObject = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
playerSprite = &gSprites[gPlayerAvatar.spriteId];
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
ObjectEventSetHeldMovement(playerObject, GetFaceDirectionMovementAction(GetPlayerFacingDirection()));
|
||||
|
@ -1544,7 +1544,7 @@ static bool8 FallWarpEffect_End(struct Task *task)
|
|||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
UnlockPlayerFieldControls();
|
||||
CameraObjectReset1();
|
||||
CameraObjectReset();
|
||||
UnfreezeObjectEvents();
|
||||
InstallCameraPanAheadCallback();
|
||||
DestroyTask(FindTaskIdByFunc(Task_FallWarpFieldEffect));
|
||||
|
@ -1583,7 +1583,7 @@ static void Task_EscalatorWarpOut(u8 taskId)
|
|||
static bool8 EscalatorWarpOut_Init(struct Task *task)
|
||||
{
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
StartEscalator(task->tGoingUp);
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
|
@ -1715,7 +1715,7 @@ static bool8 EscalatorWarpIn_Init(struct Task *task)
|
|||
s16 x;
|
||||
s16 y;
|
||||
u8 behavior;
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(DIR_EAST));
|
||||
PlayerGetDestCoords(&x, &y);
|
||||
|
@ -1815,7 +1815,7 @@ static bool8 EscalatorWarpIn_End(struct Task *task)
|
|||
objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
if (ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
{
|
||||
CameraObjectReset1();
|
||||
CameraObjectReset();
|
||||
UnlockPlayerFieldControls();
|
||||
ObjectEventSetHeldMovement(objectEvent, GetWalkNormalMovementAction(DIR_EAST));
|
||||
DestroyTask(FindTaskIdByFunc(Task_EscalatorWarpIn));
|
||||
|
@ -1961,7 +1961,7 @@ static void Task_LavaridgeGymB1FWarp(u8 taskId)
|
|||
static bool8 LavaridgeGymB1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
SetCameraPanningCallback(NULL);
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objectEvent->fixedPriority = 1;
|
||||
|
@ -2076,7 +2076,7 @@ static void Task_LavaridgeGymB1FWarpExit(u8 taskId)
|
|||
|
||||
static bool8 LavaridgeGymB1FWarpExitEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
FreezeObjectEvents();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objectEvent->invisible = TRUE;
|
||||
|
@ -2105,7 +2105,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_PopOut(struct Task *task, struct Obje
|
|||
{
|
||||
task->data[0]++;
|
||||
objectEvent->invisible = FALSE;
|
||||
CameraObjectReset1();
|
||||
CameraObjectReset();
|
||||
PlaySE(SE_M_DIG);
|
||||
ObjectEventSetHeldMovement(objectEvent, GetJumpMovementAction(DIR_EAST));
|
||||
}
|
||||
|
@ -2154,7 +2154,7 @@ static void Task_LavaridgeGym1FWarp(u8 taskId)
|
|||
static bool8 LavaridgeGym1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objectEvent->fixedPriority = 1;
|
||||
task->data[0]++;
|
||||
|
@ -2374,7 +2374,7 @@ static void TeleportWarpOutFieldEffect_Init(struct Task *task)
|
|||
{
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
task->data[15] = GetPlayerFacingDirection();
|
||||
task->tState++;
|
||||
}
|
||||
|
@ -2456,7 +2456,7 @@ static void FieldCallback_TeleportWarpIn(void)
|
|||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
CreateTask(Task_TeleportWarpIn, 0);
|
||||
}
|
||||
|
||||
|
@ -2540,7 +2540,7 @@ static void TeleportWarpInFieldEffect_SpinGround(struct Task *task)
|
|||
if ((++task->data[2]) > 4 && task->data[14] == objectEvent->facingDirection)
|
||||
{
|
||||
UnlockPlayerFieldControls();
|
||||
CameraObjectReset1();
|
||||
CameraObjectReset();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(FindTaskIdByFunc(Task_TeleportWarpIn));
|
||||
}
|
||||
|
@ -3272,7 +3272,7 @@ static void FlyOutFieldEffect_FlyOffWithBird(struct Task *task)
|
|||
objectEvent->inanimate = FALSE;
|
||||
objectEvent->hasShadow = FALSE;
|
||||
SetFlyBirdPlayerSpriteId(task->tBirdSpriteId, objectEvent->spriteId);
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
task->tState++;
|
||||
}
|
||||
}
|
||||
|
@ -3487,7 +3487,7 @@ static void FlyInFieldEffect_BirdSwoopDown(struct Task *task)
|
|||
SetSurfBlob_BobState(objectEvent->fieldEffectSpriteId, BOB_NONE);
|
||||
}
|
||||
ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING));
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
ObjectEventTurn(objectEvent, DIR_WEST);
|
||||
StartSpriteAnim(&gSprites[objectEvent->spriteId], ANIM_GET_ON_OFF_POKEMON_WEST);
|
||||
objectEvent->invisible = FALSE;
|
||||
|
|
|
@ -2095,7 +2095,7 @@ static void Task_DoPlayerSpinExit(u8 taskId)
|
|||
tSpeed = 1;
|
||||
tCurY = (u16)(sprite->y + sprite->y2) << 4;
|
||||
sprite->y2 = 0;
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
object->fixedPriority = TRUE;
|
||||
sprite->oam.priority = 0;
|
||||
sprite->subpriority = 0;
|
||||
|
@ -2164,7 +2164,7 @@ static void Task_DoPlayerSpinEntrance(u8 taskId)
|
|||
tSubpriority = sprite->subpriority;
|
||||
tCurY = -((u16)sprite->y2 + 32) * 16;
|
||||
sprite->y2 = 0;
|
||||
CameraObjectReset2();
|
||||
CameraObjectFreeze();
|
||||
object->fixedPriority = TRUE;
|
||||
sprite->oam.priority = 1;
|
||||
sprite->subpriority = 0;
|
||||
|
@ -2199,7 +2199,7 @@ static void Task_DoPlayerSpinEntrance(u8 taskId)
|
|||
object->fixedPriority = 0;
|
||||
sprite->oam.priority = tPriority;
|
||||
sprite->subpriority = tSubpriority;
|
||||
CameraObjectReset1();
|
||||
CameraObjectReset();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -279,7 +279,6 @@ static void BuildColorMaps(void)
|
|||
u16 brightnessDelta;
|
||||
u16 colorMapIndex;
|
||||
u16 baseBrightness;
|
||||
u32 remainingBrightness;
|
||||
s16 diff;
|
||||
|
||||
sPaletteColorMapTypes = sBasePaletteColorMapTypes;
|
||||
|
@ -307,11 +306,7 @@ static void BuildColorMaps(void)
|
|||
}
|
||||
|
||||
baseBrightness = curBrightness;
|
||||
remainingBrightness = 0x1f00 - curBrightness;
|
||||
if ((0x1f00 - curBrightness) < 0)
|
||||
remainingBrightness += 0xf;
|
||||
|
||||
brightnessDelta = remainingBrightness / (NUM_WEATHER_COLOR_MAPS - 3);
|
||||
brightnessDelta = (0x1f00 - curBrightness) / (NUM_WEATHER_COLOR_MAPS - 3);
|
||||
if (colorVal < 12)
|
||||
{
|
||||
// For shadows (color values < 12), the remaining color mappings are
|
||||
|
|
|
@ -75,10 +75,7 @@ int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu)
|
|||
}
|
||||
|
||||
finalWidth = maxWidth + listMenu->item_X + 9;
|
||||
if (finalWidth < 0)
|
||||
finalWidth += 7;
|
||||
|
||||
finalWidth >>= 3;
|
||||
finalWidth /= 8;
|
||||
if (finalWidth > 28)
|
||||
finalWidth = 28;
|
||||
|
||||
|
|
|
@ -4583,29 +4583,24 @@ static void ShrinkGrowVibrate(struct Sprite *sprite)
|
|||
}
|
||||
else
|
||||
{
|
||||
u8 posY_unsigned;
|
||||
s8 posY_signed;
|
||||
s32 posY;
|
||||
s16 index = (u16)(sprite->data[2] % sprite->data[6] * 256) / sprite->data[6] % 256;
|
||||
s8 sinY;
|
||||
u16 y;
|
||||
s16 index = ((u16)(sprite->data[2] % sprite->data[6] * 256) / sprite->data[6]) % 256;
|
||||
if (sprite->data[2] % 2 == 0)
|
||||
{
|
||||
sprite->data[4] = Sin(index, 32) + 256;
|
||||
sprite->data[5] = Sin(index, 32) + 256;
|
||||
posY_unsigned = Sin(index, 32);
|
||||
posY_signed = posY_unsigned;
|
||||
sinY = Sin(index, 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->data[4] = Sin(index, 8) + 256;
|
||||
sprite->data[5] = Sin(index, 8) + 256;
|
||||
posY_unsigned = Sin(index, 8);
|
||||
posY_signed = posY_unsigned;
|
||||
sinY = Sin(index, 8);
|
||||
}
|
||||
|
||||
posY = posY_signed;
|
||||
if (posY < 0)
|
||||
posY += 7;
|
||||
sprite->y2 = (u32)(posY) >> 3;
|
||||
y = sinY / 8;
|
||||
sprite->y2 = y;
|
||||
HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2311,7 +2311,7 @@ bool8 ScrCmd_lockfortrainer(struct ScriptContext *ctx)
|
|||
}
|
||||
|
||||
// This command will set a Pokémon's modernFatefulEncounter bit; there is no similar command to clear it.
|
||||
bool8 ScrCmd_setmonmodernfatefulencounter(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_setmodernfatefulencounter(struct ScriptContext *ctx)
|
||||
{
|
||||
bool8 isModernFatefulEncounter = TRUE;
|
||||
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
||||
|
@ -2320,7 +2320,7 @@ bool8 ScrCmd_setmonmodernfatefulencounter(struct ScriptContext *ctx)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_checkmonmodernfatefulencounter(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_checkmodernfatefulencounter(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
|
|
Loading…
Reference in a new issue