Merge master/2.0.5 into 2.1.0 (#536)

* Imminent fixes for bugs found on master branch (#512)

* The vanilla level checks define for Yoshi is inverted, causing him to require 120 stars when it is off and appear at 0 stars when it's on

*  The downwarp fix results in Mario levitating in midair when grabbing Bowser midair. While downwarps should still be fixed, the change should be reverted immediately until a better fix is made.

*  Some checks of Mario's floor class were using the wrong defines, which can lead to unexpected behavior in the event anyone wants to reorder surface types. By default the SURFACE_CLASS_SLIPPERY and SURFACE_SLIPPERY defines have the same value, which is why this mistake is hard to notice.

*  The firsty frames define was implemented poorly, not allowing for vanilla firsty behavior no matter what the values were set to. This has been reverted, while avoiding the UB in the original vanilla code.

*  Removed the ledge grab changes that fix QSLGs and change the false ledgegrab define since Arceveti wanted to in his PR

* Update version to 2.0.4 (#515)

* HackerSM64 2.0.5 (#517)

* Bugfix: race condition with accessing cleared audio memory pools

* Bugfix: skyboxes access tiles out of range when looking straight down (#518)

* Vscode fixes (#516)

* Revert s32 angles and remove Angle typedef usage (#529)

* Fix some surface shadowing (#531)

* Delete rtc.h

* Remove `wait_for_audio_frames()`

Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
Co-authored-by: Arceveti <73617174+Arceveti@users.noreply.github.com>
Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com>

* Update VERSION.txt (#534)

Co-authored-by: arthurtilly <32559225+arthurtilly@users.noreply.github.com>
Co-authored-by: axollyon <20480418+axollyon@users.noreply.github.com>
Co-authored-by: Gregory Heskett <gheskett@gmail.com>
Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com>
This commit is contained in:
Arceveti
2022-11-28 15:06:34 -05:00
committed by GitHub
parent 86841a3385
commit 1098ea95ea
26 changed files with 146 additions and 226 deletions

View File

@@ -31,7 +31,7 @@
"compilerPath": "/usr/bin/mips-linux-gnu-gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
"intelliSenseMode": "linux-gcc-x86"
}
],
"version": 4

View File

@@ -873,8 +873,16 @@ $(ELF): $(BUILD_DIR)/sm64_prelim.elf $(BUILD_DIR)/asm/debug/map.o $(O_FILES) $(Y
$(V)$(LD) --gc-sections -L $(BUILD_DIR) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -T goddard.txt -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L$(LIBS_DIR) -l$(ULTRALIB) -Llib $(LINK_LIBRARIES) -u sprintf -u osMapTLB -Llib/gcclib/$(LIBGCCDIR) -lgcc -lrtc
# Build ROM
ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS))))
# run with -n / --dry-run
$(ROM):
@$(PRINT) "$(BLUE)DRY RUNS ARE DISABLED$(NO_COL)\n"
else
# not running with -n / --dry-run
$(ROM): $(ELF)
$(call print,Building ROM:,$<,$@)
endif
ifeq ($(CONSOLE),n64)
$(V)$(OBJCOPY) --pad-to=0x101000 --gap-fill=0xFF $< $@ -O binary
else ifeq ($(CONSOLE),bb)

View File

@@ -14,7 +14,7 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin
- **ArcticJaguar725**: Most audio configuration and layout changes, colored ia4 text, floombas, various bugfixes, and more
- **CowQuack**: Adjustable skybox sizes, area-specific skybox function
- **thecozies**: Water surface types, general maintenance, and time
- **MrComit**: General use object defines, JUMP_KICK_FIX, LEDGE_GRABS_CHECK_SLOPE_ANGLE
- **MrComit**: General use object defines, JUMP_KICK_FIX
- **aglab2**: Bugfixes (particularly puppycam), refactor stuff
- **someone2639**: math.s and crash screen disam, stack trace, map packing, shiftable segments 2, S2DEX engine
- **Arthurtilly**: Platform Displacement 2
@@ -61,7 +61,6 @@ Thanks to Frame#5375 and AloXado320 for also helping with silhouette stuff
- Toggle to disable fall damage and the fall damage sound *
- Nonstop stars *
- Removed course-specific camera processing *
- You can increase the number of frames that you have to perform a firsty *
- Ability to set Mario's movement speed when hanging from a ceiling *
- Tighter hanging controls (Mario will face the direction of the analog stick directly while hanging from a ceiling) *
- reonucam3: custom camera by Reonu. This is included as a .patch file in the enhancements folder, you need to apply it if you want this camera.

View File

@@ -1 +1 @@
v2.0.3
v2.0.5

View File

@@ -108,20 +108,15 @@
*/
#define HANGING_FIX
/**
* The last frame after hitting a wall that will be considered a firsty when wallkicking.
*/
#define FIRSTY_LAST_FRAME 1
/**
* The maximum angle the player can wall kick, in degrees. 0..90. To allow 45 degree wall kicks, you must supply `46` to allow 45 and under.
*/
#define WALL_KICK_DEGREES 45
/**
* This is vanilla behavior, disable it to allow ledge grabbing regardless of floor pitch.
* Makes Mario unable to ledge grab steep slopes to prevent false ledge grabs.
*/
// #define LEDGE_GRABS_CHECK_SLOPE_ANGLE
// #define DONT_LEDGE_GRAB_STEEP_SLOPES
/**
* Disables BLJs and crushes SimpleFlips's dreams.

View File

@@ -1,71 +0,0 @@
/*---------------------------------------------------------------------
Copyright (C) 1997, 1998 Nintendo.
File rtc.h
Coded by Shigeo Kimura. Oct 14, 1997.
Modified by Koji Mitsunari. Jan 22, 2001.
Comments Real Time Clock Library
---------------------------------------------------------------------*/
#ifndef _rtc_h_
#define _rtc_h_
/*-----------------------------------------------------------------------
* Macro & constant definitions
*-----------------------------------------------------------------------*/
/* Controller type */
#define CONT_TYPE_RTC 0x1000 /* from os.h */
#define RTC_WAIT 300
/* RTC status signed 32bits */
#define RTC_NG_NOTHING 0x8000
#define RTC_NG_WRITE 0x0100
#define RTC_NG_ADDR 0x0200
#define RTC_STATUS_BUSY 0x0080
#define RTC_STATUS_DDOWN 0x0002
#define RTC_STATUS_BDOWN 0x0001
/* RTC Error Code */
#define CONT_ERR_RTC_BUSY 16
#define CONT_ERR_RTC_BDOWN 17
#define CONT_ERR_RTC_DDOWN 18
#define CONT_ERR_RTC_BDDOWN 19
/* RTC bit status */
#define RTC_EALM 0x80
#define RTC_ALM 0x20
#define RTC_WPB1 0x02
#define RTC_WPB0 0x01
#define RTC_MOD 0x04
#define RTC_CHLD 0x02
#define RTC_ADJ 0x01
#define RTC_ADDR_FLAG 0
#define RTC_ADDR_RAM 1
#define RTC_ADDR_TIME 2
typedef struct{
u8 sec; /* second 0-59 */
u8 min; /* minute 0-59 */
u8 hour; /* hour 0-23 */
u8 day; /* day 1-31 */
u8 week; /* week 0-6(sun,mon,..,sat) */
u8 month; /* month 1-12 */
u16 year; /* year 1901-2099 */
} OSRTCTime;
/*-----------------------------------------------------------------------
* externs
*-----------------------------------------------------------------------*/
extern s32 osRTCInit( OSMesgQueue *mq);
extern s32 osRTCReadData( OSMesgQueue *mq, u8 *);
extern s32 osRTCWriteData( OSMesgQueue *mq, u8 *);
extern s32 osRTCGetTime( OSMesgQueue *mq, OSRTCTime *);
extern s32 osRTCSetTime( OSMesgQueue *mq, OSRTCTime *);
extern u32 osRTCGetIntervalTime(OSRTCTime *, OSRTCTime *);
extern s32 osRTCGetLaterTime(OSMesgQueue *mq, u32, OSRTCTime *);
extern s32 osRTCSetAlarm( OSMesgQueue *mq, u8, u8);
extern s32 osRTCGetAlarmStat(OSMesgQueue *mq, u8 *, u8 *, int *);
extern s32 osRTCProbe( OSMesgQueue *mq);
#endif /* _rtc_h_ */

View File

@@ -248,7 +248,7 @@ enum SurfaceTypes {
enum SurfaceClass {
SURFACE_CLASS_DEFAULT,
SURFACE_CLASS_VERY_SLIPPERY = 0x0013,
SURFACE_CLASS_VERY_SLIPPERY,
SURFACE_CLASS_SLIPPERY,
SURFACE_CLASS_NOT_SLIPPERY
};

View File

@@ -99,12 +99,6 @@ typedef s8 ObjAction8;
typedef s32 ObjAction32;
typedef s16 ColFlags;
// -- Angle --
typedef s16 Angle;
typedef u16 UAngle;
typedef s32 Angle32;
typedef Angle Vec3a[3];
// -- Collision --
typedef ROOM_DATA_TYPE RoomData;
typedef COLLISION_DATA_TYPE Collision; // Collision is by default an s16, but it's best to have it match the type of COLLISION_DATA_TYPE
@@ -490,10 +484,10 @@ struct MarioState {
Vec3f prevPos;
f32 lateralSpeed;
f32 moveSpeed;
Angle movePitch;
Angle moveYaw;
Angle ceilYaw;
Angle wallYaw;
s16 movePitch;
s16 moveYaw;
s16 ceilYaw;
s16 wallYaw;
// -- HackerSM64 MarioState fields end --
};

View File

@@ -969,22 +969,6 @@ s32 audio_shut_down_and_reset_step(void) {
}
return (gAudioResetStatus < 3);
}
#else
/**
* Waits until a specified number of audio frames have been created
*/
void wait_for_audio_frames(s32 frames) {
// VC emulator stubs this function because busy loops are not supported
// Technically we can put infinite loop that _looks_ like -O0 for emu but this is cleaner
//if (gIsVC) {
return;
//}
gAudioFrameCount = 0;
// Sound thread will update gAudioFrameCount
while (gAudioFrameCount < frames) {
// spin
}
}
#endif
u8 sAudioIsInitialized = FALSE;
@@ -1159,22 +1143,33 @@ void init_reverb_us(s32 presetId) {
#if defined(VERSION_JP) || defined(VERSION_US)
void audio_reset_session(struct AudioSessionSettings *preset, s32 presetId) {
if (sAudioIsInitialized) {
bzero(&gAiBuffers[0][0], (AIBUFFER_LEN * NUMAIBUFFERS));
persistent_pool_clear(&gSeqLoadedPool.persistent);
persistent_pool_clear(&gBankLoadedPool.persistent);
temporary_pool_clear( &gSeqLoadedPool.temporary);
temporary_pool_clear( &gBankLoadedPool.temporary);
reset_bank_and_seq_load_status();
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
gAudioLoadLock = AUDIO_LOCK_LOADING;
init_reverb_us(presetId);
bzero(&gAiBuffers[0][0], (AIBUFFER_LEN * NUMAIBUFFERS));
gAudioFrameCount = 0;
if (!gIsVC) {
while (gAudioFrameCount < 1) {
// spin
if (!gIsVC) {
gAudioFrameCount = 0;
while (gAudioFrameCount < 1) {
// spin
}
}
for (s32 i = 0; i < gMaxSimultaneousNotes; i++) {
gNotes[i].enabled = FALSE;
}
persistent_pool_clear(&gSeqLoadedPool.persistent);
persistent_pool_clear(&gBankLoadedPool.persistent);
temporary_pool_clear( &gSeqLoadedPool.temporary);
temporary_pool_clear( &gBankLoadedPool.temporary);
reset_bank_and_seq_load_status();
init_reverb_us(presetId);
bzero(&gAiBuffers[0][0], (AIBUFFER_LEN * NUMAIBUFFERS));
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
}
}
bzero(&gAiBuffers[0][0], (AIBUFFER_LEN * NUMAIBUFFERS));
return;
}
#else

View File

@@ -503,7 +503,7 @@ void mtxf_rotate_xyz_and_translate_and_mul(Vec3s rot, Vec3f trans, Mat4 dest, Ma
* at the position 'to'. The up-vector is assumed to be (0, 1, 0), but the 'roll'
* angle allows a bank rotation of the camera.
*/
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s32 roll) {
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
Vec3f colX, colY, colZ;
register f32 dx = (to[0] - from[0]);
register f32 dz = (to[2] - from[2]);
@@ -543,7 +543,7 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s32 roll) {
* 'scale' is the scale of the object.
* 'angle' rotates the object while still facing the camera.
*/
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, Vec3f scale, s32 angle) {
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, Vec3f scale, s16 angle) {
register s32 i;
register f32 sx = scale[0];
register f32 sy = scale[1];
@@ -590,7 +590,7 @@ void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, Vec3f scale, s32 angle)
* 'scale' is the scale of the shadow
* 'yaw' is the angle which it should face
*/
void mtxf_shadow(Mat4 dest, Vec3f upDir, Vec3f pos, Vec3f scale, s32 yaw) {
void mtxf_shadow(Mat4 dest, Vec3f upDir, Vec3f pos, Vec3f scale, s16 yaw) {
Vec3f lateralDir;
Vec3f leftDir;
Vec3f forwardDir;
@@ -615,7 +615,7 @@ void mtxf_shadow(Mat4 dest, Vec3f upDir, Vec3f pos, Vec3f scale, s32 yaw) {
* 'yaw' is the angle which it should face
* 'pos' is the object's position in the world
*/
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s32 yaw) {
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
Vec3f lateralDir;
Vec3f leftDir;
Vec3f forwardDir;
@@ -640,7 +640,7 @@ void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s32 yaw) {
* 'pos' is the object's position in the world
* 'radius' is the distance from each triangle vertex to the center
*/
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s32 yaw, f32 radius) {
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
struct Surface *floor;
Vec3f point0, point1, point2;
Vec3f forward;
@@ -759,7 +759,7 @@ UNUSED void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
#define MATENTRY(a, b) \
((s16 *) mtx)[a ] = (((s32) b) >> 16); \
((s16 *) mtx)[a + 16] = (((s32) b) & 0xFFFF);
void mtxf_rotate_xy(Mtx *mtx, s32 angle) {
void mtxf_rotate_xy(Mtx *mtx, s16 angle) {
register s32 i = (coss(angle) * 0x10000);
register s32 j = (sins(angle) * 0x10000);
register f32 *temp = (f32 *)mtx;
@@ -841,7 +841,7 @@ void vec3f_get_angle(Vec3f from, Vec3f to, s16 *pitch, s16 *yaw) {
}
/// Finds the horizontal distance and pitch between two vectors.
void vec3f_get_lateral_dist_and_pitch(Vec3f from, Vec3f to, f32 *lateralDist, Angle *pitch) {
void vec3f_get_lateral_dist_and_pitch(Vec3f from, Vec3f to, f32 *lateralDist, s16 *pitch) {
Vec3f d;
vec3_diff(d, to, from);
*lateralDist = sqrtf(sqr(d[0]) + sqr(d[2]));
@@ -849,7 +849,7 @@ void vec3f_get_lateral_dist_and_pitch(Vec3f from, Vec3f to, f32 *lateralDist, An
}
/// Finds the horizontal distance and yaw between two vectors.
void vec3f_get_lateral_dist_and_yaw(Vec3f from, Vec3f to, f32 *lateralDist, Angle *yaw) {
void vec3f_get_lateral_dist_and_yaw(Vec3f from, Vec3f to, f32 *lateralDist, s16 *yaw) {
register f32 dx = (to[0] - from[0]);
register f32 dz = (to[2] - from[2]);
*lateralDist = sqrtf(sqr(dx) + sqr(dz));
@@ -857,7 +857,7 @@ void vec3f_get_lateral_dist_and_yaw(Vec3f from, Vec3f to, f32 *lateralDist, Angl
}
/// Finds the horizontal distance and angles between two vectors.
void vec3f_get_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *lateralDist, Angle *pitch, Angle *yaw) {
void vec3f_get_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *lateralDist, s16 *pitch, s16 *yaw) {
Vec3f d;
vec3_diff(d, to, from);
*lateralDist = sqrtf(sqr(d[0]) + sqr(d[2]));
@@ -866,7 +866,7 @@ void vec3f_get_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *lateralDist, An
}
/// Finds the distance and angles between two vectors.
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, Angle *pitch, Angle *yaw) {
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw) {
Vec3f d;
vec3_diff(d, to, from);
register f32 xz = (sqr(d[0]) + sqr(d[2]));
@@ -874,7 +874,7 @@ void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, Angle *pitch, Ang
*pitch = atan2s(sqrtf(xz), d[1]);
*yaw = atan2s(d[2], d[0]);
}
void vec3s_get_dist_and_angle(Vec3s from, Vec3s to, s16 *dist, Angle *pitch, Angle *yaw) {
void vec3s_get_dist_and_angle(Vec3s from, Vec3s to, s16 *dist, s16 *pitch, s16 *yaw) {
Vec3s d;
vec3_diff(d, to, from);
register f32 xz = (sqr(d[0]) + sqr(d[2]));
@@ -882,7 +882,7 @@ void vec3s_get_dist_and_angle(Vec3s from, Vec3s to, s16 *dist, Angle *pitch, Ang
*pitch = atan2s(sqrtf(xz), d[1]);
*yaw = atan2s(d[2], d[0]);
}
void vec3f_to_vec3s_get_dist_and_angle(Vec3f from, Vec3s to, f32 *dist, Angle *pitch, Angle *yaw) {
void vec3f_to_vec3s_get_dist_and_angle(Vec3f from, Vec3s to, f32 *dist, s16 *pitch, s16 *yaw) {
Vec3f d;
vec3_diff(d, to, from);
register f32 xz = (sqr(d[0]) + sqr(d[2]));
@@ -892,7 +892,7 @@ void vec3f_to_vec3s_get_dist_and_angle(Vec3f from, Vec3s to, f32 *dist, Angle *p
}
/// Finds the distance, horizontal distance, and angles between two vectors.
void vec3f_get_dist_and_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, f32 *lateralDist, Angle *pitch, Angle *yaw) {
void vec3f_get_dist_and_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, f32 *lateralDist, s16 *pitch, s16 *yaw) {
Vec3f d;
vec3_diff(d, to, from);
register f32 xz = (sqr(d[0]) + sqr(d[2]));
@@ -912,17 +912,17 @@ void vec3f_get_dist_and_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *dist,
to[1] = (from[1] + (dist * sins(pitch))); \
to[2] = (from[2] + (dcos * coss(yaw ))); \
}
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, Angle32 pitch, Angle32 yaw) {
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw) {
vec3_set_dist_and_angle(from, to, dist, pitch, yaw);
}
void vec3s_set_dist_and_angle(Vec3s from, Vec3s to, s16 dist, Angle32 pitch, Angle32 yaw) {
void vec3s_set_dist_and_angle(Vec3s from, Vec3s to, s16 dist, s16 pitch, s16 yaw) {
vec3_set_dist_and_angle(from, to, dist, pitch, yaw);
}
/**
* Similar to approach_s32, but converts to s16 and allows for overflow between 32767 and -32768
*/
s32 approach_angle(s32 current, s32 target, s32 inc) {
s16 approach_angle(s16 current, s16 target, s16 inc) {
s32 dist = (s16)(target - current);
if (dist < 0) {
dist += inc;
@@ -933,21 +933,21 @@ s32 approach_angle(s32 current, s32 target, s32 inc) {
}
return (target - dist);
}
Bool32 approach_angle_bool(s16 *current, s32 target, s32 inc) {
Bool32 approach_angle_bool(s16 *current, s16 target, s16 inc) {
*current = approach_angle(*current, target, inc);
return (*current != target);
}
s32 approach_s16(s32 current, s32 target, s32 inc, s32 dec) {
s16 approach_s16(s16 current, s16 target, s16 inc, s16 dec) {
s16 dist = (target - current);
if (dist >= 0) { // target >= current
current = ((dist > inc) ? (current + inc) : target);
} else { // target < current
current = ((dist < -dec) ? (current - dec) : target);
}
return (s16)current;
return current;
}
Bool32 approach_s16_bool(s16 *current, s32 target, s32 inc, s32 dec) {
Bool32 approach_s16_bool(s16 *current, s16 target, s16 inc, s16 dec) {
*current = approach_s16(*current, target, inc, dec);
return (*current != target);
}
@@ -1028,7 +1028,7 @@ f32 approach_f32_asymptotic(f32 current, f32 target, f32 multiplier) {
* is reached. Note: Since this function takes integers as parameters, the last argument is the
* reciprocal of what it would be in the previous two functions.
*/
s32 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor) {
s16 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor) {
s16 temp = *current;
if (divisor == 0) {
*current = target;
@@ -1045,7 +1045,7 @@ s32 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor) {
* Approaches an s16 value in the same fashion as approach_f32_asymptotic, returns the new value.
* Note: last parameter is the reciprocal of what it would be in the f32 functions
*/
s32 approach_s16_asymptotic(s16 current, s16 target, s16 divisor) {
s16 approach_s16_asymptotic(s16 current, s16 target, s16 divisor) {
s16 temp = current;
if (divisor == 0) {
current = target;
@@ -1058,7 +1058,7 @@ s32 approach_s16_asymptotic(s16 current, s16 target, s16 divisor) {
return current;
}
s32 abs_angle_diff(s16 a0, s16 a1) {
s16 abs_angle_diff(s16 a0, s16 a1) {
register s16 diff = (a1 - a0);
if (diff == -0x8000) return 0x7FFF;
return abss(diff);
@@ -1068,7 +1068,7 @@ s32 abs_angle_diff(s16 a0, s16 a1) {
* Helper function for atan2s. Does a look up of the arctangent of y/x assuming
* the resulting angle is in range [0, 0x2000] (1/8 of a circle).
*/
static u32 atan2_lookup(f32 y, f32 x) {
static u16 atan2_lookup(f32 y, f32 x) {
return x == 0
? 0x0
: atans(y / x);
@@ -1078,7 +1078,7 @@ static u32 atan2_lookup(f32 y, f32 x) {
* Compute the angle from (0, 0) to (x, y) as a s16. Given that terrain is in
* the xz-plane, this is commonly called with (z, x) to get a yaw angle.
*/
s32 atan2s(f32 y, f32 x) {
s16 atan2s(f32 y, f32 x) {
u16 ret;
if (x >= 0) {
if (y >= 0) {

View File

@@ -54,12 +54,12 @@ extern f32 gSineTable[];
#define RAD_PER_DEG (M_PI / 180.0f)
#define DEG_PER_RAD (180.0f / M_PI)
#define angle_to_degrees( x) (f32)(((Angle)(x) / 65536.0f) * 360.0f)
#define degrees_to_angle( x) (Angle)(((f32)(x) * 0x10000 ) / 360 )
#define angle_to_radians( x) (f32)(((Angle)(x) * M_PI ) / 0x8000)
#define radians_to_angle( x) (Angle)(((f32)(x) / M_PI ) * 0x8000)
#define degrees_to_radians(x) (f32)( (f32)(x) * RAD_PER_DEG )
#define radians_to_degrees(x) (f32)( (f32)(x) * DEG_PER_RAD )
#define angle_to_degrees( x) (f32)(((s16)(x) / 65536.0f) * 360.0f)
#define degrees_to_angle( x) (s16)(((f32)(x) * 0x10000 ) / 360 )
#define angle_to_radians( x) (f32)(((s16)(x) * M_PI ) / 0x8000)
#define radians_to_angle( x) (s16)(((f32)(x) / M_PI ) * 0x8000)
#define degrees_to_radians(x) (f32)( (f32)(x) * RAD_PER_DEG )
#define radians_to_degrees(x) (f32)( (f32)(x) * DEG_PER_RAD )
#define signum_positive(x) ((x < 0) ? -1 : 1)
@@ -538,15 +538,15 @@ void vec3f_normalize(Vec3f dest);
void mtxf_copy(Mat4 dest, Mat4 src);
void mtxf_identity(Mat4 mtx);
void mtxf_translate(Mat4 dest, Vec3f b);
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s32 roll);
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll);
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f trans, Vec3s rot);
void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f trans, Vec3s rot);
void mtxf_rotate_zxy_and_translate_and_mul(Vec3s rot, Vec3f trans, Mat4 dest, Mat4 src);
void mtxf_rotate_xyz_and_translate_and_mul(Vec3s rot, Vec3f trans, Mat4 dest, Mat4 src);
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, Vec3f scale, s32 angle);
void mtxf_shadow(Mat4 dest, Vec3f upDir, Vec3f pos, Vec3f scale, s32 yaw);
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s32 yaw);
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s32 yaw, f32 radius);
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, Vec3f scale, s16 angle);
void mtxf_shadow(Mat4 dest, Vec3f upDir, Vec3f pos, Vec3f scale, s16 yaw);
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw);
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 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);
@@ -557,36 +557,36 @@ ALWAYS_INLINE void mtxf_to_mtx(register void *dest, register void *src) {
// guMtxF2L(src, dest);
}
void mtxf_rotate_xy(Mtx *mtx, s32 angle);
void mtxf_rotate_xy(Mtx *mtx, s16 angle);
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
void linear_mtxf_mul_vec3f_and_translate(Mat4 m, Vec3f dst, Vec3f v);
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
void vec2f_get_lateral_dist( Vec2f from, Vec2f to, f32 *lateralDist );
void vec3f_get_lateral_dist( Vec3f from, Vec3f to, f32 *lateralDist );
void vec3f_get_lateral_dist_squared( Vec3f from, Vec3f to, f32 *lateralDist );
void vec3f_get_dist( Vec3f from, Vec3f to, f32 *dist );
void vec3f_get_dist_squared( Vec3f from, Vec3f to, f32 *dist );
void vec3f_get_dist_and_yaw( Vec3f from, Vec3f to, f32 *dist, Angle *yaw);
void vec3f_get_pitch( Vec3f from, Vec3f to, Angle *pitch );
void vec3f_get_yaw( Vec3f from, Vec3f to, Angle *yaw);
void vec3f_get_angle( Vec3f from, Vec3f to, Angle *pitch, Angle *yaw);
void vec3f_get_lateral_dist_and_pitch( Vec3f from, Vec3f to, f32 *lateralDist, Angle *pitch );
void vec3f_get_lateral_dist_and_yaw( Vec3f from, Vec3f to, f32 *lateralDist, Angle *yaw);
void vec3f_get_lateral_dist_and_angle( Vec3f from, Vec3f to, f32 *lateralDist, Angle *pitch, Angle *yaw);
void vec3f_get_dist_and_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, f32 *lateralDist, Angle *pitch, Angle *yaw);
void vec3f_get_dist_and_angle( Vec3f from, Vec3f to, f32 *dist, Angle *pitch, Angle *yaw);
void vec3s_get_dist_and_angle( Vec3s from, Vec3s to, s16 *dist, Angle *pitch, Angle *yaw);
void vec3f_to_vec3s_get_dist_and_angle( Vec3f from, Vec3s to, f32 *dist, Angle *pitch, Angle *yaw);
void vec3s_set_dist_and_angle( Vec3s from, Vec3s to, s16 dist, Angle32 pitch, Angle32 yaw);
void vec3f_set_dist_and_angle( Vec3f from, Vec3f to, f32 dist, Angle32 pitch, Angle32 yaw);
void vec2f_get_lateral_dist( Vec2f from, Vec2f to, f32 *lateralDist );
void vec3f_get_lateral_dist( Vec3f from, Vec3f to, f32 *lateralDist );
void vec3f_get_lateral_dist_squared( Vec3f from, Vec3f to, f32 *lateralDist );
void vec3f_get_dist( Vec3f from, Vec3f to, f32 *dist );
void vec3f_get_dist_squared( Vec3f from, Vec3f to, f32 *dist );
void vec3f_get_dist_and_yaw( Vec3f from, Vec3f to, f32 *dist, s16 *yaw);
void vec3f_get_pitch( Vec3f from, Vec3f to, s16 *pitch );
void vec3f_get_yaw( Vec3f from, Vec3f to, s16 *yaw);
void vec3f_get_angle( Vec3f from, Vec3f to, s16 *pitch, s16 *yaw);
void vec3f_get_lateral_dist_and_pitch( Vec3f from, Vec3f to, f32 *lateralDist, s16 *pitch );
void vec3f_get_lateral_dist_and_yaw( Vec3f from, Vec3f to, f32 *lateralDist, s16 *yaw);
void vec3f_get_lateral_dist_and_angle( Vec3f from, Vec3f to, f32 *lateralDist, s16 *pitch, s16 *yaw);
void vec3f_get_dist_and_lateral_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, f32 *lateralDist, s16 *pitch, s16 *yaw);
void vec3f_get_dist_and_angle( Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw);
void vec3s_get_dist_and_angle( Vec3s from, Vec3s to, s16 *dist, s16 *pitch, s16 *yaw);
void vec3f_to_vec3s_get_dist_and_angle( Vec3f from, Vec3s to, f32 *dist, s16 *pitch, s16 *yaw);
void vec3s_set_dist_and_angle( Vec3s from, Vec3s to, s16 dist, s16 pitch, s16 yaw);
void vec3f_set_dist_and_angle( Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw);
s32 approach_angle(s32 current, s32 target, s32 inc);
s32 approach_s16(s32 current, s32 target, s32 inc, s32 dec);
s16 approach_angle(s16 current, s16 target, s16 inc);
s16 approach_s16(s16 current, s16 target, s16 inc, s16 dec);
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec);
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec);
Bool32 approach_angle_bool(s16 *current, s32 target, s32 inc);
Bool32 approach_s16_bool(s16 *current, s32 target, s32 inc, s32 dec);
Bool32 approach_angle_bool(s16 *current, s16 target, s16 inc);
Bool32 approach_s16_bool(s16 *current, s16 target, s16 inc, s16 dec);
Bool32 approach_s32_bool(s32 *current, s32 target, s32 inc, s32 dec);
Bool32 approach_f32_bool(f32 *current, f32 target, f32 inc, f32 dec);
#define approach_s16_symmetric(current, target, inc) approach_s16((current), (target), (inc), (inc))
@@ -598,10 +598,10 @@ Bool32 approach_f32_bool(f32 *current, f32 target, f32 inc, f32 dec);
s32 approach_f32_signed(f32 *current, f32 target, f32 inc);
s32 approach_f32_asymptotic_bool(f32 *current, f32 target, f32 multiplier);
f32 approach_f32_asymptotic(f32 current, f32 target, f32 multiplier);
s32 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor);
s32 approach_s16_asymptotic(s16 current, s16 target, s16 divisor);
s32 abs_angle_diff(s16 a0, s16 a1);
s32 atan2s(f32 y, f32 x);
s16 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor);
s16 approach_s16_asymptotic(s16 current, s16 target, s16 divisor);
s16 abs_angle_diff(s16 a0, s16 a1);
s16 atan2s(f32 y, f32 x);
f32 atan2f(f32 a, f32 b);
void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c);
void anim_spline_init(Vec4s *keyFrames);

View File

@@ -459,7 +459,7 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
height = get_surface_height_at_location(x, z, surf);
// Exclude floors lower than the previous highest floor.
if (height < *pheight) continue;
if (height <= *pheight) continue;
// Checks for floor interaction with a FIND_FLOOR_BUFFER unit buffer.
if (bufferY < height) continue;
@@ -734,7 +734,7 @@ s32 find_water_level(s32 x, s32 z) { // TODO: Allow y pos
// If the location is within a water box and it is a water box.
// Water is less than 50 val only, while above is gas and such.
if (loX < x && x < hiX && loZ < z && z < hiZ && val < 50) {
if (loX <= x && x <= hiX && loZ <= z && z <= hiZ && val < 50) {
// Set the water height. Since this breaks, only return the first height.
waterLevel = *p;
break;

View File

@@ -178,7 +178,7 @@ static void boo_set_move_yaw_for_during_hit(s32 hurt) {
}
// Boo Roll
static Angle sBooHitRotations[] = {
static s16 sBooHitRotations[] = {
0x179F, 0x1620, 0x14AC, 0x1346,
0x11EB, 0x109E, 0x0B75, 0x0E28,
0x0D01, 0x0BE6, 0x0AD7, 0x09D5,

View File

@@ -68,7 +68,7 @@ void hoot_free_step(s16 fastOscY, s32 speed) {
void hoot_player_set_yaw(void) {
#ifdef HOOT_YAW_FIX
Angle turnSpeed = gMarioState->intendedMag * 0x20;
s16 turnSpeed = gMarioState->intendedMag * 0x20;
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, gMarioState->intendedYaw, turnSpeed);
#else
s16 stickX = gPlayer3Controller->rawStickX;
@@ -193,7 +193,7 @@ void hoot_action_loop(void) {
}
void hoot_turn_to_home(void) {
Angle pitchToHome, yawToHome;
s16 pitchToHome, yawToHome;
vec3f_get_angle(&o->oPosVec, &o->oHomeVec, &pitchToHome, &yawToHome);
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, yawToHome, 0x140);

View File

@@ -8,10 +8,10 @@ enum LLLOctagonalMeshInstructions {
};
struct LllOctagonalMeshAction {
s16 instruction;
s16 time;
Angle moveAngle;
s16 forwardVel;
s16 instruction;
s16 time;
s16 moveAngle;
s16 forwardVel;
};
// Path for big bullies platforms

View File

@@ -384,7 +384,7 @@ void bhv_platform_on_track_update(void) {
platform_on_track_rock_ski_lift();
} else if (o->oPlatformOnTrackType == PLATFORM_ON_TRACK_TYPE_CARPET) {
#ifdef CONTROLLABLE_PLATFORM_SPEED
Angle targetRoll; // Visually, this is the platform's pitch, since these platforms technically move sideways
s16 targetRoll; // Visually, this is the platform's pitch, since these platforms technically move sideways
if (gMarioObject->platform == o) {
if (!o->oPlatformOnTrackWasStoodOn) {
o->oPlatformOnTrackOffsetY = -8.0f;

View File

@@ -39,7 +39,7 @@ void bhv_collect_star_loop(void) {
}
void bhv_star_spawn_init(void) {
Angle yaw;
s16 yaw;
vec3f_get_lateral_dist_and_yaw(&o->oPosVec, &o->oHomeVec, &o->oStarSpawnDisFromHome, &yaw);
o->oMoveAngleYaw = yaw;
o->oVelY = (o->oHomeY - o->oPosY) / 30.0f;

View File

@@ -11,7 +11,7 @@ void bhv_yoshi_init(void) {
o->oBuoyancy = 1.3f;
o->oInteractionSubtype = INT_SUBTYPE_NPC;
#if defined(ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS) || defined(UNLOCK_ALL)
#if !defined(ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS) || defined(UNLOCK_ALL)
if (sYoshiDead == TRUE) {
#else
if ((save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_NUM_TO_INDEX(COURSE_MIN), COURSE_NUM_TO_INDEX(COURSE_MAX)) < 120)

View File

@@ -4257,7 +4257,7 @@ s32 is_pos_in_bounds(Vec3f pos, Vec3f center, Vec3f bounds, s16 boundsYaw) {
-bounds[2] < rel[2] && rel[2] < bounds[2]);
}
s32 calculate_pitch(Vec3f from, Vec3f to) {
s16 calculate_pitch(Vec3f from, Vec3f to) {
f32 dx = to[0] - from[0];
f32 dy = to[1] - from[1];
f32 dz = to[2] - from[2];
@@ -4266,7 +4266,7 @@ s32 calculate_pitch(Vec3f from, Vec3f to) {
return pitch;
}
s32 calculate_yaw(Vec3f from, Vec3f to) {
s16 calculate_yaw(Vec3f from, Vec3f to) {
f32 dx = to[0] - from[0];
// UNUSED f32 dy = to[1] - from[1];
f32 dz = to[2] - from[2];

View File

@@ -750,8 +750,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);
s32 calculate_pitch(Vec3f from, Vec3f to);
s32 calculate_yaw(Vec3f from, Vec3f to);
s16 calculate_pitch(Vec3f from, Vec3f to);
s16 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);

Some files were not shown because too many files have changed in this diff Show More