2020-08-04 08:49:11 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-08-14 02:29:25 +02:00
|
|
|
s32 MakeLerp(script_context* script, s32 initialCall) {
|
|
|
|
s32* ptrReadPos = script->ptrReadPos;
|
|
|
|
|
2020-08-15 02:17:20 +02:00
|
|
|
script->varTable[0xC] = get_variable(script, *ptrReadPos++); // start
|
|
|
|
script->varTable[0xD] = get_variable(script, *ptrReadPos++); // end
|
|
|
|
script->varTable[0xF] = get_variable(script, *ptrReadPos++); // duration
|
|
|
|
script->varTable[0xB] = get_variable(script, *ptrReadPos++); // easing type
|
2020-08-15 02:49:33 +02:00
|
|
|
script->varTable[0xE] = 0; // elapsed
|
2020-08-15 02:17:20 +02:00
|
|
|
|
2020-08-14 02:29:25 +02:00
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 02:49:33 +02:00
|
|
|
s32 UpdateLerp(script_context* script, s32 initialCall) {
|
|
|
|
script->varTable[0x0] = (s32) update_lerp(
|
|
|
|
script->varTable[0xB],
|
2020-08-15 05:12:30 +02:00
|
|
|
script->varTable[0xC],
|
|
|
|
script->varTable[0xD],
|
2020-08-15 02:49:33 +02:00
|
|
|
script->varTable[0xE],
|
|
|
|
script->varTable[0xF]
|
|
|
|
);
|
|
|
|
|
|
|
|
if (script->varTable[0xE] >= script->varTable[0xF]) {
|
|
|
|
script->varTable[0x1] = 0; // finished
|
|
|
|
} else {
|
|
|
|
script->varTable[0x1] = 1; // lerping
|
|
|
|
}
|
|
|
|
script->varTable[0xE]++;
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 05:25:48 +02:00
|
|
|
s32 RandInt(script_context* script, s32 initialCall) {
|
|
|
|
bytecode* ptrReadPos = script->ptrReadPos;
|
|
|
|
|
2020-08-15 07:00:29 +02:00
|
|
|
s32 max = get_variable(script, *ptrReadPos++);
|
2020-08-15 05:25:48 +02:00
|
|
|
bytecode outVar = *ptrReadPos++;
|
|
|
|
|
2020-08-15 07:00:29 +02:00
|
|
|
set_variable(script, outVar, rand_int(max));
|
2020-08-15 05:25:48 +02:00
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 06:27:01 +02:00
|
|
|
s32 GetAngleBetweenNPCs(script_context* script, s32 initialCall) {
|
|
|
|
bytecode* ptrReadPos = script->ptrReadPos;
|
|
|
|
|
|
|
|
NPC aID = get_variable(script, *ptrReadPos++);
|
|
|
|
NPC bID = get_variable(script, *ptrReadPos++);
|
|
|
|
bytecode outVar = *ptrReadPos++;
|
|
|
|
|
|
|
|
npc* a = resolve_npc(script, aID);
|
|
|
|
npc* b = resolve_npc(script, bID);
|
|
|
|
set_variable(script, outVar, atan2(a->pos.x, a->pos.z, b->pos.x, b->pos.z));
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 07:00:29 +02:00
|
|
|
s32 GetAngleToNPC(script_context* script, s32 initialCall) {
|
|
|
|
player_status* playerStatus = &gPlayerStatus;
|
|
|
|
bytecode* ptrReadPos = script->ptrReadPos;
|
|
|
|
|
|
|
|
NPC npcID = get_variable(script, *ptrReadPos++);
|
|
|
|
bytecode outVar = *ptrReadPos++;
|
|
|
|
|
|
|
|
npc* npc = resolve_npc(script, npcID);
|
|
|
|
set_variable(script, outVar, atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z));
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 07:00:29 +02:00
|
|
|
s32 GetAngleToPlayer(script_context* script, s32 initialCall) {
|
|
|
|
player_status* playerStatus = &gPlayerStatus;
|
|
|
|
bytecode* ptrReadPos = script->ptrReadPos;
|
|
|
|
|
|
|
|
NPC npcID = get_variable(script, *ptrReadPos++);
|
|
|
|
bytecode outVar = *ptrReadPos++;
|
|
|
|
|
|
|
|
npc* npc = resolve_npc(script, npcID);
|
|
|
|
set_variable(script, outVar, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z));
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, AwaitPlayerApproach);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, IsPlayerWithin);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, AwaitPlayerLeave);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, AddVectorPolar);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, setup_path_data);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, func_802D5270);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, LoadPath);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, GetNextPathPos);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, GetDist2D);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, SetValueByRef);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, GetValueByRef);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, EnableStatusMenu);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, ShowStatusMenu);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, SetGameMode);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, ClampAngleInt);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f8f60_len_1560, ClampAngleFloat);
|