Skip to content

Commit

Permalink
last fixes before revert
Browse files Browse the repository at this point in the history
  • Loading branch information
kasenbackup committed Aug 4, 2024
1 parent 12fb01a commit cd5ace2
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 91 deletions.
44 changes: 1 addition & 43 deletions data/layouts/TestRoom/map.bin
Original file line number Diff line number Diff line change
@@ -1,43 +1 @@
ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppprs1s1s1tpppppppppppppppppppppppppppppppppprsq0q0q0utpppppppppppppppppppppppppppppppprs{|�|}utpppppppppppppppppppppppppppppprs{�����}utpppppppppppppppppppppppppppprs{�������}utpppppppppppppppppppppppppprs{���������}utppppppppppppp22222222222222222222222222r@@@@@@@@@@@@@22222222222222222222222222z@@@@@@@@@@@@@22222222222222222222222222@@@@@@@@@@@@@@22222222222222222222222222@@@@@@@@@@@@@@
2
2
2
2
2
2
2
2
222222
2
2
2
2
2
2
2
2
2
2
2
2@@@@@@@@@@@@@@
2
2
2
2
2
2
2
2
222222
2
2
2
2
2
2
2
2
2
2
2
2@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@BBBBBBBBBBBBBBBBBBBBBBBBBB@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppprs1s1s1tpppppppppppppppppppppppppppppppppprsq0q0q0utpppppppppppppppppppppppppppppppprs{|�|}utpppppppppppppppppppppppppppppprs{�����}utpppppppppppppppppppppppppppprs{�������}utpppppppppppppppppppppppppprs{���������}utppppppppppppp222000000000p{�����������}r0000000000000000000000000x�������������z000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3 changes: 3 additions & 0 deletions data/maps/map_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@
"Route114_FossilManiacsHouse",
"Route114_FossilManiacsTunnel",
"Route114_LanettesHouse"
],
"gMapGroup_IndoorRoute115": [

],
"gMapGroup_IndoorRoute116": [
"Route116_TunnelersRestHouse"
Expand Down
30 changes: 12 additions & 18 deletions data/scripts/debug.inc
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,13 @@ Debug_EventScript_Script_4::
end

Debug_EventScript_Script_5::
lockall
applymovement OBJ_EVENT_ID_PLAYER, Walk1Right
delay 10
releaseall
bufferspeciesname STR_VAR_1, SPECIES_CLODSIRE
msgbox TestMsg
end

TestMsg:
.string "{STR_VAR_1}$"

Debug_EventScript_Script_6::
release
end
Expand Down Expand Up @@ -191,8 +192,6 @@ Debug_CheckSaveBlock::
msgbox Debug_SaveBlock1SizePart2, MSGBOX_DEFAULT
callnative CheckSaveBlock1Part3
msgbox Debug_SaveBlock1SizePart3, MSGBOX_DEFAULT
callnative CheckSaveBlock1Part4
msgbox Debug_SaveBlock1SizePart4, MSGBOX_DEFAULT
release
end

Expand All @@ -201,22 +200,17 @@ Debug_SaveBlock1Size::
.string "Free space: {STR_VAR_3}b.$"

Debug_SaveBlock1SizePart1::
.string "Pokedex size: {STR_VAR_1}b\n"
.string "Time size: {STR_VAR_2}b\l"
.string "PlayersApprentice size: {STR_VAR_3}b.$"
.string "WarpData size: {STR_VAR_1}b\n"
.string "Pokemon size: {STR_VAR_2}b\l"
.string "ItemSlot size: {STR_VAR_3}b.$"

Debug_SaveBlock1SizePart2::
.string "Apprentice size: {STR_VAR_1}b\n"
.string "BerryCrush size: {STR_VAR_2}b\l"
.string "PokemonJumpRecords size: {STR_VAR_3}b.$"
.string "Pokeblock size: {STR_VAR_1}b\n"
.string "ObjectEvent size: {STR_VAR_2}b\l"
.string "ObjectEventTemplate size: {STR_VAR_3}b.$"

Debug_SaveBlock1SizePart3::
.string "BerryPickingResults size: {STR_VAR_1}b\n"
.string "ItemSlot size: {STR_VAR_2}b\l"
.string "BattleFrontier size: {STR_VAR_3}b.$"

Debug_SaveBlock1SizePart4::
.string "Follower size: {STR_VAR_1}b.$"
.string "RegisteredItemSlot size: {STR_VAR_1}b.$"

Debug_SaveBlock2Size::
.string "SaveBlock2 size: {STR_VAR_1}b/{STR_VAR_2}b.\n"
Expand Down
3 changes: 0 additions & 3 deletions data/scripts/surf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ EventScript_UseSurf::
lockall
msgbox gText_WantToUseSurf, MSGBOX_YESNO
goto_if_eq VAR_RESULT, NO, EventScript_ReleaseUseSurf
msgbox gText_BetaSurfBlock, MSGBOX_DEFAULT
releaseall
end
msgbox gText_PlayerUsedSurf, MSGBOX_DEFAULT
dofieldeffect FLDEFF_USE_SURF
EventScript_ReleaseUseSurf::
Expand Down
2 changes: 1 addition & 1 deletion include/global.fieldmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ struct ObjectEvent
u32 fixedPriority:1;
u32 hideReflection:1;
u32 shiny:1; // OW mon shininess
u32 padding:3;
u32 padding:2;
/*0x04*/ u16 graphicsId; // 11 bits for species; high 5 bits for form
/*0x06*/ u8 movementType;
/*0x07*/ u8 trainerType;
Expand Down
2 changes: 2 additions & 0 deletions src/data/pokemon/level_up_learnsets/gen_7.h
Original file line number Diff line number Diff line change
Expand Up @@ -7113,6 +7113,8 @@ static const struct LevelUpMove sCombuskenLevelUpLearnset[] = {
static const struct LevelUpMove sBlazikenLevelUpLearnset[] = {
LEVEL_UP_MOVE( 0, MOVE_BLAZE_KICK),
LEVEL_UP_MOVE( 1, MOVE_BLAZE_KICK),
LEVEL_UP_MOVE( 1, MOVE_ROCK_CLIMB),
LEVEL_UP_MOVE( 1, MOVE_SURF),
LEVEL_UP_MOVE( 1, MOVE_DOUBLE_KICK),
LEVEL_UP_MOVE( 1, MOVE_FLARE_BLITZ),
LEVEL_UP_MOVE( 1, MOVE_FIRE_PUNCH),
Expand Down
30 changes: 8 additions & 22 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2162,42 +2162,28 @@ void CheckSaveBlock1Size(struct ScriptContext *ctx)

void CheckSaveBlock1Part1(struct ScriptContext *ctx)
{
u32 Sb1A = sizeof(struct Pokedex);
u32 Sb1B = sizeof(struct Time);
u32 Sb1C = sizeof(struct PlayersApprentice);
u32 Sb1A = sizeof(struct WarpData);
u32 Sb1B = sizeof(struct Pokemon);
u32 Sb1C = sizeof(struct ItemSlot);
ConvertIntToDecimalStringN(gStringVar1, Sb1A, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar2, Sb1B, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar3, Sb1C, STR_CONV_MODE_LEFT_ALIGN, 6);
}

void CheckSaveBlock1Part2(struct ScriptContext *ctx)
{
u32 Sb1A = sizeof(struct Apprentice);
u32 Sb1B = sizeof(struct BerryCrush);
u32 Sb1C = sizeof(struct PokemonJumpRecords);
u32 Sb1A = sizeof(struct Pokeblock);
u32 Sb1B = sizeof(struct ObjectEvent);
u32 Sb1C = sizeof(struct ObjectEventTemplate);
ConvertIntToDecimalStringN(gStringVar1, Sb1A, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar2, Sb1B, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar3, Sb1C, STR_CONV_MODE_LEFT_ALIGN, 6);
}

void CheckSaveBlock1Part3(struct ScriptContext *ctx)
{
u32 Sb1A = sizeof(struct BerryPickingResults);
u32 Sb1B = sizeof(struct ItemSlot);
u32 Sb1C = sizeof(struct BattleFrontier);
ConvertIntToDecimalStringN(gStringVar1, Sb1A, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar2, Sb1B, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar3, Sb1C, STR_CONV_MODE_LEFT_ALIGN, 6);
}

void CheckSaveBlock1Part4(struct ScriptContext *ctx)
{
u32 Sb1A = sizeof(struct Follower);
// u32 Sb1B = sizeof(struct ItemSlot);
// u32 Sb1C = sizeof(struct BattleFrontier);
ConvertIntToDecimalStringN(gStringVar1, Sb1A, STR_CONV_MODE_LEFT_ALIGN, 6);
// ConvertIntToDecimalStringN(gStringVar2, Sb1B, STR_CONV_MODE_LEFT_ALIGN, 6);
// ConvertIntToDecimalStringN(gStringVar3, Sb1C, STR_CONV_MODE_LEFT_ALIGN, 6);
u32 Sb1D = sizeof(struct RegisteredItemSlot);
ConvertIntToDecimalStringN(gStringVar1, Sb1D, STR_CONV_MODE_LEFT_ALIGN, 6);
}

void CheckSaveBlock2Size(struct ScriptContext *ctx)
Expand Down
4 changes: 3 additions & 1 deletion src/event_object_movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ static u16 GetObjectEventFlagIdByObjectEventId(u8);
static void UpdateObjectEventVisibility(struct ObjectEvent *, struct Sprite *);
static void MakeSpriteTemplateFromObjectEventTemplate(const struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
static void GetObjectEventMovingCameraOffset(s16 *, s16 *);
// static const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
static void RemoveObjectEventIfOutsideView(struct ObjectEvent *);
static void SpawnObjectEventOnReturnToField(u8, s16, s16);
static void SetPlayerAvatarObjectEventIdAndObjectId(u8, u8);
Expand Down Expand Up @@ -2180,7 +2181,8 @@ void UpdateFollowingPokemon(void)
|| SpeciesToGraphicsInfo(species, form) == NULL
|| (gMapHeader.mapType == MAP_TYPE_INDOOR && SpeciesToGraphicsInfo(species, form)->oam->size > ST_OAM_SIZE_2)
|| FlagGet(FLAG_TEMP_HIDE_FOLLOWER)
|| FlagGet(FLAG_DISABLE_FOLLOWER))
|| FlagGet(FLAG_DISABLE_FOLLOWER)
|| FlagGet(FLAG_PARTNER_HEALS))
{
RemoveFollowingPokemon();
return;
Expand Down
39 changes: 37 additions & 2 deletions src/follow_me.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static void Task_FollowerHandleEscalatorFinish(u8 taskId);
static void CalculateFollowerEscalatorTrajectoryUp(struct Task *task);
static void CalculateFollowerEscalatorTrajectoryDown(struct Task *task);
static void TurnNPCIntoFollower(u8 localId, u16 followerFlags);
static void RemoveObjectEventInternal2(struct ObjectEvent *);

// Const Data
static const struct FollowerSpriteGraphics gFollowerAlternateSprites[] =
Expand Down Expand Up @@ -1127,6 +1128,40 @@ void FollowMe_HandleSprite(void)
}
}

void RemoveObjectEvent2(struct ObjectEvent *objectEvent)
{
objectEvent->active = FALSE;
RemoveObjectEventInternal2(objectEvent);
// zero potential species info
objectEvent->graphicsId = objectEvent->shiny = 0;
}

static void RemoveObjectEventInternal2(struct ObjectEvent *objectEvent)
{
struct SpriteFrameImage image;
image.size = GetObjectEventGraphicsInfo(objectEvent->graphicsId)->size;
gSprites[objectEvent->spriteId].images = ℑ
// It's possible that this function is called while the sprite pointed to `== sDummySprite`, i.e during map resume;
// In this case, don't free the palette as `paletteNum` is likely blank dummy data
if (!gSprites[objectEvent->spriteId].inUse &&
!gSprites[objectEvent->spriteId].oam.paletteNum &&
gSprites[objectEvent->spriteId].callback == SpriteCallbackDummy)
{
DestroySprite(&gSprites[objectEvent->spriteId]);
}
else
{
u32 paletteNum = gSprites[objectEvent->spriteId].oam.paletteNum;
u16 tileStart;
if (OW_GFX_COMPRESS)
tileStart = gSprites[objectEvent->spriteId].sheetTileStart;
DestroySprite(&gSprites[objectEvent->spriteId]);
FieldEffectFreePaletteIfUnused(paletteNum);
if (OW_GFX_COMPRESS && tileStart)
FieldEffectFreeTilesIfUnused(tileStart);
}
}

void SetFollowerSprite(u8 spriteIndex)
{
u8 oldSpriteId;
Expand Down Expand Up @@ -1156,7 +1191,7 @@ void SetFollowerSprite(u8 spriteIndex)
backupFollower.graphicsId = newGraphicsId;
//backupFollower.graphicsIdUpperByte = newGraphicsId >> 8;
DestroySprite(&gSprites[oldSpriteId]);
RemoveObjectEvent(&gObjectEvents[GetFollowerMapObjId()]);
RemoveObjectEvent2(&gObjectEvents[GetFollowerMapObjId()]);

clone = *GetObjectEventTemplateByLocalIdAndMap(gSaveBlock2Ptr->follower.map.id, gSaveBlock2Ptr->follower.map.number, gSaveBlock2Ptr->follower.map.group);
clone.graphicsId = newGraphicsId;
Expand Down Expand Up @@ -1413,7 +1448,7 @@ void DestroyFollower(void)
{
if (gSaveBlock2Ptr->follower.inProgress)
{
RemoveObjectEvent(&gObjectEvents[gSaveBlock2Ptr->follower.objId]);
RemoveObjectEvent2(&gObjectEvents[gSaveBlock2Ptr->follower.objId]);
FlagSet(gSaveBlock2Ptr->follower.flag);
gSaveBlock2Ptr->follower.inProgress = FALSE;
}
Expand Down
2 changes: 1 addition & 1 deletion src/scrcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ bool8 ScrCmd_vmessage(struct ScriptContext *ctx)
bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx)
{
u8 stringVarIndex = ScriptReadByte(ctx);
u16 species = VarGet(ScriptReadHalfword(ctx)) & ((1 << 10) - 1); // ignore possible shiny / form bits
u16 species = VarGet(ScriptReadHalfword(ctx));

StringCopy(sScriptStringVars[stringVarIndex], GetSpeciesName(species));
return FALSE;
Expand Down

0 comments on commit cd5ace2

Please sign in to comment.