diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2022-08-05 21:04:33 +0200 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2022-08-05 22:39:02 +0200 |
| commit | 167710b4d400e47d8be7e6d52dee65b2f3caee12 (patch) | |
| tree | d7b6b7c572730cb2ce0ecbecc5c25d897d6a68d4 /src | |
| parent | aa57b04756b7d8a175389075ee705c71a81963af (diff) | |
Decompile some functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/common.c | 130 | ||||
| -rw-r--r-- | src/interrupts.c | 4 | ||||
| -rw-r--r-- | src/object/lilypadLarge.c | 2 | ||||
| -rw-r--r-- | src/object/linkAnimation.c | 2 | ||||
| -rw-r--r-- | src/object/pushableFurniture.c | 92 | ||||
| -rw-r--r-- | src/objectUtils.c | 2 | ||||
| -rw-r--r-- | src/physics.c | 3 | ||||
| -rw-r--r-- | src/player.c | 6 | ||||
| -rw-r--r-- | src/playerUtils.c | 127 | ||||
| -rw-r--r-- | src/vram.c | 50 |
10 files changed, 283 insertions, 135 deletions
diff --git a/src/common.c b/src/common.c index 2c4bdc1a..a8ee1736 100644 --- a/src/common.c +++ b/src/common.c @@ -1,23 +1,25 @@ -#include "global.h" +#include "area.h" #include "asm.h" #include "common.h" -#include "structures.h" -#include "screen.h" -#include "main.h" -#include "area.h" -#include "room.h" -#include "fileselect.h" -#include "game.h" #include "flags.h" -#include "kinstone.h" #include "functions.h" +#include "game.h" +#include "global.h" +#include "kinstone.h" +#include "main.h" #include "message.h" +#include "room.h" +#include "save.h" +#include "screen.h" +#include "sound.h" +#include "structures.h" typedef struct { - u8 _0; - u8 _1; - u8 _2; - u8 _3; + u8 area; + u8 room; + u8 unk_2; + u8 unk_3; + u32 mapDataOffset; } DungeonLayout; extern u8 gUnk_03003DE0; @@ -71,6 +73,18 @@ extern const u32 gUnk_080C9460[]; void sub_0801E82C(void); +extern void* GetRoomProperty(u32, u32, u32); + +extern u8 gMapData; +extern const DungeonLayout** gUnk_080C9C50[]; +extern u8 gMapDataBottomSpecial[]; + +u32 sub_0801DF10(const DungeonLayout* lyt); +bool32 sub_0801DF90(TileEntity* tileEntity, u32 bank); +u32 sub_0801DF60(u32 a1, u8* p); +u32 sub_0801DF78(u32 a1, u32 a2); +void sub_0801DF28(u32 x, u32 y, s32 color); + u32 DecToHex(u32 value) { u32 result; register u32 r1 asm("r1"); @@ -386,7 +400,7 @@ u32 sub_0801DB94(void) { return gRoomTransition.player_status.dungeon_map_y >> 11; } -ASM_FUNC("asm/non_matching/common/DrawDungeonMap.inc", void DrawDungeonMap(u32 floor, struct_02019EE0* data, u32 size)); +ASM_FUNC("asm/non_matching/common/DrawDungeonMap.inc", void DrawDungeonMap(u32 floor, void* data, u32 size)); void sub_0801DD58(u32 area, u32 room) { RoomHeader* hdr = gAreaRoomHeaders[area] + room; @@ -398,15 +412,81 @@ void LoadDungeonMap(void) { LoadResourceAsync(gUnk_0201AEE0, 0x6006000, sizeof(gUnk_0201AEE0)); } -ASM_FUNC("asm/non_matching/common/DrawDungeonFeatures.inc", void DrawDungeonFeatures(u32 room, void* data, u32 size)); +void DrawDungeonFeatures(u32 floor, void* data, u32 size) { + u32 bankOffset; + u32 width; + u32 height; + u32 x; + u32 y; + u16 mapX; + u16 mapY; + u32 tmp; + u32 tmp2; + u32 color; + u32 features; + TileEntity* tileEntity; + RoomHeader* roomHeader; + const DungeonLayout* layout; + const DungeonLayout* nextLayout; + u8* ptr; + u32 tmp3; + u32 tmp4; + + if (!AreaHasMap()) { + return; + } + layout = gUnk_080C9C50[gArea.dungeon_idx][floor]; + MemClear(gMapDataBottomSpecial, 0x8000); + while (layout->area != 0) { + tileEntity = (TileEntity*)GetRoomProperty(layout->area, layout->room, 3); + bankOffset = sub_0801DF10(layout); + features = 0; + if (layout->area == gUI.roomControls.area && layout->room == gUI.roomControls.room) { + features = 8; + } else { + if (HasDungeonSmallKey()) { + features = 2; + } + if (sub_0801DF90(tileEntity, bankOffset)) { + features = 3; + } + } + if ((layout->unk_2 & 1) != 0) { + features = 0; + } + nextLayout = layout + 1; + if (features != 0) { + DmaCopy32(3, &gMapData + layout->mapDataOffset, &gMapDataBottomSpecial, 0x400); + + roomHeader = gAreaRoomHeaders[layout->area] + layout->room; + mapX = roomHeader->map_x / 0x10; + tmp3 = roomHeader->map_y; + tmp4 = 0x7ff; + mapY = (tmp3 & tmp4) / 0x10; + width = roomHeader->pixel_width / 0x10; + height = roomHeader->pixel_height / 0x10; + tmp = (width + 3) / 4; + + for (y = 0; y < height; y++) { + ptr = gMapDataBottomSpecial + y * tmp; + for (x = 0; x < width; x++) { + tmp2 = mapX + x; + color = sub_0801DF78(sub_0801DF60(x, ptr), features); + sub_0801DF28(tmp2, mapY + y, color); + } + } + } + layout = nextLayout; + } +} -u32 sub_0801DF10(DungeonLayout* lyt) { +u32 sub_0801DF10(const DungeonLayout* lyt) { u32 offset; - if (lyt->_3 == 1) + if (lyt->unk_3 == 1) offset = 0x300; else - offset = GetFlagBankOffset(lyt->_0); + offset = GetFlagBankOffset(lyt->area); return offset; } @@ -435,15 +515,15 @@ u32 sub_0801DF78(u32 a1, u32 a2) { } } -u32 sub_0801DF90(u8* a1, u32 a2) { - if (a1 == NULL) - return 0; +bool32 sub_0801DF90(TileEntity* tileEntity, u32 bank) { + if (tileEntity == NULL) + return FALSE; - for (; *a1 != 0; a1 += 8) { - if (*a1 == 1) - return CheckLocalFlagByBank(a2, a1[1]); + for (; tileEntity->type != 0; tileEntity++) { + if (tileEntity->type == 1) + return CheckLocalFlagByBank(bank, tileEntity->localFlag); } - return 0; + return FALSE; } void sub_0801DFB4(Entity* entity, u32 textIndex, u32 a3, u32 a4) { diff --git a/src/interrupts.c b/src/interrupts.c index b0a6be57..7d5c162d 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -246,8 +246,8 @@ static void HandlePlayerLife(Entity* this) { gPlayerState.framestate_last = gPlayerState.framestate; gPlayerState.framestate = PL_STATE_IDLE; - if (gPlayerState.field_0x82[0x8] != 0) { - gPlayerState.field_0x82[0x8]--; + if (gPlayerState.field_0x8a != 0) { + gPlayerState.field_0x8a--; return; } diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index a36f8277..570ffb09 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -123,7 +123,7 @@ void sub_080855E8(LilypadLargeEntity* this) { gPlayerEntity.collisionFlags &= 0xfb; gPlayerState.swim_state = 0; } - *(u32*)&gPlayerState.field_0x82[2] = (u32)this; // TODO + gPlayerState.lilypad = super; if (super->collisionLayer == 1) { ResetCollisionLayer(&gPlayerEntity); } else { diff --git a/src/object/linkAnimation.c b/src/object/linkAnimation.c index fa76b9dc..7d5d2cae 100644 --- a/src/object/linkAnimation.c +++ b/src/object/linkAnimation.c @@ -113,7 +113,7 @@ void LinkAnimation_Action8(LinkAnimationEntity* this) { gPlayerState.field_0x27[0] = this->unk_6e; gPlayerState.mobility = this->unk_6f; gPlayerState.flags = this->unk_70; - gPlayerState.field_0x82[8] = this->unk_74; + gPlayerState.field_0x8a = this->unk_74; } break; } diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index 22efed6f..ff6b627c 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -58,14 +58,8 @@ void PushableFurniture(PushableFurnitureEntity* this) { } } -NONMATCH("asm/non_matching/pushableFurniture/sub_0808F990.inc", void sub_0808F990(PushableFurnitureEntity* this)) { - s32 uVar1; - bool32 bVar2; - u32 uVar3; - u32 sVar4; - u16 uVar5; - SpritePriority* pSVar6; - Entity* pEVar7; +void sub_0808F990(PushableFurnitureEntity* this) { + bool32 condition; super->action = 1; super->speed = 0x80; @@ -88,58 +82,54 @@ NONMATCH("asm/non_matching/pushableFurniture/sub_0808F990.inc", void sub_0808F99 super->frameIndex = 0; } } - switch (super->subtimer) { - default: - bVar2 = FALSE; - if (*(u16*)&super->type == 0x101) { - uVar1 = (s8)super->subtimer; - sVar4 = super->y.HALF_U.HI; - } else { - uVar1 = (s8)super->subtimer; - sVar4 = super->x.HALF_U.HI; - } - this->unk_7e = sVar4 + (u32)uVar1; - if (super->parent == NULL) { - uVar3 = CheckFlags((u32)this->unk_86); - } else { - if ((this->unk_82 & 0x80) != 0) { - if (super->parent->action == 2) { - bVar2++; + if (super->subtimer != 0) { + condition = FALSE; + switch (super->subtimer) { + default: + if (super->type == 1 && super->type2 == 1) { + this->unk_7e = (s8)super->subtimer + super->y.HALF_U.HI; + } else { + this->unk_7e = (s8)super->subtimer + super->x.HALF_U.HI; + } + if (super->parent == NULL) { + if (CheckFlags(this->unk_86)) { + condition++; + } + } else { + if ((this->unk_82 & 0x80) != 0) { + if (super->parent->action == 2) { + condition++; + } + break; + } + if (CheckLocalFlag((u32)this->unk_82)) { + condition++; } - break; } - uVar3 = CheckLocalFlag((u32)this->unk_82); - } - if (uVar3 != 0) { - bVar2++; - } - break; - case 0: - bVar2 = FALSE; - break; - case 0x80: - bVar2 = TRUE; - if (*(u16*)&super->type == 0x101) { - uVar5 = super->y.HALF.HI; + + break; + case 0x80: + condition = TRUE; + if (super->type == 1 && super->type2 == 1) { + this->unk_7e = super->y.HALF.HI; + } else { + this->unk_7e = super->x.HALF.HI; + } + break; + } + + if (condition) { + this->unk_81 = 1; + if (super->type == 1 && super->type2 == 1) { + super->y.HALF.HI = this->unk_7e; } else { - uVar5 = super->x.HALF.HI; + super->x.HALF.HI = this->unk_7e; } - this->unk_7e = uVar5; - break; - } - - if (bVar2) { - this->unk_81 = 1; - if (*(u16*)&super->type == 0x101) { - super->y.HALF.HI = this->unk_7e; - } else { - super->x.HALF.HI = this->unk_7e; } } sub_0808FF50(this); } -END_NONMATCH void PushableFurniture_Action1(PushableFurnitureEntity* this) { if (this->unk_81 == 0) { diff --git a/src/objectUtils.c b/src/objectUtils.c index 42ef2df5..7b748c6d 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -35,7 +35,7 @@ Entity* sub_080A276C(Entity* parent, u32 type, u32 type2) { e->field_0x6e.HALF.LO = gPlayerState.field_0x27[0]; e->field_0x6e.HALF.HI = gPlayerState.mobility; e->field_0x70.WORD = gPlayerState.flags; - e->field_0x74.HALF.LO = gPlayerState.field_0x82[8]; + e->field_0x74.HALF.LO = gPlayerState.field_0x8a; gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.spriteSettings.draw = 0; } diff --git a/src/physics.c b/src/physics.c index fbe503c1..064dc466 100644 --- a/src/physics.c +++ b/src/physics.c @@ -399,14 +399,13 @@ bool32 CheckPlayerProximity(u32 x, u32 y, u32 distX, u32 DistY) { } NONMATCH("asm/non_matching/coord/sub_0806FC24.inc", bool32 sub_0806FC24(u32 param_1, u32 param_2)) { - u32 rv; + register u32 rv asm("r0"); u32 val = sub_08007DD6(param_1, gUnk_080046A4); if (val) { rv = (*(gUnk_080047F6 + (val << 2)) >> param_2) & 0x1; } else { rv = 0; } - return rv; } END_NONMATCH diff --git a/src/player.c b/src/player.c index af48dcf4..ce8056b4 100644 --- a/src/player.c +++ b/src/player.c @@ -1977,7 +1977,7 @@ static void sub_080724DC(Entity* this) { this->knockbackDuration = 0; DeleteClones(); if (GetTileUnderEntity(this) != 0x29) { - if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swim_state != 0)) { + if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) { sub_0807AE20(this); } if (gRoomControls.reload_flags == 0) { @@ -2019,7 +2019,7 @@ static void sub_0807258C(Entity* this) { PlayerWaitForScroll(this); } } - if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swim_state != 0)) { + if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) { sub_0807AE20(this); } } @@ -3606,7 +3606,7 @@ static void sub_08074808(Entity* this) { else gPlayerState.swim_state = 8; this->speed = 0; - gPlayerState.field_0x82[7] = 0; + gPlayerState.remainingDiveTime = 0; if ((gPlayerState.flags & PL_MINISH) == 0) CreateFx(this, FX_WATER_SPLASH, 0); SoundReq(SFX_1A5); diff --git a/src/playerUtils.c b/src/playerUtils.c index 31dbb3fc..2f1b806b 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1163,7 +1163,7 @@ void sub_08078B48(void) { break; } gPlayerEntity.iframes = -2; - gPlayerState.field_0x82[8] = 2; + gPlayerState.field_0x8a = 2; } void ClearPlayerState(void) { @@ -1299,53 +1299,49 @@ bool32 sub_08078F74(Entity* this) { } } -NONMATCH("asm/non_matching/playerUtils/sub_08078FB0.inc", void sub_08078FB0(Entity* this)) { - u32 bVar2; - u32 animation; +void sub_08078FB0(Entity* this) { + u32 animIndex; if ((gPlayerState.pushedObject & 0x80) == 0) { gPlayerState.field_0x35 = 0xff; } sub_08079064(this); if ((gPlayerState.flags & 8) != 0) { - bVar2 = 0x58; + animIndex = 0x58; } else { if ((gPlayerState.flags & 0x80) != 0) { - bVar2 = 0x18; + animIndex = 0x18; } else { if (gPlayerState.animation >> 8 == 7) { - bVar2 = 0x34; + animIndex = 0x34; } else { - bVar2 = 0xb8; + animIndex = 0xb8; } } } - if (bVar2 > gPlayerState.animation) { - u32 temp = this->animationState; - bVar2 = temp; - if (bVar2 >= 5) { + if (animIndex > (u8)gPlayerState.animation) { + if (this->animationState >= 5) { this->spriteSettings.flipX = 1; } else { this->spriteSettings.flipX = 0; } if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) { - bVar2 = gPlayerState.animation + this->animationState; + animIndex = gPlayerState.animation + this->animationState; } else { - bVar2 = (((u8)bVar2) >> 1) + gPlayerState.animation; + animIndex = (this->animationState >> 1) + gPlayerState.animation; } } else { - bVar2 = gPlayerState.animation; + animIndex = gPlayerState.animation; } - if (bVar2 != (((u16)this->spriteIndex << 8) | this->animIndex)) { - this->spriteIndex = bVar2 >> 8; - bVar2 &= 0xff; - InitAnimationForceUpdate(this, bVar2); + if (animIndex != (((u16)this->spriteIndex << 8) | this->animIndex)) { + this->spriteIndex = animIndex >> 8; + animIndex &= 0xff; + InitAnimationForceUpdate(this, animIndex); } } -END_NONMATCH void sub_08079064(Entity* this) { u32 i; @@ -1496,7 +1492,47 @@ bool32 sub_080793E4(u32 param_1) { } } -ASM_FUNC("asm/non_matching/playerUtils/RespawnPlayer.inc", void RespawnPlayer()) +void RespawnPlayer(void) { + u32* ptr1; + u32 index; + Entity* player = &gPlayerEntity; + + player->action = PLAYER_080728AC; + player->z.WORD = 0; + player->zVelocity = 0; + player->knockbackDuration = 0; + ResetPlayerPosition(); + if ((gPlayerState.flags & 0x20000) == 0) { + if ((gPlayerState.flags & 0x10000) != 0) { + player->x.HALF.HI = gPlayerState.lilypad->x.HALF.HI; + player->y.HALF.HI = gPlayerState.lilypad->y.HALF.HI; + } else { + goto code_1; + code_0: + gPlayerEntity.collisionLayer = *ptr1 >> 0x1e; + gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + (*ptr1 & 0x3f) * 16 + 8; + gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + (*ptr1 & 0xfc0) / 4 + 8; + COLLISION_ON(&gPlayerEntity); + goto code_3; + code_1: + index = 0; + if (gPlayerState.path_memory[0] != 0xffffffff) { + ptr1 = gPlayerState.path_memory; + while (sub_080B1B44((u16)*ptr1, *ptr1 >> 0x1e) == 0xf) { + ptr1++; + index++; + if ((index > 0xf) || (*ptr1 == -1)) { + goto code_3; + break; + } + } + goto code_0; + } + } + } +code_3: + UpdateSpriteForCollisionLayer(&gPlayerEntity); +} void sub_08079520(Entity* this) { s32 tmp = gPlayerState.field_0xd; @@ -1904,8 +1940,8 @@ void sub_0807A050(void) { gPlayerState.hurtBlinkSpeed--; } palette = sub_0807A094(0); - if (palette != gPlayerState.field_0x82[1]) { - gPlayerState.field_0x82[1] = palette; + if (palette != gPlayerState.playerPalette) { + gPlayerState.playerPalette = palette; ChangeObjPalette(&gPlayerEntity, palette); } } @@ -2199,13 +2235,13 @@ void sub_0807ACCC(Entity* this) { } else { this->speed -= 4; } - if (gPlayerState.field_0x82[7] == 0) { + if (gPlayerState.remainingDiveTime == 0) { if (!sub_0807ADB8(this)) { sub_0807AE20(this); } } else { - gPlayerState.field_0x82[7]--; - if (gPlayerState.field_0x82[7] != 0) { + gPlayerState.remainingDiveTime--; + if (gPlayerState.remainingDiveTime != 0) { sub_0807ADB8(this); } else { gPlayerState.swim_state &= 0x7f; @@ -2227,10 +2263,10 @@ bool32 sub_0807ADB8(Entity* this) { gPlayerState.swim_state ^= 0x80; tmp = (gPlayerState.swim_state & 0x80); if (tmp != 0) { - gPlayerState.field_0x82[7] = 0x78; + gPlayerState.remainingDiveTime = 0x78; } else { this->spritePriority.b0 = 4; - gPlayerState.field_0x82[7] = tmp; + gPlayerState.remainingDiveTime = tmp; } SoundReq(SFX_163); return TRUE; @@ -3291,15 +3327,13 @@ void sub_0807C69C(u8* data, u32 width, u32 height) { } } -NONMATCH("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera()) { +void InitializeCamera() { s32 targetX; s32 targetY; Entity* target; RoomControls* roomControls; u32 tmp1; u32 tmp2; - u32 tmp3; - u32 tmp4; sub_0807BFD0(); LoadRoomGfx(); @@ -3307,15 +3341,15 @@ NONMATCH("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera( target = gRoomControls.camera_target; if (target != NULL) { if ((target->x.HALF_U.HI * 0x10000) < 0) { - tmp3 = (target->x.HALF.HI & 0x7fff); - tmp3 -= gRoomControls.origin_x; - target->x.HALF.HI = tmp3; + tmp1 = (target->x.HALF.HI & 0x7fff); + tmp1 -= gRoomControls.origin_x; + target->x.HALF.HI = tmp1; } targetX = target->x.HALF.HI; if ((target->y.HALF_U.HI * 0x10000) < 0) { - tmp4 = (target->y.HALF.HI & 0x7fff); - tmp4 -= gRoomControls.origin_y; - target->y.HALF.HI = tmp4; + tmp2 = (target->y.HALF.HI & 0x7fff); + tmp2 -= gRoomControls.origin_y; + target->y.HALF.HI = tmp2; } targetY = target->y.HALF.HI; } else { @@ -3326,26 +3360,24 @@ NONMATCH("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera( if (targetX < 0x78) { roomControls->scroll_x = 0; } else { - if (targetX >= (roomControls->width - 0x78)) { - tmp1 = roomControls->width - 0x78; + if ((roomControls->width - 0x78) < targetX) { + roomControls->scroll_x = roomControls->width - 0x78 - 0x78; } else { - tmp1 = targetX; + roomControls->scroll_x = targetX - 0x78; } - roomControls->scroll_x = tmp1 - 0x78; } - roomControls->scroll_x = roomControls->origin_x + roomControls->scroll_x; + roomControls->scroll_x += roomControls->origin_x; if (targetY < 0x50) { roomControls->scroll_y = 0; } else { - if (targetY >= (roomControls->height - 0x50)) { - tmp2 = roomControls->height - 0x50; + if ((roomControls->height - 0x50) < targetY) { + roomControls->scroll_y = roomControls->height - 0x50 - 0x50; } else { - tmp2 = targetY; + roomControls->scroll_y = targetY - 0x50; } - roomControls->scroll_y = tmp2 - 0x50; } - roomControls->scroll_y = roomControls->scroll_y + roomControls->origin_y; + roomControls->scroll_y += roomControls->origin_y; if (roomControls->camera_target != NULL) { roomControls->camera_target->x.HALF.HI += roomControls->origin_x; @@ -3358,7 +3390,6 @@ NONMATCH("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera( roomControls->scroll_flags &= 0xfb; sub_08080BC4(); } -END_NONMATCH void sub_0807C810(void) { DiggingCaveEntranceTransition* ptr; @@ -101,7 +101,55 @@ void sub_080ADE24(void) { } // Transfer gfx slot data to vram? -ASM_FUNC("asm/non_matching/vram/sub_080ADE74.inc", void sub_080ADE74(u32 index)) +void sub_080ADE74(u32 index) { + void* dest; + GfxSlot* slot; + struct_gUnk_020000C0_1* ptr1; + s32 palIndex; + s32 loopIndex; + s32 tmp1; + + slot = gGFXSlots.slots + index; + if (slot->vramStatus != 0) { + slot->vramStatus = 1; + if (((slot->paletteIndex != 0xffff) && (slot->unk_3 != 0))) { + ptr1 = (struct_gUnk_020000C0_1*)(gUnk_020000C0 + slot->unk_3); + for (loopIndex = 4; loopIndex > 0; loopIndex--) { + if (ptr1->unk_00.unk2 != 0 && (gGFXSlots.unk_3 != 0 || ptr1->unk_00.unk3 != 0)) { + ptr1->unk_00.unk3 = 0; + palIndex = ptr1->unk_08.BYTES.byte1 << 5; + if (palIndex != 0) { + dest = (void*)(*(u16*)((s32)&ptr1->unk_08 + 2) * 0x20 + OBJ_VRAM0); + DmaCopy32(3, ptr1->unk_0C, dest, palIndex); + } + } + ptr1++; + } + } else { + dest = (void*)(index * 0x200 + OBJ_VRAM0 + 0x2800); + switch (slot->paletteIndex) { + default: + DmaCopy32(3, slot->palettePointer, dest, (u32)slot->paletteIndex << 5); + palIndex = slot->paletteIndex; + palIndex -= 0x10; + break; + case 0: + slot->vramStatus = 0; + return; + case 0xffff: + if (slot->unk_3 == 0) { + LZ77UnCompVram(slot->palettePointer, dest); + } + return; + } + while (palIndex > 0) { + slot++; + slot[0].paletteIndex = 0; + palIndex -= 0x10; + } + } + } +} bool32 LoadFixedGFX(Entity* entity, u32 gfxIndex) { #ifdef EU |
