Added back the beta trampoline code from earlier PRs+minor tweaks

This commit is contained in:
Colton Rushton 2021-02-17 23:47:26 -04:00
parent 9128f60553
commit be23d6018c
5 changed files with 48 additions and 8 deletions

View File

@ -195,6 +195,11 @@
#define /*0x0FC*/ oBackAndForthPlatformUnkFC OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oBackAndForthPlatformUnk100 OBJECT_FIELD_F32(0x1E)
/* Beta Trampoline */
#ifdef QOL_FIXES
#define /*0x098*/ oBetaTrampolineAdditiveYVel OBJECT_FIELD_F32(0x04)
#endif
/* Bird */
#define /*0x0F4*/ oBirdSpeed OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oBirdTargetPitch OBJECT_FIELD_S32(0x1C)

View File

@ -30,7 +30,11 @@ void bhv_beta_trampoline_spring_loop(void) {
// must be replaced with 150 (the height of the trampoline).
// Note that all of the numbers in this if/else block are doubles.
if ((yDisplacement = o->oPosY - o->oHomeY) >= 0) {
#ifndef QOL_FIXES
yScale = yDisplacement / 10.0 + 1.0;
#else
yScale = yDisplacement / 150.0f + 1.0;
#endif
} else {
// Otherwise (if the trampoline is compressed),
// scale by 1 - (the displacement)/500.
@ -38,7 +42,12 @@ void bhv_beta_trampoline_spring_loop(void) {
// must be replaced with 150 (the height of the trampoline),
// as with the above code.
yDisplacement = -yDisplacement;
#ifndef QOL_FIXES
yScale = 1.0 - yDisplacement / 500.0;
#else
yScale = 1.0 - yDisplacement / 150.0f;
o->oPosY += 75.0f * (1.0f - yScale);
#endif
}
// Scale the spring
@ -73,9 +82,29 @@ void bhv_beta_trampoline_top_loop(void) {
// when Mario's on it in this if statement?
if (gMarioObject->platform == o) {
o->oBetaTrampolineMarioOnTrampoline = TRUE;
#ifdef QOL_FIXES
o->oPosY =
(o->oPosY > (o->oHomeY - 150.0f + 75.0f)) ?
(o->oPosY - 10) :
(o->oHomeY - 150.0f + 65.0f);
o->oBetaTrampolineAdditiveYVel =
((o->oBehParams2ndByte >> 4) / 2.0f) +
((o->oHomeY - o->oPosY) / ((o->oBehParams2ndByte & 0x0F) / 2.0f));
#endif
} else {
o->oBetaTrampolineMarioOnTrampoline = FALSE;
o->oPosY = o->oHomeY;
#ifdef QOL_FIXES
o->oPosY =
(o->oPosY > (o->oHomeY - 150.0f + 75.0f)) ?
(o->oPosY - 10) :
(o->oHomeY - 150.0f + 65.0f);
o->oBetaTrampolineAdditiveYVel =
((o->oBehParams2ndByte >> 4) / 2.0f) +
((o->oHomeY - o->oPosY) / ((o->oBehParams2ndByte & 0x0F) / 2.0f));
#endif
}
// This function is from mario_step.c, and is empty.

View File

@ -350,7 +350,6 @@ void bhv_big_bully_with_minions_loop(void) {
// for counting the number of dead minions. This means that when it activates,
// the knockback timer is at 3 instead of 0. So the bully knockback time will
// be reduced by 3 frames (16.67%) on the first hit.
//
if (o->oBullyKBTimerAndMinionKOCounter == 3) {
play_puzzle_jingle();

View File

@ -786,9 +786,6 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8
if (currentIndex[0] < maxIndex) {
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
currentIndex[0]++;
// this allows the pause menu arrow to loop when stick up is held down
} else if (currentIndex[0] >= maxIndex) {
currentIndex[0] = minIndex;
}
#endif
}
@ -806,10 +803,6 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8
if (currentIndex[0] > minIndex) {
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
currentIndex[0]--;
// same as above, but with stick down instead of stick up
} else if (currentIndex[0] <= minIndex) {
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
currentIndex[0] = maxIndex;
}
#endif
}

View File

@ -8,6 +8,9 @@
#include "game_init.h"
#include "interaction.h"
#include "mario_step.h"
#ifdef QOL_FIXES
#include "object_list_processor.h"
#endif
static s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 };
@ -16,6 +19,10 @@ struct Surface gWaterSurfacePseudoFloor = {
{ 0.0f, 1.0f, 0.0f }, 0.0f, NULL,
};
#ifdef QOL_FIXES
static struct Object *sTrampoline;
#endif
/**
* Always returns zero. This may have been intended
* to be used for the beta trampoline. Its return value
@ -27,7 +34,11 @@ struct Surface gWaterSurfacePseudoFloor = {
* and if so return a higher value than 0.
*/
f32 get_additive_y_vel_for_jumps(void) {
#ifndef QOL_FIXES
return 0.0f;
#else
return (sTrampoline != NULL) ? sTrampoline->oBetaTrampolineAdditiveYVel : 0.0f;
#endif
}
/**
@ -50,6 +61,9 @@ void stub_mario_step_1(UNUSED struct MarioState *x) {
* or to set a variable with its intended additive Y vel.
*/
void stub_mario_step_2(void) {
#ifdef QOL_FIXES
sTrampoline = gCurrentObject;
#endif
}
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2) {