Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

last actors #1118

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "messages.h"
#include "battle/formation_names.h"
#include "battle/stage_names.h"
#include "battle/actor_levels.h"
#include "battle/actor_types.h"

#ifdef PERMUTER
extern int TEXEL0, TEXEL1, PRIMITIVE, PRIMITIVE_ALPHA;
Expand Down
12 changes: 6 additions & 6 deletions include/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ typedef struct DebuffFXData {
/* 0x30 */ f32 unk_30;
/* 0x34 */ s32 alpha;
/* 0x38 */ Color_RGB8 primCol;
/* 0x38 */ Color_RGB8 envCol;
/* 0x3B */ Color_RGB8 envCol;
/* 0x3E */ char unk_3E[2];
} DebuffFXData; // size = 0x40

Expand Down Expand Up @@ -1024,12 +1024,12 @@ typedef struct AuraFXData {
} AuraFXData; // size = 0x70

typedef struct BulbGlowFXData {
/* 0x00 */ s32 unk_00;
/* 0x00 */ s32 type;
/* 0x04 */ Vec3f pos;
/* 0x10 */ s32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ s32 unk_18;
/* 0x1C */ s32 unk_1C;
/* 0x10 */ s32 brightness;
/* 0x14 */ s32 timeLeft;
/* 0x18 */ s32 lifetime;
/* 0x1C */ s32 depthQueryID;
/* 0x20 */ s32 unk_20;
} BulbGlowFXData; // size = 0x24

Expand Down
8 changes: 4 additions & 4 deletions include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ enum TargetFlags {
TARGET_FLAG_200000 = 0x00200000,
TARGET_FLAG_400000 = 0x00400000,
TARGET_FLAG_800000 = 0x00800000,
TARGET_FLAG_80000000 = 0x80000000,
TARGET_FLAG_OVERRIDE = 0x80000000, // skip choosing a target
};

