You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Some requested changes + fix build
This commit is contained in:
@@ -482,8 +482,8 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s32 yaw, f32 radius);
|
||||
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b);
|
||||
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s);
|
||||
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b);
|
||||
extern void mtxf_to_mtx_asm(register s16 *dest, register f32 *src);
|
||||
inline void mtxf_to_mtx(register s16 *dest, register f32 *src) {
|
||||
extern void mtxf_to_mtx_asm(register void *dest, register void *src);
|
||||
inline void mtxf_to_mtx(register void *dest, register void *src) {
|
||||
mtxf_to_mtx_asm(dest, src);
|
||||
}
|
||||
void mtxf_rotate_xy(Mtx *mtx, s32 angle);
|
||||
|
||||
@@ -2855,8 +2855,8 @@ void update_camera(struct Camera *c) {
|
||||
|
||||
c->yaw = gLakituState.yaw;
|
||||
c->nextYaw = gLakituState.nextYaw;
|
||||
c->mode = gLakituState.mode;// = c->mode;
|
||||
c->defMode = gLakituState.defMode;// = c->defMode;
|
||||
c->mode = gLakituState.mode;
|
||||
c->defMode = gLakituState.defMode;
|
||||
#ifdef CAMERA_FIX
|
||||
if (gCurrDemoInput != NULL) camera_course_processing(c);
|
||||
#else
|
||||
@@ -3865,19 +3865,8 @@ s16 reduce_by_dist_from_camera(s16 value, f32 maxDist, f32 posX, f32 posY, f32 p
|
||||
|
||||
s32 clamp_positions_and_find_yaw(Vec3f pos, Vec3f origin, f32 xMax, f32 xMin, f32 zMax, f32 zMin) {
|
||||
s16 yaw = gCamera->nextYaw;
|
||||
|
||||
if (pos[0] >= xMax) {
|
||||
pos[0] = xMax;
|
||||
}
|
||||
if (pos[0] <= xMin) {
|
||||
pos[0] = xMin;
|
||||
}
|
||||
if (pos[2] >= zMax) {
|
||||
pos[2] = zMax;
|
||||
}
|
||||
if (pos[2] <= zMin) {
|
||||
pos[2] = zMin;
|
||||
}
|
||||
pos[0] = CLAMP(pos[0], xMin, xMax);
|
||||
pos[2] = CLAMP(pos[2], zMin, zMax);
|
||||
yaw = calculate_yaw(origin, pos);
|
||||
return yaw;
|
||||
}
|
||||
@@ -4047,14 +4036,14 @@ s32 is_pos_in_bounds(Vec3f pos, Vec3f center, Vec3f bounds, s16 boundsYaw) {
|
||||
-bounds[2] < rel[2] && rel[2] < bounds[2]);
|
||||
}
|
||||
|
||||
s16 calculate_pitch(Vec3f from, Vec3f to) {
|
||||
s32 calculate_pitch(Vec3f from, Vec3f to) {
|
||||
f32 dx = to[0] - from[0];
|
||||
f32 dy = to[1] - from[1];
|
||||
f32 dz = to[2] - from[2];
|
||||
return atan2s(sqrtf(sqr(dx) + sqr(dz)), dy);
|
||||
}
|
||||
|
||||
s16 calculate_yaw(Vec3f from, Vec3f to) {
|
||||
s32 calculate_yaw(Vec3f from, Vec3f to) {
|
||||
f32 dx = to[0] - from[0];
|
||||
f32 dz = to[2] - from[2];
|
||||
return atan2s(dz, dx);
|
||||
@@ -5023,19 +5012,17 @@ void set_fixed_cam_axis_sa_lobby(UNUSED s16 preset) {
|
||||
* or if the camera is in Mario mode and Mario is not swimming or in water with the metal cap
|
||||
*/
|
||||
#ifdef CAMERA_FIX
|
||||
void check_blocking_area_processing(UNUSED const UNUSED u8 *mode) {
|
||||
void check_blocking_area_processing(UNUSED const u8 *mode) {
|
||||
sStatusFlags |= CAM_FLAG_BLOCK_AREA_PROCESSING;
|
||||
#else
|
||||
void check_blocking_area_processing(UNUSED const u8 *mode) {
|
||||
void check_blocking_area_processing(const u8 *mode) {
|
||||
if ((sMarioCamState->action & ACT_FLAG_METAL_WATER) || (sMarioCamState->action == ACT_DEBUG_FREE_MOVE) ||
|
||||
*mode == CAMERA_MODE_BEHIND_MARIO || *mode == CAMERA_MODE_WATER_SURFACE) {
|
||||
sStatusFlags |= CAM_FLAG_BLOCK_AREA_PROCESSING;
|
||||
}
|
||||
#ifndef DISABLE_LEVEL_SPECIFIC_CHECKS
|
||||
if (gCurrLevelNum == LEVEL_DDD || gCurrLevelNum == LEVEL_WDW || gCurrLevelNum == LEVEL_COTMC) {
|
||||
sStatusFlags &= ~CAM_FLAG_BLOCK_AREA_PROCESSING;
|
||||
}
|
||||
#endif
|
||||
if ((*mode == CAMERA_MODE_BEHIND_MARIO &&
|
||||
!(sMarioCamState->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER))) ||
|
||||
*mode == CAMERA_MODE_INSIDE_CANNON) {
|
||||
@@ -5990,7 +5977,10 @@ s16 camera_course_processing(struct Camera *c) {
|
||||
|
||||
case AREA_BBH:
|
||||
// if camera is fixed at bbh_room_13_balcony_camera (but as floats)
|
||||
if (sFixedModeBasePosition[0] == 210.f && sFixedModeBasePosition[1] == 420.f && sFixedModeBasePosition[2] == 3109.f && sMarioCamState->pos[1] < 1800.f) {
|
||||
if (sFixedModeBasePosition[0] == 210.f
|
||||
&& sFixedModeBasePosition[1] == 420.f
|
||||
&& sFixedModeBasePosition[2] == 3109.f
|
||||
&& sMarioCamState->pos[1] < 1800.f) {
|
||||
transition_to_camera_mode(c, CAMERA_MODE_CLOSE, 30);
|
||||
}
|
||||
break;
|
||||
@@ -7119,6 +7109,7 @@ void star_dance_bound_yaw(struct Camera *c, s16 absYaw, s16 yawMax) {
|
||||
* Store the camera's focus in cvar9.
|
||||
*/
|
||||
void cutscene_dance_closeup_start(struct Camera *c) {
|
||||
#ifndef DISABLE_LEVEL_SPECIFIC_CHECKS
|
||||
if ((gLastCompletedStarNum == 4) && (gCurrCourseNum == COURSE_JRB)) {
|
||||
star_dance_bound_yaw(c, 0x0, 0x4000);
|
||||
}
|
||||
@@ -7128,7 +7119,7 @@ void cutscene_dance_closeup_start(struct Camera *c) {
|
||||
if ((gLastCompletedStarNum == 5) && (gCurrCourseNum == COURSE_WDW)) {
|
||||
star_dance_bound_yaw(c, 0x8000, 0x800);
|
||||
}
|
||||
|
||||
#endif
|
||||
vec3f_copy(sCutsceneVars[9].point, c->focus);
|
||||
//! cvar8 is unused in the closeup cutscene
|
||||
sCutsceneVars[8].angle[0] = 0x2000;
|
||||
@@ -7152,12 +7143,12 @@ void cutscene_dance_closeup_fly_above(struct Camera *c) {
|
||||
s16 pitch, yaw;
|
||||
f32 dist;
|
||||
s16 goalPitch = 0x1800;
|
||||
|
||||
#ifndef DISABLE_LEVEL_SPECIFIC_CHECKS
|
||||
if ((gLastCompletedStarNum == 6 && gCurrCourseNum == COURSE_SL) ||
|
||||
(gLastCompletedStarNum == 4 && gCurrCourseNum == COURSE_TTC)) {
|
||||
goalPitch = 0x800;
|
||||
}
|
||||
|
||||
#endif
|
||||
vec3f_get_dist_and_angle(sMarioCamState->pos, c->pos, &dist, &pitch, &yaw);
|
||||
approach_f32_asymptotic_bool(&dist, 800.f, 0.05f);
|
||||
approach_s16_asymptotic_bool(&pitch, goalPitch, 16);
|
||||
@@ -7232,12 +7223,13 @@ void cutscene_dance_fly_away_start(struct Camera *c) {
|
||||
c->yaw = calculate_yaw(areaCenter, c->pos);
|
||||
c->nextYaw = c->yaw;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_LEVEL_SPECIFIC_CHECKS
|
||||
// Restrict the camera yaw in tight spaces
|
||||
if ((gLastCompletedStarNum == 6) && (gCurrCourseNum == COURSE_CCM)) star_dance_bound_yaw(c, 0x5600, 0x800);
|
||||
if ((gLastCompletedStarNum == 2) && (gCurrCourseNum == COURSE_TTM)) star_dance_bound_yaw(c, 0x0, 0x800);
|
||||
if ((gLastCompletedStarNum == 1) && (gCurrCourseNum == COURSE_SL )) star_dance_bound_yaw(c, 0x2000, 0x800);
|
||||
if ((gLastCompletedStarNum == 3) && (gCurrCourseNum == COURSE_RR )) star_dance_bound_yaw(c, 0x0, 0x800);
|
||||
#endif
|
||||
}
|
||||
|
||||
void cutscene_dance_fly_away_approach_mario(struct Camera *c) {
|
||||
|
||||
@@ -704,8 +704,8 @@ void random_vec3s(Vec3s dst, s16 xRange, s16 yRange, s16 zRange);
|
||||
s32 clamp_positions_and_find_yaw(Vec3f pos, Vec3f origin, f32 xMax, f32 xMin, f32 zMax, f32 zMin);
|
||||
s32 is_range_behind_surface(Vec3f from, Vec3f to, struct Surface *surf, s16 range, s16 surfType);
|
||||
void scale_along_line(Vec3f dest, Vec3f from, Vec3f to, f32 scale);
|
||||
s16 calculate_pitch(Vec3f from, Vec3f to);
|
||||
s16 calculate_yaw(Vec3f from, Vec3f to);
|
||||
s32 calculate_pitch(Vec3f from, Vec3f to);
|
||||
s32 calculate_yaw(Vec3f from, Vec3f to);
|
||||
void calculate_angles(Vec3f from, Vec3f to, s16 *pitch, s16 *yaw);
|
||||
f32 calc_abs_dist(Vec3f a, Vec3f b);
|
||||
f32 calc_abs_dist_squared(Vec3f a, Vec3f b);
|
||||
|
||||
@@ -611,15 +611,15 @@ void push_mario_out_of_object(struct MarioState *m, struct Object *obj, f32 padd
|
||||
|
||||
f32 offsetX = m->pos[0] - obj->oPosX;
|
||||
f32 offsetZ = m->pos[2] - obj->oPosZ;
|
||||
f32 distance = (sqr(offsetX) + sqr(offsetZ));
|
||||
f32 distanceSquared = (sqr(offsetX) + sqr(offsetZ));
|
||||
|
||||
if (distance < sqr(minDistance)) {
|
||||
if (distanceSquared < sqr(minDistance)) {
|
||||
struct Surface *floor;
|
||||
s16 pushAngle;
|
||||
f32 newMarioX;
|
||||
f32 newMarioZ;
|
||||
|
||||
if (distance == 0.0f) {
|
||||
if (distanceSquared == 0.0f) {
|
||||
pushAngle = m->faceAngle[1];
|
||||
} else {
|
||||
pushAngle = atan2s(offsetZ, offsetX);
|
||||
@@ -1442,8 +1442,13 @@ u32 interact_koopa_shell(struct MarioState *m, UNUSED u32 interactType, struct O
|
||||
update_mario_sound_and_camera(m);
|
||||
play_shell_music();
|
||||
mario_drop_held_object(m);
|
||||
|
||||
#ifdef SHELL_CANCEL_FIX
|
||||
return set_mario_action(m, ((m->pos[0] > m->floorHeight) ? ACT_RIDING_SHELL_FALL : ACT_RIDING_SHELL_GROUND), 0);
|
||||
#else
|
||||
//! Puts Mario in ground action even when in air, making it easy to
|
||||
// escape air actions into crouch slide (shell cancel)
|
||||
return set_mario_action(m, ACT_RIDING_SHELL_GROUND, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
push_mario_out_of_object(m, obj, 2.0f);
|
||||
@@ -1644,17 +1649,8 @@ u32 mario_can_talk(struct MarioState *m, u32 arg) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef VERSION_JP
|
||||
#define READ_MASK (INPUT_B_PRESSED)
|
||||
#else
|
||||
#define READ_MASK (INPUT_B_PRESSED | INPUT_A_PRESSED)
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_JP
|
||||
#define SIGN_RANGE 0x38E3
|
||||
#else
|
||||
#define SIGN_RANGE 0x4000
|
||||
#endif
|
||||
#define READ_MASK (INPUT_A_PRESSED | INPUT_B_PRESSED)
|
||||
#define SIGN_RANGE DEGREES(45)
|
||||
|
||||
u32 check_read_sign(struct MarioState *m, struct Object *obj) {
|
||||
if ((m->input & READ_MASK) && mario_can_talk(m, 0) && object_facing_mario(m, obj, SIGN_RANGE)) {
|
||||
@@ -1840,11 +1836,9 @@ void mario_handle_special_floors(struct MarioState *m) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(m->action & ACT_FLAG_AIR) && !(m->action & ACT_FLAG_SWIMMING)) {
|
||||
switch (floorType) {
|
||||
case SURFACE_BURNING:
|
||||
check_lava_boost(m);
|
||||
break;
|
||||
if (!(m->action & (ACT_FLAG_AIR | ACT_FLAG_SWIMMING))) {
|
||||
if (floorType == SURFACE_BURNING) {
|
||||
check_lava_boost(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,6 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) {
|
||||
|
||||
if (gSavedCourseNum != gCurrCourseNum) {
|
||||
gSavedCourseNum = gCurrCourseNum;
|
||||
nop_change_course();
|
||||
disable_warp_checkpoint();
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ void spawn_macro_objects(s32 areaIndex, s16 *macroObjList) {
|
||||
// Spawn the new macro object.
|
||||
newObj = spawn_object_abs_with_rot(&gMacroObjectDefaultParent, // Parent object
|
||||
0, // Unused
|
||||
MacroObjectPresets[presetID].model, // Model ID
|
||||
MacroObjectPresets[presetID].behavior, // Behavior address
|
||||
preset.model, // Model ID
|
||||
preset.behavior, // Behavior address
|
||||
macroObject[MACRO_OBJ_X], // X-position
|
||||
macroObject[MACRO_OBJ_Y], // Y-position
|
||||
macroObject[MACRO_OBJ_Z], // Z-position
|
||||
|
||||
@@ -940,10 +940,10 @@ static u32 set_mario_action_cutscene(struct MarioState *m, u32 action, UNUSED u3
|
||||
*/
|
||||
u32 set_mario_action(struct MarioState *m, u32 action, u32 actionArg) {
|
||||
switch (action & ACT_GROUP_MASK) {
|
||||
case ACT_GROUP_MOVING: action = set_mario_action_moving (m, action, actionArg); break;
|
||||
case ACT_GROUP_AIRBORNE: action = set_mario_action_airborne (m, action, actionArg); break;
|
||||
case ACT_GROUP_MOVING: action = set_mario_action_moving( m, action, actionArg); break;
|
||||
case ACT_GROUP_AIRBORNE: action = set_mario_action_airborne( m, action, actionArg); break;
|
||||
case ACT_GROUP_SUBMERGED: action = set_mario_action_submerged(m, action, actionArg); break;
|
||||
case ACT_GROUP_CUTSCENE: action = set_mario_action_cutscene (m, action, actionArg); break;
|
||||
case ACT_GROUP_CUTSCENE: action = set_mario_action_cutscene( m, action, actionArg); break;
|
||||
}
|
||||
|
||||
// Resets the sound played flags, meaning Mario can play those sound types again.
|
||||
@@ -1735,12 +1735,12 @@ s32 execute_mario_action(struct MarioState *m) {
|
||||
while (inLoop) {
|
||||
switch (m->action & ACT_GROUP_MASK) {
|
||||
case ACT_GROUP_STATIONARY: inLoop = mario_execute_stationary_action(m); break;
|
||||
case ACT_GROUP_MOVING: inLoop = mario_execute_moving_action (m); break;
|
||||
case ACT_GROUP_AIRBORNE: inLoop = mario_execute_airborne_action (m); break;
|
||||
case ACT_GROUP_SUBMERGED: inLoop = mario_execute_submerged_action (m); break;
|
||||
case ACT_GROUP_CUTSCENE: inLoop = mario_execute_cutscene_action (m); break;
|
||||
case ACT_GROUP_AUTOMATIC: inLoop = mario_execute_automatic_action (m); break;
|
||||
case ACT_GROUP_OBJECT: inLoop = mario_execute_object_action (m); break;
|
||||
case ACT_GROUP_MOVING: inLoop = mario_execute_moving_action(m); break;
|
||||
case ACT_GROUP_AIRBORNE: inLoop = mario_execute_airborne_action(m); break;
|
||||
case ACT_GROUP_SUBMERGED: inLoop = mario_execute_submerged_action(m); break;
|
||||
case ACT_GROUP_CUTSCENE: inLoop = mario_execute_cutscene_action(m); break;
|
||||
case ACT_GROUP_AUTOMATIC: inLoop = mario_execute_automatic_action(m); break;
|
||||
case ACT_GROUP_OBJECT: inLoop = mario_execute_object_action(m); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -804,7 +804,10 @@ s32 cur_obj_check_if_near_animation_end(void) {
|
||||
u32 animFlags = (s32) o->header.gfx.animInfo.curAnim->flags;
|
||||
s32 animFrame = o->header.gfx.animInfo.animFrame;
|
||||
s32 nearLoopEnd = o->header.gfx.animInfo.curAnim->loopEnd - 2;
|
||||
return ((animFlags & ANIM_FLAG_NOLOOP && nearLoopEnd + 1 == animFrame) || animFrame == nearLoopEnd);
|
||||
if (animFlags & ANIM_FLAG_NOLOOP && nearLoopEnd + 1 == animFrame) {
|
||||
return TRUE;
|
||||
}
|
||||
return (animFrame == nearLoopEnd);
|
||||
}
|
||||
|
||||
s32 cur_obj_check_if_at_animation_end(void) {
|
||||
@@ -1968,7 +1971,10 @@ s32 cur_obj_mario_far_away(void) {
|
||||
}
|
||||
|
||||
s32 is_mario_moving_fast_or_in_air(s32 speedThreshold) {
|
||||
return ((gMarioStates[0].forwardVel > speedThreshold) || (gMarioStates[0].action & ACT_FLAG_AIR));
|
||||
return (
|
||||
(gMarioState->forwardVel > speedThreshold) ||
|
||||
(gMarioState->action & ACT_FLAG_AIR)
|
||||
);
|
||||
}
|
||||
|
||||
s32 is_item_in_array(s8 item, s8 *array) {
|
||||
|
||||
@@ -420,7 +420,6 @@ void geo_process_perspective(struct GraphNodePerspective *node) {
|
||||
if (node->fnNode.node.children != NULL) {
|
||||
u16 perspNorm;
|
||||
f32 farClip = node->far;
|
||||
f32 farClipDelta = farClip;
|
||||
Mtx *mtx = alloc_display_list(sizeof(*mtx));
|
||||
#ifdef WIDE
|
||||
if (gConfig.widescreen && (gCurrLevelNum != 0x01)){
|
||||
|
||||
Reference in New Issue
Block a user