mirror of
https://github.com/zeldaret/tmc
synced 2026-07-11 15:28:41 -04:00
Merge pull request #346 from hatal175/sittingperson
This commit is contained in:
+90
-7
@@ -1,17 +1,42 @@
|
||||
#include "npc.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*gUnk_0810CBD8[])(Entity*);
|
||||
extern void (*SittingPersion_Actions[])(Entity*);
|
||||
|
||||
extern Dialog gUnk_0810CC08[];
|
||||
|
||||
extern SpriteLoadData gUnk_0810CB78[];
|
||||
extern u8 gUnk_02002B0E[];
|
||||
extern u16 gUnk_0810CC04[];
|
||||
extern u8 gUnk_02002B0E[];
|
||||
extern u16 gUnk_0810CBE4[][4];
|
||||
extern u8 gUnk_0810CBC0[];
|
||||
extern u8 gUnk_0810CD88[][4];
|
||||
|
||||
extern void sub_08096208(Entity*, u32);
|
||||
void sub_080637B8(Entity* this);
|
||||
|
||||
void SittingPerson(Entity* this) {
|
||||
gUnk_0810CBD8[this->action](this);
|
||||
SittingPersion_Actions[this->action](this);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/sittingPerson/sub_08063758.inc", void sub_08063758(Entity* this))
|
||||
void SittingPersion_Init(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810CB78[this->type * 3])) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.flipX = this->actionDelay;
|
||||
|
||||
if (this->spriteSettings.flipX == 0) {
|
||||
this->animationState = 6;
|
||||
} else {
|
||||
this->animationState = 2;
|
||||
}
|
||||
|
||||
this->actionDelay = this->animationState;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0807DD50(this);
|
||||
sub_080637B8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080637B8(Entity* this) {
|
||||
u32 tmp;
|
||||
@@ -50,11 +75,63 @@ void sub_08063874(Entity* this) {
|
||||
this->animationState = this->actionDelay;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/sittingPerson/sub_0806387C.inc", void sub_0806387C(Entity* this))
|
||||
#if defined(EU) || defined(DEMO_JP) || defined(JP)
|
||||
#define SUB_0806387C_FLAG 0xd7
|
||||
#define SUB_0806387C_FLAG2 0xce
|
||||
#define SUB_0806390C_FLAG 0xd6
|
||||
#else
|
||||
#define SUB_0806387C_FLAG 0xda
|
||||
#define SUB_0806387C_FLAG2 0xd1
|
||||
#define SUB_0806390C_FLAG 0xd9
|
||||
#endif
|
||||
|
||||
ASM_FUNC("asm/non_matching/sittingPerson/sub_0806390C.inc", void sub_0806390C(Entity* this))
|
||||
void sub_0806387C(Entity* this) {
|
||||
s32 r4 = 3;
|
||||
s32 r5;
|
||||
s32 val, val2;
|
||||
u16* ptr;
|
||||
if (CheckLocalFlag(SUB_0806387C_FLAG) == 0) {
|
||||
r4 = 0;
|
||||
SetLocalFlag(SUB_0806387C_FLAG);
|
||||
} else {
|
||||
if (CheckLocalFlag(SUB_0806387C_FLAG2) == 0) {
|
||||
r5 = 0;
|
||||
for (r4 = 1; r4 <= 0x82; r4++) {
|
||||
if (ReadBit(gUnk_02002B0E, r4)) {
|
||||
r5++;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063944(Entity* this, ScriptExecutionContext* context) {
|
||||
r4 = 1;
|
||||
if (r5 > 0x81) {
|
||||
r4 = 2;
|
||||
SetLocalFlag(SUB_0806387C_FLAG2);
|
||||
sub_0807BA8C(0xa17, 1);
|
||||
sub_0807BA8C(0xa57, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val = gSave.global_progress - 6;
|
||||
if (val < 0) {
|
||||
val = 0;
|
||||
}
|
||||
|
||||
MessageNoOverlap(gUnk_0810CBE4[val][r4], this);
|
||||
}
|
||||
|
||||
void sub_0806390C(Entity* this) {
|
||||
u32 r5 = 1;
|
||||
if (CheckLocalFlag(SUB_0806390C_FLAG) == 0) {
|
||||
r5 = 0;
|
||||
SetLocalFlag(SUB_0806390C_FLAG);
|
||||
(*(u32**)&this->cutsceneBeh)[0x5] = 1;
|
||||
}
|
||||
|
||||
MessageNoOverlap(gUnk_0810CC04[r5], this);
|
||||
}
|
||||
|
||||
void SittingPersion_ShowDialogue(Entity* this, ScriptExecutionContext* context) {
|
||||
s32 tmp;
|
||||
|
||||
context->condition = 0;
|
||||
@@ -65,7 +142,13 @@ void sub_08063944(Entity* this, ScriptExecutionContext* context) {
|
||||
ShowNPCDialogue(this, gUnk_0810CC08 + this->type2 * 8 + tmp);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/sittingPerson/SittingPerson_Head.inc", void SittingPerson_Head(Entity* this))
|
||||
void SittingPerson_Head(Entity* this) {
|
||||
u8* ptr = &gUnk_0810CBC0[this->type * 4];
|
||||
SetExtraSpriteFrame(this, 0, *ptr + (this->frame & 0xf));
|
||||
SetExtraSpriteFrame(this, 1, gUnk_0810CD88[this->type][this->frameIndex & 3] + *(ptr + 1));
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_080639D0(Entity* this) {
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
|
||||
Reference in New Issue
Block a user