enum ActorPartTargetFlags {
Expand Down Expand Up @@ -3310,7 +3310,7 @@ enum ActorPartFlags {
ACTOR_PART_FLAG_200000 = 0x00200000,
ACTOR_PART_FLAG_400000 = 0x00400000,
ACTOR_PART_FLAG_MULTI_TARGET = 0x00800000, ///< Can be targeted with multi-target attacks (e.g. Star Storm).
ACTOR_PART_FLAG_1000000 = 0x01000000,
ACTOR_PART_FLAG_HAS_PAL_EFFECT = 0x01000000,
ACTOR_PART_FLAG_2000000 = 0x02000000,
ACTOR_PART_FLAG_4000000 = 0x04000000,
ACTOR_PART_FLAG_8000000 = 0x08000000,
Expand Down Expand Up @@ -4061,8 +4061,8 @@ enum BattleMessages {
BTL_MSG_STAR_POWER_FILLED = 0x1C,
BTL_MSG_ATTACK_UP = 0x1D,
BTL_MSG_DEFENCE_UP = 0x1E,
BTL_MSG_1F = 0x1F,
BTL_MSG_20 = 0x20,
BTL_MSG_HEAL_ONE = 0x1F,
BTL_MSG_HEAL_ALL = 0x20,
BTL_MSG_ENEMY_TRANSPARENT = 0x21,
BTL_MSG_ENEMY_CHARGED = 0x22,
BTL_MSG_PARTNER_INJURED = 0x23,
Expand Down
4 changes: 2 additions & 2 deletions include/script_api/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ ApiStatus func_8027D434(Evt* script, s32 isInitialCall);
ApiStatus func_8026F1A0(Evt* script, s32 isInitialCall);
ApiStatus PlayLoopingSoundAtActor(Evt* script, s32 isInitialCall);
ApiStatus StopLoopingSoundAtActor(Evt* script, s32 isInitialCall);
ApiStatus func_8026ED20(Evt* script, s32 isInitialCall);
ApiStatus EnableActorPaletteEffects(Evt* script, s32 isInitialCall);
ApiStatus SetActorPaletteSwapParams(Evt* script, s32 isInitialCall);
ApiStatus BattleCamTargetActorPart(Evt* script, s32 isInitialCall);
ApiStatus func_802537C0(Evt* script, s32 isInitialCall);
ApiStatus GetDarknessStatus(Evt* script, s32 isInitialCall);
ApiStatus CancelEnemyTurn(Evt* script, s32 isInitialCall);
ApiStatus GetAnimatedNodeRotation(Evt* script, s32 isInitialCall);
ApiStatus GetAnimatedNodePosition(Evt* script, s32 isInitialCall);
Expand Down
4 changes: 2 additions & 2 deletions src/16F740.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern s16 D_802809F6;
extern s16 DemoBattleBeginDelay;
extern s32 BattleScreenFadeAmt;
extern EvtScript EVS_OnBattleInit;
extern s32 D_80281454[];
extern s32 bActorsIgnoreDuringCount[];
extern EvtScript EVS_Mario_OnActorCreate;
extern EvtScript EVS_Peach_OnActorCreate;

Expand Down Expand Up @@ -343,7 +343,7 @@ void btl_state_update_normal_start(void) {

for (i = 0; i < BattleEnemiesCreated; i++) {
create_actor(&(*battle->formation)[i]);
types = D_80281454;
types = bActorsIgnoreDuringCount;
actor = battleStatus->enemyActors[i];

while (TRUE) {
Expand Down
2,157 changes: 9 additions & 2,148 deletions src/17D6A0.c

Large diffs are not rendered by default.

25 changes: 12 additions & 13 deletions src/181810.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ ApiStatus EnableBattleFloorReflections(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}


ApiStatus SetDarknessMode(Evt* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Bytecode* args = script->ptrReadPos;
Expand All @@ -366,25 +365,25 @@ ApiStatus SetDarknessMode(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}

ApiStatus func_802537C0(Evt* script, s32 isInitialCall) {
ApiStatus GetDarknessStatus(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a0 = *args++;
s32 a1 = *args++;
u8 t1;
f32 t2;
s32 t3;
s32 out1 = *args++;
s32 out2 = *args++;
u8 type;
f32 amt;
s32 isLight;

// While loop may not be necessary in the future
do { get_screen_overlay_params(SCREEN_LAYER_BACK, &t1, &t2); } while (0);
do { get_screen_overlay_params(SCREEN_LAYER_BACK, &type, &amt); } while (0);

if (t2 < 128.0f) {
t3 = 0;
if (amt < 128.0f) {
isLight = FALSE;
} else {
t3 = 1;
isLight = TRUE;
}

evt_set_variable(script, a0, 1);
evt_set_variable(script, a1, t3);
evt_set_variable(script, out1, SCREEN_LAYER_BACK);
evt_set_variable(script, out2, isLight);

return ApiStatus_DONE2;
}
Expand Down
4 changes: 2 additions & 2 deletions src/182B30.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,10 @@ void appendGfx_npc_actor(b32 isPartner, s32 actorIndex) {
}
palChanged = TRUE;
}
if ((!palChanged) && !(part->flags & ACTOR_PART_FLAG_1000000)) {
if (!palChanged && !(part->flags & ACTOR_PART_FLAG_HAS_PAL_EFFECT)) {
set_actor_pal_adjustment(actor, PAL_ADJUST_NONE);
}
if ((!decorChanged) && !(part->flags & ACTOR_PART_FLAG_1000000)) {
if (!decorChanged && !(part->flags & ACTOR_PART_FLAG_HAS_PAL_EFFECT)) {
func_80266EE8(actor, UNK_PAL_EFFECT_0);
}
if (actor->flags & ACTOR_FLAG_4000000) {
Expand Down
4 changes: 2 additions & 2 deletions src/190B20.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void create_target_list(Actor* actor, s32 arg1) {
s32 row;
s32 skip;

if (battleStatus->curTargetListFlags & TARGET_FLAG_80000000) {
if (battleStatus->curTargetListFlags & TARGET_FLAG_OVERRIDE) {
actor->targetListLength = -1;
return;
}
Expand Down Expand Up @@ -247,7 +247,7 @@ void create_target_list(Actor* actor, s32 arg1) {
if (targetData->actorID == ACTOR_PLAYER || targetData->actorID == ACTOR_PARTNER) {
continue;
}
if (battleStatus->curTargetListFlags & TARGET_FLAG_80000000) {
if (battleStatus->curTargetListFlags & TARGET_FLAG_OVERRIDE) {
skip = TRUE;
goto END2;
}
Expand Down
16 changes: 8 additions & 8 deletions src/415D90.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ BSS s32 D_802ACC60;
BSS s32 D_802ACC64;
BSS s32 D_802ACC68;
BSS s32 D_802ACC6C;
BSS s32 D_802ACC70[24];
BSS s32 BattleMenu_TargetHudElems[24];
BSS PopupMenu D_802ACCD0;
BSS s8 BattleMenuState;
BSS s8 D_802AD001;
Expand Down Expand Up @@ -4911,7 +4911,7 @@ void btl_state_update_select_target(void) {
}
}

if (battleStatus->curTargetListFlags & TARGET_FLAG_80000000) {
if (battleStatus->curTargetListFlags & TARGET_FLAG_OVERRIDE) {
if (!(gBattleStatus.flags1 & BS_FLAGS1_PARTNER_ACTING)) {
gBattleSubState = battleStatus->acceptTargetMenuSubstate;
if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) {
Expand Down Expand Up @@ -4955,7 +4955,7 @@ void btl_state_update_select_target(void) {

for (i = 0; i < targetListLength; i++) {
id = hud_element_create(&HES_HandPointDownLoop);
D_802ACC70[i] = id;
BattleMenu_TargetHudElems[i] = id;
hud_element_set_render_depth(id, 0);
hud_element_set_render_pos(id, 0, -100);
}
Expand Down Expand Up @@ -5009,7 +5009,7 @@ void btl_state_update_select_target(void) {

target = &actor->targetData[targetIndexList[selectedTargetIndex]];
actorFlags = get_actor(target->actorID)->flags;
id = D_802ACC70[0];
id = BattleMenu_TargetHudElems[0];

if (actorFlags & ACTOR_FLAG_UPSIDE_DOWN) {
hud_element_set_script(id, &HES_HandPointLeftLoop);
Expand All @@ -5027,7 +5027,7 @@ void btl_state_update_select_target(void) {
actor->targetActorID = target->actorID;
actor->targetPartIndex = target->partID;
for (i = 0; i < targetListLength; i++) {
hud_element_free(D_802ACC70[i]);
hud_element_free(BattleMenu_TargetHudElems[i]);
}

if (!(gBattleStatus.flags1 & BS_FLAGS1_PARTNER_ACTING)) {
Expand All @@ -5050,7 +5050,7 @@ void btl_state_update_select_target(void) {
break;
case BTL_SUBSTATE_SELECT_TARGET_CANCEL:
for (i = 0; i < targetListLength; i++) {
hud_element_free(D_802ACC70[i]);
hud_element_free(BattleMenu_TargetHudElems[i]);
}
gBattleStatus.flags1 |= BS_FLAGS1_10000 | BS_FLAGS1_MENU_OPEN;
actor->flags |= ACTOR_FLAG_8000000;
Expand Down Expand Up @@ -5122,7 +5122,7 @@ void btl_state_draw_select_target(void) {
if (battleStatus->curTargetListFlags & TARGET_FLAG_ENEMY) {
target = &actor->targetData[targetIndexList[selectedTargetIndex]];
anotherActor = get_actor(target->actorID);
id = D_802ACC70[0];
id = BattleMenu_TargetHudElems[0];
targetX = target->posA.x;
targetY = target->posA.y;
targetZ = target->posA.z;
Expand Down Expand Up @@ -5150,7 +5150,7 @@ void btl_state_draw_select_target(void) {
for (i = 0; i < targetListLength; i++) {
target = &actor->targetData[targetIndexList[i]];
anotherActor = get_actor(target->actorID);
id = D_802ACC70[i];
id = BattleMenu_TargetHudElems[i];
targetX = target->posA.x;
targetY = target->posA.y;
targetZ = target->posA.z;
Expand Down
Loading
Loading