Put const data in acroBandits + renames

This commit is contained in:
Tal Hayon 2022-03-24 06:32:01 +02:00
parent 65d6fbb5f9
commit 92e7aaa89b
4 changed files with 87 additions and 126 deletions

View File

@ -25510,31 +25510,6 @@
"size": 73, "size": 73,
"type": "animation" "type": "animation"
}, },
{
"path": "acroBandits/gUnk_080CE5B0.bin",
"start": 845232,
"size": 8
},
{
"path": "acroBandits/gUnk_080CE5B8.bin",
"start": 845240,
"size": 8
},
{
"path": "acroBandits/gUnk_080CE5C0.bin",
"start": 845248,
"size": 8
},
{
"path": "acroBandits/gUnk_080CE5F0.bin",
"start": 845296,
"size": 10
},
{
"path": "acroBandits/gUnk_080CE5FA.bin",
"start": 845306,
"size": 20
},
{ {
"path": "animations/gSpriteAnimations_Keaton_0.bin", "path": "animations/gSpriteAnimations_Keaton_0.bin",
"start": 845848, "start": 845848,

View File

@ -1,55 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
AcroBandit_Functions:: @ 080CE56C
.4byte AcroBandit_OnTick
.4byte AcroBandit_OnCollision
.4byte AcroBandit_OnKnockback
.4byte GenericDeath
.4byte GenericConfused
.4byte AcroBandit_OnGrabbed
gUnk_080CE584:: @ 080CE584
.4byte sub_08031A88
.4byte sub_08031E90
gUnk_080CE58C:: @ 080CE58C
.4byte sub_08031AA0
.4byte sub_08031AC8
.4byte sub_08031B48
.4byte sub_08031B98
.4byte sub_08031C1C
.4byte sub_08031C58
.4byte sub_08031D70
.4byte sub_08031DA0
.4byte sub_08031DC4
gUnk_080CE5B0:: @ 080CE5B0
.incbin "acroBandits/gUnk_080CE5B0.bin"
gUnk_080CE5B8:: @ 080CE5B8
.incbin "acroBandits/gUnk_080CE5B8.bin"
gUnk_080CE5C0:: @ 080CE5C0
.incbin "acroBandits/gUnk_080CE5C0.bin"
gUnk_080CE5C8:: @ 080CE5C8
.4byte sub_08031EA8
.4byte sub_08031EE8
.4byte sub_08031F54
.4byte sub_08031FB0
.4byte sub_08032008
.4byte sub_08032148
.4byte sub_08032160
.4byte sub_080321E8
.4byte sub_08032204
.4byte sub_08032248
gUnk_080CE5F0:: @ 080CE5F0
.incbin "acroBandits/gUnk_080CE5F0.bin"
gUnk_080CE5FA:: @ 080CE5FA
.incbin "acroBandits/gUnk_080CE5FA.bin"

View File

@ -995,7 +995,7 @@ SECTIONS {
data/const/enemy/rope.o(.rodata); data/const/enemy/rope.o(.rodata);
data/animations/enemy/rope.o(.rodata); data/animations/enemy/rope.o(.rodata);
data/const/enemy/smallPesto.o(.rodata); data/const/enemy/smallPesto.o(.rodata);
data/const/enemy/acroBandits.o(.rodata); src/enemy/acroBandits.o(.rodata);
data/animations/enemy/acroBandits.o(.rodata); data/animations/enemy/acroBandits.o(.rodata);
data/const/enemy/keaton.o(.rodata); data/const/enemy/keaton.o(.rodata);
data/animations/enemy/keaton.o(.rodata); data/animations/enemy/keaton.o(.rodata);

View File

@ -10,15 +10,39 @@
extern Entity* gUnk_020000B0; extern Entity* gUnk_020000B0;
extern void (*const gUnk_080012C8[])(Entity*); extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const AcroBandit_Functions[])(Entity*);
extern void (*const gUnk_080CE584[])(Entity*); void AcroBandit_OnTick(Entity* this);
extern void (*const gUnk_080CE58C[])(Entity*); void AcroBandit_OnCollision(Entity* this);
extern void (*const gUnk_080CE5C8[])(Entity*); void AcroBandit_OnKnockback(Entity* this);
extern u8 gUnk_080CE5B0[8]; void GenericDeath(Entity* this);
extern u8 gUnk_080CE5B8[8]; void GenericConfused(Entity* this);
extern s8 gUnk_080CE5C0[8]; void AcroBandit_OnGrabbed(Entity* this);
extern u16 gUnk_080CE5F0[5]; void AcroBandit_Type0(Entity* this);
extern u8 gUnk_080CE5FA[20]; // Directions void AcroBandit_Type1(Entity* this);
void AcroBandit_Type0Action0(Entity* this);
void AcroBandit_Type0Action1(Entity* this);
void AcroBandit_Type0Action2(Entity* this);
void AcroBandit_Type0Action3(Entity* this);
void AcroBandit_Type0Action4(Entity* this);
void AcroBandit_Type0Action5(Entity* this);
void AcroBandit_Type0Action6(Entity* this);
void AcroBandit_Type0Action7(Entity* this);
void AcroBandit_Type0Action8(Entity* this);
void AcroBandit_Type1Init(Entity* this);
void AcroBandit_Type1Action1(Entity* this);
void AcroBandit_Type1Action2(Entity* this);
void AcroBandit_Type1Action3(Entity* this);
void AcroBandit_Type1Action4(Entity* this);
void AcroBandit_Type1Action5(Entity* this);
void AcroBandit_Type1Action6(Entity* this);
void AcroBandit_Type1Action7(Entity* this);
void AcroBandit_Type1Action8(Entity* this);
void AcroBandit_Type1Action9(Entity* this);
static void (*const AcroBandit_Functions[])(Entity*) = {
AcroBandit_OnTick, AcroBandit_OnCollision, AcroBandit_OnKnockback,
GenericDeath, GenericConfused, AcroBandit_OnGrabbed,
};
void AcroBandit(Entity* this) { void AcroBandit(Entity* this) {
s32 index; s32 index;
@ -37,7 +61,11 @@ void AcroBandit(Entity* this) {
} }
void AcroBandit_OnTick(Entity* this) { void AcroBandit_OnTick(Entity* this) {
gUnk_080CE584[this->type](this); static void (*const typeFuncs[])(Entity*) = {
AcroBandit_Type0,
AcroBandit_Type1,
};
typeFuncs[this->type](this);
} }
void AcroBandit_OnCollision(Entity* this) { void AcroBandit_OnCollision(Entity* this) {
@ -109,25 +137,27 @@ void AcroBandit_OnKnockback(Entity* this) {
GenericKnockback(this); GenericKnockback(this);
} }
void AcroBandit_OnGrabbed(void) { void AcroBandit_OnGrabbed(Entity* this) {
/* ... */
} }
void sub_08031A88(Entity* this) { void AcroBandit_Type0(Entity* this) {
gUnk_080CE58C[this->action](this); static void (*const actionFuncs[])(Entity*) = {
AcroBandit_Type0Action0, AcroBandit_Type0Action1, AcroBandit_Type0Action2,
AcroBandit_Type0Action3, AcroBandit_Type0Action4, AcroBandit_Type0Action5,
AcroBandit_Type0Action6, AcroBandit_Type0Action7, AcroBandit_Type0Action8,
};
actionFuncs[this->action](this);
} }
void sub_08031AA0(Entity* this) { void AcroBandit_Type0Action0(Entity* this) {
sub_0804A720(this); sub_0804A720(this);
this->action = '\x01'; this->action = 1;
this->field_0x74.HWORD = this->x.HALF.HI; this->field_0x74.HWORD = this->x.HALF.HI;
this->field_0x76.HWORD = this->y.HALF.HI; this->field_0x76.HWORD = this->y.HALF.HI;
this->field_0x78.HALF.HI = Random(); this->field_0x78.HALF.HI = Random();
} }
void sub_08031AC8(Entity* this) void AcroBandit_Type0Action1(Entity* this) {
{
u32 rand; u32 rand;
s32 x, y; s32 x, y;
@ -149,7 +179,8 @@ void sub_08031AC8(Entity* this)
} }
} }
void sub_08031B48(Entity* this) { void AcroBandit_Type0Action2(Entity* this) {
static const u8 actionDelays[] = { 2, 2, 2, 3, 3, 3, 3, 4 };
GetNextFrame(this); GetNextFrame(this);
if (this->frame & 1) { if (this->frame & 1) {
this->frame = 0; this->frame = 0;
@ -157,13 +188,13 @@ void sub_08031B48(Entity* this) {
} else { } else {
if (this->frame & ANIM_DONE) { if (this->frame & ANIM_DONE) {
this->action = 0x3; this->action = 0x3;
this->actionDelay = gUnk_080CE5B0[Random() & 7]; this->actionDelay = actionDelays[Random() & 7];
InitializeAnimation(this, 1); InitializeAnimation(this, 1);
} }
} }
} }
void sub_08031B98(Entity* this) { void AcroBandit_Type0Action3(Entity* this) {
if (sub_08031E04(this)) { if (sub_08031E04(this)) {
this->action = 5; this->action = 5;
if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) { if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) {
@ -186,21 +217,22 @@ void sub_08031B98(Entity* this) {
} }
} }
void sub_08031C1C(Entity* this) { void AcroBandit_Type0Action4(Entity* this) {
static const u8 actionDelays[] = { 60, 60, 90, 120, 120, 120, 120, 150 };
GetNextFrame(this); GetNextFrame(this);
if (this->frame & ANIM_DONE) { if (this->frame & ANIM_DONE) {
this->action = '\x01'; this->action = 1;
this->actionDelay = gUnk_080CE5B8[Random() & 7]; this->actionDelay = actionDelays[Random() & 7];
this->spriteSettings.draw = 0; this->spriteSettings.draw = 0;
} }
} }
void sub_08031C58(Entity* this) { void AcroBandit_Type0Action5(Entity* this) {
Entity *a, *b; Entity *a, *b;
GetNextFrame(this); GetNextFrame(this);
if (this->frame & ANIM_DONE) { if (this->frame & ANIM_DONE) {
if (gEntCount < 0x43) { if (gEntCount < MAX_ENTITIES - 4) {
u32 tmp = Random(); u32 tmp = Random();
tmp &= 3; tmp &= 3;
@ -252,7 +284,7 @@ void sub_08031C58(Entity* this) {
} }
} }
void sub_08031D70(Entity* this) { void AcroBandit_Type0Action6(Entity* this) {
GetNextFrame(this); GetNextFrame(this);
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {
this->action = 7; this->action = 7;
@ -262,7 +294,7 @@ void sub_08031D70(Entity* this) {
} }
} }
void sub_08031DA0(Entity* this) { void AcroBandit_Type0Action7(Entity* this) {
if ((this->actionDelay & 0xf) == 0) { if ((this->actionDelay & 0xf) == 0) {
if (this->actionDelay == 0x50) { if (this->actionDelay == 0x50) {
DeleteEntity(this); DeleteEntity(this);
@ -273,7 +305,7 @@ void sub_08031DA0(Entity* this) {
} }
} }
void sub_08031DC4(Entity* this) { void AcroBandit_Type0Action8(Entity* this) {
if (this->frame & ANIM_DONE) { if (this->frame & ANIM_DONE) {
this->action = 1; this->action = 1;
this->actionDelay = 0xb4; this->actionDelay = 0xb4;
@ -287,8 +319,9 @@ void sub_08031DC4(Entity* this) {
} }
u32 sub_08031E04(Entity* this) { u32 sub_08031E04(Entity* this) {
static const s8 gUnk_080CE5C0[] = { -32, 0, 0, 32, 32, 0, 0, 0 };
Entity* ent; Entity* ent;
s8* tmp; const s8* tmp;
ent = sub_08049DF4(1); ent = sub_08049DF4(1);
if (ent == NULL) if (ent == NULL)
@ -308,11 +341,16 @@ void sub_08031E48(Entity* this, Entity* child) {
child->field_0x7c.WORD = (s32)this; child->field_0x7c.WORD = (s32)this;
} }
void sub_08031E90(Entity* this) { void AcroBandit_Type1(Entity* this) {
gUnk_080CE5C8[this->action](this); static void (*const actionFuncs[])(Entity*) = {
AcroBandit_Type1Init, AcroBandit_Type1Action1, AcroBandit_Type1Action2, AcroBandit_Type1Action3,
AcroBandit_Type1Action4, AcroBandit_Type1Action5, AcroBandit_Type1Action6, AcroBandit_Type1Action7,
AcroBandit_Type1Action8, AcroBandit_Type1Action9,
};
actionFuncs[this->action](this);
} }
void sub_08031EA8(Entity* this) { void AcroBandit_Type1Init(Entity* this) {
this->action = 1; this->action = 1;
this->spritePriority.b1 = 1; this->spritePriority.b1 = 1;
this->zVelocity = Q_16_16(4.0); this->zVelocity = Q_16_16(4.0);
@ -321,7 +359,7 @@ void sub_08031EA8(Entity* this) {
InitializeAnimation(this, 4); InitializeAnimation(this, 4);
} }
void sub_08031EE8(Entity* this) { void AcroBandit_Type1Action1(Entity* this) {
int draw; int draw;
this->z.WORD -= this->zVelocity; this->z.WORD -= this->zVelocity;
@ -346,8 +384,9 @@ void sub_08031EE8(Entity* this) {
} }
} }
void sub_08031F54(Entity* this) { void AcroBandit_Type1Action2(Entity* this) {
GravityUpdate(this, gUnk_080CE5F0[this->type2]); static const u16 banditGravity[] = { 0x1600, 0x1300, 0x1000, 0xD00, 0xB00 };
GravityUpdate(this, banditGravity[this->type2]);
if (this->type2 * -0xe <= this->z.HALF.HI) { if (this->type2 * -0xe <= this->z.HALF.HI) {
this->action = 3; this->action = 3;
this->actionDelay = 20; this->actionDelay = 20;
@ -358,7 +397,7 @@ void sub_08031F54(Entity* this) {
} }
} }
void sub_08031FB0(Entity* this) { void AcroBandit_Type1Action3(Entity* this) {
GetNextFrame(this); GetNextFrame(this);
if ((this->frame & ANIM_DONE) && (this->parent || --this->actionDelay == 0)) { if ((this->frame & ANIM_DONE) && (this->parent || --this->actionDelay == 0)) {
this->action = 4; this->action = 4;
@ -372,7 +411,7 @@ void sub_08031FB0(Entity* this) {
} }
} }
void sub_08032008(Entity* this) { void AcroBandit_Type1Action4(Entity* this) {
Entity* parent; Entity* parent;
if (sub_080322A4(this) == 0) { if (sub_080322A4(this) == 0) {
@ -421,20 +460,22 @@ void sub_08032008(Entity* this) {
} }
} }
void sub_08032148(Entity* this) { void AcroBandit_Type1Action5(Entity* this) {
if (GravityUpdate(this, 0x2000)) if (GravityUpdate(this, 0x2000))
return; return;
sub_08032290(this); sub_08032290(this);
} }
void sub_08032160(Entity* this) { void AcroBandit_Type1Action6(Entity* this) {
static const u8 fallDirections[] = { 0x8, 0x1c, 0x11, 0x2, 0x15, 0xc, 0x0, 0x15, 0x6, 0x19,
0x10, 0x4, 0x19, 0xa, 0x1d, 0x14, 0x8, 0x1d, 0xe, 0x1 };
Entity* tmp; Entity* tmp;
u32 dir; u32 dir;
if (this->actionDelay == 0) { if (this->actionDelay == 0) {
this->action = 7; this->action = 7;
dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->type2]; dir = fallDirections[this->field_0x74.HALF.LO * 5 + this->type2];
this->direction = dir; this->direction = dir;
if (dir >= 0x10) { if (dir >= 0x10) {
this->spriteSettings.flipX = 1; this->spriteSettings.flipX = 1;
@ -456,14 +497,14 @@ void sub_08032160(Entity* this) {
} }
} }
void sub_080321E8(Entity* this) { void AcroBandit_Type1Action7(Entity* this) {
ProcessMovement2(this); ProcessMovement2(this);
if (sub_080044EC(this, 0x2000) == 0) if (sub_080044EC(this, 0x2000) == 0)
this->action = 8; this->action = 8;
} }
void sub_08032204(Entity* this) { void AcroBandit_Type1Action8(Entity* this) {
GetNextFrame(this); GetNextFrame(this);
if (this->frame & 1) { if (this->frame & 1) {
this->frame = 0; this->frame = 0;
@ -476,7 +517,7 @@ void sub_08032204(Entity* this) {
} }
} }
void sub_08032248(Entity* this) { void AcroBandit_Type1Action9(Entity* this) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) { if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
if (this->frame & ANIM_DONE) { if (this->frame & ANIM_DONE) {
((Entity*)this->field_0x7c.WORD)->actionDelay--; ((Entity*)this->field_0x7c.WORD)->actionDelay--;