mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
match add_actor_decoration, near-match others
This commit is contained in:
parent
46586ba9ba
commit
57d69d1e72
@ -1136,7 +1136,10 @@ typedef struct DecorationTable {
|
||||
/* 0x8AC */ u8 effectType; /* 0 = blur, 14 = none? */
|
||||
/* 0x8AD */ char unk_8AD[11];
|
||||
/* 0x8B8 */ u8 decorationType[2];
|
||||
/* 0x8BA */ char unk_8BA[46];
|
||||
/* 0x8BA */ u8 unk_8BA;
|
||||
/* 0x8BB */ u8 unk_8BB;
|
||||
/* 0x8BC */ u8 unk_8BC;
|
||||
/* 0x8BD */ char unk_8BD[43];
|
||||
} DecorationTable; // size = 0x8E8
|
||||
|
||||
typedef struct Shop {
|
||||
|
@ -17,10 +17,10 @@ ApiStatus func_80260DB8(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus func_80260DD8(ScriptInstance* script, s32 isInitialCall) {
|
||||
Actor* player = gBattleStatus.playerActor;
|
||||
|
||||
|
||||
if (!gPlayerData.hasActionCommands) {
|
||||
s32 var = player->varTable[0];
|
||||
|
||||
|
||||
if (var >= rand_int(100)) {
|
||||
script->varTable[0] = 1;
|
||||
} else {
|
||||
@ -57,7 +57,7 @@ INCLUDE_ASM(s32, "code_18F340", func_8026127C);
|
||||
|
||||
ApiStatus func_80261388(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 partnerActorExists = gBattleStatus.partnerActor != NULL;
|
||||
|
||||
|
||||
script->varTable[0] = FALSE;
|
||||
if (partnerActorExists) {
|
||||
script->varTable[0] = TRUE;
|
||||
|
@ -78,11 +78,35 @@ INCLUDE_ASM(s32, "code_190B20", func_80265CE8);
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", func_80265D44);
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
typedef struct {
|
||||
Element element;
|
||||
s32 defense;
|
||||
} DefenseTableEntry;
|
||||
s32 lookup_defense(DefenseTableEntry* defenseTable, Element elementKey) {
|
||||
DefenseTableEntry* row;
|
||||
s32 normalDefense = 0;
|
||||
|
||||
for (row = defenseTable; row->element != Element_END; row++) {
|
||||
if (row->element == Element_NORMAL) {
|
||||
normalDefense = row->defense;
|
||||
}
|
||||
|
||||
if (row->element == elementKey) {
|
||||
return row->defense;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to normal defense if given element is not specified in table
|
||||
return normalDefense;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "code_190B20", lookup_defense);
|
||||
#endif
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", lookup_status_chance);
|
||||
INCLUDE_ASM(s32, "code_190B20", lookup_status_chance); // exactly (?) the same as lookup_defense
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", lookup_status_duration_mod);
|
||||
INCLUDE_ASM(s32, "code_190B20", lookup_status_duration_mod); // exactly (?) the same as lookup_defense
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", inflict_status);
|
||||
|
||||
@ -138,9 +162,32 @@ INCLUDE_ASM(s32, "code_190B20", func_8026709C);
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", func_802670C8);
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", add_part_decoration);
|
||||
#ifdef NON_MATCHING
|
||||
// Register allocation issues (decorationIndex is placed in s2 for seemingly no reason?).
|
||||
// Should be easy to clean up once DecorationTable is more understood
|
||||
void add_part_decoration(ActorPart* part, s32 decorationIndex, DecorationId decorationType) {
|
||||
if (part->idleAnimations && (part->flags & 2) == 0) {
|
||||
DecorationTable* decoration = &part->decorationTable->unk_00[decorationIndex];
|
||||
_remove_part_decoration(part, decorationIndex);
|
||||
decoration->decorationType[0] = decorationType;
|
||||
decoration->unk_8BA = 1;
|
||||
decoration->unk_8BC = 0;
|
||||
func_8025CEC8(part);
|
||||
}
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(void, "code_190B20", add_part_decoration, ActorPart* part, s32 decorationIndex,
|
||||
DecorationId decorationType);
|
||||
#endif
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", add_actor_decoration);
|
||||
void add_actor_decoration(Actor* actor, s32 decorationIndex, DecorationId decorationType) {
|
||||
ActorPart* part;
|
||||
for (part = actor->partsTable; part != NULL; part = part->nextPart) {
|
||||
if ((part->flags & 0x100001) == 0 && part->idleAnimations && (part->flags & 2) == 0) {
|
||||
add_part_decoration(part, decorationIndex, decorationType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void remove_part_decoration(ActorPart* part, s32 decorationIndex) {
|
||||
_remove_part_decoration(part, decorationIndex);
|
||||
@ -188,7 +235,7 @@ void remove_part_shadow(s32 actorId, s32 partIndex) {
|
||||
func_80112328(part->shadow);
|
||||
}
|
||||
|
||||
void create_part_shadow_by_ptr(UNK_TYPE unused, ActorPart* part) {
|
||||
void create_part_shadow_by_ptr(UNK_TYPE arg0, ActorPart* part) {
|
||||
part->flags &= ~4;
|
||||
part->shadow = create_shadow_type(0, part->currentPos.x, part->currentPos.y, part->currentPos.z);
|
||||
part->shadowScale = part->size[0] / 24.0;
|
||||
@ -215,3 +262,4 @@ INCLUDE_ASM(s32, "code_190B20", show_foreground_models);
|
||||
INCLUDE_ASM(s32, "code_190B20", StartRumbleWithParams);
|
||||
|
||||
INCLUDE_ASM(s32, "code_190B20", start_rumble_type);
|
||||
|
||||
|
@ -12,12 +12,15 @@ void set_part_yaw(s32 actorID, s32 partIndex, s32 value);
|
||||
|
||||
ActorPart* get_actor_part(Actor* actor, s32 partIndex);
|
||||
|
||||
void add_part_decoration(ActorPart* part, s32 decorationIndex, DecorationId decorationType);
|
||||
void add_actor_decoration(Actor* actor, s32 decorationIndex, DecorationId decorationType);
|
||||
void remove_part_decoration(ActorPart* part, s32 decorationIndex);
|
||||
void remove_actor_decoration(Actor* actor, s32 decorationIndex);
|
||||
|
||||
s32 heroes_is_ability_active(Actor* actor, Ability ability);
|
||||
|
||||
void create_part_shadow(s32 actorId, s32 partIndex);
|
||||
void remove_part_shadow(s32 actorId, s32 partIndex);
|
||||
void create_part_shadow_by_ptr(UNK_TYPE unused, ActorPart* part);
|
||||
void create_part_shadow_by_ptr(UNK_TYPE arg0, ActorPart* part); // arg0 unused
|
||||
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@ ApiStatus LoadMoveScript(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
dma_copy(moveScript[0], moveScript[1], moveScript[2]);
|
||||
script->varTable[0] = moveScript[3];
|
||||
|
||||
|
||||
deduct_current_move_fp();
|
||||
|
||||
if (gBattleStatus.flags2 & 0x8000000) {
|
||||
|
Loading…
Reference in New Issue
Block a user