Fixed follower not disappearing when surfing.

This commit is contained in:
Ariel Antonitis 2020-06-17 23:49:18 -04:00
parent 4bd6642033
commit 1fa2bc0df1
9 changed files with 20 additions and 108 deletions

View file

@ -1,19 +0,0 @@
JASC-PAL
0100
16
208 144 200
0 0 0
0 2 6
72 80 104
40 104 152
0 132 6
40 128 168
112 128 144
64 168 216
96 192 232
168 176 192
208 224 232
248 248 248
0 0 0
0 0 0
0 0 0

View file

@ -1,19 +0,0 @@
JASC-PAL
0100
16
160 176 128
0 0 0
96 48 0
192 16 32
40 72 88
96 64 0
144 64 32
200 88 40
64 128 128
248 120 56
160 160 160
216 168 48
248 184 16
240 208 112
216 216 248
0 0 0

View file

@ -1,19 +0,0 @@
JASC-PAL
0100
16
136 184 104
0 0 0
72 56 16
32 80 88
48 80 96
160 72 16
192 88 16
64 128 128
96 120 128
240 128 16
128 160 176
88 184 176
176 192 208
232 232 248
0 0 0
0 0 0

View file

@ -1,19 +0,0 @@
JASC-PAL
0100
16
56 144 88
0 0 0
40 40 40
40 48 88
216 80 88
128 144 144
96 168 224
160 176 216
232 232 248
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

View file

@ -1,4 +1,5 @@
#!/usr/bin/python3
""" Extract a GBA-compatible palette from a PNG. """
import sys
import os.path
import png

View file

