tik_05 functions (#699)

* matched func_802DE748, thanks stuckpixel

* revert changes made while experimenting

* matched func_8024093C_8756FC

* deleted func_802DE748 assembly

* fixed some small things

* fixed access to ptrReadPosition in func_8024093C_8756FC

* removed random whitespace

* small changes

* match

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
This commit is contained in:
Kevin Klions 2022-04-21 12:07:22 -04:00 committed by GitHub
parent 80f5e18fc9
commit e85761f7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 47 deletions

View File

@ -285,6 +285,7 @@ void clear_virtual_entity_list(void);
void reset_model_animators(void); void reset_model_animators(void);
void init_virtual_entity_list(void); void init_virtual_entity_list(void);
void init_model_animators(void); void init_model_animators(void);
void play_model_animation(s32, s32);
s32 heap_free(void* ptr); s32 heap_free(void* ptr);
void btl_state_update_normal_start(void); void btl_state_update_normal_start(void);

View File

@ -5,7 +5,7 @@ s32 func_802B7000_2(void) {
s8 actionState = gPlayerActionState; s8 actionState = gPlayerActionState;
if (actionState != ACTION_STATE_USE_TWEESTER) { if (actionState != ACTION_STATE_USE_TWEESTER) {
if (partnerActionStatus->partnerActionState != PARTNER_ACTION_USE || if (partnerActionStatus->partnerActionState != PARTNER_ACTION_USE ||
(partnerActionStatus->actingPartner != PARTNER_BOW (partnerActionStatus->actingPartner != PARTNER_BOW
&& partnerActionStatus->actingPartner != PARTNER_PARAKARRY)) { && partnerActionStatus->actingPartner != PARTNER_PARAKARRY)) {
return 0; return 0;

View File

@ -345,7 +345,27 @@ s32 func_802DE5C8(s32 arg0) {
INCLUDE_ASM(s32, "sprite", spr_free_sprite); INCLUDE_ASM(s32, "sprite", spr_free_sprite);
INCLUDE_ASM(s32, "sprite", func_802DE748); typedef struct {
/* 0x00 */ char unk_00[0x4F];
/* 0x4F */ u8 unk_4F;
} Unk802DE748_2;
typedef struct {
/* 0x00 */ Unk802DE748_2** unk_00;
/* 0x04 */ char unk_04[0x10];
} Unk802DE748; // size = 0x14
extern Unk802DE748 D_802DFA4C[];
s32 func_802DE748(s32 arg0, s32 arg1) {
Unk802DE748_2** unk_00 = D_802DFA4C[arg0].unk_00;
if (unk_00 == NULL) {
return -1;
}
return unk_00[arg1]->unk_4F;
}
INCLUDE_ASM(s32, "sprite", func_802DE780); INCLUDE_ASM(s32, "sprite", func_802DE780);
@ -368,7 +388,7 @@ s32 spr_get_npc_raster_info(SpriteRasterInfo* out, s32 npcSpriteID, s32 rasterIn
UnkSpriteStruct* temp_v1; UnkSpriteStruct* temp_v1;
s32** paletteOffsetCopy; s32** paletteOffsetCopy;
s32 newVar; s32 newVar;
if (sprite != NULL) { if (sprite != NULL) {
paletteOffsetCopy = sprite->palettesOffset; paletteOffsetCopy = sprite->palettesOffset;
temp_v1 = (UnkSpriteStruct*)sprite->rastersOffset[rasterIndex]; temp_v1 = (UnkSpriteStruct*)sprite->rastersOffset[rasterIndex];

View File

@ -184,7 +184,7 @@ s32 func_802DE5C8(s32 arg0);
s32 spr_free_sprite(s32 spriteInstanceID); s32 spr_free_sprite(s32 spriteInstanceID);
//s32 func_802DE748(); // TODO s32 func_802DE748(s32, s32); // TODO
s32 func_802DE780(s32, s32, s32, s32, s32, s32, s32, s32); s32 func_802DE780(s32, s32, s32, s32, s32, s32, s32, s32);

View File

@ -1,4 +1,7 @@
#include "tik_05.h" #include "tik_05.h"
#include "battle/battle.h"
#include "effects.h"
#include "functions.h"
#include "world/common/UnkPosFunc2.inc.c" #include "world/common/UnkPosFunc2.inc.c"
@ -10,6 +13,18 @@
#include "world/common/CheckItemFlags40.inc.c" #include "world/common/CheckItemFlags40.inc.c"
INCLUDE_ASM(s32, "world/area_tik/tik_05/8750D0", func_8024093C_8756FC); extern s32 D_000001E4;
ApiStatus func_8024093C_8756FC(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Entity* entity = get_entity_by_index(evt_get_variable(script, *args++));
if (entity == NULL) {
return ApiStatus_BLOCK;
}
play_model_animation(entity->virtualModelIndex, &D_000001E4);
return ApiStatus_DONE2;
}
#include "world/common/SetEntityPosition.inc.c" #include "world/common/SetEntityPosition.inc.c"

View File

@ -1,19 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802DE748
/* 101838 802DE748 00041080 */ sll $v0, $a0, 2
/* 10183C 802DE74C 00441021 */ addu $v0, $v0, $a0
/* 101840 802DE750 00021080 */ sll $v0, $v0, 2
/* 101844 802DE754 3C03802E */ lui $v1, %hi(D_802DFA4C)
/* 101848 802DE758 00621821 */ addu $v1, $v1, $v0
/* 10184C 802DE75C 8C63FA4C */ lw $v1, %lo(D_802DFA4C)($v1)
/* 101850 802DE760 10600005 */ beqz $v1, .L802DE778
/* 101854 802DE764 00051080 */ sll $v0, $a1, 2
/* 101858 802DE768 00431021 */ addu $v0, $v0, $v1
/* 10185C 802DE76C 8C420000 */ lw $v0, ($v0)
/* 101860 802DE770 03E00008 */ jr $ra
/* 101864 802DE774 9042004F */ lbu $v0, 0x4f($v0)
.L802DE778:
/* 101868 802DE778 03E00008 */ jr $ra
/* 10186C 802DE77C 2402FFFF */ addiu $v0, $zero, -1

View File

@ -1,23 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8024093C_8756FC
/* 8756FC 8024093C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 875700 80240940 AFBF0010 */ sw $ra, 0x10($sp)
/* 875704 80240944 8C82000C */ lw $v0, 0xc($a0)
/* 875708 80240948 0C0B1EAF */ jal evt_get_variable
/* 87570C 8024094C 8C450000 */ lw $a1, ($v0)
/* 875710 80240950 0C04417A */ jal get_entity_by_index
/* 875714 80240954 0040202D */ daddu $a0, $v0, $zero
/* 875718 80240958 50400007 */ beql $v0, $zero, .L80240978
/* 87571C 8024095C 0000102D */ daddu $v0, $zero, $zero
/* 875720 80240960 84440014 */ lh $a0, 0x14($v0)
/* 875724 80240964 3C050000 */ lui $a1, 0
/* 875728 80240968 24A501E4 */ addiu $a1, $a1, 0x1e4
/* 87572C 8024096C 0C048052 */ jal play_model_animation
/* 875730 80240970 00000000 */ nop
/* 875734 80240974 24020002 */ addiu $v0, $zero, 2
.L80240978:
/* 875738 80240978 8FBF0010 */ lw $ra, 0x10($sp)
/* 87573C 8024097C 03E00008 */ jr $ra
/* 875740 80240980 27BD0018 */ addiu $sp, $sp, 0x18