mirror of https://github.com/zeldaret/tmc.git
Merge branch 'master' into enemies
This commit is contained in:
commit
917ca10ba5
|
@ -1,6 +1,8 @@
|
|||
.ifndef GUARD_ASM_MACROS_ENTITY_INC
|
||||
.set GUARD_ASM_MACROS_ENTITY_INC, 1
|
||||
|
||||
.set DEFAULT_POOL, 0xF
|
||||
|
||||
.set ENTITY_TYPE_ENEMY, 0x3
|
||||
.set ENTITY_TYPE_SIGN, 0x5
|
||||
.set ENTITY_TYPE_OBJECT, 0x6
|
||||
|
@ -14,7 +16,7 @@
|
|||
|
||||
.macro object_minish_lilypad x, y, room_property, collision=0
|
||||
.byte ENTITY_TYPE_OBJECT | ((\collision) << 4)
|
||||
.byte 0x0F
|
||||
.byte DEFAULT_POOL
|
||||
.byte OBJECT_MINISH_LILYPAD
|
||||
.byte 0x00
|
||||
.byte \room_property
|
||||
|
@ -25,7 +27,7 @@
|
|||
|
||||
.macro object_item x, y, item, flag, collision=0
|
||||
.byte ENTITY_TYPE_OBJECT | ((\collision) << 4)
|
||||
.byte 0x0F
|
||||
.byte DEFAULT_POOL
|
||||
.byte OBJECT_ITEM
|
||||
.byte \item
|
||||
.byte 0x00
|
||||
|
@ -37,7 +39,7 @@
|
|||
|
||||
.macro enemy_octorok x, y, bound_x, bound_y, bound_tile_width, bound_tile_height, collision=0
|
||||
.byte ENTITY_TYPE_ENEMY | ((\collision) << 4)
|
||||
.byte 0x0F
|
||||
.byte DEFAULT_POOL
|
||||
.byte ENEMY_OCTOROK
|
||||
.byte 0x00, 0x00, 0x00
|
||||
.byte \bound_tile_width, \bound_tile_height
|
||||
|
@ -47,7 +49,7 @@
|
|||
|
||||
.macro enemy_chuchu x, y, bound_x, bound_y, bound_tile_width, bound_tile_height, collision=0
|
||||
.byte ENTITY_TYPE_ENEMY | ((\collision) << 4)
|
||||
.byte 0x0F
|
||||
.byte DEFAULT_POOL
|
||||
.byte ENEMY_CHUCHU
|
||||
.byte 0x00, 0x00, 0x00
|
||||
.byte \bound_tile_width, \bound_tile_height
|
||||
|
@ -57,16 +59,16 @@
|
|||
|
||||
.macro enemy_tree_item x, y, unknown, collision=0
|
||||
.byte ENTITY_TYPE_ENEMY | ((\collision) << 4)
|
||||
.byte 0x0F
|
||||
.byte DEFAULT_POOL
|
||||
.byte ENEMY_TREE_ITEM
|
||||
.byte \unknown, 0x00, 0x00, 0x00, 0x00
|
||||
.2byte \x, \y
|
||||
.2byte 0x00, 0x00
|
||||
.endm
|
||||
|
||||
.macro entity_raw type:req, subtype:req, collision=0, unknown:req, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
.macro entity_raw type:req, subtype:req, collision=0, pool:req, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
.byte \type | ((\collision) << 4)
|
||||
.byte \unknown
|
||||
.byte \pool
|
||||
.byte \subtype
|
||||
.byte \paramA
|
||||
.4byte \paramB
|
||||
|
@ -91,24 +93,24 @@
|
|||
.2byte \flag2
|
||||
.endm
|
||||
|
||||
.macro manager subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=9, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.macro manager subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=9, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.endm
|
||||
|
||||
.macro object_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=6, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.macro object_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=6, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.endm
|
||||
|
||||
.macro enemy_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=3, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.macro enemy_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=3, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.endm
|
||||
|
||||
.macro npc_raw subtype:req, collision=0, unknown=0x4f, paramA=0, paramB=0, x=0, y=0, script:req
|
||||
entity_raw type=7, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\script
|
||||
.macro npc_raw subtype:req, collision=0, pool=0x4f, paramA=0, paramB=0, x=0, y=0, script:req
|
||||
entity_raw type=7, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\script
|
||||
.endm
|
||||
|
||||
.macro projectile_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=4, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.macro projectile_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
|
||||
entity_raw type=4, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
|
||||
.endm
|
||||
|
||||
.macro entity_list_end
|
||||
|
|
|
@ -59,7 +59,7 @@ gUnk_080FED58:: @ 080FED58
|
|||
.incbin "data_080FC8A4/gUnk_080FED58.bin"
|
||||
|
||||
@ kinstone.c
|
||||
gUnk_080FED98:: @ 080FED98
|
||||
gLilypadRails:: @ 080FED98
|
||||
.4byte gUnk_080FEDA4
|
||||
.4byte gUnk_080FEDDA
|
||||
.4byte gUnk_080FEDF8
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -197,7 +197,7 @@ typedef enum {
|
|||
WORLD_EVENT_TYPE_8, // set a tile type
|
||||
WORLD_EVENT_TYPE_9, // LoadRoomEntity and set some tile type
|
||||
WORLD_EVENT_TYPE_BEANSTALK,
|
||||
WORLD_EVENT_TYPE_11, // LoadRoomEntity and set gRoomVars.field_0x8c
|
||||
WORLD_EVENT_TYPE_11, // LoadRoomEntity and set gRoomVars.entityRails
|
||||
WORLD_EVENT_TYPE_12,
|
||||
WORLD_EVENT_TYPE_13,
|
||||
WORLD_EVENT_TYPE_14,
|
||||
|
|
|
@ -60,29 +60,26 @@ typedef struct {
|
|||
extern RoomControls gRoomControls;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x01 */ u8 filler_0x1;
|
||||
/* 0x00 */ bool8 didEnterScrolling;
|
||||
/* 0x01 */ bool8 destructableManagerLoaded;
|
||||
/* 0x02 */ bool8 randomDropsDisabled;
|
||||
/* 0x03 */ u8 field_0x3;
|
||||
/* 0x04 */ u8 field_0x4;
|
||||
/* 0x05 */ u8 filler1[1];
|
||||
/* 0x03 */ bool8 remFlagUnused;
|
||||
/* 0x04 */ u8 numKinstoneDrops;
|
||||
/* 0x05 */ u8 numKinstoneDropsPrevFrame;
|
||||
/* 0x06 */ u8 shopItemType;
|
||||
/* 0x07 */ u8 shopItemType2;
|
||||
/* 0x08 */ u8 field_0x8;
|
||||
/* 0x08 */ u8 unused;
|
||||
/* 0x09 */ u8 fight_bgm;
|
||||
/* 0x0a */ u8 unk2;
|
||||
/* 0x0b */ u8 filler2;
|
||||
/* 0x0a */ u8 needHealthDrop;
|
||||
/* 0x0c */ s16 lightLevel;
|
||||
/* 0x0e */ u16 unk_0e;
|
||||
/* 0x10 */ u8 unk_10[4];
|
||||
/* 0x14 */ u32 flags;
|
||||
/* 0x18 */ u32 unk3;
|
||||
/* 0x1c */ u8 filler4[44];
|
||||
/* 0x0e */ u16 tileEntityCount;
|
||||
/* 0x10 */ u8 graphicsGroups[4];
|
||||
/* 0x14 */ u8 flags[52];
|
||||
/* 0x48 */ Droptable currentAreaDroptable;
|
||||
/* 0x68 */ u32 animFlags;
|
||||
/* 0x6c */ void* field_0x6c[8];
|
||||
/* 0x8c */ void* field_0x8c[8];
|
||||
/* 0xac */ Entity* entities[8];
|
||||
/* 0x6c */ void* properties[8];
|
||||
/* 0x8c */ void* entityRails[8];
|
||||
/* 0xac */ Entity* puzzleEntities[8];
|
||||
} RoomVars;
|
||||
static_assert(sizeof(RoomVars) == 0xCC);
|
||||
extern RoomVars gRoomVars;
|
||||
|
|
|
@ -27,7 +27,7 @@ extern u8 gUpdateVisibleTiles;
|
|||
extern u16 gMapDataTopSpecial[];
|
||||
extern u16 gMapDataBottomSpecial[];
|
||||
extern const u8 gGlobalGfxAndPalettes[];
|
||||
extern const u8 gUnk_081091E4[];
|
||||
extern const u8 gEntityListLUT[];
|
||||
|
||||
typedef struct {
|
||||
u16 tileType;
|
||||
|
@ -1084,7 +1084,7 @@ u32 sub_0801AC68(u32 position, u32 data) {
|
|||
u32 end;
|
||||
|
||||
ptr = gUnk_0200B240;
|
||||
end = gRoomVars.unk_0e;
|
||||
end = gRoomVars.tileEntityCount;
|
||||
for (index = 0; index < end; ptr++, index++) {
|
||||
if (position == ptr->position) {
|
||||
return ptr->data << 2;
|
||||
|
@ -1150,7 +1150,7 @@ void sub_0801AD6C(const Data* param_1, u32 tilePosition) {
|
|||
entity->y.HALF.HI = tmpY1 + gRoomControls.origin_y;
|
||||
entity->collisionLayer = 0;
|
||||
ResolveCollisionLayer(entity);
|
||||
AppendEntityToList(entity, gUnk_081091E4[entity->kind]);
|
||||
AppendEntityToList(entity, gEntityListLUT[entity->kind]);
|
||||
}
|
||||
} else {
|
||||
manager = GetEmptyManager();
|
||||
|
@ -1164,7 +1164,7 @@ void sub_0801AD6C(const Data* param_1, u32 tilePosition) {
|
|||
*(u16*)(&manager[1].timer + 10) = tmpX2 + gRoomControls.origin_x;
|
||||
tmpY2 = (s16)((tilePosition & 0xfc0) >> 2) + 8;
|
||||
*(u16*)(&manager[1].timer + 12) = tmpY2 + gRoomControls.origin_y;
|
||||
AppendEntityToList((Entity*)manager, gUnk_081091E4[manager->kind]);
|
||||
AppendEntityToList((Entity*)manager, gEntityListLUT[manager->kind]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1224,11 +1224,11 @@ void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer) {
|
|||
void sub_0801AF48(u32 data, u32 position, u32 layer) {
|
||||
u32 index;
|
||||
if ((data < 0x4000) && (gRoomTransition.field30 == 0)) {
|
||||
index = gRoomVars.unk_0e;
|
||||
index = gRoomVars.tileEntityCount;
|
||||
if (index < 0x100) {
|
||||
gUnk_0200B240[index].data = data;
|
||||
gUnk_0200B240[index].position = (layer << 0xc) | position;
|
||||
gRoomVars.unk_0e = index + 1;
|
||||
gRoomVars.tileEntityCount = index + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@ void DeleteLoadedTileEntity(u32 position, s32 layer) {
|
|||
layer = layer << 12;
|
||||
positionLayer = position | layer;
|
||||
ptr = gUnk_0200B240;
|
||||
count = gRoomVars.unk_0e;
|
||||
count = gRoomVars.tileEntityCount;
|
||||
t = 0;
|
||||
|
||||
if (t >= count) {
|
||||
|
@ -1251,7 +1251,7 @@ void DeleteLoadedTileEntity(u32 position, s32 layer) {
|
|||
|
||||
if (positionLayer == ptr->position) {
|
||||
count--;
|
||||
gRoomVars.unk_0e = count;
|
||||
gRoomVars.tileEntityCount = count;
|
||||
ptr[0] = ptr[count];
|
||||
return;
|
||||
}
|
||||
|
@ -1263,7 +1263,7 @@ void DeleteLoadedTileEntity(u32 position, s32 layer) {
|
|||
}
|
||||
}
|
||||
count--;
|
||||
gRoomVars.unk_0e = count;
|
||||
gRoomVars.tileEntityCount = count;
|
||||
ptr = gUnk_0200B240;
|
||||
ptr[t] = ptr[count];
|
||||
}
|
||||
|
|
|
@ -75,45 +75,42 @@ void sub_0802C318(FallingBoulderEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0802C334(FallingBoulderEntity* this) {
|
||||
register Entity* entity asm("r2");
|
||||
u32 diff;
|
||||
u16 tmp;
|
||||
Entity* entity;
|
||||
u32 roomOriginY, tmp;
|
||||
s32 y, i;
|
||||
if (this->unk_7c == 0) {
|
||||
u32 tmp = gRoomControls.origin_y;
|
||||
roomOriginY = gRoomControls.origin_y;
|
||||
entity = &gPlayerEntity.base;
|
||||
if (entity == NULL)
|
||||
return;
|
||||
if (entity->y.HALF.HI - tmp <= 0x38) {
|
||||
tmp = entity->y.HALF.HI;
|
||||
if (0x38 >= tmp - roomOriginY)
|
||||
return;
|
||||
}
|
||||
this->unk_7c = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
}
|
||||
|
||||
GetNextFrame(super);
|
||||
this->unk_7e = COORD_TO_TILE(super);
|
||||
|
||||
if (sub_080044EC(super, this->unk_84) == 1) {
|
||||
EnqueueSFX(0x14c);
|
||||
COLLISION_ON(super);
|
||||
this->unk_7a = 0xc;
|
||||
this->unk_7a = 12;
|
||||
sub_0802C4B0(this);
|
||||
} else {
|
||||
s32 y;
|
||||
|
||||
if (this->unk_7a) {
|
||||
tmp = --this->unk_7a;
|
||||
switch (tmp) {
|
||||
switch (--this->unk_7a) {
|
||||
case 0:
|
||||
COLLISION_OFF(super);
|
||||
break;
|
||||
case 8:
|
||||
if (super->type2 != 0 && !sub_08049FA0(super)) {
|
||||
diff = 0;
|
||||
for (y = 1; y > -1; y--) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
entity = CreateFx(super, FX_ROCK2, 0);
|
||||
if (entity) {
|
||||
entity->x.HALF.HI = entity->x.HALF.HI + 12 - diff;
|
||||
entity->x.HALF.HI += 12 - i * 0x18;
|
||||
}
|
||||
diff += 0x18;
|
||||
}
|
||||
sub_0802C62C(this);
|
||||
this->unk_7a = (Random() & 0xff) | 0x100;
|
||||
|
@ -122,11 +119,9 @@ void sub_0802C334(FallingBoulderEntity* this) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
FORCE_REGISTER(RoomControls * tmp, r0) = &gRoomControls;
|
||||
y = tmp->origin_y + tmp->height - super->y.HALF.HI;
|
||||
}
|
||||
roomOriginY = gRoomControls.origin_y;
|
||||
tmp = gRoomControls.height;
|
||||
y = roomOriginY + tmp - super->y.HALF.HI;
|
||||
|
||||
if (y >= 5) {
|
||||
ProcessMovement1(super);
|
||||
|
@ -141,6 +136,7 @@ void sub_0802C334(FallingBoulderEntity* this) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
super->collisionLayer = 3;
|
||||
super->spritePriority.b0 = 1;
|
||||
UpdateSpriteForCollisionLayer(super);
|
||||
|
|
67
src/entity.c
67
src/entity.c
|
@ -40,51 +40,54 @@ typedef struct {
|
|||
extern UpdateContext gUpdateContext;
|
||||
|
||||
// List by entity kind.
|
||||
const u8 gUnk_081091E4[] = {
|
||||
const u8 gEntityListLUT[] = {
|
||||
8, 1, 8, 4, 5, 8, 6, 7, 2, 6,
|
||||
};
|
||||
|
||||
// TODO: wrong file, maybe an "enter.c" according to lexicographical order
|
||||
void sub_0805E248(void) {
|
||||
s32 v0;
|
||||
s32 idx;
|
||||
|
||||
v0 = gDiggingCaveEntranceTransition.entrance->targetTilePosition;
|
||||
idx = gDiggingCaveEntranceTransition.entrance->targetTilePosition;
|
||||
if (gRoomControls.area == AREA_VEIL_FALLS || gRoomControls.area == AREA_VEIL_FALLS_DIG_CAVE) {
|
||||
SetTileType(0x27c, v0 + TILE_POS(-1, -1), 1);
|
||||
SetTileType(0x283, v0 + TILE_POS(-1, -1), 2);
|
||||
SetTileType(0x27d, v0 + TILE_POS(0, -1), 1);
|
||||
SetTileType(0x284, v0 + TILE_POS(0, -1), 2);
|
||||
SetTileType(0x27e, v0 + TILE_POS(1, -1), 1);
|
||||
SetTileType(0x285, v0 + TILE_POS(1, -1), 2);
|
||||
SetTileType(0x27f, v0 + TILE_POS(-1, 0), 1);
|
||||
SetTileType(0x280, v0 + TILE_POS(0, 0), 1);
|
||||
SetTileType(0x282, v0 + TILE_POS(1, 0), 1);
|
||||
SetTileType(0x27c, idx + TILE_POS(-1, -1), 1);
|
||||
SetTileType(0x283, idx + TILE_POS(-1, -1), 2);
|
||||
SetTileType(0x27d, idx + TILE_POS(0, -1), 1);
|
||||
SetTileType(0x284, idx + TILE_POS(0, -1), 2);
|
||||
SetTileType(0x27e, idx + TILE_POS(1, -1), 1);
|
||||
SetTileType(0x285, idx + TILE_POS(1, -1), 2);
|
||||
SetTileType(0x27f, idx + TILE_POS(-1, 0), 1);
|
||||
SetTileType(0x280, idx + TILE_POS(0, 0), 1);
|
||||
SetTileType(0x282, idx + TILE_POS(1, 0), 1);
|
||||
} else {
|
||||
SetTileType(0x26c, v0 + TILE_POS(-1, -1), 1);
|
||||
SetTileType(0x273, v0 + TILE_POS(-1, -1), 2);
|
||||
SetTileType(0x26d, v0 + TILE_POS(0, -1), 1);
|
||||
SetTileType(0x274, v0 + TILE_POS(0, -1), 2);
|
||||
SetTileType(0x26e, v0 + TILE_POS(1, -1), 1);
|
||||
SetTileType(0x275, v0 + TILE_POS(1, -1), 2);
|
||||
SetTileType(0x26f, v0 + TILE_POS(-1, 0), 1);
|
||||
SetTileType(0x270, v0 + TILE_POS(0, 0), 1);
|
||||
SetTileType(0x272, v0 + TILE_POS(1, 0), 1);
|
||||
SetTileType(0x26c, idx + TILE_POS(-1, -1), 1);
|
||||
SetTileType(0x273, idx + TILE_POS(-1, -1), 2);
|
||||
SetTileType(0x26d, idx + TILE_POS(0, -1), 1);
|
||||
SetTileType(0x274, idx + TILE_POS(0, -1), 2);
|
||||
SetTileType(0x26e, idx + TILE_POS(1, -1), 1);
|
||||
SetTileType(0x275, idx + TILE_POS(1, -1), 2);
|
||||
SetTileType(0x26f, idx + TILE_POS(-1, 0), 1);
|
||||
SetTileType(0x270, idx + TILE_POS(0, 0), 1);
|
||||
SetTileType(0x272, idx + TILE_POS(1, 0), 1);
|
||||
}
|
||||
gUpdateVisibleTiles = 0;
|
||||
}
|
||||
|
||||
const u8 gUnk_081091EE[] = {
|
||||
0, 1, 0, 0, 0, 0, 1, 1, 1, 1,
|
||||
const u8 gPrioritiesDefault[] = {
|
||||
[0] = 0, [PLAYER] = 1, [2] = 0, [ENEMY] = 0, [PROJECTILE] = 0,
|
||||
[5] = 0, [OBJECT] = 1, [NPC] = 1, [PLAYER_ITEM] = 1, [MANAGER] = 1,
|
||||
};
|
||||
const u8 gUnk_081091F8[] = {
|
||||
0, 3, 0, 3, 3, 0, 3, 3, 3, 3,
|
||||
const u8 gPrioritiesKinstoneMenu[] = {
|
||||
[0] = 0, [PLAYER] = 3, [2] = 0, [ENEMY] = 3, [PROJECTILE] = 3,
|
||||
[5] = 0, [OBJECT] = 3, [NPC] = 3, [PLAYER_ITEM] = 3, [MANAGER] = 3,
|
||||
};
|
||||
|
||||
void SetEntityPriorityForKind(Entity* e) {
|
||||
void InitDefaultPriority(Entity* e) {
|
||||
u8 r3 = gRoomTransition.entity_update_type;
|
||||
const u8* array = gUnk_081091F8;
|
||||
const u8* array = gPrioritiesKinstoneMenu;
|
||||
|
||||
if (r3 != 2) {
|
||||
array = gUnk_081091EE;
|
||||
array = gPrioritiesDefault;
|
||||
}
|
||||
SetEntityPriority(e, array[e->kind]);
|
||||
}
|
||||
|
@ -214,8 +217,10 @@ void ClearEventPriority(void) {
|
|||
void UpdateEntities(void) {
|
||||
void (*f)(u32);
|
||||
|
||||
gRoomVars.filler1[0] = gRoomVars.field_0x4;
|
||||
gRoomVars.field_0x4 = 0;
|
||||
// TODO: why is this needed? Does this avoid a bug?
|
||||
gRoomVars.numKinstoneDropsPrevFrame = gRoomVars.numKinstoneDrops;
|
||||
gRoomVars.numKinstoneDrops = 0;
|
||||
|
||||
UpdatePlayerInput();
|
||||
UpdatePriority();
|
||||
ClearHitboxList();
|
||||
|
@ -505,7 +510,7 @@ void AppendEntityToList(Entity* entity, u32 listIndex) {
|
|||
} else {
|
||||
gManagerCount++;
|
||||
}
|
||||
SetEntityPriorityForKind(entity);
|
||||
InitDefaultPriority(entity);
|
||||
}
|
||||
|
||||
void PrependEntityToList(Entity* entity, u32 listIndex) {
|
||||
|
|
|
@ -236,7 +236,7 @@ static void GameMain_ChangeRoom(void) {
|
|||
}
|
||||
CreateMiscManager();
|
||||
#endif
|
||||
if (!gRoomVars.field_0x0) {
|
||||
if (!gRoomVars.didEnterScrolling) {
|
||||
RequestPriorityDuration(NULL, 1);
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ static void InitializeEntities(void) {
|
|||
|
||||
static void sub_08051D98(void) {
|
||||
sub_08052EA0();
|
||||
gRoomVars.field_0x0 = 1;
|
||||
gRoomVars.didEnterScrolling = TRUE;
|
||||
|
||||
// remove old entities, unless persistent
|
||||
RecycleEntities();
|
||||
|
|
|
@ -495,8 +495,8 @@ extern EntityData gUnk_080FECC8[];
|
|||
extern EntityData gUnk_080FEC28[];
|
||||
extern const EntityData gUnk_080FED18[];
|
||||
extern EntityData gUnk_080FED58[];
|
||||
// TODO need to find out what gRoomVars.field_0x8c[ptr->entity_idx] is.
|
||||
extern const void* gUnk_080FED98[];
|
||||
// TODO need to find out what gRoomVars.entityRails[ptr->entity_idx] is.
|
||||
extern const void* gLilypadRails[];
|
||||
// gUnk_080FEDA4
|
||||
// gUnk_080FEDDA
|
||||
// gUnk_080FEDF8
|
||||
|
|
|
@ -571,10 +571,10 @@ RoomResInfo* GetCurrentRoomInfo(void) {
|
|||
|
||||
void sub_08052EA0(void) {
|
||||
MemClear(&gRoomVars, sizeof gRoomVars);
|
||||
gRoomVars.unk_10[0] = -1;
|
||||
gRoomVars.unk_10[1] = gRoomVars.unk_10[0];
|
||||
gRoomVars.unk_10[2] = gRoomVars.unk_10[0];
|
||||
gRoomVars.unk_10[3] = gRoomVars.unk_10[0];
|
||||
gRoomVars.graphicsGroups[0] = -1;
|
||||
gRoomVars.graphicsGroups[1] = gRoomVars.graphicsGroups[0];
|
||||
gRoomVars.graphicsGroups[2] = gRoomVars.graphicsGroups[0];
|
||||
gRoomVars.graphicsGroups[3] = gRoomVars.graphicsGroups[0];
|
||||
gRoomVars.lightLevel = 256;
|
||||
gArea.locationIndex = gAreaMetadata[gRoomControls.area].location;
|
||||
UpdateRoomTracker();
|
||||
|
@ -601,7 +601,7 @@ void UpdateFakeScroll(void) {
|
|||
LinkedList* ll;
|
||||
Entity* e;
|
||||
|
||||
if (gArea.unk_0c_0 == 0 || !gRoomVars.field_0x0)
|
||||
if (gArea.unk_0c_0 == 0 || !gRoomVars.didEnterScrolling)
|
||||
return;
|
||||
|
||||
y = 0;
|
||||
|
@ -727,7 +727,7 @@ void CheckAreaDiscovery(void) {
|
|||
e->kind = MANAGER;
|
||||
e->id = ENTER_ROOM_TEXTBOX_MANAGER;
|
||||
AppendEntityToList(e, 8);
|
||||
if (!gRoomVars.field_0x0 && !ReadBit(gSave.areaVisitFlags, gArea.locationIndex)) {
|
||||
if (!gRoomVars.didEnterScrolling && !ReadBit(gSave.areaVisitFlags, gArea.locationIndex)) {
|
||||
e->type2 = 1;
|
||||
SetPlayerControl(3);
|
||||
SetInitializationPriority();
|
||||
|
|
|
@ -198,39 +198,39 @@ void WaitForNextFrame(void) {
|
|||
FadeVBlank();
|
||||
}
|
||||
|
||||
void PlayerUpdate(Entity* this) {
|
||||
void PlayerUpdate(PlayerEntity* this) {
|
||||
if (gSave.stats.effect != 0)
|
||||
gPlayerState.flags |= PL_DRUGGED;
|
||||
else
|
||||
gPlayerState.flags &= ~PL_DRUGGED;
|
||||
|
||||
if (!EntityDisabled(this)) {
|
||||
if (!EntityDisabled(super)) {
|
||||
if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) {
|
||||
PutAwayItems();
|
||||
if (gPlayerState.flags & PL_MOLDWORM_RELEASED) {
|
||||
gPlayerState.queued_action = PLAYER_ROLL;
|
||||
gPlayerState.flags &= ~PL_MOLDWORM_CAPTURED;
|
||||
gPlayerState.hurtBlinkSpeed = 240;
|
||||
COLLISION_ON(this);
|
||||
COLLISION_ON(super);
|
||||
} else {
|
||||
COLLISION_OFF(this);
|
||||
COLLISION_OFF(super);
|
||||
gPlayerState.framestate = PL_STATE_F;
|
||||
}
|
||||
}
|
||||
HandlePlayerLife(this);
|
||||
HandlePlayerLife(super);
|
||||
DoPlayerAction(this);
|
||||
if ((this->z.WORD == 0) && (this->action == 1 || this->action == 9))
|
||||
sub_08008790(this, 8);
|
||||
if ((super->z.WORD == 0) && (super->action == 1 || super->action == 9))
|
||||
sub_08008790(super, 8);
|
||||
sub_080171F0();
|
||||
}
|
||||
sub_08078FB0(this);
|
||||
DrawEntity(this);
|
||||
sub_08078FB0(super);
|
||||
DrawEntity(super);
|
||||
UpdatePlayerPalette();
|
||||
}
|
||||
|
||||
// Responsible for some life things like low health beep and initiating the death sequence
|
||||
static void HandlePlayerLife(Entity* this) {
|
||||
u32 temp;
|
||||
u32 threshold;
|
||||
|
||||
gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE;
|
||||
gUnk_0200AF00.rActionInteractTile = R_ACTION_NONE;
|
||||
|
@ -263,26 +263,27 @@ static void HandlePlayerLife(Entity* this) {
|
|||
|
||||
#ifdef EU
|
||||
if ((gUnk_0200AF00.unk_1 == 0) && gRoomTransition.frameCount % 90 == 0) {
|
||||
temp = gSave.stats.maxHealth / 4;
|
||||
if (temp > 24)
|
||||
temp = 24;
|
||||
if (temp < 8)
|
||||
temp = 8;
|
||||
threshold = gSave.stats.maxHealth / 4;
|
||||
if (threshold > 24)
|
||||
threshold = 24;
|
||||
if (threshold < 8)
|
||||
threshold = 8;
|
||||
|
||||
if (gSave.stats.health <= temp) {
|
||||
if (gSave.stats.health <= threshold) {
|
||||
EnqueueSFX(SFX_LOW_HEALTH);
|
||||
}
|
||||
}
|
||||
#else
|
||||
gRoomVars.unk2 = gMessage.state & MESSAGE_ACTIVE;
|
||||
temp = gSave.stats.maxHealth / 4;
|
||||
if (temp > 24)
|
||||
temp = 24;
|
||||
if (temp < 8)
|
||||
temp = 8;
|
||||
// TODO: why does message state affect health drops in US/JP?
|
||||
gRoomVars.needHealthDrop = gMessage.state & MESSAGE_ACTIVE;
|
||||
threshold = gSave.stats.maxHealth / 4;
|
||||
if (threshold > 24)
|
||||
threshold = 24;
|
||||
if (threshold < 8)
|
||||
threshold = 8;
|
||||
|
||||
if (gSave.stats.health <= temp) {
|
||||
gRoomVars.unk2 = 1;
|
||||
if (gSave.stats.health <= threshold) {
|
||||
gRoomVars.needHealthDrop = TRUE;
|
||||
if ((gUnk_0200AF00.unk_1 == 0) && gRoomTransition.frameCount % 90 == 0) {
|
||||
EnqueueSFX(SFX_LOW_HEALTH);
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
|
|||
#ifndef EU
|
||||
case 24:
|
||||
case 25:
|
||||
r0 = gRoomVars.unk2;
|
||||
r0 = gRoomVars.needHealthDrop;
|
||||
ptr4 = &gUnk_0800191C[0];
|
||||
if (r0) {
|
||||
ptr4++;
|
||||
|
@ -545,7 +545,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
|
|||
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0) {
|
||||
return ITEM_NONE;
|
||||
}
|
||||
if (3 < gRoomVars.filler1[0]) {
|
||||
if (3 < gRoomVars.numKinstoneDropsPrevFrame) {
|
||||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ extern const EntityData gUnk_080FEE38[];
|
|||
extern const EntityData gUnk_080FEE18[];
|
||||
extern const EntityData gUnk_080FEE48[];
|
||||
extern const EntityData gUnk_080FEE58[];
|
||||
extern const void* gUnk_080FED98[];
|
||||
extern const void* gLilypadRails[];
|
||||
|
||||
void sub_08018AB4(int);
|
||||
void sub_08018BB4(u32 worldEventId);
|
||||
|
@ -339,8 +339,9 @@ void sub_0801876C(u32 worldEventId, bool32 isKinstoneFused) {
|
|||
break;
|
||||
case WORLD_EVENT_TYPE_11:
|
||||
if (isKinstoneFused != 0) {
|
||||
// lilypad rails
|
||||
LoadRoomEntity(&gUnk_080FED58[ptr->entity_idx]);
|
||||
gRoomVars.field_0x8c[ptr->entity_idx] = (void*)gUnk_080FED98[ptr->entity_idx];
|
||||
gRoomVars.entityRails[ptr->entity_idx] = (void*)gLilypadRails[ptr->entity_idx];
|
||||
}
|
||||
break;
|
||||
case WORLD_EVENT_TYPE_9:
|
||||
|
|
|
@ -29,7 +29,7 @@ void HorizontalMinishPathBackgroundManager_Main(HorizontalMinishPathBackgroundMa
|
|||
}
|
||||
|
||||
void sub_08057EFC(void* this) {
|
||||
LoadGfxGroup((u32)gRoomVars.unk_10[0]);
|
||||
LoadGfxGroup((u32)gRoomVars.graphicsGroups[0]);
|
||||
sub_08058034();
|
||||
((HorizontalMinishPathBackgroundManager*)this)->unk_3c = 0;
|
||||
((HorizontalMinishPathBackgroundManager*)this)->unk_38 = 0;
|
||||
|
@ -103,7 +103,7 @@ void sub_080580B0(u32 unk1) {
|
|||
gMapTop.bgSettings = 0;
|
||||
REG_DISPCNT = 0;
|
||||
LoadGfxGroup(unk1);
|
||||
gRoomVars.unk_10[0] = unk1;
|
||||
gRoomVars.graphicsGroups[0] = unk1;
|
||||
sub_08058034();
|
||||
tmp = gRoomControls.scroll_x - gRoomControls.origin_x;
|
||||
tmp = tmp + (tmp >> 3) + (0x400 - gRoomControls.width) / 2;
|
||||
|
|
|
@ -72,9 +72,9 @@ void HyruleTownTilesetManager_Main(HyruleTownTilesetManager* this) {
|
|||
}
|
||||
|
||||
void sub_08059A2C(HyruleTownTilesetManager* this) {
|
||||
gRoomVars.unk_10[2] = 0xff;
|
||||
gRoomVars.unk_10[1] = 0xff;
|
||||
gRoomVars.unk_10[0] = 0xff;
|
||||
gRoomVars.graphicsGroups[2] = 0xff;
|
||||
gRoomVars.graphicsGroups[1] = 0xff;
|
||||
gRoomVars.graphicsGroups[0] = 0xff;
|
||||
this->field_0x22 = 0xff;
|
||||
this->field_0x21 = 0xff;
|
||||
this->field_0x20 = 0xff;
|
||||
|
@ -147,8 +147,8 @@ bool32 sub_08059C8C(HyruleTownTilesetManager* this, u32 param_2, u8* param_3, co
|
|||
bool32 bVar2;
|
||||
|
||||
*param_3 = CheckRegionsOnScreen(param_4);
|
||||
if ((*param_3 != 0xff) && (gRoomVars.unk_10[param_2] != *param_3)) {
|
||||
gRoomVars.unk_10[param_2] = *param_3;
|
||||
if ((*param_3 != 0xff) && (gRoomVars.graphicsGroups[param_2] != *param_3)) {
|
||||
gRoomVars.graphicsGroups[param_2] = *param_3;
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
@ -158,7 +158,7 @@ bool32 sub_08059C8C(HyruleTownTilesetManager* this, u32 param_2, u8* param_3, co
|
|||
void sub_08059CC0(u32 param_1, u32 param_2) {
|
||||
const Unknown* unknown;
|
||||
|
||||
gRoomVars.unk_10[param_1] = param_2;
|
||||
gRoomVars.graphicsGroups[param_1] = param_2;
|
||||
if (gRoomControls.area != AREA_FESTIVAL_TOWN) {
|
||||
unknown = &gUnk_08108408[param_2];
|
||||
} else {
|
||||
|
|
|
@ -69,7 +69,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) {
|
|||
return;
|
||||
|
||||
if (sub_08057E40(this)) {
|
||||
tmp = (u32)gRoomVars.unk_10[0];
|
||||
tmp = (u32)gRoomVars.graphicsGroups[0];
|
||||
if (this->unk_20 != tmp) {
|
||||
this->unk_20 = tmp;
|
||||
super->timer = 0;
|
||||
|
@ -115,7 +115,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) {
|
|||
RegisterTransitionManager(this, sub_08057E30, 0);
|
||||
}
|
||||
if (sub_08057E40(this)) {
|
||||
tmp = (u32)gRoomVars.unk_10[0];
|
||||
tmp = (u32)gRoomVars.graphicsGroups[0];
|
||||
if (this->unk_20 != tmp) {
|
||||
this->unk_20 = tmp;
|
||||
super->timer = 0;
|
||||
|
@ -153,13 +153,13 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) {
|
|||
#endif
|
||||
|
||||
void sub_08057E30(void* this) {
|
||||
sub_08057E7C(gRoomVars.unk_10[0]);
|
||||
sub_08057E7C(gRoomVars.graphicsGroups[0]);
|
||||
}
|
||||
|
||||
bool32 sub_08057E40(MinishVillageTilesetManager* this) {
|
||||
u32 tmp = CheckRegionsOnScreen(gUnk_08108050);
|
||||
if (tmp != 0xFF) {
|
||||
gRoomVars.unk_10[0] = tmp;
|
||||
gRoomVars.graphicsGroups[0] = tmp;
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
@ -187,5 +187,5 @@ void sub_08057E7C(u32 unk1) {
|
|||
for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) {
|
||||
DmaCopy32(3, &gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x400 * 4);
|
||||
}
|
||||
gRoomVars.unk_10[0] = unk1;
|
||||
gRoomVars.graphicsGroups[0] = unk1;
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ void MiscManager_TypeD(MiscManager* this) {
|
|||
SetPlayerControl(3);
|
||||
if (gRoomControls.reload_flags)
|
||||
return;
|
||||
if (gRoomVars.field_0x0) {
|
||||
if (gRoomVars.didEnterScrolling) {
|
||||
StartPlayerScript(gUnk_08108380[gRoomControls.scroll_direction]);
|
||||
} else {
|
||||
StartPlayerScript(gUnk_08108380[gPlayerEntity.base.animationState >> 1]);
|
||||
|
|
|
@ -51,7 +51,7 @@ void sub_080575C8(u32 param) {
|
|||
gMapTop.bgSettings = 0;
|
||||
REG_DISPCNT = 0;
|
||||
LoadGfxGroup(param);
|
||||
gRoomVars.unk_10[0] = param;
|
||||
gRoomVars.graphicsGroups[0] = param;
|
||||
|
||||
bgOffset = (gRoomControls.scroll_y - gRoomControls.origin_y);
|
||||
bgOffset += bgOffset >> 3;
|
||||
|
@ -80,7 +80,7 @@ void sub_08057688(void) {
|
|||
}
|
||||
|
||||
void sub_080576A0(void* this) {
|
||||
LoadGfxGroup(gRoomVars.unk_10[0]);
|
||||
LoadGfxGroup(gRoomVars.graphicsGroups[0]);
|
||||
((VerticalMinishPathBackgroundManager*)this)->field_0x38 = NULL;
|
||||
((VerticalMinishPathBackgroundManager*)this)->field_0x3c = NULL;
|
||||
sub_0805754C((VerticalMinishPathBackgroundManager*)this);
|
||||
|
|
|
@ -46,7 +46,7 @@ void WeatherChangeManager_Main(WeatherChangeManager* this) {
|
|||
this->unk_20 = 0x1F;
|
||||
this->unk_22 = 5;
|
||||
}
|
||||
gRoomVars.unk_10[0] = 0xFF;
|
||||
gRoomVars.graphicsGroups[0] = 0xFF;
|
||||
RegisterTransitionManager(this, sub_080595E4, 0);
|
||||
}
|
||||
sub_08059608(this);
|
||||
|
@ -55,7 +55,7 @@ void WeatherChangeManager_Main(WeatherChangeManager* this) {
|
|||
}
|
||||
|
||||
void sub_080595E4(WeatherChangeManager* this) {
|
||||
gRoomVars.unk_10[0] = 0xFF;
|
||||
gRoomVars.graphicsGroups[0] = 0xFF;
|
||||
sub_08059690(this);
|
||||
sub_080596E0(this);
|
||||
LoadStaticBackground(0);
|
||||
|
@ -134,8 +134,8 @@ void sub_080596E0(WeatherChangeManager* this) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
if (gRoomVars.unk_10[0] != this->unk_22) {
|
||||
gRoomVars.unk_10[0] = this->unk_22;
|
||||
if (gRoomVars.graphicsGroups[0] != this->unk_22) {
|
||||
gRoomVars.graphicsGroups[0] = this->unk_22;
|
||||
switch (this->unk_22) {
|
||||
case 0 ... 3:
|
||||
LoadGfxGroup(this->unk_22 + 0x2B);
|
||||
|
|
|
@ -434,18 +434,18 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) {
|
|||
MessageNoOverlap(messageIndex, this);
|
||||
switch (context->intVariable) {
|
||||
case 0:
|
||||
gRoomVars.entities[0] = this;
|
||||
gRoomVars.puzzleEntities[0] = this;
|
||||
PrependEntityToList(this, NPC);
|
||||
this->zVelocity = Q_16_16(1.5);
|
||||
break;
|
||||
case 1:
|
||||
pEnt = FindNextDuplicateID(gRoomVars.entities[0], NPC);
|
||||
gRoomVars.entities[1] = pEnt;
|
||||
pEnt = FindNextDuplicateID(gRoomVars.puzzleEntities[0], NPC);
|
||||
gRoomVars.puzzleEntities[1] = pEnt;
|
||||
pEnt->zVelocity = Q_16_16(1.5);
|
||||
break;
|
||||
case 2:
|
||||
pEnt = FindNextDuplicateID(gRoomVars.entities[1], NPC);
|
||||
gRoomVars.entities[2] = pEnt;
|
||||
pEnt = FindNextDuplicateID(gRoomVars.puzzleEntities[1], NPC);
|
||||
gRoomVars.puzzleEntities[2] = pEnt;
|
||||
pEnt->zVelocity = Q_16_16(1.5);
|
||||
break;
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) {
|
|||
context->unk_18 = 1;
|
||||
break;
|
||||
case 1:
|
||||
pEnt = gRoomVars.entities[context->intVariable];
|
||||
pEnt = gRoomVars.puzzleEntities[context->intVariable];
|
||||
if (pEnt->z.HALF.HI < 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) {
|
|||
}
|
||||
|
||||
void sub_0806AB74(Entity* this) {
|
||||
gRoomVars.field_0x3 = 1;
|
||||
gRoomVars.remFlagUnused = TRUE;
|
||||
if ((s32)(this->y.HALF.HI - (u32)gRoomControls.origin_y) < 0xa8) {
|
||||
this->y.HALF.HI = gRoomControls.origin_y + 0xa8;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ void ItemOnGround(ItemOnGroundEntity* this) {
|
|||
}
|
||||
|
||||
if (super->type == 0x5C) {
|
||||
gRoomVars.field_0x4++;
|
||||
gRoomVars.numKinstoneDrops++;
|
||||
}
|
||||
|
||||
sub_08080CB4(super);
|
||||
|
|
|
@ -104,7 +104,7 @@ static u32 sub_08088938(PressurePlateEntity* this) {
|
|||
x = super->x.HALF.HI - 8;
|
||||
y = super->y.HALF.HI - 8;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
Entity* e = gRoomVars.entities[i];
|
||||
Entity* e = gRoomVars.puzzleEntities[i];
|
||||
if (e != NULL) {
|
||||
if ((u16)(e->x.HALF.HI - x) < 0x11 && ((u16)(e->y.HALF_U.HI - y) < 0x11)) {
|
||||
e->spriteOffsetY = sSpriteOffsets[this->dir];
|
||||
|
|
|
@ -172,8 +172,8 @@ void sub_08089454(PushableStatueEntity* this) {
|
|||
void sub_080894C8(PushableStatueEntity* this) {
|
||||
u32 index;
|
||||
for (index = 0; index < 8; index++) {
|
||||
if (gRoomVars.entities[index] == NULL) {
|
||||
gRoomVars.entities[index] = super;
|
||||
if (gRoomVars.puzzleEntities[index] == NULL) {
|
||||
gRoomVars.puzzleEntities[index] = super;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -182,8 +182,8 @@ void sub_080894C8(PushableStatueEntity* this) {
|
|||
void sub_080894FC(PushableStatueEntity* this) {
|
||||
u32 index;
|
||||
for (index = 0; index <= 7; index++) {
|
||||
if (super == gRoomVars.entities[index]) {
|
||||
gRoomVars.entities[index] = NULL;
|
||||
if (super == gRoomVars.puzzleEntities[index]) {
|
||||
gRoomVars.puzzleEntities[index] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1989,7 +1989,7 @@ static void sub_080724DC(PlayerEntity* this) {
|
|||
} else {
|
||||
super->spriteSettings.draw = 3;
|
||||
super->subAction = 1;
|
||||
if (gRoomVars.field_0x0 == 0) {
|
||||
if (!gRoomVars.didEnterScrolling) {
|
||||
if (gPlayerState.flags & PL_MINISH) {
|
||||
gPlayerState.animation = ANIM_BOUNCE_MINISH;
|
||||
} else {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
static void sub_08077E54(ItemBehavior* beh);
|
||||
|
||||
extern void sub_0800857C(Entity*);
|
||||
extern void SetEntityPriorityForKind(Entity*);
|
||||
extern void InitDefaultPriority(Entity*);
|
||||
extern void sub_0809D738(Entity*);
|
||||
extern s32 Mod(s32, s32);
|
||||
extern u32 sub_08003FDE(Entity*, Entity*, u32, u32);
|
||||
|
@ -1671,7 +1671,7 @@ bool32 CheckQueuedAction(void) {
|
|||
gPlayerEntity.base.action = gPlayerState.queued_action;
|
||||
gPlayerEntity.base.subAction = 0;
|
||||
gPlayerState.queued_action = PLAYER_INIT;
|
||||
DoPlayerAction(&gPlayerEntity.base);
|
||||
DoPlayerAction(&gPlayerEntity);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1851,7 +1851,7 @@ void PlayerSetNormalAndCollide(void) {
|
|||
PL_MOLDWORM_RELEASED | PL_PARACHUTE);
|
||||
ResolvePlayerAnimation();
|
||||
SetPlayerActionNormal();
|
||||
SetEntityPriorityForKind(&gPlayerEntity.base);
|
||||
InitDefaultPriority(&gPlayerEntity.base);
|
||||
}
|
||||
|
||||
void PlayerMinishSetNormalAndCollide(void) {
|
||||
|
@ -1867,7 +1867,7 @@ void PlayerMinishSetNormalAndCollide(void) {
|
|||
~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE);
|
||||
gPlayerState.swim_state = 0;
|
||||
gPlayerState.queued_action = PLAYER_INIT;
|
||||
SetEntityPriorityForKind(&gPlayerEntity.base);
|
||||
InitDefaultPriority(&gPlayerEntity.base);
|
||||
}
|
||||
|
||||
void sub_080792BC(s32 speed, u32 direction, u32 field_0x38) {
|
||||
|
@ -2018,7 +2018,7 @@ bool32 sub_08079550(void) {
|
|||
gPlayerEntity.base.subAction = 0;
|
||||
COLLISION_OFF(&gPlayerEntity.base);
|
||||
gPlayerState.jump_status = 0x81;
|
||||
DoPlayerAction(&gPlayerEntity.base);
|
||||
DoPlayerAction(&gPlayerEntity);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
16
src/room.c
16
src/room.c
|
@ -14,7 +14,7 @@ extern u32 sub_08049D1C(u32);
|
|||
|
||||
extern void** gCurrentRoomProperties;
|
||||
extern void*** gAreaTable[];
|
||||
extern u8 gUnk_081091E4[];
|
||||
extern u8 gEntityListLUT[];
|
||||
|
||||
extern void sub_080186EC(void);
|
||||
extern void sub_0804B16C(void);
|
||||
|
@ -102,7 +102,7 @@ void RegisterRoomEntity(Entity* ent, const EntityData* dat) {
|
|||
kind = dat->kind & 0xF;
|
||||
if (ent->prev == NULL) {
|
||||
if (list == 0xF) {
|
||||
AppendEntityToList(ent, gUnk_081091E4[kind]);
|
||||
AppendEntityToList(ent, gEntityListLUT[kind]);
|
||||
} else if (list == 8) {
|
||||
AppendEntityToList(ent, 8);
|
||||
} else {
|
||||
|
@ -122,6 +122,8 @@ void sub_0804AF0C(Entity* ent, const EntityData* dat) {
|
|||
ent->y.HALF.HI = dat->yPos + gRoomControls.origin_y;
|
||||
break;
|
||||
case 0x20:
|
||||
// TODO: for enemies, I think this is for delayed spawn
|
||||
// see mulldozerSpawnPoint.c
|
||||
((GenericEntity*)ent)->field_0x6c.HALF.HI |= 0x20;
|
||||
ent->x.HALF.HI = dat->xPos + gRoomControls.origin_x;
|
||||
ent->y.HALF.HI = dat->yPos + gRoomControls.origin_y;
|
||||
|
@ -145,7 +147,7 @@ void sub_0804AFB0(void** properties) {
|
|||
|
||||
gCurrentRoomProperties = properties;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
gRoomVars.field_0x6c[i] = gCurrentRoomProperties[i];
|
||||
gRoomVars.properties[i] = gCurrentRoomProperties[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,9 +249,9 @@ void* GetCurrentRoomProperty(u32 idx) {
|
|||
return NULL;
|
||||
|
||||
if (idx >= 0x80) {
|
||||
return gRoomVars.field_0x8c[idx & 7];
|
||||
return gRoomVars.entityRails[idx & 7];
|
||||
} else if (idx <= 7) {
|
||||
return gRoomVars.field_0x6c[idx];
|
||||
return gRoomVars.properties[idx];
|
||||
} else {
|
||||
return gCurrentRoomProperties[idx];
|
||||
}
|
||||
|
@ -353,9 +355,9 @@ static void LoadDarknessTile(TileEntity* tile) {
|
|||
static void LoadDestructibleTile(TileEntity* tile) {
|
||||
if (CheckLocalFlag(*(u16*)&tile->_2)) {
|
||||
SetTileType(*(u16*)&tile->_6, tile->tilePos, tile->localFlag);
|
||||
} else if (!gRoomVars.filler_0x1) {
|
||||
} else if (!gRoomVars.destructableManagerLoaded) {
|
||||
Manager* mgr;
|
||||
gRoomVars.filler_0x1 = 1;
|
||||
gRoomVars.destructableManagerLoaded = TRUE;
|
||||
mgr = GetEmptyManager();
|
||||
if (mgr != NULL) {
|
||||
mgr->kind = MANAGER;
|
||||
|
|
|
@ -399,7 +399,7 @@ u32 sub_unk3_HouseInteriors1_InnWestRoom(void) {
|
|||
index = 0;
|
||||
SetLocalFlag(BILL05_YADO1F_MATSU_T0);
|
||||
}
|
||||
gRoomVars.field_0x6c[3] = gUnk_080D6A74[index];
|
||||
gRoomVars.properties[3] = gUnk_080D6A74[index];
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ u32 sub_unk3_HouseInteriors1_InnMiddleRoom(void) {
|
|||
index = 0;
|
||||
SetLocalFlag(BILL06_YADO1F_TAKE_T0);
|
||||
}
|
||||
gRoomVars.field_0x6c[3] = gUnk_080D6B18[index];
|
||||
gRoomVars.properties[3] = gUnk_080D6B18[index];
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ u32 sub_unk3_HouseInteriors1_InnEastRoom(void) {
|
|||
index = 0;
|
||||
SetLocalFlag(BILL07_YADO1F_UME_T0);
|
||||
}
|
||||
gRoomVars.field_0x6c[3] = gUnk_080D6BB8[index];
|
||||
gRoomVars.properties[3] = gUnk_080D6BB8[index];
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,7 @@ void sub_StateChange_HouseInteriors1_SchoolWest(void) {
|
|||
if (gSave.global_progress < 8) {
|
||||
LoadRoomEntityList(&gUnk_080D7038);
|
||||
}
|
||||
if (gRoomVars.field_0x0 == 0) {
|
||||
if (!gRoomVars.didEnterScrolling) {
|
||||
SetWorldMapPos(2, 0, 0x2c8, 0xa8);
|
||||
}
|
||||
}
|
||||
|
@ -566,8 +566,8 @@ extern u32 gUnk_080D7348;
|
|||
|
||||
u32 sub_unk3_HyruleCastle_0(void) {
|
||||
if (CheckGlobalFlag(ENDING)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080D7348;
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[0] = &gUnk_080D7348;
|
||||
gRoomVars.properties[2] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -600,8 +600,8 @@ extern u32 gUnk_080D7410;
|
|||
|
||||
u32 sub_unk3_HyruleCastle_1(void) {
|
||||
if (CheckGlobalFlag(ENDING)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080D7410;
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[0] = &gUnk_080D7410;
|
||||
gRoomVars.properties[2] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -1077,7 +1077,7 @@ extern TileEntity gUnk_080D9328[];
|
|||
|
||||
static void sub_0804C128(void) {
|
||||
sub_080AF250(0);
|
||||
if (gRoomVars.field_0x0 != 0) {
|
||||
if (gRoomVars.didEnterScrolling) {
|
||||
if ((gArea.unk_0c_1) == 0) {
|
||||
if ((gArea.unk_0c_4) == 0) {
|
||||
gArea.unk_0c_1 = 1;
|
||||
|
@ -1271,7 +1271,7 @@ extern u32 gUnk_080DA230;
|
|||
|
||||
u32 sub_unk3_CastorDarknut_Main(void) {
|
||||
if (!CheckLocalFlag(LV4_0a_TSUBO))
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080DA230;
|
||||
gRoomVars.properties[0] = &gUnk_080DA230;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1633,7 +1633,7 @@ extern u32 gUnk_080DB910;
|
|||
|
||||
u32 sub_unk3_TownMinishHoles_LibraryBookshelf(void) {
|
||||
if (CheckGlobalFlag(MIZUKAKI_START) && !CheckLocalFlag(MIZUKAKI_BOOK_ALLBACK)) {
|
||||
gRoomVars.field_0x6c[1] = &gUnk_080DB910;
|
||||
gRoomVars.properties[1] = &gUnk_080DB910;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -2456,7 +2456,7 @@ extern u32 gUnk_080E103C;
|
|||
|
||||
u32 sub_unk3_CaveOfFlames_BeforeGleerok(void) {
|
||||
if (CheckGlobalFlag(LV2_CLEAR)) {
|
||||
gRoomVars.field_0x6c[1] = &gUnk_080E103C;
|
||||
gRoomVars.properties[1] = &gUnk_080E103C;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -3758,16 +3758,16 @@ extern u32 gUnk_080EB5D4;
|
|||
|
||||
u32 sub_unk3_DarkHyruleCastle_1FEntrance(void) {
|
||||
if (CheckGlobalFlag(ENDING)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080EB604;
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[0] = &gUnk_080EB604;
|
||||
gRoomVars.properties[2] = 0;
|
||||
gArea.bgm = gArea.queued_bgm = BGM_BEAT_VAATI;
|
||||
} else if (CheckLocalFlag(0x79)) {
|
||||
gRoomVars.field_0x6c[0] = NULL;
|
||||
gRoomVars.properties[0] = NULL;
|
||||
if (!CheckLocalFlag(0x7a)) {
|
||||
SetGlobalFlag(ZELDA_CHASE);
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080EB5D4;
|
||||
gRoomVars.field_0x6c[7] = sub_0804D9B0;
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[0] = &gUnk_080EB5D4;
|
||||
gRoomVars.properties[7] = sub_0804D9B0;
|
||||
gRoomVars.properties[2] = 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -3830,8 +3830,8 @@ void sub_StateChange_Dojos_ToSplitblade1(void) {
|
|||
|
||||
u32 sub_unk3_DarkHyruleCastle_3FTripleDarknut(void) {
|
||||
if (!CheckLocalFlag(0x77)) {
|
||||
gRoomVars.field_0x6c[0] = 0;
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[0] = 0;
|
||||
gRoomVars.properties[2] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -4023,7 +4023,7 @@ void sub_StateChange_Dojos_ToGreatblade8(void) {
|
|||
|
||||
u32 sub_unk3_DarkHyruleCastle_B1Entrance(void) {
|
||||
if (CheckLocalFlag(0x79)) {
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[2] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -4056,8 +4056,8 @@ extern u32 gUnk_080ED1E4;
|
|||
|
||||
u32 sub_unk3_DarkHyruleCastle_1FThroneRoom(void) {
|
||||
if (CheckGlobalFlag(ENDING)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080ED1E4;
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[0] = &gUnk_080ED1E4;
|
||||
gRoomVars.properties[2] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -4217,8 +4217,8 @@ void sub_StateChange_Ruins_Beanstalk1(void) {
|
|||
|
||||
u32 sub_unk3_DarkHyruleCastle_B1Left(void) {
|
||||
if (CheckLocalFlag(0x79)) {
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.field_0x6c[0] = 0;
|
||||
gRoomVars.properties[2] = 0;
|
||||
gRoomVars.properties[0] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -4242,7 +4242,7 @@ void sub_StateChange_Ruins_Beanstalk2(void) {
|
|||
|
||||
u32 sub_unk3_DarkHyruleCastle_B1Map(void) {
|
||||
if (CheckLocalFlag(0x79)) {
|
||||
gRoomVars.field_0x6c[2] = 0;
|
||||
gRoomVars.properties[2] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -4564,7 +4564,7 @@ extern u32 gUnk_080F09A0;
|
|||
|
||||
u32 sub_unk3_CastleGarden_Main(void) {
|
||||
if (GetInventoryValue(ITEM_FOURSWORD)) {
|
||||
gRoomVars.field_0x6c[1] = &gUnk_080F09A0;
|
||||
gRoomVars.properties[1] = &gUnk_080F09A0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -5022,9 +5022,9 @@ extern u32 gUnk_080F3EA4;
|
|||
|
||||
u32 sub_unk3_LakeHylia_Main(void) {
|
||||
if (CheckGlobalFlag(LV4_CLEAR) && !CheckLocalFlag(4)) {
|
||||
gRoomVars.field_0x6c[2] = &gUnk_080F3EA4;
|
||||
gRoomVars.properties[2] = &gUnk_080F3EA4;
|
||||
} else {
|
||||
gRoomVars.field_0x6c[2] = &Enemies_LakeHylia_Main;
|
||||
gRoomVars.properties[2] = &Enemies_LakeHylia_Main;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -5177,8 +5177,8 @@ extern u32 gUnk_080F4EB0;
|
|||
|
||||
u32 sub_unk3_MinishWoods_Main(void) {
|
||||
if (CheckGlobalFlag(ENDING)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080F4EB0;
|
||||
gRoomVars.field_0x6c[2] = NULL;
|
||||
gRoomVars.properties[0] = &gUnk_080F4EB0;
|
||||
gRoomVars.properties[2] = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -5234,9 +5234,9 @@ extern u32 gUnk_080F5348;
|
|||
|
||||
u32 sub_unk3_SanctuaryEntrance_Main(void) {
|
||||
if (CheckGlobalFlag(ENDING)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080F5348;
|
||||
gRoomVars.field_0x6c[7] = sub_0804ED18;
|
||||
gRoomVars.field_0x6c[2] = NULL;
|
||||
gRoomVars.properties[0] = &gUnk_080F5348;
|
||||
gRoomVars.properties[7] = sub_0804ED18;
|
||||
gRoomVars.properties[2] = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -5687,7 +5687,7 @@ extern u32 gUnk_080F7680;
|
|||
|
||||
u32 sub_unk3_HyruleField_EasternHillsNorth(void) {
|
||||
if (GetInventoryValue(ITEM_GUST_JAR) && !GetInventoryValue(ITEM_PACCI_CANE)) {
|
||||
gRoomVars.field_0x6c[2] = &gUnk_080F7680;
|
||||
gRoomVars.properties[2] = &gUnk_080F7680;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -5748,13 +5748,13 @@ extern void sub_0804F4E4(void);
|
|||
|
||||
u32 sub_unk3_HyruleField_OutsideCastle(void) {
|
||||
if (CheckGlobalFlag(TABIDACHI) && !GetInventoryValue(ITEM_GUST_JAR)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080F7CD0;
|
||||
gRoomVars.field_0x6c[7] = sub_0804F5E8;
|
||||
gRoomVars.properties[0] = &gUnk_080F7CD0;
|
||||
gRoomVars.properties[7] = sub_0804F5E8;
|
||||
}
|
||||
if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(ITEM_RED_SWORD) && !CheckLocalFlag(SOUGEN_06_SAIKAI)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080F7C80;
|
||||
gRoomVars.field_0x6c[7] = sub_0804F4E4;
|
||||
gRoomVars.field_0x6c[2] = NULL;
|
||||
gRoomVars.properties[0] = &gUnk_080F7C80;
|
||||
gRoomVars.properties[7] = sub_0804F4E4;
|
||||
gRoomVars.properties[2] = NULL;
|
||||
}
|
||||
#ifndef EU
|
||||
if (CheckGlobalFlag(TABIDACHI)) {
|
||||
|
@ -6255,7 +6255,7 @@ extern u32 gUnk_080F9BF8;
|
|||
|
||||
u32 sub_unk3_VeilFallsTop_Main(void) {
|
||||
if (!CheckKinstoneFused(KINSTONE_E)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080F9BF8;
|
||||
gRoomVars.properties[0] = &gUnk_080F9BF8;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -6541,8 +6541,8 @@ extern u32 gUnk_080FAD48;
|
|||
|
||||
u32 sub_unk3_MtCrenel_MountainTop(void) {
|
||||
if (CheckGlobalFlag(ENDING)) {
|
||||
gRoomVars.field_0x6c[0] = &gUnk_080FAD48;
|
||||
gRoomVars.field_0x6c[2] = NULL;
|
||||
gRoomVars.properties[0] = &gUnk_080FAD48;
|
||||
gRoomVars.properties[2] = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue