mirror of
https://github.com/zeldaret/tmc
synced 2026-08-05 17:44:13 -04:00
objectA2.c: ok
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
#include "global.h"
|
||||
#include "object.h"
|
||||
#include "menu.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (* const gUnk_081246F4[])(Entity*);
|
||||
extern const u8 gUnk_08124704[];
|
||||
|
||||
typedef struct {
|
||||
u8 unk_0;
|
||||
u8 unk_1;
|
||||
} PACKED struct_08124708;
|
||||
|
||||
extern const struct_08124708 gUnk_08124708[];
|
||||
|
||||
void sub_0809F448(Entity*);
|
||||
|
||||
void ObjectA2(Entity* this) {
|
||||
gUnk_081246F4[this->action](this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0809F318(Entity* this) {
|
||||
InitializeAnimation(this, 0);
|
||||
if (Random() & 0x10) {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
this->x.HALF.HI = 0x28;
|
||||
this->y.HALF.HI = 0x48;
|
||||
this->height.HALF.HI = 0xFFB0;
|
||||
this->spriteOrientation.flipY = 2;
|
||||
this->action = 1;
|
||||
sub_0801D2B4(this, gUnk_08124704[this->entityType.form]);
|
||||
sub_0805E3A0(this, 7);
|
||||
}
|
||||
|
||||
void sub_0809F374(Entity* this) {
|
||||
sub_0806F69C(this);
|
||||
if (gUnk_02000000->gameLanguage < 2) {
|
||||
if (sub_080044EC(this, 0x2000) < 2) {
|
||||
this->height.WORD = 0;
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
PlaySFX(0x186);
|
||||
} else {
|
||||
this->actionDelay++;
|
||||
}
|
||||
} else {
|
||||
switch (sub_080044EC(this, 0x2000)) {
|
||||
default:
|
||||
this->actionDelay++;
|
||||
break;
|
||||
case 0:
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
//fall through
|
||||
case 1:
|
||||
this->actionDelay = 0;
|
||||
sub_0809F448(this);
|
||||
PlaySFX(0x186);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F3E8(Entity* this) {
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 3;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F408(Entity* this) {
|
||||
switch (this->frames.all) {
|
||||
case 9:
|
||||
this->frames.all = 0;
|
||||
CreateFx(this, 0x43, 0);
|
||||
gMenu.field_0x0 = 1;
|
||||
break;
|
||||
case 0x80:
|
||||
gMenu.field_0x4 = 1;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 sub_080045DA(s32, u32);
|
||||
|
||||
void sub_0809F448(Entity* this) {
|
||||
s32 tmp;
|
||||
int rand = Random();
|
||||
const struct_08124708 *tmp2 = &gUnk_08124708[this->field_0xf];
|
||||
this->field_0xf++;
|
||||
tmp = 0x280000 - this->x.WORD;
|
||||
|
||||
switch (tmp2->unk_0) {
|
||||
case 0:
|
||||
tmp = rand % 0x180000;
|
||||
if (rand & 0x1000000) {
|
||||
tmp = -tmp;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
tmp += -0x80000 + (rand & 0xFFFFF);
|
||||
break;
|
||||
}
|
||||
this->nonPlanarMovement = (tmp > 0 ? tmp : -tmp) / (tmp2->unk_1 << 8);
|
||||
this->direction = sub_080045DA(tmp, 0) >> 3;
|
||||
}
|
||||
Reference in New Issue
Block a user