papermario/src/code_fe0b0_len_5a0.c

61 lines
1.7 KiB
C
Raw Normal View History

2020-07-18 02:47:33 +02:00
#include "common.h"
2020-08-16 08:55:51 +02:00
INCLUDE_API_ASM(code_fe0b0_len_5a0, SetSpriteShading);
2020-07-18 02:47:33 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus EnableSpriteShading(ScriptInstance* script, s32 isInitialCall) {
2020-07-18 02:47:33 +02:00
if (get_variable(script, *script->ptrReadPos) != 0) {
*D_80151328 |= 1;
} else {
*D_80151328 &= ~1;
}
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-07-18 02:47:33 +02:00
}
2020-08-16 07:13:03 +02:00
s32 getDemoState(ScriptInstance* script) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->demoState);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-07-18 02:47:33 +02:00
}
2020-08-16 08:55:51 +02:00
ApiStatus DemoPressButton(ScriptInstance* script, s32 isInitialCall) {
(*gGameStatusPtr)->demoButtonInput |= get_variable(script, *script->ptrReadPos);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-07-18 02:47:33 +02:00
}
2020-08-16 08:55:51 +02:00
ApiStatus DemoReleaseButton(ScriptInstance* script, s32 isInitialCall) {
(*gGameStatusPtr)->demoButtonInput &= ~get_variable(script, *script->ptrReadPos);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-07-18 02:47:33 +02:00
}
2020-08-16 08:55:51 +02:00
ApiStatus DemoSetButtons(ScriptInstance* script, s32 isInitialCall) {
(*gGameStatusPtr)->demoButtonInput = get_variable(script, *script->ptrReadPos);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-07-18 02:47:33 +02:00
}
2020-08-16 08:55:51 +02:00
ApiStatus DemoJoystickRadial(ScriptInstance* script, s32 isInitialCall) {
f32 a;
f32 b;
s32* thisPos = script->ptrReadPos;
2020-07-18 02:47:33 +02:00
a = get_float_variable(script, *thisPos++);
2020-07-19 05:56:17 +02:00
b = get_float_variable(script, *thisPos++);
2020-07-18 02:47:33 +02:00
(*gGameStatusPtr)->demoStickX = a * sin_deg(b);
(*gGameStatusPtr)->demoStickY = a * cos_deg(b);
2020-08-12 04:08:48 +02:00
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-07-18 02:47:33 +02:00
}
2020-08-16 08:55:51 +02:00
ApiStatus DemoJoystickXY(ScriptInstance* script, s32 isInitialCall) {
2020-08-13 07:03:47 +02:00
f32 x;
f32 y;
2020-07-18 02:47:33 +02:00
s32* thisPos = script->ptrReadPos;
2020-08-13 07:03:47 +02:00
x = get_float_variable(script, *thisPos++);
y = get_float_variable(script, *thisPos++);
2020-08-13 07:03:47 +02:00
(*gGameStatusPtr)->demoStickX = x;
(*gGameStatusPtr)->demoStickY = y;
2020-07-18 02:47:33 +02:00
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
}