Decompile/port event_object_movement

This commit is contained in:
ultima-soul
2020-03-12 12:46:40 -07:00
parent 65690ca7dc
commit 339c2914af
46 changed files with 8790 additions and 23331 deletions
+3 -3
View File
@@ -51,7 +51,7 @@ void sub_80695CC(u8 taskId)
task->data[0] = 1;
}
if (task->data[1] == 0 && !gObjectEvents[gSelectedObjectEvent].mapobj_bit_1)
if (task->data[1] == 0 && !gObjectEvents[gSelectedObjectEvent].singleMovementActive)
{
FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]);
task->data[1] = 1;
@@ -78,7 +78,7 @@ void LockSelectedObjectEvent(void)
FreezeObjectEventsExceptOne(gSelectedObjectEvent);
taskId = CreateTask(sub_80695CC, 80);
if (!gObjectEvents[gSelectedObjectEvent].mapobj_bit_1)
if (!gObjectEvents[gSelectedObjectEvent].singleMovementActive)
{
FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]);
gTasks[taskId].data[1] = 1;
@@ -111,5 +111,5 @@ void Script_FacePlayer(void)
void Script_ClearHeldMovement(void)
{
ObjectEventClearAnimIfSpecialAnimActive(&gObjectEvents[gSelectedObjectEvent]);
ObjectEventClearHeldMovementIfActive(&gObjectEvents[gSelectedObjectEvent]);
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1004,7 +1004,7 @@ static void FCSetup_ResetTasksAndSpriteResources(void)
ResetSpriteData();
ResetAllPicSprites();
ResetPaletteFade();
npc_paltag_set_load(0);
InitObjectEventPalettes(0);
gReservedSpritePaletteCount = 7;
}
+6 -6
View File
@@ -415,7 +415,7 @@ static void task_map_chg_seq_0807E20C(u8 taskId)
if (sub_807E418())
{
sub_807DCB0(TRUE);
ObjectEventSetHeldMovement(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)], sub_8063F84(GetPlayerFacingDirection()));
ObjectEventSetHeldMovement(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)], GetWalkNormalMovementAction(GetPlayerFacingDirection()));
task->data[0] = 2;
}
break;
@@ -752,7 +752,7 @@ static void sub_807E80C(u8 taskId)
case 1:
if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE)
{
ObjectEventClearAnimIfSpecialAnimActive(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)]);
ObjectEventClearHeldMovementIfActive(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)]);
ObjectEventSetHeldMovement(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)], 17);
task->data[0] = 2;
}
@@ -850,15 +850,15 @@ static void sub_807EAC4(s16 a0, s16 a1, s16 *a2, s16 *a3, s16 *a4)
(*a4)++;
playerSpr->pos2.x = *a2 >> 5;
playerSpr->pos2.y = *a3 >> 5;
if (playerObj->mapobj_bit_7)
if (playerObj->heldMovementFinished)
{
ObjectEventForceSetSpecialAnim(playerObj, GetStepInPlaceDelay16AnimId(GetPlayerFacingDirection()));
ObjectEventForceSetHeldMovement(playerObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
}
}
static void sub_807EB64(u16 a0, s16 *a1, s16 *a2)
{
ObjectEventForceSetSpecialAnim(&gObjectEvents[gPlayerAvatar.objectEventId], GetStepInPlaceDelay16AnimId(GetPlayerFacingDirection()));
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
sub_807EBBC(a0, a1, a2);
}
@@ -930,7 +930,7 @@ static void sub_807ECBC(s16 *a0, s16 *a1, s16 *a2, s16 *a3, s16 *a4)
r1 = 3;
else
r1 = 4;
ObjectEventForceSetSpecialAnim(&gObjectEvents[gPlayerAvatar.objectEventId], sub_8064270(r1));
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceSlowMovementAction(r1));
sub_807EBBC(behavior, a0, a1);
*a2 = *a0 * 16;
*a3 = *a1 * 16;
+1 -1
View File
@@ -316,7 +316,7 @@ void Special_AnimatePcTurnOff()
void SpawnCameraObject(void)
{
u8 objectEventId = SpawnSpecialObjectEventParameterized(OBJECT_EVENT_GFX_YOUNGSTER, 8, 127, gSaveBlock1Ptr->pos.x + 7, gSaveBlock1Ptr->pos.y + 7, 3);
gObjectEvents[objectEventId].mapobj_bit_13 = TRUE;
gObjectEvents[objectEventId].invisible = TRUE;
CameraObjectSetFollowedObjectId(gObjectEvents[objectEventId].spriteId);
}
+50 -48
View File
@@ -8,6 +8,8 @@
#include "quest_log.h"
#include "fieldmap.h"
#define VMap gBackupMapLayout // Needed for AGB_ASSERT_EX to match
struct ConnectionFlags
{
u8 south:1;
@@ -28,8 +30,8 @@ struct MapConnection *sub_8059600(u8 direction, s32 x, s32 y);
bool8 sub_8059658(u8 direction, s32 x, s32 y, struct MapConnection *connection);
bool8 sub_80596BC(s32 x, s32 src_width, s32 dest_width, s32 offset);
struct BackupMapLayout VMap;
EWRAM_DATA u16 gBackupMapLayout[VIRTUAL_MAP_SIZE] = {};
struct BackupMapLayout gBackupMapLayout;
EWRAM_DATA u16 gBackupMapData[VIRTUAL_MAP_SIZE] = {};
EWRAM_DATA struct MapHeader gMapHeader = {};
EWRAM_DATA struct Camera gCamera = {};
EWRAM_DATA struct ConnectionFlags gMapConnectionFlags = {};
@@ -79,10 +81,10 @@ void sub_80589E8(void)
void sub_8058A00(struct MapHeader * mapHeader)
{
const struct MapLayout * mapLayout = mapHeader->mapLayout;
CpuFastFill(0x03FF03FF, gBackupMapLayout, sizeof(gBackupMapLayout));
VMap.map = gBackupMapLayout;
VMap.Xsize = mapLayout->width + 15;
VMap.Ysize = mapLayout->height + 14;
CpuFastFill(0x03FF03FF, gBackupMapData, sizeof(gBackupMapData));
gBackupMapLayout.map = gBackupMapData;
gBackupMapLayout.Xsize = mapLayout->width + 15;
gBackupMapLayout.Ysize = mapLayout->height + 14;
AGB_ASSERT_EX(VMap.Xsize * VMap.Ysize <= VIRTUAL_MAP_SIZE, ABSPATH("fieldmap.c"), 158);
map_copy_with_padding(mapLayout->map, mapLayout->width, mapLayout->height);
mapheader_copy_mapdata_of_adjacent_maps(mapHeader);
@@ -91,8 +93,8 @@ void sub_8058A00(struct MapHeader * mapHeader)
void map_copy_with_padding(u16 *map, u16 width, u16 height)
{
s32 y;
u16 *dest = VMap.map;
dest += VMap.Xsize * 7 + 7;
u16 *dest = gBackupMapLayout.map;
dest += gBackupMapLayout.Xsize * 7 + 7;
for (y = 0; y < height; y++)
{
@@ -157,12 +159,12 @@ void sub_8058B54(s32 x, s32 y, const struct MapHeader *connectedMapHeader, s32 x
mapWidth = connectedMapHeader->mapLayout->width;
src = &connectedMapHeader->mapLayout->map[mapWidth * y2 + x2];
dest = &VMap.map[VMap.Xsize * y + x];
dest = &gBackupMapLayout.map[gBackupMapLayout.Xsize * y + x];
for (i = 0; i < height; i++)
{
CpuCopy16(src, dest, width * 2);
dest += VMap.Xsize;
dest += gBackupMapLayout.Xsize;
src += mapWidth;
}
}
@@ -183,26 +185,26 @@ void fillSouthConnection(struct MapHeader const *mapHeader, struct MapHeader con
{
x2 = -x;
x += cWidth;
if (x < VMap.Xsize)
if (x < gBackupMapLayout.Xsize)
{
width = x;
}
else
{
width = VMap.Xsize;
width = gBackupMapLayout.Xsize;
}
x = 0;
}
else
{
x2 = 0;
if (x + cWidth < VMap.Xsize)
if (x + cWidth < gBackupMapLayout.Xsize)
{
width = cWidth;
}
else
{
width = VMap.Xsize - x;
width = gBackupMapLayout.Xsize - x;
}
}
@@ -231,26 +233,26 @@ void fillNorthConnection(struct MapHeader const *mapHeader, struct MapHeader con
{
x2 = -x;
x += cWidth;
if (x < VMap.Xsize)
if (x < gBackupMapLayout.Xsize)
{
width = x;
}
else
{
width = VMap.Xsize;
width = gBackupMapLayout.Xsize;
}
x = 0;
}
else
{
x2 = 0;
if (x + cWidth < VMap.Xsize)
if (x + cWidth < gBackupMapLayout.Xsize)
{
width = cWidth;
}
else
{
width = VMap.Xsize - x;
width = gBackupMapLayout.Xsize - x;
}
}
@@ -278,26 +280,26 @@ void fillWestConnection(struct MapHeader const *mapHeader, struct MapHeader cons
if (y < 0)
{
y2 = -y;
if (y + cHeight < VMap.Ysize)
if (y + cHeight < gBackupMapLayout.Ysize)
{
height = y + cHeight;
}
else
{
height = VMap.Ysize;
height = gBackupMapLayout.Ysize;
}
y = 0;
}
else
{
y2 = 0;
if (y + cHeight < VMap.Ysize)
if (y + cHeight < gBackupMapLayout.Ysize)
{
height = cHeight;
}
else
{
height = VMap.Ysize - y;
height = gBackupMapLayout.Ysize - y;
}
}
@@ -323,26 +325,26 @@ void fillEastConnection(struct MapHeader const *mapHeader, struct MapHeader cons
if (y < 0)
{
y2 = -y;
if (y + cHeight < VMap.Ysize)
if (y + cHeight < gBackupMapLayout.Ysize)
{
height = y + cHeight;
}
else
{
height = VMap.Ysize;
height = gBackupMapLayout.Ysize;
}
y = 0;
}
else
{
y2 = 0;
if (y + cHeight < VMap.Ysize)
if (y + cHeight < gBackupMapLayout.Ysize)
{
height = cHeight;
}
else
{
height = VMap.Ysize - y;
height = gBackupMapLayout.Ysize - y;
}
}
@@ -404,9 +406,9 @@ union Block
block; \
})
#define AreCoordsWithinMapGridBounds(x, y) (x >= 0 && x < VMap.Xsize && y >= 0 && y < VMap.Ysize)
#define AreCoordsWithinMapGridBounds(x, y) (x >= 0 && x < gBackupMapLayout.Xsize && y >= 0 && y < gBackupMapLayout.Ysize)
#define MapGridGetTileAt(x, y) (AreCoordsWithinMapGridBounds(x, y) ? VMap.map[x + VMap.Xsize * y] : MapGridGetBorderTileAt2(x, y))
#define MapGridGetTileAt(x, y) (AreCoordsWithinMapGridBounds(x, y) ? gBackupMapLayout.map[x + gBackupMapLayout.Xsize * y] : MapGridGetBorderTileAt2(x, y))
u8 MapGridGetZCoordAt(s32 x, s32 y)
{
@@ -471,37 +473,37 @@ u8 MapGridGetMetatileLayerTypeAt(s16 x, s16 y)
void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatile)
{
s32 i;
if (x >= 0 && x < VMap.Xsize
&& y >= 0 && y < VMap.Ysize)
if (x >= 0 && x < gBackupMapLayout.Xsize
&& y >= 0 && y < gBackupMapLayout.Ysize)
{
i = x + y * VMap.Xsize;
VMap.map[i] = (VMap.map[i] & 0xf000) | (metatile & 0xfff);
i = x + y * gBackupMapLayout.Xsize;
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & 0xf000) | (metatile & 0xfff);
}
}
void MapGridSetMetatileEntryAt(s32 x, s32 y, u16 metatile)
{
s32 i;
if (x >= 0 && x < VMap.Xsize
&& y >= 0 && y < VMap.Ysize)
if (x >= 0 && x < gBackupMapLayout.Xsize
&& y >= 0 && y < gBackupMapLayout.Ysize)
{
i = x + VMap.Xsize * y;
VMap.map[i] = metatile;
i = x + gBackupMapLayout.Xsize * y;
gBackupMapLayout.map[i] = metatile;
}
}
void sub_8059024(s32 x, s32 y, bool32 arg2)
{
if (x >= 0 && x < VMap.Xsize
&& y >= 0 && y < VMap.Ysize)
if (x >= 0 && x < gBackupMapLayout.Xsize
&& y >= 0 && y < gBackupMapLayout.Ysize)
{
if (arg2)
{
VMap.map[x + VMap.Xsize * y] |= 0x0C00;
gBackupMapLayout.map[x + gBackupMapLayout.Xsize * y] |= 0x0C00;
}
else
{
VMap.map[x + VMap.Xsize * y] &= ~0x0C00;
gBackupMapLayout.map[x + gBackupMapLayout.Xsize * y] &= ~0x0C00;
}
}
}
@@ -533,14 +535,14 @@ void save_serialize_map(void)
u16 *mapView;
s32 width;
mapView = gSaveBlock2Ptr->mapView;
width = VMap.Xsize;
width = gBackupMapLayout.Xsize;
x = gSaveBlock1Ptr->pos.x;
y = gSaveBlock1Ptr->pos.y;
for (i = y; i < y + 14; i++)
{
for (j = x; j < x + 15; j++)
{
*mapView++ = gBackupMapLayout[width * i + j];
*mapView++ = gBackupMapData[width * i + j];
}
}
}
@@ -574,14 +576,14 @@ void LoadSavedMapView(void)
mapView = gSaveBlock2Ptr->mapView;
if (!SavedMapViewIsEmpty())
{
width = VMap.Xsize;
width = gBackupMapLayout.Xsize;
x = gSaveBlock1Ptr->pos.x;
y = gSaveBlock1Ptr->pos.y;
for (i = y; i < y + 14; i++)
{
for (j = x; j < x + 15; j++)
{
gBackupMapLayout[j + width * i] = *mapView;
gBackupMapData[j + width * i] = *mapView;
mapView++;
}
}
@@ -601,7 +603,7 @@ void sub_8059250(u8 a1)
s32 x, y;
s32 i, j;
mapView = gSaveBlock2Ptr->mapView;
width = VMap.Xsize;
width = gBackupMapLayout.Xsize;
r9 = 0;
r8 = 0;
x0 = gSaveBlock1Ptr->pos.x;
@@ -636,7 +638,7 @@ void sub_8059250(u8 a1)
desti = width * (y + y0);
srci = (y + r8) * 15 + r9;
src = &mapView[srci + i];
dest = &gBackupMapLayout[x0 + desti + j];
dest = &gBackupMapData[x0 + desti + j];
*dest = *src;
i++;
j++;
@@ -652,7 +654,7 @@ s32 GetMapBorderIdAt(s32 x, s32 y)
return -1;
}
if (x >= VMap.Xsize - 8)
if (x >= gBackupMapLayout.Xsize - 8)
{
if (!gMapConnectionFlags.east)
{
@@ -670,7 +672,7 @@ s32 GetMapBorderIdAt(s32 x, s32 y)
return CONNECTION_WEST;
}
if (y >= VMap.Ysize - 7)
if (y >= gBackupMapLayout.Ysize - 7)
{
if (!gMapConnectionFlags.south)
{
+1 -1
View File
@@ -88,7 +88,7 @@ bool8 MetatileBehavior_IsJumpSouth(u8 metatileBehavior)
return FALSE;
}
bool8 MetatileBehavior_IsTallGrass(u8 metatileBehavior)
bool8 MetatileBehavior_IsPokeGrass(u8 metatileBehavior)
{
if(metatileBehavior == MB_TALL_GRASS || metatileBehavior == MB_CYCLING_ROAD_PULL_DOWN_GRASS)
return TRUE;
+67 -67
View File
@@ -14,37 +14,37 @@ void SetQuestLogObjectEventsData(struct QuestLog * questLog)
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
{
questLog->unk_008[i].active = gObjectEvents[i].active;
questLog->unk_008[i].mapobj_bit_3 = gObjectEvents[i].mapobj_bit_3;
questLog->unk_008[i].mapobj_bit_4 = gObjectEvents[i].mapobj_bit_4;
questLog->unk_008[i].mapobj_bit_5 = gObjectEvents[i].mapobj_bit_5;
questLog->unk_008[i].mapobj_bit_8 = gObjectEvents[i].mapobj_bit_8;
questLog->unk_008[i].mapobj_bit_9 = gObjectEvents[i].mapobj_bit_9;
questLog->unk_008[i].mapobj_bit_10 = gObjectEvents[i].mapobj_bit_10;
questLog->unk_008[i].mapobj_bit_11 = gObjectEvents[i].mapobj_bit_11;
questLog->unk_008[i].mapobj_bit_12 = gObjectEvents[i].mapobj_bit_12;
questLog->unk_008[i].mapobj_bit_13 = gObjectEvents[i].mapobj_bit_13;
questLog->unk_008[i].mapobj_bit_14 = gObjectEvents[i].mapobj_bit_14;
questLog->unk_008[i].mapobj_bit_15 = gObjectEvents[i].mapobj_bit_15;
questLog->unk_008[i].mapobj_bit_16 = gObjectEvents[i].mapobj_bit_16;
questLog->unk_008[i].mapobj_bit_23 = gObjectEvents[i].mapobj_bit_23;
questLog->unk_008[i].mapobj_bit_24 = gObjectEvents[i].mapobj_bit_24;
questLog->unk_008[i].mapobj_bit_25 = gObjectEvents[i].mapobj_bit_25;
questLog->unk_008[i].mapobj_bit_26 = gObjectEvents[i].mapobj_bit_26;
questLog->unk_008[i].mapobj_bit_3 = gObjectEvents[i].triggerGroundEffectsOnStop;
questLog->unk_008[i].mapobj_bit_4 = gObjectEvents[i].disableCoveringGroundEffects;
questLog->unk_008[i].mapobj_bit_5 = gObjectEvents[i].landingJump;
questLog->unk_008[i].mapobj_bit_8 = gObjectEvents[i].frozen;
questLog->unk_008[i].mapobj_bit_9 = gObjectEvents[i].facingDirectionLocked;
questLog->unk_008[i].mapobj_bit_10 = gObjectEvents[i].disableAnim;
questLog->unk_008[i].mapobj_bit_11 = gObjectEvents[i].enableAnim;
questLog->unk_008[i].mapobj_bit_12 = gObjectEvents[i].inanimate;
questLog->unk_008[i].mapobj_bit_13 = gObjectEvents[i].invisible;
questLog->unk_008[i].mapobj_bit_14 = gObjectEvents[i].offScreen;
questLog->unk_008[i].mapobj_bit_15 = gObjectEvents[i].trackedByCamera;
questLog->unk_008[i].mapobj_bit_16 = gObjectEvents[i].isPlayer;
questLog->unk_008[i].mapobj_bit_23 = gObjectEvents[i].spriteAnimPausedBackup;
questLog->unk_008[i].mapobj_bit_24 = gObjectEvents[i].spriteAffineAnimPausedBackup;
questLog->unk_008[i].mapobj_bit_25 = gObjectEvents[i].disableJumpLandingGroundEffect;
questLog->unk_008[i].mapobj_bit_26 = gObjectEvents[i].fixedPriority;
questLog->unk_008[i].mapobj_unk_18 = gObjectEvents[i].facingDirection;
questLog->unk_008[i].mapobj_unk_0B_0 = gObjectEvents[i].mapobj_unk_0B_0;
questLog->unk_008[i].elevation = gObjectEvents[i].elevation;
questLog->unk_008[i].mapobj_unk_0B_0 = gObjectEvents[i].currentElevation;
questLog->unk_008[i].elevation = gObjectEvents[i].previousElevation;
questLog->unk_008[i].graphicsId = gObjectEvents[i].graphicsId;
questLog->unk_008[i].animPattern = gObjectEvents[i].animPattern;
questLog->unk_008[i].animPattern = gObjectEvents[i].movementType;
questLog->unk_008[i].trainerType = gObjectEvents[i].trainerType;
questLog->unk_008[i].localId = gObjectEvents[i].localId;
questLog->unk_008[i].mapNum = gObjectEvents[i].mapNum;
questLog->unk_008[i].mapGroup = gObjectEvents[i].mapGroup;
questLog->unk_008[i].x = gObjectEvents[i].coords2.x;
questLog->unk_008[i].y = gObjectEvents[i].coords2.y;
questLog->unk_008[i].x = gObjectEvents[i].currentCoords.x;
questLog->unk_008[i].y = gObjectEvents[i].currentCoords.y;
questLog->unk_008[i].trainerRange_berryTreeId = gObjectEvents[i].trainerRange_berryTreeId;
questLog->unk_008[i].mapobj_unk_1F = gObjectEvents[i].mapobj_unk_1F;
questLog->unk_008[i].mapobj_unk_21 = gObjectEvents[i].mapobj_unk_21;
questLog->unk_008[i].animId = gObjectEvents[i].animId;
questLog->unk_008[i].mapobj_unk_1F = gObjectEvents[i].previousMetatileBehavior;
questLog->unk_008[i].mapobj_unk_21 = gObjectEvents[i].directionSequenceIndex;
questLog->unk_008[i].animId = gObjectEvents[i].playerCopyableMovement;
}
}
@@ -58,74 +58,74 @@ void sub_815A1F8(const struct QuestLog * questLog, const struct ObjectEventTempl
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
{
gObjectEvents[i].active = questLogObjectEvents[i].active;
gObjectEvents[i].mapobj_bit_3 = questLogObjectEvents[i].mapobj_bit_3;
gObjectEvents[i].mapobj_bit_4 = questLogObjectEvents[i].mapobj_bit_4;
gObjectEvents[i].mapobj_bit_5 = questLogObjectEvents[i].mapobj_bit_5;
gObjectEvents[i].mapobj_bit_8 = questLogObjectEvents[i].mapobj_bit_8;
gObjectEvents[i].mapobj_bit_9 = questLogObjectEvents[i].mapobj_bit_9;
gObjectEvents[i].mapobj_bit_10 = questLogObjectEvents[i].mapobj_bit_10;
gObjectEvents[i].mapobj_bit_11 = questLogObjectEvents[i].mapobj_bit_11;
gObjectEvents[i].mapobj_bit_12 = questLogObjectEvents[i].mapobj_bit_12;
gObjectEvents[i].mapobj_bit_13 = questLogObjectEvents[i].mapobj_bit_13;
gObjectEvents[i].mapobj_bit_14 = questLogObjectEvents[i].mapobj_bit_14;
gObjectEvents[i].mapobj_bit_15 = questLogObjectEvents[i].mapobj_bit_15;
gObjectEvents[i].mapobj_bit_16 = questLogObjectEvents[i].mapobj_bit_16;
gObjectEvents[i].mapobj_bit_23 = questLogObjectEvents[i].mapobj_bit_23;
gObjectEvents[i].mapobj_bit_24 = questLogObjectEvents[i].mapobj_bit_24;
gObjectEvents[i].mapobj_bit_25 = questLogObjectEvents[i].mapobj_bit_25;
gObjectEvents[i].mapobj_bit_26 = questLogObjectEvents[i].mapobj_bit_26;
gObjectEvents[i].triggerGroundEffectsOnStop = questLogObjectEvents[i].mapobj_bit_3;
gObjectEvents[i].disableCoveringGroundEffects = questLogObjectEvents[i].mapobj_bit_4;
gObjectEvents[i].landingJump = questLogObjectEvents[i].mapobj_bit_5;
gObjectEvents[i].frozen = questLogObjectEvents[i].mapobj_bit_8;
gObjectEvents[i].facingDirectionLocked = questLogObjectEvents[i].mapobj_bit_9;
gObjectEvents[i].disableAnim = questLogObjectEvents[i].mapobj_bit_10;
gObjectEvents[i].enableAnim = questLogObjectEvents[i].mapobj_bit_11;
gObjectEvents[i].inanimate = questLogObjectEvents[i].mapobj_bit_12;
gObjectEvents[i].invisible = questLogObjectEvents[i].mapobj_bit_13;
gObjectEvents[i].offScreen = questLogObjectEvents[i].mapobj_bit_14;
gObjectEvents[i].trackedByCamera = questLogObjectEvents[i].mapobj_bit_15;
gObjectEvents[i].isPlayer = questLogObjectEvents[i].mapobj_bit_16;
gObjectEvents[i].spriteAnimPausedBackup = questLogObjectEvents[i].mapobj_bit_23;
gObjectEvents[i].spriteAffineAnimPausedBackup = questLogObjectEvents[i].mapobj_bit_24;
gObjectEvents[i].disableJumpLandingGroundEffect = questLogObjectEvents[i].mapobj_bit_25;
gObjectEvents[i].fixedPriority = questLogObjectEvents[i].mapobj_bit_26;
gObjectEvents[i].facingDirection = questLogObjectEvents[i].mapobj_unk_18;
gObjectEvents[i].mapobj_unk_0B_0 = questLogObjectEvents[i].mapobj_unk_0B_0;
gObjectEvents[i].elevation = questLogObjectEvents[i].elevation;
gObjectEvents[i].currentElevation = questLogObjectEvents[i].mapobj_unk_0B_0;
gObjectEvents[i].previousElevation = questLogObjectEvents[i].elevation;
gObjectEvents[i].graphicsId = questLogObjectEvents[i].graphicsId;
gObjectEvents[i].animPattern = questLogObjectEvents[i].animPattern;
gObjectEvents[i].movementType = questLogObjectEvents[i].animPattern;
gObjectEvents[i].trainerType = questLogObjectEvents[i].trainerType;
gObjectEvents[i].localId = questLogObjectEvents[i].localId;
gObjectEvents[i].mapNum = questLogObjectEvents[i].mapNum;
gObjectEvents[i].mapGroup = questLogObjectEvents[i].mapGroup;
gObjectEvents[i].coords2.x = questLogObjectEvents[i].x;
gObjectEvents[i].coords2.y = questLogObjectEvents[i].y;
gObjectEvents[i].currentCoords.x = questLogObjectEvents[i].x;
gObjectEvents[i].currentCoords.y = questLogObjectEvents[i].y;
gObjectEvents[i].trainerRange_berryTreeId = questLogObjectEvents[i].trainerRange_berryTreeId;
gObjectEvents[i].mapobj_unk_1F = questLogObjectEvents[i].mapobj_unk_1F;
gObjectEvents[i].mapobj_unk_21 = questLogObjectEvents[i].mapobj_unk_21;
gObjectEvents[i].animId = questLogObjectEvents[i].animId;
gObjectEvents[i].previousMetatileBehavior = questLogObjectEvents[i].mapobj_unk_1F;
gObjectEvents[i].directionSequenceIndex = questLogObjectEvents[i].mapobj_unk_21;
gObjectEvents[i].playerCopyableMovement = questLogObjectEvents[i].animId;
for (j = 0; j < 0x40; j++)
{
if (gObjectEvents[i].localId == templates[j].localId)
{
gObjectEvents[i].coords1.x = templates[j].x + 7;
gObjectEvents[i].coords1.y = templates[j].y + 7;
gObjectEvents[i].initialCoords.x = templates[j].x + 7;
gObjectEvents[i].initialCoords.y = templates[j].y + 7;
gObjectEvents[i].range.as_nybbles.x = templates[j].movementRangeX;
gObjectEvents[i].range.as_nybbles.y = templates[j].movementRangeY;
}
}
gObjectEvents[i].mapobj_unk_1E = MapGridGetMetatileBehaviorAt(gObjectEvents[i].coords2.x, gObjectEvents[i].coords2.y);
if (gObjectEvents[i].mapobj_unk_1F == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].coords2.x), (s16)(gObjectEvents[i].coords2.y)))
gObjectEvents[i].currentMetatileBehavior = MapGridGetMetatileBehaviorAt(gObjectEvents[i].currentCoords.x, gObjectEvents[i].currentCoords.y);
if (gObjectEvents[i].previousMetatileBehavior == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].currentCoords.x), (s16)(gObjectEvents[i].currentCoords.y)))
{
gObjectEvents[i].coords3.x = gObjectEvents[i].coords2.x;
gObjectEvents[i].coords3.y = gObjectEvents[i].coords2.y;
gObjectEvents[i].previousCoords.x = gObjectEvents[i].currentCoords.x;
gObjectEvents[i].previousCoords.y = gObjectEvents[i].currentCoords.y;
}
else if (gObjectEvents[i].mapobj_unk_1F == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].coords2.x - 1), (s16)(gObjectEvents[i].coords2.y)))
else if (gObjectEvents[i].previousMetatileBehavior == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].currentCoords.x - 1), (s16)(gObjectEvents[i].currentCoords.y)))
{
gObjectEvents[i].coords3.x = gObjectEvents[i].coords2.x - 1;
gObjectEvents[i].coords3.y = gObjectEvents[i].coords2.y;
gObjectEvents[i].previousCoords.x = gObjectEvents[i].currentCoords.x - 1;
gObjectEvents[i].previousCoords.y = gObjectEvents[i].currentCoords.y;
}
else if (gObjectEvents[i].mapobj_unk_1F == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].coords2.x + 1), (s16)(gObjectEvents[i].coords2.y)))
else if (gObjectEvents[i].previousMetatileBehavior == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].currentCoords.x + 1), (s16)(gObjectEvents[i].currentCoords.y)))
{
gObjectEvents[i].coords3.x = gObjectEvents[i].coords2.x + 1;
gObjectEvents[i].coords3.y = gObjectEvents[i].coords2.y;
gObjectEvents[i].previousCoords.x = gObjectEvents[i].currentCoords.x + 1;
gObjectEvents[i].previousCoords.y = gObjectEvents[i].currentCoords.y;
}
else if (gObjectEvents[i].mapobj_unk_1F == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].coords2.x), (s16)(gObjectEvents[i].coords2.y - 1)))
else if (gObjectEvents[i].previousMetatileBehavior == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].currentCoords.x), (s16)(gObjectEvents[i].currentCoords.y - 1)))
{
gObjectEvents[i].coords3.x = gObjectEvents[i].coords2.x;
gObjectEvents[i].coords3.y = gObjectEvents[i].coords2.y - 1;
gObjectEvents[i].previousCoords.x = gObjectEvents[i].currentCoords.x;
gObjectEvents[i].previousCoords.y = gObjectEvents[i].currentCoords.y - 1;
}
else if (gObjectEvents[i].mapobj_unk_1F == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].coords2.x), (s16)(gObjectEvents[i].coords2.y + 1)))
else if (gObjectEvents[i].previousMetatileBehavior == MapGridGetMetatileBehaviorAt((s16)(gObjectEvents[i].currentCoords.x), (s16)(gObjectEvents[i].currentCoords.y + 1)))
{
gObjectEvents[i].coords3.x = gObjectEvents[i].coords2.x;
gObjectEvents[i].coords3.y = gObjectEvents[i].coords2.y + 1;
gObjectEvents[i].previousCoords.x = gObjectEvents[i].currentCoords.x;
gObjectEvents[i].previousCoords.y = gObjectEvents[i].currentCoords.y + 1;
}
}
@@ -143,7 +143,7 @@ void sub_815A540(void)
{
struct ObjectEvent * objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
SetPlayerAvatarTransitionFlags(0x01);
DestroySprite(&gSprites[objectEvent->mapobj_unk_1A]);
DestroySprite(&gSprites[objectEvent->fieldEffectSpriteId]);
}
}
}
+12 -12
View File
@@ -58,7 +58,7 @@ static void sub_81504A8(void)
{
struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
sub_81507BC(objectEvent, sub_805C808(0));
ObjectEventTurn(objectEvent, objectEvent->placeholder18);
ObjectEventTurn(objectEvent, objectEvent->movementDirection);
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT);
}
@@ -66,7 +66,7 @@ static void sub_81504E8(void)
{
struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
sub_81507BC(objectEvent, sub_805C808(1));
ObjectEventTurn(objectEvent, objectEvent->placeholder18);
ObjectEventTurn(objectEvent, objectEvent->movementDirection);
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_MACH_BIKE);
sub_80BD620(0, 0);
}
@@ -87,7 +87,7 @@ static void sub_8150530(void)
else
{
sub_81507BC(objectEvent, sub_805C808(4));
StartSpriteAnim(sprite, sub_80634F0(objectEvent->facingDirection));
StartSpriteAnim(sprite, GetFishingNoCatchDirectionAnimNum(objectEvent->facingDirection));
}
}
@@ -99,10 +99,10 @@ static void sub_81505C4(u8 taskId)
switch (gTasks[taskId].data[0])
{
case 0:
ObjectEventClearAnimIfSpecialAnimActive(objectEvent);
objectEvent->mapobj_bit_11 = TRUE;
ObjectEventClearHeldMovementIfActive(objectEvent);
objectEvent->enableAnim = TRUE;
sub_81507BC(objectEvent, sub_805C808(4));
StartSpriteAnim(sprite, sub_80634F0(objectEvent->facingDirection));
StartSpriteAnim(sprite, GetFishingNoCatchDirectionAnimNum(objectEvent->facingDirection));
gTasks[taskId].data[0]++;
gTasks[taskId].data[1] = 0;
break;
@@ -114,7 +114,7 @@ static void sub_81505C4(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 2:
StartSpriteAnim(sprite, sub_8063500(GetPlayerFacingDirection()));
StartSpriteAnim(sprite, GetFishingBiteDirectionAnimNum(GetPlayerFacingDirection()));
gTasks[taskId].data[0]++;
break;
case 3:
@@ -125,7 +125,7 @@ static void sub_81505C4(u8 taskId)
sub_81507BC(objectEvent, sub_805C808(0));
else
sub_81507BC(objectEvent, sub_805C808(2));
ObjectEventTurn(objectEvent, objectEvent->placeholder18);
ObjectEventTurn(objectEvent, objectEvent->movementDirection);
sprite->pos2.x = 0;
sprite->pos2.y = 0;
ScriptContext2_Disable();
@@ -143,13 +143,13 @@ static void sub_8150708(void)
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING))
{
sub_81507BC(objectEvent, sub_805C808(2));
ObjectEventTurn(objectEvent, objectEvent->placeholder18);
ObjectEventTurn(objectEvent, objectEvent->movementDirection);
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING);
gFieldEffectArguments[0] = objectEvent->coords2.x;
gFieldEffectArguments[1] = objectEvent->coords2.y;
gFieldEffectArguments[0] = objectEvent->currentCoords.x;
gFieldEffectArguments[1] = objectEvent->currentCoords.y;
gFieldEffectArguments[2] = gPlayerAvatar.objectEventId;
fieldEffectId = FieldEffectStart(FLDEFF_SURF_BLOB);
objectEvent->mapobj_unk_1A = fieldEffectId;
objectEvent->fieldEffectSpriteId = fieldEffectId;
sub_80DC44C(fieldEffectId, 1);
}
}
+2 -2
View File
@@ -1084,7 +1084,7 @@ bool8 ScrCmd_setobjectxy(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
sub_805F7C4(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, x, y);
TryMoveObjectEventToMapCoords(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, x, y);
return FALSE;
}
@@ -1102,7 +1102,7 @@ bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext *ctx)
{
u16 localId = VarGet(ScriptReadHalfword(ctx));
sub_805FE94(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
TryOverrideObjectEventTemplateCoords(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
return FALSE;
}
+9 -9
View File
@@ -598,7 +598,7 @@ static void sub_810C3B8(u8 taskId)
{
if (sub_810CF04(i) == TRUE)
{
if (gObjectEvents[i].mapobj_bit_1)
if (gObjectEvents[i].singleMovementActive)
return;
FreezeObjectEvent(&gObjectEvents[i]);
}
@@ -687,7 +687,7 @@ static void sub_810C594(void)
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
{
struct ObjectEvent * objectEvent = &gObjectEvents[i];
if (objectEvent->animPattern == 0x4D || objectEvent->animPattern == 0x4E || objectEvent->animPattern == 0x4F)
if (objectEvent->movementType == 0x4D || objectEvent->movementType == 0x4E || objectEvent->movementType == 0x4F)
{
u8 r3 = sub_810CF54();
if (objectEvent->active && gSprites[objectEvent->spriteId].data[0] == i)
@@ -799,8 +799,8 @@ static void GatherNearbyTrainerInfo(void)
sVsSeeker->trainerInfo[vsSeekerObjectIdx].localId = templates[objectEventIdx].localId;
TryGetObjectEventIdByLocalIdAndMap(templates[objectEventIdx].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId);
sVsSeeker->trainerInfo[vsSeekerObjectIdx].objectEventId = objectEventId;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].xCoord = gObjectEvents[objectEventId].coords2.x - 7;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].yCoord = gObjectEvents[objectEventId].coords2.y - 7;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].xCoord = gObjectEvents[objectEventId].currentCoords.x - 7;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].yCoord = gObjectEvents[objectEventId].currentCoords.y - 7;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].graphicsId = templates[objectEventIdx].graphicsId;
vsSeekerObjectIdx++;
}
@@ -909,7 +909,7 @@ static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
else
{
gSaveBlock1Ptr->trainerRematches[sVsSeeker->trainerInfo[vsSeekerIdx].localId] = r7;
npc_coords_shift_still(&gObjectEvents[sVsSeeker->trainerInfo[vsSeekerIdx].objectEventId]);
ShiftStillObjectEventCoords(&gObjectEvents[sVsSeeker->trainerInfo[vsSeekerIdx].objectEventId]);
StartTrainerObjectMovementScript(&sVsSeeker->trainerInfo[vsSeekerIdx], sMovementScript_TrainerRematch);
sVsSeeker->trainerIdxArray[sVsSeeker->numRematchableTrainers] = r8;
sVsSeeker->runningBehaviourEtcArray[sVsSeeker->numRematchableTrainers] = GetRunningBehaviorFromGraphicsId(sVsSeeker->trainerInfo[vsSeekerIdx].graphicsId);
@@ -952,12 +952,12 @@ void sub_810CB90(void)
TryGetObjectEventIdByLocalIdAndMap(r4[r8].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &sp0);
r4_2 = &gObjectEvents[sp0];
sub_810CF54(&r4[r8]); // You are using this function incorrectly. Please consult the manual.
sub_805FE7C(r4_2, gUnknown_8453F67[r4_2->facingDirection]);
OverrideMovementTypeForObjectEvent(r4_2, gUnknown_8453F67[r4_2->facingDirection]);
gSaveBlock1Ptr->trainerRematches[r4[r8].localId] = 0;
if (gSelectedObjectEvent == sp0)
r4_2->animPattern = gUnknown_8453F67[r4_2->facingDirection];
r4_2->movementType = gUnknown_8453F67[r4_2->facingDirection];
else
r4_2->animPattern = 0x08;
r4_2->movementType = 0x08;
}
}
}
@@ -1313,7 +1313,7 @@ static void StartAllRespondantIdleMovements(void)
if (sub_810CF04(sVsSeeker->trainerInfo[j].objectEventId) == 1)
SetTrainerMovementType(r4, sVsSeeker->runningBehaviourEtcArray[i]);
sub_805FE7C(r4, sVsSeeker->runningBehaviourEtcArray[i]);
OverrideMovementTypeForObjectEvent(r4, sVsSeeker->runningBehaviourEtcArray[i]);
gSaveBlock1Ptr->trainerRematches[sVsSeeker->trainerInfo[j].localId] = GetNextAvailableRematchTrainer(sVsSeekerData, sVsSeeker->trainerInfo[j].trainerIdx, &dummy);
}
}