PR comments

This commit is contained in:
Ethan Roseman 2020-10-26 17:45:24 -04:00
parent 099c159535
commit 9494153160
5 changed files with 22 additions and 16 deletions

View File

@ -32,6 +32,9 @@
#define MAX_ENTITIES 30
#define MAX_DYNAMIC_ENTITIES 16
// Alternative to libultra's M_PI: non-float version; more digits cause issues
#define PI 3.141592f
//NOTE: SCRIPT_ALLOC is probably not quite correct, but this is the closest thing to matching for the functions its used in. Needs more work.
#define SCRIPT_ALLOC(new, index) \
{ \

View File

@ -1,11 +1,11 @@
#include "common.h"
s32 si_find_label(ScriptInstance* script, s32 arg1);
s32 si_skip_if(ScriptInstance* script);
s32 si_skip_else(ScriptInstance* script);
s32 si_goto_end_loop(ScriptInstance* script);
Bytecode* si_find_label(ScriptInstance* script, s32 arg1);
Bytecode* si_skip_if(ScriptInstance* script);
Bytecode* si_skip_else(ScriptInstance* script);
Bytecode* si_goto_end_case(ScriptInstance* script);
s32 si_goto_next_case(ScriptInstance* script);
Bytecode* si_goto_next_case(ScriptInstance* script);
Bytecode* si_goto_end_loop(ScriptInstance* script);
s32 get_variable_index(ScriptInstance* script, s32 var);
f32 fixed_var_to_float(Bytecode scriptVar) {
@ -1380,8 +1380,8 @@ INCLUDE_ASM(f32, "si", get_float_variable, ScriptInstance* script, Bytecode var)
INCLUDE_ASM(f32, "si", set_float_variable, ScriptInstance* script, Bytecode var, f32 value);
s32 si_find_label(ScriptInstance* script, s32 arg1) {
s32 ret = script->ptrReadPos;
Bytecode* si_find_label(ScriptInstance* script, s32 arg1) {
Bytecode* ret = script->ptrReadPos;
s32 i;
if (arg1 < -270000000) {
@ -1399,7 +1399,7 @@ s32 si_find_label(ScriptInstance* script, s32 arg1) {
return ret;
}
INCLUDE_ASM(s32, "si", si_skip_if, ScriptInstance* script);
INCLUDE_ASM(Bytecode*, "si", si_skip_if, ScriptInstance* script);
// Matching but needs rodata support
/*Bytecode* si_skip_if(ScriptInstance* script) {
s32 nestedIfDepth = 0;
@ -1439,7 +1439,7 @@ INCLUDE_ASM(s32, "si", si_skip_if, ScriptInstance* script);
} while(1);
}*/
INCLUDE_ASM(s32, "si", si_skip_else, ScriptInstance* script);
INCLUDE_ASM(Bytecode*, "si", si_skip_else, ScriptInstance* script);
// Matching but needs rodata support
/*Bytecode* si_skip_else(ScriptInstance* script) {
s32 nestedIfDepth = 0;
@ -1477,6 +1477,6 @@ INCLUDE_ASM(s32, "si", si_skip_else, ScriptInstance* script);
INCLUDE_ASM(Bytecode*, "si", si_goto_end_case, ScriptInstance* script);
INCLUDE_ASM(s32, "si", si_goto_next_case, ScriptInstance* script);
INCLUDE_ASM(Bytecode*, "si", si_goto_next_case, ScriptInstance* script);
INCLUDE_ASM(s32, "si", si_goto_end_loop, ScriptInstance* script);
INCLUDE_ASM(Bytecode*, "si", si_goto_end_loop, ScriptInstance* script);

View File

@ -1,14 +1,14 @@
#include "trd_03.h"
static ApiStatus func_80240000_9A4650(ScriptInstance* script, s32 isInitialCall) {
ApiStatus func_80240000_9A4650(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
u32 stickX;
stickX = 0;
if (gCollisionStatus.pushingAgainstWall == 35) {
stickX = ((u32)GAME_STATUS->stickX) >> 0x1F;
if (gCollisionStatus.pushingAgainstWall == COLLIDER_o84) {
stickX = GAME_STATUS->stickX < 0;
}
if ((gCollisionStatus.pushingAgainstWall == 37) && (GAME_STATUS->stickX > 0)) {
if ((gCollisionStatus.pushingAgainstWall == COLLIDER_o85) && (GAME_STATUS->stickX > 0)) {
stickX = 2;
}

View File

@ -2,3 +2,6 @@
#include "map.h"
#define MAP_NAME trd_03
#define COLLIDER_o84 35
#define COLLIDER_o85 37

View File

@ -12,7 +12,7 @@ static ApiStatus SomeItemEntityFunc(ScriptInstance* script, s32 isInitialCall) {
switch (script->functionTemp[1].s) {
case 0:
itemEntity->position.y = script->functionTemp[2].f + ((1.0f - cos_rad((script->functionTemp[3].s *
(1.570796f)) / 30.0f)) * 20.0f);
(PI / 2)) / 30.0f)) * 20.0f);
if (script->functionTemp[3].s == 30) {
script->functionTemp[1].s = 1;
script->functionTemp[3].s = 0;