2020-10-15 05:49:49 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
s32 count_targets(Actor* actor, s32 targetHomeIndex, s32 targetSelectionFlags) {
|
2020-11-20 01:58:41 +01:00
|
|
|
BattleStatus* battleStatus = BATTLE_STATUS;
|
2020-10-16 22:29:55 +02:00
|
|
|
|
|
|
|
battleStatus->targetHomeIndex = targetHomeIndex;
|
|
|
|
battleStatus->currentTargetListFlags = targetSelectionFlags;
|
|
|
|
player_create_target_list(actor);
|
|
|
|
return actor->targetListLength;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
s32 get_nearest_home_index(f32 x, f32 y, f32 z) {
|
|
|
|
s32 xVal;
|
|
|
|
s32 yVal;
|
|
|
|
|
2020-11-20 00:54:49 +01:00
|
|
|
if (y < 40.0f) {
|
|
|
|
xVal = 0;
|
|
|
|
} else if (y < 85.0f) {
|
2020-11-19 04:17:41 +01:00
|
|
|
xVal = 1;
|
2020-11-20 00:54:49 +01:00
|
|
|
} else if (y < 100.0f) {
|
|
|
|
xVal = 2;
|
|
|
|
} else {
|
|
|
|
xVal = 3;
|
2020-11-19 04:17:41 +01:00
|
|
|
}
|
|
|
|
|
2020-11-20 00:54:49 +01:00
|
|
|
if (x < 25.0f) {
|
|
|
|
yVal = 0;
|
|
|
|
} else if (x < 65.0f) {
|
2020-11-19 04:17:41 +01:00
|
|
|
yVal = 1;
|
2020-11-20 00:54:49 +01:00
|
|
|
} else if (x < 105.0f) {
|
|
|
|
yVal = 2;
|
|
|
|
} else {
|
|
|
|
yVal = 3;
|
2020-11-19 04:17:41 +01:00
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-19 20:21:59 +01:00
|
|
|
return yVal | (xVal << 2);
|
2020-11-19 04:17:41 +01:00
|
|
|
}
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
INCLUDE_ASM(void, "code_197F40", set_goal_pos_to_part, f32* goalPos, ActorID target, s32 partIndex);
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", set_part_goal_to_actor_part);
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
void set_actor_current_position(ActorID actorID, f32 x, f32 y, f32 z) {
|
2020-11-19 04:17:41 +01:00
|
|
|
Actor* actor = get_actor(actorID);
|
|
|
|
|
|
|
|
actor->currentPos.x = x;
|
|
|
|
actor->currentPos.y = y;
|
|
|
|
actor->currentPos.z = z;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
void set_part_absolute_position(ActorID actorID, s32 partIndex, f32 x, f32 y, f32 z) {
|
2020-11-27 07:14:28 +01:00
|
|
|
Actor* actor = get_actor(actorID);
|
|
|
|
ActorPart* actorPart;
|
|
|
|
|
|
|
|
switch (actorID & 0x700) {
|
|
|
|
case 0:
|
|
|
|
actor->currentPos.x = x;
|
|
|
|
actor->currentPos.y = y;
|
|
|
|
actor->currentPos.z = z;
|
|
|
|
break;
|
|
|
|
case 0x100:
|
|
|
|
case 0x200:
|
|
|
|
actorPart = get_actor_part(actor, partIndex);
|
|
|
|
actorPart->absolutePosition.x = x;
|
|
|
|
actorPart->absolutePosition.y = y;
|
|
|
|
actorPart->absolutePosition.z = z;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
void set_actor_home_position(ActorID actorID, f32 x, f32 y, f32 z) {
|
2020-11-19 04:17:41 +01:00
|
|
|
Actor* actor = get_actor(actorID);
|
|
|
|
|
|
|
|
actor->homePos.x = x;
|
|
|
|
actor->homePos.y = y;
|
|
|
|
actor->homePos.z = z;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
Actor* get_actor(s32 actorID) {
|
|
|
|
Actor* ret = NULL;
|
|
|
|
BattleStatus* battleStatus = BATTLE_STATUS;
|
|
|
|
s32 idFlag = actorID & 0x700;
|
|
|
|
u32 idIdx = (u8)actorID;
|
|
|
|
|
|
|
|
switch (idFlag) {
|
|
|
|
case 0:
|
|
|
|
ret = battleStatus->playerActor;
|
|
|
|
break;
|
|
|
|
case 0x100:
|
|
|
|
ret = battleStatus->partnerActor;
|
|
|
|
break;
|
|
|
|
case 0x200:
|
|
|
|
ret = battleStatus->enemyActors[idIdx];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", LoadBattleSection);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus GetBattlePhase(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gBattleStatus.battlePhase);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus GetLastElement(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gBattleStatus.currentAttackElement);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_80269E80(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gBattleStatus.unk_19A);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus func_80269EAC(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
s32 a0 = *script->ptrReadPos;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
gBattleStatus.unk_19A = a0;
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
ApiStatus SetGoalToHome(ScriptInstance* script, s32 isInitialCall) {
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *script->ptrReadPos);
|
2020-11-19 04:17:41 +01:00
|
|
|
Actor* actor;
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
2020-11-19 20:21:59 +01:00
|
|
|
actor->movePos.goal.x = actor->homePos.x;
|
|
|
|
actor->movePos.goal.y = actor->homePos.y;
|
|
|
|
actor->movePos.goal.z = actor->homePos.z;
|
2020-11-19 04:17:41 +01:00
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetIdleGoalToHome(ScriptInstance* script, s32 isInitialCall) {
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *script->ptrReadPos);
|
2020-11-19 04:17:41 +01:00
|
|
|
Actor* actor;
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
2020-11-20 01:41:49 +01:00
|
|
|
actor->flyPos.goal.x = actor->homePos.x;
|
|
|
|
actor->flyPos.goal.y = actor->homePos.y;
|
|
|
|
actor->flyPos.goal.z = actor->homePos.z;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetGoalToIndex);
|
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
ApiStatus GetIndexFromPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *args++);
|
2020-11-19 04:17:41 +01:00
|
|
|
s32 a1 = *args++;
|
|
|
|
Actor* actor;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
actor = get_actor(actorID);
|
|
|
|
set_variable(script, a1, get_nearest_home_index(actor->currentPos.x, actor->currentPos.y, actor->currentPos.z));
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-19 04:17:41 +01:00
|
|
|
ApiStatus GetIndexFromHome(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *args++);
|
2020-11-19 04:17:41 +01:00
|
|
|
s32 a1 = *args++;
|
|
|
|
Actor* actor;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
set_variable(script, a1, get_nearest_home_index(actor->homePos.x, actor->homePos.y, actor->homePos.z));
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus CountPlayerTargets(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *args++);
|
2020-11-19 04:17:41 +01:00
|
|
|
s32 targetSelectionFlags = *args++;
|
|
|
|
s32 outVar = *args++;
|
|
|
|
Actor* actor;
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
2020-11-19 17:02:42 +01:00
|
|
|
set_variable(script, outVar, count_targets(actor, get_nearest_home_index(actor->currentPos.x, actor->currentPos.y,
|
|
|
|
actor->currentPos.z), targetSelectionFlags));
|
2020-11-19 04:17:41 +01:00
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus ForceHomePos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *args++);
|
2020-11-19 04:17:41 +01:00
|
|
|
f32 x, y, z;
|
|
|
|
Actor* actor;
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = get_variable(script, *args++);
|
|
|
|
y = get_variable(script, *args++);
|
|
|
|
z = get_variable(script, *args++);
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
actor->homePos.x = x;
|
|
|
|
actor->currentPos.x = x;
|
|
|
|
actor->homePos.y = y;
|
|
|
|
actor->currentPos.y = y;
|
|
|
|
actor->homePos.z = z;
|
|
|
|
actor->currentPos.z = z;
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetHomePos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *args++);
|
2020-11-19 04:17:41 +01:00
|
|
|
f32 x, y, z;
|
|
|
|
Actor* actor;
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = get_variable(script, *args++);
|
|
|
|
y = get_variable(script, *args++);
|
|
|
|
z = get_variable(script, *args++);
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
actor->homePos.x = x;
|
|
|
|
actor->homePos.y = y;
|
|
|
|
actor->homePos.z = z;
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetGoalToTarget(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *args++);
|
2020-11-19 04:17:41 +01:00
|
|
|
Actor* actor;
|
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-11-19 04:17:41 +01:00
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
set_goal_pos_to_part(&actor->movePos, actor->targetActorID, actor->targetPartIndex);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
ApiStatus SetPartGoalToTarget(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
s32 partIndex = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
set_part_goal_to_actor_part(get_actor_part(actor, partIndex)->movement, actor->targetActorID, actor->targetPartIndex);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetGoalToFirstTarget(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
SelectableTarget* target;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
target = &actor->targetData[actor->targetIndexList[0]];
|
|
|
|
set_goal_pos_to_part(&actor->movePos, target->actorID, target->partID);
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetGoalPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
ActorMovePos* movePos;
|
|
|
|
f32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
movePos = &actor->movePos;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (*args == -12345678) {
|
|
|
|
x = actor->movePos.goal.x;
|
|
|
|
} else {
|
|
|
|
x = get_variable(script, *args);
|
|
|
|
}
|
|
|
|
|
|
|
|
*args++;
|
|
|
|
if (*args == -12345678) {
|
|
|
|
y = movePos->goal.y;
|
|
|
|
} else {
|
|
|
|
y = get_variable(script, *args);
|
|
|
|
}
|
|
|
|
|
|
|
|
*args++;
|
|
|
|
if (*args == -12345678) {
|
|
|
|
z = movePos->goal.z;
|
|
|
|
} else {
|
|
|
|
z = get_variable(script, *args);
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
movePos->goal.x = x;
|
|
|
|
movePos->goal.y = y;
|
|
|
|
movePos->goal.z = z;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetIdleGoal(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
ActorFlyPos* flyPos;
|
|
|
|
f32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
flyPos = &actor->flyPos;
|
|
|
|
|
|
|
|
if (*args == -12345678) {
|
|
|
|
x = actor->flyPos.goal.x;
|
|
|
|
} else {
|
|
|
|
x = get_variable(script, *args);
|
|
|
|
}
|
|
|
|
|
|
|
|
*args++;
|
|
|
|
if (*args == -12345678) {
|
|
|
|
y = flyPos->goal.y;
|
|
|
|
} else {
|
|
|
|
y = get_variable(script, *args);
|
|
|
|
}
|
|
|
|
|
|
|
|
*args++;
|
|
|
|
if (*args == -12345678) {
|
|
|
|
z = flyPos->goal.z;
|
|
|
|
} else {
|
|
|
|
z = get_variable(script, *args);
|
|
|
|
}
|
|
|
|
|
|
|
|
flyPos->goal.x = x;
|
|
|
|
flyPos->goal.y = y;
|
|
|
|
flyPos->goal.z = z;
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus AddGoalPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
f32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = get_float_variable(script, *args++);
|
|
|
|
y = get_float_variable(script, *args++);
|
|
|
|
z = get_float_variable(script, *args++);
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
actor->movePos.goal.x += x;
|
|
|
|
actor->movePos.goal.y += y;
|
|
|
|
actor->movePos.goal.z += z;
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:58:41 +01:00
|
|
|
ApiStatus GetGoalPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
s32 outX, outY, outZ;
|
|
|
|
s32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
outX = *args++;
|
|
|
|
outY = *args++;
|
|
|
|
outZ = *args++;
|
|
|
|
|
|
|
|
x = actor->movePos.goal.x;
|
|
|
|
y = actor->movePos.goal.y;
|
|
|
|
z = actor->movePos.goal.z;
|
|
|
|
|
|
|
|
set_variable(script, outX, x);
|
|
|
|
set_variable(script, outY, y);
|
|
|
|
set_variable(script, outZ, z);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// should this be renamed to GetFlyGoal ?
|
|
|
|
ApiStatus GetIdleGoal(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
s32 outX, outY, outZ;
|
|
|
|
s32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
outX = *args++;
|
|
|
|
outY = *args++;
|
|
|
|
outZ = *args++;
|
|
|
|
|
|
|
|
x = actor->flyPos.goal.x;
|
|
|
|
y = actor->flyPos.goal.y;
|
|
|
|
z = actor->flyPos.goal.z;
|
|
|
|
|
|
|
|
set_variable(script, outX, x);
|
|
|
|
set_variable(script, outY, y);
|
|
|
|
set_variable(script, outZ, z);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus GetPartTarget(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
s32 partIndex = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
ActorPart* actorPart;
|
|
|
|
s32 outX, outY, outZ;
|
|
|
|
s32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
actorPart = get_actor_part(actor, partIndex);
|
|
|
|
|
|
|
|
outX = *args++;
|
|
|
|
outY = *args++;
|
|
|
|
outZ = *args++;
|
|
|
|
|
|
|
|
x = actorPart->movement->goalPos.x;
|
|
|
|
y = actorPart->movement->goalPos.y;
|
|
|
|
z = actorPart->movement->goalPos.z;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:58:41 +01:00
|
|
|
set_variable(script, outX, x);
|
|
|
|
set_variable(script, outY, y);
|
|
|
|
set_variable(script, outZ, z);
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:58:41 +01:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:58:41 +01:00
|
|
|
ApiStatus GetActorPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
s32 outX, outY, outZ;
|
|
|
|
s32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
outX = *args++;
|
|
|
|
outY = *args++;
|
|
|
|
outZ = *args++;
|
|
|
|
|
|
|
|
x = actor->currentPos.x;
|
|
|
|
y = actor->currentPos.y;
|
|
|
|
z = actor->currentPos.z;
|
|
|
|
|
|
|
|
set_variable(script, outX, x);
|
|
|
|
set_variable(script, outY, y);
|
|
|
|
set_variable(script, outZ, z);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus GetPartOffset(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
s32 partIndex;
|
|
|
|
ActorPart* actorPart;
|
|
|
|
s32 outX, outY, outZ;
|
|
|
|
s32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
partIndex = get_variable(script, *args++);
|
|
|
|
actorPart = get_actor_part(get_actor(actorID), partIndex);
|
|
|
|
|
|
|
|
outX = *args++;
|
|
|
|
outY = *args++;
|
|
|
|
outZ = *args++;
|
|
|
|
|
|
|
|
if (!(actorPart->flags & 0x100000)) {
|
|
|
|
x = actorPart->partOffset.x;
|
|
|
|
y = actorPart->partOffset.y;
|
|
|
|
z = actorPart->partOffset.z;
|
|
|
|
} else {
|
|
|
|
x = actorPart->absolutePosition.x;
|
|
|
|
y = actorPart->absolutePosition.y;
|
|
|
|
z = actorPart->absolutePosition.z;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_variable(script, outX, x);
|
|
|
|
set_variable(script, outY, y);
|
|
|
|
set_variable(script, outZ, z);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus GetPartPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
s32 partIndex;
|
|
|
|
ActorPart* actorPart;
|
|
|
|
s32 outX, outY, outZ;
|
|
|
|
s32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
partIndex = get_variable(script, *args++);
|
|
|
|
actorPart = get_actor_part(get_actor(actorID), partIndex);
|
|
|
|
|
|
|
|
outX = *args++;
|
|
|
|
outY = *args++;
|
|
|
|
outZ = *args++;
|
|
|
|
|
|
|
|
x = actorPart->currentPos.x;
|
|
|
|
y = actorPart->currentPos.y;
|
|
|
|
z = actorPart->currentPos.z;
|
|
|
|
|
|
|
|
set_variable(script, outX, x);
|
|
|
|
set_variable(script, outY, y);
|
|
|
|
set_variable(script, outZ, z);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus GetHomePos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
s32 outX, outY, outZ;
|
|
|
|
s32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
outX = *args++;
|
|
|
|
outY = *args++;
|
|
|
|
outZ = *args++;
|
|
|
|
|
|
|
|
x = actor->homePos.x;
|
|
|
|
y = actor->homePos.y;
|
|
|
|
z = actor->homePos.z;
|
|
|
|
|
|
|
|
set_variable(script, outX, x);
|
|
|
|
set_variable(script, outY, y);
|
|
|
|
set_variable(script, outZ, z);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetActorPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
f32 x, y, z;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = get_variable(script, *args++);
|
|
|
|
y = get_variable(script, *args++);
|
|
|
|
z = get_variable(script, *args++);
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
actor->currentPos.x = x;
|
|
|
|
actor->currentPos.y = y;
|
|
|
|
actor->currentPos.z = z;
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetPartPos(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
s32 partIndex;
|
|
|
|
f32 x, y, z;
|
|
|
|
ActorPart* actorPart;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
partIndex = get_variable(script, *args++);
|
|
|
|
x = get_variable(script, *args++);
|
|
|
|
y = get_variable(script, *args++);
|
|
|
|
z = get_variable(script, *args++);
|
|
|
|
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
|
|
|
|
switch (actorID & 0x700) {
|
|
|
|
case 0:
|
|
|
|
actor->currentPos.x = x;
|
|
|
|
actor->currentPos.y = y;
|
|
|
|
actor->currentPos.z = z;
|
|
|
|
break;
|
|
|
|
case 0x100:
|
|
|
|
case 0x200:
|
|
|
|
actorPart = get_actor_part(actor, partIndex);
|
|
|
|
|
|
|
|
if (!(actorPart->flags & 0x100000)) {
|
|
|
|
actorPart->partOffset.x = x;
|
|
|
|
actorPart->partOffset.y = y;
|
|
|
|
actorPart->partOffset.z = z;
|
|
|
|
} else {
|
|
|
|
actorPart->absolutePosition.x = x;
|
|
|
|
actorPart->absolutePosition.y = y;
|
|
|
|
actorPart->absolutePosition.z = z;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetEnemyTargetOffset(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
s32 partIndex;
|
|
|
|
f32 x, y;
|
|
|
|
ActorPart* actorPart;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
partIndex = get_variable(script, *args++);
|
|
|
|
x = get_variable(script, *args++);
|
|
|
|
y = get_variable(script, *args++);
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
actor = get_actor(actorID);
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
switch (actorID & 0x700) {
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
case 0x100:
|
|
|
|
case 0x200:
|
|
|
|
actorPart = get_actor_part(actor, partIndex);
|
|
|
|
actorPart->targetOffset.x = x;
|
|
|
|
actorPart->targetOffset.y = y;
|
|
|
|
break;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus SetAnimation(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_animation(actorID, get_variable(script, *args++), get_variable(script, *args++));
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus GetAnimation(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
s32 var1;
|
|
|
|
ActorPart* actorPart;
|
|
|
|
s32 a1;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
var1 = get_variable(script, *args++);
|
|
|
|
a1 = *args++;
|
|
|
|
|
|
|
|
actorPart = get_actor_part(get_actor(actorID), var1);
|
|
|
|
|
|
|
|
if (actorPart != NULL) {
|
|
|
|
set_variable(script, a1, actorPart->currentAnimation);
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetAnimationRate(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
Actor* actor;
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
set_animation_rate(actorID, get_variable(script, *args++), get_float_variable(script, *args++));
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetActorYaw(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ActorID actorID = get_variable(script, *args++);
|
|
|
|
|
|
|
|
if (actorID == ActorID_SELF) {
|
|
|
|
actorID = script->owner1.actorID;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_actor_yaw(actorID, get_variable(script, *args++));
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetActorYaw);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartYaw);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartYaw);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorJumpGravity);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorIdleJumpGravity);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorSpeed);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorIdleSpeed);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartJumpGravity);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartMoveSpeed);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetJumpAnimations);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", AddActorPos);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorDispOffset);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartDispOffset);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartDispOffset);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", AddPartDispOffset);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026BF48);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetActorVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", AddActorVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartMovementVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartMovementVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", AddPartMovementVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorRotation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorRotationOffset);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetActorRotation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartRotation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartRotationOffset);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartRotation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorScale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorScaleModifier);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetActorScale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartScale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartScale);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus GetBattleFlags(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gBattleStatus.flags1);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus SetBattleFlagBits(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode a0 = *args++;
|
|
|
|
|
|
|
|
if (get_variable(script, *args)) {
|
|
|
|
gBattleStatus.flags1 |= a0;
|
|
|
|
} else {
|
|
|
|
gBattleStatus.flags1 &= ~a0;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus GetBattleFlags2(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gBattleStatus.flags2);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetBattleFlagBits2);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorFlagBits);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetActorFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartFlagBits);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartTargetFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartTargetFlagBits);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartTargetFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartEventFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartEventBits);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetPartEventFlags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026D51C);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026D5A4);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", HPBarToHome);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", HPBarToCurrent);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026D8EC);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026D940);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026DA94);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SummonEnemy);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus GetOwnerID(ScriptInstance* script, s32 isInitialCall) {
|
2020-10-21 01:02:05 +02:00
|
|
|
set_variable(script, *script->ptrReadPos, script->owner1.actorID);
|
2020-10-16 22:29:55 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus SetOwnerID(ScriptInstance* script, s32 isInitialCall) {
|
2020-10-21 01:02:05 +02:00
|
|
|
script->owner1.actorID = get_variable(script, *script->ptrReadPos);
|
2020-10-16 22:29:55 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
ApiStatus ActorExists(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode isExist;
|
|
|
|
Actor* partner = gBattleStatus.partnerActor;
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:41:49 +01:00
|
|
|
ActorID actorID = get_variable(script, *args++);
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-20 01:41:49 +01:00
|
|
|
if (actorID == ActorID_SELF) {
|
2020-10-21 01:02:05 +02:00
|
|
|
actorID = script->owner1.actorID;
|
2020-10-15 05:49:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
isExist = get_actor(actorID) != NULL;
|
2020-11-20 01:41:49 +01:00
|
|
|
if ((actorID == ActorID_PARTNER) && (partner == NULL)) {
|
2020-10-15 05:49:49 +02:00
|
|
|
isExist = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_variable(script, *args++, isExist);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026DEF0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026DF88);
|
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_8026E020(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
s32 a0 = *script->ptrReadPos;
|
|
|
|
|
|
|
|
gBattleStatus.unk_70 = a0;
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 20:49:18 +02:00
|
|
|
ApiStatus func_8026E038(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
gBattleStatus.unk_74 = *script->ptrReadPos;
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 20:49:18 +02:00
|
|
|
ApiStatus SetBattleInputMask(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
gBattleStatus.inputBitmask = *script->ptrReadPos;
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus SetBattleInputButtons(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-11-20 01:58:41 +01:00
|
|
|
BattleStatus* battleStatus = BATTLE_STATUS;
|
2020-10-16 22:29:55 +02:00
|
|
|
s32 currentButtonsDown = *args++;
|
|
|
|
s32 currentButtonsPressed = *args++;
|
|
|
|
s32 currentButtonsHeld = *args;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
battleStatus->currentButtonsDown = currentButtonsDown;
|
|
|
|
battleStatus->currentButtonsPressed = currentButtonsPressed;
|
|
|
|
battleStatus->currentButtonsHeld = currentButtonsHeld;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus CheckButtonPress(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode buttons = *args++;
|
|
|
|
Bytecode out = *args;
|
|
|
|
s32 buttonsPressed = gBattleStatus.currentButtonsPressed;
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
set_variable(script, out, (buttonsPressed & buttons) != 0);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus CheckButtonHeld(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode buttons = *args++;
|
|
|
|
Bytecode out = *args;
|
|
|
|
s32 buttonsHeld = gBattleStatus.currentButtonsHeld;
|
|
|
|
|
|
|
|
set_variable(script, out, (buttonsHeld & buttons) != 0);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus CheckButtonDown(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode buttons = *args++;
|
|
|
|
Bytecode out = *args;
|
|
|
|
s32 buttonsDown = gBattleStatus.currentButtonsDown;
|
|
|
|
|
|
|
|
set_variable(script, out, (buttonsDown & buttons) != 0);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus GetBattleState(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gBattleState);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_8026E16C(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
func_80241190(get_variable(script, *script->ptrReadPos));
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026E198);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026E208);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026E260);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus PlayerCreateTargetList(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-10-21 01:02:05 +02:00
|
|
|
Actor* actor = get_actor(script->owner1.actorID);
|
2020-10-16 22:29:55 +02:00
|
|
|
|
|
|
|
gBattleStatus.currentTargetListFlags = *args;
|
|
|
|
player_create_target_list(actor);
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus EnemyCreateTargetList(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-10-21 01:02:05 +02:00
|
|
|
Actor* actor = get_actor(script->owner1.actorID);
|
2020-10-16 22:29:55 +02:00
|
|
|
|
|
|
|
gBattleStatus.currentTargetListFlags = *args;
|
|
|
|
enemy_create_target_list(actor);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", InitTargetIterator);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetOwnerTarget);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", ChooseNextTarget);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026E558);
|
|
|
|
|
2020-11-19 17:02:42 +01:00
|
|
|
ApiStatus GetTargetListLength(ScriptInstance* script) {
|
2020-11-19 04:17:41 +01:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
|
|
|
|
set_variable(script, *args, get_actor(script->owner1.actorID)->targetListLength);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetOwnerTarget);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026E914);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus GetAttackerActorID(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gBattleStatus.attackerActorID);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026E9A0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetDistanceToGoal);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026EA7C);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026EB20);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026EBF8);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026ED20);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026EDE4);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", AddActorDecoration);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", RemoveActorDecoration);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", ModifyActorDecoration);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", UseIdleAnimation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8026F1A0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetStatusFlags);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus RemovePlayerBuffs(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
remove_player_buffs(*script->ptrReadPos);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartAlpha);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", CreatePartShadow);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", RemovePartShadow);
|
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_8026F60C(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
BATTLE_STATUS->unk_8D = get_variable(script, *script->ptrReadPos);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetBattleVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetBattleVar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", ResetAllActorSounds);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorSounds);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", ResetActorSounds);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetPartSounds);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", SetActorType);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", ShowShockEffect);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetActorAttackBoost);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetActorDefenseBoost);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", BoostAttack);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", BoostDefense);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", VanishActor);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", ElectrifyActor);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", HealActor);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", WaitForBuffDone);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", CopyBuffs);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80271210);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80271258);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_802712A0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80271328);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_802713B0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_8027143C);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80271484);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80271588);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", dispatch_event_player);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", dispatch_event_player_continue_turn);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", calc_player_test_enemy);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", calc_player_damage_enemy);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", dispatch_damage_event_player);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
void dispatch_damage_event_player_0(s32 damageAmount, Event event) {
|
2020-11-20 01:58:41 +01:00
|
|
|
BattleStatus* battleStatus = BATTLE_STATUS;
|
2020-10-16 22:29:55 +02:00
|
|
|
|
|
|
|
battleStatus->currentAttackElement = Element_END;
|
|
|
|
battleStatus->unk_19A = 0;
|
|
|
|
dispatch_damage_event_player(damageAmount, event, FALSE);
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
void dispatch_damage_event_player_1(s32 damageAmount, Event event) {
|
|
|
|
dispatch_damage_event_player(damageAmount, event, TRUE);
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", GetMenuSelection);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80273444);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", PlayerFallToGoal);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", PlayerLandJump);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", PlayerRunToGoal);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", CancelablePlayerRunToGoal);
|
|
|
|
|
2020-10-16 22:29:55 +02:00
|
|
|
ApiStatus GetPlayerHP(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
set_variable(script, *script->ptrReadPos, gPlayerData.curHP);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
2020-10-15 05:49:49 +02:00
|
|
|
INCLUDE_ASM(s32, "code_197F40", PlayerDamageEnemy);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", PlayerPowerBounceEnemy);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", PlayerTestEnemy);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", DispatchDamagePlayerEvent);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", EnablePlayerBlur);
|
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_802749D8(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
func_802549A0();
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_802749F8(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
func_802549C0();
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80274A18);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_802752AC);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", func_80275F00);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_197F40", DidActionSucceed);
|
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_80276EFC(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
gBattleStatus.flags1 |= 0x200000;
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
2020-11-27 20:38:52 +01:00
|
|
|
ApiStatus func_80276F1C(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
dispatch_event_player(get_variable(script, *script->ptrReadPos));
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|