@ -68,10 +68,6 @@ const u16 gObjectEventPal_Npc1Reflection[] = INCBIN_U16("graphics/object_events/
const u16 gObjectEventPal_Npc2Reflection[] = INCBIN_U16("graphics/object_events/palettes/npc_2_reflection.gbapal");
const u16 gObjectEventPal_Npc3Reflection[] = INCBIN_U16("graphics/object_events/palettes/npc_3_reflection.gbapal");
const u16 gObjectEventPal_Npc4Reflection[] = INCBIN_U16("graphics/object_events/palettes/npc_4_reflection.gbapal");
const u16 gObjectEventPaletteMarshtomp[] = INCBIN_U16("graphics/object_events/palettes/marshtomp.gbapal");
const u16 gObjectEventPaletteAltaria[] = INCBIN_U16("graphics/object_events/palettes/altaria.gbapal");
const u16 gObjectEventPaletteTogetic[] = INCBIN_U16("graphics/object_events/palettes/togetic.gbapal");
const u16 gObjectEventPaletteCharizard[] = INCBIN_U16("graphics/object_events/palettes/charizard.gbapal");
const u32 gObjectEventPic_NinjaBoy[] = INCBIN_U32("graphics/object_events/pics/people/ninja_boy.4bpp");
const u32 gObjectEventPic_Twin[] = INCBIN_U32("graphics/object_events/pics/people/twin.4bpp");
const u32 gObjectEventPic_Boy1[] = INCBIN_U32("graphics/object_events/pics/people/boy_1.4bpp");

View file

@ -245,7 +245,7 @@ const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Lugia = {0xFFFF, O
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_HoOh = {0xFFFF, OBJ_EVENT_PAL_TAG_HO_OH, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 10, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_HoOh, gObjectEventPicTable_HoOh, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_AnimatedBall = {0xFFFF, OBJ_EVENT_PAL_TAG_3, OBJ_EVENT_PAL_TAG_NONE, 256, 16, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_16x32, gObjectEventSpriteOamTables_16x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_AnimatedBall, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Marshtomp = {0xFFFF, OBJ_EVENT_PAL_TAG_DYNAMIC, OBJ_EVENT_PAL_TAG_NONE, 256, 16, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_16x32, gObjectEventSpriteOamTables_16x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Marshtomp, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Altaria = {0xFFFF, OBJ_EVENT_PAL_TAG_ALTARIA, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Standard, gObjectEventPicTable_Altaria, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Altaria = {0xFFFF, OBJ_EVENT_PAL_TAG_DYNAMIC, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Standard, gObjectEventPicTable_Altaria, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Togetic = {0xFFFF, OBJ_EVENT_PAL_TAG_DYNAMIC, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_NONE, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Togetic, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Charizard = {0xFFFF, OBJ_EVENT_PAL_TAG_CHARIZARD, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Charizard, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Follower = {0xFFFF, OBJ_EVENT_PAL_TAG_CHARIZARD, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Togetic, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Charizard = {0xFFFF, OBJ_EVENT_PAL_TAG_DYNAMIC, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Charizard, gDummySpriteAffineAnimTable};
const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Follower = {0xFFFF, OBJ_EVENT_PAL_TAG_DYNAMIC, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, gObjectEventSpriteOamTables_32x32, gObjectEventImageAnimTable_Following, gObjectEventPicTable_Togetic, gDummySpriteAffineAnimTable};

View file

@ -2,6 +2,7 @@
#include "malloc.h"
#include "battle_pyramid.h"
#include "berry.h"
#include "data.h"
#include "decoration.h"
#include "decompress.h"
#include "event_data.h"
@ -18,7 +19,6 @@
#include "metatile_behavior.h"
#include "overworld.h"
#include "palette.h"
#include "data.h"
#include "pokemon.h"
#include "random.h"
#include "script.h"
@ -447,12 +447,8 @@ const u8 gInitialMovementTypeFacingDirections[] = {
#define OBJ_EVENT_PAL_TAG_LUGIA 0x1121
#define OBJ_EVENT_PAL_TAG_RS_BRENDAN 0x1122
#define OBJ_EVENT_PAL_TAG_RS_MAY 0x1123
#define OBJ_EVENT_PAL_TAG_MARSHTOMP 0x1124
#define OBJ_EVENT_PAL_TAG_ALTARIA 0x1125
#define OBJ_EVENT_PAL_TAG_TOGETIC 0x1126
#define OBJ_EVENT_PAL_TAG_CHARIZARD 0x1127
#define OBJ_EVENT_PAL_TAG_NONE 0x11FF
#define OBJ_EVENT_PAL_TAG_DYNAMIC 0x1124
#define OBJ_EVENT_PAL_TAG_NONE 0x11FF
#include "data/object_events/object_event_graphics_info_pointers.h"
#include "data/field_effects/field_effect_object_template_pointers.h"
@ -498,10 +494,7 @@ static const struct SpritePalette sObjectEventSpritePalettes[] = {
{gObjectEventPal_Lugia, OBJ_EVENT_PAL_TAG_LUGIA},
{gObjectEventPal_RubySapphireBrendan, OBJ_EVENT_PAL_TAG_RS_BRENDAN},
{gObjectEventPal_RubySapphireMay, OBJ_EVENT_PAL_TAG_RS_MAY},
{gObjectEventPaletteMarshtomp, OBJ_EVENT_PAL_TAG_MARSHTOMP},
{gObjectEventPaletteAltaria, OBJ_EVENT_PAL_TAG_ALTARIA},
{gObjectEventPaletteTogetic, OBJ_EVENT_PAL_TAG_TOGETIC},
{gObjectEventPaletteCharizard, OBJ_EVENT_PAL_TAG_CHARIZARD},
{gObjectEventPalette0, OBJ_EVENT_PAL_TAG_DYNAMIC},
{NULL, 0x0000},
};
@ -4608,6 +4601,18 @@ bool8 MovementType_FollowPlayer_Active(struct ObjectEvent *objectEvent, struct S
{
if (gObjectEvents[gPlayerAvatar.objectEventId].movementActionId == 0xFF || gPlayerAvatar.tileTransitionState == T_TILE_CENTER) { // do nothing if player is stationary
return FALSE;
} else if (!IsFollowerVisible()) {
if (objectEvent->invisible) { // Return to shadowing state
sprite->data[1] = 0;
return FALSE;
}
// Animate entering pokeball
ClearObjectEventMovement(objectEvent, sprite);
ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_ENTER_POKEBALL);
objectEvent->singleMovementActive = 1;
sprite->animCmdIndex = 0; // Needed because of weird animCmdIndex stuff
sprite->data[1] = 2; // movement action sets state to 0
return TRUE;
}
// TODO: Remove dependence on PlayerGetCopyableMovement
return gFollowPlayerMovementFuncs[PlayerGetCopyableMovement()](objectEvent, sprite, GetPlayerMovementDirection(), NULL);
@ -4628,19 +4633,7 @@ bool8 MovementType_FollowPlayer_Moving(struct ObjectEvent *objectEvent, struct S
bool8 FollowablePlayerMovement_Idle(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8))
{
u8 direction;
if (!IsFollowerVisible()) {
if (objectEvent->invisible) { // Return to shadowing state
sprite->data[1] = 0;
return FALSE;
}
// Animate entering pokeball
ClearObjectEventMovement(objectEvent, sprite);
ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_ENTER_POKEBALL);
objectEvent->singleMovementActive = 1;
sprite->animCmdIndex = 0; // Needed because of weird animCmdIndex stuff
sprite->data[1] = 2; // movement action sets state to 0
return TRUE;
} else if (!objectEvent->singleMovementActive) { // walk in place
if (!objectEvent->singleMovementActive) { // walk in place
ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkInPlaceNormalMovementAction(objectEvent->facingDirection));
sprite->data[1] = 1;
objectEvent->singleMovementActive = 1;

View file

@ -84,11 +84,9 @@ static void LoadObjectReflectionPalette(struct ObjectEvent *objectEvent, struct
// Apply a blue tint effect to a palette
static void ApplyReflectionFilter(u8 paletteNum, u16 *dest) {
u32 *debugPtr = (u32*) 0x0203d600;
u8 i, val, r, g, b;
// CpuCopy16(gPlttBufferUnfaded + 0x100 + paletteNum * 16, dest, 32);
u16 *src = gPlttBufferUnfaded + 0x100 + paletteNum * 16;
*(debugPtr + 2) = (u32) (gPlttBufferUnfaded + 0x100 + paletteNum * 16);
for (i = 0; i < 16; i++) {
r = src[i] & 0x1F;
g = (src[i] >> 5) & 0x1F;