match UpdateLerp

This commit is contained in:
Alex Bates 2020-08-15 01:49:33 +01:00
parent 0d8d3e50a9
commit dae676c8af
4 changed files with 23 additions and 4 deletions

View File

@ -191,7 +191,7 @@ typedef struct script_context {
/* 0x06C */ struct script_context* parentScript; /* brother? */
/* 0x070 */ s32 functionTemp[4];
/* 0x080 */ UNK_PTR callFunction;
/* 0x084 */ u32 varTable[16];
/* 0x084 */ s32 varTable[16];
/* 0x0C4 */ s32 varFlags[3];
/* 0x0D0 */ s32 loopStartTable[8];
/* 0x0F0 */ s32 loopCounterTable[8];

View File

@ -3,6 +3,7 @@
#include "ultra64.h"
#include "common_structs.h"
#include "enums.h"
void osCleanupThread(void);
@ -19,6 +20,7 @@ s32 func_800554E8(s32, s32);
s32 func_800555E4(s32);
void func_80137D88(s32, f32);
void func_80137E10(s32, u8, u8, u8);
f32 update_lerp(EASING easing, f32 start, f32 end, s32 elapsed, s32 duration);
s32 play_sound_at_position(s32 soundID, s32 value2, f32 posX, f32 posY, f32 posZ);
s32 set_music_track(s32 musicPlayer, s32 songID, s32 variation, s32 unk, s32 volume);

View File

@ -78,7 +78,7 @@ f32 INCLUDE_ASM(code_42e0_len_1f60, sin_deg, f32 x);
f32 INCLUDE_ASM(code_42e0_len_1f60, cos_deg, f32 x);
INCLUDE_ASM(code_42e0_len_1f60, update_lerp);
f32 INCLUDE_ASM(code_42e0_len_1f60, update_lerp, EASING easing, f32 start, f32 end, s32 elapsed, s32 duration);
INCLUDE_ASM(code_42e0_len_1f60, func_8002A904);

View File

@ -7,12 +7,29 @@ s32 MakeLerp(script_context* script, s32 initialCall) {
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
script->varTable[0xE] = 0;
script->varTable[0xE] = 0; // elapsed
return 2;
}
INCLUDE_ASM(code_f8f60_len_1560, UpdateLerp);
s32 UpdateLerp(script_context* script, s32 initialCall) {
script->varTable[0x0] = (s32) update_lerp(
script->varTable[0xB],
(s32) script->varTable[0xC],
(s32) script->varTable[0xD],
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;
}
INCLUDE_ASM(code_f8f60_len_1560, RandInt);