mirror of https://github.com/zeldaret/tmc.git
				
				
				
			Two functions in townMinish.c OK
Also created npc.h and format.sh'd various files. A third function is outlined in townMinish.c, but currently non-matching.
This commit is contained in:
		
							parent
							
								
									a54ec31a56
								
							
						
					
					
						commit
						06f2cd289d
					
				| 
						 | 
				
			
			@ -6,68 +6,6 @@
 | 
			
		|||
 | 
			
		||||
	.text
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	thumb_func_start sub_0806ABC8
 | 
			
		||||
sub_0806ABC8: @ 0x0806ABC8
 | 
			
		||||
	push {r4, lr}
 | 
			
		||||
	adds r4, r0, #0
 | 
			
		||||
	ldrb r1, [r4, #0x10]
 | 
			
		||||
	movs r0, #2
 | 
			
		||||
	ands r0, r1
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	bne _0806ABF4
 | 
			
		||||
	ldr r0, _0806ABF0 @ =gUnk_081126E8
 | 
			
		||||
	ldrb r1, [r4, #0xc]
 | 
			
		||||
	lsls r1, r1, #2
 | 
			
		||||
	adds r1, r1, r0
 | 
			
		||||
	ldr r1, [r1]
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl _call_via_r1
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_0806ED78
 | 
			
		||||
	b _0806ABFA
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_0806ABF0: .4byte gUnk_081126E8
 | 
			
		||||
_0806ABF4:
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_0806ACC4
 | 
			
		||||
_0806ABFA:
 | 
			
		||||
	pop {r4, pc}
 | 
			
		||||
 | 
			
		||||
	thumb_func_start sub_0806ABFC
 | 
			
		||||
sub_0806ABFC: @ 0x0806ABFC
 | 
			
		||||
	push {r4, lr}
 | 
			
		||||
	adds r4, r0, #0
 | 
			
		||||
	ldrb r1, [r4, #0xa]
 | 
			
		||||
	lsls r1, r1, #4
 | 
			
		||||
	ldr r0, _0806AC38 @ =gUnk_08112674
 | 
			
		||||
	adds r1, r1, r0
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_0806FDEC
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _0806AC36
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	movs r1, #2
 | 
			
		||||
	bl InitializeAnimation
 | 
			
		||||
	movs r1, #0
 | 
			
		||||
	movs r0, #1
 | 
			
		||||
	strb r0, [r4, #0xc]
 | 
			
		||||
	ldrb r0, [r4, #0xe]
 | 
			
		||||
	adds r2, r4, #0
 | 
			
		||||
	adds r2, #0x6a
 | 
			
		||||
	strb r0, [r2]
 | 
			
		||||
	lsls r0, r0, #1
 | 
			
		||||
	strb r0, [r4, #0x14]
 | 
			
		||||
	ldrb r0, [r4, #0x14]
 | 
			
		||||
	lsls r0, r0, #2
 | 
			
		||||
	subs r2, #1
 | 
			
		||||
	strb r0, [r2]
 | 
			
		||||
	strb r1, [r4, #0xe]
 | 
			
		||||
_0806AC36:
 | 
			
		||||
	pop {r4, pc}
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_0806AC38: .4byte gUnk_08112674
 | 
			
		||||
 | 
			
		||||
	thumb_func_start sub_0806AC3C
 | 
			
		||||
sub_0806AC3C: @ 0x0806AC3C
 | 
			
		||||
	push {r4, r5, lr}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
#include "global.h"
 | 
			
		||||
#include "entity.h"
 | 
			
		||||
 | 
			
		||||
#ifndef NPC_H
 | 
			
		||||
#define NPC_H
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  u16 palette;
 | 
			
		||||
  u8 animIndex;
 | 
			
		||||
  u8 unk;
 | 
			
		||||
} SpriteLoadThing;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -519,6 +519,7 @@ SECTIONS {
 | 
			
		|||
		asm/dog.o(.text);
 | 
			
		||||
		asm/syrup.o(.text);
 | 
			
		||||
		asm/rem.o(.text);
 | 
			
		||||
		src/townMinish.o(.text);
 | 
			
		||||
		asm/townMinish.o(.text);
 | 
			
		||||
		asm/librari.o(.text);
 | 
			
		||||
		asm/percy.o(.text);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,4 +108,4 @@ void (*const gEnemyFunctions[])(Entity* ent) = {
 | 
			
		|||
    TreeItem,
 | 
			
		||||
    Enemy66
 | 
			
		||||
};
 | 
			
		||||
// clang-format on
 | 
			
		||||
// clang-format on
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,4 +16,4 @@ void Object1C(Entity *this)
 | 
			
		|||
    this->parent->field_0x20 &= ~(1 << this->entityType.parameter2);
 | 
			
		||||
    DeleteThisEntity();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,4 +15,4 @@ void sub_080874F8(Entity* this)
 | 
			
		|||
  DeleteThisEntity();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nullsub_117(){}
 | 
			
		||||
void nullsub_117(){}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,4 +33,4 @@ void ObjectA8(Entity *this)
 | 
			
		|||
  }
 | 
			
		||||
  gUnk_08124824[this->action](this);
 | 
			
		||||
  sub_08080CB4(this);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,4 +66,4 @@ void sub_08031704(Entity *this)
 | 
			
		|||
{
 | 
			
		||||
  sub_0804A720(this);
 | 
			
		||||
  sub_080317F8(this);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
#include "global.h"
 | 
			
		||||
#include "entity.h"
 | 
			
		||||
#include "npc.h"
 | 
			
		||||
 | 
			
		||||
extern void InitializeAnimation(Entity *, u32);
 | 
			
		||||
 | 
			
		||||
extern void sub_0806ED78(Entity *);
 | 
			
		||||
 | 
			
		||||
extern void (*gUnk_081126E8[])();
 | 
			
		||||
extern void sub_0806ACC4(Entity *);
 | 
			
		||||
 | 
			
		||||
extern u32 sub_0806FDEC(Entity *, SpriteLoadThing *);
 | 
			
		||||
extern SpriteLoadThing gUnk_08112674[];
 | 
			
		||||
 | 
			
		||||
void sub_0806ABC8(Entity *this)
 | 
			
		||||
{
 | 
			
		||||
    if ((this->flags & 2) == 0) {
 | 
			
		||||
        (*gUnk_081126E8[this->action])(this);
 | 
			
		||||
        sub_0806ED78(this);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        sub_0806ACC4(this);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_0806ABFC(Entity *this)
 | 
			
		||||
{
 | 
			
		||||
    u8 animationState;
 | 
			
		||||
 | 
			
		||||
    SpriteLoadThing* spriteLoadThing = &gUnk_08112674[this->entityType.parameter1 << 2];
 | 
			
		||||
    if (!sub_0806FDEC(this, spriteLoadThing))
 | 
			
		||||
    {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    InitializeAnimation(this, 2);
 | 
			
		||||
    this->action = 1;
 | 
			
		||||
    this->field_0x6a.HALF.LO = this->parameter3;
 | 
			
		||||
 | 
			
		||||
    this->animationState = this->field_0x6a.HALF.LO << 1;
 | 
			
		||||
    animationState = this->animationState;
 | 
			
		||||
    this->field_0x69 = animationState << 2;
 | 
			
		||||
 | 
			
		||||
    this->parameter3 = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Not matching yet, not 100% sure it's functionally identical
 | 
			
		||||
/*void sub_0806AC3C(Entity *this) {
 | 
			
		||||
    if (this->field_0x58 <= 3) {
 | 
			
		||||
        s32 unk;
 | 
			
		||||
        u8 field_0x69;
 | 
			
		||||
 | 
			
		||||
        Entity *link = &gLinkEntity;
 | 
			
		||||
        if (sub_080041A0(this, link, 0x18, 0x18)) {
 | 
			
		||||
            unk = sub_080045C4(this, link) & (u8)0x1e;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            unk = this->animationState << 2;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        field_0x69 = this->field_0x69;
 | 
			
		||||
 | 
			
		||||
        if (unk != field_0x69) {
 | 
			
		||||
            s32 temp;
 | 
			
		||||
 | 
			
		||||
            if (((unk - field_0x69) & 0x1f) <= 0xf) {
 | 
			
		||||
                field_0x69--;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                field_0x69++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            temp = field_0x69;
 | 
			
		||||
            this->field_0x69 = temp & 0x1f;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!(this->field_0x69 & 7)) {
 | 
			
		||||
            this->animationState = sub_0806F5B0(this->field_0x69);
 | 
			
		||||
            UpdateSprite(this, (this->animationState >> 1) ^ 2);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    sub_080042B8(this);
 | 
			
		||||
}*/
 | 
			
		||||
		Loading…
	
		Reference in New Issue